@documentation-robotics/cli 0.3.0 → 0.4.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/README.md +10 -14
- package/dist/analyzers/active-analyzer.js +62 -0
- package/dist/analyzers/active-analyzer.js.map +7 -0
- package/dist/analyzers/cards/build.js +21 -1
- package/dist/analyzers/cards/build.js.map +2 -2
- package/dist/analyzers/cards/extract.js +138 -0
- package/dist/analyzers/cards/extract.js.map +7 -0
- package/dist/analyzers/cards/routes.js +96 -0
- package/dist/analyzers/cards/routes.js.map +7 -0
- package/dist/analyzers/cbm-analyzer.js +76 -4
- package/dist/analyzers/cbm-analyzer.js.map +2 -2
- package/dist/analyzers/cbm-responses.js +12 -6
- package/dist/analyzers/cbm-responses.js.map +2 -2
- package/dist/analyzers/code-changes.js +159 -0
- package/dist/analyzers/code-changes.js.map +7 -0
- package/dist/analyzers/edge-relationships.js +6 -2
- package/dist/analyzers/edge-relationships.js.map +2 -2
- package/dist/analyzers/extraction-plan.js +541 -0
- package/dist/analyzers/extraction-plan.js.map +7 -0
- package/dist/analyzers/index-job.js +229 -0
- package/dist/analyzers/index-job.js.map +7 -0
- package/dist/cli.js +12 -10
- package/dist/cli.js.map +2 -2
- package/dist/coding-agents/drbot-mcp.js +120 -18
- package/dist/coding-agents/drbot-mcp.js.map +2 -2
- package/dist/commands/add.js +4 -2
- package/dist/commands/add.js.map +2 -2
- package/dist/commands/analyzer.js +35 -35
- package/dist/commands/analyzer.js.map +2 -2
- package/dist/commands/changeset-verify.js +16 -8
- package/dist/commands/changeset-verify.js.map +2 -2
- package/dist/commands/changeset.js +41 -11
- package/dist/commands/changeset.js.map +2 -2
- package/dist/commands/init.js +9 -26
- package/dist/commands/init.js.map +2 -2
- package/dist/commands/mcp.js +35 -31
- package/dist/commands/mcp.js.map +3 -3
- package/dist/commands/relationship.js +2 -12
- package/dist/commands/relationship.js.map +2 -2
- package/dist/commands/reports.js +3 -3
- package/dist/commands/reports.js.map +2 -2
- package/dist/commands/update.js +14 -13
- package/dist/commands/update.js.map +2 -2
- package/dist/commands/upgrade.js +28 -120
- package/dist/commands/upgrade.js.map +2 -2
- package/dist/commands/validate.js +19 -3
- package/dist/commands/validate.js.map +2 -2
- package/dist/commands/version.js +1 -1
- package/dist/commands/visualize.js +30 -12
- package/dist/commands/visualize.js.map +2 -2
- package/dist/core/annotation-store.js +15 -5
- package/dist/core/annotation-store.js.map +2 -2
- package/dist/core/catalog-migration.js +2 -1
- package/dist/core/catalog-migration.js.map +2 -2
- package/dist/core/changeset-base-index.js +7 -0
- package/dist/core/changeset-base-index.js.map +2 -2
- package/dist/core/changeset-brief-compact.js +256 -0
- package/dist/core/changeset-brief-compact.js.map +7 -0
- package/dist/core/changeset-verify.js +356 -26
- package/dist/core/changeset-verify.js.map +3 -3
- package/dist/core/extraction-observability.js +161 -0
- package/dist/core/extraction-observability.js.map +7 -0
- package/dist/core/migration-registry.js +13 -1
- package/dist/core/migration-registry.js.map +2 -2
- package/dist/core/project-init.js +53 -0
- package/dist/core/project-init.js.map +7 -0
- package/dist/core/relationship-staging.js +94 -1
- package/dist/core/relationship-staging.js.map +2 -2
- package/dist/core/staged-changeset-storage.js +83 -3
- package/dist/core/staged-changeset-storage.js.map +2 -2
- package/dist/core/staging-area.js +85 -8
- package/dist/core/staging-area.js.map +2 -2
- package/dist/core/upgrade-plan.js +117 -0
- package/dist/core/upgrade-plan.js.map +7 -0
- package/dist/generated/relationship-index.js +124 -15
- package/dist/generated/relationship-index.js.map +2 -2
- package/dist/integrations/claude_code/.claude-plugin/plugin.json +24 -0
- package/dist/integrations/claude_code/agents/dr-architect.md +19 -5
- package/dist/integrations/claude_code/agents/dr-extractor.md +7 -1
- package/dist/integrations/claude_code/commands/dr-changeset.md +2 -1
- package/dist/integrations/claude_code/commands/dr-map.md +7 -1
- package/dist/integrations/claude_code/commands/dr-plan.md +42 -16
- package/dist/integrations/claude_code/docs/MCP_SERVER.md +28 -31
- package/dist/integrations/claude_code/docs/README.md +20 -1
- package/dist/integrations/claude_code/plugin-agents/dr-advisor.md +255 -0
- package/dist/integrations/claude_code/plugin-agents/dr-architect.md +306 -0
- package/dist/integrations/claude_code/skills/dr_13_testing_layer/SKILL.md +3 -0
- package/dist/integrations/claude_code/skills/dr_change_planning/SKILL.md +90 -31
- package/dist/integrations/claude_code/skills/dr_changeset_reviewer/SKILL.md +5 -0
- package/dist/integrations/claude_code/skills/dr_engineering_guide/SKILL.md +5 -0
- package/dist/integrations/github_copilot/agents/dr-architect.md +2 -0
- package/dist/integrations/github_copilot/skills/dr_13_testing_layer/SKILL.md +3 -0
- package/dist/integrations/github_copilot/skills/dr_change_planning/SKILL.md +88 -30
- package/dist/mcp/changeset-only.js +14 -3
- package/dist/mcp/changeset-only.js.map +2 -2
- package/dist/mcp/project-root.js +85 -0
- package/dist/mcp/project-root.js.map +7 -0
- package/dist/mcp/server-instructions.js +27 -0
- package/dist/mcp/server-instructions.js.map +7 -0
- package/dist/mcp/strict-schema.js +52 -0
- package/dist/mcp/strict-schema.js.map +7 -0
- package/dist/mcp/tool-registry.js +39 -5
- package/dist/mcp/tool-registry.js.map +2 -2
- package/dist/mcp/tools/changeset-analysis-tools.js +25 -5
- package/dist/mcp/tools/changeset-analysis-tools.js.map +3 -3
- package/dist/mcp/tools/changeset-commit.js +224 -0
- package/dist/mcp/tools/changeset-commit.js.map +7 -0
- package/dist/mcp/tools/changeset-editing.js +133 -57
- package/dist/mcp/tools/changeset-editing.js.map +3 -3
- package/dist/mcp/tools/changeset-lifecycle.js +1 -1
- package/dist/mcp/tools/changeset-lifecycle.js.map +2 -2
- package/dist/mcp/tools/changeset-verify.js +12 -6
- package/dist/mcp/tools/changeset-verify.js.map +2 -2
- package/dist/mcp/tools/codebase-extract.js +836 -0
- package/dist/mcp/tools/codebase-extract.js.map +7 -0
- package/dist/mcp/tools/codebase-index.js +125 -0
- package/dist/mcp/tools/codebase-index.js.map +7 -0
- package/dist/mcp/tools/codebase-shared.js +265 -0
- package/dist/mcp/tools/codebase-shared.js.map +7 -0
- package/dist/mcp/tools/codebase-verify.js +48 -0
- package/dist/mcp/tools/codebase-verify.js.map +7 -0
- package/dist/mcp/tools/index.js +15 -0
- package/dist/mcp/tools/index.js.map +2 -2
- package/dist/mcp/tools/model-add.js +189 -73
- package/dist/mcp/tools/model-add.js.map +2 -2
- package/dist/mcp/tools/model-update.js +16 -12
- package/dist/mcp/tools/model-update.js.map +2 -2
- package/dist/mcp/tools/model-validate.js +46 -4
- package/dist/mcp/tools/model-validate.js.map +2 -2
- package/dist/mcp/tools/project-status-collectors.js +381 -0
- package/dist/mcp/tools/project-status-collectors.js.map +7 -0
- package/dist/mcp/tools/project-status.js +237 -0
- package/dist/mcp/tools/project-status.js.map +7 -0
- package/dist/mcp/tools/project-tools.js +505 -0
- package/dist/mcp/tools/project-tools.js.map +7 -0
- package/dist/mcp/tools/relationship-tools.js +89 -20
- package/dist/mcp/tools/relationship-tools.js.map +2 -2
- package/dist/mcp/tools/review-open.js +210 -0
- package/dist/mcp/tools/review-open.js.map +7 -0
- package/dist/mcp/tools/shared.js +10 -2
- package/dist/mcp/tools/shared.js.map +2 -2
- package/dist/reports/model-report-orchestrator.js +31 -2
- package/dist/reports/model-report-orchestrator.js.map +2 -2
- package/dist/schemas/bundled/analyzers/cbm.json +22 -10
- package/dist/schemas/bundled/analyzers/manifest.json +2 -2
- package/dist/schemas/bundled/api.json +1 -1
- package/dist/schemas/bundled/apm.json +1 -1
- package/dist/schemas/bundled/application.json +1 -1
- package/dist/schemas/bundled/base.json +1 -1
- package/dist/schemas/bundled/business.json +1 -1
- package/dist/schemas/bundled/data-model.json +1 -1
- package/dist/schemas/bundled/data-store.json +1 -1
- package/dist/schemas/bundled/manifest.json +3 -3
- package/dist/schemas/bundled/motivation.json +1 -1
- package/dist/schemas/bundled/navigation.json +1 -1
- package/dist/schemas/bundled/product.json +1 -1
- package/dist/schemas/bundled/security.json +1 -1
- package/dist/schemas/bundled/technology.json +1 -1
- package/dist/schemas/bundled/testing.json +145 -1
- package/dist/schemas/bundled/ux.json +1 -1
- package/dist/server/server.js +508 -237
- package/dist/server/server.js.map +3 -3
- package/dist/server/viewer-registry.js +264 -0
- package/dist/server/viewer-registry.js.map +7 -0
- package/dist/telemetry/index.js +1 -1
- package/dist/utils/id-generator.js +5 -2
- package/dist/utils/id-generator.js.map +2 -2
- package/dist/utils/source-reference.js +58 -27
- package/dist/utils/source-reference.js.map +2 -2
- package/dist/utils/spec-version.js +2 -2
- package/dist/utils/spec-version.js.map +1 -1
- package/dist/validators/model-warnings.js +28 -0
- package/dist/validators/model-warnings.js.map +7 -0
- package/dist/viewer/README.md +6 -6
- package/dist/viewer/assets/main-CUOQGGRA.css +1 -0
- package/dist/viewer/assets/main-DvH3gYrI.js +84 -0
- package/dist/viewer/index.html +2 -2
- package/dist/viewer/manifest.json +10 -10
- package/dist/viewer/version.json +1 -1
- package/package.json +1 -1
- package/dist/viewer/assets/main-CxzcuU_o.js +0 -84
- package/dist/viewer/assets/main-j-7ULYpm.css +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var sR=Object.defineProperty,iR=Object.defineProperties;var rR=Object.getOwnPropertyDescriptors;var pf=Object.getOwnPropertySymbols;var Y_=Object.prototype.hasOwnProperty,G_=Object.prototype.propertyIsEnumerable;var K_=e=>{throw TypeError(e)},ks=Math.pow,Gg=(e,t,n)=>t in e?sR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Y_.call(t,n)&&Gg(e,n,t[n]);if(pf)for(var n of pf(t))G_.call(t,n)&&Gg(e,n,t[n]);return e},ee=(e,t)=>iR(e,rR(t));var Ie=(e,t)=>{var n={};for(var a in e)Y_.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&pf)for(var a of pf(e))t.indexOf(a)<0&&G_.call(e,a)&&(n[a]=e[a]);return n};var oR=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var nn=(e,t,n)=>Gg(e,typeof t!="symbol"?t+"":t,n),Kg=(e,t,n)=>t.has(e)||K_("Cannot "+n);var fe=(e,t,n)=>(Kg(e,t,"read from private field"),n?n.call(e):t.get(e)),mt=(e,t,n)=>t.has(e)?K_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),rt=(e,t,n,a)=>(Kg(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),Ot=(e,t,n)=>(Kg(e,t,"access private method"),n);var mf=(e,t,n,a)=>({set _(i){rt(e,t,i,n)},get _(){return fe(e,t,a)}});var St=(e,t,n)=>new Promise((a,i)=>{var r=u=>{try{c(n.next(u))}catch(h){i(h)}},l=u=>{try{c(n.throw(u))}catch(h){i(h)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(r,l);c((n=n.apply(e,t)).next())});import{r as Sx,a as ON,g as lR,b as j,R as Se,c as jp}from"./vendor-CxKvDp2x.js";var pq=oR(H0=>{(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))a(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const l of r.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function a(i){if(i.ep)return;i.ep=!0;const r=n(i);fetch(i.href,r)}})();var Qg={exports:{}},Wu={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Q_;function cR(){if(Q_)return Wu;Q_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,i,r){var l=null;if(r!==void 0&&(l=""+r),i.key!==void 0&&(l=""+i.key),"key"in i){r={};for(var c in i)c!=="key"&&(r[c]=i[c])}else r=i;return i=r.ref,{$$typeof:e,type:a,key:l,ref:i!==void 0?i:null,props:r}}return Wu.Fragment=t,Wu.jsx=n,Wu.jsxs=n,Wu}var X_;function uR(){return X_||(X_=1,Qg.exports=cR()),Qg.exports}var f=uR(),Xg={exports:{}},ed={},Zg={exports:{}},Jg={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* scheduler.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Z_;function dR(){return Z_||(Z_=1,(function(e){function t(F,Y){var X=F.length;F.push(Y);e:for(;0<X;){var ne=X-1>>>1,q=F[ne];if(0<i(q,Y))F[ne]=Y,F[X]=q,X=ne;else break e}}function n(F){return F.length===0?null:F[0]}function a(F){if(F.length===0)return null;var Y=F[0],X=F.pop();if(X!==Y){F[0]=X;e:for(var ne=0,q=F.length,he=q>>>1;ne<he;){var pe=2*(ne+1)-1,H=F[pe],te=pe+1,ie=F[te];if(0>i(H,X))te<q&&0>i(ie,H)?(F[ne]=ie,F[te]=X,ne=te):(F[ne]=H,F[pe]=X,ne=pe);else if(te<q&&0>i(ie,X))F[ne]=ie,F[te]=X,ne=te;else break e}}return Y}function i(F,Y){var X=F.sortIndex-Y.sortIndex;return X!==0?X:F.id-Y.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;e.unstable_now=function(){return r.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var u=[],h=[],m=1,p=null,g=3,v=!1,x=!1,b=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate!="undefined"?setImmediate:null;function k(F){for(var Y=n(h);Y!==null;){if(Y.callback===null)a(h);else if(Y.startTime<=F)a(h),Y.sortIndex=Y.expirationTime,t(u,Y);else break;Y=n(h)}}function L(F){if(b=!1,k(F),!x)if(n(u)!==null)x=!0,E||(E=!0,O());else{var Y=n(h);Y!==null&&U(L,Y.startTime-F)}}var E=!1,I=-1,T=5,A=-1;function R(){return _?!0:!(e.unstable_now()-A<T)}function D(){if(_=!1,E){var F=e.unstable_now();A=F;var Y=!0;try{e:{x=!1,b&&(b=!1,M(I),I=-1),v=!0;var X=g;try{t:{for(k(F),p=n(u);p!==null&&!(p.expirationTime>F&&R());){var ne=p.callback;if(typeof ne=="function"){p.callback=null,g=p.priorityLevel;var q=ne(p.expirationTime<=F);if(F=e.unstable_now(),typeof q=="function"){p.callback=q,k(F),Y=!0;break t}p===n(u)&&a(u),k(F)}else a(u);p=n(u)}if(p!==null)Y=!0;else{var he=n(h);he!==null&&U(L,he.startTime-F),Y=!1}}break e}finally{p=null,g=X,v=!1}Y=void 0}}finally{Y?O():E=!1}}}var O;if(typeof C=="function")O=function(){C(D)};else if(typeof MessageChannel!="undefined"){var B=new MessageChannel,z=B.port2;B.port1.onmessage=D,O=function(){z.postMessage(null)}}else O=function(){S(D,0)};function U(F,Y){I=S(function(){F(e.unstable_now())},Y)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_next=function(F){switch(g){case 1:case 2:case 3:var Y=3;break;default:Y=g}var X=g;g=Y;try{return F()}finally{g=X}},e.unstable_requestPaint=function(){_=!0},e.unstable_runWithPriority=function(F,Y){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var X=g;g=F;try{return Y()}finally{g=X}},e.unstable_scheduleCallback=function(F,Y,X){var ne=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?ne+X:ne):X=ne,F){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=X+q,F={id:m++,callback:Y,priorityLevel:F,startTime:X,expirationTime:q,sortIndex:-1},X>ne?(F.sortIndex=X,t(h,F),n(u)===null&&F===n(h)&&(b?(M(I),I=-1):b=!0,U(L,X-ne))):(F.sortIndex=q,t(u,F),x||v||(x=!0,E||(E=!0,O()))),F},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(F){var Y=g;return function(){var X=g;g=Y;try{return F.apply(this,arguments)}finally{g=X}}}})(Jg)),Jg}var J_;function hR(){return J_||(J_=1,Zg.exports=dR()),Zg.exports}/**
|
|
18
|
+
* @license React
|
|
19
|
+
* react-dom-client.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var W_;function fR(){if(W_)return ed;W_=1;var e=hR(),t=Sx(),n=ON();function a(s){var o="https://react.dev/errors/"+s;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)o+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+s+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function r(s){var o=s,d=s;if(s.alternate)for(;o.return;)o=o.return;else{s=o;do o=s,(o.flags&4098)!==0&&(d=o.return),s=o.return;while(s)}return o.tag===3?d:null}function l(s){if(s.tag===13){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function c(s){if(s.tag===31){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function u(s){if(r(s)!==s)throw Error(a(188))}function h(s){var o=s.alternate;if(!o){if(o=r(s),o===null)throw Error(a(188));return o!==s?null:s}for(var d=s,y=o;;){var w=d.return;if(w===null)break;var N=w.alternate;if(N===null){if(y=w.return,y!==null){d=y;continue}break}if(w.child===N.child){for(N=w.child;N;){if(N===d)return u(w),s;if(N===y)return u(w),o;N=N.sibling}throw Error(a(188))}if(d.return!==y.return)d=w,y=N;else{for(var P=!1,G=w.child;G;){if(G===d){P=!0,d=w,y=N;break}if(G===y){P=!0,y=w,d=N;break}G=G.sibling}if(!P){for(G=N.child;G;){if(G===d){P=!0,d=N,y=w;break}if(G===y){P=!0,y=N,d=w;break}G=G.sibling}if(!P)throw Error(a(189))}}if(d.alternate!==y)throw Error(a(190))}if(d.tag!==3)throw Error(a(188));return d.stateNode.current===d?s:o}function m(s){var o=s.tag;if(o===5||o===26||o===27||o===6)return s;for(s=s.child;s!==null;){if(o=m(s),o!==null)return o;s=s.sibling}return null}var p=Object.assign,g=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),C=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),A=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),D=Symbol.iterator;function O(s){return s===null||typeof s!="object"?null:(s=D&&s[D]||s["@@iterator"],typeof s=="function"?s:null)}var B=Symbol.for("react.client.reference");function z(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===B?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case b:return"Fragment";case S:return"Profiler";case _:return"StrictMode";case L:return"Suspense";case E:return"SuspenseList";case A:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case x:return"Portal";case C:return s.displayName||"Context";case M:return(s._context.displayName||"Context")+".Consumer";case k:var o=s.render;return s=s.displayName,s||(s=o.displayName||o.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case I:return o=s.displayName||null,o!==null?o:z(s.type)||"Memo";case T:o=s._payload,s=s._init;try{return z(s(o))}catch(d){}}return null}var U=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},ne=[],q=-1;function he(s){return{current:s}}function pe(s){0>q||(s.current=ne[q],ne[q]=null,q--)}function H(s,o){q++,ne[q]=s.current,s.current=o}var te=he(null),ie=he(null),W=he(null),ge=he(null);function we(s,o){switch(H(W,o),H(ie,s),H(te,null),o.nodeType){case 9:case 11:s=(s=o.documentElement)&&(s=s.namespaceURI)?m_(s):0;break;default:if(s=o.tagName,o=o.namespaceURI)o=m_(o),s=g_(o,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}pe(te),H(te,s)}function je(){pe(te),pe(ie),pe(W)}function De(s){s.memoizedState!==null&&H(ge,s);var o=te.current,d=g_(o,s.type);o!==d&&(H(ie,s),H(te,d))}function re(s){ie.current===s&&(pe(te),pe(ie)),ge.current===s&&(pe(ge),Qu._currentValue=X)}var Z,J;function K(s){if(Z===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);Z=o&&o[1]||"",J=-1<d.stack.indexOf(`
|
|
26
|
+
at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
27
|
+
`+Z+s+J}var Q=!1;function ae(s,o){if(!s||Q)return"";Q=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var y={DetermineComponentFrameRoot:function(){try{if(o){var Ve=function(){throw Error()};if(Object.defineProperty(Ve.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ve,[])}catch(Le){var Me=Le}Reflect.construct(s,[],Ve)}else{try{Ve.call()}catch(Le){Me=Le}s.call(Ve.prototype)}}else{try{throw Error()}catch(Le){Me=Le}(Ve=s())&&typeof Ve.catch=="function"&&Ve.catch(function(){})}}catch(Le){if(Le&&Me&&typeof Le.stack=="string")return[Le.stack,Me.stack]}return[null,null]}};y.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(y.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(y.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var N=y.DetermineComponentFrameRoot(),P=N[0],G=N[1];if(P&&G){var ue=P.split(`
|
|
28
|
+
`),ke=G.split(`
|
|
29
|
+
`);for(w=y=0;y<ue.length&&!ue[y].includes("DetermineComponentFrameRoot");)y++;for(;w<ke.length&&!ke[w].includes("DetermineComponentFrameRoot");)w++;if(y===ue.length||w===ke.length)for(y=ue.length-1,w=ke.length-1;1<=y&&0<=w&&ue[y]!==ke[w];)w--;for(;1<=y&&0<=w;y--,w--)if(ue[y]!==ke[w]){if(y!==1||w!==1)do if(y--,w--,0>w||ue[y]!==ke[w]){var Oe=`
|
|
30
|
+
`+ue[y].replace(" at new "," at ");return s.displayName&&Oe.includes("<anonymous>")&&(Oe=Oe.replace("<anonymous>",s.displayName)),Oe}while(1<=y&&0<=w);break}}}finally{Q=!1,Error.prepareStackTrace=d}return(d=s?s.displayName||s.name:"")?K(d):""}function ye(s,o){switch(s.tag){case 26:case 27:case 5:return K(s.type);case 16:return K("Lazy");case 13:return s.child!==o&&o!==null?K("Suspense Fallback"):K("Suspense");case 19:return K("SuspenseList");case 0:case 15:return ae(s.type,!1);case 11:return ae(s.type.render,!1);case 1:return ae(s.type,!0);case 31:return K("Activity");default:return""}}function Ae(s){try{var o="",d=null;do o+=ye(s,d),d=s,s=s.return;while(s);return o}catch(y){return`
|
|
31
|
+
Error generating stack: `+y.message+`
|
|
32
|
+
`+y.stack}}var de=Object.prototype.hasOwnProperty,Je=e.unstable_scheduleCallback,Ge=e.unstable_cancelCallback,be=e.unstable_shouldYield,Fe=e.unstable_requestPaint,me=e.unstable_now,Ee=e.unstable_getCurrentPriorityLevel,se=e.unstable_ImmediatePriority,le=e.unstable_UserBlockingPriority,xe=e.unstable_NormalPriority,Pe=e.unstable_LowPriority,$e=e.unstable_IdlePriority,Be=e.log,at=e.unstable_setDisableYieldValue,ot=null,ft=null;function it(s){if(typeof Be=="function"&&at(s),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(ot,s)}catch(o){}}var kt=Math.clz32?Math.clz32:Rt,pt=Math.log,Yt=Math.LN2;function Rt(s){return s>>>=0,s===0?32:31-(pt(s)/Yt|0)|0}var hn=256,Nn=262144,An=4194304;function It(s){var o=s&42;if(o!==0)return o;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function $n(s,o,d){var y=s.pendingLanes;if(y===0)return 0;var w=0,N=s.suspendedLanes,P=s.pingedLanes;s=s.warmLanes;var G=y&134217727;return G!==0?(y=G&~N,y!==0?w=It(y):(P&=G,P!==0?w=It(P):d||(d=G&~s,d!==0&&(w=It(d))))):(G=y&~N,G!==0?w=It(G):P!==0?w=It(P):d||(d=y&~s,d!==0&&(w=It(d)))),w===0?0:o!==0&&o!==w&&(o&N)===0&&(N=w&-w,d=o&-o,N>=d||N===32&&(d&4194048)!==0)?o:w}function yn(s,o){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&o)===0}function Na(s,o){switch(s){case 1:case 2:case 4:case 8:case 64:return o+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function kn(){var s=An;return An<<=1,(An&62914560)===0&&(An=4194304),s}function Un(s){for(var o=[],d=0;31>d;d++)o.push(s);return o}function Cn(s,o){s.pendingLanes|=o,o!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Xt(s,o,d,y,w,N){var P=s.pendingLanes;s.pendingLanes=d,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=d,s.entangledLanes&=d,s.errorRecoveryDisabledLanes&=d,s.shellSuspendCounter=0;var G=s.entanglements,ue=s.expirationTimes,ke=s.hiddenUpdates;for(d=P&~d;0<d;){var Oe=31-kt(d),Ve=1<<Oe;G[Oe]=0,ue[Oe]=-1;var Me=ke[Oe];if(Me!==null)for(ke[Oe]=null,Oe=0;Oe<Me.length;Oe++){var Le=Me[Oe];Le!==null&&(Le.lane&=-536870913)}d&=~Ve}y!==0&&Mn(s,y,0),N!==0&&w===0&&s.tag!==0&&(s.suspendedLanes|=N&~(P&~o))}function Mn(s,o,d){s.pendingLanes|=o,s.suspendedLanes&=~o;var y=31-kt(o);s.entangledLanes|=o,s.entanglements[y]=s.entanglements[y]|1073741824|d&261930}function Gt(s,o){var d=s.entangledLanes|=o;for(s=s.entanglements;d;){var y=31-kt(d),w=1<<y;w&o|s[y]&o&&(s[y]|=o),d&=~w}}function Zn(s,o){var d=o&-o;return d=(d&42)!==0?1:ys(d),(d&(s.suspendedLanes|o))!==0?0:d}function ys(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Hn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ti(){var s=Y.p;return s!==0?s:(s=window.event,s===void 0?32:$_(s.type))}function da(s,o){var d=Y.p;try{return Y.p=s,o()}finally{Y.p=d}}var fn=Math.random().toString(36).slice(2),Re="__reactFiber$"+fn,We="__reactProps$"+fn,lt="__reactContainer$"+fn,ht="__reactEvents$"+fn,jn="__reactListeners$"+fn,pa="__reactHandles$"+fn,Ua="__reactResources$"+fn,Wt="__reactMarker$"+fn;function en(s){delete s[Re],delete s[We],delete s[ht],delete s[jn],delete s[pa]}function In(s){var o=s[Re];if(o)return o;for(var d=s.parentNode;d;){if(o=d[lt]||d[Re]){if(d=o.alternate,o.child!==null||d!==null&&d.child!==null)for(s=S_(s);s!==null;){if(d=s[Re])return d;s=S_(s)}return o}s=d,d=s.parentNode}return null}function Ts(s){if(s=s[Re]||s[lt]){var o=s.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return s}return null}function Jn(s){var o=s.tag;if(o===5||o===26||o===27||o===6)return s.stateNode;throw Error(a(33))}function ma(s){var o=s[Ua];return o||(o=s[Ua]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function Lt(s){s[Wt]=!0}var Wn=new Set,pi={};function Dn(s,o){Xa(s,o),Xa(s+"Capture",o)}function Xa(s,o){for(pi[s]=o,s=0;s<o.length;s++)Wn.add(o[s])}var mi=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Li={},Sl={};function Tt(s){return de.call(Sl,s)?!0:de.call(Li,s)?!1:mi.test(s)?Sl[s]=!0:(Li[s]=!0,!1)}function As(s,o,d){if(Tt(o))if(d===null)s.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":s.removeAttribute(o);return;case"boolean":var y=o.toLowerCase().slice(0,5);if(y!=="data-"&&y!=="aria-"){s.removeAttribute(o);return}}s.setAttribute(o,""+d)}}function vs(s,o,d){if(d===null)s.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(o);return}s.setAttribute(o,""+d)}}function La(s,o,d,y){if(y===null)s.removeAttribute(d);else{switch(typeof y){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(d);return}s.setAttributeNS(o,d,""+y)}}function Ta(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function wo(s){var o=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function su(s,o,d){var y=Object.getOwnPropertyDescriptor(s.constructor.prototype,o);if(!s.hasOwnProperty(o)&&typeof y!="undefined"&&typeof y.get=="function"&&typeof y.set=="function"){var w=y.get,N=y.set;return Object.defineProperty(s,o,{configurable:!0,get:function(){return w.call(this)},set:function(P){d=""+P,N.call(this,P)}}),Object.defineProperty(s,o,{enumerable:y.enumerable}),{getValue:function(){return d},setValue:function(P){d=""+P},stopTracking:function(){s._valueTracker=null,delete s[o]}}}}function Fa(s){if(!s._valueTracker){var o=wo(s)?"checked":"value";s._valueTracker=su(s,o,""+s[o])}}function mr(s){if(!s)return!1;var o=s._valueTracker;if(!o)return!0;var d=o.getValue(),y="";return s&&(y=wo(s)?s.checked?"true":"false":s.value),s=y,s!==d?(o.setValue(s),!0):!1}function ni(s){if(s=s||(typeof document!="undefined"?document:void 0),typeof s=="undefined")return null;try{return s.activeElement||s.body}catch(o){return s.body}}var gi=/[\n"\\]/g;function Fn(s){return s.replace(gi,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function gr(s,o,d,y,w,N,P,G){s.name="",P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?s.type=P:s.removeAttribute("type"),o!=null?P==="number"?(o===0&&s.value===""||s.value!=o)&&(s.value=""+Ta(o)):s.value!==""+Ta(o)&&(s.value=""+Ta(o)):P!=="submit"&&P!=="reset"||s.removeAttribute("value"),o!=null?Ti(s,P,Ta(o)):d!=null?Ti(s,P,Ta(d)):y!=null&&s.removeAttribute("value"),w==null&&N!=null&&(s.defaultChecked=!!N),w!=null&&(s.checked=w&&typeof w!="function"&&typeof w!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?s.name=""+Ta(G):s.removeAttribute("name")}function Nl(s,o,d,y,w,N,P,G){if(N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(s.type=N),o!=null||d!=null){if(!(N!=="submit"&&N!=="reset"||o!=null)){Fa(s);return}d=d!=null?""+Ta(d):"",o=o!=null?""+Ta(o):d,G||o===s.value||(s.value=o),s.defaultValue=o}y=y!=null?y:w,y=typeof y!="function"&&typeof y!="symbol"&&!!y,s.checked=G?s.checked:!!y,s.defaultChecked=!!y,P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(s.name=P),Fa(s)}function Ti(s,o,d){o==="number"&&ni(s.ownerDocument)===s||s.defaultValue===""+d||(s.defaultValue=""+d)}function Is(s,o,d,y){if(s=s.options,o){o={};for(var w=0;w<d.length;w++)o["$"+d[w]]=!0;for(d=0;d<s.length;d++)w=o.hasOwnProperty("$"+s[d].value),s[d].selected!==w&&(s[d].selected=w),w&&y&&(s[d].defaultSelected=!0)}else{for(d=""+Ta(d),o=null,w=0;w<s.length;w++){if(s[w].value===d){s[w].selected=!0,y&&(s[w].defaultSelected=!0);return}o!==null||s[w].disabled||(o=s[w])}o!==null&&(o.selected=!0)}}function ai(s,o,d){if(o!=null&&(o=""+Ta(o),o!==s.value&&(s.value=o),d==null)){s.defaultValue!==o&&(s.defaultValue=o);return}s.defaultValue=d!=null?""+Ta(d):""}function Ai(s,o,d,y){if(o==null){if(y!=null){if(d!=null)throw Error(a(92));if(U(y)){if(1<y.length)throw Error(a(93));y=y[0]}d=y}d==null&&(d=""),o=d}d=Ta(o),s.defaultValue=d,y=s.textContent,y===d&&y!==""&&y!==null&&(s.value=y),Fa(s)}function Za(s,o){if(o){var d=s.firstChild;if(d&&d===s.lastChild&&d.nodeType===3){d.nodeValue=o;return}}s.textContent=o}var yr=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function So(s,o,d){var y=o.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?y?s.setProperty(o,""):o==="float"?s.cssFloat="":s[o]="":y?s.setProperty(o,d):typeof d!="number"||d===0||yr.has(o)?o==="float"?s.cssFloat=d:s[o]=(""+d).trim():s[o]=d+"px"}function Mt(s,o,d){if(o!=null&&typeof o!="object")throw Error(a(62));if(s=s.style,d!=null){for(var y in d)!d.hasOwnProperty(y)||o!=null&&o.hasOwnProperty(y)||(y.indexOf("--")===0?s.setProperty(y,""):y==="float"?s.cssFloat="":s[y]="");for(var w in o)y=o[w],o.hasOwnProperty(w)&&d[w]!==y&&So(s,w,y)}else for(var N in o)o.hasOwnProperty(N)&&So(s,N,o[N])}function No(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ko=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Ds=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ii(s){return Ds.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Aa(){}var si=null;function Di(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Ja=null,Os=null;function ii(s){var o=Ts(s);if(o&&(s=o.stateNode)){var d=s[We]||null;e:switch(s=o.stateNode,o.type){case"input":if(gr(s,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),o=d.name,d.type==="radio"&&o!=null){for(d=s;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Fn(""+o)+'"][type="radio"]'),o=0;o<d.length;o++){var y=d[o];if(y!==s&&y.form===s.form){var w=y[We]||null;if(!w)throw Error(a(90));gr(y,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(o=0;o<d.length;o++)y=d[o],y.form===s.form&&mr(y)}break e;case"textarea":ai(s,d.value,d.defaultValue);break e;case"select":o=d.value,o!=null&&Is(s,!!d.multiple,o,!1)}}}var oe=!1;function ze(s,o,d){if(oe)return s(o,d);oe=!0;try{var y=s(o);return y}finally{if(oe=!1,(Ja!==null||Os!==null)&&(Vh(),Ja&&(o=Ja,s=Os,Os=Ja=null,ii(o),s)))for(o=0;o<s.length;o++)ii(s[o])}}function Ye(s,o){var d=s.stateNode;if(d===null)return null;var y=d[We]||null;if(y===null)return null;d=y[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(y=!y.disabled)||(s=s.type,y=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!y;break e;default:s=!1}if(s)return null;if(d&&typeof d!="function")throw Error(a(231,o,typeof d));return d}var Xe=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),dt=!1;if(Xe)try{var xt={};Object.defineProperty(xt,"passive",{get:function(){dt=!0}}),window.addEventListener("test",xt,xt),window.removeEventListener("test",xt,xt)}catch(s){dt=!1}var Ct=null,zt=null,aa=null;function Ia(){if(aa)return aa;var s,o=zt,d=o.length,y,w="value"in Ct?Ct.value:Ct.textContent,N=w.length;for(s=0;s<d&&o[s]===w[s];s++);var P=d-s;for(y=1;y<=P&&o[d-y]===w[N-y];y++);return aa=w.slice(s,1<y?1-y:void 0)}function vt(s){var o=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&o===13&&(s=13)):s=o,s===10&&(s=13),32<=s||s===13?s:0}function ga(){return!0}function En(){return!1}function sn(s){function o(d,y,w,N,P){this._reactName=d,this._targetInst=w,this.type=y,this.nativeEvent=N,this.target=P,this.currentTarget=null;for(var G in s)s.hasOwnProperty(G)&&(d=s[G],this[G]=d?d(N):N[G]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?ga:En,this.isPropagationStopped=En,this}return p(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=ga)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=ga)},persist:function(){},isPersistent:ga}),o}var qn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},On=sn(qn),zs=p({},qn,{view:0,detail:0}),kl=sn(zs),vr,xr,Co,Cl=p({},zs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jl,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Co&&(Co&&s.type==="mousemove"?(vr=s.screenX-Co.screenX,xr=s.screenY-Co.screenY):xr=vr=0,Co=s),vr)},movementY:function(s){return"movementY"in s?s.movementY:xr}}),iu=sn(Cl),ru=p({},Cl,{dataTransfer:0}),Zp=sn(ru),Jp=p({},zs,{relatedTarget:0}),Mo=sn(Jp),Wp=p({},qn,{animationName:0,elapsedTime:0,pseudoElement:0}),em=sn(Wp),tm=p({},qn,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),ou=sn(tm),br=p({},qn,{data:0}),Ml=sn(br),sh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},lu={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},ih={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rh(s){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(s):(s=ih[s])?!!o[s]:!1}function jl(){return rh}var oh=p({},zs,{key:function(s){if(s.key){var o=sh[s.key]||s.key;if(o!=="Unidentified")return o}return s.type==="keypress"?(s=vt(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?lu[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jl,charCode:function(s){return s.type==="keypress"?vt(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?vt(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),lh=sn(oh),ch=p({},Cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ya=sn(ch),Pa=p({},zs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jl}),El=sn(Pa),Rl=p({},qn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ll=sn(Rl),cu=p({},Cl,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),_r=sn(cu),uh=p({},qn,{newState:0,oldState:0}),Tl=sn(uh),dh=[9,13,27,32],Al=Xe&&"CompositionEvent"in window,wr=null;Xe&&"documentMode"in document&&(wr=document.documentMode);var nm=Xe&&"TextEvent"in window&&!wr,uu=Xe&&(!Al||wr&&8<wr&&11>=wr),du=" ",hu=!1;function fu(s,o){switch(s){case"keyup":return dh.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pu(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Pn=!1;function am(s,o){switch(s){case"compositionend":return pu(o);case"keypress":return o.which!==32?null:(hu=!0,du);case"textInput":return s=o.data,s===du&&hu?null:s;default:return null}}function sm(s,o){if(Pn)return s==="compositionend"||!Al&&fu(s,o)?(s=Ia(),aa=zt=Ct=null,Pn=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return uu&&o.locale!=="ko"?null:o.data;default:return null}}var hh={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Oi(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o==="input"?!!hh[s.type]:o==="textarea"}function Il(s,o,d,y){Ja?Os?Os.push(y):Os=[y]:Ja=y,o=Jh(o,"onChange"),0<o.length&&(d=new On("onChange","change",null,d,y),s.push({event:d,listeners:o}))}var ea=null,Sr=null;function im(s){c_(s,0)}function Dl(s){var o=Jn(s);if(mr(o))return s}function jo(s,o){if(s==="change")return o}var Ol=!1;if(Xe){var zl;if(Xe){var Bl="oninput"in document;if(!Bl){var sa=document.createElement("div");sa.setAttribute("oninput","return;"),Bl=typeof sa.oninput=="function"}zl=Bl}else zl=!1;Ol=zl&&(!document.documentMode||9<document.documentMode)}function mu(){ea&&(ea.detachEvent("onpropertychange",yi),Sr=ea=null)}function yi(s){if(s.propertyName==="value"&&Dl(Sr)){var o=[];Il(o,Sr,s,Di(s)),ze(im,o)}}function va(s,o,d){s==="focusin"?(mu(),ea=o,Sr=d,ea.attachEvent("onpropertychange",yi)):s==="focusout"&&mu()}function gu(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Dl(Sr)}function rm(s,o){if(s==="click")return Dl(o)}function om(s,o){if(s==="input"||s==="change")return Dl(o)}function lm(s,o){return s===o&&(s!==0||1/s===1/o)||s!==s&&o!==o}var Vn=typeof Object.is=="function"?Object.is:lm;function Eo(s,o){if(Vn(s,o))return!0;if(typeof s!="object"||s===null||typeof o!="object"||o===null)return!1;var d=Object.keys(s),y=Object.keys(o);if(d.length!==y.length)return!1;for(y=0;y<d.length;y++){var w=d[y];if(!de.call(o,w)||!Vn(s[w],o[w]))return!1}return!0}function fh(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function yu(s,o){var d=fh(s);s=0;for(var y;d;){if(d.nodeType===3){if(y=s+d.textContent.length,s<=o&&y>=o)return{node:d,offset:o-s};s=y}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=fh(d)}}function vu(s,o){return s&&o?s===o?!0:s&&s.nodeType===3?!1:o&&o.nodeType===3?vu(s,o.parentNode):"contains"in s?s.contains(o):s.compareDocumentPosition?!!(s.compareDocumentPosition(o)&16):!1:!1}function xu(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var o=ni(s.document);o instanceof s.HTMLIFrameElement;){try{var d=typeof o.contentWindow.location.href=="string"}catch(y){d=!1}if(d)s=o.contentWindow;else break;o=ni(s.document)}return o}function $l(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o&&(o==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||o==="textarea"||s.contentEditable==="true")}var V=Xe&&"documentMode"in document&&11>=document.documentMode,ce=null,Ce=null,Te=null,et=!1;function Ue(s,o,d){var y=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;et||ce==null||ce!==ni(y)||(y=ce,"selectionStart"in y&&$l(y)?y={start:y.selectionStart,end:y.selectionEnd}:(y=(y.ownerDocument&&y.ownerDocument.defaultView||window).getSelection(),y={anchorNode:y.anchorNode,anchorOffset:y.anchorOffset,focusNode:y.focusNode,focusOffset:y.focusOffset}),Te&&Eo(Te,y)||(Te=y,y=Jh(Ce,"onSelect"),0<y.length&&(o=new On("onSelect","select",null,o,d),s.push({event:o,listeners:y}),o.target=ce)))}function Ke(s,o){var d={};return d[s.toLowerCase()]=o.toLowerCase(),d["Webkit"+s]="webkit"+o,d["Moz"+s]="moz"+o,d}var tt={animationend:Ke("Animation","AnimationEnd"),animationiteration:Ke("Animation","AnimationIteration"),animationstart:Ke("Animation","AnimationStart"),transitionrun:Ke("Transition","TransitionRun"),transitionstart:Ke("Transition","TransitionStart"),transitioncancel:Ke("Transition","TransitionCancel"),transitionend:Ke("Transition","TransitionEnd")},st={},wt={};Xe&&(wt=document.createElement("div").style,"AnimationEvent"in window||(delete tt.animationend.animation,delete tt.animationiteration.animation,delete tt.animationstart.animation),"TransitionEvent"in window||delete tt.transitionend.transition);function Dt(s){if(st[s])return st[s];if(!tt[s])return s;var o=tt[s],d;for(d in o)if(o.hasOwnProperty(d)&&d in wt)return st[s]=o[d];return s}var _n=Dt("animationend"),Yn=Dt("animationiteration"),Bt=Dt("animationstart"),Nt=Dt("transitionrun"),ia=Dt("transitionstart"),Ro=Dt("transitioncancel"),Wa=Dt("transitionend"),Nr=new Map,zi="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");zi.push("scrollEnd");function ka(s,o){Nr.set(s,o),Dn(o,[s])}var Bi=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Ha=[],$i=0,bu=0;function Ui(){for(var s=$i,o=bu=$i=0;o<s;){var d=Ha[o];Ha[o++]=null;var y=Ha[o];Ha[o++]=null;var w=Ha[o];Ha[o++]=null;var N=Ha[o];if(Ha[o++]=null,y!==null&&w!==null){var P=y.pending;P===null?w.next=w:(w.next=P.next,P.next=w),y.pending=w}N!==0&&q0(d,w,N)}}function es(s,o,d,y){Ha[$i++]=s,Ha[$i++]=o,Ha[$i++]=d,Ha[$i++]=y,bu|=y,s.lanes|=y,s=s.alternate,s!==null&&(s.lanes|=y)}function Bs(s,o,d,y){return es(s,o,d,y),ph(s)}function vi(s,o){return es(s,null,null,o),ph(s)}function q0(s,o,d){s.lanes|=d;var y=s.alternate;y!==null&&(y.lanes|=d);for(var w=!1,N=s.return;N!==null;)N.childLanes|=d,y=N.alternate,y!==null&&(y.childLanes|=d),N.tag===22&&(s=N.stateNode,s===null||s._visibility&1||(w=!0)),s=N,N=N.return;return s.tag===3?(N=s.stateNode,w&&o!==null&&(w=31-kt(d),s=N.hiddenUpdates,y=s[w],y===null?s[w]=[o]:y.push(o),o.lane=d|536870912),N):null}function ph(s){if(50<Pu)throw Pu=0,yg=null,Error(a(185));for(var o=s.return;o!==null;)s=o,o=s.return;return s.tag===3?s.stateNode:null}var Ul={};function Fj(s,o,d,y){this.tag=s,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xs(s,o,d,y){return new Fj(s,o,d,y)}function cm(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Fi(s,o){var d=s.alternate;return d===null?(d=xs(s.tag,o,s.key,s.mode),d.elementType=s.elementType,d.type=s.type,d.stateNode=s.stateNode,d.alternate=s,s.alternate=d):(d.pendingProps=o,d.type=s.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=s.flags&65011712,d.childLanes=s.childLanes,d.lanes=s.lanes,d.child=s.child,d.memoizedProps=s.memoizedProps,d.memoizedState=s.memoizedState,d.updateQueue=s.updateQueue,o=s.dependencies,d.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},d.sibling=s.sibling,d.index=s.index,d.ref=s.ref,d.refCleanup=s.refCleanup,d}function V0(s,o){s.flags&=65011714;var d=s.alternate;return d===null?(s.childLanes=0,s.lanes=o,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=d.childLanes,s.lanes=d.lanes,s.child=d.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=d.memoizedProps,s.memoizedState=d.memoizedState,s.updateQueue=d.updateQueue,s.type=d.type,o=d.dependencies,s.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),s}function mh(s,o,d,y,w,N){var P=0;if(y=s,typeof s=="function")cm(s)&&(P=1);else if(typeof s=="string")P=YE(s,d,te.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case A:return s=xs(31,d,o,w),s.elementType=A,s.lanes=N,s;case b:return Lo(d.children,w,N,o);case _:P=8,w|=24;break;case S:return s=xs(12,d,o,w|2),s.elementType=S,s.lanes=N,s;case L:return s=xs(13,d,o,w),s.elementType=L,s.lanes=N,s;case E:return s=xs(19,d,o,w),s.elementType=E,s.lanes=N,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case C:P=10;break e;case M:P=9;break e;case k:P=11;break e;case I:P=14;break e;case T:P=16,y=null;break e}P=29,d=Error(a(130,s===null?"null":typeof s,"")),y=null}return o=xs(P,d,o,w),o.elementType=s,o.type=y,o.lanes=N,o}function Lo(s,o,d,y){return s=xs(7,s,y,o),s.lanes=d,s}function um(s,o,d){return s=xs(6,s,null,o),s.lanes=d,s}function Y0(s){var o=xs(18,null,null,0);return o.stateNode=s,o}function dm(s,o,d){return o=xs(4,s.children!==null?s.children:[],s.key,o),o.lanes=d,o.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},o}var G0=new WeakMap;function $s(s,o){if(typeof s=="object"&&s!==null){var d=G0.get(s);return d!==void 0?d:(o={value:s,source:o,stack:Ae(o)},G0.set(s,o),o)}return{value:s,source:o,stack:Ae(o)}}var Fl=[],Pl=0,gh=null,_u=0,Us=[],Fs=0,kr=null,xi=1,bi="";function Pi(s,o){Fl[Pl++]=_u,Fl[Pl++]=gh,gh=s,_u=o}function K0(s,o,d){Us[Fs++]=xi,Us[Fs++]=bi,Us[Fs++]=kr,kr=s;var y=xi;s=bi;var w=32-kt(y)-1;y&=~(1<<w),d+=1;var N=32-kt(o)+w;if(30<N){var P=w-w%5;N=(y&(1<<P)-1).toString(32),y>>=P,w-=P,xi=1<<32-kt(o)+w|d<<w|y,bi=N+s}else xi=1<<N|d<<w|y,bi=s}function hm(s){s.return!==null&&(Pi(s,1),K0(s,1,0))}function fm(s){for(;s===gh;)gh=Fl[--Pl],Fl[Pl]=null,_u=Fl[--Pl],Fl[Pl]=null;for(;s===kr;)kr=Us[--Fs],Us[Fs]=null,bi=Us[--Fs],Us[Fs]=null,xi=Us[--Fs],Us[Fs]=null}function Q0(s,o){Us[Fs++]=xi,Us[Fs++]=bi,Us[Fs++]=kr,xi=o.id,bi=o.overflow,kr=s}var Ca=null,Rn=null,qt=!1,Cr=null,Ps=!1,pm=Error(a(519));function Mr(s){var o=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wu($s(o,s)),pm}function X0(s){var o=s.stateNode,d=s.type,y=s.memoizedProps;switch(o[Re]=s,o[We]=y,d){case"dialog":Ut("cancel",o),Ut("close",o);break;case"iframe":case"object":case"embed":Ut("load",o);break;case"video":case"audio":for(d=0;d<qu.length;d++)Ut(qu[d],o);break;case"source":Ut("error",o);break;case"img":case"image":case"link":Ut("error",o),Ut("load",o);break;case"details":Ut("toggle",o);break;case"input":Ut("invalid",o),Nl(o,y.value,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name,!0);break;case"select":Ut("invalid",o);break;case"textarea":Ut("invalid",o),Ai(o,y.value,y.defaultValue,y.children)}d=y.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||o.textContent===""+d||y.suppressHydrationWarning===!0||f_(o.textContent,d)?(y.popover!=null&&(Ut("beforetoggle",o),Ut("toggle",o)),y.onScroll!=null&&Ut("scroll",o),y.onScrollEnd!=null&&Ut("scrollend",o),y.onClick!=null&&(o.onclick=Aa),o=!0):o=!1,o||Mr(s,!0)}function Z0(s){for(Ca=s.return;Ca;)switch(Ca.tag){case 5:case 31:case 13:Ps=!1;return;case 27:case 3:Ps=!0;return;default:Ca=Ca.return}}function Hl(s){if(s!==Ca)return!1;if(!qt)return Z0(s),qt=!0,!1;var o=s.tag,d;if((d=o!==3&&o!==27)&&((d=o===5)&&(d=s.type,d=!(d!=="form"&&d!=="button")||Tg(s.type,s.memoizedProps)),d=!d),d&&Rn&&Mr(s),Z0(s),o===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));Rn=w_(s)}else if(o===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));Rn=w_(s)}else o===27?(o=Rn,Fr(s.type)?(s=zg,zg=null,Rn=s):Rn=o):Rn=Ca?qs(s.stateNode.nextSibling):null;return!0}function To(){Rn=Ca=null,qt=!1}function mm(){var s=Cr;return s!==null&&(ss===null?ss=s:ss.push.apply(ss,s),Cr=null),s}function wu(s){Cr===null?Cr=[s]:Cr.push(s)}var gm=he(null),Ao=null,Hi=null;function jr(s,o,d){H(gm,o._currentValue),o._currentValue=d}function qi(s){s._currentValue=gm.current,pe(gm)}function ym(s,o,d){for(;s!==null;){var y=s.alternate;if((s.childLanes&o)!==o?(s.childLanes|=o,y!==null&&(y.childLanes|=o)):y!==null&&(y.childLanes&o)!==o&&(y.childLanes|=o),s===d)break;s=s.return}}function vm(s,o,d,y){var w=s.child;for(w!==null&&(w.return=s);w!==null;){var N=w.dependencies;if(N!==null){var P=w.child;N=N.firstContext;e:for(;N!==null;){var G=N;N=w;for(var ue=0;ue<o.length;ue++)if(G.context===o[ue]){N.lanes|=d,G=N.alternate,G!==null&&(G.lanes|=d),ym(N.return,d,s),y||(P=null);break e}N=G.next}}else if(w.tag===18){if(P=w.return,P===null)throw Error(a(341));P.lanes|=d,N=P.alternate,N!==null&&(N.lanes|=d),ym(P,d,s),P=null}else P=w.child;if(P!==null)P.return=w;else for(P=w;P!==null;){if(P===s){P=null;break}if(w=P.sibling,w!==null){w.return=P.return,P=w;break}P=P.return}w=P}}function ql(s,o,d,y){s=null;for(var w=o,N=!1;w!==null;){if(!N){if((w.flags&524288)!==0)N=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var P=w.alternate;if(P===null)throw Error(a(387));if(P=P.memoizedProps,P!==null){var G=w.type;Vn(w.pendingProps.value,P.value)||(s!==null?s.push(G):s=[G])}}else if(w===ge.current){if(P=w.alternate,P===null)throw Error(a(387));P.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(s!==null?s.push(Qu):s=[Qu])}w=w.return}s!==null&&vm(o,s,d,y),o.flags|=262144}function yh(s){for(s=s.firstContext;s!==null;){if(!Vn(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Io(s){Ao=s,Hi=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Ma(s){return J0(Ao,s)}function vh(s,o){return Ao===null&&Io(s),J0(s,o)}function J0(s,o){var d=o._currentValue;if(o={context:o,memoizedValue:d,next:null},Hi===null){if(s===null)throw Error(a(308));Hi=o,s.dependencies={lanes:0,firstContext:o},s.flags|=524288}else Hi=Hi.next=o;return d}var Pj=typeof AbortController!="undefined"?AbortController:function(){var s=[],o=this.signal={aborted:!1,addEventListener:function(d,y){s.push(y)}};this.abort=function(){o.aborted=!0,s.forEach(function(d){return d()})}},Hj=e.unstable_scheduleCallback,qj=e.unstable_NormalPriority,ra={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xm(){return{controller:new Pj,data:new Map,refCount:0}}function Su(s){s.refCount--,s.refCount===0&&Hj(qj,function(){s.controller.abort()})}var Nu=null,bm=0,Vl=0,Yl=null;function Vj(s,o){if(Nu===null){var d=Nu=[];bm=0,Vl=Sg(),Yl={status:"pending",value:void 0,then:function(y){d.push(y)}}}return bm++,o.then(W0,W0),o}function W0(){if(--bm===0&&Nu!==null){Yl!==null&&(Yl.status="fulfilled");var s=Nu;Nu=null,Vl=0,Yl=null;for(var o=0;o<s.length;o++)(0,s[o])()}}function Yj(s,o){var d=[],y={status:"pending",value:null,reason:null,then:function(w){d.push(w)}};return s.then(function(){y.status="fulfilled",y.value=o;for(var w=0;w<d.length;w++)(0,d[w])(o)},function(w){for(y.status="rejected",y.reason=w,w=0;w<d.length;w++)(0,d[w])(void 0)}),y}var e1=F.S;F.S=function(s,o){zb=me(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&Vj(s,o),e1!==null&&e1(s,o)};var Do=he(null);function _m(){var s=Do.current;return s!==null?s:vn.pooledCache}function xh(s,o){o===null?H(Do,Do.current):H(Do,o.pool)}function t1(){var s=_m();return s===null?null:{parent:ra._currentValue,pool:s}}var Gl=Error(a(460)),wm=Error(a(474)),bh=Error(a(542)),_h={then:function(){}};function n1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function a1(s,o,d){switch(d=s[d],d===void 0?s.push(o):d!==o&&(o.then(Aa,Aa),o=d),o.status){case"fulfilled":return o.value;case"rejected":throw s=o.reason,i1(s),s;default:if(typeof o.status=="string")o.then(Aa,Aa);else{if(s=vn,s!==null&&100<s.shellSuspendCounter)throw Error(a(482));s=o,s.status="pending",s.then(function(y){if(o.status==="pending"){var w=o;w.status="fulfilled",w.value=y}},function(y){if(o.status==="pending"){var w=o;w.status="rejected",w.reason=y}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw s=o.reason,i1(s),s}throw zo=o,Gl}}function Oo(s){try{var o=s._init;return o(s._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(zo=d,Gl):d}}var zo=null;function s1(){if(zo===null)throw Error(a(459));var s=zo;return zo=null,s}function i1(s){if(s===Gl||s===bh)throw Error(a(483))}var Kl=null,ku=0;function wh(s){var o=ku;return ku+=1,Kl===null&&(Kl=[]),a1(Kl,s,o)}function Cu(s,o){o=o.props.ref,s.ref=o!==void 0?o:null}function Sh(s,o){throw o.$$typeof===g?Error(a(525)):(s=Object.prototype.toString.call(o),Error(a(31,s==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":s)))}function r1(s){function o(_e,ve){if(s){var Ne=_e.deletions;Ne===null?(_e.deletions=[ve],_e.flags|=16):Ne.push(ve)}}function d(_e,ve){if(!s)return null;for(;ve!==null;)o(_e,ve),ve=ve.sibling;return null}function y(_e){for(var ve=new Map;_e!==null;)_e.key!==null?ve.set(_e.key,_e):ve.set(_e.index,_e),_e=_e.sibling;return ve}function w(_e,ve){return _e=Fi(_e,ve),_e.index=0,_e.sibling=null,_e}function N(_e,ve,Ne){return _e.index=Ne,s?(Ne=_e.alternate,Ne!==null?(Ne=Ne.index,Ne<ve?(_e.flags|=67108866,ve):Ne):(_e.flags|=67108866,ve)):(_e.flags|=1048576,ve)}function P(_e){return s&&_e.alternate===null&&(_e.flags|=67108866),_e}function G(_e,ve,Ne,He){return ve===null||ve.tag!==6?(ve=um(Ne,_e.mode,He),ve.return=_e,ve):(ve=w(ve,Ne),ve.return=_e,ve)}function ue(_e,ve,Ne,He){var gt=Ne.type;return gt===b?Oe(_e,ve,Ne.props.children,He,Ne.key):ve!==null&&(ve.elementType===gt||typeof gt=="object"&>!==null&>.$$typeof===T&&Oo(gt)===ve.type)?(ve=w(ve,Ne.props),Cu(ve,Ne),ve.return=_e,ve):(ve=mh(Ne.type,Ne.key,Ne.props,null,_e.mode,He),Cu(ve,Ne),ve.return=_e,ve)}function ke(_e,ve,Ne,He){return ve===null||ve.tag!==4||ve.stateNode.containerInfo!==Ne.containerInfo||ve.stateNode.implementation!==Ne.implementation?(ve=dm(Ne,_e.mode,He),ve.return=_e,ve):(ve=w(ve,Ne.children||[]),ve.return=_e,ve)}function Oe(_e,ve,Ne,He,gt){return ve===null||ve.tag!==7?(ve=Lo(Ne,_e.mode,He,gt),ve.return=_e,ve):(ve=w(ve,Ne),ve.return=_e,ve)}function Ve(_e,ve,Ne){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return ve=um(""+ve,_e.mode,Ne),ve.return=_e,ve;if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case v:return Ne=mh(ve.type,ve.key,ve.props,null,_e.mode,Ne),Cu(Ne,ve),Ne.return=_e,Ne;case x:return ve=dm(ve,_e.mode,Ne),ve.return=_e,ve;case T:return ve=Oo(ve),Ve(_e,ve,Ne)}if(U(ve)||O(ve))return ve=Lo(ve,_e.mode,Ne,null),ve.return=_e,ve;if(typeof ve.then=="function")return Ve(_e,wh(ve),Ne);if(ve.$$typeof===C)return Ve(_e,vh(_e,ve),Ne);Sh(_e,ve)}return null}function Me(_e,ve,Ne,He){var gt=ve!==null?ve.key:null;if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number"||typeof Ne=="bigint")return gt!==null?null:G(_e,ve,""+Ne,He);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case v:return Ne.key===gt?ue(_e,ve,Ne,He):null;case x:return Ne.key===gt?ke(_e,ve,Ne,He):null;case T:return Ne=Oo(Ne),Me(_e,ve,Ne,He)}if(U(Ne)||O(Ne))return gt!==null?null:Oe(_e,ve,Ne,He,null);if(typeof Ne.then=="function")return Me(_e,ve,wh(Ne),He);if(Ne.$$typeof===C)return Me(_e,ve,vh(_e,Ne),He);Sh(_e,Ne)}return null}function Le(_e,ve,Ne,He,gt){if(typeof He=="string"&&He!==""||typeof He=="number"||typeof He=="bigint")return _e=_e.get(Ne)||null,G(ve,_e,""+He,gt);if(typeof He=="object"&&He!==null){switch(He.$$typeof){case v:return _e=_e.get(He.key===null?Ne:He.key)||null,ue(ve,_e,He,gt);case x:return _e=_e.get(He.key===null?Ne:He.key)||null,ke(ve,_e,He,gt);case T:return He=Oo(He),Le(_e,ve,Ne,He,gt)}if(U(He)||O(He))return _e=_e.get(Ne)||null,Oe(ve,_e,He,gt,null);if(typeof He.then=="function")return Le(_e,ve,Ne,wh(He),gt);if(He.$$typeof===C)return Le(_e,ve,Ne,vh(ve,He),gt);Sh(ve,He)}return null}function ct(_e,ve,Ne,He){for(var gt=null,Zt=null,ut=ve,At=ve=0,Ht=null;ut!==null&&At<Ne.length;At++){ut.index>At?(Ht=ut,ut=null):Ht=ut.sibling;var Jt=Me(_e,ut,Ne[At],He);if(Jt===null){ut===null&&(ut=Ht);break}s&&ut&&Jt.alternate===null&&o(_e,ut),ve=N(Jt,ve,At),Zt===null?gt=Jt:Zt.sibling=Jt,Zt=Jt,ut=Ht}if(At===Ne.length)return d(_e,ut),qt&&Pi(_e,At),gt;if(ut===null){for(;At<Ne.length;At++)ut=Ve(_e,Ne[At],He),ut!==null&&(ve=N(ut,ve,At),Zt===null?gt=ut:Zt.sibling=ut,Zt=ut);return qt&&Pi(_e,At),gt}for(ut=y(ut);At<Ne.length;At++)Ht=Le(ut,_e,At,Ne[At],He),Ht!==null&&(s&&Ht.alternate!==null&&ut.delete(Ht.key===null?At:Ht.key),ve=N(Ht,ve,At),Zt===null?gt=Ht:Zt.sibling=Ht,Zt=Ht);return s&&ut.forEach(function(Yr){return o(_e,Yr)}),qt&&Pi(_e,At),gt}function _t(_e,ve,Ne,He){if(Ne==null)throw Error(a(151));for(var gt=null,Zt=null,ut=ve,At=ve=0,Ht=null,Jt=Ne.next();ut!==null&&!Jt.done;At++,Jt=Ne.next()){ut.index>At?(Ht=ut,ut=null):Ht=ut.sibling;var Yr=Me(_e,ut,Jt.value,He);if(Yr===null){ut===null&&(ut=Ht);break}s&&ut&&Yr.alternate===null&&o(_e,ut),ve=N(Yr,ve,At),Zt===null?gt=Yr:Zt.sibling=Yr,Zt=Yr,ut=Ht}if(Jt.done)return d(_e,ut),qt&&Pi(_e,At),gt;if(ut===null){for(;!Jt.done;At++,Jt=Ne.next())Jt=Ve(_e,Jt.value,He),Jt!==null&&(ve=N(Jt,ve,At),Zt===null?gt=Jt:Zt.sibling=Jt,Zt=Jt);return qt&&Pi(_e,At),gt}for(ut=y(ut);!Jt.done;At++,Jt=Ne.next())Jt=Le(ut,_e,At,Jt.value,He),Jt!==null&&(s&&Jt.alternate!==null&&ut.delete(Jt.key===null?At:Jt.key),ve=N(Jt,ve,At),Zt===null?gt=Jt:Zt.sibling=Jt,Zt=Jt);return s&&ut.forEach(function(aR){return o(_e,aR)}),qt&&Pi(_e,At),gt}function gn(_e,ve,Ne,He){if(typeof Ne=="object"&&Ne!==null&&Ne.type===b&&Ne.key===null&&(Ne=Ne.props.children),typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case v:e:{for(var gt=Ne.key;ve!==null;){if(ve.key===gt){if(gt=Ne.type,gt===b){if(ve.tag===7){d(_e,ve.sibling),He=w(ve,Ne.props.children),He.return=_e,_e=He;break e}}else if(ve.elementType===gt||typeof gt=="object"&>!==null&>.$$typeof===T&&Oo(gt)===ve.type){d(_e,ve.sibling),He=w(ve,Ne.props),Cu(He,Ne),He.return=_e,_e=He;break e}d(_e,ve);break}else o(_e,ve);ve=ve.sibling}Ne.type===b?(He=Lo(Ne.props.children,_e.mode,He,Ne.key),He.return=_e,_e=He):(He=mh(Ne.type,Ne.key,Ne.props,null,_e.mode,He),Cu(He,Ne),He.return=_e,_e=He)}return P(_e);case x:e:{for(gt=Ne.key;ve!==null;){if(ve.key===gt)if(ve.tag===4&&ve.stateNode.containerInfo===Ne.containerInfo&&ve.stateNode.implementation===Ne.implementation){d(_e,ve.sibling),He=w(ve,Ne.children||[]),He.return=_e,_e=He;break e}else{d(_e,ve);break}else o(_e,ve);ve=ve.sibling}He=dm(Ne,_e.mode,He),He.return=_e,_e=He}return P(_e);case T:return Ne=Oo(Ne),gn(_e,ve,Ne,He)}if(U(Ne))return ct(_e,ve,Ne,He);if(O(Ne)){if(gt=O(Ne),typeof gt!="function")throw Error(a(150));return Ne=gt.call(Ne),_t(_e,ve,Ne,He)}if(typeof Ne.then=="function")return gn(_e,ve,wh(Ne),He);if(Ne.$$typeof===C)return gn(_e,ve,vh(_e,Ne),He);Sh(_e,Ne)}return typeof Ne=="string"&&Ne!==""||typeof Ne=="number"||typeof Ne=="bigint"?(Ne=""+Ne,ve!==null&&ve.tag===6?(d(_e,ve.sibling),He=w(ve,Ne),He.return=_e,_e=He):(d(_e,ve),He=um(Ne,_e.mode,He),He.return=_e,_e=He),P(_e)):d(_e,ve)}return function(_e,ve,Ne,He){try{ku=0;var gt=gn(_e,ve,Ne,He);return Kl=null,gt}catch(ut){if(ut===Gl||ut===bh)throw ut;var Zt=xs(29,ut,null,_e.mode);return Zt.lanes=He,Zt.return=_e,Zt}finally{}}}var Bo=r1(!0),o1=r1(!1),Er=!1;function Sm(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Nm(s,o){s=s.updateQueue,o.updateQueue===s&&(o.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Rr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Lr(s,o,d){var y=s.updateQueue;if(y===null)return null;if(y=y.shared,(tn&2)!==0){var w=y.pending;return w===null?o.next=o:(o.next=w.next,w.next=o),y.pending=o,o=ph(s),q0(s,null,d),o}return es(s,y,o,d),ph(s)}function Mu(s,o,d){if(o=o.updateQueue,o!==null&&(o=o.shared,(d&4194048)!==0)){var y=o.lanes;y&=s.pendingLanes,d|=y,o.lanes=d,Gt(s,d)}}function km(s,o){var d=s.updateQueue,y=s.alternate;if(y!==null&&(y=y.updateQueue,d===y)){var w=null,N=null;if(d=d.firstBaseUpdate,d!==null){do{var P={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};N===null?w=N=P:N=N.next=P,d=d.next}while(d!==null);N===null?w=N=o:N=N.next=o}else w=N=o;d={baseState:y.baseState,firstBaseUpdate:w,lastBaseUpdate:N,shared:y.shared,callbacks:y.callbacks},s.updateQueue=d;return}s=d.lastBaseUpdate,s===null?d.firstBaseUpdate=o:s.next=o,d.lastBaseUpdate=o}var Cm=!1;function ju(){if(Cm){var s=Yl;if(s!==null)throw s}}function Eu(s,o,d,y){Cm=!1;var w=s.updateQueue;Er=!1;var N=w.firstBaseUpdate,P=w.lastBaseUpdate,G=w.shared.pending;if(G!==null){w.shared.pending=null;var ue=G,ke=ue.next;ue.next=null,P===null?N=ke:P.next=ke,P=ue;var Oe=s.alternate;Oe!==null&&(Oe=Oe.updateQueue,G=Oe.lastBaseUpdate,G!==P&&(G===null?Oe.firstBaseUpdate=ke:G.next=ke,Oe.lastBaseUpdate=ue))}if(N!==null){var Ve=w.baseState;P=0,Oe=ke=ue=null,G=N;do{var Me=G.lane&-536870913,Le=Me!==G.lane;if(Le?(Pt&Me)===Me:(y&Me)===Me){Me!==0&&Me===Vl&&(Cm=!0),Oe!==null&&(Oe=Oe.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var ct=s,_t=G;Me=o;var gn=d;switch(_t.tag){case 1:if(ct=_t.payload,typeof ct=="function"){Ve=ct.call(gn,Ve,Me);break e}Ve=ct;break e;case 3:ct.flags=ct.flags&-65537|128;case 0:if(ct=_t.payload,Me=typeof ct=="function"?ct.call(gn,Ve,Me):ct,Me==null)break e;Ve=p({},Ve,Me);break e;case 2:Er=!0}}Me=G.callback,Me!==null&&(s.flags|=64,Le&&(s.flags|=8192),Le=w.callbacks,Le===null?w.callbacks=[Me]:Le.push(Me))}else Le={lane:Me,tag:G.tag,payload:G.payload,callback:G.callback,next:null},Oe===null?(ke=Oe=Le,ue=Ve):Oe=Oe.next=Le,P|=Me;if(G=G.next,G===null){if(G=w.shared.pending,G===null)break;Le=G,G=Le.next,Le.next=null,w.lastBaseUpdate=Le,w.shared.pending=null}}while(!0);Oe===null&&(ue=Ve),w.baseState=ue,w.firstBaseUpdate=ke,w.lastBaseUpdate=Oe,N===null&&(w.shared.lanes=0),Or|=P,s.lanes=P,s.memoizedState=Ve}}function l1(s,o){if(typeof s!="function")throw Error(a(191,s));s.call(o)}function c1(s,o){var d=s.callbacks;if(d!==null)for(s.callbacks=null,s=0;s<d.length;s++)l1(d[s],o)}var Ql=he(null),Nh=he(0);function u1(s,o){s=Wi,H(Nh,s),H(Ql,o),Wi=s|o.baseLanes}function Mm(){H(Nh,Wi),H(Ql,Ql.current)}function jm(){Wi=Nh.current,pe(Ql),pe(Nh)}var bs=he(null),Hs=null;function Tr(s){var o=s.alternate;H(ta,ta.current&1),H(bs,s),Hs===null&&(o===null||Ql.current!==null||o.memoizedState!==null)&&(Hs=s)}function Em(s){H(ta,ta.current),H(bs,s),Hs===null&&(Hs=s)}function d1(s){s.tag===22?(H(ta,ta.current),H(bs,s),Hs===null&&(Hs=s)):Ar()}function Ar(){H(ta,ta.current),H(bs,bs.current)}function _s(s){pe(bs),Hs===s&&(Hs=null),pe(ta)}var ta=he(0);function kh(s){for(var o=s;o!==null;){if(o.tag===13){var d=o.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Dg(d)||Og(d)))return o}else if(o.tag===19&&(o.memoizedProps.revealOrder==="forwards"||o.memoizedProps.revealOrder==="backwards"||o.memoizedProps.revealOrder==="unstable_legacy-backwards"||o.memoizedProps.revealOrder==="together")){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Vi=0,Et=null,pn=null,oa=null,Ch=!1,Xl=!1,$o=!1,Mh=0,Ru=0,Zl=null,Gj=0;function Gn(){throw Error(a(321))}function Rm(s,o){if(o===null)return!1;for(var d=0;d<o.length&&d<s.length;d++)if(!Vn(s[d],o[d]))return!1;return!0}function Lm(s,o,d,y,w,N){return Vi=N,Et=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,F.H=s===null||s.memoizedState===null?K1:Ym,$o=!1,N=d(y,w),$o=!1,Xl&&(N=f1(o,d,y,w)),h1(s),N}function h1(s){F.H=Au;var o=pn!==null&&pn.next!==null;if(Vi=0,oa=pn=Et=null,Ch=!1,Ru=0,Zl=null,o)throw Error(a(300));s===null||la||(s=s.dependencies,s!==null&&yh(s)&&(la=!0))}function f1(s,o,d,y){Et=s;var w=0;do{if(Xl&&(Zl=null),Ru=0,Xl=!1,25<=w)throw Error(a(301));if(w+=1,oa=pn=null,s.updateQueue!=null){var N=s.updateQueue;N.lastEffect=null,N.events=null,N.stores=null,N.memoCache!=null&&(N.memoCache.index=0)}F.H=Q1,N=o(d,y)}while(Xl);return N}function Kj(){var s=F.H,o=s.useState()[0];return o=typeof o.then=="function"?Lu(o):o,s=s.useState()[0],(pn!==null?pn.memoizedState:null)!==s&&(Et.flags|=1024),o}function Tm(){var s=Mh!==0;return Mh=0,s}function Am(s,o,d){o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~d}function Im(s){if(Ch){for(s=s.memoizedState;s!==null;){var o=s.queue;o!==null&&(o.pending=null),s=s.next}Ch=!1}Vi=0,oa=pn=Et=null,Xl=!1,Ru=Mh=0,Zl=null}function qa(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return oa===null?Et.memoizedState=oa=s:oa=oa.next=s,oa}function na(){if(pn===null){var s=Et.alternate;s=s!==null?s.memoizedState:null}else s=pn.next;var o=oa===null?Et.memoizedState:oa.next;if(o!==null)oa=o,pn=s;else{if(s===null)throw Et.alternate===null?Error(a(467)):Error(a(310));pn=s,s={memoizedState:pn.memoizedState,baseState:pn.baseState,baseQueue:pn.baseQueue,queue:pn.queue,next:null},oa===null?Et.memoizedState=oa=s:oa=oa.next=s}return oa}function jh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Lu(s){var o=Ru;return Ru+=1,Zl===null&&(Zl=[]),s=a1(Zl,s,o),o=Et,(oa===null?o.memoizedState:oa.next)===null&&(o=o.alternate,F.H=o===null||o.memoizedState===null?K1:Ym),s}function Eh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Lu(s);if(s.$$typeof===C)return Ma(s)}throw Error(a(438,String(s)))}function Dm(s){var o=null,d=Et.updateQueue;if(d!==null&&(o=d.memoCache),o==null){var y=Et.alternate;y!==null&&(y=y.updateQueue,y!==null&&(y=y.memoCache,y!=null&&(o={data:y.data.map(function(w){return w.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),d===null&&(d=jh(),Et.updateQueue=d),d.memoCache=o,d=o.data[o.index],d===void 0)for(d=o.data[o.index]=Array(s),y=0;y<s;y++)d[y]=R;return o.index++,d}function Yi(s,o){return typeof o=="function"?o(s):o}function Rh(s){var o=na();return Om(o,pn,s)}function Om(s,o,d){var y=s.queue;if(y===null)throw Error(a(311));y.lastRenderedReducer=d;var w=s.baseQueue,N=y.pending;if(N!==null){if(w!==null){var P=w.next;w.next=N.next,N.next=P}o.baseQueue=w=N,y.pending=null}if(N=s.baseState,w===null)s.memoizedState=N;else{o=w.next;var G=P=null,ue=null,ke=o,Oe=!1;do{var Ve=ke.lane&-536870913;if(Ve!==ke.lane?(Pt&Ve)===Ve:(Vi&Ve)===Ve){var Me=ke.revertLane;if(Me===0)ue!==null&&(ue=ue.next={lane:0,revertLane:0,gesture:null,action:ke.action,hasEagerState:ke.hasEagerState,eagerState:ke.eagerState,next:null}),Ve===Vl&&(Oe=!0);else if((Vi&Me)===Me){ke=ke.next,Me===Vl&&(Oe=!0);continue}else Ve={lane:0,revertLane:ke.revertLane,gesture:null,action:ke.action,hasEagerState:ke.hasEagerState,eagerState:ke.eagerState,next:null},ue===null?(G=ue=Ve,P=N):ue=ue.next=Ve,Et.lanes|=Me,Or|=Me;Ve=ke.action,$o&&d(N,Ve),N=ke.hasEagerState?ke.eagerState:d(N,Ve)}else Me={lane:Ve,revertLane:ke.revertLane,gesture:ke.gesture,action:ke.action,hasEagerState:ke.hasEagerState,eagerState:ke.eagerState,next:null},ue===null?(G=ue=Me,P=N):ue=ue.next=Me,Et.lanes|=Ve,Or|=Ve;ke=ke.next}while(ke!==null&&ke!==o);if(ue===null?P=N:ue.next=G,!Vn(N,s.memoizedState)&&(la=!0,Oe&&(d=Yl,d!==null)))throw d;s.memoizedState=N,s.baseState=P,s.baseQueue=ue,y.lastRenderedState=N}return w===null&&(y.lanes=0),[s.memoizedState,y.dispatch]}function zm(s){var o=na(),d=o.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=s;var y=d.dispatch,w=d.pending,N=o.memoizedState;if(w!==null){d.pending=null;var P=w=w.next;do N=s(N,P.action),P=P.next;while(P!==w);Vn(N,o.memoizedState)||(la=!0),o.memoizedState=N,o.baseQueue===null&&(o.baseState=N),d.lastRenderedState=N}return[N,y]}function p1(s,o,d){var y=Et,w=na(),N=qt;if(N){if(d===void 0)throw Error(a(407));d=d()}else d=o();var P=!Vn((pn||w).memoizedState,d);if(P&&(w.memoizedState=d,la=!0),w=w.queue,Um(y1.bind(null,y,w,s),[s]),w.getSnapshot!==o||P||oa!==null&&oa.memoizedState.tag&1){if(y.flags|=2048,Jl(9,{destroy:void 0},g1.bind(null,y,w,d,o),null),vn===null)throw Error(a(349));N||(Vi&127)!==0||m1(y,o,d)}return d}function m1(s,o,d){s.flags|=16384,s={getSnapshot:o,value:d},o=Et.updateQueue,o===null?(o=jh(),Et.updateQueue=o,o.stores=[s]):(d=o.stores,d===null?o.stores=[s]:d.push(s))}function g1(s,o,d,y){o.value=d,o.getSnapshot=y,v1(o)&&x1(s)}function y1(s,o,d){return d(function(){v1(o)&&x1(s)})}function v1(s){var o=s.getSnapshot;s=s.value;try{var d=o();return!Vn(s,d)}catch(y){return!0}}function x1(s){var o=vi(s,2);o!==null&&is(o,s,2)}function Bm(s){var o=qa();if(typeof s=="function"){var d=s;if(s=d(),$o){it(!0);try{d()}finally{it(!1)}}}return o.memoizedState=o.baseState=s,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yi,lastRenderedState:s},o}function b1(s,o,d,y){return s.baseState=d,Om(s,pn,typeof y=="function"?y:Yi)}function Qj(s,o,d,y,w){if(Ah(s))throw Error(a(485));if(s=o.action,s!==null){var N={payload:w,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(P){N.listeners.push(P)}};F.T!==null?d(!0):N.isTransition=!1,y(N),d=o.pending,d===null?(N.next=o.pending=N,_1(o,N)):(N.next=d.next,o.pending=d.next=N)}}function _1(s,o){var d=o.action,y=o.payload,w=s.state;if(o.isTransition){var N=F.T,P={};F.T=P;try{var G=d(w,y),ue=F.S;ue!==null&&ue(P,G),w1(s,o,G)}catch(ke){$m(s,o,ke)}finally{N!==null&&P.types!==null&&(N.types=P.types),F.T=N}}else try{N=d(w,y),w1(s,o,N)}catch(ke){$m(s,o,ke)}}function w1(s,o,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(y){S1(s,o,y)},function(y){return $m(s,o,y)}):S1(s,o,d)}function S1(s,o,d){o.status="fulfilled",o.value=d,N1(o),s.state=d,o=s.pending,o!==null&&(d=o.next,d===o?s.pending=null:(d=d.next,o.next=d,_1(s,d)))}function $m(s,o,d){var y=s.pending;if(s.pending=null,y!==null){y=y.next;do o.status="rejected",o.reason=d,N1(o),o=o.next;while(o!==y)}s.action=null}function N1(s){s=s.listeners;for(var o=0;o<s.length;o++)(0,s[o])()}function k1(s,o){return o}function C1(s,o){if(qt){var d=vn.formState;if(d!==null){e:{var y=Et;if(qt){if(Rn){t:{for(var w=Rn,N=Ps;w.nodeType!==8;){if(!N){w=null;break t}if(w=qs(w.nextSibling),w===null){w=null;break t}}N=w.data,w=N==="F!"||N==="F"?w:null}if(w){Rn=qs(w.nextSibling),y=w.data==="F!";break e}}Mr(y)}y=!1}y&&(o=d[0])}}return d=qa(),d.memoizedState=d.baseState=o,y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:k1,lastRenderedState:o},d.queue=y,d=V1.bind(null,Et,y),y.dispatch=d,y=Bm(!1),N=Vm.bind(null,Et,!1,y.queue),y=qa(),w={state:o,dispatch:null,action:s,pending:null},y.queue=w,d=Qj.bind(null,Et,w,N,d),w.dispatch=d,y.memoizedState=s,[o,d,!1]}function M1(s){var o=na();return j1(o,pn,s)}function j1(s,o,d){if(o=Om(s,o,k1)[0],s=Rh(Yi)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var y=Lu(o)}catch(P){throw P===Gl?bh:P}else y=o;o=na();var w=o.queue,N=w.dispatch;return d!==o.memoizedState&&(Et.flags|=2048,Jl(9,{destroy:void 0},Xj.bind(null,w,d),null)),[y,N,s]}function Xj(s,o){s.action=o}function E1(s){var o=na(),d=pn;if(d!==null)return j1(o,d,s);na(),o=o.memoizedState,d=na();var y=d.queue.dispatch;return d.memoizedState=s,[o,y,!1]}function Jl(s,o,d,y){return s={tag:s,create:d,deps:y,inst:o,next:null},o=Et.updateQueue,o===null&&(o=jh(),Et.updateQueue=o),d=o.lastEffect,d===null?o.lastEffect=s.next=s:(y=d.next,d.next=s,s.next=y,o.lastEffect=s),s}function R1(){return na().memoizedState}function Lh(s,o,d,y){var w=qa();Et.flags|=s,w.memoizedState=Jl(1|o,{destroy:void 0},d,y===void 0?null:y)}function Th(s,o,d,y){var w=na();y=y===void 0?null:y;var N=w.memoizedState.inst;pn!==null&&y!==null&&Rm(y,pn.memoizedState.deps)?w.memoizedState=Jl(o,N,d,y):(Et.flags|=s,w.memoizedState=Jl(1|o,N,d,y))}function L1(s,o){Lh(8390656,8,s,o)}function Um(s,o){Th(2048,8,s,o)}function Zj(s){Et.flags|=4;var o=Et.updateQueue;if(o===null)o=jh(),Et.updateQueue=o,o.events=[s];else{var d=o.events;d===null?o.events=[s]:d.push(s)}}function T1(s){var o=na().memoizedState;return Zj({ref:o,nextImpl:s}),function(){if((tn&2)!==0)throw Error(a(440));return o.impl.apply(void 0,arguments)}}function A1(s,o){return Th(4,2,s,o)}function I1(s,o){return Th(4,4,s,o)}function D1(s,o){if(typeof o=="function"){s=s();var d=o(s);return function(){typeof d=="function"?d():o(null)}}if(o!=null)return s=s(),o.current=s,function(){o.current=null}}function O1(s,o,d){d=d!=null?d.concat([s]):null,Th(4,4,D1.bind(null,o,s),d)}function Fm(){}function z1(s,o){var d=na();o=o===void 0?null:o;var y=d.memoizedState;return o!==null&&Rm(o,y[1])?y[0]:(d.memoizedState=[s,o],s)}function B1(s,o){var d=na();o=o===void 0?null:o;var y=d.memoizedState;if(o!==null&&Rm(o,y[1]))return y[0];if(y=s(),$o){it(!0);try{s()}finally{it(!1)}}return d.memoizedState=[y,o],y}function Pm(s,o,d){return d===void 0||(Vi&1073741824)!==0&&(Pt&261930)===0?s.memoizedState=o:(s.memoizedState=d,s=$b(),Et.lanes|=s,Or|=s,d)}function $1(s,o,d,y){return Vn(d,o)?d:Ql.current!==null?(s=Pm(s,d,y),Vn(s,o)||(la=!0),s):(Vi&42)===0||(Vi&1073741824)!==0&&(Pt&261930)===0?(la=!0,s.memoizedState=d):(s=$b(),Et.lanes|=s,Or|=s,o)}function U1(s,o,d,y,w){var N=Y.p;Y.p=N!==0&&8>N?N:8;var P=F.T,G={};F.T=G,Vm(s,!1,o,d);try{var ue=w(),ke=F.S;if(ke!==null&&ke(G,ue),ue!==null&&typeof ue=="object"&&typeof ue.then=="function"){var Oe=Yj(ue,y);Tu(s,o,Oe,Ns(s))}else Tu(s,o,y,Ns(s))}catch(Ve){Tu(s,o,{then:function(){},status:"rejected",reason:Ve},Ns())}finally{Y.p=N,P!==null&&G.types!==null&&(P.types=G.types),F.T=P}}function Jj(){}function Hm(s,o,d,y){if(s.tag!==5)throw Error(a(476));var w=F1(s).queue;U1(s,w,o,X,d===null?Jj:function(){return P1(s),d(y)})}function F1(s){var o=s.memoizedState;if(o!==null)return o;o={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yi,lastRenderedState:X},next:null};var d={};return o.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yi,lastRenderedState:d},next:null},s.memoizedState=o,s=s.alternate,s!==null&&(s.memoizedState=o),o}function P1(s){var o=F1(s);o.next===null&&(o=s.alternate.memoizedState),Tu(s,o.next.queue,{},Ns())}function qm(){return Ma(Qu)}function H1(){return na().memoizedState}function q1(){return na().memoizedState}function Wj(s){for(var o=s.return;o!==null;){switch(o.tag){case 24:case 3:var d=Ns();s=Rr(d);var y=Lr(o,s,d);y!==null&&(is(y,o,d),Mu(y,o,d)),o={cache:xm()},s.payload=o;return}o=o.return}}function eE(s,o,d){var y=Ns();d={lane:y,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ah(s)?Y1(o,d):(d=Bs(s,o,d,y),d!==null&&(is(d,s,y),G1(d,o,y)))}function V1(s,o,d){var y=Ns();Tu(s,o,d,y)}function Tu(s,o,d,y){var w={lane:y,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(Ah(s))Y1(o,w);else{var N=s.alternate;if(s.lanes===0&&(N===null||N.lanes===0)&&(N=o.lastRenderedReducer,N!==null))try{var P=o.lastRenderedState,G=N(P,d);if(w.hasEagerState=!0,w.eagerState=G,Vn(G,P))return es(s,o,w,0),vn===null&&Ui(),!1}catch(ue){}finally{}if(d=Bs(s,o,w,y),d!==null)return is(d,s,y),G1(d,o,y),!0}return!1}function Vm(s,o,d,y){if(y={lane:2,revertLane:Sg(),gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},Ah(s)){if(o)throw Error(a(479))}else o=Bs(s,d,y,2),o!==null&&is(o,s,2)}function Ah(s){var o=s.alternate;return s===Et||o!==null&&o===Et}function Y1(s,o){Xl=Ch=!0;var d=s.pending;d===null?o.next=o:(o.next=d.next,d.next=o),s.pending=o}function G1(s,o,d){if((d&4194048)!==0){var y=o.lanes;y&=s.pendingLanes,d|=y,o.lanes=d,Gt(s,d)}}var Au={readContext:Ma,use:Eh,useCallback:Gn,useContext:Gn,useEffect:Gn,useImperativeHandle:Gn,useLayoutEffect:Gn,useInsertionEffect:Gn,useMemo:Gn,useReducer:Gn,useRef:Gn,useState:Gn,useDebugValue:Gn,useDeferredValue:Gn,useTransition:Gn,useSyncExternalStore:Gn,useId:Gn,useHostTransitionStatus:Gn,useFormState:Gn,useActionState:Gn,useOptimistic:Gn,useMemoCache:Gn,useCacheRefresh:Gn};Au.useEffectEvent=Gn;var K1={readContext:Ma,use:Eh,useCallback:function(s,o){return qa().memoizedState=[s,o===void 0?null:o],s},useContext:Ma,useEffect:L1,useImperativeHandle:function(s,o,d){d=d!=null?d.concat([s]):null,Lh(4194308,4,D1.bind(null,o,s),d)},useLayoutEffect:function(s,o){return Lh(4194308,4,s,o)},useInsertionEffect:function(s,o){Lh(4,2,s,o)},useMemo:function(s,o){var d=qa();o=o===void 0?null:o;var y=s();if($o){it(!0);try{s()}finally{it(!1)}}return d.memoizedState=[y,o],y},useReducer:function(s,o,d){var y=qa();if(d!==void 0){var w=d(o);if($o){it(!0);try{d(o)}finally{it(!1)}}}else w=o;return y.memoizedState=y.baseState=w,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:w},y.queue=s,s=s.dispatch=eE.bind(null,Et,s),[y.memoizedState,s]},useRef:function(s){var o=qa();return s={current:s},o.memoizedState=s},useState:function(s){s=Bm(s);var o=s.queue,d=V1.bind(null,Et,o);return o.dispatch=d,[s.memoizedState,d]},useDebugValue:Fm,useDeferredValue:function(s,o){var d=qa();return Pm(d,s,o)},useTransition:function(){var s=Bm(!1);return s=U1.bind(null,Et,s.queue,!0,!1),qa().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,o,d){var y=Et,w=qa();if(qt){if(d===void 0)throw Error(a(407));d=d()}else{if(d=o(),vn===null)throw Error(a(349));(Pt&127)!==0||m1(y,o,d)}w.memoizedState=d;var N={value:d,getSnapshot:o};return w.queue=N,L1(y1.bind(null,y,N,s),[s]),y.flags|=2048,Jl(9,{destroy:void 0},g1.bind(null,y,N,d,o),null),d},useId:function(){var s=qa(),o=vn.identifierPrefix;if(qt){var d=bi,y=xi;d=(y&~(1<<32-kt(y)-1)).toString(32)+d,o="_"+o+"R_"+d,d=Mh++,0<d&&(o+="H"+d.toString(32)),o+="_"}else d=Gj++,o="_"+o+"r_"+d.toString(32)+"_";return s.memoizedState=o},useHostTransitionStatus:qm,useFormState:C1,useActionState:C1,useOptimistic:function(s){var o=qa();o.memoizedState=o.baseState=s;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=d,o=Vm.bind(null,Et,!0,d),d.dispatch=o,[s,o]},useMemoCache:Dm,useCacheRefresh:function(){return qa().memoizedState=Wj.bind(null,Et)},useEffectEvent:function(s){var o=qa(),d={impl:s};return o.memoizedState=d,function(){if((tn&2)!==0)throw Error(a(440));return d.impl.apply(void 0,arguments)}}},Ym={readContext:Ma,use:Eh,useCallback:z1,useContext:Ma,useEffect:Um,useImperativeHandle:O1,useInsertionEffect:A1,useLayoutEffect:I1,useMemo:B1,useReducer:Rh,useRef:R1,useState:function(){return Rh(Yi)},useDebugValue:Fm,useDeferredValue:function(s,o){var d=na();return $1(d,pn.memoizedState,s,o)},useTransition:function(){var s=Rh(Yi)[0],o=na().memoizedState;return[typeof s=="boolean"?s:Lu(s),o]},useSyncExternalStore:p1,useId:H1,useHostTransitionStatus:qm,useFormState:M1,useActionState:M1,useOptimistic:function(s,o){var d=na();return b1(d,pn,s,o)},useMemoCache:Dm,useCacheRefresh:q1};Ym.useEffectEvent=T1;var Q1={readContext:Ma,use:Eh,useCallback:z1,useContext:Ma,useEffect:Um,useImperativeHandle:O1,useInsertionEffect:A1,useLayoutEffect:I1,useMemo:B1,useReducer:zm,useRef:R1,useState:function(){return zm(Yi)},useDebugValue:Fm,useDeferredValue:function(s,o){var d=na();return pn===null?Pm(d,s,o):$1(d,pn.memoizedState,s,o)},useTransition:function(){var s=zm(Yi)[0],o=na().memoizedState;return[typeof s=="boolean"?s:Lu(s),o]},useSyncExternalStore:p1,useId:H1,useHostTransitionStatus:qm,useFormState:E1,useActionState:E1,useOptimistic:function(s,o){var d=na();return pn!==null?b1(d,pn,s,o):(d.baseState=s,[s,d.queue.dispatch])},useMemoCache:Dm,useCacheRefresh:q1};Q1.useEffectEvent=T1;function Gm(s,o,d,y){o=s.memoizedState,d=d(y,o),d=d==null?o:p({},o,d),s.memoizedState=d,s.lanes===0&&(s.updateQueue.baseState=d)}var Km={enqueueSetState:function(s,o,d){s=s._reactInternals;var y=Ns(),w=Rr(y);w.payload=o,d!=null&&(w.callback=d),o=Lr(s,w,y),o!==null&&(is(o,s,y),Mu(o,s,y))},enqueueReplaceState:function(s,o,d){s=s._reactInternals;var y=Ns(),w=Rr(y);w.tag=1,w.payload=o,d!=null&&(w.callback=d),o=Lr(s,w,y),o!==null&&(is(o,s,y),Mu(o,s,y))},enqueueForceUpdate:function(s,o){s=s._reactInternals;var d=Ns(),y=Rr(d);y.tag=2,o!=null&&(y.callback=o),o=Lr(s,y,d),o!==null&&(is(o,s,d),Mu(o,s,d))}};function X1(s,o,d,y,w,N,P){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(y,N,P):o.prototype&&o.prototype.isPureReactComponent?!Eo(d,y)||!Eo(w,N):!0}function Z1(s,o,d,y){s=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(d,y),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(d,y),o.state!==s&&Km.enqueueReplaceState(o,o.state,null)}function Uo(s,o){var d=o;if("ref"in o){d={};for(var y in o)y!=="ref"&&(d[y]=o[y])}if(s=s.defaultProps){d===o&&(d=p({},d));for(var w in s)d[w]===void 0&&(d[w]=s[w])}return d}function J1(s){Bi(s)}function W1(s){console.error(s)}function eb(s){Bi(s)}function Ih(s,o){try{var d=s.onUncaughtError;d(o.value,{componentStack:o.stack})}catch(y){setTimeout(function(){throw y})}}function tb(s,o,d){try{var y=s.onCaughtError;y(d.value,{componentStack:d.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function Qm(s,o,d){return d=Rr(d),d.tag=3,d.payload={element:null},d.callback=function(){Ih(s,o)},d}function nb(s){return s=Rr(s),s.tag=3,s}function ab(s,o,d,y){var w=d.type.getDerivedStateFromError;if(typeof w=="function"){var N=y.value;s.payload=function(){return w(N)},s.callback=function(){tb(o,d,y)}}var P=d.stateNode;P!==null&&typeof P.componentDidCatch=="function"&&(s.callback=function(){tb(o,d,y),typeof w!="function"&&(zr===null?zr=new Set([this]):zr.add(this));var G=y.stack;this.componentDidCatch(y.value,{componentStack:G!==null?G:""})})}function tE(s,o,d,y,w){if(d.flags|=32768,y!==null&&typeof y=="object"&&typeof y.then=="function"){if(o=d.alternate,o!==null&&ql(o,d,w,!0),d=bs.current,d!==null){switch(d.tag){case 31:case 13:return Hs===null?Yh():d.alternate===null&&Kn===0&&(Kn=3),d.flags&=-257,d.flags|=65536,d.lanes=w,y===_h?d.flags|=16384:(o=d.updateQueue,o===null?d.updateQueue=new Set([y]):o.add(y),bg(s,y,w)),!1;case 22:return d.flags|=65536,y===_h?d.flags|=16384:(o=d.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([y])},d.updateQueue=o):(d=o.retryQueue,d===null?o.retryQueue=new Set([y]):d.add(y)),bg(s,y,w)),!1}throw Error(a(435,d.tag))}return bg(s,y,w),Yh(),!1}if(qt)return o=bs.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=w,y!==pm&&(s=Error(a(422),{cause:y}),wu($s(s,d)))):(y!==pm&&(o=Error(a(423),{cause:y}),wu($s(o,d))),s=s.current.alternate,s.flags|=65536,w&=-w,s.lanes|=w,y=$s(y,d),w=Qm(s.stateNode,y,w),km(s,w),Kn!==4&&(Kn=2)),!1;var N=Error(a(520),{cause:y});if(N=$s(N,d),Fu===null?Fu=[N]:Fu.push(N),Kn!==4&&(Kn=2),o===null)return!0;y=$s(y,d),d=o;do{switch(d.tag){case 3:return d.flags|=65536,s=w&-w,d.lanes|=s,s=Qm(d.stateNode,y,s),km(d,s),!1;case 1:if(o=d.type,N=d.stateNode,(d.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&(zr===null||!zr.has(N))))return d.flags|=65536,w&=-w,d.lanes|=w,w=nb(w),ab(w,s,d,y),km(d,w),!1}d=d.return}while(d!==null);return!1}var Xm=Error(a(461)),la=!1;function ja(s,o,d,y){o.child=s===null?o1(o,null,d,y):Bo(o,s.child,d,y)}function sb(s,o,d,y,w){d=d.render;var N=o.ref;if("ref"in y){var P={};for(var G in y)G!=="ref"&&(P[G]=y[G])}else P=y;return Io(o),y=Lm(s,o,d,P,N,w),G=Tm(),s!==null&&!la?(Am(s,o,w),Gi(s,o,w)):(qt&&G&&hm(o),o.flags|=1,ja(s,o,y,w),o.child)}function ib(s,o,d,y,w){if(s===null){var N=d.type;return typeof N=="function"&&!cm(N)&&N.defaultProps===void 0&&d.compare===null?(o.tag=15,o.type=N,rb(s,o,N,y,w)):(s=mh(d.type,null,y,o,o.mode,w),s.ref=o.ref,s.return=o,o.child=s)}if(N=s.child,!sg(s,w)){var P=N.memoizedProps;if(d=d.compare,d=d!==null?d:Eo,d(P,y)&&s.ref===o.ref)return Gi(s,o,w)}return o.flags|=1,s=Fi(N,y),s.ref=o.ref,s.return=o,o.child=s}function rb(s,o,d,y,w){if(s!==null){var N=s.memoizedProps;if(Eo(N,y)&&s.ref===o.ref)if(la=!1,o.pendingProps=y=N,sg(s,w))(s.flags&131072)!==0&&(la=!0);else return o.lanes=s.lanes,Gi(s,o,w)}return Zm(s,o,d,y,w)}function ob(s,o,d,y){var w=y.children,N=s!==null?s.memoizedState:null;if(s===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),y.mode==="hidden"){if((o.flags&128)!==0){if(N=N!==null?N.baseLanes|d:d,s!==null){for(y=o.child=s.child,w=0;y!==null;)w=w|y.lanes|y.childLanes,y=y.sibling;y=w&~N}else y=0,o.child=null;return lb(s,o,N,d,y)}if((d&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},s!==null&&xh(o,N!==null?N.cachePool:null),N!==null?u1(o,N):Mm(),d1(o);else return y=o.lanes=536870912,lb(s,o,N!==null?N.baseLanes|d:d,d,y)}else N!==null?(xh(o,N.cachePool),u1(o,N),Ar(),o.memoizedState=null):(s!==null&&xh(o,null),Mm(),Ar());return ja(s,o,w,d),o.child}function Iu(s,o){return s!==null&&s.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function lb(s,o,d,y,w){var N=_m();return N=N===null?null:{parent:ra._currentValue,pool:N},o.memoizedState={baseLanes:d,cachePool:N},s!==null&&xh(o,null),Mm(),d1(o),s!==null&&ql(s,o,y,!0),o.childLanes=w,null}function Dh(s,o){return o=zh({mode:o.mode,children:o.children},s.mode),o.ref=s.ref,s.child=o,o.return=s,o}function cb(s,o,d){return Bo(o,s.child,null,d),s=Dh(o,o.pendingProps),s.flags|=2,_s(o),o.memoizedState=null,s}function nE(s,o,d){var y=o.pendingProps,w=(o.flags&128)!==0;if(o.flags&=-129,s===null){if(qt){if(y.mode==="hidden")return s=Dh(o,y),o.lanes=536870912,Iu(null,s);if(Em(o),(s=Rn)?(s=__(s,Ps),s=s!==null&&s.data==="&"?s:null,s!==null&&(o.memoizedState={dehydrated:s,treeContext:kr!==null?{id:xi,overflow:bi}:null,retryLane:536870912,hydrationErrors:null},d=Y0(s),d.return=o,o.child=d,Ca=o,Rn=null)):s=null,s===null)throw Mr(o);return o.lanes=536870912,null}return Dh(o,y)}var N=s.memoizedState;if(N!==null){var P=N.dehydrated;if(Em(o),w)if(o.flags&256)o.flags&=-257,o=cb(s,o,d);else if(o.memoizedState!==null)o.child=s.child,o.flags|=128,o=null;else throw Error(a(558));else if(la||ql(s,o,d,!1),w=(d&s.childLanes)!==0,la||w){if(y=vn,y!==null&&(P=Zn(y,d),P!==0&&P!==N.retryLane))throw N.retryLane=P,vi(s,P),is(y,s,P),Xm;Yh(),o=cb(s,o,d)}else s=N.treeContext,Rn=qs(P.nextSibling),Ca=o,qt=!0,Cr=null,Ps=!1,s!==null&&Q0(o,s),o=Dh(o,y),o.flags|=4096;return o}return s=Fi(s.child,{mode:y.mode,children:y.children}),s.ref=o.ref,o.child=s,s.return=o,s}function Oh(s,o){var d=o.ref;if(d===null)s!==null&&s.ref!==null&&(o.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(a(284));(s===null||s.ref!==d)&&(o.flags|=4194816)}}function Zm(s,o,d,y,w){return Io(o),d=Lm(s,o,d,y,void 0,w),y=Tm(),s!==null&&!la?(Am(s,o,w),Gi(s,o,w)):(qt&&y&&hm(o),o.flags|=1,ja(s,o,d,w),o.child)}function ub(s,o,d,y,w,N){return Io(o),o.updateQueue=null,d=f1(o,y,d,w),h1(s),y=Tm(),s!==null&&!la?(Am(s,o,N),Gi(s,o,N)):(qt&&y&&hm(o),o.flags|=1,ja(s,o,d,N),o.child)}function db(s,o,d,y,w){if(Io(o),o.stateNode===null){var N=Ul,P=d.contextType;typeof P=="object"&&P!==null&&(N=Ma(P)),N=new d(y,N),o.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,N.updater=Km,o.stateNode=N,N._reactInternals=o,N=o.stateNode,N.props=y,N.state=o.memoizedState,N.refs={},Sm(o),P=d.contextType,N.context=typeof P=="object"&&P!==null?Ma(P):Ul,N.state=o.memoizedState,P=d.getDerivedStateFromProps,typeof P=="function"&&(Gm(o,d,P,y),N.state=o.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(P=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),P!==N.state&&Km.enqueueReplaceState(N,N.state,null),Eu(o,y,N,w),ju(),N.state=o.memoizedState),typeof N.componentDidMount=="function"&&(o.flags|=4194308),y=!0}else if(s===null){N=o.stateNode;var G=o.memoizedProps,ue=Uo(d,G);N.props=ue;var ke=N.context,Oe=d.contextType;P=Ul,typeof Oe=="object"&&Oe!==null&&(P=Ma(Oe));var Ve=d.getDerivedStateFromProps;Oe=typeof Ve=="function"||typeof N.getSnapshotBeforeUpdate=="function",G=o.pendingProps!==G,Oe||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(G||ke!==P)&&Z1(o,N,y,P),Er=!1;var Me=o.memoizedState;N.state=Me,Eu(o,y,N,w),ju(),ke=o.memoizedState,G||Me!==ke||Er?(typeof Ve=="function"&&(Gm(o,d,Ve,y),ke=o.memoizedState),(ue=Er||X1(o,d,ue,y,Me,ke,P))?(Oe||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(o.flags|=4194308)):(typeof N.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=y,o.memoizedState=ke),N.props=y,N.state=ke,N.context=P,y=ue):(typeof N.componentDidMount=="function"&&(o.flags|=4194308),y=!1)}else{N=o.stateNode,Nm(s,o),P=o.memoizedProps,Oe=Uo(d,P),N.props=Oe,Ve=o.pendingProps,Me=N.context,ke=d.contextType,ue=Ul,typeof ke=="object"&&ke!==null&&(ue=Ma(ke)),G=d.getDerivedStateFromProps,(ke=typeof G=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(P!==Ve||Me!==ue)&&Z1(o,N,y,ue),Er=!1,Me=o.memoizedState,N.state=Me,Eu(o,y,N,w),ju();var Le=o.memoizedState;P!==Ve||Me!==Le||Er||s!==null&&s.dependencies!==null&&yh(s.dependencies)?(typeof G=="function"&&(Gm(o,d,G,y),Le=o.memoizedState),(Oe=Er||X1(o,d,Oe,y,Me,Le,ue)||s!==null&&s.dependencies!==null&&yh(s.dependencies))?(ke||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(y,Le,ue),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(y,Le,ue)),typeof N.componentDidUpdate=="function"&&(o.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof N.componentDidUpdate!="function"||P===s.memoizedProps&&Me===s.memoizedState||(o.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||P===s.memoizedProps&&Me===s.memoizedState||(o.flags|=1024),o.memoizedProps=y,o.memoizedState=Le),N.props=y,N.state=Le,N.context=ue,y=Oe):(typeof N.componentDidUpdate!="function"||P===s.memoizedProps&&Me===s.memoizedState||(o.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||P===s.memoizedProps&&Me===s.memoizedState||(o.flags|=1024),y=!1)}return N=y,Oh(s,o),y=(o.flags&128)!==0,N||y?(N=o.stateNode,d=y&&typeof d.getDerivedStateFromError!="function"?null:N.render(),o.flags|=1,s!==null&&y?(o.child=Bo(o,s.child,null,w),o.child=Bo(o,null,d,w)):ja(s,o,d,w),o.memoizedState=N.state,s=o.child):s=Gi(s,o,w),s}function hb(s,o,d,y){return To(),o.flags|=256,ja(s,o,d,y),o.child}var Jm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wm(s){return{baseLanes:s,cachePool:t1()}}function eg(s,o,d){return s=s!==null?s.childLanes&~d:0,o&&(s|=Ss),s}function fb(s,o,d){var y=o.pendingProps,w=!1,N=(o.flags&128)!==0,P;if((P=N)||(P=s!==null&&s.memoizedState===null?!1:(ta.current&2)!==0),P&&(w=!0,o.flags&=-129),P=(o.flags&32)!==0,o.flags&=-33,s===null){if(qt){if(w?Tr(o):Ar(),(s=Rn)?(s=__(s,Ps),s=s!==null&&s.data!=="&"?s:null,s!==null&&(o.memoizedState={dehydrated:s,treeContext:kr!==null?{id:xi,overflow:bi}:null,retryLane:536870912,hydrationErrors:null},d=Y0(s),d.return=o,o.child=d,Ca=o,Rn=null)):s=null,s===null)throw Mr(o);return Og(s)?o.lanes=32:o.lanes=536870912,null}var G=y.children;return y=y.fallback,w?(Ar(),w=o.mode,G=zh({mode:"hidden",children:G},w),y=Lo(y,w,d,null),G.return=o,y.return=o,G.sibling=y,o.child=G,y=o.child,y.memoizedState=Wm(d),y.childLanes=eg(s,P,d),o.memoizedState=Jm,Iu(null,y)):(Tr(o),tg(o,G))}var ue=s.memoizedState;if(ue!==null&&(G=ue.dehydrated,G!==null)){if(N)o.flags&256?(Tr(o),o.flags&=-257,o=ng(s,o,d)):o.memoizedState!==null?(Ar(),o.child=s.child,o.flags|=128,o=null):(Ar(),G=y.fallback,w=o.mode,y=zh({mode:"visible",children:y.children},w),G=Lo(G,w,d,null),G.flags|=2,y.return=o,G.return=o,y.sibling=G,o.child=y,Bo(o,s.child,null,d),y=o.child,y.memoizedState=Wm(d),y.childLanes=eg(s,P,d),o.memoizedState=Jm,o=Iu(null,y));else if(Tr(o),Og(G)){if(P=G.nextSibling&&G.nextSibling.dataset,P)var ke=P.dgst;P=ke,y=Error(a(419)),y.stack="",y.digest=P,wu({value:y,source:null,stack:null}),o=ng(s,o,d)}else if(la||ql(s,o,d,!1),P=(d&s.childLanes)!==0,la||P){if(P=vn,P!==null&&(y=Zn(P,d),y!==0&&y!==ue.retryLane))throw ue.retryLane=y,vi(s,y),is(P,s,y),Xm;Dg(G)||Yh(),o=ng(s,o,d)}else Dg(G)?(o.flags|=192,o.child=s.child,o=null):(s=ue.treeContext,Rn=qs(G.nextSibling),Ca=o,qt=!0,Cr=null,Ps=!1,s!==null&&Q0(o,s),o=tg(o,y.children),o.flags|=4096);return o}return w?(Ar(),G=y.fallback,w=o.mode,ue=s.child,ke=ue.sibling,y=Fi(ue,{mode:"hidden",children:y.children}),y.subtreeFlags=ue.subtreeFlags&65011712,ke!==null?G=Fi(ke,G):(G=Lo(G,w,d,null),G.flags|=2),G.return=o,y.return=o,y.sibling=G,o.child=y,Iu(null,y),y=o.child,G=s.child.memoizedState,G===null?G=Wm(d):(w=G.cachePool,w!==null?(ue=ra._currentValue,w=w.parent!==ue?{parent:ue,pool:ue}:w):w=t1(),G={baseLanes:G.baseLanes|d,cachePool:w}),y.memoizedState=G,y.childLanes=eg(s,P,d),o.memoizedState=Jm,Iu(s.child,y)):(Tr(o),d=s.child,s=d.sibling,d=Fi(d,{mode:"visible",children:y.children}),d.return=o,d.sibling=null,s!==null&&(P=o.deletions,P===null?(o.deletions=[s],o.flags|=16):P.push(s)),o.child=d,o.memoizedState=null,d)}function tg(s,o){return o=zh({mode:"visible",children:o},s.mode),o.return=s,s.child=o}function zh(s,o){return s=xs(22,s,null,o),s.lanes=0,s}function ng(s,o,d){return Bo(o,s.child,null,d),s=tg(o,o.pendingProps.children),s.flags|=2,o.memoizedState=null,s}function pb(s,o,d){s.lanes|=o;var y=s.alternate;y!==null&&(y.lanes|=o),ym(s.return,o,d)}function ag(s,o,d,y,w,N){var P=s.memoizedState;P===null?s.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:y,tail:d,tailMode:w,treeForkCount:N}:(P.isBackwards=o,P.rendering=null,P.renderingStartTime=0,P.last=y,P.tail=d,P.tailMode=w,P.treeForkCount=N)}function mb(s,o,d){var y=o.pendingProps,w=y.revealOrder,N=y.tail;y=y.children;var P=ta.current,G=(P&2)!==0;if(G?(P=P&1|2,o.flags|=128):P&=1,H(ta,P),ja(s,o,y,d),y=qt?_u:0,!G&&s!==null&&(s.flags&128)!==0)e:for(s=o.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&pb(s,d,o);else if(s.tag===19)pb(s,d,o);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===o)break e;for(;s.sibling===null;){if(s.return===null||s.return===o)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(w){case"forwards":for(d=o.child,w=null;d!==null;)s=d.alternate,s!==null&&kh(s)===null&&(w=d),d=d.sibling;d=w,d===null?(w=o.child,o.child=null):(w=d.sibling,d.sibling=null),ag(o,!1,w,d,N,y);break;case"backwards":case"unstable_legacy-backwards":for(d=null,w=o.child,o.child=null;w!==null;){if(s=w.alternate,s!==null&&kh(s)===null){o.child=w;break}s=w.sibling,w.sibling=d,d=w,w=s}ag(o,!0,d,null,N,y);break;case"together":ag(o,!1,null,null,void 0,y);break;default:o.memoizedState=null}return o.child}function Gi(s,o,d){if(s!==null&&(o.dependencies=s.dependencies),Or|=o.lanes,(d&o.childLanes)===0)if(s!==null){if(ql(s,o,d,!1),(d&o.childLanes)===0)return null}else return null;if(s!==null&&o.child!==s.child)throw Error(a(153));if(o.child!==null){for(s=o.child,d=Fi(s,s.pendingProps),o.child=d,d.return=o;s.sibling!==null;)s=s.sibling,d=d.sibling=Fi(s,s.pendingProps),d.return=o;d.sibling=null}return o.child}function sg(s,o){return(s.lanes&o)!==0?!0:(s=s.dependencies,!!(s!==null&&yh(s)))}function aE(s,o,d){switch(o.tag){case 3:we(o,o.stateNode.containerInfo),jr(o,ra,s.memoizedState.cache),To();break;case 27:case 5:De(o);break;case 4:we(o,o.stateNode.containerInfo);break;case 10:jr(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,Em(o),null;break;case 13:var y=o.memoizedState;if(y!==null)return y.dehydrated!==null?(Tr(o),o.flags|=128,null):(d&o.child.childLanes)!==0?fb(s,o,d):(Tr(o),s=Gi(s,o,d),s!==null?s.sibling:null);Tr(o);break;case 19:var w=(s.flags&128)!==0;if(y=(d&o.childLanes)!==0,y||(ql(s,o,d,!1),y=(d&o.childLanes)!==0),w){if(y)return mb(s,o,d);o.flags|=128}if(w=o.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),H(ta,ta.current),y)break;return null;case 22:return o.lanes=0,ob(s,o,d,o.pendingProps);case 24:jr(o,ra,s.memoizedState.cache)}return Gi(s,o,d)}function gb(s,o,d){if(s!==null)if(s.memoizedProps!==o.pendingProps)la=!0;else{if(!sg(s,d)&&(o.flags&128)===0)return la=!1,aE(s,o,d);la=(s.flags&131072)!==0}else la=!1,qt&&(o.flags&1048576)!==0&&K0(o,_u,o.index);switch(o.lanes=0,o.tag){case 16:e:{var y=o.pendingProps;if(s=Oo(o.elementType),o.type=s,typeof s=="function")cm(s)?(y=Uo(s,y),o.tag=1,o=db(null,o,s,y,d)):(o.tag=0,o=Zm(null,o,s,y,d));else{if(s!=null){var w=s.$$typeof;if(w===k){o.tag=11,o=sb(null,o,s,y,d);break e}else if(w===I){o.tag=14,o=ib(null,o,s,y,d);break e}}throw o=z(s)||s,Error(a(306,o,""))}}return o;case 0:return Zm(s,o,o.type,o.pendingProps,d);case 1:return y=o.type,w=Uo(y,o.pendingProps),db(s,o,y,w,d);case 3:e:{if(we(o,o.stateNode.containerInfo),s===null)throw Error(a(387));y=o.pendingProps;var N=o.memoizedState;w=N.element,Nm(s,o),Eu(o,y,null,d);var P=o.memoizedState;if(y=P.cache,jr(o,ra,y),y!==N.cache&&vm(o,[ra],d,!0),ju(),y=P.element,N.isDehydrated)if(N={element:y,isDehydrated:!1,cache:P.cache},o.updateQueue.baseState=N,o.memoizedState=N,o.flags&256){o=hb(s,o,y,d);break e}else if(y!==w){w=$s(Error(a(424)),o),wu(w),o=hb(s,o,y,d);break e}else{switch(s=o.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Rn=qs(s.firstChild),Ca=o,qt=!0,Cr=null,Ps=!0,d=o1(o,null,y,d),o.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling}else{if(To(),y===w){o=Gi(s,o,d);break e}ja(s,o,y,d)}o=o.child}return o;case 26:return Oh(s,o),s===null?(d=M_(o.type,null,o.pendingProps,null))?o.memoizedState=d:qt||(d=o.type,s=o.pendingProps,y=Wh(W.current).createElement(d),y[Re]=o,y[We]=s,Ea(y,d,s),Lt(y),o.stateNode=y):o.memoizedState=M_(o.type,s.memoizedProps,o.pendingProps,s.memoizedState),null;case 27:return De(o),s===null&&qt&&(y=o.stateNode=N_(o.type,o.pendingProps,W.current),Ca=o,Ps=!0,w=Rn,Fr(o.type)?(zg=w,Rn=qs(y.firstChild)):Rn=w),ja(s,o,o.pendingProps.children,d),Oh(s,o),s===null&&(o.flags|=4194304),o.child;case 5:return s===null&&qt&&((w=y=Rn)&&(y=AE(y,o.type,o.pendingProps,Ps),y!==null?(o.stateNode=y,Ca=o,Rn=qs(y.firstChild),Ps=!1,w=!0):w=!1),w||Mr(o)),De(o),w=o.type,N=o.pendingProps,P=s!==null?s.memoizedProps:null,y=N.children,Tg(w,N)?y=null:P!==null&&Tg(w,P)&&(o.flags|=32),o.memoizedState!==null&&(w=Lm(s,o,Kj,null,null,d),Qu._currentValue=w),Oh(s,o),ja(s,o,y,d),o.child;case 6:return s===null&&qt&&((s=d=Rn)&&(d=IE(d,o.pendingProps,Ps),d!==null?(o.stateNode=d,Ca=o,Rn=null,s=!0):s=!1),s||Mr(o)),null;case 13:return fb(s,o,d);case 4:return we(o,o.stateNode.containerInfo),y=o.pendingProps,s===null?o.child=Bo(o,null,y,d):ja(s,o,y,d),o.child;case 11:return sb(s,o,o.type,o.pendingProps,d);case 7:return ja(s,o,o.pendingProps,d),o.child;case 8:return ja(s,o,o.pendingProps.children,d),o.child;case 12:return ja(s,o,o.pendingProps.children,d),o.child;case 10:return y=o.pendingProps,jr(o,o.type,y.value),ja(s,o,y.children,d),o.child;case 9:return w=o.type._context,y=o.pendingProps.children,Io(o),w=Ma(w),y=y(w),o.flags|=1,ja(s,o,y,d),o.child;case 14:return ib(s,o,o.type,o.pendingProps,d);case 15:return rb(s,o,o.type,o.pendingProps,d);case 19:return mb(s,o,d);case 31:return nE(s,o,d);case 22:return ob(s,o,d,o.pendingProps);case 24:return Io(o),y=Ma(ra),s===null?(w=_m(),w===null&&(w=vn,N=xm(),w.pooledCache=N,N.refCount++,N!==null&&(w.pooledCacheLanes|=d),w=N),o.memoizedState={parent:y,cache:w},Sm(o),jr(o,ra,w)):((s.lanes&d)!==0&&(Nm(s,o),Eu(o,null,null,d),ju()),w=s.memoizedState,N=o.memoizedState,w.parent!==y?(w={parent:y,cache:y},o.memoizedState=w,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=w),jr(o,ra,y)):(y=N.cache,jr(o,ra,y),y!==w.cache&&vm(o,[ra],d,!0))),ja(s,o,o.pendingProps.children,d),o.child;case 29:throw o.pendingProps}throw Error(a(156,o.tag))}function Ki(s){s.flags|=4}function ig(s,o,d,y,w){if((o=(s.mode&32)!==0)&&(o=!1),o){if(s.flags|=16777216,(w&335544128)===w)if(s.stateNode.complete)s.flags|=8192;else if(Hb())s.flags|=8192;else throw zo=_h,wm}else s.flags&=-16777217}function yb(s,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!T_(o))if(Hb())s.flags|=8192;else throw zo=_h,wm}function Bh(s,o){o!==null&&(s.flags|=4),s.flags&16384&&(o=s.tag!==22?kn():536870912,s.lanes|=o,nc|=o)}function Du(s,o){if(!qt)switch(s.tailMode){case"hidden":o=s.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?s.tail=null:d.sibling=null;break;case"collapsed":d=s.tail;for(var y=null;d!==null;)d.alternate!==null&&(y=d),d=d.sibling;y===null?o||s.tail===null?s.tail=null:s.tail.sibling=null:y.sibling=null}}function Ln(s){var o=s.alternate!==null&&s.alternate.child===s.child,d=0,y=0;if(o)for(var w=s.child;w!==null;)d|=w.lanes|w.childLanes,y|=w.subtreeFlags&65011712,y|=w.flags&65011712,w.return=s,w=w.sibling;else for(w=s.child;w!==null;)d|=w.lanes|w.childLanes,y|=w.subtreeFlags,y|=w.flags,w.return=s,w=w.sibling;return s.subtreeFlags|=y,s.childLanes=d,o}function sE(s,o,d){var y=o.pendingProps;switch(fm(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ln(o),null;case 1:return Ln(o),null;case 3:return d=o.stateNode,y=null,s!==null&&(y=s.memoizedState.cache),o.memoizedState.cache!==y&&(o.flags|=2048),qi(ra),je(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(s===null||s.child===null)&&(Hl(o)?Ki(o):s===null||s.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,mm())),Ln(o),null;case 26:var w=o.type,N=o.memoizedState;return s===null?(Ki(o),N!==null?(Ln(o),yb(o,N)):(Ln(o),ig(o,w,null,y,d))):N?N!==s.memoizedState?(Ki(o),Ln(o),yb(o,N)):(Ln(o),o.flags&=-16777217):(s=s.memoizedProps,s!==y&&Ki(o),Ln(o),ig(o,w,s,y,d)),null;case 27:if(re(o),d=W.current,w=o.type,s!==null&&o.stateNode!=null)s.memoizedProps!==y&&Ki(o);else{if(!y){if(o.stateNode===null)throw Error(a(166));return Ln(o),null}s=te.current,Hl(o)?X0(o):(s=N_(w,y,d),o.stateNode=s,Ki(o))}return Ln(o),null;case 5:if(re(o),w=o.type,s!==null&&o.stateNode!=null)s.memoizedProps!==y&&Ki(o);else{if(!y){if(o.stateNode===null)throw Error(a(166));return Ln(o),null}if(N=te.current,Hl(o))X0(o);else{var P=Wh(W.current);switch(N){case 1:N=P.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:N=P.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":N=P.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":N=P.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":N=P.createElement("div"),N.innerHTML="<script><\/script>",N=N.removeChild(N.firstChild);break;case"select":N=typeof y.is=="string"?P.createElement("select",{is:y.is}):P.createElement("select"),y.multiple?N.multiple=!0:y.size&&(N.size=y.size);break;default:N=typeof y.is=="string"?P.createElement(w,{is:y.is}):P.createElement(w)}}N[Re]=o,N[We]=y;e:for(P=o.child;P!==null;){if(P.tag===5||P.tag===6)N.appendChild(P.stateNode);else if(P.tag!==4&&P.tag!==27&&P.child!==null){P.child.return=P,P=P.child;continue}if(P===o)break e;for(;P.sibling===null;){if(P.return===null||P.return===o)break e;P=P.return}P.sibling.return=P.return,P=P.sibling}o.stateNode=N;e:switch(Ea(N,w,y),w){case"button":case"input":case"select":case"textarea":y=!!y.autoFocus;break e;case"img":y=!0;break e;default:y=!1}y&&Ki(o)}}return Ln(o),ig(o,o.type,s===null?null:s.memoizedProps,o.pendingProps,d),null;case 6:if(s&&o.stateNode!=null)s.memoizedProps!==y&&Ki(o);else{if(typeof y!="string"&&o.stateNode===null)throw Error(a(166));if(s=W.current,Hl(o)){if(s=o.stateNode,d=o.memoizedProps,y=null,w=Ca,w!==null)switch(w.tag){case 27:case 5:y=w.memoizedProps}s[Re]=o,s=!!(s.nodeValue===d||y!==null&&y.suppressHydrationWarning===!0||f_(s.nodeValue,d)),s||Mr(o,!0)}else s=Wh(s).createTextNode(y),s[Re]=o,o.stateNode=s}return Ln(o),null;case 31:if(d=o.memoizedState,s===null||s.memoizedState!==null){if(y=Hl(o),d!==null){if(s===null){if(!y)throw Error(a(318));if(s=o.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(557));s[Re]=o}else To(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Ln(o),s=!1}else d=mm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=d),s=!0;if(!s)return o.flags&256?(_s(o),o):(_s(o),null);if((o.flags&128)!==0)throw Error(a(558))}return Ln(o),null;case 13:if(y=o.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(w=Hl(o),y!==null&&y.dehydrated!==null){if(s===null){if(!w)throw Error(a(318));if(w=o.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(a(317));w[Re]=o}else To(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Ln(o),w=!1}else w=mm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=w),w=!0;if(!w)return o.flags&256?(_s(o),o):(_s(o),null)}return _s(o),(o.flags&128)!==0?(o.lanes=d,o):(d=y!==null,s=s!==null&&s.memoizedState!==null,d&&(y=o.child,w=null,y.alternate!==null&&y.alternate.memoizedState!==null&&y.alternate.memoizedState.cachePool!==null&&(w=y.alternate.memoizedState.cachePool.pool),N=null,y.memoizedState!==null&&y.memoizedState.cachePool!==null&&(N=y.memoizedState.cachePool.pool),N!==w&&(y.flags|=2048)),d!==s&&d&&(o.child.flags|=8192),Bh(o,o.updateQueue),Ln(o),null);case 4:return je(),s===null&&Mg(o.stateNode.containerInfo),Ln(o),null;case 10:return qi(o.type),Ln(o),null;case 19:if(pe(ta),y=o.memoizedState,y===null)return Ln(o),null;if(w=(o.flags&128)!==0,N=y.rendering,N===null)if(w)Du(y,!1);else{if(Kn!==0||s!==null&&(s.flags&128)!==0)for(s=o.child;s!==null;){if(N=kh(s),N!==null){for(o.flags|=128,Du(y,!1),s=N.updateQueue,o.updateQueue=s,Bh(o,s),o.subtreeFlags=0,s=d,d=o.child;d!==null;)V0(d,s),d=d.sibling;return H(ta,ta.current&1|2),qt&&Pi(o,y.treeForkCount),o.child}s=s.sibling}y.tail!==null&&me()>Hh&&(o.flags|=128,w=!0,Du(y,!1),o.lanes=4194304)}else{if(!w)if(s=kh(N),s!==null){if(o.flags|=128,w=!0,s=s.updateQueue,o.updateQueue=s,Bh(o,s),Du(y,!0),y.tail===null&&y.tailMode==="hidden"&&!N.alternate&&!qt)return Ln(o),null}else 2*me()-y.renderingStartTime>Hh&&d!==536870912&&(o.flags|=128,w=!0,Du(y,!1),o.lanes=4194304);y.isBackwards?(N.sibling=o.child,o.child=N):(s=y.last,s!==null?s.sibling=N:o.child=N,y.last=N)}return y.tail!==null?(s=y.tail,y.rendering=s,y.tail=s.sibling,y.renderingStartTime=me(),s.sibling=null,d=ta.current,H(ta,w?d&1|2:d&1),qt&&Pi(o,y.treeForkCount),s):(Ln(o),null);case 22:case 23:return _s(o),jm(),y=o.memoizedState!==null,s!==null?s.memoizedState!==null!==y&&(o.flags|=8192):y&&(o.flags|=8192),y?(d&536870912)!==0&&(o.flags&128)===0&&(Ln(o),o.subtreeFlags&6&&(o.flags|=8192)):Ln(o),d=o.updateQueue,d!==null&&Bh(o,d.retryQueue),d=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),y=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(y=o.memoizedState.cachePool.pool),y!==d&&(o.flags|=2048),s!==null&&pe(Do),null;case 24:return d=null,s!==null&&(d=s.memoizedState.cache),o.memoizedState.cache!==d&&(o.flags|=2048),qi(ra),Ln(o),null;case 25:return null;case 30:return null}throw Error(a(156,o.tag))}function iE(s,o){switch(fm(o),o.tag){case 1:return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 3:return qi(ra),je(),s=o.flags,(s&65536)!==0&&(s&128)===0?(o.flags=s&-65537|128,o):null;case 26:case 27:case 5:return re(o),null;case 31:if(o.memoizedState!==null){if(_s(o),o.alternate===null)throw Error(a(340));To()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 13:if(_s(o),s=o.memoizedState,s!==null&&s.dehydrated!==null){if(o.alternate===null)throw Error(a(340));To()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 19:return pe(ta),null;case 4:return je(),null;case 10:return qi(o.type),null;case 22:case 23:return _s(o),jm(),s!==null&&pe(Do),s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 24:return qi(ra),null;case 25:return null;default:return null}}function vb(s,o){switch(fm(o),o.tag){case 3:qi(ra),je();break;case 26:case 27:case 5:re(o);break;case 4:je();break;case 31:o.memoizedState!==null&&_s(o);break;case 13:_s(o);break;case 19:pe(ta);break;case 10:qi(o.type);break;case 22:case 23:_s(o),jm(),s!==null&&pe(Do);break;case 24:qi(ra)}}function Ou(s,o){try{var d=o.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var w=y.next;d=w;do{if((d.tag&s)===s){y=void 0;var N=d.create,P=d.inst;y=N(),P.destroy=y}d=d.next}while(d!==w)}}catch(G){un(o,o.return,G)}}function Ir(s,o,d){try{var y=o.updateQueue,w=y!==null?y.lastEffect:null;if(w!==null){var N=w.next;y=N;do{if((y.tag&s)===s){var P=y.inst,G=P.destroy;if(G!==void 0){P.destroy=void 0,w=o;var ue=d,ke=G;try{ke()}catch(Oe){un(w,ue,Oe)}}}y=y.next}while(y!==N)}}catch(Oe){un(o,o.return,Oe)}}function xb(s){var o=s.updateQueue;if(o!==null){var d=s.stateNode;try{c1(o,d)}catch(y){un(s,s.return,y)}}}function bb(s,o,d){d.props=Uo(s.type,s.memoizedProps),d.state=s.memoizedState;try{d.componentWillUnmount()}catch(y){un(s,o,y)}}function zu(s,o){try{var d=s.ref;if(d!==null){switch(s.tag){case 26:case 27:case 5:var y=s.stateNode;break;case 30:y=s.stateNode;break;default:y=s.stateNode}typeof d=="function"?s.refCleanup=d(y):d.current=y}}catch(w){un(s,o,w)}}function _i(s,o){var d=s.ref,y=s.refCleanup;if(d!==null)if(typeof y=="function")try{y()}catch(w){un(s,o,w)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(w){un(s,o,w)}else d.current=null}function _b(s){var o=s.type,d=s.memoizedProps,y=s.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":d.autoFocus&&y.focus();break e;case"img":d.src?y.src=d.src:d.srcSet&&(y.srcset=d.srcSet)}}catch(w){un(s,s.return,w)}}function rg(s,o,d){try{var y=s.stateNode;ME(y,s.type,d,o),y[We]=o}catch(w){un(s,s.return,w)}}function wb(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Fr(s.type)||s.tag===4}function og(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||wb(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Fr(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function lg(s,o,d){var y=s.tag;if(y===5||y===6)s=s.stateNode,o?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(s,o):(o=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,o.appendChild(s),d=d._reactRootContainer,d!=null||o.onclick!==null||(o.onclick=Aa));else if(y!==4&&(y===27&&Fr(s.type)&&(d=s.stateNode,o=null),s=s.child,s!==null))for(lg(s,o,d),s=s.sibling;s!==null;)lg(s,o,d),s=s.sibling}function $h(s,o,d){var y=s.tag;if(y===5||y===6)s=s.stateNode,o?d.insertBefore(s,o):d.appendChild(s);else if(y!==4&&(y===27&&Fr(s.type)&&(d=s.stateNode),s=s.child,s!==null))for($h(s,o,d),s=s.sibling;s!==null;)$h(s,o,d),s=s.sibling}function Sb(s){var o=s.stateNode,d=s.memoizedProps;try{for(var y=s.type,w=o.attributes;w.length;)o.removeAttributeNode(w[0]);Ea(o,y,d),o[Re]=s,o[We]=d}catch(N){un(s,s.return,N)}}var Qi=!1,ca=!1,cg=!1,Nb=typeof WeakSet=="function"?WeakSet:Set,xa=null;function rE(s,o){if(s=s.containerInfo,Rg=of,s=xu(s),$l(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var y=d.getSelection&&d.getSelection();if(y&&y.rangeCount!==0){d=y.anchorNode;var w=y.anchorOffset,N=y.focusNode;y=y.focusOffset;try{d.nodeType,N.nodeType}catch(_t){d=null;break e}var P=0,G=-1,ue=-1,ke=0,Oe=0,Ve=s,Me=null;t:for(;;){for(var Le;Ve!==d||w!==0&&Ve.nodeType!==3||(G=P+w),Ve!==N||y!==0&&Ve.nodeType!==3||(ue=P+y),Ve.nodeType===3&&(P+=Ve.nodeValue.length),(Le=Ve.firstChild)!==null;)Me=Ve,Ve=Le;for(;;){if(Ve===s)break t;if(Me===d&&++ke===w&&(G=P),Me===N&&++Oe===y&&(ue=P),(Le=Ve.nextSibling)!==null)break;Ve=Me,Me=Ve.parentNode}Ve=Le}d=G===-1||ue===-1?null:{start:G,end:ue}}else d=null}d=d||{start:0,end:0}}else d=null;for(Lg={focusedElem:s,selectionRange:d},of=!1,xa=o;xa!==null;)if(o=xa,s=o.child,(o.subtreeFlags&1028)!==0&&s!==null)s.return=o,xa=s;else for(;xa!==null;){switch(o=xa,N=o.alternate,s=o.flags,o.tag){case 0:if((s&4)!==0&&(s=o.updateQueue,s=s!==null?s.events:null,s!==null))for(d=0;d<s.length;d++)w=s[d],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&N!==null){s=void 0,d=o,w=N.memoizedProps,N=N.memoizedState,y=d.stateNode;try{var ct=Uo(d.type,w);s=y.getSnapshotBeforeUpdate(ct,N),y.__reactInternalSnapshotBeforeUpdate=s}catch(_t){un(d,d.return,_t)}}break;case 3:if((s&1024)!==0){if(s=o.stateNode.containerInfo,d=s.nodeType,d===9)Ig(s);else if(d===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Ig(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(a(163))}if(s=o.sibling,s!==null){s.return=o.return,xa=s;break}xa=o.return}}function kb(s,o,d){var y=d.flags;switch(d.tag){case 0:case 11:case 15:Zi(s,d),y&4&&Ou(5,d);break;case 1:if(Zi(s,d),y&4)if(s=d.stateNode,o===null)try{s.componentDidMount()}catch(P){un(d,d.return,P)}else{var w=Uo(d.type,o.memoizedProps);o=o.memoizedState;try{s.componentDidUpdate(w,o,s.__reactInternalSnapshotBeforeUpdate)}catch(P){un(d,d.return,P)}}y&64&&xb(d),y&512&&zu(d,d.return);break;case 3:if(Zi(s,d),y&64&&(s=d.updateQueue,s!==null)){if(o=null,d.child!==null)switch(d.child.tag){case 27:case 5:o=d.child.stateNode;break;case 1:o=d.child.stateNode}try{c1(s,o)}catch(P){un(d,d.return,P)}}break;case 27:o===null&&y&4&&Sb(d);case 26:case 5:Zi(s,d),o===null&&y&4&&_b(d),y&512&&zu(d,d.return);break;case 12:Zi(s,d);break;case 31:Zi(s,d),y&4&&jb(s,d);break;case 13:Zi(s,d),y&4&&Eb(s,d),y&64&&(s=d.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(d=mE.bind(null,d),DE(s,d))));break;case 22:if(y=d.memoizedState!==null||Qi,!y){o=o!==null&&o.memoizedState!==null||ca,w=Qi;var N=ca;Qi=y,(ca=o)&&!N?Ji(s,d,(d.subtreeFlags&8772)!==0):Zi(s,d),Qi=w,ca=N}break;case 30:break;default:Zi(s,d)}}function Cb(s){var o=s.alternate;o!==null&&(s.alternate=null,Cb(o)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(o=s.stateNode,o!==null&&en(o)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var zn=null,ts=!1;function Xi(s,o,d){for(d=d.child;d!==null;)Mb(s,o,d),d=d.sibling}function Mb(s,o,d){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(ot,d)}catch(N){}switch(d.tag){case 26:ca||_i(d,o),Xi(s,o,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:ca||_i(d,o);var y=zn,w=ts;Fr(d.type)&&(zn=d.stateNode,ts=!1),Xi(s,o,d),Yu(d.stateNode),zn=y,ts=w;break;case 5:ca||_i(d,o);case 6:if(y=zn,w=ts,zn=null,Xi(s,o,d),zn=y,ts=w,zn!==null)if(ts)try{(zn.nodeType===9?zn.body:zn.nodeName==="HTML"?zn.ownerDocument.body:zn).removeChild(d.stateNode)}catch(N){un(d,o,N)}else try{zn.removeChild(d.stateNode)}catch(N){un(d,o,N)}break;case 18:zn!==null&&(ts?(s=zn,x_(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,d.stateNode),uc(s)):x_(zn,d.stateNode));break;case 4:y=zn,w=ts,zn=d.stateNode.containerInfo,ts=!0,Xi(s,o,d),zn=y,ts=w;break;case 0:case 11:case 14:case 15:Ir(2,d,o),ca||Ir(4,d,o),Xi(s,o,d);break;case 1:ca||(_i(d,o),y=d.stateNode,typeof y.componentWillUnmount=="function"&&bb(d,o,y)),Xi(s,o,d);break;case 21:Xi(s,o,d);break;case 22:ca=(y=ca)||d.memoizedState!==null,Xi(s,o,d),ca=y;break;default:Xi(s,o,d)}}function jb(s,o){if(o.memoizedState===null&&(s=o.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{uc(s)}catch(d){un(o,o.return,d)}}}function Eb(s,o){if(o.memoizedState===null&&(s=o.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{uc(s)}catch(d){un(o,o.return,d)}}function oE(s){switch(s.tag){case 31:case 13:case 19:var o=s.stateNode;return o===null&&(o=s.stateNode=new Nb),o;case 22:return s=s.stateNode,o=s._retryCache,o===null&&(o=s._retryCache=new Nb),o;default:throw Error(a(435,s.tag))}}function Uh(s,o){var d=oE(s);o.forEach(function(y){if(!d.has(y)){d.add(y);var w=gE.bind(null,s,y);y.then(w,w)}})}function ns(s,o){var d=o.deletions;if(d!==null)for(var y=0;y<d.length;y++){var w=d[y],N=s,P=o,G=P;e:for(;G!==null;){switch(G.tag){case 27:if(Fr(G.type)){zn=G.stateNode,ts=!1;break e}break;case 5:zn=G.stateNode,ts=!1;break e;case 3:case 4:zn=G.stateNode.containerInfo,ts=!0;break e}G=G.return}if(zn===null)throw Error(a(160));Mb(N,P,w),zn=null,ts=!1,N=w.alternate,N!==null&&(N.return=null),w.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)Rb(o,s),o=o.sibling}var ri=null;function Rb(s,o){var d=s.alternate,y=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:ns(o,s),as(s),y&4&&(Ir(3,s,s.return),Ou(3,s),Ir(5,s,s.return));break;case 1:ns(o,s),as(s),y&512&&(ca||d===null||_i(d,d.return)),y&64&&Qi&&(s=s.updateQueue,s!==null&&(y=s.callbacks,y!==null&&(d=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=d===null?y:d.concat(y))));break;case 26:var w=ri;if(ns(o,s),as(s),y&512&&(ca||d===null||_i(d,d.return)),y&4){var N=d!==null?d.memoizedState:null;if(y=s.memoizedState,d===null)if(y===null)if(s.stateNode===null){e:{y=s.type,d=s.memoizedProps,w=w.ownerDocument||w;t:switch(y){case"title":N=w.getElementsByTagName("title")[0],(!N||N[Wt]||N[Re]||N.namespaceURI==="http://www.w3.org/2000/svg"||N.hasAttribute("itemprop"))&&(N=w.createElement(y),w.head.insertBefore(N,w.querySelector("head > title"))),Ea(N,y,d),N[Re]=s,Lt(N),y=N;break e;case"link":var P=R_("link","href",w).get(y+(d.href||""));if(P){for(var G=0;G<P.length;G++)if(N=P[G],N.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&N.getAttribute("rel")===(d.rel==null?null:d.rel)&&N.getAttribute("title")===(d.title==null?null:d.title)&&N.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){P.splice(G,1);break t}}N=w.createElement(y),Ea(N,y,d),w.head.appendChild(N);break;case"meta":if(P=R_("meta","content",w).get(y+(d.content||""))){for(G=0;G<P.length;G++)if(N=P[G],N.getAttribute("content")===(d.content==null?null:""+d.content)&&N.getAttribute("name")===(d.name==null?null:d.name)&&N.getAttribute("property")===(d.property==null?null:d.property)&&N.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&N.getAttribute("charset")===(d.charSet==null?null:d.charSet)){P.splice(G,1);break t}}N=w.createElement(y),Ea(N,y,d),w.head.appendChild(N);break;default:throw Error(a(468,y))}N[Re]=s,Lt(N),y=N}s.stateNode=y}else L_(w,s.type,s.stateNode);else s.stateNode=E_(w,y,s.memoizedProps);else N!==y?(N===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):N.count--,y===null?L_(w,s.type,s.stateNode):E_(w,y,s.memoizedProps)):y===null&&s.stateNode!==null&&rg(s,s.memoizedProps,d.memoizedProps)}break;case 27:ns(o,s),as(s),y&512&&(ca||d===null||_i(d,d.return)),d!==null&&y&4&&rg(s,s.memoizedProps,d.memoizedProps);break;case 5:if(ns(o,s),as(s),y&512&&(ca||d===null||_i(d,d.return)),s.flags&32){w=s.stateNode;try{Za(w,"")}catch(ct){un(s,s.return,ct)}}y&4&&s.stateNode!=null&&(w=s.memoizedProps,rg(s,w,d!==null?d.memoizedProps:w)),y&1024&&(cg=!0);break;case 6:if(ns(o,s),as(s),y&4){if(s.stateNode===null)throw Error(a(162));y=s.memoizedProps,d=s.stateNode;try{d.nodeValue=y}catch(ct){un(s,s.return,ct)}}break;case 3:if(nf=null,w=ri,ri=ef(o.containerInfo),ns(o,s),ri=w,as(s),y&4&&d!==null&&d.memoizedState.isDehydrated)try{uc(o.containerInfo)}catch(ct){un(s,s.return,ct)}cg&&(cg=!1,Lb(s));break;case 4:y=ri,ri=ef(s.stateNode.containerInfo),ns(o,s),as(s),ri=y;break;case 12:ns(o,s),as(s);break;case 31:ns(o,s),as(s),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Uh(s,y)));break;case 13:ns(o,s),as(s),s.child.flags&8192&&s.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(Ph=me()),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Uh(s,y)));break;case 22:w=s.memoizedState!==null;var ue=d!==null&&d.memoizedState!==null,ke=Qi,Oe=ca;if(Qi=ke||w,ca=Oe||ue,ns(o,s),ca=Oe,Qi=ke,as(s),y&8192)e:for(o=s.stateNode,o._visibility=w?o._visibility&-2:o._visibility|1,w&&(d===null||ue||Qi||ca||Fo(s)),d=null,o=s;;){if(o.tag===5||o.tag===26){if(d===null){ue=d=o;try{if(N=ue.stateNode,w)P=N.style,typeof P.setProperty=="function"?P.setProperty("display","none","important"):P.display="none";else{G=ue.stateNode;var Ve=ue.memoizedProps.style,Me=Ve!=null&&Ve.hasOwnProperty("display")?Ve.display:null;G.style.display=Me==null||typeof Me=="boolean"?"":(""+Me).trim()}}catch(ct){un(ue,ue.return,ct)}}}else if(o.tag===6){if(d===null){ue=o;try{ue.stateNode.nodeValue=w?"":ue.memoizedProps}catch(ct){un(ue,ue.return,ct)}}}else if(o.tag===18){if(d===null){ue=o;try{var Le=ue.stateNode;w?b_(Le,!0):b_(ue.stateNode,!1)}catch(ct){un(ue,ue.return,ct)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===s)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break e;for(;o.sibling===null;){if(o.return===null||o.return===s)break e;d===o&&(d=null),o=o.return}d===o&&(d=null),o.sibling.return=o.return,o=o.sibling}y&4&&(y=s.updateQueue,y!==null&&(d=y.retryQueue,d!==null&&(y.retryQueue=null,Uh(s,d))));break;case 19:ns(o,s),as(s),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Uh(s,y)));break;case 30:break;case 21:break;default:ns(o,s),as(s)}}function as(s){var o=s.flags;if(o&2){try{for(var d,y=s.return;y!==null;){if(wb(y)){d=y;break}y=y.return}if(d==null)throw Error(a(160));switch(d.tag){case 27:var w=d.stateNode,N=og(s);$h(s,N,w);break;case 5:var P=d.stateNode;d.flags&32&&(Za(P,""),d.flags&=-33);var G=og(s);$h(s,G,P);break;case 3:case 4:var ue=d.stateNode.containerInfo,ke=og(s);lg(s,ke,ue);break;default:throw Error(a(161))}}catch(Oe){un(s,s.return,Oe)}s.flags&=-3}o&4096&&(s.flags&=-4097)}function Lb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var o=s;Lb(o),o.tag===5&&o.flags&1024&&o.stateNode.reset(),s=s.sibling}}function Zi(s,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)kb(s,o.alternate,o),o=o.sibling}function Fo(s){for(s=s.child;s!==null;){var o=s;switch(o.tag){case 0:case 11:case 14:case 15:Ir(4,o,o.return),Fo(o);break;case 1:_i(o,o.return);var d=o.stateNode;typeof d.componentWillUnmount=="function"&&bb(o,o.return,d),Fo(o);break;case 27:Yu(o.stateNode);case 26:case 5:_i(o,o.return),Fo(o);break;case 22:o.memoizedState===null&&Fo(o);break;case 30:Fo(o);break;default:Fo(o)}s=s.sibling}}function Ji(s,o,d){for(d=d&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var y=o.alternate,w=s,N=o,P=N.flags;switch(N.tag){case 0:case 11:case 15:Ji(w,N,d),Ou(4,N);break;case 1:if(Ji(w,N,d),y=N,w=y.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(ke){un(y,y.return,ke)}if(y=N,w=y.updateQueue,w!==null){var G=y.stateNode;try{var ue=w.shared.hiddenCallbacks;if(ue!==null)for(w.shared.hiddenCallbacks=null,w=0;w<ue.length;w++)l1(ue[w],G)}catch(ke){un(y,y.return,ke)}}d&&P&64&&xb(N),zu(N,N.return);break;case 27:Sb(N);case 26:case 5:Ji(w,N,d),d&&y===null&&P&4&&_b(N),zu(N,N.return);break;case 12:Ji(w,N,d);break;case 31:Ji(w,N,d),d&&P&4&&jb(w,N);break;case 13:Ji(w,N,d),d&&P&4&&Eb(w,N);break;case 22:N.memoizedState===null&&Ji(w,N,d),zu(N,N.return);break;case 30:break;default:Ji(w,N,d)}o=o.sibling}}function ug(s,o){var d=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),s=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(s=o.memoizedState.cachePool.pool),s!==d&&(s!=null&&s.refCount++,d!=null&&Su(d))}function dg(s,o){s=null,o.alternate!==null&&(s=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==s&&(o.refCount++,s!=null&&Su(s))}function oi(s,o,d,y){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Tb(s,o,d,y),o=o.sibling}function Tb(s,o,d,y){var w=o.flags;switch(o.tag){case 0:case 11:case 15:oi(s,o,d,y),w&2048&&Ou(9,o);break;case 1:oi(s,o,d,y);break;case 3:oi(s,o,d,y),w&2048&&(s=null,o.alternate!==null&&(s=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==s&&(o.refCount++,s!=null&&Su(s)));break;case 12:if(w&2048){oi(s,o,d,y),s=o.stateNode;try{var N=o.memoizedProps,P=N.id,G=N.onPostCommit;typeof G=="function"&&G(P,o.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(ue){un(o,o.return,ue)}}else oi(s,o,d,y);break;case 31:oi(s,o,d,y);break;case 13:oi(s,o,d,y);break;case 23:break;case 22:N=o.stateNode,P=o.alternate,o.memoizedState!==null?N._visibility&2?oi(s,o,d,y):Bu(s,o):N._visibility&2?oi(s,o,d,y):(N._visibility|=2,Wl(s,o,d,y,(o.subtreeFlags&10256)!==0||!1)),w&2048&&ug(P,o);break;case 24:oi(s,o,d,y),w&2048&&dg(o.alternate,o);break;default:oi(s,o,d,y)}}function Wl(s,o,d,y,w){for(w=w&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var N=s,P=o,G=d,ue=y,ke=P.flags;switch(P.tag){case 0:case 11:case 15:Wl(N,P,G,ue,w),Ou(8,P);break;case 23:break;case 22:var Oe=P.stateNode;P.memoizedState!==null?Oe._visibility&2?Wl(N,P,G,ue,w):Bu(N,P):(Oe._visibility|=2,Wl(N,P,G,ue,w)),w&&ke&2048&&ug(P.alternate,P);break;case 24:Wl(N,P,G,ue,w),w&&ke&2048&&dg(P.alternate,P);break;default:Wl(N,P,G,ue,w)}o=o.sibling}}function Bu(s,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var d=s,y=o,w=y.flags;switch(y.tag){case 22:Bu(d,y),w&2048&&ug(y.alternate,y);break;case 24:Bu(d,y),w&2048&&dg(y.alternate,y);break;default:Bu(d,y)}o=o.sibling}}var $u=8192;function ec(s,o,d){if(s.subtreeFlags&$u)for(s=s.child;s!==null;)Ab(s,o,d),s=s.sibling}function Ab(s,o,d){switch(s.tag){case 26:ec(s,o,d),s.flags&$u&&s.memoizedState!==null&&GE(d,ri,s.memoizedState,s.memoizedProps);break;case 5:ec(s,o,d);break;case 3:case 4:var y=ri;ri=ef(s.stateNode.containerInfo),ec(s,o,d),ri=y;break;case 22:s.memoizedState===null&&(y=s.alternate,y!==null&&y.memoizedState!==null?(y=$u,$u=16777216,ec(s,o,d),$u=y):ec(s,o,d));break;default:ec(s,o,d)}}function Ib(s){var o=s.alternate;if(o!==null&&(s=o.child,s!==null)){o.child=null;do o=s.sibling,s.sibling=null,s=o;while(s!==null)}}function Uu(s){var o=s.deletions;if((s.flags&16)!==0){if(o!==null)for(var d=0;d<o.length;d++){var y=o[d];xa=y,Ob(y,s)}Ib(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Db(s),s=s.sibling}function Db(s){switch(s.tag){case 0:case 11:case 15:Uu(s),s.flags&2048&&Ir(9,s,s.return);break;case 3:Uu(s);break;case 12:Uu(s);break;case 22:var o=s.stateNode;s.memoizedState!==null&&o._visibility&2&&(s.return===null||s.return.tag!==13)?(o._visibility&=-3,Fh(s)):Uu(s);break;default:Uu(s)}}function Fh(s){var o=s.deletions;if((s.flags&16)!==0){if(o!==null)for(var d=0;d<o.length;d++){var y=o[d];xa=y,Ob(y,s)}Ib(s)}for(s=s.child;s!==null;){switch(o=s,o.tag){case 0:case 11:case 15:Ir(8,o,o.return),Fh(o);break;case 22:d=o.stateNode,d._visibility&2&&(d._visibility&=-3,Fh(o));break;default:Fh(o)}s=s.sibling}}function Ob(s,o){for(;xa!==null;){var d=xa;switch(d.tag){case 0:case 11:case 15:Ir(8,d,o);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var y=d.memoizedState.cachePool.pool;y!=null&&y.refCount++}break;case 24:Su(d.memoizedState.cache)}if(y=d.child,y!==null)y.return=d,xa=y;else e:for(d=s;xa!==null;){y=xa;var w=y.sibling,N=y.return;if(Cb(y),y===d){xa=null;break e}if(w!==null){w.return=N,xa=w;break e}xa=N}}}var lE={getCacheForType:function(s){var o=Ma(ra),d=o.data.get(s);return d===void 0&&(d=s(),o.data.set(s,d)),d},cacheSignal:function(){return Ma(ra).controller.signal}},cE=typeof WeakMap=="function"?WeakMap:Map,tn=0,vn=null,$t=null,Pt=0,cn=0,ws=null,Dr=!1,tc=!1,hg=!1,Wi=0,Kn=0,Or=0,Po=0,fg=0,Ss=0,nc=0,Fu=null,ss=null,pg=!1,Ph=0,zb=0,Hh=1/0,qh=null,zr=null,ha=0,Br=null,ac=null,er=0,mg=0,gg=null,Bb=null,Pu=0,yg=null;function Ns(){return(tn&2)!==0&&Pt!==0?Pt&-Pt:F.T!==null?Sg():ti()}function $b(){if(Ss===0)if((Pt&536870912)===0||qt){var s=Nn;Nn<<=1,(Nn&3932160)===0&&(Nn=262144),Ss=s}else Ss=536870912;return s=bs.current,s!==null&&(s.flags|=32),Ss}function is(s,o,d){(s===vn&&(cn===2||cn===9)||s.cancelPendingCommit!==null)&&(sc(s,0),$r(s,Pt,Ss,!1)),Cn(s,d),((tn&2)===0||s!==vn)&&(s===vn&&((tn&2)===0&&(Po|=d),Kn===4&&$r(s,Pt,Ss,!1)),wi(s))}function Ub(s,o,d){if((tn&6)!==0)throw Error(a(327));var y=!d&&(o&127)===0&&(o&s.expiredLanes)===0||yn(s,o),w=y?hE(s,o):xg(s,o,!0),N=y;do{if(w===0){tc&&!y&&$r(s,o,0,!1);break}else{if(d=s.current.alternate,N&&!uE(d)){w=xg(s,o,!1),N=!1;continue}if(w===2){if(N=o,s.errorRecoveryDisabledLanes&N)var P=0;else P=s.pendingLanes&-536870913,P=P!==0?P:P&536870912?536870912:0;if(P!==0){o=P;e:{var G=s;w=Fu;var ue=G.current.memoizedState.isDehydrated;if(ue&&(sc(G,P).flags|=256),P=xg(G,P,!1),P!==2){if(hg&&!ue){G.errorRecoveryDisabledLanes|=N,Po|=N,w=4;break e}N=ss,ss=w,N!==null&&(ss===null?ss=N:ss.push.apply(ss,N))}w=P}if(N=!1,w!==2)continue}}if(w===1){sc(s,0),$r(s,o,0,!0);break}e:{switch(y=s,N=w,N){case 0:case 1:throw Error(a(345));case 4:if((o&4194048)!==o)break;case 6:$r(y,o,Ss,!Dr);break e;case 2:ss=null;break;case 3:case 5:break;default:throw Error(a(329))}if((o&62914560)===o&&(w=Ph+300-me(),10<w)){if($r(y,o,Ss,!Dr),$n(y,0,!0)!==0)break e;er=o,y.timeoutHandle=y_(Fb.bind(null,y,d,ss,qh,pg,o,Ss,Po,nc,Dr,N,"Throttled",-0,0),w);break e}Fb(y,d,ss,qh,pg,o,Ss,Po,nc,Dr,N,null,-0,0)}}break}while(!0);wi(s)}function Fb(s,o,d,y,w,N,P,G,ue,ke,Oe,Ve,Me,Le){if(s.timeoutHandle=-1,Ve=o.subtreeFlags,Ve&8192||(Ve&16785408)===16785408){Ve={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Aa},Ab(o,N,Ve);var ct=(N&62914560)===N?Ph-me():(N&4194048)===N?zb-me():0;if(ct=KE(Ve,ct),ct!==null){er=N,s.cancelPendingCommit=ct(Qb.bind(null,s,o,N,d,y,w,P,G,ue,Oe,Ve,null,Me,Le)),$r(s,N,P,!ke);return}}Qb(s,o,N,d,y,w,P,G,ue)}function uE(s){for(var o=s;;){var d=o.tag;if((d===0||d===11||d===15)&&o.flags&16384&&(d=o.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var y=0;y<d.length;y++){var w=d[y],N=w.getSnapshot;w=w.value;try{if(!Vn(N(),w))return!1}catch(P){return!1}}if(d=o.child,o.subtreeFlags&16384&&d!==null)d.return=o,o=d;else{if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function $r(s,o,d,y){o&=~fg,o&=~Po,s.suspendedLanes|=o,s.pingedLanes&=~o,y&&(s.warmLanes|=o),y=s.expirationTimes;for(var w=o;0<w;){var N=31-kt(w),P=1<<N;y[N]=-1,w&=~P}d!==0&&Mn(s,d,o)}function Vh(){return(tn&6)===0?(Hu(0),!1):!0}function vg(){if($t!==null){if(cn===0)var s=$t.return;else s=$t,Hi=Ao=null,Im(s),Kl=null,ku=0,s=$t;for(;s!==null;)vb(s.alternate,s),s=s.return;$t=null}}function sc(s,o){var d=s.timeoutHandle;d!==-1&&(s.timeoutHandle=-1,RE(d)),d=s.cancelPendingCommit,d!==null&&(s.cancelPendingCommit=null,d()),er=0,vg(),vn=s,$t=d=Fi(s.current,null),Pt=o,cn=0,ws=null,Dr=!1,tc=yn(s,o),hg=!1,nc=Ss=fg=Po=Or=Kn=0,ss=Fu=null,pg=!1,(o&8)!==0&&(o|=o&32);var y=s.entangledLanes;if(y!==0)for(s=s.entanglements,y&=o;0<y;){var w=31-kt(y),N=1<<w;o|=s[w],y&=~N}return Wi=o,Ui(),d}function Pb(s,o){Et=null,F.H=Au,o===Gl||o===bh?(o=s1(),cn=3):o===wm?(o=s1(),cn=4):cn=o===Xm?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,ws=o,$t===null&&(Kn=1,Ih(s,$s(o,s.current)))}function Hb(){var s=bs.current;return s===null?!0:(Pt&4194048)===Pt?Hs===null:(Pt&62914560)===Pt||(Pt&536870912)!==0?s===Hs:!1}function qb(){var s=F.H;return F.H=Au,s===null?Au:s}function Vb(){var s=F.A;return F.A=lE,s}function Yh(){Kn=4,Dr||(Pt&4194048)!==Pt&&bs.current!==null||(tc=!0),(Or&134217727)===0&&(Po&134217727)===0||vn===null||$r(vn,Pt,Ss,!1)}function xg(s,o,d){var y=tn;tn|=2;var w=qb(),N=Vb();(vn!==s||Pt!==o)&&(qh=null,sc(s,o)),o=!1;var P=Kn;e:do try{if(cn!==0&&$t!==null){var G=$t,ue=ws;switch(cn){case 8:vg(),P=6;break e;case 3:case 2:case 9:case 6:bs.current===null&&(o=!0);var ke=cn;if(cn=0,ws=null,ic(s,G,ue,ke),d&&tc){P=0;break e}break;default:ke=cn,cn=0,ws=null,ic(s,G,ue,ke)}}dE(),P=Kn;break}catch(Oe){Pb(s,Oe)}while(!0);return o&&s.shellSuspendCounter++,Hi=Ao=null,tn=y,F.H=w,F.A=N,$t===null&&(vn=null,Pt=0,Ui()),P}function dE(){for(;$t!==null;)Yb($t)}function hE(s,o){var d=tn;tn|=2;var y=qb(),w=Vb();vn!==s||Pt!==o?(qh=null,Hh=me()+500,sc(s,o)):tc=yn(s,o);e:do try{if(cn!==0&&$t!==null){o=$t;var N=ws;t:switch(cn){case 1:cn=0,ws=null,ic(s,o,N,1);break;case 2:case 9:if(n1(N)){cn=0,ws=null,Gb(o);break}o=function(){cn!==2&&cn!==9||vn!==s||(cn=7),wi(s)},N.then(o,o);break e;case 3:cn=7;break e;case 4:cn=5;break e;case 7:n1(N)?(cn=0,ws=null,Gb(o)):(cn=0,ws=null,ic(s,o,N,7));break;case 5:var P=null;switch($t.tag){case 26:P=$t.memoizedState;case 5:case 27:var G=$t;if(P?T_(P):G.stateNode.complete){cn=0,ws=null;var ue=G.sibling;if(ue!==null)$t=ue;else{var ke=G.return;ke!==null?($t=ke,Gh(ke)):$t=null}break t}}cn=0,ws=null,ic(s,o,N,5);break;case 6:cn=0,ws=null,ic(s,o,N,6);break;case 8:vg(),Kn=6;break e;default:throw Error(a(462))}}fE();break}catch(Oe){Pb(s,Oe)}while(!0);return Hi=Ao=null,F.H=y,F.A=w,tn=d,$t!==null?0:(vn=null,Pt=0,Ui(),Kn)}function fE(){for(;$t!==null&&!be();)Yb($t)}function Yb(s){var o=gb(s.alternate,s,Wi);s.memoizedProps=s.pendingProps,o===null?Gh(s):$t=o}function Gb(s){var o=s,d=o.alternate;switch(o.tag){case 15:case 0:o=ub(d,o,o.pendingProps,o.type,void 0,Pt);break;case 11:o=ub(d,o,o.pendingProps,o.type.render,o.ref,Pt);break;case 5:Im(o);default:vb(d,o),o=$t=V0(o,Wi),o=gb(d,o,Wi)}s.memoizedProps=s.pendingProps,o===null?Gh(s):$t=o}function ic(s,o,d,y){Hi=Ao=null,Im(o),Kl=null,ku=0;var w=o.return;try{if(tE(s,w,o,d,Pt)){Kn=1,Ih(s,$s(d,s.current)),$t=null;return}}catch(N){if(w!==null)throw $t=w,N;Kn=1,Ih(s,$s(d,s.current)),$t=null;return}o.flags&32768?(qt||y===1?s=!0:tc||(Pt&536870912)!==0?s=!1:(Dr=s=!0,(y===2||y===9||y===3||y===6)&&(y=bs.current,y!==null&&y.tag===13&&(y.flags|=16384))),Kb(o,s)):Gh(o)}function Gh(s){var o=s;do{if((o.flags&32768)!==0){Kb(o,Dr);return}s=o.return;var d=sE(o.alternate,o,Wi);if(d!==null){$t=d;return}if(o=o.sibling,o!==null){$t=o;return}$t=o=s}while(o!==null);Kn===0&&(Kn=5)}function Kb(s,o){do{var d=iE(s.alternate,s);if(d!==null){d.flags&=32767,$t=d;return}if(d=s.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!o&&(s=s.sibling,s!==null)){$t=s;return}$t=s=d}while(s!==null);Kn=6,$t=null}function Qb(s,o,d,y,w,N,P,G,ue){s.cancelPendingCommit=null;do Kh();while(ha!==0);if((tn&6)!==0)throw Error(a(327));if(o!==null){if(o===s.current)throw Error(a(177));if(N=o.lanes|o.childLanes,N|=bu,Xt(s,d,N,P,G,ue),s===vn&&($t=vn=null,Pt=0),ac=o,Br=s,er=d,mg=N,gg=w,Bb=y,(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,yE(xe,function(){return e_(),null})):(s.callbackNode=null,s.callbackPriority=0),y=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||y){y=F.T,F.T=null,w=Y.p,Y.p=2,P=tn,tn|=4;try{rE(s,o,d)}finally{tn=P,Y.p=w,F.T=y}}ha=1,Xb(),Zb(),Jb()}}function Xb(){if(ha===1){ha=0;var s=Br,o=ac,d=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||d){d=F.T,F.T=null;var y=Y.p;Y.p=2;var w=tn;tn|=4;try{Rb(o,s);var N=Lg,P=xu(s.containerInfo),G=N.focusedElem,ue=N.selectionRange;if(P!==G&&G&&G.ownerDocument&&vu(G.ownerDocument.documentElement,G)){if(ue!==null&&$l(G)){var ke=ue.start,Oe=ue.end;if(Oe===void 0&&(Oe=ke),"selectionStart"in G)G.selectionStart=ke,G.selectionEnd=Math.min(Oe,G.value.length);else{var Ve=G.ownerDocument||document,Me=Ve&&Ve.defaultView||window;if(Me.getSelection){var Le=Me.getSelection(),ct=G.textContent.length,_t=Math.min(ue.start,ct),gn=ue.end===void 0?_t:Math.min(ue.end,ct);!Le.extend&&_t>gn&&(P=gn,gn=_t,_t=P);var _e=yu(G,_t),ve=yu(G,gn);if(_e&&ve&&(Le.rangeCount!==1||Le.anchorNode!==_e.node||Le.anchorOffset!==_e.offset||Le.focusNode!==ve.node||Le.focusOffset!==ve.offset)){var Ne=Ve.createRange();Ne.setStart(_e.node,_e.offset),Le.removeAllRanges(),_t>gn?(Le.addRange(Ne),Le.extend(ve.node,ve.offset)):(Ne.setEnd(ve.node,ve.offset),Le.addRange(Ne))}}}}for(Ve=[],Le=G;Le=Le.parentNode;)Le.nodeType===1&&Ve.push({element:Le,left:Le.scrollLeft,top:Le.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<Ve.length;G++){var He=Ve[G];He.element.scrollLeft=He.left,He.element.scrollTop=He.top}}of=!!Rg,Lg=Rg=null}finally{tn=w,Y.p=y,F.T=d}}s.current=o,ha=2}}function Zb(){if(ha===2){ha=0;var s=Br,o=ac,d=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||d){d=F.T,F.T=null;var y=Y.p;Y.p=2;var w=tn;tn|=4;try{kb(s,o.alternate,o)}finally{tn=w,Y.p=y,F.T=d}}ha=3}}function Jb(){if(ha===4||ha===3){ha=0,Fe();var s=Br,o=ac,d=er,y=Bb;(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?ha=5:(ha=0,ac=Br=null,Wb(s,s.pendingLanes));var w=s.pendingLanes;if(w===0&&(zr=null),Hn(d),o=o.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(ot,o,void 0,(o.current.flags&128)===128)}catch(ue){}if(y!==null){o=F.T,w=Y.p,Y.p=2,F.T=null;try{for(var N=s.onRecoverableError,P=0;P<y.length;P++){var G=y[P];N(G.value,{componentStack:G.stack})}}finally{F.T=o,Y.p=w}}(er&3)!==0&&Kh(),wi(s),w=s.pendingLanes,(d&261930)!==0&&(w&42)!==0?s===yg?Pu++:(Pu=0,yg=s):Pu=0,Hu(0)}}function Wb(s,o){(s.pooledCacheLanes&=o)===0&&(o=s.pooledCache,o!=null&&(s.pooledCache=null,Su(o)))}function Kh(){return Xb(),Zb(),Jb(),e_()}function e_(){if(ha!==5)return!1;var s=Br,o=mg;mg=0;var d=Hn(er),y=F.T,w=Y.p;try{Y.p=32>d?32:d,F.T=null,d=gg,gg=null;var N=Br,P=er;if(ha=0,ac=Br=null,er=0,(tn&6)!==0)throw Error(a(331));var G=tn;if(tn|=4,Db(N.current),Tb(N,N.current,P,d),tn=G,Hu(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(ot,N)}catch(ue){}return!0}finally{Y.p=w,F.T=y,Wb(s,o)}}function t_(s,o,d){o=$s(d,o),o=Qm(s.stateNode,o,2),s=Lr(s,o,2),s!==null&&(Cn(s,2),wi(s))}function un(s,o,d){if(s.tag===3)t_(s,s,d);else for(;o!==null;){if(o.tag===3){t_(o,s,d);break}else if(o.tag===1){var y=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(zr===null||!zr.has(y))){s=$s(d,s),d=nb(2),y=Lr(o,d,2),y!==null&&(ab(d,y,o,s),Cn(y,2),wi(y));break}}o=o.return}}function bg(s,o,d){var y=s.pingCache;if(y===null){y=s.pingCache=new cE;var w=new Set;y.set(o,w)}else w=y.get(o),w===void 0&&(w=new Set,y.set(o,w));w.has(d)||(hg=!0,w.add(d),s=pE.bind(null,s,o,d),o.then(s,s))}function pE(s,o,d){var y=s.pingCache;y!==null&&y.delete(o),s.pingedLanes|=s.suspendedLanes&d,s.warmLanes&=~d,vn===s&&(Pt&d)===d&&(Kn===4||Kn===3&&(Pt&62914560)===Pt&&300>me()-Ph?(tn&2)===0&&sc(s,0):fg|=d,nc===Pt&&(nc=0)),wi(s)}function n_(s,o){o===0&&(o=kn()),s=vi(s,o),s!==null&&(Cn(s,o),wi(s))}function mE(s){var o=s.memoizedState,d=0;o!==null&&(d=o.retryLane),n_(s,d)}function gE(s,o){var d=0;switch(s.tag){case 31:case 13:var y=s.stateNode,w=s.memoizedState;w!==null&&(d=w.retryLane);break;case 19:y=s.stateNode;break;case 22:y=s.stateNode._retryCache;break;default:throw Error(a(314))}y!==null&&y.delete(o),n_(s,d)}function yE(s,o){return Je(s,o)}var Qh=null,rc=null,_g=!1,Xh=!1,wg=!1,Ur=0;function wi(s){s!==rc&&s.next===null&&(rc===null?Qh=rc=s:rc=rc.next=s),Xh=!0,_g||(_g=!0,xE())}function Hu(s,o){if(!wg&&Xh){wg=!0;do for(var d=!1,y=Qh;y!==null;){if(s!==0){var w=y.pendingLanes;if(w===0)var N=0;else{var P=y.suspendedLanes,G=y.pingedLanes;N=(1<<31-kt(42|s)+1)-1,N&=w&~(P&~G),N=N&201326741?N&201326741|1:N?N|2:0}N!==0&&(d=!0,r_(y,N))}else N=Pt,N=$n(y,y===vn?N:0,y.cancelPendingCommit!==null||y.timeoutHandle!==-1),(N&3)===0||yn(y,N)||(d=!0,r_(y,N));y=y.next}while(d);wg=!1}}function vE(){a_()}function a_(){Xh=_g=!1;var s=0;Ur!==0&&EE()&&(s=Ur);for(var o=me(),d=null,y=Qh;y!==null;){var w=y.next,N=s_(y,o);N===0?(y.next=null,d===null?Qh=w:d.next=w,w===null&&(rc=d)):(d=y,(s!==0||(N&3)!==0)&&(Xh=!0)),y=w}ha!==0&&ha!==5||Hu(s),Ur!==0&&(Ur=0)}function s_(s,o){for(var d=s.suspendedLanes,y=s.pingedLanes,w=s.expirationTimes,N=s.pendingLanes&-62914561;0<N;){var P=31-kt(N),G=1<<P,ue=w[P];ue===-1?((G&d)===0||(G&y)!==0)&&(w[P]=Na(G,o)):ue<=o&&(s.expiredLanes|=G),N&=~G}if(o=vn,d=Pt,d=$n(s,s===o?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),y=s.callbackNode,d===0||s===o&&(cn===2||cn===9)||s.cancelPendingCommit!==null)return y!==null&&y!==null&&Ge(y),s.callbackNode=null,s.callbackPriority=0;if((d&3)===0||yn(s,d)){if(o=d&-d,o===s.callbackPriority)return o;switch(y!==null&&Ge(y),Hn(d)){case 2:case 8:d=le;break;case 32:d=xe;break;case 268435456:d=$e;break;default:d=xe}return y=i_.bind(null,s),d=Je(d,y),s.callbackPriority=o,s.callbackNode=d,o}return y!==null&&y!==null&&Ge(y),s.callbackPriority=2,s.callbackNode=null,2}function i_(s,o){if(ha!==0&&ha!==5)return s.callbackNode=null,s.callbackPriority=0,null;var d=s.callbackNode;if(Kh()&&s.callbackNode!==d)return null;var y=Pt;return y=$n(s,s===vn?y:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),y===0?null:(Ub(s,y,o),s_(s,me()),s.callbackNode!=null&&s.callbackNode===d?i_.bind(null,s):null)}function r_(s,o){if(Kh())return null;Ub(s,o,!0)}function xE(){LE(function(){(tn&6)!==0?Je(se,vE):a_()})}function Sg(){if(Ur===0){var s=Vl;s===0&&(s=hn,hn<<=1,(hn&261888)===0&&(hn=256)),Ur=s}return Ur}function o_(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Ii(""+s)}function l_(s,o){var d=o.ownerDocument.createElement("input");return d.name=o.name,d.value=o.value,s.id&&d.setAttribute("form",s.id),o.parentNode.insertBefore(d,o),s=new FormData(s),d.parentNode.removeChild(d),s}function bE(s,o,d,y,w){if(o==="submit"&&d&&d.stateNode===w){var N=o_((w[We]||null).action),P=y.submitter;P&&(o=(o=P[We]||null)?o_(o.formAction):P.getAttribute("formAction"),o!==null&&(N=o,P=null));var G=new On("action","action",null,y,w);s.push({event:G,listeners:[{instance:null,listener:function(){if(y.defaultPrevented){if(Ur!==0){var ue=P?l_(w,P):new FormData(w);Hm(d,{pending:!0,data:ue,method:w.method,action:N},null,ue)}}else typeof N=="function"&&(G.preventDefault(),ue=P?l_(w,P):new FormData(w),Hm(d,{pending:!0,data:ue,method:w.method,action:N},N,ue))},currentTarget:w}]})}}for(var Ng=0;Ng<zi.length;Ng++){var kg=zi[Ng],_E=kg.toLowerCase(),wE=kg[0].toUpperCase()+kg.slice(1);ka(_E,"on"+wE)}ka(_n,"onAnimationEnd"),ka(Yn,"onAnimationIteration"),ka(Bt,"onAnimationStart"),ka("dblclick","onDoubleClick"),ka("focusin","onFocus"),ka("focusout","onBlur"),ka(Nt,"onTransitionRun"),ka(ia,"onTransitionStart"),ka(Ro,"onTransitionCancel"),ka(Wa,"onTransitionEnd"),Xa("onMouseEnter",["mouseout","mouseover"]),Xa("onMouseLeave",["mouseout","mouseover"]),Xa("onPointerEnter",["pointerout","pointerover"]),Xa("onPointerLeave",["pointerout","pointerover"]),Dn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Dn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Dn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Dn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Dn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Dn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),SE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qu));function c_(s,o){o=(o&4)!==0;for(var d=0;d<s.length;d++){var y=s[d],w=y.event;y=y.listeners;e:{var N=void 0;if(o)for(var P=y.length-1;0<=P;P--){var G=y[P],ue=G.instance,ke=G.currentTarget;if(G=G.listener,ue!==N&&w.isPropagationStopped())break e;N=G,w.currentTarget=ke;try{N(w)}catch(Oe){Bi(Oe)}w.currentTarget=null,N=ue}else for(P=0;P<y.length;P++){if(G=y[P],ue=G.instance,ke=G.currentTarget,G=G.listener,ue!==N&&w.isPropagationStopped())break e;N=G,w.currentTarget=ke;try{N(w)}catch(Oe){Bi(Oe)}w.currentTarget=null,N=ue}}}}function Ut(s,o){var d=o[ht];d===void 0&&(d=o[ht]=new Set);var y=s+"__bubble";d.has(y)||(u_(o,s,2,!1),d.add(y))}function Cg(s,o,d){var y=0;o&&(y|=4),u_(d,s,y,o)}var Zh="_reactListening"+Math.random().toString(36).slice(2);function Mg(s){if(!s[Zh]){s[Zh]=!0,Wn.forEach(function(d){d!=="selectionchange"&&(SE.has(d)||Cg(d,!1,s),Cg(d,!0,s))});var o=s.nodeType===9?s:s.ownerDocument;o===null||o[Zh]||(o[Zh]=!0,Cg("selectionchange",!1,o))}}function u_(s,o,d,y){switch($_(o)){case 2:var w=ZE;break;case 8:w=JE;break;default:w=Pg}d=w.bind(null,o,d,s),w=void 0,!dt||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(w=!0),y?w!==void 0?s.addEventListener(o,d,{capture:!0,passive:w}):s.addEventListener(o,d,!0):w!==void 0?s.addEventListener(o,d,{passive:w}):s.addEventListener(o,d,!1)}function jg(s,o,d,y,w){var N=y;if((o&1)===0&&(o&2)===0&&y!==null)e:for(;;){if(y===null)return;var P=y.tag;if(P===3||P===4){var G=y.stateNode.containerInfo;if(G===w)break;if(P===4)for(P=y.return;P!==null;){var ue=P.tag;if((ue===3||ue===4)&&P.stateNode.containerInfo===w)return;P=P.return}for(;G!==null;){if(P=In(G),P===null)return;if(ue=P.tag,ue===5||ue===6||ue===26||ue===27){y=N=P;continue e}G=G.parentNode}}y=y.return}ze(function(){var ke=N,Oe=Di(d),Ve=[];e:{var Me=Nr.get(s);if(Me!==void 0){var Le=On,ct=s;switch(s){case"keypress":if(vt(d)===0)break e;case"keydown":case"keyup":Le=lh;break;case"focusin":ct="focus",Le=Mo;break;case"focusout":ct="blur",Le=Mo;break;case"beforeblur":case"afterblur":Le=Mo;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Le=iu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Le=Zp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Le=El;break;case _n:case Yn:case Bt:Le=em;break;case Wa:Le=Ll;break;case"scroll":case"scrollend":Le=kl;break;case"wheel":Le=_r;break;case"copy":case"cut":case"paste":Le=ou;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Le=ya;break;case"toggle":case"beforetoggle":Le=Tl}var _t=(o&4)!==0,gn=!_t&&(s==="scroll"||s==="scrollend"),_e=_t?Me!==null?Me+"Capture":null:Me;_t=[];for(var ve=ke,Ne;ve!==null;){var He=ve;if(Ne=He.stateNode,He=He.tag,He!==5&&He!==26&&He!==27||Ne===null||_e===null||(He=Ye(ve,_e),He!=null&&_t.push(Vu(ve,He,Ne))),gn)break;ve=ve.return}0<_t.length&&(Me=new Le(Me,ct,null,d,Oe),Ve.push({event:Me,listeners:_t}))}}if((o&7)===0){e:{if(Me=s==="mouseover"||s==="pointerover",Le=s==="mouseout"||s==="pointerout",Me&&d!==si&&(ct=d.relatedTarget||d.fromElement)&&(In(ct)||ct[lt]))break e;if((Le||Me)&&(Me=Oe.window===Oe?Oe:(Me=Oe.ownerDocument)?Me.defaultView||Me.parentWindow:window,Le?(ct=d.relatedTarget||d.toElement,Le=ke,ct=ct?In(ct):null,ct!==null&&(gn=r(ct),_t=ct.tag,ct!==gn||_t!==5&&_t!==27&&_t!==6)&&(ct=null)):(Le=null,ct=ke),Le!==ct)){if(_t=iu,He="onMouseLeave",_e="onMouseEnter",ve="mouse",(s==="pointerout"||s==="pointerover")&&(_t=ya,He="onPointerLeave",_e="onPointerEnter",ve="pointer"),gn=Le==null?Me:Jn(Le),Ne=ct==null?Me:Jn(ct),Me=new _t(He,ve+"leave",Le,d,Oe),Me.target=gn,Me.relatedTarget=Ne,He=null,In(Oe)===ke&&(_t=new _t(_e,ve+"enter",ct,d,Oe),_t.target=Ne,_t.relatedTarget=gn,He=_t),gn=He,Le&&ct)t:{for(_t=NE,_e=Le,ve=ct,Ne=0,He=_e;He;He=_t(He))Ne++;He=0;for(var gt=ve;gt;gt=_t(gt))He++;for(;0<Ne-He;)_e=_t(_e),Ne--;for(;0<He-Ne;)ve=_t(ve),He--;for(;Ne--;){if(_e===ve||ve!==null&&_e===ve.alternate){_t=_e;break t}_e=_t(_e),ve=_t(ve)}_t=null}else _t=null;Le!==null&&d_(Ve,Me,Le,_t,!1),ct!==null&&gn!==null&&d_(Ve,gn,ct,_t,!0)}}e:{if(Me=ke?Jn(ke):window,Le=Me.nodeName&&Me.nodeName.toLowerCase(),Le==="select"||Le==="input"&&Me.type==="file")var Zt=jo;else if(Oi(Me))if(Ol)Zt=om;else{Zt=gu;var ut=va}else Le=Me.nodeName,!Le||Le.toLowerCase()!=="input"||Me.type!=="checkbox"&&Me.type!=="radio"?ke&&No(ke.elementType)&&(Zt=jo):Zt=rm;if(Zt&&(Zt=Zt(s,ke))){Il(Ve,Zt,d,Oe);break e}ut&&ut(s,Me,ke),s==="focusout"&&ke&&Me.type==="number"&&ke.memoizedProps.value!=null&&Ti(Me,"number",Me.value)}switch(ut=ke?Jn(ke):window,s){case"focusin":(Oi(ut)||ut.contentEditable==="true")&&(ce=ut,Ce=ke,Te=null);break;case"focusout":Te=Ce=ce=null;break;case"mousedown":et=!0;break;case"contextmenu":case"mouseup":case"dragend":et=!1,Ue(Ve,d,Oe);break;case"selectionchange":if(V)break;case"keydown":case"keyup":Ue(Ve,d,Oe)}var At;if(Al)e:{switch(s){case"compositionstart":var Ht="onCompositionStart";break e;case"compositionend":Ht="onCompositionEnd";break e;case"compositionupdate":Ht="onCompositionUpdate";break e}Ht=void 0}else Pn?fu(s,d)&&(Ht="onCompositionEnd"):s==="keydown"&&d.keyCode===229&&(Ht="onCompositionStart");Ht&&(uu&&d.locale!=="ko"&&(Pn||Ht!=="onCompositionStart"?Ht==="onCompositionEnd"&&Pn&&(At=Ia()):(Ct=Oe,zt="value"in Ct?Ct.value:Ct.textContent,Pn=!0)),ut=Jh(ke,Ht),0<ut.length&&(Ht=new Ml(Ht,s,null,d,Oe),Ve.push({event:Ht,listeners:ut}),At?Ht.data=At:(At=pu(d),At!==null&&(Ht.data=At)))),(At=nm?am(s,d):sm(s,d))&&(Ht=Jh(ke,"onBeforeInput"),0<Ht.length&&(ut=new Ml("onBeforeInput","beforeinput",null,d,Oe),Ve.push({event:ut,listeners:Ht}),ut.data=At)),bE(Ve,s,ke,d,Oe)}c_(Ve,o)})}function Vu(s,o,d){return{instance:s,listener:o,currentTarget:d}}function Jh(s,o){for(var d=o+"Capture",y=[];s!==null;){var w=s,N=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||N===null||(w=Ye(s,d),w!=null&&y.unshift(Vu(s,w,N)),w=Ye(s,o),w!=null&&y.push(Vu(s,w,N))),s.tag===3)return y;s=s.return}return[]}function NE(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function d_(s,o,d,y,w){for(var N=o._reactName,P=[];d!==null&&d!==y;){var G=d,ue=G.alternate,ke=G.stateNode;if(G=G.tag,ue!==null&&ue===y)break;G!==5&&G!==26&&G!==27||ke===null||(ue=ke,w?(ke=Ye(d,N),ke!=null&&P.unshift(Vu(d,ke,ue))):w||(ke=Ye(d,N),ke!=null&&P.push(Vu(d,ke,ue)))),d=d.return}P.length!==0&&s.push({event:o,listeners:P})}var kE=/\r\n?/g,CE=/\u0000|\uFFFD/g;function h_(s){return(typeof s=="string"?s:""+s).replace(kE,`
|
|
33
|
+
`).replace(CE,"")}function f_(s,o){return o=h_(o),h_(s)===o}function mn(s,o,d,y,w,N){switch(d){case"children":typeof y=="string"?o==="body"||o==="textarea"&&y===""||Za(s,y):(typeof y=="number"||typeof y=="bigint")&&o!=="body"&&Za(s,""+y);break;case"className":vs(s,"class",y);break;case"tabIndex":vs(s,"tabindex",y);break;case"dir":case"role":case"viewBox":case"width":case"height":vs(s,d,y);break;case"style":Mt(s,y,N);break;case"data":if(o!=="object"){vs(s,"data",y);break}case"src":case"href":if(y===""&&(o!=="a"||d!=="href")){s.removeAttribute(d);break}if(y==null||typeof y=="function"||typeof y=="symbol"||typeof y=="boolean"){s.removeAttribute(d);break}y=Ii(""+y),s.setAttribute(d,y);break;case"action":case"formAction":if(typeof y=="function"){s.setAttribute(d,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof N=="function"&&(d==="formAction"?(o!=="input"&&mn(s,o,"name",w.name,w,null),mn(s,o,"formEncType",w.formEncType,w,null),mn(s,o,"formMethod",w.formMethod,w,null),mn(s,o,"formTarget",w.formTarget,w,null)):(mn(s,o,"encType",w.encType,w,null),mn(s,o,"method",w.method,w,null),mn(s,o,"target",w.target,w,null)));if(y==null||typeof y=="symbol"||typeof y=="boolean"){s.removeAttribute(d);break}y=Ii(""+y),s.setAttribute(d,y);break;case"onClick":y!=null&&(s.onclick=Aa);break;case"onScroll":y!=null&&Ut("scroll",s);break;case"onScrollEnd":y!=null&&Ut("scrollend",s);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(a(61));if(d=y.__html,d!=null){if(w.children!=null)throw Error(a(60));s.innerHTML=d}}break;case"multiple":s.multiple=y&&typeof y!="function"&&typeof y!="symbol";break;case"muted":s.muted=y&&typeof y!="function"&&typeof y!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(y==null||typeof y=="function"||typeof y=="boolean"||typeof y=="symbol"){s.removeAttribute("xlink:href");break}d=Ii(""+y),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":y!=null&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(d,""+y):s.removeAttribute(d);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":y&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(d,""):s.removeAttribute(d);break;case"capture":case"download":y===!0?s.setAttribute(d,""):y!==!1&&y!=null&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(d,y):s.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":y!=null&&typeof y!="function"&&typeof y!="symbol"&&!isNaN(y)&&1<=y?s.setAttribute(d,y):s.removeAttribute(d);break;case"rowSpan":case"start":y==null||typeof y=="function"||typeof y=="symbol"||isNaN(y)?s.removeAttribute(d):s.setAttribute(d,y);break;case"popover":Ut("beforetoggle",s),Ut("toggle",s),As(s,"popover",y);break;case"xlinkActuate":La(s,"http://www.w3.org/1999/xlink","xlink:actuate",y);break;case"xlinkArcrole":La(s,"http://www.w3.org/1999/xlink","xlink:arcrole",y);break;case"xlinkRole":La(s,"http://www.w3.org/1999/xlink","xlink:role",y);break;case"xlinkShow":La(s,"http://www.w3.org/1999/xlink","xlink:show",y);break;case"xlinkTitle":La(s,"http://www.w3.org/1999/xlink","xlink:title",y);break;case"xlinkType":La(s,"http://www.w3.org/1999/xlink","xlink:type",y);break;case"xmlBase":La(s,"http://www.w3.org/XML/1998/namespace","xml:base",y);break;case"xmlLang":La(s,"http://www.w3.org/XML/1998/namespace","xml:lang",y);break;case"xmlSpace":La(s,"http://www.w3.org/XML/1998/namespace","xml:space",y);break;case"is":As(s,"is",y);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=ko.get(d)||d,As(s,d,y))}}function Eg(s,o,d,y,w,N){switch(d){case"style":Mt(s,y,N);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(a(61));if(d=y.__html,d!=null){if(w.children!=null)throw Error(a(60));s.innerHTML=d}}break;case"children":typeof y=="string"?Za(s,y):(typeof y=="number"||typeof y=="bigint")&&Za(s,""+y);break;case"onScroll":y!=null&&Ut("scroll",s);break;case"onScrollEnd":y!=null&&Ut("scrollend",s);break;case"onClick":y!=null&&(s.onclick=Aa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!pi.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(w=d.endsWith("Capture"),o=d.slice(2,w?d.length-7:void 0),N=s[We]||null,N=N!=null?N[d]:null,typeof N=="function"&&s.removeEventListener(o,N,w),typeof y=="function")){typeof N!="function"&&N!==null&&(d in s?s[d]=null:s.hasAttribute(d)&&s.removeAttribute(d)),s.addEventListener(o,y,w);break e}d in s?s[d]=y:y===!0?s.setAttribute(d,""):As(s,d,y)}}}function Ea(s,o,d){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ut("error",s),Ut("load",s);var y=!1,w=!1,N;for(N in d)if(d.hasOwnProperty(N)){var P=d[N];if(P!=null)switch(N){case"src":y=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,o));default:mn(s,o,N,P,d,null)}}w&&mn(s,o,"srcSet",d.srcSet,d,null),y&&mn(s,o,"src",d.src,d,null);return;case"input":Ut("invalid",s);var G=N=P=w=null,ue=null,ke=null;for(y in d)if(d.hasOwnProperty(y)){var Oe=d[y];if(Oe!=null)switch(y){case"name":w=Oe;break;case"type":P=Oe;break;case"checked":ue=Oe;break;case"defaultChecked":ke=Oe;break;case"value":N=Oe;break;case"defaultValue":G=Oe;break;case"children":case"dangerouslySetInnerHTML":if(Oe!=null)throw Error(a(137,o));break;default:mn(s,o,y,Oe,d,null)}}Nl(s,N,G,ue,ke,P,w,!1);return;case"select":Ut("invalid",s),y=P=N=null;for(w in d)if(d.hasOwnProperty(w)&&(G=d[w],G!=null))switch(w){case"value":N=G;break;case"defaultValue":P=G;break;case"multiple":y=G;default:mn(s,o,w,G,d,null)}o=N,d=P,s.multiple=!!y,o!=null?Is(s,!!y,o,!1):d!=null&&Is(s,!!y,d,!0);return;case"textarea":Ut("invalid",s),N=w=y=null;for(P in d)if(d.hasOwnProperty(P)&&(G=d[P],G!=null))switch(P){case"value":y=G;break;case"defaultValue":w=G;break;case"children":N=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(a(91));break;default:mn(s,o,P,G,d,null)}Ai(s,y,w,N);return;case"option":for(ue in d)if(d.hasOwnProperty(ue)&&(y=d[ue],y!=null))switch(ue){case"selected":s.selected=y&&typeof y!="function"&&typeof y!="symbol";break;default:mn(s,o,ue,y,d,null)}return;case"dialog":Ut("beforetoggle",s),Ut("toggle",s),Ut("cancel",s),Ut("close",s);break;case"iframe":case"object":Ut("load",s);break;case"video":case"audio":for(y=0;y<qu.length;y++)Ut(qu[y],s);break;case"image":Ut("error",s),Ut("load",s);break;case"details":Ut("toggle",s);break;case"embed":case"source":case"link":Ut("error",s),Ut("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ke in d)if(d.hasOwnProperty(ke)&&(y=d[ke],y!=null))switch(ke){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,o));default:mn(s,o,ke,y,d,null)}return;default:if(No(o)){for(Oe in d)d.hasOwnProperty(Oe)&&(y=d[Oe],y!==void 0&&Eg(s,o,Oe,y,d,void 0));return}}for(G in d)d.hasOwnProperty(G)&&(y=d[G],y!=null&&mn(s,o,G,y,d,null))}function ME(s,o,d,y){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,N=null,P=null,G=null,ue=null,ke=null,Oe=null;for(Le in d){var Ve=d[Le];if(d.hasOwnProperty(Le)&&Ve!=null)switch(Le){case"checked":break;case"value":break;case"defaultValue":ue=Ve;default:y.hasOwnProperty(Le)||mn(s,o,Le,null,y,Ve)}}for(var Me in y){var Le=y[Me];if(Ve=d[Me],y.hasOwnProperty(Me)&&(Le!=null||Ve!=null))switch(Me){case"type":N=Le;break;case"name":w=Le;break;case"checked":ke=Le;break;case"defaultChecked":Oe=Le;break;case"value":P=Le;break;case"defaultValue":G=Le;break;case"children":case"dangerouslySetInnerHTML":if(Le!=null)throw Error(a(137,o));break;default:Le!==Ve&&mn(s,o,Me,Le,y,Ve)}}gr(s,P,G,ue,ke,Oe,N,w);return;case"select":Le=P=G=Me=null;for(N in d)if(ue=d[N],d.hasOwnProperty(N)&&ue!=null)switch(N){case"value":break;case"multiple":Le=ue;default:y.hasOwnProperty(N)||mn(s,o,N,null,y,ue)}for(w in y)if(N=y[w],ue=d[w],y.hasOwnProperty(w)&&(N!=null||ue!=null))switch(w){case"value":Me=N;break;case"defaultValue":G=N;break;case"multiple":P=N;default:N!==ue&&mn(s,o,w,N,y,ue)}o=G,d=P,y=Le,Me!=null?Is(s,!!d,Me,!1):!!y!=!!d&&(o!=null?Is(s,!!d,o,!0):Is(s,!!d,d?[]:"",!1));return;case"textarea":Le=Me=null;for(G in d)if(w=d[G],d.hasOwnProperty(G)&&w!=null&&!y.hasOwnProperty(G))switch(G){case"value":break;case"children":break;default:mn(s,o,G,null,y,w)}for(P in y)if(w=y[P],N=d[P],y.hasOwnProperty(P)&&(w!=null||N!=null))switch(P){case"value":Me=w;break;case"defaultValue":Le=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(a(91));break;default:w!==N&&mn(s,o,P,w,y,N)}ai(s,Me,Le);return;case"option":for(var ct in d)if(Me=d[ct],d.hasOwnProperty(ct)&&Me!=null&&!y.hasOwnProperty(ct))switch(ct){case"selected":s.selected=!1;break;default:mn(s,o,ct,null,y,Me)}for(ue in y)if(Me=y[ue],Le=d[ue],y.hasOwnProperty(ue)&&Me!==Le&&(Me!=null||Le!=null))switch(ue){case"selected":s.selected=Me&&typeof Me!="function"&&typeof Me!="symbol";break;default:mn(s,o,ue,Me,y,Le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var _t in d)Me=d[_t],d.hasOwnProperty(_t)&&Me!=null&&!y.hasOwnProperty(_t)&&mn(s,o,_t,null,y,Me);for(ke in y)if(Me=y[ke],Le=d[ke],y.hasOwnProperty(ke)&&Me!==Le&&(Me!=null||Le!=null))switch(ke){case"children":case"dangerouslySetInnerHTML":if(Me!=null)throw Error(a(137,o));break;default:mn(s,o,ke,Me,y,Le)}return;default:if(No(o)){for(var gn in d)Me=d[gn],d.hasOwnProperty(gn)&&Me!==void 0&&!y.hasOwnProperty(gn)&&Eg(s,o,gn,void 0,y,Me);for(Oe in y)Me=y[Oe],Le=d[Oe],!y.hasOwnProperty(Oe)||Me===Le||Me===void 0&&Le===void 0||Eg(s,o,Oe,Me,y,Le);return}}for(var _e in d)Me=d[_e],d.hasOwnProperty(_e)&&Me!=null&&!y.hasOwnProperty(_e)&&mn(s,o,_e,null,y,Me);for(Ve in y)Me=y[Ve],Le=d[Ve],!y.hasOwnProperty(Ve)||Me===Le||Me==null&&Le==null||mn(s,o,Ve,Me,y,Le)}function p_(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function jE(){if(typeof performance.getEntriesByType=="function"){for(var s=0,o=0,d=performance.getEntriesByType("resource"),y=0;y<d.length;y++){var w=d[y],N=w.transferSize,P=w.initiatorType,G=w.duration;if(N&&G&&p_(P)){for(P=0,G=w.responseEnd,y+=1;y<d.length;y++){var ue=d[y],ke=ue.startTime;if(ke>G)break;var Oe=ue.transferSize,Ve=ue.initiatorType;Oe&&p_(Ve)&&(ue=ue.responseEnd,P+=Oe*(ue<G?1:(G-ke)/(ue-ke)))}if(--y,o+=8*(N+P)/(w.duration/1e3),s++,10<s)break}}if(0<s)return o/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Rg=null,Lg=null;function Wh(s){return s.nodeType===9?s:s.ownerDocument}function m_(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function g_(s,o){if(s===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&o==="foreignObject"?0:s}function Tg(s,o){return s==="textarea"||s==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Ag=null;function EE(){var s=window.event;return s&&s.type==="popstate"?s===Ag?!1:(Ag=s,!0):(Ag=null,!1)}var y_=typeof setTimeout=="function"?setTimeout:void 0,RE=typeof clearTimeout=="function"?clearTimeout:void 0,v_=typeof Promise=="function"?Promise:void 0,LE=typeof queueMicrotask=="function"?queueMicrotask:typeof v_!="undefined"?function(s){return v_.resolve(null).then(s).catch(TE)}:y_;function TE(s){setTimeout(function(){throw s})}function Fr(s){return s==="head"}function x_(s,o){var d=o,y=0;do{var w=d.nextSibling;if(s.removeChild(d),w&&w.nodeType===8)if(d=w.data,d==="/$"||d==="/&"){if(y===0){s.removeChild(w),uc(o);return}y--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")y++;else if(d==="html")Yu(s.ownerDocument.documentElement);else if(d==="head"){d=s.ownerDocument.head,Yu(d);for(var N=d.firstChild;N;){var P=N.nextSibling,G=N.nodeName;N[Wt]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&N.rel.toLowerCase()==="stylesheet"||d.removeChild(N),N=P}}else d==="body"&&Yu(s.ownerDocument.body);d=w}while(d);uc(o)}function b_(s,o){var d=s;s=0;do{var y=d.nextSibling;if(d.nodeType===1?o?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(o?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),y&&y.nodeType===8)if(d=y.data,d==="/$"){if(s===0)break;s--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||s++;d=y}while(d)}function Ig(s){var o=s.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var d=o;switch(o=o.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":Ig(d),en(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}s.removeChild(d)}}function AE(s,o,d,y){for(;s.nodeType===1;){var w=d;if(s.nodeName.toLowerCase()!==o.toLowerCase()){if(!y&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(y){if(!s[Wt])switch(o){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(N=s.getAttribute("rel"),N==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(N!==w.rel||s.getAttribute("href")!==(w.href==null||w.href===""?null:w.href)||s.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin)||s.getAttribute("title")!==(w.title==null?null:w.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(N=s.getAttribute("src"),(N!==(w.src==null?null:w.src)||s.getAttribute("type")!==(w.type==null?null:w.type)||s.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&N&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(o==="input"&&s.type==="hidden"){var N=w.name==null?null:""+w.name;if(w.type==="hidden"&&s.getAttribute("name")===N)return s}else return s;if(s=qs(s.nextSibling),s===null)break}return null}function IE(s,o,d){if(o==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!d||(s=qs(s.nextSibling),s===null))return null;return s}function __(s,o){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!o||(s=qs(s.nextSibling),s===null))return null;return s}function Dg(s){return s.data==="$?"||s.data==="$~"}function Og(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function DE(s,o){var d=s.ownerDocument;if(s.data==="$~")s._reactRetry=o;else if(s.data!=="$?"||d.readyState!=="loading")o();else{var y=function(){o(),d.removeEventListener("DOMContentLoaded",y)};d.addEventListener("DOMContentLoaded",y),s._reactRetry=y}}function qs(s){for(;s!=null;s=s.nextSibling){var o=s.nodeType;if(o===1||o===3)break;if(o===8){if(o=s.data,o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"||o==="F!"||o==="F")break;if(o==="/$"||o==="/&")return null}}return s}var zg=null;function w_(s){s=s.nextSibling;for(var o=0;s;){if(s.nodeType===8){var d=s.data;if(d==="/$"||d==="/&"){if(o===0)return qs(s.nextSibling);o--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||o++}s=s.nextSibling}return null}function S_(s){s=s.previousSibling;for(var o=0;s;){if(s.nodeType===8){var d=s.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(o===0)return s;o--}else d!=="/$"&&d!=="/&"||o++}s=s.previousSibling}return null}function N_(s,o,d){switch(o=Wh(d),s){case"html":if(s=o.documentElement,!s)throw Error(a(452));return s;case"head":if(s=o.head,!s)throw Error(a(453));return s;case"body":if(s=o.body,!s)throw Error(a(454));return s;default:throw Error(a(451))}}function Yu(s){for(var o=s.attributes;o.length;)s.removeAttributeNode(o[0]);en(s)}var Vs=new Map,k_=new Set;function ef(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var tr=Y.d;Y.d={f:OE,r:zE,D:BE,C:$E,L:UE,m:FE,X:HE,S:PE,M:qE};function OE(){var s=tr.f(),o=Vh();return s||o}function zE(s){var o=Ts(s);o!==null&&o.tag===5&&o.type==="form"?P1(o):tr.r(s)}var oc=typeof document=="undefined"?null:document;function C_(s,o,d){var y=oc;if(y&&typeof o=="string"&&o){var w=Fn(o);w='link[rel="'+s+'"][href="'+w+'"]',typeof d=="string"&&(w+='[crossorigin="'+d+'"]'),k_.has(w)||(k_.add(w),s={rel:s,crossOrigin:d,href:o},y.querySelector(w)===null&&(o=y.createElement("link"),Ea(o,"link",s),Lt(o),y.head.appendChild(o)))}}function BE(s){tr.D(s),C_("dns-prefetch",s,null)}function $E(s,o){tr.C(s,o),C_("preconnect",s,o)}function UE(s,o,d){tr.L(s,o,d);var y=oc;if(y&&s&&o){var w='link[rel="preload"][as="'+Fn(o)+'"]';o==="image"&&d&&d.imageSrcSet?(w+='[imagesrcset="'+Fn(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(w+='[imagesizes="'+Fn(d.imageSizes)+'"]')):w+='[href="'+Fn(s)+'"]';var N=w;switch(o){case"style":N=lc(s);break;case"script":N=cc(s)}Vs.has(N)||(s=p({rel:"preload",href:o==="image"&&d&&d.imageSrcSet?void 0:s,as:o},d),Vs.set(N,s),y.querySelector(w)!==null||o==="style"&&y.querySelector(Gu(N))||o==="script"&&y.querySelector(Ku(N))||(o=y.createElement("link"),Ea(o,"link",s),Lt(o),y.head.appendChild(o)))}}function FE(s,o){tr.m(s,o);var d=oc;if(d&&s){var y=o&&typeof o.as=="string"?o.as:"script",w='link[rel="modulepreload"][as="'+Fn(y)+'"][href="'+Fn(s)+'"]',N=w;switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":N=cc(s)}if(!Vs.has(N)&&(s=p({rel:"modulepreload",href:s},o),Vs.set(N,s),d.querySelector(w)===null)){switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(Ku(N)))return}y=d.createElement("link"),Ea(y,"link",s),Lt(y),d.head.appendChild(y)}}}function PE(s,o,d){tr.S(s,o,d);var y=oc;if(y&&s){var w=ma(y).hoistableStyles,N=lc(s);o=o||"default";var P=w.get(N);if(!P){var G={loading:0,preload:null};if(P=y.querySelector(Gu(N)))G.loading=5;else{s=p({rel:"stylesheet",href:s,"data-precedence":o},d),(d=Vs.get(N))&&Bg(s,d);var ue=P=y.createElement("link");Lt(ue),Ea(ue,"link",s),ue._p=new Promise(function(ke,Oe){ue.onload=ke,ue.onerror=Oe}),ue.addEventListener("load",function(){G.loading|=1}),ue.addEventListener("error",function(){G.loading|=2}),G.loading|=4,tf(P,o,y)}P={type:"stylesheet",instance:P,count:1,state:G},w.set(N,P)}}}function HE(s,o){tr.X(s,o);var d=oc;if(d&&s){var y=ma(d).hoistableScripts,w=cc(s),N=y.get(w);N||(N=d.querySelector(Ku(w)),N||(s=p({src:s,async:!0},o),(o=Vs.get(w))&&$g(s,o),N=d.createElement("script"),Lt(N),Ea(N,"link",s),d.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},y.set(w,N))}}function qE(s,o){tr.M(s,o);var d=oc;if(d&&s){var y=ma(d).hoistableScripts,w=cc(s),N=y.get(w);N||(N=d.querySelector(Ku(w)),N||(s=p({src:s,async:!0,type:"module"},o),(o=Vs.get(w))&&$g(s,o),N=d.createElement("script"),Lt(N),Ea(N,"link",s),d.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},y.set(w,N))}}function M_(s,o,d,y){var w=(w=W.current)?ef(w):null;if(!w)throw Error(a(446));switch(s){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(o=lc(d.href),d=ma(w).hoistableStyles,y=d.get(o),y||(y={type:"style",instance:null,count:0,state:null},d.set(o,y)),y):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){s=lc(d.href);var N=ma(w).hoistableStyles,P=N.get(s);if(P||(w=w.ownerDocument||w,P={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},N.set(s,P),(N=w.querySelector(Gu(s)))&&!N._p&&(P.instance=N,P.state.loading=5),Vs.has(s)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},Vs.set(s,d),N||VE(w,s,d,P.state))),o&&y===null)throw Error(a(528,""));return P}if(o&&y!==null)throw Error(a(529,""));return null;case"script":return o=d.async,d=d.src,typeof d=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=cc(d),d=ma(w).hoistableScripts,y=d.get(o),y||(y={type:"script",instance:null,count:0,state:null},d.set(o,y)),y):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,s))}}function lc(s){return'href="'+Fn(s)+'"'}function Gu(s){return'link[rel="stylesheet"]['+s+"]"}function j_(s){return p({},s,{"data-precedence":s.precedence,precedence:null})}function VE(s,o,d,y){s.querySelector('link[rel="preload"][as="style"]['+o+"]")?y.loading=1:(o=s.createElement("link"),y.preload=o,o.addEventListener("load",function(){return y.loading|=1}),o.addEventListener("error",function(){return y.loading|=2}),Ea(o,"link",d),Lt(o),s.head.appendChild(o))}function cc(s){return'[src="'+Fn(s)+'"]'}function Ku(s){return"script[async]"+s}function E_(s,o,d){if(o.count++,o.instance===null)switch(o.type){case"style":var y=s.querySelector('style[data-href~="'+Fn(d.href)+'"]');if(y)return o.instance=y,Lt(y),y;var w=p({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return y=(s.ownerDocument||s).createElement("style"),Lt(y),Ea(y,"style",w),tf(y,d.precedence,s),o.instance=y;case"stylesheet":w=lc(d.href);var N=s.querySelector(Gu(w));if(N)return o.state.loading|=4,o.instance=N,Lt(N),N;y=j_(d),(w=Vs.get(w))&&Bg(y,w),N=(s.ownerDocument||s).createElement("link"),Lt(N);var P=N;return P._p=new Promise(function(G,ue){P.onload=G,P.onerror=ue}),Ea(N,"link",y),o.state.loading|=4,tf(N,d.precedence,s),o.instance=N;case"script":return N=cc(d.src),(w=s.querySelector(Ku(N)))?(o.instance=w,Lt(w),w):(y=d,(w=Vs.get(N))&&(y=p({},d),$g(y,w)),s=s.ownerDocument||s,w=s.createElement("script"),Lt(w),Ea(w,"link",y),s.head.appendChild(w),o.instance=w);case"void":return null;default:throw Error(a(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(y=o.instance,o.state.loading|=4,tf(y,d.precedence,s));return o.instance}function tf(s,o,d){for(var y=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=y.length?y[y.length-1]:null,N=w,P=0;P<y.length;P++){var G=y[P];if(G.dataset.precedence===o)N=G;else if(N!==w)break}N?N.parentNode.insertBefore(s,N.nextSibling):(o=d.nodeType===9?d.head:d,o.insertBefore(s,o.firstChild))}function Bg(s,o){s.crossOrigin==null&&(s.crossOrigin=o.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=o.referrerPolicy),s.title==null&&(s.title=o.title)}function $g(s,o){s.crossOrigin==null&&(s.crossOrigin=o.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=o.referrerPolicy),s.integrity==null&&(s.integrity=o.integrity)}var nf=null;function R_(s,o,d){if(nf===null){var y=new Map,w=nf=new Map;w.set(d,y)}else w=nf,y=w.get(d),y||(y=new Map,w.set(d,y));if(y.has(s))return y;for(y.set(s,null),d=d.getElementsByTagName(s),w=0;w<d.length;w++){var N=d[w];if(!(N[Wt]||N[Re]||s==="link"&&N.getAttribute("rel")==="stylesheet")&&N.namespaceURI!=="http://www.w3.org/2000/svg"){var P=N.getAttribute(o)||"";P=s+P;var G=y.get(P);G?G.push(N):y.set(P,[N])}}return y}function L_(s,o,d){s=s.ownerDocument||s,s.head.insertBefore(d,o==="title"?s.querySelector("head > title"):null)}function YE(s,o,d){if(d===1||o.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;switch(o.rel){case"stylesheet":return s=o.disabled,typeof o.precedence=="string"&&s==null;default:return!0}case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function T_(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function GE(s,o,d,y){if(d.type==="stylesheet"&&(typeof y.media!="string"||matchMedia(y.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var w=lc(y.href),N=o.querySelector(Gu(w));if(N){o=N._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(s.count++,s=af.bind(s),o.then(s,s)),d.state.loading|=4,d.instance=N,Lt(N);return}N=o.ownerDocument||o,y=j_(y),(w=Vs.get(w))&&Bg(y,w),N=N.createElement("link"),Lt(N);var P=N;P._p=new Promise(function(G,ue){P.onload=G,P.onerror=ue}),Ea(N,"link",y),d.instance=N}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(d,o),(o=d.state.preload)&&(d.state.loading&3)===0&&(s.count++,d=af.bind(s),o.addEventListener("load",d),o.addEventListener("error",d))}}var Ug=0;function KE(s,o){return s.stylesheets&&s.count===0&&rf(s,s.stylesheets),0<s.count||0<s.imgCount?function(d){var y=setTimeout(function(){if(s.stylesheets&&rf(s,s.stylesheets),s.unsuspend){var N=s.unsuspend;s.unsuspend=null,N()}},6e4+o);0<s.imgBytes&&Ug===0&&(Ug=62500*jE());var w=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&rf(s,s.stylesheets),s.unsuspend)){var N=s.unsuspend;s.unsuspend=null,N()}},(s.imgBytes>Ug?50:800)+o);return s.unsuspend=d,function(){s.unsuspend=null,clearTimeout(y),clearTimeout(w)}}:null}function af(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)rf(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var sf=null;function rf(s,o){s.stylesheets=null,s.unsuspend!==null&&(s.count++,sf=new Map,o.forEach(QE,s),sf=null,af.call(s))}function QE(s,o){if(!(o.state.loading&4)){var d=sf.get(s);if(d)var y=d.get(null);else{d=new Map,sf.set(s,d);for(var w=s.querySelectorAll("link[data-precedence],style[data-precedence]"),N=0;N<w.length;N++){var P=w[N];(P.nodeName==="LINK"||P.getAttribute("media")!=="not all")&&(d.set(P.dataset.precedence,P),y=P)}y&&d.set(null,y)}w=o.instance,P=w.getAttribute("data-precedence"),N=d.get(P)||y,N===y&&d.set(null,w),d.set(P,w),this.count++,y=af.bind(this),w.addEventListener("load",y),w.addEventListener("error",y),N?N.parentNode.insertBefore(w,N.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(w,s.firstChild)),o.state.loading|=4}}var Qu={$$typeof:C,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function XE(s,o,d,y,w,N,P,G,ue){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Un(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Un(0),this.hiddenUpdates=Un(null),this.identifierPrefix=y,this.onUncaughtError=w,this.onCaughtError=N,this.onRecoverableError=P,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ue,this.incompleteTransitions=new Map}function A_(s,o,d,y,w,N,P,G,ue,ke,Oe,Ve){return s=new XE(s,o,d,P,ue,ke,Oe,Ve,G),o=1,N===!0&&(o|=24),N=xs(3,null,null,o),s.current=N,N.stateNode=s,o=xm(),o.refCount++,s.pooledCache=o,o.refCount++,N.memoizedState={element:y,isDehydrated:d,cache:o},Sm(N),s}function I_(s){return s?(s=Ul,s):Ul}function D_(s,o,d,y,w,N){w=I_(w),y.context===null?y.context=w:y.pendingContext=w,y=Rr(o),y.payload={element:d},N=N===void 0?null:N,N!==null&&(y.callback=N),d=Lr(s,y,o),d!==null&&(is(d,s,o),Mu(d,s,o))}function O_(s,o){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var d=s.retryLane;s.retryLane=d!==0&&d<o?d:o}}function Fg(s,o){O_(s,o),(s=s.alternate)&&O_(s,o)}function z_(s){if(s.tag===13||s.tag===31){var o=vi(s,67108864);o!==null&&is(o,s,67108864),Fg(s,67108864)}}function B_(s){if(s.tag===13||s.tag===31){var o=Ns();o=ys(o);var d=vi(s,o);d!==null&&is(d,s,o),Fg(s,o)}}var of=!0;function ZE(s,o,d,y){var w=F.T;F.T=null;var N=Y.p;try{Y.p=2,Pg(s,o,d,y)}finally{Y.p=N,F.T=w}}function JE(s,o,d,y){var w=F.T;F.T=null;var N=Y.p;try{Y.p=8,Pg(s,o,d,y)}finally{Y.p=N,F.T=w}}function Pg(s,o,d,y){if(of){var w=Hg(y);if(w===null)jg(s,o,y,lf,d),U_(s,y);else if(eR(w,s,o,d,y))y.stopPropagation();else if(U_(s,y),o&4&&-1<WE.indexOf(s)){for(;w!==null;){var N=Ts(w);if(N!==null)switch(N.tag){case 3:if(N=N.stateNode,N.current.memoizedState.isDehydrated){var P=It(N.pendingLanes);if(P!==0){var G=N;for(G.pendingLanes|=2,G.entangledLanes|=2;P;){var ue=1<<31-kt(P);G.entanglements[1]|=ue,P&=~ue}wi(N),(tn&6)===0&&(Hh=me()+500,Hu(0))}}break;case 31:case 13:G=vi(N,2),G!==null&&is(G,N,2),Vh(),Fg(N,2)}if(N=Hg(y),N===null&&jg(s,o,y,lf,d),N===w)break;w=N}w!==null&&y.stopPropagation()}else jg(s,o,y,null,d)}}function Hg(s){return s=Di(s),qg(s)}var lf=null;function qg(s){if(lf=null,s=In(s),s!==null){var o=r(s);if(o===null)s=null;else{var d=o.tag;if(d===13){if(s=l(o),s!==null)return s;s=null}else if(d===31){if(s=c(o),s!==null)return s;s=null}else if(d===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;s=null}else o!==s&&(s=null)}}return lf=s,null}function $_(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ee()){case se:return 2;case le:return 8;case xe:case Pe:return 32;case $e:return 268435456;default:return 32}default:return 32}}var Vg=!1,Pr=null,Hr=null,qr=null,Xu=new Map,Zu=new Map,Vr=[],WE="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function U_(s,o){switch(s){case"focusin":case"focusout":Pr=null;break;case"dragenter":case"dragleave":Hr=null;break;case"mouseover":case"mouseout":qr=null;break;case"pointerover":case"pointerout":Xu.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zu.delete(o.pointerId)}}function Ju(s,o,d,y,w,N){return s===null||s.nativeEvent!==N?(s={blockedOn:o,domEventName:d,eventSystemFlags:y,nativeEvent:N,targetContainers:[w]},o!==null&&(o=Ts(o),o!==null&&z_(o)),s):(s.eventSystemFlags|=y,o=s.targetContainers,w!==null&&o.indexOf(w)===-1&&o.push(w),s)}function eR(s,o,d,y,w){switch(o){case"focusin":return Pr=Ju(Pr,s,o,d,y,w),!0;case"dragenter":return Hr=Ju(Hr,s,o,d,y,w),!0;case"mouseover":return qr=Ju(qr,s,o,d,y,w),!0;case"pointerover":var N=w.pointerId;return Xu.set(N,Ju(Xu.get(N)||null,s,o,d,y,w)),!0;case"gotpointercapture":return N=w.pointerId,Zu.set(N,Ju(Zu.get(N)||null,s,o,d,y,w)),!0}return!1}function F_(s){var o=In(s.target);if(o!==null){var d=r(o);if(d!==null){if(o=d.tag,o===13){if(o=l(d),o!==null){s.blockedOn=o,da(s.priority,function(){B_(d)});return}}else if(o===31){if(o=c(d),o!==null){s.blockedOn=o,da(s.priority,function(){B_(d)});return}}else if(o===3&&d.stateNode.current.memoizedState.isDehydrated){s.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}s.blockedOn=null}function cf(s){if(s.blockedOn!==null)return!1;for(var o=s.targetContainers;0<o.length;){var d=Hg(s.nativeEvent);if(d===null){d=s.nativeEvent;var y=new d.constructor(d.type,d);si=y,d.target.dispatchEvent(y),si=null}else return o=Ts(d),o!==null&&z_(o),s.blockedOn=d,!1;o.shift()}return!0}function P_(s,o,d){cf(s)&&d.delete(o)}function tR(){Vg=!1,Pr!==null&&cf(Pr)&&(Pr=null),Hr!==null&&cf(Hr)&&(Hr=null),qr!==null&&cf(qr)&&(qr=null),Xu.forEach(P_),Zu.forEach(P_)}function uf(s,o){s.blockedOn===o&&(s.blockedOn=null,Vg||(Vg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,tR)))}var df=null;function H_(s){df!==s&&(df=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){df===s&&(df=null);for(var o=0;o<s.length;o+=3){var d=s[o],y=s[o+1],w=s[o+2];if(typeof y!="function"){if(qg(y||d)===null)continue;break}var N=Ts(d);N!==null&&(s.splice(o,3),o-=3,Hm(N,{pending:!0,data:w,method:d.method,action:y},y,w))}}))}function uc(s){function o(ue){return uf(ue,s)}Pr!==null&&uf(Pr,s),Hr!==null&&uf(Hr,s),qr!==null&&uf(qr,s),Xu.forEach(o),Zu.forEach(o);for(var d=0;d<Vr.length;d++){var y=Vr[d];y.blockedOn===s&&(y.blockedOn=null)}for(;0<Vr.length&&(d=Vr[0],d.blockedOn===null);)F_(d),d.blockedOn===null&&Vr.shift();if(d=(s.ownerDocument||s).$$reactFormReplay,d!=null)for(y=0;y<d.length;y+=3){var w=d[y],N=d[y+1],P=w[We]||null;if(typeof N=="function")P||H_(d);else if(P){var G=null;if(N&&N.hasAttribute("formAction")){if(w=N,P=N[We]||null)G=P.formAction;else if(qg(w)!==null)continue}else G=P.action;typeof G=="function"?d[y+1]=G:(d.splice(y,3),y-=3),H_(d)}}}function q_(){function s(N){N.canIntercept&&N.info==="react-transition"&&N.intercept({handler:function(){return new Promise(function(P){return w=P})},focusReset:"manual",scroll:"manual"})}function o(){w!==null&&(w(),w=null),y||setTimeout(d,20)}function d(){if(!y&&!navigation.transition){var N=navigation.currentEntry;N&&N.url!=null&&navigation.navigate(N.url,{state:N.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var y=!1,w=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",o),navigation.addEventListener("navigateerror",o),setTimeout(d,100),function(){y=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",o),navigation.removeEventListener("navigateerror",o),w!==null&&(w(),w=null)}}}function Yg(s){this._internalRoot=s}hf.prototype.render=Yg.prototype.render=function(s){var o=this._internalRoot;if(o===null)throw Error(a(409));var d=o.current,y=Ns();D_(d,y,s,o,null,null)},hf.prototype.unmount=Yg.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var o=s.containerInfo;D_(s.current,2,null,s,null,null),Vh(),o[lt]=null}};function hf(s){this._internalRoot=s}hf.prototype.unstable_scheduleHydration=function(s){if(s){var o=ti();s={blockedOn:null,target:s,priority:o};for(var d=0;d<Vr.length&&o!==0&&o<Vr[d].priority;d++);Vr.splice(d,0,s),d===0&&F_(s)}};var V_=t.version;if(V_!=="19.2.4")throw Error(a(527,V_,"19.2.4"));Y.findDOMNode=function(s){var o=s._reactInternals;if(o===void 0)throw typeof s.render=="function"?Error(a(188)):(s=Object.keys(s).join(","),Error(a(268,s)));return s=h(o),s=s!==null?m(s):null,s=s===null?null:s.stateNode,s};var nR={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var ff=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ff.isDisabled&&ff.supportsFiber)try{ot=ff.inject(nR),ft=ff}catch(s){}}return ed.createRoot=function(s,o){if(!i(s))throw Error(a(299));var d=!1,y="",w=J1,N=W1,P=eb;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(y=o.identifierPrefix),o.onUncaughtError!==void 0&&(w=o.onUncaughtError),o.onCaughtError!==void 0&&(N=o.onCaughtError),o.onRecoverableError!==void 0&&(P=o.onRecoverableError)),o=A_(s,1,!1,null,null,d,y,null,w,N,P,q_),s[lt]=o.current,Mg(s),new Yg(o)},ed.hydrateRoot=function(s,o,d){if(!i(s))throw Error(a(299));var y=!1,w="",N=J1,P=W1,G=eb,ue=null;return d!=null&&(d.unstable_strictMode===!0&&(y=!0),d.identifierPrefix!==void 0&&(w=d.identifierPrefix),d.onUncaughtError!==void 0&&(N=d.onUncaughtError),d.onCaughtError!==void 0&&(P=d.onCaughtError),d.onRecoverableError!==void 0&&(G=d.onRecoverableError),d.formState!==void 0&&(ue=d.formState)),o=A_(s,1,!0,o,d!=null?d:null,y,w,ue,N,P,G,q_),o.context=I_(null),d=o.current,y=Ns(),y=ys(y),w=Rr(y),w.callback=null,Lr(d,w,y),d=y,o.current.lanes=d,Cn(o,d),wi(o),s[lt]=o.current,Mg(s),new hf(o)},ed.version="19.2.4",ed}var ew;function pR(){if(ew)return Xg.exports;ew=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Xg.exports=fR(),Xg.exports}var mR=pR();const gR=lR(mR),hv=new WeakMap,yR=new WeakMap,ep={current:[]};let Wg=!1,bd=0;const fd=new Set,gf=new Map;function zN(e){for(const t of e){if(ep.current.includes(t))continue;ep.current.push(t),t.recompute();const n=yR.get(t);if(n)for(const a of n){const i=hv.get(a);i!=null&&i.length&&zN(i)}}}function vR(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function xR(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function BN(e){var t;if(bd>0&&!gf.has(e)&&gf.set(e,e.prevState),fd.add(e),!(bd>0)&&!Wg)try{for(Wg=!0;fd.size>0;){const n=Array.from(fd);fd.clear();for(const a of n){const i=(t=gf.get(a))!=null?t:a.prevState;a.prevState=i,vR(a)}for(const a of n){const i=hv.get(a);i&&(ep.current.push(a),zN(i))}for(const a of n){const i=hv.get(a);if(i)for(const r of i)xR(r)}}}finally{Wg=!1,ep.current=[],gf.clear()}}function bR(e){bd++;try{e()}finally{if(bd--,bd===0){const t=fd.values().next().value;t&&BN(t)}}}function _R(e){return typeof e=="function"}class wR{constructor(t,n){this.listeners=new Set,this.subscribe=a=>{var i,r;this.listeners.add(a);const l=(r=(i=this.options)==null?void 0:i.onSubscribe)==null?void 0:r.call(i,a,this);return()=>{this.listeners.delete(a),l==null||l()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,a,i;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):_R(t)?this.state=t(this.prevState):this.state=t,(i=(a=this.options)==null?void 0:a.onUpdate)==null||i.call(a),BN(this)}}const po="__TSR_index",tw="popstate",nw="beforeunload";function SR(e){let t=e.getLocation();const n=new Set,a=l=>{t=e.getLocation(),n.forEach(c=>c({location:t,action:l}))},i=l=>{var c;(c=e.notifyOnIndexChange)==null||c?a(l):t=e.getLocation()},r=h=>St(null,null,function*(){var m=h,{task:l,navigateOpts:c}=m,u=Ie(m,["task","navigateOpts"]);var x,b,_,S;if((x=c==null?void 0:c.ignoreBlocker)!=null?x:!1){l();return}const g=(_=(b=e.getBlockers)==null?void 0:b.call(e))!=null?_:[],v=u.type==="PUSH"||u.type==="REPLACE";if(typeof document!="undefined"&&g.length&&v)for(const M of g){const C=Md(u.path,u.state);if(yield M.blockerFn({currentLocation:t,nextLocation:C,action:u.type})){(S=e.onBlocked)==null||S.call(e);return}}l()});return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:l=>(n.add(l),()=>{n.delete(l)}),push:(l,c,u)=>{const h=t.state[po];c=aw(h+1,c),r({task:()=>{e.pushState(l,c),a({type:"PUSH"})},navigateOpts:u,type:"PUSH",path:l,state:c})},replace:(l,c,u)=>{const h=t.state[po];c=aw(h,c),r({task:()=>{e.replaceState(l,c),a({type:"REPLACE"})},navigateOpts:u,type:"REPLACE",path:l,state:c})},go:(l,c)=>{r({task:()=>{e.go(l),i({type:"GO",index:l})},navigateOpts:c,type:"GO"})},back:l=>{r({task:()=>{var c;e.back((c=l==null?void 0:l.ignoreBlocker)!=null?c:!1),i({type:"BACK"})},navigateOpts:l,type:"BACK"})},forward:l=>{r({task:()=>{var c;e.forward((c=l==null?void 0:l.ignoreBlocker)!=null?c:!1),i({type:"FORWARD"})},navigateOpts:l,type:"FORWARD"})},canGoBack:()=>t.state[po]!==0,createHref:l=>e.createHref(l),block:l=>{var u,h;if(!e.setBlockers)return()=>{};const c=(h=(u=e.getBlockers)==null?void 0:u.call(e))!=null?h:[];return e.setBlockers([...c,l]),()=>{var p,g,v;const m=(g=(p=e.getBlockers)==null?void 0:p.call(e))!=null?g:[];(v=e.setBlockers)==null||v.call(e,m.filter(x=>x!==l))}},flush:()=>{var l;return(l=e.flush)==null?void 0:l.call(e)},destroy:()=>{var l;return(l=e.destroy)==null?void 0:l.call(e)},notify:a}}function aw(e,t){t||(t={});const n=Nx();return ee($({},t),{key:n,__TSR_key:n,[po]:e})}function $N(e){var T,A,R,D,O;const t=(T=e==null?void 0:e.window)!=null?T:typeof document!="undefined"?window:void 0,n=t.history.pushState,a=t.history.replaceState;let i=[];const r=()=>i,l=B=>i=B,c=(A=e==null?void 0:e.createHref)!=null?A:(B=>B),u=(R=e==null?void 0:e.parseLocation)!=null?R:(()=>Md(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((D=t.history.state)!=null&&D.__TSR_key)&&!((O=t.history.state)!=null&&O.key)){const B=Nx();t.history.replaceState({[po]:0,key:B,__TSR_key:B},"")}let h=u(),m,p=!1,g=!1,v=!1,x=!1;const b=()=>h;let _,S;const M=()=>{_&&(I._ignoreSubscribers=!0,(_.isPush?t.history.pushState:t.history.replaceState)(_.state,"",_.href),I._ignoreSubscribers=!1,_=void 0,S=void 0,m=void 0)},C=(B,z,U)=>{const F=c(z);S||(m=h),h=Md(z,U),_={href:F,state:U,isPush:(_==null?void 0:_.isPush)||B==="push"},S||(S=Promise.resolve().then(()=>M()))},k=B=>{h=u(),I.notify({type:B})},L=()=>St(null,null,function*(){if(g){g=!1;return}const B=u(),z=B.state[po]-h.state[po],U=z===1,F=z===-1,Y=!U&&!F||p;p=!1;const X=Y?"GO":F?"BACK":"FORWARD",ne=Y?{type:"GO",index:z}:{type:F?"BACK":"FORWARD"};if(v)v=!1;else{const q=r();if(typeof document!="undefined"&&q.length){for(const he of q)if(yield he.blockerFn({currentLocation:h,nextLocation:B,action:X})){g=!0,t.history.go(1),I.notify(ne);return}}}h=u(),I.notify(ne)}),E=B=>{var F;if(x){x=!1;return}let z=!1;const U=r();if(typeof document!="undefined"&&U.length)for(const Y of U){const X=(F=Y.enableBeforeUnload)!=null?F:!0;if(X===!0){z=!0;break}if(typeof X=="function"&&X()===!0){z=!0;break}}if(z)return B.preventDefault(),B.returnValue=""},I=SR({getLocation:b,getLength:()=>t.history.length,pushState:(B,z)=>C("push",B,z),replaceState:(B,z)=>C("replace",B,z),back:B=>(B&&(v=!0),x=!0,t.history.back()),forward:B=>{B&&(v=!0),x=!0,t.history.forward()},go:B=>{p=!0,t.history.go(B)},createHref:B=>c(B),flush:M,destroy:()=>{t.history.pushState=n,t.history.replaceState=a,t.removeEventListener(nw,E,{capture:!0}),t.removeEventListener(tw,L)},onBlocked:()=>{m&&h!==m&&(h=m)},getBlockers:r,setBlockers:l,notifyOnIndexChange:!1});return t.addEventListener(nw,E,{capture:!0}),t.addEventListener(tw,L),t.history.pushState=function(...B){const z=n.apply(t.history,B);return I._ignoreSubscribers||k("PUSH"),z},t.history.replaceState=function(...B){const z=a.apply(t.history,B);return I._ignoreSubscribers||k("REPLACE"),z},I}function NR(e){const t=typeof document!="undefined"?window:void 0;return $N({window:t,parseLocation:()=>{var u;const n=t.location.hash.split("#").slice(1),a=(u=n[0])!=null?u:"/",i=t.location.search,r=n.slice(1),l=r.length===0?"":`#${r.join("#")}`,c=`${a}${i}${l}`;return Md(c,t.history.state)},createHref:n=>`${t.location.pathname}${t.location.search}#${n}`})}function kR(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Md(e,t){const n=kR(e),a=n.indexOf("#"),i=n.indexOf("?"),r=Nx();return{href:n,pathname:n.substring(0,a>0?i>0?Math.min(a,i):a:i>0?i:n.length),hash:a>-1?n.substring(a):"",search:i>-1?n.slice(i,a===-1?void 0:a):"",state:t||{[po]:0,key:r,__TSR_key:r}}}function Nx(){return(Math.random()+1).toString(36).substring(7)}const ey=!1;function _d(e){let t;return bR(()=>{t=e()}),t}function jd(e){return e[e.length-1]}function CR(e){return typeof e=="function"}function uo(e,t){return CR(e)?e(t):e}const MR=Object.prototype.hasOwnProperty,sw=Object.prototype.propertyIsEnumerable;function Ms(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=t,i=ow(e)&&ow(a);if(!i&&!(tp(e)&&tp(a)))return a;const r=i?e:iw(e);if(!r)return a;const l=i?a:iw(a);if(!l)return a;const c=r.length,u=l.length,h=i?new Array(u):{};let m=0;for(let p=0;p<u;p++){const g=i?p:l[p],v=e[g],x=a[g];if(v===x){h[g]=v,(i?p<c:MR.call(e,g))&&m++;continue}if(v===null||x===null||typeof v!="object"||typeof x!="object"){h[g]=x;continue}const b=Ms(v,x,n+1);h[g]=b,b===v&&m++}return c===u&&m===c?e:h}function iw(e){const t=Object.getOwnPropertyNames(e);for(const i of t)if(!sw.call(e,i))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const a=t;for(const i of n){if(!sw.call(e,i))return!1;a.push(i)}return a}function tp(e){if(!rw(e))return!1;const t=e.constructor;if(typeof t=="undefined")return!0;const n=t.prototype;return!(!rw(n)||!n.hasOwnProperty("isPrototypeOf"))}function rw(e){return Object.prototype.toString.call(e)==="[object Object]"}function ow(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ol(e,t,n){var a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,r=e.length;i<r;i++)if(!ol(e[i],t[i],n))return!1;return!0}if(tp(e)&&tp(t)){const i=(a=n==null?void 0:n.ignoreUndefined)!=null?a:!0;if(n!=null&&n.partial){for(const c in t)if((!i||t[c]!==void 0)&&!ol(e[c],t[c],n))return!1;return!0}let r=0;if(!i)r=Object.keys(e).length;else for(const c in e)e[c]!==void 0&&r++;let l=0;for(const c in t)if((!i||t[c]!==void 0)&&(l++,l>r||!ol(e[c],t[c],n)))return!1;return r===l}return!1}function Pc(e){let t,n;const a=new Promise((i,r)=>{t=i,n=r});return a.status="pending",a.resolve=i=>{a.status="resolved",a.value=i,t(i),e==null||e(i)},a.reject=i=>{a.status="rejected",n(i)},a}function kc(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function jR(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function lw(e){let t;try{t=decodeURI(e)}catch(n){t=e.replaceAll(/%[0-9A-F]{2}/gi,a=>{try{return decodeURI(a)}catch(i){return a}})}return jR(t)}const UN=["http:","https:","mailto:","tel:"];function np(e){if(!e)return!1;try{const t=new URL(e);return!UN.includes(t.protocol)}catch(t){return!1}}function td(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,a="",i;for(;(i=t.exec(e))!==null;)a+=lw(e.slice(n,i.index))+i[0],n=t.lastIndex;a=a+lw(n?e.slice(n):e);let r=!1;return a.startsWith("//")&&(r=!0,a="/"+a.replace(/^\/+/,"")),{path:a,handledProtocolRelativeURL:r}}function ER(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}var RR="Invariant failed";function dr(e,t){if(!e)throw new Error(RR)}function ap(e){const t=new Map;let n,a;const i=r=>{r.next&&(r.prev?(r.prev.next=r.next,r.next.prev=r.prev,r.next=void 0,a&&(a.next=r,r.prev=a)):(r.next.prev=void 0,n=r.next,r.next=void 0,a&&(r.prev=a,a.next=r)),a=r)};return{get(r){const l=t.get(r);if(l)return i(l),l.value},set(r,l){if(t.size>=e&&n){const u=n;t.delete(u.key),u.next&&(n=u.next,u.next.prev=void 0),u===a&&(a=void 0)}const c=t.get(r);if(c)c.value=l,i(c);else{const u={key:r,value:l,prev:a};a&&(a.next=u),a=u,n||(n=u),t.set(r,u)}},clear(){t.clear(),n=void 0,a=void 0}}}const Hc=0,fl=1,pl=2,Ed=3,Ko=4,FN=5;function LR(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function kx(e,t,n=new Uint16Array(6)){const a=e.indexOf("/",t),i=a===-1?e.length:a,r=e.substring(t,i);if(!r||!r.includes("$"))return n[0]=Hc,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(r==="$"){const c=e.length;return n[0]=pl,n[1]=t,n[2]=t,n[3]=c,n[4]=c,n[5]=c,n}if(r.charCodeAt(0)===36)return n[0]=fl,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;const l=LR(r);if(l){const[c,u]=l,h=r.charCodeAt(c+1);if(h===45){if(c+2<r.length&&r.charCodeAt(c+2)===36){const m=c+3,p=u;if(m<p)return n[0]=Ed,n[1]=t+c,n[2]=t+m,n[3]=t+p,n[4]=t+u+1,n[5]=i,n}}else if(h===36){const m=c+1,p=c+2;return p===u?(n[0]=pl,n[1]=t+c,n[2]=t+m,n[3]=t+p,n[4]=t+u+1,n[5]=e.length,n):(n[0]=fl,n[1]=t+c,n[2]=t+p,n[3]=t+u,n[4]=t+u+1,n[5]=i,n)}}return n[0]=Hc,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function Ep(e,t,n,a,i,r,l){var u,h,m,p,g,v,x,b,_,S,M,C,k,L,E,I,T,A,R,D,O,B,z,U,F,Y,X,ne,q,he,pe;l==null||l(n);let c=a;{const H=(u=n.fullPath)!=null?u:n.from,te=H.length,ie=(m=(h=n.options)==null?void 0:h.caseSensitive)!=null?m:e,W=!!((g=(p=n.options)==null?void 0:p.params)!=null&&g.parse&&((x=(v=n.options)==null?void 0:v.skipRouteOnParseError)!=null&&x.params));for(;c<te;){const we=kx(H,c,t);let je;const De=c,re=we[5];switch(c=re+1,r++,we[0]){case Hc:{const J=H.substring(we[2],we[3]);if(ie){const K=(b=i.static)==null?void 0:b.get(J);if(K)je=K;else{(_=i.static)!=null||(i.static=new Map);const Q=Qo((S=n.fullPath)!=null?S:n.from);Q.parent=i,Q.depth=r,je=Q,i.static.set(J,Q)}}else{const K=J.toLowerCase(),Q=(M=i.staticInsensitive)==null?void 0:M.get(K);if(Q)je=Q;else{(C=i.staticInsensitive)!=null||(i.staticInsensitive=new Map);const ae=Qo((k=n.fullPath)!=null?k:n.from);ae.parent=i,ae.depth=r,je=ae,i.staticInsensitive.set(K,ae)}}break}case fl:{const J=H.substring(De,we[1]),K=H.substring(we[4],re),Q=ie&&!!(J||K),ae=J?Q?J:J.toLowerCase():void 0,ye=K?Q?K:K.toLowerCase():void 0,Ae=!W&&((L=i.dynamic)==null?void 0:L.find(de=>!de.skipOnParamError&&de.caseSensitive===Q&&de.prefix===ae&&de.suffix===ye));if(Ae)je=Ae;else{const de=ny(fl,(E=n.fullPath)!=null?E:n.from,Q,ae,ye);je=de,de.depth=r,de.parent=i,(I=i.dynamic)!=null||(i.dynamic=[]),i.dynamic.push(de)}break}case Ed:{const J=H.substring(De,we[1]),K=H.substring(we[4],re),Q=ie&&!!(J||K),ae=J?Q?J:J.toLowerCase():void 0,ye=K?Q?K:K.toLowerCase():void 0,Ae=!W&&((T=i.optional)==null?void 0:T.find(de=>!de.skipOnParamError&&de.caseSensitive===Q&&de.prefix===ae&&de.suffix===ye));if(Ae)je=Ae;else{const de=ny(Ed,(A=n.fullPath)!=null?A:n.from,Q,ae,ye);je=de,de.parent=i,de.depth=r,(R=i.optional)!=null||(i.optional=[]),i.optional.push(de)}break}case pl:{const J=H.substring(De,we[1]),K=H.substring(we[4],re),Q=ie&&!!(J||K),ae=J?Q?J:J.toLowerCase():void 0,ye=K?Q?K:K.toLowerCase():void 0,Ae=ny(pl,(D=n.fullPath)!=null?D:n.from,Q,ae,ye);je=Ae,Ae.parent=i,Ae.depth=r,(O=i.wildcard)!=null||(i.wildcard=[]),i.wildcard.push(Ae)}}i=je}if(W&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const we=Qo((B=n.fullPath)!=null?B:n.from);we.kind=FN,we.parent=i,r++,we.depth=r,(z=i.pathless)!=null||(i.pathless=[]),i.pathless.push(we),i=we}const ge=(n.path||!n.children)&&!n.isRoot;if(ge&&H.endsWith("/")){const we=Qo((U=n.fullPath)!=null?U:n.from);we.kind=Ko,we.parent=i,r++,we.depth=r,i.index=we,i=we}i.parse=(X=(Y=(F=n.options)==null?void 0:F.params)==null?void 0:Y.parse)!=null?X:null,i.skipOnParamError=W,i.parsingPriority=(he=(q=(ne=n.options)==null?void 0:ne.skipRouteOnParseError)==null?void 0:q.priority)!=null?he:0,ge&&!i.route&&(i.route=n,i.fullPath=(pe=n.fullPath)!=null?pe:n.from)}if(n.children)for(const H of n.children)Ep(e,t,H,c,i,r,l)}function ty(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function eo(e){var t,n,a;if(e.pathless)for(const i of e.pathless)eo(i);if(e.static)for(const i of e.static.values())eo(i);if(e.staticInsensitive)for(const i of e.staticInsensitive.values())eo(i);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort(ty);for(const i of e.dynamic)eo(i)}if((n=e.optional)!=null&&n.length){e.optional.sort(ty);for(const i of e.optional)eo(i)}if((a=e.wildcard)!=null&&a.length){e.wildcard.sort(ty);for(const i of e.wildcard)eo(i)}}function Qo(e){return{kind:Hc,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function ny(e,t,n,a,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:n,prefix:a,suffix:i}}function TR(e,t){const n=Qo("/"),a=new Uint16Array(6);for(const i of e)Ep(!1,a,i,1,n,0);eo(n),t.masksTree=n,t.flatCache=ap(1e3)}function AR(e,t){e||(e="/");const n=t.flatCache.get(e);if(n)return n;const a=Cx(e,t.masksTree);return t.flatCache.set(e,a),a}function IR(e,t,n,a,i){e||(e="/"),a||(a="/");const r=t?`case\0${e}`:e;let l=i.singleCache.get(r);if(!l){l=Qo("/");const c=new Uint16Array(6);Ep(t,c,{from:e},1,l,0),i.singleCache.set(r,l)}return Cx(a,l,n)}function DR(e,t,n=!1){const a=n?e:`nofuzz\0${e}`,i=t.matchCache.get(a);if(i!==void 0)return i;e||(e="/");let r;try{r=Cx(e,t.segmentTree,n)}catch(l){if(l instanceof URIError)r=null;else throw l}return r&&(r.branch=BR(r.route)),t.matchCache.set(a,r),r}function OR(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function zR(e,t=!1,n){const a=Qo(e.fullPath),i=new Uint16Array(6),r={},l={};let c=0;return Ep(t,i,e,1,a,0,h=>{if(n==null||n(h,c),dr(!(h.id in r),`Duplicate routes found with id: ${String(h.id)}`),r[h.id]=h,c!==0&&h.path){const m=OR(h.fullPath);(!l[m]||h.fullPath.endsWith("/"))&&(l[m]=h)}c++}),eo(a),{processedTree:{segmentTree:a,singleCache:ap(1e3),matchCache:ap(1e3),flatCache:null,masksTree:null},routesById:r,routesByPath:l}}function Cx(e,t,n=!1){const a=e.split("/"),i=UR(e,a,t,n);if(!i)return null;const[r]=PN(e,a,i);return{route:i.node.route,rawParams:r,parsedParams:i.parsedParams}}function PN(e,t,n){var m,p,g,v,x,b,_,S,M,C,k,L,E,I,T,A,R,D,O,B;const a=$R(n.node);let i=null;const r={};let l=(p=(m=n.extract)==null?void 0:m.part)!=null?p:0,c=(v=(g=n.extract)==null?void 0:g.node)!=null?v:0,u=(b=(x=n.extract)==null?void 0:x.path)!=null?b:0,h=(S=(_=n.extract)==null?void 0:_.segment)!=null?S:0;for(;c<a.length;l++,c++,u++,h++){const z=a[c];if(z.kind===Ko)break;if(z.kind===FN){h--,l--,u--;continue}const U=t[l],F=u;if(U&&(u+=U.length),z.kind===fl){i!=null||(i=n.node.fullPath.split("/"));const Y=i[h],X=(C=(M=z.prefix)==null?void 0:M.length)!=null?C:0;if(Y.charCodeAt(X)===123){const q=(L=(k=z.suffix)==null?void 0:k.length)!=null?L:0,he=Y.substring(X+2,Y.length-q-1),pe=U.substring(X,U.length-q);r[he]=decodeURIComponent(pe)}else{const q=Y.substring(1);r[q]=decodeURIComponent(U)}}else if(z.kind===Ed){if(n.skipped&1<<c){l--,u=F-1;continue}i!=null||(i=n.node.fullPath.split("/"));const Y=i[h],X=(I=(E=z.prefix)==null?void 0:E.length)!=null?I:0,ne=(A=(T=z.suffix)==null?void 0:T.length)!=null?A:0,q=Y.substring(X+3,Y.length-ne-1),he=z.suffix||z.prefix?U.substring(X,U.length-ne):U;he&&(r[q]=decodeURIComponent(he))}else if(z.kind===pl){const Y=z,X=e.substring(F+((D=(R=Y.prefix)==null?void 0:R.length)!=null?D:0),e.length-((B=(O=Y.suffix)==null?void 0:O.length)!=null?B:0)),ne=decodeURIComponent(X);r["*"]=ne,r._splat=ne;break}}return n.rawParams&&Object.assign(r,n.rawParams),[r,{part:l,node:c,path:u,segment:h}]}function BR(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function $R(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function UR(e,t,n,a){var p;if(e==="/"&&n.index)return{node:n.index,skipped:0};const i=!jd(t),r=i&&e!=="/",l=t.length-(i?1:0),c=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let u=null,h=null,m=null;for(;c.length;){const g=c.pop(),{node:v,index:x,skipped:b,depth:_,statics:S,dynamics:M,optionals:C}=g;let{extract:k,rawParams:L,parsedParams:E}=g;if(v.skipOnParamError){if(!ay(e,t,g))continue;L=g.rawParams,k=g.extract,E=g.parsedParams}a&&v.route&&v.kind!==Ko&&nd(h,g)&&(h=g);const I=x===l;if(I&&(v.route&&!r&&nd(m,g)&&(m=g),!v.optional&&!v.wildcard&&!v.index&&!v.pathless))continue;const T=I?void 0:t[x];let A;if(I&&v.index){const R={node:v.index,index:x,skipped:b,depth:_+1,statics:S,dynamics:M,optionals:C,extract:k,rawParams:L,parsedParams:E};let D=!0;if(v.index.skipOnParamError&&(ay(e,t,R)||(D=!1)),D){if(S===l&&!M&&!C&&!b)return R;nd(m,R)&&(m=R)}}if(v.wildcard&&nd(u,g))for(const R of v.wildcard){const{prefix:D,suffix:O}=R;if(D&&(I||!(R.caseSensitive?T:A!=null?A:A=T.toLowerCase()).startsWith(D)))continue;if(O){if(I)continue;const z=t.slice(x).join("/").slice(-O.length);if((R.caseSensitive?z:z.toLowerCase())!==O)continue}const B={node:R,index:l,skipped:b,depth:_,statics:S,dynamics:M,optionals:C,extract:k,rawParams:L,parsedParams:E};if(!(R.skipOnParamError&&!ay(e,t,B))){u=B;break}}if(v.optional){const R=b|1<<_,D=_+1;for(let O=v.optional.length-1;O>=0;O--){const B=v.optional[O];c.push({node:B,index:x,skipped:R,depth:D,statics:S,dynamics:M,optionals:C,extract:k,rawParams:L,parsedParams:E})}if(!I)for(let O=v.optional.length-1;O>=0;O--){const B=v.optional[O],{prefix:z,suffix:U}=B;if(z||U){const F=B.caseSensitive?T:A!=null?A:A=T.toLowerCase();if(z&&!F.startsWith(z)||U&&!F.endsWith(U))continue}c.push({node:B,index:x+1,skipped:b,depth:D,statics:S,dynamics:M,optionals:C+1,extract:k,rawParams:L,parsedParams:E})}}if(!I&&v.dynamic&&T)for(let R=v.dynamic.length-1;R>=0;R--){const D=v.dynamic[R],{prefix:O,suffix:B}=D;if(O||B){const z=D.caseSensitive?T:A!=null?A:A=T.toLowerCase();if(O&&!z.startsWith(O)||B&&!z.endsWith(B))continue}c.push({node:D,index:x+1,skipped:b,depth:_+1,statics:S,dynamics:M+1,optionals:C,extract:k,rawParams:L,parsedParams:E})}if(!I&&v.staticInsensitive){const R=v.staticInsensitive.get(A!=null?A:A=T.toLowerCase());R&&c.push({node:R,index:x+1,skipped:b,depth:_+1,statics:S+1,dynamics:M,optionals:C,extract:k,rawParams:L,parsedParams:E})}if(!I&&v.static){const R=v.static.get(T);R&&c.push({node:R,index:x+1,skipped:b,depth:_+1,statics:S+1,dynamics:M,optionals:C,extract:k,rawParams:L,parsedParams:E})}if(v.pathless){const R=_+1;for(let D=v.pathless.length-1;D>=0;D--){const O=v.pathless[D];c.push({node:O,index:x,skipped:b,depth:R,statics:S,dynamics:M,optionals:C,extract:k,rawParams:L,parsedParams:E})}}}if(m&&u)return nd(u,m)?m:u;if(m)return m;if(u)return u;if(a&&h){let g=h.index;for(let x=0;x<h.index;x++)g+=t[x].length;const v=g===e.length?"/":e.slice(g);return(p=h.rawParams)!=null||(h.rawParams={}),h.rawParams["**"]=decodeURIComponent(v),h}return null}function ay(e,t,n){try{const[a,i]=PN(e,t,n);n.rawParams=a,n.extract=i;const r=n.node.parse(a);return n.parsedParams=Object.assign({},n.parsedParams,r),!0}catch(a){return null}}function nd(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Ko)>(e.node.kind===Ko)||t.node.kind===Ko==(e.node.kind===Ko)&&t.depth>e.depth))):!0}function Vf(e){return Mx(e.filter(t=>t!==void 0).join("/"))}function Mx(e){return e.replace(/\/{2,}/g,"/")}function HN(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function lr(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function qN(e){return lr(HN(e))}function sp(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function FR(e,t,n){return sp(e,n)===sp(t,n)}function PR({base:e,to:t,trailingSlash:n="never",cache:a}){const i=t.startsWith("/"),r=!i&&t===".";let l;if(a){l=i?t:r?e:e+"\0"+t;const p=a.get(l);if(p)return p}let c;if(r)c=e.split("/");else if(i)c=t.split("/");else{for(c=e.split("/");c.length>1&&jd(c)==="";)c.pop();const p=t.split("/");for(let g=0,v=p.length;g<v;g++){const x=p[g];x===""?g?g===v-1&&c.push(x):c=[x]:x===".."?c.pop():x==="."||c.push(x)}}c.length>1&&(jd(c)===""?n==="never"&&c.pop():n==="always"&&c.push(""));let u,h="";for(let p=0;p<c.length;p++){p>0&&(h+="/");const g=c[p];if(!g)continue;u=kx(g,0,u);const v=u[0];if(v===Hc){h+=g;continue}const x=u[5],b=g.substring(0,u[1]),_=g.substring(u[4],x),S=g.substring(u[2],u[3]);v===fl?h+=b||_?`${b}{$${S}}${_}`:`$${S}`:v===pl?h+=b||_?`${b}{$}${_}`:"$":h+=`${b}{-$${S}}${_}`}h=Mx(h);const m=h||"/";return l&&a&&a.set(l,m),m}function HR(e){const t=new Map(e.map(i=>[encodeURIComponent(i),i])),n=Array.from(t.keys()).map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),a=new RegExp(n,"g");return i=>i.replace(a,r=>{var l;return(l=t.get(r))!=null?l:r})}function sy(e,t,n){const a=t[e];return typeof a!="string"?a:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(a)?a:a.split("/").map(i=>cw(i,n)).join("/"):cw(a,n)}function iy(i){var r=i,{path:e,params:t,decoder:n}=r,a=Ie(r,["path","params","decoder"]);var v,x;let l=!1;const c={};if(!e||e==="/")return{interpolatedPath:"/",usedParams:c,isMissingParams:l};if(!e.includes("$"))return{interpolatedPath:e,usedParams:c,isMissingParams:l};const u=e.length;let h=0,m,p="";for(;h<u;){const b=h;m=kx(e,b,m);const _=m[5];if(h=_+1,b===_)continue;const S=m[0];if(S===Hc){p+="/"+e.substring(b,_);continue}if(S===pl){const M=t._splat;c._splat=M,c["*"]=M;const C=e.substring(b,m[1]),k=e.substring(m[4],_);if(!M){l=!0,(C||k)&&(p+="/"+C+k);continue}const L=sy("_splat",t,n);p+="/"+C+L+k;continue}if(S===fl){const M=e.substring(m[2],m[3]);!l&&!(M in t)&&(l=!0),c[M]=t[M];const C=e.substring(b,m[1]),k=e.substring(m[4],_),L=(v=sy(M,t,n))!=null?v:"undefined";p+="/"+C+L+k;continue}if(S===Ed){const M=e.substring(m[2],m[3]),C=t[M];if(C==null)continue;c[M]=C;const k=e.substring(b,m[1]),L=e.substring(m[4],_),E=(x=sy(M,t,n))!=null?x:"";p+="/"+k+E+L;continue}}return e.endsWith("/")&&(p+="/"),{usedParams:c,interpolatedPath:p||"/",isMissingParams:l}}function cw(e,t){var a;const n=encodeURIComponent(e);return(a=t==null?void 0:t(n))!=null?a:n}function js(e){return!!(e!=null&&e.isNotFound)}function qR(){try{if(typeof window!="undefined"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch(e){}}const fv="tsr-scroll-restoration-v1_3",VR=(e,t)=>{let n;return(...a)=>{n||(n=setTimeout(()=>{e(...a),n=null},t))}};function YR(){const e=qR();if(!e)return null;const t=e.getItem(fv);let n=t?JSON.parse(t):{};return{state:n,set:a=>{n=uo(a,n)||n;try{e.setItem(fv,JSON.stringify(n))}catch(i){console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const yf=YR(),GR=e=>e.state.__TSR_key||e.href;function KR(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}let ip=!1;function QR({storageKey:e,key:t,behavior:n,shouldScrollRestoration:a,scrollToTopSelectors:i,location:r}){var h,m,p;let l;try{l=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(g){console.error(g);return}const c=t||((h=window.history.state)==null?void 0:h.__TSR_key),u=l[c];ip=!0;e:{if(a&&u&&Object.keys(u).length>0){for(const x in u){const b=u[x];if(x==="window")window.scrollTo({top:b.scrollY,left:b.scrollX,behavior:n});else if(x){const _=document.querySelector(x);_&&(_.scrollLeft=b.scrollX,_.scrollTop=b.scrollY)}}break e}const g=(r!=null?r:window.location).hash.split("#",2)[1];if(g){const x=(p=(m=window.history.state)==null?void 0:m.__hashScrollIntoViewOptions)!=null?p:!0;if(x){const b=document.getElementById(g);b&&b.scrollIntoView(x)}break e}const v={top:0,left:0,behavior:n};if(window.scrollTo(v),i)for(const x of i){if(x==="window")continue;const b=typeof x=="function"?x():document.querySelector(x);b&&b.scrollTo(v)}}ip=!1}function XR(e,t){var r;if(!yf||(((r=e.options.scrollRestoration)!=null?r:!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!yf))return;e.isScrollRestorationSetup=!0,ip=!1;const a=e.options.getScrollRestorationKey||GR;window.history.scrollRestoration="manual";const i=l=>{if(ip||!e.isScrollRestoring)return;let c="";if(l.target===document||l.target===window)c="window";else{const h=l.target.getAttribute("data-scroll-restoration-id");h?c=`[data-scroll-restoration-id="${h}"]`:c=KR(l.target)}const u=a(e.state.location);yf.set(h=>{const m=h[u]||(h[u]={}),p=m[c]||(m[c]={});if(c==="window")p.scrollX=window.scrollX||0,p.scrollY=window.scrollY||0;else if(c){const g=document.querySelector(c);g&&(p.scrollX=g.scrollLeft||0,p.scrollY=g.scrollTop||0)}return h})};typeof document!="undefined"&&document.addEventListener("scroll",VR(i,100),!0),e.subscribe("onRendered",l=>{const c=a(l.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(QR({storageKey:fv,key:c,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&yf.set(u=>(u[c]||(u[c]={}),u)))})}function ZR(e){var t;if(typeof document!="undefined"&&document.querySelector){const n=(t=e.state.location.state.__hashScrollIntoViewOptions)!=null?t:!0;if(n&&e.state.location.hash!==""){const a=document.getElementById(e.state.location.hash);a&&a.scrollIntoView(n)}}}function JR(e,t=String){const n=new URLSearchParams;for(const a in e){const i=e[a];i!==void 0&&n.set(a,t(i))}return n.toString()}function ry(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function WR(e){const t=new URLSearchParams(e),n={};for(const[a,i]of t.entries()){const r=n[a];r==null?n[a]=ry(i):Array.isArray(r)?r.push(ry(i)):n[a]=[r,ry(i)]}return n}const eL=nL(JSON.parse),tL=aL(JSON.stringify,JSON.parse);function nL(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=WR(t);for(const a in n){const i=n[a];if(typeof i=="string")try{n[a]=e(i)}catch(r){}}return n}}function aL(e,t){const n=typeof t=="function";function a(i){if(typeof i=="object"&&i!==null)try{return e(i)}catch(r){}else if(n&&typeof i=="string")try{return t(i),e(i)}catch(r){}return i}return i=>{const r=JR(i,a);return r?`?${r}`:""}}const Ks="__root__";function sL(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&typeof e.href=="string"&&np(e.href))throw new Error(`Redirect blocked: unsafe protocol in href "${e.href}". Only ${UN.join(", ")} protocols are allowed.`);if(!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch(a){}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Zs(e){return e instanceof Response&&!!e.options}const Yf=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},Rp=(e,t)=>!!(e.preload&&!e.router.state.matches.some(n=>n.id===t)),Cc=(e,t,n=!0)=>{var r;const a=$({},(r=e.router.options.context)!=null?r:{}),i=n?t:t-1;for(let l=0;l<=i;l++){const c=e.matches[l];if(!c)continue;const u=e.router.getMatch(c.id);u&&Object.assign(a,u.__routeContext,u.__beforeLoadContext)}return a},VN=(e,t)=>{var i,r,l;const n=(r=e.router.routesById[(i=t.routeId)!=null?i:""])!=null?r:e.router.routeTree;!n.options.notFoundComponent&&((l=e.router.options)!=null&&l.defaultNotFoundComponent)&&(n.options.notFoundComponent=e.router.options.defaultNotFoundComponent),dr(n.options.notFoundComponent);const a=e.matches.find(c=>c.routeId===n.id);dr(a,"Could not find match for route: "+n.id),e.updateMatch(a.id,c=>ee($({},c),{status:"notFound",error:t,isFetching:!1})),t.routerCode==="BEFORE_LOAD"&&n.parentRoute&&(t.routeId=n.parentRoute.id,VN(e,t))},ho=(e,t,n)=>{var a,i,r;if(!(!Zs(n)&&!js(n))){if(Zs(n)&&n.redirectHandled&&!n.options.reloadDocument)throw n;if(t){(a=t._nonReactive.beforeLoadPromise)==null||a.resolve(),(i=t._nonReactive.loaderPromise)==null||i.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;const l=Zs(n)?"redirected":"notFound";t._nonReactive.error=n,e.updateMatch(t.id,c=>ee($({},c),{status:l,context:Cc(e,t.index),isFetching:!1,error:n})),js(n)&&!n.routeId&&(n.routeId=t.routeId),(r=t._nonReactive.loadPromise)==null||r.resolve()}throw Zs(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n),n):(VN(e,n),n)}},YN=(e,t)=>!!e.router.getMatch(t)._nonReactive.dehydrated,ad=(e,t,n,a)=>{var c,u,h;const{id:i,routeId:r}=e.matches[t],l=e.router.looseRoutesById[r];if(n instanceof Promise)throw n;n.routerCode=a,(c=e.firstBadMatchIndex)!=null||(e.firstBadMatchIndex=t),ho(e,e.router.getMatch(i),n);try{(h=(u=l.options).onError)==null||h.call(u,n)}catch(m){n=m,ho(e,e.router.getMatch(i),n)}e.updateMatch(i,m=>{var p,g;return(p=m._nonReactive.beforeLoadPromise)==null||p.resolve(),m._nonReactive.beforeLoadPromise=void 0,(g=m._nonReactive.loadPromise)==null||g.resolve(),ee($({},m),{error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})})},GN=(e,t,n,a)=>{var l,c,u;if(a._nonReactive.pendingTimeout!==void 0)return;const i=(l=n.options.pendingMs)!=null?l:e.router.options.defaultPendingMs;if(!!(e.onReady&&!Rp(e,t)&&(n.options.loader||n.options.beforeLoad||XN(n))&&typeof i=="number"&&i!==1/0&&((u=n.options.pendingComponent)!=null?u:(c=e.router.options)!=null&&c.defaultPendingComponent))){const h=setTimeout(()=>{Yf(e)},i);a._nonReactive.pendingTimeout=h}},iL=(e,t,n)=>{const a=e.router.getMatch(t);if(!a._nonReactive.beforeLoadPromise&&!a._nonReactive.loaderPromise)return;GN(e,t,n,a);const i=()=>{const r=e.router.getMatch(t);r.preload&&(r.status==="redirected"||r.status==="notFound")&&ho(e,r,r.error)};return a._nonReactive.beforeLoadPromise?a._nonReactive.beforeLoadPromise.then(i):i()},rL=(e,t,n,a)=>{const i=e.router.getMatch(t),r=i._nonReactive.loadPromise;i._nonReactive.loadPromise=Pc(()=>{r==null||r.resolve()});const{paramsError:l,searchError:c}=i;l&&ad(e,n,l,"PARSE_PARAMS"),c&&ad(e,n,c,"VALIDATE_SEARCH"),GN(e,t,a,i);const u=new AbortController;let h=!1;const m=()=>{h||(h=!0,e.updateMatch(t,k=>ee($({},k),{isFetching:"beforeLoad",fetchCount:k.fetchCount+1,abortController:u})))},p=()=>{var k;(k=i._nonReactive.beforeLoadPromise)==null||k.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,L=>ee($({},L),{isFetching:!1}))};if(!a.options.beforeLoad){_d(()=>{m(),p()});return}i._nonReactive.beforeLoadPromise=Pc();const g=$($({},Cc(e,n,!1)),i.__routeContext),{search:v,params:x,cause:b}=i,_=Rp(e,t),S=$({search:v,abortController:u,params:x,preload:_,context:g,location:e.location,navigate:k=>e.router.navigate(ee($({},k),{_fromLocation:e.location})),buildLocation:e.router.buildLocation,cause:_?"preload":b,matches:e.matches,routeId:a.id},e.router.options.additionalContext),M=k=>{if(k===void 0){_d(()=>{m(),p()});return}(Zs(k)||js(k))&&(m(),ad(e,n,k,"BEFORE_LOAD")),_d(()=>{m(),e.updateMatch(t,L=>ee($({},L),{__beforeLoadContext:k})),p()})};let C;try{if(C=a.options.beforeLoad(S),kc(C))return m(),C.catch(k=>{ad(e,n,k,"BEFORE_LOAD")}).then(M)}catch(k){m(),ad(e,n,k,"BEFORE_LOAD")}M(C)},oL=(e,t)=>{const{id:n,routeId:a}=e.matches[t],i=e.router.looseRoutesById[a],r=()=>c(),l=()=>rL(e,n,t,i),c=()=>{if(YN(e,n))return;const u=iL(e,n,i);return kc(u)?u.then(l):l()};return r()},lL=(e,t,n)=>{var r,l,c,u,h,m;const a=e.router.getMatch(t);if(!a||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const i={ssr:e.router.options.ssr,matches:e.matches,match:a,params:a.params,loaderData:a.loaderData};return Promise.all([(l=(r=n.options).head)==null?void 0:l.call(r,i),(u=(c=n.options).scripts)==null?void 0:u.call(c,i),(m=(h=n.options).headers)==null?void 0:m.call(h,i)]).then(([p,g,v])=>{const x=p==null?void 0:p.meta,b=p==null?void 0:p.links,_=p==null?void 0:p.scripts,S=p==null?void 0:p.styles;return{meta:x,links:b,headScripts:_,headers:v,scripts:g,styles:S}})},KN=(e,t,n,a)=>{const i=e.matchPromises[n-1],{params:r,loaderDeps:l,abortController:c,cause:u}=e.router.getMatch(t),h=Cc(e,n),m=Rp(e,t);return $({params:r,deps:l,preload:!!m,parentMatchPromise:i,abortController:c,context:h,location:e.location,navigate:p=>e.router.navigate(ee($({},p),{_fromLocation:e.location})),cause:m?"preload":u,route:a},e.router.options.additionalContext)},uw=(e,t,n,a)=>St(null,null,function*(){var i,r,l,c,u,h,m;try{const p=e.router.getMatch(t);try{(!(ey!=null?ey:e.router.isServer)||p.ssr===!0)&&QN(a);const g=(r=(i=a.options).loader)==null?void 0:r.call(i,KN(e,t,n,a)),v=a.options.loader&&kc(g);if(!!(v||a._lazyPromise||a._componentsPromise||a.options.head||a.options.scripts||a.options.headers||p._nonReactive.minPendingPromise)&&e.updateMatch(t,_=>ee($({},_),{isFetching:"loader"})),a.options.loader){const _=v?yield g:g;ho(e,e.router.getMatch(t),_),_!==void 0&&e.updateMatch(t,S=>ee($({},S),{loaderData:_}))}a._lazyPromise&&(yield a._lazyPromise);const b=p._nonReactive.minPendingPromise;b&&(yield b),a._componentsPromise&&(yield a._componentsPromise),e.updateMatch(t,_=>ee($({},_),{error:void 0,context:Cc(e,n),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(g){let v=g;if((v==null?void 0:v.name)==="AbortError"){if(p.abortController.signal.aborted){(l=p._nonReactive.loaderPromise)==null||l.resolve(),p._nonReactive.loaderPromise=void 0;return}e.updateMatch(t,b=>ee($({},b),{status:b.status==="pending"?"success":b.status,isFetching:!1,context:Cc(e,n)}));return}const x=p._nonReactive.minPendingPromise;x&&(yield x),js(g)&&(yield(u=(c=a.options.notFoundComponent)==null?void 0:c.preload)==null?void 0:u.call(c)),ho(e,e.router.getMatch(t),g);try{(m=(h=a.options).onError)==null||m.call(h,g)}catch(b){v=b,ho(e,e.router.getMatch(t),b)}e.updateMatch(t,b=>ee($({},b),{error:v,context:Cc(e,n),status:"error",isFetching:!1}))}}catch(p){const g=e.router.getMatch(t);g&&(g._nonReactive.loaderPromise=void 0),ho(e,g,p)}}),cL=(e,t)=>St(null,null,function*(){var m,p;function n(g,v,x,b){return St(this,null,function*(){var E,I,T,A;const _=Date.now()-v.updatedAt,S=g?(I=(E=b.options.preloadStaleTime)!=null?E:e.router.options.defaultPreloadStaleTime)!=null?I:3e4:(A=(T=b.options.staleTime)!=null?T:e.router.options.defaultStaleTime)!=null?A:0,M=b.options.shouldReload,C=typeof M=="function"?M(KN(e,a,t,b)):M,{status:k,invalid:L}=x;r=k==="success"&&(L||(C!=null?C:_>S)),g&&b.options.preload===!1||(r&&!e.sync?(l=!0,St(null,null,function*(){var R,D;try{yield uw(e,a,t,b);const O=e.router.getMatch(a);(R=O._nonReactive.loaderPromise)==null||R.resolve(),(D=O._nonReactive.loadPromise)==null||D.resolve(),O._nonReactive.loaderPromise=void 0}catch(O){Zs(O)&&(yield e.router.navigate(O.options))}})):(k!=="success"||r&&e.sync)&&(yield uw(e,a,t,b)))})}const{id:a,routeId:i}=e.matches[t];let r=!1,l=!1;const c=e.router.looseRoutesById[i];if(!YN(e,a)){const g=e.router.getMatch(a),v=Rp(e,a);if(g._nonReactive.loaderPromise){if(g.status==="success"&&!e.sync&&!g.preload)return g;yield g._nonReactive.loaderPromise;const x=e.router.getMatch(a),b=x._nonReactive.error||x.error;b&&ho(e,x,b),x.status==="pending"&&(yield n(v,g,x,c))}else{const x=v&&!e.router.state.matches.some(_=>_.id===a),b=e.router.getMatch(a);b._nonReactive.loaderPromise=Pc(),x!==b.preload&&e.updateMatch(a,_=>ee($({},_),{preload:x})),yield n(v,g,b,c)}}const u=e.router.getMatch(a);l||((m=u._nonReactive.loaderPromise)==null||m.resolve(),(p=u._nonReactive.loadPromise)==null||p.resolve()),clearTimeout(u._nonReactive.pendingTimeout),u._nonReactive.pendingTimeout=void 0,l||(u._nonReactive.loaderPromise=void 0),u._nonReactive.dehydrated=void 0;const h=l?u.isFetching:!1;return h!==u.isFetching||u.invalid!==!1?(e.updateMatch(a,g=>ee($({},g),{isFetching:h,invalid:!1})),e.router.getMatch(a)):u});function dw(e){return St(this,null,function*(){var n;const t=Object.assign(e,{matchPromises:[]});t.router.state.matches.some(a=>a._forcePending)&&Yf(t);try{for(let u=0;u<t.matches.length;u++){const h=oL(t,u);kc(h)&&(yield h)}const a=(n=t.firstBadMatchIndex)!=null?n:t.matches.length;for(let u=0;u<a;u++)t.matchPromises.push(cL(t,u));const r=(yield Promise.allSettled(t.matchPromises)).filter(u=>u.status==="rejected").map(u=>u.reason);let l;for(const u of r){if(Zs(u))throw u;!l&&js(u)&&(l=u)}for(const u of t.matches){const{id:h,routeId:m}=u,p=t.router.looseRoutesById[m];try{const g=lL(t,h,p);if(g){const v=yield g;t.updateMatch(h,x=>$($({},x),v))}}catch(g){console.error(`Error executing head for route ${m}:`,g)}}if(l)throw l;const c=Yf(t);kc(c)&&(yield c)}catch(a){if(js(a)&&!t.preload){const i=Yf(t);throw kc(i)&&(yield i),a}if(Zs(a))throw a}return t.matches})}function QN(e){return St(this,null,function*(){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{const i=t.options,{id:n}=i,a=Ie(i,["id"]);Object.assign(e.options,a),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){const t=()=>{var a;const n=[];for(const i of ZN){const r=(a=e.options[i])==null?void 0:a.preload;r&&n.push(r())}if(n.length)return Promise.all(n).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise})}function XN(e){var t;for(const n of ZN)if((t=e.options[n])!=null&&t.preload)return!0;return!1}const ZN=["component","errorComponent","pendingComponent","notFoundComponent"];function uL(e){return{input:({url:t})=>{for(const n of e)t=pv(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=JN(e[n],t);return t}}}function dL(e){const t=qN(e.basepath),n=`/${t}`,a=`${n}/`,i=e.caseSensitive?n:n.toLowerCase(),r=e.caseSensitive?a:a.toLowerCase();return{input:({url:l})=>{const c=e.caseSensitive?l.pathname:l.pathname.toLowerCase();return c===i?l.pathname="/":c.startsWith(r)&&(l.pathname=l.pathname.slice(n.length)),l},output:({url:l})=>(l.pathname=Vf(["/",t,l.pathname]),l)}}function pv(e,t){var a;const n=(a=e==null?void 0:e.input)==null?void 0:a.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function JN(e,t){var a;const n=(a=e==null?void 0:e.output)==null?void 0:a.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function ll(e){const t=e.resolvedLocation,n=e.location,a=(t==null?void 0:t.pathname)!==n.pathname,i=(t==null?void 0:t.href)!==n.href,r=(t==null?void 0:t.hash)!==n.hash;return{fromLocation:t,toLocation:n,pathChanged:a,hrefChanged:i,hashChanged:r}}class hL{constructor(t){var n,a,i,r;this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=l=>l(),this.update=l=>{var _,S,M,C,k;l.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const c=this.options,u=(S=(_=this.basepath)!=null?_:c==null?void 0:c.basepath)!=null?S:"/",h=this.basepath===void 0,m=c==null?void 0:c.rewrite;if(this.options=$($({},c),l),this.isServer=(M=this.options.isServer)!=null?M:typeof document=="undefined",this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=HR(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=$N()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let L;this.resolvePathCache=ap(1e3),L=this.buildRouteTree(),this.setRoutes(L)}!this.__store&&this.latestLocation&&(this.__store=new wR(pL(this.latestLocation),{onUpdate:()=>{this.__store.state=ee($({},this.state),{cachedMatches:this.state.cachedMatches.filter(L=>!["redirected"].includes(L.status))})}}),XR(this));let p=!1;const g=(C=this.options.basepath)!=null?C:"/",v=this.options.rewrite;if(h||u!==g||m!==v){this.basepath=g;const L=[],E=qN(g);E&&E!=="/"&&L.push(dL({basepath:g})),v&&L.push(v),this.rewrite=L.length===0?void 0:L.length===1?L[0]:uL(L),this.history&&this.updateLatestLocation(),p=!0}p&&this.__store&&(this.__store.state=ee($({},this.state),{location:this.latestLocation})),typeof window!="undefined"&&"CSS"in window&&typeof((k=window.CSS)==null?void 0:k.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const l=zR(this.routeTree,this.options.caseSensitive,(c,u)=>{c.init({originalIndex:u})});return this.options.routeMasks&&TR(this.options.routeMasks,l.processedTree),l},this.subscribe=(l,c)=>{const u={eventType:l,fn:c};return this.subscribers.add(u),()=>{this.subscribers.delete(u)}},this.emit=l=>{this.subscribers.forEach(c=>{c.eventType===l.type&&c.fn(l)})},this.parseLocation=(l,c)=>{const u=({pathname:g,search:v,hash:x,href:b,state:_})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(g)){const E=this.options.parseSearch(v),I=this.options.stringifySearch(E);return{href:g+I+x,publicHref:b,pathname:td(g).path,external:!1,searchStr:I,search:Ms(c==null?void 0:c.search,E),hash:td(x.slice(1)).path,state:Ms(c==null?void 0:c.state,_)}}const S=new URL(b,this.origin),M=pv(this.rewrite,S),C=this.options.parseSearch(M.search),k=this.options.stringifySearch(C);return M.search=k,{href:M.href.replace(M.origin,""),publicHref:b,pathname:td(M.pathname).path,external:!!this.rewrite&&M.origin!==this.origin,searchStr:k,search:Ms(c==null?void 0:c.search,C),hash:td(M.hash.slice(1)).path,state:Ms(c==null?void 0:c.state,_)}},h=u(l),{__tempLocation:m,__tempKey:p}=h.state;if(m&&(!p||p===this.tempLocationKey)){const g=u(m);return g.state.key=h.state.key,g.state.__TSR_key=h.state.__TSR_key,delete g.state.__tempLocation,ee($({},g),{maskedLocation:h})}return h},this.resolvePathWithBase=(l,c)=>PR({base:l,to:Mx(c),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(l,c,u)=>typeof l=="string"?this.matchRoutesInternal({pathname:l,search:c},u):this.matchRoutesInternal(l,c),this.getMatchedRoutes=l=>mL({pathname:l,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=l=>{const c=this.getMatch(l);c&&(c.abortController.abort(),clearTimeout(c._nonReactive.pendingTimeout),c._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{var h;const l=this.state.matches.filter(m=>m.status==="pending"),c=this.state.matches.filter(m=>m.isFetching==="loader");new Set([...(h=this.state.pendingMatches)!=null?h:[],...l,...c]).forEach(m=>{this.cancelMatch(m.id)})},this.buildLocation=l=>{const c=(h={})=>{var Y,X,ne,q,he;const m=h._fromLocation||this.pendingBuiltLocation||this.latestLocation,p=this.matchRoutesLightweight(m);h.from;const g=h.unsafeRelative==="path"?m.pathname:(Y=h.from)!=null?Y:p.fullPath,v=this.resolvePathWithBase(g,"."),x=p.search,b=$({},p.params),_=h.to?this.resolvePathWithBase(v,`${h.to}`):this.resolvePathWithBase(v,"."),S=h.params===!1||h.params===null?{}:((X=h.params)!=null?X:!0)===!0?b:Object.assign(b,uo(h.params,b)),M=iy({path:_,params:S,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath,C=this.getMatchedRoutes(M);let k=C.matchedRoutes;(C.foundRoute?C.foundRoute.path!=="/"&&C.routeParams["**"]:lr(M))&&this.options.notFoundRoute&&(k=[...k,this.options.notFoundRoute]);let E=!1;if(Object.keys(S).length>0)for(const pe of k){const H=(q=(ne=pe.options.params)==null?void 0:ne.stringify)!=null?q:pe.options.stringifyParams;H&&(E=!0,Object.assign(S,H(S)))}const I=l.leaveParams?_:td(E?iy({path:_,params:S,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath:M).path;let T=x;if(l._includeValidateSearch&&((he=this.options.search)!=null&&he.strict)){const pe={};k.forEach(H=>{if(H.options.validateSearch)try{Object.assign(pe,Gf(H.options.validateSearch,$($({},pe),T)))}catch(te){}}),T=pe}T=gL({search:T,dest:h,destRoutes:k,_includeValidateSearch:l._includeValidateSearch}),T=Ms(x,T);const A=this.options.stringifySearch(T),R=h.hash===!0?m.hash:h.hash?uo(h.hash,m.hash):void 0,D=R?`#${R}`:"";let O=h.state===!0?m.state:h.state?uo(h.state,m.state):{};O=Ms(m.state,O);const B=`${I}${A}${D}`;let z,U,F=!1;if(this.rewrite){const pe=new URL(B,this.origin),H=JN(this.rewrite,pe);z=pe.href.replace(pe.origin,""),H.origin!==this.origin?(U=H.href,F=!0):U=H.pathname+H.search+H.hash}else z=ER(B),U=z;return{publicHref:U,href:z,pathname:I,search:T,searchStr:A,state:O,hash:R!=null?R:"",external:F,unmaskOnReload:h.unmaskOnReload}},u=(h={},m)=>{const p=c(h);let g=m?c(m):void 0;if(!g){const x={};if(this.options.routeMasks){const b=AR(p.pathname,this.processedTree);if(b){Object.assign(x,b.rawParams);const v=b.route,{from:_,params:S}=v,M=Ie(v,["from","params"]),C=S===!1||S===null?{}:(S!=null?S:!0)===!0?x:Object.assign(x,uo(S,x));m=ee($({from:l.from},M),{params:C}),g=c(m)}}}return g&&(p.maskedLocation=g),p};return l.mask?u(l,$({from:l.from},l.mask)):u(l)},this.commitLocation=h=>St(this,null,function*(){var m=h,{viewTransition:l,ignoreBlocker:c}=m,u=Ie(m,["viewTransition","ignoreBlocker"]);var b,_,S,M;const p=()=>{const C=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];C.forEach(L=>{u.state[L]=this.latestLocation.state[L]});const k=ol(u.state,this.latestLocation.state);return C.forEach(L=>{delete u.state[L]}),k},g=lr(this.latestLocation.href)===lr(u.href),v=this.commitLocationPromise;if(this.commitLocationPromise=Pc(()=>{v==null||v.resolve()}),g&&p())this.load();else{let x=u,{maskedLocation:C,hashScrollIntoView:k}=x,L=Ie(x,["maskedLocation","hashScrollIntoView"]);C&&(L=ee($({},C),{state:ee($({},C.state),{__tempKey:void 0,__tempLocation:ee($({},L),{search:L.searchStr,state:ee($({},L.state),{__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0})})})}),(_=(b=L.unmaskOnReload)!=null?b:this.options.unmaskOnReload)!=null&&_&&(L.state.__tempKey=this.tempLocationKey)),L.state.__hashScrollIntoViewOptions=(S=k!=null?k:this.options.defaultHashScrollIntoView)!=null?S:!0,this.shouldViewTransition=l,this.history[u.replace?"replace":"push"](L.publicHref,L.state,{ignoreBlocker:c})}return this.resetNextScroll=(M=u.resetScroll)!=null?M:!0,this.history.subscribers.size||this.load(),this.commitLocationPromise}),this.buildAndCommitLocation=(v={})=>{var x=v,{replace:l,resetScroll:c,hashScrollIntoView:u,viewTransition:h,ignoreBlocker:m,href:p}=x,g=Ie(x,["replace","resetScroll","hashScrollIntoView","viewTransition","ignoreBlocker","href"]);if(p){const S=this.history.location.state.__TSR_index,M=Md(p,{__TSR_index:l?S:S+1}),C=new URL(M.pathname,this.origin),k=pv(this.rewrite,C);g.to=k.pathname,g.search=this.options.parseSearch(M.search),g.hash=M.hash.slice(1)}const b=this.buildLocation(ee($({},g),{_includeValidateSearch:!0}));this.pendingBuiltLocation=b;const _=this.commitLocation(ee($({},b),{viewTransition:h,replace:l,resetScroll:c,hashScrollIntoView:u,ignoreBlocker:m}));return Promise.resolve().then(()=>{this.pendingBuiltLocation===b&&(this.pendingBuiltLocation=void 0)}),_},this.navigate=p=>St(this,null,function*(){var g=p,{to:l,reloadDocument:c,href:u,publicHref:h}=g,m=Ie(g,["to","reloadDocument","href","publicHref"]);var x,b;let v=!1;if(u)try{new URL(`${u}`),v=!0}catch(_){}if(v&&!c&&(c=!0),c){if(l!==void 0||!u){const S=this.buildLocation($({to:l},m));u=u!=null?u:S.publicHref,h=h!=null?h:S.publicHref}const _=!v&&h?h:u;if(np(_))return Promise.resolve();if(!m.ignoreBlocker){const S=this.history,M=(b=(x=S.getBlockers)==null?void 0:x.call(S))!=null?b:[];for(const C of M)if(C!=null&&C.blockerFn&&(yield C.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"})))return Promise.resolve()}return m.replace?window.location.replace(_):window.location.href=_,Promise.resolve()}return this.buildAndCommitLocation(ee($({},m),{href:u,to:l,_isNavigate:!0}))}),this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const l=this.matchRoutes(this.latestLocation);this.__store.setState(c=>ee($({},c),{status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:l,cachedMatches:c.cachedMatches.filter(u=>!l.some(h=>h.id===u.id))}))},this.load=l=>St(this,null,function*(){let c,u,h;for(h=new Promise(p=>{this.startTransition(()=>St(this,null,function*(){var g;try{this.beforeLoad();const v=this.latestLocation,x=this.state.resolvedLocation;this.state.redirect||this.emit($({type:"onBeforeNavigate"},ll({resolvedLocation:x,location:v}))),this.emit($({type:"onBeforeLoad"},ll({resolvedLocation:x,location:v}))),yield dw({router:this,sync:l==null?void 0:l.sync,matches:this.state.pendingMatches,location:v,updateMatch:this.updateMatch,onReady:()=>St(this,null,function*(){this.startTransition(()=>{this.startViewTransition(()=>St(this,null,function*(){let b=[],_=[],S=[];_d(()=>{this.__store.setState(M=>{const C=M.matches,k=M.pendingMatches||M.matches;return b=C.filter(L=>!k.some(E=>E.id===L.id)),_=k.filter(L=>!C.some(E=>E.id===L.id)),S=k.filter(L=>C.some(E=>E.id===L.id)),ee($({},M),{isLoading:!1,loadedAt:Date.now(),matches:k,pendingMatches:void 0,cachedMatches:[...M.cachedMatches,...b.filter(L=>L.status!=="error"&&L.status!=="notFound")]})}),this.clearExpiredCache()}),[[b,"onLeave"],[_,"onEnter"],[S,"onStay"]].forEach(([M,C])=>{M.forEach(k=>{var L,E;(E=(L=this.looseRoutesById[k.routeId].options)[C])==null||E.call(L,k)})})}))})})})}catch(v){Zs(v)?(c=v,this.navigate(ee($({},c.options),{replace:!0,ignoreBlocker:!0}))):js(v)&&(u=v),this.__store.setState(x=>ee($({},x),{statusCode:c?c.status:u?404:x.matches.some(b=>b.status==="error")?500:200,redirect:c}))}this.latestLoadPromise===h&&((g=this.commitLocationPromise)==null||g.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),p()}))}),this.latestLoadPromise=h,yield h;this.latestLoadPromise&&h!==this.latestLoadPromise;)yield this.latestLoadPromise;let m;this.hasNotFoundMatch()?m=404:this.__store.state.matches.some(p=>p.status==="error")&&(m=500),m!==void 0&&this.__store.setState(p=>ee($({},p),{statusCode:m}))}),this.startViewTransition=l=>{var u;const c=(u=this.shouldViewTransition)!=null?u:this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,c&&typeof document!="undefined"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let h;if(typeof c=="object"&&this.isViewTransitionTypesSupported){const m=this.latestLocation,p=this.state.resolvedLocation,g=typeof c.types=="function"?c.types(ll({resolvedLocation:p,location:m})):c.types;if(g===!1){l();return}h={update:l,types:g}}else h=l;document.startViewTransition(h)}else l()},this.updateMatch=(l,c)=>{this.startTransition(()=>{var h;const u=(h=this.state.pendingMatches)!=null&&h.some(m=>m.id===l)?"pendingMatches":this.state.matches.some(m=>m.id===l)?"matches":this.state.cachedMatches.some(m=>m.id===l)?"cachedMatches":"";u&&this.__store.setState(m=>{var p;return ee($({},m),{[u]:(p=m[u])==null?void 0:p.map(g=>g.id===l?c(g):g)})})})},this.getMatch=l=>{var u,h,m;const c=p=>p.id===l;return(m=(h=this.state.cachedMatches.find(c))!=null?h:(u=this.state.pendingMatches)==null?void 0:u.find(c))!=null?m:this.state.matches.find(c)},this.invalidate=l=>{const c=u=>{var h,m;return(m=(h=l==null?void 0:l.filter)==null?void 0:h.call(l,u))==null||m?$(ee($({},u),{invalid:!0}),l!=null&&l.forcePending||u.status==="error"||u.status==="notFound"?{status:"pending",error:void 0}:void 0):u};return this.__store.setState(u=>{var h;return ee($({},u),{matches:u.matches.map(c),cachedMatches:u.cachedMatches.map(c),pendingMatches:(h=u.pendingMatches)==null?void 0:h.map(c)})}),this.shouldViewTransition=!1,this.load({sync:l==null?void 0:l.sync})},this.getParsedLocationHref=l=>l.publicHref||"/",this.resolveRedirect=l=>{var u;const c=l.headers.get("Location");if(!l.options.href||l.options._builtLocation){const h=(u=l.options._builtLocation)!=null?u:this.buildLocation(l.options),m=this.getParsedLocationHref(h);l.options.href=m,l.headers.set("Location",m)}else if(c)try{const h=new URL(c);if(this.origin&&h.origin===this.origin){const m=h.pathname+h.search+h.hash;l.options.href=m,l.headers.set("Location",m)}}catch(h){}return l.headers.get("Location")||l.headers.set("Location",l.options.href),l},this.clearCache=l=>{const c=l==null?void 0:l.filter;c!==void 0?this.__store.setState(u=>ee($({},u),{cachedMatches:u.cachedMatches.filter(h=>!c(h))})):this.__store.setState(u=>ee($({},u),{cachedMatches:[]}))},this.clearExpiredCache=()=>{const l=c=>{var g,v,x;const u=this.looseRoutesById[c.routeId];if(!u.options.loader)return!0;const h=(x=c.preload?(g=u.options.preloadGcTime)!=null?g:this.options.defaultPreloadGcTime:(v=u.options.gcTime)!=null?v:this.options.defaultGcTime)!=null?x:300*1e3;return c.status==="error"?!0:Date.now()-c.updatedAt>=h};this.clearCache({filter:l})},this.loadRouteChunk=QN,this.preloadRoute=l=>St(this,null,function*(){var p;const c=this.buildLocation(l);let u=this.matchRoutes(c,{throwOnError:!0,preload:!0,dest:l});const h=new Set([...this.state.matches,...(p=this.state.pendingMatches)!=null?p:[]].map(g=>g.id)),m=new Set([...h,...this.state.cachedMatches.map(g=>g.id)]);_d(()=>{u.forEach(g=>{m.has(g.id)||this.__store.setState(v=>ee($({},v),{cachedMatches:[...v.cachedMatches,g]}))})});try{return u=yield dw({router:this,matches:u,location:c,preload:!0,updateMatch:(g,v)=>{h.has(g)?u=u.map(x=>x.id===g?v(x):x):this.updateMatch(g,v)}}),u}catch(g){if(Zs(g))return g.options.reloadDocument?void 0:yield this.preloadRoute(ee($({},g.options),{_fromLocation:c}));js(g)||console.error(g);return}}),this.matchRoute=(l,c)=>{var v,x,b;const u=ee($({},l),{to:l.to?this.resolvePathWithBase(l.from||"",l.to):void 0,params:l.params||{},leaveParams:!0}),h=this.buildLocation(u);if(c!=null&&c.pending&&this.state.status!=="pending")return!1;const p=((c==null?void 0:c.pending)===void 0?!this.state.isLoading:c.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,g=IR(h.pathname,(v=c==null?void 0:c.caseSensitive)!=null?v:!1,(x=c==null?void 0:c.fuzzy)!=null?x:!1,p.pathname,this.processedTree);return!g||l.params&&!ol(g.rawParams,l.params,{partial:!0})?!1:(b=c==null?void 0:c.includeSearch)==null||b?ol(p.search,h.search,{partial:!0})?g.rawParams:!1:g.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(l=>l.status==="notFound"||l.globalNotFound),this.update(ee($({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0},t),{caseSensitive:(n=t.caseSensitive)!=null?n:!1,notFoundMode:(a=t.notFoundMode)!=null?a:"fuzzy",stringifySearch:(i=t.stringifySearch)!=null?i:tL,parseSearch:(r=t.parseSearch)!=null?r:eL})),typeof document!="undefined"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:t,routesByPath:n,processedTree:a}){this.routesById=t,this.routesByPath=n,this.processedTree=a;const i=this.options.notFoundRoute;i&&(i.init({originalIndex:99999999999}),this.routesById[i.id]=i)}get looseRoutesById(){return this.routesById}getParentContext(t){var i,r,l;return(t==null?void 0:t.id)?(l=(r=t.context)!=null?r:this.options.context)!=null?l:void 0:(i=this.options.context)!=null?i:void 0}matchRoutesInternal(t,n){var g,v,x,b,_,S,M,C,k,L;const a=this.getMatchedRoutes(t.pathname),{foundRoute:i,routeParams:r,parsedParams:l}=a;let{matchedRoutes:c}=a,u=!1;(i?i.path!=="/"&&r["**"]:lr(t.pathname))&&(this.options.notFoundRoute?c=[...c,this.options.notFoundRoute]:u=!0);const h=u?vL(this.options.notFoundMode,c):void 0,m=new Array(c.length),p=new Map(this.state.matches.map(E=>[E.routeId,E]));for(let E=0;E<c.length;E++){const I=c[E],T=m[E-1];let A,R,D;{const te=(g=T==null?void 0:T.search)!=null?g:t.search,ie=(v=T==null?void 0:T._strictSearch)!=null?v:void 0;try{const W=(x=Gf(I.options.validateSearch,$({},te)))!=null?x:void 0;A=$($({},te),W),R=$($({},ie),W),D=void 0}catch(W){let ge=W;if(W instanceof rp||(ge=new rp(W.message,{cause:W})),n!=null&&n.throwOnError)throw ge;A=te,R={},D=ge}}const O=(S=(_=(b=I.options).loaderDeps)==null?void 0:_.call(b,{search:A}))!=null?S:"",B=O?JSON.stringify(O):"",{interpolatedPath:z,usedParams:U}=iy({path:I.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),F=I.id+z+B,Y=this.getMatch(F),X=p.get(I.id),ne=(M=Y==null?void 0:Y._strictParams)!=null?M:U;let q;if(!Y)try{hw(I,U,l,ne)}catch(te){if(js(te)||Zs(te)?q=te:q=new fL(te.message,{cause:te}),n!=null&&n.throwOnError)throw q}Object.assign(r,ne);const he=X?"stay":"enter";let pe;if(Y)pe=ee($({},Y),{cause:he,params:(C=X==null?void 0:X.params)!=null?C:r,_strictParams:ne,search:Ms(X?X.search:Y.search,A),_strictSearch:R});else{const te=I.options.loader||I.options.beforeLoad||I.lazyFn||XN(I)?"pending":"success";pe={id:F,ssr:I.options.ssr,index:E,routeId:I.id,params:(k=X==null?void 0:X.params)!=null?k:r,_strictParams:ne,pathname:z,updatedAt:Date.now(),search:X?Ms(X.search,A):A,_strictSearch:R,searchError:void 0,status:te,isFetching:!1,error:void 0,paramsError:q,__routeContext:void 0,_nonReactive:{loadPromise:Pc()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:he,loaderDeps:X?Ms(X.loaderDeps,O):O,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:I.options.staticData||{},fullPath:I.fullPath}}n!=null&&n.preload||(pe.globalNotFound=h===I.id),pe.searchError=D;const H=this.getParentContext(T);pe.context=$($($({},H),pe.__routeContext),pe.__beforeLoadContext),m[E]=pe}for(let E=0;E<m.length;E++){const I=m[E],T=this.looseRoutesById[I.routeId],A=this.getMatch(I.id),R=p.get(I.routeId);if(I.params=R?Ms(R.params,r):r,!A){const D=m[E-1],O=this.getParentContext(D);if(T.options.context){const B={deps:I.loaderDeps,params:I.params,context:O!=null?O:{},location:t,navigate:z=>this.navigate(ee($({},z),{_fromLocation:t})),buildLocation:this.buildLocation,cause:I.cause,abortController:I.abortController,preload:!!I.preload,matches:m,routeId:T.id};I.__routeContext=(L=T.options.context(B))!=null?L:void 0}I.context=$($($({},O),I.__routeContext),I.__beforeLoadContext)}}return m}matchRoutesLightweight(t){const{matchedRoutes:n,routeParams:a,parsedParams:i}=this.getMatchedRoutes(t.pathname),r=jd(n),l=$({},t.search);for(const m of n)try{Object.assign(l,Gf(m.options.validateSearch,l))}catch(p){}const c=jd(this.state.matches),u=c&&c.routeId===r.id&&t.pathname===this.state.location.pathname;let h;if(u)h=c.params;else{const m=$({},a);for(const p of n)try{hw(p,a,i!=null?i:{},m)}catch(g){}h=m}return{matchedRoutes:n,fullPath:r.fullPath,search:l,params:h}}}class rp extends Error{}class fL extends Error{}function pL(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Gf(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new rp("Async validation not supported");if(n.issues)throw new rp(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function mL({pathname:e,routesById:t,processedTree:n}){const a={},i=lr(e);let r,l;const c=DR(i,n,!0);return c&&(r=c.route,Object.assign(a,c.rawParams),l=Object.assign({},c.parsedParams)),{matchedRoutes:(c==null?void 0:c.branch)||[t[Ks]],routeParams:a,foundRoute:r,parsedParams:l}}function gL({search:e,dest:t,destRoutes:n,_includeValidateSearch:a}){return yL(n)(e,t,a!=null?a:!1)}function yL(e){var i;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const r of e){if("search"in r.options)(i=r.options.search)!=null&&i.middlewares&&t.middlewares.push(...r.options.search.middlewares);else if(r.options.preSearchFilters||r.options.postSearchFilters){const l=({search:c,next:u})=>{let h=c;"preSearchFilters"in r.options&&r.options.preSearchFilters&&(h=r.options.preSearchFilters.reduce((p,g)=>g(p),c));const m=u(h);return"postSearchFilters"in r.options&&r.options.postSearchFilters?r.options.postSearchFilters.reduce((p,g)=>g(p),m):m};t.middlewares.push(l)}if(r.options.validateSearch){const l=({search:c,next:u})=>{var m;const h=u(c);if(!t._includeValidateSearch)return h;try{return $($({},h),(m=Gf(r.options.validateSearch,h))!=null?m:void 0)}catch(p){return h}};t.middlewares.push(l)}}const n=({search:r})=>{const l=t.dest;return l.search?l.search===!0?r:uo(l.search,r):{}};t.middlewares.push(n);const a=(r,l,c)=>{if(r>=c.length)return l;const u=c[r];return u({search:l,next:m=>a(r+1,m,c)})};return function(l,c,u){return t.dest=c,t._includeValidateSearch=u,a(0,l,t.middlewares)}}function vL(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const a=t[n];if(a.children)return a.id}return Ks}function hw(e,t,n,a){var r,l;const i=(l=(r=e.options.params)==null?void 0:r.parse)!=null?l:e.options.parseParams;if(i)if(e.options.skipRouteOnParseError)for(const c in t)c in n&&(a[c]=n[c]);else{const c=i(a);Object.assign(a,c)}}const xL="Error preloading route! ☝️";class WN{constructor(t){if(this.init=n=>{var h,m;this.originalIndex=n.originalIndex;const a=this.options,i=!(a!=null&&a.path)&&!(a!=null&&a.id);this.parentRoute=(m=(h=this.options).getParentRoute)==null?void 0:m.call(h),i?this._path=Ks:this.parentRoute||dr(!1);let r=i?Ks:a==null?void 0:a.path;r&&r!=="/"&&(r=HN(r));const l=(a==null?void 0:a.id)||r;let c=i?Ks:Vf([this.parentRoute.id===Ks?"":this.parentRoute.id,l]);r===Ks&&(r="/"),c!==Ks&&(c=Vf(["/",c]));const u=c===Ks?"/":Vf([this.parentRoute.fullPath,r]);this._path=r,this._id=c,this._fullPath=u,this._to=lr(u)},this.addChildren=n=>this._addFileChildren(n),this._addFileChildren=n=>(Array.isArray(n)&&(this.children=n),typeof n=="object"&&n!==null&&(this.children=Object.values(n)),this),this._addFileTypes=()=>this,this.updateLoader=n=>(Object.assign(this.options,n),this),this.update=n=>(Object.assign(this.options,n),this),this.lazy=n=>(this.lazyFn=n,this),this.redirect=n=>sL($({from:this.fullPath},n)),this.options=t||{},this.isRoot=!(t!=null&&t.getParentRoute),t!=null&&t.id&&(t!=null&&t.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class bL extends WN{constructor(t){super(t)}}const vf=typeof window!="undefined"?j.useLayoutEffect:j.useEffect;function oy(e){const t=j.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function _L(e,t,n={},a={}){j.useEffect(()=>{if(!e.current||a.disabled||typeof IntersectionObserver!="function")return;const i=new IntersectionObserver(([r])=>{t(r)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,a.disabled,e])}function wL(e){const t=j.useRef(null);return j.useImperativeHandle(e,()=>t.current,[]),t}function jx(e){var n;const t=(n=e.errorComponent)!=null?n:Ex;return f.jsx(SL,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:a,reset:i})=>a?j.createElement(t,{error:a,reset:i}):e.children})}class SL extends j.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,n){n.error&&n.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,n){this.props.onCatch&&this.props.onCatch(t,n)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Ex({error:e}){const[t,n]=j.useState(!1);return f.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[f.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),f.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(a=>!a),children:t?"Hide Error":"Show Error"})]}),f.jsx("div",{style:{height:".25rem"}}),t?f.jsx("div",{children:f.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?f.jsx("code",{children:e.message}):null})}):null]})}function NL({children:e,fallback:t=null}){return ek()?f.jsx(Se.Fragment,{children:e}):f.jsx(Se.Fragment,{children:t})}function ek(){return Se.useSyncExternalStore(kL,()=>!0,()=>!1)}function kL(){return()=>{}}var ly={exports:{}},cy={},uy={exports:{}},dy={};/**
|
|
34
|
+
* @license React
|
|
35
|
+
* use-sync-external-store-shim.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var fw;function CL(){if(fw)return dy;fw=1;var e=Sx();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var n=typeof Object.is=="function"?Object.is:t,a=e.useState,i=e.useEffect,r=e.useLayoutEffect,l=e.useDebugValue;function c(p,g){var v=g(),x=a({inst:{value:v,getSnapshot:g}}),b=x[0].inst,_=x[1];return r(function(){b.value=v,b.getSnapshot=g,u(b)&&_({inst:b})},[p,v,g]),i(function(){return u(b)&&_({inst:b}),p(function(){u(b)&&_({inst:b})})},[p]),l(v),v}function u(p){var g=p.getSnapshot;p=p.value;try{var v=g();return!n(p,v)}catch(x){return!0}}function h(p,g){return g()}var m=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?h:c;return dy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,dy}var pw;function ML(){return pw||(pw=1,uy.exports=CL()),uy.exports}/**
|
|
42
|
+
* @license React
|
|
43
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
44
|
+
*
|
|
45
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
46
|
+
*
|
|
47
|
+
* This source code is licensed under the MIT license found in the
|
|
48
|
+
* LICENSE file in the root directory of this source tree.
|
|
49
|
+
*/var mw;function jL(){if(mw)return cy;mw=1;var e=Sx(),t=ML();function n(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var a=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,r=e.useRef,l=e.useEffect,c=e.useMemo,u=e.useDebugValue;return cy.useSyncExternalStoreWithSelector=function(h,m,p,g,v){var x=r(null);if(x.current===null){var b={hasValue:!1,value:null};x.current=b}else b=x.current;x=c(function(){function S(E){if(!M){if(M=!0,C=E,E=g(E),v!==void 0&&b.hasValue){var I=b.value;if(v(I,E))return k=I}return k=E}if(I=k,a(C,E))return I;var T=g(E);return v!==void 0&&v(I,T)?(C=E,I):(C=E,k=T)}var M=!1,C,k,L=p===void 0?null:p;return[function(){return S(m())},L===null?void 0:function(){return S(L())}]},[m,p,g,v]);var _=i(h,x[0],x[1]);return l(function(){b.hasValue=!0,b.value=_},[_]),u(_),_},cy}var gw;function EL(){return gw||(gw=1,ly.exports=jL()),ly.exports}var RL=EL();function LL(e,t=a=>a,n={}){var r;const a=(r=n.equal)!=null?r:TL;return RL.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,a)}function TL(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[a,i]of e)if(!t.has(a)||!Object.is(i,t.get(a)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const a of e)if(!t.has(a))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=yw(e);if(n.length!==yw(t).length)return!1;for(let a=0;a<n.length;a++)if(!Object.prototype.hasOwnProperty.call(t,n[a])||!Object.is(e[n[a]],t[n[a]]))return!1;return!0}function yw(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const hy=j.createContext(null);function tk(){return typeof document=="undefined"?hy:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=hy,hy)}function ei(e){var n;const t=j.useContext(tk());return(n=e==null?void 0:e.warn)==null,t}function Ws(e){const t=ei({warn:(e==null?void 0:e.router)===void 0}),n=(e==null?void 0:e.router)||t,a=j.useRef(void 0);return LL(n.__store,i=>{var r;if(e!=null&&e.select){if((r=e.structuralSharing)!=null?r:n.options.defaultStructuralSharing){const l=Ms(a.current,e.select(i));return a.current=l,l}return e.select(i)}return i})}const Lp=j.createContext(void 0),AL=j.createContext(void 0);function Ei(e){const t=j.useContext(e.from?AL:Lp);return Ws({select:a=>{var r;const i=a.matches.find(l=>e.from?e.from===l.routeId:l.id===t);if(dr(!(((r=e.shouldThrow)==null||r)&&!i),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),i!==void 0)return e.select?e.select(i):i},structuralSharing:e.structuralSharing})}function Rx(e){return Ei({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Lx(e){const a=e,{select:t}=a,n=Ie(a,["select"]);return Ei(ee($({},n),{select:i=>t?t(i.loaderDeps):i.loaderDeps}))}function Tp(e){return Ei({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Kd(e){return Ei({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Tx(e){const t=ei();return j.useCallback(n=>{var a;return t.navigate(ee($({},n),{from:(a=n.from)!=null?a:e==null?void 0:e.from}))},[e==null?void 0:e.from,t])}var nk=ON();function IL(e,t){var le,xe,Pe;const n=ei(),a=wL(t),se=e,{activeProps:i,inactiveProps:r,activeOptions:l,to:c,preload:u,preloadDelay:h,hashScrollIntoView:m,replace:p,startTransition:g,resetScroll:v,viewTransition:x,children:b,target:_,disabled:S,style:M,className:C,onClick:k,onFocus:L,onMouseEnter:E,onMouseLeave:I,onTouchStart:T,ignoreBlocker:A,params:R,search:D,hash:O,state:B,mask:z,reloadDocument:U,unsafeRelative:F,from:Y,_fromLocation:X}=se,ne=Ie(se,["activeProps","inactiveProps","activeOptions","to","preload","preloadDelay","hashScrollIntoView","replace","startTransition","resetScroll","viewTransition","children","target","disabled","style","className","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","ignoreBlocker","params","search","hash","state","mask","reloadDocument","unsafeRelative","from","_fromLocation"]),q=ek(),he=Ws({select:$e=>$e.location.search,structuralSharing:!0}),pe=e.from,H=j.useMemo(()=>ee($({},e),{from:pe}),[n,he,pe,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),te=j.useMemo(()=>n.buildLocation($({},H)),[n,H]),ie=te.maskedLocation?te.maskedLocation.publicHref:te.publicHref,W=te.maskedLocation?te.maskedLocation.external:te.external,ge=j.useMemo(()=>UL(ie,W,n.history,S),[S,W,ie,n.history]),we=j.useMemo(()=>{if(ge!=null&&ge.external)return np(ge.href)?void 0:ge.href;if(!FL(c)&&!(typeof c!="string"||c.indexOf(":")===-1))try{return new URL(c),np(c)?void 0:c}catch(Be){}},[c,ge]),je=Ws({select:$e=>{var Be;if(we)return!1;if(l!=null&&l.exact){if(!FR($e.location.pathname,te.pathname,n.basepath))return!1}else{const at=sp($e.location.pathname,n.basepath),ot=sp(te.pathname,n.basepath);if(!(at.startsWith(ot)&&(at.length===ot.length||at[ot.length]==="/")))return!1}return((Be=l==null?void 0:l.includeSearch)==null||Be)&&!ol($e.location.search,te.search,{partial:!(l!=null&&l.exact),ignoreUndefined:!(l!=null&&l.explicitUndefined)})?!1:l!=null&&l.includeHash?q&&$e.location.hash===te.hash:!0}}),De=je?(le=uo(i,{}))!=null?le:DL:fy,re=je?fy:(xe=uo(r,{}))!=null?xe:fy,Z=[C,De.className,re.className].filter(Boolean).join(" "),J=(M||De.style||re.style)&&$($($({},M),De.style),re.style),[K,Q]=j.useState(!1),ae=j.useRef(!1),ye=e.reloadDocument||we?!1:u!=null?u:n.options.defaultPreload,Ae=(Pe=h!=null?h:n.options.defaultPreloadDelay)!=null?Pe:0,de=j.useCallback(()=>{n.preloadRoute($({},H)).catch($e=>{console.warn($e),console.warn(xL)})},[n,H]),Je=j.useCallback($e=>{$e!=null&&$e.isIntersecting&&de()},[de]);_L(a,Je,$L,{disabled:!!S||ye!=="viewport"}),j.useEffect(()=>{ae.current||!S&&ye==="render"&&(de(),ae.current=!0)},[S,de,ye]);const Ge=$e=>{const Be=$e.currentTarget.getAttribute("target"),at=_!==void 0?_:Be;if(!S&&!PL($e)&&!$e.defaultPrevented&&(!at||at==="_self")&&$e.button===0){$e.preventDefault(),nk.flushSync(()=>{Q(!0)});const ot=n.subscribe("onResolved",()=>{ot(),Q(!1)});n.navigate(ee($({},H),{replace:p,resetScroll:v,hashScrollIntoView:m,startTransition:g,viewTransition:x,ignoreBlocker:A}))}};if(we)return $($($($($($($($($($(ee($({},ne),{ref:a,href:we}),b&&{children:b}),_&&{target:_}),S&&{disabled:S}),M&&{style:M}),C&&{className:C}),k&&{onClick:k}),L&&{onFocus:L}),E&&{onMouseEnter:E}),I&&{onMouseLeave:I}),T&&{onTouchStart:T});const be=$e=>{S||ye&&de()},Fe=be,me=$e=>{if(!(S||!ye))if(!Ae)de();else{const Be=$e.target;if(sd.has(Be))return;const at=setTimeout(()=>{sd.delete(Be),de()},Ae);sd.set(Be,at)}},Ee=$e=>{if(S||!ye||!Ae)return;const Be=$e.target,at=sd.get(Be);at&&(clearTimeout(at),sd.delete(Be))};return $($($($($(ee($($($({},ne),De),re),{href:ge==null?void 0:ge.href,ref:a,onClick:id([k,Ge]),onFocus:id([L,be]),onMouseEnter:id([E,me]),onMouseLeave:id([I,Ee]),onTouchStart:id([T,Fe]),disabled:!!S,target:_}),J&&{style:J}),Z&&{className:Z}),S&&OL),je&&zL),q&&K&&BL)}const fy={},DL={className:"active"},OL={role:"link","aria-disabled":!0},zL={"data-status":"active","aria-current":"page"},BL={"data-transitioning":"transitioning"},sd=new WeakMap,$L={rootMargin:"100px"},id=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function UL(e,t,n,a){if(!a)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function FL(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}const ak=j.forwardRef((e,t)=>{const c=e,{_asChild:n}=c,a=Ie(c,["_asChild"]),u=IL(a,t),{type:i}=u,r=Ie(u,["type"]),l=typeof a.children=="function"?a.children({isActive:r["data-status"]==="active"}):a.children;if(!n){const h=r,{disabled:m}=h,p=Ie(h,["disabled"]);return j.createElement("a",p,l)}return j.createElement(n,r,l)});function PL(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}class HL extends WN{constructor(t){super(t),this.useMatch=n=>Ei({select:n==null?void 0:n.select,from:this.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>Ei(ee($({},n),{from:this.id,select:a=>n!=null&&n.select?n.select(a.context):a.context})),this.useSearch=n=>Kd({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useParams=n=>Tp({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useLoaderDeps=n=>Lx(ee($({},n),{from:this.id})),this.useLoaderData=n=>Rx(ee($({},n),{from:this.id})),this.useNavigate=()=>Tx({from:this.fullPath}),this.Link=Se.forwardRef((n,a)=>f.jsx(ak,$({ref:a,from:this.fullPath},n))),this.$$typeof=Symbol.for("react.memo")}}function Ax(e){return new HL(e)}class qL extends bL{constructor(t){super(t),this.useMatch=n=>Ei({select:n==null?void 0:n.select,from:this.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>Ei(ee($({},n),{from:this.id,select:a=>n!=null&&n.select?n.select(a.context):a.context})),this.useSearch=n=>Kd({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useParams=n=>Tp({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useLoaderDeps=n=>Lx(ee($({},n),{from:this.id})),this.useLoaderData=n=>Rx(ee($({},n),{from:this.id})),this.useNavigate=()=>Tx({from:this.fullPath}),this.Link=Se.forwardRef((n,a)=>f.jsx(ak,$({ref:a,from:this.fullPath},n))),this.$$typeof=Symbol.for("react.memo")}}function VL(e){return new qL(e)}function vw(e){return typeof e=="object"?new xw(e,{silent:!0}).createRoute(e):new xw(e,{silent:!0}).createRoute}class xw{constructor(t,n){this.path=t,this.createRoute=a=>{this.silent;const i=Ax(a);return i.isRoot=!1,i},this.silent=n==null?void 0:n.silent}}class bw{constructor(t){this.useMatch=n=>Ei({select:n==null?void 0:n.select,from:this.options.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>Ei({from:this.options.id,select:a=>n!=null&&n.select?n.select(a.context):a.context}),this.useSearch=n=>Kd({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.options.id}),this.useParams=n=>Tp({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.options.id}),this.useLoaderDeps=n=>Lx(ee($({},n),{from:this.options.id})),this.useLoaderData=n=>Rx(ee($({},n),{from:this.options.id})),this.useNavigate=()=>{const n=ei();return Tx({from:n.routesById[this.options.id].fullPath})},this.options=t,this.$$typeof=Symbol.for("react.memo")}}function _w(e){return typeof e=="object"?new bw(e):t=>new bw($({id:e},t))}function YL(){const e=ei(),t=j.useRef({router:e,mounted:!1}),[n,a]=j.useState(!1),{hasPendingMatches:i,isLoading:r}=Ws({select:p=>({isLoading:p.isLoading,hasPendingMatches:p.matches.some(g=>g.status==="pending")}),structuralSharing:!0}),l=oy(r),c=r||n||i,u=oy(c),h=r||i,m=oy(h);return e.startTransition=p=>{a(!0),j.startTransition(()=>{p(),a(!1)})},j.useEffect(()=>{const p=e.history.subscribe(e.load),g=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return lr(e.latestLocation.publicHref)!==lr(g.publicHref)&&e.commitLocation(ee($({},g),{replace:!0})),()=>{p()}},[e,e.history]),vf(()=>{if(typeof window!="undefined"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},St(null,null,function*(){try{yield e.load()}catch(g){console.error(g)}})},[e]),vf(()=>{l&&!r&&e.emit($({type:"onLoad"},ll(e.state)))},[l,e,r]),vf(()=>{m&&!h&&e.emit($({type:"onBeforeRouteMount"},ll(e.state)))},[h,m,e]),vf(()=>{if(u&&!c){const p=ll(e.state);e.emit($({type:"onResolved"},p)),e.__store.setState(g=>ee($({},g),{status:"idle",resolvedLocation:g.location})),p.hrefChanged&&ZR(e)}},[c,u,e]),null}function GL(e){const t=Ws({select:n=>`not-found-${n.location.pathname}-${n.status}`});return f.jsx(jx,{getResetKey:()=>t,onCatch:(n,a)=>{var i;if(js(n))(i=e.onCatch)==null||i.call(e,n,a);else throw n},errorComponent:({error:n})=>{var a;if(js(n))return(a=e.fallback)==null?void 0:a.call(e,n);throw n},children:e.children})}function KL(){return f.jsx("p",{children:"Not Found"})}function _c(e){return f.jsx(f.Fragment,{children:e.children})}function sk(e,t,n){return t.options.notFoundComponent?f.jsx(t.options.notFoundComponent,$({},n)):e.options.defaultNotFoundComponent?f.jsx(e.options.defaultNotFoundComponent,$({},n)):f.jsx(KL,{})}function QL(){return ei().isScrollRestoring,null}const ik=j.memo(function({matchId:t}){var b,_,S,M,C,k,L,E,I;const n=ei(),a=Ws({select:T=>{var D;const A=T.matches.findIndex(O=>O.id===t),R=T.matches[A];return dr(R),{routeId:R.routeId,ssr:R.ssr,_displayPending:R._displayPending,resetKey:T.loadedAt,parentRouteId:(D=T.matches[A-1])==null?void 0:D.routeId}},structuralSharing:!0}),i=n.routesById[a.routeId],r=(b=i.options.pendingComponent)!=null?b:n.options.defaultPendingComponent,l=r?f.jsx(r,{}):null,c=(_=i.options.errorComponent)!=null?_:n.options.defaultErrorComponent,u=(S=i.options.onCatch)!=null?S:n.options.defaultOnCatch,h=i.isRoot?(C=i.options.notFoundComponent)!=null?C:(M=n.options.notFoundRoute)==null?void 0:M.options.component:i.options.notFoundComponent,m=a.ssr===!1||a.ssr==="data-only",p=(!i.isRoot||i.options.wrapInSuspense||m)&&((E=(k=i.options.wrapInSuspense)!=null?k:r)!=null?E:(L=i.options.errorComponent)!=null&&L.preload||m)?j.Suspense:_c,g=c?jx:_c,v=h?GL:_c,x=i.isRoot&&(I=i.options.shellComponent)!=null?I:_c;return f.jsxs(x,{children:[f.jsx(Lp.Provider,{value:t,children:f.jsx(p,{fallback:l,children:f.jsx(g,{getResetKey:()=>a.resetKey,errorComponent:c||Ex,onCatch:(T,A)=>{if(js(T))throw T;u==null||u(T,A)},children:f.jsx(v,{fallback:T=>{if(!h||T.routeId&&T.routeId!==a.routeId||!T.routeId&&!i.isRoot)throw T;return j.createElement(h,T)},children:m||a._displayPending?f.jsx(NL,{fallback:l,children:f.jsx(ww,{matchId:t})}):f.jsx(ww,{matchId:t})})})})}),a.parentRouteId===Ks&&n.options.scrollRestoration?f.jsxs(f.Fragment,{children:[f.jsx(XL,{}),f.jsx(QL,{})]}):null]})});function XL(){const e=ei(),t=j.useRef(void 0);return f.jsx("script",{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit($({type:"onRendered"},ll(e.state))),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const ww=j.memo(function({matchId:t}){var u,h,m,p,g;const n=ei(),{match:a,key:i,routeId:r}=Ws({select:v=>{var C;const x=v.matches.find(k=>k.id===t),b=x.routeId,_=(C=n.routesById[b].options.remountDeps)!=null?C:n.options.defaultRemountDeps,S=_==null?void 0:_({routeId:b,loaderDeps:x.loaderDeps,params:x._strictParams,search:x._strictSearch});return{key:S?JSON.stringify(S):void 0,routeId:b,match:{id:x.id,status:x.status,error:x.error,invalid:x.invalid,_forcePending:x._forcePending,_displayPending:x._displayPending}}},structuralSharing:!0}),l=n.routesById[r],c=j.useMemo(()=>{var x;const v=(x=l.options.component)!=null?x:n.options.defaultComponent;return v?f.jsx(v,{},i):f.jsx(rk,{})},[i,l.options.component,n.options.defaultComponent]);if(a._displayPending)throw(u=n.getMatch(a.id))==null?void 0:u._nonReactive.displayPendingPromise;if(a._forcePending)throw(h=n.getMatch(a.id))==null?void 0:h._nonReactive.minPendingPromise;if(a.status==="pending"){const v=(m=l.options.pendingMinMs)!=null?m:n.options.defaultPendingMinMs;if(v){const x=n.getMatch(a.id);if(x&&!x._nonReactive.minPendingPromise){const b=Pc();x._nonReactive.minPendingPromise=b,setTimeout(()=>{b.resolve(),x._nonReactive.minPendingPromise=void 0},v)}}throw(p=n.getMatch(a.id))==null?void 0:p._nonReactive.loadPromise}if(a.status==="notFound")return dr(js(a.error)),sk(n,l,a.error);if(a.status==="redirected")throw dr(Zs(a.error)),(g=n.getMatch(a.id))==null?void 0:g._nonReactive.loadPromise;if(a.status==="error")throw a.error;return c}),rk=j.memo(function(){const t=ei(),n=j.useContext(Lp),a=Ws({select:h=>{var m;return(m=h.matches.find(p=>p.id===n))==null?void 0:m.routeId}}),i=t.routesById[a],r=Ws({select:h=>{const p=h.matches.find(g=>g.id===n);return dr(p),p.globalNotFound}}),l=Ws({select:h=>{var g;const m=h.matches,p=m.findIndex(v=>v.id===n);return(g=m[p+1])==null?void 0:g.id}}),c=t.options.defaultPendingComponent?f.jsx(t.options.defaultPendingComponent,{}):null;if(r)return sk(t,i,void 0);if(!l)return null;const u=f.jsx(ik,{matchId:l});return a===Ks?f.jsx(j.Suspense,{fallback:c,children:u}):u});function ZL(){var l;const e=ei(),n=(l=e.routesById[Ks].options.pendingComponent)!=null?l:e.options.defaultPendingComponent,a=n?f.jsx(n,{}):null,i=typeof document!="undefined"&&e.ssr?_c:j.Suspense,r=f.jsxs(i,{fallback:a,children:[f.jsx(YL,{}),f.jsx(JL,{})]});return e.options.InnerWrap?f.jsx(e.options.InnerWrap,{children:r}):r}function JL(){const e=ei(),t=Ws({select:i=>{var r;return(r=i.matches[0])==null?void 0:r.id}}),n=Ws({select:i=>i.loadedAt}),a=t?f.jsx(ik,{matchId:t}):null;return f.jsx(Lp.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?a:f.jsx(jx,{getResetKey:()=>n,errorComponent:Ex,onCatch:i=>{i.message||i.toString()},children:a})})}const WL=e=>new eT(e);class eT extends hL{constructor(t){super(t)}}typeof globalThis!="undefined"?(globalThis.createFileRoute=vw,globalThis.createLazyFileRoute=_w):typeof window!="undefined"&&(window.createFileRoute=vw,window.createLazyFileRoute=_w);function tT(a){var i=a,{router:e,children:t}=i,n=Ie(i,["router","children"]);Object.keys(n).length>0&&e.update(ee($($({},e.options),n),{context:$($({},e.options.context),n.context)}));const r=tk(),l=f.jsx(r.Provider,{value:e,children:t});return e.options.Wrap?f.jsx(e.options.Wrap,{children:l}):l}function nT(n){var a=n,{router:e}=a,t=Ie(a,["router"]);return f.jsx(tT,ee($({router:e},t),{children:f.jsx(ZL,{})}))}var Zc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},aT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},to,wx,kN,sT=(kN=class{constructor(){mt(this,to,aT);mt(this,wx,!1)}setTimeoutProvider(e){rt(this,to,e)}setTimeout(e,t){return fe(this,to).setTimeout(e,t)}clearTimeout(e){fe(this,to).clearTimeout(e)}setInterval(e,t){return fe(this,to).setInterval(e,t)}clearInterval(e){fe(this,to).clearInterval(e)}},to=new WeakMap,wx=new WeakMap,kN),Xo=new sT;function iT(e){setTimeout(e,0)}var ml=typeof window=="undefined"||"Deno"in globalThis;function Ka(){}function rT(e,t){return typeof e=="function"?e(t):e}function mv(e){return typeof e=="number"&&e>=0&&e!==1/0}function ok(e,t){return Math.max(e+(t||0)-Date.now(),0)}function mo(e,t){return typeof e=="function"?e(t):e}function Qs(e,t){return typeof e=="function"?e(t):e}function Sw(e,t){const{type:n="all",exact:a,fetchStatus:i,predicate:r,queryKey:l,stale:c}=e;if(l){if(a){if(t.queryHash!==Ix(l,t.options))return!1}else if(!Rd(t.queryKey,l))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||i&&i!==t.state.fetchStatus||r&&!r(t))}function Nw(e,t){const{exact:n,status:a,predicate:i,mutationKey:r}=e;if(r){if(!t.options.mutationKey)return!1;if(n){if(gl(t.options.mutationKey)!==gl(r))return!1}else if(!Rd(t.options.mutationKey,r))return!1}return!(a&&t.state.status!==a||i&&!i(t))}function Ix(e,t){return((t==null?void 0:t.queryKeyHashFn)||gl)(e)}function gl(e){return JSON.stringify(e,(t,n)=>gv(n)?Object.keys(n).sort().reduce((a,i)=>(a[i]=n[i],a),{}):n)}function Rd(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Rd(e[n],t[n])):!1}var oT=Object.prototype.hasOwnProperty;function lk(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=kw(e)&&kw(t);if(!a&&!(gv(e)&&gv(t)))return t;const r=(a?e:Object.keys(e)).length,l=a?t:Object.keys(t),c=l.length,u=a?new Array(c):{};let h=0;for(let m=0;m<c;m++){const p=a?m:l[m],g=e[p],v=t[p];if(g===v){u[p]=g,(a?m<r:oT.call(e,p))&&h++;continue}if(g===null||v===null||typeof g!="object"||typeof v!="object"){u[p]=v;continue}const x=lk(g,v,n+1);u[p]=x,x===g&&h++}return r===c&&h===r?e:u}function op(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function kw(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function gv(e){if(!Cw(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Cw(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Cw(e){return Object.prototype.toString.call(e)==="[object Object]"}function lT(e){return new Promise(t=>{Xo.setTimeout(t,e)})}function yv(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?lk(e,t):t}function cT(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function uT(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var Dx=Symbol();function ck(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Dx?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ox(e,t){return typeof e=="function"?e(...t):!!e}function dT(e,t,n){let a=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i!=null||(i=t()),a||(a=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var Jo,no,Rc,CN,hT=(CN=class extends Zc{constructor(){super();mt(this,Jo);mt(this,no);mt(this,Rc);rt(this,Rc,t=>{if(!ml&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){fe(this,no)||this.setEventListener(fe(this,Rc))}onUnsubscribe(){var t;this.hasListeners()||((t=fe(this,no))==null||t.call(this),rt(this,no,void 0))}setEventListener(t){var n;rt(this,Rc,t),(n=fe(this,no))==null||n.call(this),rt(this,no,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){fe(this,Jo)!==t&&(rt(this,Jo,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof fe(this,Jo)=="boolean"?fe(this,Jo):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Jo=new WeakMap,no=new WeakMap,Rc=new WeakMap,CN),zx=new hT;function vv(){let e,t;const n=new Promise((i,r)=>{e=i,t=r});n.status="pending",n.catch(()=>{});function a(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{a({status:"fulfilled",value:i}),e(i)},n.reject=i=>{a({status:"rejected",reason:i}),t(i)},n}var fT=iT;function pT(){let e=[],t=0,n=c=>{c()},a=c=>{c()},i=fT;const r=c=>{t?e.push(c):i(()=>{n(c)})},l=()=>{const c=e;e=[],c.length&&i(()=>{a(()=>{c.forEach(u=>{n(u)})})})};return{batch:c=>{let u;t++;try{u=c()}finally{t--,t||l()}return u},batchCalls:c=>(...u)=>{r(()=>{c(...u)})},schedule:r,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{a=c},setScheduler:c=>{i=c}}}var fa=pT(),Lc,ao,Tc,MN,mT=(MN=class extends Zc{constructor(){super();mt(this,Lc,!0);mt(this,ao);mt(this,Tc);rt(this,Tc,t=>{if(!ml&&window.addEventListener){const n=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",a)}}})}onSubscribe(){fe(this,ao)||this.setEventListener(fe(this,Tc))}onUnsubscribe(){var t;this.hasListeners()||((t=fe(this,ao))==null||t.call(this),rt(this,ao,void 0))}setEventListener(t){var n;rt(this,Tc,t),(n=fe(this,ao))==null||n.call(this),rt(this,ao,t(this.setOnline.bind(this)))}setOnline(t){fe(this,Lc)!==t&&(rt(this,Lc,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return fe(this,Lc)}},Lc=new WeakMap,ao=new WeakMap,Tc=new WeakMap,MN),lp=new mT;function gT(e){return Math.min(1e3*ks(2,e),3e4)}function uk(e){return(e!=null?e:"online")==="online"?lp.isOnline():!0}var xv=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function dk(e){let t=!1,n=0,a;const i=vv(),r=()=>i.status!=="pending",l=b=>{var _;if(!r()){const S=new xv(b);g(S),(_=e.onCancel)==null||_.call(e,S)}},c=()=>{t=!0},u=()=>{t=!1},h=()=>zx.isFocused()&&(e.networkMode==="always"||lp.isOnline())&&e.canRun(),m=()=>uk(e.networkMode)&&e.canRun(),p=b=>{r()||(a==null||a(),i.resolve(b))},g=b=>{r()||(a==null||a(),i.reject(b))},v=()=>new Promise(b=>{var _;a=S=>{(r()||h())&&b(S)},(_=e.onPause)==null||_.call(e)}).then(()=>{var b;a=void 0,r()||(b=e.onContinue)==null||b.call(e)}),x=()=>{if(r())return;let b;const _=n===0?e.initialPromise:void 0;try{b=_!=null?_:e.fn()}catch(S){b=Promise.reject(S)}Promise.resolve(b).then(p).catch(S=>{var E,I,T;if(r())return;const M=(E=e.retry)!=null?E:ml?0:3,C=(I=e.retryDelay)!=null?I:gT,k=typeof C=="function"?C(n,S):C,L=M===!0||typeof M=="number"&&n<M||typeof M=="function"&&M(n,S);if(t||!L){g(S);return}n++,(T=e.onFail)==null||T.call(e,n,S),lT(k).then(()=>h()?void 0:v()).then(()=>{t?g(S):x()})})};return{promise:i,status:()=>i.status,cancel:l,continue:()=>(a==null||a(),i),cancelRetry:c,continueRetry:u,canStart:m,start:()=>(m()?x():v().then(x),i)}}var Wo,jN,hk=(jN=class{constructor(){mt(this,Wo)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mv(this.gcTime)&&rt(this,Wo,Xo.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e!=null?e:ml?1/0:300*1e3)}clearGcTimeout(){fe(this,Wo)&&(Xo.clearTimeout(fe(this,Wo)),rt(this,Wo,void 0))}},Wo=new WeakMap,jN),el,Ac,Gs,tl,_a,Hd,nl,li,nr,EN,yT=(EN=class extends hk{constructor(t){var n;super();mt(this,li);mt(this,el);mt(this,Ac);mt(this,Gs);mt(this,tl);mt(this,_a);mt(this,Hd);mt(this,nl);rt(this,nl,!1),rt(this,Hd,t.defaultOptions),this.setOptions(t.options),this.observers=[],rt(this,tl,t.client),rt(this,Gs,fe(this,tl).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,rt(this,el,jw(this.options)),this.state=(n=t.state)!=null?n:fe(this,el),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=fe(this,_a))==null?void 0:t.promise}setOptions(t){if(this.options=$($({},fe(this,Hd)),t),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=jw(this.options);n.data!==void 0&&(this.setState(Mw(n.data,n.dataUpdatedAt)),rt(this,el,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&fe(this,Gs).remove(this)}setData(t,n){const a=yv(this.state.data,t,this.options);return Ot(this,li,nr).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){Ot(this,li,nr).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,i;const n=(a=fe(this,_a))==null?void 0:a.promise;return(i=fe(this,_a))==null||i.cancel(t),n?n.then(Ka).catch(Ka):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(fe(this,el))}isActive(){return this.observers.some(t=>Qs(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Dx||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>mo(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!ok(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=fe(this,_a))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=fe(this,_a))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),fe(this,Gs).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(fe(this,_a)&&(fe(this,nl)?fe(this,_a).cancel({revert:!0}):fe(this,_a).cancelRetry()),this.scheduleGc()),fe(this,Gs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ot(this,li,nr).call(this,{type:"invalidate"})}fetch(t,n){return St(this,null,function*(){var u,h,m,p,g,v,x,b,_,S,M,C;if(this.state.fetchStatus!=="idle"&&((u=fe(this,_a))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(fe(this,_a))return fe(this,_a).continueRetry(),fe(this,_a).promise}if(t&&this.setOptions(t),!this.options.queryFn){const k=this.observers.find(L=>L.options.queryFn);k&&this.setOptions(k.options)}const a=new AbortController,i=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(rt(this,nl,!0),a.signal)})},r=()=>{const k=ck(this.options,n),E=(()=>{const I={client:fe(this,tl),queryKey:this.queryKey,meta:this.meta};return i(I),I})();return rt(this,nl,!1),this.options.persister?this.options.persister(k,E,this):k(E)},c=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:fe(this,tl),state:this.state,fetchFn:r};return i(k),k})();(h=this.options.behavior)==null||h.onFetch(c,this),rt(this,Ac,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((m=c.fetchOptions)==null?void 0:m.meta))&&Ot(this,li,nr).call(this,{type:"fetch",meta:(p=c.fetchOptions)==null?void 0:p.meta}),rt(this,_a,dk({initialPromise:n==null?void 0:n.initialPromise,fn:c.fetchFn,onCancel:k=>{k instanceof xv&&k.revert&&this.setState(ee($({},fe(this,Ac)),{fetchStatus:"idle"})),a.abort()},onFail:(k,L)=>{Ot(this,li,nr).call(this,{type:"failed",failureCount:k,error:L})},onPause:()=>{Ot(this,li,nr).call(this,{type:"pause"})},onContinue:()=>{Ot(this,li,nr).call(this,{type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode,canRun:()=>!0}));try{const k=yield fe(this,_a).start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(v=(g=fe(this,Gs).config).onSuccess)==null||v.call(g,k,this),(b=(x=fe(this,Gs).config).onSettled)==null||b.call(x,k,this.state.error,this),k}catch(k){if(k instanceof xv){if(k.silent)return fe(this,_a).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw Ot(this,li,nr).call(this,{type:"error",error:k}),(S=(_=fe(this,Gs).config).onError)==null||S.call(_,k,this),(C=(M=fe(this,Gs).config).onSettled)==null||C.call(M,this.state.data,k,this),k}finally{this.scheduleGc()}})}},el=new WeakMap,Ac=new WeakMap,Gs=new WeakMap,tl=new WeakMap,_a=new WeakMap,Hd=new WeakMap,nl=new WeakMap,li=new WeakSet,nr=function(t){const n=a=>{var i;switch(t.type){case"failed":return ee($({},a),{fetchFailureCount:t.failureCount,fetchFailureReason:t.error});case"pause":return ee($({},a),{fetchStatus:"paused"});case"continue":return ee($({},a),{fetchStatus:"fetching"});case"fetch":return ee($($({},a),fk(a.data,this.options)),{fetchMeta:(i=t.meta)!=null?i:null});case"success":const r=$(ee($($({},a),Mw(t.data,t.dataUpdatedAt)),{dataUpdateCount:a.dataUpdateCount+1}),!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null});return rt(this,Ac,t.manual?r:void 0),r;case"error":const l=t.error;return ee($({},a),{error:l,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error",isInvalidated:!0});case"invalidate":return ee($({},a),{isInvalidated:!0});case"setState":return $($({},a),t.state)}};this.state=n(this.state),fa.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),fe(this,Gs).notify({query:this,type:"updated",action:t})})},EN);function fk(e,t){return $({fetchFailureCount:0,fetchFailureReason:null,fetchStatus:uk(t.networkMode)?"fetching":"paused"},e===void 0&&{error:null,status:"pending"})}function Mw(e,t){return{data:e,dataUpdatedAt:t!=null?t:Date.now(),error:null,isInvalidated:!1,status:"success"}}function jw(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,a=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?a!=null?a:Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var us,Vt,qd,Ya,al,Ic,ar,so,Vd,Dc,Oc,sl,il,io,zc,ln,pd,bv,_v,wv,Sv,Nv,kv,Cv,pk,RN,vT=(RN=class extends Zc{constructor(t,n){super();mt(this,ln);mt(this,us);mt(this,Vt);mt(this,qd);mt(this,Ya);mt(this,al);mt(this,Ic);mt(this,ar);mt(this,so);mt(this,Vd);mt(this,Dc);mt(this,Oc);mt(this,sl);mt(this,il);mt(this,io);mt(this,zc,new Set);this.options=n,rt(this,us,t),rt(this,so,null),rt(this,ar,vv()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(fe(this,Vt).addObserver(this),Ew(fe(this,Vt),this.options)?Ot(this,ln,pd).call(this):this.updateResult(),Ot(this,ln,Sv).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Mv(fe(this,Vt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Mv(fe(this,Vt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ot(this,ln,Nv).call(this),Ot(this,ln,kv).call(this),fe(this,Vt).removeObserver(this)}setOptions(t){const n=this.options,a=fe(this,Vt);if(this.options=fe(this,us).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Qs(this.options.enabled,fe(this,Vt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ot(this,ln,Cv).call(this),fe(this,Vt).setOptions(this.options),n._defaulted&&!op(this.options,n)&&fe(this,us).getQueryCache().notify({type:"observerOptionsUpdated",query:fe(this,Vt),observer:this});const i=this.hasListeners();i&&Rw(fe(this,Vt),a,this.options,n)&&Ot(this,ln,pd).call(this),this.updateResult(),i&&(fe(this,Vt)!==a||Qs(this.options.enabled,fe(this,Vt))!==Qs(n.enabled,fe(this,Vt))||mo(this.options.staleTime,fe(this,Vt))!==mo(n.staleTime,fe(this,Vt)))&&Ot(this,ln,bv).call(this);const r=Ot(this,ln,_v).call(this);i&&(fe(this,Vt)!==a||Qs(this.options.enabled,fe(this,Vt))!==Qs(n.enabled,fe(this,Vt))||r!==fe(this,io))&&Ot(this,ln,wv).call(this,r)}getOptimisticResult(t){const n=fe(this,us).getQueryCache().build(fe(this,us),t),a=this.createResult(n,t);return bT(this,a)&&(rt(this,Ya,a),rt(this,Ic,this.options),rt(this,al,fe(this,Vt).state)),a}getCurrentResult(){return fe(this,Ya)}trackResult(t,n){return new Proxy(t,{get:(a,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&fe(this,ar).status==="pending"&&fe(this,ar).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,i))})}trackProp(t){fe(this,zc).add(t)}getCurrentQuery(){return fe(this,Vt)}refetch(n={}){var t=Ie(n,[]);return this.fetch($({},t))}fetchOptimistic(t){const n=fe(this,us).defaultQueryOptions(t),a=fe(this,us).getQueryCache().build(fe(this,us),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){var n;return Ot(this,ln,pd).call(this,ee($({},t),{cancelRefetch:(n=t.cancelRefetch)!=null?n:!0})).then(()=>(this.updateResult(),fe(this,Ya)))}createResult(t,n){var A;const a=fe(this,Vt),i=this.options,r=fe(this,Ya),l=fe(this,al),c=fe(this,Ic),h=t!==a?t.state:fe(this,qd),{state:m}=t;let p=$({},m),g=!1,v;if(n._optimisticResults){const R=this.hasListeners(),D=!R&&Ew(t,n),O=R&&Rw(t,a,n,i);(D||O)&&(p=$($({},p),fk(m.data,t.options))),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:x,errorUpdatedAt:b,status:_}=p;v=p.data;let S=!1;if(n.placeholderData!==void 0&&v===void 0&&_==="pending"){let R;r!=null&&r.isPlaceholderData&&n.placeholderData===(c==null?void 0:c.placeholderData)?(R=r.data,S=!0):R=typeof n.placeholderData=="function"?n.placeholderData((A=fe(this,Oc))==null?void 0:A.state.data,fe(this,Oc)):n.placeholderData,R!==void 0&&(_="success",v=yv(r==null?void 0:r.data,R,n),g=!0)}if(n.select&&v!==void 0&&!S)if(r&&v===(l==null?void 0:l.data)&&n.select===fe(this,Vd))v=fe(this,Dc);else try{rt(this,Vd,n.select),v=n.select(v),v=yv(r==null?void 0:r.data,v,n),rt(this,Dc,v),rt(this,so,null)}catch(R){rt(this,so,R)}fe(this,so)&&(x=fe(this,so),v=fe(this,Dc),b=Date.now(),_="error");const M=p.fetchStatus==="fetching",C=_==="pending",k=_==="error",L=C&&M,E=v!==void 0,T={status:_,fetchStatus:p.fetchStatus,isPending:C,isSuccess:_==="success",isError:k,isInitialLoading:L,isLoading:L,data:v,dataUpdatedAt:p.dataUpdatedAt,error:x,errorUpdatedAt:b,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>h.dataUpdateCount||p.errorUpdateCount>h.errorUpdateCount,isFetching:M,isRefetching:M&&!C,isLoadingError:k&&!E,isPaused:p.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:k&&E,isStale:Bx(t,n),refetch:this.refetch,promise:fe(this,ar),isEnabled:Qs(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=T.data!==void 0,D=T.status==="error"&&!R,O=U=>{D?U.reject(T.error):R&&U.resolve(T.data)},B=()=>{const U=rt(this,ar,T.promise=vv());O(U)},z=fe(this,ar);switch(z.status){case"pending":t.queryHash===a.queryHash&&O(z);break;case"fulfilled":(D||T.data!==z.value)&&B();break;case"rejected":(!D||T.error!==z.reason)&&B();break}}return T}updateResult(){const t=fe(this,Ya),n=this.createResult(fe(this,Vt),this.options);if(rt(this,al,fe(this,Vt).state),rt(this,Ic,this.options),fe(this,al).data!==void 0&&rt(this,Oc,fe(this,Vt)),op(n,t))return;rt(this,Ya,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,r=typeof i=="function"?i():i;if(r==="all"||!r&&!fe(this,zc).size)return!0;const l=new Set(r!=null?r:fe(this,zc));return this.options.throwOnError&&l.add("error"),Object.keys(fe(this,Ya)).some(c=>{const u=c;return fe(this,Ya)[u]!==t[u]&&l.has(u)})};Ot(this,ln,pk).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ot(this,ln,Sv).call(this)}},us=new WeakMap,Vt=new WeakMap,qd=new WeakMap,Ya=new WeakMap,al=new WeakMap,Ic=new WeakMap,ar=new WeakMap,so=new WeakMap,Vd=new WeakMap,Dc=new WeakMap,Oc=new WeakMap,sl=new WeakMap,il=new WeakMap,io=new WeakMap,zc=new WeakMap,ln=new WeakSet,pd=function(t){Ot(this,ln,Cv).call(this);let n=fe(this,Vt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ka)),n},bv=function(){Ot(this,ln,Nv).call(this);const t=mo(this.options.staleTime,fe(this,Vt));if(ml||fe(this,Ya).isStale||!mv(t))return;const a=ok(fe(this,Ya).dataUpdatedAt,t)+1;rt(this,sl,Xo.setTimeout(()=>{fe(this,Ya).isStale||this.updateResult()},a))},_v=function(){var t;return(t=typeof this.options.refetchInterval=="function"?this.options.refetchInterval(fe(this,Vt)):this.options.refetchInterval)!=null?t:!1},wv=function(t){Ot(this,ln,kv).call(this),rt(this,io,t),!(ml||Qs(this.options.enabled,fe(this,Vt))===!1||!mv(fe(this,io))||fe(this,io)===0)&&rt(this,il,Xo.setInterval(()=>{(this.options.refetchIntervalInBackground||zx.isFocused())&&Ot(this,ln,pd).call(this)},fe(this,io)))},Sv=function(){Ot(this,ln,bv).call(this),Ot(this,ln,wv).call(this,Ot(this,ln,_v).call(this))},Nv=function(){fe(this,sl)&&(Xo.clearTimeout(fe(this,sl)),rt(this,sl,void 0))},kv=function(){fe(this,il)&&(Xo.clearInterval(fe(this,il)),rt(this,il,void 0))},Cv=function(){const t=fe(this,us).getQueryCache().build(fe(this,us),this.options);if(t===fe(this,Vt))return;const n=fe(this,Vt);rt(this,Vt,t),rt(this,qd,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},pk=function(t){fa.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(fe(this,Ya))}),fe(this,us).getQueryCache().notify({query:fe(this,Vt),type:"observerResultsUpdated"})})},RN);function xT(e,t){return Qs(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ew(e,t){return xT(e,t)||e.state.data!==void 0&&Mv(e,t,t.refetchOnMount)}function Mv(e,t,n){if(Qs(t.enabled,e)!==!1&&mo(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&Bx(e,t)}return!1}function Rw(e,t,n,a){return(e!==t||Qs(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Bx(e,n)}function Bx(e,t){return Qs(t.enabled,e)!==!1&&e.isStaleByTime(mo(t.staleTime,e))}function bT(e,t){return!op(e.getCurrentResult(),t)}function Lw(e){return{onFetch:(t,n)=>{var m,p,g,v,x;const a=t.options,i=(g=(p=(m=t.fetchOptions)==null?void 0:m.meta)==null?void 0:p.fetchMore)==null?void 0:g.direction,r=((v=t.state.data)==null?void 0:v.pages)||[],l=((x=t.state.data)==null?void 0:x.pageParams)||[];let c={pages:[],pageParams:[]},u=0;const h=()=>St(null,null,function*(){var C;let b=!1;const _=k=>{dT(k,()=>t.signal,()=>b=!0)},S=ck(t.options,t.fetchOptions),M=(k,L,E)=>St(null,null,function*(){if(b)return Promise.reject();if(L==null&&k.pages.length)return Promise.resolve(k);const T=(()=>{const O={client:t.client,queryKey:t.queryKey,pageParam:L,direction:E?"backward":"forward",meta:t.options.meta};return _(O),O})(),A=yield S(T),{maxPages:R}=t.options,D=E?uT:cT;return{pages:D(k.pages,A,R),pageParams:D(k.pageParams,L,R)}});if(i&&r.length){const k=i==="backward",L=k?_T:Tw,E={pages:r,pageParams:l},I=L(a,E);c=yield M(E,I,k)}else{const k=e!=null?e:r.length;do{const L=u===0?(C=l[0])!=null?C:a.initialPageParam:Tw(a,c);if(u>0&&L==null)break;c=yield M(c,L),u++}while(u<k)}return c});t.options.persister?t.fetchFn=()=>{var b,_;return(_=(b=t.options).persister)==null?void 0:_.call(b,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function Tw(e,{pages:t,pageParams:n}){const a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,n[a],n):void 0}function _T(e,{pages:t,pageParams:n}){var a;return t.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,t[0],t,n[0],n):void 0}var Yd,ki,Oa,rl,Ci,Wr,LN,wT=(LN=class extends hk{constructor(t){super();mt(this,Ci);mt(this,Yd);mt(this,ki);mt(this,Oa);mt(this,rl);rt(this,Yd,t.client),this.mutationId=t.mutationId,rt(this,Oa,t.mutationCache),rt(this,ki,[]),this.state=t.state||mk(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){fe(this,ki).includes(t)||(fe(this,ki).push(t),this.clearGcTimeout(),fe(this,Oa).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){rt(this,ki,fe(this,ki).filter(n=>n!==t)),this.scheduleGc(),fe(this,Oa).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){fe(this,ki).length||(this.state.status==="pending"?this.scheduleGc():fe(this,Oa).remove(this))}continue(){var t,n;return(n=(t=fe(this,rl))==null?void 0:t.continue())!=null?n:this.execute(this.state.variables)}execute(t){return St(this,null,function*(){var l,c,u,h,m,p,g,v,x,b,_,S,M,C,k,L,E,I,T;const n=()=>{Ot(this,Ci,Wr).call(this,{type:"continue"})},a={client:fe(this,Yd),meta:this.options.meta,mutationKey:this.options.mutationKey};rt(this,rl,dk({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(A,R)=>{Ot(this,Ci,Wr).call(this,{type:"failed",failureCount:A,error:R})},onPause:()=>{Ot(this,Ci,Wr).call(this,{type:"pause"})},onContinue:n,retry:(l=this.options.retry)!=null?l:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>fe(this,Oa).canRun(this)}));const i=this.state.status==="pending",r=!fe(this,rl).canStart();try{if(i)n();else{Ot(this,Ci,Wr).call(this,{type:"pending",variables:t,isPaused:r}),fe(this,Oa).config.onMutate&&(yield fe(this,Oa).config.onMutate(t,this,a));const R=yield(u=(c=this.options).onMutate)==null?void 0:u.call(c,t,a);R!==this.state.context&&Ot(this,Ci,Wr).call(this,{type:"pending",context:R,variables:t,isPaused:r})}const A=yield fe(this,rl).start();return yield(m=(h=fe(this,Oa).config).onSuccess)==null?void 0:m.call(h,A,t,this.state.context,this,a),yield(g=(p=this.options).onSuccess)==null?void 0:g.call(p,A,t,this.state.context,a),yield(x=(v=fe(this,Oa).config).onSettled)==null?void 0:x.call(v,A,null,this.state.variables,this.state.context,this,a),yield(_=(b=this.options).onSettled)==null?void 0:_.call(b,A,null,t,this.state.context,a),Ot(this,Ci,Wr).call(this,{type:"success",data:A}),A}catch(A){try{yield(M=(S=fe(this,Oa).config).onError)==null?void 0:M.call(S,A,t,this.state.context,this,a)}catch(R){Promise.reject(R)}try{yield(k=(C=this.options).onError)==null?void 0:k.call(C,A,t,this.state.context,a)}catch(R){Promise.reject(R)}try{yield(E=(L=fe(this,Oa).config).onSettled)==null?void 0:E.call(L,void 0,A,this.state.variables,this.state.context,this,a)}catch(R){Promise.reject(R)}try{yield(T=(I=this.options).onSettled)==null?void 0:T.call(I,void 0,A,t,this.state.context,a)}catch(R){Promise.reject(R)}throw Ot(this,Ci,Wr).call(this,{type:"error",error:A}),A}finally{fe(this,Oa).runNext(this)}})}},Yd=new WeakMap,ki=new WeakMap,Oa=new WeakMap,rl=new WeakMap,Ci=new WeakSet,Wr=function(t){const n=a=>{switch(t.type){case"failed":return ee($({},a),{failureCount:t.failureCount,failureReason:t.error});case"pause":return ee($({},a),{isPaused:!0});case"continue":return ee($({},a),{isPaused:!1});case"pending":return ee($({},a),{context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()});case"success":return ee($({},a),{data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1});case"error":return ee($({},a),{data:void 0,error:t.error,failureCount:a.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"})}};this.state=n(this.state),fa.batch(()=>{fe(this,ki).forEach(a=>{a.onMutationUpdate(t)}),fe(this,Oa).notify({mutation:this,type:"updated",action:t})})},LN);function mk(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var sr,ci,Gd,TN,ST=(TN=class extends Zc{constructor(t={}){super();mt(this,sr);mt(this,ci);mt(this,Gd);this.config=t,rt(this,sr,new Set),rt(this,ci,new Map),rt(this,Gd,0)}build(t,n,a){const i=new wT({client:t,mutationCache:this,mutationId:++mf(this,Gd)._,options:t.defaultMutationOptions(n),state:a});return this.add(i),i}add(t){fe(this,sr).add(t);const n=xf(t);if(typeof n=="string"){const a=fe(this,ci).get(n);a?a.push(t):fe(this,ci).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(fe(this,sr).delete(t)){const n=xf(t);if(typeof n=="string"){const a=fe(this,ci).get(n);if(a)if(a.length>1){const i=a.indexOf(t);i!==-1&&a.splice(i,1)}else a[0]===t&&fe(this,ci).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=xf(t);if(typeof n=="string"){const a=fe(this,ci).get(n),i=a==null?void 0:a.find(r=>r.state.status==="pending");return!i||i===t}else return!0}runNext(t){var a,i;const n=xf(t);if(typeof n=="string"){const r=(a=fe(this,ci).get(n))==null?void 0:a.find(l=>l!==t&&l.state.isPaused);return(i=r==null?void 0:r.continue())!=null?i:Promise.resolve()}else return Promise.resolve()}clear(){fa.batch(()=>{fe(this,sr).forEach(t=>{this.notify({type:"removed",mutation:t})}),fe(this,sr).clear(),fe(this,ci).clear()})}getAll(){return Array.from(fe(this,sr))}find(t){const n=$({exact:!0},t);return this.getAll().find(a=>Nw(n,a))}findAll(t={}){return this.getAll().filter(n=>Nw(t,n))}notify(t){fa.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return fa.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ka))))}},sr=new WeakMap,ci=new WeakMap,Gd=new WeakMap,TN);function xf(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ir,ro,ds,rr,ur,Kf,jv,AN,NT=(AN=class extends Zc{constructor(n,a){super();mt(this,ur);mt(this,ir);mt(this,ro);mt(this,ds);mt(this,rr);rt(this,ir,n),this.setOptions(a),this.bindMethods(),Ot(this,ur,Kf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const a=this.options;this.options=fe(this,ir).defaultMutationOptions(n),op(this.options,a)||fe(this,ir).getMutationCache().notify({type:"observerOptionsUpdated",mutation:fe(this,ds),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&gl(a.mutationKey)!==gl(this.options.mutationKey)?this.reset():((i=fe(this,ds))==null?void 0:i.state.status)==="pending"&&fe(this,ds).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=fe(this,ds))==null||n.removeObserver(this)}onMutationUpdate(n){Ot(this,ur,Kf).call(this),Ot(this,ur,jv).call(this,n)}getCurrentResult(){return fe(this,ro)}reset(){var n;(n=fe(this,ds))==null||n.removeObserver(this),rt(this,ds,void 0),Ot(this,ur,Kf).call(this),Ot(this,ur,jv).call(this)}mutate(n,a){var i;return rt(this,rr,a),(i=fe(this,ds))==null||i.removeObserver(this),rt(this,ds,fe(this,ir).getMutationCache().build(fe(this,ir),this.options)),fe(this,ds).addObserver(this),fe(this,ds).execute(n)}},ir=new WeakMap,ro=new WeakMap,ds=new WeakMap,rr=new WeakMap,ur=new WeakSet,Kf=function(){var a,i;const n=(i=(a=fe(this,ds))==null?void 0:a.state)!=null?i:mk();rt(this,ro,ee($({},n),{isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset}))},jv=function(n){fa.batch(()=>{var a,i,r,l,c,u,h,m;if(fe(this,rr)&&this.hasListeners()){const p=fe(this,ro).variables,g=fe(this,ro).context,v={client:fe(this,ir),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(i=(a=fe(this,rr)).onSuccess)==null||i.call(a,n.data,p,g,v)}catch(x){Promise.reject(x)}try{(l=(r=fe(this,rr)).onSettled)==null||l.call(r,n.data,null,p,g,v)}catch(x){Promise.reject(x)}}else if((n==null?void 0:n.type)==="error"){try{(u=(c=fe(this,rr)).onError)==null||u.call(c,n.error,p,g,v)}catch(x){Promise.reject(x)}try{(m=(h=fe(this,rr)).onSettled)==null||m.call(h,void 0,n.error,p,g,v)}catch(x){Promise.reject(x)}}}this.listeners.forEach(p=>{p(fe(this,ro))})})},AN),Mi,IN,kT=(IN=class extends Zc{constructor(t={}){super();mt(this,Mi);this.config=t,rt(this,Mi,new Map)}build(t,n,a){var c;const i=n.queryKey,r=(c=n.queryHash)!=null?c:Ix(i,n);let l=this.get(r);return l||(l=new yT({client:t,queryKey:i,queryHash:r,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(i)}),this.add(l)),l}add(t){fe(this,Mi).has(t.queryHash)||(fe(this,Mi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=fe(this,Mi).get(t.queryHash);n&&(t.destroy(),n===t&&fe(this,Mi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){fa.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return fe(this,Mi).get(t)}getAll(){return[...fe(this,Mi).values()]}find(t){const n=$({exact:!0},t);return this.getAll().find(a=>Sw(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>Sw(t,a)):n}notify(t){fa.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){fa.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){fa.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Mi=new WeakMap,IN),Qn,oo,lo,Bc,$c,co,Uc,Fc,DN,CT=(DN=class{constructor(e={}){mt(this,Qn);mt(this,oo);mt(this,lo);mt(this,Bc);mt(this,$c);mt(this,co);mt(this,Uc);mt(this,Fc);rt(this,Qn,e.queryCache||new kT),rt(this,oo,e.mutationCache||new ST),rt(this,lo,e.defaultOptions||{}),rt(this,Bc,new Map),rt(this,$c,new Map),rt(this,co,0)}mount(){mf(this,co)._++,fe(this,co)===1&&(rt(this,Uc,zx.subscribe(e=>St(this,null,function*(){e&&(yield this.resumePausedMutations(),fe(this,Qn).onFocus())}))),rt(this,Fc,lp.subscribe(e=>St(this,null,function*(){e&&(yield this.resumePausedMutations(),fe(this,Qn).onOnline())}))))}unmount(){var e,t;mf(this,co)._--,fe(this,co)===0&&((e=fe(this,Uc))==null||e.call(this),rt(this,Uc,void 0),(t=fe(this,Fc))==null||t.call(this),rt(this,Fc,void 0))}isFetching(e){return fe(this,Qn).findAll(ee($({},e),{fetchStatus:"fetching"})).length}isMutating(e){return fe(this,oo).findAll(ee($({},e),{status:"pending"})).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=fe(this,Qn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=fe(this,Qn).build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(mo(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return fe(this,Qn).findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),i=fe(this,Qn).get(a.queryHash),r=i==null?void 0:i.state.data,l=rT(t,r);if(l!==void 0)return fe(this,Qn).build(this,a).setData(l,ee($({},n),{manual:!0}))}setQueriesData(e,t,n){return fa.batch(()=>fe(this,Qn).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=fe(this,Qn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=fe(this,Qn);fa.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=fe(this,Qn);return fa.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries($({type:"active"},e),t)))}cancelQueries(e,t={}){const n=$({revert:!0},t),a=fa.batch(()=>fe(this,Qn).findAll(e).map(i=>i.cancel(n)));return Promise.all(a).then(Ka).catch(Ka)}invalidateQueries(e,t={}){return fa.batch(()=>{var n,a;return fe(this,Qn).findAll(e).forEach(i=>{i.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries(ee($({},e),{type:(a=(n=e==null?void 0:e.refetchType)!=null?n:e==null?void 0:e.type)!=null?a:"active"}),t)})}refetchQueries(e,t={}){var i;const n=ee($({},t),{cancelRefetch:(i=t.cancelRefetch)!=null?i:!0}),a=fa.batch(()=>fe(this,Qn).findAll(e).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let l=r.fetch(void 0,n);return n.throwOnError||(l=l.catch(Ka)),r.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(a).then(Ka)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=fe(this,Qn).build(this,t);return n.isStaleByTime(mo(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ka).catch(Ka)}fetchInfiniteQuery(e){return e.behavior=Lw(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ka).catch(Ka)}ensureInfiniteQueryData(e){return e.behavior=Lw(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return lp.isOnline()?fe(this,oo).resumePausedMutations():Promise.resolve()}getQueryCache(){return fe(this,Qn)}getMutationCache(){return fe(this,oo)}getDefaultOptions(){return fe(this,lo)}setDefaultOptions(e){rt(this,lo,e)}setQueryDefaults(e,t){fe(this,Bc).set(gl(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...fe(this,Bc).values()],n={};return t.forEach(a=>{Rd(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){fe(this,$c).set(gl(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...fe(this,$c).values()],n={};return t.forEach(a=>{Rd(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t=ee($($($({},fe(this,lo).queries),this.getQueryDefaults(e.queryKey)),e),{_defaulted:!0});return t.queryHash||(t.queryHash=Ix(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Dx&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:ee($($($({},fe(this,lo).mutations),(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey)),e),{_defaulted:!0})}clear(){fe(this,Qn).clear(),fe(this,oo).clear()}},Qn=new WeakMap,oo=new WeakMap,lo=new WeakMap,Bc=new WeakMap,$c=new WeakMap,co=new WeakMap,Uc=new WeakMap,Fc=new WeakMap,DN),gk=j.createContext(void 0),fi=e=>{const t=j.useContext(gk);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},MT=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(gk.Provider,{value:e,children:t})),yk=j.createContext(!1),jT=()=>j.useContext(yk);yk.Provider;function ET(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var RT=j.createContext(ET()),LT=()=>j.useContext(RT),TT=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Ox(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},AT=e=>{j.useEffect(()=>{e.clearReset()},[e])},IT=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(i&&e.data===void 0||Ox(n,[e.error,a])),DT=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i!=null?i:1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...i)=>n(a(...i)):n(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},OT=(e,t)=>e.isLoading&&e.isFetching&&!t,zT=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Aw=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function BT(e,t,n){var g,v,x,b;const a=jT(),i=LT(),r=fi(),l=r.defaultQueryOptions(e);(v=(g=r.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||v.call(g,l);const c=r.getQueryCache().get(l.queryHash);l._optimisticResults=a?"isRestoring":"optimistic",DT(l),TT(l,i,c),AT(i);const u=!r.getQueryCache().get(l.queryHash),[h]=j.useState(()=>new t(r,l)),m=h.getOptimisticResult(l),p=!a&&e.subscribed!==!1;if(j.useSyncExternalStore(j.useCallback(_=>{const S=p?h.subscribe(fa.batchCalls(_)):Ka;return h.updateResult(),S},[h,p]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),j.useEffect(()=>{h.setOptions(l)},[l,h]),zT(l,m))throw Aw(l,h,i);if(IT({result:m,errorResetBoundary:i,throwOnError:l.throwOnError,query:c,suspense:l.suspense}))throw m.error;if((b=(x=r.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||b.call(x,l,m),l.experimental_prefetchInRender&&!ml&&OT(m,a)){const _=u?Aw(l,h,i):c==null?void 0:c.promise;_==null||_.catch(Ka).finally(()=>{h.updateResult()})}return l.notifyOnChangeProps?m:h.trackResult(m)}function Jc(e,t){return BT(e,vT)}function Wc(e,t){const n=fi(),[a]=j.useState(()=>new NT(n,e));j.useEffect(()=>{a.setOptions(e)},[a,e]);const i=j.useSyncExternalStore(j.useCallback(l=>a.subscribe(fa.batchCalls(l)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),r=j.useCallback((l,c)=>{a.mutate(l,c).catch(Ka)},[a]);if(i.error&&Ox(a.options.throwOnError,[i.error]))throw i.error;return ee($({},i),{mutate:r,mutateAsync:i.mutate})}const $T="dr_auth_token";function UT(){const e=window.fetch;window.fetch=function(...t){const[n,a]=t,i=typeof window!="undefined"?localStorage.getItem($T):null,r=a||{};if(i&&!r.headers)r.headers={Authorization:`Bearer ${i}`};else if(i&&r.headers){const l=r.headers;l.Authorization||(l.Authorization=`Bearer ${i}`)}return e(n,r)},console.log("[FetchInterceptor] Installed - will add Authorization header to all requests")}var FT={};class Ra extends Error{constructor(t,n,a){super(`${t} failed: ${n} ${a}`),this.request=t,this.status=n,this.body=a,this.name="ApiError"}get serverMessage(){try{const t=JSON.parse(this.body);return typeof t.error=="string"&&t.error?t.error:void 0}catch(t){return}}}class PT{constructor(t){nn(this,"baseUrl");nn(this,"token",null);this.baseUrl=t,this.loadToken()}loadToken(){typeof window!="undefined"&&(this.token=localStorage.getItem("dr_auth_token"))}setToken(t){this.token=t}getBaseUrl(){return this.baseUrl}getHeaders(){const t={"Content-Type":"application/json"};return this.token&&(t.Authorization=`Bearer ${this.token}`),t}gethealth(){return St(this,null,function*(){const a=`${this.getBaseUrl()}/health`,i={method:"GET",headers:this.getHeaders(),credentials:"include"},r=yield fetch(a,i);if(!r.ok)throw new Ra("GET /health",r.status,yield r.text());return r.json()})}getapimodel(){return St(this,null,function*(){const a=`${this.getBaseUrl()}/api/model`,i={method:"GET",headers:this.getHeaders(),credentials:"include"},r=yield fetch(a,i);if(!r.ok)throw new Ra("GET /api/model",r.status,yield r.text());return r.json()})}getapilayerslayerName(t){return St(this,null,function*(){const n=this.getBaseUrl(),a=`/api/layers/${encodeURIComponent(t)}`,i=`${n}${a}`,r={method:"GET",headers:this.getHeaders(),credentials:"include"},l=yield fetch(i,r);if(!l.ok)throw new Ra("GET /api/layers/:layerName",l.status,yield l.text());return l.json()})}getapispec(){return St(this,null,function*(){const a=`${this.getBaseUrl()}/api/spec`,i={method:"GET",headers:this.getHeaders(),credentials:"include"},r=yield fetch(a,i);if(!r.ok)throw new Ra("GET /api/spec",r.status,yield r.text());return r.json()})}getapiannotations(t){return St(this,null,function*(){const n=this.getBaseUrl(),a="/api/annotations",i=new URLSearchParams;t&&Object.entries(t).forEach(([u,h])=>{h!=null&&i.append(u,h)});const r=i.toString()?`${n}${a}?${i.toString()}`:`${n}${a}`,l={method:"GET",headers:this.getHeaders(),credentials:"include"},c=yield fetch(r,l);if(!c.ok)throw new Ra("GET /api/annotations",c.status,yield c.text());return c.json()})}postapiannotations(t){return St(this,null,function*(){const i=`${this.getBaseUrl()}/api/annotations`,r={method:"POST",headers:this.getHeaders(),credentials:"include"};t&&(r.body=JSON.stringify(t));const l=yield fetch(i,r);if(!l.ok)throw new Ra("POST /api/annotations",l.status,yield l.text());return l.json()})}getapiannotationsannotationId(t){return St(this,null,function*(){const n=this.getBaseUrl(),a=`/api/annotations/${encodeURIComponent(t)}`,i=`${n}${a}`,r={method:"GET",headers:this.getHeaders(),credentials:"include"},l=yield fetch(i,r);if(!l.ok)throw new Ra("GET /api/annotations/:annotationId",l.status,yield l.text());return l.json()})}putapiannotationsannotationId(t,n){return St(this,null,function*(){const a=this.getBaseUrl(),i=`/api/annotations/${encodeURIComponent(t)}`,r=`${a}${i}`,l={method:"PUT",headers:this.getHeaders(),credentials:"include"};n&&(l.body=JSON.stringify(n));const c=yield fetch(r,l);if(!c.ok)throw new Ra("PUT /api/annotations/:annotationId",c.status,yield c.text());return c.json()})}patchapiannotationsannotationId(t,n){return St(this,null,function*(){const a=this.getBaseUrl(),i=`/api/annotations/${encodeURIComponent(t)}`,r=`${a}${i}`,l={method:"PATCH",headers:this.getHeaders(),credentials:"include"};n&&(l.body=JSON.stringify(n));const c=yield fetch(r,l);if(!c.ok)throw new Ra("PATCH /api/annotations/:annotationId",c.status,yield c.text());return c.json()})}deleteapiannotationsannotationId(t){return St(this,null,function*(){const n=this.getBaseUrl(),a=`/api/annotations/${encodeURIComponent(t)}`,i=`${n}${a}`,r={method:"DELETE",headers:this.getHeaders(),credentials:"include"},l=yield fetch(i,r);if(!l.ok)throw new Ra("DELETE /api/annotations/:annotationId",l.status,yield l.text());if(l.status!==204)return l.json()})}getapiannotationsannotationIdreplies(t){return St(this,null,function*(){const n=this.getBaseUrl(),a=`/api/annotations/${encodeURIComponent(t)}/replies`,i=`${n}${a}`,r={method:"GET",headers:this.getHeaders(),credentials:"include"},l=yield fetch(i,r);if(!l.ok)throw new Ra("GET /api/annotations/:annotationId/replies",l.status,yield l.text());return l.json()})}postapiannotationsannotationIdreplies(t,n){return St(this,null,function*(){const a=this.getBaseUrl(),i=`/api/annotations/${encodeURIComponent(t)}/replies`,r=`${a}${i}`,l={method:"POST",headers:this.getHeaders(),credentials:"include"};n&&(l.body=JSON.stringify(n));const c=yield fetch(r,l);if(!c.ok)throw new Ra("POST /api/annotations/:annotationId/replies",c.status,yield c.text());return c.json()})}getapichangesets(){return St(this,null,function*(){const a=`${this.getBaseUrl()}/api/changesets`,i={method:"GET",headers:this.getHeaders(),credentials:"include"},r=yield fetch(a,i);if(!r.ok)throw new Ra("GET /api/changesets",r.status,yield r.text());return r.json()})}getapichangesetschangesetId(t){return St(this,null,function*(){const n=this.getBaseUrl(),a=`/api/changesets/${encodeURIComponent(t)}`,i=`${n}${a}`,r={method:"GET",headers:this.getHeaders(),credentials:"include"},l=yield fetch(i,r);if(!l.ok)throw new Ra("GET /api/changesets/:changesetId",l.status,yield l.text());return l.json()})}postapichangesetschangesetIdcommit(t){return St(this,null,function*(){const n=this.getBaseUrl(),a=`/api/changesets/${encodeURIComponent(t)}/commit`,i=`${n}${a}`,r={method:"POST",headers:this.getHeaders(),credentials:"include"},l=yield fetch(i,r);if(!l.ok)throw new Ra("POST /api/changesets/:changesetId/commit",l.status,yield l.text());return l.json()})}postapichangesetschangesetIddiscard(t){return St(this,null,function*(){const n=this.getBaseUrl(),a=`/api/changesets/${encodeURIComponent(t)}/discard`,i=`${n}${a}`,r={method:"POST",headers:this.getHeaders(),credentials:"include"},l=yield fetch(i,r);if(!l.ok)throw new Ra("POST /api/changesets/:changesetId/discard",l.status,yield l.text());return l.json()})}}let py=null;function _l(e){if(!py){const t=typeof window!="undefined"?window.location.origin:FT.API_URL||"http://localhost:8080";py=new PT(t)}return py}const eu=_l();function HT(e){return Jc({queryKey:["getapimodel"],queryFn:()=>eu.getapimodel()})}function qT(e){return Jc({queryKey:["getapispec"],queryFn:()=>eu.getapispec()})}function VT(e){return Jc({queryKey:["getapichangesets"],queryFn:()=>eu.getapichangesets()})}function YT(e,t){return Jc($({queryKey:["getapichangesetschangesetId",e],queryFn:()=>eu.getapichangesetschangesetId(e)},t))}function GT(e,t){const n=fi();return Wc($({mutationFn:()=>eu.postapichangesetschangesetIdcommit(e),onSuccess:()=>{n.invalidateQueries({queryKey:["getapichangesets"]}),n.invalidateQueries({queryKey:["getapichangesetschangesetId",e]}),n.invalidateQueries({queryKey:["getapimodel"]}),n.invalidateQueries({queryKey:["getapilayerslayerName"]})}},t))}function KT(e,t){const n=fi();return Wc($({mutationFn:()=>eu.postapichangesetschangesetIddiscard(e),onSuccess:()=>{n.invalidateQueries({queryKey:["getapichangesets"]}),n.invalidateQueries({queryKey:["getapichangesetschangesetId",e]})}},t))}function QT(){return new CT({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1e3*60*10,retry:1},mutations:{retry:0}}})}const wd="dr_auth_token";function Iw(){if(typeof window=="undefined")return null;const e=localStorage.getItem(wd);if(e)return console.log("[Auth] Token loaded from localStorage"),e;const t=XT();return t?(console.log("[Auth] Token loaded from cookie"),t):(console.log("[Auth] No token found - running in development mode"),null)}function XT(){if(typeof document=="undefined")return null;const e=document.cookie.split(";").map(t=>t.trim()).find(t=>t.startsWith(`${wd}=`));if(!e)return null;try{return decodeURIComponent(e.split("=")[1]||"")}catch(t){return e.split("=")[1]||null}}const $x=jp((e,t)=>({token:Iw(),isAuthenticated:!!Iw(),setToken:n=>{typeof window!="undefined"&&(n?localStorage.setItem(wd,n):localStorage.removeItem(wd)),e({token:n,isAuthenticated:!!n}),console.log("[Auth] Token updated:",n?"present":"cleared")},clearToken:()=>{typeof window!="undefined"&&localStorage.removeItem(wd),e({token:null,isAuthenticated:!1}),console.log("[Auth] Token cleared from store and localStorage")},getAuthHeaders:()=>{const{token:n}=t();return n?{Authorization:`Bearer ${n}`}:{}},getAuthQueryParams:()=>{const{token:n}=t();return n?{token:n}:{}}}));function ZT(){const e=Kd({strict:!1}),t=$x(n=>n.setToken);return j.useEffect(()=>{const n=e==null?void 0:e.token,a=window.location.hash.slice(1)||"/model/graph";n&&(console.log("[AuthRoute] Storing token in localStorage"),localStorage.setItem("dr_auth_token",n),t(n),console.log("[AuthRoute] Updated authStore with new token")),window.location.hash=a},[e==null?void 0:e.token,t]),f.jsx("div",{className:"flex items-center justify-center h-screen",children:f.jsx("p",{className:"text-gray-500","data-testid":"auth-loading",children:"Authenticating..."})})}var JT=Object.defineProperty,WT=(e,t,n)=>t in e?JT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kt=(e,t,n)=>WT(e,typeof t!="symbol"?t+"":t,n);const eA={dashboard:"M3 3 L10 3 L10 10 L3 10 Z M14 3 L21 3 L21 10 L14 10 Z M14 14 L21 14 L21 21 L14 21 Z M3 14 L10 14 L10 21 L3 21 Z",schema:"M3 12 L9 6 L21 6 M3 12 L9 18 L21 18 M3 12 C4.7 12 6 10.3 6 8 C6 5.7 4.7 4 3 4 C1.3 4 0 5.7 0 8 C0 10.3 1.3 12 3 12 M21 6 C22.7 6 24 4.3 24 2 C24 0.3 22.7 0 21 0 C19.3 0 18 0.3 18 2 C18 4.3 19.3 6 21 6 M21 18 C22.7 18 24 16.3 24 14 C24 12.3 22.7 11 21 11 C19.3 11 18 12.3 18 14 C18 16.3 19.3 18 21 18",data:"M12 5 C18.6 5 24 6.3 24 8 L24 8 L24 16 C24 17.7 18.6 19 12 19 C5.4 19 0 17.7 0 16 L0 8 C0 6.3 5.4 5 12 5 M3 5 L3 14 L21 14 L21 5 M3 11 L3 19 L21 19 L21 11",pipeline:"M2 12 L6 12 L6 6 L18 6 L18 12 L22 12 M8 12 L16 12 M12 9 L15 12 L12 15",graph:"M6 10 C8.8 10 11 7.8 11 5 C11 2.2 8.8 0 6 0 C3.2 0 1 2.2 1 5 C1 7.8 3.2 10 6 10 M18 10 C20.8 10 23 7.8 23 5 C23 2.2 20.8 0 18 0 C15.2 0 13 2.2 13 5 C13 7.8 15.2 10 18 10 M12 18 C14.8 18 17 15.8 17 13 C17 10.2 14.8 8 12 8 C9.2 8 7 10.2 7 13 C7 15.8 9.2 18 12 18 M8 8 L16 16 M16 8 L8 16 M12 9 L12 15",search:"M10.6 14.8 C14.2 14.8 17.2 11.5 17.2 7.4 C17.2 3 14.2 0 10.6 0 C6.9 0 3 3 3 7.4 C3 11.5 6.9 14.8 10.6 14.8 M19.8 19.2 L16.7 16.3",bell:"M6.55 9.7 C6.55 3.7 11.15 0 11.15 0 C11.15 0 15.75 3.7 15.75 9.7 C15.75 12 17.25 13.4 17.25 13.4 L4.6 13.4 C4.6 13.4 6.55 12 6.55 9.7 M9.4 19.4 C9.73 19.8 10.8 20.1 10.95 20.1 C11.1 20.1 12.18 19.8 12.5 19.4",plus:"M12 5 L12 19 M5 12 L19 12",check:"M2 12 L8 18 L22 4",x:"M3 3 L21 21 M21 3 L3 21",chevronDown:"M6 9 L12 15 L18 9",chevronUp:"M18 15 L12 9 L6 15",chevronLeft:"M15 6 L9 12 L15 18",chevronRight:"M9 6 L15 12 L9 18",menu:"M3 6 L21 6 M3 12 L21 12 M3 18 L21 18",settings:"M12 1.5 C12.4 1.5 12.7 1.8 12.7 2.2 L12.7 4 C14.2 4.4 15.6 5.3 16.7 6.6 L18 5.4 C18.4 5.1 19 5.1 19.3 5.4 C19.7 5.7 19.7 6.3 19.3 6.6 L18 7.8 C19.2 8.9 20.2 10.3 20.6 12 L22.4 12 C22.9 12 23.2 12.3 23.2 12.8 C23.2 13.3 22.9 13.6 22.4 13.6 L20.6 13.6 C20.2 15.3 19.2 16.7 18 17.8 L19.3 19 C19.7 19.3 19.7 19.9 19.3 20.2 C19 20.5 18.4 20.5 18 20.2 L16.7 19 C15.6 20.3 14.2 21.2 12.7 21.6 L12.7 23.4 C12.7 23.8 12.4 24.1 12 24.1 C11.6 24.1 11.3 23.8 11.3 23.4 L11.3 21.6 C9.8 21.2 8.4 20.3 7.3 19 L6 20.2 C5.6 20.5 5 20.5 4.7 20.2 C4.3 19.9 4.3 19.3 4.7 19 L6 17.8 C4.8 16.7 3.8 15.3 3.4 13.6 L1.6 13.6 C1.1 13.6 0.8 13.3 0.8 12.8 C0.8 12.3 1.1 12 1.6 12 L3.4 12 C3.8 10.3 4.8 8.9 6 7.8 L4.7 6.6 C4.3 6.3 4.3 5.7 4.7 5.4 C5 5.1 5.6 5.1 6 5.4 L7.3 6.6 C8.4 5.3 9.8 4.4 11.3 4 L11.3 2.2 C11.3 1.8 11.6 1.5 12 1.5 Z M12 8.5 C10.6 8.5 9.5 9.6 9.5 11 C9.5 12.4 10.6 13.5 12 13.5 C13.4 13.5 14.5 12.4 14.5 11 C14.5 9.6 13.4 8.5 12 8.5 Z",alert:"M12 2 L2 20 L22 20 Z M12 9 L12 13 M12 17 L12.01 17",trash:"M3 6 L3 20 C3 21.1 3.9 22 5 22 L19 22 C20.1 22 21 21.1 21 20 L21 6 M1 6 L23 6 M7 6 L7 4 C7 2.9 7.9 2 9 2 L15 2 C16.1 2 17 2.9 17 4 L17 6 M9 11 L9 17 M15 11 L15 17",edit:"M3 17.25 L3 21 L6.75 21 L17.81 9.94 L14.06 6.19 Z M20.71 7.04 C21.1 6.65 21.1 6.02 20.71 5.63 L18.37 3.29 C17.98 2.9 17.35 2.9 16.96 3.29 L15.12 5.12 L18.87 8.87 Z",download:"M12 2 L12 13 M5 10 L12 17 L19 10",upload:"M12 22 L12 11 M5 14 L12 7 L19 14",eye:"M12 5 C7 5 2.73 8.11 1 12.46 C2.73 16.89 7 20 12 20 C17 20 21.27 16.89 23 12.46 C21.27 8.11 17 5 12 5 Z M12 16 C14.2 16 16 14.2 16 12 C16 9.8 14.2 8 12 8 C9.8 8 8 9.8 8 12 C8 14.2 9.8 16 12 16 Z",eyeOff:"M12 5.69 C8.5 5.69 5.2 7.6 3.2 10.4 M21 19 L2 2 M9.88 9.88 C9.4 10.5 9 11.2 9 12 C9 14.21 10.79 16 13 16 C13.8 16 14.5 15.6 15.12 15.12 M18.8 10.4 C20.8 7.6 17.5 5.69 12 5.69",clock:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 C22 6.48 17.52 2 12 2 Z M12 20 C7.58 20 4 16.42 4 12 C4 7.58 7.58 4 12 4 C16.42 4 20 7.58 20 12 C20 16.42 16.42 20 12 20 Z M13 7 L11 7 L11 13 L16.25 15.85 L17 14.32 L13 12 Z",calendar:"M5 2 L5 4 L19 4 L19 2 M3 4 L3 20 C3 21.1 3.9 22 5 22 L19 22 C20.1 22 21 21.1 21 20 L21 4 M7 11 L7 13 L9 13 L9 11 L7 11 Z M12 11 L12 13 L14 13 L14 11 L12 11 Z M17 11 L17 13 L19 13 L19 11 L17 11 Z",filter:"M3 6 L21 6 L18 13 L18 20 L6 20 L6 13 Z",link:"M10 11 C10.8 10.3 12 10.2 12.7 10.2 L20 10.2 C21 10.2 21.8 11 21.8 12 L21.8 19 C21.8 20 21 20.8 20 20.8 L12.7 20.8 C11.7 20.8 10.9 20 10.9 19 L10.9 12 C10.9 11.9 10.91 11.8 10.92 11.7 M7 11 C7.8 10.3 6.5 10.2 5.8 10.2 L1 10.2 C0.1 10.2 0.2 11 0.2 12 L0.2 19 C0.2 20 0.9 20.8 1.8 20.8 L5.8 20.8 C6.8 20.8 7.6 20 7.6 19 L7.6 12 C7.6 11.9 7.59 11.8 7.58 11.7",lock:"M7 10 L7 7 C7 4.24 9.24 2 12 2 C14.76 2 17 4.24 17 7 L17 10 M5 10 L19 10 L19 20 C19 21.1 18.1 22 17 22 L7 22 C5.9 22 5 21.1 5 20 Z",unlock:"M7 10 L19 10 L19 20 C19 21.1 18.1 22 17 22 L7 22 C5.9 22 5 21.1 5 20 L5 10 L5 7 C5 4.24 7.24 2 10 2 C12.76 2 15 4.24 15 7 L13 7 C13 5.34 11.66 4 10 4 C8.34 4 7 5.34 7 7 Z",user:"M12 12 C13.66 12 15 10.66 15 9 C15 7.34 13.66 6 12 6 C10.34 6 9 7.34 9 9 C9 10.66 10.34 12 12 12 Z M12 22 C16.42 22 21 20 21 16 L21 14 C21 11.79 19.21 10 17 10 L7 10 C4.79 10 3 11.79 3 14 L3 16 C3 20 7.58 22 12 22 Z",copy:"M16 1 L4 1 C2.9 1 2 1.9 2 3 L2 17 L4 17 L4 3 L16 3 Z M20 5 L8 5 C6.9 5 6 5.9 6 7 L6 21 C6 22.1 6.9 23 8 23 L20 23 C21.1 23 22 22.1 22 21 L22 7 C22 5.9 21.1 5 20 5 Z",info:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 C22 6.48 17.52 2 12 2 Z M13 17 L11 17 L11 11 L13 11 Z M13 9 L11 9 L11 7 L13 7 Z",help:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 C22 6.48 17.52 2 12 2 Z M13 19 L11 19 L11 17 L13 17 Z M15.07 10.25 C14.29 11.29 13.5 12 13 12.9 L13 14 L11 14 L11 13 C11 11.52 11.79 10.29 12.93 9.07 C13.62 8.29 14.29 7.5 14.29 6.5 C14.29 5.42 13.47 4.6 12.4 4.6 C11.4 4.6 10.6 5.36 10.6 6.3 L8.6 6.2 C8.72 4.5 10.09 3.1 12.4 3.1 C14.84 3.1 16.3 4.5 16.3 6.42 C16.3 7.8 15.66 8.9 15.07 10.25 Z",spinner:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 M12 2 C6.48 2 2 6.48 2 12",loading:"M12 2 C6.48 2 2 6.48 2 12",moreVertical:"M12 8 C13.1 8 14 7.1 14 6 C14 4.9 13.1 4 12 4 C10.9 4 10 4.9 10 6 C10 7.1 10.9 8 12 8 Z M12 14 C13.1 14 14 13.1 14 12 C14 10.9 13.1 10 12 10 C10.9 10 10 10.9 10 12 C10 13.1 10.9 14 12 14 Z M12 20 C13.1 20 14 19.1 14 18 C14 16.9 13.1 16 12 16 C10.9 16 10 16.9 10 18 C10 19.1 10.9 20 12 20 Z",moreHorizontal:"M6 10 C4.9 10 4 10.9 4 12 C4 13.1 4.9 14 6 14 C7.1 14 8 13.1 8 12 C8 10.9 7.1 10 6 10 Z M18 10 C16.9 10 16 10.9 16 12 C16 13.1 16.9 14 18 14 C19.1 14 20 13.1 20 12 C20 10.9 19.1 10 18 10 Z M12 10 C10.9 10 10 10.9 10 12 C10 13.1 10.9 14 12 14 C13.1 14 14 13.1 14 12 C14 10.9 13.1 10 12 10 Z",reload:"M7 7 C4.24 7 2 9.24 2 12 C2 14.56 3.68 16.73 6 17.73 L6 15.95 C4.29 15.16 3 13.32 3 11.13 C3 8.82 4.82 7 7 7 Z M17 7 C19.76 7 22 9.24 22 12 C22 14.13 20.71 15.97 18.7 16.76 L18.7 18.54 C21.32 17.54 23 15.56 23 13 C23 10.24 20.76 8 18 8 Z M11.5 5 L14.5 8 L8.5 8 Z M8.5 16 L14.5 16 L11.5 19 Z",arrowRight:"M5 12 L19 12 M13 6 L19 12 L13 18",arrowLeft:"M19 12 L5 12 M11 6 L5 12 L11 18",arrowUp:"M12 19 L12 5 M6 11 L12 5 L18 11",arrowDown:"M12 5 L12 19 M6 13 L12 19 L18 13",star:"M12 2 L15.09 10.26 L24 10.26 L17.55 15.13 L19.64 23.39 L12 18.53 L4.36 23.39 L6.45 15.13 L0 10.26 L8.91 10.26 Z",heart:"M20.84 4.61 C20.02 3.78 18.98 3.37 17.93 3.37 C16.88 3.37 15.84 3.78 15.02 4.61 L12 7.63 L8.98 4.61 C7.30 2.92 4.71 2.92 3.02 4.61 C1.33 6.30 1.33 8.88 3.02 10.57 L12 19.58 L20.99 10.57 C22.68 8.88 22.68 6.30 20.84 4.61 Z",palette:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 C22 6.48 17.52 2 12 2 Z M7 12 C8.1 12 9 11.1 9 10 C9 8.9 8.1 8 7 8 C5.9 8 5 8.9 5 10 C5 11.1 5.9 12 7 12 Z M17 12 C18.1 12 19 11.1 19 10 C19 8.9 18.1 8 17 8 C15.9 8 15 8.9 15 10 C15 11.1 15.9 12 17 12 Z M12 17 C10.9 17 10 16.1 10 15 C10 13.9 10.9 13 12 13 C13.1 13 14 13.9 14 15 C14 16.1 13.1 17 12 17 Z M7 17 C5.9 17 5 16.1 5 15 C5 13.9 5.9 13 7 13 C8.1 13 9 13.9 9 15 C9 16.1 8.1 17 7 17 Z M17 17 C15.9 17 15 16.1 15 15 C15 13.9 15.9 13 17 13 C18.1 13 19 13.9 19 15 C19 16.1 18.1 17 17 17 Z",component:"M5 3 L19 3 L19 9 L5 9 Z M5 11 L19 11 L19 17 L5 17 Z M3 20 L21 20",table:"M3 4 L21 4 M3 4 L3 20 L21 20 L21 4 M3 8 L21 8 M3 12 L21 12 M3 16 L21 16 M8 4 L8 20 M13 4 L13 20 M18 4 L18 20",layout:"M3 3 L21 3 L21 21 L3 21 Z M3 8 L21 8 M3 3 L3 21 M8 8 L8 21",moon:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z",sun:"M12 3v2M12 19v2M5.64 5.64l1.42 1.42M16.95 16.95l1.41 1.41M3 12h2M19 12h2M5.64 18.36l1.41-1.41M16.95 7.05l1.41-1.41M12 7a5 5 0 1 0 0 10A5 5 0 0 0 12 7z","bar-chart":"M3 3 L3 20 L21 20 M5 16 L5 9 M12 16 L12 5 M19 16 L19 8","trending-up":"M23 6 L13.5 15.5 M23 6 L23 13 L16 13 M1 23 L6.5 17.5 L13 24 L23 6","trending-down":"M23 18 L13.5 8.5 M23 18 L23 11 L16 11 M1 1 L6.5 6.5 L13 0 L23 18",send:"M16 8 L2 5 L9.5 12 L2 19 L16 16 M7 12 L16 12",bot:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 C22 6.48 17.52 2 12 2 Z M7 8 L7 10 L9 10 L9 8 Z M15 8 L15 10 L17 10 L17 8 Z M9 14 L15 14 M12 14 L12 18",paperclip:"M12.5 2 C9.46 2 7 4.46 7 7.5 C7 10.54 9.46 13 12.5 13 L18 13 C18.55 13 19 12.55 19 12 C19 11.45 18.55 11 18 11 L12.5 11 C10.57 11 9 9.43 9 7.5 C9 5.57 10.57 4 12.5 4 C14.43 4 16 5.57 16 7.5 L16 15 C16 18.31 13.31 21 10 21 C6.69 21 4 18.31 4 15 L4 7 C4 5.9 4.9 5 6 5 C7.1 5 8 5.9 8 7 L8 15 C8 16.1 8.9 17 10 17 C11.1 17 12 16.1 12 15 L12 7.5","pie-chart":"M21.21 15.89 L12 12 L12 2.69 A10 10 0 0 1 21.21 15.89 M12 12 L5.5 5.5 A10 10 0 0 0 2 12 M2 12 A10 10 0 0 0 12 22 A10 10 0 0 0 12 12",slash:"M21 3 L3 21",file:"M14 2 L6 2 C4.9 2 4 2.9 4 4 L4 20 C4 21.1 4.9 22 6 22 L18 22 C19.1 22 20 21.1 20 20 L20 8 Z M14 2 L14 8 L20 8 M16 13 L8 13 M16 17 L8 17 M10 9 L8 9",zap:"M13 2 L3 14 L12 14 L11 22 L21 10 L12 10 Z",hardDrive:"M22 12 L2 12 M2 9 C2 7.9 2.9 7 4 7 L20 7 C21.1 7 22 7.9 22 9 L22 19 C22 20.1 21.1 21 20 21 L4 21 C2.9 21 2 20.1 2 19 Z M6 17 L6.01 17",folder:"M20 20 C21.1 20 22 19.1 22 18 L22 8 C22 6.9 21.1 6 20 6 L12.1 6 C11.43 6 10.8 5.68 10.41 5.13 L9.6 3.9 C9.22 3.34 8.59 3 7.93 3 L4 3 C2.9 3 2 3.9 2 5 L2 18 C2 19.1 2.9 20 4 20 Z",tag:"M12.59 2.59 C12.21 2.21 11.7 2 11.17 2 L4 2 C2.9 2 2 2.9 2 4 L2 11.17 C2 11.7 2.21 12.21 2.59 12.59 L11.29 21.29 C12.07 22.07 13.34 22.07 14.12 21.29 L20.7 14.71 C21.48 13.93 21.48 12.66 20.7 11.88 Z M7.5 7.5 L7.51 7.5",gitBranch:"M6 3 L6 15 M6 6 C7.66 6 9 4.66 9 3 C9 1.34 7.66 0 6 0 C4.34 0 3 1.34 3 3 C3 4.66 4.34 6 6 6 Z M6 24 C7.66 24 9 22.66 9 21 C9 19.34 7.66 18 6 18 C4.34 18 3 19.34 3 21 C3 22.66 4.34 24 6 24 Z M18 9 C19.66 9 21 7.66 21 6 C21 4.34 19.66 3 18 3 C16.34 3 15 4.34 15 6 C15 7.66 16.34 9 18 9 Z M18 9 C18 13 15 15 9 15",image:"M3 3 L21 3 L21 21 L3 21 Z M8.5 10 C9.6 10 10.5 9.1 10.5 8 C10.5 6.9 9.6 6 8.5 6 C7.4 6 6.5 6.9 6.5 8 C6.5 9.1 7.4 10 8.5 10 Z M21 15 L16 10 L5 21",code:"M9 18 L3 12 L9 6 M15 6 L21 12 L15 18",map:"M9 3 L3 5 L3 19 L9 17 M9 3 L15 5 M9 3 L9 17 M15 5 L21 3 L21 17 L15 19 M15 5 L15 19 M9 17 L15 19",sparkles:"M12 2 L14 9 L21 11 L14 13 L12 20 L10 13 L3 11 L10 9 Z M19 3 L20 5.5 L22.5 6.5 L20 7.5 L19 10 L18 7.5 L15.5 6.5 L18 5.5 Z",share:"M18 8 C19.66 8 21 6.66 21 5 C21 3.34 19.66 2 18 2 C16.34 2 15 3.34 15 5 C15 6.66 16.34 8 18 8 Z M6 15 C7.66 15 9 13.66 9 12 C9 10.34 7.66 9 6 9 C4.34 9 3 10.34 3 12 C3 13.66 4.34 15 6 15 Z M18 22 C19.66 22 21 20.66 21 19 C21 17.34 19.66 16 18 16 C16.34 16 15 17.34 15 19 C15 20.66 16.34 22 18 22 Z M8.59 13.51 L15.42 17.49 M15.41 6.51 L8.59 10.49",ellipsis:"M6 12 C6 13.1 5.1 14 4 14 C2.9 14 2 13.1 2 12 C2 10.9 2.9 10 4 10 C5.1 10 6 10.9 6 12 Z M14 12 C14 13.1 13.1 14 12 14 C10.9 14 10 13.1 10 12 C10 10.9 10.9 10 12 10 C13.1 10 14 10.9 14 12 Z M22 12 C22 13.1 21.1 14 20 14 C18.9 14 18 13.1 18 12 C18 10.9 18.9 10 20 10 C21.1 10 22 10.9 22 12 Z",zoomIn:"M11 3 C15.42 3 19 6.58 19 11 C19 15.42 15.42 19 11 19 C6.58 19 3 15.42 3 11 C3 6.58 6.58 3 11 3 M21 21 L16.65 16.65 M11 8 L11 14 M8 11 L14 11",zoomOut:"M11 3 C15.42 3 19 6.58 19 11 C19 15.42 15.42 19 11 19 C6.58 19 3 15.42 3 11 C3 6.58 6.58 3 11 3 M21 21 L16.65 16.65 M8 11 L14 11",maximize:"M3 8 L3 3 L8 3 M16 3 L21 3 L21 8 M21 16 L21 21 L16 21 M8 21 L3 21 L3 16",fullscreen:"M15 3 L21 3 L21 9 M9 21 L3 21 L3 15 M21 3 L14 10 M3 21 L10 14",fullscreenExit:"M20 10 L14 10 L14 4 M4 14 L10 14 L10 20 M14 10 L21 3 M10 14 L3 21",orbit:"M21 12 C21 9.52 16.97 7.5 12 7.5 C7.03 7.5 3 9.52 3 12 C3 14.48 7.03 16.5 12 16.5 C16.97 16.5 21 14.48 21 12 M22.8 12 C22.8 13 22 13.8 21 13.8 C20 13.8 19.2 13 19.2 12 C19.2 11 20 10.2 21 10.2 C22 10.2 22.8 11 22.8 12"},nt=Se.forwardRef((l,r)=>{var c=l,{name:e,size:t=24,className:n="","aria-label":a}=c,i=Ie(c,["name","size","className","aria-label"]);const u=eA[e];return u?f.jsx("svg",ee($({ref:r,viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":a?void 0:!0,"aria-label":a,className:n},i),{children:f.jsx("path",{d:u})})):(console.warn(`Icon "${e}" does not exist in ICONS map`),null)});nt.displayName="Icon";function tA(e){return e.split(" ").slice(0,2).map(t=>t[0]).join("").toUpperCase()}const md={amber:"linear-gradient(135deg, rgb(var(--accent-primary)), rgb(var(--accent-primary-deep)))",emerald:"linear-gradient(135deg, rgb(var(--status-emerald)), rgb(var(--semantic-emerald-fg)))",rose:"linear-gradient(135deg, rgb(var(--status-rose)), rgb(var(--status-rose-deep)))",cyan:"linear-gradient(135deg, rgb(var(--status-cyan)), rgb(var(--status-cyan-deep)))",violet:"linear-gradient(135deg, rgb(var(--status-violet)), rgb(var(--semantic-violet-fg)))",neutral:"linear-gradient(135deg, rgb(var(--status-neutral)), rgb(var(--semantic-neutral-fg)))"},Dw=Object.keys(md);function nA(e){let t=0;for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);t=(t<<5)-t+a,t=t&t}return Math.abs(t)}function aA(e){const t=nA(e)%Dw.length;return Dw[t]}function sA(e,t){if(e&&e in md)return md[e];if(e)return e;if(t){const n=aA(t);return md[n]}return md.amber}const iA=Se.forwardRef((p,m)=>{var g=p,{name:e,src:t,size:n="md",shape:a="circle",status:i,color:r,decorative:l,className:c="",style:u}=g,h=Ie(g,["name","src","size","shape","status","color","decorative","className","style"]);const[v,x]=j.useState(!1),b=tA(e),_=!t||v,S=["avatar",`avatar--${n}`,`avatar--${a}`,c].filter(Boolean).join(" "),M=_?{background:sA(r,e)}:{display:"none"},C=_?{display:"none"}:{};return f.jsxs("div",ee($({ref:m,className:S,style:u,role:l?void 0:"img","aria-label":l?void 0:i?`${e} (${i})`:e,"aria-hidden":l?"true":void 0},h),{children:[f.jsx("div",{className:"avatar__initials",style:M,children:b}),t&&f.jsx("img",{className:"avatar__image",src:t,alt:"",onError:()=>x(!0),style:C}),i&&f.jsx("div",{className:`avatar__status avatar__status--${i}`,"aria-label":i})]}))});iA.displayName="Avatar";const Bn=Se.forwardRef((u,c)=>{var h=u,{variant:e="primary",size:t="md",icon:n,className:a="",disabled:i,type:r="button"}=h,l=Ie(h,["variant","size","icon","className","disabled","type"]);const m=["btn",`btn--${e}`,`btn--${t}`,n?"btn--icon":"",a].filter(Boolean).join(" ");return f.jsx("button",$({ref:c,type:r,disabled:i,className:m},l))});Bn.displayName="Button";const fs=Se.forwardRef((l,r)=>{var c=l,{variant:e="neutral",form:t="default",className:n="",children:a}=c,i=Ie(c,["variant","form","className","children"]);const u=["chip",`chip--${t}`,t==="default"&&`chip--${e}`,n].filter(Boolean).join(" ");return f.jsxs("span",ee($({ref:r,className:u},i),{children:[t==="default"&&f.jsx("span",{className:"chip__dot"}),t==="env"&&f.jsx("span",{className:"chip__dot chip__dot--env"}),a]}))});fs.displayName="Chip";const Ux=Se.forwardRef((r,i)=>{var l=r,{color:e="cyan",pulse:t=!1,className:n=""}=l,a=Ie(l,["color","pulse","className"]);const c=["badge",`badge--${e}`,t&&"badge--pulse",n].filter(Boolean).join(" ");return f.jsx("span",$({ref:i,className:c},a))});Ux.displayName="Badge";const Fx=Se.forwardRef((l,r)=>{var c=l,{color:e="cyan",pulse:t=!1,className:n="",role:a="img"}=c,i=Ie(c,["color","pulse","className","role"]);const u=["status-badge",`status-badge--${e}`,t&&"status-badge--pulse",n].filter(Boolean).join(" ");return f.jsx("div",$({ref:r,role:a,className:u},i))});Fx.displayName="StatusBadge";const Ld=Se.forwardRef((r,i)=>{var l=r,{mono:e=!1,error:t=!1,className:n=""}=l,a=Ie(l,["mono","error","className"]);const c=["text-input",e&&"text-input--mono",t&&"text-input--error",n].filter(Boolean).join(" ");return f.jsx("input",$({type:"text",ref:i,className:c},a))});Ld.displayName="TextInput";const Px=Se.forwardRef((r,i)=>{var l=r,{mono:e=!1,error:t=!1,className:n=""}=l,a=Ie(l,["mono","error","className"]);const c=["text-area",e&&"text-area--mono",t&&"text-area--error",n].filter(Boolean).join(" ");return f.jsx("textarea",$({ref:i,className:c},a))});Px.displayName="TextArea";const rA=Se.forwardRef((r,i)=>{var l=r,{mono:e=!1,error:t=!1,className:n=""}=l,a=Ie(l,["mono","error","className"]);const c=["number-input",e&&"number-input--mono",t&&"number-input--error",n].filter(Boolean).join(" ");return f.jsx("input",$({ref:i,type:"number",className:c},a))});rA.displayName="NumberInput";const oA="[data-dropdown-item]:not([data-disabled])";function Ap({triggerRef:e,panelRef:t,isOpen:n,onClose:a,itemSelector:i=oA,restoreFocus:r=!0}){const[l,c]=j.useState(null),u=j.useRef(!1),h=j.useCallback(()=>{const m=t.current;return m?Array.from(m.querySelectorAll(i)).map(p=>p.getAttribute("data-dropdown-item")).filter(p=>p!==null&&p.length>0):[]},[t,i]);return j.useEffect(()=>{var m;if(n&&!u.current){u.current=!0;const p=h();c(g=>{var v;return g&&p.includes(g)?g:(v=p[0])!=null?v:null})}else!n&&u.current&&(u.current=!1,c(null),r&&((m=e.current)==null||m.focus()))},[n,h,r,e]),j.useEffect(()=>{if(!n)return;const m=g=>{const v=g.target,x=e.current,b=t.current;x!=null&&x.contains(v)||b!=null&&b.contains(v)||a()},p=g=>{g.key==="Escape"&&(g.preventDefault(),a())};return document.addEventListener("mousedown",m),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",p)}},[n,a,e,t]),j.useEffect(()=>{if(!n)return;const m=e.current,p=t.current,g=v=>{var x;const b=h();if(b.length===0)return;let _=b.indexOf(l!=null?l:"");_<0&&(_=0);const S=b.length-1,M=(x=v.target)==null?void 0:x.hasAttribute("data-dropdown-item");switch(v.key){case"ArrowDown":{v.preventDefault();const C=_<S?_+1:0;c(b[C]);break}case"ArrowUp":{v.preventDefault();const C=_>0?_-1:S;c(b[C]);break}case"Tab":{if(!M)return;v.preventDefault();const C=v.shiftKey?-1:1,k=(_+C+b.length)%b.length;c(b[k]);break}case"Home":{v.preventDefault(),c(b[0]);break}case"End":{v.preventDefault(),c(b[S]);break}}};return m==null||m.addEventListener("keydown",g),p==null||p.addEventListener("keydown",g),()=>{m==null||m.removeEventListener("keydown",g),p==null||p.removeEventListener("keydown",g)}},[n,l,h,e,t]),{focusedValue:l,setFocusedValue:c}}const Ip=(e="bottom-start")=>`dropdown-panel--placement-${e}`,vk=j.createContext(void 0);function xk(e){const t=j.useContext(vk);if(!t)throw new Error(`${e} must be used inside <Select>`);return t}const bk=Se.forwardRef((e,t)=>{var pe;const{placeholder:n="Select…",error:a=!1,disabled:i=!1,id:r,name:l,className:c="",ariaLabel:u,children:h,placement:m="bottom-start"}=e,p=e["data-testid"],g=e.multiple?"multi":"single",v=g==="single"&&e.value!==void 0,x=g==="multi"&&e.values!==void 0,[b,_]=j.useState(g==="single"&&(pe=e.defaultValue)!=null?pe:""),[S,M]=j.useState(()=>{var H;return new Set(g==="multi"?(H=e.defaultValues)!=null?H:[]:[])}),C=j.useMemo(()=>{var H,te;if(g==="single"){const ie=v?(H=e.value)!=null?H:"":b;return ie?new Set([ie]):new Set}return x?new Set((te=e.values)!=null?te:[]):S},[g,v,x,e.value,e.values,b,S]),[k,L]=j.useState(!1),E=j.useRef(null),I=j.useRef(null),T=j.useRef(null),[A,R]=j.useState(new Map),D=j.useCallback((H,te)=>(R(ie=>{if(ie.get(H)===te)return ie;const W=new Map(ie);return W.set(H,te),W}),()=>{R(ie=>{if(!ie.has(H))return ie;const W=new Map(ie);return W.delete(H),W})}),[]),O=j.useCallback(H=>{i||L(H)},[i]),B=j.useCallback(()=>L(!1),[]),{focusedValue:z,setFocusedValue:U}=Ap({triggerRef:E,panelRef:I,isOpen:k,onClose:B});j.useEffect(()=>{if(k&&C.size>0&&!z){const H=C.values().next().value;H&&U(H)}},[k,C,z,U]);const F=j.useCallback(H=>{var te,ie;if(g==="single")v||_(H),(te=e.onChange)==null||te.call(e,H),L(!1);else{const W=new Set(C);W.has(H)?W.delete(H):W.add(H),x||M(W),(ie=e.onValuesChange)==null||ie.call(e,Array.from(W))}},[g,v,x,C,e]),Y={mode:g,isOpen:k,onOpenChange:O,selectedValues:C,onValueChange:F,focusedValue:z,setFocusedValue:U,registerItem:D,panelRef:I},X=j.useMemo(()=>{var W,ge;if(C.size===0)return f.jsx("span",{className:"select__placeholder",children:n});if(g==="single"){const we=C.values().next().value;return f.jsx("span",{className:"select__value",children:(W=A.get(we))!=null?W:we})}const H=Array.from(C),te=H[0],ie=(ge=A.get(te))!=null?ge:te;return H.length===1?f.jsx("span",{className:"select__value",children:ie}):f.jsxs("span",{className:"select__value",children:[ie," ",f.jsxs("span",{className:"select__value-count",children:["+",H.length-1]})]})},[C,A,g,n]),ne=H=>{k||(H.key==="ArrowDown"||H.key==="ArrowUp"||H.key==="Enter"||H.key===" ")&&(H.preventDefault(),O(!0))},q=l&&C.size>0?Array.from(C).map(H=>f.jsx("input",{type:"hidden",name:l,value:H},H)):null,he=H=>{E.current=H,typeof t=="function"?t(H):t&&(t.current=H)};return f.jsx(vk.Provider,{value:Y,children:f.jsxs("div",{ref:T,className:["select",a&&"select--error",i&&"select--disabled",c].filter(Boolean).join(" "),"data-testid":p,children:[f.jsxs("button",{ref:he,id:r,type:"button",className:"select__trigger","aria-haspopup":"listbox","aria-expanded":k,"aria-invalid":a||void 0,"aria-label":u,disabled:i,onClick:()=>O(!k),onKeyDown:ne,children:[X,f.jsx(nt,{name:"chevronDown",size:14,className:`select__chevron ${k?"select__chevron--open":""}`})]}),q,f.jsx("div",{ref:I,role:"listbox","aria-multiselectable":g==="multi"?!0:void 0,className:`dropdown-panel ${Ip(m)} select__panel`,hidden:!k,children:h})]})})});bk.displayName="Select";function lA({value:e,icon:t,description:n,disabled:a=!1,children:i}){const{selectedValues:r,onValueChange:l,focusedValue:c,setFocusedValue:u,registerItem:h,mode:m}=xk("Select.Item"),p=j.useRef(null),g=r.has(e),v=c===e;return j.useEffect(()=>h(e,i),[e,i,h]),j.useEffect(()=>{var x;v&&((x=p.current)==null||x.focus())},[v]),f.jsxs("button",{ref:p,type:"button",role:"option","aria-selected":g,tabIndex:v?0:-1,"data-dropdown-item":e,"data-disabled":a||void 0,disabled:a,onClick:()=>l(e),onMouseEnter:()=>!a&&u(e),className:["dropdown-item",g&&"dropdown-item--selected",v&&"dropdown-item--focused",a&&"dropdown-item--disabled"].filter(Boolean).join(" "),children:[t?f.jsx("span",{className:"dropdown-item__leading",children:f.jsx(nt,{name:t,size:16})}):null,f.jsxs("span",{className:"dropdown-item__body",children:[f.jsx("span",{className:"dropdown-item__label",children:i}),n&&f.jsx("span",{className:"dropdown-item__description",children:n})]}),m==="single"&&g&&f.jsx("span",{className:"dropdown-item__trailing",children:f.jsx(nt,{name:"check",size:14})})]})}function cA({value:e,description:t,disabled:n=!1,children:a}){const{selectedValues:i,onValueChange:r,focusedValue:l,setFocusedValue:c,registerItem:u}=xk("Select.CheckboxItem"),h=j.useRef(null),m=i.has(e),p=l===e;return j.useEffect(()=>u(e,a),[e,a,u]),j.useEffect(()=>{var g;p&&((g=h.current)==null||g.focus())},[p]),f.jsxs("button",{ref:h,type:"button",role:"option","aria-selected":m,tabIndex:p?0:-1,"data-dropdown-item":e,"data-disabled":n||void 0,disabled:n,onClick:()=>r(e),onMouseEnter:()=>!n&&c(e),className:["dropdown-item",p&&"dropdown-item--focused",n&&"dropdown-item--disabled"].filter(Boolean).join(" "),children:[f.jsx("span",{className:"dropdown-item__leading",children:f.jsx("input",{type:"checkbox",className:"dropdown-item__checkbox",checked:m,readOnly:!0,tabIndex:-1,"aria-hidden":"true"})}),f.jsxs("span",{className:"dropdown-item__body",children:[f.jsx("span",{className:"dropdown-item__label",children:a}),t&&f.jsx("span",{className:"dropdown-item__description",children:t})]})]})}function uA(){return f.jsx("div",{role:"separator",className:"dropdown-separator"})}function dA({children:e}){return f.jsx("div",{className:"dropdown-section-title",children:e})}const cp=Object.assign(bk,{Item:lA,CheckboxItem:cA,Separator:uA,SectionTitle:dA}),hA=Se.forwardRef((r,i)=>{var l=r,{indeterminate:e=!1,className:t="","aria-checked":n}=l,a=Ie(l,["indeterminate","className","aria-checked"]);const c=Se.useRef(null),u=Se.useCallback(m=>{c.current=m,typeof i=="function"?i(m):i&&(i.current=m)},[i]);Se.useEffect(()=>{c.current&&(c.current.indeterminate=e)},[e]);const h=["tri-state",e&&"tri-state--indeterminate",t].filter(Boolean).join(" ");return f.jsx("input",ee($({ref:u,type:"checkbox",className:h},a),{"aria-checked":n!=null?n:e?"mixed":a.checked!==void 0?!!a.checked:void 0}))});hA.displayName="TriState";const fA=Se.forwardRef((p,m)=>{var g=p,{label:e,htmlFor:t,required:n=!1,disabled:a=!1,error:i,errorId:r,hint:l,children:c,className:u=""}=g,h=Ie(g,["label","htmlFor","required","disabled","error","errorId","hint","children","className"]);const v=["field",a?"field--disabled":"",u].filter(Boolean).join(" ");return f.jsxs("div",ee($({ref:m,className:v},h),{children:[e&&f.jsxs("label",{className:"field__label",htmlFor:t,children:[f.jsx("span",{children:e}),n&&f.jsx("span",{className:"field__required",children:"*"}),l&&f.jsx("span",{className:"field__hint",children:l})]}),f.jsx("div",{className:"field__input",children:c}),i&&f.jsx("div",{className:"field__error",id:r,children:i})]}))});fA.displayName="Field";const Td={emerald:"rgb(16 185 129)",amber:"rgb(245 158 11)",rose:"rgb(244 63 94)",cyan:"rgb(34 211 238)",violet:"rgb(139 92 246)",neutral:"rgb(var(--canvas-fg-2))"};function pA(e){return e in Td?Td[e]:e}function mA(e){return e.map(([t,n],a)=>(a?"L":"M")+t.toFixed(2)+","+n.toFixed(2)).join(" ")}const Hx=Se.forwardRef((m,h)=>{var p=m,{data:e,width:t=88,height:n=28,color:a="emerald",area:i=!0,label:r,className:l="",style:c}=p,u=Ie(p,["data","width","height","color","area","label","className","style"]);const g=Se.useId(),v=Se.useMemo(()=>{if(!e||e.length<2)return null;const S=Math.min(...e),M=Math.max(...e),C=e.map((E,I)=>[I/(e.length-1)*t,n-2-(E-S)/(M-S||1)*(n-4)]),k=mA(C),L=`${k} L${t},${n} L0,${n} Z`;return{line:k,fill:L}},[e,t,n]);if(!v)return null;const x=pA(String(a)),{line:b,fill:_}=v;return f.jsxs("svg",ee($({ref:h,role:"img","aria-label":r!=null?r:"trend sparkline",width:t,height:n,viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"none",style:$({display:"block"},c),className:l},u),{children:[i&&f.jsx("defs",{children:f.jsxs("linearGradient",{id:g,x1:"0",y1:"0",x2:"0",y2:"1",children:[f.jsx("stop",{offset:"0%",stopColor:x,stopOpacity:"0.22"}),f.jsx("stop",{offset:"100%",stopColor:x,stopOpacity:"0"})]})}),i&&f.jsx("path",{d:_,fill:`url(#${g})`}),f.jsx("path",{d:b,stroke:x,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}))});Hx.displayName="Sparkline";const Mc=Se.forwardRef((g,p)=>{var v=g,{label:e="",value:t="",delta:n,color:a="cyan",icon:i,sparkData:r,meta:l,metaIcon:c,className:u="","aria-label":h}=v,m=Ie(v,["label","value","delta","color","icon","sparkData","meta","metaIcon","className","aria-label"]);const x=["stat-tile",`stat-tile--${a}`,u].filter(Boolean).join(" ");return f.jsxs("div",ee($({ref:p,className:x,"aria-label":h!=null?h:`${e}: ${t}`},m),{children:[f.jsxs("div",{className:"stat-tile__header",children:[f.jsx("div",{className:"stat-tile__label",children:e}),i&&f.jsx(nt,{name:i,size:14,"aria-hidden":"true"})]}),f.jsx("div",{className:"stat-tile__value",children:t}),(n||l)&&f.jsxs("div",{className:"stat-tile__footer",children:[n&&f.jsxs("span",{className:`stat-tile__delta stat-tile__delta--${n.direction||"up"}`,children:[f.jsxs("span",{className:"stat-tile__delta-value",children:[n.direction==="down"?"−":"+",Math.abs(n.value)]}),n.label&&f.jsx("span",{className:"stat-tile__delta-label",children:n.label})]}),l&&f.jsxs("div",{className:"stat-tile__meta",children:[c&&f.jsx(nt,{name:c,size:12,"aria-hidden":"true"}),f.jsx("span",{className:"stat-tile__meta-text",children:l})]})]}),r&&f.jsx("div",{className:"stat-tile__sparkline",children:f.jsx(Hx,{data:r,width:88,height:28,color:a||"cyan"})})]}))});Mc.displayName="StatTile";const gA=Se.forwardRef((r,i)=>{var l=r,{columns:e=4,className:t="",children:n}=l,a=Ie(l,["columns","className","children"]);const c=["stat-grid",`stat-grid--cols-${e}`,t].filter(Boolean).join(" ");return f.jsx("div",ee($({ref:i,className:c},a),{children:n}))});gA.displayName="StatGrid";const Es=Se.forwardRef((r,i)=>{var l=r,{className:e="",children:t,tone:n="amber"}=l,a=Ie(l,["className","children","tone"]);const c=["version-pill",`version-pill--${n}`,e].filter(Boolean).join(" ");return f.jsx("span",ee($({ref:i,className:c},a),{children:t}))});Es.displayName="VersionPill";const ps=Se.forwardRef((c,l)=>{var u=c,{value:e,onChange:t,options:n,disabled:a=!1,className:i=""}=u,r=Ie(u,["value","onChange","options","disabled","className"]);const h=["segmented-control",a?"segmented-control--disabled":"",i].filter(Boolean).join(" "),m=j.useRef([]),p=j.useCallback((x,b)=>{var _;const S=n.map((k,L)=>k.disabled?null:L).filter(k=>k!==null),M=S.indexOf(b);let C;x.key==="ArrowRight"||x.key==="ArrowDown"?(x.preventDefault(),C=S[(M+1)%S.length]):(x.key==="ArrowLeft"||x.key==="ArrowUp")&&(x.preventDefault(),C=S[(M-1+S.length)%S.length]),C!==void 0&&((_=m.current[C])==null||_.focus(),t(n[C].value))},[n,t]),g=n.some(x=>x.value===e),v=n.findIndex(x=>!x.disabled);return f.jsx("div",ee($({ref:l,className:h,role:"radiogroup"},r),{children:n.map((x,b)=>{const _=e===x.value,S=_||!g&&b===v?0:-1;return f.jsx("button",{ref:M=>{m.current[b]=M},className:`segmented-control__segment ${_?"segmented-control__segment--active":""}`,onClick:()=>!a&&!x.disabled&&t(x.value),onKeyDown:M=>p(M,b),type:"button",role:"radio","aria-checked":_,disabled:a||x.disabled,tabIndex:S,children:x.label},x.value)})}))});ps.displayName="SegmentedControl";const yA=Se.forwardRef((g,p)=>{var v=g,{columns:e,data:t,rowKey:n,selectable:a=!1,selectedRows:i=[],onSelectRows:r,onRowClick:l,onSort:c,emptyState:u,className:h=""}=v,m=Ie(v,["columns","data","rowKey","selectable","selectedRows","onSelectRows","onRowClick","onSort","emptyState","className"]);const[x,b]=j.useState(null),[_,S]=j.useState("asc"),M=j.useRef(null),C=t.length>0&&i.length===t.length,k=i.length>0&&i.length<t.length;j.useEffect(()=>{M.current&&(M.current.indeterminate=k)},[k]);const L=(D,O)=>typeof n=="function"?n(D,O):D[n],E=()=>{C?r==null||r([]):r==null||r(t.map((D,O)=>L(D,O)))},I=D=>{i.includes(D)?r==null||r(i.filter(O=>O!==D)):r==null||r([...i,D])},T=D=>{x===D?_==="asc"?(S("desc"),c==null||c(D,"desc")):(b(null),c==null||c(D,null)):(b(D),S("asc"),c==null||c(D,"asc"))},A=(D,O)=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),T(O))},R=["table",h].filter(Boolean).join(" ");return f.jsxs("table",ee($({ref:p,className:R},m),{children:[f.jsx("thead",{className:"table__head",children:f.jsxs("tr",{className:"table__row",children:[a&&f.jsx("th",{className:"table__header table__header--checkbox",style:{width:"30px"},children:f.jsx("input",{ref:M,type:"checkbox",className:"table__checkbox",checked:C,onChange:E,"aria-label":"Select all rows"})}),e.map(D=>{const O=String(D.key),B=x===O,z=B?_==="asc"?"ascending":"descending":D.sortable?"none":void 0;return f.jsx("th",{className:`table__header ${D.sortable?"table__header--sortable":""}`,style:{width:D.width},"aria-sort":z,tabIndex:D.sortable?0:void 0,onClick:()=>D.sortable&&T(O),onKeyDown:D.sortable?U=>A(U,O):void 0,children:f.jsxs("div",{className:"table__header-content",children:[D.label,B&&f.jsx(nt,{name:_==="asc"?"chevronUp":"chevronDown",size:14,className:"table__sort-icon"})]})},O)})]})}),f.jsx("tbody",{className:"table__body",children:t.length===0&&u?f.jsx("tr",{className:"table__row",children:f.jsx("td",{className:"table__cell table__cell--empty",colSpan:e.length+(a?1:0),children:u})}):t.map((D,O)=>{const B=L(D,O),z=i.includes(B),U=!!l;return f.jsxs("tr",{"data-row-key":B,className:["table__row",z?"table__row--selected":"",U?"table__row--clickable":""].filter(Boolean).join(" "),onClick:U?()=>l(D,B):void 0,onKeyDown:U?F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),l(D,B))}:void 0,tabIndex:U?0:void 0,children:[a&&f.jsx("td",{className:"table__cell table__cell--checkbox",children:f.jsx("input",{type:"checkbox",className:"table__checkbox",checked:z,"aria-label":`Select row ${B}`,onChange:()=>I(B),onClick:F=>F.stopPropagation()})}),e.map(F=>f.jsx("td",{className:"table__cell",children:F.render?F.render(D[F.key],D,O):D[F.key]},`${B}-${String(F.key)}`))]},B)})})]}))});yA.displayName="Table";const Ad=Se.forwardRef((m,h)=>{var p=m,{icon:e,label:t,count:n,active:a=!1,depth:i=0,onClick:r,className:l="",type:c="button"}=p,u=Ie(p,["icon","label","count","active","depth","onClick","className","type"]);const g=["nav-item",a&&"nav-item--active",i===1&&"nav-item--depth-1",l].filter(Boolean).join(" ");return f.jsxs("button",ee($({ref:h,type:c,className:g,onClick:r,"aria-current":a?"page":void 0},u),{children:[i===0&&e&&f.jsx(nt,{name:e,size:16,className:"nav-item__icon"}),f.jsx("span",{className:"nav-item__label",children:t}),n!==void 0&&f.jsx("span",{className:"nav-item__count",children:n})]}))});Ad.displayName="NavItem";const qx=Se.forwardRef((u,c)=>{var h=u,{title:e,version:t,collapsed:n=!1,action:a,className:i="","aria-label":r}=h,l=Ie(h,["title","version","collapsed","action","className","aria-label"]);const m=["app-title",n&&"app-title--collapsed",i].filter(Boolean).join(" "),p=r!=null?r:t?`${e} ${t}`:e;return f.jsxs("div",ee($({ref:c,className:m,"aria-label":p,role:"banner"},l),{children:[f.jsx("div",{className:"app-title__mark","aria-hidden":"true"}),!n&&f.jsxs("div",{className:"app-title__text",children:[f.jsx("div",{className:"app-title__name",children:e}),t&&f.jsx("span",{className:"app-title__version",children:t})]}),a&&f.jsx("div",{className:"app-title__action",children:a})]}))});qx.displayName="AppTitle";const Ev=Se.forwardRef((x,v)=>{var b=x,{sections:e,activeItemId:t,collapsed:n=!1,onCollapse:a,onSelectItem:i,defaultExpandedIds:r,expandedIds:l,onExpandedChange:c,showCollapseToggle:u=!0,appTitle:h,footer:m,className:p=""}=b,g=Ie(b,["sections","activeItemId","collapsed","onCollapse","onSelectItem","defaultExpandedIds","expandedIds","onExpandedChange","showCollapseToggle","appTitle","footer","className"]);var I;const _=l!==void 0,[S,M]=j.useState(()=>new Set(r)),C=_?new Set(l):S,k=T=>{const A=new Set(C);A.has(T)?A.delete(T):A.add(T),_||M(A),c==null||c(Array.from(A))},L=["sidebar",n&&"sidebar--collapsed",p].filter(Boolean).join(" "),E=f.jsx("button",{type:"button",className:"sidebar__toggle",onClick:()=>a==null?void 0:a(!n),"aria-label":n?"Expand sidebar":"Collapse sidebar",children:f.jsx(nt,{name:n?"chevronRight":"chevronLeft",size:16})});return f.jsxs("div",ee($({ref:v,className:L},g),{children:[h?f.jsxs(f.Fragment,{children:[f.jsx(qx,ee($({},h),{collapsed:n,action:n?h.action:(I=h.action)!=null?I:E})),n&&E]}):u&&E,f.jsx("nav",{className:"sidebar__nav","aria-label":"Sidebar navigation",children:e.map(T=>f.jsxs("div",{className:"sidebar__section",children:[!n&&f.jsx("div",{className:"sidebar__section-title",children:T.title}),f.jsx("div",{className:"sidebar__items",children:T.items.map(A=>{const R=A.children&&A.children.length>0,D=C.has(A.id),O=t===A.id;return f.jsxs(Se.Fragment,{children:[f.jsxs("button",{type:"button",className:`sidebar__item ${O?"sidebar__item--active":""}`,onClick:()=>{R?k(A.id):i==null||i(A.id)},title:n?A.label:void 0,"aria-current":O?"page":void 0,"aria-expanded":R?D:void 0,children:[A.icon&&f.jsx(nt,{name:A.icon,size:18,className:"sidebar__item-icon"}),!n&&f.jsx("span",{className:"sidebar__item-label",children:A.label}),!n&&A.count!==void 0&&f.jsx("span",{className:"sidebar__item-count",children:A.count}),!n&&R&&f.jsx(nt,{name:"chevronRight",size:14,className:`sidebar__item-chevron ${D?"sidebar__item-chevron--open":""}`})]}),!n&&R&&D&&A.children.map(B=>f.jsxs("button",{type:"button",className:`sidebar__item sidebar__item--child ${t===B.id?"sidebar__item--active":""}`,onClick:()=>i==null?void 0:i(B.id),"aria-current":t===B.id?"page":void 0,children:[f.jsx("span",{className:"sidebar__item-label",children:B.label}),B.count!==void 0&&f.jsx("span",{className:"sidebar__item-count",children:B.count})]},B.id))]},A.id)})})]},T.title))}),m&&f.jsx("div",{className:"sidebar__footer",children:m})]}))});Ev.displayName="Sidebar";function Dp(e){const[t,n]=j.useState(()=>typeof window<"u"?window.matchMedia(e).matches:!1);return j.useEffect(()=>{if(typeof window>"u")return;const a=window.matchMedia(e);n(a.matches);const i=r=>{n(r.matches)};return a.addEventListener("change",i),()=>{a.removeEventListener("change",i)}},[e]),t}const _k=Se.forwardRef((m,h)=>{var p=m,{breadcrumbs:e,searchPlaceholder:t="Search…",onSearch:n,leadingContent:a,searchHint:i,children:r,className:l="",mobileBreakpoint:c=768}=p,u=Ie(p,["breadcrumbs","searchPlaceholder","onSearch","leadingContent","searchHint","children","className","mobileBreakpoint"]);const g=Dp(c!==!1?`(max-width: ${c}px)`:"(max-width: 0px)"),v=["topbar",l].filter(Boolean).join(" "),x=e?e.length-1:-1;return f.jsxs("div",ee($({ref:h,className:v,"data-mobile":g},u),{children:[a&&f.jsx("div",{className:"topbar__leading",children:a}),f.jsx("div",{className:"topbar__breadcrumbs",children:e&&e.length>0&&f.jsx("nav",{className:"breadcrumbs","aria-label":"Breadcrumb",children:e.map((b,_)=>f.jsxs(Se.Fragment,{children:[_>0&&f.jsx("span",{className:"breadcrumbs__separator","aria-hidden":"true",children:"/"}),b.href?f.jsx("a",{href:b.href,className:"breadcrumbs__link","aria-current":_===x?"page":void 0,children:b.label}):b.onClick?f.jsx("button",{type:"button",className:"breadcrumbs__link breadcrumbs__link--button",onClick:b.onClick,"aria-current":_===x?"page":void 0,children:b.label}):f.jsx("span",{className:"breadcrumbs__link breadcrumbs__link--static","aria-current":_===x?"page":void 0,children:b.label})]},_))})}),f.jsxs("div",{className:"topbar__actions",children:[n&&!g&&f.jsxs("div",{className:"topbar__search-wrap",children:[f.jsx("input",{type:"search",placeholder:t,"aria-label":t,className:"topbar__search",onChange:b=>n(b.target.value)}),i&&f.jsx("span",{className:"topbar__search-hint",children:i})]}),r]})]}))});_k.displayName="Topbar";const vA=Se.forwardRef((l,r)=>{var c=l,{tabs:e=[],activeTabId:t="",onSelectTab:n,className:a=""}=c,i=Ie(c,["tabs","activeTabId","onSelectTab","className"]);const u=["tab-bar",a].filter(Boolean).join(" "),h=j.useRef([]),m=j.useCallback((p,g)=>{var v;const x=e.map((S,M)=>S.disabled?-1:M).filter(S=>S!==-1),b=x.indexOf(g);let _;p.key==="ArrowRight"?_=x[(b+1)%x.length]:p.key==="ArrowLeft"?_=x[(b-1+x.length)%x.length]:p.key==="Home"?_=x[0]:p.key==="End"&&(_=x[x.length-1]),_!==void 0&&(p.preventDefault(),(v=h.current[_])==null||v.focus(),n==null||n(e[_].id))},[e,n]);return f.jsx("div",ee($({ref:r,className:u,role:"tablist"},i),{children:f.jsx("div",{className:"tab-bar__tabs",children:e.map((p,g)=>f.jsxs("button",{type:"button",ref:v=>{h.current[g]=v},role:"tab","aria-selected":t===p.id,"aria-disabled":p.disabled,tabIndex:p.disabled?-1:t===p.id?0:-1,className:["tab-bar__tab",t===p.id?"tab-bar__tab--active":"",p.disabled?"tab-bar__tab--disabled":""].filter(Boolean).join(" "),onClick:()=>!p.disabled&&(n==null?void 0:n(p.id)),onKeyDown:v=>m(v,g),children:[f.jsx("span",{className:"tab-bar__tab-label",children:p.label}),p.count!==void 0&&f.jsx(fs,{form:"id-tag",children:p.count})]},p.id))})}))});vA.displayName="TabBar";const wk=Se.forwardRef((u,c)=>{var h=u,{left:e,center:t,right:n,className:a="",role:i="banner","aria-label":r="Application titlebar"}=h,l=Ie(h,["left","center","right","className","role","aria-label"]);const m=["titlebar",a].filter(Boolean).join(" ");return f.jsxs("div",ee($({ref:c,className:m,role:i,"aria-label":r},l),{children:[e&&f.jsx("div",{className:"titlebar__slot titlebar__slot--left",children:e}),t&&f.jsx("div",{className:"titlebar__slot titlebar__slot--center",children:t}),n&&f.jsx("div",{className:"titlebar__slot titlebar__slot--right",children:n})]}))});wk.displayName="Titlebar";const xA=e=>typeof e=="object"&&e!==null&&"kind"in e,bA=e=>e.map((t,n)=>{switch(t.kind){case"divider":return f.jsx("div",{className:"statusbar__divider"},n);case"pulse":return f.jsxs("div",{className:"statusbar__item statusbar__item--pulse",children:[f.jsx("div",{className:`statusbar__pulse statusbar__pulse--${t.tone}`}),t.mono?f.jsx("span",{className:"statusbar__label statusbar__label--mono",children:t.label}):f.jsx("span",{className:"statusbar__label",children:t.label})]},n);case"icon":return f.jsxs("div",{className:`statusbar__item ${t.mono?"statusbar__item--mono":""}`,"aria-label":t.label,children:[f.jsx(nt,{name:t.icon,size:14}),t.label&&f.jsx("span",{className:"statusbar__label",children:t.label})]},n);default:return t}}),Vx=Se.forwardRef((c,l)=>{var u=c,{left:e,center:t,right:n,className:a="",mobileBreakpoint:i=768}=u,r=Ie(u,["left","center","right","className","mobileBreakpoint"]);const h=Dp(i!==!1?`(max-width: ${i}px)`:"(max-width: 0px)"),m=["statusbar",a].filter(Boolean).join(" "),p=g=>g?Array.isArray(g)&&g.length>0&&xA(g[0])?bA(g):g:null;return f.jsxs("div",ee($({ref:l,role:"status",className:m,"data-mobile":h},r),{children:[e&&f.jsx("div",{className:"statusbar__slot statusbar__slot--left statusbar__left",children:p(e)}),t&&f.jsx("div",{className:"statusbar__slot statusbar__slot--center",children:p(t)}),n&&f.jsx("div",{className:"statusbar__slot statusbar__slot--right statusbar__right",children:p(n)})]}))});Vx.displayName="Statusbar";const _A=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'];function Qd(e,t,n){var l,c;const a=j.useRef(null),i=(l=n==null?void 0:n.mode)!=null?l:"modal",r=(c=n==null?void 0:n.initialFocus)!=null?c:i==="modal";j.useEffect(()=>{if(!t||!e.current)return;a.current=document.activeElement;const u=()=>e.current?Array.from(e.current.querySelectorAll(_A.join(","))):[],h=p=>{if(p.key!=="Tab")return;const g=u();if(g.length===0)return;const v=g[0],x=g[g.length-1];p.shiftKey?document.activeElement===v&&(p.preventDefault(),x.focus()):document.activeElement===x&&(p.preventDefault(),v.focus())},m=u();return m.length>0&&r&&m[0].focus(),e.current.addEventListener("keydown",h),()=>{var p;(p=e.current)==null||p.removeEventListener("keydown",h);const g=a.current;g&&document.body.contains(g)&&g.focus()}},[e,t,i,r])}let bf=0,_f=null;function Yx(e){j.useEffect(()=>{if(e)return bf===0&&(_f=document.body.style.overflow,document.body.style.overflow="hidden"),bf++,()=>{bf--,bf===0&&_f!==null&&(document.body.style.overflow=_f,_f=null)}},[e])}const Sk=Se.forwardRef((m,h)=>{var p=m,{isOpen:e,onClose:t,title:n,position:a="right",width:i="320px",children:r,className:l="",keepMounted:c=!1}=p,u=Ie(p,["isOpen","onClose","title","position","width","children","className","keepMounted"]);const g=Se.useId(),v=j.useRef(null);j.useImperativeHandle(h,()=>v.current),Qd(v,e),Yx(e),j.useEffect(()=>{const b=_=>{_.key==="Escape"&&e&&t()};if(e)return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[e,t]);const x=b=>{b.target===b.currentTarget&&t()};return!c&&!e?null:f.jsx("div",{className:"drawer-backdrop",onClick:e?x:void 0,style:{display:e?"block":"none"},children:f.jsxs("div",ee($({ref:v,className:["drawer",`drawer--${a}`,l].filter(Boolean).join(" "),style:{width:i},role:"dialog","aria-modal":e,"aria-labelledby":n?g:void 0,"data-open":e?"true":"false"},u),{children:[f.jsxs("div",{className:["drawer__header",n?"":"drawer__header--no-title"].filter(Boolean).join(" "),children:[n&&f.jsx("h2",{id:g,className:"drawer__title",children:n}),f.jsx("button",{type:"button",className:"drawer__close",onClick:t,"aria-label":"Close drawer",children:f.jsx(nt,{name:"x",size:14})})]}),f.jsx("div",{className:"drawer__body",children:r})]}))})});Sk.displayName="Drawer";const wA=Se.forwardRef((m,h)=>{var p=m,{titlebar:e,appTitle:t,topbar:n,sidebar:a,statusbar:i,children:r,className:l="",mobileBreakpoint:c=768}=p,u=Ie(p,["titlebar","appTitle","topbar","sidebar","statusbar","children","className","mobileBreakpoint"]);var X,te;const[g,v]=j.useState(!1),x=Dp(c!==!1?`(max-width: ${c}px)`:"(max-width: 0px)");j.useEffect(()=>{x||v(!1)},[x]);const b=["shell-layout",l].filter(Boolean).join(" "),ne=e!=null?e:{},{hide:_}=ne,S=Ie(ne,["hide"]),M=e&&!e.hide,q=t!=null?t:{},{hide:C}=q,k=Ie(q,["hide"]),L=t&&!t.hide,he=n!=null?n:{},{hide:E}=he,I=Ie(he,["hide"]),T=n&&!n.hide,pe=a!=null?a:{},{hide:A}=pe,R=Ie(pe,["hide"]),D=a&&!a.hide,H=i!=null?i:{},{hide:O}=H,B=Ie(H,["hide"]),z=i&&!i.hide,U=x?ee($({},R),{collapsed:!1,showCollapseToggle:!1,onSelectItem:ie=>{var W;try{(W=R==null?void 0:R.onSelectItem)==null||W.call(R,ie)}finally{v(!1)}}}):R,F=x&&D&&f.jsx("button",{type:"button",className:"shell-layout__mobile-menu-toggle",onClick:()=>v(!0),"aria-label":"Open sidebar menu",children:f.jsx(nt,{name:"menu",size:20})}),Y=T?ee($({},I),{mobileBreakpoint:(X=I.mobileBreakpoint)!=null?X:c,leadingContent:f.jsxs(f.Fragment,{children:[x&&F,I==null?void 0:I.leadingContent]})}):I;return f.jsxs("div",ee($({ref:h,className:b,"data-mobile":x},u),{children:[M&&f.jsx(wk,$({},S)),f.jsxs("div",{className:"shell-layout__main",children:[D?!x&&f.jsx("div",{className:"shell-layout__sidebar-col",children:f.jsx(Ev,ee($({},U),{appTitle:L?k:U.appTitle}))}):L?f.jsx(qx,$({},k)):null,f.jsxs("div",{className:"shell-layout__content",children:[T&&f.jsx(_k,$({},Y)),!T&&x&&F&&f.jsx("div",{className:"shell-layout__mobile-header",children:F}),f.jsx("main",{className:"shell-layout__canvas",children:r})]})]}),z&&f.jsx(Vx,ee($({},B),{mobileBreakpoint:(te=B.mobileBreakpoint)!=null?te:c})),x&&D&&f.jsx(Sk,{isOpen:g,onClose:()=>v(!1),position:"left",width:"280px",keepMounted:!0,children:f.jsx(Ev,ee($({},U),{appTitle:L?k:U.appTitle}))})]}))});wA.displayName="ShellLayout";const Gx=Se.forwardRef((p,m)=>{var g=p,{isOpen:e,onClose:t,title:n,subtitle:a,children:i,footer:r,hintFooter:l,size:c="md",className:u=""}=g,h=Ie(g,["isOpen","onClose","title","subtitle","children","footer","hintFooter","size","className"]);const v=Se.useId(),x=j.useRef(null),b=j.useRef(null);j.useImperativeHandle(m,()=>b.current),Qd(b,e),Yx(e),j.useEffect(()=>{const S=M=>{M.key==="Escape"&&e&&t()};if(e)return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[e,t]);const _=S=>{S.target===x.current&&t()};return e?f.jsx("div",{ref:x,className:"modal-backdrop",onClick:_,children:f.jsxs("div",ee($({ref:b,className:["modal",`modal--${c}`,u].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-labelledby":n?v:void 0},h),{children:[n&&f.jsxs("div",{className:"modal__header",children:[f.jsxs("div",{className:"modal__header-text",children:[f.jsx("div",{id:v,className:"modal__title",children:n}),a&&f.jsx("div",{className:"modal__subtitle",children:a})]}),f.jsx("button",{type:"button",className:"modal__close",onClick:t,"aria-label":"Close dialog",children:f.jsx(nt,{name:"x",size:14})})]}),f.jsx("div",{className:"modal__body",children:i}),r&&f.jsx("div",{className:"modal__footer",children:r}),l&&f.jsx("div",{className:"modal__foot-hint",children:l})]}))}):null});Gx.displayName="Modal";const up=Se.forwardRef(({isOpen:e,onClose:t,onConfirm:n,title:a,subtitle:i,message:r,confirmLabel:l="Confirm",cancelLabel:c="Cancel",variant:u="danger"},h)=>f.jsxs(Gx,{ref:h,isOpen:e,onClose:t,title:a,subtitle:i,children:[f.jsx("div",{className:"confirm-dialog__message",children:r}),f.jsxs("div",{className:"confirm-dialog__footer",children:[f.jsx(Bn,{variant:"ghost",size:"sm",onClick:t,children:c}),f.jsx(Bn,{variant:u,size:"sm",onClick:n,children:l})]})]}));up.displayName="ConfirmDialog";function my({icon:e,title:t,description:n,onClick:a}){return f.jsxs("button",{type:"button",className:"workspace-switcher-dialog__action-tile",onClick:a,children:[f.jsx("div",{className:"workspace-switcher-dialog__action-icon",children:f.jsx(nt,{name:e,size:20})}),f.jsx("div",{className:"workspace-switcher-dialog__action-title",children:t}),f.jsx("div",{className:"workspace-switcher-dialog__action-desc",children:n})]})}const SA=Se.forwardRef(({isOpen:e,onClose:t,title:n="Switch Workspace",current:a,recent:i=[],onOpenFolder:r,onNewWorkspace:l,onCloneFromGit:c,onPickRecent:u},h)=>f.jsx(Gx,{ref:h,isOpen:e,onClose:t,title:n,size:"lg",children:f.jsxs("div",{className:"workspace-switcher-dialog__content",children:[(r||l||c)&&f.jsxs("div",{className:"workspace-switcher-dialog__tiles",children:[r&&f.jsx(my,{icon:"folder",title:"Open folder…",description:"Point to an existing workspace directory",onClick:r}),l&&f.jsx(my,{icon:"plus",title:"New workspace…",description:"Initialize a fresh local workspace",onClick:l}),c&&f.jsx(my,{icon:"gitBranch",title:"Clone from git…",description:"Pull a workspace from a remote repository",onClick:c})]}),i.length>0&&f.jsxs("div",{className:"workspace-switcher-dialog__recent",children:[f.jsx("div",{className:"workspace-switcher-dialog__recent-header",children:"Recent"}),f.jsx("div",{className:"workspace-switcher-dialog__recent-list",children:i.map(m=>{const p=(a==null?void 0:a.id)===m.id;return f.jsxs("button",{type:"button",className:`workspace-switcher-dialog__recent-item ${p?"workspace-switcher-dialog__recent-item--current":""}`,"aria-current":p?!0:void 0,onClick:()=>u(m),children:[f.jsxs("div",{className:"workspace-switcher-dialog__recent-main",children:[f.jsx("span",{className:"workspace-switcher-dialog__recent-name",children:m.name}),p&&f.jsx("span",{className:"workspace-switcher-dialog__open-badge",children:"open"})]}),f.jsxs("div",{className:"workspace-switcher-dialog__recent-meta",children:[m.path&&f.jsx("span",{className:"workspace-switcher-dialog__recent-path",children:m.path}),(m.classCount!=null||m.individualCount!=null)&&f.jsxs("span",{className:"workspace-switcher-dialog__recent-stats",children:[m.classCount!=null&&`${m.classCount} cls`,m.classCount!=null&&m.individualCount!=null&&" · ",m.individualCount!=null&&`${m.individualCount} ind`]})]})]},m.id)})})]})]})}));SA.displayName="WorkspaceSwitcherDialog";const Nk=j.createContext(void 0);function Op(){const e=j.useContext(Nk);if(!e)throw new Error("FilterDropdown components must be used within FilterDropdown");return e}const kk=Se.forwardRef(({mode:e="checkbox",children:t,onChange:n,className:a="",defaultValue:i,value:r,placement:l="bottom-start"},c)=>{const[u,h]=j.useState(!1),m=r!==void 0,[p,g]=j.useState(new Set(i!=null?i:[])),v=m?new Set(r):p,x=j.useRef(null),b=j.useRef(null),_=j.useRef(null),S=j.useCallback(()=>h(!1),[]),{focusedValue:M,setFocusedValue:C}=Ap({triggerRef:x,panelRef:b,isOpen:u,onClose:S}),k=j.useCallback(I=>{h(I)},[]),L=j.useCallback((I,T)=>{const A=new Set(v);T?(e==="radio"&&A.clear(),A.add(I)):A.delete(I),m||g(A),n==null||n(Array.from(A)),e==="radio"&&T&&h(!1)},[v,e,n,m]),E={isOpen:u,onOpenChange:k,mode:e,selectedValues:v,onValueChange:L,focusedValue:M,setFocusedValue:C,triggerRef:x,panelRef:b,placement:l};return f.jsx(Nk.Provider,{value:E,children:f.jsx("div",{ref:I=>{_.current=I,typeof c=="function"?c(I):c&&(c.current=I)},className:`filter-dropdown ${a}`.trim(),children:t})})});kk.displayName="FilterDropdown";function NA(a){var i=a,{label:e,summary:t}=i,n=Ie(i,["label","summary"]);const{isOpen:r,onOpenChange:l,triggerRef:c,mode:u}=Op();return f.jsxs("button",ee($({ref:c,type:"button"},n),{className:"filter-dropdown__trigger",onClick:()=>l(!r),"aria-haspopup":u==="radio"?"dialog":"listbox","aria-expanded":r,children:[f.jsx("span",{className:"filter-dropdown__label",children:e}),f.jsx("span",{className:"filter-dropdown__summary",children:t}),f.jsx(nt,{name:"chevronDown",size:14,className:`filter-dropdown__chevron ${r?"filter-dropdown__chevron--open":""}`})]}))}function kA(i){var r=i,{children:e,className:t="",style:n}=r,a=Ie(r,["children","className","style"]);const{isOpen:l,mode:c,panelRef:u,placement:h}=Op();return f.jsx("div",ee($({ref:u,className:`dropdown-panel ${Ip(h)} filter-dropdown__panel ${t}`.trim(),role:c==="checkbox"?"listbox":"radiogroup","aria-multiselectable":c==="checkbox"?!0:void 0,hidden:!l,style:l?n:void 0},a),{children:e}))}function CA({title:e,children:t}){return f.jsxs("div",{className:"dropdown-section",children:[e&&f.jsx("div",{className:"dropdown-section-title",children:e}),f.jsx("div",{className:"filter-dropdown__section-content",children:t})]})}function MA({value:e,label:t,description:n}){const{selectedValues:a,onValueChange:i,focusedValue:r,setFocusedValue:l,mode:c}=Op(),u=j.useRef(null),h=a.has(e),m=r===e;return j.useEffect(()=>{var p;m&&((p=u.current)==null||p.focus())},[m]),f.jsxs("button",{ref:u,type:"button",role:c==="checkbox"?"option":void 0,"aria-selected":h,tabIndex:m?0:-1,"data-dropdown-item":e,onClick:()=>i(e,!h),onMouseEnter:()=>l(e),className:["dropdown-item",m&&"dropdown-item--focused"].filter(Boolean).join(" "),children:[f.jsx("span",{className:"dropdown-item__leading",children:f.jsx("input",{type:"checkbox",className:"dropdown-item__checkbox",checked:h,readOnly:!0,tabIndex:-1,"aria-hidden":"true"})}),f.jsxs("span",{className:"dropdown-item__body",children:[f.jsx("span",{className:"dropdown-item__label",children:t}),n&&f.jsx("span",{className:"dropdown-item__description",children:n})]})]})}function jA({value:e,label:t,description:n}){const{selectedValues:a,onValueChange:i,focusedValue:r,setFocusedValue:l}=Op(),c=j.useRef(null),u=a.has(e),h=r===e;return j.useEffect(()=>{var m;h&&((m=c.current)==null||m.focus())},[h]),f.jsxs("button",{ref:c,type:"button",role:"radio","aria-checked":u,tabIndex:h?0:-1,"data-dropdown-item":e,onClick:()=>i(e,!0),onMouseEnter:()=>l(e),className:["dropdown-item",h&&"dropdown-item--focused"].filter(Boolean).join(" "),children:[f.jsx("span",{className:"dropdown-item__leading",children:f.jsx("input",{type:"radio",className:"dropdown-item__radio",checked:u,readOnly:!0,tabIndex:-1,"aria-hidden":"true"})}),f.jsxs("span",{className:"dropdown-item__body",children:[f.jsx("span",{className:"dropdown-item__label",children:t}),n&&f.jsx("span",{className:"dropdown-item__description",children:n})]})]})}Object.assign(kk,{Trigger:NA,Panel:kA,Section:CA,Checkbox:MA,Radio:jA});const EA={success:"check",error:"x",warning:"alert",info:"info"},RA={success:"emerald",error:"rose",warning:"amber",info:"cyan"},Kx=Se.forwardRef((m,h)=>{var p=m,{isOpen:e,onClose:t,title:n,subtitle:a,variant:i="info",icon:r,duration:l=4e3,className:c=""}=p,u=Ie(p,["isOpen","onClose","title","subtitle","variant","icon","duration","className"]);if(j.useEffect(()=>{if(e&&l){const x=setTimeout(t,l);return()=>clearTimeout(x)}},[e,l,t]),!e)return null;const g=r||EA[i],v=RA[i];return f.jsxs("div",ee($({ref:h,className:["toast",`toast--${i}`,c].filter(Boolean).join(" "),role:i==="error"||i==="warning"?"alert":"status","aria-live":i==="error"||i==="warning"?"assertive":"polite","aria-atomic":"true"},u),{children:[f.jsx("div",{className:`toast__icon toast__icon--${v}`,children:f.jsx(nt,{name:g,size:12})}),f.jsxs("div",{className:"toast__content",children:[n&&f.jsx("div",{className:"toast__title",children:n}),a&&f.jsx("div",{className:"toast__subtitle",children:a})]}),f.jsx("button",{type:"button",className:"toast__close",onClick:t,"aria-label":"Dismiss notification",children:f.jsx(nt,{name:"x",size:14})})]}))});Kx.displayName="Toast";const Ck=({content:e,children:t,placement:n="top",delay:a=200,offset:i=6,className:r="",disabled:l=!1,open:c,id:u})=>{const h=c!==void 0,[m,p]=j.useState(!1),g=h?c:m,[v,x]=j.useState(n),b=j.useRef(),_=j.useRef(null),S=j.useId(),M=u!=null?u:S;j.useEffect(()=>()=>clearTimeout(b.current),[]),j.useEffect(()=>{l&&(clearTimeout(b.current),h||p(!1))},[l,h]),j.useEffect(()=>{g||x(n)},[g,n]),j.useLayoutEffect(()=>{if(!g)return;const E=_.current;if(!E)return;const I=E.getBoundingClientRect();n==="top"&&I.top<0?x("bottom"):n==="bottom"&&I.bottom>window.innerHeight?x("top"):n==="left"&&I.left<0?x("right"):n==="right"&&I.right>window.innerWidth&&x("left")},[g,n]);const C=()=>{l||h||(clearTimeout(b.current),b.current=setTimeout(()=>{x(n),p(!0)},a))},k=()=>{h||(clearTimeout(b.current),p(!1))},L=g&&!l&&e!=null;return f.jsxs("span",{className:"tooltip-wrapper",onPointerEnter:C,onPointerLeave:k,onFocus:C,onBlur:k,children:[Se.cloneElement(t,L?{"aria-describedby":M}:{}),L&&f.jsx("div",{ref:_,role:"tooltip",id:M,className:["tooltip",`tooltip--${v}`,r].filter(Boolean).join(" "),style:{"--tooltip-offset":`${i}px`},children:e})]})};Ck.displayName="Tooltip";const Mk=j.createContext(void 0);function jk(){const e=j.useContext(Mk);if(!e)throw new Error("Popover subcomponents must be used within Popover");return e}function LA(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})}}const Ek=Se.forwardRef(({open:e,onOpenChange:t,placement:n="bottom",offset:a=8,disableOutsideClick:i=!1,panelId:r,autoFocus:l=!1,children:c},u)=>{const h=e!==void 0,[m,p]=j.useState(!1),g=h?e:m,[v,x]=j.useState(n),b=j.useId(),_=r||b,S=j.useId(),M=j.useRef(null),C=j.useRef(null),k=j.useRef(null);Qd(C,g,{mode:"popup",initialFocus:l}),j.useEffect(()=>{h&&!t&&console.warn("[Popover] Controlled mode detected (open prop provided) but onOpenChange handler is missing. The popover will not respond to user interactions and will remain stuck in its current state. Either: (1) provide onOpenChange callback, or (2) remove open prop to use uncontrolled mode.")},[h,t]),j.useEffect(()=>{g||x(n)},[g,n]),j.useLayoutEffect(()=>{if(!g)return;const I=C.current;if(!I)return;const T=I.getBoundingClientRect();n==="top"&&T.top<0?x("bottom"):n==="bottom"&&T.bottom>window.innerHeight?x("top"):n==="left"&&T.left<0?x("right"):n==="right"&&T.right>window.innerWidth&&x("left")},[g,n]);const L=j.useCallback(I=>{h?t==null||t(I):p(I)},[h,t]);j.useEffect(()=>{if(!g)return;const I=k.current;if(!I)return;const T=A=>{A.key==="Escape"&&(A.preventDefault(),A.stopPropagation(),L(!1),requestAnimationFrame(()=>{const R=M.current;R&&R.offsetWidth>0&&R.offsetHeight>0&&R.focus()}))};return I.addEventListener("keydown",T),()=>I.removeEventListener("keydown",T)},[g,L]),j.useEffect(()=>{if(!g||i)return;const I=T=>{const A=T.target;k.current&&!k.current.contains(A)&&L(!1)};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[g,i,L]);const E={isOpen:g,onOpenChange:L,panelId:_,triggerId:S,placement:v,offset:a,triggerRef:M,panelRef:C};return f.jsx(Mk.Provider,{value:E,children:f.jsx("div",{ref:I=>{k.current=I,typeof u=="function"?u(I):u&&(u.current=I)},className:"popover-wrapper",children:c})})});Ek.displayName="Popover";function TA({children:e}){const{isOpen:t,onOpenChange:n,triggerId:a,panelId:i,triggerRef:r}=jk(),l=u=>{u.stopPropagation(),n(!t)},c=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),n(!t))};return Se.cloneElement(e,$({ref:LA([r,e.ref]),id:a,onClick:u=>{var h,m;l(u),(m=(h=e.props).onClick)==null||m.call(h,u)},onKeyDown:u=>{var h,m;c(u),(m=(h=e.props).onKeyDown)==null||m.call(h,u)},"aria-haspopup":"dialog","aria-expanded":t},t&&{"aria-controls":i}))}function AA({"aria-label":e,"aria-labelledby":t,className:n="",children:a}){const{isOpen:i,panelId:r,placement:l,offset:c,panelRef:u}=jk();return i?f.jsx("div",{ref:u,id:r,role:"dialog","aria-modal":"false","aria-label":e,"aria-labelledby":t,className:["popover-panel",`popover-panel--${l}`,n].filter(Boolean).join(" "),style:{"--popover-offset":`${c}px`},children:a}):null}const gy=Object.assign(Ek,{Trigger:TA,Panel:AA}),IA=Se.forwardRef(({isOpen:e,onClose:t,commands:n=[],placeholder:a="Search commands…",emptyMessage:i="No commands found"},r)=>{const[l,c]=j.useState(""),[u,h]=j.useState(0),m=j.useRef(null),p=j.useRef(null),g=Se.useId(),v=Se.useId();j.useImperativeHandle(r,()=>p.current),Qd(p,e),Yx(e);const x=j.useMemo(()=>{const S=l.toLowerCase();return n.filter(M=>{var k;var C;return M.label.toLowerCase().includes(S)||((k=(C=M.description)==null?void 0:C.toLowerCase().includes(S))!=null?k:!1)})},[n,l]),b=j.useMemo(()=>{const S=[],M=new Map;return x.forEach((C,k)=>{M.has(C.group)||(M.set(C.group,[]),S.push(C.group)),M.get(C.group).push({cmd:C,index:k})}),S.map(C=>({name:C,items:M.get(C)}))},[x]);j.useEffect(()=>{e?setTimeout(()=>{var S;return(S=m.current)==null?void 0:S.focus()},0):(c(""),h(0))},[e]),j.useEffect(()=>{const S=M=>{e&&(M.key==="Escape"?t():M.key==="ArrowDown"?(M.preventDefault(),x.length>0&&h(C=>(C+1)%x.length)):M.key==="ArrowUp"?(M.preventDefault(),x.length>0&&h(C=>(C-1+x.length)%x.length)):M.key==="Enter"&&(M.preventDefault(),x[u]&&(x[u].onSelect(),t(),c(""))))};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[e,t,x,u]);const _=S=>{S.target===S.currentTarget&&t()};return e?f.jsx("div",{ref:p,className:"command-palette-backdrop",onClick:_,children:f.jsxs("div",{className:"command-palette",role:"dialog","aria-modal":"true","aria-labelledby":v,children:[f.jsx("span",{id:v,className:"command-palette__sr-title",children:"Command palette"}),f.jsxs("div",{className:"command-palette__header",children:[f.jsx(nt,{name:"search",size:16}),f.jsx("input",{ref:m,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":!0,"aria-controls":g,"aria-activedescendant":x[u]?`${g}-${x[u].id}`:void 0,"aria-label":a,className:"command-palette__input",placeholder:a,value:l,onChange:S=>{c(S.target.value),h(0)}})]}),f.jsx("div",{id:g,role:"listbox",className:"command-palette__list",children:x.length===0?f.jsx("div",{className:"command-palette__empty",children:i}):b.map(S=>{var M;return f.jsxs("div",{className:"command-palette__group",role:"group",children:[S.name&&f.jsx("div",{className:"command-palette__group-header","aria-hidden":"true",children:S.name}),S.items.map(({cmd:C,index:k})=>f.jsxs("button",{type:"button",id:`${g}-${C.id}`,role:"option","aria-selected":k===u,className:["command-palette__item",k===u&&"command-palette__item--selected"].filter(Boolean).join(" "),onClick:()=>{C.onSelect(),t(),c("")},children:[C.icon&&f.jsx(nt,{name:C.icon,size:16}),f.jsxs("div",{className:"command-palette__item-content",children:[f.jsx("div",{className:"command-palette__item-label",children:C.label}),C.description&&f.jsx("div",{className:"command-palette__item-description",children:C.description})]})]},C.id))]},(M=S.name)!=null?M:"__ungrouped")})})]})}):null});IA.displayName="CommandPalette";const Rk=Se.forwardRef((m,h)=>{var p=m,{title:e,subtitle:t,headerAction:n,footer:a,bordered:i=!0,noPadding:r=!1,className:l="",children:c}=p,u=Ie(p,["title","subtitle","headerAction","footer","bordered","noPadding","className","children"]);const g=["panel",!i&&"panel--no-border",l].filter(Boolean).join(" ");return f.jsxs("div",ee($({ref:h,className:g},u),{children:[(e||t||n)&&f.jsxs("div",{className:"panel__header",children:[f.jsxs("div",{className:"panel__header-left",children:[e&&f.jsx("div",{className:"panel__title",children:e}),t&&f.jsx("div",{className:"panel__subtitle",children:t})]}),n&&f.jsx("div",{className:"panel__header-action",children:n})]}),c!=null&&f.jsx("div",{className:r?"panel__body panel__body--no-padding":"panel__body",children:c}),a&&f.jsx("div",{className:"panel__footer",children:a})]}))});Rk.displayName="Panel";const DA=Se.forwardRef((g,p)=>{var v=g,{direction:e="horizontal",initialSplitPercent:t=50,splitPercent:n,onSplitChange:a,minSize:i=200,maxSize:r=800,first:l,second:c,dividerLabel:u,className:h=""}=v,m=Ie(v,["direction","initialSplitPercent","splitPercent","onSplitChange","minSize","maxSize","first","second","dividerLabel","className"]);const[x,b]=j.useState(t),_=j.useRef(null),S=n!==void 0,M=S?n:x,C=j.useCallback((A,R)=>{const D=i/R*100,O=r/R*100;return Math.max(D,Math.min(A,O))},[i,r]),k=j.useCallback(A=>{S||b(A),a==null||a(A)},[S,a]),L=j.useCallback(A=>R=>{A.forEach(D=>{typeof D=="function"?D(R):D&&(D.current=R)})},[]),E=j.useCallback(()=>{const A=D=>{if(!_.current)return;const O=_.current.getBoundingClientRect(),B=e==="horizontal",z=B?D.clientX-O.left:D.clientY-O.top,U=B?O.width:O.height,F=z/U*100;k(C(F,U))},R=()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",R)};document.addEventListener("mousemove",A),document.addEventListener("mouseup",R)},[e,C,k]),I=j.useCallback(A=>{if(!_.current)return;const R=A.shiftKey?10:2,D=e==="horizontal",O=_.current.getBoundingClientRect(),B=D?O.width:O.height;A.key==="ArrowLeft"||A.key==="ArrowUp"?(A.preventDefault(),k(C(M-R,B))):(A.key==="ArrowRight"||A.key==="ArrowDown")&&(A.preventDefault(),k(C(M+R,B)))},[e,M,C,k]),T=["split-pane",`split-pane--${e}`,h].filter(Boolean).join(" ");return f.jsxs("div",ee($({ref:L([_,p]),className:T},m),{children:[f.jsx("div",{className:"split-pane__first",style:e==="horizontal"?{width:`${M}%`}:{height:`${M}%`},children:l}),f.jsx("div",{role:"separator","aria-orientation":e==="horizontal"?"vertical":"horizontal","aria-valuenow":Math.round(M),"aria-valuemin":0,"aria-valuemax":100,"aria-label":u!=null?u:e==="horizontal"?"Horizontal divider":"Vertical divider",tabIndex:0,className:`split-pane__divider split-pane__divider--${e}`,onMouseDown:E,onKeyDown:I}),f.jsx("div",{className:"split-pane__second",style:e==="horizontal"?{width:`${100-M}%`}:{height:`${100-M}%`},children:c})]}))});DA.displayName="SplitPane";const Lk=j.createContext(void 0),Tk=()=>{const e=j.useContext(Lk);if(!e)throw new Error("InspectorPanel.Section must be used within an InspectorPanel");return e},Ak=Se.forwardRef((c,l)=>{var u=c,{title:e,count:t,actions:n,children:a,className:i=""}=u,r=Ie(u,["title","count","actions","children","className"]);Tk();const h=["inspector-panel__section",i].filter(Boolean).join(" ");return f.jsxs("div",ee($({ref:l,className:h},r),{children:[f.jsxs("div",{className:"inspector-panel__section-header",children:[f.jsxs("div",{className:"inspector-panel__section-title",children:[f.jsx("span",{children:e}),t!==void 0&&f.jsxs("span",{className:"inspector-panel__section-count",children:["· ",t]})]}),n&&f.jsx("div",{className:"inspector-panel__section-actions",children:n})]}),a&&f.jsx("div",{className:"inspector-panel__section-content",children:a})]}))});Ak.displayName="InspectorPanel.Section";const Ik=Se.forwardRef((h,u)=>{var m=h,{title:e,count:t,actionIcon:n,actionLabel:a,onAction:i,rows:r,className:l=""}=m,c=Ie(m,["title","count","actionIcon","actionLabel","onAction","rows","className"]);Tk();const p=["inspector-panel__property-section",l].filter(Boolean).join(" ");return f.jsxs("div",ee($({ref:u,className:p},c),{children:[f.jsxs("div",{className:"inspector-panel__property-section-header",children:[f.jsx("span",{className:"inspector-panel__property-section-title",children:e}),t!==void 0&&f.jsx("span",{className:"inspector-panel__property-section-count",children:t}),i&&f.jsx("button",{className:"inspector-panel__property-section-action",onClick:i,type:"button","aria-label":a,children:n})]}),r.length>0&&f.jsx("div",{className:"inspector-panel__property-rows",children:r.map(g=>f.jsxs("div",{className:"inspector-panel__property-row",children:[f.jsx("span",{className:"inspector-panel__property-key",children:g.key}),f.jsx("span",{className:"inspector-panel__property-value",children:g.value}),g.usageCount!==void 0&&f.jsxs("span",{className:"inspector-panel__property-usage",children:["used ",g.usageCount]})]},g.key))})]}))});Ik.displayName="InspectorPanel.PropertySection";const Dk=Se.forwardRef((h,u)=>{var m=h,{eyebrow:e="",title:t,id:n,version:a,actions:i,children:r,className:l=""}=m,c=Ie(m,["eyebrow","title","id","version","actions","children","className"]);const p=["inspector-panel",l].filter(Boolean).join(" ");return f.jsx(Lk.Provider,{value:!0,children:f.jsxs("div",ee($({ref:u,className:p},c),{children:[f.jsxs("div",{className:"inspector-panel__head",children:[e&&f.jsx("div",{className:"inspector-panel__eyebrow",children:e}),f.jsx("div",{className:"inspector-panel__title",children:t}),f.jsxs("div",{className:"inspector-panel__id-version",children:[f.jsx("span",{className:"inspector-panel__id",children:n}),a!==void 0&&f.jsx(Es,{children:a})]}),i&&f.jsx("div",{className:"inspector-panel__actions",children:i})]}),f.jsx("div",{className:"inspector-panel__body",children:r})]}))})});Dk.displayName="InspectorPanel";Object.assign(Dk,{Section:Ak,PropertySection:Ik});const OA=Se.forwardRef((l,r)=>{var c=l,{rows:e=[],keyWidth:t,className:n="",style:a}=c,i=Ie(c,["rows","keyWidth","className","style"]);const u=["kv-grid",n].filter(Boolean).join(" "),h=t?ee($({},a),{gridTemplateColumns:`${typeof t=="number"?`${t}px`:t} 1fr`}):a;return f.jsx("dl",ee($({ref:r,className:u,style:h},i),{children:e.map(m=>f.jsxs(Se.Fragment,{children:[f.jsx("dt",{className:"kv-grid__key",children:m.key}),f.jsx("dd",{className:"kv-grid__value",children:m.value})]},m.key))}))});OA.displayName="KVGrid";const zA=Se.forwardRef((u,c)=>{var h=u,{label:e,width:t,height:n,viewBox:a,className:i="",children:r}=h,l=Ie(h,["label","width","height","viewBox","className","children"]);return f.jsx("svg",ee($({ref:c,role:"img","aria-label":e,width:t,height:n,viewBox:a,className:i,style:{display:"block"}},l),{children:r}))});zA.displayName="ChartWrapper";const qc=["#22D3EE","#10B981","#F59E0B","#818CF8","#8B5CF6","#F43F5E"],Ow=qc,xo={light:{fg1:"#0B1220",fg2:"#475569",fg3:"#64748B",fg4:"#94A3B8",grid:"#EEF1F4",border:"#E5E9EE",card:"#FFFFFF",inset:"#F7F9FB"},dark:{fg1:"#E2E8F0",fg2:"#94A3B8",fg3:"#64748B",fg4:"#475569",grid:"#1B2949",border:"#243763",card:"#1B2949",inset:"#13203A"}};function yo(e){return Math.abs(e)>=1e3?(e/1e3).toFixed(1)+"k":Number.isInteger(e)?String(e):e.toFixed(1)}const zw="#F59E0B",BA="#B45309",$A="#1B2949",UA="#2A3A5C",FA="#E6EDF3",PA="#A6B1BD",HA=Se.forwardRef((M,S)=>{var C=M,{series:e,colors:t,xLabels:n,width:a=480,height:i=200,area:r=!1,axes:l=!1,grid:c=!1,ticks:u=4,threshold:h,markers:m,tooltip:p=!1,tone:g="light",padding:v,className:x="",style:b}=C,_=Ie(C,["series","colors","xLabels","width","height","area","axes","grid","ticks","threshold","markers","tooltip","tone","padding","className","style"]);var H;const k=xo[g],L=Se.useId(),[E,I]=Se.useState(null),T=t!=null?t:e.length===1?[qc[0]]:qc,A=$({top:8,right:p?12:8,bottom:l?22:6,left:l?30:6},v),R=a-A.left-A.right,D=i-A.top-A.bottom,O=e.flat();if(O.length===0)return null;let B=Math.min(...O),z=Math.max(...O);const U=z-B||1;B-=U*.08,z+=U*.08,h&&(B=Math.min(B,h.value),z=Math.max(z,h.value));const F=Math.max(...e.map(te=>te.length)),Y=te=>A.left+(F<=1?R/2:te/(F-1)*R),X=te=>A.top+D-(te-B)/(z-B)*D,ne=[];for(let te=0;te<=u;te++)ne.push(B+te/u*(z-B));function q(te){const ie=te.currentTarget.getBoundingClientRect(),W=(te.clientX-ie.left)/ie.width*a,ge=Math.max(0,Math.min(F-1,Math.round((W-A.left)/R*(F-1))));I(ge)}function he(te){return te.map(([ie,W],ge)=>(ge?"L":"M")+ie.toFixed(2)+","+W.toFixed(2)).join(" ")}const pe=e.map(te=>te.map((ie,W)=>[Y(W),X(ie)]));return f.jsxs("svg",ee($({ref:S,width:a,height:i,viewBox:`0 0 ${a} ${i}`,className:x,role:"img","aria-label":(H=_["aria-label"])!=null?H:"Line chart",style:$({display:"block",cursor:p?"crosshair":"default"},b),onMouseMove:p?q:void 0,onMouseLeave:p?()=>I(null):void 0},_),{children:[c&&ne.map((te,ie)=>f.jsx("line",{x1:A.left,x2:a-A.right,y1:X(te),y2:X(te),stroke:k.grid,strokeWidth:"1"},"g"+ie)),l&&f.jsxs(f.Fragment,{children:[f.jsx("line",{x1:A.left,x2:A.left,y1:A.top,y2:A.top+D,stroke:k.border,strokeWidth:"1"}),f.jsx("line",{x1:A.left,x2:a-A.right,y1:A.top+D,y2:A.top+D,stroke:k.border,strokeWidth:"1"}),ne.map((te,ie)=>f.jsx("text",{x:A.left-6,y:X(te)+3,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:k.fg3,children:yo(te)},"yt"+ie)),n&&n.map((te,ie)=>f.jsx("text",{x:Y(ie),y:A.top+D+14,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:k.fg3,children:te},"xt"+ie))]}),h&&f.jsxs(f.Fragment,{children:[f.jsx("line",{x1:A.left,x2:a-A.right,y1:X(h.value),y2:X(h.value),stroke:k.fg3,strokeWidth:"1",strokeDasharray:"3 3"}),h.label&&f.jsx("text",{x:a-A.right-4,y:X(h.value)-4,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:k.fg3,style:{textTransform:"uppercase",letterSpacing:"0.08em"},children:h.label})]}),m&&m.map((te,ie)=>f.jsxs("g",{children:[f.jsx("line",{x1:Y(te.x),x2:Y(te.x),y1:A.top-2,y2:A.top+D,stroke:zw,strokeWidth:"1",strokeDasharray:"2 2"}),f.jsx("circle",{cx:Y(te.x),cy:A.top+4,r:"3",fill:zw}),te.label&&f.jsx("text",{x:Y(te.x)+6,y:A.top+7,fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:BA,style:{textTransform:"uppercase",letterSpacing:"0.08em"},children:te.label})]},"mk"+ie)),pe.map((te,ie)=>{const W=T[ie%T.length],ge=he(te),we=`${ge} L${te[te.length-1][0].toFixed(2)},${A.top+D} L${te[0][0].toFixed(2)},${A.top+D} Z`,je=`${L}-lg${ie}`;return f.jsxs("g",{children:[r&&f.jsxs(f.Fragment,{children:[f.jsx("defs",{children:f.jsxs("linearGradient",{id:je,x1:"0",y1:"0",x2:"0",y2:"1",children:[f.jsx("stop",{offset:"0%",stopColor:W,stopOpacity:"0.22"}),f.jsx("stop",{offset:"100%",stopColor:W,stopOpacity:"0"})]})}),f.jsx("path",{d:we,fill:`url(#${je})`})]}),f.jsx("path",{d:ge,stroke:W,strokeWidth:p?1.75:1.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]},"s"+ie)}),p&&E!==null&&(()=>{const te=18+e.length*16;let ie=Y(E)+10;ie+132>a-4&&(ie=Y(E)-132-10);const W=A.top+4;return f.jsxs("g",{children:[f.jsx("line",{x1:Y(E),x2:Y(E),y1:A.top,y2:A.top+D,stroke:k.fg3,strokeWidth:"1",strokeDasharray:"2 3"}),e.map((ge,we)=>ge[E]!=null&&f.jsx("circle",{cx:Y(E),cy:X(ge[E]),r:"3",fill:k.card,stroke:T[we%T.length],strokeWidth:"1.75"},"h"+we)),f.jsx("rect",{x:ie,y:W,width:132,height:te,rx:"6",fill:$A,stroke:UA}),f.jsx("text",{x:ie+9,y:W+13,fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:PA,style:{textTransform:"uppercase",letterSpacing:"0.10em"},children:n?n[E]:`t${E}`}),e.map((ge,we)=>f.jsxs("g",{children:[f.jsx("rect",{x:ie+9,y:W+22+we*16,width:"6",height:"6",rx:"1",fill:T[we%T.length]}),f.jsx("text",{x:ie+20,y:W+28+we*16,fontFamily:"JetBrains Mono, monospace",fontSize:"10.5",fill:FA,children:ge[E]!=null?yo(ge[E]):"—"})]},"tt"+we))]})})()]}))});HA.displayName="LineChart";const qA=Se.forwardRef((v,g)=>{var x=v,{series:e,xLabels:t=[],yMin:n,yMax:a,yTickCount:i=5,legend:r=!1,width:l=400,height:c=200,tone:u="light",ariaLabel:h,className:m=""}=x,p=Ie(x,["series","xLabels","yMin","yMax","yTickCount","legend","width","height","tone","ariaLabel","className"]);const b=xo[u],_=Y=>f.jsx("div",ee($({ref:g,className:m,style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center",color:b.fg3,fontSize:"12px"}},p),{children:Y}));if(!e||e.length===0)return _("No data");let S=1/0,M=-1/0,C=0;if(e.forEach(Y=>{if(Y.data&&Y.data.length>0){Y.data.length>C&&(C=Y.data.length);for(let X=0;X<Y.data.length;X++){const ne=Y.data[X];ne<S&&(S=ne),ne>M&&(M=ne)}}}),C===0)return _("No data");const k=isFinite(S)&&isFinite(M),L=n!==void 0?n:k?Math.min(0,S):0,E=(a!==void 0?a:k?M:1)-L||1,I={top:8,right:10,bottom:22,left:36},T=l-I.left-I.right,A=c-I.top-I.bottom,R=Y=>I.top+A-(Y-L)/E*A,D=R(Math.max(L,0)),O=Array.from({length:i},(Y,X)=>{const ne=i===1?1:i-1,q=L+E*X/ne;return{value:q,y:R(q)}}),B=T/C,z=B*.18,U=Math.max(1,(B-z*2)/e.length),F=(Y,X)=>Y.color?Td[Y.color]:Ow[X%Ow.length];return f.jsxs("div",ee($({ref:g,style:{display:"flex",flexDirection:"column",gap:"8px"},className:m},p),{children:[f.jsxs("svg",{role:"img","aria-label":h!=null?h:e.map(Y=>Y.name).join(", "),width:l,height:c,viewBox:`0 0 ${l} ${c}`,style:{display:"block"},children:[h&&f.jsx("title",{children:h}),O.map((Y,X)=>f.jsxs("g",{children:[f.jsx("line",{x1:I.left,x2:l-I.right,y1:Y.y,y2:Y.y,stroke:b.grid,strokeWidth:"1"}),f.jsx("text",{x:I.left-6,y:Y.y+3,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:b.fg3,children:yo(Y.value)})]},`y-${X}`)),f.jsx("line",{x1:I.left,x2:I.left,y1:I.top,y2:I.top+A,stroke:b.border,strokeWidth:"1"}),f.jsx("line",{x1:I.left,x2:l-I.right,y1:I.top+A,y2:I.top+A,stroke:b.border,strokeWidth:"1"}),e.map((Y,X)=>{const ne=F(Y,X);return f.jsx("g",{children:Y.data.map((q,he)=>{const pe=I.left+he*B+z+X*U,H=R(q),te=Math.min(H,D),ie=Math.abs(D-H);return f.jsx("rect",{x:pe,y:te,width:Math.max(1,U-1),height:Math.max(0,ie),fill:ne,rx:"1"},`bar-${X}-${he}`)})},`series-${X}`)}),t.map((Y,X)=>f.jsx("text",{x:I.left+(X+.5)*B,y:I.top+A+14,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:b.fg3,children:Y},`x-${X}`))]}),r&&f.jsx("div",{style:{display:"flex",gap:"12px",fontSize:"12px",flexWrap:"wrap",color:b.fg2},children:e.map((Y,X)=>f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[f.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"1px",backgroundColor:F(Y,X)}}),f.jsx("span",{children:Y.name})]},`legend-${X}`))})]}))});qA.displayName="BarChart";const VA=Se.forwardRef((b,x)=>{var _=b,{values:e,xLabels:t,color:n,width:a=480,height:i=200,axes:r=!1,grid:l=!1,ticks:c=4,threshold:u,tone:h="light",label:m,className:p="",style:g}=_,v=Ie(_,["values","xLabels","color","width","height","axes","grid","ticks","threshold","tone","label","className","style"]);const S=xo[h],M=n!=null?n:qc[2],C={top:8,right:8,bottom:r?22:6,left:r?30:6},k=a-C.left-C.right,L=i-C.top-C.bottom;if(!e||e.length===0)return null;const E=Math.max(...e,u?u.value:0),I=e.length,T=Math.max(2,k/I*.22),A=(k-T*(I-1))/I,R=O=>C.top+L-O/(E||1)*L,D=[];for(let O=0;O<=c;O++)D.push(O/c*E);return f.jsxs("svg",ee($({ref:x,role:"img","aria-label":m,width:a,height:i,viewBox:`0 0 ${a} ${i}`,className:p,style:$({display:"block"},g)},v),{children:[l&&D.map((O,B)=>f.jsx("line",{x1:C.left,x2:a-C.right,y1:R(O),y2:R(O),stroke:S.grid,strokeWidth:"1"},"g"+B)),r&&f.jsxs(f.Fragment,{children:[f.jsx("line",{x1:C.left,x2:C.left,y1:C.top,y2:C.top+L,stroke:S.border,strokeWidth:"1"}),f.jsx("line",{x1:C.left,x2:a-C.right,y1:C.top+L,y2:C.top+L,stroke:S.border,strokeWidth:"1"}),D.map((O,B)=>f.jsx("text",{x:C.left-6,y:R(O)+3,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:S.fg3,children:yo(O)},"yt"+B))]}),e.map((O,B)=>{const z=C.left+B*(A+T),U=R(O);return f.jsxs("g",{children:[f.jsx("rect",{x:z,y:U,width:A,height:C.top+L-U,fill:M,rx:"1"}),r&&t&&t[B]!==void 0&&f.jsx("text",{x:z+A/2,y:C.top+L+14,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:S.fg3,children:t[B]})]},B)}),u&&f.jsxs(f.Fragment,{children:[f.jsx("line",{x1:C.left,x2:a-C.right,y1:R(u.value),y2:R(u.value),stroke:S.fg3,strokeWidth:"1",strokeDasharray:"3 3"}),u.label&&f.jsx("text",{x:a-C.right-4,y:R(u.value)-4,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:S.fg3,style:{textTransform:"uppercase",letterSpacing:"0.08em"},children:u.label})]})]}))});VA.displayName="BarV";const YA="#22D3EE",GA=Se.forwardRef((g,p)=>{var v=g,{items:e,width:t=320,height:n=200,tone:a="light",showValues:i=!0,valueFormat:r,maxValue:l,label:c,className:u="",style:h}=v,m=Ie(v,["items","width","height","tone","showValues","valueFormat","maxValue","label","className","style"]);const x=xo[a],b={top:4,right:36,bottom:4,left:92},_=t-b.left-b.right,S=n-b.top-b.bottom;if(!e||e.length===0)return null;const M=l!=null?l:Math.max(...e.map(E=>E.value)),C=S/e.length,k=Math.min(C*.62,14),L=r!=null?r:yo;return f.jsx("svg",ee($({ref:p,role:"img","aria-label":c!=null?c:"Horizontal bar chart",width:t,height:n,viewBox:`0 0 ${t} ${n}`,className:u,style:$({display:"block"},h)},m),{children:e.map((E,I)=>{var D;const T=b.top+I*C+(C-k)/2,A=E.value/(M||1)*_,R=(D=E.color)!=null?D:YA;return f.jsxs("g",{children:[f.jsx("text",{x:b.left-10,y:T+k*.78,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"11",fill:x.fg2,children:E.label}),f.jsx("rect",{x:b.left,y:T,width:_,height:k,fill:x.inset,rx:"2"}),f.jsx("rect",{x:b.left,y:T,width:A,height:k,fill:R,rx:"2"}),i&&f.jsx("text",{x:b.left+A+6,y:T+k*.78,fontFamily:"JetBrains Mono, monospace",fontSize:"11",fill:x.fg2,fontWeight:"500",children:L(E.value)})]},E.label)})}))});GA.displayName="BarH";const KA=Se.forwardRef((b,x)=>{var _=b,{stacks:e,colors:t,width:n=480,height:a=200,axes:i=!1,grid:r=!1,ticks:l=4,normalized:c=!1,tone:u="light",label:h="Stacked bar chart",stackLabel:m,className:p="",style:g}=_,v=Ie(_,["stacks","colors","width","height","axes","grid","ticks","normalized","tone","label","stackLabel","className","style"]);const S=xo[u],M=t!=null?t:qc,C={top:m?24:8,right:8,bottom:i?22:6,left:i?30:6},k=n-C.left-C.right,L=a-C.top-C.bottom;if(!e||e.length===0)return null;const E=e.map(z=>z.parts.reduce((U,F)=>isNaN(U)||isNaN(F)?NaN:U+F,0)),I=E.filter(z=>!isNaN(z)),T=c?1:I.length>0?Math.max(...I):1,A=e.length,R=Math.max(2,k/A*.22),D=(k-R*(A-1))/A,O=[];for(let z=0;z<=l;z++)O.push(z/l*T);const B=z=>C.top+L-z/(T||1)*L;return f.jsxs("svg",ee($({ref:x,role:"img","aria-label":h,width:n,height:a,viewBox:`0 0 ${n} ${a}`,className:p,style:$({display:"block"},g)},v),{children:[r&&O.map((z,U)=>f.jsx("line",{x1:C.left,x2:n-C.right,y1:B(z),y2:B(z),stroke:S.grid,strokeWidth:"1"},"g"+U)),i&&f.jsxs(f.Fragment,{children:[f.jsx("line",{x1:C.left,x2:C.left,y1:C.top,y2:C.top+L,stroke:S.border,strokeWidth:"1"}),f.jsx("line",{x1:C.left,x2:n-C.right,y1:C.top+L,y2:C.top+L,stroke:S.border,strokeWidth:"1"}),O.map((z,U)=>f.jsx("text",{x:C.left-6,y:B(z)+3,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:S.fg3,children:c?`${Math.round(z*100)}%`:yo(z)},"yt"+U))]}),e.map((z,U)=>{const F=C.left+U*(D+R),Y=!isNaN(E[U])&&E[U]>0?E[U]:Math.max(...I,1);let X=0;return f.jsxs("g",{children:[z.parts.map((ne,q)=>{if(isNaN(ne))return null;const he=(c?ne/Y:ne)/(T||1)*L,pe=C.top+L-X-he;return X+=he,f.jsx("rect",{x:F,y:pe,width:D,height:he,fill:M[q%M.length]},q)}),m&&!isNaN(E[U])&&f.jsx("text",{x:F+D/2,y:C.top+L-X-6,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:S.fg3,children:m==="total"?yo(E[U]):m(z)}),i&&f.jsx("text",{x:F+D/2,y:C.top+L+14,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:S.fg3,children:z.label})]},U)})]}))});KA.displayName="StackedBar";const QA=Se.forwardRef((x,v)=>{var b=x,{slices:e,colors:t,width:n=160,height:a=160,thickness:i=14,gap:r=.03,centerValue:l,centerLabel:c,"aria-label":u,tone:h="light",className:m="",style:p}=b,g=Ie(b,["slices","colors","width","height","thickness","gap","centerValue","centerLabel","aria-label","tone","className","style"]);const _=xo[h],S=t!=null?t:qc;if(!e||e.length===0)return null;const M=n/2,C=a/2,k=Math.min(n,a)/2-4,L=k-i,E=e.reduce((B,z)=>B+z.value,0)||1;function I(B,z){const U=Math.cos(B),F=Math.sin(B),Y=Math.cos(z),X=Math.sin(z),ne=z-B>Math.PI?1:0;return[`M ${M+k*U} ${C+k*F}`,`A ${k} ${k} 0 ${ne} 1 ${M+k*Y} ${C+k*X}`,`L ${M+L*Y} ${C+L*X}`,`A ${L} ${L} 0 ${ne} 0 ${M+L*U} ${C+L*F}`,"Z"].join(" ")}const T=e.length>1?r:0;let A=-Math.PI/2;const R=e.map((B,z)=>{var X;const U=B.value/E*Math.PI*2,F=A+T/2;let Y=A+U-T/2;return Y-F>=Math.PI*2-1e-6&&(Y=F+Math.PI*2-1e-6),Y<=F&&(Y=F+1e-4),A+=U,{d:I(F,Y),color:(X=B.color)!=null?X:S[z%S.length]}}),D=Math.min(n,a)*.22,O=C+Math.min(n,a)*.18;return f.jsxs("svg",ee($({ref:v,role:"img","aria-label":u!=null?u:"Donut chart",width:n,height:a,viewBox:`0 0 ${n} ${a}`,className:m,style:$({display:"block"},p)},g),{children:[R.map((B,z)=>f.jsx("path",{d:B.d,fill:B.color},z)),l!=null&&f.jsx("text",{x:M,y:C+1,textAnchor:"middle",fontFamily:"Inter, sans-serif",fontSize:D,fontWeight:"700",fill:_.fg1,style:{letterSpacing:"-0.02em",fontVariantNumeric:"tabular-nums"},children:l}),c!=null&&f.jsx("text",{x:M,y:O,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:_.fg3,style:{textTransform:"uppercase",letterSpacing:"0.08em"},children:c})]}))});QA.displayName="Donut";const XA=Se.forwardRef((_,b)=>{var S=_,{data:e,baseColor:t="#10B981",xLabels:n,yLabels:a,width:i=480,height:r=120,axes:l=!1,tone:c="light",showValues:u=!1,valueFormat:h,cellMark:m,ariaLabel:p,className:g="",style:v}=S,x=Ie(S,["data","baseColor","xLabels","yLabels","width","height","axes","tone","showValues","valueFormat","cellMark","ariaLabel","className","style"]);const M=xo[c];if(!e||e.length===0)return null;const C=e.length,k=e[0].length,L={top:4,right:8,bottom:l?18:4,left:l?28:4},E=(i-L.left-L.right)/k,I=(r-L.top-L.bottom)/C,T=e.flat().filter(U=>U!=null&&!isNaN(U)),A=T.length?Math.min(...T):0,R=T.length?Math.max(...T):1,D=t.replace("#",""),O=h!=null?h:yo;function B(U){if(U==null||isNaN(U))return M.inset;const F=(U-A)/(R-A||1),Y=Math.round((.12+F*.88)*255).toString(16).padStart(2,"0");return`#${D}${Y}`}function z(U){return(U-A)/(R-A||1)>.55?"#FFFFFF":M.fg1}return f.jsxs("svg",ee($({ref:b,role:"img","aria-label":p!=null?p:"Heatmap",width:i,height:r,viewBox:`0 0 ${i} ${r}`,className:g,style:$({display:"block"},v)},x),{children:[p&&f.jsx("title",{children:p}),e.map((U,F)=>U.map((Y,X)=>{const ne=L.left+X*E+1,q=L.top+F*I+1,he=ne+(E-2)/2,pe=q+(I-2)/2,H=m==null?void 0:m(F,X,Y!=null&&!isNaN(Y)?Y:null);return f.jsxs("g",{children:[f.jsx("rect",{x:ne,y:q,width:Math.max(0,E-2),height:Math.max(0,I-2),fill:B(Y),rx:"2"}),u&&Y!=null&&!isNaN(Y)&&f.jsx("text",{x:he,y:pe+3.5,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:z(Y),children:O(Y)}),H&&f.jsx("g",{transform:`translate(${he}, ${pe})`,children:H})]},`${F}-${X}`)})),l&&a&&a.map((U,F)=>f.jsx("text",{x:L.left-6,y:L.top+F*I+I/2+3,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:M.fg3,children:U},"y"+F)),l&&n&&n.map((U,F)=>f.jsx("text",{x:L.left+F*E+E/2,y:r-L.bottom+12,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:M.fg3,children:U},"x"+F))]}))});XA.displayName="Heatmap";const ZA="#B45309",yy={ok:"#10B981",warn:"#F59E0B",error:"#F43F5E",idle:"",info:"#22D3EE"},JA=Se.forwardRef((v,g)=>{var x=v,{tracks:e,range:t=[0,100],width:n=480,height:a=160,axes:i=!1,xLabels:r,marker:l,tone:c="light","aria-label":u,className:h="",style:m}=x,p=Ie(x,["tracks","range","width","height","axes","xLabels","marker","tone","aria-label","className","style"]);const b=xo[c];if(!e||e.length===0)return null;const _={top:6,right:8,bottom:i?22:6,left:92},S=n-_.left-_.right,M=a-_.top-_.bottom,C=M/e.length,k=Math.min(C*.6,14),L=I=>_.left+(I-t[0])/(t[1]-t[0]||1)*S;function E(I){var T;return I==="idle"?b.border:(T=yy[I])!=null?T:I}return f.jsxs("svg",ee($({ref:g,role:"img","aria-label":u,width:n,height:a,viewBox:`0 0 ${n} ${a}`,className:h,style:$({display:"block"},m)},p),{children:[e.map((I,T)=>{const A=_.top+T*C+(C-k)/2;return f.jsxs("g",{children:[f.jsx("text",{x:_.left-10,y:A+k*.78,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"11",fill:b.fg2,children:I.label}),f.jsx("rect",{x:_.left,y:A,width:S,height:k,fill:b.inset,rx:"2"}),I.segments.map((R,D)=>f.jsx("rect",{x:L(R.start),y:A,width:Math.max(2,L(R.end)-L(R.start)),height:k,fill:E(R.kind),rx:"2"},D))]},T)}),i&&r&&r.map((I,T)=>f.jsx("text",{x:_.left+T/(r.length-1)*S,y:_.top+M+14,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:b.fg3,children:I},"x"+T)),l&&f.jsxs(f.Fragment,{children:[f.jsx("line",{x1:L(l.x),x2:L(l.x),y1:_.top-2,y2:_.top+M+2,stroke:yy.warn,strokeWidth:"1",strokeDasharray:"2 2"}),f.jsx("circle",{cx:L(l.x),cy:_.top-2,r:"3",fill:yy.warn}),l.label&&f.jsx("text",{x:L(l.x)+6,y:_.top+2,fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:ZA,style:{textTransform:"uppercase",letterSpacing:"0.08em"},children:l.label})]})]}))});JA.displayName="StatusTimeline";const Qx=Se.forwardRef((c,l)=>{var u=c,{percent:e,color:t="emerald",height:n=6,label:a,className:i=""}=u,r=Ie(u,["percent","color","height","label","className"]);const h=Number.isNaN(e)?0:Math.min(Math.max(e,0),100),m=`progress-bar--${t}`;return f.jsx("div",ee($({ref:l,className:`progress-bar ${m} ${i}`.trim(),style:{height:`${n}px`},role:"progressbar","aria-valuenow":h,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},r),{children:f.jsx("div",{className:"progress-bar__fill",style:{width:`${h}%`}})}))});Qx.displayName="ProgressBar";const WA=Se.forwardRef((p,m)=>{var g=p,{label:e,value:t,unit:n,percent:a,sparklineData:i=[],color:r="emerald",progressLabel:l,className:c="","aria-label":u}=g,h=Ie(g,["label","value","unit","percent","sparklineData","color","progressLabel","className","aria-label"]);return f.jsxs("div",ee($({ref:m,role:"row","aria-label":u!=null?u:e,className:`metric-row ${c}`.trim()},h),{children:[f.jsx("div",{className:"metric-row__label",children:e}),f.jsx("div",{className:"metric-row__progress",children:f.jsx(Qx,{percent:a,color:r,height:6,label:l!=null?l:e})}),f.jsx("div",{className:"metric-row__sparkline",children:f.jsx(Hx,{data:i,width:60,height:18,color:r})}),f.jsxs("div",{className:"metric-row__value",children:[t,n&&f.jsx("span",{className:"metric-row__unit",children:n})]})]}))});WA.displayName="MetricRow";const Xx=Se.forwardRef((u,c)=>{var h=u,{eyebrow:e,title:t,idChip:n,subtitle:a,actions:i,className:r=""}=h,l=Ie(h,["eyebrow","title","idChip","subtitle","actions","className"]);const m=["page-header",r].filter(Boolean).join(" ");return f.jsxs("div",ee($({ref:c,className:m,role:"banner"},l),{children:[f.jsxs("div",{className:"page-header__text",children:[e&&f.jsx("div",{className:"page-header__eyebrow","data-testid":"page-header-eyebrow",children:e}),f.jsxs("h1",{className:"page-header__title","data-testid":"page-header-title",children:[t,n&&f.jsx(fs,{form:"id-tag",className:"page-header__id-chip","data-testid":"page-header-id-chip",children:n})]}),a&&f.jsx("div",{className:"page-header__subtitle","data-testid":"page-header-subtitle",children:a})]}),i&&f.jsx("div",{className:"page-header__actions","data-testid":"page-header-actions",children:i})]}))});Xx.displayName="PageHeader";const eI=Se.forwardRef((v,g)=>{var x=v,{filters:e=[],value:t,defaultValue:n="",onSearchChange:a,onFilterRemove:i,onClearAll:r,searchPlaceholder:l="Search...",children:c,showingCount:u,totalCount:h,className:m=""}=x,p=Ie(x,["filters","value","defaultValue","onSearchChange","onFilterRemove","onClearAll","searchPlaceholder","children","showingCount","totalCount","className"]);const b=t!==void 0,[_,S]=j.useState(n),M=b?t:_,C=I=>{const T=I.target.value;b||S(T),a==null||a(T)},k=()=>{b||S(""),r==null||r()},L=["filter-bar",m].filter(Boolean).join(" "),E=Se.Children.count(c)>0;return f.jsxs("div",ee($({ref:g,className:L,"data-testid":"filter-bar"},p),{children:[f.jsxs("div",{className:"filter-bar__controls",children:[f.jsxs("div",{className:"filter-bar__search-wrapper",role:"search",children:[f.jsx(nt,{name:"search",size:16,className:"filter-bar__search-icon"}),f.jsx("input",{type:"text","aria-label":"Search",placeholder:l,value:M,onChange:C,className:"filter-bar__search-input","data-testid":"filter-bar-search"})]}),E&&f.jsx("div",{className:"filter-bar__children",children:c}),u!==void 0&&h!==void 0&&f.jsxs("div",{className:"filter-bar__caption",children:["Showing ",u," of ",h]})]}),e.length>0&&f.jsxs("div",{className:"filter-bar__chips","data-testid":"filter-bar-chips",children:[r&&f.jsx("button",{type:"button",className:"filter-bar__clear-all",onClick:k,"data-testid":"filter-bar-clear-all",children:"Clear all"}),e.map(I=>f.jsxs(fs,{variant:"neutral",className:"filter-bar__chip","data-testid":`filter-chip-${I.id}`,children:[f.jsx("span",{className:"filter-bar__chip-label",children:I.label}),f.jsx("button",{type:"button",className:"filter-bar__chip-close",onClick:()=>i==null?void 0:i(I.id),"aria-label":`Remove ${I.label} filter`,"data-testid":`filter-chip-close-${I.id}`,children:f.jsx(nt,{name:"x",size:14})})]},I.id))]})]}))});eI.displayName="FilterBar";const Ok=e=>{const t=typeof e=="string"?new Date(e):e,n=new Date().getTime()-t.getTime();if(Number.isNaN(n))return"";const a=Math.floor(n/6e4),i=Math.floor(n/36e5),r=Math.floor(n/864e5);return a<1?"just now":a<60?`${a}m ago`:i<24?`${i}h ago`:r<7?`${r}d ago`:t.toLocaleDateString()},tI=e=>{const t=typeof e=="string"?new Date(e):e;if(Number.isNaN(t.getTime()))return"";const n=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return`${n}:${a}:${i}`},Vc=(e,t)=>{const n=typeof e=="string"?new Date(e):e,a=typeof t=="string"?new Date(t):t;return n.getFullYear()===a.getFullYear()&&n.getMonth()===a.getMonth()&&n.getDate()===a.getDate()},zk=e=>Vc(e,new Date),Yc=(e,t=0)=>{const n=typeof e=="string"?new Date(e):new Date(e);let a=n.getDay()-t;a<0&&(a+=7);const i=new Date(n);i.setDate(n.getDate()-a);const r=[];for(let l=0;l<7;l++){const c=new Date(i);c.setDate(i.getDate()+l),r.push(c)}return r},nI=8,Bk=(e,t=0)=>{const n=typeof e=="string"?new Date(e):e;if(Number.isNaN(n.getTime()))return[];const a=new Date(n.getFullYear(),n.getMonth(),1),i=Yc(a,t),r=[];let l=new Date(i[0]);for(;r.length<nI;){const c=Yc(l,t);r.push(c);const u=c[c.length-1];if(u.getMonth()>n.getMonth()||u.getFullYear()>n.getFullYear())break;l=new Date(u),l.setDate(l.getDate()+1)}return r},aI=e=>(typeof e=="string"?new Date(e):new Date(e)).toLocaleDateString("en-US",{month:"long",year:"numeric"}),Rv=e=>(typeof e=="string"?new Date(e):new Date(e)).toLocaleDateString("en-US",{month:"short",day:"numeric"}),sI=(e,t)=>{const n=Yc(e,t),a=Rv(n[0]),i=Rv(n[6]);return`${a} – ${i}`},iI={create:"emerald",update:"cyan",delete:"rose",run:"amber"},rI=Se.forwardRef((r,i)=>{var l=r,{events:e=[],emptyState:t="No activity recorded",className:n=""}=l,a=Ie(l,["events","emptyState","className"]);const c=["activity-timeline",n].filter(Boolean).join(" ");return e.length===0?f.jsx("div",ee($({ref:i,className:c,"data-testid":"activity-timeline"},a),{children:f.jsx("div",{className:"activity-timeline__empty","data-testid":"activity-timeline-empty",children:t})})):f.jsx("div",ee($({ref:i,className:c,"data-testid":"activity-timeline"},a),{children:f.jsx("div",{className:"activity-timeline__list",children:e.map(u=>f.jsxs("div",ee($($({className:["activity-timeline__event",u.onClick?"activity-timeline__event--clickable":""].filter(Boolean).join(" "),"data-testid":`activity-event-${u.id}`},u.kind&&{"data-kind":u.kind}),u.onClick&&{role:"button",tabIndex:0,onClick:()=>u.onClick(u),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),u.onClick(u))}}),{children:[f.jsx("div",{className:"activity-timeline__dot-container",children:u.dotColor?f.jsx("div",{className:"activity-timeline__dot--custom",style:{backgroundColor:Td[u.dotColor]},"data-testid":`activity-dot-custom-${u.id}`}):f.jsx(Ux,{color:iI[u.type],className:"activity-timeline__dot","data-testid":`activity-dot-${u.type}`})}),f.jsxs("div",{className:"activity-timeline__content",children:[f.jsxs("div",{className:"activity-timeline__header",children:[u.kind&&f.jsx("span",{className:"activity-timeline__kind-label","data-testid":`activity-kind-tag-${u.id}`,children:u.kindLabel||u.kind}),f.jsx("div",{className:"activity-timeline__subject","data-testid":"activity-subject",children:u.headline||u.subject})]}),u.meta&&f.jsx("div",{className:"activity-timeline__meta","data-testid":"activity-meta",children:u.meta})]}),f.jsx("div",{className:"activity-timeline__timestamp","data-testid":"activity-timestamp",children:Ok(u.timestamp)})]}),u.id))})}))});rI.displayName="ActivityTimeline";const oI=Se.forwardRef((u,c)=>{var h=u,{entries:e=[],selectedId:t,onSelect:n,order:a="newest-first",emptyState:i="No versions available",className:r=""}=h,l=Ie(h,["entries","selectedId","onSelect","order","emptyState","className"]);const m=j.useRef(null),p=Se.useMemo(()=>{const _=[...e];return a==="oldest-first"?_.reverse():_},[e,a]),g=p.findIndex(_=>_.id===t),v=_=>{n&&(_.key==="ArrowUp"?(_.preventDefault(),g>0&&n(p[g-1].id)):_.key==="ArrowDown"?(_.preventDefault(),g<p.length-1&&n(p[g+1].id)):(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),g>=0&&n(p[g].id)))};j.useEffect(()=>{if(g>=0&&m.current&&t){const _=m.current.querySelector(`[data-version-id="${CSS.escape(t)}"]`);_&&_.scrollIntoView({block:"nearest"})}},[t,g]);const x=["version-timeline",r].filter(Boolean).join(" ");if(p.length===0)return f.jsx("div",ee($({ref:c,className:x,"data-testid":"version-timeline"},l),{children:f.jsx("div",{className:"version-timeline__empty","data-testid":"version-timeline-empty",children:i})}));const b=p.length>1;return f.jsx("div",ee($({ref:c,className:x,"data-testid":"version-timeline",role:"listbox",tabIndex:0,onKeyDown:v},l),{children:f.jsx("div",{className:"version-timeline__list",ref:m,children:p.map((_,S)=>f.jsxs("div",ee($({className:["version-timeline__entry",t===_.id?"version-timeline__entry--selected":"",n?"version-timeline__entry--clickable":""].filter(Boolean).join(" "),"data-version-id":_.id,"data-testid":`version-entry-${_.id}`,role:"option","aria-selected":t===_.id},n&&{onClick:()=>n(_.id),tabIndex:0}),{children:[f.jsxs("div",{className:"version-timeline__rail",children:[b&&S<p.length-1&&f.jsx("div",{className:"version-timeline__connector"}),f.jsx("div",{className:["version-timeline__dot",_.head?"version-timeline__dot--head":"version-timeline__dot--hollow"].filter(Boolean).join(" "),"data-testid":`version-dot-${_.id}`})]}),f.jsxs("div",{className:"version-timeline__content",children:[f.jsxs("div",{className:"version-timeline__header",children:[f.jsx(Es,{tone:"amber",className:"version-timeline__pill",children:_.label}),_.head&&f.jsx(fs,{variant:"amber",form:"default",className:"version-timeline__head-chip","data-testid":`version-head-${_.id}`,children:"head"})]}),_.headline&&f.jsx("div",{className:"version-timeline__headline","data-testid":`version-headline-${_.id}`,children:_.headline}),_.transition?f.jsxs("div",{className:"version-timeline__transition","data-testid":`version-transition-${_.id}`,children:[f.jsx("span",{className:"version-timeline__transition-label",children:_.transition.from}),f.jsx("span",{className:"version-timeline__transition-arrow",children:"→"}),f.jsx("span",{className:"version-timeline__transition-label",children:_.transition.to})]}):_.stats?f.jsxs("div",{className:"version-timeline__stats","data-testid":`version-stats-${_.id}`,children:[_.stats.added!==void 0&&f.jsxs("span",{className:"version-timeline__stat version-timeline__stat--added",children:[f.jsxs("span",{className:"version-timeline__stat-symbol",children:["+",_.stats.added]}),f.jsxs("span",{className:"version-timeline__stat-label","aria-label":`${_.stats.added} added`,children:[_.stats.added," added"]})]}),_.stats.removed!==void 0&&f.jsxs("span",{className:"version-timeline__stat version-timeline__stat--removed",children:[f.jsxs("span",{className:"version-timeline__stat-symbol",children:["−",_.stats.removed]}),f.jsxs("span",{className:"version-timeline__stat-label","aria-label":`${_.stats.removed} removed`,children:[_.stats.removed," removed"]})]}),_.stats.kept!==void 0&&f.jsxs("span",{className:"version-timeline__stat version-timeline__stat--kept",children:[f.jsxs("span",{className:"version-timeline__stat-symbol",children:["∩",_.stats.kept]}),f.jsxs("span",{className:"version-timeline__stat-label","aria-label":`${_.stats.kept} kept`,children:[_.stats.kept," kept"]})]})]}):null]}),f.jsx("div",{className:"version-timeline__timestamp","data-testid":`version-timestamp-${_.id}`,children:Ok(_.timestamp)})]}),_.id))})}))});oI.displayName="VersionTimeline";const Zx=({itemCount:e,itemHeight:t,containerHeight:n,overscan:a=5})=>{const i=j.useRef(null),r=j.useRef(null),[l,c]=j.useState([0,Math.ceil(n/t)]);return j.useEffect(()=>{const u=i.current,h=r.current;if(!u||!h)return;const m=()=>{const p=h.getBoundingClientRect(),g=u.getBoundingClientRect().top-p.top,v=Math.max(0,Math.floor(g/t)-a),x=Math.min(e,Math.ceil((g+n)/t)+a);c(b=>b[0]===v&&b[1]===x?b:[v,x])};return u.addEventListener("scroll",m,{passive:!0}),m(),()=>{u.removeEventListener("scroll",m)}},[e,t,n,a]),{visibleRange:l,containerRef:i,sentinelRef:r}},dc=28,lI=400,$k=Se.forwardRef((c,l)=>{var u=c,{added:e=[],removed:t=[],kept:n=[],maxVisible:a=10,className:i=""}=u,r=Ie(u,["added","removed","kept","maxVisible","className"]);const[h,m]=j.useState(!1),p=e.length>0||t.length>0||n.length>0,g=n.length>a&&!h,v=h?n:n.slice(0,a),x=n.length-v.length,b=Math.max(e.length,t.length,g?a+1:n.length),{visibleRange:_,containerRef:S,sentinelRef:M}=Zx({itemCount:b,itemHeight:dc,containerHeight:lI}),[C,k]=_,L=["hash-set-diff",i].filter(Boolean).join(" ");return p?f.jsxs("div",ee($({ref:l,className:L,role:"table"},r),{children:[f.jsxs("div",{className:"hash-set-diff__header",role:"row",children:[f.jsxs("div",{className:"hash-set-diff__column hash-set-diff__column--added",role:"cell",children:[f.jsx(Es,{tone:"emerald",className:"hash-set-diff__pill",children:"Added"}),f.jsx("span",{className:"hash-set-diff__count",children:e.length})]}),f.jsxs("div",{className:"hash-set-diff__column hash-set-diff__column--removed",role:"cell",children:[f.jsx(Es,{tone:"rose",className:"hash-set-diff__pill",children:"Removed"}),f.jsx("span",{className:"hash-set-diff__count",children:t.length})]}),f.jsxs("div",{className:"hash-set-diff__column hash-set-diff__column--kept",role:"cell",children:[f.jsx(Es,{className:"hash-set-diff__pill",children:"Kept"}),f.jsx("span",{className:"hash-set-diff__count",children:n.length})]})]}),f.jsx("div",{className:"hash-set-diff__viewport",ref:S,children:f.jsxs("div",{className:"hash-set-diff__content",style:{height:b*dc,position:"relative"},children:[f.jsx("div",{ref:M,style:{position:"absolute",top:0,left:0,width:"1px",height:`${b*dc}px`,visibility:"hidden",pointerEvents:"none"}}),f.jsx("div",{style:{height:C*dc}}),Array.from({length:Math.min(k-C,b-C)}).map((E,I)=>{const T=C+I,A=T<e.length?e[T]:null,R=T<t.length?t[T]:null;let D=null,O=!1;return g&&T===a?O=!0:T<v.length&&(D=v[T]),f.jsxs("div",{className:"hash-set-diff__row",style:{height:dc},role:"row",children:[f.jsx("div",{className:"hash-set-diff__cell hash-set-diff__cell--added",role:"cell",children:A&&f.jsx("div",{className:"hash-set-diff__item",children:A})}),f.jsx("div",{className:"hash-set-diff__cell hash-set-diff__cell--removed",role:"cell",children:R&&f.jsx("div",{className:"hash-set-diff__item",children:R})}),f.jsx("div",{className:"hash-set-diff__cell hash-set-diff__cell--kept",role:"cell",children:O?f.jsxs("button",{type:"button",className:"hash-set-diff__expand-button",onClick:()=>m(!0),"aria-label":`Show ${x} more kept items`,children:["… ",x," more carried forward"]}):D&&f.jsx("div",{className:"hash-set-diff__item",children:D})})]},T)}),f.jsx("div",{style:{height:Math.max(0,(b-k)*dc)}})]})})]})):f.jsx("div",ee($({ref:l,className:L},r),{children:f.jsx("div",{className:"hash-set-diff__empty",children:"No changes between these versions"})}))});$k.displayName="HashSetDiff";const hc=24,cI=500,Jx=Se.forwardRef((i,a)=>{var r=i,{lines:e=[],className:t=""}=r,n=Ie(r,["lines","className"]);const{visibleRange:l,containerRef:c,sentinelRef:u}=Zx({itemCount:e.length,itemHeight:hc,containerHeight:cI}),[h,m]=l,p=["side-by-side-diff",t].filter(Boolean).join(" ");return e.length>0?f.jsxs("div",ee($({ref:a,className:p,role:"table"},n),{children:[f.jsxs("div",{className:"side-by-side-diff__header",role:"row",children:[f.jsx("div",{className:"side-by-side-diff__gutter",role:"cell"}),f.jsx("div",{role:"cell",className:"side-by-side-diff__header-cell",children:f.jsx(Es,{tone:"emerald",className:"side-by-side-diff__pill side-by-side-diff__pill--added",children:"Version 2 (Added)"})}),f.jsx("div",{role:"cell",className:"side-by-side-diff__header-cell",children:f.jsx(Es,{tone:"rose",className:"side-by-side-diff__pill side-by-side-diff__pill--removed",children:"Version 1 (Removed)"})})]}),f.jsx("div",{className:"side-by-side-diff__viewport",ref:c,children:f.jsxs("div",{className:"side-by-side-diff__content",style:{height:e.length*hc,position:"relative"},children:[f.jsx("div",{ref:u,style:{position:"absolute",top:0,left:0,width:"1px",height:`${e.length*hc}px`,visibility:"hidden",pointerEvents:"none"}}),f.jsx("div",{style:{height:h*hc}}),e.slice(h,m).map((g,v)=>{const x=h+v,b=g.type==="hunk",_=g.type==="added",S=g.type==="removed";return f.jsx("div",{className:["side-by-side-diff__row",`side-by-side-diff__row--${g.type}`].filter(Boolean).join(" "),style:{height:hc},role:"row",children:b?f.jsx("div",{className:"side-by-side-diff__hunk",role:"cell",children:g.content}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:["side-by-side-diff__gutter",_&&"side-by-side-diff__gutter--added",S&&"side-by-side-diff__gutter--removed"].filter(Boolean).join(" "),role:"cell",children:f.jsx("span",{className:"sr-only",children:_?"added":S?"removed":""})}),f.jsx("div",{className:["side-by-side-diff__line",_&&"side-by-side-diff__line--added",S&&"side-by-side-diff__line--removed"].filter(Boolean).join(" "),role:"cell",children:f.jsx("span",{className:"side-by-side-diff__content",children:g.content})})]})},x)}),f.jsx("div",{style:{height:Math.max(0,(e.length-m)*hc)}})]})})]})):f.jsx("div",ee($({ref:a,className:p},n),{children:f.jsx("div",{className:"side-by-side-diff__empty",children:"No changes between these versions"})}))});Jx.displayName="SideBySideDiff";const Wx=j.createContext(null),Uk=Se.forwardRef((l,r)=>{var c=l,{mode:e="hash-set",onModeChange:t,children:n,className:a=""}=c,i=Ie(c,["mode","onModeChange","children","className"]);const[u,h]=j.useState(e);j.useEffect(()=>{h(e)},[e]);const m=v=>{h(v),t==null||t(v)},p=v=>{var x,b,_,S,M;const C=Array.from(((x=v.currentTarget.closest('[role="tablist"]'))==null?void 0:x.querySelectorAll('[role="tab"]'))||[]),k=C.indexOf(v.currentTarget);if(v.key==="ArrowLeft"){v.preventDefault();const L=k>0?k-1:C.length-1;(b=C[L])==null||b.focus()}else if(v.key==="ArrowRight"){v.preventDefault();const L=k<C.length-1?k+1:0;(_=C[L])==null||_.focus()}else v.key==="Home"?(v.preventDefault(),(S=C[0])==null||S.focus()):v.key==="End"&&(v.preventDefault(),(M=C[C.length-1])==null||M.focus())},g=["diff-viewer",a].filter(Boolean).join(" ");return f.jsx(Wx.Provider,{value:u,children:f.jsxs("div",ee($({ref:r,className:g,role:"region","aria-label":"Diff Viewer","data-testid":"diff-viewer"},i),{children:[f.jsxs("div",{className:"diff-viewer__header",role:"tablist",children:[f.jsx("button",{type:"button",id:"diff-viewer-hash-set-tab",role:"tab","aria-selected":u==="hash-set","aria-controls":"diff-viewer-hash-set-panel",className:["diff-viewer__tab",u==="hash-set"&&"diff-viewer__tab--active"].filter(Boolean).join(" "),onClick:()=>m("hash-set"),onKeyDown:p,children:"Hash Set"}),f.jsx("button",{type:"button",id:"diff-viewer-side-by-side-tab",role:"tab","aria-selected":u==="side-by-side","aria-controls":"diff-viewer-side-by-side-panel",className:["diff-viewer__tab",u==="side-by-side"&&"diff-viewer__tab--active"].filter(Boolean).join(" "),onClick:()=>m("side-by-side"),onKeyDown:p,children:"Side by Side"})]}),f.jsxs("div",{className:"diff-viewer__content","data-testid":"diff-viewer-content",children:[u==="hash-set"&&f.jsx("div",{id:"diff-viewer-hash-set-panel",role:"tabpanel","aria-labelledby":"diff-viewer-hash-set-tab",className:"diff-viewer__panel diff-viewer__panel--hash-set",children:n}),u==="side-by-side"&&f.jsx("div",{id:"diff-viewer-side-by-side-panel",role:"tabpanel","aria-labelledby":"diff-viewer-side-by-side-tab",className:"diff-viewer__panel diff-viewer__panel--side-by-side",children:n})]})]}))})});Uk.displayName="DiffViewer";function Fk(u){var h=u,{added:e,removed:t,kept:n,maxVisible:a,label:i="Changes",labelTone:r="amber",className:l=""}=h,c=Ie(h,["added","removed","kept","maxVisible","label","labelTone","className"]);return j.useContext(Wx)!=="hash-set"?null:f.jsxs("div",ee($({className:["diff-viewer-hash-set",l].filter(Boolean).join(" ")},c),{children:[i&&f.jsx("div",{className:"diff-viewer-hash-set__header",children:f.jsx(Es,{tone:r,className:"diff-viewer-hash-set__label",children:i})}),f.jsx($k,{added:e,removed:t,kept:n,maxVisible:a})]}))}Fk.displayName="DiffViewerHashSet";function Pk(c){var u=c,{lines:e,addedLabel:t="Version 2 (Added)",removedLabel:n="Version 1 (Removed)",addedLabelTone:a="emerald",removedLabelTone:i="rose",className:r=""}=u,l=Ie(u,["lines","addedLabel","removedLabel","addedLabelTone","removedLabelTone","className"]);return j.useContext(Wx)!=="side-by-side"?null:f.jsxs("div",ee($({className:["diff-viewer-side-by-side",r].filter(Boolean).join(" ")},l),{children:[(t||n)&&f.jsx("div",{className:"diff-viewer-side-by-side__header",children:f.jsxs("div",{className:"diff-viewer-side-by-side__labels",children:[t&&f.jsx(Es,{tone:a,className:"diff-viewer-side-by-side__label",children:t}),n&&f.jsx(Es,{tone:i,className:"diff-viewer-side-by-side__label",children:n})]})}),f.jsx(Jx,{lines:e})]}))}Pk.displayName="DiffViewerSideBySide";Object.assign(Uk,{HashSet:Fk,SideBySide:Pk});const uI={error:"rose",warn:"amber",info:"cyan",success:"emerald"},dI=Se.forwardRef((r,i)=>{var l=r,{alerts:e=[],onDismiss:t,className:n=""}=l,a=Ie(l,["alerts","onDismiss","className"]);const c=["alert-strip",n].filter(Boolean).join(" ");return e.length===0?null:f.jsx("div",ee($({ref:i,className:c,"data-testid":"alert-strip"},a),{children:e.map(u=>f.jsxs("div",{className:"alert-strip__alert","data-testid":`alert-${u.id}`,children:[f.jsx(Ux,{color:uI[u.severity],"data-testid":`alert-severity-${u.severity}`}),f.jsx("div",{className:"alert-strip__message","data-testid":"alert-message",children:u.message}),t&&f.jsx("button",{type:"button",className:"alert-strip__dismiss",onClick:()=>t(u.id),"aria-label":`Dismiss alert: ${u.message}`,"data-testid":`alert-dismiss-${u.id}`,children:f.jsx(nt,{name:"x",size:16})})]},u.id))}))});dI.displayName="AlertStrip";const Hk=Se.forwardRef((l,r)=>{var c=l,{icon:e,title:t,description:n,className:a=""}=c,i=Ie(c,["icon","title","description","className"]);const u=["quick-access-tile",a].filter(Boolean).join(" ");return f.jsxs("button",ee($({ref:r,type:"button",className:u,"data-testid":"quick-access-tile"},i),{children:[f.jsx("div",{className:"quick-access-tile__icon",children:f.jsx(nt,{name:e,size:16})}),f.jsxs("div",{className:"quick-access-tile__body",children:[f.jsx("div",{className:"quick-access-tile__title",children:t}),n&&f.jsx("div",{className:"quick-access-tile__description",children:n})]}),f.jsx(nt,{name:"chevronRight",size:13,className:"quick-access-tile__chev"})]}))});Hk.displayName="QuickAccessTile";const hI=Se.forwardRef((l,r)=>{var c=l,{tiles:e,onAction:t,columns:n=4,className:a=""}=c,i=Ie(c,["tiles","onAction","columns","className"]);const u=["quick-access-grid",a].filter(Boolean).join(" ");return f.jsx("div",ee($({ref:r,className:u,style:{"--qa-columns":n},"data-testid":"quick-access-grid"},i),{children:e.map(h=>f.jsx(Hk,{icon:h.icon,title:h.title,description:h.description,onClick:()=>t==null?void 0:t(h.id),"data-testid":`quick-access-tile-${h.id}`},h.id))}))});hI.displayName="QuickAccessGrid";const fI=Se.forwardRef((m,h)=>{var p=m,{icon:e,title:t,description:n,summary:a=[],onClick:i,className:r="",disabled:l,type:c="button"}=p,u=Ie(p,["icon","title","description","summary","onClick","className","disabled","type"]);const g=["config-tile",l&&"config-tile--disabled",r].filter(Boolean).join(" ");return f.jsxs("button",ee($({ref:h,type:c,className:g,onClick:i,disabled:l,"data-testid":"config-tile"},u),{children:[f.jsx("div",{className:"config-tile__icon",children:f.jsx(nt,{name:e,size:24})}),f.jsxs("div",{className:"config-tile__content",children:[f.jsx("div",{className:"config-tile__title",children:t}),n&&f.jsx("div",{className:"config-tile__description",children:n}),a.length>0&&f.jsx("div",{className:"config-tile__summary",children:a.map((v,x)=>f.jsxs(Se.Fragment,{children:[f.jsx("div",{className:"config-tile__summary-key",children:v.label}),f.jsx("div",{className:"config-tile__summary-value",children:v.value})]},x))})]}),f.jsx("div",{className:"config-tile__chevron",children:f.jsx(nt,{name:"chevronRight",size:16})})]}))});fI.displayName="ConfigTile";const pI=e=>/^https?:\/\//.test(e)||e.startsWith("/"),qk=Se.forwardRef((p,m)=>{var g=p,{role:e,senderName:t,timestamp:n,body:a,avatar:i,badge:r,toolBlock:l,thinkingBlock:c,className:u=""}=g,h=Ie(g,["role","senderName","timestamp","body","avatar","badge","toolBlock","thinkingBlock","className"]);const v=i&&pI(i)?f.jsx("img",{src:i,alt:t,className:"chat-message__avatar-img"}):i||t.slice(0,2).toUpperCase();return f.jsxs("div",ee($({ref:m,className:["chat-message",`chat-message--${e}`,u].filter(Boolean).join(" "),"data-testid":`chat-message-${e}`},h),{children:[f.jsx("div",{className:"chat-message__avatar",children:v}),f.jsxs("div",{className:"chat-message__content",children:[f.jsxs("div",{className:"chat-message__meta",children:[f.jsx("span",{className:"chat-message__sender",children:t}),r&&f.jsx("span",{className:"chat-message__badge",children:r}),f.jsx("span",{className:"chat-message__timestamp",children:n})]}),f.jsx("div",{className:"chat-message__body",children:a}),c&&f.jsx(Yk,{content:c.content}),l&&f.jsx(Vk,{name:l.name,status:l.status,output:l.output})]})]}))});qk.displayName="ChatMessage";const Vk=Se.forwardRef((u,c)=>{var h=u,{name:e,status:t,output:n=[],defaultCollapsed:a=!1,onToggleCollapsed:i,className:r=""}=h,l=Ie(h,["name","status","output","defaultCollapsed","onToggleCollapsed","className"]);const[m,p]=Se.useState(a),g=Se.useId(),v=Se.useCallback(()=>{const b=!m;p(b),i==null||i(b)},[m,i]),x=t==="running"?"amber":t==="success"?"emerald":"rose";return f.jsxs("div",ee($({ref:c,className:["tool-block",r].filter(Boolean).join(" "),"data-testid":"tool-block"},l),{children:[f.jsxs("button",{type:"button",className:"tool-block__header",onClick:v,"aria-expanded":!m,"aria-controls":n.length>0?g:void 0,children:[f.jsx(nt,{name:m?"chevronRight":"chevronDown",size:12,className:"tool-block__toggle-icon"}),f.jsx("span",{className:"tool-block__name",children:e}),f.jsx("span",{className:`tool-block__status tool-block__status--${x}`,children:t==="running"?"running":t==="success"?"success":"error"})]}),!m&&n.length>0&&f.jsx("div",{id:g,className:"tool-block__output",children:n.map((b,_)=>f.jsxs("div",{className:"tool-block__output-row",children:[b.key&&f.jsx("span",{className:"tool-block__key",children:b.key}),f.jsx("span",{className:"tool-block__value",children:b.value})]},_))})]}))});Vk.displayName="ToolBlock";const Yk=Se.forwardRef((c,l)=>{var u=c,{content:e,label:t="thinking",defaultCollapsed:n=!1,onToggleCollapsed:a,className:i=""}=u,r=Ie(u,["content","label","defaultCollapsed","onToggleCollapsed","className"]);const[h,m]=Se.useState(n),p=Se.useId(),g=Se.useCallback(()=>{const v=!h;m(v),a==null||a(v)},[h,a]);return f.jsxs("div",ee($({ref:l,className:["thinking-block",i].filter(Boolean).join(" "),"data-testid":"thinking-block"},r),{children:[f.jsxs("button",{type:"button",className:"thinking-block__header",onClick:g,"aria-expanded":!h,"aria-controls":h?void 0:p,children:[f.jsx(nt,{name:h?"chevronRight":"chevronDown",size:12,className:"thinking-block__toggle-icon"}),f.jsx("span",{className:"thinking-block__label",children:t})]}),!h&&f.jsx("div",{id:p,className:"thinking-block__content",children:e})]}))});Yk.displayName="ThinkingBlock";const mI=Se.forwardRef((i,a)=>{var r=i,{label:e,className:t=""}=r,n=Ie(r,["label","className"]);return f.jsxs("div",ee($({ref:a,role:"separator","aria-label":e,className:["chat-divider",t].filter(Boolean).join(" "),"data-testid":"chat-divider"},n),{children:[f.jsx("span",{className:"chat-divider__line"}),f.jsx("span",{className:"chat-divider__label","aria-hidden":"true",children:e}),f.jsx("span",{className:"chat-divider__line"})]}))});mI.displayName="ChatDivider";const Gk=Se.forwardRef((c,l)=>{var u=c,{suggestions:e,onSelect:t,selected:n,className:a="","aria-label":i="Suggestions"}=u,r=Ie(u,["suggestions","onSelect","selected","className","aria-label"]);if(!e||e.length===0)return null;const h=n!==void 0;return f.jsx("div",ee($({ref:l,role:"group","aria-label":i,className:["chat-suggestions",a].filter(Boolean).join(" "),"data-testid":"chat-suggestions"},r),{children:e.map(m=>{const p=m===n,g=h&&!p;return f.jsx("button",{className:["chat-suggestions__pill",p?"chat-suggestions__pill--selected":"",g?"chat-suggestions__pill--disabled":""].filter(Boolean).join(" "),onClick:()=>!g&&t(m),type:"button",disabled:g,"aria-pressed":p,children:m},m)})}))});Gk.displayName="ChatSuggestions";const gI=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`id-${Math.random().toString(36).slice(2,11)}-${Date.now()}`,Kk=Se.forwardRef((S,_)=>{var M=S,{placeholder:e="Type a message...",value:t,onChange:n,onSubmit:a,onContextChange:i,onAttachmentChange:r,scopeLabel:l,contextItems:c=[],attachments:u=[],disabled:h=!1,loading:m=!1,label:p="Message",accept:g,enterBehavior:v="send",className:x}=M,b=Ie(M,["placeholder","value","onChange","onSubmit","onContextChange","onAttachmentChange","scopeLabel","contextItems","attachments","disabled","loading","label","accept","enterBehavior","className"]);const C=j.useRef(null),k=j.useRef(null);j.useEffect(()=>{if(C.current){C.current.style.height="auto";const R=Math.min(C.current.scrollHeight,200);C.current.style.height=`${R}px`}},[t]);const L=R=>{R.key==="Enter"&&!R.shiftKey&&v==="send"&&(R.preventDefault(),t.trim()&&!h&&!m&&a(t,c))},E=()=>{t.trim()&&!h&&!m&&a(t,c)},I=R=>{const D=c.filter(O=>O.id!==R);i==null||i(D)},T=R=>{if(!R.target.files)return;const D=Array.from(R.target.files).map(B=>({id:gI(),name:B.name,size:B.size})),O=[...u,...D];r==null||r(O),k.current&&(k.current.value="")},A=R=>{const D=u.filter(O=>O.id!==R);r==null||r(D)};return f.jsxs("div",ee($({ref:_,className:["chat-composer",h&&"chat-composer--disabled",x].filter(Boolean).join(" ")},b),{children:[f.jsxs("div",{className:"chat-composer__tools",children:[l&&f.jsxs("span",{className:"chat-composer__scope",children:["talking to ",f.jsx("b",{children:l})]}),c.map(R=>f.jsxs("div",{className:"chat-composer__context-pill",children:[f.jsx("span",{className:"chat-composer__context-label",children:R.label}),f.jsx("button",{className:"chat-composer__context-remove",onClick:()=>I(R.id),"aria-label":`Remove ${R.label}`,type:"button",children:f.jsx(nt,{name:"x",size:10})})]},R.id)),u.map(R=>f.jsxs("div",{className:"chat-composer__attachment-pill",children:[f.jsx(nt,{name:"paperclip",size:10}),f.jsx("span",{className:"chat-composer__attachment-label",children:R.name}),f.jsx("button",{className:"chat-composer__attachment-remove",onClick:()=>A(R.id),"aria-label":`Remove ${R.name}`,type:"button",children:f.jsx(nt,{name:"x",size:10})})]},R.id))]}),f.jsxs("div",{className:"chat-composer__input-wrapper",children:[f.jsx("textarea",{ref:C,className:"chat-composer__input",placeholder:e,value:t,onChange:R=>n(R.target.value),onKeyDown:L,rows:2,disabled:h,"aria-label":p}),f.jsxs("div",{className:"chat-composer__footer",children:[f.jsx("div",{className:"chat-composer__footer-start",children:v==="send"&&f.jsxs("span",{className:"chat-composer__hint",children:[f.jsx("b",{children:"↵"})," send · ",f.jsx("b",{children:"⇧↵"})," newline"]})}),f.jsxs("div",{className:"chat-composer__footer-end",children:[f.jsx("input",{ref:k,type:"file",multiple:!0,accept:g,onChange:T,className:"chat-composer__file-input","aria-label":"Attach files"}),f.jsx("button",{className:"chat-composer__attach-button",onClick:()=>{var R;return(R=k.current)==null?void 0:R.click()},type:"button","aria-label":"Attach files",disabled:h,children:f.jsx(nt,{name:"paperclip",size:12})}),f.jsxs(Bn,{variant:"primary",size:"sm",onClick:E,disabled:!t.trim()||h||m,children:[f.jsx(nt,{name:"send",size:12}),"send"]})]})]})]})]}))});Kk.displayName="ChatComposer";const Qk=Se.forwardRef((h,u)=>{var m=h,{children:e,bots:t=[],activeBotId:n,onBotChange:a,autoScroll:i=!0,composer:r,className:l=""}=m,c=Ie(m,["children","bots","activeBotId","onBotChange","autoScroll","composer","className"]);const p=j.useRef(null);return j.useEffect(()=>{i&&p.current&&(p.current.scrollTop=p.current.scrollHeight)},[e,i]),f.jsxs("div",ee($({ref:u,className:["chat-container",l].filter(Boolean).join(" ")},c),{children:[t&&t.length>0&&f.jsx("div",{className:"chat-container__bot-tabs",role:"group","aria-label":"Bot tabs",children:t.map(g=>f.jsxs("button",{type:"button",className:["chat-container__bot-tab",n===g.id&&"chat-container__bot-tab--active"].filter(Boolean).join(" "),onClick:()=>a==null?void 0:a(g.id),"aria-pressed":n===g.id,"aria-label":`${g.label} — ${g.role}`,children:[f.jsxs("span",{className:"chat-container__bot-label",children:[f.jsx("span",{className:["chat-container__bot-status",`chat-container__bot-status--${g.status}`].filter(Boolean).join(" ")}),g.label]}),f.jsx("span",{className:"chat-container__bot-role",children:g.role})]},g.id))}),f.jsx("div",{ref:p,className:"chat-container__thread",role:"log","aria-live":"polite","aria-atomic":"false",children:f.jsx("div",{className:"chat-container__messages",children:e})}),r]}))});Qk.displayName="ChatContainer";function yI(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const vI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,bI={};function Bw(e,t){return(bI.jsx?xI:vI).test(e)}const _I=/[ \t\n\f\r]/g;function wI(e){return typeof e=="object"?e.type==="text"?$w(e.value):!1:$w(e)}function $w(e){return e.replace(_I,"")===""}class Xd{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}Xd.prototype.normal={};Xd.prototype.property={};Xd.prototype.space=void 0;function Xk(e,t){const n={},a={};for(const i of e)Object.assign(n,i.property),Object.assign(a,i.normal);return new Xd(n,a,t)}function Lv(e){return e.toLowerCase()}class ms{constructor(t,n){this.attribute=n,this.property=t}}ms.prototype.attribute="";ms.prototype.booleanish=!1;ms.prototype.boolean=!1;ms.prototype.commaOrSpaceSeparated=!1;ms.prototype.commaSeparated=!1;ms.prototype.defined=!1;ms.prototype.mustUseProperty=!1;ms.prototype.number=!1;ms.prototype.overloadedBoolean=!1;ms.prototype.property="";ms.prototype.spaceSeparated=!1;ms.prototype.space=void 0;let SI=0;const jt=wl(),ua=wl(),Tv=wl(),Ze=wl(),xn=wl(),cl=wl(),Cs=wl();function wl(){return ks(2,++SI)}const Av=Object.freeze(Object.defineProperty({__proto__:null,boolean:jt,booleanish:ua,commaOrSpaceSeparated:Cs,commaSeparated:cl,number:Ze,overloadedBoolean:Tv,spaceSeparated:xn},Symbol.toStringTag,{value:"Module"})),vy=Object.keys(Av);class e0 extends ms{constructor(t,n,a,i){let r=-1;if(super(t,n),Uw(this,"space",i),typeof a=="number")for(;++r<vy.length;){const l=vy[r];Uw(this,vy[r],(a&Av[l])===Av[l])}}}e0.prototype.defined=!0;function Uw(e,t,n){n&&(e[t]=n)}function tu(e){const t={},n={};for(const[a,i]of Object.entries(e.properties)){const r=new e0(a,e.transform(e.attributes||{},a),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(r.mustUseProperty=!0),t[a]=r,n[Lv(a)]=a,n[Lv(r.attribute)]=a}return new Xd(t,n,e.space)}const Zk=tu({properties:{ariaActiveDescendant:null,ariaAtomic:ua,ariaAutoComplete:null,ariaBusy:ua,ariaChecked:ua,ariaColCount:Ze,ariaColIndex:Ze,ariaColSpan:Ze,ariaControls:xn,ariaCurrent:null,ariaDescribedBy:xn,ariaDetails:null,ariaDisabled:ua,ariaDropEffect:xn,ariaErrorMessage:null,ariaExpanded:ua,ariaFlowTo:xn,ariaGrabbed:ua,ariaHasPopup:null,ariaHidden:ua,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xn,ariaLevel:Ze,ariaLive:null,ariaModal:ua,ariaMultiLine:ua,ariaMultiSelectable:ua,ariaOrientation:null,ariaOwns:xn,ariaPlaceholder:null,ariaPosInSet:Ze,ariaPressed:ua,ariaReadOnly:ua,ariaRelevant:null,ariaRequired:ua,ariaRoleDescription:xn,ariaRowCount:Ze,ariaRowIndex:Ze,ariaRowSpan:Ze,ariaSelected:ua,ariaSetSize:Ze,ariaSort:null,ariaValueMax:Ze,ariaValueMin:Ze,ariaValueNow:Ze,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Jk(e,t){return t in e?e[t]:t}function Wk(e,t){return Jk(e,t.toLowerCase())}const NI=tu({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:cl,acceptCharset:xn,accessKey:xn,action:null,allow:null,allowFullScreen:jt,allowPaymentRequest:jt,allowUserMedia:jt,alpha:jt,alt:null,as:null,async:jt,autoCapitalize:null,autoComplete:xn,autoFocus:jt,autoPlay:jt,blocking:xn,capture:null,charSet:null,checked:jt,cite:null,className:xn,closedBy:null,colorSpace:null,cols:Ze,colSpan:Ze,command:null,commandFor:null,content:null,contentEditable:ua,controls:jt,controlsList:xn,coords:Ze|cl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:jt,defer:jt,dir:null,dirName:null,disabled:jt,download:Tv,draggable:ua,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:jt,formTarget:null,headers:xn,height:Ze,hidden:Tv,high:Ze,href:null,hrefLang:null,htmlFor:xn,httpEquiv:xn,id:null,imageSizes:null,imageSrcSet:null,inert:jt,inputMode:null,integrity:null,is:null,isMap:jt,itemId:null,itemProp:xn,itemRef:xn,itemScope:jt,itemType:xn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:jt,low:Ze,manifest:null,max:null,maxLength:Ze,media:null,method:null,min:null,minLength:Ze,multiple:jt,muted:jt,name:null,nonce:null,noModule:jt,noValidate:jt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:jt,optimum:Ze,pattern:null,ping:xn,placeholder:null,playsInline:jt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:jt,referrerPolicy:null,rel:xn,required:jt,reversed:jt,rows:Ze,rowSpan:Ze,sandbox:xn,scope:null,scoped:jt,seamless:jt,selected:jt,shadowRootClonable:jt,shadowRootCustomElementRegistry:jt,shadowRootDelegatesFocus:jt,shadowRootMode:null,shadowRootSerializable:jt,shape:null,size:Ze,sizes:null,slot:null,span:Ze,spellCheck:ua,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ze,step:null,style:null,tabIndex:Ze,target:null,title:null,translate:null,type:null,typeMustMatch:jt,useMap:null,value:ua,width:Ze,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xn,axis:null,background:null,bgColor:null,border:Ze,borderColor:null,bottomMargin:Ze,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:jt,declare:jt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ze,leftMargin:Ze,link:null,longDesc:null,lowSrc:null,marginHeight:Ze,marginWidth:Ze,noResize:jt,noHref:jt,noShade:jt,noWrap:jt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ze,rules:null,scheme:null,scrolling:ua,standby:null,summary:null,text:null,topMargin:Ze,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ze,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:jt,disablePictureInPicture:jt,disableRemotePlayback:jt,exportParts:cl,part:xn,prefix:null,property:null,results:Ze,security:null,unselectable:null},space:"html",transform:Wk}),kI=tu({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Cs,accentHeight:Ze,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ze,amplitude:Ze,arabicForm:null,ascent:Ze,attributeName:null,attributeType:null,azimuth:Ze,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ze,by:null,calcMode:null,capHeight:Ze,className:xn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ze,diffuseConstant:Ze,direction:null,display:null,dur:null,divisor:Ze,dominantBaseline:null,download:jt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ze,enableBackground:null,end:null,event:null,exponent:Ze,externalResourcesRequired:null,fill:null,fillOpacity:Ze,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:cl,g2:cl,glyphName:cl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ze,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ze,horizOriginX:Ze,horizOriginY:Ze,id:null,ideographic:Ze,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ze,k:Ze,k1:Ze,k2:Ze,k3:Ze,k4:Ze,kernelMatrix:Cs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ze,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ze,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ze,overlineThickness:Ze,paintOrder:null,panose1:null,path:null,pathLength:Ze,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ze,pointsAtY:Ze,pointsAtZ:Ze,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Cs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Cs,rev:Cs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Cs,requiredFeatures:Cs,requiredFonts:Cs,requiredFormats:Cs,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ze,specularExponent:Ze,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ze,strikethroughThickness:Ze,string:null,stroke:null,strokeDashArray:Cs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ze,strokeOpacity:Ze,strokeWidth:null,style:null,surfaceScale:Ze,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Cs,tabIndex:Ze,tableValues:null,target:null,targetX:Ze,targetY:Ze,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Cs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ze,underlineThickness:Ze,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ze,values:null,vAlphabetic:Ze,vMathematical:Ze,vectorEffect:null,vHanging:Ze,vIdeographic:Ze,version:null,vertAdvY:Ze,vertOriginX:Ze,vertOriginY:Ze,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ze,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Jk}),eC=tu({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),tC=tu({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Wk}),nC=tu({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),CI={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},MI=/[A-Z]/g,Fw=/-[a-z]/g,jI=/^data[-\w.:]+$/i;function EI(e,t){const n=Lv(t);let a=t,i=ms;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&jI.test(t)){if(t.charAt(4)==="-"){const r=t.slice(5).replace(Fw,LI);a="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=t.slice(4);if(!Fw.test(r)){let l=r.replace(MI,RI);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=e0}return new i(a,t)}function RI(e){return"-"+e.toLowerCase()}function LI(e){return e.charAt(1).toUpperCase()}const TI=Xk([Zk,NI,eC,tC,nC],"html"),t0=Xk([Zk,kI,eC,tC,nC],"svg");function AI(e){return e.join(" ").trim()}function aC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fc={},xy,Pw;function II(){if(Pw)return xy;Pw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,r=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,u=`
|
|
50
|
+
`,h="/",m="*",p="",g="comment",v="declaration";function x(_,S){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];S=S||{};var M=1,C=1;function k(z){var U=z.match(t);U&&(M+=U.length);var F=z.lastIndexOf(u);C=~F?z.length-F:C+z.length}function L(){var z={line:M,column:C};return function(U){return U.position=new E(z),A(),U}}function E(z){this.start=z,this.end={line:M,column:C},this.source=S.source}E.prototype.content=_;function I(z){var U=new Error(S.source+":"+M+":"+C+": "+z);if(U.reason=z,U.filename=S.source,U.line=M,U.column=C,U.source=_,!S.silent)throw U}function T(z){var U=z.exec(_);if(U){var F=U[0];return k(F),_=_.slice(F.length),U}}function A(){T(n)}function R(z){var U;for(z=z||[];U=D();)U!==!1&&z.push(U);return z}function D(){var z=L();if(!(h!=_.charAt(0)||m!=_.charAt(1))){for(var U=2;p!=_.charAt(U)&&(m!=_.charAt(U)||h!=_.charAt(U+1));)++U;if(U+=2,p===_.charAt(U-1))return I("End of comment missing");var F=_.slice(2,U-2);return C+=2,k(F),_=_.slice(U),C+=2,z({type:g,comment:F})}}function O(){var z=L(),U=T(a);if(U){if(D(),!T(i))return I("property missing ':'");var F=T(r),Y=z({type:v,property:b(U[0].replace(e,p)),value:F?b(F[0].replace(e,p)):p});return T(l),Y}}function B(){var z=[];R(z);for(var U;U=O();)U!==!1&&(z.push(U),R(z));return z}return A(),B()}function b(_){return _?_.replace(c,p):p}return xy=x,xy}var Hw;function DI(){if(Hw)return fc;Hw=1;var e=fc&&fc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(fc,"__esModule",{value:!0}),fc.default=n;const t=e(II());function n(a,i){let r=null;if(!a||typeof a!="string")return r;const l=(0,t.default)(a),c=typeof i=="function";return l.forEach(u=>{if(u.type!=="declaration")return;const{property:h,value:m}=u;c?i(h,m,u):m&&(r=r||{},r[h]=m)}),r}return fc}var rd={},qw;function OI(){if(qw)return rd;qw=1,Object.defineProperty(rd,"__esModule",{value:!0}),rd.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,r=function(h){return!h||n.test(h)||e.test(h)},l=function(h,m){return m.toUpperCase()},c=function(h,m){return"".concat(m,"-")},u=function(h,m){return m===void 0&&(m={}),r(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(i,c):h=h.replace(a,c),h.replace(t,l))};return rd.camelCase=u,rd}var od,Vw;function zI(){if(Vw)return od;Vw=1;var e=od&&od.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(DI()),n=OI();function a(i,r){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(c,u){c&&u&&(l[(0,n.camelCase)(c,r)]=u)}),l}return a.default=a,od=a,od}var BI=zI();const $I=aC(BI),sC=iC("end"),n0=iC("start");function iC(e){return t;function t(n){const a=n&&n.position&&n.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function UI(e){const t=n0(e),n=sC(e);if(t&&n)return{start:t,end:n}}function Sd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Yw(e.position):"start"in e||"end"in e?Yw(e):"line"in e||"column"in e?Iv(e):""}function Iv(e){return Gw(e&&e.line)+":"+Gw(e&&e.column)}function Yw(e){return Iv(e&&e.start)+"-"+Iv(e&&e.end)}function Gw(e){return e&&typeof e=="number"?e:1}class $a extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let i="",r={},l=!1;if(n&&("line"in n&&"column"in n?r={place:n}:"start"in n&&"end"in n?r={place:n}:"type"in n?r={ancestors:[n],place:n.position}:r=$({},n)),typeof t=="string"?i=t:!r.cause&&t&&(l=!0,i=t.message,r.cause=t),!r.ruleId&&!r.source&&typeof a=="string"){const u=a.indexOf(":");u===-1?r.ruleId=a:(r.source=a.slice(0,u),r.ruleId=a.slice(u+1))}if(!r.place&&r.ancestors&&r.ancestors){const u=r.ancestors[r.ancestors.length-1];u&&(r.place=u.position)}const c=r.place&&"start"in r.place?r.place.start:r.place;this.ancestors=r.ancestors||void 0,this.cause=r.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=Sd(r.place)||"1:1",this.place=r.place||void 0,this.reason=this.message,this.ruleId=r.ruleId||void 0,this.source=r.source||void 0,this.stack=l&&r.cause&&typeof r.cause.stack=="string"?r.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}$a.prototype.file="";$a.prototype.name="";$a.prototype.reason="";$a.prototype.message="";$a.prototype.stack="";$a.prototype.column=void 0;$a.prototype.line=void 0;$a.prototype.ancestors=void 0;$a.prototype.cause=void 0;$a.prototype.fatal=void 0;$a.prototype.place=void 0;$a.prototype.ruleId=void 0;$a.prototype.source=void 0;const a0={}.hasOwnProperty,FI=new Map,PI=/[A-Z]/g,HI=new Set(["table","tbody","thead","tfoot","tr"]),qI=new Set(["td","th"]),rC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function VI(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=WI(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=JI(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?t0:TI,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},r=oC(i,e,void 0);return r&&typeof r!="string"?r:i.create(e,i.Fragment,{children:r||void 0},void 0)}function oC(e,t,n){if(t.type==="element")return YI(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return GI(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return QI(e,t,n);if(t.type==="mdxjsEsm")return KI(e,t);if(t.type==="root")return XI(e,t,n);if(t.type==="text")return ZI(e,t)}function YI(e,t,n){const a=e.schema;let i=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(i=t0,e.schema=i),e.ancestors.push(t);const r=cC(e,t.tagName,!1),l=eD(e,t);let c=i0(e,t);return HI.has(t.tagName)&&(c=c.filter(function(u){return typeof u=="string"?!wI(u):!0})),lC(e,l,r,t),s0(l,c),e.ancestors.pop(),e.schema=a,e.create(t,r,l,n)}function GI(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Id(e,t.position)}function KI(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Id(e,t.position)}function QI(e,t,n){const a=e.schema;let i=a;t.name==="svg"&&a.space==="html"&&(i=t0,e.schema=i),e.ancestors.push(t);const r=t.name===null?e.Fragment:cC(e,t.name,!0),l=tD(e,t),c=i0(e,t);return lC(e,l,r,t),s0(l,c),e.ancestors.pop(),e.schema=a,e.create(t,r,l,n)}function XI(e,t,n){const a={};return s0(a,i0(e,t)),e.create(t,e.Fragment,a,n)}function ZI(e,t){return t.value}function lC(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function s0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function JI(e,t,n){return a;function a(i,r,l,c){const u=Array.isArray(l.children)?n:t;return c?u(r,l,c):u(r,l)}}function WI(e,t){return n;function n(a,i,r,l){const c=Array.isArray(r.children),u=n0(a);return t(i,r,l,c,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function eD(e,t){const n={};let a,i;for(i in t.properties)if(i!=="children"&&a0.call(t.properties,i)){const r=nD(e,i,t.properties[i]);if(r){const[l,c]=r;e.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&qI.has(t.tagName)?a=c:n[l]=c}}if(a){const r=n.style||(n.style={});r[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function tD(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const i=a.data.estree.body[0];i.type;const r=i.expression;r.type;const l=r.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Id(e,t.position);else{const i=a.name;let r;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const l=a.value.data.estree.body[0];l.type,r=e.evaluater.evaluateExpression(l.expression)}else Id(e,t.position);else r=a.value===null?!0:a.value;n[i]=r}return n}function i0(e,t){const n=[];let a=-1;const i=e.passKeys?new Map:FI;for(;++a<t.children.length;){const r=t.children[a];let l;if(e.passKeys){const u=r.type==="element"?r.tagName:r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement"?r.name:void 0;if(u){const h=i.get(u)||0;l=u+"-"+h,i.set(u,h+1)}}const c=oC(e,r,l);c!==void 0&&n.push(c)}return n}function nD(e,t,n){const a=EI(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?yI(n):AI(n)),a.property==="style"){let i=typeof n=="object"?n:aD(e,String(n));return e.stylePropertyNameCase==="css"&&(i=sD(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&a.space?CI[a.property]||a.property:a.attribute,n]}}function aD(e,t){try{return $I(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,i=new $a("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=rC+"#cannot-parse-style-attribute",i}}function cC(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let r=-1,l;for(;++r<i.length;){const c=Bw(i[r])?{type:"Identifier",name:i[r]}:{type:"Literal",value:i[r]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(r&&c.type==="Literal"),optional:!1}:c}a=l}else a=Bw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const i=a.value;return a0.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(a);Id(e)}function Id(e,t){const n=new $a("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=rC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function sD(e){const t={};let n;for(n in e)a0.call(e,n)&&(t[iD(n)]=e[n]);return t}function iD(e){let t=e.replace(PI,rD);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function rD(e){return"-"+e.toLowerCase()}const by={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},oD={};function r0(e,t){const n=oD,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return uC(e,a,i)}function uC(e,t,n){if(lD(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Kw(e.children,t,n)}return Array.isArray(e)?Kw(e,t,n):""}function Kw(e,t,n){const a=[];let i=-1;for(;++i<e.length;)a[i]=uC(e[i],t,n);return a.join("")}function lD(e){return!!(e&&typeof e=="object")}const Qw=document.createElement("i");function o0(e){const t="&"+e+";";Qw.innerHTML=t;const n=Qw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Rs(e,t,n,a){const i=e.length;let r=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,a.length<1e4)l=Array.from(a),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);r<a.length;)l=a.slice(r,r+1e4),l.unshift(t,0),e.splice(...l),r+=1e4,t+=1e4}function Xs(e,t){return e.length>0?(Rs(e,e.length,0,t),e):t}const Xw={}.hasOwnProperty;function dC(e){const t={};let n=-1;for(;++n<e.length;)cD(t,e[n]);return t}function cD(e,t){let n;for(n in t){const a=(Xw.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let r;if(i)for(r in i){Xw.call(a,r)||(a[r]=[]);const l=i[r];uD(a[r],Array.isArray(l)?l:l?[l]:[])}}}function uD(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);Rs(e,0,0,a)}function hC(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ui(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Qa=bo(/[A-Za-z]/),Ba=bo(/[\dA-Za-z]/),dD=bo(/[#-'*+\--9=?A-Z^-~]/);function dp(e){return e!==null&&(e<32||e===127)}const Dv=bo(/\d/),hD=bo(/[\dA-Fa-f]/),fD=bo(/[!-/:-@[-`{-~]/);function bt(e){return e!==null&&e<-2}function bn(e){return e!==null&&(e<0||e===32)}function Ft(e){return e===-2||e===-1||e===32}const zp=bo(new RegExp("\\p{P}|\\p{S}","u")),yl=bo(/\s/);function bo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function nu(e){const t=[];let n=-1,a=0,i=0;for(;++n<e.length;){const r=e.charCodeAt(n);let l="";if(r===37&&Ba(e.charCodeAt(n+1))&&Ba(e.charCodeAt(n+2)))i=2;else if(r<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(r))||(l=String.fromCharCode(r));else if(r>55295&&r<57344){const c=e.charCodeAt(n+1);r<56320&&c>56319&&c<57344?(l=String.fromCharCode(r,c),i=1):l="�"}else l=String.fromCharCode(r);l&&(t.push(e.slice(a,n),encodeURIComponent(l)),a=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(a)}function Qt(e,t,n,a){const i=a?a-1:Number.POSITIVE_INFINITY;let r=0;return l;function l(u){return Ft(u)?(e.enter(n),c(u)):t(u)}function c(u){return Ft(u)&&r++<i?(e.consume(u),c):(e.exit(n),t(u))}}const pD={tokenize:mD};function mD(e){const t=e.attempt(this.parser.constructs.contentInitial,a,i);let n;return t;function a(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Qt(e,t,"linePrefix")}function i(c){return e.enter("paragraph"),r(c)}function r(c){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,l(c)}function l(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return bt(c)?(e.consume(c),e.exit("chunkText"),r):(e.consume(c),l)}}const gD={tokenize:yD},Zw={tokenize:vD};function yD(e){const t=this,n=[];let a=0,i,r,l;return c;function c(C){if(a<n.length){const k=n[a];return t.containerState=k[1],e.attempt(k[0].continuation,u,h)(C)}return h(C)}function u(C){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&M();const k=t.events.length;let L=k,E;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){E=t.events[L][1].end;break}S(a);let I=k;for(;I<t.events.length;)t.events[I][1].end=$({},E),I++;return Rs(t.events,L+1,0,t.events.slice(k)),t.events.length=I,h(C)}return c(C)}function h(C){if(a===n.length){if(!i)return g(C);if(i.currentConstruct&&i.currentConstruct.concrete)return x(C);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Zw,m,p)(C)}function m(C){return i&&M(),S(a),g(C)}function p(C){return t.parser.lazy[t.now().line]=a!==n.length,l=t.now().offset,x(C)}function g(C){return t.containerState={},e.attempt(Zw,v,x)(C)}function v(C){return a++,n.push([t.currentConstruct,t.containerState]),g(C)}function x(C){if(C===null){i&&M(),S(0),e.consume(C);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:r}),b(C)}function b(C){if(C===null){_(e.exit("chunkFlow"),!0),S(0),e.consume(C);return}return bt(C)?(e.consume(C),_(e.exit("chunkFlow")),a=0,t.interrupt=void 0,c):(e.consume(C),b)}function _(C,k){const L=t.sliceStream(C);if(k&&L.push(null),C.previous=r,r&&(r.next=C),r=C,i.defineSkip(C.start),i.write(L),t.parser.lazy[C.start.line]){let E=i.events.length;for(;E--;)if(i.events[E][1].start.offset<l&&(!i.events[E][1].end||i.events[E][1].end.offset>l))return;const I=t.events.length;let T=I,A,R;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(A){R=t.events[T][1].end;break}A=!0}for(S(a),E=I;E<t.events.length;)t.events[E][1].end=$({},R),E++;Rs(t.events,T+1,0,t.events.slice(I)),t.events.length=E}}function S(C){let k=n.length;for(;k-- >C;){const L=n[k];t.containerState=L[1],L[0].exit.call(t,e)}n.length=C}function M(){i.write([null]),r=void 0,i=void 0,t.containerState._closeFlow=void 0}}function vD(e,t,n){return Qt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Gc(e){if(e===null||bn(e)||yl(e))return 1;if(zp(e))return 2}function Bp(e,t,n){const a=[];let i=-1;for(;++i<e.length;){const r=e[i].resolveAll;r&&!a.includes(r)&&(t=r(t,n),a.push(r))}return t}const Ov={name:"attention",resolveAll:xD,tokenize:bD};function xD(e,t){let n=-1,a,i,r,l,c,u,h,m;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p=$({},e[a][1].end),g=$({},e[n][1].start);Jw(p,-u),Jw(g,u),l={type:u>1?"strongSequence":"emphasisSequence",start:p,end:$({},e[a][1].end)},c={type:u>1?"strongSequence":"emphasisSequence",start:$({},e[n][1].start),end:g},r={type:u>1?"strongText":"emphasisText",start:$({},e[a][1].end),end:$({},e[n][1].start)},i={type:u>1?"strong":"emphasis",start:$({},l.start),end:$({},c.end)},e[a][1].end=$({},l.start),e[n][1].start=$({},c.end),h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=Xs(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=Xs(h,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",r,t]]),h=Xs(h,Bp(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=Xs(h,[["exit",r,t],["enter",c,t],["exit",c,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,h=Xs(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,Rs(e,a-1,n-a+3,h),n=a+h.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function bD(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,i=Gc(a);let r;return l;function l(u){return r=u,e.enter("attentionSequence"),c(u)}function c(u){if(u===r)return e.consume(u),c;const h=e.exit("attentionSequence"),m=Gc(u),p=!m||m===2&&i||n.includes(u),g=!i||i===2&&m||n.includes(a);return h._open=!!(r===42?p:p&&(i||!g)),h._close=!!(r===42?g:g&&(m||!p)),t(u)}}function Jw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const _D={name:"autolink",tokenize:wD};function wD(e,t,n){let a=0;return i;function i(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),r}function r(v){return Qa(v)?(e.consume(v),l):v===64?n(v):h(v)}function l(v){return v===43||v===45||v===46||Ba(v)?(a=1,c(v)):h(v)}function c(v){return v===58?(e.consume(v),a=0,u):(v===43||v===45||v===46||Ba(v))&&a++<32?(e.consume(v),c):(a=0,h(v))}function u(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||dp(v)?n(v):(e.consume(v),u)}function h(v){return v===64?(e.consume(v),m):dD(v)?(e.consume(v),h):n(v)}function m(v){return Ba(v)?p(v):n(v)}function p(v){return v===46?(e.consume(v),a=0,m):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):g(v)}function g(v){if((v===45||Ba(v))&&a++<63){const x=v===45?g:p;return e.consume(v),x}return n(v)}}const Zd={partial:!0,tokenize:SD};function SD(e,t,n){return a;function a(r){return Ft(r)?Qt(e,i,"linePrefix")(r):i(r)}function i(r){return r===null||bt(r)?t(r):n(r)}}const fC={continuation:{tokenize:kD},exit:CD,name:"blockQuote",tokenize:ND};function ND(e,t,n){const a=this;return i;function i(l){if(l===62){const c=a.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),r}return n(l)}function r(l){return Ft(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function kD(e,t,n){const a=this;return i;function i(l){return Ft(l)?Qt(e,r,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):r(l)}function r(l){return e.attempt(fC,t,n)(l)}}function CD(e){e.exit("blockQuote")}const pC={name:"characterEscape",tokenize:MD};function MD(e,t,n){return a;function a(r){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(r),e.exit("escapeMarker"),i}function i(r){return fD(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}const mC={name:"characterReference",tokenize:jD};function jD(e,t,n){const a=this;let i=0,r,l;return c;function c(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),u}function u(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),r=31,l=Ba,m(p))}function h(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,l=hD,m):(e.enter("characterReferenceValue"),r=7,l=Dv,m(p))}function m(p){if(p===59&&i){const g=e.exit("characterReferenceValue");return l===Ba&&!o0(a.sliceSerialize(g))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(p)&&i++<r?(e.consume(p),m):n(p)}}const Ww={partial:!0,tokenize:RD},e2={concrete:!0,name:"codeFenced",tokenize:ED};function ED(e,t,n){const a=this,i={partial:!0,tokenize:L};let r=0,l=0,c;return u;function u(E){return h(E)}function h(E){const I=a.events[a.events.length-1];return r=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,c=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(E)}function m(E){return E===c?(l++,e.consume(E),m):l<3?n(E):(e.exit("codeFencedFenceSequence"),Ft(E)?Qt(e,p,"whitespace")(E):p(E))}function p(E){return E===null||bt(E)?(e.exit("codeFencedFence"),a.interrupt?t(E):e.check(Ww,b,k)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(E))}function g(E){return E===null||bt(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(E)):Ft(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Qt(e,v,"whitespace")(E)):E===96&&E===c?n(E):(e.consume(E),g)}function v(E){return E===null||bt(E)?p(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(E))}function x(E){return E===null||bt(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(E)):E===96&&E===c?n(E):(e.consume(E),x)}function b(E){return e.attempt(i,k,_)(E)}function _(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),S}function S(E){return r>0&&Ft(E)?Qt(e,M,"linePrefix",r+1)(E):M(E)}function M(E){return E===null||bt(E)?e.check(Ww,b,k)(E):(e.enter("codeFlowValue"),C(E))}function C(E){return E===null||bt(E)?(e.exit("codeFlowValue"),M(E)):(e.consume(E),C)}function k(E){return e.exit("codeFenced"),t(E)}function L(E,I,T){let A=0;return R;function R(U){return E.enter("lineEnding"),E.consume(U),E.exit("lineEnding"),D}function D(U){return E.enter("codeFencedFence"),Ft(U)?Qt(E,O,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):O(U)}function O(U){return U===c?(E.enter("codeFencedFenceSequence"),B(U)):T(U)}function B(U){return U===c?(A++,E.consume(U),B):A>=l?(E.exit("codeFencedFenceSequence"),Ft(U)?Qt(E,z,"whitespace")(U):z(U)):T(U)}function z(U){return U===null||bt(U)?(E.exit("codeFencedFence"),I(U)):T(U)}}}function RD(e,t,n){const a=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r)}function r(l){return a.parser.lazy[a.now().line]?n(l):t(l)}}const _y={name:"codeIndented",tokenize:TD},LD={partial:!0,tokenize:AD};function TD(e,t,n){const a=this;return i;function i(h){return e.enter("codeIndented"),Qt(e,r,"linePrefix",5)(h)}function r(h){const m=a.events[a.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?u(h):bt(h)?e.attempt(LD,l,u)(h):(e.enter("codeFlowValue"),c(h))}function c(h){return h===null||bt(h)?(e.exit("codeFlowValue"),l(h)):(e.consume(h),c)}function u(h){return e.exit("codeIndented"),t(h)}}function AD(e,t,n){const a=this;return i;function i(l){return a.parser.lazy[a.now().line]?n(l):bt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):Qt(e,r,"linePrefix",5)(l)}function r(l){const c=a.events[a.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):bt(l)?i(l):n(l)}}const ID={name:"codeText",previous:OD,resolve:DD,tokenize:zD};function DD(e){let t=e.length-4,n=3,a,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a<t;)if(e[a][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(a=n-1,t++;++a<=t;)i===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(i=a):(a===t||e[a][1].type==="lineEnding")&&(e[i][1].type="codeTextData",a!==i+2&&(e[i][1].end=e[a-1][1].end,e.splice(i+2,a-i-2),t-=a-i-2,a=i+2),i=void 0);return e}function OD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function zD(e,t,n){let a=0,i,r;return l;function l(p){return e.enter("codeText"),e.enter("codeTextSequence"),c(p)}function c(p){return p===96?(e.consume(p),a++,c):(e.exit("codeTextSequence"),u(p))}function u(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),u):p===96?(r=e.enter("codeTextSequence"),i=0,m(p)):bt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("codeTextData"),h(p))}function h(p){return p===null||p===32||p===96||bt(p)?(e.exit("codeTextData"),u(p)):(e.consume(p),h)}function m(p){return p===96?(e.consume(p),i++,m):i===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(r.type="codeTextData",h(p))}}class BD{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const a=n!=null?n:Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const i=n||0;this.setCursor(Math.trunc(t));const r=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return a&&ld(this.left,a),r.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ld(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ld(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ld(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ld(this.left,n.reverse())}}}function ld(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function gC(e){const t={};let n=-1,a,i,r,l,c,u,h;const m=new BD(e);for(;++n<m.length;){for(;n in t;)n=t[n];if(a=m.get(n),n&&a[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(u=a[1]._tokenizer.events,r=0,r<u.length&&u[r][1].type==="lineEndingBlank"&&(r+=2),r<u.length&&u[r][1].type==="content"))for(;++r<u.length&&u[r][1].type!=="content";)u[r][1].type==="chunkText"&&(u[r][1]._isInFirstContentOfListItem=!0,r++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,$D(m,n)),n=t[n],h=!0);else if(a[1]._container){for(r=n,i=void 0;r--;)if(l=m.get(r),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(m.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=r);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(a[1].end=$({},m.get(i)[1].start),c=m.slice(i,n),c.unshift(a),m.splice(i,n-i+1,c))}}return Rs(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!h}function $D(e,t){const n=e.get(t)[1],a=e.get(t)[2];let i=t-1;const r=[];let l=n._tokenizer;l||(l=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,u=[],h={};let m,p,g=-1,v=n,x=0,b=0;const _=[b];for(;v;){for(;e.get(++i)[1]!==v;);r.push(i),v._tokenizer||(m=a.sliceStream(v),v.next||m.push(null),p&&l.defineSkip(v.start),v._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(m),v._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=v,v=v.next}for(v=n;++g<c.length;)c[g][0]==="exit"&&c[g-1][0]==="enter"&&c[g][1].type===c[g-1][1].type&&c[g][1].start.line!==c[g][1].end.line&&(b=g+1,_.push(b),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(l.events=[],v?(v._tokenizer=void 0,v.previous=void 0):_.pop(),g=_.length;g--;){const S=c.slice(_[g],_[g+1]),M=r.pop();u.push([M,M+S.length-1]),e.splice(M,2,S)}for(u.reverse(),g=-1;++g<u.length;)h[x+u[g][0]]=x+u[g][1],x+=u[g][1]-u[g][0]-1;return h}const UD={resolve:PD,tokenize:HD},FD={partial:!0,tokenize:qD};function PD(e){return gC(e),e}function HD(e,t){let n;return a;function a(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(c)}function i(c){return c===null?r(c):bt(c)?e.check(FD,l,r)(c):(e.consume(c),i)}function r(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function l(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function qD(e,t,n){const a=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Qt(e,r,"linePrefix")}function r(l){if(l===null||bt(l))return n(l);const c=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):e.interrupt(a.parser.constructs.flow,n,t)(l)}}function yC(e,t,n,a,i,r,l,c,u){const h=u||Number.POSITIVE_INFINITY;let m=0;return p;function p(S){return S===60?(e.enter(a),e.enter(i),e.enter(r),e.consume(S),e.exit(r),g):S===null||S===32||S===41||dp(S)?n(S):(e.enter(a),e.enter(l),e.enter(c),e.enter("chunkString",{contentType:"string"}),b(S))}function g(S){return S===62?(e.enter(r),e.consume(S),e.exit(r),e.exit(i),e.exit(a),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(e.exit("chunkString"),e.exit(c),g(S)):S===null||S===60||bt(S)?n(S):(e.consume(S),S===92?x:v)}function x(S){return S===60||S===62||S===92?(e.consume(S),v):v(S)}function b(S){return!m&&(S===null||S===41||bn(S))?(e.exit("chunkString"),e.exit(c),e.exit(l),e.exit(a),t(S)):m<h&&S===40?(e.consume(S),m++,b):S===41?(e.consume(S),m--,b):S===null||S===32||S===40||dp(S)?n(S):(e.consume(S),S===92?_:b)}function _(S){return S===40||S===41||S===92?(e.consume(S),b):b(S)}}function vC(e,t,n,a,i,r){const l=this;let c=0,u;return h;function h(v){return e.enter(a),e.enter(i),e.consume(v),e.exit(i),e.enter(r),m}function m(v){return c>999||v===null||v===91||v===93&&!u||v===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(e.exit(r),e.enter(i),e.consume(v),e.exit(i),e.exit(a),t):bt(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||bt(v)||c++>999?(e.exit("chunkString"),m(v)):(e.consume(v),u||(u=!Ft(v)),v===92?g:p)}function g(v){return v===91||v===92||v===93?(e.consume(v),c++,p):p(v)}}function xC(e,t,n,a,i,r){let l;return c;function c(g){return g===34||g===39||g===40?(e.enter(a),e.enter(i),e.consume(g),e.exit(i),l=g===40?41:g,u):n(g)}function u(g){return g===l?(e.enter(i),e.consume(g),e.exit(i),e.exit(a),t):(e.enter(r),h(g))}function h(g){return g===l?(e.exit(r),u(l)):g===null?n(g):bt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Qt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(g))}function m(g){return g===l||g===null||bt(g)?(e.exit("chunkString"),h(g)):(e.consume(g),g===92?p:m)}function p(g){return g===l||g===92?(e.consume(g),m):m(g)}}function Nd(e,t){let n;return a;function a(i){return bt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,a):Ft(i)?Qt(e,a,n?"linePrefix":"lineSuffix")(i):t(i)}}const VD={name:"definition",tokenize:GD},YD={partial:!0,tokenize:KD};function GD(e,t,n){const a=this;let i;return r;function r(v){return e.enter("definition"),l(v)}function l(v){return vC.call(a,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return i=ui(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),u):n(v)}function u(v){return bn(v)?Nd(e,h)(v):h(v)}function h(v){return yC(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return e.attempt(YD,p,p)(v)}function p(v){return Ft(v)?Qt(e,g,"whitespace")(v):g(v)}function g(v){return v===null||bt(v)?(e.exit("definition"),a.parser.defined.push(i),t(v)):n(v)}}function KD(e,t,n){return a;function a(c){return bn(c)?Nd(e,i)(c):n(c)}function i(c){return xC(e,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function r(c){return Ft(c)?Qt(e,l,"whitespace")(c):l(c)}function l(c){return c===null||bt(c)?t(c):n(c)}}const QD={name:"hardBreakEscape",tokenize:XD};function XD(e,t,n){return a;function a(r){return e.enter("hardBreakEscape"),e.consume(r),i}function i(r){return bt(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}const ZD={name:"headingAtx",resolve:JD,tokenize:WD};function JD(e,t){let n=e.length-2,a=3,i,r;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(i={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},r={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},Rs(e,a,n-a+1,[["enter",i,t],["enter",r,t],["exit",r,t],["exit",i,t]])),e}function WD(e,t,n){let a=0;return i;function i(m){return e.enter("atxHeading"),r(m)}function r(m){return e.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&a++<6?(e.consume(m),l):m===null||bn(m)?(e.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(e.enter("atxHeadingSequence"),u(m)):m===null||bt(m)?(e.exit("atxHeading"),t(m)):Ft(m)?Qt(e,c,"whitespace")(m):(e.enter("atxHeadingText"),h(m))}function u(m){return m===35?(e.consume(m),u):(e.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||bn(m)?(e.exit("atxHeadingText"),c(m)):(e.consume(m),h)}}const e3=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],t2=["pre","script","style","textarea"],t3={concrete:!0,name:"htmlFlow",resolveTo:s3,tokenize:i3},n3={partial:!0,tokenize:o3},a3={partial:!0,tokenize:r3};function s3(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function i3(e,t,n){const a=this;let i,r,l,c,u;return h;function h(H){return m(H)}function m(H){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(H),p}function p(H){return H===33?(e.consume(H),g):H===47?(e.consume(H),r=!0,b):H===63?(e.consume(H),i=3,a.interrupt?t:q):Qa(H)?(e.consume(H),l=String.fromCharCode(H),_):n(H)}function g(H){return H===45?(e.consume(H),i=2,v):H===91?(e.consume(H),i=5,c=0,x):Qa(H)?(e.consume(H),i=4,a.interrupt?t:q):n(H)}function v(H){return H===45?(e.consume(H),a.interrupt?t:q):n(H)}function x(H){const te="CDATA[";return H===te.charCodeAt(c++)?(e.consume(H),c===te.length?a.interrupt?t:O:x):n(H)}function b(H){return Qa(H)?(e.consume(H),l=String.fromCharCode(H),_):n(H)}function _(H){if(H===null||H===47||H===62||bn(H)){const te=H===47,ie=l.toLowerCase();return!te&&!r&&t2.includes(ie)?(i=1,a.interrupt?t(H):O(H)):e3.includes(l.toLowerCase())?(i=6,te?(e.consume(H),S):a.interrupt?t(H):O(H)):(i=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(H):r?M(H):C(H))}return H===45||Ba(H)?(e.consume(H),l+=String.fromCharCode(H),_):n(H)}function S(H){return H===62?(e.consume(H),a.interrupt?t:O):n(H)}function M(H){return Ft(H)?(e.consume(H),M):R(H)}function C(H){return H===47?(e.consume(H),R):H===58||H===95||Qa(H)?(e.consume(H),k):Ft(H)?(e.consume(H),C):R(H)}function k(H){return H===45||H===46||H===58||H===95||Ba(H)?(e.consume(H),k):L(H)}function L(H){return H===61?(e.consume(H),E):Ft(H)?(e.consume(H),L):C(H)}function E(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(e.consume(H),u=H,I):Ft(H)?(e.consume(H),E):T(H)}function I(H){return H===u?(e.consume(H),u=null,A):H===null||bt(H)?n(H):(e.consume(H),I)}function T(H){return H===null||H===34||H===39||H===47||H===60||H===61||H===62||H===96||bn(H)?L(H):(e.consume(H),T)}function A(H){return H===47||H===62||Ft(H)?C(H):n(H)}function R(H){return H===62?(e.consume(H),D):n(H)}function D(H){return H===null||bt(H)?O(H):Ft(H)?(e.consume(H),D):n(H)}function O(H){return H===45&&i===2?(e.consume(H),F):H===60&&i===1?(e.consume(H),Y):H===62&&i===4?(e.consume(H),he):H===63&&i===3?(e.consume(H),q):H===93&&i===5?(e.consume(H),ne):bt(H)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(n3,pe,B)(H)):H===null||bt(H)?(e.exit("htmlFlowData"),B(H)):(e.consume(H),O)}function B(H){return e.check(a3,z,pe)(H)}function z(H){return e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),U}function U(H){return H===null||bt(H)?B(H):(e.enter("htmlFlowData"),O(H))}function F(H){return H===45?(e.consume(H),q):O(H)}function Y(H){return H===47?(e.consume(H),l="",X):O(H)}function X(H){if(H===62){const te=l.toLowerCase();return t2.includes(te)?(e.consume(H),he):O(H)}return Qa(H)&&l.length<8?(e.consume(H),l+=String.fromCharCode(H),X):O(H)}function ne(H){return H===93?(e.consume(H),q):O(H)}function q(H){return H===62?(e.consume(H),he):H===45&&i===2?(e.consume(H),q):O(H)}function he(H){return H===null||bt(H)?(e.exit("htmlFlowData"),pe(H)):(e.consume(H),he)}function pe(H){return e.exit("htmlFlow"),t(H)}}function r3(e,t,n){const a=this;return i;function i(l){return bt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r):n(l)}function r(l){return a.parser.lazy[a.now().line]?n(l):t(l)}}function o3(e,t,n){return a;function a(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Zd,t,n)}}const l3={name:"htmlText",tokenize:c3};function c3(e,t,n){const a=this;let i,r,l;return c;function c(q){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(q),u}function u(q){return q===33?(e.consume(q),h):q===47?(e.consume(q),L):q===63?(e.consume(q),C):Qa(q)?(e.consume(q),T):n(q)}function h(q){return q===45?(e.consume(q),m):q===91?(e.consume(q),r=0,x):Qa(q)?(e.consume(q),M):n(q)}function m(q){return q===45?(e.consume(q),v):n(q)}function p(q){return q===null?n(q):q===45?(e.consume(q),g):bt(q)?(l=p,Y(q)):(e.consume(q),p)}function g(q){return q===45?(e.consume(q),v):p(q)}function v(q){return q===62?F(q):q===45?g(q):p(q)}function x(q){const he="CDATA[";return q===he.charCodeAt(r++)?(e.consume(q),r===he.length?b:x):n(q)}function b(q){return q===null?n(q):q===93?(e.consume(q),_):bt(q)?(l=b,Y(q)):(e.consume(q),b)}function _(q){return q===93?(e.consume(q),S):b(q)}function S(q){return q===62?F(q):q===93?(e.consume(q),S):b(q)}function M(q){return q===null||q===62?F(q):bt(q)?(l=M,Y(q)):(e.consume(q),M)}function C(q){return q===null?n(q):q===63?(e.consume(q),k):bt(q)?(l=C,Y(q)):(e.consume(q),C)}function k(q){return q===62?F(q):C(q)}function L(q){return Qa(q)?(e.consume(q),E):n(q)}function E(q){return q===45||Ba(q)?(e.consume(q),E):I(q)}function I(q){return bt(q)?(l=I,Y(q)):Ft(q)?(e.consume(q),I):F(q)}function T(q){return q===45||Ba(q)?(e.consume(q),T):q===47||q===62||bn(q)?A(q):n(q)}function A(q){return q===47?(e.consume(q),F):q===58||q===95||Qa(q)?(e.consume(q),R):bt(q)?(l=A,Y(q)):Ft(q)?(e.consume(q),A):F(q)}function R(q){return q===45||q===46||q===58||q===95||Ba(q)?(e.consume(q),R):D(q)}function D(q){return q===61?(e.consume(q),O):bt(q)?(l=D,Y(q)):Ft(q)?(e.consume(q),D):A(q)}function O(q){return q===null||q===60||q===61||q===62||q===96?n(q):q===34||q===39?(e.consume(q),i=q,B):bt(q)?(l=O,Y(q)):Ft(q)?(e.consume(q),O):(e.consume(q),z)}function B(q){return q===i?(e.consume(q),i=void 0,U):q===null?n(q):bt(q)?(l=B,Y(q)):(e.consume(q),B)}function z(q){return q===null||q===34||q===39||q===60||q===61||q===96?n(q):q===47||q===62||bn(q)?A(q):(e.consume(q),z)}function U(q){return q===47||q===62||bn(q)?A(q):n(q)}function F(q){return q===62?(e.consume(q),e.exit("htmlTextData"),e.exit("htmlText"),t):n(q)}function Y(q){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(q),e.exit("lineEnding"),X}function X(q){return Ft(q)?Qt(e,ne,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):ne(q)}function ne(q){return e.enter("htmlTextData"),l(q)}}const l0={name:"labelEnd",resolveAll:f3,resolveTo:p3,tokenize:m3},u3={tokenize:g3},d3={tokenize:y3},h3={tokenize:v3};function f3(e){let t=-1;const n=[];for(;++t<e.length;){const a=e[t][1];if(n.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const i=a.type==="labelImage"?4:2;a.type="data",t+=i}}return e.length!==n.length&&Rs(e,0,e.length,n),e}function p3(e,t){let n=e.length,a=0,i,r,l,c;for(;n--;)if(i=e[n][1],r){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(r=n,i.type!=="labelLink")){a=2;break}}else i.type==="labelEnd"&&(l=n);const u={type:e[r][1].type==="labelLink"?"link":"image",start:$({},e[r][1].start),end:$({},e[e.length-1][1].end)},h={type:"label",start:$({},e[r][1].start),end:$({},e[l][1].end)},m={type:"labelText",start:$({},e[r+a+2][1].end),end:$({},e[l-2][1].start)};return c=[["enter",u,t],["enter",h,t]],c=Xs(c,e.slice(r+1,r+a+3)),c=Xs(c,[["enter",m,t]]),c=Xs(c,Bp(t.parser.constructs.insideSpan.null,e.slice(r+a+4,l-3),t)),c=Xs(c,[["exit",m,t],e[l-2],e[l-1],["exit",h,t]]),c=Xs(c,e.slice(l+1)),c=Xs(c,[["exit",u,t]]),Rs(e,r,e.length,c),e}function m3(e,t,n){const a=this;let i=a.events.length,r,l;for(;i--;)if((a.events[i][1].type==="labelImage"||a.events[i][1].type==="labelLink")&&!a.events[i][1]._balanced){r=a.events[i][1];break}return c;function c(g){return r?r._inactive?p(g):(l=a.parser.defined.includes(ui(a.sliceSerialize({start:r.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),u):n(g)}function u(g){return g===40?e.attempt(u3,m,l?m:p)(g):g===91?e.attempt(d3,m,l?h:p)(g):l?m(g):p(g)}function h(g){return e.attempt(h3,m,p)(g)}function m(g){return t(g)}function p(g){return r._balanced=!0,n(g)}}function g3(e,t,n){return a;function a(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return bn(p)?Nd(e,r)(p):r(p)}function r(p){return p===41?m(p):yC(e,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return bn(p)?Nd(e,u)(p):m(p)}function c(p){return n(p)}function u(p){return p===34||p===39||p===40?xC(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):m(p)}function h(p){return bn(p)?Nd(e,m)(p):m(p)}function m(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function y3(e,t,n){const a=this;return i;function i(c){return vC.call(a,e,r,l,"reference","referenceMarker","referenceString")(c)}function r(c){return a.parser.defined.includes(ui(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function l(c){return n(c)}}function v3(e,t,n){return a;function a(r){return e.enter("reference"),e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),i}function i(r){return r===93?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}const x3={name:"labelStartImage",resolveAll:l0.resolveAll,tokenize:b3};function b3(e,t,n){const a=this;return i;function i(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),r}function r(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(c):t(c)}}const _3={name:"labelStartLink",resolveAll:l0.resolveAll,tokenize:w3};function w3(e,t,n){const a=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),r}function r(l){return l===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(l):t(l)}}const wy={name:"lineEnding",tokenize:S3};function S3(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Qt(e,t,"linePrefix")}}const Qf={name:"thematicBreak",tokenize:N3};function N3(e,t,n){let a=0,i;return r;function r(h){return e.enter("thematicBreak"),l(h)}function l(h){return i=h,c(h)}function c(h){return h===i?(e.enter("thematicBreakSequence"),u(h)):a>=3&&(h===null||bt(h))?(e.exit("thematicBreak"),t(h)):n(h)}function u(h){return h===i?(e.consume(h),a++,u):(e.exit("thematicBreakSequence"),Ft(h)?Qt(e,c,"whitespace")(h):c(h))}}const os={continuation:{tokenize:j3},exit:R3,name:"list",tokenize:M3},k3={partial:!0,tokenize:L3},C3={partial:!0,tokenize:E3};function M3(e,t,n){const a=this,i=a.events[a.events.length-1];let r=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return c;function c(v){const x=a.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!a.containerState.marker||v===a.containerState.marker:Dv(v)){if(a.containerState.type||(a.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Qf,n,h)(v):h(v);if(!a.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(v)}return n(v)}function u(v){return Dv(v)&&++l<10?(e.consume(v),u):(!a.interrupt||l<2)&&(a.containerState.marker?v===a.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),h(v)):n(v)}function h(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||v,e.check(Zd,a.interrupt?n:m,e.attempt(k3,g,p))}function m(v){return a.containerState.initialBlankLine=!0,r++,g(v)}function p(v){return Ft(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),g):n(v)}function g(v){return a.containerState.size=r+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function j3(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Zd,i,r);function i(c){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,Qt(e,t,"listItemIndent",a.containerState.size+1)(c)}function r(c){return a.containerState.furtherBlankLines||!Ft(c)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,l(c)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(C3,t,l)(c))}function l(c){return a.containerState._closeFlow=!0,a.interrupt=void 0,Qt(e,e.attempt(os,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function E3(e,t,n){const a=this;return Qt(e,i,"listItemIndent",a.containerState.size+1);function i(r){const l=a.events[a.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===a.containerState.size?t(r):n(r)}}function R3(e){e.exit(this.containerState.type)}function L3(e,t,n){const a=this;return Qt(e,i,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(r){const l=a.events[a.events.length-1];return!Ft(r)&&l&&l[1].type==="listItemPrefixWhitespace"?t(r):n(r)}}const n2={name:"setextUnderline",resolveTo:T3,tokenize:A3};function T3(e,t){let n=e.length,a,i,r;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!r&&e[n][1].type==="definition"&&(r=n);const l={type:"setextHeading",start:$({},e[a][1].start),end:$({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",r?(e.splice(i,0,["enter",l,t]),e.splice(r+1,0,["exit",e[a][1],t]),e[a][1].end=$({},e[r][1].end)):e[a][1]=l,e.push(["exit",l,t]),e}function A3(e,t,n){const a=this;let i;return r;function r(h){let m=a.events.length,p;for(;m--;)if(a.events[m][1].type!=="lineEnding"&&a.events[m][1].type!=="linePrefix"&&a.events[m][1].type!=="content"){p=a.events[m][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||p)?(e.enter("setextHeadingLine"),i=h,l(h)):n(h)}function l(h){return e.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===i?(e.consume(h),c):(e.exit("setextHeadingLineSequence"),Ft(h)?Qt(e,u,"lineSuffix")(h):u(h))}function u(h){return h===null||bt(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const I3={tokenize:D3};function D3(e){const t=this,n=e.attempt(Zd,a,e.attempt(this.parser.constructs.flowInitial,i,Qt(e,e.attempt(this.parser.constructs.flow,i,e.attempt(UD,i)),"linePrefix")));return n;function a(r){if(r===null){e.consume(r);return}return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const O3={resolveAll:_C()},z3=bC("string"),B3=bC("text");function bC(e){return{resolveAll:_C(e==="text"?$3:void 0),tokenize:t};function t(n){const a=this,i=this.parser.constructs[e],r=n.attempt(i,l,c);return l;function l(m){return h(m)?r(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),u}function u(m){return h(m)?(n.exit("data"),r(m)):(n.consume(m),u)}function h(m){if(m===null)return!0;const p=i[m];let g=-1;if(p)for(;++g<p.length;){const v=p[g];if(!v.previous||v.previous.call(a,a.previous))return!0}return!1}}}function _C(e){return t;function t(n,a){let i=-1,r;for(;++i<=n.length;)r===void 0?n[i]&&n[i][1].type==="data"&&(r=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==r+2&&(n[r][1].end=n[i-1][1].end,n.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(n,a):n}}function $3(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const a=e[n-1][1],i=t.sliceStream(a);let r=i.length,l=-1,c=0,u;for(;r--;){const h=i[r];if(typeof h=="string"){for(l=h.length;h.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(h===-2)u=!0,c++;else if(h!==-1){r++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const h={type:n===e.length||u||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:r?l:a.start._bufferIndex+l,_index:a.start._index+r,line:a.end.line,column:a.end.column-c,offset:a.end.offset-c},end:$({},a.end)};a.end=$({},h.start),a.start.offset===a.end.offset?Object.assign(a,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const U3={42:os,43:os,45:os,48:os,49:os,50:os,51:os,52:os,53:os,54:os,55:os,56:os,57:os,62:fC},F3={91:VD},P3={[-2]:_y,[-1]:_y,32:_y},H3={35:ZD,42:Qf,45:[n2,Qf],60:t3,61:n2,95:Qf,96:e2,126:e2},q3={38:mC,92:pC},V3={[-5]:wy,[-4]:wy,[-3]:wy,33:x3,38:mC,42:Ov,60:[_D,l3],91:_3,92:[QD,pC],93:l0,95:Ov,96:ID},Y3={null:[Ov,O3]},G3={null:[42,95]},K3={null:[]},Q3=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:G3,contentInitial:F3,disable:K3,document:U3,flow:H3,flowInitial:P3,insideSpan:Y3,string:q3,text:V3},Symbol.toStringTag,{value:"Module"}));function X3(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},r=[];let l=[],c=[];const u={attempt:I(L),check:I(E),consume:M,enter:C,exit:k,interrupt:I(E,{interrupt:!0})},h={code:null,containerState:{},defineSkip:b,events:[],now:x,parser:e,previous:null,sliceSerialize:g,sliceStream:v,write:p};let m=t.tokenize.call(h,u);return t.resolveAll&&r.push(t),h;function p(D){return l=Xs(l,D),_(),l[l.length-1]!==null?[]:(T(t,0),h.events=Bp(r,h.events,h),h.events)}function g(D,O){return J3(v(D),O)}function v(D){return Z3(l,D)}function x(){const{_bufferIndex:D,_index:O,line:B,column:z,offset:U}=a;return{_bufferIndex:D,_index:O,line:B,column:z,offset:U}}function b(D){i[D.line]=D.column,R()}function _(){let D;for(;a._index<l.length;){const O=l[a._index];if(typeof O=="string")for(D=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===D&&a._bufferIndex<O.length;)S(O.charCodeAt(a._bufferIndex));else S(O)}}function S(D){m=m(D)}function M(D){bt(D)?(a.line++,a.column=1,a.offset+=D===-3?2:1,R()):D!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===l[a._index].length&&(a._bufferIndex=-1,a._index++)),h.previous=D}function C(D,O){const B=O||{};return B.type=D,B.start=x(),h.events.push(["enter",B,h]),c.push(B),B}function k(D){const O=c.pop();return O.end=x(),h.events.push(["exit",O,h]),O}function L(D,O){T(D,O.from)}function E(D,O){O.restore()}function I(D,O){return B;function B(z,U,F){let Y,X,ne,q;return Array.isArray(z)?pe(z):"tokenize"in z?pe([z]):he(z);function he(W){return ge;function ge(we){const je=we!==null&&W[we],De=we!==null&&W.null,re=[...Array.isArray(je)?je:je?[je]:[],...Array.isArray(De)?De:De?[De]:[]];return pe(re)(we)}}function pe(W){return Y=W,X=0,W.length===0?F:H(W[X])}function H(W){return ge;function ge(we){return q=A(),ne=W,W.partial||(h.currentConstruct=W),W.name&&h.parser.constructs.disable.null.includes(W.name)?ie():W.tokenize.call(O?Object.assign(Object.create(h),O):h,u,te,ie)(we)}}function te(W){return D(ne,q),U}function ie(W){return q.restore(),++X<Y.length?H(Y[X]):F}}}function T(D,O){D.resolveAll&&!r.includes(D)&&r.push(D),D.resolve&&Rs(h.events,O,h.events.length-O,D.resolve(h.events.slice(O),h)),D.resolveTo&&(h.events=D.resolveTo(h.events,h))}function A(){const D=x(),O=h.previous,B=h.currentConstruct,z=h.events.length,U=Array.from(c);return{from:z,restore:F};function F(){a=D,h.previous=O,h.currentConstruct=B,h.events.length=z,c=U,R()}}function R(){a.line in i&&a.column<2&&(a.column=i[a.line],a.offset+=i[a.line]-1)}}function Z3(e,t){const n=t.start._index,a=t.start._bufferIndex,i=t.end._index,r=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(a,r)];else{if(l=e.slice(n,i),a>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(a):l.shift()}r>0&&l.push(e[i].slice(0,r))}return l}function J3(e,t){let n=-1;const a=[];let i;for(;++n<e.length;){const r=e[n];let l;if(typeof r=="string")l=r;else switch(r){case-5:{l="\r";break}case-4:{l=`
|
|
51
|
+
`;break}case-3:{l=`\r
|
|
52
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(r)}i=r===-2,a.push(l)}return a.join("")}function W3(e){const t={constructs:dC([Q3,...(e||{}).extensions||[]]),content:n(pD),defined:[],document:n(gD),flow:n(I3),lazy:{},string:n(z3),text:n(B3)};return t;function n(a){return i;function i(r){return X3(t,a,r)}}}function eO(e){for(;!gC(e););return e}const a2=/[\0\t\n\r]/g;function tO(){let e=1,t="",n=!0,a;return i;function i(r,l,c){const u=[];let h,m,p,g,v;for(r=t+(typeof r=="string"?r.toString():new TextDecoder(l||void 0).decode(r)),p=0,t="",n&&(r.charCodeAt(0)===65279&&p++,n=void 0);p<r.length;){if(a2.lastIndex=p,h=a2.exec(r),g=h&&h.index!==void 0?h.index:r.length,v=r.charCodeAt(g),!h){t=r.slice(p);break}if(v===10&&p===g&&a)u.push(-3),a=void 0;else switch(a&&(u.push(-5),a=void 0),p<g&&(u.push(r.slice(p,g)),e+=g-p),v){case 0:{u.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,u.push(-2);e++<m;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:a=!0,e=1}p=g+1}return c&&(a&&u.push(-5),t&&u.push(t),u.push(null)),u}}const nO=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function aO(e){return e.replace(nO,sO)}function sO(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return hC(n.slice(i?2:1),i?16:10)}return o0(n)||e}const wC={}.hasOwnProperty;function iO(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),rO(n)(eO(W3(n).document().write(tO()(e,t,!0))))}function rO(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(de),autolinkProtocol:A,autolinkEmail:A,atxHeading:r(Q),blockQuote:r(De),characterEscape:A,characterReference:A,codeFenced:r(re),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:r(re,l),codeText:r(Z,l),codeTextData:A,data:A,codeFlowValue:A,definition:r(J),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:r(K),hardBreakEscape:r(ae),hardBreakTrailing:r(ae),htmlFlow:r(ye,l),htmlFlowData:A,htmlText:r(ye,l),htmlTextData:A,image:r(Ae),label:l,link:r(de),listItem:r(Ge),listItemValue:g,listOrdered:r(Je,p),listUnordered:r(Je),paragraph:r(be),reference:H,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:r(Q),strong:r(Fe),thematicBreak:r(Ee)},exit:{atxHeading:u(),atxHeadingSequence:L,autolink:u(),autolinkEmail:je,autolinkProtocol:we,blockQuote:u(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:W,characterReference:ge,codeFenced:u(_),codeFencedFence:b,codeFencedFenceInfo:v,codeFencedFenceMeta:x,codeFlowValue:R,codeIndented:u(S),codeText:u(U),codeTextData:R,data:R,definition:u(),definitionDestinationString:k,definitionLabelString:M,definitionTitleString:C,emphasis:u(),hardBreakEscape:u(O),hardBreakTrailing:u(O),htmlFlow:u(B),htmlFlowData:R,htmlText:u(z),htmlTextData:R,image:u(Y),label:ne,labelText:X,lineEnding:D,link:u(F),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:te,resourceDestinationString:q,resourceTitleString:he,resource:pe,setextHeading:u(T),setextHeadingLineSequence:I,setextHeadingText:E,strong:u(),thematicBreak:u()}};SC(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(se){let le={type:"root",children:[]};const xe={stack:[le],tokenStack:[],config:t,enter:c,exit:h,buffer:l,resume:m,data:n},Pe=[];let $e=-1;for(;++$e<se.length;)if(se[$e][1].type==="listOrdered"||se[$e][1].type==="listUnordered")if(se[$e][0]==="enter")Pe.push($e);else{const Be=Pe.pop();$e=i(se,Be,$e)}for($e=-1;++$e<se.length;){const Be=t[se[$e][0]];wC.call(Be,se[$e][1].type)&&Be[se[$e][1].type].call(Object.assign({sliceSerialize:se[$e][2].sliceSerialize},xe),se[$e][1])}if(xe.tokenStack.length>0){const Be=xe.tokenStack[xe.tokenStack.length-1];(Be[1]||s2).call(xe,void 0,Be[0])}for(le.position={start:Gr(se.length>0?se[0][1].start:{line:1,column:1,offset:0}),end:Gr(se.length>0?se[se.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e<t.transforms.length;)le=t.transforms[$e](le)||le;return le}function i(se,le,xe){let Pe=le-1,$e=-1,Be=!1,at,ot,ft,it;for(;++Pe<=xe;){const kt=se[Pe];switch(kt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{kt[0]==="enter"?$e++:$e--,it=void 0;break}case"lineEndingBlank":{kt[0]==="enter"&&(at&&!it&&!$e&&!ft&&(ft=Pe),it=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:it=void 0}if(!$e&&kt[0]==="enter"&&kt[1].type==="listItemPrefix"||$e===-1&&kt[0]==="exit"&&(kt[1].type==="listUnordered"||kt[1].type==="listOrdered")){if(at){let pt=Pe;for(ot=void 0;pt--;){const Yt=se[pt];if(Yt[1].type==="lineEnding"||Yt[1].type==="lineEndingBlank"){if(Yt[0]==="exit")continue;ot&&(se[ot][1].type="lineEndingBlank",Be=!0),Yt[1].type="lineEnding",ot=pt}else if(!(Yt[1].type==="linePrefix"||Yt[1].type==="blockQuotePrefix"||Yt[1].type==="blockQuotePrefixWhitespace"||Yt[1].type==="blockQuoteMarker"||Yt[1].type==="listItemIndent"))break}ft&&(!ot||ft<ot)&&(at._spread=!0),at.end=Object.assign({},ot?se[ot][1].start:kt[1].end),se.splice(ot||Pe,0,["exit",at,kt[2]]),Pe++,xe++}if(kt[1].type==="listItemPrefix"){const pt={type:"listItem",_spread:!1,start:Object.assign({},kt[1].start),end:void 0};at=pt,se.splice(Pe,0,["enter",pt,kt[2]]),Pe++,xe++,ft=void 0,it=!0}}}return se[le][1]._spread=Be,xe}function r(se,le){return xe;function xe(Pe){c.call(this,se(Pe),Pe),le&&le.call(this,Pe)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(se,le,xe){this.stack[this.stack.length-1].children.push(se),this.stack.push(se),this.tokenStack.push([le,xe||void 0]),se.position={start:Gr(le.start),end:void 0}}function u(se){return le;function le(xe){se&&se.call(this,xe),h.call(this,xe)}}function h(se,le){const xe=this.stack.pop(),Pe=this.tokenStack.pop();if(Pe)Pe[0].type!==se.type&&(le?le.call(this,se,Pe[0]):(Pe[1]||s2).call(this,se,Pe[0]));else throw new Error("Cannot close `"+se.type+"` ("+Sd({start:se.start,end:se.end})+"): it’s not open");xe.position.end=Gr(se.end)}function m(){return r0(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function g(se){if(this.data.expectingFirstListItemValue){const le=this.stack[this.stack.length-2];le.start=Number.parseInt(this.sliceSerialize(se),10),this.data.expectingFirstListItemValue=void 0}}function v(){const se=this.resume(),le=this.stack[this.stack.length-1];le.lang=se}function x(){const se=this.resume(),le=this.stack[this.stack.length-1];le.meta=se}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const se=this.resume(),le=this.stack[this.stack.length-1];le.value=se.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const se=this.resume(),le=this.stack[this.stack.length-1];le.value=se.replace(/(\r?\n|\r)$/g,"")}function M(se){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.label=le,xe.identifier=ui(this.sliceSerialize(se)).toLowerCase()}function C(){const se=this.resume(),le=this.stack[this.stack.length-1];le.title=se}function k(){const se=this.resume(),le=this.stack[this.stack.length-1];le.url=se}function L(se){const le=this.stack[this.stack.length-1];if(!le.depth){const xe=this.sliceSerialize(se).length;le.depth=xe}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function I(se){const le=this.stack[this.stack.length-1];le.depth=this.sliceSerialize(se).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function A(se){const le=this.stack[this.stack.length-1].children;let xe=le[le.length-1];(!xe||xe.type!=="text")&&(xe=me(),xe.position={start:Gr(se.start),end:void 0},le.push(xe)),this.stack.push(xe)}function R(se){const le=this.stack.pop();le.value+=this.sliceSerialize(se),le.position.end=Gr(se.end)}function D(se){const le=this.stack[this.stack.length-1];if(this.data.atHardBreak){const xe=le.children[le.children.length-1];xe.position.end=Gr(se.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(le.type)&&(A.call(this,se),R.call(this,se))}function O(){this.data.atHardBreak=!0}function B(){const se=this.resume(),le=this.stack[this.stack.length-1];le.value=se}function z(){const se=this.resume(),le=this.stack[this.stack.length-1];le.value=se}function U(){const se=this.resume(),le=this.stack[this.stack.length-1];le.value=se}function F(){const se=this.stack[this.stack.length-1];if(this.data.inReference){const le=this.data.referenceType||"shortcut";se.type+="Reference",se.referenceType=le,delete se.url,delete se.title}else delete se.identifier,delete se.label;this.data.referenceType=void 0}function Y(){const se=this.stack[this.stack.length-1];if(this.data.inReference){const le=this.data.referenceType||"shortcut";se.type+="Reference",se.referenceType=le,delete se.url,delete se.title}else delete se.identifier,delete se.label;this.data.referenceType=void 0}function X(se){const le=this.sliceSerialize(se),xe=this.stack[this.stack.length-2];xe.label=aO(le),xe.identifier=ui(le).toLowerCase()}function ne(){const se=this.stack[this.stack.length-1],le=this.resume(),xe=this.stack[this.stack.length-1];if(this.data.inReference=!0,xe.type==="link"){const Pe=se.children;xe.children=Pe}else xe.alt=le}function q(){const se=this.resume(),le=this.stack[this.stack.length-1];le.url=se}function he(){const se=this.resume(),le=this.stack[this.stack.length-1];le.title=se}function pe(){this.data.inReference=void 0}function H(){this.data.referenceType="collapsed"}function te(se){const le=this.resume(),xe=this.stack[this.stack.length-1];xe.label=le,xe.identifier=ui(this.sliceSerialize(se)).toLowerCase(),this.data.referenceType="full"}function ie(se){this.data.characterReferenceType=se.type}function W(se){const le=this.sliceSerialize(se),xe=this.data.characterReferenceType;let Pe;xe?(Pe=hC(le,xe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Pe=o0(le);const $e=this.stack[this.stack.length-1];$e.value+=Pe}function ge(se){const le=this.stack.pop();le.position.end=Gr(se.end)}function we(se){R.call(this,se);const le=this.stack[this.stack.length-1];le.url=this.sliceSerialize(se)}function je(se){R.call(this,se);const le=this.stack[this.stack.length-1];le.url="mailto:"+this.sliceSerialize(se)}function De(){return{type:"blockquote",children:[]}}function re(){return{type:"code",lang:null,meta:null,value:""}}function Z(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function K(){return{type:"emphasis",children:[]}}function Q(){return{type:"heading",depth:0,children:[]}}function ae(){return{type:"break"}}function ye(){return{type:"html",value:""}}function Ae(){return{type:"image",title:null,url:"",alt:null}}function de(){return{type:"link",title:null,url:"",children:[]}}function Je(se){return{type:"list",ordered:se.type==="listOrdered",start:null,spread:se._spread,children:[]}}function Ge(se){return{type:"listItem",spread:se._spread,checked:null,children:[]}}function be(){return{type:"paragraph",children:[]}}function Fe(){return{type:"strong",children:[]}}function me(){return{type:"text",value:""}}function Ee(){return{type:"thematicBreak"}}}function Gr(e){return{line:e.line,column:e.column,offset:e.offset}}function SC(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?SC(e,a):oO(e,a)}}function oO(e,t){let n;for(n in t)if(wC.call(t,n))switch(n){case"canContainEols":{const a=t[n];a&&e[n].push(...a);break}case"transforms":{const a=t[n];a&&e[n].push(...a);break}case"enter":case"exit":{const a=t[n];a&&Object.assign(e[n],a);break}}}function s2(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Sd({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Sd({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Sd({start:t.start,end:t.end})+") is still open")}function lO(e){const t=this;t.parser=n;function n(a){return iO(a,ee($($({},t.data("settings")),e),{extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]}))}}function cO(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function uO(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
53
|
+
`}]}function dO(e,t){const n=t.value?t.value+`
|
|
54
|
+
`:"",a={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(a.className=["language-"+i[0]]);let r={type:"element",tagName:"code",properties:a,children:[{type:"text",value:n}]};return t.meta&&(r.data={meta:t.meta}),e.patch(t,r),r=e.applyData(t,r),r={type:"element",tagName:"pre",properties:{},children:[r]},e.patch(t,r),r}function hO(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fO(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pO(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),i=nu(a.toLowerCase()),r=e.footnoteOrder.indexOf(a);let l,c=e.footnoteCounts.get(a);c===void 0?(c=0,e.footnoteOrder.push(a),l=e.footnoteOrder.length):l=r+1,c+=1,e.footnoteCounts.set(a,c);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,u);const h={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,h),e.applyData(t,h)}function mO(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gO(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function NC(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const i=e.all(t),r=i[0];r&&r.type==="text"?r.value="["+r.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=a:i.push({type:"text",value:a}),i}function yO(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return NC(e,t);const i={src:nu(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(i.title=a.title);const r={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,r),e.applyData(t,r)}function vO(e,t){const n={src:nu(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function xO(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const a={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,a),e.applyData(t,a)}function bO(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return NC(e,t);const i={href:nu(a.url||"")};a.title!==null&&a.title!==void 0&&(i.title=a.title);const r={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _O(e,t){const n={href:nu(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function wO(e,t,n){const a=e.all(t),i=n?SO(n):kC(t),r={},l=[];if(typeof t.checked=="boolean"){const m=a[0];let p;m&&m.type==="element"&&m.tagName==="p"?p=m:(p={type:"element",tagName:"p",properties:{},children:[]},a.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),r.className=["task-list-item"]}let c=-1;for(;++c<a.length;){const m=a[c];(i||c!==0||m.type!=="element"||m.tagName!=="p")&&l.push({type:"text",value:`
|
|
55
|
+
`}),m.type==="element"&&m.tagName==="p"&&!i?l.push(...m.children):l.push(m)}const u=a[a.length-1];u&&(i||u.type!=="element"||u.tagName!=="p")&&l.push({type:"text",value:`
|
|
56
|
+
`});const h={type:"element",tagName:"li",properties:r,children:l};return e.patch(t,h),e.applyData(t,h)}function SO(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let a=-1;for(;!t&&++a<n.length;)t=kC(n[a])}return t}function kC(e){const t=e.spread;return t!=null?t:e.children.length>1}function NO(e,t){const n={},a=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<a.length;){const l=a[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const r={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,r),e.applyData(t,r)}function kO(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CO(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function MO(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jO(e,t){const n=e.all(t),a=n.shift(),i=[];if(a){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=n0(t.children[1]),u=sC(t.children[t.children.length-1]);c&&u&&(l.position={start:c,end:u}),i.push(l)}const r={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,r),e.applyData(t,r)}function EO(e,t,n){const a=n?n.children:void 0,i=(a?a.indexOf(t):1)===0?"th":"td",r=n&&n.type==="table"?n.align:void 0,l=r?r.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const m=t.children[c],p={},g=r?r[c]:void 0;g&&(p.align=g);let v={type:"element",tagName:i,properties:p,children:[]};m&&(v.children=e.all(m),e.patch(m,v),v=e.applyData(m,v)),u.push(v)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,h),e.applyData(t,h)}function RO(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const i2=9,r2=32;function LO(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),i=0;const r=[];for(;a;)r.push(o2(t.slice(i,a.index),i>0,!0),a[0]),i=a.index+a[0].length,a=n.exec(t);return r.push(o2(t.slice(i),i>0,!1)),r.join("")}function o2(e,t,n){let a=0,i=e.length;if(t){let r=e.codePointAt(a);for(;r===i2||r===r2;)a++,r=e.codePointAt(a)}if(n){let r=e.codePointAt(i-1);for(;r===i2||r===r2;)i--,r=e.codePointAt(i-1)}return i>a?e.slice(a,i):""}function TO(e,t){const n={type:"text",value:LO(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function AO(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const IO={blockquote:cO,break:uO,code:dO,delete:hO,emphasis:fO,footnoteReference:pO,heading:mO,html:gO,imageReference:yO,image:vO,inlineCode:xO,linkReference:bO,link:_O,listItem:wO,list:NO,paragraph:kO,root:CO,strong:MO,table:jO,tableCell:RO,tableRow:EO,text:TO,thematicBreak:AO,toml:wf,yaml:wf,definition:wf,footnoteDefinition:wf};function wf(){}const CC=-1,$p=0,kd=1,hp=2,c0=3,u0=4,d0=5,h0=6,MC=7,jC=8,{defineProperty:DO}=Object,EC=typeof self=="object"?self:globalThis,l2=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new EC[e](t)},OO=(e,t)=>{const n=(i,r)=>(e.set(r,i),i),a=i=>{if(e.has(i))return e.get(i);const[r,l]=t[i];switch(r){case $p:case CC:return n(l,i);case kd:{const c=n([],i);for(const u of l)c.push(a(u));return c}case hp:{const c=n({},i);for(const[u,h]of l){const m=a(u),p=a(h);m==="__proto__"?DO(c,m,{value:p,configurable:!0,enumerable:!0,writable:!0}):c[m]=p}return c}case c0:return n(new Date(l),i);case u0:{const{source:c,flags:u}=l;return n(new RegExp(c,u),i)}case d0:{const c=n(new Map,i);for(const[u,h]of l)c.set(a(u),a(h));return c}case h0:{const c=n(new Set,i);for(const u of l)c.add(a(u));return c}case MC:{const{name:c,message:u}=l;return n(typeof EC[c]=="function"?l2(c,u):new Error(u),i)}case jC:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}case"-0":return-0}return n(l2(r,l),i)};return a},c2=e=>OO(new Map,e)(0),Yo="",{toString:zO}={},{keys:BO,is:$O}=Object,cd=e=>{const t=typeof e;if(t!=="object"||!e)return[$p,t];const n=zO.call(e).slice(8,-1);switch(n){case"Array":return[kd,Yo];case"Object":return[hp,Yo];case"Date":return[c0,Yo];case"RegExp":return[u0,Yo];case"Map":return[d0,Yo];case"Set":return[h0,Yo];case"DataView":return[kd,n]}return n.includes("Array")?[kd,n]:e instanceof Error?[MC,e.name||"Error"]:[hp,n]},Sf=([e,t])=>e===$p&&(t==="function"||t==="symbol"),UO=(e,t,n,a)=>{const i=(l,c)=>{const u=a.push(l)-1;return n.set(c,u),u},r=l=>{if(n.has(l))return n.get(l);let[c,u]=cd(l);switch(c){case $p:{let m=l;switch(u){case"bigint":c=jC,m=l.toString();break;case"number":if(!l&&$O(l,-0))return a.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);m=null;break;case"undefined":return i([CC],l)}return i([c,m],l)}case kd:{if(u){let g=l;return u==="DataView"?g=new Uint8Array(l.buffer):u==="ArrayBuffer"&&(g=new Uint8Array(l)),i([u,[...g]],l)}const m=[],p=i([c,m],l);for(const g of l)m.push(r(g));return p}case hp:{if(u)switch(u){case"BigInt":return i([u,l.toString()],l);case"Boolean":case"Number":case"String":return i([u,l.valueOf()],l)}if(t&&"toJSON"in l)return r(l.toJSON());const m=[],p=i([c,m],l);for(const g of BO(l))(e||!Sf(cd(l[g])))&&m.push([r(g),r(l[g])]);return p}case c0:return i([c,isNaN(l.getTime())?Yo:l.toISOString()],l);case u0:{const{source:m,flags:p}=l;return i([c,{source:m,flags:p}],l)}case d0:{const m=[],p=i([c,m],l);for(const[g,v]of l)(e||!(Sf(cd(g))||Sf(cd(v))))&&m.push([r(g),r(v)]);return p}case h0:{const m=[],p=i([c,m],l);for(const g of l)(e||!Sf(cd(g)))&&m.push(r(g));return p}}const{message:h}=l;return i([c,{name:u,message:h}],l)};return r},u2=(e,{json:t,lossy:n}={})=>{const a=[];return UO(!(t||n),!!t,new Map,a)(e),a},fp=typeof structuredClone=="function"?((e,t)=>t&&("json"in t||"lossy"in t)?c2(u2(e,t)):structuredClone(e)):(e,t)=>c2(u2(e,t));function FO(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function PO(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function HO(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||FO,a=e.options.footnoteBackLabel||PO,i=e.options.footnoteLabel||"Footnotes",r=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let u=-1;for(;++u<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[u]);if(!h)continue;const m=e.all(h),p=String(h.identifier).toUpperCase(),g=nu(p.toLowerCase());let v=0;const x=[],b=e.footnoteCounts.get(p);for(;b!==void 0&&++v<=b;){x.length>0&&x.push({type:"text",value:" "});let M=typeof n=="string"?n:n(u,v);typeof M=="string"&&(M={type:"text",value:M}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+g+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(u,v),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const _=m[m.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const M=_.children[_.children.length-1];M&&M.type==="text"?M.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...x)}else m.push(...x);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+g},children:e.wrap(m,!0)};e.patch(h,S),c.push(S)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:r,properties:ee($({},fp(l)),{id:"footnote-label"}),children:[{type:"text",value:i}]},{type:"text",value:`
|
|
57
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
|
|
58
|
+
`}]}}const Up=(function(e){if(e==null)return GO;if(typeof e=="function")return Fp(e);if(typeof e=="object")return Array.isArray(e)?qO(e):VO(e);if(typeof e=="string")return YO(e);throw new Error("Expected function, string, or object as test")});function qO(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Up(e[n]);return Fp(a);function a(...i){let r=-1;for(;++r<t.length;)if(t[r].apply(this,i))return!0;return!1}}function VO(e){const t=e;return Fp(n);function n(a){const i=a;let r;for(r in e)if(i[r]!==t[r])return!1;return!0}}function YO(e){return Fp(t);function t(n){return n&&n.type===e}}function Fp(e){return t;function t(n,a,i){return!!(KO(n)&&e.call(this,n,typeof a=="number"?a:void 0,i||void 0))}}function GO(){return!0}function KO(e){return e!==null&&typeof e=="object"&&"type"in e}const RC=[],QO=!0,zv=!1,XO="skip";function LC(e,t,n,a){let i;typeof t=="function"&&typeof n!="function"?(a=n,n=t):i=t;const r=Up(i),l=a?-1:1;c(e,void 0,[])();function c(u,h,m){const p=u&&typeof u=="object"?u:{};if(typeof p.type=="string"){const v=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(u.type+(v?"<"+v+">":""))+")"})}return g;function g(){let v=RC,x,b,_;if((!t||r(u,h,m[m.length-1]||void 0))&&(v=ZO(n(u,m)),v[0]===zv))return v;if("children"in u&&u.children){const S=u;if(S.children&&v[0]!==XO)for(b=(a?S.children.length:-1)+l,_=m.concat(S);b>-1&&b<S.children.length;){const M=S.children[b];if(x=c(M,b,_)(),x[0]===zv)return x;b=typeof x[1]=="number"?x[1]:b+l}}return v}}}function ZO(e){return Array.isArray(e)?e:typeof e=="number"?[QO,e]:e==null?RC:[e]}function f0(e,t,n,a){let i,r,l;typeof t=="function"&&typeof n!="function"?(r=void 0,l=t,i=n):(r=t,l=n,i=a),LC(e,r,c,i);function c(u,h){const m=h[h.length-1],p=m?m.children.indexOf(u):void 0;return l(u,p,m)}}const Bv={}.hasOwnProperty,JO={};function WO(e,t){const n=t||JO,a=new Map,i=new Map,r=new Map,l=$($({},IO),n.handlers),c={all:h,applyData:t4,definitionById:a,footnoteById:i,footnoteCounts:r,footnoteOrder:[],handlers:l,one:u,options:n,patch:e4,wrap:a4};return f0(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const p=m.type==="definition"?a:i,g=String(m.identifier).toUpperCase();p.has(g)||p.set(g,m)}}),c;function u(m,p){const g=m.type,v=c.handlers[g];if(Bv.call(c.handlers,g)&&v)return v(c,m,p);if(c.options.passThrough&&c.options.passThrough.includes(g)){if("children"in m){const x=m,{children:b}=x,_=Ie(x,["children"]),S=fp(_);return S.children=c.all(m),S}return fp(m)}return(c.options.unknownHandler||n4)(c,m,p)}function h(m){const p=[];if("children"in m){const g=m.children;let v=-1;for(;++v<g.length;){const x=c.one(g[v],m);if(x){if(v&&g[v-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=d2(x.value)),!Array.isArray(x)&&x.type==="element")){const b=x.children[0];b&&b.type==="text"&&(b.value=d2(b.value))}Array.isArray(x)?p.push(...x):p.push(x)}}}return p}}function e4(e,t){e.position&&(t.position=UI(e))}function t4(e,t){let n=t;if(e&&e.data){const a=e.data.hName,i=e.data.hChildren,r=e.data.hProperties;if(typeof a=="string")if(n.type==="element")n.tagName=a;else{const l="children"in n?n.children:[n];n={type:"element",tagName:a,properties:{},children:l}}n.type==="element"&&r&&Object.assign(n.properties,fp(r)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function n4(e,t){const n=t.data||{},a="value"in t&&!(Bv.call(n,"hProperties")||Bv.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function a4(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
|
|
59
|
+
`});++a<e.length;)a&&n.push({type:"text",value:`
|
|
60
|
+
`}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
61
|
+
`}),n}function d2(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function h2(e,t){const n=WO(e,t),a=n.one(e,void 0),i=HO(n),r=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return i&&r.children.push({type:"text",value:`
|
|
62
|
+
`},i),r}function s4(e,t){return e&&"run"in e?function(n,a){return St(this,null,function*(){const i=h2(n,$({file:a},t));yield e.run(i,a)})}:function(n,a){return h2(n,$({file:a},e||t))}}function f2(e){if(e)throw e}var Sy,p2;function i4(){if(p2)return Sy;p2=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},r=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var h=e.call(u,"constructor"),m=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!h&&!m)return!1;var p;for(p in u);return typeof p>"u"||e.call(u,p)},l=function(u,h){n&&h.name==="__proto__"?n(u,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):u[h.name]=h.newValue},c=function(u,h){if(h==="__proto__")if(e.call(u,h)){if(a)return a(u,h).value}else return;return u[h]};return Sy=function u(){var h,m,p,g,v,x,b=arguments[0],_=1,S=arguments.length,M=!1;for(typeof b=="boolean"&&(M=b,b=arguments[1]||{},_=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});_<S;++_)if(h=arguments[_],h!=null)for(m in h)p=c(b,m),g=c(h,m),b!==g&&(M&&g&&(r(g)||(v=i(g)))?(v?(v=!1,x=p&&i(p)?p:[]):x=p&&r(p)?p:{},l(b,{name:m,newValue:u(M,x,g)})):typeof g<"u"&&l(b,{name:m,newValue:g}));return b},Sy}var r4=i4();const Ny=aC(r4);function $v(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function o4(){const e=[],t={run:n,use:a};return t;function n(...i){let r=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...i);function c(u,...h){const m=e[++r];let p=-1;if(u){l(u);return}for(;++p<i.length;)(h[p]===null||h[p]===void 0)&&(h[p]=i[p]);i=h,m?l4(m,c)(...h):l(null,...h)}}function a(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function l4(e,t){let n;return a;function a(...l){const c=e.length>l.length;let u;c&&l.push(i);try{u=e.apply(this,l)}catch(h){const m=h;if(c&&n)throw m;return i(m)}c||(u&&u.then&&typeof u.then=="function"?u.then(r,i):u instanceof Error?i(u):r(u))}function i(l,...c){n||(n=!0,t(l,...c))}function r(l){i(null,l)}}const Ni={basename:c4,dirname:u4,extname:d4,join:h4,sep:"/"};function c4(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Jd(e);let n=0,a=-1,i=e.length,r;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(r){n=i+1;break}}else a<0&&(r=!0,a=i+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let l=-1,c=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(r){n=i+1;break}}else l<0&&(r=!0,l=i+1),c>-1&&(e.codePointAt(i)===t.codePointAt(c--)?c<0&&(a=i):(c=-1,a=l));return n===a?a=l:a<0&&(a=e.length),e.slice(n,a)}function u4(e){if(Jd(e),e.length===0)return".";let t=-1,n=e.length,a;for(;--n;)if(e.codePointAt(n)===47){if(a){t=n;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function d4(e){Jd(e);let t=e.length,n=-1,a=0,i=-1,r=0,l;for(;t--;){const c=e.codePointAt(t);if(c===47){if(l){a=t+1;break}continue}n<0&&(l=!0,n=t+1),c===46?i<0?i=t:r!==1&&(r=1):i>-1&&(r=-1)}return i<0||n<0||r===0||r===1&&i===n-1&&i===a+1?"":e.slice(i,n)}function h4(...e){let t=-1,n;for(;++t<e.length;)Jd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":f4(n)}function f4(e){Jd(e);const t=e.codePointAt(0)===47;let n=p4(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function p4(e,t){let n="",a=0,i=-1,r=0,l=-1,c,u;for(;++l<=e.length;){if(l<e.length)c=e.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(i===l-1||r===1))if(i!==l-1&&r===2){if(n.length<2||a!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",a=0):(n=n.slice(0,u),a=n.length-1-n.lastIndexOf("/")),i=l,r=0;continue}}else if(n.length>0){n="",a=0,i=l,r=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),a=l-i-1;i=l,r=0}else c===46&&r>-1?r++:r=-1}return n}function Jd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const m4={cwd:g4};function g4(){return"/"}function Uv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function y4(e){if(typeof e=="string")e=new URL(e);else if(!Uv(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return v4(e)}function v4(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const a=t.codePointAt(n+2);if(a===70||a===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const ky=["history","path","basename","stem","extname","dirname"];class TC{constructor(t){let n;t?Uv(t)?n={path:t}:typeof t=="string"||x4(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":m4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<ky.length;){const r=ky[a];r in n&&n[r]!==void 0&&n[r]!==null&&(this[r]=r==="history"?[...n[r]]:n[r])}let i;for(i in n)ky.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ni.basename(this.path):void 0}set basename(t){My(t,"basename"),Cy(t,"basename"),this.path=Ni.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ni.dirname(this.path):void 0}set dirname(t){m2(this.basename,"dirname"),this.path=Ni.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ni.extname(this.path):void 0}set extname(t){if(Cy(t,"extname"),m2(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ni.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Uv(t)&&(t=y4(t)),My(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ni.basename(this.path,this.extname):void 0}set stem(t){My(t,"stem"),Cy(t,"stem"),this.path=Ni.join(this.dirname||"",t+(this.extname||""))}fail(t,n,a){const i=this.message(t,n,a);throw i.fatal=!0,i}info(t,n,a){const i=this.message(t,n,a);return i.fatal=void 0,i}message(t,n,a){const i=new $a(t,n,a);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Cy(e,t){if(e&&e.includes(Ni.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ni.sep+"`")}function My(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function m2(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function x4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const b4=(function(e){const t=this.constructor.prototype,n=t[e],a=function(){return n.apply(a,arguments)};return Object.setPrototypeOf(a,t),a}),_4={}.hasOwnProperty;class p0 extends b4{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=o4()}copy(){const t=new p0;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(Ny(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ry("data",this.frozen),this.namespace[t]=n,this):_4.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ry("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const i=n.call(t,...a);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Nf(t),a=this.parser||this.Parser;return jy("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),jy("process",this.parser||this.Parser),Ey("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(r,l){const c=Nf(t),u=a.parse(c);a.run(u,c,function(m,p,g){if(m||!p||!g)return h(m);const v=p,x=a.stringify(v,g);N4(x)?g.value=x:g.result=x,h(m,g)});function h(m,p){m||!p?l(m):r?r(p):n(void 0,p)}}}processSync(t){let n=!1,a;return this.freeze(),jy("processSync",this.parser||this.Parser),Ey("processSync",this.compiler||this.Compiler),this.process(t,i),y2("processSync","process",n),a;function i(r,l){n=!0,f2(r),a=l}}run(t,n,a){g2(t),this.freeze();const i=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?r(void 0,a):new Promise(r);function r(l,c){const u=Nf(n);i.run(t,u,h);function h(m,p,g){const v=p||t;m?c(m):l?l(v):a(void 0,v,g)}}}runSync(t,n){let a=!1,i;return this.run(t,n,r),y2("runSync","run",a),i;function r(l,c){f2(l),i=c,a=!0}}stringify(t,n){this.freeze();const a=Nf(n),i=this.compiler||this.Compiler;return Ey("stringify",i),g2(t),i(t,a)}use(t,...n){const a=this.attachers,i=this.namespace;if(Ry("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function r(h){if(typeof h=="function")u(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[m,...p]=h;u(m,p)}else l(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function l(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(h.plugins),h.settings&&(i.settings=Ny(!0,i.settings,h.settings))}function c(h){let m=-1;if(h!=null)if(Array.isArray(h))for(;++m<h.length;){const p=h[m];r(p)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function u(h,m){let p=-1,g=-1;for(;++p<a.length;)if(a[p][0]===h){g=p;break}if(g===-1)a.push([h,...m]);else if(m.length>0){let[v,...x]=m;const b=a[g][1];$v(b)&&$v(v)&&(v=Ny(!0,b,v)),a[g]=[h,v,...x]}}}}const w4=new p0().freeze();function jy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ey(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ry(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function g2(e){if(!$v(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function y2(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Nf(e){return S4(e)?e:new TC(e)}function S4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function N4(e){return typeof e=="string"||k4(e)}function k4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const C4="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",v2=[],x2={allowDangerousHtml:!0},M4=/^(https?|ircs?|mailto|xmpp)$/i,j4=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function E4(e){const t=R4(e),n=L4(e);return T4(t.runSync(t.parse(n),n),e)}function R4(e){const t=e.rehypePlugins||v2,n=e.remarkPlugins||v2,a=e.remarkRehypeOptions?$($({},e.remarkRehypeOptions),x2):x2;return w4().use(lO).use(n).use(s4,a).use(t)}function L4(e){const t=e.children||"",n=new TC;return typeof t=="string"&&(n.value=t),n}function T4(e,t){const n=t.allowedElements,a=t.allowElement,i=t.components,r=t.disallowedElements,l=t.skipHtml,c=t.unwrapDisallowed,u=t.urlTransform||A4;for(const m of j4)Object.hasOwn(t,m.from)&&""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+C4+m.id;return f0(e,h),VI(e,{Fragment:f.Fragment,components:i,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function h(m,p,g){if(m.type==="raw"&&g&&typeof p=="number")return l?g.children.splice(p,1):g.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let v;for(v in by)if(Object.hasOwn(by,v)&&Object.hasOwn(m.properties,v)){const x=m.properties[v],b=by[v];(b===null||b.includes(m.tagName))&&(m.properties[v]=u(String(x||""),v,m))}}if(m.type==="element"){let v=n?!n.includes(m.tagName):r?r.includes(m.tagName):!1;if(!v&&a&&typeof p=="number"&&(v=!a(m,p,g)),v&&g&&typeof p=="number")return c&&m.children?g.children.splice(p,1,...m.children):g.children.splice(p,1),p}}}function A4(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||a!==-1&&t>a||M4.test(e.slice(0,t))?e:""}function b2(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,i=n.indexOf(t);for(;i!==-1;)a++,i=n.indexOf(t,i+t.length);return a}function I4(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function D4(e,t,n){const a=Up((n||{}).ignore||[]),i=O4(t);let r=-1;for(;++r<i.length;)LC(e,"text",l);function l(u,h){let m=-1,p;for(;++m<h.length;){const g=h[m],v=p?p.children:void 0;if(a(g,v?v.indexOf(g):void 0,p))return;p=g}if(p)return c(u,h)}function c(u,h){const m=h[h.length-1],p=i[r][0],g=i[r][1];let v=0;const x=m.children.indexOf(u);let b=!1,_=[];p.lastIndex=0;let S=p.exec(u.value);for(;S;){const M=S.index,C={index:S.index,input:S.input,stack:[...h,u]};let k=g(...S,C);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?p.lastIndex=M+1:(v!==M&&_.push({type:"text",value:u.value.slice(v,M)}),Array.isArray(k)?_.push(...k):k&&_.push(k),v=M+S[0].length,b=!0),!p.global)break;S=p.exec(u.value)}return b?(v<u.value.length&&_.push({type:"text",value:u.value.slice(v)}),m.children.splice(x,1,..._)):_=[u],x+_.length}}function O4(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<n.length;){const i=n[a];t.push([z4(i[0]),B4(i[1])])}return t}function z4(e){return typeof e=="string"?new RegExp(I4(e),"g"):e}function B4(e){return typeof e=="function"?e:function(){return e}}const Ly="phrasing",Ty=["autolink","link","image","label"];function $4(){return{transforms:[Y4],enter:{literalAutolink:F4,literalAutolinkEmail:Ay,literalAutolinkHttp:Ay,literalAutolinkWww:Ay},exit:{literalAutolink:V4,literalAutolinkEmail:q4,literalAutolinkHttp:P4,literalAutolinkWww:H4}}}function U4(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ly,notInConstruct:Ty},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ly,notInConstruct:Ty},{character:":",before:"[ps]",after:"\\/",inConstruct:Ly,notInConstruct:Ty}]}}function F4(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ay(e){this.config.enter.autolinkProtocol.call(this,e)}function P4(e){this.config.exit.autolinkProtocol.call(this,e)}function H4(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function q4(e){this.config.exit.autolinkEmail.call(this,e)}function V4(e){this.exit(e)}function Y4(e){D4(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,G4],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),K4]],{ignore:["link","linkReference"]})}function G4(e,t,n,a,i){let r="";if(!AC(i)||(/^w/i.test(t)&&(n=t+n,t="",r="http://"),!Q4(n)))return!1;const l=X4(n+a);if(!l[0])return!1;const c={type:"link",title:null,url:r+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[c,{type:"text",value:l[1]}]:c}function K4(e,t,n,a){return!AC(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Q4(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function X4(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const i=b2(e,"(");let r=b2(e,")");for(;a!==-1&&i>r;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),r++;return[e,n]}function AC(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||yl(n)||zp(n))&&(!t||n!==47)}IC.peek=i6;function Z4(){this.buffer()}function J4(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function W4(){this.buffer()}function e6(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function t6(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ui(this.sliceSerialize(e)).toLowerCase(),n.label=t}function n6(e){this.exit(e)}function a6(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ui(this.sliceSerialize(e)).toLowerCase(),n.label=t}function s6(e){this.exit(e)}function i6(){return"["}function IC(e,t,n,a){const i=n.createTracker(a);let r=i.move("[^");const l=n.enter("footnoteReference"),c=n.enter("reference");return r+=i.move(n.safe(n.associationId(e),{after:"]",before:r})),c(),l(),r+=i.move("]"),r}function r6(){return{enter:{gfmFootnoteCallString:Z4,gfmFootnoteCall:J4,gfmFootnoteDefinitionLabelString:W4,gfmFootnoteDefinition:e6},exit:{gfmFootnoteCallString:t6,gfmFootnoteCall:n6,gfmFootnoteDefinitionLabelString:a6,gfmFootnoteDefinition:s6}}}function o6(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:IC},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,i,r,l){const c=r.createTracker(l);let u=c.move("[^");const h=r.enter("footnoteDefinition"),m=r.enter("label");return u+=c.move(r.safe(r.associationId(a),{before:u,after:"]"})),m(),u+=c.move("]:"),a.children&&a.children.length>0&&(c.shift(4),u+=c.move((t?`
|
|
63
|
+
`:" ")+r.indentLines(r.containerFlow(a,c.current()),t?DC:l6))),h(),u}}function l6(e,t,n){return t===0?e:DC(e,t,n)}function DC(e,t,n){return(n?"":" ")+e}const c6=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];OC.peek=p6;function u6(){return{canContainEols:["delete"],enter:{strikethrough:h6},exit:{strikethrough:f6}}}function d6(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:c6}],handlers:{delete:OC}}}function h6(e){this.enter({type:"delete",children:[]},e)}function f6(e){this.exit(e)}function OC(e,t,n,a){const i=n.createTracker(a),r=n.enter("strikethrough");let l=i.move("~~");return l+=n.containerPhrasing(e,ee($({},i.current()),{before:l,after:"~"})),l+=i.move("~~"),r(),l}function p6(){return"~"}function m6(e){return e.length}function g6(e,t){const n=t||{},a=(n.align||[]).concat(),i=n.stringLength||m6,r=[],l=[],c=[],u=[];let h=0,m=-1;for(;++m<e.length;){const b=[],_=[];let S=-1;for(e[m].length>h&&(h=e[m].length);++S<e[m].length;){const M=y6(e[m][S]);if(n.alignDelimiters!==!1){const C=i(M);_[S]=C,(u[S]===void 0||C>u[S])&&(u[S]=C)}b.push(M)}l[m]=b,c[m]=_}let p=-1;if(typeof a=="object"&&"length"in a)for(;++p<h;)r[p]=_2(a[p]);else{const b=_2(a);for(;++p<h;)r[p]=b}p=-1;const g=[],v=[];for(;++p<h;){const b=r[p];let _="",S="";b===99?(_=":",S=":"):b===108?_=":":b===114&&(S=":");let M=n.alignDelimiters===!1?1:Math.max(1,u[p]-_.length-S.length);const C=_+"-".repeat(M)+S;n.alignDelimiters!==!1&&(M=_.length+M+S.length,M>u[p]&&(u[p]=M),v[p]=M),g[p]=C}l.splice(1,0,g),c.splice(1,0,v),m=-1;const x=[];for(;++m<l.length;){const b=l[m],_=c[m];p=-1;const S=[];for(;++p<h;){const M=b[p]||"";let C="",k="";if(n.alignDelimiters!==!1){const L=u[p]-(_[p]||0),E=r[p];E===114?C=" ".repeat(L):E===99?L%2?(C=" ".repeat(L/2+.5),k=" ".repeat(L/2-.5)):(C=" ".repeat(L/2),k=C):k=" ".repeat(L)}n.delimiterStart!==!1&&!p&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&M==="")&&(n.delimiterStart!==!1||p)&&S.push(" "),n.alignDelimiters!==!1&&S.push(C),S.push(M),n.alignDelimiters!==!1&&S.push(k),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||p!==h-1)&&S.push("|")}x.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return x.join(`
|
|
64
|
+
`)}function y6(e){return e==null?"":String(e)}function _2(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function v6(e,t,n,a){const i=n.enter("blockquote"),r=n.createTracker(a);r.move("> "),r.shift(2);const l=n.indentLines(n.containerFlow(e,r.current()),x6);return i(),l}function x6(e,t,n){return">"+(n?"":" ")+e}function b6(e,t){return w2(e,t.inConstruct,!0)&&!w2(e,t.notInConstruct,!1)}function w2(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function S2(e,t,n,a){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
65
|
+
`&&b6(n.stack,n.unsafe[i]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
66
|
+
`}function _6(e,t){const n=String(e);let a=n.indexOf(t),i=a,r=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===i?++r>l&&(l=r):r=1,i=a+t.length,a=n.indexOf(t,i);return l}function w6(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function S6(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function N6(e,t,n,a){const i=S6(n),r=e.value||"",l=i==="`"?"GraveAccent":"Tilde";if(w6(e,n)){const p=n.enter("codeIndented"),g=n.indentLines(r,k6);return p(),g}const c=n.createTracker(a),u=i.repeat(Math.max(_6(r,i)+1,3)),h=n.enter("codeFenced");let m=c.move(u);if(e.lang){const p=n.enter(`codeFencedLang${l}`);m+=c.move(n.safe(e.lang,$({before:m,after:" ",encode:["`"]},c.current()))),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${l}`);m+=c.move(" "),m+=c.move(n.safe(e.meta,$({before:m,after:`
|
|
67
|
+
`,encode:["`"]},c.current()))),p()}return m+=c.move(`
|
|
68
|
+
`),r&&(m+=c.move(r+`
|
|
69
|
+
`)),m+=c.move(u),h(),m}function k6(e,t,n){return(n?"":" ")+e}function m0(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function C6(e,t,n,a){const i=m0(n),r=i==='"'?"Quote":"Apostrophe",l=n.enter("definition");let c=n.enter("label");const u=n.createTracker(a);let h=u.move("[");return h+=u.move(n.safe(n.associationId(e),$({before:h,after:"]"},u.current()))),h+=u.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),h+=u.move("<"),h+=u.move(n.safe(e.url,$({before:h,after:">"},u.current()))),h+=u.move(">")):(c=n.enter("destinationRaw"),h+=u.move(n.safe(e.url,$({before:h,after:e.title?" ":`
|
|
70
|
+
`},u.current())))),c(),e.title&&(c=n.enter(`title${r}`),h+=u.move(" "+i),h+=u.move(n.safe(e.title,$({before:h,after:i},u.current()))),h+=u.move(i),c()),l(),h}function M6(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Dd(e){return"&#x"+e.toString(16).toUpperCase()+";"}function pp(e,t,n){const a=Gc(e),i=Gc(t);return a===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}zC.peek=j6;function zC(e,t,n,a){const i=M6(n),r=n.enter("emphasis"),l=n.createTracker(a),c=l.move(i);let u=l.move(n.containerPhrasing(e,$({after:i,before:c},l.current())));const h=u.charCodeAt(0),m=pp(a.before.charCodeAt(a.before.length-1),h,i);m.inside&&(u=Dd(h)+u.slice(1));const p=u.charCodeAt(u.length-1),g=pp(a.after.charCodeAt(0),p,i);g.inside&&(u=u.slice(0,-1)+Dd(p));const v=l.move(i);return r(),n.attentionEncodeSurroundingInfo={after:g.outside,before:m.outside},c+u+v}function j6(e,t,n){return n.options.emphasis||"*"}function E6(e,t){let n=!1;return f0(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,zv}),!!((!e.depth||e.depth<3)&&r0(e)&&(t.options.setext||n))}function R6(e,t,n,a){const i=Math.max(Math.min(6,e.depth||1),1),r=n.createTracker(a);if(E6(e,n)){const m=n.enter("headingSetext"),p=n.enter("phrasing"),g=n.containerPhrasing(e,ee($({},r.current()),{before:`
|
|
71
|
+
`,after:`
|
|
72
|
+
`}));return p(),m(),g+`
|
|
73
|
+
`+(i===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
|
|
74
|
+
`))+1))}const l="#".repeat(i),c=n.enter("headingAtx"),u=n.enter("phrasing");r.move(l+" ");let h=n.containerPhrasing(e,$({before:"# ",after:`
|
|
75
|
+
`},r.current()));return/^[\t ]/.test(h)&&(h=Dd(h.charCodeAt(0))+h.slice(1)),h=h?l+" "+h:l,n.options.closeAtx&&(h+=" "+l),u(),c(),h}BC.peek=L6;function BC(e){return e.value||""}function L6(){return"<"}$C.peek=T6;function $C(e,t,n,a){const i=m0(n),r=i==='"'?"Quote":"Apostrophe",l=n.enter("image");let c=n.enter("label");const u=n.createTracker(a);let h=u.move("![");return h+=u.move(n.safe(e.alt,$({before:h,after:"]"},u.current()))),h+=u.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),h+=u.move("<"),h+=u.move(n.safe(e.url,$({before:h,after:">"},u.current()))),h+=u.move(">")):(c=n.enter("destinationRaw"),h+=u.move(n.safe(e.url,$({before:h,after:e.title?" ":")"},u.current())))),c(),e.title&&(c=n.enter(`title${r}`),h+=u.move(" "+i),h+=u.move(n.safe(e.title,$({before:h,after:i},u.current()))),h+=u.move(i),c()),h+=u.move(")"),l(),h}function T6(){return"!"}UC.peek=A6;function UC(e,t,n,a){const i=e.referenceType,r=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(a);let u=c.move("![");const h=n.safe(e.alt,$({before:u,after:"]"},c.current()));u+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),$({before:u,after:"]"},c.current()));return l(),n.stack=m,r(),i==="full"||!h||h!==p?u+=c.move(p+"]"):i==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function A6(){return"!"}FC.peek=I6;function FC(e,t,n){let a=e.value||"",i="`",r=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(a);)i+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++r<n.unsafe.length;){const l=n.unsafe[r],c=n.compilePattern(l);let u;if(l.atBreak)for(;u=c.exec(a);){let h=u.index;a.charCodeAt(h)===10&&a.charCodeAt(h-1)===13&&h--,a=a.slice(0,h)+" "+a.slice(u.index+1)}}return i+a+i}function I6(){return"`"}function PC(e,t){const n=r0(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}HC.peek=D6;function HC(e,t,n,a){const i=m0(n),r=i==='"'?"Quote":"Apostrophe",l=n.createTracker(a);let c,u;if(PC(e,n)){const m=n.stack;n.stack=[],c=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(e,$({before:p,after:">"},l.current()))),p+=l.move(">"),c(),n.stack=m,p}c=n.enter("link"),u=n.enter("label");let h=l.move("[");return h+=l.move(n.containerPhrasing(e,$({before:h,after:"]("},l.current()))),h+=l.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(n.safe(e.url,$({before:h,after:">"},l.current()))),h+=l.move(">")):(u=n.enter("destinationRaw"),h+=l.move(n.safe(e.url,$({before:h,after:e.title?" ":")"},l.current())))),u(),e.title&&(u=n.enter(`title${r}`),h+=l.move(" "+i),h+=l.move(n.safe(e.title,$({before:h,after:i},l.current()))),h+=l.move(i),u()),h+=l.move(")"),c(),h}function D6(e,t,n){return PC(e,n)?"<":"["}qC.peek=O6;function qC(e,t,n,a){const i=e.referenceType,r=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(a);let u=c.move("[");const h=n.containerPhrasing(e,$({before:u,after:"]"},c.current()));u+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),$({before:u,after:"]"},c.current()));return l(),n.stack=m,r(),i==="full"||!h||h!==p?u+=c.move(p+"]"):i==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function O6(){return"["}function g0(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function z6(e){const t=g0(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function B6(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function VC(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function $6(e,t,n,a){const i=n.enter("list"),r=n.bulletCurrent;let l=e.ordered?B6(n):g0(n);const c=e.ordered?l==="."?")":".":z6(n);let u=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),VC(n)===l&&m){let p=-1;for(;++p<e.children.length;){const g=e.children[p];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(l=c),n.bulletCurrent=l;const h=n.containerFlow(e,a);return n.bulletLastUsed=l,n.bulletCurrent=r,i(),h}function U6(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function F6(e,t,n,a){const i=U6(n);let r=n.bulletCurrent||g0(n);t&&t.type==="list"&&t.ordered&&(r=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+r);let l=r.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(a);c.move(r+" ".repeat(l-r.length)),c.shift(l);const u=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,c.current()),m);return u(),h;function m(p,g,v){return g?(v?"":" ".repeat(l))+p:(v?r:r+" ".repeat(l-r.length))+p}}function P6(e,t,n,a){const i=n.enter("paragraph"),r=n.enter("phrasing"),l=n.containerPhrasing(e,a);return r(),i(),l}const H6=Up(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function q6(e,t,n,a){return(e.children.some(function(i){return H6(i)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function V6(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}YC.peek=Y6;function YC(e,t,n,a){const i=V6(n),r=n.enter("strong"),l=n.createTracker(a),c=l.move(i+i);let u=l.move(n.containerPhrasing(e,$({after:i,before:c},l.current())));const h=u.charCodeAt(0),m=pp(a.before.charCodeAt(a.before.length-1),h,i);m.inside&&(u=Dd(h)+u.slice(1));const p=u.charCodeAt(u.length-1),g=pp(a.after.charCodeAt(0),p,i);g.inside&&(u=u.slice(0,-1)+Dd(p));const v=l.move(i+i);return r(),n.attentionEncodeSurroundingInfo={after:g.outside,before:m.outside},c+u+v}function Y6(e,t,n){return n.options.strong||"*"}function G6(e,t,n,a){return n.safe(e.value,a)}function K6(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Q6(e,t,n){const a=(VC(n)+(n.options.ruleSpaces?" ":"")).repeat(K6(n));return n.options.ruleSpaces?a.slice(0,-1):a}const GC={blockquote:v6,break:S2,code:N6,definition:C6,emphasis:zC,hardBreak:S2,heading:R6,html:BC,image:$C,imageReference:UC,inlineCode:FC,link:HC,linkReference:qC,list:$6,listItem:F6,paragraph:P6,root:q6,strong:YC,text:G6,thematicBreak:Q6};function X6(){return{enter:{table:Z6,tableData:N2,tableHeader:N2,tableRow:W6},exit:{codeText:ez,table:J6,tableData:Iy,tableHeader:Iy,tableRow:Iy}}}function Z6(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function J6(e){this.exit(e),this.data.inTable=void 0}function W6(e){this.enter({type:"tableRow",children:[]},e)}function Iy(e){this.exit(e)}function N2(e){this.enter({type:"tableCell",children:[]},e)}function ez(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,tz));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function tz(e,t){return t==="|"?t:e}function nz(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,i=t.stringLength,r=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
76
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:l,tableCell:u,tableRow:c}};function l(v,x,b,_){return h(m(v,b,_),v.align)}function c(v,x,b,_){const S=p(v,b,_),M=h([S]);return M.slice(0,M.indexOf(`
|
|
77
|
+
`))}function u(v,x,b,_){const S=b.enter("tableCell"),M=b.enter("phrasing"),C=b.containerPhrasing(v,ee($({},_),{before:r,after:r}));return M(),S(),C}function h(v,x){return g6(v,{align:x,alignDelimiters:a,padding:n,stringLength:i})}function m(v,x,b){const _=v.children;let S=-1;const M=[],C=x.enter("table");for(;++S<_.length;)M[S]=p(_[S],x,b);return C(),M}function p(v,x,b){const _=v.children;let S=-1;const M=[],C=x.enter("tableRow");for(;++S<_.length;)M[S]=u(_[S],v,x,b);return C(),M}function g(v,x,b){let _=GC.inlineCode(v,x,b);return b.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function az(){return{exit:{taskListCheckValueChecked:k2,taskListCheckValueUnchecked:k2,paragraph:iz}}}function sz(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:rz}}}function k2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function iz(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const a=n.children[0];if(a&&a.type==="text"){const i=t.children;let r=-1,l;for(;++r<i.length;){const c=i[r];if(c.type==="paragraph"){l=c;break}}l===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function rz(e,t,n,a){const i=e.children[0],r=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",c=n.createTracker(a);r&&c.move(l);let u=GC.listItem(e,t,n,$($({},a),c.current()));return r&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),u;function h(m){return m+l}}function oz(){return[$4(),r6(),u6(),X6(),az()]}function lz(e){return{extensions:[U4(),o6(e),d6(),nz(e),sz()]}}const cz={tokenize:mz,partial:!0},KC={tokenize:gz,partial:!0},QC={tokenize:yz,partial:!0},XC={tokenize:vz,partial:!0},uz={tokenize:xz,partial:!0},ZC={name:"wwwAutolink",tokenize:fz,previous:WC},JC={name:"protocolAutolink",tokenize:pz,previous:eM},hr={name:"emailAutolink",tokenize:hz,previous:tM},Ri={};function dz(){return{text:Ri}}let Ho=48;for(;Ho<123;)Ri[Ho]=hr,Ho++,Ho===58?Ho=65:Ho===91&&(Ho=97);Ri[43]=hr;Ri[45]=hr;Ri[46]=hr;Ri[95]=hr;Ri[72]=[hr,JC];Ri[104]=[hr,JC];Ri[87]=[hr,ZC];Ri[119]=[hr,ZC];function hz(e,t,n){const a=this;let i,r;return l;function l(p){return!Fv(p)||!tM.call(a,a.previous)||y0(a.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(p))}function c(p){return Fv(p)?(e.consume(p),c):p===64?(e.consume(p),u):n(p)}function u(p){return p===46?e.check(uz,m,h)(p):p===45||p===95||Ba(p)?(r=!0,e.consume(p),u):m(p)}function h(p){return e.consume(p),i=!0,u}function m(p){return r&&i&&Qa(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function fz(e,t,n){const a=this;return i;function i(l){return l!==87&&l!==119||!WC.call(a,a.previous)||y0(a.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(cz,e.attempt(KC,e.attempt(QC,r),n),n)(l))}function r(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function pz(e,t,n){const a=this;let i="",r=!1;return l;function l(p){return(p===72||p===104)&&eM.call(a,a.previous)&&!y0(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(p),e.consume(p),c):n(p)}function c(p){if(Qa(p)&&i.length<5)return i+=String.fromCodePoint(p),e.consume(p),c;if(p===58){const g=i.toLowerCase();if(g==="http"||g==="https")return e.consume(p),u}return n(p)}function u(p){return p===47?(e.consume(p),r?h:(r=!0,u)):n(p)}function h(p){return p===null||dp(p)||bn(p)||yl(p)||zp(p)?n(p):e.attempt(KC,e.attempt(QC,m),n)(p)}function m(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function mz(e,t,n){let a=0;return i;function i(l){return(l===87||l===119)&&a<3?(a++,e.consume(l),i):l===46&&a===3?(e.consume(l),r):n(l)}function r(l){return l===null?n(l):t(l)}}function gz(e,t,n){let a,i,r;return l;function l(h){return h===46||h===95?e.check(XC,u,c)(h):h===null||bn(h)||yl(h)||h!==45&&zp(h)?u(h):(r=!0,e.consume(h),l)}function c(h){return h===95?a=!0:(i=a,a=void 0),e.consume(h),l}function u(h){return i||a||!r?n(h):t(h)}}function yz(e,t){let n=0,a=0;return i;function i(l){return l===40?(n++,e.consume(l),i):l===41&&a<n?r(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(XC,t,r)(l):l===null||bn(l)||yl(l)?t(l):(e.consume(l),i)}function r(l){return l===41&&a++,e.consume(l),i}}function vz(e,t,n){return a;function a(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),a):c===38?(e.consume(c),r):c===93?(e.consume(c),i):c===60||c===null||bn(c)||yl(c)?t(c):n(c)}function i(c){return c===null||c===40||c===91||bn(c)||yl(c)?t(c):a(c)}function r(c){return Qa(c)?l(c):n(c)}function l(c){return c===59?(e.consume(c),a):Qa(c)?(e.consume(c),l):n(c)}}function xz(e,t,n){return a;function a(r){return e.consume(r),i}function i(r){return Ba(r)?n(r):t(r)}}function WC(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||bn(e)}function eM(e){return!Qa(e)}function tM(e){return!(e===47||Fv(e))}function Fv(e){return e===43||e===45||e===46||e===95||Ba(e)}function y0(e){let t=e.length,n=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){n=!0;break}if(a._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const bz={tokenize:jz,partial:!0};function _z(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:kz,continuation:{tokenize:Cz},exit:Mz}},text:{91:{name:"gfmFootnoteCall",tokenize:Nz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:wz,resolveTo:Sz}}}}function wz(e,t,n){const a=this;let i=a.events.length;const r=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l;for(;i--;){const u=a.events[i][1];if(u.type==="labelImage"){l=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return c;function c(u){if(!l||!l._balanced)return n(u);const h=ui(a.sliceSerialize({start:l.end,end:a.now()}));return h.codePointAt(0)!==94||!r.includes(h.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function Sz(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const r={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},r.start),end:Object.assign({},r.end)},c=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",r,t],["enter",l,t],["exit",l,t],["exit",r,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...c),e}function Nz(e,t,n){const a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let r=0,l;return c;function c(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),u}function u(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(p){if(r>999||p===93&&!l||p===null||p===91||bn(p))return n(p);if(p===93){e.exit("chunkString");const g=e.exit("gfmFootnoteCallString");return i.includes(ui(a.sliceSerialize(g)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return bn(p)||(l=!0),r++,e.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(e.consume(p),r++,h):h(p)}}function kz(e,t,n){const a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let r,l=0,c;return u;function u(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(x)}function m(x){if(l>999||x===93&&!c||x===null||x===91||bn(x))return n(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return r=ui(a.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),g}return bn(x)||(c=!0),l++,e.consume(x),x===92?p:m}function p(x){return x===91||x===92||x===93?(e.consume(x),l++,m):m(x)}function g(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),i.includes(r)||i.push(r),Qt(e,v,"gfmFootnoteDefinitionWhitespace")):n(x)}function v(x){return t(x)}}function Cz(e,t,n){return e.check(Zd,t,e.attempt(bz,t,n))}function Mz(e){e.exit("gfmFootnoteDefinition")}function jz(e,t,n){const a=this;return Qt(e,i,"gfmFootnoteDefinitionIndent",5);function i(r){const l=a.events[a.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(r):n(r)}}function Ez(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:i,resolveAll:a};return t==null&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function a(r,l){let c=-1;for(;++c<r.length;)if(r[c][0]==="enter"&&r[c][1].type==="strikethroughSequenceTemporary"&&r[c][1]._close){let u=c;for(;u--;)if(r[u][0]==="exit"&&r[u][1].type==="strikethroughSequenceTemporary"&&r[u][1]._open&&r[c][1].end.offset-r[c][1].start.offset===r[u][1].end.offset-r[u][1].start.offset){r[c][1].type="strikethroughSequence",r[u][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},r[u][1].start),end:Object.assign({},r[c][1].end)},m={type:"strikethroughText",start:Object.assign({},r[u][1].end),end:Object.assign({},r[c][1].start)},p=[["enter",h,l],["enter",r[u][1],l],["exit",r[u][1],l],["enter",m,l]],g=l.parser.constructs.insideSpan.null;g&&Rs(p,p.length,0,Bp(g,r.slice(u+1,c),l)),Rs(p,p.length,0,[["exit",m,l],["enter",r[c][1],l],["exit",r[c][1],l],["exit",h,l]]),Rs(r,u-1,c-u+3,p),c=u+p.length-2;break}}for(c=-1;++c<r.length;)r[c][1].type==="strikethroughSequenceTemporary"&&(r[c][1].type="data");return r}function i(r,l,c){const u=this.previous,h=this.events;let m=0;return p;function p(v){return u===126&&h[h.length-1][1].type!=="characterEscape"?c(v):(r.enter("strikethroughSequenceTemporary"),g(v))}function g(v){const x=Gc(u);if(v===126)return m>1?c(v):(r.consume(v),m++,g);if(m<2&&!t)return c(v);const b=r.exit("strikethroughSequenceTemporary"),_=Gc(v);return b._open=!_||_===2&&!!x,b._close=!x||x===2&&!!_,l(v)}}}class Rz{constructor(){this.map=[],this.index=new Map}add(t,n,a){Lz(this,t,n,a)}consume(t){if(this.map.sort(function(r,l){return r[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let i=a.pop();for(;i;){for(const r of i)t.push(r);i=a.pop()}this.map.length=0,this.index.clear()}}function Lz(e,t,n,a){if(n===0&&a.length===0)return;const i=e.index.get(t);if(i){i[1]+=n,i[2].push(...a);return}const r=[t,n,a];e.map.push(r),e.index.set(t,r)}function Tz(e,t){let n=!1;const a=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const r=a.length-1;a[r]=a[r]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function Az(){return{flow:{null:{name:"table",tokenize:Iz,resolveAll:Dz}}}}function Iz(e,t,n){const a=this;let i=0,r=0,l;return c;function c(R){let D=a.events.length-1;for(;D>-1;){const{type:z}=a.events[D][1];if(z==="lineEnding"||z==="linePrefix")D--;else break}const O=D>-1?a.events[D][1].type:null,B=O==="tableHead"||O==="tableRow"?E:u;return B===E&&a.parser.lazy[a.now().line]?n(R):B(R)}function u(R){return e.enter("tableHead"),e.enter("tableRow"),h(R)}function h(R){return R===124||(l=!0,r+=1),m(R)}function m(R){return R===null?n(R):bt(R)?r>1?(r=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),v):n(R):Ft(R)?Qt(e,m,"whitespace")(R):(r+=1,l&&(l=!1,i+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),l=!0,m):(e.enter("data"),p(R)))}function p(R){return R===null||R===124||bn(R)?(e.exit("data"),m(R)):(e.consume(R),R===92?g:p)}function g(R){return R===92||R===124?(e.consume(R),p):p(R)}function v(R){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(R):(e.enter("tableDelimiterRow"),l=!1,Ft(R)?Qt(e,x,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):x(R))}function x(R){return R===45||R===58?_(R):R===124?(l=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),b):L(R)}function b(R){return Ft(R)?Qt(e,_,"whitespace")(R):_(R)}function _(R){return R===58?(r+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),S):R===45?(r+=1,S(R)):R===null||bt(R)?k(R):L(R)}function S(R){return R===45?(e.enter("tableDelimiterFiller"),M(R)):L(R)}function M(R){return R===45?(e.consume(R),M):R===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(R))}function C(R){return Ft(R)?Qt(e,k,"whitespace")(R):k(R)}function k(R){return R===124?x(R):R===null||bt(R)?!l||i!==r?L(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):L(R)}function L(R){return n(R)}function E(R){return e.enter("tableRow"),I(R)}function I(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),I):R===null||bt(R)?(e.exit("tableRow"),t(R)):Ft(R)?Qt(e,I,"whitespace")(R):(e.enter("data"),T(R))}function T(R){return R===null||R===124||bn(R)?(e.exit("data"),I(R)):(e.consume(R),R===92?A:T)}function A(R){return R===92||R===124?(e.consume(R),T):T(R)}}function Dz(e,t){let n=-1,a=!0,i=0,r=[0,0,0,0],l=[0,0,0,0],c=!1,u=0,h,m,p;const g=new Rz;for(;++n<e.length;){const v=e[n],x=v[1];v[0]==="enter"?x.type==="tableHead"?(c=!1,u!==0&&(C2(g,t,u,h,m),m=void 0,u=0),h={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},g.add(n,0,[["enter",h,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(a=!0,p=void 0,r=[0,0,0,0],l=[0,n+1,0,0],c&&(c=!1,m={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},g.add(n,0,[["enter",m,t]])),i=x.type==="tableDelimiterRow"?2:m?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(a=!1,l[2]===0&&(r[1]!==0&&(l[0]=l[1],p=kf(g,t,r,i,void 0,p),r=[0,0,0,0]),l[2]=n)):x.type==="tableCellDivider"&&(a?a=!1:(r[1]!==0&&(l[0]=l[1],p=kf(g,t,r,i,void 0,p)),r=l,l=[r[1],n,0,0])):x.type==="tableHead"?(c=!0,u=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(u=n,r[1]!==0?(l[0]=l[1],p=kf(g,t,r,i,n,p)):l[1]!==0&&(p=kf(g,t,l,i,n,p)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(l[3]=n)}for(u!==0&&C2(g,t,u,h,m),g.consume(t.events),n=-1;++n<t.events.length;){const v=t.events[n];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=Tz(t.events,n))}return e}function kf(e,t,n,a,i,r){const l=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(r.end=Object.assign({},wc(t.events,n[0])),e.add(n[0],0,[["exit",r,t]]));const u=wc(t.events,n[1]);if(r={type:l,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",r,t]]),n[2]!==0){const h=wc(t.events,n[2]),m=wc(t.events,n[3]),p={type:c,start:Object.assign({},h),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",p,t]]),a!==2){const g=t.events[n[2]],v=t.events[n[3]];if(g[1].end=Object.assign({},v[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,b=n[3]-n[2]-1;e.add(x,b,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return i!==void 0&&(r.end=Object.assign({},wc(t.events,i)),e.add(i,0,[["exit",r,t]]),r=void 0),r}function C2(e,t,n,a,i){const r=[],l=wc(t.events,n);i&&(i.end=Object.assign({},l),r.push(["exit",i,t])),a.end=Object.assign({},l),r.push(["exit",a,t]),e.add(n+1,0,r)}function wc(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const Oz={name:"tasklistCheck",tokenize:Bz};function zz(){return{text:{91:Oz}}}function Bz(e,t,n){const a=this;return i;function i(u){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),r)}function r(u){return bn(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),l):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),l):n(u)}function l(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(u)}function c(u){return bt(u)?t(u):Ft(u)?e.check({tokenize:$z},t,n)(u):n(u)}}function $z(e,t,n){return Qt(e,a,"whitespace");function a(i){return i===null?n(i):t(i)}}function Uz(e){return dC([dz(),_z(),Ez(e),Az(),zz()])}const Fz={};function Pz(e){const t=this,n=e||Fz,a=t.data(),i=a.micromarkExtensions||(a.micromarkExtensions=[]),r=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);i.push(Uz(n)),r.push(oz()),l.push(lz(n))}const nM=j.memo(({content:e,isStreaming:t=!1,className:n,syntaxHighlighter:a})=>{const i=j.useMemo(()=>({p:({children:l})=>f.jsx("p",{className:"chat-markdown__p",children:l}),h1:({children:l})=>f.jsx("h1",{className:"chat-markdown__h1",children:l}),h2:({children:l})=>f.jsx("h2",{className:"chat-markdown__h2",children:l}),h3:({children:l})=>f.jsx("h3",{className:"chat-markdown__h3",children:l}),ul:({children:l})=>f.jsx("ul",{className:"chat-markdown__ul",children:l}),ol:({children:l})=>f.jsx("ol",{className:"chat-markdown__ol",children:l}),li:({children:l})=>f.jsx("li",{className:"chat-markdown__li",children:l}),blockquote:({children:l})=>f.jsx("blockquote",{className:"chat-markdown__blockquote",children:l}),a:({children:l,href:c})=>f.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"chat-markdown__link",children:l}),table:({children:l})=>f.jsx("div",{className:"chat-markdown__table-wrapper",children:f.jsx("table",{className:"chat-markdown__table",children:l})}),thead:({children:l})=>f.jsx("thead",{className:"chat-markdown__thead",children:l}),tbody:({children:l})=>f.jsx("tbody",{className:"chat-markdown__tbody",children:l}),tr:({children:l})=>f.jsx("tr",{className:"chat-markdown__tr",children:l}),th:({children:l})=>f.jsx("th",{className:"chat-markdown__th",children:l}),td:({children:l})=>f.jsx("td",{className:"chat-markdown__td",children:l}),pre:({children:l})=>f.jsx(f.Fragment,{children:l}),code:({children:l,className:c})=>{const u=/language-(\w+)/.exec(c!=null?c:"");if(!u)return f.jsx("code",{className:"chat-markdown__code-inline",children:l});const h=u[1],m=String(l).replace(/\n$/,"");return a?f.jsx(f.Fragment,{children:a(m,h)}):f.jsx("pre",{className:"chat-markdown__pre",children:f.jsx("code",{className:"chat-markdown__code-block",children:l})})},hr:()=>f.jsx("hr",{className:"chat-markdown__hr"}),strong:({children:l})=>f.jsx("strong",{className:"chat-markdown__strong",children:l}),em:({children:l})=>f.jsx("em",{className:"chat-markdown__em",children:l})}),[a]),r=["chat-markdown",t&&"chat-markdown--streaming",n].filter(Boolean).join(" ");return f.jsx("div",{className:r,"aria-busy":t||void 0,children:f.jsx(E4,{remarkPlugins:[Pz],components:i,children:e})})});nM.displayName="ChatMarkdownContent";const Pv=Se.forwardRef((g,p)=>{var v=g,{query:e,onQueryChange:t,results:n=[],onSelect:a,onClear:i,placeholder:r="Search entities...",disabled:l=!1,inputId:c,placement:u="bottom-start",className:h}=v,m=Ie(v,["query","onQueryChange","results","onSelect","onClear","placeholder","disabled","inputId","placement","className"]);const[x,b]=j.useState(!1),_=j.useRef(null),S=j.useRef(null),M=j.useRef(null),C=Se.useId(),k=z=>`${C}-option-${z}`,L=j.useCallback(()=>b(!1),[]),{focusedValue:E,setFocusedValue:I}=Ap({triggerRef:_,panelRef:M,isOpen:x,onClose:L,restoreFocus:!1});j.useEffect(()=>{n.length===0?I(null):n.some(z=>z.id===E)||I(n[0].id)},[n,E,I]),j.useEffect(()=>{if(!x)return;const z=U=>{var F;if(U.key!=="Enter"||!((F=_.current)!=null&&F.contains(U.target)))return;const Y=n.find(X=>X.id===E);Y&&(U.preventDefault(),a(Y),b(!1))};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[x,n,E,a]),j.useImperativeHandle(p,()=>S.current);const T=z=>{l||(t(z.target.value),b(!0))},A=()=>{l||e.length>0&&n.length>0&&b(!0)},R=()=>{var z;i(),b(!1),(z=_.current)==null||z.focus()},D=z=>{a(z),b(!1)},O=x&&n.length>0,B=O&&E?k(E):void 0;return f.jsxs("div",ee($({ref:S,className:["entity-picker",l&&"entity-picker--disabled",h].filter(Boolean).join(" ")},m),{children:[f.jsxs("div",{className:"entity-picker__input-wrapper",children:[f.jsx("input",{ref:_,id:c,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":O,"aria-controls":C,"aria-activedescendant":B,className:"entity-picker__input",placeholder:r,value:e,disabled:l,onChange:T,onFocus:A,"data-testid":"entity-picker-input"}),e&&!l&&f.jsx("button",{type:"button",className:"entity-picker__clear",onClick:R,"aria-label":"Clear search","data-testid":"entity-picker-clear",children:f.jsx(nt,{name:"x",size:16})})]}),O&&f.jsx("div",{ref:M,id:C,role:"listbox",className:`dropdown-panel ${Ip(u)} entity-picker__dropdown`,"data-testid":"entity-picker-dropdown",children:n.map(z=>{const U=z.id===E;return f.jsxs("div",{id:k(z.id),role:"option","aria-selected":U,"data-dropdown-item":z.id,className:["dropdown-item","entity-picker__result",U&&"dropdown-item--focused"].filter(Boolean).join(" "),onMouseEnter:()=>I(z.id),onMouseDown:F=>{F.preventDefault(),D(z)},"data-testid":`entity-picker-result-${z.id}`,children:[z.domain&&z.domainColor&&f.jsx(fs,{variant:z.domainColor,className:"entity-picker__badge",children:z.domain}),f.jsx("span",{className:"dropdown-item__label entity-picker__label",children:z.label})]},z.id)})})]}))});Pv.displayName="EntityPicker";const Hz=Se.forwardRef((p,m)=>{var g=p,{rows:e,onChange:t,datatypeColumn:n=!1,datatypes:a=["string","number","boolean"],disabled:i=!1,keyPlaceholder:r="Key",valuePlaceholder:l="Value",addLabel:c="Add row",className:u}=g,h=Ie(g,["rows","onChange","datatypeColumn","datatypes","disabled","keyPlaceholder","valuePlaceholder","addLabel","className"]);const v=Se.useId(),x=Se.useRef(0),b=(k,L)=>{t(e.map(E=>E.id===k?ee($({},E),{key:L}):E))},_=(k,L)=>{t(e.map(E=>E.id===k?ee($({},E),{value:L}):E))},S=(k,L)=>{t(e.map(E=>E.id===k?ee($({},E),{datatype:L}):E))},M=k=>{t(e.filter(L=>L.id!==k))},C=()=>{const k=$({id:`${v}-${x.current++}`,key:"",value:""},n&&{datatype:"string"});t([...e,k])};return f.jsxs("div",ee($({ref:m,className:["key-value-editor",n&&"key-value-editor--has-datatype",i&&"key-value-editor--disabled",u].filter(Boolean).join(" "),"data-testid":"key-value-editor"},h),{children:[f.jsxs("div",{className:"key-value-editor__table",children:[f.jsxs("div",{className:"key-value-editor__header",children:[f.jsx("div",{className:"key-value-editor__col key-value-editor__col--key",children:"Key"}),f.jsx("div",{className:"key-value-editor__col key-value-editor__col--value",children:"Value"}),n&&f.jsx("div",{className:"key-value-editor__col key-value-editor__col--datatype",children:"Type"}),f.jsx("div",{className:"key-value-editor__col key-value-editor__col--actions"})]}),e.map(k=>f.jsxs("div",{className:"key-value-editor__row","data-testid":`key-value-row-${k.id}`,children:[f.jsx(Ld,{className:"key-value-editor__input",placeholder:r,value:k.key,onChange:L=>b(k.id,L.target.value),disabled:i,"data-testid":`key-input-${k.id}`}),f.jsx(Ld,{className:"key-value-editor__input",placeholder:l,value:k.value,onChange:L=>_(k.id,L.target.value),disabled:i,"data-testid":`value-input-${k.id}`}),n&&f.jsx(cp,{className:"key-value-editor__input key-value-editor__select",value:k.datatype||"string",onChange:L=>S(k.id,L),disabled:i,"data-testid":`datatype-select-${k.id}`,children:a.map(L=>f.jsx(cp.Item,{value:L,children:L},L))}),f.jsx("button",{type:"button",className:"key-value-editor__remove-btn",onClick:()=>M(k.id),"aria-label":"Remove row",disabled:i,"data-testid":`remove-row-${k.id}`,children:f.jsx(nt,{name:"trash",size:16})})]},k.id))]}),f.jsxs(Bn,{variant:"ghost",size:"sm",className:"key-value-editor__add-btn",onClick:C,disabled:i,"data-testid":"add-row-btn",children:[f.jsx(nt,{name:"plus",size:16}),c]})]}))});Hz.displayName="KeyValueEditor";const qz=Se.forwardRef((c,l)=>{var u=c,{items:e,onChange:t,primaryItemId:n,disabled:a=!1,className:i}=u,r=Ie(u,["items","onChange","primaryItemId","disabled","className"]);const h=j.useCallback(p=>{if(p>0){const g=[...e];[g[p-1],g[p]]=[g[p],g[p-1]],t(g)}},[e,t]),m=j.useCallback(p=>{if(p<e.length-1){const g=[...e];[g[p],g[p+1]]=[g[p+1],g[p]],t(g)}},[e,t]);return f.jsx("div",ee($({ref:l,className:["ordered-list",a&&"ordered-list--disabled",i].filter(Boolean).join(" "),role:"list","aria-disabled":a||void 0,"data-testid":"ordered-list"},r),{children:e.map((p,g)=>f.jsxs("div",{className:["ordered-list__item",n===p.id&&"ordered-list__item--primary"].filter(Boolean).join(" "),role:"listitem","data-testid":`ordered-item-${p.id}`,children:[f.jsxs("div",{className:"ordered-list__rank",children:[n===p.id&&f.jsx("div",{className:"ordered-list__primary-badge",title:"Primary item",children:f.jsx(nt,{name:"star",size:10})}),f.jsx("div",{className:"ordered-list__index",children:g+1})]}),f.jsx("span",{className:"ordered-list__label",children:p.label}),f.jsxs("div",{className:"ordered-list__controls",children:[f.jsx(Bn,{variant:"ghost",size:"sm",disabled:a||g===0,onClick:()=>h(g),"aria-label":"Move up","data-testid":`move-up-${p.id}`,children:f.jsx(nt,{name:"arrowUp",size:16})}),f.jsx(Bn,{variant:"ghost",size:"sm",disabled:a||g===e.length-1,onClick:()=>m(g),"aria-label":"Move down","data-testid":`move-down-${p.id}`,children:f.jsx(nt,{name:"arrowDown",size:16})})]})]},p.id))}))});qz.displayName="OrderedList";const Vz=Se.forwardRef((b,x)=>{var _=b,{value:e,onChange:t,sourceResults:n=[],targetResults:a=[],sourceQuery:i,onSourceQueryChange:r,targetQuery:l,onTargetQueryChange:c,predicates:u=["contains","relates to","depends on","is used by"],onSourceClear:h,onTargetClear:m,disabled:p=!1,className:g}=_,v=Ie(_,["value","onChange","sourceResults","targetResults","sourceQuery","onSourceQueryChange","targetQuery","onTargetQueryChange","predicates","onSourceClear","onTargetClear","disabled","className"]);const S=Se.useId(),M=`${S}-source`,C=`${S}-predicate`,k=`${S}-target`,L=Se.useCallback(T=>{t(ee($({},e),{source:T})),r("")},[t,r,e]),E=Se.useCallback(T=>{t(ee($({},e),{target:T})),c("")},[t,c,e]),I=Se.useCallback(T=>{t(ee($({},e),{predicate:T}))},[t,e]);return f.jsxs("div",ee($({ref:x,className:["relationship-builder",g].filter(Boolean).join(" "),"data-testid":"relationship-builder"},v),{children:[f.jsxs("div",{className:"relationship-builder__column",children:[f.jsx("label",{htmlFor:M,className:"relationship-builder__label",children:"Source"}),f.jsx(Pv,{inputId:M,query:i,onQueryChange:r,results:n,onSelect:L,onClear:h,placeholder:"Search source entity...",disabled:p}),e.source&&f.jsxs("div",{className:"relationship-builder__selected","data-testid":"source-selected",children:[e.source.domain&&f.jsx("span",{className:"relationship-builder__domain",children:e.source.domain}),f.jsx("span",{children:e.source.label})]})]}),f.jsxs("div",{className:"relationship-builder__column",children:[f.jsx("label",{htmlFor:C,className:"relationship-builder__label",children:"Predicate"}),f.jsx(cp,{id:C,value:e.predicate,placeholder:"Select relation type...",onChange:I,disabled:p,"data-testid":"predicate-select",children:u.map(T=>f.jsx(cp.Item,{value:T,children:T},T))})]}),f.jsxs("div",{className:"relationship-builder__column",children:[f.jsx("label",{htmlFor:k,className:"relationship-builder__label",children:"Target"}),f.jsx(Pv,{inputId:k,query:l,onQueryChange:c,results:a,onSelect:E,onClear:m,placeholder:"Search target entity...",disabled:p}),e.target&&f.jsxs("div",{className:"relationship-builder__selected","data-testid":"target-selected",children:[e.target.domain&&f.jsx("span",{className:"relationship-builder__domain",children:e.target.domain}),f.jsx("span",{children:e.target.label})]})]})]}))});Vz.displayName="RelationshipBuilder";const Yz=e=>"type"in e&&e.type==="separator",aM=Se.forwardRef((h,u)=>{var m=h,{actions:e,onAction:t,trigger:n,triggerIcon:a="moreVertical",triggerLabel:i="Menu",placement:r="bottom-start",className:l}=m,c=Ie(m,["actions","onAction","trigger","triggerIcon","triggerLabel","placement","className"]);const[p,g]=j.useState(!1),v=j.useRef(null),x=j.useRef(null),b=j.useRef(null),_=j.useCallback(()=>g(!1),[]),{focusedValue:S,setFocusedValue:M}=Ap({triggerRef:b,panelRef:x,isOpen:p,onClose:_});j.useImperativeHandle(u,()=>v.current);const C=j.useCallback(k=>{t(k),g(!1)},[t]);return f.jsxs("div",ee($({ref:v,className:["row-menu",l].filter(Boolean).join(" "),"data-testid":"row-menu"},c),{children:[f.jsx("button",{ref:b,type:"button",className:"row-menu__trigger",onClick:()=>g(k=>!k),"aria-label":i,"aria-haspopup":"menu","aria-expanded":p,"data-testid":"row-menu-trigger",children:n||f.jsx(nt,{name:a,size:16})}),p&&f.jsx("div",{ref:x,role:"menu","aria-label":i,className:`dropdown-panel ${Ip(r)} row-menu__dropdown`,"data-testid":"row-menu-dropdown",children:e.map((k,L)=>Yz(k)?f.jsx("div",{role:"separator",className:"dropdown-separator","data-testid":`row-menu-separator-${L}`},`separator-${L}`):f.jsx(Gz,{action:k,isFocused:S===k.id,onFocus:()=>M(k.id),onClick:()=>C(k.id)},k.id))})]}))});aM.displayName="RowMenu";function Gz({action:e,isFocused:t,onFocus:n,onClick:a}){const i=j.useRef(null);return j.useEffect(()=>{var r;t&&((r=i.current)==null||r.focus())},[t]),f.jsxs("button",{ref:i,type:"button",role:"menuitem",tabIndex:t?0:-1,disabled:e.disabled,"data-dropdown-item":e.id,"data-disabled":e.disabled||void 0,onClick:a,onMouseEnter:()=>!e.disabled&&n(),className:["dropdown-item",e.danger&&"dropdown-item--danger",t&&"dropdown-item--focused",e.disabled&&"dropdown-item--disabled"].filter(Boolean).join(" "),"data-testid":`row-menu-action-${e.id}`,children:[e.icon&&f.jsx("span",{className:"dropdown-item__leading",children:f.jsx(nt,{name:e.icon,size:16})}),f.jsx("span",{className:"dropdown-item__label",children:e.label})]})}const Kz={running:"cyan",success:"emerald",idle:"neutral",failed:"rose"},Qz=Se.forwardRef((g,p)=>{var v=g,{pipeline:e,onRun:t,onCancel:n,onOptions:a,compact:i=!1,selected:r=!1,headerAction:l,footerContent:c,flowLayout:u="fill",className:h}=v,m=Ie(v,["pipeline","onRun","onCancel","onOptions","compact","selected","headerAction","footerContent","flowLayout","className"]);const x=Kz[e.status];return f.jsxs("div",ee($({ref:p,className:["pipeline-card",i&&"pipeline-card--compact",r&&"pipeline-card--selected",h].filter(Boolean).join(" "),"data-testid":"pipeline-card"},m),{children:[f.jsxs("div",{className:"pipeline-card__head",children:[f.jsxs("div",{className:"pipeline-card__head-top",children:[f.jsxs("div",{className:"pipeline-card__title-group",children:[f.jsx("div",{className:"pipeline-card__name-mono",children:e.name}),e.id&&f.jsx("div",{className:"pipeline-card__id-mono",children:e.id})]}),f.jsxs("div",{className:"pipeline-card__head-right",children:[f.jsxs("div",{className:"pipeline-card__head-chips",children:[f.jsx(fs,{variant:x,children:e.status}),e.target&&f.jsx(fs,{variant:"neutral",children:e.target}),e.tags&&e.tags.length>0&&f.jsx("div",{className:"pipeline-card__tags",children:e.tags.map(b=>f.jsx(fs,{variant:"neutral",children:b},b))})]}),f.jsxs("div",{className:"pipeline-card__head-actions",children:[l,t&&e.status!=="running"&&f.jsx("button",{type:"button",className:"pipeline-card__action-btn",onClick:t,"data-testid":"pipeline-run-btn",children:"Run"}),n&&e.status==="running"&&f.jsx("button",{type:"button",className:"pipeline-card__action-btn pipeline-card__action-btn--cancel",onClick:n,"data-testid":"pipeline-cancel-btn",children:"Cancel"}),a&&f.jsx("button",{type:"button","aria-label":"Pipeline options",className:"pipeline-card__kebab-btn",onClick:a,"data-testid":"pipeline-kebab-btn",children:f.jsx(nt,{name:"moreVertical",size:16})})]})]})]}),e.description&&f.jsx("p",{className:"pipeline-card__description",children:e.description})]}),f.jsx("div",{className:"pipeline-card__flow","data-layout":u,children:e.flow.map((b,_)=>f.jsxs(Se.Fragment,{children:[f.jsxs("div",{className:"pipeline-card__node","data-color":b.color,children:[f.jsx("div",{className:"pipeline-card__icon-tile",children:typeof b.icon=="string"?f.jsx(nt,{name:b.icon,size:16}):b.icon}),f.jsxs("div",{className:"pipeline-card__node-content",children:[f.jsx("div",{className:"pipeline-card__node-name",children:b.name}),b.label&&f.jsx("div",{className:"pipeline-card__node-label",children:b.label})]})]}),_<e.flow.length-1&&f.jsx("div",{className:"pipeline-card__arrow"})]},b.id))}),f.jsx("div",{className:"pipeline-card__foot",children:c!=null?c:f.jsxs("div",{className:"pipeline-card__foot-row",children:[f.jsxs("div",{className:"pipeline-card__foot-col",children:[f.jsx("div",{className:"pipeline-card__foot-label",children:"LAST RUN"}),f.jsx("div",{className:"pipeline-card__foot-value",children:e.lastRun||"—"})]}),f.jsxs("div",{className:"pipeline-card__foot-col",children:[f.jsx("div",{className:"pipeline-card__foot-label",children:"INGESTED"}),f.jsx("div",{className:"pipeline-card__foot-value",children:e.recent.ingested})]}),f.jsxs("div",{className:"pipeline-card__foot-col",children:[f.jsx("div",{className:"pipeline-card__foot-label",children:"CREATED"}),f.jsx("div",{className:"pipeline-card__foot-value",children:e.recent.created})]}),f.jsxs("div",{className:"pipeline-card__foot-col",children:[f.jsx("div",{className:"pipeline-card__foot-label",children:"UPDATED"}),f.jsx("div",{className:"pipeline-card__foot-value",children:e.recent.updated})]}),f.jsxs("div",{className:["pipeline-card__foot-col",Number(e.recent.errors)>0&&"pipeline-card__foot-col--error"].filter(Boolean).join(" "),children:[f.jsx("div",{className:"pipeline-card__foot-label",children:"ERRORS"}),f.jsx("div",{className:"pipeline-card__foot-value",children:e.recent.errors})]})]})})]}))});Qz.displayName="PipelineCard";const Xz=e=>{const t=[];let n=0;const a=/`([^`]+)`/g;let i;for(;(i=a.exec(e))!==null;)i.index>n&&t.push(e.substring(n,i.index)),t.push(f.jsx("code",{className:"form-callout__code",children:i[1]},`code-${i.index}`)),n=a.lastIndex;return n<e.length&&t.push(e.substring(n)),t.length>0?t:[e]},Zz=Se.forwardRef((c,l)=>{var u=c,{variant:e="info",icon:t,children:n,className:a="",role:i}=u,r=Ie(u,["variant","icon","children","className","role"]);const h=typeof n=="string"?Xz(n):n,m=i!=null?i:e==="error"||e==="warn"?"alert":"note";return f.jsxs("div",ee($({ref:l,className:["form-callout",`form-callout--${e}`,a].filter(Boolean).join(" "),"data-testid":"form-callout",role:m},r),{children:[t&&f.jsx("div",{className:"form-callout__icon",children:f.jsx(nt,{name:t,size:16})}),f.jsx("div",{className:"form-callout__body",children:h})]}))});Zz.displayName="FormCallout";function mp(e,t,n){const a=`${t} to ${n}`;return e?`${e}: ${a}`:a}function Jz(e,t,n,a,i,r){const l=i-e,c=r-t;if(l===0&&c===0)return{x:e,y:t};const u=Math.abs(l),h=Math.abs(c),m=n/2,p=a/2;if(u*p>h*m){const g=l>0?1:-1;return{x:e+g*m,y:t+c*m/u}}else{const g=c>0?1:-1;return{x:e+l*p/h,y:t+g*p}}}function Dy(e,t){let{minX:n,maxX:a,minY:i,maxY:r}=e,l=!1;for(const c of t)!Number.isFinite(c.x)||!Number.isFinite(c.y)||!Number.isFinite(c.r)||(n=Math.min(n,c.x-c.r),a=Math.max(a,c.x+c.r),i=Math.min(i,c.y-c.r),r=Math.max(r,c.y+c.r),l=!0);return l?{minX:n,maxX:a,minY:i,maxY:r}:e}function Oy(e,t,n,a,i,r){const l=e.maxX-e.minX,c=e.maxY-e.minY,u=Math.min(r,Math.max(i,Math.min((t-2*a)/(l||1),(n-2*a)/(c||1)))),h=(e.minX+e.maxX)/2,m=(e.minY+e.maxY)/2;return{zoom:u,panX:t/2-h*u,panY:n/2-m*u}}const Pp=.22;function Wz(e,t,n=Pp){const a=t.x-e.x,i=t.y-e.y,r=Math.hypot(a,i),l=-i/(r||1),c=a/(r||1),u=Math.min(80,r*n),h=(e.x+t.x)/2+l*u,m=(e.y+t.y)/2+c*u;return{d:`M ${e.x} ${e.y} Q ${h} ${m} ${t.x} ${t.y}`,mid:{x:(e.x+2*h+t.x)/4,y:(e.y+2*m+t.y)/4},angle:Math.atan2(t.y-m,t.x-h),points:[e,{x:h,y:m},t]}}const M2={left:{x:-1,y:0},right:{x:1,y:0},top:{x:0,y:-1},bottom:{x:0,y:1}};function j2(e,t,n,a,i,r){const l=i-e,c=r-t;if(l===0&&c===0)return{x:0,y:0};const u=Math.abs(l),h=Math.abs(c),m=n/2,p=a/2;return u*p>h*m?{x:l>0?1:-1,y:0}:{x:0,y:c>0?1:-1}}function e5(e,t,n,a,i,r,l){switch(i){case"left":return{x:e-n/2,y:t};case"right":return{x:e+n/2,y:t};case"top":return{x:e,y:t-a/2};case"bottom":return{x:e,y:t+a/2};default:return Jz(e,t,n,a,r,l)}}function E2(e,t,n,a){if(t==="auto"&&e.radius!==void 0&&e.radius>0){const i=n-e.x,r=a-e.y,l=Math.hypot(i,r);return l===0?{x:e.x,y:e.y}:{x:e.x+i/l*e.radius,y:e.y+r/l*e.radius}}return e5(e.x,e.y,e.width,e.height,t,n,a)}const sM=.22;function t5(e,t,n="auto",a="auto",i=sM,r,l){const c=t.x-e.x,u=t.y-e.y,h=Math.hypot(c,u)||1,m=Math.min(120,h*i),p=-u/h,g=c/h,v=r!=null?r:n==="auto"?{x:p,y:g}:M2[n],x=l!=null?l:a==="auto"?{x:p,y:g}:M2[a],b={x:e.x+v.x*m,y:e.y+v.y*m},_={x:t.x+x.x*m,y:t.y+x.y*m},S={x:(e.x+b.x)/2,y:(e.y+b.y)/2},M={x:(b.x+_.x)/2,y:(b.y+_.y)/2},C={x:(_.x+t.x)/2,y:(_.y+t.y)/2},k={x:(S.x+M.x)/2,y:(S.y+M.y)/2},L={x:(M.x+C.x)/2,y:(M.y+C.y)/2},E={x:(k.x+L.x)/2,y:(k.y+L.y)/2};return{d:`M ${e.x} ${e.y} C ${b.x} ${b.y} ${_.x} ${_.y} ${t.x} ${t.y}`,mid:E,angle:Math.atan2(L.y-k.y,L.x-k.x),points:[e,b,_,t]}}function gp(e,t,n={}){var h,m,p,g;const a=(h=n.sourceAnchor)!=null?h:"auto",i=(m=n.targetAnchor)!=null?m:"auto",r=E2(e,a,t.x,t.y),l=E2(t,i,e.x,e.y);if(a==="auto"&&i==="auto")return Wz(r,l,(p=n.curvature)!=null?p:Pp);const c=a==="auto"?j2(e.x,e.y,e.width,e.height,t.x,t.y):void 0,u=i==="auto"?j2(t.x,t.y,t.width,t.height,e.x,e.y):void 0;return t5(r,l,a,i,(g=n.curvature)!=null?g:sM,c,u)}const n5=6.6,a5=14,s5=18;function Kc(e){return{width:e.length*n5+a5,height:s5}}function i5(e,t,n,a){const i=1-a;return{x:i*i*e.x+2*i*a*t.x+a*a*n.x,y:i*i*e.y+2*i*a*t.y+a*a*n.y}}function r5(e,t,n,a,i){const r=1-i;return{x:r*r*r*e.x+3*r*r*i*t.x+3*r*i*i*n.x+i*i*i*a.x,y:r*r*r*e.y+3*r*r*i*t.y+3*r*i*i*n.y+i*i*i*a.y}}function o5(e,t){const n=e.length-1,a=Math.floor(t*n),i=t*n-a,r=e[Math.min(a,e.length-1)],l=e[Math.min(a+1,e.length-1)];return{x:r.x+(l.x-r.x)*i,y:r.y+(l.y-r.y)*i}}const l5=[.5,.38,.62,.26,.74,.15,.85];function Hv(e,t,n,a=6,i){const r=i?u=>o5(e,u):e.length===4?u=>r5(e[0],e[1],e[2],e[3],u):u=>i5(e[0],e[1],e[2],u),l=t.width/2+a,c=t.height/2+a;for(const u of l5){const h=r(u);if(n.every(m=>{const p=m.width/2,g=m.height/2;return Math.abs(h.x-m.x)>=l+p||Math.abs(h.y-m.y)>=c+g}))return h}return r(.5)}const Od=16,ul=20,R2=2;function c5(e){if(e.length<2)return null;const t=e.map(l=>({x:l.x,y:l.y})),n=dM(t),a=t.slice(1).map((l,c)=>({len:Math.abs(l.x-t[c].x)+Math.abs(l.y-t[c].y),a:t[c],b:l,i:c})).sort((l,c)=>c.len-l.len||l.i-c.i).flatMap(l=>[.5,.3,.7].map(c=>({x:l.a.x+(l.b.x-l.a.x)*c,y:l.a.y+(l.b.y-l.a.y)*c}))),i=a[0],r=Math.atan2(t[t.length-1].y-t[t.length-2].y,t[t.length-1].x-t[t.length-2].x);return{d:n,mid:i,angle:r,points:t,isPolyline:!0,labelAnchors:a}}function u5(e,t,n=[]){return iM(cM(e,t,rM(n,e,t)).points)}function d5(e,t=[],n=Od){const a=new Map;for(const g of e)a.set(g.id,{source:g.source,target:g.target});const i=g=>Math.abs(g.target.x-g.source.x)+Math.abs(g.target.y-g.source.y),r=e.length>N5?[e]:[e,[...e].sort((g,v)=>i(g)-i(v)),[...e].sort((g,v)=>i(v)-i(g))],l=b0(t),c=new Map,u={pops:uM};let h=null,m=1/0;for(const g of r){const v=new Map,x=new lM;let b=0;for(const _ of g){let S=c.get(_);S||c.set(_,S=new Map);const M=cM(_.source,_.target,rM(t,_.source,_.target),x,{grid:l,skip:[_.source,_.target]},S,u);b+=M.cost,x.add(M.points),v.set(_.id,M.points)}(b<m||!h)&&(h=v,m=b)}const p=new Map;for(const g of e)p.set(g.id,iM(h.get(g.id)));return h5(p,a,t,n),p}function iM(e){const t={d:"",mid:e[0],angle:0,points:e,isPolyline:!0};return oM(t),t}function qv(e,t){return e===t||e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rM(e,t,n){return e.filter(a=>!qv(a,t)&&!qv(a,n))}function h5(e,t,n,a=Od){const i=b0(n),r=new Map,l=new Map;for(const[m,p]of e)for(let g=0;g<p.points.length-1;g++){const v=p.points[g],x=p.points[g+1];if(!(v.x===x.x&&v.y===x.y)){if(v.y===x.y){const b=Math.round(v.y);r.has(b)||r.set(b,[]),r.get(b).push({id:m,segmentIndex:g,lo:Math.min(v.x,x.x),hi:Math.max(v.x,x.x)})}else if(v.x===x.x){const b=Math.round(v.x);l.has(b)||l.set(b,[]),l.get(b).push({id:m,segmentIndex:g,lo:Math.min(v.y,x.y),hi:Math.max(v.y,x.y)})}}}const c={y:new Map,x:new Map},u=(m,p,g,v)=>{const x=Math.round(p),b=c[m].get(x);b?b.push({id:g,segmentIndex:v}):c[m].set(x,[{id:g,segmentIndex:v}])};for(const[m,p]of[["y",r],["x",l]])for(const[g,v]of p)for(const x of v)u(m,g,x.id,x.segmentIndex);const h=(m,p,g,v)=>{var M;const x=g[m],b=m==="y"?"x":"y",_=Math.min(g[b],v[b]),S=Math.max(g[b],v[b]);for(let C=Math.round(x)-jc;C<=Math.round(x)+jc;C++)for(const k of(M=c[m].get(C))!=null?M:[]){if(k.id===p)continue;const L=e.get(k.id).points,E=L[k.segmentIndex],I=L[k.segmentIndex+1];if(!(!I||E[m]!==I[m]||Math.abs(E[m]-x)>=jc)&&Math.min(S,Math.max(E[b],I[b]))-Math.max(_,Math.min(E[b],I[b]))>0)return!0}return!1};for(const[m,p]of[["y",r],["x",l]])for(const g of p.values()){const v=[...g].sort((S,M)=>S.lo-M.lo||S.id.localeCompare(M.id));let x=[],b=-1/0;const _=[];for(const S of v)x.length>0&&S.lo<b?(x.push(S),b=Math.max(b,S.hi)):(x.length>1&&_.push(x),x=[S],b=S.hi);x.length>1&&_.push(x);for(const S of _){const M=[...new Set(S.map(k=>k.id))];if(M.length<2)continue;const C=new Set;M.forEach((k,L)=>{const E=(L-(M.length-1)/2)*a,I=e.get(k),T=t.get(k),A={grid:i,skip:[T.source,T.target]},R=[E,-E];for(let D=Math.ceil(M.length/2);D<=M.length;D++)R.push(D*a,-D*a);for(const D of R){if(C.has(D))continue;if(D===0){C.add(D);break}const O=S.filter(z=>z.id===k);if(!O.every(z=>f5(I,z.segmentIndex,m,D,T)))continue;let B=I.points;for(const z of O)B=p5(B,z.segmentIndex,m,D);if(!(yp(B,A,0)>yp(I.points,A,0))&&!O.some(z=>h(m,k,B[z.segmentIndex],B[z.segmentIndex+1]))){I.points=B,oM(I);for(const z of O)u(m,B[z.segmentIndex][m],k,z.segmentIndex);C.add(D);break}}})}}}function f5(e,t,n,a,i){const r=e.points.length-2;return!(t===0&&!L2(e.points[0],i.source,n,a)||t===r&&!L2(e.points[r+1],i.target,n,a))}function L2(e,t,n,a){const i=Math.abs(Math.abs(e.x-t.x)-t.width/2)<.01,r=Math.abs(Math.abs(e.y-t.y)-t.height/2)<.01;return n==="y"?i?Math.abs(e.y+a-t.y)<=t.height/2-R2:!1:r?Math.abs(e.x+a-t.x)<=t.width/2-R2:!1}function p5(e,t,n,a){return e.map((i,r)=>r===t||r===t+1?n==="y"?{x:i.x,y:i.y+a}:{x:i.x+a,y:i.y}:i)}function oM(e){e.d=dM(e.points),e.mid=e.points[Math.floor(e.points.length/2)];const t=e.points.length;e.angle=t>=2?Math.atan2(e.points[t-1].y-e.points[t-2].y,e.points[t-1].x-e.points[t-2].x):0}function wn(e,t){switch(t){case"left":return{x:e.x-e.width/2,y:e.y};case"right":return{x:e.x+e.width/2,y:e.y};case"top":return{x:e.x,y:e.y-e.height/2};case"bottom":return{x:e.x,y:e.y+e.height/2}}}function v0(e,t,n,a,i=0){const r=a.x-a.width/2-i,l=a.x+a.width/2+i,c=a.y-a.height/2-i,u=a.y+a.height/2+i;return n>c&&n<u&&Math.min(e,t)<l&&Math.max(e,t)>r}function x0(e,t,n,a,i=0){const r=a.x-a.width/2-i,l=a.x+a.width/2+i,c=a.y-a.height/2-i,u=a.y+a.height/2+i;return e>r&&e<l&&Math.min(t,n)<u&&Math.max(t,n)>c}function m5(e,t,n,a,i,r){if(!("grid"in e)){for(const u of e)if(r(u))return;return}const{grid:l,skip:c}=e;l.visit(t,n,a,i,u=>{for(const h of c)if(qv(u,h))return!1;return r(u)})}function Vv(e,t,n,a){return e.y===t.y?v0(e.x,t.x,e.y,n,a):x0(e.x,e.y,t.y,n,a)}function yp(e,t,n,a=1/0){let i=0;for(let r=0;r<e.length-1;r++){const l=e[r],c=e[r+1];if(!(l.x===c.x&&l.y===c.y)&&(m5(t,Math.min(l.x,c.x)-n,Math.min(l.y,c.y)-n,Math.max(l.x,c.x)+n,Math.max(l.y,c.y)+n,u=>(Vv(l,c,u,n)&&i++,i>a)),i>a))break}return i}const g5=200,Kr=e=>Math.floor(e/g5);class zd{constructor(){Kt(this,"cells",new Map),Kt(this,"round",0)}static key(t,n){return(t+32768)*65536+(n+32768)}insert(t,n,a,i,r){const l={item:t,seen:0};for(let c=Kr(n);c<=Kr(i);c++)for(let u=Kr(a);u<=Kr(r);u++){const h=zd.key(c,u),m=this.cells.get(h);m?m.push(l):this.cells.set(h,[l])}}visit(t,n,a,i,r){const l=++this.round;for(let c=Kr(t);c<=Kr(a);c++)for(let u=Kr(n);u<=Kr(i);u++){const h=this.cells.get(zd.key(c,u));if(h){for(const m of h)if(m.seen!==l&&(m.seen=l,r(m.item)))return}}}}function b0(e){const t=new zd;for(const n of e)t.insert(n,n.x-n.width/2,n.y-n.height/2,n.x+n.width/2,n.y+n.height/2);return t}class lM{constructor(){Kt(this,"grid",new zd)}add(t){for(let n=0;n<t.length-1;n++){const a=t[n],i=t[n+1];this.grid.insert({a,b:i},Math.min(a.x,i.x),Math.min(a.y,i.y),Math.max(a.x,i.x),Math.max(a.y,i.y))}}forEachNear(t,n,a,i){this.grid.visit(Math.min(t.x,n.x)-a,Math.min(t.y,n.y)-a,Math.max(t.x,n.x)+a,Math.max(t.y,n.y)+a,i)}}function y5(e){const t=[];for(const n of e){const a=t[t.length-1];(!a||a.x!==n.x||a.y!==n.y)&&t.push(n)}return t}const vp=40,v5=250,or=10,x5=30,jc=8,b5=2,Js=10,_5=12,w5=4,S5=4,N5=24;function Yv(e){const t=[];for(const n of y5(e)){const a=t.length;if(a>=2){const i=t[a-2],r=t[a-1];if(i.x===r.x&&r.x===n.x||i.y===r.y&&r.y===n.y){t[a-1]=n;continue}}t.push(n)}return t}function T2(e,t){const n=Math.abs(e.x-(t.x-t.width/2)),a=Math.abs(e.x-(t.x+t.width/2)),i=Math.abs(e.y-(t.y-t.height/2)),r=Math.abs(e.y-(t.y+t.height/2)),l=Math.min(n,a,i,r);return l===n?"left":l===a?"right":l===i?"top":"bottom"}function k5(e,t,n){if(e.length<2)return!1;const[a,i]=e,r=(u,h,m)=>{switch(u){case"left":return h.y===m.y&&m.x<h.x;case"right":return h.y===m.y&&m.x>h.x;case"top":return h.x===m.x&&m.y<h.y;case"bottom":return h.x===m.x&&m.y>h.y}},l=e[e.length-2],c=e[e.length-1];return r(T2(a,t),a,i)&&r(T2(c,n),c,l)}function C5(e,t,n){let a=0;for(let i=0;i<e.length-1;i++){const r=e[i],l=e[i+1],c=[i>0?t:null,i<e.length-2?n:null];for(const u of c)u&&(r.y===l.y?v0(r.x,l.x,r.y,u):x0(r.x,r.y,l.y,u))&&a++}return a}function M5(e){if(e.length<=2)return!0;const t=(a,i)=>Math.abs(i.x-a.x)+Math.abs(i.y-a.y),n=e.length;return t(e[0],e[1])>=Js&&t(e[n-2],e[n-1])>=Js}function j5(e,t){let n=0,a=0;for(let i=0;i<e.length-1;i++){const r=e[i],l=e[i+1];t.forEachNear(r,l,jc,({a:c,b:u})=>{r.y===l.y&&c.y===u.y&&Math.abs(r.y-c.y)<jc?a+=Math.max(0,Math.min(Math.max(r.x,l.x),Math.max(c.x,u.x))-Math.max(Math.min(r.x,l.x),Math.min(c.x,u.x))):r.x===l.x&&c.x===u.x&&Math.abs(r.x-c.x)<jc&&(a+=Math.max(0,Math.min(Math.max(r.y,l.y),Math.max(c.y,u.y))-Math.max(Math.min(r.y,l.y),Math.min(c.y,u.y))));const h=r.y===l.y,m=c.y===u.y;if(h===m)return;const[p,g,v,x]=h?[r,l,c,u]:[c,u,r,l];v.x>Math.min(p.x,g.x)&&v.x<Math.max(p.x,g.x)&&p.y>Math.min(v.y,x.y)&&p.y<Math.max(v.y,x.y)&&n++})}return{crossings:n,shared:a}}function A2(e){let t=0;for(let n=0;n<e.length-1;n++)t+=Math.abs(e[n+1].x-e[n].x)+Math.abs(e[n+1].y-e[n].y);return t}function Cf(e,t,n,a,i){const r=p=>e==="x"?p.width:p.height,l=p=>e==="x"?p.height:p.width,c=p=>e==="x"?p.y:p.x,u=t.filter(p=>c(p)+l(p)/2>n&&c(p)-l(p)/2<a).map(p=>[p[e]-r(p)/2-i,p[e]+r(p)/2+i]).sort((p,g)=>p[0]-g[0]);if(u.length===0)return[];const h=[];for(const p of u){const g=h[h.length-1];g&&p[0]<=g[1]?g[1]=Math.max(g[1],p[1]):h.push([p[0],p[1]])}const m=[h[0][0],h[h.length-1][1]];for(let p=0;p<h.length-1;p++)m.push((h[p][1]+h[p+1][0])/2);return m}function cM(e,t,n,a=new lM,i,r=new Map,l={pops:uM}){const c=ul,u=t.x-e.x,h=t.y-e.y,m=(re,Z)=>Z.x>=re.x?"right":"left",p=(re,Z)=>Z.y>=re.y?"bottom":"top",g=re=>({left:"right",right:"left",top:"bottom",bottom:"top"})[re];if(u===0&&h===0)return{points:[wn(e,"right"),wn(t,"right")],cost:0};const v=[];if(h===0&&v.push([wn(e,m(e,t)),wn(t,g(m(e,t)))]),u===0&&v.push([wn(e,p(e,t)),wn(t,g(p(e,t)))]),u!==0&&h!==0){const re=wn(e,m(e,t)),Z=wn(t,g(p(e,t)));v.push([re,{x:Z.x,y:re.y},Z]);const J=wn(e,p(e,t)),K=wn(t,g(m(e,t)));v.push([J,{x:J.x,y:K.y},K])}const x=re=>{if(re.length===0)return[];const Z=Math.min(...re.map(K=>K.y-K.height/2))-c,J=Math.max(...re.map(K=>K.y+K.height/2))+c;return[Z,J]},b=re=>{if(re.length===0)return[];const Z=Math.min(...re.map(K=>K.x-K.width/2))-c,J=Math.max(...re.map(K=>K.x+K.width/2))+c;return[Z,J]},_=re=>{const Z=wn(e,p(e,{x:e.x,y:re})),J=wn(t,p(t,{x:t.x,y:re}));return[Z,{x:Z.x,y:re},{x:J.x,y:re},J]},S=re=>{const Z=wn(e,m(e,{x:re,y:e.y})),J=wn(t,m(t,{x:re,y:t.y}));return[Z,{x:re,y:Z.y},{x:re,y:J.y},J]},M=wn(e,m(e,t)),C=n.filter(re=>v0(M.x,t.x,e.y,re,c)),k=wn(e,p(e,t)),L=n.filter(re=>x0(e.x,k.y,t.y,re,c)),E=[...n,e,t],I=Math.min(e.x,t.x),T=Math.max(e.x,t.x),A=Math.min(e.y,t.y),R=Math.max(e.y,t.y),D=re=>(Z,J)=>Math.abs(Z-re)-Math.abs(J-re)||Z-J,O=(re,Z,J)=>{const K=new Set(re);let Q=0;return[...new Set([...re,...Z])].sort(D(J)).filter(ae=>K.has(ae)||Q++<_5)},B=O([...x(C),...x(n)],Cf("y",E,I,T,or),(e.y+t.y)/2),z=O([...b(L),...b(n)],Cf("x",E,A,R,or),(e.x+t.x)/2);for(const re of B)v.push(_(re));for(const re of z)v.push(S(re));const U=re=>[...new Set([...z,re.x-Od,re.x+Od])].filter(Z=>Z>re.x-re.width/2+Js&&Z<re.x+re.width/2-Js&&Z!==re.x),F=v.length,Y=[e.x,...U(e)],X=[t.x,...U(t)];for(const re of B.slice(0,w5)){const Z=wn(e,p(e,{x:e.x,y:re})).y,J=wn(t,p(t,{x:t.x,y:re})).y;for(const K of Y)for(const Q of X)K===e.x&&Q===t.x||v.push([{x:K,y:Z},{x:K,y:re},{x:Q,y:re},{x:Q,y:J}])}const ne=(re,Z,J,K)=>[Math.max(re,J)+Js,Math.min(Z,K)-Js],[q,he]=ne(e.x-e.width/2,e.x+e.width/2,t.x-t.width/2,t.x+t.width/2);if(q<=he&&h!==0){const re=e.y+Math.sign(h)*e.height/2,Z=t.y-Math.sign(h)*t.height/2,J=n.filter(K=>K.y>Math.min(e.y,t.y)&&K.y<Math.max(e.y,t.y));for(const K of[...Cf("x",J,Math.min(re,Z),Math.max(re,Z),or),(q+he)/2])K>=q&&K<=he&&v.push([{x:K,y:re},{x:K,y:Z}])}const[pe,H]=ne(e.y-e.height/2,e.y+e.height/2,t.y-t.height/2,t.y+t.height/2);if(pe<=H&&u!==0){const re=e.x+Math.sign(u)*e.width/2,Z=t.x-Math.sign(u)*t.width/2,J=n.filter(K=>K.x>Math.min(e.x,t.x)&&K.x<Math.max(e.x,t.x));for(const K of[...Cf("y",J,Math.min(re,Z),Math.max(re,Z),or),(pe+H)/2])K>=pe&&K<=H&&v.push([{x:re,y:K},{x:Z,y:K}])}const te=i!=null?i:n;let ie=null,W=1/0,ge=1/0;const we=(re,Z)=>{const J=[];re.forEach((K,Q)=>{const ae=Yv(K),ye=A2(ae)+vp*(ae.length-2);W===0&&ye>ge||ae.length>=2&&k5(ae,e,t)&&M5(ae)&&J.push({points:ae,index:Z+Q,bound:ye})}),J.sort((K,Q)=>K.bound-Q.bound||K.index-Q.index);for(const K of J){if(W===0&&K.bound>ge)break;const Q=C5(K.points,e,t);if(Q>W)continue;const ae=Q+yp(K.points,te,or,W-Q);if(ae>W)continue;const{crossings:ye,shared:Ae}=j5(K.points,a),de=K.bound+v5*ye+b5*Ae+x5*yp(K.points,te,c);(ae<W||de<ge||de===ge&&K.index<ie.index)&&(ie=K,W=ae,ge=de)}};we(v.slice(0,F),0),we(v.slice(F),F);{const re=(J,K)=>[...J].sort(D(K)).slice(0,S5),Z=[];for(const J of re(B,e.y))for(const K of re(z,t.x)){const Q=wn(e,p(e,{x:e.x,y:J})),ae=wn(t,m(t,{x:K,y:t.y}));Z.push([Q,{x:Q.x,y:J},{x:K,y:J},{x:K,y:ae.y},ae])}for(const J of re(z,e.x))for(const K of re(B,t.y)){const Q=wn(e,m(e,{x:J,y:e.y})),ae=wn(t,p(t,{x:t.x,y:K}));Z.push([Q,{x:J,y:Q.y},{x:J,y:K},{x:ae.x,y:K},ae])}we(Z,v.length)}const je=ie!==null&&D5(e,t,A2(ie.points));if(W>0||je)for(const re of W>0?[I2,1/0]:[I2]){let Z=r.get(re);if(Z||r.set(re,Z=O5(e,t,n,re,l)),Z.points&&we([Z.points],Number.MAX_SAFE_INTEGER),W===0||!Z.widen)break}const De=ie;return De?{points:De.points,cost:ge}:{points:Yv(v[0]),cost:1/0}}const I2=300,zy=1.001,E5=4,R5=1,L5=1.5,T5=4e5,A5=2e5,uM=1e6,I5=2*vp+2*ul;function D5(e,t,n){const a=(u,h,m)=>Math.max(0,Math.abs(u)-(h+m)/2),i=a(t.x-e.x,e.width,t.width)+a(t.y-e.y,e.height,t.height);if(i<=0||n<=L5*i)return!1;const r=u=>{const h=u.x-u.width/2,m=u.x+u.width/2,p=u.y-u.height/2,g=u.y+u.height/2,[v,x]=h+Js<=m-Js?[h+Js,m-Js]:[u.x,u.x];return[{x1:h,x2:h,y1:u.y,y2:u.y},{x1:m,x2:m,y1:u.y,y2:u.y},{x1:v,x2:x,y1:p,y2:p},{x1:v,x2:x,y1:g,y2:g}]},l=(u,h,m,p)=>Math.max(0,u-p,m-h);let c=1/0;for(const u of r(e))for(const h of r(t))c=Math.min(c,l(u.x1,u.x2,h.x1,h.x2)+l(u.y1,u.y2,h.y1,h.y2));return n-c>I5}function D2(e,t,n,a,i){const r=p=>e==="x"?p.width:p.height,l=p=>e==="x"?p.y:p.x,c=p=>e==="x"?p.height:p.width,u=t.map(p=>({b:p,lo:p[e]-r(p)/2})).sort((p,g)=>p.lo-g.lo),h=u.map(p=>p.lo),m=[...n];for(const p of t){const g=p[e]-r(p)/2,v=p[e]+r(p)/2;m.push(g-ul,v+ul);let x=0,b=h.length;for(;x<b;){const _=x+b>>1;h[_]<=v?x=_+1:b=_}x<h.length&&h[x]-v>=2*or&&m.push((v+h[x])/2);for(let _=x;_<u.length&&u[_].lo<v+2*ul;_++){const S=u[_].b;if(!(Math.abs(l(S)-l(p))>=(c(S)+c(p))/2+2*or)){u[_].lo-v>=2*or&&m.push((v+u[_].lo)/2);break}}}return[...new Set(m.filter(p=>p>=a&&p<=i))].sort((p,g)=>p-g)}function O5(e,t,n,a,i){const r={points:null,widen:!1};if(i.pops<=0)return r;const l=or,c=[e,t],u=[...n,...c],h=J=>({x1:Math.min(...J.map(K=>K.x-K.width/2)),x2:Math.max(...J.map(K=>K.x+K.width/2)),y1:Math.min(...J.map(K=>K.y-K.height/2)),y2:Math.max(...J.map(K=>K.y+K.height/2))}),m=h(c),p=h(u),g=ul+l,v={x1:Math.max(m.x1-a,p.x1-g),x2:Math.min(m.x2+a,p.x2+g),y1:Math.max(m.y1-a,p.y1-g),y2:Math.min(m.y2+a,p.y2+g)},x=u.filter(J=>J.x+J.width/2+l>v.x1&&J.x-J.width/2-l<v.x2&&J.y+J.height/2+l>v.y1&&J.y-J.height/2-l<v.y2),b=J=>[{x:J.x+J.width/2+l,y:J.y,dir:0,port:wn(J,"right"),cost:0},{x:J.x-J.width/2-l,y:J.y,dir:1,port:wn(J,"left"),cost:0},{x:J.x,y:J.y+J.height/2+l,dir:2,port:wn(J,"bottom"),cost:0},{x:J.x,y:J.y-J.height/2-l,dir:3,port:wn(J,"top"),cost:0}],_=[...b(e),...b(t)],S=D2("x",x,_.map(J=>J.x),v.x1,v.x2),M=D2("y",x,_.map(J=>J.y),v.y1,v.y2),C=S.length,k=M.length;if(C*k>T5)return r;const L=b0(x),E=J=>{let K=!1;return L.visit(J.x-l,J.y-l,J.x+l,J.y+l,Q=>K=Math.abs(J.x-Q.x)<Q.width/2+l&&Math.abs(J.y-Q.y)<Q.height/2+l),!K},I=J=>{const K=b(J);for(const Q of S){if(Q===J.x||Q<=J.x-J.width/2+Js||Q>=J.x+J.width/2-Js)continue;const ae=E5;K.push({x:Q,y:J.y+J.height/2+l,dir:2,port:{x:Q,y:J.y+J.height/2},cost:ae}),K.push({x:Q,y:J.y-J.height/2-l,dir:3,port:{x:Q,y:J.y-J.height/2},cost:ae})}return K.filter(E)},T=I(e),A=I(t);if(T.length===0||A.length===0)return r;const R=(J,K)=>J.indexOf(K),D=new Float32Array(C*k*2),O=(J,K,Q)=>{const ae=(K*C+J)*2+Q,ye=D[ae];if(ye!==0)return ye<0?-1:ye-1;const Ae={x:S[J],y:M[K]},de=Q===0?{x:S[J+1],y:M[K]}:{x:S[J],y:M[K+1]},Je=ul;let Ge=0;return L.visit(Math.min(Ae.x,de.x)-Je,Math.min(Ae.y,de.y)-Je,Math.max(Ae.x,de.x)+Je,Math.max(Ae.y,de.y)+Je,be=>{if(Vv(Ae,de,be,l))return Ge=-1,!0;if(!Vv(Ae,de,be,Je))return!1;const Fe=Q===0?Math.min(de.x,be.x+be.width/2+Je)-Math.max(Ae.x,be.x-be.width/2-Je):Math.min(de.y,be.y+be.height/2+Je)-Math.max(Ae.y,be.y-be.height/2-Je);return Ge+=R5*Fe,!1}),D[ae]=Ge<0?-1:Ge+1,Ge},B=[1,-1,0,0],z=[0,0,1,-1],U=new Float64Array(C*k*4),F=new Int32Array(C*k*4),Y=new Int8Array(C*k),X=new Float64Array(C*k);for(const J of A){const K=R(M,J.y)*C+R(S,J.x);Y[K]=(J.dir^1)+1,X[K]=J.cost}const ne=t.width/2+l,q=t.height/2+l,he=(J,K)=>{const Q=Math.max(0,Math.abs(S[J]-t.x)-ne),ae=Math.max(0,Math.abs(M[K]-t.y)-q);return Q+ae+(Q>0&&ae>0?vp:0)},pe=[],H=[],te=(J,K)=>{let Q=pe.length;for(pe.push(J),H.push(K);Q>0;){const ae=Q-1>>1;if(pe[ae]<=J)break;pe[Q]=pe[ae],H[Q]=H[ae],Q=ae}pe[Q]=J,H[Q]=K},ie=()=>{const J=H[0],K=pe.pop(),Q=H.pop();if(pe.length>0){let ae=0;for(;;){const ye=2*ae+1;if(ye>=pe.length)break;const Ae=ye+1<pe.length&&pe[ye+1]<pe[ye]?ye+1:ye;if(pe[Ae]>=K)break;pe[ae]=pe[Ae],H[ae]=H[Ae],ae=Ae}pe[ae]=K,H[ae]=Q}return J},W=(J,K,Q,ae)=>{U[J]!==0&&K>=U[J]||(U[J]=K,F[J]=ae+1,te(Q,J))};for(const J of T){const K=R(S,J.x),Q=R(M,J.y);K<0||Q<0||W((Q*C+K)*4+J.dir,l+J.cost,l+J.cost+zy*he(K,Q),-1)}let ge=-1;const we=Math.min(A5,i.pops);let je=0;for(;pe.length>0;je++){if(je>=we)return i.pops-=je,r;const J=pe[0],K=ie(),Q=K&3,ae=K>>2,ye=ae%C,Ae=(ae-ye)/C,de=U[K];if(!(J>de+zy*he(ye,Ae)+1e-6)){if(Y[ae]===Q+1){ge=K;break}for(let Je=0;Je<3;Je++){const Ge=Je===0?Q:(Q<2?2:0)+Je-1,be=Je===0?de:de+vp;Je>0&&Y[ae]===Ge+1&&W(ae*4+Ge,be+X[ae],be+X[ae],K);const Fe=ye+B[Ge],me=Ae+z[Ge];if(Fe<0||Fe>=C||me<0||me>=k)continue;const Ee=Ge<2?O(Math.min(ye,Fe),Ae,0):O(ye,Math.min(Ae,me),1);if(Ee<0)continue;const se=me*C+Fe,le=be+Math.abs(S[Fe]-S[ye])+Math.abs(M[me]-M[Ae])+Ee+(Y[se]===Ge+1?X[se]:0);W(se*4+Ge,le,le+zy*he(Fe,me),K)}}}if(i.pops-=je,ge<0)return{points:null,widen:!0};const De=[];for(let J=ge;J>=0;J=F[J]-1){const K=J>>2,Q=K%C;De.push({x:S[Q],y:M[(K-Q)/C]})}De.reverse();const re=T.find(J=>J.x===De[0].x&&J.y===De[0].y),Z=A.find(J=>J.x===De[De.length-1].x&&J.y===De[De.length-1].y);return{points:Yv([re.port,...De,Z.port]),widen:!1}}function dM(e){return e.length===0?"":[`M ${Math.round(e[0].x)} ${Math.round(e[0].y)}`,...e.slice(1).map(t=>`L ${Math.round(t.x)} ${Math.round(t.y)}`)].join(" ")}const z5=10,B5=100;function $5(e,t){var r,l,c;const n=new Map(e.map((u,h)=>[u,h])),a=e.map(()=>new Map),i=e.map(()=>0);for(const u of t){const h=n.get(u.source),m=n.get(u.target);if(h===void 0||m===void 0)continue;const p=(r=u.weight)!=null?r:1;if(h===m){i[h]+=p;continue}a[h].set(m,((l=a[h].get(m))!=null?l:0)+p),a[m].set(h,((c=a[m].get(h))!=null?c:0)+p)}return{id:[...e],adj:a,selfLoop:i}}function U5(e,t){var u;const n=e.id.length,a=e.adj.map((h,m)=>{let p=2*e.selfLoop[m];for(const g of h.values())p+=g;return p}),i=a.reduce((h,m)=>h+m,0),r=Array.from({length:n},(h,m)=>m),l=[...a];let c=!1;if(i===0)return{comm:r,moved:!1};for(let h=0;h<t;h++){let m=!1;for(let p=0;p<n;p++){const g=r[p];l[g]-=a[p];const v=new Map([[g,0]]);for(const[_,S]of e.adj[p]){const M=r[_];v.set(M,((u=v.get(M))!=null?u:0)+S)}let x=g,b=-1/0;for(const[_,S]of v){const M=S-l[_]*a[p]/i;(M>b||M===b&&_<x)&&(b=M,x=_)}r[p]=x,l[x]+=a[p],x!==g&&(m=!0)}if(m)c=!0;else break}return{comm:r,moved:c}}function F5(e,t,n){var h,m;const a=new Map;for(let p=0;p<e.id.length;p++){const g=t[p];a.has(g)||a.set(g,[]),a.get(g).push(e.id[p])}const i=new Map,r=new Map;for(const[p,g]of a){g.sort();const v=`cluster-L${n}-${g[0]}`;i.set(p,v),r.set(v,g)}const l=[...a.keys()].sort((p,g)=>{const v=i.get(p),x=i.get(g);return v<x?-1:v>x?1:0}),c=new Map(l.map((p,g)=>[p,g])),u={id:l.map(p=>i.get(p)),adj:l.map(()=>new Map),selfLoop:l.map(()=>0)};for(let p=0;p<e.id.length;p++){const g=c.get(t[p]);u.selfLoop[g]+=e.selfLoop[p];for(const[v,x]of e.adj[p]){if(v<=p)continue;const b=c.get(t[v]);g===b?u.selfLoop[g]+=x:(u.adj[g].set(b,((h=u.adj[g].get(b))!=null?h:0)+x),u.adj[b].set(g,((m=u.adj[b].get(g))!=null?m:0)+x))}}return{coarse:u,membersOf:r}}function P5(e,t,n={}){var p,g;const a=(p=n.maxLevels)!=null?p:z5,i=(g=n.maxLocalPasses)!=null?g:B5,r="cluster-root";if(e.length===0)return{id:r,children:[]};let l=new Map,c=$5(e,t),u=0,h=[...e];for(;u<a;){const{comm:v,moved:x}=U5(c,i);if(!x)break;const{coarse:b,membersOf:_}=F5(c,v,u);if(b.id.length===c.id.length)break;const S=new Map;for(const[M,C]of _){const k=C.map(L=>{var E;return(E=l.get(L))!=null?E:{id:L}});S.set(M,{id:M,children:k})}l=S,h=b.id,c=b,u++}const m=h.map(v=>{var x;return(x=l.get(v))!=null?x:{id:v}});return{id:r,children:m}}function H5(e){var t=0,n=e.children,a=n&&n.length;if(!a)t=1;else for(;--a>=0;)t+=n[a].value;e.value=t}function q5(){return this.eachAfter(H5)}function V5(e,t){let n=-1;for(const a of this)e.call(t,a,++n,this);return this}function Y5(e,t){for(var n=this,a=[n],i,r,l=-1;n=a.pop();)if(e.call(t,n,++l,this),i=n.children)for(r=i.length-1;r>=0;--r)a.push(i[r]);return this}function G5(e,t){for(var n=this,a=[n],i=[],r,l,c,u=-1;n=a.pop();)if(i.push(n),r=n.children)for(l=0,c=r.length;l<c;++l)a.push(r[l]);for(;n=i.pop();)e.call(t,n,++u,this);return this}function K5(e,t){let n=-1;for(const a of this)if(e.call(t,a,++n,this))return a}function Q5(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,a=t.children,i=a&&a.length;--i>=0;)n+=a[i].value;t.value=n})}function X5(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function Z5(e){for(var t=this,n=J5(t,e),a=[t];t!==n;)t=t.parent,a.push(t);for(var i=a.length;e!==n;)a.splice(i,0,e),e=e.parent;return a}function J5(e,t){if(e===t)return e;var n=e.ancestors(),a=t.ancestors(),i=null;for(e=n.pop(),t=a.pop();e===t;)i=e,e=n.pop(),t=a.pop();return i}function W5(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function e8(){return Array.from(this)}function t8(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function n8(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*a8(){var e=this,t,n=[e],a,i,r;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,a=e.children)for(i=0,r=a.length;i<r;++i)n.push(a[i]);while(n.length)}function Wd(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=r8)):t===void 0&&(t=i8);for(var n=new Bd(e),a,i=[n],r,l,c,u;a=i.pop();)if((l=t(a.data))&&(u=(l=Array.from(l)).length))for(a.children=l,c=u-1;c>=0;--c)i.push(r=l[c]=new Bd(l[c])),r.parent=a,r.depth=a.depth+1;return n.eachBefore(l8)}function s8(){return Wd(this).eachBefore(o8)}function i8(e){return e.children}function r8(e){return Array.isArray(e)?e[1]:null}function o8(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function l8(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Bd(e){this.data=e,this.depth=this.height=0,this.parent=null}Bd.prototype=Wd.prototype={constructor:Bd,count:q5,each:V5,eachAfter:G5,eachBefore:Y5,find:K5,sum:Q5,sort:X5,path:Z5,ancestors:W5,descendants:e8,leaves:t8,links:n8,copy:s8,[Symbol.iterator]:a8};function c8(e){return e==null?null:u8(e)}function u8(e){if(typeof e!="function")throw new Error;return e}function O2(){return 0}function d8(e){return function(){return e}}const h8=1664525,f8=1013904223,z2=4294967296;function _0(){let e=1;return()=>(e=(h8*e+f8)%z2)/z2}function p8(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function m8(e,t){let n=e.length,a,i;for(;n;)i=t()*n--|0,a=e[n],e[n]=e[i],e[i]=a;return e}function hM(e){return fM(e,_0())}function fM(e,t){for(var n=0,a=(e=m8(Array.from(e),t)).length,i=[],r,l;n<a;)r=e[n],l&&pM(l,r)?++n:(l=y8(i=g8(i,r)),n=0);return l}function g8(e,t){var n,a;if(By(t,e))return[t];for(n=0;n<e.length;++n)if(Mf(t,e[n])&&By(gd(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(a=n+1;a<e.length;++a)if(Mf(gd(e[n],e[a]),t)&&Mf(gd(e[n],t),e[a])&&Mf(gd(e[a],t),e[n])&&By(mM(e[n],e[a],t),e))return[e[n],e[a],t];throw new Error}function Mf(e,t){var n=e.r-t.r,a=t.x-e.x,i=t.y-e.y;return n<0||n*n<a*a+i*i}function pM(e,t){var n=e.r-t.r+Math.max(e.r,t.r,1)*1e-9,a=t.x-e.x,i=t.y-e.y;return n>0&&n*n>a*a+i*i}function By(e,t){for(var n=0;n<t.length;++n)if(!pM(e,t[n]))return!1;return!0}function y8(e){switch(e.length){case 1:return v8(e[0]);case 2:return gd(e[0],e[1]);case 3:return mM(e[0],e[1],e[2])}}function v8(e){return{x:e.x,y:e.y,r:e.r}}function gd(e,t){var n=e.x,a=e.y,i=e.r,r=t.x,l=t.y,c=t.r,u=r-n,h=l-a,m=c-i,p=Math.sqrt(u*u+h*h);return{x:(n+r+u/p*m)/2,y:(a+l+h/p*m)/2,r:(p+i+c)/2}}function mM(e,t,n){var a=e.x,i=e.y,r=e.r,l=t.x,c=t.y,u=t.r,h=n.x,m=n.y,p=n.r,g=a-l,v=a-h,x=i-c,b=i-m,_=u-r,S=p-r,M=a*a+i*i-r*r,C=M-l*l-c*c+u*u,k=M-h*h-m*m+p*p,L=v*x-g*b,E=(x*k-b*C)/(L*2)-a,I=(b*_-x*S)/L,T=(v*C-g*k)/(L*2)-i,A=(g*S-v*_)/L,R=I*I+A*A-1,D=2*(r+E*I+T*A),O=E*E+T*T-r*r,B=-(Math.abs(R)>1e-6?(D+Math.sqrt(D*D-4*R*O))/(2*R):O/D);return{x:a+E+I*B,y:i+T+A*B,r:B}}function B2(e,t,n){var a=e.x-t.x,i,r,l=e.y-t.y,c,u,h=a*a+l*l;h?(r=t.r+n.r,r*=r,u=e.r+n.r,u*=u,r>u?(i=(h+u-r)/(2*h),c=Math.sqrt(Math.max(0,u/h-i*i)),n.x=e.x-i*a-c*l,n.y=e.y-i*l+c*a):(i=(h+r-u)/(2*h),c=Math.sqrt(Math.max(0,r/h-i*i)),n.x=t.x+i*a-c*l,n.y=t.y+i*l+c*a)):(n.x=t.x+n.r,n.y=t.y)}function $2(e,t){var n=e.r+t.r-1e-6,a=t.x-e.x,i=t.y-e.y;return n>0&&n*n>a*a+i*i}function U2(e){var t=e._,n=e.next._,a=t.r+n.r,i=(t.x*n.r+n.x*t.r)/a,r=(t.y*n.r+n.y*t.r)/a;return i*i+r*r}function jf(e){this._=e,this.next=null,this.previous=null}function gM(e,t){if(!(r=(e=p8(e)).length))return 0;var n,a,i,r,l,c,u,h,m,p,g;if(n=e[0],n.x=0,n.y=0,!(r>1))return n.r;if(a=e[1],n.x=-a.r,a.x=n.r,a.y=0,!(r>2))return n.r+a.r;B2(a,n,i=e[2]),n=new jf(n),a=new jf(a),i=new jf(i),n.next=i.previous=a,a.next=n.previous=i,i.next=a.previous=n;e:for(u=3;u<r;++u){B2(n._,a._,i=e[u]),i=new jf(i),h=a.next,m=n.previous,p=a._.r,g=n._.r;do if(p<=g){if($2(h._,i._)){a=h,n.next=a,a.previous=n,--u;continue e}p+=h._.r,h=h.next}else{if($2(m._,i._)){n=m,n.next=a,a.previous=n,--u;continue e}g+=m._.r,m=m.previous}while(h!==m.next);for(i.previous=n,i.next=a,n.next=a.previous=a=i,l=U2(n);(i=i.next)!==a;)(c=U2(i))<l&&(n=i,l=c);a=n.next}for(n=[a._],i=a;(i=i.next)!==a;)n.push(i._);for(i=fM(n,t),u=0;u<r;++u)n=e[u],n.x-=i.x,n.y-=i.y;return i.r}function Gv(e){return gM(e,_0()),e}function x8(e){return Math.sqrt(e.value)}function b8(){var e=null,t=1,n=1,a=O2;function i(r){const l=_0();return r.x=t/2,r.y=n/2,e?r.eachBefore(F2(e)).eachAfter($y(a,.5,l)).eachBefore(P2(1)):r.eachBefore(F2(x8)).eachAfter($y(O2,1,l)).eachAfter($y(a,r.r/Math.min(t,n),l)).eachBefore(P2(Math.min(t,n)/(2*r.r))),r}return i.radius=function(r){return arguments.length?(e=c8(r),i):e},i.size=function(r){return arguments.length?(t=+r[0],n=+r[1],i):[t,n]},i.padding=function(r){return arguments.length?(a=typeof r=="function"?r:d8(+r),i):a},i}function F2(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function $y(e,t,n){return function(a){if(i=a.children){var i,r,l=i.length,c=e(a)*t||0,u;if(c)for(r=0;r<l;++r)i[r].r+=c;if(u=gM(i,n),c)for(r=0;r<l;++r)i[r].r-=c;a.r=u+c}}}function P2(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function _8(e,t){return e.parent===t.parent?1:2}function Uy(e){var t=e.children;return t?t[0]:e.t}function Fy(e){var t=e.children;return t?t[t.length-1]:e.t}function w8(e,t,n){var a=n/(t.i-e.i);t.c-=a,t.s+=n,e.c+=a,t.z+=n,t.m+=n}function S8(e){for(var t=0,n=0,a=e.children,i=a.length,r;--i>=0;)r=a[i],r.z+=t,r.m+=t,t+=r.s+(n+=r.c)}function N8(e,t,n){return e.a.parent===t.parent?e.a:n}function Xf(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}Xf.prototype=Object.create(Bd.prototype);function k8(e){for(var t=new Xf(e,0),n,a=[t],i,r,l,c;n=a.pop();)if(r=n._.children)for(n.children=new Array(c=r.length),l=c-1;l>=0;--l)a.push(i=n.children[l]=new Xf(r[l],l)),i.parent=n;return(t.parent=new Xf(null,0)).children=[t],t}function yM(){var e=_8,t=1,n=1,a=null;function i(h){var m=k8(h);if(m.eachAfter(r),m.parent.m=-m.z,m.eachBefore(l),a)h.eachBefore(u);else{var p=h,g=h,v=h;h.eachBefore(function(M){M.x<p.x&&(p=M),M.x>g.x&&(g=M),M.depth>v.depth&&(v=M)});var x=p===g?1:e(p,g)/2,b=x-p.x,_=t/(g.x+x+b),S=n/(v.depth||1);h.eachBefore(function(M){M.x=(M.x+b)*_,M.y=M.depth*S})}return h}function r(h){var m=h.children,p=h.parent.children,g=h.i?p[h.i-1]:null;if(m){S8(h);var v=(m[0].z+m[m.length-1].z)/2;g?(h.z=g.z+e(h._,g._),h.m=h.z-v):h.z=v}else g&&(h.z=g.z+e(h._,g._));h.parent.A=c(h,g,h.parent.A||p[0])}function l(h){h._.x=h.z+h.parent.m,h.m+=h.parent.m}function c(h,m,p){if(m){for(var g=h,v=h,x=m,b=g.parent.children[0],_=g.m,S=v.m,M=x.m,C=b.m,k;x=Fy(x),g=Uy(g),x&&g;)b=Uy(b),v=Fy(v),v.a=h,k=x.z+M-g.z-_+e(x._,g._),k>0&&(w8(N8(x,h,p),h,k),_+=k,S+=k),M+=x.m,_+=g.m,C+=b.m,S+=v.m;x&&!Fy(v)&&(v.t=x,v.m+=M-S),g&&!Uy(b)&&(b.t=g,b.m+=_-C,p=h)}return p}function u(h){h.x*=t,h.y=h.depth*n}return i.separation=function(h){return arguments.length?(e=h,i):e},i.size=function(h){return arguments.length?(a=!1,t=+h[0],n=+h[1],i):a?null:[t,n]},i.nodeSize=function(h){return arguments.length?(a=!0,t=+h[0],n=+h[1],i):a?[t,n]:null},i}const C8=6;function M8(e,t){const{radiusOf:n,padding:a=C8}=t,i=b8().radius(c=>c.children?0:n(c.data.id));typeof a=="function"?i.padding(c=>a(c.depth)):i.padding(a);const r=i(Wd(e)),l=new Map;return r.each(c=>{l.set(c.data.id,{x:c.x,y:c.y,r:c.r})}),l}function Kv(e,t,n={}){var C,k,L;var a,i;const{iterations:r=300,springLength:l=160,springStrength:c=.04,repulsion:u=8e3,damping:h=.85,centerStrength:m=.005,collisionStrength:p=.3,nodeMargin:g}=n;if(e.length===0)return new Map;const v=E=>g!=null?g:E.width,x=(E,I)=>Math.max(l,(Math.hypot(E.width,E.height)+Math.hypot(I.width,I.height))/2*1.1+(v(E)+v(I))/2),b=new Map(e.map(E=>[E.id,0])),_=new Map(e.map(E=>[E.id,0])),S=new Map(e.map(E=>[E.id,{x:E.x,y:E.y}])),M=new Map(e.map(E=>[E.id,E]));for(let E=0;E<r;E++){for(let I=0;I<e.length;I++)for(let T=I+1;T<e.length;T++){const A=e[I],R=e[T];if(A.pinned&&R.pinned)continue;const D=S.get(A.id),O=S.get(R.id),B=O.x-D.x||.1,z=O.y-D.y||.1,U=Math.max(Math.hypot(B,z),1),F=u/(U*U),Y=B/U*F,X=z/U*F;A.pinned||(b.set(A.id,b.get(A.id)-Y),_.set(A.id,_.get(A.id)-X)),R.pinned||(b.set(R.id,b.get(R.id)+Y),_.set(R.id,_.get(R.id)+X));const ne=A.width+v(A),q=R.width+v(R),he=A.height+v(A),pe=R.height+v(R),H=(ne+q)/2-Math.abs(B),te=(he+pe)/2-Math.abs(z);if(H>0&&te>0){const ie=Math.min(H,te)*p,W=B/U*ie,ge=z/U*ie;A.pinned||(b.set(A.id,b.get(A.id)-W),_.set(A.id,_.get(A.id)-ge)),R.pinned||(b.set(R.id,b.get(R.id)+W),_.set(R.id,_.get(R.id)+ge))}}for(const I of t){const T=M.get(I.source),A=M.get(I.target);if(!T||!A||T.pinned&&A.pinned)continue;const R=S.get(T.id),D=S.get(A.id),O=D.x-R.x||.1,B=D.y-R.y||.1,z=Math.max(Math.hypot(O,B),1),U=c*(z-x(T,A)),F=O/z*U,Y=B/z*U;T.pinned||(b.set(T.id,b.get(T.id)+F),_.set(T.id,_.get(T.id)+Y)),A.pinned||(b.set(A.id,b.get(A.id)-F),_.set(A.id,_.get(A.id)-Y))}for(const I of e){if(I.pinned)continue;const T=S.get(I.id),A=(C=(a=I.gravityTarget)==null?void 0:a.x)!=null?C:0,R=(k=(i=I.gravityTarget)==null?void 0:i.y)!=null?k:0,D=(L=I.gravityStrength)!=null?L:1,O=(b.get(I.id)-(T.x-A)*m*D)*h,B=(_.get(I.id)-(T.y-R)*m*D)*h;b.set(I.id,O),_.set(I.id,B),S.set(I.id,{x:T.x+O,y:T.y+B})}}return R8(e,t,S,b,_,M,{restLength:x,springStrength:c,damping:h}),S}const j8=40,E8=3,w0=400,xp=6;function R8(e,t,n,a,i,r,l){for(let c=0;c<j8;c++){$d(e,n);for(let u=0;u<E8;u++)I8(e,t,n,a,i,r,l)}for(let c=0;c<w0&&$d(e,n);c++);}function $d(e,t){let n=!1;const a=new Map(e.map(i=>[i.id,{x:0,y:0}]));for(let i=0;i<e.length;i++)for(let r=i+1;r<e.length;r++){const l=e[i],c=e[r];if(l.pinned&&c.pinned)continue;const u=t.get(l.id),h=t.get(c.id),m=h.x-u.x,p=h.y-u.y,g=(l.width+c.width)/2-Math.abs(m),v=(l.height+c.height)/2-Math.abs(p);if(g<=0||v<=0)continue;n=!0;let x=0,b=0;g<v?x=(m>=0?1:-1)*g:b=(p>=0?1:-1)*v;let _=x/2,S=b/2;const M=Math.hypot(_,S);if(M>xp){const C=xp/M;_*=C,S*=C}l.pinned?(a.get(c.id).x+=_*2,a.get(c.id).y+=S*2):c.pinned?(a.get(l.id).x-=_*2,a.get(l.id).y-=S*2):(a.get(l.id).x-=_,a.get(l.id).y-=S,a.get(c.id).x+=_,a.get(c.id).y+=S)}for(const i of e){if(i.pinned)continue;const r=a.get(i.id);if(r.x===0&&r.y===0)continue;const l=t.get(i.id);t.set(i.id,{x:l.x+r.x,y:l.y+r.y})}return n}const H2=ks(2,14),L8=ks(2,15),yd=ks(2,25),T8=2*yd+1;class A8{constructor(t,n,a){Kt(this,"stats",{passes:0,pairChecks:0}),Kt(this,"finished",!1),Kt(this,"plain",!1),Kt(this,"n"),Kt(this,"px"),Kt(this,"py"),Kt(this,"w"),Kt(this,"h"),Kt(this,"isPinned"),Kt(this,"cellX"),Kt(this,"cellY"),Kt(this,"cellW"),Kt(this,"cellH"),Kt(this,"originX",0),Kt(this,"originY",0),Kt(this,"wide",!1),Kt(this,"grid",new Map),Kt(this,"hits",new Float64Array(1024)),Kt(this,"hitCount",0),Kt(this,"isMover"),Kt(this,"mx"),Kt(this,"my"),Kt(this,"overlapping",[]),Kt(this,"moved"),Kt(this,"nodes"),Kt(this,"pos"),Kt(this,"maxPasses"),this.nodes=t,this.pos=n,this.maxPasses=a;const i=this.n=t.length;this.px=new Float64Array(i),this.py=new Float64Array(i),this.w=new Float64Array(i),this.h=new Float64Array(i),this.isPinned=new Uint8Array(i),this.cellX=new Float64Array(i),this.cellY=new Float64Array(i),this.mx=new Float64Array(i),this.my=new Float64Array(i),this.isMover=new Uint8Array(i);let r=0,l=0;const c=new Set;for(let u=0;u<i;u++){const h=t[u],m=n.get(h.id);if(!(m!==void 0&&!c.has(h.id)&&Number.isFinite(m.x)&&Number.isFinite(m.y)&&Number.isFinite(h.width)&&Number.isFinite(h.height)&&h.width>=0&&h.height>=0)){this.plain=!0;break}c.add(h.id),this.px[u]=m.x,this.py[u]=m.y,this.w[u]=h.width,this.h[u]=h.height,this.isPinned[u]=h.pinned?1:0,r=Math.max(r,h.width),l=Math.max(l,h.height)}if(this.cellW=r*1.01+1,this.cellH=l*1.01+1,!this.plain&&i>0){this.originX=Math.floor(this.px[0]/this.cellW),this.originY=Math.floor(this.py[0]/this.cellH);for(let u=0;u<i&&!this.plain;u++)this.locate(u)||(this.plain=!0);if(!this.plain)for(let u=0;u<i;u++)this.insert(u)}}get done(){return this.finished}run(t=1/0){const n=this.stats.pairChecks;for(;!this.finished&&this.stats.pairChecks-n<t;){if(this.stats.passes>=this.maxPasses){this.finished=!0;break}if(this.stats.passes++,this.plain){this.stats.pairChecks+=this.n*(this.n-1)/2,$d(this.nodes,this.pos)||(this.finished=!0);continue}this.pass()}return this.finished}keyOf(t,n){return this.wide?(t+yd)*T8+(n+yd):(t-this.originX)*L8+(n-this.originY)}locate(t){const n=Math.floor(this.px[t]/this.cellW),a=Math.floor(this.py[t]/this.cellH);return Math.abs(n)<yd-1&&Math.abs(a)<yd-1?((Math.abs(n-this.originX)>=H2-1||Math.abs(a-this.originY)>=H2-1)&&(this.wide=!0),this.cellX[t]=n,this.cellY[t]=a,!0):!1}insert(t){const n=this.keyOf(this.cellX[t],this.cellY[t]),a=this.grid.get(n);a?a.push(t):this.grid.set(n,[t])}remove(t){const n=this.grid.get(this.keyOf(this.cellX[t],this.cellY[t]));n.splice(n.indexOf(t),1)}test(t,n){if(this.isPinned[t]&&this.isPinned[n])return;this.stats.pairChecks++;const{px:a,py:i,w:r,h:l}=this;if(!((r[t]+r[n])/2-Math.abs(a[n]-a[t])<=0||(l[t]+l[n])/2-Math.abs(i[n]-i[t])<=0)){if(this.hitCount===this.hits.length){const c=new Float64Array(this.hits.length*2);c.set(this.hits),this.hits=c}this.hits[this.hitCount++]=t*this.n+n}}testNeighbours(t,n){const a=this.cellX[t],i=this.cellY[t];for(let r=a-1;r<=a+1;r++)for(let l=i-1;l<=i+1;l++){const c=this.grid.get(this.keyOf(r,l));if(c)for(const u of c)u===t||n(u)||(t<u?this.test(t,u):this.test(u,t))}}pass(){const{n:t,px:n,py:a,w:i,h:r,isPinned:l,mx:c,my:u}=this;this.hitCount=0;const h=this.moved;if(h){const b=this.isMover;for(const _ of h)b[_]=1;for(const _ of this.overlapping){let S=Math.floor(_/t);S*t>_&&S--;const M=_-S*t;!b[S]&&!b[M]&&this.test(S,M)}for(const _ of h)this.testNeighbours(_,S=>b[S]===1&&S<_);for(const _ of h)b[_]=0}else for(let b=0;b<t;b++)this.testNeighbours(b,_=>_<b);const m=this.hits.subarray(0,this.hitCount).sort(),p=[],g=[];for(let b=0;b<m.length;b++){const _=m[b];let S=Math.floor(_/t);S*t>_&&S--;const M=_-S*t;p.push(_);const C=n[M]-n[S],k=a[M]-a[S],L=(i[S]+i[M])/2-Math.abs(C),E=(r[S]+r[M])/2-Math.abs(k);let I=0,T=0;L<E?I=(C>=0?1:-1)*L:T=(k>=0?1:-1)*E;let A=I/2,R=T/2;const D=Math.hypot(A,R);if(D>xp){const O=xp/D;A*=O,R*=O}g.push(S,M),l[S]?(c[M]+=A*2,u[M]+=R*2):l[M]?(c[S]-=A*2,u[S]-=R*2):(c[S]-=A,u[S]-=R,c[M]+=A,u[M]+=R)}const v=[];for(const b of g){if(l[b]||c[b]===0&&u[b]===0)continue;const _=n[b]+c[b],S=a[b]+u[b];c[b]=0,u[b]=0,this.pos.set(this.nodes[b].id,{x:_,y:S}),!(_===n[b]&&S===a[b])&&(n[b]=_,a[b]=S,v.push(b))}for(const b of g)c[b]=0,u[b]=0;if(this.overlapping=p,this.moved=v,p.length===0||v.length===0){this.finished=!0;return}for(const b of v)this.remove(b);const x=this.wide;for(const b of v)if(!this.locate(b)){this.plain=!0;return}if(this.wide===x)for(const b of v)this.insert(b);else{this.grid.clear();for(let b=0;b<t;b++)this.insert(b)}}}function I8(e,t,n,a,i,r,{restLength:l,springStrength:c,damping:u}){for(const h of t){const m=r.get(h.source),p=r.get(h.target);if(!m||!p||m.pinned&&p.pinned)continue;const g=n.get(m.id),v=n.get(p.id),x=v.x-g.x||.1,b=v.y-g.y||.1,_=Math.max(Math.hypot(x,b),1),S=c*(_-l(m,p)),M=x/_*S,C=b/_*S;m.pinned||(a.set(m.id,a.get(m.id)+M),i.set(m.id,i.get(m.id)+C)),p.pinned||(a.set(p.id,a.get(p.id)-M),i.set(p.id,i.get(p.id)-C))}for(const h of e){if(h.pinned)continue;const m=n.get(h.id),p=a.get(h.id)*u,g=i.get(h.id)*u;a.set(h.id,p),i.set(h.id,g),n.set(h.id,{x:m.x+p,y:m.y+g})}}const D8=1.2,O8=160,z8=160,B8=8e3,$8=8,U8=60;function F8(e){const t=new Map,n=(a,i)=>{if(!a.children){t.set(a.id,i);return}for(const r of a.children)n(r,i)};for(const a of e)n(a,a.id);return t}function P8(e,t,n={}){var U,F,Y,X,ne,q,he,pe,H,te;var a,i,r,l,c,u,h;if(e.length===0)return{positions:new Map,clusterBoundaries:new Map};const m=new Map(e.map(ie=>[ie.id,ie])),p=P5(e.map(ie=>ie.id),t),g=ie=>{const W=m.get(ie);return W?Math.hypot(W.width,W.height)/2:20},v=M8(p,{radiusOf:g,padding:n.clusterPadding}),x=(U=p.children)!=null?U:[],b=F8(x),_=ie=>{var W;return(W=b.get(ie))!=null?W:ie},S=new Map;for(const ie of e){const W=_(ie.id);S.has(W)||S.set(W,[]),S.get(W).push(ie)}const M=new Map;for(const ie of t){if(!m.has(ie.source)||!m.has(ie.target))continue;const W=_(ie.source);W===_(ie.target)&&(M.has(W)||M.set(W,[]),M.get(W).push(ie))}const C=new Map,k=new Map;for(const[ie,W]of S){const ge=v.get(ie),we=W.map(ye=>{const Ae=v.get(ye.id);return ee($({},ye),{pinned:!1,gravityTarget:void 0,gravityStrength:void 0,x:Ae&&ge&&Ae!==ge?Ae.x-ge.x:0,y:Ae&&ge&&Ae!==ge?Ae.y-ge.y:0})}),je=Kv(we,(F=M.get(ie))!=null?F:[],n);let De=1/0,re=-1/0,Z=1/0,J=-1/0;for(const ye of W){const Ae=je.get(ye.id);De=Math.min(De,Ae.x-ye.width/2),re=Math.max(re,Ae.x+ye.width/2),Z=Math.min(Z,Ae.y-ye.height/2),J=Math.max(J,Ae.y+ye.height/2)}const K=(De+re)/2,Q=(Z+J)/2;let ae=0;for(const ye of W){const Ae=je.get(ye.id),de={x:Ae.x-K,y:Ae.y-Q};je.set(ye.id,de),ae=Math.max(ae,Math.hypot(de.x,de.y)+g(ye.id))}C.set(ie,je),k.set(ie,ae)}const L=[...S.keys()].map(ie=>{var we;const W=(we=v.get(ie))!=null?we:{x:0,y:0},ge=k.get(ie);return{id:ie,x:W.x,y:W.y,width:ge*2,height:ge*2}}),E=new Map,I=[];for(const ie of t){if(!m.has(ie.source)||!m.has(ie.target))continue;const W=_(ie.source),ge=_(ie.target);if(W===ge)continue;const we=W<ge?`${W}\0${ge}`:`${ge}\0${W}`,je=(Y=E.get(we))!=null?Y:0;je>=$8||(E.set(we,je+1),I.push({source:W,target:ge}))}const T=L.reduce((ie,W)=>Math.max(ie,W.width),0),A=(X=(a=n.macro)==null?void 0:a.springLength)!=null?X:Math.max(T*D8,O8),R=ks(A/z8,2),D={iterations:(ne=(i=n.macro)==null?void 0:i.iterations)!=null?ne:300,springLength:A,springStrength:(q=(r=n.macro)==null?void 0:r.springStrength)!=null?q:.04,repulsion:(he=(l=n.macro)==null?void 0:l.repulsion)!=null?he:B8*R,damping:(pe=(c=n.macro)==null?void 0:c.damping)!=null?pe:.85,centerStrength:(H=(u=n.macro)==null?void 0:u.centerStrength)!=null?H:.005,nodeMargin:(te=(h=n.macro)==null?void 0:h.nodeMargin)!=null?te:U8},O=Kv(L,I,D);q8(C,O,t,_,m);const B=new Map;for(const[ie,W]of C){const ge=O.get(ie);for(const[we,je]of W)B.set(we,{x:ge.x+je.x,y:ge.y+je.y})}for(const ie of e)ie.pinned&&B.set(ie.id,{x:ie.x,y:ie.y});for(let ie=0;ie<w0&&$d(e,B);ie++);const z=V8(e,B,b,g);return{positions:B,clusterBoundaries:z}}const q2=24,H8=2;function q8(e,t,n,a,i){const r=new Map;for(const c of n){if(!i.has(c.source)||!i.has(c.target))continue;const u=a(c.source),h=a(c.target);u!==h&&(r.has(u)||r.set(u,[]),r.has(h)||r.set(h,[]),r.get(u).push([c.source,c.target,h]),r.get(h).push([c.target,c.source,u]))}const l=(c,u)=>{const h=t.get(c),m=e.get(c).get(u);return{x:h.x+m.x,y:h.y+m.y}};for(let c=0;c<H8;c++)for(const[u,h]of r){const m=e.get(u);if(m.size<2)continue;const p=t.get(u),g=h.map(([x,b,_])=>({own:x,at:l(_,b)}));let v={cos:1,sin:0,mirror:1,cost:1/0};for(const x of[1,-1])for(let b=0;b<q2;b++){const _=2*Math.PI*b/q2,S=Math.cos(_),M=Math.sin(_);let C=0;for(const{own:k,at:L}of g){const E=m.get(k),I=E.x*x;C+=Math.hypot(p.x+I*S-E.y*M-L.x,p.y+I*M+E.y*S-L.y)}C<v.cost-1e-6&&(v={cos:S,sin:M,mirror:x,cost:C})}if(!(v.cos===1&&v.mirror===1))for(const[x,b]of m){const _=b.x*v.mirror;m.set(x,{x:_*v.cos-b.y*v.sin,y:_*v.sin+b.y*v.cos})}}}function V8(e,t,n,a,i=!1){const r=new Map;for(const c of e){const u=n.get(c.id);u&&(r.has(u)||r.set(u,[]),r.get(u).push(c))}const l=new Map;for(const[c,u]of r){let h,m;const p=i?t.get(c):void 0;if(p)h=p.x,m=p.y;else{h=0,m=0;for(const v of u){const x=t.get(v.id);x&&(h+=x.x,m+=x.y)}h/=u.length,m/=u.length}let g=0;for(const v of u){const x=t.get(v.id);x&&(g=Math.max(g,Math.hypot(x.x-h,x.y-m)+a(v.id)))}l.set(c,{x:h,y:m,r:g})}return l}const cr=11102230246251565e-32,Da=134217729,Y8=(3+8*cr)*cr;function Py(e,t,n,a,i){let r,l,c,u,h=t[0],m=a[0],p=0,g=0;m>h==m>-h?(r=h,h=t[++p]):(r=m,m=a[++g]);let v=0;if(p<e&&g<n)for(m>h==m>-h?(l=h+r,c=r-(l-h),h=t[++p]):(l=m+r,c=r-(l-m),m=a[++g]),r=l,c!==0&&(i[v++]=c);p<e&&g<n;)m>h==m>-h?(l=r+h,u=l-r,c=r-(l-u)+(h-u),h=t[++p]):(l=r+m,u=l-r,c=r-(l-u)+(m-u),m=a[++g]),r=l,c!==0&&(i[v++]=c);for(;p<e;)l=r+h,u=l-r,c=r-(l-u)+(h-u),h=t[++p],r=l,c!==0&&(i[v++]=c);for(;g<n;)l=r+m,u=l-r,c=r-(l-u)+(m-u),m=a[++g],r=l,c!==0&&(i[v++]=c);return(r!==0||v===0)&&(i[v++]=r),v}function G8(e,t){let n=t[0];for(let a=1;a<e;a++)n+=t[a];return n}function eh(e){return new Float64Array(e)}const K8=(3+16*cr)*cr,Q8=(2+12*cr)*cr,X8=(9+64*cr)*cr*cr,pc=eh(4),V2=eh(8),Y2=eh(12),G2=eh(16),Va=eh(4);function Z8(e,t,n,a,i,r,l){let c,u,h,m,p,g,v,x,b,_,S,M,C,k,L,E,I,T;const A=e-i,R=n-i,D=t-r,O=a-r;k=A*O,g=Da*A,v=g-(g-A),x=A-v,g=Da*O,b=g-(g-O),_=O-b,L=x*_-(k-v*b-x*b-v*_),E=D*R,g=Da*D,v=g-(g-D),x=D-v,g=Da*R,b=g-(g-R),_=R-b,I=x*_-(E-v*b-x*b-v*_),S=L-I,p=L-S,pc[0]=L-(S+p)+(p-I),M=k+S,p=M-k,C=k-(M-p)+(S-p),S=C-E,p=C-S,pc[1]=C-(S+p)+(p-E),T=M+S,p=T-M,pc[2]=M-(T-p)+(S-p),pc[3]=T;let B=G8(4,pc),z=Q8*l;if(B>=z||-B>=z||(p=e-A,c=e-(A+p)+(p-i),p=n-R,h=n-(R+p)+(p-i),p=t-D,u=t-(D+p)+(p-r),p=a-O,m=a-(O+p)+(p-r),c===0&&u===0&&h===0&&m===0)||(z=X8*l+Y8*Math.abs(B),B+=A*m+O*c-(D*h+R*u),B>=z||-B>=z))return B;k=c*O,g=Da*c,v=g-(g-c),x=c-v,g=Da*O,b=g-(g-O),_=O-b,L=x*_-(k-v*b-x*b-v*_),E=u*R,g=Da*u,v=g-(g-u),x=u-v,g=Da*R,b=g-(g-R),_=R-b,I=x*_-(E-v*b-x*b-v*_),S=L-I,p=L-S,Va[0]=L-(S+p)+(p-I),M=k+S,p=M-k,C=k-(M-p)+(S-p),S=C-E,p=C-S,Va[1]=C-(S+p)+(p-E),T=M+S,p=T-M,Va[2]=M-(T-p)+(S-p),Va[3]=T;const U=Py(4,pc,4,Va,V2);k=A*m,g=Da*A,v=g-(g-A),x=A-v,g=Da*m,b=g-(g-m),_=m-b,L=x*_-(k-v*b-x*b-v*_),E=D*h,g=Da*D,v=g-(g-D),x=D-v,g=Da*h,b=g-(g-h),_=h-b,I=x*_-(E-v*b-x*b-v*_),S=L-I,p=L-S,Va[0]=L-(S+p)+(p-I),M=k+S,p=M-k,C=k-(M-p)+(S-p),S=C-E,p=C-S,Va[1]=C-(S+p)+(p-E),T=M+S,p=T-M,Va[2]=M-(T-p)+(S-p),Va[3]=T;const F=Py(U,V2,4,Va,Y2);k=c*m,g=Da*c,v=g-(g-c),x=c-v,g=Da*m,b=g-(g-m),_=m-b,L=x*_-(k-v*b-x*b-v*_),E=u*h,g=Da*u,v=g-(g-u),x=u-v,g=Da*h,b=g-(g-h),_=h-b,I=x*_-(E-v*b-x*b-v*_),S=L-I,p=L-S,Va[0]=L-(S+p)+(p-I),M=k+S,p=M-k,C=k-(M-p)+(S-p),S=C-E,p=C-S,Va[1]=C-(S+p)+(p-E),T=M+S,p=T-M,Va[2]=M-(T-p)+(S-p),Va[3]=T;const Y=Py(F,Y2,4,Va,G2);return G2[Y-1]}function Ef(e,t,n,a,i,r){const l=(t-r)*(n-i),c=(e-i)*(a-r),u=l-c,h=Math.abs(l+c);return Math.abs(u)>=K8*h?u:-Z8(e,t,n,a,i,r,h)}const K2=Math.pow(2,-52),Rf=new Uint32Array(512);class bp{static from(t,n=nB,a=aB){const i=t.length,r=new Float64Array(i*2);for(let l=0;l<i;l++){const c=t[l];r[2*l]=n(c),r[2*l+1]=a(c)}return new bp(r)}constructor(t){const n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const a=Math.max(2*n-5,0);this._triangles=new Uint32Array(a*3),this._halfedges=new Int32Array(a*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:a,_hullTri:i,_hullHash:r}=this,l=t.length>>1;let c=1/0,u=1/0,h=-1/0,m=-1/0;for(let A=0;A<l;A++){const R=t[2*A],D=t[2*A+1];R<c&&(c=R),D<u&&(u=D),R>h&&(h=R),D>m&&(m=D),this._ids[A]=A}const p=(c+h)/2,g=(u+m)/2;let v=0,x=0,b=0;for(let A=0,R=1/0;A<l;A++){const D=Hy(p,g,t[2*A],t[2*A+1]);D<R&&(v=A,R=D)}const _=t[2*v],S=t[2*v+1];for(let A=0,R=1/0;A<l;A++){if(A===v)continue;const D=Hy(_,S,t[2*A],t[2*A+1]);D<R&&D>0&&(x=A,R=D)}let M=t[2*x],C=t[2*x+1],k=1/0;for(let A=0;A<l;A++){if(A===v||A===x)continue;const R=eB(_,S,M,C,t[2*A],t[2*A+1]);R<k&&(b=A,k=R)}let L=t[2*b],E=t[2*b+1];if(k===1/0){for(let D=0;D<l;D++)this._dists[D]=t[2*D]-t[0]||t[2*D+1]-t[1];Sc(this._ids,this._dists,0,l-1);const A=new Uint32Array(l);let R=0;for(let D=0,O=-1/0;D<l;D++){const B=this._ids[D],z=this._dists[B];z>O&&(A[R++]=B,O=z)}this.hull=A.subarray(0,R),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(Ef(_,S,M,C,L,E)<0){const A=x,R=M,D=C;x=b,M=L,C=E,b=A,L=R,E=D}const I=tB(_,S,M,C,L,E);this._cx=I.x,this._cy=I.y;for(let A=0;A<l;A++)this._dists[A]=Hy(t[2*A],t[2*A+1],I.x,I.y);Sc(this._ids,this._dists,0,l-1),this._hullStart=v;let T=3;a[v]=n[b]=x,a[x]=n[v]=b,a[b]=n[x]=v,i[v]=0,i[x]=1,i[b]=2,r.fill(-1),r[this._hashKey(_,S)]=v,r[this._hashKey(M,C)]=x,r[this._hashKey(L,E)]=b,this.trianglesLen=0,this._addTriangle(v,x,b,-1,-1,-1);for(let A=0,R=0,D=0;A<this._ids.length;A++){const O=this._ids[A],B=t[2*O],z=t[2*O+1];if(A>0&&Math.abs(B-R)<=K2&&Math.abs(z-D)<=K2||(R=B,D=z,O===v||O===x||O===b))continue;let U=0;for(let q=0,he=this._hashKey(B,z);q<this._hashSize&&(U=r[(he+q)%this._hashSize],!(U!==-1&&U!==a[U]));q++);U=n[U];let F=U,Y;for(;Y=a[F],Ef(B,z,t[2*F],t[2*F+1],t[2*Y],t[2*Y+1])>=0;)if(F=Y,F===U){F=-1;break}if(F===-1)continue;let X=this._addTriangle(F,O,a[F],-1,-1,i[F]);i[O]=this._legalize(X+2),i[F]=X,T++;let ne=a[F];for(;Y=a[ne],Ef(B,z,t[2*ne],t[2*ne+1],t[2*Y],t[2*Y+1])<0;)X=this._addTriangle(ne,O,Y,i[O],-1,i[ne]),i[O]=this._legalize(X+2),a[ne]=ne,T--,ne=Y;if(F===U)for(;Y=n[F],Ef(B,z,t[2*Y],t[2*Y+1],t[2*F],t[2*F+1])<0;)X=this._addTriangle(Y,O,F,-1,i[F],i[Y]),this._legalize(X+2),i[Y]=X,a[F]=F,T--,F=Y;this._hullStart=n[O]=F,a[F]=n[ne]=O,a[O]=ne,r[this._hashKey(B,z)]=O,r[this._hashKey(t[2*F],t[2*F+1])]=F}this.hull=new Uint32Array(T);for(let A=0,R=this._hullStart;A<T;A++)this.hull[A]=R,R=a[R];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(J8(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:a,coords:i}=this;let r=0,l=0;for(;;){const c=a[t],u=t-t%3;if(l=u+(t+2)%3,c===-1){if(r===0)break;t=Rf[--r];continue}const h=c-c%3,m=u+(t+1)%3,p=h+(c+2)%3,g=n[l],v=n[t],x=n[m],b=n[p];if(W8(i[2*g],i[2*g+1],i[2*v],i[2*v+1],i[2*x],i[2*x+1],i[2*b],i[2*b+1])){n[t]=b,n[c]=g;const _=a[p];if(_===-1){let M=this._hullStart;do{if(this._hullTri[M]===p){this._hullTri[M]=t;break}M=this._hullPrev[M]}while(M!==this._hullStart)}this._link(t,_),this._link(c,a[l]),this._link(l,p);const S=h+(c+1)%3;r<Rf.length&&(Rf[r++]=S)}else{if(r===0)break;t=Rf[--r]}}return l}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,a,i,r,l){const c=this.trianglesLen;return this._triangles[c]=t,this._triangles[c+1]=n,this._triangles[c+2]=a,this._link(c,i),this._link(c+1,r),this._link(c+2,l),this.trianglesLen+=3,c}}function J8(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function Hy(e,t,n,a){const i=e-n,r=t-a;return i*i+r*r}function W8(e,t,n,a,i,r,l,c){const u=e-l,h=t-c,m=n-l,p=a-c,g=i-l,v=r-c,x=u*u+h*h,b=m*m+p*p,_=g*g+v*v;return u*(p*_-b*v)-h*(m*_-b*g)+x*(m*v-p*g)<0}function eB(e,t,n,a,i,r){const l=n-e,c=a-t,u=i-e,h=r-t,m=l*l+c*c,p=u*u+h*h,g=.5/(l*h-c*u),v=(h*m-c*p)*g,x=(l*p-u*m)*g;return v*v+x*x}function tB(e,t,n,a,i,r){const l=n-e,c=a-t,u=i-e,h=r-t,m=l*l+c*c,p=u*u+h*h,g=.5/(l*h-c*u),v=e+(h*m-c*p)*g,x=t+(l*p-u*m)*g;return{x:v,y:x}}function Sc(e,t,n,a){if(a-n<=20)for(let i=n+1;i<=a;i++){const r=e[i],l=t[r];let c=i-1;for(;c>=n&&t[e[c]]>l;)e[c+1]=e[c--];e[c+1]=r}else{const i=n+a>>1;let r=n+1,l=a;ud(e,i,r),t[e[n]]>t[e[a]]&&ud(e,n,a),t[e[r]]>t[e[a]]&&ud(e,r,a),t[e[n]]>t[e[r]]&&ud(e,n,r);const c=e[r],u=t[c];for(;;){do r++;while(t[e[r]]<u);do l--;while(t[e[l]]>u);if(l<r)break;ud(e,r,l)}e[n+1]=e[l],e[l]=c,a-r+1>=l-n?(Sc(e,t,r,a),Sc(e,t,n,l-1)):(Sc(e,t,n,l-1),Sc(e,t,r,a))}}function ud(e,t,n){const a=e[t];e[t]=e[n],e[n]=a}function nB(e){return e[0]}function aB(e){return e[1]}const Q2=1e-6;class Zo{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,a){t=+t,n=+n,a=+a;const i=t+a,r=n;if(a<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${r}`:(Math.abs(this._x1-i)>Q2||Math.abs(this._y1-r)>Q2)&&(this._+="L"+i+","+r),a&&(this._+=`A${a},${a},0,1,1,${t-a},${n}A${a},${a},0,1,1,${this._x1=i},${this._y1=r}`)}rect(t,n,a,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+a}v${+i}h${-a}Z`}value(){return this._||null}}class Qv{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}class sB{constructor(t,[n,a,i,r]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((r=+r)>=(a=+a)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=r,this.ymin=a,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:a},vectors:i}=this;let r,l;const c=this.circumcenters=this._circumcenters.subarray(0,a.length/3*2);for(let b=0,_=0,S=a.length,M,C;b<S;b+=3,_+=2){const k=a[b]*2,L=a[b+1]*2,E=a[b+2]*2,I=t[k],T=t[k+1],A=t[L],R=t[L+1],D=t[E],O=t[E+1],B=A-I,z=R-T,U=D-I,F=O-T,Y=(B*F-z*U)*2;if(Math.abs(Y)<1e-9){if(r===void 0){r=l=0;for(const ne of n)r+=t[ne*2],l+=t[ne*2+1];r/=n.length,l/=n.length}const X=1e9*Math.sign((r-I)*F-(l-T)*U);M=(I+D)/2-X*F,C=(T+O)/2+X*U}else{const X=1/Y,ne=B*B+z*z,q=U*U+F*F;M=I+(F*ne-z*q)*X,C=T+(B*q-U*ne)*X}c[_]=M,c[_+1]=C}let u=n[n.length-1],h,m=u*4,p,g=t[2*u],v,x=t[2*u+1];i.fill(0);for(let b=0;b<n.length;++b)u=n[b],h=m,p=g,v=x,m=u*4,g=t[2*u],x=t[2*u+1],i[h+2]=i[m]=v-x,i[h+3]=i[m+1]=g-p}render(t){const n=t==null?t=new Zo:void 0,{delaunay:{halfedges:a,inedges:i,hull:r},circumcenters:l,vectors:c}=this;if(r.length<=1)return null;for(let m=0,p=a.length;m<p;++m){const g=a[m];if(g<m)continue;const v=Math.floor(m/3)*2,x=Math.floor(g/3)*2,b=l[v],_=l[v+1],S=l[x],M=l[x+1];this._renderSegment(b,_,S,M,t)}let u,h=r[r.length-1];for(let m=0;m<r.length;++m){u=h,h=r[m];const p=Math.floor(i[h]/3)*2,g=l[p],v=l[p+1],x=u*4,b=this._project(g,v,c[x+2],c[x+3]);b&&this._renderSegment(g,v,b[0],b[1],t)}return n&&n.value()}renderBounds(t){const n=t==null?t=new Zo:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const a=n==null?n=new Zo:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let r=i.length;for(;i[0]===i[r-2]&&i[1]===i[r-1]&&r>1;)r-=2;for(let l=2;l<r;l+=2)(i[l]!==i[l-2]||i[l+1]!==i[l-1])&&n.lineTo(i[l],i[l+1]);return n.closePath(),a&&a.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,a=t.length/2;n<a;++n){const i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){const n=new Qv;return this.renderCell(t,n),n.value()}_renderSegment(t,n,a,i,r){let l;const c=this._regioncode(t,n),u=this._regioncode(a,i);c===0&&u===0?(r.moveTo(t,n),r.lineTo(a,i)):(l=this._clipSegment(t,n,a,i,c,u))&&(r.moveTo(l[0],l[1]),r.lineTo(l[2],l[3]))}contains(t,n,a){return n=+n,n!==n||(a=+a,a!==a)?!1:this.delaunay._step(t,n,a)===t}*neighbors(t){const n=this._clip(t);if(n)for(const a of this.delaunay.neighbors(t)){const i=this._clip(a);if(i){e:for(let r=0,l=n.length;r<l;r+=2)for(let c=0,u=i.length;c<u;c+=2)if(n[r]===i[c]&&n[r+1]===i[c+1]&&n[(r+2)%l]===i[(c+u-2)%u]&&n[(r+3)%l]===i[(c+u-1)%u]){yield a;break e}}}}_cell(t){const{circumcenters:n,delaunay:{inedges:a,halfedges:i,triangles:r}}=this,l=a[t];if(l===-1)return null;const c=[];let u=l;do{const h=Math.floor(u/3);if(c.push(n[h*2],n[h*2+1]),u=u%3===2?u-2:u+1,r[u]!==t)break;u=i[u]}while(u!==l&&u!==-1);return c}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(n===null)return null;const{vectors:a}=this,i=t*4;return this._simplify(a[i]||a[i+1]?this._clipInfinite(t,n,a[i],a[i+1],a[i+2],a[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){const a=n.length;let i=null,r,l,c=n[a-2],u=n[a-1],h,m=this._regioncode(c,u),p,g=0;for(let v=0;v<a;v+=2)if(r=c,l=u,c=n[v],u=n[v+1],h=m,m=this._regioncode(c,u),h===0&&m===0)p=g,g=0,i?i.push(c,u):i=[c,u];else{let x,b,_,S,M;if(h===0){if((x=this._clipSegment(r,l,c,u,h,m))===null)continue;[b,_,S,M]=x}else{if((x=this._clipSegment(c,u,r,l,m,h))===null)continue;[S,M,b,_]=x,p=g,g=this._edgecode(b,_),p&&g&&this._edge(t,p,g,i,i.length),i?i.push(b,_):i=[b,_]}p=g,g=this._edgecode(S,M),p&&g&&this._edge(t,p,g,i,i.length),i?i.push(S,M):i=[S,M]}if(i)p=g,g=this._edgecode(i[0],i[1]),p&&g&&this._edge(t,p,g,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,a,i,r,l){const c=r<l;for(c&&([t,n,a,i,r,l]=[a,i,t,n,l,r]);;){if(r===0&&l===0)return c?[a,i,t,n]:[t,n,a,i];if(r&l)return null;let u,h,m=r||l;m&8?(u=t+(a-t)*(this.ymax-n)/(i-n),h=this.ymax):m&4?(u=t+(a-t)*(this.ymin-n)/(i-n),h=this.ymin):m&2?(h=n+(i-n)*(this.xmax-t)/(a-t),u=this.xmax):(h=n+(i-n)*(this.xmin-t)/(a-t),u=this.xmin),r?(t=u,n=h,r=this._regioncode(t,n)):(a=u,i=h,l=this._regioncode(a,i))}}_clipInfinite(t,n,a,i,r,l){let c=Array.from(n),u;if((u=this._project(c[0],c[1],a,i))&&c.unshift(u[0],u[1]),(u=this._project(c[c.length-2],c[c.length-1],r,l))&&c.push(u[0],u[1]),c=this._clipFinite(t,c))for(let h=0,m=c.length,p,g=this._edgecode(c[m-2],c[m-1]);h<m;h+=2)p=g,g=this._edgecode(c[h],c[h+1]),p&&g&&(h=this._edge(t,p,g,c,h),m=c.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(c=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return c}_edge(t,n,a,i,r){for(;n!==a;){let l,c;switch(n){case 5:n=4;continue;case 4:n=6,l=this.xmax,c=this.ymin;break;case 6:n=2;continue;case 2:n=10,l=this.xmax,c=this.ymax;break;case 10:n=8;continue;case 8:n=9,l=this.xmin,c=this.ymax;break;case 9:n=1;continue;case 1:n=5,l=this.xmin,c=this.ymin;break}(i[r]!==l||i[r+1]!==c)&&this.contains(t,l,c)&&(i.splice(r,0,l,c),r+=2)}return r}_project(t,n,a,i){let r=1/0,l,c,u;if(i<0){if(n<=this.ymin)return null;(l=(this.ymin-n)/i)<r&&(u=this.ymin,c=t+(r=l)*a)}else if(i>0){if(n>=this.ymax)return null;(l=(this.ymax-n)/i)<r&&(u=this.ymax,c=t+(r=l)*a)}if(a>0){if(t>=this.xmax)return null;(l=(this.xmax-t)/a)<r&&(c=this.xmax,u=n+(r=l)*i)}else if(a<0){if(t<=this.xmin)return null;(l=(this.xmin-t)/a)<r&&(c=this.xmin,u=n+(r=l)*i)}return[c,u]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const a=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[a]&&t[a]===t[i]||t[n+1]===t[a+1]&&t[a+1]===t[i+1])&&(t.splice(a,2),n-=2)}t.length||(t=null)}return t}}const iB=2*Math.PI,mc=Math.pow;function rB(e){return e[0]}function oB(e){return e[1]}function lB(e){const{triangles:t,coords:n}=e;for(let a=0;a<t.length;a+=3){const i=2*t[a],r=2*t[a+1],l=2*t[a+2];if((n[l]-n[i])*(n[r+1]-n[i+1])-(n[r]-n[i])*(n[l+1]-n[i+1])>1e-10)return!1}return!0}function cB(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class S0{static from(t,n=rB,a=oB,i){return new S0("length"in t?uB(t,n,a,i):Float64Array.from(dB(t,n,a,i)))}constructor(t){this._delaunator=new bp(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&lB(t)){this.collinear=Int32Array.from({length:n.length/2},(g,v)=>v).sort((g,v)=>n[2*g]-n[2*v]||n[2*g+1]-n[2*v+1]);const u=this.collinear[0],h=this.collinear[this.collinear.length-1],m=[n[2*u],n[2*u+1],n[2*h],n[2*h+1]],p=1e-8*Math.hypot(m[3]-m[1],m[2]-m[0]);for(let g=0,v=n.length/2;g<v;++g){const x=cB(n[2*g],n[2*g+1],p);n[2*g]=x[0],n[2*g+1]=x[1]}this._delaunator=new bp(n)}else delete this.collinear;const a=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,r=this.triangles=this._delaunator.triangles,l=this.inedges.fill(-1),c=this._hullIndex.fill(-1);for(let u=0,h=a.length;u<h;++u){const m=r[u%3===2?u-2:u+1];(a[u]===-1||l[m]===-1)&&(l[m]=u)}for(let u=0,h=i.length;u<h;++u)c[i[u]]=u;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],l[i[0]]=1,i.length===2&&(l[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new sB(this,t)}*neighbors(t){const{inedges:n,hull:a,_hullIndex:i,halfedges:r,triangles:l,collinear:c}=this;if(c){const p=c.indexOf(t);p>0&&(yield c[p-1]),p<c.length-1&&(yield c[p+1]);return}const u=n[t];if(u===-1)return;let h=u,m=-1;do{if(yield m=l[h],h=h%3===2?h-2:h+1,l[h]!==t)return;if(h=r[h],h===-1){const p=a[(i[t]+1)%a.length];p!==m&&(yield p);return}}while(h!==u)}find(t,n,a=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;const i=a;let r;for(;(r=this._step(a,t,n))>=0&&r!==a&&r!==i;)a=r;return r}_step(t,n,a){const{inedges:i,hull:r,_hullIndex:l,halfedges:c,triangles:u,points:h}=this;if(i[t]===-1||!h.length)return(t+1)%(h.length>>1);let m=t,p=mc(n-h[t*2],2)+mc(a-h[t*2+1],2);const g=i[t];let v=g;do{let x=u[v];const b=mc(n-h[x*2],2)+mc(a-h[x*2+1],2);if(b<p&&(p=b,m=x),v=v%3===2?v-2:v+1,u[v]!==t)break;if(v=c[v],v===-1){if(v=r[(l[t]+1)%r.length],v!==x&&mc(n-h[v*2],2)+mc(a-h[v*2+1],2)<p)return v;break}}while(v!==g);return m}render(t){const n=t==null?t=new Zo:void 0,{points:a,halfedges:i,triangles:r}=this;for(let l=0,c=i.length;l<c;++l){const u=i[l];if(u<l)continue;const h=r[l]*2,m=r[u]*2;t.moveTo(a[h],a[h+1]),t.lineTo(a[m],a[m+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;const a=t==null?t=new Zo:void 0,{points:i}=this;for(let r=0,l=i.length;r<l;r+=2){const c=i[r],u=i[r+1];t.moveTo(c+n,u),t.arc(c,u,n,0,iB)}return a&&a.value()}renderHull(t){const n=t==null?t=new Zo:void 0,{hull:a,points:i}=this,r=a[0]*2,l=a.length;t.moveTo(i[r],i[r+1]);for(let c=1;c<l;++c){const u=2*a[c];t.lineTo(i[u],i[u+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new Qv;return this.renderHull(t),t.value()}renderTriangle(t,n){const a=n==null?n=new Zo:void 0,{points:i,triangles:r}=this,l=r[t*=3]*2,c=r[t+1]*2,u=r[t+2]*2;return n.moveTo(i[l],i[l+1]),n.lineTo(i[c],i[c+1]),n.lineTo(i[u],i[u+1]),n.closePath(),a&&a.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,a=t.length/3;n<a;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new Qv;return this.renderTriangle(t,n),n.value()}}function uB(e,t,n,a){const i=e.length,r=new Float64Array(i*2);for(let l=0;l<i;++l){const c=e[l];r[l*2]=t.call(a,c,l,e),r[l*2+1]=n.call(a,c,l,e)}return r}function*dB(e,t,n,a){let i=0;for(const r of e)yield t.call(a,r,i,e),yield n.call(a,r,i,e),++i}const hB=600,fB=50,pB=120,mB=50,gB=20,yB=1.001,vB=50,xB=25,bB=4,_B=20,wB=10,SB=30,NB=1.5,kB=300;function CB(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0)/4294967296}const _p=e=>{const t=CB(e)*2*Math.PI;return{x:Math.cos(t),y:Math.sin(t)}};function Qc(e,t,n){return Math.abs(e.x-t.x)<(e.w+t.w)/2+n&&Math.abs(e.y-t.y)<(e.h+t.h)/2+n}function Ud(e,t,n){const a=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y),r=a>1e-9?((e.w+t.w)/2+n)/a:1/0,l=i>1e-9?((e.h+t.h)/2+n)/i:1/0;return r>1&&l>1?Math.min(Math.min(r,l)*yB,vB):1}function vM(e,t,n={}){var he,pe,H,te,ie,W,ge,we,je,De,re,Z,J,K;const a=((he=n.preferredEdgeLength)!=null?he:160)*(1.25-.5*Math.min(1,Math.max(0,(pe=n.compactness)!=null?pe:.5))),i=(H=n.minimumNodeDistance)!=null?H:24,r=(te=n.maxIterations)!=null?te:300,l=(ie=n.tolerance)!=null?ie:1e-4,c=(W=n.componentSpacing)!=null?W:40,u=[...e].sort((Q,ae)=>Q.id<ae.id?-1:Q.id>ae.id?1:0),h=u.length,m=new Map;u.forEach((Q,ae)=>m.set(Q.id,ae));const p=u.map(()=>[]),g=new Set,v=new Map,x=new Map;for(const Q of t){const ae=m.get(Q.source),ye=m.get(Q.target);if(ae===void 0||ye===void 0||ae===ye)continue;const Ae=ae<ye?`${ae}|${ye}`:`${ye}|${ae}`;if(Number.isFinite(Q.length)&&Q.length>0&&v.set(Ae,Math.max((ge=v.get(Ae))!=null?ge:0,Q.length)),Q.label&&Q.label.width>0&&Q.label.height>0){const de=x.get(`${ae}>${ye}`);x.set(`${ae}>${ye}`,{a:ae,b:ye,w:Math.max((we=de==null?void 0:de.w)!=null?we:0,Q.label.width),h:Math.max((je=de==null?void 0:de.h)!=null?je:0,Q.label.height),offset:Math.max((De=de==null?void 0:de.offset)!=null?De:0,(re=Q.label.offset)!=null?re:0)})}g.has(Ae)||(g.add(Ae),p[ae].push(ye),p[ye].push(ae))}for(const Q of p)Q.sort((ae,ye)=>ae-ye);const b=u.map(Q=>({x:Q.x,y:Q.y})),_=u.map((Q,ae)=>({x:b[ae].x,y:b[ae].y,w:Q.width,h:Q.height})),S=()=>_.forEach((Q,ae)=>{Q.x=b[ae].x,Q.y=b[ae].y}),M=b.map(Q=>Number.isFinite(Q.x)&&Number.isFinite(Q.y)),C=M.filter(Boolean).length,k=h>0&&C>=2&&C>=.7*h,L=new Int32Array(h).fill(-1),E=[];for(let Q=0;Q<h;Q++){if(L[Q]!==-1)continue;const ae=E.length,ye=[],Ae=[Q];for(L[Q]=ae;Ae.length;){const de=Ae.pop();ye.push(de);for(const Je of p[de])L[Je]===-1&&(L[Je]=ae,Ae.push(Je))}ye.sort((de,Je)=>de-Je),E.push(ye)}const I=(Z=n.scope)!=null?Z:"auto",T=[...x.values()].sort((Q,ae)=>Q.a-ae.a||Q.b-ae.b),A=T.filter(Q=>M[Q.a]&&M[Q.b]),R=k&&!X2(_.filter((Q,ae)=>M[ae]),i)&&wp(A,_,b).length===0,D=k&&(I==="auto"?R:!0),O={iterations:0,overlapIterations:0,scaledUp:0,polishRounds:0,components:E.length,warmStart:D,solvedNodes:0},B=u.map((Q,ae)=>!!Q.pinned&&M[ae]),z=b.map(Q=>$({},Q)),U=M.slice(),F=new Uint8Array(h);if(!D||I==="all")for(let Q=0;Q<h;Q++)F[Q]=B[Q]?0:1;else{const Q=new Set;for(let ae=0;ae<h;ae++)M[ae]||Q.add(ae);for(const ae of(J=n.affectedIds)!=null?J:[]){const ye=m.get(ae);ye!==void 0&&Q.add(ye)}for(const ae of[...Q])for(const ye of p[ae])Q.add(ye);for(const ae of Q)B[ae]||(F[ae]=1)}O.solvedNodes=F.reduce((Q,ae)=>Q+ae,0);const Y=E.filter(Q=>Q.length>1).map(Q=>MB(Q,p,u,b,F,a,i,v));if(D)for(let Q=0;Q<h;Q++){if(M[Q])continue;const ae=p[Q].filter(de=>M[de]),ye=ae.length?ae:E[L[Q]].filter(de=>M[de]),Ae=_p(u[Q].id);if(ye.length){const de=ye.reduce((Ge,be)=>Ge+b[be].x,0)/ye.length,Je=ye.reduce((Ge,be)=>Ge+b[be].y,0)/ye.length;b[Q]={x:de+Ae.x*a,y:Je+Ae.y*a}}else{const de=Zf(_.filter((Je,Ge)=>M[Ge]));b[Q]={x:de.cx+Ae.x*(de.w/2+a),y:de.cy+Ae.y*(de.h/2+a)}}_[Q].x=b[Q].x,_[Q].y=b[Q].y,M[Q]=!0}else{for(const Q of Y)Q.initFromMds();for(const Q of E)Q.length===1&&(b[Q[0]]=B[Q[0]]?$({},z[Q[0]]):{x:0,y:0});for(const Q of E){const ae=Q.filter(ye=>B[ye]);if(ae.length){J2(b,ae,z,Q);for(const ye of ae)b[ye]=$({},z[ye])}}}const X=[];if(Y.length&&O.solvedNodes>0){let Q=Y.reduce((ae,ye)=>ae+ye.stress(),0);X.push(Q);for(let ae=0;ae<r;ae++){let ye=0;for(const de of Y)ye=Math.max(ye,de.sweep());const Ae=Y.reduce((de,Je)=>de+Je.stress(),0);if(X.push(Ae),O.iterations=ae+1,Q-Ae<=l*Math.max(Q,1e-12)||ye<.01)break;Q=Ae}}else Y.length&&X.push(Y.reduce((Q,ae)=>Q+ae.stress(),0));if(D&&I==="all"){const Q=u.map((ae,ye)=>ye).filter(ae=>U[ae]);J2(b,Q,z,u.map((ae,ye)=>ye));for(let ae=0;ae<h;ae++)B[ae]&&(b[ae]=$({},z[ae]))}if(O.solvedNodes>0)for(const Q of Y)O.polishRounds+=Q.polish();S();const ne=new Map;for(const Q of T){const ae=L[Q.a];((K=ne.get(ae))!=null?K:ne.set(ae,[]).get(ae)).push(Q)}E.forEach((Q,ae)=>{var ye;Q.length<2||Z2(Q,_,b,u,B,i,O,(ye=ne.get(ae))!=null?ye:[],!D)}),S(),D||IB(E,_,b,B,i,c),(D||E.some(Q=>Q.some(ae=>B[ae])))&&(S(),(X2(_,i)||wp(T,_,b).length)&&Z2(E.flat(),_,b,u,B,i,O,T));const q=new Map;return u.forEach((Q,ae)=>q.set(Q.id,{x:b[ae].x,y:b[ae].y})),{positions:q,stressHistory:X,stats:O}}function MB(e,t,n,a,i,r,l,c){const u=e.length,h=new Map;e.forEach((k,L)=>h.set(k,L));const m=e.map(k=>t[k].map(L=>h.get(L))),p=new Float64Array(u*u),g=new Float64Array(u*u),v=new Int32Array(u),x=new Int32Array(u);for(let k=0;k<u;k++){x.fill(-1),x[k]=0;let L=0,E=0;for(v[E++]=k;L<E;){const I=v[L++];for(const T of m[I])x[T]===-1&&(x[T]=x[I]+1,v[E++]=T)}for(let I=0;I<u;I++)I!==k&&(p[k*u+I]=x[I]*r)}const b=(k,L)=>{const E=n[e[k]],I=n[e[L]];return Math.hypot((E.width+I.width)/2,(E.height+I.height)/2)+l},_=(k,L)=>{var T;const E=e[k],I=e[L];return(T=c.get(E<I?`${E}|${I}`:`${I}|${E}`))!=null?T:0};for(let k=0;k<u;k++)for(const L of m[k])if(k<L){const E=Math.max(p[k*u+L],b(k,L),_(k,L));p[k*u+L]=E,p[L*u+k]=E}for(let k=0;k<u;k++){const L=m[k].filter(R=>m[R].length===1);if(L.length<3)continue;const E=Math.max(r,...L.map(R=>_(k,R))),I=Math.min(...L.map(R=>b(k,R))),T=Math.floor(2*Math.PI*E/I);if(L.length>bB*T){const R=jB(L.length,[k,...L].map(O=>n[e[O]]),l),D=[k,...L];for(let O=0;O<D.length;O++)for(let B=O+1;B<D.length;B++){const z=Math.hypot(R[O].x-R[B].x,R[O].y-R[B].y);p[D[O]*u+D[B]]=z,p[D[B]*u+D[O]]=z}continue}const A=Math.max(0,Math.min(2*E,2*E*Math.sin(Math.PI/L.length)));for(let R=0;R<L.length;R++)for(let D=R+1;D<L.length;D++){const O=L[R],B=L[D],z=Math.max(A,b(O,B));p[O*u+B]=z,p[B*u+O]=z}}for(let k=0;k<u*u;k++)g[k]=p[k]>0?1/(p[k]*p[k]):0;const S=()=>e.map(k=>a[k]),M=new Float64Array(u),C=new Float64Array(u);return{initFromMds(){const k=u<=hB?EB(p,u):RB(p,u);for(let L=0;L<u;L++){const E=_p(n[e[L]].id);a[e[L]]={x:k[2*L]+E.x*.01*r,y:k[2*L+1]+E.y*.01*r}}},sweep(){for(let L=0;L<u;L++)M[L]=a[e[L]].x,C[L]=a[e[L]].y;let k=0;for(let L=0;L<u;L++){if(!i[e[L]])continue;let E=0,I=0,T=0;const A=M[L],R=C[L],D=L*u;for(let O=0;O<u;O++){const B=g[D+O];if(B===0||O===L)continue;const z=M[O],U=C[O];let F=A-z,Y=R-U,X=Math.sqrt(F*F+Y*Y);if(X<1e-9){const q=_p(n[e[L]].id);F=q.x,Y=q.y,X=1}const ne=p[D+O]/X;E+=B*(z+ne*F),I+=B*(U+ne*Y),T+=B}if(T>0){const O=E/T,B=I/T,z=O-A,U=B-R;k=Math.max(k,Math.sqrt(z*z+U*U)),M[L]=O,C[L]=B,a[e[L]].x=O,a[e[L]].y=B}}return k},polish(){if(u>kB)return 0;let k=0;for(let L=0;L<_B;L++){const E=S().map((T,A)=>({x:T.x,y:T.y,w:n[e[A]].width,h:n[e[A]].height}));let I=0;for(let T=0;T<u;T++)for(let A=T+1;A<u;A++){if(!i[e[T]]&&!i[e[A]])continue;const R=E[T],D=E[A];if(!Qc(R,D,l))continue;const O=Math.max(Math.hypot(R.x-D.x,R.y-D.y),1e-6)*Math.min(Ud(R,D,l),NB);O<=p[T*u+A]||(p[T*u+A]=p[A*u+T]=O,g[T*u+A]=g[A*u+T]=SB/(O*O),I++)}if(I===0)break;k++;for(let T=0;T<wB&&!(this.sweep()<.01);T++);}return k},stress(){for(let L=0;L<u;L++)M[L]=a[e[L]].x,C[L]=a[e[L]].y;let k=0;for(let L=0;L<u;L++){const E=M[L],I=C[L],T=L*u;for(let A=L+1;A<u;A++){const R=g[T+A];if(R===0)continue;const D=E-M[A],O=I-C[A],B=Math.sqrt(D*D+O*O)-p[T+A];k+=R*B*B}}return k}}}function jB(e,t,n){const a=Math.max(...t.map(c=>c.width))+n+.5,i=Math.max(...t.map(c=>c.height))+n+.5,r=Math.ceil(2*Math.sqrt(e))+2,l=[];for(let c=-r;c<=r;c++)for(let u=-r;u<=r;u++){if(c===0&&u===0)continue;const h=c*a,m=u*i;l.push({x:h,y:m,d:ks(h/Jf,2)+m*m,a:Math.atan2(m,h)})}return l.sort((c,u)=>c.d-u.d||c.a-u.a),[{x:0,y:0},...l.slice(0,e).map(c=>({x:c.x,y:c.y}))]}function xM(e,t){const n=u=>{const h=new Float64Array(t);for(let m=0;m<t;m++)h[m]=Math.sin((m+1)*(u+1)*.7)+.5;return h},a=u=>{let h=0;for(let m=0;m<t;m++)h+=u[m]*u[m];h=Math.sqrt(h)||1;for(let m=0;m<t;m++)u[m]/=h},i=(u,h)=>{let m=0;for(let p=0;p<t;p++)m+=u[p]*h[p];return m},r=(u,h)=>{let m=n(u);a(m);let p=new Float64Array(t),g=0;for(let v=0;v<pB;v++){if(e(m,p),h){const b=h.l*i(h.v,m);for(let _=0;_<t;_++)p[_]-=b*h.v[_]}g=i(m,p),a(p);const x=m;m=p,p=x}return{v:m,l:g}},l=r(0),c=r(1,l);return{v1:l.v,l1:l.l,v2:c.v,l2:c.l}}function EB(e,t){const n=new Float64Array(t*t);for(let v=0;v<t*t;v++)n[v]=e[v]*e[v];const a=new Float64Array(t);let i=0;for(let v=0;v<t;v++){let x=0;for(let b=0;b<t;b++)x+=n[v*t+b];a[v]=x/t,i+=x}i/=t*t;const r=new Float64Array(t*t);for(let v=0;v<t;v++)for(let x=0;x<t;x++)r[v*t+x]=-.5*(n[v*t+x]-a[v]-a[x]+i);const{v1:l,l1:c,v2:u,l2:h}=xM((v,x)=>{for(let b=0;b<t;b++){let _=0;for(let S=0;S<t;S++)_+=r[b*t+S]*v[S];x[b]=_}},t),m=new Float64Array(2*t),p=Math.sqrt(Math.max(c,0)),g=Math.sqrt(Math.max(h,0));for(let v=0;v<t;v++)m[2*v]=l[v]*p,m[2*v+1]=u[v]*g;return m}function RB(e,t){const n=Math.min(fB,t),a=[0],i=new Float64Array(t).fill(1/0);for(;a.length<n;){const b=a[a.length-1];let _=-1,S=-1;for(let M=0;M<t;M++)i[M]=Math.min(i[M],e[b*t+M]),i[M]>S&&(S=i[M],_=M);a.push(_)}const r=new Float64Array(t*n),l=new Float64Array(n),c=new Float64Array(t);let u=0;for(let b=0;b<t;b++)for(let _=0;_<n;_++){const S=ks(e[b*t+a[_]],2);r[b*n+_]=S,l[_]+=S/t,c[b]+=S/n,u+=S/(t*n)}for(let b=0;b<t;b++)for(let _=0;_<n;_++)r[b*n+_]=-.5*(r[b*n+_]-c[b]-l[_]+u);const{v1:h,v2:m}=xM((b,_)=>{const S=new Float64Array(t);for(let M=0;M<t;M++){let C=0;for(let k=0;k<n;k++)C+=r[M*n+k]*b[k];S[M]=C}for(let M=0;M<n;M++){let C=0;for(let k=0;k<t;k++)C+=r[k*n+M]*S[k];_[M]=C}},n),p=new Float64Array(2*t);for(let b=0;b<t;b++){let _=0,S=0;for(let M=0;M<n;M++)_+=r[b*n+M]*h[M],S+=r[b*n+M]*m[M];p[2*b]=_,p[2*b+1]=S}let g=0,v=0;for(let b=0;b<t;b++)for(let _=0;_<n;_++){const S=a[_];if(S===b)continue;const M=Math.hypot(p[2*b]-p[2*S],p[2*b+1]-p[2*S+1]);g+=e[b*t+S]*M,v+=M*M}const x=v>0?g/v:1;for(let b=0;b<2*t;b++)p[b]*=x;return p}function X2(e,t){for(let n=0;n<e.length;n++)for(let a=n+1;a<e.length;a++)if(Qc(e[n],e[a],t))return!0;return!1}function LB(e,t){const n=[],a=new Set,i=(r,l)=>{const c=r<l?`${r}|${l}`:`${l}|${r}`;a.has(c)||(a.add(c),n.push(r<l?[r,l]:[l,r]))};if(e.length>=3){const r=new Float64Array(e.length*2);e.forEach((u,h)=>{r[2*h]=t[u].x,r[2*h+1]=t[u].y});const l=new S0(r),c=l.triangles;for(let u=0;u<c.length;u+=3)i(e[c[u]],e[c[u+1]]),i(e[c[u+1]],e[c[u+2]]),i(e[c[u+2]],e[c[u]]);if(c.length===0){const u=l.hull;for(let h=0;h+1<u.length;h++)i(e[u[h]],e[u[h+1]])}}if(e.length<3||n.length===0)for(let r=0;r<e.length;r++)for(let l=r+1;l<e.length;l++)i(e[r],e[l]);return n}function bM(e,t){const n=t[e.b].x-t[e.a].x,a=t[e.b].y-t[e.a].y,i=Math.hypot(n,a)||1;return{x:(t[e.a].x+t[e.b].x)/2-a/i*e.offset,y:(t[e.a].y+t[e.b].y)/2+n/i*e.offset,w:e.w,h:e.h}}function wp(e,t,n){const a=[],i=e.map(c=>bM(c,n)),r=new Map,l=(c,u,h)=>a.push({a:Math.min(c,u),b:Math.max(c,u),t:h});e.forEach((c,u)=>{var h;for(const m of[c.a,c.b])Qc(t[m],i[u],0)&&l(c.a,c.b,Ud(t[m],i[u],0)),((h=r.get(m))!=null?h:r.set(m,[]).get(m)).push(u)});for(const[c,u]of r)for(let h=0;h<u.length;h++)for(let m=h+1;m<u.length;m++){const p=e[u[h]],g=e[u[m]],v=p.a===c?p.b:p.a,x=g.a===c?g.b:g.a;v===x||!Qc(i[u[h]],i[u[m]],0)||l(v,x,Ud(i[u[h]],i[u[m]],0))}return a}function TB(e,t,n,a,i){let r=0;for(const l of e){const c=bM(l,a);for(const u of t){if(u===l.a||u===l.b||i[u]||!Qc(n[u],c,0))continue;const h=(n[u].w+c.w)/2-Math.abs(n[u].x-c.x)+.5,m=(n[u].h+c.h)/2-Math.abs(n[u].y-c.y)+.5;h<m?a[u].x+=n[u].x>=c.x?h:-h:a[u].y+=n[u].y>=c.y?m:-m,n[u].x=a[u].x,n[u].y=a[u].y,r++}}return r}function Z2(e,t,n,a,i,r,l,c=[],u=!1){var p;const h=()=>e.forEach(g=>{t[g].x=n[g].x,t[g].y=n[g].y}),m=()=>{for(let g=0;g<e.length;g++)for(let v=g+1;v<e.length;v++){const x=e[g],b=e[v];if(Math.abs(n[x].x-n[b].x)<1e-6&&Math.abs(n[x].y-n[b].y)<1e-6){const _=i[b]&&!i[x]?x:b,S=_p(a[_].id);n[_].x+=S.x,n[_].y+=S.y}}h()};for(let g=0;g<mB;g++){m();const v=u&&g<xB?TB(c,e,t,n,i):0,x=[];for(let U=0;U<e.length;U++)for(let F=U+1;F<e.length;F++)Qc(t[e[U]],t[e[F]],r)&&x.push([e[U],e[F]]);const b=wp(c,t,n);if(x.length===0&&b.length===0){if(v===0)return;continue}l.overlapIterations++;const _=LB(e,t),S=new Set(_.map(([U,F])=>`${U}|${F}`));for(const[U,F]of x)S.has(`${U}|${F}`)||(S.add(`${U}|${F}`),_.push([U,F]));for(const{a:U,b:F}of b)S.has(`${U}|${F}`)||(S.add(`${U}|${F}`),_.push([U,F]));const M=new Map;for(const{a:U,b:F,t:Y}of b)M.set(`${U}|${F}`,Math.max((p=M.get(`${U}|${F}`))!=null?p:1,Y));const C=_.map(([U,F])=>{var Y;return{a:U,b:F,t:Math.max(Ud(t[U],t[F],r),(Y=M.get(`${U}|${F}`))!=null?Y:1)}});C.sort((U,F)=>F.t-U.t||U.a-F.a||U.b-F.b);const k=new Map(e.map(U=>[U,U])),L=U=>{for(;k.get(U)!==U;)k.set(U,k.get(k.get(U))),U=k.get(U);return U},E=new Map(e.map(U=>[U,[]]));for(const U of C){const F=L(U.a),Y=L(U.b);F!==Y&&(k.set(F,Y),E.get(U.a).push({to:U.b,t:U.t}),E.get(U.b).push({to:U.a,t:U.t}))}let I=0,T=0;for(const U of e)I+=n[U].x,T+=n[U].y;I/=e.length,T/=e.length;let A=e[0],R=1/0;for(const U of e){const F=Math.hypot(n[U].x-I,n[U].y-T);F<R&&(R=F,A=U)}const D=e.find(U=>i[U]);D!==void 0&&(A=D);const O=new Map([[A,$({},n[A])]]),B=[A],z=new Set([A]);for(;B.length;){const U=B.pop(),F=O.get(U);for(const{to:Y,t:X}of E.get(U))z.has(Y)||(z.add(Y),O.set(Y,{x:F.x+(n[Y].x-n[U].x)*X,y:F.y+(n[Y].y-n[U].y)*X}),B.push(Y))}for(const U of e){const F=O.get(U);F&&(n[U].x=F.x,n[U].y=F.y)}h()}for(let g=0;g<gB;g++){m();let v=1;for(let S=0;S<e.length;S++)for(let M=S+1;M<e.length;M++)v=Math.max(v,Ud(t[e[S]],t[e[M]],r));for(const S of wp(c,t,n))v=Math.max(v,S.t);if(v<=1)return;l.scaledUp++;const x=e.find(S=>i[S]);let b=0,_=0;if(x!==void 0)b=n[x].x,_=n[x].y;else{for(const S of e)b+=n[S].x,_+=n[S].y;b/=e.length,_/=e.length}for(const S of e)n[S].x=b+(n[S].x-b)*v,n[S].y=_+(n[S].y-_)*v;h()}}function Zf(e){if(e.length===0)return{cx:0,cy:0,w:0,h:0};let t=1/0,n=1/0,a=-1/0,i=-1/0;for(const r of e)t=Math.min(t,r.x-r.w/2),a=Math.max(a,r.x+r.w/2),n=Math.min(n,r.y-r.h/2),i=Math.max(i,r.y+r.h/2);return{cx:(t+a)/2,cy:(n+i)/2,w:a-t,h:i-n}}const Jf=1.6;function AB(e,t,n){const a=e.map(()=>({x:0,y:0})),i=[];e.forEach((c,u)=>{const h=i[i.length-1];h&&h.w+n+c.w<=t?(a[u]={x:h.w+n,y:0},h.items.push(u),h.w+=n+c.w,h.h=Math.max(h.h,c.h)):(i.push({items:[u],w:c.w,h:c.h}),a[u]={x:0,y:0})});const r=Math.max(...i.map(c=>c.w));let l=0;for(const c of i){const u=(r-c.w)/2;for(const h of c.items)a[h].x+=u,a[h].y=l+(c.h-e[h].h)/2;l+=c.h+n}return{offsets:a,w:r,h:l-n}}function IB(e,t,n,a,i,r){const l=e.filter(k=>k.some(L=>a[L])),c=e.filter(k=>!k.some(L=>a[L]));if(c.length===0)return;const u=Math.max(i,r),h=c.filter(k=>k.length>1),m=c.filter(k=>k.length===1).map(k=>k[0]),p=(k,L,E,I)=>{for(const T of k)n[T].x+=E-L.cx,n[T].y+=I-L.cy},g=h.map((k,L)=>{const E=Zf(k.map(I=>t[I]));return{i:L,m:k,bb:E,w:E.w,h:E.h}});g.sort((k,L)=>L.h-k.h||L.w-k.w||k.i-L.i);let v=0,x=0;if(g.length){const k=g.reduce((D,O)=>D+(O.w+u)*(O.h+u),0),L=Math.max(...g.map(D=>D.w));let E,I=-1/0;for(const D of[.75,1,1.25,1.5,2]){const O=AB(g,Math.max(L,Math.sqrt(k*Jf)*D),u),B=Math.min(Jf/O.w,1/O.h);B>I+1e-12&&(I=B,E=O)}const{offsets:T,w:A,h:R}=E;g.forEach((D,O)=>p(D.m,D.bb,T[O].x+D.w/2,T[O].y+D.h/2)),v=A,x=R}if(m.length){const k=Math.max(...m.map(R=>t[R].w))+u,L=Math.max(...m.map(R=>t[R].h))+u,E=g.length?Math.max(1,Math.min(m.length,Math.floor((v+u)/k))):Math.max(1,Math.min(m.length,Math.ceil(Math.sqrt(m.length*Jf*L/k)))),I=Math.ceil(m.length/E),T=E*k-u,A=g.length?x+u:0;m.forEach((R,D)=>{const O=D%E,B=Math.floor(D/E);n[R].x=(v-T)/2+O*k+(k-u)/2,n[R].y=A+B*L+(L-u)/2}),v=Math.max(v,T),x=A+I*L-u}const b=c.flat();for(const k of b)n[k].x-=v/2,n[k].y-=x/2;if(l.length===0)return;const _=Zf(l.flat().map(k=>t[k])),S=Zf(b.map(k=>ee($({},t[k]),{x:n[k].x,y:n[k].y}))),M=Math.abs(S.cx-_.cx)<(S.w+_.w)/2+u,C=Math.abs(S.cy-_.cy)<(S.h+_.h)/2+u;if(M&&C){const k=_.cx+_.w/2+u+S.w/2-S.cx;for(const L of b)n[L].x+=k}}function J2(e,t,n,a){const i=t.length;if(i===0)return;const r={x:0,y:0},l={x:0,y:0};for(const p of t)r.x+=e[p].x/i,r.y+=e[p].y/i,l.x+=n[p].x/i,l.y+=n[p].y/i;const c=p=>{let g=0,v=0,x=0,b=0;for(const L of t){const E=e[L].x-r.x,I=(e[L].y-r.y)*(p?-1:1),T=n[L].x-l.x,A=n[L].y-l.y;g+=E*T,v+=E*A,x+=I*T,b+=I*A}const _=i>=2?Math.atan2(v-x,g+b):0,S=Math.cos(_),M=Math.sin(_),C=L=>{const E=L.x-r.x,I=(L.y-r.y)*(p?-1:1);return{x:S*E-M*I+l.x,y:M*E+S*I+l.y}};let k=0;for(const L of t){const E=C(e[L]);k+=ks(E.x-n[L].x,2)+ks(E.y-n[L].y,2)}return{err:k,map:C}},u=c(!1),h=i>=3?(()=>{const p=c(!0);return p.err<u.err?p:u})():u,m=a.map(p=>h.map(e[p]));a.forEach((p,g)=>{e[p].x=m[g].x,e[p].y=m[g].y})}function Hp(e,t){const n=Array.from(new Set(e)),a=new Set(n),i=new Map,r=new Map,l=new Set;for(const p of t){if(!p.structural||p.source===p.target||!a.has(p.source)||!a.has(p.target)||i.has(p.target))continue;const g=`${p.source}->${p.target}`;if(l.has(g))continue;l.add(g),i.set(p.target,p.source);const v=r.get(p.source);v?v.push(p.target):r.set(p.source,[p.target])}const c=new Set(n.filter(p=>!i.has(p))),u=Array.from(c),h=new Set,m=p=>{var g;if(!h.has(p)){h.add(p);for(const v of(g=r.get(p))!=null?g:[])m(v)}};u.forEach(m);for(const p of n){if(h.has(p))continue;const g=i.get(p);if(g!==void 0){i.delete(p);const v=r.get(g);v&&r.set(g,v.filter(x=>x!==p))}u.push(p),m(p)}return{parentOf:i,childrenOf:r,roots:u}}function DB(e,t){return e.flatMap(n=>{const a=t.get(n);return a&&a.length>1?a:[n]})}function Xv(e,t){var r,l;const n=new Set,a=[...(r=t.get(e))!=null?r:[]];let i=0;for(;i<a.length;){const c=a[i++];n.has(c)||(n.add(c),a.push(...(l=t.get(c))!=null?l:[]))}return n}function OB(e,t){var n;const a=DB(e,t),i=new Map;for(const r of a){i.set(r,r);for(const l of Xv(r,t))i.set(l,r)}for(const r of e){if(i.has(r))continue;const l=(n=t.get(r))==null?void 0:n[0],c=l!==void 0?i.get(l):void 0;c!==void 0&&i.set(r,c)}return{groupHeads:a,leafToGroup:i}}const zB=2,W2=64,eS=[{dx:1,dy:0},{dx:0,dy:1},{dx:-1,dy:0},{dx:0,dy:-1}];function BB(e,t,n={}){var W,ge,we,je,De,re,Z,J;const a=(W=n.clearance)!=null?W:10,i=(ge=n.laneSpacing)!=null?ge:16,r=Math.max(1,Math.floor((we=n.lanes)!=null?we:4)),l=Math.max(0,Math.floor((je=n.componentGap)!=null?je:1)),c=(De=n.orderingSweeps)!=null?De:6,u=[...e].sort((K,Q)=>K.id<Q.id?-1:K.id>Q.id?1:0),h=u.length,m=new Map;u.forEach((K,Q)=>m.set(K.id,Q));const p=u.map(()=>[]),g=[],v=new Set;let x=0;t.forEach(K=>{const Q=m.get(K.source),ae=m.get(K.target);if(Q===void 0||ae===void 0||Q===ae){g.push(null),x++;return}g.push([Q,ae]);const ye=Q<ae?`${Q}|${ae}`:`${ae}|${Q}`;v.has(ye)||(v.add(ye),p[Q].push(ae),p[ae].push(Q))});for(const K of p)K.sort((Q,ae)=>Q-ae);const b=h?Math.max(...u.map(K=>K.width)):0,_=h?Math.max(...u.map(K=>K.height)):0,S=r*i,M=b+2*a+S,C=_+2*a+S,k=t.some(K=>K.structural)?Hp(u.map(K=>K.id),t.filter(K=>K.structural).map(K=>({source:K.source,target:K.target,structural:!0}))):null,L=n.isPageNode,E=K=>L?$B(L,u[K].id):!0,I=new Int32Array(h),T=new Int32Array(h),A=u.map(K=>!!K.pinned&&Number.isFinite(K.x)&&Number.isFinite(K.y)),R=u.map(K=>Number.isFinite(K.x)&&Number.isFinite(K.y)),D=A.findIndex(Boolean),O=D>=0?{x:u[D].x-Math.round(u[D].x/M)*M,y:u[D].y-Math.round(u[D].y/C)*C}:{x:0,y:0},B=K=>[Math.round((u[K].x-O.x)/M),Math.round((u[K].y-O.y)/C)],z=(re=n.scope)!=null?re:"auto",U=R.filter(Boolean).length;let F=z==="sketch";if(z==="auto"&&h>0&&U>=2&&U>=.7*h){const K=new Set;let Q=!0;for(let ae=0;ae<h&&Q;ae++)if(R[ae]){const ye=B(ae).join(",");K.has(ye)&&(Q=!1),K.add(ye)}F=Q}let Y,X;if(F)({components:Y,isolates:X}=UB(h,p,u,R,A,B,I,T));else{({components:Y,isolates:X}=FB(h,p,I,T,l,c,k,m,E,u));const K=new Map;for(let Q=0;Q<h;Q++)K.set(`${I[Q]},${T[Q]}`,Q);for(let Q=0;Q<h;Q++){if(!A[Q])continue;const[ae,ye]=B(Q),Ae=`${ae},${ye}`;K.delete(`${I[Q]},${T[Q]}`);const de=K.get(Ae);if(I[Q]=ae,T[Q]=ye,K.set(Ae,Q),de!==void 0&&de!==Q&&!A[de]){const Je=Zv(ae,ye,K);I[de]=Je[0],T[de]=Je[1],K.set(`${Je[0]},${Je[1]}`,de)}}}const ne=new Map,q=u.map((K,Q)=>{const ae={x:O.x+I[Q]*M,y:O.y+T[Q]*C};return ne.set(K.id,ae),ae}),he=t.map(K=>K.navigationRoute?2:K.structural?0:1),pe=t.map(()=>{});if(n.busTreeEdges){const K=new Map;t.forEach((ae,ye)=>{var Ge;const Ae=g[ye];if(!Ae||!ae.structural)return;const[de,Je]=Ae;T[Je]===T[de]+1&&K.set(de,[...(Ge=K.get(de))!=null?Ge:[],ye])});let Q=0;for(const[,ae]of[...K.entries()].sort((ye,Ae)=>ye[0]-Ae[0]))if(!(ae.length<2)){for(const ye of ae)pe[ye]=Q;Q++}}const H=YB(u,q,g,I,T,M,C,O,he,pe,{clearance:a,laneSpacing:i,lanes:r,bendPenalty:(Z=n.bendPenalty)!=null?Z:Math.max(M,C),crossingPenalty:(J=n.crossingPenalty)!=null?J:3*Math.max(M,C)}),te=h?Math.max(...Array.from(I))-Math.min(...Array.from(I))+1:0,ie=h?Math.max(...Array.from(T))-Math.min(...Array.from(T))+1:0;return{positions:ne,routes:H.points,groups:pe,cell:{w:M,h:C},origin:O,stats:{components:Y+(X?1:0),rows:ie,cols:te,fallbackRoutes:H.fallbacks,droppedEdges:x,sketch:F,pinnedNodes:A.filter(Boolean).length,busEdges:pe.filter(K=>K!==void 0).length}}}function $B(e,t){try{return!!e(t)}catch(n){return!0}}function Zv(e,t,n){for(let a=1;a<1e4;a++){const i=[];for(let r=-a;r<=a;r++){const l=a-Math.abs(r);i.push([e+r,t+l]),l!==0&&i.push([e+r,t-l])}i.sort((r,l)=>r[0]-l[0]||r[1]-l[1]);for(const[r,l]of i)if(!n.has(`${r},${l}`))return[r,l]}return[e,t]}function UB(e,t,n,a,i,r,l,c){const u=new Map,h=[...Array(e).keys()].filter(v=>a[v]).sort((v,x)=>(i[x]?1:0)-(i[v]?1:0)||v-x);for(const v of h){let[x,b]=r(v);u.has(`${x},${b}`)&&([x,b]=Zv(x,b,u)),l[v]=x,c[v]=b,u.set(`${x},${b}`,v)}for(let v=0;v<e;v++){if(a[v])continue;const x=t[v].filter(S=>u.has(`${l[S]},${c[S]}`)&&(a[S]||S<v));let b=0,_=0;if(x.length)b=Math.round(x.reduce((S,M)=>S+l[M],0)/x.length),_=Math.round(x.reduce((S,M)=>S+c[M],0)/x.length)+1;else if(u.size){let S=-1/0,M=1/0;for(const C of u.keys()){const[k,L]=C.split(",").map(Number);S=Math.max(S,L),M=Math.min(M,k)}b=M,_=S+1}u.has(`${b},${_}`)&&([b,_]=Zv(b,_,u)),l[v]=b,c[v]=_,u.set(`${b},${_}`,v)}const m=new Uint8Array(e);let p=0,g=0;for(let v=0;v<e;v++){if(m[v])continue;if(t[v].length===0){g++,m[v]=1;continue}p++;const x=[v];for(m[v]=1;x.length;){const b=x.pop();for(const _ of t[b])m[_]||(m[_]=1,x.push(_))}}return{components:p,isolates:g}}function FB(e,t,n,a,i,r,l,c,u,h){const m=new Int32Array(e).fill(-1),p=[];for(let E=0;E<e;E++){if(m[E]!==-1)continue;const I=[],T=[E];for(m[E]=p.length;T.length;){const A=T.pop();I.push(A);for(const R of t[A])m[R]===-1&&(m[R]=p.length,T.push(R))}I.sort((A,R)=>A-R),p.push(I)}const g=p.filter(E=>E.length>1),v=p.filter(E=>E.length===1).map(E=>E[0]);g.sort((E,I)=>I.length-E.length||E[0]-I[0]);const x=g.map(E=>{const I=PB(E,t,r,l,c,u,h);let T=0,A=0;for(const R of E)T=Math.max(T,I.col.get(R)+1),A=Math.max(A,I.row.get(R)+1);return{m:E,local:I,width:T,height:A}}),b=Math.max(Math.ceil(Math.sqrt(e*1.6)),...x.map(E=>E.width));let _=0,S=0,M=0,C=0;for(const{m:E,local:I,width:T,height:A}of x){_>0&&_+T>b&&(S+=M+i,_=0,M=0);for(const R of E)n[R]=_+I.col.get(R),a[R]=S+I.row.get(R);C=Math.max(C,_+T),_+=T+i,M=Math.max(M,A)}const k=x.length?S+M:0,L=Math.max(1,C,Math.ceil(Math.sqrt(v.length*1.6)));return v.forEach((E,I)=>{n[E]=I%L,a[E]=k+Math.floor(I/L)}),{components:g.length,isolates:v.length}}function PB(e,t,n,a,i,r,l){var R,D,O;const c=new Map,u=new Set;if(a){const B=new Set(e);for(const z of e)if(r(z))for(const U of(R=a.childrenOf.get(l[z].id))!=null?R:[]){const F=i.get(U);F===void 0||!B.has(F)||r(F)||(c.set(z,[...(D=c.get(z))!=null?D:[],F]),u.add(F))}}const h=e.filter(B=>!u.has(B)),m=t.map(()=>[]);for(const B of h)m[B]=t[B].filter(z=>!u.has(z));const p=B=>{var Y;const z=new Map([[B,0]]),U=[B];for(let X=0;X<U.length;X++){const ne=U[X];for(const q of m[ne])z.has(q)||(z.set(q,z.get(ne)+1),U.push(q))}for(const X of h)z.has(X)||(z.set(X,0),U.push(X));const F=new Map;for(const X of z.values())F.set(X,((Y=F.get(X))!=null?Y:0)+1);return{root:B,depth:z,order:U,widest:Math.max(...F.values()),rows:F.size}};let g;if(a){const B=new Set(h),z=X=>{const ne=a.parentOf.get(l[X].id),q=ne===void 0?void 0:i.get(ne);return q!==void 0&&B.has(q)?q:void 0},U=h.filter(X=>z(X)===void 0),F=[...U];for(let X=0;X<F.length;X++)for(const ne of(O=a.childrenOf.get(l[F[X]].id))!=null?O:[]){const q=i.get(ne);q!==void 0&&B.has(q)&&z(q)===F[X]&&F.push(q)}const Y=X=>{var H;const ne=p(X);for(const te of F){const ie=z(te);ie!==void 0&&ne.depth.get(te)<=ne.depth.get(ie)&&ne.depth.set(te,ne.depth.get(ie)+1)}const q=[...new Set(ne.depth.values())].sort((te,ie)=>te-ie),he=new Map(q.map((te,ie)=>[te,ie]));for(const[te,ie]of ne.depth)ne.depth.set(te,he.get(ie));const pe=new Map;for(const te of ne.depth.values())pe.set(te,((H=pe.get(te))!=null?H:0)+1);return ee($({},ne),{widest:Math.max(...pe.values()),rows:pe.size})};g=(U.length?U:h).map(Y)}else g=h.map(p);const v=Math.min(...g.map(B=>B.widest));let x=g.filter(B=>B.widest<=v+zB);if(x.length>W2){const B=new Set([...x].sort((z,U)=>z.widest-U.widest||z.rows-U.rows||z.root-U.root).slice(0,W2));x=x.filter(z=>B.has(z))}let b=null;for(const B of x){const z=HB(B.depth,B.order,B.rows,m,n);(!b||z.crossings<b.crossings||z.crossings===b.crossings&&(B.widest<b.widest||B.widest===b.widest&&B.rows<b.rows))&&(b={crossings:z.crossings,widest:B.widest,rows:B.rows,root:B.root,layers:z.layers,depth:B.depth})}const{layers:_,depth:S}=b,M=_.length,C=new Map,k=B=>{var U;var z;return 1+((U=(z=c.get(B))==null?void 0:z.length)!=null?U:0)};{let B=0;for(const z of _[0])C.set(z,B),B+=k(z)}const L=(B,z)=>{const U=_[B].map(Y=>{const X=m[Y].filter(ne=>S.get(ne)===z);return X.length?X.reduce((ne,q)=>ne+C.get(q),0)/X.length:NaN});for(let Y=0;Y<U.length;Y++)Number.isFinite(U[Y])||(U[Y]=Y>0?U[Y-1]+k(_[B][Y-1]):0);const F=VB(U,_[B].map(k));_[B].forEach((Y,X)=>C.set(Y,F[X]))};for(let B=1;B<M;B++)L(B,B-1);for(let B=M-2;B>=0;B--)L(B,B+1);for(let B=1;B<M;B++)L(B,B-1);for(const[B,z]of c)z.forEach((U,F)=>C.set(U,C.get(B)+1+F));const E=[...new Set(C.values())].sort((B,z)=>B-z),I=new Map(E.map((B,z)=>[B,z])),T=new Map,A=new Map;for(const B of h)T.set(B,I.get(C.get(B))),A.set(B,S.get(B));for(const[B,z]of c)for(const U of z)T.set(U,I.get(C.get(U))),A.set(U,S.get(B));return{col:T,row:A}}function HB(e,t,n,a,i){const r=Array.from({length:n},()=>[]);for(const E of t)r[e.get(E)].push(E);const l=new Int32Array(a.length),c=()=>r.forEach(E=>E.forEach((I,T)=>l[I]=T));c();const u=(E,I)=>{const T=e.get(E);let A=0,R=0;for(const D of a[E]){const O=e.get(D);O===I?(A+=l[D],R+=1):O===T&&(A+=.5*l[D],R+=.5)}return R?A/R:l[E]};for(let E=0;E<i;E++){const I=E%2===0,T=I?r.keys():[...r.keys()].reverse();for(const A of T){const R=I?A-1:A+1;if(R<0||R>=n)continue;const D=r[A].map(O=>({g:O,b:u(O,R),i:l[O]}));D.sort((O,B)=>O.b-B.b||O.i-B.i),r[A]=D.map(O=>O.g),c()}}const h=new Int32Array(a.length),m=new Int32Array(a.length),p=[],g=[];let v=0;for(let E=0;E<n;E++){v=Math.max(v,r[E].length);const I=[];for(const T of r[E]){h[T]=p.length;for(const A of a[T]){const R=e.get(A);R===E+1?p.push(A):R===E&&A>T&&I.push(T,A)}m[T]=p.length-h[T]}g.push(Int32Array.from(I))}const x=Int32Array.from(p),b=new Int32Array(v+1),_=E=>E<0||E+1>=n?0:qB(r[E],h,m,x,l,r[E+1].length,b),S=E=>{const I=g[E];let T=0;for(let A=0;A<I.length;A+=2)T+=Math.abs(l[I[A]]-l[I[A+1]])-1;return T},M=E=>_(E-1)+_(E)+S(E),C=E=>r[E].forEach((I,T)=>l[I]=T);let k=0;for(let E=0;E<n;E++)k+=_(E)+S(E);const L=8;for(let E=0;E<4;E++){let I=!1;for(let T=0;T<n;T++){const A=r[T];if(A.length<2||A.length>L)continue;const R=A.slice();let D=R.slice(),O=k;const B=R.slice(),z=new Array(B.length).fill(0);let U=1;const F=k-M(T),Y=()=>{r[T]=B.slice(),C(T);const X=F+M(T);X<O&&(O=X,D=B.slice())};for(Y();U<B.length;)if(z[U]<U){const X=U%2===0?0:z[U];[B[X],B[U]]=[B[U],B[X]],Y(),z[U]++,U=1}else z[U]=0,U++;r[T]=D,C(T),O<k&&(k=O,I=!0)}if(!I)break}for(let E=0;E<6;E++){let I=!1;for(let T=0;T<n;T++){const A=r[T];if(!(A.length<=L))for(let R=0;R<A.length;R++){const D=M(T);if(D===0)break;const O=k-D;for(let B=0;B<A.length;B++){if(B===R)continue;const z=A.splice(R,1)[0];A.splice(B,0,z),C(T);const U=O+M(T);if(U<k){k=U,I=!0;break}A.splice(B,1),A.splice(R,0,z),C(T)}}}if(!I)break}return{layers:r,crossings:k}}function qB(e,t,n,a,i,r,l){l.fill(0,0,r+1);let c=0,u=0;for(const h of e){const m=t[h],p=m+n[h];if(m!==p){for(let g=m;g<p;g++){let v=0;for(let x=i[a[g]]+1;x>0;x-=x&-x)v+=l[x];c+=u-v}for(let g=m;g<p;g++)for(let v=i[a[g]]+1;v<=r;v+=v&-v)l[v]++;u+=p-m}}return c}function VB(e,t){const n=[];let a=0;for(let c=0;c<e.length;c++)n.push(a),a+=t?t[c]:1;const i=[];for(let c=0;c<e.length;c++)for(i.push({start:c,end:c,sum:e[c]-n[c]});i.length>1;){const u=i[i.length-1],h=i[i.length-2],m=h.sum/(h.end-h.start+1),p=u.sum/(u.end-u.start+1);if(m<=p)break;i.pop(),i.pop(),i.push({start:h.start,end:u.end,sum:h.sum+u.sum})}const r=new Array(e.length);let l=-1/0;for(const c of i){const u=c.sum/(c.end-c.start+1);for(let h=c.start;h<=c.end;h++)r[h]=Math.max(Math.round(u+n[h]),l),l=r[h]+(t?t[h]:1)}return r}function YB(e,t,n,a,i,r,l,c,u,h,m){const p=e.length,g=n.map(()=>[]);if(p===0)return{points:g,fallbacks:0};const v=e.map((be,Fe)=>({x:t[Fe].x,y:t[Fe].y,hw:be.width/2,hh:be.height/2})),x=v.map(be=>({x:be.x,y:be.y,hw:be.hw+m.clearance,hh:be.hh+m.clearance})),b=Math.min(...Array.from(a)),_=Math.max(...Array.from(a)),S=Math.min(...Array.from(i)),M=Math.max(...Array.from(i)),C=Array.from({length:m.lanes},(be,Fe)=>(Fe-(m.lanes-1)/2)*m.laneSpacing),k=(be,Fe,me)=>{const Ee=[0];for(let se=1;se<=me;se++)se*Fe<=be-3&&(Ee.push(-se*Fe),Ee.push(se*Fe));return Ee.sort((se,le)=>se-le)},L=Math.max(...v.map(be=>be.hw)),E=Math.max(...v.map(be=>be.hh)),I=k(L,m.laneSpacing,3),T=k(E,Math.max(8,Math.round(m.laneSpacing/2)),3),A=new Set,R=new Set;for(let be=b-1;be<=_;be++)for(const Fe of C)A.add(c.x+be*r+r/2+Fe);for(let be=S-1;be<=M;be++)for(const Fe of C)R.add(c.y+be*l+l/2+Fe);for(let be=b;be<=_;be++)for(const Fe of I)A.add(c.x+be*r+Fe);for(let be=S;be<=M;be++)for(const Fe of T)R.add(c.y+be*l+Fe);const D=[...A].sort((be,Fe)=>be-Fe),O=[...R].sort((be,Fe)=>be-Fe),B=new Map(D.map((be,Fe)=>[be,Fe])),z=new Map(O.map((be,Fe)=>[be,Fe])),U=D.length,F=O.length,Y=(be,Fe)=>Fe*U+be,X=new Uint8Array(U*F),ne=new Uint8Array(U*F),q=new Int32Array(U*F).fill(-1),he=new Int32Array(U*F).fill(-1),pe=be=>h[be]!==void 0?h[be]:1e6+be,H=(be,Fe,me,Ee,se)=>{const le=Math.min(be,me),xe=Math.max(be,me),Pe=Math.min(Fe,Ee),$e=Math.max(Fe,Ee);return le<se.x+se.hw-1e-9&&xe>se.x-se.hw+1e-9&&Pe<se.y+se.hh-1e-9&&$e>se.y-se.hh+1e-9};for(const be of x){const Fe=Lf(D,be.x-be.hw),me=Tf(D,be.x+be.hw),Ee=Lf(O,be.y-be.hh),se=Tf(O,be.y+be.hh);for(let le=Math.max(0,Ee-1);le<=Math.min(F-1,se);le++)for(let xe=Math.max(0,Fe-1);xe<=Math.min(U-1,me);xe++)xe+1<U&&H(D[xe],O[le],D[xe+1],O[le],be)&&(X[Y(xe,le)]=1),le+1<F&&H(D[xe],O[le],D[xe],O[le+1],be)&&(ne[Y(xe,le)]=1)}const te=new Uint16Array(U*F),ie=new Uint16Array(U*F),W=e.map((be,Fe)=>{const me=v[Fe],Ee=x[Fe],se=[];for(const le of I){const xe=me.x+le;if(Math.abs(le)>me.hw-3||!B.has(xe))continue;const Pe=B.get(xe),$e=O[Tf(O,Ee.y-Ee.hh)-1],Be=O[Lf(O,Ee.y+Ee.hh)];$e!==void 0&&$e<Ee.y-Ee.hh+1e-9&&se.push({side:3,port:{x:xe,y:me.y-me.hh},vertex:Y(Pe,z.get($e)),used:!1}),Be!==void 0&&Be>Ee.y+Ee.hh-1e-9&&se.push({side:1,port:{x:xe,y:me.y+me.hh},vertex:Y(Pe,z.get(Be)),used:!1})}for(const le of T){const xe=me.y+le;if(Math.abs(le)>me.hh-3||!z.has(xe))continue;const Pe=z.get(xe),$e=D[Tf(D,Ee.x-Ee.hw)-1],Be=D[Lf(D,Ee.x+Ee.hw)];$e!==void 0&&$e<Ee.x-Ee.hw+1e-9&&se.push({side:2,port:{x:me.x-me.hw,y:xe},vertex:Y(B.get($e),Pe),used:!1}),Be!==void 0&&Be>Ee.x+Ee.hw-1e-9&&se.push({side:0,port:{x:me.x+me.hw,y:xe},vertex:Y(B.get(Be),Pe),used:!1})}return se}),ge=n.map((be,Fe)=>({i:Fe,cls:u[Fe],d:be?Math.abs(t[be[0]].x-t[be[1]].x)+Math.abs(t[be[0]].y-t[be[1]].y):-1})).filter(be=>be.d>=0).sort((be,Fe)=>{var me,Ee;return be.cls-Fe.cls||((me=h[be.i])!=null?me:-1)-((Ee=h[Fe.i])!=null?Ee:-1)||Fe.d-be.d||be.i-Fe.i});let we=0;const je=new KB,De=new Float64Array(U*F*4),re=new Int32Array(U*F*4),Z=new Uint32Array(U*F*4),J=new Uint32Array(U*F*4);let K=0;const Q=be=>Z[be]===K?De[be]:1/0,ae=n.map(()=>null),ye=(be,Fe,me)=>{const{states:Ee}=Fe;for(let xe=1;xe<Ee.length;xe++){const Pe=Math.floor(Ee[xe-1]/4),$e=Ee[xe]%4,Be=Pe%U,at=Math.floor(Pe/U),ot=$e===0?Y(Be,at):$e===2?Y(Be-1,at):$e===1?Y(Be,at):Y(Be,at-1),ft=pe(be);$e===0||$e===2?me>0?q[ot]=ft:q[ot]===ft&&h[be]===void 0&&(q[ot]=-1):me>0?he[ot]=ft:he[ot]===ft&&h[be]===void 0&&(he[ot]=-1),Ee[xe-1]%4===$e&&($e===0||$e===2?te[Pe]+=me:ie[Pe]+=me)}const se=Ee[Ee.length-1],le=Math.floor(se/4);se%4===0||se%4===2?te[le]+=me:ie[le]+=me,h[be]===void 0?Fe.startSlot.used=me>0:me>0&&(Fe.startSlot.used=!0),Fe.endSlot.used=me>0},Ae=new Map,de=be=>{const[Fe,me]=n[be],Ee=h[be],se=Ee!==void 0?Ae.get(Ee):void 0,le=se?[se]:W[Fe].filter(pt=>!pt.used),xe=W[me].filter(pt=>!pt.used),Pe=pe(be),$e=u[be]===2?2*m.crossingPenalty:m.crossingPenalty,Be=new Map;for(const pt of xe)Be.set(pt.vertex,pt);const at=v[me],ot=pt=>Math.abs(D[pt%U]-at.x)+Math.abs(O[Math.floor(pt/U)]-at.y)-at.hw-at.hh;K++,je.clear();const ft=new Map;for(const pt of le){const Yt=pt.side,Rt=Math.hypot(pt.port.x-D[pt.vertex%U],pt.port.y-O[Math.floor(pt.vertex/U)]),hn=pt.vertex*4+Yt;Rt<Q(hn)&&(De[hn]=Rt,Z[hn]=K,re[hn]=-1,ft.set(hn,pt),je.push(Rt+ot(pt.vertex),Rt,hn))}let it=-1;for(;je.size;){const pt=je.pop();if(J[pt]===K)continue;J[pt]=K;const Yt=Math.floor(pt/4),Rt=pt%4,hn=Be.get(Yt);if(hn&&Rt===(hn.side+2)%4){it=pt;break}const Nn=Yt%U,An=Math.floor(Yt/U);for(let It=0;It<4;It++){if(It===(Rt+2)%4)continue;const $n=Nn+eS[It].dx,yn=An+eS[It].dy;if($n<0||yn<0||$n>=U||yn>=F)continue;const Na=It===0?Y(Nn,An):It===2?Y($n,An):It===1?Y(Nn,An):Y(Nn,yn),kn=It===0||It===2,Un=kn?q[Na]:he[Na];if((kn?X[Na]:ne[Na])||Un>=0&&Un!==Pe)continue;const Cn=It===Rt;let Xt=Math.abs(kn?D[$n]-D[Nn]:O[yn]-O[An]);Cn||(Xt+=m.bendPenalty),Cn&&(kn?ie[Yt]:te[Yt])&&(Xt+=$e),!Cn&&(ie[Yt]||te[Yt])&&(Xt+=m.bendPenalty/2);const Mn=Y($n,yn),Gt=Mn*4+It,Zn=De[pt]+Xt;Zn<Q(Gt)&&(De[Gt]=Zn,Z[Gt]=K,re[Gt]=pt,je.push(Zn+ot(Mn),Zn,Gt))}}if(it<0)return null;const kt=[];for(let pt=it;pt>=0&&(kt.push(pt),re[pt]!==-1);pt=re[pt]);return kt.reverse(),{states:kt,startSlot:ft.get(kt[0]),endSlot:Be.get(Math.floor(it/4)),fallback:!1}},Je=be=>{const Fe=[be.startSlot.port];for(const me of be.states){const Ee=Math.floor(me/4);Fe.push({x:D[Ee%U],y:O[Math.floor(Ee/U)]})}return Fe.push(be.endSlot.port),Jv(Fe)};for(const{i:be}of ge){const Fe=de(be);if(!Fe){we++;const[me,Ee]=n[be];g[be]=GB(v[me],v[Ee]);continue}ae[be]=Fe,ye(be,Fe,1),h[be]!==void 0&&!Ae.has(h[be])&&Ae.set(h[be],Fe.startSlot)}const Ge=be=>{let Fe=0;const{states:me}=be;for(let Ee=1;Ee<me.length;Ee++){const se=Math.floor(me[Ee-1]/4),le=me[Ee]%4;me[Ee-1]%4===le&&(le===0||le===2?Fe+=ie[se]:Fe+=te[se])}return Fe};for(let be=0;be<2;be++){let Fe=!1;for(const{i:me}of ge){const Ee=ae[me];if(!Ee||h[me]!==void 0)continue;ye(me,Ee,-1);const se=Ge(Ee);if(se===0){ye(me,Ee,1);continue}const le=de(me);le&&Ge(le)<se?(ae[me]=le,ye(me,le,1),Fe=!0):ye(me,Ee,1)}if(!Fe)break}return ae.forEach((be,Fe)=>{be&&(g[Fe]=Je(be))}),n.forEach((be,Fe)=>{be||(g[Fe]=[{x:0,y:0},{x:0,y:0}])}),{points:g,fallbacks:we}}function GB(e,t){const n=t.x-e.x,a=t.y-e.y;if(Math.abs(n)>=Math.abs(a)){const l=e.x+Math.sign(n)*e.hw,c=t.x-Math.sign(n)*t.hw;return Jv([{x:l,y:e.y},{x:(l+c)/2,y:e.y},{x:(l+c)/2,y:t.y},{x:c,y:t.y}])}const i=e.y+Math.sign(a)*e.hh,r=t.y-Math.sign(a)*t.hh;return Jv([{x:e.x,y:i},{x:e.x,y:(i+r)/2},{x:t.x,y:(i+r)/2},{x:t.x,y:r}])}function Jv(e){const t=[];for(const a of e){const i=t[t.length-1];i&&Math.abs(i.x-a.x)<1e-9&&Math.abs(i.y-a.y)<1e-9||t.push({x:a.x,y:a.y})}let n=1;for(;n<t.length-1;){const a=t[n-1],i=t[n],r=t[n+1],l=Math.abs(a.x-i.x)<1e-9&&Math.abs(i.x-r.x)<1e-9||Math.abs(a.y-i.y)<1e-9&&Math.abs(i.y-r.y)<1e-9,c=(i.x-a.x)*(r.x-i.x)+(i.y-a.y)*(r.y-i.y)>=0;l&&c?t.splice(n,1):n++}return t}function Lf(e,t){let n=0,a=e.length;for(;n<a;){const i=n+a>>1;e[i]<t-1e-9?n=i+1:a=i}return n}function Tf(e,t){let n=0,a=e.length;for(;n<a;){const i=n+a>>1;e[i]<=t+1e-9?n=i+1:a=i}return n}class KB{constructor(){Kt(this,"f",new Float64Array(1024)),Kt(this,"g",new Float64Array(1024)),Kt(this,"s",new Int32Array(1024)),Kt(this,"n",0)}get size(){return this.n}clear(){this.n=0}before(t,n,a,i){const r=this.f[i];return t<r||t===r&&(n>this.g[i]||n===this.g[i]&&a<this.s[i])}push(t,n,a){if(this.n===this.f.length){const r=l=>{const c=new l.constructor(l.length*2);return c.set(l),c};this.f=r(this.f),this.g=r(this.g),this.s=r(this.s)}let i=this.n++;for(;i>0;){const r=i-1>>1;if(!this.before(t,n,a,r))break;this.f[i]=this.f[r],this.g[i]=this.g[r],this.s[i]=this.s[r],i=r}this.f[i]=t,this.g[i]=n,this.s[i]=a}pop(){const t=this.s[0],n=--this.n;if(n>0){const a=this.f[n],i=this.g[n],r=this.s[n];let l=0;for(;;){const c=2*l+1;if(c>=n)break;const u=c+1,h=u<n&&this.before(this.f[u],this.g[u],this.s[u],c)?u:c;if(!(this.f[h]<a||this.f[h]===a&&(this.g[h]>i||this.g[h]===i&&this.s[h]<r)))break;this.f[l]=this.f[h],this.g[l]=this.g[h],this.s[l]=this.s[h],l=h}this.f[l]=a,this.g[l]=i,this.s[l]=r}return t}}function tS(e){return e.radius!==void 0&&Number.isFinite(e.radius)&&e.radius>0?e.radius:Math.hypot(e.width,e.height)/2}function _M(e,t,n){var l;const a=new Map;for(const c of e){const u=n(c);u!==void 0&&Number.isFinite(u)&&u>=0&&a.set(c,u)}const i=a.size>0,r=new Map;for(const c of QB(e,t)){const u=a.get(c),h=(l=t.get(c))!=null?l:[];r.set(c,u!==void 0?u:h.length?h.reduce((m,p)=>{var g;return m+((g=r.get(p))!=null?g:0)},0):i?0:1)}return r}function Sp(e,t){var i;const n=[],a=new Set;for(const r of e){if(a.has(r))continue;const l=[{id:r,depth:0,hasParent:!1}];for(;l.length;){const c=l.pop();if(a.has(c.id))continue;a.add(c.id),n.push(c);const u=(i=t.get(c.id))!=null?i:[];for(let h=u.length-1;h>=0;h--)l.push({id:u[h],depth:c.depth+1,hasParent:!0})}}return n}function QB(e,t){return Sp(e,t).map(n=>n.id).reverse()}const XB=8,ZB=64,JB=15;function WB(e,{minRadius:t=XB,maxRadius:n=ZB}={}){const a=new Map([...e].map(([m,p])=>[m,Math.sqrt(Math.max(0,p))])),i=[...a.values()],r=Math.min(...i),l=Math.max(...i),c=ks(t,2),u=ks(n,2),h=new Map;for(const[m,p]of a){const g=l>r?(p-r)/(l-r):.5;h.set(m,Math.sqrt(c+g*(u-c)))}return h}function wM(e,t){return e.map((n,a)=>{var i;return{id:n,i:a,w:(i=t.get(n))!=null?i:0}}).sort((n,a)=>a.w-n.w||n.i-a.i).map(n=>n.id)}const e9=150,t9=12;function SM(e,t,n){var p,g;const a=new Map(e.map(v=>[v.id,v])),{childrenOf:i,roots:r}=Hp(e.map(v=>v.id),t),l=_M(e.map(v=>v.id),i,v=>{var x;return(x=a.get(v))==null?void 0:x.weight}),c=v=>{const x=a.get(v);return x?tS(x):20},u=e.map(v=>tS(v)).sort((v,x)=>v-x),h=u.length?u[u.length>>1]:20,m=(g=n.nodeMargin)!=null?g:Math.max(t9,((p=n.nodeSpread)!=null?p:.6)*h);return{childrenOf:i,roots:[...r],weightOf:l,radiusOf:c,gap:m}}const nS=[.5,1.5],qy=.5,n9=.7;function a9(e){const t=e.length,n=2*Math.PI/t,[a,i]=[nS[0]*n,nS[1]*n],r=new Map;for(let c=0;c<=2*t;c++){const u=e.map((x,b)=>b).filter(x=>!r.has(x));if(u.length===0)break;const h=2*Math.PI-[...r.values()].reduce((x,b)=>x+b,0),m=u.reduce((x,b)=>x+e[b],0),p=x=>m>0?h*e[x]/m:h/u.length,g=u.filter(x=>p(x)>i);if(g.length){for(const x of g)r.set(x,i);continue}const v=u.filter(x=>p(x)<a);if(v.length){for(const x of v)r.set(x,a);continue}for(const x of u)r.set(x,p(x));break}let l=2*Math.PI-[...r.values()].reduce((c,u)=>c+u,0);if(Math.abs(l)>1e-9){const c=e.map((h,m)=>m).filter(h=>l>0?r.get(h)<=a+1e-12:r.get(h)>=i-1e-12),u=c.length?c:e.map((h,m)=>m);for(const h of u)r.set(h,r.get(h)+l/u.length);l=0}return e.map((c,u)=>r.get(u))}function s9(e,t,n,a){const i=e+a+t;return n>=Math.PI?i:Math.max(i,(t+a/2)/Math.sin(n/2))}function aS(e,t,n,a,i,r){const l=a/2,c=a<2*Math.PI-1e-9,u=c?[{x:Math.cos(l),y:Math.sin(l)},{x:Math.cos(l),y:-Math.sin(l)}]:[],h=[...t.pts].map(([v,x])=>({p:x,rho:r(v)})),m=v=>{for(const{p:x,rho:b}of h){const _=v+x.x,S=x.y;if(Math.hypot(_,S)<e+i+b*(1+qy))return!1;if(c){if(Math.abs(Math.atan2(S,_))>l)return!1;for(const M of u){const C=Math.max(0,_*M.x+S*M.y);if(Math.hypot(_-C*M.x,S-C*M.y)<b+i/2)return!1}}}return!0};let p=e+i+n*(1+qy),g=Math.max(p,s9(e,t.R*(1+qy),a,i));if(m(p))return p;for(let v=0;v<28&&g-p>.5;v++){const x=(p+g)/2;m(x)?g=x:p=x}return g}function i9(e){var u;const{childrenOf:t,roots:n,weightOf:a,radiusOf:i,gap:r}=e,l=new Map,c=Sp(n,t).reverse();for(const{id:h,depth:m,hasParent:p}of c){const g=i(h),v=new Map([[h,{x:0,y:0}]]),x=wM(((u=t.get(h))!=null?u:[]).filter(k=>l.has(k)),a),b=x.map(k=>l.get(k)),_=x.length;let S=[],M=[];if(_===1)S=[p?n9:0],M=[aS(g,b[0],i(x[0]),2*Math.PI,r,i)];else if(_>1){const k=a9(b.map(E=>E.R));let L=-k[0]/2;for(const E of k)S.push(L+E/2),L+=E;if(p){const E=m%2===0?1:-1;let I=1/0,T=1/0,A=-k[0]/2;for(const D of k){const O=Math.atan2(Math.sin(Math.PI-A),Math.cos(Math.PI-A));Math.abs(O)<Math.abs(I)&&(I=O),Math.sign(O)===E&&Math.abs(O)<Math.abs(T)&&(T=O),A+=D}const R=Math.abs(T)<=k[0]?T:I;S=S.map(D=>D+R)}M=b.map((E,I)=>aS(g,E,i(x[I]),k[I],r,i))}let C=g;x.forEach((k,L)=>{const E=S[L],I=Math.cos(E),T=Math.sin(E),A=M[L]*I,R=M[L]*T;for(const[D,O]of b[L].pts){const B={x:A+O.x*I-O.y*T,y:R+O.x*T+O.y*I};v.set(D,B),C=Math.max(C,Math.hypot(B.x,B.y)+i(D))}}),l.set(h,{pts:v,R:C})}return l}function r9(e,t){const n=Math.min(8,Math.max(.125,t)),a=()=>({w:Math.max(...e.map(c=>c.x+c.r))-Math.min(...e.map(c=>c.x-c.r)),h:Math.max(...e.map(c=>c.y+c.r))-Math.min(...e.map(c=>c.y-c.r))}),i=()=>{const{w:c,h:u}=a();return Math.min(n/c,1/u)};let r={fit:i(),at:e.map(c=>({x:c.x,y:c.y}))};const l=n>=1;for(let c=0;c<80;c++){const{w:u,h}=a();if(l?u/h>=n:u/h<=n)break;for(const p of e)l?p.y*=.94:p.x*=.94;for(let p=0;p<60;p++){let g=!1;for(let v=0;v<e.length;v++)for(let x=v+1;x<e.length;x++){const b=e[v],_=e[x];let S=_.x-b.x,M=_.y-b.y,C=Math.hypot(S,M);const k=b.r+_.r-C;k<=1e-6||(C<1e-9&&(S=l?1:0,M=l?0:1,C=1),b.x-=S/C*k/2,b.y-=M/C*k/2,_.x+=S/C*k/2,_.y+=M/C*k/2,g=!0)}if(!g)break}const m=i();m>r.fit&&(r={fit:m,at:e.map(p=>({x:p.x,y:p.y}))})}e.forEach((c,u)=>{c.x=r.at[u].x,c.y=r.at[u].y})}function o9(e,t,n){const{childrenOf:a,roots:i,weightOf:r,gap:l}=e,c=i9(e),u=new Map,h=wM(i,r),m=h.filter(M=>{var C;return((C=a.get(M))!=null?C:[]).length===0}),p=h.filter(M=>{var C;return((C=a.get(M))!=null?C:[]).length>0}),g=p.map(M=>({id:M,r:c.get(M).R+l/2,x:0,y:0}));let v=[],x;if(m.length&&p.length){v=m.map(C=>({id:C,r:c.get(C).R+l/2,x:0,y:0})),Gv(v);const M=hM(v);x={id:"\0lone",r:M.r+2*l,x:0,y:0},v=v.map(C=>ee($({},C),{x:C.x-M.x,y:C.y-M.y})),g.push(x)}else g.push(...m.map(M=>({id:M,r:c.get(M).R+l/2,x:0,y:0})));Gv(g),n!==void 0&&Number.isFinite(n)&&g.length>1&&g.length<=e9&&r9(g,n);const b=Math.cos(t),_=Math.sin(t),S=(M,C,k)=>{for(const[L,E]of c.get(M).pts)u.set(L,{x:C+E.x*b-E.y*_,y:k+E.x*_+E.y*b})};for(const M of g)if(M===x)for(const C of v)S(C.id,M.x+C.x,M.y+C.y);else S(M.id,M.x,M.y);return u}function l9(e,t,n){const{childrenOf:a,roots:i}=t,r=new Map(n),l=h=>Sp([h],a).slice(1).map(m=>m.id),c=new Map(Sp(i,a).map(h=>[h.id,h.depth])),u=e.filter(h=>h.pinned&&h.x!==void 0&&h.y!==void 0&&r.has(h.id)).sort((h,m)=>{var p,g;return((p=c.get(h.id))!=null?p:0)-((g=c.get(m.id))!=null?g:0)});for(const h of u){const m=r.get(h.id),p=h.x-m.x,g=h.y-m.y;if(!(p===0&&g===0))for(const v of[h.id,...l(h.id)]){const x=r.get(v);r.set(v,{x:x.x+p,y:x.y+g})}}return r}let gc,Qr;const c9=5e4;let Wv={pending:!1};function u9(){return Wv.pending}function d9(e,t,n){var i,r,l;const a=e.map(c=>{var u,h;return`${c.id}|${c.width}|${c.height}|${(u=c.radius)!=null?u:""}|${(h=c.weight)!=null?h:""}`});return`${n}|${(i=t.aspectRatio)!=null?i:""}|${(r=t.nodeMargin)!=null?r:""}|${(l=t.nodeSpread)!=null?l:""}#${a.join(";")}`}function NM(e,t,n,a,i,r=1/0){Wv={passes:0,pairChecks:0,pending:!1};const l=d9(e,a,i);(!gc||gc.key!==l||gc.edges!==t)&&(gc={key:l,edges:t,home:o9(n,i,a.aspectRatio)},Qr=void 0);const c=e.filter(m=>m.pinned&&m.x!==void 0&&m.y!==void 0);if(c.length===0)return new Map(gc.home);const u=c.map(m=>`${m.id}@${m.x},${m.y}`).join(";");if(!Qr||Qr.key!==u||Qr.edges!==t){const m=l9(e,n,gc.home),p=n.gap/2,g=e.map(v=>({id:v.id,width:v.width+p,height:v.height+p,pinned:v.pinned,x:0,y:0}));Qr={key:u,edges:t,home:m,job:new A8(g,m,w0)}}const h=Qr.job;if(h){const m=$({},h.stats),p=h.run(r);p&&(Qr.job=void 0),Wv={passes:h.stats.passes-m.passes,pairChecks:h.stats.pairChecks-m.pairChecks,pending:!p}}return new Map(Qr.home)}function h9(e,t,n,a={}){var h;const{startAngle:i=Math.PI,homeStrength:r=.18}=a;if(e.length===0)return new Map;const l=SM(e,t,a),c=NM(e,t,l,a,i,c9),u=new Map;for(const m of e){const p=c.get(m.id);if(m.pinned&&m.x!==void 0&&m.y!==void 0){u.set(m.id,{x:m.x,y:m.y});continue}const g=(h=n==null?void 0:n.get(m.id))!=null?h:p;u.set(m.id,{x:g.x+(p.x-g.x)*r,y:g.y+(p.y-g.y)*r})}return u}function sS(e,t,n={}){const{startAngle:a=Math.PI}=n;if(e.length===0)return new Map;const i=SM(e,t,n);return NM(e,t,i,n,a)}function Vy(e,t,n){const a=new Map;for(const[r,l]of t){const c=e.get(r);c&&(a.has(l)||a.set(l,[]),a.get(l).push({x:c.x,y:c.y,r:n(r)}))}const i=new Map;for(const[r,l]of a){const c=hM(l);c&&i.set(r,{x:c.x,y:c.y,r:c.r})}return i}const f9=1.6;function p9(e,t,n,a,i={}){var ne,q;const{rowSpacing:r=80,columnSpacing:l=60,viewFanGap:c=40,viewSpacing:u=20,trunkSpacing:h=120,maxRowWidth:m=1024}=i,p=new Map;if(e.length===0)return p;const g=Hp(e.map(he=>he.id),t),v=new Set(e.map(he=>he.id)),x=new Set(e.filter(he=>a(he)).map(he=>he.id)),b=new Set(e.filter(he=>!a(he)).map(he=>he.id)),_=g.roots.filter(he=>x.has(he)),S=new Map;for(const[he,pe]of g.childrenOf){if(!x.has(he))continue;const H=pe.filter(te=>x.has(te));H.length>0&&S.set(he,H)}const M=he=>{var te,ie;var pe,H;return{width:(te=(pe=n.get(he))==null?void 0:pe.width)!=null?te:138,height:(ie=(H=n.get(he))==null?void 0:H.height)!=null?ie:30}},C=new Map;for(const he of t){if(!he.structural||he.source===he.target||!v.has(he.source)||!v.has(he.target))continue;const pe=(ne=C.get(he.source))!=null?ne:[];pe.includes(he.target)||pe.push(he.target),C.set(he.source,pe)}const k=he=>{var te;let pe=0;const H=((te=C.get(he))!=null?te:[]).filter(ie=>b.has(ie));if(H.length===0)return 0;pe+=c;for(let ie=0;ie<H.length;ie++)ie>0&&(pe+=u),pe+=M(H[ie]).width;return pe},L=new Map,E=[];for(const he of _){const pe=J=>{var Q;const K=(Q=S.get(J))!=null?Q:[];return{id:J,children:K.map(pe)}},H=pe(he),te=Wd(H),ie=100+r,W=200+l,ge=new Map;te.eachBefore(J=>ge.set(J.data.id,ge.size)),yM().nodeSize([W,ie]).separation((J,K)=>{const[Q,ae]=ge.get(J.data.id)<ge.get(K.data.id)?[J,K]:[K,J],ye=M(Q.data.id).width/2+k(Q.data.id),Ae=M(ae.data.id).width/2;return(ye+Ae+l)/W})(te);const we=new Map;let je=1/0,De=-1/0,re=1/0,Z=-1/0;te.each(J=>{const K=J.data.id,Q=J.x,ae=J.y;we.set(K,{x:Q,y:ae}),je=Math.min(je,Q),De=Math.max(De,Q),re=Math.min(re,ae),Z=Math.max(Z,ae)}),E.push({minX:je,maxX:De,minY:re,maxY:Z});for(const[J,K]of we)L.set(J,K)}const I=[];for(let he=0;he<_.length;he++){const pe=_[he],H=E[he];if(!H)continue;const te=new Set,ie=De=>{var re;te.add(De);for(const Z of(re=S.get(De))!=null?re:[])ie(Z)};ie(pe);let W=H.minX,ge=H.maxX,we=H.minY,je=H.maxY;for(const De of te){const re=L.get(De);if(re){const Z=M(De),J=k(De);W=Math.min(W,re.x-Z.width/2),ge=Math.max(ge,re.x+Z.width/2+J),we=Math.min(we,re.y-Z.height/2),je=Math.max(je,re.y+Z.height/2)}}I.push({width:ge-W,height:je-we,place:(De,re)=>{const Z=De-W,J=re-we,K=Q=>{var ae;if(L.has(Q)){const ye=L.get(Q);L.set(Q,{x:ye.x+Z,y:ye.y+J})}for(const ye of(ae=S.get(Q))!=null?ae:[])K(ye)};K(pe)}})}const T=new Set;for(const[he,pe]of C)if(x.has(he))for(const H of pe)b.has(H)&&T.add(H);const A=Array.from(b).filter(he=>!T.has(he));if(A.length>0){const he=I.reduce((ge,we)=>Math.max(ge,we.height),0),pe=Math.max(...A.map(ge=>M(ge).height)),H=Math.floor((he+u)/(pe+u)),te=Math.max(1,Math.min(A.length,I.length>0?H:Math.ceil(Math.sqrt(A.length)))),ie=[];for(let ge=0;ge<A.length;ge+=te)ie.push(A.slice(ge,ge+te));const W=ie.map(ge=>Math.max(...ge.map(we=>M(we).width)));I.push({width:W.reduce((ge,we)=>ge+we,0)+(ie.length-1)*u,height:te*pe+(te-1)*u,place:(ge,we)=>{let je=ge;ie.forEach((De,re)=>{De.forEach((Z,J)=>{p.set(Z,{x:je+W[re]/2,y:we+pe/2+J*(pe+u)})}),je+=W[re]+u})}})}const R=I.reduce((he,pe)=>he+pe.width*pe.height,0),D=I.reduce((he,pe)=>Math.max(he,pe.width),0),O=Math.max(D,m,Math.sqrt(R*f9));let B=0,z=0,U=0;for(const he of I)B>0&&B+he.width>O&&(B=0,z+=U+h,U=0),he.place(B,z),B+=he.width+h,U=Math.max(U,he.height);const F=new Map;for(const[he,pe]of C)for(const H of pe)if(b.has(H)){const te=(q=F.get(H))!=null?q:new Set;te.add(he),F.set(H,te)}const Y=new Set(Array.from(F.entries()).filter(([he,pe])=>pe.size>1).map(([he])=>he)),X=new Map;for(const[he,pe]of C){if(!x.has(he))continue;const H=L.get(he);if(!H)continue;const te=M(he),ie=pe.filter(W=>b.has(W));if(ie.length!==0)for(let W=0;W<ie.length;W++){const ge=ie[W],we=M(ge).width;let je=H.x+te.width/2+c;for(let re=0;re<W;re++){const Z=ie[re],J=M(Z).width;je+=J+u}const De={x:je+we/2,y:H.y};if(Y.has(ge)){const re=`${ge}:${he}`;p.set(re,De),X.has(ge)||X.set(ge,De)}else p.set(ge,De)}}for(const[he,pe]of X)p.set(he,pe);for(const[he,pe]of L)p.set(he,pe);return p}const m9=100;function g9(e){let t=!1,n=!1,a=null,i=null,r=null;const l=()=>{t||n||(n=!0,a!==null&&cancelAnimationFrame(a),i!==null&&clearTimeout(i),r=setTimeout(()=>{t||e()},0))};return typeof requestAnimationFrame=="function"?(a=requestAnimationFrame(l),i=setTimeout(l,m9)):l(),()=>{t=!0,a!==null&&cancelAnimationFrame(a),i!==null&&clearTimeout(i),r!==null&&clearTimeout(r)}}const y9=1.5;function v9(e,t,n,a,i={}){const{ringSpacing:r=80,nodeSeparationGap:l=12,trunkPadding:c=6}=i,u={positions:new Map,trunkBoundaries:new Map,ringGeometry:[]};if(e.length===0)return u;const h=a,m=new Set(e.map(T=>T.id));let p={width:40,height:40};if(n.size>0){let T=0,A=0;for(const R of n.values())T=Math.max(T,R.width),A=Math.max(A,R.height);p={width:T,height:A}}const g=T=>{var A;return(A=n.get(T))!=null?A:p},v=T=>{const A=g(T);return Math.hypot(A.width,A.height)/2},x=(T,A,R,D)=>{const O=g(T),B=g(R),z=Math.abs(Math.cos(D)-Math.cos(A)),U=Math.abs(Math.sin(D)-Math.sin(A)),F=(O.width+B.width)/2+l,Y=(O.height+B.height)/2+l;return Math.min(z>1e-9?F/z:1/0,U>1e-9?Y/U:1/0)},b=T=>{const A=new Set,R=X=>{var q;A.add(X);const ne=((q=h.childrenOf.get(X))!=null?q:[]).filter(he=>!A.has(he));return{id:X,children:ne.length>0?ne.map(R):void 0}},D=Wd(R(T));yM().size([2*Math.PI,1]).separation((X,ne)=>{const q=(g(X.data.id).width+g(ne.data.id).width)/2+l,he=X.parent===ne.parent?1:y9;return q*he/Math.max(X.depth,1)})(D);const O=[],B=new Map;D.each(X=>{var q,he;var ne;B.set(X.data.id,X.depth),((q=O[ne=X.depth])!=null?q:O[ne]=[]).push({id:X.data.id,angle:(he=X.x)!=null?he:0})});const z=[0],U=X=>Math.max(...O[X].map(ne=>v(ne.id)));for(let X=1;X<O.length;X++){let ne=z[X-1]+U(X-1)+U(X)+r;const q=[...O[X]].sort((he,pe)=>he.angle-pe.angle);if(q.length>1)for(let he=0;he<q.length;he++){const pe=q[he],H=q[(he+1)%q.length];ne=Math.max(ne,x(pe.id,pe.angle,H.id,H.angle))}z.push(ne)}const F=new Map;let Y=v(T)+10;return O.forEach((X,ne)=>{const q=z[ne];for(const{id:he,angle:pe}of X)F.set(he,{x:q*Math.cos(pe),y:q*Math.sin(pe)}),Y=Math.max(Y,q+v(he))}),{positions:F,depthOf:B,ringRadii:z,bubbleRadius:Y}},_=h.roots,S=_.map(T=>b(T)),M=S.map(T=>({radius:T.bubbleRadius})),C=Gv(M.map(T=>({r:T.radius+c}))),k=new Map;for(let T=0;T<_.length;T++)k.set(_[T],{x:C[T].x,y:C[T].y});const L=new Map,E=new Map;for(let T=0;T<_.length;T++){const A=_[T],R=S[T],D=k.get(A),O=new Set;for(const[B,z]of R.positions)m.has(B)&&(L.set(B,{x:z.x+D.x,y:z.y+D.y}),E.set(B,A),O.add(R.depthOf.get(B)));for(const B of[...O].sort((z,U)=>z-U))B!==0&&u.ringGeometry.push({trunkId:A,cx:D.x,cy:D.y,r:R.ringRadii[B],depth:B})}const I=e.filter(T=>L.has(T.id));$d(I,L),u.positions=L;for(let T=0;T<_.length;T++){const A=_[T],R=k.get(A);let D=M[T].radius;for(const[O,B]of L){if(E.get(O)!==A)continue;const z=g(O),U=Math.hypot(z.width,z.height)/2,F=Math.hypot(B.x-R.x,B.y-R.y)+U;D=Math.max(D,F)}u.trunkBoundaries.set(A,{x:R.x,y:R.y,r:D})}return u}function x9(e,t,n,a,i,r){const l=new Set;if(!t)return l;const c=b9(t,n,i,r);for(const u of e)a(u)&&(c.has(u.sourceId)||c.has(u.targetId))&&l.add(u.id);return l}function b9(e,t,n,a){var l,c;const i=new Set;if(i.add(e),!t(e)||!((l=a==null?void 0:a.has(e))!=null&&l))return i;const r=(c=n.childrenOf.get(e))!=null?c:[];for(const u of r)t(u)||i.add(u);return i}const kM=.95,_9=1/(60*-Math.log(kM)),w9=.5,CM=100;function S9(e,t){const n=t-CM;let a=0;for(;a+1<e.length&&e[a+1].t<=n;)a++;return a>0&&e.splice(0,a),e}function N9(e,t){if(e.length<2)return{vx:0,vy:0};const n=e[e.length-1],a=t-CM;if(n.t<=a)return{vx:0,vy:0};let i,r;if(a<=e[0].t)i=e[0],r=e[0].t;else{let c=0;for(;e[c+1].t<=a;)c++;const u=e[c],h=e[c+1],m=(a-u.t)/(h.t-u.t);i={x:u.x+(h.x-u.x)*m,y:u.y+(h.y-u.y)*m},r=a}const l=Math.max(1,t-r)/1e3;return{vx:(n.x-i.x)/l,vy:(n.y-i.y)/l}}function iS(e,t){return e*Math.pow(kM,t*60)}function rS(e,t){return Math.hypot(e,t)*_9<w9}const k9=.25,C9=4,oS=1.2,Af=20,M9=.002,j9=.05,E9=1,R9=10;function L9(e){const t=e.deltaMode===1?j9:e.deltaMode===2?E9:M9,n=e.ctrlKey?R9:1;return Math.pow(2,-e.deltaY*t*n)}function Yy(e,t,n,a,i){const r=a/n;return{x:e-r*(e-i.x),y:t-r*(t-i.y)}}function T9(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function MM({minZoom:e=k9,maxZoom:t=C9,bounds:n,onViewportChange:a,containerRef:i,locked:r=!1,onUserGesture:l}){const[c,u]=j.useState(1),[h,m]=j.useState({x:0,y:0}),p=j.useRef(1),g=j.useRef({x:0,y:0}),v=j.useRef(r);j.useEffect(()=>{v.current=r},[r]);const x=j.useRef(null),b=j.useRef(!1),_=j.useRef(),S=j.useRef(),M=j.useRef(null),C=j.useRef(null),k=j.useRef(null),L=j.useCallback(W=>{p.current=W,u(W)},[]),E=j.useCallback(W=>{g.current=W,m(W)},[]),I=j.useCallback(()=>{C.current===null&&(C.current=requestAnimationFrame(()=>{C.current=null,u(p.current),m(g.current)}))},[]),T=j.useCallback(()=>{k.current!==null&&(cancelAnimationFrame(k.current),k.current=null)},[]),A=j.useRef(a);A.current=a;const R=j.useRef(l);R.current=l;const D=j.useCallback(W=>{var ge;(ge=R.current)==null||ge.call(R,W)},[]);j.useEffect(()=>{var W;(W=A.current)==null||W.call(A,{x:h.x,y:h.y,zoom:c})},[h,c]);const O=j.useCallback((W,ge)=>{if(!n)return{x:W,y:ge};const we=-n.maxX*p.current,je=-n.minX*p.current,De=-n.maxY*p.current,re=-n.minY*p.current;return{x:Math.max(we,Math.min(je,W)),y:Math.max(De,Math.min(re,ge))}},[n]),B=j.useCallback(W=>{var ge;(ge=_.current)==null||ge.call(_,W)},[]),z=j.useCallback(()=>{var W;(W=S.current)==null||W.call(S)},[]),U=j.useCallback(()=>{b.current||(document.addEventListener("pointermove",B),document.addEventListener("pointerup",z),b.current=!0)},[B,z]),F=j.useCallback(()=>{b.current&&(document.removeEventListener("pointermove",B),document.removeEventListener("pointerup",z),b.current=!1)},[B,z]),Y=j.useCallback(W=>{if(!x.current)return;const ge=performance.now(),we=x.current.samples;we.push({x:W.clientX,y:W.clientY,t:ge}),S9(we,ge),M.current!==null&&cancelAnimationFrame(M.current),M.current=requestAnimationFrame(()=>{if(!x.current)return;const je=O(x.current.panX+(W.clientX-x.current.x),x.current.panY+(W.clientY-x.current.y));E(je),M.current=null,D("change")})},[O,E,D]),X=j.useCallback(()=>{if(!x.current){F();return}const W=T9(),{vx:ge,vy:we}=N9(x.current.samples,performance.now());if(x.current=null,F(),W||rS(ge,we)){D("end");return}let je=ge,De=we,re=performance.now();const Z=()=>{const J=performance.now(),K=(J-re)/1e3;if(re=J,je=iS(je,K),De=iS(De,K),rS(je,De)){k.current=null,D("end");return}E(O(g.current.x+je*K,g.current.y+De*K)),D("change"),k.current=requestAnimationFrame(Z)};k.current=requestAnimationFrame(Z)},[F,O,E,D]),ne=j.useCallback(W=>{v.current||(T(),x.current={x:W.clientX,y:W.clientY,panX:g.current.x,panY:g.current.y,samples:[{x:W.clientX,y:W.clientY,t:performance.now()}]},U(),D("start"))},[U,T,D]);j.useEffect(()=>{_.current=Y},[Y]),j.useEffect(()=>{S.current=X},[X]),j.useEffect(()=>()=>{F(),M.current!==null&&cancelAnimationFrame(M.current),C.current!==null&&cancelAnimationFrame(C.current),T()},[F,T]);const q=j.useCallback(W=>{if(v.current)return;W.preventDefault();const ge=W.currentTarget.getBoundingClientRect(),we=W.clientX-ge.left,je=W.clientY-ge.top;if(!Number.isFinite(we)||!Number.isFinite(je))return;T();const De=p.current,re=Math.min(t,Math.max(e,De*L9(W))),Z=Yy(we,je,De,re,g.current);p.current=re,g.current=O(Z.x,Z.y),I(),D("change"),D("end")},[O,e,t,T,I,D]);j.useEffect(()=>{const W=i.current;if(W)return W.addEventListener("wheel",q,{passive:!1}),()=>W.removeEventListener("wheel",q)},[i,q]);const he=j.useCallback(W=>{if(v.current)return;const ge=W.key;let we=null,je=null;if(ge==="+"||ge==="=")we=Math.min(t,p.current*oS);else if(ge==="-"||ge==="_")we=Math.max(e,p.current/oS);else if(ge==="ArrowUp")je={x:g.current.x,y:g.current.y+Af};else if(ge==="ArrowDown")je={x:g.current.x,y:g.current.y-Af};else if(ge==="ArrowLeft")je={x:g.current.x+Af,y:g.current.y};else if(ge==="ArrowRight")je={x:g.current.x-Af,y:g.current.y};else return;if(W.preventDefault(),T(),we!==null){const De=i.current,re=De?De.clientWidth/2:0,Z=De?De.clientHeight/2:0;je=Yy(re,Z,p.current,we,g.current),p.current=we}je!==null&&(g.current=O(je.x,je.y)),I(),D("change"),D("end")},[O,e,t,i,T,I,D]),pe=j.useCallback((W,ge,we)=>{T();const je=Math.min(t,Math.max(e,W)),De=p.current;if(L(je),ge!==void 0&&we!==void 0){const re=Yy(ge,we,De,je,g.current);E(O(re.x,re.y))}},[O,e,t,T,L,E]),H=j.useCallback((W,ge)=>{T(),E(O(W,ge))},[O,T,E]),te=j.useCallback(()=>{T(),L(1),E({x:0,y:0})},[T,L,E]),ie=j.useCallback(()=>({x:g.current.x,y:g.current.y,zoom:p.current}),[]);return{transform:`matrix(${c}, 0, 0, ${c}, ${h.x}, ${h.y})`,viewport:{x:h.x,y:h.y,zoom:c},bind:{onPointerDown:ne,onKeyDown:he,tabIndex:0,role:"region"},zoomTo:pe,panTo:H,reset:te,getViewport:ie}}const A9=.15,I9=30;function D9({active:e,nodes:t,edges:n,options:a,onTick:i,initialPositions:r,onRunningChange:l}){const c=j.useRef({nodes:t,edges:n,options:a}),u=j.useRef(i),h=j.useRef(void 0),m=j.useRef(null),p=j.useRef(0),g=j.useRef(l);g.current=l;const v=j.useRef(!1),x=j.useCallback(M=>{var C;v.current!==M&&(v.current=M,(C=g.current)==null||C.call(g,M))},[]);j.useEffect(()=>{c.current={nodes:t,edges:n,options:a}},[t,n,a]),j.useEffect(()=>{u.current=i},[i]);const b=j.useCallback(()=>{const{nodes:M,edges:C,options:k}=c.current,L=h.current,E=h9(M,C,L,k);let I=0;if(L)for(const[T,A]of E){const R=L.get(T);if(!R)continue;const D=Math.hypot(A.x-R.x,A.y-R.y);D>I&&(I=D)}else I=1/0;if(h.current=E,u.current(E),p.current=I<A9&&!u9()?p.current+1:0,p.current>=I9){m.current=null,x(!1);return}m.current=requestAnimationFrame(b)},[x]),_=j.useCallback(()=>{p.current=0,m.current===null&&e&&(m.current=requestAnimationFrame(b),x(!0))},[e,b,x]),S=j.useRef(null);return j.useEffect(()=>{const M=t.map(k=>k.id).sort().join(" "),C=S.current!==null&&S.current!==M;S.current=M,C&&_()},[t,_]),j.useEffect(()=>{if(!e){m.current!==null&&(cancelAnimationFrame(m.current),m.current=null),x(!1);return}return h.current=r&&r.size>0?new Map(r):void 0,p.current=0,m.current=requestAnimationFrame(b),x(!0),()=>{m.current!==null&&(cancelAnimationFrame(m.current),m.current=null)}},[e]),{wake:_}}const jM=j.createContext(null),EM=j.createContext(null);function N0(){const e=j.useContext(jM);if(!e)throw new Error("useGraphCanvas must be used within a GraphCanvas");return e}const O9=44,RM=Se.forwardRef((L,k)=>{var E=L,{id:e,label:t,kind:n,domainColor:a="default",selected:i=!1,onSelect:r,hasChildren:l=!1,collapsed:c=!1,hiddenDescendantCount:u=0,onToggleCollapse:h,onPopoverOpen:m,popoverOpen:p=!1,popoverPanelId:g,tooltipId:v,onFocus:x,onBlur:b,className:_="",style:S,bodyRadius:M}=E,C=Ie(E,["id","label","kind","domainColor","selected","onSelect","hasChildren","collapsed","hiddenDescendantCount","onToggleCollapse","onPopoverOpen","popoverOpen","popoverPanelId","tooltipId","onFocus","onBlur","className","style","bodyRadius"]);const I=M!==void 0&&Number.isFinite(M)&&M>0,T=I?2*M:void 0,A=["graph-node",I&&"graph-node--body",I&&T<O9&&"graph-node--body-unlabeled",i&&"selected",_].filter(Boolean).join(" ");return f.jsxs("div",ee($($($($($({ref:k,className:A,"data-domain":a,"data-kind":n,onClick:R=>{R.stopPropagation();try{r==null||r(e)}catch(D){console.error("onSelect failed:",D)}try{m==null||m(R.currentTarget)}catch(D){console.error("onPopoverOpen failed:",D)}},onFocus:x,onBlur:b,onKeyDown:R=>{if(R.target===R.currentTarget){if((R.key==="Enter"||R.key===" ")&&!R.shiftKey){R.preventDefault(),R.stopPropagation();try{r==null||r(e)}catch(D){console.error("onSelect failed:",D)}try{m==null||m(R.currentTarget)}catch(D){console.error("onPopoverOpen failed:",D)}}else if(R.key==="Enter"&&R.shiftKey&&l&&h){R.preventDefault(),R.stopPropagation();try{h()}catch(D){console.error("onToggleCollapse failed:",D)}}}},role:r||m||l&&h?"button":void 0,tabIndex:r||m||l&&h?0:void 0,"aria-pressed":r?i:void 0,"aria-haspopup":m?"dialog":void 0},m&&{"aria-expanded":p}),m&&g&&{"aria-controls":g}),v&&{"aria-describedby":v}),I&&{style:{width:T,height:T},title:t}),C),{children:[f.jsx("span",{className:"graph-node__swatch"}),f.jsx("span",{className:"graph-node__label",children:t}),n&&f.jsx("span",{className:"graph-node__kind",children:n}),l&&h&&f.jsxs("button",{className:"graph-node__collapse-toggle",onClick:R=>{R.preventDefault(),R.stopPropagation();try{h()}catch(D){console.error("onToggleCollapse failed:",D)}},onKeyDown:R=>{if((R.key==="Enter"||R.key===" ")&&R.target===R.currentTarget){R.preventDefault(),R.stopPropagation();try{h()}catch(D){console.error("onToggleCollapse failed:",D)}}},type:"button","aria-label":c?`Expand ${t}`:`Collapse ${t}`,"aria-expanded":!c,children:[f.jsx("svg",{className:"graph-node__toggle-icon",viewBox:"0 0 24 24",width:"12",height:"12",children:c?f.jsx("polyline",{points:"9 6 15 12 9 18",strokeWidth:"1.75",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}):f.jsx("polyline",{points:"6 9 12 15 18 9",strokeWidth:"1.75",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}),c&&u>0&&f.jsx("span",{className:"graph-node__hidden-badge",children:u})]})]}))});RM.displayName="GraphNode";const lS=1,z9=8,B9=20,$9={default:1.25,hot:1.75,irrelevant:1.25},Gy={default:7,hot:8,irrelevant:7};function U9(e){const t=Number.isFinite(e)?e:0,n=Math.min(100,Math.max(0,t)),a=z9-lS;return lS+a*Math.sqrt(n/100)}function F9(e,t,n){return Math.min(e*(n/t),B9)}function P9(e){return Array.isArray(e)?`${e[0]} ${e[1]}`:`${e} ${e}`}function k0({id:e,d:t,mid:n,label:a,variant:i,weight:r,opacity:l,strokeDash:c,detailedTestIds:u=!1,onSelect:h}){const m=`arrow-${e}`,p=`arrow-rose-${e}`,g=`arrow-cyan-${e}`,v=i==="hot"?`url(#${g})`:i==="irrelevant"?`url(#${p})`:`url(#${m})`,x=r!==void 0?U9(r):void 0,b=$9[i],_=A=>x!==void 0?F9(A,b,x):A,S=x!==void 0?"userSpaceOnUse":void 0,M={};x!==void 0&&(M.strokeWidth=x),l!==void 0&&(M.opacity=l),c!==void 0&&(M.strokeDasharray=P9(c));const C=l!==void 0?{opacity:l}:void 0,k=_(Gy.default),L=_(Gy.irrelevant),E=_(Gy.hot),I=h?A=>{A.stopPropagation(),h(e)}:void 0,T=a?Kc(a):null;return f.jsxs(f.Fragment,{children:[f.jsxs("defs",{children:[f.jsx("marker",{id:m,viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:k,markerHeight:k,markerUnits:S,orient:"auto-start-reverse",children:f.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--graph-edge-strong, #94a3b8)",style:C})}),f.jsx("marker",{id:p,viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:L,markerHeight:L,markerUnits:S,orient:"auto-start-reverse",children:f.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"rgb(var(--status-rose))",style:C})}),f.jsx("marker",{id:g,viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:E,markerHeight:E,markerUnits:S,orient:"auto-start-reverse",children:f.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"rgb(var(--accent-primary))",style:C})})]}),f.jsx("path",{className:"graph-edge__hit",d:t,onClick:I,"data-testid":u?`graph-edge-hit-${e}`:void 0}),f.jsx("path",{className:"graph-edge__line",d:t,markerEnd:v,style:Object.keys(M).length?M:void 0,"data-testid":u?`graph-edge-line-${e}`:void 0}),a&&T&&f.jsxs("g",{className:h?"graph-edge__label graph-edge__label--clickable":"graph-edge__label",transform:`translate(${n.x-T.width/2}, ${n.y-T.height/2})`,onClick:I,children:[f.jsx("rect",{width:T.width,height:T.height,rx:"3",className:"graph-edge__label-bg","data-testid":u?`graph-edge-label-bg-${e}`:void 0}),f.jsx("text",{x:T.width/2,y:T.height/2+3,className:"graph-edge__label-text","data-testid":u?`graph-edge-label-text-${e}`:void 0,children:a})]})]})}k0.displayName="GraphEdgeShape";const cS=1.3,LM=Se.forwardRef((i,a)=>{var r=i,{position:e="bottom-right",className:t=""}=r,n=Ie(r,["position","className"]);var T,A;const{zoomBy:l,zoomToFit:c,locked:u,setLocked:h,isFullscreen:m,toggleFullscreen:p,layout:g,liveSimulation:v,setLiveSimulation:x}=N0(),b=j.useContext(EM),_=(T=b==null?void 0:b.zoomBy)!=null?T:l,S=(A=b==null?void 0:b.zoomToFit)!=null?A:c,M=j.useCallback(()=>_(cS),[_]),C=j.useCallback(()=>_(1/cS),[_]),k=j.useCallback(()=>S(),[S]),L=j.useCallback(()=>h(R=>!R),[h]),E=j.useCallback(()=>x(R=>!R),[x]),I=["graph-toolbar",`graph-toolbar--${e}`,t].filter(Boolean).join(" ");return f.jsxs("div",ee($({ref:a,className:I,"data-no-drag":!0},n),{children:[f.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:M,"aria-label":"Zoom in",children:f.jsx(nt,{name:"zoomIn",size:16})}),f.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:C,"aria-label":"Zoom out",children:f.jsx(nt,{name:"zoomOut",size:16})}),f.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:k,"aria-label":"Zoom to fit",children:f.jsx(nt,{name:"maximize",size:16})}),f.jsx("div",{className:"graph-toolbar__divider"}),f.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:L,"aria-pressed":u,"aria-label":u?"Unlock pan and zoom":"Lock pan and zoom",children:f.jsx(nt,{name:u?"lock":"unlock",size:16})}),f.jsx("div",{className:"graph-toolbar__divider"}),f.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:p,"aria-pressed":m,"aria-label":m?"Exit fullscreen":"Fullscreen",children:f.jsx(nt,{name:m?"fullscreenExit":"fullscreen",size:16})}),g==="galaxy"&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"graph-toolbar__divider"}),f.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:E,"aria-pressed":v,"aria-label":v?"Disable live simulation":"Enable live simulation",children:f.jsx(nt,{name:"orbit",size:16})})]})]}))});LM.displayName="GraphToolbar";const Ky=24,H9=4,TM=Se.forwardRef(({nodeId:e,label:t,collapsed:n,hiddenDescendantCount:a,onToggleCollapse:i,x:r,y:l,nodeWidth:c},u)=>{const h=j.useCallback(b=>{b.stopPropagation(),b.preventDefault();try{i()}catch(_){console.error("onToggleCollapse failed:",_)}},[i]),m=j.useCallback(b=>{b.stopPropagation(),b.preventDefault()},[]),p=j.useCallback(b=>{if(b.key==="Enter"||b.key===" "){b.preventDefault(),b.stopPropagation();try{i()}catch(_){console.error("onToggleCollapse failed:",_)}}},[i]),g=`${n?"Expand":"Collapse"} ${t}`,v=r+c/2+H9,x=l-Ky/2;return f.jsx("foreignObject",{x:v,y:x,width:Ky,height:Ky,overflow:"visible",className:"graph-collapse-control-container",children:f.jsxs("button",{ref:u,type:"button",className:"graph-collapse-control","aria-label":g,"aria-expanded":!n,onClick:h,onPointerDown:m,onKeyDown:p,"data-testid":`graph-collapse-control-${e}`,children:[n&&a>0&&f.jsx("span",{className:"graph-collapse-control__badge",children:a}),f.jsx(nt,{name:n?"chevronRight":"chevronDown",size:12})]})})});TM.displayName="GraphCollapseControl";function q9(e){const t=e.toUpperCase().replace(/[^A-Z]/g,""),n=e.toUpperCase().split(/[^A-Z]+/).filter(Boolean),a=[];n.length>1&&a.push(n[0][0]+n[1][0]);for(let i=1;i<t.length;i++)a.push(t[0]+t[i]);return a}function V9(e,t={}){var l;var n;const a=new Map,i=new Set,r=[];for(const c of e){if(a.has(c)||r.includes(c))continue;const u=(n=t[c])==null?void 0:n.code;u&&!i.has(u)?(a.set(c,u),i.add(u)):r.push(c)}for(const c of r){let u=q9(c).find(h=>!i.has(h));if(!u){const h=((l=c.replace(/[^a-zA-Z]/g,"")[0])!=null?l:"X").toUpperCase();let m=1;for(;i.has(h+m);)m++;u=h+m}a.set(c,u),i.add(u)}return a}const Y9=12;function G9(e){return`rgb(var(--graph-layer-${e%Y9+1}))`}function uS(e,t){return JSON.stringify(e.rank<=t.rank?[e.id,t.id]:[t.id,e.id])}function dS(e,t){let n=e;for(let a=2;t.has(n);a++)n=`${e}#${a}`;return t.add(n),n}function K9(e,t){return e.length>t?e.slice(0,Math.max(1,t-1))+"…":e}function Q9(e,t){var n;let a;typeof t=="function"?a=t(e):t==="kind"?a=e.kind:t==="domainColor"?a=e.domainColor:a=(n=e.attributes)==null?void 0:n[t];const i=Array.isArray(a)?a:[a],r=[];for(const l of i){if(l==null||l==="")continue;const c=String(l);r.includes(c)||r.push(c)}return r}function X9(e,t){var n;if(!t)return;if(typeof t=="function")return t(e)||void 0;const a=(n=e.attributes)==null?void 0:n[t],i=Array.isArray(a)?a[0]:a;return i==null||i===""?void 0:String(i)}function AM(e,t,n){var X,ne,q,he,pe,H,te,ie,W,ge,we,je,De,re;var a,i;const r=(X=n.catalog)!=null?X:{},l=(ne=n.fallbackCategory)!=null?ne:"other",c=(q=n.multiValue)!=null?q:"first",u=(he=n.missingValue)!=null?he:"exclude",h=(pe=n.maxLabelLength)!=null?pe:30,m=[],p=[],g=new Set,v=[];for(const Z of e){if(g.has(Z.id)){m.push({kind:"duplicate-node",id:Z.id,detail:`Node "${Z.id}" appears more than once; the first is used.`});continue}g.add(Z.id);let J=Q9(Z,n.layerBy);if(J.length===0){if(u==="exclude"){m.push({kind:"missing-layer-value",id:Z.id,detail:`Node "${Z.id}" has no layer value and is left out.`});continue}J=[""]}else if(J.length>1){if(c==="exclude"){m.push({kind:"multi-value-excluded",id:Z.id,detail:`Node "${Z.id}" has ${J.length} layer values and is left out.`});continue}c==="first"?J=[J[0]]:c==="last"&&(J=[J[J.length-1]])}for(const K of J)v.includes(K)||v.push(K);p.push({node:Z,layerIds:J})}const x=new Map(((H=n.layers)!=null?H:[]).map(Z=>[Z.id,Z])),b=[...((te=n.layers)!=null?te:[]).map(Z=>Z.id).filter(Z=>v.includes(Z)),...v.filter(Z=>!x.has(Z))].map((Z,J)=>{var Q,ae,ye;const K=x.get(Z);return{id:Z,label:(ae=K==null?void 0:K.label)!=null?ae:Z===""?(Q=n.missingLayerLabel)!=null?Q:"Unassigned":Z,color:(ye=K==null?void 0:K.color)!=null?ye:G9(J),rank:J,nodeIds:[],intraLinkCount:0,crossLinkCount:0}}),_=new Map(b.map(Z=>[Z.id,Z])),S=new Set(p.map(Z=>Z.node.id)),M=new Set(t.map(Z=>Z.id)),C=[],k=new Map,L=new Map;for(const{node:Z,layerIds:J}of p){const K=[];for(const Q of J){const ae=_.get(Q),ye=J.length>1?dS(`${Z.id}@${Q}`,S):Z.id,Ae=(a=Z.attributes)==null?void 0:a.description,de={id:ye,nodeId:Z.id,layerId:Q,layerRank:ae.rank,label:Z.label,displayLabel:K9(Z.label,h),kind:Z.kind,description:typeof Ae=="string"?Ae:void 0,weight:Z.weight,position:Z.x!==void 0&&Z.y!==void 0?{x:Z.x,y:Z.y}:void 0,source:Z,degree:0,crossDegree:0,adjacency:[]};C.push(de),k.set(ye,de),ae.nodeIds.push(ye),K.push(ye)}L.set(Z.id,K)}const E=[],I=new Map,T=new Map;for(const Z of t){const J=L.get(Z.sourceId),K=L.get(Z.targetId);if(!J||!K){(!g.has(Z.sourceId)||!g.has(Z.targetId))&&m.push({kind:"dangling-edge",id:Z.id,detail:`Edge "${Z.id}" references missing node "${g.has(Z.sourceId)?Z.targetId:Z.sourceId}".`});continue}if(Z.sourceId===Z.targetId){m.push({kind:"self-loop",id:Z.id,detail:`Edge "${Z.id}" is a self-loop on "${Z.sourceId}"; self-loops are not drawn.`});continue}const Q=(W=(ie=X9(Z,n.linkCategoryBy))!=null?ie:Z.label?(i=r[Z.label])==null?void 0:i.category:void 0)!=null?W:l,ae=J.length*K.length>1;for(const ye of J)for(const Ae of K){const de=JSON.stringify([ye,Ae]);let Je=I.get(de);if(!Je){const be=k.get(ye),Fe=k.get(Ae);Je={id:ae?dS(`${Z.id}@${ye}>${Ae}`,M):Z.id,sourceId:ye,targetId:Ae,predicates:[],predicateCategories:[],categories:[],primaryCategory:l,cross:be.layerId!==Fe.layerId,pairKey:uS(_.get(be.layerId),_.get(Fe.layerId)),edgeIds:[]},I.set(de,Je),E.push(Je),T.set(Je,[])}Je.edgeIds.push(Z.id),Z.label&&!Je.predicates.includes(Z.label)&&(Je.predicates.push(Z.label),Je.predicateCategories.push(Q));const Ge=T.get(Je);Ge.includes(Q)||Ge.push(Q)}}const A=[];for(const Z of E)for(const J of T.get(Z))A.includes(J)||A.push(J);const R=(ge=n.categoryOrder)!=null?ge:[],D=[...R.filter(Z=>A.includes(Z)),...A.filter(Z=>!R.includes(Z))],O=new Map(D.map((Z,J)=>[Z,J])),B=new Map,z={},U=new Map;for(const Z of E){Z.categories=T.get(Z).slice().sort((Q,ae)=>O.get(Q)-O.get(ae)),Z.primaryCategory=(we=Z.categories[0])!=null?we:l,B.set(Z.id,Z),z[Z.primaryCategory]=((je=z[Z.primaryCategory])!=null?je:0)+1;const J=k.get(Z.sourceId),K=k.get(Z.targetId);J.adjacency.push({linkId:Z.id,otherId:K.id,direction:"out"}),K.adjacency.push({linkId:Z.id,otherId:J.id,direction:"in"}),J.degree++,K.degree++,Z.cross?(J.crossDegree++,K.crossDegree++,_.get(J.layerId).crossLinkCount++,_.get(K.layerId).crossLinkCount++,U.set(Z.pairKey,((De=U.get(Z.pairKey))!=null?De:0)+1)):_.get(J.layerId).intraLinkCount++}const F=[];for(let Z=0;Z<b.length;Z++)for(let J=Z+1;J<b.length;J++){const K=uS(b[Z],b[J]);F.push({key:K,layerIds:[b[Z].id,b[J].id],linkCount:(re=U.get(K))!=null?re:0})}const Y=V9(E.flatMap(Z=>Z.predicates),r);return{layers:b,nodes:C,links:E,layerById:_,nodeById:k,linkById:B,instancesOf:L,layerPairs:F,categoryCounts:z,categories:D,catalog:r,predicateCodes:Y,issues:m}}const IM=Object.freeze({hiddenLayers:[],categories:{},hiddenPredicates:[],showIntra:!0,layerPair:null});function hS(e,t){return!t.hiddenLayers.includes(e.layerId)}function C0(e,t){return e.predicates.filter((n,a)=>t.categories[e.predicateCategories[a]]!==!1&&!t.hiddenPredicates.includes(n))}function Np(e,t,n){const a=t.nodeById.get(e.sourceId),i=t.nodeById.get(e.targetId);return!a||!i||!hS(a,n)||!hS(i,n)?!1:e.predicates.length===0?e.categories.some(r=>n.categories[r]!==!1):C0(e,n).length>0}function DM(e,t,n){return!e.cross&&!n.showIntra||n.layerPair&&!(e.cross&&e.pairKey===n.layerPair)?!1:Np(e,t,n)}function Z9(e,t){const n=new Set;if(!t)return n;for(const a of e.links)a.cross&&a.pairKey===t&&(n.add(a.sourceId),n.add(a.targetId));return n}const Qy=6,J9=["","6 4","2 3","1 5","10 3 2 3","4 2"];function W9(e){const t=(e%Qy+Qy)%Qy;return{color:`rgb(var(--graph-link-${t+1}))`,dash:J9[t]}}const e$=["","rgb(var(--graph-hop-1))","rgb(var(--graph-hop-2))","rgb(var(--graph-hop-3))"],t$=[null,{opacity:1,width:1.8},{opacity:.85,width:1.4},{opacity:.7,width:1.2}];function OM(e,t){var a;var n;return(a=(n=t.styles)==null?void 0:n[e])!=null?a:W9(Math.max(0,t.index.categories.indexOf(e)))}function n$(e,t){var v,x;var n,a;const i=DM(e,t.index,t.filters),r=OM(e.primaryCategory,t),l=!!((n=t.reach)!=null&&n.originId),c=(v=(a=t.reach)==null?void 0:a.linkHop.get(e.id))!=null?v:0,u=c>0;let h=e.cross?.75:.3;if(l&&!u&&(h=.06),!u&&t.focusedLayerId){const b=t.index.nodeById.get(e.sourceId),_=t.index.nodeById.get(e.targetId);(b==null?void 0:b.layerId)!==t.focusedLayerId&&(_==null?void 0:_.layerId)!==t.focusedLayerId&&(h*=.25)}const m=u?t$[Math.min(c,3)]:null,p=(x=t.predicateLabels)!=null?x:"highlighted",g=i&&(p==="all"?!l||u:p==="highlighted"?u||!!t.filters.layerPair:!1);return{visible:i,hop:c,highlighted:u,color:u?e$[Math.min(c,3)]:r.color,dash:u?"":r.dash,width:m?m.width:e.cross?1.3:1,opacity:m?m.opacity:h,z:u?10-Math.min(c,9):e.cross?1:0,arrow:i&&(u||g),label:g}}function a$(e,t){var h;var n,a;const i=(h=(n=t.reach)==null?void 0:n.hopOf.get(e.id))!=null?h:null,r=!!((a=t.reach)!=null&&a.originId),l=i===0,c=i!==null&&i>=2;let u=1;return r&&i===null&&(u=.2),t.filters.layerPair&&t.pairNodeIds&&!t.pairNodeIds.has(e.id)&&(u*=.25),t.focusedLayerId&&e.layerId!==t.focusedLayerId&&i===null&&(u*=.2),{hop:i,selected:l,followed:c,opacity:u,tint:l?"selected":c?"followed":"none"}}const s$=e=>({width:Math.round(e.displayLabel.length*6.4+22),height:24});function i$(e){return e?t=>t.categories.some(n=>e.includes(n)):()=>!0}function fS(e,t,n,a){return n.engine==="manual"?new Map(e.map(i=>[i.id,i.position?$({},i.position):{x:0,y:0}])):vM(e.map(i=>{var c,u;var r,l;return $({id:i.id,x:(c=(r=i.position)==null?void 0:r.x)!=null?c:NaN,y:(u=(l=i.position)==null?void 0:l.y)!=null?u:NaN},a(i))}),t.map(i=>({source:i.sourceId,target:i.targetId})),$({preferredEdgeLength:120,minimumNodeDistance:18},n.organic)).positions}function pS(e,t,n,a){if(e.length===0)return 1;let i=0,r=0;for(const c of e)i+=t.get(c.id).x,r+=t.get(c.id).y;i/=e.length,r/=e.length;let l=0;for(const c of e){const u=t.get(c.id),h=n(c);l=Math.max(l,Math.abs(u.x-i)+h.width/2,Math.abs(u.y-r)+h.height/2)}l=l||1;for(const c of e){const u=t.get(c.id);a.set(c.id,{x:(u.x-i)/l,y:(u.y-r)/l})}return l}function r$(e,t={}){var m;const n=(m=t.nodeSize)!=null?m:s$,a=i$(t.layoutCategories),i=new Map,r=new Map;for(const p of e.layers){const g=p.nodeIds.map(b=>e.nodeById.get(b)),v=e.links.filter(b=>!b.cross&&a(b)&&e.nodeById.get(b.sourceId).layerId===p.id),x=fS(g,v,t,n);r.set(p.id,pS(g,x,n,i))}const l=e.links.filter(p=>p.cross||a(p)),c=fS(e.nodes,l,t,n),u=new Map,h=pS(e.nodes,c,n,u);return{independent:i,coupled:u,scale:{independent:r,coupled:h}}}function o$(e,t){var i;const n=Math.max(0,Math.min(1,t)),a=new Map;for(const[r,l]of e.independent){const c=(i=e.coupled.get(r))!=null?i:l;a.set(r,{x:l.x+(c.x-l.x)*n,y:l.y+(c.y-l.y)*n})}return a}function zM(e,t){if(typeof e=="function")return e;const n=(a,i)=>a.label.localeCompare(i.label);switch(e){case"coupled-x":return(a,i)=>{var c,u;var r,l;return((c=(r=t==null?void 0:t.coupled.get(a.id))==null?void 0:r.x)!=null?c:0)-((u=(l=t==null?void 0:t.coupled.get(i.id))==null?void 0:l.x)!=null?u:0)||n(a,i)};case"degree":return(a,i)=>i.degree-a.degree||n(a,i);case"cross-degree":return(a,i)=>i.crossDegree-a.crossDegree||i.degree-a.degree||n(a,i);case"label":return n}}function BM(e,t,n="coupled-x"){const a=zM(n,t);return new Map(e.layers.map(i=>[i.id,i.nodeIds.map(r=>e.nodeById.get(r)).sort(a).map(r=>r.id)]))}function l$(e,t,n="coupled-x"){const a=BM(e,t,n);return e.layers.flatMap(i=>{var r;return(r=a.get(i.id))!=null?r:[]})}function c$(e,t="degree"){const n=zM(t,null),a=t==="degree"||t==="cross-degree",i=new Map;for(const r of e.layers){const l=r.nodeIds.map(c=>e.nodeById.get(c)).sort(n);a&&l.reverse(),l.forEach((c,u)=>i.set(c.id,(u+.5)/l.length))}return i}const mS=Object.freeze({originId:null,hopOf:new Map,linkHop:new Map,via:new Map,maxHop:0});function ex(e,t,n={}){var g,v,x;const a=t!=null?e.nodeById.get(t):void 0;if(!a)return mS;const i=(g=n.filters)!=null?g:IM;if(i.hiddenLayers.includes(a.layerId))return mS;const r=Math.max(0,Math.floor((v=n.follow)!=null?v:1)),l=(x=n.followCategories)!=null?x:null,c=new Map([[a.id,0]]),u=new Map,h=new Map;let m=0,p=[];for(const b of a.adjacency){const _=e.linkById.get(b.linkId);Np(_,e,i)&&(u.set(_.id,1),m=1,c.has(b.otherId)||(c.set(b.otherId,1),h.set(b.otherId,{fromId:a.id,linkId:_.id}),_.cross&&p.push(b.otherId)))}for(let b=2;b<=r+1&&p.length>0;b++){const _=[];for(const S of p)for(const M of e.nodeById.get(S).adjacency){const C=e.linkById.get(M.linkId);if(!C.cross)continue;const k=e.nodeById.get(M.otherId);if(k.layerId===a.layerId)continue;const L=c.get(k.id);L!==void 0&&L<b||Np(C,e,i)&&(l&&!C.categories.some(E=>l.includes(E))||(u.has(C.id)||u.set(C.id,b),m=Math.max(m,b),L===void 0&&(c.set(k.id,b),h.set(k.id,{fromId:S,linkId:C.id}),_.push(k.id))))}p=_}return{originId:a.id,hopOf:c,linkHop:u,via:h,maxHop:m}}const u$={};function yc(e,t,n){const[a,i]=j.useState(t),r=e!==void 0,l=r?e:a,c=j.useRef(n);c.current=n;const u=j.useCallback(h=>{var m;r||i(h),(m=c.current)==null||m.call(c,h)},[r]);return[l,u]}function th(e){var ie,W,ge,we,je,De;const{nodes:t,edges:n,layering:a,layout:i=u$,followCategories:r,linkStyles:l}=e,c=j.useMemo(()=>AM(t,n,a),[t,n,a]),u=j.useMemo(()=>i===!1?null:r$(c,i),[c,i]),[h,m]=yc(e.selectedId,(ie=e.defaultSelectedId)!=null?ie:null,e.onSelect),[p,g]=yc(e.follow,(W=e.defaultFollow)!=null?W:1,e.onFollowChange),[v,x]=yc(e.filters,(ge=e.defaultFilters)!=null?ge:IM,e.onFiltersChange),[b,_]=yc(e.predicateLabels,(we=e.defaultPredicateLabels)!=null?we:"highlighted",e.onPredicateLabelsChange),[S,M]=yc(e.focusedLayerId,(je=e.defaultFocusedLayerId)!=null?je:null,e.onFocusLayer),[C,k]=yc(e.planeLayout,(De=e.defaultPlaneLayout)!=null?De:"independent",e.onPlaneLayoutChange),[L,E]=j.useState(null),I=h!=null?c.nodeById.get(h):void 0,T=I&&!v.hiddenLayers.includes(I.layerId)?I.id:null,A=j.useMemo(()=>ex(c,T,{follow:p,followCategories:r,filters:v}),[c,T,p,r,v]),R=j.useMemo(()=>ex(c,L,{follow:0,filters:v}),[c,L,v]),D=j.useMemo(()=>Z9(c,v.layerPair),[c,v.layerPair]),O=j.useCallback(re=>g(Math.max(0,Math.floor(re))),[g]),B=j.useRef(v);B.current=v;const z=j.useCallback(re=>{const Z=re(B.current);B.current=Z,x(Z)},[x]),U=j.useCallback(re=>z(Z=>ee($({},Z),{categories:ee($({},Z.categories),{[re]:Z.categories[re]===!1})})),[z]),F=j.useCallback(re=>z(Z=>ee($({},Z),{hiddenPredicates:Z.hiddenPredicates.includes(re)?Z.hiddenPredicates.filter(J=>J!==re):[...Z.hiddenPredicates,re]})),[z]),Y=j.useCallback(re=>{const Z=!B.current.hiddenLayers.includes(re);z(J=>ee($({},J),{hiddenLayers:Z?[...J.hiddenLayers,re]:J.hiddenLayers.filter(K=>K!==re)})),Z&&S===re&&M(null),Z&&(I==null?void 0:I.layerId)===re&&m(null)},[z,S,M,I,m]),X=j.useCallback(re=>z(Z=>ee($({},Z),{showIntra:re})),[z]),ne=j.useCallback(re=>z(Z=>ee($({},Z),{layerPair:re===Z.layerPair?null:re})),[z]),q=j.useMemo(()=>({index:c,filters:v,reach:A,focusedLayerId:S,pairNodeIds:D,predicateLabels:b,styles:l}),[c,v,A,S,D,b,l]),he=j.useCallback(re=>n$(re,q),[q]),pe=j.useCallback(re=>a$(re,q),[q]),H=j.useMemo(()=>({selectedId:T,follow:p,filters:v,predicateLabels:b,focusedLayerId:S,planeLayout:C}),[T,p,v,b,S,C]),te=j.useCallback(re=>{re.selectedId!==void 0&&m(re.selectedId),re.follow!==void 0&&O(re.follow),re.filters!==void 0&&x(re.filters),re.predicateLabels!==void 0&&_(re.predicateLabels),re.focusedLayerId!==void 0&&M(re.focusedLayerId),re.planeLayout!==void 0&&k(re.planeLayout)},[m,O,x,_,M,k]);return{index:c,layout:u,reach:A,hoverReach:R,pairNodeIds:D,selectedId:T,hoveredId:L,follow:p,filters:v,predicateLabels:b,focusedLayerId:S,planeLayout:C,select:m,hover:E,setFollow:O,setFilters:x,toggleCategory:U,togglePredicate:F,toggleLayer:Y,setShowIntra:X,setLayerPair:ne,setPredicateLabels:_,focusLayer:M,setPlaneLayout:k,emphasisContext:q,linkEmphasis:he,nodeEmphasis:pe,snapshot:H,restore:te}}const vl=j.createContext(null);function xl(e,t,n=e.predicates){return n.map(a=>{var r;var i;return(r=(i=t[a])==null?void 0:i.label)!=null?r:a}).join(" · ")}function M0(e,t,n,a=7,i=3.2){const r=u=>Math.round(u*10)/10,l=e.x-t*a,c=e.y-n*a;return`${r(e.x)},${r(e.y)} ${r(l-n*i)},${r(c+t*i)} ${r(l+n*i)},${r(c-t*i)}`}const wa=e=>Math.round(e*10)/10;function j0(e,t){const n=Math.hypot(e,t);return n>1e-9?{x:e/n,y:t/n}:{x:1,y:0}}function d$(e,t){const n=j0(t.x-e.x,t.y-e.y);return{d:`M${wa(e.x)},${wa(e.y)} L${wa(t.x)},${wa(t.y)}`,pointAt:a=>({x:e.x+(t.x-e.x)*a,y:e.y+(t.y-e.y)*a}),tangentAt:()=>n}}function tx(e,t,n){return{d:`M${wa(e.x)},${wa(e.y)} Q${wa(t.x)},${wa(t.y)} ${wa(n.x)},${wa(n.y)}`,pointAt:a=>{const i=1-a;return{x:i*i*e.x+2*i*a*t.x+a*a*n.x,y:i*i*e.y+2*i*a*t.y+a*a*n.y}},tangentAt:a=>j0(2*(1-a)*(t.x-e.x)+2*a*(n.x-t.x),2*(1-a)*(t.y-e.y)+2*a*(n.y-t.y))}}function gS(e,t,n,a){return{d:`M${wa(e.x)},${wa(e.y)} C${wa(t.x)},${wa(t.y)} ${wa(n.x)},${wa(n.y)} ${wa(a.x)},${wa(a.y)}`,pointAt:i=>{const r=1-i,l=r*r*r,c=3*r*r*i,u=3*r*i*i,h=i*i*i;return{x:l*e.x+c*t.x+u*n.x+h*a.x,y:l*e.y+c*t.y+u*n.y+h*a.y}},tangentAt:i=>{const r=1-i,l=3*r*r*(t.x-e.x)+6*r*i*(n.x-t.x)+3*i*i*(a.x-n.x),c=3*r*r*(t.y-e.y)+6*r*i*(n.y-t.y)+3*i*i*(a.y-n.y);return j0(l,c)}}}const h$=[.5,.36,.64,.24,.76],$M=e=>({width:Math.round(e.length*6.4+12),height:15});function E0(e,t={}){var m,p,g,v,x;const n=(m=t.ts)!=null?m:h$,a=(p=t.size)!=null?p:$M,i=(g=t.gapX)!=null?g:2,r=(v=t.gapY)!=null?v:1,l=[...(x=t.obstacles)!=null?x:[]],c=b=>l.every(_=>Math.abs(_.x-b.x)>(_.width+b.width)/2+i||Math.abs(_.y-b.y)>(_.height+b.height)/2+r),u=e.map((b,_)=>({c:b,i:_})).sort((b,_)=>b.c.priority-_.c.priority||b.i-_.i),h=[];for(const{c:b}of u){const{width:_,height:S}=a(b.text);for(const M of n){const C=b.pointAt(M);if(!Number.isFinite(C.x)||!Number.isFinite(C.y))continue;const k={x:C.x,y:C.y,width:_,height:S};if(c(k)){l.push(k),h.push($({id:b.id,text:b.text,t:M},k));break}}}return h}function R0(e,t){return(t.highlighted?t.hop*2:10)+(e.cross?0:1)}const If=20,yS=32,vS=34,Df=12,xS=10,f$=70,p$=14,m$=40,dd=16,bS=28,g$=120,_S=20;function y$(e,t,n){var b,_,S,M,C,k,L;const a=(b=n.orientation)!=null?b:"horizontal",i=(E,I)=>{var R,D;var T,A;return((R=(T=t==null?void 0:t.coupled.get(E.id))==null?void 0:T.y)!=null?R:0)-((D=(A=t==null?void 0:t.coupled.get(I.id))==null?void 0:A.y)!=null?D:0)||E.label.localeCompare(I.label)},r=(_=n.order)!=null?_:t?a==="vertical"?i:"coupled-x":"degree",l=new Set((S=n.hiddenLayers)!=null?S:[]),c=BM(e,t,r),u=e.layers.filter(E=>!l.has(E.id)),h=new Map,m=[];if(a==="horizontal"){const E=Math.max(80,(M=n.maxRowWidth)!=null?M:1120);let I=dd;for(const T of u){const A=(C=c.get(T.id))!=null?C:[],R=[[]];let D=0;for(const z of A){const U=n.sizeOf(z).width+p$;D+U>E&&R[R.length-1].length&&(R.push([]),D=0),R[R.length-1].push(z),D+=U}let O=I+vS;for(const z of R){const U=z.reduce((ne,q)=>Math.max(ne,n.sizeOf(q).height),0),F=z.reduce((ne,q)=>ne+n.sizeOf(q).width,0),Y=z.length>1?Math.min(m$,Math.max(0,(E-F)/(z.length-1))):0;let X=yS+(E-F-Y*(z.length-1))/2;for(const ne of z){const q=n.sizeOf(ne);h.set(ne,{x:X+q.width/2,y:O+U/2}),X+=q.width+Y}O+=U+Df}A.length===0&&(O+=24+Df);const B=O-I+xS;m.push({layerId:T.id,label:T.label,color:T.color,count:A.length,x:If,y:I,width:E+2*(yS-If),height:B,titleX:If+14,titleY:I+19}),I+=B+f$}}else{const E=Math.max(80,(k=n.maxRowWidth)!=null?k:640);let I=If;const T=dd+vS;let A=0;for(const R of u){const D=(L=c.get(R.id))!=null?L:[],O=[[]];let B=0;for(const X of D){const ne=n.sizeOf(X).height+Df;B+ne>E&&O[O.length-1].length&&(O.push([]),B=0),O[O.length-1].push(X),B+=ne}let z=I+_S,U=T;for(const X of O){const ne=X.reduce((he,pe)=>Math.max(he,n.sizeOf(pe).width),0);let q=T;for(const he of X){const pe=n.sizeOf(he);h.set(he,{x:z+ne/2,y:q+pe.height/2}),q+=pe.height+Df}U=Math.max(U,q),z+=ne+bS}const F=Math.max(140,z-bS-I+_S),Y=U-dd+xS;A=Math.max(A,Y),m.push({layerId:R.id,label:R.label,color:R.color,count:D.length,x:I,y:dd,width:F,height:Y,titleX:I+14,titleY:dd+19}),I+=F+g$}for(const R of m)R.height=A}let p=1/0,g=1/0,v=-1/0,x=-1/0;for(const E of m)p=Math.min(p,E.x),g=Math.min(g,E.y),v=Math.max(v,E.x+E.width),x=Math.max(x,E.y+E.height);return m.length||(p=g=v=x=0),{orientation:a,positions:h,bands:m,bounds:{minX:p,minY:g,maxX:v,maxY:x}}}function wS(e,t){const n=Math.hypot(e,t);return n>1e-9?{x:e/n,y:t/n}:{x:0,y:1}}function v$(e,t,n,a="horizontal"){if(a==="horizontal"){if(n){const g=e.y<t.y,v=g?e.y+e.height/2:e.y-e.height/2,x=g?t.y-t.height/2:t.y+t.height/2,b=(x-v)*.5;return ee($({},gS({x:e.x,y:v},{x:e.x,y:v+b},{x:t.x,y:x-b},{x:t.x,y:x})),{tip:{x:t.x,y:x},dir:{x:0,y:g?1:-1}})}const u=e.y-e.height/2,h=t.y-t.height/2,m=10+Math.abs(t.x-e.x)*.12+Math.abs(t.y-e.y)*.3,p={x:(e.x+t.x)/2,y:Math.min(u,h)-m};return ee($({},tx({x:e.x,y:u},p,{x:t.x,y:h})),{tip:{x:t.x,y:h},dir:wS(t.x-p.x,h-p.y)})}if(n){const u=e.x<t.x,h=u?e.x+e.width/2:e.x-e.width/2,m=u?t.x-t.width/2:t.x+t.width/2,p=(m-h)*.5;return ee($({},gS({x:h,y:e.y},{x:h+p,y:e.y},{x:m-p,y:t.y},{x:m,y:t.y})),{tip:{x:m,y:t.y},dir:{x:u?1:-1,y:0}})}const i=e.x-e.width/2,r=t.x-t.width/2,l=10+Math.abs(t.y-e.y)*.12+Math.abs(t.x-e.x)*.3,c={x:Math.min(i,r)-l,y:(e.y+t.y)/2};return ee($({},tx({x:i,y:e.y},c,{x:r,y:t.y})),{tip:{x:r,y:t.y},dir:wS(r-c.x,t.y-c.y)})}const SS=200,x$=150,NS=e=>e==="force"||e==="organic"||e==="orthogonal"||e==="galaxy"||e==="force-clustered"||e==="ux-navigation"||e==="radial-tree",UM=e=>e.replace(/[^\w:.-]/g,"_"),b$=e=>`tooltip-node-${UM(e)}`,_$=e=>`tooltip-edge-${UM(e)}`,ls=138,cs=30,w$=.05,S$=8,kS=3;function FM(e,t,n){try{return e(t,n)}catch(a){return console.error("Error in renderEdge callback:",a),null}}function N$(e,t,n,a,i){try{return e(t,n,a,i)}catch(r){return console.error("Error in renderNode callback:",r),null}}function Xy(e,t){const{groupHeads:n,leafToGroup:a}=OB(e,t),i=new Set(n);for(const r of e)i.has(r)||a.delete(r);return a}function Si(e,t,n){if(!e)return n!=="ux-navigation";try{return e(t)}catch(a){return console.error("Error in isStructuralEdge callback:",a),n!=="ux-navigation"}}function Zy(e,t){if(!e)return!0;try{return e(t)}catch(n){return console.error("Error in isPageNode callback:",n),!0}}function Jy(e,t){if(!e)return!1;try{return e(t)}catch(n){return console.error("Error in isNavigationRoute callback:",n),!1}}const fo=6;function k$(e,t,n){var v,x,b,_;const{width:a,height:i}=Kc(e),r=(v=t==null?void 0:t.width)!=null?v:ls,l=(x=t==null?void 0:t.height)!=null?x:cs,c=(b=n==null?void 0:n.width)!=null?b:ls,u=(_=n==null?void 0:n.height)!=null?_:cs,h=(r+c)/2+a,m=(l+u)/2+i,p=2/Math.PI,g=p*h+(1-p)*m+2*fo;return{length:g,label:{width:a+2*fo,height:i+2*fo,offset:Math.min(80,g*Pp)/2}}}function C$({id:e,sourceId:t,targetId:n,sourceLabel:a,targetLabel:i,label:r,variant:l="default",weight:c,opacity:u,strokeDash:h,sourceAnchor:m,targetAnchor:p,curvature:g,selected:v,hovered:x,onSelect:b,onHoverStart:_,onHoverEnd:S,renderEdge:M,onPopoverOpen:C,hasPopover:k,popoverOpen:L,popoverPanelId:E,tooltipId:I,isNavigationRoute:T=!1,preRoutedEdge:A}){const{getNodeRect:R,nodeRects:D}=N0(),O=j.useMemo(()=>{var pe,H;if(A){let te=A.mid;if(r){const ie=Kc(r),W=ie.width/2+fo,ge=ie.height/2+fo;te=(H=((pe=A.labelAnchors)!=null?pe:[]).find(we=>D.every(je=>Math.abs(we.x-je.x)>=W+je.width/2||Math.abs(we.y-je.y)>=ge+je.height/2)))!=null?H:Hv(A.points,ie,D,fo,A.isPolyline)}return ee($({},A),{labelPos:te})}const Y=R(t),X=R(n);if(!Y||!X)return null;const ne=D.filter(te=>!(te.x===Y.x&&te.y===Y.y&&te.width===Y.width&&te.height===Y.height)&&!(te.x===X.x&&te.y===X.y&&te.width===X.width&&te.height===X.height)),q=T?u5(Y,X,ne):gp(Y,X,{sourceAnchor:m,targetAnchor:p,curvature:g}),he=r?Hv(q.points,Kc(r),D,fo,q.isPolyline):q.mid;return ee($({},q),{labelPos:he})},[A,r,D,R,t,n,m,p,g,T]);if(!O)return null;const B=["graph-edge",l!=="default"&&`graph-edge--${l}`,T&&"graph-edge--navigation",v&&"selected"].filter(Boolean).join(" "),z=!!b||!!k||!!I,U={id:e,sourceId:t,targetId:n,label:r,variant:l,weight:c,opacity:u,strokeDash:h,sourceAnchor:m,targetAnchor:p,curvature:g},F=z?Y=>{Y.stopPropagation(),k&&C&&C(e,Y.currentTarget),b&&b(e)}:void 0;return f.jsx("g",ee($($($({className:B,role:z?"button":"presentation","aria-hidden":z?void 0:!0,"aria-pressed":z?!!v:void 0,"aria-haspopup":k?"dialog":void 0},k&&{"aria-expanded":!!L}),k&&E&&{"aria-controls":E}),z&&I&&{"aria-describedby":I}),{"aria-label":z?mp(r,a||t,i||n):void 0,tabIndex:z?0:void 0,onClick:F,onKeyDown:z?Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),k&&C&&C(e,Y.currentTarget),b&&b(e))}:void 0,onPointerEnter:_?()=>_(e):void 0,onPointerLeave:S?()=>S(e):void 0,"data-testid":`graph-edge-${e}`,children:M?f.jsxs(f.Fragment,{children:[FM(M,U,{path:O.d,mid:O.mid,labelPos:O.labelPos,angle:O.angle,selected:!!v,hovered:!!x}),f.jsx("path",{className:"graph-edge__hit",d:O.d,onClick:F})]}):f.jsx(k0,{id:e,d:O.d,mid:O.labelPos,label:r,variant:l,weight:c,opacity:u,strokeDash:h,onSelect:b})}))}const M$={nodes:[],edges:[],layering:{layerBy:""},layout:!1},j$={layerBy:"kind",missingValue:"layer"};function E$({id:e,label:t,ariaLabel:n,fullLabel:a,color:i,tint:r,selected:l,onSelect:c,onPopoverOpen:u,popoverOpen:h,popoverPanelId:m,tooltipId:p}){const g=x=>{try{c==null||c(e)}catch(b){console.error("onSelect failed:",b)}try{u==null||u(x)}catch(b){console.error("onPopoverOpen failed:",b)}},v=!!c||!!u;return f.jsx("div",ee($($($({className:["graph-lane-node",r!=="none"&&`graph-lane-node--${r}`].filter(Boolean).join(" "),style:{"--graph-lane-color":i},"data-no-drag":!0,title:a,role:v?"button":void 0,tabIndex:v?0:void 0,"aria-label":n,"aria-pressed":c?l:void 0,"aria-haspopup":u?"dialog":void 0},u&&{"aria-expanded":!!h}),u&&m&&{"aria-controls":m}),p&&{"aria-describedby":p}),{onClick:x=>{x.stopPropagation(),g(x.currentTarget)},onKeyDown:x=>{x.target===x.currentTarget&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),x.stopPropagation(),g(x.currentTarget))},children:f.jsx("span",{className:"graph-lane-node__label",children:t})}))}const R$=1500,L$=150;function T$(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const qp=Se.forwardRef((ae,Q)=>{var ye=ae,{nodes:e=[],edges:t=[],selectedNodeId:n,onNodeSelect:a,onNodeHover:i,nodeTooltip:r,nodeTooltipTrigger:l="hover",edgeTooltip:c,edgeTooltipTrigger:u="hover",nodePopover:h,edgePopover:m,centerOnSelect:p=!1,renderNode:g,renderEdge:v,layout:x="manual",nodeMargin:b,showClusterBoundaries:_,showHierarchyRings:S=!1,isStructuralEdge:M,structuralEdgeCurvature:C=Pp,isPageNode:k,isNavigationRoute:L,showAllRelations:E=!1,collapsedNodeIds:I,onToggleCollapse:T,fitView:A=!1,fitPadding:R=40,minZoom:D=w$,maxZoom:O=S$,selectedEdgeId:B,onEdgeSelect:z,onEdgeHover:U,onBackgroundClick:F,onLayoutStateChange:Y,showLayoutIndicator:X=!0,draggable:ne=!0,onNodeDragEnd:q,showToolbar:he=!0,toolbarPosition:pe="bottom-right",fullscreenContainerRef:H,onViewportDwell:te,dwellMs:ie=R$,onViewportNavigate:W,initialViewport:ge,viewportRef:we,layeredGraph:je,layering:De,layeredGraphOptions:re,laneOptions:Z,className:J=""}=ye,K=Ie(ye,["nodes","edges","selectedNodeId","onNodeSelect","onNodeHover","nodeTooltip","nodeTooltipTrigger","edgeTooltip","edgeTooltipTrigger","nodePopover","edgePopover","centerOnSelect","renderNode","renderEdge","layout","nodeMargin","showClusterBoundaries","showHierarchyRings","isStructuralEdge","structuralEdgeCurvature","isPageNode","isNavigationRoute","showAllRelations","collapsedNodeIds","onToggleCollapse","fitView","fitPadding","minZoom","maxZoom","selectedEdgeId","onEdgeSelect","onEdgeHover","onBackgroundClick","onLayoutStateChange","showLayoutIndicator","draggable","onNodeDragEnd","showToolbar","toolbarPosition","fullscreenContainerRef","onViewportDwell","dwellMs","onViewportNavigate","initialViewport","viewportRef","layeredGraph","layering","layeredGraphOptions","laneOptions","className"]);var yu,vu,xu,$l;const Ae=x==="layer-lanes",de=j.useContext(vl),Je=Ae?je!=null?je:de:null,Ge=th(Ae&&!Je?ee($({},re),{nodes:e,edges:t,layering:De!=null?De:j$}):M$),be=Ae?Je!=null?Je:Ge:null,Fe=be==null?void 0:be.index,me=be==null?void 0:be.filters,Ee=(Z==null?void 0:Z.intraLinks)!=="none",se=j.useMemo(()=>{if(!Fe||!me)return null;const V=new Set(me.hiddenLayers),ce=Fe.nodes.filter(Ue=>!V.has(Ue.layerId)).map(Ue=>ee($({},Ue.source),{id:Ue.id,x:void 0,y:void 0})),Ce=new Map(t.map(Ue=>[Ue.id,Ue])),Te=Fe.links.filter(Ue=>DM(Ue,Fe,me)&&(Ue.cross||Ee)),et=Te.map(Ue=>ee($({},Ce.get(Ue.edgeIds[0])),{id:Ue.id,sourceId:Ue.sourceId,targetId:Ue.targetId,label:xl(Ue,Fe.catalog)||void 0}));return{nodes:ce,edges:et,links:Te}},[Fe,me,t,Ee]),le=(yu=se==null?void 0:se.nodes)!=null?yu:e,xe=(vu=se==null?void 0:se.edges)!=null?vu:t,Pe=be==null?void 0:be.select,$e=(xu=be==null?void 0:be.selectedId)!=null?xu:null,Be=be?$e!=null?$e:void 0:n,at=j.useMemo(()=>Pe?V=>{Pe($e===V?null:V),a==null||a(V)}:a,[Pe,$e,a]),ot=j.useMemo(()=>Pe?()=>{Pe(null),F==null||F()}:F,[Pe,F]),ft=_!=null?_:x!=="galaxy",[it,kt]=j.useState(new Map),[pt,Yt]=j.useState(new Map),[Rt,hn]=j.useState(),[Nn,An]=j.useState(),[It,$n]=j.useState(),[yn,Na]=j.useState(),[kn,Un]=j.useState(),[Cn,Xt]=j.useState(),Mn=j.useRef(!1),Gt=j.useRef({}),Zn=j.useRef(null);j.useEffect(()=>{try{i==null||i(Rt)}catch(V){console.error("Error in onNodeHover callback:",V)}},[Rt,i]);const ys=be==null?void 0:be.hover;j.useEffect(()=>{ys==null||ys(Rt!=null?Rt:null)},[Rt,ys]),j.useEffect(()=>{try{U==null||U(Nn)}catch(V){console.error("Error in onEdgeHover callback:",V)}},[Nn,U]),j.useEffect(()=>{Nn&&((xe!=null?xe:[]).some(V=>V.id===Nn)||(An(void 0),Gt.current.edgeTimer&&clearTimeout(Gt.current.edgeTimer),Na(void 0)))},[Nn,xe]),j.useEffect(()=>()=>{Gt.current.nodeTimer&&clearTimeout(Gt.current.nodeTimer),Gt.current.edgeTimer&&clearTimeout(Gt.current.edgeTimer)},[]);const[Hn,ti]=j.useState(new Map),da=j.useRef(null),fn=j.useCallback(V=>{var Ce;const ce=da.current;if(ce)try{if(ce.dragging){if(V){const et=ce.target,Ue=Ke=>{Ke.stopPropagation(),Ke.preventDefault()};et.addEventListener("click",Ue,{capture:!0,once:!0})}const Te=(Ce=Hn.get(ce.id))!=null?Ce:{x:ce.startX,y:ce.startY};q==null||q(ce.id,Te)}}finally{da.current=null}},[Hn,q]),Re=j.useRef(fn);j.useEffect(()=>{Re.current=fn},[fn]);const We=j.useMemo(()=>le.map(V=>V.id).sort().join(" "),[le]),lt=j.useRef(!1);j.useEffect(()=>{if(!lt.current){lt.current=!0;return}const V=da.current;if(V!=null&&V.dragging)try{V.target.releasePointerCapture(V.pointerId)}catch(ce){ce instanceof DOMException||console.warn("GraphCanvas: releasePointerCapture failed",ce)}Re.current(!1),ti(new Map)},[We]);const[ht,jn]=j.useState(!1),[pa,Ua]=j.useState(!1),Wt=j.useRef(!1),en=j.useRef(null),[In,Ts]=j.useState(!1),Jn=In&&x==="galaxy",ma=j.useRef(Jn);j.useEffect(()=>{ma.current=Jn},[Jn]);const Lt=j.useMemo(()=>{const V=xe.map(ce=>({source:ce.sourceId,target:ce.targetId,structural:Si(M,ce,x)}));return Hp(le.map(ce=>ce.id),V)},[le,xe,M,x]),Wn=j.useMemo(()=>{if(x!=="galaxy")return null;const V=new Map(le.map(ce=>[ce.id,ce.weight]));return _M(le.map(ce=>ce.id),Lt.childrenOf,ce=>V.get(ce))},[x,le,Lt]),pi=j.useMemo(()=>le.some(V=>V.weight!==void 0&&Number.isFinite(V.weight)&&V.weight>=0),[le]),Dn=j.useMemo(()=>Wn&&!g?WB(Wn,pi?{}:{minRadius:JB}):null,[Wn,g,pi]),Xa=j.useCallback(V=>({weight:Wn==null?void 0:Wn.get(V),radius:Dn==null?void 0:Dn.get(V)}),[Wn,Dn]),mi=j.useCallback(V=>{const ce=Dn==null?void 0:Dn.get(V);if(ce!==void 0)return ce;const Ce=it.get(V);return Ce?Math.hypot(Ce.width,Ce.height)/2:20},[Dn,it]),Li=j.useMemo(()=>{if(!I||I.size===0)return new Set;const V=new Set;for(const ce of I)for(const Ce of Xv(ce,Lt.childrenOf))V.add(Ce);return V},[I,Lt]),Sl=j.useMemo(()=>{if(x!=="ux-navigation"||!L)return new Set;const V=new Map(le.map(ce=>[ce.id,ce]));return x9(xe,Rt,ce=>{const Ce=V.get(ce);return Ce?Zy(k,Ce):!1},ce=>Jy(L,ce),Lt,I)},[x,L,xe,Rt,Lt,I,k,le]),Tt=j.useMemo(()=>{const V=new Set,ce=[];for(const Ce of le)V.has(Ce.id)||(V.add(Ce.id),Li.has(Ce.id)||ce.push(Ce));return ce},[le,Li]);j.useEffect(()=>{Rt&&(Tt.some(V=>V.id===Rt)||(hn(void 0),Gt.current.nodeTimer&&clearTimeout(Gt.current.nodeTimer),$n(void 0)))},[Rt,Tt]);const[As,vs]=j.useState(new Map),[La,Ta]=j.useState([]),[wo,su]=j.useState(null),[Fa,mr]=j.useState(new Map),[ni,gi]=j.useState(()=>NS(x)&&le.length>0),Fn=j.useRef(null),[gr,Nl]=j.useState(0),[Ti,Is]=j.useState(null);if(Ti)throw Ti;const ai=j.useRef(null),Ai=j.useRef({}),Za=j.useRef(!1),[yr,So]=j.useState(!1),[Mt,No]=j.useState(null),ko=j.useRef(null),Ds=j.useMemo(()=>{if(!(x!=="galaxy"||!Mt||Mt.height===0))return Math.round(Mt.width/Mt.height*20)/20},[x,Mt]),Ii=j.useRef(Ds);j.useEffect(()=>{Ii.current=Ds});const Aa=j.useRef(te);Aa.current=te;const si=j.useRef(W);si.current=W;const Di=j.useRef(ie);Di.current=ie;const Ja=j.useRef(Mt);Ja.current=Mt;const Os=j.useRef(()=>({x:0,y:0,zoom:1})),ii=j.useRef(null),oe=j.useRef(!1),ze=j.useRef(null),Ye=j.useRef(null),Xe=j.useRef(ge?{viewport:ge,silent:!0}:null),dt=j.useRef(!1),xt=j.useCallback(V=>{const ce=Ja.current;if(!ce)return null;const Ce=-V.x/V.zoom,Te=-V.y/V.zoom,et=(ce.width-V.x)/V.zoom,Ue=(ce.height-V.y)/V.zoom;return{center:{x:(Ce+et)/2,y:(Te+Ue)/2},zoom:V.zoom,bounds:{minX:Ce,minY:Te,maxX:et,maxY:Ue}}},[]),Ct=j.useCallback(()=>{ii.current!==null&&(clearTimeout(ii.current),ii.current=null)},[]),zt=j.useCallback(()=>{ze.current!==null&&(cancelAnimationFrame(ze.current),ze.current=null)},[]),aa=j.useCallback(V=>{V!=="end"&&zt(),Aa.current&&(Ct(),V==="change"?oe.current=!0:V==="end"&&oe.current&&(ii.current=setTimeout(()=>{var ce;ii.current=null,oe.current=!1;const Ce=xt(Os.current());if(Ce)try{(ce=Aa.current)==null||ce.call(Aa,Ce)}catch(Te){console.error("Error in onViewportDwell callback:",Te)}},Di.current)))},[zt,Ct,xt]),{transform:Ia,viewport:vt,bind:ga,panTo:En,zoomTo:sn,getViewport:qn}=MM({minZoom:D,maxZoom:O,containerRef:ai,locked:ht,onUserGesture:aa});Os.current=qn;const On=j.useCallback(V=>{zt(),Ct(),oe.current=!1,Ye.current=V&&si.current?{cause:V,target:qn()}:null},[zt,Ct,qn]);j.useEffect(()=>{var V;const ce=Ye.current;if(!ce)return;const{target:Ce}=ce,Te=qn();if(Te.x!==Ce.x||Te.y!==Ce.y||Te.zoom!==Ce.zoom){Ye.current=null;return}if(vt.x!==Ce.x||vt.y!==Ce.y||vt.zoom!==Ce.zoom)return;Ye.current=null;const et=xt(Ce);if(et)try{(V=si.current)==null||V.call(si,et,ce.cause)}catch(Ue){console.error("Error in onViewportNavigate callback:",Ue)}}),j.useEffect(()=>()=>{Ct(),zt()},[Ct,zt]);const zs=j.useCallback(V=>{const ce=Ja.current;if(!ce)return!1;const Ce=Math.min(O,Math.max(D,V.zoom));return sn(Ce),En(ce.width/2-V.center.x*Ce,ce.height/2-V.center.y*Ce),!0},[D,O,sn,En]),kl=j.useCallback((V,ce={})=>{var Yn;var Ce,Te;if(!Number.isFinite((Ce=V==null?void 0:V.center)==null?void 0:Ce.x)||!Number.isFinite((Te=V==null?void 0:V.center)==null?void 0:Te.y)||!Number.isFinite(V==null?void 0:V.zoom)||V.zoom<=0){console.warn("GraphCanvas: setViewport() ignored an invalid viewport",V);return}const et=(Yn=ce.silent)!=null?Yn:!1,Ue=Ja.current;if(!Za.current||!Ue){Xe.current={viewport:V,silent:et};return}const Ke=et?null:{kind:"imperative"};if(!ce.animate||T$()){zs(V),On(Ke);return}On(null);const tt=qn(),st={x:(Ue.width/2-tt.x)/tt.zoom,y:(Ue.height/2-tt.y)/tt.zoom},wt=Math.min(O,Math.max(D,V.zoom)),Dt=performance.now(),_n=Bt=>{const Nt=Math.min(1,(Bt-Dt)/L$);if(Nt>=1){ze.current=null,zs(V),On(Ke);return}const ia=1-Math.pow(1-Nt,3);zs({center:{x:st.x+(V.center.x-st.x)*ia,y:st.y+(V.center.y-st.y)*ia},zoom:tt.zoom*Math.pow(wt/tt.zoom,ia)}),ze.current=requestAnimationFrame(_n)};ze.current=requestAnimationFrame(_n)},[zs,On,qn,D,O]),vr=j.useCallback(()=>xt(qn()),[xt,qn]);j.useImperativeHandle(we,()=>({setViewport:kl,getViewport:vr}),[kl,vr]);const xr=j.useRef(null),Co=j.useCallback(V=>{if(V.target instanceof Element&&V.target.closest(".graph-node, .graph-edge, [data-no-drag]")){xr.current=null;return}xr.current={x:V.clientX,y:V.clientY},ga.onPointerDown(V)},[ga]),Cl=j.useCallback(V=>{const ce=xr.current;xr.current=null,ce&&Math.hypot(V.clientX-ce.x,V.clientY-ce.y)<kS&&(Un(void 0),Xt(void 0),ot==null||ot())},[ot]),iu=`grid${j.useId().replace(/:/g,"")}`;j.useLayoutEffect(()=>{const V=new Map;for(const ce of Tt){const Ce=Ai.current[ce.id];V.set(ce.id,{width:(Ce==null?void 0:Ce.offsetWidth)||ls,height:(Ce==null?void 0:Ce.offsetHeight)||cs})}kt(V)},[Tt,g,Dn]),j.useEffect(()=>{if(!NS(x)||Tt.length===0){gi(!1);return}if(it.size===0)return;if(x==="galaxy"&&ma.current){gi(!1);return}const V=()=>{if(x==="galaxy"&&ma.current){gi(!1);return}let ce,Ce=new Map,Te=new Map,et=[];try{const Ue=Tt.map((Ke,tt)=>{var Dt,_n,Yn,Bt;var st,wt;return{id:Ke.id,x:(Dt=Ke.x)!=null?Dt:Math.cos(2*Math.PI*tt/Tt.length)*120,y:(_n=Ke.y)!=null?_n:Math.sin(2*Math.PI*tt/Tt.length)*120,width:(Yn=(st=it.get(Ke.id))==null?void 0:st.width)!=null?Yn:ls,height:(Bt=(wt=it.get(Ke.id))==null?void 0:wt.height)!=null?Bt:cs,pinned:Ke.x!==void 0&&Ke.y!==void 0}});if(x==="force"){const Ke=(xe!=null?xe:[]).map(tt=>({source:tt.sourceId,target:tt.targetId}));ce=Kv(Ue,Ke,{nodeMargin:b})}else if(x==="organic"){const Ke=(xe!=null?xe:[]).map(st=>$({source:st.sourceId,target:st.targetId},st.label?k$(st.label,it.get(st.sourceId),it.get(st.targetId)):{})),tt=Tt.map(st=>{var _n,Yn,Bt,Nt;var wt,Dt;return{id:st.id,x:(_n=st.x)!=null?_n:NaN,y:(Yn=st.y)!=null?Yn:NaN,width:(Bt=(wt=it.get(st.id))==null?void 0:wt.width)!=null?Bt:ls,height:(Nt=(Dt=it.get(st.id))==null?void 0:Dt.height)!=null?Nt:cs,pinned:st.x!==void 0&&st.y!==void 0}});ce=vM(tt,Ke,{minimumNodeDistance:b}).positions}else if(x==="orthogonal"){const Ke=new Set(Tt.map(Nt=>Nt.id)),tt=(xe!=null?xe:[]).filter(Nt=>Ke.has(Nt.sourceId)&&Ke.has(Nt.targetId)),st=Tt.map(Nt=>{var Wa,Nr,zi,ka;var ia,Ro;return{id:Nt.id,x:(Wa=Nt.x)!=null?Wa:NaN,y:(Nr=Nt.y)!=null?Nr:NaN,width:(zi=(ia=it.get(Nt.id))==null?void 0:ia.width)!=null?zi:ls,height:(ka=(Ro=it.get(Nt.id))==null?void 0:Ro.height)!=null?ka:cs,pinned:Nt.x!==void 0&&Nt.y!==void 0}}),wt=new Map(le.map(Nt=>[Nt.id,Nt])),Dt=BB(st,tt.map(Nt=>({source:Nt.sourceId,target:Nt.targetId,structural:M?Si(M,Nt,x):void 0,navigationRoute:L?Jy(L,Nt):void 0})),k?{isPageNode:Nt=>{const ia=wt.get(Nt);return ia?Zy(k,ia):!0}}:{}),_n=new Map,Yn=[];ce=Dt.positions;const Bt=st.map(Nt=>ee($({},Dt.positions.get(Nt.id)),{w:Nt.width,h:Nt.height}));tt.forEach((Nt,ia)=>{var Nr,zi,ka;var Ro;const Wa=c5((Nr=Dt.routes[ia])!=null?Nr:[]);if(Wa){if(Nt.label&&(Ro=Wa.labelAnchors)!=null&&Ro.length){const Bi=Kc(Nt.label),Ha=(es,Bs,vi)=>Math.abs(es.x-Bs.x)>=(Bi.width+Bs.w)/2+vi||Math.abs(es.y-Bs.y)>=(Bi.height+Bs.h)/2+vi,$i=es=>Bt.every(Bs=>Ha(es,Bs,fo)),bu=es=>$i(es)&&Yn.every(Bs=>Ha(es,Bs,2)),Ui=(ka=(zi=Wa.labelAnchors.find(bu))!=null?zi:Wa.labelAnchors.find($i))!=null?ka:Wa.labelAnchors[0];Wa.labelAnchors=[Ui,...Wa.labelAnchors.filter(es=>es!==Ui)],Yn.push({x:Ui.x,y:Ui.y,w:Bi.width,h:Bi.height})}_n.set(Nt.id,Wa)}}),Ce=_n}else if(x==="force-clustered"){const Ke=(xe!=null?xe:[]).map(st=>({source:st.sourceId,target:st.targetId})),tt=P8(Ue,Ke,{nodeMargin:b});ce=tt.positions,Te=tt.clusterBoundaries}else if(x==="ux-navigation"){const Ke=(xe!=null?xe:[]).map(st=>({source:st.sourceId,target:st.targetId,structural:Si(M,st,x)})),tt=new Map(le.map(st=>[st.id,st]));ce=p9(Ue,Ke,it,st=>{const wt=tt.get(st.id);return wt?Zy(k,wt):!0})}else if(x==="radial-tree"){const Ke=(xe!=null?xe:[]).map(st=>({source:st.sourceId,target:st.targetId,structural:Si(M,st,x)})),tt=v9(Ue,Ke,it,Lt);ce=tt.positions,Te=tt.trunkBoundaries,et=tt.ringGeometry}else{const Ke=(xe!=null?xe:[]).map(st=>({source:st.sourceId,target:st.targetId,structural:Si(M,st,x)}));ce=sS(Ue.map(st=>$($({},st),Xa(st.id))),Ke,{nodeMargin:b,aspectRatio:Ii.current});const tt=Xy(Lt.roots,Lt.childrenOf);Te=Vy(ce,tt,mi)}}catch(Ue){gi(!1),Is(Ue);return}Yt(ce),mr(Ce),vs(Te),Ta(et),su(x),gi(!1)};return Fn.current=V,gi(!0),Nl(ce=>ce+1),()=>{Fn.current===V&&(Fn.current=null)}},[Tt,xe,it,x,b,M,k,L,Lt,le,I,Xa,mi]),j.useEffect(()=>{const V=Fn.current;if(V)return g9(()=>{Fn.current===V&&(Fn.current=null,V())})},[gr]);const ru=j.useCallback(()=>Tt.map(V=>{var Ke,tt,st,wt;var ce,Ce;const Te=Hn.get(V.id),et=(Ke=Te==null?void 0:Te.x)!=null?Ke:V.x,Ue=(tt=Te==null?void 0:Te.y)!=null?tt:V.y;return $({id:V.id,width:(st=(ce=it.get(V.id))==null?void 0:ce.width)!=null?st:ls,height:(wt=(Ce=it.get(V.id))==null?void 0:Ce.height)!=null?wt:cs,x:et,y:Ue,pinned:et!==void 0&&Ue!==void 0},Xa(V.id))}),[Tt,it,Hn,Xa]),Zp=j.useMemo(()=>Jn?ru():[],[Jn,ru]),Jp=j.useMemo(()=>Jn?(xe!=null?xe:[]).map(V=>({source:V.sourceId,target:V.targetId,structural:Si(M,V,x)})):[],[Jn,xe,M,x]),Mo=j.useMemo(()=>Jn?Xy(Lt.roots,Lt.childrenOf):null,[Jn,Lt]),Wp=j.useCallback(V=>{Yt(V),!(!ft||!Mo)&&vs(Vy(V,Mo,mi))},[ft,Mo,mi]),[em,tm]=j.useState(!1),{wake:ou}=D9({active:Jn,nodes:Zp,edges:Jp,options:{nodeMargin:b,aspectRatio:Ds},onTick:Wp,initialPositions:pt,onRunningChange:tm}),br=ni?"computing":Jn&&em?"simulating":"idle",Ml=j.useRef(Y);Ml.current=Y;const sh=j.useRef("idle");j.useEffect(()=>{var V;if(sh.current!==br){sh.current=br;try{(V=Ml.current)==null||V.call(Ml,br)}catch(ce){console.error("Error in onLayoutStateChange callback:",ce)}}},[br]);const lu=j.useMemo(()=>{const V=new Set;if(!ni)return V;for(const ce of Tt)ce.x!==void 0&&ce.y!==void 0||Hn.has(ce.id)||pt.has(ce.id)||V.add(ce.id);return V},[ni,Tt,Hn,pt]);j.useEffect(()=>{const V=ai.current;if(!V)return;const ce=new ResizeObserver(Ce=>{const{width:Te,height:et}=Ce[0].contentRect;Te>0&&et>0&&No({width:Te,height:et})});return ce.observe(V),()=>ce.disconnect()},[]),j.useEffect(()=>{const V=()=>{var Te;const ce=(Te=H==null?void 0:H.current)!=null?Te:ai.current,Ce=document.fullscreenElement===ce;Ua(Ce),en.current!==null&&(clearTimeout(en.current),en.current=null),Ce?(Wt.current=!0,en.current=setTimeout(()=>{Wt.current=!1,en.current=null},500)):Wt.current=!1};return document.addEventListener("fullscreenchange",V),()=>{document.removeEventListener("fullscreenchange",V),en.current!==null&&clearTimeout(en.current)}},[H]);const ih=j.useCallback(()=>{var Ue;var V,ce,Ce,Te;const et=(Ue=H==null?void 0:H.current)!=null?Ue:ai.current;document.fullscreenElement===et?(ce=(V=document.exitFullscreen)==null?void 0:V.call(document))==null||ce.catch(Ke=>{console.warn("GraphCanvas: exitFullscreen() was rejected",Ke)}):(Te=(Ce=et==null?void 0:et.requestFullscreen)==null?void 0:Ce.call(et))==null||Te.catch(Ke=>{console.warn("GraphCanvas: requestFullscreen() was rejected for the fullscreenContainerRef (or default root) target",Ke)})},[H]),rh=($l=be==null?void 0:be.layout)!=null?$l:null,jl=me==null?void 0:me.hiddenLayers,oh=Z==null?void 0:Z.orientation,lh=Z==null?void 0:Z.order,ch=Z==null?void 0:Z.maxRowWidth,ya=j.useMemo(()=>!Fe||it.size===0?null:y$(Fe,rh,{orientation:oh,order:lh,maxRowWidth:ch,hiddenLayers:jl,sizeOf:V=>{var ce;return(ce=it.get(V))!=null?ce:{width:ls,height:cs}}}),[Fe,rh,jl,oh,lh,ch,it]),Pa=j.useCallback(V=>{var Te;const ce=Hn.get(V.id);return ce||(ya==null?void 0:ya.positions.get(V.id))||(V.x!==void 0&&V.y!==void 0?{x:V.x,y:V.y}:(Te=pt.get(V.id))!=null?Te:{x:0,y:0})},[Hn,pt,ya]),El=j.useCallback(()=>{var et;let V=1/0,ce=-1/0,Ce=1/0,Te=-1/0;for(const Ue of Tt){const Ke=Pa(Ue),tt=(et=it.get(Ue.id))!=null?et:{width:ls,height:cs};V=Math.min(V,Ke.x-tt.width/2),ce=Math.max(ce,Ke.x+tt.width/2),Ce=Math.min(Ce,Ke.y-tt.height/2),Te=Math.max(Te,Ke.y+tt.height/2)}return Number.isFinite(V)?(ya&&ya.bands.length>0&&(V=Math.min(V,ya.bounds.minX),ce=Math.max(ce,ya.bounds.maxX),Ce=Math.min(Ce,ya.bounds.minY),Te=Math.max(Te,ya.bounds.maxY)),{minX:V,maxX:ce,minY:Ce,maxY:Te}):null},[Tt,it,Pa,ya]),Rl=j.useMemo(()=>{const V=[];if(ft&&V.push(...As.values()),S)for(const ce of La)V.push({x:ce.cx,y:ce.cy,r:ce.r});return V},[ft,As,S,La]);j.useEffect(()=>{if(Za.current||!Mt||it.size===0||Tt.length===0||(x==="force"||x==="organic"||x==="orthogonal"||x==="galaxy"||x==="force-clustered"||x==="ux-navigation"||x==="radial-tree")&&(pt.size===0||wo!==x))return;const V=El();if(!V)return;Za.current=!0,So(!0);const ce=Xe.current;if(Xe.current=null,ce&&zs(ce.viewport))dt.current=!0,Ll.current=Be,On(ce.silent?null:{kind:"imperative"});else if(A){const Ce=Oy(Dy(V,Rl),Mt.width,Mt.height,R,D,O);sn(Ce.zoom),En(Ce.panX,Ce.panY),On({kind:"fit",reason:"mount"})}else{const Ce=(V.minX+V.maxX)/2,Te=(V.minY+V.maxY)/2;En(Mt.width/2-Ce*vt.zoom,Mt.height/2-Te*vt.zoom),On({kind:"fit",reason:"mount"})}},[Mt,it,pt,Tt,x,vt.zoom,En,sn,zs,On,Be,A,R,El,wo,Rl]);const Ll=j.useRef(void 0);j.useEffect(()=>{if(!p||!yr||ht||Be===Ll.current)return;if(!Be){Ll.current=void 0;return}if(!Mt)return;const V=Tt.find(Ce=>Ce.id===Be);if(!V)return;Ll.current=Be;const ce=Pa(V);En(Mt.width/2-ce.x*vt.zoom,Mt.height/2-ce.y*vt.zoom),On({kind:"center-on-select",nodeId:Be})},[p,yr,Be,ht,Mt,Tt,Pa,vt.zoom,En,On]),j.useEffect(()=>{const V=ko.current;if(ko.current=Mt,!Za.current||!V||!Mt||V.width===Mt.width&&V.height===Mt.height)return;const ce=(V.width/2-vt.x)/vt.zoom,Ce=(V.height/2-vt.y)/vt.zoom;En(Mt.width/2-ce*vt.zoom,Mt.height/2-Ce*vt.zoom)},[Mt,vt.x,vt.y,vt.zoom,En]);const cu=j.useRef(void 0);j.useEffect(()=>{var Dt,_n,Yn;if(x!=="galaxy"||Ds===void 0||cu.current===Ds||ht||it.size===0)return;const V=cu.current===void 0;if(cu.current=Ds,ma.current){ou();return}const ce=ru(),Ce=(xe!=null?xe:[]).map(Bt=>({source:Bt.sourceId,target:Bt.targetId,structural:Si(M,Bt)})),Te=sS(ce,Ce,{nodeMargin:b,aspectRatio:Ds});Yt(Te);const et=Xy(Lt.roots,Lt.childrenOf),Ue=Vy(Te,et,mi);vs(Ue);let Ke=1/0,tt=-1/0,st=1/0,wt=-1/0;for(const Bt of Tt){const Nt=(_n=(Dt=Hn.get(Bt.id))!=null?Dt:Te.get(Bt.id))!=null?_n:{x:0,y:0},ia=(Yn=it.get(Bt.id))!=null?Yn:{width:ls,height:cs};Ke=Math.min(Ke,Nt.x-ia.width/2),tt=Math.max(tt,Nt.x+ia.width/2),st=Math.min(st,Nt.y-ia.height/2),wt=Math.max(wt,Nt.y+ia.height/2)}if(Number.isFinite(Ke)&&Mt&&!(V&&dt.current)){const Bt={minX:Ke,maxX:tt,minY:st,maxY:wt};if(A){const Nt=Oy(ft?Dy(Bt,Ue.values()):Bt,Mt.width,Mt.height,R,D,O);sn(Nt.zoom),En(Nt.panX,Nt.panY)}else{const Nt=(Bt.minX+Bt.maxX)/2,ia=(Bt.minY+Bt.maxY)/2;En(Mt.width/2-Nt*vt.zoom,Mt.height/2-ia*vt.zoom)}On(Za.current?{kind:"fit",reason:V?"mount":"resize"}:null)}},[Ds,x,ht]);const _r=j.useCallback((V,ce)=>{const Ce=El();if(!Ce||!Mt)return;const Te=Oy(Dy(Ce,Rl),Mt.width,Mt.height,V!=null?V:R,D,O);sn(Te.zoom),En(Te.panX,Te.panY),On(ce)},[El,Rl,Mt,R,D,O,sn,En,On]),uh=j.useCallback(V=>_r(V,{kind:"imperative"}),[_r]);j.useEffect(()=>{!Wt.current||!Mt||(Wt.current=!1,!ht&&_r(void 0,{kind:"fit",reason:"fullscreen"}))},[Mt,_r,ht]);const Tl=j.useCallback(V=>{if(!Mt){sn(vt.zoom*V);return}sn(vt.zoom*V,Mt.width/2,Mt.height/2)},[Mt,vt.zoom,sn]),dh=j.useCallback(V=>{Tl(V),On({kind:"imperative"})},[Tl,On]),Al=j.useCallback(V=>{sn(V),On({kind:"imperative"})},[sn,On]),wr=j.useCallback((V,ce)=>{En(V,ce),On({kind:"imperative"})},[En,On]),nm=j.useMemo(()=>({zoomBy:V=>{Tl(V),aa("change"),aa("end")},zoomToFit:()=>_r(void 0,{kind:"fit",reason:"toolbar"})}),[Tl,aa,_r]),uu=j.useCallback(V=>{An(ce=>ce===V?void 0:ce)},[]),du=j.useCallback(V=>{An(V),c&&(Gt.current.edgeTimer&&clearTimeout(Gt.current.edgeTimer),Gt.current.edgeTimer=setTimeout(()=>{Na(V)},SS))},[c]),hu=j.useCallback(V=>{uu(V),Gt.current.edgeTimer&&clearTimeout(Gt.current.edgeTimer),Na(void 0)},[uu]),fu=j.useCallback(V=>{hn(V),r&&(Gt.current.nodeTimer&&clearTimeout(Gt.current.nodeTimer),Gt.current.nodeTimer=setTimeout(()=>{$n(V)},SS))},[r]),pu=j.useCallback(V=>{hn(ce=>ce===V?void 0:ce),Gt.current.nodeTimer&&clearTimeout(Gt.current.nodeTimer),$n(void 0)},[]),Pn=j.useCallback(V=>{var Ue;const ce=Tt.find(Ke=>Ke.id===V);if(!ce)return le.some(Ke=>Ke.id===V)||console.warn(`GraphCanvas: node "${V}" not found`),null;const Ce=Pa(ce),Te=(Ue=it.get(V))!=null?Ue:{width:ls,height:cs},et=Dn==null?void 0:Dn.get(V);return $({x:Ce.x,y:Ce.y,width:Te.width,height:Te.height},et!==void 0?{radius:et}:{})},[le,Tt,it,Pa,Dn]),am=j.useCallback((V,ce)=>{if(!ne)return;V.stopPropagation();const Ce=Pa(ce);da.current={id:ce.id,pointerId:V.pointerId,startClientX:V.clientX,startClientY:V.clientY,startX:Ce.x,startY:Ce.y,dragging:!1,target:V.currentTarget}},[ne,Pa]),sm=j.useCallback(V=>{const ce=da.current;if(!ce||ce.pointerId!==V.pointerId)return;const Ce=V.clientX-ce.startClientX,Te=V.clientY-ce.startClientY;if(!ce.dragging&&Math.hypot(Ce,Te)<kS)return;const et=Ce/vt.zoom,Ue=Te/vt.zoom;ce.dragging||V.currentTarget.setPointerCapture(V.pointerId),ce.dragging=!0;const Ke={x:ce.startX+et,y:ce.startY+Ue};ti(tt=>{const st=new Map(tt);return st.set(ce.id,Ke),st}),ou()},[vt.zoom,ou]),hh=j.useCallback(V=>{const ce=da.current;!ce||ce.pointerId!==V.pointerId||fn(V.type==="pointerup")},[fn]);j.useEffect(()=>{if(ne)return;const V=da.current;if(V){if(V.dragging)try{V.target.releasePointerCapture(V.pointerId)}catch(ce){ce instanceof DOMException||console.warn("GraphCanvas: releasePointerCapture failed",ce)}fn(!1)}},[ne,fn]);const Oi=j.useMemo(()=>Tt.map(V=>Pn(V.id)).filter(V=>V!==null),[Tt,Pn]),Il=be==null?void 0:be.linkEmphasis,ea=j.useMemo(()=>{if(!se||!ya||!Fe||!Il)return null;const V=new Map(Tt.map(Ue=>[Ue.id,Pn(Ue.id)])),ce=[];for(const Ue of se.links){const Ke=V.get(Ue.sourceId),tt=V.get(Ue.targetId);!Ke||!tt||ce.push({link:Ue,em:Il(Ue),curve:v$(Ke,tt,Ue.cross,ya.orientation)})}ce.sort((Ue,Ke)=>Ue.em.z-Ke.em.z);const Ce=new Map(ce.map(Ue=>[Ue.link.id,Ue])),Te=E0(ce.filter(Ue=>Ue.em.label&&Ue.link.predicates.length>0).map(Ue=>({id:Ue.link.id,text:xl(Ue.link,Fe.catalog),pointAt:Ue.curve.pointAt,priority:R0(Ue.link,Ue.em)})),{obstacles:Oi,size:$M}),et=new Map(Te.map(Ue=>[Ue.id,Ue]));return{items:ce,byId:Ce,pills:Te,pillById:et}},[se,ya,Fe,Il,Oi,Tt,Pn]),Sr=j.useMemo(()=>ea?new Map(xe.map(V=>[V.id,V])):null,[ea,xe]),im=j.useMemo(()=>{if(x!=="orthogonal"||Fa.size===0)return new Map;if(Hn.size===0)return Fa;const V=new Map;for(const ce of xe!=null?xe:[]){const Ce=Fa.get(ce.id);Ce&&!Hn.has(ce.sourceId)&&!Hn.has(ce.targetId)&&V.set(ce.id,Ce)}return V},[x,Fa,Hn,xe]),Dl=j.useMemo(()=>{if(x!=="ux-navigation"||!L)return new Map;const V=xe.filter(Ce=>{try{return L(Ce)}catch(Te){return!1}});if(V.length===0)return new Map;const ce=V.map(Ce=>{const Te=Pn(Ce.sourceId),et=Pn(Ce.targetId);return!Te||!et?null:{id:Ce.id,source:Te,target:et}}).filter(Ce=>Ce!==null);return ce.length===0?new Map:d5(ce,Oi,Od)},[x,L,xe,Pn,Oi,M,C]),jo=j.useCallback(V=>{var Ue,Ke;var ce;const Ce=((Ue=(ce=Lt.childrenOf.get(V))==null?void 0:ce.length)!=null?Ue:0)>0,Te=(Ke=I==null?void 0:I.has(V))!=null?Ke:!1,et=Te?Xv(V,Lt.childrenOf).size:0;return{hasChildren:Ce,collapsed:Te,hiddenDescendantCount:et,onToggleCollapse:T?()=>T(V):void 0}},[Lt,I,T]),Ol=j.useCallback((V,ce)=>{Zn.current=ce;try{(h?h(V):l==="click"&&r?r(V):null)!=null&&(Un(V.id),Xt(void 0))}catch(Ce){console.error("Error in nodePopover/nodeTooltip callback:",Ce),Mn.current=!0,Un(V.id),Xt(void 0)}},[h,r,l]),zl=j.useCallback((V,ce)=>{Zn.current=ce;try{(m?m(V):u==="click"&&c?c(V):null)!=null&&(Xt(V.id),Un(void 0))}catch(Ce){console.error("Error in edgePopover/edgeTooltip callback:",Ce),Mn.current=!0,Xt(V.id),Un(void 0)}},[m,c,u]),Bl=j.useCallback((V,ce,Ce)=>{var st,wt;const Te=jo(V.id),et=kn===V.id,Ue=h||l==="click"&&r,Ke={nodeId:V.id,tooltipId:Ce,onSelect:at,onPopoverOpen:Ue?Dt=>Ol(V,Dt):void 0};if(g)return N$(g,V,ce,Te,Ke);const tt=be==null?void 0:be.index.nodeById.get(V.id);if(tt){const Dt=be.nodeEmphasis(tt),_n=be.index.layerById.get(tt.layerId);return f.jsx(E$,{id:V.id,label:tt.displayLabel,fullLabel:tt.label,ariaLabel:`${tt.label}, ${(st=_n==null?void 0:_n.label)!=null?st:tt.layerId} layer${Dt.selected?", selected":""}`,color:(wt=_n==null?void 0:_n.color)!=null?wt:"rgb(var(--canvas-fg-3))",tint:Dt.selected?"selected":Dt.followed?"followed":Dt.hop!==null?"reached":"none",selected:Dt.selected,onSelect:at,onPopoverOpen:Ke.onPopoverOpen,popoverOpen:et,popoverPanelId:et?`popover-node-${V.id}`:void 0,tooltipId:Ce})}return f.jsx(RM,{bodyRadius:Dn==null?void 0:Dn.get(V.id),id:V.id,label:V.label,kind:V.kind,domainColor:V.domainColor,selected:ce,onSelect:at,onPopoverOpen:Ue?Dt=>Ol(V,Dt):void 0,hasChildren:Te.hasChildren,collapsed:Te.collapsed,hiddenDescendantCount:Te.hiddenDescendantCount,onToggleCollapse:Te.onToggleCollapse,popoverOpen:et,popoverPanelId:et?`popover-node-${V.id}`:void 0,tooltipId:Ce})},[g,at,jo,h,r,l,Ol,kn,Dn,be]),sa=j.useMemo(()=>{var ce,Ce;var V;if(r&&l==="hover"&&It&&It!==kn){const Te=Tt.find(et=>et.id===It);if(Te){const et=Pa(Te),Ue=(ce=it.get(Te.id))!=null?ce:{width:ls,height:cs};try{const Ke=r(Te);return{type:"node",nodeId:It,tooltipId:b$(It),content:Ke,worldX:et.x,worldY:et.y-Ue.height/2}}catch(Ke){return console.error("Error in nodeTooltip callback:",Ke),null}}}if(c&&u==="hover"&&yn&&yn!==Cn){const Te=xe.find(Ke=>Ke.id===yn),et=Te&&Pn(Te.sourceId),Ue=Te&&Pn(Te.targetId);if(Te&&et&&Ue){const Ke=(Ce=Te.curvature)!=null?Ce:Si(M,Te)?C:void 0,tt=(V=ea==null?void 0:ea.byId.get(Te.id))==null?void 0:V.curve,st=tt?{mid:tt.pointAt(.5)}:gp(et,Ue,{sourceAnchor:Te.sourceAnchor,targetAnchor:Te.targetAnchor,curvature:Ke});try{const wt=c(Te);return{type:"edge",edgeId:yn,tooltipId:_$(yn),content:wt,worldX:st.mid.x,worldY:st.mid.y}}catch(wt){return console.error("Error in edgeTooltip callback:",wt),null}}}return null},[r,l,c,u,It,yn,kn,Cn,Tt,it,Pa,xe,Pn,M,C,ea]),mu=j.useMemo(()=>{const V=new Map;for(const ce of le)V.has(ce.id)||V.set(ce.id,ce.label);return V},[le]),yi=j.useCallback(V=>mu.get(V)||V,[mu]),va=j.useMemo(()=>{var ce,Ce;var V;if(Mn.current=!1,kn){const Te=Tt.find(et=>et.id===kn);if(Te){const et=Pa(Te),Ue=(ce=it.get(Te.id))!=null?ce:{width:ls,height:cs};try{const Ke=h?h(Te):l==="click"&&r?r(Te):null;return Ke!=null?{type:"node",nodeId:kn,ariaLabel:`Details for ${Te.label||Te.id}`,content:Ke,worldX:et.x,worldY:et.y-Ue.height/2}:null}catch(Ke){return console.error("Error in nodePopover/nodeTooltip callback:",Ke),Mn.current=!0,null}}}if(Cn){const Te=xe.find(Ke=>Ke.id===Cn),et=Te&&Pn(Te.sourceId),Ue=Te&&Pn(Te.targetId);if(Te&&et&&Ue){const Ke=(Ce=Te.curvature)!=null?Ce:Si(M,Te)?C:void 0,tt=(V=ea==null?void 0:ea.byId.get(Te.id))==null?void 0:V.curve,st=tt?{mid:tt.pointAt(.5)}:gp(et,Ue,{sourceAnchor:Te.sourceAnchor,targetAnchor:Te.targetAnchor,curvature:Ke});try{const wt=m?m(Te):u==="click"&&c?c(Te):null;return wt!=null?{type:"edge",edgeId:Cn,ariaLabel:`Details for ${mp(Te.label,yi(Te.sourceId),yi(Te.targetId))}`,content:wt,worldX:st.mid.x,worldY:st.mid.y}:null}catch(wt){return console.error("Error in edgePopover/edgeTooltip callback:",wt),Mn.current=!0,null}}}return null},[h,r,l,m,c,u,kn,Cn,Tt,it,Pa,xe,Pn,M,C,yi,ea]);j.useEffect(()=>{Mn.current&&(kn||Cn)&&(Un(void 0),Xt(void 0),Mn.current=!1)},[va,kn,Cn]);const gu=j.useCallback(()=>{const V=Zn.current;V&&document.body.contains(V)&&V.focus(),Un(void 0),Xt(void 0),Zn.current=null},[]),rm=j.useCallback(V=>{if(V.key==="Escape"&&va){V.preventDefault(),gu();return}if(V.key==="Escape"&&Pe&&$e){V.preventDefault(),Pe(null);return}ga.onKeyDown(V)},[va,gu,ga,Pe,$e]);j.useEffect(()=>{if(!va)return;const V=ce=>{const Ce=ai.current;Ce&&!Ce.contains(ce.target)&&(Un(void 0),Xt(void 0))};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[va]);const om=j.useMemo(()=>({getNodeRect:Pn,nodeRects:Oi,zoom:vt.zoom,pan:{x:vt.x,y:vt.y},selectedNodeId:Be,zoomToFit:uh,setZoom:Al,zoomBy:dh,setPan:wr,setViewport:kl,getViewport:vr,locked:ht,setLocked:jn,isFullscreen:pa,toggleFullscreen:ih,layout:x,liveSimulation:In,setLiveSimulation:Ts,hoveredNodeId:Rt,hoveredEdgeId:Nn}),[Pn,Oi,vt,Be,uh,Al,dh,wr,kl,vr,ht,pa,ih,x,In,Rt,Nn]),lm=V=>{typeof Q=="function"?Q(V):Q&&(Q.current=V),ai.current=V},Vn=18*vt.zoom,Eo=(vt.x%Vn+Vn)%Vn,fh=(vt.y%Vn+Vn)%Vn;return f.jsxs("div",ee($({ref:lm,"aria-label":"Graph canvas",className:["graph-canvas",J].filter(Boolean).join(" "),"data-layout-state":br,onPointerDown:Co,onPointerUp:Cl,onKeyDown:rm,tabIndex:ga.tabIndex,role:ga.role},K),{children:[f.jsx("div",{className:"graph-measure","aria-hidden":"true",children:Tt.map(V=>f.jsx("div",{ref:ce=>{Ai.current[V.id]=ce},style:{display:"inline-block"},children:Bl(V,!1)},V.id))}),f.jsx(jM.Provider,{value:om,children:f.jsxs(EM.Provider,{value:nm,children:[f.jsxs("svg",{className:"graph-svg",width:"100%",height:"100%",style:{position:"absolute",inset:0,overflow:"visible"},children:[f.jsx("defs",{children:f.jsx("pattern",{id:iu,x:Eo,y:fh,width:Vn,height:Vn,patternUnits:"userSpaceOnUse",children:f.jsx("circle",{cx:"0",cy:"0",r:Math.min(1,.5*vt.zoom),className:"graph-grid-dot"})})}),f.jsx("rect",{width:"100%",height:"100%",fill:`url(#${iu})`,className:"graph-grid"}),f.jsxs("g",{className:"graph-viewport","data-testid":"graph-viewport",transform:Ia,children:[ft&&As.size>0&&f.jsx("g",{className:"graph-clusters","aria-hidden":"true",children:[...As.entries()].map(([V,ce])=>f.jsx("circle",{className:"graph-cluster-boundary",cx:ce.x,cy:ce.y,r:ce.r},V))}),S&&La.length>0&&f.jsx("g",{className:"graph-hierarchy-rings","aria-hidden":"true",children:La.map((V,ce)=>f.jsx("circle",{className:"graph-hierarchy-ring",cx:V.cx,cy:V.cy,r:V.r},`${V.trunkId}-depth-${V.depth}-${ce}`))}),ya&&f.jsx("g",{className:"graph-lanes","aria-hidden":"true",children:ya.bands.map(V=>f.jsxs("g",{className:"graph-lane","data-layer-id":V.layerId,children:[f.jsx("rect",{className:"graph-lane__band",x:V.x,y:V.y,width:V.width,height:V.height,rx:8,style:{fill:V.color,stroke:V.color}}),f.jsx("rect",{className:"graph-lane__bar",x:V.x,y:V.y,width:3,height:V.height,style:{fill:V.color}}),f.jsxs("text",{className:"graph-lane__title",x:V.titleX,y:V.titleY,style:{fill:V.color},children:[V.label.toUpperCase(),f.jsx("tspan",{dx:9,children:V.count})]})]},V.layerId))}),ea&&f.jsx("g",{className:"graph-edges graph-lane-links",children:ea.items.map(({link:V,em:ce,curve:Ce})=>{var Yn;const Te=Sr==null?void 0:Sr.get(V.id);if(!Te)return null;const et=V.id===B,Ue=V.id===Nn,Ke=!!m||u==="click"&&!!c,tt=!!z||Ke,st=(sa==null?void 0:sa.type)==="edge"&&sa.edgeId===V.id?sa.tooltipId:void 0,wt=Cn===V.id,Dt=et?"rgb(var(--accent-primary))":ce.color,_n=Bt=>{Ke&&zl(Te,Bt),z==null||z(V.id)};return f.jsxs("g",ee($($($({className:["graph-edge","graph-lane-link",et&&"selected"].filter(Boolean).join(" "),"data-testid":`graph-edge-${V.id}`,"data-link-id":V.id,"data-hop":ce.hop||void 0,role:tt?"button":"presentation","aria-hidden":tt?void 0:!0,"aria-pressed":tt?et:void 0,"aria-haspopup":Ke?"dialog":void 0},Ke&&{"aria-expanded":wt}),Ke&&wt&&{"aria-controls":`popover-edge-${V.id}`}),tt&&st&&{"aria-describedby":st}),{"aria-label":tt?mp(Te.label,yi(V.sourceId),yi(V.targetId)):void 0,tabIndex:tt?0:void 0,onClick:tt?Bt=>{Bt.stopPropagation(),_n(Bt.currentTarget)}:void 0,onKeyDown:tt?Bt=>{(Bt.key==="Enter"||Bt.key===" ")&&(Bt.preventDefault(),_n(Bt.currentTarget))}:void 0,onPointerEnter:()=>du(V.id),onPointerLeave:()=>hu(V.id),children:[v?FM(v,Te,{path:Ce.d,mid:Ce.pointAt(.5),labelPos:(Yn=ea.pillById.get(V.id))!=null?Yn:Ce.pointAt(.5),angle:Math.atan2(Ce.tangentAt(.5).y,Ce.tangentAt(.5).x)*180/Math.PI,selected:et,hovered:Ue}):f.jsxs(f.Fragment,{children:[f.jsx("path",{className:"graph-lane-link__line",d:Ce.d,style:{stroke:Dt,strokeWidth:ce.width+(et||Ue?.6:0),strokeOpacity:et||Ue?1:ce.opacity,strokeDasharray:ce.dash||void 0}}),(ce.arrow||et)&&f.jsx("polygon",{className:"graph-lane-link__arrow",points:M0(Ce.tip,Ce.dir.x,Ce.dir.y),style:{fill:Dt,fillOpacity:ce.highlighted||et?1:.8}})]}),(tt||!!c||!!U)&&f.jsx("path",{className:"graph-edge__hit",d:Ce.d})]}),V.id)})}),!Ae&&f.jsx("g",{className:"graph-edges",children:xe==null?void 0:xe.map(V=>{var wt,Dt;const ce=Si(M,V,x),Ce=x==="ux-navigation"?Jy(L,V):!1,Te=V.sourceId===Rt||V.targetId===Rt||V.id===Nn||V.sourceId===Be||V.targetId===Be||V.id===B,et=Sl.has(V.id);if(!ce&&!E&&!Te&&!et||lu.has(V.sourceId)||lu.has(V.targetId))return null;const Ue=Cn===V.id,Ke=(sa==null?void 0:sa.type)==="edge"&&sa.edgeId===V.id?sa.tooltipId:void 0,tt=(wt=V.curvature)!=null?wt:ce?C:void 0,st=(x==="galaxy"&&ce||x==="ux-navigation"&&(ce||Ce))&&!Te?void 0:V.label;return f.jsx(C$,{id:V.id,sourceId:V.sourceId,targetId:V.targetId,sourceLabel:yi(V.sourceId),targetLabel:yi(V.targetId),label:st,variant:V.variant,weight:V.weight,opacity:V.opacity,strokeDash:V.strokeDash,sourceAnchor:V.sourceAnchor,targetAnchor:V.targetAnchor,curvature:tt,selected:V.id===B,hovered:V.id===Nn,onSelect:z,onHoverStart:du,onHoverEnd:hu,renderEdge:v,hasPopover:!!m||u==="click"&&!!c,onPopoverOpen:(_n,Yn)=>zl(V,Yn),popoverOpen:Ue,popoverPanelId:Ue?`popover-edge-${V.id}`:void 0,tooltipId:Ke,isNavigationRoute:Ce,preRoutedEdge:(Dt=Dl.get(V.id))!=null?Dt:im.get(V.id)},V.id)})}),f.jsx("g",{className:"graph-nodes",children:Tt.map(V=>{var st;const ce=Pa(V),Ce=(st=it.get(V.id))!=null?st:{width:ls,height:cs},Te=V.id===Be,et=(sa==null?void 0:sa.type)==="node"&&sa.nodeId===V.id?sa.tooltipId:void 0,Ue=jo(V.id),Ke=be==null?void 0:be.index.nodeById.get(V.id),tt=Ke?be.nodeEmphasis(Ke).opacity:1;return f.jsx("g",{transform:`translate(${ce.x} ${ce.y})`,opacity:tt<1?tt:void 0,visibility:lu.has(V.id)?"hidden":void 0,"data-node-id":V.id,"data-testid":`graph-node-${V.id}`,"data-domain":V.domainColor,className:["graph-canvas-node",ne&&"draggable",Te&&"selected"].filter(Boolean).join(" "),tabIndex:g&&Ue.hasChildren&&Ue.onToggleCollapse?0:-1,role:g&&Ue.hasChildren&&Ue.onToggleCollapse?"group":void 0,"aria-expanded":g&&Ue.hasChildren&&Ue.onToggleCollapse?!Ue.collapsed:void 0,"aria-label":g&&Ue.hasChildren&&Ue.onToggleCollapse?V.label:void 0,onPointerEnter:()=>fu(V.id),onPointerLeave:()=>pu(V.id),onFocus:g?()=>{Ue.hasChildren&&Ue.onToggleCollapse&&fu(V.id)}:void 0,onBlur:g?wt=>{Ue.hasChildren&&Ue.onToggleCollapse&&(wt.currentTarget.contains(wt.relatedTarget)||pu(V.id))}:void 0,onKeyDown:g?wt=>{if(wt.key==="Enter"&&wt.shiftKey&&Ue.hasChildren&&Ue.onToggleCollapse){wt.preventDefault(),wt.stopPropagation();try{Ue.onToggleCollapse()}catch(Dt){console.error("onToggleCollapse failed:",Dt)}}}:void 0,onPointerDown:ne?wt=>am(wt,V):void 0,onPointerMove:ne?sm:void 0,onPointerUp:ne?hh:void 0,onPointerCancel:ne?hh:void 0,children:f.jsx("foreignObject",{x:-Ce.width/2,y:-Ce.height/2,width:Ce.width,height:Ce.height,overflow:"visible",children:Bl(V,Te,et)})},V.id)})}),ea&&ea.pills.length>0&&f.jsx("g",{className:"graph-lane-pills","aria-hidden":"true",children:ea.pills.map(V=>{const ce=ea.byId.get(V.id);return f.jsxs("g",{className:"graph-lane-pill","data-link-id":V.id,transform:`translate(${Math.round((V.x-V.width/2)*10)/10} ${Math.round((V.y-V.height/2)*10)/10})`,opacity:ce.em.highlighted?1:.9,children:[f.jsx("rect",{className:"graph-lane-pill__bg",width:V.width,height:V.height,rx:3,style:{stroke:ce.em.color}}),f.jsx("text",{className:"graph-lane-pill__text",x:V.width/2,y:V.height/2,style:{fill:ce.em.color},children:V.text})]},V.id)})}),Rt&&f.jsx("g",{className:"graph-collapse-controls",children:(()=>{var V;const ce=Pn(Rt);if(!ce)return null;const Ce=jo(Rt);return!Ce.hasChildren||!Ce.onToggleCollapse?null:f.jsx(TM,{nodeId:Rt,label:((V=Tt.find(Te=>Te.id===Rt))==null?void 0:V.label)||Rt,collapsed:Ce.collapsed,hiddenDescendantCount:Ce.hiddenDescendantCount,onToggleCollapse:Ce.onToggleCollapse,x:ce.x,y:ce.y,nodeWidth:ce.width},Rt)})()})]})]}),he&&f.jsx(LM,{position:pe}),X&&f.jsx("div",{className:["graph-layout-indicator",he&&pe.startsWith("top-")&&"graph-layout-indicator--bottom"].filter(Boolean).join(" "),role:"status","aria-live":"polite",children:br!=="idle"&&f.jsxs("span",{className:"graph-layout-indicator__chip","data-testid":"graph-layout-indicator",style:{animationDelay:`${x$}ms`},children:[f.jsx(Fx,{color:"cyan",pulse:!0,"aria-hidden":"true"}),"Laying out…"]})}),sa&&f.jsx("div",{className:"graph-tooltip-layer",children:f.jsx("div",{className:"graph-tooltip-anchor",style:{left:sa.worldX*vt.zoom+vt.x,top:sa.worldY*vt.zoom+vt.y},children:f.jsx(Ck,{open:!0,content:sa.content,placement:"top",id:sa.tooltipId,children:f.jsx("span",{})})})}),va&&f.jsx("div",{className:"graph-popover-layer",children:f.jsx("div",{className:"graph-popover-anchor",style:{left:va.worldX*vt.zoom+vt.x,top:va.worldY*vt.zoom+vt.y},children:f.jsxs(gy,{open:!0,onOpenChange:V=>{V||gu()},autoFocus:!0,placement:"top",disableOutsideClick:!0,panelId:va.type==="node"?`popover-node-${va.nodeId}`:`popover-edge-${va.edgeId}`,children:[f.jsx(gy.Trigger,{children:f.jsx("div",{style:{width:0,height:0}})}),f.jsx(gy.Panel,{"aria-label":va.ariaLabel,children:va.content})]},va.type==="node"?va.nodeId:va.edgeId)})})]})})]}))});qp.displayName="GraphCanvas";const A$=Se.forwardRef((M,S)=>{var C=M,{id:e,sourceId:t,targetId:n,sourceLabel:a,targetLabel:i,label:r,variant:l="default",weight:c,opacity:u,strokeDash:h,sourceAnchor:m,targetAnchor:p,curvature:g,selected:v=!1,onSelect:x,className:b=""}=C,_=Ie(C,["id","sourceId","targetId","sourceLabel","targetLabel","label","variant","weight","opacity","strokeDash","sourceAnchor","targetAnchor","curvature","selected","onSelect","className"]);const{getNodeRect:k,nodeRects:L}=N0(),E=j.useMemo(()=>{const A=k(t),R=k(n);if(!A)return console.warn(`GraphEdge: source node "${t}" not found`),null;if(!R)return console.warn(`GraphEdge: target node "${n}" not found`),null;const D=gp(A,R,{sourceAnchor:m,targetAnchor:p,curvature:g}),O=r?Hv(D.points,Kc(r),L,6):D.mid;return ee($({},D),{labelPos:O})},[k,t,n,m,p,g,r,L]);if(!E)return null;const I=["graph-edge",l!=="default"&&`graph-edge--${l}`,v&&"selected",b].filter(Boolean).join(" "),T=!!x;return f.jsx("g",ee($({ref:S,className:I,role:T?"button":"presentation","aria-hidden":T?void 0:!0,"aria-pressed":T?v:void 0,"aria-label":T?mp(r,a||t,i||n):void 0,tabIndex:T?0:void 0,onKeyDown:T?A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),x(e))}:void 0,"data-testid":`graph-edge-${e}`},_),{children:f.jsx(k0,{id:e,d:E.d,mid:E.labelPos,label:r,variant:l,weight:c,opacity:u,strokeDash:h,onSelect:x,detailedTestIds:!0})}))});A$.displayName="GraphEdge";const CS=[],MS=[],jS={layerBy:""},I$=60,ES=40,D$=.6,PM=Se.forwardRef((x,v)=>{var b=x,{graph:e,nodes:t,edges:n,layering:a,graphOptions:i,order:r,cellSize:l="auto",labelWidth:c=210,showBlockCounts:u=!0,showCodeLegend:h=!0,onLinkSelect:m,className:p=""}=b,g=Ie(b,["graph","nodes","edges","layering","graphOptions","order","cellSize","labelWidth","showBlockCounts","showCodeLegend","onLinkSelect","className"]);const _=j.useContext(vl),S=e!=null?e:_,M=th(S?{nodes:CS,edges:MS,layering:jS,layout:!1}:ee($({},i),{nodes:t!=null?t:CS,edges:n!=null?n:MS,layering:a!=null?a:jS})),C=S!=null?S:M,{index:k,filters:L,reach:E,layout:I,selectedId:T,linkEmphasis:A}=C,[R,D]=j.useState(null),O=r!=null?r:I?"coupled-x":"degree",B=j.useMemo(()=>l$(k,I,O).filter(Z=>!L.hiddenLayers.includes(k.nodeById.get(Z).layerId)),[k,I,O,L.hiddenLayers]),z=j.useMemo(()=>new Map(B.map((Z,J)=>[Z,J])),[B]),U=B.length,F=l==="auto"?Math.max(10,Math.min(18,Math.floor(820/Math.max(1,U)))):l,Y=Math.min(11,Math.round(F*.66*10)/10),X=B.reduce((Z,J)=>Math.max(Z,k.nodeById.get(J).displayLabel.length),0)*Y*D$,ne=c,q=Math.max(I$,Math.ceil(X*.87)+24),he=ne+U*F+Math.max(ES,Math.ceil(X*.5)+16),pe=q+U*F+ES,H=j.useMemo(()=>{const Z=[];return B.forEach((J,K)=>{const Q=k.nodeById.get(J).layerId,ae=Z[Z.length-1];ae&&ae.layerId===Q?ae.end=K+1:Z.push({layerId:Q,start:K,end:K+1})}),Z},[B,k]),te=j.useMemo(()=>{var J;const Z=new Map;for(const K of k.links){if(!A(K).visible)continue;const Q=k.nodeById.get(K.sourceId).layerId+"\0"+k.nodeById.get(K.targetId).layerId;Z.set(Q,((J=Z.get(Q))!=null?J:0)+1)}return Z},[k,A]),ie=j.useMemo(()=>{const Z=!!E.originId;return k.links.flatMap(J=>{var de;const K=z.get(J.sourceId),Q=z.get(J.targetId);if(K===void 0||Q===void 0)return[];const ae=A(J);if(!ae.visible)return[];const ye=ae.highlighted?1:Z?.25:J.cross?.95:.7,Ae=ae.label&&J.predicates.length>0?((de=k.predicateCodes.get(J.predicates[0]))!=null?de:"")+(J.predicates.length>1?"+":""):"";return[{link:J,r:K,c:Q,em:ae,opacity:ye,code:Ae}]})},[k,z,A,E.originId]),W=j.useMemo(()=>{var J;const Z=new Map;for(const K of ie)if(K.code)for(const Q of K.link.predicates)Z.has(Q)||Z.set(Q,(J=k.predicateCodes.get(Q))!=null?J:"");return[...Z].sort((K,Q)=>K[0].localeCompare(Q[0]))},[ie,k]),ge=Z=>{const J=C.nodeEmphasis(Z);return J.selected?"adjacency-matrix__label--selected":J.hop!==null?J.followed?"adjacency-matrix__label--followed":"adjacency-matrix__label--reached":E.originId?"adjacency-matrix__label--dim":""},we=(Z,J)=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),C.select(T===J?null:J))},je=T!=null?z.get(T):void 0,De=R?z.get(R.row):void 0,re=R?z.get(R.col):void 0;return f.jsxs("div",ee($({ref:v,className:["adjacency-matrix",p].filter(Boolean).join(" ")},g),{children:[f.jsx("div",{className:"adjacency-matrix__scroll",children:f.jsxs("svg",{className:"adjacency-matrix__svg",width:he,height:pe,viewBox:`0 0 ${he} ${pe}`,role:"group","aria-label":`Adjacency matrix, ${U} by ${U}: rows are link sources, columns link targets`,onMouseLeave:()=>D(null),children:[H.map(Z=>H.map(J=>{var ye;const K=Z.layerId===J.layerId,Q=k.layerById.get(Z.layerId),ae=(ye=te.get(Z.layerId+"\0"+J.layerId))!=null?ye:0;return f.jsxs("g",{children:[f.jsx("rect",{className:"adjacency-matrix__block",x:ne+J.start*F,y:q+Z.start*F,width:(J.end-J.start)*F,height:(Z.end-Z.start)*F,style:{fill:K?Q.color:"rgb(var(--accent-primary))",fillOpacity:K?.08:.03}}),u&&!K&&f.jsx("text",{className:"adjacency-matrix__block-count",x:ne+J.end*F-4,y:q+Z.end*F-5,textAnchor:"end",children:ae})]},Z.layerId+"|"+J.layerId)})),je!==void 0&&f.jsxs("g",{className:"adjacency-matrix__band adjacency-matrix__band--selected",children:[f.jsx("rect",{x:ne,y:q+je*F,width:U*F,height:F}),f.jsx("rect",{x:ne+je*F,y:q,width:F,height:U*F})]}),De!==void 0&&re!==void 0&&f.jsxs("g",{className:"adjacency-matrix__band adjacency-matrix__band--hover",children:[f.jsx("rect",{x:ne,y:q+De*F,width:U*F,height:F}),f.jsx("rect",{x:ne+re*F,y:q,width:F,height:U*F})]}),B.map((Z,J)=>{const K=k.nodeById.get(Z),Q=k.layerById.get(K.layerId),ae=["adjacency-matrix__label",ge(K)].filter(Boolean).join(" "),ye=()=>C.select(T===Z?null:Z);return f.jsxs("g",{children:[f.jsx("rect",{x:ne-6,y:q+J*F+1,width:3,height:F-2,style:{fill:Q.color}}),f.jsx("rect",{x:ne+J*F+1,y:q-6,width:F-2,height:3,style:{fill:Q.color}}),f.jsxs("g",{className:"adjacency-matrix__header",role:"button",tabIndex:0,"aria-label":`${K.label}, ${Q.label} layer${T===Z?", selected":""}`,onClick:ye,onKeyDown:Ae=>we(Ae,Z),children:[f.jsx("title",{children:K.label}),f.jsx("rect",{className:"adjacency-matrix__header-box",x:2,y:q+J*F,width:ne-10,height:F,rx:4}),f.jsx("text",{className:ae,x:ne-10,y:q+J*F+F/2,textAnchor:"end",dominantBaseline:"central",style:{fontSize:Y},children:K.displayLabel})]}),f.jsx("g",{className:"adjacency-matrix__header","aria-hidden":"true",onClick:ye,children:f.jsx("text",{className:ae,transform:`translate(${ne+J*F+F*.65} ${q-10}) rotate(-60)`,dominantBaseline:"central",style:{fontSize:Y},children:K.displayLabel})})]},Z)}),ie.map(({link:Z,r:J,c:K,em:Q,opacity:ae,code:ye})=>{const Ae=k.nodeById.get(Z.sourceId),de=k.nodeById.get(Z.targetId),Je=Z.predicates.length?xl(Z,k.catalog):Z.primaryCategory;return f.jsxs("g",{className:"adjacency-matrix__cell","data-link-id":Z.id,onClick:()=>m?m(Z):C.select(Z.sourceId),onMouseEnter:()=>D({row:Z.sourceId,col:Z.targetId}),children:[f.jsx("title",{children:`${Ae.label} ${Je} ${de.label}`}),f.jsx("rect",{x:ne+K*F+1,y:q+J*F+1,width:F-2,height:F-2,rx:2,style:{fill:Q.color,fillOpacity:ae,stroke:Q.highlighted?Q.color:"none",strokeWidth:1.5}}),ye&&f.jsx("text",{className:"adjacency-matrix__code",x:ne+K*F+F/2,y:q+J*F+F/2,textAnchor:"middle",dominantBaseline:"central",style:{fontSize:Math.min(8.5,F*.48)},children:ye})]},Z.id)}),f.jsx("text",{className:"adjacency-matrix__caption",x:ne,y:q+U*F+20,children:`row = source · column = target · ${U} × ${U}`})]})}),h&&W.length>0&&f.jsxs("div",{className:"adjacency-matrix__legend",children:[f.jsx("span",{className:"adjacency-matrix__legend-title",children:"Cell codes"}),W.map(([Z,J])=>{var Q;var K;return f.jsxs("span",{className:"adjacency-matrix__legend-item",children:[f.jsx("b",{children:J})," ",(Q=(K=k.catalog[Z])==null?void 0:K.label)!=null?Q:Z]},Z)})]})]}))});PM.displayName="AdjacencyMatrix";const bl=Math.PI/180;function za(e,t){return{x:t*Math.cos(e*bl),y:t*Math.sin(e*bl)}}function O$(e,t=-90){return Array.from({length:Math.max(0,e)},(n,a)=>t+360*a/e)}function z$(e,t){const n=t>1?180/t-6:45;return Math.max(0,Math.min(e,n))}function RS(e,t){let n=(t-e)%360;return n>180&&(n-=360),n<=-180&&(n+=360),n}function B$(e,t){if(t.length===1)return 0;let n=0,a=-1/0;return t.forEach((i,r)=>{const l=(e+i+(i>=0?90:-90))*bl,c=.5*Math.cos(l)-Math.sin(l);c>a+1e-9&&(a=c,n=r)}),n}function $$(e,t=e.labelCopy){var i;const n=(i=e.offsets[t])!=null?i:0;if(n===0)return Math.cos(e.angle*bl)>=-.1?1:-1;const a=e.angle+n+(n>0?90:-90);return Math.cos(a*bl)>=-1e-9?1:-1}function U$(e,t,n={}){var h,m,p,g,v;const a=(h=n.innerRadius)!=null?h:64,i=(m=n.axisLength)!=null?m:300,r=n.splitAxes===!1?0:z$((p=n.splitAngle)!=null?p:13,e.length),l=O$(e.length,(g=n.startAngle)!=null?g:-90),c=e.map((x,b)=>{const _=r>0?[-r,r]:[0];return{layerId:x.id,position:b,angle:l[b],offsets:_,labelCopy:B$(l[b],_)}}),u=new Map;for(const x of e)for(const b of x.nodeIds)u.set(b,a+i*((v=t.get(b))!=null?v:.5));return{axes:c,axisOf:new Map(c.map(x=>[x.layerId,x])),radiusOf:u,split:r,innerRadius:a,axisLength:i}}function F$(e,t,n){const a=e.axisOf.get(t.layerId),i=e.axisOf.get(n.layerId);if(!a||!i)return null;const r=e.split,l=t.radius,c=n.radius,u=(C,k)=>Math.max(0,C.offsets.indexOf(k));if(a===i){if(r>0){const R=za(a.angle+r,l),D=za(a.angle-r,c),O=za(a.angle,(l+c)/2*1.02);return{a:R,b:D,c:O,sourceCopy:u(a,r),targetCopy:u(a,-r)}}const C=za(a.angle,l),k=za(a.angle,c),L=za(a.angle,(l+c)/2),E=c>=l?1:-1,I=Math.abs(c-l)*.6+10,T=-Math.sin(a.angle*bl),A=Math.cos(a.angle*bl);return{a:C,b:k,c:{x:L.x+T*I*E,y:L.y+A*I*E},sourceCopy:0,targetCopy:0}}const h=RS(a.angle,i.angle),m=h>0||Math.abs(Math.abs(h)-180)<1e-9?1:-1,p=r*m,g=-p,v=a.angle+p,x=i.angle+g,b=za(v,l),_=za(x,c),S=v+RS(v,x)/2,M=za(S,(l+c)/2*.42);return{a:b,b:_,c:M,sourceCopy:u(a,p),targetCopy:u(i,g)}}const LS=[],TS=[],AS={layerBy:""},IS=10.5,DS=11,P$=.6,Of=14,H$=12,rn=e=>Math.round(e*10)/10,Wy=e=>2.6+Math.sqrt(e.degree)*.9,HM=Se.forwardRef((S,_)=>{var M=S,{graph:e,nodes:t,edges:n,layering:a,graphOptions:i,rank:r="degree",splitAxes:l=!0,splitAngle:c=13,axisLabels:u=1,innerRadius:h=64,axisLength:m=300,startAngle:p=-90,interactions:g,onLinkSelect:v,className:x=""}=M,b=Ie(M,["graph","nodes","edges","layering","graphOptions","rank","splitAxes","splitAngle","axisLabels","innerRadius","axisLength","startAngle","interactions","onLinkSelect","className"]);var C;const k=j.useContext(vl),L=e!=null?e:k,E=th(L?{nodes:LS,edges:TS,layering:AS,layout:!1}:ee($({layout:!1},i),{nodes:t!=null?t:LS,edges:n!=null?n:TS,layering:a!=null?a:AS})),I=L!=null?L:E,{index:T,filters:A,reach:R,selectedId:D,linkEmphasis:O,nodeEmphasis:B}=I,z=(g==null?void 0:g.select)!==!1,U=(g==null?void 0:g.hover)!==!1,[F,Y]=j.useState(null),[X,ne]=j.useState(null),q=j.useRef(new Map),he=j.useRef(null),[pe,H]=j.useState(0);j.useEffect(()=>{const me=he.current;if(!me||typeof ResizeObserver>"u")return;const Ee=new ResizeObserver(se=>{var xe;var le;return H((xe=(le=se[0])==null?void 0:le.contentRect.width)!=null?xe:0)});return Ee.observe(me),()=>Ee.disconnect()},[]);const te=j.useMemo(()=>T.layers.filter(me=>!A.hiddenLayers.includes(me.id)),[T,A.hiddenLayers]),ie=j.useMemo(()=>c$(T,r),[T,r]),W=j.useMemo(()=>U$(te,ie,{innerRadius:h,axisLength:m,splitAxes:l,splitAngle:c,startAngle:p}),[te,ie,h,m,l,c,p]),ge=j.useMemo(()=>W.axes.map(me=>[...T.layerById.get(me.layerId).nodeIds].sort((Ee,se)=>W.radiusOf.get(Ee)-W.radiusOf.get(se)||Ee.localeCompare(se))),[W,T]),we=j.useMemo(()=>{const me=[];for(const Ee of W.axes)for(const se of T.layerById.get(Ee.layerId).nodeIds){const le=T.nodeById.get(se),xe=W.radiusOf.get(se);Ee.offsets.forEach((Pe,$e)=>{const Be=za(Ee.angle+Pe,xe);me.push({node:le,x:Be.x,y:Be.y,r:Wy(le),copy:$e})})}return me},[W,T]),je=me=>{const Ee=W.axisOf.get(me.layerId),se=za(Ee.angle+Ee.offsets[Ee.labelCopy],W.radiusOf.get(me.id)),le=$$(Ee),xe=me.displayLabel.length*IS*P$,Pe=se.x+le*(Wy(me)+5);return{x:Pe+le*xe/2,y:se.y,width:xe,height:IS*1.2,side:le,tx:Pe,ty:se.y}},De=j.useMemo(()=>{let me=1/0,Ee=1/0,se=-1/0,le=-1/0;const xe=(Pe,$e,Be=0,at=0)=>{me=Math.min(me,Pe-Be),se=Math.max(se,Pe+Be),Ee=Math.min(Ee,$e-at),le=Math.max(le,$e+at)};xe(0,0,h,h);for(const Pe of W.axes){for(const at of Pe.offsets){const ot=za(Pe.angle+at,h+m+8);xe(ot.x,ot.y)}const $e=za(Pe.angle,h+m+30),Be=T.layerById.get(Pe.layerId).label;xe($e.x,$e.y,Be.length*DS*.7/2,DS)}for(const Pe of te.flatMap($e=>$e.nodeIds)){const $e=je(T.nodeById.get(Pe));xe($e.x,$e.y,$e.width/2,$e.height/2)}return Number.isFinite(me)?{x:Math.floor(me-Of),y:Math.floor(Ee-Of),w:Math.ceil(se-me+2*Of),h:Math.ceil(le-Ee+2*Of)}:{x:-200,y:-200,w:400,h:400}},[W,T,te,h,m]),re=pe>0?De.w/pe:1,Z=Math.min(20,H$*Math.max(1,re)),J=j.useMemo(()=>{const me=[];for(const Ee of T.links){const se=O(Ee);if(!se.visible)continue;const le=T.nodeById.get(Ee.sourceId),xe=T.nodeById.get(Ee.targetId),Pe=F$(W,{layerId:le.layerId,radius:W.radiusOf.get(le.id)},{layerId:xe.layerId,radius:W.radiusOf.get(xe.id)});if(!Pe)continue;const $e=tx(Pe.a,Pe.c,Pe.b);let Be=null;if(se.arrow){const at=$e.tangentAt(1),ot=Wy(xe)+2;Be=M0({x:Pe.b.x-at.x*ot,y:Pe.b.y-at.y*ot},at.x,at.y)}me.push({link:Ee,em:se,curve:$e,arrow:Be})}return me.sort((Ee,se)=>Ee.em.z-se.em.z)},[T,W,O]),K=j.useMemo(()=>{const me=new Set;if(R.originId)for(const Ee of R.hopOf.keys())me.add(Ee);else if(u>0)for(const Ee of te)Ee.nodeIds.map(se=>T.nodeById.get(se)).sort((se,le)=>le.degree-se.degree||se.label.localeCompare(le.label)).slice(0,u).forEach(se=>me.add(se.id));return me},[R,u,te,T]),Q=j.useMemo(()=>{const me=[...K].filter(le=>W.radiusOf.has(le));F&&W.radiusOf.has(F)&&!K.has(F)&&me.push(F);const Ee=le=>{var xe;return le===D||le===F?-1:(xe=R.hopOf.get(le))!=null?xe:99};me.sort((le,xe)=>Ee(le)-Ee(xe)||T.nodeById.get(xe).degree-T.nodeById.get(le).degree||le.localeCompare(xe));const se=[];return me.filter(le=>{const xe=je(T.nodeById.get(le));return!se.every(Pe=>Math.abs(Pe.x-xe.x)>(Pe.width+xe.width)/2+2||Math.abs(Pe.y-xe.y)>(Pe.height+xe.height)/2)&&Ee(le)>=0?!1:(se.push(xe),!0)})},[K,F,W,D,R,T]),ae=j.useMemo(()=>{const me=Q.map(le=>{const xe=je(T.nodeById.get(le));return{x:xe.x,y:xe.y,width:xe.width,height:xe.height}}),Ee=J.filter(le=>le.em.label&&le.link.predicates.length>0).map(le=>({id:le.link.id,text:xl(le.link,T.catalog),pointAt:le.curve.pointAt,priority:R0(le.link,le.em)})),se=new Map(J.map(le=>[le.link.id,le]));return E0(Ee,{obstacles:me}).map(le=>ee($({},le),{em:se.get(le.id).em}))},[J,Q,T,W]),ye=me=>{z&&I.select(D===me?null:me)},Ae=me=>{U&&(Y(me),I.hover(me))},de=me=>{var Ee;me&&(ne(me),(Ee=q.current.get(me))==null||Ee.focus())},Je=(me,Ee)=>{var Pe;const se=W.axes.findIndex($e=>$e.layerId===Ee.layerId),le=(Pe=ge[se])!=null?Pe:[],xe=le.indexOf(Ee.id);switch(me.key){case"Enter":case" ":me.preventDefault(),ye(Ee.id);return;case"ArrowUp":me.preventDefault(),de(le[Math.min(le.length-1,xe+1)]);return;case"ArrowDown":me.preventDefault(),de(le[Math.max(0,xe-1)]);return;case"Home":me.preventDefault(),de(le[0]);return;case"End":me.preventDefault(),de(le[le.length-1]);return;case"ArrowRight":case"ArrowLeft":{if(me.preventDefault(),W.axes.length<2)return;const $e=ge[(se+(me.key==="ArrowRight"?1:-1)+W.axes.length)%W.axes.length],Be=W.radiusOf.get(Ee.id);let at,ot=1/0;for(const ft of $e){const it=Math.abs(W.radiusOf.get(ft)-Be);it<ot&&(ot=it,at=ft)}de(at);return}}},Ge=me=>{me.key==="Escape"&&z&&D&&(me.preventDefault(),I.select(null))},be=X&&W.radiusOf.has(X)&&X||D&&W.radiusOf.has(D)&&D||((C=ge[0])==null?void 0:C[0])||null,Fe=h+m;return f.jsx("div",ee($({ref:_,className:["hive-plot",x].filter(Boolean).join(" ")},b),{children:f.jsxs("svg",{ref:he,className:"hive-plot__svg",viewBox:`${De.x} ${De.y} ${De.w} ${De.h}`,preserveAspectRatio:"xMidYMid meet",role:"group","aria-label":`Hive plot, ${W.axes.length} layer axes, ${te.reduce((me,Ee)=>me+Ee.nodeIds.length,0)} nodes; arrow keys move between nodes`,onKeyDown:Ge,onMouseLeave:()=>Ae(null),children:[W.axes.map(me=>{const Ee=T.layerById.get(me.layerId),se=za(me.angle,Fe+30);return f.jsxs("g",{className:"hive-plot__axis","data-layer-id":me.layerId,children:[me.offsets.map(le=>{const xe=za(me.angle+le,h*.8),Pe=za(me.angle+le,Fe+8);return f.jsx("line",{x1:rn(xe.x),y1:rn(xe.y),x2:rn(Pe.x),y2:rn(Pe.y),style:{stroke:Ee.color}},le)}),f.jsx("text",{className:"hive-plot__axis-title",x:rn(se.x),y:rn(se.y),textAnchor:"middle",dominantBaseline:"central",style:{fill:Ee.color},children:Ee.label.toUpperCase()})]},me.layerId)}),J.map(({link:me,em:Ee,curve:se})=>{const le=T.nodeById.get(me.sourceId),xe=T.nodeById.get(me.targetId),Pe=me.predicates.length?xl(me,T.catalog):me.primaryCategory,$e=!!v||z;return f.jsxs("g",ee($({className:["hive-plot__link",$e?"hive-plot__link--clickable":""].filter(Boolean).join(" "),"data-link-id":me.id,onClick:$e?()=>v?v(me):I.select(me.sourceId):void 0},v?{role:"button",tabIndex:0,"aria-label":`${le.label} ${Pe} ${xe.label}`,onKeyDown:Be=>{(Be.key==="Enter"||Be.key===" ")&&(Be.preventDefault(),v(me))}}:{}),{children:[f.jsx("title",{children:`${le.label} ${Pe} ${xe.label}`}),f.jsx("path",{className:"hive-plot__link-hit",d:se.d}),f.jsx("path",{className:"hive-plot__link-line",d:se.d,style:{stroke:Ee.color,strokeWidth:Ee.width,strokeOpacity:Ee.opacity,strokeDasharray:Ee.dash||void 0}})]}),me.id)}),J.map(({link:me,em:Ee,arrow:se})=>se?f.jsx("polygon",{className:"hive-plot__arrow",points:se,style:{fill:Ee.color,fillOpacity:Ee.highlighted?1:.8}},me.id):null),we.map(({node:me,x:Ee,y:se,r:le,copy:xe})=>{const Pe=B(me),$e=W.axisOf.get(me.layerId),Be=T.layerById.get(me.layerId),at=xe===$e.labelCopy,ot=Pe.selected?2:Pe.followed?1.2:0,ft=F===me.id,it=f.jsxs(f.Fragment,{children:[ft&&f.jsx("circle",{className:"hive-plot__hover",cx:rn(Ee),cy:rn(se),r:rn(le+6)}),ot>0&&f.jsx("circle",{className:"hive-plot__ring",cx:rn(Ee),cy:rn(se),r:rn(le+3),style:{stroke:Pe.selected?"rgb(var(--graph-hop-1))":"rgb(var(--graph-hop-2))",strokeWidth:ot}}),f.jsx("circle",{className:"hive-plot__dot",cx:rn(Ee),cy:rn(se),r:rn(le),style:{fill:Be.color}})]});return at?f.jsxs("g",{ref:kt=>{kt?q.current.set(me.id,kt):q.current.delete(me.id)},className:"hive-plot__node","data-node-id":me.id,opacity:Pe.opacity,role:"button",tabIndex:be===me.id?0:-1,"aria-pressed":Pe.selected,"aria-label":`${me.label}, ${Be.label} layer${Pe.selected?", selected":""}`,onClick:()=>ye(me.id),onFocus:()=>ne(me.id),onKeyDown:kt=>Je(kt,me),onMouseEnter:()=>Ae(me.id),onMouseLeave:()=>Ae(null),children:[f.jsx("title",{children:me.label}),f.jsx("circle",{className:"hive-plot__hit",cx:rn(Ee),cy:rn(se),r:rn(Z)}),f.jsx("circle",{className:"hive-plot__focus",cx:rn(Ee),cy:rn(se),r:rn(le+6)}),it]},me.id+":"+xe):f.jsxs("g",{className:"hive-plot__node hive-plot__node--twin",opacity:Pe.opacity,onClick:()=>ye(me.id),onMouseEnter:()=>Ae(me.id),onMouseLeave:()=>Ae(null),"aria-hidden":"true",children:[f.jsx("circle",{className:"hive-plot__hit",cx:rn(Ee),cy:rn(se),r:rn(Z)}),it]},me.id+":"+xe)}),Q.map(me=>{const Ee=T.nodeById.get(me),se=B(Ee),le=je(Ee),xe=se.selected?"hive-plot__label--selected":se.followed?"hive-plot__label--followed":"";return f.jsx("text",{className:["hive-plot__label",xe].filter(Boolean).join(" "),x:rn(le.tx),y:rn(le.ty),textAnchor:le.side===1?"start":"end",dominantBaseline:"central",opacity:Math.max(se.opacity,.35),children:Ee.displayLabel},me)}),ae.map(me=>f.jsxs("g",{className:"hive-plot__pill",opacity:me.em.highlighted?1:.9,children:[f.jsx("rect",{x:rn(me.x-me.width/2),y:rn(me.y-me.height/2),width:me.width,height:me.height,rx:3,style:{stroke:me.em.color}}),f.jsx("text",{x:rn(me.x),y:rn(me.y),textAnchor:"middle",dominantBaseline:"central",style:{fill:me.em.color},children:me.text})]},me.id))]})}))});HM.displayName="HivePlot";function q$(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function OS(e,t,n){const a=$({},e);for(const i in t){const r=t[i];if(r===void 0)continue;const l=e[i];a[i]=l+(r-l)*n}return a}const V$="(prefers-reduced-motion: reduce)";function Y$(){return Dp(V$)}function zf(e){const t=Y$(),n=j.useRef(t);n.current=t;const a=j.useRef(e);a.current=e;const i=j.useRef(null),r=j.useCallback(()=>{i.current!==null&&cancelAnimationFrame(i.current),i.current=null},[]),l=j.useCallback((u,h,m={})=>{var S,M;var p;r();const g=(S=m.duration)!=null?S:750,v=OS(u,h,1);if(n.current||g<=0){a.current(v,!0),(p=m.onDone)==null||p.call(m);return}const x=(M=m.easing)!=null?M:q$;let b=null;const _=C=>{var k;b===null&&(b=C);const L=Math.min(1,(C-b)/g),E=L>=1;a.current(E?v:OS(u,h,x(L)),E),E?(i.current=null,(k=m.onDone)==null||k.call(m)):i.current=requestAnimationFrame(_)};i.current=requestAnimationFrame(_)},[r]),c=j.useCallback(()=>i.current!==null,[]);return j.useEffect(()=>r,[r]),j.useMemo(()=>({start:l,cancel:r,isActive:c,reducedMotion:t}),[l,r,c,t])}const Cd=Object.freeze({stack:{yaw:-.62,pitch:.5,zoom:1,layerGap:170},exploded:{yaw:-.5,pitch:.34,zoom:.86,layerGap:300},top:{yaw:0,pitch:1.5,zoom:1.05,layerGap:170},profile:{yaw:0,pitch:.04,zoom:.95,layerGap:210}}),G$=["stack","exploded","top","profile"],zS=[.02,1.52],kp=[.4,3],K$=1600,Q$=1.2;function qM(e){const t=Cd[e];return{yaw:t.yaw,pitch:t.pitch,zoom:t.zoom,targetY:0}}const nx=(e,t,n)=>Math.max(t,Math.min(n,e));function vc(e){return{yaw:e.yaw,pitch:nx(e.pitch,zS[0],zS[1]),zoom:nx(e.zoom,kp[0],kp[1]),targetY:e.targetY}}function X$(e){const t=2*Math.PI;let n=(e%t+t)%t;return n>Math.PI&&(n-=t),n}function Z$(e,t){return e+X$(t-e)}function VM(e,t={}){var p,g,v;const n=(p=t.distance)!=null?p:K$,a=(g=t.offsetX)!=null?g:0,i=(v=t.offsetY)!=null?v:0,r=Math.cos(e.yaw),l=Math.sin(e.yaw),c=Math.cos(e.pitch),u=Math.sin(e.pitch),h=e.zoom,m=e.targetY;return x=>{const b=x.x*r-x.z*l,_=x.x*l+x.z*r,S=x.y-m,M=S*c+_*u,C=-S*u+_*c,k=n/Math.max(n*.05,n+C)*h;return{x:b*k+a,y:-M*k+i,scale:k,depth:C}}}function Bf(e,t){return e.map((n,a)=>({item:n,i:a,d:t(n)})).sort((n,a)=>a.d-n.d||n.i-a.i).map(n=>n.item)}function ev(e,t,n,a,i=150){let r=((t-1)/2-e)*n;return a&&a.amount>0&&e!==a.rank&&(r+=(e<a.rank?1:-1)*i*a.amount),r}function BS(e,t){return[{x:-t,y:e,z:-t},{x:t,y:e,z:-t},{x:t,y:e,z:t},{x:-t,y:e,z:t}]}function J$(e,t,n=[-.5,0,.5]){const a=[];for(const i of n){const r=i*t;a.push([{x:r,y:e,z:-t},{x:r,y:e,z:t}]),a.push([{x:-t,y:e,z:r},{x:t,y:e,z:r}])}return a}function W$(e,t,n,a,i=24){const r=[];for(let l=0;l<=i;l++){const c=l/i*Math.PI*2;r.push({x:e+Math.cos(c)*a,y:t,z:n+Math.sin(c)*a})}return r}function $f(e){return e.map(t=>`${Math.round(t.x*10)/10},${Math.round(t.y*10)/10}`).join(" ")}function eU(e){let t=e[0];for(const n of e)(n.x<t.x||n.x===t.x&&n.y>t.y)&&(t=n);return t}function tU(e,t,n,a={}){var p,g;if(e.length===0)return t.zoom;const i=(p=a.offsetX)!=null?p:0,r=(g=a.offsetY)!=null?g:0,l=VM(ee($({},t),{zoom:1}),a),c=n.margin,u=n.width/2-c,h=n.height/2-c;let m=1/0;for(const v of e){const x=l(v),b=x.x-i,_=x.y-r;b>1e-6&&(m=Math.min(m,(u-i)/b)),b<-1e-6&&(m=Math.min(m,(-u-i)/b)),_>1e-6&&(m=Math.min(m,(h-r)/_)),_<-1e-6&&(m=Math.min(m,(-h-r)/_))}return!Number.isFinite(m)||m<=0?t.zoom:nx(m,kp[0],kp[1])}function nU(e,t,n,a=44){const i=n-(e-1)*a/2;return Array.from({length:e},(r,l)=>({x:t,y:i+l*a}))}const $S=[],US=[],FS={layerBy:""},aU={select:!0,hover:!0,orbit:!0,zoom:!0,focusLayer:!0};function PS(e,t){return{offsetX:60,offsetY:-50*Math.sin(2*e)*(1-t)}}const sU=150,HS=.95,qS=1.12,Uf=750,iU=900,rU=180,oU=4,lU=.0075,cU=.006,VS=.98,qo=e=>Math.round(e*10)/10,hd=e=>Math.round(e*100)/100,YS=(e,t,n)=>Math.max(t,Math.min(n,e)),uU=e=>3.2+Math.sqrt(e.degree)*1.5;function Xr(e){return{yaw:e.yaw,pitch:e.pitch,zoom:e.zoom,targetY:e.targetY}}function dU(e,t){const n={};for(const a of t)n[a]=e[a];return n}function GS(e,t,n){const[a,i]=j.useState(t),r=e!==void 0,l=j.useRef(n);l.current=n;const c=j.useCallback(u=>{var h;r||i(u),(h=l.current)==null||h.call(l,u)},[r]);return[r?e:a,c]}function hU(e){const t=new Map;for(const n of e.values())n.forEach((a,i)=>{if(n.length===1)return t.set(a.id,{x:0,y:0});const r=i/n.length*Math.PI*2;t.set(a.id,{x:Math.cos(r)*.75,y:Math.sin(r)*.75})});return t}const YM=Se.forwardRef((O,D)=>{var B=O,{graph:e,nodes:t,edges:n,layering:a,graphOptions:i,cameraPreset:r,defaultCameraPreset:l="stack",onCameraPresetChange:c,camera:u,defaultCamera:h,onCameraChange:m,turntable:p,defaultTurntable:g=!1,onTurntableChange:v,turntableSpeed:x=.27,layerGap:b,defaultLayerGap:_,onLayerGapChange:S,nodeLabels:M="all",interactions:C,sceneWidth:k=1160,sceneHeight:L=780,planeSize:E=300,className:I="",style:T,"aria-label":A}=B,R=Ie(B,["graph","nodes","edges","layering","graphOptions","cameraPreset","defaultCameraPreset","onCameraPresetChange","camera","defaultCamera","onCameraChange","turntable","defaultTurntable","onTurntableChange","turntableSpeed","layerGap","defaultLayerGap","onLayerGapChange","nodeLabels","interactions","sceneWidth","sceneHeight","planeSize","className","style","aria-label"]);var si,Di,Ja,Os,ii;var z;const U=j.useContext(vl),F=e!=null?e:U,Y=th(F?{nodes:$S,edges:US,layering:FS,layout:!1}:ee($({},i),{nodes:t!=null?t:$S,edges:n!=null?n:US,layering:a!=null?a:FS})),X=F!=null?F:Y,{index:ne,layout:q,filters:he,selectedId:pe,hoveredId:H,focusedLayerId:te,planeLayout:ie}=X,W=$($({},aU),C),[ge,we]=GS(r,l,c),[je,De]=GS(p,g,v),re=j.useRef(null);if(re.current===null){const oe=vc($($($({},qM(r!=null?r:l)),h),u)),ze=te!=null&&ne.layerById.has(te);re.current=ee($($({},oe),ze?{pitch:HS,zoom:qS}:null),{gap:(si=b!=null?b:_)!=null?si:Cd[r!=null?r:l].layerGap,focusAmt:ze?1:0,mix:ie==="coupled"?1:0})}const Z=j.useRef(te!=null?te:null),[,J]=j.useState(0),K=j.useCallback(()=>J(oe=>(oe+1)%1e9),[]),Q=j.useRef(null),ae=j.useCallback(()=>{Q.current===null&&(Q.current=requestAnimationFrame(()=>{Q.current=null,K()}))},[K]);j.useEffect(()=>()=>{Q.current!==null&&cancelAnimationFrame(Q.current)},[]);const ye=j.useRef(m);ye.current=m;const Ae=j.useRef(S);Ae.current=S;const de=j.useCallback(oe=>{var ze;return(ze=ye.current)==null?void 0:ze.call(ye,Xr(re.current),oe)},[]),Je=j.useCallback(oe=>{Object.assign(re.current,oe)},[]),Ge=zf(oe=>{Je(oe),K()}),be=zf(oe=>{Je(oe),K()}),Fe=zf(oe=>{Je(oe),K()}),me=zf(oe=>{Je(oe),K()}),Ee=Ge.reducedMotion,se=j.useCallback((oe,ze={})=>{var xt;const Ye=re.current,Xe=$({},oe);if(Xe.yaw!==void 0&&(Xe.yaw=Z$(Ye.yaw,Xe.yaw)),Xe.pitch!==void 0||Xe.zoom!==void 0){const Ct=vc($($({},Xr(Ye)),Xe));Xe.pitch!==void 0&&(Xe.pitch=Ct.pitch),Xe.zoom!==void 0&&(Xe.zoom=Ct.zoom)}const dt=Object.keys(Xe);Ge.start(dU(Ye,dt),Xe,{duration:ze.animate===!1?0:(xt=ze.duration)!=null?xt:Uf,onDone:ze.onDone})},[Ge]),le=j.useRef(ge);le.current=ge;const xe=j.useRef(ge),Pe=j.useCallback(()=>{xe.current=null,le.current!==null&&we(null)},[we]),$e=j.useRef(null),Be=j.useRef(0),at=j.useRef(te);j.useEffect(()=>{if(at.current===te)return;at.current=te;const oe=$e.current!==null&&te==null;if($e.current=null,oe)return;const ze=re.current;if(te!=null&&ne.layerById.has(te))Z.current!==null&&ze.focusAmt>0&&Z.current!==te&&(ze.focusAmt=0),Z.current=te,Pe(),Fe.start({focusAmt:ze.focusAmt},{focusAmt:1},{duration:Uf}),se({pitch:HS,zoom:qS},{onDone:()=>de("focus")});else{const Ye=Cd.stack;Fe.start({focusAmt:ze.focusAmt},{focusAmt:0},{duration:Uf,onDone:()=>{Z.current=null}}),se({pitch:Ye.pitch,zoom:Ye.zoom},{onDone:()=>de("focus")})}},[te,ne,se,Fe,Pe,de]),j.useEffect(()=>{Be.current+=1,$e.current!==null&&Be.current>$e.current&&($e.current=null)});const ot=j.useCallback((oe,ze={})=>{const Ye=Cd[oe];xe.current=oe,le.current!==oe&&we(oe),te!=null&&($e.current=Be.current,X.focusLayer(null)),kt.current(!1);const Xe=re.current,dt=ze.animate===!1?0:Uf;Fe.start({focusAmt:Xe.focusAmt},{focusAmt:0},{duration:dt,onDone:()=>{Z.current=null}}),me.start({gap:Xe.gap},{gap:Ye.layerGap},{duration:dt,onDone:()=>{var xt;return(xt=Ae.current)==null?void 0:xt.call(Ae,Ye.layerGap)}}),se({yaw:Ye.yaw,pitch:Ye.pitch,zoom:Ye.zoom,targetY:0},{animate:ze.animate,onDone:()=>de("preset")})},[te,X,se,Fe,me,we,de]),ft=j.useRef(r);j.useEffect(()=>{ft.current!==r&&(ft.current=r,!(r==null||r===xe.current)&&ot(r))},[r,ot]);const it=u?[u.yaw,u.pitch,u.zoom,u.targetY].join("|"):"";j.useEffect(()=>{if(!u)return;const oe=re.current,ze=vc($($({},Xr(oe)),u));Object.keys(ze).every(Ye=>Math.abs(ze[Ye]-oe[Ye])<1e-6)||(Ge.cancel(),Je($({},ze)),ae())},[it]),j.useEffect(()=>{b===void 0||Math.abs(b-re.current.gap)<1e-6||(me.cancel(),re.current.gap=b,ae())},[b,ae,me]),j.useEffect(()=>{const oe=ie==="coupled"?1:0;Math.abs(re.current.mix-oe)<1e-6||be.start({mix:re.current.mix},{mix:oe},{duration:iU})},[ie,be]);const kt=j.useRef(De);kt.current=De;const pt=j.useRef(je);pt.current=je;const Yt=je&&!Ee;j.useEffect(()=>{if(!Yt)return;Pe();let oe=0,ze=null;const Ye=Xe=>{ze!==null&&(re.current.yaw+=x*Math.min(100,Xe-ze)/1e3),ze=Xe,K(),oe=requestAnimationFrame(Ye)};return oe=requestAnimationFrame(Ye),()=>{cancelAnimationFrame(oe),de("turntable")}},[Yt,x,K,Pe,de]);const Rt=j.useRef(null),[hn,Nn]=j.useState(1);j.useLayoutEffect(()=>{const oe=Rt.current;if(!oe)return;const ze=()=>{const Xe=oe.clientWidth;Xe>0&&Nn(k/Xe)};if(ze(),typeof ResizeObserver>"u")return;const Ye=new ResizeObserver(ze);return Ye.observe(oe),()=>Ye.disconnect()},[k]);const An=j.useRef(null),It=j.useRef(!1),$n=j.useRef(!1),yn=oe=>{if(oe.button!==0)return;It.current=!1;const ze=re.current;An.current={x:oe.clientX,y:oe.clientY,yaw:ze.yaw,pitch:ze.pitch,pointerId:oe.pointerId,moved:!1}},Na=oe=>{var ze,Ye;const Xe=An.current;if(!Xe||!W.orbit)return;const dt=oe.clientX-Xe.x,xt=oe.clientY-Xe.y;if(!Xe.moved){if(Math.abs(dt)+Math.abs(xt)<=oU)return;Xe.moved=!0,$n.current=!0,It.current=!0,(Ye=(ze=oe.currentTarget).setPointerCapture)==null||Ye.call(ze,Xe.pointerId),Ge.cancel(),pt.current&&De(!1),Pe()}const Ct=re.current;Ct.yaw=Xe.yaw+dt*lU,Ct.pitch=vc(ee($({},Xr(Ct)),{pitch:Xe.pitch+xt*cU})).pitch,ae()},kn=oe=>{var ze,Ye;const Xe=An.current;An.current=null,Xe!=null&&Xe.moved&&((Ye=(ze=oe.currentTarget).hasPointerCapture)!=null&&Ye.call(ze,Xe.pointerId)&&oe.currentTarget.releasePointerCapture(Xe.pointerId),$n.current=!1,setTimeout(()=>{It.current=!1},0),ae(),de("orbit"))},Un=j.useRef(null),Cn=j.useRef(W.zoom);Cn.current=W.zoom,j.useEffect(()=>{const oe=Rt.current;if(!oe)return;const ze=Ye=>{if(!Cn.current||!oe.contains(document.activeElement))return;Ye.preventDefault(),Ge.cancel(),Pe();const Xe=re.current;Xe.zoom=vc(ee($({},Xr(Xe)),{zoom:Xe.zoom*Math.exp(-Ye.deltaY*.0015)})).zoom,ae(),Un.current&&clearTimeout(Un.current),Un.current=setTimeout(()=>de("zoom"),160)};return oe.addEventListener("wheel",ze,{passive:!1}),()=>{oe.removeEventListener("wheel",ze),Un.current&&clearTimeout(Un.current)}},[Ge,Pe,ae,de]);const Xt=j.useMemo(()=>ne.layers.filter(oe=>!he.hiddenLayers.includes(oe.id)),[ne,he.hiddenLayers]),Mn=j.useMemo(()=>Xt.flatMap(oe=>oe.nodeIds.map(ze=>ne.nodeById.get(ze))),[Xt,ne]),Gt=j.useMemo(()=>{const oe=new Map;for(const ze of Xt)oe.set(ze.id,ze.nodeIds.map(Ye=>ne.nodeById.get(Ye)).sort((Ye,Xe)=>Ye.label.localeCompare(Xe.label)));return oe},[Xt,ne]),Zn=j.useMemo(()=>q?null:hU(new Map(ne.layers.map(oe=>[oe.id,oe.nodeIds.map(ze=>ne.nodeById.get(ze))]))),[q,ne]),{nodeEmphasis:ys,linkEmphasis:Hn}=X,ti=j.useMemo(()=>new Map(Mn.map(oe=>[oe.id,ys(oe)])),[Mn,ys]),da=j.useMemo(()=>ne.links.flatMap(oe=>{const ze=Hn(oe);if(!ze.visible)return[];const Ye=C0(oe,he);return[{link:oe,em:ze,text:ze.label&&Ye.length?xl(oe,ne.catalog,Ye):""}]}),[ne,Hn,he]),fn=re.current,Re=fn.mix,We=j.useMemo(()=>q?o$(q,Re):Zn,[q,Re,Zn]),lt=ne.layers.length,ht=Z.current!=null?ne.layerById.get(Z.current):void 0,jn=ht?{rank:ht.rank,amount:fn.focusAmt}:null,pa=oe=>ev(oe,lt,fn.gap,jn,sU),Ua=vc(ee($({},Xr(fn)),{targetY:fn.targetY+(ht?fn.focusAmt*ev(ht.rank,lt,fn.gap):0)})),Wt=VM(Ua,PS(Ua.pitch,ht?fn.focusAmt:0)),en=k,In=L,Ts=oe=>hd((oe+en/2)/en*100),Jn=oe=>hd((oe+In/2)/In*100),ma=E,Lt=new Map,Wn=new Map;for(const oe of Mn){const ze=(Di=We.get(oe.id))!=null?Di:{x:0,y:0},Ye={x:ze.x*ma*VS,y:pa(oe.layerRank),z:ze.y*ma*VS};Lt.set(oe.id,Ye),Wn.set(oe.id,Wt(Ye))}const pi=oe=>uU(oe)*Wn.get(oe.id).scale,Dn=Ua.pitch>=Q$,Xa=Bf(Xt.map(oe=>{const ze=pa(oe.rank),Ye=BS(ze,ma).map(Wt);return{layer:oe,depth:Wt({x:0,y:ze,z:0}).depth,points:$f(Ye),grid:J$(ze,ma).map(([Xe,dt])=>$f([Wt(Xe),Wt(dt)])),anchor:eU(Ye),center:Wt({x:0,y:ze,z:0})}}),oe=>oe.depth),mi=oe=>te&&oe!==te?.2:1,Li=46*hn,Sl=(()=>{const oe=[...Xa].sort((xt,Ct)=>xt.layer.rank-Ct.layer.rank);if(Dn&&oe.length>0){const xt=Math.max(-en/2+150*hn,Math.min(...oe.map(aa=>aa.anchor.x))-16),Ct=oe.reduce((aa,Ia)=>aa+Ia.center.y,0)/oe.length,zt=nU(oe.length,xt,Ct,Li);return oe.map((aa,Ia)=>({p:aa,x:zt[Ia].x,y:zt[Ia].y}))}const ze=-en/2+150*hn,Ye=-In/2+22*hn,Xe=In/2-22*hn,dt=oe.map(xt=>({p:xt,x:Math.max(ze,xt.anchor.x-8),y:YS(xt.anchor.y,Ye,Xe)})).sort((xt,Ct)=>xt.y-Ct.y);for(let xt=1;xt<dt.length;xt++)dt[xt].y-dt[xt-1].y<Li&&(dt[xt].y=dt[xt-1].y+Li);return dt.sort((xt,Ct)=>xt.p.layer.rank-Ct.p.layer.rank)})(),Tt=[],As=[],vs=[];for(const{link:oe,em:ze,text:Ye}of da){const Xe=Wn.get(oe.sourceId),dt=Wn.get(oe.targetId);if(!Xe||!dt)continue;const xt=d$(Xe,dt),Ct=(Xe.depth+dt.depth)/2-ze.z*1e4;if(Tt.push({id:oe.id,d:xt.d,color:ze.color,width:hd(ze.width*Math.min(Xe.scale,dt.scale)),opacity:ze.opacity,dash:ze.dash,key:Ct}),ze.arrow){const zt=dt.x-Xe.x,aa=dt.y-Xe.y,Ia=Math.hypot(zt,aa)||1,vt=pi(ne.nodeById.get(oe.targetId))+2;if(Ia>vt+14){const ga=zt/Ia,En=aa/Ia;As.push({id:oe.id,points:M0({x:dt.x-ga*vt,y:dt.y-En*vt},ga,En,8*dt.scale,3.6*dt.scale),color:ze.color,opacity:ze.highlighted?1:.8,key:Ct})}}Ye&&ze.opacity>=.2&&vs.push({id:oe.id,text:Ye,pointAt:xt.pointAt,priority:R0(oe,ze),color:ze.color,opacity:ze.highlighted?1:.9})}const La=Bf(Tt,oe=>oe.key),Ta=Bf(As,oe=>oe.key),wo=$n.current||Yt||Ge.isActive()||Fe.isActive()||me.isActive()||be.isActive(),su=(()=>{if(wo||vs.length===0)return[];const oe=Mn.map(Ye=>{const Xe=Wn.get(Ye.id),dt=pi(Ye);return{x:Xe.x,y:Xe.y,width:dt*2,height:dt*2}}),ze=new Map(vs.map(Ye=>[Ye.id,Ye]));return E0(vs,{obstacles:oe,size:Ye=>({width:(Ye.length*5.8+12)*hn,height:15*hn})}).map(Ye=>ee($({},Ye),{color:ze.get(Ye.id).color,opacity:ze.get(Ye.id).opacity}))})(),Fa=pe!=null?ne.nodeById.get(pe):void 0,mr=(()=>{if(!Fa||!Lt.has(Fa.id)||Xt.length<2)return null;const oe=Lt.get(Fa.id),ze=Xt.map(dt=>pa(dt.rank)),Ye=$f([Wt({x:oe.x,y:Math.max(...ze),z:oe.z}),Wt({x:oe.x,y:Math.min(...ze),z:oe.z})]),Xe=Xt.filter(dt=>dt.id!==Fa.layerId).map(dt=>({id:dt.id,points:$f(W$(oe.x,pa(dt.rank),oe.z,14).map(Wt))}));return{column:Ye,rings:Xe}})(),ni=Bf(Mn,oe=>Wn.get(oe.id).depth-(oe.id===pe?1e6:0)),gi=new Map(ni.map((oe,ze)=>[oe.id,ze+1])),[Fn,gr]=j.useState(null),[Nl,Ti]=j.useState(null),Is=j.useRef(new Map),ai=(ii=(Os=(Ja=Fn&&Wn.has(Fn)?Fn:null)!=null?Ja:pe&&Wn.has(pe)?pe:null)!=null?Os:(z=Mn[0])==null?void 0:z.id)!=null?ii:null,Ai=oe=>{var ze;oe&&(gr(oe),(ze=Is.current.get(oe))==null||ze.focus())},Za=(oe,ze)=>{var Ia,vt;var Ye,Xe,dt,xt,Ct;const zt=(Ia=Gt.get(ze.layerId))!=null?Ia:[],aa=zt.findIndex(ga=>ga.id===ze.id);if(oe.key==="ArrowRight"||oe.key==="ArrowLeft")oe.preventDefault(),Ai((Ye=zt[(aa+(oe.key==="ArrowRight"?1:zt.length-1))%zt.length])==null?void 0:Ye.id);else if(oe.key==="ArrowUp"||oe.key==="ArrowDown"){oe.preventDefault();const ga=Xt.findIndex(qn=>qn.id===ze.layerId),En=Xt[ga+(oe.key==="ArrowUp"?-1:1)];if(!En)return;const sn=ze.adjacency.map(qn=>ne.nodeById.get(qn.otherId)).find(qn=>qn.layerId===En.id);Ai((vt=sn==null?void 0:sn.id)!=null?vt:(dt=(Xe=Gt.get(En.id))==null?void 0:Xe[0])==null?void 0:dt.id)}else oe.key==="Home"||oe.key==="End"?(oe.preventDefault(),Ai(oe.key==="Home"?(xt=zt[0])==null?void 0:xt.id:(Ct=zt[zt.length-1])==null?void 0:Ct.id)):oe.key==="Escape"&&pe&&(oe.preventDefault(),X.select(null))},yr=oe=>It.current&&oe.detail!==0,So=(oe,ze)=>{!W.select||yr(oe)||X.select(pe===ze?null:ze)},Mt=oe=>{!W.select||yr(oe)||pe&&X.select(null)},No=(oe,ze)=>{!W.focusLayer||yr(oe)||X.focusLayer(te===ze?null:ze)},ko=j.useCallback(()=>{const oe=re.current,ze=Xt.flatMap(Xe=>BS(ev(Xe.rank,lt,oe.gap),ma)),Ye=ee($({},Xr(oe)),{targetY:0});Pe(),se({targetY:0,zoom:tU(ze,Ye,{width:en,height:In,margin:40},PS(Ye.pitch,0))},{onDone:()=>de("fit")})},[Xt,lt,ma,en,In,se,Pe,de]);j.useImperativeHandle(D,()=>({applyPreset:ot,setCamera:(oe,ze={})=>{Pe(),se(oe,{animate:ze.animate,onDone:()=>de("api")})},getCamera:()=>Xr(re.current),zoomBy:oe=>{Pe(),se({zoom:re.current.zoom*oe},{duration:rU,onDone:()=>de("zoom")})},fit:ko,setTurntable:oe=>kt.current(oe),focusLayer:oe=>X.focusLayer(oe),select:oe=>X.select(oe),setFollow:oe=>X.setFollow(oe),element:()=>Rt.current}),[ot,Pe,se,de,ko,X]);const Ds=oe=>{const ze=ti.get(oe.id);return oe.id===H||oe.id===Nl?!0:M==="none"?!1:ze.hop!==null?!0:M==="all"&&ze.opacity>.5},Ii=oe=>qo(YS(10.5*Wn.get(oe.id).scale,8,14)),Aa=A!=null?A:`Layer stack: ${Xt.length} layers, ${Mn.length} nodes, ${da.length} links${Fa?`; ${Fa.label} selected`:""}`;return f.jsxs("div",ee($({ref:Rt,className:["layer-stack",W.orbit?"layer-stack--orbit":"",I].filter(Boolean).join(" "),style:$({aspectRatio:`${en} / ${In}`},T),tabIndex:-1,role:"group","aria-roledescription":"3D layer stack","aria-label":Aa,"data-preset":ge!=null?ge:"","data-focused-layer":te!=null?te:"",onPointerDown:yn,onPointerMove:Na,onPointerUp:kn,onPointerCancel:kn,onKeyDown:oe=>{oe.key==="Escape"&&pe&&W.select&&X.select(null)}},R),{children:[f.jsxs("svg",{className:"layer-stack__svg",viewBox:`${-en/2} ${-In/2} ${en} ${In}`,preserveAspectRatio:"none","aria-hidden":"true",children:[f.jsx("rect",{className:"layer-stack__bg",x:-en/2,y:-In/2,width:en,height:In,onClick:Mt}),Xa.map(oe=>f.jsxs("g",{className:"layer-stack__plane",opacity:mi(oe.layer.id),"data-layer-id":oe.layer.id,children:[f.jsx("polygon",{points:oe.points,className:te===oe.layer.id?"layer-stack__plane-fill layer-stack__plane-fill--focused":"layer-stack__plane-fill",style:{fill:oe.layer.color,stroke:oe.layer.color},onClick:Mt}),oe.grid.map((ze,Ye)=>f.jsx("polyline",{points:ze,className:"layer-stack__grid",style:{stroke:oe.layer.color}},Ye))]},oe.layer.id)),La.map(oe=>f.jsx("path",{className:"layer-stack__link","data-link-id":oe.id,d:oe.d,style:{stroke:oe.color,strokeWidth:oe.width,strokeOpacity:oe.opacity},strokeDasharray:oe.dash||void 0},oe.id)),Ta.map(oe=>f.jsx("polygon",{className:"layer-stack__arrow",points:oe.points,style:{fill:oe.color,fillOpacity:oe.opacity}},oe.id)),mr&&f.jsxs("g",{className:"layer-stack__drill",children:[f.jsx("polyline",{className:"layer-stack__drill-column",points:mr.column}),mr.rings.map(oe=>f.jsx("polyline",{className:"layer-stack__drill-ring",points:oe.points},oe.id))]}),ni.map(oe=>{const ze=Wn.get(oe.id),Ye=ti.get(oe.id),Xe=pi(oe),dt=ne.layerById.get(oe.layerId),xt=Ye.selected?"selected":Ye.followed?"followed":oe.id===H?"hover":null;return f.jsxs("g",{className:"layer-stack__node","data-node-id":oe.id,opacity:hd(Ye.opacity),onClick:Ct=>So(Ct,oe.id),onPointerEnter:()=>{var Ct;return W.hover&&!((Ct=An.current)!=null&&Ct.moved)&&X.hover(oe.id)},onPointerLeave:()=>W.hover&&H===oe.id&&X.hover(null),children:[xt&&f.jsx("circle",{className:`layer-stack__ring layer-stack__ring--${xt}`,cx:qo(ze.x),cy:qo(ze.y),r:qo(Xe+3.5)}),f.jsx("circle",{className:"layer-stack__disc",cx:qo(ze.x),cy:qo(ze.y),r:qo(Xe),style:{fill:dt.color}})]},oe.id)})]}),f.jsxs("div",{className:"layer-stack__overlay",children:[su.map(oe=>f.jsx("span",{className:"layer-stack__pill",style:{left:`${Ts(oe.x)}%`,top:`${Jn(oe.y)}%`,color:oe.color,borderColor:`color-mix(in srgb, ${oe.color} 34%, transparent)`,opacity:oe.opacity},children:oe.text},oe.id)),f.jsx("div",{role:"group","aria-label":"Nodes",className:"layer-stack__nodes",children:Xt.flatMap(oe=>{var ze;return((ze=Gt.get(oe.id))!=null?ze:[]).map(Ye=>{const Xe=Wn.get(Ye.id),dt=ti.get(Ye.id),xt=Ds(Ye),Ct=dt.selected?" layer-stack__label--selected":dt.followed?" layer-stack__label--followed":"";return f.jsx("button",{ref:zt=>{zt?Is.current.set(Ye.id,zt):Is.current.delete(Ye.id)},type:"button",className:`layer-stack__label${Ct}${xt?"":" layer-stack__label--hidden"}`,"data-node-id":Ye.id,tabIndex:Ye.id===ai?0:-1,"aria-pressed":dt.selected,"aria-label":`${Ye.label}, ${oe.label} layer${dt.selected?", selected":""}`,style:{left:`${Ts(Xe.x+pi(Ye)+4)}%`,top:`${Jn(Xe.y)}%`,fontSize:Ii(Ye),opacity:hd(Math.max(dt.opacity,.35)),zIndex:gi.get(Ye.id)},onClick:zt=>So(zt,Ye.id),onFocus:()=>{gr(Ye.id),Ti(Ye.id)},onBlur:()=>Ti(zt=>zt===Ye.id?null:zt),onPointerEnter:()=>{var zt;return W.hover&&!((zt=An.current)!=null&&zt.moved)&&X.hover(Ye.id)},onPointerLeave:()=>W.hover&&H===Ye.id&&X.hover(null),onKeyDown:zt=>Za(zt,Ye),children:Ye.displayLabel},Ye.id)})})}),Sl.map(({p:oe,x:ze,y:Ye})=>{const Xe=oe.layer,dt=te===Xe.id,xt=f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"layer-stack__title-name",style:{color:Xe.color},children:Xe.label.toUpperCase()}),f.jsx("span",{className:"layer-stack__title-sub",children:`${Xe.nodeIds.length} nodes · ${Xe.intraLinkCount} links`})]}),Ct={className:`layer-stack__title${dt?" layer-stack__title--focused":""}${Dn?" layer-stack__title--rail":""}`,style:{left:`${Ts(ze)}%`,top:`${Jn(Ye)}%`,opacity:mi(Xe.id)},"data-layer-id":Xe.id};return W.focusLayer?f.jsx("button",ee($({type:"button"},Ct),{"aria-pressed":dt,"aria-label":`${dt?"Exit focus on":"Focus"} ${Xe.label} layer: ${Xe.nodeIds.length} nodes, ${Xe.intraLinkCount} links`,onClick:zt=>No(zt,Xe.id),children:xt}),Xe.id):f.jsx("div",ee($({},Ct),{children:xt}),Xe.id)}),Mn.length===0&&f.jsx("span",{className:"layer-stack__empty",children:"No nodes to show."})]})]}))});YM.displayName="LayerStack";function _o(e,t){const n=j.useContext(vl),a=e!=null?e:n;if(!a)throw new Error(`${t} needs a \`graph\` prop or an enclosing <LayeredGraphContext.Provider>`);return a}function di(...e){return e.filter(Boolean).join(" ")}function fU(e){const t=e.replace(/[_-]+/g," ").trim();return t?t[0].toUpperCase()+t.slice(1):"Uncategorized"}const Vp=Se.forwardRef((h,u)=>{var m=h,{label:e,ariaLabel:t,value:n,options:a,onChange:i,disabled:r,className:l}=m,c=Ie(m,["label","ariaLabel","value","options","onChange","disabled","className"]);return f.jsxs("div",ee($({ref:u,className:di("layered-control",l)},c),{children:[e!=null&&f.jsx("span",{className:"layered-control__eyebrow","aria-hidden":"true",children:e}),f.jsx(ps,{"aria-label":t,value:n,options:a,onChange:i,disabled:r})]}))});Vp.displayName="SegmentedChrome";function Yp(e){return e<=0?"Direct":`+${e} layer${e>1?"s":""}`}const pU=[0,1,2],GM=Se.forwardRef((l,r)=>{var c=l,{graph:e,options:t=pU,formatOption:n=Yp,label:a="Follow"}=c,i=Ie(c,["graph","options","formatOption","label"]);const u=_o(e,"FollowControl");return f.jsx(Vp,ee($({ref:r},i),{label:a,ariaLabel:"Follow links from the selection",value:u.follow,options:t.map(h=>({value:h,label:n(h)})),onChange:h=>u.setFollow(Number(h))}))});GM.displayName="FollowControl";const mU={off:"Off",highlighted:"Highlighted",all:"All"},gU=["off","highlighted","all"],ax=Se.forwardRef((l,r)=>{var c=l,{graph:e,options:t=gU,optionLabels:n,label:a="Predicates"}=c,i=Ie(c,["graph","options","optionLabels","label"]);const u=_o(e,"PredicateLabelControl");return f.jsx(Vp,ee($({ref:r},i),{label:a,ariaLabel:"Predicate labels",value:u.predicateLabels,options:t.map(h=>{var m;return{value:h,label:(m=n==null?void 0:n[h])!=null?m:mU[h]}}),onChange:h=>u.setPredicateLabels(h)}))});ax.displayName="PredicateLabelControl";const yU={independent:"Independent",coupled:"Coupled"},KM=Se.forwardRef((r,i)=>{var l=r,{graph:e,optionLabels:t,label:n="Plane layout"}=l,a=Ie(l,["graph","optionLabels","label"]);const c=_o(e,"PlaneLayoutControl");return f.jsx(Vp,ee($({ref:i},a),{label:n,ariaLabel:"Plane layout",value:c.planeLayout,options:["independent","coupled"].map(u=>{var h;return{value:u,label:(h=t==null?void 0:t[u])!=null?h:yU[u]}}),onChange:u=>c.setPlaneLayout(u)}))});KM.displayName="PlaneLayoutControl";function tv(a){var i=a,{pressed:e,className:t}=i,n=Ie(i,["pressed","className"]);return f.jsx("button",$({type:"button","aria-pressed":e,className:di("layered-toggle",e&&"layered-toggle--on",t)},n))}const QM=Se.forwardRef((b,x)=>{var _=b,{graph:e,categories:t,categoryLabels:n,showCounts:a=!0,label:i="Links",showIntraToggle:r=!0,intraLabel:l="Intra-layer links",showLabelToggle:c,nodeLabels:u=!0,onNodeLabelsChange:h,labelToggleLabel:m="Labels",children:p,className:g}=_,v=Ie(_,["graph","categories","categoryLabels","showCounts","label","showIntraToggle","intraLabel","showLabelToggle","nodeLabels","onNodeLabelsChange","labelToggleLabel","children","className"]);const S=_o(e,"LinkCategoryFilter"),{index:M,filters:C,emphasisContext:k}=S,L=t!=null?t:M.categories,E=c!=null?c:h!==void 0,I=j.useId();return f.jsxs("div",ee($({ref:x,role:"group","aria-labelledby":i!=null?I:void 0,"aria-label":i==null?"Links":void 0,className:di("layered-link-filter",g)},v),{children:[i!=null&&f.jsx("span",{className:"layered-control__eyebrow",id:I,children:i}),L.map(T=>{var B,z;const A=C.categories[T]!==!1,R=OM(T,k),D=(B=M.categoryCounts[T])!=null?B:0,O=(z=n==null?void 0:n[T])!=null?z:fU(T);return f.jsxs(tv,{pressed:A,onClick:()=>S.toggleCategory(T),"data-category":T,children:[f.jsx("svg",{className:"layered-toggle__sample",width:"22",height:"8","aria-hidden":"true",children:f.jsx("line",{x1:"1",y1:"4",x2:"21",y2:"4",stroke:R.color,strokeWidth:"2",strokeDasharray:R.dash||void 0,strokeLinecap:"round"})}),O,a&&f.jsx("span",{className:"layered-toggle__count",children:D})]},T)}),(r||E)&&f.jsx("span",{className:"layered-link-filter__divider","aria-hidden":"true"}),r&&f.jsx(tv,{pressed:C.showIntra,onClick:()=>S.setShowIntra(!C.showIntra),children:l}),E&&f.jsx(tv,{pressed:u,onClick:()=>h==null?void 0:h(!u),children:m}),p!=null&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"layered-link-filter__divider","aria-hidden":"true"}),p]})]}))});QM.displayName="LinkCategoryFilter";const Gp=Se.forwardRef((r,i)=>{var l=r,{label:e,className:t,children:n}=l,a=Ie(l,["label","className","children"]);const c=j.useId();return f.jsxs("div",ee($({ref:i,className:di("layered-list",t)},a),{children:[e!=null&&f.jsx("span",{className:"layered-control__eyebrow",id:c,children:e}),f.jsx("ul",{className:"layered-list__items","aria-labelledby":e!=null?c:void 0,children:n})]}))});Gp.displayName="ListSection";function sx({color:e}){return f.jsx("span",{className:"layered-dot",style:{background:e},"aria-hidden":"true"})}const XM=Se.forwardRef((u,c)=>{var h=u,{graph:e,label:t="Layers",focusable:n=!0,hideable:a=!0,showCounts:i=!0,className:r}=h,l=Ie(h,["graph","label","focusable","hideable","showCounts","className"]);const m=_o(e,"LayerList"),{index:p,filters:g,focusedLayerId:v}=m;return f.jsx(Gp,ee($({ref:c,label:t,className:di("layer-list",r)},l),{children:p.layers.map(x=>{const b=g.hiddenLayers.includes(x.id),_=v===x.id,S=`${x.nodeIds.length} nodes, ${x.intraLinkCount} links within`,M=f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"layer-list__swatch",style:{background:x.color},"aria-hidden":"true"}),f.jsx("span",{className:"layer-list__name",children:x.label}),i&&f.jsxs("span",{className:"layered-row__meta",title:S,"aria-hidden":"true",children:[x.nodeIds.length," · ",x.intraLinkCount]})]});return f.jsxs("li",{className:di("layer-list__item",b&&"layer-list__item--hidden"),"data-layer":x.id,children:[n?f.jsx("button",{type:"button",className:di("layered-row",_&&"layered-row--on"),"aria-pressed":_,"aria-label":`${x.label} layer, ${S}${b?", hidden":""}`,disabled:b,onClick:()=>m.focusLayer(_?null:x.id),children:M}):f.jsxs("div",{className:"layered-row layered-row--static",children:[M,f.jsx("span",{className:"layered-visually-hidden",children:`, ${S}${b?", hidden":""}`})]}),a&&f.jsx(Bn,{variant:"ghost",size:"sm",icon:!0,className:"layer-list__eye","aria-label":`${b?"Show":"Hide"} ${x.label}`,"aria-pressed":b,onClick:()=>m.toggleLayer(x.id),children:f.jsx(nt,{name:b?"eyeOff":"eye",size:14,"aria-hidden":"true"})})]},x.id)})}))});XM.displayName="LayerList";const ZM=Se.forwardRef((m,h)=>{var p=m,{graph:e,label:t="Cross-layer links",showEmptyPairs:n=!1,sort:a="rank",limit:i,clearSelection:r=!0,emptyText:l="No cross-layer links.",className:c}=p,u=Ie(p,["graph","label","showEmptyPairs","sort","limit","clearSelection","emptyText","className"]);const g=_o(e,"LayerPairList"),{index:v,filters:x}=g,b=j.useMemo(()=>{let _=v.layerPairs.filter(S=>(n||S.linkCount>0)&&!S.layerIds.some(M=>x.hiddenLayers.includes(M)));return a==="count"&&(_=[..._].sort((S,M)=>M.linkCount-S.linkCount)),i!=null?_.slice(0,i):_},[v,x.hiddenLayers,n,a,i]);return f.jsxs(Gp,ee($({ref:h,label:t,className:di("layer-pair-list",c)},u),{children:[b.length===0&&f.jsx("li",{className:"layered-list__empty",children:l}),b.map(_=>{const[S,M]=_.layerIds.map(k=>v.layerById.get(k)),C=x.layerPair===_.key;return f.jsx("li",{children:f.jsxs("button",{type:"button",className:di("layered-row",C&&"layered-row--on"),"aria-pressed":C,"aria-label":`${S.label} and ${M.label}, ${_.linkCount} cross-layer links`,onClick:()=>{r&&!C&&g.select(null),g.setLayerPair(_.key)},children:[f.jsxs("span",{className:"layer-pair-list__dots","aria-hidden":"true",children:[f.jsx(sx,{color:S.color}),f.jsx(sx,{color:M.color})]}),f.jsxs("span",{className:"layered-row__name",children:[S.label," / ",M.label]}),f.jsx("span",{className:"layered-row__count","aria-hidden":"true",children:_.linkCount})]})},_.key)})]}))});ZM.displayName="LayerPairList";const JM=Se.forwardRef((c,l)=>{var u=c,{graph:e,label:t="Bridge nodes · most cross-layer links",limit:n=6,emptyText:a="No cross-layer links.",className:i}=u,r=Ie(u,["graph","label","limit","emptyText","className"]);const h=_o(e,"BridgeNodeList"),{index:m,filters:p,selectedId:g}=h,v=j.useMemo(()=>m.nodes.filter(x=>x.crossDegree>0&&!p.hiddenLayers.includes(x.layerId)).sort((x,b)=>b.crossDegree-x.crossDegree||b.degree-x.degree).slice(0,Math.max(0,n)),[m,p.hiddenLayers,n]);return f.jsxs(Gp,ee($({ref:l,label:t,className:di("bridge-node-list",i)},r),{children:[v.length===0&&f.jsx("li",{className:"layered-list__empty",children:a}),v.map(x=>{const b=m.layerById.get(x.layerId),_=g===x.id;return f.jsx("li",{children:f.jsxs("button",{type:"button",className:di("layered-row",_&&"layered-row--on"),"aria-pressed":_,"aria-label":`${x.label}, ${b.label} layer, ${x.crossDegree} cross-layer links`,onClick:()=>h.select(x.id),children:[f.jsx(sx,{color:b.color}),f.jsx("span",{className:"layered-row__name",children:x.displayLabel}),f.jsx("span",{className:"layered-row__count","aria-hidden":"true",children:x.crossDegree})]})},x.id)})]}))});JM.displayName="BridgeNodeList";function vU(e){const{index:t,filters:n,reach:a,selectedId:i}=e,r=i?t.nodeById.get(i):void 0;if(!r)return null;const l=t.layerById.get(r.layerId),c=v=>({id:v.id,label:v.label,color:v.color}),u=v=>{const x=t.linkById.get(v);return xl(x,t.catalog,C0(x,n))},h=[],m=[];for(const v of r.adjacency){const x=t.linkById.get(v.linkId),b=t.nodeById.get(v.otherId);if(!x||!b||!Np(x,t,n))continue;const _={id:`${x.id}:${v.direction}`,target:b.id,targetTitle:b.label,predicate:u(x.id),direction:v.direction,hop:1,layer:c(t.layerById.get(b.layerId))};(x.cross?h:m).push(_)}const p=[];if(a.originId===r.id){const v=[...a.hopOf.entries()].filter(([,x])=>x>=2).map(([x,b])=>({n:t.nodeById.get(x),h:b})).sort((x,b)=>x.h-b.h||x.n.layerRank-b.n.layerRank||x.n.label.localeCompare(b.n.label));for(const{n:x,h:b}of v){const _=a.via.get(x.id),S=_?t.nodeById.get(_.fromId):void 0,M=_?t.linkById.get(_.linkId):void 0;p.push({id:`followed:${x.id}`,target:x.id,targetTitle:x.label,predicate:M?u(M.id):"",direction:M&&M.sourceId===_.fromId?"out":"in",hop:b,via:S&&M?{id:S.id,title:S.label,predicate:u(M.id)}:void 0,layer:c(t.layerById.get(x.layerId))})}}const g=new Set;for(const v of a.hopOf.keys()){const x=t.nodeById.get(v);x&&g.add(x.layerId)}return{node:r,layer:l,cross:h,intra:m,followed:p,reachCount:Math.max(0,a.hopOf.size-1),reachLayerCount:g.size}}function xU(e,t){const n=`${e.reachCount} node${e.reachCount===1?"":"s"}`,a=`${e.reachLayerCount} layer${e.reachLayerCount===1?"":"s"}`;return`reach ${n} across ${a} · follow ${t>0?Yp(t):"direct only"}`}function KS({rel:e,showLayer:t,onPick:n}){const a=e.direction==="out"?"outgoing":"incoming";return f.jsx("li",{children:f.jsxs("button",{type:"button",className:"layered-row reach-inspector__rel","aria-label":`${e.targetTitle}, ${a}${e.predicate?` ${e.predicate}`:""}${t&&e.layer?`, ${e.layer.label} layer`:""}`,onClick:()=>n(e.target),children:[f.jsx(nt,{className:"reach-inspector__dir",name:e.direction==="out"?"arrowRight":"arrowLeft",size:13,"aria-hidden":"true"}),f.jsx("span",{className:"layered-row__name",children:e.targetTitle}),e.predicate&&f.jsx("span",{className:"reach-inspector__pred","aria-hidden":"true",children:e.predicate}),t&&e.layer&&f.jsx("span",{className:"layered-dot",style:{background:e.layer.color},"aria-hidden":"true"})]})})}const WM=Se.forwardRef((v,g)=>{var x=v,{graph:e,emptyText:t="No node selected.",empty:n,showClear:a=!0,showDescription:i=!0,showStats:r=!0,showFollowed:l=!0,showReachSummary:c=!0,onNodeSelect:u,className:h="",style:m}=x,p=Ie(x,["graph","emptyText","empty","showClear","showDescription","showStats","showFollowed","showReachSummary","onNodeSelect","className","style"]);const b=_o(e,"ReachInspector"),{index:_,filters:S,reach:M,selectedId:C,follow:k}=b,L=j.useMemo(()=>vU({index:_,filters:S,reach:M,selectedId:C}),[_,S,M,C]),E=u!=null?u:b.select,I=["reach-inspector",h].filter(Boolean).join(" ");if(!L)return f.jsx("div",ee($({ref:g,className:I,style:m},p),{children:n!=null?n:f.jsx("p",{className:"reach-inspector__empty",children:t})}));const{node:T,layer:A,cross:R,intra:D,followed:O}=L,B={"--reach-inspector-layer":A.color};return f.jsxs("div",ee($({ref:g,className:I,style:$($({},B),m)},p),{children:[f.jsxs("section",{className:"reach-inspector__head","aria-label":`${T.label}, ${A.label} layer`,children:[f.jsxs("div",{className:"reach-inspector__eyebrow-row",children:[f.jsxs("span",{className:"layered-control__eyebrow reach-inspector__layer",children:[A.label," layer"]}),a&&f.jsx(Bn,{variant:"ghost",size:"sm",icon:!0,"aria-label":"Clear selection",onClick:()=>b.select(null),children:f.jsx(nt,{name:"x",size:14,"aria-hidden":"true"})})]}),f.jsx("h2",{className:"reach-inspector__title",children:T.label}),f.jsx("span",{className:"reach-inspector__id",children:T.nodeId}),i&&T.description&&f.jsx("p",{className:"reach-inspector__description",children:T.description}),r&&f.jsxs("div",{className:"reach-inspector__stats",children:[f.jsx(Mc,{className:"reach-inspector__stat",color:"amber",label:"Across layers",value:R.length}),f.jsx(Mc,{className:"reach-inspector__stat reach-inspector__stat--layer",color:"neutral",label:"Within layer",value:D.length})]})]}),f.jsxs("section",{className:"reach-inspector__section",children:[f.jsx("span",{className:"layered-control__eyebrow",children:"Across layers"}),R.length>0?f.jsx("ul",{className:"layered-list__items",children:R.map(z=>f.jsx(KS,{rel:z,showLayer:!0,onPick:E},z.id))}):f.jsx("p",{className:"reach-inspector__empty-mini",children:"No cross-layer links on this node."}),c&&f.jsx("span",{className:"reach-inspector__summary",children:xU(L,k)})]}),l&&O.length>0&&f.jsxs("section",{className:"reach-inspector__section",children:[f.jsxs("span",{className:"layered-control__eyebrow reach-inspector__followed-title",children:["Followed across layers · ",O.length]}),f.jsx("ul",{className:"layered-list__items",children:O.map(z=>{var U,F;return f.jsx("li",{children:f.jsxs("button",{type:"button",className:"layered-row reach-inspector__rel reach-inspector__rel--followed","aria-label":`${z.targetTitle}, ${(U=z.layer)==null?void 0:U.label} layer, ${z.hop-1} past direct${z.via?`, via ${z.via.title} ${z.via.predicate}`:""}`,onClick:()=>E(z.target),children:[f.jsx("span",{className:"layered-dot",style:{background:(F=z.layer)==null?void 0:F.color},"aria-hidden":"true"}),f.jsxs("span",{className:"reach-inspector__followed-text","aria-hidden":"true",children:[f.jsx("span",{className:"layered-row__name",children:z.targetTitle}),z.via&&f.jsxs("span",{className:"reach-inspector__via",children:["via ",z.via.title,z.via.predicate?` · ${z.via.predicate}`:""]})]}),f.jsxs("span",{className:"reach-inspector__hop","aria-hidden":"true",children:["+",z.hop-1]})]})},z.id)})})]}),f.jsxs("section",{className:"reach-inspector__section",children:[f.jsxs("span",{className:"layered-control__eyebrow",children:["Within ",A.label]}),D.length>0?f.jsx("ul",{className:"layered-list__items",children:D.map(z=>f.jsx(KS,{rel:z,showLayer:!1,onPick:E},z.id))}):f.jsx("p",{className:"reach-inspector__empty-mini",children:"No links within this layer."})]})]}))});WM.displayName="ReachInspector";function Nc(...e){return e.filter(Boolean).join(" ")}const ix=["stack","lanes","matrix","hive"],ej={stack:"3D stack",lanes:"Lanes",matrix:"Matrix",hive:"Hive"},tj=Se.forwardRef((h,u)=>{var m=h,{views:e=ix,value:t,onChange:n,viewLabels:a,label:i="View",disabled:r,className:l}=m,c=Ie(m,["views","value","onChange","viewLabels","label","disabled","className"]);return f.jsxs("div",ee($({ref:u,className:Nc("layered-control",l)},c),{children:[i!=null&&f.jsx("span",{className:"layered-control__eyebrow",children:i}),f.jsx(ps,{"aria-label":"View",value:t,disabled:r,onChange:p=>n(p),options:e.map(p=>{var g;return{value:p,label:(g=a==null?void 0:a[p])!=null?g:ej[p]}})})]}))});tj.displayName="ViewSwitcher";const bU={stack:"Stack",exploded:"Exploded",top:"Top",profile:"Profile"},nj=Se.forwardRef((_,b)=>{var S=_,{stack:e,preset:t=null,onPresetChange:n,presets:a=G$,presetLabels:i,turntable:r=!1,onTurntableChange:l,showZoom:c=!0,showFit:u=!1,showTurntable:h=!0,zoomStep:m=1.2,label:p=null,disabled:g,className:v}=S,x=Ie(S,["stack","preset","onPresetChange","presets","presetLabels","turntable","onTurntableChange","showZoom","showFit","showTurntable","zoomStep","label","disabled","className"]);const M=k=>{var L;(L=e==null?void 0:e.current)==null||L.applyPreset(k),n==null||n(k)},C=()=>{var k;l?l(!r):(k=e==null?void 0:e.current)==null||k.setTurntable(!r)};return f.jsxs("div",ee($({ref:b,className:Nc("layered-camera-controls",v),role:"group","aria-label":"Camera"},x),{children:[a.length>0&&f.jsxs("div",{className:"layered-control",children:[p!=null&&f.jsx("span",{className:"layered-control__eyebrow",children:p}),f.jsx(ps,{"aria-label":"Camera preset",value:t!=null?t:"",disabled:g,onChange:k=>M(k),options:a.map(k=>{var L;return{value:k,label:(L=i==null?void 0:i[k])!=null?L:bU[k]}})})]}),(c||u||h)&&f.jsxs("div",{className:"layered-camera-controls__buttons",children:[c&&f.jsxs(f.Fragment,{children:[f.jsxs(Bn,{variant:"ghost",size:"sm",disabled:g,onClick:()=>{var k;return(k=e==null?void 0:e.current)==null?void 0:k.zoomBy(1/m)},children:[f.jsx(nt,{name:"zoomOut",size:14}),"Zoom out"]}),f.jsxs(Bn,{variant:"ghost",size:"sm",disabled:g,onClick:()=>{var k;return(k=e==null?void 0:e.current)==null?void 0:k.zoomBy(m)},children:[f.jsx(nt,{name:"zoomIn",size:14}),"Zoom in"]})]}),u&&f.jsxs(Bn,{variant:"ghost",size:"sm",disabled:g,onClick:()=>{var k;return(k=e==null?void 0:e.current)==null?void 0:k.fit()},children:[f.jsx(nt,{name:"maximize",size:14}),"Fit"]}),h&&f.jsxs(Bn,{variant:r?"accent":"ghost",size:"sm",disabled:g,"aria-pressed":r,onClick:C,children:[f.jsx(nt,{name:"reload",size:14}),"Turntable"]})]})]}))});nj.displayName="CameraControls";const _U={viewSwitcher:!0,follow:!0,predicateLabels:!0,linkFilter:!0,nodeLabels:!0,camera:!0,planeLayout:!0,inspector:!0,layers:!0,layerPairs:!0,bridgeNodes:!0,status:!0},nv=[],av=[],QS={layerBy:""},wU=560,XS=e=>Math.round(e*180/Math.PI);function SU(e,t,n){return[t,`yaw ${XS(e.yaw)}° pitch ${XS(e.pitch)}° zoom ${e.zoom.toFixed(2)}`,`gap ${Math.round(n)}`].filter(Boolean).join(" · ")}const NU=Se.forwardRef((z,B)=>{var U=z,{graph:e,nodes:t,edges:n,layering:a,graphOptions:i,views:r=ix,viewLabels:l,view:c,defaultView:u,onViewChange:h,controls:m,followOptions:p,title:g,eyebrow:v,statusLabel:x,chromeSurface:b="shell",nodeLabels:_,defaultNodeLabels:S=!0,onNodeLabelsChange:M,stackProps:C,lanesProps:k,matrixProps:L,hiveProps:E,height:I,stackBelow:T=960,asideWidth:A=340,className:R,style:D}=U,O=Ie(U,["graph","nodes","edges","layering","graphOptions","views","viewLabels","view","defaultView","onViewChange","controls","followOptions","title","eyebrow","statusLabel","chromeSurface","nodeLabels","defaultNodeLabels","onNodeLabelsChange","stackProps","lanesProps","matrixProps","hiveProps","height","stackBelow","asideWidth","className","style"]);const F=j.useContext(vl),Y=e!=null?e:F,X=th(Y?{nodes:nv,edges:av,layering:QS,layout:!1}:ee($({},i),{nodes:t!=null?t:nv,edges:n!=null?n:av,layering:a!=null?a:QS})),ne=Y!=null?Y:X,q=$($({},_U),m),he=r.length>0?r:ix,[pe,H]=j.useState(u!=null?u:he[0]),te=c!=null?c:pe,ie=he.includes(te)?te:he[0],[W,ge]=j.useState(S),we=_!=null?_:W,je=j.useCallback(Be=>{_===void 0&&ge(Be),M==null||M(Be)},[_,M]),De=j.useRef(null),[re,Z]=j.useState(()=>{var at,ot,ft,it,kt,pt;const Be=(ot=(at=C==null?void 0:C.cameraPreset)!=null?at:C==null?void 0:C.defaultCameraPreset)!=null?ot:"stack";return{camera:$($({},qM(Be!=null?Be:"stack")),C==null?void 0:C.defaultCamera),preset:Be,gap:(it=(ft=C==null?void 0:C.layerGap)!=null?ft:C==null?void 0:C.defaultLayerGap)!=null?it:Cd[Be!=null?Be:"stack"].layerGap,turntable:(pt=(kt=C==null?void 0:C.turntable)!=null?kt:C==null?void 0:C.defaultTurntable)!=null?pt:!1}}),J=j.useCallback(Be=>{if(Be!==ie){if(ie==="stack"&&De.current){const at=ee($({},re),{camera:De.current.getCamera()});Z(at)}c===void 0&&H(Be),h==null||h(Be)}},[ie,c,h,re]),K=j.useRef(null),Q=j.useCallback(Be=>{K.current=Be,typeof B=="function"?B(Be):B&&(B.current=Be)},[B]),[ae,ye]=j.useState(!1);j.useLayoutEffect(()=>{const Be=K.current;if(!Be)return;const at=()=>{const ft=Be.getBoundingClientRect().width;ft>0&&ye(ft<T)};if(at(),typeof ResizeObserver>"u")return;const ot=new ResizeObserver(at);return ot.observe(Be),()=>ot.disconnect()},[T]);const Ae=I!==void 0;let de=null;ie==="stack"?de=f.jsx(YM,ee($({nodeLabels:we?"all":"reached"},C),{ref:De,graph:ne,cameraPreset:re.preset,defaultCamera:re.camera,defaultLayerGap:re.gap,turntable:re.turntable,onCameraPresetChange:Be=>{var at;Z(ot=>ee($({},ot),{preset:Be})),(at=C==null?void 0:C.onCameraPresetChange)==null||at.call(C,Be)},onTurntableChange:Be=>{var at;Z(ot=>ee($({},ot),{turntable:Be})),(at=C==null?void 0:C.onTurntableChange)==null||at.call(C,Be)},onLayerGapChange:Be=>{var at;Z(ot=>ee($({},ot),{gap:Be})),(at=C==null?void 0:C.onLayerGapChange)==null||at.call(C,Be)},onCameraChange:(Be,at)=>{var ot;Z(ft=>ee($({},ft),{camera:Be})),(ot=C==null?void 0:C.onCameraChange)==null||ot.call(C,Be,at)},className:Nc("layered-graph-explorer__stack",C==null?void 0:C.className)}),"stack"):ie==="lanes"?de=f.jsx(qp,ee($({nodes:t!=null?t:nv,edges:n!=null?n:av,fitView:!0,fitPadding:24},k),{layout:"layer-lanes",layeredGraph:ne,className:Nc("layered-graph-explorer__lanes",k==null?void 0:k.className),style:$({width:"100%",height:Ae&&!ae?"100%":wU},k==null?void 0:k.style)}),"lanes"):ie==="matrix"?de=f.jsx(PM,ee($({},L),{graph:ne}),"matrix"):de=f.jsx(HM,ee($({axisLabels:we?1:0},E),{graph:ne,className:Nc("layered-graph-explorer__hive",E==null?void 0:E.className)}),"hive");const Je=q.viewSwitcher&&he.length>1,Ge=Je||q.follow,be=Ge||g!=null||v!=null,Fe=ie==="stack"||ie==="hive",me=ie==="stack"&&(q.camera||q.planeLayout),Ee=q.layers||q.layerPairs||q.bridgeNodes,se=Ee?f.jsxs(f.Fragment,{children:[q.layers&&f.jsx(XM,{}),q.layerPairs&&f.jsx(ZM,{}),q.bridgeNodes&&f.jsx(JM,{})]}):null,le=q.inspector||Ee,{index:xe}=ne,Pe=j.useMemo(()=>xe.links.filter(Be=>Be.cross).length,[xe]),$e=[`${xe.nodes.length} nodes · ${xe.links.length} links · ${Pe} cross-layer · ${xe.layers.length} layers`,`${ej[ie].toLowerCase()} · follow ${Yp(ne.follow).toLowerCase()}`];return f.jsx(vl.Provider,{value:ne,children:f.jsxs("div",ee($({ref:Q,className:Nc("layered-graph-explorer",`layered-graph-explorer--${ie}`,Ae&&"layered-graph-explorer--fixed",ae&&"layered-graph-explorer--narrow",b==="shell"&&"layered-graph-explorer--shell-chrome",R),style:$({height:I,"--layered-explorer-aside":`${A}px`},D),"data-view":ie},O),{children:[be&&f.jsxs("header",{className:"layered-graph-explorer__header",children:[(g!=null||v!=null)&&f.jsxs("div",{className:"layered-graph-explorer__heading",children:[v!=null&&f.jsx("span",{className:"layered-control__eyebrow",children:v}),g!=null&&f.jsx("h2",{className:"layered-graph-explorer__title",children:g})]}),Ge&&f.jsxs("div",{className:"layered-graph-explorer__header-controls",children:[Je&&f.jsx(tj,{views:he,value:ie,onChange:J,viewLabels:l}),q.follow&&f.jsx(GM,{options:p})]})]}),f.jsxs("div",{className:"layered-graph-explorer__body",children:[f.jsxs("div",{className:"layered-graph-explorer__main",children:[me&&f.jsxs("div",{className:"layered-graph-explorer__tools",children:[q.camera&&f.jsx(nj,{stack:De,preset:re.preset,turntable:re.turntable,onTurntableChange:Be=>Z(at=>ee($({},at),{turntable:Be}))}),q.planeLayout&&f.jsx(KM,{className:"layered-graph-explorer__plane-layout"})]}),f.jsx("div",{className:`layered-graph-explorer__scene layered-graph-explorer__scene--${ie}`,children:de}),q.linkFilter&&f.jsx(QM,{className:"layered-graph-explorer__link-bar",showLabelToggle:q.nodeLabels&&Fe,nodeLabels:we,onNodeLabelsChange:je,children:q.predicateLabels&&f.jsx(ax,{})}),!q.linkFilter&&q.predicateLabels&&f.jsx("div",{className:"layered-graph-explorer__link-bar",children:f.jsx(ax,{})})]}),le&&f.jsx("aside",{className:"layered-graph-explorer__aside","aria-label":"Inspector",children:q.inspector?f.jsx(WM,{empty:se!=null?se:void 0}):se})]}),q.status&&f.jsxs("footer",{className:"layered-graph-explorer__status",role:"status","aria-live":"off",children:[x!=null&&f.jsx("span",{children:x}),$e.map(Be=>f.jsx("span",{children:Be},Be)),ie==="stack"&&f.jsx("span",{className:"layered-graph-explorer__status-camera",children:SU(re.camera,re.preset,re.gap)})]})]}))})});NU.displayName="LayeredGraphExplorer";const kU=360,CU=260,MU=640,aj=Se.forwardRef((h,u)=>{var m=h,{open:e,width:t=kU,onWidthChange:n,minWidth:a=CU,maxWidth:i=MU,children:r,className:l=""}=m,c=Ie(m,["open","width","onWidthChange","minWidth","maxWidth","children","className"]);const[p,g]=j.useState(t),[v,x]=j.useState(!1),b=!!n,_=b?p:t,S=j.useRef(null),M=j.useCallback(A=>R=>{A.forEach(D=>{typeof D=="function"?D(R):D&&(D.current=R)})},[]);j.useEffect(()=>{S.current&&(S.current.inert=!e)},[e]);const C=j.useRef(null),k=j.useRef(null),L=j.useCallback(A=>{const R=C.current;if(!R)return;const D=Math.min(i,Math.max(a,R.startWidth-(A.clientX-R.startX)));g(D),n==null||n(D)},[a,i,n]),E=j.useCallback(()=>{C.current=null,x(!1);const A=k.current;A&&(document.removeEventListener("mousemove",A.move),document.removeEventListener("mouseup",A.up),k.current=null)},[]),I=j.useCallback(A=>{A.preventDefault(),C.current={startX:A.clientX,startWidth:_},x(!0),k.current={move:L,up:E},document.addEventListener("mousemove",L),document.addEventListener("mouseup",E)},[_,L,E]);j.useEffect(()=>()=>{const A=k.current;A&&(document.removeEventListener("mousemove",A.move),document.removeEventListener("mouseup",A.up))},[]);const T=j.useCallback(A=>{const R=A.shiftKey?40:10;if(A.key==="ArrowLeft"){A.preventDefault();const D=Math.min(i,_+R);g(D),n==null||n(D)}else if(A.key==="ArrowRight"){A.preventDefault();const D=Math.max(a,_-R);g(D),n==null||n(D)}},[_,a,i,n]);return f.jsxs("div",ee($({ref:M([S,u]),className:["detail-drawer",e&&"detail-drawer--open",l].filter(Boolean).join(" "),style:{width:e?_:0},"aria-hidden":!e},c),{children:[b&&f.jsx("div",{className:["detail-drawer__resize-handle",v&&"detail-drawer__resize-handle--active"].filter(Boolean).join(" "),role:"separator","aria-orientation":"vertical","aria-label":"Resize detail panel","aria-valuenow":Math.round(_),"aria-valuemin":a,"aria-valuemax":i,tabIndex:e?0:-1,onMouseDown:I,onKeyDown:T}),f.jsx("div",{className:"detail-drawer__content",style:{width:_},children:r})]}))});aj.displayName="DetailDrawer";const Fd=Se.forwardRef((c,l)=>{var u=c,{node:e,relationships:t=[],onNodeSelect:n,emptyStateText:a="Select a node to inspect.",className:i=""}=u,r=Ie(u,["node","relationships","onNodeSelect","emptyStateText","className"]);const h=["graph-inspector",i].filter(Boolean).join(" ");if(!e)return f.jsx("div",ee($({ref:l,className:h},r),{children:f.jsx("div",{className:"graph-inspector__empty","data-testid":"inspector-empty",children:a})}));const m=t.filter(g=>g.direction==="out"),p=t.filter(g=>g.direction==="in");return f.jsxs("div",ee($({ref:l,className:h},r),{children:[f.jsxs("div",{className:"graph-inspector__head",children:[f.jsxs("div",{className:"graph-inspector__head-eyebrow",children:[e.kind&&f.jsx("span",{className:"graph-inspector__badge",children:e.kind}),e.domain&&f.jsx("span",{className:`graph-inspector__badge graph-inspector__badge--${e.domain}`,children:e.domain})]}),f.jsx("div",{className:"graph-inspector__title","data-testid":"inspector-title",children:e.title}),f.jsx("div",{className:"graph-inspector__id","data-testid":"inspector-id",children:e.id})]}),f.jsxs("div",{className:"graph-inspector__body",children:[e.description&&f.jsx("p",{className:"graph-inspector__description","data-testid":"inspector-description",children:e.description}),e.metadata&&Object.keys(e.metadata).length>0&&f.jsx("dl",{className:"graph-inspector__kv","data-testid":"inspector-metadata",children:Object.entries(e.metadata).map(([g,v])=>f.jsxs(Se.Fragment,{children:[f.jsx("dt",{children:g}),f.jsx("dd",{children:String(v)})]},g))}),m.length>0&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"graph-inspector__section-label",children:["Outgoing · ",m.length]}),f.jsx("ul",{className:"graph-inspector__rels","data-testid":"inspector-outgoing",children:m.map(g=>f.jsxs("li",{className:"graph-inspector__rel",children:[f.jsx("span",{className:"graph-inspector__rel-dir graph-inspector__rel-dir--out",children:"→"}),f.jsx("span",{className:"graph-inspector__rel-pred",children:g.predicate}),f.jsxs("button",{type:"button",className:"graph-inspector__rel-target","data-domain":g.targetDomain,onClick:()=>n==null?void 0:n(g.target),"aria-label":`Navigate to ${g.targetTitle}${g.layer?`, ${g.layer.label} layer`:""}`,"data-testid":`inspector-rel-${g.id}`,children:[f.jsx("span",{className:"graph-inspector__rel-swatch",style:g.layer?{background:g.layer.color}:void 0}),f.jsx("span",{children:g.targetTitle})]}),g.hop!==void 0&&g.hop>1&&f.jsxs("span",{className:"graph-inspector__rel-hop",children:["+",g.hop-1]}),g.via&&f.jsxs("span",{className:"graph-inspector__rel-via",children:["via ",g.via.title," · ",g.via.predicate]})]},g.id))})]}),p.length>0&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"graph-inspector__section-label",children:["Incoming · ",p.length]}),f.jsx("ul",{className:"graph-inspector__rels","data-testid":"inspector-incoming",children:p.map(g=>f.jsxs("li",{className:"graph-inspector__rel",children:[f.jsx("span",{className:"graph-inspector__rel-dir graph-inspector__rel-dir--in",children:"←"}),f.jsx("span",{className:"graph-inspector__rel-pred",children:g.predicate}),f.jsxs("button",{type:"button",className:"graph-inspector__rel-target","data-domain":g.targetDomain,onClick:()=>n==null?void 0:n(g.target),"aria-label":`Navigate to ${g.targetTitle}${g.layer?`, ${g.layer.label} layer`:""}`,"data-testid":`inspector-rel-${g.id}`,children:[f.jsx("span",{className:"graph-inspector__rel-swatch",style:g.layer?{background:g.layer.color}:void 0}),f.jsx("span",{children:g.targetTitle})]}),g.hop!==void 0&&g.hop>1&&f.jsxs("span",{className:"graph-inspector__rel-hop",children:["+",g.hop-1]}),g.via&&f.jsxs("span",{className:"graph-inspector__rel-via",children:["via ",g.via.title," · ",g.via.predicate]})]},g.id))})]}),t.length===0&&f.jsx("div",{className:"graph-inspector__empty-mini",children:"No relationships yet."})]})]}))});Fd.displayName="GraphInspector";const sj=Se.forwardRef((l,r)=>{var c=l,{edge:e,onNodeSelect:t,emptyStateText:n="Select an edge to inspect.",className:a=""}=c,i=Ie(c,["edge","onNodeSelect","emptyStateText","className"]);const u=["graph-edge-inspector",a].filter(Boolean).join(" ");if(!e)return f.jsx("div",ee($({ref:r,className:u},i),{children:f.jsx("div",{className:"graph-edge-inspector__empty","data-testid":"edge-inspector-empty",children:n})}));const h=e.metadata?Object.entries(e.metadata):[],m=(p,g,v,x)=>{const b=f.jsx("span",{className:"graph-edge-inspector__endpoint-swatch"});return t?f.jsxs("button",{type:"button",className:"graph-edge-inspector__endpoint graph-edge-inspector__endpoint--button","data-domain":v,onClick:()=>t(p),"aria-label":`Inspect ${g}`,"data-testid":x,children:[b,f.jsx("span",{children:g})]}):f.jsxs("span",{className:"graph-edge-inspector__endpoint","data-domain":v,"data-testid":x,children:[b,f.jsx("span",{children:g})]})};return f.jsxs("div",ee($({ref:r,className:u},i),{children:[f.jsxs("div",{className:"graph-edge-inspector__head",children:[f.jsx("div",{className:"graph-edge-inspector__head-eyebrow",children:e.variant&&e.variant!=="default"&&f.jsx("span",{className:`graph-edge-inspector__badge graph-edge-inspector__badge--${e.variant}`,children:e.variant})}),f.jsx("div",{className:"graph-edge-inspector__title","data-testid":"edge-inspector-title",children:e.predicate}),f.jsx("div",{className:"graph-edge-inspector__id","data-testid":"edge-inspector-id",children:e.id})]}),f.jsxs("div",{className:"graph-edge-inspector__body",children:[f.jsxs("div",{className:"graph-edge-inspector__endpoints","data-testid":"edge-inspector-endpoints",children:[m(e.sourceId,e.sourceTitle,e.sourceDomain,"edge-inspector-source"),f.jsx(nt,{name:"arrowRight",size:14,className:"graph-edge-inspector__arrow"}),m(e.targetId,e.targetTitle,e.targetDomain,"edge-inspector-target")]}),(e.weight!==void 0||h.length>0)&&f.jsxs("dl",{className:"graph-edge-inspector__kv","data-testid":"edge-inspector-metadata",children:[e.weight!==void 0&&f.jsxs(Se.Fragment,{children:[f.jsx("dt",{children:"weight"}),f.jsx("dd",{children:e.weight})]}),h.map(([p,g])=>f.jsxs(Se.Fragment,{children:[f.jsx("dt",{children:p}),f.jsx("dd",{children:String(g)})]},p))]})]})]}))});sj.displayName="GraphEdgeInspector";const jU={ok:"rgb(var(--status-emerald))",warning:"rgb(var(--status-amber))",error:"rgb(var(--status-rose))",idle:"rgb(var(--status-neutral))"},EU=Se.forwardRef((g,p)=>{var v=g,{title:e,nodeRole:t="",status:n="idle",metrics:a=[],selected:i=!1,x:r,y:l,onSelect:c,className:u="",style:h}=v,m=Ie(v,["title","nodeRole","status","metrics","selected","x","y","onSelect","className","style"]);const x=["topology-node",`topology-node--${n}`,i?"topology-node--selected":"",c?"topology-node--interactive":"",u].filter(Boolean).join(" "),b=$($({},r!==void 0&&l!==void 0?{position:"absolute",left:`${r}px`,top:`${l}px`}:{}),h),_=e.replace(/\s+/g,"-").toLowerCase(),S=M=>{c&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),c())};return f.jsxs("div",ee($({ref:p,className:x,style:b,"data-testid":`topology-node-${_}`,onClick:c,onKeyDown:S,tabIndex:c?0:void 0,"aria-selected":i,role:c?"button":void 0},m),{children:[f.jsxs("div",{className:"topology-node__head",children:[f.jsx("div",{className:"topology-node__title",children:e}),f.jsx("div",{className:"topology-node__status-dot",style:{backgroundColor:jU[n]},"data-testid":`topology-status-${_}`,"aria-label":`Status: ${n}`})]}),f.jsx("div",{className:"topology-node__role","data-testid":`topology-role-${_}`,children:t}),a.length>0&&f.jsx("div",{className:"topology-node__metrics","data-testid":`topology-metrics-${_}`,children:a.map((M,C)=>f.jsxs("div",{className:"topology-node__metric-row",children:[f.jsx("div",{className:"topology-node__metric-label",children:M.label}),f.jsxs("div",{className:"topology-node__metric-value",children:[M.value,M.unit&&f.jsx("span",{className:"topology-node__metric-unit",children:M.unit})]}),f.jsx("div",{className:"topology-node__metric-bar",children:f.jsx("div",{className:"topology-node__metric-fill",style:{width:`${Number.isFinite(M.percent)?Math.max(0,Math.min(100,M.percent)):0}%`,backgroundColor:M.color?`rgb(var(--status-${M.color}))`:"rgb(var(--accent-primary))"}})})]},C))})]}))});EU.displayName="TopologyNode";const ZS={life:"var(--dom-life)",climate:"var(--dom-climate)",software:"var(--dom-software)",default:"var(--dom-default)"},RU=Se.forwardRef((g,p)=>{var v=g,{depth:e=0,domain:t,kind:n,label:a,meta:i,description:r,selected:l=!1,onSelect:c,showKind:u=!0,className:h=""}=v,m=Ie(v,["depth","domain","kind","label","meta","description","selected","onSelect","showKind","className"]);const x=ZS[t]||ZS.default,b=["hierarchy-row",l&&"selected",c&&"interactive",h].filter(Boolean).join(" "),_=Se.useCallback(S=>{(S.key==="Enter"||S.key===" ")&&c&&(S.preventDefault(),c())},[c]);return f.jsxs("div",ee($({ref:p,className:b,role:c?"button":void 0,tabIndex:c?0:void 0,"aria-pressed":c?l:void 0,onClick:c,onKeyDown:c?_:void 0,style:{"--hierarchy-depth":e,"--domain-color":x}},m),{children:[f.jsxs("div",{className:"hierarchy-row__left",children:[e>0&&f.jsx("div",{className:"hierarchy-row__connector"}),f.jsxs("div",{className:"hierarchy-row__pill",children:[f.jsx("div",{className:"hierarchy-row__swatch"}),u&&f.jsx("span",{className:"hierarchy-row__kind",children:n}),f.jsx("span",{className:"hierarchy-row__label",children:a}),i&&f.jsx("span",{className:"hierarchy-row__meta",children:i})]})]}),r&&f.jsx("div",{className:"hierarchy-row__right",children:f.jsx("span",{className:"hierarchy-row__description",children:r})})]}))});RU.displayName="HierarchyRow";const LU=Se.forwardRef((i,a)=>{var r=i,{className:e="",children:t}=r,n=Ie(r,["className","children"]);const l=["hierarchy-tree",e].filter(Boolean).join(" ");return f.jsx("div",ee($({ref:a,className:l},n),{children:t}))});LU.displayName="HierarchyTree";const TU=Se.forwardRef((l,r)=>{var c=l,{nodes:e,wrap:t=!1,className:n="","aria-label":a}=c,i=Ie(c,["nodes","wrap","className","aria-label"]);if(e.length===0)return null;const u=["lineage-rail",t&&"lineage-rail--wrap",n].filter(Boolean).join(" "),h=a||`Lineage: ${e.map(m=>m.label).join(" → ")}`;return f.jsx("div",ee($({ref:r,className:u,role:"list","aria-label":h},i),{children:e.map((m,p)=>{const g=p===0;return f.jsxs(Se.Fragment,{children:[p>0&&f.jsx("span",{className:"lineage-rail__arrow","aria-hidden":"true",children:"→"}),f.jsx(AU,{node:m,isHead:g})]},`${m.label}-${p}`)})}))});TU.displayName="LineageRail";const AU=({node:e,isHead:t})=>{const n=["lineage-rail__node",e.onClick&&"lineage-rail__node--interactive",t&&"lineage-rail__node--head"].filter(Boolean).join(" "),a=i=>{(i.key==="Enter"||i.key===" ")&&e.onClick&&(i.preventDefault(),e.onClick())};return f.jsxs(fs,{className:n,role:"listitem","aria-current":t?"step":void 0,onClick:e.onClick,onKeyDown:e.onClick?a:void 0,tabIndex:e.onClick?0:void 0,children:[e.icon&&f.jsx(nt,{name:e.icon,size:14}),f.jsx("span",{className:"lineage-rail__label",children:e.label})]})},IU=Se.forwardRef((h,u)=>{var m=h,{thumb:e,title:t,subtitle:n,meta:a,badge:i,selected:r=!1,className:l=""}=m,c=Ie(m,["thumb","title","subtitle","meta","badge","selected","className"]);const[p,g]=Se.useState(!1),[v,x]=Se.useState(!1);Se.useEffect(()=>{g(!1),x(!1)},[e.kind==="image"?e.src:null]);const b=["asset-card",r&&"asset-card--selected",l].filter(Boolean).join(" ");return f.jsxs("div",ee($({ref:u,className:b,"aria-selected":r},c),{children:[f.jsxs("div",{className:"asset-card__thumb-wrapper",children:[(()=>{if(e.kind==="doc")return f.jsxs("div",{className:"asset-card__thumb asset-card__thumb--doc",children:[f.jsx("div",{className:"asset-card__doc-page"}),f.jsx("div",{className:`asset-card__doc-tab asset-card__doc-tab--${e.ext.toLowerCase()}`,children:e.ext.toUpperCase()})]});if(e.kind==="cover")return f.jsx("div",{className:"asset-card__thumb asset-card__thumb--cover",style:{"--cover-gradient":e.gradient},children:f.jsx(nt,{name:e.glyph,size:32,className:"asset-card__cover-glyph"})});if(e.kind==="image")return(p||!v&&!e.src)&&e.fallbackGlyph?f.jsx("div",{className:"asset-card__thumb asset-card__thumb--image-fallback",children:f.jsx(nt,{name:e.fallbackGlyph,size:32,className:"asset-card__image-glyph"})}):f.jsx("div",{className:"asset-card__thumb asset-card__thumb--image",children:f.jsx("img",{src:e.src,alt:"",className:"asset-card__image",onLoad:()=>x(!0),onError:()=>g(!0),"aria-hidden":"true"})})})(),i&&f.jsx("div",{className:"asset-card__badge",children:i})]}),f.jsxs("div",{className:"asset-card__body",children:[f.jsx("div",{className:"asset-card__title",children:t}),n&&f.jsx("div",{className:"asset-card__subtitle",children:n}),a&&f.jsx("div",{className:"asset-card__meta",children:a})]})]}))});IU.displayName="AssetCard";const DU=Se.forwardRef((l,r)=>{var c=l,{columns:e=3,gap:t=14,className:n="",children:a}=c,i=Ie(c,["columns","gap","className","children"]);const u=["asset-grid",n].filter(Boolean).join(" ");return f.jsx("div",ee($({ref:r,className:u,style:{"--asset-columns":e,"--asset-gap":`${t}px`}},i),{children:a}))});DU.displayName="AssetGrid";const L0=(e,t=[])=>t.filter(n=>{const a=typeof n.startDate=="string"?new Date(n.startDate):new Date(n.startDate);return Vc(e,a)}),OU=({focusedDate:e,selectedDate:t,grid:n,events:a,calendarColors:i,weekStartsOn:r,onSelectDate:l,onSelectEvent:c,renderEvent:u,onKeyDown:h})=>{const m=typeof e=="string"?new Date(e):e,p=t?typeof t=="string"?new Date(t):t:null;let g=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return r===1&&(g=g.slice(1).concat(g.slice(0,1))),f.jsxs("div",{className:"calendar-month",role:"grid",onKeyDown:h,tabIndex:0,children:[f.jsx("div",{className:"calendar-month__header",role:"row",children:g.map(v=>f.jsx("div",{className:"calendar-month__weekday",role:"columnheader",children:v.slice(0,3).toUpperCase()},v))}),n.map((v,x)=>f.jsx("div",{className:"calendar-month__week",role:"row",children:v.map((b,_)=>{const S=b.getMonth()!==m.getMonth(),M=Vc(b,m),C=p?Vc(b,p):!1,k=zk(b),L=L0(b,a),E=3,I=L.length-E;return f.jsxs("div",{className:`calendar-month__cell ${S?"calendar-month__cell--out-of-month":""} ${M?"calendar-month__cell--focused":""} ${C?"calendar-month__cell--selected":""}`,role:"gridcell",onClick:()=>!S&&(l==null?void 0:l(b)),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),!S&&(l==null||l(b)))},children:[f.jsx("div",{className:"calendar-month__date-number","aria-current":k?"date":void 0,children:k?f.jsx(fs,{variant:"amber",form:"default",children:b.getDate()}):f.jsx("span",{children:b.getDate()})}),f.jsxs("div",{className:"calendar-month__events",children:[L.slice(0,E).map(T=>{const A=(i==null?void 0:i[T.calendarId])||"rgb(var(--status-cyan))";return f.jsx("div",{className:"calendar-month__event-bar",style:{borderLeftColor:A},onClick:R=>{R.stopPropagation(),c==null||c(T.id)},role:"button",tabIndex:0,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),R.stopPropagation(),c==null||c(T.id))},children:u?u(T,A):f.jsx("span",{className:"calendar-month__event-title",children:T.title||"Event"})},T.id)}),I>0&&f.jsxs("div",{className:"calendar-month__event-overflow",children:["+",I," more"]})]})]},`${x}-${_}`)})},x))]})},zU=({focusedDate:e,weekStartsOn:t,events:n,calendarColors:a,onSelectDate:i,onSelectEvent:r,renderEvent:l})=>{const c=Yc(e,t);return f.jsx("div",{className:"calendar-week",children:f.jsx("div",{className:"calendar-week__days",children:c.map(u=>{const h=L0(u,n);return f.jsxs("div",{className:"calendar-week__day",role:"button",tabIndex:0,onClick:()=>i==null?void 0:i(u),onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),i==null||i(u))},children:[f.jsx("div",{className:"calendar-week__header",children:u.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}),f.jsx("div",{className:"calendar-week__events",children:h.map(m=>{const p=(a==null?void 0:a[m.calendarId])||"rgb(var(--status-cyan))";return f.jsx("div",{className:"calendar-week__event",style:{borderLeftColor:p},role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),r==null||r(m.id)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),r==null||r(m.id))},children:l?l(m,p):f.jsx("span",{children:m.title||"Event"})},m.id)})})]},u.toISOString())})})})},BU=({focusedDate:e,events:t,calendarColors:n,onSelectEvent:a,renderEvent:i})=>{const r=L0(e,t);return f.jsxs("div",{className:"calendar-day",children:[f.jsx("div",{className:"calendar-day__title",children:typeof e=="string"?new Date(e).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"}):e.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"})}),f.jsx("div",{className:"calendar-day__events",children:r.length===0?f.jsx("div",{className:"calendar-day__empty",children:"No events scheduled"}):r.map(l=>{const c=(n==null?void 0:n[l.calendarId])||"rgb(var(--status-cyan))";return f.jsx("div",{className:"calendar-day__event",style:{borderLeftColor:c},role:"button",tabIndex:0,onClick:()=>a==null?void 0:a(l.id),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a==null||a(l.id))},children:i?i(l,c):f.jsx("span",{children:l.title||"Event"})},l.id)})})]})},$U=({focusedDate:e,events:t=[],calendarColors:n,onSelectEvent:a,renderEvent:i})=>{const r=typeof e=="string"?new Date(e):e,l=t.filter(c=>(typeof c.startDate=="string"?new Date(c.startDate):new Date(c.startDate))>=r).sort((c,u)=>{const h=typeof c.startDate=="string"?new Date(c.startDate):new Date(c.startDate),m=typeof u.startDate=="string"?new Date(u.startDate):new Date(u.startDate);return h.getTime()-m.getTime()});return f.jsx("div",{className:"calendar-agenda",children:l.length===0?f.jsx("div",{className:"calendar-agenda__empty",children:"No upcoming events"}):f.jsx("div",{className:"calendar-agenda__list",children:l.map(c=>{const u=(n==null?void 0:n[c.calendarId])||"rgb(var(--status-cyan))";return f.jsxs("div",{className:"calendar-agenda__item",role:"button",tabIndex:0,onClick:()=>a==null?void 0:a(c.id),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),a==null||a(c.id))},children:[f.jsx("div",{className:"calendar-agenda__date",style:{color:u},children:typeof c.startDate=="string"?new Date(c.startDate).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}):c.startDate.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}),f.jsx("div",{className:"calendar-agenda__content",children:i?i(c,u):f.jsx("span",{children:c.title||"Event"})})]},c.id)})})})},UU=Se.forwardRef((x,v)=>{var b=x,{view:e,focusedDate:t,selectedDate:n,events:a,calendarColors:i,weekStartsOn:r=0,onChangeView:l,onNavigate:c,onSelectDate:u,onSelectEvent:h,renderEvent:m,className:p=""}=b,g=Ie(b,["view","focusedDate","selectedDate","events","calendarColors","weekStartsOn","onChangeView","onNavigate","onSelectDate","onSelectEvent","renderEvent","className"]);const _=typeof t=="string"?new Date(t):t,S=j.useMemo(()=>Bk(_,r),[_.getTime(),r]),M=[{value:"month",label:"Month"},{value:"week",label:"Week"},{value:"day",label:"Day"},{value:"agenda",label:"Agenda"}],C=j.useCallback(I=>{if(e!=="month")return;const T=new Date(_);if(I.key==="ArrowLeft"||I.key==="ArrowRight"||I.key==="ArrowUp"||I.key==="ArrowDown"){I.preventDefault();const A=I.key==="ArrowLeft"?-1:I.key==="ArrowRight"?1:I.key==="ArrowUp"?-7:7;T.setDate(T.getDate()+A),c==null||c(T)}else if(I.key==="PageUp")I.preventDefault(),T.setMonth(T.getMonth()-1),c==null||c(T);else if(I.key==="PageDown")I.preventDefault(),T.setMonth(T.getMonth()+1),c==null||c(T);else if(I.key==="Home"){I.preventDefault();const A=Yc(T,r);c==null||c(A[0])}else if(I.key==="End"){I.preventDefault();const A=Yc(T,r);c==null||c(A[6])}},[_.getTime(),c,e,r]),k=j.useCallback(()=>{const I=new Date(_);e==="month"?I.setMonth(I.getMonth()-1):e==="week"?I.setDate(I.getDate()-7):(e==="day"||e==="agenda")&&I.setDate(I.getDate()-1),c==null||c(I)},[_.getTime(),c,e]),L=j.useCallback(()=>{const I=new Date(_);e==="month"?I.setMonth(I.getMonth()+1):e==="week"?I.setDate(I.getDate()+7):(e==="day"||e==="agenda")&&I.setDate(I.getDate()+1),c==null||c(I)},[_.getTime(),c,e]),E=j.useCallback(()=>{c==null||c(new Date)},[c]);return f.jsxs("div",ee($({ref:v,className:`calendar ${p}`.trim()},g),{children:[f.jsxs("div",{className:"calendar__header",children:[f.jsxs("div",{className:"calendar__title",children:[e==="month"&&aI(_),e==="week"&&sI(_,r),e==="day"&&Rv(_),e==="agenda"&&"Agenda"]}),f.jsxs("div",{className:"calendar__controls",children:[f.jsx(Bn,{variant:"secondary",size:"sm",onClick:k,"aria-label":"Previous",children:f.jsx(nt,{name:"chevronLeft",size:16})}),f.jsx(Bn,{variant:"secondary",size:"sm",onClick:E,children:"Today"}),f.jsx(Bn,{variant:"secondary",size:"sm",onClick:L,"aria-label":"Next",children:f.jsx(nt,{name:"chevronRight",size:16})})]})]}),f.jsx("div",{className:"calendar__view-selector",children:f.jsx(ps,{value:e,onChange:I=>l==null?void 0:l(I),options:M})}),f.jsxs("div",{className:"calendar__content",children:[e==="month"&&f.jsx(OU,{focusedDate:_,selectedDate:n,grid:S,events:a,calendarColors:i,weekStartsOn:r,onSelectDate:u,onSelectEvent:h,renderEvent:m,onKeyDown:C}),e==="week"&&f.jsx(zU,{focusedDate:_,weekStartsOn:r,events:a,calendarColors:i,onSelectDate:u,onSelectEvent:h,renderEvent:m}),e==="day"&&f.jsx(BU,{focusedDate:_,events:a,calendarColors:i,onSelectEvent:h,renderEvent:m}),e==="agenda"&&f.jsx($U,{focusedDate:_,events:a,calendarColors:i,onSelectEvent:h,renderEvent:m})]})]}))});UU.displayName="Calendar";const FU=({card:e,isSelected:t,renderCard:n,onSelect:a,onCardPointerDown:i,onCardKeyDown:r})=>n?f.jsx("div",{className:`kanban-card ${t?"kanban-card--selected":""}`,onPointerDown:l=>i(l,e.id),onKeyDown:l=>r(l,e.id),onClick:()=>a(e.id),tabIndex:0,role:"button","aria-pressed":t,children:n(e,t)}):f.jsxs("div",{className:`kanban-card ${t?"kanban-card--selected":""} ${e.done?"kanban-card--done":""}`,onPointerDown:l=>i(l,e.id),onKeyDown:l=>r(l,e.id),onClick:()=>a(e.id),tabIndex:0,role:"button","aria-pressed":t,children:[e.context&&f.jsx("div",{className:"kanban-card__context",children:e.context}),f.jsx("div",{className:"kanban-card__title",children:e.title}),e.version&&f.jsx("div",{className:"kanban-card__version",children:f.jsx(Es,{children:e.version})}),(e.dueDate||e.badges)&&f.jsxs("div",{className:"kanban-card__meta",children:[e.dueDate&&f.jsx("div",{className:"kanban-card__due-date",children:e.dueDate}),e.badges&&e.badges.length>0&&f.jsx("div",{className:"kanban-card__badges",children:e.badges.map(l=>f.jsx("span",{className:"kanban-card__badge",children:l},l))})]}),e.blocked&&f.jsxs("div",{className:"kanban-card__blocked",children:[f.jsx(nt,{name:"alert",size:16}),e.blocked]})]}),PU=({column:e,cards:t,selectedId:n,onSelectCard:a,renderCard:i,draggedCardId:r,insertionIndex:l,onCardPointerDown:c,onCardKeyDown:u})=>{const h=j.useRef(null),m=e.wipLimit&&t.length>e.wipLimit;return f.jsxs(Rk,{className:"kanban-column",noPadding:!0,children:[f.jsxs("div",{className:"kanban-column__header",children:[f.jsxs("div",{className:"kanban-column__header-left",children:[e.statusColor&&f.jsx("div",{className:"kanban-column__status-dot",style:{backgroundColor:Td[e.statusColor]}}),f.jsx("div",{className:"kanban-column__title",children:e.title})]}),f.jsxs("div",{className:"kanban-column__header-right",children:[f.jsx(fs,{variant:"neutral",children:t.length}),m&&f.jsx("div",{className:"kanban-column__wip-warning",title:`Over WIP limit of ${e.wipLimit}`,children:f.jsx(nt,{name:"alert",size:14})})]})]}),f.jsxs("div",{ref:h,className:"kanban-column__body",children:[t.length===0?f.jsx("div",{className:"kanban-column__empty",children:"Drop cards here"}):t.map((p,g)=>f.jsxs(Se.Fragment,{children:[r&&l===g&&f.jsx("div",{className:"kanban-column__insertion-line"}),f.jsx(FU,{card:p,isSelected:n===p.id,renderCard:i,onSelect:v=>a==null?void 0:a(v),onCardPointerDown:c,onCardKeyDown:u})]},p.id)),r&&l===t.length&&f.jsx("div",{className:"kanban-column__insertion-line"})]})]})},HU=Se.forwardRef((h,u)=>{var m=h,{columns:e,cards:t,selectedId:n,onSelectCard:a,onMoveCard:i,renderCard:r,className:l=""}=m,c=Ie(m,["columns","cards","selectedId","onSelectCard","onMoveCard","renderCard","className"]);const p=j.useRef(null),[g,v]=j.useState(null),[x,b]=j.useState(null),[_,S]=j.useState(null),M=j.useRef(null),C=j.useRef(null),k=j.useMemo(()=>{const R={};return e.forEach(D=>{R[D.id]=t.filter(O=>O.columnId===D.id)}),R},[e,t]),L=j.useCallback((R,D,O)=>{M.current&&(M.current.textContent=`Card "${R}" moved to ${D} at position ${O+1}`)},[]),E=j.useCallback((R,D)=>{const O=t.find(z=>z.id===D);if(!O)return;const B=R.currentTarget;B.setPointerCapture(R.pointerId),p.current={cardId:D,sourceColumnId:O.columnId,sourceIndex:k[O.columnId].findIndex(z=>z.id===D),offsetY:R.clientY,pointerId:R.pointerId,capturingElement:B},v(D),S(O.columnId)},[t,k]),I=j.useCallback(R=>{var D;if(!p.current||!((D=C.current)!=null&&D.getBoundingClientRect()))return;let O=null;for(const X of e){const ne=document.querySelector(`[data-column-id="${CSS.escape(X.id)}"]`);if(ne){const q=ne.getBoundingClientRect();if(R.clientX>=q.left&&R.clientX<q.right){O=X,S(X.id);break}}}if(!O)return;const B=document.querySelector(`[data-column-id="${CSS.escape(O.id)}"] .kanban-column__body`);if(!B)return;const z=B.getBoundingClientRect(),U=R.clientY-z.top,F=B.querySelectorAll(".kanban-card");let Y=0;for(let X=0;X<F.length;X++){const ne=F[X].getBoundingClientRect(),q=ne.top-z.top;if(U<q+ne.height/2){Y=X;break}else Y=X+1}b(Y)},[e]),T=j.useCallback(R=>{if(!p.current)return;const D=p.current;if(p.current=null,_&&x!==null){const O=e.find(z=>z.id===D.sourceColumnId),B=e.find(z=>z.id===_);if(B&&O){const z=t.find(U=>U.id===D.cardId);if(z){const U=_===D.sourceColumnId&&x>D.sourceIndex?x-1:x;i(D.cardId,_,U),L(z.title,B.title,U)}}}if(v(null),b(null),S(null),D.capturingElement&&D.pointerId!==void 0)try{D.capturingElement.releasePointerCapture(D.pointerId)}catch(O){}},[e,t,_,x,i,L]),A=j.useCallback((R,D)=>{var O,B;const z=t.find(U=>U.id===D);if(z){if(R.key===" "){R.preventDefault();const U=p.current;if(U!=null&&U.isKeyboardGrab){i(U.cardId,U.sourceColumnId,U.sourceIndex);const F=e.find(Y=>Y.id===U.sourceColumnId);L(z.title,(F==null?void 0:F.title)||"",U.sourceIndex),p.current=null,v(null),b(null),S(null)}else{const F=k[z.columnId].findIndex(Y=>Y.id===D);p.current={cardId:D,sourceColumnId:z.columnId,sourceIndex:F,offsetY:0,isKeyboardGrab:!0,originalColumnId:z.columnId,originalIndex:F},v(D),S(z.columnId)}}else if(R.key==="ArrowUp"||R.key==="ArrowDown"||R.key==="ArrowLeft"||R.key==="ArrowRight"){R.preventDefault();const U=p.current;if(!U||!U.isKeyboardGrab)return;const F=e.findIndex(he=>he.id===U.sourceColumnId),Y=k[U.sourceColumnId];if(!Y){p.current=null,v(null),b(null),S(null);return}const X=U.sourceIndex;let ne=U.sourceColumnId,q=X;R.key==="ArrowUp"&&X>0?q=X-1:R.key==="ArrowDown"&&X<Y.length-1?q=X+1:R.key==="ArrowLeft"&&F>0?(ne=e[F-1].id,q=0):R.key==="ArrowRight"&&F<e.length-1&&(ne=e[F+1].id,q=0),p.current=ee($({},U),{sourceColumnId:ne,sourceIndex:q}),S(ne),b(q),L(z.title,((O=e.find(he=>he.id===ne))==null?void 0:O.title)||"",q)}else if(R.key==="Escape"){const U=p.current;U!=null&&U.isKeyboardGrab&&U.originalColumnId!==void 0&&U.originalIndex!==void 0&&(i(U.cardId,U.originalColumnId,U.originalIndex),L(z.title,((B=e.find(F=>F.id===U.originalColumnId))==null?void 0:B.title)||"",U.originalIndex)),p.current=null,v(null),b(null),S(null)}}},[t,k,e,i,L]);return f.jsxs("div",ee($({ref:u,className:`kanban-board ${l}`,onPointerMove:I,onPointerUp:T},c),{children:[f.jsx("div",{ref:C,className:"kanban-board__columns",children:e.map(R=>f.jsx("div",{"data-column-id":R.id,className:"kanban-board__column-wrapper",children:f.jsx(PU,{column:R,cards:k[R.id]||[],selectedId:n,onSelectCard:D=>a==null?void 0:a(D),renderCard:r,draggedCardId:g||void 0,insertionIndex:_===R.id?x!=null?x:0:void 0,onCardPointerDown:E,onCardKeyDown:A})},R.id))}),f.jsx("div",{ref:M,className:"kanban-board__live-region",role:"status","aria-live":"polite","aria-atomic":"true"})]}))});HU.displayName="KanbanBoard";const qU=Se.forwardRef((u,c)=>{var h=u,{entries:e=[],follow:t=!0,maxRows:n=500,showOps:a=!1,className:i="","aria-label":r}=h,l=Ie(h,["entries","follow","maxRows","showOps","className","aria-label"]);const m=j.useRef(null),p=j.useRef(null),[g,v]=j.useState(t);j.useEffect(()=>{c&&(typeof c=="function"?c(m.current):c.current=m.current)},[c]),j.useEffect(()=>{if(!t||!p.current)return;const S=new IntersectionObserver(M=>{M.forEach(C=>{C.isIntersecting&&v(!0)})},{threshold:.1});return S.observe(p.current),()=>{S.disconnect()}},[t]),j.useEffect(()=>{g&&t&&m.current&&(m.current.scrollTop=m.current.scrollHeight)},[e,t,g]),j.useEffect(()=>{if(!t||!m.current)return;const S=()=>{const{scrollTop:C,scrollHeight:k,clientHeight:L}=m.current;k-C-L<50||v(!1)},M=m.current;return M.addEventListener("scroll",S),()=>{M.removeEventListener("scroll",S)}},[t]);const x=e.slice(-n),b=S=>S.id?S.id:`log-${typeof S.timestamp=="string"?S.timestamp:S.timestamp.getTime()}-${S.level}-${S.message}-${S.op||""}-${S.target||""}`,_=["log-stream",i].filter(Boolean).join(" ");return f.jsxs("div",ee($({ref:m,className:_,role:"log","aria-live":g&&t?"polite":void 0,"aria-label":r!=null?r:"Log stream"},l),{children:[f.jsx("div",{className:"log-stream__content",children:x.length===0?f.jsx("div",{className:"log-stream__empty",children:f.jsx("span",{className:"log-stream__empty-text",children:"No log entries"})}):x.map(S=>{const M=typeof S.timestamp=="string"?new Date(S.timestamp):S.timestamp,C=tI(M),k=`log-stream__level log-stream__level--${S.level.toLowerCase()}`;return f.jsxs("div",{className:a?"log-stream__row log-stream__row--with-ops":"log-stream__row",children:[f.jsx("span",{className:"log-stream__time",children:C}),f.jsx("span",{className:k,children:S.level}),a&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"log-stream__op",children:S.op||""}),f.jsx("span",{className:"log-stream__target",children:S.target||""})]}),f.jsx("span",{className:"log-stream__message",children:S.message})]},b(S))})}),t&&f.jsx("div",{ref:p,className:"log-stream__sentinel"})]}))});qU.displayName="LogStream";function rx(e){const t=e.trim();if(/^#[0-9a-fA-F]{6}$/i.test(t))return t;if(/^#[0-9a-fA-F]{3}$/i.test(t)){const l=t.slice(1);return"#"+l[0]+l[0]+l[1]+l[1]+l[2]+l[2]}const n=t.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(n){const l=Math.max(0,Math.min(255,parseInt(n[1],10))),c=Math.max(0,Math.min(255,parseInt(n[2],10))),u=Math.max(0,Math.min(255,parseInt(n[3],10)));return"#"+[l,c,u].map(h=>h.toString(16).padStart(2,"0")).join("")}const a=t.match(/hsla?\s*\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)%\s*,\s*(\d+(?:\.\d+)?)%/);if(a){const l=parseFloat(a[1])/360,c=parseFloat(a[2])/100,u=parseFloat(a[3])/100,h=(1-Math.abs(2*u-1))*c,m=h*(1-Math.abs(l*6%2-1)),p=u-h/2;let g=0,v=0,x=0;l<1/6?(g=h,v=m):l<2/6?(g=m,v=h):l<3/6?(v=h,x=m):l<4/6?(v=m,x=h):l<5/6?(g=m,x=h):(g=h,x=m);const b=_=>Math.round((_+p)*255).toString(16).padStart(2,"0");return"#"+b(g)+b(v)+b(x)}const i={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#008000",blue:"#0000ff",yellow:"#ffff00",cyan:"#00ffff",magenta:"#ff00ff",gray:"#808080",grey:"#808080",silver:"#c0c0c0",maroon:"#800000",olive:"#808000",lime:"#00ff00",aqua:"#00ffff",teal:"#008080",navy:"#000080",purple:"#800080",fuchsia:"#ff00ff"},r=t.toLowerCase();return r in i?i[r]:"#10b981"}function VU(e,t,n,a){const i=(e-t)/(n-t||1),r=Math.round((.12+i*.88)*255).toString(16).padStart(2,"0");return`${rx(a)}${r}`}const JS=85.05112878,WS=2,YU=60,eN=12,GU=16;function xc(e,t,n){const a=Math.pow(2,n),i=(t+180)/360*a*256,r=Math.max(-85.05112878,Math.min(85.05112878,e)),l=(1-Math.log(Math.tan(r*Math.PI/180)+1/Math.cos(r*Math.PI/180))/Math.PI)/2*a*256;return{x:i,y:l}}function KU(e,t,n){const a=Math.pow(2,n),i=e/(a*256)*360-180;return{lat:Math.atan(Math.sinh(Math.PI*(1-2*(t/(a*256)))))*180/Math.PI,lng:i}}function QU({patternId:e,zoomLevel:t}){const n=32*Math.pow(2,t);return f.jsxs("pattern",{id:e,x:0,y:0,width:n,height:n,patternUnits:"userSpaceOnUse",children:[f.jsx("rect",{width:n,height:n,fill:"none",stroke:"rgb(var(--canvas-fg-3))",strokeWidth:"0.5",opacity:"0.3"}),f.jsx("circle",{cx:0,cy:0,r:1,fill:"rgb(var(--canvas-fg-3))",opacity:"0.4"})]})}function XU({pin:e,x:t,y:n,onClose:a}){const i=j.useRef(null);return Qd(i,!0,{mode:"popup"}),j.useEffect(()=>{const r=l=>{l.key==="Escape"&&a()};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[a]),f.jsxs("div",{ref:i,className:"map-popover",style:{left:`${t}px`,top:`${n}px`},role:"dialog",children:[e.label&&f.jsx("div",{className:"map-popover__label",children:e.label}),e.timestamp&&f.jsx("div",{className:"map-popover__timestamp",children:e.timestamp}),e.detail&&f.jsx("div",{className:"map-popover__detail",children:e.detail})]})}const ZU=Se.forwardRef((S,_)=>{var M=S,{mode:e,pins:t=[],selectedPinId:n,onSelectPin:a,trackPoints:i=[],heatmapData:r=[],heatmapColor:l="#10b981",tileUrl:c,bounds:u,scaleBar:h=!1,minZoom:m=0,maxZoom:p=18,onViewportChange:g,onModeChange:v,className:x=""}=M,b=Ie(M,["mode","pins","selectedPinId","onSelectPin","trackPoints","heatmapData","heatmapColor","tileUrl","bounds","scaleBar","minZoom","maxZoom","onViewportChange","onModeChange","className"]);const C=j.useRef(null),[k,L]=j.useState(null),[E,I]=j.useState(null),T=j.useRef(!1),[A,R]=j.useState(WS),D=j.useRef(WS),O=j.useCallback(H=>{var we,je;const te=C.current,ie=(we=te==null?void 0:te.clientWidth)!=null?we:0,W=(je=te==null?void 0:te.clientHeight)!=null?je:0,ge=KU((ie/2-H.x)/H.zoom,(W/2-H.y)/H.zoom,D.current);g==null||g({center:{lat:ge.lat,lng:ge.lng},zoom:H.zoom})},[g]),{transform:B,viewport:z,bind:U,panTo:F}=MM({minZoom:m,maxZoom:p,onViewportChange:O,containerRef:C}),Y=`map-grid-${j.useId().replace(/:/g,"")}`;j.useEffect(()=>{const H=C.current;if(!H)return;const te=new ResizeObserver(ie=>{const{width:W,height:ge}=ie[0].contentRect;W>0&&ge>0&&L({width:W,height:ge})});return te.observe(H),()=>te.disconnect()},[]),j.useEffect(()=>{if(T.current||!k)return;const H=[...t.map(K=>({lat:K.lat,lng:K.lng})),...i.map(K=>({lat:K.lat,lng:K.lng})),...r.map(K=>({lat:K.lat,lng:K.lng}))];let te;if(u)te={north:Math.max(u[0].lat,u[1].lat),south:Math.min(u[0].lat,u[1].lat),east:Math.max(u[0].lng,u[1].lng),west:Math.min(u[0].lng,u[1].lng)};else if(H.length>0){const K=H.map(ae=>ae.lat),Q=H.map(ae=>ae.lng);te={north:Math.max(...K),south:Math.min(...K),east:Math.max(...Q),west:Math.min(...Q)}}else te={north:JS,south:-JS,east:180,west:-180};const{width:ie,height:W}=k,ge=Math.min(YU,ie/4,W/4),we=xc(te.north,te.west,0),je=xc(te.south,te.east,0),De=Math.abs(je.x-we.x),re=Math.abs(je.y-we.y);let Z;if(De===0&&re===0)Z=eN;else{const K=De>0?Math.log2((ie-2*ge)/De):1/0,Q=re>0?Math.log2((W-2*ge)/re):1/0;Z=Math.min(K,Q)}Z=Math.max(0,Math.min(GU,Number.isFinite(Z)?Z:eN));const J=xc((te.north+te.south)/2,(te.east+te.west)/2,Z);D.current=Z,R(Z),F(ie/2-J.x,W/2-J.y),T.current=!0},[k,u,t,i,r,F]);const X=j.useCallback(H=>{H.target instanceof Element&&(H.target.closest(".map-pin")||H.target.closest(".map-popover")||H.target.closest("[data-no-drag]"))||U.onPointerDown(H)},[U]),ne=j.useCallback(()=>e!=="pins"||!t.length?null:f.jsx("div",{className:"map-pins","data-testid":"map-pins",style:{position:"absolute",inset:0,pointerEvents:"none"},children:t.map(H=>{const te=xc(H.lat,H.lng,A),ie=z.x+te.x*z.zoom,W=z.y+te.y*z.zoom;return f.jsxs("button",{type:"button",className:["map-pin",n===H.id&&"map-pin--selected"].filter(Boolean).join(" "),onClick:ge=>{ge.stopPropagation(),a==null||a(H.id);const we=ge.target.getBoundingClientRect();I({x:we.right+8,y:we.top})},"aria-label":`${H.label||"Pin"} at latitude ${H.lat.toFixed(4)}, longitude ${H.lng.toFixed(4)}${H.timestamp?` on ${H.timestamp}`:""}`,"data-testid":`map-pin-${H.id}`,"data-no-drag":!0,style:{position:"absolute",left:`${ie}px`,top:`${W}px`,pointerEvents:"auto"},children:[f.jsx("span",{className:"map-pin__dot"}),H.label&&f.jsx("span",{className:"map-pin__label",children:H.label})]},H.id)})}),[e,t,A,z.zoom,z.x,z.y,n,a]),q=j.useCallback(()=>{if(e!=="track"||!i.length)return null;const H=i.map(te=>xc(te.lat,te.lng,A)).map((te,ie)=>`${ie===0?"M":"L"} ${te.x} ${te.y}`).join(" ");return f.jsx("g",{className:"map-track","data-testid":"map-track",children:f.jsx("path",{d:H,className:"map-track__line"})})},[e,i,A]),he=j.useCallback(()=>{if(e!=="heatmap"||!r.length)return null;const H=r.map(W=>W.value).filter(W=>W!=null),te=Math.min(...H),ie=Math.max(...H);return f.jsx("g",{className:"map-heatmap","data-testid":"map-heatmap",children:r.map((W,ge)=>{const we=xc(W.lat,W.lng,A),je=(W.value-te)/(ie-te||1),De=VU(W.value,te,ie,l);return f.jsx("circle",{cx:we.x,cy:we.y,r:8+je*4,fill:De,opacity:.6,"data-testid":`heatmap-point-${ge}`},ge)})})},[e,r,l,A]),pe=j.useCallback(()=>{if(!c||!k)return null;const H=Math.min(Math.max(Math.round(A+Math.log2(z.zoom)),0),28),te=Math.pow(2,H),ie=256*Math.pow(2,A-H),W=-z.x/z.zoom,ge=-z.y/z.zoom,we=(k.width-z.x)/z.zoom,je=(k.height-z.y)/z.zoom,De=Math.max(0,Math.floor(W/ie)),re=Math.max(0,Math.floor(ge/ie)),Z=Math.min(te,Math.ceil(we/ie)),J=Math.min(te,Math.ceil(je/ie)),K=typeof c=="function"?c:(ae,ye,Ae)=>c.replace("{x}",String(ae)).replace("{y}",String(ye)).replace("{z}",String(Ae)),Q=[];for(let ae=De;ae<Z;ae++)for(let ye=re;ye<J;ye++){const Ae=K(ae,ye,H);Q.push(f.jsx("image",{href:Ae,x:ae*ie,y:ye*ie,width:ie,height:ie,"data-testid":`tile-${ae}-${ye}`},`${H}-${ae}-${ye}`))}return Q},[c,k,z,A]);return f.jsxs("div",ee($(ee($({ref:H=>{typeof _=="function"?_(H):_&&(_.current=H),C.current=H},className:["map-canvas",x].filter(Boolean).join(" ")},U),{onPointerDown:X,role:"application","aria-label":"Map canvas"}),b),{children:[f.jsxs("svg",{className:"map-svg",width:"100%",height:"100%",style:{position:"absolute",inset:0,overflow:"visible"},children:[f.jsx("defs",{children:f.jsx(QU,{patternId:Y,zoomLevel:z.zoom})}),c?f.jsx("g",{className:"map-tiles",transform:B,children:pe()}):f.jsx("rect",{width:"100%",height:"100%",fill:`url(#${Y})`,className:"map-grid"}),f.jsxs("g",{className:"map-viewport",transform:B,children:[q(),he()]})]}),ne(),f.jsxs("div",{className:"map-overlay",children:[e==="track"&&f.jsx("div",{className:"map-legend",children:f.jsxs("div",{className:"map-legend__item",children:[f.jsx("div",{className:"map-legend__line",style:{backgroundColor:"rgb(var(--status-cyan))"}}),"Track"]})}),e==="heatmap"&&f.jsx("div",{className:"map-legend",children:f.jsxs("div",{className:"map-legend__item",children:[f.jsx("div",{className:"map-legend__gradient",style:{backgroundImage:`linear-gradient(to right, ${rx(l)}20, ${rx(l)}cc)`}}),"Density"]})}),v&&f.jsxs("div",{className:"map-mode-switch",children:[f.jsx("button",{type:"button",className:["map-mode-switch__button",e==="pins"&&"map-mode-switch__button--active"].filter(Boolean).join(" "),onClick:()=>v("pins"),"aria-label":"Switch to pins mode",title:"Pins",children:"Pins"}),f.jsx("button",{type:"button",className:["map-mode-switch__button",e==="track"&&"map-mode-switch__button--active"].filter(Boolean).join(" "),onClick:()=>v("track"),"aria-label":"Switch to track mode",title:"Track",children:"Track"}),f.jsx("button",{type:"button",className:["map-mode-switch__button",e==="heatmap"&&"map-mode-switch__button--active"].filter(Boolean).join(" "),onClick:()=>v("heatmap"),"aria-label":"Switch to heatmap mode",title:"Heatmap",children:"Heatmap"})]}),h&&f.jsx("div",{className:"map-scale-bar",children:f.jsxs("div",{className:"map-scale-bar__label",children:["Zoom: ",z.zoom.toFixed(1)]})})]}),n&&E&&(()=>{const H=t.find(te=>te.id===n);return H?f.jsx(XU,{pin:H,x:E.x,y:E.y,onClose:()=>{a==null||a(null),I(null)}}):null})()]}))});ZU.displayName="MapCanvas";const JU=e=>(typeof e=="string"?new Date(e):new Date(e)).toLocaleDateString("en-US",{month:"short",year:"numeric"}),WU=Se.forwardRef((u,c)=>{var h=u,{focusedDate:e,selectedDate:t,markers:n=[],weekStartsOn:a=0,onSelect:i,className:r=""}=h,l=Ie(h,["focusedDate","selectedDate","markers","weekStartsOn","onSelect","className"]);const m=typeof e=="string"?new Date(e):new Date(e),p=t?typeof t=="string"?new Date(t):t:null,g=j.useMemo(()=>Bk(m,a),[m.getTime(),a]),v=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];a===1&&v.push(v.shift());const x=b=>n.some(_=>Vc(b,_));return f.jsxs("div",ee($({ref:c,className:`mini-calendar ${r}`.trim()},l),{children:[f.jsx("div",{className:"mini-calendar__header",children:f.jsx("div",{className:"mini-calendar__title",children:JU(m)})}),f.jsxs("div",{className:"mini-calendar__grid",children:[f.jsx("div",{className:"mini-calendar__weekdays",children:v.map(b=>f.jsx("div",{className:"mini-calendar__weekday",children:b.toUpperCase()},b))}),f.jsx("div",{className:"mini-calendar__dates",children:g.map(b=>b.map(_=>{const S=_.getMonth()!==m.getMonth(),M=p?Vc(_,p):!1,C=zk(_),k=x(_);return f.jsxs("button",{className:`mini-calendar__date ${S?"mini-calendar__date--out-of-month":""} ${M?"mini-calendar__date--selected":""} ${C?"mini-calendar__date--today":""} ${k?"mini-calendar__date--has-marker":""}`,onClick:()=>!S&&(i==null?void 0:i(_)),type:"button","aria-current":C?"date":void 0,"aria-selected":M,children:[f.jsx("span",{className:"mini-calendar__date-number",children:_.getDate()}),k&&f.jsx("span",{className:"mini-calendar__marker"})]},_.toISOString())}))})]})]}))});WU.displayName="MiniCalendar";const eF={life:"var(--dom-life)",climate:"var(--dom-climate)",software:"var(--dom-software)",data:"var(--dom-default)",infrastructure:"var(--dom-default)"},tF=e=>eF[e]||"var(--accent-primary)",nF=e=>{const t=["emerald","cyan","amber","rose","violet"],n=e.split("").reduce((a,i)=>a+i.charCodeAt(0),0);return t[n%t.length]},aF=Se.forwardRef((g,p)=>{var v=g,{domain:e,source:t,version:n,snippet:a,provenance:i,score:r,onOpen:l,actions:c,selected:u=!1,className:h=""}=v,m=Ie(v,["domain","source","version","snippet","provenance","score","onOpen","actions","selected","className"]);const x=tF(e),b=nF(e),_=Se.useCallback(C=>{(C.key==="Enter"||C.key===" ")&&l&&(C.preventDefault(),l())},[l]),S=["result-card",u&&"result-card--selected",h].filter(Boolean).join(" "),M=n?`${t} v${n}`:t;return f.jsxs("div",ee($({ref:p,className:S,role:"article","aria-label":M,tabIndex:l?0:void 0,onClick:l,onKeyDown:l?_:void 0,style:{"--domain-color":x}},m),{children:[f.jsxs("div",{className:"result-card__header",children:[f.jsxs("div",{className:"result-card__header-left",children:[f.jsx("div",{className:`result-card__domain-dot result-card__domain-dot--${b}`}),f.jsx("span",{className:"result-card__source",children:t}),n&&f.jsx(Es,{children:n})]}),r!==void 0&&f.jsx("span",{className:"result-card__score-label",children:r.toFixed(2)})]}),r!==void 0&&f.jsx("div",{className:"result-card__score-bar",children:f.jsx(Qx,{percent:r*100,color:"amber",height:4})}),f.jsx("div",{className:"result-card__snippet",children:a}),i&&Object.values(i).some(C=>C!==void 0)&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"result-card__divider"}),f.jsxs("div",{className:"result-card__provenance",children:[i.collection&&f.jsxs("span",{className:"result-card__provenance-field",children:[f.jsx("span",{className:"result-card__provenance-label",children:"Collection"}),f.jsx("span",{className:"result-card__provenance-value",children:i.collection})]}),i.document&&f.jsxs("span",{className:"result-card__provenance-field",children:[f.jsx("span",{className:"result-card__provenance-label",children:"Document"}),f.jsx("span",{className:"result-card__provenance-value",children:i.document})]}),i.section&&f.jsxs("span",{className:"result-card__provenance-field",children:[f.jsx("span",{className:"result-card__provenance-label",children:"Section"}),f.jsx("span",{className:"result-card__provenance-value",children:i.section})]})]})]}),c&&c.length>0&&f.jsx("div",{className:"result-card__actions",children:c.map((C,k)=>f.jsx(Bn,{variant:"ghost",size:"sm",icon:!!C.icon,title:C.label,onClick:L=>{L.stopPropagation(),C.onClick()},children:C.icon?f.jsx(nt,{name:C.icon,size:16}):C.label},k))})]}))});aF.displayName="ResultCard";const sF=/^[0-9a-fA-F]+$/;function ij(e){let t;typeof atob=="function"?t=atob(e):t=globalThis.Buffer.from(e,"base64").toString("binary");let n="";for(let a=0;a<t.length;a++)n+=t.charCodeAt(a).toString(16).padStart(2,"0");return n}function sv(e,t){if(!e)return"";if(sF.test(e)&&e.length===t)return e.toLowerCase();try{return ij(e).toLowerCase()}catch(n){return e.toLowerCase()}}function iF(e){return!e||/^0+$/.test(e)?null:e}const iv=["UNSPECIFIED","INTERNAL","SERVER","CLIENT","PRODUCER","CONSUMER"];function rF(e){var t,n;if(typeof e=="number")return(t=iv[e])!=null?t:"UNSPECIFIED";if(typeof e=="string"){if(/^\d+$/.test(e))return(n=iv[Number(e)])!=null?n:"UNSPECIFIED";const a=e.replace(/^SPAN_KIND_/,"").toUpperCase();return iv.includes(a)?a:"UNSPECIFIED"}return"UNSPECIFIED"}function oF(e){const t=typeof e=="string"&&/^\d+$/.test(e)?Number(e):e;return t===2||t==="STATUS_CODE_ERROR"?"error":"ok"}function Ff(e){if(e==null||e==="")return null;try{return typeof e=="number"?Number.isFinite(e)?BigInt(Math.trunc(e)):null:BigInt(/[.eE]/.test(e)?e.split(/[.eE]/)[0]:e)}catch(t){return null}}function T0(e){var t;if(!e)return"";if(e.stringValue!==void 0)return e.stringValue;if(e.boolValue!==void 0)return e.boolValue;if(e.intValue!==void 0){const n=Number(e.intValue);return Number.isSafeInteger(n)?n:String(e.intValue)}if(e.doubleValue!==void 0)return e.doubleValue;if(e.bytesValue!==void 0)try{return ij(e.bytesValue)}catch(n){return e.bytesValue}return e.arrayValue?JSON.stringify(((t=e.arrayValue.values)!=null?t:[]).map(T0)):e.kvlistValue?JSON.stringify(ox(e.kvlistValue.values)):""}function ox(e){const t={};return(e!=null?e:[]).forEach(n=>{n&&n.key&&(t[n.key]=T0(n.value))}),t}function rv(e,t){const n=(e!=null?e:[]).find(a=>a.key===t);return n?T0(n.value):void 0}const lF=["http.response.status_code","http.status_code","rpc.grpc.status_code"];function cF(e,t={}){var p,g,v;const n=(p=t.serviceNameKey)!=null?p:"service.name",a=Array.isArray(e)?e:(g=e==null?void 0:e.resourceSpans)!=null?g:[],i={},r=[];if(a.forEach(x=>{var M,C,k,L;var b;const _=(b=x.resource)==null?void 0:b.attributes,S=String((M=rv(_,n))!=null?M:"unknown_service");if(!i[S]){const E=(C=rv(_,"host.name"))!=null?C:rv(_,"service.instance.id");i[S]={label:S,host:E!=null?String(E):void 0}}((L=(k=x.scopeSpans)!=null?k:x.instrumentationLibrarySpans)!=null?L:[]).forEach(E=>{var I;((I=E.spans)!=null?I:[]).forEach(T=>r.push({span:T,service:S}))})}),r.length===0)return{spans:[],services:i,meta:{traceId:""}};let l=null;r.forEach(({span:x})=>{const b=Ff(x.startTimeUnixNano);b!==null&&(l===null||b<l)&&(l=b)});const c=l!=null?l:BigInt(0),u=r.map(({span:x,service:b})=>{var R,D,O,B;var _;const S=(R=Ff(x.startTimeUnixNano))!=null?R:c,M=(D=Ff(x.endTimeUnixNano))!=null?D:S,C=Number(S-c)/1e6,k=Number(M-S)/1e6,L=ox(x.attributes);let E;const I=((O=x.events)!=null?O:[]).map(z=>{var X;const U=ox(z.attributes),F=Ff(z.timeUnixNano),Y=F!==null?Number(F-c)/1e6:C;return z.name==="exception"&&!E&&(E={type:U["exception.type"]!=null?String(U["exception.type"]):void 0,message:U["exception.message"]!=null?String(U["exception.message"]):void 0,stacktrace:U["exception.stacktrace"]!=null?String(U["exception.stacktrace"]):void 0}),{time:Y,name:(X=z.name)!=null?X:"event",attributes:U}});let T;for(const z of lF){const U=L[z];if(U!==void 0){T=typeof U=="boolean"?String(U):U;break}}const A={id:sv(x.spanId,16),parentId:iF(sv(x.parentSpanId,16)),name:(B=x.name)!=null?B:"(unnamed)",service:b,kind:rF(x.kind),start:C,duration:k,status:oF((_=x.status)==null?void 0:_.code),statusCode:T,attributes:L,exception:E,events:I.length?I:void 0};return t.deriveStatus?ee($({},A),{status:t.deriveStatus(A)}):A}),h=(v=u.find(x=>x.parentId===null))!=null?v:u[0],m={traceId:sv(r[0].span.traceId,32),name:h==null?void 0:h.name,rootService:h==null?void 0:h.service};return{spans:u,services:i,meta:m}}function uF(e){if(!e)return"";const t=e.split("-");return t.length===3?(t[1]+t[2]).toLowerCase():e.replace(/-/g,"").toLowerCase()}function dF(e,t){return t?"SERVER":e.namespace==="aws"||e.namespace==="remote"?"CLIENT":"INTERNAL"}function hF(e){return e.fault||e.error||e.throttle?"error":"ok"}function lx(e,t,n){if(n!=null){if(typeof n!="object"||Array.isArray(n)){e[t]=Array.isArray(n)?JSON.stringify(n):n;return}Object.entries(n).forEach(([a,i])=>{if(i==null)return;const r=t?`${t}.${a}`:a;typeof i=="object"&&!Array.isArray(i)?lx(e,r,i):e[r]=Array.isArray(i)?JSON.stringify(i):i})}}function fF(e){var t,n;const a={},i=(t=e.http)==null?void 0:t.request,r=(n=e.http)==null?void 0:n.response;if((i==null?void 0:i.method)!=null&&(a["http.request.method"]=i.method),(i==null?void 0:i.url)!=null&&(a["url.full"]=i.url),(i==null?void 0:i.user_agent)!=null&&(a["user_agent.original"]=i.user_agent),(i==null?void 0:i.client_ip)!=null&&(a["client.address"]=i.client_ip),(r==null?void 0:r.status)!=null&&(a["http.response.status_code"]=r.status),(r==null?void 0:r.content_length)!=null&&(a["http.response.body.size"]=r.content_length),e.sql){const l=e.sql;l.database_type!=null&&(a["db.system"]=l.database_type),l.sanitized_query!=null&&(a["db.statement"]=l.sanitized_query),l.url!=null&&(a["server.address"]=l.url),l.user!=null&&(a["db.user"]=l.user)}return e.namespace&&(a["aws.xray.namespace"]=e.namespace),e.throttle&&(a["aws.xray.throttle"]=!0),"origin"in e&&e.origin&&(a["cloud.platform"]=String(e.origin)),e.aws&&lx(a,"aws",e.aws),e.annotations&&Object.entries(e.annotations).forEach(([l,c])=>{a[l]=c}),e.metadata&&lx(a,"metadata",e.metadata),a}function pF(e){var l,c;var t,n,a,i;let r;if(e.cause&&typeof e.cause=="object"&&(t=e.cause.exceptions)!=null&&t.length){const u=e.cause.exceptions[0],h=(n=u.stack)!=null&&n.length?`${(l=u.type)!=null?l:"Error"}: ${(c=u.message)!=null?c:""}
|
|
78
|
+
`+u.stack.map(m=>{var p,g,v;return` at ${(p=m.label)!=null?p:"<anonymous>"} (${(g=m.path)!=null?g:"?"}:${(v=m.line)!=null?v:0})`}).join(`
|
|
79
|
+
`):void 0;r={type:u.type,message:u.message,stacktrace:h}}else typeof e.cause=="string"&&(r={type:"Error",message:`exception ${e.cause}`});return{exception:r,statusCode:(i=(a=e.http)==null?void 0:a.response)==null?void 0:i.status}}function rj(e){var t,n;if(e==null)return[];if(Array.isArray(e))return e.flatMap(rj);if(e.Traces||e.traces){const a=(t=e.Traces)!=null?t:e.traces;let i=a;return a.length>1&&(console.warn(`fromXRay: response has ${a.length} traces; using the first. Pass one trace at a time for the rest.`),i=a.slice(0,1)),i.flatMap(r=>{var l;return((l=r.Segments)!=null?l:[]).map(c=>typeof c.Document=="string"?JSON.parse(c.Document):c.Document)})}return e.Segments||e.segments?((n=e.Segments)!=null?n:e.segments).map(a=>typeof a.Document=="string"?JSON.parse(a.Document):a.Document):[e]}function mF(e,t={}){var p;const n=rj(e);if(n.length===0)return{spans:[],services:{},meta:{traceId:""}};const a=[],i={},r=(g,v,x,b)=>{var _;a.push({node:g,parentId:v,service:x,isRoot:b}),((_=g.subsegments)!=null?_:[]).forEach(S=>r(S,g.id,x,!1))};n.forEach(g=>{var b;const v=g.type==="subsegment",x=g.name;i[x]||(i[x]={label:x}),r(g,(b=g.parent_id)!=null?b:null,x,!v)});let l=1/0,c=-1/0;a.forEach(({node:g})=>{typeof g.start_time=="number"&&(l=Math.min(l,g.start_time)),typeof g.end_time=="number"&&(c=Math.max(c,g.end_time))}),Number.isFinite(l)||(l=0),Number.isFinite(c)||(c=l);const u=a.map(({node:g,parentId:v,service:x,isRoot:b})=>{var A,R,D,O;const _=typeof g.start_time=="number"?g.start_time:l,S=(_-l)*1e3,M=typeof g.end_time=="number"?g.end_time:c,C=Math.max(0,(M-_)*1e3),k=fF(g),{exception:L,statusCode:E}=pF(g),I=L?[{time:S,name:"exception",attributes:{"exception.type":(A=L.type)!=null?A:"","exception.message":(R=L.message)!=null?R:""}}]:void 0,T={id:String((D=g.id)!=null?D:"").toLowerCase(),parentId:v!=null?String(v).toLowerCase():null,name:String((O=g.name)!=null?O:"(unnamed)"),service:x,kind:dF(g,b),start:S,duration:C,status:hF(g),statusCode:E,attributes:k,exception:L,events:I};return t.deriveStatus?ee($({},T),{status:t.deriveStatus(T)}):T}),h=(p=n.find(g=>g.type!=="subsegment"))!=null?p:n[0],m={traceId:uF(h.trace_id),name:h.name,rootService:h.name};return{spans:u,services:i,meta:m}}function gF(e){const t={};e.forEach(u=>{t[u.id]=ee($({},u),{end:u.start+u.duration,depth:0,children:[],hasChildren:!1})});const n=[];e.forEach(u=>{const h=t[u.id];u.parentId&&t[u.parentId]&&u.parentId!==u.id?t[u.parentId].children.push(h):n.push(h)});const a=(u,h)=>u.start-h.start||u.end-h.end;n.sort(a);const i=[];let r=0;const l=(u,h)=>{u.depth=h,u.hasChildren=u.children.length>0,h>r&&(r=h),i.push(u),u.children.sort(a),u.children.forEach(m=>l(m,h+1))};n.forEach(u=>l(u,0));const c=i.reduce((u,h)=>h.end>u?h.end:u,0);return{byId:t,ordered:i,roots:n,total:c,maxDepth:r}}function oj(e){if(!e.children.length)return e.duration;const t=e.children.map(r=>[Math.max(r.start,e.start),Math.min(r.end,e.end)]).filter(([r,l])=>l>r).sort((r,l)=>r[0]-l[0]);let n=0,a=null,i=0;return t.forEach(([r,l])=>{a===null?(a=r,i=l):r<=i?i=Math.max(i,l):(n+=i-a,a=r,i=l)}),a!==null&&(n+=i-a),Math.max(0,e.duration-n)}function yF(e,t){const n=[],a=new Set;return e.forEach(i=>{if(i.parentId&&a.has(i.parentId)){a.add(i.id);return}n.push(i),t.has(i.id)&&a.add(i.id)}),n}function vF(e){let t=0;const n=a=>{a.children.forEach(i=>{t++,n(i)})};return n(e),t}const cx=2;function lj(e,t,n=cx){const a=Math.max(1e-6,t-e),i=100-2*n;return{x:r=>n+(r-e)/a*i,w:r=>Math.max(.5,r/a*i)}}function xF(e,t){const n=Math.max(1e-6,t-e)/8,a=Math.pow(10,Math.floor(Math.log10(n))),i=n/a,r=a*(i<1.5?1:i<3?2:i<7?5:10),l=[],c=Math.ceil(e/r-1e-9)*r;for(let u=c;u<=t+1e-6;u+=r)l.push(+u.toFixed(3));return{ticks:l,step:r}}function hs(e){return e==null?"—":e>=1e3?(e/1e3).toFixed(2)+" s":e>=10?e.toFixed(0)+" ms":e>=1?e.toFixed(1)+" ms":e.toFixed(2)+" ms"}const cj=["#22D3EE","#818CF8","#10B981","#8B5CF6","#14B8A6","#F59E0B","#38BDF8","#A3E635","#E879F9","#2DD4BF"];function bF(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t>>>0}function _F(e,t=cj){return t[bF(e)%t.length]}function wF(e,t,n,a=cj){var i;return(n==null?void 0:n(e))||((i=t==null?void 0:t[e])==null?void 0:i.color)||_F(e,a)}function SF(e,t){var n;return((n=t==null?void 0:t[e])==null?void 0:n.label)||e}const NF={SERVER:"server",CLIENT:"client",INTERNAL:"internal",PRODUCER:"producer",CONSUMER:"consumer",UNSPECIFIED:"internal"},kF={ok:"OK",warn:"WARN",error:"ERROR"};function CF({model:e,resolveColor:t,selectedId:n}){const{ordered:a,total:i}=e,r=100,l=2,c=1,u=3,h=a.length,m=u*2+h*(l+c),p=a.findIndex(v=>v.id===n),g=Se.useMemo(()=>{const v=lj(0,i);return a.map((x,b)=>f.jsx("rect",{x:v.x(x.start),y:u+b*(l+c),width:v.w(x.duration),height:l,rx:"0.6",fill:x.status==="error"?"rgb(var(--status-error))":t(x.service),fillOpacity:.5},x.id))},[a,i,t]);return f.jsxs("svg",{className:"trace-detail__minimap",width:"100%",height:m,viewBox:`0 0 ${r} ${m}`,preserveAspectRatio:"none",children:[p>=0&&f.jsx("rect",{x:"0",y:u+p*(l+c)-1,width:r,height:l+2,className:"trace-detail__minimap-band"}),g]})}function tN({rows:e}){return f.jsx("div",{className:"trace-detail__kv",children:e.map(([t,n],a)=>f.jsxs(Se.Fragment,{children:[f.jsx("div",{className:"trace-detail__kv-key",title:t,children:t}),f.jsx("div",{className:"trace-detail__kv-val",title:typeof n=="string"?n:void 0,children:n})]},t+a))})}function Vo({title:e,right:t,children:n}){return f.jsxs("div",{className:"trace-detail__section",children:[f.jsxs("div",{className:"trace-detail__section-head",children:[f.jsx("span",{className:"trace-detail__eyebrow",children:e}),t]}),f.jsx("div",{className:"trace-detail__section-body",children:n})]})}const uj=Se.forwardRef(function({span:e,model:t,traceId:n,resolveColor:a,serviceLabel:i,serviceHost:r,onClose:l,onSelect:c,renderAttributes:u,closeButtonRef:h},m){var I,T,A,R;var p;const g=a(e.service),v=t.total,x=oj(e),b=v>0?e.duration/v*100:0,_=e.duration>0?x/e.duration*100:0,S=e.parentId?t.byId[e.parentId]:null,M=(I=NF[e.kind])!=null?I:"internal",C=t.ordered.findIndex(D=>D.id===e.id)+1,k=e.attributes?Object.entries(e.attributes):[],L=((T=e.events)!=null?T:[]).filter(D=>D.name!=="exception"),E=({label:D,value:O,sub:B})=>f.jsxs("div",{className:"trace-detail__timing-row",children:[f.jsx("span",{className:"trace-detail__timing-label",children:D}),f.jsxs("span",{className:"trace-detail__timing-value",children:[O,B&&f.jsxs("span",{className:"trace-detail__timing-sub",children:[" ",B]})]})]});return f.jsxs("div",{className:"trace-detail",ref:m,role:"complementary","aria-label":`Span detail: ${e.name}`,onKeyDown:D=>{D.key==="Escape"&&(D.stopPropagation(),l())},children:[f.jsxs("div",{className:"trace-detail__head",children:[f.jsx("span",{className:"trace-detail__head-swatch",style:{background:g}}),f.jsxs("div",{className:"trace-detail__head-main",children:[f.jsxs("div",{className:"trace-detail__eyebrow",children:[i.toUpperCase()," · ",e.kind]}),f.jsx("div",{className:"trace-detail__title",children:e.name}),f.jsx("div",{className:"trace-detail__status-row",children:f.jsxs("span",{className:`trace-detail__status-pill trace-detail__status-pill--${e.status}`,children:[f.jsx("span",{className:"trace-detail__status-dot"}),kF[e.status],e.statusCode!=null&&e.statusCode!==0?` · ${e.statusCode}`:""]})})]}),f.jsx("button",{type:"button",className:"trace-detail__close",onClick:l,title:"Close panel","aria-label":"Close span detail",ref:h,children:f.jsx(nt,{name:"x",size:14})})]}),f.jsxs("div",{className:"trace-detail__scroll",children:[f.jsxs(Vo,{title:"TRACE MAP",children:[f.jsx("div",{className:"trace-detail__minimap-wrap",children:f.jsx(CF,{model:t,resolveColor:a,selectedId:e.id})}),f.jsxs("div",{className:"trace-detail__minimap-caption",children:["row ",C," of ",t.ordered.length]})]}),f.jsxs(Vo,{title:"TIMING",children:[f.jsx(E,{label:"start offset",value:hs(e.start)}),f.jsx(E,{label:"duration",value:hs(e.duration)}),f.jsx(E,{label:"self time",value:hs(x),sub:`· ${_.toFixed(0)}%`}),f.jsx(E,{label:"% of trace",value:`${b.toFixed(1)}%`}),f.jsxs("div",{className:"trace-detail__selfbar",children:[f.jsx("div",{className:"trace-detail__selfbar-self",style:{width:`${_}%`,background:g}}),f.jsx("div",{className:"trace-detail__selfbar-children"})]}),f.jsxs("div",{className:"trace-detail__selfbar-legend",children:[f.jsxs("span",{children:["SELF ",hs(x)]}),f.jsxs("span",{children:["IN CHILDREN ",hs(e.duration-x)]})]})]}),f.jsx(Vo,{title:"IDENTITY",children:f.jsx(tN,{rows:[["span_id",e.id],["parent",S?f.jsx("button",{type:"button",className:"trace-detail__link",onClick:()=>c(S.id),title:S.name,children:S.name}):f.jsx("span",{className:"trace-detail__muted",children:"— root —"})],["service",f.jsxs("span",{className:"trace-detail__svc",title:i,children:[f.jsx("span",{className:"trace-detail__svc-dot",style:{background:g}}),i]})],...r?[["host",r]]:[],["kind",f.jsx("span",{className:`trace-detail__kind trace-detail__kind--${M}`,children:e.kind})],...n?[["trace_id",n]]:[]]})}),u?f.jsx(Vo,{title:"ATTRIBUTES",children:u(e)}):k.length>0?f.jsx(Vo,{title:"ATTRIBUTES",right:f.jsx("span",{className:"trace-detail__count",children:k.length}),children:f.jsx(tN,{rows:k.map(([D,O])=>[D,String(O)])})}):null,L.length>0&&f.jsx(Vo,{title:"EVENTS",right:f.jsx("span",{className:"trace-detail__count",children:L.length}),children:f.jsx("div",{className:"trace-detail__events",children:L.map((D,O)=>f.jsxs("div",{className:"trace-detail__event",children:[f.jsx("span",{className:"trace-detail__event-time",children:hs(D.time)}),f.jsx("span",{className:"trace-detail__event-name",children:D.name})]},O))})}),f.jsx(Vo,{title:"STATUS",children:e.status==="error"&&e.exception?f.jsxs("div",{className:"trace-detail__error",children:[f.jsxs("div",{className:"trace-detail__error-head",children:[f.jsx(nt,{name:"alert",size:14}),f.jsx("span",{children:(A=e.exception.type)!=null?A:"Error"})]}),e.exception.message&&f.jsx("div",{className:"trace-detail__error-msg",children:e.exception.message}),e.exception.stacktrace&&f.jsx("pre",{className:"trace-detail__error-stack",children:e.exception.stacktrace})]}):e.status==="warn"?f.jsxs("div",{className:"trace-detail__warn",children:[f.jsx(nt,{name:"alert",size:13}),"degraded — ",String((R=(p=e.attributes)==null?void 0:p.note)!=null?R:"elevated latency on this span")]}):f.jsxs("div",{className:"trace-detail__ok",children:[f.jsx("span",{className:"trace-detail__ok-dot"}),"OK",e.statusCode?` · ${e.statusCode}`:""]})}),f.jsx("div",{className:"trace-detail__foot-spacer"})]})]})});uj.displayName="TraceDetailPanel";const nN=14,aN=16;function MF({node:e,rowHeight:t,treeWidth:n,selected:a,hovered:i,collapsed:r,color:l,onSelect:c,onHover:u,onToggle:h,registerRef:m}){const p=nN+e.depth*aN,g=[];for(let x=0;x<e.depth;x++)g.push(nN+x*aN+7);const v=["trace-viewer__tree-row",a&&"is-selected",i&&"is-hovered",e.status==="error"&&"is-error",e.status==="warn"&&"is-warn"].filter(Boolean).join(" ");return f.jsxs("div",{ref:x=>m(e.id,x),className:v,role:"treeitem","aria-level":e.depth+1,"aria-selected":a,"aria-expanded":e.hasChildren?!r:void 0,tabIndex:a?0:-1,style:{height:t,paddingLeft:p,width:n},onClick:()=>c(e.id),onMouseEnter:()=>u(e.id),onMouseLeave:()=>u(null),children:[g.map((x,b)=>f.jsx("span",{className:"trace-viewer__guide",style:{left:x}},b)),e.hasChildren?f.jsx("button",{type:"button",className:"trace-viewer__twisty"+(r?"":" is-open"),onClick:x=>{x.stopPropagation(),h(e.id)},tabIndex:-1,"aria-label":r?"Expand":"Collapse",children:f.jsx(nt,{name:"chevronRight",size:13})}):f.jsx("span",{className:"trace-viewer__twisty trace-viewer__twisty--leaf",children:f.jsx("span",{className:"trace-viewer__leaf-dot"})}),f.jsx("span",{className:"trace-viewer__swatch",style:{background:l}}),f.jsx("span",{className:"trace-viewer__tree-name",children:e.name}),r&&e.hasChildren&&f.jsxs("span",{className:"trace-viewer__desc-count",children:["+",vF(e)]}),f.jsx("span",{className:"trace-viewer__tree-dur",children:hs(e.duration)})]})}function jF({node:e,rowHeight:t,scaleX:n,scaleW:a,selected:i,hovered:r,color:l,onSelect:c,onHover:u}){const h=n(e.start),m=a(e.duration),p=h+m<68,g=e.status==="error",v=e.status==="warn",x=["trace-viewer__wf-row",i&&"is-selected",r&&"is-hovered"].filter(Boolean).join(" ");return f.jsxs("div",{className:x,style:{height:t},onClick:()=>c(e.id),onMouseEnter:()=>u(e.id),onMouseLeave:()=>u(null),children:[f.jsx("div",{className:"trace-viewer__bar"+(g?" is-error":"")+(i?" is-selected":""),style:{left:`${h}%`,width:`${m}%`,background:l},children:v&&f.jsx("span",{className:"trace-viewer__bar-warn"})}),g&&f.jsx("span",{className:"trace-viewer__bar-alert",style:{left:`calc(${h}% - 4px)`},children:f.jsx(nt,{name:"alert",size:12})}),f.jsxs("span",{className:"trace-viewer__bar-label",style:p?{left:`calc(${h+m}% + 7px)`}:{right:`calc(${100-h}% + 7px)`},children:[f.jsx("span",{className:"trace-viewer__bar-dur"+(g?" is-error":v?" is-warn":""),children:hs(e.duration)}),f.jsx("span",{className:"trace-viewer__bar-name",children:e.name})]})]})}const EF=Se.memo(function({model:e,resolveColor:t,resolveLabel:n}){const{ordered:a,total:i}=e,r=new Set(a.map(g=>g.service)),l=a.filter(g=>g.status==="error").length,c=a.filter(g=>g.status==="warn").length,u={};a.forEach(g=>{u[g.service]=(u[g.service]||0)+oj(g)});const h=Object.entries(u).sort((g,v)=>v[1]-g[1]),m=h.reduce((g,[,v])=>g+v,0)||1,p=({label:g,value:v,tone:x})=>f.jsxs("div",{className:"trace-viewer__stat"+(x?` trace-viewer__stat--${x}`:""),children:[f.jsx("span",{className:"trace-viewer__eyebrow",children:g}),f.jsx("span",{className:"trace-viewer__stat-value",children:v})]});return f.jsxs("div",{className:"trace-viewer__summary",children:[f.jsx(p,{label:"DURATION",value:hs(i),tone:"accent"}),f.jsx(p,{label:"SPANS",value:a.length}),f.jsx(p,{label:"SERVICES",value:r.size}),f.jsx(p,{label:"ERRORS",value:l,tone:l?"error":void 0}),f.jsx(p,{label:"WARNINGS",value:c,tone:c?"warn":void 0}),f.jsxs("div",{className:"trace-viewer__svcbar-wrap",children:[f.jsx("span",{className:"trace-viewer__eyebrow",children:"TIME PER SERVICE · SELF"}),f.jsx("div",{className:"trace-viewer__svcbar",children:h.map(([g,v])=>f.jsx("div",{className:"trace-viewer__svcbar-seg",title:`${n(g)} · ${hs(v)}`,style:{width:`${v/m*100}%`,background:t(g)}},g))}),f.jsx("div",{className:"trace-viewer__svc-legend",children:h.map(([g,v])=>f.jsxs("span",{className:"trace-viewer__svc-legend-item",children:[f.jsx("span",{className:"trace-viewer__svc-legend-dot",style:{background:t(g)}}),n(g),f.jsx("span",{className:"trace-viewer__svc-legend-val",children:hs(v)})]},g))})]})]})}),RF=Se.forwardRef(function(T,I){var A=T,{trace:e,otlp:t,xray:n,selectedSpanId:a,defaultSelectedSpanId:i=null,onSelectSpan:r,collapsedSpanIds:l,defaultCollapsedSpanIds:c,onToggleSpan:u,showSummary:h=!0,showToolbar:m=!0,showDetailPanel:p=!0,treeWidth:g=336,detailPanelWidth:v=360,rowHeight:x=30,services:b,serviceColor:_,deriveStatus:S,renderAttributes:M,enableZoom:C=!0,virtualizeThreshold:k=80,className:L=""}=A,E=Ie(A,["trace","otlp","xray","selectedSpanId","defaultSelectedSpanId","onSelectSpan","collapsedSpanIds","defaultCollapsedSpanIds","onToggleSpan","showSummary","showToolbar","showDetailPanel","treeWidth","detailPanelWidth","rowHeight","services","serviceColor","deriveStatus","renderAttributes","enableZoom","virtualizeThreshold","className"]);var R,D;const O=j.useMemo(()=>{let Re;return t?Re=cF(t):n?Re=mF(n):Re=e!=null?e:{spans:[]},S&&(Re=ee($({},Re),{spans:Re.spans.map(We=>ee($({},We),{status:S(We)}))})),Re},[t,n,e,S]),B=j.useMemo(()=>gF(O.spans),[O]),{ordered:z,byId:U,total:F}=B,Y=j.useMemo(()=>{var Re;return $($({},(Re=O.services)!=null?Re:{}),b!=null?b:{})},[O.services,b]),X=j.useCallback(Re=>wF(Re,Y,_),[Y,_]),ne=j.useCallback(Re=>SF(Re,Y),[Y]),[q,he]=j.useState(i),pe=a!==void 0?a:q,H=pe&&U[pe]?pe:null,te=j.useCallback(Re=>{a===void 0&&he(Re),r==null||r(Re)},[a,r]),[ie,W]=j.useState(()=>new Set(c!=null?c:[])),ge=j.useMemo(()=>l?new Set(l):ie,[l,ie]),we=j.useCallback(Re=>{const We=!ge.has(Re);l===void 0&&W(lt=>{const ht=new Set(lt);return ht.has(Re)?ht.delete(Re):ht.add(Re),ht}),u==null||u(Re,We)},[ge,l,u]),je=j.useCallback(Re=>{var We;if(l!==void 0)return;const lt=[];let ht=(We=U[Re])!=null&&We.parentId?U[U[Re].parentId]:null;for(;ht;)lt.push(ht.id),ht=ht.parentId?U[ht.parentId]:null;lt.length&&W(jn=>{const pa=new Set(jn);return lt.forEach(Ua=>pa.delete(Ua)),pa})},[U,l]),[De,re]=j.useState(null),[Z,J]=j.useState(null),K=Z!=null?Z:[0,F||1],Q=j.useMemo(()=>lj(K[0],K[1]),[K[0],K[1]]),ae=j.useMemo(()=>xF(K[0],K[1]).ticks,[K[0],K[1]]),ye=j.useMemo(()=>yF(z,ge),[z,ge]),Ae=j.useMemo(()=>{const Re=new Map;return ye.forEach((We,lt)=>Re.set(We.id,lt)),Re},[ye]),de=ye.length*x,[Je,Ge]=j.useState(600),be=ye.length>=k,{visibleRange:Fe,containerRef:me,sentinelRef:Ee}=Zx({itemCount:ye.length,itemHeight:x,containerHeight:Je,overscan:16}),se=be?Math.max(0,Fe[0]):0,le=be?Math.min(ye.length,Fe[1]):ye.length,xe=ye.slice(se,le);j.useEffect(()=>{const Re=me.current;if(!Re||typeof ResizeObserver>"u")return;const We=new ResizeObserver(()=>Ge(Re.clientHeight||600));return We.observe(Re),Ge(Re.clientHeight||600),()=>We.disconnect()},[me]);const Pe=j.useMemo(()=>{const Re=new Set;let We=H?U[H]:null;for(;We;)Re.add(We.id),We=We.parentId?U[We.parentId]:null;return Re},[H,U]),$e=j.useRef(new Map),Be=j.useCallback((Re,We)=>{We?$e.current.set(Re,We):$e.current.delete(Re)},[]),at=j.useRef(null),ot=j.useCallback(Re=>{const We=Ae.get(Re),lt=me.current;if(We==null||!lt)return;const ht=We*x,jn=ht+x;ht<lt.scrollTop?lt.scrollTop=Math.max(0,ht-x):jn>lt.scrollTop+lt.clientHeight&&(lt.scrollTop=jn-lt.clientHeight+x)},[Ae,x,me]),ft=j.useCallback((Re,We=6)=>{const lt=$e.current.get(Re);if(lt){lt.focus();return}We>0&&requestAnimationFrame(()=>ft(Re,We-1))},[]);j.useEffect(()=>{H&&(ot(H),at.current===H&&(ft(H),at.current=null))},[H,ot,ft]);const it=j.useCallback((Re,We=!0)=>{je(Re),We&&(at.current=Re),te(Re)},[je,te]),kt=j.useCallback(Re=>{var We;const lt=H!=null?H:(We=ye[0])==null?void 0:We.id;if(!lt)return;const ht=Ae.get(lt);if(ht==null)return;const jn=U[lt];switch(Re.key){case"ArrowDown":Re.preventDefault(),ye[ht+1]&&it(ye[ht+1].id);break;case"ArrowUp":Re.preventDefault(),ye[ht-1]&&it(ye[ht-1].id);break;case"ArrowRight":Re.preventDefault(),jn.hasChildren&&ge.has(lt)?we(lt):ye[ht+1]&&ye[ht+1].parentId===lt&&it(ye[ht+1].id);break;case"ArrowLeft":Re.preventDefault(),jn.hasChildren&&!ge.has(lt)?we(lt):jn.parentId&&it(jn.parentId);break;case"Home":Re.preventDefault(),ye[0]&&it(ye[0].id);break;case"End":Re.preventDefault(),ye[ye.length-1]&&it(ye[ye.length-1].id);break;case"Enter":case" ":Re.preventDefault(),it(lt);break;case"Escape":H&&(Re.preventDefault(),te(null));break}},[H,ye,Ae,U,ge,we,it,te]),pt=j.useMemo(()=>{const Re=new Map;return z.forEach((We,lt)=>Re.set(We.id,lt)),Re},[z]),Yt=j.useMemo(()=>z.filter(Re=>Re.status==="error").map(Re=>Re.id),[z]),Rt=j.useCallback(Re=>{var pa,Ua;if(!Yt.length)return;const We=Wt=>{var en;return(en=pt.get(Wt))!=null?en:-1},lt=H?We(H):-1,ht=Yt.map(We).sort((Wt,en)=>Wt-en);let jn;Re===1?jn=(pa=ht.find(Wt=>Wt>lt))!=null?pa:ht[0]:jn=(Ua=[...ht].reverse().find(Wt=>Wt<lt))!=null?Ua:ht[ht.length-1],jn!=null&&it(z[jn].id)},[Yt,z,H,it]),hn=j.useCallback(()=>{l===void 0&&W(new Set(z.filter(Re=>Re.hasChildren).map(Re=>Re.id)))},[l,z]),Nn=j.useCallback(()=>{l===void 0&&W(new Set)},[l]),An=j.useRef(null),[It,$n]=j.useState(null),yn=j.useRef(null),Na=j.useCallback(Re=>{const We=An.current;if(!We)return 0;const lt=We.getBoundingClientRect();return Math.min(100,Math.max(0,(Re-lt.left)/lt.width*100))},[]),kn=j.useCallback(Re=>{const We=100-2*cx,lt=(Re-cx)/We;return K[0]+lt*(K[1]-K[0])},[K]),Un=j.useCallback(Re=>{if(!C||F<=0)return;Re.currentTarget.setPointerCapture(Re.pointerId);const We=Na(Re.clientX);yn.current=We,$n({a:We,b:We})},[C,F,Na]),Cn=j.useCallback(Re=>{yn.current!=null&&$n({a:yn.current,b:Na(Re.clientX)})},[Na]),Xt=j.useCallback(()=>{if(yn.current==null)return;const Re=It;if(yn.current=null,$n(null),!Re||Math.abs(Re.b-Re.a)<1.5)return;const We=kn(Math.min(Re.a,Re.b)),lt=kn(Math.max(Re.a,Re.b)),ht=Math.max(0,Math.min(We,lt)),jn=Math.min(F,Math.max(We,lt));jn-ht>F*.005&&J([ht,jn])},[It,kn,F]),Mn=j.useCallback(()=>{yn.current=null,$n(null)},[]),Gt=Z!=null;j.useEffect(()=>{a===void 0&&q&&!U[q]&&he(null)},[U,q,a]);const Zn=H?U[H]:null,ys=p&&!!Zn,Hn=j.useRef(null),ti=j.useCallback(()=>{const Re=H;te(null),Re&&ft(Re)},[H,te,ft]),da=Yt.length,fn=["trace-viewer",L].filter(Boolean).join(" ");return z.length?f.jsxs("div",ee($({ref:I,className:fn},E),{children:[h&&f.jsx(EF,{model:B,resolveColor:X,resolveLabel:ne}),m&&f.jsxs("div",{className:"trace-viewer__toolbar",children:[f.jsxs("div",{className:"trace-viewer__toolbar-group",children:[f.jsx("button",{type:"button",className:"trace-viewer__tool-btn",onClick:Nn,title:"Expand all","aria-label":"Expand all",children:f.jsx(nt,{name:"chevronDown",size:14})}),f.jsx("button",{type:"button",className:"trace-viewer__tool-btn",onClick:hn,title:"Collapse all","aria-label":"Collapse all",children:f.jsx(nt,{name:"chevronRight",size:14})})]}),f.jsxs("div",{className:"trace-viewer__toolbar-group",children:[f.jsx("button",{type:"button",className:"trace-viewer__tool-btn",onClick:()=>Rt(-1),disabled:!da,title:"Previous error","aria-label":"Previous error",children:f.jsx(nt,{name:"arrowUp",size:14})}),f.jsxs("span",{className:"trace-viewer__error-count"+(da?" is-active":""),children:[da," error",da!==1?"s":""]}),f.jsx("button",{type:"button",className:"trace-viewer__tool-btn",onClick:()=>Rt(1),disabled:!da,title:"Next error","aria-label":"Next error",children:f.jsx(nt,{name:"arrowDown",size:14})})]}),C&&f.jsxs("div",{className:"trace-viewer__toolbar-group",children:[f.jsx("button",{type:"button",className:"trace-viewer__tool-btn",onClick:()=>J(null),disabled:!Gt,title:"Reset zoom","aria-label":"Reset zoom",children:f.jsx(nt,{name:"reload",size:14})}),f.jsx("span",{className:"trace-viewer__zoom-hint",children:Gt?`${hs(K[0])} – ${hs(K[1])}`:"drag axis to zoom"})]})]}),f.jsxs("div",{className:"trace-viewer__body",children:[f.jsxs("div",{className:"trace-viewer__lane",children:[f.jsxs("div",{className:"trace-viewer__lane-head",style:{height:32},children:[f.jsxs("div",{className:"trace-viewer__tree-head",style:{width:g},children:[f.jsxs("span",{className:"trace-viewer__eyebrow",children:["SPAN · ",ye.length,"/",z.length]}),f.jsx("span",{className:"trace-viewer__eyebrow",children:"DURATION"})]}),f.jsxs("div",{className:"trace-viewer__axis"+(C?" is-zoomable":""),ref:An,onPointerDown:Un,onPointerMove:Cn,onPointerUp:Xt,onPointerCancel:Mn,onLostPointerCapture:Mn,onDoubleClick:()=>J(null),children:[ae.map((Re,We)=>f.jsx("div",{className:"trace-viewer__tick-label",style:{left:`${Q.x(Re)}%`},children:Re===0?"0":hs(Re)},We)),It&&f.jsx("div",{className:"trace-viewer__brush",style:{left:`${Math.min(It.a,It.b)}%`,width:`${Math.abs(It.b-It.a)}%`}})]})]}),f.jsx("div",{className:"trace-viewer__scroll",ref:me,children:f.jsxs("div",{className:"trace-viewer__rows",style:{height:de},children:[f.jsx("div",{ref:Ee,className:"trace-viewer__sentinel"}),f.jsx("div",{className:"trace-viewer__tree",role:"tree","aria-label":"Span tree",tabIndex:0,onKeyDown:kt,style:{width:g,height:de},children:xe.map((Re,We)=>{const lt=se+We;return f.jsx("div",{className:"trace-viewer__row-abs",style:{top:lt*x},children:f.jsx(MF,{node:Re,rowHeight:x,treeWidth:g,selected:H===Re.id,hovered:De===Re.id,collapsed:ge.has(Re.id),color:X(Re.service),onSelect:ht=>it(ht,!1),onHover:re,onToggle:we,registerRef:Be})},Re.id)})}),f.jsxs("div",{className:"trace-viewer__wf",style:{height:de},children:[ae.map((Re,We)=>f.jsx("div",{className:"trace-viewer__gridline",style:{left:`${Q.x(Re)}%`}},We)),f.jsx("svg",{className:"trace-viewer__connectors",width:"100%",height:de,viewBox:`0 0 100 ${de}`,preserveAspectRatio:"none",children:ye.map(Re=>{if(!Re.parentId)return null;const We=Ae.get(Re.id),lt=Ae.get(Re.parentId);if(We==null||lt==null)return null;const ht=Math.min(We,lt);if(Math.max(We,lt)<se-24||ht>le+24)return null;const jn=U[Re.parentId],pa=Q.x(jn.start),Ua=Q.x(Re.start),Wt=lt*x+x/2+5,en=We*x+x/2,In=Pe.has(Re.id)&&Pe.has(Re.parentId);return f.jsx("path",{d:`M ${pa} ${Wt} L ${pa} ${en} L ${Ua} ${en}`,className:"trace-viewer__connector"+(In?" is-active":""),vectorEffect:"non-scaling-stroke"},Re.id)})}),xe.map((Re,We)=>{const lt=se+We;return f.jsx("div",{className:"trace-viewer__row-abs",style:{top:lt*x},children:f.jsx(jF,{node:Re,rowHeight:x,scaleX:Q.x,scaleW:Q.w,selected:H===Re.id,hovered:De===Re.id,color:X(Re.service),onSelect:ht=>it(ht,!1),onHover:re})},Re.id)})]})]})})]}),p&&f.jsx("div",{className:"trace-viewer__panel"+(ys?" is-open":""),style:{width:ys?v:0},children:Zn&&f.jsx(uj,{span:Zn,model:B,traceId:(R=O.meta)==null?void 0:R.traceId,resolveColor:X,serviceLabel:ne(Zn.service),serviceHost:(D=Y[Zn.service])==null?void 0:D.host,onClose:ti,onSelect:Re=>it(Re,!1),renderAttributes:M,closeButtonRef:Hn})})]})]})):f.jsx("div",ee($({ref:I,className:fn},E),{children:f.jsx("div",{className:"trace-viewer__empty",children:"No spans in this trace."})}))});RF.displayName="TraceViewer";function dj(e,t){let n;try{n=e()}catch(i){return}return{getItem:i=>{var r;const l=u=>u===null?null:JSON.parse(u,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const ux=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(a){return ux(a)(n)},catch(a){return this}}}catch(n){return{then(a){return this},catch(a){return ux(a)(n)}}}},LF=(e,t)=>(n,a,i)=>{let r=$({storage:dj(()=>window.localStorage),partialize:_=>_,version:0,merge:(_,S)=>$($({},S),_)},t),l=!1,c=0;const u=new Set,h=new Set;let m=r.storage;if(!m)return e((..._)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(..._)},a,i);const p=()=>{const _=r.partialize($({},a()));return m.setItem(r.name,{state:_,version:r.version})},g=i.setState;i.setState=(_,S)=>(g(_,S),p());const v=e((..._)=>(n(..._),p()),a,i);i.getInitialState=()=>v;let x;const b=()=>{var _,S;if(!m)return;const M=++c;l=!1,u.forEach(k=>{var L;return k((L=a())!=null?L:v)});const C=((S=r.onRehydrateStorage)==null?void 0:S.call(r,(_=a())!=null?_:v))||void 0;return ux(m.getItem.bind(m))(r.name).then(k=>{if(k)if(typeof k.version=="number"&&k.version!==r.version){if(r.migrate){const L=r.migrate(k.state,k.version);return L instanceof Promise?L.then(E=>[!0,E]):[!0,L]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,k.state];return[!1,void 0]}).then(k=>{var L;if(M!==c)return;const[E,I]=k;if(x=r.merge(I,(L=a())!=null?L:v),n(x,!0),E)return p()}).then(()=>{M===c&&(C==null||C(x,void 0),x=a(),l=!0,h.forEach(k=>k(x)))}).catch(k=>{M===c&&(C==null||C(void 0,k))})};return i.persist={setOptions:_=>{r=$($({},r),_),_.storage&&(m=_.storage)},clearStorage:()=>{m==null||m.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>b(),hasHydrated:()=>l,onHydrate:_=>(u.add(_),()=>{u.delete(_)}),onFinishHydration:_=>(h.add(_),()=>{h.delete(_)})},r.skipHydration||b(),x||v},TF=LF,hj=[0,1,2],sN=typeof window!="undefined"?window.innerWidth>=1300:!1;function dx(e){typeof document!="undefined"&&document.body.classList.toggle("dark-canvas",e)}const bc=(e,t)=>`${e}:${t}`,AF="dr-viewer-ui-preferences",IF={getItem:e=>typeof window!="undefined"?window.localStorage.getItem(e):null,setItem:(e,t)=>{typeof window!="undefined"&&window.localStorage.setItem(e,t)},removeItem:e=>{typeof window!="undefined"&&window.localStorage.removeItem(e)}},qe=jp()(TF(e=>({view:"model",layerId:null,selectedId:null,selectedEdgeId:null,highlightedEdgeId:null,changesetId:null,canvasDark:!0,chatOpen:sN,wide:sN,mode:"graph",navSeq:0,graphViewport:null,focus:"layer",expandedSections:new Set(["model"]),expandedLayers:new Set,graphLayout:"organic",showClusterBoundaries:!0,showAllRelations:!0,nodeMarginPreset:"default",nodeDisplay:"card",showInterLayerNodes:!0,inspectorFollow:1,setView:t=>e({view:t}),selectLayer:t=>e(n=>{const a=new Set(n.expandedLayers);return a.add(bc(n.view,t)),{layerId:t,selectedId:null,selectedEdgeId:null,highlightedEdgeId:null,focus:"layer",expandedSections:new Set(n.expandedSections).add(n.view),expandedLayers:a}}),selectNode:t=>e({selectedId:t,selectedEdgeId:null,highlightedEdgeId:null,focus:"node"}),selectGraphNode:t=>e(n=>({selectedId:t,selectedEdgeId:null,highlightedEdgeId:null,focus:"node",expandedSections:new Set(n.expandedSections).add(n.view),expandedLayers:n.layerId?new Set(n.expandedLayers).add(bc(n.view,n.layerId)):n.expandedLayers})),selectEdge:t=>e({selectedEdgeId:t,selectedId:null,highlightedEdgeId:null,focus:"layer"}),setHighlightedEdgeId:t=>e({highlightedEdgeId:t}),clearEdgeSelection:()=>e({selectedEdgeId:null,highlightedEdgeId:null}),navigateToElement:(t,n)=>e(a=>{const r=a.layerId===n?a.expandedLayers:new Set(a.expandedLayers).add(bc("model",n));return{navSeq:a.navSeq+1,view:"model",layerId:n,selectedId:t,selectedEdgeId:null,highlightedEdgeId:null,focus:"node",expandedSections:new Set(a.expandedSections).add("model"),expandedLayers:r}}),navigateToElementWithEdge:(t,n,a)=>e(i=>{const l=i.layerId===n?i.expandedLayers:new Set(i.expandedLayers).add(bc("model",n));return{navSeq:i.navSeq+1,view:"model",mode:"graph",layerId:n,selectedId:t,selectedEdgeId:null,highlightedEdgeId:a,focus:"node",expandedSections:new Set(i.expandedSections).add("model"),expandedLayers:l}}),navigateToSpecNode:(t,n)=>e(a=>{const r=a.layerId===n?a.expandedLayers:new Set(a.expandedLayers).add(bc("spec",n));return{navSeq:a.navSeq+1,view:"spec",layerId:n,selectedId:t,selectedEdgeId:null,highlightedEdgeId:null,focus:"node",expandedSections:new Set(a.expandedSections).add("spec"),expandedLayers:r}}),selectChangeset:t=>e(n=>({view:"changesets",changesetId:t,highlightedEdgeId:null,expandedSections:new Set(n.expandedSections).add("changesets")})),setMode:t=>e({mode:t}),toggleCanvasDark:()=>e(t=>{const n=!t.canvasDark;return dx(n),{canvasDark:n}}),toggleChat:()=>e(t=>({chatOpen:!t.chatOpen})),toggleSection:t=>e(n=>{const a=new Set(n.expandedSections);a.has(t)?a.delete(t):a.add(t);const i=n.view!==t;return $({view:t,expandedSections:a},i?{selectedId:null,selectedEdgeId:null,highlightedEdgeId:null,focus:"layer"}:{})}),toggleLayer:(t,n)=>e(a=>{const i=bc(t,n),r=new Set(a.expandedLayers),l=r.has(i);return l?r.delete(i):r.add(i),{view:t,layerId:n,selectedId:l?a.selectedId:null,selectedEdgeId:l?a.selectedEdgeId:null,highlightedEdgeId:l?a.highlightedEdgeId:null,focus:l?a.focus:"layer",expandedSections:new Set(a.expandedSections).add(t),expandedLayers:r}}),setWide:t=>e({wide:t}),setGraphLayout:t=>e({graphLayout:t}),toggleClusterBoundaries:()=>e(t=>({showClusterBoundaries:!t.showClusterBoundaries})),toggleShowAllRelations:()=>e(t=>({showAllRelations:!t.showAllRelations})),setNodeMarginPreset:t=>e({nodeMarginPreset:t}),setNodeDisplay:t=>e({nodeDisplay:t}),toggleShowInterLayerNodes:()=>e(t=>({showInterLayerNodes:!t.showInterLayerNodes})),setInspectorFollow:t=>e({inspectorFollow:t}),setGraphViewport:t=>e({graphViewport:t})}),{name:AF,version:1,storage:dj(()=>IF),partialize:e=>({canvasDark:e.canvasDark,chatOpen:e.chatOpen,graphLayout:e.graphLayout,showClusterBoundaries:e.showClusterBoundaries,showAllRelations:e.showAllRelations,nodeMarginPreset:e.nodeMarginPreset,nodeDisplay:e.nodeDisplay,showInterLayerNodes:e.showInterLayerNodes,inspectorFollow:e.inspectorFollow}),onRehydrateStorage:()=>e=>{e&&dx(e.canvasDark)}}));typeof document!="undefined"&&dx(qe.getState().canvasDark);const DF=new Set(["force-clustered","organic","orthogonal"]),OF=new Set(["tight","default","wide"]),zF=new Set(["card","pill"]);{const e=qe.getState(),t={};DF.has(e.graphLayout)||(t.graphLayout="organic"),OF.has(e.nodeMarginPreset)||(t.nodeMarginPreset="default"),zF.has(e.nodeDisplay)||(t.nodeDisplay="card"),typeof e.showInterLayerNodes!="boolean"&&(t.showInterLayerNodes=!0),hj.includes(e.inspectorFollow)||(t.inspectorFollow=1),Object.keys(t).length>0&&qe.setState(t)}typeof window!="undefined"&&window.addEventListener("resize",()=>{const e=window.innerWidth>=1300;e!==qe.getState().wide&&qe.getState().setWide(e)});const vd=jp(e=>({state:"disconnected",reconnectAttempt:0,reconnectDelay:0,lastError:null,lastConnectedAt:null,lastDisconnectedAt:null,setConnecting:()=>e({state:"connecting",lastError:null}),setConnected:()=>e({state:"connected",reconnectAttempt:0,reconnectDelay:0,lastError:null,lastConnectedAt:new Date}),setDisconnected:()=>e({state:"disconnected",lastDisconnectedAt:new Date}),setReconnecting:(t,n)=>e({state:"reconnecting",reconnectAttempt:t,reconnectDelay:n}),setError:t=>e({state:"error",lastError:t}),reset:()=>e({state:"disconnected",reconnectAttempt:0,reconnectDelay:0,lastError:null,lastConnectedAt:null,lastDisconnectedAt:null})})),BF={connected:{label:"connected",color:"#10B981"},connecting:{label:"connecting",color:"#FBBF24"},reconnecting:{label:"reconnecting",color:"#FBBF24"},disconnected:{label:"disconnected",color:"#64748B"},error:{label:"disconnected",color:"#F43F5E"}},$F=[{value:"light",label:"light"},{value:"dark",label:"dark"}];function UF(){const e=qe(l=>l.canvasDark),t=qe(l=>l.toggleCanvasDark),n=qe(l=>l.chatOpen),a=qe(l=>l.toggleChat),i=vd(l=>l.state),r=BF[i];return f.jsxs("div",{style:{height:54,flex:"none",display:"flex",alignItems:"center",gap:18,padding:"0 16px",background:"rgb(var(--shell-bg-2))",borderBottom:"1px solid rgb(var(--shell-border))"},children:[f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[f.jsx("div",{style:{width:24,height:24,borderRadius:6,background:"linear-gradient(135deg,#FBBF24,#B45309)",display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"'JetBrains Mono',monospace",fontWeight:700,fontSize:12,color:"#1B1206"},children:"dr"}),f.jsxs("div",{style:{display:"flex",flexDirection:"column",lineHeight:1.15},children:[f.jsx("span",{style:{fontSize:13,fontWeight:600,color:"rgb(var(--shell-fg-1))"},children:"Documentation Robotics"}),f.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.08em",color:"rgb(var(--shell-fg-3))"},children:"architecture viewer"})]})]}),f.jsx("div",{style:{flex:1}}),f.jsx(ps,{value:e?"dark":"light",onChange:l=>{l==="dark"!==e&&t()},options:$F,"aria-label":"Canvas theme"}),f.jsxs("button",{type:"button",onClick:a,"aria-pressed":n,style:{display:"flex",alignItems:"center",gap:7,padding:"6px 12px",borderRadius:7,fontSize:12,fontWeight:500,fontFamily:"inherit",cursor:"pointer",transition:"all .12s",background:n?"rgb(var(--shell-surface))":"transparent",color:n?"rgb(var(--shell-fg-1))":"rgb(var(--shell-fg-2))",border:n?"1px solid rgb(var(--shell-border-2))":"1px solid rgb(var(--shell-border))"},children:[f.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#FBBF24",display:"inline-block"}}),"DrBot"]}),f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,paddingLeft:4},"data-testid":"connection-status","data-state":i,children:[f.jsx("span",{style:{position:"relative",width:8,height:8},children:f.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:r.color}})}),f.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--shell-fg-2))"},children:r.label})]})]})}const A0=["motivation","business","security","application","technology","api","data-model","data-store","ux","navigation","apm","testing"],fj={motivation:"#8B5CF6",business:"#F59E0B",security:"#F43F5E",application:"#818CF8",technology:"#22D3EE",api:"#10B981","data-model":"#2DD4BF","data-store":"#38BDF8",ux:"#F472B6",navigation:"#A78BFA",apm:"#FB923C",testing:"#4ADE80"},FF={motivation:"Motivation",business:"Business",security:"Security",application:"Application",technology:"Technology",api:"API","data-model":"Data Model","data-store":"Data Store",ux:"UX",navigation:"Navigation",apm:"APM",testing:"Testing"},PF={motivation:"ArchiMate 3.2",business:"ArchiMate 3.2",security:"NIST SP 800-53",application:"ArchiMate 3.2",technology:"ArchiMate 3.2",api:"OpenAPI 3.0","data-model":"JSON Schema Draft 7","data-store":"ISO/IEC 9075 (SQL)",ux:"HTML 5.3",navigation:"SPA Navigation Patterns",apm:"OpenTelemetry",testing:"IEEE 829-2008"},HF="#6B7280";function Kp(e){return e in fj}function Ls(e){return e&&Kp(e)?fj[e]:HF}function Sa(e){return e&&Kp(e)?FF[e]:e?e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "):""}function Qp(e){return e&&Kp(e)?PF[e]:""}const Sn={JSONRPC_MESSAGE_PARSE_FAILED:"JSONRPC_001",JSONRPC_ATTACH_LISTENER_FAILED:"JSONRPC_002",JSONRPC_ATTACH_LISTENER_BACKGROUND_FAILED:"JSONRPC_003",JSONRPC_SEND_REQUEST_FAILED:"JSONRPC_004",JSONRPC_SEND_NOTIFICATION_FAILED:"JSONRPC_005",JSONRPC_NOTIFICATION_HANDLER_ERROR:"JSONRPC_006",JSONRPC_HANDLE_NOTIFICATION_ERROR:"JSONRPC_007",JSONRPC_MESSAGE_HANDLER_ERROR:"JSONRPC_008",JSONRPC_WEBSOCKET_LOAD_FAILED:"JSONRPC_009",JSONRPC_UNKNOWN_RESPONSE_ID:"JSONRPC_010",CHAT_GET_STATUS_FAILED:"CHAT_001",CHAT_SEND_FAILED:"CHAT_002",CHAT_CANCEL_FAILED:"CHAT_003",WS_CONNECTION_ERROR:"WS_001",WS_MESSAGE_PARSE_FAILED:"WS_002",WS_ERROR_EVENT:"WS_003",WS_EVENT_HANDLER_ERROR:"WS_004",WS_MAX_RECONNECT_ATTEMPTS:"WS_005",WS_SEND_FAILED:"WS_006",WS_NOT_CONNECTED:"WS_007",SPEC_CONVERSION_FAILED:"DATA_001",DATA_LOADER_SUCCESS_CALLBACK_FAILED:"DATA_002",DATA_LOADER_ERROR_CALLBACK_FAILED:"DATA_003",DATA_NORMALIZATION_FAILED:"DATA_004",DATA_LOADER_LOAD_FAILED:"DATA_005",ANNOTATION_CREATE_FAILED:"ANNOTATION_001",ANNOTATION_DELETE_FAILED:"ANNOTATION_002",ANNOTATION_RESOLVE_FAILED:"ANNOTATION_003",ANNOTATION_REPLY_FAILED:"ANNOTATION_004",ANNOTATION_DELETE_ROLLBACK_FAILED:"ANNOTATION_005",SESSION_STORAGE_PARSE_ERROR:"STORAGE_001",AUTH_COOKIE_DECODE_FAILED:"AUTH_001",AUTH_REQUEST_FAILED:"AUTH_002"};var Qe=(e=>(e.VALIDATION_ERROR="validation_error",e.NOT_FOUND="not_found",e.NETWORK_ERROR="network_error",e.TIMEOUT="timeout",e.UNAUTHORIZED="unauthorized",e.RATE_LIMITED="rate_limited",e.RESOURCE_EXHAUSTED="resource_exhausted",e.CONFLICT="conflict",e.EXTERNAL_SERVICE_ERROR="external_service_error",e.ASSERTION_FAILED="assertion_failed",e.INVALID_STATE="invalid_state",e.NOT_IMPLEMENTED="not_implemented",e.TYPE_ERROR="type_error",e.PARSE_ERROR="parse_error",e.LOGIC_ERROR="logic_error",e.NULL_REFERENCE="null_reference",e.INTERNAL_ERROR="internal_error",e))(Qe||{}),Go=(e=>(e.LOW="low",e.MEDIUM="medium",e.HIGH="high",e.CRITICAL="critical",e))(Go||{}),Ys=(e=>(e.RETRY="retry",e.EXPONENTIAL_BACKOFF="exponential_backoff",e.FALLBACK="fallback",e.USER_ACTION="user_action",e.RELOAD="reload",e.NONE="none",e))(Ys||{});const ba={network:/network|fetch|offline|connection|timeout|ERR_NAME_NOT_RESOLVED|ERR_INTERNET_DISCONNECTED/i,timeout:/timeout|timed out|deadline|took too long/i,networkDetail:{dns:/dns|name.*not.*resolved|ERR_NAME_NOT_RESOLVED/i,timeout:/timeout|timed out|deadline/i},unauthorized:/401|unauthorized|forbidden|not authorized|credentials/i,notFound:/404|not found|does not exist|resource.*not.*found/i,rateLimited:/429|rate limit|too many requests|quota|throttle/i,conflict:/409|conflict|duplicate|already.*exists|constraint/i,serverError:/500|502|503|504|internal.*error|service.*unavailable|gateway/i,validation:/validation|must be|required|bad request|email.*valid|password.*valid|field.*invalid/i,parseError:/parse|syntax|unexpected token|json|xml|invalid.*format/i,typeError:/type|not a function|is not a|undefined|null|cannot read|cannot set/i,resourceExhausted:/out of memory|quota|storage|disk|heap|too large|maximum/i,assertionFailed:/assertion.*failed|assert.*failed/i,invalidState:/invalid state|invariant|unreachable|should not happen/i,externalService:/third.?party|external|webhook|provider|service.*failed/i};function qF(e,t,n,a){const i=Date.now(),r=n==null?void 0:n.stack,l=`${t} ${(n==null?void 0:n.message)||""}`.toLowerCase(),c=VF(l,n),u=YF(c,a),h=GF(c),m=KF(c,l),p=QF(c,m),g=m&&XF(c),v=WF(c,t),x=tP(a,c);return{errorId:e,message:t,originalError:n,category:c,severity:u,isExpectedFailure:h,isTransient:m,recoveryStrategy:p,canRetry:g,maxRetryAttempts:ZF(c),retryDelayMs:JF(c),context:a,userFacingMessage:v,devMessage:eP(c,t,n),timestamp:i,stackTrace:r,affectedFeatures:x}}function VF(e,t){return t instanceof TypeError?Qe.TYPE_ERROR:t instanceof SyntaxError?Qe.PARSE_ERROR:t instanceof RangeError?Qe.RESOURCE_EXHAUSTED:ba.network.test(e)?ba.networkDetail.timeout.test(e)?Qe.TIMEOUT:(ba.networkDetail.dns.test(e),Qe.NETWORK_ERROR):ba.timeout.test(e)?Qe.TIMEOUT:ba.unauthorized.test(e)?Qe.UNAUTHORIZED:ba.notFound.test(e)?Qe.NOT_FOUND:ba.rateLimited.test(e)?Qe.RATE_LIMITED:ba.conflict.test(e)?Qe.CONFLICT:ba.serverError.test(e)?Qe.EXTERNAL_SERVICE_ERROR:ba.assertionFailed.test(e)?Qe.ASSERTION_FAILED:ba.validation.test(e)&&!ba.invalidState.test(e)&&!ba.assertionFailed.test(e)?Qe.VALIDATION_ERROR:ba.invalidState.test(e)?Qe.INVALID_STATE:ba.parseError.test(e)?Qe.PARSE_ERROR:ba.typeError.test(e)?Qe.TYPE_ERROR:ba.resourceExhausted.test(e)?Qe.RESOURCE_EXHAUSTED:ba.externalService.test(e)?Qe.EXTERNAL_SERVICE_ERROR:Qe.INTERNAL_ERROR}function YF(e,t){return t!=null&&t.isCritical||e===Qe.ASSERTION_FAILED||e===Qe.INVALID_STATE||e===Qe.NULL_REFERENCE||e===Qe.TYPE_ERROR?Go.CRITICAL:e===Qe.UNAUTHORIZED||e===Qe.NETWORK_ERROR||e===Qe.TIMEOUT||e===Qe.EXTERNAL_SERVICE_ERROR?Go.HIGH:e===Qe.VALIDATION_ERROR||e===Qe.NOT_FOUND||e===Qe.PARSE_ERROR||e===Qe.CONFLICT?Go.MEDIUM:e===Qe.RATE_LIMITED||e===Qe.RESOURCE_EXHAUSTED?Go.LOW:Go.MEDIUM}function GF(e){return[Qe.VALIDATION_ERROR,Qe.NOT_FOUND,Qe.NETWORK_ERROR,Qe.TIMEOUT,Qe.UNAUTHORIZED,Qe.RATE_LIMITED,Qe.RESOURCE_EXHAUSTED,Qe.CONFLICT,Qe.EXTERNAL_SERVICE_ERROR,Qe.PARSE_ERROR].includes(e)}function KF(e,t){const n=[Qe.NETWORK_ERROR,Qe.TIMEOUT,Qe.RATE_LIMITED,Qe.EXTERNAL_SERVICE_ERROR];return e===Qe.RESOURCE_EXHAUSTED?!t.includes("permanent")&&!t.includes("quota"):n.includes(e)}function QF(e,t){return e===Qe.ASSERTION_FAILED||e===Qe.INVALID_STATE||e===Qe.NOT_IMPLEMENTED||e===Qe.TYPE_ERROR||e===Qe.NULL_REFERENCE||e===Qe.LOGIC_ERROR?Ys.NONE:e===Qe.NETWORK_ERROR&&t||e===Qe.TIMEOUT&&t||e===Qe.EXTERNAL_SERVICE_ERROR&&t||e===Qe.RATE_LIMITED?Ys.EXPONENTIAL_BACKOFF:e===Qe.UNAUTHORIZED||e===Qe.VALIDATION_ERROR||e===Qe.NOT_FOUND?Ys.USER_ACTION:e===Qe.CONFLICT?Ys.FALLBACK:(e===Qe.PARSE_ERROR,Ys.NONE)}function XF(e){return[Qe.NETWORK_ERROR,Qe.TIMEOUT,Qe.RATE_LIMITED,Qe.EXTERNAL_SERVICE_ERROR,Qe.RESOURCE_EXHAUSTED].includes(e)}function ZF(e){switch(e){case Qe.NETWORK_ERROR:case Qe.TIMEOUT:return 3;case Qe.EXTERNAL_SERVICE_ERROR:return 2;case Qe.RATE_LIMITED:return 1;case Qe.RESOURCE_EXHAUSTED:return 2;default:return}}function JF(e){switch(e){case Qe.NETWORK_ERROR:return 500;case Qe.TIMEOUT:return 1e3;case Qe.EXTERNAL_SERVICE_ERROR:return 1e3;case Qe.RATE_LIMITED:return 5e3;case Qe.RESOURCE_EXHAUSTED:return 2e3;default:return}}function WF(e,t){switch(e){case Qe.NETWORK_ERROR:return"Network connection failed. Please check your internet connection.";case Qe.TIMEOUT:return"The operation took too long. Please try again.";case Qe.UNAUTHORIZED:return"Your session has expired. Please log in again.";case Qe.NOT_FOUND:return"The requested resource was not found.";case Qe.RATE_LIMITED:return"Too many requests. Please wait before trying again.";case Qe.RESOURCE_EXHAUSTED:return"System resources are temporarily exhausted. Please try again.";case Qe.VALIDATION_ERROR:return`Invalid input: ${t}`;case Qe.CONFLICT:return"This resource has been modified by someone else. Please refresh and try again.";case Qe.EXTERNAL_SERVICE_ERROR:return"External service is temporarily unavailable. Please try again.";case Qe.PARSE_ERROR:return"Unable to process the response. Please try again or contact support.";case Qe.ASSERTION_FAILED:case Qe.INVALID_STATE:case Qe.TYPE_ERROR:case Qe.NULL_REFERENCE:case Qe.INTERNAL_ERROR:return"An unexpected error occurred. Please refresh the page or contact support.";default:return"An error occurred. Please try again."}}function eP(e,t,n){var r;return[`[${((r=Object.entries(Qe).find(([,l])=>l===e))==null?void 0:r[0])||"UNKNOWN"}] ${t}`,n!=null&&n.message?`Original: ${n.message}`:""].filter(Boolean).join(" | ")}function tP(e,t){const n=[];return e!=null&&e.feature&&typeof e.feature=="string"&&n.push(e.feature),e!=null&&e.layer&&typeof e.layer=="string"&&n.push(`${e.layer}_layer`),t===Qe.NETWORK_ERROR?n.push("data_sync","websocket","api_calls"):t===Qe.EXTERNAL_SERVICE_ERROR&&n.push("export","integrations"),[...new Set(n)]}function Tn(e,t,n,a){const i=new Date().toISOString(),r=qF(e,t,a,n),l={errorId:e,message:t,timestamp:i,context:n||{},category:r.category,severity:r.severity,isExpectedFailure:r.isExpectedFailure,isTransient:r.isTransient,recoveryStrategy:r.recoveryStrategy,canRetry:r.canRetry,affectedFeatures:r.affectedFeatures};if(typeof window!="undefined")try{const c=window.__SENTRY__;if(c&&c.captureException){const u=a||new Error(t);u.errorId=e,u.context=n,u.category=r.category,u.severity=r.severity,u.isExpectedFailure=r.isExpectedFailure,u.isTransient=r.isTransient,u.recoveryStrategy=r.recoveryStrategy,c.setTag("error_id",e),c.setTag("error_category",r.category),c.setTag("error_severity",r.severity),c.setTag("is_expected",String(r.isExpectedFailure)),c.setTag("is_transient",String(r.isTransient)),c.captureException(u)}}catch(c){console.warn("[ErrorTracker] Failed to capture error in Sentry:",c instanceof Error?c.message:String(c),{errorId:e,message:t})}if(e!==Sn.SESSION_STORAGE_PARSE_ERROR&&typeof sessionStorage!="undefined")try{const c="app:error_log",u=sessionStorage.getItem(c),h=u?JSON.parse(u):[];h.push(l),h.length>50&&h.shift(),sessionStorage.setItem(c,JSON.stringify(h))}catch(c){console.warn("[ErrorTracker] Failed to store error log in session storage:",c instanceof Error?c.message:String(c),{errorId:e,message:t})}return r}function xd(e,t){const n=new Date().toISOString();if(console.warn(e),typeof sessionStorage!="undefined")try{const a="app:warning_log",i=sessionStorage.getItem(a),r=i?JSON.parse(i):[];r.push({message:e,timestamp:n,context:t||{}}),r.length>50&&r.shift(),sessionStorage.setItem(a,JSON.stringify(r))}catch(a){console.warn("[ErrorTracker] Failed to store warning log in session storage:",a instanceof Error?a.message:String(a),{message:e})}}const nP=0,Zr=1,aP=2,sP=3;class pj{constructor(t,n=null){nn(this,"ws",null);nn(this,"url");nn(this,"token",null);nn(this,"reconnectAttempts",0);nn(this,"maxReconnectAttempts",10);nn(this,"reconnectDelay",1e3);nn(this,"maxReconnectDelay",3e4);nn(this,"reconnectTimer",null);nn(this,"heartbeatTimer",null);nn(this,"heartbeatInterval",3e4);nn(this,"eventHandlers",new Map);nn(this,"isIntentionallyClosed",!1);nn(this,"subscribedTopics",[]);nn(this,"mode","detecting");nn(this,"connectionTimeout",null);nn(this,"maxConnectionAttempts",3);nn(this,"connectionErrors",[]);this.url=t,this.token=n}setToken(t){this.token=t,console.log("[WebSocket] Token updated:",t?"present":"cleared")}getAuthProtocols(){if(this.token)return["token",this.token]}connect(){if(this.ws&&this.ws.readyState===Zr){console.log("[WebSocket] Already connected");return}if(this.mode==="rest"){console.log("[WebSocket] Using REST mode, skipping WebSocket connection"),this.emit("rest-mode",{});return}this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.close(),this.ws=null),this.isIntentionallyClosed=!1,this.mode==="detecting"&&console.log(`[WebSocket] Attempting WebSocket connection (attempt ${this.reconnectAttempts+1}/${this.maxConnectionAttempts})...`);try{const t=this.getAuthProtocols();this.ws=new WebSocket(this.url,t),this.ws.onopen=this.handleOpen.bind(this),this.ws.onmessage=this.handleMessage.bind(this),this.ws.onerror=this.handleError.bind(this),this.ws.onclose=this.handleClose.bind(this),this.mode==="detecting"&&(this.connectionTimeout=setTimeout(()=>{this.ws&&this.ws.readyState!==Zr&&(console.log("[WebSocket] Connection timeout during detection phase"),this.ws.close())},3e3))}catch(t){this.mode==="detecting"?(console.debug("[WebSocket] Connection error during detection:",t),this.handleConnectionFailure(),this.connectionErrors.push(t instanceof Error?t:new Error(String(t)))):(Tn(Sn.WS_CONNECTION_ERROR,"WebSocket connection error",{error:t instanceof Error?t.message:String(t)}),this.scheduleReconnect())}}getConnectionErrors(){return[...this.connectionErrors]}isTestEnvironment(){return hx()}triggerCloseForTesting(){this.isTestEnvironment()&&(this.ws&&this.ws.readyState===Zr?(console.log("[WebSocket] TEST: Forcing close event"),this.ws.close(1e3,"Test-triggered close")):console.warn("[WebSocket] TEST: Cannot close, not connected"))}simulateMaxReconnectAttemptsForTesting(){this.isTestEnvironment()&&(console.log("[WebSocket] TEST: Simulating max reconnect attempts"),this.reconnectAttempts=this.maxReconnectAttempts,Tn(Sn.WS_MAX_RECONNECT_ATTEMPTS,"Max reconnection attempts reached (TEST SIMULATION)",{attempts:this.reconnectAttempts}),this.emit("max-reconnect-attempts",{attempts:this.reconnectAttempts}))}disconnect(){this.isIntentionallyClosed=!0,this.stopHeartbeat(),this.cancelReconnect(),this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=null),this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.close(),this.ws=null),console.log("[WebSocket] Disconnected"),this.emit("disconnect",{})}subscribe(t){this.subscribedTopics=t,this.ws&&this.ws.readyState===Zr&&this.send({type:"subscribe",topics:t})}send(t){var n;if(this.ws&&this.ws.readyState===Zr)try{return this.ws.send(JSON.stringify(t)),!0}catch(a){return Tn(Sn.WS_SEND_FAILED,"Failed to send WebSocket message",{error:a instanceof Error?a.message:String(a),message:t}),!1}else return Tn(Sn.WS_NOT_CONNECTED,"Cannot send message, WebSocket not connected",{connectionState:(n=this.ws)==null?void 0:n.readyState,message:t}),!1}on(t,n){this.eventHandlers.has(t)||this.eventHandlers.set(t,new Set),this.eventHandlers.get(t).add(n)}off(t,n){const a=this.eventHandlers.get(t);a&&a.delete(n)}get isConnected(){return this.ws!==null&&this.ws.readyState===Zr}get connectionState(){if(!this.ws)return this.reconnectTimer?"reconnecting":"disconnected";switch(this.ws.readyState){case nP:return"connecting";case Zr:return"connected";case aP:case sP:return this.reconnectTimer?"reconnecting":"disconnected";default:return"disconnected"}}get transportMode(){return this.mode}handleConnectionFailure(){this.reconnectAttempts++,this.reconnectAttempts>=this.maxConnectionAttempts?(console.log("[WebSocket] Server does not support WebSocket, using REST mode"),this.connectionErrors.length>0&&(console.warn("[WebSocket] Connection attempts failed with the following errors:"),this.connectionErrors.forEach((t,n)=>{console.warn(` [${n+1}] ${t.message}`)})),this.mode="rest",this.reconnectAttempts=0,this.emit("rest-mode",{}),this.emit("connect",{})):setTimeout(()=>this.connect(),500)}handleOpen(){this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=null),console.log("[WebSocket] Connected successfully"),this.mode="websocket",this.reconnectAttempts=0,this.reconnectDelay=1e3,this.startHeartbeat(),this.emit("connect",{}),this.subscribedTopics.length>0&&this.subscribe(this.subscribedTopics)}handleMessage(t){var n;try{const a=JSON.parse(t.data),i=(n=a.type)!=null?n:"message";console.log("[WebSocket] Received:",i),this.emit(i,a),i!=="message"&&this.emit("message",a)}catch(a){Tn(Sn.WS_MESSAGE_PARSE_FAILED,"Failed to parse WebSocket message",{error:a instanceof Error?a.message:String(a),data:t.data})}}handleError(t){const n=hx();if(this.mode==="detecting"){const a=t instanceof ErrorEvent?t.message:String(t);this.connectionErrors.push(new Error(`[Attempt ${this.reconnectAttempts+1}/${this.maxConnectionAttempts}] ${a}`)),console.debug("[WebSocket] Connection error during detection (attempt %d/%d): %s",this.reconnectAttempts+1,this.maxConnectionAttempts,a)}else n?console.debug("[WebSocket] Error in test environment:",t):Tn(Sn.WS_ERROR_EVENT,"WebSocket error event",{error:t instanceof ErrorEvent?t.message:String(t)});this.emit("error",{kind:"event",error:t})}handleClose(t){if(this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=null),this.mode==="detecting"){this.handleConnectionFailure();return}console.log(`[WebSocket] Closed (code: ${t.code}, reason: ${t.reason})`),this.stopHeartbeat(),this.emit("close",{code:t.code,reason:t.reason}),!this.isIntentionallyClosed&&this.mode!=="rest"&&this.scheduleReconnect()}scheduleReconnect(){if(this.isIntentionallyClosed)return;if(this.reconnectAttempts>=this.maxReconnectAttempts){Tn(Sn.WS_MAX_RECONNECT_ATTEMPTS,"Max reconnection attempts reached",{attempts:this.reconnectAttempts}),this.emit("max-reconnect-attempts",{attempts:this.reconnectAttempts});return}this.reconnectAttempts++;const t=Math.min(this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1),this.maxReconnectDelay);console.log(`[WebSocket] Reconnecting in ${t}ms (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts})`),this.emit("reconnecting",{attempt:this.reconnectAttempts,delay:t}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}cancelReconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=setInterval(()=>{this.ws&&this.ws.readyState===Zr&&this.send({type:"ping"})},this.heartbeatInterval)}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}emit(t,n){const a=this.eventHandlers.get(t);a&&a.forEach(i=>{try{i(n)}catch(r){Tn(Sn.WS_EVENT_HANDLER_ERROR,`Error in WebSocket event handler for '${t}'`,{error:r instanceof Error?r.message:String(r),event:t})}})}}function hx(){return typeof window=="undefined"?!1:!!(window.__PLAYWRIGHT__||window.__STORYBOOK_MOCK_WEBSOCKET__||window.__karma__||window.jasmine||window.jest)}let an;if(typeof window!="undefined"){const t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;an=new pj(t,null)}else{const e=new Map;an={setToken:()=>{},connect:()=>{setTimeout(()=>{const t=e.get("error");t&&t.forEach(a=>a({code:"SSR_ENVIRONMENT",message:"WebSocket not available in SSR/Node.js environment"}));const n=e.get("rest-mode");n&&n.forEach(a=>a({}))},0)},disconnect:()=>{},subscribe:()=>{},send:()=>(Tn(Sn.WS_SEND_FAILED,"Cannot send message in SSR/Node.js environment - use REST API instead",{environment:"SSR/Node.js"}),!1),on:(t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},off:(t,n)=>{const a=e.get(t);a&&a.delete(n)},get isConnected(){return!1},get connectionState(){return"disconnected"},get transportMode(){return"rest"}}}typeof window!="undefined"&&hx()&&(window.__WEBSOCKET_CLIENT__=an);const iP=Object.freeze(Object.defineProperty({__proto__:null,WebSocketClient:pj,get websocketClient(){return an}},Symbol.toStringTag,{value:"Module"})),rP={nodes:[],links:[],countsByLayer:{},nodesByLayer:{},relCount:0};function fr(){const e=HT(),t=e.data,n=j.useMemo(()=>{var r,l,c,u,h;if(!(t!=null&&t.nodes))return rP;const a={},i={};for(const m of t.nodes){const p=m.layer_id;p&&(a[p]=((r=a[p])!=null?r:0)+1,((l=i[p])!=null?l:i[p]=[]).push(m))}return{nodes:t.nodes,links:(c=t.links)!=null?c:[],countsByLayer:a,nodesByLayer:i,relCount:(h=(u=t.links)==null?void 0:u.length)!=null?h:0}},[t]);return ee($({},e),{derived:n})}function oP(){const e=fi();j.useEffect(()=>{const t=()=>{e.invalidateQueries({queryKey:["getapimodel"]}),e.invalidateQueries({queryKey:["getapilayerslayerName"]}),e.invalidateQueries({queryKey:["getapichangesets"]}),e.invalidateQueries({queryKey:["getapichangesetschangesetId"]})};return an.on(iN,t),()=>an.off(iN,t)},[e])}const iN="model.updated",lP={version:"",byLayer:{}};function pr(){const e=qT(),t=e.data,n=j.useMemo(()=>{var i,r,l,c;if(!(t!=null&&t.schemas))return lP;const a={};for(const u of Object.values(t.schemas)){const h=u,m=h.layer;if(!(m!=null&&m.id))continue;const p=(i=h.nodeSchemas)!=null?i:{},g=Object.keys(p);a[m.id]={typeCount:g.length,typeIds:g,typeTitles:g.map(v=>{var x,b;return(b=(x=p[v])==null?void 0:x.title)!=null?b:v}),standard:(l=(r=m.inspired_by)==null?void 0:r.standard)!=null?l:Qp(m.id)}}return{version:(c=t.version)!=null?c:"",byLayer:a}},[t]);return ee($({},e),{derived:n,raw:t})}const cP={add:{op:"add",label:"ADD",color:"#10B981",colorLight:"#047857",background:"rgba(16,185,129,0.12)"},update:{op:"update",label:"MOD",color:"#22D3EE",colorLight:"#0E7490",background:"rgba(34,211,238,0.12)"},delete:{op:"delete",label:"DEL",color:"#FB7185",colorLight:"#BE123C",background:"rgba(244,63,94,0.12)"}};function mj(e){const t=(e!=null?e:"").toLowerCase();return t.includes("delete")||t==="del"||t==="remove"?"delete":t.includes("add")||t==="create"?"add":"update"}function ov(e){var n;if(!e)return"element";const t=(n=e.type)!=null?n:e.predicate;return typeof t=="string"&&t.length>0?t:"element"}function Cp(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Cp).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${Cp(t[n])}`).join(",")}}`}function uP(e,t){if(!e||!t)return[];const n=new Set([...Object.keys(e),...Object.keys(t)]),a=[];for(const i of n)Cp(e[i])!==Cp(t[i])&&a.push(i);return a}function dP(e){var r,l,c;const t=mj(e.type);if(t==="add")return((r=e.type)!=null?r:"").includes("relationship")?"Added relationship":`Added ${ov(e.after)}`;if(t==="delete")return((l=e.type)!=null?l:"").includes("relationship")?"Removed relationship":`Removed ${ov(e.before)}`;const n=uP(e.before,e.after);if(n.length===0)return`Updated ${ov((c=e.after)!=null?c:e.before)}`;const a=n.slice(0,3).join(", "),i=n.length>3?` +${n.length-3} more`:"";return`Changed ${a}${i}`}function hP(e,t){var i,r,l;const n=mj(e.type),a=(i=e.elementId)!=null?i:"(unknown)";return{key:`${a}::${(r=e.sequenceNumber)!=null?r:t}`,op:n,meta:cP[n],elementId:a,layerName:(l=e.layerName)!=null?l:"",detail:dP(e),hasDiff:!!e.before||!!e.after,raw:e}}function fP(e){return e?e.map(hP):[]}function pP(e){const t=e.before?JSON.stringify(e.before,null,2):"",n=e.after?JSON.stringify(e.after,null,2):"",a=t?t.split(`
|
|
80
|
+
`):[],i=n?n.split(`
|
|
81
|
+
`):[],r=new Set(a),l=new Set(i),c=[];for(const u of a)l.has(u)||c.push({type:"removed",content:u});for(const u of i)r.has(u)||c.push({type:"added",content:u});return c}function mP(e,t){if(!t)return e;const{additions:n,modifications:a,deletions:i}=t;return`${n} additions · ${a} modifications · ${i} deletions in this changeset.`}const gP={list:[]};function nh(){const e=VT(),t=e.data,n=j.useMemo(()=>{const a=t==null?void 0:t.changesets;if(!a)return gP;const i=Object.entries(a).map(([r,l])=>{var c,u,h,m;return{id:r,name:(c=l.name)!=null?c:r,status:(u=l.status)!=null?u:"unknown",created:(h=l.created)!=null?h:"",changesCount:(m=l.changes_count)!=null?m:0}});return i.sort((r,l)=>l.created.localeCompare(r.created)),{list:i}},[t]);return ee($({},e),{derived:n})}const yP={additions:0,modifications:0,deletions:0};function gj(e){const t=YT(e!=null?e:"",{enabled:!!e}),n=t.data,a=j.useMemo(()=>{var i,r,l,c,u,h,m,p,g,v,x,b,_,S,M,C;return n?{id:(r=(i=n.id)!=null?i:e)!=null?r:"",name:(c=(l=n.name)!=null?l:n.id)!=null?c:"",status:(u=n.status)!=null?u:"unknown",created:(h=n.created)!=null?h:"",modified:(m=n.modified)!=null?m:"",baseSnapshot:(p=n.baseSnapshot)!=null?p:"",stats:{additions:(v=(g=n.stats)==null?void 0:g.additions)!=null?v:0,modifications:(b=(x=n.stats)==null?void 0:x.modifications)!=null?b:0,deletions:(S=(_=n.stats)==null?void 0:_.deletions)!=null?S:0},rows:fP(n.changes),changesCount:(C=(M=n.changes)==null?void 0:M.length)!=null?C:0}:null},[n,e]);return ee($({},t),{detail:a,emptyStats:yP})}function vP(e){var t;return e instanceof Ra?(t=e.serverMessage)!=null?t:e.body.trim()||e.message:e instanceof Error?e.message:String(e)}function xP(){const e=fi();j.useEffect(()=>{const t=()=>{e.invalidateQueries({queryKey:["getapichangesets"]}),e.invalidateQueries({queryKey:["getapichangesetschangesetId"]})};return an.on(rN,t),()=>an.off(rN,t)},[e])}const rN="changesets.updated",bP=[{id:"model",label:"Model",icon:"graph"},{id:"spec",label:"Schema",icon:"schema"},{id:"changesets",label:"Changesets",icon:"clock"}];function yj({open:e}){return f.jsx("span",{style:{position:"absolute",right:12,top:0,bottom:0,display:"flex",alignItems:"center",pointerEvents:"none"},children:f.jsx("span",{className:`drv-chev${e?" drv-chev--open":""}`})})}function _P({section:e}){const t=qe(c=>c.view),n=qe(c=>c.expandedSections),a=qe(c=>c.toggleSection),{derived:i}=nh(),r=n.has(e.id),l=e.id==="changesets"?i.list.length:12;return f.jsxs("div",{style:{position:"relative"},children:[f.jsx(Ad,{icon:e.icon,label:e.label,count:l,active:t===e.id,depth:0,onClick:()=>a(e.id)}),f.jsx(yj,{open:r})]})}function wP({sectionId:e,slug:t}){var M,C,k;const n=qe(L=>L.view),a=qe(L=>L.layerId),i=qe(L=>L.selectedId),r=qe(L=>L.expandedLayers),l=qe(L=>L.toggleLayer),c=qe(L=>L.navigateToElement),u=qe(L=>L.navigateToSpecNode),{derived:h}=fr(),{derived:m}=pr(),p=`${e}:${t}`,g=r.has(p),v=n===e&&a===t,x=m.byLayer[t],b=(M=h.nodesByLayer[t])!=null?M:[],_=e==="spec"?(C=x==null?void 0:x.typeCount)!=null?C:0:b.length,S=e==="spec"?((k=x==null?void 0:x.typeIds)!=null?k:[]).map((L,E)=>{var I;return{id:`${t}.${L}`,label:(I=x==null?void 0:x.typeTitles[E])!=null?I:L}}):b.map(L=>({id:L.id,label:L.name}));return f.jsxs(f.Fragment,{children:[f.jsxs("div",{style:{position:"relative"},children:[f.jsx(Ad,{label:Sa(t),count:_,active:v,depth:1,onClick:()=>l(e,t)}),f.jsx(yj,{open:g})]}),g&&S.map(L=>{const E=n===e&&a===t&&i===L.id;return f.jsx("div",{style:{position:"relative"},children:f.jsx(Ad,{label:L.label,active:E,depth:1,className:"drv-nav-l2",onClick:()=>e==="model"?c(L.id,t):u(L.id,t),title:L.label})},L.id)})]})}function SP(){const e=qe(i=>i.view),t=qe(i=>i.changesetId),n=qe(i=>i.selectChangeset),{derived:a}=nh();return a.list.length===0?f.jsx("div",{style:{padding:"8px 10px 8px 34px",fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--shell-fg-4))"},children:"no changesets"}):f.jsx(f.Fragment,{children:a.list.map(i=>{const r=e==="changesets"&&t===i.id;return f.jsx("div",{style:{position:"relative"},children:f.jsx(Ad,{label:i.name,count:i.changesCount,active:r,depth:1,onClick:()=>n(i.id),title:i.name})},i.id)})})}function NP(){const e=qe(t=>t.expandedSections);return f.jsx("div",{className:"drv-scroll drv-noscroll",style:{flex:1,overflowY:"auto",padding:"8px"},"data-testid":"nav-tree",children:bP.map(t=>{const n=e.has(t.id);return f.jsxs("div",{children:[f.jsx(_P,{section:t}),n&&t.id==="changesets"&&f.jsx(SP,{}),n&&t.id!=="changesets"&&A0.map(a=>f.jsx(wP,{sectionId:t.id,slug:a},a))]},t.id)})})}function kP(){const{derived:e}=fr(),{derived:t}=pr(),n=e.relCount,a=t.version||"—";return f.jsxs("div",{style:{width:244,flex:"none",background:"rgb(var(--shell-bg-2))",borderRight:"1px solid rgb(var(--shell-border))",display:"flex",flexDirection:"column",minHeight:0},"data-testid":"left-rail",children:[f.jsxs("div",{style:{height:40,flex:"none",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 14px",borderBottom:"1px solid rgb(var(--shell-border))"},children:[f.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.1em",textTransform:"uppercase",color:"rgb(var(--shell-fg-3))"},children:"Navigation"}),f.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,color:"rgb(var(--shell-fg-4))"},"data-testid":"rail-count"})]}),f.jsx(NP,{}),f.jsxs("div",{style:{flex:"none",padding:"10px 14px",borderTop:"1px solid rgb(var(--shell-border))",display:"flex",flexDirection:"column",gap:3},"data-testid":"rail-footer",children:[f.jsxs("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.08em",color:"rgb(var(--shell-fg-3))"},children:["SPEC ",a]}),f.jsxs("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,color:"rgb(var(--shell-fg-4))"},children:["12 layers · ",n," rels"]})]})]})}const fx={fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--shell-fg-3))"},oN=ee($({},fx),{color:"rgb(var(--shell-fg-4))"});function CP(){var c;const e=qe(u=>u.layerId),{derived:t}=fr(),{derived:n}=pr(),a=e&&(c=t.countsByLayer[e])!=null?c:0,i=e?Sa(e).toLowerCase():"",r=e?`${a} ${i} elements`:`${t.nodes.length} elements`,l=n.version||"—";return f.jsx(Vx,{style:{height:28},"data-testid":"status-bar",left:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[f.jsx("span",{style:fx,"data-testid":"status-elements",children:r}),f.jsx("span",{style:oN,children:"·"}),f.jsxs("span",{style:fx,children:[t.relCount," refs indexed · 0 unresolved"]})]}),right:f.jsxs("span",{style:oN,children:["cli ",l," · refs ok"]})})}function gs(e,t){var a;return(a=e==null?void 0:e.schemas)==null?void 0:a[`${t}.json`]}function ji(e,t){const n=`${e}.`;if(t.startsWith(n))return t.slice(n.length);const a=t.lastIndexOf(".");return a>=0?t.slice(a+1):t}function vo(e,t,n){var r,l,c;const a=ji(t,n),i=gs(e,t);return(c=(l=(r=i==null?void 0:i.nodeSchemas)==null?void 0:r[a])==null?void 0:l.title)!=null?c:a}function MP(e,t){var r;const n=gs(e,t),a=(r=n==null?void 0:n.nodeSchemas)!=null?r:{};return Object.entries(a).map(([l,c])=>{var u;return{id:`${t}.${l}`,label:(u=c.title)!=null?u:l,kind:"spec node",domainColor:t}})}const jP={"many-to-many":"N:N","one-to-many":"1:N","many-to-one":"N:1","one-to-one":"1:1"};function px(e){var t;return e&&(t=jP[e])!=null?t:""}function EP(e,t){var r;const n=gs(e,t),a=(r=n==null?void 0:n.relationshipSchemas)!=null?r:{},i=[];for(const l of Object.values(a))l.source_layer!==t||l.destination_layer!==t||l.source_spec_node_id!==l.destination_spec_node_id&&i.push({id:l.id,sourceId:l.source_spec_node_id,targetId:l.destination_spec_node_id,label:l.predicate});return i}function vj(e,t){var r;const n=gs(e,t),a=(r=n==null?void 0:n.relationshipSchemas)!=null?r:{};let i=0;for(const l of Object.values(a))l.source_layer===t&&l.destination_layer===t&&(i+=1);return i}function xj(e){var n,a,i;const t=[];for(const r of Object.values((n=e==null?void 0:e.schemas)!=null?n:{})){const l=r;(a=l==null?void 0:l.layer)!=null&&a.id&&t.push(...Object.values((i=l.relationshipSchemas)!=null?i:{}))}return t}function RP(e,t,n){var c;const a=gs(e,t),i=(c=a==null?void 0:a.relationshipSchemas)!=null?c:{},r=[];let l=0;for(const u of Object.values(i)){const h=px(u.cardinality),m=h?`${u.predicate} ${h}`:u.predicate;u.source_spec_node_id===n?r.push({id:`out-${l++}-${u.id}`,target:u.destination_spec_node_id,targetTitle:vo(e,u.destination_layer,u.destination_spec_node_id),targetDomain:u.destination_layer,predicate:m,direction:"out"}):u.destination_spec_node_id===n&&r.push({id:`in-${l++}-${u.id}`,target:u.source_spec_node_id,targetTitle:vo(e,u.source_layer,u.source_spec_node_id),targetDomain:u.source_layer,predicate:m,direction:"in"})}return r}function I0(e){var i,r,l;const t=(i=e==null?void 0:e.properties)==null?void 0:i.attributes,n=new Set((r=t==null?void 0:t.required)!=null?r:[]),a=(l=t==null?void 0:t.properties)!=null?l:{};return Object.entries(a).map(([c,u])=>{var h;return{name:c,type:(h=u==null?void 0:u.type)!=null?h:"object",required:n.has(c)}})}function LP(e,t,n){var c,u;const a=gs(e,t),i=ji(t,n),r=(c=a==null?void 0:a.nodeSchemas)==null?void 0:c[i];if(!r)return null;const l={};for(const h of I0(r))l[h.name]=h.required?"required":"—";return{id:n,title:(u=r.title)!=null?u:i,kind:"SPEC NODE",domain:t,description:r.description,metadata:l}}function TP(e,t,n){var c;const a=gs(e,t),i=(c=a==null?void 0:a.relationshipSchemas)!=null?c:{},r=[],l=[];for(const u of Object.values(i))u.source_spec_node_id===n&&l.push({predicate:u.predicate,typeId:u.destination_spec_node_id,typeLabel:vo(e,u.destination_layer,u.destination_spec_node_id),domain:u.destination_layer}),u.destination_spec_node_id===n&&r.push({predicate:u.predicate,typeId:u.source_spec_node_id,typeLabel:vo(e,u.source_layer,u.source_spec_node_id),domain:u.source_layer});return{inbound:r,outbound:l}}function AP(e,t,n){var u,h;const a=gs(e,t),i=ji(t,n),r=(u=a==null?void 0:a.nodeSchemas)==null?void 0:u[i];if(!r)return null;const{inbound:l,outbound:c}=TP(e,t,n);return{specifier:n,title:(h=r.title)!=null?h:i,description:r.description,inbound:l,outbound:c}}function IP(e,t){var i;const n=gs(e,t),a=Object.keys((i=n==null?void 0:n.nodeSchemas)!=null?i:{})[0];return a?`${t}.${a}`:void 0}const DP=new Set(["realizes","provides","extends","connects","exposes","implements","composes","aggregates","specializes","assigned-to","associated-with","scheduled-for"]);function bj(e){return!!e&&DP.has(e)}function _j(e){return bj(e.label)}function OP(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\./g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function au(e){return`${e.layer_id}.${e.type}.${OP(e.name)}`}function Xp(e){const t=new Map,n=new Map;for(const a of e.nodes)n.set(a.id,a),t.set(a.id,a),t.set(au(a),a);return{byEndpoint:t,byUuid:n}}function Xn(e,t){return e.byEndpoint.get(t)}function zP(e,t){var a;return((a=e.nodesByLayer[t])!=null?a:[]).map(i=>({id:i.id,label:i.name,kind:i.type,domainColor:t}))}function BP(e,t,n){const a=[];for(const i of e.links){const r=Xn(n,i.source),l=Xn(n,i.target);!r||!l||r.layer_id!==t||l.layer_id!==t||a.push({id:i.id,sourceId:r.id,targetId:l.id,label:i.type})}return a}const $P=5;function UP(e,t,n){const a=zP(e,t),i=new Set(a.map(c=>c.id)),r=new Map;for(const c of i)r.set(c,{intraCount:0,crossLinks:[],crossTotal:0});const l=(c,u,h)=>{const m=r.get(c);m&&(m.crossTotal+=1,m.crossLinks.length<$P&&m.crossLinks.push({predicate:u,targetId:h.id,targetName:h.name,targetLayer:h.layer_id}))};for(const c of e.links){const u=Xn(n,c.source),h=Xn(n,c.target);if(!u||!h)continue;const m=i.has(u.id),p=i.has(h.id);if(!(!m&&!p)){if(m&&p){const g=r.get(u.id),v=r.get(h.id);if(!g||!v)continue;g.intraCount+=1,v.intraCount+=1;continue}m?l(u.id,c.type,h):l(h.id,c.type,u)}}return{nodes:a,cardData:r}}function lN(e){return{id:e.id,name:e.name,type:e.type,layer:e.layer_id}}function FP(e,t,n,a){var c;const i=`${t.layer_id}.${t.type}`,r=`${n.layer_id}.${n.type}`,l=u=>{var m,p;const h=(p=(m=gs(e,u))==null?void 0:m.relationshipSchemas)!=null?p:{};return Object.values(h).find(g=>g.source_spec_node_id===i&&g.destination_spec_node_id===r&&g.predicate===a)};return(c=l(t.layer_id))!=null?c:l(n.layer_id)}function D0(e,t,n,a){const i=e.links.find(c=>c.id===t);if(!i)return;const r=Xn(n,i.source),l=Xn(n,i.target);if(!(!r||!l))return{predicate:i.type,sourceNode:lN(r),targetNode:lN(l),specRelationship:FP(a,r,l,i.type)}}function PP(e,t,n){var h,m;const a=new Set((m=(h=e.nodesByLayer[t])==null?void 0:h.map(p=>p.id))!=null?m:[]),i=new Map,r=[];for(const p of e.links){const g=Xn(n,p.source),v=Xn(n,p.target);if(!g||!v)continue;const x=a.has(g.id),b=a.has(v.id);x&&!b?(i.set(v.id,v),r.push({id:p.id,sourceId:g.id,targetId:v.id,label:p.type,opacity:.4,strokeDash:[6,4]})):!x&&b&&(i.set(g.id,g),r.push({id:p.id,sourceId:g.id,targetId:v.id,label:p.type,opacity:.4,strokeDash:[6,4]}))}const l=[],c=new Set,u=new Map;for(const p of i.values()){const g=u.get(p.layer_id);g?g.push(p):u.set(p.layer_id,[p])}for(const p of Array.from(u.keys()).sort())for(const g of u.get(p))c.add(g.id),l.push({id:g.id,label:g.name,kind:g.type,domainColor:g.layer_id});return{foreignNodes:l,crossEdges:r,foreignNodeIds:c}}function HP(e,t,n,a){if(e.foreignNodes.length===0)return e;const i=new Set;for(const u of t.links){const h=Xn(a,u.source),m=Xn(a,u.target);if(!h||!m)continue;const p=h.layer_id===n,g=m.layer_id===n;if((p&&!g||!p&&g)&&bj(u.type)){const v=p?m.id:h.id;i.add(v)}}const r=e.foreignNodes.filter(u=>i.has(u.id)),l=new Set(r.map(u=>u.id)),c=e.crossEdges.filter(u=>l.has(u.sourceId)||l.has(u.targetId));return{foreignNodes:r,crossEdges:c,foreignNodeIds:l}}function mx(e,t,n){const a=n.byUuid.get(t);if(!a)return[];const i=[];let r=0;for(const l of e.links){const c=Xn(n,l.source),u=Xn(n,l.target);!c||!u||(c.id===t?i.push({id:`out-${r++}-${l.id}`,target:u.id,targetTitle:u.name,targetDomain:u.layer_id,predicate:l.type,direction:"out",sourceTypeLabel:a.type,destinationTypeLabel:u.type}):u.id===t&&i.push({id:`in-${r++}-${l.id}`,target:c.id,targetTitle:c.name,targetDomain:c.layer_id,predicate:l.type,direction:"in",sourceTypeLabel:c.type,destinationTypeLabel:a.type}))}return i}function wj(e){var t;return(t=e==null?void 0:e.provenance)!=null?t:"authored"}function Sj(e){var t,n;return(n=(t=e==null?void 0:e.locations)==null?void 0:t.find(a=>a.symbol||a.file))!=null?n:{}}function qP(e){var n;const t=Sj(e);return(n=t.symbol)!=null?n:t.file}function gx(e,t){const n=e.source_reference,a={layer:t,type:e.type,provenance:wj(n)},i=qP(n);return i&&(a.source=i),{id:e.id,title:e.name,kind:e.type,domain:e.layer_id,description:e.description,metadata:a}}function VP(e,t,n){const a=n.byUuid.get(e);if(!a)return{nodes:[],edges:[],empty:!0};const i=new Map,r=new Map;for(const u of t.links){const h=Xn(n,u.source),m=Xn(n,u.target);if(!h||!m)continue;let p=!1,g;h.id===e?(p=!0,g=m):m.id===e&&(p=!1,g=h),g&&g.id!==e&&(i.set(g.id,g),r.has(g.id)||r.set(g.id,[]),r.get(g.id).push({id:u.id,predicate:u.type,direction:p?"out":"in",targetId:g.id}))}const l=[{id:a.id,name:a.name,kind:a.type,layer:a.layer_id,isCenter:!0}];for(const u of i.values())l.push({id:u.id,name:u.name,kind:u.type,layer:u.layer_id,isCenter:!1});const c=[];for(const u of r.values())for(const h of u)c.push(h);return{nodes:l,edges:c,empty:i.size===0}}function YP(e,t,n){var p,g;const a=gs(n,e),i=ji(e,t),r=(p=a==null?void 0:a.nodeSchemas)==null?void 0:p[i];if(!r)return{nodes:[],edges:[],empty:!0};const l=new Map,c=new Map,u=xj(n);for(const v of u)if(v.source_spec_node_id===t){const x=v.destination_spec_node_id;if(x===t)continue;const b=v.destination_layer,_=vo(n,b,x);l.has(x)||l.set(x,{layerId:b,title:_}),c.has(x)||c.set(x,[]),c.get(x).push({id:v.id,predicate:v.predicate,direction:"out",targetId:x})}for(const v of u)if(v.destination_spec_node_id===t){const x=v.source_spec_node_id;if(x===t)continue;const b=v.source_layer,_=vo(n,b,x);l.has(x)||l.set(x,{layerId:b,title:_}),c.has(x)||c.set(x,[]),c.get(x).push({id:v.id,predicate:v.predicate,direction:"in",targetId:x})}const h=[{id:t,name:(g=r.title)!=null?g:i,kind:"spec node",layer:e,isCenter:!0}];for(const[v,x]of l)h.push({id:v,name:x.title,kind:"spec node",layer:x.layerId,isCenter:!1});const m=[];for(const v of c.values())for(const x of v)m.push(x);return{nodes:h,edges:m,empty:l.size===0}}const O0=Ls("application"),Nj=Ls("navigation"),kj="rgb(var(--status-emerald))",Cj="rgb(var(--accent-primary))",Mj="rgb(var(--accent-primary-deep))",yx="—";function go(e){return e==null||e===""?yx:String(e)}function on(e,t,n){return{text:go(e),kind:t,color:n}}function dl(e,t,n,a,i){return ee($({},on(e,t,i)),{tooltip:{kind:"nodeType",layerId:n,typeId:a}})}function Pd(e,t,n,a,i,r,l){return ee($({},on(e,t,r)),{tooltip:{kind:"predicate",predicate:n,sourceTypeLabel:a,destinationTypeLabel:i,edge:l}})}function dn(e,t,n){return{key:e,value:go(t),prose:n}}function z0(e,t,n){return[{label:e==="spec"?"schema":"model",target:{kind:"section",view:e}},{label:t,target:{kind:"layer",view:e,layerId:t},current:n}]}const GP="minmax(0,1.1fr) minmax(0,1.5fr) 78px",KP="minmax(0,1.3fr) minmax(0,1fr) minmax(0,0.9fr) 96px",QP="minmax(0,1fr) minmax(0,0.9fr) minmax(0,1.2fr)";function XP(e,t,n,a,i){var M,C,k,L,E,I;if(!Kp(t))return null;const r=gs(i,t),l=r==null?void 0:r.layer,c=l==null?void 0:l.number,u=(C=(M=l==null?void 0:l.inspired_by)==null?void 0:M.standard)!=null?C:Qp(t),h=(k=r==null?void 0:r.nodeSchemas)!=null?k:{},m=Object.keys(h).length,p=vj(i,t),g=(L=n.nodesByLayer[t])!=null?L:[],v=Ls(t),x=Sa(t),b=Object.entries(h).map(([T,A])=>{var D;const R=g.filter(O=>O.type===T).length;return{target:{kind:"specNode",specNodeId:`${t}.${T}`,layerId:t},cells:[dl((D=A.title)!=null?D:T,"name",t,T),on(`${t}.${T}`,"dim"),on(R,"num")]}}),_=g.map(T=>{let A=0,R=0;for(const D of n.links){const O=Xn(a,D.source);if(!O||O.id!==T.id)continue;const B=Xn(a,D.target);B&&(B.layer_id===t?A+=1:R+=1)}return{target:{kind:"element",elementId:T.id,layerId:t},cells:[on(T.name,"name"),dl(T.type,"mono",t,T.type),on(B0(T),"dim"),on(`${A} · ${R}`,"num")]}}),S=[];for(const T of g)for(const A of n.links){const R=Xn(a,A.source);if(!R||R.id!==T.id)continue;const D=Xn(a,A.target);!D||D.layer_id===t||S.push({target:{kind:"element",elementId:D.id,layerId:D.layer_id},cells:[on(T.name,"name"),Pd(A.type,"dim",A.type,T.type,D.type),dl(`${D.layer_id}.${D.type}`,"mono",D.layer_id,D.type,Ls(D.layer_id))]})}return{eyebrow:`LAYER ${go(c)} · ${u}`,title:x,idChip:t,meta:`${m} node types · ${p} relationship schemas`,color:v,crumbs:z0(e,t,!0),description:`${x} is layer ${go(c)} of 12 in the federated model, inspired by ${u}. The spec defines ${m} node types and ${p} valid relationship schemas for this layer; the loaded model holds ${g.length} elements.`,stats:[{label:"NODE TYPES",value:m,color:v},{label:"RELATIONSHIPS",value:p,color:O0},{label:"ELEMENTS",value:g.length,color:kj},{label:"LAYER",value:`${go(c)} / 12`,color:Cj}],factsTitle:"LAYER SPEC",facts:[dn("layer_id",t),dn("number",c),dn("name",x,!0),dn("description",l==null?void 0:l.description,!0),dn("inspired_by.standard",u),dn("inspired_by.version",(E=l==null?void 0:l.inspired_by)==null?void 0:E.version),dn("inspired_by.url",(I=l==null?void 0:l.inspired_by)==null?void 0:I.url),dn("spec source",`spec/dist/${t}.json`)],tables:[{title:"Spec node types",columns:["node type","spec_node_id","instances"],widths:GP,rows:b,emptyText:"No node types are published for this layer."},{title:"Elements in model",columns:["name","type","provenance","rels · xrefs"],widths:KP,rows:_,emptyText:"No elements of this layer in the loaded model."},{title:"Cross-layer references",columns:["from","predicate","to"],widths:QP,rows:S,emptyText:"This layer emits no cross-layer references."}]}}const jj="minmax(0,1fr) minmax(0,0.8fr) 96px",ZP="minmax(0,1fr) minmax(0,1.2fr) minmax(0,0.8fr) minmax(0,1fr) minmax(0,0.7fr) 62px",JP="minmax(0,1.2fr) minmax(0,1fr) minmax(0,1fr) minmax(0,0.8fr)",WP="minmax(0,1fr) minmax(0,1.5fr) 96px";function e7(e,t,n,a){var M,C,k,L,E,I,T,A,R,D,O,B;const i=gs(n,e),r=ji(e,t),l=(M=i==null?void 0:i.nodeSchemas)==null?void 0:M[r];if(!l)return null;const c=Ls(e),u=(L=(k=(C=i==null?void 0:i.layer)==null?void 0:C.inspired_by)==null?void 0:k.standard)!=null?L:Qp(e),h=I0(l),m=((E=a.nodesByLayer[e])!=null?E:[]).filter(z=>z.type===r),p=xj(n),g=p.filter(z=>z.source_spec_node_id===t),v=p.filter(z=>z.destination_spec_node_id===t),x=h.map(z=>({cells:[on(z.name,"mono"),on(z.type,"dim"),on(z.required?"required":"optional","dim",z.required?Mj:void 0)]})),b=g.map(z=>({target:{kind:"specNode",specNodeId:z.destination_spec_node_id,layerId:z.destination_layer},cells:[Pd(z.predicate,"mono",z.predicate,r,ji(z.destination_layer,z.destination_spec_node_id)),dl(vo(n,z.destination_layer,z.destination_spec_node_id),"name",z.destination_layer,ji(z.destination_layer,z.destination_spec_node_id)),on(z.destination_layer,"dim",Ls(z.destination_layer)),on(z.cardinality?px(z.cardinality)||z.cardinality:yx,"dim"),on(z.strength,"dim"),on(z.required?"yes":"no","num")]})),_=v.map(z=>({target:{kind:"specNode",specNodeId:z.source_spec_node_id,layerId:z.source_layer},cells:[dl(vo(n,z.source_layer,z.source_spec_node_id),"name",z.source_layer,ji(z.source_layer,z.source_spec_node_id)),Pd(z.predicate,"mono",z.predicate,ji(z.source_layer,z.source_spec_node_id),r),on(z.cardinality?px(z.cardinality)||z.cardinality:yx,"dim"),on(z.strength,"dim")]})),S=m.map(z=>({target:{kind:"element",elementId:z.id,layerId:e},cells:[on(z.name,"name"),on(au(z),"dim"),on(B0(z),"dim")]}));return{eyebrow:`SPEC NODE · ${u}`,title:(I=l.title)!=null?I:r,idChip:t,meta:`${h.length} attributes · ${m.length} instances`,color:c,crumbs:[...z0("spec",e,!1),{label:r,current:!0}],description:(T=l.description)!=null?T:"",stats:[{label:"ATTRIBUTES",value:h.length,color:c},{label:"OUTGOING TYPES",value:g.length,color:O0},{label:"INCOMING TYPES",value:v.length,color:Nj},{label:"INSTANCES",value:m.length,color:kj}],factsTitle:"SPEC NODE",facts:[dn("spec_node_id",t),dn("layer_id",e),dn("type",r),dn("title",l.title,!0),dn("extends",(R=(A=l.allOf)==null?void 0:A[0])==null?void 0:R.$ref),dn("schema",l.$id),dn("inspired_by",(O=(D=i==null?void 0:i.layer)==null?void 0:D.inspired_by)!=null&&O.version?`${u} ${i.layer.inspired_by.version}`:u),dn("required",(B=l.required)==null?void 0:B.join(", "))],tables:[{title:"Attributes",columns:["attribute","type","constraint"],widths:jj,rows:x,emptyText:"No attribute schema is published for this node type."},{title:"Valid outgoing relationships",columns:["predicate","destination","layer","cardinality","strength","required"],widths:ZP,rows:b,emptyText:"This node type declares no outgoing relationships."},{title:"Valid incoming relationships",columns:["source","predicate","cardinality","strength"],widths:JP,rows:_,emptyText:"No other node type declares a relationship into this one."},{title:"Instances in model",columns:["name","path","provenance"],widths:WP,rows:S,emptyText:"No instances of this node type in the loaded model."}],neighborhoodGraph:YP(e,t,n)}}const t7="minmax(0,1fr) minmax(0,1.5fr) 88px",n7="minmax(0,1fr) minmax(0,1.3fr) minmax(0,0.8fr) minmax(0,1.4fr)",a7="minmax(0,1.3fr) minmax(0,1fr) minmax(0,1fr) minmax(0,0.8fr)";function B0(e){return wj(e.source_reference)}function s7(e,t,n,a,i){var k,L,E,I,T;const r=a.byUuid.get(t);if(!r||r.layer_id!==e)return null;const l=Ls(e),c=Sa(e),u=gs(i,e),h=(k=u==null?void 0:u.nodeSchemas)==null?void 0:k[r.type],m=I0(h),p=[],g=[];for(const A of n.links){const R=Xn(a,A.source),D=Xn(a,A.target);if(!(!R||!D)){if(R.id===r.id){const O=`${go(R.spec_node_id)}.${A.type}.${go(D.spec_node_id)}`,B=D.layer_id===e?{edgeId:A.id,sourceElementId:r.id,sourceLayerId:e}:void 0;p.push({target:{kind:"element",elementId:D.id,layerId:D.layer_id},cells:[Pd(A.type,"mono",A.type,r.type,D.type,void 0,B),on(D.name,"name"),on(D.layer_id,"dim",Ls(D.layer_id)),on(O,"dim")]})}else if(D.id===r.id){const O=R.layer_id===e?{edgeId:A.id,sourceElementId:R.id,sourceLayerId:R.layer_id}:void 0;g.push({target:{kind:"element",elementId:R.id,layerId:R.layer_id},cells:[on(R.name,"name"),Pd(A.type,"mono",A.type,R.type,r.type,void 0,O),dl(R.type,"dim",R.layer_id,R.type),on(R.layer_id,"dim",Ls(R.layer_id))]})}}}const v=p.filter(A=>{var R;return((R=A.target)==null?void 0:R.kind)==="element"&&A.target.layerId===e}).length,x=p.length-v,b=[{target:{kind:"specNode",specNodeId:`${e}.${r.type}`,layerId:e},cells:[dl((L=h==null?void 0:h.title)!=null?L:r.type,"name",e,r.type),on(`${e}.${r.type}`,"dim"),on(`${m.length} attrs`,"num")]}],_=m.map(A=>({cells:[on(A.name,"mono"),on(A.type,"dim"),on(A.required?"required":"optional","dim",A.required?Mj:void 0)]})),S=au(r),M=Sj(r.source_reference),C=(E=r.metadata)!=null?E:{};return{eyebrow:`ELEMENT · ${c}`,title:r.name,idChip:r.id,meta:`${p.length} outgoing · ${g.length} incoming`,color:l,crumbs:[...z0("model",e,!1),{label:r.id,current:!0}],description:(I=r.description)!=null?I:"",stats:[{label:"INTRA-LAYER",value:v,color:l},{label:"CROSS-LAYER",value:x,color:O0},{label:"INCOMING",value:g.length,color:Nj},{label:"VERSION",value:go(C.version),color:Cj}],factsTitle:"NODE",facts:[dn("path",S),dn("id",r.id),dn("spec_node_id",(T=r.spec_node_id)!=null?T:`${e}.${r.type}`),dn("type",r.type),dn("layer_id",e),dn("name",r.name,!0),dn("source_reference.provenance",B0(r)),dn("source_reference.file",M.file),dn("source_reference.symbol",M.symbol),dn("metadata.created_at",C.created_at),dn("metadata.updated_at",C.updated_at),dn("metadata.created_by",C.created_by),dn("metadata.version",C.version)],tables:[{title:"Conforms to",columns:["spec node","spec_node_id","attributes"],widths:t7,rows:b,emptyText:"No spec node type resolved for this element."},{title:"Attributes",columns:["attribute","type","constraint"],widths:jj,rows:_,emptyText:"No attribute schema is published for this node type."},{title:"Outgoing relationships",columns:["predicate","target","layer","spec_relationship_id"],widths:n7,rows:p,emptyText:"This element has no outgoing relationships."},{title:"Incoming relationships",columns:["source","predicate","type","layer"],widths:a7,rows:g,emptyText:"No other element references this one."}],neighborhoodGraph:VP(t,n,a)}}const i7='a[href], button, input, select, textarea, [tabindex]:not([tabindex="-1"])',rs=8,r7={top:"bottom",bottom:"top",left:"right",right:"left"};function o7(e,t,n,a={width:typeof window!="undefined"?window.innerWidth:1024,height:typeof window!="undefined"?window.innerHeight:768}){var g;const i=v=>{switch(v){case"top":return e.top-t.height-rs>=0;case"bottom":return e.bottom+t.height+rs<=a.height;case"left":return e.left-t.width-rs>=0;case"right":return e.right+t.width+rs<=a.width}},r=n==="top"||n==="bottom"?["right","left"]:["bottom","top"],l=(g=[n,r7[n],...r].find(i))!=null?g:n;let c,u;l==="top"||l==="bottom"?(c=l==="top"?e.top-t.height-rs:e.bottom+rs,u=e.left+e.width/2-t.width/2):(u=l==="left"?e.left-t.width-rs:e.right+rs,c=e.top+e.height/2-t.height/2);const h=Math.max(rs,a.width-t.width-rs),m=Math.max(rs,a.height-t.height-rs);u=Math.min(Math.max(rs,u),h),c=Math.min(Math.max(rs,c),m);const p=u<e.right&&u+t.width>e.left&&c<e.bottom&&c+t.height>e.top;return{top:c,left:u,placement:l,overlapsAnchor:p}}function l7(e,t){return!!e&&e.top===t.top&&e.left===t.left&&e.placement===t.placement&&e.overlapsAnchor===t.overlapsAnchor}function Ej({id:e,getAnchorRect:t,content:n,placement:a="top",track:i=!1,passThrough:r=!1,onMouseEnter:l,onMouseLeave:c,"data-testid":u}){var v,x,b;const[h,m]=j.useState(null),p=j.useRef(null),g=j.useRef(t);return g.current=t,j.useLayoutEffect(()=>{if(!p.current)return;let _=null;const S=()=>{if(!p.current)return;const C=g.current();if(!C){m(null);return}const k={width:p.current.offsetWidth,height:p.current.offsetHeight},L=o7(C,k,a);m(E=>l7(E,L)?E:L)},M=()=>{S(),_=requestAnimationFrame(M)};return S(),i&&(_=requestAnimationFrame(M)),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{_!==null&&cancelAnimationFrame(_),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[a,i]),nk.createPortal(f.jsx("div",{ref:p,id:e,role:"tooltip",className:"rich-tooltip","data-placement":(v=h==null?void 0:h.placement)!=null?v:a,style:{position:"fixed",top:(x=h==null?void 0:h.top)!=null?x:0,left:(b=h==null?void 0:h.left)!=null?b:0,visibility:h?"visible":"hidden",pointerEvents:r||h!=null&&h.overlapsAnchor?"none":void 0},onMouseEnter:l,onMouseLeave:c,"data-testid":u,children:n}),document.body)}function Rj({content:e,children:t,placement:n="top",openDelay:a=300,closeDelay:i=150,className:r,"data-testid":l}){const u=`rich-tooltip-${j.useId()}`,[h,m]=j.useState(!1),p=j.useRef(null),g=j.useRef(null),v=j.useRef(null),x=()=>{g.current&&(clearTimeout(g.current),g.current=null)},b=()=>{v.current&&(clearTimeout(v.current),v.current=null)},_=()=>{x(),b(),m(!0)},S=()=>{b(),!h&&(g.current=setTimeout(()=>{g.current=null,m(!0)},a))},M=()=>{x(),v.current=setTimeout(()=>{v.current=null,m(!1)},i)},C=()=>{x(),b(),m(!1)};return j.useEffect(()=>()=>{x(),b()},[]),j.useLayoutEffect(()=>{var I;const k=p.current;if(!h||!k)return;const L=(I=k.querySelector(i7))!=null?I:k,E=L.getAttribute("aria-describedby");return L.setAttribute("aria-describedby",E?`${E} ${u}`:u),()=>{E?L.setAttribute("aria-describedby",E):L.removeAttribute("aria-describedby")}},[h,u]),j.useEffect(()=>{if(!h)return;const k=L=>{L.key==="Escape"&&C()};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[h]),f.jsxs("span",{ref:p,className:r,style:{display:"inline-block"},onMouseEnter:S,onMouseLeave:M,onFocus:_,onBlur:C,"data-testid":l,children:[t,h&&f.jsx(Ej,{id:u,getAnchorRect:()=>{var k,L;return(L=(k=p.current)==null?void 0:k.getBoundingClientRect())!=null?L:null},content:e,placement:n,onMouseEnter:b,onMouseLeave:M,"data-testid":l?`${l}-card`:"rich-tooltip-card"})]})}const c7=6;function cN({items:e,max:t,testId:n,emptyLabel:a}){if(e.length===0)return f.jsx("div",{className:"rich-tooltip__empty","data-testid":n,children:a});const i=e.slice(0,t),r=e.length-i.length;return f.jsxs("ul",{className:"rich-tooltip__connections","data-testid":n,children:[i.map((l,c)=>f.jsxs("li",{className:"rich-tooltip__connection",title:`${l.predicate} · ${l.typeLabel}${l.domain?` (${Sa(l.domain)})`:""}`,children:[f.jsx("span",{className:"rich-tooltip__connection-swatch",style:{background:Ls(l.domain)}}),f.jsx("span",{className:"rich-tooltip__connection-predicate",children:l.predicate}),f.jsx("span",{className:"rich-tooltip__connection-type",children:l.typeLabel})]},`${l.predicate}-${l.typeId}-${c}`)),r>0&&f.jsxs("li",{className:"rich-tooltip__overflow","data-testid":`${n}-overflow`,children:["+",r," more"]})]})}function u7({children:e,specifier:t,title:n,description:a,inbound:i,outbound:r,maxConnections:l=c7,placement:c,className:u,"data-testid":h="node-type-tooltip"}){const m=f.jsxs("div",{className:"rich-tooltip__body","data-testid":`${h}-content`,children:[f.jsx("div",{className:"rich-tooltip__title",children:n}),f.jsx("div",{className:"rich-tooltip__specifier",children:t}),a&&f.jsx("p",{className:"rich-tooltip__description",children:a}),f.jsx("div",{className:"rich-tooltip__section-label",children:"Inbound connections"}),f.jsx(cN,{items:i,max:l,testId:`${h}-inbound`,emptyLabel:"No inbound connection types"}),f.jsx("div",{className:"rich-tooltip__section-label",children:"Outbound connections"}),f.jsx(cN,{items:r,max:l,testId:`${h}-outbound`,emptyLabel:"No outbound connection types"})]});return f.jsx(Rj,{content:m,placement:c,className:u,"data-testid":h,children:e})}function Xc({spec:e,layerId:t,typeId:n,children:a,placement:i,className:r,"data-testid":l}){const c=AP(e,t,`${t}.${n}`);return c?f.jsx(u7,{specifier:c.specifier,title:c.title,description:c.description,inbound:c.inbound,outbound:c.outbound,placement:i,className:r,"data-testid":l,children:a}):f.jsx(f.Fragment,{children:a})}const d7={supports:{description:"Element contributes to achieving or enabling another element",category:"motivation",archimateAlignment:"Influence"},realizes:{description:"Element implements or makes concrete another element",category:"structural",archimateAlignment:"Realization"},fulfills:{description:"Element satisfies the needs specified by another element",category:"motivation",archimateAlignment:"Realization"},delivers:{description:"Element provides value or benefit",category:"motivation",archimateAlignment:"Realization"},constrains:{description:"Element limits or restricts another element",category:"motivation",archimateAlignment:"Influence"},governs:{description:"Element provides rules or guidelines for another element",category:"motivation",archimateAlignment:"Influence"},owns:{description:"Element has responsibility or authority over another element",category:"business",archimateAlignment:"Assignment"},performs:{description:"Element executes or carries out another element",category:"business",archimateAlignment:"Assignment"},provides:{description:"Element makes functionality available",category:"structural",archimateAlignment:"Serving"},consumes:{description:"Element uses or depends on another element's functionality",category:"dependency",archimateAlignment:"Serving"},requires:{description:"Element needs another element to function correctly",category:"security",archimateAlignment:"Access"},protects:{description:"Element provides security for another element",category:"security",archimateAlignment:"Influence"},mitigates:{description:"Element reduces or addresses a risk or threat",category:"security",archimateAlignment:"Influence"},accesses:{description:"Element can read or modify another element",category:"security",archimateAlignment:"Access"},uses:{description:"Element depends on or utilizes another element",category:"dependency",archimateAlignment:"Serving"},implements:{description:"Element provides concrete implementation of another element",category:"structural",archimateAlignment:"Realization"},composes:{description:"Whole-part relationship where part cannot exist without whole",category:"structural",archimateAlignment:"Composition"},aggregates:{description:"Whole-part relationship where part can exist independently",category:"structural",archimateAlignment:"Aggregation"},triggers:{description:"Element causes or initiates another element",category:"behavioral",archimateAlignment:"Triggering"},"flows-to":{description:"Data or control flows from one element to another",category:"behavioral",archimateAlignment:"Flow"},monitors:{description:"Element observes or tracks another element",category:"apm",archimateAlignment:"Serving"},tests:{description:"Element validates or verifies another element",category:"testing",archimateAlignment:"Serving"},specializes:{description:"Type-subtype relationship (inheritance)",category:"structural",archimateAlignment:"Specialization"},"assigned-to":{description:"Active element assigned to behavior or role",category:"structural",archimateAlignment:"Assignment"},"associated-with":{description:"Generic relationship indicating elements are related or connected",category:"structural",archimateAlignment:"Association"},influence:{description:"Element affects or impacts another element",category:"behavioral",archimateAlignment:"Influence"},serves:{description:"Service available to consumer",category:"behavioral",archimateAlignment:"Serving"},references:{description:"Pointer reference without functional dependency",category:"dependency"},"depends-on":{description:"Element requires another to function",category:"dependency"},"supports-goals":{description:"Implementation contributes to achieving goal",category:"traceability"},"fulfills-requirements":{description:"Implementation satisfies requirement",category:"traceability"},"delivers-value":{description:"Implementation provides business value",category:"traceability"},"measures-outcome":{description:"Metric validates outcome achievement",category:"traceability"},"governed-by-principles":{description:"Element follows architectural principle",category:"governance"},"constrained-by":{description:"Element limited by constraint",category:"governance"},"enforces-requirement":{description:"Element actively enforces requirement",category:"governance"},traces:{description:"Distributed tracing relationships",category:"apm"},measures:{description:"Metric collection relationships",category:"apm"},authenticates:{description:"Authentication flows",category:"security"},authorizes:{description:"Permission grants",category:"security"},renders:{description:"UI rendering relationships",category:"ux"},"binds-to":{description:"Data binding relationships",category:"ux"},"navigates-to":{description:"Navigation flows",category:"ux"},"maps-to":{description:"Schema/table mapping",category:"data"},"references-table":{description:"Foreign key relationships",category:"data"},"derives-from":{description:"Calculated field relationships",category:"data"},validates:{description:"Test element validates that a requirement or target is satisfied",category:"testing"},applies:{description:"Element applies a rule, pattern, or style to another element",category:"ux"},"archives-to":{description:"Element archives data to a target store",category:"data"},"cascades-to":{description:"A change to element cascades to a dependent element",category:"data"},connects:{description:"Element establishes a connection to another element",category:"structural",archimateAlignment:"Association"},covers:{description:"Test element provides coverage for another element",category:"testing"},enforces:{description:"Element actively enforces a policy or requirement on another element",category:"governance"},evaluates:{description:"Element assesses or scores another element",category:"behavioral"},exposes:{description:"Element makes an interface or capability externally available",category:"structural",archimateAlignment:"Serving"},extends:{description:"Element extends the definition or capability of another element",category:"structural",archimateAlignment:"Specialization"},federates:{description:"Element federates identity or access with another element",category:"security"},generates:{description:"Element produces or creates another element",category:"data"},"governed-by":{description:"Element operates under the governance of another element",category:"governance"},intercepts:{description:"Element intercepts a request or action directed at another element",category:"behavioral"},"lazy-loads":{description:"Element defers loading of another element until needed",category:"behavioral"},manages:{description:"Element administers or oversees another element",category:"business"},mandates:{description:"Element requires compliance with another element",category:"governance"},migrates:{description:"Element transforms or moves data to another element",category:"data"},optimizes:{description:"Element improves the performance or efficiency of another element",category:"apm"},replicates:{description:"Element duplicates data to another element",category:"data"},"resolves-with":{description:"Element resolves an ambiguity or conflict together with another element",category:"behavioral"},satisfies:{description:"Element meets the criteria or requirement defined by another element",category:"traceability"},targets:{description:"Element is the target or subject of another element's action",category:"security"},tracks:{description:"Element records or follows the state of another element",category:"apm"},"scheduled-for":{description:"Element is scheduled to occur at or by a target element",category:"structural",archimateAlignment:"Assignment"}};function h7(e){return e?d7[e]:void 0}const Lj=3e3;function Tj({predicate:e,sourceTypeLabel:t,destinationTypeLabel:n,"data-testid":a="predicate-tooltip"}){var r;const i=h7(e);return f.jsxs("div",{className:"rich-tooltip__body","data-testid":`${a}-content`,children:[f.jsx("div",{className:"rich-tooltip__title",children:e}),f.jsx("p",{className:"rich-tooltip__description",children:(r=i==null?void 0:i.description)!=null?r:"No definition available for this predicate."}),f.jsx("div",{className:"rich-tooltip__section-label",children:"Relationship"}),f.jsxs("div",{className:"rich-tooltip__diagram","data-testid":`${a}-diagram`,children:[f.jsx("span",{className:"rich-tooltip__diagram-node",children:t}),f.jsx("span",{className:"rich-tooltip__diagram-arrow","aria-hidden":"true",children:"→"}),f.jsx("span",{className:"rich-tooltip__diagram-predicate",children:e}),f.jsx("span",{className:"rich-tooltip__diagram-arrow","aria-hidden":"true",children:"→"}),f.jsx("span",{className:"rich-tooltip__diagram-node",children:n})]})]})}function $0({children:e,predicate:t,sourceTypeLabel:n,destinationTypeLabel:a,placement:i,className:r,"data-testid":l="predicate-tooltip"}){return f.jsx(Rj,{content:f.jsx(Tj,{predicate:t,sourceTypeLabel:n,destinationTypeLabel:a,"data-testid":l}),placement:i,className:r,openDelay:Lj,"data-testid":l,children:e})}function vx({id:e,label:t,kind:n,domainColor:a="default",selected:i=!1,onSelect:r,spec:l,typeId:c,hasChildren:u=!1,collapsed:h=!1,hiddenDescendantCount:m=0,onToggleCollapse:p}){const g=c!=null?c:n,v=["graph-node",i&&"selected"].filter(Boolean).join(" ");return f.jsxs("div",{className:v,"data-domain":a,"data-kind":n,"data-testid":`pill-node-${e}`,onClick:x=>{x.stopPropagation(),r==null||r(e)},onKeyDown:x=>{x.target===x.currentTarget&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),x.stopPropagation(),r==null||r(e))},role:r?"button":void 0,tabIndex:r?0:void 0,"aria-pressed":r?i:void 0,children:[f.jsx("span",{className:"graph-node__swatch"}),f.jsx("span",{className:"graph-node__label",children:t}),n&&(g?f.jsx(Xc,{spec:l,layerId:a,typeId:g,"data-testid":`pill-node-kind-tooltip-${e}`,children:f.jsx("span",{className:"graph-node__kind",tabIndex:0,children:n})}):f.jsx("span",{className:"graph-node__kind",children:n})),u&&p&&f.jsxs("button",{type:"button",className:"graph-node__collapse-toggle","aria-label":h?"Expand":"Collapse","aria-expanded":!h,onClick:x=>{x.stopPropagation(),p()},children:[h&&m>0&&f.jsx("span",{className:"graph-node__hidden-badge",children:m}),f.jsx(nt,{name:h?"chevronRight":"chevronDown",size:12})]})]})}function f7(e){return e.map(t=>({id:t.id,label:t.name,kind:t.kind,domainColor:t.layer}))}function p7(e,t){const n=e.find(a=>a.isCenter);return n?t.map(a=>({id:a.id,sourceId:a.direction==="out"?n.id:a.targetId,targetId:a.direction==="out"?a.targetId:n.id,label:a.predicate})):[]}function m7(e,t,n,a,i){const r=t.find(l=>l.id===e);r&&(r.isCenter||(n?i(e,r.layer):a(e,r.layer)))}function g7({neighborhood:e,isSpecView:t}){const n=qe(m=>m.navigateToElement),a=qe(m=>m.navigateToSpecNode),{raw:i}=pr(),r=j.useMemo(()=>{const m=e.nodes.find(p=>p.isCenter);return m==null?void 0:m.id},[e.nodes]),l=j.useMemo(()=>f7(e.nodes),[e.nodes]),c=j.useMemo(()=>p7(e.nodes,e.edges),[e.nodes,e.edges]),u=j.useCallback(m=>{m7(m,e.nodes,t,n,a)},[e.nodes,t,n,a]),h=j.useCallback((m,p)=>{var x;const g=e.nodes.find(b=>b.id===m.id),v=(x=g==null?void 0:g.isCenter)!=null?x:!1;return f.jsx(vx,{id:m.id,label:m.label,kind:m.kind,domainColor:m.domainColor,selected:p,onSelect:v?void 0:u,spec:i,typeId:t?m.id.split(".")[1]:void 0})},[e.nodes,t,u,i]);return f.jsx("div",{style:{height:"40vh",minHeight:360,maxHeight:560,display:"flex",flexDirection:"column",overflow:"hidden",border:"1px solid rgb(var(--canvas-border))",borderRadius:8,background:"rgb(var(--canvas-card))"},"data-testid":"neighborhood-graph-view",children:e.empty?f.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"rgb(var(--canvas-fg-3))",fontFamily:"'JetBrains Mono',monospace",fontSize:12},"data-testid":"neighborhood-empty-state",children:"no connections"}):f.jsx(qp,{nodes:l,edges:c,selectedNodeId:r,renderNode:h,onNodeSelect:u,layout:"force",nodeMargin:40,fitView:!0,fitPadding:20,showToolbar:!1,isStructuralEdge:_j,style:{flex:1}})})}const hi="'JetBrains Mono',monospace";function y7(){const e=qe(c=>c.view),t=qe(c=>c.layerId),n=qe(c=>c.selectedId),a=qe(c=>c.focus),{derived:i}=fr(),{raw:r}=pr(),l=j.useMemo(()=>Xp(i),[i]);return j.useMemo(()=>!t||e==="changesets"?null:a==="layer"?XP(e,t,i,l,r):n?e==="spec"?e7(t,n,r,i):s7(t,n,i,l,r):null,[e,t,n,a,i,l,r])}function v7(){const e=qe(r=>r.setView),t=qe(r=>r.selectLayer),n=qe(r=>r.navigateToElement),a=qe(r=>r.navigateToElementWithEdge),i=qe(r=>r.navigateToSpecNode);return r=>{if(r)switch(r.kind){case"section":e(r.view);return;case"layer":e(r.view),t(r.layerId);return;case"element":n(r.elementId,r.layerId);return;case"elementWithEdge":a(r.elementId,r.layerId,r.edgeId);return;case"specNode":i(r.specNodeId,r.layerId);return;default:return r}}}function x7(e){var t,n;if(((t=e.tooltip)==null?void 0:t.kind)==="nodeType")return{kind:"specNode",specNodeId:`${e.tooltip.layerId}.${e.tooltip.typeId}`,layerId:e.tooltip.layerId};if(((n=e.tooltip)==null?void 0:n.kind)==="predicate"&&e.tooltip.edge)return{kind:"elementWithEdge",elementId:e.tooltip.edge.sourceElementId,layerId:e.tooltip.edge.sourceLayerId,edgeId:e.tooltip.edge.edgeId}}const b7={name:{fontSize:13,color:"rgb(var(--canvas-fg-1))",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},mono:{fontFamily:hi,fontSize:11,color:"rgb(var(--canvas-fg-2))",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},dim:{fontFamily:hi,fontSize:11,color:"rgb(var(--canvas-fg-3))",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},num:{fontFamily:hi,fontSize:11,color:"rgb(var(--canvas-fg-2))",textAlign:"right"}};function _7({cell:e,spec:t,target:n,onNavigate:a}){var l,c,u;const i=$($({},b7[e.kind]),e.color?{color:e.color}:null),r=n?f.jsx("span",{role:"cell",style:i,children:f.jsx("button",{type:"button",className:"drv-cell-link",style:{overflow:i.overflow,textOverflow:i.textOverflow,whiteSpace:i.whiteSpace,textAlign:(l=i.textAlign)!=null?l:"left",display:"block",width:"100%",border:"none",padding:0,margin:0,cursor:"pointer"},onClick:()=>a(n),"data-testid":"page-cell-link",children:e.text})}):f.jsx("span",{role:"cell",style:i,tabIndex:e.tooltip?0:void 0,children:e.text});return((c=e.tooltip)==null?void 0:c.kind)==="nodeType"?f.jsx(Xc,{spec:t,layerId:e.tooltip.layerId,typeId:e.tooltip.typeId,"data-testid":"page-cell-node-type-tooltip",children:r}):((u=e.tooltip)==null?void 0:u.kind)==="predicate"?f.jsx($0,{predicate:e.tooltip.predicate,sourceTypeLabel:e.tooltip.sourceTypeLabel,destinationTypeLabel:e.tooltip.destinationTypeLabel,"data-testid":"page-cell-predicate-tooltip",children:r}):r}function w7({pg:e,onNavigate:t}){const n={fontFamily:hi,fontSize:11};return f.jsx("nav",{"aria-label":"Breadcrumb",style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:e.crumbs.map((a,i)=>f.jsxs("span",{style:{display:"contents"},children:[i>0&&f.jsx("span",{style:ee($({},n),{color:"rgb(var(--canvas-fg-4))"}),"aria-hidden":"true",children:"/"}),a.target?f.jsx("button",{type:"button",className:`drv-crumb${a.current?" drv-crumb--current":""}`,onClick:()=>t(a.target),"data-testid":"page-crumb",style:$({background:"none",border:"none",padding:0},n),children:a.label}):f.jsx("span",{style:ee($({},n),{color:a.current?"rgb(var(--canvas-fg-1))":"rgb(var(--canvas-fg-3))"}),children:a.label})]},`${a.label}-${i}`))})}function S7({pg:e}){return f.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4,minmax(0,1fr))",gap:14},children:e.stats.map(t=>f.jsxs("div",{style:{padding:"12px 14px",background:"rgb(var(--canvas-card))",border:"1px solid rgb(var(--canvas-border))",borderLeft:`2px solid ${t.color}`,borderRadius:8},children:[f.jsx("div",{style:{fontFamily:hi,fontSize:10,letterSpacing:"0.1em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))"},children:t.label}),f.jsx("div",{style:{fontSize:28,fontWeight:700,letterSpacing:"-0.02em",color:"rgb(var(--canvas-fg-1))",marginTop:4},children:t.value})]},t.label))})}function N7({pg:e}){return f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[f.jsx("span",{style:{fontFamily:hi,fontSize:10,letterSpacing:"0.1em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))"},children:e.factsTitle}),f.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2,minmax(0,1fr))",gap:"1px 32px"},children:e.facts.map(t=>f.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0,150px) minmax(0,1fr)",gap:12,padding:"7px 0",borderBottom:"1px solid rgb(var(--canvas-border))"},children:[f.jsx("span",{style:{fontFamily:hi,fontSize:11,lineHeight:1.45,color:"rgb(var(--canvas-fg-3))",minWidth:0,overflowWrap:"anywhere",wordBreak:"break-word"},children:t.key}),f.jsx("span",{style:t.prose?{fontSize:12,color:"rgb(var(--canvas-fg-1))",overflowWrap:"anywhere"}:{fontFamily:hi,fontSize:11,color:"rgb(var(--canvas-fg-1))",overflowWrap:"anywhere"},children:t.value})]},t.key))})]})}const k7={display:"grid",gap:14,alignItems:"center",padding:"9px 10px",borderBottom:"1px solid rgb(var(--canvas-border))",borderRadius:4};function C7({row:e,widths:t,spec:n,onNavigate:a}){let i=!1,r=!1;const l=e.cells.map((c,u)=>{let h=x7(c);return!h&&e.target&&!i&&(h=e.target,i=!0),h&&(r=!0),f.jsx(_7,{cell:c,spec:n,target:h,onNavigate:a},u)});return f.jsx("div",{role:"row",className:r?"drv-row":void 0,style:ee($({},k7),{gridTemplateColumns:t}),"data-testid":e.target?"page-row":void 0,children:l})}function M7({pg:e,spec:t,onNavigate:n}){return f.jsx(f.Fragment,{children:e.tables.map(a=>f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[f.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[f.jsx("span",{style:{fontFamily:hi,fontSize:10,letterSpacing:"0.1em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))"},children:a.title}),f.jsx("span",{style:{fontFamily:hi,fontSize:10,color:"rgb(var(--canvas-fg-3))"},children:a.rows.length?a.rows.length:""})]}),a.rows.length===0?f.jsx("span",{style:{fontSize:13,color:"rgb(var(--canvas-fg-3))"},children:a.emptyText}):f.jsxs("div",{role:"table","aria-label":a.title,children:[f.jsx("div",{role:"row",style:{display:"grid",gridTemplateColumns:a.widths,gap:14,alignItems:"center",padding:"0 10px 7px",fontFamily:hi,fontSize:10,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))",borderBottom:"1px solid rgb(var(--canvas-border))"},children:a.columns.map(i=>f.jsx("span",{role:"columnheader",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i},i))}),a.rows.map((i,r)=>f.jsx(C7,{row:i,widths:a.widths,spec:t,onNavigate:n},r))]})]},a.title))})}function j7({pg:e}){const t=v7(),{raw:n}=pr(),a=qe(i=>i.view);return f.jsx("div",{className:"drv-scroll",style:{position:"absolute",inset:0,overflowY:"auto",padding:"2px 22px 44px"},"data-testid":"page-view",children:f.jsxs("div",{style:{maxWidth:1040,display:"flex",flexDirection:"column",gap:28},children:[f.jsx(w7,{pg:e,onNavigate:t}),e.neighborhoodGraph&&f.jsx(g7,{neighborhood:e.neighborhoodGraph,isSpecView:a==="spec"},`${e.title}-neighborhood`),f.jsx("p",{style:{fontSize:14,lineHeight:1.6,color:"rgb(var(--canvas-fg-2))",margin:0,maxWidth:760,textWrap:"pretty"},children:e.description}),f.jsx(S7,{pg:e}),f.jsx(N7,{pg:e}),f.jsx(M7,{pg:e,spec:n,onNavigate:t})]})})}const Aj="You",E7=/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/;function R7(e){return E7.test(e)}function ah(e){return["annotations",e!=null?e:""]}function Mp(e){return["annotation-replies",e]}function L7(e){return Jc({queryKey:ah(e),enabled:!!e,queryFn:()=>St(null,null,function*(){var n;return(n=(yield _l().getapiannotations({elementId:e})).annotations)!=null?n:[]})})}function T7(e,t=!0){return Jc({queryKey:Mp(e),enabled:t,queryFn:()=>St(null,null,function*(){var a;return(a=(yield _l().getapiannotationsannotationIdreplies(e)).replies)!=null?a:[]})})}function A7(){const e=fi();return Wc({mutationFn:t=>{var n,a;return _l().postapiannotations({elementId:t.elementId,author:(n=t.author)!=null?n:Aj,content:t.content,tags:(a=t.tags)!=null?a:[]})},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:ah(n.elementId)})}})}function I7(){const e=fi();return Wc({mutationFn:t=>{const n={};return t.content!==void 0&&(n.content=t.content),t.tags!==void 0&&(n.tags=t.tags),t.resolved!==void 0&&(n.resolved=t.resolved),_l().patchapiannotationsannotationId(t.id,n)},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:ah(n.elementId)})}})}function D7(){const e=fi();return Wc({mutationFn:t=>_l().deleteapiannotationsannotationId(t.id),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:ah(n.elementId)})}})}function O7(){const e=fi();return Wc({mutationFn:t=>{var n;return _l().postapiannotationsannotationIdreplies(t.annotationId,{author:(n=t.author)!=null?n:Aj,content:t.content})},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:Mp(n.annotationId)})}})}const uN="annotation.added",dN="annotation.updated",hN="annotation.reply.added",fN="annotation.deleted";function z7(){const e=fi();j.useEffect(()=>{const t=()=>e.invalidateQueries({queryKey:["annotations"]}),n=l=>{const{elementId:c}=l!=null?l:{};c?e.invalidateQueries({queryKey:ah(c)}):t()},a=()=>{t()},i=l=>{const{annotationId:c}=l!=null?l:{};c&&e.invalidateQueries({queryKey:Mp(c)})},r=l=>{const{annotationId:c}=l!=null?l:{};t().then(()=>{c&&e.removeQueries({queryKey:Mp(c),type:"inactive"})})};return an.on(uN,n),an.on(dN,a),an.on(hN,i),an.on(fN,r),()=>{an.off(uN,n),an.off(dN,a),an.off(hN,i),an.off(fN,r)}},[e])}function Ij(e){const t=new Date(e).getTime();if(Number.isNaN(t))return e;const n=Date.now()-t,a=Math.round(n/1e3);if(a<45)return"just now";const i=Math.round(a/60);if(i<60)return`${i}m ago`;const r=Math.round(i/60);if(r<24)return`${r}h ago`;const l=Math.round(r/24);if(l<30)return`${l}d ago`;const c=Math.round(l/30);return c<12?`${c}mo ago`:`${Math.round(c/12)}y ago`}function B7(e){const t=new Set;for(const n of e.split(/[\s,]+/)){const a=n.trim().toLowerCase();a&&t.add(a)}return[...t]}const $7={display:"block",fontFamily:"'JetBrains Mono', monospace",fontSize:10.5,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))",fontWeight:500},hl={fontFamily:"'JetBrains Mono', monospace",fontSize:10.5,color:"rgb(var(--canvas-fg-3))"},U7={background:"rgb(var(--canvas-card))",border:"1px solid rgb(var(--canvas-border))",borderRadius:8,padding:"10px 12px"};function F7({elementId:e,notify:t}){const[n,a]=j.useState(""),[i,r]=j.useState(""),l=A7(),c=n.trim(),u=j.useMemo(()=>B7(i),[i]),h=u.filter(g=>!R7(g)),m=c.length>=1&&c.length<=5e3&&h.length===0&&!l.isPending,p=()=>{m&&l.mutate({elementId:e,content:c,tags:u},{onSuccess:()=>{a(""),r(""),t("success","Annotation added")},onError:()=>t("error","Failed to add annotation")})};return f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[f.jsx(Px,{value:n,onChange:g=>a(g.target.value),placeholder:"Add an annotation…",rows:3,"aria-label":"New annotation content","data-testid":"annotation-add-content"}),f.jsx(Ld,{mono:!0,value:i,onChange:g=>r(g.target.value),placeholder:"tags (space or comma separated)",error:h.length>0,"aria-label":"New annotation tags","data-testid":"annotation-add-tags"}),h.length>0&&f.jsxs("span",{style:ee($({},hl),{color:"rgb(var(--status-rose))"}),children:["invalid tag",h.length>1?"s":"",": ",h.join(", ")]}),f.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:f.jsx(Bn,{variant:"accent",size:"sm",disabled:!m,onClick:p,"data-testid":"annotation-add-submit",children:l.isPending?"Adding…":"Add"})})]})}function P7({annotationId:e,expanded:t,notify:n}){const{data:a=[],isLoading:i}=T7(e,t),r=O7(),[l,c]=j.useState(""),u=l.trim(),h=u.length>=1&&u.length<=5e3&&!r.isPending,m=()=>{h&&r.mutate({annotationId:e,content:u},{onSuccess:()=>{c(""),n("success","Reply added")},onError:()=>n("error","Failed to add reply")})};return f.jsxs("div",{style:{marginTop:8,paddingLeft:12,borderLeft:"2px solid rgb(var(--canvas-border))",display:"flex",flexDirection:"column",gap:8},"data-testid":"annotation-replies",children:[i&&a.length===0?f.jsx("span",{style:hl,children:"loading replies…"}):a.map(p=>f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[f.jsx("span",{style:{fontSize:12,fontWeight:600,color:"rgb(var(--canvas-fg-1))"},children:p.author}),f.jsx("span",{style:hl,title:p.createdAt,children:Ij(p.createdAt)})]}),f.jsx("p",{style:{margin:0,fontSize:12.5,lineHeight:1.5,color:"rgb(var(--canvas-fg-2))",whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:p.content})]},p.id)),f.jsxs("div",{style:{display:"flex",gap:6,alignItems:"flex-start"},children:[f.jsx(Ld,{value:l,onChange:p=>c(p.target.value),placeholder:"Reply…","aria-label":"Reply content","data-testid":"annotation-reply-input",style:{flex:1},onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),m())}}),f.jsx(Bn,{variant:"secondary",size:"sm",disabled:!h,onClick:m,"data-testid":"annotation-reply-submit",children:"Reply"})]})]})}function H7({annotation:e,elementId:t,notify:n}){const a=I7(),i=D7(),[r,l]=j.useState(!1),[c,u]=j.useState(e.content),[h,m]=j.useState(!1),[p,g]=j.useState(!1),v=c.trim(),x=v.length>=1&&v.length<=5e3&&v!==e.content&&!a.isPending,b=()=>{x&&a.mutate({id:e.id,elementId:t,content:v},{onSuccess:()=>{l(!1),n("success","Annotation updated")},onError:()=>n("error","Failed to update annotation")})},_=()=>{a.mutate({id:e.id,elementId:t,resolved:!e.resolved},{onSuccess:()=>n("success",e.resolved?"Reopened":"Resolved"),onError:()=>n("error","Failed to update annotation")})},S=()=>{i.mutate({id:e.id,elementId:t},{onSuccess:()=>{m(!1),n("success","Annotation deleted")},onError:()=>{m(!1),n("error","Failed to delete annotation")}})},M=C=>{C==="edit"?(u(e.content),l(!0)):C==="resolve"?_():C==="delete"&&m(!0)};return f.jsxs("div",{style:U7,"data-testid":"annotation-item","data-resolved":e.resolved,children:[f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[f.jsx("span",{style:{fontSize:12.5,fontWeight:600,color:"rgb(var(--canvas-fg-1))"},children:e.author}),f.jsx("span",{style:hl,title:e.createdAt,children:Ij(e.createdAt)}),e.resolved&&f.jsx(fs,{variant:"emerald","data-testid":"annotation-resolved-chip",children:"resolved"}),f.jsx("div",{style:{marginLeft:"auto"},children:f.jsx(aM,{placement:"bottom-end",triggerLabel:"Annotation actions",actions:[{id:"edit",label:"Edit",icon:"edit"},{id:"resolve",label:e.resolved?"Reopen":"Resolve",icon:"check"},{type:"separator"},{id:"delete",label:"Delete",icon:"trash",danger:!0}],onAction:M})})]}),r?f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[f.jsx(Px,{value:c,onChange:C=>u(C.target.value),rows:3,"aria-label":"Edit annotation content","data-testid":"annotation-edit-content",autoFocus:!0}),f.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:6},children:[f.jsx(Bn,{variant:"ghost",size:"sm",onClick:()=>l(!1),"data-testid":"annotation-edit-cancel",children:"Cancel"}),f.jsx(Bn,{variant:"accent",size:"sm",disabled:!x,onClick:b,"data-testid":"annotation-edit-save",children:a.isPending?"Saving…":"Save"})]})]}):f.jsx("p",{style:{margin:0,fontSize:13,lineHeight:1.55,color:"rgb(var(--canvas-fg-2))",whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:e.content}),e.tags.length>0&&f.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginTop:8},"data-testid":"annotation-tags",children:e.tags.map(C=>f.jsx(fs,{form:"id-tag",children:C},C))}),f.jsx("div",{style:{marginTop:8},children:f.jsx(Bn,{variant:"ghost",size:"sm",onClick:()=>g(C=>!C),"aria-expanded":p,"data-testid":"annotation-replies-toggle",children:p?"Hide replies":"Replies"})}),p&&f.jsx(P7,{annotationId:e.id,expanded:p,notify:n}),f.jsx(up,{isOpen:h,onClose:()=>m(!1),onConfirm:S,title:"Delete annotation",message:"This permanently removes the annotation and its replies. Continue?",confirmLabel:i.isPending?"Deleting…":"Delete",variant:"danger"})]})}function q7({elementId:e}){const{data:t=[],isLoading:n,isError:a}=L7(e),[i,r]=j.useState({open:!1,variant:"success",title:""}),l=(c,u)=>r({open:!0,variant:c,title:u});return f.jsxs("section",{style:{padding:"16px",borderTop:"1px solid rgb(var(--canvas-border))",display:"flex",flexDirection:"column",gap:12},"data-testid":"annotations-section",children:[f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[f.jsx("span",{style:$7,children:"Annotations"}),f.jsxs("span",{style:hl,"data-testid":"annotations-count",children:["· ",t.length]})]}),f.jsx(F7,{elementId:e,notify:l}),n?f.jsx("span",{style:hl,children:"loading…"}):a?f.jsx("span",{style:ee($({},hl),{color:"rgb(var(--status-rose))"}),children:"failed to load annotations"}):t.length===0?f.jsx("span",{style:{fontSize:12.5,color:"rgb(var(--canvas-fg-3))"},"data-testid":"annotations-empty",children:"No annotations yet"}):f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:t.map(c=>f.jsx(H7,{annotation:c,elementId:e,notify:l},c.id))}),f.jsx(Kx,{isOpen:i.open,onClose:()=>r(c=>ee($({},c),{open:!1})),variant:i.variant,title:i.title})]})}function xx({relationships:e,onNodeSelect:t,originLayer:n}){if(e.length===0)return null;const a=e.filter(r=>r.direction==="out"),i=e.filter(r=>r.direction==="in");return f.jsxs(f.Fragment,{children:[a.length>0&&f.jsxs("div",{"data-testid":"inspector-outgoing",children:[f.jsxs("div",{className:"graph-inspector__section-label",children:["Outgoing · ",a.length]}),f.jsx("ul",{className:"graph-inspector__rels",children:a.map(r=>f.jsx(pN,{rel:r,onNodeSelect:t,originLayer:n},r.id))})]}),i.length>0&&f.jsxs("div",{"data-testid":"inspector-incoming",children:[f.jsxs("div",{className:"graph-inspector__section-label",children:["Incoming · ",i.length]}),f.jsx("ul",{className:"graph-inspector__rels",children:i.map(r=>f.jsx(pN,{rel:r,onNodeSelect:t,originLayer:n},r.id))})]})]})}const V7=hj.map(e=>({value:e,label:Yp(e)}));function bx(e,t){return`${e} ${t}${e===1?"":"s"}`}function Y7({reach:e,follow:t,onFollowChange:n,onNodeSelect:a}){const{followed:i,nodeCount:r,layerCount:l,byLayer:c}=e,u=`Reached by layer: ${c.map(h=>`${Sa(h.layerId)} ${h.count}`).join(", ")}`;return f.jsxs("div",{"data-testid":"inspector-followed",style:{display:"flex",flexDirection:"column",gap:8},children:[f.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,flexWrap:"wrap"},children:[f.jsxs("div",{className:"graph-inspector__section-label",style:{margin:0},children:["Followed across layers · ",i.length]}),f.jsx(ps,{value:t,onChange:h=>n(Number(h)),options:V7,"aria-label":"Follow depth","data-testid":"inspector-follow-control"})]}),c.length>0&&f.jsx("div",{className:"drv-reach-strip",role:"img","aria-label":u,"data-testid":"inspector-reach-strip",children:c.map(h=>f.jsx("span",{className:"drv-reach-strip__seg",style:{flexGrow:h.count,background:Ls(h.layerId)},title:`${Sa(h.layerId)} · ${h.count}`,"data-layer":h.layerId},h.layerId))}),f.jsxs("div",{className:"graph-inspector__rel-via",style:{padding:0},"data-testid":"inspector-reach-summary",children:["reach ",bx(r,"element")," across ",bx(l,"layer")]}),i.length>0?f.jsx("ul",{className:"graph-inspector__rels",children:i.map(h=>f.jsx(G7,{rel:h,onNodeSelect:a},h.id))}):f.jsx("div",{className:"graph-inspector__empty-mini",children:t===0?"Direct links only.":"Nothing further across layers."})]})}function Dj({rel:e}){const t=f.jsx("span",{className:"graph-inspector__rel-pred",children:e.predicate});return e.sourceTypeLabel&&e.destinationTypeLabel?f.jsx($0,{predicate:e.predicate,sourceTypeLabel:e.sourceTypeLabel,destinationTypeLabel:e.destinationTypeLabel,"data-testid":`relationship-predicate-tooltip-${e.id}`,children:t}):t}function pN({rel:e,onNodeSelect:t,originLayer:n}){const a=e.direction==="out"?"→":"←",i=`graph-inspector__rel-dir--${e.direction}`,r=n&&e.targetDomain&&e.targetDomain!==n?Sa(e.targetDomain):void 0;return f.jsxs("li",{className:"graph-inspector__rel",children:[f.jsx("div",{className:`graph-inspector__rel-dir ${i}`,children:a}),f.jsx(Dj,{rel:e}),f.jsxs("button",{type:"button",className:"graph-inspector__rel-target","data-domain":e.targetDomain,onClick:()=>t(e.target),"aria-label":`Navigate to ${e.targetTitle}${r?`, ${r} layer`:""}`,children:[f.jsx("span",{className:"graph-inspector__rel-swatch"}),e.targetTitle]}),r&&f.jsx("span",{className:"drv-rel-layer","aria-hidden":"true","data-testid":`inspector-rel-layer-${e.id}`,children:r})]})}function G7({rel:e,onNodeSelect:t}){const n=e.hop-1,a=e.direction==="out"?"→":"←",i=Sa(e.targetDomain),r=`Navigate to ${e.targetTitle}, ${i} layer, ${bx(n,"layer")} past direct, `+(e.direction==="out"?`via ${e.via.title}, which ${e.via.predicate} it`:`via ${e.via.title}, which it ${e.via.predicate}`);return f.jsxs("li",{className:"graph-inspector__rel","data-testid":`inspector-followed-row-${e.target}`,children:[f.jsxs("button",{type:"button",className:"graph-inspector__rel-target","data-domain":e.targetDomain,onClick:()=>t(e.target),"aria-label":r,children:[f.jsx("span",{className:"graph-inspector__rel-swatch"}),e.targetTitle]}),f.jsxs("span",{className:"graph-inspector__rel-hop","aria-hidden":"true",children:["+",n]}),f.jsxs("span",{className:"graph-inspector__rel-via",children:["via ",e.via.title," ",f.jsx("span",{className:`graph-inspector__rel-dir--${e.direction}`,"aria-hidden":"true",children:a})," ",f.jsx(Dj,{rel:e})]})]})}const lv={border:"none",cursor:"pointer"};function K7({edgeId:e,edge:t,model:n,index:a,spec:i,onNodeSelect:r,navigateToSpecNode:l,navigateToElementWithEdge:c}){var b;const u=a.byUuid.get(t.sourceNode.id),h=a.byUuid.get(t.targetNode.id),m=j.useMemo(()=>u?ee($({},gx(u,Sa(u.layer_id))),{kind:void 0}):null,[u]),p=j.useMemo(()=>h?ee($({},gx(h,Sa(h.layer_id))),{kind:void 0}):null,[h]),g=j.useMemo(()=>u?mx(n,u.id,a):[],[n,u,a]),v=j.useMemo(()=>h?mx(n,h.id,a):[],[n,h,a]),x={id:e,predicate:t.predicate,sourceId:t.sourceNode.id,sourceTitle:t.sourceNode.name,sourceDomain:t.sourceNode.layer,targetId:t.targetNode.id,targetTitle:t.targetNode.name,targetDomain:t.targetNode.layer,variant:"hot",metadata:(b=t.specRelationship)!=null&&b.cardinality?{cardinality:t.specRelationship.cardinality}:void 0};return f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},"data-testid":"edge-inspector",children:[f.jsxs("div",{"data-testid":"edge-inspector-source-node",children:[u&&f.jsx("div",{className:"graph-inspector__head-eyebrow","data-testid":"edge-inspector-source-type-row",children:f.jsx(Xc,{spec:i,layerId:u.layer_id,typeId:u.type,"data-testid":"edge-inspector-source-type-tooltip",children:f.jsx("button",{type:"button",className:"graph-inspector__badge",style:lv,onClick:()=>l(`${u.layer_id}.${u.type}`,u.layer_id),children:u.type})})}),f.jsxs("div",{className:"graph-inspector--custom-relationships",children:[f.jsx(Fd,{node:m,relationships:[],onNodeSelect:r,emptyStateText:"Source element unavailable."}),f.jsx(xx,{relationships:g,onNodeSelect:r})]})]}),f.jsx("div",{className:"graph-edge-inspector__head-eyebrow","data-testid":"edge-inspector-predicate-row",children:f.jsx($0,{predicate:t.predicate,sourceTypeLabel:t.sourceNode.type,destinationTypeLabel:t.targetNode.type,"data-testid":"edge-inspector-predicate-tooltip",children:f.jsx("button",{type:"button",className:"graph-edge-inspector__badge",style:lv,onClick:()=>c(t.sourceNode.id,t.sourceNode.layer,e),children:t.predicate})})}),f.jsx(sj,{edge:x,onNodeSelect:r,"data-testid":"edge-inspector-edge"}),f.jsxs("div",{"data-testid":"edge-inspector-destination-node",children:[h&&f.jsx("div",{className:"graph-inspector__head-eyebrow","data-testid":"edge-inspector-destination-type-row",children:f.jsx(Xc,{spec:i,layerId:h.layer_id,typeId:h.type,"data-testid":"edge-inspector-destination-type-tooltip",children:f.jsx("button",{type:"button",className:"graph-inspector__badge",style:lv,onClick:()=>l(`${h.layer_id}.${h.type}`,h.layer_id),children:h.type})})}),f.jsxs("div",{className:"graph-inspector--custom-relationships",children:[f.jsx(Fd,{node:p,relationships:[],onNodeSelect:r,emptyStateText:"Destination element unavailable."}),f.jsx(xx,{relationships:v,onNodeSelect:r})]})]})]})}const Q7={followed:[],nodeCount:0,layerCount:0,byLayer:[]};function X7(e,t){const n=e.nodes.map(i=>({id:i.id,label:i.name,kind:i.type,domainColor:i.layer_id})),a=[];return e.links.forEach((i,r)=>{var u;const l=Xn(t,i.source),c=Xn(t,i.target);!l||!c||a.push({id:(u=i.id)!=null?u:`link-${r}`,sourceId:l.id,targetId:c.id,label:i.type})}),AM(n,a,{layerBy:"domainColor",layers:A0.map(i=>({id:i,label:Sa(i)}))})}function Z7(e,t,n){var c;if(!e.nodeById.has(t))return Q7;const a=ex(e,t,{follow:n}),i=new Set,r=new Map,l=[];for(const[u,h]of a.hopOf){const m=e.nodeById.get(u);if(!m||(i.add(m.layerId),h>=1&&r.set(m.layerId,((c=r.get(m.layerId))!=null?c:0)+1),h<2))continue;const p=a.via.get(u),g=p?e.nodeById.get(p.fromId):void 0,v=p?e.linkById.get(p.linkId):void 0;if(!g||!v)continue;const x=v.sourceId===g.id?"out":"in",b=v.predicates.join(" · "),_=v.predicates.length===1;l.push({rank:m.layerRank,rel:{id:`followed-${m.id}`,target:m.nodeId,targetTitle:m.label,targetDomain:m.layerId,predicate:b,direction:x,hop:h,via:{id:g.nodeId,title:g.label,predicate:b},sourceTypeLabel:_?x==="out"?g.kind:m.kind:void 0,destinationTypeLabel:_?x==="out"?m.kind:g.kind:void 0}})}return l.sort((u,h)=>u.rel.hop-h.rel.hop||u.rank-h.rank||u.rel.targetTitle.localeCompare(h.rel.targetTitle)),{followed:l.map(u=>u.rel),nodeCount:a.hopOf.size-1,layerCount:i.size,byLayer:e.layers.filter(u=>r.has(u.id)).map(u=>({layerId:u.id,count:r.get(u.id)}))}}function J7(e){const t=e.lastIndexOf(".");return t>0?e.slice(0,t):e}const W7=320;function eH(){const[e,t]=j.useState(W7),n=qe(B=>B.view),a=qe(B=>B.layerId),i=qe(B=>B.selectedId),r=qe(B=>B.selectedEdgeId),l=qe(B=>B.navigateToElement),c=qe(B=>B.navigateToSpecNode),u=qe(B=>B.navigateToElementWithEdge),h=qe(B=>B.clearEdgeSelection),m=qe(B=>B.inspectorFollow),p=qe(B=>B.setInspectorFollow),{derived:g,isSuccess:v}=fr(),{raw:x}=pr(),b=j.useMemo(()=>Xp(g),[g]),_=n==="spec",S=j.useMemo(()=>_?null:X7(g,b),[_,g,b]),M=j.useMemo(()=>!_&&r?D0(g,r,b,x):void 0,[_,g,r,b,x]);j.useEffect(()=>{_||!r||!v||M||h()},[_,r,v,M,h]);const C=!_&&i?b.byUuid.get(i):void 0,k=j.useMemo(()=>C?ee($({},gx(C,Sa(C.layer_id))),{kind:void 0}):null,[C]),L=j.useMemo(()=>C?mx(g,C.id,b):[],[g,C,b]),E=j.useMemo(()=>S&&C?Z7(S,C.id,m):null,[S,C,m]),I=j.useMemo(()=>_&&a&&i?LP(x,a,i):null,[_,x,a,i]),T=j.useMemo(()=>_&&a&&i?RP(x,a,i):[],[_,x,a,i]),A=_?I:k,R=_?T:L,D=B=>{if(_){c(B,J7(B));return}const z=b.byUuid.get(B);z&&l(z.id,z.layer_id)},O=C?au(C):null;return f.jsx(aj,{open:!!A||!!M,width:e,onWidthChange:t,"data-testid":"inspector",className:_?"":"inspector-model-branch",children:M&&r?f.jsx(K7,{edgeId:r,edge:M,model:g,index:b,spec:x,onNodeSelect:D,navigateToSpecNode:c,navigateToElementWithEdge:u}):f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[!_&&C&&f.jsx("div",{className:"graph-inspector__head-eyebrow","data-testid":"inspector-kind-tooltip-row",children:f.jsx(Xc,{spec:x,layerId:C.layer_id,typeId:C.type,"data-testid":"inspector-kind-tooltip",children:f.jsx("button",{type:"button",className:"graph-inspector__badge",style:{border:"none",cursor:"pointer"},onClick:()=>c(`${C.layer_id}.${C.type}`,C.layer_id),children:C.type})})}),_?f.jsx(Fd,{node:A,relationships:R,onNodeSelect:D,emptyStateText:"Select a node type to inspect."}):f.jsxs("div",{className:"graph-inspector--custom-relationships",children:[f.jsx(Fd,{node:A,relationships:[],onNodeSelect:D,emptyStateText:"Select an element to inspect."}),f.jsx(xx,{relationships:R,onNodeSelect:D,originLayer:C==null?void 0:C.layer_id}),E&&f.jsx(Y7,{reach:E,follow:m,onFollowChange:p,onNodeSelect:D})]}),O&&f.jsx(q7,{elementId:O})]})})}function tH({id:e,label:t,kind:n,domainColor:a="default",selected:i=!1,onSelect:r,cardData:l,spec:c,hasChildren:u=!1,collapsed:h=!1,hiddenDescendantCount:m=0,onToggleCollapse:p}){var S,M,C;const g=(S=l==null?void 0:l.intraCount)!=null?S:0,v=(M=l==null?void 0:l.crossLinks)!=null?M:[],x=(C=l==null?void 0:l.crossTotal)!=null?C:0,b=x>v.length,_=["graph-node","graph-node--card",i&&"selected"].filter(Boolean).join(" ");return f.jsxs("div",{className:_,"data-domain":a,"data-kind":n,"data-testid":`model-card-node-${e}`,onClick:k=>{k.stopPropagation(),r==null||r(e)},onKeyDown:k=>{k.target===k.currentTarget&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),k.stopPropagation(),r==null||r(e))},role:r?"button":void 0,tabIndex:r?0:void 0,"aria-pressed":r?i:void 0,children:[f.jsxs("div",{className:"graph-node__card-header",children:[f.jsxs("span",{className:"graph-node__card-title",children:[f.jsx("span",{className:"graph-node__swatch"}),f.jsx("span",{className:"graph-node__label",children:t})]}),n&&f.jsx(Xc,{spec:c,layerId:a,typeId:n,"data-testid":`model-card-kind-tooltip-${e}`,children:f.jsx("span",{className:"graph-node__kind",tabIndex:0,children:n})}),u&&p&&f.jsx("button",{type:"button",className:"graph-node__collapse-toggle","aria-label":h?"Expand":"Collapse","aria-expanded":!h,onClick:k=>{k.stopPropagation(),p()},children:h&&m>0&&f.jsx("span",{className:"graph-node__hidden-badge",children:m})})]}),f.jsxs("div",{className:"graph-node__card-stats","data-testid":`model-card-stats-${e}`,children:[f.jsxs("span",{className:"graph-node__card-stat","data-testid":`model-card-intra-count-${e}`,children:[g," intra-layer"]}),f.jsxs("span",{className:"graph-node__card-stat","data-testid":`model-card-cross-count-${e}`,children:[x," inter-layer"]})]}),v.length>0&&f.jsxs("ul",{className:"graph-node__cross-links","data-testid":`model-card-cross-links-${e}`,children:[v.map((k,L)=>f.jsxs("li",{className:"graph-node__cross-link",title:`${k.predicate} · ${k.targetName} (${Sa(k.targetLayer)})`,children:[f.jsx("span",{className:"graph-node__cross-link-swatch",style:{background:Ls(k.targetLayer)}}),f.jsxs("span",{className:"graph-node__cross-link-label",children:[k.predicate," · ",k.targetName]})]},`${k.predicate}-${k.targetId}-${L}`)),b&&f.jsx("li",{className:"graph-node__cross-link graph-node__cross-link--overflow","data-testid":`model-card-overflow-${e}`,"aria-label":`${x-v.length} more inter-layer connections`,children:"…"})]})]})}function nH(e){const[t,n]=j.useState(),a=j.useRef(null),i=j.useCallback(r=>{a.current&&clearTimeout(a.current),a.current=null,n(l=>l===r?l:void 0),r!==void 0&&(a.current=setTimeout(()=>{a.current=null,n(r)},e))},[e]);return j.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),{dwelledId:t,onHover:i}}function aH(e,t){if(!e)return null;const n=`graph-edge-${t}`,a=Array.from(e.querySelectorAll('[data-testid^="graph-edge-"]')).find(l=>l.getAttribute("data-testid")===n);if(!a)return null;const i=a.querySelector(".graph-edge__label-bg");if(i){const l=i.getBoundingClientRect();if(l.width>0||l.height>0)return l}const r=Array.from(a.querySelectorAll("path")).find(l=>!l.closest("defs"));if(r&&typeof r.getTotalLength=="function"){const l=r.getPointAtLength(r.getTotalLength()/2),c=r.getScreenCTM();if(c){const u=l.x*c.a+l.y*c.c+c.e,h=l.x*c.b+l.y*c.d+c.f;return{left:u,right:u,top:h,bottom:h,width:0,height:0}}}return a.getBoundingClientRect()}function sH(){const e=qe(n=>n.selectedEdgeId),t=qe(n=>n.selectEdge);return{selectedEdgeId:e,edgeSelectionProps:{selectedEdgeId:e!=null?e:void 0,onEdgeSelect:t}}}function Wf(e){return`${e.view}:${e.layerId}:${e.graphLayout}:${e.nodeMarginPreset}:${e.nodeDisplay}:${e.showInterLayerNodes}`}function U0(e){return{center:{x:Math.round(e.center.x*10)/10,y:Math.round(e.center.y*10)/10},zoom:Number(e.zoom.toPrecision(4))}}function Oj(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return t.toString(36)}function iH(e){const t=U0(e);return`${t.center.x},${t.center.y},${t.zoom},${Oj(e.scope)}`}function rH(e){if(!e)return null;const t=e.split(",");if(t.length!==3&&t.length!==4)return null;const[n,a,i]=t.slice(0,3).map(l=>l.trim()===""?NaN:Number(l));if(![n,a,i].every(Number.isFinite)||i<=0)return null;const r=t[3];return r!==void 0&&!/^[0-9a-z]+$/.test(r)?null:$($({},U0({center:{x:n,y:a},zoom:i})),r?{tag:r}:{})}function oH(e,t){return e.tag===void 0||e.tag===Oj(t)}function zj(e,t){return!e||!t?!e&&!t:e.zoom===t.zoom&&e.center.x===t.center.x&&e.center.y===t.center.y}function lH(e){const t=qe(u=>u.graphViewport),n=qe(u=>u.setGraphViewport),a=j.useRef(null),i=j.useRef(null),r=t&&t.scope===e?t:null,l=j.useCallback(u=>{const h=U0(u);i.current={key:e,vp:h},n($({scope:e},h))},[e,n]),c=j.useCallback((u,h)=>{h.kind==="fit"&&h.reason==="mount"||l(u)},[l]);return j.useEffect(()=>{var m;if(!r)return;const u=i.current;if(u&&u.key===e&&zj(u.vp,r))return;const h={center:r.center,zoom:r.zoom};i.current={key:e,vp:h},(m=a.current)==null||m.setViewport(h,{silent:!0,animate:!0})},[r,e]),{viewportRef:a,initialViewport:r?{center:r.center,zoom:r.zoom}:void 0,onViewportDwell:l,onViewportNavigate:c}}const cH=[{value:"graph",label:"graph"},{value:"page",label:"page"}],uH=[{value:"force-clustered",label:"Clustered"},{value:"organic",label:"Organic"},{value:"orthogonal",label:"Orthogonal"}],dH=new Set(["force-clustered"]),Bj=[{value:"on",label:"On"},{value:"off",label:"Off"}],hH=[{value:"tight",label:"Tight"},{value:"default",label:"Default"},{value:"wide",label:"Wide"}],fH=[{value:"structural",label:"Structural"},{value:"all",label:"All"}],pH=[{value:"card",label:"Card"},{value:"pill",label:"Pill"}],mH=120;function gH(e){if(e==="tight")return 0;if(e==="wide")return mH}function yH(){const e=qe(c=>c.graphLayout),t=qe(c=>c.setGraphLayout),n=qe(c=>c.showAllRelations),a=qe(c=>c.toggleShowAllRelations),i=qe(c=>c.showInterLayerNodes),r=qe(c=>c.toggleShowInterLayerNodes),l=qe(c=>c.view);return f.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px 16px"},"data-testid":"graph-header-controls",children:[f.jsx(Ec,{label:"Layout",testId:"graph-layout-control",inline:!0,children:f.jsx(ps,{value:e,onChange:c=>t(c),options:uH})}),f.jsx(Ec,{label:"Relations",testId:"graph-relations-control",inline:!0,children:f.jsx(ps,{value:n?"all":"structural",onChange:c=>{c==="all"!==n&&a()},options:fH})}),l==="model"&&f.jsx(Ec,{label:"Inter-layer",testId:"graph-inter-layer-control",inline:!0,children:f.jsx(ps,{value:i?"on":"off",onChange:c=>{c==="on"!==i&&r()},options:Bj})})]})}const vH=200;function xH(){const[e,t]=j.useState(!1),n=j.useRef(null),a=j.useRef(null),i=j.useRef(!1),r=qe(S=>S.graphLayout),l=qe(S=>S.showClusterBoundaries),c=qe(S=>S.toggleClusterBoundaries),u=qe(S=>S.nodeMarginPreset),h=qe(S=>S.setNodeMarginPreset),m=qe(S=>S.nodeDisplay),p=qe(S=>S.setNodeDisplay),g=qe(S=>S.view),v=()=>{a.current&&clearTimeout(a.current),a.current=null},x=()=>{v(),t(!0)},b=()=>{v(),t(!1)};j.useEffect(()=>v,[]);const _=S=>{if(!S.currentTarget.contains(S.relatedTarget)){if(S.type==="blur"){b();return}v(),a.current=setTimeout(()=>{a.current=null,t(!1)},vH)}};return f.jsx("div",{style:{position:"absolute",top:14,left:14,right:14,zIndex:1,pointerEvents:"none"},"data-testid":"graph-controls",children:f.jsxs("div",{onMouseEnter:x,onMouseLeave:_,onFocus:()=>{if(i.current){i.current=!1;return}x()},onBlur:_,onKeyDown:S=>{var M;S.key==="Escape"&&(b(),i.current=!0,(M=n.current)==null||M.focus())},style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",maxWidth:"100%",pointerEvents:"auto"},"data-testid":"graph-controls-flyout",children:[f.jsx("button",{ref:n,type:"button",className:"graph-toolbar__btn","aria-label":"Graph display options","aria-expanded":e,"aria-controls":"graph-controls-panel","data-testid":"graph-controls-toggle",onClick:x,style:{background:"transparent"},children:f.jsx(nt,{name:"settings",size:16})}),e&&f.jsx("div",{style:{paddingTop:6,maxWidth:"100%",boxSizing:"border-box"},children:f.jsxs("div",{id:"graph-controls-panel",style:{display:"grid",gridTemplateColumns:"auto auto",justifyContent:"start",columnGap:14,rowGap:8,width:"fit-content",maxWidth:"100%",boxSizing:"border-box",padding:"10px 14px",background:"rgb(var(--canvas-card) / 0.5)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",border:"1px solid rgb(var(--canvas-border))",borderRadius:"var(--radius-lg)",boxShadow:"var(--shadow-md)"},"data-testid":"graph-controls-panel",children:[g==="model"&&f.jsx(Ec,{label:"Display",testId:"graph-display-control",children:f.jsx(ps,{value:m,onChange:S=>p(S),options:pH})}),f.jsx(Ec,{label:"Node margin",testId:"graph-margin-control",children:f.jsx(ps,{value:u,onChange:S=>h(S),options:hH})}),dH.has(r)&&f.jsx(Ec,{label:"Boundaries",testId:"graph-boundaries-control",children:f.jsx(ps,{value:l?"on":"off",onChange:S=>{S==="on"!==l&&c()},options:Bj})})]})})]})})}function Ec({label:e,testId:t,inline:n=!1,children:a}){return f.jsxs("div",{style:{display:"flex",flexDirection:n?"row":"column",alignItems:n?"center":"flex-start",gap:n?8:6},"data-testid":t,children:[f.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,textTransform:"uppercase",letterSpacing:"0.08em",color:"rgb(var(--canvas-fg-3))"},children:e}),a]})}function Pf({message:e}){return f.jsx("div",{style:{flex:1,display:"grid",placeItems:"center",color:"rgb(var(--canvas-fg-3))",fontFamily:"'JetBrains Mono',monospace",fontSize:12},"data-testid":"canvas-empty",children:e})}function bH(){var Ae;const e=qe(de=>de.view),t=qe(de=>de.layerId),n=qe(de=>de.selectedId),a=qe(de=>de.highlightedEdgeId),i=qe(de=>de.selectGraphNode),r=qe(de=>de.selectLayer),l=qe(de=>de.navigateToElement),c=qe(de=>de.navSeq),u=qe(de=>de.mode),h=qe(de=>de.setMode),m=qe(de=>de.graphLayout),p=qe(de=>de.showClusterBoundaries),g=qe(de=>de.showAllRelations),v=qe(de=>de.nodeMarginPreset),x=qe(de=>de.nodeDisplay),b=qe(de=>de.showInterLayerNodes),_=y7(),S=u==="page",M=gH(v),C=j.useRef(null),k=Wf({view:e,layerId:t,graphLayout:m,nodeMarginPreset:v,nodeDisplay:x,showInterLayerNodes:b}),L=lH(k),[E,I]=j.useState(null),T=!(E&&E.id===n&&E.navSeq===c),A=j.useCallback(de=>{I({id:de,navSeq:qe.getState().navSeq}),i(de)},[i]),{derived:R}=fr(),{derived:D,raw:O}=pr(),B=e==="spec",z=j.useMemo(()=>Xp(R),[R]),U=j.useMemo(()=>{if(!t||B||!b)return{foreignNodes:[],crossEdges:[],foreignNodeIds:new Set};let de=PP(R,t,z);return g||(de=HP(de,R,t,z)),de},[t,B,b,R,z,g]),{nodes:F,cardData:Y}=j.useMemo(()=>{if(!t)return{nodes:[],cardData:new Map};if(B)return{nodes:MP(O,t),cardData:new Map};const{nodes:de,cardData:Je}=UP(R,t,z);return{nodes:[...de,...U.foreignNodes],cardData:Je}},[B,O,R,t,z,U.foreignNodes]),X=j.useCallback((de,Je,Ge)=>{if(U.foreignNodeIds.has(de.id)){const Fe=()=>{var me;return l(de.id,(me=de.domainColor)!=null?me:"")};return f.jsx("div",{style:{opacity:.6},"data-testid":`foreign-node-wrapper-${de.id}`,children:f.jsx(vx,{id:de.id,label:de.label,kind:de.kind,domainColor:de.domainColor,selected:Je,onSelect:Fe,spec:O,typeId:void 0,hasChildren:Ge==null?void 0:Ge.hasChildren,collapsed:Ge==null?void 0:Ge.collapsed,hiddenDescendantCount:Ge==null?void 0:Ge.hiddenDescendantCount,onToggleCollapse:Ge==null?void 0:Ge.onToggleCollapse})})}return f.jsx(tH,{id:de.id,label:de.label,kind:de.kind,domainColor:de.domainColor,selected:Je,onSelect:A,cardData:Y.get(de.id),spec:O,hasChildren:Ge==null?void 0:Ge.hasChildren,collapsed:Ge==null?void 0:Ge.collapsed,hiddenDescendantCount:Ge==null?void 0:Ge.hiddenDescendantCount,onToggleCollapse:Ge==null?void 0:Ge.onToggleCollapse})},[A,l,Y,O,U.foreignNodeIds]),ne=j.useCallback((de,Je,Ge)=>{var se;const be=U.foreignNodeIds.has(de.id),me=(be?()=>{var le;return l(de.id,(le=de.domainColor)!=null?le:"")}:void 0)||A,Ee=f.jsx(vx,{id:de.id,label:de.label,kind:de.kind,domainColor:de.domainColor,selected:Je,onSelect:me,spec:O,typeId:B?ji((se=de.domainColor)!=null?se:"",de.id):void 0,hasChildren:Ge==null?void 0:Ge.hasChildren,collapsed:Ge==null?void 0:Ge.collapsed,hiddenDescendantCount:Ge==null?void 0:Ge.hiddenDescendantCount,onToggleCollapse:Ge==null?void 0:Ge.onToggleCollapse});return be?f.jsx("div",{style:{opacity:.6},"data-testid":`foreign-node-wrapper-${de.id}`,children:Ee}):Ee},[A,l,O,B,U.foreignNodeIds]),{selectedEdgeId:q,edgeSelectionProps:he}=sH(),pe=j.useMemo(()=>t?B?EP(O,t):[...BP(R,t,z),...U.crossEdges].map(Ge=>Ge.id===q||Ge.id===a?ee($({},Ge),{variant:"hot"}):Ge):[],[B,O,R,t,z,q,a,U.crossEdges]),{dwelledId:H,onHover:te}=nH(Lj),ie=j.useMemo(()=>{if(B||!H)return null;const de=D0(R,H,z,O);return de?f.jsx(Tj,{predicate:de.predicate,sourceTypeLabel:de.sourceNode.type,destinationTypeLabel:de.targetNode.type,"data-testid":"edge-predicate-tooltip"}):null},[B,H,R,z,O]),W=t!=null?t:"",ge=((Ae=D.byLayer[W])==null?void 0:Ae.standard)||Qp(W),we=B?`META-MODEL${ge?` · ${ge}`:""}`:`INSTANCE MODEL${ge?` · ${ge}`:""}`,je=t?B?`${Sa(W)} schema`:Sa(W):B?"Schema":"Model",De=j.useMemo(()=>{var de,Je,Ge;if(!t)return"";if(B){const be=(Je=(de=D.byLayer[W])==null?void 0:de.typeCount)!=null?Je:0,Fe=vj(O,W);return`${be} node types · ${Fe} relationships`}return`${(Ge=R.countsByLayer[W])!=null?Ge:0} elements`},[B,t,W,D,O,R]),re=B?"select a layer to view its schema":"select a layer to view its instance model",Z=B?"no node types in this layer":"no elements in this layer",J=S&&_?_.color:Ls(W),K=S&&_?_.eyebrow:we,Q=S&&_?_.title:je,ae=S&&_?_.idChip:t!=null?t:e,ye=S&&_?_.meta:De;return f.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,background:"rgb(var(--canvas-bg))",borderTopLeftRadius:8,overflow:"hidden"},"data-testid":"canvas",children:[f.jsx(Xx,{className:"canvas-header",style:{flex:"none",padding:"16px 22px 14px"},eyebrow:f.jsxs(f.Fragment,{children:[f.jsx("span",{style:{width:10,height:10,borderRadius:3,flex:"none",background:J,display:"inline-block"}}),f.jsx("span",{children:K})]}),title:Q,idChip:ae,actions:f.jsxs(f.Fragment,{children:[f.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--canvas-fg-3))",marginRight:8},children:ye}),!S&&t&&f.jsx(yH,{}),f.jsx(ps,{value:u,onChange:de=>h(de),options:cH,"data-testid":"canvas-mode-toggle"})]})}),f.jsx("div",{ref:C,style:{flex:1,position:"relative",minHeight:0},children:S?t?_?f.jsx(j7,{pg:_}):f.jsx(Pf,{message:"select a node to view its page"}):f.jsx(Pf,{message:re}):f.jsxs(f.Fragment,{children:[t?F.length===0?f.jsx(Pf,{message:Z}):f.jsxs(f.Fragment,{children:[f.jsx(qp,ee($(ee($({nodes:F,edges:pe,selectedNodeId:n!=null?n:void 0,onNodeSelect:de=>{if(U.foreignNodeIds.has(de)){const Je=z.byUuid.get(de);Je&&l(Je.id,Je.layer_id)}else A(de)}},B?{}:he),{onEdgeHover:B?void 0:te,onBackgroundClick:()=>r(t),renderNode:!B&&x==="card"?X:ne,centerOnSelect:T}),L),{fullscreenContainerRef:C,layout:m,nodeMargin:M,showClusterBoundaries:p,isStructuralEdge:_j,showAllRelations:g,toolbarPosition:"bottom-left",fitView:!0,fitPadding:40,style:{position:"absolute",inset:0,width:"100%",height:"100%"}}),k),f.jsx(xH,{}),H&&ie&&f.jsx(Ej,{getAnchorRect:()=>aH(C.current,H),content:ie,track:!0,passThrough:!0,"data-testid":"edge-predicate-tooltip-card"},H)]}):f.jsx(Pf,{message:re}),f.jsx(eH,{})]})})]})}function _H(e){return e==="staged"?"#FBBF24":"#10B981"}function mN({message:e}){return f.jsx("div",{style:{flex:1,display:"grid",placeItems:"center",color:"rgb(var(--canvas-fg-3))",fontFamily:"'JetBrains Mono',monospace",fontSize:12},"data-testid":"changeset-canvas-empty",children:e})}function wH({row:e}){const[t,n]=j.useState(!1),a=qe(r=>r.canvasDark),i=t&&e.hasDiff?pP(e.raw):[];return f.jsxs("div",{style:{background:"rgb(var(--canvas-card))",border:"1px solid rgb(var(--canvas-border))",borderRadius:8,overflow:"hidden"},"data-testid":"changeset-row","data-op":e.op,children:[f.jsxs("div",{role:e.hasDiff?"button":void 0,tabIndex:e.hasDiff?0:void 0,onClick:e.hasDiff?()=>n(r=>!r):void 0,onKeyDown:e.hasDiff?r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),n(l=>!l))}:void 0,style:{display:"flex",alignItems:"flex-start",gap:12,padding:"12px 14px",cursor:e.hasDiff?"pointer":"default"},children:[f.jsx("span",{style:{flex:"none",fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.05em",textTransform:"uppercase",padding:"3px 8px",borderRadius:4,width:42,textAlign:"center",background:e.meta.background,color:a?e.meta.color:e.meta.colorLight},"data-testid":"changeset-op-badge",children:e.meta.label}),f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,minWidth:0,flex:1},children:[f.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:12,color:"rgb(var(--canvas-fg-1))",wordBreak:"break-all"},children:e.elementId}),f.jsx("span",{style:{fontSize:12,color:"rgb(var(--canvas-fg-3))",lineHeight:1.45},children:e.detail})]}),e.layerName&&f.jsx("span",{style:{flex:"none",fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))",alignSelf:"center"},children:e.layerName})]}),t&&e.hasDiff&&f.jsx("div",{style:{borderTop:"1px solid rgb(var(--canvas-border))",padding:"10px 14px 14px"},children:i.length>0?f.jsx(Jx,{lines:i}):f.jsx("div",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--canvas-fg-3))"},children:"no field-level changes"})})]})}function SH(){var c,u,h,m,p,g;const e=qe(v=>v.changesetId),{derived:t}=nh(),{detail:n}=gj(e),a=t.list.find(v=>v.id===e),i=(u=(c=n==null?void 0:n.name)!=null?c:a==null?void 0:a.name)!=null?u:"",r=(m=(h=n==null?void 0:n.status)!=null?h:a==null?void 0:a.status)!=null?m:"unknown",l=(g=(p=n==null?void 0:n.changesCount)!=null?p:a==null?void 0:a.changesCount)!=null?g:0;return f.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,background:"rgb(var(--canvas-bg))",borderTopLeftRadius:8,overflow:"hidden"},"data-testid":"canvas",children:[e&&f.jsx(Xx,{style:{flex:"none",padding:"16px 22px 14px"},eyebrow:f.jsxs(f.Fragment,{children:[f.jsx("span",{style:{width:10,height:10,borderRadius:3,flex:"none",background:_H(r),display:"inline-block"}}),f.jsx("span",{children:"CHANGESET"})]}),title:i,idChip:r,actions:f.jsxs("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--canvas-fg-3))"},children:[l," changes"]})}),f.jsx("div",{style:{flex:1,position:"relative",minHeight:0},children:e?n?f.jsxs("div",{className:"drv-scroll",style:{position:"absolute",inset:0,overflowY:"auto",padding:"20px 22px"},"data-testid":"changeset-list",children:[f.jsx("p",{style:{fontSize:13,color:"rgb(var(--canvas-fg-2))",margin:"0 0 18px 0",maxWidth:620,lineHeight:1.5},children:mP(n.name,n.stats)}),f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,maxWidth:760},children:n.rows.map(v=>f.jsx(wH,{row:v},v.key))})]}):f.jsx(mN,{message:"loading changeset…"}):f.jsx(mN,{message:"select a changeset to view its changes"})})]})}function gN(e){return e==="staged"?{color:"amber",label:"STAGED"}:e==="discarded"?{color:"neutral",label:"DISCARDED"}:e==="committed"?{color:"emerald",label:"COMMITTED"}:{color:"neutral",label:e.toUpperCase()}}function yN(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function cv({label:e,value:t}){return f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[f.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))"},children:e}),f.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:12,color:"rgb(var(--canvas-fg-1))",wordBreak:"break-all"},children:t})]})}function vN(e,t){return`${e} ${t}${e===1?"":"s"}`}function NH({detail:e,notify:t}){const n=GT(e.id),a=KT(e.id),[i,r]=j.useState(null),[l,c]=j.useState(null),u=n.isPending||a.isPending,h=vN(e.changesCount,"change"),m=p=>{r(null),c(null),(p==="commit"?n:a).mutate(void 0,{onSuccess:v=>{var _;const b=p==="commit"?`Applied ${vN((_=v.committed)!=null?_:e.changesCount,"change")} to the model`:`Discarded ${e.name}`;t("success",b)},onError:v=>c(vP(v))})};return f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},"data-testid":"changeset-actions",children:[f.jsxs("div",{style:{display:"flex",gap:8},children:[f.jsx(Bn,{variant:"accent",size:"sm",disabled:u||e.changesCount===0,onClick:()=>r("commit"),"data-testid":"changeset-apply-button",children:n.isPending?"Applying…":"Apply"}),f.jsx(Bn,{variant:"secondary",size:"sm",disabled:u,onClick:()=>r("discard"),"data-testid":"changeset-discard-button",children:a.isPending?"Discarding…":"Discard"})]}),l&&f.jsx("div",{role:"alert","data-testid":"changeset-action-error",style:{padding:"8px 10px",borderRadius:"var(--radius-md, 6px)",border:"1px solid rgb(var(--status-error) / 0.5)",background:"rgb(var(--status-error) / 0.08)",color:"rgb(var(--canvas-fg-1))",fontFamily:"'JetBrains Mono',monospace",fontSize:11,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:l}),f.jsx(up,{isOpen:i==="commit",onClose:()=>r(null),onConfirm:()=>m("commit"),title:"Apply changeset",message:`Apply the ${h} in "${e.name}" to the model? They are validated first, and nothing is written if any change fails.`,confirmLabel:"Apply",variant:"primary"}),f.jsx(up,{isOpen:i==="discard",onClose:()=>r(null),onConfirm:()=>m("discard"),title:"Discard changeset",message:`Throw away the ${h} in "${e.name}"? The model is not changed, and this can't be undone.`,confirmLabel:"Discard",variant:"danger"})]})}function kH(){const e=qe(r=>r.changesetId),{detail:t}=gj(e),[n,a]=j.useState({open:!1,variant:"success",title:""}),i=(r,l)=>a({open:!0,variant:r,title:l});return f.jsxs("div",{style:{width:320,flex:"none",borderLeft:"1px solid rgb(var(--canvas-border))",background:"rgb(var(--canvas-surface))",display:"flex",flexDirection:"column",minHeight:0},"data-testid":"inspector",children:[!e||!t?f.jsx("div",{style:{flex:1,display:"grid",placeItems:"center",padding:24,textAlign:"center",color:"rgb(var(--canvas-fg-3))",fontFamily:"'JetBrains Mono',monospace",fontSize:12},"data-testid":"changeset-inspector-empty",children:e?"loading changeset…":"Select a changeset to inspect."}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{style:{flex:"none",padding:"16px 16px 14px",borderBottom:"1px solid rgb(var(--canvas-border))"},children:[f.jsx("div",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.1em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))",marginBottom:6},children:"CHANGESET"}),f.jsx("div",{style:{fontSize:16,fontWeight:600,color:"rgb(var(--canvas-fg-1))",lineHeight:1.3},children:t.name}),f.jsxs("div",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--canvas-fg-3))",marginTop:4},children:[t.changesCount," changes"]})]}),f.jsxs("div",{className:"drv-scroll",style:{flex:1,minHeight:0,overflowY:"auto",padding:16,display:"flex",flexDirection:"column",gap:16},children:[f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[f.jsx(Fx,{color:gN(t.status).color,"aria-label":t.status}),f.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,letterSpacing:"0.06em",color:"rgb(var(--canvas-fg-2))"},children:gN(t.status).label})]}),t.status==="staged"&&f.jsx(NH,{detail:t,notify:i},t.id),f.jsxs("div",{style:{display:"flex",gap:8},children:[f.jsx(Mc,{label:"Added",value:t.stats.additions,color:"emerald",style:{flex:1,padding:11}}),f.jsx(Mc,{label:"Modified",value:t.stats.modifications,color:"cyan",style:{flex:1,padding:11}}),f.jsx(Mc,{label:"Deleted",value:t.stats.deletions,color:"rose",style:{flex:1,padding:11}})]}),f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[f.jsx(cv,{label:"Created",value:yN(t.created)}),f.jsx(cv,{label:"Modified",value:yN(t.modified)}),t.baseSnapshot&&f.jsx(cv,{label:"Base Snapshot",value:t.baseSnapshot})]})]})]}),f.jsx(Kx,{isOpen:n.open,onClose:()=>a(r=>ee($({},r),{open:!1})),variant:n.variant,title:n.title})]})}class yt extends Error{constructor(t,n,a){super(n),this.code=t,this.context=a,this.name="ChatValidationError"}}function Hf(e){if(typeof e!="string"||e.trim().length===0)throw new yt("INVALID_MESSAGE_ID","Message ID must be a non-empty string",{id:e})}function $j(e){if(!e||typeof e!="object")throw new yt("INVALID_CONTENT","Content must be an object",{content:e});const t=e,n=t.type;if(typeof n!="string")throw new yt("INVALID_CONTENT_TYPE","Content must have a type field that is a string",{type:n});if(typeof t.timestamp!="string")throw new yt("MISSING_TIMESTAMP","Content must have a timestamp field",{timestamp:t.timestamp});switch(n){case"text":{if(typeof t.content!="string")throw new yt("INVALID_TEXT_CONTENT","Text content must have a content field that is a string",{content:t.content});break}case"tool_invocation":{if(typeof t.toolUseId!="string"||t.toolUseId.length===0)throw new yt("INVALID_TOOL_USE_ID","Tool invocation must have a non-empty toolUseId",{toolUseId:t.toolUseId});if(typeof t.toolName!="string")throw new yt("INVALID_TOOL_NAME","Tool invocation must have a toolName field",{toolName:t.toolName});if(!t.toolInput||typeof t.toolInput!="object")throw new yt("INVALID_TOOL_INPUT","Tool invocation must have a toolInput field",{toolInput:t.toolInput});if(!t.status||typeof t.status!="object")throw new yt("INVALID_TOOL_STATUS","Tool invocation must have a status field",{status:t.status});break}case"thinking":{if(typeof t.content!="string")throw new yt("INVALID_THINKING_CONTENT","Thinking content must have a content field that is a string",{content:t.content});break}case"usage":{if(typeof t.inputTokens!="number")throw new yt("INVALID_USAGE","Usage content must have an inputTokens field that is a number",{inputTokens:t.inputTokens});if(typeof t.outputTokens!="number")throw new yt("INVALID_USAGE","Usage content must have an outputTokens field that is a number",{outputTokens:t.outputTokens});if(typeof t.totalTokens!="number")throw new yt("INVALID_USAGE","Usage content must have a totalTokens field that is a number",{totalTokens:t.totalTokens});if(typeof t.totalCostUsd!="number")throw new yt("INVALID_USAGE","Usage content must have a totalCostUsd field that is a number",{totalCostUsd:t.totalCostUsd});break}case"error":{if(typeof t.code!="string")throw new yt("INVALID_ERROR","Error content must have a code field that is a string",{code:t.code});if(typeof t.message!="string")throw new yt("INVALID_ERROR","Error content must have a message field that is a string",{message:t.message});break}default:throw new yt("UNKNOWN_CONTENT_TYPE",`Unknown content type: ${n}. Must be one of: text, tool_invocation, thinking, usage, error`,{type:n})}}function CH(e){if(!e||typeof e!="object")throw new yt("INVALID_MESSAGE","Message must be an object",{message:e});const t=e;if(typeof t.id!="string"||t.id.length===0)throw new yt("INVALID_MESSAGE_ID","Message must have a non-empty id field",{id:t.id});if(typeof t.role!="string")throw new yt("INVALID_ROLE","Message must have a role field that is a string",{role:t.role});const n=["user","assistant","system"];if(!n.includes(t.role))throw new yt("INVALID_ROLE_VALUE",`Role must be one of: ${n.join(", ")}`,{role:t.role});if(typeof t.conversationId!="string"||t.conversationId.length===0)throw new yt("INVALID_CONVERSATION_ID","Message must have a non-empty conversationId field",{conversationId:t.conversationId});if(typeof t.timestamp!="string"||t.timestamp.length===0)throw new yt("INVALID_TIMESTAMP","Message must have a non-empty timestamp field",{timestamp:t.timestamp});if(!Array.isArray(t.parts))throw new yt("INVALID_PARTS","Message must have a parts field that is an array",{parts:t.parts});for(let a=0;a<t.parts.length;a++)try{$j(t.parts[a])}catch(i){throw i instanceof yt?new yt(i.code,`Invalid content at parts[${a}]: ${i.message}`,ee($({},i.context),{partIndex:a})):i}if(t.isStreaming!==void 0&&typeof t.isStreaming!="boolean")throw new yt("INVALID_STREAMING_FLAG","isStreaming must be a boolean",{isStreaming:t.isStreaming})}function MH(e){if(!e||typeof e!="object")throw new yt("INVALID_SDK_STATUS","SDK status must be an object",{status:e});const t=e;if(typeof t.sdkAvailable!="boolean")throw new yt("INVALID_SDK_AVAILABLE","sdkAvailable must be a boolean",{sdkAvailable:t.sdkAvailable});if(t.sdkVersion!==null&&typeof t.sdkVersion!="string")throw new yt("INVALID_SDK_VERSION","sdkVersion must be a string or null",{sdkVersion:t.sdkVersion});if(t.errorMessage!==null&&typeof t.errorMessage!="string")throw new yt("INVALID_ERROR_MESSAGE","errorMessage must be a string or null",{errorMessage:t.errorMessage})}function jH(e){if(e!==null&&(typeof e!="string"||e.length===0))throw new yt("INVALID_CONVERSATION_ID","Conversation ID must be a non-empty string or null",{id:e})}function EH(e){if(e!==null&&typeof e!="string")throw new yt("INVALID_ERROR_MESSAGE","Error message must be a string or null",{error:e})}function RH(e){if(!e||typeof e!="object")throw new yt("INVALID_UPDATES","Updates must be an object",{updates:e});const t=e;if(t.id!==void 0&&(typeof t.id!="string"||t.id.length===0))throw new yt("INVALID_ID_UPDATE","Updated id must be a non-empty string",{id:t.id});if(t.role!==void 0){const n=["user","assistant","system"];if(!n.includes(t.role))throw new yt("INVALID_ROLE_UPDATE",`Updated role must be one of: ${n.join(", ")}`,{role:t.role})}if(t.conversationId!==void 0&&(typeof t.conversationId!="string"||t.conversationId.length===0))throw new yt("INVALID_CONVERSATION_ID_UPDATE","Updated conversationId must be a non-empty string",{conversationId:t.conversationId});if(t.timestamp!==void 0&&typeof t.timestamp!="string")throw new yt("INVALID_TIMESTAMP_UPDATE","Updated timestamp must be a string",{timestamp:t.timestamp});if(t.isStreaming!==void 0&&typeof t.isStreaming!="boolean")throw new yt("INVALID_STREAMING_UPDATE","Updated isStreaming must be a boolean",{isStreaming:t.isStreaming});if(t.parts!==void 0)throw new yt("INVALID_PARTS_UPDATE","Parts cannot be directly updated - use appendPart or appendTextContent instead",{parts:t.parts})}function LH(e){if(!e||typeof e!="object")throw new yt("INVALID_UPDATES","Updates must be an object",{updates:e});const t=e;if(t.toolName!==void 0&&(typeof t.toolName!="string"||t.toolName.length===0))throw new yt("INVALID_TOOL_NAME","Updated toolName must be a non-empty string",{toolName:t.toolName});if(t.toolInput!==void 0&&(typeof t.toolInput!="object"||t.toolInput===null))throw new yt("INVALID_TOOL_INPUT","Updated toolInput must be an object",{toolInput:t.toolInput});if(t.status!==void 0){if(typeof t.status!="object"||t.status===null)throw new yt("INVALID_TOOL_STATUS","Updated status must be an object",{status:t.status});const n=t.status,a=["executing","completed","failed"];if(!a.includes(n.state))throw new yt("INVALID_STATUS_STATE",`Updated status state must be one of: ${a.join(", ")}`,{state:n.state})}}const Ga=jp((e,t)=>({messages:[],activeConversationId:null,isStreaming:!1,sdkStatus:null,error:null,setActiveConversationId:n=>{jH(n),e({activeConversationId:n})},setStreaming:n=>{if(typeof n!="boolean")throw new yt("INVALID_STREAMING_FLAG","isStreaming must be a boolean",{isStreaming:n});e({isStreaming:n})},setSdkStatus:n=>{n!==null&&MH(n),e({sdkStatus:n})},setError:n=>{EH(n),e({error:n})},reset:()=>e({messages:[],activeConversationId:null,isStreaming:!1,sdkStatus:null,error:null}),addMessage:n=>{CH(n);const i=t();if(i.messages.length>=1e3)throw new yt("MAX_MESSAGES_EXCEEDED","Cannot add message: maximum limit of 1000 messages reached",{currentCount:i.messages.length,maxLimit:1e3});i.activeConversationId&&n.conversationId!==i.activeConversationId&&console.warn(`Message conversationId "${n.conversationId}" does not match active conversationId "${i.activeConversationId}"`),e(r=>({messages:[...r.messages,n]}))},updateMessage:(n,a)=>{if(Hf(n),RH(a),!t().messages.some(l=>l.id===n))throw new yt("MESSAGE_NOT_FOUND",`Message with id "${n}" not found`,{id:n});e(l=>({messages:l.messages.map(c=>c.id===n?$($({},c),a):c)}))},deleteMessage:n=>{Hf(n),e(a=>({messages:a.messages.filter(i=>i.id!==n)}))},appendPart:(n,a)=>{Hf(n),$j(a);const l=t().messages.find(c=>c.id===n);if(!l)throw new yt("MESSAGE_NOT_FOUND",`Message with id "${n}" not found`,{messageId:n});if(l.parts.length>=500)throw new yt("MAX_PARTS_EXCEEDED","Cannot append part: maximum limit of 500 parts per message reached",{messageId:n,currentCount:l.parts.length,maxLimit:500});e(c=>({messages:c.messages.map(u=>{if(u.id===n){const h=ee($({},a),{timestamp:a.timestamp&&a.timestamp.length>0?a.timestamp:new Date().toISOString()});return ee($({},u),{parts:[...u.parts,h]})}return u})}))},appendTextContent:(n,a)=>{if(Hf(n),typeof a!="string")throw new yt("INVALID_TEXT_CONTENT","Content must be a string",{content:a});const l=t().messages.find(h=>h.id===n);if(!l)throw new yt("MESSAGE_NOT_FOUND",`Message with id "${n}" not found`,{messageId:n});const c=l.parts[l.parts.length-1];if(!(c&&c.type==="text")&&l.parts.length>=500)throw new yt("MAX_PARTS_EXCEEDED","Cannot append part: maximum limit of 500 parts per message reached",{messageId:n,currentCount:l.parts.length,maxLimit:500});e(h=>({messages:h.messages.map(m=>{if(m.id===n){const p=m.parts[m.parts.length-1];if(p&&p.type==="text"){const v=[...m.parts];return v[m.parts.length-1]=ee($({},p),{content:p.content+a}),ee($({},m),{parts:v})}const g={type:"text",content:a,timestamp:new Date().toISOString()};return ee($({},m),{parts:[...m.parts,g]})}return m})}))},updateToolInvocation:(n,a)=>{if(typeof n!="string"||n.length===0)throw new yt("INVALID_TOOL_USE_ID","toolUseId must be a non-empty string",{toolUseId:n});LH(a);const i=t();let r=!1;for(const l of i.messages){for(const c of l.parts)if(c.type==="tool_invocation"&&"toolUseId"in c&&c.toolUseId===n){r=!0;break}if(r)break}if(!r)throw new yt("TOOL_NOT_FOUND",`Tool invocation with toolUseId "${n}" not found`,{toolUseId:n});e(l=>({messages:l.messages.map(c=>ee($({},c),{parts:c.parts.map(u=>u.type==="tool_invocation"&&"toolUseId"in u&&u.toolUseId===n?$($({},u),a):u)}))}))},getLastMessage:()=>{const n=t().messages;return n.length>0?n[n.length-1]:void 0},getMessagesByConversation:n=>t().messages.filter(a=>a.conversationId===n),getCurrentStreamingMessage:()=>{const n=t().messages;for(let a=n.length-1;a>=0;a--)if(n[a].isStreaming)return n[a]}})),TH="modulepreload",AH=function(e){return"/"+e},xN={},IH=function(t,n,a){let i=Promise.resolve();if(n&&n.length>0){let l=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),u=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=l(n.map(h=>{if(h=AH(h),h in xN)return;xN[h]=!0;const m=h.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":TH,m||(g.as="script"),g.crossOrigin="",g.href=h,u&&g.setAttribute("nonce",u),document.head.appendChild(g),m)return new Promise((v,x)=>{g.addEventListener("load",v),g.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&r(c.reason);return t().catch(r)})};class F0 extends Error{constructor(t,n,a){super(a),this.code=t,this.rpcError=n,this.name="JsonRpcErrorResult",Object.setPrototypeOf(this,F0.prototype)}}class DH{constructor(){nn(this,"pendingRequests",new Map);nn(this,"notificationHandlers",new Map);nn(this,"requestTimeout",3e4);nn(this,"requestIdCounter",1);nn(this,"messageListenerAttached",!1);nn(this,"messageListenerAttachmentInProgress",!1);nn(this,"cachedWebSocketClient",null);this.ensureMessageListenerAttached()}getWebSocketClient(){return St(this,null,function*(){if(this.cachedWebSocketClient)return this.cachedWebSocketClient;try{const t=yield IH(()=>Promise.resolve().then(()=>iP),void 0);return this.cachedWebSocketClient=t.websocketClient,this.cachedWebSocketClient}catch(t){throw Tn(Sn.JSONRPC_WEBSOCKET_LOAD_FAILED,"Failed to load WebSocket client - JSON-RPC communication will not be available",{},t instanceof Error?t:new Error(String(t))),t}})}ensureMessageListenerAttachedAsync(){return St(this,null,function*(){if(!this.messageListenerAttached&&!this.messageListenerAttachmentInProgress){this.messageListenerAttachmentInProgress=!0;try{const t=yield this.getWebSocketClient();t.on("message",n=>{try{if(!this.isValidJsonRpcMessage(n)){Tn(Sn.JSONRPC_MESSAGE_PARSE_FAILED,"Invalid JSON-RPC message structure - missing required fields",{message:String(n)});return}this.handleMessage(n)}catch(a){a instanceof TypeError?Tn(Sn.JSONRPC_MESSAGE_PARSE_FAILED,"Invalid JSON-RPC message structure",{error:a instanceof Error?a.message:String(a),message:String(n)},a instanceof Error?a:new Error(String(a))):Tn(Sn.JSONRPC_MESSAGE_HANDLER_ERROR,"Unexpected error while handling JSON-RPC message - possible programming bug",{error:a instanceof Error?a.message:String(a),errorType:a instanceof Error?a.constructor.name:typeof a,message:String(n),stack:a instanceof Error?a.stack:void 0},a instanceof Error?a:new Error(String(a)))}}),t.on("close",()=>this.clearPendingRequests()),this.messageListenerAttached=!0}catch(t){Tn(Sn.JSONRPC_ATTACH_LISTENER_FAILED,"Failed to attach message listener to WebSocket - JSON-RPC responses will not be received",{error:t instanceof Error?t.message:String(t)},t instanceof Error?t:new Error(String(t)))}finally{this.messageListenerAttachmentInProgress=!1}}})}ensureMessageListenerAttached(){this.messageListenerAttached||this.messageListenerAttachmentInProgress||this.ensureMessageListenerAttachedAsync().catch(t=>{Tn(Sn.JSONRPC_ATTACH_LISTENER_BACKGROUND_FAILED,"Failed to attach message listener in background",{error:t instanceof Error?t.message:String(t)})})}sendRequest(t,n,a){return St(this,null,function*(){const i=this.generateRequestId(),r={jsonrpc:"2.0",method:t,id:i};return n&&(r.params=n),new Promise((l,c)=>{const u=a!=null?a:this.requestTimeout,h=setTimeout(()=>{this.pendingRequests.delete(i),c(new Error(`JSON-RPC request timeout for method '${t}' after ${u}ms`))},u);this.pendingRequests.set(i,{id:i,method:t,resolve:m=>l(m),reject:c,timeout:h}),this._sendRequestMessage(r,i,h,c)})})}sendNotification(t,n){const a=$({jsonrpc:"2.0",method:t},n&&{params:n});this._sendNotificationMessage(a,t)}_sendRequestMessage(t,n,a,i){return St(this,null,function*(){try{if(!(yield this.getWebSocketClient()).send(t)){this.pendingRequests.delete(n),clearTimeout(a);const c="Failed to send JSON-RPC request: WebSocket not connected";Tn(Sn.JSONRPC_SEND_REQUEST_FAILED,c,{method:t.method}),i(new Error(c))}}catch(r){this.pendingRequests.delete(n),clearTimeout(a);const l=`Failed to send JSON-RPC request: ${r instanceof Error?r.message:"Unknown error"}`;Tn(Sn.JSONRPC_SEND_REQUEST_FAILED,l,{error:r instanceof Error?r.message:String(r),method:t.method}),i(new Error(l))}})}_sendNotificationMessage(t,n){return St(this,null,function*(){try{(yield this.getWebSocketClient()).send(t)||Tn(Sn.JSONRPC_SEND_NOTIFICATION_FAILED,`Failed to send notification for method '${n}': WebSocket not connected`,{method:n})}catch(a){Tn(Sn.JSONRPC_SEND_NOTIFICATION_FAILED,`Failed to send notification for method '${n}'`,{error:a instanceof Error?a.message:String(a),method:n})}})}onNotification(t,n){this.notificationHandlers.has(t)||this.notificationHandlers.set(t,new Set);const a=this.notificationHandlers.get(t);return a.add(n),()=>{a.delete(n),a.size===0&&this.notificationHandlers.delete(t)}}handleMessage(t){"result"in t||"error"in t?this.handleResponse(t):"method"in t&&!("id"in t)&&this.handleNotification(t)}handleResponse(t){const{id:n}=t,a=this.pendingRequests.get(n);if(!a){const i=`Received JSON-RPC response for unknown request ID: ${n}. This may indicate a timing issue or protocol error.`;Tn(Sn.JSONRPC_UNKNOWN_RESPONSE_ID,i,{responseId:n},new Error(i));return}if(this.pendingRequests.delete(n),clearTimeout(a.timeout),"result"in t)a.resolve(t.result);else if("error"in t){const i=this.createError(t.error,a.method);a.reject(i)}}handleNotification(t){const{method:n,params:a}=t;if(!n){xd("Received notification without method");return}const i=this.notificationHandlers.get(n);!i||i.size===0||i.forEach(r=>{try{const l=r(a!=null?a:{});l&&typeof l.then=="function"&&l.catch(c=>{Tn(Sn.JSONRPC_NOTIFICATION_HANDLER_ERROR,`Error in notification handler for '${n}'`,{error:c instanceof Error?c.message:String(c),method:n})})}catch(l){Tn(Sn.JSONRPC_NOTIFICATION_HANDLER_ERROR,`Error in notification handler for '${n}'`,{error:l instanceof Error?l.message:String(l),method:n})}})}createError(t,n){const a=`JSON-RPC Error (${t.code}): ${t.message} [method: ${n}]`;return new F0(t.code,t,a)}generateRequestId(){return`req-${Date.now()}-${this.requestIdCounter++}`}clearPendingRequests(){this.pendingRequests.forEach(({timeout:n})=>{clearTimeout(n)});const t=new Error("WebSocket connection closed");this.pendingRequests.forEach(({reject:n})=>{n(t)}),this.pendingRequests.clear()}getPendingRequestCount(){return this.pendingRequests.size}static validateRequest(t){if(typeof t!="object"||t===null)return!1;const n=t;return n.jsonrpc==="2.0"&&typeof n.method=="string"&&(n.id===void 0||typeof n.id=="string"||typeof n.id=="number")}static validateResponse(t){if(typeof t!="object"||t===null)return!1;const n=t;return n.jsonrpc!=="2.0"||n.id===void 0&&n.id!==0?!1:"result"in n&&!("error"in n)||"error"in n&&!("result"in n)}isValidJsonRpcMessage(t){if(typeof t!="object"||t===null)return!1;const n=t;if(n.jsonrpc!=="2.0")return!1;const a="id"in n,i="method"in n,r="result"in n,l="error"in n;return a&&(r||l)?r&&!l||!r&&l:!!(i&&!a)}}const Jr=new DH,bN={model:"Model (architecture element instances)",spec:"Schema (the meta-model: node types and allowed relationships)",changesets:"Changesets"};function OH(e){const t=[],n=e.view==="changesets"?bN.changesets:`${bN[e.view]}, ${e.mode} view`;if(t.push(`View: ${n}`),e.view==="changesets"){if(!e.changeset)return null;t.push(`Selected changeset: "${e.changeset.name}" (id ${e.changeset.id})`)}else{if(!e.layerId)return null;if(t.push(`Layer: ${e.layerLabel?`${e.layerLabel} (${e.layerId})`:e.layerId}`),e.selectedNode){const a=e.selectedNode;t.push(`Selected element: "${a.name}" (${au(a)}, type ${a.type}, uuid ${a.id})`)}else if(e.selectedSpecNodeId)t.push(`Selected node type: ${e.selectedSpecNodeId}`);else if(e.selectedEdge){const a=e.selectedEdge;t.push(`Selected relationship: "${a.source.name}" (${a.source.ref}) --${a.predicate}--> "${a.target.name}" (${a.target.ref})`)}else t.push("Nothing selected within the layer.")}return["<viewer-context>","The user is asking from the Documentation Robotics viewer. This is what they have open;",'use it to resolve "this", "here", "this element" and "this layer".',...t,"</viewer-context>"].join(`
|
|
82
|
+
`)}function zH(e,t){return t?`${t}
|
|
83
|
+
|
|
84
|
+
${e}`:e}function _N(e,t,n){switch(e){case"executing":return{state:"executing"};case"completed":return{state:"completed",result:t};case"failed":return{state:"failed",error:n||"Unknown error"};default:return console.warn(`[ChatService] Unknown tool status: "${e}", treating as executing`),{state:"executing"}}}const BH=900*1e3;class $H{constructor(){nn(this,"currentConversationId",null);nn(this,"currentRequestId",null);nn(this,"statuslessToolIds",new Set);nn(this,"toolIdCounter",0);this.setupNotificationHandlers()}setupNotificationHandlers(){Jr.onNotification("chat.response.chunk",t=>{this.handleResponseChunk(t)}),Jr.onNotification("chat.tool.invoke",t=>{this.handleToolInvoke(t)}),Jr.onNotification("chat.thinking",t=>{this.handleThinking(t)}),Jr.onNotification("chat.usage",t=>{this.handleUsage(t)}),Jr.onNotification("chat.error",t=>{this.handleError(t)})}getStatus(){return St(this,null,function*(){var t,n,a,i,r,l;try{const c=yield Jr.sendRequest("chat.status",{}),u={sdkAvailable:(n=(t=c.sdkAvailable)!=null?t:c.sdk_available)!=null?n:!1,sdkVersion:(i=(a=c.sdkVersion)!=null?a:c.sdk_version)!=null?i:null,errorMessage:(l=(r=c.errorMessage)!=null?r:c.error_message)!=null?l:null};return Ga.getState().setSdkStatus(u),u}catch(c){const u=c instanceof Error?c.message:"Unknown error";Tn(Sn.CHAT_GET_STATUS_FAILED,"Failed to get status",{error:u});const h={sdkAvailable:!1,sdkVersion:null,errorMessage:u};throw Ga.getState().setSdkStatus(h),c}})}sendMessage(t,n){return St(this,null,function*(){if(!t.trim())throw new Error("Message cannot be empty");const a=Ga.getState(),r={id:this.generateMessageId(),role:"user",conversationId:this.currentConversationId||this.generateConversationId(),timestamp:new Date().toISOString(),parts:[{type:"text",content:t,timestamp:new Date().toISOString()}]};this.currentConversationId=r.conversationId,a.setActiveConversationId(this.currentConversationId),a.addMessage(r);const l=this.generateMessageId(),c={id:l,role:"assistant",conversationId:r.conversationId,timestamp:new Date().toISOString(),parts:[],isStreaming:!0};a.addMessage(c),a.setStreaming(!0),a.setError(null);try{this.currentRequestId=this.generateRequestId();const u=yield Jr.sendRequest("chat.send",{message:zH(t,n!=null?n:null),conversation_id:r.conversationId},BH);return this.completeStatuslessTools(),a.updateMessage(l,{isStreaming:!1}),a.setStreaming(!1),u}catch(u){this.completeStatuslessTools(),a.setStreaming(!1);const h=u instanceof Error?u.message:"Unknown error";throw a.setError(h),Tn(Sn.CHAT_SEND_FAILED,"Failed to send message",{error:h,message:t}),a.appendPart(l,{type:"error",code:"SEND_FAILED",message:h,timestamp:new Date().toISOString()}),u}})}cancelMessage(){return St(this,null,function*(){const t=Ga.getState();try{const n=yield Jr.sendRequest("chat.cancel",this.currentConversationId?{conversation_id:this.currentConversationId}:{},5e3);return t.setStreaming(!1),n}catch(n){const a=n instanceof Error?n.message:"Unknown error";throw Tn(Sn.CHAT_CANCEL_FAILED,"Failed to cancel",{error:a}),t.setStreaming(!1),n}})}handleResponseChunk(t){const n=Ga.getState(),a=n.getCurrentStreamingMessage();if(!a){xd("Received response chunk but no streaming message");return}this.completeStatuslessTools(),n.appendTextContent(a.id,t.content)}completeStatuslessTools(){if(this.statuslessToolIds.size===0)return;const t=Ga.getState();for(const n of this.statuslessToolIds)try{t.updateToolInvocation(n,{status:{state:"completed",result:void 0}})}catch(a){}this.statuslessToolIds.clear()}handleToolInvoke(t){var u,h,m,p,g;const n=Ga.getState(),a=n.getCurrentStreamingMessage();if(!a){xd("Received tool invoke but no streaming message");return}const i=(h=(u=t.toolName)!=null?u:t.tool_name)!=null?h:"tool",r=(p=(m=t.toolInput)!=null?m:t.tool_input)!=null?p:{};if(!t.tool_use_id){this.completeStatuslessTools();const v=`local-tool-${++this.toolIdCounter}`;n.appendPart(a.id,{type:"tool_invocation",toolUseId:v,toolName:i,toolInput:r,status:t.status?_N(t.status,t.result,t.error):{state:"executing"},timestamp:t.timestamp||new Date().toISOString()}),(!t.status||t.status==="executing")&&this.statuslessToolIds.add(v);return}const l=_N((g=t.status)!=null?g:"executing",t.result,t.error),c=a.parts.find(v=>v.type==="tool_invocation"&&v.toolUseId===t.tool_use_id);t.status===void 0?this.statuslessToolIds.add(t.tool_use_id):this.statuslessToolIds.delete(t.tool_use_id),c?n.updateToolInvocation(t.tool_use_id,{status:l}):n.appendPart(a.id,{type:"tool_invocation",toolUseId:t.tool_use_id,toolName:i,toolInput:r,status:l,timestamp:t.timestamp||new Date().toISOString()})}handleThinking(t){const n=Ga.getState(),a=n.getCurrentStreamingMessage();if(!a){xd("Received thinking but no streaming message");return}n.appendPart(a.id,{type:"thinking",content:t.content,timestamp:t.timestamp||new Date().toISOString()})}handleUsage(t){const n=Ga.getState(),a=n.getCurrentStreamingMessage();if(!a){xd("Received usage but no streaming message");return}n.appendPart(a.id,{type:"usage",inputTokens:t.input_tokens,outputTokens:t.output_tokens,totalTokens:t.total_tokens,totalCostUsd:t.total_cost_usd,timestamp:t.timestamp||new Date().toISOString()})}handleError(t){const n=Ga.getState(),a=t.message||"Unknown error";n.setError(a),n.setStreaming(!1);const i=n.getCurrentStreamingMessage();i&&n.appendPart(i.id,{type:"error",code:t.code||"UNKNOWN_ERROR",message:a,timestamp:t.timestamp||new Date().toISOString()})}generateMessageId(){return`msg-${Date.now()}-${Math.random().toString(36).substring(2,11)}`}generateConversationId(){return`conv-${Date.now()}-${Math.random().toString(36).substring(2,11)}`}generateRequestId(){return`req-${Date.now()}-${Math.random().toString(36).substring(2,11)}`}getCurrentConversationId(){return this.currentConversationId}getCurrentRequestId(){return this.currentRequestId}reset(){this.currentConversationId=null,this.currentRequestId=null,Ga.getState().reset()}}const UH=new $H;function FH(e){return e==="user"?"user":"bot"}function PH(e){return e==="user"?"You":"DrBot"}function HH(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function qH(e){switch(e.state){case"executing":return"running";case"completed":return"success";case"failed":return"error";default:return"running"}}function wN(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch(t){return String(e)}}function VH(e){var a;const t=[],n=(a=e.toolInput)!=null?a:{};for(const[i,r]of Object.entries(n))t.push({key:i,value:wN(r)});return e.status.state==="completed"&&e.status.result!==void 0?t.push({key:"result",value:wN(e.status.result)}):e.status.state==="failed"&&t.push({key:"error",value:e.status.error}),t}function YH(e){return{name:e.toolName,status:qH(e.status),output:VH(e)}}function GH(e){const t=typeof e.totalCostUsd=="number"&&e.totalCostUsd>0?` · $${e.totalCostUsd.toFixed(4)}`:"";return`${e.totalTokens} tokens (${e.inputTokens} in / ${e.outputTokens} out)${t}`}function KH(e){var m,p;const t=FH(e.role),n=PH(e.role),a=HH(e.timestamp),i=!!e.isStreaming,r=[];let l=0,c=null;const u=(g={})=>$({id:`${e.id}:${l++}`,role:t,senderName:n,timestamp:a,body:"",bodyKind:"markdown",isStreaming:i},g),h=()=>{c&&(r.push(c),c=null)};for(const g of e.parts)switch(g.type){case"text":{const v=(m=g.content)!=null?m:"";c&&c.bodyKind==="markdown"&&!c.toolBlock&&!c.thinkingBlock?c.body+=v:(h(),c=u({body:v}));break}case"thinking":{const v={content:(p=g.content)!=null?p:""};c&&c.bodyKind==="markdown"&&!c.thinkingBlock&&!c.toolBlock?(c.thinkingBlock=v,h()):(h(),r.push(u({thinkingBlock:v})));break}case"tool_invocation":{const v=YH(g);c&&c.bodyKind==="markdown"&&!c.toolBlock?(c.toolBlock=v,h()):(h(),r.push(u({toolBlock:v})));break}case"error":{h(),r.push(u({body:g.message,bodyKind:"error",isStreaming:!1}));break}case"usage":{h(),r.push(u({body:GH(g),bodyKind:"usage",isStreaming:!1}));break}}return h(),r.length===0&&r.push(u({})),r}function QH(e){const t=[];for(const n of e)t.push(...KH(n));return t}const uv=["What does this element do?","Show cross-layer references","Any unresolved references?","Explain the data-model layer"];function XH({row:e}){return e.bodyKind==="error"?f.jsx("span",{style:{color:"#F43F5E",fontSize:12.5,lineHeight:1.5},"data-testid":"chat-error-line",children:e.body}):e.bodyKind==="usage"?f.jsx("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:10.5,color:"rgb(var(--canvas-fg-3))"},children:e.body}):f.jsx(nM,{content:e.body,isStreaming:e.isStreaming})}function ZH(){const e=qe(E=>E.view),t=qe(E=>E.layerId),n=qe(E=>E.selectedId),a=qe(E=>E.changesetId),i=Ga(E=>E.messages),r=Ga(E=>E.isStreaming),l=Ga(E=>E.error),{derived:c}=fr(),{derived:u}=nh(),h=j.useMemo(()=>Xp(c),[c]),m=e==="model"&&n?h.byUuid.get(n):void 0,p=m==null?void 0:m.name,g=t?Sa(t):"",v=j.useMemo(()=>{if(e==="changesets"){const E=u.list.find(I=>I.id===a);return E?E.name:"changesets"}return p||(g?`${g} layer`:"meta-model")},[e,u.list,a,p,g]),x=j.useMemo(()=>p?[`What does ${p} do?`,"Show cross-layer references","Any unresolved references?",g?`Explain the ${g} layer`:uv[3]]:g?[...uv.slice(0,3),`Explain the ${g} layer`]:uv,[p,g]),b=j.useMemo(()=>QH(i),[i]),[_,S]=j.useState(""),M=()=>{var R;const E=qe.getState(),I=D=>{const O=h.byUuid.get(D);return O?{name:O.name,ref:au(O)}:void 0};let T;if(E.view==="model"&&E.selectedEdgeId){const D=D0(c,E.selectedEdgeId,h,void 0),O=D&&I(D.sourceNode.id),B=D&&I(D.targetNode.id);D&&O&&B&&(T={predicate:D.predicate,source:O,target:B})}const A=E.view==="changesets"?u.list.find(D=>D.id===E.changesetId):void 0;return OH({view:E.view,mode:E.mode,layerId:E.layerId,layerLabel:E.layerId?Sa(E.layerId):void 0,selectedNode:E.view==="model"&&E.selectedId?h.byUuid.get(E.selectedId):void 0,selectedSpecNodeId:E.view==="spec"&&(R=E.selectedId)!=null?R:void 0,selectedEdge:T,changeset:A?{id:A.id,name:A.name}:void 0})},C=E=>{const I=E.trim();!I||r||(S(""),UH.sendMessage(I,M()).catch(()=>{}))},k=i.length<=1,L=f.jsxs(f.Fragment,{children:[l&&f.jsx("div",{role:"alert","data-testid":"chat-store-error",style:{flex:"none",margin:"6px 12px 0 12px",padding:"8px 10px",borderRadius:8,fontSize:12,lineHeight:1.45,color:"#F43F5E",background:"rgba(244,63,94,0.08)",border:"1px solid rgba(244,63,94,0.25)"},children:/-32001|sdk|not (?:installed|available)/i.test(l)?"No chat client is available on the server (the Claude SDK is not installed). The drawer is read-only until it is enabled.":l}),k&&f.jsx("div",{style:{flex:"none",padding:"10px 12px 6px 12px",borderTop:"1px solid rgb(var(--canvas-border))"},children:f.jsx(Gk,{suggestions:x,onSelect:E=>C(E)})}),f.jsx("div",{style:{flex:"none",padding:"0 8px 10px 8px"},children:f.jsx(Kk,{value:_,onChange:S,onSubmit:E=>C(E),scopeLabel:v,placeholder:"Ask about the model…",loading:r})})]});return f.jsx(Qk,{composer:L,children:b.map(E=>f.jsx(qk,{role:E.role,senderName:E.senderName,timestamp:E.timestamp,body:f.jsx(XH,{row:E}),toolBlock:E.toolBlock,thinkingBlock:E.thinkingBlock},E.id))})}const SN={width:372,flex:"none",background:"rgb(var(--canvas-bg))",display:"flex",flexDirection:"column",minHeight:0,borderLeft:"1px solid rgb(var(--canvas-border))"},JH={position:"absolute",right:0,top:0,bottom:0,zIndex:30,boxShadow:"-16px 0 44px -22px rgba(0,0,0,0.5)"};function WH(){const e=qe(a=>a.chatOpen),t=qe(a=>a.wide);if(!e)return null;const n=t?SN:$($({},SN),JH);return f.jsxs("div",{style:n,"data-testid":"chat-drawer","data-mode":t?"pane":"overlay",children:[f.jsxs("div",{style:{height:40,flex:"none",display:"flex",alignItems:"center",gap:8,padding:"0 16px",borderBottom:"1px solid rgb(var(--canvas-border))"},children:[f.jsx("span",{className:"drv-chat-pulse",style:{width:6,height:6,borderRadius:"50%",background:"#FBBF24",display:"inline-block"}}),f.jsx("span",{style:{fontSize:13,fontWeight:600,color:"rgb(var(--canvas-fg-1))"},children:"DrBot"}),f.jsx("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:10,letterSpacing:"0.06em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))"},children:"model assistant"})]}),f.jsx("div",{style:{flex:1,minHeight:0,position:"relative"},children:f.jsx("div",{style:{position:"absolute",inset:0},children:f.jsx(ZH,{})})})]})}const qf="data-model",eq="I'm **DrBot**, scoped to the loaded architecture model. Select any element to inspect it, then ask me to explain it, trace its cross-layer references, or validate reference integrity.";function tq(){j.useEffect(()=>{var a;const e=Ga.getState();if(e.messages.length>0)return;const t=new Date().toISOString(),n={id:`msg-greeting-${Date.now()}`,role:"assistant",conversationId:(a=e.activeConversationId)!=null?a:"greeting",timestamp:t,parts:[{type:"text",content:eq,timestamp:t}]};e.addMessage(n)},[])}function nq(){const e=qe(m=>m.view),t=qe(m=>m.layerId),n=qe(m=>m.changesetId),a=qe(m=>m.navigateToElement),i=qe(m=>m.navigateToSpecNode),r=qe(m=>m.selectChangeset),{derived:l}=fr(),{derived:c,raw:u}=pr(),{derived:h}=nh();j.useEffect(()=>{var m,p,g;if(e==="changesets"){if(n)return;const v=h.list[0];v&&r(v.id);return}if(!t){if(e==="model"){if(l.nodes.length===0)return;const v=(m=l.nodesByLayer[qf])!=null&&m.length?qf:Object.keys(l.nodesByLayer)[0];if(!v)return;const x=(p=l.nodesByLayer[v])==null?void 0:p[0];x&&a(x.id,v);return}if(e==="spec"){if(Object.keys(c.byLayer).length===0)return;const v=(g=c.byLayer[qf])!=null&&g.typeCount?qf:A0.find(b=>{var _;return(_=c.byLayer[b])==null?void 0:_.typeCount});if(!v)return;const x=IP(u,v);x&&i(x,v)}}},[e,t,n,l,c,u,h,a,i,r])}function aq(){const t=qe(n=>n.view)==="changesets";return nq(),tq(),xP(),oP(),z7(),f.jsxs("div",{style:{height:"100vh",minWidth:880,display:"flex",flexDirection:"column",background:"rgb(var(--shell-bg))",color:"rgb(var(--shell-fg-1))",fontFamily:"Inter, system-ui, sans-serif",overflow:"hidden"},"data-testid":"app-shell",children:[f.jsx(UF,{}),f.jsxs("div",{style:{flex:1,display:"flex",minHeight:0,position:"relative"},children:[f.jsx(kP,{}),t?f.jsx(SH,{}):f.jsx(bH,{}),t&&f.jsx(kH,{}),f.jsx(WH,{})]}),f.jsx(CP,{})]})}function sq(){const e=$x(m=>m.token),t=vd(m=>m.setConnected),n=vd(m=>m.setDisconnected),a=vd(m=>m.setReconnecting),i=vd(m=>m.setError),r=j.useCallback(()=>{console.log("[RootShell] WebSocket connected"),t(),an.transportMode==="websocket"&&an.subscribe(["model","changesets","annotations"])},[t]),l=j.useCallback(()=>{console.log("[RootShell] Using REST mode"),t()},[t]),c=j.useCallback(()=>{console.log("[RootShell] WebSocket disconnected"),n()},[n]),u=j.useCallback(m=>{a(m.attempt,m.delay)},[a]),h=j.useCallback(m=>{const p=m.kind==="event"?m.error:`${m.code}: ${m.message}`;console.error("[RootShell] WebSocket error:",p),i("Connection error")},[i]);return j.useEffect(()=>(console.log("[RootShell] Initializing WebSocket connection"),e&&(console.log("[RootShell] Setting authentication token for WebSocket"),an.setToken(e)),an.on("connect",r),an.on("disconnect",c),an.on("reconnecting",u),an.on("error",h),an.on("rest-mode",l),an.connect(),()=>{an.off("connect",r),an.off("disconnect",c),an.off("reconnecting",u),an.off("error",h),an.off("rest-mode",l),an.disconnect()}),[e,r,c,u,h,l]),f.jsx(rk,{})}const iq={model:"model",spec:"spec",changesets:"changesets"},rq={model:"model",spec:"spec",changesets:"changesets"},oq={model:"graph",spec:"graph",changesets:"list"};function NN(e,t,n,a){return`${e!=null?e:""}|${t!=null?t:""}|${n!=null?n:""}|${a!=null?a:""}`}function lq(){const{section:e,view:t}=Tp({strict:!1}),n=Kd({strict:!1}),a=qe(O=>O.view),i=qe(O=>O.setView),r=qe(O=>O.layerId),l=qe(O=>O.selectedId),c=qe(O=>O.selectedEdgeId),u=qe(O=>O.changesetId),h=qe(O=>O.mode),m=qe(O=>O.setMode),p=qe(O=>O.navSeq),g=qe(O=>O.graphViewport),v=qe(Wf),x=qe(O=>O.setGraphViewport),b=qe(O=>O.selectLayer),_=qe(O=>O.selectNode),S=qe(O=>O.selectEdge),M=qe(O=>O.selectChangeset),{derived:C,isSuccess:k}=fr(),L=j.useRef(!1),E=j.useRef(a),I=j.useRef(NN(r,l,c,u)),T=j.useRef(h),A=j.useRef(r),R=j.useRef(p),D=j.useRef(void 0);return j.useEffect(()=>{const O=e?iq[e]:void 0;O&&i(O)},[e,i]),j.useEffect(()=>{(t==="graph"||t==="page")&&m(t)},[t,m]),j.useEffect(()=>{if(n.changeset&&n.changeset!==u){M(n.changeset);return}const O=!!n.layer&&n.layer!==r;if(O&&b(n.layer),n.layer&&!n.node&&!n.edge&&!O&&(l||c)&&b(n.layer),n.edge&&n.edge!==c){if(!k)return;C.links.some(B=>B.id===n.edge)?S(n.edge):_x.navigate({to:".",search:B=>ee($({},B),{edge:void 0}),replace:!0})}else n.node&&n.node!==l&&_(n.node)},[n.layer,n.node,n.edge,n.changeset,k,C.links]),j.useEffect(()=>{const O=qe.getState(),B=Wf(O),z=rH(n.vp),U=z&&oH(z,B)?z:null,F=O.graphViewport;if(!U){F&&x(null);return}F&&F.scope===B&&zj(F,U)||x({scope:B,center:U.center,zoom:U.zoom})},[e,n.layer,n.vp,x]),j.useEffect(()=>{var W,ge,we,je,De,re;const O=NN(r,l,c,u);if(!L.current){L.current=!0,E.current=a,I.current=O,T.current=h,A.current=r,R.current=p,D.current=n.vp;return}const B=E.current!==a,z=I.current!==O,U=T.current!==h,F=A.current!==null&&A.current!==r,Y=R.current!==p,X=qe.getState(),ne=a!=="changesets"&&((W=X.graphViewport)==null?void 0:W.scope)===Wf(X)?iH(X.graphViewport):void 0,q=D.current!==ne;if(!B&&!z&&!U&&!Y&&!q)return;E.current=a,I.current=O,T.current=h,A.current=r,R.current=p,D.current=ne;const he=rq[a],pe=a==="changesets"?oq[he]:h,H=a==="changesets"?{changeset:u!=null?u:void 0}:{layer:r!=null?r:void 0,node:l!=null?l:void 0,edge:c!=null?c:void 0,vp:ne},te=e===he&&t===pe&&((ge=n.layer)!=null?ge:void 0)===H.layer&&((we=n.node)!=null?we:void 0)===H.node&&((je=n.edge)!=null?je:void 0)===H.edge&&((De=n.changeset)!=null?De:void 0)===H.changeset;if(te&&((re=n.vp)!=null?re:void 0)===H.vp)return;const ie=!te&&(B||U||F||Y||h==="page"&&z);_x.navigate({to:"/$section/$view",params:{section:he,view:pe},search:H,replace:!ie})},[a,h,r,l,c,u,p,g,v]),f.jsx(aq,{})}const P0=VL({component:sq}),cq=Ax({getParentRoute:()=>P0,path:"/",validateSearch:e=>({token:typeof e.token=="string"?e.token:void 0}),component:ZT}),uq=Ax({getParentRoute:()=>P0,path:"/$section/$view",validateSearch:e=>({layer:typeof e.layer=="string"?e.layer:void 0,node:typeof e.node=="string"?e.node:void 0,edge:typeof e.edge=="string"?e.edge:void 0,changeset:typeof e.changeset=="string"?e.changeset:void 0,vp:typeof e.vp=="string"?e.vp:void 0}),component:lq}),dq=P0.addChildren([cq,uq]),_x=WL({routeTree:dq,history:NR()}),hq=new URLSearchParams(window.location.search),dv=hq.get("token");if(dv){console.log("[main] Found token in URL query string, storing to localStorage"),localStorage.setItem("dr_auth_token",dv),$x.getState().setToken(dv),console.log("[main] Updated authStore with new token");const e=window.location.pathname+window.location.hash;window.history.replaceState(null,"",e),console.log("[main] URL cleaned, removed token from query string")}UT();const Uj=document.getElementById("root");if(!Uj)throw new Error("Root element not found");const fq=QT();gR.createRoot(Uj).render(f.jsx(Se.StrictMode,{children:f.jsx(MT,{client:fq,children:f.jsx(nT,{router:_x})})}))});export default pq();
|