@langgraph-js/ui 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +2 -0
- package/.env.example +2 -0
- package/dist/assets/index-7vem5Peg.css +1 -0
- package/dist/assets/index-CZ6k2dGe.js +235 -0
- package/dist/index.html +3 -5
- package/index.html +1 -3
- package/package.json +10 -2
- package/src/artifacts/ArtifactViewer.tsx +158 -0
- package/src/artifacts/ArtifactsContext.tsx +99 -0
- package/src/artifacts/SourceCodeViewer.tsx +15 -0
- package/src/chat/Chat.tsx +102 -27
- package/src/chat/FileUpload/index.ts +3 -7
- package/src/chat/components/FileList.tsx +16 -12
- package/src/chat/components/HistoryList.tsx +39 -137
- package/src/chat/components/JsonEditorPopup.tsx +57 -45
- package/src/chat/components/JsonToMessage/JsonToMessage.tsx +20 -14
- package/src/chat/components/JsonToMessage/JsonToMessageButton.tsx +9 -16
- package/src/chat/components/JsonToMessage/index.tsx +1 -1
- package/src/chat/components/MessageAI.tsx +5 -4
- package/src/chat/components/MessageBox.tsx +21 -19
- package/src/chat/components/MessageHuman.tsx +13 -10
- package/src/chat/components/MessageTool.tsx +71 -30
- package/src/chat/components/UsageMetadata.tsx +41 -22
- package/src/chat/context/ChatContext.tsx +14 -5
- package/src/chat/store/index.ts +25 -2
- package/src/chat/tools/ask_user_for_approve.tsx +80 -0
- package/src/chat/tools/create_artifacts.tsx +50 -0
- package/src/chat/tools/index.ts +5 -0
- package/src/chat/tools/update_plan.tsx +75 -0
- package/src/chat/tools/web_search_tool.tsx +89 -0
- package/src/graph/index.tsx +9 -6
- package/src/index.ts +1 -0
- package/src/login/Login.tsx +155 -47
- package/src/memory/BaseDB.ts +92 -0
- package/src/memory/db.ts +232 -0
- package/src/memory/fulltext-search.ts +191 -0
- package/src/memory/index.ts +4 -0
- package/src/memory/tools.ts +170 -0
- package/test/main.tsx +2 -2
- package/vite.config.ts +7 -1
- package/dist/assets/index-BWndsYW1.js +0 -214
- package/dist/assets/index-LcgERueJ.css +0 -1
- package/src/chat/chat.css +0 -406
- package/src/chat/components/FileList.css +0 -129
- package/src/chat/components/JsonEditorPopup.css +0 -81
- package/src/chat/components/JsonToMessage/JsonToMessage.css +0 -104
- package/src/chat/tools.ts +0 -33
- package/src/login/Login.css +0 -93
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
var yR=Object.defineProperty;var vR=(e,t,n)=>t in e?yR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ut=(e,t,n)=>vR(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function Fi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mm={exports:{}},ol={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var B1;function xR(){if(B1)return ol;B1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,o){var l=null;if(o!==void 0&&(l=""+o),s.key!==void 0&&(l=""+s.key),"key"in s){o={};for(var u in s)u!=="key"&&(o[u]=s[u])}else o=s;return s=o.ref,{$$typeof:e,type:r,key:l,ref:s!==void 0?s:null,props:o}}return ol.Fragment=t,ol.jsx=n,ol.jsxs=n,ol}var U1;function bR(){return U1||(U1=1,Mm.exports=xR()),Mm.exports}var A=bR(),Om={exports:{}},ll={},Rm={exports:{}},Dm={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* scheduler.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var H1;function wR(){return H1||(H1=1,function(e){function t(I,P){var Y=I.length;I.push(P);e:for(;0<Y;){var Z=Y-1>>>1,k=I[Z];if(0<s(k,P))I[Z]=P,I[Y]=k,Y=Z;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var P=I[0],Y=I.pop();if(Y!==P){I[0]=Y;e:for(var Z=0,k=I.length,G=k>>>1;Z<G;){var te=2*(Z+1)-1,C=I[te],F=te+1,W=I[F];if(0>s(C,Y))F<k&&0>s(W,C)?(I[Z]=W,I[F]=Y,Z=F):(I[Z]=C,I[te]=Y,Z=te);else if(F<k&&0>s(W,Y))I[Z]=W,I[F]=Y,Z=F;else break e}}return P}function s(I,P){var Y=I.sortIndex-P.sortIndex;return Y!==0?Y:I.id-P.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var f=[],d=[],h=1,p=null,g=3,v=!1,b=!1,w=!1,_=!1,E=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function M(I){for(var P=n(d);P!==null;){if(P.callback===null)r(d);else if(P.startTime<=I)r(d),P.sortIndex=P.expirationTime,t(f,P);else break;P=n(d)}}function D(I){if(w=!1,M(I),!b)if(n(f)!==null)b=!0,R||(R=!0,H());else{var P=n(d);P!==null&&$(D,P.startTime-I)}}var R=!1,B=-1,z=5,U=-1;function O(){return _?!0:!(e.unstable_now()-U<z)}function V(){if(_=!1,R){var I=e.unstable_now();U=I;var P=!0;try{e:{b=!1,w&&(w=!1,T(B),B=-1),v=!0;var Y=g;try{t:{for(M(I),p=n(f);p!==null&&!(p.expirationTime>I&&O());){var Z=p.callback;if(typeof Z=="function"){p.callback=null,g=p.priorityLevel;var k=Z(p.expirationTime<=I);if(I=e.unstable_now(),typeof k=="function"){p.callback=k,M(I),P=!0;break t}p===n(f)&&r(f),M(I)}else r(f);p=n(f)}if(p!==null)P=!0;else{var G=n(d);G!==null&&$(D,G.startTime-I),P=!1}}break e}finally{p=null,g=Y,v=!1}P=void 0}}finally{P?H():R=!1}}}var H;if(typeof S=="function")H=function(){S(V)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,j=Q.port2;Q.port1.onmessage=V,H=function(){j.postMessage(null)}}else H=function(){E(V,0)};function $(I,P){B=E(function(){I(e.unstable_now())},P)}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(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_next=function(I){switch(g){case 1:case 2:case 3:var P=3;break;default:P=g}var Y=g;g=P;try{return I()}finally{g=Y}},e.unstable_requestPaint=function(){_=!0},e.unstable_runWithPriority=function(I,P){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var Y=g;g=I;try{return P()}finally{g=Y}},e.unstable_scheduleCallback=function(I,P,Y){var Z=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?Z+Y:Z):Y=Z,I){case 1:var k=-1;break;case 2:k=250;break;case 5:k=1073741823;break;case 4:k=1e4;break;default:k=5e3}return k=Y+k,I={id:h++,callback:P,priorityLevel:I,startTime:Y,expirationTime:k,sortIndex:-1},Y>Z?(I.sortIndex=Y,t(d,I),n(f)===null&&I===n(d)&&(w?(T(B),B=-1):w=!0,$(D,Y-Z))):(I.sortIndex=k,t(f,I),b||v||(b=!0,R||(R=!0,H()))),I},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(I){var P=g;return function(){var Y=g;g=P;try{return I.apply(this,arguments)}finally{g=Y}}}}(Dm)),Dm}var F1;function _R(){return F1||(F1=1,Rm.exports=wR()),Rm.exports}var jm={exports:{}},Pe={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* react.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var $1;function SR(){if($1)return Pe;$1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator;function g(k){return k===null||typeof k!="object"?null:(k=p&&k[p]||k["@@iterator"],typeof k=="function"?k:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,w={};function _(k,G,te){this.props=k,this.context=G,this.refs=w,this.updater=te||v}_.prototype.isReactComponent={},_.prototype.setState=function(k,G){if(typeof k!="object"&&typeof k!="function"&&k!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,k,G,"setState")},_.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function E(){}E.prototype=_.prototype;function T(k,G,te){this.props=k,this.context=G,this.refs=w,this.updater=te||v}var S=T.prototype=new E;S.constructor=T,b(S,_.prototype),S.isPureReactComponent=!0;var M=Array.isArray,D={H:null,A:null,T:null,S:null,V:null},R=Object.prototype.hasOwnProperty;function B(k,G,te,C,F,W){return te=W.ref,{$$typeof:e,type:k,key:G,ref:te!==void 0?te:null,props:W}}function z(k,G){return B(k.type,G,void 0,void 0,void 0,k.props)}function U(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function O(k){var G={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(te){return G[te]})}var V=/\/+/g;function H(k,G){return typeof k=="object"&&k!==null&&k.key!=null?O(""+k.key):G.toString(36)}function Q(){}function j(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(Q,Q):(k.status="pending",k.then(function(G){k.status==="pending"&&(k.status="fulfilled",k.value=G)},function(G){k.status==="pending"&&(k.status="rejected",k.reason=G)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function $(k,G,te,C,F){var W=typeof k;(W==="undefined"||W==="boolean")&&(k=null);var J=!1;if(k===null)J=!0;else switch(W){case"bigint":case"string":case"number":J=!0;break;case"object":switch(k.$$typeof){case e:case t:J=!0;break;case h:return J=k._init,$(J(k._payload),G,te,C,F)}}if(J)return F=F(k),J=C===""?"."+H(k,0):C,M(F)?(te="",J!=null&&(te=J.replace(V,"$&/")+"/"),$(F,G,te,"",function(ge){return ge})):F!=null&&(U(F)&&(F=z(F,te+(F.key==null||k&&k.key===F.key?"":(""+F.key).replace(V,"$&/")+"/")+J)),G.push(F)),1;J=0;var oe=C===""?".":C+":";if(M(k))for(var ce=0;ce<k.length;ce++)C=k[ce],W=oe+H(C,ce),J+=$(C,G,te,W,F);else if(ce=g(k),typeof ce=="function")for(k=ce.call(k),ce=0;!(C=k.next()).done;)C=C.value,W=oe+H(C,ce++),J+=$(C,G,te,W,F);else if(W==="object"){if(typeof k.then=="function")return $(j(k),G,te,C,F);throw G=String(k),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return J}function I(k,G,te){if(k==null)return k;var C=[],F=0;return $(k,C,"","",function(W){return G.call(te,W,F++)}),C}function P(k){if(k._status===-1){var G=k._result;G=G(),G.then(function(te){(k._status===0||k._status===-1)&&(k._status=1,k._result=te)},function(te){(k._status===0||k._status===-1)&&(k._status=2,k._result=te)}),k._status===-1&&(k._status=0,k._result=G)}if(k._status===1)return k._result.default;throw k._result}var Y=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)};function Z(){}return Pe.Children={map:I,forEach:function(k,G,te){I(k,function(){G.apply(this,arguments)},te)},count:function(k){var G=0;return I(k,function(){G++}),G},toArray:function(k){return I(k,function(G){return G})||[]},only:function(k){if(!U(k))throw Error("React.Children.only expected to receive a single React element child.");return k}},Pe.Component=_,Pe.Fragment=n,Pe.Profiler=s,Pe.PureComponent=T,Pe.StrictMode=r,Pe.Suspense=f,Pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Pe.__COMPILER_RUNTIME={__proto__:null,c:function(k){return D.H.useMemoCache(k)}},Pe.cache=function(k){return function(){return k.apply(null,arguments)}},Pe.cloneElement=function(k,G,te){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var C=b({},k.props),F=k.key,W=void 0;if(G!=null)for(J in G.ref!==void 0&&(W=void 0),G.key!==void 0&&(F=""+G.key),G)!R.call(G,J)||J==="key"||J==="__self"||J==="__source"||J==="ref"&&G.ref===void 0||(C[J]=G[J]);var J=arguments.length-2;if(J===1)C.children=te;else if(1<J){for(var oe=Array(J),ce=0;ce<J;ce++)oe[ce]=arguments[ce+2];C.children=oe}return B(k.type,F,void 0,void 0,W,C)},Pe.createContext=function(k){return k={$$typeof:l,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:o,_context:k},k},Pe.createElement=function(k,G,te){var C,F={},W=null;if(G!=null)for(C in G.key!==void 0&&(W=""+G.key),G)R.call(G,C)&&C!=="key"&&C!=="__self"&&C!=="__source"&&(F[C]=G[C]);var J=arguments.length-2;if(J===1)F.children=te;else if(1<J){for(var oe=Array(J),ce=0;ce<J;ce++)oe[ce]=arguments[ce+2];F.children=oe}if(k&&k.defaultProps)for(C in J=k.defaultProps,J)F[C]===void 0&&(F[C]=J[C]);return B(k,W,void 0,void 0,null,F)},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(k){return{$$typeof:u,render:k}},Pe.isValidElement=U,Pe.lazy=function(k){return{$$typeof:h,_payload:{_status:-1,_result:k},_init:P}},Pe.memo=function(k,G){return{$$typeof:d,type:k,compare:G===void 0?null:G}},Pe.startTransition=function(k){var G=D.T,te={};D.T=te;try{var C=k(),F=D.S;F!==null&&F(te,C),typeof C=="object"&&C!==null&&typeof C.then=="function"&&C.then(Z,Y)}catch(W){Y(W)}finally{D.T=G}},Pe.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Pe.use=function(k){return D.H.use(k)},Pe.useActionState=function(k,G,te){return D.H.useActionState(k,G,te)},Pe.useCallback=function(k,G){return D.H.useCallback(k,G)},Pe.useContext=function(k){return D.H.useContext(k)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(k,G){return D.H.useDeferredValue(k,G)},Pe.useEffect=function(k,G,te){var C=D.H;if(typeof te=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return C.useEffect(k,G)},Pe.useId=function(){return D.H.useId()},Pe.useImperativeHandle=function(k,G,te){return D.H.useImperativeHandle(k,G,te)},Pe.useInsertionEffect=function(k,G){return D.H.useInsertionEffect(k,G)},Pe.useLayoutEffect=function(k,G){return D.H.useLayoutEffect(k,G)},Pe.useMemo=function(k,G){return D.H.useMemo(k,G)},Pe.useOptimistic=function(k,G){return D.H.useOptimistic(k,G)},Pe.useReducer=function(k,G,te){return D.H.useReducer(k,G,te)},Pe.useRef=function(k){return D.H.useRef(k)},Pe.useState=function(k){return D.H.useState(k)},Pe.useSyncExternalStore=function(k,G,te){return D.H.useSyncExternalStore(k,G,te)},Pe.useTransition=function(){return D.H.useTransition()},Pe.version="19.1.0",Pe}var q1;function ru(){return q1||(q1=1,jm.exports=SR()),jm.exports}var zm={exports:{}},Zt={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var G1;function ER(){if(G1)return Zt;G1=1;var e=ru();function t(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)d+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(f,d,h){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:f,containerInfo:d,implementation:h}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Zt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Zt.createPortal=function(f,d){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return o(f,d,null,h)},Zt.flushSync=function(f){var d=l.T,h=r.p;try{if(l.T=null,r.p=2,f)return f()}finally{l.T=d,r.p=h,r.d.f()}},Zt.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(f,d))},Zt.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Zt.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var h=d.as,p=u(h,d.crossOrigin),g=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;h==="style"?r.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:p,integrity:g,fetchPriority:v}):h==="script"&&r.d.X(f,{crossOrigin:p,integrity:g,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Zt.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var h=u(d.as,d.crossOrigin);r.d.M(f,{crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(f)},Zt.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var h=d.as,p=u(h,d.crossOrigin);r.d.L(f,h,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Zt.preloadModule=function(f,d){if(typeof f=="string")if(d){var h=u(d.as,d.crossOrigin);r.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(f)},Zt.requestFormReset=function(f){r.d.r(f)},Zt.unstable_batchedUpdates=function(f,d){return f(d)},Zt.useFormState=function(f,d,h){return l.H.useFormState(f,d,h)},Zt.useFormStatus=function(){return l.H.useHostTransitionStatus()},Zt.version="19.1.0",Zt}var Y1;function Kk(){if(Y1)return zm.exports;Y1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),zm.exports=ER(),zm.exports}/**
|
|
34
|
+
* @license React
|
|
35
|
+
* react-dom-client.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var Z1;function kR(){if(Z1)return ll;Z1=1;var e=_R(),t=ru(),n=Kk();function r(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function o(i){var a=i,c=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(c=a.return),i=a.return;while(i)}return a.tag===3?c:null}function l(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function u(i){if(o(i)!==i)throw Error(r(188))}function f(i){var a=i.alternate;if(!a){if(a=o(i),a===null)throw Error(r(188));return a!==i?null:i}for(var c=i,m=a;;){var y=c.return;if(y===null)break;var x=y.alternate;if(x===null){if(m=y.return,m!==null){c=m;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===c)return u(y),i;if(x===m)return u(y),a;x=x.sibling}throw Error(r(188))}if(c.return!==m.return)c=y,m=x;else{for(var N=!1,L=y.child;L;){if(L===c){N=!0,c=y,m=x;break}if(L===m){N=!0,m=y,c=x;break}L=L.sibling}if(!N){for(L=x.child;L;){if(L===c){N=!0,c=x,m=y;break}if(L===m){N=!0,m=x,c=y;break}L=L.sibling}if(!N)throw Error(r(189))}}if(c.alternate!==m)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?i:a}function d(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=d(i),a!==null)return a;i=i.sibling}return null}var h=Object.assign,p=Symbol.for("react.element"),g=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),T=Symbol.for("react.consumer"),S=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function H(i){return i===null||typeof i!="object"?null:(i=V&&i[V]||i["@@iterator"],typeof i=="function"?i:null)}var Q=Symbol.for("react.client.reference");function j(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===Q?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case b:return"Fragment";case _:return"Profiler";case w:return"StrictMode";case D:return"Suspense";case R:return"SuspenseList";case U:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case v:return"Portal";case S:return(i.displayName||"Context")+".Provider";case T:return(i._context.displayName||"Context")+".Consumer";case M:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case B:return a=i.displayName||null,a!==null?a:j(i.type)||"Memo";case z:a=i._payload,i=i._init;try{return j(i(a))}catch{}}return null}var $=Array.isArray,I=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},Z=[],k=-1;function G(i){return{current:i}}function te(i){0>k||(i.current=Z[k],Z[k]=null,k--)}function C(i,a){k++,Z[k]=i.current,i.current=a}var F=G(null),W=G(null),J=G(null),oe=G(null);function ce(i,a){switch(C(J,a),C(W,i),C(F,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?m1(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=m1(a),i=p1(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}te(F),C(F,i)}function ge(){te(F),te(W),te(J)}function ke(i){i.memoizedState!==null&&C(oe,i);var a=F.current,c=p1(a,i.type);a!==c&&(C(W,i),C(F,c))}function _e(i){W.current===i&&(te(F),te(W)),oe.current===i&&(te(oe),nl._currentValue=Y)}var ye=Object.prototype.hasOwnProperty,je=e.unstable_scheduleCallback,ze=e.unstable_cancelCallback,ot=e.unstable_shouldYield,ft=e.unstable_requestPaint,Et=e.unstable_now,Gi=e.unstable_getCurrentPriorityLevel,kr=e.unstable_ImmediatePriority,$n=e.unstable_UserBlockingPriority,or=e.unstable_NormalPriority,Tr=e.unstable_LowPriority,lr=e.unstable_IdlePriority,Yi=e.log,ur=e.unstable_setDisableYieldValue,ae=null,de=null;function Ee(i){if(typeof Yi=="function"&&ur(i),de&&typeof de.setStrictMode=="function")try{de.setStrictMode(ae,i)}catch{}}var Te=Math.clz32?Math.clz32:qn,Qe=Math.log,Jt=Math.LN2;function qn(i){return i>>>=0,i===0?32:31-(Qe(i)/Jt|0)|0}var qt=256,On=4194304;function en(i){var a=i&42;if(a!==0)return a;switch(i&-i){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:case 262144:case 524288:case 1048576:case 2097152:return i&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function kt(i,a,c){var m=i.pendingLanes;if(m===0)return 0;var y=0,x=i.suspendedLanes,N=i.pingedLanes;i=i.warmLanes;var L=m&134217727;return L!==0?(m=L&~x,m!==0?y=en(m):(N&=L,N!==0?y=en(N):c||(c=L&~i,c!==0&&(y=en(c))))):(L=m&~x,L!==0?y=en(L):N!==0?y=en(N):c||(c=m&~i,c!==0&&(y=en(c)))),y===0?0:a!==0&&a!==y&&(a&x)===0&&(x=y&-y,c=a&-a,x>=c||x===32&&(c&4194048)!==0)?a:y}function an(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function yn(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 yu(){var i=qt;return qt<<=1,(qt&4194048)===0&&(qt=256),i}function vu(){var i=On;return On<<=1,(On&62914560)===0&&(On=4194304),i}function io(i){for(var a=[],c=0;31>c;c++)a.push(i);return a}function Zi(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function wd(i,a,c,m,y,x){var N=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var L=i.entanglements,q=i.expirationTimes,re=i.hiddenUpdates;for(c=N&~c;0<c;){var le=31-Te(c),fe=1<<le;L[le]=0,q[le]=-1;var ie=re[le];if(ie!==null)for(re[le]=null,le=0;le<ie.length;le++){var se=ie[le];se!==null&&(se.lane&=-536870913)}c&=~fe}m!==0&&so(i,m,0),x!==0&&y===0&&i.tag!==0&&(i.suspendedLanes|=x&~(N&~a))}function so(i,a,c){i.pendingLanes|=a,i.suspendedLanes&=~a;var m=31-Te(a);i.entangledLanes|=a,i.entanglements[m]=i.entanglements[m]|1073741824|c&4194090}function xu(i,a){var c=i.entangledLanes|=a;for(i=i.entanglements;c;){var m=31-Te(c),y=1<<m;y&a|i[m]&a&&(i[m]|=a),c&=~y}}function ao(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function oo(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function bu(){var i=P.p;return i!==0?i:(i=window.event,i===void 0?32:j1(i.type))}function _d(i,a){var c=P.p;try{return P.p=i,a()}finally{P.p=c}}var cr=Math.random().toString(36).slice(2),zt="__reactFiber$"+cr,Gt="__reactProps$"+cr,ei="__reactContainer$"+cr,lo="__reactEvents$"+cr,Sd="__reactListeners$"+cr,Ed="__reactHandles$"+cr,wu="__reactResources$"+cr,Xi="__reactMarker$"+cr;function uo(i){delete i[zt],delete i[Gt],delete i[lo],delete i[Sd],delete i[Ed]}function Cr(i){var a=i[zt];if(a)return a;for(var c=i.parentNode;c;){if(a=c[ei]||c[zt]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(i=x1(i);i!==null;){if(c=i[zt])return c;i=x1(i)}return a}i=c,c=i.parentNode}return null}function Ar(i){if(i=i[zt]||i[ei]){var a=i.tag;if(a===5||a===6||a===13||a===26||a===27||a===3)return i}return null}function ti(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(r(33))}function ni(i){var a=i[wu];return a||(a=i[wu]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Tt(i){i[Xi]=!0}var _u=new Set,Su={};function Nr(i,a){ri(i,a),ri(i+"Capture",a)}function ri(i,a){for(Su[i]=a,i=0;i<a.length;i++)_u.add(a[i])}var Eu=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ku={},Tu={};function kd(i){return ye.call(Tu,i)?!0:ye.call(ku,i)?!1:Eu.test(i)?Tu[i]=!0:(ku[i]=!0,!1)}function zs(i,a,c){if(kd(a))if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var m=a.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,""+c)}}function Ls(i,a,c){if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttribute(a,""+c)}}function Gn(i,a,c,m){if(m===null)i.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(a,c,""+m)}}var co,fo;function ii(i){if(co===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);co=a&&a[1]||"",fo=-1<c.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+co+i+fo}var ho=!1;function mo(i,a){if(!i||ho)return"";ho=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(a){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(se){var ie=se}Reflect.construct(i,[],fe)}else{try{fe.call()}catch(se){ie=se}i.call(fe.prototype)}}else{try{throw Error()}catch(se){ie=se}(fe=i())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(se){if(se&&ie&&typeof se.stack=="string")return[se.stack,ie.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=m.DetermineComponentFrameRoot(),N=x[0],L=x[1];if(N&&L){var q=N.split(`
|
|
44
|
+
`),re=L.split(`
|
|
45
|
+
`);for(y=m=0;m<q.length&&!q[m].includes("DetermineComponentFrameRoot");)m++;for(;y<re.length&&!re[y].includes("DetermineComponentFrameRoot");)y++;if(m===q.length||y===re.length)for(m=q.length-1,y=re.length-1;1<=m&&0<=y&&q[m]!==re[y];)y--;for(;1<=m&&0<=y;m--,y--)if(q[m]!==re[y]){if(m!==1||y!==1)do if(m--,y--,0>y||q[m]!==re[y]){var le=`
|
|
46
|
+
`+q[m].replace(" at new "," at ");return i.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",i.displayName)),le}while(1<=m&&0<=y);break}}}finally{ho=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?ii(c):""}function Td(i){switch(i.tag){case 26:case 27:case 5:return ii(i.type);case 16:return ii("Lazy");case 13:return ii("Suspense");case 19:return ii("SuspenseList");case 0:case 15:return mo(i.type,!1);case 11:return mo(i.type.render,!1);case 1:return mo(i.type,!0);case 31:return ii("Activity");default:return""}}function Cu(i){try{var a="";do a+=Td(i),i=i.return;while(i);return a}catch(c){return`
|
|
47
|
+
Error generating stack: `+c.message+`
|
|
48
|
+
`+c.stack}}function on(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Au(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Ps(i){var a=Au(i)?"checked":"value",c=Object.getOwnPropertyDescriptor(i.constructor.prototype,a),m=""+i[a];if(!i.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var y=c.get,x=c.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return y.call(this)},set:function(N){m=""+N,x.call(this,N)}}),Object.defineProperty(i,a,{enumerable:c.enumerable}),{getValue:function(){return m},setValue:function(N){m=""+N},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function Is(i){i._valueTracker||(i._valueTracker=Ps(i))}function Nu(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var c=a.getValue(),m="";return i&&(m=Au(i)?i.checked?"true":"false":i.value),i=m,i!==c?(a.setValue(i),!0):!1}function si(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Cd=/[\n"\\]/g;function ln(i){return i.replace(Cd,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Vs(i,a,c,m,y,x,N,L){i.name="",N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?i.type=N:i.removeAttribute("type"),a!=null?N==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+on(a)):i.value!==""+on(a)&&(i.value=""+on(a)):N!=="submit"&&N!=="reset"||i.removeAttribute("value"),a!=null?Ad(i,N,on(a)):c!=null?Ad(i,N,on(c)):m!=null&&i.removeAttribute("value"),y==null&&x!=null&&(i.defaultChecked=!!x),y!=null&&(i.checked=y&&typeof y!="function"&&typeof y!="symbol"),L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"?i.name=""+on(L):i.removeAttribute("name")}function fv(i,a,c,m,y,x,N,L){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(i.type=x),a!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||a!=null))return;c=c!=null?""+on(c):"",a=a!=null?""+on(a):c,L||a===i.value||(i.value=a),i.defaultValue=a}m=m??y,m=typeof m!="function"&&typeof m!="symbol"&&!!m,i.checked=L?i.checked:!!m,i.defaultChecked=!!m,N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(i.name=N)}function Ad(i,a,c){a==="number"&&si(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function Bs(i,a,c,m){if(i=i.options,a){a={};for(var y=0;y<c.length;y++)a["$"+c[y]]=!0;for(c=0;c<i.length;c++)y=a.hasOwnProperty("$"+i[c].value),i[c].selected!==y&&(i[c].selected=y),y&&m&&(i[c].defaultSelected=!0)}else{for(c=""+on(c),a=null,y=0;y<i.length;y++){if(i[y].value===c){i[y].selected=!0,m&&(i[y].defaultSelected=!0);return}a!==null||i[y].disabled||(a=i[y])}a!==null&&(a.selected=!0)}}function dv(i,a,c){if(a!=null&&(a=""+on(a),a!==i.value&&(i.value=a),c==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=c!=null?""+on(c):""}function hv(i,a,c,m){if(a==null){if(m!=null){if(c!=null)throw Error(r(92));if($(m)){if(1<m.length)throw Error(r(93));m=m[0]}c=m}c==null&&(c=""),a=c}c=on(a),i.defaultValue=c,m=i.textContent,m===c&&m!==""&&m!==null&&(i.value=m)}function Us(i,a){if(a){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=a;return}}i.textContent=a}var mM=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function mv(i,a,c){var m=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?m?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":m?i.setProperty(a,c):typeof c!="number"||c===0||mM.has(a)?a==="float"?i.cssFloat=c:i[a]=(""+c).trim():i[a]=c+"px"}function pv(i,a,c){if(a!=null&&typeof a!="object")throw Error(r(62));if(i=i.style,c!=null){for(var m in c)!c.hasOwnProperty(m)||a!=null&&a.hasOwnProperty(m)||(m.indexOf("--")===0?i.setProperty(m,""):m==="float"?i.cssFloat="":i[m]="");for(var y in a)m=a[y],a.hasOwnProperty(y)&&c[y]!==m&&mv(i,y,m)}else for(var x in a)a.hasOwnProperty(x)&&mv(i,x,a[x])}function Nd(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pM=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),gM=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Mu(i){return gM.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}var Md=null;function Od(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Hs=null,Fs=null;function gv(i){var a=Ar(i);if(a&&(i=a.stateNode)){var c=i[Gt]||null;e:switch(i=a.stateNode,a.type){case"input":if(Vs(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+ln(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var m=c[a];if(m!==i&&m.form===i.form){var y=m[Gt]||null;if(!y)throw Error(r(90));Vs(m,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(a=0;a<c.length;a++)m=c[a],m.form===i.form&&Nu(m)}break e;case"textarea":dv(i,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&Bs(i,!!c.multiple,a,!1)}}}var Rd=!1;function yv(i,a,c){if(Rd)return i(a,c);Rd=!0;try{var m=i(a);return m}finally{if(Rd=!1,(Hs!==null||Fs!==null)&&(pc(),Hs&&(a=Hs,i=Fs,Fs=Hs=null,gv(a),i)))for(a=0;a<i.length;a++)gv(i[a])}}function po(i,a){var c=i.stateNode;if(c===null)return null;var m=c[Gt]||null;if(m===null)return null;c=m[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(i=i.type,m=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!m;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(r(231,a,typeof c));return c}var Mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Dd=!1;if(Mr)try{var go={};Object.defineProperty(go,"passive",{get:function(){Dd=!0}}),window.addEventListener("test",go,go),window.removeEventListener("test",go,go)}catch{Dd=!1}var ai=null,jd=null,Ou=null;function vv(){if(Ou)return Ou;var i,a=jd,c=a.length,m,y="value"in ai?ai.value:ai.textContent,x=y.length;for(i=0;i<c&&a[i]===y[i];i++);var N=c-i;for(m=1;m<=N&&a[c-m]===y[x-m];m++);return Ou=y.slice(i,1<m?1-m:void 0)}function Ru(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function Du(){return!0}function xv(){return!1}function un(i){function a(c,m,y,x,N){this._reactName=c,this._targetInst=y,this.type=m,this.nativeEvent=x,this.target=N,this.currentTarget=null;for(var L in i)i.hasOwnProperty(L)&&(c=i[L],this[L]=c?c(x):x[L]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Du:xv,this.isPropagationStopped=xv,this}return h(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Du)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Du)},persist:function(){},isPersistent:Du}),a}var Qi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ju=un(Qi),yo=h({},Qi,{view:0,detail:0}),yM=un(yo),zd,Ld,vo,zu=h({},yo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Id,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==vo&&(vo&&i.type==="mousemove"?(zd=i.screenX-vo.screenX,Ld=i.screenY-vo.screenY):Ld=zd=0,vo=i),zd)},movementY:function(i){return"movementY"in i?i.movementY:Ld}}),bv=un(zu),vM=h({},zu,{dataTransfer:0}),xM=un(vM),bM=h({},yo,{relatedTarget:0}),Pd=un(bM),wM=h({},Qi,{animationName:0,elapsedTime:0,pseudoElement:0}),_M=un(wM),SM=h({},Qi,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),EM=un(SM),kM=h({},Qi,{data:0}),wv=un(kM),TM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},CM={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},AM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function NM(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=AM[i])?!!a[i]:!1}function Id(){return NM}var MM=h({},yo,{key:function(i){if(i.key){var a=TM[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=Ru(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?CM[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Id,charCode:function(i){return i.type==="keypress"?Ru(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Ru(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),OM=un(MM),RM=h({},zu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_v=un(RM),DM=h({},yo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Id}),jM=un(DM),zM=h({},Qi,{propertyName:0,elapsedTime:0,pseudoElement:0}),LM=un(zM),PM=h({},zu,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),IM=un(PM),VM=h({},Qi,{newState:0,oldState:0}),BM=un(VM),UM=[9,13,27,32],Vd=Mr&&"CompositionEvent"in window,xo=null;Mr&&"documentMode"in document&&(xo=document.documentMode);var HM=Mr&&"TextEvent"in window&&!xo,Sv=Mr&&(!Vd||xo&&8<xo&&11>=xo),Ev=" ",kv=!1;function Tv(i,a){switch(i){case"keyup":return UM.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cv(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var $s=!1;function FM(i,a){switch(i){case"compositionend":return Cv(a);case"keypress":return a.which!==32?null:(kv=!0,Ev);case"textInput":return i=a.data,i===Ev&&kv?null:i;default:return null}}function $M(i,a){if($s)return i==="compositionend"||!Vd&&Tv(i,a)?(i=vv(),Ou=jd=ai=null,$s=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Sv&&a.locale!=="ko"?null:a.data;default:return null}}var qM={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Av(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!qM[i.type]:a==="textarea"}function Nv(i,a,c,m){Hs?Fs?Fs.push(m):Fs=[m]:Hs=m,a=wc(a,"onChange"),0<a.length&&(c=new ju("onChange","change",null,c,m),i.push({event:c,listeners:a}))}var bo=null,wo=null;function GM(i){u1(i,0)}function Lu(i){var a=ti(i);if(Nu(a))return i}function Mv(i,a){if(i==="change")return a}var Ov=!1;if(Mr){var Bd;if(Mr){var Ud="oninput"in document;if(!Ud){var Rv=document.createElement("div");Rv.setAttribute("oninput","return;"),Ud=typeof Rv.oninput=="function"}Bd=Ud}else Bd=!1;Ov=Bd&&(!document.documentMode||9<document.documentMode)}function Dv(){bo&&(bo.detachEvent("onpropertychange",jv),wo=bo=null)}function jv(i){if(i.propertyName==="value"&&Lu(wo)){var a=[];Nv(a,wo,i,Od(i)),yv(GM,a)}}function YM(i,a,c){i==="focusin"?(Dv(),bo=a,wo=c,bo.attachEvent("onpropertychange",jv)):i==="focusout"&&Dv()}function ZM(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Lu(wo)}function XM(i,a){if(i==="click")return Lu(a)}function QM(i,a){if(i==="input"||i==="change")return Lu(a)}function KM(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var vn=typeof Object.is=="function"?Object.is:KM;function _o(i,a){if(vn(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var c=Object.keys(i),m=Object.keys(a);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var y=c[m];if(!ye.call(a,y)||!vn(i[y],a[y]))return!1}return!0}function zv(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Lv(i,a){var c=zv(i);i=0;for(var m;c;){if(c.nodeType===3){if(m=i+c.textContent.length,i<=a&&m>=a)return{node:c,offset:a-i};i=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=zv(c)}}function Pv(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?Pv(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function Iv(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=si(i.document);a instanceof i.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)i=a.contentWindow;else break;a=si(i.document)}return a}function Hd(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var WM=Mr&&"documentMode"in document&&11>=document.documentMode,qs=null,Fd=null,So=null,$d=!1;function Vv(i,a,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;$d||qs==null||qs!==si(m)||(m=qs,"selectionStart"in m&&Hd(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),So&&_o(So,m)||(So=m,m=wc(Fd,"onSelect"),0<m.length&&(a=new ju("onSelect","select",null,a,c),i.push({event:a,listeners:m}),a.target=qs)))}function Ki(i,a){var c={};return c[i.toLowerCase()]=a.toLowerCase(),c["Webkit"+i]="webkit"+a,c["Moz"+i]="moz"+a,c}var Gs={animationend:Ki("Animation","AnimationEnd"),animationiteration:Ki("Animation","AnimationIteration"),animationstart:Ki("Animation","AnimationStart"),transitionrun:Ki("Transition","TransitionRun"),transitionstart:Ki("Transition","TransitionStart"),transitioncancel:Ki("Transition","TransitionCancel"),transitionend:Ki("Transition","TransitionEnd")},qd={},Bv={};Mr&&(Bv=document.createElement("div").style,"AnimationEvent"in window||(delete Gs.animationend.animation,delete Gs.animationiteration.animation,delete Gs.animationstart.animation),"TransitionEvent"in window||delete Gs.transitionend.transition);function Wi(i){if(qd[i])return qd[i];if(!Gs[i])return i;var a=Gs[i],c;for(c in a)if(a.hasOwnProperty(c)&&c in Bv)return qd[i]=a[c];return i}var Uv=Wi("animationend"),Hv=Wi("animationiteration"),Fv=Wi("animationstart"),JM=Wi("transitionrun"),eO=Wi("transitionstart"),tO=Wi("transitioncancel"),$v=Wi("transitionend"),qv=new Map,Gd="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Gd.push("scrollEnd");function Yn(i,a){qv.set(i,a),Nr(a,[i])}var Gv=new WeakMap;function Rn(i,a){if(typeof i=="object"&&i!==null){var c=Gv.get(i);return c!==void 0?c:(a={value:i,source:a,stack:Cu(a)},Gv.set(i,a),a)}return{value:i,source:a,stack:Cu(a)}}var Dn=[],Ys=0,Yd=0;function Pu(){for(var i=Ys,a=Yd=Ys=0;a<i;){var c=Dn[a];Dn[a++]=null;var m=Dn[a];Dn[a++]=null;var y=Dn[a];Dn[a++]=null;var x=Dn[a];if(Dn[a++]=null,m!==null&&y!==null){var N=m.pending;N===null?y.next=y:(y.next=N.next,N.next=y),m.pending=y}x!==0&&Yv(c,y,x)}}function Iu(i,a,c,m){Dn[Ys++]=i,Dn[Ys++]=a,Dn[Ys++]=c,Dn[Ys++]=m,Yd|=m,i.lanes|=m,i=i.alternate,i!==null&&(i.lanes|=m)}function Zd(i,a,c,m){return Iu(i,a,c,m),Vu(i)}function Zs(i,a){return Iu(i,null,null,a),Vu(i)}function Yv(i,a,c){i.lanes|=c;var m=i.alternate;m!==null&&(m.lanes|=c);for(var y=!1,x=i.return;x!==null;)x.childLanes|=c,m=x.alternate,m!==null&&(m.childLanes|=c),x.tag===22&&(i=x.stateNode,i===null||i._visibility&1||(y=!0)),i=x,x=x.return;return i.tag===3?(x=i.stateNode,y&&a!==null&&(y=31-Te(c),i=x.hiddenUpdates,m=i[y],m===null?i[y]=[a]:m.push(a),a.lane=c|536870912),x):null}function Vu(i){if(50<Zo)throw Zo=0,em=null,Error(r(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var Xs={};function nO(i,a,c,m){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xn(i,a,c,m){return new nO(i,a,c,m)}function Xd(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Or(i,a){var c=i.alternate;return c===null?(c=xn(i.tag,a,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=a,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,a=i.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function Zv(i,a){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=a,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,a=c.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),i}function Bu(i,a,c,m,y,x){var N=0;if(m=i,typeof i=="function")Xd(i)&&(N=1);else if(typeof i=="string")N=iR(i,c,F.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case U:return i=xn(31,c,a,y),i.elementType=U,i.lanes=x,i;case b:return Ji(c.children,y,x,a);case w:N=8,y|=24;break;case _:return i=xn(12,c,a,y|2),i.elementType=_,i.lanes=x,i;case D:return i=xn(13,c,a,y),i.elementType=D,i.lanes=x,i;case R:return i=xn(19,c,a,y),i.elementType=R,i.lanes=x,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case E:case S:N=10;break e;case T:N=9;break e;case M:N=11;break e;case B:N=14;break e;case z:N=16,m=null;break e}N=29,c=Error(r(130,i===null?"null":typeof i,"")),m=null}return a=xn(N,c,a,y),a.elementType=i,a.type=m,a.lanes=x,a}function Ji(i,a,c,m){return i=xn(7,i,m,a),i.lanes=c,i}function Qd(i,a,c){return i=xn(6,i,null,a),i.lanes=c,i}function Kd(i,a,c){return a=xn(4,i.children!==null?i.children:[],i.key,a),a.lanes=c,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var Qs=[],Ks=0,Uu=null,Hu=0,jn=[],zn=0,es=null,Rr=1,Dr="";function ts(i,a){Qs[Ks++]=Hu,Qs[Ks++]=Uu,Uu=i,Hu=a}function Xv(i,a,c){jn[zn++]=Rr,jn[zn++]=Dr,jn[zn++]=es,es=i;var m=Rr;i=Dr;var y=32-Te(m)-1;m&=~(1<<y),c+=1;var x=32-Te(a)+y;if(30<x){var N=y-y%5;x=(m&(1<<N)-1).toString(32),m>>=N,y-=N,Rr=1<<32-Te(a)+y|c<<y|m,Dr=x+i}else Rr=1<<x|c<<y|m,Dr=i}function Wd(i){i.return!==null&&(ts(i,1),Xv(i,1,0))}function Jd(i){for(;i===Uu;)Uu=Qs[--Ks],Qs[Ks]=null,Hu=Qs[--Ks],Qs[Ks]=null;for(;i===es;)es=jn[--zn],jn[zn]=null,Dr=jn[--zn],jn[zn]=null,Rr=jn[--zn],jn[zn]=null}var tn=null,yt=null,Ke=!1,ns=null,fr=!1,eh=Error(r(519));function rs(i){var a=Error(r(418,""));throw To(Rn(a,i)),eh}function Qv(i){var a=i.stateNode,c=i.type,m=i.memoizedProps;switch(a[zt]=i,a[Gt]=m,c){case"dialog":He("cancel",a),He("close",a);break;case"iframe":case"object":case"embed":He("load",a);break;case"video":case"audio":for(c=0;c<Qo.length;c++)He(Qo[c],a);break;case"source":He("error",a);break;case"img":case"image":case"link":He("error",a),He("load",a);break;case"details":He("toggle",a);break;case"input":He("invalid",a),fv(a,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0),Is(a);break;case"select":He("invalid",a);break;case"textarea":He("invalid",a),hv(a,m.value,m.defaultValue,m.children),Is(a)}c=m.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||m.suppressHydrationWarning===!0||h1(a.textContent,c)?(m.popover!=null&&(He("beforetoggle",a),He("toggle",a)),m.onScroll!=null&&He("scroll",a),m.onScrollEnd!=null&&He("scrollend",a),m.onClick!=null&&(a.onclick=_c),a=!0):a=!1,a||rs(i)}function Kv(i){for(tn=i.return;tn;)switch(tn.tag){case 5:case 13:fr=!1;return;case 27:case 3:fr=!0;return;default:tn=tn.return}}function Eo(i){if(i!==tn)return!1;if(!Ke)return Kv(i),Ke=!0,!1;var a=i.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||gm(i.type,i.memoizedProps)),c=!c),c&&yt&&rs(i),Kv(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));e:{for(i=i.nextSibling,a=0;i;){if(i.nodeType===8)if(c=i.data,c==="/$"){if(a===0){yt=Xn(i.nextSibling);break e}a--}else c!=="$"&&c!=="$!"&&c!=="$?"||a++;i=i.nextSibling}yt=null}}else a===27?(a=yt,_i(i.type)?(i=bm,bm=null,yt=i):yt=a):yt=tn?Xn(i.stateNode.nextSibling):null;return!0}function ko(){yt=tn=null,Ke=!1}function Wv(){var i=ns;return i!==null&&(dn===null?dn=i:dn.push.apply(dn,i),ns=null),i}function To(i){ns===null?ns=[i]:ns.push(i)}var th=G(null),is=null,jr=null;function oi(i,a,c){C(th,a._currentValue),a._currentValue=c}function zr(i){i._currentValue=th.current,te(th)}function nh(i,a,c){for(;i!==null;){var m=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,m!==null&&(m.childLanes|=a)):m!==null&&(m.childLanes&a)!==a&&(m.childLanes|=a),i===c)break;i=i.return}}function rh(i,a,c,m){var y=i.child;for(y!==null&&(y.return=i);y!==null;){var x=y.dependencies;if(x!==null){var N=y.child;x=x.firstContext;e:for(;x!==null;){var L=x;x=y;for(var q=0;q<a.length;q++)if(L.context===a[q]){x.lanes|=c,L=x.alternate,L!==null&&(L.lanes|=c),nh(x.return,c,i),m||(N=null);break e}x=L.next}}else if(y.tag===18){if(N=y.return,N===null)throw Error(r(341));N.lanes|=c,x=N.alternate,x!==null&&(x.lanes|=c),nh(N,c,i),N=null}else N=y.child;if(N!==null)N.return=y;else for(N=y;N!==null;){if(N===i){N=null;break}if(y=N.sibling,y!==null){y.return=N.return,N=y;break}N=N.return}y=N}}function Co(i,a,c,m){i=null;for(var y=a,x=!1;y!==null;){if(!x){if((y.flags&524288)!==0)x=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var N=y.alternate;if(N===null)throw Error(r(387));if(N=N.memoizedProps,N!==null){var L=y.type;vn(y.pendingProps.value,N.value)||(i!==null?i.push(L):i=[L])}}else if(y===oe.current){if(N=y.alternate,N===null)throw Error(r(387));N.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(i!==null?i.push(nl):i=[nl])}y=y.return}i!==null&&rh(a,i,c,m),a.flags|=262144}function Fu(i){for(i=i.firstContext;i!==null;){if(!vn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function ss(i){is=i,jr=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Yt(i){return Jv(is,i)}function $u(i,a){return is===null&&ss(i),Jv(i,a)}function Jv(i,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},jr===null){if(i===null)throw Error(r(308));jr=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else jr=jr.next=a;return c}var rO=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(c,m){i.push(m)}};this.abort=function(){a.aborted=!0,i.forEach(function(c){return c()})}},iO=e.unstable_scheduleCallback,sO=e.unstable_NormalPriority,Dt={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ih(){return{controller:new rO,data:new Map,refCount:0}}function Ao(i){i.refCount--,i.refCount===0&&iO(sO,function(){i.controller.abort()})}var No=null,sh=0,Ws=0,Js=null;function aO(i,a){if(No===null){var c=No=[];sh=0,Ws=om(),Js={status:"pending",value:void 0,then:function(m){c.push(m)}}}return sh++,a.then(ex,ex),a}function ex(){if(--sh===0&&No!==null){Js!==null&&(Js.status="fulfilled");var i=No;No=null,Ws=0,Js=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function oO(i,a){var c=[],m={status:"pending",value:null,reason:null,then:function(y){c.push(y)}};return i.then(function(){m.status="fulfilled",m.value=a;for(var y=0;y<c.length;y++)(0,c[y])(a)},function(y){for(m.status="rejected",m.reason=y,y=0;y<c.length;y++)(0,c[y])(void 0)}),m}var tx=I.S;I.S=function(i,a){typeof a=="object"&&a!==null&&typeof a.then=="function"&&aO(i,a),tx!==null&&tx(i,a)};var as=G(null);function ah(){var i=as.current;return i!==null?i:lt.pooledCache}function qu(i,a){a===null?C(as,as.current):C(as,a.pool)}function nx(){var i=ah();return i===null?null:{parent:Dt._currentValue,pool:i}}var Mo=Error(r(460)),rx=Error(r(474)),Gu=Error(r(542)),oh={then:function(){}};function ix(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Yu(){}function sx(i,a,c){switch(c=i[c],c===void 0?i.push(a):c!==a&&(a.then(Yu,Yu),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,ox(i),i;default:if(typeof a.status=="string")a.then(Yu,Yu);else{if(i=lt,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=a,i.status="pending",i.then(function(m){if(a.status==="pending"){var y=a;y.status="fulfilled",y.value=m}},function(m){if(a.status==="pending"){var y=a;y.status="rejected",y.reason=m}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,ox(i),i}throw Oo=a,Mo}}var Oo=null;function ax(){if(Oo===null)throw Error(r(459));var i=Oo;return Oo=null,i}function ox(i){if(i===Mo||i===Gu)throw Error(r(483))}var li=!1;function lh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function uh(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function ui(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function ci(i,a,c){var m=i.updateQueue;if(m===null)return null;if(m=m.shared,(Je&2)!==0){var y=m.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),m.pending=a,a=Vu(i),Yv(i,null,c),a}return Iu(i,m,a,c),Vu(i)}function Ro(i,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var m=a.lanes;m&=i.pendingLanes,c|=m,a.lanes=c,xu(i,c)}}function ch(i,a){var c=i.updateQueue,m=i.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var y=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var N={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?y=x=N:x=x.next=N,c=c.next}while(c!==null);x===null?y=x=a:x=x.next=a}else y=x=a;c={baseState:m.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:m.shared,callbacks:m.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=a:i.next=a,c.lastBaseUpdate=a}var fh=!1;function Do(){if(fh){var i=Js;if(i!==null)throw i}}function jo(i,a,c,m){fh=!1;var y=i.updateQueue;li=!1;var x=y.firstBaseUpdate,N=y.lastBaseUpdate,L=y.shared.pending;if(L!==null){y.shared.pending=null;var q=L,re=q.next;q.next=null,N===null?x=re:N.next=re,N=q;var le=i.alternate;le!==null&&(le=le.updateQueue,L=le.lastBaseUpdate,L!==N&&(L===null?le.firstBaseUpdate=re:L.next=re,le.lastBaseUpdate=q))}if(x!==null){var fe=y.baseState;N=0,le=re=q=null,L=x;do{var ie=L.lane&-536870913,se=ie!==L.lane;if(se?($e&ie)===ie:(m&ie)===ie){ie!==0&&ie===Ws&&(fh=!0),le!==null&&(le=le.next={lane:0,tag:L.tag,payload:L.payload,callback:null,next:null});e:{var Oe=i,Ne=L;ie=a;var it=c;switch(Ne.tag){case 1:if(Oe=Ne.payload,typeof Oe=="function"){fe=Oe.call(it,fe,ie);break e}fe=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=Ne.payload,ie=typeof Oe=="function"?Oe.call(it,fe,ie):Oe,ie==null)break e;fe=h({},fe,ie);break e;case 2:li=!0}}ie=L.callback,ie!==null&&(i.flags|=64,se&&(i.flags|=8192),se=y.callbacks,se===null?y.callbacks=[ie]:se.push(ie))}else se={lane:ie,tag:L.tag,payload:L.payload,callback:L.callback,next:null},le===null?(re=le=se,q=fe):le=le.next=se,N|=ie;if(L=L.next,L===null){if(L=y.shared.pending,L===null)break;se=L,L=se.next,se.next=null,y.lastBaseUpdate=se,y.shared.pending=null}}while(!0);le===null&&(q=fe),y.baseState=q,y.firstBaseUpdate=re,y.lastBaseUpdate=le,x===null&&(y.shared.lanes=0),vi|=N,i.lanes=N,i.memoizedState=fe}}function lx(i,a){if(typeof i!="function")throw Error(r(191,i));i.call(a)}function ux(i,a){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)lx(c[i],a)}var ea=G(null),Zu=G(0);function cx(i,a){i=Hr,C(Zu,i),C(ea,a),Hr=i|a.baseLanes}function dh(){C(Zu,Hr),C(ea,ea.current)}function hh(){Hr=Zu.current,te(ea),te(Zu)}var fi=0,Ie=null,nt=null,Ct=null,Xu=!1,ta=!1,os=!1,Qu=0,zo=0,na=null,lO=0;function wt(){throw Error(r(321))}function mh(i,a){if(a===null)return!1;for(var c=0;c<a.length&&c<i.length;c++)if(!vn(i[c],a[c]))return!1;return!0}function ph(i,a,c,m,y,x){return fi=x,Ie=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,I.H=i===null||i.memoizedState===null?Yx:Zx,os=!1,x=c(m,y),os=!1,ta&&(x=dx(a,c,m,y)),fx(i),x}function fx(i){I.H=nc;var a=nt!==null&&nt.next!==null;if(fi=0,Ct=nt=Ie=null,Xu=!1,zo=0,na=null,a)throw Error(r(300));i===null||Lt||(i=i.dependencies,i!==null&&Fu(i)&&(Lt=!0))}function dx(i,a,c,m){Ie=i;var y=0;do{if(ta&&(na=null),zo=0,ta=!1,25<=y)throw Error(r(301));if(y+=1,Ct=nt=null,i.updateQueue!=null){var x=i.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}I.H=pO,x=a(c,m)}while(ta);return x}function uO(){var i=I.H,a=i.useState()[0];return a=typeof a.then=="function"?Lo(a):a,i=i.useState()[0],(nt!==null?nt.memoizedState:null)!==i&&(Ie.flags|=1024),a}function gh(){var i=Qu!==0;return Qu=0,i}function yh(i,a,c){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~c}function vh(i){if(Xu){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Xu=!1}fi=0,Ct=nt=Ie=null,ta=!1,zo=Qu=0,na=null}function cn(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?Ie.memoizedState=Ct=i:Ct=Ct.next=i,Ct}function At(){if(nt===null){var i=Ie.alternate;i=i!==null?i.memoizedState:null}else i=nt.next;var a=Ct===null?Ie.memoizedState:Ct.next;if(a!==null)Ct=a,nt=i;else{if(i===null)throw Ie.alternate===null?Error(r(467)):Error(r(310));nt=i,i={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},Ct===null?Ie.memoizedState=Ct=i:Ct=Ct.next=i}return Ct}function xh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Lo(i){var a=zo;return zo+=1,na===null&&(na=[]),i=sx(na,i,a),a=Ie,(Ct===null?a.memoizedState:Ct.next)===null&&(a=a.alternate,I.H=a===null||a.memoizedState===null?Yx:Zx),i}function Ku(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Lo(i);if(i.$$typeof===S)return Yt(i)}throw Error(r(438,String(i)))}function bh(i){var a=null,c=Ie.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var m=Ie.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(a={data:m.data.map(function(y){return y.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=xh(),Ie.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(i),m=0;m<i;m++)c[m]=O;return a.index++,c}function Lr(i,a){return typeof a=="function"?a(i):a}function Wu(i){var a=At();return wh(a,nt,i)}function wh(i,a,c){var m=i.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=c;var y=i.baseQueue,x=m.pending;if(x!==null){if(y!==null){var N=y.next;y.next=x.next,x.next=N}a.baseQueue=y=x,m.pending=null}if(x=i.baseState,y===null)i.memoizedState=x;else{a=y.next;var L=N=null,q=null,re=a,le=!1;do{var fe=re.lane&-536870913;if(fe!==re.lane?($e&fe)===fe:(fi&fe)===fe){var ie=re.revertLane;if(ie===0)q!==null&&(q=q.next={lane:0,revertLane:0,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),fe===Ws&&(le=!0);else if((fi&ie)===ie){re=re.next,ie===Ws&&(le=!0);continue}else fe={lane:0,revertLane:re.revertLane,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(L=q=fe,N=x):q=q.next=fe,Ie.lanes|=ie,vi|=ie;fe=re.action,os&&c(x,fe),x=re.hasEagerState?re.eagerState:c(x,fe)}else ie={lane:fe,revertLane:re.revertLane,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(L=q=ie,N=x):q=q.next=ie,Ie.lanes|=fe,vi|=fe;re=re.next}while(re!==null&&re!==a);if(q===null?N=x:q.next=L,!vn(x,i.memoizedState)&&(Lt=!0,le&&(c=Js,c!==null)))throw c;i.memoizedState=x,i.baseState=N,i.baseQueue=q,m.lastRenderedState=x}return y===null&&(m.lanes=0),[i.memoizedState,m.dispatch]}function _h(i){var a=At(),c=a.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=i;var m=c.dispatch,y=c.pending,x=a.memoizedState;if(y!==null){c.pending=null;var N=y=y.next;do x=i(x,N.action),N=N.next;while(N!==y);vn(x,a.memoizedState)||(Lt=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),c.lastRenderedState=x}return[x,m]}function hx(i,a,c){var m=Ie,y=At(),x=Ke;if(x){if(c===void 0)throw Error(r(407));c=c()}else c=a();var N=!vn((nt||y).memoizedState,c);N&&(y.memoizedState=c,Lt=!0),y=y.queue;var L=gx.bind(null,m,y,i);if(Po(2048,8,L,[i]),y.getSnapshot!==a||N||Ct!==null&&Ct.memoizedState.tag&1){if(m.flags|=2048,ra(9,Ju(),px.bind(null,m,y,c,a),null),lt===null)throw Error(r(349));x||(fi&124)!==0||mx(m,a,c)}return c}function mx(i,a,c){i.flags|=16384,i={getSnapshot:a,value:c},a=Ie.updateQueue,a===null?(a=xh(),Ie.updateQueue=a,a.stores=[i]):(c=a.stores,c===null?a.stores=[i]:c.push(i))}function px(i,a,c,m){a.value=c,a.getSnapshot=m,yx(a)&&vx(i)}function gx(i,a,c){return c(function(){yx(a)&&vx(i)})}function yx(i){var a=i.getSnapshot;i=i.value;try{var c=a();return!vn(i,c)}catch{return!0}}function vx(i){var a=Zs(i,2);a!==null&&En(a,i,2)}function Sh(i){var a=cn();if(typeof i=="function"){var c=i;if(i=c(),os){Ee(!0);try{c()}finally{Ee(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:i},a}function xx(i,a,c,m){return i.baseState=c,wh(i,nt,typeof m=="function"?m:Lr)}function cO(i,a,c,m,y){if(tc(i))throw Error(r(485));if(i=a.action,i!==null){var x={payload:y,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(N){x.listeners.push(N)}};I.T!==null?c(!0):x.isTransition=!1,m(x),c=a.pending,c===null?(x.next=a.pending=x,bx(a,x)):(x.next=c.next,a.pending=c.next=x)}}function bx(i,a){var c=a.action,m=a.payload,y=i.state;if(a.isTransition){var x=I.T,N={};I.T=N;try{var L=c(y,m),q=I.S;q!==null&&q(N,L),wx(i,a,L)}catch(re){Eh(i,a,re)}finally{I.T=x}}else try{x=c(y,m),wx(i,a,x)}catch(re){Eh(i,a,re)}}function wx(i,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(m){_x(i,a,m)},function(m){return Eh(i,a,m)}):_x(i,a,c)}function _x(i,a,c){a.status="fulfilled",a.value=c,Sx(a),i.state=c,a=i.pending,a!==null&&(c=a.next,c===a?i.pending=null:(c=c.next,a.next=c,bx(i,c)))}function Eh(i,a,c){var m=i.pending;if(i.pending=null,m!==null){m=m.next;do a.status="rejected",a.reason=c,Sx(a),a=a.next;while(a!==m)}i.action=null}function Sx(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function Ex(i,a){return a}function kx(i,a){if(Ke){var c=lt.formState;if(c!==null){e:{var m=Ie;if(Ke){if(yt){t:{for(var y=yt,x=fr;y.nodeType!==8;){if(!x){y=null;break t}if(y=Xn(y.nextSibling),y===null){y=null;break t}}x=y.data,y=x==="F!"||x==="F"?y:null}if(y){yt=Xn(y.nextSibling),m=y.data==="F!";break e}}rs(m)}m=!1}m&&(a=c[0])}}return c=cn(),c.memoizedState=c.baseState=a,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ex,lastRenderedState:a},c.queue=m,c=$x.bind(null,Ie,m),m.dispatch=c,m=Sh(!1),x=Nh.bind(null,Ie,!1,m.queue),m=cn(),y={state:a,dispatch:null,action:i,pending:null},m.queue=y,c=cO.bind(null,Ie,y,x,c),y.dispatch=c,m.memoizedState=i,[a,c,!1]}function Tx(i){var a=At();return Cx(a,nt,i)}function Cx(i,a,c){if(a=wh(i,a,Ex)[0],i=Wu(Lr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var m=Lo(a)}catch(N){throw N===Mo?Gu:N}else m=a;a=At();var y=a.queue,x=y.dispatch;return c!==a.memoizedState&&(Ie.flags|=2048,ra(9,Ju(),fO.bind(null,y,c),null)),[m,x,i]}function fO(i,a){i.action=a}function Ax(i){var a=At(),c=nt;if(c!==null)return Cx(a,c,i);At(),a=a.memoizedState,c=At();var m=c.queue.dispatch;return c.memoizedState=i,[a,m,!1]}function ra(i,a,c,m){return i={tag:i,create:c,deps:m,inst:a,next:null},a=Ie.updateQueue,a===null&&(a=xh(),Ie.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=i.next=i:(m=c.next,c.next=i,i.next=m,a.lastEffect=i),i}function Ju(){return{destroy:void 0,resource:void 0}}function Nx(){return At().memoizedState}function ec(i,a,c,m){var y=cn();m=m===void 0?null:m,Ie.flags|=i,y.memoizedState=ra(1|a,Ju(),c,m)}function Po(i,a,c,m){var y=At();m=m===void 0?null:m;var x=y.memoizedState.inst;nt!==null&&m!==null&&mh(m,nt.memoizedState.deps)?y.memoizedState=ra(a,x,c,m):(Ie.flags|=i,y.memoizedState=ra(1|a,x,c,m))}function Mx(i,a){ec(8390656,8,i,a)}function Ox(i,a){Po(2048,8,i,a)}function Rx(i,a){return Po(4,2,i,a)}function Dx(i,a){return Po(4,4,i,a)}function jx(i,a){if(typeof a=="function"){i=i();var c=a(i);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function zx(i,a,c){c=c!=null?c.concat([i]):null,Po(4,4,jx.bind(null,a,i),c)}function kh(){}function Lx(i,a){var c=At();a=a===void 0?null:a;var m=c.memoizedState;return a!==null&&mh(a,m[1])?m[0]:(c.memoizedState=[i,a],i)}function Px(i,a){var c=At();a=a===void 0?null:a;var m=c.memoizedState;if(a!==null&&mh(a,m[1]))return m[0];if(m=i(),os){Ee(!0);try{i()}finally{Ee(!1)}}return c.memoizedState=[m,a],m}function Th(i,a,c){return c===void 0||(fi&1073741824)!==0?i.memoizedState=a:(i.memoizedState=c,i=Bb(),Ie.lanes|=i,vi|=i,c)}function Ix(i,a,c,m){return vn(c,a)?c:ea.current!==null?(i=Th(i,c,m),vn(i,a)||(Lt=!0),i):(fi&42)===0?(Lt=!0,i.memoizedState=c):(i=Bb(),Ie.lanes|=i,vi|=i,a)}function Vx(i,a,c,m,y){var x=P.p;P.p=x!==0&&8>x?x:8;var N=I.T,L={};I.T=L,Nh(i,!1,a,c);try{var q=y(),re=I.S;if(re!==null&&re(L,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var le=oO(q,m);Io(i,a,le,Sn(i))}else Io(i,a,m,Sn(i))}catch(fe){Io(i,a,{then:function(){},status:"rejected",reason:fe},Sn())}finally{P.p=x,I.T=N}}function dO(){}function Ch(i,a,c,m){if(i.tag!==5)throw Error(r(476));var y=Bx(i).queue;Vx(i,y,a,Y,c===null?dO:function(){return Ux(i),c(m)})}function Bx(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:Y},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lr,lastRenderedState:c},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function Ux(i){var a=Bx(i).next.queue;Io(i,a,{},Sn())}function Ah(){return Yt(nl)}function Hx(){return At().memoizedState}function Fx(){return At().memoizedState}function hO(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var c=Sn();i=ui(c);var m=ci(a,i,c);m!==null&&(En(m,a,c),Ro(m,a,c)),a={cache:ih()},i.payload=a;return}a=a.return}}function mO(i,a,c){var m=Sn();c={lane:m,revertLane:0,action:c,hasEagerState:!1,eagerState:null,next:null},tc(i)?qx(a,c):(c=Zd(i,a,c,m),c!==null&&(En(c,i,m),Gx(c,a,m)))}function $x(i,a,c){var m=Sn();Io(i,a,c,m)}function Io(i,a,c,m){var y={lane:m,revertLane:0,action:c,hasEagerState:!1,eagerState:null,next:null};if(tc(i))qx(a,y);else{var x=i.alternate;if(i.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var N=a.lastRenderedState,L=x(N,c);if(y.hasEagerState=!0,y.eagerState=L,vn(L,N))return Iu(i,a,y,0),lt===null&&Pu(),!1}catch{}finally{}if(c=Zd(i,a,y,m),c!==null)return En(c,i,m),Gx(c,a,m),!0}return!1}function Nh(i,a,c,m){if(m={lane:2,revertLane:om(),action:m,hasEagerState:!1,eagerState:null,next:null},tc(i)){if(a)throw Error(r(479))}else a=Zd(i,c,m,2),a!==null&&En(a,i,2)}function tc(i){var a=i.alternate;return i===Ie||a!==null&&a===Ie}function qx(i,a){ta=Xu=!0;var c=i.pending;c===null?a.next=a:(a.next=c.next,c.next=a),i.pending=a}function Gx(i,a,c){if((c&4194048)!==0){var m=a.lanes;m&=i.pendingLanes,c|=m,a.lanes=c,xu(i,c)}}var nc={readContext:Yt,use:Ku,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt},Yx={readContext:Yt,use:Ku,useCallback:function(i,a){return cn().memoizedState=[i,a===void 0?null:a],i},useContext:Yt,useEffect:Mx,useImperativeHandle:function(i,a,c){c=c!=null?c.concat([i]):null,ec(4194308,4,jx.bind(null,a,i),c)},useLayoutEffect:function(i,a){return ec(4194308,4,i,a)},useInsertionEffect:function(i,a){ec(4,2,i,a)},useMemo:function(i,a){var c=cn();a=a===void 0?null:a;var m=i();if(os){Ee(!0);try{i()}finally{Ee(!1)}}return c.memoizedState=[m,a],m},useReducer:function(i,a,c){var m=cn();if(c!==void 0){var y=c(a);if(os){Ee(!0);try{c(a)}finally{Ee(!1)}}}else y=a;return m.memoizedState=m.baseState=y,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:y},m.queue=i,i=i.dispatch=mO.bind(null,Ie,i),[m.memoizedState,i]},useRef:function(i){var a=cn();return i={current:i},a.memoizedState=i},useState:function(i){i=Sh(i);var a=i.queue,c=$x.bind(null,Ie,a);return a.dispatch=c,[i.memoizedState,c]},useDebugValue:kh,useDeferredValue:function(i,a){var c=cn();return Th(c,i,a)},useTransition:function(){var i=Sh(!1);return i=Vx.bind(null,Ie,i.queue,!0,!1),cn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,c){var m=Ie,y=cn();if(Ke){if(c===void 0)throw Error(r(407));c=c()}else{if(c=a(),lt===null)throw Error(r(349));($e&124)!==0||mx(m,a,c)}y.memoizedState=c;var x={value:c,getSnapshot:a};return y.queue=x,Mx(gx.bind(null,m,x,i),[i]),m.flags|=2048,ra(9,Ju(),px.bind(null,m,x,c,a),null),c},useId:function(){var i=cn(),a=lt.identifierPrefix;if(Ke){var c=Dr,m=Rr;c=(m&~(1<<32-Te(m)-1)).toString(32)+c,a="«"+a+"R"+c,c=Qu++,0<c&&(a+="H"+c.toString(32)),a+="»"}else c=lO++,a="«"+a+"r"+c.toString(32)+"»";return i.memoizedState=a},useHostTransitionStatus:Ah,useFormState:kx,useActionState:kx,useOptimistic:function(i){var a=cn();a.memoizedState=a.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Nh.bind(null,Ie,!0,c),c.dispatch=a,[i,a]},useMemoCache:bh,useCacheRefresh:function(){return cn().memoizedState=hO.bind(null,Ie)}},Zx={readContext:Yt,use:Ku,useCallback:Lx,useContext:Yt,useEffect:Ox,useImperativeHandle:zx,useInsertionEffect:Rx,useLayoutEffect:Dx,useMemo:Px,useReducer:Wu,useRef:Nx,useState:function(){return Wu(Lr)},useDebugValue:kh,useDeferredValue:function(i,a){var c=At();return Ix(c,nt.memoizedState,i,a)},useTransition:function(){var i=Wu(Lr)[0],a=At().memoizedState;return[typeof i=="boolean"?i:Lo(i),a]},useSyncExternalStore:hx,useId:Hx,useHostTransitionStatus:Ah,useFormState:Tx,useActionState:Tx,useOptimistic:function(i,a){var c=At();return xx(c,nt,i,a)},useMemoCache:bh,useCacheRefresh:Fx},pO={readContext:Yt,use:Ku,useCallback:Lx,useContext:Yt,useEffect:Ox,useImperativeHandle:zx,useInsertionEffect:Rx,useLayoutEffect:Dx,useMemo:Px,useReducer:_h,useRef:Nx,useState:function(){return _h(Lr)},useDebugValue:kh,useDeferredValue:function(i,a){var c=At();return nt===null?Th(c,i,a):Ix(c,nt.memoizedState,i,a)},useTransition:function(){var i=_h(Lr)[0],a=At().memoizedState;return[typeof i=="boolean"?i:Lo(i),a]},useSyncExternalStore:hx,useId:Hx,useHostTransitionStatus:Ah,useFormState:Ax,useActionState:Ax,useOptimistic:function(i,a){var c=At();return nt!==null?xx(c,nt,i,a):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:bh,useCacheRefresh:Fx},ia=null,Vo=0;function rc(i){var a=Vo;return Vo+=1,ia===null&&(ia=[]),sx(ia,i,a)}function Bo(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function ic(i,a){throw a.$$typeof===p?Error(r(525)):(i=Object.prototype.toString.call(a),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function Xx(i){var a=i._init;return a(i._payload)}function Qx(i){function a(ee,K){if(i){var ne=ee.deletions;ne===null?(ee.deletions=[K],ee.flags|=16):ne.push(K)}}function c(ee,K){if(!i)return null;for(;K!==null;)a(ee,K),K=K.sibling;return null}function m(ee){for(var K=new Map;ee!==null;)ee.key!==null?K.set(ee.key,ee):K.set(ee.index,ee),ee=ee.sibling;return K}function y(ee,K){return ee=Or(ee,K),ee.index=0,ee.sibling=null,ee}function x(ee,K,ne){return ee.index=ne,i?(ne=ee.alternate,ne!==null?(ne=ne.index,ne<K?(ee.flags|=67108866,K):ne):(ee.flags|=67108866,K)):(ee.flags|=1048576,K)}function N(ee){return i&&ee.alternate===null&&(ee.flags|=67108866),ee}function L(ee,K,ne,ue){return K===null||K.tag!==6?(K=Qd(ne,ee.mode,ue),K.return=ee,K):(K=y(K,ne),K.return=ee,K)}function q(ee,K,ne,ue){var xe=ne.type;return xe===b?le(ee,K,ne.props.children,ue,ne.key):K!==null&&(K.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===z&&Xx(xe)===K.type)?(K=y(K,ne.props),Bo(K,ne),K.return=ee,K):(K=Bu(ne.type,ne.key,ne.props,null,ee.mode,ue),Bo(K,ne),K.return=ee,K)}function re(ee,K,ne,ue){return K===null||K.tag!==4||K.stateNode.containerInfo!==ne.containerInfo||K.stateNode.implementation!==ne.implementation?(K=Kd(ne,ee.mode,ue),K.return=ee,K):(K=y(K,ne.children||[]),K.return=ee,K)}function le(ee,K,ne,ue,xe){return K===null||K.tag!==7?(K=Ji(ne,ee.mode,ue,xe),K.return=ee,K):(K=y(K,ne),K.return=ee,K)}function fe(ee,K,ne){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=Qd(""+K,ee.mode,ne),K.return=ee,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case g:return ne=Bu(K.type,K.key,K.props,null,ee.mode,ne),Bo(ne,K),ne.return=ee,ne;case v:return K=Kd(K,ee.mode,ne),K.return=ee,K;case z:var ue=K._init;return K=ue(K._payload),fe(ee,K,ne)}if($(K)||H(K))return K=Ji(K,ee.mode,ne,null),K.return=ee,K;if(typeof K.then=="function")return fe(ee,rc(K),ne);if(K.$$typeof===S)return fe(ee,$u(ee,K),ne);ic(ee,K)}return null}function ie(ee,K,ne,ue){var xe=K!==null?K.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return xe!==null?null:L(ee,K,""+ne,ue);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case g:return ne.key===xe?q(ee,K,ne,ue):null;case v:return ne.key===xe?re(ee,K,ne,ue):null;case z:return xe=ne._init,ne=xe(ne._payload),ie(ee,K,ne,ue)}if($(ne)||H(ne))return xe!==null?null:le(ee,K,ne,ue,null);if(typeof ne.then=="function")return ie(ee,K,rc(ne),ue);if(ne.$$typeof===S)return ie(ee,K,$u(ee,ne),ue);ic(ee,ne)}return null}function se(ee,K,ne,ue,xe){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return ee=ee.get(ne)||null,L(K,ee,""+ue,xe);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case g:return ee=ee.get(ue.key===null?ne:ue.key)||null,q(K,ee,ue,xe);case v:return ee=ee.get(ue.key===null?ne:ue.key)||null,re(K,ee,ue,xe);case z:var Ve=ue._init;return ue=Ve(ue._payload),se(ee,K,ne,ue,xe)}if($(ue)||H(ue))return ee=ee.get(ne)||null,le(K,ee,ue,xe,null);if(typeof ue.then=="function")return se(ee,K,ne,rc(ue),xe);if(ue.$$typeof===S)return se(ee,K,ne,$u(K,ue),xe);ic(K,ue)}return null}function Oe(ee,K,ne,ue){for(var xe=null,Ve=null,Se=K,Me=K=0,It=null;Se!==null&&Me<ne.length;Me++){Se.index>Me?(It=Se,Se=null):It=Se.sibling;var Ze=ie(ee,Se,ne[Me],ue);if(Ze===null){Se===null&&(Se=It);break}i&&Se&&Ze.alternate===null&&a(ee,Se),K=x(Ze,K,Me),Ve===null?xe=Ze:Ve.sibling=Ze,Ve=Ze,Se=It}if(Me===ne.length)return c(ee,Se),Ke&&ts(ee,Me),xe;if(Se===null){for(;Me<ne.length;Me++)Se=fe(ee,ne[Me],ue),Se!==null&&(K=x(Se,K,Me),Ve===null?xe=Se:Ve.sibling=Se,Ve=Se);return Ke&&ts(ee,Me),xe}for(Se=m(Se);Me<ne.length;Me++)It=se(Se,ee,Me,ne[Me],ue),It!==null&&(i&&It.alternate!==null&&Se.delete(It.key===null?Me:It.key),K=x(It,K,Me),Ve===null?xe=It:Ve.sibling=It,Ve=It);return i&&Se.forEach(function(Ci){return a(ee,Ci)}),Ke&&ts(ee,Me),xe}function Ne(ee,K,ne,ue){if(ne==null)throw Error(r(151));for(var xe=null,Ve=null,Se=K,Me=K=0,It=null,Ze=ne.next();Se!==null&&!Ze.done;Me++,Ze=ne.next()){Se.index>Me?(It=Se,Se=null):It=Se.sibling;var Ci=ie(ee,Se,Ze.value,ue);if(Ci===null){Se===null&&(Se=It);break}i&&Se&&Ci.alternate===null&&a(ee,Se),K=x(Ci,K,Me),Ve===null?xe=Ci:Ve.sibling=Ci,Ve=Ci,Se=It}if(Ze.done)return c(ee,Se),Ke&&ts(ee,Me),xe;if(Se===null){for(;!Ze.done;Me++,Ze=ne.next())Ze=fe(ee,Ze.value,ue),Ze!==null&&(K=x(Ze,K,Me),Ve===null?xe=Ze:Ve.sibling=Ze,Ve=Ze);return Ke&&ts(ee,Me),xe}for(Se=m(Se);!Ze.done;Me++,Ze=ne.next())Ze=se(Se,ee,Me,Ze.value,ue),Ze!==null&&(i&&Ze.alternate!==null&&Se.delete(Ze.key===null?Me:Ze.key),K=x(Ze,K,Me),Ve===null?xe=Ze:Ve.sibling=Ze,Ve=Ze);return i&&Se.forEach(function(gR){return a(ee,gR)}),Ke&&ts(ee,Me),xe}function it(ee,K,ne,ue){if(typeof ne=="object"&&ne!==null&&ne.type===b&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case g:e:{for(var xe=ne.key;K!==null;){if(K.key===xe){if(xe=ne.type,xe===b){if(K.tag===7){c(ee,K.sibling),ue=y(K,ne.props.children),ue.return=ee,ee=ue;break e}}else if(K.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===z&&Xx(xe)===K.type){c(ee,K.sibling),ue=y(K,ne.props),Bo(ue,ne),ue.return=ee,ee=ue;break e}c(ee,K);break}else a(ee,K);K=K.sibling}ne.type===b?(ue=Ji(ne.props.children,ee.mode,ue,ne.key),ue.return=ee,ee=ue):(ue=Bu(ne.type,ne.key,ne.props,null,ee.mode,ue),Bo(ue,ne),ue.return=ee,ee=ue)}return N(ee);case v:e:{for(xe=ne.key;K!==null;){if(K.key===xe)if(K.tag===4&&K.stateNode.containerInfo===ne.containerInfo&&K.stateNode.implementation===ne.implementation){c(ee,K.sibling),ue=y(K,ne.children||[]),ue.return=ee,ee=ue;break e}else{c(ee,K);break}else a(ee,K);K=K.sibling}ue=Kd(ne,ee.mode,ue),ue.return=ee,ee=ue}return N(ee);case z:return xe=ne._init,ne=xe(ne._payload),it(ee,K,ne,ue)}if($(ne))return Oe(ee,K,ne,ue);if(H(ne)){if(xe=H(ne),typeof xe!="function")throw Error(r(150));return ne=xe.call(ne),Ne(ee,K,ne,ue)}if(typeof ne.then=="function")return it(ee,K,rc(ne),ue);if(ne.$$typeof===S)return it(ee,K,$u(ee,ne),ue);ic(ee,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,K!==null&&K.tag===6?(c(ee,K.sibling),ue=y(K,ne),ue.return=ee,ee=ue):(c(ee,K),ue=Qd(ne,ee.mode,ue),ue.return=ee,ee=ue),N(ee)):c(ee,K)}return function(ee,K,ne,ue){try{Vo=0;var xe=it(ee,K,ne,ue);return ia=null,xe}catch(Se){if(Se===Mo||Se===Gu)throw Se;var Ve=xn(29,Se,null,ee.mode);return Ve.lanes=ue,Ve.return=ee,Ve}finally{}}}var sa=Qx(!0),Kx=Qx(!1),Ln=G(null),dr=null;function di(i){var a=i.alternate;C(jt,jt.current&1),C(Ln,i),dr===null&&(a===null||ea.current!==null||a.memoizedState!==null)&&(dr=i)}function Wx(i){if(i.tag===22){if(C(jt,jt.current),C(Ln,i),dr===null){var a=i.alternate;a!==null&&a.memoizedState!==null&&(dr=i)}}else hi()}function hi(){C(jt,jt.current),C(Ln,Ln.current)}function Pr(i){te(Ln),dr===i&&(dr=null),te(jt)}var jt=G(0);function sc(i){for(var a=i;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||xm(c)))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}function Mh(i,a,c,m){a=i.memoizedState,c=c(m,a),c=c==null?a:h({},a,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var Oh={enqueueSetState:function(i,a,c){i=i._reactInternals;var m=Sn(),y=ui(m);y.payload=a,c!=null&&(y.callback=c),a=ci(i,y,m),a!==null&&(En(a,i,m),Ro(a,i,m))},enqueueReplaceState:function(i,a,c){i=i._reactInternals;var m=Sn(),y=ui(m);y.tag=1,y.payload=a,c!=null&&(y.callback=c),a=ci(i,y,m),a!==null&&(En(a,i,m),Ro(a,i,m))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var c=Sn(),m=ui(c);m.tag=2,a!=null&&(m.callback=a),a=ci(i,m,c),a!==null&&(En(a,i,c),Ro(a,i,c))}};function Jx(i,a,c,m,y,x,N){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(m,x,N):a.prototype&&a.prototype.isPureReactComponent?!_o(c,m)||!_o(y,x):!0}function eb(i,a,c,m){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,m),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,m),a.state!==i&&Oh.enqueueReplaceState(a,a.state,null)}function ls(i,a){var c=a;if("ref"in a){c={};for(var m in a)m!=="ref"&&(c[m]=a[m])}if(i=i.defaultProps){c===a&&(c=h({},c));for(var y in i)c[y]===void 0&&(c[y]=i[y])}return c}var ac=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)};function tb(i){ac(i)}function nb(i){console.error(i)}function rb(i){ac(i)}function oc(i,a){try{var c=i.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(m){setTimeout(function(){throw m})}}function ib(i,a,c){try{var m=i.onCaughtError;m(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Rh(i,a,c){return c=ui(c),c.tag=3,c.payload={element:null},c.callback=function(){oc(i,a)},c}function sb(i){return i=ui(i),i.tag=3,i}function ab(i,a,c,m){var y=c.type.getDerivedStateFromError;if(typeof y=="function"){var x=m.value;i.payload=function(){return y(x)},i.callback=function(){ib(a,c,m)}}var N=c.stateNode;N!==null&&typeof N.componentDidCatch=="function"&&(i.callback=function(){ib(a,c,m),typeof y!="function"&&(xi===null?xi=new Set([this]):xi.add(this));var L=m.stack;this.componentDidCatch(m.value,{componentStack:L!==null?L:""})})}function gO(i,a,c,m,y){if(c.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(a=c.alternate,a!==null&&Co(a,c,y,!0),c=Ln.current,c!==null){switch(c.tag){case 13:return dr===null?nm():c.alternate===null&&vt===0&&(vt=3),c.flags&=-257,c.flags|=65536,c.lanes=y,m===oh?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([m]):a.add(m),im(i,m,y)),!1;case 22:return c.flags|=65536,m===oh?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([m])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([m]):c.add(m)),im(i,m,y)),!1}throw Error(r(435,c.tag))}return im(i,m,y),nm(),!1}if(Ke)return a=Ln.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,m!==eh&&(i=Error(r(422),{cause:m}),To(Rn(i,c)))):(m!==eh&&(a=Error(r(423),{cause:m}),To(Rn(a,c))),i=i.current.alternate,i.flags|=65536,y&=-y,i.lanes|=y,m=Rn(m,c),y=Rh(i.stateNode,m,y),ch(i,y),vt!==4&&(vt=2)),!1;var x=Error(r(520),{cause:m});if(x=Rn(x,c),Yo===null?Yo=[x]:Yo.push(x),vt!==4&&(vt=2),a===null)return!0;m=Rn(m,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,i=y&-y,c.lanes|=i,i=Rh(c.stateNode,m,i),ch(c,i),!1;case 1:if(a=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(xi===null||!xi.has(x))))return c.flags|=65536,y&=-y,c.lanes|=y,y=sb(y),ab(y,i,c,m),ch(c,y),!1}c=c.return}while(c!==null);return!1}var ob=Error(r(461)),Lt=!1;function Vt(i,a,c,m){a.child=i===null?Kx(a,null,c,m):sa(a,i.child,c,m)}function lb(i,a,c,m,y){c=c.render;var x=a.ref;if("ref"in m){var N={};for(var L in m)L!=="ref"&&(N[L]=m[L])}else N=m;return ss(a),m=ph(i,a,c,N,x,y),L=gh(),i!==null&&!Lt?(yh(i,a,y),Ir(i,a,y)):(Ke&&L&&Wd(a),a.flags|=1,Vt(i,a,m,y),a.child)}function ub(i,a,c,m,y){if(i===null){var x=c.type;return typeof x=="function"&&!Xd(x)&&x.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=x,cb(i,a,x,m,y)):(i=Bu(c.type,null,m,a,a.mode,y),i.ref=a.ref,i.return=a,a.child=i)}if(x=i.child,!Bh(i,y)){var N=x.memoizedProps;if(c=c.compare,c=c!==null?c:_o,c(N,m)&&i.ref===a.ref)return Ir(i,a,y)}return a.flags|=1,i=Or(x,m),i.ref=a.ref,i.return=a,a.child=i}function cb(i,a,c,m,y){if(i!==null){var x=i.memoizedProps;if(_o(x,m)&&i.ref===a.ref)if(Lt=!1,a.pendingProps=m=x,Bh(i,y))(i.flags&131072)!==0&&(Lt=!0);else return a.lanes=i.lanes,Ir(i,a,y)}return Dh(i,a,c,m,y)}function fb(i,a,c){var m=a.pendingProps,y=m.children,x=i!==null?i.memoizedState:null;if(m.mode==="hidden"){if((a.flags&128)!==0){if(m=x!==null?x.baseLanes|c:c,i!==null){for(y=a.child=i.child,x=0;y!==null;)x=x|y.lanes|y.childLanes,y=y.sibling;a.childLanes=x&~m}else a.childLanes=0,a.child=null;return db(i,a,m,c)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&qu(a,x!==null?x.cachePool:null),x!==null?cx(a,x):dh(),Wx(a);else return a.lanes=a.childLanes=536870912,db(i,a,x!==null?x.baseLanes|c:c,c)}else x!==null?(qu(a,x.cachePool),cx(a,x),hi(),a.memoizedState=null):(i!==null&&qu(a,null),dh(),hi());return Vt(i,a,y,c),a.child}function db(i,a,c,m){var y=ah();return y=y===null?null:{parent:Dt._currentValue,pool:y},a.memoizedState={baseLanes:c,cachePool:y},i!==null&&qu(a,null),dh(),Wx(a),i!==null&&Co(i,a,m,!0),null}function lc(i,a){var c=a.ref;if(c===null)i!==null&&i.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(i===null||i.ref!==c)&&(a.flags|=4194816)}}function Dh(i,a,c,m,y){return ss(a),c=ph(i,a,c,m,void 0,y),m=gh(),i!==null&&!Lt?(yh(i,a,y),Ir(i,a,y)):(Ke&&m&&Wd(a),a.flags|=1,Vt(i,a,c,y),a.child)}function hb(i,a,c,m,y,x){return ss(a),a.updateQueue=null,c=dx(a,m,c,y),fx(i),m=gh(),i!==null&&!Lt?(yh(i,a,x),Ir(i,a,x)):(Ke&&m&&Wd(a),a.flags|=1,Vt(i,a,c,x),a.child)}function mb(i,a,c,m,y){if(ss(a),a.stateNode===null){var x=Xs,N=c.contextType;typeof N=="object"&&N!==null&&(x=Yt(N)),x=new c(m,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Oh,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=m,x.state=a.memoizedState,x.refs={},lh(a),N=c.contextType,x.context=typeof N=="object"&&N!==null?Yt(N):Xs,x.state=a.memoizedState,N=c.getDerivedStateFromProps,typeof N=="function"&&(Mh(a,c,N,m),x.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(N=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),N!==x.state&&Oh.enqueueReplaceState(x,x.state,null),jo(a,m,x,y),Do(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),m=!0}else if(i===null){x=a.stateNode;var L=a.memoizedProps,q=ls(c,L);x.props=q;var re=x.context,le=c.contextType;N=Xs,typeof le=="object"&&le!==null&&(N=Yt(le));var fe=c.getDerivedStateFromProps;le=typeof fe=="function"||typeof x.getSnapshotBeforeUpdate=="function",L=a.pendingProps!==L,le||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(L||re!==N)&&eb(a,x,m,N),li=!1;var ie=a.memoizedState;x.state=ie,jo(a,m,x,y),Do(),re=a.memoizedState,L||ie!==re||li?(typeof fe=="function"&&(Mh(a,c,fe,m),re=a.memoizedState),(q=li||Jx(a,c,q,m,ie,re,N))?(le||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=m,a.memoizedState=re),x.props=m,x.state=re,x.context=N,m=q):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),m=!1)}else{x=a.stateNode,uh(i,a),N=a.memoizedProps,le=ls(c,N),x.props=le,fe=a.pendingProps,ie=x.context,re=c.contextType,q=Xs,typeof re=="object"&&re!==null&&(q=Yt(re)),L=c.getDerivedStateFromProps,(re=typeof L=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N!==fe||ie!==q)&&eb(a,x,m,q),li=!1,ie=a.memoizedState,x.state=ie,jo(a,m,x,y),Do();var se=a.memoizedState;N!==fe||ie!==se||li||i!==null&&i.dependencies!==null&&Fu(i.dependencies)?(typeof L=="function"&&(Mh(a,c,L,m),se=a.memoizedState),(le=li||Jx(a,c,le,m,ie,se,q)||i!==null&&i.dependencies!==null&&Fu(i.dependencies))?(re||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(m,se,q),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(m,se,q)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||N===i.memoizedProps&&ie===i.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||N===i.memoizedProps&&ie===i.memoizedState||(a.flags|=1024),a.memoizedProps=m,a.memoizedState=se),x.props=m,x.state=se,x.context=q,m=le):(typeof x.componentDidUpdate!="function"||N===i.memoizedProps&&ie===i.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||N===i.memoizedProps&&ie===i.memoizedState||(a.flags|=1024),m=!1)}return x=m,lc(i,a),m=(a.flags&128)!==0,x||m?(x=a.stateNode,c=m&&typeof c.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,i!==null&&m?(a.child=sa(a,i.child,null,y),a.child=sa(a,null,c,y)):Vt(i,a,c,y),a.memoizedState=x.state,i=a.child):i=Ir(i,a,y),i}function pb(i,a,c,m){return ko(),a.flags|=256,Vt(i,a,c,m),a.child}var jh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zh(i){return{baseLanes:i,cachePool:nx()}}function Lh(i,a,c){return i=i!==null?i.childLanes&~c:0,a&&(i|=Pn),i}function gb(i,a,c){var m=a.pendingProps,y=!1,x=(a.flags&128)!==0,N;if((N=x)||(N=i!==null&&i.memoizedState===null?!1:(jt.current&2)!==0),N&&(y=!0,a.flags&=-129),N=(a.flags&32)!==0,a.flags&=-33,i===null){if(Ke){if(y?di(a):hi(),Ke){var L=yt,q;if(q=L){e:{for(q=L,L=fr;q.nodeType!==8;){if(!L){L=null;break e}if(q=Xn(q.nextSibling),q===null){L=null;break e}}L=q}L!==null?(a.memoizedState={dehydrated:L,treeContext:es!==null?{id:Rr,overflow:Dr}:null,retryLane:536870912,hydrationErrors:null},q=xn(18,null,null,0),q.stateNode=L,q.return=a,a.child=q,tn=a,yt=null,q=!0):q=!1}q||rs(a)}if(L=a.memoizedState,L!==null&&(L=L.dehydrated,L!==null))return xm(L)?a.lanes=32:a.lanes=536870912,null;Pr(a)}return L=m.children,m=m.fallback,y?(hi(),y=a.mode,L=uc({mode:"hidden",children:L},y),m=Ji(m,y,c,null),L.return=a,m.return=a,L.sibling=m,a.child=L,y=a.child,y.memoizedState=zh(c),y.childLanes=Lh(i,N,c),a.memoizedState=jh,m):(di(a),Ph(a,L))}if(q=i.memoizedState,q!==null&&(L=q.dehydrated,L!==null)){if(x)a.flags&256?(di(a),a.flags&=-257,a=Ih(i,a,c)):a.memoizedState!==null?(hi(),a.child=i.child,a.flags|=128,a=null):(hi(),y=m.fallback,L=a.mode,m=uc({mode:"visible",children:m.children},L),y=Ji(y,L,c,null),y.flags|=2,m.return=a,y.return=a,m.sibling=y,a.child=m,sa(a,i.child,null,c),m=a.child,m.memoizedState=zh(c),m.childLanes=Lh(i,N,c),a.memoizedState=jh,a=y);else if(di(a),xm(L)){if(N=L.nextSibling&&L.nextSibling.dataset,N)var re=N.dgst;N=re,m=Error(r(419)),m.stack="",m.digest=N,To({value:m,source:null,stack:null}),a=Ih(i,a,c)}else if(Lt||Co(i,a,c,!1),N=(c&i.childLanes)!==0,Lt||N){if(N=lt,N!==null&&(m=c&-c,m=(m&42)!==0?1:ao(m),m=(m&(N.suspendedLanes|c))!==0?0:m,m!==0&&m!==q.retryLane))throw q.retryLane=m,Zs(i,m),En(N,i,m),ob;L.data==="$?"||nm(),a=Ih(i,a,c)}else L.data==="$?"?(a.flags|=192,a.child=i.child,a=null):(i=q.treeContext,yt=Xn(L.nextSibling),tn=a,Ke=!0,ns=null,fr=!1,i!==null&&(jn[zn++]=Rr,jn[zn++]=Dr,jn[zn++]=es,Rr=i.id,Dr=i.overflow,es=a),a=Ph(a,m.children),a.flags|=4096);return a}return y?(hi(),y=m.fallback,L=a.mode,q=i.child,re=q.sibling,m=Or(q,{mode:"hidden",children:m.children}),m.subtreeFlags=q.subtreeFlags&65011712,re!==null?y=Or(re,y):(y=Ji(y,L,c,null),y.flags|=2),y.return=a,m.return=a,m.sibling=y,a.child=m,m=y,y=a.child,L=i.child.memoizedState,L===null?L=zh(c):(q=L.cachePool,q!==null?(re=Dt._currentValue,q=q.parent!==re?{parent:re,pool:re}:q):q=nx(),L={baseLanes:L.baseLanes|c,cachePool:q}),y.memoizedState=L,y.childLanes=Lh(i,N,c),a.memoizedState=jh,m):(di(a),c=i.child,i=c.sibling,c=Or(c,{mode:"visible",children:m.children}),c.return=a,c.sibling=null,i!==null&&(N=a.deletions,N===null?(a.deletions=[i],a.flags|=16):N.push(i)),a.child=c,a.memoizedState=null,c)}function Ph(i,a){return a=uc({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function uc(i,a){return i=xn(22,i,null,a),i.lanes=0,i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},i}function Ih(i,a,c){return sa(a,i.child,null,c),i=Ph(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function yb(i,a,c){i.lanes|=a;var m=i.alternate;m!==null&&(m.lanes|=a),nh(i.return,a,c)}function Vh(i,a,c,m,y){var x=i.memoizedState;x===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:y}:(x.isBackwards=a,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=c,x.tailMode=y)}function vb(i,a,c){var m=a.pendingProps,y=m.revealOrder,x=m.tail;if(Vt(i,a,m.children,c),m=jt.current,(m&2)!==0)m=m&1|2,a.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&yb(i,c,a);else if(i.tag===19)yb(i,c,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}m&=1}switch(C(jt,m),y){case"forwards":for(c=a.child,y=null;c!==null;)i=c.alternate,i!==null&&sc(i)===null&&(y=c),c=c.sibling;c=y,c===null?(y=a.child,a.child=null):(y=c.sibling,c.sibling=null),Vh(a,!1,y,c,x);break;case"backwards":for(c=null,y=a.child,a.child=null;y!==null;){if(i=y.alternate,i!==null&&sc(i)===null){a.child=y;break}i=y.sibling,y.sibling=c,c=y,y=i}Vh(a,!0,c,null,x);break;case"together":Vh(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Ir(i,a,c){if(i!==null&&(a.dependencies=i.dependencies),vi|=a.lanes,(c&a.childLanes)===0)if(i!==null){if(Co(i,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(i!==null&&a.child!==i.child)throw Error(r(153));if(a.child!==null){for(i=a.child,c=Or(i,i.pendingProps),a.child=c,c.return=a;i.sibling!==null;)i=i.sibling,c=c.sibling=Or(i,i.pendingProps),c.return=a;c.sibling=null}return a.child}function Bh(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&Fu(i)))}function yO(i,a,c){switch(a.tag){case 3:ce(a,a.stateNode.containerInfo),oi(a,Dt,i.memoizedState.cache),ko();break;case 27:case 5:ke(a);break;case 4:ce(a,a.stateNode.containerInfo);break;case 10:oi(a,a.type,a.memoizedProps.value);break;case 13:var m=a.memoizedState;if(m!==null)return m.dehydrated!==null?(di(a),a.flags|=128,null):(c&a.child.childLanes)!==0?gb(i,a,c):(di(a),i=Ir(i,a,c),i!==null?i.sibling:null);di(a);break;case 19:var y=(i.flags&128)!==0;if(m=(c&a.childLanes)!==0,m||(Co(i,a,c,!1),m=(c&a.childLanes)!==0),y){if(m)return vb(i,a,c);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),C(jt,jt.current),m)break;return null;case 22:case 23:return a.lanes=0,fb(i,a,c);case 24:oi(a,Dt,i.memoizedState.cache)}return Ir(i,a,c)}function xb(i,a,c){if(i!==null)if(i.memoizedProps!==a.pendingProps)Lt=!0;else{if(!Bh(i,c)&&(a.flags&128)===0)return Lt=!1,yO(i,a,c);Lt=(i.flags&131072)!==0}else Lt=!1,Ke&&(a.flags&1048576)!==0&&Xv(a,Hu,a.index);switch(a.lanes=0,a.tag){case 16:e:{i=a.pendingProps;var m=a.elementType,y=m._init;if(m=y(m._payload),a.type=m,typeof m=="function")Xd(m)?(i=ls(m,i),a.tag=1,a=mb(null,a,m,i,c)):(a.tag=0,a=Dh(null,a,m,i,c));else{if(m!=null){if(y=m.$$typeof,y===M){a.tag=11,a=lb(null,a,m,i,c);break e}else if(y===B){a.tag=14,a=ub(null,a,m,i,c);break e}}throw a=j(m)||m,Error(r(306,a,""))}}return a;case 0:return Dh(i,a,a.type,a.pendingProps,c);case 1:return m=a.type,y=ls(m,a.pendingProps),mb(i,a,m,y,c);case 3:e:{if(ce(a,a.stateNode.containerInfo),i===null)throw Error(r(387));m=a.pendingProps;var x=a.memoizedState;y=x.element,uh(i,a),jo(a,m,null,c);var N=a.memoizedState;if(m=N.cache,oi(a,Dt,m),m!==x.cache&&rh(a,[Dt],c,!0),Do(),m=N.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:N.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=pb(i,a,m,c);break e}else if(m!==y){y=Rn(Error(r(424)),a),To(y),a=pb(i,a,m,c);break e}else{switch(i=a.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(yt=Xn(i.firstChild),tn=a,Ke=!0,ns=null,fr=!0,c=Kx(a,null,m,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(ko(),m===y){a=Ir(i,a,c);break e}Vt(i,a,m,c)}a=a.child}return a;case 26:return lc(i,a),i===null?(c=S1(a.type,null,a.pendingProps,null))?a.memoizedState=c:Ke||(c=a.type,i=a.pendingProps,m=Sc(J.current).createElement(c),m[zt]=a,m[Gt]=i,Ut(m,c,i),Tt(m),a.stateNode=m):a.memoizedState=S1(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return ke(a),i===null&&Ke&&(m=a.stateNode=b1(a.type,a.pendingProps,J.current),tn=a,fr=!0,y=yt,_i(a.type)?(bm=y,yt=Xn(m.firstChild)):yt=y),Vt(i,a,a.pendingProps.children,c),lc(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&Ke&&((y=m=yt)&&(m=qO(m,a.type,a.pendingProps,fr),m!==null?(a.stateNode=m,tn=a,yt=Xn(m.firstChild),fr=!1,y=!0):y=!1),y||rs(a)),ke(a),y=a.type,x=a.pendingProps,N=i!==null?i.memoizedProps:null,m=x.children,gm(y,x)?m=null:N!==null&&gm(y,N)&&(a.flags|=32),a.memoizedState!==null&&(y=ph(i,a,uO,null,null,c),nl._currentValue=y),lc(i,a),Vt(i,a,m,c),a.child;case 6:return i===null&&Ke&&((i=c=yt)&&(c=GO(c,a.pendingProps,fr),c!==null?(a.stateNode=c,tn=a,yt=null,i=!0):i=!1),i||rs(a)),null;case 13:return gb(i,a,c);case 4:return ce(a,a.stateNode.containerInfo),m=a.pendingProps,i===null?a.child=sa(a,null,m,c):Vt(i,a,m,c),a.child;case 11:return lb(i,a,a.type,a.pendingProps,c);case 7:return Vt(i,a,a.pendingProps,c),a.child;case 8:return Vt(i,a,a.pendingProps.children,c),a.child;case 12:return Vt(i,a,a.pendingProps.children,c),a.child;case 10:return m=a.pendingProps,oi(a,a.type,m.value),Vt(i,a,m.children,c),a.child;case 9:return y=a.type._context,m=a.pendingProps.children,ss(a),y=Yt(y),m=m(y),a.flags|=1,Vt(i,a,m,c),a.child;case 14:return ub(i,a,a.type,a.pendingProps,c);case 15:return cb(i,a,a.type,a.pendingProps,c);case 19:return vb(i,a,c);case 31:return m=a.pendingProps,c=a.mode,m={mode:m.mode,children:m.children},i===null?(c=uc(m,c),c.ref=a.ref,a.child=c,c.return=a,a=c):(c=Or(i.child,m),c.ref=a.ref,a.child=c,c.return=a,a=c),a;case 22:return fb(i,a,c);case 24:return ss(a),m=Yt(Dt),i===null?(y=ah(),y===null&&(y=lt,x=ih(),y.pooledCache=x,x.refCount++,x!==null&&(y.pooledCacheLanes|=c),y=x),a.memoizedState={parent:m,cache:y},lh(a),oi(a,Dt,y)):((i.lanes&c)!==0&&(uh(i,a),jo(a,null,null,c),Do()),y=i.memoizedState,x=a.memoizedState,y.parent!==m?(y={parent:m,cache:m},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),oi(a,Dt,m)):(m=x.cache,oi(a,Dt,m),m!==y.cache&&rh(a,[Dt],c,!0))),Vt(i,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Vr(i){i.flags|=4}function bb(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!A1(a)){if(a=Ln.current,a!==null&&(($e&4194048)===$e?dr!==null:($e&62914560)!==$e&&($e&536870912)===0||a!==dr))throw Oo=oh,rx;i.flags|=8192}}function cc(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?vu():536870912,i.lanes|=a,ua|=a)}function Uo(i,a){if(!Ke)switch(i.tailMode){case"hidden":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:m.sibling=null}}function mt(i){var a=i.alternate!==null&&i.alternate.child===i.child,c=0,m=0;if(a)for(var y=i.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags&65011712,m|=y.flags&65011712,y.return=i,y=y.sibling;else for(y=i.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags,m|=y.flags,y.return=i,y=y.sibling;return i.subtreeFlags|=m,i.childLanes=c,a}function vO(i,a,c){var m=a.pendingProps;switch(Jd(a),a.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(a),null;case 1:return mt(a),null;case 3:return c=a.stateNode,m=null,i!==null&&(m=i.memoizedState.cache),a.memoizedState.cache!==m&&(a.flags|=2048),zr(Dt),ge(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Eo(a)?Vr(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Wv())),mt(a),null;case 26:return c=a.memoizedState,i===null?(Vr(a),c!==null?(mt(a),bb(a,c)):(mt(a),a.flags&=-16777217)):c?c!==i.memoizedState?(Vr(a),mt(a),bb(a,c)):(mt(a),a.flags&=-16777217):(i.memoizedProps!==m&&Vr(a),mt(a),a.flags&=-16777217),null;case 27:_e(a),c=J.current;var y=a.type;if(i!==null&&a.stateNode!=null)i.memoizedProps!==m&&Vr(a);else{if(!m){if(a.stateNode===null)throw Error(r(166));return mt(a),null}i=F.current,Eo(a)?Qv(a):(i=b1(y,m,c),a.stateNode=i,Vr(a))}return mt(a),null;case 5:if(_e(a),c=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==m&&Vr(a);else{if(!m){if(a.stateNode===null)throw Error(r(166));return mt(a),null}if(i=F.current,Eo(a))Qv(a);else{switch(y=Sc(J.current),i){case 1:i=y.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:i=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":i=y.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":i=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":i=y.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof m.is=="string"?y.createElement("select",{is:m.is}):y.createElement("select"),m.multiple?i.multiple=!0:m.size&&(i.size=m.size);break;default:i=typeof m.is=="string"?y.createElement(c,{is:m.is}):y.createElement(c)}}i[zt]=a,i[Gt]=m;e:for(y=a.child;y!==null;){if(y.tag===5||y.tag===6)i.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===a)break e;for(;y.sibling===null;){if(y.return===null||y.return===a)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}a.stateNode=i;e:switch(Ut(i,c,m),c){case"button":case"input":case"select":case"textarea":i=!!m.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Vr(a)}}return mt(a),a.flags&=-16777217,null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==m&&Vr(a);else{if(typeof m!="string"&&a.stateNode===null)throw Error(r(166));if(i=J.current,Eo(a)){if(i=a.stateNode,c=a.memoizedProps,m=null,y=tn,y!==null)switch(y.tag){case 27:case 5:m=y.memoizedProps}i[zt]=a,i=!!(i.nodeValue===c||m!==null&&m.suppressHydrationWarning===!0||h1(i.nodeValue,c)),i||rs(a)}else i=Sc(i).createTextNode(m),i[zt]=a,a.stateNode=i}return mt(a),null;case 13:if(m=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(y=Eo(a),m!==null&&m.dehydrated!==null){if(i===null){if(!y)throw Error(r(318));if(y=a.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[zt]=a}else ko(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;mt(a),y=!1}else y=Wv(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=y),y=!0;if(!y)return a.flags&256?(Pr(a),a):(Pr(a),null)}if(Pr(a),(a.flags&128)!==0)return a.lanes=c,a;if(c=m!==null,i=i!==null&&i.memoizedState!==null,c){m=a.child,y=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(y=m.alternate.memoizedState.cachePool.pool);var x=null;m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(x=m.memoizedState.cachePool.pool),x!==y&&(m.flags|=2048)}return c!==i&&c&&(a.child.flags|=8192),cc(a,a.updateQueue),mt(a),null;case 4:return ge(),i===null&&fm(a.stateNode.containerInfo),mt(a),null;case 10:return zr(a.type),mt(a),null;case 19:if(te(jt),y=a.memoizedState,y===null)return mt(a),null;if(m=(a.flags&128)!==0,x=y.rendering,x===null)if(m)Uo(y,!1);else{if(vt!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(x=sc(i),x!==null){for(a.flags|=128,Uo(y,!1),i=x.updateQueue,a.updateQueue=i,cc(a,i),a.subtreeFlags=0,i=c,c=a.child;c!==null;)Zv(c,i),c=c.sibling;return C(jt,jt.current&1|2),a.child}i=i.sibling}y.tail!==null&&Et()>hc&&(a.flags|=128,m=!0,Uo(y,!1),a.lanes=4194304)}else{if(!m)if(i=sc(x),i!==null){if(a.flags|=128,m=!0,i=i.updateQueue,a.updateQueue=i,cc(a,i),Uo(y,!0),y.tail===null&&y.tailMode==="hidden"&&!x.alternate&&!Ke)return mt(a),null}else 2*Et()-y.renderingStartTime>hc&&c!==536870912&&(a.flags|=128,m=!0,Uo(y,!1),a.lanes=4194304);y.isBackwards?(x.sibling=a.child,a.child=x):(i=y.last,i!==null?i.sibling=x:a.child=x,y.last=x)}return y.tail!==null?(a=y.tail,y.rendering=a,y.tail=a.sibling,y.renderingStartTime=Et(),a.sibling=null,i=jt.current,C(jt,m?i&1|2:i&1),a):(mt(a),null);case 22:case 23:return Pr(a),hh(),m=a.memoizedState!==null,i!==null?i.memoizedState!==null!==m&&(a.flags|=8192):m&&(a.flags|=8192),m?(c&536870912)!==0&&(a.flags&128)===0&&(mt(a),a.subtreeFlags&6&&(a.flags|=8192)):mt(a),c=a.updateQueue,c!==null&&cc(a,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),m=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(m=a.memoizedState.cachePool.pool),m!==c&&(a.flags|=2048),i!==null&&te(as),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),zr(Dt),mt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function xO(i,a){switch(Jd(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return zr(Dt),ge(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return _e(a),null;case 13:if(Pr(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(r(340));ko()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return te(jt),null;case 4:return ge(),null;case 10:return zr(a.type),null;case 22:case 23:return Pr(a),hh(),i!==null&&te(as),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return zr(Dt),null;case 25:return null;default:return null}}function wb(i,a){switch(Jd(a),a.tag){case 3:zr(Dt),ge();break;case 26:case 27:case 5:_e(a);break;case 4:ge();break;case 13:Pr(a);break;case 19:te(jt);break;case 10:zr(a.type);break;case 22:case 23:Pr(a),hh(),i!==null&&te(as);break;case 24:zr(Dt)}}function Ho(i,a){try{var c=a.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var y=m.next;c=y;do{if((c.tag&i)===i){m=void 0;var x=c.create,N=c.inst;m=x(),N.destroy=m}c=c.next}while(c!==y)}}catch(L){st(a,a.return,L)}}function mi(i,a,c){try{var m=a.updateQueue,y=m!==null?m.lastEffect:null;if(y!==null){var x=y.next;m=x;do{if((m.tag&i)===i){var N=m.inst,L=N.destroy;if(L!==void 0){N.destroy=void 0,y=a;var q=c,re=L;try{re()}catch(le){st(y,q,le)}}}m=m.next}while(m!==x)}}catch(le){st(a,a.return,le)}}function _b(i){var a=i.updateQueue;if(a!==null){var c=i.stateNode;try{ux(a,c)}catch(m){st(i,i.return,m)}}}function Sb(i,a,c){c.props=ls(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(m){st(i,a,m)}}function Fo(i,a){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var m=i.stateNode;break;case 30:m=i.stateNode;break;default:m=i.stateNode}typeof c=="function"?i.refCleanup=c(m):c.current=m}}catch(y){st(i,a,y)}}function hr(i,a){var c=i.ref,m=i.refCleanup;if(c!==null)if(typeof m=="function")try{m()}catch(y){st(i,a,y)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(y){st(i,a,y)}else c.current=null}function Eb(i){var a=i.type,c=i.memoizedProps,m=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&m.focus();break e;case"img":c.src?m.src=c.src:c.srcSet&&(m.srcset=c.srcSet)}}catch(y){st(i,i.return,y)}}function Uh(i,a,c){try{var m=i.stateNode;BO(m,i.type,c,a),m[Gt]=a}catch(y){st(i,i.return,y)}}function kb(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&_i(i.type)||i.tag===4}function Hh(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||kb(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&_i(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Fh(i,a,c){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(i),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=_c));else if(m!==4&&(m===27&&_i(i.type)&&(c=i.stateNode,a=null),i=i.child,i!==null))for(Fh(i,a,c),i=i.sibling;i!==null;)Fh(i,a,c),i=i.sibling}function fc(i,a,c){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?c.insertBefore(i,a):c.appendChild(i);else if(m!==4&&(m===27&&_i(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(fc(i,a,c),i=i.sibling;i!==null;)fc(i,a,c),i=i.sibling}function Tb(i){var a=i.stateNode,c=i.memoizedProps;try{for(var m=i.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);Ut(a,m,c),a[zt]=i,a[Gt]=c}catch(x){st(i,i.return,x)}}var Br=!1,_t=!1,$h=!1,Cb=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function bO(i,a){if(i=i.containerInfo,mm=Nc,i=Iv(i),Hd(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var y=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var N=0,L=-1,q=-1,re=0,le=0,fe=i,ie=null;t:for(;;){for(var se;fe!==c||y!==0&&fe.nodeType!==3||(L=N+y),fe!==x||m!==0&&fe.nodeType!==3||(q=N+m),fe.nodeType===3&&(N+=fe.nodeValue.length),(se=fe.firstChild)!==null;)ie=fe,fe=se;for(;;){if(fe===i)break t;if(ie===c&&++re===y&&(L=N),ie===x&&++le===m&&(q=N),(se=fe.nextSibling)!==null)break;fe=ie,ie=fe.parentNode}fe=se}c=L===-1||q===-1?null:{start:L,end:q}}else c=null}c=c||{start:0,end:0}}else c=null;for(pm={focusedElem:i,selectionRange:c},Nc=!1,Pt=a;Pt!==null;)if(a=Pt,i=a.child,(a.subtreeFlags&1024)!==0&&i!==null)i.return=a,Pt=i;else for(;Pt!==null;){switch(a=Pt,x=a.alternate,i=a.flags,a.tag){case 0:break;case 11:case 15:break;case 1:if((i&1024)!==0&&x!==null){i=void 0,c=a,y=x.memoizedProps,x=x.memoizedState,m=c.stateNode;try{var Oe=ls(c.type,y,c.elementType===c.type);i=m.getSnapshotBeforeUpdate(Oe,x),m.__reactInternalSnapshotBeforeUpdate=i}catch(Ne){st(c,c.return,Ne)}}break;case 3:if((i&1024)!==0){if(i=a.stateNode.containerInfo,c=i.nodeType,c===9)vm(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":vm(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=a.sibling,i!==null){i.return=a.return,Pt=i;break}Pt=a.return}}function Ab(i,a,c){var m=c.flags;switch(c.tag){case 0:case 11:case 15:pi(i,c),m&4&&Ho(5,c);break;case 1:if(pi(i,c),m&4)if(i=c.stateNode,a===null)try{i.componentDidMount()}catch(N){st(c,c.return,N)}else{var y=ls(c.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(y,a,i.__reactInternalSnapshotBeforeUpdate)}catch(N){st(c,c.return,N)}}m&64&&_b(c),m&512&&Fo(c,c.return);break;case 3:if(pi(i,c),m&64&&(i=c.updateQueue,i!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{ux(i,a)}catch(N){st(c,c.return,N)}}break;case 27:a===null&&m&4&&Tb(c);case 26:case 5:pi(i,c),a===null&&m&4&&Eb(c),m&512&&Fo(c,c.return);break;case 12:pi(i,c);break;case 13:pi(i,c),m&4&&Ob(i,c),m&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=NO.bind(null,c),YO(i,c))));break;case 22:if(m=c.memoizedState!==null||Br,!m){a=a!==null&&a.memoizedState!==null||_t,y=Br;var x=_t;Br=m,(_t=a)&&!x?gi(i,c,(c.subtreeFlags&8772)!==0):pi(i,c),Br=y,_t=x}break;case 30:break;default:pi(i,c)}}function Nb(i){var a=i.alternate;a!==null&&(i.alternate=null,Nb(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&uo(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var dt=null,fn=!1;function Ur(i,a,c){for(c=c.child;c!==null;)Mb(i,a,c),c=c.sibling}function Mb(i,a,c){if(de&&typeof de.onCommitFiberUnmount=="function")try{de.onCommitFiberUnmount(ae,c)}catch{}switch(c.tag){case 26:_t||hr(c,a),Ur(i,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:_t||hr(c,a);var m=dt,y=fn;_i(c.type)&&(dt=c.stateNode,fn=!1),Ur(i,a,c),Wo(c.stateNode),dt=m,fn=y;break;case 5:_t||hr(c,a);case 6:if(m=dt,y=fn,dt=null,Ur(i,a,c),dt=m,fn=y,dt!==null)if(fn)try{(dt.nodeType===9?dt.body:dt.nodeName==="HTML"?dt.ownerDocument.body:dt).removeChild(c.stateNode)}catch(x){st(c,a,x)}else try{dt.removeChild(c.stateNode)}catch(x){st(c,a,x)}break;case 18:dt!==null&&(fn?(i=dt,v1(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),al(i)):v1(dt,c.stateNode));break;case 4:m=dt,y=fn,dt=c.stateNode.containerInfo,fn=!0,Ur(i,a,c),dt=m,fn=y;break;case 0:case 11:case 14:case 15:_t||mi(2,c,a),_t||mi(4,c,a),Ur(i,a,c);break;case 1:_t||(hr(c,a),m=c.stateNode,typeof m.componentWillUnmount=="function"&&Sb(c,a,m)),Ur(i,a,c);break;case 21:Ur(i,a,c);break;case 22:_t=(m=_t)||c.memoizedState!==null,Ur(i,a,c),_t=m;break;default:Ur(i,a,c)}}function Ob(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{al(i)}catch(c){st(a,a.return,c)}}function wO(i){switch(i.tag){case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new Cb),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new Cb),a;default:throw Error(r(435,i.tag))}}function qh(i,a){var c=wO(i);a.forEach(function(m){var y=MO.bind(null,i,m);c.has(m)||(c.add(m),m.then(y,y))})}function bn(i,a){var c=a.deletions;if(c!==null)for(var m=0;m<c.length;m++){var y=c[m],x=i,N=a,L=N;e:for(;L!==null;){switch(L.tag){case 27:if(_i(L.type)){dt=L.stateNode,fn=!1;break e}break;case 5:dt=L.stateNode,fn=!1;break e;case 3:case 4:dt=L.stateNode.containerInfo,fn=!0;break e}L=L.return}if(dt===null)throw Error(r(160));Mb(x,N,y),dt=null,fn=!1,x=y.alternate,x!==null&&(x.return=null),y.return=null}if(a.subtreeFlags&13878)for(a=a.child;a!==null;)Rb(a,i),a=a.sibling}var Zn=null;function Rb(i,a){var c=i.alternate,m=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:bn(a,i),wn(i),m&4&&(mi(3,i,i.return),Ho(3,i),mi(5,i,i.return));break;case 1:bn(a,i),wn(i),m&512&&(_t||c===null||hr(c,c.return)),m&64&&Br&&(i=i.updateQueue,i!==null&&(m=i.callbacks,m!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?m:c.concat(m))));break;case 26:var y=Zn;if(bn(a,i),wn(i),m&512&&(_t||c===null||hr(c,c.return)),m&4){var x=c!==null?c.memoizedState:null;if(m=i.memoizedState,c===null)if(m===null)if(i.stateNode===null){e:{m=i.type,c=i.memoizedProps,y=y.ownerDocument||y;t:switch(m){case"title":x=y.getElementsByTagName("title")[0],(!x||x[Xi]||x[zt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=y.createElement(m),y.head.insertBefore(x,y.querySelector("head > title"))),Ut(x,m,c),x[zt]=i,Tt(x),m=x;break e;case"link":var N=T1("link","href",y).get(m+(c.href||""));if(N){for(var L=0;L<N.length;L++)if(x=N[L],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){N.splice(L,1);break t}}x=y.createElement(m),Ut(x,m,c),y.head.appendChild(x);break;case"meta":if(N=T1("meta","content",y).get(m+(c.content||""))){for(L=0;L<N.length;L++)if(x=N[L],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){N.splice(L,1);break t}}x=y.createElement(m),Ut(x,m,c),y.head.appendChild(x);break;default:throw Error(r(468,m))}x[zt]=i,Tt(x),m=x}i.stateNode=m}else C1(y,i.type,i.stateNode);else i.stateNode=k1(y,m,i.memoizedProps);else x!==m?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,m===null?C1(y,i.type,i.stateNode):k1(y,m,i.memoizedProps)):m===null&&i.stateNode!==null&&Uh(i,i.memoizedProps,c.memoizedProps)}break;case 27:bn(a,i),wn(i),m&512&&(_t||c===null||hr(c,c.return)),c!==null&&m&4&&Uh(i,i.memoizedProps,c.memoizedProps);break;case 5:if(bn(a,i),wn(i),m&512&&(_t||c===null||hr(c,c.return)),i.flags&32){y=i.stateNode;try{Us(y,"")}catch(se){st(i,i.return,se)}}m&4&&i.stateNode!=null&&(y=i.memoizedProps,Uh(i,y,c!==null?c.memoizedProps:y)),m&1024&&($h=!0);break;case 6:if(bn(a,i),wn(i),m&4){if(i.stateNode===null)throw Error(r(162));m=i.memoizedProps,c=i.stateNode;try{c.nodeValue=m}catch(se){st(i,i.return,se)}}break;case 3:if(Tc=null,y=Zn,Zn=Ec(a.containerInfo),bn(a,i),Zn=y,wn(i),m&4&&c!==null&&c.memoizedState.isDehydrated)try{al(a.containerInfo)}catch(se){st(i,i.return,se)}$h&&($h=!1,Db(i));break;case 4:m=Zn,Zn=Ec(i.stateNode.containerInfo),bn(a,i),wn(i),Zn=m;break;case 12:bn(a,i),wn(i);break;case 13:bn(a,i),wn(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Kh=Et()),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,qh(i,m)));break;case 22:y=i.memoizedState!==null;var q=c!==null&&c.memoizedState!==null,re=Br,le=_t;if(Br=re||y,_t=le||q,bn(a,i),_t=le,Br=re,wn(i),m&8192)e:for(a=i.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(c===null||q||Br||_t||us(i)),c=null,a=i;;){if(a.tag===5||a.tag===26){if(c===null){q=c=a;try{if(x=q.stateNode,y)N=x.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none";else{L=q.stateNode;var fe=q.memoizedProps.style,ie=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;L.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(se){st(q,q.return,se)}}}else if(a.tag===6){if(c===null){q=a;try{q.stateNode.nodeValue=y?"":q.memoizedProps}catch(se){st(q,q.return,se)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}m&4&&(m=i.updateQueue,m!==null&&(c=m.retryQueue,c!==null&&(m.retryQueue=null,qh(i,c))));break;case 19:bn(a,i),wn(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,qh(i,m)));break;case 30:break;case 21:break;default:bn(a,i),wn(i)}}function wn(i){var a=i.flags;if(a&2){try{for(var c,m=i.return;m!==null;){if(kb(m)){c=m;break}m=m.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var y=c.stateNode,x=Hh(i);fc(i,x,y);break;case 5:var N=c.stateNode;c.flags&32&&(Us(N,""),c.flags&=-33);var L=Hh(i);fc(i,L,N);break;case 3:case 4:var q=c.stateNode.containerInfo,re=Hh(i);Fh(i,re,q);break;default:throw Error(r(161))}}catch(le){st(i,i.return,le)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function Db(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;Db(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function pi(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Ab(i,a.alternate,a),a=a.sibling}function us(i){for(i=i.child;i!==null;){var a=i;switch(a.tag){case 0:case 11:case 14:case 15:mi(4,a,a.return),us(a);break;case 1:hr(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&Sb(a,a.return,c),us(a);break;case 27:Wo(a.stateNode);case 26:case 5:hr(a,a.return),us(a);break;case 22:a.memoizedState===null&&us(a);break;case 30:us(a);break;default:us(a)}i=i.sibling}}function gi(i,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var m=a.alternate,y=i,x=a,N=x.flags;switch(x.tag){case 0:case 11:case 15:gi(y,x,c),Ho(4,x);break;case 1:if(gi(y,x,c),m=x,y=m.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(re){st(m,m.return,re)}if(m=x,y=m.updateQueue,y!==null){var L=m.stateNode;try{var q=y.shared.hiddenCallbacks;if(q!==null)for(y.shared.hiddenCallbacks=null,y=0;y<q.length;y++)lx(q[y],L)}catch(re){st(m,m.return,re)}}c&&N&64&&_b(x),Fo(x,x.return);break;case 27:Tb(x);case 26:case 5:gi(y,x,c),c&&m===null&&N&4&&Eb(x),Fo(x,x.return);break;case 12:gi(y,x,c);break;case 13:gi(y,x,c),c&&N&4&&Ob(y,x);break;case 22:x.memoizedState===null&&gi(y,x,c),Fo(x,x.return);break;case 30:break;default:gi(y,x,c)}a=a.sibling}}function Gh(i,a){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&Ao(c))}function Yh(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&Ao(i))}function mr(i,a,c,m){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)jb(i,a,c,m),a=a.sibling}function jb(i,a,c,m){var y=a.flags;switch(a.tag){case 0:case 11:case 15:mr(i,a,c,m),y&2048&&Ho(9,a);break;case 1:mr(i,a,c,m);break;case 3:mr(i,a,c,m),y&2048&&(i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&Ao(i)));break;case 12:if(y&2048){mr(i,a,c,m),i=a.stateNode;try{var x=a.memoizedProps,N=x.id,L=x.onPostCommit;typeof L=="function"&&L(N,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(q){st(a,a.return,q)}}else mr(i,a,c,m);break;case 13:mr(i,a,c,m);break;case 23:break;case 22:x=a.stateNode,N=a.alternate,a.memoizedState!==null?x._visibility&2?mr(i,a,c,m):$o(i,a):x._visibility&2?mr(i,a,c,m):(x._visibility|=2,aa(i,a,c,m,(a.subtreeFlags&10256)!==0)),y&2048&&Gh(N,a);break;case 24:mr(i,a,c,m),y&2048&&Yh(a.alternate,a);break;default:mr(i,a,c,m)}}function aa(i,a,c,m,y){for(y=y&&(a.subtreeFlags&10256)!==0,a=a.child;a!==null;){var x=i,N=a,L=c,q=m,re=N.flags;switch(N.tag){case 0:case 11:case 15:aa(x,N,L,q,y),Ho(8,N);break;case 23:break;case 22:var le=N.stateNode;N.memoizedState!==null?le._visibility&2?aa(x,N,L,q,y):$o(x,N):(le._visibility|=2,aa(x,N,L,q,y)),y&&re&2048&&Gh(N.alternate,N);break;case 24:aa(x,N,L,q,y),y&&re&2048&&Yh(N.alternate,N);break;default:aa(x,N,L,q,y)}a=a.sibling}}function $o(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=i,m=a,y=m.flags;switch(m.tag){case 22:$o(c,m),y&2048&&Gh(m.alternate,m);break;case 24:$o(c,m),y&2048&&Yh(m.alternate,m);break;default:$o(c,m)}a=a.sibling}}var qo=8192;function oa(i){if(i.subtreeFlags&qo)for(i=i.child;i!==null;)zb(i),i=i.sibling}function zb(i){switch(i.tag){case 26:oa(i),i.flags&qo&&i.memoizedState!==null&&aR(Zn,i.memoizedState,i.memoizedProps);break;case 5:oa(i);break;case 3:case 4:var a=Zn;Zn=Ec(i.stateNode.containerInfo),oa(i),Zn=a;break;case 22:i.memoizedState===null&&(a=i.alternate,a!==null&&a.memoizedState!==null?(a=qo,qo=16777216,oa(i),qo=a):oa(i));break;default:oa(i)}}function Lb(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function Go(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var m=a[c];Pt=m,Ib(m,i)}Lb(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Pb(i),i=i.sibling}function Pb(i){switch(i.tag){case 0:case 11:case 15:Go(i),i.flags&2048&&mi(9,i,i.return);break;case 3:Go(i);break;case 12:Go(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,dc(i)):Go(i);break;default:Go(i)}}function dc(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var m=a[c];Pt=m,Ib(m,i)}Lb(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:mi(8,a,a.return),dc(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,dc(a));break;default:dc(a)}i=i.sibling}}function Ib(i,a){for(;Pt!==null;){var c=Pt;switch(c.tag){case 0:case 11:case 15:mi(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var m=c.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Ao(c.memoizedState.cache)}if(m=c.child,m!==null)m.return=c,Pt=m;else e:for(c=i;Pt!==null;){m=Pt;var y=m.sibling,x=m.return;if(Nb(m),m===c){Pt=null;break e}if(y!==null){y.return=x,Pt=y;break e}Pt=x}}}var _O={getCacheForType:function(i){var a=Yt(Dt),c=a.data.get(i);return c===void 0&&(c=i(),a.data.set(i,c)),c}},SO=typeof WeakMap=="function"?WeakMap:Map,Je=0,lt=null,Ue=null,$e=0,et=0,_n=null,yi=!1,la=!1,Zh=!1,Hr=0,vt=0,vi=0,cs=0,Xh=0,Pn=0,ua=0,Yo=null,dn=null,Qh=!1,Kh=0,hc=1/0,mc=null,xi=null,Bt=0,bi=null,ca=null,fa=0,Wh=0,Jh=null,Vb=null,Zo=0,em=null;function Sn(){if((Je&2)!==0&&$e!==0)return $e&-$e;if(I.T!==null){var i=Ws;return i!==0?i:om()}return bu()}function Bb(){Pn===0&&(Pn=($e&536870912)===0||Ke?yu():536870912);var i=Ln.current;return i!==null&&(i.flags|=32),Pn}function En(i,a,c){(i===lt&&(et===2||et===9)||i.cancelPendingCommit!==null)&&(da(i,0),wi(i,$e,Pn,!1)),Zi(i,c),((Je&2)===0||i!==lt)&&(i===lt&&((Je&2)===0&&(cs|=c),vt===4&&wi(i,$e,Pn,!1)),pr(i))}function Ub(i,a,c){if((Je&6)!==0)throw Error(r(327));var m=!c&&(a&124)===0&&(a&i.expiredLanes)===0||an(i,a),y=m?TO(i,a):rm(i,a,!0),x=m;do{if(y===0){la&&!m&&wi(i,a,0,!1);break}else{if(c=i.current.alternate,x&&!EO(c)){y=rm(i,a,!1),x=!1;continue}if(y===2){if(x=a,i.errorRecoveryDisabledLanes&x)var N=0;else N=i.pendingLanes&-536870913,N=N!==0?N:N&536870912?536870912:0;if(N!==0){a=N;e:{var L=i;y=Yo;var q=L.current.memoizedState.isDehydrated;if(q&&(da(L,N).flags|=256),N=rm(L,N,!1),N!==2){if(Zh&&!q){L.errorRecoveryDisabledLanes|=x,cs|=x,y=4;break e}x=dn,dn=y,x!==null&&(dn===null?dn=x:dn.push.apply(dn,x))}y=N}if(x=!1,y!==2)continue}}if(y===1){da(i,0),wi(i,a,0,!0);break}e:{switch(m=i,x=y,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:wi(m,a,Pn,!yi);break e;case 2:dn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(y=Kh+300-Et(),10<y)){if(wi(m,a,Pn,!yi),kt(m,0,!0)!==0)break e;m.timeoutHandle=g1(Hb.bind(null,m,c,dn,mc,Qh,a,Pn,cs,ua,yi,x,2,-0,0),y);break e}Hb(m,c,dn,mc,Qh,a,Pn,cs,ua,yi,x,0,-0,0)}}break}while(!0);pr(i)}function Hb(i,a,c,m,y,x,N,L,q,re,le,fe,ie,se){if(i.timeoutHandle=-1,fe=a.subtreeFlags,(fe&8192||(fe&16785408)===16785408)&&(tl={stylesheets:null,count:0,unsuspend:sR},zb(a),fe=oR(),fe!==null)){i.cancelPendingCommit=fe(Xb.bind(null,i,a,x,c,m,y,N,L,q,le,1,ie,se)),wi(i,x,N,!re);return}Xb(i,a,x,c,m,y,N,L,q)}function EO(i){for(var a=i;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var m=0;m<c.length;m++){var y=c[m],x=y.getSnapshot;y=y.value;try{if(!vn(x(),y))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function wi(i,a,c,m){a&=~Xh,a&=~cs,i.suspendedLanes|=a,i.pingedLanes&=~a,m&&(i.warmLanes|=a),m=i.expirationTimes;for(var y=a;0<y;){var x=31-Te(y),N=1<<x;m[x]=-1,y&=~N}c!==0&&so(i,c,a)}function pc(){return(Je&6)===0?(Xo(0),!1):!0}function tm(){if(Ue!==null){if(et===0)var i=Ue.return;else i=Ue,jr=is=null,vh(i),ia=null,Vo=0,i=Ue;for(;i!==null;)wb(i.alternate,i),i=i.return;Ue=null}}function da(i,a){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,HO(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),tm(),lt=i,Ue=c=Or(i.current,null),$e=a,et=0,_n=null,yi=!1,la=an(i,a),Zh=!1,ua=Pn=Xh=cs=vi=vt=0,dn=Yo=null,Qh=!1,(a&8)!==0&&(a|=a&32);var m=i.entangledLanes;if(m!==0)for(i=i.entanglements,m&=a;0<m;){var y=31-Te(m),x=1<<y;a|=i[y],m&=~x}return Hr=a,Pu(),c}function Fb(i,a){Ie=null,I.H=nc,a===Mo||a===Gu?(a=ax(),et=3):a===rx?(a=ax(),et=4):et=a===ob?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,_n=a,Ue===null&&(vt=1,oc(i,Rn(a,i.current)))}function $b(){var i=I.H;return I.H=nc,i===null?nc:i}function qb(){var i=I.A;return I.A=_O,i}function nm(){vt=4,yi||($e&4194048)!==$e&&Ln.current!==null||(la=!0),(vi&134217727)===0&&(cs&134217727)===0||lt===null||wi(lt,$e,Pn,!1)}function rm(i,a,c){var m=Je;Je|=2;var y=$b(),x=qb();(lt!==i||$e!==a)&&(mc=null,da(i,a)),a=!1;var N=vt;e:do try{if(et!==0&&Ue!==null){var L=Ue,q=_n;switch(et){case 8:tm(),N=6;break e;case 3:case 2:case 9:case 6:Ln.current===null&&(a=!0);var re=et;if(et=0,_n=null,ha(i,L,q,re),c&&la){N=0;break e}break;default:re=et,et=0,_n=null,ha(i,L,q,re)}}kO(),N=vt;break}catch(le){Fb(i,le)}while(!0);return a&&i.shellSuspendCounter++,jr=is=null,Je=m,I.H=y,I.A=x,Ue===null&&(lt=null,$e=0,Pu()),N}function kO(){for(;Ue!==null;)Gb(Ue)}function TO(i,a){var c=Je;Je|=2;var m=$b(),y=qb();lt!==i||$e!==a?(mc=null,hc=Et()+500,da(i,a)):la=an(i,a);e:do try{if(et!==0&&Ue!==null){a=Ue;var x=_n;t:switch(et){case 1:et=0,_n=null,ha(i,a,x,1);break;case 2:case 9:if(ix(x)){et=0,_n=null,Yb(a);break}a=function(){et!==2&&et!==9||lt!==i||(et=7),pr(i)},x.then(a,a);break e;case 3:et=7;break e;case 4:et=5;break e;case 7:ix(x)?(et=0,_n=null,Yb(a)):(et=0,_n=null,ha(i,a,x,7));break;case 5:var N=null;switch(Ue.tag){case 26:N=Ue.memoizedState;case 5:case 27:var L=Ue;if(!N||A1(N)){et=0,_n=null;var q=L.sibling;if(q!==null)Ue=q;else{var re=L.return;re!==null?(Ue=re,gc(re)):Ue=null}break t}}et=0,_n=null,ha(i,a,x,5);break;case 6:et=0,_n=null,ha(i,a,x,6);break;case 8:tm(),vt=6;break e;default:throw Error(r(462))}}CO();break}catch(le){Fb(i,le)}while(!0);return jr=is=null,I.H=m,I.A=y,Je=c,Ue!==null?0:(lt=null,$e=0,Pu(),vt)}function CO(){for(;Ue!==null&&!ot();)Gb(Ue)}function Gb(i){var a=xb(i.alternate,i,Hr);i.memoizedProps=i.pendingProps,a===null?gc(i):Ue=a}function Yb(i){var a=i,c=a.alternate;switch(a.tag){case 15:case 0:a=hb(c,a,a.pendingProps,a.type,void 0,$e);break;case 11:a=hb(c,a,a.pendingProps,a.type.render,a.ref,$e);break;case 5:vh(a);default:wb(c,a),a=Ue=Zv(a,Hr),a=xb(c,a,Hr)}i.memoizedProps=i.pendingProps,a===null?gc(i):Ue=a}function ha(i,a,c,m){jr=is=null,vh(a),ia=null,Vo=0;var y=a.return;try{if(gO(i,y,a,c,$e)){vt=1,oc(i,Rn(c,i.current)),Ue=null;return}}catch(x){if(y!==null)throw Ue=y,x;vt=1,oc(i,Rn(c,i.current)),Ue=null;return}a.flags&32768?(Ke||m===1?i=!0:la||($e&536870912)!==0?i=!1:(yi=i=!0,(m===2||m===9||m===3||m===6)&&(m=Ln.current,m!==null&&m.tag===13&&(m.flags|=16384))),Zb(a,i)):gc(a)}function gc(i){var a=i;do{if((a.flags&32768)!==0){Zb(a,yi);return}i=a.return;var c=vO(a.alternate,a,Hr);if(c!==null){Ue=c;return}if(a=a.sibling,a!==null){Ue=a;return}Ue=a=i}while(a!==null);vt===0&&(vt=5)}function Zb(i,a){do{var c=xO(i.alternate,i);if(c!==null){c.flags&=32767,Ue=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(i=i.sibling,i!==null)){Ue=i;return}Ue=i=c}while(i!==null);vt=6,Ue=null}function Xb(i,a,c,m,y,x,N,L,q){i.cancelPendingCommit=null;do yc();while(Bt!==0);if((Je&6)!==0)throw Error(r(327));if(a!==null){if(a===i.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=Yd,wd(i,c,x,N,L,q),i===lt&&(Ue=lt=null,$e=0),ca=a,bi=i,fa=c,Wh=x,Jh=y,Vb=m,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,OO(or,function(){return e1(),null})):(i.callbackNode=null,i.callbackPriority=0),m=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||m){m=I.T,I.T=null,y=P.p,P.p=2,N=Je,Je|=4;try{bO(i,a,c)}finally{Je=N,P.p=y,I.T=m}}Bt=1,Qb(),Kb(),Wb()}}function Qb(){if(Bt===1){Bt=0;var i=bi,a=ca,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=I.T,I.T=null;var m=P.p;P.p=2;var y=Je;Je|=4;try{Rb(a,i);var x=pm,N=Iv(i.containerInfo),L=x.focusedElem,q=x.selectionRange;if(N!==L&&L&&L.ownerDocument&&Pv(L.ownerDocument.documentElement,L)){if(q!==null&&Hd(L)){var re=q.start,le=q.end;if(le===void 0&&(le=re),"selectionStart"in L)L.selectionStart=re,L.selectionEnd=Math.min(le,L.value.length);else{var fe=L.ownerDocument||document,ie=fe&&fe.defaultView||window;if(ie.getSelection){var se=ie.getSelection(),Oe=L.textContent.length,Ne=Math.min(q.start,Oe),it=q.end===void 0?Ne:Math.min(q.end,Oe);!se.extend&&Ne>it&&(N=it,it=Ne,Ne=N);var ee=Lv(L,Ne),K=Lv(L,it);if(ee&&K&&(se.rangeCount!==1||se.anchorNode!==ee.node||se.anchorOffset!==ee.offset||se.focusNode!==K.node||se.focusOffset!==K.offset)){var ne=fe.createRange();ne.setStart(ee.node,ee.offset),se.removeAllRanges(),Ne>it?(se.addRange(ne),se.extend(K.node,K.offset)):(ne.setEnd(K.node,K.offset),se.addRange(ne))}}}}for(fe=[],se=L;se=se.parentNode;)se.nodeType===1&&fe.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof L.focus=="function"&&L.focus(),L=0;L<fe.length;L++){var ue=fe[L];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}Nc=!!mm,pm=mm=null}finally{Je=y,P.p=m,I.T=c}}i.current=a,Bt=2}}function Kb(){if(Bt===2){Bt=0;var i=bi,a=ca,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=I.T,I.T=null;var m=P.p;P.p=2;var y=Je;Je|=4;try{Ab(i,a.alternate,a)}finally{Je=y,P.p=m,I.T=c}}Bt=3}}function Wb(){if(Bt===4||Bt===3){Bt=0,ft();var i=bi,a=ca,c=fa,m=Vb;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Bt=5:(Bt=0,ca=bi=null,Jb(i,i.pendingLanes));var y=i.pendingLanes;if(y===0&&(xi=null),oo(c),a=a.stateNode,de&&typeof de.onCommitFiberRoot=="function")try{de.onCommitFiberRoot(ae,a,void 0,(a.current.flags&128)===128)}catch{}if(m!==null){a=I.T,y=P.p,P.p=2,I.T=null;try{for(var x=i.onRecoverableError,N=0;N<m.length;N++){var L=m[N];x(L.value,{componentStack:L.stack})}}finally{I.T=a,P.p=y}}(fa&3)!==0&&yc(),pr(i),y=i.pendingLanes,(c&4194090)!==0&&(y&42)!==0?i===em?Zo++:(Zo=0,em=i):Zo=0,Xo(0)}}function Jb(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,Ao(a)))}function yc(i){return Qb(),Kb(),Wb(),e1()}function e1(){if(Bt!==5)return!1;var i=bi,a=Wh;Wh=0;var c=oo(fa),m=I.T,y=P.p;try{P.p=32>c?32:c,I.T=null,c=Jh,Jh=null;var x=bi,N=fa;if(Bt=0,ca=bi=null,fa=0,(Je&6)!==0)throw Error(r(331));var L=Je;if(Je|=4,Pb(x.current),jb(x,x.current,N,c),Je=L,Xo(0,!1),de&&typeof de.onPostCommitFiberRoot=="function")try{de.onPostCommitFiberRoot(ae,x)}catch{}return!0}finally{P.p=y,I.T=m,Jb(i,a)}}function t1(i,a,c){a=Rn(c,a),a=Rh(i.stateNode,a,2),i=ci(i,a,2),i!==null&&(Zi(i,2),pr(i))}function st(i,a,c){if(i.tag===3)t1(i,i,c);else for(;a!==null;){if(a.tag===3){t1(a,i,c);break}else if(a.tag===1){var m=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(xi===null||!xi.has(m))){i=Rn(c,i),c=sb(2),m=ci(a,c,2),m!==null&&(ab(c,m,a,i),Zi(m,2),pr(m));break}}a=a.return}}function im(i,a,c){var m=i.pingCache;if(m===null){m=i.pingCache=new SO;var y=new Set;m.set(a,y)}else y=m.get(a),y===void 0&&(y=new Set,m.set(a,y));y.has(c)||(Zh=!0,y.add(c),i=AO.bind(null,i,a,c),a.then(i,i))}function AO(i,a,c){var m=i.pingCache;m!==null&&m.delete(a),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,lt===i&&($e&c)===c&&(vt===4||vt===3&&($e&62914560)===$e&&300>Et()-Kh?(Je&2)===0&&da(i,0):Xh|=c,ua===$e&&(ua=0)),pr(i)}function n1(i,a){a===0&&(a=vu()),i=Zs(i,a),i!==null&&(Zi(i,a),pr(i))}function NO(i){var a=i.memoizedState,c=0;a!==null&&(c=a.retryLane),n1(i,c)}function MO(i,a){var c=0;switch(i.tag){case 13:var m=i.stateNode,y=i.memoizedState;y!==null&&(c=y.retryLane);break;case 19:m=i.stateNode;break;case 22:m=i.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(a),n1(i,c)}function OO(i,a){return je(i,a)}var vc=null,ma=null,sm=!1,xc=!1,am=!1,fs=0;function pr(i){i!==ma&&i.next===null&&(ma===null?vc=ma=i:ma=ma.next=i),xc=!0,sm||(sm=!0,DO())}function Xo(i,a){if(!am&&xc){am=!0;do for(var c=!1,m=vc;m!==null;){if(i!==0){var y=m.pendingLanes;if(y===0)var x=0;else{var N=m.suspendedLanes,L=m.pingedLanes;x=(1<<31-Te(42|i)+1)-1,x&=y&~(N&~L),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,a1(m,x))}else x=$e,x=kt(m,m===lt?x:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(x&3)===0||an(m,x)||(c=!0,a1(m,x));m=m.next}while(c);am=!1}}function RO(){r1()}function r1(){xc=sm=!1;var i=0;fs!==0&&(UO()&&(i=fs),fs=0);for(var a=Et(),c=null,m=vc;m!==null;){var y=m.next,x=i1(m,a);x===0?(m.next=null,c===null?vc=y:c.next=y,y===null&&(ma=c)):(c=m,(i!==0||(x&3)!==0)&&(xc=!0)),m=y}Xo(i)}function i1(i,a){for(var c=i.suspendedLanes,m=i.pingedLanes,y=i.expirationTimes,x=i.pendingLanes&-62914561;0<x;){var N=31-Te(x),L=1<<N,q=y[N];q===-1?((L&c)===0||(L&m)!==0)&&(y[N]=yn(L,a)):q<=a&&(i.expiredLanes|=L),x&=~L}if(a=lt,c=$e,c=kt(i,i===a?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m=i.callbackNode,c===0||i===a&&(et===2||et===9)||i.cancelPendingCommit!==null)return m!==null&&m!==null&&ze(m),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||an(i,c)){if(a=c&-c,a===i.callbackPriority)return a;switch(m!==null&&ze(m),oo(c)){case 2:case 8:c=$n;break;case 32:c=or;break;case 268435456:c=lr;break;default:c=or}return m=s1.bind(null,i),c=je(c,m),i.callbackPriority=a,i.callbackNode=c,a}return m!==null&&m!==null&&ze(m),i.callbackPriority=2,i.callbackNode=null,2}function s1(i,a){if(Bt!==0&&Bt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(yc()&&i.callbackNode!==c)return null;var m=$e;return m=kt(i,i===lt?m:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m===0?null:(Ub(i,m,a),i1(i,Et()),i.callbackNode!=null&&i.callbackNode===c?s1.bind(null,i):null)}function a1(i,a){if(yc())return null;Ub(i,a,!0)}function DO(){FO(function(){(Je&6)!==0?je(kr,RO):r1()})}function om(){return fs===0&&(fs=yu()),fs}function o1(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Mu(""+i)}function l1(i,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,i.id&&c.setAttribute("form",i.id),a.parentNode.insertBefore(c,a),i=new FormData(i),c.parentNode.removeChild(c),i}function jO(i,a,c,m,y){if(a==="submit"&&c&&c.stateNode===y){var x=o1((y[Gt]||null).action),N=m.submitter;N&&(a=(a=N[Gt]||null)?o1(a.formAction):N.getAttribute("formAction"),a!==null&&(x=a,N=null));var L=new ju("action","action",null,m,y);i.push({event:L,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(fs!==0){var q=N?l1(y,N):new FormData(y);Ch(c,{pending:!0,data:q,method:y.method,action:x},null,q)}}else typeof x=="function"&&(L.preventDefault(),q=N?l1(y,N):new FormData(y),Ch(c,{pending:!0,data:q,method:y.method,action:x},x,q))},currentTarget:y}]})}}for(var lm=0;lm<Gd.length;lm++){var um=Gd[lm],zO=um.toLowerCase(),LO=um[0].toUpperCase()+um.slice(1);Yn(zO,"on"+LO)}Yn(Uv,"onAnimationEnd"),Yn(Hv,"onAnimationIteration"),Yn(Fv,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(JM,"onTransitionRun"),Yn(eO,"onTransitionStart"),Yn(tO,"onTransitionCancel"),Yn($v,"onTransitionEnd"),ri("onMouseEnter",["mouseout","mouseover"]),ri("onMouseLeave",["mouseout","mouseover"]),ri("onPointerEnter",["pointerout","pointerover"]),ri("onPointerLeave",["pointerout","pointerover"]),Nr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Nr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Nr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Nr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Nr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Nr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),PO=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qo));function u1(i,a){a=(a&4)!==0;for(var c=0;c<i.length;c++){var m=i[c],y=m.event;m=m.listeners;e:{var x=void 0;if(a)for(var N=m.length-1;0<=N;N--){var L=m[N],q=L.instance,re=L.currentTarget;if(L=L.listener,q!==x&&y.isPropagationStopped())break e;x=L,y.currentTarget=re;try{x(y)}catch(le){ac(le)}y.currentTarget=null,x=q}else for(N=0;N<m.length;N++){if(L=m[N],q=L.instance,re=L.currentTarget,L=L.listener,q!==x&&y.isPropagationStopped())break e;x=L,y.currentTarget=re;try{x(y)}catch(le){ac(le)}y.currentTarget=null,x=q}}}}function He(i,a){var c=a[lo];c===void 0&&(c=a[lo]=new Set);var m=i+"__bubble";c.has(m)||(c1(a,i,2,!1),c.add(m))}function cm(i,a,c){var m=0;a&&(m|=4),c1(c,i,m,a)}var bc="_reactListening"+Math.random().toString(36).slice(2);function fm(i){if(!i[bc]){i[bc]=!0,_u.forEach(function(c){c!=="selectionchange"&&(PO.has(c)||cm(c,!1,i),cm(c,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[bc]||(a[bc]=!0,cm("selectionchange",!1,a))}}function c1(i,a,c,m){switch(j1(a)){case 2:var y=cR;break;case 8:y=fR;break;default:y=km}c=y.bind(null,a,c,i),y=void 0,!Dd||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),m?y!==void 0?i.addEventListener(a,c,{capture:!0,passive:y}):i.addEventListener(a,c,!0):y!==void 0?i.addEventListener(a,c,{passive:y}):i.addEventListener(a,c,!1)}function dm(i,a,c,m,y){var x=m;if((a&1)===0&&(a&2)===0&&m!==null)e:for(;;){if(m===null)return;var N=m.tag;if(N===3||N===4){var L=m.stateNode.containerInfo;if(L===y)break;if(N===4)for(N=m.return;N!==null;){var q=N.tag;if((q===3||q===4)&&N.stateNode.containerInfo===y)return;N=N.return}for(;L!==null;){if(N=Cr(L),N===null)return;if(q=N.tag,q===5||q===6||q===26||q===27){m=x=N;continue e}L=L.parentNode}}m=m.return}yv(function(){var re=x,le=Od(c),fe=[];e:{var ie=qv.get(i);if(ie!==void 0){var se=ju,Oe=i;switch(i){case"keypress":if(Ru(c)===0)break e;case"keydown":case"keyup":se=OM;break;case"focusin":Oe="focus",se=Pd;break;case"focusout":Oe="blur",se=Pd;break;case"beforeblur":case"afterblur":se=Pd;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=bv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=xM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=jM;break;case Uv:case Hv:case Fv:se=_M;break;case $v:se=LM;break;case"scroll":case"scrollend":se=yM;break;case"wheel":se=IM;break;case"copy":case"cut":case"paste":se=EM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=_v;break;case"toggle":case"beforetoggle":se=BM}var Ne=(a&4)!==0,it=!Ne&&(i==="scroll"||i==="scrollend"),ee=Ne?ie!==null?ie+"Capture":null:ie;Ne=[];for(var K=re,ne;K!==null;){var ue=K;if(ne=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||ne===null||ee===null||(ue=po(K,ee),ue!=null&&Ne.push(Ko(K,ue,ne))),it)break;K=K.return}0<Ne.length&&(ie=new se(ie,Oe,null,c,le),fe.push({event:ie,listeners:Ne}))}}if((a&7)===0){e:{if(ie=i==="mouseover"||i==="pointerover",se=i==="mouseout"||i==="pointerout",ie&&c!==Md&&(Oe=c.relatedTarget||c.fromElement)&&(Cr(Oe)||Oe[ei]))break e;if((se||ie)&&(ie=le.window===le?le:(ie=le.ownerDocument)?ie.defaultView||ie.parentWindow:window,se?(Oe=c.relatedTarget||c.toElement,se=re,Oe=Oe?Cr(Oe):null,Oe!==null&&(it=o(Oe),Ne=Oe.tag,Oe!==it||Ne!==5&&Ne!==27&&Ne!==6)&&(Oe=null)):(se=null,Oe=re),se!==Oe)){if(Ne=bv,ue="onMouseLeave",ee="onMouseEnter",K="mouse",(i==="pointerout"||i==="pointerover")&&(Ne=_v,ue="onPointerLeave",ee="onPointerEnter",K="pointer"),it=se==null?ie:ti(se),ne=Oe==null?ie:ti(Oe),ie=new Ne(ue,K+"leave",se,c,le),ie.target=it,ie.relatedTarget=ne,ue=null,Cr(le)===re&&(Ne=new Ne(ee,K+"enter",Oe,c,le),Ne.target=ne,Ne.relatedTarget=it,ue=Ne),it=ue,se&&Oe)t:{for(Ne=se,ee=Oe,K=0,ne=Ne;ne;ne=pa(ne))K++;for(ne=0,ue=ee;ue;ue=pa(ue))ne++;for(;0<K-ne;)Ne=pa(Ne),K--;for(;0<ne-K;)ee=pa(ee),ne--;for(;K--;){if(Ne===ee||ee!==null&&Ne===ee.alternate)break t;Ne=pa(Ne),ee=pa(ee)}Ne=null}else Ne=null;se!==null&&f1(fe,ie,se,Ne,!1),Oe!==null&&it!==null&&f1(fe,it,Oe,Ne,!0)}}e:{if(ie=re?ti(re):window,se=ie.nodeName&&ie.nodeName.toLowerCase(),se==="select"||se==="input"&&ie.type==="file")var xe=Mv;else if(Av(ie))if(Ov)xe=QM;else{xe=ZM;var Ve=YM}else se=ie.nodeName,!se||se.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?re&&Nd(re.elementType)&&(xe=Mv):xe=XM;if(xe&&(xe=xe(i,re))){Nv(fe,xe,c,le);break e}Ve&&Ve(i,ie,re),i==="focusout"&&re&&ie.type==="number"&&re.memoizedProps.value!=null&&Ad(ie,"number",ie.value)}switch(Ve=re?ti(re):window,i){case"focusin":(Av(Ve)||Ve.contentEditable==="true")&&(qs=Ve,Fd=re,So=null);break;case"focusout":So=Fd=qs=null;break;case"mousedown":$d=!0;break;case"contextmenu":case"mouseup":case"dragend":$d=!1,Vv(fe,c,le);break;case"selectionchange":if(WM)break;case"keydown":case"keyup":Vv(fe,c,le)}var Se;if(Vd)e:{switch(i){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else $s?Tv(i,c)&&(Me="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(Me="onCompositionStart");Me&&(Sv&&c.locale!=="ko"&&($s||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&$s&&(Se=vv()):(ai=le,jd="value"in ai?ai.value:ai.textContent,$s=!0)),Ve=wc(re,Me),0<Ve.length&&(Me=new wv(Me,i,null,c,le),fe.push({event:Me,listeners:Ve}),Se?Me.data=Se:(Se=Cv(c),Se!==null&&(Me.data=Se)))),(Se=HM?FM(i,c):$M(i,c))&&(Me=wc(re,"onBeforeInput"),0<Me.length&&(Ve=new wv("onBeforeInput","beforeinput",null,c,le),fe.push({event:Ve,listeners:Me}),Ve.data=Se)),jO(fe,i,re,c,le)}u1(fe,a)})}function Ko(i,a,c){return{instance:i,listener:a,currentTarget:c}}function wc(i,a){for(var c=a+"Capture",m=[];i!==null;){var y=i,x=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||x===null||(y=po(i,c),y!=null&&m.unshift(Ko(i,y,x)),y=po(i,a),y!=null&&m.push(Ko(i,y,x))),i.tag===3)return m;i=i.return}return[]}function pa(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function f1(i,a,c,m,y){for(var x=a._reactName,N=[];c!==null&&c!==m;){var L=c,q=L.alternate,re=L.stateNode;if(L=L.tag,q!==null&&q===m)break;L!==5&&L!==26&&L!==27||re===null||(q=re,y?(re=po(c,x),re!=null&&N.unshift(Ko(c,re,q))):y||(re=po(c,x),re!=null&&N.push(Ko(c,re,q)))),c=c.return}N.length!==0&&i.push({event:a,listeners:N})}var IO=/\r\n?/g,VO=/\u0000|\uFFFD/g;function d1(i){return(typeof i=="string"?i:""+i).replace(IO,`
|
|
49
|
+
`).replace(VO,"")}function h1(i,a){return a=d1(a),d1(i)===a}function _c(){}function rt(i,a,c,m,y,x){switch(c){case"children":typeof m=="string"?a==="body"||a==="textarea"&&m===""||Us(i,m):(typeof m=="number"||typeof m=="bigint")&&a!=="body"&&Us(i,""+m);break;case"className":Ls(i,"class",m);break;case"tabIndex":Ls(i,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Ls(i,c,m);break;case"style":pv(i,m,x);break;case"data":if(a!=="object"){Ls(i,"data",m);break}case"src":case"href":if(m===""&&(a!=="a"||c!=="href")){i.removeAttribute(c);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(c);break}m=Mu(""+m),i.setAttribute(c,m);break;case"action":case"formAction":if(typeof m=="function"){i.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(c==="formAction"?(a!=="input"&&rt(i,a,"name",y.name,y,null),rt(i,a,"formEncType",y.formEncType,y,null),rt(i,a,"formMethod",y.formMethod,y,null),rt(i,a,"formTarget",y.formTarget,y,null)):(rt(i,a,"encType",y.encType,y,null),rt(i,a,"method",y.method,y,null),rt(i,a,"target",y.target,y,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(c);break}m=Mu(""+m),i.setAttribute(c,m);break;case"onClick":m!=null&&(i.onclick=_c);break;case"onScroll":m!=null&&He("scroll",i);break;case"onScrollEnd":m!=null&&He("scrollend",i);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(c=m.__html,c!=null){if(y.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"multiple":i.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":i.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){i.removeAttribute("xlink:href");break}c=Mu(""+m),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,""+m):i.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":m&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":m===!0?i.setAttribute(c,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,m):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?i.setAttribute(c,m):i.removeAttribute(c);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?i.removeAttribute(c):i.setAttribute(c,m);break;case"popover":He("beforetoggle",i),He("toggle",i),zs(i,"popover",m);break;case"xlinkActuate":Gn(i,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":Gn(i,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":Gn(i,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":Gn(i,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":Gn(i,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":Gn(i,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":Gn(i,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":Gn(i,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":Gn(i,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":zs(i,"is",m);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=pM.get(c)||c,zs(i,c,m))}}function hm(i,a,c,m,y,x){switch(c){case"style":pv(i,m,x);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(c=m.__html,c!=null){if(y.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"children":typeof m=="string"?Us(i,m):(typeof m=="number"||typeof m=="bigint")&&Us(i,""+m);break;case"onScroll":m!=null&&He("scroll",i);break;case"onScrollEnd":m!=null&&He("scrollend",i);break;case"onClick":m!=null&&(i.onclick=_c);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Su.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(y=c.endsWith("Capture"),a=c.slice(2,y?c.length-7:void 0),x=i[Gt]||null,x=x!=null?x[c]:null,typeof x=="function"&&i.removeEventListener(a,x,y),typeof m=="function")){typeof x!="function"&&x!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(a,m,y);break e}c in i?i[c]=m:m===!0?i.setAttribute(c,""):zs(i,c,m)}}}function Ut(i,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":He("error",i),He("load",i);var m=!1,y=!1,x;for(x in c)if(c.hasOwnProperty(x)){var N=c[x];if(N!=null)switch(x){case"src":m=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:rt(i,a,x,N,c,null)}}y&&rt(i,a,"srcSet",c.srcSet,c,null),m&&rt(i,a,"src",c.src,c,null);return;case"input":He("invalid",i);var L=x=N=y=null,q=null,re=null;for(m in c)if(c.hasOwnProperty(m)){var le=c[m];if(le!=null)switch(m){case"name":y=le;break;case"type":N=le;break;case"checked":q=le;break;case"defaultChecked":re=le;break;case"value":x=le;break;case"defaultValue":L=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,a));break;default:rt(i,a,m,le,c,null)}}fv(i,x,L,q,re,N,y,!1),Is(i);return;case"select":He("invalid",i),m=N=x=null;for(y in c)if(c.hasOwnProperty(y)&&(L=c[y],L!=null))switch(y){case"value":x=L;break;case"defaultValue":N=L;break;case"multiple":m=L;default:rt(i,a,y,L,c,null)}a=x,c=N,i.multiple=!!m,a!=null?Bs(i,!!m,a,!1):c!=null&&Bs(i,!!m,c,!0);return;case"textarea":He("invalid",i),x=y=m=null;for(N in c)if(c.hasOwnProperty(N)&&(L=c[N],L!=null))switch(N){case"value":m=L;break;case"defaultValue":y=L;break;case"children":x=L;break;case"dangerouslySetInnerHTML":if(L!=null)throw Error(r(91));break;default:rt(i,a,N,L,c,null)}hv(i,m,y,x),Is(i);return;case"option":for(q in c)if(c.hasOwnProperty(q)&&(m=c[q],m!=null))switch(q){case"selected":i.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:rt(i,a,q,m,c,null)}return;case"dialog":He("beforetoggle",i),He("toggle",i),He("cancel",i),He("close",i);break;case"iframe":case"object":He("load",i);break;case"video":case"audio":for(m=0;m<Qo.length;m++)He(Qo[m],i);break;case"image":He("error",i),He("load",i);break;case"details":He("toggle",i);break;case"embed":case"source":case"link":He("error",i),He("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(re in c)if(c.hasOwnProperty(re)&&(m=c[re],m!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:rt(i,a,re,m,c,null)}return;default:if(Nd(a)){for(le in c)c.hasOwnProperty(le)&&(m=c[le],m!==void 0&&hm(i,a,le,m,c,void 0));return}}for(L in c)c.hasOwnProperty(L)&&(m=c[L],m!=null&&rt(i,a,L,m,c,null))}function BO(i,a,c,m){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,x=null,N=null,L=null,q=null,re=null,le=null;for(se in c){var fe=c[se];if(c.hasOwnProperty(se)&&fe!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":q=fe;default:m.hasOwnProperty(se)||rt(i,a,se,null,m,fe)}}for(var ie in m){var se=m[ie];if(fe=c[ie],m.hasOwnProperty(ie)&&(se!=null||fe!=null))switch(ie){case"type":x=se;break;case"name":y=se;break;case"checked":re=se;break;case"defaultChecked":le=se;break;case"value":N=se;break;case"defaultValue":L=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,a));break;default:se!==fe&&rt(i,a,ie,se,m,fe)}}Vs(i,N,L,q,re,le,x,y);return;case"select":se=N=L=ie=null;for(x in c)if(q=c[x],c.hasOwnProperty(x)&&q!=null)switch(x){case"value":break;case"multiple":se=q;default:m.hasOwnProperty(x)||rt(i,a,x,null,m,q)}for(y in m)if(x=m[y],q=c[y],m.hasOwnProperty(y)&&(x!=null||q!=null))switch(y){case"value":ie=x;break;case"defaultValue":L=x;break;case"multiple":N=x;default:x!==q&&rt(i,a,y,x,m,q)}a=L,c=N,m=se,ie!=null?Bs(i,!!c,ie,!1):!!m!=!!c&&(a!=null?Bs(i,!!c,a,!0):Bs(i,!!c,c?[]:"",!1));return;case"textarea":se=ie=null;for(L in c)if(y=c[L],c.hasOwnProperty(L)&&y!=null&&!m.hasOwnProperty(L))switch(L){case"value":break;case"children":break;default:rt(i,a,L,null,m,y)}for(N in m)if(y=m[N],x=c[N],m.hasOwnProperty(N)&&(y!=null||x!=null))switch(N){case"value":ie=y;break;case"defaultValue":se=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:y!==x&&rt(i,a,N,y,m,x)}dv(i,ie,se);return;case"option":for(var Oe in c)if(ie=c[Oe],c.hasOwnProperty(Oe)&&ie!=null&&!m.hasOwnProperty(Oe))switch(Oe){case"selected":i.selected=!1;break;default:rt(i,a,Oe,null,m,ie)}for(q in m)if(ie=m[q],se=c[q],m.hasOwnProperty(q)&&ie!==se&&(ie!=null||se!=null))switch(q){case"selected":i.selected=ie&&typeof ie!="function"&&typeof ie!="symbol";break;default:rt(i,a,q,ie,m,se)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ne in c)ie=c[Ne],c.hasOwnProperty(Ne)&&ie!=null&&!m.hasOwnProperty(Ne)&&rt(i,a,Ne,null,m,ie);for(re in m)if(ie=m[re],se=c[re],m.hasOwnProperty(re)&&ie!==se&&(ie!=null||se!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,a));break;default:rt(i,a,re,ie,m,se)}return;default:if(Nd(a)){for(var it in c)ie=c[it],c.hasOwnProperty(it)&&ie!==void 0&&!m.hasOwnProperty(it)&&hm(i,a,it,void 0,m,ie);for(le in m)ie=m[le],se=c[le],!m.hasOwnProperty(le)||ie===se||ie===void 0&&se===void 0||hm(i,a,le,ie,m,se);return}}for(var ee in c)ie=c[ee],c.hasOwnProperty(ee)&&ie!=null&&!m.hasOwnProperty(ee)&&rt(i,a,ee,null,m,ie);for(fe in m)ie=m[fe],se=c[fe],!m.hasOwnProperty(fe)||ie===se||ie==null&&se==null||rt(i,a,fe,ie,m,se)}var mm=null,pm=null;function Sc(i){return i.nodeType===9?i:i.ownerDocument}function m1(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function p1(i,a){if(i===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&a==="foreignObject"?0:i}function gm(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var ym=null;function UO(){var i=window.event;return i&&i.type==="popstate"?i===ym?!1:(ym=i,!0):(ym=null,!1)}var g1=typeof setTimeout=="function"?setTimeout:void 0,HO=typeof clearTimeout=="function"?clearTimeout:void 0,y1=typeof Promise=="function"?Promise:void 0,FO=typeof queueMicrotask=="function"?queueMicrotask:typeof y1<"u"?function(i){return y1.resolve(null).then(i).catch($O)}:g1;function $O(i){setTimeout(function(){throw i})}function _i(i){return i==="head"}function v1(i,a){var c=a,m=0,y=0;do{var x=c.nextSibling;if(i.removeChild(c),x&&x.nodeType===8)if(c=x.data,c==="/$"){if(0<m&&8>m){c=m;var N=i.ownerDocument;if(c&1&&Wo(N.documentElement),c&2&&Wo(N.body),c&4)for(c=N.head,Wo(c),N=c.firstChild;N;){var L=N.nextSibling,q=N.nodeName;N[Xi]||q==="SCRIPT"||q==="STYLE"||q==="LINK"&&N.rel.toLowerCase()==="stylesheet"||c.removeChild(N),N=L}}if(y===0){i.removeChild(x),al(a);return}y--}else c==="$"||c==="$?"||c==="$!"?y++:m=c.charCodeAt(0)-48;else m=0;c=x}while(c);al(a)}function vm(i){var a=i.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":vm(c),uo(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function qO(i,a,c,m){for(;i.nodeType===1;){var y=c;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!m&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(m){if(!i[Xi])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(x=i.getAttribute("rel"),x==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(x!==y.rel||i.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||i.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||i.getAttribute("title")!==(y.title==null?null:y.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(x=i.getAttribute("src"),(x!==(y.src==null?null:y.src)||i.getAttribute("type")!==(y.type==null?null:y.type)||i.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&x&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var x=y.name==null?null:""+y.name;if(y.type==="hidden"&&i.getAttribute("name")===x)return i}else return i;if(i=Xn(i.nextSibling),i===null)break}return null}function GO(i,a,c){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=Xn(i.nextSibling),i===null))return null;return i}function xm(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState==="complete"}function YO(i,a){var c=i.ownerDocument;if(i.data!=="$?"||c.readyState==="complete")a();else{var m=function(){a(),c.removeEventListener("DOMContentLoaded",m)};c.addEventListener("DOMContentLoaded",m),i._reactRetry=m}}function Xn(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?"||a==="F!"||a==="F")break;if(a==="/$")return null}}return i}var bm=null;function x1(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"){if(a===0)return i;a--}else c==="/$"&&a++}i=i.previousSibling}return null}function b1(i,a,c){switch(a=Sc(c),i){case"html":if(i=a.documentElement,!i)throw Error(r(452));return i;case"head":if(i=a.head,!i)throw Error(r(453));return i;case"body":if(i=a.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function Wo(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);uo(i)}var In=new Map,w1=new Set;function Ec(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Fr=P.d;P.d={f:ZO,r:XO,D:QO,C:KO,L:WO,m:JO,X:tR,S:eR,M:nR};function ZO(){var i=Fr.f(),a=pc();return i||a}function XO(i){var a=Ar(i);a!==null&&a.tag===5&&a.type==="form"?Ux(a):Fr.r(i)}var ga=typeof document>"u"?null:document;function _1(i,a,c){var m=ga;if(m&&typeof a=="string"&&a){var y=ln(a);y='link[rel="'+i+'"][href="'+y+'"]',typeof c=="string"&&(y+='[crossorigin="'+c+'"]'),w1.has(y)||(w1.add(y),i={rel:i,crossOrigin:c,href:a},m.querySelector(y)===null&&(a=m.createElement("link"),Ut(a,"link",i),Tt(a),m.head.appendChild(a)))}}function QO(i){Fr.D(i),_1("dns-prefetch",i,null)}function KO(i,a){Fr.C(i,a),_1("preconnect",i,a)}function WO(i,a,c){Fr.L(i,a,c);var m=ga;if(m&&i&&a){var y='link[rel="preload"][as="'+ln(a)+'"]';a==="image"&&c&&c.imageSrcSet?(y+='[imagesrcset="'+ln(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(y+='[imagesizes="'+ln(c.imageSizes)+'"]')):y+='[href="'+ln(i)+'"]';var x=y;switch(a){case"style":x=ya(i);break;case"script":x=va(i)}In.has(x)||(i=h({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:i,as:a},c),In.set(x,i),m.querySelector(y)!==null||a==="style"&&m.querySelector(Jo(x))||a==="script"&&m.querySelector(el(x))||(a=m.createElement("link"),Ut(a,"link",i),Tt(a),m.head.appendChild(a)))}}function JO(i,a){Fr.m(i,a);var c=ga;if(c&&i){var m=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+ln(m)+'"][href="'+ln(i)+'"]',x=y;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=va(i)}if(!In.has(x)&&(i=h({rel:"modulepreload",href:i},a),In.set(x,i),c.querySelector(y)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(el(x)))return}m=c.createElement("link"),Ut(m,"link",i),Tt(m),c.head.appendChild(m)}}}function eR(i,a,c){Fr.S(i,a,c);var m=ga;if(m&&i){var y=ni(m).hoistableStyles,x=ya(i);a=a||"default";var N=y.get(x);if(!N){var L={loading:0,preload:null};if(N=m.querySelector(Jo(x)))L.loading=5;else{i=h({rel:"stylesheet",href:i,"data-precedence":a},c),(c=In.get(x))&&wm(i,c);var q=N=m.createElement("link");Tt(q),Ut(q,"link",i),q._p=new Promise(function(re,le){q.onload=re,q.onerror=le}),q.addEventListener("load",function(){L.loading|=1}),q.addEventListener("error",function(){L.loading|=2}),L.loading|=4,kc(N,a,m)}N={type:"stylesheet",instance:N,count:1,state:L},y.set(x,N)}}}function tR(i,a){Fr.X(i,a);var c=ga;if(c&&i){var m=ni(c).hoistableScripts,y=va(i),x=m.get(y);x||(x=c.querySelector(el(y)),x||(i=h({src:i,async:!0},a),(a=In.get(y))&&_m(i,a),x=c.createElement("script"),Tt(x),Ut(x,"link",i),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},m.set(y,x))}}function nR(i,a){Fr.M(i,a);var c=ga;if(c&&i){var m=ni(c).hoistableScripts,y=va(i),x=m.get(y);x||(x=c.querySelector(el(y)),x||(i=h({src:i,async:!0,type:"module"},a),(a=In.get(y))&&_m(i,a),x=c.createElement("script"),Tt(x),Ut(x,"link",i),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},m.set(y,x))}}function S1(i,a,c,m){var y=(y=J.current)?Ec(y):null;if(!y)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=ya(c.href),c=ni(y).hoistableStyles,m=c.get(a),m||(m={type:"style",instance:null,count:0,state:null},c.set(a,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=ya(c.href);var x=ni(y).hoistableStyles,N=x.get(i);if(N||(y=y.ownerDocument||y,N={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(i,N),(x=y.querySelector(Jo(i)))&&!x._p&&(N.instance=x,N.state.loading=5),In.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},In.set(i,c),x||rR(y,i,c,N.state))),a&&m===null)throw Error(r(528,""));return N}if(a&&m!==null)throw Error(r(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=va(c),c=ni(y).hoistableScripts,m=c.get(a),m||(m={type:"script",instance:null,count:0,state:null},c.set(a,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function ya(i){return'href="'+ln(i)+'"'}function Jo(i){return'link[rel="stylesheet"]['+i+"]"}function E1(i){return h({},i,{"data-precedence":i.precedence,precedence:null})}function rR(i,a,c,m){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?m.loading=1:(a=i.createElement("link"),m.preload=a,a.addEventListener("load",function(){return m.loading|=1}),a.addEventListener("error",function(){return m.loading|=2}),Ut(a,"link",c),Tt(a),i.head.appendChild(a))}function va(i){return'[src="'+ln(i)+'"]'}function el(i){return"script[async]"+i}function k1(i,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var m=i.querySelector('style[data-href~="'+ln(c.href)+'"]');if(m)return a.instance=m,Tt(m),m;var y=h({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return m=(i.ownerDocument||i).createElement("style"),Tt(m),Ut(m,"style",y),kc(m,c.precedence,i),a.instance=m;case"stylesheet":y=ya(c.href);var x=i.querySelector(Jo(y));if(x)return a.state.loading|=4,a.instance=x,Tt(x),x;m=E1(c),(y=In.get(y))&&wm(m,y),x=(i.ownerDocument||i).createElement("link"),Tt(x);var N=x;return N._p=new Promise(function(L,q){N.onload=L,N.onerror=q}),Ut(x,"link",m),a.state.loading|=4,kc(x,c.precedence,i),a.instance=x;case"script":return x=va(c.src),(y=i.querySelector(el(x)))?(a.instance=y,Tt(y),y):(m=c,(y=In.get(x))&&(m=h({},c),_m(m,y)),i=i.ownerDocument||i,y=i.createElement("script"),Tt(y),Ut(y,"link",m),i.head.appendChild(y),a.instance=y);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(m=a.instance,a.state.loading|=4,kc(m,c.precedence,i));return a.instance}function kc(i,a,c){for(var m=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=m.length?m[m.length-1]:null,x=y,N=0;N<m.length;N++){var L=m[N];if(L.dataset.precedence===a)x=L;else if(x!==y)break}x?x.parentNode.insertBefore(i,x.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(i,a.firstChild))}function wm(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function _m(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var Tc=null;function T1(i,a,c){if(Tc===null){var m=new Map,y=Tc=new Map;y.set(c,m)}else y=Tc,m=y.get(c),m||(m=new Map,y.set(c,m));if(m.has(i))return m;for(m.set(i,null),c=c.getElementsByTagName(i),y=0;y<c.length;y++){var x=c[y];if(!(x[Xi]||x[zt]||i==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var N=x.getAttribute(a)||"";N=i+N;var L=m.get(N);L?L.push(x):m.set(N,[x])}}return m}function C1(i,a,c){i=i.ownerDocument||i,i.head.insertBefore(c,a==="title"?i.querySelector("head > title"):null)}function iR(i,a,c){if(c===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return i=a.disabled,typeof a.precedence=="string"&&i==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function A1(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}var tl=null;function sR(){}function aR(i,a,c){if(tl===null)throw Error(r(475));var m=tl;if(a.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var y=ya(c.href),x=i.querySelector(Jo(y));if(x){i=x._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(m.count++,m=Cc.bind(m),i.then(m,m)),a.state.loading|=4,a.instance=x,Tt(x);return}x=i.ownerDocument||i,c=E1(c),(y=In.get(y))&&wm(c,y),x=x.createElement("link"),Tt(x);var N=x;N._p=new Promise(function(L,q){N.onload=L,N.onerror=q}),Ut(x,"link",c),a.instance=x}m.stylesheets===null&&(m.stylesheets=new Map),m.stylesheets.set(a,i),(i=a.state.preload)&&(a.state.loading&3)===0&&(m.count++,a=Cc.bind(m),i.addEventListener("load",a),i.addEventListener("error",a))}}function oR(){if(tl===null)throw Error(r(475));var i=tl;return i.stylesheets&&i.count===0&&Sm(i,i.stylesheets),0<i.count?function(a){var c=setTimeout(function(){if(i.stylesheets&&Sm(i,i.stylesheets),i.unsuspend){var m=i.unsuspend;i.unsuspend=null,m()}},6e4);return i.unsuspend=a,function(){i.unsuspend=null,clearTimeout(c)}}:null}function Cc(){if(this.count--,this.count===0){if(this.stylesheets)Sm(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Ac=null;function Sm(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Ac=new Map,a.forEach(lR,i),Ac=null,Cc.call(i))}function lR(i,a){if(!(a.state.loading&4)){var c=Ac.get(i);if(c)var m=c.get(null);else{c=new Map,Ac.set(i,c);for(var y=i.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<y.length;x++){var N=y[x];(N.nodeName==="LINK"||N.getAttribute("media")!=="not all")&&(c.set(N.dataset.precedence,N),m=N)}m&&c.set(null,m)}y=a.instance,N=y.getAttribute("data-precedence"),x=c.get(N)||m,x===m&&c.set(null,y),c.set(N,y),this.count++,m=Cc.bind(this),y.addEventListener("load",m),y.addEventListener("error",m),x?x.parentNode.insertBefore(y,x.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(y,i.firstChild)),a.state.loading|=4}}var nl={$$typeof:S,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function uR(i,a,c,m,y,x,N,L){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=io(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=io(0),this.hiddenUpdates=io(null),this.identifierPrefix=m,this.onUncaughtError=y,this.onCaughtError=x,this.onRecoverableError=N,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function N1(i,a,c,m,y,x,N,L,q,re,le,fe){return i=new uR(i,a,c,N,L,q,re,fe),a=1,x===!0&&(a|=24),x=xn(3,null,null,a),i.current=x,x.stateNode=i,a=ih(),a.refCount++,i.pooledCache=a,a.refCount++,x.memoizedState={element:m,isDehydrated:c,cache:a},lh(x),i}function M1(i){return i?(i=Xs,i):Xs}function O1(i,a,c,m,y,x){y=M1(y),m.context===null?m.context=y:m.pendingContext=y,m=ui(a),m.payload={element:c},x=x===void 0?null:x,x!==null&&(m.callback=x),c=ci(i,m,a),c!==null&&(En(c,i,a),Ro(c,i,a))}function R1(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<a?c:a}}function Em(i,a){R1(i,a),(i=i.alternate)&&R1(i,a)}function D1(i){if(i.tag===13){var a=Zs(i,67108864);a!==null&&En(a,i,67108864),Em(i,67108864)}}var Nc=!0;function cR(i,a,c,m){var y=I.T;I.T=null;var x=P.p;try{P.p=2,km(i,a,c,m)}finally{P.p=x,I.T=y}}function fR(i,a,c,m){var y=I.T;I.T=null;var x=P.p;try{P.p=8,km(i,a,c,m)}finally{P.p=x,I.T=y}}function km(i,a,c,m){if(Nc){var y=Tm(m);if(y===null)dm(i,a,m,Mc,c),z1(i,m);else if(hR(y,i,a,c,m))m.stopPropagation();else if(z1(i,m),a&4&&-1<dR.indexOf(i)){for(;y!==null;){var x=Ar(y);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var N=en(x.pendingLanes);if(N!==0){var L=x;for(L.pendingLanes|=2,L.entangledLanes|=2;N;){var q=1<<31-Te(N);L.entanglements[1]|=q,N&=~q}pr(x),(Je&6)===0&&(hc=Et()+500,Xo(0))}}break;case 13:L=Zs(x,2),L!==null&&En(L,x,2),pc(),Em(x,2)}if(x=Tm(m),x===null&&dm(i,a,m,Mc,c),x===y)break;y=x}y!==null&&m.stopPropagation()}else dm(i,a,m,null,c)}}function Tm(i){return i=Od(i),Cm(i)}var Mc=null;function Cm(i){if(Mc=null,i=Cr(i),i!==null){var a=o(i);if(a===null)i=null;else{var c=a.tag;if(c===13){if(i=l(a),i!==null)return i;i=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return Mc=i,null}function j1(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Gi()){case kr:return 2;case $n:return 8;case or:case Tr:return 32;case lr:return 268435456;default:return 32}default:return 32}}var Am=!1,Si=null,Ei=null,ki=null,rl=new Map,il=new Map,Ti=[],dR="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function z1(i,a){switch(i){case"focusin":case"focusout":Si=null;break;case"dragenter":case"dragleave":Ei=null;break;case"mouseover":case"mouseout":ki=null;break;case"pointerover":case"pointerout":rl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":il.delete(a.pointerId)}}function sl(i,a,c,m,y,x){return i===null||i.nativeEvent!==x?(i={blockedOn:a,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[y]},a!==null&&(a=Ar(a),a!==null&&D1(a)),i):(i.eventSystemFlags|=m,a=i.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),i)}function hR(i,a,c,m,y){switch(a){case"focusin":return Si=sl(Si,i,a,c,m,y),!0;case"dragenter":return Ei=sl(Ei,i,a,c,m,y),!0;case"mouseover":return ki=sl(ki,i,a,c,m,y),!0;case"pointerover":var x=y.pointerId;return rl.set(x,sl(rl.get(x)||null,i,a,c,m,y)),!0;case"gotpointercapture":return x=y.pointerId,il.set(x,sl(il.get(x)||null,i,a,c,m,y)),!0}return!1}function L1(i){var a=Cr(i.target);if(a!==null){var c=o(a);if(c!==null){if(a=c.tag,a===13){if(a=l(c),a!==null){i.blockedOn=a,_d(i.priority,function(){if(c.tag===13){var m=Sn();m=ao(m);var y=Zs(c,m);y!==null&&En(y,c,m),Em(c,m)}});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Oc(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var c=Tm(i.nativeEvent);if(c===null){c=i.nativeEvent;var m=new c.constructor(c.type,c);Md=m,c.target.dispatchEvent(m),Md=null}else return a=Ar(c),a!==null&&D1(a),i.blockedOn=c,!1;a.shift()}return!0}function P1(i,a,c){Oc(i)&&c.delete(a)}function mR(){Am=!1,Si!==null&&Oc(Si)&&(Si=null),Ei!==null&&Oc(Ei)&&(Ei=null),ki!==null&&Oc(ki)&&(ki=null),rl.forEach(P1),il.forEach(P1)}function Rc(i,a){i.blockedOn===a&&(i.blockedOn=null,Am||(Am=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,mR)))}var Dc=null;function I1(i){Dc!==i&&(Dc=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Dc===i&&(Dc=null);for(var a=0;a<i.length;a+=3){var c=i[a],m=i[a+1],y=i[a+2];if(typeof m!="function"){if(Cm(m||c)===null)continue;break}var x=Ar(c);x!==null&&(i.splice(a,3),a-=3,Ch(x,{pending:!0,data:y,method:c.method,action:m},m,y))}}))}function al(i){function a(q){return Rc(q,i)}Si!==null&&Rc(Si,i),Ei!==null&&Rc(Ei,i),ki!==null&&Rc(ki,i),rl.forEach(a),il.forEach(a);for(var c=0;c<Ti.length;c++){var m=Ti[c];m.blockedOn===i&&(m.blockedOn=null)}for(;0<Ti.length&&(c=Ti[0],c.blockedOn===null);)L1(c),c.blockedOn===null&&Ti.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(m=0;m<c.length;m+=3){var y=c[m],x=c[m+1],N=y[Gt]||null;if(typeof x=="function")N||I1(c);else if(N){var L=null;if(x&&x.hasAttribute("formAction")){if(y=x,N=x[Gt]||null)L=N.formAction;else if(Cm(y)!==null)continue}else L=N.action;typeof L=="function"?c[m+1]=L:(c.splice(m,3),m-=3),I1(c)}}}function Nm(i){this._internalRoot=i}jc.prototype.render=Nm.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(r(409));var c=a.current,m=Sn();O1(c,m,i,a,null,null)},jc.prototype.unmount=Nm.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;O1(i.current,2,null,i,null,null),pc(),a[ei]=null}};function jc(i){this._internalRoot=i}jc.prototype.unstable_scheduleHydration=function(i){if(i){var a=bu();i={blockedOn:null,target:i,priority:a};for(var c=0;c<Ti.length&&a!==0&&a<Ti[c].priority;c++);Ti.splice(c,0,i),c===0&&L1(i)}};var V1=t.version;if(V1!=="19.1.0")throw Error(r(527,V1,"19.1.0"));P.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=f(a),i=i!==null?d(i):null,i=i===null?null:i.stateNode,i};var pR={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var zc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zc.isDisabled&&zc.supportsFiber)try{ae=zc.inject(pR),de=zc}catch{}}return ll.createRoot=function(i,a){if(!s(i))throw Error(r(299));var c=!1,m="",y=tb,x=nb,N=rb,L=null;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(m=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(L=a.unstable_transitionCallbacks)),a=N1(i,1,!1,null,null,c,m,y,x,N,L,null),i[ei]=a.current,fm(i),new Nm(a)},ll.hydrateRoot=function(i,a,c){if(!s(i))throw Error(r(299));var m=!1,y="",x=tb,N=nb,L=rb,q=null,re=null;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(y=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(N=c.onCaughtError),c.onRecoverableError!==void 0&&(L=c.onRecoverableError),c.unstable_transitionCallbacks!==void 0&&(q=c.unstable_transitionCallbacks),c.formState!==void 0&&(re=c.formState)),a=N1(i,1,!0,a,c??null,m,y,x,N,L,q,re),a.context=M1(null),c=a.current,m=Sn(),m=ao(m),y=ui(m),y.callback=null,ci(c,y,m),c=m,a.current.lanes=c,Zi(a,c),pr(a),i[ei]=a.current,fm(i),new jc(a)},ll.version="19.1.0",ll}var X1;function TR(){if(X1)return Om.exports;X1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Om.exports=kR(),Om.exports}var CR=TR();const AR=Fi(CR);var X=ru();const NR=Fi(X),MR=({content:e})=>{const t=()=>typeof e=="string"?A.jsx("div",{className:"text-white whitespace-pre-wrap",children:e}):Array.isArray(e)?e.map((n,r)=>{switch(n.type){case"text":return A.jsx("div",{className:"text-white",children:n.text},r);case"image_url":return A.jsx("div",{className:"mt-2",children:A.jsx("img",{src:n.image_url.url,alt:"用户上传的图片",className:"max-w-[200px] rounded"})},r);case"audio":return A.jsx("div",{className:"mt-2",children:A.jsx("audio",{controls:!0,src:n.audio_url,className:"w-full",children:"您的浏览器不支持音频播放"})},r);default:return A.jsx("div",{className:"text-white whitespace-pre-wrap",children:JSON.stringify(n)},r)}}):A.jsx("div",{className:"text-white whitespace-pre-wrap",children:JSON.stringify(e)});return A.jsx("div",{className:"flex flex-row w-full justify-end",children:A.jsx("div",{className:"flex flex-col w-fit bg-blue-500 rounded-lg text-white border border-blue-100",children:A.jsx("div",{className:"flex flex-col p-4 ",children:t()})})})},Lm=e=>e.toString(),Zy=({usage_metadata:e,spend_time:t,response_metadata:n,id:r,tool_call_id:s})=>{const o=t?(e.output_tokens||0)*1e3/(t||1):0;return A.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500 mt-2",children:[A.jsxs("div",{className:"flex items-center gap-3",children:[A.jsx(OR,{usage_metadata:e}),t&&A.jsxs("span",{className:"text-gray-500",children:[(t/1e3).toFixed(2),"s"]}),o&&A.jsxs("span",{className:"text-gray-500",children:[o.toFixed(2)," TPS"]})]}),A.jsxs("div",{className:"flex items-center gap-2",children:[(n==null?void 0:n.model_name)&&A.jsx("span",{className:"text-gray-600",children:n.model_name}),s&&A.jsxs("span",{className:"text-gray-500",children:["Tool: ",s]}),r&&A.jsxs("span",{className:"text-gray-500",children:["ID: ",r]})]})]})},OR=({usage_metadata:e})=>A.jsx("div",{className:"flex items-center gap-1",children:A.jsxs("span",{className:"flex items-center gap-1 group relative",children:[A.jsx("span",{children:"📊"}),Lm(e.total_tokens||0),A.jsx("div",{className:"hidden group-hover:block absolute bottom-full ml-2 bg-gray-100 p-2 rounded text-xs shadow border",children:A.jsx("div",{className:"flex flex-col gap-1",children:A.jsxs("div",{className:"flex flex-col gap-1",children:[A.jsxs("span",{className:"flex items-center gap-1",children:[A.jsx("span",{children:"📥"}),Lm(e.input_tokens||0),A.jsxs("div",{children:[" ",JSON.stringify(e.prompt_tokens_details)]})]}),A.jsxs("span",{className:"flex items-center gap-1",children:[A.jsx("span",{children:"📤"}),Lm(e.output_tokens||0),A.jsxs("div",{children:[" ",JSON.stringify(e.completion_tokens_details)]})]})]})})})]})});var ul={exports:{}},Pm={},Im,Q1;function RR(){if(Q1)return Im;Q1=1;function e(t,n){typeof n=="boolean"&&(n={forever:n}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=n||{},this._maxRetryTime=n&&n.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}return Im=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var n=new Date().getTime();if(t&&n-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var s=this;return this._timer=setTimeout(function(){s._attempts++,s._operationTimeoutCb&&(s._timeout=setTimeout(function(){s._operationTimeoutCb(s._attempts)},s._operationTimeout),s._options.unref&&s._timeout.unref()),s._fn(s._attempts)},r),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(t,n){this._fn=t,n&&(n.timeout&&(this._operationTimeout=n.timeout),n.cb&&(this._operationTimeoutCb=n.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},e.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},e.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},e.prototype.start=e.prototype.try,e.prototype.errors=function(){return this._errors},e.prototype.attempts=function(){return this._attempts},e.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},n=null,r=0,s=0;s<this._errors.length;s++){var o=this._errors[s],l=o.message,u=(t[l]||0)+1;t[l]=u,u>=r&&(n=o,r=u)}return n},Im}var K1;function DR(){return K1||(K1=1,function(e){var t=RR();e.operation=function(n){var r=e.timeouts(n);return new t(r,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(n){if(n instanceof Array)return[].concat(n);var r={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var s in n)r[s]=n[s];if(r.minTimeout>r.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],l=0;l<r.retries;l++)o.push(this.createTimeout(l,r));return n&&n.forever&&!o.length&&o.push(this.createTimeout(l,r)),o.sort(function(u,f){return u-f}),o},e.createTimeout=function(n,r){var s=r.randomize?Math.random()+1:1,o=Math.round(s*Math.max(r.minTimeout,1)*Math.pow(r.factor,n));return o=Math.min(o,r.maxTimeout),o},e.wrap=function(n,r,s){if(r instanceof Array&&(s=r,r=null),!s){s=[];for(var o in n)typeof n[o]=="function"&&s.push(o)}for(var l=0;l<s.length;l++){var u=s[l],f=n[u];n[u]=(function(h){var p=e.operation(r),g=Array.prototype.slice.call(arguments,1),v=g.pop();g.push(function(b){p.retry(b)||(b&&(arguments[0]=p.mainError()),v.apply(this,arguments))}),p.attempt(function(){h.apply(n,g)})}).bind(n,f),n[u].options=r}}}(Pm)),Pm}var Vm,W1;function jR(){return W1||(W1=1,Vm=DR()),Vm}var J1;function zR(){if(J1)return ul.exports;J1=1;const e=jR(),t=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class n extends Error{constructor(u){super(),u instanceof Error?(this.originalError=u,{message:u}=u):(this.originalError=new Error(u),this.originalError.stack=this.stack),this.name="AbortError",this.message=u}}const r=(l,u,f)=>{const d=f.retries-(u-1);return l.attemptNumber=u,l.retriesLeft=d,l},s=l=>t.includes(l),o=(l,u)=>new Promise((f,d)=>{u={onFailedAttempt:()=>{},retries:10,...u};const h=e.operation(u);h.attempt(async p=>{try{f(await l(p))}catch(g){if(!(g instanceof Error)){d(new TypeError(`Non-error was thrown: "${g}". You should only throw errors.`));return}if(g instanceof n)h.stop(),d(g.originalError);else if(g instanceof TypeError&&!s(g.message))h.stop(),d(g);else{r(g,p,u);try{await u.onFailedAttempt(g)}catch(v){d(v);return}h.retry(g)||d(h.mainError())}}})});return ul.exports=o,ul.exports.default=o,ul.exports.AbortError=n,ul.exports}var LR=zR();const PR=Fi(LR);var Lc={},Bm={exports:{}},ew;function IR(){return ew||(ew=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(f,d,h){this.fn=f,this.context=d,this.once=h||!1}function o(f,d,h,p,g){if(typeof h!="function")throw new TypeError("The listener must be a function");var v=new s(h,p||f,g),b=n?n+d:d;return f._events[b]?f._events[b].fn?f._events[b]=[f._events[b],v]:f._events[b].push(v):(f._events[b]=v,f._eventsCount++),f}function l(f,d){--f._eventsCount===0?f._events=new r:delete f._events[d]}function u(){this._events=new r,this._eventsCount=0}u.prototype.eventNames=function(){var d=[],h,p;if(this._eventsCount===0)return d;for(p in h=this._events)t.call(h,p)&&d.push(n?p.slice(1):p);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(h)):d},u.prototype.listeners=function(d){var h=n?n+d:d,p=this._events[h];if(!p)return[];if(p.fn)return[p.fn];for(var g=0,v=p.length,b=new Array(v);g<v;g++)b[g]=p[g].fn;return b},u.prototype.listenerCount=function(d){var h=n?n+d:d,p=this._events[h];return p?p.fn?1:p.length:0},u.prototype.emit=function(d,h,p,g,v,b){var w=n?n+d:d;if(!this._events[w])return!1;var _=this._events[w],E=arguments.length,T,S;if(_.fn){switch(_.once&&this.removeListener(d,_.fn,void 0,!0),E){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,h),!0;case 3:return _.fn.call(_.context,h,p),!0;case 4:return _.fn.call(_.context,h,p,g),!0;case 5:return _.fn.call(_.context,h,p,g,v),!0;case 6:return _.fn.call(_.context,h,p,g,v,b),!0}for(S=1,T=new Array(E-1);S<E;S++)T[S-1]=arguments[S];_.fn.apply(_.context,T)}else{var M=_.length,D;for(S=0;S<M;S++)switch(_[S].once&&this.removeListener(d,_[S].fn,void 0,!0),E){case 1:_[S].fn.call(_[S].context);break;case 2:_[S].fn.call(_[S].context,h);break;case 3:_[S].fn.call(_[S].context,h,p);break;case 4:_[S].fn.call(_[S].context,h,p,g);break;default:if(!T)for(D=1,T=new Array(E-1);D<E;D++)T[D-1]=arguments[D];_[S].fn.apply(_[S].context,T)}}return!0},u.prototype.on=function(d,h,p){return o(this,d,h,p,!1)},u.prototype.once=function(d,h,p){return o(this,d,h,p,!0)},u.prototype.removeListener=function(d,h,p,g){var v=n?n+d:d;if(!this._events[v])return this;if(!h)return l(this,v),this;var b=this._events[v];if(b.fn)b.fn===h&&(!g||b.once)&&(!p||b.context===p)&&l(this,v);else{for(var w=0,_=[],E=b.length;w<E;w++)(b[w].fn!==h||g&&!b[w].once||p&&b[w].context!==p)&&_.push(b[w]);_.length?this._events[v]=_.length===1?_[0]:_:l(this,v)}return this},u.prototype.removeAllListeners=function(d){var h;return d?(h=n?n+d:d,this._events[h]&&l(this,h)):(this._events=new r,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=n,u.EventEmitter=u,e.exports=u}(Bm)),Bm.exports}var cl={exports:{}},Um,tw;function VR(){return tw||(tw=1,Um=(e,t)=>(t=t||(()=>{}),e.then(n=>new Promise(r=>{r(t())}).then(()=>n),n=>new Promise(r=>{r(t())}).then(()=>{throw n})))),Um}var nw;function BR(){if(nw)return cl.exports;nw=1;const e=VR();class t extends Error{constructor(s){super(s),this.name="TimeoutError"}}const n=(r,s,o)=>new Promise((l,u)=>{if(typeof s!="number"||s<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(s===1/0){l(r);return}const f=setTimeout(()=>{if(typeof o=="function"){try{l(o())}catch(p){u(p)}return}const d=typeof o=="string"?o:`Promise timed out after ${s} milliseconds`,h=o instanceof Error?o:new t(d);typeof r.cancel=="function"&&r.cancel(),u(h)},s);e(r.then(l,u),()=>{clearTimeout(f)})});return cl.exports=n,cl.exports.default=n,cl.exports.TimeoutError=t,cl.exports}var Pc={},Ic={},rw;function UR(){if(rw)return Ic;rw=1,Object.defineProperty(Ic,"__esModule",{value:!0});function e(t,n,r){let s=0,o=t.length;for(;o>0;){const l=o/2|0;let u=s+l;r(t[u],n)<=0?(s=++u,o-=l+1):o=l}return s}return Ic.default=e,Ic}var iw;function HR(){if(iw)return Pc;iw=1,Object.defineProperty(Pc,"__esModule",{value:!0});const e=UR();class t{constructor(){this._queue=[]}enqueue(r,s){s=Object.assign({priority:0},s);const o={priority:s.priority,run:r};if(this.size&&this._queue[this.size-1].priority>=s.priority){this._queue.push(o);return}const l=e.default(this._queue,o,(u,f)=>f.priority-u.priority);this._queue.splice(l,0,o)}dequeue(){const r=this._queue.shift();return r==null?void 0:r.run}filter(r){return this._queue.filter(s=>s.priority===r.priority).map(s=>s.run)}get size(){return this._queue.length}}return Pc.default=t,Pc}var sw;function FR(){if(sw)return Lc;sw=1,Object.defineProperty(Lc,"__esModule",{value:!0});const e=IR(),t=BR(),n=HR(),r=()=>{},s=new t.TimeoutError;class o extends e{constructor(u){var f,d,h,p;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=r,this._resolveIdle=r,u=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:n.default},u),!(typeof u.intervalCap=="number"&&u.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(d=(f=u.intervalCap)===null||f===void 0?void 0:f.toString())!==null&&d!==void 0?d:""}\` (${typeof u.intervalCap})`);if(u.interval===void 0||!(Number.isFinite(u.interval)&&u.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(p=(h=u.interval)===null||h===void 0?void 0:h.toString())!==null&&p!==void 0?p:""}\` (${typeof u.interval})`);this._carryoverConcurrencyCount=u.carryoverConcurrencyCount,this._isIntervalIgnored=u.intervalCap===1/0||u.interval===0,this._intervalCap=u.intervalCap,this._interval=u.interval,this._queue=new u.queueClass,this._queueClass=u.queueClass,this.concurrency=u.concurrency,this._timeout=u.timeout,this._throwOnTimeout=u.throwOnTimeout===!0,this._isPaused=u.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=r,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=r,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){const u=Date.now();if(this._intervalId===void 0){const f=this._intervalEnd-u;if(f<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},f)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){const u=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){const f=this._queue.dequeue();return f?(this.emit("active"),f(),u&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(u){if(!(typeof u=="number"&&u>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${u}\` (${typeof u})`);this._concurrency=u,this._processQueue()}async add(u,f={}){return new Promise((d,h)=>{const p=async()=>{this._pendingCount++,this._intervalCount++;try{const g=this._timeout===void 0&&f.timeout===void 0?u():t.default(Promise.resolve(u()),f.timeout===void 0?this._timeout:f.timeout,()=>{(f.throwOnTimeout===void 0?this._throwOnTimeout:f.throwOnTimeout)&&h(s)});d(await g)}catch(g){h(g)}this._next()};this._queue.enqueue(p,f),this._tryToStartAnother(),this.emit("add")})}async addAll(u,f){return Promise.all(u.map(async d=>this.add(d,f)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(u=>{const f=this._resolveEmpty;this._resolveEmpty=()=>{f(),u()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(u=>{const f=this._resolveIdle;this._resolveIdle=()=>{f(),u()}})}get size(){return this._queue.size}sizeBy(u){return this._queue.filter(u).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(u){this._timeout=u}}return Lc.default=o,Lc}var $R=FR();const Hm=Fi($R),qR=(...e)=>fetch(...e),GR=Symbol.for("lg:fetch_implementation"),YR=()=>globalThis[GR]??qR,ZR=[400,401,402,403,404,405,406,407,408,409,422];function XR(e){return e==null||typeof e!="object"?!1:"status"in e&&"statusText"in e&&"text"in e}class jl extends Error{constructor(t,n,r){super(`HTTP ${t}: ${n}`),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.status=t,this.text=n,this.response=r}static async fromResponse(t,n){try{return new jl(t.status,await t.text(),n!=null&&n.includeResponse?t:void 0)}catch{return new jl(t.status,t.statusText,n!=null&&n.includeResponse?t:void 0)}}}class QR{constructor(t){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"customFetch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??4,"default"in Hm?this.queue=new Hm.default({concurrency:this.maxConcurrency}):this.queue=new Hm({concurrency:this.maxConcurrency}),this.onFailedResponseHook=t==null?void 0:t.onFailedResponseHook,this.customFetch=t.fetch}call(t,...n){const r=this.onFailedResponseHook;return this.queue.add(()=>PR(()=>t(...n).catch(async s=>{throw s instanceof Error?s:XR(s)?await jl.fromResponse(s,{includeResponse:!!r}):new Error(s)}),{async onFailedAttempt(s){if(s.message.startsWith("Cancel")||s.message.startsWith("TimeoutError")||s.message.startsWith("AbortError")||(s==null?void 0:s.code)==="ECONNABORTED")throw s;if(s instanceof jl){if(ZR.includes(s.status))throw s;r&&s.response&&await r(s.response)}},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,n,...r){return t.signal?Promise.race([this.call(n,...r),new Promise((s,o)=>{var l;(l=t.signal)==null||l.addEventListener("abort",()=>{o(new Error("AbortError"))})})]):this.call(n,...r)}fetch(...t){const n=this.customFetch??YR();return this.call(()=>n(...t).then(r=>r.ok?r:Promise.reject(r)))}}var Fm={};function KR(e){try{return typeof process<"u"?Fm==null?void 0:Fm[e]:void 0}catch{return}}function WR(...e){const t=e.filter(r=>r!=null);if(t.length===0)return;if(t.length===1)return t[0];const n=new AbortController;for(const r of e){if(r!=null&&r.aborted)return n.abort(r.reason),n.signal;r==null||r.addEventListener("abort",()=>n.abort(r.reason),{once:!0})}return n.signal}const xl=13,Bg=10,JR=0,aw=58,eD=32,tD=[xl,Bg];class ow extends TransformStream{constructor(){let t=[],n=!1;super({start(){t=[],n=!1},transform(r,s){let o=r;if(n&&(o=of([[xl],o]),n=!1),o.length>0&&o.at(-1)===xl&&(n=!0,o=o.subarray(0,-1)),!o.length)return;const l=tD.includes(o.at(-1)),u=o.length-1,{lines:f}=o.reduce((d,h,p)=>(d.from>p||((h===xl||h===Bg)&&(d.lines.push(o.subarray(d.from,p)),h===xl&&o[p+1]===Bg?d.from=p+2:d.from=p+1),p===u&&d.from<=u&&d.lines.push(o.subarray(d.from))),d),{lines:[],from:0});if(f.length===1&&!l){t.push(f[0]);return}t.length&&(t.push(f[0]),f[0]=of(t),t=[]),l||f.length&&(t=[f.pop()]);for(const d of f)s.enqueue(d)},flush(r){t.length&&r.enqueue(of(t))}})}}class lw extends TransformStream{constructor(){let t="",n=[],r="",s=null;const o=new TextDecoder;super({transform(l,u){if(!l.length){if(!t&&!n.length&&!r&&s==null)return;const p={id:r||void 0,event:t,data:n.length?uw(o,n):null};t="",n=[],s=null,u.enqueue(p);return}if(l[0]===aw)return;const f=l.indexOf(aw);if(f===-1)return;const d=o.decode(l.subarray(0,f));let h=l.subarray(f+1);if(h[0]===eD&&(h=h.subarray(1)),d==="event")t=o.decode(h);else if(d==="data")n.push(h);else if(d==="id")h.indexOf(JR)===-1&&(r=o.decode(h));else if(d==="retry"){const p=Number.parseInt(o.decode(h));Number.isNaN(p)||(s=p)}},flush(l){t&&l.enqueue({id:r||void 0,event:t,data:n.length?uw(o,n):null})}})}}function of(e){const t=e.reduce((s,o)=>s+o.length,0);let n=new Uint8Array(t),r=0;for(const s of e)n.set(s,r),r+=s.length;return n}function uw(e,t){return JSON.parse(e.decode(of(t)))}class zl extends ReadableStream{constructor(){super(...arguments),Object.defineProperty(this,"reader",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{const t=await this.reader.read();return t.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:t.value}}catch(t){throw this.reader.releaseLock(),t}}async return(){if(this.ensureReader(),this.locked){const t=this.reader.cancel();this.reader.releaseLock(),await t}return{done:!0,value:void 0}}async throw(t){if(this.ensureReader(),this.locked){const n=this.reader.cancel();this.reader.releaseLock(),await n}throw t}async[Symbol.asyncDispose](){await this.return()}[Symbol.asyncIterator](){return this}static fromReadableStream(t){const n=t.getReader();return new zl({start(r){return s();function s(){return n.read().then(({done:o,value:l})=>{if(o){r.close();return}return r.enqueue(l),s()})}},cancel(){n.releaseLock()}})}static fromAsyncGenerator(t){return new zl({async pull(n){const{value:r,done:s}=await t.next();s&&n.close(),n.enqueue(r)},async cancel(n){await t.return(n)}})}}function nD(e){if(e)return e;const t=["LANGGRAPH","LANGSMITH","LANGCHAIN"];for(const n of t){const r=KR(`${n}_API_KEY`);if(r)return r.trim().replace(/^["']|["']$/g,"")}}const rD=/(\/threads\/(?<thread_id>.+))?\/runs\/(?<run_id>.+)/;function $m(e){var r;const t=e.headers.get("Content-Location");if(!t)return;const n=rD.exec(t);if((r=n==null?void 0:n.groups)!=null&&r.run_id)return{run_id:n.groups.run_id,thread_id:n.groups.thread_id||void 0}}class Wa{constructor(t){var o;Object.defineProperty(this,"asyncCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeoutMs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const n={maxRetries:4,maxConcurrency:4,...t==null?void 0:t.callerOptions};let r="http://localhost:8123";if(!(t!=null&&t.apiUrl)&&typeof globalThis=="object"&&globalThis!=null){const l=Symbol.for("langgraph_api:fetch"),u=Symbol.for("langgraph_api:url"),f=globalThis;f[l]&&(n.fetch??(n.fetch=f[l])),f[u]&&(r=f[u])}this.asyncCaller=new QR(n),this.timeoutMs=t==null?void 0:t.timeoutMs,this.apiUrl=((o=t==null?void 0:t.apiUrl)==null?void 0:o.replace(/\/$/,""))||r,this.defaultHeaders=(t==null?void 0:t.defaultHeaders)||{};const s=nD(t==null?void 0:t.apiKey);s&&(this.defaultHeaders["X-Api-Key"]=s)}prepareFetchOptions(t,n){const r={...n,headers:{...this.defaultHeaders,...n==null?void 0:n.headers}};r.json&&(r.body=JSON.stringify(r.json),r.headers={...r.headers,"Content-Type":"application/json"},delete r.json),r.withResponse&&delete r.withResponse;let s=null;typeof(n==null?void 0:n.timeoutMs)<"u"?n.timeoutMs!=null&&(s=AbortSignal.timeout(n.timeoutMs)):this.timeoutMs!=null&&(s=AbortSignal.timeout(this.timeoutMs)),r.signal=WR(s,r.signal);const o=new URL(`${this.apiUrl}${t}`);if(r.params){for(const[l,u]of Object.entries(r.params)){if(u==null)continue;let f=typeof u=="string"||typeof u=="number"?u.toString():JSON.stringify(u);o.searchParams.append(l,f)}delete r.params}return[o,r]}async fetch(t,n){const r=await this.asyncCaller.fetch(...this.prepareFetchOptions(t,n)),s=(()=>{if(!(r.status===202||r.status===204))return r.json()})();return n!=null&&n.withResponse?[await s,r]:s}}class iD extends Wa{async createForThread(t,n,r){const s={schedule:r==null?void 0:r.schedule,input:r==null?void 0:r.input,config:r==null?void 0:r.config,metadata:r==null?void 0:r.metadata,assistant_id:n,interrupt_before:r==null?void 0:r.interruptBefore,interrupt_after:r==null?void 0:r.interruptAfter,webhook:r==null?void 0:r.webhook,multitask_strategy:r==null?void 0:r.multitaskStrategy,if_not_exists:r==null?void 0:r.ifNotExists,checkpoint_during:r==null?void 0:r.checkpointDuring};return this.fetch(`/threads/${t}/runs/crons`,{method:"POST",json:s})}async create(t,n){const r={schedule:n==null?void 0:n.schedule,input:n==null?void 0:n.input,config:n==null?void 0:n.config,metadata:n==null?void 0:n.metadata,assistant_id:t,interrupt_before:n==null?void 0:n.interruptBefore,interrupt_after:n==null?void 0:n.interruptAfter,webhook:n==null?void 0:n.webhook,multitask_strategy:n==null?void 0:n.multitaskStrategy,if_not_exists:n==null?void 0:n.ifNotExists,checkpoint_during:n==null?void 0:n.checkpointDuring};return this.fetch("/runs/crons",{method:"POST",json:r})}async delete(t){await this.fetch(`/runs/crons/${t}`,{method:"DELETE"})}async search(t){return this.fetch("/runs/crons/search",{method:"POST",json:{assistant_id:(t==null?void 0:t.assistantId)??void 0,thread_id:(t==null?void 0:t.threadId)??void 0,limit:(t==null?void 0:t.limit)??10,offset:(t==null?void 0:t.offset)??0}})}}class sD extends Wa{async get(t){return this.fetch(`/assistants/${t}`)}async getGraph(t,n){return this.fetch(`/assistants/${t}/graph`,{params:{xray:n==null?void 0:n.xray}})}async getSchemas(t){return this.fetch(`/assistants/${t}/schemas`)}async getSubgraphs(t,n){return n!=null&&n.namespace?this.fetch(`/assistants/${t}/subgraphs/${n.namespace}`,{params:{recurse:n==null?void 0:n.recurse}}):this.fetch(`/assistants/${t}/subgraphs`,{params:{recurse:n==null?void 0:n.recurse}})}async create(t){return this.fetch("/assistants",{method:"POST",json:{graph_id:t.graphId,config:t.config,metadata:t.metadata,assistant_id:t.assistantId,if_exists:t.ifExists,name:t.name,description:t.description}})}async update(t,n){return this.fetch(`/assistants/${t}`,{method:"PATCH",json:{graph_id:n.graphId,config:n.config,metadata:n.metadata,name:n.name,description:n.description}})}async delete(t){return this.fetch(`/assistants/${t}`,{method:"DELETE"})}async search(t){return this.fetch("/assistants/search",{method:"POST",json:{graph_id:(t==null?void 0:t.graphId)??void 0,metadata:(t==null?void 0:t.metadata)??void 0,limit:(t==null?void 0:t.limit)??10,offset:(t==null?void 0:t.offset)??0,sort_by:(t==null?void 0:t.sortBy)??void 0,sort_order:(t==null?void 0:t.sortOrder)??void 0}})}async getVersions(t,n){return this.fetch(`/assistants/${t}/versions`,{method:"POST",json:{metadata:(n==null?void 0:n.metadata)??void 0,limit:(n==null?void 0:n.limit)??10,offset:(n==null?void 0:n.offset)??0}})}async setLatest(t,n){return this.fetch(`/assistants/${t}/latest`,{method:"POST",json:{version:n}})}}class aD extends Wa{async get(t){return this.fetch(`/threads/${t}`)}async create(t){var n;return this.fetch("/threads",{method:"POST",json:{metadata:{...t==null?void 0:t.metadata,graph_id:t==null?void 0:t.graphId},thread_id:t==null?void 0:t.threadId,if_exists:t==null?void 0:t.ifExists,supersteps:(n=t==null?void 0:t.supersteps)==null?void 0:n.map(r=>({updates:r.updates.map(s=>({values:s.values,command:s.command,as_node:s.asNode}))}))}})}async copy(t){return this.fetch(`/threads/${t}/copy`,{method:"POST"})}async update(t,n){return this.fetch(`/threads/${t}`,{method:"PATCH",json:{metadata:n==null?void 0:n.metadata}})}async delete(t){return this.fetch(`/threads/${t}`,{method:"DELETE"})}async search(t){return this.fetch("/threads/search",{method:"POST",json:{metadata:(t==null?void 0:t.metadata)??void 0,limit:(t==null?void 0:t.limit)??10,offset:(t==null?void 0:t.offset)??0,status:t==null?void 0:t.status,sort_by:t==null?void 0:t.sortBy,sort_order:t==null?void 0:t.sortOrder}})}async getState(t,n,r){return n!=null?typeof n!="string"?this.fetch(`/threads/${t}/state/checkpoint`,{method:"POST",json:{checkpoint:n,subgraphs:r==null?void 0:r.subgraphs}}):this.fetch(`/threads/${t}/state/${n}`,{params:{subgraphs:r==null?void 0:r.subgraphs}}):this.fetch(`/threads/${t}/state`,{params:{subgraphs:r==null?void 0:r.subgraphs}})}async updateState(t,n){return this.fetch(`/threads/${t}/state`,{method:"POST",json:{values:n.values,checkpoint_id:n.checkpointId,checkpoint:n.checkpoint,as_node:n==null?void 0:n.asNode}})}async patchState(t,n){var s;let r;if(typeof t!="string"){if(typeof((s=t.configurable)==null?void 0:s.thread_id)!="string")throw new Error("Thread ID is required when updating state with a config.");r=t.configurable.thread_id}else r=t;return this.fetch(`/threads/${r}/state`,{method:"PATCH",json:{metadata:n}})}async getHistory(t,n){return this.fetch(`/threads/${t}/history`,{method:"POST",json:{limit:(n==null?void 0:n.limit)??10,before:n==null?void 0:n.before,metadata:n==null?void 0:n.metadata,checkpoint:n==null?void 0:n.checkpoint}})}}class oD extends Wa{async*stream(t,n,r){var d;const s={input:r==null?void 0:r.input,command:r==null?void 0:r.command,config:r==null?void 0:r.config,metadata:r==null?void 0:r.metadata,stream_mode:r==null?void 0:r.streamMode,stream_subgraphs:r==null?void 0:r.streamSubgraphs,stream_resumable:r==null?void 0:r.streamResumable,feedback_keys:r==null?void 0:r.feedbackKeys,assistant_id:n,interrupt_before:r==null?void 0:r.interruptBefore,interrupt_after:r==null?void 0:r.interruptAfter,checkpoint:r==null?void 0:r.checkpoint,checkpoint_id:r==null?void 0:r.checkpointId,webhook:r==null?void 0:r.webhook,multitask_strategy:r==null?void 0:r.multitaskStrategy,on_completion:r==null?void 0:r.onCompletion,on_disconnect:r==null?void 0:r.onDisconnect,after_seconds:r==null?void 0:r.afterSeconds,if_not_exists:r==null?void 0:r.ifNotExists,checkpoint_during:r==null?void 0:r.checkpointDuring},o=t==null?"/runs/stream":`/threads/${t}/runs/stream`,l=await this.asyncCaller.fetch(...this.prepareFetchOptions(o,{method:"POST",json:s,timeoutMs:null,signal:r==null?void 0:r.signal})),u=$m(l);u&&((d=r==null?void 0:r.onRunCreated)==null||d.call(r,u));const f=(l.body||new ReadableStream({start:h=>h.close()})).pipeThrough(new ow).pipeThrough(new lw);yield*zl.fromReadableStream(f)}async create(t,n,r){var f;const s={input:r==null?void 0:r.input,command:r==null?void 0:r.command,config:r==null?void 0:r.config,metadata:r==null?void 0:r.metadata,stream_mode:r==null?void 0:r.streamMode,stream_subgraphs:r==null?void 0:r.streamSubgraphs,stream_resumable:r==null?void 0:r.streamResumable,assistant_id:n,interrupt_before:r==null?void 0:r.interruptBefore,interrupt_after:r==null?void 0:r.interruptAfter,webhook:r==null?void 0:r.webhook,checkpoint:r==null?void 0:r.checkpoint,checkpoint_id:r==null?void 0:r.checkpointId,multitask_strategy:r==null?void 0:r.multitaskStrategy,after_seconds:r==null?void 0:r.afterSeconds,if_not_exists:r==null?void 0:r.ifNotExists,checkpoint_during:r==null?void 0:r.checkpointDuring},[o,l]=await this.fetch(`/threads/${t}/runs`,{method:"POST",json:s,signal:r==null?void 0:r.signal,withResponse:!0}),u=$m(l);return u&&((f=r==null?void 0:r.onRunCreated)==null||f.call(r,u)),o}async createBatch(t){const n=t.map(r=>({...r,assistant_id:r.assistantId})).map(r=>Object.fromEntries(Object.entries(r).filter(([s,o])=>o!==void 0)));return this.fetch("/runs/batch",{method:"POST",json:n})}async wait(t,n,r){var h,p,g;const s={input:r==null?void 0:r.input,command:r==null?void 0:r.command,config:r==null?void 0:r.config,metadata:r==null?void 0:r.metadata,assistant_id:n,interrupt_before:r==null?void 0:r.interruptBefore,interrupt_after:r==null?void 0:r.interruptAfter,checkpoint:r==null?void 0:r.checkpoint,checkpoint_id:r==null?void 0:r.checkpointId,webhook:r==null?void 0:r.webhook,multitask_strategy:r==null?void 0:r.multitaskStrategy,on_completion:r==null?void 0:r.onCompletion,on_disconnect:r==null?void 0:r.onDisconnect,after_seconds:r==null?void 0:r.afterSeconds,if_not_exists:r==null?void 0:r.ifNotExists,checkpoint_during:r==null?void 0:r.checkpointDuring},o=t==null?"/runs/wait":`/threads/${t}/runs/wait`,[l,u]=await this.fetch(o,{method:"POST",json:s,timeoutMs:null,signal:r==null?void 0:r.signal,withResponse:!0}),f=$m(u);if(f&&((h=r==null?void 0:r.onRunCreated)==null||h.call(r,f)),((r==null?void 0:r.raiseError)!==void 0?r.raiseError:!0)&&"__error__"in l&&typeof l.__error__=="object"&&l.__error__&&"error"in l.__error__&&"message"in l.__error__)throw new Error(`${(p=l.__error__)==null?void 0:p.error}: ${(g=l.__error__)==null?void 0:g.message}`);return l}async list(t,n){return this.fetch(`/threads/${t}/runs`,{params:{limit:(n==null?void 0:n.limit)??10,offset:(n==null?void 0:n.offset)??0,status:(n==null?void 0:n.status)??void 0}})}async get(t,n){return this.fetch(`/threads/${t}/runs/${n}`)}async cancel(t,n,r=!1,s="interrupt"){return this.fetch(`/threads/${t}/runs/${n}/cancel`,{method:"POST",params:{wait:r?"1":"0",action:s}})}async join(t,n,r){return this.fetch(`/threads/${t}/runs/${n}/join`,{timeoutMs:null,signal:r==null?void 0:r.signal})}async*joinStream(t,n,r){const s=typeof r=="object"&&r!=null&&r instanceof AbortSignal?{signal:r}:r,l=((await this.asyncCaller.fetch(...this.prepareFetchOptions(t!=null?`/threads/${t}/runs/${n}/stream`:`/runs/${n}/stream`,{method:"GET",timeoutMs:null,signal:s==null?void 0:s.signal,headers:s!=null&&s.lastEventId?{"Last-Event-ID":s.lastEventId}:void 0,params:{cancel_on_disconnect:s!=null&&s.cancelOnDisconnect?"1":"0",stream_mode:s==null?void 0:s.streamMode}}))).body||new ReadableStream({start:u=>u.close()})).pipeThrough(new ow).pipeThrough(new lw);yield*zl.fromReadableStream(l)}async delete(t,n){return this.fetch(`/threads/${t}/runs/${n}`,{method:"DELETE"})}}class lD extends Wa{async putItem(t,n,r,s){t.forEach(l=>{if(l.includes("."))throw new Error(`Invalid namespace label '${l}'. Namespace labels cannot contain periods ('.')`)});const o={namespace:t,key:n,value:r,index:s==null?void 0:s.index,ttl:s==null?void 0:s.ttl};return this.fetch("/store/items",{method:"PUT",json:o})}async getItem(t,n,r){t.forEach(l=>{if(l.includes("."))throw new Error(`Invalid namespace label '${l}'. Namespace labels cannot contain periods ('.')`)});const s={namespace:t.join("."),key:n};(r==null?void 0:r.refreshTtl)!==void 0&&(s.refresh_ttl=r.refreshTtl);const o=await this.fetch("/store/items",{params:s});return o?{...o,createdAt:o.created_at,updatedAt:o.updated_at}:null}async deleteItem(t,n){return t.forEach(r=>{if(r.includes("."))throw new Error(`Invalid namespace label '${r}'. Namespace labels cannot contain periods ('.')`)}),this.fetch("/store/items",{method:"DELETE",json:{namespace:t,key:n}})}async searchItems(t,n){const r={namespace_prefix:t,filter:n==null?void 0:n.filter,limit:(n==null?void 0:n.limit)??10,offset:(n==null?void 0:n.offset)??0,query:n==null?void 0:n.query,refresh_ttl:n==null?void 0:n.refreshTtl};return{items:(await this.fetch("/store/items/search",{method:"POST",json:r})).items.map(o=>({...o,createdAt:o.created_at,updatedAt:o.updated_at}))}}async listNamespaces(t){const n={prefix:t==null?void 0:t.prefix,suffix:t==null?void 0:t.suffix,max_depth:t==null?void 0:t.maxDepth,limit:(t==null?void 0:t.limit)??100,offset:(t==null?void 0:t.offset)??0};return this.fetch("/store/namespaces",{method:"POST",json:n})}}class xs extends Wa{static getOrCached(t,n){if(xs.promiseCache[t]!=null)return xs.promiseCache[t];const r=n();return xs.promiseCache[t]=r,r}async getComponent(t,n){return xs.getOrCached(`${this.apiUrl}-${t}-${n}`,async()=>(await this.asyncCaller.fetch(...this.prepareFetchOptions(`/ui/${t}`,{headers:{Accept:"text/html","Content-Type":"application/json"},method:"POST",json:{name:n}}))).text())}}Object.defineProperty(xs,"promiseCache",{enumerable:!0,configurable:!0,writable:!0,value:{}});class uD{constructor(t){Object.defineProperty(this,"assistants",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"threads",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"crons",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"~ui",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.assistants=new sD(t),this.threads=new aD(t),this.runs=new oD(t),this.crons=new iD(t),this.store=new lD(t),this["~ui"]=new xs(t)}}var Xe;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const o={};for(const l of s)o[l]=l;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(u=>typeof s[s[u]]!="number"),l={};for(const u of o)l[u]=s[u];return e.objectValues(l)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const l in s)Object.prototype.hasOwnProperty.call(s,l)&&o.push(l);return o},e.find=(s,o)=>{for(const l of s)if(o(l))return l},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(Xe||(Xe={}));var cw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(cw||(cw={}));const be=Xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Di=e=>{switch(typeof e){case"undefined":return be.undefined;case"string":return be.string;case"number":return Number.isNaN(e)?be.nan:be.number;case"boolean":return be.boolean;case"function":return be.function;case"bigint":return be.bigint;case"symbol":return be.symbol;case"object":return Array.isArray(e)?be.array:e===null?be.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?be.promise:typeof Map<"u"&&e instanceof Map?be.map:typeof Set<"u"&&e instanceof Set?be.set:typeof Date<"u"&&e instanceof Date?be.date:be.object;default:return be.unknown}},me=Xe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Zr extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(o){return o.message},r={_errors:[]},s=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(s);else if(l.code==="invalid_return_type")s(l.returnTypeError);else if(l.code==="invalid_arguments")s(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let u=r,f=0;for(;f<l.path.length;){const d=l.path[f];f===l.path.length-1?(u[d]=u[d]||{_errors:[]},u[d]._errors.push(n(l))):u[d]=u[d]||{_errors:[]},u=u[d],f++}}};return s(this),r}static assert(t){if(!(t instanceof Zr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Zr.create=e=>new Zr(e);const Ug=(e,t)=>{let n;switch(e.code){case me.invalid_type:e.received===be.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case me.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Xe.jsonStringifyReplacer)}`;break;case me.unrecognized_keys:n=`Unrecognized key(s) in object: ${Xe.joinValues(e.keys,", ")}`;break;case me.invalid_union:n="Invalid input";break;case me.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Xe.joinValues(e.options)}`;break;case me.invalid_enum_value:n=`Invalid enum value. Expected ${Xe.joinValues(e.options)}, received '${e.received}'`;break;case me.invalid_arguments:n="Invalid function arguments";break;case me.invalid_return_type:n="Invalid function return type";break;case me.invalid_date:n="Invalid date";break;case me.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Xe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case me.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case me.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case me.custom:n="Invalid input";break;case me.invalid_intersection_types:n="Intersection results could not be merged";break;case me.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case me.not_finite:n="Number must be finite";break;default:n=t.defaultError,Xe.assertNever(e)}return{message:n}};let cD=Ug;function fD(){return cD}const dD=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,o=[...n,...s.path||[]],l={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let u="";const f=r.filter(d=>!!d).slice().reverse();for(const d of f)u=d(l,{data:t,defaultError:u}).message;return{...s,path:o,message:u}};function ve(e,t){const n=fD(),r=dD({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Ug?void 0:Ug].filter(s=>!!s)});e.common.issues.push(r)}class Nn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return De;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const o=await s.key,l=await s.value;r.push({key:o,value:l})}return Nn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:o,value:l}=s;if(o.status==="aborted"||l.status==="aborted")return De;o.status==="dirty"&&t.dirty(),l.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||s.alwaysSet)&&(r[o.value]=l.value)}return{status:t.value,value:r}}}const De=Object.freeze({status:"aborted"}),bl=e=>({status:"dirty",value:e}),Fn=e=>({status:"valid",value:e}),fw=e=>e.status==="aborted",dw=e=>e.status==="dirty",Pa=e=>e.status==="valid",bf=e=>typeof Promise<"u"&&e instanceof Promise;var we;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(we||(we={}));class Vi{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const hw=(e,t)=>{if(Pa(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Zr(e.common.issues);return this._error=n,this._error}}};function Be(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(l,u)=>{const{message:f}=e;return l.code==="invalid_enum_value"?{message:f??u.defaultError}:typeof u.data>"u"?{message:f??r??u.defaultError}:l.code!=="invalid_type"?{message:u.defaultError}:{message:f??n??u.defaultError}},description:s}}class Ye{get description(){return this._def.description}_getType(t){return Di(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Di(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Nn,ctx:{common:t.parent.common,data:t.data,parsedType:Di(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(bf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Di(t)},s=this._parseSync({data:t,path:r.path,parent:r});return hw(r,s)}"~validate"(t){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Di(t)};if(!this["~standard"].async)try{const o=this._parseSync({data:t,path:[],parent:n});return Pa(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(s=(r=o==null?void 0:o.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(o=>Pa(o)?{value:o.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Di(t)},s=this._parse({data:t,path:r.path,parent:r}),o=await(bf(s)?s:Promise.resolve(s));return hw(r,o)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,o)=>{const l=t(s),u=()=>o.addIssue({code:me.custom,...r(s)});return typeof Promise<"u"&&l instanceof Promise?l.then(f=>f?!0:(u(),!1)):l?!0:(u(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new Ba({schema:this,typeName:pe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Gr.create(this,this._def)}nullable(){return Ua.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yr.create(this)}promise(){return Ef.create(this,this._def)}or(t){return _f.create([this,t],this._def)}and(t){return Sf.create(this,t,this._def)}transform(t){return new Ba({...Be(this._def),schema:this,typeName:pe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new $g({...Be(this._def),innerType:this,defaultValue:n,typeName:pe.ZodDefault})}brand(){return new zD({typeName:pe.ZodBranded,type:this,...Be(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new qg({...Be(this._def),innerType:this,catchValue:n,typeName:pe.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Xy.create(this,t)}readonly(){return Gg.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const hD=/^c[^\s-]{8,}$/i,mD=/^[0-9a-z]+$/,pD=/^[0-9A-HJKMNP-TV-Z]{26}$/i,gD=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,yD=/^[a-z0-9_-]{21}$/i,vD=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,xD=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,bD=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wD="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let qm;const _D=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,SD=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ED=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,kD=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,TD=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,CD=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Wk="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",AD=new RegExp(`^${Wk}$`);function Jk(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function ND(e){return new RegExp(`^${Jk(e)}$`)}function MD(e){let t=`${Wk}T${Jk(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function OD(e,t){return!!((t==="v4"||!t)&&_D.test(e)||(t==="v6"||!t)&&ED.test(e))}function RD(e,t){if(!vD.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function DD(e,t){return!!((t==="v4"||!t)&&SD.test(e)||(t==="v6"||!t)&&kD.test(e))}class Li extends Ye{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==be.string){const o=this._getOrReturnCtx(t);return ve(o,{code:me.invalid_type,expected:be.string,received:o.parsedType}),De}const r=new Nn;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),ve(s,{code:me.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")t.data.length>o.value&&(s=this._getOrReturnCtx(t,s),ve(s,{code:me.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const l=t.data.length>o.value,u=t.data.length<o.value;(l||u)&&(s=this._getOrReturnCtx(t,s),l?ve(s,{code:me.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):u&&ve(s,{code:me.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")bD.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"email",code:me.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")qm||(qm=new RegExp(wD,"u")),qm.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"emoji",code:me.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")gD.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"uuid",code:me.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")yD.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"nanoid",code:me.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")hD.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"cuid",code:me.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")mD.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"cuid2",code:me.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")pD.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"ulid",code:me.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),ve(s,{validation:"url",code:me.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"regex",code:me.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(t,s),ve(s,{code:me.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(s=this._getOrReturnCtx(t,s),ve(s,{code:me.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),ve(s,{code:me.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?MD(o).test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{code:me.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?AD.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{code:me.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?ND(o).test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{code:me.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?xD.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"duration",code:me.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?OD(t.data,o.version)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"ip",code:me.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?RD(t.data,o.alg)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"jwt",code:me.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?DD(t.data,o.version)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"cidr",code:me.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?TD.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"base64",code:me.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?CD.test(t.data)||(s=this._getOrReturnCtx(t,s),ve(s,{validation:"base64url",code:me.invalid_string,message:o.message}),r.dirty()):Xe.assertNever(o);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:me.invalid_string,...we.errToObj(r)})}_addCheck(t){return new Li({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...we.errToObj(t)})}url(t){return this._addCheck({kind:"url",...we.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...we.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...we.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...we.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...we.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...we.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...we.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...we.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...we.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...we.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...we.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...we.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...we.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...we.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...we.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...we.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...we.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...we.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...we.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...we.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...we.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...we.errToObj(n)})}nonempty(t){return this.min(1,we.errToObj(t))}trim(){return new Li({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Li({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Li({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Li.create=e=>new Li({checks:[],typeName:pe.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Be(e)});function jD(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,o=Number.parseInt(e.toFixed(s).replace(".","")),l=Number.parseInt(t.toFixed(s).replace(".",""));return o%l/10**s}class Ia extends Ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==be.number){const o=this._getOrReturnCtx(t);return ve(o,{code:me.invalid_type,expected:be.number,received:o.parsedType}),De}let r;const s=new Nn;for(const o of this._def.checks)o.kind==="int"?Xe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ve(r,{code:me.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),ve(r,{code:me.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ve(r,{code:me.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?jD(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),ve(r,{code:me.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ve(r,{code:me.not_finite,message:o.message}),s.dirty()):Xe.assertNever(o);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,we.toString(n))}gt(t,n){return this.setLimit("min",t,!1,we.toString(n))}lte(t,n){return this.setLimit("max",t,!0,we.toString(n))}lt(t,n){return this.setLimit("max",t,!1,we.toString(n))}setLimit(t,n,r,s){return new Ia({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:we.toString(s)}]})}_addCheck(t){return new Ia({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:we.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:we.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:we.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:we.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:we.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:we.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:we.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:we.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:we.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Xe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ia.create=e=>new Ia({checks:[],typeName:pe.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Be(e)});class Ll extends Ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==be.bigint)return this._getInvalidInput(t);let r;const s=new Nn;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),ve(r,{code:me.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),ve(r,{code:me.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ve(r,{code:me.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):Xe.assertNever(o);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return ve(n,{code:me.invalid_type,expected:be.bigint,received:n.parsedType}),De}gte(t,n){return this.setLimit("min",t,!0,we.toString(n))}gt(t,n){return this.setLimit("min",t,!1,we.toString(n))}lte(t,n){return this.setLimit("max",t,!0,we.toString(n))}lt(t,n){return this.setLimit("max",t,!1,we.toString(n))}setLimit(t,n,r,s){return new Ll({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:we.toString(s)}]})}_addCheck(t){return new Ll({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:we.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:we.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:we.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:we.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:we.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ll.create=e=>new Ll({checks:[],typeName:pe.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Be(e)});class Hg extends Ye{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==be.boolean){const r=this._getOrReturnCtx(t);return ve(r,{code:me.invalid_type,expected:be.boolean,received:r.parsedType}),De}return Fn(t.data)}}Hg.create=e=>new Hg({typeName:pe.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Be(e)});class wf extends Ye{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==be.date){const o=this._getOrReturnCtx(t);return ve(o,{code:me.invalid_type,expected:be.date,received:o.parsedType}),De}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ve(o,{code:me.invalid_date}),De}const r=new Nn;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),ve(s,{code:me.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(s=this._getOrReturnCtx(t,s),ve(s,{code:me.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Xe.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new wf({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:we.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:we.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}wf.create=e=>new wf({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:pe.ZodDate,...Be(e)});class mw extends Ye{_parse(t){if(this._getType(t)!==be.symbol){const r=this._getOrReturnCtx(t);return ve(r,{code:me.invalid_type,expected:be.symbol,received:r.parsedType}),De}return Fn(t.data)}}mw.create=e=>new mw({typeName:pe.ZodSymbol,...Be(e)});class pw extends Ye{_parse(t){if(this._getType(t)!==be.undefined){const r=this._getOrReturnCtx(t);return ve(r,{code:me.invalid_type,expected:be.undefined,received:r.parsedType}),De}return Fn(t.data)}}pw.create=e=>new pw({typeName:pe.ZodUndefined,...Be(e)});class gw extends Ye{_parse(t){if(this._getType(t)!==be.null){const r=this._getOrReturnCtx(t);return ve(r,{code:me.invalid_type,expected:be.null,received:r.parsedType}),De}return Fn(t.data)}}gw.create=e=>new gw({typeName:pe.ZodNull,...Be(e)});class yw extends Ye{constructor(){super(...arguments),this._any=!0}_parse(t){return Fn(t.data)}}yw.create=e=>new yw({typeName:pe.ZodAny,...Be(e)});class vw extends Ye{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Fn(t.data)}}vw.create=e=>new vw({typeName:pe.ZodUnknown,...Be(e)});class Bi extends Ye{_parse(t){const n=this._getOrReturnCtx(t);return ve(n,{code:me.invalid_type,expected:be.never,received:n.parsedType}),De}}Bi.create=e=>new Bi({typeName:pe.ZodNever,...Be(e)});class xw extends Ye{_parse(t){if(this._getType(t)!==be.undefined){const r=this._getOrReturnCtx(t);return ve(r,{code:me.invalid_type,expected:be.void,received:r.parsedType}),De}return Fn(t.data)}}xw.create=e=>new xw({typeName:pe.ZodVoid,...Be(e)});class yr extends Ye{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==be.array)return ve(n,{code:me.invalid_type,expected:be.array,received:n.parsedType}),De;if(s.exactLength!==null){const l=n.data.length>s.exactLength.value,u=n.data.length<s.exactLength.value;(l||u)&&(ve(n,{code:l?me.too_big:me.too_small,minimum:u?s.exactLength.value:void 0,maximum:l?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(ve(n,{code:me.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(ve(n,{code:me.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((l,u)=>s.type._parseAsync(new Vi(n,l,n.path,u)))).then(l=>Nn.mergeArray(r,l));const o=[...n.data].map((l,u)=>s.type._parseSync(new Vi(n,l,n.path,u)));return Nn.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new yr({...this._def,minLength:{value:t,message:we.toString(n)}})}max(t,n){return new yr({...this._def,maxLength:{value:t,message:we.toString(n)}})}length(t,n){return new yr({...this._def,exactLength:{value:t,message:we.toString(n)}})}nonempty(t){return this.min(1,t)}}yr.create=(e,t)=>new yr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:pe.ZodArray,...Be(t)});function Ea(e){if(e instanceof Mt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Gr.create(Ea(r))}return new Mt({...e._def,shape:()=>t})}else return e instanceof yr?new yr({...e._def,type:Ea(e.element)}):e instanceof Gr?Gr.create(Ea(e.unwrap())):e instanceof Ua?Ua.create(Ea(e.unwrap())):e instanceof Ns?Ns.create(e.items.map(t=>Ea(t))):e}class Mt extends Ye{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Xe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==be.object){const d=this._getOrReturnCtx(t);return ve(d,{code:me.invalid_type,expected:be.object,received:d.parsedType}),De}const{status:r,ctx:s}=this._processInputParams(t),{shape:o,keys:l}=this._getCached(),u=[];if(!(this._def.catchall instanceof Bi&&this._def.unknownKeys==="strip"))for(const d in s.data)l.includes(d)||u.push(d);const f=[];for(const d of l){const h=o[d],p=s.data[d];f.push({key:{status:"valid",value:d},value:h._parse(new Vi(s,p,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof Bi){const d=this._def.unknownKeys;if(d==="passthrough")for(const h of u)f.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(d==="strict")u.length>0&&(ve(s,{code:me.unrecognized_keys,keys:u}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const h of u){const p=s.data[h];f.push({key:{status:"valid",value:h},value:d._parse(new Vi(s,p,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const h of f){const p=await h.key,g=await h.value;d.push({key:p,value:g,alwaysSet:h.alwaysSet})}return d}).then(d=>Nn.mergeObjectSync(r,d)):Nn.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(t){return we.errToObj,new Mt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,l;const s=((l=(o=this._def).errorMap)==null?void 0:l.call(o,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:we.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new Mt({...this._def,unknownKeys:"strip"})}passthrough(){return new Mt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Mt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Mt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:pe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Mt({...this._def,catchall:t})}pick(t){const n={};for(const r of Xe.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Mt({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Xe.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Mt({...this._def,shape:()=>n})}deepPartial(){return Ea(this)}partial(t){const n={};for(const r of Xe.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new Mt({...this._def,shape:()=>n})}required(t){const n={};for(const r of Xe.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Gr;)o=o._def.innerType;n[r]=o}return new Mt({...this._def,shape:()=>n})}keyof(){return eT(Xe.objectKeys(this.shape))}}Mt.create=(e,t)=>new Mt({shape:()=>e,unknownKeys:"strip",catchall:Bi.create(),typeName:pe.ZodObject,...Be(t)});Mt.strictCreate=(e,t)=>new Mt({shape:()=>e,unknownKeys:"strict",catchall:Bi.create(),typeName:pe.ZodObject,...Be(t)});Mt.lazycreate=(e,t)=>new Mt({shape:e,unknownKeys:"strip",catchall:Bi.create(),typeName:pe.ZodObject,...Be(t)});class _f extends Ye{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(o){for(const u of o)if(u.result.status==="valid")return u.result;for(const u of o)if(u.result.status==="dirty")return n.common.issues.push(...u.ctx.common.issues),u.result;const l=o.map(u=>new Zr(u.ctx.common.issues));return ve(n,{code:me.invalid_union,unionErrors:l}),De}if(n.common.async)return Promise.all(r.map(async o=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(s);{let o;const l=[];for(const f of r){const d={...n,common:{...n.common,issues:[]},parent:null},h=f._parseSync({data:n.data,path:n.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!o&&(o={result:h,ctx:d}),d.common.issues.length&&l.push(d.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const u=l.map(f=>new Zr(f));return ve(n,{code:me.invalid_union,unionErrors:u}),De}}get options(){return this._def.options}}_f.create=(e,t)=>new _f({options:e,typeName:pe.ZodUnion,...Be(t)});function Fg(e,t){const n=Di(e),r=Di(t);if(e===t)return{valid:!0,data:e};if(n===be.object&&r===be.object){const s=Xe.objectKeys(t),o=Xe.objectKeys(e).filter(u=>s.indexOf(u)!==-1),l={...e,...t};for(const u of o){const f=Fg(e[u],t[u]);if(!f.valid)return{valid:!1};l[u]=f.data}return{valid:!0,data:l}}else if(n===be.array&&r===be.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o<e.length;o++){const l=e[o],u=t[o],f=Fg(l,u);if(!f.valid)return{valid:!1};s.push(f.data)}return{valid:!0,data:s}}else return n===be.date&&r===be.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Sf extends Ye{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(o,l)=>{if(fw(o)||fw(l))return De;const u=Fg(o.value,l.value);return u.valid?((dw(o)||dw(l))&&n.dirty(),{status:n.value,value:u.data}):(ve(r,{code:me.invalid_intersection_types}),De)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,l])=>s(o,l)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Sf.create=(e,t,n)=>new Sf({left:e,right:t,typeName:pe.ZodIntersection,...Be(n)});class Ns extends Ye{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==be.array)return ve(r,{code:me.invalid_type,expected:be.array,received:r.parsedType}),De;if(r.data.length<this._def.items.length)return ve(r,{code:me.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),De;!this._def.rest&&r.data.length>this._def.items.length&&(ve(r,{code:me.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((l,u)=>{const f=this._def.items[u]||this._def.rest;return f?f._parse(new Vi(r,l,r.path,u)):null}).filter(l=>!!l);return r.common.async?Promise.all(o).then(l=>Nn.mergeArray(n,l)):Nn.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Ns({...this._def,rest:t})}}Ns.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ns({items:e,typeName:pe.ZodTuple,rest:null,...Be(t)})};class bw extends Ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==be.map)return ve(r,{code:me.invalid_type,expected:be.map,received:r.parsedType}),De;const s=this._def.keyType,o=this._def.valueType,l=[...r.data.entries()].map(([u,f],d)=>({key:s._parse(new Vi(r,u,r.path,[d,"key"])),value:o._parse(new Vi(r,f,r.path,[d,"value"]))}));if(r.common.async){const u=new Map;return Promise.resolve().then(async()=>{for(const f of l){const d=await f.key,h=await f.value;if(d.status==="aborted"||h.status==="aborted")return De;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),u.set(d.value,h.value)}return{status:n.value,value:u}})}else{const u=new Map;for(const f of l){const d=f.key,h=f.value;if(d.status==="aborted"||h.status==="aborted")return De;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),u.set(d.value,h.value)}return{status:n.value,value:u}}}}bw.create=(e,t,n)=>new bw({valueType:t,keyType:e,typeName:pe.ZodMap,...Be(n)});class Pl extends Ye{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==be.set)return ve(r,{code:me.invalid_type,expected:be.set,received:r.parsedType}),De;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(ve(r,{code:me.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(ve(r,{code:me.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const o=this._def.valueType;function l(f){const d=new Set;for(const h of f){if(h.status==="aborted")return De;h.status==="dirty"&&n.dirty(),d.add(h.value)}return{status:n.value,value:d}}const u=[...r.data.values()].map((f,d)=>o._parse(new Vi(r,f,r.path,d)));return r.common.async?Promise.all(u).then(f=>l(f)):l(u)}min(t,n){return new Pl({...this._def,minSize:{value:t,message:we.toString(n)}})}max(t,n){return new Pl({...this._def,maxSize:{value:t,message:we.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Pl.create=(e,t)=>new Pl({valueType:e,minSize:null,maxSize:null,typeName:pe.ZodSet,...Be(t)});class ww extends Ye{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ww.create=(e,t)=>new ww({getter:e,typeName:pe.ZodLazy,...Be(t)});class _w extends Ye{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ve(n,{received:n.data,code:me.invalid_literal,expected:this._def.value}),De}return{status:"valid",value:t.data}}get value(){return this._def.value}}_w.create=(e,t)=>new _w({value:e,typeName:pe.ZodLiteral,...Be(t)});function eT(e,t){return new Va({values:e,typeName:pe.ZodEnum,...Be(t)})}class Va extends Ye{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ve(n,{expected:Xe.joinValues(r),received:n.parsedType,code:me.invalid_type}),De}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ve(n,{received:n.data,code:me.invalid_enum_value,options:r}),De}return Fn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Va.create(t,{...this._def,...n})}exclude(t,n=this._def){return Va.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Va.create=eT;class Sw extends Ye{_parse(t){const n=Xe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==be.string&&r.parsedType!==be.number){const s=Xe.objectValues(n);return ve(r,{expected:Xe.joinValues(s),received:r.parsedType,code:me.invalid_type}),De}if(this._cache||(this._cache=new Set(Xe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=Xe.objectValues(n);return ve(r,{received:r.data,code:me.invalid_enum_value,options:s}),De}return Fn(t.data)}get enum(){return this._def.values}}Sw.create=(e,t)=>new Sw({values:e,typeName:pe.ZodNativeEnum,...Be(t)});class Ef extends Ye{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==be.promise&&n.common.async===!1)return ve(n,{code:me.invalid_type,expected:be.promise,received:n.parsedType}),De;const r=n.parsedType===be.promise?n.data:Promise.resolve(n.data);return Fn(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Ef.create=(e,t)=>new Ef({type:e,typeName:pe.ZodPromise,...Be(t)});class Ba extends Ye{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:l=>{ve(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const l=s.transform(r.data,o);if(r.common.async)return Promise.resolve(l).then(async u=>{if(n.value==="aborted")return De;const f=await this._def.schema._parseAsync({data:u,path:r.path,parent:r});return f.status==="aborted"?De:f.status==="dirty"||n.value==="dirty"?bl(f.value):f});{if(n.value==="aborted")return De;const u=this._def.schema._parseSync({data:l,path:r.path,parent:r});return u.status==="aborted"?De:u.status==="dirty"||n.value==="dirty"?bl(u.value):u}}if(s.type==="refinement"){const l=u=>{const f=s.refinement(u,o);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(r.common.async===!1){const u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?De:(u.status==="dirty"&&n.dirty(),l(u.value),{status:n.value,value:u.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>u.status==="aborted"?De:(u.status==="dirty"&&n.dirty(),l(u.value).then(()=>({status:n.value,value:u.value}))))}if(s.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Pa(l))return De;const u=s.transform(l.value,o);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:u}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>Pa(l)?Promise.resolve(s.transform(l.value,o)).then(u=>({status:n.value,value:u})):De);Xe.assertNever(s)}}Ba.create=(e,t,n)=>new Ba({schema:e,typeName:pe.ZodEffects,effect:t,...Be(n)});Ba.createWithPreprocess=(e,t,n)=>new Ba({schema:t,effect:{type:"preprocess",transform:e},typeName:pe.ZodEffects,...Be(n)});class Gr extends Ye{_parse(t){return this._getType(t)===be.undefined?Fn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Gr.create=(e,t)=>new Gr({innerType:e,typeName:pe.ZodOptional,...Be(t)});class Ua extends Ye{_parse(t){return this._getType(t)===be.null?Fn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ua.create=(e,t)=>new Ua({innerType:e,typeName:pe.ZodNullable,...Be(t)});class $g extends Ye{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===be.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}$g.create=(e,t)=>new $g({innerType:e,typeName:pe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Be(t)});class qg extends Ye{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return bf(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Zr(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Zr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}qg.create=(e,t)=>new qg({innerType:e,typeName:pe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Be(t)});class Ew extends Ye{_parse(t){if(this._getType(t)!==be.nan){const r=this._getOrReturnCtx(t);return ve(r,{code:me.invalid_type,expected:be.nan,received:r.parsedType}),De}return{status:"valid",value:t.data}}}Ew.create=e=>new Ew({typeName:pe.ZodNaN,...Be(e)});class zD extends Ye{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Xy extends Ye{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?De:o.status==="dirty"?(n.dirty(),bl(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?De:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Xy({in:t,out:n,typeName:pe.ZodPipeline})}}class Gg extends Ye{_parse(t){const n=this._def.innerType._parse(t),r=s=>(Pa(s)&&(s.value=Object.freeze(s.value)),s);return bf(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Gg.create=(e,t)=>new Gg({innerType:e,typeName:pe.ZodReadonly,...Be(t)});var pe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(pe||(pe={}));const LD=Li.create,PD=Ia.create,ID=Hg.create;Bi.create;const VD=yr.create,lf=Mt.create;_f.create;Sf.create;Ns.create;Va.create;Ef.create;Gr.create;Ua.create;function BD(e){let t={};for(let r of e||[])t[r.name]=tT(r);let n=[];for(let r of e||[])r.required!==!1&&n.push(r.name);return{type:"object",properties:t,required:n}}function tT(e){var t,n,r;switch(e.type){case"string":return{type:"string",description:e.description,...e.enum&&{enum:e.enum}};case"number":case"boolean":return{type:e.type,description:e.description};case"object":case"object[]":const s=(t=e.attributes)==null?void 0:t.reduce((l,u)=>(l[u.name]=tT(u),l),{}),o=(n=e.attributes)==null?void 0:n.filter(l=>l.required!==!1).map(l=>l.name);return e.type==="object[]"?{type:"array",items:{type:"object",...s&&{properties:s},...o&&o.length>0&&{required:o}},description:e.description}:{type:"object",description:e.description,...s&&{properties:s},...o&&o.length>0&&{required:o}};default:return(r=e.type)!=null&&r.endsWith("[]")?{type:"array",items:{type:e.type.slice(0,-2)},description:e.description}:{type:"string",description:e.description}}}function UD(e){const t={};for(const[n,r]of Object.entries(e.properties))t[n]=Yg(r,e.required?e.required.includes(n):!1);return t}function Yg(e,t){if(e.type==="object"){const n={};if(!e.properties||!Object.keys(e.properties).length)return t?lf(n):lf(n).optional();for(const[s,o]of Object.entries(e.properties))n[s]=Yg(o,e.required?e.required.includes(s):!1);let r=lf(n).describe(e.description);return t?r:r.optional()}else if(e.type==="string"){let n=LD().describe(e.description);return t?n:n.optional()}else if(e.type==="number"){let n=PD().describe(e.description);return t?n:n.optional()}else if(e.type==="boolean"){let n=ID().describe(e.description);return t?n:n.optional()}else if(e.type==="array"){let n=Yg(e.items,!0),r=VD(n).describe(e.description);return t?r:r.optional()}throw new Error("Invalid JSON schema")}const HD=Symbol("Let zodToJsonSchema decide on which parser to use"),FD={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},$D=e=>({...FD,...e}),qD=e=>{const t=$D(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}};function nT(e,t,n,r){r!=null&&r.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function tt(e,t,n,r,s){e[t]=n,nT(e,t,r,s)}function GD(){return{}}function YD(e,t){var r,s,o;const n={type:"array"};return(r=e.type)!=null&&r._def&&((o=(s=e.type)==null?void 0:s._def)==null?void 0:o.typeName)!==pe.ZodAny&&(n.items=We(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&tt(n,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&tt(n,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(tt(n,"minItems",e.exactLength.value,e.exactLength.message,t),tt(n,"maxItems",e.exactLength.value,e.exactLength.message,t)),n}function ZD(e,t){const n={type:"integer",format:"int64"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"min":t.target==="jsonSchema7"?r.inclusive?tt(n,"minimum",r.value,r.message,t):tt(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),tt(n,"minimum",r.value,r.message,t));break;case"max":t.target==="jsonSchema7"?r.inclusive?tt(n,"maximum",r.value,r.message,t):tt(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),tt(n,"maximum",r.value,r.message,t));break;case"multipleOf":tt(n,"multipleOf",r.value,r.message,t);break}return n}function XD(){return{type:"boolean"}}function rT(e,t){return We(e.type._def,t)}const QD=(e,t)=>We(e.innerType._def,t);function iT(e,t,n){const r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((s,o)=>iT(e,t,s))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return KD(e,t)}}const KD=(e,t)=>{const n={type:"integer",format:"unix-time"};if(t.target==="openApi3")return n;for(const r of e.checks)switch(r.kind){case"min":tt(n,"minimum",r.value,r.message,t);break;case"max":tt(n,"maximum",r.value,r.message,t);break}return n};function WD(e,t){return{...We(e.innerType._def,t),default:e.defaultValue()}}function JD(e,t){return t.effectStrategy==="input"?We(e.schema._def,t):{}}function e4(e){return{type:"string",enum:Array.from(e.values)}}const t4=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function n4(e,t){const n=[We(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),We(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o);let r=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const s=[];return n.forEach(o=>{if(t4(o))s.push(...o.allOf),o.unevaluatedProperties===void 0&&(r=void 0);else{let l=o;if("additionalProperties"in o&&o.additionalProperties===!1){const{additionalProperties:u,...f}=o;l=f}else r=void 0;s.push(l)}}),s.length?{allOf:s,...r}:void 0}function r4(e,t){const n=typeof e.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[e.value]}:{type:n==="bigint"?"integer":n,const:e.value}}let Gm;const Qn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Gm===void 0&&(Gm=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Gm),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function sT(e,t){const n={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":tt(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":tt(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Kn(n,"email",r.message,t);break;case"format:idn-email":Kn(n,"idn-email",r.message,t);break;case"pattern:zod":nn(n,Qn.email,r.message,t);break}break;case"url":Kn(n,"uri",r.message,t);break;case"uuid":Kn(n,"uuid",r.message,t);break;case"regex":nn(n,r.regex,r.message,t);break;case"cuid":nn(n,Qn.cuid,r.message,t);break;case"cuid2":nn(n,Qn.cuid2,r.message,t);break;case"startsWith":nn(n,RegExp(`^${Ym(r.value,t)}`),r.message,t);break;case"endsWith":nn(n,RegExp(`${Ym(r.value,t)}$`),r.message,t);break;case"datetime":Kn(n,"date-time",r.message,t);break;case"date":Kn(n,"date",r.message,t);break;case"time":Kn(n,"time",r.message,t);break;case"duration":Kn(n,"duration",r.message,t);break;case"length":tt(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,t),tt(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":{nn(n,RegExp(Ym(r.value,t)),r.message,t);break}case"ip":{r.version!=="v6"&&Kn(n,"ipv4",r.message,t),r.version!=="v4"&&Kn(n,"ipv6",r.message,t);break}case"base64url":nn(n,Qn.base64url,r.message,t);break;case"jwt":nn(n,Qn.jwt,r.message,t);break;case"cidr":{r.version!=="v6"&&nn(n,Qn.ipv4Cidr,r.message,t),r.version!=="v4"&&nn(n,Qn.ipv6Cidr,r.message,t);break}case"emoji":nn(n,Qn.emoji(),r.message,t);break;case"ulid":{nn(n,Qn.ulid,r.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Kn(n,"binary",r.message,t);break}case"contentEncoding:base64":{tt(n,"contentEncoding","base64",r.message,t);break}case"pattern:zod":{nn(n,Qn.base64,r.message,t);break}}break}case"nanoid":nn(n,Qn.nanoid,r.message,t)}return n}function Ym(e,t){return t.patternStrategy==="escape"?s4(e):e}const i4=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function s4(e){let t="";for(let n=0;n<e.length;n++)i4.has(e[n])||(t+="\\"),t+=e[n];return t}function Kn(e,t,n,r){var s;e.format||(s=e.anyOf)!=null&&s.some(o=>o.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):tt(e,"format",t,n,r)}function nn(e,t,n,r){var s;e.pattern||(s=e.allOf)!=null&&s.some(o=>o.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:kw(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):tt(e,"pattern",kw(t,r),n,r)}function kw(e,t){var f;if(!t.applyRegexFlags||!e.flags)return e.source;const n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},r=n.i?e.source.toLowerCase():e.source;let s="",o=!1,l=!1,u=!1;for(let d=0;d<r.length;d++){if(o){s+=r[d],o=!1;continue}if(n.i){if(l){if(r[d].match(/[a-z]/)){u?(s+=r[d],s+=`${r[d-2]}-${r[d]}`.toUpperCase(),u=!1):r[d+1]==="-"&&((f=r[d+2])!=null&&f.match(/[a-z]/))?(s+=r[d],u=!0):s+=`${r[d]}${r[d].toUpperCase()}`;continue}}else if(r[d].match(/[a-z]/)){s+=`[${r[d]}${r[d].toUpperCase()}]`;continue}}if(n.m){if(r[d]==="^"){s+=`(^|(?<=[\r
|
|
50
|
+
]))`;continue}else if(r[d]==="$"){s+=`($|(?=[\r
|
|
51
|
+
]))`;continue}}if(n.s&&r[d]==="."){s+=l?`${r[d]}\r
|
|
52
|
+
`:`[${r[d]}\r
|
|
53
|
+
]`;continue}s+=r[d],r[d]==="\\"?o=!0:l&&r[d]==="]"?l=!1:!l&&r[d]==="["&&(l=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return s}function aT(e,t){var r,s,o,l,u,f;if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&((r=e.keyType)==null?void 0:r._def.typeName)===pe.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((d,h)=>({...d,[h]:We(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",h]})??{}}),{}),additionalProperties:t.rejectedAdditionalProperties};const n={type:"object",additionalProperties:We(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return n;if(((s=e.keyType)==null?void 0:s._def.typeName)===pe.ZodString&&((o=e.keyType._def.checks)!=null&&o.length)){const{type:d,...h}=sT(e.keyType._def,t);return{...n,propertyNames:h}}else{if(((l=e.keyType)==null?void 0:l._def.typeName)===pe.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};if(((u=e.keyType)==null?void 0:u._def.typeName)===pe.ZodBranded&&e.keyType._def.type._def.typeName===pe.ZodString&&((f=e.keyType._def.type._def.checks)!=null&&f.length)){const{type:d,...h}=rT(e.keyType._def,t);return{...n,propertyNames:h}}}return n}function a4(e,t){if(t.mapStrategy==="record")return aT(e,t);const n=We(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},r=We(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function o4(e){const t=e.values,r=Object.keys(e.values).filter(o=>typeof t[t[o]]!="number").map(o=>t[o]),s=Array.from(new Set(r.map(o=>typeof o)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:r}}function l4(){return{not:{}}}function u4(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const kf={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function c4(e,t){if(t.target==="openApi3")return Tw(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in kf&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((s,o)=>{const l=kf[o._def.typeName];return l&&!s.includes(l)?[...s,l]:s},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((s,o)=>{const l=typeof o._def.value;switch(l){case"string":case"number":case"boolean":return[...s,l];case"bigint":return[...s,"integer"];case"object":if(o._def.value===null)return[...s,"null"];case"symbol":case"undefined":case"function":default:return s}},[]);if(r.length===n.length){const s=r.filter((o,l,u)=>u.indexOf(o)===l);return{type:s.length>1?s:s[0],enum:n.reduce((o,l)=>o.includes(l._def.value)?o:[...o,l._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,s)=>[...r,...s._def.values.filter(o=>!r.includes(o))],[])};return Tw(e,t)}const Tw=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,s)=>We(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function f4(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:kf[e.innerType._def.typeName],nullable:!0}:{type:[kf[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){const r=We(e.innerType._def,{...t,currentPath:[...t.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}const n=We(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function d4(e,t){const n={type:"number"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"int":n.type="integer",nT(n,"type",r.message,t);break;case"min":t.target==="jsonSchema7"?r.inclusive?tt(n,"minimum",r.value,r.message,t):tt(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),tt(n,"minimum",r.value,r.message,t));break;case"max":t.target==="jsonSchema7"?r.inclusive?tt(n,"maximum",r.value,r.message,t):tt(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),tt(n,"maximum",r.value,r.message,t));break;case"multipleOf":tt(n,"multipleOf",r.value,r.message,t);break}return n}function h4(e,t){const n=t.target==="openAi",r={type:"object",properties:{}},s=[],o=e.shape();for(const u in o){let f=o[u];if(f===void 0||f._def===void 0)continue;let d=p4(f);d&&n&&(f instanceof Gr&&(f=f._def.innerType),f.isNullable()||(f=f.nullable()),d=!1);const h=We(f._def,{...t,currentPath:[...t.currentPath,"properties",u],propertyPath:[...t.currentPath,"properties",u]});h!==void 0&&(r.properties[u]=h,d||s.push(u))}s.length&&(r.required=s);const l=m4(e,t);return l!==void 0&&(r.additionalProperties=l),r}function m4(e,t){if(e.catchall._def.typeName!=="ZodNever")return We(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function p4(e){try{return e.isOptional()}catch{return!0}}const g4=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return We(e.innerType._def,t);const n=We(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:{}},n]}:{}},y4=(e,t)=>{if(t.pipeStrategy==="input")return We(e.in._def,t);if(t.pipeStrategy==="output")return We(e.out._def,t);const n=We(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=We(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(s=>s!==void 0)}};function v4(e,t){return We(e.type._def,t)}function x4(e,t){const r={type:"array",uniqueItems:!0,items:We(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&tt(r,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&tt(r,"maxItems",e.maxSize.value,e.maxSize.message,t),r}function b4(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>We(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:We(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>We(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function w4(){return{not:{}}}function _4(){return{}}const S4=(e,t)=>We(e.innerType._def,t),E4=(e,t,n)=>{switch(t){case pe.ZodString:return sT(e,n);case pe.ZodNumber:return d4(e,n);case pe.ZodObject:return h4(e,n);case pe.ZodBigInt:return ZD(e,n);case pe.ZodBoolean:return XD();case pe.ZodDate:return iT(e,n);case pe.ZodUndefined:return w4();case pe.ZodNull:return u4(n);case pe.ZodArray:return YD(e,n);case pe.ZodUnion:case pe.ZodDiscriminatedUnion:return c4(e,n);case pe.ZodIntersection:return n4(e,n);case pe.ZodTuple:return b4(e,n);case pe.ZodRecord:return aT(e,n);case pe.ZodLiteral:return r4(e,n);case pe.ZodEnum:return e4(e);case pe.ZodNativeEnum:return o4(e);case pe.ZodNullable:return f4(e,n);case pe.ZodOptional:return g4(e,n);case pe.ZodMap:return a4(e,n);case pe.ZodSet:return x4(e,n);case pe.ZodLazy:return()=>e.getter()._def;case pe.ZodPromise:return v4(e,n);case pe.ZodNaN:case pe.ZodNever:return l4();case pe.ZodEffects:return JD(e,n);case pe.ZodAny:return GD();case pe.ZodUnknown:return _4();case pe.ZodDefault:return WD(e,n);case pe.ZodBranded:return rT(e,n);case pe.ZodReadonly:return S4(e,n);case pe.ZodCatch:return QD(e,n);case pe.ZodPipeline:return y4(e,n);case pe.ZodFunction:case pe.ZodVoid:case pe.ZodSymbol:return;default:return(r=>{})()}};function We(e,t,n=!1){var u;const r=t.seen.get(e);if(t.override){const f=(u=t.override)==null?void 0:u.call(t,e,t,r,n);if(f!==HD)return f}if(r&&!n){const f=k4(r,t);if(f!==void 0)return f}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const o=E4(e,e.typeName,t),l=typeof o=="function"?We(o(),t):o;if(l&&C4(e,t,l),t.postProcess){const f=t.postProcess(l,e,t);return s.jsonSchema=l,f}return s.jsonSchema=l,l}const k4=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:T4(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):t.$refStrategy==="seen"?{}:void 0}},T4=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")},C4=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),A4=(e,t)=>{const n=qD(t),r=void 0,s=t==null?void 0:t.name,o=We(e._def,n,!1)??{},l=s===void 0?r?{...o,[n.definitionPath]:r}:o:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:{...r,[s]:o}};return n.target==="jsonSchema7"?l.$schema="http://json-schema.org/draft-07/schema#":(n.target==="jsonSchema2019-09"||n.target==="openAi")&&(l.$schema="https://json-schema.org/draft/2019-09/schema#"),n.target==="openAi"&&("anyOf"in l||"oneOf"in l||"allOf"in l||"type"in l&&Array.isArray(l.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),l},N4=e=>({name:e.name,description:e.description||"",parameters:UD(BD(e.parameters||[])),returnDirect:e.returnDirect,callbackMessage:e.callbackMessage,allowAgent:e.allowAgent,allowGraph:e.allowGraph,async execute(t,n){var r;try{const s=await((r=e.handler)==null?void 0:r.call(e,t,n));return typeof s=="string"?[{type:"text",text:s}]:[{type:"text",text:JSON.stringify(s)}]}catch(s){return[{type:"text",text:`Error: ${s}`}]}}}),M4=e=>({name:e.name,description:e.description,parameters:A4(lf(e.parameters))}),Ha=e=>({...N4(e),render:e.render,onlyRender:e.onlyRender});class oT{constructor(){this.tools=new Map,this.waitingMap=new Map}bindTool(t){if(this.tools.has(t.name))throw new Error(`Tool with name ${t.name} already exists`);this.tools.set(t.name,t)}bindTools(t){t.forEach(n=>this.bindTool(n))}getAllTools(){return Array.from(this.tools.values())}getTool(t){return this.tools.get(t)}removeTool(t){return this.tools.delete(t)}clearTools(){this.tools.clear()}reset(){this.clearTools(),this.clearWaiting()}clearWaiting(){this.waitingMap.clear()}async callTool(t,n,r){const s=this.getTool(t);if(!s)throw new Error(`Tool with name ${t} not found`);return await s.execute(n,r)}toJSON(t,n=!0){return Array.from(this.tools.values()).filter(r=>n?!r.onlyRender:!0).filter(r=>!r.allowGraph||r.allowGraph.includes(t)).map(r=>M4(r))}doneWaiting(t,n){return this.waitingMap.has(t)?(this.waitingMap.get(t)(n),this.waitingMap.delete(t),!0):(console.warn(`Waiting for tool ${t} not found`),!1)}waitForDone(t){return this.waitingMap.has(t)?this.waitingMap.get(t):new Promise((r,s)=>{this.waitingMap.set(t,r)})}static waitForUIDone(t,n){return n.client.tools.waitForDone(n.message.id)}}class Zm{static isUser(t){return t.type==="human"}static isTool(t){return t.type==="tool"}static isAssistant(t){return t.type==="ai"&&!this.isToolAssistant(t)}static isToolAssistant(t){var n,r;return t.type==="ai"&&(((n=t.tool_calls)==null?void 0:n.length)||((r=t.tool_call_chunks)==null?void 0:r.length))}}class O4 extends uD{constructor(t){super(t),this.currentAssistant=null,this.currentThread=null,this.streamingCallbacks=new Set,this.tools=new oT,this.stopController=null,this.availableAssistants=[],this.streamingMessage=[],this.graphMessages=[],this.graphState={},this.graphPosition="",this.extraParams={}}listAssistants(){return this.assistants.search({metadata:null,offset:0,limit:100})}async initAssistant(t){try{const n=await this.listAssistants();if(this.availableAssistants=n,n.length>0)if(t){if(this.currentAssistant=n.find(r=>r.graph_id===t)||null,!this.currentAssistant)throw new Error("Agent not found: "+t)}else this.currentAssistant=n[0];else throw new Error("No assistants found")}catch(n){throw console.error("Failed to initialize LangGraphClient:",n),n}}async createThread({threadId:t}={}){try{return this.currentThread=await this.threads.create({threadId:t}),this.currentThread}catch(n){throw console.error("Failed to create new thread:",n),n}}graphVisualize(){var t;return this.assistants.getGraph((t=this.currentAssistant)==null?void 0:t.assistant_id,{xray:!0})}async listThreads(){return this.threads.search({sortOrder:"desc"})}async resetThread(t,n){await this.initAssistant(t),this.currentThread=await this.threads.get(n),this.graphState=this.currentThread.values,this.graphMessages=this.graphState.messages,this.emitStreamingUpdate({type:"value",data:{event:"messages/partial",data:{messages:this.graphMessages}}})}cloneMessage(t){return JSON.parse(JSON.stringify(t))}updateStreamingMessage(t){const n=this.streamingMessage[this.streamingMessage.length-1];if(!(n!=null&&n.id)||t.id!==n.id){this.streamingMessage.push(t);return}this.streamingMessage[this.streamingMessage.length-1]=t}combineGraphMessagesWithStreamingMessages(){const t=new Map(this.streamingMessage.map(n=>[n.id,n]));return[...this.graphMessages.map(n=>{if(t.has(n.id)){const r=t.get(n.id);return t.delete(n.id),r}return n}),...t.values()]}get renderMessage(){var o;const t=new Map,n=new Set,r=[],s=this.combineGraphMessagesWithStreamingMessages();for(let l=s.length-1;l>=0;l--){const u=this.cloneMessage(s[l]);if(!u.id){r.unshift(u);continue}if(u.type==="ai"&&(u.name||(u.name=this.getGraphNodeNow().name)),Zm.isToolAssistant(u)){const f=u;t.set(u.id,f);const h=((o=f.tool_calls)!=null&&o.length?f.tool_calls:f.tool_call_chunks).filter(p=>!n.has(p.id)).map((p,g)=>{var v,b,w,_;return{type:"tool",additional_kwargs:{},tool_input:(_=(w=(b=(v=f.additional_kwargs)==null?void 0:v.tool_calls)==null?void 0:b[g])==null?void 0:w.function)==null?void 0:_.arguments,id:p.id,name:p.name,response_metadata:{},tool_call_id:p.id,content:""}});for(const p of h)t.has(p.id)||(r.unshift(p),t.set(p.id,p));r.unshift(f)}else u.type==="tool"&&u.tool_call_id&&n.add(u.tool_call_id),t.set(u.id,u),r.unshift(u)}return this.attachInfoForMessage(this.composeToolMessages(r))}attachInfoForMessage(t){var r,s,o;let n=null;for(const l of t){const u=((r=l.response_metadata)==null?void 0:r.create_time)||"";if(l.unique_id=l.tool_call_id||l.id,l.spend_time=new Date(u).getTime()-new Date(((s=n==null?void 0:n.response_metadata)==null?void 0:s.create_time)||u).getTime(),!l.usage_metadata&&((o=l.response_metadata)!=null&&o.usage)){const f=l.response_metadata.usage;l.usage_metadata={...f,input_tokens:f.prompt_tokens,output_tokens:f.completion_tokens,total_tokens:f.total_tokens}}n=l}return t}composeToolMessages(t){var o,l;const n=[],r=new Map,s=new Map;for(const u of t)if(!(Zm.isToolAssistant(u)&&((o=u.tool_calls||u.tool_call_chunks)==null||o.forEach(f=>{r.set(f.id,f),s.set(f.id,u)}),!u.content))){if(Zm.isTool(u)&&!u.tool_input){const f=r.get(u.tool_call_id),d=s.get(u.tool_call_id);f&&(u.tool_input=typeof f.args!="string"?JSON.stringify(f.args):f.args,u.additional_kwargs?(u.additional_kwargs.done=!0,u.done=!0):(u.done=!0,u.additional_kwargs={done:!0})),d&&(u.usage_metadata=d.usage_metadata,u.node_name=d.name,u.name||(u.name=(l=d.tool_calls.find(h=>h.id===u.tool_call_id))==null?void 0:l.name))}n.push(u)}return n}get tokenCounter(){return this.graphMessages.reduce((t,n)=>{var r,s,o,l,u;if(n.usage_metadata)t.total_tokens+=((r=n.usage_metadata)==null?void 0:r.total_tokens)||0,t.input_tokens+=((s=n.usage_metadata)==null?void 0:s.input_tokens)||0,t.output_tokens+=((o=n.usage_metadata)==null?void 0:o.output_tokens)||0;else if((l=n.response_metadata)!=null&&l.usage){const f=(u=n.response_metadata)==null?void 0:u.usage;t.total_tokens+=f.total_tokens||0,t.input_tokens+=f.prompt_tokens||0,t.output_tokens+=f.completion_tokens||0}return t},{total_tokens:0,input_tokens:0,output_tokens:0})}onStreamingUpdate(t){return this.streamingCallbacks.add(t),()=>{this.streamingCallbacks.delete(t)}}emitStreamingUpdate(t){this.streamingCallbacks.forEach(n=>n(t))}isFELocking(t){var s;const n=t[t.length-1];if(!n)return!1;const r=this.tools.getTool(n==null?void 0:n.name);return r&&r.render&&(n==null?void 0:n.type)==="tool"&&!((s=n==null?void 0:n.additional_kwargs)!=null&&s.done)}cancelRun(){var t,n;(t=this.currentThread)!=null&&t.thread_id&&((n=this.currentRun)!=null&&n.run_id)&&this.runs.cancel(this.currentThread.thread_id,this.currentRun.run_id)}async sendMessage(t,{extraParams:n,_debug:r,command:s}={}){var d;if(!this.currentAssistant)throw new Error("Thread or Assistant not initialized");this.currentThread||(await this.createThread(),this.emitStreamingUpdate({type:"thread",data:{event:"thread/create",data:{thread:this.currentThread}}}));const o=Array.isArray(t)?t:[{type:"human",content:t}],l=(r==null?void 0:r.streamResponse)||this.runs.stream(this.currentThread.thread_id,this.currentAssistant.assistant_id,{input:{...this.graphState,...this.extraParams,...n||{},messages:o,fe_tools:this.tools.toJSON(this.currentAssistant.graph_id)},streamMode:["messages","values"],streamSubgraphs:!0,command:s}),u=[];this.emitStreamingUpdate({type:"start",data:{event:"start"}});for await(const h of l)if(u.push(h),h.event==="metadata")this.currentRun=h.data;else if(h.event==="error")this.emitStreamingUpdate({type:"error",data:h});else if(h.event==="messages/partial"){for(const p of h.data)this.updateStreamingMessage(p);this.emitStreamingUpdate({type:"message",data:h});continue}else if(h.event==="values"){const p=h.data;if(p.messages){const g=!!(s!=null&&s.resume),v=p.messages.length>=this.graphMessages.length;(!g||g&&v)&&(this.graphMessages=p.messages,this.emitStreamingUpdate({type:"value",data:h})),this.graphState=h.data}continue}else h.event.startsWith("values|")&&((d=h.data)!=null&&d.messages&&this.mergeSubGraphMessagesToStreamingMessages(h.data.messages),this.graphPosition=h.event.split("|")[1]);const f=await this.runFETool();return f&&u.push(...f),this.emitStreamingUpdate({type:"done",data:{event:"done"}}),this.streamingMessage=[],u}getGraphPosition(){return this.graphPosition.split("|").map(t=>{const[n,r]=t.split(":");return{id:r,name:n}})}getGraphNodeNow(){const t=this.getGraphPosition();return t[t.length-1]}mergeSubGraphMessagesToStreamingMessages(t){const n=new Map(t.filter(r=>r.id).map(r=>[r.id,r]));this.streamingMessage.forEach(r=>{if(n.has(r.id)){const s=n.get(r.id);Object.assign(r,s),n.delete(r.id)}}),n.forEach(r=>{r.type==="tool"&&r.tool_call_id&&this.streamingMessage.push(r)})}runFETool(){var r;const t=this.streamingMessage,n=t[t.length-1];if(n&&n.type==="ai"&&(r=n.tool_calls)!=null&&r.length){const s=n.tool_calls.map(o=>{if(this.tools.getTool(o.name)){const l={...o,tool_call_id:o.id,tool_input:JSON.stringify(o.args),additional_kwargs:{}};return this.callFETool(l,o.args)}});return this.currentThread.status="interrupted",Promise.all(s)}}async callFETool(t,n){const r=this,s=await this.tools.callTool(t.name,n,{client:r,message:t});return this.resume(s)}resume(t){return this.sendMessage([],{command:{resume:t}})}doneFEToolWaiting(t,n){var s;!this.tools.doneWaiting(t,n)&&((s=this.currentThread)==null?void 0:s.status)==="interrupted"&&this.resume(n)}getCurrentThread(){return this.currentThread}getCurrentAssistant(){return this.currentAssistant}async reset(){var t;await this.initAssistant((t=this.currentAssistant)==null?void 0:t.graph_id),this.currentThread=null,this.graphState={},this.graphMessages=[],this.streamingMessage=[],this.currentRun=void 0,this.tools.clearWaiting(),this.emitStreamingUpdate({type:"value",data:{event:"messages/partial"}})}}let Wn=[],Ai=0;const Vc=4;let kn=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},lc:0,listen(r){return n.lc=t.push(r),()=>{for(let o=Ai+Vc;o<Wn.length;)Wn[o]===r?Wn.splice(o,Vc):o+=Vc;let s=t.indexOf(r);~s&&(t.splice(s,1),--n.lc)}},notify(r,s){let o=!Wn.length;for(let l of t)Wn.push(l,n.value,r,s);if(o){for(Ai=0;Ai<Wn.length;Ai+=Vc)Wn[Ai](Wn[Ai+1],Wn[Ai+2],Wn[Ai+3]);Wn.length=0}},off(){},set(r){let s=n.value;s!==r&&(n.value=r,n.notify(s))},subscribe(r){let s=n.listen(r);return r(n.value),s},value:e};return n};function R4(e,t,n){let r=new Set(t).add(void 0);return e.listen((s,o,l)=>{r.has(l)&&n(s,o,l)})}function D4(e){let t=null,n=null;return function(...r){n=r,t!==null&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{n!==null&&(e(...n),n=null),t=null})}}const j4=e=>e.toLocaleTimeString("en-US"),z4=e=>e.toLocaleString("en"),Qy=e=>typeof e=="string"?e:Array.isArray(e)?e.map(t=>typeof t=="string"?t:t.type==="text"?t.text:t.type==="image_url"?"[图片]":JSON.stringify(t)).join(""):JSON.stringify(e),L4=e=>{var n,r,s;const t=(s=(r=(n=e==null?void 0:e.values)==null?void 0:n.messages)==null?void 0:r[0])==null?void 0:s.content;return t&&Array.isArray(t)?t.map(o=>{if(o.type==="text")return o.text}):typeof t=="string"?t:""},P4=(e,t,n={})=>{const r=kn(null),s=kn([]),o=kn(""),l=kn(!1),u=kn([]),f=kn(null),d=kn(n.showHistory??!1),h=kn(e),p=kn(null),g=kn("__start__"),v=kn(n.showGraph??!1),b=kn(null),w=async()=>{var O;v.get()&&b.set(await((O=r.get())==null?void 0:O.graphVisualize())||null)},_=D4(O=>{const V=O.renderMessage,H=V[V.length-1];g.set((H==null?void 0:H.node_name)||(H==null?void 0:H.name)||"__start__"),s.set(V)});async function E(){var V;const O=new O4(t);return await O.initAssistant(h.get()),h.set(O.getCurrentAssistant().graph_id),f.set(null),O.onStreamingUpdate(H=>{if(H.type==="start"&&l.set(!0),H.type==="thread"||H.type==="done")return g.set("__start__"),H.type==="done"&&l.set(!1),B();H.type==="error"&&(l.set(!1),f.set(H.data)),_(O)}),(V=n.onInit)==null||V.call(n,O),O.graphState={},r.set(O),v.get()&&w(),O}const T=async(O,V)=>{var H;!o.get().trim()&&!(O!=null&&O.length)||l.get()||!r.get()||(l.set(!0),f.set(null),await((H=r.get())==null?void 0:H.sendMessage(O||o.get(),V)),o.set(""),l.set(!1))},S=()=>{var O;(O=r.get())==null||O.cancelRun()},M=O=>{const V=u.get();u.set(V.includes(O)?V.filter(H=>H!==O):[...V,O])},D=()=>{d.set(!d.get()),d.get()&&B()},R=kn([]),B=async()=>{var O;if(!(!r.get()||!d.get()))try{const V=await((O=r.get())==null?void 0:O.listThreads());R.set(V||[])}catch(V){console.error("Failed to fetch threads:",V)}};return{data:{client:r,renderMessages:s,userInput:o,loading:l,inChatError:f,currentAgent:h,collapsedTools:u,showHistory:d,historyList:R,currentChatId:p,showGraph:v,graphVisualize:b,currentNodeName:g},mutations:{isFELocking(){var O;return(O=r.get())==null?void 0:O.isFELocking(s.get())},initClient:E,sendMessage:T,stopGeneration:S,toggleToolCollapse:M,toggleHistoryVisible:D,refreshHistoryList:B,addToHistory:O=>{const V=R.get();R.set([O,...V])},setUserInput(O){o.set(O)},setCurrentAgent(O){return h.set(O),E().then(()=>{d.get()&&B()})},toggleGraphVisible(){v.set(!v.get()),v.get()&&w()},refreshGraph:w,createNewChat(){var O;(O=r.get())==null||O.reset(),f.set(null),l.set(!1)},toHistoryChat(O){var V,H;f.set(null),l.set(!1),(H=r.get())==null||H.resetThread((V=O.metadata)==null?void 0:V.graph_id,O.thread_id)},async deleteHistoryChat(O){var V;await((V=r.get())==null?void 0:V.threads.delete(O.thread_id)),await B()},getToolUIRender:O=>{var Q;const H=(Q=r.get().tools.getAllTools().find(j=>j.name===O))==null?void 0:Q.render;return H?j=>H(new rj(j,r.get())):null}}}};class xa extends Error{constructor(t,n){super("".concat(t," at position ").concat(n)),this.position=n}}const lT=32,I4=10,uT=9,cT=13,V4=160,B4=8192,U4=8202,H4=8239,F4=8287,$4=12288;function q4(e){return/^[0-9A-Fa-f]$/.test(e)}function ds(e){return e>="0"&&e<="9"}function G4(e){return e>=" "}function Bc(e){return`,:[]/{}()
|
|
54
|
+
+`.includes(e)}function Cw(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"}function Aw(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"||e>="0"&&e<="9"}const Nw=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,Mw=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function Ow(e){return`,[]/{}
|
|
55
|
+
+`.includes(e)}function Rw(e){return uf(e)||Y4.test(e)}const Y4=/^[[{\w-]$/;function Z4(e){return e===`
|
|
56
|
+
`||e==="\r"||e===" "||e==="\b"||e==="\f"}function ys(e,t){const n=e.charCodeAt(t);return n===lT||n===I4||n===uT||n===cT}function X4(e,t){const n=e.charCodeAt(t);return n===lT||n===uT||n===cT}function Q4(e,t){const n=e.charCodeAt(t);return n===V4||n>=B4&&n<=U4||n===H4||n===F4||n===$4}function uf(e){return fT(e)||Zg(e)}function fT(e){return e==='"'||e==="“"||e==="”"}function Dw(e){return e==='"'}function Zg(e){return e==="'"||e==="‘"||e==="’"||e==="`"||e==="´"}function jw(e){return e==="'"}function fl(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const r=e.lastIndexOf(t);return r!==-1?e.substring(0,r)+(n?"":e.substring(r+1)):e}function Jn(e,t){let n=e.length;if(!ys(e,n-1))return e+t;for(;ys(e,n-1);)n--;return e.substring(0,n)+t+e.substring(n)}function K4(e,t,n){return e.substring(0,t)+e.substring(t+n)}function W4(e){return/[,\n][ \t\r]*$/.test(e)}const J4={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},ej={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
57
|
+
`,r:"\r",t:" "};function tj(e){let t=0,n="";d(),o()||Q(),d();const s=h(",");for(s&&l(),Rw(e[t])&&W4(n)?(s||(n=Jn(n,",")),_()):s&&(n=fl(n,","));e[t]==="}"||e[t]==="]";)t++,l();if(t>=e.length)return n;H();function o(){l();const P=b()||w()||E()||S()||M()||R(!1)||B();return l(),P}function l(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;const Y=t;let Z=u(P);do Z=f(),Z&&(Z=u(P));while(Z);return t>Y}function u(P){const Y=P?ys:X4;let Z="";for(;;)if(Y(e,t))Z+=e[t],t++;else if(Q4(e,t))Z+=" ",t++;else break;return Z.length>0?(n+=Z,!0):!1}function f(){if(e[t]==="/"&&e[t+1]==="*"){for(;t<e.length&&!nj(e,t);)t++;return t+=2,!0}if(e[t]==="/"&&e[t+1]==="/"){for(;t<e.length&&e[t]!==`
|
|
58
|
+
`;)t++;return!0}return!1}function d(){if(e.slice(t,t+3)==="```"){if(t+=3,Cw(e[t]))for(;t<e.length&&Aw(e[t]);)t++;return l(),!0}return!1}function h(P){return e[t]===P?(n+=e[t],t++,!0):!1}function p(P){return e[t]===P?(t++,!0):!1}function g(){return p("\\")}function v(){return l(),e[t]==="."&&e[t+1]==="."&&e[t+2]==="."?(t+=3,l(),p(","),!0):!1}function b(){if(e[t]==="{"){n+="{",t++,l(),p(",")&&l();let P=!0;for(;t<e.length&&e[t]!=="}";){let Y;if(P?(Y=!0,P=!1):(Y=h(","),Y||(n=Jn(n,",")),l()),v(),!(E()||R(!0))){e[t]==="}"||e[t]==="{"||e[t]==="]"||e[t]==="["||e[t]===void 0?n=fl(n,","):j();break}l();const k=h(":"),G=t>=e.length;k||(Rw(e[t])||G?n=Jn(n,":"):$()),o()||(k||G?n+="null":$())}return e[t]==="}"?(n+="}",t++):n=Jn(n,"}"),!0}return!1}function w(){if(e[t]==="["){n+="[",t++,l(),p(",")&&l();let P=!0;for(;t<e.length&&e[t]!=="]";)if(P?P=!1:h(",")||(n=Jn(n,",")),v(),!o()){n=fl(n,",");break}return e[t]==="]"?(n+="]",t++):n=Jn(n,"]"),!0}return!1}function _(){let P=!0,Y=!0;for(;Y;)P?P=!1:h(",")||(n=Jn(n,",")),Y=o();Y||(n=fl(n,",")),n=`[
|
|
59
|
+
`.concat(n,`
|
|
60
|
+
]`)}function E(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,Z=e[t]==="\\";if(Z&&(t++,Z=!0),uf(e[t])){const k=Dw(e[t])?Dw:jw(e[t])?jw:Zg(e[t])?Zg:fT,G=t,te=n.length;let C='"';for(t++;;){if(t>=e.length){const F=z(t-1);return!P&&Bc(e.charAt(F))?(t=G,n=n.substring(0,te),E(!0)):(C=Jn(C,'"'),n+=C,!0)}else{if(t===Y)return C=Jn(C,'"'),n+=C,!0;if(k(e[t])){const F=t,W=C.length;if(C+='"',t++,n+=C,l(!1),P||t>=e.length||Bc(e[t])||uf(e[t])||ds(e[t]))return T(),!0;const J=z(F-1),oe=e.charAt(J);if(oe===",")return t=G,n=n.substring(0,te),E(!1,J);if(Bc(oe))return t=G,n=n.substring(0,te),E(!0);n=n.substring(0,te),t=F+1,C="".concat(C.substring(0,W),"\\").concat(C.substring(W))}else if(P&&Ow(e[t])){if(e[t-1]===":"&&Nw.test(e.substring(G+1,t+2)))for(;t<e.length&&Mw.test(e[t]);)C+=e[t],t++;return C=Jn(C,'"'),n+=C,T(),!0}else if(e[t]==="\\"){const F=e.charAt(t+1);if(ej[F]!==void 0)C+=e.slice(t,t+2),t+=2;else if(F==="u"){let J=2;for(;J<6&&q4(e[t+J]);)J++;J===6?(C+=e.slice(t,t+6),t+=6):t+J>=e.length?t=e.length:I()}else C+=F,t+=2}else{const F=e.charAt(t);F==='"'&&e[t-1]!=="\\"?(C+="\\".concat(F),t++):Z4(F)?(C+=J4[F],t++):(G4(F)||V(F),C+=F,t++)}}Z&&g()}}return!1}function T(){let P=!1;for(l();e[t]==="+";){P=!0,t++,l(),n=fl(n,'"',!0);const Y=n.length;E()?n=K4(n,Y,1):n=Jn(n,'"')}return P}function S(){const P=t;if(e[t]==="-"){if(t++,U())return O(P),!0;if(!ds(e[t]))return t=P,!1}for(;ds(e[t]);)t++;if(e[t]==="."){if(t++,U())return O(P),!0;if(!ds(e[t]))return t=P,!1;for(;ds(e[t]);)t++}if(e[t]==="e"||e[t]==="E"){if(t++,(e[t]==="-"||e[t]==="+")&&t++,U())return O(P),!0;if(!ds(e[t]))return t=P,!1;for(;ds(e[t]);)t++}if(!U())return t=P,!1;if(t>P){const Y=e.slice(P,t),Z=/^0\d/.test(Y);return n+=Z?'"'.concat(Y,'"'):Y,!0}return!1}function M(){return D("true","true")||D("false","false")||D("null","null")||D("True","true")||D("False","false")||D("None","null")}function D(P,Y){return e.slice(t,t+P.length)===P?(n+=Y,t+=P.length,!0):!1}function R(P){const Y=t;if(Cw(e[t])){for(;t<e.length&&Aw(e[t]);)t++;let Z=t;for(;ys(e,Z);)Z++;if(e[Z]==="(")return t=Z+1,o(),e[t]===")"&&(t++,e[t]===";"&&t++),!0}for(;t<e.length&&!Ow(e[t])&&!uf(e[t])&&(!P||e[t]!==":");)t++;if(e[t-1]===":"&&Nw.test(e.substring(Y,t+2)))for(;t<e.length&&Mw.test(e[t]);)t++;if(t>Y){for(;ys(e,t-1)&&t>0;)t--;const Z=e.slice(Y,t);return n+=Z==="undefined"?"null":JSON.stringify(Z),e[t]==='"'&&t++,!0}}function B(){if(e[t]==="/"){const P=t;for(t++;t<e.length&&(e[t]!=="/"||e[t-1]==="\\");)t++;return t++,n+='"'.concat(e.substring(P,t),'"'),!0}}function z(P){let Y=P;for(;Y>0&&ys(e,Y);)Y--;return Y}function U(){return t>=e.length||Bc(e[t])||ys(e,t)}function O(P){n+="".concat(e.slice(P,t),"0")}function V(P){throw new xa("Invalid character ".concat(JSON.stringify(P)),t)}function H(){throw new xa("Unexpected character ".concat(JSON.stringify(e[t])),t)}function Q(){throw new xa("Unexpected end of json string",e.length)}function j(){throw new xa("Object key expected",t)}function $(){throw new xa("Colon expected",t)}function I(){const P=e.slice(t,t+6);throw new xa('Invalid unicode character "'.concat(P,'"'),t)}}function nj(e,t){return e[t]==="*"&&e[t+1]==="/"}class rj{constructor(t,n){this.message=t,this.client=n}get state(){var t,n;return this.message.type==="tool"&&((n=(t=this.message)==null?void 0:t.additional_kwargs)!=null&&n.done)?"done":this.message.tool_input?"loading":"idle"}get input(){try{return JSON.parse(this.message.tool_input)}catch{return null}}get output(){return Qy(this.message.content)}getJSONOutput(){return JSON.parse(this.output)}getJSONOutputSafe(){try{return JSON.parse(this.output)}catch{return null}}getInputRepaired(){try{return JSON.parse(tj(this.message.tool_input||""))}catch{return{}}}response(t){this.client.doneFEToolWaiting(this.message.id,JSON.stringify(t))}}const ij=(e,t)=>({...Object.fromEntries(Object.entries(e.data).map(([r,s])=>[r,t(s)])),...e.mutations});function sj(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const aj=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oj=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lj={};function zw(e,t){return(lj.jsx?oj:aj).test(e)}const uj=/[ \t\n\f\r]/g;function cj(e){return typeof e=="object"?e.type==="text"?Lw(e.value):!1:Lw(e)}function Lw(e){return e.replace(uj,"")===""}class iu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}iu.prototype.normal={};iu.prototype.property={};iu.prototype.space=void 0;function dT(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new iu(n,r,t)}function Xg(e){return e.toLowerCase()}class gn{constructor(t,n){this.attribute=n,this.property=t}}gn.prototype.attribute="";gn.prototype.booleanish=!1;gn.prototype.boolean=!1;gn.prototype.commaOrSpaceSeparated=!1;gn.prototype.commaSeparated=!1;gn.prototype.defined=!1;gn.prototype.mustUseProperty=!1;gn.prototype.number=!1;gn.prototype.overloadedBoolean=!1;gn.prototype.property="";gn.prototype.spaceSeparated=!1;gn.prototype.space=void 0;let fj=0;const Le=Ds(),Nt=Ds(),hT=Ds(),he=Ds(),ct=Ds(),ja=Ds(),Tn=Ds();function Ds(){return 2**++fj}const Qg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Le,booleanish:Nt,commaOrSpaceSeparated:Tn,commaSeparated:ja,number:he,overloadedBoolean:hT,spaceSeparated:ct},Symbol.toStringTag,{value:"Module"})),Xm=Object.keys(Qg);class Ky extends gn{constructor(t,n,r,s){let o=-1;if(super(t,n),Pw(this,"space",s),typeof r=="number")for(;++o<Xm.length;){const l=Xm[o];Pw(this,Xm[o],(r&Qg[l])===Qg[l])}}}Ky.prototype.defined=!0;function Pw(e,t,n){n&&(e[t]=n)}function Ja(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const o=new Ky(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Xg(r)]=r,n[Xg(o.attribute)]=r}return new iu(t,n,e.space)}const mT=Ja({properties:{ariaActiveDescendant:null,ariaAtomic:Nt,ariaAutoComplete:null,ariaBusy:Nt,ariaChecked:Nt,ariaColCount:he,ariaColIndex:he,ariaColSpan:he,ariaControls:ct,ariaCurrent:null,ariaDescribedBy:ct,ariaDetails:null,ariaDisabled:Nt,ariaDropEffect:ct,ariaErrorMessage:null,ariaExpanded:Nt,ariaFlowTo:ct,ariaGrabbed:Nt,ariaHasPopup:null,ariaHidden:Nt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ct,ariaLevel:he,ariaLive:null,ariaModal:Nt,ariaMultiLine:Nt,ariaMultiSelectable:Nt,ariaOrientation:null,ariaOwns:ct,ariaPlaceholder:null,ariaPosInSet:he,ariaPressed:Nt,ariaReadOnly:Nt,ariaRelevant:null,ariaRequired:Nt,ariaRoleDescription:ct,ariaRowCount:he,ariaRowIndex:he,ariaRowSpan:he,ariaSelected:Nt,ariaSetSize:he,ariaSort:null,ariaValueMax:he,ariaValueMin:he,ariaValueNow:he,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function pT(e,t){return t in e?e[t]:t}function gT(e,t){return pT(e,t.toLowerCase())}const dj=Ja({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ja,acceptCharset:ct,accessKey:ct,action:null,allow:null,allowFullScreen:Le,allowPaymentRequest:Le,allowUserMedia:Le,alt:null,as:null,async:Le,autoCapitalize:null,autoComplete:ct,autoFocus:Le,autoPlay:Le,blocking:ct,capture:null,charSet:null,checked:Le,cite:null,className:ct,cols:he,colSpan:null,content:null,contentEditable:Nt,controls:Le,controlsList:ct,coords:he|ja,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Le,defer:Le,dir:null,dirName:null,disabled:Le,download:hT,draggable:Nt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Le,formTarget:null,headers:ct,height:he,hidden:Le,high:he,href:null,hrefLang:null,htmlFor:ct,httpEquiv:ct,id:null,imageSizes:null,imageSrcSet:null,inert:Le,inputMode:null,integrity:null,is:null,isMap:Le,itemId:null,itemProp:ct,itemRef:ct,itemScope:Le,itemType:ct,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Le,low:he,manifest:null,max:null,maxLength:he,media:null,method:null,min:null,minLength:he,multiple:Le,muted:Le,name:null,nonce:null,noModule:Le,noValidate:Le,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Le,optimum:he,pattern:null,ping:ct,placeholder:null,playsInline:Le,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Le,referrerPolicy:null,rel:ct,required:Le,reversed:Le,rows:he,rowSpan:he,sandbox:ct,scope:null,scoped:Le,seamless:Le,selected:Le,shadowRootClonable:Le,shadowRootDelegatesFocus:Le,shadowRootMode:null,shape:null,size:he,sizes:null,slot:null,span:he,spellCheck:Nt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:he,step:null,style:null,tabIndex:he,target:null,title:null,translate:null,type:null,typeMustMatch:Le,useMap:null,value:Nt,width:he,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ct,axis:null,background:null,bgColor:null,border:he,borderColor:null,bottomMargin:he,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Le,declare:Le,event:null,face:null,frame:null,frameBorder:null,hSpace:he,leftMargin:he,link:null,longDesc:null,lowSrc:null,marginHeight:he,marginWidth:he,noResize:Le,noHref:Le,noShade:Le,noWrap:Le,object:null,profile:null,prompt:null,rev:null,rightMargin:he,rules:null,scheme:null,scrolling:Nt,standby:null,summary:null,text:null,topMargin:he,valueType:null,version:null,vAlign:null,vLink:null,vSpace:he,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Le,disableRemotePlayback:Le,prefix:null,property:null,results:he,security:null,unselectable:null},space:"html",transform:gT}),hj=Ja({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Tn,accentHeight:he,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:he,amplitude:he,arabicForm:null,ascent:he,attributeName:null,attributeType:null,azimuth:he,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:he,by:null,calcMode:null,capHeight:he,className:ct,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:he,diffuseConstant:he,direction:null,display:null,dur:null,divisor:he,dominantBaseline:null,download:Le,dx:null,dy:null,edgeMode:null,editable:null,elevation:he,enableBackground:null,end:null,event:null,exponent:he,externalResourcesRequired:null,fill:null,fillOpacity:he,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ja,g2:ja,glyphName:ja,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:he,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:he,horizOriginX:he,horizOriginY:he,id:null,ideographic:he,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:he,k:he,k1:he,k2:he,k3:he,k4:he,kernelMatrix:Tn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:he,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:he,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:he,overlineThickness:he,paintOrder:null,panose1:null,path:null,pathLength:he,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:he,pointsAtY:he,pointsAtZ:he,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Tn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Tn,rev:Tn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Tn,requiredFeatures:Tn,requiredFonts:Tn,requiredFormats:Tn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:he,specularExponent:he,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:he,strikethroughThickness:he,string:null,stroke:null,strokeDashArray:Tn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:he,strokeOpacity:he,strokeWidth:null,style:null,surfaceScale:he,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Tn,tabIndex:he,tableValues:null,target:null,targetX:he,targetY:he,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Tn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:he,underlineThickness:he,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:he,values:null,vAlphabetic:he,vMathematical:he,vectorEffect:null,vHanging:he,vIdeographic:he,version:null,vertAdvY:he,vertOriginX:he,vertOriginY:he,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:he,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:pT}),yT=Ja({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),vT=Ja({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gT}),xT=Ja({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),mj={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},pj=/[A-Z]/g,Iw=/-[a-z]/g,gj=/^data[-\w.:]+$/i;function yj(e,t){const n=Xg(t);let r=t,s=gn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&gj.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Iw,xj);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Iw.test(o)){let l=o.replace(pj,vj);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}s=Ky}return new s(r,t)}function vj(e){return"-"+e.toLowerCase()}function xj(e){return e.charAt(1).toUpperCase()}const bj=dT([mT,dj,yT,vT,xT],"html"),Wy=dT([mT,hj,yT,vT,xT],"svg");function wj(e){return e.join(" ").trim()}var ba={},Qm,Vw;function _j(){if(Vw)return Qm;Vw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,f=`
|
|
61
|
+
`,d="/",h="*",p="",g="comment",v="declaration";Qm=function(w,_){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];_=_||{};var E=1,T=1;function S(Q){var j=Q.match(t);j&&(E+=j.length);var $=Q.lastIndexOf(f);T=~$?Q.length-$:T+Q.length}function M(){var Q={line:E,column:T};return function(j){return j.position=new D(Q),z(),j}}function D(Q){this.start=Q,this.end={line:E,column:T},this.source=_.source}D.prototype.content=w;function R(Q){var j=new Error(_.source+":"+E+":"+T+": "+Q);if(j.reason=Q,j.filename=_.source,j.line=E,j.column=T,j.source=w,!_.silent)throw j}function B(Q){var j=Q.exec(w);if(j){var $=j[0];return S($),w=w.slice($.length),j}}function z(){B(n)}function U(Q){var j;for(Q=Q||[];j=O();)j!==!1&&Q.push(j);return Q}function O(){var Q=M();if(!(d!=w.charAt(0)||h!=w.charAt(1))){for(var j=2;p!=w.charAt(j)&&(h!=w.charAt(j)||d!=w.charAt(j+1));)++j;if(j+=2,p===w.charAt(j-1))return R("End of comment missing");var $=w.slice(2,j-2);return T+=2,S($),w=w.slice(j),T+=2,Q({type:g,comment:$})}}function V(){var Q=M(),j=B(r);if(j){if(O(),!B(s))return R("property missing ':'");var $=B(o),I=Q({type:v,property:b(j[0].replace(e,p)),value:$?b($[0].replace(e,p)):p});return B(l),I}}function H(){var Q=[];U(Q);for(var j;j=V();)j!==!1&&(Q.push(j),U(Q));return Q}return z(),H()};function b(w){return w?w.replace(u,p):p}return Qm}var Bw;function Sj(){if(Bw)return ba;Bw=1;var e=ba&&ba.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ba,"__esModule",{value:!0}),ba.default=n;var t=e(_j());function n(r,s){var o=null;if(!r||typeof r!="string")return o;var l=(0,t.default)(r),u=typeof s=="function";return l.forEach(function(f){if(f.type==="declaration"){var d=f.property,h=f.value;u?s(d,h,f):h&&(o=o||{},o[d]=h)}}),o}return ba}var dl={},Uw;function Ej(){if(Uw)return dl;Uw=1,Object.defineProperty(dl,"__esModule",{value:!0}),dl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(d){return!d||n.test(d)||e.test(d)},l=function(d,h){return h.toUpperCase()},u=function(d,h){return"".concat(h,"-")},f=function(d,h){return h===void 0&&(h={}),o(d)?d:(d=d.toLowerCase(),h.reactCompat?d=d.replace(s,u):d=d.replace(r,u),d.replace(t,l))};return dl.camelCase=f,dl}var hl,Hw;function kj(){if(Hw)return hl;Hw=1;var e=hl&&hl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(Sj()),n=Ej();function r(s,o){var l={};return!s||typeof s!="string"||(0,t.default)(s,function(u,f){u&&f&&(l[(0,n.camelCase)(u,o)]=f)}),l}return r.default=r,hl=r,hl}var Tj=kj();const Cj=Fi(Tj),bT=wT("end"),Jy=wT("start");function wT(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Aj(e){const t=Jy(e),n=bT(e);if(t&&n)return{start:t,end:n}}function El(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Fw(e.position):"start"in e||"end"in e?Fw(e):"line"in e||"column"in e?Kg(e):""}function Kg(e){return $w(e&&e.line)+":"+$w(e&&e.column)}function Fw(e){return Kg(e&&e.start)+"-"+Kg(e&&e.end)}function $w(e){return e&&typeof e=="number"?e:1}class Wt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",o={},l=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(l=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?o.ruleId=r:(o.source=r.slice(0,f),o.ruleId=r.slice(f+1))}if(!o.place&&o.ancestors&&o.ancestors){const f=o.ancestors[o.ancestors.length-1];f&&(o.place=f.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file,this.message=s,this.line=u?u.line:void 0,this.name=El(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}}Wt.prototype.file="";Wt.prototype.name="";Wt.prototype.reason="";Wt.prototype.message="";Wt.prototype.stack="";Wt.prototype.column=void 0;Wt.prototype.line=void 0;Wt.prototype.ancestors=void 0;Wt.prototype.cause=void 0;Wt.prototype.fatal=void 0;Wt.prototype.place=void 0;Wt.prototype.ruleId=void 0;Wt.prototype.source=void 0;const e0={}.hasOwnProperty,Nj=new Map,Mj=/[A-Z]/g,Oj=new Set(["table","tbody","thead","tfoot","tr"]),Rj=new Set(["td","th"]),_T="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Dj(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Uj(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Bj(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Wy:bj,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=ST(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function ST(e,t,n){if(t.type==="element")return jj(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return zj(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Pj(e,t,n);if(t.type==="mdxjsEsm")return Lj(e,t);if(t.type==="root")return Ij(e,t,n);if(t.type==="text")return Vj(e,t)}function jj(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Wy,e.schema=s),e.ancestors.push(t);const o=kT(e,t.tagName,!1),l=Hj(e,t);let u=n0(e,t);return Oj.has(t.tagName)&&(u=u.filter(function(f){return typeof f=="string"?!cj(f):!0})),ET(e,l,o,t),t0(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function zj(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Il(e,t.position)}function Lj(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Il(e,t.position)}function Pj(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Wy,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:kT(e,t.name,!0),l=Fj(e,t),u=n0(e,t);return ET(e,l,o,t),t0(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function Ij(e,t,n){const r={};return t0(r,n0(e,t)),e.create(t,e.Fragment,r,n)}function Vj(e,t){return t.value}function ET(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function t0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Bj(e,t,n){return r;function r(s,o,l,u){const d=Array.isArray(l.children)?n:t;return u?d(o,l,u):d(o,l)}}function Uj(e,t){return n;function n(r,s,o,l){const u=Array.isArray(o.children),f=Jy(r);return t(s,o,l,u,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function Hj(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&e0.call(t.properties,s)){const o=$j(e,s,t.properties[s]);if(o){const[l,u]=o;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&Rj.has(t.tagName)?r=u:n[l]=u}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Fj(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const l=o.expression;l.type;const u=l.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else Il(e,t.position);else{const s=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const u=r.value.data.estree.body[0];u.type,o=e.evaluater.evaluateExpression(u.expression)}else Il(e,t.position);else o=r.value===null?!0:r.value;n[s]=o}return n}function n0(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:Nj;for(;++r<t.children.length;){const o=t.children[r];let l;if(e.passKeys){const f=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(f){const d=s.get(f)||0;l=f+"-"+d,s.set(f,d+1)}}const u=ST(e,o,l);u!==void 0&&n.push(u)}return n}function $j(e,t,n){const r=yj(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?sj(n):wj(n)),r.property==="style"){let s=typeof n=="object"?n:qj(e,String(n));return e.stylePropertyNameCase==="css"&&(s=Gj(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?mj[r.property]||r.property:r.attribute,n]}}function qj(e,t){try{return Cj(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Wt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=_T+"#cannot-parse-style-attribute",s}}function kT(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,l;for(;++o<s.length;){const u=zw(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(o&&u.type==="Literal"),optional:!1}:u}r=l}else r=zw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return e0.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Il(e)}function Il(e,t){const n=new Wt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=_T+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Gj(e){const t={};let n;for(n in e)e0.call(e,n)&&(t[Yj(n)]=e[n]);return t}function Yj(e){let t=e.replace(Mj,Zj);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Zj(e){return"-"+e.toLowerCase()}const Km={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Xj={};function r0(e,t){const n=Xj,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return TT(e,r,s)}function TT(e,t,n){if(Qj(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return qw(e.children,t,n)}return Array.isArray(e)?qw(e,t,n):""}function qw(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=TT(e[s],t,n);return r.join("")}function Qj(e){return!!(e&&typeof e=="object")}const Gw=document.createElement("i");function i0(e){const t="&"+e+";";Gw.innerHTML=t;const n=Gw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function An(e,t,n,r){const s=e.length;let o=0,l;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);o<r.length;)l=r.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function Un(e,t){return e.length>0?(An(e,e.length,0,t),e):t}const Yw={}.hasOwnProperty;function CT(e){const t={};let n=-1;for(;++n<e.length;)Kj(t,e[n]);return t}function Kj(e,t){let n;for(n in t){const s=(Yw.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let l;if(o)for(l in o){Yw.call(s,l)||(s[l]=[]);const u=o[l];Wj(s[l],Array.isArray(u)?u:u?[u]:[])}}}function Wj(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);An(e,0,0,r)}function AT(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ir(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rn=$i(/[A-Za-z]/),Qt=$i(/[\dA-Za-z]/),Jj=$i(/[#-'*+\--9=?A-Z^-~]/);function Tf(e){return e!==null&&(e<32||e===127)}const Wg=$i(/\d/),ez=$i(/[\dA-Fa-f]/),tz=$i(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function at(e){return e!==null&&(e<0||e===32)}function Fe(e){return e===-2||e===-1||e===32}const Wf=$i(new RegExp("\\p{P}|\\p{S}","u")),Ms=$i(/\s/);function $i(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function eo(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&Qt(e.charCodeAt(n+1))&&Qt(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const u=e.charCodeAt(n+1);o<56320&&u>56319&&u<57344?(l=String.fromCharCode(o,u),s=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function qe(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(f){return Fe(f)?(e.enter(n),u(f)):t(f)}function u(f){return Fe(f)&&o++<s?(e.consume(f),u):(e.exit(n),t(f))}}const nz={tokenize:rz};function rz(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),qe(e,t,"linePrefix")}function s(u){return e.enter("paragraph"),o(u)}function o(u){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(u)}function l(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return Ce(u)?(e.consume(u),e.exit("chunkText"),o):(e.consume(u),l)}}const iz={tokenize:sz},Zw={tokenize:az};function sz(e){const t=this,n=[];let r=0,s,o,l;return u;function u(S){if(r<n.length){const M=n[r];return t.containerState=M[1],e.attempt(M[0].continuation,f,d)(S)}return d(S)}function f(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&T();const M=t.events.length;let D=M,R;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){R=t.events[D][1].end;break}E(r);let B=M;for(;B<t.events.length;)t.events[B][1].end={...R},B++;return An(t.events,D+1,0,t.events.slice(M)),t.events.length=B,d(S)}return u(S)}function d(S){if(r===n.length){if(!s)return g(S);if(s.currentConstruct&&s.currentConstruct.concrete)return b(S);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Zw,h,p)(S)}function h(S){return s&&T(),E(r),g(S)}function p(S){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,b(S)}function g(S){return t.containerState={},e.attempt(Zw,v,b)(S)}function v(S){return r++,n.push([t.currentConstruct,t.containerState]),g(S)}function b(S){if(S===null){s&&T(),E(0),e.consume(S);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),w(S)}function w(S){if(S===null){_(e.exit("chunkFlow"),!0),E(0),e.consume(S);return}return Ce(S)?(e.consume(S),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,u):(e.consume(S),w)}function _(S,M){const D=t.sliceStream(S);if(M&&D.push(null),S.previous=o,o&&(o.next=S),o=S,s.defineSkip(S.start),s.write(D),t.parser.lazy[S.start.line]){let R=s.events.length;for(;R--;)if(s.events[R][1].start.offset<l&&(!s.events[R][1].end||s.events[R][1].end.offset>l))return;const B=t.events.length;let z=B,U,O;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(U){O=t.events[z][1].end;break}U=!0}for(E(r),R=B;R<t.events.length;)t.events[R][1].end={...O},R++;An(t.events,z+1,0,t.events.slice(B)),t.events.length=R}}function E(S){let M=n.length;for(;M-- >S;){const D=n[M];t.containerState=D[1],D[0].exit.call(t,e)}n.length=S}function T(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function az(e,t,n){return qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Fa(e){if(e===null||at(e)||Ms(e))return 1;if(Wf(e))return 2}function Jf(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Jg={name:"attention",resolveAll:oz,tokenize:lz};function oz(e,t){let n=-1,r,s,o,l,u,f,d,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},g={...e[n][1].start};Xw(p,-f),Xw(g,f),l={type:f>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},u={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},o={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:f>1?"strong":"emphasis",start:{...l.start},end:{...u.end}},e[r][1].end={...l.start},e[n][1].start={...u.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=Un(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Un(d,[["enter",s,t],["enter",l,t],["exit",l,t],["enter",o,t]]),d=Un(d,Jf(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Un(d,[["exit",o,t],["enter",u,t],["exit",u,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,d=Un(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,An(e,r-1,n-r+3,d),n=r+d.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function lz(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Fa(r);let o;return l;function l(f){return o=f,e.enter("attentionSequence"),u(f)}function u(f){if(f===o)return e.consume(f),u;const d=e.exit("attentionSequence"),h=Fa(f),p=!h||h===2&&s||n.includes(f),g=!s||s===2&&h||n.includes(r);return d._open=!!(o===42?p:p&&(s||!g)),d._close=!!(o===42?g:g&&(h||!p)),t(f)}}function Xw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const uz={name:"autolink",tokenize:cz};function cz(e,t,n){let r=0;return s;function s(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(v){return rn(v)?(e.consume(v),l):v===64?n(v):d(v)}function l(v){return v===43||v===45||v===46||Qt(v)?(r=1,u(v)):d(v)}function u(v){return v===58?(e.consume(v),r=0,f):(v===43||v===45||v===46||Qt(v))&&r++<32?(e.consume(v),u):(r=0,d(v))}function f(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||Tf(v)?n(v):(e.consume(v),f)}function d(v){return v===64?(e.consume(v),h):Jj(v)?(e.consume(v),d):n(v)}function h(v){return Qt(v)?p(v):n(v)}function p(v){return v===46?(e.consume(v),r=0,h):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):g(v)}function g(v){if((v===45||Qt(v))&&r++<63){const b=v===45?g:p;return e.consume(v),b}return n(v)}}const su={partial:!0,tokenize:fz};function fz(e,t,n){return r;function r(o){return Fe(o)?qe(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||Ce(o)?t(o):n(o)}}const NT={continuation:{tokenize:hz},exit:mz,name:"blockQuote",tokenize:dz};function dz(e,t,n){const r=this;return s;function s(l){if(l===62){const u=r.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return n(l)}function o(l){return Fe(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function hz(e,t,n){const r=this;return s;function s(l){return Fe(l)?qe(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(NT,t,n)(l)}}function mz(e){e.exit("blockQuote")}const MT={name:"characterEscape",tokenize:pz};function pz(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return tz(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const OT={name:"characterReference",tokenize:gz};function gz(e,t,n){const r=this;let s=0,o,l;return u;function u(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),f}function f(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),o=31,l=Qt,h(p))}function d(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=ez,h):(e.enter("characterReferenceValue"),o=7,l=Wg,h(p))}function h(p){if(p===59&&s){const g=e.exit("characterReferenceValue");return l===Qt&&!i0(r.sliceSerialize(g))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(p)&&s++<o?(e.consume(p),h):n(p)}}const Qw={partial:!0,tokenize:vz},Kw={concrete:!0,name:"codeFenced",tokenize:yz};function yz(e,t,n){const r=this,s={partial:!0,tokenize:D};let o=0,l=0,u;return f;function f(R){return d(R)}function d(R){const B=r.events[r.events.length-1];return o=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,u=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(R)}function h(R){return R===u?(l++,e.consume(R),h):l<3?n(R):(e.exit("codeFencedFenceSequence"),Fe(R)?qe(e,p,"whitespace")(R):p(R))}function p(R){return R===null||Ce(R)?(e.exit("codeFencedFence"),r.interrupt?t(R):e.check(Qw,w,M)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(R))}function g(R){return R===null||Ce(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(R)):Fe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),qe(e,v,"whitespace")(R)):R===96&&R===u?n(R):(e.consume(R),g)}function v(R){return R===null||Ce(R)?p(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(R))}function b(R){return R===null||Ce(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(R)):R===96&&R===u?n(R):(e.consume(R),b)}function w(R){return e.attempt(s,M,_)(R)}function _(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),E}function E(R){return o>0&&Fe(R)?qe(e,T,"linePrefix",o+1)(R):T(R)}function T(R){return R===null||Ce(R)?e.check(Qw,w,M)(R):(e.enter("codeFlowValue"),S(R))}function S(R){return R===null||Ce(R)?(e.exit("codeFlowValue"),T(R)):(e.consume(R),S)}function M(R){return e.exit("codeFenced"),t(R)}function D(R,B,z){let U=0;return O;function O($){return R.enter("lineEnding"),R.consume($),R.exit("lineEnding"),V}function V($){return R.enter("codeFencedFence"),Fe($)?qe(R,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):H($)}function H($){return $===u?(R.enter("codeFencedFenceSequence"),Q($)):z($)}function Q($){return $===u?(U++,R.consume($),Q):U>=l?(R.exit("codeFencedFenceSequence"),Fe($)?qe(R,j,"whitespace")($):j($)):z($)}function j($){return $===null||Ce($)?(R.exit("codeFencedFence"),B($)):z($)}}}function vz(e,t,n){const r=this;return s;function s(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Wm={name:"codeIndented",tokenize:bz},xz={partial:!0,tokenize:wz};function bz(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),qe(e,o,"linePrefix",5)(d)}function o(d){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?l(d):n(d)}function l(d){return d===null?f(d):Ce(d)?e.attempt(xz,l,f)(d):(e.enter("codeFlowValue"),u(d))}function u(d){return d===null||Ce(d)?(e.exit("codeFlowValue"),l(d)):(e.consume(d),u)}function f(d){return e.exit("codeIndented"),t(d)}}function wz(e,t,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Ce(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):qe(e,o,"linePrefix",5)(l)}function o(l){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):Ce(l)?s(l):n(l)}}const _z={name:"codeText",previous:Ez,resolve:Sz,tokenize:kz};function Sz(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function Ez(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function kz(e,t,n){let r=0,s,o;return l;function l(p){return e.enter("codeText"),e.enter("codeTextSequence"),u(p)}function u(p){return p===96?(e.consume(p),r++,u):(e.exit("codeTextSequence"),f(p))}function f(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),f):p===96?(o=e.enter("codeTextSequence"),s=0,h(p)):Ce(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),f):(e.enter("codeTextData"),d(p))}function d(p){return p===null||p===32||p===96||Ce(p)?(e.exit("codeTextData"),f(p)):(e.consume(p),d)}function h(p){return p===96?(e.consume(p),s++,h):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",d(p))}}class Tz{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&ml(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ml(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ml(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ml(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ml(this.left,n.reverse())}}}function ml(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function RT(e){const t={};let n=-1,r,s,o,l,u,f,d;const h=new Tz(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,o=0,o<f.length&&f[o][1].type==="lineEndingBlank"&&(o+=2),o<f.length&&f[o][1].type==="content"))for(;++o<f.length&&f[o][1].type!=="content";)f[o][1].type==="chunkText"&&(f[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Cz(h,n)),n=t[n],d=!0);else if(r[1]._container){for(o=n,s=void 0;o--;)if(l=h.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(s&&(h.get(s)[1].type="lineEndingBlank"),l[1].type="lineEnding",s=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;s&&(r[1].end={...h.get(s)[1].start},u=h.slice(s,n),u.unshift(r),h.splice(s,n-s+1,u))}}return An(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!d}function Cz(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const o=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,f=[],d={};let h,p,g=-1,v=n,b=0,w=0;const _=[w];for(;v;){for(;e.get(++s)[1]!==v;);o.push(s),v._tokenizer||(h=r.sliceStream(v),v.next||h.push(null),p&&l.defineSkip(v.start),v._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(h),v._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=v,v=v.next}for(v=n;++g<u.length;)u[g][0]==="exit"&&u[g-1][0]==="enter"&&u[g][1].type===u[g-1][1].type&&u[g][1].start.line!==u[g][1].end.line&&(w=g+1,_.push(w),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(l.events=[],v?(v._tokenizer=void 0,v.previous=void 0):_.pop(),g=_.length;g--;){const E=u.slice(_[g],_[g+1]),T=o.pop();f.push([T,T+E.length-1]),e.splice(T,2,E)}for(f.reverse(),g=-1;++g<f.length;)d[b+f[g][0]]=b+f[g][1],b+=f[g][1]-f[g][0]-1;return d}const Az={resolve:Mz,tokenize:Oz},Nz={partial:!0,tokenize:Rz};function Mz(e){return RT(e),e}function Oz(e,t){let n;return r;function r(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(u)}function s(u){return u===null?o(u):Ce(u)?e.check(Nz,l,o)(u):(e.consume(u),s)}function o(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function Rz(e,t,n){const r=this;return s;function s(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),qe(e,o,"linePrefix")}function o(l){if(l===null||Ce(l))return n(l);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function DT(e,t,n,r,s,o,l,u,f){const d=f||Number.POSITIVE_INFINITY;let h=0;return p;function p(E){return E===60?(e.enter(r),e.enter(s),e.enter(o),e.consume(E),e.exit(o),g):E===null||E===32||E===41||Tf(E)?n(E):(e.enter(r),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),w(E))}function g(E){return E===62?(e.enter(o),e.consume(E),e.exit(o),e.exit(s),e.exit(r),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),v(E))}function v(E){return E===62?(e.exit("chunkString"),e.exit(u),g(E)):E===null||E===60||Ce(E)?n(E):(e.consume(E),E===92?b:v)}function b(E){return E===60||E===62||E===92?(e.consume(E),v):v(E)}function w(E){return!h&&(E===null||E===41||at(E))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),t(E)):h<d&&E===40?(e.consume(E),h++,w):E===41?(e.consume(E),h--,w):E===null||E===32||E===40||Tf(E)?n(E):(e.consume(E),E===92?_:w)}function _(E){return E===40||E===41||E===92?(e.consume(E),w):w(E)}}function jT(e,t,n,r,s,o){const l=this;let u=0,f;return d;function d(v){return e.enter(r),e.enter(s),e.consume(v),e.exit(s),e.enter(o),h}function h(v){return u>999||v===null||v===91||v===93&&!f||v===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(e.exit(o),e.enter(s),e.consume(v),e.exit(s),e.exit(r),t):Ce(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Ce(v)||u++>999?(e.exit("chunkString"),h(v)):(e.consume(v),f||(f=!Fe(v)),v===92?g:p)}function g(v){return v===91||v===92||v===93?(e.consume(v),u++,p):p(v)}}function zT(e,t,n,r,s,o){let l;return u;function u(g){return g===34||g===39||g===40?(e.enter(r),e.enter(s),e.consume(g),e.exit(s),l=g===40?41:g,f):n(g)}function f(g){return g===l?(e.enter(s),e.consume(g),e.exit(s),e.exit(r),t):(e.enter(o),d(g))}function d(g){return g===l?(e.exit(o),f(l)):g===null?n(g):Ce(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),qe(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===l||g===null||Ce(g)?(e.exit("chunkString"),d(g)):(e.consume(g),g===92?p:h)}function p(g){return g===l||g===92?(e.consume(g),h):h(g)}}function kl(e,t){let n;return r;function r(s){return Ce(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Fe(s)?qe(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const Dz={name:"definition",tokenize:zz},jz={partial:!0,tokenize:Lz};function zz(e,t,n){const r=this;let s;return o;function o(v){return e.enter("definition"),l(v)}function l(v){return jT.call(r,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function u(v){return s=ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),f):n(v)}function f(v){return at(v)?kl(e,d)(v):d(v)}function d(v){return DT(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function h(v){return e.attempt(jz,p,p)(v)}function p(v){return Fe(v)?qe(e,g,"whitespace")(v):g(v)}function g(v){return v===null||Ce(v)?(e.exit("definition"),r.parser.defined.push(s),t(v)):n(v)}}function Lz(e,t,n){return r;function r(u){return at(u)?kl(e,s)(u):n(u)}function s(u){return zT(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return Fe(u)?qe(e,l,"whitespace")(u):l(u)}function l(u){return u===null||Ce(u)?t(u):n(u)}}const Pz={name:"hardBreakEscape",tokenize:Iz};function Iz(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return Ce(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const Vz={name:"headingAtx",resolve:Bz,tokenize:Uz};function Bz(e,t){let n=e.length-2,r=3,s,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},An(e,r,n-r+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function Uz(e,t,n){let r=0;return s;function s(h){return e.enter("atxHeading"),o(h)}function o(h){return e.enter("atxHeadingSequence"),l(h)}function l(h){return h===35&&r++<6?(e.consume(h),l):h===null||at(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),f(h)):h===null||Ce(h)?(e.exit("atxHeading"),t(h)):Fe(h)?qe(e,u,"whitespace")(h):(e.enter("atxHeadingText"),d(h))}function f(h){return h===35?(e.consume(h),f):(e.exit("atxHeadingSequence"),u(h))}function d(h){return h===null||h===35||at(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),d)}}const Hz=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ww=["pre","script","style","textarea"],Fz={concrete:!0,name:"htmlFlow",resolveTo:Gz,tokenize:Yz},$z={partial:!0,tokenize:Xz},qz={partial:!0,tokenize:Zz};function Gz(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Yz(e,t,n){const r=this;let s,o,l,u,f;return d;function d(C){return h(C)}function h(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),p}function p(C){return C===33?(e.consume(C),g):C===47?(e.consume(C),o=!0,w):C===63?(e.consume(C),s=3,r.interrupt?t:k):rn(C)?(e.consume(C),l=String.fromCharCode(C),_):n(C)}function g(C){return C===45?(e.consume(C),s=2,v):C===91?(e.consume(C),s=5,u=0,b):rn(C)?(e.consume(C),s=4,r.interrupt?t:k):n(C)}function v(C){return C===45?(e.consume(C),r.interrupt?t:k):n(C)}function b(C){const F="CDATA[";return C===F.charCodeAt(u++)?(e.consume(C),u===F.length?r.interrupt?t:H:b):n(C)}function w(C){return rn(C)?(e.consume(C),l=String.fromCharCode(C),_):n(C)}function _(C){if(C===null||C===47||C===62||at(C)){const F=C===47,W=l.toLowerCase();return!F&&!o&&Ww.includes(W)?(s=1,r.interrupt?t(C):H(C)):Hz.includes(l.toLowerCase())?(s=6,F?(e.consume(C),E):r.interrupt?t(C):H(C)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(C):o?T(C):S(C))}return C===45||Qt(C)?(e.consume(C),l+=String.fromCharCode(C),_):n(C)}function E(C){return C===62?(e.consume(C),r.interrupt?t:H):n(C)}function T(C){return Fe(C)?(e.consume(C),T):O(C)}function S(C){return C===47?(e.consume(C),O):C===58||C===95||rn(C)?(e.consume(C),M):Fe(C)?(e.consume(C),S):O(C)}function M(C){return C===45||C===46||C===58||C===95||Qt(C)?(e.consume(C),M):D(C)}function D(C){return C===61?(e.consume(C),R):Fe(C)?(e.consume(C),D):S(C)}function R(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),f=C,B):Fe(C)?(e.consume(C),R):z(C)}function B(C){return C===f?(e.consume(C),f=null,U):C===null||Ce(C)?n(C):(e.consume(C),B)}function z(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||at(C)?D(C):(e.consume(C),z)}function U(C){return C===47||C===62||Fe(C)?S(C):n(C)}function O(C){return C===62?(e.consume(C),V):n(C)}function V(C){return C===null||Ce(C)?H(C):Fe(C)?(e.consume(C),V):n(C)}function H(C){return C===45&&s===2?(e.consume(C),I):C===60&&s===1?(e.consume(C),P):C===62&&s===4?(e.consume(C),G):C===63&&s===3?(e.consume(C),k):C===93&&s===5?(e.consume(C),Z):Ce(C)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check($z,te,Q)(C)):C===null||Ce(C)?(e.exit("htmlFlowData"),Q(C)):(e.consume(C),H)}function Q(C){return e.check(qz,j,te)(C)}function j(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),$}function $(C){return C===null||Ce(C)?Q(C):(e.enter("htmlFlowData"),H(C))}function I(C){return C===45?(e.consume(C),k):H(C)}function P(C){return C===47?(e.consume(C),l="",Y):H(C)}function Y(C){if(C===62){const F=l.toLowerCase();return Ww.includes(F)?(e.consume(C),G):H(C)}return rn(C)&&l.length<8?(e.consume(C),l+=String.fromCharCode(C),Y):H(C)}function Z(C){return C===93?(e.consume(C),k):H(C)}function k(C){return C===62?(e.consume(C),G):C===45&&s===2?(e.consume(C),k):H(C)}function G(C){return C===null||Ce(C)?(e.exit("htmlFlowData"),te(C)):(e.consume(C),G)}function te(C){return e.exit("htmlFlow"),t(C)}}function Zz(e,t,n){const r=this;return s;function s(l){return Ce(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):n(l)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function Xz(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(su,t,n)}}const Qz={name:"htmlText",tokenize:Kz};function Kz(e,t,n){const r=this;let s,o,l;return u;function u(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),f}function f(k){return k===33?(e.consume(k),d):k===47?(e.consume(k),D):k===63?(e.consume(k),S):rn(k)?(e.consume(k),z):n(k)}function d(k){return k===45?(e.consume(k),h):k===91?(e.consume(k),o=0,b):rn(k)?(e.consume(k),T):n(k)}function h(k){return k===45?(e.consume(k),v):n(k)}function p(k){return k===null?n(k):k===45?(e.consume(k),g):Ce(k)?(l=p,P(k)):(e.consume(k),p)}function g(k){return k===45?(e.consume(k),v):p(k)}function v(k){return k===62?I(k):k===45?g(k):p(k)}function b(k){const G="CDATA[";return k===G.charCodeAt(o++)?(e.consume(k),o===G.length?w:b):n(k)}function w(k){return k===null?n(k):k===93?(e.consume(k),_):Ce(k)?(l=w,P(k)):(e.consume(k),w)}function _(k){return k===93?(e.consume(k),E):w(k)}function E(k){return k===62?I(k):k===93?(e.consume(k),E):w(k)}function T(k){return k===null||k===62?I(k):Ce(k)?(l=T,P(k)):(e.consume(k),T)}function S(k){return k===null?n(k):k===63?(e.consume(k),M):Ce(k)?(l=S,P(k)):(e.consume(k),S)}function M(k){return k===62?I(k):S(k)}function D(k){return rn(k)?(e.consume(k),R):n(k)}function R(k){return k===45||Qt(k)?(e.consume(k),R):B(k)}function B(k){return Ce(k)?(l=B,P(k)):Fe(k)?(e.consume(k),B):I(k)}function z(k){return k===45||Qt(k)?(e.consume(k),z):k===47||k===62||at(k)?U(k):n(k)}function U(k){return k===47?(e.consume(k),I):k===58||k===95||rn(k)?(e.consume(k),O):Ce(k)?(l=U,P(k)):Fe(k)?(e.consume(k),U):I(k)}function O(k){return k===45||k===46||k===58||k===95||Qt(k)?(e.consume(k),O):V(k)}function V(k){return k===61?(e.consume(k),H):Ce(k)?(l=V,P(k)):Fe(k)?(e.consume(k),V):U(k)}function H(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),s=k,Q):Ce(k)?(l=H,P(k)):Fe(k)?(e.consume(k),H):(e.consume(k),j)}function Q(k){return k===s?(e.consume(k),s=void 0,$):k===null?n(k):Ce(k)?(l=Q,P(k)):(e.consume(k),Q)}function j(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||at(k)?U(k):(e.consume(k),j)}function $(k){return k===47||k===62||at(k)?U(k):n(k)}function I(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):n(k)}function P(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),Y}function Y(k){return Fe(k)?qe(e,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):Z(k)}function Z(k){return e.enter("htmlTextData"),l(k)}}const s0={name:"labelEnd",resolveAll:t3,resolveTo:n3,tokenize:r3},Wz={tokenize:i3},Jz={tokenize:s3},e3={tokenize:a3};function t3(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&An(e,0,e.length,n),e}function n3(e,t){let n=e.length,r=0,s,o,l,u;for(;n--;)if(s=e[n][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(l=n);const f={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},h={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[l-2][1].start}};return u=[["enter",f,t],["enter",d,t]],u=Un(u,e.slice(o+1,o+r+3)),u=Un(u,[["enter",h,t]]),u=Un(u,Jf(t.parser.constructs.insideSpan.null,e.slice(o+r+4,l-3),t)),u=Un(u,[["exit",h,t],e[l-2],e[l-1],["exit",d,t]]),u=Un(u,e.slice(l+1)),u=Un(u,[["exit",f,t]]),An(e,o,e.length,u),e}function r3(e,t,n){const r=this;let s=r.events.length,o,l;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){o=r.events[s][1];break}return u;function u(g){return o?o._inactive?p(g):(l=r.parser.defined.includes(ir(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),f):n(g)}function f(g){return g===40?e.attempt(Wz,h,l?h:p)(g):g===91?e.attempt(Jz,h,l?d:p)(g):l?h(g):p(g)}function d(g){return e.attempt(e3,h,p)(g)}function h(g){return t(g)}function p(g){return o._balanced=!0,n(g)}}function i3(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return at(p)?kl(e,o)(p):o(p)}function o(p){return p===41?h(p):DT(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return at(p)?kl(e,f)(p):h(p)}function u(p){return n(p)}function f(p){return p===34||p===39||p===40?zT(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):h(p)}function d(p){return at(p)?kl(e,h)(p):h(p)}function h(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function s3(e,t,n){const r=this;return s;function s(u){return jT.call(r,e,o,l,"reference","referenceMarker","referenceString")(u)}function o(u){return r.parser.defined.includes(ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function a3(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const o3={name:"labelStartImage",resolveAll:s0.resolveAll,tokenize:l3};function l3(e,t,n){const r=this;return s;function s(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),o}function o(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),l):n(u)}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const u3={name:"labelStartLink",resolveAll:s0.resolveAll,tokenize:c3};function c3(e,t,n){const r=this;return s;function s(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Jm={name:"lineEnding",tokenize:f3};function f3(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),qe(e,t,"linePrefix")}}const cf={name:"thematicBreak",tokenize:d3};function d3(e,t,n){let r=0,s;return o;function o(d){return e.enter("thematicBreak"),l(d)}function l(d){return s=d,u(d)}function u(d){return d===s?(e.enter("thematicBreakSequence"),f(d)):r>=3&&(d===null||Ce(d))?(e.exit("thematicBreak"),t(d)):n(d)}function f(d){return d===s?(e.consume(d),r++,f):(e.exit("thematicBreakSequence"),Fe(d)?qe(e,u,"whitespace")(d):u(d))}}const hn={continuation:{tokenize:g3},exit:v3,name:"list",tokenize:p3},h3={partial:!0,tokenize:x3},m3={partial:!0,tokenize:y3};function p3(e,t,n){const r=this,s=r.events[r.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return u;function u(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:Wg(v)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(cf,n,d)(v):d(v);if(!r.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(v)}return n(v)}function f(v){return Wg(v)&&++l<10?(e.consume(v),f):(!r.interrupt||l<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),d(v)):n(v)}function d(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,e.check(su,r.interrupt?n:h,e.attempt(h3,g,p))}function h(v){return r.containerState.initialBlankLine=!0,o++,g(v)}function p(v){return Fe(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),g):n(v)}function g(v){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function g3(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(su,s,o);function s(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,qe(e,t,"listItemIndent",r.containerState.size+1)(u)}function o(u){return r.containerState.furtherBlankLines||!Fe(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(m3,t,l)(u))}function l(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,qe(e,e.attempt(hn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function y3(e,t,n){const r=this;return qe(e,s,"listItemIndent",r.containerState.size+1);function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(o):n(o)}}function v3(e){e.exit(this.containerState.type)}function x3(e,t,n){const r=this;return qe(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const l=r.events[r.events.length-1];return!Fe(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Jw={name:"setextUnderline",resolveTo:b3,tokenize:w3};function b3(e,t){let n=e.length,r,s,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",l,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function w3(e,t,n){const r=this;let s;return o;function o(d){let h=r.events.length,p;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){p=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),s=d,l(d)):n(d)}function l(d){return e.enter("setextHeadingLineSequence"),u(d)}function u(d){return d===s?(e.consume(d),u):(e.exit("setextHeadingLineSequence"),Fe(d)?qe(e,f,"lineSuffix")(d):f(d))}function f(d){return d===null||Ce(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const _3={tokenize:S3};function S3(e){const t=this,n=e.attempt(su,r,e.attempt(this.parser.constructs.flowInitial,s,qe(e,e.attempt(this.parser.constructs.flow,s,e.attempt(Az,s)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const E3={resolveAll:PT()},k3=LT("string"),T3=LT("text");function LT(e){return{resolveAll:PT(e==="text"?C3:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],o=n.attempt(s,l,u);return l;function l(h){return d(h)?o(h):u(h)}function u(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),f}function f(h){return d(h)?(n.exit("data"),o(h)):(n.consume(h),f)}function d(h){if(h===null)return!0;const p=s[h];let g=-1;if(p)for(;++g<p.length;){const v=p[g];if(!v.previous||v.previous.call(r,r.previous))return!0}return!1}}}function PT(e){return t;function t(n,r){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,r):n}}function C3(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let o=s.length,l=-1,u=0,f;for(;o--;){const d=s[o];if(typeof d=="string"){for(l=d.length;d.charCodeAt(l-1)===32;)u++,l--;if(l)break;l=-1}else if(d===-2)f=!0,u++;else if(d!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const d={type:n===e.length||f||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:r.start._bufferIndex+l,_index:r.start._index+o,line:r.end.line,column:r.end.column-u,offset:r.end.offset-u},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const A3={42:hn,43:hn,45:hn,48:hn,49:hn,50:hn,51:hn,52:hn,53:hn,54:hn,55:hn,56:hn,57:hn,62:NT},N3={91:Dz},M3={[-2]:Wm,[-1]:Wm,32:Wm},O3={35:Vz,42:cf,45:[Jw,cf],60:Fz,61:Jw,95:cf,96:Kw,126:Kw},R3={38:OT,92:MT},D3={[-5]:Jm,[-4]:Jm,[-3]:Jm,33:o3,38:OT,42:Jg,60:[uz,Qz],91:u3,92:[Pz,MT],93:s0,95:Jg,96:_z},j3={null:[Jg,E3]},z3={null:[42,95]},L3={null:[]},P3=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:z3,contentInitial:N3,disable:L3,document:A3,flow:O3,flowInitial:M3,insideSpan:j3,string:R3,text:D3},Symbol.toStringTag,{value:"Module"}));function I3(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},o=[];let l=[],u=[];const f={attempt:B(D),check:B(R),consume:T,enter:S,exit:M,interrupt:B(R,{interrupt:!0})},d={code:null,containerState:{},defineSkip:w,events:[],now:b,parser:e,previous:null,sliceSerialize:g,sliceStream:v,write:p};let h=t.tokenize.call(d,f);return t.resolveAll&&o.push(t),d;function p(V){return l=Un(l,V),_(),l[l.length-1]!==null?[]:(z(t,0),d.events=Jf(o,d.events,d),d.events)}function g(V,H){return B3(v(V),H)}function v(V){return V3(l,V)}function b(){const{_bufferIndex:V,_index:H,line:Q,column:j,offset:$}=r;return{_bufferIndex:V,_index:H,line:Q,column:j,offset:$}}function w(V){s[V.line]=V.column,O()}function _(){let V;for(;r._index<l.length;){const H=l[r._index];if(typeof H=="string")for(V=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===V&&r._bufferIndex<H.length;)E(H.charCodeAt(r._bufferIndex));else E(H)}}function E(V){h=h(V)}function T(V){Ce(V)?(r.line++,r.column=1,r.offset+=V===-3?2:1,O()):V!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=V}function S(V,H){const Q=H||{};return Q.type=V,Q.start=b(),d.events.push(["enter",Q,d]),u.push(Q),Q}function M(V){const H=u.pop();return H.end=b(),d.events.push(["exit",H,d]),H}function D(V,H){z(V,H.from)}function R(V,H){H.restore()}function B(V,H){return Q;function Q(j,$,I){let P,Y,Z,k;return Array.isArray(j)?te(j):"tokenize"in j?te([j]):G(j);function G(J){return oe;function oe(ce){const ge=ce!==null&&J[ce],ke=ce!==null&&J.null,_e=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return te(_e)(ce)}}function te(J){return P=J,Y=0,J.length===0?I:C(J[Y])}function C(J){return oe;function oe(ce){return k=U(),Z=J,J.partial||(d.currentConstruct=J),J.name&&d.parser.constructs.disable.null.includes(J.name)?W():J.tokenize.call(H?Object.assign(Object.create(d),H):d,f,F,W)(ce)}}function F(J){return V(Z,k),$}function W(J){return k.restore(),++Y<P.length?C(P[Y]):I}}}function z(V,H){V.resolveAll&&!o.includes(V)&&o.push(V),V.resolve&&An(d.events,H,d.events.length-H,V.resolve(d.events.slice(H),d)),V.resolveTo&&(d.events=V.resolveTo(d.events,d))}function U(){const V=b(),H=d.previous,Q=d.currentConstruct,j=d.events.length,$=Array.from(u);return{from:j,restore:I};function I(){r=V,d.previous=H,d.currentConstruct=Q,d.events.length=j,u=$,O()}}function O(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function V3(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let l;if(n===s)l=[e[n].slice(r,o)];else{if(l=e.slice(n,s),r>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(r):l.shift()}o>0&&l.push(e[s].slice(0,o))}return l}function B3(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const o=e[n];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
|
|
62
|
+
`;break}case-3:{l=`\r
|
|
63
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&s)continue;l=" ";break}default:l=String.fromCharCode(o)}s=o===-2,r.push(l)}return r.join("")}function U3(e){const r={constructs:CT([P3,...(e||{}).extensions||[]]),content:s(nz),defined:[],document:s(iz),flow:s(_3),lazy:{},string:s(k3),text:s(T3)};return r;function s(o){return l;function l(u){return I3(r,o,u)}}}function H3(e){for(;!RT(e););return e}const e_=/[\0\t\n\r]/g;function F3(){let e=1,t="",n=!0,r;return s;function s(o,l,u){const f=[];let d,h,p,g,v;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(e_.lastIndex=p,d=e_.exec(o),g=d&&d.index!==void 0?d.index:o.length,v=o.charCodeAt(g),!d){t=o.slice(p);break}if(v===10&&p===g&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),p<g&&(f.push(o.slice(p,g)),e+=g-p),v){case 0:{f.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,f.push(-2);e++<h;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}p=g+1}return u&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const $3=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function q3(e){return e.replace($3,G3)}function G3(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return AT(n.slice(o?2:1),o?16:10)}return i0(n)||e}const IT={}.hasOwnProperty;function Y3(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Z3(n)(H3(U3(n).document().write(F3()(e,t,!0))))}function Z3(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(kr),autolinkProtocol:U,autolinkEmail:U,atxHeading:o(ot),blockQuote:o(ke),characterEscape:U,characterReference:U,codeFenced:o(_e),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(_e,l),codeText:o(ye,l),codeTextData:U,data:U,codeFlowValue:U,definition:o(je),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(ze),hardBreakEscape:o(ft),hardBreakTrailing:o(ft),htmlFlow:o(Et,l),htmlFlowData:U,htmlText:o(Et,l),htmlTextData:U,image:o(Gi),label:l,link:o(kr),listItem:o(or),listItemValue:g,listOrdered:o($n,p),listUnordered:o($n),paragraph:o(Tr),reference:C,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(ot),strong:o(lr),thematicBreak:o(ur)},exit:{atxHeading:f(),atxHeadingSequence:D,autolink:f(),autolinkEmail:ge,autolinkProtocol:ce,blockQuote:f(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:J,characterReference:oe,codeFenced:f(_),codeFencedFence:w,codeFencedFenceInfo:v,codeFencedFenceMeta:b,codeFlowValue:O,codeIndented:f(E),codeText:f($),codeTextData:O,data:O,definition:f(),definitionDestinationString:M,definitionLabelString:T,definitionTitleString:S,emphasis:f(),hardBreakEscape:f(H),hardBreakTrailing:f(H),htmlFlow:f(Q),htmlFlowData:O,htmlText:f(j),htmlTextData:O,image:f(P),label:Z,labelText:Y,lineEnding:V,link:f(I),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:F,resourceDestinationString:k,resourceTitleString:G,resource:te,setextHeading:f(z),setextHeadingLineSequence:B,setextHeadingText:R,strong:f(),thematicBreak:f()}};VT(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ae){let de={type:"root",children:[]};const Ee={stack:[de],tokenStack:[],config:t,enter:u,exit:d,buffer:l,resume:h,data:n},Te=[];let Qe=-1;for(;++Qe<ae.length;)if(ae[Qe][1].type==="listOrdered"||ae[Qe][1].type==="listUnordered")if(ae[Qe][0]==="enter")Te.push(Qe);else{const Jt=Te.pop();Qe=s(ae,Jt,Qe)}for(Qe=-1;++Qe<ae.length;){const Jt=t[ae[Qe][0]];IT.call(Jt,ae[Qe][1].type)&&Jt[ae[Qe][1].type].call(Object.assign({sliceSerialize:ae[Qe][2].sliceSerialize},Ee),ae[Qe][1])}if(Ee.tokenStack.length>0){const Jt=Ee.tokenStack[Ee.tokenStack.length-1];(Jt[1]||t_).call(Ee,void 0,Jt[0])}for(de.position={start:Ni(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:Ni(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},Qe=-1;++Qe<t.transforms.length;)de=t.transforms[Qe](de)||de;return de}function s(ae,de,Ee){let Te=de-1,Qe=-1,Jt=!1,qn,qt,On,en;for(;++Te<=Ee;){const kt=ae[Te];switch(kt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{kt[0]==="enter"?Qe++:Qe--,en=void 0;break}case"lineEndingBlank":{kt[0]==="enter"&&(qn&&!en&&!Qe&&!On&&(On=Te),en=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:en=void 0}if(!Qe&&kt[0]==="enter"&&kt[1].type==="listItemPrefix"||Qe===-1&&kt[0]==="exit"&&(kt[1].type==="listUnordered"||kt[1].type==="listOrdered")){if(qn){let an=Te;for(qt=void 0;an--;){const yn=ae[an];if(yn[1].type==="lineEnding"||yn[1].type==="lineEndingBlank"){if(yn[0]==="exit")continue;qt&&(ae[qt][1].type="lineEndingBlank",Jt=!0),yn[1].type="lineEnding",qt=an}else if(!(yn[1].type==="linePrefix"||yn[1].type==="blockQuotePrefix"||yn[1].type==="blockQuotePrefixWhitespace"||yn[1].type==="blockQuoteMarker"||yn[1].type==="listItemIndent"))break}On&&(!qt||On<qt)&&(qn._spread=!0),qn.end=Object.assign({},qt?ae[qt][1].start:kt[1].end),ae.splice(qt||Te,0,["exit",qn,kt[2]]),Te++,Ee++}if(kt[1].type==="listItemPrefix"){const an={type:"listItem",_spread:!1,start:Object.assign({},kt[1].start),end:void 0};qn=an,ae.splice(Te,0,["enter",an,kt[2]]),Te++,Ee++,On=void 0,en=!0}}}return ae[de][1]._spread=Jt,Ee}function o(ae,de){return Ee;function Ee(Te){u.call(this,ae(Te),Te),de&&de.call(this,Te)}}function l(){this.stack.push({type:"fragment",children:[]})}function u(ae,de,Ee){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([de,Ee||void 0]),ae.position={start:Ni(de.start),end:void 0}}function f(ae){return de;function de(Ee){ae&&ae.call(this,Ee),d.call(this,Ee)}}function d(ae,de){const Ee=this.stack.pop(),Te=this.tokenStack.pop();if(Te)Te[0].type!==ae.type&&(de?de.call(this,ae,Te[0]):(Te[1]||t_).call(this,ae,Te[0]));else throw new Error("Cannot close `"+ae.type+"` ("+El({start:ae.start,end:ae.end})+"): it’s not open");Ee.position.end=Ni(ae.end)}function h(){return r0(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function g(ae){if(this.data.expectingFirstListItemValue){const de=this.stack[this.stack.length-2];de.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.lang=ae}function b(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.meta=ae}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae.replace(/(\r?\n|\r)$/g,"")}function T(ae){const de=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=de,Ee.identifier=ir(this.sliceSerialize(ae)).toLowerCase()}function S(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.title=ae}function M(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.url=ae}function D(ae){const de=this.stack[this.stack.length-1];if(!de.depth){const Ee=this.sliceSerialize(ae).length;de.depth=Ee}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function B(ae){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function U(ae){const Ee=this.stack[this.stack.length-1].children;let Te=Ee[Ee.length-1];(!Te||Te.type!=="text")&&(Te=Yi(),Te.position={start:Ni(ae.start),end:void 0},Ee.push(Te)),this.stack.push(Te)}function O(ae){const de=this.stack.pop();de.value+=this.sliceSerialize(ae),de.position.end=Ni(ae.end)}function V(ae){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ee=de.children[de.children.length-1];Ee.position.end=Ni(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(de.type)&&(U.call(this,ae),O.call(this,ae))}function H(){this.data.atHardBreak=!0}function Q(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function j(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function $(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function I(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=de,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function P(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=de,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function Y(ae){const de=this.sliceSerialize(ae),Ee=this.stack[this.stack.length-2];Ee.label=q3(de),Ee.identifier=ir(de).toLowerCase()}function Z(){const ae=this.stack[this.stack.length-1],de=this.resume(),Ee=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ee.type==="link"){const Te=ae.children;Ee.children=Te}else Ee.alt=de}function k(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.url=ae}function G(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.title=ae}function te(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function F(ae){const de=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=de,Ee.identifier=ir(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function W(ae){this.data.characterReferenceType=ae.type}function J(ae){const de=this.sliceSerialize(ae),Ee=this.data.characterReferenceType;let Te;Ee?(Te=AT(de,Ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Te=i0(de);const Qe=this.stack[this.stack.length-1];Qe.value+=Te}function oe(ae){const de=this.stack.pop();de.position.end=Ni(ae.end)}function ce(ae){O.call(this,ae);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(ae)}function ge(ae){O.call(this,ae);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(ae)}function ke(){return{type:"blockquote",children:[]}}function _e(){return{type:"code",lang:null,meta:null,value:""}}function ye(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ze(){return{type:"emphasis",children:[]}}function ot(){return{type:"heading",depth:0,children:[]}}function ft(){return{type:"break"}}function Et(){return{type:"html",value:""}}function Gi(){return{type:"image",title:null,url:"",alt:null}}function kr(){return{type:"link",title:null,url:"",children:[]}}function $n(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function or(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function Tr(){return{type:"paragraph",children:[]}}function lr(){return{type:"strong",children:[]}}function Yi(){return{type:"text",value:""}}function ur(){return{type:"thematicBreak"}}}function Ni(e){return{line:e.line,column:e.column,offset:e.offset}}function VT(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?VT(e,r):X3(e,r)}}function X3(e,t){let n;for(n in t)if(IT.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function t_(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+El({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+El({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+El({start:t.start,end:t.end})+") is still open")}function Q3(e){const t=this;t.parser=n;function n(r){return Y3(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function K3(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function W3(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
64
|
+
`}]}function J3(e,t){const n=t.value?t.value+`
|
|
65
|
+
`:"",r={};t.lang&&(r.className=["language-"+t.lang]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function eL(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tL(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nL(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=eo(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let l,u=e.footnoteCounts.get(r);u===void 0?(u=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=o+1,u+=1,e.footnoteCounts.set(r,u);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,f);const d={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,d),e.applyData(t,d)}function rL(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iL(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function BT(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),o=s[0];o&&o.type==="text"?o.value="["+o.value:s.unshift({type:"text",value:"["});const l=s[s.length-1];return l&&l.type==="text"?l.value+=r:s.push({type:"text",value:r}),s}function sL(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return BT(e,t);const s={src:eo(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,o),e.applyData(t,o)}function aL(e,t){const n={src:eo(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function oL(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function lL(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return BT(e,t);const s={href:eo(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const o={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function uL(e,t){const n={href:eo(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function cL(e,t,n){const r=e.all(t),s=n?fL(n):UT(t),o={},l=[];if(typeof t.checked=="boolean"){const h=r[0];let p;h&&h.type==="element"&&h.tagName==="p"?p=h:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const h=r[u];(s||u!==0||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
|
|
66
|
+
`}),h.type==="element"&&h.tagName==="p"&&!s?l.push(...h.children):l.push(h)}const f=r[r.length-1];f&&(s||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
|
|
67
|
+
`});const d={type:"element",tagName:"li",properties:o,children:l};return e.patch(t,d),e.applyData(t,d)}function fL(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=UT(n[r])}return t}function UT(e){const t=e.spread;return t??e.children.length>1}function dL(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const l=r[s];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function hL(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mL(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function pL(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gL(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),s.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=Jy(t.children[1]),f=bT(t.children[t.children.length-1]);u&&f&&(l.position={start:u,end:f}),s.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function yL(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,u=l?l.length:t.children.length;let f=-1;const d=[];for(;++f<u;){const p=t.children[f],g={},v=l?l[f]:void 0;v&&(g.align=v);let b={type:"element",tagName:o,properties:g,children:[]};p&&(b.children=e.all(p),e.patch(p,b),b=e.applyData(p,b)),d.push(b)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,h),e.applyData(t,h)}function vL(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const n_=9,r_=32;function xL(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const o=[];for(;r;)o.push(i_(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return o.push(i_(t.slice(s),s>0,!1)),o.join("")}function i_(e,t,n){let r=0,s=e.length;if(t){let o=e.codePointAt(r);for(;o===n_||o===r_;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(s-1);for(;o===n_||o===r_;)s--,o=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function bL(e,t){const n={type:"text",value:xL(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function wL(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const _L={blockquote:K3,break:W3,code:J3,delete:eL,emphasis:tL,footnoteReference:nL,heading:rL,html:iL,imageReference:sL,image:aL,inlineCode:oL,linkReference:lL,link:uL,listItem:cL,list:dL,paragraph:hL,root:mL,strong:pL,table:gL,tableCell:vL,tableRow:yL,text:bL,thematicBreak:wL,toml:Uc,yaml:Uc,definition:Uc,footnoteDefinition:Uc};function Uc(){}const HT=-1,ed=0,Tl=1,Cf=2,a0=3,o0=4,l0=5,u0=6,FT=7,$T=8,s_=typeof self=="object"?self:globalThis,SL=(e,t)=>{const n=(s,o)=>(e.set(o,s),s),r=s=>{if(e.has(s))return e.get(s);const[o,l]=t[s];switch(o){case ed:case HT:return n(l,s);case Tl:{const u=n([],s);for(const f of l)u.push(r(f));return u}case Cf:{const u=n({},s);for(const[f,d]of l)u[r(f)]=r(d);return u}case a0:return n(new Date(l),s);case o0:{const{source:u,flags:f}=l;return n(new RegExp(u,f),s)}case l0:{const u=n(new Map,s);for(const[f,d]of l)u.set(r(f),r(d));return u}case u0:{const u=n(new Set,s);for(const f of l)u.add(r(f));return u}case FT:{const{name:u,message:f}=l;return n(new s_[u](f),s)}case $T:return n(BigInt(l),s);case"BigInt":return n(Object(BigInt(l)),s);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return n(new DataView(u),l)}}return n(new s_[o](l),s)};return r},a_=e=>SL(new Map,e)(0),wa="",{toString:EL}={},{keys:kL}=Object,pl=e=>{const t=typeof e;if(t!=="object"||!e)return[ed,t];const n=EL.call(e).slice(8,-1);switch(n){case"Array":return[Tl,wa];case"Object":return[Cf,wa];case"Date":return[a0,wa];case"RegExp":return[o0,wa];case"Map":return[l0,wa];case"Set":return[u0,wa];case"DataView":return[Tl,n]}return n.includes("Array")?[Tl,n]:n.includes("Error")?[FT,n]:[Cf,n]},Hc=([e,t])=>e===ed&&(t==="function"||t==="symbol"),TL=(e,t,n,r)=>{const s=(l,u)=>{const f=r.push(l)-1;return n.set(u,f),f},o=l=>{if(n.has(l))return n.get(l);let[u,f]=pl(l);switch(u){case ed:{let h=l;switch(f){case"bigint":u=$T,h=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);h=null;break;case"undefined":return s([HT],l)}return s([u,h],l)}case Tl:{if(f){let g=l;return f==="DataView"?g=new Uint8Array(l.buffer):f==="ArrayBuffer"&&(g=new Uint8Array(l)),s([f,[...g]],l)}const h=[],p=s([u,h],l);for(const g of l)h.push(o(g));return p}case Cf:{if(f)switch(f){case"BigInt":return s([f,l.toString()],l);case"Boolean":case"Number":case"String":return s([f,l.valueOf()],l)}if(t&&"toJSON"in l)return o(l.toJSON());const h=[],p=s([u,h],l);for(const g of kL(l))(e||!Hc(pl(l[g])))&&h.push([o(g),o(l[g])]);return p}case a0:return s([u,l.toISOString()],l);case o0:{const{source:h,flags:p}=l;return s([u,{source:h,flags:p}],l)}case l0:{const h=[],p=s([u,h],l);for(const[g,v]of l)(e||!(Hc(pl(g))||Hc(pl(v))))&&h.push([o(g),o(v)]);return p}case u0:{const h=[],p=s([u,h],l);for(const g of l)(e||!Hc(pl(g)))&&h.push(o(g));return p}}const{message:d}=l;return s([u,{name:f,message:d}],l)};return o},o_=(e,{json:t,lossy:n}={})=>{const r=[];return TL(!(t||n),!!t,new Map,r)(e),r},Af=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?a_(o_(e,t)):structuredClone(e):(e,t)=>a_(o_(e,t));function CL(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function AL(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function NL(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||CL,r=e.options.footnoteBackLabel||AL,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let f=-1;for(;++f<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[f]);if(!d)continue;const h=e.all(d),p=String(d.identifier).toUpperCase(),g=eo(p.toLowerCase());let v=0;const b=[],w=e.footnoteCounts.get(p);for(;w!==void 0&&++v<=w;){b.length>0&&b.push({type:"text",value:" "});let T=typeof n=="string"?n:n(f,v);typeof T=="string"&&(T={type:"text",value:T}),b.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+g+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,v),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const _=h[h.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const T=_.children[_.children.length-1];T&&T.type==="text"?T.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...b)}else h.push(...b);const E={type:"element",tagName:"li",properties:{id:t+"fn-"+g},children:e.wrap(h,!0)};e.patch(d,E),u.push(E)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Af(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
68
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
69
|
+
`}]}}const td=function(e){if(e==null)return DL;if(typeof e=="function")return nd(e);if(typeof e=="object")return Array.isArray(e)?ML(e):OL(e);if(typeof e=="string")return RL(e);throw new Error("Expected function, string, or object as test")};function ML(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=td(e[n]);return nd(r);function r(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function OL(e){const t=e;return nd(n);function n(r){const s=r;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function RL(e){return nd(t);function t(n){return n&&n.type===e}}function nd(e){return t;function t(n,r,s){return!!(jL(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function DL(){return!0}function jL(e){return e!==null&&typeof e=="object"&&"type"in e}const qT=[],zL=!0,ey=!1,LL="skip";function GT(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const o=td(s),l=r?-1:1;u(e,void 0,[])();function u(f,d,h){const p=f&&typeof f=="object"?f:{};if(typeof p.type=="string"){const v=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(f.type+(v?"<"+v+">":""))+")"})}return g;function g(){let v=qT,b,w,_;if((!t||o(f,d,h[h.length-1]||void 0))&&(v=PL(n(f,h)),v[0]===ey))return v;if("children"in f&&f.children){const E=f;if(E.children&&v[0]!==LL)for(w=(r?E.children.length:-1)+l,_=h.concat(E);w>-1&&w<E.children.length;){const T=E.children[w];if(b=u(T,w,_)(),b[0]===ey)return b;w=typeof b[1]=="number"?b[1]:w+l}}return v}}}function PL(e){return Array.isArray(e)?e:typeof e=="number"?[zL,e]:e==null?qT:[e]}function c0(e,t,n,r){let s,o,l;typeof t=="function"&&typeof n!="function"?(o=void 0,l=t,s=n):(o=t,l=n,s=r),GT(e,o,u,s);function u(f,d){const h=d[d.length-1],p=h?h.children.indexOf(f):void 0;return l(f,p,h)}}const ty={}.hasOwnProperty,IL={};function VL(e,t){const n=t||IL,r=new Map,s=new Map,o=new Map,l={..._L,...n.handlers},u={all:d,applyData:UL,definitionById:r,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:l,one:f,options:n,patch:BL,wrap:FL};return c0(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const p=h.type==="definition"?r:s,g=String(h.identifier).toUpperCase();p.has(g)||p.set(g,h)}}),u;function f(h,p){const g=h.type,v=u.handlers[g];if(ty.call(u.handlers,g)&&v)return v(u,h,p);if(u.options.passThrough&&u.options.passThrough.includes(g)){if("children"in h){const{children:w,..._}=h,E=Af(_);return E.children=u.all(h),E}return Af(h)}return(u.options.unknownHandler||HL)(u,h,p)}function d(h){const p=[];if("children"in h){const g=h.children;let v=-1;for(;++v<g.length;){const b=u.one(g[v],h);if(b){if(v&&g[v-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=l_(b.value)),!Array.isArray(b)&&b.type==="element")){const w=b.children[0];w&&w.type==="text"&&(w.value=l_(w.value))}Array.isArray(b)?p.push(...b):p.push(b)}}}return p}}function BL(e,t){e.position&&(t.position=Aj(e))}function UL(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&o&&Object.assign(n.properties,Af(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function HL(e,t){const n=t.data||{},r="value"in t&&!(ty.call(n,"hProperties")||ty.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function FL(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
70
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
71
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
72
|
+
`}),n}function l_(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function u_(e,t){const n=VL(e,t),r=n.one(e,void 0),s=NL(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
|
|
73
|
+
`},s),o}function $L(e,t){return e&&"run"in e?async function(n,r){const s=u_(n,{file:r,...t});await e.run(s,r)}:function(n,r){return u_(n,{file:r,...e||t})}}function c_(e){if(e)throw e}var ep,f_;function qL(){if(f_)return ep;f_=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},o=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var h=e.call(d,"constructor"),p=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!h&&!p)return!1;var g;for(g in d);return typeof g>"u"||e.call(d,g)},l=function(d,h){n&&h.name==="__proto__"?n(d,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):d[h.name]=h.newValue},u=function(d,h){if(h==="__proto__")if(e.call(d,h)){if(r)return r(d,h).value}else return;return d[h]};return ep=function f(){var d,h,p,g,v,b,w=arguments[0],_=1,E=arguments.length,T=!1;for(typeof w=="boolean"&&(T=w,w=arguments[1]||{},_=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});_<E;++_)if(d=arguments[_],d!=null)for(h in d)p=u(w,h),g=u(d,h),w!==g&&(T&&g&&(o(g)||(v=s(g)))?(v?(v=!1,b=p&&s(p)?p:[]):b=p&&o(p)?p:{},l(w,{name:h,newValue:f(T,b,g)})):typeof g<"u"&&l(w,{name:h,newValue:g}));return w},ep}var GL=qL();const tp=Fi(GL);function ny(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function YL(){const e=[],t={run:n,use:r};return t;function n(...s){let o=-1;const l=s.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...s);function u(f,...d){const h=e[++o];let p=-1;if(f){l(f);return}for(;++p<s.length;)(d[p]===null||d[p]===void 0)&&(d[p]=s[p]);s=d,h?ZL(h,u)(...d):l(null,...d)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function ZL(e,t){let n;return r;function r(...l){const u=e.length>l.length;let f;u&&l.push(s);try{f=e.apply(this,l)}catch(d){const h=d;if(u&&n)throw h;return s(h)}u||(f&&f.then&&typeof f.then=="function"?f.then(o,s):f instanceof Error?s(f):o(f))}function s(l,...u){n||(n=!0,t(l,...u))}function o(l){s(null,l)}}const gr={basename:XL,dirname:QL,extname:KL,join:WL,sep:"/"};function XL(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');au(e);let n=0,r=-1,s=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else r<0&&(o=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,u=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else l<0&&(o=!0,l=s+1),u>-1&&(e.codePointAt(s)===t.codePointAt(u--)?u<0&&(r=s):(u=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function QL(e){if(au(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function KL(e){au(e);let t=e.length,n=-1,r=0,s=-1,o=0,l;for(;t--;){const u=e.codePointAt(t);if(u===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),u===46?s<0?s=t:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function WL(...e){let t=-1,n;for(;++t<e.length;)au(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":JL(n)}function JL(e){au(e);const t=e.codePointAt(0)===47;let n=e5(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function e5(e,t){let n="",r=0,s=-1,o=0,l=-1,u,f;for(;++l<=e.length;){if(l<e.length)u=e.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(s===l-1||o===1))if(s!==l-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),s=l,o=0;continue}}else if(n.length>0){n="",r=0,s=l,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,l):n=e.slice(s+1,l),r=l-s-1;s=l,o=0}else u===46&&o>-1?o++:o=-1}return n}function au(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const t5={cwd:n5};function n5(){return"/"}function ry(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function r5(e){if(typeof e=="string")e=new URL(e);else if(!ry(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return i5(e)}function i5(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const np=["history","path","basename","stem","extname","dirname"];class YT{constructor(t){let n;t?ry(t)?n={path:t}:typeof t=="string"||s5(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":t5.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<np.length;){const o=np[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)np.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?gr.basename(this.path):void 0}set basename(t){ip(t,"basename"),rp(t,"basename"),this.path=gr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?gr.dirname(this.path):void 0}set dirname(t){d_(this.basename,"dirname"),this.path=gr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?gr.extname(this.path):void 0}set extname(t){if(rp(t,"extname"),d_(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=gr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ry(t)&&(t=r5(t)),ip(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?gr.basename(this.path,this.extname):void 0}set stem(t){ip(t,"stem"),rp(t,"stem"),this.path=gr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Wt(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function rp(e,t){if(e&&e.includes(gr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+gr.sep+"`")}function ip(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function d_(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function s5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const a5=function(e){const r=this.constructor.prototype,s=r[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},o5={}.hasOwnProperty;class f0 extends a5{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=YL()}copy(){const t=new f0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(tp(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(op("data",this.frozen),this.namespace[t]=n,this):o5.call(this.namespace,t)&&this.namespace[t]||void 0:t?(op("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Fc(t),r=this.parser||this.Parser;return sp("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),sp("process",this.parser||this.Parser),ap("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,l){const u=Fc(t),f=r.parse(u);r.run(f,u,function(h,p,g){if(h||!p||!g)return d(h);const v=p,b=r.stringify(v,g);c5(b)?g.value=b:g.result=b,d(h,g)});function d(h,p){h||!p?l(h):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),sp("processSync",this.parser||this.Parser),ap("processSync",this.compiler||this.Compiler),this.process(t,s),m_("processSync","process",n),r;function s(o,l){n=!0,c_(o),r=l}}run(t,n,r){h_(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(l,u){const f=Fc(n);s.run(t,f,d);function d(h,p,g){const v=p||t;h?u(h):l?l(v):r(void 0,v,g)}}}runSync(t,n){let r=!1,s;return this.run(t,n,o),m_("runSync","run",r),s;function o(l,u){c_(l),s=u,r=!0}}stringify(t,n){this.freeze();const r=Fc(n),s=this.compiler||this.Compiler;return ap("stringify",s),h_(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(op("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(d){if(typeof d=="function")f(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[h,...p]=d;f(h,p)}else l(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function l(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(d.plugins),d.settings&&(s.settings=tp(!0,s.settings,d.settings))}function u(d){let h=-1;if(d!=null)if(Array.isArray(d))for(;++h<d.length;){const p=d[h];o(p)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function f(d,h){let p=-1,g=-1;for(;++p<r.length;)if(r[p][0]===d){g=p;break}if(g===-1)r.push([d,...h]);else if(h.length>0){let[v,...b]=h;const w=r[g][1];ny(w)&&ny(v)&&(v=tp(!0,w,v)),r[g]=[d,v,...b]}}}}const l5=new f0().freeze();function sp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ap(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function op(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function h_(e){if(!ny(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function m_(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Fc(e){return u5(e)?e:new YT(e)}function u5(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function c5(e){return typeof e=="string"||f5(e)}function f5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const d5="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",p_=[],g_={allowDangerousHtml:!0},h5=/^(https?|ircs?|mailto|xmpp)$/i,m5=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function ZT(e){const t=p5(e),n=g5(e);return y5(t.runSync(t.parse(n),n),e)}function p5(e){const t=e.rehypePlugins||p_,n=e.remarkPlugins||p_,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...g_}:g_;return l5().use(Q3).use(n).use($L,r).use(t)}function g5(e){const t=e.children||"",n=new YT;return typeof t=="string"&&(n.value=t),n}function y5(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,o=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,f=t.urlTransform||v5;for(const h of m5)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+d5+h.id,void 0);return c0(e,d),Dj(e,{Fragment:A.Fragment,components:s,ignoreInvalidStyle:!0,jsx:A.jsx,jsxs:A.jsxs,passKeys:!0,passNode:!0});function d(h,p,g){if(h.type==="raw"&&g&&typeof p=="number")return l?g.children.splice(p,1):g.children[p]={type:"text",value:h.value},p;if(h.type==="element"){let v;for(v in Km)if(Object.hasOwn(Km,v)&&Object.hasOwn(h.properties,v)){const b=h.properties[v],w=Km[v];(w===null||w.includes(h.tagName))&&(h.properties[v]=f(String(b||""),v,h))}}if(h.type==="element"){let v=n?!n.includes(h.tagName):o?o.includes(h.tagName):!1;if(!v&&r&&typeof p=="number"&&(v=!r(h,p,g)),v&&g&&typeof p=="number")return u&&h.children?g.children.splice(p,1,...h.children):g.children.splice(p,1),p}}}function v5(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||h5.test(e.slice(0,t))?e:""}function y_(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function x5(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function b5(e,t,n){const s=td((n||{}).ignore||[]),o=w5(t);let l=-1;for(;++l<o.length;)GT(e,"text",u);function u(d,h){let p=-1,g;for(;++p<h.length;){const v=h[p],b=g?g.children:void 0;if(s(v,b?b.indexOf(v):void 0,g))return;g=v}if(g)return f(d,h)}function f(d,h){const p=h[h.length-1],g=o[l][0],v=o[l][1];let b=0;const _=p.children.indexOf(d);let E=!1,T=[];g.lastIndex=0;let S=g.exec(d.value);for(;S;){const M=S.index,D={index:S.index,input:S.input,stack:[...h,d]};let R=v(...S,D);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?g.lastIndex=M+1:(b!==M&&T.push({type:"text",value:d.value.slice(b,M)}),Array.isArray(R)?T.push(...R):R&&T.push(R),b=M+S[0].length,E=!0),!g.global)break;S=g.exec(d.value)}return E?(b<d.value.length&&T.push({type:"text",value:d.value.slice(b)}),p.children.splice(_,1,...T)):T=[d],_+T.length}}function w5(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([_5(s[0]),S5(s[1])])}return t}function _5(e){return typeof e=="string"?new RegExp(x5(e),"g"):e}function S5(e){return typeof e=="function"?e:function(){return e}}const lp="phrasing",up=["autolink","link","image","label"];function E5(){return{transforms:[O5],enter:{literalAutolink:T5,literalAutolinkEmail:cp,literalAutolinkHttp:cp,literalAutolinkWww:cp},exit:{literalAutolink:M5,literalAutolinkEmail:N5,literalAutolinkHttp:C5,literalAutolinkWww:A5}}}function k5(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:lp,notInConstruct:up},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:lp,notInConstruct:up},{character:":",before:"[ps]",after:"\\/",inConstruct:lp,notInConstruct:up}]}}function T5(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function cp(e){this.config.enter.autolinkProtocol.call(this,e)}function C5(e){this.config.exit.autolinkProtocol.call(this,e)}function A5(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function N5(e){this.config.exit.autolinkEmail.call(this,e)}function M5(e){this.exit(e)}function O5(e){b5(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,R5],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),D5]],{ignore:["link","linkReference"]})}function R5(e,t,n,r,s){let o="";if(!XT(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!j5(n)))return!1;const l=z5(n+r);if(!l[0])return!1;const u={type:"link",title:null,url:o+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function D5(e,t,n,r){return!XT(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function j5(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function z5(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=y_(e,"(");let o=y_(e,")");for(;r!==-1&&s>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function XT(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ms(n)||Wf(n))&&(!t||n!==47)}QT.peek=$5;function L5(){this.buffer()}function P5(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function I5(){this.buffer()}function V5(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function B5(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ir(this.sliceSerialize(e)).toLowerCase(),n.label=t}function U5(e){this.exit(e)}function H5(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ir(this.sliceSerialize(e)).toLowerCase(),n.label=t}function F5(e){this.exit(e)}function $5(){return"["}function QT(e,t,n,r){const s=n.createTracker(r);let o=s.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),u(),l(),o+=s.move("]"),o}function q5(){return{enter:{gfmFootnoteCallString:L5,gfmFootnoteCall:P5,gfmFootnoteDefinitionLabelString:I5,gfmFootnoteDefinition:V5},exit:{gfmFootnoteCallString:B5,gfmFootnoteCall:U5,gfmFootnoteDefinitionLabelString:H5,gfmFootnoteDefinition:F5}}}function G5(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:QT},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,o,l){const u=o.createTracker(l);let f=u.move("[^");const d=o.enter("footnoteDefinition"),h=o.enter("label");return f+=u.move(o.safe(o.associationId(r),{before:f,after:"]"})),h(),f+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),f+=u.move((t?`
|
|
74
|
+
`:" ")+o.indentLines(o.containerFlow(r,u.current()),t?KT:Y5))),d(),f}}function Y5(e,t,n){return t===0?e:KT(e,t,n)}function KT(e,t,n){return(n?"":" ")+e}const Z5=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];WT.peek=J5;function X5(){return{canContainEols:["delete"],enter:{strikethrough:K5},exit:{strikethrough:W5}}}function Q5(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Z5}],handlers:{delete:WT}}}function K5(e){this.enter({type:"delete",children:[]},e)}function W5(e){this.exit(e)}function WT(e,t,n,r){const s=n.createTracker(r),o=n.enter("strikethrough");let l=s.move("~~");return l+=n.containerPhrasing(e,{...s.current(),before:l,after:"~"}),l+=s.move("~~"),o(),l}function J5(){return"~"}function eP(e){return e.length}function tP(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||eP,o=[],l=[],u=[],f=[];let d=0,h=-1;for(;++h<e.length;){const w=[],_=[];let E=-1;for(e[h].length>d&&(d=e[h].length);++E<e[h].length;){const T=nP(e[h][E]);if(n.alignDelimiters!==!1){const S=s(T);_[E]=S,(f[E]===void 0||S>f[E])&&(f[E]=S)}w.push(T)}l[h]=w,u[h]=_}let p=-1;if(typeof r=="object"&&"length"in r)for(;++p<d;)o[p]=v_(r[p]);else{const w=v_(r);for(;++p<d;)o[p]=w}p=-1;const g=[],v=[];for(;++p<d;){const w=o[p];let _="",E="";w===99?(_=":",E=":"):w===108?_=":":w===114&&(E=":");let T=n.alignDelimiters===!1?1:Math.max(1,f[p]-_.length-E.length);const S=_+"-".repeat(T)+E;n.alignDelimiters!==!1&&(T=_.length+T+E.length,T>f[p]&&(f[p]=T),v[p]=T),g[p]=S}l.splice(1,0,g),u.splice(1,0,v),h=-1;const b=[];for(;++h<l.length;){const w=l[h],_=u[h];p=-1;const E=[];for(;++p<d;){const T=w[p]||"";let S="",M="";if(n.alignDelimiters!==!1){const D=f[p]-(_[p]||0),R=o[p];R===114?S=" ".repeat(D):R===99?D%2?(S=" ".repeat(D/2+.5),M=" ".repeat(D/2-.5)):(S=" ".repeat(D/2),M=S):M=" ".repeat(D)}n.delimiterStart!==!1&&!p&&E.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&T==="")&&(n.delimiterStart!==!1||p)&&E.push(" "),n.alignDelimiters!==!1&&E.push(S),E.push(T),n.alignDelimiters!==!1&&E.push(M),n.padding!==!1&&E.push(" "),(n.delimiterEnd!==!1||p!==d-1)&&E.push("|")}b.push(n.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return b.join(`
|
|
75
|
+
`)}function nP(e){return e==null?"":String(e)}function v_(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function rP(e,t,n,r){const s=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const l=n.indentLines(n.containerFlow(e,o.current()),iP);return s(),l}function iP(e,t,n){return">"+(n?"":" ")+e}function sP(e,t){return x_(e,t.inConstruct,!0)&&!x_(e,t.notInConstruct,!1)}function x_(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function b_(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
76
|
+
`&&sP(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
77
|
+
`}function aP(e,t){const n=String(e);let r=n.indexOf(t),s=r,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++o>l&&(l=o):o=1,s=r+t.length,r=n.indexOf(t,s);return l}function oP(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function lP(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function uP(e,t,n,r){const s=lP(n),o=e.value||"",l=s==="`"?"GraveAccent":"Tilde";if(oP(e,n)){const p=n.enter("codeIndented"),g=n.indentLines(o,cP);return p(),g}const u=n.createTracker(r),f=s.repeat(Math.max(aP(o,s)+1,3)),d=n.enter("codeFenced");let h=u.move(f);if(e.lang){const p=n.enter(`codeFencedLang${l}`);h+=u.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...u.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${l}`);h+=u.move(" "),h+=u.move(n.safe(e.meta,{before:h,after:`
|
|
78
|
+
`,encode:["`"],...u.current()})),p()}return h+=u.move(`
|
|
79
|
+
`),o&&(h+=u.move(o+`
|
|
80
|
+
`)),h+=u.move(f),d(),h}function cP(e,t,n){return(n?"":" ")+e}function d0(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function fP(e,t,n,r){const s=d0(n),o=s==='"'?"Quote":"Apostrophe",l=n.enter("definition");let u=n.enter("label");const f=n.createTracker(r);let d=f.move("[");return d+=f.move(n.safe(n.associationId(e),{before:d,after:"]",...f.current()})),d+=f.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(n.safe(e.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(u=n.enter("destinationRaw"),d+=f.move(n.safe(e.url,{before:d,after:e.title?" ":`
|
|
81
|
+
`,...f.current()}))),u(),e.title&&(u=n.enter(`title${o}`),d+=f.move(" "+s),d+=f.move(n.safe(e.title,{before:d,after:s,...f.current()})),d+=f.move(s),u()),l(),d}function dP(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Vl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Nf(e,t,n){const r=Fa(e),s=Fa(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}JT.peek=hP;function JT(e,t,n,r){const s=dP(n),o=n.enter("emphasis"),l=n.createTracker(r),u=l.move(s);let f=l.move(n.containerPhrasing(e,{after:s,before:u,...l.current()}));const d=f.charCodeAt(0),h=Nf(r.before.charCodeAt(r.before.length-1),d,s);h.inside&&(f=Vl(d)+f.slice(1));const p=f.charCodeAt(f.length-1),g=Nf(r.after.charCodeAt(0),p,s);g.inside&&(f=f.slice(0,-1)+Vl(p));const v=l.move(s);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},u+f+v}function hP(e,t,n){return n.options.emphasis||"*"}function mP(e,t){let n=!1;return c0(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ey}),!!((!e.depth||e.depth<3)&&r0(e)&&(t.options.setext||n))}function pP(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(mP(e,n)){const h=n.enter("headingSetext"),p=n.enter("phrasing"),g=n.containerPhrasing(e,{...o.current(),before:`
|
|
82
|
+
`,after:`
|
|
83
|
+
`});return p(),h(),g+`
|
|
84
|
+
`+(s===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
|
|
85
|
+
`))+1))}const l="#".repeat(s),u=n.enter("headingAtx"),f=n.enter("phrasing");o.move(l+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
|
|
86
|
+
`,...o.current()});return/^[\t ]/.test(d)&&(d=Vl(d.charCodeAt(0))+d.slice(1)),d=d?l+" "+d:l,n.options.closeAtx&&(d+=" "+l),f(),u(),d}e2.peek=gP;function e2(e){return e.value||""}function gP(){return"<"}t2.peek=yP;function t2(e,t,n,r){const s=d0(n),o=s==='"'?"Quote":"Apostrophe",l=n.enter("image");let u=n.enter("label");const f=n.createTracker(r);let d=f.move("![");return d+=f.move(n.safe(e.alt,{before:d,after:"]",...f.current()})),d+=f.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(n.safe(e.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(u=n.enter("destinationRaw"),d+=f.move(n.safe(e.url,{before:d,after:e.title?" ":")",...f.current()}))),u(),e.title&&(u=n.enter(`title${o}`),d+=f.move(" "+s),d+=f.move(n.safe(e.title,{before:d,after:s,...f.current()})),d+=f.move(s),u()),d+=f.move(")"),l(),d}function yP(){return"!"}n2.peek=vP;function n2(e,t,n,r){const s=e.referenceType,o=n.enter("imageReference");let l=n.enter("label");const u=n.createTracker(r);let f=u.move("![");const d=n.safe(e.alt,{before:f,after:"]",...u.current()});f+=u.move(d+"]["),l();const h=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=h,o(),s==="full"||!d||d!==p?f+=u.move(p+"]"):s==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function vP(){return"!"}r2.peek=xP;function r2(e,t,n){let r=e.value||"",s="`",o=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const l=n.unsafe[o],u=n.compilePattern(l);let f;if(l.atBreak)for(;f=u.exec(r);){let d=f.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(f.index+1)}}return s+r+s}function xP(){return"`"}function i2(e,t){const n=r0(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}s2.peek=bP;function s2(e,t,n,r){const s=d0(n),o=s==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let u,f;if(i2(e,n)){const h=n.stack;n.stack=[],u=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(e,{before:p,after:">",...l.current()})),p+=l.move(">"),u(),n.stack=h,p}u=n.enter("link"),f=n.enter("label");let d=l.move("[");return d+=l.move(n.containerPhrasing(e,{before:d,after:"](",...l.current()})),d+=l.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),d+=l.move("<"),d+=l.move(n.safe(e.url,{before:d,after:">",...l.current()})),d+=l.move(">")):(f=n.enter("destinationRaw"),d+=l.move(n.safe(e.url,{before:d,after:e.title?" ":")",...l.current()}))),f(),e.title&&(f=n.enter(`title${o}`),d+=l.move(" "+s),d+=l.move(n.safe(e.title,{before:d,after:s,...l.current()})),d+=l.move(s),f()),d+=l.move(")"),u(),d}function bP(e,t,n){return i2(e,n)?"<":"["}a2.peek=wP;function a2(e,t,n,r){const s=e.referenceType,o=n.enter("linkReference");let l=n.enter("label");const u=n.createTracker(r);let f=u.move("[");const d=n.containerPhrasing(e,{before:f,after:"]",...u.current()});f+=u.move(d+"]["),l();const h=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=h,o(),s==="full"||!d||d!==p?f+=u.move(p+"]"):s==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function wP(){return"["}function h0(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function _P(e){const t=h0(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function SP(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function o2(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function EP(e,t,n,r){const s=n.enter("list"),o=n.bulletCurrent;let l=e.ordered?SP(n):h0(n);const u=e.ordered?l==="."?")":".":_P(n);let f=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),o2(n)===l&&h){let p=-1;for(;++p<e.children.length;){const g=e.children[p];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(l=u),n.bulletCurrent=l;const d=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=o,s(),d}function kP(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function TP(e,t,n,r){const s=kP(n);let o=n.bulletCurrent||h0(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let l=o.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const u=n.createTracker(r);u.move(o+" ".repeat(l-o.length)),u.shift(l);const f=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,u.current()),h);return f(),d;function h(p,g,v){return g?(v?"":" ".repeat(l))+p:(v?o:o+" ".repeat(l-o.length))+p}}function CP(e,t,n,r){const s=n.enter("paragraph"),o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),s(),l}const AP=td(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function NP(e,t,n,r){return(e.children.some(function(l){return AP(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function MP(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}l2.peek=OP;function l2(e,t,n,r){const s=MP(n),o=n.enter("strong"),l=n.createTracker(r),u=l.move(s+s);let f=l.move(n.containerPhrasing(e,{after:s,before:u,...l.current()}));const d=f.charCodeAt(0),h=Nf(r.before.charCodeAt(r.before.length-1),d,s);h.inside&&(f=Vl(d)+f.slice(1));const p=f.charCodeAt(f.length-1),g=Nf(r.after.charCodeAt(0),p,s);g.inside&&(f=f.slice(0,-1)+Vl(p));const v=l.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},u+f+v}function OP(e,t,n){return n.options.strong||"*"}function RP(e,t,n,r){return n.safe(e.value,r)}function DP(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function jP(e,t,n){const r=(o2(n)+(n.options.ruleSpaces?" ":"")).repeat(DP(n));return n.options.ruleSpaces?r.slice(0,-1):r}const u2={blockquote:rP,break:b_,code:uP,definition:fP,emphasis:JT,hardBreak:b_,heading:pP,html:e2,image:t2,imageReference:n2,inlineCode:r2,link:s2,linkReference:a2,list:EP,listItem:TP,paragraph:CP,root:NP,strong:l2,text:RP,thematicBreak:jP};function zP(){return{enter:{table:LP,tableData:w_,tableHeader:w_,tableRow:IP},exit:{codeText:VP,table:PP,tableData:fp,tableHeader:fp,tableRow:fp}}}function LP(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function PP(e){this.exit(e),this.data.inTable=void 0}function IP(e){this.enter({type:"tableRow",children:[]},e)}function fp(e){this.exit(e)}function w_(e){this.enter({type:"tableCell",children:[]},e)}function VP(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,BP));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function BP(e,t){return t==="|"?t:e}function UP(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
87
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:l,tableCell:f,tableRow:u}};function l(v,b,w,_){return d(h(v,w,_),v.align)}function u(v,b,w,_){const E=p(v,w,_),T=d([E]);return T.slice(0,T.indexOf(`
|
|
88
|
+
`))}function f(v,b,w,_){const E=w.enter("tableCell"),T=w.enter("phrasing"),S=w.containerPhrasing(v,{..._,before:o,after:o});return T(),E(),S}function d(v,b){return tP(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function h(v,b,w){const _=v.children;let E=-1;const T=[],S=b.enter("table");for(;++E<_.length;)T[E]=p(_[E],b,w);return S(),T}function p(v,b,w){const _=v.children;let E=-1;const T=[],S=b.enter("tableRow");for(;++E<_.length;)T[E]=f(_[E],v,b,w);return S(),T}function g(v,b,w){let _=u2.inlineCode(v,b,w);return w.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function HP(){return{exit:{taskListCheckValueChecked:__,taskListCheckValueUnchecked:__,paragraph:$P}}}function FP(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:qP}}}function __(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function $P(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let o=-1,l;for(;++o<s.length;){const u=s[o];if(u.type==="paragraph"){l=u;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function qP(e,t,n,r){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(l);let f=u2.listItem(e,t,n,{...r,...u.current()});return o&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),f;function d(h){return h+l}}function GP(){return[E5(),q5(),X5(),zP(),HP()]}function YP(e){return{extensions:[k5(),G5(e),Q5(),UP(e),FP()]}}const ZP={tokenize:eI,partial:!0},c2={tokenize:tI,partial:!0},f2={tokenize:nI,partial:!0},d2={tokenize:rI,partial:!0},XP={tokenize:iI,partial:!0},h2={name:"wwwAutolink",tokenize:WP,previous:p2},m2={name:"protocolAutolink",tokenize:JP,previous:g2},Wr={name:"emailAutolink",tokenize:KP,previous:y2},Sr={};function QP(){return{text:Sr}}let hs=48;for(;hs<123;)Sr[hs]=Wr,hs++,hs===58?hs=65:hs===91&&(hs=97);Sr[43]=Wr;Sr[45]=Wr;Sr[46]=Wr;Sr[95]=Wr;Sr[72]=[Wr,m2];Sr[104]=[Wr,m2];Sr[87]=[Wr,h2];Sr[119]=[Wr,h2];function KP(e,t,n){const r=this;let s,o;return l;function l(p){return!iy(p)||!y2.call(r,r.previous)||m0(r.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(p))}function u(p){return iy(p)?(e.consume(p),u):p===64?(e.consume(p),f):n(p)}function f(p){return p===46?e.check(XP,h,d)(p):p===45||p===95||Qt(p)?(o=!0,e.consume(p),f):h(p)}function d(p){return e.consume(p),s=!0,f}function h(p){return o&&s&&rn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function WP(e,t,n){const r=this;return s;function s(l){return l!==87&&l!==119||!p2.call(r,r.previous)||m0(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(ZP,e.attempt(c2,e.attempt(f2,o),n),n)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function JP(e,t,n){const r=this;let s="",o=!1;return l;function l(p){return(p===72||p===104)&&g2.call(r,r.previous)&&!m0(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),e.consume(p),u):n(p)}function u(p){if(rn(p)&&s.length<5)return s+=String.fromCodePoint(p),e.consume(p),u;if(p===58){const g=s.toLowerCase();if(g==="http"||g==="https")return e.consume(p),f}return n(p)}function f(p){return p===47?(e.consume(p),o?d:(o=!0,f)):n(p)}function d(p){return p===null||Tf(p)||at(p)||Ms(p)||Wf(p)?n(p):e.attempt(c2,e.attempt(f2,h),n)(p)}function h(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function eI(e,t,n){let r=0;return s;function s(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),s):l===46&&r===3?(e.consume(l),o):n(l)}function o(l){return l===null?n(l):t(l)}}function tI(e,t,n){let r,s,o;return l;function l(d){return d===46||d===95?e.check(d2,f,u)(d):d===null||at(d)||Ms(d)||d!==45&&Wf(d)?f(d):(o=!0,e.consume(d),l)}function u(d){return d===95?r=!0:(s=r,r=void 0),e.consume(d),l}function f(d){return s||r||!o?n(d):t(d)}}function nI(e,t){let n=0,r=0;return s;function s(l){return l===40?(n++,e.consume(l),s):l===41&&r<n?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(d2,t,o)(l):l===null||at(l)||Ms(l)?t(l):(e.consume(l),s)}function o(l){return l===41&&r++,e.consume(l),s}}function rI(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),o):u===93?(e.consume(u),s):u===60||u===null||at(u)||Ms(u)?t(u):n(u)}function s(u){return u===null||u===40||u===91||at(u)||Ms(u)?t(u):r(u)}function o(u){return rn(u)?l(u):n(u)}function l(u){return u===59?(e.consume(u),r):rn(u)?(e.consume(u),l):n(u)}}function iI(e,t,n){return r;function r(o){return e.consume(o),s}function s(o){return Qt(o)?n(o):t(o)}}function p2(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||at(e)}function g2(e){return!rn(e)}function y2(e){return!(e===47||iy(e))}function iy(e){return e===43||e===45||e===46||e===95||Qt(e)}function m0(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const sI={tokenize:hI,partial:!0};function aI(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:cI,continuation:{tokenize:fI},exit:dI}},text:{91:{name:"gfmFootnoteCall",tokenize:uI},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:oI,resolveTo:lI}}}}function oI(e,t,n){const r=this;let s=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const f=r.events[s][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return u;function u(f){if(!l||!l._balanced)return n(f);const d=ir(r.sliceSerialize({start:l.end,end:r.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function lI(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",l,t],["exit",l,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function uI(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return u;function u(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),f}function f(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(p){if(o>999||p===93&&!l||p===null||p===91||at(p))return n(p);if(p===93){e.exit("chunkString");const g=e.exit("gfmFootnoteCallString");return s.includes(ir(r.sliceSerialize(g)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return at(p)||(l=!0),o++,e.consume(p),p===92?h:d}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,d):d(p)}}function cI(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,l=0,u;return f;function f(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(b)}function h(b){if(l>999||b===93&&!u||b===null||b===91||at(b))return n(b);if(b===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return o=ir(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),g}return at(b)||(u=!0),l++,e.consume(b),b===92?p:h}function p(b){return b===91||b===92||b===93?(e.consume(b),l++,h):h(b)}function g(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),s.includes(o)||s.push(o),qe(e,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return t(b)}}function fI(e,t,n){return e.check(su,t,e.attempt(sI,t,n))}function dI(e){e.exit("gfmFootnoteDefinition")}function hI(e,t,n){const r=this;return qe(e,s,"gfmFootnoteDefinitionIndent",5);function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):n(o)}}function mI(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(l,u){let f=-1;for(;++f<l.length;)if(l[f][0]==="enter"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._close){let d=f;for(;d--;)if(l[d][0]==="exit"&&l[d][1].type==="strikethroughSequenceTemporary"&&l[d][1]._open&&l[f][1].end.offset-l[f][1].start.offset===l[d][1].end.offset-l[d][1].start.offset){l[f][1].type="strikethroughSequence",l[d][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},l[d][1].start),end:Object.assign({},l[f][1].end)},p={type:"strikethroughText",start:Object.assign({},l[d][1].end),end:Object.assign({},l[f][1].start)},g=[["enter",h,u],["enter",l[d][1],u],["exit",l[d][1],u],["enter",p,u]],v=u.parser.constructs.insideSpan.null;v&&An(g,g.length,0,Jf(v,l.slice(d+1,f),u)),An(g,g.length,0,[["exit",p,u],["enter",l[f][1],u],["exit",l[f][1],u],["exit",h,u]]),An(l,d-1,f-d+3,g),f=d+g.length-2;break}}for(f=-1;++f<l.length;)l[f][1].type==="strikethroughSequenceTemporary"&&(l[f][1].type="data");return l}function o(l,u,f){const d=this.previous,h=this.events;let p=0;return g;function g(b){return d===126&&h[h.length-1][1].type!=="characterEscape"?f(b):(l.enter("strikethroughSequenceTemporary"),v(b))}function v(b){const w=Fa(d);if(b===126)return p>1?f(b):(l.consume(b),p++,v);if(p<2&&!n)return f(b);const _=l.exit("strikethroughSequenceTemporary"),E=Fa(b);return _._open=!E||E===2&&!!w,_._close=!w||w===2&&!!E,u(b)}}}class pI{constructor(){this.map=[]}add(t,n,r){gI(this,t,n,r)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const o of s)t.push(o);s=r.pop()}this.map.length=0}}function gI(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function yI(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function vI(){return{flow:{null:{name:"table",tokenize:xI,resolveAll:bI}}}}function xI(e,t,n){const r=this;let s=0,o=0,l;return u;function u(O){let V=r.events.length-1;for(;V>-1;){const j=r.events[V][1].type;if(j==="lineEnding"||j==="linePrefix")V--;else break}const H=V>-1?r.events[V][1].type:null,Q=H==="tableHead"||H==="tableRow"?R:f;return Q===R&&r.parser.lazy[r.now().line]?n(O):Q(O)}function f(O){return e.enter("tableHead"),e.enter("tableRow"),d(O)}function d(O){return O===124||(l=!0,o+=1),h(O)}function h(O){return O===null?n(O):Ce(O)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),v):n(O):Fe(O)?qe(e,h,"whitespace")(O):(o+=1,l&&(l=!1,s+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),l=!0,h):(e.enter("data"),p(O)))}function p(O){return O===null||O===124||at(O)?(e.exit("data"),h(O)):(e.consume(O),O===92?g:p)}function g(O){return O===92||O===124?(e.consume(O),p):p(O)}function v(O){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(O):(e.enter("tableDelimiterRow"),l=!1,Fe(O)?qe(e,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):b(O))}function b(O){return O===45||O===58?_(O):O===124?(l=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),w):D(O)}function w(O){return Fe(O)?qe(e,_,"whitespace")(O):_(O)}function _(O){return O===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),E):O===45?(o+=1,E(O)):O===null||Ce(O)?M(O):D(O)}function E(O){return O===45?(e.enter("tableDelimiterFiller"),T(O)):D(O)}function T(O){return O===45?(e.consume(O),T):O===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(O))}function S(O){return Fe(O)?qe(e,M,"whitespace")(O):M(O)}function M(O){return O===124?b(O):O===null||Ce(O)?!l||s!==o?D(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(O)):D(O)}function D(O){return n(O)}function R(O){return e.enter("tableRow"),B(O)}function B(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),B):O===null||Ce(O)?(e.exit("tableRow"),t(O)):Fe(O)?qe(e,B,"whitespace")(O):(e.enter("data"),z(O))}function z(O){return O===null||O===124||at(O)?(e.exit("data"),B(O)):(e.consume(O),O===92?U:z)}function U(O){return O===92||O===124?(e.consume(O),z):z(O)}}function bI(e,t){let n=-1,r=!0,s=0,o=[0,0,0,0],l=[0,0,0,0],u=!1,f=0,d,h,p;const g=new pI;for(;++n<e.length;){const v=e[n],b=v[1];v[0]==="enter"?b.type==="tableHead"?(u=!1,f!==0&&(S_(g,t,f,d,h),h=void 0,f=0),d={type:"table",start:Object.assign({},b.start),end:Object.assign({},b.end)},g.add(n,0,[["enter",d,t]])):b.type==="tableRow"||b.type==="tableDelimiterRow"?(r=!0,p=void 0,o=[0,0,0,0],l=[0,n+1,0,0],u&&(u=!1,h={type:"tableBody",start:Object.assign({},b.start),end:Object.assign({},b.end)},g.add(n,0,[["enter",h,t]])),s=b.type==="tableDelimiterRow"?2:h?3:1):s&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],p=$c(g,t,o,s,void 0,p),o=[0,0,0,0]),l[2]=n)):b.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],p=$c(g,t,o,s,void 0,p)),o=l,l=[o[1],n,0,0])):b.type==="tableHead"?(u=!0,f=n):b.type==="tableRow"||b.type==="tableDelimiterRow"?(f=n,o[1]!==0?(l[0]=l[1],p=$c(g,t,o,s,n,p)):l[1]!==0&&(p=$c(g,t,l,s,n,p)),s=0):s&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&S_(g,t,f,d,h),g.consume(t.events),n=-1;++n<t.events.length;){const v=t.events[n];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=yI(t.events,n))}return e}function $c(e,t,n,r,s,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(o.end=Object.assign({},ka(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const f=ka(t.events,n[1]);if(o={type:l,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=ka(t.events,n[2]),h=ka(t.events,n[3]),p={type:u,start:Object.assign({},d),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",p,t]]),r!==2){const g=t.events[n[2]],v=t.events[n[3]];if(g[1].end=Object.assign({},v[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[2]+1){const b=n[2]+1,w=n[3]-n[2]-1;e.add(b,w,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return s!==void 0&&(o.end=Object.assign({},ka(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function S_(e,t,n,r,s){const o=[],l=ka(t.events,n);s&&(s.end=Object.assign({},l),o.push(["exit",s,t])),r.end=Object.assign({},l),o.push(["exit",r,t]),e.add(n+1,0,o)}function ka(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const wI={name:"tasklistCheck",tokenize:SI};function _I(){return{text:{91:wI}}}function SI(e,t,n){const r=this;return s;function s(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),o)}function o(f){return at(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(f)}function u(f){return Ce(f)?t(f):Fe(f)?e.check({tokenize:EI},t,n)(f):n(f)}}function EI(e,t,n){return qe(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function kI(e){return CT([QP(),aI(),mI(e),vI(),_I()])}const TI={};function v2(e){const t=this,n=e||TI,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(kI(n)),o.push(GP()),l.push(YP(n))}const CI=({message:e})=>A.jsx("div",{className:"flex flex-col w-[80%] bg-white rounded-lg shadow-sm border border-gray-200",children:A.jsxs("div",{className:"flex flex-col p-4",children:[A.jsx("div",{className:"text-sm font-medium text-gray-700 mb-2",children:e.name}),A.jsx("div",{className:"markdown-body max-w-none",children:A.jsx(ZT,{remarkPlugins:[v2],children:Qy(e.content)})}),A.jsx(Zy,{response_metadata:e.response_metadata,usage_metadata:e.usage_metadata||{},spend_time:e.spend_time,id:e.id})]})});/**
|
|
89
|
+
* @license lucide-react v0.511.0 - ISC
|
|
90
|
+
*
|
|
91
|
+
* This source code is licensed under the ISC license.
|
|
92
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
+
*/const AI=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),NI=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),E_=e=>{const t=NI(e);return t.charAt(0).toUpperCase()+t.slice(1)},x2=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),MI=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
94
|
+
* @license lucide-react v0.511.0 - ISC
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the ISC license.
|
|
97
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
+
*/var OI={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"};/**
|
|
99
|
+
* @license lucide-react v0.511.0 - ISC
|
|
100
|
+
*
|
|
101
|
+
* This source code is licensed under the ISC license.
|
|
102
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
+
*/const RI=X.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:l,...u},f)=>X.createElement("svg",{ref:f,...OI,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:x2("lucide",s),...!o&&!MI(u)&&{"aria-hidden":"true"},...u},[...l.map(([d,h])=>X.createElement(d,h)),...Array.isArray(o)?o:[o]]));/**
|
|
104
|
+
* @license lucide-react v0.511.0 - ISC
|
|
105
|
+
*
|
|
106
|
+
* This source code is licensed under the ISC license.
|
|
107
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
108
|
+
*/const $t=(e,t)=>{const n=X.forwardRef(({className:r,...s},o)=>X.createElement(RI,{ref:o,iconNode:t,className:x2(`lucide-${AI(E_(e))}`,`lucide-${e}`,r),...s}));return n.displayName=E_(e),n};/**
|
|
109
|
+
* @license lucide-react v0.511.0 - ISC
|
|
110
|
+
*
|
|
111
|
+
* This source code is licensed under the ISC license.
|
|
112
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
+
*/const DI=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],jI=$t("brain",DI);/**
|
|
114
|
+
* @license lucide-react v0.511.0 - ISC
|
|
115
|
+
*
|
|
116
|
+
* This source code is licensed under the ISC license.
|
|
117
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
+
*/const zI=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],LI=$t("chevron-down",zI);/**
|
|
119
|
+
* @license lucide-react v0.511.0 - ISC
|
|
120
|
+
*
|
|
121
|
+
* This source code is licensed under the ISC license.
|
|
122
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
+
*/const PI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],II=$t("circle-check",PI);/**
|
|
124
|
+
* @license lucide-react v0.511.0 - ISC
|
|
125
|
+
*
|
|
126
|
+
* This source code is licensed under the ISC license.
|
|
127
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
+
*/const VI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],BI=$t("circle-x",VI);/**
|
|
129
|
+
* @license lucide-react v0.511.0 - ISC
|
|
130
|
+
*
|
|
131
|
+
* This source code is licensed under the ISC license.
|
|
132
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
133
|
+
*/const UI=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],b2=$t("file-json",UI);/**
|
|
134
|
+
* @license lucide-react v0.511.0 - ISC
|
|
135
|
+
*
|
|
136
|
+
* This source code is licensed under the ISC license.
|
|
137
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
+
*/const HI=[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]],FI=$t("file-pen",HI);/**
|
|
139
|
+
* @license lucide-react v0.511.0 - ISC
|
|
140
|
+
*
|
|
141
|
+
* This source code is licensed under the ISC license.
|
|
142
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
143
|
+
*/const $I=[["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"}]],qI=$t("file",$I);/**
|
|
144
|
+
* @license lucide-react v0.511.0 - ISC
|
|
145
|
+
*
|
|
146
|
+
* This source code is licensed under the ISC license.
|
|
147
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
148
|
+
*/const GI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],YI=$t("globe",GI);/**
|
|
149
|
+
* @license lucide-react v0.511.0 - ISC
|
|
150
|
+
*
|
|
151
|
+
* This source code is licensed under the ISC license.
|
|
152
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
153
|
+
*/const ZI=[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],XI=$t("history",ZI);/**
|
|
154
|
+
* @license lucide-react v0.511.0 - ISC
|
|
155
|
+
*
|
|
156
|
+
* This source code is licensed under the ISC license.
|
|
157
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
158
|
+
*/const QI=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],KI=$t("link",QI);/**
|
|
159
|
+
* @license lucide-react v0.511.0 - ISC
|
|
160
|
+
*
|
|
161
|
+
* This source code is licensed under the ISC license.
|
|
162
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
163
|
+
*/const WI=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],JI=$t("log-out",WI);/**
|
|
164
|
+
* @license lucide-react v0.511.0 - ISC
|
|
165
|
+
*
|
|
166
|
+
* This source code is licensed under the ISC license.
|
|
167
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
168
|
+
*/const eV=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],tV=$t("network",eV);/**
|
|
169
|
+
* @license lucide-react v0.511.0 - ISC
|
|
170
|
+
*
|
|
171
|
+
* This source code is licensed under the ISC license.
|
|
172
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
173
|
+
*/const nV=[["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"}]],rV=$t("refresh-cw",nV);/**
|
|
174
|
+
* @license lucide-react v0.511.0 - ISC
|
|
175
|
+
*
|
|
176
|
+
* This source code is licensed under the ISC license.
|
|
177
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
178
|
+
*/const iV=[["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"}]],sV=$t("rotate-ccw",iV);/**
|
|
179
|
+
* @license lucide-react v0.511.0 - ISC
|
|
180
|
+
*
|
|
181
|
+
* This source code is licensed under the ISC license.
|
|
182
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
183
|
+
*/const aV=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],oV=$t("search",aV);/**
|
|
184
|
+
* @license lucide-react v0.511.0 - ISC
|
|
185
|
+
*
|
|
186
|
+
* This source code is licensed under the ISC license.
|
|
187
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
188
|
+
*/const lV=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],uV=$t("trash-2",lV);/**
|
|
189
|
+
* @license lucide-react v0.511.0 - ISC
|
|
190
|
+
*
|
|
191
|
+
* This source code is licensed under the ISC license.
|
|
192
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
193
|
+
*/const cV=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],w2=$t("x",cV),fV=Ha({name:"ask_user_for_approve",description:"Request user review and approval for plans or content, wait for user feedback before proceeding",parameters:[{name:"title",type:"string",description:"Title or subject of the content to be reviewed"}],onlyRender:!0,handler:oT.waitForUIDone,render(e){var l;const t=e.getInputRepaired(),[n,r]=X.useState(((l=e.getJSONOutputSafe())==null?void 0:l.feedback)||""),s=()=>{const u={approved:!0,feedback:n.trim()||null};e.response(u)},o=()=>{const u={approved:!1,feedback:n.trim()||"用户拒绝了请求"};e.response(u)};return A.jsxs("div",{className:"flex flex-col gap-3 p-4 bg-white rounded-lg border border-gray-200",children:[A.jsxs("div",{className:"flex items-center gap-2 text-gray-700",children:[A.jsx(oV,{className:"w-4 h-4 text-blue-500"}),A.jsx("span",{children:"请求审核批准"}),t.title&&A.jsx("span",{className:"text-sm text-gray-500 ml-2 truncate max-w-[200px]",children:t.title})]}),A.jsxs("div",{className:"flex gap-2",children:[A.jsx("textarea",{disabled:e.state==="done",className:"flex-1 p-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:bg-gray-50 disabled:text-gray-500",placeholder:"反馈意见(可选)",value:n,onChange:u=>r(u.target.value),rows:1}),A.jsxs("button",{disabled:e.state==="done",className:"px-3 py-2 text-sm font-medium text-white bg-green-500 rounded-lg hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1.5",onClick:s,children:[A.jsx(II,{className:"w-4 h-4"}),"批准"]}),A.jsxs("button",{disabled:e.state==="done",className:"px-3 py-2 text-sm font-medium text-white bg-red-500 rounded-lg hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1.5",onClick:o,children:[A.jsx(BI,{className:"w-4 h-4"}),"拒绝"]})]})]})}}),dV=Ha({name:"update_plan",description:"展示当前执行计划,等待用户确认",parameters:[],onlyRender:!0,render(e){const n=e.getInputRepaired()||{thought:"",steps:[]};return A.jsxs("div",{className:"p-3 bg-white rounded-lg border border-gray-200",children:[A.jsxs("div",{className:"flex items-center gap-1.5 text-gray-700 mb-2 font-bold",children:[A.jsx(FI,{className:"w-3.5 h-3.5 text-blue-500"}),A.jsx("span",{children:"执行计划"})]}),A.jsxs("div",{className:"space-y-2",children:[n.title&&A.jsxs("div",{className:"text-sm",children:[A.jsx("span",{className:"text-gray-500",children:"标题:"}),A.jsx("span",{children:n.title})]}),n.thought&&A.jsxs("div",{className:"text-sm",children:[A.jsx("span",{className:"text-gray-500",children:"思考:"}),A.jsx("span",{className:"whitespace-pre-wrap",children:n.thought})]}),n.steps&&n.steps.length>0&&A.jsxs("div",{className:"space-y-1.5",children:[A.jsx("div",{className:"text-sm text-gray-500",children:"步骤:"}),n.steps.map((r,s)=>A.jsxs("div",{className:"pl-2 border-l-2 border-gray-200",children:[A.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[r.step_type==="research"?A.jsx(YI,{className:"w-3.5 h-3.5 text-blue-500"}):A.jsx(jI,{className:"w-3.5 h-3.5 text-purple-500"}),A.jsx("span",{className:"font-medium",children:r.title}),r.need_web_search&&A.jsx("span",{className:"text-xs text-blue-500",children:"[搜索]"})]}),A.jsx("div",{className:"text-sm text-gray-600 pl-5",children:r.description})]},s))]})]})]})}}),hV=Ha({name:"web_search",description:"A powerful web search tool that provides comprehensive, real-time results using search engine. Returns relevant web content with customizable parameters for result count, content type, and domain filtering. Ideal for gathering current information, news, and detailed web content analysis.",parameters:[],onlyRender:!0,render(e){var u;const t=e.getInputRepaired(),n=((u=e.getJSONOutputSafe())==null?void 0:u.flatMap(f=>f.results))||[],[r,s]=X.useState(new Set),o=f=>{const d=new Set(r);d.has(f)?d.delete(f):d.add(f),s(d)},l=f=>{window.open(f,"_blank","noopener,noreferrer")};return A.jsxs("div",{className:"p-4 space-y-4",children:[A.jsxs("div",{className:"text-sm text-gray-500",children:["Search Query: ",t.query,";Get ",n.length," results"]}),A.jsx("div",{className:"space-y-3 max-h-[300px] overflow-y-auto",children:n.map((f,d)=>A.jsxs("div",{className:"border rounded-lg p-2 hover:bg-gray-50",children:[A.jsxs("div",{className:"flex items-center justify-between select-none cursor-pointer",onClick:()=>o(d),children:[A.jsx("span",{className:"font-xs flex-1",children:f.title}),A.jsx("div",{onClick:h=>{h.stopPropagation(),l(f.url)},className:"px-3 py-1 text-sm",children:A.jsx(KI,{className:"w-4 h-4"})}),A.jsx("span",{className:"text-gray-400",children:r.has(d)?"▼":"▶"})]}),r.has(d)&&A.jsxs("div",{className:"mt-3 space-y-2",children:[A.jsx("p",{className:"text-sm text-gray-600",children:f.description}),A.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[A.jsx("span",{children:new Date(f.updateTime).toLocaleDateString()}),A.jsx("span",{children:"•"}),A.jsx("span",{children:f.metadata.engines.join(", ")})]})]})]},d))})]})}});function mV(e){return"default"}function pV(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null||Array.isArray(e)||typeof e=="object"?e:String(e)}const gV=e=>({manageMemory:Ha({name:"manage_memory",description:`这是一个**结构化**工具,用于**管理跨对话的持久化记忆**,以保留上下文、用户偏好和学习到的见解。它支持**创建、更新、检索和删除记忆条目**,从而在互动中保持连续性和个性化。
|
|
194
|
+
|
|
195
|
+
### 你需要记录记忆的场景
|
|
196
|
+
|
|
197
|
+
1. 请你第一时间敏锐记录下用户的细节偏好,包括对话风格、习惯、内容、方式等。
|
|
198
|
+
2. 记录下高价值的问答,比如用户对你的纠正、任务过程中的关键信息
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
### 核心功能
|
|
202
|
+
|
|
203
|
+
该工具具备以下关键能力:
|
|
204
|
+
|
|
205
|
+
* **记忆生命周期管理:** 对记忆条目进行**全生命周期管理**,包括创建、更新、检索和删除。
|
|
206
|
+
* **分段与标签支持:** 支持**分段或打标签的记忆条目**,方便分类和高效检索。
|
|
207
|
+
* **存储选项灵活:** 提供**临时和永久两种存储选项**,以适应不同类型信息的存储需求。
|
|
208
|
+
`,parameters:[{name:"path",type:"string",description:"记忆路径(创建时需要)"},{name:"tags",type:"string[]",description:"记忆标签(创建或更新时需要)"},{name:"content",type:"string",description:"记忆内容(创建或更新时需要)"},{name:"action",type:"string",enum:["create","update","delete"],description:"操作类型:create(创建)、update(更新)、delete(删除)"},{name:"id",type:"string",description:"记忆ID(更新或删除时需要,创建时会自动生成)",required:!1},{name:"referencePath",type:"string",description:"引用文档的 URL",required:!1}],handler:async t=>{const{content:n,action:r,id:s,tags:o,path:l,referencePath:u}=t;if((r==="delete"||r==="update")&&!s)throw new Error("删除或更新记忆时必须提供记忆ID");if((r==="create"||r==="update")&&!n)throw new Error("创建或更新记忆时必须提供内容");try{if(r==="delete")return await e.delete(Number(s)),`已删除记忆 ${s}`;const f={text:n,content:pV(n),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),namespace:mV(),tags:o,path:l,type:"document",referencePath:u};return r==="create"?`已创建记忆 ${await e.insert(f)}`:(await e.update(Number(s),f),`已更新记忆 ${s}`)}catch(f){throw new Error(`记忆操作失败: ${f}`)}}}),searchMemory:Ha({name:"search_memory",description:"搜索长期记忆中的相关信息,帮助维护对话上下文",parameters:[{name:"query",type:"string",description:"请使用中文关键词进行搜索"},{name:"tags",type:"string[]",description:"记忆标签",required:!1},{name:"path",type:"string",description:"记忆路径,memory://user_id/path/to/memory_name",required:!1},{name:"limit",type:"number",description:"返回结果的最大数量(默认10)",required:!1}],handler:async t=>{const{query:n,limit:r=10,tags:s,path:o}=t;if(!n||typeof n=="string"&&n.trim().length===0)throw new Error("搜索查询不能为空");try{const l=await e.query(n.toString(),{limit:r});return{query:n.toString(),results:l,total:l.length,limit:Number(r)}}catch(l){throw new Error(`搜索记忆失败: ${l}`)}}})}),sy=(e,t)=>t.some(n=>e instanceof n);let k_,T_;function yV(){return k_||(k_=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function vV(){return T_||(T_=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const ay=new WeakMap,dp=new WeakMap,rd=new WeakMap;function xV(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",l)},o=()=>{n(Ss(e.result)),s()},l=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",l)});return rd.set(t,e),t}function bV(e){if(ay.has(e))return;const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",l),e.removeEventListener("abort",l)},o=()=>{n(),s()},l=()=>{r(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",o),e.addEventListener("error",l),e.addEventListener("abort",l)});ay.set(e,t)}let oy={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return ay.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ss(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function _2(e){oy=e(oy)}function wV(e){return vV().includes(e)?function(...t){return e.apply(ly(this),t),Ss(this.request)}:function(...t){return Ss(e.apply(ly(this),t))}}function _V(e){return typeof e=="function"?wV(e):(e instanceof IDBTransaction&&bV(e),sy(e,yV())?new Proxy(e,oy):e)}function Ss(e){if(e instanceof IDBRequest)return xV(e);if(dp.has(e))return dp.get(e);const t=_V(e);return t!==e&&(dp.set(e,t),rd.set(t,e)),t}const ly=e=>rd.get(e);function SV(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const l=indexedDB.open(e,t),u=Ss(l);return r&&l.addEventListener("upgradeneeded",f=>{r(Ss(l.result),f.oldVersion,f.newVersion,Ss(l.transaction),f)}),n&&l.addEventListener("blocked",f=>n(f.oldVersion,f.newVersion,f)),u.then(f=>{o&&f.addEventListener("close",()=>o()),s&&f.addEventListener("versionchange",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),u}const EV=["get","getKey","getAll","getAllKeys","count"],kV=["put","add","delete","clear"],hp=new Map;function C_(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(hp.get(t))return hp.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=kV.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||EV.includes(n)))return;const o=async function(l,...u){const f=this.transaction(l,s?"readwrite":"readonly");let d=f.store;return r&&(d=d.index(u.shift())),(await Promise.all([d[n](...u),s&&f.done]))[0]};return hp.set(t,o),o}_2(e=>({...e,get:(t,n,r)=>C_(t,n)||e.get(t,n,r),has:(t,n)=>!!C_(t,n)||e.has(t,n)}));const TV=["continue","continuePrimaryKey","advance"],A_={},uy=new WeakMap,S2=new WeakMap,CV={get(e,t){if(!TV.includes(t))return e[t];let n=A_[t];return n||(n=A_[t]=function(...r){uy.set(this,S2.get(this)[t](...r))}),n}};async function*AV(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;const n=new Proxy(t,CV);for(S2.set(n,t),rd.set(n,ly(t));t;)yield n,t=await(uy.get(n)||t.continue()),uy.delete(n)}function N_(e,t){return t===Symbol.asyncIterator&&sy(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&sy(e,[IDBIndex,IDBObjectStore])}_2(e=>({...e,get(t,n,r){return N_(t,n)?AV:e.get(t,n,r)},has(t,n){return N_(t,n)||e.has(t,n)}}));class NV{constructor(t){ut(this,"isInitialized",!1);ut(this,"config");this.config=t}}const MV="ENTRIES",E2="KEYS",k2="VALUES",Ft="";class mp{constructor(t,n){const r=t._tree,s=Array.from(r.keys());this.set=t,this._type=n,this._path=s.length>0?[{node:r,keys:s}]:[]}next(){const t=this.dive();return this.backtrack(),t}dive(){if(this._path.length===0)return{done:!0,value:void 0};const{node:t,keys:n}=_a(this._path);if(_a(n)===Ft)return{done:!1,value:this.result()};const r=t.get(_a(n));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const t=_a(this._path).keys;t.pop(),!(t.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:t})=>_a(t)).filter(t=>t!==Ft).join("")}value(){return _a(this._path).node.get(Ft)}result(){switch(this._type){case k2:return this.value();case E2:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const _a=e=>e[e.length-1],OV=(e,t,n)=>{const r=new Map;if(t===void 0)return r;const s=t.length+1,o=s+n,l=new Uint8Array(o*s).fill(n+1);for(let u=0;u<s;++u)l[u]=u;for(let u=1;u<o;++u)l[u*s]=u;return T2(e,t,n,r,l,1,s,""),r},T2=(e,t,n,r,s,o,l,u)=>{const f=o*l;e:for(const d of e.keys())if(d===Ft){const h=s[f-1];h<=n&&r.set(u,[e.get(d),h])}else{let h=o;for(let p=0;p<d.length;++p,++h){const g=d[p],v=l*h,b=v-l;let w=s[v];const _=Math.max(0,h-n-1),E=Math.min(l-1,h+n);for(let T=_;T<E;++T){const S=g!==t[T],M=s[b+T]+ +S,D=s[b+T+1]+1,R=s[v+T]+1,B=s[v+T+1]=Math.min(M,D,R);B<w&&(w=B)}if(w>n)continue e}T2(e.get(d),t,n,r,s,h,l,u+d)}};class Pi{constructor(t=new Map,n=""){this._size=void 0,this._tree=t,this._prefix=n}atPrefix(t){if(!t.startsWith(this._prefix))throw new Error("Mismatched prefix");const[n,r]=Mf(this._tree,t.slice(this._prefix.length));if(n===void 0){const[s,o]=p0(r);for(const l of s.keys())if(l!==Ft&&l.startsWith(o)){const u=new Map;return u.set(l.slice(o.length),s.get(l)),new Pi(u,t)}}return new Pi(n,t)}clear(){this._size=void 0,this._tree.clear()}delete(t){return this._size=void 0,RV(this._tree,t)}entries(){return new mp(this,MV)}forEach(t){for(const[n,r]of this)t(n,r,this)}fuzzyGet(t,n){return OV(this._tree,t,n)}get(t){const n=cy(this._tree,t);return n!==void 0?n.get(Ft):void 0}has(t){const n=cy(this._tree,t);return n!==void 0&&n.has(Ft)}keys(){return new mp(this,E2)}set(t,n){if(typeof t!="string")throw new Error("key must be a string");return this._size=void 0,pp(this._tree,t).set(Ft,n),this}get size(){if(this._size)return this._size;this._size=0;const t=this.entries();for(;!t.next().done;)this._size+=1;return this._size}update(t,n){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const r=pp(this._tree,t);return r.set(Ft,n(r.get(Ft))),this}fetch(t,n){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const r=pp(this._tree,t);let s=r.get(Ft);return s===void 0&&r.set(Ft,s=n()),s}values(){return new mp(this,k2)}[Symbol.iterator](){return this.entries()}static from(t){const n=new Pi;for(const[r,s]of t)n.set(r,s);return n}static fromObject(t){return Pi.from(Object.entries(t))}}const Mf=(e,t,n=[])=>{if(t.length===0||e==null)return[e,n];for(const r of e.keys())if(r!==Ft&&t.startsWith(r))return n.push([e,r]),Mf(e.get(r),t.slice(r.length),n);return n.push([e,t]),Mf(void 0,"",n)},cy=(e,t)=>{if(t.length===0||e==null)return e;for(const n of e.keys())if(n!==Ft&&t.startsWith(n))return cy(e.get(n),t.slice(n.length))},pp=(e,t)=>{const n=t.length;e:for(let r=0;e&&r<n;){for(const o of e.keys())if(o!==Ft&&t[r]===o[0]){const l=Math.min(n-r,o.length);let u=1;for(;u<l&&t[r+u]===o[u];)++u;const f=e.get(o);if(u===o.length)e=f;else{const d=new Map;d.set(o.slice(u),f),e.set(t.slice(r,r+u),d),e.delete(o),e=d}r+=u;continue e}const s=new Map;return e.set(t.slice(r),s),s}return e},RV=(e,t)=>{const[n,r]=Mf(e,t);if(n!==void 0){if(n.delete(Ft),n.size===0)C2(r);else if(n.size===1){const[s,o]=n.entries().next().value;A2(r,s,o)}}},C2=e=>{if(e.length===0)return;const[t,n]=p0(e);if(t.delete(n),t.size===0)C2(e.slice(0,-1));else if(t.size===1){const[r,s]=t.entries().next().value;r!==Ft&&A2(e.slice(0,-1),r,s)}},A2=(e,t,n)=>{if(e.length===0)return;const[r,s]=p0(e);r.set(s+t,n),r.delete(s)},p0=e=>e[e.length-1],g0="or",N2="and",DV="and_not";class Es{constructor(t){if((t==null?void 0:t.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');const n=t.autoVacuum==null||t.autoVacuum===!0?vp:t.autoVacuum;this._options={...yp,...t,autoVacuum:n,searchOptions:{...M_,...t.searchOptions||{}},autoSuggestOptions:{...IV,...t.autoSuggestOptions||{}}},this._index=new Pi,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=dy,this.addFields(this._options.fields)}add(t){const{extractField:n,tokenize:r,processTerm:s,fields:o,idField:l}=this._options,u=n(t,l);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${l}"`);if(this._idToShortId.has(u))throw new Error(`MiniSearch: duplicate ID ${u}`);const f=this.addDocumentId(u);this.saveStoredFields(f,t);for(const d of o){const h=n(t,d);if(h==null)continue;const p=r(h.toString(),d),g=this._fieldIds[d],v=new Set(p).size;this.addFieldLength(f,g,this._documentCount-1,v);for(const b of p){const w=s(b,d);if(Array.isArray(w))for(const _ of w)this.addTerm(g,f,_);else w&&this.addTerm(g,f,w)}}}addAll(t){for(const n of t)this.add(n)}addAllAsync(t,n={}){const{chunkSize:r=10}=n,s={chunk:[],promise:Promise.resolve()},{chunk:o,promise:l}=t.reduce(({chunk:u,promise:f},d,h)=>(u.push(d),(h+1)%r===0?{chunk:[],promise:f.then(()=>new Promise(p=>setTimeout(p,0))).then(()=>this.addAll(u))}:{chunk:u,promise:f}),s);return l.then(()=>this.addAll(o))}remove(t){const{tokenize:n,processTerm:r,extractField:s,fields:o,idField:l}=this._options,u=s(t,l);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${l}"`);const f=this._idToShortId.get(u);if(f==null)throw new Error(`MiniSearch: cannot remove document with ID ${u}: it is not in the index`);for(const d of o){const h=s(t,d);if(h==null)continue;const p=n(h.toString(),d),g=this._fieldIds[d],v=new Set(p).size;this.removeFieldLength(f,g,this._documentCount,v);for(const b of p){const w=r(b,d);if(Array.isArray(w))for(const _ of w)this.removeTerm(g,f,_);else w&&this.removeTerm(g,f,w)}}this._storedFields.delete(f),this._documentIds.delete(f),this._idToShortId.delete(u),this._fieldLength.delete(f),this._documentCount-=1}removeAll(t){if(t)for(const n of t)this.remove(n);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Pi,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(t){const n=this._idToShortId.get(t);if(n==null)throw new Error(`MiniSearch: cannot discard document with ID ${t}: it is not in the index`);this._idToShortId.delete(t),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach((r,s)=>{this.removeFieldLength(n,s,this._documentCount,r)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:t,minDirtCount:n,batchSize:r,batchWait:s}=this._options.autoVacuum;this.conditionalVacuum({batchSize:r,batchWait:s},{minDirtCount:n,minDirtFactor:t})}discardAll(t){const n=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const r of t)this.discard(r)}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()}replace(t){const{idField:n,extractField:r}=this._options,s=r(t,n);this.discard(s),this.add(t)}vacuum(t={}){return this.conditionalVacuum(t)}conditionalVacuum(t,n){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&n,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const r=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=dy,this.performVacuuming(t,r)}),this._enqueuedVacuum)):this.vacuumConditionsMet(n)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(t),this._currentVacuum)}async performVacuuming(t,n){const r=this._dirtCount;if(this.vacuumConditionsMet(n)){const s=t.batchSize||fy.batchSize,o=t.batchWait||fy.batchWait;let l=1;for(const[u,f]of this._index){for(const[d,h]of f)for(const[p]of h)this._documentIds.has(p)||(h.size<=1?f.delete(d):h.delete(p));this._index.get(u).size===0&&this._index.delete(u),l%s===0&&await new Promise(d=>setTimeout(d,o)),l+=1}this._dirtCount-=r}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(t){if(t==null)return!0;let{minDirtCount:n,minDirtFactor:r}=t;return n=n||vp.minDirtCount,r=r||vp.minDirtFactor,this.dirtCount>=n&&this.dirtFactor>=r}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(t){return this._idToShortId.has(t)}getStoredFields(t){const n=this._idToShortId.get(t);if(n!=null)return this._storedFields.get(n)}search(t,n={}){const{searchOptions:r}=this._options,s={...r,...n},o=this.executeQuery(t,n),l=[];for(const[u,{score:f,terms:d,match:h}]of o){const p=d.length||1,g={id:this._documentIds.get(u),score:f*p,terms:Object.keys(h),queryTerms:d,match:h};Object.assign(g,this._storedFields.get(u)),(s.filter==null||s.filter(g))&&l.push(g)}return t===Es.wildcard&&s.boostDocument==null||l.sort(R_),l}autoSuggest(t,n={}){n={...this._options.autoSuggestOptions,...n};const r=new Map;for(const{score:o,terms:l}of this.search(t,n)){const u=l.join(" "),f=r.get(u);f!=null?(f.score+=o,f.count+=1):r.set(u,{score:o,terms:l,count:1})}const s=[];for(const[o,{score:l,terms:u,count:f}]of r)s.push({suggestion:o,terms:u,score:l/f});return s.sort(R_),s}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(t,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(t),n)}static async loadJSONAsync(t,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(t),n)}static getDefault(t){if(yp.hasOwnProperty(t))return gp(yp,t);throw new Error(`MiniSearch: unknown option "${t}"`)}static loadJS(t,n){const{index:r,documentIds:s,fieldLength:o,storedFields:l,serializationVersion:u}=t,f=this.instantiateMiniSearch(t,n);f._documentIds=qc(s),f._fieldLength=qc(o),f._storedFields=qc(l);for(const[d,h]of f._documentIds)f._idToShortId.set(h,d);for(const[d,h]of r){const p=new Map;for(const g of Object.keys(h)){let v=h[g];u===1&&(v=v.ds),p.set(parseInt(g,10),qc(v))}f._index.set(d,p)}return f}static async loadJSAsync(t,n){const{index:r,documentIds:s,fieldLength:o,storedFields:l,serializationVersion:u}=t,f=this.instantiateMiniSearch(t,n);f._documentIds=await Gc(s),f._fieldLength=await Gc(o),f._storedFields=await Gc(l);for(const[h,p]of f._documentIds)f._idToShortId.set(p,h);let d=0;for(const[h,p]of r){const g=new Map;for(const v of Object.keys(p)){let b=p[v];u===1&&(b=b.ds),g.set(parseInt(v,10),await Gc(b))}++d%1e3===0&&await M2(0),f._index.set(h,g)}return f}static instantiateMiniSearch(t,n){const{documentCount:r,nextId:s,fieldIds:o,averageFieldLength:l,dirtCount:u,serializationVersion:f}=t;if(f!==1&&f!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const d=new Es(n);return d._documentCount=r,d._nextId=s,d._idToShortId=new Map,d._fieldIds=o,d._avgFieldLength=l,d._dirtCount=u||0,d._index=new Pi,d}executeQuery(t,n={}){if(t===Es.wildcard)return this.executeWildcardQuery(n);if(typeof t!="string"){const g={...n,...t,queries:void 0},v=t.queries.map(b=>this.executeQuery(b,g));return this.combineResults(v,g.combineWith)}const{tokenize:r,processTerm:s,searchOptions:o}=this._options,l={tokenize:r,processTerm:s,...o,...n},{tokenize:u,processTerm:f}=l,p=u(t).flatMap(g=>f(g)).filter(g=>!!g).map(PV(l)).map(g=>this.executeQuerySpec(g,l));return this.combineResults(p,l.combineWith)}executeQuerySpec(t,n){const r={...this._options.searchOptions,...n},s=(r.fields||this._options.fields).reduce((w,_)=>({...w,[_]:gp(r.boost,_)||1}),{}),{boostDocument:o,weights:l,maxFuzzy:u,bm25:f}=r,{fuzzy:d,prefix:h}={...M_.weights,...l},p=this._index.get(t.term),g=this.termResults(t.term,t.term,1,t.termBoost,p,s,o,f);let v,b;if(t.prefix&&(v=this._index.atPrefix(t.term)),t.fuzzy){const w=t.fuzzy===!0?.2:t.fuzzy,_=w<1?Math.min(u,Math.round(t.term.length*w)):w;_&&(b=this._index.fuzzyGet(t.term,_))}if(v)for(const[w,_]of v){const E=w.length-t.term.length;if(!E)continue;b==null||b.delete(w);const T=h*w.length/(w.length+.3*E);this.termResults(t.term,w,T,t.termBoost,_,s,o,f,g)}if(b)for(const w of b.keys()){const[_,E]=b.get(w);if(!E)continue;const T=d*w.length/(w.length+E);this.termResults(t.term,w,T,t.termBoost,_,s,o,f,g)}return g}executeWildcardQuery(t){const n=new Map,r={...this._options.searchOptions,...t};for(const[s,o]of this._documentIds){const l=r.boostDocument?r.boostDocument(o,"",this._storedFields.get(s)):1;n.set(s,{score:l,terms:[],match:{}})}return n}combineResults(t,n=g0){if(t.length===0)return new Map;const r=n.toLowerCase(),s=jV[r];if(!s)throw new Error(`Invalid combination operator: ${n}`);return t.reduce(s)||new Map}toJSON(){const t=[];for(const[n,r]of this._index){const s={};for(const[o,l]of r)s[o]=Object.fromEntries(l);t.push([n,s])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:t,serializationVersion:2}}termResults(t,n,r,s,o,l,u,f,d=new Map){if(o==null)return d;for(const h of Object.keys(l)){const p=l[h],g=this._fieldIds[h],v=o.get(g);if(v==null)continue;let b=v.size;const w=this._avgFieldLength[g];for(const _ of v.keys()){if(!this._documentIds.has(_)){this.removeTerm(g,_,n),b-=1;continue}const E=u?u(this._documentIds.get(_),n,this._storedFields.get(_)):1;if(!E)continue;const T=v.get(_),S=this._fieldLength.get(_)[g],M=LV(T,b,this._documentCount,S,w,f),D=r*s*p*E*M,R=d.get(_);if(R){R.score+=D,VV(R.terms,t);const B=gp(R.match,n);B?B.push(h):R.match[n]=[h]}else d.set(_,{score:D,terms:[t],match:{[n]:[h]}})}}return d}addTerm(t,n,r){const s=this._index.fetch(r,D_);let o=s.get(t);if(o==null)o=new Map,o.set(n,1),s.set(t,o);else{const l=o.get(n);o.set(n,(l||0)+1)}}removeTerm(t,n,r){if(!this._index.has(r)){this.warnDocumentChanged(n,t,r);return}const s=this._index.fetch(r,D_),o=s.get(t);o==null||o.get(n)==null?this.warnDocumentChanged(n,t,r):o.get(n)<=1?o.size<=1?s.delete(t):o.delete(n):o.set(n,o.get(n)-1),this._index.get(r).size===0&&this._index.delete(r)}warnDocumentChanged(t,n,r){for(const s of Object.keys(this._fieldIds))if(this._fieldIds[s]===n){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(t)} has changed before removal: term "${r}" was not present in field "${s}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(t){const n=this._nextId;return this._idToShortId.set(t,n),this._documentIds.set(n,t),this._documentCount+=1,this._nextId+=1,n}addFields(t){for(let n=0;n<t.length;n++)this._fieldIds[t[n]]=n}addFieldLength(t,n,r,s){let o=this._fieldLength.get(t);o==null&&this._fieldLength.set(t,o=[]),o[n]=s;const u=(this._avgFieldLength[n]||0)*r+s;this._avgFieldLength[n]=u/(r+1)}removeFieldLength(t,n,r,s){if(r===1){this._avgFieldLength[n]=0;return}const o=this._avgFieldLength[n]*r-s;this._avgFieldLength[n]=o/(r-1)}saveStoredFields(t,n){const{storeFields:r,extractField:s}=this._options;if(r==null||r.length===0)return;let o=this._storedFields.get(t);o==null&&this._storedFields.set(t,o={});for(const l of r){const u=s(n,l);u!==void 0&&(o[l]=u)}}}Es.wildcard=Symbol("*");const gp=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,jV={[g0]:(e,t)=>{for(const n of t.keys()){const r=e.get(n);if(r==null)e.set(n,t.get(n));else{const{score:s,terms:o,match:l}=t.get(n);r.score=r.score+s,r.match=Object.assign(r.match,l),O_(r.terms,o)}}return e},[N2]:(e,t)=>{const n=new Map;for(const r of t.keys()){const s=e.get(r);if(s==null)continue;const{score:o,terms:l,match:u}=t.get(r);O_(s.terms,l),n.set(r,{score:s.score+o,terms:s.terms,match:Object.assign(s.match,u)})}return n},[DV]:(e,t)=>{for(const n of t.keys())e.delete(n);return e}},zV={k:1.2,b:.7,d:.5},LV=(e,t,n,r,s,o)=>{const{k:l,b:u,d:f}=o;return Math.log(1+(n-t+.5)/(t+.5))*(f+e*(l+1)/(e+l*(1-u+u*r/s)))},PV=e=>(t,n,r)=>{const s=typeof e.fuzzy=="function"?e.fuzzy(t,n,r):e.fuzzy||!1,o=typeof e.prefix=="function"?e.prefix(t,n,r):e.prefix===!0,l=typeof e.boostTerm=="function"?e.boostTerm(t,n,r):1;return{term:t,fuzzy:s,prefix:o,termBoost:l}},yp={idField:"id",extractField:(e,t)=>e[t],tokenize:e=>e.split(BV),processTerm:e=>e.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(e,t)=>{typeof(console==null?void 0:console[e])=="function"&&console[e](t)},autoVacuum:!0},M_={combineWith:g0,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:zV},IV={combineWith:N2,prefix:(e,t,n)=>t===n.length-1},fy={batchSize:1e3,batchWait:10},dy={minDirtFactor:.1,minDirtCount:20},vp={...fy,...dy},VV=(e,t)=>{e.includes(t)||e.push(t)},O_=(e,t)=>{for(const n of t)e.includes(n)||e.push(n)},R_=({score:e},{score:t})=>t-e,D_=()=>new Map,qc=e=>{const t=new Map;for(const n of Object.keys(e))t.set(parseInt(n,10),e[n]);return t},Gc=async e=>{const t=new Map;let n=0;for(const r of Object.keys(e))t.set(parseInt(r,10),e[r]),++n%1e3===0&&await M2(0);return t},M2=e=>new Promise(t=>setTimeout(t,e)),BV=/[\n\r\p{Z}\p{P}]+/u,j_={dbName:"minisearch_memory_db",dbVersion:1,storeName:"memory",miniSearchOptions:{fields:["text","path","tags","referencePath"],storeFields:["text","path","tags","referencePath"],tokenize:O2}};function O2(e){const t=e.replace(/ /g,""),n=new Intl.Segmenter("zh-CN",{granularity:"word"});return Array.from(n.segment(t)).map(s=>s.segment)}class UV extends NV{constructor(n){const r={...j_,...n,miniSearchOptions:{...j_.miniSearchOptions,...(n==null?void 0:n.miniSearchOptions)||{}}};super(r);ut(this,"miniSearch");ut(this,"config");ut(this,"db");this.config=r}async initialize(){if(this.isInitialized)return;const{storeName:n}=this.config;this.db=await SV(this.config.dbName,this.config.dbVersion,{upgrade(s){s.objectStoreNames.contains(n)||s.createObjectStore(n,{keyPath:"id",autoIncrement:!0}),s.objectStoreNames.contains("minisearch_index")||s.createObjectStore("minisearch_index")}});const r={fields:this.config.miniSearchOptions.fields||["text"],storeFields:this.config.miniSearchOptions.storeFields||["text"],tokenize:this.config.miniSearchOptions.tokenize||O2};this.miniSearch=new Es(r);try{const s=await this.loadMiniSearchIndex();if(s)console.log(s),this.miniSearch=await Es.loadJSAsync(s,r),console.log("MiniSearch index loaded from IndexedDB.");else{console.log("No saved index found, building from documents...");const o=await this.getAll();o.length>0?(this.miniSearch.addAll(o),await this.saveMiniSearchIndex(this.miniSearch.toJSON()),console.log(`MiniSearch index built from ${o.length} documents and saved.`)):console.log("No documents found, index is empty.")}this.isInitialized=!0}catch(s){throw console.error("Failed to initialize FullTextSearchService:",s),s}}async insert(n){const r=this.db.transaction(this.config.storeName,"readwrite"),s=r.objectStore(this.config.storeName),o={...n},l=await s.add(o);return o.id=Number(l),await r.done,this.miniSearch.add(o),await this.saveMiniSearchIndex(this.miniSearch.toJSON()),o.id}async update(n,r){const o=this.db.transaction(this.config.storeName,"readwrite").objectStore(this.config.storeName),l={...r,id:n};await o.put(l);const u=await o.get(n);u&&this.miniSearch.remove(u),this.miniSearch.add(l),await this.saveMiniSearchIndex(this.miniSearch.toJSON())}async delete(n){const s=this.db.transaction(this.config.storeName,"readwrite").objectStore(this.config.storeName),o=await s.get(n);o&&this.miniSearch.remove(o),await s.delete(n),await this.saveMiniSearchIndex(this.miniSearch.toJSON())}async query(n,r){return this.miniSearch.search(n,r).slice(0,(r==null?void 0:r.limit)??5).map(o=>{const{id:l,text:u,...f}=o;return{id:l,text:u,tags:f.tags,path:f.path,type:f.type,score:Math.round(o.score),referencePath:f.referencePath}})}async get(n){return this.db.transaction(this.config.storeName,"readonly").objectStore(this.config.storeName).get(n)}async getAll(){return this.db.transaction(this.config.storeName,"readonly").objectStore(this.config.storeName).getAll()}async loadMiniSearchIndex(){return this.db.transaction("minisearch_index","readonly").objectStore("minisearch_index").get("indexData")}async saveMiniSearchIndex(n){const r=this.db.transaction("minisearch_index","readwrite");await r.objectStore("minisearch_index").put(n,"indexData"),await r.done}}const R2=X.createContext({artifacts:[],currentArtifact:null,setCurrentArtifactById:()=>{},getArtifactVersions:()=>[],showArtifact:!1,setShowArtifact:()=>{}}),id=()=>X.useContext(R2),HV=({children:e})=>{const[t,n]=X.useState([]),[r,s]=X.useState(!1),{renderMessages:o}=js(),[l,u]=X.useState(null),f=h=>t.filter(p=>p.filename===h).sort((p,g)=>p.version-g.version);X.useEffect(()=>{if(!o)return;const h=o.filter(v=>v.type==="tool").filter(v=>v.name==="create_artifacts"),p=new Map,g=h.map(v=>{const b=JSON.parse(v.tool_input),w=b.filename,E=(p.get(w)||0)+1;return p.set(w,E),{id:v.id,code:b.code,filename:w,version:E,filetype:b.filetype}});n(g)},[o]);const d=h=>{s(!0),u(t.find(p=>p.id===h)||null)};return A.jsx(R2.Provider,{value:{artifacts:t,currentArtifact:l,setCurrentArtifactById:d,getArtifactVersions:f,showArtifact:r,setShowArtifact:s},children:e})},FV=Ha({name:"create_artifacts",description:"创建并保存代码文件到 artifacts 目录",parameters:[],onlyRender:!0,render(e){const t=e.getInputRepaired(),{setCurrentArtifactById:n,currentArtifact:r}=id(),s=()=>{n(e.message.id)};return A.jsxs("div",{className:"p-4 space-y-4",children:[A.jsxs("div",{className:"text-sm text-gray-500",children:["创建文件: ",t.filename,".",t.filetype]}),A.jsx("div",{className:"border rounded-lg p-2 hover:bg-gray-50",children:A.jsxs("div",{className:"flex items-center justify-between select-none cursor-pointer",onClick:s,children:[A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx(qI,{className:"w-4 h-4"}),A.jsx("span",{className:"font-xs",children:t.filename})]}),A.jsxs("span",{className:"text-gray-400",children:[t.filetype," ",(r==null?void 0:r.id)===e.message.id?"▼":"▶"]})]})})]})}}),$V=localStorage.getItem("withCredentials")==="true"?(e,t)=>(t.credentials="include",fetch(e,t)):fetch,qV=()=>({showHistory:localStorage.getItem("showHistory")==="true"||!1,showGraph:localStorage.getItem("showGraph")==="true"||!1}),z_=e=>{Object.entries(e).forEach(([t,n])=>{localStorage.setItem(t,n.toString())})},y0=new UV({dbName:"memory_fulltext_db",dbVersion:1,storeName:"memory"});y0.initialize();console.log(y0);const L_=gV(y0),GV=P4(localStorage.getItem("agent_name")||"",{apiUrl:localStorage.getItem("apiUrl")||"http://localhost:8123",defaultHeaders:JSON.parse(localStorage.getItem("code")||"{}"),callerOptions:{fetch:$V}},{...qV(),onInit(e){e.tools.bindTools([FV,hV,fV,dV,L_.manageMemory,L_.searchMemory])}});let xp=(e,t)=>n=>{e.current!==n&&(e.current=n,t())};function YV(e,{keys:t,deps:n=[e,t]}={}){let r=X.useRef();r.current=e.get();let s=X.useCallback(l=>(xp(r,l)(e.value),(t==null?void 0:t.length)>0?R4(e,t,xp(r,l)):e.listen(xp(r,l))),n),o=()=>r.current;return X.useSyncExternalStore(s,o,o)}const D2=X.createContext(void 0),js=()=>{const e=X.useContext(D2);if(!e)throw new Error("useChat must be used within a ChatProvider");return e},ZV=({children:e})=>{const t=ij(GV,YV);return X.useEffect(()=>{t.initClient().then(n=>{t.showHistory&&t.refreshHistoryList(),console.log(n)}).catch(n=>{console.error(n);const r=prompt("Failed to initialize chat client: "+t.currentAgent+`
|
|
209
|
+
请输入 agent 名称`);localStorage.setItem("agent_name",r),location.reload()})},[]),A.jsx(D2.Provider,{value:t,children:e})},XV=({message:e,client:t,getMessageContent:n,formatTokens:r,isCollapsed:s,onToggleCollapse:o})=>{const{getToolUIRender:l}=js(),u=l(e.name);return A.jsx("div",{className:"flex flex-col w-full",children:u?u(e):A.jsxs("div",{className:"flex flex-col w-full bg-white rounded-lg shadow-sm border border-gray-200",children:[A.jsx("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-gray-50 transition-colors",onClick:o,children:A.jsxs("div",{className:"text-sm font-medium text-gray-700",onClick:()=>console.log(e),children:[e.node_name," | ",e.name]})}),!s&&A.jsxs("div",{className:"flex flex-col gap-4 p-4 border-t border-gray-100",children:[A.jsx(P_,{content:e.tool_input||""}),A.jsx(P_,{content:n(e.content)}),A.jsx(Zy,{response_metadata:e.response_metadata,usage_metadata:e.usage_metadata||{},spend_time:e.spend_time,id:e.id,tool_call_id:e.tool_call_id})]})]})})},P_=({content:e})=>{const t=()=>{try{return JSON.parse(e),!0}catch{return!1}},n=e.startsWith("{")&&e.endsWith("}")&&t(),r=e.includes("#")||e.includes("```")||e.includes("*"),[s,o]=X.useState(!1),[l,u]=X.useState(!1);return A.jsxs("div",{className:"flex flex-col",children:[A.jsxs("div",{className:"flex gap-2 mb-2",children:[n&&A.jsx("button",{onClick:()=>o(!s),className:"px-2 py-1 text-xs font-medium text-gray-600 bg-gray-100 rounded hover:bg-gray-200 transition-colors",children:"json"}),r&&A.jsx("button",{onClick:()=>u(!l),className:"px-2 py-1 text-xs font-medium text-gray-600 bg-gray-100 rounded hover:bg-gray-200 transition-colors",children:"markdown"})]}),A.jsx("div",{className:"flex flex-col max-h-[300px] overflow-auto border border-gray-200 rounded p-2 w-full text-xs font-mono whitespace-pre-wrap",children:s&&n?A.jsx("pre",{className:"whitespace-pre-wrap",children:JSON.stringify(JSON.parse(e),null,2)}):l&&r?A.jsx("div",{className:"markdown-body",children:A.jsx(ZT,{remarkPlugins:[v2],children:e})}):A.jsx("pre",{className:"whitespace-pre-wrap",children:e})})]})},j2=X.createContext({});function QV(e){const t=X.useRef(null);return t.current===null&&(t.current=e()),t.current}const v0=typeof window<"u",KV=v0?X.useLayoutEffect:X.useEffect,x0=X.createContext(null),z2=X.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function L2(e){return typeof e=="object"&&e!==null}function P2(e){return L2(e)&&"offsetHeight"in e}function WV(e=!0){const t=X.useContext(x0);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,o=X.useId();X.useEffect(()=>{if(e)return s(o)},[e]);const l=X.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,l]:[!0]}const Yc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],I_={value:null};function JV(e,t){let n=new Set,r=new Set,s=!1,o=!1;const l=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1},f=0;function d(p){l.has(p)&&(h.schedule(p),e()),f++,p(u)}const h={schedule:(p,g=!1,v=!1)=>{const w=v&&s?n:r;return g&&l.add(p),w.has(p)||w.add(p),p},cancel:p=>{r.delete(p),l.delete(p)},process:p=>{if(u=p,s){o=!0;return}s=!0,[n,r]=[r,n],n.forEach(d),t&&I_.value&&I_.value.frameloop[t].push(f),f=0,n.clear(),s=!1,o&&(o=!1,h.process(p))}};return h}const Xr={},e9=40;function I2(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,l=Yc.reduce((S,M)=>(S[M]=JV(o,t?M:void 0),S),{}),{setup:u,read:f,resolveKeyframes:d,preUpdate:h,update:p,preRender:g,render:v,postRender:b}=l,w=()=>{const S=Xr.useManualTiming?s.timestamp:performance.now();n=!1,Xr.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(S-s.timestamp,e9),1)),s.timestamp=S,s.isProcessing=!0,u.process(s),f.process(s),d.process(s),h.process(s),p.process(s),g.process(s),v.process(s),b.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(w))},_=()=>{n=!0,r=!0,s.isProcessing||e(w)};return{schedule:Yc.reduce((S,M)=>{const D=l[M];return S[M]=(R,B=!1,z=!1)=>(n||_(),D.schedule(R,B,z)),S},{}),cancel:S=>{for(let M=0;M<Yc.length;M++)l[Yc[M]].cancel(S)},state:s,steps:l}}const Hn=e=>e,{schedule:gt,cancel:Ui,state:Ht,steps:bp}=I2(typeof requestAnimationFrame<"u"?requestAnimationFrame:Hn,!0),V2=X.createContext({strict:!1}),V_={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},$a={};for(const e in V_)$a[e]={isEnabled:t=>V_[e].some(n=>!!t[n])};function t9(e){for(const t in e)$a[t]={...$a[t],...e[t]}}const n9=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 Of(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||n9.has(e)}let B2=e=>!Of(e);function r9(e){e&&(B2=t=>t.startsWith("on")?!Of(t):e(t))}try{r9(require("@emotion/is-prop-valid").default)}catch{}function i9(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(B2(s)||n===!0&&Of(s)||!t&&!Of(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function s9(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const sd=X.createContext({});function ad(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Bl(e){return typeof e=="string"||Array.isArray(e)}const b0=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],w0=["initial",...b0];function od(e){return ad(e.animate)||w0.some(t=>Bl(e[t]))}function U2(e){return!!(od(e)||e.variants)}function a9(e,t){if(od(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Bl(n)?n:void 0,animate:Bl(r)?r:void 0}}return e.inherit!==!1?t:{}}function o9(e){const{initial:t,animate:n}=a9(e,X.useContext(sd));return X.useMemo(()=>({initial:t,animate:n}),[B_(t),B_(n)])}function B_(e){return Array.isArray(e)?e.join(" "):e}const l9=Symbol.for("motionComponentSymbol");function Ca(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function u9(e,t,n){return X.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Ca(n)&&(n.current=r))},[t])}const _0=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),c9="framerAppearId",H2="data-"+_0(c9),F2=X.createContext({}),{schedule:S0}=I2(queueMicrotask,!1);function f9(e,t,n,r,s){var w,_;const{visualElement:o}=X.useContext(sd),l=X.useContext(V2),u=X.useContext(x0),f=X.useContext(z2).reducedMotion,d=X.useRef(null);r=r||l.renderer,!d.current&&r&&(d.current=r(e,{visualState:t,parent:o,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:f}));const h=d.current,p=X.useContext(F2);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&d9(d.current,n,s,p);const g=X.useRef(!1);X.useInsertionEffect(()=>{h&&g.current&&h.update(n,u)});const v=n[H2],b=X.useRef(!!v&&!((w=window.MotionHandoffIsComplete)!=null&&w.call(window,v))&&((_=window.MotionHasOptimisedAnimation)==null?void 0:_.call(window,v)));return KV(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),S0.render(h.render),b.current&&h.animationState&&h.animationState.animateChanges())}),X.useEffect(()=>{h&&(!b.current&&h.animationState&&h.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)==null||E.call(window,v)}),b.current=!1))}),h}function d9(e,t,n,r){const{layoutId:s,layout:o,drag:l,dragConstraints:u,layoutScroll:f,layoutRoot:d,layoutCrossfade:h}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:$2(e.parent)),e.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!l||u&&Ca(u),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:f,layoutRoot:d})}function $2(e){if(e)return e.options.allowProjection!==!1?e.projection:$2(e.parent)}let E0=()=>{};function h9({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){e&&t9(e);function o(u,f){let d;const h={...X.useContext(z2),...u,layoutId:m9(u)},{isStatic:p}=h,g=o9(u),v=r(u,p);if(!p&&v0){p9();const b=g9(h);d=b.MeasureLayout,g.visualElement=f9(s,v,h,t,b.ProjectionNode)}return A.jsxs(sd.Provider,{value:g,children:[d&&g.visualElement?A.jsx(d,{visualElement:g.visualElement,...h}):null,n(s,u,u9(v,g.visualElement,f),v,p,g.visualElement)]})}o.displayName=`motion.${typeof s=="string"?s:`create(${s.displayName??s.name??""})`}`;const l=X.forwardRef(o);return l[l9]=s,l}function m9({layoutId:e}){const t=X.useContext(j2).id;return t&&e!==void 0?t+"-"+e:e}function p9(e,t){X.useContext(V2).strict}function g9(e){const{drag:t,layout:n}=$a;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const q2=e=>t=>typeof t=="string"&&t.startsWith(e),k0=q2("--"),y9=q2("var(--"),T0=e=>y9(e)?v9.test(e.split("/*")[0].trim()):!1,v9=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Ul={};function x9(e){for(const t in e)Ul[t]=e[t],k0(t)&&(Ul[t].isCSSVariable=!0)}const to=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],no=new Set(to);function G2(e,{layout:t,layoutId:n}){return no.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Ul[e]||e==="opacity")}const Y2=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Qr=(e,t,n)=>n>t?t:n<e?e:n,ro={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Hl={...ro,transform:e=>Qr(0,1,e)},Zc={...ro,default:1},U_={...ro,transform:Math.round},ou=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ri=ou("deg"),vr=ou("%"),Re=ou("px"),b9=ou("vh"),w9=ou("vw"),H_={...vr,parse:e=>vr.parse(e)/100,transform:e=>vr.transform(e*100)},_9={rotate:Ri,rotateX:Ri,rotateY:Ri,rotateZ:Ri,scale:Zc,scaleX:Zc,scaleY:Zc,scaleZ:Zc,skew:Ri,skewX:Ri,skewY:Ri,distance:Re,translateX:Re,translateY:Re,translateZ:Re,x:Re,y:Re,z:Re,perspective:Re,transformPerspective:Re,opacity:Hl,originX:H_,originY:H_,originZ:Re},C0={borderWidth:Re,borderTopWidth:Re,borderRightWidth:Re,borderBottomWidth:Re,borderLeftWidth:Re,borderRadius:Re,radius:Re,borderTopLeftRadius:Re,borderTopRightRadius:Re,borderBottomRightRadius:Re,borderBottomLeftRadius:Re,width:Re,maxWidth:Re,height:Re,maxHeight:Re,top:Re,right:Re,bottom:Re,left:Re,padding:Re,paddingTop:Re,paddingRight:Re,paddingBottom:Re,paddingLeft:Re,margin:Re,marginTop:Re,marginRight:Re,marginBottom:Re,marginLeft:Re,backgroundPositionX:Re,backgroundPositionY:Re,..._9,zIndex:U_,fillOpacity:Hl,strokeOpacity:Hl,numOctaves:U_},S9={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},E9=to.length;function k9(e,t,n){let r="",s=!0;for(let o=0;o<E9;o++){const l=to[o],u=e[l];if(u===void 0)continue;let f=!0;if(typeof u=="number"?f=u===(l.startsWith("scale")?1:0):f=parseFloat(u)===0,!f||n){const d=Y2(u,C0[l]);if(!f){s=!1;const h=S9[l]||l;r+=`${h}(${d}) `}n&&(t[l]=d)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function A0(e,t,n){const{style:r,vars:s,transformOrigin:o}=e;let l=!1,u=!1;for(const f in t){const d=t[f];if(no.has(f)){l=!0;continue}else if(k0(f)){s[f]=d;continue}else{const h=Y2(d,C0[f]);f.startsWith("origin")?(u=!0,o[f]=h):r[f]=h}}if(t.transform||(l||n?r.transform=k9(t,e.transform,n):r.transform&&(r.transform="none")),u){const{originX:f="50%",originY:d="50%",originZ:h=0}=o;r.transformOrigin=`${f} ${d} ${h}`}}const N0=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Kt=e=>!!(e&&e.getVelocity);function Z2(e,t,n){for(const r in t)!Kt(t[r])&&!G2(r,n)&&(e[r]=t[r])}function T9({transformTemplate:e},t){return X.useMemo(()=>{const n=N0();return A0(n,t,e),Object.assign({},n.vars,n.style)},[t])}function C9(e,t){const n=e.style||{},r={};return Z2(r,n,e),Object.assign(r,T9(e,t)),r}function A9(e,t){const n={},r=C9(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.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=r,n}const N9={offset:"stroke-dashoffset",array:"stroke-dasharray"},M9={offset:"strokeDashoffset",array:"strokeDasharray"};function O9(e,t,n=1,r=0,s=!0){e.pathLength=1;const o=s?N9:M9;e[o.offset]=Re.transform(-r);const l=Re.transform(t),u=Re.transform(n);e[o.array]=`${l} ${u}`}function X2(e,{attrX:t,attrY:n,attrScale:r,pathLength:s,pathSpacing:o=1,pathOffset:l=0,...u},f,d,h){if(A0(e,u,d),f){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:g}=e;p.transform&&(g.transform=p.transform,delete p.transform),(g.transform||p.transformOrigin)&&(g.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),g.transform&&(g.transformBox=(h==null?void 0:h.transformBox)??"fill-box",delete p.transformBox),t!==void 0&&(p.x=t),n!==void 0&&(p.y=n),r!==void 0&&(p.scale=r),s!==void 0&&O9(p,s,o,l,!1)}const Q2=()=>({...N0(),attrs:{}}),K2=e=>typeof e=="string"&&e.toLowerCase()==="svg";function R9(e,t,n,r){const s=X.useMemo(()=>{const o=Q2();return X2(o,t,K2(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};Z2(o,e.style,e),s.style={...o,...s.style}}return s}const D9=["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 M0(e){return typeof e!="string"||e.includes("-")?!1:!!(D9.indexOf(e)>-1||/[A-Z]/u.test(e))}function j9(e=!1){return(n,r,s,{latestValues:o},l)=>{const f=(M0(n)?R9:A9)(r,o,l,n),d=i9(r,typeof n=="string",e),h=n!==X.Fragment?{...d,...f,ref:s}:{},{children:p}=r,g=X.useMemo(()=>Kt(p)?p.get():p,[p]);return X.createElement(n,{...h,children:g})}}function F_(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function O0(e,t,n,r){if(typeof t=="function"){const[s,o]=F_(r);t=t(n!==void 0?n:e.custom,s,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,o]=F_(r);t=t(n!==void 0?n:e.custom,s,o)}return t}function ff(e){return Kt(e)?e.get():e}function z9({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:L9(n,r,s,e),renderState:t()}}const W2=e=>(t,n)=>{const r=X.useContext(sd),s=X.useContext(x0),o=()=>z9(e,t,r,s);return n?o():QV(o)};function L9(e,t,n,r){const s={},o=r(e,{});for(const g in o)s[g]=ff(o[g]);let{initial:l,animate:u}=e;const f=od(e),d=U2(e);t&&d&&!f&&e.inherit!==!1&&(l===void 0&&(l=t.initial),u===void 0&&(u=t.animate));let h=n?n.initial===!1:!1;h=h||l===!1;const p=h?u:l;if(p&&typeof p!="boolean"&&!ad(p)){const g=Array.isArray(p)?p:[p];for(let v=0;v<g.length;v++){const b=O0(e,g[v]);if(b){const{transitionEnd:w,transition:_,...E}=b;for(const T in E){let S=E[T];if(Array.isArray(S)){const M=h?S.length-1:0;S=S[M]}S!==null&&(s[T]=S)}for(const T in w)s[T]=w[T]}}}return s}function R0(e,t,n){var o;const{style:r}=e,s={};for(const l in r)(Kt(r[l])||t.style&&Kt(t.style[l])||G2(l,e)||((o=n==null?void 0:n.getValue(l))==null?void 0:o.liveStyle)!==void 0)&&(s[l]=r[l]);return s}const P9={useVisualState:W2({scrapeMotionValuesFromProps:R0,createRenderState:N0})};function J2(e,t,n){const r=R0(e,t,n);for(const s in e)if(Kt(e[s])||Kt(t[s])){const o=to.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[o]=e[s]}return r}const I9={useVisualState:W2({scrapeMotionValuesFromProps:J2,createRenderState:Q2})};function V9(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const l={...M0(r)?I9:P9,preloadedFeatures:e,useRender:j9(s),createVisualElement:t,Component:r};return h9(l)}}function Fl(e,t,n){const r=e.getProps();return O0(r,t,n!==void 0?n:r.custom,e)}const hy=e=>Array.isArray(e);let df;function B9(){df=void 0}const mn={now:()=>(df===void 0&&mn.set(Ht.isProcessing||Xr.useManualTiming?Ht.timestamp:performance.now()),df),set:e=>{df=e,queueMicrotask(B9)}};function D0(e,t){e.indexOf(t)===-1&&e.push(t)}function j0(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class z0{constructor(){this.subscriptions=[]}add(t){return D0(this.subscriptions,t),()=>j0(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let o=0;o<s;o++){const l=this.subscriptions[o];l&&l(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function eC(e,t){return t?e*(1e3/t):0}const $_=30,U9=e=>!isNaN(parseFloat(e));class H9{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{var l,u;const o=mn.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((l=this.events.change)==null||l.notify(this.current),this.dependents))for(const f of this.dependents)f.dirty();s&&((u=this.events.renderRequest)==null||u.notify(this.current))},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=mn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=U9(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 z0);const r=this.events[t].add(n);return t==="change"?()=>{r(),gt.read(()=>{this.events.change.getSize()||this.stop()})}:r}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,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=mn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>$_)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,$_);return eC(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(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function qa(e,t){return new H9(e,t)}function F9(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,qa(n))}function $9(e){return hy(e)?e[e.length-1]||0:e}function q9(e,t){const n=Fl(e,t);let{transitionEnd:r={},transition:s={},...o}=n||{};o={...o,...r};for(const l in o){const u=$9(o[l]);F9(e,l,u)}}function G9(e){return!!(Kt(e)&&e.add)}function my(e,t){const n=e.getValue("willChange");if(G9(n))return n.add(t);if(!n&&Xr.WillChange){const r=new Xr.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function tC(e){return e.props[H2]}const Y9=e=>e!==null;function Z9(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(Y9),o=t&&n!=="loop"&&t%2===1?0:s.length-1;return s[o]}const X9={type:"spring",stiffness:500,damping:25,restSpeed:10},Q9=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),K9={type:"keyframes",duration:.8},W9={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},J9=(e,{keyframes:t})=>t.length>2?K9:no.has(e)?e.startsWith("scale")?Q9(t[1]):X9:W9;function e6({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:o,repeatType:l,repeatDelay:u,from:f,elapsed:d,...h}){return!!Object.keys(h).length}function L0(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const xr=e=>e*1e3,br=e=>e/1e3,Cl=e=>Math.round(e*1e5)/1e5,P0=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function t6(e){return e==null}const n6=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,I0=(e,t)=>n=>!!(typeof n=="string"&&n6.test(n)&&n.startsWith(e)||t&&!t6(n)&&Object.prototype.hasOwnProperty.call(n,t)),nC=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,o,l,u]=r.match(P0);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(l),alpha:u!==void 0?parseFloat(u):1}},r6=e=>Qr(0,255,e),wp={...ro,transform:e=>Math.round(r6(e))},bs={test:I0("rgb","red"),parse:nC("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+wp.transform(e)+", "+wp.transform(t)+", "+wp.transform(n)+", "+Cl(Hl.transform(r))+")"};function i6(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const py={test:I0("#"),parse:i6,transform:bs.transform},Aa={test:I0("hsl","hue"),parse:nC("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+vr.transform(Cl(t))+", "+vr.transform(Cl(n))+", "+Cl(Hl.transform(r))+")"},Xt={test:e=>bs.test(e)||py.test(e)||Aa.test(e),parse:e=>bs.test(e)?bs.parse(e):Aa.test(e)?Aa.parse(e):py.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?bs.transform(e):Aa.transform(e)},s6=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function a6(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(P0))==null?void 0:t.length)||0)+(((n=e.match(s6))==null?void 0:n.length)||0)>0}const rC="number",iC="color",o6="var",l6="var(",q_="${}",u6=/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 $l(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let o=0;const u=t.replace(u6,f=>(Xt.test(f)?(r.color.push(o),s.push(iC),n.push(Xt.parse(f))):f.startsWith(l6)?(r.var.push(o),s.push(o6),n.push(f)):(r.number.push(o),s.push(rC),n.push(parseFloat(f))),++o,q_)).split(q_);return{values:n,split:u,indexes:r,types:s}}function sC(e){return $l(e).values}function aC(e){const{split:t,types:n}=$l(e),r=t.length;return s=>{let o="";for(let l=0;l<r;l++)if(o+=t[l],s[l]!==void 0){const u=n[l];u===rC?o+=Cl(s[l]):u===iC?o+=Xt.transform(s[l]):o+=s[l]}return o}}const c6=e=>typeof e=="number"?0:e;function f6(e){const t=sC(e);return aC(e)(t.map(c6))}const Hi={test:a6,parse:sC,createTransformer:aC,getAnimatableNone:f6};function _p(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 d6({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,o=0,l=0;if(!t)s=o=l=n;else{const u=n<.5?n*(1+t):n+t-n*t,f=2*n-u;s=_p(f,u,e+1/3),o=_p(f,u,e),l=_p(f,u,e-1/3)}return{red:Math.round(s*255),green:Math.round(o*255),blue:Math.round(l*255),alpha:r}}function Rf(e,t){return n=>n>0?t:e}const pt=(e,t,n)=>e+(t-e)*n,Sp=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},h6=[py,bs,Aa],m6=e=>h6.find(t=>t.test(e));function G_(e){const t=m6(e);if(!t)return!1;let n=t.parse(e);return t===Aa&&(n=d6(n)),n}const Y_=(e,t)=>{const n=G_(e),r=G_(t);if(!n||!r)return Rf(e,t);const s={...n};return o=>(s.red=Sp(n.red,r.red,o),s.green=Sp(n.green,r.green,o),s.blue=Sp(n.blue,r.blue,o),s.alpha=pt(n.alpha,r.alpha,o),bs.transform(s))},gy=new Set(["none","hidden"]);function p6(e,t){return gy.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}const g6=(e,t)=>n=>t(e(n)),lu=(...e)=>e.reduce(g6);function y6(e,t){return n=>pt(e,t,n)}function V0(e){return typeof e=="number"?y6:typeof e=="string"?T0(e)?Rf:Xt.test(e)?Y_:b6:Array.isArray(e)?oC:typeof e=="object"?Xt.test(e)?Y_:v6:Rf}function oC(e,t){const n=[...e],r=n.length,s=e.map((o,l)=>V0(o)(o,t[l]));return o=>{for(let l=0;l<r;l++)n[l]=s[l](o);return n}}function v6(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=V0(e[s])(e[s],t[s]));return s=>{for(const o in r)n[o]=r[o](s);return n}}function x6(e,t){const n=[],r={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const o=t.types[s],l=e.indexes[o][r[o]],u=e.values[l]??0;n[s]=u,r[o]++}return n}const b6=(e,t)=>{const n=Hi.createTransformer(t),r=$l(e),s=$l(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?gy.has(e)&&!s.values.length||gy.has(t)&&!r.values.length?p6(e,t):lu(oC(x6(r,s),s.values),n):Rf(e,t)};function lC(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?pt(e,t,n):V0(e)(e,t)}const w6=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>gt.update(t,n),stop:()=>Ui(t),now:()=>Ht.isProcessing?Ht.timestamp:mn.now()}},uC=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let o=0;o<s;o++)r+=e(o/(s-1))+", ";return`linear(${r.substring(0,r.length-2)})`},Df=2e4;function B0(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Df;)t+=n,r=e.next(t);return t>=Df?1/0:t}function _6(e,t=100,n){const r=n({...e,keyframes:[0,t]}),s=Math.min(B0(r),Df);return{type:"keyframes",ease:o=>r.next(s*o).value/t,duration:br(s)}}const S6=5;function cC(e,t,n){const r=Math.max(t-S6,0);return eC(n-e(r),t-r)}const xt={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},Ep=.001;function E6({duration:e=xt.duration,bounce:t=xt.bounce,velocity:n=xt.velocity,mass:r=xt.mass}){let s,o,l=1-t;l=Qr(xt.minDamping,xt.maxDamping,l),e=Qr(xt.minDuration,xt.maxDuration,br(e)),l<1?(s=d=>{const h=d*l,p=h*e,g=h-n,v=yy(d,l),b=Math.exp(-p);return Ep-g/v*b},o=d=>{const p=d*l*e,g=p*n+n,v=Math.pow(l,2)*Math.pow(d,2)*e,b=Math.exp(-p),w=yy(Math.pow(d,2),l);return(-s(d)+Ep>0?-1:1)*((g-v)*b)/w}):(s=d=>{const h=Math.exp(-d*e),p=(d-n)*e+1;return-Ep+h*p},o=d=>{const h=Math.exp(-d*e),p=(n-d)*(e*e);return h*p});const u=5/e,f=T6(s,o,u);if(e=xr(e),isNaN(f))return{stiffness:xt.stiffness,damping:xt.damping,duration:e};{const d=Math.pow(f,2)*r;return{stiffness:d,damping:l*2*Math.sqrt(r*d),duration:e}}}const k6=12;function T6(e,t,n){let r=n;for(let s=1;s<k6;s++)r=r-e(r)/t(r);return r}function yy(e,t){return e*Math.sqrt(1-t*t)}const C6=["duration","bounce"],A6=["stiffness","damping","mass"];function Z_(e,t){return t.some(n=>e[n]!==void 0)}function N6(e){let t={velocity:xt.velocity,stiffness:xt.stiffness,damping:xt.damping,mass:xt.mass,isResolvedFromDuration:!1,...e};if(!Z_(e,A6)&&Z_(e,C6))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,o=2*Qr(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:xt.mass,stiffness:s,damping:o}}else{const n=E6(e);t={...t,...n,mass:xt.mass},t.isResolvedFromDuration=!0}return t}function jf(e=xt.visualDuration,t=xt.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const o=n.keyframes[0],l=n.keyframes[n.keyframes.length-1],u={done:!1,value:o},{stiffness:f,damping:d,mass:h,duration:p,velocity:g,isResolvedFromDuration:v}=N6({...n,velocity:-br(n.velocity||0)}),b=g||0,w=d/(2*Math.sqrt(f*h)),_=l-o,E=br(Math.sqrt(f/h)),T=Math.abs(_)<5;r||(r=T?xt.restSpeed.granular:xt.restSpeed.default),s||(s=T?xt.restDelta.granular:xt.restDelta.default);let S;if(w<1){const D=yy(E,w);S=R=>{const B=Math.exp(-w*E*R);return l-B*((b+w*E*_)/D*Math.sin(D*R)+_*Math.cos(D*R))}}else if(w===1)S=D=>l-Math.exp(-E*D)*(_+(b+E*_)*D);else{const D=E*Math.sqrt(w*w-1);S=R=>{const B=Math.exp(-w*E*R),z=Math.min(D*R,300);return l-B*((b+w*E*_)*Math.sinh(z)+D*_*Math.cosh(z))/D}}const M={calculatedDuration:v&&p||null,next:D=>{const R=S(D);if(v)u.done=D>=p;else{let B=D===0?b:0;w<1&&(B=D===0?xr(b):cC(S,D,R));const z=Math.abs(B)<=r,U=Math.abs(l-R)<=s;u.done=z&&U}return u.value=u.done?l:R,u},toString:()=>{const D=Math.min(B0(M),Df),R=uC(B=>M.next(D*B).value,D,30);return D+"ms "+R},toTransition:()=>{}};return M}jf.applyToOptions=e=>{const t=_6(e,100,jf);return e.ease=t.ease,e.duration=xr(t.duration),e.type="keyframes",e};function vy({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:l,min:u,max:f,restDelta:d=.5,restSpeed:h}){const p=e[0],g={done:!1,value:p},v=z=>u!==void 0&&z<u||f!==void 0&&z>f,b=z=>u===void 0?f:f===void 0||Math.abs(u-z)<Math.abs(f-z)?u:f;let w=n*t;const _=p+w,E=l===void 0?_:l(_);E!==_&&(w=E-p);const T=z=>-w*Math.exp(-z/r),S=z=>E+T(z),M=z=>{const U=T(z),O=S(z);g.done=Math.abs(U)<=d,g.value=g.done?E:O};let D,R;const B=z=>{v(g.value)&&(D=z,R=jf({keyframes:[g.value,b(g.value)],velocity:cC(S,z,g.value),damping:s,stiffness:o,restDelta:d,restSpeed:h}))};return B(0),{calculatedDuration:null,next:z=>{let U=!1;return!R&&D===void 0&&(U=!0,M(z),B(z)),D!==void 0&&z>=D?R.next(z-D):(!U&&M(z),g)}}}const ql=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};function M6(e,t,n){const r=[],s=n||Xr.mix||lC,o=e.length-1;for(let l=0;l<o;l++){let u=s(e[l],e[l+1]);if(t){const f=Array.isArray(t)?t[l]||Hn:t;u=lu(f,u)}r.push(u)}return r}function O6(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const o=e.length;if(E0(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const l=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const u=M6(t,r,s),f=u.length,d=h=>{if(l&&h<e[0])return t[0];let p=0;if(f>1)for(;p<e.length-2&&!(h<e[p+1]);p++);const g=ql(e[p],e[p+1],h);return u[p](g)};return n?h=>d(Qr(e[0],e[o-1],h)):d}function R6(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=ql(0,t,r);e.push(pt(n,1,s))}}function D6(e){const t=[0];return R6(t,e.length-1),t}function j6(e,t){return e.map(n=>n*t)}const fC=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,z6=1e-7,L6=12;function P6(e,t,n,r,s){let o,l,u=0;do l=t+(n-t)/2,o=fC(l,r,s)-e,o>0?n=l:t=l;while(Math.abs(o)>z6&&++u<L6);return l}function uu(e,t,n,r){if(e===t&&n===r)return Hn;const s=o=>P6(o,0,1,e,n);return o=>o===0||o===1?o:fC(s(o),t,r)}const I6=uu(.42,0,1,1),V6=uu(0,0,.58,1),dC=uu(.42,0,.58,1),B6=e=>Array.isArray(e)&&typeof e[0]!="number",hC=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,mC=e=>t=>1-e(1-t),pC=uu(.33,1.53,.69,.99),U0=mC(pC),gC=hC(U0),yC=e=>(e*=2)<1?.5*U0(e):.5*(2-Math.pow(2,-10*(e-1))),H0=e=>1-Math.sin(Math.acos(e)),vC=mC(H0),xC=hC(H0),bC=e=>Array.isArray(e)&&typeof e[0]=="number",U6={linear:Hn,easeIn:I6,easeInOut:dC,easeOut:V6,circIn:H0,circInOut:xC,circOut:vC,backIn:U0,backInOut:gC,backOut:pC,anticipate:yC},H6=e=>typeof e=="string",X_=e=>{if(bC(e)){E0(e.length===4);const[t,n,r,s]=e;return uu(t,n,r,s)}else if(H6(e))return U6[e];return e};function F6(e,t){return e.map(()=>t||dC).splice(0,e.length-1)}function Al({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=B6(r)?r.map(X_):X_(r),o={done:!1,value:t[0]},l=j6(n&&n.length===t.length?n:D6(t),e),u=O6(l,t,{ease:Array.isArray(s)?s:F6(t,s)});return{calculatedDuration:e,next:f=>(o.value=u(f),o.done=f>=e,o)}}const $6=e=>e!==null;function F0(e,{repeat:t,repeatType:n="loop"},r,s=1){const o=e.filter($6),u=s<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!u||r===void 0?o[u]:r}const q6={decay:vy,inertia:vy,tween:Al,keyframes:Al,spring:jf};function wC(e){typeof e.type=="string"&&(e.type=q6[e.type])}class $0{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const G6=e=>e/100;class q0 extends $0{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==mn.now()&&this.tick(mn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;wC(t);const{type:n=Al,repeat:r=0,repeatDelay:s=0,repeatType:o,velocity:l=0}=t;let{keyframes:u}=t;const f=n||Al;f!==Al&&typeof u[0]!="number"&&(this.mixKeyframes=lu(G6,lC(u[0],u[1])),u=[0,100]);const d=f({...t,keyframes:u});o==="mirror"&&(this.mirroredGenerator=f({...t,keyframes:[...u].reverse(),velocity:-l})),d.calculatedDuration===null&&(d.calculatedDuration=B0(d));const{calculatedDuration:h}=d;this.calculatedDuration=h,this.resolvedDuration=h+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=d}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:s,mixKeyframes:o,mirroredGenerator:l,resolvedDuration:u,calculatedDuration:f}=this;if(this.startTime===null)return r.next(0);const{delay:d=0,keyframes:h,repeat:p,repeatType:g,repeatDelay:v,type:b,onUpdate:w,finalKeyframe:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const E=this.currentTime-d*(this.playbackSpeed>=0?1:-1),T=this.playbackSpeed>=0?E<0:E>s;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let S=this.currentTime,M=r;if(p){const z=Math.min(this.currentTime,s)/u;let U=Math.floor(z),O=z%1;!O&&z>=1&&(O=1),O===1&&U--,U=Math.min(U,p+1),!!(U%2)&&(g==="reverse"?(O=1-O,v&&(O-=v/u)):g==="mirror"&&(M=l)),S=Qr(0,1,O)*u}const D=T?{done:!1,value:h[0]}:M.next(S);o&&(D.value=o(D.value));let{done:R}=D;!T&&f!==null&&(R=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const B=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&R);return B&&b!==vy&&(D.value=F0(h,this.options,_,this.speed)),w&&w(D.value),B&&this.finish(),D}then(t,n){return this.finished.then(t,n)}get duration(){return br(this.calculatedDuration)}get time(){return br(this.currentTime)}set time(t){var n;t=xr(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(mn.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=br(this.currentTime))}play(){var s,o;if(this.isStopped)return;const{driver:t=w6,startTime:n}=this.options;this.driver||(this.driver=t(l=>this.tick(l))),(o=(s=this.options).onPlay)==null||o.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(mn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function Y6(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const ws=e=>e*180/Math.PI,xy=e=>{const t=ws(Math.atan2(e[1],e[0]));return by(t)},Z6={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:xy,rotateZ:xy,skewX:e=>ws(Math.atan(e[1])),skewY:e=>ws(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},by=e=>(e=e%360,e<0&&(e+=360),e),Q_=xy,K_=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),W_=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),X6={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:K_,scaleY:W_,scale:e=>(K_(e)+W_(e))/2,rotateX:e=>by(ws(Math.atan2(e[6],e[5]))),rotateY:e=>by(ws(Math.atan2(-e[2],e[0]))),rotateZ:Q_,rotate:Q_,skewX:e=>ws(Math.atan(e[4])),skewY:e=>ws(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function wy(e){return e.includes("scale")?1:0}function _y(e,t){if(!e||e==="none")return wy(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=X6,s=n;else{const u=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Z6,s=u}if(!s)return wy(t);const o=r[t],l=s[1].split(",").map(K6);return typeof o=="function"?o(l):l[o]}const Q6=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return _y(n,t)};function K6(e){return parseFloat(e.trim())}const J_=e=>e===ro||e===Re,W6=new Set(["x","y","z"]),J6=to.filter(e=>!W6.has(e));function eB(e){const t=[];return J6.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const ks={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:(e,{transform:t})=>_y(t,"x"),y:(e,{transform:t})=>_y(t,"y")};ks.translateX=ks.x;ks.translateY=ks.y;const Ts=new Set;let Sy=!1,Ey=!1,ky=!1;function _C(){if(Ey){const e=Array.from(Ts).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=eB(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([o,l])=>{var u;(u=r.getValue(o))==null||u.set(l)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Ey=!1,Sy=!1,Ts.forEach(e=>e.complete(ky)),Ts.clear()}function SC(){Ts.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ey=!0)})}function tB(){ky=!0,SC(),_C(),ky=!1}class G0{constructor(t,n,r,s,o,l=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=o,this.isAsync=l}scheduleResolve(){this.state="scheduled",this.isAsync?(Ts.add(this),Sy||(Sy=!0,gt.read(SC),gt.resolveKeyframes(_C))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;if(t[0]===null){const o=s==null?void 0:s.get(),l=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const u=r.readValue(n,l);u!=null&&(t[0]=u)}t[0]===void 0&&(t[0]=l),s&&o===void 0&&s.set(t[0])}Y6(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ts.delete(this)}cancel(){this.state==="scheduled"&&(Ts.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const nB=e=>e.startsWith("--");function rB(e,t,n){nB(t)?e.style.setProperty(t,n):e.style[t]=n}function Y0(e){let t;return()=>(t===void 0&&(t=e()),t)}const iB=Y0(()=>window.ScrollTimeline!==void 0),sB={};function aB(e,t){const n=Y0(e);return()=>sB[t]??n()}const EC=aB(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),wl=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,eS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:wl([0,.65,.55,1]),circOut:wl([.55,0,1,.45]),backIn:wl([.31,.01,.66,-.59]),backOut:wl([.33,1.53,.69,.99])};function kC(e,t){if(e)return typeof e=="function"?EC()?uC(e,t):"ease-out":bC(e)?wl(e):Array.isArray(e)?e.map(n=>kC(n,t)||eS.easeOut):eS[e]}function oB(e,t,n,{delay:r=0,duration:s=300,repeat:o=0,repeatType:l="loop",ease:u="easeOut",times:f}={},d=void 0){const h={[t]:n};f&&(h.offset=f);const p=kC(u,s);Array.isArray(p)&&(h.easing=p);const g={delay:r,duration:s,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:o+1,direction:l==="reverse"?"alternate":"normal"};return d&&(g.pseudoElement=d),e.animate(h,g)}function TC(e){return typeof e=="function"&&"applyToOptions"in e}function lB({type:e,...t}){return TC(e)&&EC()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class uB extends $0{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:r,keyframes:s,pseudoElement:o,allowFlatten:l=!1,finalKeyframe:u,onComplete:f}=t;this.isPseudoElement=!!o,this.allowFlatten=l,this.options=t,E0(typeof t.type!="string");const d=lB(t);this.animation=oB(n,r,s,d,o),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const h=F0(s,this.options,u,this.speed);this.updateMotionValue?this.updateMotionValue(h):rB(n,r,h),this.animation.cancel()}f==null||f(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return br(Number(t))}get time(){return br(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=xr(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var r;return this.allowFlatten&&((r=this.animation.effect)==null||r.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&iB()?(this.animation.timeline=t,Hn):n(this)}}const CC={anticipate:yC,backInOut:gC,circInOut:xC};function cB(e){return e in CC}function fB(e){typeof e.ease=="string"&&cB(e.ease)&&(e.ease=CC[e.ease])}const tS=10;class dB extends uB{constructor(t){fB(t),wC(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:s,element:o,...l}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const u=new q0({...l,autoplay:!1}),f=xr(this.finishedTime??this.time);n.setWithVelocity(u.sample(f-tS).value,u.sample(f).value,tS),u.stop()}}const nS=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Hi.test(e)||e==="0")&&!e.startsWith("url("));function hB(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function mB(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],l=nS(s,t),u=nS(o,t);return!l||!u?!1:hB(e)||(n==="spring"||TC(n))&&r}const pB=new Set(["opacity","clipPath","filter","transform"]),gB=Y0(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function yB(e){var d;const{motionValue:t,name:n,repeatDelay:r,repeatType:s,damping:o,type:l}=e;if(!P2((d=t==null?void 0:t.owner)==null?void 0:d.current))return!1;const{onUpdate:u,transformTemplate:f}=t.owner.getProps();return gB()&&n&&pB.has(n)&&(n!=="transform"||!f)&&!u&&!r&&s!=="mirror"&&o!==0&&l!=="inertia"}const vB=40;class xB extends $0{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:o=0,repeatType:l="loop",keyframes:u,name:f,motionValue:d,element:h,...p}){var b;super(),this.stop=()=>{var w,_;this._animation&&(this._animation.stop(),(w=this.stopTimeline)==null||w.call(this)),(_=this.keyframeResolver)==null||_.cancel()},this.createdAt=mn.now();const g={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:o,repeatType:l,name:f,motionValue:d,element:h,...p},v=(h==null?void 0:h.KeyframeResolver)||G0;this.keyframeResolver=new v(u,(w,_,E)=>this.onKeyframesResolved(w,_,g,!E),f,d,h),(b=this.keyframeResolver)==null||b.scheduleResolve()}onKeyframesResolved(t,n,r,s){this.keyframeResolver=void 0;const{name:o,type:l,velocity:u,delay:f,isHandoff:d,onUpdate:h}=r;this.resolvedAt=mn.now(),mB(t,o,l,u)||((Xr.instantAnimations||!f)&&(h==null||h(F0(t,r,n))),t[0]=t[t.length-1],r.duration=0,r.repeat=0);const g={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>vB?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},v=!d&&yB(g)?new dB({...g,element:g.motionValue.owner.current}):new q0(g);v.finished.then(()=>this.notifyFinished()).catch(Hn),this.pendingTimeline&&(this.stopTimeline=v.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=v}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),tB()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const Z0=(e,t,n,r={},s,o)=>l=>{const u=L0(r,e)||{},f=u.delay||r.delay||0;let{elapsed:d=0}=r;d=d-xr(f);const h={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...u,delay:-d,onUpdate:g=>{t.set(g),u.onUpdate&&u.onUpdate(g)},onComplete:()=>{l(),u.onComplete&&u.onComplete()},name:e,motionValue:t,element:o?void 0:s};e6(u)||Object.assign(h,J9(e,h)),h.duration&&(h.duration=xr(h.duration)),h.repeatDelay&&(h.repeatDelay=xr(h.repeatDelay)),h.from!==void 0&&(h.keyframes[0]=h.from);let p=!1;if((h.type===!1||h.duration===0&&!h.repeatDelay)&&(h.duration=0,h.delay===0&&(p=!0)),(Xr.instantAnimations||Xr.skipAnimations)&&(p=!0,h.duration=0,h.delay=0),h.allowFlatten=!u.type&&!u.ease,p&&!o&&t.get()!==void 0){const g=Z9(h.keyframes,u);if(g!==void 0){gt.update(()=>{h.onUpdate(g),h.onComplete()});return}}return u.isSync?new q0(h):new xB(h)},AC=new Set(["width","height","top","left","right","bottom",...to]);function bB({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function NC(e,t,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:l,...u}=t;r&&(o=r);const f=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const h in u){const p=e.getValue(h,e.latestValues[h]??null),g=u[h];if(g===void 0||d&&bB(d,h))continue;const v={delay:n,...L0(o||{},h)},b=p.get();if(b!==void 0&&!p.isAnimating&&!Array.isArray(g)&&g===b&&!v.velocity)continue;let w=!1;if(window.MotionHandoffAnimation){const E=tC(e);if(E){const T=window.MotionHandoffAnimation(E,h,gt);T!==null&&(v.startTime=T,w=!0)}}my(e,h),p.start(Z0(h,p,g,e.shouldReduceMotion&&AC.has(h)?{type:!1}:v,e,w));const _=p.animation;_&&f.push(_)}return l&&Promise.all(f).then(()=>{gt.update(()=>{l&&q9(e,l)})}),f}function Ty(e,t,n={}){var f;const r=Fl(e,t,n.type==="exit"?(f=e.presenceContext)==null?void 0:f.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const o=r?()=>Promise.all(NC(e,r,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:h=0,staggerChildren:p,staggerDirection:g}=s;return wB(e,t,h+d,p,g,n)}:()=>Promise.resolve(),{when:u}=s;if(u){const[d,h]=u==="beforeChildren"?[o,l]:[l,o];return d().then(()=>h())}else return Promise.all([o(),l(n.delay)])}function wB(e,t,n=0,r=0,s=1,o){const l=[],u=(e.variantChildren.size-1)*r,f=s===1?(d=0)=>d*r:(d=0)=>u-d*r;return Array.from(e.variantChildren).sort(_B).forEach((d,h)=>{d.notify("AnimationStart",t),l.push(Ty(d,t,{...o,delay:n+f(h)}).then(()=>d.notify("AnimationComplete",t)))}),Promise.all(l)}function _B(e,t){return e.sortNodePosition(t)}function SB(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(o=>Ty(e,o,n));r=Promise.all(s)}else if(typeof t=="string")r=Ty(e,t,n);else{const s=typeof t=="function"?Fl(e,t,n.custom):t;r=Promise.all(NC(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}function MC(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const EB=w0.length;function OC(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?OC(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<EB;n++){const r=w0[n],s=e.props[r];(Bl(s)||s===!1)&&(t[r]=s)}return t}const kB=[...b0].reverse(),TB=b0.length;function CB(e){return t=>Promise.all(t.map(({animation:n,options:r})=>SB(e,n,r)))}function AB(e){let t=CB(e),n=rS(),r=!0;const s=f=>(d,h)=>{var g;const p=Fl(e,h,f==="exit"?(g=e.presenceContext)==null?void 0:g.custom:void 0);if(p){const{transition:v,transitionEnd:b,...w}=p;d={...d,...w,...b}}return d};function o(f){t=f(e)}function l(f){const{props:d}=e,h=OC(e.parent)||{},p=[],g=new Set;let v={},b=1/0;for(let _=0;_<TB;_++){const E=kB[_],T=n[E],S=d[E]!==void 0?d[E]:h[E],M=Bl(S),D=E===f?T.isActive:null;D===!1&&(b=_);let R=S===h[E]&&S!==d[E]&&M;if(R&&r&&e.manuallyAnimateOnMount&&(R=!1),T.protectedKeys={...v},!T.isActive&&D===null||!S&&!T.prevProp||ad(S)||typeof S=="boolean")continue;const B=NB(T.prevProp,S);let z=B||E===f&&T.isActive&&!R&&M||_>b&&M,U=!1;const O=Array.isArray(S)?S:[S];let V=O.reduce(s(E),{});D===!1&&(V={});const{prevResolvedValues:H={}}=T,Q={...H,...V},j=P=>{z=!0,g.has(P)&&(U=!0,g.delete(P)),T.needsAnimating[P]=!0;const Y=e.getValue(P);Y&&(Y.liveStyle=!1)};for(const P in Q){const Y=V[P],Z=H[P];if(v.hasOwnProperty(P))continue;let k=!1;hy(Y)&&hy(Z)?k=!MC(Y,Z):k=Y!==Z,k?Y!=null?j(P):g.add(P):Y!==void 0&&g.has(P)?j(P):T.protectedKeys[P]=!0}T.prevProp=S,T.prevResolvedValues=V,T.isActive&&(v={...v,...V}),r&&e.blockInitialAnimation&&(z=!1),z&&(!(R&&B)||U)&&p.push(...O.map(P=>({animation:P,options:{type:E}})))}if(g.size){const _={};if(typeof d.initial!="boolean"){const E=Fl(e,Array.isArray(d.initial)?d.initial[0]:d.initial);E&&E.transition&&(_.transition=E.transition)}g.forEach(E=>{const T=e.getBaseTarget(E),S=e.getValue(E);S&&(S.liveStyle=!0),_[E]=T??null}),p.push({animation:_})}let w=!!p.length;return r&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(w=!1),r=!1,w?t(p):Promise.resolve()}function u(f,d){var p;if(n[f].isActive===d)return Promise.resolve();(p=e.variantChildren)==null||p.forEach(g=>{var v;return(v=g.animationState)==null?void 0:v.setActive(f,d)}),n[f].isActive=d;const h=l(f);for(const g in n)n[g].protectedKeys={};return h}return{animateChanges:l,setActive:u,setAnimateFunction:o,getState:()=>n,reset:()=>{n=rS(),r=!0}}}function NB(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!MC(t,e):!1}function ms(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function rS(){return{animate:ms(!0),whileInView:ms(),whileHover:ms(),whileTap:ms(),whileDrag:ms(),whileFocus:ms(),exit:ms()}}class qi{constructor(t){this.isMounted=!1,this.node=t}update(){}}class MB extends qi{constructor(t){super(t),t.animationState||(t.animationState=AB(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();ad(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.call(this)}}let OB=0;class RB extends qi{constructor(){super(...arguments),this.id=OB++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const DB={animation:{Feature:MB},exit:{Feature:RB}};function Gl(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const X0=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function cu(e){return{point:{x:e.pageX,y:e.pageY}}}const jB=e=>t=>X0(t)&&e(t,cu(t));function Nl(e,t,n,r){return Gl(e,t,jB(n),r)}function RC({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function zB({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function LB(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}const DC=1e-4,PB=1-DC,IB=1+DC,jC=.01,VB=0-jC,BB=0+jC;function sn(e){return e.max-e.min}function UB(e,t,n){return Math.abs(e-t)<=n}function iS(e,t,n,r=.5){e.origin=r,e.originPoint=pt(t.min,t.max,e.origin),e.scale=sn(n)/sn(t),e.translate=pt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=PB&&e.scale<=IB||isNaN(e.scale))&&(e.scale=1),(e.translate>=VB&&e.translate<=BB||isNaN(e.translate))&&(e.translate=0)}function Ml(e,t,n,r){iS(e.x,t.x,n.x,r?r.originX:void 0),iS(e.y,t.y,n.y,r?r.originY:void 0)}function sS(e,t,n){e.min=n.min+t.min,e.max=e.min+sn(t)}function HB(e,t,n){sS(e.x,t.x,n.x),sS(e.y,t.y,n.y)}function aS(e,t,n){e.min=t.min-n.min,e.max=e.min+sn(t)}function Ol(e,t,n){aS(e.x,t.x,n.x),aS(e.y,t.y,n.y)}const oS=()=>({translate:0,scale:1,origin:0,originPoint:0}),Na=()=>({x:oS(),y:oS()}),lS=()=>({min:0,max:0}),St=()=>({x:lS(),y:lS()});function Bn(e){return[e("x"),e("y")]}function kp(e){return e===void 0||e===1}function Cy({scale:e,scaleX:t,scaleY:n}){return!kp(e)||!kp(t)||!kp(n)}function ps(e){return Cy(e)||zC(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function zC(e){return uS(e.x)||uS(e.y)}function uS(e){return e&&e!=="0%"}function zf(e,t,n){const r=e-n,s=t*r;return n+s}function cS(e,t,n,r,s){return s!==void 0&&(e=zf(e,s,r)),zf(e,n,r)+t}function Ay(e,t=0,n=1,r,s){e.min=cS(e.min,t,n,r,s),e.max=cS(e.max,t,n,r,s)}function LC(e,{x:t,y:n}){Ay(e.x,t.translate,t.scale,t.originPoint),Ay(e.y,n.translate,n.scale,n.originPoint)}const fS=.999999999999,dS=1.0000000000001;function FB(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let o,l;for(let u=0;u<s;u++){o=n[u],l=o.projectionDelta;const{visualElement:f}=o.options;f&&f.props.style&&f.props.style.display==="contents"||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Oa(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),l&&(t.x*=l.x.scale,t.y*=l.y.scale,LC(e,l)),r&&ps(o.latestValues)&&Oa(e,o.latestValues))}t.x<dS&&t.x>fS&&(t.x=1),t.y<dS&&t.y>fS&&(t.y=1)}function Ma(e,t){e.min=e.min+t,e.max=e.max+t}function hS(e,t,n,r,s=.5){const o=pt(e.min,e.max,s);Ay(e,t,n,o,r)}function Oa(e,t){hS(e.x,t.x,t.scaleX,t.scale,t.originX),hS(e.y,t.y,t.scaleY,t.scale,t.originY)}function PC(e,t){return RC(LB(e.getBoundingClientRect(),t))}function $B(e,t,n){const r=PC(e,n),{scroll:s}=t;return s&&(Ma(r.x,s.offset.x),Ma(r.y,s.offset.y)),r}const IC=({current:e})=>e?e.ownerDocument.defaultView:null,mS=(e,t)=>Math.abs(e-t);function qB(e,t){const n=mS(e.x,t.x),r=mS(e.y,t.y);return Math.sqrt(n**2+r**2)}class VC{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:o=!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 p=Cp(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,v=qB(p.offset,{x:0,y:0})>=3;if(!g&&!v)return;const{point:b}=p,{timestamp:w}=Ht;this.history.push({...b,timestamp:w});const{onStart:_,onMove:E}=this.handlers;g||(_&&_(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),E&&E(this.lastMoveEvent,p)},this.handlePointerMove=(p,g)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=Tp(g,this.transformPagePoint),gt.update(this.updatePoint,!0)},this.handlePointerUp=(p,g)=>{this.end();const{onEnd:v,onSessionEnd:b,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=Cp(p.type==="pointercancel"?this.lastMoveEventInfo:Tp(g,this.transformPagePoint),this.history);this.startEvent&&v&&v(p,_),b&&b(p,_)},!X0(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const l=cu(t),u=Tp(l,this.transformPagePoint),{point:f}=u,{timestamp:d}=Ht;this.history=[{...f,timestamp:d}];const{onSessionStart:h}=n;h&&h(t,Cp(u,this.history)),this.removeListeners=lu(Nl(this.contextWindow,"pointermove",this.handlePointerMove),Nl(this.contextWindow,"pointerup",this.handlePointerUp),Nl(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ui(this.updatePoint)}}function Tp(e,t){return t?{point:t(e.point)}:e}function pS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Cp({point:e},t){return{point:e,delta:pS(e,BC(t)),offset:pS(e,GB(t)),velocity:YB(t,.1)}}function GB(e){return e[0]}function BC(e){return e[e.length-1]}function YB(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=BC(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>xr(t)));)n--;if(!r)return{x:0,y:0};const o=br(s.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const l={x:(s.x-r.x)/o,y:(s.y-r.y)/o};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function ZB(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?pt(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?pt(n,e,r.max):Math.min(e,n)),e}function gS(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 XB(e,{top:t,left:n,bottom:r,right:s}){return{x:gS(e.x,n,s),y:gS(e.y,t,r)}}function yS(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function QB(e,t){return{x:yS(e.x,t.x),y:yS(e.y,t.y)}}function KB(e,t){let n=.5;const r=sn(e),s=sn(t);return s>r?n=ql(t.min,t.max-r,e.min):r>s&&(n=ql(e.min,e.max-s,t.min)),Qr(0,1,n)}function WB(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 Ny=.35;function JB(e=Ny){return e===!1?e=0:e===!0&&(e=Ny),{x:vS(e,"left","right"),y:vS(e,"top","bottom")}}function vS(e,t,n){return{min:xS(e,t),max:xS(e,n)}}function xS(e,t){return typeof e=="number"?e:e[t]||0}const er={x:!1,y:!1};function UC(){return er.x||er.y}function e8(e){return e==="x"||e==="y"?er[e]?null:(er[e]=!0,()=>{er[e]=!1}):er.x||er.y?null:(er.x=er.y=!0,()=>{er.x=er.y=!1})}const t8=new WeakMap;class n8{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=St(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=h=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(cu(h).point)},o=(h,p)=>{const{drag:g,dragPropagation:v,onDragStart:b}=this.getProps();if(g&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=e8(g),!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),Bn(_=>{let E=this.getAxisMotionValue(_).get()||0;if(vr.test(E)){const{projection:T}=this.visualElement;if(T&&T.layout){const S=T.layout.layoutBox[_];S&&(E=sn(S)*(parseFloat(E)/100))}}this.originPoint[_]=E}),b&>.postRender(()=>b(h,p)),my(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},l=(h,p)=>{const{dragPropagation:g,dragDirectionLock:v,onDirectionLock:b,onDrag:w}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:_}=p;if(v&&this.currentDirection===null){this.currentDirection=r8(_),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",p.point,_),this.updateAxis("y",p.point,_),this.visualElement.render(),w&&w(h,p)},u=(h,p)=>this.stop(h,p),f=()=>Bn(h=>{var p;return this.getAnimationState(h)==="paused"&&((p=this.getAxisMotionValue(h).animation)==null?void 0:p.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new VC(t,{onSessionStart:s,onStart:o,onMove:l,onSessionEnd:u,resumeAnimation:f},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,contextWindow:IC(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&>.postRender(()=>o(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:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Xc(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let l=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(l=ZB(l,this.constraints[t],this.elastic[t])),o.set(l)}resolveConstraints(){var o;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(o=this.visualElement.projection)==null?void 0:o.layout,s=this.constraints;t&&Ca(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=XB(r.layoutBox,t):this.constraints=!1,this.elastic=JB(n),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Bn(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=WB(r.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Ca(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=$B(r,s.root,this.visualElement.getTransformPagePoint());let l=QB(s.layout.layoutBox,o);if(n){const u=n(zB(l));this.hasMutatedConstraints=!!u,u&&(l=RC(u))}return l}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:o,dragSnapToOrigin:l,onDragTransitionEnd:u}=this.getProps(),f=this.constraints||{},d=Bn(h=>{if(!Xc(h,n,this.currentDirection))return;let p=f&&f[h]||{};l&&(p={min:0,max:0});const g=s?200:1e6,v=s?40:1e7,b={type:"inertia",velocity:r?t[h]:0,bounceStiffness:g,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...o,...p};return this.startAxisValueAnimation(h,b)});return Promise.all(d).then(u)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return my(this.visualElement,t),r.start(Z0(t,r,0,n,this.visualElement,!1))}stopAnimation(){Bn(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Bn(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Bn(n=>{const{drag:r}=this.getProps();if(!Xc(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(n);if(s&&s.layout){const{min:l,max:u}=s.layout.layoutBox[n];o.set(t[n]-pt(l,u,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Ca(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Bn(l=>{const u=this.getAxisMotionValue(l);if(u&&this.constraints!==!1){const f=u.get();s[l]=KB({min:f,max:f},this.constraints[l])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Bn(l=>{if(!Xc(l,t,null))return;const u=this.getAxisMotionValue(l),{min:f,max:d}=this.constraints[l];u.set(pt(f,d,s[l]))})}addListeners(){if(!this.visualElement.current)return;t8.set(this.visualElement,this);const t=this.visualElement.current,n=Nl(t,"pointerdown",f=>{const{drag:d,dragListener:h=!0}=this.getProps();d&&h&&this.start(f)}),r=()=>{const{dragConstraints:f}=this.getProps();Ca(f)&&f.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,o=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),gt.read(r);const l=Gl(window,"resize",()=>this.scalePositionWithinConstraints()),u=s.addEventListener("didUpdate",({delta:f,hasLayoutChanged:d})=>{this.isDragging&&d&&(Bn(h=>{const p=this.getAxisMotionValue(h);p&&(this.originPoint[h]+=f[h].translate,p.set(p.get()+f[h].translate))}),this.visualElement.render())});return()=>{l(),n(),o(),u&&u()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:o=!1,dragElastic:l=Ny,dragMomentum:u=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:o,dragElastic:l,dragMomentum:u}}}function Xc(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function r8(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class i8 extends qi{constructor(t){super(t),this.removeGroupControls=Hn,this.removeListeners=Hn,this.controls=new n8(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Hn}unmount(){this.removeGroupControls(),this.removeListeners()}}const bS=e=>(t,n)=>{e&>.postRender(()=>e(t,n))};class s8 extends qi{constructor(){super(...arguments),this.removePointerDownListener=Hn}onPointerDown(t){this.session=new VC(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:IC(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:bS(t),onStart:bS(n),onMove:r,onEnd:(o,l)=>{delete this.session,s&>.postRender(()=>s(o,l))}}}mount(){this.removePointerDownListener=Nl(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 hf={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function wS(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const gl={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Re.test(e))e=parseFloat(e);else return e;const n=wS(e,t.target.x),r=wS(e,t.target.y);return`${n}% ${r}%`}},a8={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Hi.parse(e);if(s.length>5)return r;const o=Hi.createTransformer(e),l=typeof s[0]!="number"?1:0,u=n.x.scale*t.x,f=n.y.scale*t.y;s[0+l]/=u,s[1+l]/=f;const d=pt(u,f,.5);return typeof s[2+l]=="number"&&(s[2+l]/=d),typeof s[3+l]=="number"&&(s[3+l]/=d),o(s)}};class o8 extends X.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:o}=t;x9(l8),o&&(n.group&&n.group.add(o),r&&r.register&&s&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),hf.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:o}=this.props,{projection:l}=r;return l&&(l.isPresent=o,s||t.layoutDependency!==n||n===void 0||t.isPresent!==o?l.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?l.promote():l.relegate()||gt.postRender(()=>{const u=l.getStack();(!u||!u.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),S0.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function HC(e){const[t,n]=WV(),r=X.useContext(j2);return A.jsx(o8,{...e,layoutGroup:r,switchLayoutGroup:X.useContext(F2),isPresent:t,safeToRemove:n})}const l8={borderRadius:{...gl,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:gl,borderTopRightRadius:gl,borderBottomLeftRadius:gl,borderBottomRightRadius:gl,boxShadow:a8};function u8(e,t,n){const r=Kt(e)?e:qa(e);return r.start(Z0("",r,t,n)),r.animation}const c8=(e,t)=>e.depth-t.depth;class f8{constructor(){this.children=[],this.isDirty=!1}add(t){D0(this.children,t),this.isDirty=!0}remove(t){j0(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(c8),this.isDirty=!1,this.children.forEach(t)}}function d8(e,t){const n=mn.now(),r=({timestamp:s})=>{const o=s-n;o>=t&&(Ui(r),e(o-t))};return gt.setup(r,!0),()=>Ui(r)}const FC=["TopLeft","TopRight","BottomLeft","BottomRight"],h8=FC.length,_S=e=>typeof e=="string"?parseFloat(e):e,SS=e=>typeof e=="number"||Re.test(e);function m8(e,t,n,r,s,o){s?(e.opacity=pt(0,n.opacity??1,p8(r)),e.opacityExit=pt(t.opacity??1,0,g8(r))):o&&(e.opacity=pt(t.opacity??1,n.opacity??1,r));for(let l=0;l<h8;l++){const u=`border${FC[l]}Radius`;let f=ES(t,u),d=ES(n,u);if(f===void 0&&d===void 0)continue;f||(f=0),d||(d=0),f===0||d===0||SS(f)===SS(d)?(e[u]=Math.max(pt(_S(f),_S(d),r),0),(vr.test(d)||vr.test(f))&&(e[u]+="%")):e[u]=d}(t.rotate||n.rotate)&&(e.rotate=pt(t.rotate||0,n.rotate||0,r))}function ES(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const p8=$C(0,.5,vC),g8=$C(.5,.95,Hn);function $C(e,t,n){return r=>r<e?0:r>t?1:n(ql(e,t,r))}function kS(e,t){e.min=t.min,e.max=t.max}function Vn(e,t){kS(e.x,t.x),kS(e.y,t.y)}function TS(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function CS(e,t,n,r,s){return e-=t,e=zf(e,1/n,r),s!==void 0&&(e=zf(e,1/s,r)),e}function y8(e,t=0,n=1,r=.5,s,o=e,l=e){if(vr.test(t)&&(t=parseFloat(t),t=pt(l.min,l.max,t/100)-l.min),typeof t!="number")return;let u=pt(o.min,o.max,r);e===o&&(u-=t),e.min=CS(e.min,t,n,u,s),e.max=CS(e.max,t,n,u,s)}function AS(e,t,[n,r,s],o,l){y8(e,t[n],t[r],t[s],t.scale,o,l)}const v8=["x","scaleX","originX"],x8=["y","scaleY","originY"];function NS(e,t,n,r){AS(e.x,t,v8,n?n.x:void 0,r?r.x:void 0),AS(e.y,t,x8,n?n.y:void 0,r?r.y:void 0)}function MS(e){return e.translate===0&&e.scale===1}function qC(e){return MS(e.x)&&MS(e.y)}function OS(e,t){return e.min===t.min&&e.max===t.max}function b8(e,t){return OS(e.x,t.x)&&OS(e.y,t.y)}function RS(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function GC(e,t){return RS(e.x,t.x)&&RS(e.y,t.y)}function DS(e){return sn(e.x)/sn(e.y)}function jS(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class w8{constructor(){this.members=[]}add(t){D0(this.members,t),t.scheduleRender()}remove(t){if(j0(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(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const o=this.members[s];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function _8(e,t,n){let r="";const s=e.x.translate/t.x,o=e.y.translate/t.y,l=(n==null?void 0:n.z)||0;if((s||o||l)&&(r=`translate3d(${s}px, ${o}px, ${l}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:h,rotateX:p,rotateY:g,skewX:v,skewY:b}=n;d&&(r=`perspective(${d}px) ${r}`),h&&(r+=`rotate(${h}deg) `),p&&(r+=`rotateX(${p}deg) `),g&&(r+=`rotateY(${g}deg) `),v&&(r+=`skewX(${v}deg) `),b&&(r+=`skewY(${b}deg) `)}const u=e.x.scale*t.x,f=e.y.scale*t.y;return(u!==1||f!==1)&&(r+=`scale(${u}, ${f})`),r||"none"}function YC(e){return L2(e)&&"ownerSVGElement"in e}function S8(e){return YC(e)&&e.tagName==="svg"}const Ap=["","X","Y","Z"],E8={visibility:"hidden"},k8=1e3;let T8=0;function Np(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function ZC(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=tC(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",gt,!(s||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&ZC(r)}function XC({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(l={},u=t==null?void 0:t()){this.id=T8++,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,this.nodes.forEach(N8),this.nodes.forEach(j8),this.nodes.forEach(z8),this.nodes.forEach(M8)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=u?u.root||u:this,this.path=u?[...u.path,u]:[],this.parent=u,this.depth=u?u.depth+1:0;for(let f=0;f<this.path.length;f++)this.path[f].shouldResetTransform=!0;this.root===this&&(this.nodes=new f8)}addEventListener(l,u){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new z0),this.eventHandlers.get(l).add(u)}notifyListeners(l,...u){const f=this.eventHandlers.get(l);f&&f.notify(...u)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=YC(l)&&!S8(l),this.instance=l;const{layoutId:u,layout:f,visualElement:d}=this.options;if(d&&!d.current&&d.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(f||u)&&(this.isLayoutDirty=!0),e){let h;const p=()=>this.root.updateBlockedByResize=!1;e(l,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=d8(p,250),hf.hasAnimatedSinceResize&&(hf.hasAnimatedSinceResize=!1,this.nodes.forEach(LS))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&d&&(u||f)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:p,hasRelativeLayoutChanged:g,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||B8,{onLayoutAnimationStart:w,onLayoutAnimationComplete:_}=d.getProps(),E=!this.targetLayout||!GC(this.targetLayout,v),T=!p&&g;if(this.options.layoutRoot||this.resumeFrom||T||p&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const S={...L0(b,"layout"),onPlay:w,onComplete:_};(d.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S),this.setAnimationOrigin(h,T)}else p||LS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Ui(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(L8),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&ZC(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let h=0;h<this.path.length;h++){const p=this.path[h];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:u,layout:f}=this.options;if(u===void 0&&!f)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(zS);return}this.isUpdating||this.nodes.forEach(R8),this.isUpdating=!1,this.nodes.forEach(D8),this.nodes.forEach(C8),this.nodes.forEach(A8),this.clearAllSnapshots();const u=mn.now();Ht.delta=Qr(0,1e3/60,u-Ht.timestamp),Ht.timestamp=u,Ht.isProcessing=!0,bp.update.process(Ht),bp.preRender.process(Ht),bp.render.process(Ht),Ht.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,S0.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(O8),this.sharedNodes.forEach(P8)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,gt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){gt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!sn(this.snapshot.measuredBox.x)&&!sn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let f=0;f<this.path.length;f++)this.path[f].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutCorrected=St(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:u}=this.options;u&&u.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let u=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(u=!1),u&&this.instance){const f=r(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:f,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:f}}}resetTransform(){if(!s)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,u=this.projectionDelta&&!qC(this.projectionDelta),f=this.getTransformTemplate(),d=f?f(this.latestValues,""):void 0,h=d!==this.prevTransformTemplateValue;l&&this.instance&&(u||ps(this.latestValues)||h)&&(s(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const u=this.measurePageBox();let f=this.removeElementScroll(u);return l&&(f=this.removeTransform(f)),U8(f),{animationId:this.root.animationId,measuredBox:u,layoutBox:f,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:l}=this.options;if(!l)return St();const u=l.measureViewportBox();if(!(((d=this.scroll)==null?void 0:d.wasRoot)||this.path.some(H8))){const{scroll:h}=this.root;h&&(Ma(u.x,h.offset.x),Ma(u.y,h.offset.y))}return u}removeElementScroll(l){var f;const u=St();if(Vn(u,l),(f=this.scroll)!=null&&f.wasRoot)return u;for(let d=0;d<this.path.length;d++){const h=this.path[d],{scroll:p,options:g}=h;h!==this.root&&p&&g.layoutScroll&&(p.wasRoot&&Vn(u,l),Ma(u.x,p.offset.x),Ma(u.y,p.offset.y))}return u}applyTransform(l,u=!1){const f=St();Vn(f,l);for(let d=0;d<this.path.length;d++){const h=this.path[d];!u&&h.options.layoutScroll&&h.scroll&&h!==h.root&&Oa(f,{x:-h.scroll.offset.x,y:-h.scroll.offset.y}),ps(h.latestValues)&&Oa(f,h.latestValues)}return ps(this.latestValues)&&Oa(f,this.latestValues),f}removeTransform(l){const u=St();Vn(u,l);for(let f=0;f<this.path.length;f++){const d=this.path[f];if(!d.instance||!ps(d.latestValues))continue;Cy(d.latestValues)&&d.updateSnapshot();const h=St(),p=d.measurePageBox();Vn(h,p),NS(u,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,h)}return ps(this.latestValues)&&NS(u,this.latestValues),u}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ht.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){var g;const u=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=u.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=u.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=u.isSharedProjectionDirty);const f=!!this.resumingFrom||this!==u;if(!(l||f&&this.isSharedProjectionDirty||this.isProjectionDirty||(g=this.parent)!=null&&g.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:p}=this.options;if(!(!this.layout||!(h||p))){if(this.resolvedRelativeTargetAt=Ht.timestamp,!this.targetDelta&&!this.relativeTarget){const v=this.getClosestProjectingParent();v&&v.layout&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=St(),this.relativeTargetOrigin=St(),Ol(this.relativeTargetOrigin,this.layout.layoutBox,v.layout.layoutBox),Vn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=St(),this.targetWithTransforms=St()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),HB(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Vn(this.target,this.layout.layoutBox),LC(this.target,this.targetDelta)):Vn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const v=this.getClosestProjectingParent();v&&!!v.resumingFrom==!!this.resumingFrom&&!v.options.layoutScroll&&v.target&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=St(),this.relativeTargetOrigin=St(),Ol(this.relativeTargetOrigin,this.target,v.target),Vn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Cy(this.parent.latestValues)||zC(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var b;const l=this.getLead(),u=!!this.resumingFrom||this!==l;let f=!0;if((this.isProjectionDirty||(b=this.parent)!=null&&b.isProjectionDirty)&&(f=!1),u&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(f=!1),this.resolvedRelativeTargetAt===Ht.timestamp&&(f=!1),f)return;const{layout:d,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||h))return;Vn(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,g=this.treeScale.y;FB(this.layoutCorrected,this.treeScale,this.path,u),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=St());const{target:v}=l;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(TS(this.prevProjectionDelta.x,this.projectionDelta.x),TS(this.prevProjectionDelta.y,this.projectionDelta.y)),Ml(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==g||!jS(this.projectionDelta.x,this.prevProjectionDelta.x)||!jS(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",v))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){var u;if((u=this.options.visualElement)==null||u.scheduleRender(),l){const f=this.getStack();f&&f.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Na(),this.projectionDelta=Na(),this.projectionDeltaWithTransform=Na()}setAnimationOrigin(l,u=!1){const f=this.snapshot,d=f?f.latestValues:{},h={...this.latestValues},p=Na();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!u;const g=St(),v=f?f.source:void 0,b=this.layout?this.layout.source:void 0,w=v!==b,_=this.getStack(),E=!_||_.members.length<=1,T=!!(w&&!E&&this.options.crossfade===!0&&!this.path.some(V8));this.animationProgress=0;let S;this.mixTargetDelta=M=>{const D=M/1e3;PS(p.x,l.x,D),PS(p.y,l.y,D),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ol(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox),I8(this.relativeTarget,this.relativeTargetOrigin,g,D),S&&b8(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=St()),Vn(S,this.relativeTarget)),w&&(this.animationValues=h,m8(h,d,this.latestValues,D,T,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=D},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){var u,f,d;this.notifyListeners("animationStart"),(u=this.currentAnimation)==null||u.stop(),(d=(f=this.resumingFrom)==null?void 0:f.currentAnimation)==null||d.stop(),this.pendingAnimation&&(Ui(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=gt.update(()=>{hf.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=qa(0)),this.currentAnimation=u8(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:h=>{this.mixTargetDelta(h),l.onUpdate&&l.onUpdate(h)},onStop:()=>{},onComplete:()=>{l.onComplete&&l.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 l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(k8),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:u,target:f,layout:d,latestValues:h}=l;if(!(!u||!f||!d)){if(this!==l&&this.layout&&d&&QC(this.options.animationType,this.layout.layoutBox,d.layoutBox)){f=this.target||St();const p=sn(this.layout.layoutBox.x);f.x.min=l.target.x.min,f.x.max=f.x.min+p;const g=sn(this.layout.layoutBox.y);f.y.min=l.target.y.min,f.y.max=f.y.min+g}Vn(u,f),Oa(u,h),Ml(this.projectionDeltaWithTransform,this.layoutCorrected,u,h)}}registerSharedNode(l,u){this.sharedNodes.has(l)||this.sharedNodes.set(l,new w8),this.sharedNodes.get(l).add(u);const d=u.options.initialPromotionConfig;u.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(u):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){var u;const{layoutId:l}=this.options;return l?((u=this.getStack())==null?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:l}=this.options;return l?(u=this.getStack())==null?void 0:u.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:u,preserveFollowOpacity:f}={}){const d=this.getStack();d&&d.promote(this,f),l&&(this.projectionDelta=void 0,this.needsReset=!0),u&&this.setOptions({transition:u})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let u=!1;const{latestValues:f}=l;if((f.z||f.rotate||f.rotateX||f.rotateY||f.rotateZ||f.skewX||f.skewY)&&(u=!0),!u)return;const d={};f.z&&Np("z",l,d,this.animationValues);for(let h=0;h<Ap.length;h++)Np(`rotate${Ap[h]}`,l,d,this.animationValues),Np(`skew${Ap[h]}`,l,d,this.animationValues);l.render();for(const h in d)l.setStaticValue(h,d[h]),this.animationValues&&(this.animationValues[h]=d[h]);l.scheduleRender()}getProjectionStyles(l){if(!this.instance||this.isSVG)return;if(!this.isVisible)return E8;const u={visibility:""},f=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=ff(l==null?void 0:l.pointerEvents)||"",u.transform=f?f(this.latestValues,""):"none",u;const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){const v={};return this.options.layoutId&&(v.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,v.pointerEvents=ff(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!ps(this.latestValues)&&(v.transform=f?f({},""):"none",this.hasProjected=!1),v}const h=d.animationValues||d.latestValues;this.applyTransformsToTarget(),u.transform=_8(this.projectionDeltaWithTransform,this.treeScale,h),f&&(u.transform=f(h,u.transform));const{x:p,y:g}=this.projectionDelta;u.transformOrigin=`${p.origin*100}% ${g.origin*100}% 0`,d.animationValues?u.opacity=d===this?h.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:u.opacity=d===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const v in Ul){if(h[v]===void 0)continue;const{correct:b,applyTo:w,isCSSVariable:_}=Ul[v],E=u.transform==="none"?h[v]:b(h[v],d);if(w){const T=w.length;for(let S=0;S<T;S++)u[w[S]]=E}else _?this.options.visualElement.renderState.vars[v]=E:u[v]=E}return this.options.layoutId&&(u.pointerEvents=d===this?ff(l==null?void 0:l.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>{var u;return(u=l.currentAnimation)==null?void 0:u.stop()}),this.root.nodes.forEach(zS),this.root.sharedNodes.clear()}}}function C8(e){e.updateLayout()}function A8(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:o}=e.options,l=t.source!==e.layout.source;o==="size"?Bn(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],v=sn(g);g.min=r[p].min,g.max=g.min+v}):QC(o,t.layoutBox,r)&&Bn(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],v=sn(r[p]);g.max=g.min+v,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+v)});const u=Na();Ml(u,r,t.layoutBox);const f=Na();l?Ml(f,e.applyTransform(s,!0),t.measuredBox):Ml(f,r,t.layoutBox);const d=!qC(u);let h=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:g,layout:v}=p;if(g&&v){const b=St();Ol(b,t.layoutBox,g.layoutBox);const w=St();Ol(w,r,v.layoutBox),GC(b,w)||(h=!0),p.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=b,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:f,layoutDelta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:h})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function N8(e){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 M8(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function O8(e){e.clearSnapshot()}function zS(e){e.clearMeasurements()}function R8(e){e.isLayoutDirty=!1}function D8(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function LS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function j8(e){e.resolveTargetDelta()}function z8(e){e.calcProjection()}function L8(e){e.resetSkewAndRotation()}function P8(e){e.removeLeadSnapshot()}function PS(e,t,n){e.translate=pt(t.translate,0,n),e.scale=pt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function IS(e,t,n,r){e.min=pt(t.min,n.min,r),e.max=pt(t.max,n.max,r)}function I8(e,t,n,r){IS(e.x,t.x,n.x,r),IS(e.y,t.y,n.y,r)}function V8(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const B8={duration:.45,ease:[.4,0,.1,1]},VS=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),BS=VS("applewebkit/")&&!VS("chrome/")?Math.round:Hn;function US(e){e.min=BS(e.min),e.max=BS(e.max)}function U8(e){US(e.x),US(e.y)}function QC(e,t,n){return e==="position"||e==="preserve-aspect"&&!UB(DS(t),DS(n),.2)}function H8(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const F8=XC({attachResizeListener:(e,t)=>Gl(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Mp={current:void 0},KC=XC({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Mp.current){const e=new F8({});e.mount(window),e.setOptions({layoutScroll:!0}),Mp.current=e}return Mp.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),$8={pan:{Feature:s8},drag:{Feature:i8,ProjectionNode:KC,MeasureLayout:HC}};function q8(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const s=(n==null?void 0:n[e])??r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}function WC(e,t){const n=q8(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function HS(e){return!(e.pointerType==="touch"||UC())}function G8(e,t,n={}){const[r,s,o]=WC(e,n),l=u=>{if(!HS(u))return;const{target:f}=u,d=t(f,u);if(typeof d!="function"||!f)return;const h=p=>{HS(p)&&(d(p),f.removeEventListener("pointerleave",h))};f.addEventListener("pointerleave",h,s)};return r.forEach(u=>{u.addEventListener("pointerenter",l,s)}),o}function FS(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,o=r[s];o&>.postRender(()=>o(t,cu(t)))}class Y8 extends qi{mount(){const{current:t}=this.node;t&&(this.unmount=G8(t,(n,r)=>(FS(this.node,r,"Start"),s=>FS(this.node,s,"End"))))}unmount(){}}class Z8 extends qi{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=lu(Gl(this.node.current,"focus",()=>this.onFocus()),Gl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const JC=(e,t)=>t?e===t?!0:JC(e,t.parentElement):!1,X8=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Q8(e){return X8.has(e.tagName)||e.tabIndex!==-1}const mf=new WeakSet;function $S(e){return t=>{t.key==="Enter"&&e(t)}}function Op(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const K8=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=$S(()=>{if(mf.has(n))return;Op(n,"down");const s=$S(()=>{Op(n,"up")}),o=()=>Op(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function qS(e){return X0(e)&&!UC()}function W8(e,t,n={}){const[r,s,o]=WC(e,n),l=u=>{const f=u.currentTarget;if(!qS(u))return;mf.add(f);const d=t(f,u),h=(v,b)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",g),mf.has(f)&&mf.delete(f),qS(v)&&typeof d=="function"&&d(v,{success:b})},p=v=>{h(v,f===window||f===document||n.useGlobalTarget||JC(f,v.target))},g=v=>{h(v,!1)};window.addEventListener("pointerup",p,s),window.addEventListener("pointercancel",g,s)};return r.forEach(u=>{(n.useGlobalTarget?window:u).addEventListener("pointerdown",l,s),P2(u)&&(u.addEventListener("focus",d=>K8(d,s)),!Q8(u)&&!u.hasAttribute("tabindex")&&(u.tabIndex=0))}),o}function GS(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),o=r[s];o&>.postRender(()=>o(t,cu(t)))}class J8 extends qi{mount(){const{current:t}=this.node;t&&(this.unmount=W8(t,(n,r)=>(GS(this.node,r,"Start"),(s,{success:o})=>GS(this.node,s,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const My=new WeakMap,Rp=new WeakMap,eU=e=>{const t=My.get(e.target);t&&t(e)},tU=e=>{e.forEach(eU)};function nU({root:e,...t}){const n=e||document;Rp.has(n)||Rp.set(n,{});const r=Rp.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(tU,{root:e,...t})),r[s]}function rU(e,t,n){const r=nU(t);return My.set(e,n),r.observe(e),()=>{My.delete(e),r.unobserve(e)}}const iU={some:0,all:1};class sU extends qi{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:o}=t,l={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:iU[s]},u=f=>{const{isIntersecting:d}=f;if(this.isInView===d||(this.isInView=d,o&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:h,onViewportLeave:p}=this.node.getProps(),g=d?h:p;g&&g(f)};return rU(this.node.current,l,u)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(aU(t,n))&&this.startObserver()}unmount(){}}function aU({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const oU={inView:{Feature:sU},tap:{Feature:J8},focus:{Feature:Z8},hover:{Feature:Y8}},lU={layout:{ProjectionNode:KC,MeasureLayout:HC}},Oy={current:null},eA={current:!1};function uU(){if(eA.current=!0,!!v0)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Oy.current=e.matches;e.addListener(t),t()}else Oy.current=!1}const cU=new WeakMap;function fU(e,t,n){for(const r in t){const s=t[r],o=n[r];if(Kt(s))e.addValue(r,s);else if(Kt(o))e.addValue(r,qa(s,{owner:e}));else if(o!==s)if(e.hasValue(r)){const l=e.getValue(r);l.liveStyle===!0?l.jump(s):l.hasAnimated||l.set(s)}else{const l=e.getStaticValue(r);e.addValue(r,qa(l!==void 0?l:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const tA=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),nA=e=>/^0[^.\s]+$/u.test(e),dU={test:e=>e==="auto",parse:e=>e},rA=e=>t=>t.test(e),iA=[ro,Re,vr,Ri,w9,b9,dU],YS=e=>iA.find(rA(e)),hU=[...iA,Xt,Hi],mU=e=>hU.find(rA(e)),pU=new Set(["brightness","contrast","saturate","opacity"]);function gU(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(P0)||[];if(!r)return e;const s=n.replace(r,"");let o=pU.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+s+")"}const yU=/\b([a-z-]*)\(.*?\)/gu,Ry={...Hi,getAnimatableNone:e=>{const t=e.match(yU);return t?t.map(gU).join(" "):e}},vU={...C0,color:Xt,backgroundColor:Xt,outlineColor:Xt,fill:Xt,stroke:Xt,borderColor:Xt,borderTopColor:Xt,borderRightColor:Xt,borderBottomColor:Xt,borderLeftColor:Xt,filter:Ry,WebkitFilter:Ry},sA=e=>vU[e];function aA(e,t){let n=sA(e);return n!==Ry&&(n=Hi),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const ZS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class xU{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:o,visualState:l},u={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=G0,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 g=mn.now();this.renderScheduledAt<g&&(this.renderScheduledAt=g,gt.render(this.render,!1,!0))};const{latestValues:f,renderState:d}=l;this.latestValues=f,this.baseTarget={...f},this.initialValues=n.initial?{...f}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=u,this.blockInitialAnimation=!!o,this.isControllingVariants=od(n),this.isVariantNode=U2(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:h,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const g in p){const v=p[g];f[g]!==void 0&&Kt(v)&&v.set(f[g],!1)}}mount(t){this.current=t,cU.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),eA.current||uU(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Oy.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Ui(this.notifyUpdate),Ui(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 r=no.has(t);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&>.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);let l;window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),o(),l&&l(),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 $a){const n=$a[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):St()}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 r=0;r<ZS.length;r++){const s=ZS[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const o="on"+s,l=t[o];l&&(this.propEventSubscriptions[s]=this.on(s,l))}this.prevMotionValues=fU(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&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 r=this.values.get(t);return r===void 0&&n!==void 0&&(r=qa(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(tA(r)||nA(r))?r=parseFloat(r):!mU(r)&&Hi.test(n)&&(r=aA(t,n)),this.setBaseTarget(t,Kt(r)?r.get():r)),Kt(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var o;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const l=O0(this.props,n,(o=this.presenceContext)==null?void 0:o.custom);l&&(r=l[t])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Kt(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 z0),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}const bU=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function wU(e){const t=bU.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function oA(e,t,n=1){const[r,s]=wU(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const l=o.trim();return tA(l)?parseFloat(l):l}return T0(s)?oA(s,t,n+1):s}function _U(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||nA(e):!0}const SU=new Set(["auto","none","0"]);function EU(e,t,n){let r=0,s;for(;r<e.length&&!s;){const o=e[r];typeof o=="string"&&!SU.has(o)&&$l(o).values.length&&(s=e[r]),r++}if(s&&n)for(const o of t)e[o]=aA(n,s)}class kU extends G0{constructor(t,n,r,s,o){super(t,n,r,s,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let f=0;f<t.length;f++){let d=t[f];if(typeof d=="string"&&(d=d.trim(),T0(d))){const h=oA(d,n.current);h!==void 0&&(t[f]=h),f===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!AC.has(r)||t.length!==2)return;const[s,o]=t,l=YS(s),u=YS(o);if(l!==u)if(J_(l)&&J_(u))for(let f=0;f<t.length;f++){const d=t[f];typeof d=="string"&&(t[f]=parseFloat(d))}else ks[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)(t[s]===null||_U(t[s]))&&r.push(s);r.length&&EU(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ks[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var u;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const s=t.getValue(n);s&&s.jump(this.measuredOrigin,!1);const o=r.length-1,l=r[o];r[o]=ks[n](t.measureViewportBox(),window.getComputedStyle(t.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),(u=this.removedTransforms)!=null&&u.length&&this.removedTransforms.forEach(([f,d])=>{t.getValue(f).set(d)}),this.resolveNoneKeyframes()}}class lA extends xU{constructor(){super(...arguments),this.KeyframeResolver=kU}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:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Kt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function uA(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}function TU(e){return window.getComputedStyle(e)}class CU extends lA{constructor(){super(...arguments),this.type="html",this.renderInstance=uA}readValueFromInstance(t,n){var r;if(no.has(n))return(r=this.projection)!=null&&r.isProjecting?wy(n):Q6(t,n);{const s=TU(t),o=(k0(n)?s.getPropertyValue(n):s[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return PC(t,n)}build(t,n,r){A0(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return R0(t,n,r)}}const cA=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 AU(e,t,n,r){uA(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(cA.has(s)?s:_0(s),t.attrs[s])}class NU extends lA{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=St}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(no.has(n)){const r=sA(n);return r&&r.default||0}return n=cA.has(n)?n:_0(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return J2(t,n,r)}build(t,n,r){X2(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,s){AU(t,n,r,s)}mount(t){this.isSVGTag=K2(t.tagName),super.mount(t)}}const MU=(e,t)=>M0(e)?new NU(t):new CU(t,{allowProjection:e!==X.Fragment}),OU=V9({...DB,...oU,...$8,...lU},MU),RU=s9(OU),fA=({renderMessages:e,collapsedTools:t,toggleToolCollapse:n,client:r})=>A.jsx("div",{className:"flex flex-col gap-4 w-full",children:e.map((s,o)=>A.jsx(RU.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,delay:o*.1},children:s.type==="human"?A.jsx(MR,{content:s.content}):s.type==="tool"?A.jsx(XV,{message:s,client:r,getMessageContent:Qy,formatTokens:z4,isCollapsed:t.includes(s.id),onToggleCollapse:()=>n(s.id)}):A.jsx(CI,{message:s})},s.unique_id))}),DU=({onClose:e,formatTime:t})=>{const{historyList:n,currentChatId:r,refreshHistoryList:s,createNewChat:o,deleteHistoryChat:l,toHistoryChat:u}=js();return A.jsxs("div",{className:" bg-white rounded-lg shadow-md h-full flex flex-col border-r",children:[A.jsxs("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center h-16",children:[A.jsxs("div",{className:"flex items-center gap-3",children:[A.jsx("h3",{className:"m-0 text-lg text-gray-800",children:"历史记录"}),A.jsx("button",{className:"p-1.5 text-base rounded bg-blue-100 hover:bg-blue-200 transition-all duration-200 flex items-center justify-center hover:scale-110 group",onClick:s,title:"刷新列表",children:A.jsx(rV,{className:"w-4 h-4 text-blue-600 group-hover:text-blue-700 group-hover:rotate-180 transition-all duration-300"})})]}),A.jsx("button",{className:"p-1.5 text-base rounded bg-red-100 hover:bg-red-200 transition-all duration-200 flex items-center justify-center hover:scale-110 group",onClick:e,title:"关闭",children:A.jsx(w2,{className:"w-4 h-4 text-red-600 group-hover:text-red-700"})})]}),A.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[A.jsx("div",{className:"flex flex-col gap-3 cursor-pointer",onClick:()=>{o()},children:A.jsx("div",{className:"flex justify-between items-center p-3 rounded-lg bg-gray-50 hover:bg-gray-100 transition-colors duration-200",children:A.jsx("div",{className:"text-sm text-gray-800 truncate",children:"New Chat"})})}),n.length===0?A.jsx("div",{className:"text-center text-gray-500 py-8",children:"暂无历史记录"}):A.jsx("div",{className:"flex flex-col gap-3 mt-3",children:n.sort((f,d)=>new Date(d.created_at).getTime()-new Date(f.created_at).getTime()).map(f=>A.jsxs("div",{className:`flex justify-between items-center p-3 rounded-lg transition-colors duration-200 ${f.thread_id===r?"bg-blue-50 border border-blue-200":"bg-gray-50 hover:bg-gray-100"}`,children:[A.jsxs("div",{className:"flex-1 min-w-0 mr-2",children:[A.jsx("div",{className:"text-sm text-gray-800 mb-1 truncate max-w-[180px]",children:L4(f)}),A.jsxs("div",{className:"flex gap-3 text-xs text-gray-500",children:[A.jsx("span",{className:"truncate max-w-[100px]",children:t(new Date(f.created_at))}),A.jsx("span",{className:"truncate max-w-[60px]",children:f.status})]})]}),A.jsxs("div",{className:"flex gap-2 shrink-0",children:[A.jsx("button",{className:"p-1.5 text-base rounded bg-green-100 hover:bg-green-200 transition-all duration-200 flex items-center justify-center hover:scale-110 group",onClick:()=>{u(f)},title:"恢复对话",children:A.jsx(sV,{className:"w-4 h-4 text-green-600 group-hover:text-green-700 group-hover:-rotate-180 transition-all duration-300"})}),A.jsx("button",{className:"p-1.5 text-base rounded bg-red-100 hover:bg-red-200 transition-all duration-200 flex items-center justify-center hover:scale-110 group",onClick:async()=>{await l(f)},title:"删除对话",children:A.jsx(uV,{className:"w-4 h-4 text-red-600 group-hover:text-red-700"})})]})]},f.thread_id))})]})]})},dA=X.createContext(void 0),jU=({children:e})=>{const[t,n]=X.useState(()=>{const s=localStorage.getItem("extraParams");try{return s?JSON.parse(s):{}}catch(o){return console.error("Failed to parse extraParams from localStorage",o),{}}});X.useEffect(()=>{localStorage.setItem("extraParams",JSON.stringify(t))},[t]);const r=s=>{n(s)};return A.jsx(dA.Provider,{value:{extraParams:t,setExtraParams:r},children:e})},hA=()=>{const e=X.useContext(dA);if(e===void 0)throw new Error("useExtraParams must be used within an ExtraParamsProvider");return e};class zU{constructor(t={}){ut(this,"apiUrl");this.apiUrl=t.apiUrl||""}createFormData(t,n){const r=new FormData;if(typeof t=="string"){const s=new Blob([t],{type:"text/plain"});r.append("file",s,n||"file.txt")}else r.append("file",t,n||(t instanceof File?t.name:"file"));return r}async upload(t,n={}){const s={method:"POST",body:this.createFormData(t,n.filename)};n.signal&&(s.signal=n.signal);try{const o=await fetch(`${this.apiUrl}${this.getUploadEndpoint()}`,s);if(!o.ok)throw new Error(`Upload failed with status: ${o.status}`);const l=await o.json();return this.processResponse(l)}catch(o){throw new Error(`File upload failed: ${o instanceof Error?o.message:String(o)}`)}}}class LU extends zU{constructor(t={}){super({apiUrl:t.apiUrl||"https://tmpfiles.org/api/v1"})}getUploadEndpoint(){return"/upload"}processResponse(t){var n;return(n=t.data)!=null&&n.url&&(t.data.url=t.data.url.replace("//tmpfiles.org/","//tmpfiles.org/dl/")),t}}const PU=({onFileUploaded:e})=>{const[t,n]=X.useState([]),r=new LU,s=3,o=X.useCallback(async u=>{var h;const d=Array.from(u.target.files||[]).filter(p=>p.type.startsWith("image/"));if(t.length+d.length>s){alert(`最多只能上传${s}张图片`),u.target.value="";return}n(p=>[...p,...d]);for(const p of d)try{const g=await r.upload(p);(h=g.data)!=null&&h.url&&e(g.data.url)}catch(g){console.error("Upload failed:",g)}u.target.value=""},[e,t.length]),l=X.useCallback(u=>{n(f=>f.filter((d,h)=>h!==u))},[]);return A.jsxs("div",{className:"flex gap-2 rounded-lg flex-1",children:[t.length<s&&A.jsxs("label",{className:`inline-flex items-center justify-center w-20 h-20 text-gray-500 bg-gray-100 rounded-lg cursor-pointer transition-all duration-200 hover:bg-gray-200 ${t.length===0?"w-8 h-8":""}`,children:[A.jsxs("svg",{viewBox:"0 0 24 24",width:t.length===0?"20":"32",height:t.length===0?"20":"32",fill:"currentColor",children:[A.jsx("path",{d:"M12 15.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z"}),A.jsx("path",{d:"M20 4h-3.17l-1.24-1.35A1.99 1.99 0 0 0 14.12 2H9.88c-.56 0-1.1.24-1.48.65L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 13c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z"})]}),A.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:o,className:"hidden"})]}),A.jsx("div",{className:"flex flex-wrap gap-2",children:t.map((u,f)=>A.jsxs("div",{className:"relative w-20 h-20 rounded-lg overflow-hidden",children:[A.jsx("img",{src:URL.createObjectURL(u),alt:u.name,className:"w-full h-full object-cover border border-gray-200"}),A.jsx("button",{className:"absolute top-0.5 right-0.5 w-5 h-5 bg-black/50 text-white rounded-full flex items-center justify-center text-base leading-none hover:bg-black/70 transition-colors",onClick:()=>l(f),children:"×"})]},f))})]})},IU=({isOpen:e,initialJson:t,onClose:n,onSave:r})=>{const[s,o]=X.useState(""),[l,u]=X.useState(null);if(X.useEffect(()=>{o(JSON.stringify(t,null,2)),u(null)},[t,e]),!e)return null;const f=()=>{try{const d=JSON.parse(s);r(d),n()}catch(d){u("JSON 格式无效,请检查后重试。"),console.error("Invalid JSON format:",d)}};return A.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:A.jsx("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl mx-4",children:A.jsxs("div",{className:"p-6",children:[A.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-4",children:"编辑 Extra Parameters"}),A.jsx("textarea",{value:s,onChange:d=>{o(d.target.value),u(null)},rows:15,className:"w-full p-3 border border-gray-300 rounded-lg font-mono text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),l&&A.jsx("p",{className:"mt-2 text-sm text-red-600",children:l}),A.jsxs("div",{className:"flex justify-end gap-3 mt-4",children:[A.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"取消"}),A.jsx("button",{onClick:f,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"保存"})]})]})})})},VU=({isOpen:e,onClose:t,initialJson:n})=>{const[r,s]=X.useState(""),[o,l]=X.useState(null),[u,f]=X.useState([]);X.useEffect(()=>{if(e){let h="";if(n)if(typeof n=="string")h=n;else try{h=JSON.stringify(n,null,2)}catch(p){console.error("Failed to stringify initial JSON",p),h=""}else h=JSON.stringify([],null,2);s(h),l(null);try{d(h)}catch(p){console.error("Failed to parse initial JSON",p)}}},[e,n]);const d=h=>{try{const p=JSON.parse(h);let g=[];if(Array.isArray(p)?g=p:g=p.messages,!Array.isArray(g))throw new Error("JSON 格式无效,请检查后重试");f(g),l(null)}catch(p){l("JSON 格式无效,请检查后重试"),console.error("Invalid JSON format:",p)}};return X.useEffect(()=>{r&&d(r)},[r]),e?A.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:A.jsxs("div",{className:"bg-white rounded-lg shadow-xl w-[90%] max-w-[1200px] h-[80vh] max-h-[800px] flex flex-col overflow-hidden",children:[A.jsxs("div",{className:"flex justify-between items-center p-4 border-b border-gray-200",children:[A.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"JSON 消息预览"}),A.jsx("button",{onClick:t,className:"p-1.5 text-gray-500 hover:text-gray-900 transition-colors rounded-lg hover:bg-gray-100",children:A.jsx(w2,{className:"w-5 h-5"})})]}),A.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[A.jsxs("div",{className:"flex-1 p-4 flex flex-col border-r border-gray-200",children:[A.jsx("textarea",{value:r,onChange:h=>s(h.target.value),rows:20,placeholder:"输入JSON消息格式...",className:"flex-1 font-mono text-sm p-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none"}),o&&A.jsx("p",{className:"mt-2 text-sm text-red-600",children:o})]}),A.jsx("div",{className:"flex-1 p-4 overflow-y-auto bg-gray-50",children:A.jsx("div",{className:"bg-white rounded-lg p-4 min-h-full",children:(u==null?void 0:u.length)>0?A.jsx(fA,{renderMessages:u,collapsedTools:[],toggleToolCollapse:()=>{},client:null}):A.jsx("div",{className:"flex items-center justify-center h-full text-gray-500 italic",children:"请输入有效的JSON以查看消息预览"})})})]})]})}):null},BU=()=>{const[e,t]=X.useState(!1);return A.jsxs(A.Fragment,{children:[A.jsxs("button",{onClick:()=>t(!0),className:"px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 flex items-center gap-1.5",children:[A.jsx(b2,{className:"w-4 h-4"}),"JSON 消息"]}),A.jsx(VU,{isOpen:e,onClose:()=>t(!1)})]})};function Rt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=Rt(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var UU={value:()=>{}};function ld(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new pf(n)}function pf(e){this._=e}function HU(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}pf.prototype=ld.prototype={constructor:pf,on:function(e,t){var n=this._,r=HU(e+"",n),s,o=-1,l=r.length;if(arguments.length<2){for(;++o<l;)if((s=(e=r[o]).type)&&(s=FU(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<l;)if(s=(e=r[o]).type)n[s]=XS(n[s],e.name,t);else if(t==null)for(s in n)n[s]=XS(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new pf(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,o;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,o=r.length;s<o;++s)r[s].value.apply(t,n)}};function FU(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function XS(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=UU,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Dy="http://www.w3.org/1999/xhtml";const QS={svg:"http://www.w3.org/2000/svg",xhtml:Dy,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ud(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),QS.hasOwnProperty(t)?{space:QS[t],local:e}:e}function $U(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Dy&&t.documentElement.namespaceURI===Dy?t.createElement(e):t.createElementNS(n,e)}}function qU(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mA(e){var t=ud(e);return(t.local?qU:$U)(t)}function GU(){}function Q0(e){return e==null?GU:function(){return this.querySelector(e)}}function YU(e){typeof e!="function"&&(e=Q0(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],l=o.length,u=r[s]=new Array(l),f,d,h=0;h<l;++h)(f=o[h])&&(d=e.call(f,f.__data__,h,o))&&("__data__"in f&&(d.__data__=f.__data__),u[h]=d);return new Mn(r,this._parents)}function ZU(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function XU(){return[]}function pA(e){return e==null?XU:function(){return this.querySelectorAll(e)}}function QU(e){return function(){return ZU(e.apply(this,arguments))}}function KU(e){typeof e=="function"?e=QU(e):e=pA(e);for(var t=this._groups,n=t.length,r=[],s=[],o=0;o<n;++o)for(var l=t[o],u=l.length,f,d=0;d<u;++d)(f=l[d])&&(r.push(e.call(f,f.__data__,d,l)),s.push(f));return new Mn(r,s)}function gA(e){return function(){return this.matches(e)}}function yA(e){return function(t){return t.matches(e)}}var WU=Array.prototype.find;function JU(e){return function(){return WU.call(this.children,e)}}function eH(){return this.firstElementChild}function tH(e){return this.select(e==null?eH:JU(typeof e=="function"?e:yA(e)))}var nH=Array.prototype.filter;function rH(){return Array.from(this.children)}function iH(e){return function(){return nH.call(this.children,e)}}function sH(e){return this.selectAll(e==null?rH:iH(typeof e=="function"?e:yA(e)))}function aH(e){typeof e!="function"&&(e=gA(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],l=o.length,u=r[s]=[],f,d=0;d<l;++d)(f=o[d])&&e.call(f,f.__data__,d,o)&&u.push(f);return new Mn(r,this._parents)}function vA(e){return new Array(e.length)}function oH(){return new Mn(this._enter||this._groups.map(vA),this._parents)}function Lf(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Lf.prototype={constructor:Lf,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function lH(e){return function(){return e}}function uH(e,t,n,r,s,o){for(var l=0,u,f=t.length,d=o.length;l<d;++l)(u=t[l])?(u.__data__=o[l],r[l]=u):n[l]=new Lf(e,o[l]);for(;l<f;++l)(u=t[l])&&(s[l]=u)}function cH(e,t,n,r,s,o,l){var u,f,d=new Map,h=t.length,p=o.length,g=new Array(h),v;for(u=0;u<h;++u)(f=t[u])&&(g[u]=v=l.call(f,f.__data__,u,t)+"",d.has(v)?s[u]=f:d.set(v,f));for(u=0;u<p;++u)v=l.call(e,o[u],u,o)+"",(f=d.get(v))?(r[u]=f,f.__data__=o[u],d.delete(v)):n[u]=new Lf(e,o[u]);for(u=0;u<h;++u)(f=t[u])&&d.get(g[u])===f&&(s[u]=f)}function fH(e){return e.__data__}function dH(e,t){if(!arguments.length)return Array.from(this,fH);var n=t?cH:uH,r=this._parents,s=this._groups;typeof e!="function"&&(e=lH(e));for(var o=s.length,l=new Array(o),u=new Array(o),f=new Array(o),d=0;d<o;++d){var h=r[d],p=s[d],g=p.length,v=hH(e.call(h,h&&h.__data__,d,r)),b=v.length,w=u[d]=new Array(b),_=l[d]=new Array(b),E=f[d]=new Array(g);n(h,p,w,_,E,v,t);for(var T=0,S=0,M,D;T<b;++T)if(M=w[T]){for(T>=S&&(S=T+1);!(D=_[S])&&++S<b;);M._next=D||null}}return l=new Mn(l,r),l._enter=u,l._exit=f,l}function hH(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function mH(){return new Mn(this._exit||this._groups.map(vA),this._parents)}function pH(e,t,n){var r=this.enter(),s=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?o.remove():n(o),r&&s?r.merge(s).order():s}function gH(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,o=r.length,l=Math.min(s,o),u=new Array(s),f=0;f<l;++f)for(var d=n[f],h=r[f],p=d.length,g=u[f]=new Array(p),v,b=0;b<p;++b)(v=d[b]||h[b])&&(g[b]=v);for(;f<s;++f)u[f]=n[f];return new Mn(u,this._parents)}function yH(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,o=r[s],l;--s>=0;)(l=r[s])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function vH(e){e||(e=xH);function t(p,g){return p&&g?e(p.__data__,g.__data__):!p-!g}for(var n=this._groups,r=n.length,s=new Array(r),o=0;o<r;++o){for(var l=n[o],u=l.length,f=s[o]=new Array(u),d,h=0;h<u;++h)(d=l[h])&&(f[h]=d);f.sort(t)}return new Mn(s,this._parents).order()}function xH(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function bH(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function wH(){return Array.from(this)}function _H(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length;s<o;++s){var l=r[s];if(l)return l}return null}function SH(){let e=0;for(const t of this)++e;return e}function EH(){return!this.node()}function kH(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],o=0,l=s.length,u;o<l;++o)(u=s[o])&&e.call(u,u.__data__,o,s);return this}function TH(e){return function(){this.removeAttribute(e)}}function CH(e){return function(){this.removeAttributeNS(e.space,e.local)}}function AH(e,t){return function(){this.setAttribute(e,t)}}function NH(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function MH(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function OH(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function RH(e,t){var n=ud(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?CH:TH:typeof t=="function"?n.local?OH:MH:n.local?NH:AH)(n,t))}function xA(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function DH(e){return function(){this.style.removeProperty(e)}}function jH(e,t,n){return function(){this.style.setProperty(e,t,n)}}function zH(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function LH(e,t,n){return arguments.length>1?this.each((t==null?DH:typeof t=="function"?zH:jH)(e,t,n??"")):Ga(this.node(),e)}function Ga(e,t){return e.style.getPropertyValue(t)||xA(e).getComputedStyle(e,null).getPropertyValue(t)}function PH(e){return function(){delete this[e]}}function IH(e,t){return function(){this[e]=t}}function VH(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function BH(e,t){return arguments.length>1?this.each((t==null?PH:typeof t=="function"?VH:IH)(e,t)):this.node()[e]}function bA(e){return e.trim().split(/^|\s+/)}function K0(e){return e.classList||new wA(e)}function wA(e){this._node=e,this._names=bA(e.getAttribute("class")||"")}wA.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 _A(e,t){for(var n=K0(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function SA(e,t){for(var n=K0(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function UH(e){return function(){_A(this,e)}}function HH(e){return function(){SA(this,e)}}function FH(e,t){return function(){(t.apply(this,arguments)?_A:SA)(this,e)}}function $H(e,t){var n=bA(e+"");if(arguments.length<2){for(var r=K0(this.node()),s=-1,o=n.length;++s<o;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?FH:t?UH:HH)(n,t))}function qH(){this.textContent=""}function GH(e){return function(){this.textContent=e}}function YH(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function ZH(e){return arguments.length?this.each(e==null?qH:(typeof e=="function"?YH:GH)(e)):this.node().textContent}function XH(){this.innerHTML=""}function QH(e){return function(){this.innerHTML=e}}function KH(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function WH(e){return arguments.length?this.each(e==null?XH:(typeof e=="function"?KH:QH)(e)):this.node().innerHTML}function JH(){this.nextSibling&&this.parentNode.appendChild(this)}function eF(){return this.each(JH)}function tF(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function nF(){return this.each(tF)}function rF(e){var t=typeof e=="function"?e:mA(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function iF(){return null}function sF(e,t){var n=typeof e=="function"?e:mA(e),r=t==null?iF:typeof t=="function"?t:Q0(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function aF(){var e=this.parentNode;e&&e.removeChild(this)}function oF(){return this.each(aF)}function lF(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function uF(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function cF(e){return this.select(e?uF:lF)}function fF(e){return arguments.length?this.property("__data__",e):this.node().__data__}function dF(e){return function(t){e.call(this,t,this.__data__)}}function hF(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function mF(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,o;n<s;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function pF(e,t,n){return function(){var r=this.__on,s,o=dF(t);if(r){for(var l=0,u=r.length;l<u;++l)if((s=r[l]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=o,s.options=n),s.value=t;return}}this.addEventListener(e.type,o,n),s={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(s):this.__on=[s]}}function gF(e,t,n){var r=hF(e+""),s,o=r.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,d=u.length,h;f<d;++f)for(s=0,h=u[f];s<o;++s)if((l=r[s]).type===h.type&&l.name===h.name)return h.value}return}for(u=t?pF:mF,s=0;s<o;++s)this.each(u(r[s],t,n));return this}function EA(e,t,n){var r=xA(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function yF(e,t){return function(){return EA(this,e,t)}}function vF(e,t){return function(){return EA(this,e,t.apply(this,arguments))}}function xF(e,t){return this.each((typeof t=="function"?vF:yF)(e,t))}function*bF(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,l;s<o;++s)(l=r[s])&&(yield l)}var kA=[null];function Mn(e,t){this._groups=e,this._parents=t}function fu(){return new Mn([[document.documentElement]],kA)}function wF(){return this}Mn.prototype=fu.prototype={constructor:Mn,select:YU,selectAll:KU,selectChild:tH,selectChildren:sH,filter:aH,data:dH,enter:oH,exit:mH,join:pH,merge:gH,selection:wF,order:yH,sort:vH,call:bH,nodes:wH,node:_H,size:SH,empty:EH,each:kH,attr:RH,style:LH,property:BH,classed:$H,text:ZH,html:WH,raise:eF,lower:nF,append:rF,insert:sF,remove:oF,clone:cF,datum:fF,on:gF,dispatch:xF,[Symbol.iterator]:bF};function Cn(e){return typeof e=="string"?new Mn([[document.querySelector(e)]],[document.documentElement]):new Mn([[e]],kA)}function _F(e){let t;for(;t=e.sourceEvent;)e=t;return e}function tr(e,t){if(e=_F(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const SF={passive:!1},Yl={capture:!0,passive:!1};function Dp(e){e.stopImmediatePropagation()}function za(e){e.preventDefault(),e.stopImmediatePropagation()}function TA(e){var t=e.document.documentElement,n=Cn(e).on("dragstart.drag",za,Yl);"onselectstart"in t?n.on("selectstart.drag",za,Yl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function CA(e,t){var n=e.document.documentElement,r=Cn(e).on("dragstart.drag",null);t&&(r.on("click.drag",za,Yl),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Qc=e=>()=>e;function jy(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:o,x:l,y:u,dx:f,dy:d,dispatch:h}){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:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:h}})}jy.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function EF(e){return!e.ctrlKey&&!e.button}function kF(){return this.parentNode}function TF(e,t){return t??{x:e.x,y:e.y}}function CF(){return navigator.maxTouchPoints||"ontouchstart"in this}function AA(){var e=EF,t=kF,n=TF,r=CF,s={},o=ld("start","drag","end"),l=0,u,f,d,h,p=0;function g(M){M.on("mousedown.drag",v).filter(r).on("touchstart.drag",_).on("touchmove.drag",E,SF).on("touchend.drag touchcancel.drag",T).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(M,D){if(!(h||!e.call(this,M,D))){var R=S(this,t.call(this,M,D),M,D,"mouse");R&&(Cn(M.view).on("mousemove.drag",b,Yl).on("mouseup.drag",w,Yl),TA(M.view),Dp(M),d=!1,u=M.clientX,f=M.clientY,R("start",M))}}function b(M){if(za(M),!d){var D=M.clientX-u,R=M.clientY-f;d=D*D+R*R>p}s.mouse("drag",M)}function w(M){Cn(M.view).on("mousemove.drag mouseup.drag",null),CA(M.view,d),za(M),s.mouse("end",M)}function _(M,D){if(e.call(this,M,D)){var R=M.changedTouches,B=t.call(this,M,D),z=R.length,U,O;for(U=0;U<z;++U)(O=S(this,B,M,D,R[U].identifier,R[U]))&&(Dp(M),O("start",M,R[U]))}}function E(M){var D=M.changedTouches,R=D.length,B,z;for(B=0;B<R;++B)(z=s[D[B].identifier])&&(za(M),z("drag",M,D[B]))}function T(M){var D=M.changedTouches,R=D.length,B,z;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),B=0;B<R;++B)(z=s[D[B].identifier])&&(Dp(M),z("end",M,D[B]))}function S(M,D,R,B,z,U){var O=o.copy(),V=tr(U||R,D),H,Q,j;if((j=n.call(M,new jy("beforestart",{sourceEvent:R,target:g,identifier:z,active:l,x:V[0],y:V[1],dx:0,dy:0,dispatch:O}),B))!=null)return H=j.x-V[0]||0,Q=j.y-V[1]||0,function $(I,P,Y){var Z=V,k;switch(I){case"start":s[z]=$,k=l++;break;case"end":delete s[z],--l;case"drag":V=tr(Y||P,D),k=l;break}O.call(I,M,new jy(I,{sourceEvent:P,subject:j,target:g,identifier:z,active:k,x:V[0]+H,y:V[1]+Q,dx:V[0]-Z[0],dy:V[1]-Z[1],dispatch:O}),B)}}return g.filter=function(M){return arguments.length?(e=typeof M=="function"?M:Qc(!!M),g):e},g.container=function(M){return arguments.length?(t=typeof M=="function"?M:Qc(M),g):t},g.subject=function(M){return arguments.length?(n=typeof M=="function"?M:Qc(M),g):n},g.touchable=function(M){return arguments.length?(r=typeof M=="function"?M:Qc(!!M),g):r},g.on=function(){var M=o.on.apply(o,arguments);return M===o?g:M},g.clickDistance=function(M){return arguments.length?(p=(M=+M)*M,g):Math.sqrt(p)},g}function W0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function NA(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function du(){}var Zl=.7,Pf=1/Zl,La="\\s*([+-]?\\d+)\\s*",Xl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",wr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",AF=/^#([0-9a-f]{3,8})$/,NF=new RegExp(`^rgb\\(${La},${La},${La}\\)$`),MF=new RegExp(`^rgb\\(${wr},${wr},${wr}\\)$`),OF=new RegExp(`^rgba\\(${La},${La},${La},${Xl}\\)$`),RF=new RegExp(`^rgba\\(${wr},${wr},${wr},${Xl}\\)$`),DF=new RegExp(`^hsl\\(${Xl},${wr},${wr}\\)$`),jF=new RegExp(`^hsla\\(${Xl},${wr},${wr},${Xl}\\)$`),KS={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};W0(du,Ql,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:WS,formatHex:WS,formatHex8:zF,formatHsl:LF,formatRgb:JS,toString:JS});function WS(){return this.rgb().formatHex()}function zF(){return this.rgb().formatHex8()}function LF(){return MA(this).formatHsl()}function JS(){return this.rgb().formatRgb()}function Ql(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=AF.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?eE(t):n===3?new pn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Kc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Kc(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=NF.exec(e))?new pn(t[1],t[2],t[3],1):(t=MF.exec(e))?new pn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=OF.exec(e))?Kc(t[1],t[2],t[3],t[4]):(t=RF.exec(e))?Kc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=DF.exec(e))?rE(t[1],t[2]/100,t[3]/100,1):(t=jF.exec(e))?rE(t[1],t[2]/100,t[3]/100,t[4]):KS.hasOwnProperty(e)?eE(KS[e]):e==="transparent"?new pn(NaN,NaN,NaN,0):null}function eE(e){return new pn(e>>16&255,e>>8&255,e&255,1)}function Kc(e,t,n,r){return r<=0&&(e=t=n=NaN),new pn(e,t,n,r)}function PF(e){return e instanceof du||(e=Ql(e)),e?(e=e.rgb(),new pn(e.r,e.g,e.b,e.opacity)):new pn}function zy(e,t,n,r){return arguments.length===1?PF(e):new pn(e,t,n,r??1)}function pn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}W0(pn,zy,NA(du,{brighter(e){return e=e==null?Pf:Math.pow(Pf,e),new pn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Zl:Math.pow(Zl,e),new pn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pn(Cs(this.r),Cs(this.g),Cs(this.b),If(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:tE,formatHex:tE,formatHex8:IF,formatRgb:nE,toString:nE}));function tE(){return`#${_s(this.r)}${_s(this.g)}${_s(this.b)}`}function IF(){return`#${_s(this.r)}${_s(this.g)}${_s(this.b)}${_s((isNaN(this.opacity)?1:this.opacity)*255)}`}function nE(){const e=If(this.opacity);return`${e===1?"rgb(":"rgba("}${Cs(this.r)}, ${Cs(this.g)}, ${Cs(this.b)}${e===1?")":`, ${e})`}`}function If(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Cs(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _s(e){return e=Cs(e),(e<16?"0":"")+e.toString(16)}function rE(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new nr(e,t,n,r)}function MA(e){if(e instanceof nr)return new nr(e.h,e.s,e.l,e.opacity);if(e instanceof du||(e=Ql(e)),!e)return new nr;if(e instanceof nr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),o=Math.max(t,n,r),l=NaN,u=o-s,f=(o+s)/2;return u?(t===o?l=(n-r)/u+(n<r)*6:n===o?l=(r-t)/u+2:l=(t-n)/u+4,u/=f<.5?o+s:2-o-s,l*=60):u=f>0&&f<1?0:l,new nr(l,u,f,e.opacity)}function VF(e,t,n,r){return arguments.length===1?MA(e):new nr(e,t,n,r??1)}function nr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}W0(nr,VF,NA(du,{brighter(e){return e=e==null?Pf:Math.pow(Pf,e),new nr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Zl:Math.pow(Zl,e),new nr(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,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new pn(jp(e>=240?e-240:e+120,s,r),jp(e,s,r),jp(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new nr(iE(this.h),Wc(this.s),Wc(this.l),If(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=If(this.opacity);return`${e===1?"hsl(":"hsla("}${iE(this.h)}, ${Wc(this.s)*100}%, ${Wc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function iE(e){return e=(e||0)%360,e<0?e+360:e}function Wc(e){return Math.max(0,Math.min(1,e||0))}function jp(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 OA=e=>()=>e;function BF(e,t){return function(n){return e+n*t}}function UF(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function HF(e){return(e=+e)==1?RA:function(t,n){return n-t?UF(t,n,e):OA(isNaN(t)?n:t)}}function RA(e,t){var n=t-e;return n?BF(e,n):OA(isNaN(e)?t:e)}const sE=function e(t){var n=HF(t);function r(s,o){var l=n((s=zy(s)).r,(o=zy(o)).r),u=n(s.g,o.g),f=n(s.b,o.b),d=RA(s.opacity,o.opacity);return function(h){return s.r=l(h),s.g=u(h),s.b=f(h),s.opacity=d(h),s+""}}return r.gamma=e,r}(1);function ji(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Ly=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zp=new RegExp(Ly.source,"g");function FF(e){return function(){return e}}function $F(e){return function(t){return e(t)+""}}function qF(e,t){var n=Ly.lastIndex=zp.lastIndex=0,r,s,o,l=-1,u=[],f=[];for(e=e+"",t=t+"";(r=Ly.exec(e))&&(s=zp.exec(t));)(o=s.index)>n&&(o=t.slice(n,o),u[l]?u[l]+=o:u[++l]=o),(r=r[0])===(s=s[0])?u[l]?u[l]+=s:u[++l]=s:(u[++l]=null,f.push({i:l,x:ji(r,s)})),n=zp.lastIndex;return n<t.length&&(o=t.slice(n),u[l]?u[l]+=o:u[++l]=o),u.length<2?f[0]?$F(f[0].x):FF(t):(t=f.length,function(d){for(var h=0,p;h<t;++h)u[(p=f[h]).i]=p.x(d);return u.join("")})}var aE=180/Math.PI,Py={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function DA(e,t,n,r,s,o){var l,u,f;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(f=e*n+t*r)&&(n-=e*f,r-=t*f),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,f/=u),e*r<t*n&&(e=-e,t=-t,f=-f,l=-l),{translateX:s,translateY:o,rotate:Math.atan2(t,e)*aE,skewX:Math.atan(f)*aE,scaleX:l,scaleY:u}}var Jc;function GF(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Py:DA(t.a,t.b,t.c,t.d,t.e,t.f)}function YF(e){return e==null||(Jc||(Jc=document.createElementNS("http://www.w3.org/2000/svg","g")),Jc.setAttribute("transform",e),!(e=Jc.transform.baseVal.consolidate()))?Py:(e=e.matrix,DA(e.a,e.b,e.c,e.d,e.e,e.f))}function jA(e,t,n,r){function s(d){return d.length?d.pop()+" ":""}function o(d,h,p,g,v,b){if(d!==p||h!==g){var w=v.push("translate(",null,t,null,n);b.push({i:w-4,x:ji(d,p)},{i:w-2,x:ji(h,g)})}else(p||g)&&v.push("translate("+p+t+g+n)}function l(d,h,p,g){d!==h?(d-h>180?h+=360:h-d>180&&(d+=360),g.push({i:p.push(s(p)+"rotate(",null,r)-2,x:ji(d,h)})):h&&p.push(s(p)+"rotate("+h+r)}function u(d,h,p,g){d!==h?g.push({i:p.push(s(p)+"skewX(",null,r)-2,x:ji(d,h)}):h&&p.push(s(p)+"skewX("+h+r)}function f(d,h,p,g,v,b){if(d!==p||h!==g){var w=v.push(s(v)+"scale(",null,",",null,")");b.push({i:w-4,x:ji(d,p)},{i:w-2,x:ji(h,g)})}else(p!==1||g!==1)&&v.push(s(v)+"scale("+p+","+g+")")}return function(d,h){var p=[],g=[];return d=e(d),h=e(h),o(d.translateX,d.translateY,h.translateX,h.translateY,p,g),l(d.rotate,h.rotate,p,g),u(d.skewX,h.skewX,p,g),f(d.scaleX,d.scaleY,h.scaleX,h.scaleY,p,g),d=h=null,function(v){for(var b=-1,w=g.length,_;++b<w;)p[(_=g[b]).i]=_.x(v);return p.join("")}}}var ZF=jA(GF,"px, ","px)","deg)"),XF=jA(YF,", ",")",")"),QF=1e-12;function oE(e){return((e=Math.exp(e))+1/e)/2}function KF(e){return((e=Math.exp(e))-1/e)/2}function WF(e){return((e=Math.exp(2*e))-1)/(e+1)}const JF=function e(t,n,r){function s(o,l){var u=o[0],f=o[1],d=o[2],h=l[0],p=l[1],g=l[2],v=h-u,b=p-f,w=v*v+b*b,_,E;if(w<QF)E=Math.log(g/d)/t,_=function(B){return[u+B*v,f+B*b,d*Math.exp(t*B*E)]};else{var T=Math.sqrt(w),S=(g*g-d*d+r*w)/(2*d*n*T),M=(g*g-d*d-r*w)/(2*g*n*T),D=Math.log(Math.sqrt(S*S+1)-S),R=Math.log(Math.sqrt(M*M+1)-M);E=(R-D)/t,_=function(B){var z=B*E,U=oE(D),O=d/(n*T)*(U*WF(t*z+D)-KF(D));return[u+O*v,f+O*b,d*U/oE(t*z+D)]}}return _.duration=E*1e3*t/Math.SQRT2,_}return s.rho=function(o){var l=Math.max(.001,+o),u=l*l,f=u*u;return e(l,u,f)},s}(Math.SQRT2,2,4);var Ya=0,_l=0,yl=0,zA=1e3,Vf,Sl,Bf=0,Os=0,cd=0,Kl=typeof performance=="object"&&performance.now?performance:Date,LA=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function J0(){return Os||(LA(e7),Os=Kl.now()+cd)}function e7(){Os=0}function Uf(){this._call=this._time=this._next=null}Uf.prototype=PA.prototype={constructor:Uf,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?J0():+n)+(t==null?0:+t),!this._next&&Sl!==this&&(Sl?Sl._next=this:Vf=this,Sl=this),this._call=e,this._time=n,Iy()},stop:function(){this._call&&(this._call=null,this._time=1/0,Iy())}};function PA(e,t,n){var r=new Uf;return r.restart(e,t,n),r}function t7(){J0(),++Ya;for(var e=Vf,t;e;)(t=Os-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ya}function lE(){Os=(Bf=Kl.now())+cd,Ya=_l=0;try{t7()}finally{Ya=0,r7(),Os=0}}function n7(){var e=Kl.now(),t=e-Bf;t>zA&&(cd-=t,Bf=e)}function r7(){for(var e,t=Vf,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Vf=n);Sl=e,Iy(r)}function Iy(e){if(!Ya){_l&&(_l=clearTimeout(_l));var t=e-Os;t>24?(e<1/0&&(_l=setTimeout(lE,e-Kl.now()-cd)),yl&&(yl=clearInterval(yl))):(yl||(Bf=Kl.now(),yl=setInterval(n7,zA)),Ya=1,LA(lE))}}function uE(e,t,n){var r=new Uf;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var i7=ld("start","end","cancel","interrupt"),s7=[],IA=0,cE=1,Vy=2,gf=3,fE=4,By=5,yf=6;function fd(e,t,n,r,s,o){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;a7(e,n,{name:t,index:r,group:s,on:i7,tween:s7,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:IA})}function ev(e,t){var n=ar(e,t);if(n.state>IA)throw new Error("too late; already scheduled");return n}function Er(e,t){var n=ar(e,t);if(n.state>gf)throw new Error("too late; already running");return n}function ar(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function a7(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=PA(o,0,n.time);function o(d){n.state=cE,n.timer.restart(l,n.delay,n.time),n.delay<=d&&l(d-n.delay)}function l(d){var h,p,g,v;if(n.state!==cE)return f();for(h in r)if(v=r[h],v.name===n.name){if(v.state===gf)return uE(l);v.state===fE?(v.state=yf,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete r[h]):+h<t&&(v.state=yf,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete r[h])}if(uE(function(){n.state===gf&&(n.state=fE,n.timer.restart(u,n.delay,n.time),u(d))}),n.state=Vy,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Vy){for(n.state=gf,s=new Array(g=n.tween.length),h=0,p=-1;h<g;++h)(v=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(s[++p]=v);s.length=p+1}}function u(d){for(var h=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(f),n.state=By,1),p=-1,g=s.length;++p<g;)s[p].call(e,h);n.state===By&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=yf,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function vf(e,t){var n=e.__transition,r,s,o=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((r=n[l]).name!==t){o=!1;continue}s=r.state>Vy&&r.state<By,r.state=yf,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[l]}o&&delete e.__transition}}function o7(e){return this.each(function(){vf(this,e)})}function l7(e,t){var n,r;return function(){var s=Er(this,e),o=s.tween;if(o!==n){r=n=o;for(var l=0,u=r.length;l<u;++l)if(r[l].name===t){r=r.slice(),r.splice(l,1);break}}s.tween=r}}function u7(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var o=Er(this,e),l=o.tween;if(l!==r){s=(r=l).slice();for(var u={name:t,value:n},f=0,d=s.length;f<d;++f)if(s[f].name===t){s[f]=u;break}f===d&&s.push(u)}o.tween=s}}function c7(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ar(this.node(),n).tween,s=0,o=r.length,l;s<o;++s)if((l=r[s]).name===e)return l.value;return null}return this.each((t==null?l7:u7)(n,e,t))}function tv(e,t,n){var r=e._id;return e.each(function(){var s=Er(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return ar(s,r).value[t]}}function VA(e,t){var n;return(typeof t=="number"?ji:t instanceof Ql?sE:(n=Ql(t))?(t=n,sE):qF)(e,t)}function f7(e){return function(){this.removeAttribute(e)}}function d7(e){return function(){this.removeAttributeNS(e.space,e.local)}}function h7(e,t,n){var r,s=n+"",o;return function(){var l=this.getAttribute(e);return l===s?null:l===r?o:o=t(r=l,n)}}function m7(e,t,n){var r,s=n+"",o;return function(){var l=this.getAttributeNS(e.space,e.local);return l===s?null:l===r?o:o=t(r=l,n)}}function p7(e,t,n){var r,s,o;return function(){var l,u=n(this),f;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),f=u+"",l===f?null:l===r&&f===s?o:(s=f,o=t(r=l,u)))}}function g7(e,t,n){var r,s,o;return function(){var l,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),f=u+"",l===f?null:l===r&&f===s?o:(s=f,o=t(r=l,u)))}}function y7(e,t){var n=ud(e),r=n==="transform"?XF:VA;return this.attrTween(e,typeof t=="function"?(n.local?g7:p7)(n,r,tv(this,"attr."+e,t)):t==null?(n.local?d7:f7)(n):(n.local?m7:h7)(n,r,t))}function v7(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function x7(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function b7(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&x7(e,o)),n}return s._value=t,s}function w7(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&v7(e,o)),n}return s._value=t,s}function _7(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=ud(e);return this.tween(n,(r.local?b7:w7)(r,t))}function S7(e,t){return function(){ev(this,e).delay=+t.apply(this,arguments)}}function E7(e,t){return t=+t,function(){ev(this,e).delay=t}}function k7(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?S7:E7)(t,e)):ar(this.node(),t).delay}function T7(e,t){return function(){Er(this,e).duration=+t.apply(this,arguments)}}function C7(e,t){return t=+t,function(){Er(this,e).duration=t}}function A7(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?T7:C7)(t,e)):ar(this.node(),t).duration}function N7(e,t){if(typeof t!="function")throw new Error;return function(){Er(this,e).ease=t}}function M7(e){var t=this._id;return arguments.length?this.each(N7(t,e)):ar(this.node(),t).ease}function O7(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Er(this,e).ease=n}}function R7(e){if(typeof e!="function")throw new Error;return this.each(O7(this._id,e))}function D7(e){typeof e!="function"&&(e=gA(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],l=o.length,u=r[s]=[],f,d=0;d<l;++d)(f=o[d])&&e.call(f,f.__data__,d,o)&&u.push(f);return new Kr(r,this._parents,this._name,this._id)}function j7(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),l=new Array(r),u=0;u<o;++u)for(var f=t[u],d=n[u],h=f.length,p=l[u]=new Array(h),g,v=0;v<h;++v)(g=f[v]||d[v])&&(p[v]=g);for(;u<r;++u)l[u]=t[u];return new Kr(l,this._parents,this._name,this._id)}function z7(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function L7(e,t,n){var r,s,o=z7(t)?ev:Er;return function(){var l=o(this,e),u=l.on;u!==r&&(s=(r=u).copy()).on(t,n),l.on=s}}function P7(e,t){var n=this._id;return arguments.length<2?ar(this.node(),n).on.on(e):this.each(L7(n,e,t))}function I7(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function V7(){return this.on("end.remove",I7(this._id))}function B7(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Q0(e));for(var r=this._groups,s=r.length,o=new Array(s),l=0;l<s;++l)for(var u=r[l],f=u.length,d=o[l]=new Array(f),h,p,g=0;g<f;++g)(h=u[g])&&(p=e.call(h,h.__data__,g,u))&&("__data__"in h&&(p.__data__=h.__data__),d[g]=p,fd(d[g],t,n,g,d,ar(h,n)));return new Kr(o,this._parents,t,n)}function U7(e){var t=this._name,n=this._id;typeof e!="function"&&(e=pA(e));for(var r=this._groups,s=r.length,o=[],l=[],u=0;u<s;++u)for(var f=r[u],d=f.length,h,p=0;p<d;++p)if(h=f[p]){for(var g=e.call(h,h.__data__,p,f),v,b=ar(h,n),w=0,_=g.length;w<_;++w)(v=g[w])&&fd(v,t,n,w,g,b);o.push(g),l.push(h)}return new Kr(o,l,t,n)}var H7=fu.prototype.constructor;function F7(){return new H7(this._groups,this._parents)}function $7(e,t){var n,r,s;return function(){var o=Ga(this,e),l=(this.style.removeProperty(e),Ga(this,e));return o===l?null:o===n&&l===r?s:s=t(n=o,r=l)}}function BA(e){return function(){this.style.removeProperty(e)}}function q7(e,t,n){var r,s=n+"",o;return function(){var l=Ga(this,e);return l===s?null:l===r?o:o=t(r=l,n)}}function G7(e,t,n){var r,s,o;return function(){var l=Ga(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),Ga(this,e))),l===f?null:l===r&&f===s?o:(s=f,o=t(r=l,u))}}function Y7(e,t){var n,r,s,o="style."+t,l="end."+o,u;return function(){var f=Er(this,e),d=f.on,h=f.value[o]==null?u||(u=BA(t)):void 0;(d!==n||s!==h)&&(r=(n=d).copy()).on(l,s=h),f.on=r}}function Z7(e,t,n){var r=(e+="")=="transform"?ZF:VA;return t==null?this.styleTween(e,$7(e,r)).on("end.style."+e,BA(e)):typeof t=="function"?this.styleTween(e,G7(e,r,tv(this,"style."+e,t))).each(Y7(this._id,e)):this.styleTween(e,q7(e,r,t),n).on("end.style."+e,null)}function X7(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Q7(e,t,n){var r,s;function o(){var l=t.apply(this,arguments);return l!==s&&(r=(s=l)&&X7(e,l,n)),r}return o._value=t,o}function K7(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Q7(e,t,n??""))}function W7(e){return function(){this.textContent=e}}function J7(e){return function(){var t=e(this);this.textContent=t??""}}function e$(e){return this.tween("text",typeof e=="function"?J7(tv(this,"text",e)):W7(e==null?"":e+""))}function t$(e){return function(t){this.textContent=e.call(this,t)}}function n$(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&t$(s)),t}return r._value=e,r}function r$(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,n$(e))}function i$(){for(var e=this._name,t=this._id,n=UA(),r=this._groups,s=r.length,o=0;o<s;++o)for(var l=r[o],u=l.length,f,d=0;d<u;++d)if(f=l[d]){var h=ar(f,t);fd(f,e,n,d,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Kr(r,this._parents,e,n)}function s$(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(o,l){var u={value:l},f={value:function(){--s===0&&o()}};n.each(function(){var d=Er(this,r),h=d.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),d.on=t}),s===0&&o()})}var a$=0;function Kr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function UA(){return++a$}var $r=fu.prototype;Kr.prototype={constructor:Kr,select:B7,selectAll:U7,selectChild:$r.selectChild,selectChildren:$r.selectChildren,filter:D7,merge:j7,selection:F7,transition:i$,call:$r.call,nodes:$r.nodes,node:$r.node,size:$r.size,empty:$r.empty,each:$r.each,on:P7,attr:y7,attrTween:_7,style:Z7,styleTween:K7,text:e$,textTween:r$,remove:V7,tween:c7,delay:k7,duration:A7,ease:M7,easeVarying:R7,end:s$,[Symbol.iterator]:$r[Symbol.iterator]};function o$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var l$={time:null,delay:0,duration:250,ease:o$};function u$(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function c$(e){var t,n;e instanceof Kr?(t=e._id,e=e._name):(t=UA(),(n=l$).time=J0(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,o=0;o<s;++o)for(var l=r[o],u=l.length,f,d=0;d<u;++d)(f=l[d])&&fd(f,e,t,d,l,n||u$(f,t));return new Kr(r,this._parents,e,t)}fu.prototype.interrupt=o7;fu.prototype.transition=c$;const ef=e=>()=>e;function f$(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){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:r,enumerable:!0,configurable:!0},_:{value:s}})}function qr(e,t,n){this.k=e,this.x=t,this.y=n}qr.prototype={constructor:qr,scale:function(e){return e===1?this:new qr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new qr(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 dd=new qr(1,0,0);HA.prototype=qr.prototype;function HA(e){for(;!e.__zoom;)if(!(e=e.parentNode))return dd;return e.__zoom}function Lp(e){e.stopImmediatePropagation()}function vl(e){e.preventDefault(),e.stopImmediatePropagation()}function d$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function h$(){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 dE(){return this.__zoom||dd}function m$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function p$(){return navigator.maxTouchPoints||"ontouchstart"in this}function g$(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),l>o?(o+l)/2:Math.min(0,o)||Math.max(0,l))}function FA(){var e=d$,t=h$,n=g$,r=m$,s=p$,o=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,f=JF,d=ld("start","zoom","end"),h,p,g,v=500,b=150,w=0,_=10;function E(j){j.property("__zoom",dE).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",U).on("dblclick.zoom",O).filter(s).on("touchstart.zoom",V).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(j,$,I,P){var Y=j.selection?j.selection():j;Y.property("__zoom",dE),j!==Y?D(j,$,I,P):Y.interrupt().each(function(){R(this,arguments).event(P).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},E.scaleBy=function(j,$,I,P){E.scaleTo(j,function(){var Y=this.__zoom.k,Z=typeof $=="function"?$.apply(this,arguments):$;return Y*Z},I,P)},E.scaleTo=function(j,$,I,P){E.transform(j,function(){var Y=t.apply(this,arguments),Z=this.__zoom,k=I==null?M(Y):typeof I=="function"?I.apply(this,arguments):I,G=Z.invert(k),te=typeof $=="function"?$.apply(this,arguments):$;return n(S(T(Z,te),k,G),Y,l)},I,P)},E.translateBy=function(j,$,I,P){E.transform(j,function(){return n(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),l)},null,P)},E.translateTo=function(j,$,I,P,Y){E.transform(j,function(){var Z=t.apply(this,arguments),k=this.__zoom,G=P==null?M(Z):typeof P=="function"?P.apply(this,arguments):P;return n(dd.translate(G[0],G[1]).scale(k.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof I=="function"?-I.apply(this,arguments):-I),Z,l)},P,Y)};function T(j,$){return $=Math.max(o[0],Math.min(o[1],$)),$===j.k?j:new qr($,j.x,j.y)}function S(j,$,I){var P=$[0]-I[0]*j.k,Y=$[1]-I[1]*j.k;return P===j.x&&Y===j.y?j:new qr(j.k,P,Y)}function M(j){return[(+j[0][0]+ +j[1][0])/2,(+j[0][1]+ +j[1][1])/2]}function D(j,$,I,P){j.on("start.zoom",function(){R(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(P).end()}).tween("zoom",function(){var Y=this,Z=arguments,k=R(Y,Z).event(P),G=t.apply(Y,Z),te=I==null?M(G):typeof I=="function"?I.apply(Y,Z):I,C=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),F=Y.__zoom,W=typeof $=="function"?$.apply(Y,Z):$,J=f(F.invert(te).concat(C/F.k),W.invert(te).concat(C/W.k));return function(oe){if(oe===1)oe=W;else{var ce=J(oe),ge=C/ce[2];oe=new qr(ge,te[0]-ce[0]*ge,te[1]-ce[1]*ge)}k.zoom(null,oe)}})}function R(j,$,I){return!I&&j.__zooming||new B(j,$)}function B(j,$){this.that=j,this.args=$,this.active=0,this.sourceEvent=null,this.extent=t.apply(j,$),this.taps=0}B.prototype={event:function(j){return j&&(this.sourceEvent=j),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(j,$){return this.mouse&&j!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&j!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&j!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(j){var $=Cn(this.that).datum();d.call(j,this.that,new f$(j,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),$)}};function z(j,...$){if(!e.apply(this,arguments))return;var I=R(this,$).event(j),P=this.__zoom,Y=Math.max(o[0],Math.min(o[1],P.k*Math.pow(2,r.apply(this,arguments)))),Z=tr(j);if(I.wheel)(I.mouse[0][0]!==Z[0]||I.mouse[0][1]!==Z[1])&&(I.mouse[1]=P.invert(I.mouse[0]=Z)),clearTimeout(I.wheel);else{if(P.k===Y)return;I.mouse=[Z,P.invert(Z)],vf(this),I.start()}vl(j),I.wheel=setTimeout(k,b),I.zoom("mouse",n(S(T(P,Y),I.mouse[0],I.mouse[1]),I.extent,l));function k(){I.wheel=null,I.end()}}function U(j,...$){if(g||!e.apply(this,arguments))return;var I=j.currentTarget,P=R(this,$,!0).event(j),Y=Cn(j.view).on("mousemove.zoom",te,!0).on("mouseup.zoom",C,!0),Z=tr(j,I),k=j.clientX,G=j.clientY;TA(j.view),Lp(j),P.mouse=[Z,this.__zoom.invert(Z)],vf(this),P.start();function te(F){if(vl(F),!P.moved){var W=F.clientX-k,J=F.clientY-G;P.moved=W*W+J*J>w}P.event(F).zoom("mouse",n(S(P.that.__zoom,P.mouse[0]=tr(F,I),P.mouse[1]),P.extent,l))}function C(F){Y.on("mousemove.zoom mouseup.zoom",null),CA(F.view,P.moved),vl(F),P.event(F).end()}}function O(j,...$){if(e.apply(this,arguments)){var I=this.__zoom,P=tr(j.changedTouches?j.changedTouches[0]:j,this),Y=I.invert(P),Z=I.k*(j.shiftKey?.5:2),k=n(S(T(I,Z),P,Y),t.apply(this,$),l);vl(j),u>0?Cn(this).transition().duration(u).call(D,k,P,j):Cn(this).call(E.transform,k,P,j)}}function V(j,...$){if(e.apply(this,arguments)){var I=j.touches,P=I.length,Y=R(this,$,j.changedTouches.length===P).event(j),Z,k,G,te;for(Lp(j),k=0;k<P;++k)G=I[k],te=tr(G,this),te=[te,this.__zoom.invert(te),G.identifier],Y.touch0?!Y.touch1&&Y.touch0[2]!==te[2]&&(Y.touch1=te,Y.taps=0):(Y.touch0=te,Z=!0,Y.taps=1+!!h);h&&(h=clearTimeout(h)),Z&&(Y.taps<2&&(p=te[0],h=setTimeout(function(){h=null},v)),vf(this),Y.start())}}function H(j,...$){if(this.__zooming){var I=R(this,$).event(j),P=j.changedTouches,Y=P.length,Z,k,G,te;for(vl(j),Z=0;Z<Y;++Z)k=P[Z],G=tr(k,this),I.touch0&&I.touch0[2]===k.identifier?I.touch0[0]=G:I.touch1&&I.touch1[2]===k.identifier&&(I.touch1[0]=G);if(k=I.that.__zoom,I.touch1){var C=I.touch0[0],F=I.touch0[1],W=I.touch1[0],J=I.touch1[1],oe=(oe=W[0]-C[0])*oe+(oe=W[1]-C[1])*oe,ce=(ce=J[0]-F[0])*ce+(ce=J[1]-F[1])*ce;k=T(k,Math.sqrt(oe/ce)),G=[(C[0]+W[0])/2,(C[1]+W[1])/2],te=[(F[0]+J[0])/2,(F[1]+J[1])/2]}else if(I.touch0)G=I.touch0[0],te=I.touch0[1];else return;I.zoom("touch",n(S(k,G,te),I.extent,l))}}function Q(j,...$){if(this.__zooming){var I=R(this,$).event(j),P=j.changedTouches,Y=P.length,Z,k;for(Lp(j),g&&clearTimeout(g),g=setTimeout(function(){g=null},v),Z=0;Z<Y;++Z)k=P[Z],I.touch0&&I.touch0[2]===k.identifier?delete I.touch0:I.touch1&&I.touch1[2]===k.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(k=tr(k,this),Math.hypot(p[0]-k[0],p[1]-k[1])<_)){var G=Cn(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return E.wheelDelta=function(j){return arguments.length?(r=typeof j=="function"?j:ef(+j),E):r},E.filter=function(j){return arguments.length?(e=typeof j=="function"?j:ef(!!j),E):e},E.touchable=function(j){return arguments.length?(s=typeof j=="function"?j:ef(!!j),E):s},E.extent=function(j){return arguments.length?(t=typeof j=="function"?j:ef([[+j[0][0],+j[0][1]],[+j[1][0],+j[1][1]]]),E):t},E.scaleExtent=function(j){return arguments.length?(o[0]=+j[0],o[1]=+j[1],E):[o[0],o[1]]},E.translateExtent=function(j){return arguments.length?(l[0][0]=+j[0][0],l[1][0]=+j[1][0],l[0][1]=+j[0][1],l[1][1]=+j[1][1],E):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},E.constrain=function(j){return arguments.length?(n=j,E):n},E.duration=function(j){return arguments.length?(u=+j,E):u},E.interpolate=function(j){return arguments.length?(f=j,E):f},E.on=function(){var j=d.on.apply(d,arguments);return j===d?E:j},E.clickDistance=function(j){return arguments.length?(w=(j=+j)*j,E):Math.sqrt(w)},E.tapDistance=function(j){return arguments.length?(_=+j,E):_},E}const _r={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.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 React Flow 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:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", 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."},Wl=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],$A=["Enter"," ","Escape"];var Za;(function(e){e.Strict="strict",e.Loose="loose"})(Za||(Za={}));var As;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(As||(As={}));var Jl;(function(e){e.Partial="partial",e.Full="full"})(Jl||(Jl={}));const qA={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var zi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(zi||(zi={}));var Hf;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Hf||(Hf={}));var Ae;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ae||(Ae={}));const hE={[Ae.Left]:Ae.Right,[Ae.Right]:Ae.Left,[Ae.Top]:Ae.Bottom,[Ae.Bottom]:Ae.Top};function GA(e){return e===null?null:e?"valid":"invalid"}const YA=e=>"id"in e&&"source"in e&&"target"in e,y$=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),nv=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),hu=(e,t=[0,0])=>{const{width:n,height:r}=Jr(e),s=e.origin??t,o=n*s[0],l=r*s[1];return{x:e.position.x-o,y:e.position.y-l}},v$=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const o=typeof s=="string";let l=!t.nodeLookup&&!o?s:void 0;t.nodeLookup&&(l=o?t.nodeLookup.get(s):nv(s)?s:t.nodeLookup.get(s.id));const u=l?Ff(l,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return hd(r,u)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return md(n)},mu=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(r=>{if(t.filter===void 0||t.filter(r)){const s=Ff(r);n=hd(n,s)}}),md(n)},ZA=(e,t,[n,r,s]=[0,0,1],o=!1,l=!1)=>{const u={...pu(t,[n,r,s]),width:t.width/s,height:t.height/s},f=[];for(const d of e.values()){const{measured:h,selectable:p=!0,hidden:g=!1}=d;if(l&&!p||g)continue;const v=h.width??d.width??d.initialWidth??null,b=h.height??d.height??d.initialHeight??null,w=eu(u,Qa(d)),_=(v??0)*(b??0),E=o&&w>0;(!d.internals.handleBounds||E||w>=_||d.dragging)&&f.push(d)}return f},x$=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function b$(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function w$({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:o},l){if(e.size===0)return Promise.resolve(!0);const u=b$(e,l),f=mu(u),d=rv(f,t,n,(l==null?void 0:l.minZoom)??s,(l==null?void 0:l.maxZoom)??o,(l==null?void 0:l.padding)??.1);return await r.setViewport(d,{duration:l==null?void 0:l.duration}),Promise.resolve(!0)}function XA({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:o}){const l=n.get(e),u=l.parentId?n.get(l.parentId):void 0,{x:f,y:d}=u?u.internals.positionAbsolute:{x:0,y:0},h=l.origin??r;let p=s;if(l.extent==="parent"&&!l.expandParent)if(!u)o==null||o("005",_r.error005());else{const v=u.measured.width,b=u.measured.height;v&&b&&(p=[[f,d],[f+v,d+b]])}else u&&Ka(l.extent)&&(p=[[l.extent[0][0]+f,l.extent[0][1]+d],[l.extent[1][0]+f,l.extent[1][1]+d]]);const g=Ka(p)?Rs(t,p,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&(o==null||o("015",_r.error015())),{position:{x:g.x-f+(l.measured.width??0)*h[0],y:g.y-d+(l.measured.height??0)*h[1]},positionAbsolute:g}}async function _$({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const o=new Set(e.map(g=>g.id)),l=[];for(const g of n){if(g.deletable===!1)continue;const v=o.has(g.id),b=!v&&g.parentId&&l.find(w=>w.id===g.parentId);(v||b)&&l.push(g)}const u=new Set(t.map(g=>g.id)),f=r.filter(g=>g.deletable!==!1),h=x$(l,f);for(const g of f)u.has(g.id)&&!h.find(b=>b.id===g.id)&&h.push(g);if(!s)return{edges:h,nodes:l};const p=await s({nodes:l,edges:h});return typeof p=="boolean"?p?{edges:h,nodes:l}:{edges:[],nodes:[]}:p}const Xa=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Rs=(e={x:0,y:0},t,n)=>({x:Xa(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Xa(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function QA(e,t,n){const{width:r,height:s}=Jr(n),{x:o,y:l}=n.internals.positionAbsolute;return Rs(e,[[o,l],[o+r,l+s]],t)}const mE=(e,t,n)=>e<t?Xa(Math.abs(e-t),1,t)/t:e>n?-Xa(Math.abs(e-n),1,t)/t:0,KA=(e,t,n=15,r=40)=>{const s=mE(e.x,r,t.width-r)*n,o=mE(e.y,r,t.height-r)*n;return[s,o]},hd=(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)}),Uy=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),md=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Qa=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=nv(e)?e.internals.positionAbsolute:hu(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0}},Ff=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=nv(e)?e.internals.positionAbsolute:hu(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0)}},WA=(e,t)=>md(hd(Uy(e),Uy(t))),eu=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},pE=e=>rr(e.width)&&rr(e.height)&&rr(e.x)&&rr(e.y),rr=e=>!isNaN(e)&&isFinite(e),S$=(e,t)=>{},pd=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),pu=({x:e,y:t},[n,r,s],o=!1,l=[1,1])=>{const u={x:(e-n)/s,y:(t-r)/s};return o?pd(u,l):u},$f=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Sa(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(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function E$(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Sa(e,n),s=Sa(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Sa(e.top??e.y??0,n),s=Sa(e.bottom??e.y??0,n),o=Sa(e.left??e.x??0,t),l=Sa(e.right??e.x??0,t);return{top:r,right:l,bottom:s,left:o,x:o+l,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function k$(e,t,n,r,s,o){const{x:l,y:u}=$f(e,[t,n,r]),{x:f,y:d}=$f({x:e.x+e.width,y:e.y+e.height},[t,n,r]),h=s-f,p=o-d;return{left:Math.floor(l),top:Math.floor(u),right:Math.floor(h),bottom:Math.floor(p)}}const rv=(e,t,n,r,s,o)=>{const l=E$(o,t,n),u=(t-l.x)/e.width,f=(n-l.y)/e.height,d=Math.min(u,f),h=Xa(d,r,s),p=e.x+e.width/2,g=e.y+e.height/2,v=t/2-p*h,b=n/2-g*h,w=k$(e,v,b,h,t,n),_={left:Math.min(w.left-l.left,0),top:Math.min(w.top-l.top,0),right:Math.min(w.right-l.right,0),bottom:Math.min(w.bottom-l.bottom,0)};return{x:v-_.left+_.right,y:b-_.top+_.bottom,zoom:h}},qf=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ka(e){return e!==void 0&&e!=="parent"}function Jr(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 JA(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 eN(e,t={width:0,height:0},n,r,s){const o={...e},l=r.get(n);if(l){const u=l.origin||s;o.x+=l.internals.positionAbsolute.x-(t.width??0)*u[0],o.y+=l.internals.positionAbsolute.y-(t.height??0)*u[1]}return o}function gE(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function T$(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function Rl(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:o,y:l}=Yr(e),u=pu({x:o-((s==null?void 0:s.left)??0),y:l-((s==null?void 0:s.top)??0)},r),{x:f,y:d}=n?pd(u,t):u;return{xSnapped:f,ySnapped:d,...u}}const iv=e=>({width:e.offsetWidth,height:e.offsetHeight}),tN=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},C$=["INPUT","SELECT","TEXTAREA"];function nN(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:C$.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const rN=e=>"clientX"in e,Yr=(e,t)=>{var o,l;const n=rN(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,s=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},yE=(e,t,n,r,s)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:s,position:l.getAttribute("data-handlepos"),x:(u.left-n.left)/r,y:(u.top-n.top)/r,...iv(l)}})};function iN({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:o,targetControlX:l,targetControlY:u}){const f=e*.125+s*.375+l*.375+n*.125,d=t*.125+o*.375+u*.375+r*.125,h=Math.abs(f-e),p=Math.abs(d-t);return[f,d,h,p]}function tf(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vE({pos:e,x1:t,y1:n,x2:r,y2:s,c:o}){switch(e){case Ae.Left:return[t-tf(t-r,o),n];case Ae.Right:return[t+tf(r-t,o),n];case Ae.Top:return[t,n-tf(n-s,o)];case Ae.Bottom:return[t,n+tf(s-n,o)]}}function sN({sourceX:e,sourceY:t,sourcePosition:n=Ae.Bottom,targetX:r,targetY:s,targetPosition:o=Ae.Top,curvature:l=.25}){const[u,f]=vE({pos:n,x1:e,y1:t,x2:r,y2:s,c:l}),[d,h]=vE({pos:o,x1:r,y1:s,x2:e,y2:t,c:l}),[p,g,v,b]=iN({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:u,sourceControlY:f,targetControlX:d,targetControlY:h});return[`M${e},${t} C${u},${f} ${d},${h} ${r},${s}`,p,g,v,b]}function aN({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,o=n<e?n+s:n-s,l=Math.abs(r-t)/2,u=r<t?r+l:r-l;return[o,u,s,l]}function A$({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1}){if(!s)return r;const o=n||t.selected||e.selected,l=Math.max(e.internals.z||0,t.internals.z||0,1e3);return r+(o?l:0)}function N$({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const o=hd(Ff(e),Ff(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const l={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return eu(l,md(o))>0}const M$=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,O$=(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)),R$=(e,t)=>{if(!e.source||!e.target)return t;let n;return YA(e)?n={...e}:n={...e,id:M$(e)},O$(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function oN({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,o,l,u]=aN({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,o,l,u]}const xE={[Ae.Left]:{x:-1,y:0},[Ae.Right]:{x:1,y:0},[Ae.Top]:{x:0,y:-1},[Ae.Bottom]:{x:0,y:1}},D$=({source:e,sourcePosition:t=Ae.Bottom,target:n})=>t===Ae.Left||t===Ae.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},bE=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function j$({source:e,sourcePosition:t=Ae.Bottom,target:n,targetPosition:r=Ae.Top,center:s,offset:o}){const l=xE[t],u=xE[r],f={x:e.x+l.x*o,y:e.y+l.y*o},d={x:n.x+u.x*o,y:n.y+u.y*o},h=D$({source:f,sourcePosition:t,target:d}),p=h.x!==0?"x":"y",g=h[p];let v=[],b,w;const _={x:0,y:0},E={x:0,y:0},[T,S,M,D]=aN({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[p]*u[p]===-1){b=s.x??T,w=s.y??S;const B=[{x:b,y:f.y},{x:b,y:d.y}],z=[{x:f.x,y:w},{x:d.x,y:w}];l[p]===g?v=p==="x"?B:z:v=p==="x"?z:B}else{const B=[{x:f.x,y:d.y}],z=[{x:d.x,y:f.y}];if(p==="x"?v=l.x===g?z:B:v=l.y===g?B:z,t===r){const Q=Math.abs(e[p]-n[p]);if(Q<=o){const j=Math.min(o-1,o-Q);l[p]===g?_[p]=(f[p]>e[p]?-1:1)*j:E[p]=(d[p]>n[p]?-1:1)*j}}if(t!==r){const Q=p==="x"?"y":"x",j=l[p]===u[Q],$=f[Q]>d[Q],I=f[Q]<d[Q];(l[p]===1&&(!j&&$||j&&I)||l[p]!==1&&(!j&&I||j&&$))&&(v=p==="x"?B:z)}const U={x:f.x+_.x,y:f.y+_.y},O={x:d.x+E.x,y:d.y+E.y},V=Math.max(Math.abs(U.x-v[0].x),Math.abs(O.x-v[0].x)),H=Math.max(Math.abs(U.y-v[0].y),Math.abs(O.y-v[0].y));V>=H?(b=(U.x+O.x)/2,w=v[0].y):(b=v[0].x,w=(U.y+O.y)/2)}return[[e,{x:f.x+_.x,y:f.y+_.y},...v,{x:d.x+E.x,y:d.y+E.y},n],b,w,M,D]}function z$(e,t,n,r){const s=Math.min(bE(e,t)/2,bE(t,n)/2,r),{x:o,y:l}=t;if(e.x===o&&o===n.x||e.y===l&&l===n.y)return`L${o} ${l}`;if(e.y===l){const d=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${o+s*d},${l}Q ${o},${l} ${o},${l+s*h}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${o},${l+s*f}Q ${o},${l} ${o+s*u},${l}`}function Hy({sourceX:e,sourceY:t,sourcePosition:n=Ae.Bottom,targetX:r,targetY:s,targetPosition:o=Ae.Top,borderRadius:l=5,centerX:u,centerY:f,offset:d=20}){const[h,p,g,v,b]=j$({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:o,center:{x:u,y:f},offset:d});return[h.reduce((_,E,T)=>{let S="";return T>0&&T<h.length-1?S=z$(h[T-1],E,h[T+1],l):S=`${T===0?"M":"L"}${E.x} ${E.y}`,_+=S,_},""),p,g,v,b]}function wE(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function L$(e){var p;const{sourceNode:t,targetNode:n}=e;if(!wE(t)||!wE(n))return null;const r=t.internals.handleBounds||_E(t.handles),s=n.internals.handleBounds||_E(n.handles),o=SE((r==null?void 0:r.source)??[],e.sourceHandle),l=SE(e.connectionMode===Za.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!o||!l)return(p=e.onError)==null||p.call(e,"008",_r.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const u=(o==null?void 0:o.position)||Ae.Bottom,f=(l==null?void 0:l.position)||Ae.Top,d=tu(t,o,u),h=tu(n,l,f);return{sourceX:d.x,sourceY:d.y,targetX:h.x,targetY:h.y,sourcePosition:u,targetPosition:f}}function _E(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function tu(e,t,n=Ae.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,o=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:l,height:u}=t??Jr(e);if(r)return{x:s+l/2,y:o+u/2};switch((t==null?void 0:t.position)??n){case Ae.Top:return{x:s+l/2,y:o};case Ae.Right:return{x:s+l,y:o+u/2};case Ae.Bottom:return{x:s+l/2,y:o+u};case Ae.Left:return{x:s,y:o+u/2}}}function SE(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Fy(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function P$(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const o=new Set;return e.reduce((l,u)=>([u.markerStart||r,u.markerEnd||s].forEach(f=>{if(f&&typeof f=="object"){const d=Fy(f,t);o.has(d)||(l.push({id:d,color:f.color||n,...f}),o.add(d))}}),l),[]).sort((l,u)=>l.id.localeCompare(u.id))}const sv={nodeOrigin:[0,0],nodeExtent:Wl,elevateNodesOnSelect:!0,defaults:{}},I$={...sv,checkEquality:!0};function av(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function V$(e,t,n){const r=av(sv,n);for(const s of e.values())if(s.parentId)ov(s,e,t,r);else{const o=hu(s,r.nodeOrigin),l=Ka(s.extent)?s.extent:r.nodeExtent,u=Rs(o,l,Jr(s));s.internals.positionAbsolute=u}}function $y(e,t,n,r){var f,d;const s=av(I$,r);let o=e.length>0;const l=new Map(t),u=s!=null&&s.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const h of e){let p=l.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const g=hu(h,s.nodeOrigin),v=Ka(h.extent)?h.extent:s.nodeExtent,b=Rs(g,v,Jr(h));p={...s.defaults,...h,measured:{width:(f=h.measured)==null?void 0:f.width,height:(d=h.measured)==null?void 0:d.height},internals:{positionAbsolute:b,handleBounds:h.measured?p==null?void 0:p.internals.handleBounds:void 0,z:lN(h,u),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(o=!1),h.parentId&&ov(p,t,n,r)}return o}function B$(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 ov(e,t,n,r){const{elevateNodesOnSelect:s,nodeOrigin:o,nodeExtent:l}=av(sv,r),u=e.parentId,f=t.get(u);if(!f){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}B$(e,n);const d=s?1e3:0,{x:h,y:p,z:g}=U$(e,f,o,l,d),{positionAbsolute:v}=e.internals,b=h!==v.x||p!==v.y;(b||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:h,y:p}:v,z:g}})}function lN(e,t){return(rr(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function U$(e,t,n,r,s){const{x:o,y:l}=t.internals.positionAbsolute,u=Jr(e),f=hu(e,n),d=Ka(e.extent)?Rs(f,e.extent,u):f;let h=Rs({x:o+d.x,y:l+d.y},r,u);e.extent==="parent"&&(h=QA(h,u,t));const p=lN(e,s),g=t.internals.z??0;return{x:h.x,y:h.y,z:g>p?g:p}}function lv(e,t,n,r=[0,0]){var l;const s=[],o=new Map;for(const u of e){const f=t.get(u.parentId);if(!f)continue;const d=((l=o.get(u.parentId))==null?void 0:l.expandedRect)??Qa(f),h=WA(d,u.rect);o.set(u.parentId,{expandedRect:h,parent:f})}return o.size>0&&o.forEach(({expandedRect:u,parent:f},d)=>{var S;const h=f.internals.positionAbsolute,p=Jr(f),g=f.origin??r,v=u.x<h.x?Math.round(Math.abs(h.x-u.x)):0,b=u.y<h.y?Math.round(Math.abs(h.y-u.y)):0,w=Math.max(p.width,Math.round(u.width)),_=Math.max(p.height,Math.round(u.height)),E=(w-p.width)*g[0],T=(_-p.height)*g[1];(v>0||b>0||E||T)&&(s.push({id:d,type:"position",position:{x:f.position.x-v+E,y:f.position.y-b+T}}),(S=n.get(d))==null||S.forEach(M=>{e.some(D=>D.id===M.id)||s.push({id:M.id,type:"position",position:{x:M.position.x+v,y:M.position.y+b}})})),(p.width<u.width||p.height<u.height||v||b)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:w+(v?g[0]*v-E:0),height:_+(b?g[1]*b-T:0)}})}),s}function H$(e,t,n,r,s,o){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let u=!1;if(!l)return{changes:[],updatedInternals:u};const f=[],d=window.getComputedStyle(l),{m22:h}=new window.DOMMatrixReadOnly(d.transform),p=[];for(const g of e.values()){const v=t.get(g.id);if(!v)continue;if(v.hidden){t.set(v.id,{...v,internals:{...v.internals,handleBounds:void 0}}),u=!0;continue}const b=iv(g.nodeElement),w=v.measured.width!==b.width||v.measured.height!==b.height;if(!!(b.width&&b.height&&(w||!v.internals.handleBounds||g.force))){const E=g.nodeElement.getBoundingClientRect(),T=Ka(v.extent)?v.extent:o;let{positionAbsolute:S}=v.internals;v.parentId&&v.extent==="parent"?S=QA(S,b,t.get(v.parentId)):T&&(S=Rs(S,T,b));const M={...v,measured:b,internals:{...v.internals,positionAbsolute:S,handleBounds:{source:yE("source",g.nodeElement,E,h,v.id),target:yE("target",g.nodeElement,E,h,v.id)}}};t.set(v.id,M),v.parentId&&ov(M,t,n,{nodeOrigin:s}),u=!0,w&&(f.push({id:v.id,type:"dimensions",dimensions:b}),v.expandParent&&v.parentId&&p.push({id:v.id,parentId:v.parentId,rect:Qa(M,s)}))}}if(p.length>0){const g=lv(p,t,n,s);f.push(...g)}return{changes:f,updatedInternals:u}}async function F$({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:o}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const l=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,o]],r),u=!!l&&(l.x!==n[0]||l.y!==n[1]||l.k!==n[2]);return Promise.resolve(u)}function EE(e,t,n,r,s,o){let l=s;const u=r.get(l)||new Map;r.set(l,u.set(n,t)),l=`${s}-${e}`;const f=r.get(l)||new Map;if(r.set(l,f.set(n,t)),o){l=`${s}-${e}-${o}`;const d=r.get(l)||new Map;r.set(l,d.set(n,t))}}function uN(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:o,sourceHandle:l=null,targetHandle:u=null}=r,f={edgeId:r.id,source:s,target:o,sourceHandle:l,targetHandle:u},d=`${s}-${l}--${o}-${u}`,h=`${o}-${u}--${s}-${l}`;EE("source",f,h,e,s,l),EE("target",f,d,e,o,u),t.set(r.id,r)}}function cN(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:cN(n,t):!1}function kE(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function $$(e,t,n,r){const s=new Map;for(const[o,l]of e)if((l.selected||l.id===r)&&(!l.parentId||!cN(l,e))&&(l.draggable||t&&typeof l.draggable>"u")){const u=e.get(o);u&&s.set(o,{id:o,position:u.position||{x:0,y:0},distance:{x:n.x-u.internals.positionAbsolute.x,y:n.y-u.internals.positionAbsolute.y},extent:u.extent,parentId:u.parentId,origin:u.origin,expandParent:u.expandParent,internals:{positionAbsolute:u.internals.positionAbsolute||{x:0,y:0}},measured:{width:u.measured.width??0,height:u.measured.height??0}})}return s}function Pp({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var l,u,f;const s=[];for(const[d,h]of t){const p=(l=n.get(d))==null?void 0:l.internals.userNode;p&&s.push({...p,position:h.position,dragging:r})}if(!e)return[s[0],s];const o=(u=n.get(e))==null?void 0:u.internals.userNode;return[o?{...o,position:((f=t.get(e))==null?void 0:f.position)||o.position,dragging:r}:s[0],s]}function q$({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let o={x:null,y:null},l=0,u=new Map,f=!1,d={x:0,y:0},h=null,p=!1,g=null,v=!1;function b({noDragClassName:_,handleSelector:E,domNode:T,isSelectable:S,nodeId:M,nodeClickDistance:D=0}){g=Cn(T);function R({x:O,y:V},H){const{nodeLookup:Q,nodeExtent:j,snapGrid:$,snapToGrid:I,nodeOrigin:P,onNodeDrag:Y,onSelectionDrag:Z,onError:k,updateNodePositions:G}=t();o={x:O,y:V};let te=!1,C={x:0,y:0,x2:0,y2:0};if(u.size>1&&j){const F=mu(u);C=Uy(F)}for(const[F,W]of u){if(!Q.has(F))continue;let J={x:O-W.distance.x,y:V-W.distance.y};I&&(J=pd(J,$));let oe=[[j[0][0],j[0][1]],[j[1][0],j[1][1]]];if(u.size>1&&j&&!W.extent){const{positionAbsolute:ke}=W.internals,_e=ke.x-C.x+j[0][0],ye=ke.x+W.measured.width-C.x2+j[1][0],je=ke.y-C.y+j[0][1],ze=ke.y+W.measured.height-C.y2+j[1][1];oe=[[_e,je],[ye,ze]]}const{position:ce,positionAbsolute:ge}=XA({nodeId:F,nextPosition:J,nodeLookup:Q,nodeExtent:oe,nodeOrigin:P,onError:k});te=te||W.position.x!==ce.x||W.position.y!==ce.y,W.position=ce,W.internals.positionAbsolute=ge}if(te&&(G(u,!0),H&&(r||Y||!M&&Z))){const[F,W]=Pp({nodeId:M,dragItems:u,nodeLookup:Q});r==null||r(H,u,F,W),Y==null||Y(H,F,W),M||Z==null||Z(H,W)}}async function B(){if(!h)return;const{transform:O,panBy:V,autoPanSpeed:H,autoPanOnNodeDrag:Q}=t();if(!Q){f=!1,cancelAnimationFrame(l);return}const[j,$]=KA(d,h,H);(j!==0||$!==0)&&(o.x=(o.x??0)-j/O[2],o.y=(o.y??0)-$/O[2],await V({x:j,y:$})&&R(o,null)),l=requestAnimationFrame(B)}function z(O){var te;const{nodeLookup:V,multiSelectionActive:H,nodesDraggable:Q,transform:j,snapGrid:$,snapToGrid:I,selectNodesOnDrag:P,onNodeDragStart:Y,onSelectionDragStart:Z,unselectNodesAndEdges:k}=t();p=!0,(!P||!S)&&!H&&M&&((te=V.get(M))!=null&&te.selected||k()),S&&P&&M&&(e==null||e(M));const G=Rl(O.sourceEvent,{transform:j,snapGrid:$,snapToGrid:I,containerBounds:h});if(o=G,u=$$(V,Q,G,M),u.size>0&&(n||Y||!M&&Z)){const[C,F]=Pp({nodeId:M,dragItems:u,nodeLookup:V});n==null||n(O.sourceEvent,u,C,F),Y==null||Y(O.sourceEvent,C,F),M||Z==null||Z(O.sourceEvent,F)}}const U=AA().clickDistance(D).on("start",O=>{const{domNode:V,nodeDragThreshold:H,transform:Q,snapGrid:j,snapToGrid:$}=t();h=(V==null?void 0:V.getBoundingClientRect())||null,v=!1,H===0&&z(O),o=Rl(O.sourceEvent,{transform:Q,snapGrid:j,snapToGrid:$,containerBounds:h}),d=Yr(O.sourceEvent,h)}).on("drag",O=>{const{autoPanOnNodeDrag:V,transform:H,snapGrid:Q,snapToGrid:j,nodeDragThreshold:$,nodeLookup:I}=t(),P=Rl(O.sourceEvent,{transform:H,snapGrid:Q,snapToGrid:j,containerBounds:h});if((O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1||M&&!I.has(M))&&(v=!0),!v){if(!f&&V&&p&&(f=!0,B()),!p){const Y=P.xSnapped-(o.x??0),Z=P.ySnapped-(o.y??0);Math.sqrt(Y*Y+Z*Z)>$&&z(O)}(o.x!==P.xSnapped||o.y!==P.ySnapped)&&u&&p&&(d=Yr(O.sourceEvent,h),R(P,O.sourceEvent))}}).on("end",O=>{if(!(!p||v)&&(f=!1,p=!1,cancelAnimationFrame(l),u.size>0)){const{nodeLookup:V,updateNodePositions:H,onNodeDragStop:Q,onSelectionDragStop:j}=t();if(H(u,!1),s||Q||!M&&j){const[$,I]=Pp({nodeId:M,dragItems:u,nodeLookup:V,dragging:!1});s==null||s(O.sourceEvent,u,$,I),Q==null||Q(O.sourceEvent,$,I),M||j==null||j(O.sourceEvent,I)}}}).filter(O=>{const V=O.target;return!O.button&&(!_||!kE(V,`.${_}`,T))&&(!E||kE(V,E,T))});g.call(U)}function w(){g==null||g.on(".drag",null)}return{update:b,destroy:w}}function G$(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())eu(s,Qa(o))>0&&r.push(o);return r}const Y$=250;function Z$(e,t,n,r){var u,f;let s=[],o=1/0;const l=G$(e,n,t+Y$);for(const d of l){const h=[...((u=d.internals.handleBounds)==null?void 0:u.source)??[],...((f=d.internals.handleBounds)==null?void 0:f.target)??[]];for(const p of h){if(r.nodeId===p.nodeId&&r.type===p.type&&r.id===p.id)continue;const{x:g,y:v}=tu(d,p,p.position,!0),b=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(v-e.y,2));b>t||(b<o?(s=[{...p,x:g,y:v}],o=b):b===o&&s.push({...p,x:g,y:v}))}}if(!s.length)return null;if(s.length>1){const d=r.type==="source"?"target":"source";return s.find(h=>h.type===d)??s[0]}return s[0]}function fN(e,t,n,r,s,o=!1){var d,h,p;const l=r.get(e);if(!l)return null;const u=s==="strict"?(d=l.internals.handleBounds)==null?void 0:d[t]:[...((h=l.internals.handleBounds)==null?void 0:h.source)??[],...((p=l.internals.handleBounds)==null?void 0:p.target)??[]],f=(n?u==null?void 0:u.find(g=>g.id===n):u==null?void 0:u[0])??null;return f&&o?{...f,...tu(l,f,f.position,!0)}:f}function dN(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function X$(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const hN=()=>!0;function Q$(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:o,isTarget:l,domNode:u,nodeLookup:f,lib:d,autoPanOnConnect:h,flowId:p,panBy:g,cancelConnection:v,onConnectStart:b,onConnect:w,onConnectEnd:_,isValidConnection:E=hN,onReconnectEnd:T,updateConnection:S,getTransform:M,getFromHandle:D,autoPanSpeed:R}){const B=tN(e.target);let z=0,U;const{x:O,y:V}=Yr(e),H=B==null?void 0:B.elementFromPoint(O,V),Q=dN(o,H),j=u==null?void 0:u.getBoundingClientRect();if(!j||!Q)return;const $=fN(s,Q,r,f,t);if(!$)return;let I=Yr(e,j),P=!1,Y=null,Z=!1,k=null;function G(){if(!h||!j)return;const[ge,ke]=KA(I,j,R);g({x:ge,y:ke}),z=requestAnimationFrame(G)}const te={...$,nodeId:s,type:Q,position:$.position},C=f.get(s),W={inProgress:!0,isValid:null,from:tu(C,te,Ae.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:C,to:I,toHandle:null,toPosition:hE[te.position],toNode:null};S(W);let J=W;b==null||b(e,{nodeId:s,handleId:r,handleType:Q});function oe(ge){if(!D()||!te){ce(ge);return}const ke=M();I=Yr(ge,j),U=Z$(pu(I,ke,!1,[1,1]),n,f,te),P||(G(),P=!0);const _e=mN(ge,{handle:U,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:l?"target":"source",isValidConnection:E,doc:B,lib:d,flowId:p,nodeLookup:f});k=_e.handleDomNode,Y=_e.connection,Z=X$(!!U,_e.isValid);const ye={...J,isValid:Z,to:_e.toHandle&&Z?$f({x:_e.toHandle.x,y:_e.toHandle.y},ke):I,toHandle:_e.toHandle,toPosition:Z&&_e.toHandle?_e.toHandle.position:hE[te.position],toNode:_e.toHandle?f.get(_e.toHandle.nodeId):null};Z&&U&&J.toHandle&&ye.toHandle&&J.toHandle.type===ye.toHandle.type&&J.toHandle.nodeId===ye.toHandle.nodeId&&J.toHandle.id===ye.toHandle.id&&J.to.x===ye.to.x&&J.to.y===ye.to.y||(S(ye),J=ye)}function ce(ge){(U||k)&&Y&&Z&&(w==null||w(Y));const{inProgress:ke,..._e}=J,ye={..._e,toPosition:J.toHandle?J.toPosition:null};_==null||_(ge,ye),o&&(T==null||T(ge,ye)),v(),cancelAnimationFrame(z),P=!1,Z=!1,Y=null,k=null,B.removeEventListener("mousemove",oe),B.removeEventListener("mouseup",ce),B.removeEventListener("touchmove",oe),B.removeEventListener("touchend",ce)}B.addEventListener("mousemove",oe),B.addEventListener("mouseup",ce),B.addEventListener("touchmove",oe),B.addEventListener("touchend",ce)}function mN(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:o,doc:l,lib:u,flowId:f,isValidConnection:d=hN,nodeLookup:h}){const p=o==="target",g=t?l.querySelector(`.${u}-flow__handle[data-id="${f}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:v,y:b}=Yr(e),w=l.elementFromPoint(v,b),_=w!=null&&w.classList.contains(`${u}-flow__handle`)?w:g,E={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const T=dN(void 0,_),S=_.getAttribute("data-nodeid"),M=_.getAttribute("data-handleid"),D=_.classList.contains("connectable"),R=_.classList.contains("connectableend");if(!S||!T)return E;const B={source:p?S:r,sourceHandle:p?M:s,target:p?r:S,targetHandle:p?s:M};E.connection=B;const U=D&&R&&(n===Za.Strict?p&&T==="source"||!p&&T==="target":S!==r||M!==s);E.isValid=U&&d(B),E.toHandle=fN(S,T,M,h,n,!0)}return E}const qy={onPointerDown:Q$,isValid:mN};function K$({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Cn(e);function o({translateExtent:u,width:f,height:d,zoomStep:h=10,pannable:p=!0,zoomable:g=!0,inversePan:v=!1}){const b=S=>{const M=n();if(S.sourceEvent.type!=="wheel"||!t)return;const D=-S.sourceEvent.deltaY*(S.sourceEvent.deltaMode===1?.05:S.sourceEvent.deltaMode?1:.002)*h,R=M[2]*Math.pow(2,D);t.scaleTo(R)};let w=[0,0];const _=S=>{(S.sourceEvent.type==="mousedown"||S.sourceEvent.type==="touchstart")&&(w=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY])},E=S=>{const M=n();if(S.sourceEvent.type!=="mousemove"&&S.sourceEvent.type!=="touchmove"||!t)return;const D=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY],R=[D[0]-w[0],D[1]-w[1]];w=D;const B=r()*Math.max(M[2],Math.log(M[2]))*(v?-1:1),z={x:M[0]-R[0]*B,y:M[1]-R[1]*B},U=[[0,0],[f,d]];t.setViewportConstrained({x:z.x,y:z.y,zoom:M[2]},U,u)},T=FA().on("start",_).on("zoom",p?E:null).on("zoom.wheel",g?b:null);s.call(T,{})}function l(){s.on("zoom",null)}return{update:o,destroy:l,pointer:tr}}const W$=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,gd=e=>({x:e.x,y:e.y,zoom:e.k}),Ip=({x:e,y:t,zoom:n})=>dd.translate(e,t).scale(n),Ra=(e,t)=>e.target.closest(`.${t}`),pN=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Vp=(e,t=0,n=()=>{})=>{const r=typeof t=="number"&&t>0;return r||n(),r?e.transition().duration(t).on("end",n):e},gN=e=>{const t=e.ctrlKey&&qf()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function J$({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:o,zoomOnPinch:l,onPanZoomStart:u,onPanZoom:f,onPanZoomEnd:d}){return h=>{if(Ra(h,t))return!1;h.preventDefault(),h.stopImmediatePropagation();const p=n.property("__zoom").k||1;if(h.ctrlKey&&l){const _=tr(h),E=gN(h),T=p*Math.pow(2,E);r.scaleTo(n,T,_,h);return}const g=h.deltaMode===1?20:1;let v=s===As.Vertical?0:h.deltaX*g,b=s===As.Horizontal?0:h.deltaY*g;!qf()&&h.shiftKey&&s!==As.Vertical&&(v=h.deltaY*g,b=0),r.translateBy(n,-(v/p)*o,-(b/p)*o,{internal:!0});const w=gd(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,u==null||u(h,w)),e.isPanScrolling&&(f==null||f(h,w),e.panScrollTimeout=setTimeout(()=>{d==null||d(h,w),e.isPanScrolling=!1},150))}}function eq({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const o=r.type==="wheel",l=!t&&o&&!r.ctrlKey,u=Ra(r,e);if(r.ctrlKey&&o&&u&&r.preventDefault(),l||u)return null;r.preventDefault(),n.call(this,r,s)}}function tq({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var o,l,u;if((o=r.sourceEvent)!=null&&o.internal)return;const s=gd(r.transform);e.mouseButton=((l=r.sourceEvent)==null?void 0:l.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((u=r.sourceEvent)==null?void 0:u.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function nq({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return o=>{var l,u;e.usedRightMouseButton=!!(n&&pN(t,e.mouseButton??0)),(l=o.sourceEvent)!=null&&l.sync||r([o.transform.x,o.transform.y,o.transform.k]),s&&!((u=o.sourceEvent)!=null&&u.internal)&&(s==null||s(o.sourceEvent,gd(o.transform)))}}function rq({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:o}){return l=>{var u;if(!((u=l.sourceEvent)!=null&&u.internal)&&(e.isZoomingOrPanning=!1,o&&pN(t,e.mouseButton??0)&&!e.usedRightMouseButton&&l.sourceEvent&&o(l.sourceEvent),e.usedRightMouseButton=!1,r(!1),s&&W$(e.prevViewport,l.transform))){const f=gd(l.transform);e.prevViewport=f,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(l.sourceEvent,f)},n?150:0)}}}function iq({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:o,userSelectionActive:l,noWheelClassName:u,noPanClassName:f,lib:d}){return h=>{var b;const p=e||t,g=n&&h.ctrlKey;if(h.button===1&&h.type==="mousedown"&&(Ra(h,`${d}-flow__node`)||Ra(h,`${d}-flow__edge`)))return!0;if(!r&&!p&&!s&&!o&&!n||l||Ra(h,u)&&h.type==="wheel"||Ra(h,f)&&(h.type!=="wheel"||s&&h.type==="wheel"&&!e)||!n&&h.ctrlKey&&h.type==="wheel")return!1;if(!n&&h.type==="touchstart"&&((b=h.touches)==null?void 0:b.length)>1)return h.preventDefault(),!1;if(!p&&!s&&!g&&h.type==="wheel"||!r&&(h.type==="mousedown"||h.type==="touchstart")||Array.isArray(r)&&!r.includes(h.button)&&h.type==="mousedown")return!1;const v=Array.isArray(r)&&r.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||h.type==="wheel")&&v}}function sq({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:s,viewport:o,onPanZoom:l,onPanZoomStart:u,onPanZoomEnd:f,onDraggingChange:d}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),g=FA().clickDistance(!rr(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(s),v=Cn(e).call(g);S({x:o.x,y:o.y,zoom:Xa(o.zoom,t,n)},[[0,0],[p.width,p.height]],s);const b=v.on("wheel.zoom"),w=v.on("dblclick.zoom");g.wheelDelta(gN);function _(H,Q){return v?new Promise(j=>{g==null||g.transform(Vp(v,Q==null?void 0:Q.duration,()=>j(!0)),H)}):Promise.resolve(!1)}function E({noWheelClassName:H,noPanClassName:Q,onPaneContextMenu:j,userSelectionActive:$,panOnScroll:I,panOnDrag:P,panOnScrollMode:Y,panOnScrollSpeed:Z,preventScrolling:k,zoomOnPinch:G,zoomOnScroll:te,zoomOnDoubleClick:C,zoomActivationKeyPressed:F,lib:W,onTransformChange:J}){$&&!h.isZoomingOrPanning&&T();const ce=I&&!F&&!$?J$({zoomPanValues:h,noWheelClassName:H,d3Selection:v,d3Zoom:g,panOnScrollMode:Y,panOnScrollSpeed:Z,zoomOnPinch:G,onPanZoomStart:u,onPanZoom:l,onPanZoomEnd:f}):eq({noWheelClassName:H,preventScrolling:k,d3ZoomHandler:b});if(v.on("wheel.zoom",ce,{passive:!1}),!$){const ke=tq({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:u});g.on("start",ke);const _e=nq({zoomPanValues:h,panOnDrag:P,onPaneContextMenu:!!j,onPanZoom:l,onTransformChange:J});g.on("zoom",_e);const ye=rq({zoomPanValues:h,panOnDrag:P,panOnScroll:I,onPaneContextMenu:j,onPanZoomEnd:f,onDraggingChange:d});g.on("end",ye)}const ge=iq({zoomActivationKeyPressed:F,panOnDrag:P,zoomOnScroll:te,panOnScroll:I,zoomOnDoubleClick:C,zoomOnPinch:G,userSelectionActive:$,noPanClassName:Q,noWheelClassName:H,lib:W});g.filter(ge),C?v.on("dblclick.zoom",w):v.on("dblclick.zoom",null)}function T(){g.on("zoom",null)}async function S(H,Q,j){const $=Ip(H),I=g==null?void 0:g.constrain()($,Q,j);return I&&await _(I),new Promise(P=>P(I))}async function M(H,Q){const j=Ip(H);return await _(j,Q),new Promise($=>$(j))}function D(H){if(v){const Q=Ip(H),j=v.property("__zoom");(j.k!==H.zoom||j.x!==H.x||j.y!==H.y)&&(g==null||g.transform(v,Q,null,{sync:!0}))}}function R(){const H=v?HA(v.node()):{x:0,y:0,k:1};return{x:H.x,y:H.y,zoom:H.k}}function B(H,Q){return v?new Promise(j=>{g==null||g.scaleTo(Vp(v,Q==null?void 0:Q.duration,()=>j(!0)),H)}):Promise.resolve(!1)}function z(H,Q){return v?new Promise(j=>{g==null||g.scaleBy(Vp(v,Q==null?void 0:Q.duration,()=>j(!0)),H)}):Promise.resolve(!1)}function U(H){g==null||g.scaleExtent(H)}function O(H){g==null||g.translateExtent(H)}function V(H){const Q=!rr(H)||H<0?0:H;g==null||g.clickDistance(Q)}return{update:E,destroy:T,setViewport:M,setViewportConstrained:S,getViewport:R,scaleTo:B,scaleBy:z,setScaleExtent:U,setTranslateExtent:O,syncViewport:D,setClickDistance:V}}var Dl;(function(e){e.Line="line",e.Handle="handle"})(Dl||(Dl={}));function aq({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:o}){const l=e-t,u=n-r,f=[l>0?1:l<0?-1:0,u>0?1:u<0?-1:0];return l&&s&&(f[0]=f[0]*-1),u&&o&&(f[1]=f[1]*-1),f}function oq(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function Mi(e,t){return Math.max(0,t-e)}function Oi(e,t){return Math.max(0,e-t)}function nf(e,t,n){return Math.max(0,t-e,e-n)}function TE(e,t){return e?!t:t}function lq(e,t,n,r,s,o,l,u){let{affectsX:f,affectsY:d}=t;const{isHorizontal:h,isVertical:p}=t,g=h&&p,{xSnapped:v,ySnapped:b}=n,{minWidth:w,maxWidth:_,minHeight:E,maxHeight:T}=r,{x:S,y:M,width:D,height:R,aspectRatio:B}=e;let z=Math.floor(h?v-e.pointerX:0),U=Math.floor(p?b-e.pointerY:0);const O=D+(f?-z:z),V=R+(d?-U:U),H=-o[0]*D,Q=-o[1]*R;let j=nf(O,w,_),$=nf(V,E,T);if(l){let Y=0,Z=0;f&&z<0?Y=Mi(S+z+H,l[0][0]):!f&&z>0&&(Y=Oi(S+O+H,l[1][0])),d&&U<0?Z=Mi(M+U+Q,l[0][1]):!d&&U>0&&(Z=Oi(M+V+Q,l[1][1])),j=Math.max(j,Y),$=Math.max($,Z)}if(u){let Y=0,Z=0;f&&z>0?Y=Oi(S+z,u[0][0]):!f&&z<0&&(Y=Mi(S+O,u[1][0])),d&&U>0?Z=Oi(M+U,u[0][1]):!d&&U<0&&(Z=Mi(M+V,u[1][1])),j=Math.max(j,Y),$=Math.max($,Z)}if(s){if(h){const Y=nf(O/B,E,T)*B;if(j=Math.max(j,Y),l){let Z=0;!f&&!d||f&&!d&&g?Z=Oi(M+Q+O/B,l[1][1])*B:Z=Mi(M+Q+(f?z:-z)/B,l[0][1])*B,j=Math.max(j,Z)}if(u){let Z=0;!f&&!d||f&&!d&&g?Z=Mi(M+O/B,u[1][1])*B:Z=Oi(M+(f?z:-z)/B,u[0][1])*B,j=Math.max(j,Z)}}if(p){const Y=nf(V*B,w,_)/B;if($=Math.max($,Y),l){let Z=0;!f&&!d||d&&!f&&g?Z=Oi(S+V*B+H,l[1][0])/B:Z=Mi(S+(d?U:-U)*B+H,l[0][0])/B,$=Math.max($,Z)}if(u){let Z=0;!f&&!d||d&&!f&&g?Z=Mi(S+V*B,u[1][0])/B:Z=Oi(S+(d?U:-U)*B,u[0][0])/B,$=Math.max($,Z)}}}U=U+(U<0?$:-$),z=z+(z<0?j:-j),s&&(g?O>V*B?U=(TE(f,d)?-z:z)/B:z=(TE(f,d)?-U:U)*B:h?(U=z/B,d=f):(z=U*B,f=d));const I=f?S+z:S,P=d?M+U:M;return{width:D+(f?-z:z),height:R+(d?-U:U),x:o[0]*z*(f?-1:1)+I,y:o[1]*U*(d?-1:1)+P}}const yN={width:0,height:0,x:0,y:0},uq={...yN,pointerX:0,pointerY:0,aspectRatio:1};function cq(e){return[[0,0],[e.measured.width,e.measured.height]]}function fq(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,o=e.measured.width??0,l=e.measured.height??0,u=n[0]*o,f=n[1]*l;return[[r-u,s-f],[r+o-u,s+l-f]]}function dq({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const o=Cn(e);function l({controlPosition:f,boundaries:d,keepAspectRatio:h,resizeDirection:p,onResizeStart:g,onResize:v,onResizeEnd:b,shouldResize:w}){let _={...yN},E={...uq};const T=oq(f);let S,M=null,D=[],R,B,z;const U=AA().on("start",O=>{const{nodeLookup:V,transform:H,snapGrid:Q,snapToGrid:j,nodeOrigin:$,paneDomNode:I}=n();if(S=V.get(t),!S)return;M=(I==null?void 0:I.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:Y}=Rl(O.sourceEvent,{transform:H,snapGrid:Q,snapToGrid:j,containerBounds:M});_={width:S.measured.width??0,height:S.measured.height??0,x:S.position.x??0,y:S.position.y??0},E={..._,pointerX:P,pointerY:Y,aspectRatio:_.width/_.height},R=void 0,S.parentId&&(S.extent==="parent"||S.expandParent)&&(R=V.get(S.parentId),B=R&&S.extent==="parent"?cq(R):void 0),D=[],z=void 0;for(const[Z,k]of V)if(k.parentId===t&&(D.push({id:Z,position:{...k.position},extent:k.extent}),k.extent==="parent"||k.expandParent)){const G=fq(k,S,k.origin??$);z?z=[[Math.min(G[0][0],z[0][0]),Math.min(G[0][1],z[0][1])],[Math.max(G[1][0],z[1][0]),Math.max(G[1][1],z[1][1])]]:z=G}g==null||g(O,{..._})}).on("drag",O=>{const{transform:V,snapGrid:H,snapToGrid:Q,nodeOrigin:j}=n(),$=Rl(O.sourceEvent,{transform:V,snapGrid:H,snapToGrid:Q,containerBounds:M}),I=[];if(!S)return;const{x:P,y:Y,width:Z,height:k}=_,G={},te=S.origin??j,{width:C,height:F,x:W,y:J}=lq(E,T,$,d,h,te,B,z),oe=C!==Z,ce=F!==k,ge=W!==P&&oe,ke=J!==Y&&ce;if(!ge&&!ke&&!oe&&!ce)return;if((ge||ke||te[0]===1||te[1]===1)&&(G.x=ge?W:_.x,G.y=ke?J:_.y,_.x=G.x,_.y=G.y,D.length>0)){const ze=W-P,ot=J-Y;for(const ft of D)ft.position={x:ft.position.x-ze+te[0]*(C-Z),y:ft.position.y-ot+te[1]*(F-k)},I.push(ft)}if((oe||ce)&&(G.width=oe&&(!p||p==="horizontal")?C:_.width,G.height=ce&&(!p||p==="vertical")?F:_.height,_.width=G.width,_.height=G.height),R&&S.expandParent){const ze=te[0]*(G.width??0);G.x&&G.x<ze&&(_.x=ze,E.x=E.x-(G.x-ze));const ot=te[1]*(G.height??0);G.y&&G.y<ot&&(_.y=ot,E.y=E.y-(G.y-ot))}const _e=aq({width:_.width,prevWidth:Z,height:_.height,prevHeight:k,affectsX:T.affectsX,affectsY:T.affectsY}),ye={..._,direction:_e};(w==null?void 0:w(O,ye))!==!1&&(v==null||v(O,ye),r(G,I))}).on("end",O=>{b==null||b(O,{..._}),s==null||s({..._})});o.call(U)}function u(){o.on(".drag",null)}return{update:l,destroy:u}}var Bp={exports:{}},Up={},Hp={exports:{}},Fp={};/**
|
|
210
|
+
* @license React
|
|
211
|
+
* use-sync-external-store-shim.production.js
|
|
212
|
+
*
|
|
213
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
214
|
+
*
|
|
215
|
+
* This source code is licensed under the MIT license found in the
|
|
216
|
+
* LICENSE file in the root directory of this source tree.
|
|
217
|
+
*/var CE;function hq(){if(CE)return Fp;CE=1;var e=ru();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,l=e.useDebugValue;function u(p,g){var v=g(),b=r({inst:{value:v,getSnapshot:g}}),w=b[0].inst,_=b[1];return o(function(){w.value=v,w.getSnapshot=g,f(w)&&_({inst:w})},[p,v,g]),s(function(){return f(w)&&_({inst:w}),p(function(){f(w)&&_({inst:w})})},[p]),l(v),v}function f(p){var g=p.getSnapshot;p=p.value;try{var v=g();return!n(p,v)}catch{return!0}}function d(p,g){return g()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:u;return Fp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Fp}var AE;function mq(){return AE||(AE=1,Hp.exports=hq()),Hp.exports}/**
|
|
218
|
+
* @license React
|
|
219
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
220
|
+
*
|
|
221
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
222
|
+
*
|
|
223
|
+
* This source code is licensed under the MIT license found in the
|
|
224
|
+
* LICENSE file in the root directory of this source tree.
|
|
225
|
+
*/var NE;function pq(){if(NE)return Up;NE=1;var e=ru(),t=mq();function n(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,l=e.useEffect,u=e.useMemo,f=e.useDebugValue;return Up.useSyncExternalStoreWithSelector=function(d,h,p,g,v){var b=o(null);if(b.current===null){var w={hasValue:!1,value:null};b.current=w}else w=b.current;b=u(function(){function E(R){if(!T){if(T=!0,S=R,R=g(R),v!==void 0&&w.hasValue){var B=w.value;if(v(B,R))return M=B}return M=R}if(B=M,r(S,R))return B;var z=g(R);return v!==void 0&&v(B,z)?(S=R,B):(S=R,M=z)}var T=!1,S,M,D=p===void 0?null:p;return[function(){return E(h())},D===null?void 0:function(){return E(D())}]},[h,p,g,v]);var _=s(d,b[0],b[1]);return l(function(){w.hasValue=!0,w.value=_},[_]),f(_),_},Up}var ME;function gq(){return ME||(ME=1,Bp.exports=pq()),Bp.exports}var yq=gq();const vq=Fi(yq),xq={},OE=e=>{let t;const n=new Set,r=(h,p)=>{const g=typeof h=="function"?h(t):h;if(!Object.is(g,t)){const v=t;t=p??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(b=>b(t,v))}},s=()=>t,f={setState:r,getState:s,getInitialState:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(xq?"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()}},d=t=e(r,s,f);return f},bq=e=>e?OE(e):OE,{useDebugValue:wq}=NR,{useSyncExternalStoreWithSelector:_q}=vq,Sq=e=>e;function vN(e,t=Sq,n){const r=_q(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return wq(r),r}const RE=(e,t)=>{const n=bq(e),r=(s,o=t)=>vN(n,s,o);return Object.assign(r,n),r},Eq=(e,t)=>e?RE(e,t):RE;function bt(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[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}Kk();const yd=X.createContext(null),kq=yd.Provider,xN=_r.error001();function Ge(e,t){const n=X.useContext(yd);if(n===null)throw new Error(xN);return vN(n,e,t)}function ht(){const e=X.useContext(yd);if(e===null)throw new Error(xN);return X.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const DE={display:"none"},Tq={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},bN="react-flow__node-desc",wN="react-flow__edge-desc",Cq="react-flow__aria-live",Aq=e=>e.ariaLiveMessage;function Nq({rfId:e}){const t=Ge(Aq);return A.jsx("div",{id:`${Cq}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Tq,children:t})}function Mq({rfId:e,disableKeyboardA11y:t}){return A.jsxs(A.Fragment,{children:[A.jsxs("div",{id:`${bN}-${e}`,style:DE,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),A.jsx("div",{id:`${wN}-${e}`,style:DE,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&A.jsx(Nq,{rfId:e})]})}const Oq=e=>e.userSelectionActive?"none":"all",gu=X.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},o)=>{const l=Ge(Oq),u=`${e}`.split("-");return A.jsx("div",{className:Rt(["react-flow__panel",n,...u]),style:{...r,pointerEvents:l},ref:o,...s,children:t})});gu.displayName="Panel";function Rq({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:A.jsx(gu,{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:A.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Dq=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},rf=e=>e.id;function jq(e,t){return bt(e.selectedNodes.map(rf),t.selectedNodes.map(rf))&&bt(e.selectedEdges.map(rf),t.selectedEdges.map(rf))}function zq({onSelectionChange:e}){const t=ht(),{selectedNodes:n,selectedEdges:r}=Ge(Dq,jq);return X.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(o=>o(s))},[n,r,e]),null}const Lq=e=>!!e.onSelectionChangeHandlers;function Pq({onSelectionChange:e}){const t=Ge(Lq);return e||t?A.jsx(zq,{onSelectionChange:e}):null}const _N=[0,0],Iq={x:0,y:0,zoom:1},Vq=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","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","onBeforeDelete","debug","autoPanSpeed","paneClickDistance"],jE=[...Vq,"rfId"],Bq=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,setPaneClickDistance:e.setPaneClickDistance}),zE={translateExtent:Wl,nodeOrigin:_N,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function Uq(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:o,setNodeExtent:l,reset:u,setDefaultNodesAndEdges:f,setPaneClickDistance:d}=Ge(Bq,bt),h=ht();X.useEffect(()=>(f(e.defaultNodes,e.defaultEdges),()=>{p.current=zE,u()}),[]);const p=X.useRef(zE);return X.useEffect(()=>{for(const g of jE){const v=e[g],b=p.current[g];v!==b&&(typeof e[g]>"u"||(g==="nodes"?t(v):g==="edges"?n(v):g==="minZoom"?r(v):g==="maxZoom"?s(v):g==="translateExtent"?o(v):g==="nodeExtent"?l(v):g==="paneClickDistance"?d(v):g==="fitView"?h.setState({fitViewQueued:v}):g==="fitViewOptions"?h.setState({fitViewOptions:v}):h.setState({[g]:v})))}p.current=e},jE.map(g=>e[g])),null}function LE(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Hq(e){var r;const[t,n]=X.useState(e==="system"?null:e);return X.useEffect(()=>{if(e!=="system"){n(e);return}const s=LE(),o=()=>n(s!=null&&s.matches?"dark":"light");return o(),s==null||s.addEventListener("change",o),()=>{s==null||s.removeEventListener("change",o)}},[e]),t!==null?t:(r=LE())!=null&&r.matches?"dark":"light"}const PE=typeof document<"u"?document:null;function nu(e=null,t={target:PE,actInsideInputWithModifier:!0}){const[n,r]=X.useState(!1),s=X.useRef(!1),o=X.useRef(new Set([])),[l,u]=X.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.replace("+",`
|
|
226
|
+
`).replace(`
|
|
227
|
+
|
|
228
|
+
`,`
|
|
229
|
+
+`).split(`
|
|
230
|
+
`)),h=d.reduce((p,g)=>p.concat(...g),[]);return[d,h]}return[[],[]]},[e]);return X.useEffect(()=>{const f=(t==null?void 0:t.target)??PE,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const h=v=>{var _,E;if(s.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!s.current||s.current&&!d)&&nN(v))return!1;const w=VE(v.code,u);if(o.current.add(v[w]),IE(l,o.current,!1)){const T=((E=(_=v.composedPath)==null?void 0:_.call(v))==null?void 0:E[0])||v.target,S=(T==null?void 0:T.nodeName)==="BUTTON"||(T==null?void 0:T.nodeName)==="A";t.preventDefault!==!1&&(s.current||!S)&&v.preventDefault(),r(!0)}},p=v=>{const b=VE(v.code,u);IE(l,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(v[b]),v.key==="Meta"&&o.current.clear(),s.current=!1},g=()=>{o.current.clear(),r(!1)};return f==null||f.addEventListener("keydown",h),f==null||f.addEventListener("keyup",p),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{f==null||f.removeEventListener("keydown",h),f==null||f.removeEventListener("keyup",p),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function IE(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function VE(e,t){return t.includes(e)?"code":"key"}const Fq=()=>{const e=ht();return X.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,o],panZoom:l}=e.getState();return l?(await l.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??o},{duration:n==null?void 0:n.duration}),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>{const{width:s,height:o,maxZoom:l,panZoom:u}=e.getState(),f=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:l,d=s/2-t*f,h=o/2-n*f;return u?(await u.setViewport({x:d,y:h,zoom:f},{duration:r==null?void 0:r.duration}),Promise.resolve(!0)):Promise.resolve(!1)},fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:o,maxZoom:l,panZoom:u}=e.getState(),f=rv(t,r,s,o,l,(n==null?void 0:n.padding)??.1);return u?(await u.setViewport(f,{duration:n==null?void 0:n.duration}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:o,domNode:l}=e.getState();if(!l)return t;const{x:u,y:f}=l.getBoundingClientRect(),d={x:t.x-u,y:t.y-f},h=n.snapGrid??s,p=n.snapToGrid??o;return pu(d,r,p,h)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:o}=r.getBoundingClientRect(),l=$f(t,n);return{x:l.x+s,y:l.y+o}}}),[])};function SN(e,t){const n=[],r=new Map,s=[];for(const o of e)if(o.type==="add"){s.push(o);continue}else if(o.type==="remove"||o.type==="replace")r.set(o.id,[o]);else{const l=r.get(o.id);l?l.push(o):r.set(o.id,[o])}for(const o of t){const l=r.get(o.id);if(!l){n.push(o);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}const u={...o};for(const f of l)$q(f,u);n.push(u)}return s.length&&s.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function $q(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??(t.measured={}),t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,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 EN(e,t){return SN(e,t)}function kN(e,t){return SN(e,t)}function gs(e,t){return{id:e,type:"select",selected:t}}function Da(e,t=new Set,n=!1){const r=[];for(const[s,o]of e){const l=t.has(s);!(o.selected===void 0&&!l)&&o.selected!==l&&(n&&(o.selected=l),r.push(gs(o.id,l)))}return r}function BE({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(o=>[o.id,o]));for(const[o,l]of e.entries()){const u=t.get(l.id),f=((s=u==null?void 0:u.internals)==null?void 0:s.userNode)??u;f!==void 0&&f!==l&&n.push({id:l.id,item:l,type:"replace"}),f===void 0&&n.push({item:l,type:"add",index:o})}for(const[o]of t)r.get(o)===void 0&&n.push({id:o,type:"remove"});return n}function UE(e){return{id:e.id,type:"remove"}}const HE=e=>y$(e),qq=e=>YA(e);function TN(e){return X.forwardRef(e)}const Gq=typeof window<"u"?X.useLayoutEffect:X.useEffect;function FE(e){const[t,n]=X.useState(BigInt(0)),[r]=X.useState(()=>Yq(()=>n(s=>s+BigInt(1))));return Gq(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function Yq(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const CN=X.createContext(null);function Zq({children:e}){const t=ht(),n=X.useCallback(u=>{const{nodes:f=[],setNodes:d,hasDefaultNodes:h,onNodesChange:p,nodeLookup:g,fitViewQueued:v}=t.getState();let b=f;for(const _ of u)b=typeof _=="function"?_(b):_;const w=BE({items:b,lookup:g});h&&d(b),w.length>0?p==null||p(w):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:E,setNodes:T}=t.getState();_&&T(E)})},[]),r=FE(n),s=X.useCallback(u=>{const{edges:f=[],setEdges:d,hasDefaultEdges:h,onEdgesChange:p,edgeLookup:g}=t.getState();let v=f;for(const b of u)v=typeof b=="function"?b(v):b;h?d(v):p&&p(BE({items:v,lookup:g}))},[]),o=FE(s),l=X.useMemo(()=>({nodeQueue:r,edgeQueue:o}),[]);return A.jsx(CN.Provider,{value:l,children:e})}function Xq(){const e=X.useContext(CN);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Qq=e=>!!e.panZoom;function vd(){const e=Fq(),t=ht(),n=Xq(),r=Ge(Qq),s=X.useMemo(()=>{const o=p=>t.getState().nodeLookup.get(p),l=p=>{n.nodeQueue.push(p)},u=p=>{n.edgeQueue.push(p)},f=p=>{var E,T;const{nodeLookup:g,nodeOrigin:v}=t.getState(),b=HE(p)?p:g.get(p.id),w=b.parentId?eN(b.position,b.measured,b.parentId,g,v):b.position,_={...b,position:w,width:((E=b.measured)==null?void 0:E.width)??b.width,height:((T=b.measured)==null?void 0:T.height)??b.height};return Qa(_)},d=(p,g,v={replace:!1})=>{l(b=>b.map(w=>{if(w.id===p){const _=typeof g=="function"?g(w):g;return v.replace&&HE(_)?_:{...w,..._}}return w}))},h=(p,g,v={replace:!1})=>{u(b=>b.map(w=>{if(w.id===p){const _=typeof g=="function"?g(w):g;return v.replace&&qq(_)?_:{...w,..._}}return w}))};return{getNodes:()=>t.getState().nodes.map(p=>({...p})),getNode:p=>{var g;return(g=o(p))==null?void 0:g.internals.userNode},getInternalNode:o,getEdges:()=>{const{edges:p=[]}=t.getState();return p.map(g=>({...g}))},getEdge:p=>t.getState().edgeLookup.get(p),setNodes:l,setEdges:u,addNodes:p=>{const g=Array.isArray(p)?p:[p];n.nodeQueue.push(v=>[...v,...g])},addEdges:p=>{const g=Array.isArray(p)?p:[p];n.edgeQueue.push(v=>[...v,...g])},toObject:()=>{const{nodes:p=[],edges:g=[],transform:v}=t.getState(),[b,w,_]=v;return{nodes:p.map(E=>({...E})),edges:g.map(E=>({...E})),viewport:{x:b,y:w,zoom:_}}},deleteElements:async({nodes:p=[],edges:g=[]})=>{const{nodes:v,edges:b,onNodesDelete:w,onEdgesDelete:_,triggerNodeChanges:E,triggerEdgeChanges:T,onDelete:S,onBeforeDelete:M}=t.getState(),{nodes:D,edges:R}=await _$({nodesToRemove:p,edgesToRemove:g,nodes:v,edges:b,onBeforeDelete:M}),B=R.length>0,z=D.length>0;if(B){const U=R.map(UE);_==null||_(R),T(U)}if(z){const U=D.map(UE);w==null||w(D),E(U)}return(z||B)&&(S==null||S({nodes:D,edges:R})),{deletedNodes:D,deletedEdges:R}},getIntersectingNodes:(p,g=!0,v)=>{const b=pE(p),w=b?p:f(p),_=v!==void 0;return w?(v||t.getState().nodes).filter(E=>{const T=t.getState().nodeLookup.get(E.id);if(T&&!b&&(E.id===p.id||!T.internals.positionAbsolute))return!1;const S=Qa(_?E:T),M=eu(S,w);return g&&M>0||M>=w.width*w.height}):[]},isNodeIntersecting:(p,g,v=!0)=>{const w=pE(p)?p:f(p);if(!w)return!1;const _=eu(w,g);return v&&_>0||_>=w.width*w.height},updateNode:d,updateNodeData:(p,g,v={replace:!1})=>{d(p,b=>{const w=typeof g=="function"?g(b):g;return v.replace?{...b,data:w}:{...b,data:{...b.data,...w}}},v)},updateEdge:h,updateEdgeData:(p,g,v={replace:!1})=>{h(p,b=>{const w=typeof g=="function"?g(b):g;return v.replace?{...b,data:w}:{...b,data:{...b.data,...w}}},v)},getNodesBounds:p=>{const{nodeLookup:g,nodeOrigin:v}=t.getState();return v$(p,{nodeLookup:g,nodeOrigin:v})},getHandleConnections:({type:p,id:g,nodeId:v})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${v}-${p}${g?`-${g}`:""}`))==null?void 0:b.values())??[])},getNodeConnections:({type:p,handleId:g,nodeId:v})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${v}${p?g?`-${p}-${g}`:`-${p}`:""}`))==null?void 0:b.values())??[])},fitView:async p=>{const g=t.getState().fitViewResolver??T$();return t.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:g}),n.nodeQueue.push(v=>[...v]),g.promise}}},[]);return X.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const $E=e=>e.selected,Kq=typeof window<"u"?window:void 0;function Wq({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ht(),{deleteElements:r}=vd(),s=nu(e,{actInsideInputWithModifier:!1}),o=nu(t,{target:Kq});X.useEffect(()=>{if(s){const{edges:l,nodes:u}=n.getState();r({nodes:u.filter($E),edges:l.filter($E)}),n.setState({nodesSelectionActive:!1})}},[s]),X.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])}function Jq(e){const t=ht();X.useEffect(()=>{const n=()=>{var s,o;if(!e.current)return!1;const r=iv(e.current);(r.height===0||r.width===0)&&((o=(s=t.getState()).onError)==null||o.call(s,"004",_r.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const xd={position:"absolute",width:"100%",height:"100%",top:0,left:0},eG=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function tG({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:o=As.Free,zoomOnDoubleClick:l=!0,panOnDrag:u=!0,defaultViewport:f,translateExtent:d,minZoom:h,maxZoom:p,zoomActivationKeyCode:g,preventScrolling:v=!0,children:b,noWheelClassName:w,noPanClassName:_,onViewportChange:E,isControlledViewport:T,paneClickDistance:S}){const M=ht(),D=X.useRef(null),{userSelectionActive:R,lib:B}=Ge(eG,bt),z=nu(g),U=X.useRef();Jq(D);const O=X.useCallback(V=>{E==null||E({x:V[0],y:V[1],zoom:V[2]}),T||M.setState({transform:V})},[E,T]);return X.useEffect(()=>{if(D.current){U.current=sq({domNode:D.current,minZoom:h,maxZoom:p,translateExtent:d,viewport:f,paneClickDistance:S,onDraggingChange:j=>M.setState({paneDragging:j}),onPanZoomStart:(j,$)=>{const{onViewportChangeStart:I,onMoveStart:P}=M.getState();P==null||P(j,$),I==null||I($)},onPanZoom:(j,$)=>{const{onViewportChange:I,onMove:P}=M.getState();P==null||P(j,$),I==null||I($)},onPanZoomEnd:(j,$)=>{const{onViewportChangeEnd:I,onMoveEnd:P}=M.getState();P==null||P(j,$),I==null||I($)}});const{x:V,y:H,zoom:Q}=U.current.getViewport();return M.setState({panZoom:U.current,transform:[V,H,Q],domNode:D.current.closest(".react-flow")}),()=>{var j;(j=U.current)==null||j.destroy()}}},[]),X.useEffect(()=>{var V;(V=U.current)==null||V.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:o,zoomOnDoubleClick:l,panOnDrag:u,zoomActivationKeyPressed:z,preventScrolling:v,noPanClassName:_,userSelectionActive:R,noWheelClassName:w,lib:B,onTransformChange:O})},[e,t,n,r,s,o,l,u,z,v,_,R,w,B,O]),A.jsx("div",{className:"react-flow__renderer",ref:D,style:xd,children:b})}const nG=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function rG(){const{userSelectionActive:e,userSelectionRect:t}=Ge(nG,bt);return e&&t?A.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 $p=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},iG=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function sG({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Jl.Full,panOnDrag:r,selectionOnDrag:s,onSelectionStart:o,onSelectionEnd:l,onPaneClick:u,onPaneContextMenu:f,onPaneScroll:d,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:g,children:v}){const b=ht(),{userSelectionActive:w,elementsSelectable:_,dragging:E,connectionInProgress:T}=Ge(iG,bt),S=_&&(e||w),M=X.useRef(null),D=X.useRef(),R=X.useRef(new Set),B=X.useRef(new Set),z=X.useRef(!1),U=X.useRef(!1),O=P=>{if(z.current||T){z.current=!1;return}u==null||u(P),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},V=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}f==null||f(P)},H=d?P=>d(P):void 0,Q=P=>{var te,C;const{resetSelectedElements:Y,domNode:Z}=b.getState();if(D.current=Z==null?void 0:Z.getBoundingClientRect(),!_||!e||P.button!==0||P.target!==M.current||!D.current)return;(C=(te=P.target)==null?void 0:te.setPointerCapture)==null||C.call(te,P.pointerId),U.current=!0,z.current=!1;const{x:k,y:G}=Yr(P.nativeEvent,D.current);Y(),b.setState({userSelectionRect:{width:0,height:0,startX:k,startY:G,x:k,y:G}}),o==null||o(P)},j=P=>{const{userSelectionRect:Y,transform:Z,nodeLookup:k,edgeLookup:G,connectionLookup:te,triggerNodeChanges:C,triggerEdgeChanges:F,defaultEdgeOptions:W}=b.getState();if(!D.current||!Y)return;z.current=!0;const{x:J,y:oe}=Yr(P.nativeEvent,D.current),{startX:ce,startY:ge}=Y,ke={startX:ce,startY:ge,x:J<ce?J:ce,y:oe<ge?oe:ge,width:Math.abs(J-ce),height:Math.abs(oe-ge)},_e=R.current,ye=B.current;R.current=new Set(ZA(k,ke,Z,n===Jl.Partial,!0).map(ze=>ze.id)),B.current=new Set;const je=(W==null?void 0:W.selectable)??!0;for(const ze of R.current){const ot=te.get(ze);if(ot)for(const{edgeId:ft}of ot.values()){const Et=G.get(ft);Et&&(Et.selectable??je)&&B.current.add(ft)}}if(!gE(_e,R.current)){const ze=Da(k,R.current,!0);C(ze)}if(!gE(ye,B.current)){const ze=Da(G,B.current);F(ze)}b.setState({userSelectionRect:ke,userSelectionActive:!0,nodesSelectionActive:!1})},$=P=>{var Z,k;if(P.button!==0||!U.current)return;(k=(Z=P.target)==null?void 0:Z.releasePointerCapture)==null||k.call(Z,P.pointerId);const{userSelectionRect:Y}=b.getState();!w&&Y&&P.target===M.current&&(O==null||O(P)),b.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:R.current.size>0}),l==null||l(P),(t||s)&&(z.current=!1),U.current=!1},I=r===!0||Array.isArray(r)&&r.includes(0);return A.jsxs("div",{className:Rt(["react-flow__pane",{draggable:I,dragging:E,selection:e}]),onClick:S?void 0:$p(O,M),onContextMenu:$p(V,M),onWheel:$p(H,M),onPointerEnter:S?void 0:h,onPointerDown:S?Q:p,onPointerMove:S?j:p,onPointerUp:S?$:void 0,onPointerLeave:g,ref:M,style:xd,children:[v,A.jsx(rG,{})]})}function Gy({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:o,multiSelectionActive:l,nodeLookup:u,onError:f}=t.getState(),d=u.get(e);if(!d){f==null||f("012",_r.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&l)&&(o({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var h;return(h=r==null?void 0:r.current)==null?void 0:h.blur()})):s([e])}function AN({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:o,nodeClickDistance:l}){const u=ht(),[f,d]=X.useState(!1),h=X.useRef();return X.useEffect(()=>{h.current=q$({getStoreItems:()=>u.getState(),onNodeMouseDown:p=>{Gy({id:p,store:u,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),X.useEffect(()=>{var p,g;if(t)(p=h.current)==null||p.destroy();else if(e.current)return(g=h.current)==null||g.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:o,nodeId:s,nodeClickDistance:l}),()=>{var v;(v=h.current)==null||v.destroy()}},[n,r,t,o,e,s]),f}const aG=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function NN(){const e=ht();return X.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:o,nodesDraggable:l,onError:u,updateNodePositions:f,nodeLookup:d,nodeOrigin:h}=e.getState(),p=new Map,g=aG(l),v=s?o[0]:5,b=s?o[1]:5,w=n.direction.x*v*n.factor,_=n.direction.y*b*n.factor;for(const[,E]of d){if(!g(E))continue;let T={x:E.internals.positionAbsolute.x+w,y:E.internals.positionAbsolute.y+_};s&&(T=pd(T,o));const{position:S,positionAbsolute:M}=XA({nodeId:E.id,nextPosition:T,nodeLookup:d,nodeExtent:r,nodeOrigin:h,onError:u});E.position=S,E.internals.positionAbsolute=M,p.set(E.id,E)}f(p)},[])}const uv=X.createContext(null),oG=uv.Provider;uv.Consumer;const MN=()=>X.useContext(uv),lG=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),uG=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:o,connection:l}=r,{fromHandle:u,toHandle:f,isValid:d}=l,h=(f==null?void 0:f.nodeId)===e&&(f==null?void 0:f.id)===t&&(f==null?void 0:f.type)===n;return{connectingFrom:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n,connectingTo:h,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:o===Za.Strict?(u==null?void 0:u.type)!==n:e!==(u==null?void 0:u.nodeId)||t!==(u==null?void 0:u.id),connectionInProcess:!!u,clickConnectionInProcess:!!s,valid:h&&d}};function cG({type:e="source",position:t=Ae.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:o=!0,id:l,onConnect:u,children:f,className:d,onMouseDown:h,onTouchStart:p,...g},v){var $,I;const b=l||null,w=e==="target",_=ht(),E=MN(),{connectOnClick:T,noPanClassName:S,rfId:M}=Ge(lG,bt),{connectingFrom:D,connectingTo:R,clickConnecting:B,isPossibleEndHandle:z,connectionInProcess:U,clickConnectionInProcess:O,valid:V}=Ge(uG(E,b,e),bt);E||(I=($=_.getState()).onError)==null||I.call($,"010",_r.error010());const H=P=>{const{defaultEdgeOptions:Y,onConnect:Z,hasDefaultEdges:k}=_.getState(),G={...Y,...P};if(k){const{edges:te,setEdges:C}=_.getState();C(R$(G,te))}Z==null||Z(G),u==null||u(G)},Q=P=>{if(!E)return;const Y=rN(P.nativeEvent);if(s&&(Y&&P.button===0||!Y)){const Z=_.getState();qy.onPointerDown(P.nativeEvent,{autoPanOnConnect:Z.autoPanOnConnect,connectionMode:Z.connectionMode,connectionRadius:Z.connectionRadius,domNode:Z.domNode,nodeLookup:Z.nodeLookup,lib:Z.lib,isTarget:w,handleId:b,nodeId:E,flowId:Z.rfId,panBy:Z.panBy,cancelConnection:Z.cancelConnection,onConnectStart:Z.onConnectStart,onConnectEnd:Z.onConnectEnd,updateConnection:Z.updateConnection,onConnect:H,isValidConnection:n||Z.isValidConnection,getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:Z.autoPanSpeed})}Y?h==null||h(P):p==null||p(P)},j=P=>{const{onClickConnectStart:Y,onClickConnectEnd:Z,connectionClickStartHandle:k,connectionMode:G,isValidConnection:te,lib:C,rfId:F,nodeLookup:W,connection:J}=_.getState();if(!E||!k&&!s)return;if(!k){Y==null||Y(P.nativeEvent,{nodeId:E,handleId:b,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:E,type:e,id:b}});return}const oe=tN(P.target),ce=n||te,{connection:ge,isValid:ke}=qy.isValid(P.nativeEvent,{handle:{nodeId:E,id:b,type:e},connectionMode:G,fromNodeId:k.nodeId,fromHandleId:k.id||null,fromType:k.type,isValidConnection:ce,flowId:F,doc:oe,lib:C,nodeLookup:W});ke&&ge&&H(ge);const _e=structuredClone(J);delete _e.inProgress,_e.toPosition=_e.toHandle?_e.toHandle.position:null,Z==null||Z(P,_e),_.setState({connectionClickStartHandle:null})};return A.jsx("div",{"data-handleid":b,"data-nodeid":E,"data-handlepos":t,"data-id":`${M}-${E}-${b}-${e}`,className:Rt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",S,d,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:o,clickconnecting:B,connectingfrom:D,connectingto:R,valid:V,connectionindicator:r&&(!U||z)&&(U||O?o:s)}]),onMouseDown:Q,onTouchStart:Q,onClick:T?j:void 0,ref:v,...g,children:f})}const Gf=X.memo(TN(cG));function fG({data:e,isConnectable:t,sourcePosition:n=Ae.Bottom}){return A.jsxs(A.Fragment,{children:[e==null?void 0:e.label,A.jsx(Gf,{type:"source",position:n,isConnectable:t})]})}function dG({data:e,isConnectable:t,targetPosition:n=Ae.Top,sourcePosition:r=Ae.Bottom}){return A.jsxs(A.Fragment,{children:[A.jsx(Gf,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,A.jsx(Gf,{type:"source",position:r,isConnectable:t})]})}function hG(){return null}function mG({data:e,isConnectable:t,targetPosition:n=Ae.Top}){return A.jsxs(A.Fragment,{children:[A.jsx(Gf,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Yf={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},qE={input:fG,default:dG,output:mG,group:hG};function pG(e){var t,n,r,s;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??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const gG=e=>{const{width:t,height:n,x:r,y:s}=mu(e.nodeLookup,{filter:o=>!!o.selected});return{width:rr(t)?t:null,height:rr(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function yG({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=ht(),{width:s,height:o,transformString:l,userSelectionActive:u}=Ge(gG,bt),f=NN(),d=X.useRef(null);if(X.useEffect(()=>{var g;n||(g=d.current)==null||g.focus({preventScroll:!0})},[n]),AN({nodeRef:d}),u||!s||!o)return null;const h=e?g=>{const v=r.getState().nodes.filter(b=>b.selected);e(g,v)}:void 0,p=g=>{Object.prototype.hasOwnProperty.call(Yf,g.key)&&(g.preventDefault(),f({direction:Yf[g.key],factor:g.shiftKey?4:1}))};return A.jsx("div",{className:Rt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:A.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p,style:{width:s,height:o}})})}const GE=typeof window<"u"?window:void 0,vG=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function ON({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:l,paneClickDistance:u,deleteKeyCode:f,selectionKeyCode:d,selectionOnDrag:h,selectionMode:p,onSelectionStart:g,onSelectionEnd:v,multiSelectionKeyCode:b,panActivationKeyCode:w,zoomActivationKeyCode:_,elementsSelectable:E,zoomOnScroll:T,zoomOnPinch:S,panOnScroll:M,panOnScrollSpeed:D,panOnScrollMode:R,zoomOnDoubleClick:B,panOnDrag:z,defaultViewport:U,translateExtent:O,minZoom:V,maxZoom:H,preventScrolling:Q,onSelectionContextMenu:j,noWheelClassName:$,noPanClassName:I,disableKeyboardA11y:P,onViewportChange:Y,isControlledViewport:Z}){const{nodesSelectionActive:k,userSelectionActive:G}=Ge(vG),te=nu(d,{target:GE}),C=nu(w,{target:GE}),F=C||z,W=C||M,J=h&&F!==!0,oe=te||G||J;return Wq({deleteKeyCode:f,multiSelectionKeyCode:b}),A.jsx(tG,{onPaneContextMenu:o,elementsSelectable:E,zoomOnScroll:T,zoomOnPinch:S,panOnScroll:W,panOnScrollSpeed:D,panOnScrollMode:R,zoomOnDoubleClick:B,panOnDrag:!te&&F,defaultViewport:U,translateExtent:O,minZoom:V,maxZoom:H,zoomActivationKeyCode:_,preventScrolling:Q,noWheelClassName:$,noPanClassName:I,onViewportChange:Y,isControlledViewport:Z,paneClickDistance:u,children:A.jsxs(sG,{onSelectionStart:g,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:l,panOnDrag:F,isSelecting:!!oe,selectionMode:p,selectionKeyPressed:te,selectionOnDrag:J,children:[e,k&&A.jsx(yG,{onSelectionContextMenu:j,noPanClassName:I,disableKeyboardA11y:P})]})})}ON.displayName="FlowRenderer";const xG=X.memo(ON),bG=e=>t=>e?ZA(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 wG(e){return Ge(X.useCallback(bG(e),[e]),bt)}const _G=e=>e.updateNodeInternals;function SG(){const e=Ge(_G),[t]=X.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const o=s.target.getAttribute("data-id");r.set(o,{id:o,nodeElement:s.target,force:!0})}),e(r)}));return X.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function EG({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=ht(),o=X.useRef(null),l=X.useRef(null),u=X.useRef(e.sourcePosition),f=X.useRef(e.targetPosition),d=X.useRef(t),h=n&&!!e.internals.handleBounds;return X.useEffect(()=>{o.current&&!e.hidden&&(!h||l.current!==o.current)&&(l.current&&(r==null||r.unobserve(l.current)),r==null||r.observe(o.current),l.current=o.current)},[h,e.hidden]),X.useEffect(()=>()=>{l.current&&(r==null||r.unobserve(l.current),l.current=null)},[]),X.useEffect(()=>{if(o.current){const p=d.current!==t,g=u.current!==e.sourcePosition,v=f.current!==e.targetPosition;(p||g||v)&&(d.current=t,u.current=e.sourcePosition,f.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:o.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),o}function kG({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:o,onDoubleClick:l,nodesDraggable:u,elementsSelectable:f,nodesConnectable:d,nodesFocusable:h,resizeObserver:p,noDragClassName:g,noPanClassName:v,disableKeyboardA11y:b,rfId:w,nodeTypes:_,nodeClickDistance:E,onError:T}){const{node:S,internals:M,isParent:D}=Ge(oe=>{const ce=oe.nodeLookup.get(e),ge=oe.parentLookup.has(e);return{node:ce,internals:ce.internals,isParent:ge}},bt);let R=S.type||"default",B=(_==null?void 0:_[R])||qE[R];B===void 0&&(T==null||T("003",_r.error003(R)),R="default",B=qE.default);const z=!!(S.draggable||u&&typeof S.draggable>"u"),U=!!(S.selectable||f&&typeof S.selectable>"u"),O=!!(S.connectable||d&&typeof S.connectable>"u"),V=!!(S.focusable||h&&typeof S.focusable>"u"),H=ht(),Q=JA(S),j=EG({node:S,nodeType:R,hasDimensions:Q,resizeObserver:p}),$=AN({nodeRef:j,disabled:S.hidden||!z,noDragClassName:g,handleSelector:S.dragHandle,nodeId:e,isSelectable:U,nodeClickDistance:E}),I=NN();if(S.hidden)return null;const P=Jr(S),Y=pG(S),Z=U||z||t||n||r||s,k=n?oe=>n(oe,{...M.userNode}):void 0,G=r?oe=>r(oe,{...M.userNode}):void 0,te=s?oe=>s(oe,{...M.userNode}):void 0,C=o?oe=>o(oe,{...M.userNode}):void 0,F=l?oe=>l(oe,{...M.userNode}):void 0,W=oe=>{const{selectNodesOnDrag:ce,nodeDragThreshold:ge}=H.getState();U&&(!ce||!z||ge>0)&&Gy({id:e,store:H,nodeRef:j}),t&&t(oe,{...M.userNode})},J=oe=>{if(!(nN(oe.nativeEvent)||b))if($A.includes(oe.key)&&U){const ce=oe.key==="Escape";Gy({id:e,store:H,unselect:ce,nodeRef:j})}else z&&S.selected&&Object.prototype.hasOwnProperty.call(Yf,oe.key)&&(oe.preventDefault(),H.setState({ariaLiveMessage:`Moved selected node ${oe.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~M.positionAbsolute.x}, y: ${~~M.positionAbsolute.y}`}),I({direction:Yf[oe.key],factor:oe.shiftKey?4:1}))};return A.jsx("div",{className:Rt(["react-flow__node",`react-flow__node-${R}`,{[v]:z},S.className,{selected:S.selected,selectable:U,parent:D,draggable:z,dragging:$}]),ref:j,style:{zIndex:M.z,transform:`translate(${M.positionAbsolute.x}px,${M.positionAbsolute.y}px)`,pointerEvents:Z?"all":"none",visibility:Q?"visible":"hidden",...S.style,...Y},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:k,onMouseMove:G,onMouseLeave:te,onContextMenu:C,onClick:W,onDoubleClick:F,onKeyDown:V?J:void 0,tabIndex:V?0:void 0,role:V?"button":void 0,"aria-describedby":b?void 0:`${bN}-${w}`,"aria-label":S.ariaLabel,children:A.jsx(oG,{value:e,children:A.jsx(B,{id:e,data:S.data,type:R,positionAbsoluteX:M.positionAbsolute.x,positionAbsoluteY:M.positionAbsolute.y,selected:S.selected??!1,selectable:U,draggable:z,deletable:S.deletable??!0,isConnectable:O,sourcePosition:S.sourcePosition,targetPosition:S.targetPosition,dragging:$,dragHandle:S.dragHandle,zIndex:M.z,parentId:S.parentId,...P})})})}const TG=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function RN(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:o}=Ge(TG,bt),l=wG(e.onlyRenderVisibleElements),u=SG();return A.jsx("div",{className:"react-flow__nodes",style:xd,children:l.map(f=>A.jsx(kG,{id:f,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:u,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:o},f))})}RN.displayName="NodeRenderer";const CG=X.memo(RN);function AG(e){return Ge(X.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const o=n.nodeLookup.get(s.source),l=n.nodeLookup.get(s.target);o&&l&&N$({sourceNode:o,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),bt)}const NG=({color:e="none",strokeWidth:t=1})=>A.jsx("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),MG=({color:e="none",strokeWidth:t=1})=>A.jsx("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),YE={[Hf.Arrow]:NG,[Hf.ArrowClosed]:MG};function OG(e){const t=ht();return X.useMemo(()=>{var s,o;return Object.prototype.hasOwnProperty.call(YE,e)?YE[e]:((o=(s=t.getState()).onError)==null||o.call(s,"009",_r.error009(e)),null)},[e])}const RG=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:o="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const f=OG(t);return f?A.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:u,refX:"0",refY:"0",children:A.jsx(f,{color:n,strokeWidth:l})}):null},DN=({defaultColor:e,rfId:t})=>{const n=Ge(o=>o.edges),r=Ge(o=>o.defaultEdgeOptions),s=X.useMemo(()=>P$(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?A.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:A.jsx("defs",{children:s.map(o=>A.jsx(RG,{id:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient},o.id))})}):null};DN.displayName="MarkerDefinitions";var DG=X.memo(DN);function jN({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:o,labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:f,className:d,...h}){const[p,g]=X.useState({x:1,y:0,width:0,height:0}),v=Rt(["react-flow__edge-textwrapper",d]),b=X.useRef(null);return X.useEffect(()=>{if(b.current){const w=b.current.getBBox();g({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?A.jsxs("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:v,visibility:p.width?"visible":"hidden",...h,children:[s&&A.jsx("rect",{width:p.width+2*l[0],x:-l[0],y:-l[1],height:p.height+2*l[1],className:"react-flow__edge-textbg",style:o,rx:u,ry:u}),A.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:b,style:r,children:n}),f]}):null}jN.displayName="EdgeText";const jG=X.memo(jN);function bd({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,interactionWidth:d=20,...h}){return A.jsxs(A.Fragment,{children:[A.jsx("path",{...h,d:e,fill:"none",className:Rt(["react-flow__edge-path",h.className])}),d&&A.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}),r&&rr(t)&&rr(n)?A.jsx(jG,{x:t,y:n,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f}):null]})}function ZE({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ae.Left||e===Ae.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function zN({sourceX:e,sourceY:t,sourcePosition:n=Ae.Bottom,targetX:r,targetY:s,targetPosition:o=Ae.Top}){const[l,u]=ZE({pos:n,x1:e,y1:t,x2:r,y2:s}),[f,d]=ZE({pos:o,x1:r,y1:s,x2:e,y2:t}),[h,p,g,v]=iN({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:u,targetControlX:f,targetControlY:d});return[`M${e},${t} C${l},${u} ${f},${d} ${r},${s}`,h,p,g,v]}function LN(e){return X.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,sourcePosition:l,targetPosition:u,label:f,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:v,style:b,markerEnd:w,markerStart:_,interactionWidth:E})=>{const[T,S,M]=zN({sourceX:n,sourceY:r,sourcePosition:l,targetX:s,targetY:o,targetPosition:u}),D=e.isInternal?void 0:t;return A.jsx(bd,{id:D,path:T,labelX:S,labelY:M,label:f,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:v,style:b,markerEnd:w,markerStart:_,interactionWidth:E})})}const zG=LN({isInternal:!1}),PN=LN({isInternal:!0});zG.displayName="SimpleBezierEdge";PN.displayName="SimpleBezierEdgeInternal";function IN(e){return X.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:g,sourcePosition:v=Ae.Bottom,targetPosition:b=Ae.Top,markerEnd:w,markerStart:_,pathOptions:E,interactionWidth:T})=>{const[S,M,D]=Hy({sourceX:n,sourceY:r,sourcePosition:v,targetX:s,targetY:o,targetPosition:b,borderRadius:E==null?void 0:E.borderRadius,offset:E==null?void 0:E.offset}),R=e.isInternal?void 0:t;return A.jsx(bd,{id:R,path:S,labelX:M,labelY:D,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:_,interactionWidth:T})})}const VN=IN({isInternal:!1}),BN=IN({isInternal:!0});VN.displayName="SmoothStepEdge";BN.displayName="SmoothStepEdgeInternal";function UN(e){return X.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return A.jsx(VN,{...n,id:r,pathOptions:X.useMemo(()=>{var o;return{borderRadius:0,offset:(o=n.pathOptions)==null?void 0:o.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const LG=UN({isInternal:!1}),HN=UN({isInternal:!0});LG.displayName="StepEdge";HN.displayName="StepEdgeInternal";function FN(e){return X.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:v,markerStart:b,interactionWidth:w})=>{const[_,E,T]=oN({sourceX:n,sourceY:r,targetX:s,targetY:o}),S=e.isInternal?void 0:t;return A.jsx(bd,{id:S,path:_,labelX:E,labelY:T,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:v,markerStart:b,interactionWidth:w})})}const PG=FN({isInternal:!1}),$N=FN({isInternal:!0});PG.displayName="StraightEdge";$N.displayName="StraightEdgeInternal";function qN(e){return X.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,sourcePosition:l=Ae.Bottom,targetPosition:u=Ae.Top,label:f,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:v,style:b,markerEnd:w,markerStart:_,pathOptions:E,interactionWidth:T})=>{const[S,M,D]=sN({sourceX:n,sourceY:r,sourcePosition:l,targetX:s,targetY:o,targetPosition:u,curvature:E==null?void 0:E.curvature}),R=e.isInternal?void 0:t;return A.jsx(bd,{id:R,path:S,labelX:M,labelY:D,label:f,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:v,style:b,markerEnd:w,markerStart:_,interactionWidth:T})})}const IG=qN({isInternal:!1}),GN=qN({isInternal:!0});IG.displayName="BezierEdge";GN.displayName="BezierEdgeInternal";const XE={default:GN,straight:$N,step:HN,smoothstep:BN,simplebezier:PN},QE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},VG=(e,t,n)=>n===Ae.Left?e-t:n===Ae.Right?e+t:e,BG=(e,t,n)=>n===Ae.Top?e-t:n===Ae.Bottom?e+t:e,KE="react-flow__edgeupdater";function WE({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:o,onMouseOut:l,type:u}){return A.jsx("circle",{onMouseDown:s,onMouseEnter:o,onMouseOut:l,className:Rt([KE,`${KE}-${u}`]),cx:VG(t,r,e),cy:BG(n,r,e),r,stroke:"transparent",fill:"transparent"})}function UG({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:o,targetY:l,sourcePosition:u,targetPosition:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:p,setReconnecting:g,setUpdateHover:v}){const b=ht(),w=(M,D)=>{if(M.button!==0)return;const{autoPanOnConnect:R,domNode:B,isValidConnection:z,connectionMode:U,connectionRadius:O,lib:V,onConnectStart:H,onConnectEnd:Q,cancelConnection:j,nodeLookup:$,rfId:I,panBy:P,updateConnection:Y}=b.getState(),Z=D.type==="target";g(!0),h==null||h(M,n,D.type);const k=(te,C)=>{g(!1),p==null||p(te,n,D.type,C)},G=te=>d==null?void 0:d(n,te);qy.onPointerDown(M.nativeEvent,{autoPanOnConnect:R,connectionMode:U,connectionRadius:O,domNode:B,handleId:D.id,nodeId:D.nodeId,nodeLookup:$,isTarget:Z,edgeUpdaterType:D.type,lib:V,flowId:I,cancelConnection:j,panBy:P,isValidConnection:z,onConnect:G,onConnectStart:H,onConnectEnd:Q,onReconnectEnd:k,updateConnection:Y,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle})},_=M=>w(M,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),E=M=>w(M,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),T=()=>v(!0),S=()=>v(!1);return A.jsxs(A.Fragment,{children:[(e===!0||e==="source")&&A.jsx(WE,{position:u,centerX:r,centerY:s,radius:t,onMouseDown:_,onMouseEnter:T,onMouseOut:S,type:"source"}),(e===!0||e==="target")&&A.jsx(WE,{position:f,centerX:o,centerY:l,radius:t,onMouseDown:E,onMouseEnter:T,onMouseOut:S,type:"target"})]})}function HG({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:o,onContextMenu:l,onMouseEnter:u,onMouseMove:f,onMouseLeave:d,reconnectRadius:h,onReconnect:p,onReconnectStart:g,onReconnectEnd:v,rfId:b,edgeTypes:w,noPanClassName:_,onError:E,disableKeyboardA11y:T}){let S=Ge(ye=>ye.edgeLookup.get(e));const M=Ge(ye=>ye.defaultEdgeOptions);S=M?{...M,...S}:S;let D=S.type||"default",R=(w==null?void 0:w[D])||XE[D];R===void 0&&(E==null||E("011",_r.error011(D)),D="default",R=XE.default);const B=!!(S.focusable||t&&typeof S.focusable>"u"),z=typeof p<"u"&&(S.reconnectable||n&&typeof S.reconnectable>"u"),U=!!(S.selectable||r&&typeof S.selectable>"u"),O=X.useRef(null),[V,H]=X.useState(!1),[Q,j]=X.useState(!1),$=ht(),{zIndex:I,sourceX:P,sourceY:Y,targetX:Z,targetY:k,sourcePosition:G,targetPosition:te}=Ge(X.useCallback(ye=>{const je=ye.nodeLookup.get(S.source),ze=ye.nodeLookup.get(S.target);if(!je||!ze)return{zIndex:S.zIndex,...QE};const ot=L$({id:e,sourceNode:je,targetNode:ze,sourceHandle:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:ye.connectionMode,onError:E});return{zIndex:A$({selected:S.selected,zIndex:S.zIndex,sourceNode:je,targetNode:ze,elevateOnSelect:ye.elevateEdgesOnSelect}),...ot||QE}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),bt),C=X.useMemo(()=>S.markerStart?`url('#${Fy(S.markerStart,b)}')`:void 0,[S.markerStart,b]),F=X.useMemo(()=>S.markerEnd?`url('#${Fy(S.markerEnd,b)}')`:void 0,[S.markerEnd,b]);if(S.hidden||P===null||Y===null||Z===null||k===null)return null;const W=ye=>{var ft;const{addSelectedEdges:je,unselectNodesAndEdges:ze,multiSelectionActive:ot}=$.getState();U&&($.setState({nodesSelectionActive:!1}),S.selected&&ot?(ze({nodes:[],edges:[S]}),(ft=O.current)==null||ft.blur()):je([e])),s&&s(ye,S)},J=o?ye=>{o(ye,{...S})}:void 0,oe=l?ye=>{l(ye,{...S})}:void 0,ce=u?ye=>{u(ye,{...S})}:void 0,ge=f?ye=>{f(ye,{...S})}:void 0,ke=d?ye=>{d(ye,{...S})}:void 0,_e=ye=>{var je;if(!T&&$A.includes(ye.key)&&U){const{unselectNodesAndEdges:ze,addSelectedEdges:ot}=$.getState();ye.key==="Escape"?((je=O.current)==null||je.blur(),ze({edges:[S]})):ot([e])}};return A.jsx("svg",{style:{zIndex:I},children:A.jsxs("g",{className:Rt(["react-flow__edge",`react-flow__edge-${D}`,S.className,_,{selected:S.selected,animated:S.animated,inactive:!U&&!s,updating:V,selectable:U}]),onClick:W,onDoubleClick:J,onContextMenu:oe,onMouseEnter:ce,onMouseMove:ge,onMouseLeave:ke,onKeyDown:B?_e:void 0,tabIndex:B?0:void 0,role:B?"button":"img","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":S.ariaLabel===null?void 0:S.ariaLabel||`Edge from ${S.source} to ${S.target}`,"aria-describedby":B?`${wN}-${b}`:void 0,ref:O,children:[!Q&&A.jsx(R,{id:e,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:U,deletable:S.deletable??!0,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:P,sourceY:Y,targetX:Z,targetY:k,sourcePosition:G,targetPosition:te,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:C,markerEnd:F,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),z&&A.jsx(UG,{edge:S,isReconnectable:z,reconnectRadius:h,onReconnect:p,onReconnectStart:g,onReconnectEnd:v,sourceX:P,sourceY:Y,targetX:Z,targetY:k,sourcePosition:G,targetPosition:te,setUpdateHover:H,setReconnecting:j})]})})}const FG=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function YN({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:o,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:d,onEdgeClick:h,reconnectRadius:p,onEdgeDoubleClick:g,onReconnectStart:v,onReconnectEnd:b,disableKeyboardA11y:w}){const{edgesFocusable:_,edgesReconnectable:E,elementsSelectable:T,onError:S}=Ge(FG,bt),M=AG(t);return A.jsxs("div",{className:"react-flow__edges",children:[A.jsx(DG,{defaultColor:e,rfId:n}),M.map(D=>A.jsx(HG,{id:D,edgesFocusable:_,edgesReconnectable:E,elementsSelectable:T,noPanClassName:s,onReconnect:o,onContextMenu:l,onMouseEnter:u,onMouseMove:f,onMouseLeave:d,onClick:h,reconnectRadius:p,onDoubleClick:g,onReconnectStart:v,onReconnectEnd:b,rfId:n,onError:S,edgeTypes:r,disableKeyboardA11y:w},D))]})}YN.displayName="EdgeRenderer";const $G=X.memo(YN),qG=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function GG({children:e}){const t=Ge(qG);return A.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function YG(e){const t=vd(),n=X.useRef(!1);X.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const ZG=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function XG(e){const t=Ge(ZG),n=ht();return X.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function QG(e){return e.connection.inProgress?{...e.connection,to:pu(e.connection.to,e.transform)}:{...e.connection}}function KG(e){return QG}function WG(e){const t=KG();return Ge(t,bt)}const JG=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function eY({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:o,height:l,isValid:u,inProgress:f}=Ge(JG,bt);return!(o&&s&&f)?null:A.jsx("svg",{style:e,width:o,height:l,className:"react-flow__connectionline react-flow__container",children:A.jsx("g",{className:Rt(["react-flow__connection",GA(u)]),children:A.jsx(ZN,{style:t,type:n,CustomComponent:r,isValid:u})})})}const ZN=({style:e,type:t=zi.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:o,fromNode:l,fromHandle:u,fromPosition:f,to:d,toNode:h,toHandle:p,toPosition:g}=WG();if(!s)return;if(n)return A.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:l,fromHandle:u,fromX:o.x,fromY:o.y,toX:d.x,toY:d.y,fromPosition:f,toPosition:g,connectionStatus:GA(r),toNode:h,toHandle:p});let v="";const b={sourceX:o.x,sourceY:o.y,sourcePosition:f,targetX:d.x,targetY:d.y,targetPosition:g};switch(t){case zi.Bezier:[v]=sN(b);break;case zi.SimpleBezier:[v]=zN(b);break;case zi.Step:[v]=Hy({...b,borderRadius:0});break;case zi.SmoothStep:[v]=Hy(b);break;default:[v]=oN(b)}return A.jsx("path",{d:v,fill:"none",className:"react-flow__connection-path",style:e})};ZN.displayName="ConnectionLine";const tY={};function JE(e=tY){X.useRef(e),ht(),X.useEffect(()=>{},[e])}function nY(){ht(),X.useRef(!1),X.useEffect(()=>{},[])}function XN({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:o,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:g,onSelectionEnd:v,connectionLineType:b,connectionLineStyle:w,connectionLineComponent:_,connectionLineContainerStyle:E,selectionKeyCode:T,selectionOnDrag:S,selectionMode:M,multiSelectionKeyCode:D,panActivationKeyCode:R,zoomActivationKeyCode:B,deleteKeyCode:z,onlyRenderVisibleElements:U,elementsSelectable:O,defaultViewport:V,translateExtent:H,minZoom:Q,maxZoom:j,preventScrolling:$,defaultMarkerColor:I,zoomOnScroll:P,zoomOnPinch:Y,panOnScroll:Z,panOnScrollSpeed:k,panOnScrollMode:G,zoomOnDoubleClick:te,panOnDrag:C,onPaneClick:F,onPaneMouseEnter:W,onPaneMouseMove:J,onPaneMouseLeave:oe,onPaneScroll:ce,onPaneContextMenu:ge,paneClickDistance:ke,nodeClickDistance:_e,onEdgeContextMenu:ye,onEdgeMouseEnter:je,onEdgeMouseMove:ze,onEdgeMouseLeave:ot,reconnectRadius:ft,onReconnect:Et,onReconnectStart:Gi,onReconnectEnd:kr,noDragClassName:$n,noWheelClassName:or,noPanClassName:Tr,disableKeyboardA11y:lr,nodeExtent:Yi,rfId:ur,viewport:ae,onViewportChange:de}){return JE(e),JE(t),nY(),YG(n),XG(ae),A.jsx(xG,{onPaneClick:F,onPaneMouseEnter:W,onPaneMouseMove:J,onPaneMouseLeave:oe,onPaneContextMenu:ge,onPaneScroll:ce,paneClickDistance:ke,deleteKeyCode:z,selectionKeyCode:T,selectionOnDrag:S,selectionMode:M,onSelectionStart:g,onSelectionEnd:v,multiSelectionKeyCode:D,panActivationKeyCode:R,zoomActivationKeyCode:B,elementsSelectable:O,zoomOnScroll:P,zoomOnPinch:Y,zoomOnDoubleClick:te,panOnScroll:Z,panOnScrollSpeed:k,panOnScrollMode:G,panOnDrag:C,defaultViewport:V,translateExtent:H,minZoom:Q,maxZoom:j,onSelectionContextMenu:p,preventScrolling:$,noDragClassName:$n,noWheelClassName:or,noPanClassName:Tr,disableKeyboardA11y:lr,onViewportChange:de,isControlledViewport:!!ae,children:A.jsxs(GG,{children:[A.jsx($G,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:l,onReconnect:Et,onReconnectStart:Gi,onReconnectEnd:kr,onlyRenderVisibleElements:U,onEdgeContextMenu:ye,onEdgeMouseEnter:je,onEdgeMouseMove:ze,onEdgeMouseLeave:ot,reconnectRadius:ft,defaultMarkerColor:I,noPanClassName:Tr,disableKeyboardA11y:lr,rfId:ur}),A.jsx(eY,{style:w,type:b,component:_,containerStyle:E}),A.jsx("div",{className:"react-flow__edgelabel-renderer"}),A.jsx(CG,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:o,onNodeMouseEnter:u,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,nodeClickDistance:_e,onlyRenderVisibleElements:U,noPanClassName:Tr,noDragClassName:$n,disableKeyboardA11y:lr,nodeExtent:Yi,rfId:ur}),A.jsx("div",{className:"react-flow__viewport-portal"})]})})}XN.displayName="GraphView";const rY=X.memo(XN),ek=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:l,fitViewOptions:u,minZoom:f=.5,maxZoom:d=2,nodeOrigin:h,nodeExtent:p}={})=>{const g=new Map,v=new Map,b=new Map,w=new Map,_=r??t??[],E=n??e??[],T=h??[0,0],S=p??Wl;uN(b,w,_);const M=$y(E,g,v,{nodeOrigin:T,nodeExtent:S,elevateNodesOnSelect:!1});let D=[0,0,1];if(l&&s&&o){const R=mu(g,{filter:O=>!!((O.width||O.initialWidth)&&(O.height||O.initialHeight))}),{x:B,y:z,zoom:U}=rv(R,s,o,f,d,(u==null?void 0:u.padding)??.1);D=[B,z,U]}return{rfId:"1",width:0,height:0,transform:D,nodes:E,nodesInitialized:M,nodeLookup:g,parentLookup:v,edges:_,edgeLookup:w,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:f,maxZoom:d,translateExtent:Wl,nodeExtent:S,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Za.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:T,nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:l??!1,fitViewOptions:u,fitViewResolver:null,connection:{...qA},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanSpeed:15,connectionRadius:20,onError:S$,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},iY=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:l,fitViewOptions:u,minZoom:f,maxZoom:d,nodeOrigin:h,nodeExtent:p})=>Eq((g,v)=>{async function b(){const{nodeLookup:w,panZoom:_,fitViewOptions:E,fitViewResolver:T,width:S,height:M,minZoom:D,maxZoom:R}=v();_&&(await w$({nodes:w,width:S,height:M,panZoom:_,minZoom:D,maxZoom:R},E),T==null||T.resolve(!0),g({fitViewResolver:null}))}return{...ek({nodes:e,edges:t,width:s,height:o,fitView:l,fitViewOptions:u,minZoom:f,maxZoom:d,nodeOrigin:h,nodeExtent:p,defaultNodes:n,defaultEdges:r}),setNodes:w=>{const{nodeLookup:_,parentLookup:E,nodeOrigin:T,elevateNodesOnSelect:S,fitViewQueued:M}=v(),D=$y(w,_,E,{nodeOrigin:T,nodeExtent:p,elevateNodesOnSelect:S,checkEquality:!0});M&&D?(b(),g({nodes:w,nodesInitialized:D,fitViewQueued:!1,fitViewOptions:void 0})):g({nodes:w,nodesInitialized:D})},setEdges:w=>{const{connectionLookup:_,edgeLookup:E}=v();uN(_,E,w),g({edges:w})},setDefaultNodesAndEdges:(w,_)=>{if(w){const{setNodes:E}=v();E(w),g({hasDefaultNodes:!0})}if(_){const{setEdges:E}=v();E(_),g({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:_,nodeLookup:E,parentLookup:T,domNode:S,nodeOrigin:M,nodeExtent:D,debug:R,fitViewQueued:B}=v(),{changes:z,updatedInternals:U}=H$(w,E,T,S,M,D);U&&(V$(E,T,{nodeOrigin:M,nodeExtent:D}),B?(b(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),(z==null?void 0:z.length)>0&&(R&&console.log("React Flow: trigger node changes",z),_==null||_(z)))},updateNodePositions:(w,_=!1)=>{const E=[],T=[],{nodeLookup:S,triggerNodeChanges:M}=v();for(const[D,R]of w){const B=S.get(D),z=!!(B!=null&&B.expandParent&&(B!=null&&B.parentId)&&(R!=null&&R.position)),U={id:D,type:"position",position:z?{x:Math.max(0,R.position.x),y:Math.max(0,R.position.y)}:R.position,dragging:_};z&&B.parentId&&E.push({id:D,parentId:B.parentId,rect:{...R.internals.positionAbsolute,width:R.measured.width??0,height:R.measured.height??0}}),T.push(U)}if(E.length>0){const{parentLookup:D,nodeOrigin:R}=v(),B=lv(E,S,D,R);T.push(...B)}M(T)},triggerNodeChanges:w=>{const{onNodesChange:_,setNodes:E,nodes:T,hasDefaultNodes:S,debug:M}=v();if(w!=null&&w.length){if(S){const D=EN(w,T);E(D)}M&&console.log("React Flow: trigger node changes",w),_==null||_(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:_,setEdges:E,edges:T,hasDefaultEdges:S,debug:M}=v();if(w!=null&&w.length){if(S){const D=kN(w,T);E(D)}M&&console.log("React Flow: trigger edge changes",w),_==null||_(w)}},addSelectedNodes:w=>{const{multiSelectionActive:_,edgeLookup:E,nodeLookup:T,triggerNodeChanges:S,triggerEdgeChanges:M}=v();if(_){const D=w.map(R=>gs(R,!0));S(D);return}S(Da(T,new Set([...w]),!0)),M(Da(E))},addSelectedEdges:w=>{const{multiSelectionActive:_,edgeLookup:E,nodeLookup:T,triggerNodeChanges:S,triggerEdgeChanges:M}=v();if(_){const D=w.map(R=>gs(R,!0));M(D);return}M(Da(E,new Set([...w]))),S(Da(T,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:_}={})=>{const{edges:E,nodes:T,nodeLookup:S,triggerNodeChanges:M,triggerEdgeChanges:D}=v(),R=w||T,B=_||E,z=R.map(O=>{const V=S.get(O.id);return V&&(V.selected=!1),gs(O.id,!1)}),U=B.map(O=>gs(O.id,!1));M(z),D(U)},setMinZoom:w=>{const{panZoom:_,maxZoom:E}=v();_==null||_.setScaleExtent([w,E]),g({minZoom:w})},setMaxZoom:w=>{const{panZoom:_,minZoom:E}=v();_==null||_.setScaleExtent([E,w]),g({maxZoom:w})},setTranslateExtent:w=>{var _;(_=v().panZoom)==null||_.setTranslateExtent(w),g({translateExtent:w})},setPaneClickDistance:w=>{var _;(_=v().panZoom)==null||_.setClickDistance(w)},resetSelectedElements:()=>{const{edges:w,nodes:_,triggerNodeChanges:E,triggerEdgeChanges:T,elementsSelectable:S}=v();if(!S)return;const M=_.reduce((R,B)=>B.selected?[...R,gs(B.id,!1)]:R,[]),D=w.reduce((R,B)=>B.selected?[...R,gs(B.id,!1)]:R,[]);E(M),T(D)},setNodeExtent:w=>{const{nodes:_,nodeLookup:E,parentLookup:T,nodeOrigin:S,elevateNodesOnSelect:M,nodeExtent:D}=v();w[0][0]===D[0][0]&&w[0][1]===D[0][1]&&w[1][0]===D[1][0]&&w[1][1]===D[1][1]||($y(_,E,T,{nodeOrigin:S,nodeExtent:w,elevateNodesOnSelect:M,checkEquality:!1}),g({nodeExtent:w}))},panBy:w=>{const{transform:_,width:E,height:T,panZoom:S,translateExtent:M}=v();return F$({delta:w,panZoom:S,transform:_,translateExtent:M,width:E,height:T})},cancelConnection:()=>{g({connection:{...qA}})},updateConnection:w=>{g({connection:w})},reset:()=>g({...ek()})}},Object.is);function QN({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:o,initialMinZoom:l,initialMaxZoom:u,initialFitViewOptions:f,fitView:d,nodeOrigin:h,nodeExtent:p,children:g}){const[v]=X.useState(()=>iY({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:d,minZoom:l,maxZoom:u,fitViewOptions:f,nodeOrigin:h,nodeExtent:p}));return A.jsx(kq,{value:v,children:A.jsx(Zq,{children:g})})}function sY({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:o,height:l,fitView:u,fitViewOptions:f,minZoom:d,maxZoom:h,nodeOrigin:p,nodeExtent:g}){return X.useContext(yd)?A.jsx(A.Fragment,{children:e}):A.jsx(QN,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:o,initialHeight:l,fitView:u,initialFitViewOptions:f,initialMinZoom:d,initialMaxZoom:h,nodeOrigin:p,nodeExtent:g,children:e})}const aY={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function oY({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:o,edgeTypes:l,onNodeClick:u,onEdgeClick:f,onInit:d,onMove:h,onMoveStart:p,onMoveEnd:g,onConnect:v,onConnectStart:b,onConnectEnd:w,onClickConnectStart:_,onClickConnectEnd:E,onNodeMouseEnter:T,onNodeMouseMove:S,onNodeMouseLeave:M,onNodeContextMenu:D,onNodeDoubleClick:R,onNodeDragStart:B,onNodeDrag:z,onNodeDragStop:U,onNodesDelete:O,onEdgesDelete:V,onDelete:H,onSelectionChange:Q,onSelectionDragStart:j,onSelectionDrag:$,onSelectionDragStop:I,onSelectionContextMenu:P,onSelectionStart:Y,onSelectionEnd:Z,onBeforeDelete:k,connectionMode:G,connectionLineType:te=zi.Bezier,connectionLineStyle:C,connectionLineComponent:F,connectionLineContainerStyle:W,deleteKeyCode:J="Backspace",selectionKeyCode:oe="Shift",selectionOnDrag:ce=!1,selectionMode:ge=Jl.Full,panActivationKeyCode:ke="Space",multiSelectionKeyCode:_e=qf()?"Meta":"Control",zoomActivationKeyCode:ye=qf()?"Meta":"Control",snapToGrid:je,snapGrid:ze,onlyRenderVisibleElements:ot=!1,selectNodesOnDrag:ft,nodesDraggable:Et,nodesConnectable:Gi,nodesFocusable:kr,nodeOrigin:$n=_N,edgesFocusable:or,edgesReconnectable:Tr,elementsSelectable:lr=!0,defaultViewport:Yi=Iq,minZoom:ur=.5,maxZoom:ae=2,translateExtent:de=Wl,preventScrolling:Ee=!0,nodeExtent:Te,defaultMarkerColor:Qe="#b1b1b7",zoomOnScroll:Jt=!0,zoomOnPinch:qn=!0,panOnScroll:qt=!1,panOnScrollSpeed:On=.5,panOnScrollMode:en=As.Free,zoomOnDoubleClick:kt=!0,panOnDrag:an=!0,onPaneClick:yn,onPaneMouseEnter:yu,onPaneMouseMove:vu,onPaneMouseLeave:io,onPaneScroll:Zi,onPaneContextMenu:wd,paneClickDistance:so=0,nodeClickDistance:xu=0,children:ao,onReconnect:oo,onReconnectStart:bu,onReconnectEnd:_d,onEdgeContextMenu:cr,onEdgeDoubleClick:zt,onEdgeMouseEnter:Gt,onEdgeMouseMove:ei,onEdgeMouseLeave:lo,reconnectRadius:Sd=10,onNodesChange:Ed,onEdgesChange:wu,noDragClassName:Xi="nodrag",noWheelClassName:uo="nowheel",noPanClassName:Cr="nopan",fitView:Ar,fitViewOptions:ti,connectOnClick:ni,attributionPosition:Tt,proOptions:_u,defaultEdgeOptions:Su,elevateNodesOnSelect:Nr,elevateEdgesOnSelect:ri,disableKeyboardA11y:Eu=!1,autoPanOnConnect:ku,autoPanOnNodeDrag:Tu,autoPanSpeed:kd,connectionRadius:zs,isValidConnection:Ls,onError:Gn,style:co,id:fo,nodeDragThreshold:ii,viewport:ho,onViewportChange:mo,width:Td,height:Cu,colorMode:on="light",debug:Au,onScroll:Ps,...Is},Nu){const si=fo||"1",Cd=Hq(on),ln=X.useCallback(Vs=>{Vs.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ps==null||Ps(Vs)},[Ps]);return A.jsx("div",{"data-testid":"rf__wrapper",...Is,onScroll:ln,style:{...co,...aY},ref:Nu,className:Rt(["react-flow",s,Cd]),id:fo,children:A.jsxs(sY,{nodes:e,edges:t,width:Td,height:Cu,fitView:Ar,fitViewOptions:ti,minZoom:ur,maxZoom:ae,nodeOrigin:$n,nodeExtent:Te,children:[A.jsx(rY,{onInit:d,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:T,onNodeMouseMove:S,onNodeMouseLeave:M,onNodeContextMenu:D,onNodeDoubleClick:R,nodeTypes:o,edgeTypes:l,connectionLineType:te,connectionLineStyle:C,connectionLineComponent:F,connectionLineContainerStyle:W,selectionKeyCode:oe,selectionOnDrag:ce,selectionMode:ge,deleteKeyCode:J,multiSelectionKeyCode:_e,panActivationKeyCode:ke,zoomActivationKeyCode:ye,onlyRenderVisibleElements:ot,defaultViewport:Yi,translateExtent:de,minZoom:ur,maxZoom:ae,preventScrolling:Ee,zoomOnScroll:Jt,zoomOnPinch:qn,zoomOnDoubleClick:kt,panOnScroll:qt,panOnScrollSpeed:On,panOnScrollMode:en,panOnDrag:an,onPaneClick:yn,onPaneMouseEnter:yu,onPaneMouseMove:vu,onPaneMouseLeave:io,onPaneScroll:Zi,onPaneContextMenu:wd,paneClickDistance:so,nodeClickDistance:xu,onSelectionContextMenu:P,onSelectionStart:Y,onSelectionEnd:Z,onReconnect:oo,onReconnectStart:bu,onReconnectEnd:_d,onEdgeContextMenu:cr,onEdgeDoubleClick:zt,onEdgeMouseEnter:Gt,onEdgeMouseMove:ei,onEdgeMouseLeave:lo,reconnectRadius:Sd,defaultMarkerColor:Qe,noDragClassName:Xi,noWheelClassName:uo,noPanClassName:Cr,rfId:si,disableKeyboardA11y:Eu,nodeExtent:Te,viewport:ho,onViewportChange:mo}),A.jsx(Uq,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:v,onConnectStart:b,onConnectEnd:w,onClickConnectStart:_,onClickConnectEnd:E,nodesDraggable:Et,nodesConnectable:Gi,nodesFocusable:kr,edgesFocusable:or,edgesReconnectable:Tr,elementsSelectable:lr,elevateNodesOnSelect:Nr,elevateEdgesOnSelect:ri,minZoom:ur,maxZoom:ae,nodeExtent:Te,onNodesChange:Ed,onEdgesChange:wu,snapToGrid:je,snapGrid:ze,connectionMode:G,translateExtent:de,connectOnClick:ni,defaultEdgeOptions:Su,fitView:Ar,fitViewOptions:ti,onNodesDelete:O,onEdgesDelete:V,onDelete:H,onNodeDragStart:B,onNodeDrag:z,onNodeDragStop:U,onSelectionDrag:$,onSelectionDragStart:j,onSelectionDragStop:I,onMove:h,onMoveStart:p,onMoveEnd:g,noPanClassName:Cr,nodeOrigin:$n,rfId:si,autoPanOnConnect:ku,autoPanOnNodeDrag:Tu,autoPanSpeed:kd,onError:Gn,connectionRadius:zs,isValidConnection:Ls,selectNodesOnDrag:ft,nodeDragThreshold:ii,onBeforeDelete:k,paneClickDistance:so,debug:Au}),A.jsx(Pq,{onSelectionChange:Q}),ao,A.jsx(Rq,{proOptions:_u,position:Tt}),A.jsx(Mq,{rfId:si,disableKeyboardA11y:Eu})]})})}var lY=TN(oY);function uY(e){const[t,n]=X.useState(e),r=X.useCallback(s=>n(o=>EN(s,o)),[]);return[t,n,r]}function cY(e){const[t,n]=X.useState(e),r=X.useCallback(s=>n(o=>kN(s,o)),[]);return[t,n,r]}function fY({dimensions:e,lineWidth:t,variant:n,className:r}){return A.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Rt(["react-flow__background-pattern",n,r])})}function dY({radius:e,className:t}){return A.jsx("circle",{cx:e,cy:e,r:e,className:Rt(["react-flow__background-pattern","dots",t])})}var Ii;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ii||(Ii={}));const hY={[Ii.Dots]:1,[Ii.Lines]:1,[Ii.Cross]:6},mY=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function KN({id:e,variant:t=Ii.Dots,gap:n=20,size:r,lineWidth:s=1,offset:o=0,color:l,bgColor:u,style:f,className:d,patternClassName:h}){const p=X.useRef(null),{transform:g,patternId:v}=Ge(mY,bt),b=r||hY[t],w=t===Ii.Dots,_=t===Ii.Cross,E=Array.isArray(n)?n:[n,n],T=[E[0]*g[2]||1,E[1]*g[2]||1],S=b*g[2],M=Array.isArray(o)?o:[o,o],D=_?[S,S]:T,R=[M[0]*g[2]||1+D[0]/2,M[1]*g[2]||1+D[1]/2],B=`${v}${e||""}`;return A.jsxs("svg",{className:Rt(["react-flow__background",d]),style:{...f,...xd,"--xy-background-color-props":u,"--xy-background-pattern-color-props":l},ref:p,"data-testid":"rf__background",children:[A.jsx("pattern",{id:B,x:g[0]%T[0],y:g[1]%T[1],width:T[0],height:T[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${R[0]},-${R[1]})`,children:w?A.jsx(dY,{radius:S/2,className:h}):A.jsx(fY,{dimensions:D,lineWidth:s,variant:t,className:h})}),A.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${B})`})]})}KN.displayName="Background";const pY=X.memo(KN);function gY(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:A.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function yY(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:A.jsx("path",{d:"M0 0h32v4.2H0z"})})}function vY(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:A.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 xY(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:A.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 bY(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:A.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 sf({children:e,className:t,...n}){return A.jsx("button",{type:"button",className:Rt(["react-flow__controls-button",t]),...n,children:e})}const wY=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom});function WN({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:o,onZoomOut:l,onFitView:u,onInteractiveChange:f,className:d,children:h,position:p="bottom-left",orientation:g="vertical","aria-label":v="React Flow controls"}){const b=ht(),{isInteractive:w,minZoomReached:_,maxZoomReached:E}=Ge(wY,bt),{zoomIn:T,zoomOut:S,fitView:M}=vd(),D=()=>{T(),o==null||o()},R=()=>{S(),l==null||l()},B=()=>{M(s),u==null||u()},z=()=>{b.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),f==null||f(!w)},U=g==="horizontal"?"horizontal":"vertical";return A.jsxs(gu,{className:Rt(["react-flow__controls",U,d]),position:p,style:e,"data-testid":"rf__controls","aria-label":v,children:[t&&A.jsxs(A.Fragment,{children:[A.jsx(sf,{onClick:D,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:E,children:A.jsx(gY,{})}),A.jsx(sf,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:_,children:A.jsx(yY,{})})]}),n&&A.jsx(sf,{className:"react-flow__controls-fitview",onClick:B,title:"fit view","aria-label":"fit view",children:A.jsx(vY,{})}),r&&A.jsx(sf,{className:"react-flow__controls-interactive",onClick:z,title:"toggle interactivity","aria-label":"toggle interactivity",children:w?A.jsx(bY,{}):A.jsx(xY,{})}),h]})}WN.displayName="Controls";const _Y=X.memo(WN);function SY({id:e,x:t,y:n,width:r,height:s,style:o,color:l,strokeColor:u,strokeWidth:f,className:d,borderRadius:h,shapeRendering:p,selected:g,onClick:v}){const{background:b,backgroundColor:w}=o||{},_=l||b||w;return A.jsx("rect",{className:Rt(["react-flow__minimap-node",{selected:g},d]),x:t,y:n,rx:h,ry:h,width:r,height:s,style:{fill:_,stroke:u,strokeWidth:f},shapeRendering:p,onClick:v?E=>v(E,e):void 0})}const EY=X.memo(SY),kY=e=>e.nodes.map(t=>t.id),qp=e=>e instanceof Function?e:()=>e;function TY({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:o=EY,onClick:l}){const u=Ge(kY,bt),f=qp(t),d=qp(e),h=qp(n),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return A.jsx(A.Fragment,{children:u.map(g=>A.jsx(AY,{id:g,nodeColorFunc:f,nodeStrokeColorFunc:d,nodeClassNameFunc:h,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:o,onClick:l,shapeRendering:p},g))})}function CY({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:o,shapeRendering:l,NodeComponent:u,onClick:f}){const{node:d,x:h,y:p,width:g,height:v}=Ge(b=>{const{internals:w}=b.nodeLookup.get(e),_=w.userNode,{x:E,y:T}=w.positionAbsolute,{width:S,height:M}=Jr(_);return{node:_,x:E,y:T,width:S,height:M}},bt);return!d||d.hidden||!JA(d)?null:A.jsx(u,{x:h,y:p,width:g,height:v,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:s,strokeColor:n(d),strokeWidth:o,shapeRendering:l,onClick:f,id:d.id})}const AY=X.memo(CY);var NY=X.memo(TY);const MY=200,OY=150,RY=e=>!e.hidden,DY=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?WA(mu(e.nodeLookup,{filter:RY}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height}},jY="react-flow__minimap-desc";function JN({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:o=5,nodeStrokeWidth:l,nodeComponent:u,bgColor:f,maskColor:d,maskStrokeColor:h,maskStrokeWidth:p,position:g="bottom-right",onClick:v,onNodeClick:b,pannable:w=!1,zoomable:_=!1,ariaLabel:E="React Flow mini map",inversePan:T,zoomStep:S=10,offsetScale:M=5}){const D=ht(),R=X.useRef(null),{boundingRect:B,viewBB:z,rfId:U,panZoom:O,translateExtent:V,flowWidth:H,flowHeight:Q}=Ge(DY,bt),j=(e==null?void 0:e.width)??MY,$=(e==null?void 0:e.height)??OY,I=B.width/j,P=B.height/$,Y=Math.max(I,P),Z=Y*j,k=Y*$,G=M*Y,te=B.x-(Z-B.width)/2-G,C=B.y-(k-B.height)/2-G,F=Z+G*2,W=k+G*2,J=`${jY}-${U}`,oe=X.useRef(0),ce=X.useRef();oe.current=Y,X.useEffect(()=>{if(R.current&&O)return ce.current=K$({domNode:R.current,panZoom:O,getTransform:()=>D.getState().transform,getViewScale:()=>oe.current}),()=>{var _e;(_e=ce.current)==null||_e.destroy()}},[O]),X.useEffect(()=>{var _e;(_e=ce.current)==null||_e.update({translateExtent:V,width:H,height:Q,inversePan:T,pannable:w,zoomStep:S,zoomable:_})},[w,_,T,S,V,H,Q]);const ge=v?_e=>{var ze;const[ye,je]=((ze=ce.current)==null?void 0:ze.pointer(_e))||[0,0];v(_e,{x:ye,y:je})}:void 0,ke=b?X.useCallback((_e,ye)=>{const je=D.getState().nodeLookup.get(ye).internals.userNode;b(_e,je)},[]):void 0;return A.jsx(gu,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-width-props":typeof p=="number"?p*Y:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof l=="number"?l:void 0},className:Rt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:A.jsxs("svg",{width:j,height:$,viewBox:`${te} ${C} ${F} ${W}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":J,ref:R,onClick:ge,children:[E&&A.jsx("title",{id:J,children:E}),A.jsx(NY,{onClick:ke,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:o,nodeClassName:s,nodeStrokeWidth:l,nodeComponent:u}),A.jsx("path",{className:"react-flow__minimap-mask",d:`M${te-G},${C-G}h${F+G*2}v${W+G*2}h${-F-G*2}z
|
|
231
|
+
M${z.x},${z.y}h${z.width}v${z.height}h${-z.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}JN.displayName="MiniMap";X.memo(JN);function zY({nodeId:e,position:t,variant:n=Dl.Handle,className:r,style:s={},children:o,color:l,minWidth:u=10,minHeight:f=10,maxWidth:d=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:g,shouldResize:v,onResizeStart:b,onResize:w,onResizeEnd:_}){const E=MN(),T=typeof e=="string"?e:E,S=ht(),M=X.useRef(null),D=n===Dl.Line?"right":"bottom-right",R=t??D,B=X.useRef(null);X.useEffect(()=>{if(!(!M.current||!T))return B.current||(B.current=dq({domNode:M.current,nodeId:T,getStoreItems:()=>{const{nodeLookup:V,transform:H,snapGrid:Q,snapToGrid:j,nodeOrigin:$,domNode:I}=S.getState();return{nodeLookup:V,transform:H,snapGrid:Q,snapToGrid:j,nodeOrigin:$,paneDomNode:I}},onChange:(V,H)=>{const{triggerNodeChanges:Q,nodeLookup:j,parentLookup:$,nodeOrigin:I}=S.getState(),P=[],Y={x:V.x,y:V.y},Z=j.get(T);if(Z&&Z.expandParent&&Z.parentId){const k=Z.origin??I,G=V.width??Z.measured.width??0,te=V.height??Z.measured.height??0,C={id:Z.id,parentId:Z.parentId,rect:{width:G,height:te,...eN({x:V.x??Z.position.x,y:V.y??Z.position.y},{width:G,height:te},Z.parentId,j,k)}},F=lv([C],j,$,I);P.push(...F),Y.x=V.x?Math.max(k[0]*G,V.x):void 0,Y.y=V.y?Math.max(k[1]*te,V.y):void 0}if(Y.x!==void 0&&Y.y!==void 0){const k={id:T,type:"position",position:{...Y}};P.push(k)}if(V.width!==void 0&&V.height!==void 0){const G={id:T,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:V.width,height:V.height}};P.push(G)}for(const k of H){const G={...k,type:"position"};P.push(G)}Q(P)},onEnd:({width:V,height:H})=>{const Q={id:T,type:"dimensions",resizing:!1,dimensions:{width:V,height:H}};S.getState().triggerNodeChanges([Q])}})),B.current.update({controlPosition:R,boundaries:{minWidth:u,minHeight:f,maxWidth:d,maxHeight:h},keepAspectRatio:p,resizeDirection:g,onResizeStart:b,onResize:w,onResizeEnd:_,shouldResize:v}),()=>{var V;(V=B.current)==null||V.destroy()}},[R,u,f,d,h,p,b,w,_,v]);const z=R.split("-"),U=n===Dl.Line?"borderColor":"backgroundColor",O=l?{...s,[U]:l}:s;return A.jsx("div",{className:Rt(["react-flow__resize-control","nodrag",...z,n,r]),ref:M,style:O,children:o})}X.memo(zY);var Gp,tk;function cv(){if(tk)return Gp;tk=1;var e="\0",t="\0",n="";class r{constructor(h){ut(this,"_isDirected",!0);ut(this,"_isMultigraph",!1);ut(this,"_isCompound",!1);ut(this,"_label");ut(this,"_defaultNodeLabelFn",()=>{});ut(this,"_defaultEdgeLabelFn",()=>{});ut(this,"_nodes",{});ut(this,"_in",{});ut(this,"_preds",{});ut(this,"_out",{});ut(this,"_sucs",{});ut(this,"_edgeObjs",{});ut(this,"_edgeLabels",{});ut(this,"_nodeCount",0);ut(this,"_edgeCount",0);ut(this,"_parent");ut(this,"_children");h&&(this._isDirected=Object.hasOwn(h,"directed")?h.directed:!0,this._isMultigraph=Object.hasOwn(h,"multigraph")?h.multigraph:!1,this._isCompound=Object.hasOwn(h,"compound")?h.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(h){return this._label=h,this}graph(){return this._label}setDefaultNodeLabel(h){return this._defaultNodeLabelFn=h,typeof h!="function"&&(this._defaultNodeLabelFn=()=>h),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var h=this;return this.nodes().filter(p=>Object.keys(h._in[p]).length===0)}sinks(){var h=this;return this.nodes().filter(p=>Object.keys(h._out[p]).length===0)}setNodes(h,p){var g=arguments,v=this;return h.forEach(function(b){g.length>1?v.setNode(b,p):v.setNode(b)}),this}setNode(h,p){return Object.hasOwn(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=p),this):(this._nodes[h]=arguments.length>1?p:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=t,this._children[h]={},this._children[t][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)}node(h){return this._nodes[h]}hasNode(h){return Object.hasOwn(this._nodes,h)}removeNode(h){var p=this;if(Object.hasOwn(this._nodes,h)){var g=v=>p.removeEdge(p._edgeObjs[v]);delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],this.children(h).forEach(function(v){p.setParent(v)}),delete this._children[h]),Object.keys(this._in[h]).forEach(g),delete this._in[h],delete this._preds[h],Object.keys(this._out[h]).forEach(g),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this}setParent(h,p){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(p===void 0)p=t;else{p+="";for(var g=p;g!==void 0;g=this.parent(g))if(g===h)throw new Error("Setting "+p+" as parent of "+h+" would create a cycle");this.setNode(p)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=p,this._children[p][h]=!0,this}_removeFromParentsChildList(h){delete this._children[this._parent[h]][h]}parent(h){if(this._isCompound){var p=this._parent[h];if(p!==t)return p}}children(h=t){if(this._isCompound){var p=this._children[h];if(p)return Object.keys(p)}else{if(h===t)return this.nodes();if(this.hasNode(h))return[]}}predecessors(h){var p=this._preds[h];if(p)return Object.keys(p)}successors(h){var p=this._sucs[h];if(p)return Object.keys(p)}neighbors(h){var p=this.predecessors(h);if(p){const v=new Set(p);for(var g of this.successors(h))v.add(g);return Array.from(v.values())}}isLeaf(h){var p;return this.isDirected()?p=this.successors(h):p=this.neighbors(h),p.length===0}filterNodes(h){var p=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});p.setGraph(this.graph());var g=this;Object.entries(this._nodes).forEach(function([w,_]){h(w)&&p.setNode(w,_)}),Object.values(this._edgeObjs).forEach(function(w){p.hasNode(w.v)&&p.hasNode(w.w)&&p.setEdge(w,g.edge(w))});var v={};function b(w){var _=g.parent(w);return _===void 0||p.hasNode(_)?(v[w]=_,_):_ in v?v[_]:b(_)}return this._isCompound&&p.nodes().forEach(w=>p.setParent(w,b(w))),p}setDefaultEdgeLabel(h){return this._defaultEdgeLabelFn=h,typeof h!="function"&&(this._defaultEdgeLabelFn=()=>h),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(h,p){var g=this,v=arguments;return h.reduce(function(b,w){return v.length>1?g.setEdge(b,w,p):g.setEdge(b,w),w}),this}setEdge(){var h,p,g,v,b=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(h=w.v,p=w.w,g=w.name,arguments.length===2&&(v=arguments[1],b=!0)):(h=w,p=arguments[1],g=arguments[3],arguments.length>2&&(v=arguments[2],b=!0)),h=""+h,p=""+p,g!==void 0&&(g=""+g);var _=l(this._isDirected,h,p,g);if(Object.hasOwn(this._edgeLabels,_))return b&&(this._edgeLabels[_]=v),this;if(g!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(p),this._edgeLabels[_]=b?v:this._defaultEdgeLabelFn(h,p,g);var E=u(this._isDirected,h,p,g);return h=E.v,p=E.w,Object.freeze(E),this._edgeObjs[_]=E,s(this._preds[p],h),s(this._sucs[h],p),this._in[p][_]=E,this._out[h][_]=E,this._edgeCount++,this}edge(h,p,g){var v=arguments.length===1?f(this._isDirected,arguments[0]):l(this._isDirected,h,p,g);return this._edgeLabels[v]}edgeAsObj(){const h=this.edge(...arguments);return typeof h!="object"?{label:h}:h}hasEdge(h,p,g){var v=arguments.length===1?f(this._isDirected,arguments[0]):l(this._isDirected,h,p,g);return Object.hasOwn(this._edgeLabels,v)}removeEdge(h,p,g){var v=arguments.length===1?f(this._isDirected,arguments[0]):l(this._isDirected,h,p,g),b=this._edgeObjs[v];return b&&(h=b.v,p=b.w,delete this._edgeLabels[v],delete this._edgeObjs[v],o(this._preds[p],h),o(this._sucs[h],p),delete this._in[p][v],delete this._out[h][v],this._edgeCount--),this}inEdges(h,p){var g=this._in[h];if(g){var v=Object.values(g);return p?v.filter(b=>b.v===p):v}}outEdges(h,p){var g=this._out[h];if(g){var v=Object.values(g);return p?v.filter(b=>b.w===p):v}}nodeEdges(h,p){var g=this.inEdges(h,p);if(g)return g.concat(this.outEdges(h,p))}}function s(d,h){d[h]?d[h]++:d[h]=1}function o(d,h){--d[h]||delete d[h]}function l(d,h,p,g){var v=""+h,b=""+p;if(!d&&v>b){var w=v;v=b,b=w}return v+n+b+n+(g===void 0?e:g)}function u(d,h,p,g){var v=""+h,b=""+p;if(!d&&v>b){var w=v;v=b,b=w}var _={v,w:b};return g&&(_.name=g),_}function f(d,h){return l(d,h.v,h.w,h.name)}return Gp=r,Gp}var Yp,nk;function LY(){return nk||(nk=1,Yp="2.2.4"),Yp}var Zp,rk;function PY(){return rk||(rk=1,Zp={Graph:cv(),version:LY()}),Zp}var Xp,ik;function IY(){if(ik)return Xp;ik=1;var e=cv();Xp={write:t,read:s};function t(o){var l={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:n(o),edges:r(o)};return o.graph()!==void 0&&(l.value=structuredClone(o.graph())),l}function n(o){return o.nodes().map(function(l){var u=o.node(l),f=o.parent(l),d={v:l};return u!==void 0&&(d.value=u),f!==void 0&&(d.parent=f),d})}function r(o){return o.edges().map(function(l){var u=o.edge(l),f={v:l.v,w:l.w};return l.name!==void 0&&(f.name=l.name),u!==void 0&&(f.value=u),f})}function s(o){var l=new e(o.options).setGraph(o.value);return o.nodes.forEach(function(u){l.setNode(u.v,u.value),u.parent&&l.setParent(u.v,u.parent)}),o.edges.forEach(function(u){l.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),l}return Xp}var Qp,sk;function VY(){if(sk)return Qp;sk=1,Qp=e;function e(t){var n={},r=[],s;function o(l){Object.hasOwn(n,l)||(n[l]=!0,s.push(l),t.successors(l).forEach(o),t.predecessors(l).forEach(o))}return t.nodes().forEach(function(l){s=[],o(l),s.length&&r.push(s)}),r}return Qp}var Kp,ak;function eM(){if(ak)return Kp;ak=1;class e{constructor(){ut(this,"_arr",[]);ut(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(n){return n.key})}has(n){return Object.hasOwn(this._keyIndices,n)}priority(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(n,r){var s=this._keyIndices;if(n=String(n),!Object.hasOwn(s,n)){var o=this._arr,l=o.length;return s[n]=l,o.push({key:n,priority:r}),this._decrease(l),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key}decrease(n,r){var s=this._keyIndices[n];if(r>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[s].priority+" New: "+r);this._arr[s].priority=r,this._decrease(s)}_heapify(n){var r=this._arr,s=2*n,o=s+1,l=n;s<r.length&&(l=r[s].priority<r[l].priority?s:l,o<r.length&&(l=r[o].priority<r[l].priority?o:l),l!==n&&(this._swap(n,l),this._heapify(l)))}_decrease(n){for(var r=this._arr,s=r[n].priority,o;n!==0&&(o=n>>1,!(r[o].priority<s));)this._swap(n,o),n=o}_swap(n,r){var s=this._arr,o=this._keyIndices,l=s[n],u=s[r];s[n]=u,s[r]=l,o[u.key]=n,o[l.key]=r}}return Kp=e,Kp}var Wp,ok;function tM(){if(ok)return Wp;ok=1;var e=eM();Wp=n;var t=()=>1;function n(s,o,l,u){return r(s,String(o),l||t,u||function(f){return s.outEdges(f)})}function r(s,o,l,u){var f={},d=new e,h,p,g=function(v){var b=v.v!==h?v.v:v.w,w=f[b],_=l(v),E=p.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+v+" Weight: "+_);E<w.distance&&(w.distance=E,w.predecessor=h,d.decrease(b,E))};for(s.nodes().forEach(function(v){var b=v===o?0:Number.POSITIVE_INFINITY;f[v]={distance:b},d.add(v,b)});d.size()>0&&(h=d.removeMin(),p=f[h],p.distance!==Number.POSITIVE_INFINITY);)u(h).forEach(g);return f}return Wp}var Jp,lk;function BY(){if(lk)return Jp;lk=1;var e=tM();Jp=t;function t(n,r,s){return n.nodes().reduce(function(o,l){return o[l]=e(n,l,r,s),o},{})}return Jp}var eg,uk;function nM(){if(uk)return eg;uk=1,eg=e;function e(t){var n=0,r=[],s={},o=[];function l(u){var f=s[u]={onStack:!0,lowlink:n,index:n++};if(r.push(u),t.successors(u).forEach(function(p){Object.hasOwn(s,p)?s[p].onStack&&(f.lowlink=Math.min(f.lowlink,s[p].index)):(l(p),f.lowlink=Math.min(f.lowlink,s[p].lowlink))}),f.lowlink===f.index){var d=[],h;do h=r.pop(),s[h].onStack=!1,d.push(h);while(u!==h);o.push(d)}}return t.nodes().forEach(function(u){Object.hasOwn(s,u)||l(u)}),o}return eg}var tg,ck;function UY(){if(ck)return tg;ck=1;var e=nM();tg=t;function t(n){return e(n).filter(function(r){return r.length>1||r.length===1&&n.hasEdge(r[0],r[0])})}return tg}var ng,fk;function HY(){if(fk)return ng;fk=1,ng=t;var e=()=>1;function t(r,s,o){return n(r,s||e,o||function(l){return r.outEdges(l)})}function n(r,s,o){var l={},u=r.nodes();return u.forEach(function(f){l[f]={},l[f][f]={distance:0},u.forEach(function(d){f!==d&&(l[f][d]={distance:Number.POSITIVE_INFINITY})}),o(f).forEach(function(d){var h=d.v===f?d.w:d.v,p=s(d);l[f][h]={distance:p,predecessor:f}})}),u.forEach(function(f){var d=l[f];u.forEach(function(h){var p=l[h];u.forEach(function(g){var v=p[f],b=d[g],w=p[g],_=v.distance+b.distance;_<w.distance&&(w.distance=_,w.predecessor=b.predecessor)})})}),l}return ng}var rg,dk;function rM(){if(dk)return rg;dk=1;function e(n){var r={},s={},o=[];function l(u){if(Object.hasOwn(s,u))throw new t;Object.hasOwn(r,u)||(s[u]=!0,r[u]=!0,n.predecessors(u).forEach(l),delete s[u],o.push(u))}if(n.sinks().forEach(l),Object.keys(r).length!==n.nodeCount())throw new t;return o}class t extends Error{constructor(){super(...arguments)}}return rg=e,e.CycleException=t,rg}var ig,hk;function FY(){if(hk)return ig;hk=1;var e=rM();ig=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return ig}var sg,mk;function iM(){if(mk)return sg;mk=1,sg=e;function e(s,o,l){Array.isArray(o)||(o=[o]);var u=s.isDirected()?p=>s.successors(p):p=>s.neighbors(p),f=l==="post"?t:n,d=[],h={};return o.forEach(p=>{if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);f(p,u,h,d)}),d}function t(s,o,l,u){for(var f=[[s,!1]];f.length>0;){var d=f.pop();d[1]?u.push(d[0]):Object.hasOwn(l,d[0])||(l[d[0]]=!0,f.push([d[0],!0]),r(o(d[0]),h=>f.push([h,!1])))}}function n(s,o,l,u){for(var f=[s];f.length>0;){var d=f.pop();Object.hasOwn(l,d)||(l[d]=!0,u.push(d),r(o(d),h=>f.push(h)))}}function r(s,o){for(var l=s.length;l--;)o(s[l],l,s);return s}return sg}var ag,pk;function $Y(){if(pk)return ag;pk=1;var e=iM();ag=t;function t(n,r){return e(n,r,"post")}return ag}var og,gk;function qY(){if(gk)return og;gk=1;var e=iM();og=t;function t(n,r){return e(n,r,"pre")}return og}var lg,yk;function GY(){if(yk)return lg;yk=1;var e=cv(),t=eM();lg=n;function n(r,s){var o=new e,l={},u=new t,f;function d(p){var g=p.v===f?p.w:p.v,v=u.priority(g);if(v!==void 0){var b=s(p);b<v&&(l[g]=f,u.decrease(g,b))}}if(r.nodeCount()===0)return o;r.nodes().forEach(function(p){u.add(p,Number.POSITIVE_INFINITY),o.setNode(p)}),u.decrease(r.nodes()[0],0);for(var h=!1;u.size()>0;){if(f=u.removeMin(),Object.hasOwn(l,f))o.setEdge(f,l[f]);else{if(h)throw new Error("Input graph is not connected: "+r);h=!0}r.nodeEdges(f).forEach(d)}return o}return lg}var ug,vk;function YY(){return vk||(vk=1,ug={components:VY(),dijkstra:tM(),dijkstraAll:BY(),findCycles:UY(),floydWarshall:HY(),isAcyclic:FY(),postorder:$Y(),preorder:qY(),prim:GY(),tarjan:nM(),topsort:rM()}),ug}var cg,xk;function sr(){if(xk)return cg;xk=1;var e=PY();return cg={Graph:e.Graph,json:IY(),alg:YY(),version:e.version},cg}var fg,bk;function ZY(){if(bk)return fg;bk=1;class e{constructor(){let s={};s._next=s._prev=s,this._sentinel=s}dequeue(){let s=this._sentinel,o=s._prev;if(o!==s)return t(o),o}enqueue(s){let o=this._sentinel;s._prev&&s._next&&t(s),s._next=o._next,o._next._prev=s,o._next=s,s._prev=o}toString(){let s=[],o=this._sentinel,l=o._prev;for(;l!==o;)s.push(JSON.stringify(l,n)),l=l._prev;return"["+s.join(", ")+"]"}}function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,s){if(r!=="_next"&&r!=="_prev")return s}return fg=e,fg}var dg,wk;function XY(){if(wk)return dg;wk=1;let e=sr().Graph,t=ZY();dg=r;let n=()=>1;function r(d,h){if(d.nodeCount()<=1)return[];let p=l(d,h||n);return s(p.graph,p.buckets,p.zeroIdx).flatMap(v=>d.outEdges(v.v,v.w))}function s(d,h,p){let g=[],v=h[h.length-1],b=h[0],w;for(;d.nodeCount();){for(;w=b.dequeue();)o(d,h,p,w);for(;w=v.dequeue();)o(d,h,p,w);if(d.nodeCount()){for(let _=h.length-2;_>0;--_)if(w=h[_].dequeue(),w){g=g.concat(o(d,h,p,w,!0));break}}}return g}function o(d,h,p,g,v){let b=v?[]:void 0;return d.inEdges(g.v).forEach(w=>{let _=d.edge(w),E=d.node(w.v);v&&b.push({v:w.v,w:w.w}),E.out-=_,u(h,p,E)}),d.outEdges(g.v).forEach(w=>{let _=d.edge(w),E=w.w,T=d.node(E);T.in-=_,u(h,p,T)}),d.removeNode(g.v),b}function l(d,h){let p=new e,g=0,v=0;d.nodes().forEach(_=>{p.setNode(_,{v:_,in:0,out:0})}),d.edges().forEach(_=>{let E=p.edge(_.v,_.w)||0,T=h(_),S=E+T;p.setEdge(_.v,_.w,S),v=Math.max(v,p.node(_.v).out+=T),g=Math.max(g,p.node(_.w).in+=T)});let b=f(v+g+3).map(()=>new t),w=g+1;return p.nodes().forEach(_=>{u(b,w,p.node(_))}),{graph:p,buckets:b,zeroIdx:w}}function u(d,h,p){p.out?p.in?d[p.out-p.in+h].enqueue(p):d[d.length-1].enqueue(p):d[0].enqueue(p)}function f(d){const h=[];for(let p=0;p<d;p++)h.push(p);return h}return dg}var hg,_k;function Ot(){if(_k)return hg;_k=1;let e=sr().Graph;hg={addBorderNode:h,addDummyNode:t,applyWithChunking:v,asNonCompoundGraph:r,buildLayerMatrix:u,intersectRect:l,mapValues:R,maxRank:b,normalizeRanks:f,notime:E,partition:w,pick:D,predecessorWeights:o,range:M,removeEmptyRanks:d,simplify:n,successorWeights:s,time:_,uniqueId:S,zipObject:B};function t(z,U,O,V){let H;do H=S(V);while(z.hasNode(H));return O.dummy=U,z.setNode(H,O),H}function n(z){let U=new e().setGraph(z.graph());return z.nodes().forEach(O=>U.setNode(O,z.node(O))),z.edges().forEach(O=>{let V=U.edge(O.v,O.w)||{weight:0,minlen:1},H=z.edge(O);U.setEdge(O.v,O.w,{weight:V.weight+H.weight,minlen:Math.max(V.minlen,H.minlen)})}),U}function r(z){let U=new e({multigraph:z.isMultigraph()}).setGraph(z.graph());return z.nodes().forEach(O=>{z.children(O).length||U.setNode(O,z.node(O))}),z.edges().forEach(O=>{U.setEdge(O,z.edge(O))}),U}function s(z){let U=z.nodes().map(O=>{let V={};return z.outEdges(O).forEach(H=>{V[H.w]=(V[H.w]||0)+z.edge(H).weight}),V});return B(z.nodes(),U)}function o(z){let U=z.nodes().map(O=>{let V={};return z.inEdges(O).forEach(H=>{V[H.v]=(V[H.v]||0)+z.edge(H).weight}),V});return B(z.nodes(),U)}function l(z,U){let O=z.x,V=z.y,H=U.x-O,Q=U.y-V,j=z.width/2,$=z.height/2;if(!H&&!Q)throw new Error("Not possible to find intersection inside of the rectangle");let I,P;return Math.abs(Q)*j>Math.abs(H)*$?(Q<0&&($=-$),I=$*H/Q,P=$):(H<0&&(j=-j),I=j,P=j*Q/H),{x:O+I,y:V+P}}function u(z){let U=M(b(z)+1).map(()=>[]);return z.nodes().forEach(O=>{let V=z.node(O),H=V.rank;H!==void 0&&(U[H][V.order]=O)}),U}function f(z){let U=z.nodes().map(V=>{let H=z.node(V).rank;return H===void 0?Number.MAX_VALUE:H}),O=v(Math.min,U);z.nodes().forEach(V=>{let H=z.node(V);Object.hasOwn(H,"rank")&&(H.rank-=O)})}function d(z){let U=z.nodes().map(j=>z.node(j).rank),O=v(Math.min,U),V=[];z.nodes().forEach(j=>{let $=z.node(j).rank-O;V[$]||(V[$]=[]),V[$].push(j)});let H=0,Q=z.graph().nodeRankFactor;Array.from(V).forEach((j,$)=>{j===void 0&&$%Q!==0?--H:j!==void 0&&H&&j.forEach(I=>z.node(I).rank+=H)})}function h(z,U,O,V){let H={width:0,height:0};return arguments.length>=4&&(H.rank=O,H.order=V),t(z,"border",H,U)}function p(z,U=g){const O=[];for(let V=0;V<z.length;V+=U){const H=z.slice(V,V+U);O.push(H)}return O}const g=65535;function v(z,U){if(U.length>g){const O=p(U);return z.apply(null,O.map(V=>z.apply(null,V)))}else return z.apply(null,U)}function b(z){const O=z.nodes().map(V=>{let H=z.node(V).rank;return H===void 0?Number.MIN_VALUE:H});return v(Math.max,O)}function w(z,U){let O={lhs:[],rhs:[]};return z.forEach(V=>{U(V)?O.lhs.push(V):O.rhs.push(V)}),O}function _(z,U){let O=Date.now();try{return U()}finally{console.log(z+" time: "+(Date.now()-O)+"ms")}}function E(z,U){return U()}let T=0;function S(z){var U=++T;return toString(z)+U}function M(z,U,O=1){U==null&&(U=z,z=0);let V=Q=>Q<U;O<0&&(V=Q=>U<Q);const H=[];for(let Q=z;V(Q);Q+=O)H.push(Q);return H}function D(z,U){const O={};for(const V of U)z[V]!==void 0&&(O[V]=z[V]);return O}function R(z,U){let O=U;return typeof U=="string"&&(O=V=>V[U]),Object.entries(z).reduce((V,[H,Q])=>(V[H]=O(Q,H),V),{})}function B(z,U){return z.reduce((O,V,H)=>(O[V]=U[H],O),{})}return hg}var mg,Sk;function QY(){if(Sk)return mg;Sk=1;let e=XY(),t=Ot().uniqueId;mg={run:n,undo:s};function n(o){(o.graph().acyclicer==="greedy"?e(o,u(o)):r(o)).forEach(f=>{let d=o.edge(f);o.removeEdge(f),d.forwardName=f.name,d.reversed=!0,o.setEdge(f.w,f.v,d,t("rev"))});function u(f){return d=>f.edge(d).weight}}function r(o){let l=[],u={},f={};function d(h){Object.hasOwn(f,h)||(f[h]=!0,u[h]=!0,o.outEdges(h).forEach(p=>{Object.hasOwn(u,p.w)?l.push(p):d(p.w)}),delete u[h])}return o.nodes().forEach(d),l}function s(o){o.edges().forEach(l=>{let u=o.edge(l);if(u.reversed){o.removeEdge(l);let f=u.forwardName;delete u.reversed,delete u.forwardName,o.setEdge(l.w,l.v,u,f)}})}return mg}var pg,Ek;function KY(){if(Ek)return pg;Ek=1;let e=Ot();pg={run:t,undo:r};function t(s){s.graph().dummyChains=[],s.edges().forEach(o=>n(s,o))}function n(s,o){let l=o.v,u=s.node(l).rank,f=o.w,d=s.node(f).rank,h=o.name,p=s.edge(o),g=p.labelRank;if(d===u+1)return;s.removeEdge(o);let v,b,w;for(w=0,++u;u<d;++w,++u)p.points=[],b={width:0,height:0,edgeLabel:p,edgeObj:o,rank:u},v=e.addDummyNode(s,"edge",b,"_d"),u===g&&(b.width=p.width,b.height=p.height,b.dummy="edge-label",b.labelpos=p.labelpos),s.setEdge(l,v,{weight:p.weight},h),w===0&&s.graph().dummyChains.push(v),l=v;s.setEdge(l,f,{weight:p.weight},h)}function r(s){s.graph().dummyChains.forEach(o=>{let l=s.node(o),u=l.edgeLabel,f;for(s.setEdge(l.edgeObj,u);l.dummy;)f=s.successors(o)[0],s.removeNode(o),u.points.push({x:l.x,y:l.y}),l.dummy==="edge-label"&&(u.x=l.x,u.y=l.y,u.width=l.width,u.height=l.height),o=f,l=s.node(o)})}return pg}var gg,kk;function Zf(){if(kk)return gg;kk=1;const{applyWithChunking:e}=Ot();gg={longestPath:t,slack:n};function t(r){var s={};function o(l){var u=r.node(l);if(Object.hasOwn(s,l))return u.rank;s[l]=!0;let f=r.outEdges(l).map(h=>h==null?Number.POSITIVE_INFINITY:o(h.w)-r.edge(h).minlen);var d=e(Math.min,f);return d===Number.POSITIVE_INFINITY&&(d=0),u.rank=d}r.sources().forEach(o)}function n(r,s){return r.node(s.w).rank-r.node(s.v).rank-r.edge(s).minlen}return gg}var yg,Tk;function sM(){if(Tk)return yg;Tk=1;var e=sr().Graph,t=Zf().slack;yg=n;function n(l){var u=new e({directed:!1}),f=l.nodes()[0],d=l.nodeCount();u.setNode(f,{});for(var h,p;r(u,l)<d;)h=s(u,l),p=u.hasNode(h.v)?t(l,h):-t(l,h),o(u,l,p);return u}function r(l,u){function f(d){u.nodeEdges(d).forEach(h=>{var p=h.v,g=d===p?h.w:p;!l.hasNode(g)&&!t(u,h)&&(l.setNode(g,{}),l.setEdge(d,g,{}),f(g))})}return l.nodes().forEach(f),l.nodeCount()}function s(l,u){return u.edges().reduce((d,h)=>{let p=Number.POSITIVE_INFINITY;return l.hasNode(h.v)!==l.hasNode(h.w)&&(p=t(u,h)),p<d[0]?[p,h]:d},[Number.POSITIVE_INFINITY,null])[1]}function o(l,u,f){l.nodes().forEach(d=>u.node(d).rank+=f)}return yg}var vg,Ck;function WY(){if(Ck)return vg;Ck=1;var e=sM(),t=Zf().slack,n=Zf().longestPath,r=sr().alg.preorder,s=sr().alg.postorder,o=Ot().simplify;vg=l,l.initLowLimValues=h,l.initCutValues=u,l.calcCutValue=d,l.leaveEdge=g,l.enterEdge=v,l.exchangeEdges=b;function l(T){T=o(T),n(T);var S=e(T);h(S),u(S,T);for(var M,D;M=g(S);)D=v(S,T,M),b(S,T,M,D)}function u(T,S){var M=s(T,T.nodes());M=M.slice(0,M.length-1),M.forEach(D=>f(T,S,D))}function f(T,S,M){var D=T.node(M),R=D.parent;T.edge(M,R).cutvalue=d(T,S,M)}function d(T,S,M){var D=T.node(M),R=D.parent,B=!0,z=S.edge(M,R),U=0;return z||(B=!1,z=S.edge(R,M)),U=z.weight,S.nodeEdges(M).forEach(O=>{var V=O.v===M,H=V?O.w:O.v;if(H!==R){var Q=V===B,j=S.edge(O).weight;if(U+=Q?j:-j,_(T,M,H)){var $=T.edge(M,H).cutvalue;U+=Q?-$:$}}}),U}function h(T,S){arguments.length<2&&(S=T.nodes()[0]),p(T,{},1,S)}function p(T,S,M,D,R){var B=M,z=T.node(D);return S[D]=!0,T.neighbors(D).forEach(U=>{Object.hasOwn(S,U)||(M=p(T,S,M,U,D))}),z.low=B,z.lim=M++,R?z.parent=R:delete z.parent,M}function g(T){return T.edges().find(S=>T.edge(S).cutvalue<0)}function v(T,S,M){var D=M.v,R=M.w;S.hasEdge(D,R)||(D=M.w,R=M.v);var B=T.node(D),z=T.node(R),U=B,O=!1;B.lim>z.lim&&(U=z,O=!0);var V=S.edges().filter(H=>O===E(T,T.node(H.v),U)&&O!==E(T,T.node(H.w),U));return V.reduce((H,Q)=>t(S,Q)<t(S,H)?Q:H)}function b(T,S,M,D){var R=M.v,B=M.w;T.removeEdge(R,B),T.setEdge(D.v,D.w,{}),h(T),u(T,S),w(T,S)}function w(T,S){var M=T.nodes().find(R=>!S.node(R).parent),D=r(T,M);D=D.slice(1),D.forEach(R=>{var B=T.node(R).parent,z=S.edge(R,B),U=!1;z||(z=S.edge(B,R),U=!0),S.node(R).rank=S.node(B).rank+(U?z.minlen:-z.minlen)})}function _(T,S,M){return T.hasEdge(S,M)}function E(T,S,M){return M.low<=S.lim&&S.lim<=M.lim}return vg}var xg,Ak;function JY(){if(Ak)return xg;Ak=1;var e=Zf(),t=e.longestPath,n=sM(),r=WY();xg=s;function s(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":l(f);break;case"longest-path":o(f);break;default:u(f)}}var o=t;function l(f){t(f),n(f)}function u(f){r(f)}return xg}var bg,Nk;function eZ(){if(Nk)return bg;Nk=1,bg=e;function e(r){let s=n(r);r.graph().dummyChains.forEach(o=>{let l=r.node(o),u=l.edgeObj,f=t(r,s,u.v,u.w),d=f.path,h=f.lca,p=0,g=d[p],v=!0;for(;o!==u.w;){if(l=r.node(o),v){for(;(g=d[p])!==h&&r.node(g).maxRank<l.rank;)p++;g===h&&(v=!1)}if(!v){for(;p<d.length-1&&r.node(g=d[p+1]).minRank<=l.rank;)p++;g=d[p]}r.setParent(o,g),o=r.successors(o)[0]}})}function t(r,s,o,l){let u=[],f=[],d=Math.min(s[o].low,s[l].low),h=Math.max(s[o].lim,s[l].lim),p,g;p=o;do p=r.parent(p),u.push(p);while(p&&(s[p].low>d||h>s[p].lim));for(g=p,p=l;(p=r.parent(p))!==g;)f.push(p);return{path:u.concat(f.reverse()),lca:g}}function n(r){let s={},o=0;function l(u){let f=o;r.children(u).forEach(l),s[u]={low:f,lim:o++}}return r.children().forEach(l),s}return bg}var wg,Mk;function tZ(){if(Mk)return wg;Mk=1;let e=Ot();wg={run:t,cleanup:o};function t(l){let u=e.addDummyNode(l,"root",{},"_root"),f=r(l),d=Object.values(f),h=e.applyWithChunking(Math.max,d)-1,p=2*h+1;l.graph().nestingRoot=u,l.edges().forEach(v=>l.edge(v).minlen*=p);let g=s(l)+1;l.children().forEach(v=>n(l,u,p,g,h,f,v)),l.graph().nodeRankFactor=p}function n(l,u,f,d,h,p,g){let v=l.children(g);if(!v.length){g!==u&&l.setEdge(u,g,{weight:0,minlen:f});return}let b=e.addBorderNode(l,"_bt"),w=e.addBorderNode(l,"_bb"),_=l.node(g);l.setParent(b,g),_.borderTop=b,l.setParent(w,g),_.borderBottom=w,v.forEach(E=>{n(l,u,f,d,h,p,E);let T=l.node(E),S=T.borderTop?T.borderTop:E,M=T.borderBottom?T.borderBottom:E,D=T.borderTop?d:2*d,R=S!==M?1:h-p[g]+1;l.setEdge(b,S,{weight:D,minlen:R,nestingEdge:!0}),l.setEdge(M,w,{weight:D,minlen:R,nestingEdge:!0})}),l.parent(g)||l.setEdge(u,b,{weight:0,minlen:h+p[g]})}function r(l){var u={};function f(d,h){var p=l.children(d);p&&p.length&&p.forEach(g=>f(g,h+1)),u[d]=h}return l.children().forEach(d=>f(d,1)),u}function s(l){return l.edges().reduce((u,f)=>u+l.edge(f).weight,0)}function o(l){var u=l.graph();l.removeNode(u.nestingRoot),delete u.nestingRoot,l.edges().forEach(f=>{var d=l.edge(f);d.nestingEdge&&l.removeEdge(f)})}return wg}var _g,Ok;function nZ(){if(Ok)return _g;Ok=1;let e=Ot();_g=t;function t(r){function s(o){let l=r.children(o),u=r.node(o);if(l.length&&l.forEach(s),Object.hasOwn(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(let f=u.minRank,d=u.maxRank+1;f<d;++f)n(r,"borderLeft","_bl",o,u,f),n(r,"borderRight","_br",o,u,f)}}r.children().forEach(s)}function n(r,s,o,l,u,f){let d={width:0,height:0,rank:f,borderType:s},h=u[s][f-1],p=e.addDummyNode(r,"border",d,o);u[s][f]=p,r.setParent(p,l),h&&r.setEdge(h,p,{weight:1})}return _g}var Sg,Rk;function rZ(){if(Rk)return Sg;Rk=1,Sg={adjust:e,undo:t};function e(f){let d=f.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&n(f)}function t(f){let d=f.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&s(f),(d==="lr"||d==="rl")&&(l(f),n(f))}function n(f){f.nodes().forEach(d=>r(f.node(d))),f.edges().forEach(d=>r(f.edge(d)))}function r(f){let d=f.width;f.width=f.height,f.height=d}function s(f){f.nodes().forEach(d=>o(f.node(d))),f.edges().forEach(d=>{let h=f.edge(d);h.points.forEach(o),Object.hasOwn(h,"y")&&o(h)})}function o(f){f.y=-f.y}function l(f){f.nodes().forEach(d=>u(f.node(d))),f.edges().forEach(d=>{let h=f.edge(d);h.points.forEach(u),Object.hasOwn(h,"x")&&u(h)})}function u(f){let d=f.x;f.x=f.y,f.y=d}return Sg}var Eg,Dk;function iZ(){if(Dk)return Eg;Dk=1;let e=Ot();Eg=t;function t(n){let r={},s=n.nodes().filter(h=>!n.children(h).length),o=s.map(h=>n.node(h).rank),l=e.applyWithChunking(Math.max,o),u=e.range(l+1).map(()=>[]);function f(h){if(r[h])return;r[h]=!0;let p=n.node(h);u[p.rank].push(h),n.successors(h).forEach(f)}return s.sort((h,p)=>n.node(h).rank-n.node(p).rank).forEach(f),u}return Eg}var kg,jk;function sZ(){if(jk)return kg;jk=1;let e=Ot().zipObject;kg=t;function t(r,s){let o=0;for(let l=1;l<s.length;++l)o+=n(r,s[l-1],s[l]);return o}function n(r,s,o){let l=e(o,o.map((g,v)=>v)),u=s.flatMap(g=>r.outEdges(g).map(v=>({pos:l[v.w],weight:r.edge(v).weight})).sort((v,b)=>v.pos-b.pos)),f=1;for(;f<o.length;)f<<=1;let d=2*f-1;f-=1;let h=new Array(d).fill(0),p=0;return u.forEach(g=>{let v=g.pos+f;h[v]+=g.weight;let b=0;for(;v>0;)v%2&&(b+=h[v+1]),v=v-1>>1,h[v]+=g.weight;p+=g.weight*b}),p}return kg}var Tg,zk;function aZ(){if(zk)return Tg;zk=1,Tg=e;function e(t,n=[]){return n.map(r=>{let s=t.inEdges(r);if(s.length){let o=s.reduce((l,u)=>{let f=t.edge(u),d=t.node(u.v);return{sum:l.sum+f.weight*d.order,weight:l.weight+f.weight}},{sum:0,weight:0});return{v:r,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:r}})}return Tg}var Cg,Lk;function oZ(){if(Lk)return Cg;Lk=1;let e=Ot();Cg=t;function t(s,o){let l={};s.forEach((f,d)=>{let h=l[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:d};f.barycenter!==void 0&&(h.barycenter=f.barycenter,h.weight=f.weight)}),o.edges().forEach(f=>{let d=l[f.v],h=l[f.w];d!==void 0&&h!==void 0&&(h.indegree++,d.out.push(l[f.w]))});let u=Object.values(l).filter(f=>!f.indegree);return n(u)}function n(s){let o=[];function l(f){return d=>{d.merged||(d.barycenter===void 0||f.barycenter===void 0||d.barycenter>=f.barycenter)&&r(f,d)}}function u(f){return d=>{d.in.push(f),--d.indegree===0&&s.push(d)}}for(;s.length;){let f=s.pop();o.push(f),f.in.reverse().forEach(l(f)),f.out.forEach(u(f))}return o.filter(f=>!f.merged).map(f=>e.pick(f,["vs","i","barycenter","weight"]))}function r(s,o){let l=0,u=0;s.weight&&(l+=s.barycenter*s.weight,u+=s.weight),o.weight&&(l+=o.barycenter*o.weight,u+=o.weight),s.vs=o.vs.concat(s.vs),s.barycenter=l/u,s.weight=u,s.i=Math.min(o.i,s.i),o.merged=!0}return Cg}var Ag,Pk;function lZ(){if(Pk)return Ag;Pk=1;let e=Ot();Ag=t;function t(s,o){let l=e.partition(s,b=>Object.hasOwn(b,"barycenter")),u=l.lhs,f=l.rhs.sort((b,w)=>w.i-b.i),d=[],h=0,p=0,g=0;u.sort(r(!!o)),g=n(d,f,g),u.forEach(b=>{g+=b.vs.length,d.push(b.vs),h+=b.barycenter*b.weight,p+=b.weight,g=n(d,f,g)});let v={vs:d.flat(!0)};return p&&(v.barycenter=h/p,v.weight=p),v}function n(s,o,l){let u;for(;o.length&&(u=o[o.length-1]).i<=l;)o.pop(),s.push(u.vs),l++;return l}function r(s){return(o,l)=>o.barycenter<l.barycenter?-1:o.barycenter>l.barycenter?1:s?l.i-o.i:o.i-l.i}return Ag}var Ng,Ik;function uZ(){if(Ik)return Ng;Ik=1;let e=aZ(),t=oZ(),n=lZ();Ng=r;function r(l,u,f,d){let h=l.children(u),p=l.node(u),g=p?p.borderLeft:void 0,v=p?p.borderRight:void 0,b={};g&&(h=h.filter(T=>T!==g&&T!==v));let w=e(l,h);w.forEach(T=>{if(l.children(T.v).length){let S=r(l,T.v,f,d);b[T.v]=S,Object.hasOwn(S,"barycenter")&&o(T,S)}});let _=t(w,f);s(_,b);let E=n(_,d);if(g&&(E.vs=[g,E.vs,v].flat(!0),l.predecessors(g).length)){let T=l.node(l.predecessors(g)[0]),S=l.node(l.predecessors(v)[0]);Object.hasOwn(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+T.order+S.order)/(E.weight+2),E.weight+=2}return E}function s(l,u){l.forEach(f=>{f.vs=f.vs.flatMap(d=>u[d]?u[d].vs:d)})}function o(l,u){l.barycenter!==void 0?(l.barycenter=(l.barycenter*l.weight+u.barycenter*u.weight)/(l.weight+u.weight),l.weight+=u.weight):(l.barycenter=u.barycenter,l.weight=u.weight)}return Ng}var Mg,Vk;function cZ(){if(Vk)return Mg;Vk=1;let e=sr().Graph,t=Ot();Mg=n;function n(s,o,l){let u=r(s),f=new e({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(d=>s.node(d));return s.nodes().forEach(d=>{let h=s.node(d),p=s.parent(d);(h.rank===o||h.minRank<=o&&o<=h.maxRank)&&(f.setNode(d),f.setParent(d,p||u),s[l](d).forEach(g=>{let v=g.v===d?g.w:g.v,b=f.edge(v,d),w=b!==void 0?b.weight:0;f.setEdge(v,d,{weight:s.edge(g).weight+w})}),Object.hasOwn(h,"minRank")&&f.setNode(d,{borderLeft:h.borderLeft[o],borderRight:h.borderRight[o]}))}),f}function r(s){for(var o;s.hasNode(o=t.uniqueId("_root")););return o}return Mg}var Og,Bk;function fZ(){if(Bk)return Og;Bk=1,Og=e;function e(t,n,r){let s={},o;r.forEach(l=>{let u=t.parent(l),f,d;for(;u;){if(f=t.parent(u),f?(d=s[f],s[f]=u):(d=o,o=u),d&&d!==u){n.setEdge(d,u);return}u=f}})}return Og}var Rg,Uk;function dZ(){if(Uk)return Rg;Uk=1;let e=iZ(),t=sZ(),n=uZ(),r=cZ(),s=fZ(),o=sr().Graph,l=Ot();Rg=u;function u(p,g){if(g&&typeof g.customOrder=="function"){g.customOrder(p,u);return}let v=l.maxRank(p),b=f(p,l.range(1,v+1),"inEdges"),w=f(p,l.range(v-1,-1,-1),"outEdges"),_=e(p);if(h(p,_),g&&g.disableOptimalOrderHeuristic)return;let E=Number.POSITIVE_INFINITY,T;for(let S=0,M=0;M<4;++S,++M){d(S%2?b:w,S%4>=2),_=l.buildLayerMatrix(p);let D=t(p,_);D<E&&(M=0,T=Object.assign({},_),E=D)}h(p,T)}function f(p,g,v){return g.map(function(b){return r(p,b,v)})}function d(p,g){let v=new o;p.forEach(function(b){let w=b.graph().root,_=n(b,w,v,g);_.vs.forEach((E,T)=>b.node(E).order=T),s(b,v,_.vs)})}function h(p,g){Object.values(g).forEach(v=>v.forEach((b,w)=>p.node(b).order=w))}return Rg}var Dg,Hk;function hZ(){if(Hk)return Dg;Hk=1;let e=sr().Graph,t=Ot();Dg={positionX:v,findType1Conflicts:n,findType2Conflicts:r,addConflict:o,hasConflict:l,verticalAlignment:u,horizontalCompaction:f,alignCoordinates:p,findSmallestWidthAlignment:h,balance:g};function n(_,E){let T={};function S(M,D){let R=0,B=0,z=M.length,U=D[D.length-1];return D.forEach((O,V)=>{let H=s(_,O),Q=H?_.node(H).order:z;(H||O===U)&&(D.slice(B,V+1).forEach(j=>{_.predecessors(j).forEach($=>{let I=_.node($),P=I.order;(P<R||Q<P)&&!(I.dummy&&_.node(j).dummy)&&o(T,$,j)})}),B=V+1,R=Q)}),D}return E.length&&E.reduce(S),T}function r(_,E){let T={};function S(D,R,B,z,U){let O;t.range(R,B).forEach(V=>{O=D[V],_.node(O).dummy&&_.predecessors(O).forEach(H=>{let Q=_.node(H);Q.dummy&&(Q.order<z||Q.order>U)&&o(T,H,O)})})}function M(D,R){let B=-1,z,U=0;return R.forEach((O,V)=>{if(_.node(O).dummy==="border"){let H=_.predecessors(O);H.length&&(z=_.node(H[0]).order,S(R,U,V,B,z),U=V,B=z)}S(R,U,R.length,z,D.length)}),R}return E.length&&E.reduce(M),T}function s(_,E){if(_.node(E).dummy)return _.predecessors(E).find(T=>_.node(T).dummy)}function o(_,E,T){if(E>T){let M=E;E=T,T=M}let S=_[E];S||(_[E]=S={}),S[T]=!0}function l(_,E,T){if(E>T){let S=E;E=T,T=S}return!!_[E]&&Object.hasOwn(_[E],T)}function u(_,E,T,S){let M={},D={},R={};return E.forEach(B=>{B.forEach((z,U)=>{M[z]=z,D[z]=z,R[z]=U})}),E.forEach(B=>{let z=-1;B.forEach(U=>{let O=S(U);if(O.length){O=O.sort((H,Q)=>R[H]-R[Q]);let V=(O.length-1)/2;for(let H=Math.floor(V),Q=Math.ceil(V);H<=Q;++H){let j=O[H];D[U]===U&&z<R[j]&&!l(T,U,j)&&(D[j]=U,D[U]=M[U]=M[j],z=R[j])}}})}),{root:M,align:D}}function f(_,E,T,S,M){let D={},R=d(_,E,T,M),B=M?"borderLeft":"borderRight";function z(V,H){let Q=R.nodes(),j=Q.pop(),$={};for(;j;)$[j]?V(j):($[j]=!0,Q.push(j),Q=Q.concat(H(j))),j=Q.pop()}function U(V){D[V]=R.inEdges(V).reduce((H,Q)=>Math.max(H,D[Q.v]+R.edge(Q)),0)}function O(V){let H=R.outEdges(V).reduce((j,$)=>Math.min(j,D[$.w]-R.edge($)),Number.POSITIVE_INFINITY),Q=_.node(V);H!==Number.POSITIVE_INFINITY&&Q.borderType!==B&&(D[V]=Math.max(D[V],H))}return z(U,R.predecessors.bind(R)),z(O,R.successors.bind(R)),Object.keys(S).forEach(V=>D[V]=D[T[V]]),D}function d(_,E,T,S){let M=new e,D=_.graph(),R=b(D.nodesep,D.edgesep,S);return E.forEach(B=>{let z;B.forEach(U=>{let O=T[U];if(M.setNode(O),z){var V=T[z],H=M.edge(V,O);M.setEdge(V,O,Math.max(R(_,U,z),H||0))}z=U})}),M}function h(_,E){return Object.values(E).reduce((T,S)=>{let M=Number.NEGATIVE_INFINITY,D=Number.POSITIVE_INFINITY;Object.entries(S).forEach(([B,z])=>{let U=w(_,B)/2;M=Math.max(z+U,M),D=Math.min(z-U,D)});const R=M-D;return R<T[0]&&(T=[R,S]),T},[Number.POSITIVE_INFINITY,null])[1]}function p(_,E){let T=Object.values(E),S=t.applyWithChunking(Math.min,T),M=t.applyWithChunking(Math.max,T);["u","d"].forEach(D=>{["l","r"].forEach(R=>{let B=D+R,z=_[B];if(z===E)return;let U=Object.values(z),O=S-t.applyWithChunking(Math.min,U);R!=="l"&&(O=M-t.applyWithChunking(Math.max,U)),O&&(_[B]=t.mapValues(z,V=>V+O))})})}function g(_,E){return t.mapValues(_.ul,(T,S)=>{if(E)return _[E.toLowerCase()][S];{let M=Object.values(_).map(D=>D[S]).sort((D,R)=>D-R);return(M[1]+M[2])/2}})}function v(_){let E=t.buildLayerMatrix(_),T=Object.assign(n(_,E),r(_,E)),S={},M;["u","d"].forEach(R=>{M=R==="u"?E:Object.values(E).reverse(),["l","r"].forEach(B=>{B==="r"&&(M=M.map(V=>Object.values(V).reverse()));let z=(R==="u"?_.predecessors:_.successors).bind(_),U=u(_,M,T,z),O=f(_,M,U.root,U.align,B==="r");B==="r"&&(O=t.mapValues(O,V=>-V)),S[R+B]=O})});let D=h(_,S);return p(S,D),g(S,_.graph().align)}function b(_,E,T){return(S,M,D)=>{let R=S.node(M),B=S.node(D),z=0,U;if(z+=R.width/2,Object.hasOwn(R,"labelpos"))switch(R.labelpos.toLowerCase()){case"l":U=-R.width/2;break;case"r":U=R.width/2;break}if(U&&(z+=T?U:-U),U=0,z+=(R.dummy?E:_)/2,z+=(B.dummy?E:_)/2,z+=B.width/2,Object.hasOwn(B,"labelpos"))switch(B.labelpos.toLowerCase()){case"l":U=B.width/2;break;case"r":U=-B.width/2;break}return U&&(z+=T?U:-U),U=0,z}}function w(_,E){return _.node(E).width}return Dg}var jg,Fk;function mZ(){if(Fk)return jg;Fk=1;let e=Ot(),t=hZ().positionX;jg=n;function n(s){s=e.asNonCompoundGraph(s),r(s),Object.entries(t(s)).forEach(([o,l])=>s.node(o).x=l)}function r(s){let o=e.buildLayerMatrix(s),l=s.graph().ranksep,u=0;o.forEach(f=>{const d=f.reduce((h,p)=>{const g=s.node(p).height;return h>g?h:g},0);f.forEach(h=>s.node(h).y=u+d/2),u+=d+l})}return jg}var zg,$k;function pZ(){if($k)return zg;$k=1;let e=QY(),t=KY(),n=JY(),r=Ot().normalizeRanks,s=eZ(),o=Ot().removeEmptyRanks,l=tZ(),u=nZ(),f=rZ(),d=dZ(),h=mZ(),p=Ot(),g=sr().Graph;zg=v;function v(C,F){let W=F&&F.debugTiming?p.time:p.notime;W("layout",()=>{let J=W(" buildLayoutGraph",()=>z(C));W(" runLayout",()=>b(J,W,F)),W(" updateInputGraph",()=>w(C,J))})}function b(C,F,W){F(" makeSpaceForEdgeLabels",()=>U(C)),F(" removeSelfEdges",()=>Y(C)),F(" acyclic",()=>e.run(C)),F(" nestingGraph.run",()=>l.run(C)),F(" rank",()=>n(p.asNonCompoundGraph(C))),F(" injectEdgeLabelProxies",()=>O(C)),F(" removeEmptyRanks",()=>o(C)),F(" nestingGraph.cleanup",()=>l.cleanup(C)),F(" normalizeRanks",()=>r(C)),F(" assignRankMinMax",()=>V(C)),F(" removeEdgeLabelProxies",()=>H(C)),F(" normalize.run",()=>t.run(C)),F(" parentDummyChains",()=>s(C)),F(" addBorderSegments",()=>u(C)),F(" order",()=>d(C,W)),F(" insertSelfEdges",()=>Z(C)),F(" adjustCoordinateSystem",()=>f.adjust(C)),F(" position",()=>h(C)),F(" positionSelfEdges",()=>k(C)),F(" removeBorderNodes",()=>P(C)),F(" normalize.undo",()=>t.undo(C)),F(" fixupEdgeLabelCoords",()=>$(C)),F(" undoCoordinateSystem",()=>f.undo(C)),F(" translateGraph",()=>Q(C)),F(" assignNodeIntersects",()=>j(C)),F(" reversePoints",()=>I(C)),F(" acyclic.undo",()=>e.undo(C))}function w(C,F){C.nodes().forEach(W=>{let J=C.node(W),oe=F.node(W);J&&(J.x=oe.x,J.y=oe.y,J.rank=oe.rank,F.children(W).length&&(J.width=oe.width,J.height=oe.height))}),C.edges().forEach(W=>{let J=C.edge(W),oe=F.edge(W);J.points=oe.points,Object.hasOwn(oe,"x")&&(J.x=oe.x,J.y=oe.y)}),C.graph().width=F.graph().width,C.graph().height=F.graph().height}let _=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},T=["acyclicer","ranker","rankdir","align"],S=["width","height"],M={width:0,height:0},D=["minlen","weight","width","height","labeloffset"],R={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},B=["labelpos"];function z(C){let F=new g({multigraph:!0,compound:!0}),W=te(C.graph());return F.setGraph(Object.assign({},E,G(W,_),p.pick(W,T))),C.nodes().forEach(J=>{let oe=te(C.node(J));const ce=G(oe,S);Object.keys(M).forEach(ge=>{ce[ge]===void 0&&(ce[ge]=M[ge])}),F.setNode(J,ce),F.setParent(J,C.parent(J))}),C.edges().forEach(J=>{let oe=te(C.edge(J));F.setEdge(J,Object.assign({},R,G(oe,D),p.pick(oe,B)))}),F}function U(C){let F=C.graph();F.ranksep/=2,C.edges().forEach(W=>{let J=C.edge(W);J.minlen*=2,J.labelpos.toLowerCase()!=="c"&&(F.rankdir==="TB"||F.rankdir==="BT"?J.width+=J.labeloffset:J.height+=J.labeloffset)})}function O(C){C.edges().forEach(F=>{let W=C.edge(F);if(W.width&&W.height){let J=C.node(F.v),ce={rank:(C.node(F.w).rank-J.rank)/2+J.rank,e:F};p.addDummyNode(C,"edge-proxy",ce,"_ep")}})}function V(C){let F=0;C.nodes().forEach(W=>{let J=C.node(W);J.borderTop&&(J.minRank=C.node(J.borderTop).rank,J.maxRank=C.node(J.borderBottom).rank,F=Math.max(F,J.maxRank))}),C.graph().maxRank=F}function H(C){C.nodes().forEach(F=>{let W=C.node(F);W.dummy==="edge-proxy"&&(C.edge(W.e).labelRank=W.rank,C.removeNode(F))})}function Q(C){let F=Number.POSITIVE_INFINITY,W=0,J=Number.POSITIVE_INFINITY,oe=0,ce=C.graph(),ge=ce.marginx||0,ke=ce.marginy||0;function _e(ye){let je=ye.x,ze=ye.y,ot=ye.width,ft=ye.height;F=Math.min(F,je-ot/2),W=Math.max(W,je+ot/2),J=Math.min(J,ze-ft/2),oe=Math.max(oe,ze+ft/2)}C.nodes().forEach(ye=>_e(C.node(ye))),C.edges().forEach(ye=>{let je=C.edge(ye);Object.hasOwn(je,"x")&&_e(je)}),F-=ge,J-=ke,C.nodes().forEach(ye=>{let je=C.node(ye);je.x-=F,je.y-=J}),C.edges().forEach(ye=>{let je=C.edge(ye);je.points.forEach(ze=>{ze.x-=F,ze.y-=J}),Object.hasOwn(je,"x")&&(je.x-=F),Object.hasOwn(je,"y")&&(je.y-=J)}),ce.width=W-F+ge,ce.height=oe-J+ke}function j(C){C.edges().forEach(F=>{let W=C.edge(F),J=C.node(F.v),oe=C.node(F.w),ce,ge;W.points?(ce=W.points[0],ge=W.points[W.points.length-1]):(W.points=[],ce=oe,ge=J),W.points.unshift(p.intersectRect(J,ce)),W.points.push(p.intersectRect(oe,ge))})}function $(C){C.edges().forEach(F=>{let W=C.edge(F);if(Object.hasOwn(W,"x"))switch((W.labelpos==="l"||W.labelpos==="r")&&(W.width-=W.labeloffset),W.labelpos){case"l":W.x-=W.width/2+W.labeloffset;break;case"r":W.x+=W.width/2+W.labeloffset;break}})}function I(C){C.edges().forEach(F=>{let W=C.edge(F);W.reversed&&W.points.reverse()})}function P(C){C.nodes().forEach(F=>{if(C.children(F).length){let W=C.node(F),J=C.node(W.borderTop),oe=C.node(W.borderBottom),ce=C.node(W.borderLeft[W.borderLeft.length-1]),ge=C.node(W.borderRight[W.borderRight.length-1]);W.width=Math.abs(ge.x-ce.x),W.height=Math.abs(oe.y-J.y),W.x=ce.x+W.width/2,W.y=J.y+W.height/2}}),C.nodes().forEach(F=>{C.node(F).dummy==="border"&&C.removeNode(F)})}function Y(C){C.edges().forEach(F=>{if(F.v===F.w){var W=C.node(F.v);W.selfEdges||(W.selfEdges=[]),W.selfEdges.push({e:F,label:C.edge(F)}),C.removeEdge(F)}})}function Z(C){var F=p.buildLayerMatrix(C);F.forEach(W=>{var J=0;W.forEach((oe,ce)=>{var ge=C.node(oe);ge.order=ce+J,(ge.selfEdges||[]).forEach(ke=>{p.addDummyNode(C,"selfedge",{width:ke.label.width,height:ke.label.height,rank:ge.rank,order:ce+ ++J,e:ke.e,label:ke.label},"_se")}),delete ge.selfEdges})})}function k(C){C.nodes().forEach(F=>{var W=C.node(F);if(W.dummy==="selfedge"){var J=C.node(W.e.v),oe=J.x+J.width/2,ce=J.y,ge=W.x-oe,ke=J.height/2;C.setEdge(W.e,W.label),C.removeNode(F),W.label.points=[{x:oe+2*ge/3,y:ce-ke},{x:oe+5*ge/6,y:ce-ke},{x:oe+ge,y:ce},{x:oe+5*ge/6,y:ce+ke},{x:oe+2*ge/3,y:ce+ke}],W.label.x=W.x,W.label.y=W.y}})}function G(C,F){return p.mapValues(p.pick(C,F),Number)}function te(C){var F={};return C&&Object.entries(C).forEach(([W,J])=>{typeof W=="string"&&(W=W.toLowerCase()),F[W]=J}),F}return zg}var Lg,qk;function gZ(){if(qk)return Lg;qk=1;let e=Ot(),t=sr().Graph;Lg={debugOrdering:n};function n(r){let s=e.buildLayerMatrix(r),o=new t({compound:!0,multigraph:!0}).setGraph({});return r.nodes().forEach(l=>{o.setNode(l,{label:l}),o.setParent(l,"layer"+r.node(l).rank)}),r.edges().forEach(l=>o.setEdge(l.v,l.w,{},l.name)),s.forEach((l,u)=>{let f="layer"+u;o.setNode(f,{rank:"same"}),l.reduce((d,h)=>(o.setEdge(d,h,{style:"invis"}),h))}),o}return Lg}var Pg,Gk;function yZ(){return Gk||(Gk=1,Pg="1.1.4"),Pg}var Ig,Yk;function vZ(){return Yk||(Yk=1,Ig={graphlib:sr(),layout:pZ(),debug:gZ(),util:{time:Ot().time,notime:Ot().notime},version:yZ()}),Ig}var xZ=vZ();const Zk=Fi(xZ);function bZ(e){const t=new Map,n=[],r=o=>{const l=o.id.split(":"),u=l.slice(0,-1).join(":");if(l.length!==1){if(!t.has(u)){const f={id:u,type:"group",data:{label:u.split(":").pop(),name:u.split(":").pop()},position:{x:0,y:0},style:{},parentId:void 0},d=r(f);d&&(f.parentId=d.id),t.set(u,f)}return t.get(u)}};return e.forEach(o=>{const l={...o,id:o.id.toString(),position:{x:0,y:0},data:{label:o.id.split(":").pop(),name:o.id.split(":").pop()}},u=r(l);u&&(l.parentId=u.id.toString()),n.push(l)}),[...Array.from(t.values()),...n]}const wZ={group:({data:e})=>A.jsx("div",{className:"absolute bottom-full left-0",children:A.jsx("span",{children:e.name})})},_Z=(e,t)=>{const n=e.map(r=>{const s=t.find(f=>f.id===r.source.toString()),o=t.find(f=>f.id===r.target.toString()),l=s==null?void 0:s.id,u=o==null?void 0:o.id;return{id:`${l}=${u}`,source:l,target:u,animated:r.conditional,label:r.data,style:{stroke:r.conditional?"#2563eb":"#64748b"}}});if(!n.find(r=>r.target==="__end__")){const r=[...t].reverse().find(s=>s.id.endsWith(":__end__"));r&&n.push({id:`${r.id}=__end__`,source:r.id,target:"__end__",type:"smoothstep"})}return n},SZ=()=>{const{fitView:e}=vd(),{graphVisualize:t,currentNodeName:n}=js(),r=t||{nodes:[],edges:[]},s=bZ(r.nodes.map(v=>({...v,type:"default"}))),o=_Z(r.edges,s),[l,u,f]=uY(s),[d,h,p]=cY(o),g=X.useCallback(v=>{const b=Xk(l,d,{direction:v});u([...b.nodes]),h([...b.edges]),e()},[l,d]);return X.useEffect(()=>{if(r.nodes.length>0){const v=Xk(s,o,{direction:"TB"});u([...v.nodes]),h([...v.edges]),e()}},[r]),X.useEffect(()=>{const v=l.findIndex(b=>b.id.endsWith(n));if(v!==-1){const b=[...l].map(w=>({...w,selected:!1}));b[v]={...b[v],selected:!0},u(b),e()}},[n]),A.jsx("div",{className:"w-1/3 h-full relative overflow-hidden border-l",children:A.jsxs(lY,{nodes:l,edges:d,onNodesChange:f,onEdgesChange:p,fitView:!0,className:"w-full h-full",nodeTypes:wZ,children:[A.jsx(pY,{}),A.jsx(_Y,{}),A.jsxs(gu,{position:"top-right",className:"flex gap-2",children:[A.jsx("button",{onClick:()=>g("TB"),className:"px-3 py-1.5 bg-white border border-gray-200 rounded-lg text-sm text-gray-700 hover:bg-gray-50 transition-colors",children:"垂直布局"}),A.jsx("button",{onClick:()=>g("LR"),className:"px-3 py-1.5 bg-white border border-gray-200 rounded-lg text-sm text-gray-700 hover:bg-gray-50 transition-colors",children:"水平布局"})]})]})})},Xk=(e,t,n)=>{const r=new Zk.graphlib.Graph({compound:!0,multigraph:!0}).setDefaultEdgeLabel(()=>({}));r.setGraph({rankdir:n.direction,nodesep:40,ranksep:40,edgesep:20}),e.forEach(u=>{u.type!=="group"&&r.setNode(u.id,{...u,width:128,height:20})}),t.forEach(u=>r.setEdge(u.source,u.target)),Zk.layout(r);const s=e.map(u=>{const f=r.node(u.id);if(!f)return{...u};let d=0,h=0;return d=f.x+((f==null?void 0:f.width)??0),h=f.y+((f==null?void 0:f.height)??0),{...u,position:{x:d,y:h},_p:f,width:f.width,height:f.height}}),o=new Map,l=15;return[...s].reverse().forEach(u=>{if(u.type==="group"){const f=o.get(u.id)||[],d=Math.min(...f.map(v=>v.position.x)),h=Math.min(...f.map(v=>v.position.y)),p=Math.max(...f.map(v=>v.position.x+(v.width??0))),g=Math.max(...f.map(v=>v.position.y+(v.height??0)));u.position.x=d-l,u.position.y=h-l,u.width=p-d+l*2,u.height=g-h+l*2,f.forEach(v=>{v.position.x=v.position.x-u.position.x,v.position.y=v.position.y-u.position.y})}u.parentId&&o.set(u.parentId,[...o.get(u.parentId)??[],u])}),{nodes:s,edges:t}};function EZ(){return A.jsx(QN,{children:A.jsx(SZ,{})})}const kZ=()=>A.jsx(EZ,{});/**
|
|
232
|
+
* @license
|
|
233
|
+
* Copyright 2019 Google LLC
|
|
234
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
235
|
+
*/const aM=Symbol("Comlink.proxy"),TZ=Symbol("Comlink.endpoint"),CZ=Symbol("Comlink.releaseProxy"),Vg=Symbol("Comlink.finalizer"),xf=Symbol("Comlink.thrown"),oM=e=>typeof e=="object"&&e!==null||typeof e=="function",AZ={canHandle:e=>oM(e)&&e[aM],serialize(e){const{port1:t,port2:n}=new MessageChannel;return uM(e,t),[n,[n]]},deserialize(e){return e.start(),fM(e)}},NZ={canHandle:e=>oM(e)&&xf in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},lM=new Map([["proxy",AZ],["throw",NZ]]);function MZ(e,t){for(const n of e)if(t===n||n==="*"||n instanceof RegExp&&n.test(t))return!0;return!1}function uM(e,t=globalThis,n=["*"]){t.addEventListener("message",function r(s){if(!s||!s.data)return;if(!MZ(n,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:o,type:l,path:u}=Object.assign({path:[]},s.data),f=(s.data.argumentList||[]).map(vs);let d;try{const h=u.slice(0,-1).reduce((g,v)=>g[v],e),p=u.reduce((g,v)=>g[v],e);switch(l){case"GET":d=p;break;case"SET":h[u.slice(-1)[0]]=vs(s.data.value),d=!0;break;case"APPLY":d=p.apply(h,f);break;case"CONSTRUCT":{const g=new p(...f);d=LZ(g)}break;case"ENDPOINT":{const{port1:g,port2:v}=new MessageChannel;uM(e,v),d=zZ(g,[g])}break;case"RELEASE":d=void 0;break;default:return}}catch(h){d={value:h,[xf]:0}}Promise.resolve(d).catch(h=>({value:h,[xf]:0})).then(h=>{const[p,g]=Kf(h);t.postMessage(Object.assign(Object.assign({},p),{id:o}),g),l==="RELEASE"&&(t.removeEventListener("message",r),cM(t),Vg in e&&typeof e[Vg]=="function"&&e[Vg]())}).catch(h=>{const[p,g]=Kf({value:new TypeError("Unserializable return value"),[xf]:0});t.postMessage(Object.assign(Object.assign({},p),{id:o}),g)})}),t.start&&t.start()}function OZ(e){return e.constructor.name==="MessagePort"}function cM(e){OZ(e)&&e.close()}function fM(e,t){const n=new Map;return e.addEventListener("message",function(s){const{data:o}=s;if(!o||!o.id)return;const l=n.get(o.id);if(l)try{l(o)}finally{n.delete(o.id)}}),Yy(e,n,[],t)}function af(e){if(e)throw new Error("Proxy has been released and is not useable")}function dM(e){return Ta(e,new Map,{type:"RELEASE"}).then(()=>{cM(e)})}const Xf=new WeakMap,Qf="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(Xf.get(e)||0)-1;Xf.set(e,t),t===0&&dM(e)});function RZ(e,t){const n=(Xf.get(t)||0)+1;Xf.set(t,n),Qf&&Qf.register(e,t,e)}function DZ(e){Qf&&Qf.unregister(e)}function Yy(e,t,n=[],r=function(){}){let s=!1;const o=new Proxy(r,{get(l,u){if(af(s),u===CZ)return()=>{DZ(o),dM(e),t.clear(),s=!0};if(u==="then"){if(n.length===0)return{then:()=>o};const f=Ta(e,t,{type:"GET",path:n.map(d=>d.toString())}).then(vs);return f.then.bind(f)}return Yy(e,t,[...n,u])},set(l,u,f){af(s);const[d,h]=Kf(f);return Ta(e,t,{type:"SET",path:[...n,u].map(p=>p.toString()),value:d},h).then(vs)},apply(l,u,f){af(s);const d=n[n.length-1];if(d===TZ)return Ta(e,t,{type:"ENDPOINT"}).then(vs);if(d==="bind")return Yy(e,t,n.slice(0,-1));const[h,p]=Qk(f);return Ta(e,t,{type:"APPLY",path:n.map(g=>g.toString()),argumentList:h},p).then(vs)},construct(l,u){af(s);const[f,d]=Qk(u);return Ta(e,t,{type:"CONSTRUCT",path:n.map(h=>h.toString()),argumentList:f},d).then(vs)}});return RZ(o,e),o}function jZ(e){return Array.prototype.concat.apply([],e)}function Qk(e){const t=e.map(Kf);return[t.map(n=>n[0]),jZ(t.map(n=>n[1]))]}const hM=new WeakMap;function zZ(e,t){return hM.set(e,t),e}function LZ(e){return Object.assign(e,{[aM]:!0})}function PZ(e,t=globalThis,n="*"){return{postMessage:(r,s)=>e.postMessage(r,n,s),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function Kf(e){for(const[t,n]of lM)if(n.canHandle(e)){const[r,s]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},s]}return[{type:"RAW",value:e},hM.get(e)||[]]}function vs(e){switch(e.type){case"HANDLER":return lM.get(e.name).deserialize(e.value);case"RAW":return e.value}}function Ta(e,t,n,r){return new Promise(s=>{const o=IZ();t.set(o,s),e.start&&e.start(),e.postMessage(Object.assign({id:o},n),r)})}function IZ(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const VZ=()=>{const{currentArtifact:e}=id();return e?A.jsx("div",{className:"h-full w-full overflow-auto",children:A.jsx("pre",{children:e.code})}):A.jsx("div",{className:"h-full w-full flex items-center justify-center text-gray-500",children:"请选择一个文件"})},BZ=()=>{const e=X.useRef(null),[t,n]=X.useState(!1),{currentArtifact:r,getArtifactVersions:s,setCurrentArtifactById:o,artifacts:l}=id(),[u,f]=X.useState(0),[d,h]=X.useState("preview"),[p,g]=X.useState(!1),v=async T=>{const S=fM(PZ(T.contentWindow));return await Promise.race(Array(100).fill(0).map((M,D)=>new Promise(R=>{setTimeout(async()=>{await S.init()&&R(D)},100*D)}))),S},b=async()=>{if(console.log(u),!!e.current){n(!0);try{await(await v(e.current)).run(r==null?void 0:r.code,r==null?void 0:r.filename,r==null?void 0:r.filetype)}catch(T){console.error("Failed to run code:",T)}finally{n(!1)}}},w=()=>{f(T=>T+1)};if(X.useEffect(()=>{e.current&&b()},[u]),!r)return A.jsx("div",{className:"h-full w-full flex items-center justify-center text-gray-500",children:"请选择一个文件"});const _=s(r.filename),E=Array.from(new Set(l.map(T=>T.filename)));return A.jsxs("div",{className:"h-full w-full flex flex-col",children:[A.jsxs("div",{className:"flex items-center justify-between p-2 border-b",children:[A.jsxs("div",{className:"flex items-center space-x-4",children:[A.jsxs("div",{className:"flex space-x-2",children:[A.jsx("button",{className:`px-3 py-1 rounded ${d==="preview"?"bg-blue-500 text-white":"bg-gray-100 text-gray-700"}`,onClick:()=>{h("preview"),w()},children:"预览"}),A.jsx("button",{className:`px-3 py-1 rounded ${d==="source"?"bg-blue-500 text-white":"bg-gray-100 text-gray-700"}`,onClick:()=>h("source"),children:"源代码"})]}),A.jsxs("div",{className:"relative",children:[A.jsxs("button",{className:"flex items-center space-x-2 px-3 py-1 bg-gray-100 rounded hover:bg-gray-200",onClick:()=>g(!p),children:[A.jsx("span",{children:r.filename}),A.jsx(LI,{className:"w-4 h-4"})]}),p&&A.jsx("div",{className:"absolute top-full left-0 mt-1 w-48 bg-white border rounded-md shadow-lg z-10",children:E.map(T=>{const S=s(T),M=S[S.length-1];return A.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100",onClick:()=>{o(M.id),g(!1)},children:T},T)})})]}),A.jsxs("div",{className:"flex items-center space-x-2",children:[A.jsx("span",{className:"text-sm text-gray-500",children:"版本:"}),A.jsx("div",{className:"flex space-x-1",children:_.map(T=>A.jsxs("button",{className:`px-2 py-1 text-sm rounded ${T.id===r.id?"bg-blue-500 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,onClick:()=>o(T.id),children:["v",T.version]},T.id))})]})]}),d==="preview"&&A.jsxs("div",{className:"flex space-x-2",children:[A.jsx("button",{disabled:t,className:"px-3 py-1 bg-gray-100 rounded hover:bg-gray-200 disabled:opacity-50",children:t?"Running...":"Run"}),A.jsx("button",{onClick:w,disabled:t,className:"px-3 py-1 bg-gray-100 rounded hover:bg-gray-200 disabled:opacity-50",children:"Refresh"})]})]}),A.jsx("div",{className:"flex-1 overflow-auto",children:d==="preview"?A.jsx("iframe",{ref:e,src:"https://langgraph-artifacts.netlify.app/index.html",className:"w-full h-full border border-gray-300"},u):A.jsx(VZ,{})})]})},UZ=()=>{const{renderMessages:e,loading:t,inChatError:n,client:r,collapsedTools:s,toggleToolCollapse:o,isFELocking:l}=js(),u=X.useRef(null),f=X.useRef(null),d=()=>{if(!f.current)return!1;const p=f.current,g=p.scrollTop+p.clientHeight;return p.scrollHeight-g<=p.clientHeight*.3},h=()=>{var p;(p=u.current)==null||p.scrollIntoView({behavior:"smooth"})};return X.useEffect(()=>{e.length>0&&f.current&&(t||h(),t&&d()&&h())},[e]),A.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-4",ref:f,children:[A.jsx(fA,{renderMessages:e,collapsedTools:s,toggleToolCollapse:o,client:r}),t&&!l()&&A.jsxs("div",{className:"flex items-center justify-center py-4 text-gray-500",children:[A.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-blue-500 border-t-transparent mr-2"}),"正在思考中..."]}),n&&A.jsx("div",{className:"p-4 text-sm text-red-600 bg-red-50 rounded-lg border border-red-200",children:JSON.stringify(n)}),A.jsx("div",{ref:u})]})},HZ=()=>{const{userInput:e,setUserInput:t,loading:n,sendMessage:r,stopGeneration:s,currentAgent:o,setCurrentAgent:l,client:u}=js(),{extraParams:f}=hA(),[d,h]=X.useState([]),p=w=>{h(_=>[..._,w])},g=w=>{localStorage.setItem("agent_name",w),l(w)},v=()=>{const w=[{type:"human",content:[{type:"text",text:e},...d.map(_=>({type:"image_url",image_url:{url:_}}))]}];r(w,{extraParams:f}),h([])},b=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),v())};return A.jsxs("div",{className:"border-t border-gray-200 p-4",children:[A.jsxs("div",{className:"flex items-center justify-between mb-4",children:[A.jsx(PU,{onFileUploaded:p}),A.jsx("select",{value:o,onChange:w=>g(w.target.value),className:"px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:u==null?void 0:u.availableAssistants.map(w=>A.jsx("option",{value:w.graph_id,children:w.name},w.graph_id))})]}),A.jsxs("div",{className:"flex gap-2",children:[A.jsx("textarea",{className:"flex-1 p-3 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none",rows:2,value:e,onChange:w=>t(w.target.value),onKeyDown:b,placeholder:"输入消息...",disabled:n}),A.jsx("button",{className:`px-4 py-2 text-sm font-medium text-white rounded-lg focus:outline-none focus:ring-2 focus:ring-offset-2 ${n?"bg-red-500 hover:bg-red-600 focus:ring-red-500":"bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"}`,onClick:()=>n?s():v(),disabled:!n&&!e.trim()&&d.length===0,children:n?"中断":"发送"})]}),A.jsx("div",{className:"flex border-b border-gray-200 mt-4",children:A.jsx(Zy,{usage_metadata:(u==null?void 0:u.tokenCounter)||{}})})]})},FZ=()=>{const[e,t]=X.useState(!1),{showHistory:n,toggleHistoryVisible:r,showGraph:s,toggleGraphVisible:o,renderMessages:l}=js(),{extraParams:u,setExtraParams:f}=hA(),{showArtifact:d,setShowArtifact:h}=id();return A.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[n&&A.jsx(DU,{onClose:()=>r(),formatTime:j4}),A.jsxs("div",{className:"flex-1 flex flex-col overflow-auto",children:[A.jsxs("div",{className:"flex items-center gap-2 p-4 border-b border-gray-200 justify-end h-16",children:[A.jsxs("button",{className:"px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 flex items-center gap-1.5",onClick:()=>{r(),z_({showHistory:!n})},children:[A.jsx(XI,{className:"w-4 h-4"}),"历史记录"]}),A.jsx("div",{className:"flex-1"}),A.jsx(BU,{}),A.jsxs("button",{onClick:()=>t(!0),className:"px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 flex items-center gap-1.5",children:[A.jsx(b2,{className:"w-4 h-4"}),"编辑参数"]}),A.jsx("button",{className:"px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 flex items-center gap-1.5",onClick:()=>{console.log(l)},children:"打印日志数据"}),A.jsxs("button",{className:"px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 flex items-center gap-1.5",onClick:()=>{o(),z_({showGraph:!s})},children:[A.jsx(tV,{className:"w-4 h-4"}),"节点图"]}),A.jsxs("button",{className:"px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 flex items-center gap-1.5",onClick:()=>{localStorage.setItem("code",""),location.reload()},children:[A.jsx(JI,{className:"w-4 h-4"}),"退出登陆"]})]}),A.jsx(UZ,{}),A.jsx(HZ,{}),A.jsx(IU,{isOpen:e,initialJson:u,onClose:()=>t(!1),onSave:f})]}),(s||d)&&A.jsxs("div",{className:"overflow-hidden flex-1",children:[s&&A.jsx(kZ,{}),d&&A.jsx(BZ,{})]})]})},$Z=()=>A.jsx(ZV,{children:A.jsx(jU,{children:A.jsx(HV,{children:A.jsx(FZ,{})})})}),qZ=()=>{const[e,t]=X.useState([{key:"authorization",value:""}]),[n,r]=X.useState(localStorage.getItem("withCredentials")==="true"),[s,o]=X.useState(localStorage.getItem("apiUrl")||""),l=()=>{t([...e,{key:"",value:""}])},u=h=>{t(e.filter((p,g)=>g!==h))},f=(h,p,g)=>{const v=[...e];v[h][p]=g,t(v)},d=()=>{const h=Object.fromEntries(e.map(p=>[p.key,p.value]));localStorage.setItem("code",JSON.stringify(h)),localStorage.setItem("withCredentials",JSON.stringify(n)),localStorage.setItem("apiUrl",s),location.reload()};return A.jsx("div",{className:"min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 flex items-center justify-center p-4",children:A.jsx("div",{className:"w-full max-w-4xl bg-white rounded-2xl shadow-xl overflow-hidden",children:A.jsxs("div",{className:"grid md:grid-cols-2",children:[A.jsx("div",{className:"hidden md:block bg-gradient-to-br from-blue-600 to-blue-800 p-12 text-white",children:A.jsxs("div",{className:"h-full flex flex-col justify-between",children:[A.jsxs("div",{children:[A.jsx("h1",{className:"text-4xl font-bold mb-6",children:"LangGraph UI"}),A.jsx("p",{className:"text-blue-100 text-lg leading-relaxed",children:"专业的 LangGraph 可视化界面,让您的 AI 应用开发更加高效和直观。"})]}),A.jsxs("div",{className:"space-y-4",children:[A.jsxs("div",{className:"flex items-center space-x-3",children:[A.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center",children:A.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:A.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})})}),A.jsx("span",{children:"直观的可视化界面"})]}),A.jsxs("div",{className:"flex items-center space-x-3",children:[A.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center",children:A.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:A.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),A.jsx("span",{children:"高效的开发体验"})]}),A.jsxs("div",{className:"flex items-center space-x-3",children:[A.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center",children:A.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:A.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),A.jsx("span",{children:"安全可靠的配置"})]})]})]})}),A.jsxs("div",{className:"p-8 md:p-12",children:[A.jsxs("div",{className:"md:hidden mb-8",children:[A.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"LangGraph UI"}),A.jsx("p",{className:"text-gray-600 mt-2",children:"专业的 LangGraph 可视化界面"})]}),A.jsxs("form",{onSubmit:h=>{h.preventDefault(),d()},className:"space-y-6",children:[A.jsxs("div",{children:[A.jsx("label",{htmlFor:"api-url",className:"block text-sm font-medium text-gray-700 mb-2",children:"API URL"}),A.jsx("input",{type:"text",id:"api-url",value:s,onChange:h=>o(h.target.value),placeholder:"例如: http://localhost:8123",className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all"})]}),A.jsxs("div",{children:[A.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"请求头配置"}),e.map((h,p)=>A.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[A.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[A.jsx("div",{children:A.jsx("input",{type:"text",id:`header-key-${p}`,value:h.key,onChange:g=>f(p,"key",g.target.value),placeholder:"例如: authorization",required:!0,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all"})}),A.jsx("div",{children:A.jsx("input",{type:"text",id:`header-value-${p}`,value:h.value,onChange:g=>f(p,"value",g.target.value),placeholder:"例如: Bearer token;无则填 1",required:!0,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all"})})]}),p>0&&A.jsxs("button",{type:"button",onClick:()=>u(p),className:"text-red-600 hover:text-red-700 text-sm font-medium flex items-center space-x-1 transition-colors",children:[A.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:A.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),A.jsx("span",{children:"删除此请求头"})]})]},p))]}),A.jsxs("div",{className:"flex items-center space-x-3",children:[A.jsx("input",{type:"checkbox",id:"with-credentials",checked:n,onChange:h=>r(h.target.checked),className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"}),A.jsx("label",{htmlFor:"with-credentials",className:"text-sm text-gray-700",children:"启用 withCredentials(跨域请求时发送 Cookie)"})]}),A.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 pt-4",children:[A.jsxs("button",{type:"button",onClick:l,className:"flex-1 px-6 py-3 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors font-medium flex items-center justify-center space-x-2",children:[A.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:A.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),A.jsx("span",{children:"添加请求头"})]}),A.jsxs("button",{type:"submit",className:"flex-1 px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium flex items-center justify-center space-x-2",children:[A.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:A.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})}),A.jsx("span",{children:"保存配置"})]})]})]})]})]})})})};function GZ(){const[e,t]=X.useState(localStorage.getItem("code"));return A.jsx(A.Fragment,{children:e?A.jsx($Z,{}):A.jsx(qZ,{})})}AR.createRoot(document.getElementById("root")).render(A.jsx(GZ,{}));
|