From 334e3eedde26d876eaa4287a34c9e4a4fa284f32 Mon Sep 17 00:00:00 2001 From: evanlowe <62918515+evanlowe@users.noreply.github.com> Date: Mon, 17 Aug 2026 22:19:42 +0800 Subject: [PATCH] fix(studio): avoid IAM policy writes during self-update --- frontend/README.md | 3 + frontend/server/studio_update_resources.py | 15 +- frontend/src/adk/client.ts | 1 + frontend/src/ui/StudioUpdateControl.css | 51 +++ frontend/src/ui/StudioUpdateControl.tsx | 38 +- frontend/tests/studioUpdate.test.mjs | 14 +- tests/cli/test_frontend_deploy_iam.py | 4 +- tests/cli/test_studio_self_update.py | 15 +- .../server/test_studio_update_resources.py | 16 +- veadk/cli/frontend_deploy_policy.py | 2 - veadk/cli/studio_self_update.py | 10 + ...Vq.js => MarkdownPromptEditor-BSNJPaIE.js} | 2 +- .../{index--GcKORDa.js => index-D7Wn8co6.js} | 380 +++++++++--------- ...{index-CcP3MwSb.css => index-Dx1UouVk.css} | 2 +- veadk/webui/index.html | 4 +- 15 files changed, 331 insertions(+), 226 deletions(-) rename veadk/webui/assets/{MarkdownPromptEditor-DuIGBjVq.js => MarkdownPromptEditor-BSNJPaIE.js} (99%) rename veadk/webui/assets/{index--GcKORDa.js => index-D7Wn8co6.js} (80%) rename veadk/webui/assets/{index-CcP3MwSb.css => index-Dx1UouVk.css} (88%) diff --git a/frontend/README.md b/frontend/README.md index 2aa2d0667..08f78f381 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -320,6 +320,9 @@ When an update fails, the administrator dialog shows the failed stage, a searchable error ID, the complete diagnostic timeline and exception chain, and a direct link to the deployed Function in the VeFaaS console. The log can be copied in full for support, and retrying starts a fresh diagnostic record. +Reading the VeFaaS release log is optional: when the Function role lacks +`vefaas:GetApplicationRevisionLog`, the update continues and the dialog links +to the matching provider IAM console so an administrator can grant access. `.github/workflows/publish-studio-release.yaml` runs only when it is manually dispatched on `main`. Enter the user-facing changelog when starting the diff --git a/frontend/server/studio_update_resources.py b/frontend/server/studio_update_resources.py index 4532cbd3f..2b3efc58e 100644 --- a/frontend/server/studio_update_resources.py +++ b/frontend/server/studio_update_resources.py @@ -20,7 +20,6 @@ from typing import Any, Literal from frontend.server.storage.provisioning import resolve_studio_storage_for_deploy -from veadk.cli.frontend_deploy_iam import ensure_default_frontend_role_policy from veadk.utils.cloud_provider import CloudProvider SnapshotKind = Literal["codex", "openclaw", "hermes"] @@ -35,7 +34,7 @@ def _function_config( function_client: Any, function_id: str, -) -> tuple[dict[str, str], str]: +) -> dict[str, str]: import volcenginesdkvefaas function = function_client.get_function( @@ -46,7 +45,7 @@ def _function_config( for item in (getattr(function, "envs", None) or []) if getattr(item, "key", None) } - return environment, str(getattr(function, "role", "") or "").strip() + return environment def _provision_snapshot_tool( @@ -136,7 +135,7 @@ def reconcile_studio_update_resources( session_token: str, ) -> dict[str, str]: """Return environment overrides for resources missing from an older Studio.""" - environment, function_role = _function_config(function_client, function_id) + environment = _function_config(function_client, function_id) overrides: dict[str, str] = {} from veadk.cli.studio_knowledge_signing import ( @@ -149,14 +148,6 @@ def reconcile_studio_update_resources( resolve_studio_knowledge_signing_key(environment) ) - ensure_default_frontend_role_policy( - function_role, - access_key=access_key, - secret_key=secret_key, - session_token=session_token, - provider=provider, - ) - if not ( environment.get("VEADK_STUDIO_TOS_BUCKET") and environment.get("VEADK_STUDIO_TOS_REGION") diff --git a/frontend/src/adk/client.ts b/frontend/src/adk/client.ts index 119c9ab0a..704db73c5 100644 --- a/frontend/src/adk/client.ts +++ b/frontend/src/adk/client.ts @@ -2615,6 +2615,7 @@ export interface StudioUpdateStatus { updateLogs: string[]; updateLogsVisible: boolean; consoleUrl: string; + permissionConsoleUrl: string; } /** Check the configured immutable Studio main release channel. */ diff --git a/frontend/src/ui/StudioUpdateControl.css b/frontend/src/ui/StudioUpdateControl.css index fd10d4ce5..63880ccce 100644 --- a/frontend/src/ui/StudioUpdateControl.css +++ b/frontend/src/ui/StudioUpdateControl.css @@ -559,6 +559,57 @@ text-underline-offset: 2px; } +.studio-update-console-link svg, +.studio-update-permission-notice svg { + width: 14px; + height: 14px; + flex: 0 0 14px; + stroke: currentColor; + stroke-width: 1.5; + stroke-linecap: round; + stroke-linejoin: round; +} + +.studio-update-permission-notice { + display: grid; + align-content: center; + gap: 8px; + min-height: 92px; + padding: 12px; + border: 1px solid hsl(var(--border)); + border-radius: 8px; + background: hsl(var(--muted) / 0.22); + color: hsl(var(--muted-foreground)); + font-size: 11px; + line-height: 1.55; +} + +.studio-update-permission-notice p { + margin: 0; +} + +.studio-update-permission-notice code { + margin: 0 3px; + color: hsl(var(--foreground)); + font-family: inherit; + font-weight: 500; +} + +.studio-update-permission-notice a { + display: inline-flex; + align-items: center; + gap: 5px; + width: fit-content; + color: hsl(var(--primary)); + font-weight: 500; + text-decoration: none; +} + +.studio-update-permission-notice a:hover { + text-decoration: underline; + text-underline-offset: 2px; +} + .studio-update-progress-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); diff --git a/frontend/src/ui/StudioUpdateControl.tsx b/frontend/src/ui/StudioUpdateControl.tsx index b6eeed471..9ec6c83bd 100644 --- a/frontend/src/ui/StudioUpdateControl.tsx +++ b/frontend/src/ui/StudioUpdateControl.tsx @@ -136,6 +136,31 @@ function VersionCheckIcon() { ); } +function ExternalLinkIcon() { + return ( + + ); +} + +function StudioUpdateLogPermissionNotice({ href }: { href: string }) { + return ( +
+ 无法读取 VeFaaS 发布日志。Function 角色缺少
+ vefaas:GetApplicationRevisionLog 权限,更新会继续。
+
发布阶段会短暂中断连接;关闭此窗口不会停止更新,可随时点击右上角按钮重新查看。
diff --git a/frontend/tests/studioUpdate.test.mjs b/frontend/tests/studioUpdate.test.mjs index 2c3c64938..ca6b7c3ea 100644 --- a/frontend/tests/studioUpdate.test.mjs +++ b/frontend/tests/studioUpdate.test.mjs @@ -91,6 +91,10 @@ test("update submission is explicit and survives a revision switch", () => { assert.match(controlSource, /setDialogOpen\(true\)/); assert.match(controlSource, /COMPLETION_LOG_SETTLE_TIMEOUT_MS = 45_000/); assert.match(controlSource, /deploymentLogComplete\(next\.updateLogs\)/); + assert.match( + controlSource, + /next\.updateLogsVisible !== false &&[\s\S]*?!deploymentLogComplete\(next\.updateLogs\)/, + ); assert.match(controlSource, /line\.includes\("部署应用成功"\)/); }); @@ -185,10 +189,18 @@ test("Studio renders bounded VeFaaS logs without stealing manual scroll", () => ); }); -test("Studio hides only the log region when VeFaaS log permission is missing", () => { +test("Studio explains how to grant optional VeFaaS log permission", () => { assert.match( controlSource, /\{status\.updateLogsVisible !== false && \([\s\S]*?r($,U))Vr(te,$)?(C[B]=te,C[V]=U,B=V):(C[B]=$,C[G]=U,B=G);else if(V
r(te,U))C[B]=te,C[V]=U,B=V;else break e}}return I}function r(C,I){var U=C.sortIndex-I.sortIndex;return U!==0?U:C.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var c=[],u=[],d=1,f=null,h=3,p=!1,g=!1,b=!1,y=!1,O=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function w(C){for(var I=n(u);I!==null;){if(I.callback===null)i(u);else if(I.startTime<=C)i(u),I.sortIndex=I.expirationTime,t(c,I);else break;I=n(u)}}function E(C){if(b=!1,w(C),!g)if(n(c)!==null)g=!0,S||(S=!0,M());else{var I=n(u);I!==null&&Q(E,I.startTime-C)}}var S=!1,k=-1,T=5,A=-1;function N(){return y?!0:!(e.unstable_now()-A
C&&N());){var B=f.callback;if(typeof B=="function"){f.callback=null,h=f.priorityLevel;var P=B(f.expirationTime<=C);if(C=e.unstable_now(),typeof P=="function"){f.callback=P,w(C),I=!0;break t}f===n(c)&&i(c),w(C)}else i(c);f=n(c)}if(f!==null)I=!0;else{var q=n(u);q!==null&&Q(E,q.startTime-C),I=!1}}break e}finally{f=null,h=U,p=!1}I=void 0}}finally{I?M():S=!1}}}var M;if(typeof x=="function")M=function(){x(j)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,L=D.port2;D.port1.onmessage=j,M=function(){L.postMessage(null)}}else M=function(){O(j,0)};function Q(C,I){k=O(function(){C(e.unstable_now())},I)}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(C){C.callback=null},e.unstable_forceFrameRate=function(C){0>C||125 B?(C.sortIndex=U,t(u,C),n(c)===null&&C===n(u)&&(b?(v(k),k=-1):b=!0,Q(E,U-B))):(C.sortIndex=P,t(c,C),g||p||(g=!0,S||(S=!0,M()))),C},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(C){var I=h;return function(){var U=h;h=I;try{return C.apply(this,arguments)}finally{h=U}}}})(WY);GY.exports=WY;var I0e=GY.exports,ZY={exports:{}},wa={};/** + */(function(e){function t(C,I){var U=C.length;C.push(I);e:for(;0>>1,P=C[B];if(0 >>1;B r($,U))Vr(te,$)?(C[B]=te,C[V]=U,B=V):(C[B]=$,C[G]=U,B=G);else if(V
r(te,U))C[B]=te,C[V]=U,B=V;else break e}}return I}function r(C,I){var U=C.sortIndex-I.sortIndex;return U!==0?U:C.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var c=[],u=[],d=1,f=null,h=3,p=!1,g=!1,b=!1,y=!1,O=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function w(C){for(var I=n(u);I!==null;){if(I.callback===null)i(u);else if(I.startTime<=C)i(u),I.sortIndex=I.expirationTime,t(c,I);else break;I=n(u)}}function E(C){if(b=!1,w(C),!g)if(n(c)!==null)g=!0,S||(S=!0,M());else{var I=n(u);I!==null&&Q(E,I.startTime-C)}}var S=!1,k=-1,T=5,A=-1;function N(){return y?!0:!(e.unstable_now()-A
C&&N());){var B=f.callback;if(typeof B=="function"){f.callback=null,h=f.priorityLevel;var P=B(f.expirationTime<=C);if(C=e.unstable_now(),typeof P=="function"){f.callback=P,w(C),I=!0;break t}f===n(c)&&i(c),w(C)}else i(c);f=n(c)}if(f!==null)I=!0;else{var q=n(u);q!==null&&Q(E,q.startTime-C),I=!1}}break e}finally{f=null,h=U,p=!1}I=void 0}}finally{I?M():S=!1}}}var M;if(typeof x=="function")M=function(){x(j)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,L=D.port2;D.port1.onmessage=j,M=function(){L.postMessage(null)}}else M=function(){O(j,0)};function Q(C,I){k=O(function(){C(e.unstable_now())},I)}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(C){C.callback=null},e.unstable_forceFrameRate=function(C){0>C||125 B?(C.sortIndex=U,t(u,C),n(c)===null&&C===n(u)&&(b?(v(k),k=-1):b=!0,Q(E,U-B))):(C.sortIndex=P,t(c,C),g||p||(g=!0,S||(S=!0,M()))),C},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(C){var I=h;return function(){var U=h;h=I;try{return C.apply(this,arguments)}finally{h=U}}}})(ZY);WY.exports=ZY;var M0e=WY.exports,KY={exports:{}},wa={};/** * @license React * react-dom.production.js * @@ -31,7 +31,7 @@ var f0e=Object.defineProperty;var p6=e=>{throw TypeError(e)};var h0e=(e,t,n)=>t * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var P0e=m;function KY(e){var t="https://react.dev/errors/"+e;if(1 "u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(JY)}catch(e){console.error(e)}}JY(),ZY.exports=wa;var $i=ZY.exports;/** + */var L0e=m;function JY(e){var t="https://react.dev/errors/"+e;if(1 "u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eG)}catch(e){console.error(e)}}eG(),KY.exports=wa;var $i=KY.exports;/** * @license React * react-dom-client.production.js * @@ -39,15 +39,15 @@ var f0e=Object.defineProperty;var p6=e=>{throw TypeError(e)};var h0e=(e,t,n)=>t * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ls=I0e,eG=m,D0e=$i;function ze(e){var t="https://react.dev/errors/"+e;if(1 qm||(e.current=WR[qm],WR[qm]=null,qm--)}function qi(e,t){qm++,WR[qm]=e.current,e.current=t}var Pc=Xc(null),Vy=Xc(null),pf=Xc(null),RE=Xc(null);function IE(e,t){switch(qi(pf,t),qi(Vy,e),qi(Pc,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?AB(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=AB(t),e=TZ(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ss(Pc),qi(Pc,e)}function Gg(){Ss(Pc),Ss(Vy),Ss(pf)}function ZR(e){e.memoizedState!==null&&qi(RE,e);var t=Pc.current,n=TZ(t,e.type);t!==n&&(qi(Vy,e),qi(Pc,n))}function PE(e){Vy.current===e&&(Ss(Pc),Ss(Vy)),RE.current===e&&(Ss(RE),tx._currentValue=Kh)}var HA,S6;function Eh(e){if(HA===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);HA=t&&t[1]||"",S6=-1 qm||(e.current=WR[qm],WR[qm]=null,qm--)}function qi(e,t){qm++,WR[qm]=e.current,e.current=t}var Pc=Xc(null),Vy=Xc(null),pf=Xc(null),RE=Xc(null);function IE(e,t){switch(qi(pf,t),qi(Vy,e),qi(Pc,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?AB(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=AB(t),e=_Z(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ss(Pc),qi(Pc,e)}function Gg(){Ss(Pc),Ss(Vy),Ss(pf)}function ZR(e){e.memoizedState!==null&&qi(RE,e);var t=Pc.current,n=_Z(t,e.type);t!==n&&(qi(Vy,e),qi(Pc,n))}function PE(e){Vy.current===e&&(Ss(Pc),Ss(Vy)),RE.current===e&&(Ss(RE),tx._currentValue=Kh)}var HA,S6;function Eh(e){if(HA===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);HA=t&&t[1]||"",S6=-1 )":-1 r||c[i]!==u[r]){var d=` -`+c[i].replace(" at new "," at ");return e.displayName&&d.includes(" ")&&(d=d.replace(" ",e.displayName)),d}while(1<=i&&0<=r);break}}}finally{YA=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Eh(n):""}function z0e(e,t){switch(e.tag){case 26:case 27:case 5:return Eh(e.type);case 16:return Eh("Lazy");case 13:return e.child!==t&&t!==null?Eh("Suspense Fallback"):Eh("Suspense");case 19:return Eh("SuspenseList");case 0:case 15:return GA(e.type,!1);case 11:return GA(e.type.render,!1);case 1:return GA(e.type,!0);case 31:return Eh("Activity");default:return""}}function E6(e){try{var t="",n=null;do t+=z0e(e,n),n=e,e=e.return;while(e);return t}catch(i){return` +`+c[i].replace(" at new "," at ");return e.displayName&&d.includes(" ")&&(d=d.replace(" ",e.displayName)),d}while(1<=i&&0<=r);break}}}finally{YA=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Eh(n):""}function V0e(e,t){switch(e.tag){case 26:case 27:case 5:return Eh(e.type);case 16:return Eh("Lazy");case 13:return e.child!==t&&t!==null?Eh("Suspense Fallback"):Eh("Suspense");case 19:return Eh("SuspenseList");case 0:case 15:return GA(e.type,!1);case 11:return GA(e.type.render,!1);case 1:return GA(e.type,!0);case 31:return Eh("Activity");default:return""}}function E6(e){try{var t="",n=null;do t+=V0e(e,n),n=e,e=e.return;while(e);return t}catch(i){return` Error generating stack: `+i.message+` -`+i.stack}}var KR=Object.prototype.hasOwnProperty,f5=ls.unstable_scheduleCallback,WA=ls.unstable_cancelCallback,F0e=ls.unstable_shouldYield,V0e=ls.unstable_requestPaint,vo=ls.unstable_now,X0e=ls.unstable_getCurrentPriorityLevel,oG=ls.unstable_ImmediatePriority,lG=ls.unstable_UserBlockingPriority,ME=ls.unstable_NormalPriority,q0e=ls.unstable_LowPriority,cG=ls.unstable_IdlePriority,H0e=ls.log,Y0e=ls.unstable_setDisableYieldValue,g1=null,wo=null;function sf(e){if(typeof H0e=="function"&&Y0e(e),wo&&typeof wo.setStrictMode=="function")try{wo.setStrictMode(g1,e)}catch{}}var So=Math.clz32?Math.clz32:Z0e,G0e=Math.log,W0e=Math.LN2;function Z0e(e){return e>>>=0,e===0?32:31-(G0e(e)/W0e|0)|0}var Bv=256,Uv=262144,zv=4194304;function kh(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function YT(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var r=0,s=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var o=i&134217727;return o!==0?(i=o&~s,i!==0?r=kh(i):(a&=o,a!==0?r=kh(a):n||(n=o&~e,n!==0&&(r=kh(n))))):(o=i&~s,o!==0?r=kh(o):a!==0?r=kh(a):n||(n=i&~e,n!==0&&(r=kh(n)))),r===0?0:t!==0&&t!==r&&!(t&s)&&(s=r&-r,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:r}function b1(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function K0e(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 uG(){var e=zv;return zv<<=1,!(zv&62914560)&&(zv=4194304),e}function ZA(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function O1(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function J0e(e,t,n,i,r,s){var a=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=a&~n;0 "u")return null;try{return e.activeElement||e.body}catch{return e.body}}var sbe=/[\n"\\]/g;function qo(e){return e.replace(sbe,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function tI(e,t,n,i,r,s,a,o){e.name="",a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.type=a:e.removeAttribute("type"),t!=null?a==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Uo(t)):e.value!==""+Uo(t)&&(e.value=""+Uo(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?nI(e,a,Uo(t)):n!=null?nI(e,a,Uo(n)):i!=null&&e.removeAttribute("value"),r==null&&s!=null&&(e.defaultChecked=!!s),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+Uo(o):e.removeAttribute("name")}function yG(e,t,n,i,r,s,a,o){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){eI(e);return}n=n!=null?""+Uo(n):"",t=t!=null?""+Uo(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}i=i??r,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=o?e.checked:!!i,e.defaultChecked=!!i,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),eI(e)}function nI(e,t,n){t==="number"&&LE(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function wg(e,t,n,i){if(e=e.options,t){t={};for(var r=0;r "u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rI=!1;if(qu)try{var Hb={};Object.defineProperty(Hb,"passive",{get:function(){rI=!0}}),window.addEventListener("test",Hb,Hb),window.removeEventListener("test",Hb,Hb)}catch{rI=!1}var af=null,O5=null,kS=null;function EG(){if(kS)return kS;var e,t=O5,n=t.length,i,r="value"in af?af.value:af.textContent,s=r.length;for(e=0;e =JO),M6=" ",L6=!1;function TG(e,t){switch(e){case"keyup":return Ibe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _G(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gm=!1;function Mbe(e,t){switch(e){case"compositionend":return _G(t);case"keypress":return t.which!==32?null:(L6=!0,M6);case"textInput":return e=t.data,e===M6&&L6?null:e;default:return null}}function Lbe(e,t){if(Gm)return e==="compositionend"||!x5&&TG(e,t)?(e=EG(),kS=O5=af=null,Gm=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1 =t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=U6(n)}}function jG(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?jG(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function RG(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=LE(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=LE(e.document)}return t}function v5(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Vbe=qu&&"documentMode"in document&&11>=document.documentMode,Wm=null,sI=null,ty=null,aI=!1;function F6(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;aI||Wm==null||Wm!==LE(i)||(i=Wm,"selectionStart"in i&&v5(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),ty&&Hy(ty,i)||(ty=i,i=ek(sI,"onSelect"),0 >=a,r-=a,Ec=1<<32-So(t)+r|n< T?(A=k,k=null):A=k.sibling;var N=h(O,k,x[T],w);if(N===null){k===null&&(k=A);break}e&&k&&N.alternate===null&&t(O,k),v=s(N,v,T),S===null?E=N:S.sibling=N,S=N,k=A}if(T===x.length)return n(O,k),Hn&&Eu(O,T),E;if(k===null){for(;T T?(A=k,k=null):A=k.sibling;var j=h(O,k,N.value,w);if(j===null){k===null&&(k=A);break}e&&k&&j.alternate===null&&t(O,k),v=s(j,v,T),S===null?E=j:S.sibling=j,S=j,k=A}if(N.done)return n(O,k),Hn&&Eu(O,T),E;if(k===null){for(;!N.done;T++,N=x.next())N=f(O,N.value,w),N!==null&&(v=s(N,v,T),S===null?E=N:S.sibling=N,S=N);return Hn&&Eu(O,T),E}for(k=i(k);!N.done;T++,N=x.next())N=p(k,O,T,N.value,w),N!==null&&(e&&N.alternate!==null&&k.delete(N.key===null?T:N.key),v=s(N,v,T),S===null?E=N:S.sibling=N,S=N);return e&&k.forEach(function(M){return t(O,M)}),Hn&&Eu(O,T),E}function y(O,v,x,w){if(typeof x=="object"&&x!==null&&x.type===Xm&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Qv:e:{for(var E=x.key;v!==null;){if(v.key===E){if(E=x.type,E===Xm){if(v.tag===7){n(O,v.sibling),w=r(v,x.props.children),w.return=O,O=w;break e}}else if(v.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Vd&&Th(E)===v.type){n(O,v.sibling),w=r(v,x.props),Gb(w,x),w.return=O,O=w;break e}n(O,v);break}else t(O,v);v=v.sibling}x.type===Xm?(w=Jh(x.props.children,O.mode,w,x.key),w.return=O,O=w):(w=_S(x.type,x.key,x.props,null,O.mode,w),Gb(w,x),w.return=O,O=w)}return a(O);case AO:e:{for(E=x.key;v!==null;){if(v.key===E)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(O,v.sibling),w=r(v,x.children||[]),w.return=O,O=w;break e}else{n(O,v);break}else t(O,v);v=v.sibling}w=aN(x,O.mode,w),w.return=O,O=w}return a(O);case Vd:return x=Th(x),y(O,v,x,w)}if(NO(x))return g(O,v,x,w);if(qb(x)){if(E=qb(x),typeof E!="function")throw Error(ze(150));return x=E.call(x),b(O,v,x,w)}if(typeof x.then=="function")return y(O,v,qv(x),w);if(x.$$typeof===Nu)return y(O,v,Xv(O,x),w);Hv(O,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,v!==null&&v.tag===6?(n(O,v.sibling),w=r(v,x),w.return=O,O=w):(n(O,v),w=sN(x,O.mode,w),w.return=O,O=w),a(O)):n(O,v)}return function(O,v,x,w){try{Wy=0;var E=y(O,v,x,w);return kg=null,E}catch(k){if(k===V0||k===e_)throw k;var S=mo(29,k,null,O.mode);return S.lanes=w,S.return=O,S}finally{}}}var bp=HG(!0),YG=HG(!1),Xd=!1;function C5(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hI(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function gf(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function bf(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,di&2){var r=i.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),i.pending=t,t=$E(e),QG(e,null,n),t}return JT(e,i,t,n),$E(e)}function iy(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,fG(e,n)}}function lN(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var r=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?r=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?r=s=t:s=s.next=t}else r=s=t;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var pI=!1;function ry(){if(pI){var e=Eg;if(e!==null)throw e}}function sy(e,t,n,i){pI=!1;var r=e.updateQueue;Xd=!1;var s=r.firstBaseUpdate,a=r.lastBaseUpdate,o=r.shared.pending;if(o!==null){r.shared.pending=null;var c=o,u=c.next;c.next=null,a===null?s=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=r.baseState;a=0,d=u=c=null,o=s;do{var h=o.lane&-536870913,p=h!==o.lane;if(p?(Un&h)===h:(i&h)===h){h!==0&&h===Kg&&(pI=!0),d!==null&&(d=d.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var g=e,b=o;h=t;var y=n;switch(b.tag){case 1:if(g=b.payload,typeof g=="function"){f=g.call(y,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,h=typeof g=="function"?g.call(y,f,h):g,h==null)break e;f=tr({},f,h);break e;case 2:Xd=!0}}h=o.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=r.callbacks,p===null?r.callbacks=[h]:p.push(h))}else p={lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(o=o.next,o===null){if(o=r.shared.pending,o===null)break;p=o,o=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);d===null&&(c=f),r.baseState=c,r.firstBaseUpdate=u,r.lastBaseUpdate=d,s===null&&(r.shared.lanes=0),If|=a,e.lanes=a,e.memoizedState=f}}function GG(e,t){if(typeof e!="function")throw Error(ze(191,e));e.call(t)}function WG(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e s?s:8;var a=Jt.T,o={};Jt.T=o,F5(e,!1,t,n);try{var c=r(),u=Jt.S;if(u!==null&&u(o,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=Jbe(c,i);ay(e,t,d,Eo(e))}else ay(e,t,i,Eo(e))}catch(f){ay(e,t,{then:function(){},status:"rejected",reason:f},Eo())}finally{fi.p=s,a!==null&&o.types!==null&&(a.types=o.types),Jt.T=a}}function sOe(){}function yI(e,t,n,i){if(e.tag!==5)throw Error(ze(476));var r=vW(e).queue;xW(e,r,t,Kh,n===null?sOe:function(){return wW(e),n(i)})}function vW(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Kh,baseState:Kh,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yu,lastRenderedState:Kh},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yu,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function wW(e){var t=vW(e);t.next===null&&(t=e.alternate.memoizedState),ay(e,t.next.queue,{},Eo())}function z5(){return Ps(tx)}function SW(){return Lr().memoizedState}function EW(){return Lr().memoizedState}function aOe(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Eo();e=gf(n);var i=bf(t,e,n);i!==null&&(Va(i,t,n),iy(i,t,n)),t={cache:_5()},e.payload=t;return}t=t.return}}function oOe(e,t,n){var i=Eo();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},r_(e)?TW(t,n):(n=S5(e,t,n,i),n!==null&&(Va(n,e,i),_W(n,t,i)))}function kW(e,t,n){var i=Eo();ay(e,t,n,i)}function ay(e,t,n,i){var r={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(r_(e))TW(t,r);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,o=s(a,n);if(r.hasEagerState=!0,r.eagerState=o,Ao(o,a))return JT(e,t,r,0),Li===null&&KT(),!1}catch{}finally{}if(n=S5(e,t,r,i),n!==null)return Va(n,e,i),_W(n,t,i),!0}return!1}function F5(e,t,n,i){if(i={lane:2,revertLane:K5(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},r_(e)){if(t)throw Error(ze(479))}else t=S5(e,n,i,2),t!==null&&Va(t,e,2)}function r_(e){var t=e.alternate;return e===gn||t!==null&&t===gn}function TW(e,t){Tg=VE=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _W(e,t,n){if(n&4194048){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,fG(e,n)}}var Ky={readContext:Ps,use:n_,useCallback:vr,useContext:vr,useEffect:vr,useImperativeHandle:vr,useLayoutEffect:vr,useInsertionEffect:vr,useMemo:vr,useReducer:vr,useRef:vr,useState:vr,useDebugValue:vr,useDeferredValue:vr,useTransition:vr,useSyncExternalStore:vr,useId:vr,useHostTransitionStatus:vr,useFormState:vr,useActionState:vr,useOptimistic:vr,useMemoCache:vr,useCacheRefresh:vr};Ky.useEffectEvent=vr;var AW={readContext:Ps,use:n_,useCallback:function(e,t){return ua().memoizedState=[e,t===void 0?null:t],e},useContext:Ps,useEffect:rB,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,CS(4194308,4,mW.bind(null,t,e),n)},useLayoutEffect:function(e,t){return CS(4194308,4,e,t)},useInsertionEffect:function(e,t){CS(4,2,e,t)},useMemo:function(e,t){var n=ua();t=t===void 0?null:t;var i=e();if(Op){sf(!0);try{e()}finally{sf(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=ua();if(n!==void 0){var r=n(t);if(Op){sf(!0);try{n(t)}finally{sf(!1)}}}else r=t;return i.memoizedState=i.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},i.queue=e,e=e.dispatch=oOe.bind(null,gn,e),[i.memoizedState,e]},useRef:function(e){var t=ua();return e={current:e},t.memoizedState=e},useState:function(e){e=bI(e);var t=e.queue,n=kW.bind(null,gn,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:B5,useDeferredValue:function(e,t){var n=ua();return U5(n,e,t)},useTransition:function(){var e=bI(!1);return e=xW.bind(null,gn,e.queue,!0,!1),ua().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=gn,r=ua();if(Hn){if(n===void 0)throw Error(ze(407));n=n()}else{if(n=t(),Li===null)throw Error(ze(349));Un&127||tW(i,t,n)}r.memoizedState=n;var s={value:n,getSnapshot:t};return r.queue=s,rB(iW.bind(null,i,s,e),[e]),i.flags|=2048,e0(9,{destroy:void 0},nW.bind(null,i,s,n,t),null),n},useId:function(){var e=ua(),t=Li.identifierPrefix;if(Hn){var n=kc,i=Ec;n=(i&~(1<<32-So(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=XE++,0 <\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof i.is=="string"?a.createElement("select",{is:i.is}):a.createElement("select"),i.multiple?s.multiple=!0:i.size&&(s.size=i.size);break;default:s=typeof i.is=="string"?a.createElement(r,{is:i.is}):a.createElement(r)}}s[js]=t,s[Ya]=i;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)s.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=s;e:switch(Ms(s,r,i),r){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&cu(t)}}return Zi(t),gN(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&cu(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(ze(166));if(e=pf.current,cm(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,r=Rs,r!==null)switch(r.tag){case 27:case 5:i=r.memoizedProps}e[js]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||kZ(e.nodeValue,n)),e||jf(t,!0)}else e=tk(e).createTextNode(i),e[js]=t,t.stateNode=e}return Zi(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=cm(t),n!==null){if(e===null){if(!i)throw Error(ze(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ze(557));e[js]=t}else mp(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Zi(t),e=!1}else n=oN(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(po(t),t):(po(t),null);if(t.flags&128)throw Error(ze(558))}return Zi(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=cm(t),i!==null&&i.dehydrated!==null){if(e===null){if(!r)throw Error(ze(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(ze(317));r[js]=t}else mp(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Zi(t),r=!1}else r=oN(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(po(t),t):(po(t),null)}return po(t),t.flags&128?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,r=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(r=i.alternate.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==r&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Yv(t,t.updateQueue),Zi(t),null);case 4:return Gg(),e===null&&J5(t.stateNode.containerInfo),Zi(t),null;case 10:return Lu(t.type),Zi(t),null;case 19:if(Ss(Ir),i=t.memoizedState,i===null)return Zi(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Wb(i,!1);else{if(Sr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=FE(e),s!==null){for(t.flags|=128,Wb(i,!1),e=s.updateQueue,t.updateQueue=e,Yv(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)BG(n,e),n=n.sibling;return qi(Ir,Ir.current&1|2),Hn&&Eu(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&vo()>GE&&(t.flags|=128,r=!0,Wb(i,!1),t.lanes=4194304)}else{if(!r)if(e=FE(s),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Yv(t,e),Wb(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Hn)return Zi(t),null}else 2*vo()-i.renderingStartTime>GE&&n!==536870912&&(t.flags|=128,r=!0,Wb(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(e=i.last,e!==null?e.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=vo(),e.sibling=null,n=Ir.current,qi(Ir,r?n&1|2:n&1),Hn&&Eu(t,i.treeForkCount),e):(Zi(t),null);case 22:case 23:return po(t),j5(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?n&536870912&&!(t.flags&128)&&(Zi(t),t.subtreeFlags&6&&(t.flags|=8192)):Zi(t),n=t.updateQueue,n!==null&&Yv(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&Ss(ep),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Lu(qr),Zi(t),null;case 25:return null;case 30:return null}throw Error(ze(156,t.tag))}function fOe(e,t){switch(T5(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Lu(qr),Gg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return PE(t),null;case 31:if(t.memoizedState!==null){if(po(t),t.alternate===null)throw Error(ze(340));mp()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(po(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ze(340));mp()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ss(Ir),null;case 4:return Gg(),null;case 10:return Lu(t.type),null;case 22:case 23:return po(t),j5(),e!==null&&Ss(ep),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Lu(qr),null;case 25:return null;default:return null}}function BW(e,t){switch(T5(t),t.tag){case 3:Lu(qr),Gg();break;case 26:case 27:case 5:PE(t);break;case 4:Gg();break;case 31:t.memoizedState!==null&&po(t);break;case 13:po(t);break;case 19:Ss(Ir);break;case 10:Lu(t.type);break;case 22:case 23:po(t),j5(),e!==null&&Ss(ep);break;case 24:Lu(qr)}}function S1(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var r=i.next;n=r;do{if((n.tag&e)===e){i=void 0;var s=n.create,a=n.inst;i=s(),a.destroy=i}n=n.next}while(n!==r)}}catch(o){wi(t,t.return,o)}}function Rf(e,t,n){try{var i=t.updateQueue,r=i!==null?i.lastEffect:null;if(r!==null){var s=r.next;i=s;do{if((i.tag&e)===e){var a=i.inst,o=a.destroy;if(o!==void 0){a.destroy=void 0,r=t;var c=n,u=o;try{u()}catch(d){wi(r,c,d)}}}i=i.next}while(i!==s)}}catch(d){wi(t,t.return,d)}}function UW(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{WG(t,n)}catch(i){wi(e,e.return,i)}}}function zW(e,t,n){n.props=yp(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){wi(e,t,i)}}function oy(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof n=="function"?e.refCleanup=n(i):n.current=i}}catch(r){wi(e,t,r)}}function Tc(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(r){wi(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){wi(e,t,r)}else n.current=null}function FW(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(r){wi(e,e.return,r)}}function bN(e,t,n){try{var i=e.stateNode;POe(i,e.type,n,t),i[Ya]=t}catch(r){wi(e,e.return,r)}}function VW(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Jf(e.type)||e.tag===4}function ON(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||VW(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Jf(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function EI(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Cu));else if(i!==4&&(i===27&&Jf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(EI(e,t,n),e=e.sibling;e!==null;)EI(e,t,n),e=e.sibling}function YE(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&Jf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(YE(e,t,n),e=e.sibling;e!==null;)YE(e,t,n),e=e.sibling}function XW(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);Ms(t,i,n),t[js]=e,t[Ya]=n}catch(s){wi(e,e.return,s)}}var Tu=!1,Xr=!1,yN=!1,bB=typeof WeakSet=="function"?WeakSet:Set,ps=null;function hOe(e,t){if(e=e.containerInfo,jI=sk,e=RG(e),v5(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,o=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||r!==0&&f.nodeType!==3||(o=a+r),f!==s||i!==0&&f.nodeType!==3||(c=a+i),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===r&&(o=a),h===s&&++d===i&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(RI={focusedElem:e,selectionRange:n},sk=!1,ps=t;ps!==null;)if(t=ps,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ps=e;else for(;ps!==null;){switch(t=ps,s=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),Ms(s,i,n),s[js]=e,bs(s),i=s;break e;case"link":var a=DB("link","href",r).get(i+(n.href||""));if(a){for(var o=0;o y&&(a=y,y=b,b=a);var O=z6(o,b),v=z6(o,y);if(O&&v&&(p.rangeCount!==1||p.anchorNode!==O.node||p.anchorOffset!==O.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var x=f.createRange();x.setStart(O.node,O.offset),p.removeAllRanges(),b>y?(p.addRange(x),p.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),p.addRange(x))}}}}for(f=[],p=o;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o n?32:n,Jt.T=null,n=_I,_I=null;var s=yf,a=Du;if(os=0,n0=yf=null,Du=0,di&6)throw Error(ze(331));var o=di;if(di|=4,nZ(s.current),JW(s,s.current,a,n),di=o,E1(0,!1),wo&&typeof wo.onPostCommitFiberRoot=="function")try{wo.onPostCommitFiberRoot(g1,s)}catch{}return!0}finally{fi.p=r,Jt.T=i,bZ(e,t)}}function vB(e,t,n){t=Ho(n,t),t=vI(e.stateNode,t,2),e=bf(e,t,2),e!==null&&(O1(e,2),qc(e))}function wi(e,t,n){if(e.tag===3)vB(e,e,n);else for(;t!==null;){if(t.tag===3){vB(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Of===null||!Of.has(i))){e=Ho(n,e),n=IW(2),i=bf(t,n,2),i!==null&&(PW(n,i,t,e),O1(i,2),qc(i));break}}t=t.return}}function vN(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new gOe;var r=new Set;i.set(t,r)}else r=i.get(t),r===void 0&&(r=new Set,i.set(t,r));r.has(n)||(G5=!0,r.add(n),e=vOe.bind(null,e,t,n),t.then(e,e))}function vOe(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Li===e&&(Un&n)===n&&(Sr===4||Sr===3&&(Un&62914560)===Un&&300>vo()-s_?!(di&2)&&i0(e,0):W5|=n,t0===Un&&(t0=0)),qc(e)}function yZ(e,t){t===0&&(t=uG()),e=Bp(e,t),e!==null&&(O1(e,t),qc(e))}function wOe(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),yZ(e,n)}function SOe(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(ze(314))}i!==null&&i.delete(t),yZ(e,n)}function EOe(e,t){return f5(e,t)}var KE=null,Im=null,NI=!1,JE=!1,wN=!1,cf=0;function qc(e){e!==Im&&e.next===null&&(Im===null?KE=Im=e:Im=Im.next=e),JE=!0,NI||(NI=!0,TOe())}function E1(e,t){if(!wN&&JE){wN=!0;do for(var n=!1,i=KE;i!==null;){if(e!==0){var r=i.pendingLanes;if(r===0)var s=0;else{var a=i.suspendedLanes,o=i.pingedLanes;s=(1<<31-So(42|e)+1)-1,s&=r&~(a&~o),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,wB(i,s))}else s=Un,s=YT(i,i===Li?s:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(s&3)||b1(i,s)||(n=!0,wB(i,s));i=i.next}while(n);wN=!1}}function kOe(){xZ()}function xZ(){JE=NI=!1;var e=0;cf!==0&&LOe()&&(e=cf);for(var t=vo(),n=null,i=KE;i!==null;){var r=i.next,s=vZ(i,t);s===0?(i.next=null,n===null?KE=r:n.next=r,r===null&&(Im=n)):(n=i,(e!==0||s&3)&&(JE=!0)),i=r}os!==0&&os!==5||E1(e),cf!==0&&(cf=0)}function vZ(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,r=e.expirationTimes,s=e.pendingLanes&-62914561;0 o)break;var d=c.transferSize,f=c.initiatorType;d&&_B(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function CZ(e,t,n){var i=q0;if(i&&typeof t=="string"&&t){var r=qo(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),PB.has(r)||(PB.add(r),e={rel:e,crossOrigin:n,href:t},i.querySelector(r)===null&&(t=i.createElement("link"),Ms(t,"link",e),bs(t),i.head.appendChild(t)))}}function XOe(e){ud.D(e),CZ("dns-prefetch",e,null)}function qOe(e,t){ud.C(e,t),CZ("preconnect",e,t)}function HOe(e,t,n){ud.L(e,t,n);var i=q0;if(i&&e&&t){var r='link[rel="preload"][as="'+qo(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+qo(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+qo(n.imageSizes)+'"]')):r+='[href="'+qo(e)+'"]';var s=r;switch(t){case"style":s=r0(e);break;case"script":s=H0(e)}ll.has(s)||(e=tr({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ll.set(s,e),i.querySelector(r)!==null||t==="style"&&i.querySelector(k1(s))||t==="script"&&i.querySelector(T1(s))||(t=i.createElement("link"),Ms(t,"link",e),bs(t),i.head.appendChild(t)))}}function YOe(e,t){ud.m(e,t);var n=q0;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+qo(i)+'"][href="'+qo(e)+'"]',s=r;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=H0(e)}if(!ll.has(s)&&(e=tr({rel:"modulepreload",href:e},t),ll.set(s,e),n.querySelector(r)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(T1(s)))return}i=n.createElement("link"),Ms(i,"link",e),bs(i),n.head.appendChild(i)}}}function GOe(e,t,n){ud.S(e,t,n);var i=q0;if(i&&e){var r=vg(i).hoistableStyles,s=r0(e);t=t||"default";var a=r.get(s);if(!a){var o={loading:0,preload:null};if(a=i.querySelector(k1(s)))o.loading=5;else{e=tr({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ll.get(s))&&eD(e,n);var c=a=i.createElement("link");bs(c),Ms(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){o.loading|=1}),c.addEventListener("error",function(){o.loading|=2}),o.loading|=4,PS(a,t,i)}a={type:"stylesheet",instance:a,count:1,state:o},r.set(s,a)}}}function WOe(e,t){ud.X(e,t);var n=q0;if(n&&e){var i=vg(n).hoistableScripts,r=H0(e),s=i.get(r);s||(s=n.querySelector(T1(r)),s||(e=tr({src:e,async:!0},t),(t=ll.get(r))&&tD(e,t),s=n.createElement("script"),bs(s),Ms(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(r,s))}}function ZOe(e,t){ud.M(e,t);var n=q0;if(n&&e){var i=vg(n).hoistableScripts,r=H0(e),s=i.get(r);s||(s=n.querySelector(T1(r)),s||(e=tr({src:e,async:!0,type:"module"},t),(t=ll.get(r))&&tD(e,t),s=n.createElement("script"),bs(s),Ms(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(r,s))}}function MB(e,t,n,i){var r=(r=pf.current)?nk(r):null;if(!r)throw Error(ze(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=r0(n.href),n=vg(r).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=r0(n.href);var s=vg(r).hoistableStyles,a=s.get(e);if(a||(r=r.ownerDocument||r,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,a),(s=r.querySelector(k1(e)))&&!s._p&&(a.instance=s,a.state.loading=5),ll.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ll.set(e,n),s||KOe(r,e,n,a.state))),t&&i===null)throw Error(ze(528,""));return a}if(t&&i!==null)throw Error(ze(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=H0(n),n=vg(r).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(ze(444,e))}}function r0(e){return'href="'+qo(e)+'"'}function k1(e){return'link[rel="stylesheet"]['+e+"]"}function jZ(e){return tr({},e,{"data-precedence":e.precedence,precedence:null})}function KOe(e,t,n,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Ms(t,"link",n),bs(t),e.head.appendChild(t))}function H0(e){return'[src="'+qo(e)+'"]'}function T1(e){return"script[async]"+e}function LB(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+qo(n.href)+'"]');if(i)return t.instance=i,bs(i),i;var r=tr({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),bs(i),Ms(i,"style",r),PS(i,n.precedence,e),t.instance=i;case"stylesheet":r=r0(n.href);var s=e.querySelector(k1(r));if(s)return t.state.loading|=4,t.instance=s,bs(s),s;i=jZ(n),(r=ll.get(r))&&eD(i,r),s=(e.ownerDocument||e).createElement("link"),bs(s);var a=s;return a._p=new Promise(function(o,c){a.onload=o,a.onerror=c}),Ms(s,"link",i),t.state.loading|=4,PS(s,n.precedence,e),t.instance=s;case"script":return s=H0(n.src),(r=e.querySelector(T1(s)))?(t.instance=r,bs(r),r):(i=n,(r=ll.get(s))&&(i=tr({},n),tD(i,r)),e=e.ownerDocument||e,r=e.createElement("script"),bs(r),Ms(r,"link",i),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(ze(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(i=t.instance,t.state.loading|=4,PS(i,n.precedence,e));return t.instance}function PS(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=i.length?i[i.length-1]:null,s=r,a=0;a title"):null)}function JOe(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function RZ(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function eye(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var r=r0(i.href),s=t.querySelector(k1(r));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=ik.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,bs(s);return}s=t.ownerDocument||t,i=jZ(i),(r=ll.get(r))&&eD(i,r),s=s.createElement("link"),bs(s);var a=s;a._p=new Promise(function(o,c){a.onload=o,a.onerror=c}),Ms(s,"link",i),n.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ik.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var AN=0;function tye(e,t){return e.stylesheets&&e.count===0&&LS(e,e.stylesheets),0 AN?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(r)}}:null}function ik(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)LS(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var rk=null;function LS(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,rk=new Map,t.forEach(nye,e),rk=null,ik.call(e))}function nye(e,t){if(!(t.state.loading&4)){var n=rk.get(e);if(n)var i=n.get(null);else{n=new Map,rk.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s "u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(BZ)}catch(e){console.error(e)}}BZ(),YY.exports=qT;var uye=YY.exports;const dye=$0(uye),aD=m.createContext({});function u_(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const d_=m.createContext(null),rx=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class fye extends m.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function hye({children:e,isPresent:t}){const n=m.useId(),i=m.useRef(null),r=m.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=m.useContext(rx);return m.useInsertionEffect(()=>{const{width:a,height:o,top:c,left:u}=r.current;if(t||!i.current||!a||!o)return;i.current.dataset.motionPopId=n;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` +`+i.stack}}var KR=Object.prototype.hasOwnProperty,f5=ls.unstable_scheduleCallback,WA=ls.unstable_cancelCallback,X0e=ls.unstable_shouldYield,q0e=ls.unstable_requestPaint,vo=ls.unstable_now,H0e=ls.unstable_getCurrentPriorityLevel,lG=ls.unstable_ImmediatePriority,cG=ls.unstable_UserBlockingPriority,ME=ls.unstable_NormalPriority,Y0e=ls.unstable_LowPriority,uG=ls.unstable_IdlePriority,G0e=ls.log,W0e=ls.unstable_setDisableYieldValue,g1=null,wo=null;function sf(e){if(typeof G0e=="function"&&W0e(e),wo&&typeof wo.setStrictMode=="function")try{wo.setStrictMode(g1,e)}catch{}}var So=Math.clz32?Math.clz32:J0e,Z0e=Math.log,K0e=Math.LN2;function J0e(e){return e>>>=0,e===0?32:31-(Z0e(e)/K0e|0)|0}var Bv=256,Uv=262144,zv=4194304;function kh(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function YT(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var r=0,s=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var o=i&134217727;return o!==0?(i=o&~s,i!==0?r=kh(i):(a&=o,a!==0?r=kh(a):n||(n=o&~e,n!==0&&(r=kh(n))))):(o=i&~s,o!==0?r=kh(o):a!==0?r=kh(a):n||(n=i&~e,n!==0&&(r=kh(n)))),r===0?0:t!==0&&t!==r&&!(t&s)&&(s=r&-r,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:r}function b1(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ebe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 dG(){var e=zv;return zv<<=1,!(zv&62914560)&&(zv=4194304),e}function ZA(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function O1(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tbe(e,t,n,i,r,s){var a=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=a&~n;0 "u")return null;try{return e.activeElement||e.body}catch{return e.body}}var obe=/[\n"\\]/g;function qo(e){return e.replace(obe,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function tI(e,t,n,i,r,s,a,o){e.name="",a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.type=a:e.removeAttribute("type"),t!=null?a==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Uo(t)):e.value!==""+Uo(t)&&(e.value=""+Uo(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?nI(e,a,Uo(t)):n!=null?nI(e,a,Uo(n)):i!=null&&e.removeAttribute("value"),r==null&&s!=null&&(e.defaultChecked=!!s),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+Uo(o):e.removeAttribute("name")}function xG(e,t,n,i,r,s,a,o){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){eI(e);return}n=n!=null?""+Uo(n):"",t=t!=null?""+Uo(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}i=i??r,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=o?e.checked:!!i,e.defaultChecked=!!i,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),eI(e)}function nI(e,t,n){t==="number"&&LE(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function wg(e,t,n,i){if(e=e.options,t){t={};for(var r=0;r "u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rI=!1;if(qu)try{var Hb={};Object.defineProperty(Hb,"passive",{get:function(){rI=!0}}),window.addEventListener("test",Hb,Hb),window.removeEventListener("test",Hb,Hb)}catch{rI=!1}var af=null,O5=null,kS=null;function kG(){if(kS)return kS;var e,t=O5,n=t.length,i,r="value"in af?af.value:af.textContent,s=r.length;for(e=0;e =JO),M6=" ",L6=!1;function _G(e,t){switch(e){case"keyup":return Mbe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function AG(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gm=!1;function Dbe(e,t){switch(e){case"compositionend":return AG(t);case"keypress":return t.which!==32?null:(L6=!0,M6);case"textInput":return e=t.data,e===M6&&L6?null:e;default:return null}}function $be(e,t){if(Gm)return e==="compositionend"||!x5&&_G(e,t)?(e=kG(),kS=O5=af=null,Gm=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1 =t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=U6(n)}}function RG(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?RG(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function IG(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=LE(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=LE(e.document)}return t}function v5(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var qbe=qu&&"documentMode"in document&&11>=document.documentMode,Wm=null,sI=null,ty=null,aI=!1;function F6(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;aI||Wm==null||Wm!==LE(i)||(i=Wm,"selectionStart"in i&&v5(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),ty&&Hy(ty,i)||(ty=i,i=ek(sI,"onSelect"),0 >=a,r-=a,Ec=1<<32-So(t)+r|n< T?(A=k,k=null):A=k.sibling;var N=h(O,k,x[T],w);if(N===null){k===null&&(k=A);break}e&&k&&N.alternate===null&&t(O,k),v=s(N,v,T),S===null?E=N:S.sibling=N,S=N,k=A}if(T===x.length)return n(O,k),Hn&&Eu(O,T),E;if(k===null){for(;T T?(A=k,k=null):A=k.sibling;var j=h(O,k,N.value,w);if(j===null){k===null&&(k=A);break}e&&k&&j.alternate===null&&t(O,k),v=s(j,v,T),S===null?E=j:S.sibling=j,S=j,k=A}if(N.done)return n(O,k),Hn&&Eu(O,T),E;if(k===null){for(;!N.done;T++,N=x.next())N=f(O,N.value,w),N!==null&&(v=s(N,v,T),S===null?E=N:S.sibling=N,S=N);return Hn&&Eu(O,T),E}for(k=i(k);!N.done;T++,N=x.next())N=p(k,O,T,N.value,w),N!==null&&(e&&N.alternate!==null&&k.delete(N.key===null?T:N.key),v=s(N,v,T),S===null?E=N:S.sibling=N,S=N);return e&&k.forEach(function(M){return t(O,M)}),Hn&&Eu(O,T),E}function y(O,v,x,w){if(typeof x=="object"&&x!==null&&x.type===Xm&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Qv:e:{for(var E=x.key;v!==null;){if(v.key===E){if(E=x.type,E===Xm){if(v.tag===7){n(O,v.sibling),w=r(v,x.props.children),w.return=O,O=w;break e}}else if(v.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Vd&&Th(E)===v.type){n(O,v.sibling),w=r(v,x.props),Gb(w,x),w.return=O,O=w;break e}n(O,v);break}else t(O,v);v=v.sibling}x.type===Xm?(w=Jh(x.props.children,O.mode,w,x.key),w.return=O,O=w):(w=_S(x.type,x.key,x.props,null,O.mode,w),Gb(w,x),w.return=O,O=w)}return a(O);case AO:e:{for(E=x.key;v!==null;){if(v.key===E)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(O,v.sibling),w=r(v,x.children||[]),w.return=O,O=w;break e}else{n(O,v);break}else t(O,v);v=v.sibling}w=aN(x,O.mode,w),w.return=O,O=w}return a(O);case Vd:return x=Th(x),y(O,v,x,w)}if(NO(x))return g(O,v,x,w);if(qb(x)){if(E=qb(x),typeof E!="function")throw Error(ze(150));return x=E.call(x),b(O,v,x,w)}if(typeof x.then=="function")return y(O,v,qv(x),w);if(x.$$typeof===Nu)return y(O,v,Xv(O,x),w);Hv(O,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,v!==null&&v.tag===6?(n(O,v.sibling),w=r(v,x),w.return=O,O=w):(n(O,v),w=sN(x,O.mode,w),w.return=O,O=w),a(O)):n(O,v)}return function(O,v,x,w){try{Wy=0;var E=y(O,v,x,w);return kg=null,E}catch(k){if(k===V0||k===e_)throw k;var S=mo(29,k,null,O.mode);return S.lanes=w,S.return=O,S}finally{}}}var bp=YG(!0),GG=YG(!1),Xd=!1;function C5(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hI(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function gf(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function bf(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,di&2){var r=i.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),i.pending=t,t=$E(e),BG(e,null,n),t}return JT(e,i,t,n),$E(e)}function iy(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,hG(e,n)}}function lN(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var r=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?r=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?r=s=t:s=s.next=t}else r=s=t;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var pI=!1;function ry(){if(pI){var e=Eg;if(e!==null)throw e}}function sy(e,t,n,i){pI=!1;var r=e.updateQueue;Xd=!1;var s=r.firstBaseUpdate,a=r.lastBaseUpdate,o=r.shared.pending;if(o!==null){r.shared.pending=null;var c=o,u=c.next;c.next=null,a===null?s=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=r.baseState;a=0,d=u=c=null,o=s;do{var h=o.lane&-536870913,p=h!==o.lane;if(p?(Un&h)===h:(i&h)===h){h!==0&&h===Kg&&(pI=!0),d!==null&&(d=d.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var g=e,b=o;h=t;var y=n;switch(b.tag){case 1:if(g=b.payload,typeof g=="function"){f=g.call(y,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,h=typeof g=="function"?g.call(y,f,h):g,h==null)break e;f=tr({},f,h);break e;case 2:Xd=!0}}h=o.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=r.callbacks,p===null?r.callbacks=[h]:p.push(h))}else p={lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(o=o.next,o===null){if(o=r.shared.pending,o===null)break;p=o,o=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);d===null&&(c=f),r.baseState=c,r.firstBaseUpdate=u,r.lastBaseUpdate=d,s===null&&(r.shared.lanes=0),If|=a,e.lanes=a,e.memoizedState=f}}function WG(e,t){if(typeof e!="function")throw Error(ze(191,e));e.call(t)}function ZG(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e s?s:8;var a=Jt.T,o={};Jt.T=o,F5(e,!1,t,n);try{var c=r(),u=Jt.S;if(u!==null&&u(o,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=tOe(c,i);ay(e,t,d,Eo(e))}else ay(e,t,i,Eo(e))}catch(f){ay(e,t,{then:function(){},status:"rejected",reason:f},Eo())}finally{fi.p=s,a!==null&&o.types!==null&&(a.types=o.types),Jt.T=a}}function oOe(){}function yI(e,t,n,i){if(e.tag!==5)throw Error(ze(476));var r=wW(e).queue;vW(e,r,t,Kh,n===null?oOe:function(){return SW(e),n(i)})}function wW(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Kh,baseState:Kh,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yu,lastRenderedState:Kh},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yu,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function SW(e){var t=wW(e);t.next===null&&(t=e.alternate.memoizedState),ay(e,t.next.queue,{},Eo())}function z5(){return Ps(tx)}function EW(){return Lr().memoizedState}function kW(){return Lr().memoizedState}function lOe(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Eo();e=gf(n);var i=bf(t,e,n);i!==null&&(Va(i,t,n),iy(i,t,n)),t={cache:_5()},e.payload=t;return}t=t.return}}function cOe(e,t,n){var i=Eo();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},r_(e)?_W(t,n):(n=S5(e,t,n,i),n!==null&&(Va(n,e,i),AW(n,t,i)))}function TW(e,t,n){var i=Eo();ay(e,t,n,i)}function ay(e,t,n,i){var r={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(r_(e))_W(t,r);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,o=s(a,n);if(r.hasEagerState=!0,r.eagerState=o,Ao(o,a))return JT(e,t,r,0),Li===null&&KT(),!1}catch{}finally{}if(n=S5(e,t,r,i),n!==null)return Va(n,e,i),AW(n,t,i),!0}return!1}function F5(e,t,n,i){if(i={lane:2,revertLane:K5(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},r_(e)){if(t)throw Error(ze(479))}else t=S5(e,n,i,2),t!==null&&Va(t,e,2)}function r_(e){var t=e.alternate;return e===gn||t!==null&&t===gn}function _W(e,t){Tg=VE=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function AW(e,t,n){if(n&4194048){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,hG(e,n)}}var Ky={readContext:Ps,use:n_,useCallback:vr,useContext:vr,useEffect:vr,useImperativeHandle:vr,useLayoutEffect:vr,useInsertionEffect:vr,useMemo:vr,useReducer:vr,useRef:vr,useState:vr,useDebugValue:vr,useDeferredValue:vr,useTransition:vr,useSyncExternalStore:vr,useId:vr,useHostTransitionStatus:vr,useFormState:vr,useActionState:vr,useOptimistic:vr,useMemoCache:vr,useCacheRefresh:vr};Ky.useEffectEvent=vr;var NW={readContext:Ps,use:n_,useCallback:function(e,t){return ua().memoizedState=[e,t===void 0?null:t],e},useContext:Ps,useEffect:rB,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,CS(4194308,4,gW.bind(null,t,e),n)},useLayoutEffect:function(e,t){return CS(4194308,4,e,t)},useInsertionEffect:function(e,t){CS(4,2,e,t)},useMemo:function(e,t){var n=ua();t=t===void 0?null:t;var i=e();if(Op){sf(!0);try{e()}finally{sf(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=ua();if(n!==void 0){var r=n(t);if(Op){sf(!0);try{n(t)}finally{sf(!1)}}}else r=t;return i.memoizedState=i.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},i.queue=e,e=e.dispatch=cOe.bind(null,gn,e),[i.memoizedState,e]},useRef:function(e){var t=ua();return e={current:e},t.memoizedState=e},useState:function(e){e=bI(e);var t=e.queue,n=TW.bind(null,gn,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:B5,useDeferredValue:function(e,t){var n=ua();return U5(n,e,t)},useTransition:function(){var e=bI(!1);return e=vW.bind(null,gn,e.queue,!0,!1),ua().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=gn,r=ua();if(Hn){if(n===void 0)throw Error(ze(407));n=n()}else{if(n=t(),Li===null)throw Error(ze(349));Un&127||nW(i,t,n)}r.memoizedState=n;var s={value:n,getSnapshot:t};return r.queue=s,rB(rW.bind(null,i,s,e),[e]),i.flags|=2048,e0(9,{destroy:void 0},iW.bind(null,i,s,n,t),null),n},useId:function(){var e=ua(),t=Li.identifierPrefix;if(Hn){var n=kc,i=Ec;n=(i&~(1<<32-So(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=XE++,0 <\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof i.is=="string"?a.createElement("select",{is:i.is}):a.createElement("select"),i.multiple?s.multiple=!0:i.size&&(s.size=i.size);break;default:s=typeof i.is=="string"?a.createElement(r,{is:i.is}):a.createElement(r)}}s[js]=t,s[Ya]=i;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)s.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=s;e:switch(Ms(s,r,i),r){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&cu(t)}}return Zi(t),gN(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&cu(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(ze(166));if(e=pf.current,cm(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,r=Rs,r!==null)switch(r.tag){case 27:case 5:i=r.memoizedProps}e[js]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||TZ(e.nodeValue,n)),e||jf(t,!0)}else e=tk(e).createTextNode(i),e[js]=t,t.stateNode=e}return Zi(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=cm(t),n!==null){if(e===null){if(!i)throw Error(ze(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ze(557));e[js]=t}else mp(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Zi(t),e=!1}else n=oN(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(po(t),t):(po(t),null);if(t.flags&128)throw Error(ze(558))}return Zi(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=cm(t),i!==null&&i.dehydrated!==null){if(e===null){if(!r)throw Error(ze(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(ze(317));r[js]=t}else mp(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Zi(t),r=!1}else r=oN(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(po(t),t):(po(t),null)}return po(t),t.flags&128?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,r=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(r=i.alternate.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==r&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Yv(t,t.updateQueue),Zi(t),null);case 4:return Gg(),e===null&&J5(t.stateNode.containerInfo),Zi(t),null;case 10:return Lu(t.type),Zi(t),null;case 19:if(Ss(Ir),i=t.memoizedState,i===null)return Zi(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Wb(i,!1);else{if(Sr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=FE(e),s!==null){for(t.flags|=128,Wb(i,!1),e=s.updateQueue,t.updateQueue=e,Yv(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)UG(n,e),n=n.sibling;return qi(Ir,Ir.current&1|2),Hn&&Eu(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&vo()>GE&&(t.flags|=128,r=!0,Wb(i,!1),t.lanes=4194304)}else{if(!r)if(e=FE(s),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Yv(t,e),Wb(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Hn)return Zi(t),null}else 2*vo()-i.renderingStartTime>GE&&n!==536870912&&(t.flags|=128,r=!0,Wb(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(e=i.last,e!==null?e.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=vo(),e.sibling=null,n=Ir.current,qi(Ir,r?n&1|2:n&1),Hn&&Eu(t,i.treeForkCount),e):(Zi(t),null);case 22:case 23:return po(t),j5(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?n&536870912&&!(t.flags&128)&&(Zi(t),t.subtreeFlags&6&&(t.flags|=8192)):Zi(t),n=t.updateQueue,n!==null&&Yv(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&Ss(ep),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Lu(qr),Zi(t),null;case 25:return null;case 30:return null}throw Error(ze(156,t.tag))}function pOe(e,t){switch(T5(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Lu(qr),Gg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return PE(t),null;case 31:if(t.memoizedState!==null){if(po(t),t.alternate===null)throw Error(ze(340));mp()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(po(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ze(340));mp()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ss(Ir),null;case 4:return Gg(),null;case 10:return Lu(t.type),null;case 22:case 23:return po(t),j5(),e!==null&&Ss(ep),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Lu(qr),null;case 25:return null;default:return null}}function UW(e,t){switch(T5(t),t.tag){case 3:Lu(qr),Gg();break;case 26:case 27:case 5:PE(t);break;case 4:Gg();break;case 31:t.memoizedState!==null&&po(t);break;case 13:po(t);break;case 19:Ss(Ir);break;case 10:Lu(t.type);break;case 22:case 23:po(t),j5(),e!==null&&Ss(ep);break;case 24:Lu(qr)}}function S1(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var r=i.next;n=r;do{if((n.tag&e)===e){i=void 0;var s=n.create,a=n.inst;i=s(),a.destroy=i}n=n.next}while(n!==r)}}catch(o){wi(t,t.return,o)}}function Rf(e,t,n){try{var i=t.updateQueue,r=i!==null?i.lastEffect:null;if(r!==null){var s=r.next;i=s;do{if((i.tag&e)===e){var a=i.inst,o=a.destroy;if(o!==void 0){a.destroy=void 0,r=t;var c=n,u=o;try{u()}catch(d){wi(r,c,d)}}}i=i.next}while(i!==s)}}catch(d){wi(t,t.return,d)}}function zW(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ZG(t,n)}catch(i){wi(e,e.return,i)}}}function FW(e,t,n){n.props=yp(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){wi(e,t,i)}}function oy(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof n=="function"?e.refCleanup=n(i):n.current=i}}catch(r){wi(e,t,r)}}function Tc(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(r){wi(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){wi(e,t,r)}else n.current=null}function VW(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(r){wi(e,e.return,r)}}function bN(e,t,n){try{var i=e.stateNode;LOe(i,e.type,n,t),i[Ya]=t}catch(r){wi(e,e.return,r)}}function XW(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Jf(e.type)||e.tag===4}function ON(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||XW(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Jf(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function EI(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Cu));else if(i!==4&&(i===27&&Jf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(EI(e,t,n),e=e.sibling;e!==null;)EI(e,t,n),e=e.sibling}function YE(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&Jf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(YE(e,t,n),e=e.sibling;e!==null;)YE(e,t,n),e=e.sibling}function qW(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);Ms(t,i,n),t[js]=e,t[Ya]=n}catch(s){wi(e,e.return,s)}}var Tu=!1,Xr=!1,yN=!1,bB=typeof WeakSet=="function"?WeakSet:Set,ps=null;function mOe(e,t){if(e=e.containerInfo,jI=sk,e=IG(e),v5(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,o=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||r!==0&&f.nodeType!==3||(o=a+r),f!==s||i!==0&&f.nodeType!==3||(c=a+i),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===r&&(o=a),h===s&&++d===i&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(RI={focusedElem:e,selectionRange:n},sk=!1,ps=t;ps!==null;)if(t=ps,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ps=e;else for(;ps!==null;){switch(t=ps,s=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),Ms(s,i,n),s[js]=e,bs(s),i=s;break e;case"link":var a=DB("link","href",r).get(i+(n.href||""));if(a){for(var o=0;o y&&(a=y,y=b,b=a);var O=z6(o,b),v=z6(o,y);if(O&&v&&(p.rangeCount!==1||p.anchorNode!==O.node||p.anchorOffset!==O.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var x=f.createRange();x.setStart(O.node,O.offset),p.removeAllRanges(),b>y?(p.addRange(x),p.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),p.addRange(x))}}}}for(f=[],p=o;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o n?32:n,Jt.T=null,n=_I,_I=null;var s=yf,a=Du;if(os=0,n0=yf=null,Du=0,di&6)throw Error(ze(331));var o=di;if(di|=4,iZ(s.current),eZ(s,s.current,a,n),di=o,E1(0,!1),wo&&typeof wo.onPostCommitFiberRoot=="function")try{wo.onPostCommitFiberRoot(g1,s)}catch{}return!0}finally{fi.p=r,Jt.T=i,OZ(e,t)}}function vB(e,t,n){t=Ho(n,t),t=vI(e.stateNode,t,2),e=bf(e,t,2),e!==null&&(O1(e,2),qc(e))}function wi(e,t,n){if(e.tag===3)vB(e,e,n);else for(;t!==null;){if(t.tag===3){vB(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Of===null||!Of.has(i))){e=Ho(n,e),n=PW(2),i=bf(t,n,2),i!==null&&(MW(n,i,t,e),O1(i,2),qc(i));break}}t=t.return}}function vN(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new OOe;var r=new Set;i.set(t,r)}else r=i.get(t),r===void 0&&(r=new Set,i.set(t,r));r.has(n)||(G5=!0,r.add(n),e=SOe.bind(null,e,t,n),t.then(e,e))}function SOe(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Li===e&&(Un&n)===n&&(Sr===4||Sr===3&&(Un&62914560)===Un&&300>vo()-s_?!(di&2)&&i0(e,0):W5|=n,t0===Un&&(t0=0)),qc(e)}function xZ(e,t){t===0&&(t=dG()),e=Bp(e,t),e!==null&&(O1(e,t),qc(e))}function EOe(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),xZ(e,n)}function kOe(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(ze(314))}i!==null&&i.delete(t),xZ(e,n)}function TOe(e,t){return f5(e,t)}var KE=null,Im=null,NI=!1,JE=!1,wN=!1,cf=0;function qc(e){e!==Im&&e.next===null&&(Im===null?KE=Im=e:Im=Im.next=e),JE=!0,NI||(NI=!0,AOe())}function E1(e,t){if(!wN&&JE){wN=!0;do for(var n=!1,i=KE;i!==null;){if(e!==0){var r=i.pendingLanes;if(r===0)var s=0;else{var a=i.suspendedLanes,o=i.pingedLanes;s=(1<<31-So(42|e)+1)-1,s&=r&~(a&~o),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,wB(i,s))}else s=Un,s=YT(i,i===Li?s:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(s&3)||b1(i,s)||(n=!0,wB(i,s));i=i.next}while(n);wN=!1}}function _Oe(){vZ()}function vZ(){JE=NI=!1;var e=0;cf!==0&&$Oe()&&(e=cf);for(var t=vo(),n=null,i=KE;i!==null;){var r=i.next,s=wZ(i,t);s===0?(i.next=null,n===null?KE=r:n.next=r,r===null&&(Im=n)):(n=i,(e!==0||s&3)&&(JE=!0)),i=r}os!==0&&os!==5||E1(e),cf!==0&&(cf=0)}function wZ(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,r=e.expirationTimes,s=e.pendingLanes&-62914561;0 o)break;var d=c.transferSize,f=c.initiatorType;d&&_B(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function jZ(e,t,n){var i=q0;if(i&&typeof t=="string"&&t){var r=qo(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),PB.has(r)||(PB.add(r),e={rel:e,crossOrigin:n,href:t},i.querySelector(r)===null&&(t=i.createElement("link"),Ms(t,"link",e),bs(t),i.head.appendChild(t)))}}function HOe(e){ud.D(e),jZ("dns-prefetch",e,null)}function YOe(e,t){ud.C(e,t),jZ("preconnect",e,t)}function GOe(e,t,n){ud.L(e,t,n);var i=q0;if(i&&e&&t){var r='link[rel="preload"][as="'+qo(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+qo(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+qo(n.imageSizes)+'"]')):r+='[href="'+qo(e)+'"]';var s=r;switch(t){case"style":s=r0(e);break;case"script":s=H0(e)}ll.has(s)||(e=tr({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ll.set(s,e),i.querySelector(r)!==null||t==="style"&&i.querySelector(k1(s))||t==="script"&&i.querySelector(T1(s))||(t=i.createElement("link"),Ms(t,"link",e),bs(t),i.head.appendChild(t)))}}function WOe(e,t){ud.m(e,t);var n=q0;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+qo(i)+'"][href="'+qo(e)+'"]',s=r;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=H0(e)}if(!ll.has(s)&&(e=tr({rel:"modulepreload",href:e},t),ll.set(s,e),n.querySelector(r)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(T1(s)))return}i=n.createElement("link"),Ms(i,"link",e),bs(i),n.head.appendChild(i)}}}function ZOe(e,t,n){ud.S(e,t,n);var i=q0;if(i&&e){var r=vg(i).hoistableStyles,s=r0(e);t=t||"default";var a=r.get(s);if(!a){var o={loading:0,preload:null};if(a=i.querySelector(k1(s)))o.loading=5;else{e=tr({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ll.get(s))&&eD(e,n);var c=a=i.createElement("link");bs(c),Ms(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){o.loading|=1}),c.addEventListener("error",function(){o.loading|=2}),o.loading|=4,PS(a,t,i)}a={type:"stylesheet",instance:a,count:1,state:o},r.set(s,a)}}}function KOe(e,t){ud.X(e,t);var n=q0;if(n&&e){var i=vg(n).hoistableScripts,r=H0(e),s=i.get(r);s||(s=n.querySelector(T1(r)),s||(e=tr({src:e,async:!0},t),(t=ll.get(r))&&tD(e,t),s=n.createElement("script"),bs(s),Ms(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(r,s))}}function JOe(e,t){ud.M(e,t);var n=q0;if(n&&e){var i=vg(n).hoistableScripts,r=H0(e),s=i.get(r);s||(s=n.querySelector(T1(r)),s||(e=tr({src:e,async:!0,type:"module"},t),(t=ll.get(r))&&tD(e,t),s=n.createElement("script"),bs(s),Ms(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(r,s))}}function MB(e,t,n,i){var r=(r=pf.current)?nk(r):null;if(!r)throw Error(ze(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=r0(n.href),n=vg(r).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=r0(n.href);var s=vg(r).hoistableStyles,a=s.get(e);if(a||(r=r.ownerDocument||r,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,a),(s=r.querySelector(k1(e)))&&!s._p&&(a.instance=s,a.state.loading=5),ll.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ll.set(e,n),s||eye(r,e,n,a.state))),t&&i===null)throw Error(ze(528,""));return a}if(t&&i!==null)throw Error(ze(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=H0(n),n=vg(r).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(ze(444,e))}}function r0(e){return'href="'+qo(e)+'"'}function k1(e){return'link[rel="stylesheet"]['+e+"]"}function RZ(e){return tr({},e,{"data-precedence":e.precedence,precedence:null})}function eye(e,t,n,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Ms(t,"link",n),bs(t),e.head.appendChild(t))}function H0(e){return'[src="'+qo(e)+'"]'}function T1(e){return"script[async]"+e}function LB(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+qo(n.href)+'"]');if(i)return t.instance=i,bs(i),i;var r=tr({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),bs(i),Ms(i,"style",r),PS(i,n.precedence,e),t.instance=i;case"stylesheet":r=r0(n.href);var s=e.querySelector(k1(r));if(s)return t.state.loading|=4,t.instance=s,bs(s),s;i=RZ(n),(r=ll.get(r))&&eD(i,r),s=(e.ownerDocument||e).createElement("link"),bs(s);var a=s;return a._p=new Promise(function(o,c){a.onload=o,a.onerror=c}),Ms(s,"link",i),t.state.loading|=4,PS(s,n.precedence,e),t.instance=s;case"script":return s=H0(n.src),(r=e.querySelector(T1(s)))?(t.instance=r,bs(r),r):(i=n,(r=ll.get(s))&&(i=tr({},n),tD(i,r)),e=e.ownerDocument||e,r=e.createElement("script"),bs(r),Ms(r,"link",i),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(ze(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(i=t.instance,t.state.loading|=4,PS(i,n.precedence,e));return t.instance}function PS(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=i.length?i[i.length-1]:null,s=r,a=0;a title"):null)}function tye(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function IZ(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function nye(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var r=r0(i.href),s=t.querySelector(k1(r));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=ik.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,bs(s);return}s=t.ownerDocument||t,i=RZ(i),(r=ll.get(r))&&eD(i,r),s=s.createElement("link"),bs(s);var a=s;a._p=new Promise(function(o,c){a.onload=o,a.onerror=c}),Ms(s,"link",i),n.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ik.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var AN=0;function iye(e,t){return e.stylesheets&&e.count===0&&LS(e,e.stylesheets),0 AN?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(r)}}:null}function ik(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)LS(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var rk=null;function LS(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,rk=new Map,t.forEach(rye,e),rk=null,ik.call(e))}function rye(e,t){if(!(t.state.loading&4)){var n=rk.get(e);if(n)var i=n.get(null);else{n=new Map,rk.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s "u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(UZ)}catch(e){console.error(e)}}UZ(),GY.exports=qT;var fye=GY.exports;const hye=$0(fye),aD=m.createContext({});function u_(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const d_=m.createContext(null),rx=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class pye extends m.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function mye({children:e,isPresent:t}){const n=m.useId(),i=m.useRef(null),r=m.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=m.useContext(rx);return m.useInsertionEffect(()=>{const{width:a,height:o,top:c,left:u}=r.current;if(t||!i.current||!a||!o)return;i.current.dataset.motionPopId=n;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${a}px !important; @@ -55,37 +55,37 @@ Error generating stack: `+i.message+` top: ${c}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(d)}},[t]),l.jsx(fye,{isPresent:t,childRef:i,sizeRef:r,children:m.cloneElement(e,{ref:i})})}const pye=({children:e,initial:t,isPresent:n,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:a})=>{const o=u_(mye),c=m.useId(),u=m.useCallback(f=>{o.set(f,!0);for(const h of o.values())if(!h)return;i&&i()},[o,i]),d=m.useMemo(()=>({id:c,initial:t,isPresent:n,custom:r,onExitComplete:u,register:f=>(o.set(f,!1),()=>o.delete(f))}),s?[Math.random(),u]:[n,u]);return m.useMemo(()=>{o.forEach((f,h)=>o.set(h,!1))},[n]),m.useEffect(()=>{!n&&!o.size&&i&&i()},[n]),a==="popLayout"&&(e=l.jsx(hye,{isPresent:n,children:e})),l.jsx(d_.Provider,{value:d,children:e})};function mye(){return new Map}function UZ(e=!0){const t=m.useContext(d_);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:r}=t,s=m.useId();m.useEffect(()=>{e&&r(s)},[e]);const a=m.useCallback(()=>e&&i&&i(s),[s,i,e]);return!n&&i?[!1,a]:[!0]}const ew=e=>e.key||"";function XB(e){const t=[];return m.Children.forEach(e,n=>{m.isValidElement(n)&&t.push(n)}),t}const oD=typeof window<"u",zZ=oD?m.useLayoutEffect:m.useEffect,Sf=({children:e,custom:t,initial:n=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:s="sync",propagate:a=!1})=>{const[o,c]=UZ(a),u=m.useMemo(()=>XB(e),[e]),d=a&&!o?[]:u.map(ew),f=m.useRef(!0),h=m.useRef(u),p=u_(()=>new Map),[g,b]=m.useState(u),[y,O]=m.useState(u);zZ(()=>{f.current=!1,h.current=u;for(let w=0;w {const E=ew(w),S=a&&!o?!1:u===y||d.includes(E),k=()=>{if(p.has(E))p.set(E,!0);else return;let T=!0;p.forEach(A=>{A||(T=!1)}),T&&(x==null||x(),O(h.current),a&&(c==null||c()),i&&i())};return l.jsx(pye,{isPresent:S,initial:!f.current||n?void 0:!1,custom:S?void 0:t,presenceAffectsLayout:r,mode:s,onExitComplete:S?void 0:k,children:w},E)})})},ko=e=>e;let FZ=ko;const gye={useManualTiming:!1};function bye(e){let t=new Set,n=new Set,i=!1,r=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(u){s.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&i?t:n;return d&&s.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),s.delete(u)},process:u=>{if(a=u,i){r=!0;return}i=!0,[t,n]=[n,t],t.forEach(o),t.clear(),i=!1,r&&(r=!1,c.process(u))}};return c}const tw=["read","resolveKeyframes","update","preRender","render","postRender"],Oye=40;function VZ(e,t){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=tw.reduce((O,v)=>(O[v]=bye(s),O),{}),{read:o,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const O=performance.now();n=!1,r.delta=i?1e3/60:Math.max(Math.min(O-r.timestamp,Oye),1),r.timestamp=O,r.isProcessing=!0,o.process(r),c.process(r),u.process(r),d.process(r),f.process(r),h.process(r),r.isProcessing=!1,n&&t&&(i=!1,e(p))},g=()=>{n=!0,i=!0,r.isProcessing||e(p)};return{schedule:tw.reduce((O,v)=>{const x=a[v];return O[v]=(w,E=!1,S=!1)=>(n||g(),x.schedule(w,E,S)),O},{}),cancel:O=>{for(let v=0;v qB[e].some(n=>!!t[n])};function yye(e){for(const t in e)a0[t]={...a0[t],...e[t]}}const xye=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ok(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||xye.has(e)}let qZ=e=>!ok(e);function HZ(e){e&&(qZ=t=>t.startsWith("on")?!ok(t):e(t))}try{HZ(require("@emotion/is-prop-valid").default)}catch{}function vye(e,t,n){const i={};for(const r in e)r==="values"&&typeof e.values=="object"||(qZ(r)||n===!0&&ok(r)||!t&&!ok(r)||e.draggable&&r.startsWith("onDrag"))&&(i[r]=e[r]);return i}function wye({children:e,isValidProp:t,...n}){t&&HZ(t),n={...m.useContext(rx),...n},n.isStatic=u_(()=>n.isStatic);const i=m.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return l.jsx(rx.Provider,{value:i,children:e})}function Sye(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...i)=>e(...i);return new Proxy(n,{get:(i,r)=>r==="create"?e:(t.has(r)||t.set(r,e(r)),t.get(r))})}const f_=m.createContext({});function sx(e){return typeof e=="string"||Array.isArray(e)}function h_(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const lD=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],cD=["initial",...lD];function p_(e){return h_(e.animate)||cD.some(t=>sx(e[t]))}function YZ(e){return!!(p_(e)||e.variants)}function Eye(e,t){if(p_(e)){const{initial:n,animate:i}=e;return{initial:n===!1||sx(n)?n:void 0,animate:sx(i)?i:void 0}}return e.inherit!==!1?t:{}}function kye(e){const{initial:t,animate:n}=Eye(e,m.useContext(f_));return m.useMemo(()=>({initial:t,animate:n}),[HB(t),HB(n)])}function HB(e){return Array.isArray(e)?e.join(" "):e}const Tye=Symbol.for("motionComponentSymbol");function ig(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function _ye(e,t,n){return m.useCallback(i=>{i&&e.onMount&&e.onMount(i),t&&(i?t.mount(i):t.unmount()),n&&(typeof n=="function"?n(i):ig(n)&&(n.current=i))},[t])}const uD=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Aye="framerAppearId",GZ="data-"+uD(Aye),{schedule:dD}=VZ(queueMicrotask,!1),WZ=m.createContext({});function Nye(e,t,n,i,r){var s,a;const{visualElement:o}=m.useContext(f_),c=m.useContext(XZ),u=m.useContext(d_),d=m.useContext(rx).reducedMotion,f=m.useRef(null);i=i||c.renderer,!f.current&&i&&(f.current=i(e,{visualState:t,parent:o,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=m.useContext(WZ);h&&!h.projection&&r&&(h.type==="html"||h.type==="svg")&&Cye(f.current,n,r,p);const g=m.useRef(!1);m.useInsertionEffect(()=>{h&&g.current&&h.update(n,u)});const b=n[GZ],y=m.useRef(!!b&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,b))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,b)));return zZ(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),dD.render(h.render),y.current&&h.animationState&&h.animationState.animateChanges())}),m.useEffect(()=>{h&&(!y.current&&h.animationState&&h.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var O;(O=window.MotionHandoffMarkAsComplete)===null||O===void 0||O.call(window,b)}),y.current=!1))}),h}function Cye(e,t,n,i){const{layoutId:r,layout:s,drag:a,dragConstraints:o,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:ZZ(e.parent)),e.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!a||o&&ig(o),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,layoutScroll:c,layoutRoot:u})}function ZZ(e){if(e)return e.options.allowProjection!==!1?e.projection:ZZ(e.parent)}function jye({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:i,Component:r}){var s,a;e&&yye(e);function o(u,d){let f;const h={...m.useContext(rx),...u,layoutId:Rye(u)},{isStatic:p}=h,g=kye(u),b=i(u,p);if(!p&&oD){Iye();const y=Pye(h);f=y.MeasureLayout,g.visualElement=Nye(r,b,h,t,y.ProjectionNode)}return l.jsxs(f_.Provider,{value:g,children:[f&&g.visualElement?l.jsx(f,{visualElement:g.visualElement,...h}):null,n(r,u,_ye(b,g.visualElement,d),b,p,g.visualElement)]})}o.displayName=`motion.${typeof r=="string"?r:`create(${(a=(s=r.displayName)!==null&&s!==void 0?s:r.name)!==null&&a!==void 0?a:""})`}`;const c=m.forwardRef(o);return c[Tye]=r,c}function Rye({layoutId:e}){const t=m.useContext(aD).id;return t&&e!==void 0?t+"-"+e:e}function Iye(e,t){m.useContext(XZ).strict}function Pye(e){const{drag:t,layout:n}=a0;if(!t&&!n)return{};const i={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const Mye=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function fD(e){return typeof e!="string"||e.includes("-")?!1:!!(Mye.indexOf(e)>-1||/[A-Z]/u.test(e))}function YB(e){const t=[{},{}];return e==null||e.values.forEach((n,i)=>{t[0][i]=n.get(),t[1][i]=n.getVelocity()}),t}function hD(e,t,n,i){if(typeof t=="function"){const[r,s]=YB(i);t=t(n!==void 0?n:e.custom,r,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,s]=YB(i);t=t(n!==void 0?n:e.custom,r,s)}return t}const BI=e=>Array.isArray(e),Lye=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),Dye=e=>BI(e)?e[e.length-1]||0:e,Zs=e=>!!(e&&e.getVelocity);function $S(e){const t=Zs(e)?e.get():e;return Lye(t)?t.toValue():t}function $ye({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},i,r,s){const a={latestValues:Qye(i,r,s,e),renderState:t()};return n&&(a.onMount=o=>n({props:i,current:o,...a}),a.onUpdate=o=>n(o)),a}const KZ=e=>(t,n)=>{const i=m.useContext(f_),r=m.useContext(d_),s=()=>$ye(e,t,i,r);return n?s():u_(s)};function Qye(e,t,n,i){const r={},s=i(e,{});for(const h in s)r[h]=$S(s[h]);let{initial:a,animate:o}=e;const c=p_(e),u=YZ(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),o===void 0&&(o=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?o:a;if(f&&typeof f!="boolean"&&!h_(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p t=>typeof t=="string"&&t.startsWith(e),eK=JZ("--"),Bye=JZ("var(--"),pD=e=>Bye(e)?Uye.test(e.split("/*")[0].trim()):!1,Uye=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,tK=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Zu=(e,t,n)=>n>t?t:n typeof e=="number",parse:parseFloat,transform:e=>e},ax={...G0,transform:e=>Zu(0,1,e)},nw={...G0,default:1},_1=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Bd=_1("deg"),Mc=_1("%"),Gt=_1("px"),zye=_1("vh"),Fye=_1("vw"),GB={...Mc,parse:e=>Mc.parse(e)/100,transform:e=>Mc.transform(e*100)},Vye={borderWidth:Gt,borderTopWidth:Gt,borderRightWidth:Gt,borderBottomWidth:Gt,borderLeftWidth:Gt,borderRadius:Gt,radius:Gt,borderTopLeftRadius:Gt,borderTopRightRadius:Gt,borderBottomRightRadius:Gt,borderBottomLeftRadius:Gt,width:Gt,maxWidth:Gt,height:Gt,maxHeight:Gt,top:Gt,right:Gt,bottom:Gt,left:Gt,padding:Gt,paddingTop:Gt,paddingRight:Gt,paddingBottom:Gt,paddingLeft:Gt,margin:Gt,marginTop:Gt,marginRight:Gt,marginBottom:Gt,marginLeft:Gt,backgroundPositionX:Gt,backgroundPositionY:Gt},Xye={rotate:Bd,rotateX:Bd,rotateY:Bd,rotateZ:Bd,scale:nw,scaleX:nw,scaleY:nw,scaleZ:nw,skew:Bd,skewX:Bd,skewY:Bd,distance:Gt,translateX:Gt,translateY:Gt,translateZ:Gt,x:Gt,y:Gt,z:Gt,perspective:Gt,transformPerspective:Gt,opacity:ax,originX:GB,originY:GB,originZ:Gt},WB={...G0,transform:Math.round},mD={...Vye,...Xye,zIndex:WB,size:Gt,fillOpacity:ax,strokeOpacity:ax,numOctaves:WB},qye={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Hye=Y0.length;function Yye(e,t,n){let i="",r=!0;for(let s=0;s ({style:{},transform:{},transformOrigin:{},vars:{}}),nK=()=>({...OD(),attrs:{}}),yD=e=>typeof e=="string"&&e.toLowerCase()==="svg";function iK(e,{style:t,vars:n},i,r){Object.assign(e.style,t,r&&r.getProjectionStyles(i));for(const s in n)e.style.setProperty(s,n[s])}const rK=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function sK(e,t,n,i){iK(e,t,void 0,i);for(const r in t.attrs)e.setAttribute(rK.has(r)?r:uD(r),t.attrs[r])}const lk={};function Jye(e){Object.assign(lk,e)}function aK(e,{layout:t,layoutId:n}){return zp.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!lk[e]||e==="opacity")}function xD(e,t,n){var i;const{style:r}=e,s={};for(const a in r)(Zs(r[a])||t.style&&Zs(t.style[a])||aK(a,e)||((i=n==null?void 0:n.getValue(a))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(s[a]=r[a]);return s}function oK(e,t,n){const i=xD(e,t,n);for(const r in e)if(Zs(e[r])||Zs(t[r])){const s=Y0.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=e[r]}return i}function exe(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const KB=["x","y","width","height","cx","cy","r"],txe={useVisualState:KZ({scrapeMotionValuesFromProps:oK,createRenderState:nK,onUpdate:({props:e,prevProps:t,current:n,renderState:i,latestValues:r})=>{if(!n)return;let s=!!e.drag;if(!s){for(const o in r)if(zp.has(o)){s=!0;break}}if(!s)return;let a=!t;if(t)for(let o=0;o {exe(n,i),er.render(()=>{bD(i,r,yD(n.tagName),e.transformTemplate),sK(n,i)})})}})},nxe={useVisualState:KZ({scrapeMotionValuesFromProps:xD,createRenderState:OD})};function lK(e,t,n){for(const i in t)!Zs(t[i])&&!aK(i,n)&&(e[i]=t[i])}function ixe({transformTemplate:e},t){return m.useMemo(()=>{const n=OD();return gD(n,t,e),Object.assign({},n.vars,n.style)},[t])}function rxe(e,t){const n=e.style||{},i={};return lK(i,n,e),Object.assign(i,ixe(e,t)),i}function sxe(e,t){const n={},i=rxe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}function axe(e,t,n,i){const r=m.useMemo(()=>{const s=nK();return bD(s,t,yD(i),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};lK(s,e.style,e),r.style={...s,...r.style}}return r}function oxe(e=!1){return(n,i,r,{latestValues:s},a)=>{const c=(fD(n)?axe:sxe)(i,s,a,n),u=vye(i,typeof n=="string",e),d=n!==m.Fragment?{...u,...c,ref:r}:{},{children:f}=i,h=m.useMemo(()=>Zs(f)?f.get():f,[f]);return m.createElement(n,{...d,children:h})}}function lxe(e,t){return function(i,{forwardMotionProps:r}={forwardMotionProps:!1}){const a={...fD(i)?txe:nxe,preloadedFeatures:e,useRender:oxe(r),createVisualElement:t,Component:i};return jye(a)}}function cK(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i (QS===void 0&&Lc.set(_s.isProcessing||gye.useManualTiming?_s.timestamp:performance.now()),QS),set:e=>{QS=e,queueMicrotask(cxe)}};function wD(e,t){e.indexOf(t)===-1&&e.push(t)}function SD(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class ED{constructor(){this.subscriptions=[]}add(t){return wD(this.subscriptions,t),()=>SD(this.subscriptions,t)}notify(t,n,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,i);else for(let s=0;s !isNaN(parseFloat(e));class dxe{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,r=!0)=>{const s=Lc.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),r&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Lc.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=uxe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new ED);const i=this.events[t].add(n);return t==="change"?()=>{i(),er.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Lc.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>JB)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,JB);return dK(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ox(e,t){return new dxe(e,t)}function fxe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ox(n))}function hxe(e,t){const n=m_(e,t);let{transitionEnd:i={},transition:r={},...s}=n||{};s={...s,...i};for(const a in s){const o=Dye(s[a]);fxe(e,a,o)}}function pxe(e){return!!(Zs(e)&&e.add)}function UI(e,t){const n=e.getValue("willChange");if(pxe(n))return n.add(t)}function fK(e){return e.props[GZ]}function kD(e){let t;return()=>(t===void 0&&(t=e()),t)}const mxe=kD(()=>window.ScrollTimeline!==void 0);class gxe{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let i=0;i {if(mxe()&&r.attachTimeline)return r.attachTimeline(t);if(typeof n=="function")return n(r)});return()=>{i.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;n n[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class bxe extends gxe{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const $u=e=>e*1e3,Qu=e=>e/1e3;function TD(e){return typeof e=="function"}function e8(e,t){e.timeline=t,e.onfinish=null}const _D=e=>Array.isArray(e)&&typeof e[0]=="number",Oxe={linearEasing:void 0};function yxe(e,t){const n=kD(e);return()=>{var i;return(i=Oxe[t])!==null&&i!==void 0?i:n()}}const ck=yxe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),o0=(e,t,n)=>{const i=t-e;return i===0?1:(n-e)/i},hK=(e,t,n=10)=>{let i="";const r=Math.max(Math.round(t/n),2);for(let s=0;s `cubic-bezier(${e}, ${t}, ${n}, ${i})`,zI={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:IO([0,.65,.55,1]),circOut:IO([.55,0,1,.45]),backIn:IO([.31,.01,.66,-.59]),backOut:IO([.33,1.53,.69,.99])};function mK(e,t){if(e)return typeof e=="function"&&ck()?hK(e,t):_D(e)?IO(e):Array.isArray(e)?e.map(n=>mK(n,t)||zI.easeOut):zI[e]}const gK=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,xxe=1e-7,vxe=12;function wxe(e,t,n,i,r){let s,a,o=0;do a=t+(n-t)/2,s=gK(a,i,r)-e,s>0?n=a:t=a;while(Math.abs(s)>xxe&&++o wxe(s,0,1,e,n);return s=>s===0||s===1?s:gK(r(s),t,i)}const bK=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,OK=e=>t=>1-e(1-t),yK=A1(.33,1.53,.69,.99),AD=OK(yK),xK=bK(AD),vK=e=>(e*=2)<1?.5*AD(e):.5*(2-Math.pow(2,-10*(e-1))),ND=e=>1-Math.sin(Math.acos(e)),wK=OK(ND),SK=bK(ND),EK=e=>/^0[^.\s]+$/u.test(e);function Sxe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||EK(e):!0}const fy=e=>Math.round(e*1e5)/1e5,CD=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Exe(e){return e==null}const kxe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,jD=(e,t)=>n=>!!(typeof n=="string"&&kxe.test(n)&&n.startsWith(e)||t&&!Exe(n)&&Object.prototype.hasOwnProperty.call(n,t)),kK=(e,t,n)=>i=>{if(typeof i!="string")return i;const[r,s,a,o]=i.match(CD);return{[e]:parseFloat(r),[t]:parseFloat(s),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},Txe=e=>Zu(0,255,e),CN={...G0,transform:e=>Math.round(Txe(e))},Fh={test:jD("rgb","red"),parse:kK("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+CN.transform(e)+", "+CN.transform(t)+", "+CN.transform(n)+", "+fy(ax.transform(i))+")"};function _xe(e){let t="",n="",i="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,i+=i,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const FI={test:jD("#"),parse:_xe,transform:Fh.transform},rg={test:jD("hsl","hue"),parse:kK("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+Mc.transform(fy(t))+", "+Mc.transform(fy(n))+", "+fy(ax.transform(i))+")"},Hs={test:e=>Fh.test(e)||FI.test(e)||rg.test(e),parse:e=>Fh.test(e)?Fh.parse(e):rg.test(e)?rg.parse(e):FI.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Fh.transform(e):rg.transform(e)},Axe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Nxe(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(CD))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(Axe))===null||n===void 0?void 0:n.length)||0)>0}const TK="number",_K="color",Cxe="var",jxe="var(",t8="${}",Rxe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function lx(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},r=[];let s=0;const o=t.replace(Rxe,c=>(Hs.test(c)?(i.color.push(s),r.push(_K),n.push(Hs.parse(c))):c.startsWith(jxe)?(i.var.push(s),r.push(Cxe),n.push(c)):(i.number.push(s),r.push(TK),n.push(parseFloat(c))),++s,t8)).split(t8);return{values:n,split:o,indexes:i,types:r}}function AK(e){return lx(e).values}function NK(e){const{split:t,types:n}=lx(e),i=t.length;return r=>{let s="";for(let a=0;atypeof e=="number"?0:e;function Pxe(e){const t=AK(e);return NK(e)(t.map(Ixe))}const Mf={test:Nxe,parse:AK,createTransformer:NK,getAnimatableNone:Pxe},Mxe=new Set(["brightness","contrast","saturate","opacity"]);function Lxe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=n.match(CD)||[];if(!i)return e;const r=n.replace(i,"");let s=Mxe.has(t)?1:0;return i!==n&&(s*=100),t+"("+s+r+")"}const Dxe=/\b([a-z-]*)\(.*?\)/gu,VI={...Mf,getAnimatableNone:e=>{const t=e.match(Dxe);return t?t.map(Lxe).join(" "):e}},$xe={...mD,color:Hs,backgroundColor:Hs,outlineColor:Hs,fill:Hs,stroke:Hs,borderColor:Hs,borderTopColor:Hs,borderRightColor:Hs,borderBottomColor:Hs,borderLeftColor:Hs,filter:VI,WebkitFilter:VI},RD=e=>$xe[e];function CK(e,t){let n=RD(e);return n!==VI&&(n=Mf),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Qxe=new Set(["auto","none","0"]);function Bxe(e,t,n){let i=0,r;for(;i e===G0||e===Gt,i8=(e,t)=>parseFloat(e.split(", ")[t]),r8=(e,t)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const r=i.match(/^matrix3d\((.+)\)$/u);if(r)return i8(r[1],t);{const s=i.match(/^matrix\((.+)\)$/u);return s?i8(s[1],e):0}},Uxe=new Set(["x","y","z"]),zxe=Y0.filter(e=>!Uxe.has(e));function Fxe(e){const t=[];return zxe.forEach(n=>{const i=e.getValue(n);i!==void 0&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}const l0={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:r8(4,13),y:r8(5,14)};l0.translateX=l0.x;l0.translateY=l0.y;const ip=new Set;let XI=!1,qI=!1;function jK(){if(qI){const e=Array.from(ip).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),n=new Map;t.forEach(i=>{const r=Fxe(i);r.length&&(n.set(i,r),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const r=n.get(i);r&&r.forEach(([s,a])=>{var o;(o=i.getValue(s))===null||o===void 0||o.set(a)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}qI=!1,XI=!1,ip.forEach(e=>e.complete()),ip.clear()}function RK(){ip.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(qI=!0)})}function Vxe(){RK(),jK()}class ID{constructor(t,n,i,r,s,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=i,this.motionValue=r,this.element=s,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(ip.add(this),XI||(XI=!0,er.read(RK),er.resolveKeyframes(jK))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:i,motionValue:r}=this;for(let s=0;s /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Xxe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function qxe(e){const t=Xxe.exec(e);if(!t)return[,];const[,n,i,r]=t;return[`--${n??i}`,r]}function PK(e,t,n=1){const[i,r]=qxe(e);if(!i)return;const s=window.getComputedStyle(t).getPropertyValue(i);if(s){const a=s.trim();return IK(a)?parseFloat(a):a}return pD(r)?PK(r,t,n+1):r}const MK=e=>t=>t.test(e),Hxe={test:e=>e==="auto",parse:e=>e},LK=[G0,Gt,Mc,Bd,Fye,zye,Hxe],s8=e=>LK.find(MK(e));class DK extends ID{constructor(t,n,i,r,s){super(t,n,i,r,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c {n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const a8=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Mf.test(e)||e==="0")&&!e.startsWith("url("));function Yxe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n e!==null;function g_(e,{repeat:t,repeatType:n="loop"},i){const r=e.filter(Wxe),s=t&&n!=="loop"&&t%2===1?0:r.length-1;return!s||i===void 0?r[s]:i}const Zxe=40;class $K{constructor({autoplay:t=!0,delay:n=0,type:i="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:a="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Lc.now(),this.options={autoplay:t,delay:n,type:i,repeat:r,repeatDelay:s,repeatType:a,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>Zxe?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Vxe(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Lc.now(),this.hasAttemptedResolve=!0;const{name:i,type:r,velocity:s,delay:a,onComplete:o,onUpdate:c,isGenerator:u}=this.options;if(!u&&!Gxe(t,i,r,s))if(a)this.options.duration=0;else{c&&c(g_(t,this.options,n)),o&&o(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const HI=2e4;function QK(e){let t=0;const n=50;let i=e.next(t);for(;!i.done&&t =HI?1/0:t}const gr=(e,t,n)=>e+(t-e)*n;function jN(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Kxe({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,t/=100,n/=100;let r=0,s=0,a=0;if(!t)r=s=a=n;else{const o=n<.5?n*(1+t):n+t-n*t,c=2*n-o;r=jN(c,o,e+1/3),s=jN(c,o,e),a=jN(c,o,e-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:i}}function uk(e,t){return n=>n>0?t:e}const RN=(e,t,n)=>{const i=e*e,r=n*(t*t-i)+i;return r<0?0:Math.sqrt(r)},Jxe=[FI,Fh,rg],e1e=e=>Jxe.find(t=>t.test(e));function o8(e){const t=e1e(e);if(!t)return!1;let n=t.parse(e);return t===rg&&(n=Kxe(n)),n}const l8=(e,t)=>{const n=o8(e),i=o8(t);if(!n||!i)return uk(e,t);const r={...n};return s=>(r.red=RN(n.red,i.red,s),r.green=RN(n.green,i.green,s),r.blue=RN(n.blue,i.blue,s),r.alpha=gr(n.alpha,i.alpha,s),Fh.transform(r))},t1e=(e,t)=>n=>t(e(n)),N1=(...e)=>e.reduce(t1e),YI=new Set(["none","hidden"]);function n1e(e,t){return YI.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function i1e(e,t){return n=>gr(e,t,n)}function PD(e){return typeof e=="number"?i1e:typeof e=="string"?pD(e)?uk:Hs.test(e)?l8:a1e:Array.isArray(e)?BK:typeof e=="object"?Hs.test(e)?l8:r1e:uk}function BK(e,t){const n=[...e],i=n.length,r=e.map((s,a)=>PD(s)(s,t[a]));return s=>{for(let a=0;a{for(const s in i)n[s]=i[s](r);return n}}function s1e(e,t){var n;const i=[],r={color:0,var:0,number:0};for(let s=0;s{const n=Mf.createTransformer(t),i=lx(e),r=lx(t);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?YI.has(e)&&!r.values.length||YI.has(t)&&!i.values.length?n1e(e,t):N1(BK(s1e(i,r),r.values),n):uk(e,t)};function UK(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?gr(e,t,n):PD(e)(e,t)}const o1e=5;function zK(e,t,n){const i=Math.max(t-o1e,0);return dK(n-e(i),t-i)}const wr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},IN=.001;function l1e({duration:e=wr.duration,bounce:t=wr.bounce,velocity:n=wr.velocity,mass:i=wr.mass}){let r,s,a=1-t;a=Zu(wr.minDamping,wr.maxDamping,a),e=Zu(wr.minDuration,wr.maxDuration,Qu(e)),a<1?(r=u=>{const d=u*a,f=d*e,h=d-n,p=GI(u,a),g=Math.exp(-f);return IN-h/p*g},s=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,g=Math.exp(-f),b=GI(Math.pow(u,2),a);return(-r(u)+IN>0?-1:1)*((h-p)*g)/b}):(r=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-IN+d*f},s=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const o=5/e,c=u1e(r,s,o);if(e=$u(e),isNaN(c))return{stiffness:wr.stiffness,damping:wr.damping,duration:e};{const u=Math.pow(c,2)*i;return{stiffness:u,damping:a*2*Math.sqrt(i*u),duration:e}}}const c1e=12;function u1e(e,t,n){let i=n;for(let r=1;r e[n]!==void 0)}function h1e(e){let t={velocity:wr.velocity,stiffness:wr.stiffness,damping:wr.damping,mass:wr.mass,isResolvedFromDuration:!1,...e};if(!c8(e,f1e)&&c8(e,d1e))if(e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(n*1.2),r=i*i,s=2*Zu(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:wr.mass,stiffness:r,damping:s}}else{const n=l1e(e);t={...t,...n,mass:wr.mass},t.isResolvedFromDuration=!0}return t}function FK(e=wr.visualDuration,t=wr.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:r}=n;const s=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:s},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=h1e({...n,velocity:-Qu(n.velocity||0)}),g=h||0,b=u/(2*Math.sqrt(c*d)),y=a-s,O=Qu(Math.sqrt(c/d)),v=Math.abs(y)<5;i||(i=v?wr.restSpeed.granular:wr.restSpeed.default),r||(r=v?wr.restDelta.granular:wr.restDelta.default);let x;if(b<1){const E=GI(O,b);x=S=>{const k=Math.exp(-b*O*S);return a-k*((g+b*O*y)/E*Math.sin(E*S)+y*Math.cos(E*S))}}else if(b===1)x=E=>a-Math.exp(-O*E)*(y+(g+O*y)*E);else{const E=O*Math.sqrt(b*b-1);x=S=>{const k=Math.exp(-b*O*S),T=Math.min(E*S,300);return a-k*((g+b*O*y)*Math.sinh(T)+E*y*Math.cosh(T))/E}}const w={calculatedDuration:p&&f||null,next:E=>{const S=x(E);if(p)o.done=E>=f;else{let k=0;b<1&&(k=E===0?$u(g):zK(x,E,S));const T=Math.abs(k)<=i,A=Math.abs(a-S)<=r;o.done=T&&A}return o.value=o.done?a:S,o},toString:()=>{const E=Math.min(QK(w),HI),S=hK(k=>w.next(E*k).value,E,30);return E+"ms "+S}};return w}function u8({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:a,min:o,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=T=>o!==void 0&&T c,g=T=>o===void 0?c:c===void 0||Math.abs(o-T) -b*Math.exp(-T/i),x=T=>O+v(T),w=T=>{const A=v(T),N=x(T);h.done=Math.abs(A)<=u,h.value=h.done?O:N};let E,S;const k=T=>{p(h.value)&&(E=T,S=FK({keyframes:[h.value,g(h.value)],velocity:zK(x,T,h.value),damping:r,stiffness:s,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:T=>{let A=!1;return!S&&E===void 0&&(A=!0,w(T),k(T)),E!==void 0&&T>=E?S.next(T-E):(!A&&w(T),h)}}}const p1e=A1(.42,0,1,1),m1e=A1(0,0,.58,1),VK=A1(.42,0,.58,1),g1e=e=>Array.isArray(e)&&typeof e[0]!="number",b1e={linear:ko,easeIn:p1e,easeInOut:VK,easeOut:m1e,circIn:ND,circInOut:SK,circOut:wK,backIn:AD,backInOut:xK,backOut:yK,anticipate:vK},d8=e=>{if(_D(e)){FZ(e.length===4);const[t,n,i,r]=e;return A1(t,n,i,r)}else if(typeof e=="string")return b1e[e];return e};function O1e(e,t,n){const i=[],r=n||UK,s=e.length-1;for(let a=0;a t[0];if(s===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=O1e(t,i,r),c=o.length,u=d=>{if(a&&d1)for(;f u(Zu(e[0],e[s-1],d)):u}function x1e(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const r=o0(0,t,i);e.push(gr(n,1,r))}}function v1e(e){const t=[0];return x1e(t,e.length-1),t}function w1e(e,t){return e.map(n=>n*t)}function S1e(e,t){return e.map(()=>t||VK).splice(0,e.length-1)}function dk({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const r=g1e(i)?i.map(d8):d8(i),s={done:!1,value:t[0]},a=w1e(n&&n.length===t.length?n:v1e(t),e),o=y1e(a,t,{ease:Array.isArray(r)?r:S1e(t,r)});return{calculatedDuration:e,next:c=>(s.value=o(c),s.done=c>=e,s)}}const E1e=e=>{const t=({timestamp:n})=>e(n);return{start:()=>er.update(t,!0),stop:()=>Pf(t),now:()=>_s.isProcessing?_s.timestamp:Lc.now()}},k1e={decay:u8,inertia:u8,tween:dk,keyframes:dk,spring:FK},T1e=e=>e/100;class MD extends $K{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:i,element:r,keyframes:s}=this.options,a=(r==null?void 0:r.KeyframeResolver)||ID,o=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(s,o,n,i,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:a=0}=this.options,o=TD(n)?n:k1e[n]||dk;let c,u;o!==dk&&typeof t[0]!="number"&&(c=N1(T1e,UK(t[0],t[1])),t=[0,100]);const d=o({...this.options,keyframes:t});s==="mirror"&&(u=o({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=QK(d));const{calculatedDuration:f}=d,h=f+r,p=h*(i+1)-r;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:i}=this;if(!i){const{keyframes:T}=this.options;return{done:!0,value:T[T.length-1]}}const{finalKeyframe:r,generator:s,mirroredGenerator:a,mapPercentToKeyframes:o,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=i;if(this.startTime===null)return s.next(0);const{delay:h,repeat:p,repeatType:g,repeatDelay:b,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const O=this.currentTime-h*(this.speed>=0?1:-1),v=this.speed>=0?O<0:O>d;this.currentTime=Math.max(O,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let x=this.currentTime,w=s;if(p){const T=Math.min(this.currentTime,d)/f;let A=Math.floor(T),N=T%1;!N&&T>=1&&(N=1),N===1&&A--,A=Math.min(A,p+1),!!(A%2)&&(g==="reverse"?(N=1-N,b&&(N-=b/f)):g==="mirror"&&(w=a)),x=Zu(0,1,N)*f}const E=v?{done:!1,value:c[0]}:w.next(x);o&&(E.value=o(E.value));let{done:S}=E;!v&&u!==null&&(S=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return k&&r!==void 0&&(E.value=g_(c,this.options,r)),y&&y(E.value),k&&this.finish(),E}get duration(){const{resolved:t}=this;return t?Qu(t.calculatedDuration):0}get time(){return Qu(this.currentTime)}set time(t){t=$u(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Qu(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=E1e,onPlay:n,startTime:i}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),n&&n();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=r):this.startTime=i??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const _1e=new Set(["opacity","clipPath","filter","transform"]);function A1e(e,t,n,{delay:i=0,duration:r=300,repeat:s=0,repeatType:a="loop",ease:o="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=mK(o,r);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:a==="reverse"?"alternate":"normal"})}const N1e=kD(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),fk=10,C1e=2e4;function j1e(e){return TD(e.type)||e.type==="spring"||!pK(e.ease)}function R1e(e,t){const n=new MD({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:e[0]};const r=[];let s=0;for(;!i.done&&s this.onKeyframesResolved(a,o),n,i,r),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:i=300,times:r,ease:s,type:a,motionValue:o,name:c,startTime:u}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof s=="string"&&ck()&&I1e(s)&&(s=XK[s]),j1e(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:g,...b}=this.options,y=R1e(t,b);t=y.keyframes,t.length===1&&(t[1]=t[0]),i=y.duration,r=y.times,s=y.ease,a="keyframes"}const d=A1e(o.owner.current,c,t,{...this.options,duration:i,times:r,ease:s});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(e8(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;o.set(g_(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:i,times:r,type:a,ease:s,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Qu(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Qu(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=$u(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return ko;const{animation:i}=n;e8(i,t)}return ko}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:i,duration:r,type:s,ease:a,times:o}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,g=new MD({...p,keyframes:i,duration:r,type:s,ease:a,times:o,isGenerator:!0}),b=$u(this.time);u.setWithVelocity(g.sample(b-fk).value,g.sample(b).value,fk)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:i,repeatDelay:r,repeatType:s,damping:a,type:o}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return N1e()&&i&&_1e.has(i)&&!c&&!u&&!r&&s!=="mirror"&&a!==0&&o!=="inertia"}}const P1e={type:"spring",stiffness:500,damping:25,restSpeed:10},M1e=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),L1e={type:"keyframes",duration:.8},D1e={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},$1e=(e,{keyframes:t})=>t.length>2?L1e:zp.has(e)?e.startsWith("scale")?M1e(t[1]):P1e:D1e;function Q1e({when:e,delay:t,delayChildren:n,staggerChildren:i,staggerDirection:r,repeat:s,repeatType:a,repeatDelay:o,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const LD=(e,t,n,i={},r,s)=>a=>{const o=vD(i,e)||{},c=o.delay||i.delay||0;let{elapsed:u=0}=i;u=u-$u(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-u,onUpdate:h=>{t.set(h),o.onUpdate&&o.onUpdate(h)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:s?void 0:r};Q1e(o)||(d={...d,...$1e(e,d)}),d.duration&&(d.duration=$u(d.duration)),d.repeatDelay&&(d.repeatDelay=$u(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!s&&t.get()!==void 0){const h=g_(d.keyframes,o);if(h!==void 0)return er.update(()=>{d.onUpdate(h),d.onComplete()}),new bxe([])}return!s&&f8.supports(d)?new f8(d):new MD(d)};function B1e({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,i}function qK(e,t,{delay:n=0,transitionOverride:i,type:r}={}){var s;let{transition:a=e.getDefaultTransition(),transitionEnd:o,...c}=t;i&&(a=i);const u=[],d=r&&e.animationState&&e.animationState.getState()[r];for(const f in c){const h=e.getValue(f,(s=e.latestValues[f])!==null&&s!==void 0?s:null),p=c[f];if(p===void 0||d&&B1e(d,f))continue;const g={delay:n,...vD(a||{},f)};let b=!1;if(window.MotionHandoffAnimation){const O=fK(e);if(O){const v=window.MotionHandoffAnimation(O,f,er);v!==null&&(g.startTime=v,b=!0)}}UI(e,f),h.start(LD(f,h,p,e.shouldReduceMotion&&uK.has(f)?{type:!1}:g,e,b));const y=h.animation;y&&u.push(y)}return o&&Promise.all(u).then(()=>{er.update(()=>{o&&hxe(e,o)})}),u}function WI(e,t,n={}){var i;const r=m_(e,t,n.type==="exit"?(i=e.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const a=r?()=>Promise.all(qK(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=s;return U1e(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=s;if(c){const[u,d]=c==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(n.delay)])}function U1e(e,t,n=0,i=0,r=1,s){const a=[],o=(e.variantChildren.size-1)*i,c=r===1?(u=0)=>u*i:(u=0)=>o-u*i;return Array.from(e.variantChildren).sort(z1e).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(WI(u,t,{...s,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function z1e(e,t){return e.sortNodePosition(t)}function F1e(e,t,n={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const r=t.map(s=>WI(e,s,n));i=Promise.all(r)}else if(typeof t=="string")i=WI(e,t,n);else{const r=typeof t=="function"?m_(e,t,n.custom):t;i=Promise.all(qK(e,r,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}const V1e=cD.length;function HK(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?HK(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n Promise.all(t.map(({animation:n,options:i})=>F1e(e,n,i)))}function Y1e(e){let t=H1e(e),n=h8(),i=!0;const r=c=>(u,d)=>{var f;const h=m_(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:g,...b}=h;u={...u,...b,...g}}return u};function s(c){t=c(e)}function a(c){const{props:u}=e,d=HK(e.parent)||{},f=[],h=new Set;let p={},g=1/0;for(let y=0;y g&&w,A=!1;const N=Array.isArray(x)?x:[x];let j=N.reduce(r(O),{});E===!1&&(j={});const{prevResolvedValues:M={}}=v,D={...M,...j},L=I=>{T=!0,h.has(I)&&(A=!0,h.delete(I)),v.needsAnimating[I]=!0;const U=e.getValue(I);U&&(U.liveStyle=!1)};for(const I in D){const U=j[I],B=M[I];if(p.hasOwnProperty(I))continue;let P=!1;BI(U)&&BI(B)?P=!cK(U,B):P=U!==B,P?U!=null?L(I):h.add(I):U!==void 0&&h.has(I)?L(I):v.protectedKeys[I]=!0}v.prevProp=x,v.prevResolvedValues=j,v.isActive&&(p={...p,...j}),i&&e.blockInitialAnimation&&(T=!1),T&&(!(S&&k)||A)&&f.push(...N.map(I=>({animation:I,options:{type:O}})))}if(h.size){const y={};h.forEach(O=>{const v=e.getBaseTarget(O),x=e.getValue(O);x&&(x.liveStyle=!0),y[O]=v??null}),f.push({animation:y})}let b=!!f.length;return i&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),i=!1,b?t(f):Promise.resolve()}function o(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:o,setAnimateFunction:s,getState:()=>n,reset:()=>{n=h8(),i=!0}}}function G1e(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!cK(t,e):!1}function mh(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function h8(){return{animate:mh(!0),whileInView:mh(),whileHover:mh(),whileTap:mh(),whileDrag:mh(),whileFocus:mh(),exit:mh()}}class eh{constructor(t){this.isMounted=!1,this.node=t}update(){}}class W1e extends eh{constructor(t){super(t),t.animationState||(t.animationState=Y1e(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();h_(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let Z1e=0;class K1e extends eh{constructor(){super(...arguments),this.id=Z1e++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const J1e={animation:{Feature:W1e},exit:{Feature:K1e}},El={x:!1,y:!1};function YK(){return El.x||El.y}function eve(e){return e==="x"||e==="y"?El[e]?null:(El[e]=!0,()=>{El[e]=!1}):El.x||El.y?null:(El.x=El.y=!0,()=>{El.x=El.y=!1})}const DD=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function cx(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n)}function C1(e){return{point:{x:e.pageX,y:e.pageY}}}const tve=e=>t=>DD(t)&&e(t,C1(t));function hy(e,t,n,i){return cx(e,t,tve(n),i)}const p8=(e,t)=>Math.abs(e-t);function nve(e,t){const n=p8(e.x,t.x),i=p8(e.y,t.y);return Math.sqrt(n**2+i**2)}class GK{constructor(t,n,{transformPagePoint:i,contextWindow:r,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=MN(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=nve(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:g}=f,{timestamp:b}=_s;this.history.push({...g,timestamp:b});const{onStart:y,onMove:O}=this.handlers;h||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),O&&O(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=PN(h,this.transformPagePoint),er.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:g,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=MN(f.type==="pointercancel"?this.lastMoveEventInfo:PN(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,y),g&&g(f,y)},!DD(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=i,this.contextWindow=r||window;const a=C1(t),o=PN(a,this.transformPagePoint),{point:c}=o,{timestamp:u}=_s;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,MN(o,this.history)),this.removeListeners=N1(hy(this.contextWindow,"pointermove",this.handlePointerMove),hy(this.contextWindow,"pointerup",this.handlePointerUp),hy(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Pf(this.updatePoint)}}function PN(e,t){return t?{point:t(e.point)}:e}function m8(e,t){return{x:e.x-t.x,y:e.y-t.y}}function MN({point:e},t){return{point:e,delta:m8(e,WK(t)),offset:m8(e,ive(t)),velocity:rve(t,.1)}}function ive(e){return e[0]}function WK(e){return e[e.length-1]}function rve(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const r=WK(e);for(;n>=0&&(i=e[n],!(r.timestamp-i.timestamp>$u(t)));)n--;if(!i)return{x:0,y:0};const s=Qu(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const a={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const ZK=1e-4,sve=1-ZK,ave=1+ZK,KK=.01,ove=0-KK,lve=0+KK;function Co(e){return e.max-e.min}function cve(e,t,n){return Math.abs(e-t)<=n}function g8(e,t,n,i=.5){e.origin=i,e.originPoint=gr(t.min,t.max,e.origin),e.scale=Co(n)/Co(t),e.translate=gr(n.min,n.max,e.origin)-e.originPoint,(e.scale>=sve&&e.scale<=ave||isNaN(e.scale))&&(e.scale=1),(e.translate>=ove&&e.translate<=lve||isNaN(e.translate))&&(e.translate=0)}function py(e,t,n,i){g8(e.x,t.x,n.x,i?i.originX:void 0),g8(e.y,t.y,n.y,i?i.originY:void 0)}function b8(e,t,n){e.min=n.min+t.min,e.max=e.min+Co(t)}function uve(e,t,n){b8(e.x,t.x,n.x),b8(e.y,t.y,n.y)}function O8(e,t,n){e.min=t.min-n.min,e.max=e.min+Co(t)}function my(e,t,n){O8(e.x,t.x,n.x),O8(e.y,t.y,n.y)}function dve(e,{min:t,max:n},i){return t!==void 0&&e n&&(e=i?gr(n,e,i.max):Math.min(e,n)),e}function y8(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function fve(e,{top:t,left:n,bottom:i,right:r}){return{x:y8(e.x,n,r),y:y8(e.y,t,i)}}function x8(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.min i?n=o0(t.min,t.max-i,e.min):i>r&&(n=o0(e.min,e.max-r,t.min)),Zu(0,1,n)}function mve(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ZI=.35;function gve(e=ZI){return e===!1?e=0:e===!0&&(e=ZI),{x:v8(e,"left","right"),y:v8(e,"top","bottom")}}function v8(e,t,n){return{min:w8(e,t),max:w8(e,n)}}function w8(e,t){return typeof e=="number"?e:e[t]||0}const S8=()=>({translate:0,scale:1,origin:0,originPoint:0}),sg=()=>({x:S8(),y:S8()}),E8=()=>({min:0,max:0}),jr=()=>({x:E8(),y:E8()});function Qo(e){return[e("x"),e("y")]}function JK({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function bve({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ove(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function LN(e){return e===void 0||e===1}function KI({scale:e,scaleX:t,scaleY:n}){return!LN(e)||!LN(t)||!LN(n)}function Ah(e){return KI(e)||eJ(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function eJ(e){return k8(e.x)||k8(e.y)}function k8(e){return e&&e!=="0%"}function hk(e,t,n){const i=e-n,r=t*i;return n+r}function T8(e,t,n,i,r){return r!==void 0&&(e=hk(e,r,i)),hk(e,n,i)+t}function JI(e,t=0,n=1,i,r){e.min=T8(e.min,t,n,i,r),e.max=T8(e.max,t,n,i,r)}function tJ(e,{x:t,y:n}){JI(e.x,t.translate,t.scale,t.originPoint),JI(e.y,n.translate,n.scale,n.originPoint)}const _8=.999999999999,A8=1.0000000000001;function yve(e,t,n,i=!1){const r=n.length;if(!r)return;t.x=t.y=1;let s,a;for(let o=0;o _8&&(t.x=1),t.y _8&&(t.y=1)}function ag(e,t){e.min=e.min+t,e.max=e.max+t}function N8(e,t,n,i,r=.5){const s=gr(e.min,e.max,r);JI(e,t,n,s,i)}function og(e,t){N8(e.x,t.x,t.scaleX,t.scale,t.originX),N8(e.y,t.y,t.scaleY,t.scale,t.originY)}function nJ(e,t){return JK(Ove(e.getBoundingClientRect(),t))}function xve(e,t,n){const i=nJ(e,n),{scroll:r}=t;return r&&(ag(i.x,r.offset.x),ag(i.y,r.offset.y)),i}const iJ=({current:e})=>e?e.ownerDocument.defaultView:null,vve=new WeakMap;class wve{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=jr(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const r=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(C1(d).point)},s=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:g}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=eve(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Qo(y=>{let O=this.getAxisMotionValue(y).get()||0;if(Mc.test(O)){const{projection:v}=this.visualElement;if(v&&v.layout){const x=v.layout.layoutBox[y];x&&(O=Co(x)*(parseFloat(O)/100))}}this.originPoint[y]=O}),g&&er.postRender(()=>g(d,f)),UI(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:g,onDrag:b}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:y}=f;if(p&&this.currentDirection===null){this.currentDirection=Sve(y),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),b&&b(d,f)},o=(d,f)=>this.stop(d,f),c=()=>Qo(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new GK(t,{onSessionStart:r,onStart:s,onMove:a,onSessionEnd:o,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:iJ(this.visualElement)})}stop(t,n){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:r}=n;this.startAnimation(r);const{onDragEnd:s}=this.getProps();s&&er.postRender(()=>s(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,i){const{drag:r}=this.getProps();if(!i||!iw(t,r,this.currentDirection))return;const s=this.getAxisMotionValue(t);let a=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(a=dve(a,this.constraints[t],this.elastic[t])),s.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:i}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,s=this.constraints;n&&ig(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&r?this.constraints=fve(r.layoutBox,n):this.constraints=!1,this.elastic=gve(i),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Qo(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=mve(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!ig(t))return!1;const i=t.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=xve(i,r.root,this.visualElement.getTransformPagePoint());let a=hve(r.layout.layoutBox,s);if(n){const o=n(bve(a));this.hasMutatedConstraints=!!o,o&&(a=JK(o))}return a}startAnimation(t){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),c=this.constraints||{},u=Qo(d=>{if(!iw(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=r?200:1e6,p=r?40:1e7,g={type:"inertia",velocity:i?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(o)}startAxisValueAnimation(t,n){const i=this.getAxisMotionValue(t);return UI(this.visualElement,t),i.start(LD(t,i,0,n,this.visualElement,!1))}stopAnimation(){Qo(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Qo(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),r=i[n];return r||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){Qo(n=>{const{drag:i}=this.getProps();if(!iw(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:a,max:o}=r.layout.layoutBox[n];s.set(t[n]-gr(a,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!ig(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Qo(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const c=o.get();r[a]=pve({min:c,max:c},this.constraints[a])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Qo(a=>{if(!iw(a,t,null))return;const o=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];o.set(gr(c,u,r[a]))})}addListeners(){if(!this.visualElement.current)return;vve.set(this.visualElement,this);const t=this.visualElement.current,n=hy(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),i=()=>{const{dragConstraints:c}=this.getProps();ig(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,s=r.addEventListener("measure",i);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),er.read(i);const a=cx(window,"resize",()=>this.scalePositionWithinConstraints()),o=r.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Qo(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),s(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:a=ZI,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:a,dragMomentum:o}}}function iw(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Sve(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class Eve extends eh{constructor(t){super(t),this.removeGroupControls=ko,this.removeListeners=ko,this.controls=new wve(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ko}unmount(){this.removeGroupControls(),this.removeListeners()}}const C8=e=>(t,n)=>{e&&er.postRender(()=>e(t,n))};class kve extends eh{constructor(){super(...arguments),this.removePointerDownListener=ko}onPointerDown(t){this.session=new GK(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:iJ(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:C8(t),onStart:C8(n),onMove:i,onEnd:(s,a)=>{delete this.session,r&&er.postRender(()=>r(s,a))}}}mount(){this.removePointerDownListener=hy(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const BS={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function j8(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Jb={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Gt.test(e))e=parseFloat(e);else return e;const n=j8(e,t.target.x),i=j8(e,t.target.y);return`${n}% ${i}%`}},Tve={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,r=Mf.parse(e);if(r.length>5)return i;const s=Mf.createTransformer(e),a=typeof r[0]!="number"?1:0,o=n.x.scale*t.x,c=n.y.scale*t.y;r[0+a]/=o,r[1+a]/=c;const u=gr(o,c,.5);return typeof r[2+a]=="number"&&(r[2+a]/=u),typeof r[3+a]=="number"&&(r[3+a]/=u),s(r)}};class _ve extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=t;Jye(Ave),s&&(n.group&&n.group.add(s),i&&i.register&&r&&i.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),BS.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:i,drag:r,isPresent:s}=this.props,a=i.projection;return a&&(a.isPresent=s,r||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?a.promote():a.relegate()||er.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),dD.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=t;r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function rJ(e){const[t,n]=UZ(),i=m.useContext(aD);return l.jsx(_ve,{...e,layoutGroup:i,switchLayoutGroup:m.useContext(WZ),isPresent:t,safeToRemove:n})}const Ave={borderRadius:{...Jb,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Jb,borderTopRightRadius:Jb,borderBottomLeftRadius:Jb,borderBottomRightRadius:Jb,boxShadow:Tve};function Nve(e,t,n){const i=Zs(e)?e:ox(e);return i.start(LD("",i,t,n)),i.animation}function Cve(e){return e instanceof SVGElement&&e.tagName!=="svg"}const jve=(e,t)=>e.depth-t.depth;class Rve{constructor(){this.children=[],this.isDirty=!1}add(t){wD(this.children,t),this.isDirty=!0}remove(t){SD(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(jve),this.isDirty=!1,this.children.forEach(t)}}function Ive(e,t){const n=Lc.now(),i=({timestamp:r})=>{const s=r-n;s>=t&&(Pf(i),e(s-t))};return er.read(i,!0),()=>Pf(i)}const sJ=["TopLeft","TopRight","BottomLeft","BottomRight"],Pve=sJ.length,R8=e=>typeof e=="string"?parseFloat(e):e,I8=e=>typeof e=="number"||Gt.test(e);function Mve(e,t,n,i,r,s){r?(e.opacity=gr(0,n.opacity!==void 0?n.opacity:1,Lve(i)),e.opacityExit=gr(t.opacity!==void 0?t.opacity:1,0,Dve(i))):s&&(e.opacity=gr(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,i));for(let a=0;a i t?1:n(o0(e,t,i))}function M8(e,t){e.min=t.min,e.max=t.max}function $o(e,t){M8(e.x,t.x),M8(e.y,t.y)}function L8(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function D8(e,t,n,i,r){return e-=t,e=hk(e,1/n,i),r!==void 0&&(e=hk(e,1/r,i)),e}function $ve(e,t=0,n=1,i=.5,r,s=e,a=e){if(Mc.test(t)&&(t=parseFloat(t),t=gr(a.min,a.max,t/100)-a.min),typeof t!="number")return;let o=gr(s.min,s.max,i);e===s&&(o-=t),e.min=D8(e.min,t,n,o,r),e.max=D8(e.max,t,n,o,r)}function $8(e,t,[n,i,r],s,a){$ve(e,t[n],t[i],t[r],t.scale,s,a)}const Qve=["x","scaleX","originX"],Bve=["y","scaleY","originY"];function Q8(e,t,n,i){$8(e.x,t,Qve,n?n.x:void 0,i?i.x:void 0),$8(e.y,t,Bve,n?n.y:void 0,i?i.y:void 0)}function B8(e){return e.translate===0&&e.scale===1}function oJ(e){return B8(e.x)&&B8(e.y)}function U8(e,t){return e.min===t.min&&e.max===t.max}function Uve(e,t){return U8(e.x,t.x)&&U8(e.y,t.y)}function z8(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function lJ(e,t){return z8(e.x,t.x)&&z8(e.y,t.y)}function F8(e){return Co(e.x)/Co(e.y)}function V8(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class zve{constructor(){this.members=[]}add(t){wD(this.members,t),t.scheduleRender()}remove(t){if(SD(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(r=>t===r);if(n===0)return!1;let i;for(let r=n;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1){i=s;break}}return i?(this.promote(i),!0):!1}promote(t,n){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,n&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;r===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:i}=t;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Fve(e,t,n){let i="";const r=e.x.translate/t.x,s=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((r||s||a)&&(i=`translate3d(${r}px, ${s}px, ${a}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:g}=n;u&&(i=`perspective(${u}px) ${i}`),d&&(i+=`rotate(${d}deg) `),f&&(i+=`rotateX(${f}deg) `),h&&(i+=`rotateY(${h}deg) `),p&&(i+=`skewX(${p}deg) `),g&&(i+=`skewY(${g}deg) `)}const o=e.x.scale*t.x,c=e.y.scale*t.y;return(o!==1||c!==1)&&(i+=`scale(${o}, ${c})`),i||"none"}const Nh={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},PO=typeof window<"u"&&window.MotionDebug!==void 0,DN=["","X","Y","Z"],Vve={visibility:"hidden"},X8=1e3;let Xve=0;function $N(e,t,n,i){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),i&&(i[e]=0))}function cJ(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=fK(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",er,!(r||s))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&cJ(i)}function uJ({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(a={},o=t==null?void 0:t()){this.id=Xve++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,PO&&(Nh.totalNodes=Nh.resolvedTargetDeltas=Nh.recalculatedProjection=0),this.nodes.forEach(Yve),this.nodes.forEach(Jve),this.nodes.forEach(ewe),this.nodes.forEach(Gve),PO&&window.MotionDebug.record(Nh)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let c=0;c this.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=Ive(h,250),BS.hasAnimatedSinceResize&&(BS.hasAnimatedSinceResize=!1,this.nodes.forEach(H8))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||swe,{onLayoutAnimationStart:y,onLayoutAnimationComplete:O}=d.getProps(),v=!this.targetLayout||!lJ(this.targetLayout,g)||p,x=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||x||h&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,x);const w={...vD(b,"layout"),onPlay:y,onComplete:O};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||H8(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Pf(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(twe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&cJ(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d {this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c {const E=w/1e3;Y8(f.x,a.x,E),Y8(f.y,a.y,E),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(my(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),iwe(this.relativeTarget,this.relativeTargetOrigin,h,E),x&&Uve(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=jr()),$o(x,this.relativeTarget)),b&&(this.animationValues=d,Mve(d,u,this.latestValues,E,v,O)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Pf(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=er.update(()=>{BS.hasAnimatedSinceResize=!0,this.currentAnimation=Nve(0,X8,{...a,onUpdate:o=>{this.mixTargetDelta(o),a.onUpdate&&a.onUpdate(o)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(X8),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:c,layout:u,latestValues:d}=a;if(!(!o||!c||!u)){if(this!==a&&this.layout&&u&&dJ(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||jr();const f=Co(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=Co(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}$o(o,c),og(o,d),py(this.projectionDeltaWithTransform,this.layoutCorrected,o,d)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new zve),this.sharedNodes.get(a).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(o=!0),!o)return;const u={};c.z&&$N("z",a,u,this.animationValues);for(let d=0;d {var o;return(o=a.currentAnimation)===null||o===void 0?void 0:o.stop()}),this.root.nodes.forEach(q8),this.root.sharedNodes.clear()}}}function qve(e){e.updateLayout()}function Hve(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:r}=e.layout,{animationType:s}=e.options,a=n.source!==e.layout.source;s==="size"?Qo(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Co(h);h.min=i[f].min,h.max=h.min+p}):dJ(s,n.layoutBox,i)&&Qo(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Co(i[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const o=sg();py(o,i,n.layoutBox);const c=sg();a?py(c,e.applyTransform(r,!0),n.measuredBox):py(c,i,n.layoutBox);const u=!oJ(o);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const g=jr();my(g,n.layoutBox,h.layoutBox);const b=jr();my(b,i,p.layoutBox),lJ(g,b)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=g,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:c,layoutDelta:o,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:i}=e.options;i&&i()}e.options.transition=void 0}function Yve(e){PO&&Nh.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Gve(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Wve(e){e.clearSnapshot()}function q8(e){e.clearMeasurements()}function Zve(e){e.isLayoutDirty=!1}function Kve(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function H8(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Jve(e){e.resolveTargetDelta()}function ewe(e){e.calcProjection()}function twe(e){e.resetSkewAndRotation()}function nwe(e){e.removeLeadSnapshot()}function Y8(e,t,n){e.translate=gr(t.translate,0,n),e.scale=gr(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function G8(e,t,n,i){e.min=gr(t.min,n.min,i),e.max=gr(t.max,n.max,i)}function iwe(e,t,n,i){G8(e.x,t.x,n.x,i),G8(e.y,t.y,n.y,i)}function rwe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const swe={duration:.45,ease:[.4,0,.1,1]},W8=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Z8=W8("applewebkit/")&&!W8("chrome/")?Math.round:ko;function K8(e){e.min=Z8(e.min),e.max=Z8(e.max)}function awe(e){K8(e.x),K8(e.y)}function dJ(e,t,n){return e==="position"||e==="preserve-aspect"&&!cve(F8(t),F8(n),.2)}function owe(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const lwe=uJ({attachResizeListener:(e,t)=>cx(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),QN={current:void 0},fJ=uJ({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!QN.current){const e=new lwe({});e.mount(window),e.setOptions({layoutScroll:!0}),QN.current=e}return QN.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),cwe={pan:{Feature:kve},drag:{Feature:Eve,ProjectionNode:fJ,MeasureLayout:rJ}};function uwe(e,t,n){var i;if(e instanceof Element)return[e];if(typeof e=="string"){let r=document;const s=(i=void 0)!==null&&i!==void 0?i:r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}function hJ(e,t){const n=uwe(e),i=new AbortController,r={passive:!0,...t,signal:i.signal};return[n,r,()=>i.abort()]}function J8(e){return t=>{t.pointerType==="touch"||YK()||e(t)}}function dwe(e,t,n={}){const[i,r,s]=hJ(e,n),a=J8(o=>{const{target:c}=o,u=t(o);if(typeof u!="function"||!c)return;const d=J8(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,r)});return i.forEach(o=>{o.addEventListener("pointerenter",a,r)}),s}function e9(e,t,n){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=i[r];s&&er.postRender(()=>s(t,C1(t)))}class fwe extends eh{mount(){const{current:t}=this.node;t&&(this.unmount=dwe(t,n=>(e9(this.node,n,"Start"),i=>e9(this.node,i,"End"))))}unmount(){}}class hwe extends eh{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=N1(cx(this.node.current,"focus",()=>this.onFocus()),cx(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const pJ=(e,t)=>t?e===t?!0:pJ(e,t.parentElement):!1,pwe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function mwe(e){return pwe.has(e.tagName)||e.tabIndex!==-1}const MO=new WeakSet;function t9(e){return t=>{t.key==="Enter"&&e(t)}}function BN(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const gwe=(e,t)=>{const n=e.currentTarget;if(!n)return;const i=t9(()=>{if(MO.has(n))return;BN(n,"down");const r=t9(()=>{BN(n,"up")}),s=()=>BN(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)};function n9(e){return DD(e)&&!YK()}function bwe(e,t,n={}){const[i,r,s]=hJ(e,n),a=o=>{const c=o.currentTarget;if(!n9(o)||MO.has(c))return;MO.add(c);const u=t(o),d=(p,g)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!n9(p)||!MO.has(c))&&(MO.delete(c),typeof u=="function"&&u(p,{success:g}))},f=p=>{d(p,n.useGlobalTarget||pJ(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,r),window.addEventListener("pointercancel",h,r)};return i.forEach(o=>{!mwe(o)&&o.getAttribute("tabindex")===null&&(o.tabIndex=0),(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,r),o.addEventListener("focus",u=>gwe(u,r),r)}),s}function i9(e,t,n){const{props:i}=e;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=i[r];s&&er.postRender(()=>s(t,C1(t)))}class Owe extends eh{mount(){const{current:t}=this.node;t&&(this.unmount=bwe(t,n=>(i9(this.node,n,"Start"),(i,{success:r})=>i9(this.node,i,r?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const eP=new WeakMap,UN=new WeakMap,ywe=e=>{const t=eP.get(e.target);t&&t(e)},xwe=e=>{e.forEach(ywe)};function vwe({root:e,...t}){const n=e||document;UN.has(n)||UN.set(n,{});const i=UN.get(n),r=JSON.stringify(t);return i[r]||(i[r]=new IntersectionObserver(xwe,{root:e,...t})),i[r]}function wwe(e,t,n){const i=vwe(t);return eP.set(e,n),i.observe(e),()=>{eP.delete(e),i.unobserve(e)}}const Swe={some:0,all:1};class Ewe extends eh{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:s}=t,a={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:Swe[r]},o=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return wwe(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(kwe(t,n))&&this.startObserver()}unmount(){}}function kwe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Twe={inView:{Feature:Ewe},tap:{Feature:Owe},focus:{Feature:hwe},hover:{Feature:fwe}},_we={layout:{ProjectionNode:fJ,MeasureLayout:rJ}},pk={current:null},$D={current:!1};function mJ(){if($D.current=!0,!!oD)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>pk.current=e.matches;e.addListener(t),t()}else pk.current=!1}const Awe=[...LK,Hs,Mf],Nwe=e=>Awe.find(MK(e)),r9=new WeakMap;function Cwe(e,t,n){for(const i in t){const r=t[i],s=n[i];if(Zs(r))e.addValue(i,r);else if(Zs(s))e.addValue(i,ox(r,{owner:e}));else if(s!==r)if(e.hasValue(i)){const a=e.getValue(i);a.liveStyle===!0?a.jump(r):a.hasAnimated||a.set(r)}else{const a=e.getStaticValue(i);e.addValue(i,ox(a!==void 0?a:r,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const s9=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class jwe{scrapeMotionValuesFromProps(t,n,i){return{}}constructor({parent:t,props:n,presenceContext:i,reducedMotionConfig:r,blockInitialAnimation:s,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ID,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Lc.now();this.renderScheduledAt this.bindToMotionValue(i,n)),$D.current||mJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:pk.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){r9.delete(this.current),this.projection&&this.projection.unmount(),Pf(this.notifyUpdate),Pf(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const i=zp.has(t),r=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&er.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),s(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in a0){const n=a0[t];if(!n)continue;const{isEnabled:i,Feature:r}=n;if(!this.features[t]&&r&&i(this.props)&&(this.features[t]=new r(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):jr()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i
n.variantChildren.delete(t)}addValue(t,n){const i=this.values.get(t);n!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&n!==void 0&&(i=ox(n===null?void 0:n,{owner:this}),this.addValue(t,i)),i}readValue(t,n){var i;let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(i=this.getBaseTargetFromProps(this.props,t))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(IK(r)||EK(r))?r=parseFloat(r):!Nwe(r)&&Mf.test(n)&&(r=CK(t,n)),this.setBaseTarget(t,Zs(r)?r.get():r)),Zs(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:i}=this.props;let r;if(typeof i=="string"||typeof i=="object"){const a=hD(this.props,i,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(r=a[t])}if(i&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Zs(s)?s:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new ED),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class gJ extends jwe{constructor(){super(...arguments),this.KeyframeResolver=DK}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:i}){delete n[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Zs(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Rwe(e){return window.getComputedStyle(e)}class Iwe extends gJ{constructor(){super(...arguments),this.type="html",this.renderInstance=iK}readValueFromInstance(t,n){if(zp.has(n)){const i=RD(n);return i&&i.default||0}else{const i=Rwe(t),r=(eK(n)?i.getPropertyValue(n):i[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(t,{transformPagePoint:n}){return nJ(t,n)}build(t,n,i){gD(t,n,i.transformTemplate)}scrapeMotionValuesFromProps(t,n,i){return xD(t,n,i)}}class Pwe extends gJ{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=jr}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(zp.has(n)){const i=RD(n);return i&&i.default||0}return n=rK.has(n)?n:uD(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,i){return oK(t,n,i)}build(t,n,i){bD(t,n,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,i,r){sK(t,n,i,r)}mount(t){this.isSVGTag=yD(t.tagName),super.mount(t)}}const Mwe=(e,t)=>fD(e)?new Pwe(t):new Iwe(t,{allowProjection:e!==m.Fragment}),Lwe=lxe({...J1e,...Twe,...cwe,..._we},Mwe),Er=Sye(Lwe);function Dwe(){!$D.current&&mJ();const[e]=m.useState(pk.current);return e}function ss(){return ss=Object.assign?Object.assign.bind():function(e){for(var t=1;t "u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?m.useEffect:m.useLayoutEffect;function Pm(e,t,n){var i=m.useRef(t);i.current=t,m.useEffect(function(){function r(s){i.current(s)}return e&&window.addEventListener(e,r,n),function(){e&&window.removeEventListener(e,r)}},[e])}var $we=["container"];function Qwe(e){var t=e.container,n=t===void 0?document.body:t,i=b_(e,$we);return $i.createPortal(xn.createElement("div",ss({},i)),n)}function Bwe(e){return xn.createElement("svg",ss({width:"44",height:"44",viewBox:"0 0 768 768"},e),xn.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function Uwe(e){return xn.createElement("svg",ss({width:"44",height:"44",viewBox:"0 0 768 768"},e),xn.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function zwe(e){return xn.createElement("svg",ss({width:"44",height:"44",viewBox:"0 0 768 768"},e),xn.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function Fwe(){return m.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function o9(e){var t=e.touches[0],n=t.clientX,i=t.clientY;if(e.touches.length>=2){var r=e.touches[1],s=r.clientX,a=r.clientY;return[(n+s)/2,(i+a)/2,Math.sqrt(Math.pow(s-n,2)+Math.pow(a-i,2))]}return[n,i,0]}var qd=function(e,t,n,i){var r,s=n*t,a=(s-i)/2,o=e;return s<=i?(r=1,o=0):e>0&&a-e<=0?(r=2,o=a):e<0&&a+e<=0&&(r=3,o=-a),[r,o]};function zN(e,t,n,i,r,s,a,o,c,u){a===void 0&&(a=innerWidth/2),o===void 0&&(o=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=qd(e,s,n,innerWidth)[0],f=qd(t,s,i,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-s/r*(a-(h+e))-h+(i/n>=3&&n*s===innerWidth?0:d?c/2:c),y:o-s/r*(o-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:o}}function iP(e,t,n){var i=e%180!=0;return i?[n,t,i]:[t,n,i]}function FN(e,t,n){var i=iP(n,innerWidth,innerHeight),r=i[0],s=i[1],a=0,o=r,c=s,u=e/t*s,d=t/e*r;return e =s?o=u:e>=r&&t r/s?c=d:t/e>=3&&!i[2]?a=((c=d)-s)/2:o=u,{width:o,height:c,x:0,y:a,pause:!0}}function sw(e,t){var n=t.leading,i=n!==void 0&&n,r=t.maxWait,s=t.wait,a=s===void 0?r||0:s,o=m.useRef(e);o.current=e;var c=m.useRef(0),u=m.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=m.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function g(){c.current=p,d(),o.current.apply(null,h)}var b=c.current,y=p-b;if(b===0&&(i&&g(),c.current=p),r!==void 0){if(y>r)return void g()}else y=1&&s&&s())};d()}function d(){c=requestAnimationFrame(u)}}var Xwe={T:0,L:0,W:0,H:0,FIT:void 0},OJ=function(){var e=m.useRef(!1);return m.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},qwe=["className"];function Hwe(e){var t=e.className,n=t===void 0?"":t,i=b_(e,qwe);return xn.createElement("div",ss({className:"PhotoView__Spinner "+n},i),xn.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},xn.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),xn.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var Ywe=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function Gwe(e){var t=e.src,n=e.loaded,i=e.broken,r=e.className,s=e.onPhotoLoad,a=e.loadingElement,o=e.brokenElement,c=b_(e,Ywe),u=OJ();return t&&!i?xn.createElement(xn.Fragment,null,xn.createElement("img",ss({className:"PhotoView__Photo"+(r?" "+r:""),src:t,onLoad:function(d){var f=d.target;u.current&&s({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&s({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?xn.createElement("span",{className:"PhotoView__icon"},a):xn.createElement(Hwe,{className:"PhotoView__icon"}))):o?xn.createElement("span",{className:"PhotoView__icon"},typeof o=="function"?o({src:t}):o):null}var Wwe={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function Zwe(e){var t=e.item,n=t.src,i=t.render,r=t.width,s=r===void 0?0:r,a=t.height,o=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,g=e.style,b=e.loadingElement,y=e.brokenElement,O=e.onPhotoTap,v=e.onMaskTap,x=e.onReachMove,w=e.onReachUp,E=e.onPhotoResize,S=e.isActive,k=e.expose,T=mk(Wwe),A=T[0],N=T[1],j=m.useRef(0),M=OJ(),D=A.naturalWidth,L=D===void 0?s:D,Q=A.naturalHeight,C=Q===void 0?o:Q,I=A.width,U=I===void 0?s:I,B=A.height,P=B===void 0?o:B,q=A.loaded,G=q===void 0?!n:q,$=A.broken,V=A.x,te=A.y,fe=A.touched,Te=A.stopRaf,J=A.maskTouched,ne=A.rotate,ce=A.scale,Oe=A.CX,Se=A.CY,je=A.lastX,ve=A.lastY,be=A.lastCX,ae=A.lastCY,Re=A.lastScale,xe=A.touchTime,Be=A.touchLength,qe=A.pause,Pe=A.reach,mt=rp({onScale:function(Ne){return bt(rw(Ne))},onRotate:function(Ne){ne!==Ne&&(k({rotate:Ne}),N(ss({rotate:Ne},FN(L,C,Ne))))}});function bt(Ne,tt,St){ce!==Ne&&(k({scale:Ne}),N(ss({scale:Ne},zN(V,te,U,P,ce,Ne,tt,St),Ne<=1&&{x:0,y:0})))}var Dt=sw(function(Ne,tt,St){if(St===void 0&&(St=0),(fe||J)&&S){var Wt=iP(ne,U,P),Ve=Wt[0],vn=Wt[1];if(St===0&&j.current===0){var nn=Math.abs(Ne-Oe)<=20,Nt=Math.abs(tt-Se)<=20;if(nn&&Nt)return void N({lastCX:Ne,lastCY:tt});j.current=nn?tt>Se?3:2:1}var Ft,Ce=Ne-be,Ze=tt-ae;if(St===0){var kt=qd(Ce+je,ce,Ve,innerWidth)[0],Zt=qd(Ze+ve,ce,vn,innerHeight);Ft=function(hi,Ie,ut,Rt){return Ie&&hi===1||Rt==="x"?"x":ut&&hi>1||Rt==="y"?"y":void 0}(j.current,kt,Zt[0],Pe),Ft!==void 0&&x(Ft,Ne,tt,ce)}if(Ft==="x"||J)return void N({reach:"x"});var Kt=rw(ce+(St-Be)/100/2*ce,L/U,.2);k({scale:Kt}),N(ss({touchLength:St,reach:Ft,scale:Kt},zN(V,te,U,P,ce,Kt,Ne,tt,Ce,Ze)))}},{maxWait:8});function We(Ne){return!Te&&!fe&&(M.current&&N(ss({},Ne,{pause:u})),M.current)}var W,ee,se,he,F,_e,Ue,Xe,_t=(F=function(Ne){return We({x:Ne})},_e=function(Ne){return We({y:Ne})},Ue=function(Ne){return M.current&&(k({scale:Ne}),N({scale:Ne})),!fe&&M.current},Xe=rp({X:function(Ne){return F(Ne)},Y:function(Ne){return _e(Ne)},S:function(Ne){return Ue(Ne)}}),function(Ne,tt,St,Wt,Ve,vn,nn,Nt,Ft,Ce,Ze){var kt=iP(Ce,Ve,vn),Zt=kt[0],Kt=kt[1],hi=qd(Ne,Nt,Zt,innerWidth),Ie=hi[0],ut=hi[1],Rt=qd(tt,Nt,Kt,innerHeight),Ut=Rt[0],Sn=Rt[1],hn=Date.now()-Ze;if(hn>=200||Nt!==nn||Math.abs(Ft-nn)>1){var Si=zN(Ne,tt,Ve,vn,nn,Nt),bi=Si.x,Qi=Si.y,de=Ie?ut:bi!==Ne?bi:null,Me=Ut?Sn:Qi!==tt?Qi:null;return de!==null&&Mh(Ne,de,Xe.X),Me!==null&&Mh(tt,Me,Xe.Y),void(Nt!==nn&&Mh(nn,Nt,Xe.S))}var dt=(Ne-St)/hn,ft=(tt-Wt)/hn,on=Math.sqrt(Math.pow(dt,2)+Math.pow(ft,2)),Kn=!1,Ei=!1;(function(Jn,bn){var Yn,ri=Jn,qt=0,Oi=0,ln=function(Ar){Yn||(Yn=Ar);var Bi=Ar-Yn,Dn=Math.sign(Jn),Qs=-.001*Dn,Yi=Math.sign(-ri)*Math.pow(ri,2)*2e-4,Sa=ri*Bi+(Qs+Yi)*Math.pow(Bi,2)/2;qt+=Sa,Yn=Ar,Dn*(ri+=(Qs+Yi)*Bi)<=0?cn():bn(qt)?Ri():cn()};function Ri(){Oi=requestAnimationFrame(ln)}function cn(){cancelAnimationFrame(Oi)}Ri()})(on,function(Jn){var bn=Ne+Jn*(dt/on),Yn=tt+Jn*(ft/on),ri=qd(bn,nn,Zt,innerWidth),qt=ri[0],Oi=ri[1],ln=qd(Yn,nn,Kt,innerHeight),Ri=ln[0],cn=ln[1];if(qt&&!Kn&&(Kn=!0,Ie?Mh(bn,Oi,Xe.X):l9(Oi,bn+(bn-Oi),Xe.X)),Ri&&!Ei&&(Ei=!0,Ut?Mh(Yn,cn,Xe.Y):l9(cn,Yn+(Yn-cn),Xe.Y)),Kn&&Ei)return!1;var Ar=Kn||Xe.X(Oi),Bi=Ei||Xe.Y(cn);return Ar&&Bi})}),Bt=(W=O,ee=function(Ne,tt){Pe||bt(ce!==1?1:Math.max(2,L/U),Ne,tt)},se=m.useRef(0),he=sw(function(){se.current=0,W.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var Ne=[].slice.call(arguments);se.current+=1,he.apply(void 0,Ne),se.current>=2&&(he.cancel(),se.current=0,ee.apply(void 0,Ne))});function Et(Ne,tt){if(j.current=0,(fe||J)&&S){N({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var St=rw(ce,L/U);if(_t(V,te,je,ve,U,P,ce,St,Re,ne,xe),w(Ne,tt),Oe===Ne&&Se===tt){if(fe)return void Bt(Ne,tt);J&&v(Ne,tt)}}}function at(Ne,tt,St){St===void 0&&(St=0),N({touched:!0,CX:Ne,CY:tt,lastCX:Ne,lastCY:tt,lastX:V,lastY:te,lastScale:ce,touchLength:St,touchTime:Date.now()})}function pe(Ne){N({maskTouched:!0,CX:Ne.clientX,CY:Ne.clientY,lastX:V,lastY:te})}Pm(bu?void 0:"mousemove",function(Ne){Ne.preventDefault(),Dt(Ne.clientX,Ne.clientY)}),Pm(bu?void 0:"mouseup",function(Ne){Et(Ne.clientX,Ne.clientY)}),Pm(bu?"touchmove":void 0,function(Ne){Ne.preventDefault();var tt=o9(Ne);Dt.apply(void 0,tt)},{passive:!1}),Pm(bu?"touchend":void 0,function(Ne){var tt=Ne.changedTouches[0];Et(tt.clientX,tt.clientY)},{passive:!1}),Pm("resize",sw(function(){G&&!fe&&(N(FN(L,C,ne)),E())},{maxWait:8})),nP(function(){S&&k(ss({scale:ce,rotate:ne},mt))},[S]);var ct=function(Ne,tt,St,Wt,Ve,vn,nn,Nt,Ft,Ce){var Ze=function(bi,Qi,de,Me,dt){var ft=m.useRef(!1),on=mk({lead:!0,scale:de}),Kn=on[0],Ei=Kn.lead,Jn=Kn.scale,bn=on[1],Yn=sw(function(ri){try{return dt(!0),bn({lead:!1,scale:ri}),Promise.resolve()}catch(qt){return Promise.reject(qt)}},{wait:Me});return nP(function(){ft.current?(dt(!1),bn({lead:!0}),Yn(de)):ft.current=!0},[de]),Ei?[bi*Jn,Qi*Jn,de/Jn]:[bi*de,Qi*de,1]}(vn,nn,Nt,Ft,Ce),kt=Ze[0],Zt=Ze[1],Kt=Ze[2],hi=function(bi,Qi,de,Me,dt){var ft=m.useState(Xwe),on=ft[0],Kn=ft[1],Ei=m.useState(0),Jn=Ei[0],bn=Ei[1],Yn=m.useRef(),ri=rp({OK:function(){return bi&&bn(4)}});function qt(Oi){dt(!1),bn(Oi)}return m.useEffect(function(){if(Yn.current||(Yn.current=Date.now()),de){if(function(Oi,ln){var Ri=Oi&&Oi.current;if(Ri&&Ri.nodeType===1){var cn=Ri.getBoundingClientRect();ln({T:cn.top,L:cn.left,W:cn.width,H:cn.height,FIT:Ri.tagName==="IMG"?getComputedStyle(Ri).objectFit:void 0})}}(Qi,Kn),bi)return Date.now()-Yn.current<250?(bn(1),requestAnimationFrame(function(){bn(2),requestAnimationFrame(function(){return qt(3)})}),void setTimeout(ri.OK,Me)):void bn(4);qt(5)}},[bi,de]),[Jn,on]}(Ne,tt,St,Ft,Ce),Ie=hi[0],ut=hi[1],Rt=ut.W,Ut=ut.FIT,Sn=innerWidth/2,hn=innerHeight/2,Si=Ie<3||Ie>4;return[Si?Rt?ut.L:Sn:Wt+(Sn-vn*Nt/2),Si?Rt?ut.T:hn:Ve+(hn-nn*Nt/2),kt,Si&&Ut?kt*(ut.H/Rt):Zt,Ie===0?Kt:Si?Rt/(vn*Nt)||.01:Kt,Si?Ut?1:0:1,Ie,Ut]}(u,c,G,V,te,U,P,ce,d,function(Ne){return N({pause:Ne})}),et=ct[4],yt=ct[6],At="transform "+d+"ms "+f,$t={className:p,onMouseDown:bu?void 0:function(Ne){Ne.stopPropagation(),Ne.button===0&&at(Ne.clientX,Ne.clientY,0)},onTouchStart:bu?function(Ne){Ne.stopPropagation(),at.apply(void 0,o9(Ne))}:void 0,onWheel:function(Ne){if(!Pe){var tt=rw(ce-Ne.deltaY/100/2,L/U);N({stopRaf:!0}),bt(tt,Ne.clientX,Ne.clientY)}},style:{width:ct[2]+"px",height:ct[3]+"px",opacity:ct[5],objectFit:yt===4?void 0:ct[7],transform:ne?"rotate("+ne+"deg)":void 0,transition:yt>2?At+", opacity "+d+"ms ease, height "+(yt<4?d/2:yt>4?d:0)+"ms "+f:void 0}};return xn.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:g,onMouseDown:!bu&&S?pe:void 0,onTouchStart:bu&&S?function(Ne){return pe(Ne.touches[0])}:void 0},xn.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+et+", 0, 0, "+et+", "+ct[0]+", "+ct[1]+")",transition:fe||qe?void 0:At,willChange:S?"transform":void 0}},n?xn.createElement(Gwe,ss({src:n,loaded:G,broken:$},$t,{onPhotoLoad:function(Ne){N(ss({},Ne,Ne.loaded&&FN(Ne.naturalWidth||0,Ne.naturalHeight||0,ne)))},loadingElement:b,brokenElement:y})):i&&i({attrs:$t,scale:et,rotate:ne})))}var c9={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function Kwe(e){var t=e.loop,n=t===void 0?3:t,i=e.speed,r=e.easing,s=e.photoClosable,a=e.maskClosable,o=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,g=e.overlayRender,b=e.toolbarRender,y=e.className,O=e.maskClassName,v=e.photoClassName,x=e.photoWrapClassName,w=e.loadingElement,E=e.brokenElement,S=e.images,k=e.index,T=k===void 0?0:k,A=e.onIndexChange,N=e.visible,j=e.onClose,M=e.afterClose,D=e.portalContainer,L=mk(c9),Q=L[0],C=L[1],I=m.useState(0),U=I[0],B=I[1],P=Q.x,q=Q.touched,G=Q.pause,$=Q.lastCX,V=Q.lastCY,te=Q.bg,fe=te===void 0?u:te,Te=Q.lastBg,J=Q.overlay,ne=Q.minimal,ce=Q.scale,Oe=Q.rotate,Se=Q.onScale,je=Q.onRotate,ve=e.hasOwnProperty("index"),be=ve?T:U,ae=ve?A:B,Re=m.useRef(be),xe=S.length,Be=S[be],qe=typeof n=="boolean"?n:xe>n,Pe=function(et,yt){var At=m.useReducer(function(St){return!St},!1)[1],$t=m.useRef(0),Ne=function(St){var Wt=m.useRef(St);function Ve(vn){Wt.current=vn}return m.useMemo(function(){(function(vn){et?(vn(et),$t.current=1):$t.current=2})(Ve)},[St]),[Wt.current,Ve]}(et),tt=Ne[1];return[Ne[0],$t.current,function(){At(),$t.current===2&&(tt(!1),yt&&yt()),$t.current=0}]}(N,M),mt=Pe[0],bt=Pe[1],Dt=Pe[2];nP(function(){if(mt)return C({pause:!0,x:be*-(innerWidth+dm)}),void(Re.current=be);C(c9)},[mt]);var We=rp({close:function(et){je&&je(0),C({overlay:!0,lastBg:fe}),j(et)},changeIndex:function(et,yt){yt===void 0&&(yt=!1);var At=qe?Re.current+(et-be):et,$t=xe-1,Ne=tP(At,0,$t),tt=qe?At:Ne,St=innerWidth+dm;C({touched:!1,lastCX:void 0,lastCY:void 0,x:-St*tt,pause:yt}),Re.current=tt,ae&&ae(qe?et<0?$t:et>$t?0:et:Ne)}}),W=We.close,ee=We.changeIndex;function se(et){return et?W():C({overlay:!J})}function he(){C({x:-(innerWidth+dm)*be,lastCX:void 0,lastCY:void 0,pause:!0}),Re.current=be}function F(et,yt,At,$t){et==="x"?function(Ne){if($!==void 0){var tt=Ne-$,St=tt;!qe&&(be===0&&tt>0||be===xe-1&&tt<0)&&(St=tt/2),C({touched:!0,lastCX:$,x:-(innerWidth+dm)*Re.current+St,pause:!1})}else C({touched:!0,lastCX:Ne,x:P,pause:!1})}(yt):et==="y"&&function(Ne,tt){if(V!==void 0){var St=u===null?null:tP(u,.01,u-Math.abs(Ne-V)/100/4);C({touched:!0,lastCY:V,bg:tt===1?St:u,minimal:tt===1})}else C({touched:!0,lastCY:Ne,bg:fe,minimal:!0})}(At,$t)}function _e(et,yt){var At=et-($??et),$t=yt-(V??yt),Ne=!1;if(At<-40)ee(be+1);else if(At>40)ee(be-1);else{var tt=-(innerWidth+dm)*Re.current;Math.abs($t)>100&&ne&&f&&(Ne=!0,W()),C({touched:!1,x:tt,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!Ne||J})}}Pm("keydown",function(et){if(N)switch(et.key){case"ArrowLeft":ee(be-1,!0);break;case"ArrowRight":ee(be+1,!0);break;case"Escape":W()}});var Ue=function(et,yt,At){return m.useMemo(function(){var $t=et.length;return At?et.concat(et).concat(et).slice($t+yt-1,$t+yt+2):et.slice(Math.max(yt-1,0),Math.min(yt+2,$t+1))},[et,yt,At])}(S,be,qe);if(!mt)return null;var Xe=J&&!bt,_t=N?fe:Te,Bt=Se&&je&&{images:S,index:be,visible:N,onClose:W,onIndexChange:ee,overlayVisible:Xe,overlay:Be&&Be.overlay,scale:ce,rotate:Oe,onScale:Se,onRotate:je},Et=i?i(bt):400,at=r?r(bt):a9,pe=i?i(3):600,ct=r?r(3):a9;return xn.createElement(Qwe,{className:"PhotoView-Portal"+(Xe?"":" PhotoView-Slider__clean")+(N?"":" PhotoView-Slider__willClose")+(y?" "+y:""),role:"dialog",onClick:function(et){return et.stopPropagation()},container:D},N&&xn.createElement(Fwe,null),xn.createElement("div",{className:"PhotoView-Slider__Backdrop"+(O?" "+O:"")+(bt===1?" PhotoView-Slider__fadeIn":bt===2?" PhotoView-Slider__fadeOut":""),style:{background:_t?"rgba(0, 0, 0, "+_t+")":void 0,transitionTimingFunction:at,transitionDuration:(q?0:Et)+"ms",animationDuration:Et+"ms"},onAnimationEnd:Dt}),p&&xn.createElement("div",{className:"PhotoView-Slider__BannerWrap"},xn.createElement("div",{className:"PhotoView-Slider__Counter"},be+1," / ",xe),xn.createElement("div",{className:"PhotoView-Slider__BannerRight"},b&&Bt&&b(Bt),xn.createElement(Bwe,{className:"PhotoView-Slider__toolbarIcon",onClick:W}))),Ue.map(function(et,yt){var At=qe||be!==0?Re.current-1+yt:be+yt;return xn.createElement(Zwe,{key:qe?et.key+"/"+et.src+"/"+At:et.key,item:et,speed:Et,easing:at,visible:N,onReachMove:F,onReachUp:_e,onPhotoTap:function(){return se(s)},onMaskTap:function(){return se(o)},wrapClassName:x,className:v,style:{left:(innerWidth+dm)*At+"px",transform:"translate3d("+P+"px, 0px, 0)",transition:q||G?void 0:"transform "+pe+"ms "+ct},loadingElement:w,brokenElement:E,onPhotoResize:he,isActive:Re.current===At,expose:C})}),!bu&&p&&xn.createElement(xn.Fragment,null,(qe||be!==0)&&xn.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ee(be-1,!0)}},xn.createElement(Uwe,null)),(qe||be+1-1){var O=u.slice();return O.splice(y,1,b),void o({images:O})}o(function(v){return{images:v.images.concat(b)}})},remove:function(b){o(function(y){var O=y.images.filter(function(v){return v.key!==b});return{images:O,index:Math.min(O.length-1,f)}})},show:function(b){var y=u.findIndex(function(O){return O.key===b});o({visible:!0,index:y}),i&&i(!0,y,a)}}),p=rp({close:function(){o({visible:!1}),i&&i(!1,f,a)},changeIndex:function(b){o({index:b}),n&&n(b,a)}}),g=m.useMemo(function(){return ss({},a,h)},[a,h]);return xn.createElement(bJ.Provider,{value:g},t,xn.createElement(Kwe,ss({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},r)))}var yJ=function(e){var t,n,i=e.src,r=e.render,s=e.overlay,a=e.width,o=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=m.useContext(bJ),h=(t=function(){return f.nextId()},(n=m.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=m.useRef(null);m.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),m.useEffect(function(){return function(){f.remove(h)}},[]);var g=rp({render:function(y){return r&&r(y)},show:function(y,O){f.show(h),function(v,x){if(d){var w=d.props[v];w&&w(x)}}(y,O)}}),b=m.useMemo(function(){var y={};return u.forEach(function(O){y[O]=g.show.bind(null,O)}),y},[]);return m.useEffect(function(){f.update({key:h,src:i,originRef:p,render:g.render,overlay:s,width:a,height:o})},[i]),d?m.Children.only(m.cloneElement(d,ss({},b,{ref:p}))):null};const nSe=e=>l.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[l.jsx("path",{d:"M22 6.017c0-1.104-.907-2.037-2.049-2l-.594.025c-2.732.148-4.952.705-7.333 1.953l-.512.279-.087.054a1 1 0 0 0 .971 1.737l.092-.046.454-.246C15.195 6.59 17.26 6.106 20 6.016v11.837c-3.034.046-5.42.582-7.99 1.99l-.517.295-.086.056a1 1 0 0 0 1.009 1.715l.09-.047.455-.258c2.105-1.157 4.045-1.645 6.537-1.738l.543-.014a1.995 1.995 0 0 0 1.95-1.8l.009-.198V6.017Z"}),l.jsx("path",{d:"M2 6.017c0-1.104.907-2.037 2.049-2l.594.025c2.732.148 4.952.705 7.333 1.953l.512.279.087.054a1 1 0 0 1-.971 1.737l-.092-.046-.454-.246C8.805 6.59 6.74 6.106 4 6.016v11.837c3.034.046 5.42.582 7.99 1.99l.517.295.086.056a1 1 0 0 1-1.009 1.715l-.09-.047-.455-.258c-2.105-1.157-4.045-1.644-6.537-1.738l-.543-.014a1.995 1.995 0 0 1-1.95-1.8L2 17.855V6.017Z"}),l.jsx("path",{d:"M13 7.5v13h-2v-13h2Z"})]}),iSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{fillRule:"evenodd",d:"M10.556 4a1 1 0 0 0-.97.751l-.292 1.14h5.421l-.293-1.14A1 1 0 0 0 13.453 4h-2.897Zm6.224 1.892-.421-1.639A3 3 0 0 0 13.453 2h-2.897A3 3 0 0 0 7.65 4.253l-.421 1.639H4a1 1 0 1 0 0 2h.1l1.215 11.425A3 3 0 0 0 8.3 22h7.4a3 3 0 0 0 2.984-2.683l1.214-11.425H20a1 1 0 1 0 0-2h-3.22Zm1.108 2H6.112l1.192 11.214A1 1 0 0 0 8.3 20h7.4a1 1 0 0 0 .995-.894l1.192-11.214ZM10 10a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Zm4 0a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),rSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{fillRule:"evenodd",d:"M16.793 2.793a3.121 3.121 0 1 1 4.414 4.414l-8.5 8.5A1 1 0 0 1 12 16H9a1 1 0 0 1-1-1v-3a1 1 0 0 1 .293-.707l8.5-8.5Zm3 1.414a1.121 1.121 0 0 0-1.586 0L10 12.414V14h1.586l8.207-8.207a1.121 1.121 0 0 0 0-1.586ZM6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-4a1 1 0 1 1 2 0v4a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h4a1 1 0 1 1 0 2H6Z",clipRule:"evenodd"})}),sSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{fillRule:"evenodd",d:"M4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-10C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm4.465 6.763a1 1 0 0 0-1.228-1.228l-5.5 1.5a1 1 0 0 0-.702.702l-1.5 5.5a1 1 0 0 0 1.228 1.228l5.5-1.5a1 1 0 0 0 .702-.702l1.5-5.5Zm-6.54 5.312.89-3.26 3.26-.89-.89 3.26-3.26.89Z",clipRule:"evenodd"})}),aSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{d:"M5.91456 7.59106C4.34202 9.04124 3.28878 10.7415 2.77064 11.6971C2.66597 11.8902 2.66597 12.1098 2.77064 12.3029C3.28878 13.2585 4.34202 14.9588 5.91456 16.4089C7.48207 17.8545 9.50584 19 12.0001 19C14.4944 19 16.5182 17.8545 18.0857 16.4089C19.6582 14.9588 20.7114 13.2585 21.2296 12.3029C21.3343 12.1098 21.3343 11.8902 21.2296 11.6971C20.7114 10.7415 19.6582 9.04124 18.0857 7.59105C16.5182 6.1455 14.4944 5 12.0001 5C9.50584 5 7.48207 6.1455 5.91456 7.59106ZM4.5587 6.1208C6.36071 4.45899 8.84593 3 12.0001 3C15.1543 3 17.6395 4.45899 19.4415 6.1208C21.2385 7.77798 22.4153 9.68799 22.9878 10.7438C23.4149 11.5315 23.4149 12.4685 22.9878 13.2562C22.4153 14.312 21.2385 16.222 19.4415 17.8792C17.6395 19.541 15.1543 21 12.0001 21C8.84593 21 6.36071 19.541 4.5587 17.8792C2.76171 16.222 1.5849 14.312 1.01244 13.2562C0.585372 12.4685 0.585371 11.5315 1.01244 10.7438C1.5849 9.688 2.76171 7.77798 4.5587 6.1208ZM12.0001 9.5C10.6194 9.5 9.50011 10.6193 9.50011 12C9.50011 13.3807 10.6194 14.5 12.0001 14.5C13.3808 14.5 14.5001 13.3807 14.5001 12C14.5001 10.6193 13.3808 9.5 12.0001 9.5ZM7.50011 12C7.50011 9.51472 9.51483 7.5 12.0001 7.5C14.4854 7.5 16.5001 9.51472 16.5001 12C16.5001 14.4853 14.4854 16.5 12.0001 16.5C9.51483 16.5 7.50011 14.4853 7.50011 12Z",fill:"currentColor"})}),oSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"})}),lSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{d:"M12 6C12.5523 6 13 6.44772 13 7V11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H13V17C13 17.5523 12.5523 18 12 18C11.4477 18 11 17.5523 11 17V13H7C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11H11V7C11 6.44772 11.4477 6 12 6Z",fill:"currentColor"})}),cSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{d:"M11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289L16.7071 7.29289C17.0976 7.68342 17.0976 8.31658 16.7071 8.70711C16.3166 9.09763 15.6834 9.09763 15.2929 8.70711L13 6.41421V15C13 15.5523 12.5523 16 12 16C11.4477 16 11 15.5523 11 15V6.41421L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289L11.2929 3.29289ZM4 14C4.55229 14 5 14.4477 5 15V15.2C5 16.0566 5.00078 16.6389 5.03755 17.089C5.07337 17.5274 5.1383 17.7516 5.21799 17.908C5.40973 18.2843 5.7157 18.5903 6.09202 18.782C6.24842 18.8617 6.47262 18.9266 6.91104 18.9624C7.36113 18.9992 7.94342 19 8.8 19H15.2C16.0566 19 16.6389 18.9992 17.089 18.9624C17.5274 18.9266 17.7516 18.8617 17.908 18.782C18.2843 18.5903 18.5903 18.2843 18.782 17.908C18.8617 17.7516 18.9266 17.5274 18.9624 17.089C18.9992 16.6389 19 16.0566 19 15.2V15C19 14.4477 19.4477 14 20 14C20.5523 14 21 14.4477 21 15V15.2413C21 16.0463 21 16.7106 20.9558 17.2518C20.9099 17.8139 20.8113 18.3306 20.564 18.816C20.1805 19.5686 19.5686 20.1805 18.816 20.564C18.3306 20.8113 17.8139 20.9099 17.2518 20.9558C16.7106 21 16.0463 21 15.2413 21H8.75868C7.95372 21 7.28936 21 6.74817 20.9558C6.18608 20.9099 5.66937 20.8113 5.18404 20.564C4.43139 20.1805 3.81947 19.5686 3.43597 18.816C3.18868 18.3306 3.09012 17.8139 3.04419 17.2518C2.99998 16.7106 2.99999 16.0463 3 15.2413L3 15C3 14.4477 3.44772 14 4 14Z",fill:"currentColor"})}),VN=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{d:"M8.99805 16.796C8.99805 15.4164 7.87961 14.2979 6.5 14.2979C5.12039 14.2979 4.00195 15.4164 4.00195 16.796C4.00196 18.1756 5.1204 19.294 6.5 19.294C7.8796 19.294 8.99804 18.1756 8.99805 16.796ZM19.748 15.0479C19.748 14.7729 19.525 14.5499 19.25 14.5499H15.75C15.475 14.5499 15.252 14.7729 15.252 15.0479V18.5479C15.252 18.823 15.475 19.046 15.75 19.046H19.25C19.525 19.046 19.748 18.823 19.748 18.5479V15.0479ZM10.0469 3.45125C11.077 2.15921 13.0849 2.20276 14.0498 3.58113L16.4189 6.96492L16.5205 7.12215C17.5046 8.76341 16.3301 10.9023 14.3691 10.9024H9.63086C7.60676 10.9023 6.42029 8.62316 7.58105 6.96492L9.9502 3.58113L10.0469 3.45125ZM12.4082 4.73055C12.2223 4.46497 11.842 4.44826 11.6318 4.68074L11.5918 4.73055L9.22266 8.11433C8.99176 8.44435 9.22808 8.89744 9.63086 8.89754H14.3691C14.7468 8.89745 14.9774 8.49957 14.8145 8.17781L14.7773 8.11433L12.4082 4.73055ZM11.002 16.796C11.0019 19.2824 8.98638 21.2979 6.5 21.2979C4.01362 21.2979 1.99806 19.2824 1.99805 16.796C1.99805 14.3096 4.01361 12.294 6.5 12.294C8.98639 12.294 11.002 14.3096 11.002 16.796ZM21.752 18.5479C21.752 19.9297 20.6318 21.0499 19.25 21.0499H15.75C14.3682 21.0499 13.248 19.9297 13.248 18.5479V15.0479C13.2481 13.6662 14.3682 12.546 15.75 12.546H19.25C20.6318 12.546 21.7519 13.6662 21.752 15.0479V18.5479Z",fill:"currentColor"})});/** + `),()=>{document.head.removeChild(d)}},[t]),l.jsx(pye,{isPresent:t,childRef:i,sizeRef:r,children:m.cloneElement(e,{ref:i})})}const gye=({children:e,initial:t,isPresent:n,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:a})=>{const o=u_(bye),c=m.useId(),u=m.useCallback(f=>{o.set(f,!0);for(const h of o.values())if(!h)return;i&&i()},[o,i]),d=m.useMemo(()=>({id:c,initial:t,isPresent:n,custom:r,onExitComplete:u,register:f=>(o.set(f,!1),()=>o.delete(f))}),s?[Math.random(),u]:[n,u]);return m.useMemo(()=>{o.forEach((f,h)=>o.set(h,!1))},[n]),m.useEffect(()=>{!n&&!o.size&&i&&i()},[n]),a==="popLayout"&&(e=l.jsx(mye,{isPresent:n,children:e})),l.jsx(d_.Provider,{value:d,children:e})};function bye(){return new Map}function zZ(e=!0){const t=m.useContext(d_);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:r}=t,s=m.useId();m.useEffect(()=>{e&&r(s)},[e]);const a=m.useCallback(()=>e&&i&&i(s),[s,i,e]);return!n&&i?[!1,a]:[!0]}const ew=e=>e.key||"";function XB(e){const t=[];return m.Children.forEach(e,n=>{m.isValidElement(n)&&t.push(n)}),t}const oD=typeof window<"u",FZ=oD?m.useLayoutEffect:m.useEffect,Sf=({children:e,custom:t,initial:n=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:s="sync",propagate:a=!1})=>{const[o,c]=zZ(a),u=m.useMemo(()=>XB(e),[e]),d=a&&!o?[]:u.map(ew),f=m.useRef(!0),h=m.useRef(u),p=u_(()=>new Map),[g,b]=m.useState(u),[y,O]=m.useState(u);FZ(()=>{f.current=!1,h.current=u;for(let w=0;w {const E=ew(w),S=a&&!o?!1:u===y||d.includes(E),k=()=>{if(p.has(E))p.set(E,!0);else return;let T=!0;p.forEach(A=>{A||(T=!1)}),T&&(x==null||x(),O(h.current),a&&(c==null||c()),i&&i())};return l.jsx(gye,{isPresent:S,initial:!f.current||n?void 0:!1,custom:S?void 0:t,presenceAffectsLayout:r,mode:s,onExitComplete:S?void 0:k,children:w},E)})})},ko=e=>e;let VZ=ko;const Oye={useManualTiming:!1};function yye(e){let t=new Set,n=new Set,i=!1,r=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(u){s.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&i?t:n;return d&&s.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),s.delete(u)},process:u=>{if(a=u,i){r=!0;return}i=!0,[t,n]=[n,t],t.forEach(o),t.clear(),i=!1,r&&(r=!1,c.process(u))}};return c}const tw=["read","resolveKeyframes","update","preRender","render","postRender"],xye=40;function XZ(e,t){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=tw.reduce((O,v)=>(O[v]=yye(s),O),{}),{read:o,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const O=performance.now();n=!1,r.delta=i?1e3/60:Math.max(Math.min(O-r.timestamp,xye),1),r.timestamp=O,r.isProcessing=!0,o.process(r),c.process(r),u.process(r),d.process(r),f.process(r),h.process(r),r.isProcessing=!1,n&&t&&(i=!1,e(p))},g=()=>{n=!0,i=!0,r.isProcessing||e(p)};return{schedule:tw.reduce((O,v)=>{const x=a[v];return O[v]=(w,E=!1,S=!1)=>(n||g(),x.schedule(w,E,S)),O},{}),cancel:O=>{for(let v=0;v qB[e].some(n=>!!t[n])};function vye(e){for(const t in e)a0[t]={...a0[t],...e[t]}}const wye=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ok(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||wye.has(e)}let HZ=e=>!ok(e);function YZ(e){e&&(HZ=t=>t.startsWith("on")?!ok(t):e(t))}try{YZ(require("@emotion/is-prop-valid").default)}catch{}function Sye(e,t,n){const i={};for(const r in e)r==="values"&&typeof e.values=="object"||(HZ(r)||n===!0&&ok(r)||!t&&!ok(r)||e.draggable&&r.startsWith("onDrag"))&&(i[r]=e[r]);return i}function Eye({children:e,isValidProp:t,...n}){t&&YZ(t),n={...m.useContext(rx),...n},n.isStatic=u_(()=>n.isStatic);const i=m.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return l.jsx(rx.Provider,{value:i,children:e})}function kye(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...i)=>e(...i);return new Proxy(n,{get:(i,r)=>r==="create"?e:(t.has(r)||t.set(r,e(r)),t.get(r))})}const f_=m.createContext({});function sx(e){return typeof e=="string"||Array.isArray(e)}function h_(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const lD=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],cD=["initial",...lD];function p_(e){return h_(e.animate)||cD.some(t=>sx(e[t]))}function GZ(e){return!!(p_(e)||e.variants)}function Tye(e,t){if(p_(e)){const{initial:n,animate:i}=e;return{initial:n===!1||sx(n)?n:void 0,animate:sx(i)?i:void 0}}return e.inherit!==!1?t:{}}function _ye(e){const{initial:t,animate:n}=Tye(e,m.useContext(f_));return m.useMemo(()=>({initial:t,animate:n}),[HB(t),HB(n)])}function HB(e){return Array.isArray(e)?e.join(" "):e}const Aye=Symbol.for("motionComponentSymbol");function ig(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Nye(e,t,n){return m.useCallback(i=>{i&&e.onMount&&e.onMount(i),t&&(i?t.mount(i):t.unmount()),n&&(typeof n=="function"?n(i):ig(n)&&(n.current=i))},[t])}const uD=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Cye="framerAppearId",WZ="data-"+uD(Cye),{schedule:dD}=XZ(queueMicrotask,!1),ZZ=m.createContext({});function jye(e,t,n,i,r){var s,a;const{visualElement:o}=m.useContext(f_),c=m.useContext(qZ),u=m.useContext(d_),d=m.useContext(rx).reducedMotion,f=m.useRef(null);i=i||c.renderer,!f.current&&i&&(f.current=i(e,{visualState:t,parent:o,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=m.useContext(ZZ);h&&!h.projection&&r&&(h.type==="html"||h.type==="svg")&&Rye(f.current,n,r,p);const g=m.useRef(!1);m.useInsertionEffect(()=>{h&&g.current&&h.update(n,u)});const b=n[WZ],y=m.useRef(!!b&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,b))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,b)));return FZ(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),dD.render(h.render),y.current&&h.animationState&&h.animationState.animateChanges())}),m.useEffect(()=>{h&&(!y.current&&h.animationState&&h.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var O;(O=window.MotionHandoffMarkAsComplete)===null||O===void 0||O.call(window,b)}),y.current=!1))}),h}function Rye(e,t,n,i){const{layoutId:r,layout:s,drag:a,dragConstraints:o,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:KZ(e.parent)),e.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!a||o&&ig(o),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,layoutScroll:c,layoutRoot:u})}function KZ(e){if(e)return e.options.allowProjection!==!1?e.projection:KZ(e.parent)}function Iye({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:i,Component:r}){var s,a;e&&vye(e);function o(u,d){let f;const h={...m.useContext(rx),...u,layoutId:Pye(u)},{isStatic:p}=h,g=_ye(u),b=i(u,p);if(!p&&oD){Mye();const y=Lye(h);f=y.MeasureLayout,g.visualElement=jye(r,b,h,t,y.ProjectionNode)}return l.jsxs(f_.Provider,{value:g,children:[f&&g.visualElement?l.jsx(f,{visualElement:g.visualElement,...h}):null,n(r,u,Nye(b,g.visualElement,d),b,p,g.visualElement)]})}o.displayName=`motion.${typeof r=="string"?r:`create(${(a=(s=r.displayName)!==null&&s!==void 0?s:r.name)!==null&&a!==void 0?a:""})`}`;const c=m.forwardRef(o);return c[Aye]=r,c}function Pye({layoutId:e}){const t=m.useContext(aD).id;return t&&e!==void 0?t+"-"+e:e}function Mye(e,t){m.useContext(qZ).strict}function Lye(e){const{drag:t,layout:n}=a0;if(!t&&!n)return{};const i={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const Dye=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function fD(e){return typeof e!="string"||e.includes("-")?!1:!!(Dye.indexOf(e)>-1||/[A-Z]/u.test(e))}function YB(e){const t=[{},{}];return e==null||e.values.forEach((n,i)=>{t[0][i]=n.get(),t[1][i]=n.getVelocity()}),t}function hD(e,t,n,i){if(typeof t=="function"){const[r,s]=YB(i);t=t(n!==void 0?n:e.custom,r,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,s]=YB(i);t=t(n!==void 0?n:e.custom,r,s)}return t}const BI=e=>Array.isArray(e),$ye=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),Qye=e=>BI(e)?e[e.length-1]||0:e,Zs=e=>!!(e&&e.getVelocity);function $S(e){const t=Zs(e)?e.get():e;return $ye(t)?t.toValue():t}function Bye({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},i,r,s){const a={latestValues:Uye(i,r,s,e),renderState:t()};return n&&(a.onMount=o=>n({props:i,current:o,...a}),a.onUpdate=o=>n(o)),a}const JZ=e=>(t,n)=>{const i=m.useContext(f_),r=m.useContext(d_),s=()=>Bye(e,t,i,r);return n?s():u_(s)};function Uye(e,t,n,i){const r={},s=i(e,{});for(const h in s)r[h]=$S(s[h]);let{initial:a,animate:o}=e;const c=p_(e),u=GZ(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),o===void 0&&(o=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?o:a;if(f&&typeof f!="boolean"&&!h_(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p t=>typeof t=="string"&&t.startsWith(e),tK=eK("--"),zye=eK("var(--"),pD=e=>zye(e)?Fye.test(e.split("/*")[0].trim()):!1,Fye=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nK=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Zu=(e,t,n)=>n>t?t:n typeof e=="number",parse:parseFloat,transform:e=>e},ax={...G0,transform:e=>Zu(0,1,e)},nw={...G0,default:1},_1=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Bd=_1("deg"),Mc=_1("%"),Gt=_1("px"),Vye=_1("vh"),Xye=_1("vw"),GB={...Mc,parse:e=>Mc.parse(e)/100,transform:e=>Mc.transform(e*100)},qye={borderWidth:Gt,borderTopWidth:Gt,borderRightWidth:Gt,borderBottomWidth:Gt,borderLeftWidth:Gt,borderRadius:Gt,radius:Gt,borderTopLeftRadius:Gt,borderTopRightRadius:Gt,borderBottomRightRadius:Gt,borderBottomLeftRadius:Gt,width:Gt,maxWidth:Gt,height:Gt,maxHeight:Gt,top:Gt,right:Gt,bottom:Gt,left:Gt,padding:Gt,paddingTop:Gt,paddingRight:Gt,paddingBottom:Gt,paddingLeft:Gt,margin:Gt,marginTop:Gt,marginRight:Gt,marginBottom:Gt,marginLeft:Gt,backgroundPositionX:Gt,backgroundPositionY:Gt},Hye={rotate:Bd,rotateX:Bd,rotateY:Bd,rotateZ:Bd,scale:nw,scaleX:nw,scaleY:nw,scaleZ:nw,skew:Bd,skewX:Bd,skewY:Bd,distance:Gt,translateX:Gt,translateY:Gt,translateZ:Gt,x:Gt,y:Gt,z:Gt,perspective:Gt,transformPerspective:Gt,opacity:ax,originX:GB,originY:GB,originZ:Gt},WB={...G0,transform:Math.round},mD={...qye,...Hye,zIndex:WB,size:Gt,fillOpacity:ax,strokeOpacity:ax,numOctaves:WB},Yye={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Gye=Y0.length;function Wye(e,t,n){let i="",r=!0;for(let s=0;s ({style:{},transform:{},transformOrigin:{},vars:{}}),iK=()=>({...OD(),attrs:{}}),yD=e=>typeof e=="string"&&e.toLowerCase()==="svg";function rK(e,{style:t,vars:n},i,r){Object.assign(e.style,t,r&&r.getProjectionStyles(i));for(const s in n)e.style.setProperty(s,n[s])}const sK=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function aK(e,t,n,i){rK(e,t,void 0,i);for(const r in t.attrs)e.setAttribute(sK.has(r)?r:uD(r),t.attrs[r])}const lk={};function txe(e){Object.assign(lk,e)}function oK(e,{layout:t,layoutId:n}){return zp.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!lk[e]||e==="opacity")}function xD(e,t,n){var i;const{style:r}=e,s={};for(const a in r)(Zs(r[a])||t.style&&Zs(t.style[a])||oK(a,e)||((i=n==null?void 0:n.getValue(a))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(s[a]=r[a]);return s}function lK(e,t,n){const i=xD(e,t,n);for(const r in e)if(Zs(e[r])||Zs(t[r])){const s=Y0.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=e[r]}return i}function nxe(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const KB=["x","y","width","height","cx","cy","r"],ixe={useVisualState:JZ({scrapeMotionValuesFromProps:lK,createRenderState:iK,onUpdate:({props:e,prevProps:t,current:n,renderState:i,latestValues:r})=>{if(!n)return;let s=!!e.drag;if(!s){for(const o in r)if(zp.has(o)){s=!0;break}}if(!s)return;let a=!t;if(t)for(let o=0;o {nxe(n,i),er.render(()=>{bD(i,r,yD(n.tagName),e.transformTemplate),aK(n,i)})})}})},rxe={useVisualState:JZ({scrapeMotionValuesFromProps:xD,createRenderState:OD})};function cK(e,t,n){for(const i in t)!Zs(t[i])&&!oK(i,n)&&(e[i]=t[i])}function sxe({transformTemplate:e},t){return m.useMemo(()=>{const n=OD();return gD(n,t,e),Object.assign({},n.vars,n.style)},[t])}function axe(e,t){const n=e.style||{},i={};return cK(i,n,e),Object.assign(i,sxe(e,t)),i}function oxe(e,t){const n={},i=axe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}function lxe(e,t,n,i){const r=m.useMemo(()=>{const s=iK();return bD(s,t,yD(i),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};cK(s,e.style,e),r.style={...s,...r.style}}return r}function cxe(e=!1){return(n,i,r,{latestValues:s},a)=>{const c=(fD(n)?lxe:oxe)(i,s,a,n),u=Sye(i,typeof n=="string",e),d=n!==m.Fragment?{...u,...c,ref:r}:{},{children:f}=i,h=m.useMemo(()=>Zs(f)?f.get():f,[f]);return m.createElement(n,{...d,children:h})}}function uxe(e,t){return function(i,{forwardMotionProps:r}={forwardMotionProps:!1}){const a={...fD(i)?ixe:rxe,preloadedFeatures:e,useRender:cxe(r),createVisualElement:t,Component:i};return Iye(a)}}function uK(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i (QS===void 0&&Lc.set(_s.isProcessing||Oye.useManualTiming?_s.timestamp:performance.now()),QS),set:e=>{QS=e,queueMicrotask(dxe)}};function wD(e,t){e.indexOf(t)===-1&&e.push(t)}function SD(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class ED{constructor(){this.subscriptions=[]}add(t){return wD(this.subscriptions,t),()=>SD(this.subscriptions,t)}notify(t,n,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,i);else for(let s=0;s !isNaN(parseFloat(e));class hxe{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,r=!0)=>{const s=Lc.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),r&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Lc.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=fxe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new ED);const i=this.events[t].add(n);return t==="change"?()=>{i(),er.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Lc.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>JB)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,JB);return fK(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ox(e,t){return new hxe(e,t)}function pxe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ox(n))}function mxe(e,t){const n=m_(e,t);let{transitionEnd:i={},transition:r={},...s}=n||{};s={...s,...i};for(const a in s){const o=Qye(s[a]);pxe(e,a,o)}}function gxe(e){return!!(Zs(e)&&e.add)}function UI(e,t){const n=e.getValue("willChange");if(gxe(n))return n.add(t)}function hK(e){return e.props[WZ]}function kD(e){let t;return()=>(t===void 0&&(t=e()),t)}const bxe=kD(()=>window.ScrollTimeline!==void 0);class Oxe{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let i=0;i {if(bxe()&&r.attachTimeline)return r.attachTimeline(t);if(typeof n=="function")return n(r)});return()=>{i.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;n n[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class yxe extends Oxe{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const $u=e=>e*1e3,Qu=e=>e/1e3;function TD(e){return typeof e=="function"}function e8(e,t){e.timeline=t,e.onfinish=null}const _D=e=>Array.isArray(e)&&typeof e[0]=="number",xxe={linearEasing:void 0};function vxe(e,t){const n=kD(e);return()=>{var i;return(i=xxe[t])!==null&&i!==void 0?i:n()}}const ck=vxe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),o0=(e,t,n)=>{const i=t-e;return i===0?1:(n-e)/i},pK=(e,t,n=10)=>{let i="";const r=Math.max(Math.round(t/n),2);for(let s=0;s `cubic-bezier(${e}, ${t}, ${n}, ${i})`,zI={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:IO([0,.65,.55,1]),circOut:IO([.55,0,1,.45]),backIn:IO([.31,.01,.66,-.59]),backOut:IO([.33,1.53,.69,.99])};function gK(e,t){if(e)return typeof e=="function"&&ck()?pK(e,t):_D(e)?IO(e):Array.isArray(e)?e.map(n=>gK(n,t)||zI.easeOut):zI[e]}const bK=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,wxe=1e-7,Sxe=12;function Exe(e,t,n,i,r){let s,a,o=0;do a=t+(n-t)/2,s=bK(a,i,r)-e,s>0?n=a:t=a;while(Math.abs(s)>wxe&&++o Exe(s,0,1,e,n);return s=>s===0||s===1?s:bK(r(s),t,i)}const OK=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,yK=e=>t=>1-e(1-t),xK=A1(.33,1.53,.69,.99),AD=yK(xK),vK=OK(AD),wK=e=>(e*=2)<1?.5*AD(e):.5*(2-Math.pow(2,-10*(e-1))),ND=e=>1-Math.sin(Math.acos(e)),SK=yK(ND),EK=OK(ND),kK=e=>/^0[^.\s]+$/u.test(e);function kxe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||kK(e):!0}const fy=e=>Math.round(e*1e5)/1e5,CD=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Txe(e){return e==null}const _xe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,jD=(e,t)=>n=>!!(typeof n=="string"&&_xe.test(n)&&n.startsWith(e)||t&&!Txe(n)&&Object.prototype.hasOwnProperty.call(n,t)),TK=(e,t,n)=>i=>{if(typeof i!="string")return i;const[r,s,a,o]=i.match(CD);return{[e]:parseFloat(r),[t]:parseFloat(s),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},Axe=e=>Zu(0,255,e),CN={...G0,transform:e=>Math.round(Axe(e))},Fh={test:jD("rgb","red"),parse:TK("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+CN.transform(e)+", "+CN.transform(t)+", "+CN.transform(n)+", "+fy(ax.transform(i))+")"};function Nxe(e){let t="",n="",i="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,i+=i,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const FI={test:jD("#"),parse:Nxe,transform:Fh.transform},rg={test:jD("hsl","hue"),parse:TK("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+Mc.transform(fy(t))+", "+Mc.transform(fy(n))+", "+fy(ax.transform(i))+")"},Hs={test:e=>Fh.test(e)||FI.test(e)||rg.test(e),parse:e=>Fh.test(e)?Fh.parse(e):rg.test(e)?rg.parse(e):FI.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Fh.transform(e):rg.transform(e)},Cxe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function jxe(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(CD))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(Cxe))===null||n===void 0?void 0:n.length)||0)>0}const _K="number",AK="color",Rxe="var",Ixe="var(",t8="${}",Pxe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function lx(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},r=[];let s=0;const o=t.replace(Pxe,c=>(Hs.test(c)?(i.color.push(s),r.push(AK),n.push(Hs.parse(c))):c.startsWith(Ixe)?(i.var.push(s),r.push(Rxe),n.push(c)):(i.number.push(s),r.push(_K),n.push(parseFloat(c))),++s,t8)).split(t8);return{values:n,split:o,indexes:i,types:r}}function NK(e){return lx(e).values}function CK(e){const{split:t,types:n}=lx(e),i=t.length;return r=>{let s="";for(let a=0;atypeof e=="number"?0:e;function Lxe(e){const t=NK(e);return CK(e)(t.map(Mxe))}const Mf={test:jxe,parse:NK,createTransformer:CK,getAnimatableNone:Lxe},Dxe=new Set(["brightness","contrast","saturate","opacity"]);function $xe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=n.match(CD)||[];if(!i)return e;const r=n.replace(i,"");let s=Dxe.has(t)?1:0;return i!==n&&(s*=100),t+"("+s+r+")"}const Qxe=/\b([a-z-]*)\(.*?\)/gu,VI={...Mf,getAnimatableNone:e=>{const t=e.match(Qxe);return t?t.map($xe).join(" "):e}},Bxe={...mD,color:Hs,backgroundColor:Hs,outlineColor:Hs,fill:Hs,stroke:Hs,borderColor:Hs,borderTopColor:Hs,borderRightColor:Hs,borderBottomColor:Hs,borderLeftColor:Hs,filter:VI,WebkitFilter:VI},RD=e=>Bxe[e];function jK(e,t){let n=RD(e);return n!==VI&&(n=Mf),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Uxe=new Set(["auto","none","0"]);function zxe(e,t,n){let i=0,r;for(;i e===G0||e===Gt,i8=(e,t)=>parseFloat(e.split(", ")[t]),r8=(e,t)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const r=i.match(/^matrix3d\((.+)\)$/u);if(r)return i8(r[1],t);{const s=i.match(/^matrix\((.+)\)$/u);return s?i8(s[1],e):0}},Fxe=new Set(["x","y","z"]),Vxe=Y0.filter(e=>!Fxe.has(e));function Xxe(e){const t=[];return Vxe.forEach(n=>{const i=e.getValue(n);i!==void 0&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}const l0={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:r8(4,13),y:r8(5,14)};l0.translateX=l0.x;l0.translateY=l0.y;const ip=new Set;let XI=!1,qI=!1;function RK(){if(qI){const e=Array.from(ip).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),n=new Map;t.forEach(i=>{const r=Xxe(i);r.length&&(n.set(i,r),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const r=n.get(i);r&&r.forEach(([s,a])=>{var o;(o=i.getValue(s))===null||o===void 0||o.set(a)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}qI=!1,XI=!1,ip.forEach(e=>e.complete()),ip.clear()}function IK(){ip.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(qI=!0)})}function qxe(){IK(),RK()}class ID{constructor(t,n,i,r,s,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=i,this.motionValue=r,this.element=s,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(ip.add(this),XI||(XI=!0,er.read(IK),er.resolveKeyframes(RK))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:i,motionValue:r}=this;for(let s=0;s /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Hxe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Yxe(e){const t=Hxe.exec(e);if(!t)return[,];const[,n,i,r]=t;return[`--${n??i}`,r]}function MK(e,t,n=1){const[i,r]=Yxe(e);if(!i)return;const s=window.getComputedStyle(t).getPropertyValue(i);if(s){const a=s.trim();return PK(a)?parseFloat(a):a}return pD(r)?MK(r,t,n+1):r}const LK=e=>t=>t.test(e),Gxe={test:e=>e==="auto",parse:e=>e},DK=[G0,Gt,Mc,Bd,Xye,Vye,Gxe],s8=e=>DK.find(LK(e));class $K extends ID{constructor(t,n,i,r,s){super(t,n,i,r,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c {n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const a8=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Mf.test(e)||e==="0")&&!e.startsWith("url("));function Wxe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n e!==null;function g_(e,{repeat:t,repeatType:n="loop"},i){const r=e.filter(Kxe),s=t&&n!=="loop"&&t%2===1?0:r.length-1;return!s||i===void 0?r[s]:i}const Jxe=40;class QK{constructor({autoplay:t=!0,delay:n=0,type:i="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:a="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Lc.now(),this.options={autoplay:t,delay:n,type:i,repeat:r,repeatDelay:s,repeatType:a,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>Jxe?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&qxe(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Lc.now(),this.hasAttemptedResolve=!0;const{name:i,type:r,velocity:s,delay:a,onComplete:o,onUpdate:c,isGenerator:u}=this.options;if(!u&&!Zxe(t,i,r,s))if(a)this.options.duration=0;else{c&&c(g_(t,this.options,n)),o&&o(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const HI=2e4;function BK(e){let t=0;const n=50;let i=e.next(t);for(;!i.done&&t =HI?1/0:t}const gr=(e,t,n)=>e+(t-e)*n;function jN(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function e1e({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,t/=100,n/=100;let r=0,s=0,a=0;if(!t)r=s=a=n;else{const o=n<.5?n*(1+t):n+t-n*t,c=2*n-o;r=jN(c,o,e+1/3),s=jN(c,o,e),a=jN(c,o,e-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:i}}function uk(e,t){return n=>n>0?t:e}const RN=(e,t,n)=>{const i=e*e,r=n*(t*t-i)+i;return r<0?0:Math.sqrt(r)},t1e=[FI,Fh,rg],n1e=e=>t1e.find(t=>t.test(e));function o8(e){const t=n1e(e);if(!t)return!1;let n=t.parse(e);return t===rg&&(n=e1e(n)),n}const l8=(e,t)=>{const n=o8(e),i=o8(t);if(!n||!i)return uk(e,t);const r={...n};return s=>(r.red=RN(n.red,i.red,s),r.green=RN(n.green,i.green,s),r.blue=RN(n.blue,i.blue,s),r.alpha=gr(n.alpha,i.alpha,s),Fh.transform(r))},i1e=(e,t)=>n=>t(e(n)),N1=(...e)=>e.reduce(i1e),YI=new Set(["none","hidden"]);function r1e(e,t){return YI.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function s1e(e,t){return n=>gr(e,t,n)}function PD(e){return typeof e=="number"?s1e:typeof e=="string"?pD(e)?uk:Hs.test(e)?l8:l1e:Array.isArray(e)?UK:typeof e=="object"?Hs.test(e)?l8:a1e:uk}function UK(e,t){const n=[...e],i=n.length,r=e.map((s,a)=>PD(s)(s,t[a]));return s=>{for(let a=0;a{for(const s in i)n[s]=i[s](r);return n}}function o1e(e,t){var n;const i=[],r={color:0,var:0,number:0};for(let s=0;s{const n=Mf.createTransformer(t),i=lx(e),r=lx(t);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?YI.has(e)&&!r.values.length||YI.has(t)&&!i.values.length?r1e(e,t):N1(UK(o1e(i,r),r.values),n):uk(e,t)};function zK(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?gr(e,t,n):PD(e)(e,t)}const c1e=5;function FK(e,t,n){const i=Math.max(t-c1e,0);return fK(n-e(i),t-i)}const wr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},IN=.001;function u1e({duration:e=wr.duration,bounce:t=wr.bounce,velocity:n=wr.velocity,mass:i=wr.mass}){let r,s,a=1-t;a=Zu(wr.minDamping,wr.maxDamping,a),e=Zu(wr.minDuration,wr.maxDuration,Qu(e)),a<1?(r=u=>{const d=u*a,f=d*e,h=d-n,p=GI(u,a),g=Math.exp(-f);return IN-h/p*g},s=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,g=Math.exp(-f),b=GI(Math.pow(u,2),a);return(-r(u)+IN>0?-1:1)*((h-p)*g)/b}):(r=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-IN+d*f},s=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const o=5/e,c=f1e(r,s,o);if(e=$u(e),isNaN(c))return{stiffness:wr.stiffness,damping:wr.damping,duration:e};{const u=Math.pow(c,2)*i;return{stiffness:u,damping:a*2*Math.sqrt(i*u),duration:e}}}const d1e=12;function f1e(e,t,n){let i=n;for(let r=1;r e[n]!==void 0)}function m1e(e){let t={velocity:wr.velocity,stiffness:wr.stiffness,damping:wr.damping,mass:wr.mass,isResolvedFromDuration:!1,...e};if(!c8(e,p1e)&&c8(e,h1e))if(e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(n*1.2),r=i*i,s=2*Zu(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:wr.mass,stiffness:r,damping:s}}else{const n=u1e(e);t={...t,...n,mass:wr.mass},t.isResolvedFromDuration=!0}return t}function VK(e=wr.visualDuration,t=wr.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:r}=n;const s=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:s},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=m1e({...n,velocity:-Qu(n.velocity||0)}),g=h||0,b=u/(2*Math.sqrt(c*d)),y=a-s,O=Qu(Math.sqrt(c/d)),v=Math.abs(y)<5;i||(i=v?wr.restSpeed.granular:wr.restSpeed.default),r||(r=v?wr.restDelta.granular:wr.restDelta.default);let x;if(b<1){const E=GI(O,b);x=S=>{const k=Math.exp(-b*O*S);return a-k*((g+b*O*y)/E*Math.sin(E*S)+y*Math.cos(E*S))}}else if(b===1)x=E=>a-Math.exp(-O*E)*(y+(g+O*y)*E);else{const E=O*Math.sqrt(b*b-1);x=S=>{const k=Math.exp(-b*O*S),T=Math.min(E*S,300);return a-k*((g+b*O*y)*Math.sinh(T)+E*y*Math.cosh(T))/E}}const w={calculatedDuration:p&&f||null,next:E=>{const S=x(E);if(p)o.done=E>=f;else{let k=0;b<1&&(k=E===0?$u(g):FK(x,E,S));const T=Math.abs(k)<=i,A=Math.abs(a-S)<=r;o.done=T&&A}return o.value=o.done?a:S,o},toString:()=>{const E=Math.min(BK(w),HI),S=pK(k=>w.next(E*k).value,E,30);return E+"ms "+S}};return w}function u8({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:a,min:o,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=T=>o!==void 0&&T c,g=T=>o===void 0?c:c===void 0||Math.abs(o-T) -b*Math.exp(-T/i),x=T=>O+v(T),w=T=>{const A=v(T),N=x(T);h.done=Math.abs(A)<=u,h.value=h.done?O:N};let E,S;const k=T=>{p(h.value)&&(E=T,S=VK({keyframes:[h.value,g(h.value)],velocity:FK(x,T,h.value),damping:r,stiffness:s,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:T=>{let A=!1;return!S&&E===void 0&&(A=!0,w(T),k(T)),E!==void 0&&T>=E?S.next(T-E):(!A&&w(T),h)}}}const g1e=A1(.42,0,1,1),b1e=A1(0,0,.58,1),XK=A1(.42,0,.58,1),O1e=e=>Array.isArray(e)&&typeof e[0]!="number",y1e={linear:ko,easeIn:g1e,easeInOut:XK,easeOut:b1e,circIn:ND,circInOut:EK,circOut:SK,backIn:AD,backInOut:vK,backOut:xK,anticipate:wK},d8=e=>{if(_D(e)){VZ(e.length===4);const[t,n,i,r]=e;return A1(t,n,i,r)}else if(typeof e=="string")return y1e[e];return e};function x1e(e,t,n){const i=[],r=n||zK,s=e.length-1;for(let a=0;a t[0];if(s===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=x1e(t,i,r),c=o.length,u=d=>{if(a&&d1)for(;f u(Zu(e[0],e[s-1],d)):u}function w1e(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const r=o0(0,t,i);e.push(gr(n,1,r))}}function S1e(e){const t=[0];return w1e(t,e.length-1),t}function E1e(e,t){return e.map(n=>n*t)}function k1e(e,t){return e.map(()=>t||XK).splice(0,e.length-1)}function dk({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const r=O1e(i)?i.map(d8):d8(i),s={done:!1,value:t[0]},a=E1e(n&&n.length===t.length?n:S1e(t),e),o=v1e(a,t,{ease:Array.isArray(r)?r:k1e(t,r)});return{calculatedDuration:e,next:c=>(s.value=o(c),s.done=c>=e,s)}}const T1e=e=>{const t=({timestamp:n})=>e(n);return{start:()=>er.update(t,!0),stop:()=>Pf(t),now:()=>_s.isProcessing?_s.timestamp:Lc.now()}},_1e={decay:u8,inertia:u8,tween:dk,keyframes:dk,spring:VK},A1e=e=>e/100;class MD extends QK{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:i,element:r,keyframes:s}=this.options,a=(r==null?void 0:r.KeyframeResolver)||ID,o=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(s,o,n,i,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:a=0}=this.options,o=TD(n)?n:_1e[n]||dk;let c,u;o!==dk&&typeof t[0]!="number"&&(c=N1(A1e,zK(t[0],t[1])),t=[0,100]);const d=o({...this.options,keyframes:t});s==="mirror"&&(u=o({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=BK(d));const{calculatedDuration:f}=d,h=f+r,p=h*(i+1)-r;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:i}=this;if(!i){const{keyframes:T}=this.options;return{done:!0,value:T[T.length-1]}}const{finalKeyframe:r,generator:s,mirroredGenerator:a,mapPercentToKeyframes:o,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=i;if(this.startTime===null)return s.next(0);const{delay:h,repeat:p,repeatType:g,repeatDelay:b,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const O=this.currentTime-h*(this.speed>=0?1:-1),v=this.speed>=0?O<0:O>d;this.currentTime=Math.max(O,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let x=this.currentTime,w=s;if(p){const T=Math.min(this.currentTime,d)/f;let A=Math.floor(T),N=T%1;!N&&T>=1&&(N=1),N===1&&A--,A=Math.min(A,p+1),!!(A%2)&&(g==="reverse"?(N=1-N,b&&(N-=b/f)):g==="mirror"&&(w=a)),x=Zu(0,1,N)*f}const E=v?{done:!1,value:c[0]}:w.next(x);o&&(E.value=o(E.value));let{done:S}=E;!v&&u!==null&&(S=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return k&&r!==void 0&&(E.value=g_(c,this.options,r)),y&&y(E.value),k&&this.finish(),E}get duration(){const{resolved:t}=this;return t?Qu(t.calculatedDuration):0}get time(){return Qu(this.currentTime)}set time(t){t=$u(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Qu(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=T1e,onPlay:n,startTime:i}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),n&&n();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=r):this.startTime=i??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const N1e=new Set(["opacity","clipPath","filter","transform"]);function C1e(e,t,n,{delay:i=0,duration:r=300,repeat:s=0,repeatType:a="loop",ease:o="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=gK(o,r);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:a==="reverse"?"alternate":"normal"})}const j1e=kD(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),fk=10,R1e=2e4;function I1e(e){return TD(e.type)||e.type==="spring"||!mK(e.ease)}function P1e(e,t){const n=new MD({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:e[0]};const r=[];let s=0;for(;!i.done&&s this.onKeyframesResolved(a,o),n,i,r),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:i=300,times:r,ease:s,type:a,motionValue:o,name:c,startTime:u}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof s=="string"&&ck()&&M1e(s)&&(s=qK[s]),I1e(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:g,...b}=this.options,y=P1e(t,b);t=y.keyframes,t.length===1&&(t[1]=t[0]),i=y.duration,r=y.times,s=y.ease,a="keyframes"}const d=C1e(o.owner.current,c,t,{...this.options,duration:i,times:r,ease:s});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(e8(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;o.set(g_(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:i,times:r,type:a,ease:s,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Qu(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Qu(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=$u(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return ko;const{animation:i}=n;e8(i,t)}return ko}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:i,duration:r,type:s,ease:a,times:o}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,g=new MD({...p,keyframes:i,duration:r,type:s,ease:a,times:o,isGenerator:!0}),b=$u(this.time);u.setWithVelocity(g.sample(b-fk).value,g.sample(b).value,fk)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:i,repeatDelay:r,repeatType:s,damping:a,type:o}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return j1e()&&i&&N1e.has(i)&&!c&&!u&&!r&&s!=="mirror"&&a!==0&&o!=="inertia"}}const L1e={type:"spring",stiffness:500,damping:25,restSpeed:10},D1e=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),$1e={type:"keyframes",duration:.8},Q1e={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},B1e=(e,{keyframes:t})=>t.length>2?$1e:zp.has(e)?e.startsWith("scale")?D1e(t[1]):L1e:Q1e;function U1e({when:e,delay:t,delayChildren:n,staggerChildren:i,staggerDirection:r,repeat:s,repeatType:a,repeatDelay:o,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const LD=(e,t,n,i={},r,s)=>a=>{const o=vD(i,e)||{},c=o.delay||i.delay||0;let{elapsed:u=0}=i;u=u-$u(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-u,onUpdate:h=>{t.set(h),o.onUpdate&&o.onUpdate(h)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:s?void 0:r};U1e(o)||(d={...d,...B1e(e,d)}),d.duration&&(d.duration=$u(d.duration)),d.repeatDelay&&(d.repeatDelay=$u(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!s&&t.get()!==void 0){const h=g_(d.keyframes,o);if(h!==void 0)return er.update(()=>{d.onUpdate(h),d.onComplete()}),new yxe([])}return!s&&f8.supports(d)?new f8(d):new MD(d)};function z1e({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,i}function HK(e,t,{delay:n=0,transitionOverride:i,type:r}={}){var s;let{transition:a=e.getDefaultTransition(),transitionEnd:o,...c}=t;i&&(a=i);const u=[],d=r&&e.animationState&&e.animationState.getState()[r];for(const f in c){const h=e.getValue(f,(s=e.latestValues[f])!==null&&s!==void 0?s:null),p=c[f];if(p===void 0||d&&z1e(d,f))continue;const g={delay:n,...vD(a||{},f)};let b=!1;if(window.MotionHandoffAnimation){const O=hK(e);if(O){const v=window.MotionHandoffAnimation(O,f,er);v!==null&&(g.startTime=v,b=!0)}}UI(e,f),h.start(LD(f,h,p,e.shouldReduceMotion&&dK.has(f)?{type:!1}:g,e,b));const y=h.animation;y&&u.push(y)}return o&&Promise.all(u).then(()=>{er.update(()=>{o&&mxe(e,o)})}),u}function WI(e,t,n={}){var i;const r=m_(e,t,n.type==="exit"?(i=e.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const a=r?()=>Promise.all(HK(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=s;return F1e(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=s;if(c){const[u,d]=c==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(n.delay)])}function F1e(e,t,n=0,i=0,r=1,s){const a=[],o=(e.variantChildren.size-1)*i,c=r===1?(u=0)=>u*i:(u=0)=>o-u*i;return Array.from(e.variantChildren).sort(V1e).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(WI(u,t,{...s,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function V1e(e,t){return e.sortNodePosition(t)}function X1e(e,t,n={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const r=t.map(s=>WI(e,s,n));i=Promise.all(r)}else if(typeof t=="string")i=WI(e,t,n);else{const r=typeof t=="function"?m_(e,t,n.custom):t;i=Promise.all(HK(e,r,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}const q1e=cD.length;function YK(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?YK(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n Promise.all(t.map(({animation:n,options:i})=>X1e(e,n,i)))}function W1e(e){let t=G1e(e),n=h8(),i=!0;const r=c=>(u,d)=>{var f;const h=m_(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:g,...b}=h;u={...u,...b,...g}}return u};function s(c){t=c(e)}function a(c){const{props:u}=e,d=YK(e.parent)||{},f=[],h=new Set;let p={},g=1/0;for(let y=0;y g&&w,A=!1;const N=Array.isArray(x)?x:[x];let j=N.reduce(r(O),{});E===!1&&(j={});const{prevResolvedValues:M={}}=v,D={...M,...j},L=I=>{T=!0,h.has(I)&&(A=!0,h.delete(I)),v.needsAnimating[I]=!0;const U=e.getValue(I);U&&(U.liveStyle=!1)};for(const I in D){const U=j[I],B=M[I];if(p.hasOwnProperty(I))continue;let P=!1;BI(U)&&BI(B)?P=!uK(U,B):P=U!==B,P?U!=null?L(I):h.add(I):U!==void 0&&h.has(I)?L(I):v.protectedKeys[I]=!0}v.prevProp=x,v.prevResolvedValues=j,v.isActive&&(p={...p,...j}),i&&e.blockInitialAnimation&&(T=!1),T&&(!(S&&k)||A)&&f.push(...N.map(I=>({animation:I,options:{type:O}})))}if(h.size){const y={};h.forEach(O=>{const v=e.getBaseTarget(O),x=e.getValue(O);x&&(x.liveStyle=!0),y[O]=v??null}),f.push({animation:y})}let b=!!f.length;return i&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),i=!1,b?t(f):Promise.resolve()}function o(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:o,setAnimateFunction:s,getState:()=>n,reset:()=>{n=h8(),i=!0}}}function Z1e(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!uK(t,e):!1}function mh(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function h8(){return{animate:mh(!0),whileInView:mh(),whileHover:mh(),whileTap:mh(),whileDrag:mh(),whileFocus:mh(),exit:mh()}}class eh{constructor(t){this.isMounted=!1,this.node=t}update(){}}class K1e extends eh{constructor(t){super(t),t.animationState||(t.animationState=W1e(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();h_(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let J1e=0;class eve extends eh{constructor(){super(...arguments),this.id=J1e++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const tve={animation:{Feature:K1e},exit:{Feature:eve}},El={x:!1,y:!1};function GK(){return El.x||El.y}function nve(e){return e==="x"||e==="y"?El[e]?null:(El[e]=!0,()=>{El[e]=!1}):El.x||El.y?null:(El.x=El.y=!0,()=>{El.x=El.y=!1})}const DD=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function cx(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n)}function C1(e){return{point:{x:e.pageX,y:e.pageY}}}const ive=e=>t=>DD(t)&&e(t,C1(t));function hy(e,t,n,i){return cx(e,t,ive(n),i)}const p8=(e,t)=>Math.abs(e-t);function rve(e,t){const n=p8(e.x,t.x),i=p8(e.y,t.y);return Math.sqrt(n**2+i**2)}class WK{constructor(t,n,{transformPagePoint:i,contextWindow:r,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=MN(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=rve(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:g}=f,{timestamp:b}=_s;this.history.push({...g,timestamp:b});const{onStart:y,onMove:O}=this.handlers;h||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),O&&O(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=PN(h,this.transformPagePoint),er.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:g,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=MN(f.type==="pointercancel"?this.lastMoveEventInfo:PN(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,y),g&&g(f,y)},!DD(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=i,this.contextWindow=r||window;const a=C1(t),o=PN(a,this.transformPagePoint),{point:c}=o,{timestamp:u}=_s;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,MN(o,this.history)),this.removeListeners=N1(hy(this.contextWindow,"pointermove",this.handlePointerMove),hy(this.contextWindow,"pointerup",this.handlePointerUp),hy(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Pf(this.updatePoint)}}function PN(e,t){return t?{point:t(e.point)}:e}function m8(e,t){return{x:e.x-t.x,y:e.y-t.y}}function MN({point:e},t){return{point:e,delta:m8(e,ZK(t)),offset:m8(e,sve(t)),velocity:ave(t,.1)}}function sve(e){return e[0]}function ZK(e){return e[e.length-1]}function ave(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const r=ZK(e);for(;n>=0&&(i=e[n],!(r.timestamp-i.timestamp>$u(t)));)n--;if(!i)return{x:0,y:0};const s=Qu(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const a={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const KK=1e-4,ove=1-KK,lve=1+KK,JK=.01,cve=0-JK,uve=0+JK;function Co(e){return e.max-e.min}function dve(e,t,n){return Math.abs(e-t)<=n}function g8(e,t,n,i=.5){e.origin=i,e.originPoint=gr(t.min,t.max,e.origin),e.scale=Co(n)/Co(t),e.translate=gr(n.min,n.max,e.origin)-e.originPoint,(e.scale>=ove&&e.scale<=lve||isNaN(e.scale))&&(e.scale=1),(e.translate>=cve&&e.translate<=uve||isNaN(e.translate))&&(e.translate=0)}function py(e,t,n,i){g8(e.x,t.x,n.x,i?i.originX:void 0),g8(e.y,t.y,n.y,i?i.originY:void 0)}function b8(e,t,n){e.min=n.min+t.min,e.max=e.min+Co(t)}function fve(e,t,n){b8(e.x,t.x,n.x),b8(e.y,t.y,n.y)}function O8(e,t,n){e.min=t.min-n.min,e.max=e.min+Co(t)}function my(e,t,n){O8(e.x,t.x,n.x),O8(e.y,t.y,n.y)}function hve(e,{min:t,max:n},i){return t!==void 0&&e n&&(e=i?gr(n,e,i.max):Math.min(e,n)),e}function y8(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function pve(e,{top:t,left:n,bottom:i,right:r}){return{x:y8(e.x,n,r),y:y8(e.y,t,i)}}function x8(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.min i?n=o0(t.min,t.max-i,e.min):i>r&&(n=o0(e.min,e.max-r,t.min)),Zu(0,1,n)}function bve(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ZI=.35;function Ove(e=ZI){return e===!1?e=0:e===!0&&(e=ZI),{x:v8(e,"left","right"),y:v8(e,"top","bottom")}}function v8(e,t,n){return{min:w8(e,t),max:w8(e,n)}}function w8(e,t){return typeof e=="number"?e:e[t]||0}const S8=()=>({translate:0,scale:1,origin:0,originPoint:0}),sg=()=>({x:S8(),y:S8()}),E8=()=>({min:0,max:0}),jr=()=>({x:E8(),y:E8()});function Qo(e){return[e("x"),e("y")]}function eJ({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function yve({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function xve(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function LN(e){return e===void 0||e===1}function KI({scale:e,scaleX:t,scaleY:n}){return!LN(e)||!LN(t)||!LN(n)}function Ah(e){return KI(e)||tJ(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function tJ(e){return k8(e.x)||k8(e.y)}function k8(e){return e&&e!=="0%"}function hk(e,t,n){const i=e-n,r=t*i;return n+r}function T8(e,t,n,i,r){return r!==void 0&&(e=hk(e,r,i)),hk(e,n,i)+t}function JI(e,t=0,n=1,i,r){e.min=T8(e.min,t,n,i,r),e.max=T8(e.max,t,n,i,r)}function nJ(e,{x:t,y:n}){JI(e.x,t.translate,t.scale,t.originPoint),JI(e.y,n.translate,n.scale,n.originPoint)}const _8=.999999999999,A8=1.0000000000001;function vve(e,t,n,i=!1){const r=n.length;if(!r)return;t.x=t.y=1;let s,a;for(let o=0;o _8&&(t.x=1),t.y _8&&(t.y=1)}function ag(e,t){e.min=e.min+t,e.max=e.max+t}function N8(e,t,n,i,r=.5){const s=gr(e.min,e.max,r);JI(e,t,n,s,i)}function og(e,t){N8(e.x,t.x,t.scaleX,t.scale,t.originX),N8(e.y,t.y,t.scaleY,t.scale,t.originY)}function iJ(e,t){return eJ(xve(e.getBoundingClientRect(),t))}function wve(e,t,n){const i=iJ(e,n),{scroll:r}=t;return r&&(ag(i.x,r.offset.x),ag(i.y,r.offset.y)),i}const rJ=({current:e})=>e?e.ownerDocument.defaultView:null,Sve=new WeakMap;class Eve{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=jr(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const r=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(C1(d).point)},s=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:g}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=nve(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Qo(y=>{let O=this.getAxisMotionValue(y).get()||0;if(Mc.test(O)){const{projection:v}=this.visualElement;if(v&&v.layout){const x=v.layout.layoutBox[y];x&&(O=Co(x)*(parseFloat(O)/100))}}this.originPoint[y]=O}),g&&er.postRender(()=>g(d,f)),UI(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:g,onDrag:b}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:y}=f;if(p&&this.currentDirection===null){this.currentDirection=kve(y),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),b&&b(d,f)},o=(d,f)=>this.stop(d,f),c=()=>Qo(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new WK(t,{onSessionStart:r,onStart:s,onMove:a,onSessionEnd:o,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:rJ(this.visualElement)})}stop(t,n){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:r}=n;this.startAnimation(r);const{onDragEnd:s}=this.getProps();s&&er.postRender(()=>s(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,i){const{drag:r}=this.getProps();if(!i||!iw(t,r,this.currentDirection))return;const s=this.getAxisMotionValue(t);let a=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(a=hve(a,this.constraints[t],this.elastic[t])),s.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:i}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,s=this.constraints;n&&ig(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&r?this.constraints=pve(r.layoutBox,n):this.constraints=!1,this.elastic=Ove(i),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Qo(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=bve(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!ig(t))return!1;const i=t.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=wve(i,r.root,this.visualElement.getTransformPagePoint());let a=mve(r.layout.layoutBox,s);if(n){const o=n(yve(a));this.hasMutatedConstraints=!!o,o&&(a=eJ(o))}return a}startAnimation(t){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),c=this.constraints||{},u=Qo(d=>{if(!iw(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=r?200:1e6,p=r?40:1e7,g={type:"inertia",velocity:i?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(o)}startAxisValueAnimation(t,n){const i=this.getAxisMotionValue(t);return UI(this.visualElement,t),i.start(LD(t,i,0,n,this.visualElement,!1))}stopAnimation(){Qo(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Qo(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),r=i[n];return r||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){Qo(n=>{const{drag:i}=this.getProps();if(!iw(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:a,max:o}=r.layout.layoutBox[n];s.set(t[n]-gr(a,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!ig(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Qo(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const c=o.get();r[a]=gve({min:c,max:c},this.constraints[a])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Qo(a=>{if(!iw(a,t,null))return;const o=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];o.set(gr(c,u,r[a]))})}addListeners(){if(!this.visualElement.current)return;Sve.set(this.visualElement,this);const t=this.visualElement.current,n=hy(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),i=()=>{const{dragConstraints:c}=this.getProps();ig(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,s=r.addEventListener("measure",i);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),er.read(i);const a=cx(window,"resize",()=>this.scalePositionWithinConstraints()),o=r.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Qo(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),s(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:a=ZI,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:a,dragMomentum:o}}}function iw(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function kve(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class Tve extends eh{constructor(t){super(t),this.removeGroupControls=ko,this.removeListeners=ko,this.controls=new Eve(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ko}unmount(){this.removeGroupControls(),this.removeListeners()}}const C8=e=>(t,n)=>{e&&er.postRender(()=>e(t,n))};class _ve extends eh{constructor(){super(...arguments),this.removePointerDownListener=ko}onPointerDown(t){this.session=new WK(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:rJ(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:C8(t),onStart:C8(n),onMove:i,onEnd:(s,a)=>{delete this.session,r&&er.postRender(()=>r(s,a))}}}mount(){this.removePointerDownListener=hy(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const BS={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function j8(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Jb={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Gt.test(e))e=parseFloat(e);else return e;const n=j8(e,t.target.x),i=j8(e,t.target.y);return`${n}% ${i}%`}},Ave={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,r=Mf.parse(e);if(r.length>5)return i;const s=Mf.createTransformer(e),a=typeof r[0]!="number"?1:0,o=n.x.scale*t.x,c=n.y.scale*t.y;r[0+a]/=o,r[1+a]/=c;const u=gr(o,c,.5);return typeof r[2+a]=="number"&&(r[2+a]/=u),typeof r[3+a]=="number"&&(r[3+a]/=u),s(r)}};class Nve extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=t;txe(Cve),s&&(n.group&&n.group.add(s),i&&i.register&&r&&i.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),BS.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:i,drag:r,isPresent:s}=this.props,a=i.projection;return a&&(a.isPresent=s,r||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?a.promote():a.relegate()||er.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),dD.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=t;r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function sJ(e){const[t,n]=zZ(),i=m.useContext(aD);return l.jsx(Nve,{...e,layoutGroup:i,switchLayoutGroup:m.useContext(ZZ),isPresent:t,safeToRemove:n})}const Cve={borderRadius:{...Jb,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Jb,borderTopRightRadius:Jb,borderBottomLeftRadius:Jb,borderBottomRightRadius:Jb,boxShadow:Ave};function jve(e,t,n){const i=Zs(e)?e:ox(e);return i.start(LD("",i,t,n)),i.animation}function Rve(e){return e instanceof SVGElement&&e.tagName!=="svg"}const Ive=(e,t)=>e.depth-t.depth;class Pve{constructor(){this.children=[],this.isDirty=!1}add(t){wD(this.children,t),this.isDirty=!0}remove(t){SD(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Ive),this.isDirty=!1,this.children.forEach(t)}}function Mve(e,t){const n=Lc.now(),i=({timestamp:r})=>{const s=r-n;s>=t&&(Pf(i),e(s-t))};return er.read(i,!0),()=>Pf(i)}const aJ=["TopLeft","TopRight","BottomLeft","BottomRight"],Lve=aJ.length,R8=e=>typeof e=="string"?parseFloat(e):e,I8=e=>typeof e=="number"||Gt.test(e);function Dve(e,t,n,i,r,s){r?(e.opacity=gr(0,n.opacity!==void 0?n.opacity:1,$ve(i)),e.opacityExit=gr(t.opacity!==void 0?t.opacity:1,0,Qve(i))):s&&(e.opacity=gr(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,i));for(let a=0;a i t?1:n(o0(e,t,i))}function M8(e,t){e.min=t.min,e.max=t.max}function $o(e,t){M8(e.x,t.x),M8(e.y,t.y)}function L8(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function D8(e,t,n,i,r){return e-=t,e=hk(e,1/n,i),r!==void 0&&(e=hk(e,1/r,i)),e}function Bve(e,t=0,n=1,i=.5,r,s=e,a=e){if(Mc.test(t)&&(t=parseFloat(t),t=gr(a.min,a.max,t/100)-a.min),typeof t!="number")return;let o=gr(s.min,s.max,i);e===s&&(o-=t),e.min=D8(e.min,t,n,o,r),e.max=D8(e.max,t,n,o,r)}function $8(e,t,[n,i,r],s,a){Bve(e,t[n],t[i],t[r],t.scale,s,a)}const Uve=["x","scaleX","originX"],zve=["y","scaleY","originY"];function Q8(e,t,n,i){$8(e.x,t,Uve,n?n.x:void 0,i?i.x:void 0),$8(e.y,t,zve,n?n.y:void 0,i?i.y:void 0)}function B8(e){return e.translate===0&&e.scale===1}function lJ(e){return B8(e.x)&&B8(e.y)}function U8(e,t){return e.min===t.min&&e.max===t.max}function Fve(e,t){return U8(e.x,t.x)&&U8(e.y,t.y)}function z8(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function cJ(e,t){return z8(e.x,t.x)&&z8(e.y,t.y)}function F8(e){return Co(e.x)/Co(e.y)}function V8(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class Vve{constructor(){this.members=[]}add(t){wD(this.members,t),t.scheduleRender()}remove(t){if(SD(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(r=>t===r);if(n===0)return!1;let i;for(let r=n;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1){i=s;break}}return i?(this.promote(i),!0):!1}promote(t,n){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,n&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;r===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:i}=t;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Xve(e,t,n){let i="";const r=e.x.translate/t.x,s=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((r||s||a)&&(i=`translate3d(${r}px, ${s}px, ${a}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:g}=n;u&&(i=`perspective(${u}px) ${i}`),d&&(i+=`rotate(${d}deg) `),f&&(i+=`rotateX(${f}deg) `),h&&(i+=`rotateY(${h}deg) `),p&&(i+=`skewX(${p}deg) `),g&&(i+=`skewY(${g}deg) `)}const o=e.x.scale*t.x,c=e.y.scale*t.y;return(o!==1||c!==1)&&(i+=`scale(${o}, ${c})`),i||"none"}const Nh={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},PO=typeof window<"u"&&window.MotionDebug!==void 0,DN=["","X","Y","Z"],qve={visibility:"hidden"},X8=1e3;let Hve=0;function $N(e,t,n,i){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),i&&(i[e]=0))}function uJ(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=hK(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",er,!(r||s))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&uJ(i)}function dJ({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(a={},o=t==null?void 0:t()){this.id=Hve++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,PO&&(Nh.totalNodes=Nh.resolvedTargetDeltas=Nh.recalculatedProjection=0),this.nodes.forEach(Wve),this.nodes.forEach(twe),this.nodes.forEach(nwe),this.nodes.forEach(Zve),PO&&window.MotionDebug.record(Nh)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let c=0;c this.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=Mve(h,250),BS.hasAnimatedSinceResize&&(BS.hasAnimatedSinceResize=!1,this.nodes.forEach(H8))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||owe,{onLayoutAnimationStart:y,onLayoutAnimationComplete:O}=d.getProps(),v=!this.targetLayout||!cJ(this.targetLayout,g)||p,x=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||x||h&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,x);const w={...vD(b,"layout"),onPlay:y,onComplete:O};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||H8(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Pf(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(iwe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&uJ(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d {this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c {const E=w/1e3;Y8(f.x,a.x,E),Y8(f.y,a.y,E),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(my(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),swe(this.relativeTarget,this.relativeTargetOrigin,h,E),x&&Fve(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=jr()),$o(x,this.relativeTarget)),b&&(this.animationValues=d,Dve(d,u,this.latestValues,E,v,O)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Pf(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=er.update(()=>{BS.hasAnimatedSinceResize=!0,this.currentAnimation=jve(0,X8,{...a,onUpdate:o=>{this.mixTargetDelta(o),a.onUpdate&&a.onUpdate(o)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(X8),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:c,layout:u,latestValues:d}=a;if(!(!o||!c||!u)){if(this!==a&&this.layout&&u&&fJ(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||jr();const f=Co(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=Co(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}$o(o,c),og(o,d),py(this.projectionDeltaWithTransform,this.layoutCorrected,o,d)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new Vve),this.sharedNodes.get(a).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(o=!0),!o)return;const u={};c.z&&$N("z",a,u,this.animationValues);for(let d=0;d {var o;return(o=a.currentAnimation)===null||o===void 0?void 0:o.stop()}),this.root.nodes.forEach(q8),this.root.sharedNodes.clear()}}}function Yve(e){e.updateLayout()}function Gve(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:r}=e.layout,{animationType:s}=e.options,a=n.source!==e.layout.source;s==="size"?Qo(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Co(h);h.min=i[f].min,h.max=h.min+p}):fJ(s,n.layoutBox,i)&&Qo(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Co(i[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const o=sg();py(o,i,n.layoutBox);const c=sg();a?py(c,e.applyTransform(r,!0),n.measuredBox):py(c,i,n.layoutBox);const u=!lJ(o);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const g=jr();my(g,n.layoutBox,h.layoutBox);const b=jr();my(b,i,p.layoutBox),cJ(g,b)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=g,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:c,layoutDelta:o,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:i}=e.options;i&&i()}e.options.transition=void 0}function Wve(e){PO&&Nh.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Zve(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Kve(e){e.clearSnapshot()}function q8(e){e.clearMeasurements()}function Jve(e){e.isLayoutDirty=!1}function ewe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function H8(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function twe(e){e.resolveTargetDelta()}function nwe(e){e.calcProjection()}function iwe(e){e.resetSkewAndRotation()}function rwe(e){e.removeLeadSnapshot()}function Y8(e,t,n){e.translate=gr(t.translate,0,n),e.scale=gr(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function G8(e,t,n,i){e.min=gr(t.min,n.min,i),e.max=gr(t.max,n.max,i)}function swe(e,t,n,i){G8(e.x,t.x,n.x,i),G8(e.y,t.y,n.y,i)}function awe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const owe={duration:.45,ease:[.4,0,.1,1]},W8=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Z8=W8("applewebkit/")&&!W8("chrome/")?Math.round:ko;function K8(e){e.min=Z8(e.min),e.max=Z8(e.max)}function lwe(e){K8(e.x),K8(e.y)}function fJ(e,t,n){return e==="position"||e==="preserve-aspect"&&!dve(F8(t),F8(n),.2)}function cwe(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const uwe=dJ({attachResizeListener:(e,t)=>cx(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),QN={current:void 0},hJ=dJ({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!QN.current){const e=new uwe({});e.mount(window),e.setOptions({layoutScroll:!0}),QN.current=e}return QN.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),dwe={pan:{Feature:_ve},drag:{Feature:Tve,ProjectionNode:hJ,MeasureLayout:sJ}};function fwe(e,t,n){var i;if(e instanceof Element)return[e];if(typeof e=="string"){let r=document;const s=(i=void 0)!==null&&i!==void 0?i:r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}function pJ(e,t){const n=fwe(e),i=new AbortController,r={passive:!0,...t,signal:i.signal};return[n,r,()=>i.abort()]}function J8(e){return t=>{t.pointerType==="touch"||GK()||e(t)}}function hwe(e,t,n={}){const[i,r,s]=pJ(e,n),a=J8(o=>{const{target:c}=o,u=t(o);if(typeof u!="function"||!c)return;const d=J8(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,r)});return i.forEach(o=>{o.addEventListener("pointerenter",a,r)}),s}function e9(e,t,n){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,s=i[r];s&&er.postRender(()=>s(t,C1(t)))}class pwe extends eh{mount(){const{current:t}=this.node;t&&(this.unmount=hwe(t,n=>(e9(this.node,n,"Start"),i=>e9(this.node,i,"End"))))}unmount(){}}class mwe extends eh{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=N1(cx(this.node.current,"focus",()=>this.onFocus()),cx(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const mJ=(e,t)=>t?e===t?!0:mJ(e,t.parentElement):!1,gwe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function bwe(e){return gwe.has(e.tagName)||e.tabIndex!==-1}const MO=new WeakSet;function t9(e){return t=>{t.key==="Enter"&&e(t)}}function BN(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Owe=(e,t)=>{const n=e.currentTarget;if(!n)return;const i=t9(()=>{if(MO.has(n))return;BN(n,"down");const r=t9(()=>{BN(n,"up")}),s=()=>BN(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)};function n9(e){return DD(e)&&!GK()}function ywe(e,t,n={}){const[i,r,s]=pJ(e,n),a=o=>{const c=o.currentTarget;if(!n9(o)||MO.has(c))return;MO.add(c);const u=t(o),d=(p,g)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!n9(p)||!MO.has(c))&&(MO.delete(c),typeof u=="function"&&u(p,{success:g}))},f=p=>{d(p,n.useGlobalTarget||mJ(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,r),window.addEventListener("pointercancel",h,r)};return i.forEach(o=>{!bwe(o)&&o.getAttribute("tabindex")===null&&(o.tabIndex=0),(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,r),o.addEventListener("focus",u=>Owe(u,r),r)}),s}function i9(e,t,n){const{props:i}=e;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),s=i[r];s&&er.postRender(()=>s(t,C1(t)))}class xwe extends eh{mount(){const{current:t}=this.node;t&&(this.unmount=ywe(t,n=>(i9(this.node,n,"Start"),(i,{success:r})=>i9(this.node,i,r?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const eP=new WeakMap,UN=new WeakMap,vwe=e=>{const t=eP.get(e.target);t&&t(e)},wwe=e=>{e.forEach(vwe)};function Swe({root:e,...t}){const n=e||document;UN.has(n)||UN.set(n,{});const i=UN.get(n),r=JSON.stringify(t);return i[r]||(i[r]=new IntersectionObserver(wwe,{root:e,...t})),i[r]}function Ewe(e,t,n){const i=Swe(t);return eP.set(e,n),i.observe(e),()=>{eP.delete(e),i.unobserve(e)}}const kwe={some:0,all:1};class Twe extends eh{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:s}=t,a={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:kwe[r]},o=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return Ewe(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(_we(t,n))&&this.startObserver()}unmount(){}}function _we({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Awe={inView:{Feature:Twe},tap:{Feature:xwe},focus:{Feature:mwe},hover:{Feature:pwe}},Nwe={layout:{ProjectionNode:hJ,MeasureLayout:sJ}},pk={current:null},$D={current:!1};function gJ(){if($D.current=!0,!!oD)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>pk.current=e.matches;e.addListener(t),t()}else pk.current=!1}const Cwe=[...DK,Hs,Mf],jwe=e=>Cwe.find(LK(e)),r9=new WeakMap;function Rwe(e,t,n){for(const i in t){const r=t[i],s=n[i];if(Zs(r))e.addValue(i,r);else if(Zs(s))e.addValue(i,ox(r,{owner:e}));else if(s!==r)if(e.hasValue(i)){const a=e.getValue(i);a.liveStyle===!0?a.jump(r):a.hasAnimated||a.set(r)}else{const a=e.getStaticValue(i);e.addValue(i,ox(a!==void 0?a:r,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const s9=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Iwe{scrapeMotionValuesFromProps(t,n,i){return{}}constructor({parent:t,props:n,presenceContext:i,reducedMotionConfig:r,blockInitialAnimation:s,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ID,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Lc.now();this.renderScheduledAt this.bindToMotionValue(i,n)),$D.current||gJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:pk.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){r9.delete(this.current),this.projection&&this.projection.unmount(),Pf(this.notifyUpdate),Pf(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const i=zp.has(t),r=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&er.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),s(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in a0){const n=a0[t];if(!n)continue;const{isEnabled:i,Feature:r}=n;if(!this.features[t]&&r&&i(this.props)&&(this.features[t]=new r(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):jr()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i
n.variantChildren.delete(t)}addValue(t,n){const i=this.values.get(t);n!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&n!==void 0&&(i=ox(n===null?void 0:n,{owner:this}),this.addValue(t,i)),i}readValue(t,n){var i;let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(i=this.getBaseTargetFromProps(this.props,t))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(PK(r)||kK(r))?r=parseFloat(r):!jwe(r)&&Mf.test(n)&&(r=jK(t,n)),this.setBaseTarget(t,Zs(r)?r.get():r)),Zs(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:i}=this.props;let r;if(typeof i=="string"||typeof i=="object"){const a=hD(this.props,i,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(r=a[t])}if(i&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Zs(s)?s:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new ED),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class bJ extends Iwe{constructor(){super(...arguments),this.KeyframeResolver=$K}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:i}){delete n[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Zs(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Pwe(e){return window.getComputedStyle(e)}class Mwe extends bJ{constructor(){super(...arguments),this.type="html",this.renderInstance=rK}readValueFromInstance(t,n){if(zp.has(n)){const i=RD(n);return i&&i.default||0}else{const i=Pwe(t),r=(tK(n)?i.getPropertyValue(n):i[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(t,{transformPagePoint:n}){return iJ(t,n)}build(t,n,i){gD(t,n,i.transformTemplate)}scrapeMotionValuesFromProps(t,n,i){return xD(t,n,i)}}class Lwe extends bJ{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=jr}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(zp.has(n)){const i=RD(n);return i&&i.default||0}return n=sK.has(n)?n:uD(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,i){return lK(t,n,i)}build(t,n,i){bD(t,n,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,i,r){aK(t,n,i,r)}mount(t){this.isSVGTag=yD(t.tagName),super.mount(t)}}const Dwe=(e,t)=>fD(e)?new Lwe(t):new Mwe(t,{allowProjection:e!==m.Fragment}),$we=uxe({...tve,...Awe,...dwe,...Nwe},Dwe),Er=kye($we);function Qwe(){!$D.current&&gJ();const[e]=m.useState(pk.current);return e}function ss(){return ss=Object.assign?Object.assign.bind():function(e){for(var t=1;t "u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?m.useEffect:m.useLayoutEffect;function Pm(e,t,n){var i=m.useRef(t);i.current=t,m.useEffect(function(){function r(s){i.current(s)}return e&&window.addEventListener(e,r,n),function(){e&&window.removeEventListener(e,r)}},[e])}var Bwe=["container"];function Uwe(e){var t=e.container,n=t===void 0?document.body:t,i=b_(e,Bwe);return $i.createPortal(xn.createElement("div",ss({},i)),n)}function zwe(e){return xn.createElement("svg",ss({width:"44",height:"44",viewBox:"0 0 768 768"},e),xn.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function Fwe(e){return xn.createElement("svg",ss({width:"44",height:"44",viewBox:"0 0 768 768"},e),xn.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function Vwe(e){return xn.createElement("svg",ss({width:"44",height:"44",viewBox:"0 0 768 768"},e),xn.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function Xwe(){return m.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function o9(e){var t=e.touches[0],n=t.clientX,i=t.clientY;if(e.touches.length>=2){var r=e.touches[1],s=r.clientX,a=r.clientY;return[(n+s)/2,(i+a)/2,Math.sqrt(Math.pow(s-n,2)+Math.pow(a-i,2))]}return[n,i,0]}var qd=function(e,t,n,i){var r,s=n*t,a=(s-i)/2,o=e;return s<=i?(r=1,o=0):e>0&&a-e<=0?(r=2,o=a):e<0&&a+e<=0&&(r=3,o=-a),[r,o]};function zN(e,t,n,i,r,s,a,o,c,u){a===void 0&&(a=innerWidth/2),o===void 0&&(o=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=qd(e,s,n,innerWidth)[0],f=qd(t,s,i,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-s/r*(a-(h+e))-h+(i/n>=3&&n*s===innerWidth?0:d?c/2:c),y:o-s/r*(o-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:o}}function iP(e,t,n){var i=e%180!=0;return i?[n,t,i]:[t,n,i]}function FN(e,t,n){var i=iP(n,innerWidth,innerHeight),r=i[0],s=i[1],a=0,o=r,c=s,u=e/t*s,d=t/e*r;return e =s?o=u:e>=r&&t r/s?c=d:t/e>=3&&!i[2]?a=((c=d)-s)/2:o=u,{width:o,height:c,x:0,y:a,pause:!0}}function sw(e,t){var n=t.leading,i=n!==void 0&&n,r=t.maxWait,s=t.wait,a=s===void 0?r||0:s,o=m.useRef(e);o.current=e;var c=m.useRef(0),u=m.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=m.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function g(){c.current=p,d(),o.current.apply(null,h)}var b=c.current,y=p-b;if(b===0&&(i&&g(),c.current=p),r!==void 0){if(y>r)return void g()}else y=1&&s&&s())};d()}function d(){c=requestAnimationFrame(u)}}var Hwe={T:0,L:0,W:0,H:0,FIT:void 0},yJ=function(){var e=m.useRef(!1);return m.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},Ywe=["className"];function Gwe(e){var t=e.className,n=t===void 0?"":t,i=b_(e,Ywe);return xn.createElement("div",ss({className:"PhotoView__Spinner "+n},i),xn.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},xn.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),xn.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var Wwe=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function Zwe(e){var t=e.src,n=e.loaded,i=e.broken,r=e.className,s=e.onPhotoLoad,a=e.loadingElement,o=e.brokenElement,c=b_(e,Wwe),u=yJ();return t&&!i?xn.createElement(xn.Fragment,null,xn.createElement("img",ss({className:"PhotoView__Photo"+(r?" "+r:""),src:t,onLoad:function(d){var f=d.target;u.current&&s({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&s({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?xn.createElement("span",{className:"PhotoView__icon"},a):xn.createElement(Gwe,{className:"PhotoView__icon"}))):o?xn.createElement("span",{className:"PhotoView__icon"},typeof o=="function"?o({src:t}):o):null}var Kwe={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function Jwe(e){var t=e.item,n=t.src,i=t.render,r=t.width,s=r===void 0?0:r,a=t.height,o=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,g=e.style,b=e.loadingElement,y=e.brokenElement,O=e.onPhotoTap,v=e.onMaskTap,x=e.onReachMove,w=e.onReachUp,E=e.onPhotoResize,S=e.isActive,k=e.expose,T=mk(Kwe),A=T[0],N=T[1],j=m.useRef(0),M=yJ(),D=A.naturalWidth,L=D===void 0?s:D,Q=A.naturalHeight,C=Q===void 0?o:Q,I=A.width,U=I===void 0?s:I,B=A.height,P=B===void 0?o:B,q=A.loaded,G=q===void 0?!n:q,$=A.broken,V=A.x,te=A.y,fe=A.touched,Te=A.stopRaf,J=A.maskTouched,ne=A.rotate,ce=A.scale,Oe=A.CX,Se=A.CY,je=A.lastX,ve=A.lastY,be=A.lastCX,ae=A.lastCY,Re=A.lastScale,xe=A.touchTime,Be=A.touchLength,qe=A.pause,Pe=A.reach,mt=rp({onScale:function(Ne){return bt(rw(Ne))},onRotate:function(Ne){ne!==Ne&&(k({rotate:Ne}),N(ss({rotate:Ne},FN(L,C,Ne))))}});function bt(Ne,tt,St){ce!==Ne&&(k({scale:Ne}),N(ss({scale:Ne},zN(V,te,U,P,ce,Ne,tt,St),Ne<=1&&{x:0,y:0})))}var Dt=sw(function(Ne,tt,St){if(St===void 0&&(St=0),(fe||J)&&S){var Wt=iP(ne,U,P),Ve=Wt[0],vn=Wt[1];if(St===0&&j.current===0){var nn=Math.abs(Ne-Oe)<=20,Nt=Math.abs(tt-Se)<=20;if(nn&&Nt)return void N({lastCX:Ne,lastCY:tt});j.current=nn?tt>Se?3:2:1}var Ft,Ce=Ne-be,Ze=tt-ae;if(St===0){var kt=qd(Ce+je,ce,Ve,innerWidth)[0],Zt=qd(Ze+ve,ce,vn,innerHeight);Ft=function(hi,Ie,ut,Rt){return Ie&&hi===1||Rt==="x"?"x":ut&&hi>1||Rt==="y"?"y":void 0}(j.current,kt,Zt[0],Pe),Ft!==void 0&&x(Ft,Ne,tt,ce)}if(Ft==="x"||J)return void N({reach:"x"});var Kt=rw(ce+(St-Be)/100/2*ce,L/U,.2);k({scale:Kt}),N(ss({touchLength:St,reach:Ft,scale:Kt},zN(V,te,U,P,ce,Kt,Ne,tt,Ce,Ze)))}},{maxWait:8});function We(Ne){return!Te&&!fe&&(M.current&&N(ss({},Ne,{pause:u})),M.current)}var W,ee,se,he,F,_e,Ue,Xe,_t=(F=function(Ne){return We({x:Ne})},_e=function(Ne){return We({y:Ne})},Ue=function(Ne){return M.current&&(k({scale:Ne}),N({scale:Ne})),!fe&&M.current},Xe=rp({X:function(Ne){return F(Ne)},Y:function(Ne){return _e(Ne)},S:function(Ne){return Ue(Ne)}}),function(Ne,tt,St,Wt,Ve,vn,nn,Nt,Ft,Ce,Ze){var kt=iP(Ce,Ve,vn),Zt=kt[0],Kt=kt[1],hi=qd(Ne,Nt,Zt,innerWidth),Ie=hi[0],ut=hi[1],Rt=qd(tt,Nt,Kt,innerHeight),Ut=Rt[0],Sn=Rt[1],hn=Date.now()-Ze;if(hn>=200||Nt!==nn||Math.abs(Ft-nn)>1){var Si=zN(Ne,tt,Ve,vn,nn,Nt),bi=Si.x,Qi=Si.y,de=Ie?ut:bi!==Ne?bi:null,Me=Ut?Sn:Qi!==tt?Qi:null;return de!==null&&Mh(Ne,de,Xe.X),Me!==null&&Mh(tt,Me,Xe.Y),void(Nt!==nn&&Mh(nn,Nt,Xe.S))}var dt=(Ne-St)/hn,ft=(tt-Wt)/hn,on=Math.sqrt(Math.pow(dt,2)+Math.pow(ft,2)),Kn=!1,Ei=!1;(function(Jn,bn){var Yn,ri=Jn,qt=0,Oi=0,ln=function(Ar){Yn||(Yn=Ar);var Bi=Ar-Yn,Dn=Math.sign(Jn),Qs=-.001*Dn,Yi=Math.sign(-ri)*Math.pow(ri,2)*2e-4,Sa=ri*Bi+(Qs+Yi)*Math.pow(Bi,2)/2;qt+=Sa,Yn=Ar,Dn*(ri+=(Qs+Yi)*Bi)<=0?cn():bn(qt)?Ri():cn()};function Ri(){Oi=requestAnimationFrame(ln)}function cn(){cancelAnimationFrame(Oi)}Ri()})(on,function(Jn){var bn=Ne+Jn*(dt/on),Yn=tt+Jn*(ft/on),ri=qd(bn,nn,Zt,innerWidth),qt=ri[0],Oi=ri[1],ln=qd(Yn,nn,Kt,innerHeight),Ri=ln[0],cn=ln[1];if(qt&&!Kn&&(Kn=!0,Ie?Mh(bn,Oi,Xe.X):l9(Oi,bn+(bn-Oi),Xe.X)),Ri&&!Ei&&(Ei=!0,Ut?Mh(Yn,cn,Xe.Y):l9(cn,Yn+(Yn-cn),Xe.Y)),Kn&&Ei)return!1;var Ar=Kn||Xe.X(Oi),Bi=Ei||Xe.Y(cn);return Ar&&Bi})}),Bt=(W=O,ee=function(Ne,tt){Pe||bt(ce!==1?1:Math.max(2,L/U),Ne,tt)},se=m.useRef(0),he=sw(function(){se.current=0,W.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var Ne=[].slice.call(arguments);se.current+=1,he.apply(void 0,Ne),se.current>=2&&(he.cancel(),se.current=0,ee.apply(void 0,Ne))});function Et(Ne,tt){if(j.current=0,(fe||J)&&S){N({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var St=rw(ce,L/U);if(_t(V,te,je,ve,U,P,ce,St,Re,ne,xe),w(Ne,tt),Oe===Ne&&Se===tt){if(fe)return void Bt(Ne,tt);J&&v(Ne,tt)}}}function at(Ne,tt,St){St===void 0&&(St=0),N({touched:!0,CX:Ne,CY:tt,lastCX:Ne,lastCY:tt,lastX:V,lastY:te,lastScale:ce,touchLength:St,touchTime:Date.now()})}function pe(Ne){N({maskTouched:!0,CX:Ne.clientX,CY:Ne.clientY,lastX:V,lastY:te})}Pm(bu?void 0:"mousemove",function(Ne){Ne.preventDefault(),Dt(Ne.clientX,Ne.clientY)}),Pm(bu?void 0:"mouseup",function(Ne){Et(Ne.clientX,Ne.clientY)}),Pm(bu?"touchmove":void 0,function(Ne){Ne.preventDefault();var tt=o9(Ne);Dt.apply(void 0,tt)},{passive:!1}),Pm(bu?"touchend":void 0,function(Ne){var tt=Ne.changedTouches[0];Et(tt.clientX,tt.clientY)},{passive:!1}),Pm("resize",sw(function(){G&&!fe&&(N(FN(L,C,ne)),E())},{maxWait:8})),nP(function(){S&&k(ss({scale:ce,rotate:ne},mt))},[S]);var ct=function(Ne,tt,St,Wt,Ve,vn,nn,Nt,Ft,Ce){var Ze=function(bi,Qi,de,Me,dt){var ft=m.useRef(!1),on=mk({lead:!0,scale:de}),Kn=on[0],Ei=Kn.lead,Jn=Kn.scale,bn=on[1],Yn=sw(function(ri){try{return dt(!0),bn({lead:!1,scale:ri}),Promise.resolve()}catch(qt){return Promise.reject(qt)}},{wait:Me});return nP(function(){ft.current?(dt(!1),bn({lead:!0}),Yn(de)):ft.current=!0},[de]),Ei?[bi*Jn,Qi*Jn,de/Jn]:[bi*de,Qi*de,1]}(vn,nn,Nt,Ft,Ce),kt=Ze[0],Zt=Ze[1],Kt=Ze[2],hi=function(bi,Qi,de,Me,dt){var ft=m.useState(Hwe),on=ft[0],Kn=ft[1],Ei=m.useState(0),Jn=Ei[0],bn=Ei[1],Yn=m.useRef(),ri=rp({OK:function(){return bi&&bn(4)}});function qt(Oi){dt(!1),bn(Oi)}return m.useEffect(function(){if(Yn.current||(Yn.current=Date.now()),de){if(function(Oi,ln){var Ri=Oi&&Oi.current;if(Ri&&Ri.nodeType===1){var cn=Ri.getBoundingClientRect();ln({T:cn.top,L:cn.left,W:cn.width,H:cn.height,FIT:Ri.tagName==="IMG"?getComputedStyle(Ri).objectFit:void 0})}}(Qi,Kn),bi)return Date.now()-Yn.current<250?(bn(1),requestAnimationFrame(function(){bn(2),requestAnimationFrame(function(){return qt(3)})}),void setTimeout(ri.OK,Me)):void bn(4);qt(5)}},[bi,de]),[Jn,on]}(Ne,tt,St,Ft,Ce),Ie=hi[0],ut=hi[1],Rt=ut.W,Ut=ut.FIT,Sn=innerWidth/2,hn=innerHeight/2,Si=Ie<3||Ie>4;return[Si?Rt?ut.L:Sn:Wt+(Sn-vn*Nt/2),Si?Rt?ut.T:hn:Ve+(hn-nn*Nt/2),kt,Si&&Ut?kt*(ut.H/Rt):Zt,Ie===0?Kt:Si?Rt/(vn*Nt)||.01:Kt,Si?Ut?1:0:1,Ie,Ut]}(u,c,G,V,te,U,P,ce,d,function(Ne){return N({pause:Ne})}),et=ct[4],yt=ct[6],At="transform "+d+"ms "+f,$t={className:p,onMouseDown:bu?void 0:function(Ne){Ne.stopPropagation(),Ne.button===0&&at(Ne.clientX,Ne.clientY,0)},onTouchStart:bu?function(Ne){Ne.stopPropagation(),at.apply(void 0,o9(Ne))}:void 0,onWheel:function(Ne){if(!Pe){var tt=rw(ce-Ne.deltaY/100/2,L/U);N({stopRaf:!0}),bt(tt,Ne.clientX,Ne.clientY)}},style:{width:ct[2]+"px",height:ct[3]+"px",opacity:ct[5],objectFit:yt===4?void 0:ct[7],transform:ne?"rotate("+ne+"deg)":void 0,transition:yt>2?At+", opacity "+d+"ms ease, height "+(yt<4?d/2:yt>4?d:0)+"ms "+f:void 0}};return xn.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:g,onMouseDown:!bu&&S?pe:void 0,onTouchStart:bu&&S?function(Ne){return pe(Ne.touches[0])}:void 0},xn.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+et+", 0, 0, "+et+", "+ct[0]+", "+ct[1]+")",transition:fe||qe?void 0:At,willChange:S?"transform":void 0}},n?xn.createElement(Zwe,ss({src:n,loaded:G,broken:$},$t,{onPhotoLoad:function(Ne){N(ss({},Ne,Ne.loaded&&FN(Ne.naturalWidth||0,Ne.naturalHeight||0,ne)))},loadingElement:b,brokenElement:y})):i&&i({attrs:$t,scale:et,rotate:ne})))}var c9={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function eSe(e){var t=e.loop,n=t===void 0?3:t,i=e.speed,r=e.easing,s=e.photoClosable,a=e.maskClosable,o=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,g=e.overlayRender,b=e.toolbarRender,y=e.className,O=e.maskClassName,v=e.photoClassName,x=e.photoWrapClassName,w=e.loadingElement,E=e.brokenElement,S=e.images,k=e.index,T=k===void 0?0:k,A=e.onIndexChange,N=e.visible,j=e.onClose,M=e.afterClose,D=e.portalContainer,L=mk(c9),Q=L[0],C=L[1],I=m.useState(0),U=I[0],B=I[1],P=Q.x,q=Q.touched,G=Q.pause,$=Q.lastCX,V=Q.lastCY,te=Q.bg,fe=te===void 0?u:te,Te=Q.lastBg,J=Q.overlay,ne=Q.minimal,ce=Q.scale,Oe=Q.rotate,Se=Q.onScale,je=Q.onRotate,ve=e.hasOwnProperty("index"),be=ve?T:U,ae=ve?A:B,Re=m.useRef(be),xe=S.length,Be=S[be],qe=typeof n=="boolean"?n:xe>n,Pe=function(et,yt){var At=m.useReducer(function(St){return!St},!1)[1],$t=m.useRef(0),Ne=function(St){var Wt=m.useRef(St);function Ve(vn){Wt.current=vn}return m.useMemo(function(){(function(vn){et?(vn(et),$t.current=1):$t.current=2})(Ve)},[St]),[Wt.current,Ve]}(et),tt=Ne[1];return[Ne[0],$t.current,function(){At(),$t.current===2&&(tt(!1),yt&&yt()),$t.current=0}]}(N,M),mt=Pe[0],bt=Pe[1],Dt=Pe[2];nP(function(){if(mt)return C({pause:!0,x:be*-(innerWidth+dm)}),void(Re.current=be);C(c9)},[mt]);var We=rp({close:function(et){je&&je(0),C({overlay:!0,lastBg:fe}),j(et)},changeIndex:function(et,yt){yt===void 0&&(yt=!1);var At=qe?Re.current+(et-be):et,$t=xe-1,Ne=tP(At,0,$t),tt=qe?At:Ne,St=innerWidth+dm;C({touched:!1,lastCX:void 0,lastCY:void 0,x:-St*tt,pause:yt}),Re.current=tt,ae&&ae(qe?et<0?$t:et>$t?0:et:Ne)}}),W=We.close,ee=We.changeIndex;function se(et){return et?W():C({overlay:!J})}function he(){C({x:-(innerWidth+dm)*be,lastCX:void 0,lastCY:void 0,pause:!0}),Re.current=be}function F(et,yt,At,$t){et==="x"?function(Ne){if($!==void 0){var tt=Ne-$,St=tt;!qe&&(be===0&&tt>0||be===xe-1&&tt<0)&&(St=tt/2),C({touched:!0,lastCX:$,x:-(innerWidth+dm)*Re.current+St,pause:!1})}else C({touched:!0,lastCX:Ne,x:P,pause:!1})}(yt):et==="y"&&function(Ne,tt){if(V!==void 0){var St=u===null?null:tP(u,.01,u-Math.abs(Ne-V)/100/4);C({touched:!0,lastCY:V,bg:tt===1?St:u,minimal:tt===1})}else C({touched:!0,lastCY:Ne,bg:fe,minimal:!0})}(At,$t)}function _e(et,yt){var At=et-($??et),$t=yt-(V??yt),Ne=!1;if(At<-40)ee(be+1);else if(At>40)ee(be-1);else{var tt=-(innerWidth+dm)*Re.current;Math.abs($t)>100&&ne&&f&&(Ne=!0,W()),C({touched:!1,x:tt,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!Ne||J})}}Pm("keydown",function(et){if(N)switch(et.key){case"ArrowLeft":ee(be-1,!0);break;case"ArrowRight":ee(be+1,!0);break;case"Escape":W()}});var Ue=function(et,yt,At){return m.useMemo(function(){var $t=et.length;return At?et.concat(et).concat(et).slice($t+yt-1,$t+yt+2):et.slice(Math.max(yt-1,0),Math.min(yt+2,$t+1))},[et,yt,At])}(S,be,qe);if(!mt)return null;var Xe=J&&!bt,_t=N?fe:Te,Bt=Se&&je&&{images:S,index:be,visible:N,onClose:W,onIndexChange:ee,overlayVisible:Xe,overlay:Be&&Be.overlay,scale:ce,rotate:Oe,onScale:Se,onRotate:je},Et=i?i(bt):400,at=r?r(bt):a9,pe=i?i(3):600,ct=r?r(3):a9;return xn.createElement(Uwe,{className:"PhotoView-Portal"+(Xe?"":" PhotoView-Slider__clean")+(N?"":" PhotoView-Slider__willClose")+(y?" "+y:""),role:"dialog",onClick:function(et){return et.stopPropagation()},container:D},N&&xn.createElement(Xwe,null),xn.createElement("div",{className:"PhotoView-Slider__Backdrop"+(O?" "+O:"")+(bt===1?" PhotoView-Slider__fadeIn":bt===2?" PhotoView-Slider__fadeOut":""),style:{background:_t?"rgba(0, 0, 0, "+_t+")":void 0,transitionTimingFunction:at,transitionDuration:(q?0:Et)+"ms",animationDuration:Et+"ms"},onAnimationEnd:Dt}),p&&xn.createElement("div",{className:"PhotoView-Slider__BannerWrap"},xn.createElement("div",{className:"PhotoView-Slider__Counter"},be+1," / ",xe),xn.createElement("div",{className:"PhotoView-Slider__BannerRight"},b&&Bt&&b(Bt),xn.createElement(zwe,{className:"PhotoView-Slider__toolbarIcon",onClick:W}))),Ue.map(function(et,yt){var At=qe||be!==0?Re.current-1+yt:be+yt;return xn.createElement(Jwe,{key:qe?et.key+"/"+et.src+"/"+At:et.key,item:et,speed:Et,easing:at,visible:N,onReachMove:F,onReachUp:_e,onPhotoTap:function(){return se(s)},onMaskTap:function(){return se(o)},wrapClassName:x,className:v,style:{left:(innerWidth+dm)*At+"px",transform:"translate3d("+P+"px, 0px, 0)",transition:q||G?void 0:"transform "+pe+"ms "+ct},loadingElement:w,brokenElement:E,onPhotoResize:he,isActive:Re.current===At,expose:C})}),!bu&&p&&xn.createElement(xn.Fragment,null,(qe||be!==0)&&xn.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ee(be-1,!0)}},xn.createElement(Fwe,null)),(qe||be+1-1){var O=u.slice();return O.splice(y,1,b),void o({images:O})}o(function(v){return{images:v.images.concat(b)}})},remove:function(b){o(function(y){var O=y.images.filter(function(v){return v.key!==b});return{images:O,index:Math.min(O.length-1,f)}})},show:function(b){var y=u.findIndex(function(O){return O.key===b});o({visible:!0,index:y}),i&&i(!0,y,a)}}),p=rp({close:function(){o({visible:!1}),i&&i(!1,f,a)},changeIndex:function(b){o({index:b}),n&&n(b,a)}}),g=m.useMemo(function(){return ss({},a,h)},[a,h]);return xn.createElement(OJ.Provider,{value:g},t,xn.createElement(eSe,ss({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},r)))}var xJ=function(e){var t,n,i=e.src,r=e.render,s=e.overlay,a=e.width,o=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=m.useContext(OJ),h=(t=function(){return f.nextId()},(n=m.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=m.useRef(null);m.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),m.useEffect(function(){return function(){f.remove(h)}},[]);var g=rp({render:function(y){return r&&r(y)},show:function(y,O){f.show(h),function(v,x){if(d){var w=d.props[v];w&&w(x)}}(y,O)}}),b=m.useMemo(function(){var y={};return u.forEach(function(O){y[O]=g.show.bind(null,O)}),y},[]);return m.useEffect(function(){f.update({key:h,src:i,originRef:p,render:g.render,overlay:s,width:a,height:o})},[i]),d?m.Children.only(m.cloneElement(d,ss({},b,{ref:p}))):null};const rSe=e=>l.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[l.jsx("path",{d:"M22 6.017c0-1.104-.907-2.037-2.049-2l-.594.025c-2.732.148-4.952.705-7.333 1.953l-.512.279-.087.054a1 1 0 0 0 .971 1.737l.092-.046.454-.246C15.195 6.59 17.26 6.106 20 6.016v11.837c-3.034.046-5.42.582-7.99 1.99l-.517.295-.086.056a1 1 0 0 0 1.009 1.715l.09-.047.455-.258c2.105-1.157 4.045-1.645 6.537-1.738l.543-.014a1.995 1.995 0 0 0 1.95-1.8l.009-.198V6.017Z"}),l.jsx("path",{d:"M2 6.017c0-1.104.907-2.037 2.049-2l.594.025c2.732.148 4.952.705 7.333 1.953l.512.279.087.054a1 1 0 0 1-.971 1.737l-.092-.046-.454-.246C8.805 6.59 6.74 6.106 4 6.016v11.837c3.034.046 5.42.582 7.99 1.99l.517.295.086.056a1 1 0 0 1-1.009 1.715l-.09-.047-.455-.258c-2.105-1.157-4.045-1.644-6.537-1.738l-.543-.014a1.995 1.995 0 0 1-1.95-1.8L2 17.855V6.017Z"}),l.jsx("path",{d:"M13 7.5v13h-2v-13h2Z"})]}),sSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{fillRule:"evenodd",d:"M10.556 4a1 1 0 0 0-.97.751l-.292 1.14h5.421l-.293-1.14A1 1 0 0 0 13.453 4h-2.897Zm6.224 1.892-.421-1.639A3 3 0 0 0 13.453 2h-2.897A3 3 0 0 0 7.65 4.253l-.421 1.639H4a1 1 0 1 0 0 2h.1l1.215 11.425A3 3 0 0 0 8.3 22h7.4a3 3 0 0 0 2.984-2.683l1.214-11.425H20a1 1 0 1 0 0-2h-3.22Zm1.108 2H6.112l1.192 11.214A1 1 0 0 0 8.3 20h7.4a1 1 0 0 0 .995-.894l1.192-11.214ZM10 10a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Zm4 0a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),aSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{fillRule:"evenodd",d:"M16.793 2.793a3.121 3.121 0 1 1 4.414 4.414l-8.5 8.5A1 1 0 0 1 12 16H9a1 1 0 0 1-1-1v-3a1 1 0 0 1 .293-.707l8.5-8.5Zm3 1.414a1.121 1.121 0 0 0-1.586 0L10 12.414V14h1.586l8.207-8.207a1.121 1.121 0 0 0 0-1.586ZM6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-4a1 1 0 1 1 2 0v4a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h4a1 1 0 1 1 0 2H6Z",clipRule:"evenodd"})}),oSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{fillRule:"evenodd",d:"M4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-10C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm4.465 6.763a1 1 0 0 0-1.228-1.228l-5.5 1.5a1 1 0 0 0-.702.702l-1.5 5.5a1 1 0 0 0 1.228 1.228l5.5-1.5a1 1 0 0 0 .702-.702l1.5-5.5Zm-6.54 5.312.89-3.26 3.26-.89-.89 3.26-3.26.89Z",clipRule:"evenodd"})}),lSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{d:"M5.91456 7.59106C4.34202 9.04124 3.28878 10.7415 2.77064 11.6971C2.66597 11.8902 2.66597 12.1098 2.77064 12.3029C3.28878 13.2585 4.34202 14.9588 5.91456 16.4089C7.48207 17.8545 9.50584 19 12.0001 19C14.4944 19 16.5182 17.8545 18.0857 16.4089C19.6582 14.9588 20.7114 13.2585 21.2296 12.3029C21.3343 12.1098 21.3343 11.8902 21.2296 11.6971C20.7114 10.7415 19.6582 9.04124 18.0857 7.59105C16.5182 6.1455 14.4944 5 12.0001 5C9.50584 5 7.48207 6.1455 5.91456 7.59106ZM4.5587 6.1208C6.36071 4.45899 8.84593 3 12.0001 3C15.1543 3 17.6395 4.45899 19.4415 6.1208C21.2385 7.77798 22.4153 9.68799 22.9878 10.7438C23.4149 11.5315 23.4149 12.4685 22.9878 13.2562C22.4153 14.312 21.2385 16.222 19.4415 17.8792C17.6395 19.541 15.1543 21 12.0001 21C8.84593 21 6.36071 19.541 4.5587 17.8792C2.76171 16.222 1.5849 14.312 1.01244 13.2562C0.585372 12.4685 0.585371 11.5315 1.01244 10.7438C1.5849 9.688 2.76171 7.77798 4.5587 6.1208ZM12.0001 9.5C10.6194 9.5 9.50011 10.6193 9.50011 12C9.50011 13.3807 10.6194 14.5 12.0001 14.5C13.3808 14.5 14.5001 13.3807 14.5001 12C14.5001 10.6193 13.3808 9.5 12.0001 9.5ZM7.50011 12C7.50011 9.51472 9.51483 7.5 12.0001 7.5C14.4854 7.5 16.5001 9.51472 16.5001 12C16.5001 14.4853 14.4854 16.5 12.0001 16.5C9.51483 16.5 7.50011 14.4853 7.50011 12Z",fill:"currentColor"})}),cSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"})}),uSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{d:"M12 6C12.5523 6 13 6.44772 13 7V11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H13V17C13 17.5523 12.5523 18 12 18C11.4477 18 11 17.5523 11 17V13H7C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11H11V7C11 6.44772 11.4477 6 12 6Z",fill:"currentColor"})}),dSe=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{d:"M11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289L16.7071 7.29289C17.0976 7.68342 17.0976 8.31658 16.7071 8.70711C16.3166 9.09763 15.6834 9.09763 15.2929 8.70711L13 6.41421V15C13 15.5523 12.5523 16 12 16C11.4477 16 11 15.5523 11 15V6.41421L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289L11.2929 3.29289ZM4 14C4.55229 14 5 14.4477 5 15V15.2C5 16.0566 5.00078 16.6389 5.03755 17.089C5.07337 17.5274 5.1383 17.7516 5.21799 17.908C5.40973 18.2843 5.7157 18.5903 6.09202 18.782C6.24842 18.8617 6.47262 18.9266 6.91104 18.9624C7.36113 18.9992 7.94342 19 8.8 19H15.2C16.0566 19 16.6389 18.9992 17.089 18.9624C17.5274 18.9266 17.7516 18.8617 17.908 18.782C18.2843 18.5903 18.5903 18.2843 18.782 17.908C18.8617 17.7516 18.9266 17.5274 18.9624 17.089C18.9992 16.6389 19 16.0566 19 15.2V15C19 14.4477 19.4477 14 20 14C20.5523 14 21 14.4477 21 15V15.2413C21 16.0463 21 16.7106 20.9558 17.2518C20.9099 17.8139 20.8113 18.3306 20.564 18.816C20.1805 19.5686 19.5686 20.1805 18.816 20.564C18.3306 20.8113 17.8139 20.9099 17.2518 20.9558C16.7106 21 16.0463 21 15.2413 21H8.75868C7.95372 21 7.28936 21 6.74817 20.9558C6.18608 20.9099 5.66937 20.8113 5.18404 20.564C4.43139 20.1805 3.81947 19.5686 3.43597 18.816C3.18868 18.3306 3.09012 17.8139 3.04419 17.2518C2.99998 16.7106 2.99999 16.0463 3 15.2413L3 15C3 14.4477 3.44772 14 4 14Z",fill:"currentColor"})}),VN=e=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:l.jsx("path",{d:"M8.99805 16.796C8.99805 15.4164 7.87961 14.2979 6.5 14.2979C5.12039 14.2979 4.00195 15.4164 4.00195 16.796C4.00196 18.1756 5.1204 19.294 6.5 19.294C7.8796 19.294 8.99804 18.1756 8.99805 16.796ZM19.748 15.0479C19.748 14.7729 19.525 14.5499 19.25 14.5499H15.75C15.475 14.5499 15.252 14.7729 15.252 15.0479V18.5479C15.252 18.823 15.475 19.046 15.75 19.046H19.25C19.525 19.046 19.748 18.823 19.748 18.5479V15.0479ZM10.0469 3.45125C11.077 2.15921 13.0849 2.20276 14.0498 3.58113L16.4189 6.96492L16.5205 7.12215C17.5046 8.76341 16.3301 10.9023 14.3691 10.9024H9.63086C7.60676 10.9023 6.42029 8.62316 7.58105 6.96492L9.9502 3.58113L10.0469 3.45125ZM12.4082 4.73055C12.2223 4.46497 11.842 4.44826 11.6318 4.68074L11.5918 4.73055L9.22266 8.11433C8.99176 8.44435 9.22808 8.89744 9.63086 8.89754H14.3691C14.7468 8.89745 14.9774 8.49957 14.8145 8.17781L14.7773 8.11433L12.4082 4.73055ZM11.002 16.796C11.0019 19.2824 8.98638 21.2979 6.5 21.2979C4.01362 21.2979 1.99806 19.2824 1.99805 16.796C1.99805 14.3096 4.01361 12.294 6.5 12.294C8.98639 12.294 11.002 14.3096 11.002 16.796ZM21.752 18.5479C21.752 19.9297 20.6318 21.0499 19.25 21.0499H15.75C14.3682 21.0499 13.248 19.9297 13.248 18.5479V15.0479C13.2481 13.6662 14.3682 12.546 15.75 12.546H19.25C20.6318 12.546 21.7519 13.6662 21.752 15.0479V18.5479Z",fill:"currentColor"})});/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uSe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xJ=(...e)=>e.filter((t,n,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===n).join(" ").trim();/** + */const fSe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),vJ=(...e)=>e.filter((t,n,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===n).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var dSe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var hSe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fSe=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:s,iconNode:a,...o},c)=>m.createElement("svg",{ref:c,...dSe,width:t,height:t,stroke:e,strokeWidth:i?Number(n)*24/Number(t):n,className:xJ("lucide",r),...o},[...a.map(([u,d])=>m.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** + */const pSe=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:s,iconNode:a,...o},c)=>m.createElement("svg",{ref:c,...hSe,width:t,height:t,stroke:e,strokeWidth:i?Number(n)*24/Number(t):n,className:vJ("lucide",r),...o},[...a.map(([u,d])=>m.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ct=(e,t)=>{const n=m.forwardRef(({className:i,...r},s)=>m.createElement(fSe,{ref:s,iconNode:t,className:xJ(`lucide-${uSe(e)}`,i),...r}));return n.displayName=`${e}`,n};/** + */const Ct=(e,t)=>{const n=m.forwardRef(({className:i,...r},s)=>m.createElement(pSe,{ref:s,iconNode:t,className:vJ(`lucide-${fSe(e)}`,i),...r}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vJ=Ct("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const wJ=Ct("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hSe=Ct("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** + */const mSe=Ct("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -95,22 +95,22 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pSe=Ct("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const gSe=Ct("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wJ=Ct("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** + */const SJ=Ct("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const SJ=Ct("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + */const EJ=Ct("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mSe=Ct("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + */const bSe=Ct("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -120,7 +120,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gSe=Ct("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const OSe=Ct("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -130,12 +130,12 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const EJ=Ct("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + */const kJ=Ct("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bSe=Ct("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const ySe=Ct("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -145,12 +145,12 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const OSe=Ct("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** + */const xSe=Ct("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kJ=Ct("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** + */const TJ=Ct("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -160,12 +160,12 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ySe=Ct("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** + */const vSe=Ct("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xSe=Ct("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + */const wSe=Ct("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -190,7 +190,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vSe=Ct("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const SSe=Ct("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -200,12 +200,12 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wSe=Ct("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** + */const ESe=Ct("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const SSe=Ct("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** + */const kSe=Ct("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -215,22 +215,22 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ESe=Ct("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** + */const TSe=Ct("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TJ=Ct("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** + */const _J=Ct("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kSe=Ct("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** + */const _Se=Ct("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TSe=Ct("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** + */const ASe=Ct("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -240,17 +240,17 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _J=Ct("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + */const AJ=Ct("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _Se=Ct("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** + */const NSe=Ct("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ASe=Ct("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** + */const CSe=Ct("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -270,12 +270,12 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const AJ=Ct("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + */const NJ=Ct("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NSe=Ct("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** + */const jSe=Ct("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -285,12 +285,12 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CSe=Ct("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** + */const RSe=Ct("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jSe=Ct("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + */const ISe=Ct("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -300,42 +300,42 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const RSe=Ct("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + */const PSe=Ct("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NJ=Ct("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** + */const CJ=Ct("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ISe=Ct("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + */const MSe=Ct("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PSe=Ct("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** + */const LSe=Ct("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const MSe=Ct("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** + */const DSe=Ct("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LSe=Ct("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** + */const $Se=Ct("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DSe=Ct("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + */const QSe=Ct("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $Se=Ct("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const BSe=Ct("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -345,22 +345,22 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const QSe=Ct("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + */const USe=Ct("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CJ=Ct("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** + */const jJ=Ct("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BSe=Ct("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** + */const zSe=Ct("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const USe=Ct("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + */const FSe=Ct("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -370,7 +370,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zSe=Ct("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** + */const VSe=Ct("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -385,7 +385,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const FSe=Ct("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** + */const XSe=Ct("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -395,34 +395,34 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const VSe=Ct("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const qSe=Ct("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const XSe=Ct("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + */const HSe=Ct("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xa=Ct("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),p9="veadk_auth_qs";let eO=null;function qSe(){if(eO!==null)return eO;const t=new URLSearchParams(window.location.search).toString();return t?(sessionStorage.setItem(p9,t),eO=t):eO=sessionStorage.getItem(p9)??"",window.location.search&&window.history.replaceState(null,"",window.location.pathname+window.location.hash),eO}function To(e){const t=qSe();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((i,r)=>{n.searchParams.has(r)||n.searchParams.set(r,i)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const Ro=3e4,br=12e4,zD=1e4;function Io(e,t=Ro){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const bk="veadk_local_user",Ok="veadk_local_user_tab",HSe=/^[A-Za-z0-9]{1,16}$/;function jJ(){try{const e=sessionStorage.getItem(Ok);if(e)return e;const t=localStorage.getItem(bk);return t&&sessionStorage.setItem(Ok,t),t}catch{try{return localStorage.getItem(bk)}catch{return null}}}function m9(e){try{sessionStorage.setItem(Ok,e)}catch{}try{localStorage.setItem(bk,e)}catch{}}function YSe(){try{sessionStorage.removeItem(Ok)}catch{}try{localStorage.removeItem(bk)}catch{}}function Fp(e){const t=new Headers(e),n=jJ();return n&&t.set("X-VeADK-Local-User",n),t}async function RJ(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:Io(void 0,zD)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error("无法加载登录配置,请检查网络后重试。")}if(!e.ok)throw new Error(`登录配置服务异常(HTTP ${e.status}),请稍后重试。`);try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error("登录配置服务返回了无法解析的响应,请稍后重试。")}}function GSe(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function WSe(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function ZSe(){const[e,t]=await Promise.all([rP(),RJ()]);return e.status==="unauthenticated"&&t.length>0}function KSe(){window.location.assign("/oauth2/logout")}async function rP(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:Io(void 0,zD)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(r){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",r),new Error("身份服务返回了无法解析的响应,请稍后重试。")}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(`身份服务异常(HTTP ${e.status}),请稍后重试。`);const t=jJ();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function JSe(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function eEe(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const sP="veadk:authentication-required";let by=null,LO=null;function tEe(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function nEe(e){by||(by=new Promise(n=>{LO=n}),window.dispatchEvent(new Event(sP)));const t=by;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,i)=>{const r=()=>i(e.reason??new Error("Request aborted"));e.addEventListener("abort",r,{once:!0}),t.then(()=>{e.removeEventListener("abort",r),n()},s=>{e.removeEventListener("abort",r),i(s)})}):t}function iEe(){return by!==null}function rEe(){LO==null||LO(),LO=null,by=null}async function v_(e,t){var i;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const r=((i=e.headers.get("content-type"))==null?void 0:i.split(";",1)[0])||"Content-Type 缺失",s=n.trim().slice(0,2e3),a=s?` -响应:${s}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${r})${a}`)}}const sEe=/\brun_sse\s*failed\s*:\s*404\b/i,aEe=/session not found/i,oEe=/(?:^|[::\s])not found\s*$/i,lEe=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,g9="提示:会话已不存在。使用 in-memory 或 SQLite 短期记忆时,多实例、进程重启或滚动发布都可能导致会话丢失;建议改用基于数据库的持久化短期记忆存储。",b9="提示:该 Runtime 未提供会话能力运行接口,可能是 Runtime 版本与当前 Studio 不兼容。",O9="提示:模型生成的工具参数格式不完整,请重新发送一次。";function aw(e){const t=String(e);return lEe.test(t)?t.includes(O9)?t:`${t} + */const xa=Ct("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),p9="veadk_auth_qs";let eO=null;function YSe(){if(eO!==null)return eO;const t=new URLSearchParams(window.location.search).toString();return t?(sessionStorage.setItem(p9,t),eO=t):eO=sessionStorage.getItem(p9)??"",window.location.search&&window.history.replaceState(null,"",window.location.pathname+window.location.hash),eO}function To(e){const t=YSe();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((i,r)=>{n.searchParams.has(r)||n.searchParams.set(r,i)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const Ro=3e4,br=12e4,zD=1e4;function Io(e,t=Ro){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const bk="veadk_local_user",Ok="veadk_local_user_tab",GSe=/^[A-Za-z0-9]{1,16}$/;function RJ(){try{const e=sessionStorage.getItem(Ok);if(e)return e;const t=localStorage.getItem(bk);return t&&sessionStorage.setItem(Ok,t),t}catch{try{return localStorage.getItem(bk)}catch{return null}}}function m9(e){try{sessionStorage.setItem(Ok,e)}catch{}try{localStorage.setItem(bk,e)}catch{}}function WSe(){try{sessionStorage.removeItem(Ok)}catch{}try{localStorage.removeItem(bk)}catch{}}function Fp(e){const t=new Headers(e),n=RJ();return n&&t.set("X-VeADK-Local-User",n),t}async function IJ(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:Io(void 0,zD)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error("无法加载登录配置,请检查网络后重试。")}if(!e.ok)throw new Error(`登录配置服务异常(HTTP ${e.status}),请稍后重试。`);try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error("登录配置服务返回了无法解析的响应,请稍后重试。")}}function ZSe(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function KSe(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function JSe(){const[e,t]=await Promise.all([rP(),IJ()]);return e.status==="unauthenticated"&&t.length>0}function eEe(){window.location.assign("/oauth2/logout")}async function rP(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:Io(void 0,zD)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(r){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",r),new Error("身份服务返回了无法解析的响应,请稍后重试。")}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(`身份服务异常(HTTP ${e.status}),请稍后重试。`);const t=RJ();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function tEe(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function nEe(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const sP="veadk:authentication-required";let by=null,LO=null;function iEe(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function rEe(e){by||(by=new Promise(n=>{LO=n}),window.dispatchEvent(new Event(sP)));const t=by;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,i)=>{const r=()=>i(e.reason??new Error("Request aborted"));e.addEventListener("abort",r,{once:!0}),t.then(()=>{e.removeEventListener("abort",r),n()},s=>{e.removeEventListener("abort",r),i(s)})}):t}function sEe(){return by!==null}function aEe(){LO==null||LO(),LO=null,by=null}async function v_(e,t){var i;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const r=((i=e.headers.get("content-type"))==null?void 0:i.split(";",1)[0])||"Content-Type 缺失",s=n.trim().slice(0,2e3),a=s?` +响应:${s}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${r})${a}`)}}const oEe=/\brun_sse\s*failed\s*:\s*404\b/i,lEe=/session not found/i,cEe=/(?:^|[::\s])not found\s*$/i,uEe=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,g9="提示:会话已不存在。使用 in-memory 或 SQLite 短期记忆时,多实例、进程重启或滚动发布都可能导致会话丢失;建议改用基于数据库的持久化短期记忆存储。",b9="提示:该 Runtime 未提供会话能力运行接口,可能是 Runtime 版本与当前 Studio 不兼容。",O9="提示:模型生成的工具参数格式不完整,请重新发送一次。";function aw(e){const t=String(e);return uEe.test(t)?t.includes(O9)?t:`${t} -${O9}`:sEe.test(t)?aEe.test(t)?t.includes(g9)?t:`${t} +${O9}`:oEe.test(t)?lEe.test(t)?t.includes(g9)?t:`${t} -${g9}`:oEe.test(t)?t.includes(b9)?t:`${t} +${g9}`:cEe.test(t)?t.includes(b9)?t:`${t} ${b9}`:t:t}async function*FD(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let i="";try{for(;;){const{done:r,value:s}=await t.read();if(r)break;i+=n.decode(s,{stream:!0});let a=i.match(/\r?\n\r?\n/);for(;(a==null?void 0:a.index)!==void 0;){const o=i.slice(0,a.index);i=i.slice(a.index+a[0].length);const c=o.split(/\r?\n/).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` -`);if(c)try{yield JSON.parse(c)}catch{c!=="[DONE]"&&c!=="ping"&&console.debug(`parseSSE: dropping unparseable frame (${c.length} chars):`,c.slice(0,200))}a=i.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const cEe=255,uEe=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function dEe(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let i=0,r="";for(const s of t){if(!uEe.test(s))continue;const a=n.encode(s).byteLength;if(i+a>cEe)break;r+=s,i+=a}return r.replace(/ +/g," ").trimEnd()}const aP="ap-southeast-1",VD="cn-beijing",fEe="https://ark.ap-southeast.bytepluses.com/api/v3",hEe="https://ark.cn-beijing.volces.com/api/v3/",pEe="https://console.byteplus.com/ark/region:ark+ap-southeast-1/openManagement",mEe="https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement",gEe="dola-seed-2-1-turbo-260628",bEe="doubao-seed-2-1-pro-260628",OEe="skylark-embedding-vision-250615",yEe="doubao-embedding-vision-250615",xEe="seed-2-0-lite-260228",vEe="doubao-seed-2-0-lite-260428",wEe="dola-seedream-5-0-pro-260628",SEe="doubao-seedream-5-0-260128",EEe="seededit-3-0-i2i-250628",kEe="doubao-seededit-3-0-i2i-250628",TEe="dreamina-seedance-2-0-260128",_Ee="doubao-seedance-2-0-260128",IJ=[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}],PJ=[{value:aP,label:aP}];function j1(e){return e==="byteplus"?PJ:IJ}function Vi(e){var t;return((t=j1(e)[0])==null?void 0:t.value)||VD}const AEe=new Set(["cn-beijing","cn-shanghai","ap-southeast-1"]);function XD(e){return typeof e=="string"&&AEe.has(e)}function Ku(e,t){var i;return((i=(t?j1(t):[...IJ,...PJ]).find(r=>r.value===e))==null?void 0:i.label)||e||"-"}function u0(e){return e==="byteplus"?gEe:bEe}function Ql(e){return e==="byteplus"?fEe:hEe}function NEe(e){return e==="byteplus"?pEe:mEe}function CEe(e){return e==="byteplus"?OEe:yEe}function jEe(e){return e==="byteplus"?xEe:vEe}function REe(e){return e==="byteplus"?wEe:SEe}function IEe(e){return e==="byteplus"?EEe:kEe}function PEe(e){return e==="byteplus"?TEe:_Ee}const qD="veadk.messageFeedback.v1";function HD(e,t,n,i){return[e,t,n,i].join(":")}function YD(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(qD)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function MEe(e,t,n){if(typeof window>"u")return;const i=YD();i[e]={...i[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(qD,JSON.stringify(i))}function MJ(e){if(typeof window>"u")return;const t=HD(e.runtimeId,e.appName,e.userId,e.sessionId),n=YD(),i=n[t];if(i){for(const r of e.eventIds)delete i[`veadk_feedback:${r}`];Object.keys(i).length===0?delete n[t]:n[t]=i,localStorage.setItem(qD,JSON.stringify(n))}}const zS="",GD=new Map;function LJ(e,t){GD.set(e,t)}function DJ(){GD.clear()}function Zr(e){const t=GD.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}async function Mt(e,t={},n={},i=Ro){const r=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",s={...t,...r?{method:"POST"}:{},headers:Fp(t.headers)},a=()=>{const u={...s,signal:Io(t.signal,i)};if(n.runtimeId){const d=new URLSearchParams;n.region&&d.set("region",n.region),n.retryProbe&&d.set("probe_retry","connect"),r&&d.set("_method","DELETE");const f=d.toString()?`${e.includes("?")?"&":"?"}${d.toString()}`:"";return fetch(To(`${zS}/web/runtime-proxy/${n.runtimeId}${e}${f}`),u)}if(n.base){const d=new Headers(u.headers);return d.set("X-AgentKit-Base",n.base),n.apiKey&&d.set("X-AgentKit-Key",n.apiKey),fetch(To(`${zS}/agentkit-proxy${e}`),{...u,headers:d})}return fetch(To(`${zS}${e}`),u)},o=async u=>{if(tEe(u))return!0;if(u.status!==401)return!1;try{return await ZSe()}catch{return!1}};let c=await a();for(;await o(c);)await nEe(t.signal),c=await a();return c}function ci(e,t={},n=Ro){return Mt(e,t,{},n)}function LEe(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const i=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",r=String(t.msg??"");return i?`${i}: ${r}`:r}return String(t)}).filter(Boolean).join(` -`):e&&typeof e=="object"?JSON.stringify(e):""}async function fn(e,t){const n=`${t}(HTTP ${e.status})`,i=await e.text().catch(()=>"");if(!i)return n;try{const r=JSON.parse(i),s=LEe(r.detail??r.error);return s?`${n} +`);if(c)try{yield JSON.parse(c)}catch{c!=="[DONE]"&&c!=="ping"&&console.debug(`parseSSE: dropping unparseable frame (${c.length} chars):`,c.slice(0,200))}a=i.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const dEe=255,fEe=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function hEe(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let i=0,r="";for(const s of t){if(!fEe.test(s))continue;const a=n.encode(s).byteLength;if(i+a>dEe)break;r+=s,i+=a}return r.replace(/ +/g," ").trimEnd()}const aP="ap-southeast-1",VD="cn-beijing",pEe="https://ark.ap-southeast.bytepluses.com/api/v3",mEe="https://ark.cn-beijing.volces.com/api/v3/",gEe="https://console.byteplus.com/ark/region:ark+ap-southeast-1/openManagement",bEe="https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement",OEe="dola-seed-2-1-turbo-260628",yEe="doubao-seed-2-1-pro-260628",xEe="skylark-embedding-vision-250615",vEe="doubao-embedding-vision-250615",wEe="seed-2-0-lite-260228",SEe="doubao-seed-2-0-lite-260428",EEe="dola-seedream-5-0-pro-260628",kEe="doubao-seedream-5-0-260128",TEe="seededit-3-0-i2i-250628",_Ee="doubao-seededit-3-0-i2i-250628",AEe="dreamina-seedance-2-0-260128",NEe="doubao-seedance-2-0-260128",PJ=[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}],MJ=[{value:aP,label:aP}];function j1(e){return e==="byteplus"?MJ:PJ}function Vi(e){var t;return((t=j1(e)[0])==null?void 0:t.value)||VD}const CEe=new Set(["cn-beijing","cn-shanghai","ap-southeast-1"]);function XD(e){return typeof e=="string"&&CEe.has(e)}function Ku(e,t){var i;return((i=(t?j1(t):[...PJ,...MJ]).find(r=>r.value===e))==null?void 0:i.label)||e||"-"}function u0(e){return e==="byteplus"?OEe:yEe}function Ql(e){return e==="byteplus"?pEe:mEe}function jEe(e){return e==="byteplus"?gEe:bEe}function REe(e){return e==="byteplus"?xEe:vEe}function IEe(e){return e==="byteplus"?wEe:SEe}function PEe(e){return e==="byteplus"?EEe:kEe}function MEe(e){return e==="byteplus"?TEe:_Ee}function LEe(e){return e==="byteplus"?AEe:NEe}const qD="veadk.messageFeedback.v1";function HD(e,t,n,i){return[e,t,n,i].join(":")}function YD(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(qD)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function DEe(e,t,n){if(typeof window>"u")return;const i=YD();i[e]={...i[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(qD,JSON.stringify(i))}function LJ(e){if(typeof window>"u")return;const t=HD(e.runtimeId,e.appName,e.userId,e.sessionId),n=YD(),i=n[t];if(i){for(const r of e.eventIds)delete i[`veadk_feedback:${r}`];Object.keys(i).length===0?delete n[t]:n[t]=i,localStorage.setItem(qD,JSON.stringify(n))}}const zS="",GD=new Map;function DJ(e,t){GD.set(e,t)}function $J(){GD.clear()}function Zr(e){const t=GD.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}async function Mt(e,t={},n={},i=Ro){const r=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",s={...t,...r?{method:"POST"}:{},headers:Fp(t.headers)},a=()=>{const u={...s,signal:Io(t.signal,i)};if(n.runtimeId){const d=new URLSearchParams;n.region&&d.set("region",n.region),n.retryProbe&&d.set("probe_retry","connect"),r&&d.set("_method","DELETE");const f=d.toString()?`${e.includes("?")?"&":"?"}${d.toString()}`:"";return fetch(To(`${zS}/web/runtime-proxy/${n.runtimeId}${e}${f}`),u)}if(n.base){const d=new Headers(u.headers);return d.set("X-AgentKit-Base",n.base),n.apiKey&&d.set("X-AgentKit-Key",n.apiKey),fetch(To(`${zS}/agentkit-proxy${e}`),{...u,headers:d})}return fetch(To(`${zS}${e}`),u)},o=async u=>{if(iEe(u))return!0;if(u.status!==401)return!1;try{return await JSe()}catch{return!1}};let c=await a();for(;await o(c);)await rEe(t.signal),c=await a();return c}function ci(e,t={},n=Ro){return Mt(e,t,{},n)}function $Ee(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const i=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",r=String(t.msg??"");return i?`${i}: ${r}`:r}return String(t)}).filter(Boolean).join(` +`):e&&typeof e=="object"?JSON.stringify(e):""}async function fn(e,t){const n=`${t}(HTTP ${e.status})`,i=await e.text().catch(()=>"");if(!i)return n;try{const r=JSON.parse(i),s=$Ee(r.detail??r.error);return s?`${n} ${s} 原始响应: ${i}`:`${n} 原始响应: ${i}`}catch{return`${n} 原始响应: -${i}`}}async function $J(e,t=!1){const n=await Mt(`/web/model-api-keys${t?"?refresh=true":""}`,{signal:e,cache:"no-store"});if(!n.ok)throw new Error(await fn(n,"加载 Ark API Key 失败"));return await n.json()}async function QJ(e,t){const n=await Mt(`/web/model-api-keys/${encodeURIComponent(e)}/value`,{method:"POST",signal:t,cache:"no-store"});if(!n.ok)throw new Error(await fn(n,"加载 Ark API Key 失败"));return await n.json()}async function BJ(e){const t=new URLSearchParams;e!=null&&e.apiKeyId&&t.set("apiKeyId",e.apiKeyId),e!=null&&e.refresh&&t.set("refresh","true");const n=t.toString(),i=await Mt(`/web/model-options${n?`?${n}`:""}`,{signal:e==null?void 0:e.signal,cache:"no-store"});if(!i.ok)throw new Error(await fn(i,"加载模型列表失败"));return await i.json()}async function UJ(){const e=await Mt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class Z0 extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class ga extends Error{constructor(t,n=!1,i=!1){super(t),this.unsupported=n,this.retryable=i,this.name="RuntimeProbeError"}}const zJ="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",FJ="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",y9=["cn-beijing","cn-shanghai"],DEe=3e4,w_=5*60*1e3,VJ=60*1e3;let XJ="volcengine";const FS=new Map,Ch=new Map,jh=new Map,Nl=new Map;function qJ(e,t){return`${t}:${e}`}function HJ(e){XJ=e}function th(e){const t=(e||"").trim();if(XJ==="byteplus")return[t&&!t.startsWith("cn-")?t:aP];const n=t&&!t.startsWith("ap-")?t:VD;return y9.includes(n)?[n,...y9.filter(i=>i!==n)]:[n]}function K0(...e){return e.map(t=>String(t??"")).join("")}function J0(e,t,n){const i=e.get(t);return i!=null&&i.value&&Date.now()-i.updatedAt<=n?i.value:null}function WD(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}async function YJ(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function S_(e,t,n){const i=await Mt("/list-apps",{},n??{base:e,apiKey:t}),r=n!=null&&n.runtimeId?await YJ(i):"";if(n!=null&&n.runtimeId&&r==="runtime_access_denied")throw new Z0;if(n!=null&&n.runtimeId&&r==="runtime_private_endpoint_unreachable")throw new ga(zJ);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(r))throw new ga(FJ,!1,!0);if(n!=null&&n.runtimeId&&i.status===404)throw new ga("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0,!0);if(n!=null&&n.runtimeId&&(i.status===401||i.status===403))throw new ga("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await fn(i,"读取 Agent 列表失败"));const s=await i.json();return n!=null&&n.runtimeId&&FS.set(qJ(n.runtimeId,n.region??""),{apps:s,expiresAt:Date.now()+DEe}),s}async function GJ(e,t){const{app:n,ep:i}=Zr(e),r=await Mt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},i);if(!r.ok){const a=`创建会话失败 (${r.status})`,o=await fn(r,"创建会话失败");throw new Error(o===a?a:`${a}:${o}`)}return(await r.json()).id}async function ZD(e,t){const{app:n,ep:i}=Zr(e),r=await Mt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},i);if(!r.ok)throw new Error(`list sessions failed: ${r.status}`);return r.json()}async function yk(e,t,n){const{app:i,ep:r}=Zr(e),s=await Mt(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},r);if(!s.ok){const o=await fn(s,"读取会话失败");throw new Error(`get session failed: ${s.status}:${o}`)}const a=await s.json();if(r.runtimeId){const o=HD(r.runtimeId,i,t,n);a.state={...YD()[o]??{},...a.state??{}}}return a}async function WJ(e){const{app:t,ep:n}=Zr(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");if(!n.region)throw new Error("Runtime 缺少地域信息,无法提交反馈");const i=await Mt("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region,appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},br);if(!i.ok)throw new Error(await fn(i,"提交反馈失败"));const r=await i.json(),s=HD(n.runtimeId,t,e.userId,e.sessionId);return MEe(s,e.eventId,r),r}async function E_(e,t={}){const n=K0(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),i=J0(Nl,n,VJ);if(!t.force&&i)return i;const r=Nl.get(n);if(!t.force&&(r!=null&&r.promise))return r.promise;let s=null;const a=(async()=>{for(const o of th(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:o,appName:e.appName,page_size:String(e.pageSize??100)}),u=await Mt(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return WD(Nl,n,await u.json());s=new Error(await fn(u,"读取评测集失败"))}throw s??new Error("读取评测集失败")})();Nl.set(n,{...r,promise:a,updatedAt:(r==null?void 0:r.updatedAt)??0});try{return await a}finally{const o=Nl.get(n);(o==null?void 0:o.promise)===a&&Nl.set(n,{value:o.value,updatedAt:o.updatedAt})}}async function ZJ(e){let t=null;for(const n of th(e.region)){const i=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName,userId:e.userId}),r=await Mt(`/web/evaluation/statuses?${i.toString()}`);if(r.ok)return r.json();t=new Error(await fn(r,"读取自动评测状态失败"))}throw t??new Error("读取自动评测状态失败")}async function KJ(e){let t=null;for(const n of th(e.region)){const i=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),r=await Mt(`/web/evaluation/optimizations?${i.toString()}`);if(r.ok)return r.json();t=new Error(await fn(r,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function JJ(e){return J0(Nl,K0(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),VJ)}function oP(e){E_(e).catch(()=>{})}function eee(e){E_(e,{force:!0}).catch(()=>{})}function tee(e,t){return["good","bad"].map(n=>{const i=e.find(r=>r.kind===n);return{kind:n,evaluationSetId:(i==null?void 0:i.evaluationSetId)??null,evaluationSetName:(i==null?void 0:i.evaluationSetName)??null,workspaceId:(i==null?void 0:i.workspaceId)??null,itemCount:t.filter(r=>r.kind===n).length}})}function VS(e){const t=e.comment??"",n=e.rating==="bad"&&!!t.trim();for(const[i,r]of Nl.entries()){const s=r.value;if(!s||s.runtimeId!==e.runtimeId||s.agentName!==e.appName)continue;const a=s.items.filter(c=>c.sessionId!==e.sessionId||c.messageId!==e.messageId),o=e.rating?[{id:`local:${e.runtimeId}:${e.sessionId}:${e.messageId}`,itemKey:`local:${e.messageId}`,kind:e.rating,input:e.input,output:e.output,referenceOutput:e.referenceOutput??e.output,comment:t,agentName:e.appName,sessionId:e.sessionId,messageId:e.messageId,runtimeId:e.runtimeId,invocationId:e.invocationId??"",userId:e.userId,createdAt:e.createdAt??new Date().toISOString(),evaluationSetId:"",evaluationSetName:"",workspaceId:"",source:"user",score:n?0:null,reason:n?t:""},...a]:a;Nl.set(i,{value:{...s,sets:tee(s.sets,o),items:o},updatedAt:Date.now(),promise:r.promise})}}async function nee(e){let t=null;for(const n of th(e.region)){const i=await Mt("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:n,appName:e.appName,itemIds:e.itemIds})},{},br);if(i.ok){const r=await i.json(),s=new Set(e.itemIds);for(const[a,o]of Nl.entries()){const c=o.value;if(!c||c.runtimeId!==e.runtimeId||c.agentName!==e.appName)continue;const u=c.items.filter(d=>!s.has(d.id));Nl.set(a,{value:{...c,sets:tee(c.sets,u),items:u},updatedAt:Date.now()})}return r}t=new Error(await fn(i,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function lP(e,t,n){const{app:i,ep:r}=Zr(e),s=await Mt(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},r);if(!s.ok&&s.status!==404)throw new Error(`delete session failed: ${s.status}`)}function $Ee(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),i=window.atob(n),r=new Uint8Array(i.length);for(let s=0;s URL.revokeObjectURL(o),0)}async function iee(e,t,n,i,r){const{app:s,ep:a}=Zr(e),o=r==null?"":`?version=${encodeURIComponent(r)}`,c=`/apps/${encodeURIComponent(s)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(i)}${o}`,u=await Mt(c,{},a,br);if(!u.ok)throw new Error(await fn(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=$Ee(f.data),p=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([p],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??i}}async function JD(e,t,n,i,r){const{blob:s}=await iee(e,t,n,i,r);return URL.createObjectURL(s)}async function QEe(e){const t=await Mt("/web/media/capabilities");if(!t.ok)throw new Error(await fn(t,"media capabilities failed"));return t.json()}async function ree(e,t,n,i){const{app:r}=Zr(e),s=new FormData;s.set("app_name",r),s.set("user_id",t),s.set("session_id",n),s.set("file",i);const a=await Mt("/web/media",{method:"POST",body:s},{},br);if(!a.ok)throw new Error(await fn(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function cP(e,t,n){const{app:i}=Zr(e),r=`/web/media/${encodeURIComponent(i)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,s=await Mt(r,{method:"POST"});if(!s.ok&&s.status!==404)throw new Error(await fn(s,"media cleanup failed"))}function see(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((i,r)=>![1,3,5].includes(r)).join("/")}`}catch{return}}async function XS(e,t){const n=see(t);if(!n)throw new Error("Invalid VeADK media URI");const i=await Mt(`${n}/delete`,{method:"POST"});if(!i.ok&&i.status!==404)throw new Error(await fn(i,"media cleanup failed"))}function aee(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=see(t);if(!n)return t;const i=`${n}/content`;return To(`${zS}${i}`)}async function xk(e,t,n){const{app:i,ep:r}=Zr(e);let s;if(r.runtimeId){const c=new URLSearchParams({runtimeId:r.runtimeId,sessionId:t,region:r.region??"cn-beijing"});if(n&&c.set("endTimeMs",String(Math.round(n))),s=await Mt(`/web/runtime-trace?${c.toString()}`),s.status===404)throw new Error("该 Agent 暂未开启链路观测,请到控制台打开后使用。")}else s=await Mt(`/dev/apps/${encodeURIComponent(i)}/debug/trace/session/${encodeURIComponent(t)}`,{},r);if(!s.ok)throw new Error(await fn(s,"加载调用链路失败"));const a=s.headers.get("content-type")??"";if(!a.includes("application/json")){const c=a.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${c}),请检查 Studio API 代理配置`)}const o=await s.json();if(!Array.isArray(o))throw new Error("trace failed: 返回格式无效");return o}async function uP(e){const t=await Mt("/web/issue-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await fn(t,"问题反馈上报失败"));if((await t.json()).submitted!==!0)throw new Error("问题反馈上报失败:服务端未确认提交结果");return{submitted:!0}}function e$(e){const t=n=>({id:String(n.id??""),kind:n.kind==="skill"?"skill":"tool",name:String(n.name??""),custom:n.custom===!0,description:typeof n.description=="string"?n.description:void 0,skillSourceId:typeof n.skill_source_id=="string"?n.skill_source_id:void 0,version:typeof n.version=="string"?n.version:void 0});return{schemaVersion:Number(e.schema_version??1),revision:Number(e.revision??0),tools:Array.isArray(e.tools)?e.tools.map(n=>t(n)):[],skills:Array.isArray(e.skills)?e.skills.map(n=>t(n)):[]}}function t$(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function dP(e,t,n){const{app:i,ep:r}=Zr(e),s=await Mt(t$(i,t,n),{},r);if(!s.ok)throw new Error(await fn(s,"读取会话能力失败"));return e$(await s.json())}async function n$(e){const{ep:t}=Zr(e),n=await Mt("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await fn(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(r=>{var s;return((s=r.name)==null?void 0:s.trim())??""}).filter(Boolean)}async function BEe(e){const{ep:t}=Zr(e),n=await Mt("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await fn(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function UEe(e,t,n){const{ep:i}=Zr(e),r=new URLSearchParams({region:n||"cn-beijing"}),s=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${r.toString()}`,a=await Mt(s,{},i);if(!a.ok)throw new Error(await fn(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function oee(e,t,n=1,i=20){const{ep:r}=Zr(e),s=new URLSearchParams({query:t,page_number:String(n),page_size:String(i)}),a=await Mt(`/harness/skills/findskill?${s.toString()}`,{},r);if(!a.ok)throw new Error(await fn(a,"搜索 Skill Hub 失败"));const o=await a.json();return{items:o.items??[],totalCount:Number(o.totalCount??0)}}async function fP(e,t,n,i,r){const{app:s,ep:a}=Zr(e),o=await Mt(t$(s,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:i.kind,name:i.name,skill_source_id:i.skillSourceId,description:i.description,version:i.version,expected_revision:r})},a);if(!o.ok)throw new Error(await fn(o,"添加会话能力失败"));return e$(await o.json())}async function lee(e,t,n,i,r){const{app:s,ep:a}=Zr(e),o=`${t$(s,t,n)}/${encodeURIComponent(i)}?expected_revision=${r}`,c=await Mt(o,{method:"DELETE"},a);if(!c.ok)throw new Error(await fn(c,"移除会话能力失败"));return e$(await c.json())}async function cee(e,t,n=!0){const i=await Mt(`/web/agent-info/${e}`,{},t);if(!i.ok)throw new Error(`agent-info failed: ${i.status}`);const r=await i.json();if(n&&!r.draft)try{const s=await Mt(`/web/agent-draft/${e}`,{},t);if(s.ok){const a=await s.json();r.draft=a.draft}}catch{}return{appName:e,name:r.name??e,description:r.description??"",type:r.type,model:r.model??"",tools:r.tools??[],skillsPreviewSupported:Array.isArray(r.skills),skills:r.skills??[],subAgents:r.subAgents??[],components:r.components??[],searchSources:r.searchSources??[],graph:r.graph,draft:r.draft}}async function uee(e){const{app:t,ep:n}=Zr(e);return cee(t,n,!1)}async function zEe(e,t,n){let i=null;for(const r of th(t)){const s={runtimeId:e,region:r};try{const a=qJ(e,r),o=FS.get(a);o&&o.expiresAt<=Date.now()&&FS.delete(a);const c=FS.get(a),u=n||(c==null?void 0:c.apps[0])||(await S_("","",s))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return cee(u,s)}catch(a){if(a instanceof Z0||a instanceof ga&&!a.unsupported)throw a;i=a instanceof Error?a:new Error(String(a))}}throw i??new Error("该 Runtime 未提供可预览的 Agent。")}async function vk(e,t,n={},i={}){const r=typeof n=="string"?n:void 0,s=typeof n=="string"?i:n,a=K0(e,t||"cn-beijing",r??""),o=J0(Ch,a,w_);if(!s.force&&o)return o;const c=Ch.get(a);if(!s.force&&(c!=null&&c.promise))return c.promise;const u=zEe(e,t,r).then(d=>WD(Ch,a,d));Ch.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=Ch.get(a);(d==null?void 0:d.promise)===u&&Ch.set(a,{value:d.value,updatedAt:d.updatedAt})}}function dee(e,t,n=""){return J0(Ch,K0(e,t||"cn-beijing",n),w_)}function fee(e,t,n=""){vk(e,t,n).catch(()=>{})}async function hee(e,t,n,i){const{app:r,ep:s}=Zr(e),a=new URLSearchParams({source:t,app_name:r,q:n,user_id:i}),o=await Mt(`/web/search?${a.toString()}`,{},s);if(!o.ok)throw new Error(await fn(o,"Agent 检索失败"));return o.json()}async function pee(e,t){const{app:n}=Zr(e),i=await Mt(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!i.ok)throw new Error(`web search failed: ${i.status}`);return i.json()}async function*hP({appName:e,userId:t,sessionId:n,text:i,attachments:r=[],invocation:s,functionResponses:a=[],signal:o,sessionCapabilities:c=!1}){const{app:u,ep:d}=Zr(e),f=r.flatMap(b=>b.status&&b.status!=="ready"?[]:b.uri?[{fileData:{mimeType:b.mimeType,fileUri:b.uri,displayName:b.name},partMetadata:{veadkMedia:{id:b.id,uri:b.uri,name:b.name,mimeType:b.mimeType,sizeBytes:b.sizeBytes}}}]:b.data?[{inlineData:{mimeType:b.mimeType,data:b.data,displayName:b.name}}]:[]),h=s&&(s.skills.length>0||s.targetAgent)?s:void 0,p=[...f,...a.map(b=>({functionResponse:{id:b.id,name:b.name,response:b.response}})),...i.trim()?[{text:i}]:[]];if(h&&p.length>0){const b=p[0],y=b.partMetadata;p[0]={...b,partMetadata:{...y,veadkInvocation:h}}}const g=await Mt(c?"/harness/run_sse":"/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,custom_metadata:h?{veadkInvocation:h}:void 0}),signal:o},d,0);if(!g.ok){const b=await fn(g,"运行会话失败");throw new Error(aw(`run_sse failed: ${g.status}:${b}`))}for await(const b of FD(g)){const y=b;typeof y.error=="string"&&(y.error=aw(y.error)),typeof y.errorMessage=="string"&&(y.errorMessage=aw(y.errorMessage)),typeof y.error_message=="string"&&(y.error_message=aw(y.error_message)),yield y}}async function mee(e,t){const n=new URLSearchParams({name:e,region:t}),i=await Mt(`/web/runtime-name-availability?${n.toString()}`,{cache:"no-store"});if(!i.ok)throw new Error(await fn(i,"检查 Runtime 名称失败"));const r=await i.json();if(typeof r.available!="boolean")throw new Error("检查 Runtime 名称失败:服务返回格式错误");return{available:r.available}}async function gee(e,t){const n=new URLSearchParams({kind:e.kind,region:e.region});e.registry&&n.set("registry",e.registry),e.namespace&&n.set("namespace",e.namespace),e.workspaceId&&n.set("workspaceId",e.workspaceId),e.search&&n.set("search",e.search),e.pageNumber&&n.set("pageNumber",String(e.pageNumber)),e.pageSize&&n.set("pageSize",String(e.pageSize));const i=await Mt(`/web/deployment-resources?${n.toString()}`,{signal:t});if(!i.ok)throw new Error(await fn(i,"加载云资源失败"));const r=await i.json();if(typeof r.serviceRegion!="string"||!Array.isArray(r.items)||typeof r.pageNumber!="number"||typeof r.pageSize!="number"||typeof r.totalCount!="number"||typeof r.hasMore!="boolean")throw new Error("云资源列表响应格式无效");const s=r.items.map(a=>{if(!a||typeof a!="object"||typeof a.id!="string"||typeof a.name!="string"||typeof a.region!="string"||typeof a.status!="string")throw new Error("云资源列表响应格式无效");return a});return{serviceRegion:r.serviceRegion,items:s,pageNumber:r.pageNumber,pageSize:r.pageSize,totalCount:r.totalCount,hasMore:r.hasMore}}async function bee(e){var r;const t=await Mt("/web/system-info",{signal:e});if(!t.ok)throw new Error(await fn(t,"加载系统信息失败"));const n=await t.json();if(typeof((r=n.storage)==null?void 0:r.tosAddress)!="string"||!Array.isArray(n.sandboxTools))throw new Error("系统信息响应格式无效");const i=n.sandboxTools.map(s=>{if(!s||typeof s!="object"||typeof s.kind!="string"||typeof s.label!="string"||typeof s.toolId!="string"||typeof s.snapshot!="boolean")throw new Error("系统信息响应格式无效");return s});return{storage:{tosAddress:n.storage.tosAddress},sandboxTools:i}}async function i$(e){const t=await Mt("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await fn(t,"加载用户池失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("用户池列表响应格式无效");return n.items.map(i=>{if(!i||typeof i!="object"||typeof i.uid!="string"||typeof i.name!="string"||typeof i.domain!="string"||typeof i.region!="string"||typeof i.isCurrent!="boolean")throw new Error("用户池列表响应格式无效");return i})}const Oy=new Map;async function R1(e,t,n,i){var f,h,p,g,b;const r=i==null?void 0:i.taskId,s=r?new AbortController:void 0;r&&s&&Oy.set(r,s);const a=()=>{r&&Oy.get(r)===s&&Oy.delete(r)};let o;try{const y=!!(i!=null&&i.migrationTaskId);(f=i==null?void 0:i.onStage)==null||f.call(i,{level:"info",phase:"upload",message:y?"正在校验迁移产物":"正在上传代码包",pct:0}),o=await Mt("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:s==null?void 0:s.signal,body:JSON.stringify({name:e,files:y?[]:t,config:n,taskId:r,migrationTaskId:i==null?void 0:i.migrationTaskId,runtimeId:i==null?void 0:i.runtimeId,runtimeName:i==null?void 0:i.runtimeName,appName:i==null?void 0:i.appName,sessionStorage:i==null?void 0:i.sessionStorage,minInstance:i==null?void 0:i.minInstance,maxInstance:i==null?void 0:i.maxInstance,createEvaluationSets:i==null?void 0:i.createEvaluationSets,description:dEe((i==null?void 0:i.description)??""),authentication:i==null?void 0:i.authentication,im:i==null?void 0:i.im,envs:i==null?void 0:i.envs,resources:i==null?void 0:i.resources})},{},0),(h=i==null?void 0:i.onStage)==null||h.call(i,{level:"success",phase:"upload",message:y?"迁移产物校验完成":"代码包上传完成",pct:100})}catch(y){throw a(),y}if(!o.ok){const y=await fn(o,"部署失败");throw a(),new Error(y)}let c=null;try{for await(const y of FD(o)){const O=y;if(O&&O.done){c=O;break}O&&O.message&&((p=i==null?void 0:i.onStage)==null||p.call(i,O))}}catch(y){throw a(),y}if(a(),!c)throw new Error("部署失败:连接中断");if(!c.success)throw new Error(c.error||"部署失败");if(!c.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!c.runtimeId&&!c.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");const u=(g=c.runtimeName)!=null&&g.trim()?c.agentName:e,d=((b=c.runtimeName)==null?void 0:b.trim())||c.agentName;return{apikey:c.apikey??"",url:c.url??"",agentName:u,runtimeName:d,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,warnings:c.warnings,feishuChannel:c.feishuChannel}}async function Oee(e){var n;const t=await Mt("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`取消部署失败 (${t.status})`)}(n=Oy.get(e))==null||n.abort(),Oy.delete(e)}async function FEe(e=VD){const t=await Mt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const dx={title:"AgentKit Studio",logoUrl:""},pP={enabled:!1},XN={studio:!1,version:"",provider:"volcengine",branding:dx,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,agentUsage:!1,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:pP};function VEe(e){if(!e||typeof e!="object")return pP;const t=e;if(t.enabled!==!0||!t.studio||typeof t.studio!="object")return pP;const n=t.studio;return{enabled:!0,studio:{deployId:typeof n.deployId=="string"?n.deployId:"",userPoolId:typeof n.userPoolId=="string"?n.userPoolId:"",applicationId:typeof n.applicationId=="string"?n.applicationId:"",functionId:typeof n.functionId=="string"?n.functionId:"",region:typeof n.region=="string"?n.region:"",project:typeof n.project=="string"?n.project:"",version:typeof n.version=="string"?n.version:"",accountId:typeof n.accountId=="string"?n.accountId:""}}}async function yee(){var e,t;try{const n=await Mt("/web/ui-config");if(!n.ok)return XN;const i=await n.json(),r=typeof((e=i.branding)==null?void 0:e.logoUrl)=="string"?i.branding.logoUrl:dx.logoUrl,s=i.provider==="byteplus"?"byteplus":"volcengine";return HJ(s),{studio:i.studio??!1,version:typeof i.version=="string"?i.version:"",provider:s,branding:{title:typeof((t=i.branding)==null?void 0:t.title)=="string"?i.branding.title:dx.title,logoUrl:r?To(r):""},features:{...XN.features,...i.features??{}},defaultView:i.defaultView??"chat",agentsSource:i.agentsSource==="cloud"?"cloud":"local",telemetry:VEe(i.telemetry)}}catch{return XN}}const xee={role:"user",telemetry:{userId:"",accountId:""},capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function vee(){var n,i,r,s;const e=await Mt("/web/access");if(!e.ok)throw new Error(`加载权限失败 (${e.status})`);const t=await e.json();if(!["admin","developer","user"].includes(t.role)||typeof((n=t.telemetry)==null?void 0:n.userId)!="string"||t.telemetry.accountId!==void 0&&typeof t.telemetry.accountId!="string"||typeof((i=t.capabilities)==null?void 0:i.createAgents)!="boolean"||typeof((r=t.capabilities)==null?void 0:r.manageAgents)!="boolean"||!["all","mine"].includes((s=t.capabilities)==null?void 0:s.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function wee(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const i=n.size?`?${n.toString()}`:"",r=await Mt(`/web/studio-update${i}`);if(!r.ok)throw new Error(`检查 Studio 更新失败 (${r.status})`);return await r.json()}async function See(e){const t=await Mt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},br);if(!t.ok){let n="";try{const i=await t.json();n=typeof i.detail=="string"?i.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function Eee({runtimeId:e,region:t,appName:n,page:i=1,pageSize:r=20,signal:s}){const a=new URLSearchParams({runtimeId:e,region:t,appName:n,page:String(i),pageSize:String(r)}),o=await Mt(`/web/agent-usage?${a.toString()}`,{signal:s});if(!o.ok)throw new Error(await fn(o,"加载 Agent 用量失败"));const c=o.headers.get("content-type")||"未提供",u=c.toLowerCase();if(!u.includes("application/json")&&!u.includes("+json"))throw new Error(`加载 Agent 用量失败:服务端返回非 JSON 响应(HTTP ${o.status},Content-Type: ${c})。请确认当前服务以 Studio 模式启动,并检查代理或网关配置。`);try{return await o.json()}catch{throw new Error(`加载 Agent 用量失败:服务端返回了无法解析的 JSON(HTTP ${o.status},Content-Type: ${c})。请稍后重试;若问题持续,请检查代理或网关配置。`)}}async function k_(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await Mt(`/web/runtimes?${t.toString()}`);if(!n.ok){const r=await fn(n,"加载 Runtime 失败");throw new Error(r)}const i=await n.json();return{runtimes:i.runtimes??[],nextToken:i.nextToken??""}}async function r$(e,t,n={}){try{const i={runtimeId:e,region:t};return n.retryProbe&&(i.retryProbe=!0),await S_("","",i)}catch(i){if(i instanceof Z0||i instanceof ga)throw i;return null}}async function kee(e,t,n={}){const i={runtimeId:e,region:t};n.retryProbe&&(i.retryProbe=!0);const r=await Mt("/.well-known/agent-card.json",{},i),s=await YJ(r);if(s==="runtime_access_denied")throw new Z0;if(s==="runtime_private_endpoint_unreachable")throw new ga(zJ);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(s))throw new ga(FJ);if(r.status===404)return null;if(r.status===401||r.status===403)throw new ga("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!r.ok)throw new Error(await fn(r,"读取 A2A Agent Card 失败"));const a=await r.json().catch(()=>null),o=typeof(a==null?void 0:a.url)=="string"?a.url.trim():"";return o?{name:typeof(a==null?void 0:a.name)=="string"?a.name:"",description:typeof(a==null?void 0:a.description)=="string"?a.description:"",endpoint:o}:null}async function Tee(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),i=await Mt(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!i.ok)throw new Error(await fn(i,"读取 Runtime API Key 失败"));const r=await i.json();if(typeof r.apiKey!="string"||!r.apiKey)throw new Error("Runtime 未返回可用的 API Key");return r.apiKey}async function _ee(e,t){const n=await Mt("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const i=await n.text().catch(()=>"");throw new Error(i||`删除失败 (${n.status})`)}}async function Aee({runtimeId:e,region:t,appName:n,signal:i}){const r=new URLSearchParams({runtimeId:e,region:t});n&&r.set("appName",n);const s=await Mt(`/web/runtime-update-capability?${r.toString()}`,{signal:i});if(!s.ok)throw new Error(await XEe(s));return await s.json()}async function XEe(e){const t=await e.json().catch(()=>null),n=typeof(t==null?void 0:t.detail)=="string"?t.detail:"";return e.status===403?"当前账号没有管理该 Runtime 的权限。":e.status===404?n==="runtime_not_found"?"该 Runtime 不存在或已被删除。":"当前账号无法访问该 Runtime。":`检查 Runtime 更新能力失败(HTTP ${e.status}),请稍后重试。`}async function qEe(e,t){let n=null;for(const i of th(t)){const r=await Mt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(i)}`);if(r.ok)return r.json();n=new Error(await fn(r,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function s$(e,t="cn-beijing",n={}){const i=K0(e,t||"cn-beijing"),r=J0(jh,i,w_);if(!n.force&&r)return r;const s=jh.get(i);if(!n.force&&(s!=null&&s.promise))return s.promise;const a=qEe(e,t).then(o=>WD(jh,i,o));jh.set(i,{...s,promise:a,updatedAt:(s==null?void 0:s.updatedAt)??0});try{return await a}finally{const o=jh.get(i);(o==null?void 0:o.promise)===a&&jh.set(i,{value:o.value,updatedAt:o.updatedAt})}}function Nee(e,t="cn-beijing"){return J0(jh,K0(e,t||"cn-beijing"),w_)}function Cee(e,t="cn-beijing"){s$(e,t).catch(()=>{})}async function a$(e){const t=await Mt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await fn(t,"生成项目失败"));return t.json()}const HEe=19e4;async function jee(e){const t=await Mt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},HEe);if(!t.ok)throw new Error(await fn(t,"生成 Agent 配置失败"));return v_(t,"生成 Agent 配置失败")}async function Ree(e,t){const n=await Mt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,runtimeId:t==null?void 0:t.runtimeId,runtimeRegion:t==null?void 0:t.region})});if(!n.ok)throw new Error(await fn(n,"创建调试运行失败"));return v_(n,"创建调试运行失败")}async function Iee(e,t){const n=await Mt(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await fn(n,"创建调试会话失败"));return(await v_(n,"创建调试会话失败")).id}async function Pee(e,t){const n=await Mt(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await fn(n,"加载调试调用链路失败"));const i=await v_(n,"加载调试调用链路失败");if(!Array.isArray(i))throw new Error("加载调试调用链路失败:返回格式无效");return i}async function*Mee({runId:e,userId:t,sessionId:n,text:i,signal:r}){const s=i.trim()?[{text:i}]:[],a=await Mt(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:s},streaming:!0}),signal:r},{},0);if(!a.ok)throw new Error(await fn(a,"调试运行失败"));for await(const o of FD(a))yield o}async function Mm(e){const t=await Mt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await fn(t,"清理调试运行失败"))}const YEe=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:dx,DEFAULT_STUDIO_ACCESS:xee,RuntimeAccessDeniedError:Z0,RuntimeProbeError:ga,addSessionCapability:fP,cancelAgentkitDeployment:Oee,checkRuntimeNameAvailability:mee,clearMessageFeedbackCache:MJ,clearRemoteApps:DJ,componentSearch:hee,createGeneratedAgentTestRun:Ree,createGeneratedAgentTestSession:Iee,createSession:GJ,deleteAgentFeedbackCases:nee,deleteGeneratedAgentTestRun:Mm,deleteMedia:XS,deleteRuntime:_ee,deleteSession:lP,deleteSessionMedia:cP,deployAgentkitProject:R1,downloadArtifact:KD,fetchRemoteApps:S_,generateAgentDraftFromRequirement:jee,generateAgentProject:a$,getAgentFeedbackCases:E_,getAgentInfo:uee,getAgentOptimizations:KJ,getAgentUsage:Eee,getAutomaticEvaluationStatuses:ZJ,getCachedAgentFeedbackCases:JJ,getCachedRuntimeAgentInfo:dee,getCachedRuntimeDetail:Nee,getGeneratedAgentTestTrace:Pee,getMediaCapabilities:QEe,getMyRuntimes:FEe,getRuntimeAgentInfo:vk,getRuntimeDetail:s$,getRuntimeUpdateCapability:Aee,getRuntimes:k_,getSession:yk,getSessionCapabilities:dP,getSessionTrace:xk,getStudioAccess:vee,getStudioUpdateStatus:wee,getSystemInfo:bee,getUiConfig:yee,listApps:UJ,listDeploymentResources:gee,listIdentityUserPools:i$,listModelApiKeys:$J,listModelOptions:BJ,listSessionBuiltinTools:n$,listSessionSkillSpaces:BEe,listSessionSkillsInSpace:UEe,listSessions:ZD,mediaContentUrl:aee,prefetchAgentFeedbackCases:oP,prefetchRuntimeAgentInfo:fee,prefetchRuntimeDetail:Cee,previewArtifact:JD,probeRuntimeA2a:kee,probeRuntimeApps:r$,refreshAgentFeedbackCases:eee,registerRemoteApp:LJ,removeSessionCapability:lee,revealModelApiKey:QJ,revealRuntimeApiKey:Tee,runGeneratedAgentTestSSE:Mee,runSSE:hP,runtimeRegionCandidates:th,searchSessionPublicSkills:oee,setClientCloudProvider:HJ,startStudioUpdate:See,studioFetch:ci,submitIssueFeedback:uP,submitMessageFeedback:WJ,uploadMedia:ree,upsertCachedAgentFeedbackCase:VS,webSearch:pee},Symbol.toStringTag,{value:"Module"})),x9=Object.freeze({totalTokenCount:0,promptTokenCount:0,candidatesTokenCount:0,thoughtsTokenCount:0,cachedContentTokenCount:0}),qS=Object.freeze({modelName:"",current:x9,cumulative:x9}),GEe={totalTokenCount:"total_token_count",promptTokenCount:"prompt_token_count",candidatesTokenCount:"candidates_token_count",thoughtsTokenCount:"thoughts_token_count",cachedContentTokenCount:"cached_content_token_count"},WEe=24,ZEe=64,KEe=16;function ow(e){var o,c;const t=e.trim();if(!t)return 0;const n=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/gu,i=((o=t.match(n))==null?void 0:o.length)??0,r=t.replace(n," "),s=(r.match(/[A-Za-z0-9_]+/g)??[]).reduce((u,d)=>u+Math.max(1,Math.ceil(d.length/4)),0),a=((c=r.match(/[^\sA-Za-z0-9_]/g))==null?void 0:c.length)??0;return i+s+a}function JEe(e){var o,c,u;const t=((o=e.instruction)==null?void 0:o.trim())??"",n=((c=e.tools)==null?void 0:c.filter(d=>d.trim()))??[],i=((u=e.skills)==null?void 0:u.filter(d=>d.name.trim()))??[],r=ow(t),s=n.reduce((d,f)=>d+ZEe+ow(f),0),a=i.reduce((d,f)=>d+KEe+ow(f.name)+ow(f.description??""),0);return WEe+r+s+a}function eke({usage:e,contextWindow:t,estimatedSystemTokens:n}){const i=Math.max(1,Math.round(t)),r=Math.max(0,e.current.promptTokenCount),s=Math.max(r,e.current.totalTokenCount),a=Math.min(i,r>0?Math.min(r,Math.max(0,n??0)):Math.max(0,n??0)),o=Math.max(0,r-a),c=r>0?Math.max(0,s-r):Math.max(0,s),u=r>0?s:a+c;return{systemTokens:a,inputTokens:o,outputTokens:c,remainingTokens:Math.max(0,i-u),usedTokens:u,contextWindow:i}}function tke(e){const t=[{kind:"system",tokens:e.systemTokens},{kind:"input",tokens:e.inputTokens},{kind:"output",tokens:e.outputTokens},{kind:"remaining",tokens:e.remainingTokens}],n=e.contextWindow/100;let i=0;const r=t.map(s=>{const a=i;return i+=s.tokens,{...s,start:a,end:i}});return Array.from({length:100},(s,a)=>{const o=a*n,c=o+n,u=r.flatMap(d=>{const f=Math.max(0,Math.min(c,d.end)-Math.max(o,d.start));return f>0?[{kind:d.kind,share:f/n}]:[]});return{index:a,slices:u}})}function tO(e,t){const n=e,i=n[t]??n[GEe[t]];return typeof i=="number"&&Number.isFinite(i)&&i>0?Math.round(i):0}function nke(e){const t=tO(e,"promptTokenCount"),n=tO(e,"candidatesTokenCount"),i=tO(e,"thoughtsTokenCount");return{totalTokenCount:tO(e,"totalTokenCount")||t+n+i,promptTokenCount:t,candidatesTokenCount:n,thoughtsTokenCount:i,cachedContentTokenCount:tO(e,"cachedContentTokenCount")}}function ike(e,t){return{totalTokenCount:e.totalTokenCount+t.totalTokenCount,promptTokenCount:e.promptTokenCount+t.promptTokenCount,candidatesTokenCount:e.candidatesTokenCount+t.candidatesTokenCount,thoughtsTokenCount:e.thoughtsTokenCount+t.thoughtsTokenCount,cachedContentTokenCount:e.cachedContentTokenCount+t.cachedContentTokenCount}}function Lee(e,t){if(!t)return e;const n=typeof t.modelVersion=="string"?t.modelVersion.trim():"",i=typeof t.model_version=="string"?t.model_version.trim():"",r=n||i||e.modelName,s=t.usageMetadata??t.usage_metadata;if(!s)return r===e.modelName?e:{...e,modelName:r};const a=nke(s);return a.totalTokenCount===0?r===e.modelName?e:{...e,modelName:r}:{modelName:r,current:a,cumulative:ike(e.cumulative,a)}}function v9(e){return e.reduce((t,n)=>Lee(t,n),qS)}function w9(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function rke(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function ske(e,t){if(!t)return e;const n=new Set(e.filter(r=>rke(r)===t).map(r=>r.trace_id)),i=e.filter(r=>n.has(r.trace_id));return i.length>0?i:e}function qN(e){return!!(e&&[...e.tools,...e.skills].some(t=>t.custom))}const ake="send_a2ui_json_to_client",oke="validated_a2ui_json",mP="adk_request_credential",S9="transfer_to_agent";function lke(e){var i,r,s,a;const t=e,n=((i=t==null?void 0:t.exchangedAuthCredential)==null?void 0:i.oauth2)??((r=t==null?void 0:t.exchanged_auth_credential)==null?void 0:r.oauth2)??((s=t==null?void 0:t.rawAuthCredential)==null?void 0:s.oauth2)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function Ru(){return{blocks:[],liveStart:0}}const E9=e=>e.functionCall??e.function_call,gP=e=>e.functionResponse??e.function_response;function cke(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function uke(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function Dee(e){const t=[];for(const[n,i]of e.entries()){const r=i.partMetadata??i.part_metadata,s=r==null?void 0:r.veadkTransport;if((s==null?void 0:s.hidden)===!0)continue;const a=r==null?void 0:r.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.sizeBytes:void 0});continue}const o=i.inlineData??i.inline_data;if(o&&o.data){t.push({id:`inline-${n}-${o.displayName??o.display_name??"media"}`,mimeType:o.mimeType??o.mime_type,data:uke(o.data),name:o.displayName??o.display_name});continue}const c=i.fileData??i.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function bP(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const dke=new Set(["llm","sequential","parallel","loop","a2a"]);function fke(e){var t;for(const n of e){const i=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!i||typeof i!="object")continue;const r=i,s=Array.isArray(r.skills)?r.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const o=r.targetAgent;if(o&&typeof o=="object"){const c=o,u=c.type;typeof c.name=="string"&&typeof u=="string"&&dke.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(s.length>0||a)return{skills:s,targetAgent:a}}}function hke(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function pke(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const i of t)n.files.some(r=>r.filename===i.filename&&r.version===i.version)||n.files.push(i);return}e.push({kind:"artifact",files:t})}function k9(e,t,n){const i=e[e.length-1];i&&i.kind===t?i.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function lw(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function wk(e,t){var o,c,u,d,f,h;const n=e.blocks.map(p=>({...p}));let i=e.liveStart;const r=((o=t.content)==null?void 0:o.parts)??[],s=r.some(p=>E9(p)||gP(p));if(t.partial&&!s){for(const p of r){const g=bP(p);typeof g=="string"&&g&&k9(n,p.thought?"thinking":"text",g)}return{blocks:n,liveStart:i}}n.length=i;for(const p of r){const g=E9(p),b=gP(p),y=Dee([p]),O=bP(p);if(typeof O=="string"&&O)k9(n,p.thought?"thinking":"text",O);else if(y.length)lw(n),hke(n,y);else if(g)if(lw(n),g.name===S9){const v=cke(g.args)||((c=t.actions)==null?void 0:c.transferToAgent)||((u=t.actions)==null?void 0:u.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:v,done:!1})}else if(g.name===mP){const v=g.args??{},x=v.authConfig??v.auth_config??v,E=String(v.functionCallId??v.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:g.id??"",label:E,authUri:lke(x),authConfig:x,done:!1})}else n.push({kind:"tool",name:g.name??"",args:g.args,done:!1});else if(b){if(lw(n),b.name===S9)for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="agent-transfer"&&!x.done){x.done=!0;break}}if(b.name===mP)for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="auth"&&!x.done){x.done=!0;break}}for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="tool"&&!x.done&&x.name===b.name){x.done=!0,x.response=b.response;break}}if(b.name===ake){const v=((d=b.response)==null?void 0:d[oke])??[];if(v.length){const x=n[n.length-1];x&&x.kind==="a2ui"?x.messages.push(...v):n.push({kind:"a2ui",messages:v})}}}}const a=((f=t.actions)==null?void 0:f.artifactDelta)??((h=t.actions)==null?void 0:h.artifact_delta);return a&&pke(n,Object.entries(a).map(([p,g])=>({filename:p,version:g}))),lw(n),i=n.length,{blocks:n,liveStart:i}}function mke(e,t={}){var r,s;const n=[];let i=Ru();for(const a of e)if(a.author==="user"){const c=((r=a.content)==null?void 0:r.parts)??[];if(c.some(p=>{var g;return((g=gP(p))==null?void 0:g.name)===mP})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let g=n[p].blocks.length-1;g>=0;g--){const b=n[p].blocks[g];if(b.kind==="auth"){b.done=!0;break}}break}}const u=c.map(bP).filter(p=>!!p).join(""),d=Dee(c),f=fke(c);if(!u&&!d.length&&!f){i=Ru();continue}const h=[];f&&h.push({kind:"invocation",value:f}),d.length&&h.push({kind:"attachment",files:d}),u&&h.push({kind:"text",text:u}),n.push({role:"user",blocks:h,meta:{ts:a.timestamp}}),i=Ru()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((s=u.meta)==null?void 0:s.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),i=Ru()),i=wk(i,a),u.blocks=i.blocks;const d=a.usageMetadata??a.usage_metadata,f=u.meta??(u.meta={});c&&(f.author=c),d!=null&&d.totalTokenCount&&(f.tokens=d.totalTokenCount),a.timestamp&&(f.ts=a.timestamp),a.id&&(f.eventId=a.id);const h=a.invocationId??a.invocation_id;h&&(f.invocationId=h)}for(const a of n){const o=a.meta,c=o==null?void 0:o.eventId;if(!c)continue;const u=t[`veadk_feedback:${c}`];if(!u||typeof u!="object")continue;const d=u;d.rating!=="good"&&d.rating!=="bad"||(o.feedback=u)}return n}function T_(e){var t,n;for(const i of e??[])if(i.author==="user"||((t=i.content)==null?void 0:t.role)==="user"){const r=(((n=i.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(r)return r}return"新会话"}const gke=50,T9=48;function bke(e){return(e.events??[]).flatMap(t=>{var r,s;const i=(((r=t.content)==null?void 0:r.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return i?[{text:i,role:t.author??((s=t.content)==null?void 0:s.role)??"",ts:t.timestamp}]:[]})}function Oke(e){var t,n;for(const i of e.events??[])if(i.author==="user"||((t=i.content)==null?void 0:t.role)==="user"){const r=(((n=i.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(r)return r}return"未命名会话"}function yke(e,t,n){const i=Math.max(0,t-T9),r=Math.min(e.length,t+n+T9);return(i>0?"…":"")+e.slice(i,r).trim()+(r {var c;if((c=o.events)!=null&&c.length)return o;try{return await yk(t,e,o.id)}catch{return o}})),a=[];for(const o of s)for(const{text:c,role:u,ts:d}of bke(o)){const f=c.toLowerCase().indexOf(i);if(f!==-1){a.push({type:"session",appId:t,sessionId:o.id,title:Oke(o),snippet:yke(c,f,i.length),role:u,ts:d??o.lastUpdateTime});break}}return a.sort((o,c)=>(c.ts??0)-(o.ts??0)),a.slice(0,gke)}async function vke(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await pee(e,t.trim())}catch(a){const o=String(a);return{results:[],note:o.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${o}`}}const{mounted:i,results:r,error:s}=n;return i?s?{results:[],note:s}:{results:r.map((a,o)=>({type:"web",index:o,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function wke(e,t,n,i){if(!t||!i.trim())return{results:[]};const r=await hee(t,e,i.trim(),n);if(!r.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(r.error)return{results:[],note:r.error};const s=r.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:r.results.map((a,o)=>e==="knowledge"?{type:"knowledge",index:o,content:a.content,sourceName:s,sourceType:r.sourceType}:{type:"memory",index:o,content:a.content,sourceName:s,sourceType:r.sourceType,author:a.author,ts:a.timestamp})}}async function Ske(e,t,n){return e==="session"?{results:await xke(n.userId,n.appId,t)}:e==="web"?vke(n.appId,t):wke(e,n.appId,n.userId,t)}function $ee({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),l.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function Eke({open:e}){return l.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function kke({active:e=!1,onClick:t}){return l.jsxs("button",{className:`new-chat${e?" is-active":""}`,onClick:t,"aria-label":"搜索","aria-current":e?"page":void 0,title:"搜索",children:[l.jsx($ee,{}),l.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function Tke(e,t,n){const i=!!e,r=new Set((t==null?void 0:t.searchSources)??[]),s=a=>i?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:i,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:i&&r.has("web"),description:"通过 web_search 工具检索",unavailableLabel:s(" web_search 工具")},{id:"knowledge",label:"知识库",ready:i&&r.has("knowledge"),unavailableLabel:s("知识库")},{id:"memory",label:"长期记忆",ready:i&&r.has("memory"),unavailableLabel:s("长期记忆")}]}function Sk(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function _9(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function _ke({userId:e,appId:t,agentInfo:n,capabilitiesLoading:i,agentLabel:r,onOpenSession:s}){var Q,C;const[a,o]=m.useState("session"),[c,u]=m.useState(""),[d,f]=m.useState([]),[h,p]=m.useState(),[g,b]=m.useState(!1),[y,O]=m.useState(!1),[v,x]=m.useState(!1),w=m.useRef(0),E=m.useRef(null),S=Tke(t,n,i),k=S.find(I=>I.id===a),T=a==="knowledge"?(Q=n==null?void 0:n.components)==null?void 0:Q.find(I=>I.source==="knowledgebase"||I.kind==="knowledgebase"):a==="memory"?(C=n==null?void 0:n.components)==null?void 0:C.find(I=>I.source==="long_term_memory"||I.kind==="memory"):void 0;m.useEffect(()=>{w.current+=1,o("session"),f([]),p(void 0),O(!1),b(!1),x(!1)},[t]),m.useEffect(()=>{if(!v)return;function I(U){var B;(B=E.current)!=null&&B.contains(U.target)||x(!1)}return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[v]);async function A(I,U){var G;const B=I.trim();if(!B||!((G=S.find($=>$.id===U))!=null&&G.ready))return;const P=++w.current;b(!0),O(!0);let q;try{q=await Ske(U,B,{userId:e,appId:t})}catch($){const V=$ instanceof Error?$.message:String($);q={results:[],note:`搜索失败:${V}`}}P===w.current&&(f(q.results),p(q.note),b(!1))}function N(I){w.current+=1,u(I),f([]),p(void 0),O(!1),b(!1)}function j(I){w.current+=1,o(I),x(!1),f([]),p(void 0),O(!1),b(!1)}const M=!!(k!=null&&k.ready),D=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(T==null?void 0:T.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(T==null?void 0:T.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",L=T!=null&&T.backend?Sk(T.backend):"";return l.jsxs("div",{className:"search",children:[l.jsxs("div",{className:"search-box",children:[l.jsxs("div",{className:"search-source-picker-wrap",ref:E,children:[l.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(k==null?void 0:k.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":v,onClick:()=>x(I=>!I),children:[l.jsx("span",{children:(k==null?void 0:k.label)??"搜索类型"}),L&&l.jsx("small",{children:L}),l.jsx(Eke,{open:v})]}),v&&l.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:S.map(I=>{var P,q;const U=I.id==="knowledge"?(P=n==null?void 0:n.components)==null?void 0:P.find(G=>G.source==="knowledgebase"||G.kind==="knowledgebase"):I.id==="memory"?(q=n==null?void 0:n.components)==null?void 0:q.find(G=>G.source==="long_term_memory"||G.kind==="memory"):void 0,B=U?[U.name,U.backend?Sk(U.backend):""].filter(Boolean).join(" · "):I.ready?I.description:I.unavailableLabel;return l.jsxs("button",{type:"button",role:"option","aria-selected":a===I.id,disabled:!I.ready,onClick:()=>j(I.id),children:[l.jsx("span",{children:I.label}),B&&l.jsx("small",{children:B})]},I.id)})})]}),l.jsx("span",{className:"search-box-divider","aria-hidden":!0}),l.jsx("input",{className:"search-input",value:c,onChange:I=>N(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),A(c,a))},placeholder:D,disabled:!M,autoFocus:!0}),l.jsx("button",{className:"search-go",onClick:()=>void A(c,a),disabled:!c.trim()||g,"aria-label":"搜索",children:g?l.jsx(ei,{className:"icon spin"}):l.jsx($ee,{className:"icon"})})]}),l.jsx("div",{className:"search-results",children:M?y?g?null:h?l.jsx("div",{className:"search-empty",children:h}):d.length===0&&y?l.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((I,U)=>l.jsx(Ake,{result:I,agentLabel:r,onOpen:s},U)):l.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):l.jsx("div",{className:"search-empty",children:t?i?"正在读取当前 Agent 的检索能力…":(k==null?void 0:k.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function Ake({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return l.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[l.jsx(NJ,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title}),l.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${_9(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return l.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[l.jsx(x_,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title||e.url}),l.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&l.jsx(c0,{className:"search-result-ext"})]})]}),e.summary&&l.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(A9,{source:"knowledge"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Sk(e.sourceType)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(A9,{source:"memory"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Sk(e.sourceType)}`:"",e.ts?` · ${_9(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function A9({source:e,className:t="search-result-icon"}){return e==="knowledge"?l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),l.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),l.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}function Df({className:e="icon"}){return l.jsxs("svg",{className:`${e} sidebar-agent-face`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),l.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),l.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function Nke({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function Cke({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}function Qee(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),l.jsx("path",{d:"M13.25 17.75h-8a2.5 2.5 0 0 1-2.5-2.5v-8a3 3 0 0 1 3-3"}),l.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),l.jsx("path",{d:"m13.35 16.65.42-2.16 4.76-4.76a1.35 1.35 0 0 1 1.91 1.91l-4.76 4.76-2.33.25Z"}),l.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const o$="/assets/logo-DCsNZy-k.svg",l$="data:image/svg+xml,%3csvg%20width='28'%20height='23'%20viewBox='0%200%2028%2023'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.1957%209.44218C17.0253%209.58161%2016.7774%209.47317%2016.7774%209.24079V8.01696V0.611967C16.7774%200.395085%2016.514%200.271152%2016.3591%200.410576L6.04172%209.16334C5.87132%209.30276%205.62345%209.19432%205.62345%208.96194V2.98218C5.62345%202.81178%205.48403%202.67235%205.31362%202.67235H0.309832C0.139424%202.67235%200%202.81178%200%202.98218V21.7115C0%2021.9284%200.263357%2022.0524%200.418273%2021.9129L10.7202%2013.1602C10.8906%2013.0207%2011.1385%2013.1292%2011.1385%2013.3616V22.0059C11.1385%2022.2228%2011.4018%2022.3467%2011.5567%2022.2073L21.8586%2013.4545C22.0291%2013.3151%2022.2769%2013.4235%2022.2769%2013.6559V19.6357C22.2769%2019.8061%2022.4163%2019.9455%2022.5868%2019.9455H27.5905C27.7609%2019.9455%2027.9004%2019.8061%2027.9004%2019.6357V0.890816C27.9004%200.673934%2027.637%200.550001%2027.4821%200.689425L17.1957%209.44218Z'%20fill='%230066FC'/%3e%3c/svg%3e",N9="(max-width: 860px)";function jke(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[l.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),l.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),l.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),l.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function Rke(e){let t=2166136261;for(const i of e)t^=i.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const Ike={admin:"管理员",developer:"开发者",user:"普通用户"};function C9({role:e}){const t=Ike[e];return l.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function Pke({access:e,userInfo:t,onSystemInfo:n,onLogout:i}){const[r,s]=m.useState(!1),[a,o]=m.useState("");if(!t)return null;const c=JSe(t),u=typeof t.email=="string"?t.email:"",d=(c||"U").slice(0,1).toUpperCase(),f=Rke(c||u||d),h=eEe(t),p=h===a?"":h;return l.jsxs("div",{className:"sidebar-user",children:[l.jsxs("button",{className:"sidebar-user-btn",onClick:()=>s(g=>!g),title:u?`${c} -${u}`:c,children:[l.jsxs("span",{className:`account-avatar${p?" has-image":""}`,style:f,children:[d,p?l.jsx("img",{className:"account-avatar-image",src:p,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>o(p)}):null]}),l.jsxs("span",{className:"sidebar-user-identity",children:[l.jsxs("span",{className:"sidebar-user-primary",children:[l.jsx("span",{className:"sidebar-user-name",children:c}),l.jsx(C9,{role:e.role})]}),u&&u!==c&&l.jsx("span",{className:"sidebar-user-email",children:u})]})]}),r&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>s(!1)}),l.jsxs("div",{className:"account-pop sidebar-user-pop",children:[l.jsxs("div",{className:"account-head",children:[l.jsxs("span",{className:`account-avatar account-avatar--lg${p?" has-image":""}`,style:f,children:[d,p?l.jsx("img",{className:"account-avatar-image",src:p,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>o(p)}):null]}),l.jsxs("div",{className:"account-id",children:[l.jsxs("div",{className:"account-name-row",children:[l.jsx("div",{className:"account-name",children:c}),l.jsx(C9,{role:e.role})]}),u&&u!==c&&l.jsx("div",{className:"account-sub",children:u})]})]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{s(!1),n()},children:[l.jsx(dd,{className:"icon"})," 系统信息"]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{s(!1),i()},children:[l.jsx(jSe,{className:"icon"})," 退出登录"]})]})]})]})}function Mke({branding:e,cloudProvider:t,sessions:n,currentSessionId:i,activePage:r,features:s,access:a,streamingSids:o,evaluatingSids:c,sandboxHistory:u,onNewChat:d,onSearch:f,onQuickCreate:h,onLibrary:p,onAddAgent:g,onMyAgents:b,onApplications:y,onSystemInfo:O,onIssueFeedback:v,onPickSession:x,onDeleteSession:w,userInfo:E,onLogout:S}){const k=C=>(s==null?void 0:s[C])!==!1,[T,A]=m.useState(null),N=m.useRef(typeof window<"u"&&window.matchMedia(N9).matches),[j,M]=m.useState(N.current),D=[...n].sort((C,I)=>(I.lastUpdateTime??0)-(C.lastUpdateTime??0)),L=()=>{N.current=!1,M(C=>!C),A(null)};m.useEffect(()=>{const C=window.matchMedia(N9),I=U=>{U.matches?M(B=>B||(N.current=!0,!0)):N.current&&(N.current=!1,M(!1))};return C.addEventListener("change",I),()=>C.removeEventListener("change",I)},[]);const Q=t==="byteplus"?l$:o$;return l.jsxs("aside",{className:`sidebar ${j?"is-collapsed":""}`,children:[l.jsxs("div",{className:"sidebar-top",children:[l.jsxs("div",{className:"sidebar-brand-row",children:[l.jsxs("button",{type:"button",className:"brand",onClick:d,"aria-label":"返回首页",title:"返回首页",children:[l.jsx("img",{className:"brand-logo",src:e.logoUrl||Q,width:20,height:20,alt:"","aria-hidden":!0}),l.jsx("span",{className:"brand-title",children:e.title})]}),l.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:L,"aria-label":j?"展开侧边栏":"收起侧边栏",title:j?"展开侧边栏":"收起侧边栏",children:j?l.jsx(LSe,{className:"icon"}):l.jsx(MSe,{className:"icon"})})]}),k("newChat")&&l.jsxs("button",{className:`new-chat new-chat--conversation${r==="new-chat"?" is-active":""}`,onClick:d,"aria-label":"新会话","aria-current":r==="new-chat"?"page":void 0,title:"新会话",children:[l.jsx(Ks,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),l.jsxs("button",{className:`new-chat new-chat--agents${r==="agents"?" is-active":""}`,onClick:b,"aria-label":"智能体","aria-current":r==="agents"?"page":void 0,title:"智能体",children:[l.jsx(Df,{}),l.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),l.jsxs("button",{className:`new-chat new-chat--library${r==="library"?" is-active":""}`,onClick:p,"aria-label":"库","aria-current":r==="library"?"page":void 0,title:"库",children:[l.jsx(nSe,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"库"})]}),k("search")&&l.jsx(kke,{active:r==="search",onClick:f}),l.jsxs("button",{className:`new-chat new-chat--applications${r==="applications"?" is-active":""}`,onClick:y,"aria-label":"自动化","aria-current":r==="applications"?"page":void 0,title:"自动化",children:[l.jsx(jke,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"自动化"}),l.jsx("span",{className:"sidebar-beta-badge",children:"Beta"})]})]}),k("history")&&l.jsxs("div",{className:"sidebar-history",children:[l.jsxs("div",{className:"history-head",children:[l.jsx("span",{children:"历史会话"}),k("newChat")&&l.jsx("button",{type:"button",className:"history-new-chat",onClick:(u==null?void 0:u.onNew)??d,disabled:u==null?void 0:u.newDisabled,"aria-label":"新建会话",title:"新建会话",children:l.jsx(Ks,{className:"icon"})})]}),l.jsx("div",{className:"history-list",children:u?l.jsxs(l.Fragment,{children:[u.loading&&u.threads.length===0?l.jsx("div",{className:"history-empty",role:"status",children:"正在加载历史会话…"}):null,u.error?l.jsx("div",{className:"history-error",role:"alert",children:u.error}):null,!u.loading&&!u.error&&u.threads.length===0?l.jsx("div",{className:"history-empty",children:"暂无会话"}):null,u.threads.map(C=>{const I=C.id===u.currentThreadId,U=C.name||C.preview||`Thread ${C.id.slice(0,8)}`,B=C.id===u.busyThreadId;return l.jsxs("div",{className:`history-item ${I?"active":""}`,children:[l.jsxs("button",{type:"button",className:"history-item-btn",onClick:()=>u.onSelect(C.id),"aria-current":I?"page":void 0,title:U,disabled:B,children:[l.jsx("span",{className:"history-title",children:U}),I?l.jsx("span",{className:"history-current-badge",children:"当前"}):null]}),l.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${U}`,title:"更多",disabled:B,onClick:()=>A(P=>P===C.id?null:C.id),children:l.jsx(d9,{className:"icon"})}),T===C.id?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>A(null)}),l.jsx("div",{className:"history-menu",children:l.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{A(null),u.onDelete(C)},children:[l.jsx(Lf,{className:"icon"})," 删除"]})})]}):null]},C.id)}),u.hasMore?l.jsx("button",{type:"button",className:"history-load-more",disabled:u.loading,onClick:u.onLoadMore,children:u.loading?"加载中…":"加载更多"}):null]}):l.jsxs(l.Fragment,{children:[D.length===0&&l.jsx("div",{className:"history-empty",children:"暂无会话"}),D.map(C=>{const I=T_(C.events),U=(o==null?void 0:o.has(C.id))===!0,B=!U&&(c==null?void 0:c.has(C.id))===!0;return l.jsxs("div",{className:`history-item ${C.id===i?"active":""}`,children:[l.jsxs("button",{className:"history-item-btn",onClick:()=>x(C.id),"aria-current":C.id===i?"page":void 0,title:I,children:[U&&l.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),l.jsx("span",{className:"history-title",children:I}),B&&l.jsxs("span",{className:"history-evaluating-status",title:"正在自动评测",children:[l.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),"评测中"]})]}),l.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${I}`,title:"更多",onClick:()=>A(P=>P===C.id?null:C.id),children:l.jsx(d9,{className:"icon"})}),T===C.id&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>A(null)}),l.jsx("div",{className:"history-menu",children:l.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{A(null),w(C.id)},children:[l.jsx(Lf,{className:"icon"})," 删除"]})})]})]},C.id)})]})})]}),l.jsxs("div",{className:"sidebar-footer",children:[l.jsxs("button",{type:"button",className:`sidebar-feedback${r==="feedback"?" is-active":""}`,onClick:v,"aria-label":"问题反馈","aria-current":r==="feedback"?"page":void 0,title:"问题反馈",children:[l.jsx(Qee,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"问题反馈"})]}),l.jsx(Pke,{access:a,userInfo:E,onSystemInfo:O,onLogout:S})]})]})}function Kr(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,i;n {}};function __(){for(var e=0,t=arguments.length,n={},i;e =0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}HS.prototype=__.prototype={constructor:HS,on:function(e,t){var n=this._,i=Dke(e+"",n),r,s=-1,a=i.length;if(arguments.length<2){for(;++s0)for(var n=new Array(r),i=0,r,s;i =0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),R9.hasOwnProperty(t)?{space:R9[t],local:e}:e}function Qke(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===OP&&t.documentElement.namespaceURI===OP?t.createElement(e):t.createElementNS(n,e)}}function Bke(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Bee(e){var t=A_(e);return(t.local?Bke:Qke)(t)}function Uke(){}function c$(e){return e==null?Uke:function(){return this.querySelector(e)}}function zke(e){typeof e!="function"&&(e=c$(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r =x&&(x=v+1);!(E=y[x])&&++x =0;)(a=i[r])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function hTe(e){e||(e=pTe);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,i=n.length,r=new Array(i),s=0;st?1:e>=t?0:NaN}function mTe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function gTe(){return Array.from(this)}function bTe(){for(var e=this._groups,t=0,n=e.length;t 1?this.each((t==null?ATe:typeof t=="function"?CTe:NTe)(e,t,n??"")):d0(this.node(),e)}function d0(e,t){return e.style.getPropertyValue(t)||Xee(e).getComputedStyle(e,null).getPropertyValue(t)}function RTe(e){return function(){delete this[e]}}function ITe(e,t){return function(){this[e]=t}}function PTe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function MTe(e,t){return arguments.length>1?this.each((t==null?RTe:typeof t=="function"?PTe:ITe)(e,t)):this.node()[e]}function qee(e){return e.trim().split(/^|\s+/)}function u$(e){return e.classList||new Hee(e)}function Hee(e){this._node=e,this._names=qee(e.getAttribute("class")||"")}Hee.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Yee(e,t){for(var n=u$(e),i=-1,r=t.length;++i =0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function c_e(e){return function(){var t=this.__on;if(t){for(var n=0,i=-1,r=t.length,s;n ()=>e;function yP(e,{sourceEvent:t,subject:n,target:i,identifier:r,active:s,x:a,y:o,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}yP.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function y_e(e){return!e.ctrlKey&&!e.button}function x_e(){return this.parentNode}function v_e(e,t){return t??{x:e.x,y:e.y}}function w_e(){return navigator.maxTouchPoints||"ontouchstart"in this}function ete(){var e=y_e,t=x_e,n=v_e,i=w_e,r={},s=__("start","drag","end"),a=0,o,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(i).on("touchstart.drag",y).on("touchmove.drag",O,O_e).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,E){if(!(d||!e.call(this,w,E))){var S=x(this,t.call(this,w,E),w,E,"mouse");S&&(go(w.view).on("mousemove.drag",g,fx).on("mouseup.drag",b,fx),Kee(w.view),HN(w),u=!1,o=w.clientX,c=w.clientY,S("start",w))}}function g(w){if(Ag(w),!u){var E=w.clientX-o,S=w.clientY-c;u=E*E+S*S>f}r.mouse("drag",w)}function b(w){go(w.view).on("mousemove.drag mouseup.drag",null),Jee(w.view,u),Ag(w),r.mouse("end",w)}function y(w,E){if(e.call(this,w,E)){var S=w.changedTouches,k=t.call(this,w,E),T=S.length,A,N;for(A=0;A >8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?uw(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?uw(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=E_e.exec(e))?new Ba(t[1],t[2],t[3],1):(t=k_e.exec(e))?new Ba(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=T_e.exec(e))?uw(t[1],t[2],t[3],t[4]):(t=__e.exec(e))?uw(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=A_e.exec(e))?Q9(t[1],t[2]/100,t[3]/100,1):(t=N_e.exec(e))?Q9(t[1],t[2]/100,t[3]/100,t[4]):I9.hasOwnProperty(e)?L9(I9[e]):e==="transparent"?new Ba(NaN,NaN,NaN,0):null}function L9(e){return new Ba(e>>16&255,e>>8&255,e&255,1)}function uw(e,t,n,i){return i<=0&&(e=t=n=NaN),new Ba(e,t,n,i)}function R_e(e){return e instanceof P1||(e=xp(e)),e?(e=e.rgb(),new Ba(e.r,e.g,e.b,e.opacity)):new Ba}function xP(e,t,n,i){return arguments.length===1?R_e(e):new Ba(e,t,n,i??1)}function Ba(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}d$(Ba,xP,tte(P1,{brighter(e){return e=e==null?kk:Math.pow(kk,e),new Ba(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?hx:Math.pow(hx,e),new Ba(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ba(ap(this.r),ap(this.g),ap(this.b),Tk(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:D9,formatHex:D9,formatHex8:I_e,formatRgb:$9,toString:$9}));function D9(){return`#${Vh(this.r)}${Vh(this.g)}${Vh(this.b)}`}function I_e(){return`#${Vh(this.r)}${Vh(this.g)}${Vh(this.b)}${Vh((isNaN(this.opacity)?1:this.opacity)*255)}`}function $9(){const e=Tk(this.opacity);return`${e===1?"rgb(":"rgba("}${ap(this.r)}, ${ap(this.g)}, ${ap(this.b)}${e===1?")":`, ${e})`}`}function Tk(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ap(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vh(e){return e=ap(e),(e<16?"0":"")+e.toString(16)}function Q9(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new jl(e,t,n,i)}function nte(e){if(e instanceof jl)return new jl(e.h,e.s,e.l,e.opacity);if(e instanceof P1||(e=xp(e)),!e)return new jl;if(e instanceof jl)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),a=NaN,o=s-r,c=(s+r)/2;return o?(t===s?a=(n-i)/o+(n0&&c<1?0:a,new jl(a,o,c,e.opacity)}function P_e(e,t,n,i){return arguments.length===1?nte(e):new jl(e,t,n,i??1)}function jl(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}d$(jl,P_e,tte(P1,{brighter(e){return e=e==null?kk:Math.pow(kk,e),new jl(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?hx:Math.pow(hx,e),new jl(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new Ba(YN(e>=240?e-240:e+120,r,i),YN(e,r,i),YN(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new jl(B9(this.h),dw(this.s),dw(this.l),Tk(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Tk(this.opacity);return`${e===1?"hsl(":"hsla("}${B9(this.h)}, ${dw(this.s)*100}%, ${dw(this.l)*100}%${e===1?")":`, ${e})`}`}}));function B9(e){return e=(e||0)%360,e<0?e+360:e}function dw(e){return Math.max(0,Math.min(1,e||0))}function YN(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const f$=e=>()=>e;function M_e(e,t){return function(n){return e+n*t}}function L_e(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function D_e(e){return(e=+e)==1?ite:function(t,n){return n-t?L_e(t,n,e):f$(isNaN(t)?n:t)}}function ite(e,t){var n=t-e;return n?M_e(e,n):f$(isNaN(e)?t:e)}const _k=function e(t){var n=D_e(t);function i(r,s){var a=n((r=xP(r)).r,(s=xP(s)).r),o=n(r.g,s.g),c=n(r.b,s.b),u=ite(r.opacity,s.opacity);return function(d){return r.r=a(d),r.g=o(d),r.b=c(d),r.opacity=u(d),r+""}}return i.gamma=e,i}(1);function $_e(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,i=t.slice(),r;return function(s){for(r=0;r n&&(s=t.slice(n,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(r=r[0])?o[a]?o[a]+=r:o[++a]=r:(o[++a]=null,c.push({i:a,x:bc(i,r)})),n=GN.lastIndex;return n 180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(r(f)+"rotate(",null,i)-2,x:bc(u,d)})):d&&f.push(r(f)+"rotate("+d+i)}function o(u,d,f,h){u!==d?h.push({i:f.push(r(f)+"skewX(",null,i)-2,x:bc(u,d)}):d&&f.push(r(f)+"skewX("+d+i)}function c(u,d,f,h,p,g){if(u!==f||d!==h){var b=p.push(r(p)+"scale(",null,",",null,")");g.push({i:b-4,x:bc(u,f)},{i:b-2,x:bc(d,h)})}else(f!==1||h!==1)&&p.push(r(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),s(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),o(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var g=-1,b=h.length,y;++g=0&&e._call.call(void 0,t),e=e._next;--f0}function F9(){vp=(Nk=mx.now())+N_,f0=DO=0;try{J_e()}finally{f0=0,t2e(),vp=0}}function e2e(){var e=mx.now(),t=e-Nk;t>ote&&(N_-=t,Nk=e)}function t2e(){for(var e,t=Ak,n,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ak=n);$O=e,SP(i)}function SP(e){if(!f0){DO&&(DO=clearTimeout(DO));var t=e-vp;t>24?(e<1/0&&(DO=setTimeout(F9,e-mx.now()-N_)),nO&&(nO=clearInterval(nO))):(nO||(Nk=mx.now(),nO=setInterval(e2e,ote)),f0=1,lte(F9))}}function V9(e,t,n){var i=new Ck;return t=t==null?0:+t,i.restart(r=>{i.stop(),e(r+t)},t,n),i}var n2e=__("start","end","cancel","interrupt"),i2e=[],ute=0,X9=1,EP=2,GS=3,q9=4,kP=5,WS=6;function C_(e,t,n,i,r,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;r2e(e,n,{name:t,index:i,group:r,on:n2e,tween:i2e,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:ute})}function p$(e,t){var n=Vl(e,t);if(n.state>ute)throw new Error("too late; already scheduled");return n}function Yc(e,t){var n=Vl(e,t);if(n.state>GS)throw new Error("too late; already running");return n}function Vl(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function r2e(e,t,n){var i=e.__transition,r;i[t]=n,n.timer=cte(s,0,n.time);function s(u){n.state=X9,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==X9)return c();for(d in i)if(p=i[d],p.name===n.name){if(p.state===GS)return V9(a);p.state===q9?(p.state=WS,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[d]):+d EP&&i.state =0&&(t=t.slice(0,n)),!t||t==="start"})}function P2e(e,t,n){var i,r,s=I2e(t)?p$:Yc;return function(){var a=s(this,e),o=a.on;o!==i&&(r=(i=o).copy()).on(t,n),a.on=r}}function M2e(e,t){var n=this._id;return arguments.length<2?Vl(this.node(),n).on.on(e):this.each(P2e(n,e,t))}function L2e(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function D2e(){return this.on("end.remove",L2e(this._id))}function $2e(e){var t=this._name,n=this._id;typeof e!="function"&&(e=c$(e));for(var i=this._groups,r=i.length,s=new Array(r),a=0;a ()=>e;function cAe(e,{sourceEvent:t,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function Iu(e,t,n){this.k=e,this.x=t,this.y=n}Iu.prototype={constructor:Iu,scale:function(e){return e===1?this:new Iu(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Iu(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var j_=new Iu(1,0,0);pte.prototype=Iu.prototype;function pte(e){for(;!e.__zoom;)if(!(e=e.parentNode))return j_;return e.__zoom}function WN(e){e.stopImmediatePropagation()}function iO(e){e.preventDefault(),e.stopImmediatePropagation()}function uAe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function dAe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function H9(){return this.__zoom||j_}function fAe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function hAe(){return navigator.maxTouchPoints||"ontouchstart"in this}function pAe(e,t,n){var i=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function mte(){var e=uAe,t=dAe,n=pAe,i=fAe,r=hAe,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,c=YS,u=__("start","zoom","end"),d,f,h,p=500,g=150,b=0,y=10;function O(L){L.property("__zoom",H9).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",N).filter(r).on("touchstart.zoom",j).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}O.transform=function(L,Q,C,I){var U=L.selection?L.selection():L;U.property("__zoom",H9),L!==U?E(L,Q,C,I):U.interrupt().each(function(){S(this,arguments).event(I).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},O.scaleBy=function(L,Q,C,I){O.scaleTo(L,function(){var U=this.__zoom.k,B=typeof Q=="function"?Q.apply(this,arguments):Q;return U*B},C,I)},O.scaleTo=function(L,Q,C,I){O.transform(L,function(){var U=t.apply(this,arguments),B=this.__zoom,P=C==null?w(U):typeof C=="function"?C.apply(this,arguments):C,q=B.invert(P),G=typeof Q=="function"?Q.apply(this,arguments):Q;return n(x(v(B,G),P,q),U,a)},C,I)},O.translateBy=function(L,Q,C,I){O.transform(L,function(){return n(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),a)},null,I)},O.translateTo=function(L,Q,C,I,U){O.transform(L,function(){var B=t.apply(this,arguments),P=this.__zoom,q=I==null?w(B):typeof I=="function"?I.apply(this,arguments):I;return n(j_.translate(q[0],q[1]).scale(P.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof C=="function"?-C.apply(this,arguments):-C),B,a)},I,U)};function v(L,Q){return Q=Math.max(s[0],Math.min(s[1],Q)),Q===L.k?L:new Iu(Q,L.x,L.y)}function x(L,Q,C){var I=Q[0]-C[0]*L.k,U=Q[1]-C[1]*L.k;return I===L.x&&U===L.y?L:new Iu(L.k,I,U)}function w(L){return[(+L[0][0]+ +L[1][0])/2,(+L[0][1]+ +L[1][1])/2]}function E(L,Q,C,I){L.on("start.zoom",function(){S(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(I).end()}).tween("zoom",function(){var U=this,B=arguments,P=S(U,B).event(I),q=t.apply(U,B),G=C==null?w(q):typeof C=="function"?C.apply(U,B):C,$=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),V=U.__zoom,te=typeof Q=="function"?Q.apply(U,B):Q,fe=c(V.invert(G).concat($/V.k),te.invert(G).concat($/te.k));return function(Te){if(Te===1)Te=te;else{var J=fe(Te),ne=$/J[2];Te=new Iu(ne,G[0]-J[0]*ne,G[1]-J[1]*ne)}P.zoom(null,Te)}})}function S(L,Q,C){return!C&&L.__zooming||new k(L,Q)}function k(L,Q){this.that=L,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=t.apply(L,Q),this.taps=0}k.prototype={event:function(L){return L&&(this.sourceEvent=L),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(L,Q){return this.mouse&&L!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&L!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&L!=="touch"&&(this.touch1[1]=Q.invert(this.touch1[0])),this.that.__zoom=Q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(L){var Q=go(this.that).datum();u.call(L,this.that,new cAe(L,{sourceEvent:this.sourceEvent,target:O,transform:this.that.__zoom,dispatch:u}),Q)}};function T(L,...Q){if(!e.apply(this,arguments))return;var C=S(this,Q).event(L),I=this.__zoom,U=Math.max(s[0],Math.min(s[1],I.k*Math.pow(2,i.apply(this,arguments)))),B=Al(L);if(C.wheel)(C.mouse[0][0]!==B[0]||C.mouse[0][1]!==B[1])&&(C.mouse[1]=I.invert(C.mouse[0]=B)),clearTimeout(C.wheel);else{if(I.k===U)return;C.mouse=[B,I.invert(B)],ZS(this),C.start()}iO(L),C.wheel=setTimeout(P,g),C.zoom("mouse",n(x(v(I,U),C.mouse[0],C.mouse[1]),C.extent,a));function P(){C.wheel=null,C.end()}}function A(L,...Q){if(h||!e.apply(this,arguments))return;var C=L.currentTarget,I=S(this,Q,!0).event(L),U=go(L.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",$,!0),B=Al(L,C),P=L.clientX,q=L.clientY;Kee(L.view),WN(L),I.mouse=[B,this.__zoom.invert(B)],ZS(this),I.start();function G(V){if(iO(V),!I.moved){var te=V.clientX-P,fe=V.clientY-q;I.moved=te*te+fe*fe>b}I.event(V).zoom("mouse",n(x(I.that.__zoom,I.mouse[0]=Al(V,C),I.mouse[1]),I.extent,a))}function $(V){U.on("mousemove.zoom mouseup.zoom",null),Jee(V.view,I.moved),iO(V),I.event(V).end()}}function N(L,...Q){if(e.apply(this,arguments)){var C=this.__zoom,I=Al(L.changedTouches?L.changedTouches[0]:L,this),U=C.invert(I),B=C.k*(L.shiftKey?.5:2),P=n(x(v(C,B),I,U),t.apply(this,Q),a);iO(L),o>0?go(this).transition().duration(o).call(E,P,I,L):go(this).call(O.transform,P,I,L)}}function j(L,...Q){if(e.apply(this,arguments)){var C=L.touches,I=C.length,U=S(this,Q,L.changedTouches.length===I).event(L),B,P,q,G;for(WN(L),P=0;P`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:i})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:i}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},gx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],gte=["Enter"," ","Escape"],bte={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var h0;(function(e){e.Strict="strict",e.Loose="loose"})(h0||(h0={}));var op;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(op||(op={}));var bx;(function(e){e.Partial="partial",e.Full="full"})(bx||(bx={}));const Ote={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ef;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ef||(ef={}));var Ox;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ox||(Ox={}));var wt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(wt||(wt={}));const Y9={[wt.Left]:wt.Right,[wt.Right]:wt.Left,[wt.Top]:wt.Bottom,[wt.Bottom]:wt.Top};function yte(e){return e===null?null:e?"valid":"invalid"}const xte=e=>"id"in e&&"source"in e&&"target"in e,mAe=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),g$=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),M1=(e,t=[0,0])=>{const{width:n,height:i}=fd(e),r=e.origin??t,s=n*r[0],a=i*r[1];return{x:e.position.x-s,y:e.position.y-a}},gAe=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((i,r)=>{const s=typeof r=="string";let a=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(r):g$(r)?r:t.nodeLookup.get(r.id));const o=a?jk(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return R_(i,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return I_(n)},L1=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=R_(n,jk(r)),i=!0)}),i?I_(n):{x:0,y:0,width:0,height:0}},b$=(e,t,[n,i,r]=[0,0,1],s=!1,a=!1)=>{const o={...eb(t,[n,i,r]),width:t.width/r,height:t.height/r},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,g=d.height??u.height??u.initialHeight??null,b=yx(o,m0(u)),y=(p??0)*(g??0),O=s&&b>0;(!u.internals.handleBounds||O||b>=y||u.dragging)&&c.push(u)}return c},bAe=(e,t)=>{const n=new Set;return e.forEach(i=>{n.add(i.id)}),t.filter(i=>n.has(i.source)||n.has(i.target))};function OAe(e,t){const n=new Map,i=t!=null&&t.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!r.hidden)&&(!i||i.has(r.id))&&n.set(r.id,r)}),n}async function yAe({nodes:e,width:t,height:n,panZoom:i,minZoom:r,maxZoom:s},a){if(e.size===0)return!0;const o=OAe(e,a),c=L1(o),u=y$(c,t,n,(a==null?void 0:a.minZoom)??r,(a==null?void 0:a.maxZoom)??s,(a==null?void 0:a.padding)??.1);return await i.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function vte({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:i=[0,0],nodeExtent:r,onError:s}){const a=n.get(e),o=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=o?o.internals.positionAbsolute:{x:0,y:0},d=a.origin??i;let f=a.extent||r;if(a.extent==="parent"&&!a.expandParent)if(!o)s==null||s("005",Bl.error005());else{const p=o.measured.width,g=o.measured.height;p&&g&&(f=[[c,u],[c+p,u+g]])}else o&&Sp(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=Sp(f)?wp(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",Bl.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function xAe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:i,onBeforeDelete:r}){const s=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=s.has(h.id),g=!p&&h.parentId&&a.find(b=>b.id===h.parentId);(p||g)&&a.push(h)}const o=new Set(t.map(h=>h.id)),c=i.filter(h=>h.deletable!==!1),d=bAe(a,c);for(const h of c)o.has(h.id)&&!d.find(g=>g.id===h.id)&&d.push(h);if(!r)return{edges:d,nodes:a};const f=await r({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const p0=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),wp=(e={x:0,y:0},t,n)=>({x:p0(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:p0(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function wte(e,t,n){const{width:i,height:r}=fd(n),{x:s,y:a}=n.internals.positionAbsolute;return wp(e,[[s,a],[s+i,a+r]],t)}const G9=(e,t,n)=>e n?-p0(Math.abs(e-n),1,t)/t:0,O$=(e,t,n=15,i=40)=>{const r=G9(e.x,i,t.width-i)*n,s=G9(e.y,i,t.height-i)*n;return[r,s]},R_=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),TP=({x:e,y:t,width:n,height:i})=>({x:e,y:t,x2:e+n,y2:t+i}),I_=({x:e,y:t,x2:n,y2:i})=>({x:e,y:t,width:n-e,height:i-t}),m0=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=g$(e)?e.internals.positionAbsolute:M1(e,t);return{x:n,y:i,width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},jk=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=g$(e)?e.internals.positionAbsolute:M1(e,t);return{x:n,y:i,x2:n+(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0),y2:i+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},Ste=(e,t)=>I_(R_(TP(e),TP(t))),yx=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*i)},W9=e=>Il(e.width)&&Il(e.height)&&Il(e.x)&&Il(e.y),Il=e=>!isNaN(e)&&isFinite(e),Ete=(e,t)=>(n,i)=>{},D1=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),eb=({x:e,y:t},[n,i,r],s=!1,a=[1,1])=>{const o={x:(e-n)/r,y:(t-i)/r};return s?D1(o,a):o},g0=({x:e,y:t},[n,i,r])=>({x:e*r+n,y:t*r+i});function fm(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function vAe(e,t,n){if(typeof e=="string"||typeof e=="number"){const i=fm(e,n),r=fm(e,t);return{top:i,right:r,bottom:i,left:r,x:r*2,y:i*2}}if(typeof e=="object"){const i=fm(e.top??e.y??0,n),r=fm(e.bottom??e.y??0,n),s=fm(e.left??e.x??0,t),a=fm(e.right??e.x??0,t);return{top:i,right:a,bottom:r,left:s,x:s+a,y:i+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function wAe(e,t,n,i,r,s){const{x:a,y:o}=g0(e,[t,n,i]),{x:c,y:u}=g0({x:e.x+e.width,y:e.y+e.height},[t,n,i]),d=r-c,f=s-u;return{left:Math.floor(a),top:Math.floor(o),right:Math.floor(d),bottom:Math.floor(f)}}const y$=(e,t,n,i,r,s)=>{const a=vAe(s,t,n),o=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(o,c),d=p0(u,i,r),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,g=n/2-h*d,b=wAe(e,p,g,d,t,n),y={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:p-y.left+y.right,y:g-y.top+y.bottom,zoom:d}},xx=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Sp(e){return e!=null&&e!=="parent"}function fd(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function x$(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function kte(e,t={width:0,height:0},n,i,r){const s={...e},a=i.get(n);if(a){const o=a.origin||r;s.x+=a.internals.positionAbsolute.x-(t.width??0)*o[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*o[1]}return s}function Z9(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function SAe(){let e,t;return{promise:new Promise((i,r)=>{e=i,t=r}),resolve:e,reject:t}}function EAe(e){return{...bte,...e||{}}}function xy(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:i,containerBounds:r}){const{x:s,y:a}=Pl(e),o=eb({x:s-((r==null?void 0:r.left)??0),y:a-((r==null?void 0:r.top)??0)},i),{x:c,y:u}=n?D1(o,t):o;return{xSnapped:c,ySnapped:u,...o}}const v$=e=>({width:e.offsetWidth,height:e.offsetHeight}),Tte=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},kAe=["INPUT","SELECT","TEXTAREA"];function _te(e){var i,r;const t=((r=(i=e.composedPath)==null?void 0:i.call(e))==null?void 0:r[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:kAe.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ate=e=>"clientX"in e,Pl=(e,t)=>{var s,a;const n=Ate(e),i=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,r=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},K9=(e,t,n,i,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{const o=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:r,position:a.getAttribute("data-handlepos"),x:(o.left-n.left)/i,y:(o.top-n.top)/i,...v$(a)}})};function Nte({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:r,sourceControlY:s,targetControlX:a,targetControlY:o}){const c=e*.125+r*.375+a*.375+n*.125,u=t*.125+s*.375+o*.375+i*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function pw(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function J9({pos:e,x1:t,y1:n,x2:i,y2:r,c:s}){switch(e){case wt.Left:return[t-pw(t-i,s),n];case wt.Right:return[t+pw(i-t,s),n];case wt.Top:return[t,n-pw(n-r,s)];case wt.Bottom:return[t,n+pw(r-n,s)]}}function Cte({sourceX:e,sourceY:t,sourcePosition:n=wt.Bottom,targetX:i,targetY:r,targetPosition:s=wt.Top,curvature:a=.25}){const[o,c]=J9({pos:n,x1:e,y1:t,x2:i,y2:r,c:a}),[u,d]=J9({pos:s,x1:i,y1:r,x2:e,y2:t,c:a}),[f,h,p,g]=Nte({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:o,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${o},${c} ${u},${d} ${i},${r}`,f,h,p,g]}function jte({sourceX:e,sourceY:t,targetX:n,targetY:i}){const r=Math.abs(n-e)/2,s=n 0}const AAe=({source:e,sourceHandle:t,target:n,targetHandle:i})=>`xy-edge__${e}${t||""}-${n}${i||""}`,NAe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),CAe=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",Bl.error006()),t;const i=n.getEdgeId||AAe;let r;return xte(e)?r={...e}:r={...e,id:i(e)},NAe(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Rte({sourceX:e,sourceY:t,targetX:n,targetY:i}){const[r,s,a,o]=jte({sourceX:e,sourceY:t,targetX:n,targetY:i});return[`M ${e},${t}L ${n},${i}`,r,s,a,o]}const eU={[wt.Left]:{x:-1,y:0},[wt.Right]:{x:1,y:0},[wt.Top]:{x:0,y:-1},[wt.Bottom]:{x:0,y:1}},jAe=({source:e,sourcePosition:t=wt.Bottom,target:n})=>t===wt.Left||t===wt.Right?e.x Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function RAe({source:e,sourcePosition:t=wt.Bottom,target:n,targetPosition:i=wt.Top,center:r,offset:s,stepPosition:a}){const o=eU[t],c=eU[i],u={x:e.x+o.x*s,y:e.y+o.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},f=jAe({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let g=[],b,y;const O={x:0,y:0},v={x:0,y:0},[,,x,w]=jte({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[h]*c[h]===-1){h==="x"?(b=r.x??u.x+(d.x-u.x)*a,y=r.y??(u.y+d.y)/2):(b=r.x??(u.x+d.x)/2,y=r.y??u.y+(d.y-u.y)*a);const T=[{x:b,y:u.y},{x:b,y:d.y}],A=[{x:u.x,y},{x:d.x,y}];o[h]===p?g=h==="x"?T:A:g=h==="x"?A:T}else{const T=[{x:u.x,y:d.y}],A=[{x:d.x,y:u.y}];if(h==="x"?g=o.x===p?A:T:g=o.y===p?T:A,t===i){const L=Math.abs(e[h]-n[h]);if(L<=s){const Q=Math.min(s-1,s-L);o[h]===p?O[h]=(u[h]>e[h]?-1:1)*Q:v[h]=(d[h]>n[h]?-1:1)*Q}}if(t!==i){const L=h==="x"?"y":"x",Q=o[h]===c[L],C=u[L]>d[L],I=u[L] =D?(b=(N.x+j.x)/2,y=g[0].y):(b=g[0].x,y=(N.y+j.y)/2)}const E={x:u.x+O.x,y:u.y+O.y},S={x:d.x+v.x,y:d.y+v.y};return[[e,...E.x!==g[0].x||E.y!==g[0].y?[E]:[],...g,...S.x!==g[g.length-1].x||S.y!==g[g.length-1].y?[S]:[],n],b,y,x,w]}function IAe(e,t,n,i){const r=Math.min(tU(e,t)/2,tU(t,n)/2,i),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){const u=e.x n.id===t):e[0])||null}function _P(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function MAe(e,{id:t,defaultColor:n,defaultMarkerStart:i,defaultMarkerEnd:r}){const s=new Set;return e.reduce((a,o)=>([o.markerStart||i,o.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const u=_P(c,t);s.has(u)||(a.push({id:u,color:c.color||n,...c}),s.add(u))}}),a),[]).sort((a,o)=>a.id.localeCompare(o.id))}const Ite=1e3,LAe=10,w$={nodeOrigin:[0,0],nodeExtent:gx,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},DAe={...w$,checkEquality:!0};function S$(e,t){const n={...e};for(const i in t)t[i]!==void 0&&(n[i]=t[i]);return n}function $Ae(e,t,n){const i=S$(w$,n);for(const r of e.values())if(r.parentId)k$(r,e,t,i);else{const s=M1(r,i.nodeOrigin),a=Sp(r.extent)?r.extent:i.nodeExtent,o=wp(s,a,fd(r));r.internals.positionAbsolute=o}}function QAe(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],i=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&i.push(s)}return{source:n,target:i}}function E$(e){return e==="manual"}function AP(e,t,n,i={}){var d,f;const r=S$(DAe,i),s={i:0},a=new Map(t),o=r!=null&&r.elevateNodesOnSelect&&!E$(r.zIndexMode)?Ite:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(r.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const g=M1(h,r.nodeOrigin),b=Sp(h.extent)?h.extent:r.nodeExtent,y=wp(g,b,fd(h));p={...r.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:y,handleBounds:QAe(h,p),z:Pte(h,o,r.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&k$(p,t,n,i,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function BAe(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function k$(e,t,n,i,r){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:o,zIndexMode:c}=S$(w$,i),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}BAe(e,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*LAe),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const f=s&&!E$(c)?Ite:0,{x:h,y:p,z:g}=UAe(e,d,a,o,f,c),{positionAbsolute:b}=e.internals,y=h!==b.x||p!==b.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:h,y:p}:b,z:g}})}function Pte(e,t,n){const i=Il(e.zIndex)?e.zIndex:0;return E$(n)?i:i+(e.selected?t:0)}function UAe(e,t,n,i,r,s){const{x:a,y:o}=t.internals.positionAbsolute,c=fd(e),u=M1(e,n),d=Sp(e.extent)?wp(u,e.extent,c):u;let f=wp({x:a+d.x,y:o+d.y},i,c);e.extent==="parent"&&(f=wte(f,c,t));const h=Pte(e,r,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function T$(e,t,n,i=[0,0]){var a;const r=[],s=new Map;for(const o of e){const c=t.get(o.parentId);if(!c)continue;const u=((a=s.get(o.parentId))==null?void 0:a.expandedRect)??m0(c),d=Ste(u,o.rect);s.set(o.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:o,parent:c},u)=>{var x;const d=c.internals.positionAbsolute,f=fd(c),h=c.origin??i,p=o.x 0||g>0||O||v)&&(r.push({id:u,type:"position",position:{x:c.position.x-p+O,y:c.position.y-g+v}}),(x=n.get(u))==null||x.forEach(w=>{e.some(E=>E.id===w.id)||r.push({id:w.id,type:"position",position:{x:w.position.x+p,y:w.position.y+g}})})),(f.width 0){const p=T$(h,t,n,r);u.push(...p)}return{changes:u,updatedInternals:c}}async function FAe({delta:e,panZoom:t,transform:n,translateExtent:i,width:r,height:s}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],i);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function sU(e,t,n,i,r,s){let a=r;const o=i.get(a)||new Map;i.set(a,o.set(n,t)),a=`${r}-${e}`;const c=i.get(a)||new Map;if(i.set(a,c.set(n,t)),s){a=`${r}-${e}-${s}`;const u=i.get(a)||new Map;i.set(a,u.set(n,t))}}function Mte(e,t,n){e.clear(),t.clear();for(const i of n){const{source:r,target:s,sourceHandle:a=null,targetHandle:o=null}=i,c={edgeId:i.id,source:r,target:s,sourceHandle:a,targetHandle:o},u=`${r}-${a}--${s}-${o}`,d=`${s}-${o}--${r}-${a}`;sU("source",c,d,e,r,a),sU("target",c,u,e,s,o),t.set(i.id,i)}}function Lte(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Lte(n,t):!1}function aU(e,t,n){var r;let i=e;do{if((r=i==null?void 0:i.matches)!=null&&r.call(i,t))return!0;if(i===n)return!1;i=i==null?void 0:i.parentElement}while(i);return!1}function VAe(e,t,n,i){const r=new Map;for(const[s,a]of e)if((a.selected||a.id===i)&&(!a.parentId||!Lte(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const o=e.get(s);o&&r.set(s,{id:s,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return r}function ZN({nodeId:e,dragItems:t,nodeLookup:n,dragging:i=!0}){var a,o,c;const r=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&r.push({...f,position:d.position,dragging:i})}if(!e)return[r[0],r];const s=(o=n.get(e))==null?void 0:o.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:i}:r[0],r]}function XAe({dragItems:e,snapGrid:t,x:n,y:i}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:i-r.distance.y},a=D1(s,t);return{x:a.x-s.x,y:a.y-s.y}}function qAe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:i,onDragStop:r}){let s={x:null,y:null},a=0,o=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,g=!1,b=null;function y({noDragClassName:v,handleSelector:x,domNode:w,isSelectable:E,nodeId:S,nodeClickDistance:k=0}){h=go(w);function T({x:M,y:D}){const{nodeLookup:L,nodeExtent:Q,snapGrid:C,snapToGrid:I,nodeOrigin:U,onNodeDrag:B,onSelectionDrag:P,onError:q,updateNodePositions:G}=t();s={x:M,y:D};let $=!1;const V=o.size>1,te=V&&Q?TP(L1(o)):null,fe=V&&I?XAe({dragItems:o,snapGrid:C,x:M,y:D}):null;for(const[Te,J]of o){if(!L.has(Te))continue;let ne={x:M-J.distance.x,y:D-J.distance.y};I&&(ne=fe?{x:Math.round(ne.x+fe.x),y:Math.round(ne.y+fe.y)}:D1(ne,C));let ce=null;if(V&&Q&&!J.extent&&te){const{positionAbsolute:je}=J.internals,ve=je.x-te.x+Q[0][0],be=je.x+J.measured.width-te.x2+Q[1][0],ae=je.y-te.y+Q[0][1],Re=je.y+J.measured.height-te.y2+Q[1][1];ce=[[ve,ae],[be,Re]]}const{position:Oe,positionAbsolute:Se}=vte({nodeId:Te,nextPosition:ne,nodeLookup:L,nodeExtent:ce||Q,nodeOrigin:U,onError:q});$=$||J.position.x!==Oe.x||J.position.y!==Oe.y,J.position=Oe,J.internals.positionAbsolute=Se}if(g=g||$,!!$&&(G(o,!0),b&&(i||B||!S&&P))){const[Te,J]=ZN({nodeId:S,dragItems:o,nodeLookup:L});i==null||i(b,o,Te,J),B==null||B(b,Te,J),S||P==null||P(b,J)}}async function A(){if(!d)return;const{transform:M,panBy:D,autoPanSpeed:L,autoPanOnNodeDrag:Q}=t();if(!Q){c=!1,cancelAnimationFrame(a);return}const[C,I]=O$(u,d,L);(C!==0||I!==0)&&(s.x=(s.x??0)-C/M[2],s.y=(s.y??0)-I/M[2],await D({x:C,y:I})&&T(s)),a=requestAnimationFrame(A)}function N(M){var V;const{nodeLookup:D,multiSelectionActive:L,nodesDraggable:Q,transform:C,snapGrid:I,snapToGrid:U,selectNodesOnDrag:B,onNodeDragStart:P,onSelectionDragStart:q,unselectNodesAndEdges:G}=t();f=!0,(!B||!E)&&!L&&S&&((V=D.get(S))!=null&&V.selected||G()),E&&B&&S&&(e==null||e(S));const $=xy(M.sourceEvent,{transform:C,snapGrid:I,snapToGrid:U,containerBounds:d});if(s=$,o=VAe(D,Q,$,S),o.size>0&&(n||P||!S&&q)){const[te,fe]=ZN({nodeId:S,dragItems:o,nodeLookup:D});n==null||n(M.sourceEvent,o,te,fe),P==null||P(M.sourceEvent,te,fe),S||q==null||q(M.sourceEvent,fe)}}const j=ete().clickDistance(k).on("start",M=>{const{domNode:D,nodeDragThreshold:L,transform:Q,snapGrid:C,snapToGrid:I}=t();d=(D==null?void 0:D.getBoundingClientRect())||null,p=!1,g=!1,b=M.sourceEvent,L===0&&N(M),s=xy(M.sourceEvent,{transform:Q,snapGrid:C,snapToGrid:I,containerBounds:d}),u=Pl(M.sourceEvent,d)}).on("drag",M=>{const{autoPanOnNodeDrag:D,transform:L,snapGrid:Q,snapToGrid:C,nodeDragThreshold:I,nodeLookup:U}=t(),B=xy(M.sourceEvent,{transform:L,snapGrid:Q,snapToGrid:C,containerBounds:d});if(b=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||S&&!U.has(S))&&(p=!0),!p){if(!c&&D&&f&&(c=!0,A()),!f){const P=Pl(M.sourceEvent,d),q=P.x-u.x,G=P.y-u.y;Math.sqrt(q*q+G*G)>I&&N(M)}(s.x!==B.xSnapped||s.y!==B.ySnapped)&&o&&f&&(u=Pl(M.sourceEvent,d),T(B))}}).on("end",M=>{if(!f||p){p&&o.size>0&&t().updateNodePositions(o,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),o.size>0){const{nodeLookup:D,updateNodePositions:L,onNodeDragStop:Q,onSelectionDragStop:C}=t();if(g&&(L(o,!1),g=!1),r||Q||!S&&C){const[I,U]=ZN({nodeId:S,dragItems:o,nodeLookup:D,dragging:!1});r==null||r(M.sourceEvent,o,I,U),Q==null||Q(M.sourceEvent,I,U),S||C==null||C(M.sourceEvent,U)}}}).filter(M=>{const D=M.target;return!M.button&&(!v||!aU(D,`.${v}`,w))&&(!x||aU(D,x,w))});h.call(j)}function O(){h==null||h.on(".drag",null)}return{update:y,destroy:O}}function HAe(e,t,n){const i=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())yx(r,m0(s))>0&&i.push(s);return i}const YAe=250;function GAe(e,t,n,i){var o,c;let r=[],s=1/0;const a=HAe(e,n,t+YAe);for(const u of a){const d=[...((o=u.internals.handleBounds)==null?void 0:o.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:h,y:p}=Ep(u,f,f.position,!0),g=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));g>t||(g 1){const u=i.type==="source"?"target":"source";return r.find(d=>d.type===u)??r[0]}return r[0]}function Dte(e,t,n,i,r,s=!1){var u,d,f;const a=i.get(e);if(!a)return null;const o=r==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?o==null?void 0:o.find(h=>h.id===n):o==null?void 0:o[0])??null;return c&&s?{...c,...Ep(a,c,c.position,!0)}:c}function $te(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function WAe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Qte=()=>!0;function ZAe(e,{connectionMode:t,connectionRadius:n,handleId:i,nodeId:r,edgeUpdaterType:s,isTarget:a,domNode:o,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:g,onConnect:b,onConnectEnd:y,isValidConnection:O=Qte,onReconnectEnd:v,updateConnection:x,getTransform:w,getFromHandle:E,autoPanSpeed:S,dragThreshold:k=1,handleDomNode:T}){const A=Tte(e.target);let N=0,j;const{x:M,y:D}=Pl(e),L=$te(s,T),Q=o==null?void 0:o.getBoundingClientRect();let C=!1;if(!Q||!L)return;const I=Dte(r,L,i,c,t);if(!I)return;let U=Pl(e,Q),B=!1,P=null,q=!1,G=null;function $(){if(!d||!Q)return;const[Oe,Se]=O$(U,Q,S);h({x:Oe,y:Se}),N=requestAnimationFrame($)}const V={...I,nodeId:r,type:L,position:I.position},te=c.get(r);let Te={inProgress:!0,isValid:null,from:Ep(te,V,wt.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:te,to:U,toHandle:null,toPosition:Y9[V.position],toNode:null,pointer:U};function J(){C=!0,x(Te),g==null||g(e,{nodeId:r,handleId:i,handleType:L})}k===0&&J();function ne(Oe){if(!C){const{x:Re,y:xe}=Pl(Oe),Be=Re-M,qe=xe-D;if(!(Be*Be+qe*qe>k*k))return;J()}if(!E()||!V){ce(Oe);return}const Se=w();U=Pl(Oe,Q),j=GAe(eb(U,Se,!1,[1,1]),n,c,V),B||($(),B=!0);const je=Bte(Oe,{handle:j,connectionMode:t,fromNodeId:r,fromHandleId:i,fromType:a?"target":"source",isValidConnection:O,doc:A,lib:u,flowId:f,nodeLookup:c});G=je.handleDomNode,P=je.connection,q=WAe(!!j,je.isValid);const ve=c.get(r),be=ve?Ep(ve,V,wt.Left,!0):Te.from,ae={...Te,from:be,isValid:q,to:je.toHandle&&q?g0({x:je.toHandle.x,y:je.toHandle.y},Se):U,toHandle:je.toHandle,toPosition:q&&je.toHandle?je.toHandle.position:Y9[V.position],toNode:je.toHandle?c.get(je.toHandle.nodeId):null,pointer:U};x(ae),Te=ae}function ce(Oe){if(!("touches"in Oe&&Oe.touches.length>0)){if(C){(j||G)&&P&&q&&(b==null||b(P));const{inProgress:Se,...je}=Te,ve={...je,toPosition:Te.toHandle?Te.toPosition:null};y==null||y(Oe,ve),s&&(v==null||v(Oe,ve))}p(),cancelAnimationFrame(N),B=!1,q=!1,P=null,G=null,A.removeEventListener("mousemove",ne),A.removeEventListener("mouseup",ce),A.removeEventListener("touchmove",ne),A.removeEventListener("touchend",ce)}}A.addEventListener("mousemove",ne),A.addEventListener("mouseup",ce),A.addEventListener("touchmove",ne),A.addEventListener("touchend",ce)}function Bte(e,{handle:t,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:s,doc:a,lib:o,flowId:c,isValidConnection:u=Qte,nodeLookup:d}){const f=s==="target",h=t?a.querySelector(`.${o}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:g}=Pl(e),b=a.elementFromPoint(p,g),y=b!=null&&b.classList.contains(`${o}-flow__handle`)?b:h,O={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const v=$te(void 0,y),x=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),E=y.classList.contains("connectable"),S=y.classList.contains("connectableend");if(!x||!v)return O;const k={source:f?x:i,sourceHandle:f?w:r,target:f?i:x,targetHandle:f?r:w};O.connection=k;const A=E&&S&&(n===h0.Strict?f&&v==="source"||!f&&v==="target":x!==i||w!==r);O.isValid=A&&u(k),O.toHandle=Dte(x,v,w,d,n,!0)}return O}const NP={onPointerDown:ZAe,isValid:Bte};function KAe({domNode:e,panZoom:t,getTransform:n,getViewScale:i}){const r=go(e);function s({translateExtent:o,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const g=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const w=n(),E=x.sourceEvent.ctrlKey&&xx()?10:1,S=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*d,k=w[2]*Math.pow(2,S*E);t.scaleTo(k)};let b=[0,0];const y=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(b=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},O=x=>{const w=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const E=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],S=[E[0]-b[0],E[1]-b[1]];b=E;const k=i()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),T={x:w[0]-S[0]*k,y:w[1]-S[1]*k},A=[[0,0],[c,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},A,o)},v=mte().on("start",y).on("zoom",f?O:null).on("zoom.wheel",h?g:null);r.call(v,{})}function a(){r.on("zoom",null)}return{update:s,destroy:a,pointer:Al}}const P_=e=>({x:e.x,y:e.y,zoom:e.k}),KN=({x:e,y:t,zoom:n})=>j_.translate(e,t).scale(n),lg=(e,t)=>e.target.closest(`.${t}`),Ute=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),JAe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,JN=(e,t=0,n=JAe,i=()=>{})=>{const r=typeof t=="number"&&t>0;return r||i(),r?e.transition().duration(t).ease(n).on("end",i):e},zte=e=>{const t=e.ctrlKey&&xx()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function eNe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:i,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:o,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(lg(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const y=Al(d),O=zte(d),v=f*Math.pow(2,O);i.scaleTo(n,v,y,d);return}const h=d.deltaMode===1?20:1;let p=r===op.Vertical?0:d.deltaX*h,g=r===op.Horizontal?0:d.deltaY*h;!xx()&&d.shiftKey&&r!==op.Vertical&&(p=d.deltaY*h,g=0),i.translateBy(n,-(p/f)*s,-(g/f)*s,{internal:!0});const b=P_(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,o==null||o(d,b))}}function tNe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(i,r){const s=i.type==="wheel",a=!t&&s&&!i.ctrlKey,o=lg(i,e);if(i.ctrlKey&&s&&o&&i.preventDefault(),a||o)return null;i.preventDefault(),n.call(this,i,r)}}function nNe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return i=>{var s,a,o;if((s=i.sourceEvent)!=null&&s.internal)return;const r=P_(i.transform);e.mouseButton=((a=i.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=r,((o=i.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(i.sourceEvent,r))}}function iNe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:i,onPanZoom:r}){return s=>{var a,o;e.usedRightMouseButton=!!(n&&Ute(t,e.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||i([s.transform.x,s.transform.y,s.transform.k]),r&&!((o=s.sourceEvent)!=null&&o.internal)&&(r==null||r(s.sourceEvent,P_(s.transform)))}}function rNe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:i,onPanZoomEnd:r,onPaneContextMenu:s}){return a=>{var o;if(!((o=a.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,s&&Ute(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,i(!1),r)){const c=P_(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(a.sourceEvent,c)},n?150:0)}}}function sNe({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:i,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:o,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var y;const h=e||t,p=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(lg(f,`${u}-flow__node`)||lg(f,`${u}-flow__edge`)))return!0;if(!i&&!h&&!r&&!s&&!n||a||d&&!g||lg(f,o)&&g||lg(f,c)&&(!g||r&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((y=f.touches)==null?void 0:y.length)>1)return f.preventDefault(),!1;if(!h&&!r&&!p&&g||!i&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(i)&&!i.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&b}}function aNe({domNode:e,minZoom:t,maxZoom:n,translateExtent:i,viewport:r,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:o,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=mte().scaleExtent([t,n]).translateExtent(i),h=go(e).call(f);v({x:r.x,y:r.y,zoom:p0(r.zoom,t,n)},[[0,0],[d.width,d.height]],i);const p=h.on("wheel.zoom"),g=h.on("dblclick.zoom");f.wheelDelta(zte);async function b(j,M){return h?new Promise(D=>{f==null||f.interpolate((M==null?void 0:M.interpolate)==="linear"?yy:YS).transform(JN(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>D(!0)),j)}):!1}function y({noWheelClassName:j,noPanClassName:M,onPaneContextMenu:D,userSelectionActive:L,panOnScroll:Q,panOnDrag:C,panOnScrollMode:I,panOnScrollSpeed:U,preventScrolling:B,zoomOnPinch:P,zoomOnScroll:q,zoomOnDoubleClick:G,zoomActivationKeyPressed:$,lib:V,onTransformChange:te,connectionInProgress:fe,paneClickDistance:Te,selectionOnDrag:J}){L&&!u.isZoomingOrPanning&&O();const ne=Q&&!$&&!L;f.clickDistance(J?1/0:!Il(Te)||Te<0?0:Te);const ce=ne?eNe({zoomPanValues:u,noWheelClassName:j,d3Selection:h,d3Zoom:f,panOnScrollMode:I,panOnScrollSpeed:U,zoomOnPinch:P,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:o}):tNe({noWheelClassName:j,preventScrolling:B,d3ZoomHandler:p});h.on("wheel.zoom",ce,{passive:!1});const Oe=nNe({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",Oe);const Se=iNe({zoomPanValues:u,panOnDrag:C,onPaneContextMenu:!!D,onPanZoom:s,onTransformChange:te});f.on("zoom",Se);const je=rNe({zoomPanValues:u,panOnDrag:C,panOnScroll:Q,onPaneContextMenu:D,onPanZoomEnd:o,onDraggingChange:c});f.on("end",je);const ve=sNe({zoomActivationKeyPressed:$,panOnDrag:C,zoomOnScroll:q,panOnScroll:Q,zoomOnDoubleClick:G,zoomOnPinch:P,userSelectionActive:L,noPanClassName:M,noWheelClassName:j,lib:V,connectionInProgress:fe});f.filter(ve),G?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function O(){f.on("zoom",null)}async function v(j,M,D){const L=KN(j),Q=f==null?void 0:f.constrain()(L,M,D);return Q&&await b(Q),Q}async function x(j,M){const D=KN(j);return await b(D,M),D}function w(j){if(h){const M=KN(j),D=h.property("__zoom");(D.k!==j.zoom||D.x!==j.x||D.y!==j.y)&&(f==null||f.transform(h,M,null,{sync:!0}))}}function E(){const j=h?pte(h.node()):{x:0,y:0,k:1};return{x:j.x,y:j.y,zoom:j.k}}async function S(j,M){return h?new Promise(D=>{f==null||f.interpolate((M==null?void 0:M.interpolate)==="linear"?yy:YS).scaleTo(JN(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>D(!0)),j)}):!1}async function k(j,M){return h?new Promise(D=>{f==null||f.interpolate((M==null?void 0:M.interpolate)==="linear"?yy:YS).scaleBy(JN(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>D(!0)),j)}):!1}function T(j){f==null||f.scaleExtent(j)}function A(j){f==null||f.translateExtent(j)}function N(j){const M=!Il(j)||j<0?0:j;f==null||f.clickDistance(M)}return{update:y,destroy:O,setViewport:x,setViewportConstrained:v,getViewport:E,scaleTo:S,scaleBy:k,setScaleExtent:T,setTranslateExtent:A,syncViewport:w,setClickDistance:N}}var b0;(function(e){e.Line="line",e.Handle="handle"})(b0||(b0={}));function oNe({width:e,prevWidth:t,height:n,prevHeight:i,affectsX:r,affectsY:s}){const a=e-t,o=n-i,c=[a>0?1:a<0?-1:0,o>0?1:o<0?-1:0];return a&&r&&(c[0]=c[0]*-1),o&&s&&(c[1]=c[1]*-1),c}function oU(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),i=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:i,affectsY:r}}function Pd(e,t){return Math.max(0,t-e)}function Md(e,t){return Math.max(0,e-t)}function mw(e,t,n){return Math.max(0,t-e,e-n)}function lU(e,t){return e?!t:t}function lNe(e,t,n,i,r,s,a,o){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:g}=n,{minWidth:b,maxWidth:y,minHeight:O,maxHeight:v}=i,{x,y:w,width:E,height:S,aspectRatio:k}=e;let T=Math.floor(d?p-e.pointerX:0),A=Math.floor(f?g-e.pointerY:0);const N=E+(c?-T:T),j=S+(u?-A:A),M=-s[0]*E,D=-s[1]*S;let L=mw(N,b,y),Q=mw(j,O,v);if(a){let U=0,B=0;c&&T<0?U=Pd(x+T+M,a[0][0]):!c&&T>0&&(U=Md(x+N+M,a[1][0])),u&&A<0?B=Pd(w+A+D,a[0][1]):!u&&A>0&&(B=Md(w+j+D,a[1][1])),L=Math.max(L,U),Q=Math.max(Q,B)}if(o){let U=0,B=0;c&&T>0?U=Md(x+T,o[0][0]):!c&&T<0&&(U=Pd(x+N,o[1][0])),u&&A>0?B=Md(w+A,o[0][1]):!u&&A<0&&(B=Pd(w+j,o[1][1])),L=Math.max(L,U),Q=Math.max(Q,B)}if(r){if(d){const U=mw(N/k,O,v)*k;if(L=Math.max(L,U),a){let B=0;!c&&!u||c&&!u&&h?B=Md(w+D+N/k,a[1][1])*k:B=Pd(w+D+(c?T:-T)/k,a[0][1])*k,L=Math.max(L,B)}if(o){let B=0;!c&&!u||c&&!u&&h?B=Pd(w+N/k,o[1][1])*k:B=Md(w+(c?T:-T)/k,o[0][1])*k,L=Math.max(L,B)}}if(f){const U=mw(j*k,b,y)/k;if(Q=Math.max(Q,U),a){let B=0;!c&&!u||u&&!c&&h?B=Md(x+j*k+M,a[1][0])/k:B=Pd(x+(u?A:-A)*k+M,a[0][0])/k,Q=Math.max(Q,B)}if(o){let B=0;!c&&!u||u&&!c&&h?B=Pd(x+j*k,o[1][0])/k:B=Md(x+(u?A:-A)*k,o[0][0])/k,Q=Math.max(Q,B)}}}A=A+(A<0?Q:-Q),T=T+(T<0?L:-L),r&&(h?N>j*k?A=(lU(c,u)?-T:T)/k:T=(lU(c,u)?-A:A)*k:d?(A=T/k,u=c):(T=A*k,c=u));const C=c?x+T:x,I=u?w+A:w;return{width:E+(c?-T:T),height:S+(u?-A:A),x:s[0]*T*(c?-1:1)+C,y:s[1]*A*(u?-1:1)+I}}const Fte={width:0,height:0,x:0,y:0},cNe={...Fte,pointerX:0,pointerY:0,aspectRatio:1};function uNe(e,t,n){const i=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,o=n[0]*s,c=n[1]*a;return[[i-o,r-c],[i+s-o,r+a-c]]}function dNe({domNode:e,nodeId:t,getStoreItems:n,onChange:i,onEnd:r}){const s=go(e);let a={controlDirection:oU("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:g,onResizeEnd:b,shouldResize:y}){let O={...Fte},v={...cNe};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:oU(u)};let x,w=null,E=[],S,k,T,A=!1;const N=ete().on("start",j=>{const{nodeLookup:M,transform:D,snapGrid:L,snapToGrid:Q,nodeOrigin:C,paneDomNode:I}=n();if(x=M.get(t),!x)return;w=(I==null?void 0:I.getBoundingClientRect())??null;const{xSnapped:U,ySnapped:B}=xy(j.sourceEvent,{transform:D,snapGrid:L,snapToGrid:Q,containerBounds:w});O={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},v={...O,pointerX:U,pointerY:B,aspectRatio:O.width/O.height},S=void 0,k=Sp(x.extent)?x.extent:void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(S=M.get(x.parentId)),S&&x.extent==="parent"&&(k=[[0,0],[S.measured.width,S.measured.height]]),E=[],T=void 0;for(const[P,q]of M)if(q.parentId===t&&(E.push({id:P,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const G=uNe(q,x,q.origin??C);T?T=[[Math.min(G[0][0],T[0][0]),Math.min(G[0][1],T[0][1])],[Math.max(G[1][0],T[1][0]),Math.max(G[1][1],T[1][1])]]:T=G}p==null||p(j,{...O})}).on("drag",j=>{const{transform:M,snapGrid:D,snapToGrid:L,nodeOrigin:Q}=n(),C=xy(j.sourceEvent,{transform:M,snapGrid:D,snapToGrid:L,containerBounds:w}),I=[];if(!x)return;const{x:U,y:B,width:P,height:q}=O,G={},$=x.origin??Q,{width:V,height:te,x:fe,y:Te}=lNe(v,a.controlDirection,C,a.boundaries,a.keepAspectRatio,$,k,T),J=V!==P,ne=te!==q,ce=fe!==U&&J,Oe=Te!==B&≠if(!ce&&!Oe&&!J&&!ne)return;if((ce||Oe||$[0]===1||$[1]===1)&&(G.x=ce?fe:O.x,G.y=Oe?Te:O.y,O.x=G.x,O.y=G.y,E.length>0)){const be=fe-U,ae=Te-B;for(const Re of E)Re.position={x:Re.position.x-be+$[0]*(V-P),y:Re.position.y-ae+$[1]*(te-q)},I.push(Re)}if((J||ne)&&(G.width=J&&(!a.resizeDirection||a.resizeDirection==="horizontal")?V:O.width,G.height=ne&&(!a.resizeDirection||a.resizeDirection==="vertical")?te:O.height,O.width=G.width,O.height=G.height),S&&x.expandParent){const be=$[0]*(G.width??0);G.x&&G.x{A&&(b==null||b(j,{...O}),r==null||r({...O}),A=!1)});s.call(N)}function c(){s.on(".drag",null)}return{update:o,destroy:c}}var Vte={exports:{}},Xte={},qte={exports:{}},Hte={};/** +${i}`}}async function QJ(e,t=!1){const n=await Mt(`/web/model-api-keys${t?"?refresh=true":""}`,{signal:e,cache:"no-store"});if(!n.ok)throw new Error(await fn(n,"加载 Ark API Key 失败"));return await n.json()}async function BJ(e,t){const n=await Mt(`/web/model-api-keys/${encodeURIComponent(e)}/value`,{method:"POST",signal:t,cache:"no-store"});if(!n.ok)throw new Error(await fn(n,"加载 Ark API Key 失败"));return await n.json()}async function UJ(e){const t=new URLSearchParams;e!=null&&e.apiKeyId&&t.set("apiKeyId",e.apiKeyId),e!=null&&e.refresh&&t.set("refresh","true");const n=t.toString(),i=await Mt(`/web/model-options${n?`?${n}`:""}`,{signal:e==null?void 0:e.signal,cache:"no-store"});if(!i.ok)throw new Error(await fn(i,"加载模型列表失败"));return await i.json()}async function zJ(){const e=await Mt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class Z0 extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class ga extends Error{constructor(t,n=!1,i=!1){super(t),this.unsupported=n,this.retryable=i,this.name="RuntimeProbeError"}}const FJ="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",VJ="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",y9=["cn-beijing","cn-shanghai"],QEe=3e4,w_=5*60*1e3,XJ=60*1e3;let qJ="volcengine";const FS=new Map,Ch=new Map,jh=new Map,Nl=new Map;function HJ(e,t){return`${t}:${e}`}function YJ(e){qJ=e}function th(e){const t=(e||"").trim();if(qJ==="byteplus")return[t&&!t.startsWith("cn-")?t:aP];const n=t&&!t.startsWith("ap-")?t:VD;return y9.includes(n)?[n,...y9.filter(i=>i!==n)]:[n]}function K0(...e){return e.map(t=>String(t??"")).join("")}function J0(e,t,n){const i=e.get(t);return i!=null&&i.value&&Date.now()-i.updatedAt<=n?i.value:null}function WD(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}async function GJ(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function S_(e,t,n){const i=await Mt("/list-apps",{},n??{base:e,apiKey:t}),r=n!=null&&n.runtimeId?await GJ(i):"";if(n!=null&&n.runtimeId&&r==="runtime_access_denied")throw new Z0;if(n!=null&&n.runtimeId&&r==="runtime_private_endpoint_unreachable")throw new ga(FJ);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(r))throw new ga(VJ,!1,!0);if(n!=null&&n.runtimeId&&i.status===404)throw new ga("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0,!0);if(n!=null&&n.runtimeId&&(i.status===401||i.status===403))throw new ga("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await fn(i,"读取 Agent 列表失败"));const s=await i.json();return n!=null&&n.runtimeId&&FS.set(HJ(n.runtimeId,n.region??""),{apps:s,expiresAt:Date.now()+QEe}),s}async function WJ(e,t){const{app:n,ep:i}=Zr(e),r=await Mt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},i);if(!r.ok){const a=`创建会话失败 (${r.status})`,o=await fn(r,"创建会话失败");throw new Error(o===a?a:`${a}:${o}`)}return(await r.json()).id}async function ZD(e,t){const{app:n,ep:i}=Zr(e),r=await Mt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},i);if(!r.ok)throw new Error(`list sessions failed: ${r.status}`);return r.json()}async function yk(e,t,n){const{app:i,ep:r}=Zr(e),s=await Mt(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},r);if(!s.ok){const o=await fn(s,"读取会话失败");throw new Error(`get session failed: ${s.status}:${o}`)}const a=await s.json();if(r.runtimeId){const o=HD(r.runtimeId,i,t,n);a.state={...YD()[o]??{},...a.state??{}}}return a}async function ZJ(e){const{app:t,ep:n}=Zr(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");if(!n.region)throw new Error("Runtime 缺少地域信息,无法提交反馈");const i=await Mt("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region,appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},br);if(!i.ok)throw new Error(await fn(i,"提交反馈失败"));const r=await i.json(),s=HD(n.runtimeId,t,e.userId,e.sessionId);return DEe(s,e.eventId,r),r}async function E_(e,t={}){const n=K0(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),i=J0(Nl,n,XJ);if(!t.force&&i)return i;const r=Nl.get(n);if(!t.force&&(r!=null&&r.promise))return r.promise;let s=null;const a=(async()=>{for(const o of th(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:o,appName:e.appName,page_size:String(e.pageSize??100)}),u=await Mt(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return WD(Nl,n,await u.json());s=new Error(await fn(u,"读取评测集失败"))}throw s??new Error("读取评测集失败")})();Nl.set(n,{...r,promise:a,updatedAt:(r==null?void 0:r.updatedAt)??0});try{return await a}finally{const o=Nl.get(n);(o==null?void 0:o.promise)===a&&Nl.set(n,{value:o.value,updatedAt:o.updatedAt})}}async function KJ(e){let t=null;for(const n of th(e.region)){const i=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName,userId:e.userId}),r=await Mt(`/web/evaluation/statuses?${i.toString()}`);if(r.ok)return r.json();t=new Error(await fn(r,"读取自动评测状态失败"))}throw t??new Error("读取自动评测状态失败")}async function JJ(e){let t=null;for(const n of th(e.region)){const i=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),r=await Mt(`/web/evaluation/optimizations?${i.toString()}`);if(r.ok)return r.json();t=new Error(await fn(r,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function eee(e){return J0(Nl,K0(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),XJ)}function oP(e){E_(e).catch(()=>{})}function tee(e){E_(e,{force:!0}).catch(()=>{})}function nee(e,t){return["good","bad"].map(n=>{const i=e.find(r=>r.kind===n);return{kind:n,evaluationSetId:(i==null?void 0:i.evaluationSetId)??null,evaluationSetName:(i==null?void 0:i.evaluationSetName)??null,workspaceId:(i==null?void 0:i.workspaceId)??null,itemCount:t.filter(r=>r.kind===n).length}})}function VS(e){const t=e.comment??"",n=e.rating==="bad"&&!!t.trim();for(const[i,r]of Nl.entries()){const s=r.value;if(!s||s.runtimeId!==e.runtimeId||s.agentName!==e.appName)continue;const a=s.items.filter(c=>c.sessionId!==e.sessionId||c.messageId!==e.messageId),o=e.rating?[{id:`local:${e.runtimeId}:${e.sessionId}:${e.messageId}`,itemKey:`local:${e.messageId}`,kind:e.rating,input:e.input,output:e.output,referenceOutput:e.referenceOutput??e.output,comment:t,agentName:e.appName,sessionId:e.sessionId,messageId:e.messageId,runtimeId:e.runtimeId,invocationId:e.invocationId??"",userId:e.userId,createdAt:e.createdAt??new Date().toISOString(),evaluationSetId:"",evaluationSetName:"",workspaceId:"",source:"user",score:n?0:null,reason:n?t:""},...a]:a;Nl.set(i,{value:{...s,sets:nee(s.sets,o),items:o},updatedAt:Date.now(),promise:r.promise})}}async function iee(e){let t=null;for(const n of th(e.region)){const i=await Mt("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:n,appName:e.appName,itemIds:e.itemIds})},{},br);if(i.ok){const r=await i.json(),s=new Set(e.itemIds);for(const[a,o]of Nl.entries()){const c=o.value;if(!c||c.runtimeId!==e.runtimeId||c.agentName!==e.appName)continue;const u=c.items.filter(d=>!s.has(d.id));Nl.set(a,{value:{...c,sets:nee(c.sets,u),items:u},updatedAt:Date.now()})}return r}t=new Error(await fn(i,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function lP(e,t,n){const{app:i,ep:r}=Zr(e),s=await Mt(`/apps/${i}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},r);if(!s.ok&&s.status!==404)throw new Error(`delete session failed: ${s.status}`)}function BEe(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),i=window.atob(n),r=new Uint8Array(i.length);for(let s=0;s URL.revokeObjectURL(o),0)}async function ree(e,t,n,i,r){const{app:s,ep:a}=Zr(e),o=r==null?"":`?version=${encodeURIComponent(r)}`,c=`/apps/${encodeURIComponent(s)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(i)}${o}`,u=await Mt(c,{},a,br);if(!u.ok)throw new Error(await fn(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=BEe(f.data),p=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([p],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??i}}async function JD(e,t,n,i,r){const{blob:s}=await ree(e,t,n,i,r);return URL.createObjectURL(s)}async function UEe(e){const t=await Mt("/web/media/capabilities");if(!t.ok)throw new Error(await fn(t,"media capabilities failed"));return t.json()}async function see(e,t,n,i){const{app:r}=Zr(e),s=new FormData;s.set("app_name",r),s.set("user_id",t),s.set("session_id",n),s.set("file",i);const a=await Mt("/web/media",{method:"POST",body:s},{},br);if(!a.ok)throw new Error(await fn(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function cP(e,t,n){const{app:i}=Zr(e),r=`/web/media/${encodeURIComponent(i)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,s=await Mt(r,{method:"POST"});if(!s.ok&&s.status!==404)throw new Error(await fn(s,"media cleanup failed"))}function aee(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((i,r)=>![1,3,5].includes(r)).join("/")}`}catch{return}}async function XS(e,t){const n=aee(t);if(!n)throw new Error("Invalid VeADK media URI");const i=await Mt(`${n}/delete`,{method:"POST"});if(!i.ok&&i.status!==404)throw new Error(await fn(i,"media cleanup failed"))}function oee(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=aee(t);if(!n)return t;const i=`${n}/content`;return To(`${zS}${i}`)}async function xk(e,t,n){const{app:i,ep:r}=Zr(e);let s;if(r.runtimeId){const c=new URLSearchParams({runtimeId:r.runtimeId,sessionId:t,region:r.region??"cn-beijing"});if(n&&c.set("endTimeMs",String(Math.round(n))),s=await Mt(`/web/runtime-trace?${c.toString()}`),s.status===404)throw new Error("该 Agent 暂未开启链路观测,请到控制台打开后使用。")}else s=await Mt(`/dev/apps/${encodeURIComponent(i)}/debug/trace/session/${encodeURIComponent(t)}`,{},r);if(!s.ok)throw new Error(await fn(s,"加载调用链路失败"));const a=s.headers.get("content-type")??"";if(!a.includes("application/json")){const c=a.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${c}),请检查 Studio API 代理配置`)}const o=await s.json();if(!Array.isArray(o))throw new Error("trace failed: 返回格式无效");return o}async function uP(e){const t=await Mt("/web/issue-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await fn(t,"问题反馈上报失败"));if((await t.json()).submitted!==!0)throw new Error("问题反馈上报失败:服务端未确认提交结果");return{submitted:!0}}function e$(e){const t=n=>({id:String(n.id??""),kind:n.kind==="skill"?"skill":"tool",name:String(n.name??""),custom:n.custom===!0,description:typeof n.description=="string"?n.description:void 0,skillSourceId:typeof n.skill_source_id=="string"?n.skill_source_id:void 0,version:typeof n.version=="string"?n.version:void 0});return{schemaVersion:Number(e.schema_version??1),revision:Number(e.revision??0),tools:Array.isArray(e.tools)?e.tools.map(n=>t(n)):[],skills:Array.isArray(e.skills)?e.skills.map(n=>t(n)):[]}}function t$(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function dP(e,t,n){const{app:i,ep:r}=Zr(e),s=await Mt(t$(i,t,n),{},r);if(!s.ok)throw new Error(await fn(s,"读取会话能力失败"));return e$(await s.json())}async function n$(e){const{ep:t}=Zr(e),n=await Mt("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await fn(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(r=>{var s;return((s=r.name)==null?void 0:s.trim())??""}).filter(Boolean)}async function zEe(e){const{ep:t}=Zr(e),n=await Mt("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await fn(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function FEe(e,t,n){const{ep:i}=Zr(e),r=new URLSearchParams({region:n||"cn-beijing"}),s=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${r.toString()}`,a=await Mt(s,{},i);if(!a.ok)throw new Error(await fn(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function lee(e,t,n=1,i=20){const{ep:r}=Zr(e),s=new URLSearchParams({query:t,page_number:String(n),page_size:String(i)}),a=await Mt(`/harness/skills/findskill?${s.toString()}`,{},r);if(!a.ok)throw new Error(await fn(a,"搜索 Skill Hub 失败"));const o=await a.json();return{items:o.items??[],totalCount:Number(o.totalCount??0)}}async function fP(e,t,n,i,r){const{app:s,ep:a}=Zr(e),o=await Mt(t$(s,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:i.kind,name:i.name,skill_source_id:i.skillSourceId,description:i.description,version:i.version,expected_revision:r})},a);if(!o.ok)throw new Error(await fn(o,"添加会话能力失败"));return e$(await o.json())}async function cee(e,t,n,i,r){const{app:s,ep:a}=Zr(e),o=`${t$(s,t,n)}/${encodeURIComponent(i)}?expected_revision=${r}`,c=await Mt(o,{method:"DELETE"},a);if(!c.ok)throw new Error(await fn(c,"移除会话能力失败"));return e$(await c.json())}async function uee(e,t,n=!0){const i=await Mt(`/web/agent-info/${e}`,{},t);if(!i.ok)throw new Error(`agent-info failed: ${i.status}`);const r=await i.json();if(n&&!r.draft)try{const s=await Mt(`/web/agent-draft/${e}`,{},t);if(s.ok){const a=await s.json();r.draft=a.draft}}catch{}return{appName:e,name:r.name??e,description:r.description??"",type:r.type,model:r.model??"",tools:r.tools??[],skillsPreviewSupported:Array.isArray(r.skills),skills:r.skills??[],subAgents:r.subAgents??[],components:r.components??[],searchSources:r.searchSources??[],graph:r.graph,draft:r.draft}}async function dee(e){const{app:t,ep:n}=Zr(e);return uee(t,n,!1)}async function VEe(e,t,n){let i=null;for(const r of th(t)){const s={runtimeId:e,region:r};try{const a=HJ(e,r),o=FS.get(a);o&&o.expiresAt<=Date.now()&&FS.delete(a);const c=FS.get(a),u=n||(c==null?void 0:c.apps[0])||(await S_("","",s))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return uee(u,s)}catch(a){if(a instanceof Z0||a instanceof ga&&!a.unsupported)throw a;i=a instanceof Error?a:new Error(String(a))}}throw i??new Error("该 Runtime 未提供可预览的 Agent。")}async function vk(e,t,n={},i={}){const r=typeof n=="string"?n:void 0,s=typeof n=="string"?i:n,a=K0(e,t||"cn-beijing",r??""),o=J0(Ch,a,w_);if(!s.force&&o)return o;const c=Ch.get(a);if(!s.force&&(c!=null&&c.promise))return c.promise;const u=VEe(e,t,r).then(d=>WD(Ch,a,d));Ch.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=Ch.get(a);(d==null?void 0:d.promise)===u&&Ch.set(a,{value:d.value,updatedAt:d.updatedAt})}}function fee(e,t,n=""){return J0(Ch,K0(e,t||"cn-beijing",n),w_)}function hee(e,t,n=""){vk(e,t,n).catch(()=>{})}async function pee(e,t,n,i){const{app:r,ep:s}=Zr(e),a=new URLSearchParams({source:t,app_name:r,q:n,user_id:i}),o=await Mt(`/web/search?${a.toString()}`,{},s);if(!o.ok)throw new Error(await fn(o,"Agent 检索失败"));return o.json()}async function mee(e,t){const{app:n}=Zr(e),i=await Mt(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!i.ok)throw new Error(`web search failed: ${i.status}`);return i.json()}async function*hP({appName:e,userId:t,sessionId:n,text:i,attachments:r=[],invocation:s,functionResponses:a=[],signal:o,sessionCapabilities:c=!1}){const{app:u,ep:d}=Zr(e),f=r.flatMap(b=>b.status&&b.status!=="ready"?[]:b.uri?[{fileData:{mimeType:b.mimeType,fileUri:b.uri,displayName:b.name},partMetadata:{veadkMedia:{id:b.id,uri:b.uri,name:b.name,mimeType:b.mimeType,sizeBytes:b.sizeBytes}}}]:b.data?[{inlineData:{mimeType:b.mimeType,data:b.data,displayName:b.name}}]:[]),h=s&&(s.skills.length>0||s.targetAgent)?s:void 0,p=[...f,...a.map(b=>({functionResponse:{id:b.id,name:b.name,response:b.response}})),...i.trim()?[{text:i}]:[]];if(h&&p.length>0){const b=p[0],y=b.partMetadata;p[0]={...b,partMetadata:{...y,veadkInvocation:h}}}const g=await Mt(c?"/harness/run_sse":"/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,custom_metadata:h?{veadkInvocation:h}:void 0}),signal:o},d,0);if(!g.ok){const b=await fn(g,"运行会话失败");throw new Error(aw(`run_sse failed: ${g.status}:${b}`))}for await(const b of FD(g)){const y=b;typeof y.error=="string"&&(y.error=aw(y.error)),typeof y.errorMessage=="string"&&(y.errorMessage=aw(y.errorMessage)),typeof y.error_message=="string"&&(y.error_message=aw(y.error_message)),yield y}}async function gee(e,t){const n=new URLSearchParams({name:e,region:t}),i=await Mt(`/web/runtime-name-availability?${n.toString()}`,{cache:"no-store"});if(!i.ok)throw new Error(await fn(i,"检查 Runtime 名称失败"));const r=await i.json();if(typeof r.available!="boolean")throw new Error("检查 Runtime 名称失败:服务返回格式错误");return{available:r.available}}async function bee(e,t){const n=new URLSearchParams({kind:e.kind,region:e.region});e.registry&&n.set("registry",e.registry),e.namespace&&n.set("namespace",e.namespace),e.workspaceId&&n.set("workspaceId",e.workspaceId),e.search&&n.set("search",e.search),e.pageNumber&&n.set("pageNumber",String(e.pageNumber)),e.pageSize&&n.set("pageSize",String(e.pageSize));const i=await Mt(`/web/deployment-resources?${n.toString()}`,{signal:t});if(!i.ok)throw new Error(await fn(i,"加载云资源失败"));const r=await i.json();if(typeof r.serviceRegion!="string"||!Array.isArray(r.items)||typeof r.pageNumber!="number"||typeof r.pageSize!="number"||typeof r.totalCount!="number"||typeof r.hasMore!="boolean")throw new Error("云资源列表响应格式无效");const s=r.items.map(a=>{if(!a||typeof a!="object"||typeof a.id!="string"||typeof a.name!="string"||typeof a.region!="string"||typeof a.status!="string")throw new Error("云资源列表响应格式无效");return a});return{serviceRegion:r.serviceRegion,items:s,pageNumber:r.pageNumber,pageSize:r.pageSize,totalCount:r.totalCount,hasMore:r.hasMore}}async function Oee(e){var r;const t=await Mt("/web/system-info",{signal:e});if(!t.ok)throw new Error(await fn(t,"加载系统信息失败"));const n=await t.json();if(typeof((r=n.storage)==null?void 0:r.tosAddress)!="string"||!Array.isArray(n.sandboxTools))throw new Error("系统信息响应格式无效");const i=n.sandboxTools.map(s=>{if(!s||typeof s!="object"||typeof s.kind!="string"||typeof s.label!="string"||typeof s.toolId!="string"||typeof s.snapshot!="boolean")throw new Error("系统信息响应格式无效");return s});return{storage:{tosAddress:n.storage.tosAddress},sandboxTools:i}}async function i$(e){const t=await Mt("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await fn(t,"加载用户池失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("用户池列表响应格式无效");return n.items.map(i=>{if(!i||typeof i!="object"||typeof i.uid!="string"||typeof i.name!="string"||typeof i.domain!="string"||typeof i.region!="string"||typeof i.isCurrent!="boolean")throw new Error("用户池列表响应格式无效");return i})}const Oy=new Map;async function R1(e,t,n,i){var f,h,p,g,b;const r=i==null?void 0:i.taskId,s=r?new AbortController:void 0;r&&s&&Oy.set(r,s);const a=()=>{r&&Oy.get(r)===s&&Oy.delete(r)};let o;try{const y=!!(i!=null&&i.migrationTaskId);(f=i==null?void 0:i.onStage)==null||f.call(i,{level:"info",phase:"upload",message:y?"正在校验迁移产物":"正在上传代码包",pct:0}),o=await Mt("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:s==null?void 0:s.signal,body:JSON.stringify({name:e,files:y?[]:t,config:n,taskId:r,migrationTaskId:i==null?void 0:i.migrationTaskId,runtimeId:i==null?void 0:i.runtimeId,runtimeName:i==null?void 0:i.runtimeName,appName:i==null?void 0:i.appName,sessionStorage:i==null?void 0:i.sessionStorage,minInstance:i==null?void 0:i.minInstance,maxInstance:i==null?void 0:i.maxInstance,createEvaluationSets:i==null?void 0:i.createEvaluationSets,description:hEe((i==null?void 0:i.description)??""),authentication:i==null?void 0:i.authentication,im:i==null?void 0:i.im,envs:i==null?void 0:i.envs,resources:i==null?void 0:i.resources})},{},0),(h=i==null?void 0:i.onStage)==null||h.call(i,{level:"success",phase:"upload",message:y?"迁移产物校验完成":"代码包上传完成",pct:100})}catch(y){throw a(),y}if(!o.ok){const y=await fn(o,"部署失败");throw a(),new Error(y)}let c=null;try{for await(const y of FD(o)){const O=y;if(O&&O.done){c=O;break}O&&O.message&&((p=i==null?void 0:i.onStage)==null||p.call(i,O))}}catch(y){throw a(),y}if(a(),!c)throw new Error("部署失败:连接中断");if(!c.success)throw new Error(c.error||"部署失败");if(!c.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!c.runtimeId&&!c.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");const u=(g=c.runtimeName)!=null&&g.trim()?c.agentName:e,d=((b=c.runtimeName)==null?void 0:b.trim())||c.agentName;return{apikey:c.apikey??"",url:c.url??"",agentName:u,runtimeName:d,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,warnings:c.warnings,feishuChannel:c.feishuChannel}}async function yee(e){var n;const t=await Mt("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`取消部署失败 (${t.status})`)}(n=Oy.get(e))==null||n.abort(),Oy.delete(e)}async function XEe(e=VD){const t=await Mt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const dx={title:"AgentKit Studio",logoUrl:""},pP={enabled:!1},XN={studio:!1,version:"",provider:"volcengine",branding:dx,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,agentUsage:!1,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:pP};function qEe(e){if(!e||typeof e!="object")return pP;const t=e;if(t.enabled!==!0||!t.studio||typeof t.studio!="object")return pP;const n=t.studio;return{enabled:!0,studio:{deployId:typeof n.deployId=="string"?n.deployId:"",userPoolId:typeof n.userPoolId=="string"?n.userPoolId:"",applicationId:typeof n.applicationId=="string"?n.applicationId:"",functionId:typeof n.functionId=="string"?n.functionId:"",region:typeof n.region=="string"?n.region:"",project:typeof n.project=="string"?n.project:"",version:typeof n.version=="string"?n.version:"",accountId:typeof n.accountId=="string"?n.accountId:""}}}async function xee(){var e,t;try{const n=await Mt("/web/ui-config");if(!n.ok)return XN;const i=await n.json(),r=typeof((e=i.branding)==null?void 0:e.logoUrl)=="string"?i.branding.logoUrl:dx.logoUrl,s=i.provider==="byteplus"?"byteplus":"volcengine";return YJ(s),{studio:i.studio??!1,version:typeof i.version=="string"?i.version:"",provider:s,branding:{title:typeof((t=i.branding)==null?void 0:t.title)=="string"?i.branding.title:dx.title,logoUrl:r?To(r):""},features:{...XN.features,...i.features??{}},defaultView:i.defaultView??"chat",agentsSource:i.agentsSource==="cloud"?"cloud":"local",telemetry:qEe(i.telemetry)}}catch{return XN}}const vee={role:"user",telemetry:{userId:"",accountId:""},capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function wee(){var n,i,r,s;const e=await Mt("/web/access");if(!e.ok)throw new Error(`加载权限失败 (${e.status})`);const t=await e.json();if(!["admin","developer","user"].includes(t.role)||typeof((n=t.telemetry)==null?void 0:n.userId)!="string"||t.telemetry.accountId!==void 0&&typeof t.telemetry.accountId!="string"||typeof((i=t.capabilities)==null?void 0:i.createAgents)!="boolean"||typeof((r=t.capabilities)==null?void 0:r.manageAgents)!="boolean"||!["all","mine"].includes((s=t.capabilities)==null?void 0:s.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function See(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const i=n.size?`?${n.toString()}`:"",r=await Mt(`/web/studio-update${i}`);if(!r.ok)throw new Error(`检查 Studio 更新失败 (${r.status})`);return await r.json()}async function Eee(e){const t=await Mt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},br);if(!t.ok){let n="";try{const i=await t.json();n=typeof i.detail=="string"?i.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function kee({runtimeId:e,region:t,appName:n,page:i=1,pageSize:r=20,signal:s}){const a=new URLSearchParams({runtimeId:e,region:t,appName:n,page:String(i),pageSize:String(r)}),o=await Mt(`/web/agent-usage?${a.toString()}`,{signal:s});if(!o.ok)throw new Error(await fn(o,"加载 Agent 用量失败"));const c=o.headers.get("content-type")||"未提供",u=c.toLowerCase();if(!u.includes("application/json")&&!u.includes("+json"))throw new Error(`加载 Agent 用量失败:服务端返回非 JSON 响应(HTTP ${o.status},Content-Type: ${c})。请确认当前服务以 Studio 模式启动,并检查代理或网关配置。`);try{return await o.json()}catch{throw new Error(`加载 Agent 用量失败:服务端返回了无法解析的 JSON(HTTP ${o.status},Content-Type: ${c})。请稍后重试;若问题持续,请检查代理或网关配置。`)}}async function k_(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await Mt(`/web/runtimes?${t.toString()}`);if(!n.ok){const r=await fn(n,"加载 Runtime 失败");throw new Error(r)}const i=await n.json();return{runtimes:i.runtimes??[],nextToken:i.nextToken??""}}async function r$(e,t,n={}){try{const i={runtimeId:e,region:t};return n.retryProbe&&(i.retryProbe=!0),await S_("","",i)}catch(i){if(i instanceof Z0||i instanceof ga)throw i;return null}}async function Tee(e,t,n={}){const i={runtimeId:e,region:t};n.retryProbe&&(i.retryProbe=!0);const r=await Mt("/.well-known/agent-card.json",{},i),s=await GJ(r);if(s==="runtime_access_denied")throw new Z0;if(s==="runtime_private_endpoint_unreachable")throw new ga(FJ);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(s))throw new ga(VJ);if(r.status===404)return null;if(r.status===401||r.status===403)throw new ga("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!r.ok)throw new Error(await fn(r,"读取 A2A Agent Card 失败"));const a=await r.json().catch(()=>null),o=typeof(a==null?void 0:a.url)=="string"?a.url.trim():"";return o?{name:typeof(a==null?void 0:a.name)=="string"?a.name:"",description:typeof(a==null?void 0:a.description)=="string"?a.description:"",endpoint:o}:null}async function _ee(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),i=await Mt(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!i.ok)throw new Error(await fn(i,"读取 Runtime API Key 失败"));const r=await i.json();if(typeof r.apiKey!="string"||!r.apiKey)throw new Error("Runtime 未返回可用的 API Key");return r.apiKey}async function Aee(e,t){const n=await Mt("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const i=await n.text().catch(()=>"");throw new Error(i||`删除失败 (${n.status})`)}}async function Nee({runtimeId:e,region:t,appName:n,signal:i}){const r=new URLSearchParams({runtimeId:e,region:t});n&&r.set("appName",n);const s=await Mt(`/web/runtime-update-capability?${r.toString()}`,{signal:i});if(!s.ok)throw new Error(await HEe(s));return await s.json()}async function HEe(e){const t=await e.json().catch(()=>null),n=typeof(t==null?void 0:t.detail)=="string"?t.detail:"";return e.status===403?"当前账号没有管理该 Runtime 的权限。":e.status===404?n==="runtime_not_found"?"该 Runtime 不存在或已被删除。":"当前账号无法访问该 Runtime。":`检查 Runtime 更新能力失败(HTTP ${e.status}),请稍后重试。`}async function YEe(e,t){let n=null;for(const i of th(t)){const r=await Mt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(i)}`);if(r.ok)return r.json();n=new Error(await fn(r,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function s$(e,t="cn-beijing",n={}){const i=K0(e,t||"cn-beijing"),r=J0(jh,i,w_);if(!n.force&&r)return r;const s=jh.get(i);if(!n.force&&(s!=null&&s.promise))return s.promise;const a=YEe(e,t).then(o=>WD(jh,i,o));jh.set(i,{...s,promise:a,updatedAt:(s==null?void 0:s.updatedAt)??0});try{return await a}finally{const o=jh.get(i);(o==null?void 0:o.promise)===a&&jh.set(i,{value:o.value,updatedAt:o.updatedAt})}}function Cee(e,t="cn-beijing"){return J0(jh,K0(e,t||"cn-beijing"),w_)}function jee(e,t="cn-beijing"){s$(e,t).catch(()=>{})}async function a$(e){const t=await Mt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await fn(t,"生成项目失败"));return t.json()}const GEe=19e4;async function Ree(e){const t=await Mt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},GEe);if(!t.ok)throw new Error(await fn(t,"生成 Agent 配置失败"));return v_(t,"生成 Agent 配置失败")}async function Iee(e,t){const n=await Mt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,runtimeId:t==null?void 0:t.runtimeId,runtimeRegion:t==null?void 0:t.region})});if(!n.ok)throw new Error(await fn(n,"创建调试运行失败"));return v_(n,"创建调试运行失败")}async function Pee(e,t){const n=await Mt(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await fn(n,"创建调试会话失败"));return(await v_(n,"创建调试会话失败")).id}async function Mee(e,t){const n=await Mt(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await fn(n,"加载调试调用链路失败"));const i=await v_(n,"加载调试调用链路失败");if(!Array.isArray(i))throw new Error("加载调试调用链路失败:返回格式无效");return i}async function*Lee({runId:e,userId:t,sessionId:n,text:i,signal:r}){const s=i.trim()?[{text:i}]:[],a=await Mt(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:s},streaming:!0}),signal:r},{},0);if(!a.ok)throw new Error(await fn(a,"调试运行失败"));for await(const o of FD(a))yield o}async function Mm(e){const t=await Mt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await fn(t,"清理调试运行失败"))}const WEe=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:dx,DEFAULT_STUDIO_ACCESS:vee,RuntimeAccessDeniedError:Z0,RuntimeProbeError:ga,addSessionCapability:fP,cancelAgentkitDeployment:yee,checkRuntimeNameAvailability:gee,clearMessageFeedbackCache:LJ,clearRemoteApps:$J,componentSearch:pee,createGeneratedAgentTestRun:Iee,createGeneratedAgentTestSession:Pee,createSession:WJ,deleteAgentFeedbackCases:iee,deleteGeneratedAgentTestRun:Mm,deleteMedia:XS,deleteRuntime:Aee,deleteSession:lP,deleteSessionMedia:cP,deployAgentkitProject:R1,downloadArtifact:KD,fetchRemoteApps:S_,generateAgentDraftFromRequirement:Ree,generateAgentProject:a$,getAgentFeedbackCases:E_,getAgentInfo:dee,getAgentOptimizations:JJ,getAgentUsage:kee,getAutomaticEvaluationStatuses:KJ,getCachedAgentFeedbackCases:eee,getCachedRuntimeAgentInfo:fee,getCachedRuntimeDetail:Cee,getGeneratedAgentTestTrace:Mee,getMediaCapabilities:UEe,getMyRuntimes:XEe,getRuntimeAgentInfo:vk,getRuntimeDetail:s$,getRuntimeUpdateCapability:Nee,getRuntimes:k_,getSession:yk,getSessionCapabilities:dP,getSessionTrace:xk,getStudioAccess:wee,getStudioUpdateStatus:See,getSystemInfo:Oee,getUiConfig:xee,listApps:zJ,listDeploymentResources:bee,listIdentityUserPools:i$,listModelApiKeys:QJ,listModelOptions:UJ,listSessionBuiltinTools:n$,listSessionSkillSpaces:zEe,listSessionSkillsInSpace:FEe,listSessions:ZD,mediaContentUrl:oee,prefetchAgentFeedbackCases:oP,prefetchRuntimeAgentInfo:hee,prefetchRuntimeDetail:jee,previewArtifact:JD,probeRuntimeA2a:Tee,probeRuntimeApps:r$,refreshAgentFeedbackCases:tee,registerRemoteApp:DJ,removeSessionCapability:cee,revealModelApiKey:BJ,revealRuntimeApiKey:_ee,runGeneratedAgentTestSSE:Lee,runSSE:hP,runtimeRegionCandidates:th,searchSessionPublicSkills:lee,setClientCloudProvider:YJ,startStudioUpdate:Eee,studioFetch:ci,submitIssueFeedback:uP,submitMessageFeedback:ZJ,uploadMedia:see,upsertCachedAgentFeedbackCase:VS,webSearch:mee},Symbol.toStringTag,{value:"Module"})),x9=Object.freeze({totalTokenCount:0,promptTokenCount:0,candidatesTokenCount:0,thoughtsTokenCount:0,cachedContentTokenCount:0}),qS=Object.freeze({modelName:"",current:x9,cumulative:x9}),ZEe={totalTokenCount:"total_token_count",promptTokenCount:"prompt_token_count",candidatesTokenCount:"candidates_token_count",thoughtsTokenCount:"thoughts_token_count",cachedContentTokenCount:"cached_content_token_count"},KEe=24,JEe=64,eke=16;function ow(e){var o,c;const t=e.trim();if(!t)return 0;const n=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/gu,i=((o=t.match(n))==null?void 0:o.length)??0,r=t.replace(n," "),s=(r.match(/[A-Za-z0-9_]+/g)??[]).reduce((u,d)=>u+Math.max(1,Math.ceil(d.length/4)),0),a=((c=r.match(/[^\sA-Za-z0-9_]/g))==null?void 0:c.length)??0;return i+s+a}function tke(e){var o,c,u;const t=((o=e.instruction)==null?void 0:o.trim())??"",n=((c=e.tools)==null?void 0:c.filter(d=>d.trim()))??[],i=((u=e.skills)==null?void 0:u.filter(d=>d.name.trim()))??[],r=ow(t),s=n.reduce((d,f)=>d+JEe+ow(f),0),a=i.reduce((d,f)=>d+eke+ow(f.name)+ow(f.description??""),0);return KEe+r+s+a}function nke({usage:e,contextWindow:t,estimatedSystemTokens:n}){const i=Math.max(1,Math.round(t)),r=Math.max(0,e.current.promptTokenCount),s=Math.max(r,e.current.totalTokenCount),a=Math.min(i,r>0?Math.min(r,Math.max(0,n??0)):Math.max(0,n??0)),o=Math.max(0,r-a),c=r>0?Math.max(0,s-r):Math.max(0,s),u=r>0?s:a+c;return{systemTokens:a,inputTokens:o,outputTokens:c,remainingTokens:Math.max(0,i-u),usedTokens:u,contextWindow:i}}function ike(e){const t=[{kind:"system",tokens:e.systemTokens},{kind:"input",tokens:e.inputTokens},{kind:"output",tokens:e.outputTokens},{kind:"remaining",tokens:e.remainingTokens}],n=e.contextWindow/100;let i=0;const r=t.map(s=>{const a=i;return i+=s.tokens,{...s,start:a,end:i}});return Array.from({length:100},(s,a)=>{const o=a*n,c=o+n,u=r.flatMap(d=>{const f=Math.max(0,Math.min(c,d.end)-Math.max(o,d.start));return f>0?[{kind:d.kind,share:f/n}]:[]});return{index:a,slices:u}})}function tO(e,t){const n=e,i=n[t]??n[ZEe[t]];return typeof i=="number"&&Number.isFinite(i)&&i>0?Math.round(i):0}function rke(e){const t=tO(e,"promptTokenCount"),n=tO(e,"candidatesTokenCount"),i=tO(e,"thoughtsTokenCount");return{totalTokenCount:tO(e,"totalTokenCount")||t+n+i,promptTokenCount:t,candidatesTokenCount:n,thoughtsTokenCount:i,cachedContentTokenCount:tO(e,"cachedContentTokenCount")}}function ske(e,t){return{totalTokenCount:e.totalTokenCount+t.totalTokenCount,promptTokenCount:e.promptTokenCount+t.promptTokenCount,candidatesTokenCount:e.candidatesTokenCount+t.candidatesTokenCount,thoughtsTokenCount:e.thoughtsTokenCount+t.thoughtsTokenCount,cachedContentTokenCount:e.cachedContentTokenCount+t.cachedContentTokenCount}}function Dee(e,t){if(!t)return e;const n=typeof t.modelVersion=="string"?t.modelVersion.trim():"",i=typeof t.model_version=="string"?t.model_version.trim():"",r=n||i||e.modelName,s=t.usageMetadata??t.usage_metadata;if(!s)return r===e.modelName?e:{...e,modelName:r};const a=rke(s);return a.totalTokenCount===0?r===e.modelName?e:{...e,modelName:r}:{modelName:r,current:a,cumulative:ske(e.cumulative,a)}}function v9(e){return e.reduce((t,n)=>Dee(t,n),qS)}function w9(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function ake(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function oke(e,t){if(!t)return e;const n=new Set(e.filter(r=>ake(r)===t).map(r=>r.trace_id)),i=e.filter(r=>n.has(r.trace_id));return i.length>0?i:e}function qN(e){return!!(e&&[...e.tools,...e.skills].some(t=>t.custom))}const lke="send_a2ui_json_to_client",cke="validated_a2ui_json",mP="adk_request_credential",S9="transfer_to_agent";function uke(e){var i,r,s,a;const t=e,n=((i=t==null?void 0:t.exchangedAuthCredential)==null?void 0:i.oauth2)??((r=t==null?void 0:t.exchanged_auth_credential)==null?void 0:r.oauth2)??((s=t==null?void 0:t.rawAuthCredential)==null?void 0:s.oauth2)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function Ru(){return{blocks:[],liveStart:0}}const E9=e=>e.functionCall??e.function_call,gP=e=>e.functionResponse??e.function_response;function dke(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function fke(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function $ee(e){const t=[];for(const[n,i]of e.entries()){const r=i.partMetadata??i.part_metadata,s=r==null?void 0:r.veadkTransport;if((s==null?void 0:s.hidden)===!0)continue;const a=r==null?void 0:r.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.sizeBytes:void 0});continue}const o=i.inlineData??i.inline_data;if(o&&o.data){t.push({id:`inline-${n}-${o.displayName??o.display_name??"media"}`,mimeType:o.mimeType??o.mime_type,data:fke(o.data),name:o.displayName??o.display_name});continue}const c=i.fileData??i.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function bP(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const hke=new Set(["llm","sequential","parallel","loop","a2a"]);function pke(e){var t;for(const n of e){const i=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!i||typeof i!="object")continue;const r=i,s=Array.isArray(r.skills)?r.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const o=r.targetAgent;if(o&&typeof o=="object"){const c=o,u=c.type;typeof c.name=="string"&&typeof u=="string"&&hke.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(s.length>0||a)return{skills:s,targetAgent:a}}}function mke(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function gke(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const i of t)n.files.some(r=>r.filename===i.filename&&r.version===i.version)||n.files.push(i);return}e.push({kind:"artifact",files:t})}function k9(e,t,n){const i=e[e.length-1];i&&i.kind===t?i.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function lw(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function wk(e,t){var o,c,u,d,f,h;const n=e.blocks.map(p=>({...p}));let i=e.liveStart;const r=((o=t.content)==null?void 0:o.parts)??[],s=r.some(p=>E9(p)||gP(p));if(t.partial&&!s){for(const p of r){const g=bP(p);typeof g=="string"&&g&&k9(n,p.thought?"thinking":"text",g)}return{blocks:n,liveStart:i}}n.length=i;for(const p of r){const g=E9(p),b=gP(p),y=$ee([p]),O=bP(p);if(typeof O=="string"&&O)k9(n,p.thought?"thinking":"text",O);else if(y.length)lw(n),mke(n,y);else if(g)if(lw(n),g.name===S9){const v=dke(g.args)||((c=t.actions)==null?void 0:c.transferToAgent)||((u=t.actions)==null?void 0:u.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:v,done:!1})}else if(g.name===mP){const v=g.args??{},x=v.authConfig??v.auth_config??v,E=String(v.functionCallId??v.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:g.id??"",label:E,authUri:uke(x),authConfig:x,done:!1})}else n.push({kind:"tool",name:g.name??"",args:g.args,done:!1});else if(b){if(lw(n),b.name===S9)for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="agent-transfer"&&!x.done){x.done=!0;break}}if(b.name===mP)for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="auth"&&!x.done){x.done=!0;break}}for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="tool"&&!x.done&&x.name===b.name){x.done=!0,x.response=b.response;break}}if(b.name===lke){const v=((d=b.response)==null?void 0:d[cke])??[];if(v.length){const x=n[n.length-1];x&&x.kind==="a2ui"?x.messages.push(...v):n.push({kind:"a2ui",messages:v})}}}}const a=((f=t.actions)==null?void 0:f.artifactDelta)??((h=t.actions)==null?void 0:h.artifact_delta);return a&&gke(n,Object.entries(a).map(([p,g])=>({filename:p,version:g}))),lw(n),i=n.length,{blocks:n,liveStart:i}}function bke(e,t={}){var r,s;const n=[];let i=Ru();for(const a of e)if(a.author==="user"){const c=((r=a.content)==null?void 0:r.parts)??[];if(c.some(p=>{var g;return((g=gP(p))==null?void 0:g.name)===mP})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let g=n[p].blocks.length-1;g>=0;g--){const b=n[p].blocks[g];if(b.kind==="auth"){b.done=!0;break}}break}}const u=c.map(bP).filter(p=>!!p).join(""),d=$ee(c),f=pke(c);if(!u&&!d.length&&!f){i=Ru();continue}const h=[];f&&h.push({kind:"invocation",value:f}),d.length&&h.push({kind:"attachment",files:d}),u&&h.push({kind:"text",text:u}),n.push({role:"user",blocks:h,meta:{ts:a.timestamp}}),i=Ru()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((s=u.meta)==null?void 0:s.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),i=Ru()),i=wk(i,a),u.blocks=i.blocks;const d=a.usageMetadata??a.usage_metadata,f=u.meta??(u.meta={});c&&(f.author=c),d!=null&&d.totalTokenCount&&(f.tokens=d.totalTokenCount),a.timestamp&&(f.ts=a.timestamp),a.id&&(f.eventId=a.id);const h=a.invocationId??a.invocation_id;h&&(f.invocationId=h)}for(const a of n){const o=a.meta,c=o==null?void 0:o.eventId;if(!c)continue;const u=t[`veadk_feedback:${c}`];if(!u||typeof u!="object")continue;const d=u;d.rating!=="good"&&d.rating!=="bad"||(o.feedback=u)}return n}function T_(e){var t,n;for(const i of e??[])if(i.author==="user"||((t=i.content)==null?void 0:t.role)==="user"){const r=(((n=i.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(r)return r}return"新会话"}const Oke=50,T9=48;function yke(e){return(e.events??[]).flatMap(t=>{var r,s;const i=(((r=t.content)==null?void 0:r.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return i?[{text:i,role:t.author??((s=t.content)==null?void 0:s.role)??"",ts:t.timestamp}]:[]})}function xke(e){var t,n;for(const i of e.events??[])if(i.author==="user"||((t=i.content)==null?void 0:t.role)==="user"){const r=(((n=i.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(r)return r}return"未命名会话"}function vke(e,t,n){const i=Math.max(0,t-T9),r=Math.min(e.length,t+n+T9);return(i>0?"…":"")+e.slice(i,r).trim()+(r {var c;if((c=o.events)!=null&&c.length)return o;try{return await yk(t,e,o.id)}catch{return o}})),a=[];for(const o of s)for(const{text:c,role:u,ts:d}of yke(o)){const f=c.toLowerCase().indexOf(i);if(f!==-1){a.push({type:"session",appId:t,sessionId:o.id,title:xke(o),snippet:vke(c,f,i.length),role:u,ts:d??o.lastUpdateTime});break}}return a.sort((o,c)=>(c.ts??0)-(o.ts??0)),a.slice(0,Oke)}async function Ske(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await mee(e,t.trim())}catch(a){const o=String(a);return{results:[],note:o.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${o}`}}const{mounted:i,results:r,error:s}=n;return i?s?{results:[],note:s}:{results:r.map((a,o)=>({type:"web",index:o,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function Eke(e,t,n,i){if(!t||!i.trim())return{results:[]};const r=await pee(t,e,i.trim(),n);if(!r.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(r.error)return{results:[],note:r.error};const s=r.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:r.results.map((a,o)=>e==="knowledge"?{type:"knowledge",index:o,content:a.content,sourceName:s,sourceType:r.sourceType}:{type:"memory",index:o,content:a.content,sourceName:s,sourceType:r.sourceType,author:a.author,ts:a.timestamp})}}async function kke(e,t,n){return e==="session"?{results:await wke(n.userId,n.appId,t)}:e==="web"?Ske(n.appId,t):Eke(e,n.appId,n.userId,t)}function Qee({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),l.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function Tke({open:e}){return l.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function _ke({active:e=!1,onClick:t}){return l.jsxs("button",{className:`new-chat${e?" is-active":""}`,onClick:t,"aria-label":"搜索","aria-current":e?"page":void 0,title:"搜索",children:[l.jsx(Qee,{}),l.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function Ake(e,t,n){const i=!!e,r=new Set((t==null?void 0:t.searchSources)??[]),s=a=>i?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:i,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:i&&r.has("web"),description:"通过 web_search 工具检索",unavailableLabel:s(" web_search 工具")},{id:"knowledge",label:"知识库",ready:i&&r.has("knowledge"),unavailableLabel:s("知识库")},{id:"memory",label:"长期记忆",ready:i&&r.has("memory"),unavailableLabel:s("长期记忆")}]}function Sk(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function _9(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function Nke({userId:e,appId:t,agentInfo:n,capabilitiesLoading:i,agentLabel:r,onOpenSession:s}){var Q,C;const[a,o]=m.useState("session"),[c,u]=m.useState(""),[d,f]=m.useState([]),[h,p]=m.useState(),[g,b]=m.useState(!1),[y,O]=m.useState(!1),[v,x]=m.useState(!1),w=m.useRef(0),E=m.useRef(null),S=Ake(t,n,i),k=S.find(I=>I.id===a),T=a==="knowledge"?(Q=n==null?void 0:n.components)==null?void 0:Q.find(I=>I.source==="knowledgebase"||I.kind==="knowledgebase"):a==="memory"?(C=n==null?void 0:n.components)==null?void 0:C.find(I=>I.source==="long_term_memory"||I.kind==="memory"):void 0;m.useEffect(()=>{w.current+=1,o("session"),f([]),p(void 0),O(!1),b(!1),x(!1)},[t]),m.useEffect(()=>{if(!v)return;function I(U){var B;(B=E.current)!=null&&B.contains(U.target)||x(!1)}return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[v]);async function A(I,U){var G;const B=I.trim();if(!B||!((G=S.find($=>$.id===U))!=null&&G.ready))return;const P=++w.current;b(!0),O(!0);let q;try{q=await kke(U,B,{userId:e,appId:t})}catch($){const V=$ instanceof Error?$.message:String($);q={results:[],note:`搜索失败:${V}`}}P===w.current&&(f(q.results),p(q.note),b(!1))}function N(I){w.current+=1,u(I),f([]),p(void 0),O(!1),b(!1)}function j(I){w.current+=1,o(I),x(!1),f([]),p(void 0),O(!1),b(!1)}const M=!!(k!=null&&k.ready),D=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(T==null?void 0:T.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(T==null?void 0:T.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",L=T!=null&&T.backend?Sk(T.backend):"";return l.jsxs("div",{className:"search",children:[l.jsxs("div",{className:"search-box",children:[l.jsxs("div",{className:"search-source-picker-wrap",ref:E,children:[l.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(k==null?void 0:k.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":v,onClick:()=>x(I=>!I),children:[l.jsx("span",{children:(k==null?void 0:k.label)??"搜索类型"}),L&&l.jsx("small",{children:L}),l.jsx(Tke,{open:v})]}),v&&l.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:S.map(I=>{var P,q;const U=I.id==="knowledge"?(P=n==null?void 0:n.components)==null?void 0:P.find(G=>G.source==="knowledgebase"||G.kind==="knowledgebase"):I.id==="memory"?(q=n==null?void 0:n.components)==null?void 0:q.find(G=>G.source==="long_term_memory"||G.kind==="memory"):void 0,B=U?[U.name,U.backend?Sk(U.backend):""].filter(Boolean).join(" · "):I.ready?I.description:I.unavailableLabel;return l.jsxs("button",{type:"button",role:"option","aria-selected":a===I.id,disabled:!I.ready,onClick:()=>j(I.id),children:[l.jsx("span",{children:I.label}),B&&l.jsx("small",{children:B})]},I.id)})})]}),l.jsx("span",{className:"search-box-divider","aria-hidden":!0}),l.jsx("input",{className:"search-input",value:c,onChange:I=>N(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),A(c,a))},placeholder:D,disabled:!M,autoFocus:!0}),l.jsx("button",{className:"search-go",onClick:()=>void A(c,a),disabled:!c.trim()||g,"aria-label":"搜索",children:g?l.jsx(ei,{className:"icon spin"}):l.jsx(Qee,{className:"icon"})})]}),l.jsx("div",{className:"search-results",children:M?y?g?null:h?l.jsx("div",{className:"search-empty",children:h}):d.length===0&&y?l.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((I,U)=>l.jsx(Cke,{result:I,agentLabel:r,onOpen:s},U)):l.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):l.jsx("div",{className:"search-empty",children:t?i?"正在读取当前 Agent 的检索能力…":(k==null?void 0:k.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function Cke({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return l.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[l.jsx(CJ,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title}),l.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${_9(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return l.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[l.jsx(x_,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title||e.url}),l.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&l.jsx(c0,{className:"search-result-ext"})]})]}),e.summary&&l.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(A9,{source:"knowledge"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Sk(e.sourceType)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(A9,{source:"memory"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Sk(e.sourceType)}`:"",e.ts?` · ${_9(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function A9({source:e,className:t="search-result-icon"}){return e==="knowledge"?l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),l.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),l.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}function Df({className:e="icon"}){return l.jsxs("svg",{className:`${e} sidebar-agent-face`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),l.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),l.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function jke({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function Rke({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}function Bee(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),l.jsx("path",{d:"M13.25 17.75h-8a2.5 2.5 0 0 1-2.5-2.5v-8a3 3 0 0 1 3-3"}),l.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),l.jsx("path",{d:"m13.35 16.65.42-2.16 4.76-4.76a1.35 1.35 0 0 1 1.91 1.91l-4.76 4.76-2.33.25Z"}),l.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const o$="/assets/logo-DCsNZy-k.svg",l$="data:image/svg+xml,%3csvg%20width='28'%20height='23'%20viewBox='0%200%2028%2023'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.1957%209.44218C17.0253%209.58161%2016.7774%209.47317%2016.7774%209.24079V8.01696V0.611967C16.7774%200.395085%2016.514%200.271152%2016.3591%200.410576L6.04172%209.16334C5.87132%209.30276%205.62345%209.19432%205.62345%208.96194V2.98218C5.62345%202.81178%205.48403%202.67235%205.31362%202.67235H0.309832C0.139424%202.67235%200%202.81178%200%202.98218V21.7115C0%2021.9284%200.263357%2022.0524%200.418273%2021.9129L10.7202%2013.1602C10.8906%2013.0207%2011.1385%2013.1292%2011.1385%2013.3616V22.0059C11.1385%2022.2228%2011.4018%2022.3467%2011.5567%2022.2073L21.8586%2013.4545C22.0291%2013.3151%2022.2769%2013.4235%2022.2769%2013.6559V19.6357C22.2769%2019.8061%2022.4163%2019.9455%2022.5868%2019.9455H27.5905C27.7609%2019.9455%2027.9004%2019.8061%2027.9004%2019.6357V0.890816C27.9004%200.673934%2027.637%200.550001%2027.4821%200.689425L17.1957%209.44218Z'%20fill='%230066FC'/%3e%3c/svg%3e",N9="(max-width: 860px)";function Ike(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[l.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),l.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),l.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),l.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function Pke(e){let t=2166136261;for(const i of e)t^=i.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const Mke={admin:"管理员",developer:"开发者",user:"普通用户"};function C9({role:e}){const t=Mke[e];return l.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function Lke({access:e,userInfo:t,onSystemInfo:n,onLogout:i}){const[r,s]=m.useState(!1),[a,o]=m.useState("");if(!t)return null;const c=tEe(t),u=typeof t.email=="string"?t.email:"",d=(c||"U").slice(0,1).toUpperCase(),f=Pke(c||u||d),h=nEe(t),p=h===a?"":h;return l.jsxs("div",{className:"sidebar-user",children:[l.jsxs("button",{className:"sidebar-user-btn",onClick:()=>s(g=>!g),title:u?`${c} +${u}`:c,children:[l.jsxs("span",{className:`account-avatar${p?" has-image":""}`,style:f,children:[d,p?l.jsx("img",{className:"account-avatar-image",src:p,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>o(p)}):null]}),l.jsxs("span",{className:"sidebar-user-identity",children:[l.jsxs("span",{className:"sidebar-user-primary",children:[l.jsx("span",{className:"sidebar-user-name",children:c}),l.jsx(C9,{role:e.role})]}),u&&u!==c&&l.jsx("span",{className:"sidebar-user-email",children:u})]})]}),r&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>s(!1)}),l.jsxs("div",{className:"account-pop sidebar-user-pop",children:[l.jsxs("div",{className:"account-head",children:[l.jsxs("span",{className:`account-avatar account-avatar--lg${p?" has-image":""}`,style:f,children:[d,p?l.jsx("img",{className:"account-avatar-image",src:p,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>o(p)}):null]}),l.jsxs("div",{className:"account-id",children:[l.jsxs("div",{className:"account-name-row",children:[l.jsx("div",{className:"account-name",children:c}),l.jsx(C9,{role:e.role})]}),u&&u!==c&&l.jsx("div",{className:"account-sub",children:u})]})]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{s(!1),n()},children:[l.jsx(dd,{className:"icon"})," 系统信息"]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{s(!1),i()},children:[l.jsx(ISe,{className:"icon"})," 退出登录"]})]})]})]})}function Dke({branding:e,cloudProvider:t,sessions:n,currentSessionId:i,activePage:r,features:s,access:a,streamingSids:o,evaluatingSids:c,sandboxHistory:u,onNewChat:d,onSearch:f,onQuickCreate:h,onLibrary:p,onAddAgent:g,onMyAgents:b,onApplications:y,onSystemInfo:O,onIssueFeedback:v,onPickSession:x,onDeleteSession:w,userInfo:E,onLogout:S}){const k=C=>(s==null?void 0:s[C])!==!1,[T,A]=m.useState(null),N=m.useRef(typeof window<"u"&&window.matchMedia(N9).matches),[j,M]=m.useState(N.current),D=[...n].sort((C,I)=>(I.lastUpdateTime??0)-(C.lastUpdateTime??0)),L=()=>{N.current=!1,M(C=>!C),A(null)};m.useEffect(()=>{const C=window.matchMedia(N9),I=U=>{U.matches?M(B=>B||(N.current=!0,!0)):N.current&&(N.current=!1,M(!1))};return C.addEventListener("change",I),()=>C.removeEventListener("change",I)},[]);const Q=t==="byteplus"?l$:o$;return l.jsxs("aside",{className:`sidebar ${j?"is-collapsed":""}`,children:[l.jsxs("div",{className:"sidebar-top",children:[l.jsxs("div",{className:"sidebar-brand-row",children:[l.jsxs("button",{type:"button",className:"brand",onClick:d,"aria-label":"返回首页",title:"返回首页",children:[l.jsx("img",{className:"brand-logo",src:e.logoUrl||Q,width:20,height:20,alt:"","aria-hidden":!0}),l.jsx("span",{className:"brand-title",children:e.title})]}),l.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:L,"aria-label":j?"展开侧边栏":"收起侧边栏",title:j?"展开侧边栏":"收起侧边栏",children:j?l.jsx($Se,{className:"icon"}):l.jsx(DSe,{className:"icon"})})]}),k("newChat")&&l.jsxs("button",{className:`new-chat new-chat--conversation${r==="new-chat"?" is-active":""}`,onClick:d,"aria-label":"新会话","aria-current":r==="new-chat"?"page":void 0,title:"新会话",children:[l.jsx(Ks,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),l.jsxs("button",{className:`new-chat new-chat--agents${r==="agents"?" is-active":""}`,onClick:b,"aria-label":"智能体","aria-current":r==="agents"?"page":void 0,title:"智能体",children:[l.jsx(Df,{}),l.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),l.jsxs("button",{className:`new-chat new-chat--library${r==="library"?" is-active":""}`,onClick:p,"aria-label":"库","aria-current":r==="library"?"page":void 0,title:"库",children:[l.jsx(rSe,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"库"})]}),k("search")&&l.jsx(_ke,{active:r==="search",onClick:f}),l.jsxs("button",{className:`new-chat new-chat--applications${r==="applications"?" is-active":""}`,onClick:y,"aria-label":"自动化","aria-current":r==="applications"?"page":void 0,title:"自动化",children:[l.jsx(Ike,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"自动化"}),l.jsx("span",{className:"sidebar-beta-badge",children:"Beta"})]})]}),k("history")&&l.jsxs("div",{className:"sidebar-history",children:[l.jsxs("div",{className:"history-head",children:[l.jsx("span",{children:"历史会话"}),k("newChat")&&l.jsx("button",{type:"button",className:"history-new-chat",onClick:(u==null?void 0:u.onNew)??d,disabled:u==null?void 0:u.newDisabled,"aria-label":"新建会话",title:"新建会话",children:l.jsx(Ks,{className:"icon"})})]}),l.jsx("div",{className:"history-list",children:u?l.jsxs(l.Fragment,{children:[u.loading&&u.threads.length===0?l.jsx("div",{className:"history-empty",role:"status",children:"正在加载历史会话…"}):null,u.error?l.jsx("div",{className:"history-error",role:"alert",children:u.error}):null,!u.loading&&!u.error&&u.threads.length===0?l.jsx("div",{className:"history-empty",children:"暂无会话"}):null,u.threads.map(C=>{const I=C.id===u.currentThreadId,U=C.name||C.preview||`Thread ${C.id.slice(0,8)}`,B=C.id===u.busyThreadId;return l.jsxs("div",{className:`history-item ${I?"active":""}`,children:[l.jsxs("button",{type:"button",className:"history-item-btn",onClick:()=>u.onSelect(C.id),"aria-current":I?"page":void 0,title:U,disabled:B,children:[l.jsx("span",{className:"history-title",children:U}),I?l.jsx("span",{className:"history-current-badge",children:"当前"}):null]}),l.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${U}`,title:"更多",disabled:B,onClick:()=>A(P=>P===C.id?null:C.id),children:l.jsx(d9,{className:"icon"})}),T===C.id?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>A(null)}),l.jsx("div",{className:"history-menu",children:l.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{A(null),u.onDelete(C)},children:[l.jsx(Lf,{className:"icon"})," 删除"]})})]}):null]},C.id)}),u.hasMore?l.jsx("button",{type:"button",className:"history-load-more",disabled:u.loading,onClick:u.onLoadMore,children:u.loading?"加载中…":"加载更多"}):null]}):l.jsxs(l.Fragment,{children:[D.length===0&&l.jsx("div",{className:"history-empty",children:"暂无会话"}),D.map(C=>{const I=T_(C.events),U=(o==null?void 0:o.has(C.id))===!0,B=!U&&(c==null?void 0:c.has(C.id))===!0;return l.jsxs("div",{className:`history-item ${C.id===i?"active":""}`,children:[l.jsxs("button",{className:"history-item-btn",onClick:()=>x(C.id),"aria-current":C.id===i?"page":void 0,title:I,children:[U&&l.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),l.jsx("span",{className:"history-title",children:I}),B&&l.jsxs("span",{className:"history-evaluating-status",title:"正在自动评测",children:[l.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),"评测中"]})]}),l.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${I}`,title:"更多",onClick:()=>A(P=>P===C.id?null:C.id),children:l.jsx(d9,{className:"icon"})}),T===C.id&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>A(null)}),l.jsx("div",{className:"history-menu",children:l.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{A(null),w(C.id)},children:[l.jsx(Lf,{className:"icon"})," 删除"]})})]})]},C.id)})]})})]}),l.jsxs("div",{className:"sidebar-footer",children:[l.jsxs("button",{type:"button",className:`sidebar-feedback${r==="feedback"?" is-active":""}`,onClick:v,"aria-label":"问题反馈","aria-current":r==="feedback"?"page":void 0,title:"问题反馈",children:[l.jsx(Bee,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"问题反馈"})]}),l.jsx(Lke,{access:a,userInfo:E,onSystemInfo:O,onLogout:S})]})]})}function Kr(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,i;n {}};function __(){for(var e=0,t=arguments.length,n={},i;e =0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}HS.prototype=__.prototype={constructor:HS,on:function(e,t){var n=this._,i=Qke(e+"",n),r,s=-1,a=i.length;if(arguments.length<2){for(;++s0)for(var n=new Array(r),i=0,r,s;i =0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),R9.hasOwnProperty(t)?{space:R9[t],local:e}:e}function Uke(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===OP&&t.documentElement.namespaceURI===OP?t.createElement(e):t.createElementNS(n,e)}}function zke(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Uee(e){var t=A_(e);return(t.local?zke:Uke)(t)}function Fke(){}function c$(e){return e==null?Fke:function(){return this.querySelector(e)}}function Vke(e){typeof e!="function"&&(e=c$(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r =x&&(x=v+1);!(E=y[x])&&++x =0;)(a=i[r])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function mTe(e){e||(e=gTe);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,i=n.length,r=new Array(i),s=0;st?1:e>=t?0:NaN}function bTe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function OTe(){return Array.from(this)}function yTe(){for(var e=this._groups,t=0,n=e.length;t 1?this.each((t==null?CTe:typeof t=="function"?RTe:jTe)(e,t,n??"")):d0(this.node(),e)}function d0(e,t){return e.style.getPropertyValue(t)||qee(e).getComputedStyle(e,null).getPropertyValue(t)}function PTe(e){return function(){delete this[e]}}function MTe(e,t){return function(){this[e]=t}}function LTe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function DTe(e,t){return arguments.length>1?this.each((t==null?PTe:typeof t=="function"?LTe:MTe)(e,t)):this.node()[e]}function Hee(e){return e.trim().split(/^|\s+/)}function u$(e){return e.classList||new Yee(e)}function Yee(e){this._node=e,this._names=Hee(e.getAttribute("class")||"")}Yee.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Gee(e,t){for(var n=u$(e),i=-1,r=t.length;++i =0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function d_e(e){return function(){var t=this.__on;if(t){for(var n=0,i=-1,r=t.length,s;n ()=>e;function yP(e,{sourceEvent:t,subject:n,target:i,identifier:r,active:s,x:a,y:o,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}yP.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function v_e(e){return!e.ctrlKey&&!e.button}function w_e(){return this.parentNode}function S_e(e,t){return t??{x:e.x,y:e.y}}function E_e(){return navigator.maxTouchPoints||"ontouchstart"in this}function tte(){var e=v_e,t=w_e,n=S_e,i=E_e,r={},s=__("start","drag","end"),a=0,o,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(i).on("touchstart.drag",y).on("touchmove.drag",O,x_e).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,E){if(!(d||!e.call(this,w,E))){var S=x(this,t.call(this,w,E),w,E,"mouse");S&&(go(w.view).on("mousemove.drag",g,fx).on("mouseup.drag",b,fx),Jee(w.view),HN(w),u=!1,o=w.clientX,c=w.clientY,S("start",w))}}function g(w){if(Ag(w),!u){var E=w.clientX-o,S=w.clientY-c;u=E*E+S*S>f}r.mouse("drag",w)}function b(w){go(w.view).on("mousemove.drag mouseup.drag",null),ete(w.view,u),Ag(w),r.mouse("end",w)}function y(w,E){if(e.call(this,w,E)){var S=w.changedTouches,k=t.call(this,w,E),T=S.length,A,N;for(A=0;A >8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?uw(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?uw(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=T_e.exec(e))?new Ba(t[1],t[2],t[3],1):(t=__e.exec(e))?new Ba(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=A_e.exec(e))?uw(t[1],t[2],t[3],t[4]):(t=N_e.exec(e))?uw(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=C_e.exec(e))?Q9(t[1],t[2]/100,t[3]/100,1):(t=j_e.exec(e))?Q9(t[1],t[2]/100,t[3]/100,t[4]):I9.hasOwnProperty(e)?L9(I9[e]):e==="transparent"?new Ba(NaN,NaN,NaN,0):null}function L9(e){return new Ba(e>>16&255,e>>8&255,e&255,1)}function uw(e,t,n,i){return i<=0&&(e=t=n=NaN),new Ba(e,t,n,i)}function P_e(e){return e instanceof P1||(e=xp(e)),e?(e=e.rgb(),new Ba(e.r,e.g,e.b,e.opacity)):new Ba}function xP(e,t,n,i){return arguments.length===1?P_e(e):new Ba(e,t,n,i??1)}function Ba(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}d$(Ba,xP,nte(P1,{brighter(e){return e=e==null?kk:Math.pow(kk,e),new Ba(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?hx:Math.pow(hx,e),new Ba(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ba(ap(this.r),ap(this.g),ap(this.b),Tk(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:D9,formatHex:D9,formatHex8:M_e,formatRgb:$9,toString:$9}));function D9(){return`#${Vh(this.r)}${Vh(this.g)}${Vh(this.b)}`}function M_e(){return`#${Vh(this.r)}${Vh(this.g)}${Vh(this.b)}${Vh((isNaN(this.opacity)?1:this.opacity)*255)}`}function $9(){const e=Tk(this.opacity);return`${e===1?"rgb(":"rgba("}${ap(this.r)}, ${ap(this.g)}, ${ap(this.b)}${e===1?")":`, ${e})`}`}function Tk(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ap(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vh(e){return e=ap(e),(e<16?"0":"")+e.toString(16)}function Q9(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new jl(e,t,n,i)}function ite(e){if(e instanceof jl)return new jl(e.h,e.s,e.l,e.opacity);if(e instanceof P1||(e=xp(e)),!e)return new jl;if(e instanceof jl)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),a=NaN,o=s-r,c=(s+r)/2;return o?(t===s?a=(n-i)/o+(n0&&c<1?0:a,new jl(a,o,c,e.opacity)}function L_e(e,t,n,i){return arguments.length===1?ite(e):new jl(e,t,n,i??1)}function jl(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}d$(jl,L_e,nte(P1,{brighter(e){return e=e==null?kk:Math.pow(kk,e),new jl(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?hx:Math.pow(hx,e),new jl(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new Ba(YN(e>=240?e-240:e+120,r,i),YN(e,r,i),YN(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new jl(B9(this.h),dw(this.s),dw(this.l),Tk(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Tk(this.opacity);return`${e===1?"hsl(":"hsla("}${B9(this.h)}, ${dw(this.s)*100}%, ${dw(this.l)*100}%${e===1?")":`, ${e})`}`}}));function B9(e){return e=(e||0)%360,e<0?e+360:e}function dw(e){return Math.max(0,Math.min(1,e||0))}function YN(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const f$=e=>()=>e;function D_e(e,t){return function(n){return e+n*t}}function $_e(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function Q_e(e){return(e=+e)==1?rte:function(t,n){return n-t?$_e(t,n,e):f$(isNaN(t)?n:t)}}function rte(e,t){var n=t-e;return n?D_e(e,n):f$(isNaN(e)?t:e)}const _k=function e(t){var n=Q_e(t);function i(r,s){var a=n((r=xP(r)).r,(s=xP(s)).r),o=n(r.g,s.g),c=n(r.b,s.b),u=rte(r.opacity,s.opacity);return function(d){return r.r=a(d),r.g=o(d),r.b=c(d),r.opacity=u(d),r+""}}return i.gamma=e,i}(1);function B_e(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,i=t.slice(),r;return function(s){for(r=0;r n&&(s=t.slice(n,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(r=r[0])?o[a]?o[a]+=r:o[++a]=r:(o[++a]=null,c.push({i:a,x:bc(i,r)})),n=GN.lastIndex;return n 180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(r(f)+"rotate(",null,i)-2,x:bc(u,d)})):d&&f.push(r(f)+"rotate("+d+i)}function o(u,d,f,h){u!==d?h.push({i:f.push(r(f)+"skewX(",null,i)-2,x:bc(u,d)}):d&&f.push(r(f)+"skewX("+d+i)}function c(u,d,f,h,p,g){if(u!==f||d!==h){var b=p.push(r(p)+"scale(",null,",",null,")");g.push({i:b-4,x:bc(u,f)},{i:b-2,x:bc(d,h)})}else(f!==1||h!==1)&&p.push(r(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),s(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),o(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var g=-1,b=h.length,y;++g=0&&e._call.call(void 0,t),e=e._next;--f0}function F9(){vp=(Nk=mx.now())+N_,f0=DO=0;try{t2e()}finally{f0=0,i2e(),vp=0}}function n2e(){var e=mx.now(),t=e-Nk;t>lte&&(N_-=t,Nk=e)}function i2e(){for(var e,t=Ak,n,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ak=n);$O=e,SP(i)}function SP(e){if(!f0){DO&&(DO=clearTimeout(DO));var t=e-vp;t>24?(e<1/0&&(DO=setTimeout(F9,e-mx.now()-N_)),nO&&(nO=clearInterval(nO))):(nO||(Nk=mx.now(),nO=setInterval(n2e,lte)),f0=1,cte(F9))}}function V9(e,t,n){var i=new Ck;return t=t==null?0:+t,i.restart(r=>{i.stop(),e(r+t)},t,n),i}var r2e=__("start","end","cancel","interrupt"),s2e=[],dte=0,X9=1,EP=2,GS=3,q9=4,kP=5,WS=6;function C_(e,t,n,i,r,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;a2e(e,n,{name:t,index:i,group:r,on:r2e,tween:s2e,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:dte})}function p$(e,t){var n=Vl(e,t);if(n.state>dte)throw new Error("too late; already scheduled");return n}function Yc(e,t){var n=Vl(e,t);if(n.state>GS)throw new Error("too late; already running");return n}function Vl(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function a2e(e,t,n){var i=e.__transition,r;i[t]=n,n.timer=ute(s,0,n.time);function s(u){n.state=X9,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==X9)return c();for(d in i)if(p=i[d],p.name===n.name){if(p.state===GS)return V9(a);p.state===q9?(p.state=WS,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[d]):+d EP&&i.state =0&&(t=t.slice(0,n)),!t||t==="start"})}function L2e(e,t,n){var i,r,s=M2e(t)?p$:Yc;return function(){var a=s(this,e),o=a.on;o!==i&&(r=(i=o).copy()).on(t,n),a.on=r}}function D2e(e,t){var n=this._id;return arguments.length<2?Vl(this.node(),n).on.on(e):this.each(L2e(n,e,t))}function $2e(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Q2e(){return this.on("end.remove",$2e(this._id))}function B2e(e){var t=this._name,n=this._id;typeof e!="function"&&(e=c$(e));for(var i=this._groups,r=i.length,s=new Array(r),a=0;a ()=>e;function dAe(e,{sourceEvent:t,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function Iu(e,t,n){this.k=e,this.x=t,this.y=n}Iu.prototype={constructor:Iu,scale:function(e){return e===1?this:new Iu(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Iu(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var j_=new Iu(1,0,0);mte.prototype=Iu.prototype;function mte(e){for(;!e.__zoom;)if(!(e=e.parentNode))return j_;return e.__zoom}function WN(e){e.stopImmediatePropagation()}function iO(e){e.preventDefault(),e.stopImmediatePropagation()}function fAe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function hAe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function H9(){return this.__zoom||j_}function pAe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function mAe(){return navigator.maxTouchPoints||"ontouchstart"in this}function gAe(e,t,n){var i=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function gte(){var e=fAe,t=hAe,n=gAe,i=pAe,r=mAe,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,c=YS,u=__("start","zoom","end"),d,f,h,p=500,g=150,b=0,y=10;function O(L){L.property("__zoom",H9).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",N).filter(r).on("touchstart.zoom",j).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}O.transform=function(L,Q,C,I){var U=L.selection?L.selection():L;U.property("__zoom",H9),L!==U?E(L,Q,C,I):U.interrupt().each(function(){S(this,arguments).event(I).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},O.scaleBy=function(L,Q,C,I){O.scaleTo(L,function(){var U=this.__zoom.k,B=typeof Q=="function"?Q.apply(this,arguments):Q;return U*B},C,I)},O.scaleTo=function(L,Q,C,I){O.transform(L,function(){var U=t.apply(this,arguments),B=this.__zoom,P=C==null?w(U):typeof C=="function"?C.apply(this,arguments):C,q=B.invert(P),G=typeof Q=="function"?Q.apply(this,arguments):Q;return n(x(v(B,G),P,q),U,a)},C,I)},O.translateBy=function(L,Q,C,I){O.transform(L,function(){return n(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),a)},null,I)},O.translateTo=function(L,Q,C,I,U){O.transform(L,function(){var B=t.apply(this,arguments),P=this.__zoom,q=I==null?w(B):typeof I=="function"?I.apply(this,arguments):I;return n(j_.translate(q[0],q[1]).scale(P.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof C=="function"?-C.apply(this,arguments):-C),B,a)},I,U)};function v(L,Q){return Q=Math.max(s[0],Math.min(s[1],Q)),Q===L.k?L:new Iu(Q,L.x,L.y)}function x(L,Q,C){var I=Q[0]-C[0]*L.k,U=Q[1]-C[1]*L.k;return I===L.x&&U===L.y?L:new Iu(L.k,I,U)}function w(L){return[(+L[0][0]+ +L[1][0])/2,(+L[0][1]+ +L[1][1])/2]}function E(L,Q,C,I){L.on("start.zoom",function(){S(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(I).end()}).tween("zoom",function(){var U=this,B=arguments,P=S(U,B).event(I),q=t.apply(U,B),G=C==null?w(q):typeof C=="function"?C.apply(U,B):C,$=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),V=U.__zoom,te=typeof Q=="function"?Q.apply(U,B):Q,fe=c(V.invert(G).concat($/V.k),te.invert(G).concat($/te.k));return function(Te){if(Te===1)Te=te;else{var J=fe(Te),ne=$/J[2];Te=new Iu(ne,G[0]-J[0]*ne,G[1]-J[1]*ne)}P.zoom(null,Te)}})}function S(L,Q,C){return!C&&L.__zooming||new k(L,Q)}function k(L,Q){this.that=L,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=t.apply(L,Q),this.taps=0}k.prototype={event:function(L){return L&&(this.sourceEvent=L),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(L,Q){return this.mouse&&L!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&L!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&L!=="touch"&&(this.touch1[1]=Q.invert(this.touch1[0])),this.that.__zoom=Q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(L){var Q=go(this.that).datum();u.call(L,this.that,new dAe(L,{sourceEvent:this.sourceEvent,target:O,transform:this.that.__zoom,dispatch:u}),Q)}};function T(L,...Q){if(!e.apply(this,arguments))return;var C=S(this,Q).event(L),I=this.__zoom,U=Math.max(s[0],Math.min(s[1],I.k*Math.pow(2,i.apply(this,arguments)))),B=Al(L);if(C.wheel)(C.mouse[0][0]!==B[0]||C.mouse[0][1]!==B[1])&&(C.mouse[1]=I.invert(C.mouse[0]=B)),clearTimeout(C.wheel);else{if(I.k===U)return;C.mouse=[B,I.invert(B)],ZS(this),C.start()}iO(L),C.wheel=setTimeout(P,g),C.zoom("mouse",n(x(v(I,U),C.mouse[0],C.mouse[1]),C.extent,a));function P(){C.wheel=null,C.end()}}function A(L,...Q){if(h||!e.apply(this,arguments))return;var C=L.currentTarget,I=S(this,Q,!0).event(L),U=go(L.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",$,!0),B=Al(L,C),P=L.clientX,q=L.clientY;Jee(L.view),WN(L),I.mouse=[B,this.__zoom.invert(B)],ZS(this),I.start();function G(V){if(iO(V),!I.moved){var te=V.clientX-P,fe=V.clientY-q;I.moved=te*te+fe*fe>b}I.event(V).zoom("mouse",n(x(I.that.__zoom,I.mouse[0]=Al(V,C),I.mouse[1]),I.extent,a))}function $(V){U.on("mousemove.zoom mouseup.zoom",null),ete(V.view,I.moved),iO(V),I.event(V).end()}}function N(L,...Q){if(e.apply(this,arguments)){var C=this.__zoom,I=Al(L.changedTouches?L.changedTouches[0]:L,this),U=C.invert(I),B=C.k*(L.shiftKey?.5:2),P=n(x(v(C,B),I,U),t.apply(this,Q),a);iO(L),o>0?go(this).transition().duration(o).call(E,P,I,L):go(this).call(O.transform,P,I,L)}}function j(L,...Q){if(e.apply(this,arguments)){var C=L.touches,I=C.length,U=S(this,Q,L.changedTouches.length===I).event(L),B,P,q,G;for(WN(L),P=0;P`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:i})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:i}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},gx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],bte=["Enter"," ","Escape"],Ote={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var h0;(function(e){e.Strict="strict",e.Loose="loose"})(h0||(h0={}));var op;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(op||(op={}));var bx;(function(e){e.Partial="partial",e.Full="full"})(bx||(bx={}));const yte={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ef;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ef||(ef={}));var Ox;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ox||(Ox={}));var wt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(wt||(wt={}));const Y9={[wt.Left]:wt.Right,[wt.Right]:wt.Left,[wt.Top]:wt.Bottom,[wt.Bottom]:wt.Top};function xte(e){return e===null?null:e?"valid":"invalid"}const vte=e=>"id"in e&&"source"in e&&"target"in e,bAe=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),g$=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),M1=(e,t=[0,0])=>{const{width:n,height:i}=fd(e),r=e.origin??t,s=n*r[0],a=i*r[1];return{x:e.position.x-s,y:e.position.y-a}},OAe=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((i,r)=>{const s=typeof r=="string";let a=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(r):g$(r)?r:t.nodeLookup.get(r.id));const o=a?jk(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return R_(i,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return I_(n)},L1=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=R_(n,jk(r)),i=!0)}),i?I_(n):{x:0,y:0,width:0,height:0}},b$=(e,t,[n,i,r]=[0,0,1],s=!1,a=!1)=>{const o={...eb(t,[n,i,r]),width:t.width/r,height:t.height/r},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,g=d.height??u.height??u.initialHeight??null,b=yx(o,m0(u)),y=(p??0)*(g??0),O=s&&b>0;(!u.internals.handleBounds||O||b>=y||u.dragging)&&c.push(u)}return c},yAe=(e,t)=>{const n=new Set;return e.forEach(i=>{n.add(i.id)}),t.filter(i=>n.has(i.source)||n.has(i.target))};function xAe(e,t){const n=new Map,i=t!=null&&t.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!r.hidden)&&(!i||i.has(r.id))&&n.set(r.id,r)}),n}async function vAe({nodes:e,width:t,height:n,panZoom:i,minZoom:r,maxZoom:s},a){if(e.size===0)return!0;const o=xAe(e,a),c=L1(o),u=y$(c,t,n,(a==null?void 0:a.minZoom)??r,(a==null?void 0:a.maxZoom)??s,(a==null?void 0:a.padding)??.1);return await i.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function wte({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:i=[0,0],nodeExtent:r,onError:s}){const a=n.get(e),o=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=o?o.internals.positionAbsolute:{x:0,y:0},d=a.origin??i;let f=a.extent||r;if(a.extent==="parent"&&!a.expandParent)if(!o)s==null||s("005",Bl.error005());else{const p=o.measured.width,g=o.measured.height;p&&g&&(f=[[c,u],[c+p,u+g]])}else o&&Sp(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=Sp(f)?wp(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",Bl.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function wAe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:i,onBeforeDelete:r}){const s=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=s.has(h.id),g=!p&&h.parentId&&a.find(b=>b.id===h.parentId);(p||g)&&a.push(h)}const o=new Set(t.map(h=>h.id)),c=i.filter(h=>h.deletable!==!1),d=yAe(a,c);for(const h of c)o.has(h.id)&&!d.find(g=>g.id===h.id)&&d.push(h);if(!r)return{edges:d,nodes:a};const f=await r({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const p0=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),wp=(e={x:0,y:0},t,n)=>({x:p0(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:p0(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Ste(e,t,n){const{width:i,height:r}=fd(n),{x:s,y:a}=n.internals.positionAbsolute;return wp(e,[[s,a],[s+i,a+r]],t)}const G9=(e,t,n)=>e n?-p0(Math.abs(e-n),1,t)/t:0,O$=(e,t,n=15,i=40)=>{const r=G9(e.x,i,t.width-i)*n,s=G9(e.y,i,t.height-i)*n;return[r,s]},R_=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),TP=({x:e,y:t,width:n,height:i})=>({x:e,y:t,x2:e+n,y2:t+i}),I_=({x:e,y:t,x2:n,y2:i})=>({x:e,y:t,width:n-e,height:i-t}),m0=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=g$(e)?e.internals.positionAbsolute:M1(e,t);return{x:n,y:i,width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},jk=(e,t=[0,0])=>{var r,s;const{x:n,y:i}=g$(e)?e.internals.positionAbsolute:M1(e,t);return{x:n,y:i,x2:n+(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0),y2:i+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},Ete=(e,t)=>I_(R_(TP(e),TP(t))),yx=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*i)},W9=e=>Il(e.width)&&Il(e.height)&&Il(e.x)&&Il(e.y),Il=e=>!isNaN(e)&&isFinite(e),kte=(e,t)=>(n,i)=>{},D1=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),eb=({x:e,y:t},[n,i,r],s=!1,a=[1,1])=>{const o={x:(e-n)/r,y:(t-i)/r};return s?D1(o,a):o},g0=({x:e,y:t},[n,i,r])=>({x:e*r+n,y:t*r+i});function fm(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function SAe(e,t,n){if(typeof e=="string"||typeof e=="number"){const i=fm(e,n),r=fm(e,t);return{top:i,right:r,bottom:i,left:r,x:r*2,y:i*2}}if(typeof e=="object"){const i=fm(e.top??e.y??0,n),r=fm(e.bottom??e.y??0,n),s=fm(e.left??e.x??0,t),a=fm(e.right??e.x??0,t);return{top:i,right:a,bottom:r,left:s,x:s+a,y:i+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function EAe(e,t,n,i,r,s){const{x:a,y:o}=g0(e,[t,n,i]),{x:c,y:u}=g0({x:e.x+e.width,y:e.y+e.height},[t,n,i]),d=r-c,f=s-u;return{left:Math.floor(a),top:Math.floor(o),right:Math.floor(d),bottom:Math.floor(f)}}const y$=(e,t,n,i,r,s)=>{const a=SAe(s,t,n),o=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(o,c),d=p0(u,i,r),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,g=n/2-h*d,b=EAe(e,p,g,d,t,n),y={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:p-y.left+y.right,y:g-y.top+y.bottom,zoom:d}},xx=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Sp(e){return e!=null&&e!=="parent"}function fd(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function x$(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function Tte(e,t={width:0,height:0},n,i,r){const s={...e},a=i.get(n);if(a){const o=a.origin||r;s.x+=a.internals.positionAbsolute.x-(t.width??0)*o[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*o[1]}return s}function Z9(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function kAe(){let e,t;return{promise:new Promise((i,r)=>{e=i,t=r}),resolve:e,reject:t}}function TAe(e){return{...Ote,...e||{}}}function xy(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:i,containerBounds:r}){const{x:s,y:a}=Pl(e),o=eb({x:s-((r==null?void 0:r.left)??0),y:a-((r==null?void 0:r.top)??0)},i),{x:c,y:u}=n?D1(o,t):o;return{xSnapped:c,ySnapped:u,...o}}const v$=e=>({width:e.offsetWidth,height:e.offsetHeight}),_te=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},_Ae=["INPUT","SELECT","TEXTAREA"];function Ate(e){var i,r;const t=((r=(i=e.composedPath)==null?void 0:i.call(e))==null?void 0:r[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:_Ae.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Nte=e=>"clientX"in e,Pl=(e,t)=>{var s,a;const n=Nte(e),i=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,r=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},K9=(e,t,n,i,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{const o=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:r,position:a.getAttribute("data-handlepos"),x:(o.left-n.left)/i,y:(o.top-n.top)/i,...v$(a)}})};function Cte({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:r,sourceControlY:s,targetControlX:a,targetControlY:o}){const c=e*.125+r*.375+a*.375+n*.125,u=t*.125+s*.375+o*.375+i*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function pw(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function J9({pos:e,x1:t,y1:n,x2:i,y2:r,c:s}){switch(e){case wt.Left:return[t-pw(t-i,s),n];case wt.Right:return[t+pw(i-t,s),n];case wt.Top:return[t,n-pw(n-r,s)];case wt.Bottom:return[t,n+pw(r-n,s)]}}function jte({sourceX:e,sourceY:t,sourcePosition:n=wt.Bottom,targetX:i,targetY:r,targetPosition:s=wt.Top,curvature:a=.25}){const[o,c]=J9({pos:n,x1:e,y1:t,x2:i,y2:r,c:a}),[u,d]=J9({pos:s,x1:i,y1:r,x2:e,y2:t,c:a}),[f,h,p,g]=Cte({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:o,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${o},${c} ${u},${d} ${i},${r}`,f,h,p,g]}function Rte({sourceX:e,sourceY:t,targetX:n,targetY:i}){const r=Math.abs(n-e)/2,s=n 0}const CAe=({source:e,sourceHandle:t,target:n,targetHandle:i})=>`xy-edge__${e}${t||""}-${n}${i||""}`,jAe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),RAe=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",Bl.error006()),t;const i=n.getEdgeId||CAe;let r;return vte(e)?r={...e}:r={...e,id:i(e)},jAe(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Ite({sourceX:e,sourceY:t,targetX:n,targetY:i}){const[r,s,a,o]=Rte({sourceX:e,sourceY:t,targetX:n,targetY:i});return[`M ${e},${t}L ${n},${i}`,r,s,a,o]}const eU={[wt.Left]:{x:-1,y:0},[wt.Right]:{x:1,y:0},[wt.Top]:{x:0,y:-1},[wt.Bottom]:{x:0,y:1}},IAe=({source:e,sourcePosition:t=wt.Bottom,target:n})=>t===wt.Left||t===wt.Right?e.x Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function PAe({source:e,sourcePosition:t=wt.Bottom,target:n,targetPosition:i=wt.Top,center:r,offset:s,stepPosition:a}){const o=eU[t],c=eU[i],u={x:e.x+o.x*s,y:e.y+o.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},f=IAe({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let g=[],b,y;const O={x:0,y:0},v={x:0,y:0},[,,x,w]=Rte({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[h]*c[h]===-1){h==="x"?(b=r.x??u.x+(d.x-u.x)*a,y=r.y??(u.y+d.y)/2):(b=r.x??(u.x+d.x)/2,y=r.y??u.y+(d.y-u.y)*a);const T=[{x:b,y:u.y},{x:b,y:d.y}],A=[{x:u.x,y},{x:d.x,y}];o[h]===p?g=h==="x"?T:A:g=h==="x"?A:T}else{const T=[{x:u.x,y:d.y}],A=[{x:d.x,y:u.y}];if(h==="x"?g=o.x===p?A:T:g=o.y===p?T:A,t===i){const L=Math.abs(e[h]-n[h]);if(L<=s){const Q=Math.min(s-1,s-L);o[h]===p?O[h]=(u[h]>e[h]?-1:1)*Q:v[h]=(d[h]>n[h]?-1:1)*Q}}if(t!==i){const L=h==="x"?"y":"x",Q=o[h]===c[L],C=u[L]>d[L],I=u[L] =D?(b=(N.x+j.x)/2,y=g[0].y):(b=g[0].x,y=(N.y+j.y)/2)}const E={x:u.x+O.x,y:u.y+O.y},S={x:d.x+v.x,y:d.y+v.y};return[[e,...E.x!==g[0].x||E.y!==g[0].y?[E]:[],...g,...S.x!==g[g.length-1].x||S.y!==g[g.length-1].y?[S]:[],n],b,y,x,w]}function MAe(e,t,n,i){const r=Math.min(tU(e,t)/2,tU(t,n)/2,i),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){const u=e.x n.id===t):e[0])||null}function _P(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function DAe(e,{id:t,defaultColor:n,defaultMarkerStart:i,defaultMarkerEnd:r}){const s=new Set;return e.reduce((a,o)=>([o.markerStart||i,o.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const u=_P(c,t);s.has(u)||(a.push({id:u,color:c.color||n,...c}),s.add(u))}}),a),[]).sort((a,o)=>a.id.localeCompare(o.id))}const Pte=1e3,$Ae=10,w$={nodeOrigin:[0,0],nodeExtent:gx,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},QAe={...w$,checkEquality:!0};function S$(e,t){const n={...e};for(const i in t)t[i]!==void 0&&(n[i]=t[i]);return n}function BAe(e,t,n){const i=S$(w$,n);for(const r of e.values())if(r.parentId)k$(r,e,t,i);else{const s=M1(r,i.nodeOrigin),a=Sp(r.extent)?r.extent:i.nodeExtent,o=wp(s,a,fd(r));r.internals.positionAbsolute=o}}function UAe(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],i=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&i.push(s)}return{source:n,target:i}}function E$(e){return e==="manual"}function AP(e,t,n,i={}){var d,f;const r=S$(QAe,i),s={i:0},a=new Map(t),o=r!=null&&r.elevateNodesOnSelect&&!E$(r.zIndexMode)?Pte:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(r.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const g=M1(h,r.nodeOrigin),b=Sp(h.extent)?h.extent:r.nodeExtent,y=wp(g,b,fd(h));p={...r.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:y,handleBounds:UAe(h,p),z:Mte(h,o,r.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&k$(p,t,n,i,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function zAe(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function k$(e,t,n,i,r){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:o,zIndexMode:c}=S$(w$,i),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}zAe(e,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*$Ae),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const f=s&&!E$(c)?Pte:0,{x:h,y:p,z:g}=FAe(e,d,a,o,f,c),{positionAbsolute:b}=e.internals,y=h!==b.x||p!==b.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:h,y:p}:b,z:g}})}function Mte(e,t,n){const i=Il(e.zIndex)?e.zIndex:0;return E$(n)?i:i+(e.selected?t:0)}function FAe(e,t,n,i,r,s){const{x:a,y:o}=t.internals.positionAbsolute,c=fd(e),u=M1(e,n),d=Sp(e.extent)?wp(u,e.extent,c):u;let f=wp({x:a+d.x,y:o+d.y},i,c);e.extent==="parent"&&(f=Ste(f,c,t));const h=Mte(e,r,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function T$(e,t,n,i=[0,0]){var a;const r=[],s=new Map;for(const o of e){const c=t.get(o.parentId);if(!c)continue;const u=((a=s.get(o.parentId))==null?void 0:a.expandedRect)??m0(c),d=Ete(u,o.rect);s.set(o.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:o,parent:c},u)=>{var x;const d=c.internals.positionAbsolute,f=fd(c),h=c.origin??i,p=o.x 0||g>0||O||v)&&(r.push({id:u,type:"position",position:{x:c.position.x-p+O,y:c.position.y-g+v}}),(x=n.get(u))==null||x.forEach(w=>{e.some(E=>E.id===w.id)||r.push({id:w.id,type:"position",position:{x:w.position.x+p,y:w.position.y+g}})})),(f.width 0){const p=T$(h,t,n,r);u.push(...p)}return{changes:u,updatedInternals:c}}async function XAe({delta:e,panZoom:t,transform:n,translateExtent:i,width:r,height:s}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],i);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function sU(e,t,n,i,r,s){let a=r;const o=i.get(a)||new Map;i.set(a,o.set(n,t)),a=`${r}-${e}`;const c=i.get(a)||new Map;if(i.set(a,c.set(n,t)),s){a=`${r}-${e}-${s}`;const u=i.get(a)||new Map;i.set(a,u.set(n,t))}}function Lte(e,t,n){e.clear(),t.clear();for(const i of n){const{source:r,target:s,sourceHandle:a=null,targetHandle:o=null}=i,c={edgeId:i.id,source:r,target:s,sourceHandle:a,targetHandle:o},u=`${r}-${a}--${s}-${o}`,d=`${s}-${o}--${r}-${a}`;sU("source",c,d,e,r,a),sU("target",c,u,e,s,o),t.set(i.id,i)}}function Dte(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Dte(n,t):!1}function aU(e,t,n){var r;let i=e;do{if((r=i==null?void 0:i.matches)!=null&&r.call(i,t))return!0;if(i===n)return!1;i=i==null?void 0:i.parentElement}while(i);return!1}function qAe(e,t,n,i){const r=new Map;for(const[s,a]of e)if((a.selected||a.id===i)&&(!a.parentId||!Dte(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const o=e.get(s);o&&r.set(s,{id:s,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return r}function ZN({nodeId:e,dragItems:t,nodeLookup:n,dragging:i=!0}){var a,o,c;const r=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&r.push({...f,position:d.position,dragging:i})}if(!e)return[r[0],r];const s=(o=n.get(e))==null?void 0:o.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:i}:r[0],r]}function HAe({dragItems:e,snapGrid:t,x:n,y:i}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:i-r.distance.y},a=D1(s,t);return{x:a.x-s.x,y:a.y-s.y}}function YAe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:i,onDragStop:r}){let s={x:null,y:null},a=0,o=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,g=!1,b=null;function y({noDragClassName:v,handleSelector:x,domNode:w,isSelectable:E,nodeId:S,nodeClickDistance:k=0}){h=go(w);function T({x:M,y:D}){const{nodeLookup:L,nodeExtent:Q,snapGrid:C,snapToGrid:I,nodeOrigin:U,onNodeDrag:B,onSelectionDrag:P,onError:q,updateNodePositions:G}=t();s={x:M,y:D};let $=!1;const V=o.size>1,te=V&&Q?TP(L1(o)):null,fe=V&&I?HAe({dragItems:o,snapGrid:C,x:M,y:D}):null;for(const[Te,J]of o){if(!L.has(Te))continue;let ne={x:M-J.distance.x,y:D-J.distance.y};I&&(ne=fe?{x:Math.round(ne.x+fe.x),y:Math.round(ne.y+fe.y)}:D1(ne,C));let ce=null;if(V&&Q&&!J.extent&&te){const{positionAbsolute:je}=J.internals,ve=je.x-te.x+Q[0][0],be=je.x+J.measured.width-te.x2+Q[1][0],ae=je.y-te.y+Q[0][1],Re=je.y+J.measured.height-te.y2+Q[1][1];ce=[[ve,ae],[be,Re]]}const{position:Oe,positionAbsolute:Se}=wte({nodeId:Te,nextPosition:ne,nodeLookup:L,nodeExtent:ce||Q,nodeOrigin:U,onError:q});$=$||J.position.x!==Oe.x||J.position.y!==Oe.y,J.position=Oe,J.internals.positionAbsolute=Se}if(g=g||$,!!$&&(G(o,!0),b&&(i||B||!S&&P))){const[Te,J]=ZN({nodeId:S,dragItems:o,nodeLookup:L});i==null||i(b,o,Te,J),B==null||B(b,Te,J),S||P==null||P(b,J)}}async function A(){if(!d)return;const{transform:M,panBy:D,autoPanSpeed:L,autoPanOnNodeDrag:Q}=t();if(!Q){c=!1,cancelAnimationFrame(a);return}const[C,I]=O$(u,d,L);(C!==0||I!==0)&&(s.x=(s.x??0)-C/M[2],s.y=(s.y??0)-I/M[2],await D({x:C,y:I})&&T(s)),a=requestAnimationFrame(A)}function N(M){var V;const{nodeLookup:D,multiSelectionActive:L,nodesDraggable:Q,transform:C,snapGrid:I,snapToGrid:U,selectNodesOnDrag:B,onNodeDragStart:P,onSelectionDragStart:q,unselectNodesAndEdges:G}=t();f=!0,(!B||!E)&&!L&&S&&((V=D.get(S))!=null&&V.selected||G()),E&&B&&S&&(e==null||e(S));const $=xy(M.sourceEvent,{transform:C,snapGrid:I,snapToGrid:U,containerBounds:d});if(s=$,o=qAe(D,Q,$,S),o.size>0&&(n||P||!S&&q)){const[te,fe]=ZN({nodeId:S,dragItems:o,nodeLookup:D});n==null||n(M.sourceEvent,o,te,fe),P==null||P(M.sourceEvent,te,fe),S||q==null||q(M.sourceEvent,fe)}}const j=tte().clickDistance(k).on("start",M=>{const{domNode:D,nodeDragThreshold:L,transform:Q,snapGrid:C,snapToGrid:I}=t();d=(D==null?void 0:D.getBoundingClientRect())||null,p=!1,g=!1,b=M.sourceEvent,L===0&&N(M),s=xy(M.sourceEvent,{transform:Q,snapGrid:C,snapToGrid:I,containerBounds:d}),u=Pl(M.sourceEvent,d)}).on("drag",M=>{const{autoPanOnNodeDrag:D,transform:L,snapGrid:Q,snapToGrid:C,nodeDragThreshold:I,nodeLookup:U}=t(),B=xy(M.sourceEvent,{transform:L,snapGrid:Q,snapToGrid:C,containerBounds:d});if(b=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||S&&!U.has(S))&&(p=!0),!p){if(!c&&D&&f&&(c=!0,A()),!f){const P=Pl(M.sourceEvent,d),q=P.x-u.x,G=P.y-u.y;Math.sqrt(q*q+G*G)>I&&N(M)}(s.x!==B.xSnapped||s.y!==B.ySnapped)&&o&&f&&(u=Pl(M.sourceEvent,d),T(B))}}).on("end",M=>{if(!f||p){p&&o.size>0&&t().updateNodePositions(o,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),o.size>0){const{nodeLookup:D,updateNodePositions:L,onNodeDragStop:Q,onSelectionDragStop:C}=t();if(g&&(L(o,!1),g=!1),r||Q||!S&&C){const[I,U]=ZN({nodeId:S,dragItems:o,nodeLookup:D,dragging:!1});r==null||r(M.sourceEvent,o,I,U),Q==null||Q(M.sourceEvent,I,U),S||C==null||C(M.sourceEvent,U)}}}).filter(M=>{const D=M.target;return!M.button&&(!v||!aU(D,`.${v}`,w))&&(!x||aU(D,x,w))});h.call(j)}function O(){h==null||h.on(".drag",null)}return{update:y,destroy:O}}function GAe(e,t,n){const i=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())yx(r,m0(s))>0&&i.push(s);return i}const WAe=250;function ZAe(e,t,n,i){var o,c;let r=[],s=1/0;const a=GAe(e,n,t+WAe);for(const u of a){const d=[...((o=u.internals.handleBounds)==null?void 0:o.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:h,y:p}=Ep(u,f,f.position,!0),g=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));g>t||(g 1){const u=i.type==="source"?"target":"source";return r.find(d=>d.type===u)??r[0]}return r[0]}function $te(e,t,n,i,r,s=!1){var u,d,f;const a=i.get(e);if(!a)return null;const o=r==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?o==null?void 0:o.find(h=>h.id===n):o==null?void 0:o[0])??null;return c&&s?{...c,...Ep(a,c,c.position,!0)}:c}function Qte(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function KAe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Bte=()=>!0;function JAe(e,{connectionMode:t,connectionRadius:n,handleId:i,nodeId:r,edgeUpdaterType:s,isTarget:a,domNode:o,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:g,onConnect:b,onConnectEnd:y,isValidConnection:O=Bte,onReconnectEnd:v,updateConnection:x,getTransform:w,getFromHandle:E,autoPanSpeed:S,dragThreshold:k=1,handleDomNode:T}){const A=_te(e.target);let N=0,j;const{x:M,y:D}=Pl(e),L=Qte(s,T),Q=o==null?void 0:o.getBoundingClientRect();let C=!1;if(!Q||!L)return;const I=$te(r,L,i,c,t);if(!I)return;let U=Pl(e,Q),B=!1,P=null,q=!1,G=null;function $(){if(!d||!Q)return;const[Oe,Se]=O$(U,Q,S);h({x:Oe,y:Se}),N=requestAnimationFrame($)}const V={...I,nodeId:r,type:L,position:I.position},te=c.get(r);let Te={inProgress:!0,isValid:null,from:Ep(te,V,wt.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:te,to:U,toHandle:null,toPosition:Y9[V.position],toNode:null,pointer:U};function J(){C=!0,x(Te),g==null||g(e,{nodeId:r,handleId:i,handleType:L})}k===0&&J();function ne(Oe){if(!C){const{x:Re,y:xe}=Pl(Oe),Be=Re-M,qe=xe-D;if(!(Be*Be+qe*qe>k*k))return;J()}if(!E()||!V){ce(Oe);return}const Se=w();U=Pl(Oe,Q),j=ZAe(eb(U,Se,!1,[1,1]),n,c,V),B||($(),B=!0);const je=Ute(Oe,{handle:j,connectionMode:t,fromNodeId:r,fromHandleId:i,fromType:a?"target":"source",isValidConnection:O,doc:A,lib:u,flowId:f,nodeLookup:c});G=je.handleDomNode,P=je.connection,q=KAe(!!j,je.isValid);const ve=c.get(r),be=ve?Ep(ve,V,wt.Left,!0):Te.from,ae={...Te,from:be,isValid:q,to:je.toHandle&&q?g0({x:je.toHandle.x,y:je.toHandle.y},Se):U,toHandle:je.toHandle,toPosition:q&&je.toHandle?je.toHandle.position:Y9[V.position],toNode:je.toHandle?c.get(je.toHandle.nodeId):null,pointer:U};x(ae),Te=ae}function ce(Oe){if(!("touches"in Oe&&Oe.touches.length>0)){if(C){(j||G)&&P&&q&&(b==null||b(P));const{inProgress:Se,...je}=Te,ve={...je,toPosition:Te.toHandle?Te.toPosition:null};y==null||y(Oe,ve),s&&(v==null||v(Oe,ve))}p(),cancelAnimationFrame(N),B=!1,q=!1,P=null,G=null,A.removeEventListener("mousemove",ne),A.removeEventListener("mouseup",ce),A.removeEventListener("touchmove",ne),A.removeEventListener("touchend",ce)}}A.addEventListener("mousemove",ne),A.addEventListener("mouseup",ce),A.addEventListener("touchmove",ne),A.addEventListener("touchend",ce)}function Ute(e,{handle:t,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:s,doc:a,lib:o,flowId:c,isValidConnection:u=Bte,nodeLookup:d}){const f=s==="target",h=t?a.querySelector(`.${o}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:g}=Pl(e),b=a.elementFromPoint(p,g),y=b!=null&&b.classList.contains(`${o}-flow__handle`)?b:h,O={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const v=Qte(void 0,y),x=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),E=y.classList.contains("connectable"),S=y.classList.contains("connectableend");if(!x||!v)return O;const k={source:f?x:i,sourceHandle:f?w:r,target:f?i:x,targetHandle:f?r:w};O.connection=k;const A=E&&S&&(n===h0.Strict?f&&v==="source"||!f&&v==="target":x!==i||w!==r);O.isValid=A&&u(k),O.toHandle=$te(x,v,w,d,n,!0)}return O}const NP={onPointerDown:JAe,isValid:Ute};function eNe({domNode:e,panZoom:t,getTransform:n,getViewScale:i}){const r=go(e);function s({translateExtent:o,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const g=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const w=n(),E=x.sourceEvent.ctrlKey&&xx()?10:1,S=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*d,k=w[2]*Math.pow(2,S*E);t.scaleTo(k)};let b=[0,0];const y=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(b=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},O=x=>{const w=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const E=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],S=[E[0]-b[0],E[1]-b[1]];b=E;const k=i()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),T={x:w[0]-S[0]*k,y:w[1]-S[1]*k},A=[[0,0],[c,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},A,o)},v=gte().on("start",y).on("zoom",f?O:null).on("zoom.wheel",h?g:null);r.call(v,{})}function a(){r.on("zoom",null)}return{update:s,destroy:a,pointer:Al}}const P_=e=>({x:e.x,y:e.y,zoom:e.k}),KN=({x:e,y:t,zoom:n})=>j_.translate(e,t).scale(n),lg=(e,t)=>e.target.closest(`.${t}`),zte=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),tNe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,JN=(e,t=0,n=tNe,i=()=>{})=>{const r=typeof t=="number"&&t>0;return r||i(),r?e.transition().duration(t).ease(n).on("end",i):e},Fte=e=>{const t=e.ctrlKey&&xx()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function nNe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:i,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:o,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(lg(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const y=Al(d),O=Fte(d),v=f*Math.pow(2,O);i.scaleTo(n,v,y,d);return}const h=d.deltaMode===1?20:1;let p=r===op.Vertical?0:d.deltaX*h,g=r===op.Horizontal?0:d.deltaY*h;!xx()&&d.shiftKey&&r!==op.Vertical&&(p=d.deltaY*h,g=0),i.translateBy(n,-(p/f)*s,-(g/f)*s,{internal:!0});const b=P_(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,o==null||o(d,b))}}function iNe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(i,r){const s=i.type==="wheel",a=!t&&s&&!i.ctrlKey,o=lg(i,e);if(i.ctrlKey&&s&&o&&i.preventDefault(),a||o)return null;i.preventDefault(),n.call(this,i,r)}}function rNe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return i=>{var s,a,o;if((s=i.sourceEvent)!=null&&s.internal)return;const r=P_(i.transform);e.mouseButton=((a=i.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=r,((o=i.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(i.sourceEvent,r))}}function sNe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:i,onPanZoom:r}){return s=>{var a,o;e.usedRightMouseButton=!!(n&&zte(t,e.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||i([s.transform.x,s.transform.y,s.transform.k]),r&&!((o=s.sourceEvent)!=null&&o.internal)&&(r==null||r(s.sourceEvent,P_(s.transform)))}}function aNe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:i,onPanZoomEnd:r,onPaneContextMenu:s}){return a=>{var o;if(!((o=a.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,s&&zte(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,i(!1),r)){const c=P_(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(a.sourceEvent,c)},n?150:0)}}}function oNe({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:i,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:o,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var y;const h=e||t,p=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(lg(f,`${u}-flow__node`)||lg(f,`${u}-flow__edge`)))return!0;if(!i&&!h&&!r&&!s&&!n||a||d&&!g||lg(f,o)&&g||lg(f,c)&&(!g||r&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((y=f.touches)==null?void 0:y.length)>1)return f.preventDefault(),!1;if(!h&&!r&&!p&&g||!i&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(i)&&!i.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&b}}function lNe({domNode:e,minZoom:t,maxZoom:n,translateExtent:i,viewport:r,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:o,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=gte().scaleExtent([t,n]).translateExtent(i),h=go(e).call(f);v({x:r.x,y:r.y,zoom:p0(r.zoom,t,n)},[[0,0],[d.width,d.height]],i);const p=h.on("wheel.zoom"),g=h.on("dblclick.zoom");f.wheelDelta(Fte);async function b(j,M){return h?new Promise(D=>{f==null||f.interpolate((M==null?void 0:M.interpolate)==="linear"?yy:YS).transform(JN(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>D(!0)),j)}):!1}function y({noWheelClassName:j,noPanClassName:M,onPaneContextMenu:D,userSelectionActive:L,panOnScroll:Q,panOnDrag:C,panOnScrollMode:I,panOnScrollSpeed:U,preventScrolling:B,zoomOnPinch:P,zoomOnScroll:q,zoomOnDoubleClick:G,zoomActivationKeyPressed:$,lib:V,onTransformChange:te,connectionInProgress:fe,paneClickDistance:Te,selectionOnDrag:J}){L&&!u.isZoomingOrPanning&&O();const ne=Q&&!$&&!L;f.clickDistance(J?1/0:!Il(Te)||Te<0?0:Te);const ce=ne?nNe({zoomPanValues:u,noWheelClassName:j,d3Selection:h,d3Zoom:f,panOnScrollMode:I,panOnScrollSpeed:U,zoomOnPinch:P,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:o}):iNe({noWheelClassName:j,preventScrolling:B,d3ZoomHandler:p});h.on("wheel.zoom",ce,{passive:!1});const Oe=rNe({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",Oe);const Se=sNe({zoomPanValues:u,panOnDrag:C,onPaneContextMenu:!!D,onPanZoom:s,onTransformChange:te});f.on("zoom",Se);const je=aNe({zoomPanValues:u,panOnDrag:C,panOnScroll:Q,onPaneContextMenu:D,onPanZoomEnd:o,onDraggingChange:c});f.on("end",je);const ve=oNe({zoomActivationKeyPressed:$,panOnDrag:C,zoomOnScroll:q,panOnScroll:Q,zoomOnDoubleClick:G,zoomOnPinch:P,userSelectionActive:L,noPanClassName:M,noWheelClassName:j,lib:V,connectionInProgress:fe});f.filter(ve),G?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function O(){f.on("zoom",null)}async function v(j,M,D){const L=KN(j),Q=f==null?void 0:f.constrain()(L,M,D);return Q&&await b(Q),Q}async function x(j,M){const D=KN(j);return await b(D,M),D}function w(j){if(h){const M=KN(j),D=h.property("__zoom");(D.k!==j.zoom||D.x!==j.x||D.y!==j.y)&&(f==null||f.transform(h,M,null,{sync:!0}))}}function E(){const j=h?mte(h.node()):{x:0,y:0,k:1};return{x:j.x,y:j.y,zoom:j.k}}async function S(j,M){return h?new Promise(D=>{f==null||f.interpolate((M==null?void 0:M.interpolate)==="linear"?yy:YS).scaleTo(JN(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>D(!0)),j)}):!1}async function k(j,M){return h?new Promise(D=>{f==null||f.interpolate((M==null?void 0:M.interpolate)==="linear"?yy:YS).scaleBy(JN(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>D(!0)),j)}):!1}function T(j){f==null||f.scaleExtent(j)}function A(j){f==null||f.translateExtent(j)}function N(j){const M=!Il(j)||j<0?0:j;f==null||f.clickDistance(M)}return{update:y,destroy:O,setViewport:x,setViewportConstrained:v,getViewport:E,scaleTo:S,scaleBy:k,setScaleExtent:T,setTranslateExtent:A,syncViewport:w,setClickDistance:N}}var b0;(function(e){e.Line="line",e.Handle="handle"})(b0||(b0={}));function cNe({width:e,prevWidth:t,height:n,prevHeight:i,affectsX:r,affectsY:s}){const a=e-t,o=n-i,c=[a>0?1:a<0?-1:0,o>0?1:o<0?-1:0];return a&&r&&(c[0]=c[0]*-1),o&&s&&(c[1]=c[1]*-1),c}function oU(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),i=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:i,affectsY:r}}function Pd(e,t){return Math.max(0,t-e)}function Md(e,t){return Math.max(0,e-t)}function mw(e,t,n){return Math.max(0,t-e,e-n)}function lU(e,t){return e?!t:t}function uNe(e,t,n,i,r,s,a,o){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:g}=n,{minWidth:b,maxWidth:y,minHeight:O,maxHeight:v}=i,{x,y:w,width:E,height:S,aspectRatio:k}=e;let T=Math.floor(d?p-e.pointerX:0),A=Math.floor(f?g-e.pointerY:0);const N=E+(c?-T:T),j=S+(u?-A:A),M=-s[0]*E,D=-s[1]*S;let L=mw(N,b,y),Q=mw(j,O,v);if(a){let U=0,B=0;c&&T<0?U=Pd(x+T+M,a[0][0]):!c&&T>0&&(U=Md(x+N+M,a[1][0])),u&&A<0?B=Pd(w+A+D,a[0][1]):!u&&A>0&&(B=Md(w+j+D,a[1][1])),L=Math.max(L,U),Q=Math.max(Q,B)}if(o){let U=0,B=0;c&&T>0?U=Md(x+T,o[0][0]):!c&&T<0&&(U=Pd(x+N,o[1][0])),u&&A>0?B=Md(w+A,o[0][1]):!u&&A<0&&(B=Pd(w+j,o[1][1])),L=Math.max(L,U),Q=Math.max(Q,B)}if(r){if(d){const U=mw(N/k,O,v)*k;if(L=Math.max(L,U),a){let B=0;!c&&!u||c&&!u&&h?B=Md(w+D+N/k,a[1][1])*k:B=Pd(w+D+(c?T:-T)/k,a[0][1])*k,L=Math.max(L,B)}if(o){let B=0;!c&&!u||c&&!u&&h?B=Pd(w+N/k,o[1][1])*k:B=Md(w+(c?T:-T)/k,o[0][1])*k,L=Math.max(L,B)}}if(f){const U=mw(j*k,b,y)/k;if(Q=Math.max(Q,U),a){let B=0;!c&&!u||u&&!c&&h?B=Md(x+j*k+M,a[1][0])/k:B=Pd(x+(u?A:-A)*k+M,a[0][0])/k,Q=Math.max(Q,B)}if(o){let B=0;!c&&!u||u&&!c&&h?B=Pd(x+j*k,o[1][0])/k:B=Md(x+(u?A:-A)*k,o[0][0])/k,Q=Math.max(Q,B)}}}A=A+(A<0?Q:-Q),T=T+(T<0?L:-L),r&&(h?N>j*k?A=(lU(c,u)?-T:T)/k:T=(lU(c,u)?-A:A)*k:d?(A=T/k,u=c):(T=A*k,c=u));const C=c?x+T:x,I=u?w+A:w;return{width:E+(c?-T:T),height:S+(u?-A:A),x:s[0]*T*(c?-1:1)+C,y:s[1]*A*(u?-1:1)+I}}const Vte={width:0,height:0,x:0,y:0},dNe={...Vte,pointerX:0,pointerY:0,aspectRatio:1};function fNe(e,t,n){const i=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,o=n[0]*s,c=n[1]*a;return[[i-o,r-c],[i+s-o,r+a-c]]}function hNe({domNode:e,nodeId:t,getStoreItems:n,onChange:i,onEnd:r}){const s=go(e);let a={controlDirection:oU("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:g,onResizeEnd:b,shouldResize:y}){let O={...Vte},v={...dNe};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:oU(u)};let x,w=null,E=[],S,k,T,A=!1;const N=tte().on("start",j=>{const{nodeLookup:M,transform:D,snapGrid:L,snapToGrid:Q,nodeOrigin:C,paneDomNode:I}=n();if(x=M.get(t),!x)return;w=(I==null?void 0:I.getBoundingClientRect())??null;const{xSnapped:U,ySnapped:B}=xy(j.sourceEvent,{transform:D,snapGrid:L,snapToGrid:Q,containerBounds:w});O={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},v={...O,pointerX:U,pointerY:B,aspectRatio:O.width/O.height},S=void 0,k=Sp(x.extent)?x.extent:void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(S=M.get(x.parentId)),S&&x.extent==="parent"&&(k=[[0,0],[S.measured.width,S.measured.height]]),E=[],T=void 0;for(const[P,q]of M)if(q.parentId===t&&(E.push({id:P,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const G=fNe(q,x,q.origin??C);T?T=[[Math.min(G[0][0],T[0][0]),Math.min(G[0][1],T[0][1])],[Math.max(G[1][0],T[1][0]),Math.max(G[1][1],T[1][1])]]:T=G}p==null||p(j,{...O})}).on("drag",j=>{const{transform:M,snapGrid:D,snapToGrid:L,nodeOrigin:Q}=n(),C=xy(j.sourceEvent,{transform:M,snapGrid:D,snapToGrid:L,containerBounds:w}),I=[];if(!x)return;const{x:U,y:B,width:P,height:q}=O,G={},$=x.origin??Q,{width:V,height:te,x:fe,y:Te}=uNe(v,a.controlDirection,C,a.boundaries,a.keepAspectRatio,$,k,T),J=V!==P,ne=te!==q,ce=fe!==U&&J,Oe=Te!==B&≠if(!ce&&!Oe&&!J&&!ne)return;if((ce||Oe||$[0]===1||$[1]===1)&&(G.x=ce?fe:O.x,G.y=Oe?Te:O.y,O.x=G.x,O.y=G.y,E.length>0)){const be=fe-U,ae=Te-B;for(const Re of E)Re.position={x:Re.position.x-be+$[0]*(V-P),y:Re.position.y-ae+$[1]*(te-q)},I.push(Re)}if((J||ne)&&(G.width=J&&(!a.resizeDirection||a.resizeDirection==="horizontal")?V:O.width,G.height=ne&&(!a.resizeDirection||a.resizeDirection==="vertical")?te:O.height,O.width=G.width,O.height=G.height),S&&x.expandParent){const be=$[0]*(G.width??0);G.x&&G.x{A&&(b==null||b(j,{...O}),r==null||r({...O}),A=!1)});s.call(N)}function c(){s.on(".drag",null)}return{update:o,destroy:c}}var Xte={exports:{}},qte={},Hte={exports:{}},Yte={};/** * @license React * use-sync-external-store-shim.production.js * @@ -430,7 +430,7 @@ ${u}`:c,children:[l.jsxs("span",{className:`account-avatar${p?" has-image":""}`, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var O0=m;function fNe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var hNe=typeof Object.is=="function"?Object.is:fNe,pNe=O0.useState,mNe=O0.useEffect,gNe=O0.useLayoutEffect,bNe=O0.useDebugValue;function ONe(e,t){var n=t(),i=pNe({inst:{value:n,getSnapshot:t}}),r=i[0].inst,s=i[1];return gNe(function(){r.value=n,r.getSnapshot=t,eC(r)&&s({inst:r})},[e,n,t]),mNe(function(){return eC(r)&&s({inst:r}),e(function(){eC(r)&&s({inst:r})})},[e]),bNe(n),n}function eC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!hNe(e,n)}catch{return!0}}function yNe(e,t){return t()}var xNe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?yNe:ONe;Hte.useSyncExternalStore=O0.useSyncExternalStore!==void 0?O0.useSyncExternalStore:xNe;qte.exports=Hte;var vNe=qte.exports;/** + */var O0=m;function pNe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var mNe=typeof Object.is=="function"?Object.is:pNe,gNe=O0.useState,bNe=O0.useEffect,ONe=O0.useLayoutEffect,yNe=O0.useDebugValue;function xNe(e,t){var n=t(),i=gNe({inst:{value:n,getSnapshot:t}}),r=i[0].inst,s=i[1];return ONe(function(){r.value=n,r.getSnapshot=t,eC(r)&&s({inst:r})},[e,n,t]),bNe(function(){return eC(r)&&s({inst:r}),e(function(){eC(r)&&s({inst:r})})},[e]),yNe(n),n}function eC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!mNe(e,n)}catch{return!0}}function vNe(e,t){return t()}var wNe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?vNe:xNe;Yte.useSyncExternalStore=O0.useSyncExternalStore!==void 0?O0.useSyncExternalStore:wNe;Hte.exports=Yte;var SNe=Hte.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -438,26 +438,26 @@ ${u}`:c,children:[l.jsxs("span",{className:`account-avatar${p?" has-image":""}`, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var M_=m,wNe=vNe;function SNe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ENe=typeof Object.is=="function"?Object.is:SNe,kNe=wNe.useSyncExternalStore,TNe=M_.useRef,_Ne=M_.useEffect,ANe=M_.useMemo,NNe=M_.useDebugValue;Xte.useSyncExternalStoreWithSelector=function(e,t,n,i,r){var s=TNe(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=ANe(function(){function c(p){if(!u){if(u=!0,d=p,p=i(p),r!==void 0&&a.hasValue){var g=a.value;if(r(g,p))return f=g}return f=p}if(g=f,ENe(d,p))return g;var b=i(p);return r!==void 0&&r(g,b)?(d=p,g):(d=p,f=b)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,i,r]);var o=kNe(e,s[0],s[1]);return _Ne(function(){a.hasValue=!0,a.value=o},[o]),NNe(o),o};Vte.exports=Xte;var CNe=Vte.exports;const jNe=$0(CNe),RNe={},cU=e=>{let t;const n=new Set,i=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,p))}},r=()=>t,c={setState:i,getState:r,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(RNe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(i,r,c);return c},INe=e=>e?cU(e):cU,{useDebugValue:PNe}=xn,{useSyncExternalStoreWithSelector:MNe}=jNe,LNe=e=>e;function Yte(e,t=LNe,n){const i=MNe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return PNe(i),i}const uU=(e,t)=>{const n=INe(e),i=(r,s=t)=>Yte(n,r,s);return Object.assign(i,n),i},DNe=(e,t)=>e?uU(e,t):uU;function ur(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[i,r]of e)if(!Object.is(r,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}const L_=m.createContext(null),$Ne=L_.Provider,Gte=Bl.error001("react");function zn(e,t){const n=m.useContext(L_);if(n===null)throw new Error(Gte);return Yte(n,e,t)}function dr(){const e=m.useContext(L_);if(e===null)throw new Error(Gte);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const dU={display:"none"},QNe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Wte="react-flow__node-desc",Zte="react-flow__edge-desc",BNe="react-flow__aria-live",UNe=e=>e.ariaLiveMessage,zNe=e=>e.ariaLabelConfig;function FNe({rfId:e}){const t=zn(UNe);return l.jsx("div",{id:`${BNe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:QNe,children:t})}function VNe({rfId:e,disableKeyboardA11y:t}){const n=zn(zNe);return l.jsxs(l.Fragment,{children:[l.jsx("div",{id:`${Wte}-${e}`,style:dU,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),l.jsx("div",{id:`${Zte}-${e}`,style:dU,children:n["edge.a11yDescription.default"]}),!t&&l.jsx(FNe,{rfId:e})]})}const D_=m.forwardRef(({position:e="top-left",children:t,className:n,style:i,...r},s)=>{const a=`${e}`.split("-");return l.jsx("div",{className:Kr(["react-flow__panel",n,...a]),style:i,ref:s,...r,children:t})});D_.displayName="Panel";function XNe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:l.jsx(D_,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:l.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const qNe=e=>{const t=[],n=[];for(const[,i]of e.nodeLookup)i.selected&&t.push(i.internals.userNode);for(const[,i]of e.edgeLookup)i.selected&&n.push(i);return{selectedNodes:t,selectedEdges:n}},gw=e=>e.id;function HNe(e,t){return ur(e.selectedNodes.map(gw),t.selectedNodes.map(gw))&&ur(e.selectedEdges.map(gw),t.selectedEdges.map(gw))}function YNe({onSelectionChange:e}){const t=dr(),{selectedNodes:n,selectedEdges:i}=zn(qNe,HNe);return m.useEffect(()=>{const r={nodes:n,edges:i};e==null||e(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,i,e]),null}const GNe=e=>!!e.onSelectionChangeHandlers;function WNe({onSelectionChange:e}){const t=zn(GNe);return e||t?l.jsx(YNe,{onSelectionChange:e}):null}const Kte=[0,0],ZNe={x:0,y:0,zoom:1},KNe=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],fU=[...KNe,"rfId"],JNe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),hU={translateExtent:gx,nodeOrigin:Kte,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function eCe(e){const{setNodes:t,setEdges:n,setMinZoom:i,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:a,reset:o,setDefaultNodesAndEdges:c}=zn(JNe,ur),u=dr();m.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=hU,o()}),[]);const d=m.useRef(hU);return m.useEffect(()=>{for(const f of fU){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?i(h):f==="maxZoom"?r(h):f==="translateExtent"?s(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:EAe(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},fU.map(f=>e[f])),null}function pU(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function tCe(e){var i;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const r=pU(),s=()=>n(r!=null&&r.matches?"dark":"light");return s(),r==null||r.addEventListener("change",s),()=>{r==null||r.removeEventListener("change",s)}},[e]),t!==null?t:(i=pU())!=null&&i.matches?"dark":"light"}const mU=typeof document<"u"?document:null;function vx(e=null,t={target:mU,actInsideInputWithModifier:!0}){const[n,i]=m.useState(!1),r=m.useRef(!1),s=m.useRef(new Set([])),[a,o]=m.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` + */var M_=m,ENe=SNe;function kNe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var TNe=typeof Object.is=="function"?Object.is:kNe,_Ne=ENe.useSyncExternalStore,ANe=M_.useRef,NNe=M_.useEffect,CNe=M_.useMemo,jNe=M_.useDebugValue;qte.useSyncExternalStoreWithSelector=function(e,t,n,i,r){var s=ANe(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=CNe(function(){function c(p){if(!u){if(u=!0,d=p,p=i(p),r!==void 0&&a.hasValue){var g=a.value;if(r(g,p))return f=g}return f=p}if(g=f,TNe(d,p))return g;var b=i(p);return r!==void 0&&r(g,b)?(d=p,g):(d=p,f=b)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,i,r]);var o=_Ne(e,s[0],s[1]);return NNe(function(){a.hasValue=!0,a.value=o},[o]),jNe(o),o};Xte.exports=qte;var RNe=Xte.exports;const INe=$0(RNe),PNe={},cU=e=>{let t;const n=new Set,i=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,p))}},r=()=>t,c={setState:i,getState:r,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(PNe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(i,r,c);return c},MNe=e=>e?cU(e):cU,{useDebugValue:LNe}=xn,{useSyncExternalStoreWithSelector:DNe}=INe,$Ne=e=>e;function Gte(e,t=$Ne,n){const i=DNe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return LNe(i),i}const uU=(e,t)=>{const n=MNe(e),i=(r,s=t)=>Gte(n,r,s);return Object.assign(i,n),i},QNe=(e,t)=>e?uU(e,t):uU;function ur(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[i,r]of e)if(!Object.is(r,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}const L_=m.createContext(null),BNe=L_.Provider,Wte=Bl.error001("react");function zn(e,t){const n=m.useContext(L_);if(n===null)throw new Error(Wte);return Gte(n,e,t)}function dr(){const e=m.useContext(L_);if(e===null)throw new Error(Wte);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const dU={display:"none"},UNe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Zte="react-flow__node-desc",Kte="react-flow__edge-desc",zNe="react-flow__aria-live",FNe=e=>e.ariaLiveMessage,VNe=e=>e.ariaLabelConfig;function XNe({rfId:e}){const t=zn(FNe);return l.jsx("div",{id:`${zNe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:UNe,children:t})}function qNe({rfId:e,disableKeyboardA11y:t}){const n=zn(VNe);return l.jsxs(l.Fragment,{children:[l.jsx("div",{id:`${Zte}-${e}`,style:dU,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),l.jsx("div",{id:`${Kte}-${e}`,style:dU,children:n["edge.a11yDescription.default"]}),!t&&l.jsx(XNe,{rfId:e})]})}const D_=m.forwardRef(({position:e="top-left",children:t,className:n,style:i,...r},s)=>{const a=`${e}`.split("-");return l.jsx("div",{className:Kr(["react-flow__panel",n,...a]),style:i,ref:s,...r,children:t})});D_.displayName="Panel";function HNe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:l.jsx(D_,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:l.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const YNe=e=>{const t=[],n=[];for(const[,i]of e.nodeLookup)i.selected&&t.push(i.internals.userNode);for(const[,i]of e.edgeLookup)i.selected&&n.push(i);return{selectedNodes:t,selectedEdges:n}},gw=e=>e.id;function GNe(e,t){return ur(e.selectedNodes.map(gw),t.selectedNodes.map(gw))&&ur(e.selectedEdges.map(gw),t.selectedEdges.map(gw))}function WNe({onSelectionChange:e}){const t=dr(),{selectedNodes:n,selectedEdges:i}=zn(YNe,GNe);return m.useEffect(()=>{const r={nodes:n,edges:i};e==null||e(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,i,e]),null}const ZNe=e=>!!e.onSelectionChangeHandlers;function KNe({onSelectionChange:e}){const t=zn(ZNe);return e||t?l.jsx(WNe,{onSelectionChange:e}):null}const Jte=[0,0],JNe={x:0,y:0,zoom:1},eCe=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],fU=[...eCe,"rfId"],tCe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),hU={translateExtent:gx,nodeOrigin:Jte,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function nCe(e){const{setNodes:t,setEdges:n,setMinZoom:i,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:a,reset:o,setDefaultNodesAndEdges:c}=zn(tCe,ur),u=dr();m.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=hU,o()}),[]);const d=m.useRef(hU);return m.useEffect(()=>{for(const f of fU){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?i(h):f==="maxZoom"?r(h):f==="translateExtent"?s(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:TAe(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},fU.map(f=>e[f])),null}function pU(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function iCe(e){var i;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const r=pU(),s=()=>n(r!=null&&r.matches?"dark":"light");return s(),r==null||r.addEventListener("change",s),()=>{r==null||r.removeEventListener("change",s)}},[e]),t!==null?t:(i=pU())!=null&&i.matches?"dark":"light"}const mU=typeof document<"u"?document:null;function vx(e=null,t={target:mU,actInsideInputWithModifier:!0}){const[n,i]=m.useState(!1),r=m.useRef(!1),s=m.useRef(new Set([])),[a,o]=m.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` `).replace(` `,` +`).split(` -`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??mU,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var y,O;if(r.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!r.current||r.current&&!u)&&_te(p))return!1;const b=bU(p.code,o);if(s.current.add(p[b]),gU(a,s.current,!1)){const v=((O=(y=p.composedPath)==null?void 0:y.call(p))==null?void 0:O[0])||p.target,x=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(r.current||!x)&&p.preventDefault(),i(!0)}},f=p=>{const g=bU(p.code,o);gU(a,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(p[g]),p.key==="Meta"&&s.current.clear(),r.current=!1},h=()=>{s.current.clear(),i(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,i]),n}function gU(e,t,n){return e.filter(i=>n||i.length===t.size).some(i=>i.every(r=>t.has(r)))}function bU(e,t){return t.includes(e)?"code":"key"}const nCe=()=>{const e=dr();return m.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[i,r,s],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??i,y:t.y??r,zoom:t.zoom??s},n),!0):!1},getViewport:()=>{const[t,n,i]=e.getState().transform;return{x:t,y:n,zoom:i}},setCenter:async(t,n,i)=>e.getState().setCenter(t,n,i),fitBounds:async(t,n)=>{const{width:i,height:r,minZoom:s,maxZoom:a,panZoom:o}=e.getState(),c=y$(t,i,r,s,a,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:i,snapGrid:r,snapToGrid:s,domNode:a}=e.getState();if(!a)return t;const{x:o,y:c}=a.getBoundingClientRect(),u={x:t.x-o,y:t.y-c},d=n.snapGrid??r,f=n.snapToGrid??s;return eb(u,i,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:r,y:s}=i.getBoundingClientRect(),a=g0(t,n);return{x:a.x+r,y:a.y+s}}}),[])};function Jte(e,t){const n=[],i=new Map,r=[];for(const s of e)if(s.type==="add"){r.push(s);continue}else if(s.type==="remove"||s.type==="replace")i.set(s.id,[s]);else{const a=i.get(s.id);a?a.push(s):i.set(s.id,[s])}for(const s of t){const a=i.get(s.id);if(!a){n.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const o={...s};for(const c of a)iCe(c,o);n.push(o)}return r.length&&r.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function iCe(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function ene(e,t){return Jte(e,t)}function tne(e,t){return Jte(e,t)}function Rh(e,t){return{id:e,type:"select",selected:t}}function cg(e,t=new Set,n=!1){const i=[];for(const[r,s]of e){const a=t.has(r);!(s.selected===void 0&&!a)&&s.selected!==a&&(n&&(s.selected=a),i.push(Rh(s.id,a)))}return i}function OU({items:e=[],lookup:t}){var r;const n=[],i=new Map(e.map(s=>[s.id,s]));for(const[s,a]of e.entries()){const o=t.get(a.id),c=((r=o==null?void 0:o.internals)==null?void 0:r.userNode)??o;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of t)i.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function yU(e){return{id:e.id,type:"remove"}}const rCe=Ete();function sCe(e,t,n={}){return CAe(e,t,{...n,onError:n.onError??rCe})}const xU=e=>mAe(e),aCe=e=>xte(e);function nne(e){return m.forwardRef(e)}const oCe=typeof window<"u"?m.useLayoutEffect:m.useEffect;function vU(e){const[t,n]=m.useState(BigInt(0)),[i]=m.useState(()=>lCe(()=>n(r=>r+BigInt(1))));return oCe(()=>{const r=i.get();r.length&&(e(r),i.reset())},[t]),i}function lCe(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const ine=m.createContext(null);function cCe({children:e}){const t=dr(),n=m.useCallback(o=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:g}=t.getState();let b=c;for(const O of o)b=typeof O=="function"?O(b):O;let y=OU({items:b,lookup:h});for(const O of g.values())y=O(y);d&&u(b),y.length>0?f==null||f(y):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:O,nodes:v,setNodes:x}=t.getState();O&&x(v)})},[]),i=vU(n),r=m.useCallback(o=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const g of o)p=typeof g=="function"?g(p):g;d?u(p):f&&f(OU({items:p,lookup:h}))},[]),s=vU(r),a=m.useMemo(()=>({nodeQueue:i,edgeQueue:s}),[]);return l.jsx(ine.Provider,{value:a,children:e})}function uCe(){const e=m.useContext(ine);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const dCe=e=>!!e.panZoom;function $_(){const e=nCe(),t=dr(),n=uCe(),i=zn(dCe),r=m.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},o=f=>{n.edgeQueue.push(f)},c=f=>{var O,v;const{nodeLookup:h,nodeOrigin:p}=t.getState(),g=xU(f)?f:h.get(f.id),b=g.parentId?kte(g.position,g.measured,g.parentId,h,p):g.position,y={...g,position:b,width:((O=g.measured)==null?void 0:O.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return m0(y)},u=(f,h,p={replace:!1})=>{a(g=>g.map(b=>{if(b.id===f){const y=typeof h=="function"?h(b):h;return p.replace&&xU(y)?y:{...b,...y}}return b}))},d=(f,h,p={replace:!1})=>{o(g=>g.map(b=>{if(b.id===f){const y=typeof h=="function"?h(b):h;return p.replace&&aCe(y)?y:{...b,...y}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=s(f))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:o,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[g,b,y]=p;return{nodes:f.map(O=>({...O})),edges:h.map(O=>({...O})),viewport:{x:g,y:b,zoom:y}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:g,onNodesDelete:b,onEdgesDelete:y,triggerNodeChanges:O,triggerEdgeChanges:v,onDelete:x,onBeforeDelete:w}=t.getState(),{nodes:E,edges:S}=await xAe({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:g,onBeforeDelete:w}),k=S.length>0,T=E.length>0;if(k){const A=S.map(yU);y==null||y(S),v(A)}if(T){const A=E.map(yU);b==null||b(E),O(A)}return(T||k)&&(x==null||x({nodes:E,edges:S})),{deletedNodes:E,deletedEdges:S}},getIntersectingNodes:(f,h=!0,p)=>{const g=W9(f),b=g?f:c(f),y=p!==void 0;return b?(p||t.getState().nodes).filter(O=>{const v=t.getState().nodeLookup.get(O.id);if(v&&!g&&(O.id===f.id||!v.internals.positionAbsolute))return!1;const x=m0(y?O:v),w=yx(x,b);return h&&w>0||w>=x.width*x.height||w>=b.width*b.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const b=W9(f)?f:c(f);if(!b)return!1;const y=yx(b,h);return p&&y>0||y>=h.width*h.height||y>=b.width*b.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,g=>{const b=typeof h=="function"?h(g):h;return p.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,g=>{const b=typeof h=="function"?h(g):h;return p.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return gAe(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:g.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??SAe();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return m.useMemo(()=>({...r,...e,viewportInitialized:i}),[i])}const wU=e=>e.selected,fCe=typeof window<"u"?window:void 0;function hCe({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=dr(),{deleteElements:i}=$_(),r=vx(e,{actInsideInputWithModifier:!1}),s=vx(t,{target:fCe});m.useEffect(()=>{if(r){const{edges:a,nodes:o}=n.getState();i({nodes:o.filter(wU),edges:a.filter(wU)}),n.setState({nodesSelectionActive:!1})}},[r]),m.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function pCe(e){const t=dr();m.useEffect(()=>{const n=()=>{var r,s,a,o;if(!e.current||!(((s=(r=e.current).checkVisibility)==null?void 0:s.call(r))??!0))return!1;const i=v$(e.current);(i.height===0||i.width===0)&&((o=(a=t.getState()).onError)==null||o.call(a,"004",Bl.error004())),t.setState({width:i.width||500,height:i.height||500})};if(e.current){n(),window.addEventListener("resize",n);const i=new ResizeObserver(()=>n());return i.observe(e.current),()=>{window.removeEventListener("resize",n),i&&e.current&&i.unobserve(e.current)}}},[])}const Q_={position:"absolute",width:"100%",height:"100%",top:0,left:0},mCe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function gCe({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=op.Free,zoomOnDoubleClick:a=!0,panOnDrag:o=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:g,noWheelClassName:b,noPanClassName:y,onViewportChange:O,isControlledViewport:v,paneClickDistance:x,selectionOnDrag:w}){const E=dr(),S=m.useRef(null),{userSelectionActive:k,lib:T,connectionInProgress:A}=zn(mCe,ur),N=vx(h),j=m.useRef();pCe(S);const M=m.useCallback(D=>{O==null||O({x:D[0],y:D[1],zoom:D[2]}),v||E.setState({transform:D})},[O,v]);return m.useEffect(()=>{if(S.current){j.current=aNe({domNode:S.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:C=>E.setState(I=>I.paneDragging===C?I:{paneDragging:C}),onPanZoomStart:(C,I)=>{const{onViewportChangeStart:U,onMoveStart:B}=E.getState();B==null||B(C,I),U==null||U(I)},onPanZoom:(C,I)=>{const{onViewportChange:U,onMove:B}=E.getState();B==null||B(C,I),U==null||U(I)},onPanZoomEnd:(C,I)=>{const{onViewportChangeEnd:U,onMoveEnd:B}=E.getState();B==null||B(C,I),U==null||U(I)}});const{x:D,y:L,zoom:Q}=j.current.getViewport();return E.setState({panZoom:j.current,transform:[D,L,Q],domNode:S.current.closest(".react-flow")}),()=>{var C;(C=j.current)==null||C.destroy()}}},[]),m.useEffect(()=>{var D;(D=j.current)==null||D.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:o,zoomActivationKeyPressed:N,preventScrolling:p,noPanClassName:y,userSelectionActive:k,noWheelClassName:b,lib:T,onTransformChange:M,connectionInProgress:A,selectionOnDrag:w,paneClickDistance:x})},[e,t,n,i,r,s,a,o,N,p,y,k,b,T,M,A,w,x]),l.jsx("div",{className:"react-flow__renderer",ref:S,style:Q_,children:g})}const bCe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function OCe(){const{userSelectionActive:e,userSelectionRect:t}=zn(bCe,ur);return e&&t?l.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const tC=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},yCe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function xCe({isSelecting:e,selectionKeyPressed:t,selectionMode:n=bx.Full,panOnDrag:i,autoPanOnSelection:r,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:g,children:b}){const y=m.useRef(0),O=dr(),{userSelectionActive:v,elementsSelectable:x,dragging:w,connectionInProgress:E,panBy:S,autoPanSpeed:k}=zn(yCe,ur),T=x&&(e||v),A=m.useRef(null),N=m.useRef(),j=m.useRef(new Set),M=m.useRef(new Set),D=m.useRef(!1),L=m.useRef({x:0,y:0}),Q=m.useRef(!1),C=J=>{if(D.current||E){D.current=!1;return}u==null||u(J),O.getState().resetSelectedElements(),O.setState({nodesSelectionActive:!1})},I=J=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){J.preventDefault();return}d==null||d(J)},U=f?J=>f(J):void 0,B=J=>{D.current&&(J.stopPropagation(),D.current=!1)},P=J=>{var Re,xe;const{domNode:ne,transform:ce}=O.getState();if(N.current=ne==null?void 0:ne.getBoundingClientRect(),!N.current)return;const Oe=J.target===A.current;if(!Oe&&!!J.target.closest(".nokey")||!e||!(a&&Oe||t)||J.button!==0||!J.isPrimary)return;(xe=(Re=J.target)==null?void 0:Re.setPointerCapture)==null||xe.call(Re,J.pointerId),D.current=!1;const{x:ve,y:be}=Pl(J.nativeEvent,N.current),ae=eb({x:ve,y:be},ce);O.setState({userSelectionRect:{width:0,height:0,startX:ae.x,startY:ae.y,x:ve,y:be}}),Oe||(J.stopPropagation(),J.preventDefault())};function q(J,ne){const{userSelectionRect:ce}=O.getState();if(!ce)return;const{transform:Oe,nodeLookup:Se,edgeLookup:je,connectionLookup:ve,triggerNodeChanges:be,triggerEdgeChanges:ae,defaultEdgeOptions:Re}=O.getState(),xe={x:ce.startX,y:ce.startY},{x:Be,y:qe}=g0(xe,Oe),Pe={startX:xe.x,startY:xe.y,x:J We.id)),M.current=new Set;const Dt=(Re==null?void 0:Re.selectable)??!0;for(const We of j.current){const W=ve.get(We);if(W)for(const{edgeId:ee}of W.values()){const se=je.get(ee);se&&(se.selectable??Dt)&&M.current.add(ee)}}if(!Z9(mt,j.current)){const We=cg(Se,j.current,!0);be(We)}if(!Z9(bt,M.current)){const We=cg(je,M.current);ae(We)}O.setState({userSelectionRect:Pe,userSelectionActive:!0,nodesSelectionActive:!1})}function G(){if(!r||!N.current)return;const[J,ne]=O$(L.current,N.current,k);S({x:J,y:ne}).then(ce=>{if(!D.current||!ce){y.current=requestAnimationFrame(G);return}const{x:Oe,y:Se}=L.current;q(Oe,Se),y.current=requestAnimationFrame(G)})}const $=()=>{cancelAnimationFrame(y.current),y.current=0,Q.current=!1};m.useEffect(()=>()=>$(),[]);const V=J=>{const{userSelectionRect:ne,transform:ce,resetSelectedElements:Oe}=O.getState();if(!N.current||!ne)return;const{x:Se,y:je}=Pl(J.nativeEvent,N.current);L.current={x:Se,y:je};const ve=g0({x:ne.startX,y:ne.startY},ce);if(!D.current){const be=t?0:s;if(Math.hypot(Se-ve.x,je-ve.y)<=be)return;Oe(),o==null||o(J)}D.current=!0,Q.current||(G(),Q.current=!0),q(Se,je)},te=J=>{var ne,ce;J.button===0&&((ce=(ne=J.target)==null?void 0:ne.releasePointerCapture)==null||ce.call(ne,J.pointerId),!v&&J.target===A.current&&O.getState().userSelectionRect&&(C==null||C(J)),O.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(c==null||c(J),O.setState({nodesSelectionActive:j.current.size>0})),$())},fe=J=>{var ne,ce;(ce=(ne=J.target)==null?void 0:ne.releasePointerCapture)==null||ce.call(ne,J.pointerId),$()},Te=i===!0||Array.isArray(i)&&i.includes(0);return l.jsxs("div",{className:Kr(["react-flow__pane",{draggable:Te,dragging:w,selection:e}]),onClick:T?void 0:tC(C,A),onContextMenu:tC(I,A),onWheel:tC(U,A),onPointerEnter:T?void 0:h,onPointerMove:T?V:p,onPointerUp:T?te:void 0,onPointerCancel:T?fe:void 0,onPointerDownCapture:T?P:void 0,onClickCapture:T?B:void 0,onPointerLeave:g,ref:A,style:Q_,children:[b,l.jsx(OCe,{})]})}function CP({id:e,store:t,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:o,onError:c}=t.getState(),u=o.get(e);if(!u){c==null||c("012",Bl.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):r([e])}function rne({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:i,nodeId:r,isSelectable:s,nodeClickDistance:a}){const o=dr(),[c,u]=m.useState(!1),d=m.useRef();return m.useEffect(()=>{d.current=qAe({getStoreItems:()=>o.getState(),onNodeMouseDown:f=>{CP({id:f,store:o,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:i,domNode:e.current,isSelectable:s,nodeId:r,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,i,t,s,e,r,a]),c}const vCe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function sne(){const e=dr();return m.useCallback(n=>{const{nodeExtent:i,snapToGrid:r,snapGrid:s,nodesDraggable:a,onError:o,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=vCe(a),p=r?s[0]:5,g=r?s[1]:5,b=n.direction.x*p*n.factor,y=n.direction.y*g*n.factor;for(const[,O]of u){if(!h(O))continue;let v={x:O.internals.positionAbsolute.x+b,y:O.internals.positionAbsolute.y+y};r&&(v=D1(v,s));const{position:x,positionAbsolute:w}=vte({nodeId:O.id,nextPosition:v,nodeLookup:u,nodeExtent:i,nodeOrigin:d,onError:o});O.position=x,O.internals.positionAbsolute=w,f.set(O.id,O)}c(f)},[])}const _$=m.createContext(null),wCe=_$.Provider;_$.Consumer;const ane=()=>m.useContext(_$),SCe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ECe=(e,t,n)=>i=>{const{connectionClickStartHandle:r,connectionMode:s,connection:a}=i,{fromHandle:o,toHandle:c,isValid:u}=a,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:d,clickConnecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===n,isPossibleEndHandle:s===h0.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!r,valid:d&&u}};function kCe({type:e="source",position:t=wt.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:a,onConnect:o,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var Q,C;const g=a||null,b=e==="target",y=dr(),O=ane(),{connectOnClick:v,noPanClassName:x,rfId:w}=zn(SCe,ur),{connectingFrom:E,connectingTo:S,clickConnecting:k,isPossibleEndHandle:T,connectionInProcess:A,clickConnectionInProcess:N,valid:j}=zn(ECe(O,g,e),ur);O||(C=(Q=y.getState()).onError)==null||C.call(Q,"010",Bl.error010());const M=I=>{const{defaultEdgeOptions:U,onConnect:B,hasDefaultEdges:P}=y.getState(),q={...U,...I};if(P){const{edges:G,setEdges:$,onError:V}=y.getState();$(sCe(q,G,{onError:V}))}B==null||B(q),o==null||o(q)},D=I=>{if(!O)return;const U=Ate(I.nativeEvent);if(r&&(U&&I.button===0||!U)){const B=y.getState();NP.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:B.autoPanOnConnect,connectionMode:B.connectionMode,connectionRadius:B.connectionRadius,domNode:B.domNode,nodeLookup:B.nodeLookup,lib:B.lib,isTarget:b,handleId:g,nodeId:O,flowId:B.rfId,panBy:B.panBy,cancelConnection:B.cancelConnection,onConnectStart:B.onConnectStart,onConnectEnd:(...P)=>{var q,G;return(G=(q=y.getState()).onConnectEnd)==null?void 0:G.call(q,...P)},updateConnection:B.updateConnection,onConnect:M,isValidConnection:n||((...P)=>{var q,G;return((G=(q=y.getState()).isValidConnection)==null?void 0:G.call(q,...P))??!0}),getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:B.autoPanSpeed,dragThreshold:B.connectionDragThreshold})}U?d==null||d(I):f==null||f(I)},L=I=>{const{onClickConnectStart:U,onClickConnectEnd:B,connectionClickStartHandle:P,connectionMode:q,isValidConnection:G,lib:$,rfId:V,nodeLookup:te,connection:fe}=y.getState();if(!O||!P&&!r)return;if(!P){U==null||U(I.nativeEvent,{nodeId:O,handleId:g,handleType:e}),y.setState({connectionClickStartHandle:{nodeId:O,type:e,id:g}});return}const Te=Tte(I.target),J=n||G,{connection:ne,isValid:ce}=NP.isValid(I.nativeEvent,{handle:{nodeId:O,id:g,type:e},connectionMode:q,fromNodeId:P.nodeId,fromHandleId:P.id||null,fromType:P.type,isValidConnection:J,flowId:V,doc:Te,lib:$,nodeLookup:te});ce&&ne&&M(ne);const Oe=structuredClone(fe);delete Oe.inProgress,Oe.toPosition=Oe.toHandle?Oe.toHandle.position:null,B==null||B(I,Oe),y.setState({connectionClickStartHandle:null})};return l.jsx("div",{"data-handleid":g,"data-nodeid":O,"data-handlepos":t,"data-id":`${w}-${O}-${g}-${e}`,className:Kr(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,u,{source:!b,target:b,connectable:i,connectablestart:r,connectableend:s,clickconnecting:k,connectingfrom:E,connectingto:S,valid:j,connectionindicator:i&&(!A||T)&&(A||N?s:r)}]),onMouseDown:D,onTouchStart:D,onClick:v?L:void 0,ref:p,...h,children:c})}const Ua=m.memo(nne(kCe));function TCe({data:e,isConnectable:t,sourcePosition:n=wt.Bottom}){return l.jsxs(l.Fragment,{children:[e==null?void 0:e.label,l.jsx(Ua,{type:"source",position:n,isConnectable:t})]})}function _Ce({data:e,isConnectable:t,targetPosition:n=wt.Top,sourcePosition:i=wt.Bottom}){return l.jsxs(l.Fragment,{children:[l.jsx(Ua,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,l.jsx(Ua,{type:"source",position:i,isConnectable:t})]})}function ACe(){return null}function NCe({data:e,isConnectable:t,targetPosition:n=wt.Top}){return l.jsxs(l.Fragment,{children:[l.jsx(Ua,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Ik={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},SU={input:TCe,default:_Ce,output:NCe,group:ACe};function CCe(e){var t,n,i,r;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((i=e.style)==null?void 0:i.width),height:e.height??((r=e.style)==null?void 0:r.height)}}const jCe=e=>{const{width:t,height:n,x:i,y:r}=L1(e.nodeLookup,{filter:s=>!!s.selected});return{width:Il(t)?t:null,height:Il(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${r}px)`}};function RCe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const i=dr(),{width:r,height:s,transformString:a,userSelectionActive:o}=zn(jCe,ur),c=sne(),u=m.useRef(null);m.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!o&&r!==null&&s!==null;if(rne({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const g=i.getState().nodes.filter(b=>b.selected);e(p,g)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Ik,p.key)&&(p.preventDefault(),c({direction:Ik[p.key],factor:p.shiftKey?4:1}))};return l.jsx("div",{className:Kr(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:l.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:r,height:s}})})}const EU=typeof window<"u"?window:void 0,ICe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function one({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,paneClickDistance:o,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:g,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:O,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:w,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:T,autoPanOnSelection:A,defaultViewport:N,translateExtent:j,minZoom:M,maxZoom:D,preventScrolling:L,onSelectionContextMenu:Q,noWheelClassName:C,noPanClassName:I,disableKeyboardA11y:U,onViewportChange:B,isControlledViewport:P}){const{nodesSelectionActive:q,userSelectionActive:G}=zn(ICe,ur),$=vx(u,{target:EU}),V=vx(b,{target:EU}),te=V||T,fe=V||w,Te=d&&te!==!0,J=$||G||Te;return hCe({deleteKeyCode:c,multiSelectionKeyCode:g}),l.jsx(gCe,{onPaneContextMenu:s,elementsSelectable:O,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:fe,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!$&&te,defaultViewport:N,translateExtent:j,minZoom:M,maxZoom:D,zoomActivationKeyCode:y,preventScrolling:L,noWheelClassName:C,noPanClassName:I,onViewportChange:B,isControlledViewport:P,paneClickDistance:o,selectionOnDrag:Te,children:l.jsxs(xCe,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:te,autoPanOnSelection:A,isSelecting:!!J,selectionMode:f,selectionKeyPressed:$,paneClickDistance:o,selectionOnDrag:Te,children:[e,q&&l.jsx(RCe,{onSelectionContextMenu:Q,noPanClassName:I,disableKeyboardA11y:U})]})})}one.displayName="FlowRenderer";const PCe=m.memo(one),MCe=e=>t=>e?b$(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function LCe(e){return zn(m.useCallback(MCe(e),[e]),ur)}const DCe=e=>e.updateNodeInternals;function $Ce(){const e=zn(DCe),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const i=new Map;n.forEach(r=>{const s=r.target.getAttribute("data-id");i.set(s,{id:s,nodeElement:r.target,force:!0})}),e(i)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function QCe({node:e,nodeType:t,hasDimensions:n,resizeObserver:i}){const r=dr(),s=m.useRef(null),a=m.useRef(null),o=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),u=m.useRef(t),d=n&&!!e.internals.handleBounds;return m.useEffect(()=>{s.current&&!e.hidden&&(!d||a.current!==s.current)&&(a.current&&(i==null||i.unobserve(a.current)),i==null||i.observe(s.current),a.current=s.current)},[d,e.hidden]),m.useEffect(()=>()=>{a.current&&(i==null||i.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(s.current){const f=u.current!==t,h=o.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,o.current=e.sourcePosition,c.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function BCe({id:e,onClick:t,onMouseEnter:n,onMouseMove:i,onMouseLeave:r,onContextMenu:s,onDoubleClick:a,nodesDraggable:o,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:g,rfId:b,nodeTypes:y,nodeClickDistance:O,onError:v}){const{node:x,internals:w,isParent:E}=zn(J=>{const ne=J.nodeLookup.get(e),ce=J.parentLookup.has(e);return{node:ne,internals:ne.internals,isParent:ce}},ur);let S=x.type||"default",k=(y==null?void 0:y[S])||SU[S];k===void 0&&(v==null||v("003",Bl.error003(S)),S="default",k=(y==null?void 0:y.default)||SU.default);const T=!!(x.draggable||o&&typeof x.draggable>"u"),A=!!(x.selectable||c&&typeof x.selectable>"u"),N=!!(x.connectable||u&&typeof x.connectable>"u"),j=!!(x.focusable||d&&typeof x.focusable>"u"),M=dr(),D=x$(x),L=QCe({node:x,nodeType:S,hasDimensions:D,resizeObserver:f}),Q=rne({nodeRef:L,disabled:x.hidden||!T,noDragClassName:h,handleSelector:x.dragHandle,nodeId:e,isSelectable:A,nodeClickDistance:O}),C=sne();if(x.hidden)return null;const I=fd(x),U=CCe(x),B=A||T||t||n||i||r,P=n?J=>n(J,{...w.userNode}):void 0,q=i?J=>i(J,{...w.userNode}):void 0,G=r?J=>r(J,{...w.userNode}):void 0,$=s?J=>s(J,{...w.userNode}):void 0,V=a?J=>a(J,{...w.userNode}):void 0,te=J=>{const{selectNodesOnDrag:ne,nodeDragThreshold:ce}=M.getState();A&&(!ne||!T||ce>0)&&CP({id:e,store:M,nodeRef:L}),t&&t(J,{...w.userNode})},fe=J=>{if(!(_te(J.nativeEvent)||g)){if(gte.includes(J.key)&&A){const ne=J.key==="Escape";CP({id:e,store:M,unselect:ne,nodeRef:L})}else if(T&&x.selected&&Object.prototype.hasOwnProperty.call(Ik,J.key)){J.preventDefault();const{ariaLabelConfig:ne}=M.getState();M.setState({ariaLiveMessage:ne["node.a11yDescription.ariaLiveMessage"]({direction:J.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),C({direction:Ik[J.key],factor:J.shiftKey?4:1})}}},Te=()=>{var ve;if(g||!((ve=L.current)!=null&&ve.matches(":focus-visible")))return;const{transform:J,width:ne,height:ce,autoPanOnNodeFocus:Oe,setCenter:Se}=M.getState();if(!Oe)return;b$(new Map([[e,x]]),{x:0,y:0,width:ne,height:ce},J,!0).length>0||Se(x.position.x+I.width/2,x.position.y+I.height/2,{zoom:J[2]})};return l.jsx("div",{className:Kr(["react-flow__node",`react-flow__node-${S}`,{[p]:T},x.className,{selected:x.selected,selectable:A,parent:E,draggable:T,dragging:Q}]),ref:L,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:D?"visible":"hidden",...x.style,...U},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:P,onMouseMove:q,onMouseLeave:G,onContextMenu:$,onClick:te,onDoubleClick:V,onKeyDown:j?fe:void 0,tabIndex:j?0:void 0,onFocus:j?Te:void 0,role:x.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Wte}-${b}`,"aria-label":x.ariaLabel,...x.domAttributes,children:l.jsx(wCe,{value:e,children:l.jsx(k,{id:e,data:x.data,type:S,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:x.selected??!1,selectable:A,draggable:T,deletable:x.deletable??!0,isConnectable:N,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:Q,dragHandle:x.dragHandle,zIndex:w.z,parentId:x.parentId,...I})})})}var UCe=m.memo(BCe);const zCe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function lne(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,onError:s}=zn(zCe,ur),a=LCe(e.onlyRenderVisibleElements),o=$Ce();return l.jsx("div",{className:"react-flow__nodes",style:Q_,children:a.map(c=>l.jsx(UCe,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}lne.displayName="NodeRenderer";const FCe=m.memo(lne);function VCe(e){return zn(m.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const i=[];if(n.width&&n.height)for(const r of n.edges){const s=n.nodeLookup.get(r.source),a=n.nodeLookup.get(r.target);s&&a&&_Ae({sourceNode:s,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&i.push(r.id)}return i},[e]),ur)}const XCe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return l.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},qCe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return l.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},kU={[Ox.Arrow]:XCe,[Ox.ArrowClosed]:qCe};function HCe(e){const t=dr();return m.useMemo(()=>{var r,s;return Object.prototype.hasOwnProperty.call(kU,e)?kU[e]:((s=(r=t.getState()).onError)==null||s.call(r,"009",Bl.error009(e)),null)},[e])}const YCe=({id:e,type:t,color:n,width:i=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const c=HCe(t);return c?l.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:o,refX:"0",refY:"0",children:l.jsx(c,{color:n,strokeWidth:a})}):null},cne=({defaultColor:e,rfId:t})=>{const n=zn(s=>s.edges),i=zn(s=>s.defaultEdgeOptions),r=m.useMemo(()=>MAe(n,{id:t,defaultColor:e,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[n,i,t,e]);return r.length?l.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:l.jsx("defs",{children:r.map(s=>l.jsx(YCe,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};cne.displayName="MarkerDefinitions";var GCe=m.memo(cne);function une({x:e,y:t,label:n,labelStyle:i,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:c,className:u,...d}){const[f,h]=m.useState({x:1,y:0,width:0,height:0}),p=Kr(["react-flow__edge-textwrapper",u]),g=m.useRef(null);return m.useEffect(()=>{if(g.current){const b=g.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?l.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[r&&l.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:o,ry:o}),l.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:i,children:n}),c]}):null}une.displayName="EdgeText";const WCe=m.memo(une);function $1({path:e,labelX:t,labelY:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return l.jsxs(l.Fragment,{children:[l.jsx("path",{...d,d:e,fill:"none",className:Kr(["react-flow__edge-path",d.className])}),u?l.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,i&&Il(t)&&Il(n)?l.jsx(WCe,{x:t,y:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c}):null]})}function TU({pos:e,x1:t,y1:n,x2:i,y2:r}){return e===wt.Left||e===wt.Right?[.5*(t+i),n]:[t,.5*(n+r)]}function dne({sourceX:e,sourceY:t,sourcePosition:n=wt.Bottom,targetX:i,targetY:r,targetPosition:s=wt.Top}){const[a,o]=TU({pos:n,x1:e,y1:t,x2:i,y2:r}),[c,u]=TU({pos:s,x1:i,y1:r,x2:e,y2:t}),[d,f,h,p]=Nte({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:a,sourceControlY:o,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${o} ${c},${u} ${i},${r}`,d,f,h,p]}function fne(e){return m.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:a,targetPosition:o,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:b,markerStart:y,interactionWidth:O})=>{const[v,x,w]=dne({sourceX:n,sourceY:i,sourcePosition:a,targetX:r,targetY:s,targetPosition:o}),E=e.isInternal?void 0:t;return l.jsx($1,{id:E,path:v,labelX:x,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:b,markerStart:y,interactionWidth:O})})}const ZCe=fne({isInternal:!1}),hne=fne({isInternal:!0});ZCe.displayName="SimpleBezierEdge";hne.displayName="SimpleBezierEdgeInternal";function pne(e){return m.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=wt.Bottom,targetPosition:g=wt.Top,markerEnd:b,markerStart:y,pathOptions:O,interactionWidth:v})=>{const[x,w,E]=Rk({sourceX:n,sourceY:i,sourcePosition:p,targetX:r,targetY:s,targetPosition:g,borderRadius:O==null?void 0:O.borderRadius,offset:O==null?void 0:O.offset,stepPosition:O==null?void 0:O.stepPosition}),S=e.isInternal?void 0:t;return l.jsx($1,{id:S,path:x,labelX:w,labelY:E,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:y,interactionWidth:v})})}const mne=pne({isInternal:!1}),gne=pne({isInternal:!0});mne.displayName="SmoothStepEdge";gne.displayName="SmoothStepEdgeInternal";function bne(e){return m.memo(({id:t,...n})=>{var r;const i=e.isInternal?void 0:t;return l.jsx(mne,{...n,id:i,pathOptions:m.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(r=n.pathOptions)==null?void 0:r.offset])})})}const KCe=bne({isInternal:!1}),One=bne({isInternal:!0});KCe.displayName="StepEdge";One.displayName="StepEdgeInternal";function yne(e){return m.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:b})=>{const[y,O,v]=Rte({sourceX:n,sourceY:i,targetX:r,targetY:s}),x=e.isInternal?void 0:t;return l.jsx($1,{id:x,path:y,labelX:O,labelY:v,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:b})})}const JCe=yne({isInternal:!1}),xne=yne({isInternal:!0});JCe.displayName="StraightEdge";xne.displayName="StraightEdgeInternal";function vne(e){return m.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:a=wt.Bottom,targetPosition:o=wt.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:b,markerStart:y,pathOptions:O,interactionWidth:v})=>{const[x,w,E]=Cte({sourceX:n,sourceY:i,sourcePosition:a,targetX:r,targetY:s,targetPosition:o,curvature:O==null?void 0:O.curvature}),S=e.isInternal?void 0:t;return l.jsx($1,{id:S,path:x,labelX:w,labelY:E,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:b,markerStart:y,interactionWidth:v})})}const eje=vne({isInternal:!1}),wne=vne({isInternal:!0});eje.displayName="BezierEdge";wne.displayName="BezierEdgeInternal";const _U={default:wne,straight:xne,step:One,smoothstep:gne,simplebezier:hne},AU={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},tje=(e,t,n)=>n===wt.Left?e-t:n===wt.Right?e+t:e,nje=(e,t,n)=>n===wt.Top?e-t:n===wt.Bottom?e+t:e,NU="react-flow__edgeupdater";function CU({position:e,centerX:t,centerY:n,radius:i=10,onMouseDown:r,onMouseEnter:s,onMouseOut:a,type:o}){return l.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:a,className:Kr([NU,`${NU}-${o}`]),cx:tje(t,i,e),cy:nje(n,i,e),r:i,stroke:"transparent",fill:"transparent"})}function ije({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:i,sourceY:r,targetX:s,targetY:a,sourcePosition:o,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const g=dr(),b=(w,E)=>{if(w.button!==0)return;const{autoPanOnConnect:S,domNode:k,connectionMode:T,connectionRadius:A,lib:N,onConnectStart:j,cancelConnection:M,nodeLookup:D,rfId:L,panBy:Q,updateConnection:C}=g.getState(),I=E.type==="target",U=(q,G)=>{h(!1),f==null||f(q,n,E.type,G)},B=q=>u==null?void 0:u(n,q),P=(q,G)=>{h(!0),d==null||d(w,n,E.type),j==null||j(q,G)};NP.onPointerDown(w.nativeEvent,{autoPanOnConnect:S,connectionMode:T,connectionRadius:A,domNode:k,handleId:E.id,nodeId:E.nodeId,nodeLookup:D,isTarget:I,edgeUpdaterType:E.type,lib:N,flowId:L,cancelConnection:M,panBy:Q,isValidConnection:(...q)=>{var G,$;return(($=(G=g.getState()).isValidConnection)==null?void 0:$.call(G,...q))??!0},onConnect:B,onConnectStart:P,onConnectEnd:(...q)=>{var G,$;return($=(G=g.getState()).onConnectEnd)==null?void 0:$.call(G,...q)},onReconnectEnd:U,updateConnection:C,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},y=w=>b(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),O=w=>b(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>p(!0),x=()=>p(!1);return l.jsxs(l.Fragment,{children:[(e===!0||e==="source")&&l.jsx(CU,{position:o,centerX:i,centerY:r,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&l.jsx(CU,{position:c,centerX:s,centerY:a,radius:t,onMouseDown:O,onMouseEnter:v,onMouseOut:x,type:"target"})]})}function rje({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:i,onClick:r,onDoubleClick:s,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:g,edgeTypes:b,noPanClassName:y,onError:O,disableKeyboardA11y:v}){let x=zn(Se=>Se.edgeLookup.get(e));const w=zn(Se=>Se.defaultEdgeOptions);x=w?{...w,...x}:x;let E=x.type||"default",S=(b==null?void 0:b[E])||_U[E];S===void 0&&(O==null||O("011",Bl.error011(E)),E="default",S=(b==null?void 0:b.default)||_U.default);const k=!!(x.focusable||t&&typeof x.focusable>"u"),T=typeof f<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),A=!!(x.selectable||i&&typeof x.selectable>"u"),N=m.useRef(null),[j,M]=m.useState(!1),[D,L]=m.useState(!1),Q=dr(),{zIndex:C,sourceX:I,sourceY:U,targetX:B,targetY:P,sourcePosition:q,targetPosition:G}=zn(m.useCallback(Se=>{const je=Se.nodeLookup.get(x.source),ve=Se.nodeLookup.get(x.target);if(!je||!ve)return{zIndex:x.zIndex,...AU};const be=PAe({id:e,sourceNode:je,targetNode:ve,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:Se.connectionMode,onError:O});return{zIndex:TAe({selected:x.selected,zIndex:x.zIndex,sourceNode:je,targetNode:ve,elevateOnSelect:Se.elevateEdgesOnSelect,zIndexMode:Se.zIndexMode}),...be||AU}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),ur),$=m.useMemo(()=>x.markerStart?`url('#${_P(x.markerStart,g)}')`:void 0,[x.markerStart,g]),V=m.useMemo(()=>x.markerEnd?`url('#${_P(x.markerEnd,g)}')`:void 0,[x.markerEnd,g]);if(x.hidden||I===null||U===null||B===null||P===null)return null;const te=Se=>{var ae;const{addSelectedEdges:je,unselectNodesAndEdges:ve,multiSelectionActive:be}=Q.getState();A&&(Q.setState({nodesSelectionActive:!1}),x.selected&&be?(ve({nodes:[],edges:[x]}),(ae=N.current)==null||ae.blur()):je([e])),r&&r(Se,x)},fe=s?Se=>{s(Se,{...x})}:void 0,Te=a?Se=>{a(Se,{...x})}:void 0,J=o?Se=>{o(Se,{...x})}:void 0,ne=c?Se=>{c(Se,{...x})}:void 0,ce=u?Se=>{u(Se,{...x})}:void 0,Oe=Se=>{var je;if(!v&>e.includes(Se.key)&&A){const{unselectNodesAndEdges:ve,addSelectedEdges:be}=Q.getState();Se.key==="Escape"?((je=N.current)==null||je.blur(),ve({edges:[x]})):be([e])}};return l.jsx("svg",{style:{zIndex:C},children:l.jsxs("g",{className:Kr(["react-flow__edge",`react-flow__edge-${E}`,x.className,y,{selected:x.selected,animated:x.animated,inactive:!A&&!r,updating:j,selectable:A}]),onClick:te,onDoubleClick:fe,onContextMenu:Te,onMouseEnter:J,onMouseMove:ne,onMouseLeave:ce,onKeyDown:k?Oe:void 0,tabIndex:k?0:void 0,role:x.ariaRole??(k?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":x.ariaLabel===null?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":k?`${Zte}-${g}`:void 0,ref:N,...x.domAttributes,children:[!D&&l.jsx(S,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:A,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:I,sourceY:U,targetX:B,targetY:P,sourcePosition:q,targetPosition:G,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:$,markerEnd:V,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),T&&l.jsx(ije,{edge:x,isReconnectable:T,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:I,sourceY:U,targetX:B,targetY:P,sourcePosition:q,targetPosition:G,setUpdateHover:M,setReconnecting:L})]})})}var sje=m.memo(rje);const aje=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Sne({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:i,noPanClassName:r,onReconnect:s,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:g,disableKeyboardA11y:b}){const{edgesFocusable:y,edgesReconnectable:O,elementsSelectable:v,onError:x}=zn(aje,ur),w=VCe(t);return l.jsxs("div",{className:"react-flow__edges",children:[l.jsx(GCe,{defaultColor:e,rfId:n}),w.map(E=>l.jsx(sje,{id:E,edgesFocusable:y,edgesReconnectable:O,elementsSelectable:v,noPanClassName:r,onReconnect:s,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:g,rfId:n,onError:x,edgeTypes:i,disableKeyboardA11y:b},E))]})}Sne.displayName="EdgeRenderer";const oje=m.memo(Sne),lje=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function cje({children:e}){const t=zn(lje);return l.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function uje(e){const t=$_(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const dje=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function fje(e){const t=zn(dje),n=dr();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function hje(e){return e.connection.inProgress?{...e.connection,to:eb(e.connection.to,e.transform)}:{...e.connection}}function pje(e){return hje}function mje(e){const t=pje();return zn(t,ur)}const gje=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function bje({containerStyle:e,style:t,type:n,component:i}){const{nodesConnectable:r,width:s,height:a,isValid:o,inProgress:c}=zn(gje,ur);return!(s&&r&&c)?null:l.jsx("svg",{style:e,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:l.jsx("g",{className:Kr(["react-flow__connection",yte(o)]),children:l.jsx(Ene,{style:t,type:n,CustomComponent:i,isValid:o})})})}const Ene=({style:e,type:t=ef.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:r,from:s,fromNode:a,fromHandle:o,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=mje();if(!r)return;if(n)return l.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:o,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:yte(i),toNode:d,toHandle:f,pointer:p});let g="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case ef.Bezier:[g]=Cte(b);break;case ef.SimpleBezier:[g]=dne(b);break;case ef.Step:[g]=Rk({...b,borderRadius:0});break;case ef.SmoothStep:[g]=Rk(b);break;default:[g]=Rte(b)}return l.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};Ene.displayName="ConnectionLine";const Oje={};function jU(e=Oje){m.useRef(e),dr(),m.useEffect(()=>{},[e])}function yje(){dr(),m.useRef(!1),m.useEffect(()=>{},[])}function kne({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:i,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:a,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:g,connectionLineStyle:b,connectionLineComponent:y,connectionLineContainerStyle:O,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:E,panActivationKeyCode:S,zoomActivationKeyCode:k,deleteKeyCode:T,onlyRenderVisibleElements:A,elementsSelectable:N,defaultViewport:j,translateExtent:M,minZoom:D,maxZoom:L,preventScrolling:Q,defaultMarkerColor:C,zoomOnScroll:I,zoomOnPinch:U,panOnScroll:B,panOnScrollSpeed:P,panOnScrollMode:q,zoomOnDoubleClick:G,panOnDrag:$,autoPanOnSelection:V,onPaneClick:te,onPaneMouseEnter:fe,onPaneMouseMove:Te,onPaneMouseLeave:J,onPaneScroll:ne,onPaneContextMenu:ce,paneClickDistance:Oe,nodeClickDistance:Se,onEdgeContextMenu:je,onEdgeMouseEnter:ve,onEdgeMouseMove:be,onEdgeMouseLeave:ae,reconnectRadius:Re,onReconnect:xe,onReconnectStart:Be,onReconnectEnd:qe,noDragClassName:Pe,noWheelClassName:mt,noPanClassName:bt,disableKeyboardA11y:Dt,nodeExtent:We,rfId:W,viewport:ee,onViewportChange:se}){return jU(e),jU(t),yje(),uje(n),fje(ee),l.jsx(PCe,{onPaneClick:te,onPaneMouseEnter:fe,onPaneMouseMove:Te,onPaneMouseLeave:J,onPaneContextMenu:ce,onPaneScroll:ne,paneClickDistance:Oe,deleteKeyCode:T,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:E,panActivationKeyCode:S,zoomActivationKeyCode:k,elementsSelectable:N,zoomOnScroll:I,zoomOnPinch:U,zoomOnDoubleClick:G,panOnScroll:B,panOnScrollSpeed:P,panOnScrollMode:q,panOnDrag:$,autoPanOnSelection:V,defaultViewport:j,translateExtent:M,minZoom:D,maxZoom:L,onSelectionContextMenu:f,preventScrolling:Q,noDragClassName:Pe,noWheelClassName:mt,noPanClassName:bt,disableKeyboardA11y:Dt,onViewportChange:se,isControlledViewport:!!ee,children:l.jsxs(cje,{children:[l.jsx(oje,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:a,onReconnect:xe,onReconnectStart:Be,onReconnectEnd:qe,onlyRenderVisibleElements:A,onEdgeContextMenu:je,onEdgeMouseEnter:ve,onEdgeMouseMove:be,onEdgeMouseLeave:ae,reconnectRadius:Re,defaultMarkerColor:C,noPanClassName:bt,disableKeyboardA11y:Dt,rfId:W}),l.jsx(bje,{style:b,type:g,component:y,containerStyle:O}),l.jsx("div",{className:"react-flow__edgelabel-renderer"}),l.jsx(FCe,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Se,onlyRenderVisibleElements:A,noPanClassName:bt,noDragClassName:Pe,disableKeyboardA11y:Dt,nodeExtent:We,rfId:W}),l.jsx("div",{className:"react-flow__viewport-portal"})]})})}kne.displayName="GraphView";const xje=m.memo(kne),vje=Ete(),RU=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:a,fitViewOptions:o,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,g=new Map,b=new Map,y=new Map,O=i??t??[],v=n??e??[],x=d??[0,0],w=f??gx;Mte(b,y,O);const{nodesInitialized:E}=AP(v,p,g,{nodeOrigin:x,nodeExtent:w,zIndexMode:h});let S=[0,0,1];if(a&&r&&s){const k=L1(p,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:T,y:A,zoom:N}=y$(k,r,s,c,u,(o==null?void 0:o.padding)??.1);S=[T,A,N]}return{rfId:"1",width:r??0,height:s??0,transform:S,nodes:v,nodesInitialized:E,nodeLookup:p,parentLookup:g,edges:O,edgeLookup:y,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:gx,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:h0.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:o,fitViewResolver:null,connection:{...Ote},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:vje,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:bte,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},wje=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>DNe((p,g)=>{async function b(){const{nodeLookup:y,panZoom:O,fitViewOptions:v,fitViewResolver:x,width:w,height:E,minZoom:S,maxZoom:k}=g();O&&(await yAe({nodes:y,width:w,height:E,panZoom:O,minZoom:S,maxZoom:k},v),x==null||x.resolve(!0),p({fitViewResolver:null}))}return{...RU({nodes:e,edges:t,width:r,height:s,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:i,zIndexMode:h}),setNodes:y=>{const{nodeLookup:O,parentLookup:v,nodeOrigin:x,elevateNodesOnSelect:w,fitViewQueued:E,zIndexMode:S,nodesSelectionActive:k}=g(),{nodesInitialized:T,hasSelectedNodes:A}=AP(y,O,v,{nodeOrigin:x,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:S}),N=k&&A;E&&T?(b(),p({nodes:y,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:N})):p({nodes:y,nodesInitialized:T,nodesSelectionActive:N})},setEdges:y=>{const{connectionLookup:O,edgeLookup:v}=g();Mte(O,v,y),p({edges:y})},setDefaultNodesAndEdges:(y,O)=>{if(y){const{setNodes:v}=g();v(y),p({hasDefaultNodes:!0})}if(O){const{setEdges:v}=g();v(O),p({hasDefaultEdges:!0})}},updateNodeInternals:y=>{const{triggerNodeChanges:O,nodeLookup:v,parentLookup:x,domNode:w,nodeOrigin:E,nodeExtent:S,debug:k,fitViewQueued:T,zIndexMode:A}=g(),{changes:N,updatedInternals:j}=zAe(y,v,x,w,E,S,A);j&&($Ae(v,x,{nodeOrigin:E,nodeExtent:S,zIndexMode:A}),T?(b(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(N==null?void 0:N.length)>0&&(k&&console.log("React Flow: trigger node changes",N),O==null||O(N)))},updateNodePositions:(y,O=!1)=>{const v=[];let x=[];const{nodeLookup:w,triggerNodeChanges:E,connection:S,updateConnection:k,onNodesChangeMiddlewareMap:T}=g();for(const[A,N]of y){const j=w.get(A),M=!!(j!=null&&j.expandParent&&(j!=null&&j.parentId)&&(N!=null&&N.position)),D={id:A,type:"position",position:M?{x:Math.max(0,N.position.x),y:Math.max(0,N.position.y)}:N.position,dragging:O};if(j&&S.inProgress&&S.fromNode.id===j.id){const L=Ep(j,S.fromHandle,wt.Left,!0);k({...S,from:L})}M&&j.parentId&&v.push({id:A,parentId:j.parentId,rect:{...N.internals.positionAbsolute,width:N.measured.width??0,height:N.measured.height??0}}),x.push(D)}if(v.length>0){const{parentLookup:A,nodeOrigin:N}=g(),j=T$(v,w,A,N);x.push(...j)}for(const A of T.values())x=A(x);E(x)},triggerNodeChanges:y=>{const{onNodesChange:O,setNodes:v,nodes:x,hasDefaultNodes:w,debug:E}=g();if(y!=null&&y.length){if(w){const S=ene(y,x);v(S)}E&&console.log("React Flow: trigger node changes",y),O==null||O(y)}},triggerEdgeChanges:y=>{const{onEdgesChange:O,setEdges:v,edges:x,hasDefaultEdges:w,debug:E}=g();if(y!=null&&y.length){if(w){const S=tne(y,x);v(S)}E&&console.log("React Flow: trigger edge changes",y),O==null||O(y)}},addSelectedNodes:y=>{const{multiSelectionActive:O,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:E}=g();if(O){const S=y.map(k=>Rh(k,!0));w(S);return}w(cg(x,new Set([...y]),!0)),E(cg(v))},addSelectedEdges:y=>{const{multiSelectionActive:O,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:E}=g();if(O){const S=y.map(k=>Rh(k,!0));E(S);return}E(cg(v,new Set([...y]))),w(cg(x,new Set,!0))},unselectNodesAndEdges:({nodes:y,edges:O}={})=>{const{edges:v,nodes:x,nodeLookup:w,triggerNodeChanges:E,triggerEdgeChanges:S}=g(),k=y||x,T=O||v,A=[];for(const j of k){if(!j.selected)continue;const M=w.get(j.id);M&&(M.selected=!1),A.push(Rh(j.id,!1))}const N=[];for(const j of T)j.selected&&N.push(Rh(j.id,!1));E(A),S(N)},setMinZoom:y=>{const{panZoom:O,maxZoom:v}=g();O==null||O.setScaleExtent([y,v]),p({minZoom:y})},setMaxZoom:y=>{const{panZoom:O,minZoom:v}=g();O==null||O.setScaleExtent([v,y]),p({maxZoom:y})},setTranslateExtent:y=>{var O;(O=g().panZoom)==null||O.setTranslateExtent(y),p({translateExtent:y})},resetSelectedElements:()=>{const{edges:y,nodes:O,triggerNodeChanges:v,triggerEdgeChanges:x,elementsSelectable:w}=g();if(!w)return;const E=O.reduce((k,T)=>T.selected?[...k,Rh(T.id,!1)]:k,[]),S=y.reduce((k,T)=>T.selected?[...k,Rh(T.id,!1)]:k,[]);v(E),x(S)},setNodeExtent:y=>{const{nodes:O,nodeLookup:v,parentLookup:x,nodeOrigin:w,elevateNodesOnSelect:E,nodeExtent:S,zIndexMode:k}=g();y[0][0]===S[0][0]&&y[0][1]===S[0][1]&&y[1][0]===S[1][0]&&y[1][1]===S[1][1]||(AP(O,v,x,{nodeOrigin:w,nodeExtent:y,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:k}),p({nodeExtent:y}))},panBy:y=>{const{transform:O,width:v,height:x,panZoom:w,translateExtent:E}=g();return FAe({delta:y,panZoom:w,transform:O,translateExtent:E,width:v,height:x})},setCenter:async(y,O,v)=>{const{width:x,height:w,maxZoom:E,panZoom:S}=g();if(!S)return!1;const k=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:E;return await S.setViewport({x:x/2-y*k,y:w/2-O*k,zoom:k},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),!0},cancelConnection:()=>{p({connection:{...Ote}})},updateConnection:y=>{p({connection:y})},reset:()=>p({...RU()})}},Object.is);function Tne({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:i,initialWidth:r,initialHeight:s,initialMinZoom:a,initialMaxZoom:o,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[g]=m.useState(()=>wje({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:u,minZoom:a,maxZoom:o,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return l.jsx($Ne,{value:g,children:l.jsx(cCe,{children:p})})}function Sje({children:e,nodes:t,edges:n,defaultNodes:i,defaultEdges:r,width:s,height:a,fitView:o,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return m.useContext(L_)?l.jsx(l.Fragment,{children:e}):l.jsx(Tne,{initialNodes:t,initialEdges:n,defaultNodes:i,defaultEdges:r,initialWidth:s,initialHeight:a,fitView:o,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const Eje={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function kje({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,className:r,nodeTypes:s,edgeTypes:a,onNodeClick:o,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:g,onConnectEnd:b,onClickConnectStart:y,onClickConnectEnd:O,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:w,onNodeContextMenu:E,onNodeDoubleClick:S,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:A,onNodesDelete:N,onEdgesDelete:j,onDelete:M,onSelectionChange:D,onSelectionDragStart:L,onSelectionDrag:Q,onSelectionDragStop:C,onSelectionContextMenu:I,onSelectionStart:U,onSelectionEnd:B,onBeforeDelete:P,connectionMode:q,connectionLineType:G=ef.Bezier,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:te,deleteKeyCode:fe="Backspace",selectionKeyCode:Te="Shift",selectionOnDrag:J=!1,selectionMode:ne=bx.Full,panActivationKeyCode:ce="Space",multiSelectionKeyCode:Oe=xx()?"Meta":"Control",zoomActivationKeyCode:Se=xx()?"Meta":"Control",snapToGrid:je,snapGrid:ve,onlyRenderVisibleElements:be=!1,selectNodesOnDrag:ae,nodesDraggable:Re,autoPanOnNodeFocus:xe,nodesConnectable:Be,nodesFocusable:qe,nodeOrigin:Pe=Kte,edgesFocusable:mt,edgesReconnectable:bt,elementsSelectable:Dt=!0,defaultViewport:We=ZNe,minZoom:W=.5,maxZoom:ee=2,translateExtent:se=gx,preventScrolling:he=!0,nodeExtent:F,defaultMarkerColor:_e="#b1b1b7",zoomOnScroll:Ue=!0,zoomOnPinch:Xe=!0,panOnScroll:_t=!1,panOnScrollSpeed:Bt=.5,panOnScrollMode:Et=op.Free,zoomOnDoubleClick:at=!0,panOnDrag:pe=!0,onPaneClick:ct,onPaneMouseEnter:et,onPaneMouseMove:yt,onPaneMouseLeave:At,onPaneScroll:$t,onPaneContextMenu:Ne,paneClickDistance:tt=1,nodeClickDistance:St=0,children:Wt,onReconnect:Ve,onReconnectStart:vn,onReconnectEnd:nn,onEdgeContextMenu:Nt,onEdgeDoubleClick:Ft,onEdgeMouseEnter:Ce,onEdgeMouseMove:Ze,onEdgeMouseLeave:kt,reconnectRadius:Zt=10,onNodesChange:Kt,onEdgesChange:hi,noDragClassName:Ie="nodrag",noWheelClassName:ut="nowheel",noPanClassName:Rt="nopan",fitView:Ut,fitViewOptions:Sn,connectOnClick:hn,attributionPosition:Si,proOptions:bi,defaultEdgeOptions:Qi,elevateNodesOnSelect:de=!0,elevateEdgesOnSelect:Me=!1,disableKeyboardA11y:dt=!1,autoPanOnConnect:ft,autoPanOnNodeDrag:on,autoPanOnSelection:Kn=!0,autoPanSpeed:Ei,connectionRadius:Jn,isValidConnection:bn,onError:Yn,style:ri,id:qt,nodeDragThreshold:Oi,connectionDragThreshold:ln,viewport:Ri,onViewportChange:cn,width:Ar,height:Bi,colorMode:Dn="light",debug:Qs,onScroll:Yi,ariaLabelConfig:Sa,zIndexMode:fr="basic",...Jr},Ea){const Bs=qt||"1",cs=tCe(Dn),Fn=m.useCallback(us=>{us.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Yi==null||Yi(us)},[Yi]);return l.jsx("div",{"data-testid":"rf__wrapper",...Jr,onScroll:Fn,style:{...ri,...Eje},ref:Ea,className:Kr(["react-flow",r,cs]),id:qt,role:"application",children:l.jsxs(Sje,{nodes:e,edges:t,width:Ar,height:Bi,fitView:Ut,fitViewOptions:Sn,minZoom:W,maxZoom:ee,nodeOrigin:Pe,nodeExtent:F,zIndexMode:fr,children:[l.jsx(eCe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:i,onConnect:p,onConnectStart:g,onConnectEnd:b,onClickConnectStart:y,onClickConnectEnd:O,nodesDraggable:Re,autoPanOnNodeFocus:xe,nodesConnectable:Be,nodesFocusable:qe,edgesFocusable:mt,edgesReconnectable:bt,elementsSelectable:Dt,elevateNodesOnSelect:de,elevateEdgesOnSelect:Me,minZoom:W,maxZoom:ee,nodeExtent:F,onNodesChange:Kt,onEdgesChange:hi,snapToGrid:je,snapGrid:ve,connectionMode:q,translateExtent:se,connectOnClick:hn,defaultEdgeOptions:Qi,fitView:Ut,fitViewOptions:Sn,onNodesDelete:N,onEdgesDelete:j,onDelete:M,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:A,onSelectionDrag:Q,onSelectionDragStart:L,onSelectionDragStop:C,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Rt,nodeOrigin:Pe,rfId:Bs,autoPanOnConnect:ft,autoPanOnNodeDrag:on,autoPanSpeed:Ei,onError:Yn,connectionRadius:Jn,isValidConnection:bn,selectNodesOnDrag:ae,nodeDragThreshold:Oi,connectionDragThreshold:ln,onBeforeDelete:P,debug:Qs,ariaLabelConfig:Sa,zIndexMode:fr}),l.jsx(xje,{onInit:u,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:w,onNodeContextMenu:E,onNodeDoubleClick:S,nodeTypes:s,edgeTypes:a,connectionLineType:G,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:te,selectionKeyCode:Te,selectionOnDrag:J,selectionMode:ne,deleteKeyCode:fe,multiSelectionKeyCode:Oe,panActivationKeyCode:ce,zoomActivationKeyCode:Se,onlyRenderVisibleElements:be,defaultViewport:We,translateExtent:se,minZoom:W,maxZoom:ee,preventScrolling:he,zoomOnScroll:Ue,zoomOnPinch:Xe,zoomOnDoubleClick:at,panOnScroll:_t,panOnScrollSpeed:Bt,panOnScrollMode:Et,panOnDrag:pe,autoPanOnSelection:Kn,onPaneClick:ct,onPaneMouseEnter:et,onPaneMouseMove:yt,onPaneMouseLeave:At,onPaneScroll:$t,onPaneContextMenu:Ne,paneClickDistance:tt,nodeClickDistance:St,onSelectionContextMenu:I,onSelectionStart:U,onSelectionEnd:B,onReconnect:Ve,onReconnectStart:vn,onReconnectEnd:nn,onEdgeContextMenu:Nt,onEdgeDoubleClick:Ft,onEdgeMouseEnter:Ce,onEdgeMouseMove:Ze,onEdgeMouseLeave:kt,reconnectRadius:Zt,defaultMarkerColor:_e,noDragClassName:Ie,noWheelClassName:ut,noPanClassName:Rt,rfId:Bs,disableKeyboardA11y:dt,nodeExtent:F,viewport:Ri,onViewportChange:cn}),l.jsx(WNe,{onSelectionChange:D}),Wt,l.jsx(XNe,{proOptions:bi,position:Si}),l.jsx(VNe,{rfId:Bs,disableKeyboardA11y:dt})]})})}var Tje=nne(kje);const _je=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function Aje({children:e}){const t=zn(_je);return t?$i.createPortal(e,t):null}function Nje(e){const[t,n]=m.useState(e),i=m.useCallback(r=>n(s=>ene(r,s)),[]);return[t,n,i]}function Cje(e){const[t,n]=m.useState(e),i=m.useCallback(r=>n(s=>tne(r,s)),[]);return[t,n,i]}const jje=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!x$(n.userNode))return!1;return!0};function Rje(e={includeHiddenNodes:!1}){return zn(jje(e))}function Ije({dimensions:e,lineWidth:t,variant:n,className:i}){return l.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Kr(["react-flow__background-pattern",n,i])})}function Pje({radius:e,className:t}){return l.jsx("circle",{cx:e,cy:e,r:e,className:Kr(["react-flow__background-pattern","dots",t])})}var Ef;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ef||(Ef={}));const Mje={[Ef.Dots]:1,[Ef.Lines]:1,[Ef.Cross]:6},Lje=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function _ne({id:e,variant:t=Ef.Dots,gap:n=20,size:i,lineWidth:r=1,offset:s=0,color:a,bgColor:o,style:c,className:u,patternClassName:d}){const f=m.useRef(null),{transform:h,patternId:p}=zn(Lje,ur),g=i||Mje[t],b=t===Ef.Dots,y=t===Ef.Cross,O=Array.isArray(n)?n:[n,n],v=[O[0]*h[2]||1,O[1]*h[2]||1],x=g*h[2],w=Array.isArray(s)?s:[s,s],E=y?[x,x]:v,S=[w[0]*h[2]||1+E[0]/2,w[1]*h[2]||1+E[1]/2],k=`${p}${e||""}`;return l.jsxs("svg",{className:Kr(["react-flow__background",u]),style:{...c,...Q_,"--xy-background-color-props":o,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[l.jsx("pattern",{id:k,x:h[0]%v[0],y:h[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:b?l.jsx(Pje,{radius:x/2,className:d}):l.jsx(Ije,{dimensions:E,lineWidth:r,variant:t,className:d})}),l.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}_ne.displayName="Background";const Dje=m.memo(_ne);function $je(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:l.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Qje(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:l.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Bje(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:l.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Uje(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function zje(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function bw({children:e,className:t,...n}){return l.jsx("button",{type:"button",className:Kr(["react-flow__controls-button",t]),...n,children:e})}const Fje=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Ane({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:a,onFitView:o,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const g=dr(),{isInteractive:b,minZoomReached:y,maxZoomReached:O,ariaLabelConfig:v}=zn(Fje,ur),{zoomIn:x,zoomOut:w,fitView:E}=$_(),S=()=>{x(),s==null||s()},k=()=>{w(),a==null||a()},T=()=>{E(r),o==null||o()},A=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},N=h==="horizontal"?"horizontal":"vertical";return l.jsxs(D_,{className:Kr(["react-flow__controls",N,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??v["controls.ariaLabel"],children:[t&&l.jsxs(l.Fragment,{children:[l.jsx(bw,{onClick:S,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:O,children:l.jsx($je,{})}),l.jsx(bw,{onClick:k,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:y,children:l.jsx(Qje,{})})]}),n&&l.jsx(bw,{className:"react-flow__controls-fitview",onClick:T,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:l.jsx(Bje,{})}),i&&l.jsx(bw,{className:"react-flow__controls-interactive",onClick:A,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:b?l.jsx(zje,{}):l.jsx(Uje,{})}),d]})}Ane.displayName="Controls";const Vje=m.memo(Ane);function Xje({id:e,x:t,y:n,width:i,height:r,style:s,color:a,strokeColor:o,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:g,backgroundColor:b}=s||{},y=a||g||b;return l.jsx("rect",{className:Kr(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:i,height:r,style:{fill:y,stroke:o,strokeWidth:c},shapeRendering:f,onClick:p?O=>p(O,e):void 0})}const qje=m.memo(Xje),Hje=e=>e.nodes.map(t=>t.id),nC=e=>e instanceof Function?e:()=>e;function Yje({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:r,nodeComponent:s=qje,onClick:a}){const o=zn(Hje,ur),c=nC(t),u=nC(e),d=nC(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return l.jsx(l.Fragment,{children:o.map(h=>l.jsx(Wje,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:i,nodeStrokeWidth:r,NodeComponent:s,onClick:a,shapeRendering:f},h))})}function Gje({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:o,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=zn(g=>{const b=g.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const y=b.internals.userNode,{x:O,y:v}=b.internals.positionAbsolute,{width:x,height:w}=fd(y);return{node:y,x:O,y:v,width:x,height:w}},ur);return!u||u.hidden||!x$(u)?null:l.jsx(o,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:i(u),color:t(u),borderRadius:r,strokeColor:n(u),strokeWidth:s,shapeRendering:a,onClick:c,id:u.id})}const Wje=m.memo(Gje);var Zje=m.memo(Yje);const Kje=200,Jje=150,eRe=e=>!e.hidden,tRe=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Ste(L1(e.nodeLookup,{filter:eRe}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},nRe="react-flow__minimap-desc";function Nne({style:e,className:t,nodeStrokeColor:n,nodeColor:i,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:o,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:g,pannable:b=!1,zoomable:y=!1,ariaLabel:O,inversePan:v,zoomStep:x=1,offsetScale:w=5}){const E=dr(),S=m.useRef(null),{boundingRect:k,viewBB:T,rfId:A,panZoom:N,translateExtent:j,flowWidth:M,flowHeight:D,ariaLabelConfig:L}=zn(tRe,ur),Q=(e==null?void 0:e.width)??Kje,C=(e==null?void 0:e.height)??Jje,I=k.width/Q,U=k.height/C,B=Math.max(I,U),P=B*Q,q=B*C,G=w*B,$=k.x-(P-k.width)/2-G,V=k.y-(q-k.height)/2-G,te=P+G*2,fe=q+G*2,Te=`${nRe}-${A}`,J=m.useRef(0),ne=m.useRef();J.current=B,m.useEffect(()=>{if(S.current&&N)return ne.current=KAe({domNode:S.current,panZoom:N,getTransform:()=>E.getState().transform,getViewScale:()=>J.current}),()=>{var je;(je=ne.current)==null||je.destroy()}},[N]),m.useEffect(()=>{var je;(je=ne.current)==null||je.update({translateExtent:j,width:M,height:D,inversePan:v,pannable:b,zoomStep:x,zoomable:y})},[b,y,v,x,j,M,D]);const ce=p?je=>{var ae;const[ve,be]=((ae=ne.current)==null?void 0:ae.pointer(je))||[0,0];p(je,{x:ve,y:be})}:void 0,Oe=g?m.useCallback((je,ve)=>{const be=E.getState().nodeLookup.get(ve).internals.userNode;g(je,be)},[]):void 0,Se=O??L["minimap.ariaLabel"];return l.jsx(D_,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*B:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:Kr(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:l.jsxs("svg",{width:Q,height:C,viewBox:`${$} ${V} ${te} ${fe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Te,ref:S,onClick:ce,children:[Se&&l.jsx("title",{id:Te,children:Se}),l.jsx(Zje,{onClick:Oe,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:a,nodeComponent:o}),l.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-G},${V-G}h${te+G*2}v${fe+G*2}h${-te-G*2}z - M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Nne.displayName="MiniMap";m.memo(Nne);const iRe=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,rRe={[b0.Line]:"right",[b0.Handle]:"bottom-right"};function sRe({nodeId:e,position:t,variant:n=b0.Handle,className:i,style:r=void 0,children:s,color:a,minWidth:o=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:g,onResizeStart:b,onResize:y,onResizeEnd:O}){const v=ane(),x=typeof e=="string"?e:v,w=dr(),E=m.useRef(null),S=n===b0.Handle,k=zn(m.useCallback(iRe(S&&p),[S,p]),ur),T=m.useRef(null),A=t??rRe[n];m.useEffect(()=>{if(!(!E.current||!x))return T.current||(T.current=dNe({domNode:E.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:j,transform:M,snapGrid:D,snapToGrid:L,nodeOrigin:Q,domNode:C}=w.getState();return{nodeLookup:j,transform:M,snapGrid:D,snapToGrid:L,nodeOrigin:Q,paneDomNode:C}},onChange:(j,M)=>{const{triggerNodeChanges:D,nodeLookup:L,parentLookup:Q,nodeOrigin:C}=w.getState(),I=[],U={x:j.x,y:j.y},B=L.get(x);if(B&&B.expandParent&&B.parentId){const P=B.origin??C,q=j.width??B.measured.width??0,G=j.height??B.measured.height??0,$={id:B.id,parentId:B.parentId,rect:{width:q,height:G,...kte({x:j.x??B.position.x,y:j.y??B.position.y},{width:q,height:G},B.parentId,L,P)}},V=T$([$],L,Q,C);I.push(...V),U.x=j.x?Math.max(P[0]*q,j.x):void 0,U.y=j.y?Math.max(P[1]*G,j.y):void 0}if(U.x!==void 0&&U.y!==void 0){const P={id:x,type:"position",position:{...U}};I.push(P)}if(j.width!==void 0&&j.height!==void 0){const q={id:x,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};I.push(q)}for(const P of M){const q={...P,type:"position"};I.push(q)}D(I)},onEnd:({width:j,height:M})=>{const D={id:x,type:"dimensions",resizing:!1,dimensions:{width:j,height:M}};w.getState().triggerNodeChanges([D])}})),T.current.update({controlPosition:A,boundaries:{minWidth:o,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:y,onResizeEnd:O,shouldResize:g}),()=>{var j;(j=T.current)==null||j.destroy()}},[A,o,c,u,d,f,b,y,O,g]);const N=A.split("-");return l.jsx("div",{className:Kr(["react-flow__resize-control","nodrag",...N,n,i]),ref:E,style:{...r,scale:k,...a&&{[S?"backgroundColor":"borderColor"]:a}},children:s})}m.memo(sRe);var Cne=Object.defineProperty,aRe=(e,t,n)=>t in e?Cne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oRe=(e,t)=>{for(var n in t)Cne(e,n,{get:t[n],enumerable:!0})},lRe=(e,t,n)=>aRe(e,t+"",n),jne={};oRe(jne,{Graph:()=>dl,alg:()=>A$,json:()=>Ine,version:()=>dRe});var cRe=Object.defineProperty,Rne=(e,t)=>{for(var n in t)cRe(e,n,{get:t[n],enumerable:!0})},dl=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,n){return t.forEach(i=>{n!==void 0?this.setNode(i,n):this.setNode(i)}),this}setNode(t,n){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let n=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(i=>{this.setParent(i)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n="\0";else{n+="";for(let i=n;i!==void 0;i=this.parent(i))if(i===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}parent(t){if(this._isCompound){let n=this._parent[t];if(n!=="\0")return n}}children(t="\0"){if(this._isCompound){let n=this._children[t];if(n)return Object.keys(n)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let n=this._preds[t];if(n)return Object.keys(n)}successors(t){let n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){let n=this.predecessors(t);if(n){let i=new Set(n);for(let r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){let n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){let n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,a])=>{t(s)&&n.setNode(s,a)}),Object.values(this._edgeObjs).forEach(s=>{n.hasNode(s.v)&&n.hasNode(s.w)&&n.setEdge(s,this.edge(s))});let i={},r=s=>{let a=this.parent(s);return!a||n.hasNode(a)?(i[s]=a??void 0,a??void 0):a in i?i[a]:r(a)};return this._isCompound&&n.nodes().forEach(s=>n.setParent(s,r(s))),n}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){return t.reduce((i,r)=>(n!==void 0?this.setEdge(i,r,n):this.setEdge(i,r),r)),this}setEdge(t,n,i,r){let s,a,o,c,u=!1;typeof t=="object"&&t!==null&&"v"in t?(s=t.v,a=t.w,o=t.name,arguments.length===2&&(c=n,u=!0)):(s=t,a=n,o=r,arguments.length>2&&(c=i,u=!0)),s=""+s,a=""+a,o!==void 0&&(o=""+o);let d=QO(this._isDirected,s,a,o);if(d in this._edgeLabels)return u&&(this._edgeLabels[d]=c),this;if(o!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(a),this._edgeLabels[d]=u?c:this._defaultEdgeLabelFn(s,a,o);let f=uRe(this._isDirected,s,a,o);return s=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,IU(this._preds[a],s),IU(this._sucs[s],a),this._in[a][d]=f,this._out[s][d]=f,this._edgeCount++,this}edge(t,n,i){let r=arguments.length===1?iC(this._isDirected,t):QO(this._isDirected,t,n,i);return this._edgeLabels[r]}edgeAsObj(t,n,i){let r=arguments.length===1?this.edge(t):this.edge(t,n,i);return typeof r!="object"?{label:r}:r}hasEdge(t,n,i){return(arguments.length===1?iC(this._isDirected,t):QO(this._isDirected,t,n,i))in this._edgeLabels}removeEdge(t,n,i){let r=arguments.length===1?iC(this._isDirected,t):QO(this._isDirected,t,n,i),s=this._edgeObjs[r];if(s){let a=s.v,o=s.w;delete this._edgeLabels[r],delete this._edgeObjs[r],PU(this._preds[o],a),PU(this._sucs[a],o),delete this._in[o][r],delete this._out[a][r],this._edgeCount--}return this}inEdges(t,n){return this.isDirected()?this.filterEdges(this._in[t],t,n):this.nodeEdges(t,n)}outEdges(t,n){return this.isDirected()?this.filterEdges(this._out[t],t,n):this.nodeEdges(t,n)}nodeEdges(t,n){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,n)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,n,i){if(!t)return;let r=Object.values(t);return i?r.filter(s=>s.v===n&&s.w===i||s.v===i&&s.w===n):r}};function IU(e,t){e[t]?e[t]++:e[t]=1}function PU(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function QO(e,t,n,i){let r=""+t,s=""+n;if(!e&&r>s){let a=r;r=s,s=a}return r+""+s+""+(i===void 0?"\0":i)}function uRe(e,t,n,i){let r=""+t,s=""+n;if(!e&&r>s){let o=r;r=s,s=o}let a={v:r,w:s};return i&&(a.name=i),a}function iC(e,t){return QO(e,t.v,t.w,t.name)}var dRe="4.0.1",Ine={};Rne(Ine,{read:()=>mRe,write:()=>fRe});function fRe(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:hRe(e),edges:pRe(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function hRe(e){return e.nodes().map(t=>{let n=e.node(t),i=e.parent(t),r={v:t};return n!==void 0&&(r.value=n),i!==void 0&&(r.parent=i),r})}function pRe(e){return e.edges().map(t=>{let n=e.edge(t),i={v:t.v,w:t.w};return t.name!==void 0&&(i.name=t.name),n!==void 0&&(i.value=n),i})}function mRe(e){let t=new dl(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var A$={};Rne(A$,{CycleException:()=>Mk,bellmanFord:()=>Pne,components:()=>ORe,dijkstra:()=>Pk,dijkstraAll:()=>vRe,findCycles:()=>wRe,floydWarshall:()=>ERe,isAcyclic:()=>TRe,postorder:()=>ARe,preorder:()=>NRe,prim:()=>CRe,shortestPaths:()=>jRe,tarjan:()=>Lne,topsort:()=>Dne});var gRe=()=>1;function Pne(e,t,n,i){return bRe(e,String(t),n||gRe,i||function(r){return e.outEdges(r)})}function bRe(e,t,n,i){let r={},s,a=0,o=e.nodes(),c=function(f){let h=n(f);r[f.v].distance+h e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,i=String(e);if(!(i in n)){let r=this._arr,s=r.length;return n[i]=s,r.push({key:i,priority:t}),this._decrease(s),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let i=this._arr[n].priority;if(t>i)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${i} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,i=n+1,r=e;n >1,!(t[i].priority 1;function Pk(e,t,n,i){let r=function(s){return e.outEdges(s)};return xRe(e,String(t),n||yRe,i||r)}function xRe(e,t,n,i){let r={},s=new Mne,a,o,c=function(u){let d=u.v!==a?u.v:u.w,f=r[d],h=n(u),p=o.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p 0&&(a=s.removeMin(),o=r[a],o.distance!==Number.POSITIVE_INFINITY);)i(a).forEach(c);return r}function vRe(e,t,n){return e.nodes().reduce(function(i,r){return i[r]=Pk(e,r,t,n),i},{})}function Lne(e){let t=0,n=[],i={},r=[];function s(a){let o=i[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in i?i[c].onStack&&(o.lowlink=Math.min(o.lowlink,i[c].index)):(s(c),o.lowlink=Math.min(o.lowlink,i[c].lowlink))}),o.lowlink===o.index){let c=[],u;do u=n.pop(),i[u].onStack=!1,c.push(u);while(a!==u);r.push(c)}}return e.nodes().forEach(function(a){a in i||s(a)}),r}function wRe(e){return Lne(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var SRe=()=>1;function ERe(e,t,n){return kRe(e,t||SRe,n||function(i){return e.outEdges(i)})}function kRe(e,t,n){let i={},r=e.nodes();return r.forEach(function(s){i[s]={},i[s][s]={distance:0,predecessor:""},r.forEach(function(a){s!==a&&(i[s][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(s).forEach(function(a){let o=a.v===s?a.w:a.v,c=t(a);i[s][o]={distance:c,predecessor:s}})}),r.forEach(function(s){let a=i[s];r.forEach(function(o){let c=i[o];r.forEach(function(u){let d=c[s],f=a[u],h=c[u],p=d.distance+f.distance;p {var c;return(c=e.isDirected()?e.successors(o):e.neighbors(o))!=null?c:[]},a={};return t.forEach(function(o){if(!e.hasNode(o))throw new Error("Graph does not have node: "+o);r=$ne(e,o,n==="post",a,s,i,r)}),r}function $ne(e,t,n,i,r,s,a){return t in i||(i[t]=!0,n||(a=s(a,t)),r(t).forEach(function(o){a=$ne(e,o,n,i,r,s,a)}),n&&(a=s(a,t))),a}function Qne(e,t,n){return _Re(e,t,n,function(i,r){return i.push(r),i},[])}function ARe(e,t){return Qne(e,t,"post")}function NRe(e,t){return Qne(e,t,"pre")}function CRe(e,t){let n=new dl,i={},r=new Mne,s;function a(c){let u=c.v===s?c.w:c.v,d=r.priority(u);if(d!==void 0){let f=t(c);f 0;){if(s=r.removeMin(),s in i)n.setEdge(s,i[s]);else{if(o)throw new Error("Input graph is not connected: "+e);o=!0}e.nodeEdges(s).forEach(a)}return n}function jRe(e,t,n,i){return RRe(e,t,n,i??(r=>{let s=e.outEdges(r);return s??[]}))}function RRe(e,t,n,i){if(n===void 0)return Pk(e,t,n,i);let r=!1,s=e.nodes();for(let a=0;a t.setNode(n,e.node(n))),e.edges().forEach(n=>{let i=t.edge(n.v,n.w)||{weight:0,minlen:1},r=e.edge(n);t.setEdge(n.v,n.w,{weight:i.weight+r.weight,minlen:Math.max(i.minlen,r.minlen)})}),t}function Bne(e){let t=new dl({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function MU(e,t){let n=e.x,i=e.y,r=t.x-n,s=t.y-i,a=e.width/2,o=e.height/2;if(!r&&!s)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(s)*a>Math.abs(r)*o?(s<0&&(o=-o),c=o*r/s,u=o):(r<0&&(a=-a),c=a,u=a*s/r),{x:n+c,y:i+u}}function Q1(e){let t=wx(zne(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let i=e.node(n),r=i.rank;r!==void 0&&(t[r]||(t[r]=[]),t[r][i.order]=n)}),t}function PRe(e){let t=e.nodes().map(i=>{let r=e.node(i).rank;return r===void 0?Number.MAX_VALUE:r}),n=_c(Math.min,t);e.nodes().forEach(i=>{let r=e.node(i);Object.hasOwn(r,"rank")&&(r.rank-=n)})}function MRe(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=_c(Math.min,t),i=[];e.nodes().forEach(a=>{let o=e.node(a).rank-n;i[o]||(i[o]=[]),i[o].push(a)});let r=0,s=e.graph().nodeRankFactor;Array.from(i).forEach((a,o)=>{a===void 0&&o%s!==0?--r:a!==void 0&&r&&a.forEach(c=>e.node(c).rank+=r)})}function LU(e,t,n,i){let r={width:0,height:0};return arguments.length>=4&&(r.rank=n,r.order=i),tb(e,"border",r,t)}function LRe(e,t=Une){let n=[];for(let i=0;i Une){let n=LRe(t);return e(...n.map(i=>e(...i)))}else return e(...t)}function zne(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return _c(Math.max,t)}function DRe(e,t){let n={lhs:[],rhs:[]};return e.forEach(i=>{t(i)?n.lhs.push(i):n.rhs.push(i)}),n}function Fne(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Vne(e,t){return t()}var $Re=0;function N$(e){let t=++$Re;return e+(""+t)}function wx(e,t,n=1){t==null&&(t=e,e=0);let i=s=>s t i[t]:n=t,Object.entries(e).reduce((i,[r,s])=>(i[r]=n(s,r),i),{})}function QRe(e,t){return e.reduce((n,i,r)=>(n[i]=t[r],n),{})}var U_="\0",BRe="3.0.0",URe=class{constructor(){lRe(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return DU(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&DU(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,zRe)),n=n._prev;return"["+e.join(", ")+"]"}};function DU(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function zRe(e,t){if(e!=="_next"&&e!=="_prev")return t}var FRe=URe,VRe=()=>1;function XRe(e,t){if(e.nodeCount()<=1)return[];let n=HRe(e,t||VRe);return qRe(n.graph,n.buckets,n.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w)||[])}function qRe(e,t,n){var i;let r=[],s=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)rC(e,t,n,o);for(;o=s.dequeue();)rC(e,t,n,o);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(o=(i=t[c])==null?void 0:i.dequeue(),o){r=r.concat(rC(e,t,n,o,!0)||[]);break}}}return r}function rC(e,t,n,i,r){let s=[],a=r?s:void 0;return(e.inEdges(i.v)||[]).forEach(o=>{let c=e.edge(o),u=e.node(o.v);r&&s.push({v:o.v,w:o.w}),u.out-=c,jP(t,n,u)}),(e.outEdges(i.v)||[]).forEach(o=>{let c=e.edge(o),u=o.w,d=e.node(u);d.in-=c,jP(t,n,d)}),e.removeNode(i.v),a}function HRe(e,t){let n=new dl,i=0,r=0;e.nodes().forEach(o=>{n.setNode(o,{v:o,in:0,out:0})}),e.edges().forEach(o=>{let c=n.edge(o.v,o.w)||0,u=t(o),d=c+u;n.setEdge(o.v,o.w,d);let f=n.node(o.v),h=n.node(o.w);r=Math.max(r,f.out+=u),i=Math.max(i,h.in+=u)});let s=YRe(r+i+3).map(()=>new FRe),a=i+1;return n.nodes().forEach(o=>{jP(s,a,n.node(o))}),{graph:n,buckets:s,zeroIdx:a}}function jP(e,t,n){var i,r,s;n.out?n.in?(s=e[n.out-n.in+t])==null||s.enqueue(n):(r=e[e.length-1])==null||r.enqueue(n):(i=e[0])==null||i.enqueue(n)}function YRe(e){let t=[];for(let n=0;n{let i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,N$("rev"))});function t(n){return i=>n.edge(i).weight}}function WRe(e){let t=[],n={},i={};function r(s){Object.hasOwn(i,s)||(i[s]=!0,n[s]=!0,e.outEdges(s).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):r(a.w)}),delete n[s])}return e.nodes().forEach(r),t}function ZRe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let i=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,i)}})}function KRe(e){e.graph().dummyChains=[],e.edges().forEach(t=>JRe(e,t))}function JRe(e,t){let n=t.v,i=e.node(n).rank,r=t.w,s=e.node(r).rank,a=t.name,o=e.edge(t),c=o.labelRank;if(s===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i {let n=e.node(t),i=n.edgeLabel,r;for(e.setEdge(n.edgeObj,i);n.dummy;)r=e.successors(t)[0],e.removeNode(t),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),t=r,n=e.node(t)})}function C$(e){let t={};function n(i){let r=e.node(i);if(Object.hasOwn(t,i))return r.rank;t[i]=!0;let s=e.outEdges(i),a=s?s.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],o=_c(Math.min,a);return o===Number.POSITIVE_INFINITY&&(o=0),r.rank=o}e.sources().forEach(n)}function y0(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Xne=tIe;function tIe(e){let t=new dl({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let i=n[0],r=e.nodeCount();t.setNode(i,{});let s,a;for(;nIe(t,e){let a=s.v,o=i===a?s.w:a;!e.hasNode(o)&&!y0(t,s)&&(e.setNode(o,{}),e.setEdge(i,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function iIe(e,t){return t.edges().reduce((n,i)=>{let r=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(r=y0(t,i)),r t.node(i).rank+=n)}var{preorder:sIe,postorder:aIe}=A$,oIe=Vp;Vp.initLowLimValues=R$;Vp.initCutValues=j$;Vp.calcCutValue=qne;Vp.leaveEdge=Yne;Vp.enterEdge=Gne;Vp.exchangeEdges=Wne;function Vp(e){e=IRe(e),C$(e);let t=Xne(e);R$(t),j$(t,e);let n,i;for(;n=Yne(t);)i=Gne(t,e,n),Wne(t,e,n,i)}function j$(e,t){let n=aIe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(i=>lIe(e,t,i))}function lIe(e,t,n){let i=e.node(n).parent,r=e.edge(n,i);r.cutvalue=qne(e,t,n)}function qne(e,t,n){let i=e.node(n).parent,r=!0,s=t.edge(n,i),a=0;s||(r=!1,s=t.edge(i,n)),a=s.weight;let o=t.nodeEdges(n);return o&&o.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==i){let f=u===r,h=t.edge(c).weight;if(a+=f?h:-h,uIe(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function R$(e,t){arguments.length<2&&(t=e.nodes()[0]),Hne(e,{},1,t)}function Hne(e,t,n,i,r){let s=n,a=e.node(i);t[i]=!0;let o=e.neighbors(i);return o&&o.forEach(c=>{Object.hasOwn(t,c)||(n=Hne(e,t,n,c,i))}),a.low=s,a.lim=n++,r?a.parent=r:delete a.parent,n}function Yne(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Gne(e,t,n){let i=n.v,r=n.w;t.hasEdge(i,r)||(i=n.w,r=n.v);let s=e.node(i),a=e.node(r),o=s,c=!1;return s.lim>a.lim&&(o=a,c=!0),t.edges().filter(u=>c===$U(e,e.node(u.v),o)&&c!==$U(e,e.node(u.w),o)).reduce((u,d)=>y0(t,d) !e.node(r).parent);if(!n)return;let i=sIe(e,[n]);i=i.slice(1),i.forEach(r=>{let s=e.node(r).parent,a=t.edge(r,s),o=!1;a||(a=t.edge(s,r),o=!0),t.node(r).rank=t.node(s).rank+(o?a.minlen:-a.minlen)})}function uIe(e,t,n){return e.hasEdge(t,n)}function $U(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var dIe=fIe;function fIe(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":QU(e);break;case"tight-tree":pIe(e);break;case"longest-path":hIe(e);break;case"none":break;default:QU(e)}}var hIe=C$;function pIe(e){C$(e),Xne(e)}function QU(e){oIe(e)}var mIe=gIe;function gIe(e){let t=OIe(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),r=i.edgeObj,s=bIe(e,t,r.v,r.w),a=s.path,o=s.lca,c=0,u=a[c],d=!0;for(;n!==r.w;){if(i=e.node(n),d){for(;(u=a[c])!==o&&e.node(u).maxRank a||o>t[c].lim));let u=c,d=i;for(;(d=e.parent(d))!==u;)s.push(d);return{path:r.concat(s.reverse()),lca:u}}function OIe(e){let t={},n=0;function i(r){let s=n;e.children(r).forEach(i),t[r]={low:s,lim:n++}}return e.children(U_).forEach(i),t}function yIe(e){let t=tb(e,"root",{},"_root"),n=xIe(e),i=Object.values(n),r=_c(Math.max,i)-1,s=2*r+1;e.graph().nestingRoot=t,e.edges().forEach(o=>e.edge(o).minlen*=s);let a=vIe(e)+1;e.children(U_).forEach(o=>Zne(e,t,s,a,r,n,o)),e.graph().nodeRankFactor=s}function Zne(e,t,n,i,r,s,a){var o;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=LU(e,"_bt"),d=LU(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var p;Zne(e,t,n,i,r,s,h);let g=e.node(h),b=g.borderTop?g.borderTop:h,y=g.borderBottom?g.borderBottom:h,O=g.borderTop?i:2*i,v=b!==y?1:r-((p=s[a])!=null?p:0)+1;e.setEdge(u,b,{weight:O,minlen:v,nestingEdge:!0}),e.setEdge(y,d,{weight:O,minlen:v,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:r+((o=s[a])!=null?o:0)})}function xIe(e){let t={};function n(i,r){let s=e.children(i);s&&s.length&&s.forEach(a=>n(a,r+1)),t[i]=r}return e.children(U_).forEach(i=>n(i,1)),t}function vIe(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function wIe(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var SIe=EIe;function EIe(e){function t(n){let i=e.children(n),r=e.node(n);if(i.length&&i.forEach(t),Object.hasOwn(r,"minRank")){r.borderLeft=[],r.borderRight=[];for(let s=r.minRank,a=r.maxRank+1;sUU(e.node(t))),e.edges().forEach(t=>UU(e.edge(t)))}function UU(e){let t=e.width;e.width=e.height,e.height=t}function _Ie(e){e.nodes().forEach(t=>sC(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(sC),Object.hasOwn(i,"y")&&sC(i)})}function sC(e){e.y=-e.y}function AIe(e){e.nodes().forEach(t=>aC(e.node(t))),e.edges().forEach(t=>{var n;let i=e.edge(t);(n=i.points)==null||n.forEach(aC),Object.hasOwn(i,"x")&&aC(i)})}function aC(e){let t=e.x;e.x=e.y,e.y=t}function NIe(e){let t={},n=e.nodes().filter(o=>!e.children(o).length),i=n.map(o=>e.node(o).rank),r=_c(Math.max,i),s=wx(r+1).map(()=>[]);function a(o){if(t[o])return;t[o]=!0;let c=e.node(o);s[c.rank].push(o);let u=e.successors(o);u&&u.forEach(a)}return n.sort((o,c)=>e.node(o).rank-e.node(c).rank).forEach(a),s}function CIe(e,t){let n=0;for(let i=1;i d)),r=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:i[f.w],weight:e.edge(f).weight})).sort((f,h)=>f.pos-h.pos):[]}),s=1;for(;s {let d=u.pos+s;o[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=o[d+1]),d=d-1>>1,o[d]+=u.weight;c+=u.weight*f}),c}function RIe(e,t=[]){return t.map(n=>{let i=e.inEdges(n);if(!i||!i.length)return{v:n};{let r=i.reduce((s,a)=>{let o=e.edge(a),c=e.node(a.v);return{sum:s.sum+o.weight*c.order,weight:s.weight+o.weight}},{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}})}function IIe(e,t){let n={};e.forEach((r,s)=>{let a={indegree:0,in:[],out:[],vs:[r.v],i:s};r.barycenter!==void 0&&(a.barycenter=r.barycenter,a.weight=r.weight),n[r.v]=a}),t.edges().forEach(r=>{let s=n[r.v],a=n[r.w];s!==void 0&&a!==void 0&&(a.indegree++,s.out.push(a))});let i=Object.values(n).filter(r=>!r.indegree);return PIe(i)}function PIe(e){let t=[];function n(r){return s=>{s.merged||(s.barycenter===void 0||r.barycenter===void 0||s.barycenter>=r.barycenter)&&MIe(r,s)}}function i(r){return s=>{s.in.push(r),--s.indegree===0&&e.push(s)}}for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(n(r)),r.out.forEach(i(r))}return t.filter(r=>!r.merged).map(r=>Lk(r,["vs","i","barycenter","weight"]))}function MIe(e,t){let n=0,i=0;e.weight&&(n+=e.barycenter*e.weight,i+=e.weight),t.weight&&(n+=t.barycenter*t.weight,i+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/i,e.weight=i,e.i=Math.min(t.i,e.i),t.merged=!0}function LIe(e,t){let n=DRe(e,d=>Object.hasOwn(d,"barycenter")),i=n.lhs,r=n.rhs.sort((d,f)=>f.i-d.i),s=[],a=0,o=0,c=0;i.sort(DIe(!!t)),c=zU(s,r,c),i.forEach(d=>{c+=d.vs.length,s.push(d.vs),a+=d.barycenter*d.weight,o+=d.weight,c=zU(s,r,c)});let u={vs:s.flat(1)};return o&&(u.barycenter=a/o,u.weight=o),u}function zU(e,t,n){let i;for(;t.length&&(i=t[t.length-1]).i<=n;)t.pop(),e.push(i.vs),n++;return n}function DIe(e){return(t,n)=>t.barycenter n.barycenter?1:e?n.i-t.i:t.i-n.i}function Jne(e,t,n,i){let r=e.children(t),s=e.node(t),a=s?s.borderLeft:void 0,o=s?s.borderRight:void 0,c={};a&&(r=r.filter(h=>h!==a&&h!==o));let u=RIe(e,r);u.forEach(h=>{if(e.children(h.v).length){let p=Jne(e,h.v,n,i);c[h.v]=p,Object.hasOwn(p,"barycenter")&&QIe(h,p)}});let d=IIe(u,n);$Ie(d,c);let f=LIe(d,i);if(a&&o){f.vs=[a,f.vs,o].flat(1);let h=e.predecessors(a);if(h&&h.length){let p=e.node(h[0]),g=e.predecessors(o),b=e.node(g[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+b.order)/(f.weight+2),f.weight+=2}}return f}function $Ie(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(i=>t[i]?t[i].vs:i)})}function QIe(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function BIe(e,t,n,i){i||(i=e.nodes());let r=UIe(e),s=new dl({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(a=>e.node(a));return i.forEach(a=>{let o=e.node(a),c=e.parent(a);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){s.setNode(a),s.setParent(a,c||r);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=s.edge(f,a),p=h!==void 0?h.weight:0;s.setEdge(f,a,{weight:e.edge(d).weight+p})}),Object.hasOwn(o,"minRank")&&s.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),s}function UIe(e){let t;for(;e.hasNode(t=N$("_root")););return t}function zIe(e,t,n){let i={},r;n.forEach(s=>{let a=e.parent(s),o,c;for(;a;){if(o=e.parent(a),o?(c=i[o],i[o]=a):(c=r,r=a),c&&c!==a){t.setEdge(c,a);return}a=o}})}function eie(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,eie);return}let n=zne(e),i=FU(e,wx(1,n+1),"inEdges"),r=FU(e,wx(n-1,-1,-1),"outEdges"),s=NIe(e);if(VU(e,s),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,o,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){FIe(u%2?i:r,u%4>=2,c),s=Q1(e);let f=CIe(e,s);f{i.has(s)||i.set(s,[]),i.get(s).push(a)};for(let s of e.nodes()){let a=e.node(s);if(typeof a.rank=="number"&&r(a.rank,s),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let o=a.minRank;o<=a.maxRank;o++)o!==a.rank&&r(o,s)}return t.map(function(s){return BIe(e,s,n,i.get(s)||[])})}function FIe(e,t,n){let i=new dl;e.forEach(function(r){n.forEach(o=>i.setEdge(o.left,o.right));let s=r.graph().root,a=Jne(r,s,i,t);a.vs.forEach((o,c)=>r.node(o).order=c),zIe(r,i,a.vs)})}function VU(e,t){Object.values(t).forEach(n=>n.forEach((i,r)=>e.node(i).order=r))}function VIe(e,t){let n={};function i(r,s){let a=0,o=0,c=r.length,u=s[s.length-1];return s.forEach((d,f)=>{let h=qIe(e,d),p=h?e.node(h).order:c;(h||d===u)&&(s.slice(o,f+1).forEach(g=>{let b=e.predecessors(g);b&&b.forEach(y=>{let O=e.node(y),v=O.order;(v{let f=s[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(p=>{if(p===void 0)return;let g=e.node(p);g.dummy&&(g.order u)&&tie(n,p,f)})}})}function r(s,a){let o=-1,c=-1,u=0;return a.forEach((d,f)=>{if(e.node(d).dummy==="border"){let h=e.predecessors(d);if(h&&h.length){let p=h[0];if(p===void 0)return;c=e.node(p).order,i(a,u,f,o,c),u=f,o=c}}i(a,u,a.length,c,s.length)}),a}return t.length&&t.reduce(r),n}function qIe(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(i=>e.node(i).dummy)}}function tie(e,t,n){if(t>n){let r=t;t=n,n=r}let i=e[t];i||(e[t]=i={}),i[n]=!0}function HIe(e,t,n){if(t>n){let r=t;t=n,n=r}let i=e[t];return i!==void 0&&Object.hasOwn(i,n)}function YIe(e,t,n,i){let r={},s={},a={};return t.forEach(o=>{o.forEach((c,u)=>{r[c]=c,s[c]=c,a[c]=u})}),t.forEach(o=>{let c=-1;o.forEach(u=>{let d=i(u);if(d&&d.length){let f=d.sort((p,g)=>{let b=a[p],y=a[g];return(b!==void 0?b:0)-(y!==void 0?y:0)}),h=(f.length-1)/2;for(let p=Math.floor(h),g=Math.ceil(h);p<=g;++p){let b=f[p];if(b===void 0)continue;let y=a[b];if(y!==void 0&&s[u]===u&&c {var O;let v=(O=s[y.v])!=null?O:0,x=a.edge(y);return Math.max(b,v+(x!==void 0?x:0))},0):s[p]=0}function d(p){let g=a.outEdges(p),b=Number.POSITIVE_INFINITY;g&&(b=g.reduce((O,v)=>{let x=s[v.w],w=a.edge(v);return Math.min(O,(x!==void 0?x:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let y=e.node(p);b!==Number.POSITIVE_INFINITY&&y.borderType!==o&&(s[p]=Math.max(s[p]!==void 0?s[p]:0,b))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(i).forEach(p=>{var g;let b=n[p];b!==void 0&&(s[p]=(g=s[b])!=null?g:0)}),s}function WIe(e,t,n,i){let r=new dl,s=e.graph(),a=tPe(s.nodesep,s.edgesep,i);return t.forEach(o=>{let c;o.forEach(u=>{let d=n[u];if(d!==void 0){if(r.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=r.edge(f,d);r.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),r}function ZIe(e,t){return Object.values(t).reduce((n,i)=>{let r=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY;Object.entries(i).forEach(([o,c])=>{let u=nPe(e,o)/2;r=Math.max(c+u,r),s=Math.min(c-u,s)});let a=r-s;return a {["l","r"].forEach(a=>{let o=s+a,c=e[o];if(!c||c===t)return;let u=Object.values(c),d=i-_c(Math.min,u);a!=="l"&&(d=r-_c(Math.max,u)),d&&(e[o]=B_(c,f=>f+d))})})}function JIe(e,t=void 0){let n=e.ul;return n?B_(n,(i,r)=>{var s,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[r]!==void 0)return u[r]}let o=Object.values(e).map(c=>{let u=c[r];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((s=o[1])!=null?s:0)+((a=o[2])!=null?a:0))/2}):{}}function ePe(e){let t=Q1(e),n=Object.assign(VIe(e,t),XIe(e,t)),i={},r;["u","d"].forEach(a=>{r=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(o=>{o==="r"&&(r=r.map(d=>Object.values(d).reverse()));let c=YIe(e,r,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=GIe(e,r,c.root,c.align,o==="r");o==="r"&&(u=B_(u,d=>-d)),i[a+o]=u})});let s=ZIe(e,i);return KIe(i,s),JIe(i,e.graph().align)}function tPe(e,t,n){return(i,r,s)=>{let a=i.node(r),o=i.node(s),c=0,u;if(c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(a.dummy?t:e)/2,c+=(o.dummy?t:e)/2,c+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(c+=n?u:-u),c}}function nPe(e,t){return e.node(t).width}function iPe(e){e=Bne(e),rPe(e),Object.entries(ePe(e)).forEach(([t,n])=>e.node(t).x=n)}function rPe(e){let t=Q1(e),n=e.graph(),i=n.ranksep,r=n.rankalign,s=0;t.forEach(a=>{let o=a.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);a.forEach(c=>{let u=e.node(c);r==="top"?u.y=s+u.height/2:r==="bottom"?u.y=s+o-u.height/2:u.y=s+o/2}),s+=o+i})}function sPe(e,t={}){let n=t.debugTiming?Fne:Vne;return n("layout",()=>{let i=n(" buildLayoutGraph",()=>mPe(e));return n(" runLayout",()=>aPe(i,n,t)),n(" updateInputGraph",()=>oPe(e,i)),i})}function aPe(e,t,n){t(" makeSpaceForEdgeLabels",()=>gPe(e)),t(" removeSelfEdges",()=>kPe(e)),t(" acyclic",()=>GRe(e)),t(" nestingGraph.run",()=>yIe(e)),t(" rank",()=>dIe(Bne(e))),t(" injectEdgeLabelProxies",()=>bPe(e)),t(" removeEmptyRanks",()=>MRe(e)),t(" nestingGraph.cleanup",()=>wIe(e)),t(" normalizeRanks",()=>PRe(e)),t(" assignRankMinMax",()=>OPe(e)),t(" removeEdgeLabelProxies",()=>yPe(e)),t(" normalize.run",()=>KRe(e)),t(" parentDummyChains",()=>mIe(e)),t(" addBorderSegments",()=>SIe(e)),t(" order",()=>eie(e,n)),t(" insertSelfEdges",()=>TPe(e)),t(" adjustCoordinateSystem",()=>kIe(e)),t(" position",()=>iPe(e)),t(" positionSelfEdges",()=>_Pe(e)),t(" removeBorderNodes",()=>EPe(e)),t(" normalize.undo",()=>eIe(e)),t(" fixupEdgeLabelCoords",()=>wPe(e)),t(" undoCoordinateSystem",()=>TIe(e)),t(" translateGraph",()=>xPe(e)),t(" assignNodeIntersects",()=>vPe(e)),t(" reversePoints",()=>SPe(e)),t(" acyclic.undo",()=>ZRe(e))}function oPe(e,t){e.nodes().forEach(n=>{let i=e.node(n),r=t.node(n);i&&(i.x=r.x,i.y=r.y,i.order=r.order,i.rank=r.rank,t.children(n).length&&(i.width=r.width,i.height=r.height))}),e.edges().forEach(n=>{let i=e.edge(n),r=t.edge(n);i.points=r.points,Object.hasOwn(r,"x")&&(i.x=r.x,i.y=r.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var lPe=["nodesep","edgesep","ranksep","marginx","marginy"],cPe={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},uPe=["acyclicer","ranker","rankdir","align","rankalign"],dPe=["width","height","rank"],XU={width:0,height:0},fPe=["minlen","weight","width","height","labeloffset"],hPe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},pPe=["labelpos"];function mPe(e){let t=new dl({multigraph:!0,compound:!0}),n=lC(e.graph());return t.setGraph(Object.assign({},cPe,oC(n,lPe),Lk(n,uPe))),e.nodes().forEach(i=>{let r=lC(e.node(i)),s=oC(r,dPe);Object.keys(XU).forEach(o=>{s[o]===void 0&&(s[o]=XU[o])}),t.setNode(i,s);let a=e.parent(i);a!==void 0&&t.setParent(i,a)}),e.edges().forEach(i=>{let r=lC(e.edge(i));t.setEdge(i,Object.assign({},hPe,oC(r,fPe),Lk(r,pPe)))}),t}function gPe(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let i=e.edge(n);i.minlen*=2,i.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})}function bPe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let i=e.node(t.v),r={rank:(e.node(t.w).rank-i.rank)/2+i.rank,e:t};tb(e,"edge-proxy",r,"_ep")}})}function OPe(e){let t=0;e.nodes().forEach(n=>{let i=e.node(n);i.borderTop&&(i.minRank=e.node(i.borderTop).rank,i.maxRank=e.node(i.borderBottom).rank,t=Math.max(t,i.maxRank))}),e.graph().maxRank=t}function yPe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let i=n;e.edge(i.e).labelRank=n.rank,e.removeNode(t)}})}function xPe(e){let t=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,r=0,s=e.graph(),a=s.marginx||0,o=s.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,p=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),i=Math.min(i,f-p/2),r=Math.max(r,f+p/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=a,i-=o,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=i}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=i}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=i)}),s.width=n-t+a,s.height=r-i+o}function vPe(e){e.edges().forEach(t=>{let n=e.edge(t),i=e.node(t.v),r=e.node(t.w),s,a;n.points?(s=n.points[0],a=n.points[n.points.length-1]):(n.points=[],s=r,a=i),n.points.unshift(MU(i,s)),n.points.push(MU(r,a))})}function wPe(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function SPe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function EPe(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),i=e.node(n.borderTop),r=e.node(n.borderBottom),s=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-s.x),n.height=Math.abs(r.y-i.y),n.x=s.x+n.width/2,n.y=i.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function kPe(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function TPe(e){Q1(e).forEach(t=>{let n=0;t.forEach((i,r)=>{let s=e.node(i);s.order=r+n,(s.selfEdges||[]).forEach(a=>{tb(e,"selfedge",{width:a.label.width,height:a.label.height,rank:s.rank,order:r+ ++n,e:a.e,label:a.label},"_se")}),delete s.selfEdges})})}function _Pe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let i=n,r=e.node(i.e.v),s=r.x+r.width/2,a=r.y,o=n.x-s,c=r.height/2;e.setEdge(i.e,i.label),e.removeNode(t),i.label.points=[{x:s+2*o/3,y:a-c},{x:s+5*o/6,y:a-c},{x:s+o,y:a},{x:s+5*o/6,y:a+c},{x:s+2*o/3,y:a+c}],i.label.x=n.x,i.label.y=n.y}})}function oC(e,t){return B_(Lk(e,t),Number)}function lC(e){let t={};return e&&Object.entries(e).forEach(([n,i])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=i}),t}function APe(e){let t=Q1(e),n=new dl({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(i=>{n.setNode(i,{label:i}),n.setParent(i,"layer"+e.node(i).rank)}),e.edges().forEach(i=>n.setEdge(i.v,i.w,{},i.name)),t.forEach((i,r)=>{let s="layer"+r;n.setNode(s,{rank:"same"}),i.reduce((a,o)=>(n.setEdge(a,o,{style:"invis"}),o))}),n}var NPe={graphlib:jne,version:BRe,layout:sPe,debug:APe,util:{time:Fne,notime:Vne}},qU=NPe;/*! For license information please see dagre.esm.js.LEGAL.txt */const BO={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:SJ},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:NSe},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:hSe},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:CJ},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:x_}},RP=220,IP=88,HU=96,YU=34,vy=64,cC=310,ug=24,nie=56,PP=40,GU=40,CPe=18,jPe=58,RPe=!1,IPe=e=>e==="sequential"||e==="parallel"||e==="loop";function MP(e,t){const n=e.agentType??"llm";return IPe(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function LP(e,t=[],n="horizontal",i=!1){const r=e.agentType??"llm";if(!MP(e,t))return{width:RP,height:IP};if(i&&e.subAgents.length===0)return{width:cC,height:vy};const s=e.subAgents.map((f,h)=>LP(f,[...t,h],n,i)),a=s.length?Math.max(...s.map(f=>f.width)):0,o=s.length?Math.max(...s.map(f=>f.height)):0,c=s.length&&r!=="parallel"?nie:ug,u=n==="horizontal"?r!=="parallel":r==="parallel",d=s.length?r==="parallel"?CPe+GU:r==="loop"?jPe:0:GU;return u?{width:Math.max(cC,s.reduce((f,h)=>f+h.width,0)+PP*Math.max(0,s.length-1)+c*2),height:vy+ug+o+d+ug}:{width:Math.max(cC,a+ug*2),height:vy+c+s.reduce((f,h)=>f+h.height,0)+PP*Math.max(0,s.length-1)+d+c}}function rO(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function PPe(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function WU(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function sO(e,t,n,i){const r=(i==null?void 0:i.tone)==="sequential"?"hsl(213 40% 40%)":(i==null?void 0:i.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${i!=null&&i.loop?"-loop":""}`,source:e,target:t,sourceHandle:i!=null&&i.loop?"loop-source":void 0,targetHandle:i!=null&&i.loop?"loop-target":void 0,label:n,type:"insertStep",data:i?{insert:i.insert,loop:i.loop,tone:i.tone}:void 0,animated:i==null?void 0:i.loop,markerEnd:{type:Ox.ArrowClosed,width:16,height:16,color:r},style:{stroke:r,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function ZU(e,t,n=!1){const i=[{id:"terminal-input",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"用户请求"},selectable:!1,draggable:!1},{id:"terminal-output",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"最终回复"},selectable:!1,draggable:!1}],r=[];function s(d,f,h,p,g){const b=d.agentType??"llm",y=rO(f);return MP(d,f)?(a(d,f,h,p,g),y):(i.push({id:y,type:"agent",parentId:h,extent:"parent",position:p,data:{kind:"agent",path:f,agent:d,title:b==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:b,description:d.description.trim()||BO[b].description,childCount:d.subAgents.length,containedIn:g}}),y)}function a(d,f,h,p={x:0,y:0},g){const b=d.agentType??"sequential",y=rO(f),O=LP(d,f,t,n);i.push({id:y,type:"group",parentId:h,extent:h?"parent":void 0,position:p,style:{width:O.width,height:O.height},data:{kind:"agent",path:f,agent:d,title:d.name.trim()||(f.length===0?"主 Agent":BO[b].label),pattern:b,description:d.description.trim()||BO[b].description,childCount:d.subAgents.length,containedIn:g,layoutWidth:O.width,layoutHeight:O.height,compactEmptyGroup:n&&d.subAgents.length===0}});const v=d.subAgents.map((k,T)=>LP(k,[...f,T],t,n)),x=v.length&&b!=="parallel"?nie:ug,w=t==="horizontal"?b!=="parallel":b==="parallel";let E=x;const S=d.subAgents.map((k,T)=>{const A=v[T],N=w?{x:E,y:vy+ug}:{x:(O.width-A.width)/2,y:vy+E};return E+=(w?A.width:A.height)+PP,s(k,[...f,T],y,N,b)});if(b==="sequential"||b==="loop"){for(let k=0;k 1&&r.push(sO(S[S.length-1],S[0],"继续循环",{loop:!0,tone:"loop"}))}return y}const o=(d,f)=>{const h=d.agentType??"llm",p=rO(f);if(MP(d,f))return a(d,f),[p];if(i.push({id:p,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:f,agent:d,title:h==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:h,description:d.description.trim()||BO[h].description,childCount:d.subAgents.length}}),d.subAgents.length===0)return[p];const g=[];return d.subAgents.forEach((b,y)=>{const O=[...f,y],v=rO(O);r.push(sO(p,v,"调用",{insert:{parentPath:f,index:y}})),g.push(...o(b,O))}),g},c=rO([]),u=o(e,[]);return r.push(sO("terminal-input",c)),u.forEach(d=>r.push(sO(d,"terminal-output"))),MPe(i,r,t)}function MPe(e,t,n){const i=new qU.graphlib.Graph().setDefaultEdgeLabel(()=>({}));i.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const r=new Set(e.filter(s=>!s.parentId).map(s=>s.id));return e.filter(s=>!s.parentId).forEach(s=>{const a=s.data.kind==="terminal";i.setNode(s.id,{width:a?HU:s.data.layoutWidth??RP,height:a?YU:s.data.layoutHeight??IP})}),t.filter(s=>r.has(s.source)&&r.has(s.target)).forEach(s=>i.setEdge(s.source,s.target)),qU.layout(i),{nodes:e.map(s=>{if(s.parentId)return s;const a=i.node(s.id),o=s.data.kind==="terminal",c=o?HU:s.data.layoutWidth??RP,u=o?YU:s.data.layoutHeight??IP;return{...s,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const z_=m.createContext(null),F_=m.createContext("horizontal");function LPe({id:e,sourceX:t,sourceY:n,targetX:i,targetY:r,sourcePosition:s,targetPosition:a,markerEnd:o,style:c,label:u,data:d}){const f=m.useContext(z_),[h,p]=m.useState(!1),[g,b,y]=Rk({sourceX:t,sourceY:n,targetX:i,targetY:r,sourcePosition:s,targetPosition:a,offset:d!=null&&d.loop?28:20});return l.jsxs(l.Fragment,{children:[l.jsx($1,{id:e,path:g,markerEnd:o,style:c}),f&&(d==null?void 0:d.insert)&&l.jsx("path",{d:g,className:"abc-edge-hover-path",onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1)}),(u||f&&(d==null?void 0:d.insert))&&l.jsx(Aje,{children:l.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${b}px, ${y}px)`},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),children:[u&&l.jsx("span",{className:"abc-edge-label",children:u}),f&&(d==null?void 0:d.insert)&&l.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":"在这里插入步骤",title:"在这里插入步骤",onClick:O=>{O.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:l.jsx(Ks,{})})]})})]})}function DPe({data:e,selected:t}){const n=m.useContext(z_),i=m.useContext(F_),r=i==="vertical"?wt.Top:wt.Left,s=i==="vertical"?wt.Bottom:wt.Right,a=i==="vertical"?wt.Right:wt.Bottom,o=e.pattern??"llm",c=BO[o],u=c.icon;return l.jsxs("div",{className:`abc-node is-${o}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[l.jsx(Ua,{type:"target",position:r,className:"abc-handle"}),o!=="llm"&&l.jsx("span",{className:"abc-node-icon",children:l.jsx(u,{})}),l.jsxs("span",{className:"abc-node-copy",children:[l.jsx("span",{className:"abc-node-meta",children:l.jsx("span",{children:c.label})}),l.jsx("strong",{children:e.title}),l.jsx("small",{children:e.description})]}),n&&e.path!==void 0&&e.path.length>0&&l.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:l.jsx(Lf,{})}),l.jsx(Ua,{type:"source",position:s,className:"abc-handle"}),e.containedIn==="loop"&&l.jsxs(l.Fragment,{children:[l.jsx(Ua,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),l.jsx(Ua,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function $Pe({data:e,selected:t}){const n=m.useContext(z_),i=m.useContext(F_),r=i==="vertical"?wt.Top:wt.Left,s=i==="vertical"?wt.Bottom:wt.Right,a=i==="vertical"?wt.Right:wt.Bottom,o=e.pattern??"sequential",c=e.childCount??0,u=o==="llm"?"添加子 Agent":o==="parallel"?"添加一个同时处理的步骤":o==="loop"?"添加循环步骤":"添加下一个步骤";return l.jsxs("div",{className:`abc-group is-${o}${e.compactEmptyGroup?" is-compact-empty":""}${t?" is-selected":""}`,children:[l.jsx(Ua,{type:"target",position:r,className:"abc-handle"}),l.jsx("header",{className:"abc-group-head",children:l.jsxs("span",{children:[l.jsx("strong",{title:e.title,children:e.title}),l.jsx("small",{children:e.description})]})}),n&&e.path!==void 0&&c>0&&o!=="parallel"&&l.jsxs("div",{className:"abc-group-boundary-actions",children:[l.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":"添加到最前",title:"添加到最前",onClick:d=>{d.stopPropagation(),n.onInsert(e.path,0)},children:l.jsx(Ks,{})}),l.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":"添加到最后",title:"添加到最后",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:l.jsx(Ks,{})})]}),n&&e.path!==void 0&&c>0&&o==="parallel"&&l.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[l.jsx(Ks,{}),l.jsx("span",{children:u})]}),n&&e.path!==void 0&&c===0&&l.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[l.jsx(Ks,{}),l.jsx("span",{children:u})]}),n&&e.path!==void 0&&e.path.length>0&&l.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:l.jsx(Lf,{})}),l.jsx(Ua,{type:"source",position:s,className:"abc-handle"}),e.containedIn==="loop"&&l.jsxs(l.Fragment,{children:[l.jsx(Ua,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),l.jsx(Ua,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function QPe({data:e}){const t=m.useContext(F_);return l.jsxs("div",{className:"abc-terminal",children:[l.jsx(Ua,{type:"target",position:t==="vertical"?wt.Top:wt.Left,className:"abc-handle"}),l.jsx("span",{children:e.title}),l.jsx(Ua,{type:"source",position:t==="vertical"?wt.Bottom:wt.Right,className:"abc-handle"})]})}const BPe={agent:DPe,group:$Pe,terminal:QPe},UPe={insertStep:LPe};function zPe({draft:e,selectedPath:t,onSelect:n,onAdd:i,onInsert:r,onDelete:s,readOnly:a=!1,interactivePreview:o=!1,direction:c="horizontal"}){const u=m.useMemo(()=>ZU(e,c,a),[]),[d,f,h]=Nje(u.nodes),[p,g,b]=Cje(u.edges),y=Rje(),O=m.useRef(`${c}:${a?"readonly":"editable"}:${WU(e)}`),v=m.useRef(null),{fitView:x}=$_(),w=m.useMemo(()=>ZU(e,c,a),[c,e,a]),[E,S]=m.useState(()=>window.matchMedia("(max-width: 860px)").matches),k=m.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:E?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[E,a]),T=m.useCallback((N=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const j=v.current;if(j&&(j.clientWidth===0||j.clientHeight===0)&&N<8){T(N+1);return}x(k)})})},[k,x]);m.useEffect(()=>{const N=window.matchMedia("(max-width: 860px)"),j=M=>S(M.matches);return N.addEventListener("change",j),()=>N.removeEventListener("change",j)},[]),m.useEffect(()=>{const N=`${c}:${a?"readonly":"editable"}:${WU(e)}`,j=N!==O.current;O.current=N,g(w.edges),f(M=>{const D=new Map(M.map(L=>[L.id,L]));return w.nodes.map(L=>{const Q=D.get(L.id);return{...L,measured:!j&&Q&&Q.type===L.type?Q.measured:void 0,position:!j&&Q?Q.position:L.position,selected:L.data.kind==="agent"&&!!L.data.path&&PPe(L.data.path,t)}})}),j&&T()},[w,e,T,t,g,f]),m.useEffect(()=>{T()},[E,T]),m.useEffect(()=>{y&&T()},[w,T,y]),m.useEffect(()=>{if(!a||!v.current)return;const N=new ResizeObserver(()=>T());return N.observe(v.current),T(),()=>N.disconnect()},[T,a]);const A=m.useMemo(()=>a?null:{onAdd:i,onInsert:r,onDelete:s},[i,s,r,a]);return l.jsx(F_.Provider,{value:c,children:l.jsx(z_.Provider,{value:A,children:l.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":a?"只读 Agent 执行画布":"Agent 执行画布",children:l.jsx("div",{ref:v,className:"abc-canvas",children:l.jsxs(Tje,{nodes:d,edges:p,nodeTypes:BPe,edgeTypes:UPe,onNodesChange:h,onEdgesChange:b,onNodeClick:(N,j)=>{!a&&j.data.kind==="agent"&&j.data.path&&n(j.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||o,zoomOnDoubleClick:o,zoomOnPinch:!a||o,zoomOnScroll:!a||o,fitView:!0,fitViewOptions:k,onInit:()=>T(),minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[l.jsx(Dje,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||o)&&l.jsx(Vje,{showInteractive:!1}),RPe]})})})})})}function Sx(e){return l.jsx(Tne,{children:l.jsx(zPe,{...e})})}const FPe="https://ark.cn-beijing.volces.com/api/v3/",KS=[{key:"MODEL_EMBEDDING_NAME",required:!1,placeholder:"doubao-embedding-vision-250615",comment:"向量化模型(记忆/知识库需要)"},{key:"MODEL_EMBEDDING_DIM",required:!1,placeholder:"2048"},{key:"MODEL_EMBEDDING_API_BASE",required:!1,placeholder:FPe}],Ex=[],Dk={label:"控制台",url:"https://console.volcengine.com/vikingdb/openviking"},VPe={label:"文档",url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},iie="https://api.vikingdb.cn-beijing.volces.com/openviking",XPe=`{ +`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??mU,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var y,O;if(r.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!r.current||r.current&&!u)&&Ate(p))return!1;const b=bU(p.code,o);if(s.current.add(p[b]),gU(a,s.current,!1)){const v=((O=(y=p.composedPath)==null?void 0:y.call(p))==null?void 0:O[0])||p.target,x=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(r.current||!x)&&p.preventDefault(),i(!0)}},f=p=>{const g=bU(p.code,o);gU(a,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(p[g]),p.key==="Meta"&&s.current.clear(),r.current=!1},h=()=>{s.current.clear(),i(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,i]),n}function gU(e,t,n){return e.filter(i=>n||i.length===t.size).some(i=>i.every(r=>t.has(r)))}function bU(e,t){return t.includes(e)?"code":"key"}const rCe=()=>{const e=dr();return m.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[i,r,s],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??i,y:t.y??r,zoom:t.zoom??s},n),!0):!1},getViewport:()=>{const[t,n,i]=e.getState().transform;return{x:t,y:n,zoom:i}},setCenter:async(t,n,i)=>e.getState().setCenter(t,n,i),fitBounds:async(t,n)=>{const{width:i,height:r,minZoom:s,maxZoom:a,panZoom:o}=e.getState(),c=y$(t,i,r,s,a,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:i,snapGrid:r,snapToGrid:s,domNode:a}=e.getState();if(!a)return t;const{x:o,y:c}=a.getBoundingClientRect(),u={x:t.x-o,y:t.y-c},d=n.snapGrid??r,f=n.snapToGrid??s;return eb(u,i,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:r,y:s}=i.getBoundingClientRect(),a=g0(t,n);return{x:a.x+r,y:a.y+s}}}),[])};function ene(e,t){const n=[],i=new Map,r=[];for(const s of e)if(s.type==="add"){r.push(s);continue}else if(s.type==="remove"||s.type==="replace")i.set(s.id,[s]);else{const a=i.get(s.id);a?a.push(s):i.set(s.id,[s])}for(const s of t){const a=i.get(s.id);if(!a){n.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const o={...s};for(const c of a)sCe(c,o);n.push(o)}return r.length&&r.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function sCe(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function tne(e,t){return ene(e,t)}function nne(e,t){return ene(e,t)}function Rh(e,t){return{id:e,type:"select",selected:t}}function cg(e,t=new Set,n=!1){const i=[];for(const[r,s]of e){const a=t.has(r);!(s.selected===void 0&&!a)&&s.selected!==a&&(n&&(s.selected=a),i.push(Rh(s.id,a)))}return i}function OU({items:e=[],lookup:t}){var r;const n=[],i=new Map(e.map(s=>[s.id,s]));for(const[s,a]of e.entries()){const o=t.get(a.id),c=((r=o==null?void 0:o.internals)==null?void 0:r.userNode)??o;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of t)i.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function yU(e){return{id:e.id,type:"remove"}}const aCe=kte();function oCe(e,t,n={}){return RAe(e,t,{...n,onError:n.onError??aCe})}const xU=e=>bAe(e),lCe=e=>vte(e);function ine(e){return m.forwardRef(e)}const cCe=typeof window<"u"?m.useLayoutEffect:m.useEffect;function vU(e){const[t,n]=m.useState(BigInt(0)),[i]=m.useState(()=>uCe(()=>n(r=>r+BigInt(1))));return cCe(()=>{const r=i.get();r.length&&(e(r),i.reset())},[t]),i}function uCe(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const rne=m.createContext(null);function dCe({children:e}){const t=dr(),n=m.useCallback(o=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:g}=t.getState();let b=c;for(const O of o)b=typeof O=="function"?O(b):O;let y=OU({items:b,lookup:h});for(const O of g.values())y=O(y);d&&u(b),y.length>0?f==null||f(y):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:O,nodes:v,setNodes:x}=t.getState();O&&x(v)})},[]),i=vU(n),r=m.useCallback(o=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const g of o)p=typeof g=="function"?g(p):g;d?u(p):f&&f(OU({items:p,lookup:h}))},[]),s=vU(r),a=m.useMemo(()=>({nodeQueue:i,edgeQueue:s}),[]);return l.jsx(rne.Provider,{value:a,children:e})}function fCe(){const e=m.useContext(rne);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const hCe=e=>!!e.panZoom;function $_(){const e=rCe(),t=dr(),n=fCe(),i=zn(hCe),r=m.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},o=f=>{n.edgeQueue.push(f)},c=f=>{var O,v;const{nodeLookup:h,nodeOrigin:p}=t.getState(),g=xU(f)?f:h.get(f.id),b=g.parentId?Tte(g.position,g.measured,g.parentId,h,p):g.position,y={...g,position:b,width:((O=g.measured)==null?void 0:O.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return m0(y)},u=(f,h,p={replace:!1})=>{a(g=>g.map(b=>{if(b.id===f){const y=typeof h=="function"?h(b):h;return p.replace&&xU(y)?y:{...b,...y}}return b}))},d=(f,h,p={replace:!1})=>{o(g=>g.map(b=>{if(b.id===f){const y=typeof h=="function"?h(b):h;return p.replace&&lCe(y)?y:{...b,...y}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=s(f))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:o,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[g,b,y]=p;return{nodes:f.map(O=>({...O})),edges:h.map(O=>({...O})),viewport:{x:g,y:b,zoom:y}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:g,onNodesDelete:b,onEdgesDelete:y,triggerNodeChanges:O,triggerEdgeChanges:v,onDelete:x,onBeforeDelete:w}=t.getState(),{nodes:E,edges:S}=await wAe({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:g,onBeforeDelete:w}),k=S.length>0,T=E.length>0;if(k){const A=S.map(yU);y==null||y(S),v(A)}if(T){const A=E.map(yU);b==null||b(E),O(A)}return(T||k)&&(x==null||x({nodes:E,edges:S})),{deletedNodes:E,deletedEdges:S}},getIntersectingNodes:(f,h=!0,p)=>{const g=W9(f),b=g?f:c(f),y=p!==void 0;return b?(p||t.getState().nodes).filter(O=>{const v=t.getState().nodeLookup.get(O.id);if(v&&!g&&(O.id===f.id||!v.internals.positionAbsolute))return!1;const x=m0(y?O:v),w=yx(x,b);return h&&w>0||w>=x.width*x.height||w>=b.width*b.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const b=W9(f)?f:c(f);if(!b)return!1;const y=yx(b,h);return p&&y>0||y>=h.width*h.height||y>=b.width*b.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,g=>{const b=typeof h=="function"?h(g):h;return p.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,g=>{const b=typeof h=="function"?h(g):h;return p.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return OAe(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:g.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??kAe();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return m.useMemo(()=>({...r,...e,viewportInitialized:i}),[i])}const wU=e=>e.selected,pCe=typeof window<"u"?window:void 0;function mCe({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=dr(),{deleteElements:i}=$_(),r=vx(e,{actInsideInputWithModifier:!1}),s=vx(t,{target:pCe});m.useEffect(()=>{if(r){const{edges:a,nodes:o}=n.getState();i({nodes:o.filter(wU),edges:a.filter(wU)}),n.setState({nodesSelectionActive:!1})}},[r]),m.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function gCe(e){const t=dr();m.useEffect(()=>{const n=()=>{var r,s,a,o;if(!e.current||!(((s=(r=e.current).checkVisibility)==null?void 0:s.call(r))??!0))return!1;const i=v$(e.current);(i.height===0||i.width===0)&&((o=(a=t.getState()).onError)==null||o.call(a,"004",Bl.error004())),t.setState({width:i.width||500,height:i.height||500})};if(e.current){n(),window.addEventListener("resize",n);const i=new ResizeObserver(()=>n());return i.observe(e.current),()=>{window.removeEventListener("resize",n),i&&e.current&&i.unobserve(e.current)}}},[])}const Q_={position:"absolute",width:"100%",height:"100%",top:0,left:0},bCe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function OCe({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=op.Free,zoomOnDoubleClick:a=!0,panOnDrag:o=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:g,noWheelClassName:b,noPanClassName:y,onViewportChange:O,isControlledViewport:v,paneClickDistance:x,selectionOnDrag:w}){const E=dr(),S=m.useRef(null),{userSelectionActive:k,lib:T,connectionInProgress:A}=zn(bCe,ur),N=vx(h),j=m.useRef();gCe(S);const M=m.useCallback(D=>{O==null||O({x:D[0],y:D[1],zoom:D[2]}),v||E.setState({transform:D})},[O,v]);return m.useEffect(()=>{if(S.current){j.current=lNe({domNode:S.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:C=>E.setState(I=>I.paneDragging===C?I:{paneDragging:C}),onPanZoomStart:(C,I)=>{const{onViewportChangeStart:U,onMoveStart:B}=E.getState();B==null||B(C,I),U==null||U(I)},onPanZoom:(C,I)=>{const{onViewportChange:U,onMove:B}=E.getState();B==null||B(C,I),U==null||U(I)},onPanZoomEnd:(C,I)=>{const{onViewportChangeEnd:U,onMoveEnd:B}=E.getState();B==null||B(C,I),U==null||U(I)}});const{x:D,y:L,zoom:Q}=j.current.getViewport();return E.setState({panZoom:j.current,transform:[D,L,Q],domNode:S.current.closest(".react-flow")}),()=>{var C;(C=j.current)==null||C.destroy()}}},[]),m.useEffect(()=>{var D;(D=j.current)==null||D.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:o,zoomActivationKeyPressed:N,preventScrolling:p,noPanClassName:y,userSelectionActive:k,noWheelClassName:b,lib:T,onTransformChange:M,connectionInProgress:A,selectionOnDrag:w,paneClickDistance:x})},[e,t,n,i,r,s,a,o,N,p,y,k,b,T,M,A,w,x]),l.jsx("div",{className:"react-flow__renderer",ref:S,style:Q_,children:g})}const yCe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function xCe(){const{userSelectionActive:e,userSelectionRect:t}=zn(yCe,ur);return e&&t?l.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const tC=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},vCe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function wCe({isSelecting:e,selectionKeyPressed:t,selectionMode:n=bx.Full,panOnDrag:i,autoPanOnSelection:r,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:g,children:b}){const y=m.useRef(0),O=dr(),{userSelectionActive:v,elementsSelectable:x,dragging:w,connectionInProgress:E,panBy:S,autoPanSpeed:k}=zn(vCe,ur),T=x&&(e||v),A=m.useRef(null),N=m.useRef(),j=m.useRef(new Set),M=m.useRef(new Set),D=m.useRef(!1),L=m.useRef({x:0,y:0}),Q=m.useRef(!1),C=J=>{if(D.current||E){D.current=!1;return}u==null||u(J),O.getState().resetSelectedElements(),O.setState({nodesSelectionActive:!1})},I=J=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){J.preventDefault();return}d==null||d(J)},U=f?J=>f(J):void 0,B=J=>{D.current&&(J.stopPropagation(),D.current=!1)},P=J=>{var Re,xe;const{domNode:ne,transform:ce}=O.getState();if(N.current=ne==null?void 0:ne.getBoundingClientRect(),!N.current)return;const Oe=J.target===A.current;if(!Oe&&!!J.target.closest(".nokey")||!e||!(a&&Oe||t)||J.button!==0||!J.isPrimary)return;(xe=(Re=J.target)==null?void 0:Re.setPointerCapture)==null||xe.call(Re,J.pointerId),D.current=!1;const{x:ve,y:be}=Pl(J.nativeEvent,N.current),ae=eb({x:ve,y:be},ce);O.setState({userSelectionRect:{width:0,height:0,startX:ae.x,startY:ae.y,x:ve,y:be}}),Oe||(J.stopPropagation(),J.preventDefault())};function q(J,ne){const{userSelectionRect:ce}=O.getState();if(!ce)return;const{transform:Oe,nodeLookup:Se,edgeLookup:je,connectionLookup:ve,triggerNodeChanges:be,triggerEdgeChanges:ae,defaultEdgeOptions:Re}=O.getState(),xe={x:ce.startX,y:ce.startY},{x:Be,y:qe}=g0(xe,Oe),Pe={startX:xe.x,startY:xe.y,x:J We.id)),M.current=new Set;const Dt=(Re==null?void 0:Re.selectable)??!0;for(const We of j.current){const W=ve.get(We);if(W)for(const{edgeId:ee}of W.values()){const se=je.get(ee);se&&(se.selectable??Dt)&&M.current.add(ee)}}if(!Z9(mt,j.current)){const We=cg(Se,j.current,!0);be(We)}if(!Z9(bt,M.current)){const We=cg(je,M.current);ae(We)}O.setState({userSelectionRect:Pe,userSelectionActive:!0,nodesSelectionActive:!1})}function G(){if(!r||!N.current)return;const[J,ne]=O$(L.current,N.current,k);S({x:J,y:ne}).then(ce=>{if(!D.current||!ce){y.current=requestAnimationFrame(G);return}const{x:Oe,y:Se}=L.current;q(Oe,Se),y.current=requestAnimationFrame(G)})}const $=()=>{cancelAnimationFrame(y.current),y.current=0,Q.current=!1};m.useEffect(()=>()=>$(),[]);const V=J=>{const{userSelectionRect:ne,transform:ce,resetSelectedElements:Oe}=O.getState();if(!N.current||!ne)return;const{x:Se,y:je}=Pl(J.nativeEvent,N.current);L.current={x:Se,y:je};const ve=g0({x:ne.startX,y:ne.startY},ce);if(!D.current){const be=t?0:s;if(Math.hypot(Se-ve.x,je-ve.y)<=be)return;Oe(),o==null||o(J)}D.current=!0,Q.current||(G(),Q.current=!0),q(Se,je)},te=J=>{var ne,ce;J.button===0&&((ce=(ne=J.target)==null?void 0:ne.releasePointerCapture)==null||ce.call(ne,J.pointerId),!v&&J.target===A.current&&O.getState().userSelectionRect&&(C==null||C(J)),O.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(c==null||c(J),O.setState({nodesSelectionActive:j.current.size>0})),$())},fe=J=>{var ne,ce;(ce=(ne=J.target)==null?void 0:ne.releasePointerCapture)==null||ce.call(ne,J.pointerId),$()},Te=i===!0||Array.isArray(i)&&i.includes(0);return l.jsxs("div",{className:Kr(["react-flow__pane",{draggable:Te,dragging:w,selection:e}]),onClick:T?void 0:tC(C,A),onContextMenu:tC(I,A),onWheel:tC(U,A),onPointerEnter:T?void 0:h,onPointerMove:T?V:p,onPointerUp:T?te:void 0,onPointerCancel:T?fe:void 0,onPointerDownCapture:T?P:void 0,onClickCapture:T?B:void 0,onPointerLeave:g,ref:A,style:Q_,children:[b,l.jsx(xCe,{})]})}function CP({id:e,store:t,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:o,onError:c}=t.getState(),u=o.get(e);if(!u){c==null||c("012",Bl.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):r([e])}function sne({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:i,nodeId:r,isSelectable:s,nodeClickDistance:a}){const o=dr(),[c,u]=m.useState(!1),d=m.useRef();return m.useEffect(()=>{d.current=YAe({getStoreItems:()=>o.getState(),onNodeMouseDown:f=>{CP({id:f,store:o,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:i,domNode:e.current,isSelectable:s,nodeId:r,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,i,t,s,e,r,a]),c}const SCe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function ane(){const e=dr();return m.useCallback(n=>{const{nodeExtent:i,snapToGrid:r,snapGrid:s,nodesDraggable:a,onError:o,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=SCe(a),p=r?s[0]:5,g=r?s[1]:5,b=n.direction.x*p*n.factor,y=n.direction.y*g*n.factor;for(const[,O]of u){if(!h(O))continue;let v={x:O.internals.positionAbsolute.x+b,y:O.internals.positionAbsolute.y+y};r&&(v=D1(v,s));const{position:x,positionAbsolute:w}=wte({nodeId:O.id,nextPosition:v,nodeLookup:u,nodeExtent:i,nodeOrigin:d,onError:o});O.position=x,O.internals.positionAbsolute=w,f.set(O.id,O)}c(f)},[])}const _$=m.createContext(null),ECe=_$.Provider;_$.Consumer;const one=()=>m.useContext(_$),kCe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),TCe=(e,t,n)=>i=>{const{connectionClickStartHandle:r,connectionMode:s,connection:a}=i,{fromHandle:o,toHandle:c,isValid:u}=a,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:d,clickConnecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===n,isPossibleEndHandle:s===h0.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!r,valid:d&&u}};function _Ce({type:e="source",position:t=wt.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:a,onConnect:o,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var Q,C;const g=a||null,b=e==="target",y=dr(),O=one(),{connectOnClick:v,noPanClassName:x,rfId:w}=zn(kCe,ur),{connectingFrom:E,connectingTo:S,clickConnecting:k,isPossibleEndHandle:T,connectionInProcess:A,clickConnectionInProcess:N,valid:j}=zn(TCe(O,g,e),ur);O||(C=(Q=y.getState()).onError)==null||C.call(Q,"010",Bl.error010());const M=I=>{const{defaultEdgeOptions:U,onConnect:B,hasDefaultEdges:P}=y.getState(),q={...U,...I};if(P){const{edges:G,setEdges:$,onError:V}=y.getState();$(oCe(q,G,{onError:V}))}B==null||B(q),o==null||o(q)},D=I=>{if(!O)return;const U=Nte(I.nativeEvent);if(r&&(U&&I.button===0||!U)){const B=y.getState();NP.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:B.autoPanOnConnect,connectionMode:B.connectionMode,connectionRadius:B.connectionRadius,domNode:B.domNode,nodeLookup:B.nodeLookup,lib:B.lib,isTarget:b,handleId:g,nodeId:O,flowId:B.rfId,panBy:B.panBy,cancelConnection:B.cancelConnection,onConnectStart:B.onConnectStart,onConnectEnd:(...P)=>{var q,G;return(G=(q=y.getState()).onConnectEnd)==null?void 0:G.call(q,...P)},updateConnection:B.updateConnection,onConnect:M,isValidConnection:n||((...P)=>{var q,G;return((G=(q=y.getState()).isValidConnection)==null?void 0:G.call(q,...P))??!0}),getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:B.autoPanSpeed,dragThreshold:B.connectionDragThreshold})}U?d==null||d(I):f==null||f(I)},L=I=>{const{onClickConnectStart:U,onClickConnectEnd:B,connectionClickStartHandle:P,connectionMode:q,isValidConnection:G,lib:$,rfId:V,nodeLookup:te,connection:fe}=y.getState();if(!O||!P&&!r)return;if(!P){U==null||U(I.nativeEvent,{nodeId:O,handleId:g,handleType:e}),y.setState({connectionClickStartHandle:{nodeId:O,type:e,id:g}});return}const Te=_te(I.target),J=n||G,{connection:ne,isValid:ce}=NP.isValid(I.nativeEvent,{handle:{nodeId:O,id:g,type:e},connectionMode:q,fromNodeId:P.nodeId,fromHandleId:P.id||null,fromType:P.type,isValidConnection:J,flowId:V,doc:Te,lib:$,nodeLookup:te});ce&&ne&&M(ne);const Oe=structuredClone(fe);delete Oe.inProgress,Oe.toPosition=Oe.toHandle?Oe.toHandle.position:null,B==null||B(I,Oe),y.setState({connectionClickStartHandle:null})};return l.jsx("div",{"data-handleid":g,"data-nodeid":O,"data-handlepos":t,"data-id":`${w}-${O}-${g}-${e}`,className:Kr(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,u,{source:!b,target:b,connectable:i,connectablestart:r,connectableend:s,clickconnecting:k,connectingfrom:E,connectingto:S,valid:j,connectionindicator:i&&(!A||T)&&(A||N?s:r)}]),onMouseDown:D,onTouchStart:D,onClick:v?L:void 0,ref:p,...h,children:c})}const Ua=m.memo(ine(_Ce));function ACe({data:e,isConnectable:t,sourcePosition:n=wt.Bottom}){return l.jsxs(l.Fragment,{children:[e==null?void 0:e.label,l.jsx(Ua,{type:"source",position:n,isConnectable:t})]})}function NCe({data:e,isConnectable:t,targetPosition:n=wt.Top,sourcePosition:i=wt.Bottom}){return l.jsxs(l.Fragment,{children:[l.jsx(Ua,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,l.jsx(Ua,{type:"source",position:i,isConnectable:t})]})}function CCe(){return null}function jCe({data:e,isConnectable:t,targetPosition:n=wt.Top}){return l.jsxs(l.Fragment,{children:[l.jsx(Ua,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Ik={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},SU={input:ACe,default:NCe,output:jCe,group:CCe};function RCe(e){var t,n,i,r;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((i=e.style)==null?void 0:i.width),height:e.height??((r=e.style)==null?void 0:r.height)}}const ICe=e=>{const{width:t,height:n,x:i,y:r}=L1(e.nodeLookup,{filter:s=>!!s.selected});return{width:Il(t)?t:null,height:Il(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${r}px)`}};function PCe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const i=dr(),{width:r,height:s,transformString:a,userSelectionActive:o}=zn(ICe,ur),c=ane(),u=m.useRef(null);m.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!o&&r!==null&&s!==null;if(sne({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const g=i.getState().nodes.filter(b=>b.selected);e(p,g)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Ik,p.key)&&(p.preventDefault(),c({direction:Ik[p.key],factor:p.shiftKey?4:1}))};return l.jsx("div",{className:Kr(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:l.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:r,height:s}})})}const EU=typeof window<"u"?window:void 0,MCe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function lne({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,paneClickDistance:o,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:g,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:O,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:w,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:T,autoPanOnSelection:A,defaultViewport:N,translateExtent:j,minZoom:M,maxZoom:D,preventScrolling:L,onSelectionContextMenu:Q,noWheelClassName:C,noPanClassName:I,disableKeyboardA11y:U,onViewportChange:B,isControlledViewport:P}){const{nodesSelectionActive:q,userSelectionActive:G}=zn(MCe,ur),$=vx(u,{target:EU}),V=vx(b,{target:EU}),te=V||T,fe=V||w,Te=d&&te!==!0,J=$||G||Te;return mCe({deleteKeyCode:c,multiSelectionKeyCode:g}),l.jsx(OCe,{onPaneContextMenu:s,elementsSelectable:O,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:fe,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!$&&te,defaultViewport:N,translateExtent:j,minZoom:M,maxZoom:D,zoomActivationKeyCode:y,preventScrolling:L,noWheelClassName:C,noPanClassName:I,onViewportChange:B,isControlledViewport:P,paneClickDistance:o,selectionOnDrag:Te,children:l.jsxs(wCe,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:te,autoPanOnSelection:A,isSelecting:!!J,selectionMode:f,selectionKeyPressed:$,paneClickDistance:o,selectionOnDrag:Te,children:[e,q&&l.jsx(PCe,{onSelectionContextMenu:Q,noPanClassName:I,disableKeyboardA11y:U})]})})}lne.displayName="FlowRenderer";const LCe=m.memo(lne),DCe=e=>t=>e?b$(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function $Ce(e){return zn(m.useCallback(DCe(e),[e]),ur)}const QCe=e=>e.updateNodeInternals;function BCe(){const e=zn(QCe),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const i=new Map;n.forEach(r=>{const s=r.target.getAttribute("data-id");i.set(s,{id:s,nodeElement:r.target,force:!0})}),e(i)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function UCe({node:e,nodeType:t,hasDimensions:n,resizeObserver:i}){const r=dr(),s=m.useRef(null),a=m.useRef(null),o=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),u=m.useRef(t),d=n&&!!e.internals.handleBounds;return m.useEffect(()=>{s.current&&!e.hidden&&(!d||a.current!==s.current)&&(a.current&&(i==null||i.unobserve(a.current)),i==null||i.observe(s.current),a.current=s.current)},[d,e.hidden]),m.useEffect(()=>()=>{a.current&&(i==null||i.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(s.current){const f=u.current!==t,h=o.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,o.current=e.sourcePosition,c.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function zCe({id:e,onClick:t,onMouseEnter:n,onMouseMove:i,onMouseLeave:r,onContextMenu:s,onDoubleClick:a,nodesDraggable:o,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:g,rfId:b,nodeTypes:y,nodeClickDistance:O,onError:v}){const{node:x,internals:w,isParent:E}=zn(J=>{const ne=J.nodeLookup.get(e),ce=J.parentLookup.has(e);return{node:ne,internals:ne.internals,isParent:ce}},ur);let S=x.type||"default",k=(y==null?void 0:y[S])||SU[S];k===void 0&&(v==null||v("003",Bl.error003(S)),S="default",k=(y==null?void 0:y.default)||SU.default);const T=!!(x.draggable||o&&typeof x.draggable>"u"),A=!!(x.selectable||c&&typeof x.selectable>"u"),N=!!(x.connectable||u&&typeof x.connectable>"u"),j=!!(x.focusable||d&&typeof x.focusable>"u"),M=dr(),D=x$(x),L=UCe({node:x,nodeType:S,hasDimensions:D,resizeObserver:f}),Q=sne({nodeRef:L,disabled:x.hidden||!T,noDragClassName:h,handleSelector:x.dragHandle,nodeId:e,isSelectable:A,nodeClickDistance:O}),C=ane();if(x.hidden)return null;const I=fd(x),U=RCe(x),B=A||T||t||n||i||r,P=n?J=>n(J,{...w.userNode}):void 0,q=i?J=>i(J,{...w.userNode}):void 0,G=r?J=>r(J,{...w.userNode}):void 0,$=s?J=>s(J,{...w.userNode}):void 0,V=a?J=>a(J,{...w.userNode}):void 0,te=J=>{const{selectNodesOnDrag:ne,nodeDragThreshold:ce}=M.getState();A&&(!ne||!T||ce>0)&&CP({id:e,store:M,nodeRef:L}),t&&t(J,{...w.userNode})},fe=J=>{if(!(Ate(J.nativeEvent)||g)){if(bte.includes(J.key)&&A){const ne=J.key==="Escape";CP({id:e,store:M,unselect:ne,nodeRef:L})}else if(T&&x.selected&&Object.prototype.hasOwnProperty.call(Ik,J.key)){J.preventDefault();const{ariaLabelConfig:ne}=M.getState();M.setState({ariaLiveMessage:ne["node.a11yDescription.ariaLiveMessage"]({direction:J.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),C({direction:Ik[J.key],factor:J.shiftKey?4:1})}}},Te=()=>{var ve;if(g||!((ve=L.current)!=null&&ve.matches(":focus-visible")))return;const{transform:J,width:ne,height:ce,autoPanOnNodeFocus:Oe,setCenter:Se}=M.getState();if(!Oe)return;b$(new Map([[e,x]]),{x:0,y:0,width:ne,height:ce},J,!0).length>0||Se(x.position.x+I.width/2,x.position.y+I.height/2,{zoom:J[2]})};return l.jsx("div",{className:Kr(["react-flow__node",`react-flow__node-${S}`,{[p]:T},x.className,{selected:x.selected,selectable:A,parent:E,draggable:T,dragging:Q}]),ref:L,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:D?"visible":"hidden",...x.style,...U},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:P,onMouseMove:q,onMouseLeave:G,onContextMenu:$,onClick:te,onDoubleClick:V,onKeyDown:j?fe:void 0,tabIndex:j?0:void 0,onFocus:j?Te:void 0,role:x.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Zte}-${b}`,"aria-label":x.ariaLabel,...x.domAttributes,children:l.jsx(ECe,{value:e,children:l.jsx(k,{id:e,data:x.data,type:S,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:x.selected??!1,selectable:A,draggable:T,deletable:x.deletable??!0,isConnectable:N,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:Q,dragHandle:x.dragHandle,zIndex:w.z,parentId:x.parentId,...I})})})}var FCe=m.memo(zCe);const VCe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function cne(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,onError:s}=zn(VCe,ur),a=$Ce(e.onlyRenderVisibleElements),o=BCe();return l.jsx("div",{className:"react-flow__nodes",style:Q_,children:a.map(c=>l.jsx(FCe,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}cne.displayName="NodeRenderer";const XCe=m.memo(cne);function qCe(e){return zn(m.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const i=[];if(n.width&&n.height)for(const r of n.edges){const s=n.nodeLookup.get(r.source),a=n.nodeLookup.get(r.target);s&&a&&NAe({sourceNode:s,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&i.push(r.id)}return i},[e]),ur)}const HCe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return l.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},YCe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return l.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},kU={[Ox.Arrow]:HCe,[Ox.ArrowClosed]:YCe};function GCe(e){const t=dr();return m.useMemo(()=>{var r,s;return Object.prototype.hasOwnProperty.call(kU,e)?kU[e]:((s=(r=t.getState()).onError)==null||s.call(r,"009",Bl.error009(e)),null)},[e])}const WCe=({id:e,type:t,color:n,width:i=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const c=GCe(t);return c?l.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:o,refX:"0",refY:"0",children:l.jsx(c,{color:n,strokeWidth:a})}):null},une=({defaultColor:e,rfId:t})=>{const n=zn(s=>s.edges),i=zn(s=>s.defaultEdgeOptions),r=m.useMemo(()=>DAe(n,{id:t,defaultColor:e,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[n,i,t,e]);return r.length?l.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:l.jsx("defs",{children:r.map(s=>l.jsx(WCe,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};une.displayName="MarkerDefinitions";var ZCe=m.memo(une);function dne({x:e,y:t,label:n,labelStyle:i,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:c,className:u,...d}){const[f,h]=m.useState({x:1,y:0,width:0,height:0}),p=Kr(["react-flow__edge-textwrapper",u]),g=m.useRef(null);return m.useEffect(()=>{if(g.current){const b=g.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?l.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[r&&l.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:o,ry:o}),l.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:i,children:n}),c]}):null}dne.displayName="EdgeText";const KCe=m.memo(dne);function $1({path:e,labelX:t,labelY:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return l.jsxs(l.Fragment,{children:[l.jsx("path",{...d,d:e,fill:"none",className:Kr(["react-flow__edge-path",d.className])}),u?l.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,i&&Il(t)&&Il(n)?l.jsx(KCe,{x:t,y:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c}):null]})}function TU({pos:e,x1:t,y1:n,x2:i,y2:r}){return e===wt.Left||e===wt.Right?[.5*(t+i),n]:[t,.5*(n+r)]}function fne({sourceX:e,sourceY:t,sourcePosition:n=wt.Bottom,targetX:i,targetY:r,targetPosition:s=wt.Top}){const[a,o]=TU({pos:n,x1:e,y1:t,x2:i,y2:r}),[c,u]=TU({pos:s,x1:i,y1:r,x2:e,y2:t}),[d,f,h,p]=Cte({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:a,sourceControlY:o,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${o} ${c},${u} ${i},${r}`,d,f,h,p]}function hne(e){return m.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:a,targetPosition:o,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:b,markerStart:y,interactionWidth:O})=>{const[v,x,w]=fne({sourceX:n,sourceY:i,sourcePosition:a,targetX:r,targetY:s,targetPosition:o}),E=e.isInternal?void 0:t;return l.jsx($1,{id:E,path:v,labelX:x,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:b,markerStart:y,interactionWidth:O})})}const JCe=hne({isInternal:!1}),pne=hne({isInternal:!0});JCe.displayName="SimpleBezierEdge";pne.displayName="SimpleBezierEdgeInternal";function mne(e){return m.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=wt.Bottom,targetPosition:g=wt.Top,markerEnd:b,markerStart:y,pathOptions:O,interactionWidth:v})=>{const[x,w,E]=Rk({sourceX:n,sourceY:i,sourcePosition:p,targetX:r,targetY:s,targetPosition:g,borderRadius:O==null?void 0:O.borderRadius,offset:O==null?void 0:O.offset,stepPosition:O==null?void 0:O.stepPosition}),S=e.isInternal?void 0:t;return l.jsx($1,{id:S,path:x,labelX:w,labelY:E,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:y,interactionWidth:v})})}const gne=mne({isInternal:!1}),bne=mne({isInternal:!0});gne.displayName="SmoothStepEdge";bne.displayName="SmoothStepEdgeInternal";function One(e){return m.memo(({id:t,...n})=>{var r;const i=e.isInternal?void 0:t;return l.jsx(gne,{...n,id:i,pathOptions:m.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(r=n.pathOptions)==null?void 0:r.offset])})})}const eje=One({isInternal:!1}),yne=One({isInternal:!0});eje.displayName="StepEdge";yne.displayName="StepEdgeInternal";function xne(e){return m.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:b})=>{const[y,O,v]=Ite({sourceX:n,sourceY:i,targetX:r,targetY:s}),x=e.isInternal?void 0:t;return l.jsx($1,{id:x,path:y,labelX:O,labelY:v,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:b})})}const tje=xne({isInternal:!1}),vne=xne({isInternal:!0});tje.displayName="StraightEdge";vne.displayName="StraightEdgeInternal";function wne(e){return m.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:a=wt.Bottom,targetPosition:o=wt.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:b,markerStart:y,pathOptions:O,interactionWidth:v})=>{const[x,w,E]=jte({sourceX:n,sourceY:i,sourcePosition:a,targetX:r,targetY:s,targetPosition:o,curvature:O==null?void 0:O.curvature}),S=e.isInternal?void 0:t;return l.jsx($1,{id:S,path:x,labelX:w,labelY:E,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:b,markerStart:y,interactionWidth:v})})}const nje=wne({isInternal:!1}),Sne=wne({isInternal:!0});nje.displayName="BezierEdge";Sne.displayName="BezierEdgeInternal";const _U={default:Sne,straight:vne,step:yne,smoothstep:bne,simplebezier:pne},AU={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},ije=(e,t,n)=>n===wt.Left?e-t:n===wt.Right?e+t:e,rje=(e,t,n)=>n===wt.Top?e-t:n===wt.Bottom?e+t:e,NU="react-flow__edgeupdater";function CU({position:e,centerX:t,centerY:n,radius:i=10,onMouseDown:r,onMouseEnter:s,onMouseOut:a,type:o}){return l.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:a,className:Kr([NU,`${NU}-${o}`]),cx:ije(t,i,e),cy:rje(n,i,e),r:i,stroke:"transparent",fill:"transparent"})}function sje({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:i,sourceY:r,targetX:s,targetY:a,sourcePosition:o,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const g=dr(),b=(w,E)=>{if(w.button!==0)return;const{autoPanOnConnect:S,domNode:k,connectionMode:T,connectionRadius:A,lib:N,onConnectStart:j,cancelConnection:M,nodeLookup:D,rfId:L,panBy:Q,updateConnection:C}=g.getState(),I=E.type==="target",U=(q,G)=>{h(!1),f==null||f(q,n,E.type,G)},B=q=>u==null?void 0:u(n,q),P=(q,G)=>{h(!0),d==null||d(w,n,E.type),j==null||j(q,G)};NP.onPointerDown(w.nativeEvent,{autoPanOnConnect:S,connectionMode:T,connectionRadius:A,domNode:k,handleId:E.id,nodeId:E.nodeId,nodeLookup:D,isTarget:I,edgeUpdaterType:E.type,lib:N,flowId:L,cancelConnection:M,panBy:Q,isValidConnection:(...q)=>{var G,$;return(($=(G=g.getState()).isValidConnection)==null?void 0:$.call(G,...q))??!0},onConnect:B,onConnectStart:P,onConnectEnd:(...q)=>{var G,$;return($=(G=g.getState()).onConnectEnd)==null?void 0:$.call(G,...q)},onReconnectEnd:U,updateConnection:C,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},y=w=>b(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),O=w=>b(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>p(!0),x=()=>p(!1);return l.jsxs(l.Fragment,{children:[(e===!0||e==="source")&&l.jsx(CU,{position:o,centerX:i,centerY:r,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&l.jsx(CU,{position:c,centerX:s,centerY:a,radius:t,onMouseDown:O,onMouseEnter:v,onMouseOut:x,type:"target"})]})}function aje({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:i,onClick:r,onDoubleClick:s,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:g,edgeTypes:b,noPanClassName:y,onError:O,disableKeyboardA11y:v}){let x=zn(Se=>Se.edgeLookup.get(e));const w=zn(Se=>Se.defaultEdgeOptions);x=w?{...w,...x}:x;let E=x.type||"default",S=(b==null?void 0:b[E])||_U[E];S===void 0&&(O==null||O("011",Bl.error011(E)),E="default",S=(b==null?void 0:b.default)||_U.default);const k=!!(x.focusable||t&&typeof x.focusable>"u"),T=typeof f<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),A=!!(x.selectable||i&&typeof x.selectable>"u"),N=m.useRef(null),[j,M]=m.useState(!1),[D,L]=m.useState(!1),Q=dr(),{zIndex:C,sourceX:I,sourceY:U,targetX:B,targetY:P,sourcePosition:q,targetPosition:G}=zn(m.useCallback(Se=>{const je=Se.nodeLookup.get(x.source),ve=Se.nodeLookup.get(x.target);if(!je||!ve)return{zIndex:x.zIndex,...AU};const be=LAe({id:e,sourceNode:je,targetNode:ve,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:Se.connectionMode,onError:O});return{zIndex:AAe({selected:x.selected,zIndex:x.zIndex,sourceNode:je,targetNode:ve,elevateOnSelect:Se.elevateEdgesOnSelect,zIndexMode:Se.zIndexMode}),...be||AU}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),ur),$=m.useMemo(()=>x.markerStart?`url('#${_P(x.markerStart,g)}')`:void 0,[x.markerStart,g]),V=m.useMemo(()=>x.markerEnd?`url('#${_P(x.markerEnd,g)}')`:void 0,[x.markerEnd,g]);if(x.hidden||I===null||U===null||B===null||P===null)return null;const te=Se=>{var ae;const{addSelectedEdges:je,unselectNodesAndEdges:ve,multiSelectionActive:be}=Q.getState();A&&(Q.setState({nodesSelectionActive:!1}),x.selected&&be?(ve({nodes:[],edges:[x]}),(ae=N.current)==null||ae.blur()):je([e])),r&&r(Se,x)},fe=s?Se=>{s(Se,{...x})}:void 0,Te=a?Se=>{a(Se,{...x})}:void 0,J=o?Se=>{o(Se,{...x})}:void 0,ne=c?Se=>{c(Se,{...x})}:void 0,ce=u?Se=>{u(Se,{...x})}:void 0,Oe=Se=>{var je;if(!v&&bte.includes(Se.key)&&A){const{unselectNodesAndEdges:ve,addSelectedEdges:be}=Q.getState();Se.key==="Escape"?((je=N.current)==null||je.blur(),ve({edges:[x]})):be([e])}};return l.jsx("svg",{style:{zIndex:C},children:l.jsxs("g",{className:Kr(["react-flow__edge",`react-flow__edge-${E}`,x.className,y,{selected:x.selected,animated:x.animated,inactive:!A&&!r,updating:j,selectable:A}]),onClick:te,onDoubleClick:fe,onContextMenu:Te,onMouseEnter:J,onMouseMove:ne,onMouseLeave:ce,onKeyDown:k?Oe:void 0,tabIndex:k?0:void 0,role:x.ariaRole??(k?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":x.ariaLabel===null?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":k?`${Kte}-${g}`:void 0,ref:N,...x.domAttributes,children:[!D&&l.jsx(S,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:A,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:I,sourceY:U,targetX:B,targetY:P,sourcePosition:q,targetPosition:G,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:$,markerEnd:V,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),T&&l.jsx(sje,{edge:x,isReconnectable:T,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:I,sourceY:U,targetX:B,targetY:P,sourcePosition:q,targetPosition:G,setUpdateHover:M,setReconnecting:L})]})})}var oje=m.memo(aje);const lje=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ene({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:i,noPanClassName:r,onReconnect:s,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:g,disableKeyboardA11y:b}){const{edgesFocusable:y,edgesReconnectable:O,elementsSelectable:v,onError:x}=zn(lje,ur),w=qCe(t);return l.jsxs("div",{className:"react-flow__edges",children:[l.jsx(ZCe,{defaultColor:e,rfId:n}),w.map(E=>l.jsx(oje,{id:E,edgesFocusable:y,edgesReconnectable:O,elementsSelectable:v,noPanClassName:r,onReconnect:s,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:g,rfId:n,onError:x,edgeTypes:i,disableKeyboardA11y:b},E))]})}Ene.displayName="EdgeRenderer";const cje=m.memo(Ene),uje=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function dje({children:e}){const t=zn(uje);return l.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function fje(e){const t=$_(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const hje=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function pje(e){const t=zn(hje),n=dr();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function mje(e){return e.connection.inProgress?{...e.connection,to:eb(e.connection.to,e.transform)}:{...e.connection}}function gje(e){return mje}function bje(e){const t=gje();return zn(t,ur)}const Oje=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function yje({containerStyle:e,style:t,type:n,component:i}){const{nodesConnectable:r,width:s,height:a,isValid:o,inProgress:c}=zn(Oje,ur);return!(s&&r&&c)?null:l.jsx("svg",{style:e,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:l.jsx("g",{className:Kr(["react-flow__connection",xte(o)]),children:l.jsx(kne,{style:t,type:n,CustomComponent:i,isValid:o})})})}const kne=({style:e,type:t=ef.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:r,from:s,fromNode:a,fromHandle:o,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=bje();if(!r)return;if(n)return l.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:o,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:xte(i),toNode:d,toHandle:f,pointer:p});let g="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case ef.Bezier:[g]=jte(b);break;case ef.SimpleBezier:[g]=fne(b);break;case ef.Step:[g]=Rk({...b,borderRadius:0});break;case ef.SmoothStep:[g]=Rk(b);break;default:[g]=Ite(b)}return l.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};kne.displayName="ConnectionLine";const xje={};function jU(e=xje){m.useRef(e),dr(),m.useEffect(()=>{},[e])}function vje(){dr(),m.useRef(!1),m.useEffect(()=>{},[])}function Tne({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:i,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:a,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:g,connectionLineStyle:b,connectionLineComponent:y,connectionLineContainerStyle:O,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:E,panActivationKeyCode:S,zoomActivationKeyCode:k,deleteKeyCode:T,onlyRenderVisibleElements:A,elementsSelectable:N,defaultViewport:j,translateExtent:M,minZoom:D,maxZoom:L,preventScrolling:Q,defaultMarkerColor:C,zoomOnScroll:I,zoomOnPinch:U,panOnScroll:B,panOnScrollSpeed:P,panOnScrollMode:q,zoomOnDoubleClick:G,panOnDrag:$,autoPanOnSelection:V,onPaneClick:te,onPaneMouseEnter:fe,onPaneMouseMove:Te,onPaneMouseLeave:J,onPaneScroll:ne,onPaneContextMenu:ce,paneClickDistance:Oe,nodeClickDistance:Se,onEdgeContextMenu:je,onEdgeMouseEnter:ve,onEdgeMouseMove:be,onEdgeMouseLeave:ae,reconnectRadius:Re,onReconnect:xe,onReconnectStart:Be,onReconnectEnd:qe,noDragClassName:Pe,noWheelClassName:mt,noPanClassName:bt,disableKeyboardA11y:Dt,nodeExtent:We,rfId:W,viewport:ee,onViewportChange:se}){return jU(e),jU(t),vje(),fje(n),pje(ee),l.jsx(LCe,{onPaneClick:te,onPaneMouseEnter:fe,onPaneMouseMove:Te,onPaneMouseLeave:J,onPaneContextMenu:ce,onPaneScroll:ne,paneClickDistance:Oe,deleteKeyCode:T,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:E,panActivationKeyCode:S,zoomActivationKeyCode:k,elementsSelectable:N,zoomOnScroll:I,zoomOnPinch:U,zoomOnDoubleClick:G,panOnScroll:B,panOnScrollSpeed:P,panOnScrollMode:q,panOnDrag:$,autoPanOnSelection:V,defaultViewport:j,translateExtent:M,minZoom:D,maxZoom:L,onSelectionContextMenu:f,preventScrolling:Q,noDragClassName:Pe,noWheelClassName:mt,noPanClassName:bt,disableKeyboardA11y:Dt,onViewportChange:se,isControlledViewport:!!ee,children:l.jsxs(dje,{children:[l.jsx(cje,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:a,onReconnect:xe,onReconnectStart:Be,onReconnectEnd:qe,onlyRenderVisibleElements:A,onEdgeContextMenu:je,onEdgeMouseEnter:ve,onEdgeMouseMove:be,onEdgeMouseLeave:ae,reconnectRadius:Re,defaultMarkerColor:C,noPanClassName:bt,disableKeyboardA11y:Dt,rfId:W}),l.jsx(yje,{style:b,type:g,component:y,containerStyle:O}),l.jsx("div",{className:"react-flow__edgelabel-renderer"}),l.jsx(XCe,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Se,onlyRenderVisibleElements:A,noPanClassName:bt,noDragClassName:Pe,disableKeyboardA11y:Dt,nodeExtent:We,rfId:W}),l.jsx("div",{className:"react-flow__viewport-portal"})]})})}Tne.displayName="GraphView";const wje=m.memo(Tne),Sje=kte(),RU=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:a,fitViewOptions:o,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,g=new Map,b=new Map,y=new Map,O=i??t??[],v=n??e??[],x=d??[0,0],w=f??gx;Lte(b,y,O);const{nodesInitialized:E}=AP(v,p,g,{nodeOrigin:x,nodeExtent:w,zIndexMode:h});let S=[0,0,1];if(a&&r&&s){const k=L1(p,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:T,y:A,zoom:N}=y$(k,r,s,c,u,(o==null?void 0:o.padding)??.1);S=[T,A,N]}return{rfId:"1",width:r??0,height:s??0,transform:S,nodes:v,nodesInitialized:E,nodeLookup:p,parentLookup:g,edges:O,edgeLookup:y,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:gx,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:h0.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:o,fitViewResolver:null,connection:{...yte},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Sje,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Ote,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Eje=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>QNe((p,g)=>{async function b(){const{nodeLookup:y,panZoom:O,fitViewOptions:v,fitViewResolver:x,width:w,height:E,minZoom:S,maxZoom:k}=g();O&&(await vAe({nodes:y,width:w,height:E,panZoom:O,minZoom:S,maxZoom:k},v),x==null||x.resolve(!0),p({fitViewResolver:null}))}return{...RU({nodes:e,edges:t,width:r,height:s,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:i,zIndexMode:h}),setNodes:y=>{const{nodeLookup:O,parentLookup:v,nodeOrigin:x,elevateNodesOnSelect:w,fitViewQueued:E,zIndexMode:S,nodesSelectionActive:k}=g(),{nodesInitialized:T,hasSelectedNodes:A}=AP(y,O,v,{nodeOrigin:x,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:S}),N=k&&A;E&&T?(b(),p({nodes:y,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:N})):p({nodes:y,nodesInitialized:T,nodesSelectionActive:N})},setEdges:y=>{const{connectionLookup:O,edgeLookup:v}=g();Lte(O,v,y),p({edges:y})},setDefaultNodesAndEdges:(y,O)=>{if(y){const{setNodes:v}=g();v(y),p({hasDefaultNodes:!0})}if(O){const{setEdges:v}=g();v(O),p({hasDefaultEdges:!0})}},updateNodeInternals:y=>{const{triggerNodeChanges:O,nodeLookup:v,parentLookup:x,domNode:w,nodeOrigin:E,nodeExtent:S,debug:k,fitViewQueued:T,zIndexMode:A}=g(),{changes:N,updatedInternals:j}=VAe(y,v,x,w,E,S,A);j&&(BAe(v,x,{nodeOrigin:E,nodeExtent:S,zIndexMode:A}),T?(b(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(N==null?void 0:N.length)>0&&(k&&console.log("React Flow: trigger node changes",N),O==null||O(N)))},updateNodePositions:(y,O=!1)=>{const v=[];let x=[];const{nodeLookup:w,triggerNodeChanges:E,connection:S,updateConnection:k,onNodesChangeMiddlewareMap:T}=g();for(const[A,N]of y){const j=w.get(A),M=!!(j!=null&&j.expandParent&&(j!=null&&j.parentId)&&(N!=null&&N.position)),D={id:A,type:"position",position:M?{x:Math.max(0,N.position.x),y:Math.max(0,N.position.y)}:N.position,dragging:O};if(j&&S.inProgress&&S.fromNode.id===j.id){const L=Ep(j,S.fromHandle,wt.Left,!0);k({...S,from:L})}M&&j.parentId&&v.push({id:A,parentId:j.parentId,rect:{...N.internals.positionAbsolute,width:N.measured.width??0,height:N.measured.height??0}}),x.push(D)}if(v.length>0){const{parentLookup:A,nodeOrigin:N}=g(),j=T$(v,w,A,N);x.push(...j)}for(const A of T.values())x=A(x);E(x)},triggerNodeChanges:y=>{const{onNodesChange:O,setNodes:v,nodes:x,hasDefaultNodes:w,debug:E}=g();if(y!=null&&y.length){if(w){const S=tne(y,x);v(S)}E&&console.log("React Flow: trigger node changes",y),O==null||O(y)}},triggerEdgeChanges:y=>{const{onEdgesChange:O,setEdges:v,edges:x,hasDefaultEdges:w,debug:E}=g();if(y!=null&&y.length){if(w){const S=nne(y,x);v(S)}E&&console.log("React Flow: trigger edge changes",y),O==null||O(y)}},addSelectedNodes:y=>{const{multiSelectionActive:O,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:E}=g();if(O){const S=y.map(k=>Rh(k,!0));w(S);return}w(cg(x,new Set([...y]),!0)),E(cg(v))},addSelectedEdges:y=>{const{multiSelectionActive:O,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:E}=g();if(O){const S=y.map(k=>Rh(k,!0));E(S);return}E(cg(v,new Set([...y]))),w(cg(x,new Set,!0))},unselectNodesAndEdges:({nodes:y,edges:O}={})=>{const{edges:v,nodes:x,nodeLookup:w,triggerNodeChanges:E,triggerEdgeChanges:S}=g(),k=y||x,T=O||v,A=[];for(const j of k){if(!j.selected)continue;const M=w.get(j.id);M&&(M.selected=!1),A.push(Rh(j.id,!1))}const N=[];for(const j of T)j.selected&&N.push(Rh(j.id,!1));E(A),S(N)},setMinZoom:y=>{const{panZoom:O,maxZoom:v}=g();O==null||O.setScaleExtent([y,v]),p({minZoom:y})},setMaxZoom:y=>{const{panZoom:O,minZoom:v}=g();O==null||O.setScaleExtent([v,y]),p({maxZoom:y})},setTranslateExtent:y=>{var O;(O=g().panZoom)==null||O.setTranslateExtent(y),p({translateExtent:y})},resetSelectedElements:()=>{const{edges:y,nodes:O,triggerNodeChanges:v,triggerEdgeChanges:x,elementsSelectable:w}=g();if(!w)return;const E=O.reduce((k,T)=>T.selected?[...k,Rh(T.id,!1)]:k,[]),S=y.reduce((k,T)=>T.selected?[...k,Rh(T.id,!1)]:k,[]);v(E),x(S)},setNodeExtent:y=>{const{nodes:O,nodeLookup:v,parentLookup:x,nodeOrigin:w,elevateNodesOnSelect:E,nodeExtent:S,zIndexMode:k}=g();y[0][0]===S[0][0]&&y[0][1]===S[0][1]&&y[1][0]===S[1][0]&&y[1][1]===S[1][1]||(AP(O,v,x,{nodeOrigin:w,nodeExtent:y,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:k}),p({nodeExtent:y}))},panBy:y=>{const{transform:O,width:v,height:x,panZoom:w,translateExtent:E}=g();return XAe({delta:y,panZoom:w,transform:O,translateExtent:E,width:v,height:x})},setCenter:async(y,O,v)=>{const{width:x,height:w,maxZoom:E,panZoom:S}=g();if(!S)return!1;const k=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:E;return await S.setViewport({x:x/2-y*k,y:w/2-O*k,zoom:k},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),!0},cancelConnection:()=>{p({connection:{...yte}})},updateConnection:y=>{p({connection:y})},reset:()=>p({...RU()})}},Object.is);function _ne({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:i,initialWidth:r,initialHeight:s,initialMinZoom:a,initialMaxZoom:o,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[g]=m.useState(()=>Eje({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:u,minZoom:a,maxZoom:o,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return l.jsx(BNe,{value:g,children:l.jsx(dCe,{children:p})})}function kje({children:e,nodes:t,edges:n,defaultNodes:i,defaultEdges:r,width:s,height:a,fitView:o,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return m.useContext(L_)?l.jsx(l.Fragment,{children:e}):l.jsx(_ne,{initialNodes:t,initialEdges:n,defaultNodes:i,defaultEdges:r,initialWidth:s,initialHeight:a,fitView:o,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const Tje={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function _je({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,className:r,nodeTypes:s,edgeTypes:a,onNodeClick:o,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:g,onConnectEnd:b,onClickConnectStart:y,onClickConnectEnd:O,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:w,onNodeContextMenu:E,onNodeDoubleClick:S,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:A,onNodesDelete:N,onEdgesDelete:j,onDelete:M,onSelectionChange:D,onSelectionDragStart:L,onSelectionDrag:Q,onSelectionDragStop:C,onSelectionContextMenu:I,onSelectionStart:U,onSelectionEnd:B,onBeforeDelete:P,connectionMode:q,connectionLineType:G=ef.Bezier,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:te,deleteKeyCode:fe="Backspace",selectionKeyCode:Te="Shift",selectionOnDrag:J=!1,selectionMode:ne=bx.Full,panActivationKeyCode:ce="Space",multiSelectionKeyCode:Oe=xx()?"Meta":"Control",zoomActivationKeyCode:Se=xx()?"Meta":"Control",snapToGrid:je,snapGrid:ve,onlyRenderVisibleElements:be=!1,selectNodesOnDrag:ae,nodesDraggable:Re,autoPanOnNodeFocus:xe,nodesConnectable:Be,nodesFocusable:qe,nodeOrigin:Pe=Jte,edgesFocusable:mt,edgesReconnectable:bt,elementsSelectable:Dt=!0,defaultViewport:We=JNe,minZoom:W=.5,maxZoom:ee=2,translateExtent:se=gx,preventScrolling:he=!0,nodeExtent:F,defaultMarkerColor:_e="#b1b1b7",zoomOnScroll:Ue=!0,zoomOnPinch:Xe=!0,panOnScroll:_t=!1,panOnScrollSpeed:Bt=.5,panOnScrollMode:Et=op.Free,zoomOnDoubleClick:at=!0,panOnDrag:pe=!0,onPaneClick:ct,onPaneMouseEnter:et,onPaneMouseMove:yt,onPaneMouseLeave:At,onPaneScroll:$t,onPaneContextMenu:Ne,paneClickDistance:tt=1,nodeClickDistance:St=0,children:Wt,onReconnect:Ve,onReconnectStart:vn,onReconnectEnd:nn,onEdgeContextMenu:Nt,onEdgeDoubleClick:Ft,onEdgeMouseEnter:Ce,onEdgeMouseMove:Ze,onEdgeMouseLeave:kt,reconnectRadius:Zt=10,onNodesChange:Kt,onEdgesChange:hi,noDragClassName:Ie="nodrag",noWheelClassName:ut="nowheel",noPanClassName:Rt="nopan",fitView:Ut,fitViewOptions:Sn,connectOnClick:hn,attributionPosition:Si,proOptions:bi,defaultEdgeOptions:Qi,elevateNodesOnSelect:de=!0,elevateEdgesOnSelect:Me=!1,disableKeyboardA11y:dt=!1,autoPanOnConnect:ft,autoPanOnNodeDrag:on,autoPanOnSelection:Kn=!0,autoPanSpeed:Ei,connectionRadius:Jn,isValidConnection:bn,onError:Yn,style:ri,id:qt,nodeDragThreshold:Oi,connectionDragThreshold:ln,viewport:Ri,onViewportChange:cn,width:Ar,height:Bi,colorMode:Dn="light",debug:Qs,onScroll:Yi,ariaLabelConfig:Sa,zIndexMode:fr="basic",...Jr},Ea){const Bs=qt||"1",cs=iCe(Dn),Fn=m.useCallback(us=>{us.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Yi==null||Yi(us)},[Yi]);return l.jsx("div",{"data-testid":"rf__wrapper",...Jr,onScroll:Fn,style:{...ri,...Tje},ref:Ea,className:Kr(["react-flow",r,cs]),id:qt,role:"application",children:l.jsxs(kje,{nodes:e,edges:t,width:Ar,height:Bi,fitView:Ut,fitViewOptions:Sn,minZoom:W,maxZoom:ee,nodeOrigin:Pe,nodeExtent:F,zIndexMode:fr,children:[l.jsx(nCe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:i,onConnect:p,onConnectStart:g,onConnectEnd:b,onClickConnectStart:y,onClickConnectEnd:O,nodesDraggable:Re,autoPanOnNodeFocus:xe,nodesConnectable:Be,nodesFocusable:qe,edgesFocusable:mt,edgesReconnectable:bt,elementsSelectable:Dt,elevateNodesOnSelect:de,elevateEdgesOnSelect:Me,minZoom:W,maxZoom:ee,nodeExtent:F,onNodesChange:Kt,onEdgesChange:hi,snapToGrid:je,snapGrid:ve,connectionMode:q,translateExtent:se,connectOnClick:hn,defaultEdgeOptions:Qi,fitView:Ut,fitViewOptions:Sn,onNodesDelete:N,onEdgesDelete:j,onDelete:M,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:A,onSelectionDrag:Q,onSelectionDragStart:L,onSelectionDragStop:C,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Rt,nodeOrigin:Pe,rfId:Bs,autoPanOnConnect:ft,autoPanOnNodeDrag:on,autoPanSpeed:Ei,onError:Yn,connectionRadius:Jn,isValidConnection:bn,selectNodesOnDrag:ae,nodeDragThreshold:Oi,connectionDragThreshold:ln,onBeforeDelete:P,debug:Qs,ariaLabelConfig:Sa,zIndexMode:fr}),l.jsx(wje,{onInit:u,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:w,onNodeContextMenu:E,onNodeDoubleClick:S,nodeTypes:s,edgeTypes:a,connectionLineType:G,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:te,selectionKeyCode:Te,selectionOnDrag:J,selectionMode:ne,deleteKeyCode:fe,multiSelectionKeyCode:Oe,panActivationKeyCode:ce,zoomActivationKeyCode:Se,onlyRenderVisibleElements:be,defaultViewport:We,translateExtent:se,minZoom:W,maxZoom:ee,preventScrolling:he,zoomOnScroll:Ue,zoomOnPinch:Xe,zoomOnDoubleClick:at,panOnScroll:_t,panOnScrollSpeed:Bt,panOnScrollMode:Et,panOnDrag:pe,autoPanOnSelection:Kn,onPaneClick:ct,onPaneMouseEnter:et,onPaneMouseMove:yt,onPaneMouseLeave:At,onPaneScroll:$t,onPaneContextMenu:Ne,paneClickDistance:tt,nodeClickDistance:St,onSelectionContextMenu:I,onSelectionStart:U,onSelectionEnd:B,onReconnect:Ve,onReconnectStart:vn,onReconnectEnd:nn,onEdgeContextMenu:Nt,onEdgeDoubleClick:Ft,onEdgeMouseEnter:Ce,onEdgeMouseMove:Ze,onEdgeMouseLeave:kt,reconnectRadius:Zt,defaultMarkerColor:_e,noDragClassName:Ie,noWheelClassName:ut,noPanClassName:Rt,rfId:Bs,disableKeyboardA11y:dt,nodeExtent:F,viewport:Ri,onViewportChange:cn}),l.jsx(KNe,{onSelectionChange:D}),Wt,l.jsx(HNe,{proOptions:bi,position:Si}),l.jsx(qNe,{rfId:Bs,disableKeyboardA11y:dt})]})})}var Aje=ine(_je);const Nje=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function Cje({children:e}){const t=zn(Nje);return t?$i.createPortal(e,t):null}function jje(e){const[t,n]=m.useState(e),i=m.useCallback(r=>n(s=>tne(r,s)),[]);return[t,n,i]}function Rje(e){const[t,n]=m.useState(e),i=m.useCallback(r=>n(s=>nne(r,s)),[]);return[t,n,i]}const Ije=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!x$(n.userNode))return!1;return!0};function Pje(e={includeHiddenNodes:!1}){return zn(Ije(e))}function Mje({dimensions:e,lineWidth:t,variant:n,className:i}){return l.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Kr(["react-flow__background-pattern",n,i])})}function Lje({radius:e,className:t}){return l.jsx("circle",{cx:e,cy:e,r:e,className:Kr(["react-flow__background-pattern","dots",t])})}var Ef;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ef||(Ef={}));const Dje={[Ef.Dots]:1,[Ef.Lines]:1,[Ef.Cross]:6},$je=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Ane({id:e,variant:t=Ef.Dots,gap:n=20,size:i,lineWidth:r=1,offset:s=0,color:a,bgColor:o,style:c,className:u,patternClassName:d}){const f=m.useRef(null),{transform:h,patternId:p}=zn($je,ur),g=i||Dje[t],b=t===Ef.Dots,y=t===Ef.Cross,O=Array.isArray(n)?n:[n,n],v=[O[0]*h[2]||1,O[1]*h[2]||1],x=g*h[2],w=Array.isArray(s)?s:[s,s],E=y?[x,x]:v,S=[w[0]*h[2]||1+E[0]/2,w[1]*h[2]||1+E[1]/2],k=`${p}${e||""}`;return l.jsxs("svg",{className:Kr(["react-flow__background",u]),style:{...c,...Q_,"--xy-background-color-props":o,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[l.jsx("pattern",{id:k,x:h[0]%v[0],y:h[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:b?l.jsx(Lje,{radius:x/2,className:d}):l.jsx(Mje,{dimensions:E,lineWidth:r,variant:t,className:d})}),l.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}Ane.displayName="Background";const Qje=m.memo(Ane);function Bje(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:l.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Uje(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:l.jsx("path",{d:"M0 0h32v4.2H0z"})})}function zje(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:l.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Fje(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Vje(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function bw({children:e,className:t,...n}){return l.jsx("button",{type:"button",className:Kr(["react-flow__controls-button",t]),...n,children:e})}const Xje=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Nne({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:a,onFitView:o,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const g=dr(),{isInteractive:b,minZoomReached:y,maxZoomReached:O,ariaLabelConfig:v}=zn(Xje,ur),{zoomIn:x,zoomOut:w,fitView:E}=$_(),S=()=>{x(),s==null||s()},k=()=>{w(),a==null||a()},T=()=>{E(r),o==null||o()},A=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},N=h==="horizontal"?"horizontal":"vertical";return l.jsxs(D_,{className:Kr(["react-flow__controls",N,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??v["controls.ariaLabel"],children:[t&&l.jsxs(l.Fragment,{children:[l.jsx(bw,{onClick:S,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:O,children:l.jsx(Bje,{})}),l.jsx(bw,{onClick:k,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:y,children:l.jsx(Uje,{})})]}),n&&l.jsx(bw,{className:"react-flow__controls-fitview",onClick:T,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:l.jsx(zje,{})}),i&&l.jsx(bw,{className:"react-flow__controls-interactive",onClick:A,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:b?l.jsx(Vje,{}):l.jsx(Fje,{})}),d]})}Nne.displayName="Controls";const qje=m.memo(Nne);function Hje({id:e,x:t,y:n,width:i,height:r,style:s,color:a,strokeColor:o,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:g,backgroundColor:b}=s||{},y=a||g||b;return l.jsx("rect",{className:Kr(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:i,height:r,style:{fill:y,stroke:o,strokeWidth:c},shapeRendering:f,onClick:p?O=>p(O,e):void 0})}const Yje=m.memo(Hje),Gje=e=>e.nodes.map(t=>t.id),nC=e=>e instanceof Function?e:()=>e;function Wje({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:r,nodeComponent:s=Yje,onClick:a}){const o=zn(Gje,ur),c=nC(t),u=nC(e),d=nC(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return l.jsx(l.Fragment,{children:o.map(h=>l.jsx(Kje,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:i,nodeStrokeWidth:r,NodeComponent:s,onClick:a,shapeRendering:f},h))})}function Zje({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:o,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=zn(g=>{const b=g.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const y=b.internals.userNode,{x:O,y:v}=b.internals.positionAbsolute,{width:x,height:w}=fd(y);return{node:y,x:O,y:v,width:x,height:w}},ur);return!u||u.hidden||!x$(u)?null:l.jsx(o,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:i(u),color:t(u),borderRadius:r,strokeColor:n(u),strokeWidth:s,shapeRendering:a,onClick:c,id:u.id})}const Kje=m.memo(Zje);var Jje=m.memo(Wje);const eRe=200,tRe=150,nRe=e=>!e.hidden,iRe=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Ete(L1(e.nodeLookup,{filter:nRe}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},rRe="react-flow__minimap-desc";function Cne({style:e,className:t,nodeStrokeColor:n,nodeColor:i,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:o,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:g,pannable:b=!1,zoomable:y=!1,ariaLabel:O,inversePan:v,zoomStep:x=1,offsetScale:w=5}){const E=dr(),S=m.useRef(null),{boundingRect:k,viewBB:T,rfId:A,panZoom:N,translateExtent:j,flowWidth:M,flowHeight:D,ariaLabelConfig:L}=zn(iRe,ur),Q=(e==null?void 0:e.width)??eRe,C=(e==null?void 0:e.height)??tRe,I=k.width/Q,U=k.height/C,B=Math.max(I,U),P=B*Q,q=B*C,G=w*B,$=k.x-(P-k.width)/2-G,V=k.y-(q-k.height)/2-G,te=P+G*2,fe=q+G*2,Te=`${rRe}-${A}`,J=m.useRef(0),ne=m.useRef();J.current=B,m.useEffect(()=>{if(S.current&&N)return ne.current=eNe({domNode:S.current,panZoom:N,getTransform:()=>E.getState().transform,getViewScale:()=>J.current}),()=>{var je;(je=ne.current)==null||je.destroy()}},[N]),m.useEffect(()=>{var je;(je=ne.current)==null||je.update({translateExtent:j,width:M,height:D,inversePan:v,pannable:b,zoomStep:x,zoomable:y})},[b,y,v,x,j,M,D]);const ce=p?je=>{var ae;const[ve,be]=((ae=ne.current)==null?void 0:ae.pointer(je))||[0,0];p(je,{x:ve,y:be})}:void 0,Oe=g?m.useCallback((je,ve)=>{const be=E.getState().nodeLookup.get(ve).internals.userNode;g(je,be)},[]):void 0,Se=O??L["minimap.ariaLabel"];return l.jsx(D_,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*B:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:Kr(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:l.jsxs("svg",{width:Q,height:C,viewBox:`${$} ${V} ${te} ${fe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Te,ref:S,onClick:ce,children:[Se&&l.jsx("title",{id:Te,children:Se}),l.jsx(Jje,{onClick:Oe,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:a,nodeComponent:o}),l.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-G},${V-G}h${te+G*2}v${fe+G*2}h${-te-G*2}z + M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Cne.displayName="MiniMap";m.memo(Cne);const sRe=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,aRe={[b0.Line]:"right",[b0.Handle]:"bottom-right"};function oRe({nodeId:e,position:t,variant:n=b0.Handle,className:i,style:r=void 0,children:s,color:a,minWidth:o=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:g,onResizeStart:b,onResize:y,onResizeEnd:O}){const v=one(),x=typeof e=="string"?e:v,w=dr(),E=m.useRef(null),S=n===b0.Handle,k=zn(m.useCallback(sRe(S&&p),[S,p]),ur),T=m.useRef(null),A=t??aRe[n];m.useEffect(()=>{if(!(!E.current||!x))return T.current||(T.current=hNe({domNode:E.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:j,transform:M,snapGrid:D,snapToGrid:L,nodeOrigin:Q,domNode:C}=w.getState();return{nodeLookup:j,transform:M,snapGrid:D,snapToGrid:L,nodeOrigin:Q,paneDomNode:C}},onChange:(j,M)=>{const{triggerNodeChanges:D,nodeLookup:L,parentLookup:Q,nodeOrigin:C}=w.getState(),I=[],U={x:j.x,y:j.y},B=L.get(x);if(B&&B.expandParent&&B.parentId){const P=B.origin??C,q=j.width??B.measured.width??0,G=j.height??B.measured.height??0,$={id:B.id,parentId:B.parentId,rect:{width:q,height:G,...Tte({x:j.x??B.position.x,y:j.y??B.position.y},{width:q,height:G},B.parentId,L,P)}},V=T$([$],L,Q,C);I.push(...V),U.x=j.x?Math.max(P[0]*q,j.x):void 0,U.y=j.y?Math.max(P[1]*G,j.y):void 0}if(U.x!==void 0&&U.y!==void 0){const P={id:x,type:"position",position:{...U}};I.push(P)}if(j.width!==void 0&&j.height!==void 0){const q={id:x,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};I.push(q)}for(const P of M){const q={...P,type:"position"};I.push(q)}D(I)},onEnd:({width:j,height:M})=>{const D={id:x,type:"dimensions",resizing:!1,dimensions:{width:j,height:M}};w.getState().triggerNodeChanges([D])}})),T.current.update({controlPosition:A,boundaries:{minWidth:o,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:y,onResizeEnd:O,shouldResize:g}),()=>{var j;(j=T.current)==null||j.destroy()}},[A,o,c,u,d,f,b,y,O,g]);const N=A.split("-");return l.jsx("div",{className:Kr(["react-flow__resize-control","nodrag",...N,n,i]),ref:E,style:{...r,scale:k,...a&&{[S?"backgroundColor":"borderColor"]:a}},children:s})}m.memo(oRe);var jne=Object.defineProperty,lRe=(e,t,n)=>t in e?jne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cRe=(e,t)=>{for(var n in t)jne(e,n,{get:t[n],enumerable:!0})},uRe=(e,t,n)=>lRe(e,t+"",n),Rne={};cRe(Rne,{Graph:()=>dl,alg:()=>A$,json:()=>Pne,version:()=>hRe});var dRe=Object.defineProperty,Ine=(e,t)=>{for(var n in t)dRe(e,n,{get:t[n],enumerable:!0})},dl=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,n){return t.forEach(i=>{n!==void 0?this.setNode(i,n):this.setNode(i)}),this}setNode(t,n){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let n=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(i=>{this.setParent(i)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n="\0";else{n+="";for(let i=n;i!==void 0;i=this.parent(i))if(i===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}parent(t){if(this._isCompound){let n=this._parent[t];if(n!=="\0")return n}}children(t="\0"){if(this._isCompound){let n=this._children[t];if(n)return Object.keys(n)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let n=this._preds[t];if(n)return Object.keys(n)}successors(t){let n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){let n=this.predecessors(t);if(n){let i=new Set(n);for(let r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){let n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){let n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,a])=>{t(s)&&n.setNode(s,a)}),Object.values(this._edgeObjs).forEach(s=>{n.hasNode(s.v)&&n.hasNode(s.w)&&n.setEdge(s,this.edge(s))});let i={},r=s=>{let a=this.parent(s);return!a||n.hasNode(a)?(i[s]=a??void 0,a??void 0):a in i?i[a]:r(a)};return this._isCompound&&n.nodes().forEach(s=>n.setParent(s,r(s))),n}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){return t.reduce((i,r)=>(n!==void 0?this.setEdge(i,r,n):this.setEdge(i,r),r)),this}setEdge(t,n,i,r){let s,a,o,c,u=!1;typeof t=="object"&&t!==null&&"v"in t?(s=t.v,a=t.w,o=t.name,arguments.length===2&&(c=n,u=!0)):(s=t,a=n,o=r,arguments.length>2&&(c=i,u=!0)),s=""+s,a=""+a,o!==void 0&&(o=""+o);let d=QO(this._isDirected,s,a,o);if(d in this._edgeLabels)return u&&(this._edgeLabels[d]=c),this;if(o!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(a),this._edgeLabels[d]=u?c:this._defaultEdgeLabelFn(s,a,o);let f=fRe(this._isDirected,s,a,o);return s=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,IU(this._preds[a],s),IU(this._sucs[s],a),this._in[a][d]=f,this._out[s][d]=f,this._edgeCount++,this}edge(t,n,i){let r=arguments.length===1?iC(this._isDirected,t):QO(this._isDirected,t,n,i);return this._edgeLabels[r]}edgeAsObj(t,n,i){let r=arguments.length===1?this.edge(t):this.edge(t,n,i);return typeof r!="object"?{label:r}:r}hasEdge(t,n,i){return(arguments.length===1?iC(this._isDirected,t):QO(this._isDirected,t,n,i))in this._edgeLabels}removeEdge(t,n,i){let r=arguments.length===1?iC(this._isDirected,t):QO(this._isDirected,t,n,i),s=this._edgeObjs[r];if(s){let a=s.v,o=s.w;delete this._edgeLabels[r],delete this._edgeObjs[r],PU(this._preds[o],a),PU(this._sucs[a],o),delete this._in[o][r],delete this._out[a][r],this._edgeCount--}return this}inEdges(t,n){return this.isDirected()?this.filterEdges(this._in[t],t,n):this.nodeEdges(t,n)}outEdges(t,n){return this.isDirected()?this.filterEdges(this._out[t],t,n):this.nodeEdges(t,n)}nodeEdges(t,n){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,n)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,n,i){if(!t)return;let r=Object.values(t);return i?r.filter(s=>s.v===n&&s.w===i||s.v===i&&s.w===n):r}};function IU(e,t){e[t]?e[t]++:e[t]=1}function PU(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function QO(e,t,n,i){let r=""+t,s=""+n;if(!e&&r>s){let a=r;r=s,s=a}return r+""+s+""+(i===void 0?"\0":i)}function fRe(e,t,n,i){let r=""+t,s=""+n;if(!e&&r>s){let o=r;r=s,s=o}let a={v:r,w:s};return i&&(a.name=i),a}function iC(e,t){return QO(e,t.v,t.w,t.name)}var hRe="4.0.1",Pne={};Ine(Pne,{read:()=>bRe,write:()=>pRe});function pRe(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:mRe(e),edges:gRe(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function mRe(e){return e.nodes().map(t=>{let n=e.node(t),i=e.parent(t),r={v:t};return n!==void 0&&(r.value=n),i!==void 0&&(r.parent=i),r})}function gRe(e){return e.edges().map(t=>{let n=e.edge(t),i={v:t.v,w:t.w};return t.name!==void 0&&(i.name=t.name),n!==void 0&&(i.value=n),i})}function bRe(e){let t=new dl(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var A$={};Ine(A$,{CycleException:()=>Mk,bellmanFord:()=>Mne,components:()=>xRe,dijkstra:()=>Pk,dijkstraAll:()=>SRe,findCycles:()=>ERe,floydWarshall:()=>TRe,isAcyclic:()=>ARe,postorder:()=>CRe,preorder:()=>jRe,prim:()=>RRe,shortestPaths:()=>IRe,tarjan:()=>Dne,topsort:()=>$ne});var ORe=()=>1;function Mne(e,t,n,i){return yRe(e,String(t),n||ORe,i||function(r){return e.outEdges(r)})}function yRe(e,t,n,i){let r={},s,a=0,o=e.nodes(),c=function(f){let h=n(f);r[f.v].distance+h e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,i=String(e);if(!(i in n)){let r=this._arr,s=r.length;return n[i]=s,r.push({key:i,priority:t}),this._decrease(s),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let i=this._arr[n].priority;if(t>i)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${i} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,i=n+1,r=e;n >1,!(t[i].priority 1;function Pk(e,t,n,i){let r=function(s){return e.outEdges(s)};return wRe(e,String(t),n||vRe,i||r)}function wRe(e,t,n,i){let r={},s=new Lne,a,o,c=function(u){let d=u.v!==a?u.v:u.w,f=r[d],h=n(u),p=o.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p 0&&(a=s.removeMin(),o=r[a],o.distance!==Number.POSITIVE_INFINITY);)i(a).forEach(c);return r}function SRe(e,t,n){return e.nodes().reduce(function(i,r){return i[r]=Pk(e,r,t,n),i},{})}function Dne(e){let t=0,n=[],i={},r=[];function s(a){let o=i[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in i?i[c].onStack&&(o.lowlink=Math.min(o.lowlink,i[c].index)):(s(c),o.lowlink=Math.min(o.lowlink,i[c].lowlink))}),o.lowlink===o.index){let c=[],u;do u=n.pop(),i[u].onStack=!1,c.push(u);while(a!==u);r.push(c)}}return e.nodes().forEach(function(a){a in i||s(a)}),r}function ERe(e){return Dne(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var kRe=()=>1;function TRe(e,t,n){return _Re(e,t||kRe,n||function(i){return e.outEdges(i)})}function _Re(e,t,n){let i={},r=e.nodes();return r.forEach(function(s){i[s]={},i[s][s]={distance:0,predecessor:""},r.forEach(function(a){s!==a&&(i[s][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(s).forEach(function(a){let o=a.v===s?a.w:a.v,c=t(a);i[s][o]={distance:c,predecessor:s}})}),r.forEach(function(s){let a=i[s];r.forEach(function(o){let c=i[o];r.forEach(function(u){let d=c[s],f=a[u],h=c[u],p=d.distance+f.distance;p {var c;return(c=e.isDirected()?e.successors(o):e.neighbors(o))!=null?c:[]},a={};return t.forEach(function(o){if(!e.hasNode(o))throw new Error("Graph does not have node: "+o);r=Qne(e,o,n==="post",a,s,i,r)}),r}function Qne(e,t,n,i,r,s,a){return t in i||(i[t]=!0,n||(a=s(a,t)),r(t).forEach(function(o){a=Qne(e,o,n,i,r,s,a)}),n&&(a=s(a,t))),a}function Bne(e,t,n){return NRe(e,t,n,function(i,r){return i.push(r),i},[])}function CRe(e,t){return Bne(e,t,"post")}function jRe(e,t){return Bne(e,t,"pre")}function RRe(e,t){let n=new dl,i={},r=new Lne,s;function a(c){let u=c.v===s?c.w:c.v,d=r.priority(u);if(d!==void 0){let f=t(c);f 0;){if(s=r.removeMin(),s in i)n.setEdge(s,i[s]);else{if(o)throw new Error("Input graph is not connected: "+e);o=!0}e.nodeEdges(s).forEach(a)}return n}function IRe(e,t,n,i){return PRe(e,t,n,i??(r=>{let s=e.outEdges(r);return s??[]}))}function PRe(e,t,n,i){if(n===void 0)return Pk(e,t,n,i);let r=!1,s=e.nodes();for(let a=0;a t.setNode(n,e.node(n))),e.edges().forEach(n=>{let i=t.edge(n.v,n.w)||{weight:0,minlen:1},r=e.edge(n);t.setEdge(n.v,n.w,{weight:i.weight+r.weight,minlen:Math.max(i.minlen,r.minlen)})}),t}function Une(e){let t=new dl({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function MU(e,t){let n=e.x,i=e.y,r=t.x-n,s=t.y-i,a=e.width/2,o=e.height/2;if(!r&&!s)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(s)*a>Math.abs(r)*o?(s<0&&(o=-o),c=o*r/s,u=o):(r<0&&(a=-a),c=a,u=a*s/r),{x:n+c,y:i+u}}function Q1(e){let t=wx(Fne(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let i=e.node(n),r=i.rank;r!==void 0&&(t[r]||(t[r]=[]),t[r][i.order]=n)}),t}function LRe(e){let t=e.nodes().map(i=>{let r=e.node(i).rank;return r===void 0?Number.MAX_VALUE:r}),n=_c(Math.min,t);e.nodes().forEach(i=>{let r=e.node(i);Object.hasOwn(r,"rank")&&(r.rank-=n)})}function DRe(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=_c(Math.min,t),i=[];e.nodes().forEach(a=>{let o=e.node(a).rank-n;i[o]||(i[o]=[]),i[o].push(a)});let r=0,s=e.graph().nodeRankFactor;Array.from(i).forEach((a,o)=>{a===void 0&&o%s!==0?--r:a!==void 0&&r&&a.forEach(c=>e.node(c).rank+=r)})}function LU(e,t,n,i){let r={width:0,height:0};return arguments.length>=4&&(r.rank=n,r.order=i),tb(e,"border",r,t)}function $Re(e,t=zne){let n=[];for(let i=0;i zne){let n=$Re(t);return e(...n.map(i=>e(...i)))}else return e(...t)}function Fne(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return _c(Math.max,t)}function QRe(e,t){let n={lhs:[],rhs:[]};return e.forEach(i=>{t(i)?n.lhs.push(i):n.rhs.push(i)}),n}function Vne(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Xne(e,t){return t()}var BRe=0;function N$(e){let t=++BRe;return e+(""+t)}function wx(e,t,n=1){t==null&&(t=e,e=0);let i=s=>s t i[t]:n=t,Object.entries(e).reduce((i,[r,s])=>(i[r]=n(s,r),i),{})}function URe(e,t){return e.reduce((n,i,r)=>(n[i]=t[r],n),{})}var U_="\0",zRe="3.0.0",FRe=class{constructor(){uRe(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return DU(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&DU(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,VRe)),n=n._prev;return"["+e.join(", ")+"]"}};function DU(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function VRe(e,t){if(e!=="_next"&&e!=="_prev")return t}var XRe=FRe,qRe=()=>1;function HRe(e,t){if(e.nodeCount()<=1)return[];let n=GRe(e,t||qRe);return YRe(n.graph,n.buckets,n.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w)||[])}function YRe(e,t,n){var i;let r=[],s=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)rC(e,t,n,o);for(;o=s.dequeue();)rC(e,t,n,o);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(o=(i=t[c])==null?void 0:i.dequeue(),o){r=r.concat(rC(e,t,n,o,!0)||[]);break}}}return r}function rC(e,t,n,i,r){let s=[],a=r?s:void 0;return(e.inEdges(i.v)||[]).forEach(o=>{let c=e.edge(o),u=e.node(o.v);r&&s.push({v:o.v,w:o.w}),u.out-=c,jP(t,n,u)}),(e.outEdges(i.v)||[]).forEach(o=>{let c=e.edge(o),u=o.w,d=e.node(u);d.in-=c,jP(t,n,d)}),e.removeNode(i.v),a}function GRe(e,t){let n=new dl,i=0,r=0;e.nodes().forEach(o=>{n.setNode(o,{v:o,in:0,out:0})}),e.edges().forEach(o=>{let c=n.edge(o.v,o.w)||0,u=t(o),d=c+u;n.setEdge(o.v,o.w,d);let f=n.node(o.v),h=n.node(o.w);r=Math.max(r,f.out+=u),i=Math.max(i,h.in+=u)});let s=WRe(r+i+3).map(()=>new XRe),a=i+1;return n.nodes().forEach(o=>{jP(s,a,n.node(o))}),{graph:n,buckets:s,zeroIdx:a}}function jP(e,t,n){var i,r,s;n.out?n.in?(s=e[n.out-n.in+t])==null||s.enqueue(n):(r=e[e.length-1])==null||r.enqueue(n):(i=e[0])==null||i.enqueue(n)}function WRe(e){let t=[];for(let n=0;n{let i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,N$("rev"))});function t(n){return i=>n.edge(i).weight}}function KRe(e){let t=[],n={},i={};function r(s){Object.hasOwn(i,s)||(i[s]=!0,n[s]=!0,e.outEdges(s).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):r(a.w)}),delete n[s])}return e.nodes().forEach(r),t}function JRe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let i=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,i)}})}function eIe(e){e.graph().dummyChains=[],e.edges().forEach(t=>tIe(e,t))}function tIe(e,t){let n=t.v,i=e.node(n).rank,r=t.w,s=e.node(r).rank,a=t.name,o=e.edge(t),c=o.labelRank;if(s===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i {let n=e.node(t),i=n.edgeLabel,r;for(e.setEdge(n.edgeObj,i);n.dummy;)r=e.successors(t)[0],e.removeNode(t),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),t=r,n=e.node(t)})}function C$(e){let t={};function n(i){let r=e.node(i);if(Object.hasOwn(t,i))return r.rank;t[i]=!0;let s=e.outEdges(i),a=s?s.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],o=_c(Math.min,a);return o===Number.POSITIVE_INFINITY&&(o=0),r.rank=o}e.sources().forEach(n)}function y0(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var qne=iIe;function iIe(e){let t=new dl({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let i=n[0],r=e.nodeCount();t.setNode(i,{});let s,a;for(;rIe(t,e){let a=s.v,o=i===a?s.w:a;!e.hasNode(o)&&!y0(t,s)&&(e.setNode(o,{}),e.setEdge(i,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function sIe(e,t){return t.edges().reduce((n,i)=>{let r=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(r=y0(t,i)),r t.node(i).rank+=n)}var{preorder:oIe,postorder:lIe}=A$,cIe=Vp;Vp.initLowLimValues=R$;Vp.initCutValues=j$;Vp.calcCutValue=Hne;Vp.leaveEdge=Gne;Vp.enterEdge=Wne;Vp.exchangeEdges=Zne;function Vp(e){e=MRe(e),C$(e);let t=qne(e);R$(t),j$(t,e);let n,i;for(;n=Gne(t);)i=Wne(t,e,n),Zne(t,e,n,i)}function j$(e,t){let n=lIe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(i=>uIe(e,t,i))}function uIe(e,t,n){let i=e.node(n).parent,r=e.edge(n,i);r.cutvalue=Hne(e,t,n)}function Hne(e,t,n){let i=e.node(n).parent,r=!0,s=t.edge(n,i),a=0;s||(r=!1,s=t.edge(i,n)),a=s.weight;let o=t.nodeEdges(n);return o&&o.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==i){let f=u===r,h=t.edge(c).weight;if(a+=f?h:-h,fIe(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function R$(e,t){arguments.length<2&&(t=e.nodes()[0]),Yne(e,{},1,t)}function Yne(e,t,n,i,r){let s=n,a=e.node(i);t[i]=!0;let o=e.neighbors(i);return o&&o.forEach(c=>{Object.hasOwn(t,c)||(n=Yne(e,t,n,c,i))}),a.low=s,a.lim=n++,r?a.parent=r:delete a.parent,n}function Gne(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Wne(e,t,n){let i=n.v,r=n.w;t.hasEdge(i,r)||(i=n.w,r=n.v);let s=e.node(i),a=e.node(r),o=s,c=!1;return s.lim>a.lim&&(o=a,c=!0),t.edges().filter(u=>c===$U(e,e.node(u.v),o)&&c!==$U(e,e.node(u.w),o)).reduce((u,d)=>y0(t,d)