ima2-gen 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -7
- package/assets/card-news/templates/academy-lesson-square/base.png +0 -0
- package/assets/card-news/templates/academy-lesson-square/preview.png +0 -0
- package/assets/card-news/templates/academy-lesson-square/template.json +20 -0
- package/assets/card-news/templates/clean-report-square/base.png +0 -0
- package/assets/card-news/templates/clean-report-square/preview.png +0 -0
- package/assets/card-news/templates/clean-report-square/template.json +20 -0
- package/bin/commands/cancel.js +45 -0
- package/bin/commands/edit.js +33 -4
- package/bin/commands/gen.js +26 -3
- package/bin/commands/ps.js +48 -16
- package/bin/ima2.js +56 -12
- package/bin/lib/client.js +4 -1
- package/bin/lib/error-hints.js +23 -0
- package/bin/lib/output.js +10 -0
- package/config.js +19 -1
- package/docs/API.md +67 -0
- package/docs/FAQ.ko.md +248 -0
- package/docs/FAQ.md +256 -0
- package/docs/README.ja.md +4 -0
- package/docs/README.ko.md +14 -1
- package/docs/README.zh-CN.md +4 -0
- package/docs/RECOVER_OLD_IMAGES.md +2 -0
- package/lib/cardNewsGenerator.js +162 -0
- package/lib/cardNewsJobStore.js +107 -0
- package/lib/cardNewsManifestStore.js +112 -0
- package/lib/cardNewsPlanner.js +180 -0
- package/lib/cardNewsPlannerClient.js +112 -0
- package/lib/cardNewsPlannerPrompt.js +60 -0
- package/lib/cardNewsPlannerSchema.js +259 -0
- package/lib/cardNewsRoleTemplateStore.js +47 -0
- package/lib/cardNewsTemplateStore.js +210 -0
- package/lib/db.js +20 -3
- package/lib/errorClassify.js +2 -2
- package/lib/generationErrors.js +51 -0
- package/lib/historyList.js +82 -8
- package/lib/inflight.js +117 -34
- package/lib/logger.js +37 -3
- package/lib/oauthLauncher.js +52 -19
- package/lib/oauthProxy.js +81 -14
- package/lib/requestLogger.js +48 -0
- package/lib/runtimePorts.js +93 -0
- package/lib/sessionStore.js +48 -7
- package/package.json +3 -2
- package/routes/cardNews.js +183 -0
- package/routes/edit.js +1 -1
- package/routes/generate.js +10 -10
- package/routes/health.js +27 -3
- package/routes/index.js +2 -0
- package/routes/nodes.js +93 -26
- package/server.js +91 -18
- package/ui/dist/assets/index-BjX_nzuK.js +23 -0
- package/ui/dist/assets/index-BjX_nzuK.js.map +1 -0
- package/ui/dist/assets/index-DHyUax4_.css +1 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/index-CqpVoXpZ.css +0 -1
- package/ui/dist/assets/index-IHSd1z1a.js +0 -22
- package/ui/dist/assets/index-IHSd1z1a.js.map +0 -1
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const u of r)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function o(r){const u={};return r.integrity&&(u.integrity=r.integrity),r.referrerPolicy&&(u.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?u.credentials="include":r.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(r){if(r.ep)return;r.ep=!0;const u=o(r);fetch(r.href,u)}})();function Zy(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var fd={exports:{}},so={};var ap;function nx(){if(ap)return so;ap=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function o(s,r,u){var f=null;if(u!==void 0&&(f=""+u),r.key!==void 0&&(f=""+r.key),"key"in r){u={};for(var g in r)g!=="key"&&(u[g]=r[g])}else u=r;return r=u.ref,{$$typeof:n,type:s,key:f,ref:r!==void 0?r:null,props:u}}return so.Fragment=i,so.jsx=o,so.jsxs=o,so}var ip;function ax(){return ip||(ip=1,fd.exports=nx()),fd.exports}var S=ax(),hd={exports:{}},be={};var lp;function ix(){if(lp)return be;lp=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),y=Symbol.iterator;function x(N){return N===null||typeof N!="object"?null:(N=y&&N[y]||N["@@iterator"],typeof N=="function"?N:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,A={};function M(N,j,W){this.props=N,this.context=j,this.refs=A,this.updater=W||E}M.prototype.isReactComponent={},M.prototype.setState=function(N,j){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,j,"setState")},M.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function H(){}H.prototype=M.prototype;function _(N,j,W){this.props=N,this.context=j,this.refs=A,this.updater=W||E}var z=_.prototype=new H;z.constructor=_,C(z,M.prototype),z.isPureReactComponent=!0;var Y=Array.isArray;function O(){}var I={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function Z(N,j,W){var te=W.ref;return{$$typeof:n,type:N,key:j,ref:te!==void 0?te:null,props:W}}function oe(N,j){return Z(N.type,j,N.props)}function $(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function ee(N){var j={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(W){return j[W]})}var se=/\/+/g;function D(N,j){return typeof N=="object"&&N!==null&&N.key!=null?ee(""+N.key):j.toString(36)}function k(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(O,O):(N.status="pending",N.then(function(j){N.status==="pending"&&(N.status="fulfilled",N.value=j)},function(j){N.status==="pending"&&(N.status="rejected",N.reason=j)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function T(N,j,W,te,ce){var de=typeof N;(de==="undefined"||de==="boolean")&&(N=null);var ue=!1;if(N===null)ue=!0;else switch(de){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(N.$$typeof){case n:case i:ue=!0;break;case m:return ue=N._init,T(ue(N._payload),j,W,te,ce)}}if(ue)return ce=ce(N),ue=te===""?"."+D(N,0):te,Y(ce)?(W="",ue!=null&&(W=ue.replace(se,"$&/")+"/"),T(ce,j,W,"",function(Ee){return Ee})):ce!=null&&($(ce)&&(ce=oe(ce,W+(ce.key==null||N&&N.key===ce.key?"":(""+ce.key).replace(se,"$&/")+"/")+ue)),j.push(ce)),1;ue=0;var re=te===""?".":te+":";if(Y(N))for(var fe=0;fe<N.length;fe++)te=N[fe],de=re+D(te,fe),ue+=T(te,j,W,de,ce);else if(fe=x(N),typeof fe=="function")for(N=fe.call(N),fe=0;!(te=N.next()).done;)te=te.value,de=re+D(te,fe++),ue+=T(te,j,W,de,ce);else if(de==="object"){if(typeof N.then=="function")return T(k(N),j,W,te,ce);throw j=String(N),Error("Objects are not valid as a React child (found: "+(j==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":j)+"). If you meant to render a collection of children, use an array instead.")}return ue}function U(N,j,W){if(N==null)return N;var te=[],ce=0;return T(N,te,"","",function(de){return j.call(W,de,ce++)}),te}function G(N){if(N._status===-1){var j=N._result;j=j(),j.then(function(W){(N._status===0||N._status===-1)&&(N._status=1,N._result=W)},function(W){(N._status===0||N._status===-1)&&(N._status=2,N._result=W)}),N._status===-1&&(N._status=0,N._result=j)}if(N._status===1)return N._result.default;throw N._result}var R=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var j=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(j))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},F={map:U,forEach:function(N,j,W){U(N,function(){j.apply(this,arguments)},W)},count:function(N){var j=0;return U(N,function(){j++}),j},toArray:function(N){return U(N,function(j){return j})||[]},only:function(N){if(!$(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return be.Activity=v,be.Children=F,be.Component=M,be.Fragment=o,be.Profiler=r,be.PureComponent=_,be.StrictMode=s,be.Suspense=p,be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,be.__COMPILER_RUNTIME={__proto__:null,c:function(N){return I.H.useMemoCache(N)}},be.cache=function(N){return function(){return N.apply(null,arguments)}},be.cacheSignal=function(){return null},be.cloneElement=function(N,j,W){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var te=C({},N.props),ce=N.key;if(j!=null)for(de in j.key!==void 0&&(ce=""+j.key),j)!B.call(j,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&j.ref===void 0||(te[de]=j[de]);var de=arguments.length-2;if(de===1)te.children=W;else if(1<de){for(var ue=Array(de),re=0;re<de;re++)ue[re]=arguments[re+2];te.children=ue}return Z(N.type,ce,te)},be.createContext=function(N){return N={$$typeof:f,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:u,_context:N},N},be.createElement=function(N,j,W){var te,ce={},de=null;if(j!=null)for(te in j.key!==void 0&&(de=""+j.key),j)B.call(j,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(ce[te]=j[te]);var ue=arguments.length-2;if(ue===1)ce.children=W;else if(1<ue){for(var re=Array(ue),fe=0;fe<ue;fe++)re[fe]=arguments[fe+2];ce.children=re}if(N&&N.defaultProps)for(te in ue=N.defaultProps,ue)ce[te]===void 0&&(ce[te]=ue[te]);return Z(N,de,ce)},be.createRef=function(){return{current:null}},be.forwardRef=function(N){return{$$typeof:g,render:N}},be.isValidElement=$,be.lazy=function(N){return{$$typeof:m,_payload:{_status:-1,_result:N},_init:G}},be.memo=function(N,j){return{$$typeof:h,type:N,compare:j===void 0?null:j}},be.startTransition=function(N){var j=I.T,W={};I.T=W;try{var te=N(),ce=I.S;ce!==null&&ce(W,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(O,R)}catch(de){R(de)}finally{j!==null&&W.types!==null&&(j.types=W.types),I.T=j}},be.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},be.use=function(N){return I.H.use(N)},be.useActionState=function(N,j,W){return I.H.useActionState(N,j,W)},be.useCallback=function(N,j){return I.H.useCallback(N,j)},be.useContext=function(N){return I.H.useContext(N)},be.useDebugValue=function(){},be.useDeferredValue=function(N,j){return I.H.useDeferredValue(N,j)},be.useEffect=function(N,j){return I.H.useEffect(N,j)},be.useEffectEvent=function(N){return I.H.useEffectEvent(N)},be.useId=function(){return I.H.useId()},be.useImperativeHandle=function(N,j,W){return I.H.useImperativeHandle(N,j,W)},be.useInsertionEffect=function(N,j){return I.H.useInsertionEffect(N,j)},be.useLayoutEffect=function(N,j){return I.H.useLayoutEffect(N,j)},be.useMemo=function(N,j){return I.H.useMemo(N,j)},be.useOptimistic=function(N,j){return I.H.useOptimistic(N,j)},be.useReducer=function(N,j,W){return I.H.useReducer(N,j,W)},be.useRef=function(N){return I.H.useRef(N)},be.useState=function(N){return I.H.useState(N)},be.useSyncExternalStore=function(N,j,W){return I.H.useSyncExternalStore(N,j,W)},be.useTransition=function(){return I.H.useTransition()},be.version="19.2.5",be}var op;function zo(){return op||(op=1,hd.exports=ix()),hd.exports}var V=zo();const go=Zy(V);var gd={exports:{}},ro={},md={exports:{}},pd={};var sp;function lx(){return sp||(sp=1,(function(n){function i(T,U){var G=T.length;T.push(U);e:for(;0<G;){var R=G-1>>>1,F=T[R];if(0<r(F,U))T[R]=U,T[G]=F,G=R;else break e}}function o(T){return T.length===0?null:T[0]}function s(T){if(T.length===0)return null;var U=T[0],G=T.pop();if(G!==U){T[0]=G;e:for(var R=0,F=T.length,N=F>>>1;R<N;){var j=2*(R+1)-1,W=T[j],te=j+1,ce=T[te];if(0>r(W,G))te<F&&0>r(ce,W)?(T[R]=ce,T[te]=G,R=te):(T[R]=W,T[j]=G,R=j);else if(te<F&&0>r(ce,G))T[R]=ce,T[te]=G,R=te;else break e}}return U}function r(T,U){var G=T.sortIndex-U.sortIndex;return G!==0?G:T.id-U.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var f=Date,g=f.now();n.unstable_now=function(){return f.now()-g}}var p=[],h=[],m=1,v=null,y=3,x=!1,E=!1,C=!1,A=!1,M=typeof setTimeout=="function"?setTimeout:null,H=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function z(T){for(var U=o(h);U!==null;){if(U.callback===null)s(h);else if(U.startTime<=T)s(h),U.sortIndex=U.expirationTime,i(p,U);else break;U=o(h)}}function Y(T){if(C=!1,z(T),!E)if(o(p)!==null)E=!0,O||(O=!0,ee());else{var U=o(h);U!==null&&k(Y,U.startTime-T)}}var O=!1,I=-1,B=5,Z=-1;function oe(){return A?!0:!(n.unstable_now()-Z<B)}function $(){if(A=!1,O){var T=n.unstable_now();Z=T;var U=!0;try{e:{E=!1,C&&(C=!1,H(I),I=-1),x=!0;var G=y;try{t:{for(z(T),v=o(p);v!==null&&!(v.expirationTime>T&&oe());){var R=v.callback;if(typeof R=="function"){v.callback=null,y=v.priorityLevel;var F=R(v.expirationTime<=T);if(T=n.unstable_now(),typeof F=="function"){v.callback=F,z(T),U=!0;break t}v===o(p)&&s(p),z(T)}else s(p);v=o(p)}if(v!==null)U=!0;else{var N=o(h);N!==null&&k(Y,N.startTime-T),U=!1}}break e}finally{v=null,y=G,x=!1}U=void 0}}finally{U?ee():O=!1}}}var ee;if(typeof _=="function")ee=function(){_($)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,D=se.port2;se.port1.onmessage=$,ee=function(){D.postMessage(null)}}else ee=function(){M($,0)};function k(T,U){I=M(function(){T(n.unstable_now())},U)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(T){T.callback=null},n.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<T?Math.floor(1e3/T):5},n.unstable_getCurrentPriorityLevel=function(){return y},n.unstable_next=function(T){switch(y){case 1:case 2:case 3:var U=3;break;default:U=y}var G=y;y=U;try{return T()}finally{y=G}},n.unstable_requestPaint=function(){A=!0},n.unstable_runWithPriority=function(T,U){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var G=y;y=T;try{return U()}finally{y=G}},n.unstable_scheduleCallback=function(T,U,G){var R=n.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?R+G:R):G=R,T){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=G+F,T={id:m++,callback:U,priorityLevel:T,startTime:G,expirationTime:F,sortIndex:-1},G>R?(T.sortIndex=G,i(h,T),o(p)===null&&T===o(h)&&(C?(H(I),I=-1):C=!0,k(Y,G-R))):(T.sortIndex=F,i(p,T),E||x||(E=!0,O||(O=!0,ee()))),T},n.unstable_shouldYield=oe,n.unstable_wrapCallback=function(T){var U=y;return function(){var G=y;y=U;try{return T.apply(this,arguments)}finally{y=G}}}})(pd)),pd}var rp;function ox(){return rp||(rp=1,md.exports=lx()),md.exports}var yd={exports:{}},yt={};var cp;function sx(){if(cp)return yt;cp=1;var n=zo();function i(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)h+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(){}var s={d:{f:o,r:function(){throw Error(i(522))},D:o,C:o,L:o,m:o,X:o,S:o,M:o},p:0,findDOMNode:null},r=Symbol.for("react.portal");function u(p,h,m){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:v==null?null:""+v,children:p,containerInfo:h,implementation:m}}var f=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return yt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,yt.createPortal=function(p,h){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(i(299));return u(p,h,null,m)},yt.flushSync=function(p){var h=f.T,m=s.p;try{if(f.T=null,s.p=2,p)return p()}finally{f.T=h,s.p=m,s.d.f()}},yt.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(p,h))},yt.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},yt.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var m=h.as,v=g(m,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,x=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;m==="style"?s.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:v,integrity:y,fetchPriority:x}):m==="script"&&s.d.X(p,{crossOrigin:v,integrity:y,fetchPriority:x,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},yt.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var m=g(h.as,h.crossOrigin);s.d.M(p,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(p)},yt.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var m=h.as,v=g(m,h.crossOrigin);s.d.L(p,m,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},yt.preloadModule=function(p,h){if(typeof p=="string")if(h){var m=g(h.as,h.crossOrigin);s.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(p)},yt.requestFormReset=function(p){s.d.r(p)},yt.unstable_batchedUpdates=function(p,h){return p(h)},yt.useFormState=function(p,h,m){return f.H.useFormState(p,h,m)},yt.useFormStatus=function(){return f.H.useHostTransitionStatus()},yt.version="19.2.5",yt}var up;function $y(){if(up)return yd.exports;up=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),yd.exports=sx(),yd.exports}var dp;function rx(){if(dp)return ro;dp=1;var n=ox(),i=zo(),o=$y();function s(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function f(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(u(e)!==e)throw Error(s(188))}function h(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(s(188));return t!==e?null:e}for(var a=e,l=t;;){var c=a.return;if(c===null)break;var d=c.alternate;if(d===null){if(l=c.return,l!==null){a=l;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===a)return p(c),e;if(d===l)return p(c),t;d=d.sibling}throw Error(s(188))}if(a.return!==l.return)a=c,l=d;else{for(var b=!1,w=c.child;w;){if(w===a){b=!0,a=c,l=d;break}if(w===l){b=!0,l=c,a=d;break}w=w.sibling}if(!b){for(w=d.child;w;){if(w===a){b=!0,a=d,l=c;break}if(w===l){b=!0,l=d,a=c;break}w=w.sibling}if(!b)throw Error(s(189))}}if(a.alternate!==l)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,y=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),_=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),oe=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function ee(e){return e===null||typeof e!="object"?null:(e=$&&e[$]||e["@@iterator"],typeof e=="function"?e:null)}var se=Symbol.for("react.client.reference");function D(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===se?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case M:return"Profiler";case A:return"StrictMode";case Y:return"Suspense";case O:return"SuspenseList";case Z:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case _:return e.displayName||"Context";case H:return(e._context.displayName||"Context")+".Consumer";case z:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case I:return t=e.displayName||null,t!==null?t:D(e.type)||"Memo";case B:t=e._payload,e=e._init;try{return D(e(t))}catch{}}return null}var k=Array.isArray,T=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},R=[],F=-1;function N(e){return{current:e}}function j(e){0>F||(e.current=R[F],R[F]=null,F--)}function W(e,t){F++,R[F]=e.current,e.current=t}var te=N(null),ce=N(null),de=N(null),ue=N(null);function re(e,t){switch(W(de,t),W(ce,e),W(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Tm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Tm(t),e=Am(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}j(te),W(te,e)}function fe(){j(te),j(ce),j(de)}function Ee(e){e.memoizedState!==null&&W(ue,e);var t=te.current,a=Am(t,e.type);t!==a&&(W(ce,e),W(te,a))}function xe(e){ce.current===e&&(j(te),j(ce)),ue.current===e&&(j(ue),ao._currentValue=G)}var ye,Se;function Ce(e){if(ye===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);ye=t&&t[1]||"",Se=-1<a.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+ye+e+Se}var Ie=!1;function Le(e,t){if(!e||Ie)return"";Ie=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(P){var J=P}Reflect.construct(e,[],le)}else{try{le.call()}catch(P){J=P}e.call(le.prototype)}}else{try{throw Error()}catch(P){J=P}(le=e())&&typeof le.catch=="function"&&le.catch(function(){})}}catch(P){if(P&&J&&typeof P.stack=="string")return[P.stack,J.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=l.DetermineComponentFrameRoot(),b=d[0],w=d[1];if(b&&w){var L=b.split(`
|
|
4
|
-
`),Q=w.split(`
|
|
5
|
-
`);for(c=l=0;l<L.length&&!L[l].includes("DetermineComponentFrameRoot");)l++;for(;c<Q.length&&!Q[c].includes("DetermineComponentFrameRoot");)c++;if(l===L.length||c===Q.length)for(l=L.length-1,c=Q.length-1;1<=l&&0<=c&&L[l]!==Q[c];)c--;for(;1<=l&&0<=c;l--,c--)if(L[l]!==Q[c]){if(l!==1||c!==1)do if(l--,c--,0>c||L[l]!==Q[c]){var ne=`
|
|
6
|
-
`+L[l].replace(" at new "," at ");return e.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",e.displayName)),ne}while(1<=l&&0<=c);break}}}finally{Ie=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ce(a):""}function ct(e,t){switch(e.tag){case 26:case 27:case 5:return Ce(e.type);case 16:return Ce("Lazy");case 13:return e.child!==t&&t!==null?Ce("Suspense Fallback"):Ce("Suspense");case 19:return Ce("SuspenseList");case 0:case 15:return Le(e.type,!1);case 11:return Le(e.type.render,!1);case 1:return Le(e.type,!0);case 31:return Ce("Activity");default:return""}}function Kt(e){try{var t="",a=null;do t+=ct(e,a),a=e,e=e.return;while(e);return t}catch(l){return`
|
|
7
|
-
Error generating stack: `+l.message+`
|
|
8
|
-
`+l.stack}}var zt=Object.prototype.hasOwnProperty,Qt=n.unstable_scheduleCallback,yn=n.unstable_cancelCallback,Na=n.unstable_shouldYield,Ta=n.unstable_requestPaint,dt=n.unstable_now,si=n.unstable_getCurrentPriorityLevel,vn=n.unstable_ImmediatePriority,Xn=n.unstable_UserBlockingPriority,Aa=n.unstable_NormalPriority,Qr=n.unstable_LowPriority,ri=n.unstable_IdlePriority,Fr=n.log,Jr=n.unstable_setDisableYieldValue,Ca=null,vt=null;function on(e){if(typeof Fr=="function"&&Jr(e),vt&&typeof vt.setStrictMode=="function")try{vt.setStrictMode(Ca,e)}catch{}}var St=Math.clz32?Math.clz32:ec,Pr=Math.log,Wr=Math.LN2;function ec(e){return e>>>=0,e===0?32:31-(Pr(e)/Wr|0)|0}var ci=256,ui=262144,di=4194304;function Sn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function fi(e,t,a){var l=e.pendingLanes;if(l===0)return 0;var c=0,d=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var w=l&134217727;return w!==0?(l=w&~d,l!==0?c=Sn(l):(b&=w,b!==0?c=Sn(b):a||(a=w&~e,a!==0&&(c=Sn(a))))):(w=l&~d,w!==0?c=Sn(w):b!==0?c=Sn(b):a||(a=l&~e,a!==0&&(c=Sn(a)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,a=t&-t,d>=a||d===32&&(a&4194048)!==0)?t:c}function Ma(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function tc(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Uo(){var e=di;return di<<=1,(di&62914560)===0&&(di=4194304),e}function gl(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function za(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function nc(e,t,a,l,c,d){var b=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var w=e.entanglements,L=e.expirationTimes,Q=e.hiddenUpdates;for(a=b&~a;0<a;){var ne=31-St(a),le=1<<ne;w[ne]=0,L[ne]=-1;var J=Q[ne];if(J!==null)for(Q[ne]=null,ne=0;ne<J.length;ne++){var P=J[ne];P!==null&&(P.lane&=-536870913)}a&=~le}l!==0&&Bo(e,l,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function Bo(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-St(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Io(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var l=31-St(a),c=1<<l;c&t|e[l]&t&&(e[l]|=t),a&=~c}}function qo(e,t){var a=t&-t;return a=(a&42)!==0?1:ml(a),(a&(e.suspendedLanes|t))!==0?0:a}function ml(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function pl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Go(){var e=U.p;return e!==0?e:(e=window.event,e===void 0?32:Fm(e.type))}function ko(e,t){var a=U.p;try{return U.p=e,t()}finally{U.p=a}}var sn=Math.random().toString(36).slice(2),st="__reactFiber$"+sn,pt="__reactProps$"+sn,bn="__reactContainer$"+sn,hi="__reactEvents$"+sn,Yo="__reactListeners$"+sn,ac="__reactHandles$"+sn,Vo="__reactResources$"+sn,Da="__reactMarker$"+sn;function yl(e){delete e[st],delete e[pt],delete e[hi],delete e[Yo],delete e[ac]}function Zn(e){var t=e[st];if(t)return t;for(var a=e.parentNode;a;){if(t=a[bn]||a[st]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Om(e);e!==null;){if(a=e[st])return a;e=Om(e)}return t}e=a,a=e.parentNode}return null}function $n(e){if(e=e[st]||e[bn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Kn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function Qn(e){var t=e[Vo];return t||(t=e[Vo]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function et(e){e[Da]=!0}var Xo=new Set,Zo={};function xn(e,t){Fn(e,t),Fn(e+"Capture",t)}function Fn(e,t){for(Zo[e]=t,e=0;e<t.length;e++)Xo.add(t[e])}var ic=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]*$"),vl={},$o={};function lc(e){return zt.call($o,e)?!0:zt.call(vl,e)?!1:ic.test(e)?$o[e]=!0:(vl[e]=!0,!1)}function gi(e,t,a){if(lc(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function mi(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Ft(e,t,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+l)}}function xt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ko(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function oc(e,t,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,d=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(b){a=""+b,d.call(this,b)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(b){a=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function pi(e){if(!e._valueTracker){var t=Ko(e)?"checked":"value";e._valueTracker=oc(e,t,""+e[t])}}function Qo(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),l="";return e&&(l=Ko(e)?e.checked?"true":"false":e.value),e=l,e!==a?(t.setValue(e),!0):!1}function Ra(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var sc=/[\n"\\]/g;function _t(e){return e.replace(sc,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ja(e,t,a,l,c,d,b,w){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+xt(t)):e.value!==""+xt(t)&&(e.value=""+xt(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Sl(e,b,xt(t)):a!=null?Sl(e,b,xt(a)):l!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+xt(w):e.removeAttribute("name")}function Fo(e,t,a,l,c,d,b,w){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||a!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){pi(e);return}a=a!=null?""+xt(a):"",t=t!=null?""+xt(t):a,w||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=w?e.checked:!!l,e.defaultChecked=!!l,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),pi(e)}function Sl(e,t,a){t==="number"&&Ra(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function _n(e,t,a,l){if(e=e.options,t){t={};for(var c=0;c<a.length;c++)t["$"+a[c]]=!0;for(a=0;a<e.length;a++)c=t.hasOwnProperty("$"+e[a].value),e[a].selected!==c&&(e[a].selected=c),c&&l&&(e[a].defaultSelected=!0)}else{for(a=""+xt(a),t=null,c=0;c<e.length;c++){if(e[c].value===a){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function xf(e,t,a){if(t!=null&&(t=""+xt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+xt(a):""}function _f(e,t,a,l){if(t==null){if(l!=null){if(a!=null)throw Error(s(92));if(k(l)){if(1<l.length)throw Error(s(93));l=l[0]}a=l}a==null&&(a=""),t=a}a=xt(t),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),pi(e)}function yi(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var Jv=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 wf(e,t,a){var l=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,a):typeof a!="number"||a===0||Jv.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Ef(e,t,a){if(t!=null&&typeof t!="object")throw Error(s(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&a[c]!==l&&wf(e,c,l)}else for(var d in t)t.hasOwnProperty(d)&&wf(e,d,t[d])}function rc(e){if(e.indexOf("-")===-1)return!1;switch(e){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 Pv=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"]]),Wv=/^[\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 Jo(e){return Wv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function wn(){}var cc=null;function uc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vi=null,Si=null;function Nf(e){var t=$n(e);if(t&&(e=t.stateNode)){var a=e[pt]||null;e:switch(e=t.stateNode,t.type){case"input":if(ja(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+_t(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var l=a[t];if(l!==e&&l.form===e.form){var c=l[pt]||null;if(!c)throw Error(s(90));ja(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<a.length;t++)l=a[t],l.form===e.form&&Qo(l)}break e;case"textarea":xf(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&_n(e,!!a.multiple,t,!1)}}}var dc=!1;function Tf(e,t,a){if(dc)return e(t,a);dc=!0;try{var l=e(t);return l}finally{if(dc=!1,(vi!==null||Si!==null)&&(Bs(),vi&&(t=vi,e=Si,Si=vi=null,Nf(t),e)))for(t=0;t<e.length;t++)Nf(e[t])}}function bl(e,t){var a=e.stateNode;if(a===null)return null;var l=a[pt]||null;if(l===null)return null;a=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(s(231,t,typeof a));return a}var En=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fc=!1;if(En)try{var xl={};Object.defineProperty(xl,"passive",{get:function(){fc=!0}}),window.addEventListener("test",xl,xl),window.removeEventListener("test",xl,xl)}catch{fc=!1}var Jn=null,hc=null,Po=null;function Af(){if(Po)return Po;var e,t=hc,a=t.length,l,c="value"in Jn?Jn.value:Jn.textContent,d=c.length;for(e=0;e<a&&t[e]===c[e];e++);var b=a-e;for(l=1;l<=b&&t[a-l]===c[d-l];l++);return Po=c.slice(e,1<l?1-l:void 0)}function Wo(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function es(){return!0}function Cf(){return!1}function wt(e){function t(a,l,c,d,b){this._reactName=a,this._targetInst=c,this.type=l,this.nativeEvent=d,this.target=b,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(a=e[w],this[w]=a?a(d):d[w]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?es:Cf,this.isPropagationStopped=Cf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=es)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=es)},persist:function(){},isPersistent:es}),t}var Oa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ts=wt(Oa),_l=v({},Oa,{view:0,detail:0}),eS=wt(_l),gc,mc,wl,ns=v({},_l,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:yc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==wl&&(wl&&e.type==="mousemove"?(gc=e.screenX-wl.screenX,mc=e.screenY-wl.screenY):mc=gc=0,wl=e),gc)},movementY:function(e){return"movementY"in e?e.movementY:mc}}),Mf=wt(ns),tS=v({},ns,{dataTransfer:0}),nS=wt(tS),aS=v({},_l,{relatedTarget:0}),pc=wt(aS),iS=v({},Oa,{animationName:0,elapsedTime:0,pseudoElement:0}),lS=wt(iS),oS=v({},Oa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),sS=wt(oS),rS=v({},Oa,{data:0}),zf=wt(rS),cS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uS={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"},dS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=dS[e])?!!t[e]:!1}function yc(){return fS}var hS=v({},_l,{key:function(e){if(e.key){var t=cS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Wo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?uS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:yc,charCode:function(e){return e.type==="keypress"?Wo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Wo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),gS=wt(hS),mS=v({},ns,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Df=wt(mS),pS=v({},_l,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:yc}),yS=wt(pS),vS=v({},Oa,{propertyName:0,elapsedTime:0,pseudoElement:0}),SS=wt(vS),bS=v({},ns,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),xS=wt(bS),_S=v({},Oa,{newState:0,oldState:0}),wS=wt(_S),ES=[9,13,27,32],vc=En&&"CompositionEvent"in window,El=null;En&&"documentMode"in document&&(El=document.documentMode);var NS=En&&"TextEvent"in window&&!El,Rf=En&&(!vc||El&&8<El&&11>=El),jf=" ",Of=!1;function Hf(e,t){switch(e){case"keyup":return ES.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var bi=!1;function TS(e,t){switch(e){case"compositionend":return Lf(t);case"keypress":return t.which!==32?null:(Of=!0,jf);case"textInput":return e=t.data,e===jf&&Of?null:e;default:return null}}function AS(e,t){if(bi)return e==="compositionend"||!vc&&Hf(e,t)?(e=Af(),Po=hc=Jn=null,bi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Rf&&t.locale!=="ko"?null:t.data;default:return null}}var CS={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 Uf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!CS[e.type]:t==="textarea"}function Bf(e,t,a,l){vi?Si?Si.push(l):Si=[l]:vi=l,t=Xs(t,"onChange"),0<t.length&&(a=new ts("onChange","change",null,a,l),e.push({event:a,listeners:t}))}var Nl=null,Tl=null;function MS(e){bm(e,0)}function as(e){var t=Kn(e);if(Qo(t))return e}function If(e,t){if(e==="change")return t}var qf=!1;if(En){var Sc;if(En){var bc="oninput"in document;if(!bc){var Gf=document.createElement("div");Gf.setAttribute("oninput","return;"),bc=typeof Gf.oninput=="function"}Sc=bc}else Sc=!1;qf=Sc&&(!document.documentMode||9<document.documentMode)}function kf(){Nl&&(Nl.detachEvent("onpropertychange",Yf),Tl=Nl=null)}function Yf(e){if(e.propertyName==="value"&&as(Tl)){var t=[];Bf(t,Tl,e,uc(e)),Tf(MS,t)}}function zS(e,t,a){e==="focusin"?(kf(),Nl=t,Tl=a,Nl.attachEvent("onpropertychange",Yf)):e==="focusout"&&kf()}function DS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return as(Tl)}function RS(e,t){if(e==="click")return as(t)}function jS(e,t){if(e==="input"||e==="change")return as(t)}function OS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Dt=typeof Object.is=="function"?Object.is:OS;function Al(e,t){if(Dt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),l=Object.keys(t);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var c=a[l];if(!zt.call(t,c)||!Dt(e[c],t[c]))return!1}return!0}function Vf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xf(e,t){var a=Vf(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=t&&l>=t)return{node:a,offset:t-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Vf(a)}}function Zf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $f(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ra(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Ra(e.document)}return t}function xc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var HS=En&&"documentMode"in document&&11>=document.documentMode,xi=null,_c=null,Cl=null,wc=!1;function Kf(e,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;wc||xi==null||xi!==Ra(l)||(l=xi,"selectionStart"in l&&xc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Cl&&Al(Cl,l)||(Cl=l,l=Xs(_c,"onSelect"),0<l.length&&(t=new ts("onSelect","select",null,t,a),e.push({event:t,listeners:l}),t.target=xi)))}function Ha(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var _i={animationend:Ha("Animation","AnimationEnd"),animationiteration:Ha("Animation","AnimationIteration"),animationstart:Ha("Animation","AnimationStart"),transitionrun:Ha("Transition","TransitionRun"),transitionstart:Ha("Transition","TransitionStart"),transitioncancel:Ha("Transition","TransitionCancel"),transitionend:Ha("Transition","TransitionEnd")},Ec={},Qf={};En&&(Qf=document.createElement("div").style,"AnimationEvent"in window||(delete _i.animationend.animation,delete _i.animationiteration.animation,delete _i.animationstart.animation),"TransitionEvent"in window||delete _i.transitionend.transition);function La(e){if(Ec[e])return Ec[e];if(!_i[e])return e;var t=_i[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Qf)return Ec[e]=t[a];return e}var Ff=La("animationend"),Jf=La("animationiteration"),Pf=La("animationstart"),LS=La("transitionrun"),US=La("transitionstart"),BS=La("transitioncancel"),Wf=La("transitionend"),eh=new Map,Nc="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(" ");Nc.push("scrollEnd");function Jt(e,t){eh.set(e,t),xn(t,[e])}var is=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},qt=[],wi=0,Tc=0;function ls(){for(var e=wi,t=Tc=wi=0;t<e;){var a=qt[t];qt[t++]=null;var l=qt[t];qt[t++]=null;var c=qt[t];qt[t++]=null;var d=qt[t];if(qt[t++]=null,l!==null&&c!==null){var b=l.pending;b===null?c.next=c:(c.next=b.next,b.next=c),l.pending=c}d!==0&&th(a,c,d)}}function os(e,t,a,l){qt[wi++]=e,qt[wi++]=t,qt[wi++]=a,qt[wi++]=l,Tc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Ac(e,t,a,l){return os(e,t,a,l),ss(e)}function Ua(e,t){return os(e,null,null,t),ss(e)}function th(e,t,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var c=!1,d=e.return;d!==null;)d.childLanes|=a,l=d.alternate,l!==null&&(l.childLanes|=a),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-St(a),e=d.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=a|536870912),d):null}function ss(e){if(50<Fl)throw Fl=0,Lu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ei={};function IS(e,t,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rt(e,t,a,l){return new IS(e,t,a,l)}function Cc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Nn(e,t){var a=e.alternate;return a===null?(a=Rt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function nh(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function rs(e,t,a,l,c,d){var b=0;if(l=e,typeof e=="function")Cc(e)&&(b=1);else if(typeof e=="string")b=Vb(e,a,te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Z:return e=Rt(31,a,t,c),e.elementType=Z,e.lanes=d,e;case C:return Ba(a.children,c,d,t);case A:b=8,c|=24;break;case M:return e=Rt(12,a,t,c|2),e.elementType=M,e.lanes=d,e;case Y:return e=Rt(13,a,t,c),e.elementType=Y,e.lanes=d,e;case O:return e=Rt(19,a,t,c),e.elementType=O,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _:b=10;break e;case H:b=9;break e;case z:b=11;break e;case I:b=14;break e;case B:b=16,l=null;break e}b=29,a=Error(s(130,e===null?"null":typeof e,"")),l=null}return t=Rt(b,a,t,c),t.elementType=e,t.type=l,t.lanes=d,t}function Ba(e,t,a,l){return e=Rt(7,e,l,t),e.lanes=a,e}function Mc(e,t,a){return e=Rt(6,e,null,t),e.lanes=a,e}function ah(e){var t=Rt(18,null,null,0);return t.stateNode=e,t}function zc(e,t,a){return t=Rt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ih=new WeakMap;function Gt(e,t){if(typeof e=="object"&&e!==null){var a=ih.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Kt(t)},ih.set(e,t),t)}return{value:e,source:t,stack:Kt(t)}}var Ni=[],Ti=0,cs=null,Ml=0,kt=[],Yt=0,Pn=null,rn=1,cn="";function Tn(e,t){Ni[Ti++]=Ml,Ni[Ti++]=cs,cs=e,Ml=t}function lh(e,t,a){kt[Yt++]=rn,kt[Yt++]=cn,kt[Yt++]=Pn,Pn=e;var l=rn;e=cn;var c=32-St(l)-1;l&=~(1<<c),a+=1;var d=32-St(t)+c;if(30<d){var b=c-c%5;d=(l&(1<<b)-1).toString(32),l>>=b,c-=b,rn=1<<32-St(t)+c|a<<c|l,cn=d+e}else rn=1<<d|a<<c|l,cn=e}function Dc(e){e.return!==null&&(Tn(e,1),lh(e,1,0))}function Rc(e){for(;e===cs;)cs=Ni[--Ti],Ni[Ti]=null,Ml=Ni[--Ti],Ni[Ti]=null;for(;e===Pn;)Pn=kt[--Yt],kt[Yt]=null,cn=kt[--Yt],kt[Yt]=null,rn=kt[--Yt],kt[Yt]=null}function oh(e,t){kt[Yt++]=rn,kt[Yt++]=cn,kt[Yt++]=Pn,rn=t.id,cn=t.overflow,Pn=e}var ft=null,Xe=null,De=!1,Wn=null,Vt=!1,jc=Error(s(519));function ea(e){var t=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zl(Gt(t,e)),jc}function sh(e){var t=e.stateNode,a=e.type,l=e.memoizedProps;switch(t[st]=e,t[pt]=l,a){case"dialog":Ae("cancel",t),Ae("close",t);break;case"iframe":case"object":case"embed":Ae("load",t);break;case"video":case"audio":for(a=0;a<Pl.length;a++)Ae(Pl[a],t);break;case"source":Ae("error",t);break;case"img":case"image":case"link":Ae("error",t),Ae("load",t);break;case"details":Ae("toggle",t);break;case"input":Ae("invalid",t),Fo(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ae("invalid",t);break;case"textarea":Ae("invalid",t),_f(t,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||l.suppressHydrationWarning===!0||Em(t.textContent,a)?(l.popover!=null&&(Ae("beforetoggle",t),Ae("toggle",t)),l.onScroll!=null&&Ae("scroll",t),l.onScrollEnd!=null&&Ae("scrollend",t),l.onClick!=null&&(t.onclick=wn),t=!0):t=!1,t||ea(e,!0)}function rh(e){for(ft=e.return;ft;)switch(ft.tag){case 5:case 31:case 13:Vt=!1;return;case 27:case 3:Vt=!0;return;default:ft=ft.return}}function Ai(e){if(e!==ft)return!1;if(!De)return rh(e),De=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Ju(e.type,e.memoizedProps)),a=!a),a&&Xe&&ea(e),rh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Xe=jm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Xe=jm(e)}else t===27?(t=Xe,ga(e.type)?(e=nd,nd=null,Xe=e):Xe=t):Xe=ft?Zt(e.stateNode.nextSibling):null;return!0}function Ia(){Xe=ft=null,De=!1}function Oc(){var e=Wn;return e!==null&&(At===null?At=e:At.push.apply(At,e),Wn=null),e}function zl(e){Wn===null?Wn=[e]:Wn.push(e)}var Hc=N(null),qa=null,An=null;function ta(e,t,a){W(Hc,t._currentValue),t._currentValue=a}function Cn(e){e._currentValue=Hc.current,j(Hc)}function Lc(e,t,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===a)break;e=e.return}}function Uc(e,t,a,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var b=c.child;d=d.firstContext;e:for(;d!==null;){var w=d;d=c;for(var L=0;L<t.length;L++)if(w.context===t[L]){d.lanes|=a,w=d.alternate,w!==null&&(w.lanes|=a),Lc(d.return,a,e),l||(b=null);break e}d=w.next}}else if(c.tag===18){if(b=c.return,b===null)throw Error(s(341));b.lanes|=a,d=b.alternate,d!==null&&(d.lanes|=a),Lc(b,a,e),b=null}else b=c.child;if(b!==null)b.return=c;else for(b=c;b!==null;){if(b===e){b=null;break}if(c=b.sibling,c!==null){c.return=b.return,b=c;break}b=b.return}c=b}}function Ci(e,t,a,l){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var b=c.alternate;if(b===null)throw Error(s(387));if(b=b.memoizedProps,b!==null){var w=c.type;Dt(c.pendingProps.value,b.value)||(e!==null?e.push(w):e=[w])}}else if(c===ue.current){if(b=c.alternate,b===null)throw Error(s(387));b.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(ao):e=[ao])}c=c.return}e!==null&&Uc(t,e,a,l),t.flags|=262144}function us(e){for(e=e.firstContext;e!==null;){if(!Dt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ga(e){qa=e,An=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ht(e){return ch(qa,e)}function ds(e,t){return qa===null&&Ga(e),ch(e,t)}function ch(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},An===null){if(e===null)throw Error(s(308));An=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else An=An.next=t;return a}var qS=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},GS=n.unstable_scheduleCallback,kS=n.unstable_NormalPriority,tt={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Bc(){return{controller:new qS,data:new Map,refCount:0}}function Dl(e){e.refCount--,e.refCount===0&&GS(kS,function(){e.controller.abort()})}var Rl=null,Ic=0,Mi=0,zi=null;function YS(e,t){if(Rl===null){var a=Rl=[];Ic=0,Mi=ku(),zi={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Ic++,t.then(uh,uh),t}function uh(){if(--Ic===0&&Rl!==null){zi!==null&&(zi.status="fulfilled");var e=Rl;Rl=null,Mi=0,zi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function VS(e,t){var a=[],l={status:"pending",value:null,reason:null,then:function(c){a.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<a.length;c++)(0,a[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<a.length;c++)(0,a[c])(void 0)}),l}var dh=T.S;T.S=function(e,t){Kg=dt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&YS(e,t),dh!==null&&dh(e,t)};var ka=N(null);function qc(){var e=ka.current;return e!==null?e:Ye.pooledCache}function fs(e,t){t===null?W(ka,ka.current):W(ka,t.pool)}function fh(){var e=qc();return e===null?null:{parent:tt._currentValue,pool:e}}var Di=Error(s(460)),Gc=Error(s(474)),hs=Error(s(542)),gs={then:function(){}};function hh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function gh(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(wn,wn),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ph(e),e;default:if(typeof t.status=="string")t.then(wn,wn);else{if(e=Ye,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ph(e),e}throw Va=t,Di}}function Ya(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Va=a,Di):a}}var Va=null;function mh(){if(Va===null)throw Error(s(459));var e=Va;return Va=null,e}function ph(e){if(e===Di||e===hs)throw Error(s(483))}var Ri=null,jl=0;function ms(e){var t=jl;return jl+=1,Ri===null&&(Ri=[]),gh(Ri,e,t)}function Ol(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ps(e,t){throw t.$$typeof===y?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function yh(e){function t(X,q){if(e){var K=X.deletions;K===null?(X.deletions=[q],X.flags|=16):K.push(q)}}function a(X,q){if(!e)return null;for(;q!==null;)t(X,q),q=q.sibling;return null}function l(X){for(var q=new Map;X!==null;)X.key!==null?q.set(X.key,X):q.set(X.index,X),X=X.sibling;return q}function c(X,q){return X=Nn(X,q),X.index=0,X.sibling=null,X}function d(X,q,K){return X.index=K,e?(K=X.alternate,K!==null?(K=K.index,K<q?(X.flags|=67108866,q):K):(X.flags|=67108866,q)):(X.flags|=1048576,q)}function b(X){return e&&X.alternate===null&&(X.flags|=67108866),X}function w(X,q,K,ie){return q===null||q.tag!==6?(q=Mc(K,X.mode,ie),q.return=X,q):(q=c(q,K),q.return=X,q)}function L(X,q,K,ie){var pe=K.type;return pe===C?ne(X,q,K.props.children,ie,K.key):q!==null&&(q.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===B&&Ya(pe)===q.type)?(q=c(q,K.props),Ol(q,K),q.return=X,q):(q=rs(K.type,K.key,K.props,null,X.mode,ie),Ol(q,K),q.return=X,q)}function Q(X,q,K,ie){return q===null||q.tag!==4||q.stateNode.containerInfo!==K.containerInfo||q.stateNode.implementation!==K.implementation?(q=zc(K,X.mode,ie),q.return=X,q):(q=c(q,K.children||[]),q.return=X,q)}function ne(X,q,K,ie,pe){return q===null||q.tag!==7?(q=Ba(K,X.mode,ie,pe),q.return=X,q):(q=c(q,K),q.return=X,q)}function le(X,q,K){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Mc(""+q,X.mode,K),q.return=X,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case x:return K=rs(q.type,q.key,q.props,null,X.mode,K),Ol(K,q),K.return=X,K;case E:return q=zc(q,X.mode,K),q.return=X,q;case B:return q=Ya(q),le(X,q,K)}if(k(q)||ee(q))return q=Ba(q,X.mode,K,null),q.return=X,q;if(typeof q.then=="function")return le(X,ms(q),K);if(q.$$typeof===_)return le(X,ds(X,q),K);ps(X,q)}return null}function J(X,q,K,ie){var pe=q!==null?q.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return pe!==null?null:w(X,q,""+K,ie);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case x:return K.key===pe?L(X,q,K,ie):null;case E:return K.key===pe?Q(X,q,K,ie):null;case B:return K=Ya(K),J(X,q,K,ie)}if(k(K)||ee(K))return pe!==null?null:ne(X,q,K,ie,null);if(typeof K.then=="function")return J(X,q,ms(K),ie);if(K.$$typeof===_)return J(X,q,ds(X,K),ie);ps(X,K)}return null}function P(X,q,K,ie,pe){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return X=X.get(K)||null,w(q,X,""+ie,pe);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case x:return X=X.get(ie.key===null?K:ie.key)||null,L(q,X,ie,pe);case E:return X=X.get(ie.key===null?K:ie.key)||null,Q(q,X,ie,pe);case B:return ie=Ya(ie),P(X,q,K,ie,pe)}if(k(ie)||ee(ie))return X=X.get(K)||null,ne(q,X,ie,pe,null);if(typeof ie.then=="function")return P(X,q,K,ms(ie),pe);if(ie.$$typeof===_)return P(X,q,K,ds(q,ie),pe);ps(q,ie)}return null}function he(X,q,K,ie){for(var pe=null,je=null,ge=q,Ne=q=0,ze=null;ge!==null&&Ne<K.length;Ne++){ge.index>Ne?(ze=ge,ge=null):ze=ge.sibling;var Oe=J(X,ge,K[Ne],ie);if(Oe===null){ge===null&&(ge=ze);break}e&&ge&&Oe.alternate===null&&t(X,ge),q=d(Oe,q,Ne),je===null?pe=Oe:je.sibling=Oe,je=Oe,ge=ze}if(Ne===K.length)return a(X,ge),De&&Tn(X,Ne),pe;if(ge===null){for(;Ne<K.length;Ne++)ge=le(X,K[Ne],ie),ge!==null&&(q=d(ge,q,Ne),je===null?pe=ge:je.sibling=ge,je=ge);return De&&Tn(X,Ne),pe}for(ge=l(ge);Ne<K.length;Ne++)ze=P(ge,X,Ne,K[Ne],ie),ze!==null&&(e&&ze.alternate!==null&&ge.delete(ze.key===null?Ne:ze.key),q=d(ze,q,Ne),je===null?pe=ze:je.sibling=ze,je=ze);return e&&ge.forEach(function(Sa){return t(X,Sa)}),De&&Tn(X,Ne),pe}function ve(X,q,K,ie){if(K==null)throw Error(s(151));for(var pe=null,je=null,ge=q,Ne=q=0,ze=null,Oe=K.next();ge!==null&&!Oe.done;Ne++,Oe=K.next()){ge.index>Ne?(ze=ge,ge=null):ze=ge.sibling;var Sa=J(X,ge,Oe.value,ie);if(Sa===null){ge===null&&(ge=ze);break}e&&ge&&Sa.alternate===null&&t(X,ge),q=d(Sa,q,Ne),je===null?pe=Sa:je.sibling=Sa,je=Sa,ge=ze}if(Oe.done)return a(X,ge),De&&Tn(X,Ne),pe;if(ge===null){for(;!Oe.done;Ne++,Oe=K.next())Oe=le(X,Oe.value,ie),Oe!==null&&(q=d(Oe,q,Ne),je===null?pe=Oe:je.sibling=Oe,je=Oe);return De&&Tn(X,Ne),pe}for(ge=l(ge);!Oe.done;Ne++,Oe=K.next())Oe=P(ge,X,Ne,Oe.value,ie),Oe!==null&&(e&&Oe.alternate!==null&&ge.delete(Oe.key===null?Ne:Oe.key),q=d(Oe,q,Ne),je===null?pe=Oe:je.sibling=Oe,je=Oe);return e&&ge.forEach(function(tx){return t(X,tx)}),De&&Tn(X,Ne),pe}function ke(X,q,K,ie){if(typeof K=="object"&&K!==null&&K.type===C&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case x:e:{for(var pe=K.key;q!==null;){if(q.key===pe){if(pe=K.type,pe===C){if(q.tag===7){a(X,q.sibling),ie=c(q,K.props.children),ie.return=X,X=ie;break e}}else if(q.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===B&&Ya(pe)===q.type){a(X,q.sibling),ie=c(q,K.props),Ol(ie,K),ie.return=X,X=ie;break e}a(X,q);break}else t(X,q);q=q.sibling}K.type===C?(ie=Ba(K.props.children,X.mode,ie,K.key),ie.return=X,X=ie):(ie=rs(K.type,K.key,K.props,null,X.mode,ie),Ol(ie,K),ie.return=X,X=ie)}return b(X);case E:e:{for(pe=K.key;q!==null;){if(q.key===pe)if(q.tag===4&&q.stateNode.containerInfo===K.containerInfo&&q.stateNode.implementation===K.implementation){a(X,q.sibling),ie=c(q,K.children||[]),ie.return=X,X=ie;break e}else{a(X,q);break}else t(X,q);q=q.sibling}ie=zc(K,X.mode,ie),ie.return=X,X=ie}return b(X);case B:return K=Ya(K),ke(X,q,K,ie)}if(k(K))return he(X,q,K,ie);if(ee(K)){if(pe=ee(K),typeof pe!="function")throw Error(s(150));return K=pe.call(K),ve(X,q,K,ie)}if(typeof K.then=="function")return ke(X,q,ms(K),ie);if(K.$$typeof===_)return ke(X,q,ds(X,K),ie);ps(X,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,q!==null&&q.tag===6?(a(X,q.sibling),ie=c(q,K),ie.return=X,X=ie):(a(X,q),ie=Mc(K,X.mode,ie),ie.return=X,X=ie),b(X)):a(X,q)}return function(X,q,K,ie){try{jl=0;var pe=ke(X,q,K,ie);return Ri=null,pe}catch(ge){if(ge===Di||ge===hs)throw ge;var je=Rt(29,ge,null,X.mode);return je.lanes=ie,je.return=X,je}}}var Xa=yh(!0),vh=yh(!1),na=!1;function kc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Yc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function aa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ia(e,t,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(He&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=ss(e),th(e,null,a),t}return os(e,l,t,a),ss(e)}function Hl(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Io(e,a)}}function Vc(e,t){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var c=null,d=null;if(a=a.firstBaseUpdate,a!==null){do{var b={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};d===null?c=d=b:d=d.next=b,a=a.next}while(a!==null);d===null?c=d=t:d=d.next=t}else c=d=t;a={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Xc=!1;function Ll(){if(Xc){var e=zi;if(e!==null)throw e}}function Ul(e,t,a,l){Xc=!1;var c=e.updateQueue;na=!1;var d=c.firstBaseUpdate,b=c.lastBaseUpdate,w=c.shared.pending;if(w!==null){c.shared.pending=null;var L=w,Q=L.next;L.next=null,b===null?d=Q:b.next=Q,b=L;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,w=ne.lastBaseUpdate,w!==b&&(w===null?ne.firstBaseUpdate=Q:w.next=Q,ne.lastBaseUpdate=L))}if(d!==null){var le=c.baseState;b=0,ne=Q=L=null,w=d;do{var J=w.lane&-536870913,P=J!==w.lane;if(P?(Me&J)===J:(l&J)===J){J!==0&&J===Mi&&(Xc=!0),ne!==null&&(ne=ne.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var he=e,ve=w;J=t;var ke=a;switch(ve.tag){case 1:if(he=ve.payload,typeof he=="function"){le=he.call(ke,le,J);break e}le=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ve.payload,J=typeof he=="function"?he.call(ke,le,J):he,J==null)break e;le=v({},le,J);break e;case 2:na=!0}}J=w.callback,J!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[J]:P.push(J))}else P={lane:J,tag:w.tag,payload:w.payload,callback:w.callback,next:null},ne===null?(Q=ne=P,L=le):ne=ne.next=P,b|=J;if(w=w.next,w===null){if(w=c.shared.pending,w===null)break;P=w,w=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);ne===null&&(L=le),c.baseState=L,c.firstBaseUpdate=Q,c.lastBaseUpdate=ne,d===null&&(c.shared.lanes=0),ca|=b,e.lanes=b,e.memoizedState=le}}function Sh(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function bh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Sh(a[e],t)}var ji=N(null),ys=N(0);function xh(e,t){e=Un,W(ys,e),W(ji,t),Un=e|t.baseLanes}function Zc(){W(ys,Un),W(ji,ji.current)}function $c(){Un=ys.current,j(ji),j(ys)}var jt=N(null),Xt=null;function la(e){var t=e.alternate;W(Pe,Pe.current&1),W(jt,e),Xt===null&&(t===null||ji.current!==null||t.memoizedState!==null)&&(Xt=e)}function Kc(e){W(Pe,Pe.current),W(jt,e),Xt===null&&(Xt=e)}function _h(e){e.tag===22?(W(Pe,Pe.current),W(jt,e),Xt===null&&(Xt=e)):oa()}function oa(){W(Pe,Pe.current),W(jt,jt.current)}function Ot(e){j(jt),Xt===e&&(Xt=null),j(Pe)}var Pe=N(0);function vs(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||ed(a)||td(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Mn=0,_e=null,qe=null,nt=null,Ss=!1,Oi=!1,Za=!1,bs=0,Bl=0,Hi=null,XS=0;function Fe(){throw Error(s(321))}function Qc(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Dt(e[a],t[a]))return!1;return!0}function Fc(e,t,a,l,c,d){return Mn=d,_e=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,T.H=e===null||e.memoizedState===null?lg:du,Za=!1,d=a(l,c),Za=!1,Oi&&(d=Eh(t,a,l,c)),wh(e),d}function wh(e){T.H=Gl;var t=qe!==null&&qe.next!==null;if(Mn=0,nt=qe=_e=null,Ss=!1,Bl=0,Hi=null,t)throw Error(s(300));e===null||at||(e=e.dependencies,e!==null&&us(e)&&(at=!0))}function Eh(e,t,a,l){_e=e;var c=0;do{if(Oi&&(Hi=null),Bl=0,Oi=!1,25<=c)throw Error(s(301));if(c+=1,nt=qe=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}T.H=og,d=t(a,l)}while(Oi);return d}function ZS(){var e=T.H,t=e.useState()[0];return t=typeof t.then=="function"?Il(t):t,e=e.useState()[0],(qe!==null?qe.memoizedState:null)!==e&&(_e.flags|=1024),t}function Jc(){var e=bs!==0;return bs=0,e}function Pc(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Wc(e){if(Ss){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ss=!1}Mn=0,nt=qe=_e=null,Oi=!1,Bl=bs=0,Hi=null}function bt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nt===null?_e.memoizedState=nt=e:nt=nt.next=e,nt}function We(){if(qe===null){var e=_e.alternate;e=e!==null?e.memoizedState:null}else e=qe.next;var t=nt===null?_e.memoizedState:nt.next;if(t!==null)nt=t,qe=e;else{if(e===null)throw _e.alternate===null?Error(s(467)):Error(s(310));qe=e,e={memoizedState:qe.memoizedState,baseState:qe.baseState,baseQueue:qe.baseQueue,queue:qe.queue,next:null},nt===null?_e.memoizedState=nt=e:nt=nt.next=e}return nt}function xs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Il(e){var t=Bl;return Bl+=1,Hi===null&&(Hi=[]),e=gh(Hi,e,t),t=_e,(nt===null?t.memoizedState:nt.next)===null&&(t=t.alternate,T.H=t===null||t.memoizedState===null?lg:du),e}function _s(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Il(e);if(e.$$typeof===_)return ht(e)}throw Error(s(438,String(e)))}function eu(e){var t=null,a=_e.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var l=_e.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=xs(),_e.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),l=0;l<e;l++)a[l]=oe;return t.index++,a}function zn(e,t){return typeof t=="function"?t(e):t}function ws(e){var t=We();return tu(t,qe,e)}function tu(e,t,a){var l=e.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=a;var c=e.baseQueue,d=l.pending;if(d!==null){if(c!==null){var b=c.next;c.next=d.next,d.next=b}t.baseQueue=c=d,l.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var w=b=null,L=null,Q=t,ne=!1;do{var le=Q.lane&-536870913;if(le!==Q.lane?(Me&le)===le:(Mn&le)===le){var J=Q.revertLane;if(J===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null}),le===Mi&&(ne=!0);else if((Mn&J)===J){Q=Q.next,J===Mi&&(ne=!0);continue}else le={lane:0,revertLane:Q.revertLane,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},L===null?(w=L=le,b=d):L=L.next=le,_e.lanes|=J,ca|=J;le=Q.action,Za&&a(d,le),d=Q.hasEagerState?Q.eagerState:a(d,le)}else J={lane:le,revertLane:Q.revertLane,gesture:Q.gesture,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},L===null?(w=L=J,b=d):L=L.next=J,_e.lanes|=le,ca|=le;Q=Q.next}while(Q!==null&&Q!==t);if(L===null?b=d:L.next=w,!Dt(d,e.memoizedState)&&(at=!0,ne&&(a=zi,a!==null)))throw a;e.memoizedState=d,e.baseState=b,e.baseQueue=L,l.lastRenderedState=d}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function nu(e){var t=We(),a=t.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=e;var l=a.dispatch,c=a.pending,d=t.memoizedState;if(c!==null){a.pending=null;var b=c=c.next;do d=e(d,b.action),b=b.next;while(b!==c);Dt(d,t.memoizedState)||(at=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),a.lastRenderedState=d}return[d,l]}function Nh(e,t,a){var l=_e,c=We(),d=De;if(d){if(a===void 0)throw Error(s(407));a=a()}else a=t();var b=!Dt((qe||c).memoizedState,a);if(b&&(c.memoizedState=a,at=!0),c=c.queue,lu(Ch.bind(null,l,c,e),[e]),c.getSnapshot!==t||b||nt!==null&&nt.memoizedState.tag&1){if(l.flags|=2048,Li(9,{destroy:void 0},Ah.bind(null,l,c,a,t),null),Ye===null)throw Error(s(349));d||(Mn&127)!==0||Th(l,t,a)}return a}function Th(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=_e.updateQueue,t===null?(t=xs(),_e.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Ah(e,t,a,l){t.value=a,t.getSnapshot=l,Mh(t)&&zh(e)}function Ch(e,t,a){return a(function(){Mh(t)&&zh(e)})}function Mh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Dt(e,a)}catch{return!0}}function zh(e){var t=Ua(e,2);t!==null&&Ct(t,e,2)}function au(e){var t=bt();if(typeof e=="function"){var a=e;if(e=a(),Za){on(!0);try{a()}finally{on(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zn,lastRenderedState:e},t}function Dh(e,t,a,l){return e.baseState=a,tu(e,qe,typeof l=="function"?l:zn)}function $S(e,t,a,l,c){if(Ts(e))throw Error(s(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){d.listeners.push(b)}};T.T!==null?a(!0):d.isTransition=!1,l(d),a=t.pending,a===null?(d.next=t.pending=d,Rh(t,d)):(d.next=a.next,t.pending=a.next=d)}}function Rh(e,t){var a=t.action,l=t.payload,c=e.state;if(t.isTransition){var d=T.T,b={};T.T=b;try{var w=a(c,l),L=T.S;L!==null&&L(b,w),jh(e,t,w)}catch(Q){iu(e,t,Q)}finally{d!==null&&b.types!==null&&(d.types=b.types),T.T=d}}else try{d=a(c,l),jh(e,t,d)}catch(Q){iu(e,t,Q)}}function jh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){Oh(e,t,l)},function(l){return iu(e,t,l)}):Oh(e,t,a)}function Oh(e,t,a){t.status="fulfilled",t.value=a,Hh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Rh(e,a)))}function iu(e,t,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=a,Hh(t),t=t.next;while(t!==l)}e.action=null}function Hh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Lh(e,t){return t}function Uh(e,t){if(De){var a=Ye.formState;if(a!==null){e:{var l=_e;if(De){if(Xe){t:{for(var c=Xe,d=Vt;c.nodeType!==8;){if(!d){c=null;break t}if(c=Zt(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){Xe=Zt(c.nextSibling),l=c.data==="F!";break e}}ea(l)}l=!1}l&&(t=a[0])}}return a=bt(),a.memoizedState=a.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lh,lastRenderedState:t},a.queue=l,a=ng.bind(null,_e,l),l.dispatch=a,l=au(!1),d=uu.bind(null,_e,!1,l.queue),l=bt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,a=$S.bind(null,_e,c,d,a),c.dispatch=a,l.memoizedState=e,[t,a,!1]}function Bh(e){var t=We();return Ih(t,qe,e)}function Ih(e,t,a){if(t=tu(e,t,Lh)[0],e=ws(zn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Il(t)}catch(b){throw b===Di?hs:b}else l=t;t=We();var c=t.queue,d=c.dispatch;return a!==t.memoizedState&&(_e.flags|=2048,Li(9,{destroy:void 0},KS.bind(null,c,a),null)),[l,d,e]}function KS(e,t){e.action=t}function qh(e){var t=We(),a=qe;if(a!==null)return Ih(t,a,e);We(),t=t.memoizedState,a=We();var l=a.queue.dispatch;return a.memoizedState=e,[t,l,!1]}function Li(e,t,a,l){return e={tag:e,create:a,deps:l,inst:t,next:null},t=_e.updateQueue,t===null&&(t=xs(),_e.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,t.lastEffect=e),e}function Gh(){return We().memoizedState}function Es(e,t,a,l){var c=bt();_e.flags|=e,c.memoizedState=Li(1|t,{destroy:void 0},a,l===void 0?null:l)}function Ns(e,t,a,l){var c=We();l=l===void 0?null:l;var d=c.memoizedState.inst;qe!==null&&l!==null&&Qc(l,qe.memoizedState.deps)?c.memoizedState=Li(t,d,a,l):(_e.flags|=e,c.memoizedState=Li(1|t,d,a,l))}function kh(e,t){Es(8390656,8,e,t)}function lu(e,t){Ns(2048,8,e,t)}function QS(e){_e.flags|=4;var t=_e.updateQueue;if(t===null)t=xs(),_e.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function Yh(e){var t=We().memoizedState;return QS({ref:t,nextImpl:e}),function(){if((He&2)!==0)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function Vh(e,t){return Ns(4,2,e,t)}function Xh(e,t){return Ns(4,4,e,t)}function Zh(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function $h(e,t,a){a=a!=null?a.concat([e]):null,Ns(4,4,Zh.bind(null,t,e),a)}function ou(){}function Kh(e,t){var a=We();t=t===void 0?null:t;var l=a.memoizedState;return t!==null&&Qc(t,l[1])?l[0]:(a.memoizedState=[e,t],e)}function Qh(e,t){var a=We();t=t===void 0?null:t;var l=a.memoizedState;if(t!==null&&Qc(t,l[1]))return l[0];if(l=e(),Za){on(!0);try{e()}finally{on(!1)}}return a.memoizedState=[l,t],l}function su(e,t,a){return a===void 0||(Mn&1073741824)!==0&&(Me&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Fg(),_e.lanes|=e,ca|=e,a)}function Fh(e,t,a,l){return Dt(a,t)?a:ji.current!==null?(e=su(e,a,l),Dt(e,t)||(at=!0),e):(Mn&42)===0||(Mn&1073741824)!==0&&(Me&261930)===0?(at=!0,e.memoizedState=a):(e=Fg(),_e.lanes|=e,ca|=e,t)}function Jh(e,t,a,l,c){var d=U.p;U.p=d!==0&&8>d?d:8;var b=T.T,w={};T.T=w,uu(e,!1,t,a);try{var L=c(),Q=T.S;if(Q!==null&&Q(w,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var ne=VS(L,l);ql(e,t,ne,Ut(e))}else ql(e,t,l,Ut(e))}catch(le){ql(e,t,{then:function(){},status:"rejected",reason:le},Ut())}finally{U.p=d,b!==null&&w.types!==null&&(b.types=w.types),T.T=b}}function FS(){}function ru(e,t,a,l){if(e.tag!==5)throw Error(s(476));var c=Ph(e).queue;Jh(e,c,t,G,a===null?FS:function(){return Wh(e),a(l)})}function Ph(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zn,lastRenderedState:G},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Wh(e){var t=Ph(e);t.next===null&&(t=e.alternate.memoizedState),ql(e,t.next.queue,{},Ut())}function cu(){return ht(ao)}function eg(){return We().memoizedState}function tg(){return We().memoizedState}function JS(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Ut();e=aa(a);var l=ia(t,e,a);l!==null&&(Ct(l,t,a),Hl(l,t,a)),t={cache:Bc()},e.payload=t;return}t=t.return}}function PS(e,t,a){var l=Ut();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ts(e)?ag(t,a):(a=Ac(e,t,a,l),a!==null&&(Ct(a,e,l),ig(a,t,l)))}function ng(e,t,a){var l=Ut();ql(e,t,a,l)}function ql(e,t,a,l){var c={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ts(e))ag(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var b=t.lastRenderedState,w=d(b,a);if(c.hasEagerState=!0,c.eagerState=w,Dt(w,b))return os(e,t,c,0),Ye===null&&ls(),!1}catch{}if(a=Ac(e,t,c,l),a!==null)return Ct(a,e,l),ig(a,t,l),!0}return!1}function uu(e,t,a,l){if(l={lane:2,revertLane:ku(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ts(e)){if(t)throw Error(s(479))}else t=Ac(e,a,l,2),t!==null&&Ct(t,e,2)}function Ts(e){var t=e.alternate;return e===_e||t!==null&&t===_e}function ag(e,t){Oi=Ss=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function ig(e,t,a){if((a&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Io(e,a)}}var Gl={readContext:ht,use:_s,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};Gl.useEffectEvent=Fe;var lg={readContext:ht,use:_s,useCallback:function(e,t){return bt().memoizedState=[e,t===void 0?null:t],e},useContext:ht,useEffect:kh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Es(4194308,4,Zh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Es(4194308,4,e,t)},useInsertionEffect:function(e,t){Es(4,2,e,t)},useMemo:function(e,t){var a=bt();t=t===void 0?null:t;var l=e();if(Za){on(!0);try{e()}finally{on(!1)}}return a.memoizedState=[l,t],l},useReducer:function(e,t,a){var l=bt();if(a!==void 0){var c=a(t);if(Za){on(!0);try{a(t)}finally{on(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=PS.bind(null,_e,e),[l.memoizedState,e]},useRef:function(e){var t=bt();return e={current:e},t.memoizedState=e},useState:function(e){e=au(e);var t=e.queue,a=ng.bind(null,_e,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:ou,useDeferredValue:function(e,t){var a=bt();return su(a,e,t)},useTransition:function(){var e=au(!1);return e=Jh.bind(null,_e,e.queue,!0,!1),bt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var l=_e,c=bt();if(De){if(a===void 0)throw Error(s(407));a=a()}else{if(a=t(),Ye===null)throw Error(s(349));(Me&127)!==0||Th(l,t,a)}c.memoizedState=a;var d={value:a,getSnapshot:t};return c.queue=d,kh(Ch.bind(null,l,d,e),[e]),l.flags|=2048,Li(9,{destroy:void 0},Ah.bind(null,l,d,a,t),null),a},useId:function(){var e=bt(),t=Ye.identifierPrefix;if(De){var a=cn,l=rn;a=(l&~(1<<32-St(l)-1)).toString(32)+a,t="_"+t+"R_"+a,a=bs++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=XS++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:cu,useFormState:Uh,useActionState:Uh,useOptimistic:function(e){var t=bt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=uu.bind(null,_e,!0,a),a.dispatch=t,[e,t]},useMemoCache:eu,useCacheRefresh:function(){return bt().memoizedState=JS.bind(null,_e)},useEffectEvent:function(e){var t=bt(),a={impl:e};return t.memoizedState=a,function(){if((He&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},du={readContext:ht,use:_s,useCallback:Kh,useContext:ht,useEffect:lu,useImperativeHandle:$h,useInsertionEffect:Vh,useLayoutEffect:Xh,useMemo:Qh,useReducer:ws,useRef:Gh,useState:function(){return ws(zn)},useDebugValue:ou,useDeferredValue:function(e,t){var a=We();return Fh(a,qe.memoizedState,e,t)},useTransition:function(){var e=ws(zn)[0],t=We().memoizedState;return[typeof e=="boolean"?e:Il(e),t]},useSyncExternalStore:Nh,useId:eg,useHostTransitionStatus:cu,useFormState:Bh,useActionState:Bh,useOptimistic:function(e,t){var a=We();return Dh(a,qe,e,t)},useMemoCache:eu,useCacheRefresh:tg};du.useEffectEvent=Yh;var og={readContext:ht,use:_s,useCallback:Kh,useContext:ht,useEffect:lu,useImperativeHandle:$h,useInsertionEffect:Vh,useLayoutEffect:Xh,useMemo:Qh,useReducer:nu,useRef:Gh,useState:function(){return nu(zn)},useDebugValue:ou,useDeferredValue:function(e,t){var a=We();return qe===null?su(a,e,t):Fh(a,qe.memoizedState,e,t)},useTransition:function(){var e=nu(zn)[0],t=We().memoizedState;return[typeof e=="boolean"?e:Il(e),t]},useSyncExternalStore:Nh,useId:eg,useHostTransitionStatus:cu,useFormState:qh,useActionState:qh,useOptimistic:function(e,t){var a=We();return qe!==null?Dh(a,qe,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:eu,useCacheRefresh:tg};og.useEffectEvent=Yh;function fu(e,t,a,l){t=e.memoizedState,a=a(l,t),a=a==null?t:v({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var hu={enqueueSetState:function(e,t,a){e=e._reactInternals;var l=Ut(),c=aa(l);c.payload=t,a!=null&&(c.callback=a),t=ia(e,c,l),t!==null&&(Ct(t,e,l),Hl(t,e,l))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var l=Ut(),c=aa(l);c.tag=1,c.payload=t,a!=null&&(c.callback=a),t=ia(e,c,l),t!==null&&(Ct(t,e,l),Hl(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Ut(),l=aa(a);l.tag=2,t!=null&&(l.callback=t),t=ia(e,l,a),t!==null&&(Ct(t,e,a),Hl(t,e,a))}};function sg(e,t,a,l,c,d,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,d,b):t.prototype&&t.prototype.isPureReactComponent?!Al(a,l)||!Al(c,d):!0}function rg(e,t,a,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,l),t.state!==e&&hu.enqueueReplaceState(t,t.state,null)}function $a(e,t){var a=t;if("ref"in t){a={};for(var l in t)l!=="ref"&&(a[l]=t[l])}if(e=e.defaultProps){a===t&&(a=v({},a));for(var c in e)a[c]===void 0&&(a[c]=e[c])}return a}function cg(e){is(e)}function ug(e){console.error(e)}function dg(e){is(e)}function As(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function fg(e,t,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function gu(e,t,a){return a=aa(a),a.tag=3,a.payload={element:null},a.callback=function(){As(e,t)},a}function hg(e){return e=aa(e),e.tag=3,e}function gg(e,t,a,l){var c=a.type.getDerivedStateFromError;if(typeof c=="function"){var d=l.value;e.payload=function(){return c(d)},e.callback=function(){fg(t,a,l)}}var b=a.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){fg(t,a,l),typeof c!="function"&&(ua===null?ua=new Set([this]):ua.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function WS(e,t,a,l,c){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=a.alternate,t!==null&&Ci(t,a,c,!0),a=jt.current,a!==null){switch(a.tag){case 31:case 13:return Xt===null?Is():a.alternate===null&&Je===0&&(Je=3),a.flags&=-257,a.flags|=65536,a.lanes=c,l===gs?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([l]):t.add(l),Iu(e,l,c)),!1;case 22:return a.flags|=65536,l===gs?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([l]):a.add(l)),Iu(e,l,c)),!1}throw Error(s(435,a.tag))}return Iu(e,l,c),Is(),!1}if(De)return t=jt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==jc&&(e=Error(s(422),{cause:l}),zl(Gt(e,a)))):(l!==jc&&(t=Error(s(423),{cause:l}),zl(Gt(t,a))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=Gt(l,a),c=gu(e.stateNode,l,c),Vc(e,c),Je!==4&&(Je=2)),!1;var d=Error(s(520),{cause:l});if(d=Gt(d,a),Ql===null?Ql=[d]:Ql.push(d),Je!==4&&(Je=2),t===null)return!0;l=Gt(l,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=c&-c,a.lanes|=e,e=gu(a.stateNode,l,e),Vc(a,e),!1;case 1:if(t=a.type,d=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(ua===null||!ua.has(d))))return a.flags|=65536,c&=-c,a.lanes|=c,c=hg(c),gg(c,e,a,l),Vc(a,c),!1}a=a.return}while(a!==null);return!1}var mu=Error(s(461)),at=!1;function gt(e,t,a,l){t.child=e===null?vh(t,null,a,l):Xa(t,e.child,a,l)}function mg(e,t,a,l,c){a=a.render;var d=t.ref;if("ref"in l){var b={};for(var w in l)w!=="ref"&&(b[w]=l[w])}else b=l;return Ga(t),l=Fc(e,t,a,b,d,c),w=Jc(),e!==null&&!at?(Pc(e,t,c),Dn(e,t,c)):(De&&w&&Dc(t),t.flags|=1,gt(e,t,l,c),t.child)}function pg(e,t,a,l,c){if(e===null){var d=a.type;return typeof d=="function"&&!Cc(d)&&d.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=d,yg(e,t,d,l,c)):(e=rs(a.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!wu(e,c)){var b=d.memoizedProps;if(a=a.compare,a=a!==null?a:Al,a(b,l)&&e.ref===t.ref)return Dn(e,t,c)}return t.flags|=1,e=Nn(d,l),e.ref=t.ref,e.return=t,t.child=e}function yg(e,t,a,l,c){if(e!==null){var d=e.memoizedProps;if(Al(d,l)&&e.ref===t.ref)if(at=!1,t.pendingProps=l=d,wu(e,c))(e.flags&131072)!==0&&(at=!0);else return t.lanes=e.lanes,Dn(e,t,c)}return pu(e,t,a,l,c)}function vg(e,t,a,l){var c=l.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|a:a,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~d}else l=0,t.child=null;return Sg(e,t,d,a,l)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&fs(t,d!==null?d.cachePool:null),d!==null?xh(t,d):Zc(),_h(t);else return l=t.lanes=536870912,Sg(e,t,d!==null?d.baseLanes|a:a,a,l)}else d!==null?(fs(t,d.cachePool),xh(t,d),oa(),t.memoizedState=null):(e!==null&&fs(t,null),Zc(),oa());return gt(e,t,c,a),t.child}function kl(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Sg(e,t,a,l,c){var d=qc();return d=d===null?null:{parent:tt._currentValue,pool:d},t.memoizedState={baseLanes:a,cachePool:d},e!==null&&fs(t,null),Zc(),_h(t),e!==null&&Ci(e,t,l,!0),t.childLanes=c,null}function Cs(e,t){return t=zs({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function bg(e,t,a){return Xa(t,e.child,null,a),e=Cs(t,t.pendingProps),e.flags|=2,Ot(t),t.memoizedState=null,e}function eb(e,t,a){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(De){if(l.mode==="hidden")return e=Cs(t,l),t.lanes=536870912,kl(null,e);if(Kc(t),(e=Xe)?(e=Rm(e,Vt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Pn!==null?{id:rn,overflow:cn}:null,retryLane:536870912,hydrationErrors:null},a=ah(e),a.return=t,t.child=a,ft=t,Xe=null)):e=null,e===null)throw ea(t);return t.lanes=536870912,null}return Cs(t,l)}var d=e.memoizedState;if(d!==null){var b=d.dehydrated;if(Kc(t),c)if(t.flags&256)t.flags&=-257,t=bg(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if(at||Ci(e,t,a,!1),c=(a&e.childLanes)!==0,at||c){if(l=Ye,l!==null&&(b=qo(l,a),b!==0&&b!==d.retryLane))throw d.retryLane=b,Ua(e,b),Ct(l,e,b),mu;Is(),t=bg(e,t,a)}else e=d.treeContext,Xe=Zt(b.nextSibling),ft=t,De=!0,Wn=null,Vt=!1,e!==null&&oh(t,e),t=Cs(t,l),t.flags|=4096;return t}return e=Nn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ms(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function pu(e,t,a,l,c){return Ga(t),a=Fc(e,t,a,l,void 0,c),l=Jc(),e!==null&&!at?(Pc(e,t,c),Dn(e,t,c)):(De&&l&&Dc(t),t.flags|=1,gt(e,t,a,c),t.child)}function xg(e,t,a,l,c,d){return Ga(t),t.updateQueue=null,a=Eh(t,l,a,c),wh(e),l=Jc(),e!==null&&!at?(Pc(e,t,d),Dn(e,t,d)):(De&&l&&Dc(t),t.flags|=1,gt(e,t,a,d),t.child)}function _g(e,t,a,l,c){if(Ga(t),t.stateNode===null){var d=Ei,b=a.contextType;typeof b=="object"&&b!==null&&(d=ht(b)),d=new a(l,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=hu,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=l,d.state=t.memoizedState,d.refs={},kc(t),b=a.contextType,d.context=typeof b=="object"&&b!==null?ht(b):Ei,d.state=t.memoizedState,b=a.getDerivedStateFromProps,typeof b=="function"&&(fu(t,a,b,l),d.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(b=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),b!==d.state&&hu.enqueueReplaceState(d,d.state,null),Ul(t,l,d,c),Ll(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){d=t.stateNode;var w=t.memoizedProps,L=$a(a,w);d.props=L;var Q=d.context,ne=a.contextType;b=Ei,typeof ne=="object"&&ne!==null&&(b=ht(ne));var le=a.getDerivedStateFromProps;ne=typeof le=="function"||typeof d.getSnapshotBeforeUpdate=="function",w=t.pendingProps!==w,ne||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(w||Q!==b)&&rg(t,d,l,b),na=!1;var J=t.memoizedState;d.state=J,Ul(t,l,d,c),Ll(),Q=t.memoizedState,w||J!==Q||na?(typeof le=="function"&&(fu(t,a,le,l),Q=t.memoizedState),(L=na||sg(t,a,L,l,J,Q,b))?(ne||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=Q),d.props=l,d.state=Q,d.context=b,l=L):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{d=t.stateNode,Yc(e,t),b=t.memoizedProps,ne=$a(a,b),d.props=ne,le=t.pendingProps,J=d.context,Q=a.contextType,L=Ei,typeof Q=="object"&&Q!==null&&(L=ht(Q)),w=a.getDerivedStateFromProps,(Q=typeof w=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==le||J!==L)&&rg(t,d,l,L),na=!1,J=t.memoizedState,d.state=J,Ul(t,l,d,c),Ll();var P=t.memoizedState;b!==le||J!==P||na||e!==null&&e.dependencies!==null&&us(e.dependencies)?(typeof w=="function"&&(fu(t,a,w,l),P=t.memoizedState),(ne=na||sg(t,a,ne,l,J,P,L)||e!==null&&e.dependencies!==null&&us(e.dependencies))?(Q||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(l,P,L),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(l,P,L)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),d.props=l,d.state=P,d.context=L,l=ne):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&J===e.memoizedState||(t.flags|=1024),l=!1)}return d=l,Ms(e,t),l=(t.flags&128)!==0,d||l?(d=t.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&l?(t.child=Xa(t,e.child,null,c),t.child=Xa(t,null,a,c)):gt(e,t,a,c),t.memoizedState=d.state,e=t.child):e=Dn(e,t,c),e}function wg(e,t,a,l){return Ia(),t.flags|=256,gt(e,t,a,l),t.child}var yu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function vu(e){return{baseLanes:e,cachePool:fh()}}function Su(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Lt),e}function Eg(e,t,a){var l=t.pendingProps,c=!1,d=(t.flags&128)!==0,b;if((b=d)||(b=e!==null&&e.memoizedState===null?!1:(Pe.current&2)!==0),b&&(c=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(De){if(c?la(t):oa(),(e=Xe)?(e=Rm(e,Vt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Pn!==null?{id:rn,overflow:cn}:null,retryLane:536870912,hydrationErrors:null},a=ah(e),a.return=t,t.child=a,ft=t,Xe=null)):e=null,e===null)throw ea(t);return td(e)?t.lanes=32:t.lanes=536870912,null}var w=l.children;return l=l.fallback,c?(oa(),c=t.mode,w=zs({mode:"hidden",children:w},c),l=Ba(l,c,a,null),w.return=t,l.return=t,w.sibling=l,t.child=w,l=t.child,l.memoizedState=vu(a),l.childLanes=Su(e,b,a),t.memoizedState=yu,kl(null,l)):(la(t),bu(t,w))}var L=e.memoizedState;if(L!==null&&(w=L.dehydrated,w!==null)){if(d)t.flags&256?(la(t),t.flags&=-257,t=xu(e,t,a)):t.memoizedState!==null?(oa(),t.child=e.child,t.flags|=128,t=null):(oa(),w=l.fallback,c=t.mode,l=zs({mode:"visible",children:l.children},c),w=Ba(w,c,a,null),w.flags|=2,l.return=t,w.return=t,l.sibling=w,t.child=l,Xa(t,e.child,null,a),l=t.child,l.memoizedState=vu(a),l.childLanes=Su(e,b,a),t.memoizedState=yu,t=kl(null,l));else if(la(t),td(w)){if(b=w.nextSibling&&w.nextSibling.dataset,b)var Q=b.dgst;b=Q,l=Error(s(419)),l.stack="",l.digest=b,zl({value:l,source:null,stack:null}),t=xu(e,t,a)}else if(at||Ci(e,t,a,!1),b=(a&e.childLanes)!==0,at||b){if(b=Ye,b!==null&&(l=qo(b,a),l!==0&&l!==L.retryLane))throw L.retryLane=l,Ua(e,l),Ct(b,e,l),mu;ed(w)||Is(),t=xu(e,t,a)}else ed(w)?(t.flags|=192,t.child=e.child,t=null):(e=L.treeContext,Xe=Zt(w.nextSibling),ft=t,De=!0,Wn=null,Vt=!1,e!==null&&oh(t,e),t=bu(t,l.children),t.flags|=4096);return t}return c?(oa(),w=l.fallback,c=t.mode,L=e.child,Q=L.sibling,l=Nn(L,{mode:"hidden",children:l.children}),l.subtreeFlags=L.subtreeFlags&65011712,Q!==null?w=Nn(Q,w):(w=Ba(w,c,a,null),w.flags|=2),w.return=t,l.return=t,l.sibling=w,t.child=l,kl(null,l),l=t.child,w=e.child.memoizedState,w===null?w=vu(a):(c=w.cachePool,c!==null?(L=tt._currentValue,c=c.parent!==L?{parent:L,pool:L}:c):c=fh(),w={baseLanes:w.baseLanes|a,cachePool:c}),l.memoizedState=w,l.childLanes=Su(e,b,a),t.memoizedState=yu,kl(e.child,l)):(la(t),a=e.child,e=a.sibling,a=Nn(a,{mode:"visible",children:l.children}),a.return=t,a.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=a,t.memoizedState=null,a)}function bu(e,t){return t=zs({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function zs(e,t){return e=Rt(22,e,null,t),e.lanes=0,e}function xu(e,t,a){return Xa(t,e.child,null,a),e=bu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ng(e,t,a){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Lc(e.return,t,a)}function _u(e,t,a,l,c,d){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:c,treeForkCount:d}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=l,b.tail=a,b.tailMode=c,b.treeForkCount=d)}function Tg(e,t,a){var l=t.pendingProps,c=l.revealOrder,d=l.tail;l=l.children;var b=Pe.current,w=(b&2)!==0;if(w?(b=b&1|2,t.flags|=128):b&=1,W(Pe,b),gt(e,t,l,a),l=De?Ml:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ng(e,a,t);else if(e.tag===19)Ng(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(a=t.child,c=null;a!==null;)e=a.alternate,e!==null&&vs(e)===null&&(c=a),a=a.sibling;a=c,a===null?(c=t.child,t.child=null):(c=a.sibling,a.sibling=null),_u(t,!1,c,a,d,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&vs(e)===null){t.child=c;break}e=c.sibling,c.sibling=a,a=c,c=e}_u(t,!0,a,null,d,l);break;case"together":_u(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Dn(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),ca|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Ci(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,a=Nn(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Nn(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function wu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&us(e)))}function tb(e,t,a){switch(t.tag){case 3:re(t,t.stateNode.containerInfo),ta(t,tt,e.memoizedState.cache),Ia();break;case 27:case 5:Ee(t);break;case 4:re(t,t.stateNode.containerInfo);break;case 10:ta(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Kc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(la(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Eg(e,t,a):(la(t),e=Dn(e,t,a),e!==null?e.sibling:null);la(t);break;case 19:var c=(e.flags&128)!==0;if(l=(a&t.childLanes)!==0,l||(Ci(e,t,a,!1),l=(a&t.childLanes)!==0),c){if(l)return Tg(e,t,a);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),W(Pe,Pe.current),l)break;return null;case 22:return t.lanes=0,vg(e,t,a,t.pendingProps);case 24:ta(t,tt,e.memoizedState.cache)}return Dn(e,t,a)}function Ag(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)at=!0;else{if(!wu(e,a)&&(t.flags&128)===0)return at=!1,tb(e,t,a);at=(e.flags&131072)!==0}else at=!1,De&&(t.flags&1048576)!==0&&lh(t,Ml,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Ya(t.elementType),t.type=e,typeof e=="function")Cc(e)?(l=$a(e,l),t.tag=1,t=_g(null,t,e,l,a)):(t.tag=0,t=pu(null,t,e,l,a));else{if(e!=null){var c=e.$$typeof;if(c===z){t.tag=11,t=mg(null,t,e,l,a);break e}else if(c===I){t.tag=14,t=pg(null,t,e,l,a);break e}}throw t=D(e)||e,Error(s(306,t,""))}}return t;case 0:return pu(e,t,t.type,t.pendingProps,a);case 1:return l=t.type,c=$a(l,t.pendingProps),_g(e,t,l,c,a);case 3:e:{if(re(t,t.stateNode.containerInfo),e===null)throw Error(s(387));l=t.pendingProps;var d=t.memoizedState;c=d.element,Yc(e,t),Ul(t,l,null,a);var b=t.memoizedState;if(l=b.cache,ta(t,tt,l),l!==d.cache&&Uc(t,[tt],a,!0),Ll(),l=b.element,d.isDehydrated)if(d={element:l,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=wg(e,t,l,a);break e}else if(l!==c){c=Gt(Error(s(424)),t),zl(c),t=wg(e,t,l,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Xe=Zt(e.firstChild),ft=t,De=!0,Wn=null,Vt=!0,a=vh(t,null,l,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Ia(),l===c){t=Dn(e,t,a);break e}gt(e,t,l,a)}t=t.child}return t;case 26:return Ms(e,t),e===null?(a=Bm(t.type,null,t.pendingProps,null))?t.memoizedState=a:De||(a=t.type,e=t.pendingProps,l=Zs(de.current).createElement(a),l[st]=t,l[pt]=e,mt(l,a,e),et(l),t.stateNode=l):t.memoizedState=Bm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ee(t),e===null&&De&&(l=t.stateNode=Hm(t.type,t.pendingProps,de.current),ft=t,Vt=!0,c=Xe,ga(t.type)?(nd=c,Xe=Zt(l.firstChild)):Xe=c),gt(e,t,t.pendingProps.children,a),Ms(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&De&&((c=l=Xe)&&(l=Db(l,t.type,t.pendingProps,Vt),l!==null?(t.stateNode=l,ft=t,Xe=Zt(l.firstChild),Vt=!1,c=!0):c=!1),c||ea(t)),Ee(t),c=t.type,d=t.pendingProps,b=e!==null?e.memoizedProps:null,l=d.children,Ju(c,d)?l=null:b!==null&&Ju(c,b)&&(t.flags|=32),t.memoizedState!==null&&(c=Fc(e,t,ZS,null,null,a),ao._currentValue=c),Ms(e,t),gt(e,t,l,a),t.child;case 6:return e===null&&De&&((e=a=Xe)&&(a=Rb(a,t.pendingProps,Vt),a!==null?(t.stateNode=a,ft=t,Xe=null,e=!0):e=!1),e||ea(t)),null;case 13:return Eg(e,t,a);case 4:return re(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Xa(t,null,l,a):gt(e,t,l,a),t.child;case 11:return mg(e,t,t.type,t.pendingProps,a);case 7:return gt(e,t,t.pendingProps,a),t.child;case 8:return gt(e,t,t.pendingProps.children,a),t.child;case 12:return gt(e,t,t.pendingProps.children,a),t.child;case 10:return l=t.pendingProps,ta(t,t.type,l.value),gt(e,t,l.children,a),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,Ga(t),c=ht(c),l=l(c),t.flags|=1,gt(e,t,l,a),t.child;case 14:return pg(e,t,t.type,t.pendingProps,a);case 15:return yg(e,t,t.type,t.pendingProps,a);case 19:return Tg(e,t,a);case 31:return eb(e,t,a);case 22:return vg(e,t,a,t.pendingProps);case 24:return Ga(t),l=ht(tt),e===null?(c=qc(),c===null&&(c=Ye,d=Bc(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=a),c=d),t.memoizedState={parent:l,cache:c},kc(t),ta(t,tt,c)):((e.lanes&a)!==0&&(Yc(e,t),Ul(t,null,null,a),Ll()),c=e.memoizedState,d=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),ta(t,tt,l)):(l=d.cache,ta(t,tt,l),l!==c.cache&&Uc(t,[tt],a,!0))),gt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function Rn(e){e.flags|=4}function Eu(e,t,a,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(em())e.flags|=8192;else throw Va=gs,Gc}else e.flags&=-16777217}function Cg(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t))if(em())e.flags|=8192;else throw Va=gs,Gc}function Ds(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Uo():536870912,e.lanes|=t,qi|=t)}function Yl(e,t){if(!De)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(t)for(var c=e.child;c!==null;)a|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)a|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=a,t}function nb(e,t,a){var l=t.pendingProps;switch(Rc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(t),null;case 1:return Ze(t),null;case 3:return a=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Cn(tt),fe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ai(t)?Rn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Oc())),Ze(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(Rn(t),d!==null?(Ze(t),Cg(t,d)):(Ze(t),Eu(t,c,null,l,a))):d?d!==e.memoizedState?(Rn(t),Ze(t),Cg(t,d)):(Ze(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Rn(t),Ze(t),Eu(t,c,e,l,a)),null;case 27:if(xe(t),a=de.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Rn(t);else{if(!l){if(t.stateNode===null)throw Error(s(166));return Ze(t),null}e=te.current,Ai(t)?sh(t):(e=Hm(c,l,a),t.stateNode=e,Rn(t))}return Ze(t),null;case 5:if(xe(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Rn(t);else{if(!l){if(t.stateNode===null)throw Error(s(166));return Ze(t),null}if(d=te.current,Ai(t))sh(t);else{var b=Zs(de.current);switch(d){case 1:d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=b.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof l.is=="string"?b.createElement("select",{is:l.is}):b.createElement("select"),l.multiple?d.multiple=!0:l.size&&(d.size=l.size);break;default:d=typeof l.is=="string"?b.createElement(c,{is:l.is}):b.createElement(c)}}d[st]=t,d[pt]=l;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)d.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=d;e:switch(mt(d,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Rn(t)}}return Ze(t),Eu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Rn(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(s(166));if(e=de.current,Ai(t)){if(e=t.stateNode,a=t.memoizedProps,l=null,c=ft,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[st]=t,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Em(e.nodeValue,a)),e||ea(t,!0)}else e=Zs(e).createTextNode(l),e[st]=t,t.stateNode=e}return Ze(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(l=Ai(t),a!==null){if(e===null){if(!l)throw Error(s(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[st]=t}else Ia(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),e=!1}else a=Oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Ot(t),t):(Ot(t),null);if((t.flags&128)!==0)throw Error(s(558))}return Ze(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Ai(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(s(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(s(317));c[st]=t}else Ia(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),c=!1}else c=Oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Ot(t),t):(Ot(t),null)}return Ot(t),(t.flags&128)!==0?(t.lanes=a,t):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),d=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(d=l.memoizedState.cachePool.pool),d!==c&&(l.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Ds(t,t.updateQueue),Ze(t),null);case 4:return fe(),e===null&&Zu(t.stateNode.containerInfo),Ze(t),null;case 10:return Cn(t.type),Ze(t),null;case 19:if(j(Pe),l=t.memoizedState,l===null)return Ze(t),null;if(c=(t.flags&128)!==0,d=l.rendering,d===null)if(c)Yl(l,!1);else{if(Je!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=vs(e),d!==null){for(t.flags|=128,Yl(l,!1),e=d.updateQueue,t.updateQueue=e,Ds(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)nh(a,e),a=a.sibling;return W(Pe,Pe.current&1|2),De&&Tn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&dt()>Ls&&(t.flags|=128,c=!0,Yl(l,!1),t.lanes=4194304)}else{if(!c)if(e=vs(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Ds(t,e),Yl(l,!0),l.tail===null&&l.tailMode==="hidden"&&!d.alternate&&!De)return Ze(t),null}else 2*dt()-l.renderingStartTime>Ls&&a!==536870912&&(t.flags|=128,c=!0,Yl(l,!1),t.lanes=4194304);l.isBackwards?(d.sibling=t.child,t.child=d):(e=l.last,e!==null?e.sibling=d:t.child=d,l.last=d)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=dt(),e.sibling=null,a=Pe.current,W(Pe,c?a&1|2:a&1),De&&Tn(t,l.treeForkCount),e):(Ze(t),null);case 22:case 23:return Ot(t),$c(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),a=t.updateQueue,a!==null&&Ds(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),e!==null&&j(ka),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Cn(tt),Ze(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function ab(e,t){switch(Rc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Cn(tt),fe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return xe(t),null;case 31:if(t.memoizedState!==null){if(Ot(t),t.alternate===null)throw Error(s(340));Ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ot(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return j(Pe),null;case 4:return fe(),null;case 10:return Cn(t.type),null;case 22:case 23:return Ot(t),$c(),e!==null&&j(ka),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Cn(tt),null;case 25:return null;default:return null}}function Mg(e,t){switch(Rc(t),t.tag){case 3:Cn(tt),fe();break;case 26:case 27:case 5:xe(t);break;case 4:fe();break;case 31:t.memoizedState!==null&&Ot(t);break;case 13:Ot(t);break;case 19:j(Pe);break;case 10:Cn(t.type);break;case 22:case 23:Ot(t),$c(),e!==null&&j(ka);break;case 24:Cn(tt)}}function Vl(e,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var c=l.next;a=c;do{if((a.tag&e)===e){l=void 0;var d=a.create,b=a.inst;l=d(),b.destroy=l}a=a.next}while(a!==c)}}catch(w){Be(t,t.return,w)}}function sa(e,t,a){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var d=c.next;l=d;do{if((l.tag&e)===e){var b=l.inst,w=b.destroy;if(w!==void 0){b.destroy=void 0,c=t;var L=a,Q=w;try{Q()}catch(ne){Be(c,L,ne)}}}l=l.next}while(l!==d)}}catch(ne){Be(t,t.return,ne)}}function zg(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{bh(t,a)}catch(l){Be(e,e.return,l)}}}function Dg(e,t,a){a.props=$a(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){Be(e,t,l)}}function Xl(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(c){Be(e,t,c)}}function un(e,t){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(c){Be(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(c){Be(e,t,c)}else a.current=null}function Rg(e){var t=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(c){Be(e,e.return,c)}}function Nu(e,t,a){try{var l=e.stateNode;Nb(l,e.type,a,t),l[pt]=t}catch(c){Be(e,e.return,c)}}function jg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ga(e.type)||e.tag===4}function Tu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ga(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Au(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=wn));else if(l!==4&&(l===27&&ga(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Au(e,t,a),e=e.sibling;e!==null;)Au(e,t,a),e=e.sibling}function Rs(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(l!==4&&(l===27&&ga(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Rs(e,t,a),e=e.sibling;e!==null;)Rs(e,t,a),e=e.sibling}function Og(e){var t=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);mt(t,l,a),t[st]=e,t[pt]=a}catch(d){Be(e,e.return,d)}}var jn=!1,it=!1,Cu=!1,Hg=typeof WeakSet=="function"?WeakSet:Set,ut=null;function ib(e,t){if(e=e.containerInfo,Qu=Ws,e=$f(e),xc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var c=l.anchorOffset,d=l.focusNode;l=l.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var b=0,w=-1,L=-1,Q=0,ne=0,le=e,J=null;t:for(;;){for(var P;le!==a||c!==0&&le.nodeType!==3||(w=b+c),le!==d||l!==0&&le.nodeType!==3||(L=b+l),le.nodeType===3&&(b+=le.nodeValue.length),(P=le.firstChild)!==null;)J=le,le=P;for(;;){if(le===e)break t;if(J===a&&++Q===c&&(w=b),J===d&&++ne===l&&(L=b),(P=le.nextSibling)!==null)break;le=J,J=le.parentNode}le=P}a=w===-1||L===-1?null:{start:w,end:L}}else a=null}a=a||{start:0,end:0}}else a=null;for(Fu={focusedElem:e,selectionRange:a},Ws=!1,ut=t;ut!==null;)if(t=ut,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ut=e;else for(;ut!==null;){switch(t=ut,d=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)c=e[a],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,a=t,c=d.memoizedProps,d=d.memoizedState,l=a.stateNode;try{var he=$a(a.type,c);e=l.getSnapshotBeforeUpdate(he,d),l.__reactInternalSnapshotBeforeUpdate=e}catch(ve){Be(a,a.return,ve)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Wu(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Wu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,ut=e;break}ut=t.return}}function Lg(e,t,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Hn(e,a),l&4&&Vl(5,a);break;case 1:if(Hn(e,a),l&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(b){Be(a,a.return,b)}else{var c=$a(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Be(a,a.return,b)}}l&64&&zg(a),l&512&&Xl(a,a.return);break;case 3:if(Hn(e,a),l&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{bh(e,t)}catch(b){Be(a,a.return,b)}}break;case 27:t===null&&l&4&&Og(a);case 26:case 5:Hn(e,a),t===null&&l&4&&Rg(a),l&512&&Xl(a,a.return);break;case 12:Hn(e,a);break;case 31:Hn(e,a),l&4&&Ig(e,a);break;case 13:Hn(e,a),l&4&&qg(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=hb.bind(null,a),jb(e,a))));break;case 22:if(l=a.memoizedState!==null||jn,!l){t=t!==null&&t.memoizedState!==null||it,c=jn;var d=it;jn=l,(it=t)&&!d?Ln(e,a,(a.subtreeFlags&8772)!==0):Hn(e,a),jn=c,it=d}break;case 30:break;default:Hn(e,a)}}function Ug(e){var t=e.alternate;t!==null&&(e.alternate=null,Ug(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&yl(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var $e=null,Et=!1;function On(e,t,a){for(a=a.child;a!==null;)Bg(e,t,a),a=a.sibling}function Bg(e,t,a){if(vt&&typeof vt.onCommitFiberUnmount=="function")try{vt.onCommitFiberUnmount(Ca,a)}catch{}switch(a.tag){case 26:it||un(a,t),On(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:it||un(a,t);var l=$e,c=Et;ga(a.type)&&($e=a.stateNode,Et=!1),On(e,t,a),eo(a.stateNode),$e=l,Et=c;break;case 5:it||un(a,t);case 6:if(l=$e,c=Et,$e=null,On(e,t,a),$e=l,Et=c,$e!==null)if(Et)try{($e.nodeType===9?$e.body:$e.nodeName==="HTML"?$e.ownerDocument.body:$e).removeChild(a.stateNode)}catch(d){Be(a,t,d)}else try{$e.removeChild(a.stateNode)}catch(d){Be(a,t,d)}break;case 18:$e!==null&&(Et?(e=$e,zm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Ki(e)):zm($e,a.stateNode));break;case 4:l=$e,c=Et,$e=a.stateNode.containerInfo,Et=!0,On(e,t,a),$e=l,Et=c;break;case 0:case 11:case 14:case 15:sa(2,a,t),it||sa(4,a,t),On(e,t,a);break;case 1:it||(un(a,t),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Dg(a,t,l)),On(e,t,a);break;case 21:On(e,t,a);break;case 22:it=(l=it)||a.memoizedState!==null,On(e,t,a),it=l;break;default:On(e,t,a)}}function Ig(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ki(e)}catch(a){Be(t,t.return,a)}}}function qg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ki(e)}catch(a){Be(t,t.return,a)}}function lb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Hg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Hg),t;default:throw Error(s(435,e.tag))}}function js(e,t){var a=lb(e);t.forEach(function(l){if(!a.has(l)){a.add(l);var c=gb.bind(null,e,l);l.then(c,c)}})}function Nt(e,t){var a=t.deletions;if(a!==null)for(var l=0;l<a.length;l++){var c=a[l],d=e,b=t,w=b;e:for(;w!==null;){switch(w.tag){case 27:if(ga(w.type)){$e=w.stateNode,Et=!1;break e}break;case 5:$e=w.stateNode,Et=!1;break e;case 3:case 4:$e=w.stateNode.containerInfo,Et=!0;break e}w=w.return}if($e===null)throw Error(s(160));Bg(d,b,c),$e=null,Et=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Gg(t,e),t=t.sibling}var Pt=null;function Gg(e,t){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Nt(t,e),Tt(e),l&4&&(sa(3,e,e.return),Vl(3,e),sa(5,e,e.return));break;case 1:Nt(t,e),Tt(e),l&512&&(it||a===null||un(a,a.return)),l&64&&jn&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var c=Pt;if(Nt(t,e),Tt(e),l&512&&(it||a===null||un(a,a.return)),l&4){var d=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":d=c.getElementsByTagName("title")[0],(!d||d[Da]||d[st]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(l),c.head.insertBefore(d,c.querySelector("head > title"))),mt(d,l,a),d[st]=e,et(d),l=d;break e;case"link":var b=Gm("link","href",c).get(l+(a.href||""));if(b){for(var w=0;w<b.length;w++)if(d=b[w],d.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&d.getAttribute("rel")===(a.rel==null?null:a.rel)&&d.getAttribute("title")===(a.title==null?null:a.title)&&d.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){b.splice(w,1);break t}}d=c.createElement(l),mt(d,l,a),c.head.appendChild(d);break;case"meta":if(b=Gm("meta","content",c).get(l+(a.content||""))){for(w=0;w<b.length;w++)if(d=b[w],d.getAttribute("content")===(a.content==null?null:""+a.content)&&d.getAttribute("name")===(a.name==null?null:a.name)&&d.getAttribute("property")===(a.property==null?null:a.property)&&d.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&d.getAttribute("charset")===(a.charSet==null?null:a.charSet)){b.splice(w,1);break t}}d=c.createElement(l),mt(d,l,a),c.head.appendChild(d);break;default:throw Error(s(468,l))}d[st]=e,et(d),l=d}e.stateNode=l}else km(c,e.type,e.stateNode);else e.stateNode=qm(c,l,e.memoizedProps);else d!==l?(d===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):d.count--,l===null?km(c,e.type,e.stateNode):qm(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Nu(e,e.memoizedProps,a.memoizedProps)}break;case 27:Nt(t,e),Tt(e),l&512&&(it||a===null||un(a,a.return)),a!==null&&l&4&&Nu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Nt(t,e),Tt(e),l&512&&(it||a===null||un(a,a.return)),e.flags&32){c=e.stateNode;try{yi(c,"")}catch(he){Be(e,e.return,he)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,Nu(e,c,a!==null?a.memoizedProps:c)),l&1024&&(Cu=!0);break;case 6:if(Nt(t,e),Tt(e),l&4){if(e.stateNode===null)throw Error(s(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(he){Be(e,e.return,he)}}break;case 3:if(Qs=null,c=Pt,Pt=$s(t.containerInfo),Nt(t,e),Pt=c,Tt(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Ki(t.containerInfo)}catch(he){Be(e,e.return,he)}Cu&&(Cu=!1,kg(e));break;case 4:l=Pt,Pt=$s(e.stateNode.containerInfo),Nt(t,e),Tt(e),Pt=l;break;case 12:Nt(t,e),Tt(e);break;case 31:Nt(t,e),Tt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,js(e,l)));break;case 13:Nt(t,e),Tt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Hs=dt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,js(e,l)));break;case 22:c=e.memoizedState!==null;var L=a!==null&&a.memoizedState!==null,Q=jn,ne=it;if(jn=Q||c,it=ne||L,Nt(t,e),it=ne,jn=Q,Tt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(a===null||L||jn||it||Ka(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){L=a=t;try{if(d=L.stateNode,c)b=d.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{w=L.stateNode;var le=L.memoizedProps.style,J=le!=null&&le.hasOwnProperty("display")?le.display:null;w.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(he){Be(L,L.return,he)}}}else if(t.tag===6){if(a===null){L=t;try{L.stateNode.nodeValue=c?"":L.memoizedProps}catch(he){Be(L,L.return,he)}}}else if(t.tag===18){if(a===null){L=t;try{var P=L.stateNode;c?Dm(P,!0):Dm(L.stateNode,!1)}catch(he){Be(L,L.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,js(e,a))));break;case 19:Nt(t,e),Tt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,js(e,l)));break;case 30:break;case 21:break;default:Nt(t,e),Tt(e)}}function Tt(e){var t=e.flags;if(t&2){try{for(var a,l=e.return;l!==null;){if(jg(l)){a=l;break}l=l.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var c=a.stateNode,d=Tu(e);Rs(e,d,c);break;case 5:var b=a.stateNode;a.flags&32&&(yi(b,""),a.flags&=-33);var w=Tu(e);Rs(e,w,b);break;case 3:case 4:var L=a.stateNode.containerInfo,Q=Tu(e);Au(e,Q,L);break;default:throw Error(s(161))}}catch(ne){Be(e,e.return,ne)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function kg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;kg(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Hn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Lg(e,t.alternate,t),t=t.sibling}function Ka(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:sa(4,t,t.return),Ka(t);break;case 1:un(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Dg(t,t.return,a),Ka(t);break;case 27:eo(t.stateNode);case 26:case 5:un(t,t.return),Ka(t);break;case 22:t.memoizedState===null&&Ka(t);break;case 30:Ka(t);break;default:Ka(t)}e=e.sibling}}function Ln(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,d=t,b=d.flags;switch(d.tag){case 0:case 11:case 15:Ln(c,d,a),Vl(4,d);break;case 1:if(Ln(c,d,a),l=d,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(Q){Be(l,l.return,Q)}if(l=d,c=l.updateQueue,c!==null){var w=l.stateNode;try{var L=c.shared.hiddenCallbacks;if(L!==null)for(c.shared.hiddenCallbacks=null,c=0;c<L.length;c++)Sh(L[c],w)}catch(Q){Be(l,l.return,Q)}}a&&b&64&&zg(d),Xl(d,d.return);break;case 27:Og(d);case 26:case 5:Ln(c,d,a),a&&l===null&&b&4&&Rg(d),Xl(d,d.return);break;case 12:Ln(c,d,a);break;case 31:Ln(c,d,a),a&&b&4&&Ig(c,d);break;case 13:Ln(c,d,a),a&&b&4&&qg(c,d);break;case 22:d.memoizedState===null&&Ln(c,d,a),Xl(d,d.return);break;case 30:break;default:Ln(c,d,a)}t=t.sibling}}function Mu(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Dl(a))}function zu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Dl(e))}function Wt(e,t,a,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Yg(e,t,a,l),t=t.sibling}function Yg(e,t,a,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Wt(e,t,a,l),c&2048&&Vl(9,t);break;case 1:Wt(e,t,a,l);break;case 3:Wt(e,t,a,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Dl(e)));break;case 12:if(c&2048){Wt(e,t,a,l),e=t.stateNode;try{var d=t.memoizedProps,b=d.id,w=d.onPostCommit;typeof w=="function"&&w(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(L){Be(t,t.return,L)}}else Wt(e,t,a,l);break;case 31:Wt(e,t,a,l);break;case 13:Wt(e,t,a,l);break;case 23:break;case 22:d=t.stateNode,b=t.alternate,t.memoizedState!==null?d._visibility&2?Wt(e,t,a,l):Zl(e,t):d._visibility&2?Wt(e,t,a,l):(d._visibility|=2,Ui(e,t,a,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Mu(b,t);break;case 24:Wt(e,t,a,l),c&2048&&zu(t.alternate,t);break;default:Wt(e,t,a,l)}}function Ui(e,t,a,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,b=t,w=a,L=l,Q=b.flags;switch(b.tag){case 0:case 11:case 15:Ui(d,b,w,L,c),Vl(8,b);break;case 23:break;case 22:var ne=b.stateNode;b.memoizedState!==null?ne._visibility&2?Ui(d,b,w,L,c):Zl(d,b):(ne._visibility|=2,Ui(d,b,w,L,c)),c&&Q&2048&&Mu(b.alternate,b);break;case 24:Ui(d,b,w,L,c),c&&Q&2048&&zu(b.alternate,b);break;default:Ui(d,b,w,L,c)}t=t.sibling}}function Zl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,l=t,c=l.flags;switch(l.tag){case 22:Zl(a,l),c&2048&&Mu(l.alternate,l);break;case 24:Zl(a,l),c&2048&&zu(l.alternate,l);break;default:Zl(a,l)}t=t.sibling}}var $l=8192;function Bi(e,t,a){if(e.subtreeFlags&$l)for(e=e.child;e!==null;)Vg(e,t,a),e=e.sibling}function Vg(e,t,a){switch(e.tag){case 26:Bi(e,t,a),e.flags&$l&&e.memoizedState!==null&&Xb(a,Pt,e.memoizedState,e.memoizedProps);break;case 5:Bi(e,t,a);break;case 3:case 4:var l=Pt;Pt=$s(e.stateNode.containerInfo),Bi(e,t,a),Pt=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=$l,$l=16777216,Bi(e,t,a),$l=l):Bi(e,t,a));break;default:Bi(e,t,a)}}function Xg(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Kl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];ut=l,$g(l,e)}Xg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Zg(e),e=e.sibling}function Zg(e){switch(e.tag){case 0:case 11:case 15:Kl(e),e.flags&2048&&sa(9,e,e.return);break;case 3:Kl(e);break;case 12:Kl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Os(e)):Kl(e);break;default:Kl(e)}}function Os(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];ut=l,$g(l,e)}Xg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:sa(8,t,t.return),Os(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Os(t));break;default:Os(t)}e=e.sibling}}function $g(e,t){for(;ut!==null;){var a=ut;switch(a.tag){case 0:case 11:case 15:sa(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Dl(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,ut=l;else e:for(a=e;ut!==null;){l=ut;var c=l.sibling,d=l.return;if(Ug(l),l===a){ut=null;break e}if(c!==null){c.return=d,ut=c;break e}ut=d}}}var ob={getCacheForType:function(e){var t=ht(tt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return ht(tt).controller.signal}},sb=typeof WeakMap=="function"?WeakMap:Map,He=0,Ye=null,Te=null,Me=0,Ue=0,Ht=null,ra=!1,Ii=!1,Du=!1,Un=0,Je=0,ca=0,Qa=0,Ru=0,Lt=0,qi=0,Ql=null,At=null,ju=!1,Hs=0,Kg=0,Ls=1/0,Us=null,ua=null,rt=0,da=null,Gi=null,Bn=0,Ou=0,Hu=null,Qg=null,Fl=0,Lu=null;function Ut(){return(He&2)!==0&&Me!==0?Me&-Me:T.T!==null?ku():Go()}function Fg(){if(Lt===0)if((Me&536870912)===0||De){var e=ui;ui<<=1,(ui&3932160)===0&&(ui=262144),Lt=e}else Lt=536870912;return e=jt.current,e!==null&&(e.flags|=32),Lt}function Ct(e,t,a){(e===Ye&&(Ue===2||Ue===9)||e.cancelPendingCommit!==null)&&(ki(e,0),fa(e,Me,Lt,!1)),za(e,a),((He&2)===0||e!==Ye)&&(e===Ye&&((He&2)===0&&(Qa|=a),Je===4&&fa(e,Me,Lt,!1)),dn(e))}function Jg(e,t,a){if((He&6)!==0)throw Error(s(327));var l=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Ma(e,t),c=l?ub(e,t):Bu(e,t,!0),d=l;do{if(c===0){Ii&&!l&&fa(e,t,0,!1);break}else{if(a=e.current.alternate,d&&!rb(a)){c=Bu(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var w=e;c=Ql;var L=w.current.memoizedState.isDehydrated;if(L&&(ki(w,b).flags|=256),b=Bu(w,b,!1),b!==2){if(Du&&!L){w.errorRecoveryDisabledLanes|=d,Qa|=d,c=4;break e}d=At,At=c,d!==null&&(At===null?At=d:At.push.apply(At,d))}c=b}if(d=!1,c!==2)continue}}if(c===1){ki(e,0),fa(e,t,0,!0);break}e:{switch(l=e,d=c,d){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:fa(l,t,Lt,!ra);break e;case 2:At=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(c=Hs+300-dt(),10<c)){if(fa(l,t,Lt,!ra),fi(l,0,!0)!==0)break e;Bn=t,l.timeoutHandle=Cm(Pg.bind(null,l,a,At,Us,ju,t,Lt,Qa,qi,ra,d,"Throttled",-0,0),c);break e}Pg(l,a,At,Us,ju,t,Lt,Qa,qi,ra,d,null,-0,0)}}break}while(!0);dn(e)}function Pg(e,t,a,l,c,d,b,w,L,Q,ne,le,J,P){if(e.timeoutHandle=-1,le=t.subtreeFlags,le&8192||(le&16785408)===16785408){le={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:wn},Vg(t,d,le);var he=(d&62914560)===d?Hs-dt():(d&4194048)===d?Kg-dt():0;if(he=Zb(le,he),he!==null){Bn=d,e.cancelPendingCommit=he(om.bind(null,e,t,d,a,l,c,b,w,L,ne,le,null,J,P)),fa(e,d,b,!Q);return}}om(e,t,d,a,l,c,b,w,L)}function rb(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var c=a[l],d=c.getSnapshot;c=c.value;try{if(!Dt(d(),c))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function fa(e,t,a,l){t&=~Ru,t&=~Qa,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var d=31-St(c),b=1<<d;l[d]=-1,c&=~b}a!==0&&Bo(e,a,t)}function Bs(){return(He&6)===0?(Jl(0),!1):!0}function Uu(){if(Te!==null){if(Ue===0)var e=Te.return;else e=Te,An=qa=null,Wc(e),Ri=null,jl=0,e=Te;for(;e!==null;)Mg(e.alternate,e),e=e.return;Te=null}}function ki(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Cb(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Bn=0,Uu(),Ye=e,Te=a=Nn(e.current,null),Me=t,Ue=0,Ht=null,ra=!1,Ii=Ma(e,t),Du=!1,qi=Lt=Ru=Qa=ca=Je=0,At=Ql=null,ju=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-St(l),d=1<<c;t|=e[c],l&=~d}return Un=t,ls(),a}function Wg(e,t){_e=null,T.H=Gl,t===Di||t===hs?(t=mh(),Ue=3):t===Gc?(t=mh(),Ue=4):Ue=t===mu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ht=t,Te===null&&(Je=1,As(e,Gt(t,e.current)))}function em(){var e=jt.current;return e===null?!0:(Me&4194048)===Me?Xt===null:(Me&62914560)===Me||(Me&536870912)!==0?e===Xt:!1}function tm(){var e=T.H;return T.H=Gl,e===null?Gl:e}function nm(){var e=T.A;return T.A=ob,e}function Is(){Je=4,ra||(Me&4194048)!==Me&&jt.current!==null||(Ii=!0),(ca&134217727)===0&&(Qa&134217727)===0||Ye===null||fa(Ye,Me,Lt,!1)}function Bu(e,t,a){var l=He;He|=2;var c=tm(),d=nm();(Ye!==e||Me!==t)&&(Us=null,ki(e,t)),t=!1;var b=Je;e:do try{if(Ue!==0&&Te!==null){var w=Te,L=Ht;switch(Ue){case 8:Uu(),b=6;break e;case 3:case 2:case 9:case 6:jt.current===null&&(t=!0);var Q=Ue;if(Ue=0,Ht=null,Yi(e,w,L,Q),a&&Ii){b=0;break e}break;default:Q=Ue,Ue=0,Ht=null,Yi(e,w,L,Q)}}cb(),b=Je;break}catch(ne){Wg(e,ne)}while(!0);return t&&e.shellSuspendCounter++,An=qa=null,He=l,T.H=c,T.A=d,Te===null&&(Ye=null,Me=0,ls()),b}function cb(){for(;Te!==null;)am(Te)}function ub(e,t){var a=He;He|=2;var l=tm(),c=nm();Ye!==e||Me!==t?(Us=null,Ls=dt()+500,ki(e,t)):Ii=Ma(e,t);e:do try{if(Ue!==0&&Te!==null){t=Te;var d=Ht;t:switch(Ue){case 1:Ue=0,Ht=null,Yi(e,t,d,1);break;case 2:case 9:if(hh(d)){Ue=0,Ht=null,im(t);break}t=function(){Ue!==2&&Ue!==9||Ye!==e||(Ue=7),dn(e)},d.then(t,t);break e;case 3:Ue=7;break e;case 4:Ue=5;break e;case 7:hh(d)?(Ue=0,Ht=null,im(t)):(Ue=0,Ht=null,Yi(e,t,d,7));break;case 5:var b=null;switch(Te.tag){case 26:b=Te.memoizedState;case 5:case 27:var w=Te;if(b?Ym(b):w.stateNode.complete){Ue=0,Ht=null;var L=w.sibling;if(L!==null)Te=L;else{var Q=w.return;Q!==null?(Te=Q,qs(Q)):Te=null}break t}}Ue=0,Ht=null,Yi(e,t,d,5);break;case 6:Ue=0,Ht=null,Yi(e,t,d,6);break;case 8:Uu(),Je=6;break e;default:throw Error(s(462))}}db();break}catch(ne){Wg(e,ne)}while(!0);return An=qa=null,T.H=l,T.A=c,He=a,Te!==null?0:(Ye=null,Me=0,ls(),Je)}function db(){for(;Te!==null&&!Na();)am(Te)}function am(e){var t=Ag(e.alternate,e,Un);e.memoizedProps=e.pendingProps,t===null?qs(e):Te=t}function im(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=xg(a,t,t.pendingProps,t.type,void 0,Me);break;case 11:t=xg(a,t,t.pendingProps,t.type.render,t.ref,Me);break;case 5:Wc(t);default:Mg(a,t),t=Te=nh(t,Un),t=Ag(a,t,Un)}e.memoizedProps=e.pendingProps,t===null?qs(e):Te=t}function Yi(e,t,a,l){An=qa=null,Wc(t),Ri=null,jl=0;var c=t.return;try{if(WS(e,c,t,a,Me)){Je=1,As(e,Gt(a,e.current)),Te=null;return}}catch(d){if(c!==null)throw Te=c,d;Je=1,As(e,Gt(a,e.current)),Te=null;return}t.flags&32768?(De||l===1?e=!0:Ii||(Me&536870912)!==0?e=!1:(ra=e=!0,(l===2||l===9||l===3||l===6)&&(l=jt.current,l!==null&&l.tag===13&&(l.flags|=16384))),lm(t,e)):qs(t)}function qs(e){var t=e;do{if((t.flags&32768)!==0){lm(t,ra);return}e=t.return;var a=nb(t.alternate,t,Un);if(a!==null){Te=a;return}if(t=t.sibling,t!==null){Te=t;return}Te=t=e}while(t!==null);Je===0&&(Je=5)}function lm(e,t){do{var a=ab(e.alternate,e);if(a!==null){a.flags&=32767,Te=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Te=e;return}Te=e=a}while(e!==null);Je=6,Te=null}function om(e,t,a,l,c,d,b,w,L){e.cancelPendingCommit=null;do Gs();while(rt!==0);if((He&6)!==0)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(d=t.lanes|t.childLanes,d|=Tc,nc(e,a,d,b,w,L),e===Ye&&(Te=Ye=null,Me=0),Gi=t,da=e,Bn=a,Ou=d,Hu=c,Qg=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,mb(Aa,function(){return dm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=T.T,T.T=null,c=U.p,U.p=2,b=He,He|=4;try{ib(e,t,a)}finally{He=b,U.p=c,T.T=l}}rt=1,sm(),rm(),cm()}}function sm(){if(rt===1){rt=0;var e=da,t=Gi,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=T.T,T.T=null;var l=U.p;U.p=2;var c=He;He|=4;try{Gg(t,e);var d=Fu,b=$f(e.containerInfo),w=d.focusedElem,L=d.selectionRange;if(b!==w&&w&&w.ownerDocument&&Zf(w.ownerDocument.documentElement,w)){if(L!==null&&xc(w)){var Q=L.start,ne=L.end;if(ne===void 0&&(ne=Q),"selectionStart"in w)w.selectionStart=Q,w.selectionEnd=Math.min(ne,w.value.length);else{var le=w.ownerDocument||document,J=le&&le.defaultView||window;if(J.getSelection){var P=J.getSelection(),he=w.textContent.length,ve=Math.min(L.start,he),ke=L.end===void 0?ve:Math.min(L.end,he);!P.extend&&ve>ke&&(b=ke,ke=ve,ve=b);var X=Xf(w,ve),q=Xf(w,ke);if(X&&q&&(P.rangeCount!==1||P.anchorNode!==X.node||P.anchorOffset!==X.offset||P.focusNode!==q.node||P.focusOffset!==q.offset)){var K=le.createRange();K.setStart(X.node,X.offset),P.removeAllRanges(),ve>ke?(P.addRange(K),P.extend(q.node,q.offset)):(K.setEnd(q.node,q.offset),P.addRange(K))}}}}for(le=[],P=w;P=P.parentNode;)P.nodeType===1&&le.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<le.length;w++){var ie=le[w];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}Ws=!!Qu,Fu=Qu=null}finally{He=c,U.p=l,T.T=a}}e.current=t,rt=2}}function rm(){if(rt===2){rt=0;var e=da,t=Gi,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=T.T,T.T=null;var l=U.p;U.p=2;var c=He;He|=4;try{Lg(e,t.alternate,t)}finally{He=c,U.p=l,T.T=a}}rt=3}}function cm(){if(rt===4||rt===3){rt=0,Ta();var e=da,t=Gi,a=Bn,l=Qg;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?rt=5:(rt=0,Gi=da=null,um(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(ua=null),pl(a),t=t.stateNode,vt&&typeof vt.onCommitFiberRoot=="function")try{vt.onCommitFiberRoot(Ca,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=T.T,c=U.p,U.p=2,T.T=null;try{for(var d=e.onRecoverableError,b=0;b<l.length;b++){var w=l[b];d(w.value,{componentStack:w.stack})}}finally{T.T=t,U.p=c}}(Bn&3)!==0&&Gs(),dn(e),c=e.pendingLanes,(a&261930)!==0&&(c&42)!==0?e===Lu?Fl++:(Fl=0,Lu=e):Fl=0,Jl(0)}}function um(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Dl(t)))}function Gs(){return sm(),rm(),cm(),dm()}function dm(){if(rt!==5)return!1;var e=da,t=Ou;Ou=0;var a=pl(Bn),l=T.T,c=U.p;try{U.p=32>a?32:a,T.T=null,a=Hu,Hu=null;var d=da,b=Bn;if(rt=0,Gi=da=null,Bn=0,(He&6)!==0)throw Error(s(331));var w=He;if(He|=4,Zg(d.current),Yg(d,d.current,b,a),He=w,Jl(0,!1),vt&&typeof vt.onPostCommitFiberRoot=="function")try{vt.onPostCommitFiberRoot(Ca,d)}catch{}return!0}finally{U.p=c,T.T=l,um(e,t)}}function fm(e,t,a){t=Gt(a,t),t=gu(e.stateNode,t,2),e=ia(e,t,2),e!==null&&(za(e,2),dn(e))}function Be(e,t,a){if(e.tag===3)fm(e,e,a);else for(;t!==null;){if(t.tag===3){fm(t,e,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ua===null||!ua.has(l))){e=Gt(a,e),a=hg(2),l=ia(t,a,2),l!==null&&(gg(a,l,t,e),za(l,2),dn(l));break}}t=t.return}}function Iu(e,t,a){var l=e.pingCache;if(l===null){l=e.pingCache=new sb;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(a)||(Du=!0,c.add(a),e=fb.bind(null,e,t,a),t.then(e,e))}function fb(e,t,a){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ye===e&&(Me&a)===a&&(Je===4||Je===3&&(Me&62914560)===Me&&300>dt()-Hs?(He&2)===0&&ki(e,0):Ru|=a,qi===Me&&(qi=0)),dn(e)}function hm(e,t){t===0&&(t=Uo()),e=Ua(e,t),e!==null&&(za(e,t),dn(e))}function hb(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),hm(e,a)}function gb(e,t){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(a=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(s(314))}l!==null&&l.delete(t),hm(e,a)}function mb(e,t){return Qt(e,t)}var ks=null,Vi=null,qu=!1,Ys=!1,Gu=!1,ha=0;function dn(e){e!==Vi&&e.next===null&&(Vi===null?ks=Vi=e:Vi=Vi.next=e),Ys=!0,qu||(qu=!0,yb())}function Jl(e,t){if(!Gu&&Ys){Gu=!0;do for(var a=!1,l=ks;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var d=0;else{var b=l.suspendedLanes,w=l.pingedLanes;d=(1<<31-St(42|e)+1)-1,d&=c&~(b&~w),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,ym(l,d))}else d=Me,d=fi(l,l===Ye?d:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(d&3)===0||Ma(l,d)||(a=!0,ym(l,d));l=l.next}while(a);Gu=!1}}function pb(){gm()}function gm(){Ys=qu=!1;var e=0;ha!==0&&Ab()&&(e=ha);for(var t=dt(),a=null,l=ks;l!==null;){var c=l.next,d=mm(l,t);d===0?(l.next=null,a===null?ks=c:a.next=c,c===null&&(Vi=a)):(a=l,(e!==0||(d&3)!==0)&&(Ys=!0)),l=c}rt!==0&&rt!==5||Jl(e),ha!==0&&(ha=0)}function mm(e,t){for(var a=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-St(d),w=1<<b,L=c[b];L===-1?((w&a)===0||(w&l)!==0)&&(c[b]=tc(w,t)):L<=t&&(e.expiredLanes|=w),d&=~w}if(t=Ye,a=Me,a=fi(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===t&&(Ue===2||Ue===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&yn(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Ma(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(l!==null&&yn(l),pl(a)){case 2:case 8:a=Xn;break;case 32:a=Aa;break;case 268435456:a=ri;break;default:a=Aa}return l=pm.bind(null,e),a=Qt(a,l),e.callbackPriority=t,e.callbackNode=a,t}return l!==null&&l!==null&&yn(l),e.callbackPriority=2,e.callbackNode=null,2}function pm(e,t){if(rt!==0&&rt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Gs()&&e.callbackNode!==a)return null;var l=Me;return l=fi(e,e===Ye?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Jg(e,l,t),mm(e,dt()),e.callbackNode!=null&&e.callbackNode===a?pm.bind(null,e):null)}function ym(e,t){if(Gs())return null;Jg(e,t,!0)}function yb(){Mb(function(){(He&6)!==0?Qt(vn,pb):gm()})}function ku(){if(ha===0){var e=Mi;e===0&&(e=ci,ci<<=1,(ci&261888)===0&&(ci=256)),ha=e}return ha}function vm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Jo(""+e)}function Sm(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function vb(e,t,a,l,c){if(t==="submit"&&a&&a.stateNode===c){var d=vm((c[pt]||null).action),b=l.submitter;b&&(t=(t=b[pt]||null)?vm(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var w=new ts("action","action",null,l,c);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ha!==0){var L=b?Sm(c,b):new FormData(c);ru(a,{pending:!0,data:L,method:c.method,action:d},null,L)}}else typeof d=="function"&&(w.preventDefault(),L=b?Sm(c,b):new FormData(c),ru(a,{pending:!0,data:L,method:c.method,action:d},d,L))},currentTarget:c}]})}}for(var Yu=0;Yu<Nc.length;Yu++){var Vu=Nc[Yu],Sb=Vu.toLowerCase(),bb=Vu[0].toUpperCase()+Vu.slice(1);Jt(Sb,"on"+bb)}Jt(Ff,"onAnimationEnd"),Jt(Jf,"onAnimationIteration"),Jt(Pf,"onAnimationStart"),Jt("dblclick","onDoubleClick"),Jt("focusin","onFocus"),Jt("focusout","onBlur"),Jt(LS,"onTransitionRun"),Jt(US,"onTransitionStart"),Jt(BS,"onTransitionCancel"),Jt(Wf,"onTransitionEnd"),Fn("onMouseEnter",["mouseout","mouseover"]),Fn("onMouseLeave",["mouseout","mouseover"]),Fn("onPointerEnter",["pointerout","pointerover"]),Fn("onPointerLeave",["pointerout","pointerover"]),xn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xn("onBeforeInput",["compositionend","keypress","textInput","paste"]),xn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pl="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(" "),xb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Pl));function bm(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],c=l.event;l=l.listeners;e:{var d=void 0;if(t)for(var b=l.length-1;0<=b;b--){var w=l[b],L=w.instance,Q=w.currentTarget;if(w=w.listener,L!==d&&c.isPropagationStopped())break e;d=w,c.currentTarget=Q;try{d(c)}catch(ne){is(ne)}c.currentTarget=null,d=L}else for(b=0;b<l.length;b++){if(w=l[b],L=w.instance,Q=w.currentTarget,w=w.listener,L!==d&&c.isPropagationStopped())break e;d=w,c.currentTarget=Q;try{d(c)}catch(ne){is(ne)}c.currentTarget=null,d=L}}}}function Ae(e,t){var a=t[hi];a===void 0&&(a=t[hi]=new Set);var l=e+"__bubble";a.has(l)||(xm(t,e,2,!1),a.add(l))}function Xu(e,t,a){var l=0;t&&(l|=4),xm(a,e,l,t)}var Vs="_reactListening"+Math.random().toString(36).slice(2);function Zu(e){if(!e[Vs]){e[Vs]=!0,Xo.forEach(function(a){a!=="selectionchange"&&(xb.has(a)||Xu(a,!1,e),Xu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Vs]||(t[Vs]=!0,Xu("selectionchange",!1,t))}}function xm(e,t,a,l){switch(Fm(t)){case 2:var c=Qb;break;case 8:c=Fb;break;default:c=sd}a=c.bind(null,t,a,e),c=void 0,!fc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,a,{capture:!0,passive:c}):e.addEventListener(t,a,!0):c!==void 0?e.addEventListener(t,a,{passive:c}):e.addEventListener(t,a,!1)}function $u(e,t,a,l,c){var d=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var b=l.tag;if(b===3||b===4){var w=l.stateNode.containerInfo;if(w===c)break;if(b===4)for(b=l.return;b!==null;){var L=b.tag;if((L===3||L===4)&&b.stateNode.containerInfo===c)return;b=b.return}for(;w!==null;){if(b=Zn(w),b===null)return;if(L=b.tag,L===5||L===6||L===26||L===27){l=d=b;continue e}w=w.parentNode}}l=l.return}Tf(function(){var Q=d,ne=uc(a),le=[];e:{var J=eh.get(e);if(J!==void 0){var P=ts,he=e;switch(e){case"keypress":if(Wo(a)===0)break e;case"keydown":case"keyup":P=gS;break;case"focusin":he="focus",P=pc;break;case"focusout":he="blur",P=pc;break;case"beforeblur":case"afterblur":P=pc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=Mf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=nS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=yS;break;case Ff:case Jf:case Pf:P=lS;break;case Wf:P=SS;break;case"scroll":case"scrollend":P=eS;break;case"wheel":P=xS;break;case"copy":case"cut":case"paste":P=sS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=Df;break;case"toggle":case"beforetoggle":P=wS}var ve=(t&4)!==0,ke=!ve&&(e==="scroll"||e==="scrollend"),X=ve?J!==null?J+"Capture":null:J;ve=[];for(var q=Q,K;q!==null;){var ie=q;if(K=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||K===null||X===null||(ie=bl(q,X),ie!=null&&ve.push(Wl(q,ie,K))),ke)break;q=q.return}0<ve.length&&(J=new P(J,he,null,a,ne),le.push({event:J,listeners:ve}))}}if((t&7)===0){e:{if(J=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",J&&a!==cc&&(he=a.relatedTarget||a.fromElement)&&(Zn(he)||he[bn]))break e;if((P||J)&&(J=ne.window===ne?ne:(J=ne.ownerDocument)?J.defaultView||J.parentWindow:window,P?(he=a.relatedTarget||a.toElement,P=Q,he=he?Zn(he):null,he!==null&&(ke=u(he),ve=he.tag,he!==ke||ve!==5&&ve!==27&&ve!==6)&&(he=null)):(P=null,he=Q),P!==he)){if(ve=Mf,ie="onMouseLeave",X="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(ve=Df,ie="onPointerLeave",X="onPointerEnter",q="pointer"),ke=P==null?J:Kn(P),K=he==null?J:Kn(he),J=new ve(ie,q+"leave",P,a,ne),J.target=ke,J.relatedTarget=K,ie=null,Zn(ne)===Q&&(ve=new ve(X,q+"enter",he,a,ne),ve.target=K,ve.relatedTarget=ke,ie=ve),ke=ie,P&&he)t:{for(ve=_b,X=P,q=he,K=0,ie=X;ie;ie=ve(ie))K++;ie=0;for(var pe=q;pe;pe=ve(pe))ie++;for(;0<K-ie;)X=ve(X),K--;for(;0<ie-K;)q=ve(q),ie--;for(;K--;){if(X===q||q!==null&&X===q.alternate){ve=X;break t}X=ve(X),q=ve(q)}ve=null}else ve=null;P!==null&&_m(le,J,P,ve,!1),he!==null&&ke!==null&&_m(le,ke,he,ve,!0)}}e:{if(J=Q?Kn(Q):window,P=J.nodeName&&J.nodeName.toLowerCase(),P==="select"||P==="input"&&J.type==="file")var je=If;else if(Uf(J))if(qf)je=jS;else{je=DS;var ge=zS}else P=J.nodeName,!P||P.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Q&&rc(Q.elementType)&&(je=If):je=RS;if(je&&(je=je(e,Q))){Bf(le,je,a,ne);break e}ge&&ge(e,J,Q),e==="focusout"&&Q&&J.type==="number"&&Q.memoizedProps.value!=null&&Sl(J,"number",J.value)}switch(ge=Q?Kn(Q):window,e){case"focusin":(Uf(ge)||ge.contentEditable==="true")&&(xi=ge,_c=Q,Cl=null);break;case"focusout":Cl=_c=xi=null;break;case"mousedown":wc=!0;break;case"contextmenu":case"mouseup":case"dragend":wc=!1,Kf(le,a,ne);break;case"selectionchange":if(HS)break;case"keydown":case"keyup":Kf(le,a,ne)}var Ne;if(vc)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else bi?Hf(e,a)&&(ze="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ze="onCompositionStart");ze&&(Rf&&a.locale!=="ko"&&(bi||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&bi&&(Ne=Af()):(Jn=ne,hc="value"in Jn?Jn.value:Jn.textContent,bi=!0)),ge=Xs(Q,ze),0<ge.length&&(ze=new zf(ze,e,null,a,ne),le.push({event:ze,listeners:ge}),Ne?ze.data=Ne:(Ne=Lf(a),Ne!==null&&(ze.data=Ne)))),(Ne=NS?TS(e,a):AS(e,a))&&(ze=Xs(Q,"onBeforeInput"),0<ze.length&&(ge=new zf("onBeforeInput","beforeinput",null,a,ne),le.push({event:ge,listeners:ze}),ge.data=Ne)),vb(le,e,Q,a,ne)}bm(le,t)})}function Wl(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Xs(e,t){for(var a=t+"Capture",l=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=bl(e,a),c!=null&&l.unshift(Wl(e,c,d)),c=bl(e,t),c!=null&&l.push(Wl(e,c,d))),e.tag===3)return l;e=e.return}return[]}function _b(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function _m(e,t,a,l,c){for(var d=t._reactName,b=[];a!==null&&a!==l;){var w=a,L=w.alternate,Q=w.stateNode;if(w=w.tag,L!==null&&L===l)break;w!==5&&w!==26&&w!==27||Q===null||(L=Q,c?(Q=bl(a,d),Q!=null&&b.unshift(Wl(a,Q,L))):c||(Q=bl(a,d),Q!=null&&b.push(Wl(a,Q,L)))),a=a.return}b.length!==0&&e.push({event:t,listeners:b})}var wb=/\r\n?/g,Eb=/\u0000|\uFFFD/g;function wm(e){return(typeof e=="string"?e:""+e).replace(wb,`
|
|
9
|
-
`).replace(Eb,"")}function Em(e,t){return t=wm(t),wm(e)===t}function Ge(e,t,a,l,c,d){switch(a){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||yi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&yi(e,""+l);break;case"className":mi(e,"class",l);break;case"tabIndex":mi(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":mi(e,a,l);break;case"style":Ef(e,l,d);break;case"data":if(t!=="object"){mi(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Jo(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"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 d=="function"&&(a==="formAction"?(t!=="input"&&Ge(e,t,"name",c.name,c,null),Ge(e,t,"formEncType",c.formEncType,c,null),Ge(e,t,"formMethod",c.formMethod,c,null),Ge(e,t,"formTarget",c.formTarget,c,null)):(Ge(e,t,"encType",c.encType,c,null),Ge(e,t,"method",c.method,c,null),Ge(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Jo(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=wn);break;case"onScroll":l!=null&&Ae("scroll",e);break;case"onScrollEnd":l!=null&&Ae("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(s(61));if(a=l.__html,a!=null){if(c.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=Jo(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":Ae("beforetoggle",e),Ae("toggle",e),gi(e,"popover",l);break;case"xlinkActuate":Ft(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ft(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ft(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ft(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ft(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ft(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ft(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ft(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ft(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":gi(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Pv.get(a)||a,gi(e,a,l))}}function Ku(e,t,a,l,c,d){switch(a){case"style":Ef(e,l,d);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(s(61));if(a=l.__html,a!=null){if(c.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"children":typeof l=="string"?yi(e,l):(typeof l=="number"||typeof l=="bigint")&&yi(e,""+l);break;case"onScroll":l!=null&&Ae("scroll",e);break;case"onScrollEnd":l!=null&&Ae("scrollend",e);break;case"onClick":l!=null&&(e.onclick=wn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zo.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(c=a.endsWith("Capture"),t=a.slice(2,c?a.length-7:void 0),d=e[pt]||null,d=d!=null?d[a]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof l=="function")){typeof d!="function"&&d!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,l,c);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):gi(e,a,l)}}}function mt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ae("error",e),Ae("load",e);var l=!1,c=!1,d;for(d in a)if(a.hasOwnProperty(d)){var b=a[d];if(b!=null)switch(d){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Ge(e,t,d,b,a,null)}}c&&Ge(e,t,"srcSet",a.srcSet,a,null),l&&Ge(e,t,"src",a.src,a,null);return;case"input":Ae("invalid",e);var w=d=b=c=null,L=null,Q=null;for(l in a)if(a.hasOwnProperty(l)){var ne=a[l];if(ne!=null)switch(l){case"name":c=ne;break;case"type":b=ne;break;case"checked":L=ne;break;case"defaultChecked":Q=ne;break;case"value":d=ne;break;case"defaultValue":w=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(s(137,t));break;default:Ge(e,t,l,ne,a,null)}}Fo(e,d,w,L,Q,b,c,!1);return;case"select":Ae("invalid",e),l=b=d=null;for(c in a)if(a.hasOwnProperty(c)&&(w=a[c],w!=null))switch(c){case"value":d=w;break;case"defaultValue":b=w;break;case"multiple":l=w;default:Ge(e,t,c,w,a,null)}t=d,a=b,e.multiple=!!l,t!=null?_n(e,!!l,t,!1):a!=null&&_n(e,!!l,a,!0);return;case"textarea":Ae("invalid",e),d=c=l=null;for(b in a)if(a.hasOwnProperty(b)&&(w=a[b],w!=null))switch(b){case"value":l=w;break;case"defaultValue":c=w;break;case"children":d=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:Ge(e,t,b,w,a,null)}_f(e,l,c,d);return;case"option":for(L in a)a.hasOwnProperty(L)&&(l=a[L],l!=null)&&(L==="selected"?e.selected=l&&typeof l!="function"&&typeof l!="symbol":Ge(e,t,L,l,a,null));return;case"dialog":Ae("beforetoggle",e),Ae("toggle",e),Ae("cancel",e),Ae("close",e);break;case"iframe":case"object":Ae("load",e);break;case"video":case"audio":for(l=0;l<Pl.length;l++)Ae(Pl[l],e);break;case"image":Ae("error",e),Ae("load",e);break;case"details":Ae("toggle",e);break;case"embed":case"source":case"link":Ae("error",e),Ae("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Q in a)if(a.hasOwnProperty(Q)&&(l=a[Q],l!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Ge(e,t,Q,l,a,null)}return;default:if(rc(t)){for(ne in a)a.hasOwnProperty(ne)&&(l=a[ne],l!==void 0&&Ku(e,t,ne,l,a,void 0));return}}for(w in a)a.hasOwnProperty(w)&&(l=a[w],l!=null&&Ge(e,t,w,l,a,null))}function Nb(e,t,a,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,b=null,w=null,L=null,Q=null,ne=null;for(P in a){var le=a[P];if(a.hasOwnProperty(P)&&le!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":L=le;default:l.hasOwnProperty(P)||Ge(e,t,P,null,l,le)}}for(var J in l){var P=l[J];if(le=a[J],l.hasOwnProperty(J)&&(P!=null||le!=null))switch(J){case"type":d=P;break;case"name":c=P;break;case"checked":Q=P;break;case"defaultChecked":ne=P;break;case"value":b=P;break;case"defaultValue":w=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(s(137,t));break;default:P!==le&&Ge(e,t,J,P,l,le)}}ja(e,b,w,L,Q,ne,d,c);return;case"select":P=b=w=J=null;for(d in a)if(L=a[d],a.hasOwnProperty(d)&&L!=null)switch(d){case"value":break;case"multiple":P=L;default:l.hasOwnProperty(d)||Ge(e,t,d,null,l,L)}for(c in l)if(d=l[c],L=a[c],l.hasOwnProperty(c)&&(d!=null||L!=null))switch(c){case"value":J=d;break;case"defaultValue":w=d;break;case"multiple":b=d;default:d!==L&&Ge(e,t,c,d,l,L)}t=w,a=b,l=P,J!=null?_n(e,!!a,J,!1):!!l!=!!a&&(t!=null?_n(e,!!a,t,!0):_n(e,!!a,a?[]:"",!1));return;case"textarea":P=J=null;for(w in a)if(c=a[w],a.hasOwnProperty(w)&&c!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:Ge(e,t,w,null,l,c)}for(b in l)if(c=l[b],d=a[b],l.hasOwnProperty(b)&&(c!=null||d!=null))switch(b){case"value":J=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(s(91));break;default:c!==d&&Ge(e,t,b,c,l,d)}xf(e,J,P);return;case"option":for(var he in a)J=a[he],a.hasOwnProperty(he)&&J!=null&&!l.hasOwnProperty(he)&&(he==="selected"?e.selected=!1:Ge(e,t,he,null,l,J));for(L in l)J=l[L],P=a[L],l.hasOwnProperty(L)&&J!==P&&(J!=null||P!=null)&&(L==="selected"?e.selected=J&&typeof J!="function"&&typeof J!="symbol":Ge(e,t,L,J,l,P));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 ve in a)J=a[ve],a.hasOwnProperty(ve)&&J!=null&&!l.hasOwnProperty(ve)&&Ge(e,t,ve,null,l,J);for(Q in l)if(J=l[Q],P=a[Q],l.hasOwnProperty(Q)&&J!==P&&(J!=null||P!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(s(137,t));break;default:Ge(e,t,Q,J,l,P)}return;default:if(rc(t)){for(var ke in a)J=a[ke],a.hasOwnProperty(ke)&&J!==void 0&&!l.hasOwnProperty(ke)&&Ku(e,t,ke,void 0,l,J);for(ne in l)J=l[ne],P=a[ne],!l.hasOwnProperty(ne)||J===P||J===void 0&&P===void 0||Ku(e,t,ne,J,l,P);return}}for(var X in a)J=a[X],a.hasOwnProperty(X)&&J!=null&&!l.hasOwnProperty(X)&&Ge(e,t,X,null,l,J);for(le in l)J=l[le],P=a[le],!l.hasOwnProperty(le)||J===P||J==null&&P==null||Ge(e,t,le,J,l,P)}function Nm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Tb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var c=a[l],d=c.transferSize,b=c.initiatorType,w=c.duration;if(d&&w&&Nm(b)){for(b=0,w=c.responseEnd,l+=1;l<a.length;l++){var L=a[l],Q=L.startTime;if(Q>w)break;var ne=L.transferSize,le=L.initiatorType;ne&&Nm(le)&&(L=L.responseEnd,b+=ne*(L<w?1:(w-Q)/(L-Q)))}if(--l,t+=8*(d+b)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Qu=null,Fu=null;function Zs(e){return e.nodeType===9?e:e.ownerDocument}function Tm(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Am(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Ju(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Pu=null;function Ab(){var e=window.event;return e&&e.type==="popstate"?e===Pu?!1:(Pu=e,!0):(Pu=null,!1)}var Cm=typeof setTimeout=="function"?setTimeout:void 0,Cb=typeof clearTimeout=="function"?clearTimeout:void 0,Mm=typeof Promise=="function"?Promise:void 0,Mb=typeof queueMicrotask=="function"?queueMicrotask:typeof Mm<"u"?function(e){return Mm.resolve(null).then(e).catch(zb)}:Cm;function zb(e){setTimeout(function(){throw e})}function ga(e){return e==="head"}function zm(e,t){var a=t,l=0;do{var c=a.nextSibling;if(e.removeChild(a),c&&c.nodeType===8)if(a=c.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(c),Ki(t);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")eo(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,eo(a);for(var d=a.firstChild;d;){var b=d.nextSibling,w=d.nodeName;d[Da]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&d.rel.toLowerCase()==="stylesheet"||a.removeChild(d),d=b}}else a==="body"&&eo(e.ownerDocument.body);a=c}while(a);Ki(t)}function Dm(e,t){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function Wu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Wu(a),yl(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Db(e,t,a,l){for(;e.nodeType===1;){var c=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Da])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=Zt(e.nextSibling),e===null)break}return null}function Rb(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Zt(e.nextSibling),e===null))return null;return e}function Rm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Zt(e.nextSibling),e===null))return null;return e}function ed(e){return e.data==="$?"||e.data==="$~"}function td(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function jb(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var l=function(){t(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Zt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var nd=null;function jm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return Zt(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Om(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Hm(e,t,a){switch(t=Zs(a),e){case"html":if(e=t.documentElement,!e)throw Error(s(452));return e;case"head":if(e=t.head,!e)throw Error(s(453));return e;case"body":if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function eo(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);yl(e)}var $t=new Map,Lm=new Set;function $s(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var In=U.d;U.d={f:Ob,r:Hb,D:Lb,C:Ub,L:Bb,m:Ib,X:Gb,S:qb,M:kb};function Ob(){var e=In.f(),t=Bs();return e||t}function Hb(e){var t=$n(e);t!==null&&t.tag===5&&t.type==="form"?Wh(t):In.r(e)}var Xi=typeof document>"u"?null:document;function Um(e,t,a){var l=Xi;if(l&&typeof t=="string"&&t){var c=_t(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),Lm.has(c)||(Lm.add(c),e={rel:e,crossOrigin:a,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),mt(t,"link",e),et(t),l.head.appendChild(t)))}}function Lb(e){In.D(e),Um("dns-prefetch",e,null)}function Ub(e,t){In.C(e,t),Um("preconnect",e,t)}function Bb(e,t,a){In.L(e,t,a);var l=Xi;if(l&&e&&t){var c='link[rel="preload"][as="'+_t(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+_t(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+_t(a.imageSizes)+'"]')):c+='[href="'+_t(e)+'"]';var d=c;switch(t){case"style":d=Zi(e);break;case"script":d=$i(e)}$t.has(d)||(e=v({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),$t.set(d,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(to(d))||t==="script"&&l.querySelector(no(d))||(t=l.createElement("link"),mt(t,"link",e),et(t),l.head.appendChild(t)))}}function Ib(e,t){In.m(e,t);var a=Xi;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+_t(l)+'"][href="'+_t(e)+'"]',d=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=$i(e)}if(!$t.has(d)&&(e=v({rel:"modulepreload",href:e},t),$t.set(d,e),a.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(no(d)))return}l=a.createElement("link"),mt(l,"link",e),et(l),a.head.appendChild(l)}}}function qb(e,t,a){In.S(e,t,a);var l=Xi;if(l&&e){var c=Qn(l).hoistableStyles,d=Zi(e);t=t||"default";var b=c.get(d);if(!b){var w={loading:0,preload:null};if(b=l.querySelector(to(d)))w.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},a),(a=$t.get(d))&&ad(e,a);var L=b=l.createElement("link");et(L),mt(L,"link",e),L._p=new Promise(function(Q,ne){L.onload=Q,L.onerror=ne}),L.addEventListener("load",function(){w.loading|=1}),L.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Ks(b,t,l)}b={type:"stylesheet",instance:b,count:1,state:w},c.set(d,b)}}}function Gb(e,t){In.X(e,t);var a=Xi;if(a&&e){var l=Qn(a).hoistableScripts,c=$i(e),d=l.get(c);d||(d=a.querySelector(no(c)),d||(e=v({src:e,async:!0},t),(t=$t.get(c))&&id(e,t),d=a.createElement("script"),et(d),mt(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(c,d))}}function kb(e,t){In.M(e,t);var a=Xi;if(a&&e){var l=Qn(a).hoistableScripts,c=$i(e),d=l.get(c);d||(d=a.querySelector(no(c)),d||(e=v({src:e,async:!0,type:"module"},t),(t=$t.get(c))&&id(e,t),d=a.createElement("script"),et(d),mt(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(c,d))}}function Bm(e,t,a,l){var c=(c=de.current)?$s(c):null;if(!c)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Zi(a.href),a=Qn(c).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Zi(a.href);var d=Qn(c).hoistableStyles,b=d.get(e);if(b||(c=c.ownerDocument||c,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,b),(d=c.querySelector(to(e)))&&!d._p&&(b.instance=d,b.state.loading=5),$t.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},$t.set(e,a),d||Yb(c,e,a,b.state))),t&&l===null)throw Error(s(528,""));return b}if(t&&l!==null)throw Error(s(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=$i(a),a=Qn(c).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Zi(e){return'href="'+_t(e)+'"'}function to(e){return'link[rel="stylesheet"]['+e+"]"}function Im(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function Yb(e,t,a,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),mt(t,"link",a),et(t),e.head.appendChild(t))}function $i(e){return'[src="'+_t(e)+'"]'}function no(e){return"script[async]"+e}function qm(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+_t(a.href)+'"]');if(l)return t.instance=l,et(l),l;var c=v({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),et(l),mt(l,"style",c),Ks(l,a.precedence,e),t.instance=l;case"stylesheet":c=Zi(a.href);var d=e.querySelector(to(c));if(d)return t.state.loading|=4,t.instance=d,et(d),d;l=Im(a),(c=$t.get(c))&&ad(l,c),d=(e.ownerDocument||e).createElement("link"),et(d);var b=d;return b._p=new Promise(function(w,L){b.onload=w,b.onerror=L}),mt(d,"link",l),t.state.loading|=4,Ks(d,a.precedence,e),t.instance=d;case"script":return d=$i(a.src),(c=e.querySelector(no(d)))?(t.instance=c,et(c),c):(l=a,(c=$t.get(d))&&(l=v({},a),id(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),et(c),mt(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(s(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Ks(l,a.precedence,e));return t.instance}function Ks(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,d=c,b=0;b<l.length;b++){var w=l[b];if(w.dataset.precedence===t)d=w;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function ad(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function id(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Qs=null;function Gm(e,t,a){if(Qs===null){var l=new Map,c=Qs=new Map;c.set(a,l)}else c=Qs,l=c.get(a),l||(l=new Map,c.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),c=0;c<a.length;c++){var d=a[c];if(!(d[Da]||d[st]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var b=d.getAttribute(t)||"";b=e+b;var w=l.get(b);w?w.push(d):l.set(b,[d])}}return l}function km(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function Vb(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Ym(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Xb(e,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var c=Zi(l.href),d=t.querySelector(to(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Fs.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=d,et(d);return}d=t.ownerDocument||t,l=Im(l),(c=$t.get(c))&&ad(l,c),d=d.createElement("link"),et(d);var b=d;b._p=new Promise(function(w,L){b.onload=w,b.onerror=L}),mt(d,"link",l),a.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Fs.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var ld=0;function Zb(e,t){return e.stylesheets&&e.count===0&&Ps(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&Ps(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&ld===0&&(ld=62500*Tb());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ps(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>ld?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function Fs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ps(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Js=null;function Ps(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Js=new Map,t.forEach($b,e),Js=null,Fs.call(e))}function $b(e,t){if(!(t.state.loading&4)){var a=Js.get(e);if(a)var l=a.get(null);else{a=new Map,Js.set(e,a);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var b=c[d];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(a.set(b.dataset.precedence,b),l=b)}l&&a.set(null,l)}c=t.instance,b=c.getAttribute("data-precedence"),d=a.get(b)||l,d===l&&a.set(null,c),a.set(b,c),this.count++,l=Fs.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var ao={$$typeof:_,Provider:null,Consumer:null,_currentValue:G,_currentValue2:G,_threadCount:0};function Kb(e,t,a,l,c,d,b,w,L){this.tag=1,this.containerInfo=e,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=gl(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gl(0),this.hiddenUpdates=gl(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function Vm(e,t,a,l,c,d,b,w,L,Q,ne,le){return e=new Kb(e,t,a,b,L,Q,ne,le,w),t=1,d===!0&&(t|=24),d=Rt(3,null,null,t),e.current=d,d.stateNode=e,t=Bc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:l,isDehydrated:a,cache:t},kc(d),e}function Xm(e){return e?(e=Ei,e):Ei}function Zm(e,t,a,l,c,d){c=Xm(c),l.context===null?l.context=c:l.pendingContext=c,l=aa(t),l.payload={element:a},d=d===void 0?null:d,d!==null&&(l.callback=d),a=ia(e,l,t),a!==null&&(Ct(a,e,t),Hl(a,e,t))}function $m(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function od(e,t){$m(e,t),(e=e.alternate)&&$m(e,t)}function Km(e){if(e.tag===13||e.tag===31){var t=Ua(e,67108864);t!==null&&Ct(t,e,67108864),od(e,67108864)}}function Qm(e){if(e.tag===13||e.tag===31){var t=Ut();t=ml(t);var a=Ua(e,t);a!==null&&Ct(a,e,t),od(e,t)}}var Ws=!0;function Qb(e,t,a,l){var c=T.T;T.T=null;var d=U.p;try{U.p=2,sd(e,t,a,l)}finally{U.p=d,T.T=c}}function Fb(e,t,a,l){var c=T.T;T.T=null;var d=U.p;try{U.p=8,sd(e,t,a,l)}finally{U.p=d,T.T=c}}function sd(e,t,a,l){if(Ws){var c=rd(l);if(c===null)$u(e,t,l,er,a),Jm(e,l);else if(Pb(c,e,t,a,l))l.stopPropagation();else if(Jm(e,l),t&4&&-1<Jb.indexOf(e)){for(;c!==null;){var d=$n(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=Sn(d.pendingLanes);if(b!==0){var w=d;for(w.pendingLanes|=2,w.entangledLanes|=2;b;){var L=1<<31-St(b);w.entanglements[1]|=L,b&=~L}dn(d),(He&6)===0&&(Ls=dt()+500,Jl(0))}}break;case 31:case 13:w=Ua(d,2),w!==null&&Ct(w,d,2),Bs(),od(d,2)}if(d=rd(l),d===null&&$u(e,t,l,er,a),d===c)break;c=d}c!==null&&l.stopPropagation()}else $u(e,t,l,null,a)}}function rd(e){return e=uc(e),cd(e)}var er=null;function cd(e){if(er=null,e=Zn(e),e!==null){var t=u(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=f(t),e!==null)return e;e=null}else if(a===31){if(e=g(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return er=e,null}function Fm(e){switch(e){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(si()){case vn:return 2;case Xn:return 8;case Aa:case Qr:return 32;case ri:return 268435456;default:return 32}default:return 32}}var ud=!1,ma=null,pa=null,ya=null,io=new Map,lo=new Map,va=[],Jb="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 Jm(e,t){switch(e){case"focusin":case"focusout":ma=null;break;case"dragenter":case"dragleave":pa=null;break;case"mouseover":case"mouseout":ya=null;break;case"pointerover":case"pointerout":io.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":lo.delete(t.pointerId)}}function oo(e,t,a,l,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:a,eventSystemFlags:l,nativeEvent:d,targetContainers:[c]},t!==null&&(t=$n(t),t!==null&&Km(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Pb(e,t,a,l,c){switch(t){case"focusin":return ma=oo(ma,e,t,a,l,c),!0;case"dragenter":return pa=oo(pa,e,t,a,l,c),!0;case"mouseover":return ya=oo(ya,e,t,a,l,c),!0;case"pointerover":var d=c.pointerId;return io.set(d,oo(io.get(d)||null,e,t,a,l,c)),!0;case"gotpointercapture":return d=c.pointerId,lo.set(d,oo(lo.get(d)||null,e,t,a,l,c)),!0}return!1}function Pm(e){var t=Zn(e.target);if(t!==null){var a=u(t);if(a!==null){if(t=a.tag,t===13){if(t=f(a),t!==null){e.blockedOn=t,ko(e.priority,function(){Qm(a)});return}}else if(t===31){if(t=g(a),t!==null){e.blockedOn=t,ko(e.priority,function(){Qm(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function tr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=rd(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);cc=l,a.target.dispatchEvent(l),cc=null}else return t=$n(a),t!==null&&Km(t),e.blockedOn=a,!1;t.shift()}return!0}function Wm(e,t,a){tr(e)&&a.delete(t)}function Wb(){ud=!1,ma!==null&&tr(ma)&&(ma=null),pa!==null&&tr(pa)&&(pa=null),ya!==null&&tr(ya)&&(ya=null),io.forEach(Wm),lo.forEach(Wm)}function nr(e,t){e.blockedOn===t&&(e.blockedOn=null,ud||(ud=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Wb)))}var ar=null;function ep(e){ar!==e&&(ar=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){ar===e&&(ar=null);for(var t=0;t<e.length;t+=3){var a=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(cd(l||a)===null)continue;break}var d=$n(a);d!==null&&(e.splice(t,3),t-=3,ru(d,{pending:!0,data:c,method:a.method,action:l},l,c))}}))}function Ki(e){function t(L){return nr(L,e)}ma!==null&&nr(ma,e),pa!==null&&nr(pa,e),ya!==null&&nr(ya,e),io.forEach(t),lo.forEach(t);for(var a=0;a<va.length;a++){var l=va[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<va.length&&(a=va[0],a.blockedOn===null);)Pm(a),a.blockedOn===null&&va.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var c=a[l],d=a[l+1],b=c[pt]||null;if(typeof d=="function")b||ep(a);else if(b){var w=null;if(d&&d.hasAttribute("formAction")){if(c=d,b=d[pt]||null)w=b.formAction;else if(cd(c)!==null)continue}else w=b.action;typeof w=="function"?a[l+1]=w:(a.splice(l,3),l-=3),ep(a)}}}function tp(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(b){return c=b})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function dd(e){this._internalRoot=e}ir.prototype.render=dd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var a=t.current,l=Ut();Zm(a,l,e,t,null,null)},ir.prototype.unmount=dd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zm(e.current,2,null,e,null,null),Bs(),t[bn]=null}};function ir(e){this._internalRoot=e}ir.prototype.unstable_scheduleHydration=function(e){if(e){var t=Go();e={blockedOn:null,target:e,priority:t};for(var a=0;a<va.length&&t!==0&&t<va[a].priority;a++);va.splice(a,0,e),a===0&&Pm(e)}};var np=i.version;if(np!=="19.2.5")throw Error(s(527,np,"19.2.5"));U.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=h(t),e=e!==null?m(e):null,e=e===null?null:e.stateNode,e};var ex={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lr.isDisabled&&lr.supportsFiber)try{Ca=lr.inject(ex),vt=lr}catch{}}return ro.createRoot=function(e,t){if(!r(e))throw Error(s(299));var a=!1,l="",c=cg,d=ug,b=dg;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=Vm(e,1,!1,null,null,a,l,null,c,d,b,tp),e[bn]=t.current,Zu(e),new dd(t)},ro.hydrateRoot=function(e,t,a){if(!r(e))throw Error(s(299));var l=!1,c="",d=cg,b=ug,w=dg,L=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(d=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError),a.formState!==void 0&&(L=a.formState)),t=Vm(e,1,!0,t,a??null,l,c,L,d,b,w,tp),t.context=Xm(null),a=t.current,l=Ut(),l=ml(l),c=aa(l),c.callback=null,ia(a,c,l),a=l,t.current.lanes=a,za(t,a),dn(t),e[bn]=t.current,Zu(e),new ir(t)},ro.version="19.2.5",ro}var fp;function cx(){if(fp)return gd.exports;fp=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),gd.exports=rx(),gd.exports}var ux=cx();const hp=n=>{let i;const o=new Set,s=(h,m)=>{const v=typeof h=="function"?h(i):h;if(!Object.is(v,i)){const y=i;i=m??(typeof v!="object"||v===null)?v:Object.assign({},i,v),o.forEach(x=>x(i,y))}},r=()=>i,g={setState:s,getState:r,getInitialState:()=>p,subscribe:h=>(o.add(h),()=>o.delete(h))},p=i=n(s,r,g);return g},dx=(n=>n?hp(n):hp),fx=n=>n;function hx(n,i=fx){const o=go.useSyncExternalStore(n.subscribe,go.useCallback(()=>i(n.getState()),[n,i]),go.useCallback(()=>i(n.getInitialState()),[n,i]));return go.useDebugValue(o),o}const gp=n=>{const i=dx(n),o=s=>hx(i,s);return Object.assign(o,i),o},gx=(n=>n?gp(n):gp);function mp(n){return Array.isArray(n.images)}async function lt(n,i){const o=await fetch(n,i),s=await o.json().catch(()=>({}));if(!o.ok){const r=s.error,u=s.code,f=typeof r=="string"?r:r?.message??`Request failed: ${o.status}`,g=new Error(f);throw g.status=o.status,typeof r!="string"&&r?.code?g.code=r.code:u&&(g.code=u),typeof s.currentVersion=="number"&&(g.currentVersion=s.currentVersion),g}return s}function vd(n){const i=new URLSearchParams;n?.kind&&i.set("kind",n.kind),n?.sessionId&&i.set("sessionId",n.sessionId),n?.includeTerminal&&i.set("includeTerminal","1");const o=i.size>0?`?${i.toString()}`:"";return lt(`/api/inflight${o}`)}async function pp(n){await fetch(`/api/inflight/${encodeURIComponent(n)}`,{method:"DELETE"}).catch(()=>{})}function mx(){return lt("/api/oauth/status")}function px(){return lt("/api/billing")}function yx(n){return lt("/api/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function Gd(n={}){const i=new URLSearchParams;return i.set("limit",String(n.limit??50)),n.since!=null&&i.set("since",String(n.since)),n.cursor&&(i.set("before",String(n.cursor.before)),i.set("beforeFilename",n.cursor.beforeFilename)),n.sessionId&&i.set("sessionId",n.sessionId),lt(`/api/history?${i.toString()}`)}function vx(n={}){const i=new URLSearchParams;return i.set("groupBy","session"),i.set("limit",String(n.limit??200)),n.cursor&&(i.set("before",String(n.cursor.before)),i.set("beforeFilename",n.cursor.beforeFilename)),lt(`/api/history?${i.toString()}`)}async function Sx(){return(await lt("/api/storage/status")).data}function bx(){return lt("/api/storage/open-generated-dir",{method:"POST"})}function xx(n){return lt(`/api/history/${encodeURIComponent(n)}`,{method:"DELETE"})}function _x(n,i){return lt(`/api/history/${encodeURIComponent(n)}/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({trashId:i})})}function wx(n){let i="message";const o=[];for(const r of n.split(`
|
|
10
|
-
`))r.startsWith("event:")&&(i=r.slice(6).trim()),r.startsWith("data:")&&o.push(r.slice(5).trimStart());if(o.length===0)return null;const s=o.join(`
|
|
11
|
-
`);return!s||s==="[DONE]"?null:{event:i,data:JSON.parse(s)}}async function Ex(n,i={}){const o=await fetch("/api/node/generate",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(n)});if(!(o.headers.get("content-type")??"").includes("text/event-stream")){const p=await o.json().catch(()=>({}));if(!o.ok){const h=p,m=h?.error?.message??`Request failed: ${o.status}`,v=new Error(m);throw v.code=h?.error?.code,v}return p}if(!o.ok||!o.body)throw new Error(`Request failed: ${o.status}`);const r=o.body.getReader(),u=new TextDecoder;let f="",g=null;for(;;){const{done:p,value:h}=await r.read();if(p)break;f+=u.decode(h,{stream:!0});let m=f.indexOf(`
|
|
12
|
-
|
|
13
|
-
`);for(;m!==-1;){const v=f.slice(0,m);f=f.slice(m+2);const y=wx(v);if(y){if(y.event==="partial")i.onPartial?.(y.data);else if(y.event==="phase")i.onPhase?.(y.data);else if(y.event==="done")g=y.data;else if(y.event==="error"){const x=y.data,E=x?.error?.message??"Node generation failed",C=new Error(E);throw C.code=x?.error?.code,C}}m=f.indexOf(`
|
|
14
|
-
|
|
15
|
-
`)}}if(!g)throw new Error("Node stream ended without a final image");return g}function Nx(){return lt("/api/sessions")}function Tx(n){return lt("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n})})}function Ky(n){return lt(`/api/sessions/${encodeURIComponent(n)}`)}function Ax(n,i){return lt(`/api/sessions/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i})})}function Cx(n){return lt(`/api/sessions/${encodeURIComponent(n)}`,{method:"DELETE"})}function Mx(n,i,o,s,r={}){const u={"Content-Type":"application/json","If-Match":String(i)};return r.saveId&&(u["X-Ima2-Graph-Save-Id"]=r.saveId),r.saveReason&&(u["X-Ima2-Graph-Save-Reason"]=r.saveReason),r.tabId&&(u["X-Ima2-Tab-Id"]=r.tabId),lt(`/api/sessions/${encodeURIComponent(n)}/graph`,{method:"PUT",headers:u,body:JSON.stringify({nodes:o,edges:s})})}function zx(n){return lt(`/api/sessions/${encodeURIComponent(n)}/style-sheet`)}function Dx(n,i,o){return lt(`/api/sessions/${encodeURIComponent(n)}/style-sheet`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({styleSheet:i,enabled:o})})}function Rx(n,i){return lt(`/api/sessions/${encodeURIComponent(n)}/style-sheet/enabled`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:i})})}function jx(n,i,o){return lt(`/api/sessions/${encodeURIComponent(n)}/style-sheet/extract`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:i,referenceDataUrl:o})})}function Ox(n,i=256){return new Promise(o=>{const s=new Image;s.onload=()=>{const r=Math.min(1,i/Math.max(s.width,s.height)),u=document.createElement("canvas");u.width=s.width*r,u.height=s.height*r;const f=u.getContext("2d");if(!f)return o(n);f.drawImage(s,0,0,u.width,u.height),o(u.toDataURL("image/jpeg",.6))},s.onerror=()=>o(n),s.src=n})}const Hx={maxB64Bytes:6e6,preserveTransparency:!1,maxEdge:4096,qualityLadder:[.85,.7,.55]},yp=16777216;function Lx(n,i,o){let s=n,r=i;if(s<=0||r<=0)return{w:1,h:1};const u=Math.max(s,r);if(u>o){const f=o/u;s=Math.round(s*f),r=Math.round(r*f)}if(s*r>yp){const f=Math.sqrt(yp/(s*r));s=Math.max(1,Math.floor(s*f)),r=Math.max(1,Math.floor(r*f))}return{w:s,h:r}}function Sd(n){return new Promise((i,o)=>{const s=new FileReader;s.onload=()=>{typeof s.result=="string"?i(s.result):o(new Error("FileReader returned non-string"))},s.onerror=()=>o(s.error??new Error("FileReader failed")),s.readAsDataURL(n)})}function vp(n,i,o){return new Promise((s,r)=>{n.toBlob(u=>u?s(u):r(new Error("canvas.toBlob returned null")),i,o)})}function bd(n){const i=n.indexOf(",");return i<0?n.length:n.length-i-1}async function Sp(n,i={}){const o={...Hx,...i},s=await Sd(n);if(bd(s)<=o.maxB64Bytes)return s;let r;try{r=await createImageBitmap(n)}catch(u){throw new Error("이미지 디코드 실패. JPEG/PNG로 변환 후 다시 시도해 주세요.",{cause:u})}try{const{w:u,h:f}=Lx(r.width,r.height,o.maxEdge),g=document.createElement("canvas");g.width=u,g.height=f;const p=g.getContext("2d");if(!p)throw new Error("canvas 2d context unavailable");if(p.drawImage(r,0,0,u,f),o.preserveTransparency){const h=await vp(g,"image/png"),m=await Sd(h);if(bd(m)>o.maxB64Bytes)throw new Error("이미지 압축 실패. JPEG/PNG로 미리 변환 후 다시 시도해 주세요.");return m}for(const h of o.qualityLadder){const m=await vp(g,"image/jpeg",h),v=await Sd(m);if(bd(v)<=o.maxB64Bytes)return v}throw new Error("이미지 압축 실패. JPEG/PNG로 미리 변환 후 다시 시도해 주세요.")}finally{r.close?.()}}function or(n){const i=(n.type||"").toLowerCase();if(i.includes("heic")||i.includes("heif"))return!0;const o=(n.name||"").toLowerCase();return o.endsWith(".heic")||o.endsWith(".heif")}function bp(n){return(n.type||"").toLowerCase()==="image/png"}const Ux={ok:"확인",cancel:"취소",delete:"삭제",close:"닫기"},Bx={localStorageFull:"로컬 저장소가 가득 차서 최근 상태가 저장되지 않을 수 있습니다.",refLimitExceeded:"참조 이미지는 최대 5장까지 추가할 수 있습니다. 초과한 이미지는 제외되었습니다.",refTooLarge:"이미지가 너무 큽니다. JPEG/PNG로 미리 변환하거나 해상도를 낮춰 다시 시도해 주세요.",refNotBase64:"이미지 파일이 손상되었거나 지원하지 않는 형식입니다.",refEmpty:"빈 이미지 파일입니다. 다른 파일을 선택해 주세요.",refHeicUnsupported:"HEIC/HEIF는 지원하지 않습니다. JPEG 또는 PNG로 변환 후 다시 시도해 주세요.",noCurrentImageForRef:"참조로 사용할 현재 이미지가 없습니다.",refSlotFull:"참조 이미지 슬롯이 가득 찼습니다. 최대 5장까지 가능합니다.",currentImageLoadFailed:"현재 이미지를 불러오지 못했습니다.",addedCurrentAsRef:"현재 이미지를 참조에 추가했습니다.",sessionLoadFailed:"세션을 불러오지 못했습니다.",sessionCreateFailed:"세션을 만들지 못했습니다.",sessionRenameFailed:"세션 이름을 바꾸지 못했습니다.",sessionDeleteFailed:"세션을 삭제하지 못했습니다.",promptRequired:"프롬프트를 입력하세요.",nodeCreated:"노드 {id} 생성 완료 ({elapsed}초)",nodeCreateFailed:"노드 생성에 실패했습니다.",generatedBatch:"{count}장을 {elapsed}초 만에 생성했습니다.",generatedSingle:"{elapsed}초 만에 생성했습니다.",generateFailed:"생성에 실패했습니다.",sessionReloadedElsewhere:"그래프 버전이 달라져 최신 그래프를 다시 불러왔습니다.",promptCopied:"프롬프트를 복사했습니다",imageCopied:"클립보드에 복사했습니다",copyFailed:"복사에 실패했습니다",openGeneratedDirFailed:"이미지 폴더를 열지 못했습니다. ima2 doctor로 저장 경로를 확인해 주세요.",noPromptToFork:"가져올 프롬프트가 없습니다",forkStarted:"이 이미지의 프롬프트를 가져왔습니다. 수정 후 다시 생성하세요"},Ix={queued:"대기 중",streaming:"생성 중",decoding:"마무리 중"},qx={title:"크기",width:"가로",height:"세로",hint:"한 변 최소 1024, 최대 3824, 16의 배수, 비율은 최대 3:1",autoLabel:"자동",autoSub:"모델 추천",customLabel:"직접 입력",customSub:"자유 설정"},Gx={title:"크기 조정이 필요합니다",body:"입력한 크기가 이미지 생성 제한을 벗어나 자동 조정이 필요합니다.",requested:"요청한 크기",adjusted:"조정될 크기",approve:"승인 후 생성",cancel:"취소",reasonRatio:"비율 제한 3:1을 초과했습니다.",reasonPixels:"최대 픽셀 수 제한을 초과했습니다.",reasonMin:"최소 크기보다 작습니다.",reasonMax:"최대 크기보다 큽니다.",reasonSnap:"16px 단위에 맞춰야 합니다."},kx={title:"품질",lowLabel:"낮음",lowSub:"빠름",mediumLabel:"중간",mediumSub:"균형",highLabel:"높음",highSub:"최상"},Yx={title:"모더레이션",autoLabel:"자동",autoSub:"표준 필터",lowLabel:"낮음",lowSub:"완화 필터",explain:"자동은 표준 안전 필터를 사용합니다. 낮음은 제한을 조금 완화해 경계선 프롬프트가 더 통과할 수 있습니다."},Vx={title:"포맷"},Xx={title:"개수"},Zx={button:"생성",buttonLoading:"생성 중 ({n})"},$x={label:"API 상태",checking:"확인 중...",offline:"오프라인",remaining:"${remaining} 남음",thisMonth:"이번 달 ${amount}",oauthFree:"OAuth 무료 사용 가능",apiDisabled:"API 키 비활성화됨 (OAuth 전용)",oauthMode:"OAuth 모드"},Kx={openGalleryAria:"갤러리 열기",openGalleryTitle:"전체 갤러리 열기"},Qx={closeSettings:"설정 닫기",detailSettings:"세부 설정",toggleShow:"세부 설정 보기",toggleHide:"세부 설정 숨기기",open:"열기",close:"닫기"},Fx={label:"프롬프트",refCount:"참조 {count}/{max}",refChipTitle:"참조 이미지 {n}",refChipAlt:"참조 이미지 {n}",refRemoveAria:"참조 이미지 {n} 제거",placeholder:"원하는 이미지를 설명하고, 드래그 앤 드롭이나 붙여넣기로 참조 이미지를 추가할 수 있어요...",placeholderWithRefs:"첨부한 이미지로 무엇을 만들지 설명해 주세요...",attach:"첨부",attachTitle:"참조 이미지 첨부",useCurrent:"현재 결과 사용",useCurrentTitle:"현재 결과를 참조로 사용",style:"스타일",styleTitle:"스타일 일관성 설정 열기",directMode:"Direct",directModeTitle:"프롬프트를 원문 그대로 전달 (Direct 모드)",hint:"Ctrl + Enter로 생성",dropHere:"놓아서 참조 이미지로 추가 ({max}장까지)"},Jx={resultAlt:"생성 결과",tokens:"{n} 토큰"},Px={today:"오늘",yesterday:"어제",thisWeek:"이번 주",earlier:"이전",imageAltFallback:"생성 이미지",deleteTitle:"삭제 (10초 내 복구 가능)",deleteAria:"이미지 삭제",ariaLabel:"이미지 갤러리",title:"갤러리",total:"총 {n}장",totalFiltered:" / 전체 {n}장",sortByAria:"정렬 기준",sortByDate:"날짜",sortBySession:"세션",searchPlaceholder:"프롬프트나 파일명을 검색",searchDisabledPlaceholder:"세션 보기에서는 검색이 비활성화됩니다",closeAria:"갤러리 닫기",closeTitle:"닫기 (Esc)",sessionLabel:"세션 {name}",standalone:"독립 이미지",emptySessions:"아직 저장된 세션이 없습니다.",emptyAll:"아직 생성된 이미지가 없습니다. 먼저 하나 만들어보세요.",noResults:"검색 결과가 없습니다.",storageNoticeTitle:"저장 위치 안내",storageNoticeRecoverable:"놀라게 해드려 죄송합니다. 최근 버전에서 갤러리 저장 위치가 설치 폴더에서 사용자 데이터 폴더로 바뀌었습니다. 예전 이미지가 이전 generated 폴더에 남아 있을 수 있어요. ima2 doctor를 실행하거나 복구 안내를 확인해 주세요.",storageNoticeNotFound:"놀라게 해드려 죄송합니다. 현재 이 컴퓨터에서 이전 generated 폴더를 찾지 못했습니다. 업데이트 중 예전 전역 설치 폴더가 교체된 경우 자동 복구가 어려울 수 있습니다. ima2 doctor와 복구 안내의 수동 검색 방법을 확인해 주세요.",storageNoticeUnknown:"저장 위치 상태를 확인하지 못했습니다. 업데이트 후 갤러리가 비어 보인다면 ima2 doctor로 이미지 폴더를 확인해 주세요.",openGeneratedDir:"폴더 열기",openGeneratedDirTitle:"생성 이미지 폴더 열기",deleted:"삭제됨: {filename}",undo:"되돌리기",secondsSuffix:"{n}초"},Wx={empty:"비어 있음",pending:"생성 중",reconciling:"동기화 중",reconcilingPhase:"동기화 중 · {phase}",ready:"완료 · {elapsed}s",readyWithSearch:"완료 · {elapsed}s · 검색 {searches}",stale:"오래된 상태",staleWithError:"오래된 상태: {error}",assetMissing:"에셋 누락",assetMissingWithError:"에셋 누락: {error}",error:"오류: {error}",errorUnknown:"알 수 없음",nodeImageAlt:"노드 이미지",partialImageAlt:"노드 중간 이미지 미리보기",noAsset:"에셋 없음",stateStale:"상태 오래됨",noImage:"이미지 없음",editPromptPlaceholder:"수정 프롬프트...",promptPlaceholder:"프롬프트...",regenerate:"재생성",generate:"생성",addChild:"자식",addChildTitle:"자식 노드 추가",duplicateBranch:"복제",duplicateBranchTitle:"새 브랜치 루트로 복제",deleteTitle:"삭제",attachRef:"첨부",attachRefTitle:"노드 참조 이미지 첨부",refAlt:"노드 참조 이미지 {n}",removeRef:"참조 이미지 {n} 제거",dropRefs:"이미지를 여기에 놓기",nodeRefsUnsupportedForEdit:"추가 참조 이미지는 현재 루트 노드에서만 지원합니다.",classicRefsParkedTitle:"클래식 참조 이미지가 보관 중입니다",classicRefsParkedBody:"이 이미지는 클래식 작성창용이라 노드 모드 생성에는 사용되지 않습니다.",clearParkedRefs:"보관된 참조 비우기",styleSheetActive:"세션 스타일 시트 적용 중"},e1={authTitle:"인증 방식",apiLabel:"API 키",oauthNotReady:"OAuth 프록시가 아직 준비되지 않았습니다.",codexLoginRequired:"Codex 로그인이 필요합니다.",codexLoginHint:"터미널에서 `codex login`을 실행한 뒤 이 페이지를 새로고침하세요.",oauthStarting:"OAuth 프록시가 시작 중입니다. 몇 초 후 다시 시도하세요.",serverUnreachable:"서버에 연결할 수 없습니다. 백엔드가 실행 중인지 확인하세요.",apiInvalid:"API 키가 없거나 유효하지 않습니다. 서버의 .env 파일에서 OPENAI_API_KEY를 확인하세요.",availableTitle:"{name} 사용 가능",availableAria:"{name}: 사용 가능",unavailableAria:"{name}: 사용 불가",availableSr:"(사용 가능)",unavailableSr:"(사용 불가)"},t1={free:"무료",approx:"약 ${amount}",label:"예상 비용"},n1={download:"다운로드",copyImage:"이미지 복사",copyPrompt:"프롬프트 복사",continueHere:"여기서 이어서",continueHereTitle:"이 이미지의 프롬프트를 가져와 이어서 작업"},a1={switchTitle:"세션 전환",loading:"불러오는 중...",newSession:"새 세션",newSessionTitle:"새 세션",renameTitle:"이름 변경",renamePrompt:"세션 이름",deleteTitle:"삭제",deleteConfirm:'"{title}" 세션을 삭제할까요? 이 작업은 되돌릴 수 없습니다.',empty:"아직 세션이 없습니다",firstGraph:"첫 번째 그래프",untitled:"제목 없는 세션",assetAbortedError:"생성이 정상적으로 끝나지 않았습니다. 이 노드에서 다시 시도하세요."},i1={ariaLabel:"UI 모드",classic:"기본",node:"노드"},l1={appName:"이미지 생성기",imageModelLabel:"모델",imageModelAria:"이미지 모델 선택",nodeModeHint:"노드 모드에서는 노드를 눌러 프롬프트를 수정한 뒤 생성하세요. 오른쪽 패널의 설정 (품질/크기)은 새로 만드는 모든 결과에 적용됩니다."},o1={openAria:"설정 열기",openTitle:"설정",closeAria:"설정 닫기",closeTitle:"캔버스로 돌아가기",navAria:"설정 섹션",contentAria:"설정 내용",jumpTo:"{section} 섹션으로 이동",eyebrow:"작업공간 설정",title:"설정",subtitle:"계정, 화면, 앞으로 늘어날 작업공간 옵션을 이곳에 모아 생성 흐름은 가볍게 유지합니다.",sections:{account:{title:"계정",hint:"OAuth 상태"},generation:{title:"생성",hint:"모델 기본값"},appearance:{title:"화면",hint:"라이트/다크"},language:{title:"언어",hint:"UI 문구"},future:{title:"예정",hint:"확장 공간"}},account:{primaryEyebrow:"현재 공급자",oauthTitle:"OAuth 사용 중",oauthBody:"현재 생성은 Codex OAuth 세션으로 실행됩니다. 이 빌드에서는 API-Key 생성 모드가 비활성화되어 있습니다.",apiSourceEnv:"OPENAI_API_KEY 감지됨",apiSourceConfig:"config.json API 키 감지됨",apiTitle:"Configured but disabled",apiBody:"env/config에서 API 키를 찾았지만, 지금 ima2-gen은 OAuth 전용으로 동작합니다. 이 상태 표시를 숨기고 싶을 때만 키를 제거하세요.",apiDisabled:"비활성화",apiUnknown:"상태 불명"},imageModel:{title:"이미지 모델",body:"앞으로 생성 요청에 사용할 OAuth 이미지 모델을 선택합니다.",gpt54Mini:"GPT-5.4 Mini",gpt54:"GPT-5.4",gpt55:"GPT-5.5",gpt53CodexSpark:"GPT-5.3 Codex Spark — 이미지 생성 미지원",unsupportedHelp:"기본값은 GPT-5.4 Mini입니다. GPT-5.3 Codex Spark는 OAuth 모델 상태에 보일 수 있지만 image_generation 도구를 지원하지 않습니다."},appearance:{themeTitle:"테마",themeBody:"이 기기에서 작업공간을 어떤 톤으로 볼지 선택합니다."},language:{title:"언어",body:"생성 프롬프트와 무관하게 인터페이스 언어만 바꿉니다."},future:{title:"나중을 위한 자리",body:"OAuth 복구 도구나 작업공간 옵션이 실제로 필요해지면 이곳에 추가합니다."}},s1={loading:"세션 불러오는 중...",addFirst:"+ 첫 노드 추가",addRootTitle:"루트 노드 추가",hint:"핸들을 빈 공간으로 드래그하면 새 브랜치가 생깁니다. Delete 또는 Backspace로 삭제할 수 있습니다."},r1={title:"{provider} 사용 불가",ariaLabel:"{provider} 사용 불가"},c1={label:"언어",ko:"한국어",en:"English"},u1={label:"테마",system:"시스템",dark:"다크",light:"라이트"},d1={toggle:"스타일 일관성 적용",extract:"프롬프트에서 추출",extracting:"추출 중…",edit:"편집",save:"저장",cancel:"취소",emptyHint:"아직 스타일 시트가 없어요. 현재 프롬프트에서 추출해서 룩을 고정하세요.",noPrompt:"먼저 프롬프트를 입력하세요",extracted:"스타일 시트가 추출됐어요",editorTitle:"스타일 시트 편집",saved:"스타일 시트를 저장했어요",errNoKey:"스타일 시트 추출에는 OpenAI API 키가 필요해요. setup에서 연결해주세요.",errBadOutput:"모델이 사용 가능한 시트를 못 만들었어요 — 프롬프트를 더 구체적으로 적어주세요.",placeholderMedium:"예: 유화, 시네마틱 사진",placeholderComposition:"예: 중앙 인물, 와이드 풍경",placeholderMood:"예: 시네마틱, 몽환적",placeholderSubject:"예: 빨간 재킷 입은 젊은 여성",placeholderPalette:"#0a0a0a, #f97316, 따뜻한 앰버",placeholderNegative:"blur, 워터마크, 텍스트",fields:{medium:"매체",composition:"구도",mood:"분위기",subject:"피사체 디테일",palette:"팔레트 (쉼표로 구분된 hex 또는 이름)",negative:"네거티브 (쉼표로 구분)"}},f1={close:"닫기",details:"자세한 원본 오류 보기",unknown:{title:"알 수 없는 오류가 발생했어요",body:"잠시 후 다시 시도해 주세요. 문제가 계속되면 원본 오류 메시지를 복사해 제보해 주세요."},moderationRefused:{title:"프롬프트가 모더레이션에 걸렸어요",body:"표현 수위를 낮추거나 다른 문구로 바꿔 보세요. 레퍼런스 이미지의 선정적/폭력적 요소도 영향을 줄 수 있어요.",cta:"프롬프트 수정"},upstream5xx:{title:"OpenAI 서버가 혼잡합니다",body:"잠시 후 다시 시도하면 대부분 해결돼요. 상태 페이지(status.openai.com)도 확인해 보세요.",cta:"다시 시도"},authChatgptExpired:{title:"Codex ChatGPT 로그인이 만료됐어요",body:"터미널에서 `npx @openai/codex login`을 다시 실행한 뒤 앱을 새로고침해 주세요.",cta:"새로고침"},authApiKeyInvalid:{title:"API 키 인증 실패",body:"키가 잘못됐거나 한도/조직 권한 문제예요. 본 앱은 API-Key 모드가 비활성화되어 있어 OAuth(ChatGPT 로그인)로 전환하는 편이 좋아요.",cta:"확인"},networkFailed:{title:"네트워크 연결 실패",body:"OpenAI/로컬 OAuth 프록시에 연결하지 못했어요. VPN/방화벽이나 `status.openai.com`을 확인해 주세요.",cta:"새로고침"},oauthUnavailable:{title:"OAuth 프록시를 사용할 수 없어요",body:"로컬 OAuth 프록시가 실행 중이 아니에요. `ima2 serve`를 재시작한 뒤 다시 시도해 주세요.",cta:"새로고침"},apikeyDisabled:{title:"API-Key 모드가 비활성화되어 있어요",body:"본 앱은 OAuth(ChatGPT 로그인) 전용으로 동작합니다. 공급자를 OAuth로 전환해 주세요.",cta:"확인"}},h1={common:Ux,toast:Bx,inflight:Ix,size:qx,sizeConfirm:Gx,quality:kx,moderation:Yx,format:Vx,count:Xx,generate:Zx,billing:$x,history:Kx,panel:Qx,prompt:Fx,canvas:Jx,gallery:Px,node:Wx,provider:e1,cost:t1,result:n1,session:a1,uiMode:i1,sidebar:l1,settings:o1,nodeCanvas:s1,apiDisabled:r1,language:c1,theme:u1,styleSheet:d1,errorCard:f1},g1={ok:"OK",cancel:"Cancel",delete:"Delete",close:"Close"},m1={localStorageFull:"Local storage is full — recent state may not persist.",refLimitExceeded:"References are capped at 5. Extra images were dropped.",refTooLarge:"Image is too large. Convert to JPEG/PNG or lower the resolution and try again.",refNotBase64:"Image file is corrupted or uses an unsupported encoding.",refEmpty:"Empty image file. Please pick a different file.",refHeicUnsupported:"HEIC/HEIF is not supported. Convert to JPEG or PNG and try again.",noCurrentImageForRef:"No current image to use as reference.",refSlotFull:"Reference slots are full (max 5).",currentImageLoadFailed:"Failed to load current image.",addedCurrentAsRef:"Added current image as a reference.",sessionLoadFailed:"Failed to load session.",sessionCreateFailed:"Failed to create session.",sessionRenameFailed:"Failed to rename session.",sessionDeleteFailed:"Failed to delete session.",promptRequired:"Enter a prompt.",nodeCreated:"Node {id} created ({elapsed}s)",nodeCreateFailed:"Node generation failed.",generatedBatch:"Generated {count} images in {elapsed}s.",generatedSingle:"Generated in {elapsed}s.",generateFailed:"Generation failed.",sessionReloadedElsewhere:"Graph version changed, so the latest graph was reloaded.",promptCopied:"Prompt copied",imageCopied:"Copied to clipboard",copyFailed:"Copy failed",openGeneratedDirFailed:"Could not open the image folder. Run ima2 doctor to check the storage path.",noPromptToFork:"No prompt to fork",forkStarted:"Prompt imported. Edit and generate again."},p1={queued:"Queued",streaming:"Generating",decoding:"Finalizing"},y1={title:"Size",width:"Width",height:"Height",hint:"Each side 1024–3824, multiple of 16, ratio up to 3:1",autoLabel:"Auto",autoSub:"Model pick",customLabel:"Custom",customSub:"Free form"},v1={title:"Size adjustment required",body:"The requested size is outside the image generation limits.",requested:"Requested size",adjusted:"Adjusted size",approve:"Approve and generate",cancel:"Cancel",reasonRatio:"The ratio exceeds the 3:1 limit.",reasonPixels:"The maximum pixel limit is exceeded.",reasonMin:"The size is below the minimum.",reasonMax:"The size is above the maximum.",reasonSnap:"The size must align to 16px increments."},S1={title:"Quality",lowLabel:"Low",lowSub:"Fast",mediumLabel:"Medium",mediumSub:"Balanced",highLabel:"High",highSub:"Best"},b1={title:"Moderation",autoLabel:"Auto",autoSub:"Standard filter",lowLabel:"Low",lowSub:"Relaxed filter",explain:"Auto uses the standard safety filter. Low relaxes limits so borderline prompts may pass through."},x1={title:"Format"},_1={title:"Count"},w1={button:"Generate",buttonLoading:"Generating ({n})"},E1={label:"API Status",checking:"Checking...",offline:"Offline",remaining:"${remaining} remaining",thisMonth:"${amount} this month",oauthFree:"OAuth · free via codex",apiDisabled:"API key disabled (OAuth only)",oauthMode:"OAuth mode"},N1={openGalleryAria:"Open gallery",openGalleryTitle:"Open full gallery"},T1={closeSettings:"Close settings",detailSettings:"Settings",toggleShow:"Show settings",toggleHide:"Hide settings",open:"Open",close:"Close"},A1={label:"Prompt",refCount:"Refs {count}/{max}",refChipTitle:"Reference {n}",refChipAlt:"Reference {n}",refRemoveAria:"Remove reference {n}",placeholder:"Describe the image you want. Drag & drop or paste to attach reference images...",placeholderWithRefs:"Describe what to do with the attached images...",attach:"Attach",attachTitle:"Attach reference images",useCurrent:"Use current",useCurrentTitle:"Use current result as a reference",style:"Style",styleTitle:"Open style consistency settings",directMode:"Direct",directModeTitle:"Pass prompt through verbatim (Direct mode)",hint:"Ctrl + Enter to generate",dropHere:"Drop to attach as reference (up to {max})"},C1={resultAlt:"result",tokens:"{n} tokens"},M1={today:"Today",yesterday:"Yesterday",thisWeek:"This week",earlier:"Earlier",imageAltFallback:"Generated image",deleteTitle:"Delete (10s undo)",deleteAria:"Delete image",ariaLabel:"Image gallery",title:"Gallery",total:"{n} total",totalFiltered:" / {n} total",sortByAria:"Sort by",sortByDate:"Date",sortBySession:"Session",searchPlaceholder:"Search prompts or filenames",searchDisabledPlaceholder:"Search is disabled in session view",closeAria:"Close gallery",closeTitle:"Close (Esc)",sessionLabel:"Session {name}",standalone:"Standalone images",emptySessions:"No sessions saved yet.",emptyAll:"No images yet. Create one first.",noResults:"No results.",storageNoticeTitle:"Storage notice",storageNoticeRecoverable:"Sorry for the scare. Recent versions moved the gallery folder from the installed package to your user data folder. Your old images may still be in the previous generated folder. Run ima2 doctor or open the recovery guide.",storageNoticeNotFound:"Sorry for the scare. We could not find a previous generated folder on this machine. If the old global install folder was replaced during update, automatic recovery may not be possible. Run ima2 doctor and check the recovery guide for manual search steps.",storageNoticeUnknown:"Storage status could not be checked. If the gallery looks empty after an update, run ima2 doctor to inspect the image folder.",openGeneratedDir:"Open folder",openGeneratedDirTitle:"Open generated image folder",deleted:"Deleted: {filename}",undo:"Undo",secondsSuffix:"{n}s"},z1={empty:"Empty",pending:"Generating",reconciling:"Syncing",reconcilingPhase:"Syncing · {phase}",ready:"Done · {elapsed}s",readyWithSearch:"Done · {elapsed}s · searched {searches}",stale:"Stale",staleWithError:"Stale: {error}",assetMissing:"Asset missing",assetMissingWithError:"Asset missing: {error}",error:"Error: {error}",errorUnknown:"unknown",nodeImageAlt:"Node image",partialImageAlt:"Partial node image preview",noAsset:"No asset",stateStale:"State stale",noImage:"No image",editPromptPlaceholder:"Edit prompt...",promptPlaceholder:"Prompt...",regenerate:"Regen",generate:"Generate",addChild:"Child",addChildTitle:"Add child node",duplicateBranch:"Branch",duplicateBranchTitle:"Duplicate as a new branch root",deleteTitle:"Delete",attachRef:"Attach",attachRefTitle:"Attach node reference images",refAlt:"Node reference {n}",removeRef:"Remove reference {n}",dropRefs:"Drop images here",nodeRefsUnsupportedForEdit:"Extra references are only supported on root nodes for now.",classicRefsParkedTitle:"Classic references are parked",classicRefsParkedBody:"These images belong to the classic composer and are inactive in node mode.",clearParkedRefs:"Clear parked references",styleSheetActive:"Session style sheet active"},D1={authTitle:"Authentication",apiLabel:"API Key",oauthNotReady:"OAuth proxy is not ready yet.",codexLoginRequired:"Codex login required.",codexLoginHint:"Run `codex login` in your terminal, then refresh this page.",oauthStarting:"OAuth proxy is starting. Try again in a few seconds.",serverUnreachable:"Cannot reach the server. Make sure the backend is running.",apiInvalid:"API key is missing or invalid. Check OPENAI_API_KEY in the server's .env.",availableTitle:"{name} available",availableAria:"{name}: available",unavailableAria:"{name}: unavailable",availableSr:"(available)",unavailableSr:"(unavailable)"},R1={free:"free",approx:"~${amount}",label:"Est. cost"},j1={download:"Download",copyImage:"Copy image",copyPrompt:"Copy prompt",continueHere:"Continue here",continueHereTitle:"Import this image's prompt and keep working"},O1={switchTitle:"Switch session",loading:"Loading...",newSession:"New session",newSessionTitle:"New session",renameTitle:"Rename",renamePrompt:"Session name",deleteTitle:"Delete",deleteConfirm:'Delete session "{title}"? This cannot be undone.',empty:"No sessions yet",firstGraph:"My first graph",untitled:"Untitled session",assetAbortedError:"Generation did not finish cleanly. Retry from this node."},H1={ariaLabel:"UI mode",classic:"Classic",node:"Node"},L1={appName:"Image Generator",imageModelLabel:"Model",imageModelAria:"Choose image model",nodeModeHint:"In node mode, click a node to edit its prompt and generate. Settings on the right panel (quality/size) apply to every new result."},U1={openAria:"Open settings",openTitle:"Settings",closeAria:"Close settings",closeTitle:"Return to canvas",navAria:"Settings sections",contentAria:"Settings content",jumpTo:"Jump to {section}",eyebrow:"Workspace settings",title:"Settings",subtitle:"Account, display, and future workspace controls live here so the generator stays focused.",sections:{account:{title:"Account",hint:"OAuth status"},generation:{title:"Generation",hint:"Model defaults"},appearance:{title:"Appearance",hint:"Light and dark"},language:{title:"Language",hint:"Interface copy"},future:{title:"Future",hint:"Reserved"}},account:{primaryEyebrow:"Active provider",oauthTitle:"OAuth is active",oauthBody:"Generation currently runs through your Codex OAuth session. API-key generation remains disabled in this build.",apiSourceEnv:"OPENAI_API_KEY detected",apiSourceConfig:"config.json API key detected",apiTitle:"Configured but disabled",apiBody:"ima2-gen found an API key in env/config, but the app is OAuth-only right now. Remove the key only if you do not want this status shown.",apiDisabled:"Disabled",apiUnknown:"Status unknown"},imageModel:{title:"Image model",body:"Choose the OAuth model used for future image generations.",gpt54Mini:"GPT-5.4 Mini",gpt54:"GPT-5.4",gpt55:"GPT-5.5",gpt53CodexSpark:"GPT-5.3 Codex Spark — unsupported for images",unsupportedHelp:"Default is GPT-5.4 Mini. GPT-5.3 Codex Spark may appear in OAuth model status, but it does not support the image_generation tool."},appearance:{themeTitle:"Theme",themeBody:"Choose how the workspace should look on this device."},language:{title:"Language",body:"Switch the UI language without changing generated content."},future:{title:"Reserved for later",body:"Future provider repair and workspace controls will appear here when they become useful."}},B1={loading:"Loading session...",addFirst:"+ Add first node",addRootTitle:"Add root node",hint:"Drag a handle into empty space to branch. Press Delete or Backspace to remove."},I1={title:"{provider} unavailable",ariaLabel:"{provider} unavailable"},q1={label:"Language",ko:"한국어",en:"English"},G1={label:"Theme",system:"System",dark:"Dark",light:"Light"},k1={toggle:"Apply style consistency",extract:"Extract from prompt",extracting:"Extracting…",edit:"Edit",save:"Save",cancel:"Cancel",emptyHint:"No style sheet yet. Extract from the current prompt to lock in a look.",noPrompt:"Enter a prompt first",extracted:"Style sheet extracted",editorTitle:"Edit style sheet",saved:"Style sheet saved",errNoKey:"Style-sheet extraction needs an OpenAI API key. Connect one via setup.",errBadOutput:"Model returned an unusable sheet — try a more specific prompt.",placeholderMedium:"e.g. oil painting, cinematic photo",placeholderComposition:"e.g. centered portrait, wide landscape",placeholderMood:"e.g. cinematic, dreamlike",placeholderSubject:"e.g. young woman in red jacket",placeholderPalette:"#0a0a0a, #f97316, warm amber",placeholderNegative:"blur, watermark, text",fields:{medium:"Medium",composition:"Composition",mood:"Mood",subject:"Subject details",palette:"Palette (comma-separated hex or names)",negative:"Negative (comma-separated)"}},Y1={close:"Close",details:"Show raw error details",unknown:{title:"An unexpected error occurred",body:"Please try again shortly. If it persists, copy the raw error message below and report it."},moderationRefused:{title:"Prompt blocked by moderation",body:"Soften the wording or rephrase. Sensitive/violent content in reference images can also trigger this.",cta:"Edit prompt"},upstream5xx:{title:"OpenAI is currently busy",body:"Retrying usually resolves this. Check status.openai.com if it persists.",cta:"Retry"},authChatgptExpired:{title:"Codex ChatGPT session expired",body:"Run `npx @openai/codex login` in your terminal, then reload this app.",cta:"Reload"},authApiKeyInvalid:{title:"API key authentication failed",body:"The key is invalid, revoked, out of quota, or tied to the wrong org. This app runs in OAuth mode, so switch to ChatGPT login.",cta:"OK"},networkFailed:{title:"Network connection failed",body:"Could not reach OpenAI or the local OAuth proxy. Check VPN/firewall and status.openai.com.",cta:"Reload"},oauthUnavailable:{title:"OAuth proxy unavailable",body:"The local OAuth proxy is not running. Restart `ima2 serve` and try again.",cta:"Reload"},apikeyDisabled:{title:"API-key mode is disabled",body:"This app is OAuth-only (ChatGPT login). Switch the provider to OAuth.",cta:"OK"}},V1={common:g1,toast:m1,inflight:p1,size:y1,sizeConfirm:v1,quality:S1,moderation:b1,format:x1,count:_1,generate:w1,billing:E1,history:N1,panel:T1,prompt:A1,canvas:C1,gallery:M1,node:z1,provider:D1,cost:R1,result:j1,session:O1,uiMode:H1,sidebar:L1,settings:U1,nodeCanvas:B1,apiDisabled:I1,language:q1,theme:G1,styleSheet:k1,errorCard:Y1},xp={ko:h1,en:V1};function _p(n,i){return i.split(".").reduce((o,s)=>{if(o!=null)return o[s]},n)}function X1(n,i){return n.replace(/\{(\w+)\}/g,(o,s)=>s in i?String(i[s]):`{${s}}`)}function we(n,i){const o=ae.getState().locale;return Qy(o,n,i)}function Qy(n,i,o){const s=_p(xp[n],i),r=typeof s=="string"?s:_p(xp.en,i),u=typeof r=="string"?r:i;return o?X1(u,o):u}function Ve(){const n=ae(i=>i.locale);return{locale:n,t:(i,o)=>Qy(n,i,o)}}const Z1=["ko","en"];function $1(){try{const n=localStorage.getItem("ima2.locale");if(n==="ko"||n==="en")return n}catch{}return typeof navigator<"u"&&(navigator.language||"").toLowerCase().startsWith("ko")?"ko":"en"}function K1(n){try{localStorage.setItem("ima2.locale",n)}catch{}}function Q1(n){return Math.round(n/16)*16}const Fy=1024,Jy=3824,sr=3,xd=8294400;function wp(n){return Math.floor(n/16)*16}function Ep(n){return Math.ceil(n/16)*16}function Wa(n){return Math.min(Jy,Math.max(Fy,n))}function il(n,i){const o=typeof n=="number"?n:Number.parseInt(n,10);return Number.isFinite(o)?o:i}function ll(n,i){n.includes(i)||n.push(i)}function Np(n,i){const o=Q1(n);return o!==n&&ll(i,"snap"),o}function Tp(n,i){return n<Fy&&ll(i,"min"),n>Jy&&ll(i,"max"),Wa(n)}function Ap(n,i,o){return n>i*sr?(ll(o,"ratio"),{w:n,h:Wa(Ep(n/sr))}):i>n*sr?(ll(o,"ratio"),{w:Wa(Ep(i/sr)),h:i}):{w:n,h:i}}function F1(n,i,o){if(n*i<=xd)return{w:n,h:i};ll(o,"pixels");const s=Math.sqrt(xd/(n*i));let r=Wa(wp(n*s)),u=Wa(wp(i*s));for(;r*u>xd;)r>=u?r=Wa(r-16):u=Wa(u-16);return{w:r,h:u}}function J1(n,i,o,s){const r=[],u=il(n,o),f=il(i,s);let g=Tp(Np(u,r),r),p=Tp(Np(f,r),r);return{w:g,h:p}=Ap(g,p,r),{w:g,h:p}=F1(g,p,r),{w:g,h:p}=Ap(g,p,r),{requestedW:u,requestedH:f,w:g,h:p,adjusted:g!==u||p!==f,reasons:r}}const P1=[{value:"1024x1024",label:"1024×1024",sub:"1:1"},{value:"1536x1024",label:"1536×1024",sub:"3:2"},{value:"1024x1536",label:"1024×1536",sub:"2:3"}],W1=[{value:"1360x1024",label:"1360×1024",sub:"4:3"},{value:"1024x1360",label:"1024×1360",sub:"3:4"},{value:"1824x1024",label:"1824×1024",sub:"16:9"}],e2=[{value:"1024x1824",label:"1024×1824",sub:"9:16"},{value:"2048x2048",label:"2048×2048",sub:"2K 1:1"},{value:"2048x1152",label:"2048×1152",sub:"2K 16:9"}],t2=[{value:"1152x2048",label:"1152×2048",sub:"2K 9:16"},{value:"3824x2160",label:"3824×2160",sub:"4K 16:9"},{value:"2160x3824",label:"2160×3824",sub:"4K 9:16"}];function n2(){return[{value:"auto",label:we("size.autoLabel"),sub:we("size.autoSub")},{value:"custom",label:we("size.customLabel"),sub:we("size.customSub")}]}const a2="gpt-5.4-mini",Py="ima2.imageModel",Pi=[{value:"gpt-5.4-mini",shortLabel:"5.4m",fullLabelKey:"settings.imageModel.gpt54Mini"},{value:"gpt-5.4",shortLabel:"5.4",fullLabelKey:"settings.imageModel.gpt54"},{value:"gpt-5.5",shortLabel:"5.5",fullLabelKey:"settings.imageModel.gpt55"}],i2=[{value:"gpt-5.3-codex-spark",fullLabelKey:"settings.imageModel.gpt53CodexSpark"}];function l2(n){return Pi.some(i=>i.value===n)}function Wy(n){return n?Pi.find(i=>i.value===n)?.shortLabel??n:null}const Qi=()=>"nc_"+Math.random().toString(36).slice(2,10);function Cp(n,i){return{x:n*360,y:i*320}}const vo={REF_TOO_LARGE:{surface:"toast",toastKey:"toast.refTooLarge"},REF_NOT_BASE64:{surface:"toast",toastKey:"toast.refNotBase64"},REF_EMPTY:{surface:"toast",toastKey:"toast.refEmpty"},REF_TOO_MANY:{surface:"toast",toastKey:"toast.refLimitExceeded"},MODERATION_REFUSED:{surface:"card",cardKey:"errorCard.moderationRefused",cta:"dismiss"},SAFETY_REFUSAL:{surface:"card",cardKey:"errorCard.moderationRefused",cta:"dismiss"},UPSTREAM_5XX:{surface:"card",cardKey:"errorCard.upstream5xx",cta:"retry"},AUTH_CHATGPT_EXPIRED:{surface:"card",cardKey:"errorCard.authChatgptExpired",cta:"reauth"},AUTH_API_KEY_INVALID:{surface:"card",cardKey:"errorCard.authApiKeyInvalid",cta:"dismiss"},NETWORK_FAILED:{surface:"card",cardKey:"errorCard.networkFailed",cta:"reload"},OAUTH_UNAVAILABLE:{surface:"card",cardKey:"errorCard.oauthUnavailable",cta:"reload"},INVALID_MODERATION:{surface:"toast",toastKey:"toast.generateFailed"},APIKEY_DISABLED:{surface:"card",cardKey:"errorCard.apikeyDisabled",cta:"dismiss"},DB_ERROR:{surface:"toast",toastKey:"toast.generateFailed"},UNKNOWN:{surface:"toast",toastKey:"toast.generateFailed"}};function o2(n){const i=(n||"").toLowerCase();return i?i.includes("content generation refused")||i.includes("moderation_blocked")||i.includes("moderation refused")?"MODERATION_REFUSED":i.includes("token is expired")||i.includes("sign in again")||i.includes("access token")&&i.includes("expired")||i.includes("token")&&i.includes("expired")&&!i.includes("api key")?"AUTH_CHATGPT_EXPIRED":i.includes("incorrect api key")||i.includes("invalid authentication")||i.includes("exceeded your current quota")||i.includes("incorrect organization")?"AUTH_API_KEY_INVALID":i.includes("failed to fetch")||i.includes("econnrefused")||i.includes("econnreset")||i.includes("enotfound")||i.includes("etimedout")||i.includes("network error")?"NETWORK_FAILED":i.includes("oauth")&&(i.includes("not running")||i.includes("unavailable"))?"OAUTH_UNAVAILABLE":i.includes("an error occurred while processing")||/\b5\d\d\b/.test(i)?"UPSTREAM_5XX":"UNKNOWN":"UNKNOWN"}function s2(n){const i=n,o=typeof i?.message=="string"?i.message:String(n??""),s=typeof i?.code=="string"?i.code:"",r=s&&s in vo?s:o2(o),u=vo[r]??vo.UNKNOWN;return{code:r,spec:u,message:o}}function Mp(n,i){const{code:o,spec:s,message:r}=s2(n);if(s.surface==="card")i.showErrorCard(o,{fallbackMessage:r});else{const u=s.toastKey?we(s.toastKey):r||we("toast.generateFailed");i.showToast(u,!0)}return{code:o,message:r}}function r2(){try{const n=localStorage.getItem("ima2.rightPanelOpen");return n===null?!0:JSON.parse(n)===!0}catch{return!0}}function c2(){try{const n=localStorage.getItem("ima2.uiMode");if(n==="node"||n==="classic")return n}catch{}return"classic"}function _d(){try{const n=localStorage.getItem("ima2:theme");if(n==="system"||n==="dark"||n==="light")return n}catch{}return"system"}function zp(){try{const n=localStorage.getItem(Py);if(l2(n))return n}catch{}return a2}function u2(n){try{localStorage.setItem(Py,n)}catch{}}function rr(n){return n==="dark"||n==="light"?n:typeof window>"u"||typeof window.matchMedia!="function"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}const e0=18e4;function wd(n){const i=n.meta??{},o=n.kind==="classic"||n.kind==="node"?n.kind:i.kind==="classic"||i.kind==="node"?i.kind:void 0;return{id:n.requestId,prompt:typeof n.prompt=="string"?n.prompt:"",startedAt:n.startedAt,phase:typeof n.phase=="string"?n.phase:void 0,sessionId:typeof i.sessionId=="string"?i.sessionId:null,parentNodeId:typeof i.parentNodeId=="string"?i.parentNodeId:null,clientNodeId:typeof i.clientNodeId=="string"?i.clientNodeId:null,kind:o}}function Ed(){try{const n=localStorage.getItem("ima2.inFlight");if(!n)return[];const i=JSON.parse(n);if(!Array.isArray(i))return[];const o=Date.now();return i.filter(s=>s&&typeof s.id=="string"&&typeof s.prompt=="string"&&typeof s.startedAt=="number"&&o-s.startedAt<e0).map(s=>({id:s.id,prompt:s.prompt,startedAt:s.startedAt,phase:typeof s.phase=="string"?s.phase:void 0,sessionId:typeof s.sessionId=="string"?s.sessionId:null,parentNodeId:typeof s.parentNodeId=="string"?s.parentNodeId:null,clientNodeId:typeof s.clientNodeId=="string"?s.clientNodeId:null,kind:s.kind==="classic"||s.kind==="node"?s.kind:void 0}))}catch{return[]}}function Fa(n){try{localStorage.setItem("ima2.inFlight",JSON.stringify(n))}catch(i){const o=window;if(!o.__ima2QuotaWarned){o.__ima2QuotaWarned=!0,console.warn("[ima2] localStorage write failed:",i);try{ae.getState().showToast(we("toast.localStorageFull"),!0)}catch{}}}}function Dp(){try{const n=localStorage.getItem("ima2.selectedFilename");return typeof n=="string"&&n.length>0?n:null}catch{return null}}function mo(n){try{n?localStorage.setItem("ima2.selectedFilename",n):localStorage.removeItem("ima2.selectedFilename")}catch{}}function d2(){try{const n=localStorage.getItem("ima2.activeSessionId");return typeof n=="string"&&n.length>0?n:null}catch{return null}}function Nd(n){try{n?localStorage.setItem("ima2.activeSessionId",n):localStorage.removeItem("ima2.activeSessionId")}catch{}}const Wi=500,ba=5;function Rp(n){return n==="classic"||n==="edit"||n==="generate"?n:null}function jp(n){return n.replace(/^data:[^;]+;base64,/,"")}function t0(n){const i=n.nodes.map(s=>{const r=s.data??{},u=typeof r.imageUrl=="string"&&r.imageUrl.length>0?r.imageUrl:null,f=typeof r.serverNodeId=="string"&&r.serverNodeId.length>0?`/generated/${r.serverNodeId}.png`:null,g=u??f,p={clientId:s.id,serverNodeId:r.serverNodeId??null,parentServerNodeId:r.parentServerNodeId??null,prompt:typeof r.prompt=="string"?r.prompt:"",imageUrl:g,status:r.status??(g?"ready":"empty"),pendingRequestId:r.pendingRequestId??null,recoveryRequestId:r.recoveryRequestId??null,pendingPhase:r.pendingPhase??null,pendingStartedAt:typeof r.pendingStartedAt=="number"?r.pendingStartedAt:null,partialImageUrl:null,error:r.error,elapsed:r.elapsed,webSearchCalls:r.webSearchCalls,model:r.model??null};return{id:s.id,type:"imageNode",position:{x:s.x,y:s.y},data:p}}),o=n.edges.map(s=>({id:s.id,source:s.source,target:s.target}));return{graphNodes:i,graphEdges:o,graphVersion:n.graphVersion}}function f2(n,i){return`${n}x${i}`}function Op(n,i){if(n.sizePreset!=="custom")return null;const o=J1(n.customW,n.customH,n.customW,n.customH);return o.adjusted?{requestedW:o.requestedW,requestedH:o.requestedH,adjustedW:o.w,adjustedH:o.h,reasons:o.reasons,continuation:i}:null}const ae=gx((n,i)=>({provider:"oauth",quality:"medium",sizePreset:"1024x1024",customW:1920,customH:1088,format:"png",moderation:"low",count:1,promptMode:"auto",prompt:"",referenceImages:[],addReferences:async o=>{const s=ba-i().referenceImages.length,r=o.slice(0,Math.max(0,s)),u=r.filter(or),f=r.filter(m=>!or(m)),p=(await Promise.all(f.map(async m=>{try{return await Sp(m,{preserveTransparency:bp(m)})}catch(v){return console.warn("[addReferences] compress failed",v),null}}))).filter(m=>!!m);n(m=>({referenceImages:[...m.referenceImages,...p].slice(0,ba)})),u.length>0&&i().showToast(we("toast.refHeicUnsupported"),!0),f.length-p.length>0&&i().showToast(we("toast.refTooLarge"),!0),o.length>s&&i().showToast(we("toast.refLimitExceeded"),!0)},addReferenceDataUrl:o=>{n(s=>s.referenceImages.length>=ba?s:{referenceImages:[...s.referenceImages,o]})},removeReference:o=>{n(s=>({referenceImages:s.referenceImages.filter((r,u)=>u!==o)}))},clearReferences:()=>n({referenceImages:[]}),useCurrentAsReference:async()=>{const o=i().currentImage;if(!o){i().showToast(we("toast.noCurrentImageForRef"),!0);return}if(i().referenceImages.length>=ba){i().showToast(we("toast.refSlotFull"),!0);return}let s=o.image;if(!s.startsWith("data:"))try{const u=await(await fetch(s)).blob();s=await new Promise((f,g)=>{const p=new FileReader;p.onload=()=>typeof p.result=="string"?f(p.result):g(new Error("read failed")),p.onerror=()=>g(p.error??new Error("read failed")),p.readAsDataURL(u)})}catch{i().showToast(we("toast.currentImageLoadFailed"),!0);return}n(r=>({referenceImages:[...r.referenceImages,s].slice(0,ba)})),i().showToast(we("toast.addedCurrentAsRef"))},activeGenerations:Ed().length,inFlight:Ed(),startInFlightPolling:()=>{if(typeof window>"u")return;const o=window;if(o.__ima2InflightTimer)return;const s=async()=>{if(i().inFlight.length===0){o.__ima2InflightTimer&&(clearInterval(o.__ima2InflightTimer),o.__ima2InflightTimer=void 0);return}try{const u=i().uiMode==="node"?"node":"classic",f=u==="node"?i().activeSessionId??void 0:void 0,{jobs:g}=await vd({kind:u,sessionId:f}),p=new Map(g.map(x=>[x.requestId,x]));let h=!1;const m=Date.now(),v=5e3,y=[];for(const x of i().inFlight){if(!((x.kind??"classic")===u&&(u!=="node"||(x.sessionId??null)===(f??null)))){y.push(x);continue}if(!p.has(x.id)&&m-x.startedAt>v){h=!0;continue}const A=p.get(x.id);if(A){const M=wd(A),H={...x,phase:M.phase,sessionId:M.sessionId,parentNodeId:M.parentNodeId,clientNodeId:M.clientNodeId,kind:M.kind};(H.phase!==x.phase||H.sessionId!==x.sessionId||H.parentNodeId!==x.parentNodeId||H.clientNodeId!==x.clientNodeId||H.kind!==x.kind)&&(h=!0),y.push(H)}else y.push(x)}h&&(Fa(y),n({inFlight:y,activeGenerations:y.length}))}catch{}try{const u=i().history.reduce((y,x)=>x.createdAt&&x.createdAt>y?x.createdAt:y,0),{items:f}=await Gd({limit:Wi,since:u}),g=f.map(y=>({image:y.url,url:y.url,filename:y.filename,thumb:y.url,prompt:y.prompt??void 0,size:y.size??void 0,quality:y.quality??void 0,format:y.format,createdAt:y.createdAt,sessionId:y.sessionId??null,nodeId:y.nodeId??null,clientNodeId:y.clientNodeId??null,requestId:y.requestId??null,kind:Rp(y.kind),refsCount:y.refsCount??0})),p=i().history,h=g.filter(y=>!p.some(x=>x.filename===y.filename));h.length>0&&n(y=>{const x=y.currentImage??h[0];return!y.currentImage&&h[0]?.filename&&mo(h[0].filename),{history:[...h,...y.history].slice(0,Wi),currentImage:x}});const m=Date.now(),v=i().inFlight.filter(y=>m-y.startedAt<e0);v.length!==i().inFlight.length&&(Fa(v),n({inFlight:v,activeGenerations:v.length}))}catch{}};o.__ima2InflightTimer=window.setInterval(s,1500)},reconcileInflight:async()=>{try{const o=i().uiMode==="node"?"node":"classic",s=o==="node"?i().activeSessionId??void 0:void 0,{jobs:r}=await vd({kind:o,sessionId:s}),u=new Map(r.map(m=>[m.requestId,m])),f=Date.now(),p=i().inFlight.flatMap(m=>{const v=u.get(m.id);if(v){const E=wd(v);return[{...m,...E,prompt:m.prompt||E.prompt}]}return(m.kind??"classic")===o&&(o!=="node"||(m.sessionId??null)===(s??null))?f-m.startedAt<1e4?[m]:[]:[m]}),h=new Set(p.map(m=>m.id));for(const m of r)h.has(m.requestId)||p.push(wd(m));Fa(p),n({inFlight:p,activeGenerations:p.length}),p.length>0&&i().startInFlightPolling()}catch{}},syncFromStorage:()=>{const o=Ed(),s=Dp(),r=zp();n(u=>({inFlight:o,activeGenerations:o.length,imageModel:r,currentImage:s&&u.currentImage?.filename!==s?u.history.find(f=>f.filename===s)??u.currentImage:u.currentImage})),o.length>0&&i().startInFlightPolling()},currentImage:null,history:[],toast:null,customSizeConfirm:null,errorCard:null,rightPanelOpen:r2(),toggleRightPanel:()=>n(o=>{const s=!o.rightPanelOpen;try{localStorage.setItem("ima2.rightPanelOpen",JSON.stringify(s))}catch{}return{rightPanelOpen:s}}),galleryOpen:!1,openGallery:()=>n({galleryOpen:!0}),closeGallery:()=>n({galleryOpen:!1}),imageModel:zp(),settingsOpen:!1,activeSettingsSection:"account",openSettings:(o="account")=>n({settingsOpen:!0,activeSettingsSection:o}),closeSettings:()=>n({settingsOpen:!1}),toggleSettings:()=>n(o=>({settingsOpen:!o.settingsOpen,activeSettingsSection:o.settingsOpen?o.activeSettingsSection:"account"})),setActiveSettingsSection:o=>n({activeSettingsSection:o}),uiMode:c2(),setUIMode:o=>{try{localStorage.setItem("ima2.uiMode",o)}catch{}n({uiMode:o})},theme:_d(),resolvedTheme:rr(_d()),setTheme:o=>{try{localStorage.setItem("ima2:theme",o)}catch{}n({theme:o,resolvedTheme:rr(o)})},syncThemeFromStorage:()=>{const o=_d();n({theme:o,resolvedTheme:rr(o)})},refreshResolvedTheme:()=>{n(o=>({resolvedTheme:rr(o.theme)}))},locale:$1(),setLocale:o=>{K1(o),n({locale:o})},graphNodes:[],graphEdges:[],setGraphNodes:o=>{n({graphNodes:o}),i().scheduleGraphSave()},setGraphEdges:o=>{n({graphEdges:o}),i().scheduleGraphSave()},sessions:[],activeSessionId:null,activeSessionGraphVersion:null,sessionLoading:!1,styleSheet:null,styleSheetEnabled:!1,styleSheetExtracting:!1,async loadStyleSheet(){const o=i().activeSessionId;if(!o){n({styleSheet:null,styleSheetEnabled:!1});return}try{const s=await zx(o);if(i().activeSessionId!==o)return;n({styleSheet:s.styleSheet,styleSheetEnabled:!!s.enabled})}catch(s){console.warn("[styleSheet] load failed:",s)}},async saveStyleSheet(o,s){const r=i().activeSessionId;if(r)try{if(await Dx(r,o,s),i().activeSessionId!==r)return;n({styleSheet:o,...typeof s=="boolean"?{styleSheetEnabled:s}:{}}),i().showToast(we("styleSheet.saved"))}catch(u){console.warn("[styleSheet] save failed:",u),i().showToast(u.message,!0)}},async toggleStyleSheetEnabled(){const o=i().activeSessionId;if(!o)return;const s=!i().styleSheetEnabled;try{if(await Rx(o,s),i().activeSessionId!==o)return;n({styleSheetEnabled:s})}catch(r){console.warn("[styleSheet] toggle failed:",r),i().showToast(r.message,!0)}},async extractStyleSheet(){const o=i().activeSessionId;if(!o)return;const s=i().prompt.trim();if(!s){i().showToast(we("styleSheet.noPrompt"),!0);return}const r=i().referenceImages[0];n({styleSheetExtracting:!0});try{const{styleSheet:u}=await jx(o,s,r);if(i().activeSessionId!==o){n({styleSheetExtracting:!1});return}n({styleSheet:u,styleSheetEnabled:!0,styleSheetExtracting:!1}),i().showToast(we("styleSheet.extracted"))}catch(u){n({styleSheetExtracting:!1}),console.warn("[styleSheet] extract failed:",u);const f=u.code,g=f==="STYLE_SHEET_NO_KEY"?we("styleSheet.errNoKey"):f==="STYLE_SHEET_EMPTY"||f==="STYLE_SHEET_PARSE"||f==="STYLE_SHEET_SHAPE"?we("styleSheet.errBadOutput"):u.message;i().showToast(g,!0)}},async loadSessions(){try{const{sessions:o}=await Nx();if(n({sessions:o}),!i().activeSessionId){const r=d2(),u=r?o.some(f=>f.id===r):!1;r&&u?await i().switchSession(r):await i().createAndSwitchSession(we("session.firstGraph"))}}catch(o){console.warn("[sessions] load failed:",o)}},async switchSession(o){n({sessionLoading:!0}),await i().flushGraphSave("switch-session");try{const{session:s}=await Ky(o),{graphNodes:r,graphEdges:u,graphVersion:f}=t0(s);n({activeSessionId:o,activeSessionGraphVersion:f,graphNodes:r,graphEdges:u,sessionLoading:!1}),Nd(o),await i().reconcileGraphPending().catch(()=>{}),i().loadStyleSheet().catch(()=>{})}catch(s){console.warn("[sessions] switch failed:",s),n({sessionLoading:!1}),i().showToast(we("toast.sessionLoadFailed"),!0)}},async reconcileGraphPending(){const o=i().activeSessionId;if(!o)return;if(i().graphNodes.filter(r=>r.data?.pendingRequestId&&(r.data.status==="pending"||r.data.status==="reconciling")).length>0){let r=[];try{r=(await vd({kind:"node",sessionId:o})).jobs}catch{r=[]}const u=new Map(r.map(h=>[h.requestId,h.phase])),f=Date.now(),g=1e4,p=i().graphNodes.map(h=>{const m=h.data?.pendingRequestId;if(!m||h.data.status!=="pending"&&h.data.status!=="reconciling")return h;if(u.has(m)){const x=u.get(m)??null;return{...h,data:{...h.data,status:"reconciling",pendingPhase:x}}}const v=h.data.pendingStartedAt??0;if(v&&f-v<g)return{...h,data:{...h.data,status:"reconciling"}};const y=!!h.data.imageUrl||!!h.data.serverNodeId;return{...h,data:{...h.data,pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,status:y?"ready":"stale",error:y?void 0:we("session.assetAbortedError")}}});n({graphNodes:p})}await l0(i,n).catch(()=>{})},async createAndSwitchSession(o){o==null&&(o=we("session.untitled"));try{const{session:s}=await Tx(o);n({sessions:[s,...i().sessions],activeSessionId:s.id,activeSessionGraphVersion:s.graphVersion,graphNodes:[],graphEdges:[]}),Nd(s.id)}catch(s){console.warn("[sessions] create failed:",s),i().showToast(we("toast.sessionCreateFailed"),!0)}},async renameCurrentSession(o){const s=i().activeSessionId;if(s)try{await Ax(s,o),n({sessions:i().sessions.map(r=>r.id===s?{...r,title:o,updatedAt:Date.now()}:r)})}catch{i().showToast(we("toast.sessionRenameFailed"),!0)}},async deleteSessionById(o){try{await Cx(o);const s=i().sessions.filter(r=>r.id!==o);n({sessions:s}),i().activeSessionId===o&&(n({activeSessionId:null,activeSessionGraphVersion:null,graphNodes:[],graphEdges:[]}),Nd(null),s.length>0?await i().switchSession(s[0].id):await i().createAndSwitchSession(we("session.firstGraph")))}catch{i().showToast(we("toast.sessionDeleteFailed"),!0)}},scheduleGraphSave(){s0(i,n)},async flushGraphSave(o="manual"){await p2(i,n,o)},addRootNode:()=>{const o=Qi(),s=0,r=i().graphNodes.filter(f=>!f.data.parentServerNodeId).length,u={id:o,type:"imageNode",position:Cp(s,r),data:{clientId:o,serverNodeId:null,parentServerNodeId:null,prompt:"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};return n({graphNodes:[...i().graphNodes,u]}),i().scheduleGraphSave(),o},addChildNode:o=>{const s=i().graphNodes.find(p=>p.id===o);if(!s)return o;const r=Qi(),u=i().graphEdges.filter(p=>p.source===o).length,f={id:r,type:"imageNode",position:{x:s.position.x+360,y:s.position.y+u*320},data:{clientId:r,serverNodeId:null,parentServerNodeId:s.data.serverNodeId,prompt:"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},g={id:`${o}->${r}`,source:o,target:r};return n({graphNodes:[...i().graphNodes,f],graphEdges:[...i().graphEdges,g]}),i().scheduleGraphSave(),r},addSiblingNode:o=>{const s=i().graphNodes.find(v=>v.id===o);if(!s)return o;const r=i().graphEdges.find(v=>v.target===o);if(!r){const v=Qi(),y=0,x=i().graphNodes.filter(C=>!C.data.parentServerNodeId).length,E={id:v,type:"imageNode",position:Cp(y,x),data:{clientId:v,serverNodeId:null,parentServerNodeId:null,prompt:s.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};return n({graphNodes:[...i().graphNodes,E]}),i().scheduleGraphSave(),v}const u=r.source,f=i().graphNodes.find(v=>v.id===u);if(!f)return o;const g=Qi(),p=i().graphEdges.filter(v=>v.source===u).length,h={id:g,type:"imageNode",position:{x:f.position.x+360,y:f.position.y+p*320},data:{clientId:g,serverNodeId:null,parentServerNodeId:s.data.parentServerNodeId,prompt:s.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},m={id:`${u}->${g}`,source:u,target:g};return n({graphNodes:[...i().graphNodes,h],graphEdges:[...i().graphEdges,m]}),i().scheduleGraphSave(),g},updateNodePrompt:(o,s)=>{n({graphNodes:i().graphNodes.map(r=>r.id===o?{...r,data:{...r.data,prompt:s}}:r)}),i().scheduleGraphSave()},addNodeReferences:async(o,s)=>{const r=i().graphNodes.find(x=>x.id===o);if(!r)return;if(r.data.parentServerNodeId){i().showToast(we("node.nodeRefsUnsupportedForEdit"),!0);return}const u=r.data.referenceImages??[],f=ba-u.length;if(f<=0){i().showToast(we("toast.refLimitExceeded"),!0);return}const g=s.slice(0,Math.max(0,f)),p=g.filter(or),h=g.filter(x=>!or(x)),v=(await Promise.all(h.map(async x=>{try{return await Sp(x,{preserveTransparency:bp(x)})}catch(E){return console.warn("[addNodeReferences] compress failed",E),null}}))).filter(x=>!!x);v.length>0&&n({graphNodes:i().graphNodes.map(x=>x.id===o?{...x,data:{...x.data,referenceImages:[...x.data.referenceImages??[],...v].slice(0,ba)}}:x)}),p.length>0&&i().showToast(we("toast.refHeicUnsupported"),!0),h.length-v.length>0&&i().showToast(we("toast.refTooLarge"),!0),s.length>f&&i().showToast(we("toast.refLimitExceeded"),!0)},addNodeReferenceDataUrl:(o,s)=>{const r=i().graphNodes.find(u=>u.id===o);if(r){if(r.data.parentServerNodeId){i().showToast(we("node.nodeRefsUnsupportedForEdit"),!0);return}n({graphNodes:i().graphNodes.map(u=>{if(u.id!==o)return u;const f=u.data.referenceImages??[];return f.length>=ba?u:{...u,data:{...u.data,referenceImages:[...f,s]}}})})}},removeNodeReference:(o,s)=>{n({graphNodes:i().graphNodes.map(r=>r.id===o?{...r,data:{...r.data,referenceImages:(r.data.referenceImages??[]).filter((u,f)=>f!==s)}}:r)})},clearNodeReferences:o=>{n({graphNodes:i().graphNodes.map(s=>s.id===o?{...s,data:{...s.data,referenceImages:void 0}}:s)})},duplicateBranchRoot:o=>{const s=i().graphNodes.find(f=>f.id===o);if(!s)return o;const r=Qi();i().graphNodes.filter(f=>!f.data.parentServerNodeId).length;const u={id:r,type:"imageNode",position:{x:s.position.x+420,y:s.position.y+40},data:{clientId:r,serverNodeId:null,parentServerNodeId:null,prompt:s.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};if(n({graphNodes:[...i().graphNodes,u]}),i().scheduleGraphSave(),s.data.imageUrl){const f=s.data.imageUrl;(async()=>{try{const p=await(await fetch(f)).blob(),h=await new Promise((m,v)=>{const y=new FileReader;y.onload=()=>typeof y.result=="string"?m(y.result):v(new Error("read failed")),y.onerror=()=>v(y.error??new Error("read failed")),y.readAsDataURL(p)});n({graphNodes:i().graphNodes.map(m=>m.id===r?{...m,data:{...m.data,referenceImages:[h]}}:m)})}catch{}})()}return r},async generateNode(o){const s=i().graphNodes.find(p=>p.id===o);if(!s)return;const{prompt:r,parentServerNodeId:u}=s.data;if(!r.trim()){i().showToast(we("toast.promptRequired"),!0);return}const f=s.data.referenceImages??[];if(u&&f.length>0){i().showToast(we("node.nodeRefsUnsupportedForEdit"),!0);return}const g=Op(i(),{kind:"node",clientId:o});if(g){n({customSizeConfirm:g});return}await i().runGenerateNode(o)},async runGenerateNode(o,s){const u=i().graphNodes.find(H=>H.id===o)?.data.status==="ready"?i().addSiblingNode(o):o,f=i().graphNodes.find(H=>H.id===u);if(!f)return;const{prompt:g,parentServerNodeId:p}=f.data;if(!g.trim()){i().showToast(we("toast.promptRequired"),!0);return}const h=f.data.referenceImages??[];if(p&&h.length>0){i().showToast(we("node.nodeRefsUnsupportedForEdit"),!0);return}const m=i(),v=s??m.getResolvedSize(),y=m.activeSessionId,x=Date.now(),E=Math.random().toString(36).slice(2,6),C=`fn_${u}_${x}_${E}`,A=[...m.inFlight,{id:C,prompt:g,startedAt:x,kind:"node",sessionId:y,clientNodeId:u}];Fa(A),n({graphNodes:i().graphNodes.map(H=>H.id===u?{...H,data:{...H.data,status:"pending",pendingRequestId:C,recoveryRequestId:C,pendingPhase:"queued",pendingStartedAt:x,partialImageUrl:null,error:void 0}}:H),activeGenerations:m.activeGenerations+1,inFlight:A}),i().startInFlightPolling();let M=!0;try{const H=await Ex({parentNodeId:p,prompt:g,quality:m.quality,size:v,format:m.format,moderation:m.moderation,model:m.imageModel,requestId:C,sessionId:y,clientNodeId:u,...h.length&&!p?{references:h.map(jp)}:{}},{onPartial:_=>{i().activeSessionId===y&&n({graphNodes:i().graphNodes.map(z=>z.id===u?{...z,data:{...z.data,status:"pending",partialImageUrl:_.image,pendingPhase:"partial"}}:z)})},onPhase:_=>{i().activeSessionId===y&&_.phase&&n({graphNodes:i().graphNodes.map(z=>z.id===u?{...z,data:{...z.data,pendingPhase:_.phase??z.data.pendingPhase}}:z)})}});i().activeSessionId===y&&(n({graphNodes:i().graphNodes.map(_=>{if(_.id!==u)return _;const z={..._.data};return delete z.referenceImages,delete z.partialImageUrl,{..._,data:{...z,serverNodeId:H.nodeId,imageUrl:H.url,status:"ready",pendingRequestId:null,recoveryRequestId:null,pendingPhase:null,pendingStartedAt:null,elapsed:H.elapsed,webSearchCalls:H.webSearchCalls,model:H.model??null}}})}),M=!0,i().showToast(we("toast.nodeCreated",{id:H.nodeId.slice(0,8),elapsed:H.elapsed})))}catch(H){const _=H instanceof Error?H.message:we("toast.nodeCreateFailed");i().activeSessionId===y&&(n({graphNodes:i().graphNodes.map(z=>z.id===u?{...z,data:{...z.data,status:"error",pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,error:_}}:z)}),M=!0,Mp(H,i()))}finally{const H=i().inFlight.filter(_=>_.id!==C);Fa(H),n({activeGenerations:Math.max(0,i().activeGenerations-1),inFlight:H}),i().activeSessionId===y&&M&&i().scheduleGraphSave()}},deleteNode:o=>{const r=i().graphNodes.find(u=>u.id===o)?.data?.pendingRequestId;r&&pp(r),n({graphNodes:i().graphNodes.filter(u=>u.id!==o),graphEdges:i().graphEdges.filter(u=>u.source!==o&&u.target!==o)}),i().scheduleGraphSave()},deleteNodes:o=>{const s=new Set(o);for(const r of i().graphNodes)s.has(r.id)&&r.data?.pendingRequestId&&pp(r.data.pendingRequestId);n({graphNodes:i().graphNodes.filter(r=>!s.has(r.id)),graphEdges:i().graphEdges.filter(r=>!s.has(r.source)&&!s.has(r.target))}),i().scheduleGraphSave()},addChildNodeAt:(o,s)=>{const r=i().graphNodes.find(p=>p.id===o);if(!r)return o;const u=Qi(),f={id:u,type:"imageNode",position:s,data:{clientId:u,serverNodeId:null,parentServerNodeId:r.data.serverNodeId,prompt:"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},g={id:`${o}->${u}`,source:o,target:u};return n({graphNodes:[...i().graphNodes,f],graphEdges:[...i().graphEdges,g]}),i().scheduleGraphSave(),u},connectNodes:(o,s)=>{if(o===s||i().graphEdges.find(f=>f.source===o&&f.target===s))return;const u=i().graphNodes.find(f=>f.id===o);u&&(n({graphNodes:i().graphNodes.map(f=>f.id===s?{...f,data:{...f.data,parentServerNodeId:u.data.serverNodeId}}:f),graphEdges:[...i().graphEdges,{id:`${o}->${s}`,source:o,target:s}]}),i().scheduleGraphSave())},setProvider:o=>n({provider:o}),setQuality:o=>n({quality:o}),setSizePreset:o=>n({sizePreset:o}),setCustomSize:(o,s)=>n(r=>({customW:il(o,r.customW),customH:il(s,r.customH)})),setFormat:o=>n({format:o}),setModeration:o=>n({moderation:o}),setImageModel:o=>{u2(o),n({imageModel:o})},setCount:o=>n({count:o}),setPromptMode:o=>n({promptMode:o}),setPrompt:o=>n({prompt:o}),selectHistory:o=>{mo(o.filename??null),n({currentImage:o})},removeFromHistory:o=>{const s=i(),r=s.history.filter(f=>f.filename!==o),u=s.currentImage&&s.currentImage.filename===o?null:s.currentImage;n({history:r,currentImage:u}),u===null&&mo(null)},addHistoryItem:o=>{const s=i();if(s.history.some(f=>o.filename&&f.filename===o.filename))return;const u={...o,createdAt:o.createdAt||Date.now()};n({history:[u,...s.history].slice(0,Wi)})},getResolvedSize:()=>{const{sizePreset:o,customW:s,customH:r}=i();return o==="custom"?`${s}x${r}`:o},async generate(){const o=i();if(!o.prompt.trim())return;const r=Op(o,{kind:"classic"});if(r){n({customSizeConfirm:r});return}await i().runGenerate()},async runGenerate(o){const s=i(),r=s.prompt.trim();if(!r)return;const u=o??s.getResolvedSize(),f=`f_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,g=Date.now(),p=[...s.inFlight,{id:f,prompt:r,startedAt:g}];Fa(p),n({activeGenerations:s.activeGenerations+1,inFlight:p}),i().startInFlightPolling();try{const h={prompt:r,quality:s.quality,size:u,format:s.format,moderation:s.moderation,provider:s.provider,n:s.count,model:s.imageModel,requestId:f,mode:s.promptMode,...s.referenceImages.length?{references:s.referenceImages.map(jp)}:{}},m=await yx(h);if(mp(m)&&m.images.length>1){for(const v of m.images){const y={image:v.image,filename:v.filename,prompt:r,elapsed:m.elapsed,provider:m.provider,usage:m.usage,quality:m.quality??s.quality,size:m.size??u,model:m.model??s.imageModel};await Lp(y,n,i)}i().showToast(we("toast.generatedBatch",{count:m.images.length,elapsed:m.elapsed}))}else{let v;if(mp(m)){const y=m.images[0];v={image:y.image,filename:y.filename,prompt:r,elapsed:m.elapsed,provider:m.provider,usage:m.usage,quality:m.quality??s.quality,size:m.size??u,model:m.model??s.imageModel}}else v={image:m.image,filename:m.filename,prompt:r,elapsed:m.elapsed,provider:m.provider,usage:m.usage,quality:m.quality??s.quality,size:m.size??u,model:m.model??s.imageModel};await Lp(v,n,i),i().showToast(we("toast.generatedSingle",{elapsed:m.elapsed}))}}catch(h){Mp(h,i())}finally{const h=i().inFlight.filter(m=>m.id!==f);Fa(h),n({activeGenerations:Math.max(0,i().activeGenerations-1),inFlight:h})}},async confirmCustomSizeAdjustment(){const o=i().customSizeConfirm;if(!o)return;const s=f2(o.adjustedW,o.adjustedH);if(n({customW:o.adjustedW,customH:o.adjustedH,customSizeConfirm:null}),o.continuation.kind==="classic"){await i().runGenerate(s);return}await i().runGenerateNode(o.continuation.clientId,s)},cancelCustomSizeAdjustment:()=>n({customSizeConfirm:null}),hydrateHistory(){(async()=>{try{const s=(await Gd({limit:Wi})).items.map(r=>({image:r.url,url:r.url,filename:r.filename,prompt:r.prompt||void 0,provider:r.provider,quality:r.quality||void 0,size:r.size||void 0,model:r.model??void 0,usage:r.usage??void 0,thumb:r.url,createdAt:r.createdAt,sessionId:r.sessionId??null,nodeId:r.nodeId??null,clientNodeId:r.clientNodeId??null,requestId:r.requestId??null,kind:Rp(r.kind),refsCount:r.refsCount??0}));if(s.length>0){const r=Dp(),u=r?s.find(f=>f.filename===r):null;n({history:s,currentImage:u??s[0]}),u||mo(s[0]?.filename??null)}}catch(o){console.warn("[history] load failed:",o)}})()},showToast(o,s=!1){n({toast:{message:o,error:s,id:Date.now()+Math.random()}})},showErrorCard(o,s){n({errorCard:{code:o,fallbackMessage:s?.fallbackMessage,id:Date.now()+Math.random()}})},dismissErrorCard(){n({errorCard:null})}})),h2=800,Hp="ima2.graphTabId";let hn=null,vr=!1,Sr=!1,Pa=null,n0=0;function a0(){try{const n=sessionStorage.getItem(Hp);if(n)return n;const i=`tab_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`;return sessionStorage.setItem(Hp,i),i}catch{return"tab_unavailable"}}function i0(n){const i={...n};return delete i.referenceImages,delete i.partialImageUrl,n.status==="pending"||n.status==="reconciling"?{...i,status:"empty",pendingRequestId:null,recoveryRequestId:n.pendingRequestId??n.recoveryRequestId??null,pendingPhase:null,pendingStartedAt:null,error:void 0}:i}async function l0(n,i){const o=n().activeSessionId;if(!o||n().graphNodes.filter(g=>!g.data.imageUrl&&!g.data.serverNodeId).length===0)return;let r=[];try{r=(await Gd({sessionId:o,limit:Wi})).items}catch{return}let u=!1;const f=n().graphNodes.map(g=>{if(g.data.imageUrl||g.data.serverNodeId)return g;const p=g.data.pendingStartedAt??0,h=g.data.pendingRequestId??g.data.recoveryRequestId??null,v=(h?r.find(y=>(y.sessionId??null)===o&&(y.requestId??null)===h):null)??r.find(y=>(y.sessionId??null)===o&&(y.clientNodeId??null)===g.id&&(!p||(y.createdAt??0)>=p));return v?(u=!0,{...g,data:{...g.data,status:"ready",imageUrl:v.url,serverNodeId:v.nodeId??g.data.serverNodeId,pendingRequestId:null,recoveryRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,error:void 0}}):g});u&&(i({graphNodes:f}),s0(n,i,"recovery"))}async function g2(n,i){const o=n().activeSessionId;if(!o)return;const{session:s}=await Ky(o),{graphNodes:r,graphEdges:u,graphVersion:f}=t0(s);i({graphNodes:r,graphEdges:u,activeSessionGraphVersion:f}),n().showToast(we("toast.sessionReloadedElsewhere"),!0),await l0(n,i).catch(()=>{})}async function m2(n,i,o){const s=n().activeSessionId,r=n().activeSessionGraphVersion;if(!s||r==null)return"skipped";const{graphNodes:u,graphEdges:f}=n(),g=u.map(m=>({id:m.id,x:m.position.x,y:m.position.y,data:i0(m.data)})),p=f.map(m=>({id:m.id,source:m.source,target:m.target,data:{}})),h=`gs_${Date.now().toString(36)}_${++n0}`;try{const m=await Mx(s,r,g,p,{saveId:h,saveReason:o,tabId:a0()});return n().activeSessionId!==s?"skipped":(i({activeSessionGraphVersion:m.graphVersion}),"saved")}catch(m){return m.status===409?(await g2(n,i),"conflict"):(console.warn("[sessions] save failed:",m),"failed")}}async function o0(n,i,o){if(vr){Sr=!0,Pa&&await Pa;return}vr=!0,Pa=(async()=>{let s=o;do{Sr=!1;const r=await m2(n,i,s);if(r==="conflict"||r==="failed")break;s="queued"}while(Sr)})().finally(()=>{vr=!1,Pa=null}),await Pa}function s0(n,i,o="debounced"){const s=n();s.activeSessionId&&(s.sessionLoading||(hn&&clearTimeout(hn),hn=setTimeout(()=>{hn=null,o0(n,i,o)},h2)))}async function p2(n,i,o="manual"){let s=!1;if(hn&&(clearTimeout(hn),hn=null,s=!0),vr){Sr=!0,Pa&&await Pa;return}s&&await o0(n,i,o)}function y2(n){const i=n();if(!i.activeSessionId||i.activeSessionGraphVersion==null)return;hn&&(clearTimeout(hn),hn=null);const o=i.graphNodes.map(f=>({id:f.id,x:f.position.x,y:f.position.y,data:i0(f.data)})),s=i.graphEdges.map(f=>({id:f.id,source:f.source,target:f.target,data:{}})),r=`/api/sessions/${encodeURIComponent(i.activeSessionId)}/graph`,u=JSON.stringify({nodes:o,edges:s});try{fetch(r,{method:"PUT",headers:{"Content-Type":"application/json","If-Match":String(i.activeSessionGraphVersion),"X-Ima2-Graph-Save-Id":`gs_${Date.now().toString(36)}_${++n0}`,"X-Ima2-Graph-Save-Reason":"beforeunload","X-Ima2-Tab-Id":a0()},body:u,keepalive:!0})}catch{}}async function Lp(n,i,o){const s=await Ox(n.image).catch(()=>n.image),r=n.filename?`/generated/${n.filename}`:n.image,u={...n,thumb:s,url:r,createdAt:n.createdAt||Date.now()},f=[u,...o().history].slice(0,Wi);mo(u.filename??null),i({history:f,currentImage:u})}function v2(){const{t:n}=Ve(),i=ae(s=>s.uiMode),o=ae(s=>s.setUIMode);return S.jsxs("div",{className:"ui-mode-switch",role:"tablist","aria-label":n("uiMode.ariaLabel"),children:[S.jsx("button",{type:"button",role:"tab","aria-selected":i==="classic",className:`ui-mode-switch__tab${i==="classic"?" active":""}`,onClick:()=>o("classic"),children:n("uiMode.classic")}),S.jsx("button",{type:"button",role:"tab","aria-selected":i==="node",className:`ui-mode-switch__tab${i==="node"?" active":""}`,onClick:()=>o("node"),children:n("uiMode.node")})]})}const Up={palette:[],composition:"",mood:"",medium:"",subject_details:"",negative:[]};function r0({open:n,onClose:i}){const{t:o}=Ve(),s=ae(O=>O.styleSheet),r=ae(O=>O.styleSheetEnabled),u=ae(O=>O.styleSheetExtracting),f=ae(O=>O.activeSessionId),g=ae(O=>O.toggleStyleSheetEnabled),p=ae(O=>O.extractStyleSheet),h=ae(O=>O.saveStyleSheet),[m,v]=V.useState(!1),[y,x]=V.useState(s??Up),[E,C]=V.useState(!1),[A,M]=V.useState(!1);if(V.useEffect(()=>{n?x(s??Up):(v(!1),C(!1))},[n,s]),V.useEffect(()=>{if(!n)return;const O=I=>{I.key==="Escape"&&!E&&i()};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[n,E,i]),!n||!f)return null;const H=!!s&&(s.composition||s.mood||s.medium||s.subject_details||s.palette.length>0),_=async()=>{if(!E){C(!0);try{await h(y,r),v(!1)}finally{C(!1)}}},z=async()=>{if(!A){M(!0);try{await g()}finally{M(!1)}}},Y=O=>x(I=>({...I,...O}));return S.jsx("div",{className:"style-sheet-editor__backdrop",onClick:E?void 0:i,role:"presentation",children:S.jsxs("div",{className:"style-sheet-editor",role:"dialog","aria-modal":"true","aria-label":o("styleSheet.editorTitle"),onClick:O=>O.stopPropagation(),children:[S.jsxs("div",{className:"style-sheet-panel__header",children:[S.jsx("h3",{style:{margin:0,fontSize:16},children:o("styleSheet.editorTitle")}),S.jsxs("label",{className:"style-sheet-panel__toggle",style:{marginLeft:"auto"},children:[S.jsx("input",{type:"checkbox",checked:r,disabled:!H||A,onChange:()=>{z()}}),S.jsx("span",{children:o("styleSheet.toggle")})]})]}),!m&&S.jsxs(S.Fragment,{children:[H?S.jsxs("div",{className:"style-sheet-panel__summary",children:[s.medium&&S.jsxs("div",{children:[S.jsxs("b",{children:[o("styleSheet.fields.medium"),":"]})," ",s.medium]}),s.palette.length>0&&S.jsx("div",{className:"style-sheet-panel__chips",children:s.palette.slice(0,6).map((O,I)=>S.jsx("span",{className:"style-sheet-panel__chip",title:O,children:O},I))}),s.mood&&S.jsxs("div",{className:"style-sheet-panel__muted",children:[o("styleSheet.fields.mood"),": ",s.mood]})]}):S.jsx("div",{className:"style-sheet-panel__muted",children:o("styleSheet.emptyHint")}),S.jsxs("div",{className:"style-sheet-panel__actions",children:[S.jsx("button",{type:"button",className:"btn btn--secondary btn--sm",onClick:()=>{p()},disabled:u,children:o(u?"styleSheet.extracting":"styleSheet.extract")}),S.jsx("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:()=>v(!0),disabled:u,children:o("styleSheet.edit")}),S.jsx("button",{type:"button",className:"btn btn--ghost btn--sm",style:{marginLeft:"auto"},onClick:i,children:o("styleSheet.cancel")})]})]}),m&&S.jsxs(S.Fragment,{children:[S.jsxs("label",{children:[o("styleSheet.fields.medium"),S.jsx("input",{value:y.medium,onChange:O=>Y({medium:O.target.value}),placeholder:o("styleSheet.placeholderMedium")})]}),S.jsxs("label",{children:[o("styleSheet.fields.composition"),S.jsx("textarea",{rows:2,value:y.composition,onChange:O=>Y({composition:O.target.value}),placeholder:o("styleSheet.placeholderComposition")})]}),S.jsxs("label",{children:[o("styleSheet.fields.mood"),S.jsx("input",{value:y.mood,onChange:O=>Y({mood:O.target.value}),placeholder:o("styleSheet.placeholderMood")})]}),S.jsxs("label",{children:[o("styleSheet.fields.subject"),S.jsx("textarea",{rows:2,value:y.subject_details,onChange:O=>Y({subject_details:O.target.value}),placeholder:o("styleSheet.placeholderSubject")})]}),S.jsxs("label",{children:[o("styleSheet.fields.palette"),S.jsx("input",{value:y.palette.join(", "),onChange:O=>Y({palette:O.target.value.split(",").map(I=>I.trim()).filter(Boolean).slice(0,6)}),placeholder:o("styleSheet.placeholderPalette")})]}),S.jsxs("label",{children:[o("styleSheet.fields.negative"),S.jsx("input",{value:y.negative.join(", "),onChange:O=>Y({negative:O.target.value.split(",").map(I=>I.trim()).filter(Boolean).slice(0,4)}),placeholder:o("styleSheet.placeholderNegative")})]}),S.jsxs("div",{className:"style-sheet-editor__actions",children:[S.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>v(!1),disabled:E,children:o("styleSheet.cancel")}),S.jsx("button",{type:"button",className:"btn btn--primary",onClick:()=>{_()},disabled:E,children:o(E?"styleSheet.extracting":"styleSheet.save")})]})]})]})})}const Fi=5;function S2(){const n=ae(B=>B.prompt),i=ae(B=>B.setPrompt),o=ae(B=>B.generate),{t:s}=Ve(),r=ae(B=>B.referenceImages),u=ae(B=>B.addReferences),f=ae(B=>B.removeReference),g=ae(B=>B.useCurrentAsReference),p=ae(B=>B.currentImage),h=V.useRef(null),[m,v]=V.useState(!1),[y,x]=V.useState(!1),E=ae(B=>B.activeSessionId),C=ae(B=>B.styleSheetEnabled),A=ae(B=>B.promptMode),M=ae(B=>B.setPromptMode),H=r.length<Fi,_=B=>{B.preventDefault(),v(!1);const Z=Array.from(B.dataTransfer.files).filter(oe=>oe.type.startsWith("image/"));Z.length>0&&u(Z)},z=B=>{B.preventDefault(),m||v(!0)},Y=B=>{B.currentTarget.contains(B.relatedTarget)||v(!1)},O=B=>{if(!B)return[];const Z=[];for(const oe of Array.from(B)){if(oe.kind!=="file"||!oe.type.startsWith("image/"))continue;const $=oe.getAsFile();$&&Z.push($)}return Z},I=B=>{if(!H)return;const Z=O(B.clipboardData?.items??null);if(Z.length===0)return;B.preventDefault();const oe=Fi-r.length;u(Z.slice(0,oe))};return V.useEffect(()=>{const B=Z=>{const oe=Z.target,$=oe?.tagName;if($==="INPUT"||$==="TEXTAREA"||oe?.isContentEditable)return;const ee=O(Z.clipboardData?.items??null);if(ee.length===0||r.length>=Fi)return;Z.preventDefault();const se=Fi-r.length;u(ee.slice(0,se))};return window.addEventListener("paste",B),()=>window.removeEventListener("paste",B)},[r.length,u]),S.jsxs("div",{className:`composer${m?" composer--drag":""}`,onDrop:_,onDragOver:z,onDragLeave:Y,onPaste:I,children:[S.jsxs("div",{className:"composer__header",children:[S.jsx("span",{className:"section-title composer__label",children:s("prompt.label")}),r.length>0&&S.jsx("span",{className:"composer__count",children:s("prompt.refCount",{count:r.length,max:Fi})})]}),r.length>0&&S.jsx("div",{className:"composer__chips",children:r.map((B,Z)=>S.jsxs("div",{className:"composer__chip",title:s("prompt.refChipTitle",{n:Z+1}),children:[S.jsx("img",{src:B,alt:s("prompt.refChipAlt",{n:Z+1})}),S.jsx("button",{type:"button",className:"composer__chip-remove",onClick:()=>f(Z),"aria-label":s("prompt.refRemoveAria",{n:Z+1}),children:"×"})]},Z))}),S.jsx("textarea",{className:"prompt-area composer__textarea",value:n,placeholder:r.length>0?s("prompt.placeholderWithRefs"):s("prompt.placeholder"),onChange:B=>i(B.target.value),onKeyDown:B=>{B.key==="Enter"&&(B.metaKey||B.ctrlKey)&&(B.preventDefault(),o())}}),S.jsxs("div",{className:"composer__toolbar",children:[S.jsxs("button",{type:"button",className:"composer__tool",onClick:()=>H&&h.current?.click(),disabled:!H,title:s("prompt.attachTitle"),"aria-label":s("prompt.attachTitle"),children:[S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:S.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),S.jsx("span",{children:s("prompt.attach")})]}),S.jsxs("button",{type:"button",className:"composer__tool",onClick:()=>{g()},disabled:!p||!H,title:s("prompt.useCurrentTitle"),children:[S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S.jsx("polyline",{points:"23 4 23 10 17 10"}),S.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]}),S.jsx("span",{children:s("prompt.useCurrent")})]}),E&&S.jsxs("button",{type:"button",className:`composer__tool${C?" composer__tool--on":""}`,onClick:()=>x(!0),title:s("prompt.styleTitle"),"aria-label":s("prompt.styleTitle"),"aria-pressed":C,children:[S.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S.jsx("circle",{cx:"12",cy:"12",r:"9"}),S.jsx("circle",{cx:"8",cy:"10",r:"1",fill:"currentColor"}),S.jsx("circle",{cx:"12",cy:"8",r:"1",fill:"currentColor"}),S.jsx("circle",{cx:"16",cy:"10",r:"1",fill:"currentColor"}),S.jsx("path",{d:"M14 14c2 0 3 1 3 3 0 1-1 2-2 2-2 0-3-2-5-2"})]}),S.jsx("span",{children:s("prompt.style")})]}),S.jsxs("button",{type:"button",className:`composer__tool${A==="direct"?" composer__tool--on":""}`,onClick:()=>M(A==="direct"?"auto":"direct"),title:s("prompt.directModeTitle"),"aria-label":s("prompt.directModeTitle"),"aria-pressed":A==="direct",children:[S.jsx("span",{"aria-hidden":"true",style:{fontWeight:700,fontSize:11},children:"1:1"}),S.jsx("span",{children:s("prompt.directMode")})]}),S.jsx("span",{className:"composer__hint",children:s("prompt.hint")})]}),m&&S.jsx("div",{className:"composer__dropzone","aria-hidden":"true",children:s("prompt.dropHere",{max:Fi})}),S.jsx("input",{ref:h,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:B=>{const Z=Array.from(B.target.files??[]);Z.length>0&&u(Z),B.target.value=""}}),S.jsx(r0,{open:y,onClose:()=>x(!1)})]})}function b2(){const n=ae(u=>u.activeGenerations),i=ae(u=>u.generate),{t:o}=Ve(),s=n>0,r=s?o("generate.buttonLoading",{n}):o("generate.button");return S.jsx("button",{type:"button",className:`generate-btn${s?" loading":""}`,onClick:()=>{i()},children:r})}function x2(n,i=28){const o=n.trim().replace(/\s+/g," ");return o.length>i?`${o.slice(0,i)}...`:o}function Bp(){const n=ae(s=>s.inFlight),{t:i}=Ve(),o={queued:i("inflight.queued"),streaming:i("inflight.streaming"),decoding:i("inflight.decoding")};return n.length===0?null:S.jsx("ul",{className:"in-flight-list",children:n.map(s=>{const r=s.phase?o[s.phase]??s.phase:i("inflight.queued");return S.jsxs("li",{className:"in-flight-item","data-phase":s.phase??"queued",children:[S.jsx("span",{className:"in-flight-prompt",children:x2(s.prompt)}),S.jsx("span",{className:"in-flight-phase",children:r}),S.jsx("span",{className:"in-flight-spinner","aria-hidden":"true"})]},s.id)})})}function _2(){const n=ae(u=>u.history),i=ae(u=>u.currentImage),o=ae(u=>u.selectHistory),s=ae(u=>u.openGallery),{t:r}=Ve();return S.jsxs("div",{className:"history-strip",children:[S.jsx("button",{type:"button",className:"history-thumb history-thumb--add",onClick:s,"aria-label":r("history.openGalleryAria"),title:r("history.openGalleryTitle"),children:S.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[S.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),S.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),S.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),S.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}),n.map((u,f)=>{const g=u.filename?i?.filename===u.filename:i?.image===u.image;return S.jsx("img",{src:u.thumb||u.url||u.image,alt:"",className:`history-thumb${g?" active":""}`,onClick:()=>o(u)},u.filename??`${f}-${u.image}`)})]})}function w2(){const{t:n}=Ve(),i=ae(y=>y.sessions),o=ae(y=>y.activeSessionId),s=ae(y=>y.switchSession),r=ae(y=>y.createAndSwitchSession),u=ae(y=>y.renameCurrentSession),f=ae(y=>y.deleteSessionById),[g,p]=V.useState(!1),h=i.find(y=>y.id===o),m=()=>{const y=window.prompt(n("session.renamePrompt"),h?.title??n("session.newSession"));y&&y.trim()&&u(y.trim())},v=(y,x)=>{window.confirm(n("session.deleteConfirm",{title:x}))&&f(y)};return S.jsxs("div",{className:"session-picker",children:[S.jsxs("div",{className:"session-picker-row",children:[S.jsxs("button",{type:"button",className:"session-current",onClick:()=>p(y=>!y),title:n("session.switchTitle"),children:[S.jsx("span",{className:"session-title",children:h?.title??n("session.loading")}),S.jsx("span",{className:"session-caret",children:g?"▴":"▾"})]}),S.jsx("button",{type:"button",className:"session-btn",onClick:()=>{r(n("session.newSession"))},title:n("session.newSessionTitle"),children:"+"}),S.jsx("button",{type:"button",className:"session-btn",onClick:m,title:n("session.renameTitle"),disabled:!h,children:"✎"})]}),g&&S.jsxs("ul",{className:"session-list",children:[i.map(y=>S.jsxs("li",{className:y.id===o?"is-active":"",children:[S.jsxs("button",{type:"button",className:"session-item",onClick:()=>{p(!1),s(y.id)},children:[S.jsx("span",{className:"session-item-title",children:y.title}),S.jsx("span",{className:"session-item-count",children:y.nodeCount})]}),S.jsx("button",{type:"button",className:"session-del",onClick:()=>v(y.id,y.title),title:n("session.deleteTitle"),children:"×"})]},y.id)),i.length===0&&S.jsx("li",{className:"session-empty",children:n("session.empty")})]})]})}function E2(){const{t:n}=Ve(),i=ae(u=>u.activeSessionId),o=ae(u=>u.styleSheetEnabled),[s,r]=V.useState(!1);return i?S.jsxs(S.Fragment,{children:[S.jsx("button",{type:"button",className:`btn btn--secondary btn--sm${o?" is-on":""}`,onClick:()=>r(!0),"aria-pressed":o,title:n("prompt.styleTitle"),children:n("prompt.style")}),S.jsx(r0,{open:s,onClose:()=>r(!1)})]}):null}function N2(){const{t:n}=Ve(),i=ae(s=>s.settingsOpen),o=ae(s=>s.toggleSettings);return S.jsx("button",{type:"button",className:`settings-button${i?" is-active":""}`,onClick:o,"aria-label":n("settings.openAria"),"aria-pressed":i,title:n("settings.openTitle"),children:S.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[S.jsx("path",{d:"M12 8.2a3.8 3.8 0 1 0 0 7.6 3.8 3.8 0 0 0 0-7.6Zm0 5.7a1.9 1.9 0 1 1 0-3.8 1.9 1.9 0 0 1 0 3.8Z"}),S.jsx("path",{d:"m20.3 13.4.1-1.4-.1-1.4-2.2-.5a6.9 6.9 0 0 0-.6-1.3l1.2-1.9a9.6 9.6 0 0 0-2-2l-1.9 1.2c-.4-.2-.9-.4-1.3-.6L13 3.3a9.5 9.5 0 0 0-2.8 0l-.5 2.2c-.5.2-.9.3-1.3.6L6.5 4.9a9.6 9.6 0 0 0-2 2l1.2 1.9c-.2.4-.4.9-.6 1.3l-2.2.5a9.5 9.5 0 0 0 0 2.8l2.2.5c.2.5.3.9.6 1.3l-1.2 1.9a9.6 9.6 0 0 0 2 2l1.9-1.2c.4.2.9.4 1.3.6l.5 2.2a9.5 9.5 0 0 0 2.8 0l.5-2.2c.5-.2.9-.3 1.3-.6l1.9 1.2a9.6 9.6 0 0 0 2-2l-1.2-1.9c.2-.4.4-.9.6-1.3l2.2-.5Z"})]})})}function c0({variant:n}){const{t:i}=Ve(),[o,s]=V.useState(!1),r=V.useRef(null),u=ae(m=>m.imageModel),f=ae(m=>m.setImageModel),g=n==="settings"?"settings-image-model":"sidebar-image-model",p=Pi.find(m=>m.value===u)??Pi[0],h=m=>{f(m.target.value)};return V.useEffect(()=>{if(n!=="sidebar"||!o)return;const m=y=>{const x=y.target;x instanceof Node&&(r.current?.contains(x)||s(!1))},v=y=>{y.key==="Escape"&&s(!1)};return document.addEventListener("pointerdown",m),document.addEventListener("keydown",v),()=>{document.removeEventListener("pointerdown",m),document.removeEventListener("keydown",v)}},[o,n]),n==="sidebar"?S.jsxs("div",{ref:r,className:"image-model-select image-model-select--sidebar",children:[S.jsx("button",{id:g,type:"button",className:"image-model-select__trigger","aria-haspopup":"listbox","aria-expanded":o,"aria-label":i("sidebar.imageModelAria"),onClick:()=>s(m=>!m),children:p.shortLabel}),o?S.jsx("div",{className:"image-model-select__menu",role:"listbox","aria-label":i("sidebar.imageModelAria"),children:Pi.map(m=>S.jsxs("button",{type:"button",className:`image-model-select__item${m.value===u?" is-active":""}`,role:"option","aria-selected":m.value===u,onClick:()=>{f(m.value),s(!1)},children:[S.jsx("span",{children:m.shortLabel}),S.jsx("small",{children:i(m.fullLabelKey)})]},m.value))}):null]}):S.jsx("div",{className:"image-model-select image-model-select--settings",children:S.jsxs("select",{id:g,value:u,onChange:h,children:[Pi.map(m=>S.jsx("option",{value:m.value,children:i(m.fullLabelKey)},m.value)),i2.map(m=>S.jsx("option",{value:m.value,disabled:!0,children:i(m.fullLabelKey)},m.value))]})})}function T2(){const{t:n}=Ve(),i=ae(f=>f.uiMode),o=ae(f=>f.referenceImages),s=ae(f=>f.clearReferences),r=ae(f=>f.styleSheetEnabled),u=i;return S.jsxs("aside",{className:"sidebar",children:[S.jsxs("div",{className:"sidebar__scroll",children:[S.jsxs("div",{className:"logo",children:[S.jsx("div",{className:"logo-mark","aria-hidden":"true"}),S.jsxs("div",{className:"logo-copy",children:[S.jsx("div",{className:"logo-title",children:"ima2-gen"}),S.jsx("div",{className:"logo-subtitle",children:"gpt-image-2 studio"})]}),S.jsxs("div",{className:"logo-actions",children:[S.jsx(c0,{variant:"sidebar"}),S.jsx(N2,{})]})]}),S.jsx(v2,{}),u==="classic"?S.jsxs(S.Fragment,{children:[S.jsx(S2,{}),S.jsx(b2,{}),S.jsx(Bp,{})]}):S.jsxs(S.Fragment,{children:[S.jsx(w2,{}),S.jsx(E2,{}),o.length>0?S.jsxs("div",{className:"node-mode-ref-warning",role:"status",children:[S.jsx("strong",{children:n("node.classicRefsParkedTitle")}),S.jsx("span",{children:n("node.classicRefsParkedBody")}),S.jsx("button",{type:"button",onClick:s,children:n("node.clearParkedRefs")})]}):null,r?S.jsx("div",{className:"node-mode-style-badge",role:"status",children:n("node.styleSheetActive")}):null,S.jsx("div",{className:"sidebar__node-hint",children:n("sidebar.nodeModeHint")}),S.jsx(Bp,{})]})]}),S.jsx(_2,{})]})}function A2(){const{t:n}=Ve(),i=ae(p=>p.currentImage),o=ae(p=>p.showToast),s=ae(p=>p.setPrompt);if(!i)return null;const r=()=>{const p=document.createElement("a");p.href=i.image,p.download=i.filename||"generated.png",p.click()},u=async()=>{try{const h=await(await fetch(i.image)).blob();await navigator.clipboard.write([new ClipboardItem({[h.type]:h})]),o(n("toast.imageCopied"))}catch{o(n("toast.copyFailed"),!0)}},f=()=>{i.prompt&&(navigator.clipboard.writeText(i.prompt),o(n("toast.promptCopied")))},g=async()=>{if(!i.prompt){o(n("toast.noPromptToFork"),!0);return}s(i.prompt);try{await ae.getState().useCurrentAsReference()}catch{}const p=document.querySelector('textarea[name="prompt"], textarea#prompt, .sidebar textarea');p&&(p.focus(),p.setSelectionRange(p.value.length,p.value.length)),o(n("toast.forkStarted"))};return S.jsxs("div",{className:"result-actions",children:[S.jsx("button",{type:"button",className:"action-btn",onClick:r,children:n("result.download")}),S.jsx("button",{type:"button",className:"action-btn",onClick:u,children:n("result.copyImage")}),S.jsx("button",{type:"button",className:"action-btn",onClick:f,children:n("result.copyPrompt")}),S.jsx("button",{type:"button",className:"action-btn action-btn--primary",onClick:g,title:n("result.continueHereTitle"),children:n("result.continueHere")})]})}function C2(n){return n==="low"?"l":n==="medium"?"m":n==="high"?"h":n??null}function M2(n){if(!n)return null;const i=n.match(/^(\d+)x\1$/);return i?`${i[1]}²`:n.replace("x","×")}function z2(){const n=ae(m=>m.currentImage),i=ae(m=>m.activeGenerations),o=ae(m=>m.quality),s=ae(m=>m.getResolvedSize),r=ae(m=>m.showToast),{t:u}=Ve(),f=()=>{n?.prompt&&(navigator.clipboard.writeText(n.prompt),r(u("toast.promptCopied")))},g=C2(n?.quality??o),p=M2(n?.size??s()),h=Wy(n?.model);return S.jsxs("main",{className:"canvas",children:[S.jsx("div",{className:`progress-bar${i>0?" active":""}`}),n?S.jsxs("div",{className:"result-container visible",children:[S.jsx("img",{className:"result-img",src:n.url??n.image,alt:u("canvas.resultAlt")},n.filename??n.url??n.image),n.prompt?S.jsx("div",{className:"result-prompt",onClick:f,children:n.prompt}):null,S.jsx("div",{className:"result-meta",children:[n.elapsed!=null?`${n.elapsed}s`:null,n.usage?u("canvas.tokens",{n:n.usage.total_tokens??"?"}):null,g,p,h,n.provider??null].filter(m=>!!m).join(" · ")}),S.jsx(A2,{})]}):null]})}function ot(n){if(typeof n=="string"||typeof n=="number")return""+n;let i="";if(Array.isArray(n))for(let o=0,s;o<n.length;o++)(s=ot(n[o]))!==""&&(i+=(i&&" ")+s);else for(let o in n)n[o]&&(i+=(i&&" ")+o);return i}var D2={value:()=>{}};function Lr(){for(var n=0,i=arguments.length,o={},s;n<i;++n){if(!(s=arguments[n]+"")||s in o||/[\s.]/.test(s))throw new Error("illegal type: "+s);o[s]=[]}return new br(o)}function br(n){this._=n}function R2(n,i){return n.trim().split(/^|\s+/).map(function(o){var s="",r=o.indexOf(".");if(r>=0&&(s=o.slice(r+1),o=o.slice(0,r)),o&&!i.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:s}})}br.prototype=Lr.prototype={constructor:br,on:function(n,i){var o=this._,s=R2(n+"",o),r,u=-1,f=s.length;if(arguments.length<2){for(;++u<f;)if((r=(n=s[u]).type)&&(r=j2(o[r],n.name)))return r;return}if(i!=null&&typeof i!="function")throw new Error("invalid callback: "+i);for(;++u<f;)if(r=(n=s[u]).type)o[r]=Ip(o[r],n.name,i);else if(i==null)for(r in o)o[r]=Ip(o[r],n.name,null);return this},copy:function(){var n={},i=this._;for(var o in i)n[o]=i[o].slice();return new br(n)},call:function(n,i){if((r=arguments.length-2)>0)for(var o=new Array(r),s=0,r,u;s<r;++s)o[s]=arguments[s+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(u=this._[n],s=0,r=u.length;s<r;++s)u[s].value.apply(i,o)},apply:function(n,i,o){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var s=this._[n],r=0,u=s.length;r<u;++r)s[r].value.apply(i,o)}};function j2(n,i){for(var o=0,s=n.length,r;o<s;++o)if((r=n[o]).name===i)return r.value}function Ip(n,i,o){for(var s=0,r=n.length;s<r;++s)if(n[s].name===i){n[s]=D2,n=n.slice(0,s).concat(n.slice(s+1));break}return o!=null&&n.push({name:i,value:o}),n}var kd="http://www.w3.org/1999/xhtml";const qp={svg:"http://www.w3.org/2000/svg",xhtml:kd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ur(n){var i=n+="",o=i.indexOf(":");return o>=0&&(i=n.slice(0,o))!=="xmlns"&&(n=n.slice(o+1)),qp.hasOwnProperty(i)?{space:qp[i],local:n}:n}function O2(n){return function(){var i=this.ownerDocument,o=this.namespaceURI;return o===kd&&i.documentElement.namespaceURI===kd?i.createElement(n):i.createElementNS(o,n)}}function H2(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function u0(n){var i=Ur(n);return(i.local?H2:O2)(i)}function L2(){}function af(n){return n==null?L2:function(){return this.querySelector(n)}}function U2(n){typeof n!="function"&&(n=af(n));for(var i=this._groups,o=i.length,s=new Array(o),r=0;r<o;++r)for(var u=i[r],f=u.length,g=s[r]=new Array(f),p,h,m=0;m<f;++m)(p=u[m])&&(h=n.call(p,p.__data__,m,u))&&("__data__"in p&&(h.__data__=p.__data__),g[m]=h);return new It(s,this._parents)}function B2(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function I2(){return[]}function d0(n){return n==null?I2:function(){return this.querySelectorAll(n)}}function q2(n){return function(){return B2(n.apply(this,arguments))}}function G2(n){typeof n=="function"?n=q2(n):n=d0(n);for(var i=this._groups,o=i.length,s=[],r=[],u=0;u<o;++u)for(var f=i[u],g=f.length,p,h=0;h<g;++h)(p=f[h])&&(s.push(n.call(p,p.__data__,h,f)),r.push(p));return new It(s,r)}function f0(n){return function(){return this.matches(n)}}function h0(n){return function(i){return i.matches(n)}}var k2=Array.prototype.find;function Y2(n){return function(){return k2.call(this.children,n)}}function V2(){return this.firstElementChild}function X2(n){return this.select(n==null?V2:Y2(typeof n=="function"?n:h0(n)))}var Z2=Array.prototype.filter;function $2(){return Array.from(this.children)}function K2(n){return function(){return Z2.call(this.children,n)}}function Q2(n){return this.selectAll(n==null?$2:K2(typeof n=="function"?n:h0(n)))}function F2(n){typeof n!="function"&&(n=f0(n));for(var i=this._groups,o=i.length,s=new Array(o),r=0;r<o;++r)for(var u=i[r],f=u.length,g=s[r]=[],p,h=0;h<f;++h)(p=u[h])&&n.call(p,p.__data__,h,u)&&g.push(p);return new It(s,this._parents)}function g0(n){return new Array(n.length)}function J2(){return new It(this._enter||this._groups.map(g0),this._parents)}function Nr(n,i){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=i}Nr.prototype={constructor:Nr,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,i){return this._parent.insertBefore(n,i)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function P2(n){return function(){return n}}function W2(n,i,o,s,r,u){for(var f=0,g,p=i.length,h=u.length;f<h;++f)(g=i[f])?(g.__data__=u[f],s[f]=g):o[f]=new Nr(n,u[f]);for(;f<p;++f)(g=i[f])&&(r[f]=g)}function e_(n,i,o,s,r,u,f){var g,p,h=new Map,m=i.length,v=u.length,y=new Array(m),x;for(g=0;g<m;++g)(p=i[g])&&(y[g]=x=f.call(p,p.__data__,g,i)+"",h.has(x)?r[g]=p:h.set(x,p));for(g=0;g<v;++g)x=f.call(n,u[g],g,u)+"",(p=h.get(x))?(s[g]=p,p.__data__=u[g],h.delete(x)):o[g]=new Nr(n,u[g]);for(g=0;g<m;++g)(p=i[g])&&h.get(y[g])===p&&(r[g]=p)}function t_(n){return n.__data__}function n_(n,i){if(!arguments.length)return Array.from(this,t_);var o=i?e_:W2,s=this._parents,r=this._groups;typeof n!="function"&&(n=P2(n));for(var u=r.length,f=new Array(u),g=new Array(u),p=new Array(u),h=0;h<u;++h){var m=s[h],v=r[h],y=v.length,x=a_(n.call(m,m&&m.__data__,h,s)),E=x.length,C=g[h]=new Array(E),A=f[h]=new Array(E),M=p[h]=new Array(y);o(m,v,C,A,M,x,i);for(var H=0,_=0,z,Y;H<E;++H)if(z=C[H]){for(H>=_&&(_=H+1);!(Y=A[_])&&++_<E;);z._next=Y||null}}return f=new It(f,s),f._enter=g,f._exit=p,f}function a_(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function i_(){return new It(this._exit||this._groups.map(g0),this._parents)}function l_(n,i,o){var s=this.enter(),r=this,u=this.exit();return typeof n=="function"?(s=n(s),s&&(s=s.selection())):s=s.append(n+""),i!=null&&(r=i(r),r&&(r=r.selection())),o==null?u.remove():o(u),s&&r?s.merge(r).order():r}function o_(n){for(var i=n.selection?n.selection():n,o=this._groups,s=i._groups,r=o.length,u=s.length,f=Math.min(r,u),g=new Array(r),p=0;p<f;++p)for(var h=o[p],m=s[p],v=h.length,y=g[p]=new Array(v),x,E=0;E<v;++E)(x=h[E]||m[E])&&(y[E]=x);for(;p<r;++p)g[p]=o[p];return new It(g,this._parents)}function s_(){for(var n=this._groups,i=-1,o=n.length;++i<o;)for(var s=n[i],r=s.length-1,u=s[r],f;--r>=0;)(f=s[r])&&(u&&f.compareDocumentPosition(u)^4&&u.parentNode.insertBefore(f,u),u=f);return this}function r_(n){n||(n=c_);function i(v,y){return v&&y?n(v.__data__,y.__data__):!v-!y}for(var o=this._groups,s=o.length,r=new Array(s),u=0;u<s;++u){for(var f=o[u],g=f.length,p=r[u]=new Array(g),h,m=0;m<g;++m)(h=f[m])&&(p[m]=h);p.sort(i)}return new It(r,this._parents).order()}function c_(n,i){return n<i?-1:n>i?1:n>=i?0:NaN}function u_(){var n=arguments[0];return arguments[0]=this,n.apply(null,arguments),this}function d_(){return Array.from(this)}function f_(){for(var n=this._groups,i=0,o=n.length;i<o;++i)for(var s=n[i],r=0,u=s.length;r<u;++r){var f=s[r];if(f)return f}return null}function h_(){let n=0;for(const i of this)++n;return n}function g_(){return!this.node()}function m_(n){for(var i=this._groups,o=0,s=i.length;o<s;++o)for(var r=i[o],u=0,f=r.length,g;u<f;++u)(g=r[u])&&n.call(g,g.__data__,u,r);return this}function p_(n){return function(){this.removeAttribute(n)}}function y_(n){return function(){this.removeAttributeNS(n.space,n.local)}}function v_(n,i){return function(){this.setAttribute(n,i)}}function S_(n,i){return function(){this.setAttributeNS(n.space,n.local,i)}}function b_(n,i){return function(){var o=i.apply(this,arguments);o==null?this.removeAttribute(n):this.setAttribute(n,o)}}function x_(n,i){return function(){var o=i.apply(this,arguments);o==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,o)}}function __(n,i){var o=Ur(n);if(arguments.length<2){var s=this.node();return o.local?s.getAttributeNS(o.space,o.local):s.getAttribute(o)}return this.each((i==null?o.local?y_:p_:typeof i=="function"?o.local?x_:b_:o.local?S_:v_)(o,i))}function m0(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function w_(n){return function(){this.style.removeProperty(n)}}function E_(n,i,o){return function(){this.style.setProperty(n,i,o)}}function N_(n,i,o){return function(){var s=i.apply(this,arguments);s==null?this.style.removeProperty(n):this.style.setProperty(n,s,o)}}function T_(n,i,o){return arguments.length>1?this.each((i==null?w_:typeof i=="function"?N_:E_)(n,i,o??"")):ol(this.node(),n)}function ol(n,i){return n.style.getPropertyValue(i)||m0(n).getComputedStyle(n,null).getPropertyValue(i)}function A_(n){return function(){delete this[n]}}function C_(n,i){return function(){this[n]=i}}function M_(n,i){return function(){var o=i.apply(this,arguments);o==null?delete this[n]:this[n]=o}}function z_(n,i){return arguments.length>1?this.each((i==null?A_:typeof i=="function"?M_:C_)(n,i)):this.node()[n]}function p0(n){return n.trim().split(/^|\s+/)}function lf(n){return n.classList||new y0(n)}function y0(n){this._node=n,this._names=p0(n.getAttribute("class")||"")}y0.prototype={add:function(n){var i=this._names.indexOf(n);i<0&&(this._names.push(n),this._node.setAttribute("class",this._names.join(" ")))},remove:function(n){var i=this._names.indexOf(n);i>=0&&(this._names.splice(i,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};function v0(n,i){for(var o=lf(n),s=-1,r=i.length;++s<r;)o.add(i[s])}function S0(n,i){for(var o=lf(n),s=-1,r=i.length;++s<r;)o.remove(i[s])}function D_(n){return function(){v0(this,n)}}function R_(n){return function(){S0(this,n)}}function j_(n,i){return function(){(i.apply(this,arguments)?v0:S0)(this,n)}}function O_(n,i){var o=p0(n+"");if(arguments.length<2){for(var s=lf(this.node()),r=-1,u=o.length;++r<u;)if(!s.contains(o[r]))return!1;return!0}return this.each((typeof i=="function"?j_:i?D_:R_)(o,i))}function H_(){this.textContent=""}function L_(n){return function(){this.textContent=n}}function U_(n){return function(){var i=n.apply(this,arguments);this.textContent=i??""}}function B_(n){return arguments.length?this.each(n==null?H_:(typeof n=="function"?U_:L_)(n)):this.node().textContent}function I_(){this.innerHTML=""}function q_(n){return function(){this.innerHTML=n}}function G_(n){return function(){var i=n.apply(this,arguments);this.innerHTML=i??""}}function k_(n){return arguments.length?this.each(n==null?I_:(typeof n=="function"?G_:q_)(n)):this.node().innerHTML}function Y_(){this.nextSibling&&this.parentNode.appendChild(this)}function V_(){return this.each(Y_)}function X_(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Z_(){return this.each(X_)}function $_(n){var i=typeof n=="function"?n:u0(n);return this.select(function(){return this.appendChild(i.apply(this,arguments))})}function K_(){return null}function Q_(n,i){var o=typeof n=="function"?n:u0(n),s=i==null?K_:typeof i=="function"?i:af(i);return this.select(function(){return this.insertBefore(o.apply(this,arguments),s.apply(this,arguments)||null)})}function F_(){var n=this.parentNode;n&&n.removeChild(this)}function J_(){return this.each(F_)}function P_(){var n=this.cloneNode(!1),i=this.parentNode;return i?i.insertBefore(n,this.nextSibling):n}function W_(){var n=this.cloneNode(!0),i=this.parentNode;return i?i.insertBefore(n,this.nextSibling):n}function ew(n){return this.select(n?W_:P_)}function tw(n){return arguments.length?this.property("__data__",n):this.node().__data__}function nw(n){return function(i){n.call(this,i,this.__data__)}}function aw(n){return n.trim().split(/^|\s+/).map(function(i){var o="",s=i.indexOf(".");return s>=0&&(o=i.slice(s+1),i=i.slice(0,s)),{type:i,name:o}})}function iw(n){return function(){var i=this.__on;if(i){for(var o=0,s=-1,r=i.length,u;o<r;++o)u=i[o],(!n.type||u.type===n.type)&&u.name===n.name?this.removeEventListener(u.type,u.listener,u.options):i[++s]=u;++s?i.length=s:delete this.__on}}}function lw(n,i,o){return function(){var s=this.__on,r,u=nw(i);if(s){for(var f=0,g=s.length;f<g;++f)if((r=s[f]).type===n.type&&r.name===n.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=u,r.options=o),r.value=i;return}}this.addEventListener(n.type,u,o),r={type:n.type,name:n.name,value:i,listener:u,options:o},s?s.push(r):this.__on=[r]}}function ow(n,i,o){var s=aw(n+""),r,u=s.length,f;if(arguments.length<2){var g=this.node().__on;if(g){for(var p=0,h=g.length,m;p<h;++p)for(r=0,m=g[p];r<u;++r)if((f=s[r]).type===m.type&&f.name===m.name)return m.value}return}for(g=i?lw:iw,r=0;r<u;++r)this.each(g(s[r],i,o));return this}function b0(n,i,o){var s=m0(n),r=s.CustomEvent;typeof r=="function"?r=new r(i,o):(r=s.document.createEvent("Event"),o?(r.initEvent(i,o.bubbles,o.cancelable),r.detail=o.detail):r.initEvent(i,!1,!1)),n.dispatchEvent(r)}function sw(n,i){return function(){return b0(this,n,i)}}function rw(n,i){return function(){return b0(this,n,i.apply(this,arguments))}}function cw(n,i){return this.each((typeof i=="function"?rw:sw)(n,i))}function*uw(){for(var n=this._groups,i=0,o=n.length;i<o;++i)for(var s=n[i],r=0,u=s.length,f;r<u;++r)(f=s[r])&&(yield f)}var x0=[null];function It(n,i){this._groups=n,this._parents=i}function Do(){return new It([[document.documentElement]],x0)}function dw(){return this}It.prototype=Do.prototype={constructor:It,select:U2,selectAll:G2,selectChild:X2,selectChildren:Q2,filter:F2,data:n_,enter:J2,exit:i_,join:l_,merge:o_,selection:dw,order:s_,sort:r_,call:u_,nodes:d_,node:f_,size:h_,empty:g_,each:m_,attr:__,style:T_,property:z_,classed:O_,text:B_,html:k_,raise:V_,lower:Z_,append:$_,insert:Q_,remove:J_,clone:ew,datum:tw,on:ow,dispatch:cw,[Symbol.iterator]:uw};function Bt(n){return typeof n=="string"?new It([[document.querySelector(n)]],[document.documentElement]):new It([[n]],x0)}function fw(n){let i;for(;i=n.sourceEvent;)n=i;return n}function en(n,i){if(n=fw(n),i===void 0&&(i=n.currentTarget),i){var o=i.ownerSVGElement||i;if(o.createSVGPoint){var s=o.createSVGPoint();return s.x=n.clientX,s.y=n.clientY,s=s.matrixTransform(i.getScreenCTM().inverse()),[s.x,s.y]}if(i.getBoundingClientRect){var r=i.getBoundingClientRect();return[n.clientX-r.left-i.clientLeft,n.clientY-r.top-i.clientTop]}}return[n.pageX,n.pageY]}const hw={passive:!1},xo={capture:!0,passive:!1};function Td(n){n.stopImmediatePropagation()}function nl(n){n.preventDefault(),n.stopImmediatePropagation()}function _0(n){var i=n.document.documentElement,o=Bt(n).on("dragstart.drag",nl,xo);"onselectstart"in i?o.on("selectstart.drag",nl,xo):(i.__noselect=i.style.MozUserSelect,i.style.MozUserSelect="none")}function w0(n,i){var o=n.document.documentElement,s=Bt(n).on("dragstart.drag",null);i&&(s.on("click.drag",nl,xo),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in o?s.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const cr=n=>()=>n;function Yd(n,{sourceEvent:i,subject:o,target:s,identifier:r,active:u,x:f,y:g,dx:p,dy:h,dispatch:m}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:i,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:u,enumerable:!0,configurable:!0},x:{value:f,enumerable:!0,configurable:!0},y:{value:g,enumerable:!0,configurable:!0},dx:{value:p,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:m}})}Yd.prototype.on=function(){var n=this._.on.apply(this._,arguments);return n===this._?this:n};function gw(n){return!n.ctrlKey&&!n.button}function mw(){return this.parentNode}function pw(n,i){return i??{x:n.x,y:n.y}}function yw(){return navigator.maxTouchPoints||"ontouchstart"in this}function E0(){var n=gw,i=mw,o=pw,s=yw,r={},u=Lr("start","drag","end"),f=0,g,p,h,m,v=0;function y(z){z.on("mousedown.drag",x).filter(s).on("touchstart.drag",A).on("touchmove.drag",M,hw).on("touchend.drag touchcancel.drag",H).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(z,Y){if(!(m||!n.call(this,z,Y))){var O=_(this,i.call(this,z,Y),z,Y,"mouse");O&&(Bt(z.view).on("mousemove.drag",E,xo).on("mouseup.drag",C,xo),_0(z.view),Td(z),h=!1,g=z.clientX,p=z.clientY,O("start",z))}}function E(z){if(nl(z),!h){var Y=z.clientX-g,O=z.clientY-p;h=Y*Y+O*O>v}r.mouse("drag",z)}function C(z){Bt(z.view).on("mousemove.drag mouseup.drag",null),w0(z.view,h),nl(z),r.mouse("end",z)}function A(z,Y){if(n.call(this,z,Y)){var O=z.changedTouches,I=i.call(this,z,Y),B=O.length,Z,oe;for(Z=0;Z<B;++Z)(oe=_(this,I,z,Y,O[Z].identifier,O[Z]))&&(Td(z),oe("start",z,O[Z]))}}function M(z){var Y=z.changedTouches,O=Y.length,I,B;for(I=0;I<O;++I)(B=r[Y[I].identifier])&&(nl(z),B("drag",z,Y[I]))}function H(z){var Y=z.changedTouches,O=Y.length,I,B;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),I=0;I<O;++I)(B=r[Y[I].identifier])&&(Td(z),B("end",z,Y[I]))}function _(z,Y,O,I,B,Z){var oe=u.copy(),$=en(Z||O,Y),ee,se,D;if((D=o.call(z,new Yd("beforestart",{sourceEvent:O,target:y,identifier:B,active:f,x:$[0],y:$[1],dx:0,dy:0,dispatch:oe}),I))!=null)return ee=D.x-$[0]||0,se=D.y-$[1]||0,function k(T,U,G){var R=$,F;switch(T){case"start":r[B]=k,F=f++;break;case"end":delete r[B],--f;case"drag":$=en(G||U,Y),F=f;break}oe.call(T,z,new Yd(T,{sourceEvent:U,subject:D,target:y,identifier:B,active:F,x:$[0]+ee,y:$[1]+se,dx:$[0]-R[0],dy:$[1]-R[1],dispatch:oe}),I)}}return y.filter=function(z){return arguments.length?(n=typeof z=="function"?z:cr(!!z),y):n},y.container=function(z){return arguments.length?(i=typeof z=="function"?z:cr(z),y):i},y.subject=function(z){return arguments.length?(o=typeof z=="function"?z:cr(z),y):o},y.touchable=function(z){return arguments.length?(s=typeof z=="function"?z:cr(!!z),y):s},y.on=function(){var z=u.on.apply(u,arguments);return z===u?y:z},y.clickDistance=function(z){return arguments.length?(v=(z=+z)*z,y):Math.sqrt(v)},y}function of(n,i,o){n.prototype=i.prototype=o,o.constructor=n}function N0(n,i){var o=Object.create(n.prototype);for(var s in i)o[s]=i[s];return o}function Ro(){}var _o=.7,Tr=1/_o,al="\\s*([+-]?\\d+)\\s*",wo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",gn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vw=/^#([0-9a-f]{3,8})$/,Sw=new RegExp(`^rgb\\(${al},${al},${al}\\)$`),bw=new RegExp(`^rgb\\(${gn},${gn},${gn}\\)$`),xw=new RegExp(`^rgba\\(${al},${al},${al},${wo}\\)$`),_w=new RegExp(`^rgba\\(${gn},${gn},${gn},${wo}\\)$`),ww=new RegExp(`^hsl\\(${wo},${gn},${gn}\\)$`),Ew=new RegExp(`^hsla\\(${wo},${gn},${gn},${wo}\\)$`),Gp={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};of(Ro,ai,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:kp,formatHex:kp,formatHex8:Nw,formatHsl:Tw,formatRgb:Yp,toString:Yp});function kp(){return this.rgb().formatHex()}function Nw(){return this.rgb().formatHex8()}function Tw(){return T0(this).formatHsl()}function Yp(){return this.rgb().formatRgb()}function ai(n){var i,o;return n=(n+"").trim().toLowerCase(),(i=vw.exec(n))?(o=i[1].length,i=parseInt(i[1],16),o===6?Vp(i):o===3?new Mt(i>>8&15|i>>4&240,i>>4&15|i&240,(i&15)<<4|i&15,1):o===8?ur(i>>24&255,i>>16&255,i>>8&255,(i&255)/255):o===4?ur(i>>12&15|i>>8&240,i>>8&15|i>>4&240,i>>4&15|i&240,((i&15)<<4|i&15)/255):null):(i=Sw.exec(n))?new Mt(i[1],i[2],i[3],1):(i=bw.exec(n))?new Mt(i[1]*255/100,i[2]*255/100,i[3]*255/100,1):(i=xw.exec(n))?ur(i[1],i[2],i[3],i[4]):(i=_w.exec(n))?ur(i[1]*255/100,i[2]*255/100,i[3]*255/100,i[4]):(i=ww.exec(n))?$p(i[1],i[2]/100,i[3]/100,1):(i=Ew.exec(n))?$p(i[1],i[2]/100,i[3]/100,i[4]):Gp.hasOwnProperty(n)?Vp(Gp[n]):n==="transparent"?new Mt(NaN,NaN,NaN,0):null}function Vp(n){return new Mt(n>>16&255,n>>8&255,n&255,1)}function ur(n,i,o,s){return s<=0&&(n=i=o=NaN),new Mt(n,i,o,s)}function Aw(n){return n instanceof Ro||(n=ai(n)),n?(n=n.rgb(),new Mt(n.r,n.g,n.b,n.opacity)):new Mt}function Vd(n,i,o,s){return arguments.length===1?Aw(n):new Mt(n,i,o,s??1)}function Mt(n,i,o,s){this.r=+n,this.g=+i,this.b=+o,this.opacity=+s}of(Mt,Vd,N0(Ro,{brighter(n){return n=n==null?Tr:Math.pow(Tr,n),new Mt(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?_o:Math.pow(_o,n),new Mt(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new Mt(ti(this.r),ti(this.g),ti(this.b),Ar(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:Xp,formatHex:Xp,formatHex8:Cw,formatRgb:Zp,toString:Zp}));function Xp(){return`#${ei(this.r)}${ei(this.g)}${ei(this.b)}`}function Cw(){return`#${ei(this.r)}${ei(this.g)}${ei(this.b)}${ei((isNaN(this.opacity)?1:this.opacity)*255)}`}function Zp(){const n=Ar(this.opacity);return`${n===1?"rgb(":"rgba("}${ti(this.r)}, ${ti(this.g)}, ${ti(this.b)}${n===1?")":`, ${n})`}`}function Ar(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function ti(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function ei(n){return n=ti(n),(n<16?"0":"")+n.toString(16)}function $p(n,i,o,s){return s<=0?n=i=o=NaN:o<=0||o>=1?n=i=NaN:i<=0&&(n=NaN),new tn(n,i,o,s)}function T0(n){if(n instanceof tn)return new tn(n.h,n.s,n.l,n.opacity);if(n instanceof Ro||(n=ai(n)),!n)return new tn;if(n instanceof tn)return n;n=n.rgb();var i=n.r/255,o=n.g/255,s=n.b/255,r=Math.min(i,o,s),u=Math.max(i,o,s),f=NaN,g=u-r,p=(u+r)/2;return g?(i===u?f=(o-s)/g+(o<s)*6:o===u?f=(s-i)/g+2:f=(i-o)/g+4,g/=p<.5?u+r:2-u-r,f*=60):g=p>0&&p<1?0:f,new tn(f,g,p,n.opacity)}function Mw(n,i,o,s){return arguments.length===1?T0(n):new tn(n,i,o,s??1)}function tn(n,i,o,s){this.h=+n,this.s=+i,this.l=+o,this.opacity=+s}of(tn,Mw,N0(Ro,{brighter(n){return n=n==null?Tr:Math.pow(Tr,n),new tn(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?_o:Math.pow(_o,n),new tn(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,i=isNaN(n)||isNaN(this.s)?0:this.s,o=this.l,s=o+(o<.5?o:1-o)*i,r=2*o-s;return new Mt(Ad(n>=240?n-240:n+120,r,s),Ad(n,r,s),Ad(n<120?n+240:n-120,r,s),this.opacity)},clamp(){return new tn(Kp(this.h),dr(this.s),dr(this.l),Ar(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 n=Ar(this.opacity);return`${n===1?"hsl(":"hsla("}${Kp(this.h)}, ${dr(this.s)*100}%, ${dr(this.l)*100}%${n===1?")":`, ${n})`}`}}));function Kp(n){return n=(n||0)%360,n<0?n+360:n}function dr(n){return Math.max(0,Math.min(1,n||0))}function Ad(n,i,o){return(n<60?i+(o-i)*n/60:n<180?o:n<240?i+(o-i)*(240-n)/60:i)*255}const sf=n=>()=>n;function zw(n,i){return function(o){return n+o*i}}function Dw(n,i,o){return n=Math.pow(n,o),i=Math.pow(i,o)-n,o=1/o,function(s){return Math.pow(n+s*i,o)}}function Rw(n){return(n=+n)==1?A0:function(i,o){return o-i?Dw(i,o,n):sf(isNaN(i)?o:i)}}function A0(n,i){var o=i-n;return o?zw(n,o):sf(isNaN(n)?i:n)}const Cr=(function n(i){var o=Rw(i);function s(r,u){var f=o((r=Vd(r)).r,(u=Vd(u)).r),g=o(r.g,u.g),p=o(r.b,u.b),h=A0(r.opacity,u.opacity);return function(m){return r.r=f(m),r.g=g(m),r.b=p(m),r.opacity=h(m),r+""}}return s.gamma=n,s})(1);function jw(n,i){i||(i=[]);var o=n?Math.min(i.length,n.length):0,s=i.slice(),r;return function(u){for(r=0;r<o;++r)s[r]=n[r]*(1-u)+i[r]*u;return s}}function Ow(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Hw(n,i){var o=i?i.length:0,s=n?Math.min(o,n.length):0,r=new Array(s),u=new Array(o),f;for(f=0;f<s;++f)r[f]=So(n[f],i[f]);for(;f<o;++f)u[f]=i[f];return function(g){for(f=0;f<s;++f)u[f]=r[f](g);return u}}function Lw(n,i){var o=new Date;return n=+n,i=+i,function(s){return o.setTime(n*(1-s)+i*s),o}}function fn(n,i){return n=+n,i=+i,function(o){return n*(1-o)+i*o}}function Uw(n,i){var o={},s={},r;(n===null||typeof n!="object")&&(n={}),(i===null||typeof i!="object")&&(i={});for(r in i)r in n?o[r]=So(n[r],i[r]):s[r]=i[r];return function(u){for(r in o)s[r]=o[r](u);return s}}var Xd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Cd=new RegExp(Xd.source,"g");function Bw(n){return function(){return n}}function Iw(n){return function(i){return n(i)+""}}function C0(n,i){var o=Xd.lastIndex=Cd.lastIndex=0,s,r,u,f=-1,g=[],p=[];for(n=n+"",i=i+"";(s=Xd.exec(n))&&(r=Cd.exec(i));)(u=r.index)>o&&(u=i.slice(o,u),g[f]?g[f]+=u:g[++f]=u),(s=s[0])===(r=r[0])?g[f]?g[f]+=r:g[++f]=r:(g[++f]=null,p.push({i:f,x:fn(s,r)})),o=Cd.lastIndex;return o<i.length&&(u=i.slice(o),g[f]?g[f]+=u:g[++f]=u),g.length<2?p[0]?Iw(p[0].x):Bw(i):(i=p.length,function(h){for(var m=0,v;m<i;++m)g[(v=p[m]).i]=v.x(h);return g.join("")})}function So(n,i){var o=typeof i,s;return i==null||o==="boolean"?sf(i):(o==="number"?fn:o==="string"?(s=ai(i))?(i=s,Cr):C0:i instanceof ai?Cr:i instanceof Date?Lw:Ow(i)?jw:Array.isArray(i)?Hw:typeof i.valueOf!="function"&&typeof i.toString!="function"||isNaN(i)?Uw:fn)(n,i)}var Qp=180/Math.PI,Zd={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function M0(n,i,o,s,r,u){var f,g,p;return(f=Math.sqrt(n*n+i*i))&&(n/=f,i/=f),(p=n*o+i*s)&&(o-=n*p,s-=i*p),(g=Math.sqrt(o*o+s*s))&&(o/=g,s/=g,p/=g),n*s<i*o&&(n=-n,i=-i,p=-p,f=-f),{translateX:r,translateY:u,rotate:Math.atan2(i,n)*Qp,skewX:Math.atan(p)*Qp,scaleX:f,scaleY:g}}var fr;function qw(n){const i=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(n+"");return i.isIdentity?Zd:M0(i.a,i.b,i.c,i.d,i.e,i.f)}function Gw(n){return n==null||(fr||(fr=document.createElementNS("http://www.w3.org/2000/svg","g")),fr.setAttribute("transform",n),!(n=fr.transform.baseVal.consolidate()))?Zd:(n=n.matrix,M0(n.a,n.b,n.c,n.d,n.e,n.f))}function z0(n,i,o,s){function r(h){return h.length?h.pop()+" ":""}function u(h,m,v,y,x,E){if(h!==v||m!==y){var C=x.push("translate(",null,i,null,o);E.push({i:C-4,x:fn(h,v)},{i:C-2,x:fn(m,y)})}else(v||y)&&x.push("translate("+v+i+y+o)}function f(h,m,v,y){h!==m?(h-m>180?m+=360:m-h>180&&(h+=360),y.push({i:v.push(r(v)+"rotate(",null,s)-2,x:fn(h,m)})):m&&v.push(r(v)+"rotate("+m+s)}function g(h,m,v,y){h!==m?y.push({i:v.push(r(v)+"skewX(",null,s)-2,x:fn(h,m)}):m&&v.push(r(v)+"skewX("+m+s)}function p(h,m,v,y,x,E){if(h!==v||m!==y){var C=x.push(r(x)+"scale(",null,",",null,")");E.push({i:C-4,x:fn(h,v)},{i:C-2,x:fn(m,y)})}else(v!==1||y!==1)&&x.push(r(x)+"scale("+v+","+y+")")}return function(h,m){var v=[],y=[];return h=n(h),m=n(m),u(h.translateX,h.translateY,m.translateX,m.translateY,v,y),f(h.rotate,m.rotate,v,y),g(h.skewX,m.skewX,v,y),p(h.scaleX,h.scaleY,m.scaleX,m.scaleY,v,y),h=m=null,function(x){for(var E=-1,C=y.length,A;++E<C;)v[(A=y[E]).i]=A.x(x);return v.join("")}}}var kw=z0(qw,"px, ","px)","deg)"),Yw=z0(Gw,", ",")",")"),Vw=1e-12;function Fp(n){return((n=Math.exp(n))+1/n)/2}function Xw(n){return((n=Math.exp(n))-1/n)/2}function Zw(n){return((n=Math.exp(2*n))-1)/(n+1)}const xr=(function n(i,o,s){function r(u,f){var g=u[0],p=u[1],h=u[2],m=f[0],v=f[1],y=f[2],x=m-g,E=v-p,C=x*x+E*E,A,M;if(C<Vw)M=Math.log(y/h)/i,A=function(I){return[g+I*x,p+I*E,h*Math.exp(i*I*M)]};else{var H=Math.sqrt(C),_=(y*y-h*h+s*C)/(2*h*o*H),z=(y*y-h*h-s*C)/(2*y*o*H),Y=Math.log(Math.sqrt(_*_+1)-_),O=Math.log(Math.sqrt(z*z+1)-z);M=(O-Y)/i,A=function(I){var B=I*M,Z=Fp(Y),oe=h/(o*H)*(Z*Zw(i*B+Y)-Xw(Y));return[g+oe*x,p+oe*E,h*Z/Fp(i*B+Y)]}}return A.duration=M*1e3*i/Math.SQRT2,A}return r.rho=function(u){var f=Math.max(.001,+u),g=f*f,p=g*g;return n(f,g,p)},r})(Math.SQRT2,2,4);var sl=0,po=0,co=0,D0=1e3,Mr,yo,zr=0,ii=0,Br=0,Eo=typeof performance=="object"&&performance.now?performance:Date,R0=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function rf(){return ii||(R0($w),ii=Eo.now()+Br)}function $w(){ii=0}function Dr(){this._call=this._time=this._next=null}Dr.prototype=j0.prototype={constructor:Dr,restart:function(n,i,o){if(typeof n!="function")throw new TypeError("callback is not a function");o=(o==null?rf():+o)+(i==null?0:+i),!this._next&&yo!==this&&(yo?yo._next=this:Mr=this,yo=this),this._call=n,this._time=o,$d()},stop:function(){this._call&&(this._call=null,this._time=1/0,$d())}};function j0(n,i,o){var s=new Dr;return s.restart(n,i,o),s}function Kw(){rf(),++sl;for(var n=Mr,i;n;)(i=ii-n._time)>=0&&n._call.call(void 0,i),n=n._next;--sl}function Jp(){ii=(zr=Eo.now())+Br,sl=po=0;try{Kw()}finally{sl=0,Fw(),ii=0}}function Qw(){var n=Eo.now(),i=n-zr;i>D0&&(Br-=i,zr=n)}function Fw(){for(var n,i=Mr,o,s=1/0;i;)i._call?(s>i._time&&(s=i._time),n=i,i=i._next):(o=i._next,i._next=null,i=n?n._next=o:Mr=o);yo=n,$d(s)}function $d(n){if(!sl){po&&(po=clearTimeout(po));var i=n-ii;i>24?(n<1/0&&(po=setTimeout(Jp,n-Eo.now()-Br)),co&&(co=clearInterval(co))):(co||(zr=Eo.now(),co=setInterval(Qw,D0)),sl=1,R0(Jp))}}function Pp(n,i,o){var s=new Dr;return i=i==null?0:+i,s.restart(r=>{s.stop(),n(r+i)},i,o),s}var Jw=Lr("start","end","cancel","interrupt"),Pw=[],O0=0,Wp=1,Kd=2,_r=3,ey=4,Qd=5,wr=6;function Ir(n,i,o,s,r,u){var f=n.__transition;if(!f)n.__transition={};else if(o in f)return;Ww(n,o,{name:i,index:s,group:r,on:Jw,tween:Pw,time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null,state:O0})}function cf(n,i){var o=ln(n,i);if(o.state>O0)throw new Error("too late; already scheduled");return o}function pn(n,i){var o=ln(n,i);if(o.state>_r)throw new Error("too late; already running");return o}function ln(n,i){var o=n.__transition;if(!o||!(o=o[i]))throw new Error("transition not found");return o}function Ww(n,i,o){var s=n.__transition,r;s[i]=o,o.timer=j0(u,0,o.time);function u(h){o.state=Wp,o.timer.restart(f,o.delay,o.time),o.delay<=h&&f(h-o.delay)}function f(h){var m,v,y,x;if(o.state!==Wp)return p();for(m in s)if(x=s[m],x.name===o.name){if(x.state===_r)return Pp(f);x.state===ey?(x.state=wr,x.timer.stop(),x.on.call("interrupt",n,n.__data__,x.index,x.group),delete s[m]):+m<i&&(x.state=wr,x.timer.stop(),x.on.call("cancel",n,n.__data__,x.index,x.group),delete s[m])}if(Pp(function(){o.state===_r&&(o.state=ey,o.timer.restart(g,o.delay,o.time),g(h))}),o.state=Kd,o.on.call("start",n,n.__data__,o.index,o.group),o.state===Kd){for(o.state=_r,r=new Array(y=o.tween.length),m=0,v=-1;m<y;++m)(x=o.tween[m].value.call(n,n.__data__,o.index,o.group))&&(r[++v]=x);r.length=v+1}}function g(h){for(var m=h<o.duration?o.ease.call(null,h/o.duration):(o.timer.restart(p),o.state=Qd,1),v=-1,y=r.length;++v<y;)r[v].call(n,m);o.state===Qd&&(o.on.call("end",n,n.__data__,o.index,o.group),p())}function p(){o.state=wr,o.timer.stop(),delete s[i];for(var h in s)return;delete n.__transition}}function Er(n,i){var o=n.__transition,s,r,u=!0,f;if(o){i=i==null?null:i+"";for(f in o){if((s=o[f]).name!==i){u=!1;continue}r=s.state>Kd&&s.state<Qd,s.state=wr,s.timer.stop(),s.on.call(r?"interrupt":"cancel",n,n.__data__,s.index,s.group),delete o[f]}u&&delete n.__transition}}function eE(n){return this.each(function(){Er(this,n)})}function tE(n,i){var o,s;return function(){var r=pn(this,n),u=r.tween;if(u!==o){s=o=u;for(var f=0,g=s.length;f<g;++f)if(s[f].name===i){s=s.slice(),s.splice(f,1);break}}r.tween=s}}function nE(n,i,o){var s,r;if(typeof o!="function")throw new Error;return function(){var u=pn(this,n),f=u.tween;if(f!==s){r=(s=f).slice();for(var g={name:i,value:o},p=0,h=r.length;p<h;++p)if(r[p].name===i){r[p]=g;break}p===h&&r.push(g)}u.tween=r}}function aE(n,i){var o=this._id;if(n+="",arguments.length<2){for(var s=ln(this.node(),o).tween,r=0,u=s.length,f;r<u;++r)if((f=s[r]).name===n)return f.value;return null}return this.each((i==null?tE:nE)(o,n,i))}function uf(n,i,o){var s=n._id;return n.each(function(){var r=pn(this,s);(r.value||(r.value={}))[i]=o.apply(this,arguments)}),function(r){return ln(r,s).value[i]}}function H0(n,i){var o;return(typeof i=="number"?fn:i instanceof ai?Cr:(o=ai(i))?(i=o,Cr):C0)(n,i)}function iE(n){return function(){this.removeAttribute(n)}}function lE(n){return function(){this.removeAttributeNS(n.space,n.local)}}function oE(n,i,o){var s,r=o+"",u;return function(){var f=this.getAttribute(n);return f===r?null:f===s?u:u=i(s=f,o)}}function sE(n,i,o){var s,r=o+"",u;return function(){var f=this.getAttributeNS(n.space,n.local);return f===r?null:f===s?u:u=i(s=f,o)}}function rE(n,i,o){var s,r,u;return function(){var f,g=o(this),p;return g==null?void this.removeAttribute(n):(f=this.getAttribute(n),p=g+"",f===p?null:f===s&&p===r?u:(r=p,u=i(s=f,g)))}}function cE(n,i,o){var s,r,u;return function(){var f,g=o(this),p;return g==null?void this.removeAttributeNS(n.space,n.local):(f=this.getAttributeNS(n.space,n.local),p=g+"",f===p?null:f===s&&p===r?u:(r=p,u=i(s=f,g)))}}function uE(n,i){var o=Ur(n),s=o==="transform"?Yw:H0;return this.attrTween(n,typeof i=="function"?(o.local?cE:rE)(o,s,uf(this,"attr."+n,i)):i==null?(o.local?lE:iE)(o):(o.local?sE:oE)(o,s,i))}function dE(n,i){return function(o){this.setAttribute(n,i.call(this,o))}}function fE(n,i){return function(o){this.setAttributeNS(n.space,n.local,i.call(this,o))}}function hE(n,i){var o,s;function r(){var u=i.apply(this,arguments);return u!==s&&(o=(s=u)&&fE(n,u)),o}return r._value=i,r}function gE(n,i){var o,s;function r(){var u=i.apply(this,arguments);return u!==s&&(o=(s=u)&&dE(n,u)),o}return r._value=i,r}function mE(n,i){var o="attr."+n;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(i==null)return this.tween(o,null);if(typeof i!="function")throw new Error;var s=Ur(n);return this.tween(o,(s.local?hE:gE)(s,i))}function pE(n,i){return function(){cf(this,n).delay=+i.apply(this,arguments)}}function yE(n,i){return i=+i,function(){cf(this,n).delay=i}}function vE(n){var i=this._id;return arguments.length?this.each((typeof n=="function"?pE:yE)(i,n)):ln(this.node(),i).delay}function SE(n,i){return function(){pn(this,n).duration=+i.apply(this,arguments)}}function bE(n,i){return i=+i,function(){pn(this,n).duration=i}}function xE(n){var i=this._id;return arguments.length?this.each((typeof n=="function"?SE:bE)(i,n)):ln(this.node(),i).duration}function _E(n,i){if(typeof i!="function")throw new Error;return function(){pn(this,n).ease=i}}function wE(n){var i=this._id;return arguments.length?this.each(_E(i,n)):ln(this.node(),i).ease}function EE(n,i){return function(){var o=i.apply(this,arguments);if(typeof o!="function")throw new Error;pn(this,n).ease=o}}function NE(n){if(typeof n!="function")throw new Error;return this.each(EE(this._id,n))}function TE(n){typeof n!="function"&&(n=f0(n));for(var i=this._groups,o=i.length,s=new Array(o),r=0;r<o;++r)for(var u=i[r],f=u.length,g=s[r]=[],p,h=0;h<f;++h)(p=u[h])&&n.call(p,p.__data__,h,u)&&g.push(p);return new Yn(s,this._parents,this._name,this._id)}function AE(n){if(n._id!==this._id)throw new Error;for(var i=this._groups,o=n._groups,s=i.length,r=o.length,u=Math.min(s,r),f=new Array(s),g=0;g<u;++g)for(var p=i[g],h=o[g],m=p.length,v=f[g]=new Array(m),y,x=0;x<m;++x)(y=p[x]||h[x])&&(v[x]=y);for(;g<s;++g)f[g]=i[g];return new Yn(f,this._parents,this._name,this._id)}function CE(n){return(n+"").trim().split(/^|\s+/).every(function(i){var o=i.indexOf(".");return o>=0&&(i=i.slice(0,o)),!i||i==="start"})}function ME(n,i,o){var s,r,u=CE(i)?cf:pn;return function(){var f=u(this,n),g=f.on;g!==s&&(r=(s=g).copy()).on(i,o),f.on=r}}function zE(n,i){var o=this._id;return arguments.length<2?ln(this.node(),o).on.on(n):this.each(ME(o,n,i))}function DE(n){return function(){var i=this.parentNode;for(var o in this.__transition)if(+o!==n)return;i&&i.removeChild(this)}}function RE(){return this.on("end.remove",DE(this._id))}function jE(n){var i=this._name,o=this._id;typeof n!="function"&&(n=af(n));for(var s=this._groups,r=s.length,u=new Array(r),f=0;f<r;++f)for(var g=s[f],p=g.length,h=u[f]=new Array(p),m,v,y=0;y<p;++y)(m=g[y])&&(v=n.call(m,m.__data__,y,g))&&("__data__"in m&&(v.__data__=m.__data__),h[y]=v,Ir(h[y],i,o,y,h,ln(m,o)));return new Yn(u,this._parents,i,o)}function OE(n){var i=this._name,o=this._id;typeof n!="function"&&(n=d0(n));for(var s=this._groups,r=s.length,u=[],f=[],g=0;g<r;++g)for(var p=s[g],h=p.length,m,v=0;v<h;++v)if(m=p[v]){for(var y=n.call(m,m.__data__,v,p),x,E=ln(m,o),C=0,A=y.length;C<A;++C)(x=y[C])&&Ir(x,i,o,C,y,E);u.push(y),f.push(m)}return new Yn(u,f,i,o)}var HE=Do.prototype.constructor;function LE(){return new HE(this._groups,this._parents)}function UE(n,i){var o,s,r;return function(){var u=ol(this,n),f=(this.style.removeProperty(n),ol(this,n));return u===f?null:u===o&&f===s?r:r=i(o=u,s=f)}}function L0(n){return function(){this.style.removeProperty(n)}}function BE(n,i,o){var s,r=o+"",u;return function(){var f=ol(this,n);return f===r?null:f===s?u:u=i(s=f,o)}}function IE(n,i,o){var s,r,u;return function(){var f=ol(this,n),g=o(this),p=g+"";return g==null&&(p=g=(this.style.removeProperty(n),ol(this,n))),f===p?null:f===s&&p===r?u:(r=p,u=i(s=f,g))}}function qE(n,i){var o,s,r,u="style."+i,f="end."+u,g;return function(){var p=pn(this,n),h=p.on,m=p.value[u]==null?g||(g=L0(i)):void 0;(h!==o||r!==m)&&(s=(o=h).copy()).on(f,r=m),p.on=s}}function GE(n,i,o){var s=(n+="")=="transform"?kw:H0;return i==null?this.styleTween(n,UE(n,s)).on("end.style."+n,L0(n)):typeof i=="function"?this.styleTween(n,IE(n,s,uf(this,"style."+n,i))).each(qE(this._id,n)):this.styleTween(n,BE(n,s,i),o).on("end.style."+n,null)}function kE(n,i,o){return function(s){this.style.setProperty(n,i.call(this,s),o)}}function YE(n,i,o){var s,r;function u(){var f=i.apply(this,arguments);return f!==r&&(s=(r=f)&&kE(n,f,o)),s}return u._value=i,u}function VE(n,i,o){var s="style."+(n+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(i==null)return this.tween(s,null);if(typeof i!="function")throw new Error;return this.tween(s,YE(n,i,o??""))}function XE(n){return function(){this.textContent=n}}function ZE(n){return function(){var i=n(this);this.textContent=i??""}}function $E(n){return this.tween("text",typeof n=="function"?ZE(uf(this,"text",n)):XE(n==null?"":n+""))}function KE(n){return function(i){this.textContent=n.call(this,i)}}function QE(n){var i,o;function s(){var r=n.apply(this,arguments);return r!==o&&(i=(o=r)&&KE(r)),i}return s._value=n,s}function FE(n){var i="text";if(arguments.length<1)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,QE(n))}function JE(){for(var n=this._name,i=this._id,o=U0(),s=this._groups,r=s.length,u=0;u<r;++u)for(var f=s[u],g=f.length,p,h=0;h<g;++h)if(p=f[h]){var m=ln(p,i);Ir(p,n,o,h,f,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new Yn(s,this._parents,n,o)}function PE(){var n,i,o=this,s=o._id,r=o.size();return new Promise(function(u,f){var g={value:f},p={value:function(){--r===0&&u()}};o.each(function(){var h=pn(this,s),m=h.on;m!==n&&(i=(n=m).copy(),i._.cancel.push(g),i._.interrupt.push(g),i._.end.push(p)),h.on=i}),r===0&&u()})}var WE=0;function Yn(n,i,o,s){this._groups=n,this._parents=i,this._name=o,this._id=s}function U0(){return++WE}var qn=Do.prototype;Yn.prototype={constructor:Yn,select:jE,selectAll:OE,selectChild:qn.selectChild,selectChildren:qn.selectChildren,filter:TE,merge:AE,selection:LE,transition:JE,call:qn.call,nodes:qn.nodes,node:qn.node,size:qn.size,empty:qn.empty,each:qn.each,on:zE,attr:uE,attrTween:mE,style:GE,styleTween:VE,text:$E,textTween:FE,remove:RE,tween:aE,delay:vE,duration:xE,ease:wE,easeVarying:NE,end:PE,[Symbol.iterator]:qn[Symbol.iterator]};function eN(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var tN={time:null,delay:0,duration:250,ease:eN};function nN(n,i){for(var o;!(o=n.__transition)||!(o=o[i]);)if(!(n=n.parentNode))throw new Error(`transition ${i} not found`);return o}function aN(n){var i,o;n instanceof Yn?(i=n._id,n=n._name):(i=U0(),(o=tN).time=rf(),n=n==null?null:n+"");for(var s=this._groups,r=s.length,u=0;u<r;++u)for(var f=s[u],g=f.length,p,h=0;h<g;++h)(p=f[h])&&Ir(p,n,i,h,f,o||nN(p,i));return new Yn(s,this._parents,n,i)}Do.prototype.interrupt=eE;Do.prototype.transition=aN;const hr=n=>()=>n;function iN(n,{sourceEvent:i,target:o,transform:s,dispatch:r}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:i,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:r}})}function kn(n,i,o){this.k=n,this.x=i,this.y=o}kn.prototype={constructor:kn,scale:function(n){return n===1?this:new kn(this.k*n,this.x,this.y)},translate:function(n,i){return n===0&i===0?this:new kn(this.k,this.x+this.k*n,this.y+this.k*i)},apply:function(n){return[n[0]*this.k+this.x,n[1]*this.k+this.y]},applyX:function(n){return n*this.k+this.x},applyY:function(n){return n*this.k+this.y},invert:function(n){return[(n[0]-this.x)/this.k,(n[1]-this.y)/this.k]},invertX:function(n){return(n-this.x)/this.k},invertY:function(n){return(n-this.y)/this.k},rescaleX:function(n){return n.copy().domain(n.range().map(this.invertX,this).map(n.invert,n))},rescaleY:function(n){return n.copy().domain(n.range().map(this.invertY,this).map(n.invert,n))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var qr=new kn(1,0,0);B0.prototype=kn.prototype;function B0(n){for(;!n.__zoom;)if(!(n=n.parentNode))return qr;return n.__zoom}function Md(n){n.stopImmediatePropagation()}function uo(n){n.preventDefault(),n.stopImmediatePropagation()}function lN(n){return(!n.ctrlKey||n.type==="wheel")&&!n.button}function oN(){var n=this;return n instanceof SVGElement?(n=n.ownerSVGElement||n,n.hasAttribute("viewBox")?(n=n.viewBox.baseVal,[[n.x,n.y],[n.x+n.width,n.y+n.height]]):[[0,0],[n.width.baseVal.value,n.height.baseVal.value]]):[[0,0],[n.clientWidth,n.clientHeight]]}function ty(){return this.__zoom||qr}function sN(n){return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*(n.ctrlKey?10:1)}function rN(){return navigator.maxTouchPoints||"ontouchstart"in this}function cN(n,i,o){var s=n.invertX(i[0][0])-o[0][0],r=n.invertX(i[1][0])-o[1][0],u=n.invertY(i[0][1])-o[0][1],f=n.invertY(i[1][1])-o[1][1];return n.translate(r>s?(s+r)/2:Math.min(0,s)||Math.max(0,r),f>u?(u+f)/2:Math.min(0,u)||Math.max(0,f))}function I0(){var n=lN,i=oN,o=cN,s=sN,r=rN,u=[0,1/0],f=[[-1/0,-1/0],[1/0,1/0]],g=250,p=xr,h=Lr("start","zoom","end"),m,v,y,x=500,E=150,C=0,A=10;function M(D){D.property("__zoom",ty).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",Z).on("dblclick.zoom",oe).filter(r).on("touchstart.zoom",$).on("touchmove.zoom",ee).on("touchend.zoom touchcancel.zoom",se).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}M.transform=function(D,k,T,U){var G=D.selection?D.selection():D;G.property("__zoom",ty),D!==G?Y(D,k,T,U):G.interrupt().each(function(){O(this,arguments).event(U).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},M.scaleBy=function(D,k,T,U){M.scaleTo(D,function(){var G=this.__zoom.k,R=typeof k=="function"?k.apply(this,arguments):k;return G*R},T,U)},M.scaleTo=function(D,k,T,U){M.transform(D,function(){var G=i.apply(this,arguments),R=this.__zoom,F=T==null?z(G):typeof T=="function"?T.apply(this,arguments):T,N=R.invert(F),j=typeof k=="function"?k.apply(this,arguments):k;return o(_(H(R,j),F,N),G,f)},T,U)},M.translateBy=function(D,k,T,U){M.transform(D,function(){return o(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof T=="function"?T.apply(this,arguments):T),i.apply(this,arguments),f)},null,U)},M.translateTo=function(D,k,T,U,G){M.transform(D,function(){var R=i.apply(this,arguments),F=this.__zoom,N=U==null?z(R):typeof U=="function"?U.apply(this,arguments):U;return o(qr.translate(N[0],N[1]).scale(F.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof T=="function"?-T.apply(this,arguments):-T),R,f)},U,G)};function H(D,k){return k=Math.max(u[0],Math.min(u[1],k)),k===D.k?D:new kn(k,D.x,D.y)}function _(D,k,T){var U=k[0]-T[0]*D.k,G=k[1]-T[1]*D.k;return U===D.x&&G===D.y?D:new kn(D.k,U,G)}function z(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function Y(D,k,T,U){D.on("start.zoom",function(){O(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(U).end()}).tween("zoom",function(){var G=this,R=arguments,F=O(G,R).event(U),N=i.apply(G,R),j=T==null?z(N):typeof T=="function"?T.apply(G,R):T,W=Math.max(N[1][0]-N[0][0],N[1][1]-N[0][1]),te=G.__zoom,ce=typeof k=="function"?k.apply(G,R):k,de=p(te.invert(j).concat(W/te.k),ce.invert(j).concat(W/ce.k));return function(ue){if(ue===1)ue=ce;else{var re=de(ue),fe=W/re[2];ue=new kn(fe,j[0]-re[0]*fe,j[1]-re[1]*fe)}F.zoom(null,ue)}})}function O(D,k,T){return!T&&D.__zooming||new I(D,k)}function I(D,k){this.that=D,this.args=k,this.active=0,this.sourceEvent=null,this.extent=i.apply(D,k),this.taps=0}I.prototype={event:function(D){return D&&(this.sourceEvent=D),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(D,k){return this.mouse&&D!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&D!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(D){var k=Bt(this.that).datum();h.call(D,this.that,new iN(D,{sourceEvent:this.sourceEvent,target:M,transform:this.that.__zoom,dispatch:h}),k)}};function B(D,...k){if(!n.apply(this,arguments))return;var T=O(this,k).event(D),U=this.__zoom,G=Math.max(u[0],Math.min(u[1],U.k*Math.pow(2,s.apply(this,arguments)))),R=en(D);if(T.wheel)(T.mouse[0][0]!==R[0]||T.mouse[0][1]!==R[1])&&(T.mouse[1]=U.invert(T.mouse[0]=R)),clearTimeout(T.wheel);else{if(U.k===G)return;T.mouse=[R,U.invert(R)],Er(this),T.start()}uo(D),T.wheel=setTimeout(F,E),T.zoom("mouse",o(_(H(U,G),T.mouse[0],T.mouse[1]),T.extent,f));function F(){T.wheel=null,T.end()}}function Z(D,...k){if(y||!n.apply(this,arguments))return;var T=D.currentTarget,U=O(this,k,!0).event(D),G=Bt(D.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",W,!0),R=en(D,T),F=D.clientX,N=D.clientY;_0(D.view),Md(D),U.mouse=[R,this.__zoom.invert(R)],Er(this),U.start();function j(te){if(uo(te),!U.moved){var ce=te.clientX-F,de=te.clientY-N;U.moved=ce*ce+de*de>C}U.event(te).zoom("mouse",o(_(U.that.__zoom,U.mouse[0]=en(te,T),U.mouse[1]),U.extent,f))}function W(te){G.on("mousemove.zoom mouseup.zoom",null),w0(te.view,U.moved),uo(te),U.event(te).end()}}function oe(D,...k){if(n.apply(this,arguments)){var T=this.__zoom,U=en(D.changedTouches?D.changedTouches[0]:D,this),G=T.invert(U),R=T.k*(D.shiftKey?.5:2),F=o(_(H(T,R),U,G),i.apply(this,k),f);uo(D),g>0?Bt(this).transition().duration(g).call(Y,F,U,D):Bt(this).call(M.transform,F,U,D)}}function $(D,...k){if(n.apply(this,arguments)){var T=D.touches,U=T.length,G=O(this,k,D.changedTouches.length===U).event(D),R,F,N,j;for(Md(D),F=0;F<U;++F)N=T[F],j=en(N,this),j=[j,this.__zoom.invert(j),N.identifier],G.touch0?!G.touch1&&G.touch0[2]!==j[2]&&(G.touch1=j,G.taps=0):(G.touch0=j,R=!0,G.taps=1+!!m);m&&(m=clearTimeout(m)),R&&(G.taps<2&&(v=j[0],m=setTimeout(function(){m=null},x)),Er(this),G.start())}}function ee(D,...k){if(this.__zooming){var T=O(this,k).event(D),U=D.changedTouches,G=U.length,R,F,N,j;for(uo(D),R=0;R<G;++R)F=U[R],N=en(F,this),T.touch0&&T.touch0[2]===F.identifier?T.touch0[0]=N:T.touch1&&T.touch1[2]===F.identifier&&(T.touch1[0]=N);if(F=T.that.__zoom,T.touch1){var W=T.touch0[0],te=T.touch0[1],ce=T.touch1[0],de=T.touch1[1],ue=(ue=ce[0]-W[0])*ue+(ue=ce[1]-W[1])*ue,re=(re=de[0]-te[0])*re+(re=de[1]-te[1])*re;F=H(F,Math.sqrt(ue/re)),N=[(W[0]+ce[0])/2,(W[1]+ce[1])/2],j=[(te[0]+de[0])/2,(te[1]+de[1])/2]}else if(T.touch0)N=T.touch0[0],j=T.touch0[1];else return;T.zoom("touch",o(_(F,N,j),T.extent,f))}}function se(D,...k){if(this.__zooming){var T=O(this,k).event(D),U=D.changedTouches,G=U.length,R,F;for(Md(D),y&&clearTimeout(y),y=setTimeout(function(){y=null},x),R=0;R<G;++R)F=U[R],T.touch0&&T.touch0[2]===F.identifier?delete T.touch0:T.touch1&&T.touch1[2]===F.identifier&&delete T.touch1;if(T.touch1&&!T.touch0&&(T.touch0=T.touch1,delete T.touch1),T.touch0)T.touch0[1]=this.__zoom.invert(T.touch0[0]);else if(T.end(),T.taps===2&&(F=en(F,this),Math.hypot(v[0]-F[0],v[1]-F[1])<A)){var N=Bt(this).on("dblclick.zoom");N&&N.apply(this,arguments)}}}return M.wheelDelta=function(D){return arguments.length?(s=typeof D=="function"?D:hr(+D),M):s},M.filter=function(D){return arguments.length?(n=typeof D=="function"?D:hr(!!D),M):n},M.touchable=function(D){return arguments.length?(r=typeof D=="function"?D:hr(!!D),M):r},M.extent=function(D){return arguments.length?(i=typeof D=="function"?D:hr([[+D[0][0],+D[0][1]],[+D[1][0],+D[1][1]]]),M):i},M.scaleExtent=function(D){return arguments.length?(u[0]=+D[0],u[1]=+D[1],M):[u[0],u[1]]},M.translateExtent=function(D){return arguments.length?(f[0][0]=+D[0][0],f[1][0]=+D[1][0],f[0][1]=+D[0][1],f[1][1]=+D[1][1],M):[[f[0][0],f[0][1]],[f[1][0],f[1][1]]]},M.constrain=function(D){return arguments.length?(o=D,M):o},M.duration=function(D){return arguments.length?(g=+D,M):g},M.interpolate=function(D){return arguments.length?(p=D,M):p},M.on=function(){var D=h.on.apply(h,arguments);return D===h?M:D},M.clickDistance=function(D){return arguments.length?(C=(D=+D)*D,M):Math.sqrt(C)},M.tapDistance=function(D){return arguments.length?(A=+D,M):A},M}const mn={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:n=>`Node type "${n}" 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:n=>`The old edge with id=${n} does not exist.`,error009:n=>`Marker type "${n}" doesn't exist.`,error008:(n,{id:i,sourceHandle:o,targetHandle:s})=>`Couldn't create edge for ${n} handle id: "${n==="source"?o:s}", edge id: ${i}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:n=>`Edge type "${n}" not found. Using fallback type "default".`,error012:n=>`Node with id "${n}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(n="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${n}/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."},No=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],q0=["Enter"," ","Escape"],G0={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:n,x:i,y:o})=>`Moved selected node ${n}. New position, x: ${i}, y: ${o}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var rl;(function(n){n.Strict="strict",n.Loose="loose"})(rl||(rl={}));var ni;(function(n){n.Free="free",n.Vertical="vertical",n.Horizontal="horizontal"})(ni||(ni={}));var To;(function(n){n.Partial="partial",n.Full="full"})(To||(To={}));const k0={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var wa;(function(n){n.Bezier="default",n.Straight="straight",n.Step="step",n.SmoothStep="smoothstep",n.SimpleBezier="simplebezier"})(wa||(wa={}));var Rr;(function(n){n.Arrow="arrow",n.ArrowClosed="arrowclosed"})(Rr||(Rr={}));var me;(function(n){n.Left="left",n.Top="top",n.Right="right",n.Bottom="bottom"})(me||(me={}));const ny={[me.Left]:me.Right,[me.Right]:me.Left,[me.Top]:me.Bottom,[me.Bottom]:me.Top};function Y0(n){return n===null?null:n?"valid":"invalid"}const V0=n=>"id"in n&&"source"in n&&"target"in n,uN=n=>"id"in n&&"position"in n&&!("source"in n)&&!("target"in n),df=n=>"id"in n&&"internals"in n&&!("source"in n)&&!("target"in n),jo=(n,i=[0,0])=>{const{width:o,height:s}=Vn(n),r=n.origin??i,u=o*r[0],f=s*r[1];return{x:n.position.x-u,y:n.position.y-f}},dN=(n,i={nodeOrigin:[0,0]})=>{if(n.length===0)return{x:0,y:0,width:0,height:0};const o=n.reduce((s,r)=>{const u=typeof r=="string";let f=!i.nodeLookup&&!u?r:void 0;i.nodeLookup&&(f=u?i.nodeLookup.get(r):df(r)?r:i.nodeLookup.get(r.id));const g=f?jr(f,i.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Gr(s,g)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return kr(o)},Oo=(n,i={})=>{let o={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return n.forEach(r=>{(i.filter===void 0||i.filter(r))&&(o=Gr(o,jr(r)),s=!0)}),s?kr(o):{x:0,y:0,width:0,height:0}},ff=(n,i,[o,s,r]=[0,0,1],u=!1,f=!1)=>{const g={...Lo(i,[o,s,r]),width:i.width/r,height:i.height/r},p=[];for(const h of n.values()){const{measured:m,selectable:v=!0,hidden:y=!1}=h;if(f&&!v||y)continue;const x=m.width??h.width??h.initialWidth??null,E=m.height??h.height??h.initialHeight??null,C=Ao(g,ul(h)),A=(x??0)*(E??0),M=u&&C>0;(!h.internals.handleBounds||M||C>=A||h.dragging)&&p.push(h)}return p},fN=(n,i)=>{const o=new Set;return n.forEach(s=>{o.add(s.id)}),i.filter(s=>o.has(s.source)||o.has(s.target))};function hN(n,i){const o=new Map,s=i?.nodes?new Set(i.nodes.map(r=>r.id)):null;return n.forEach(r=>{r.measured.width&&r.measured.height&&(i?.includeHiddenNodes||!r.hidden)&&(!s||s.has(r.id))&&o.set(r.id,r)}),o}async function gN({nodes:n,width:i,height:o,panZoom:s,minZoom:r,maxZoom:u},f){if(n.size===0)return Promise.resolve(!0);const g=hN(n,f),p=Oo(g),h=hf(p,i,o,f?.minZoom??r,f?.maxZoom??u,f?.padding??.1);return await s.setViewport(h,{duration:f?.duration,ease:f?.ease,interpolate:f?.interpolate}),Promise.resolve(!0)}function X0({nodeId:n,nextPosition:i,nodeLookup:o,nodeOrigin:s=[0,0],nodeExtent:r,onError:u}){const f=o.get(n),g=f.parentId?o.get(f.parentId):void 0,{x:p,y:h}=g?g.internals.positionAbsolute:{x:0,y:0},m=f.origin??s;let v=f.extent||r;if(f.extent==="parent"&&!f.expandParent)if(!g)u?.("005",mn.error005());else{const x=g.measured.width,E=g.measured.height;x&&E&&(v=[[p,h],[p+x,h+E]])}else g&&dl(f.extent)&&(v=[[f.extent[0][0]+p,f.extent[0][1]+h],[f.extent[1][0]+p,f.extent[1][1]+h]]);const y=dl(v)?li(i,v,f.measured):i;return(f.measured.width===void 0||f.measured.height===void 0)&&u?.("015",mn.error015()),{position:{x:y.x-p+(f.measured.width??0)*m[0],y:y.y-h+(f.measured.height??0)*m[1]},positionAbsolute:y}}async function mN({nodesToRemove:n=[],edgesToRemove:i=[],nodes:o,edges:s,onBeforeDelete:r}){const u=new Set(n.map(y=>y.id)),f=[];for(const y of o){if(y.deletable===!1)continue;const x=u.has(y.id),E=!x&&y.parentId&&f.find(C=>C.id===y.parentId);(x||E)&&f.push(y)}const g=new Set(i.map(y=>y.id)),p=s.filter(y=>y.deletable!==!1),m=fN(f,p);for(const y of p)g.has(y.id)&&!m.find(E=>E.id===y.id)&&m.push(y);if(!r)return{edges:m,nodes:f};const v=await r({nodes:f,edges:m});return typeof v=="boolean"?v?{edges:m,nodes:f}:{edges:[],nodes:[]}:v}const cl=(n,i=0,o=1)=>Math.min(Math.max(n,i),o),li=(n={x:0,y:0},i,o)=>({x:cl(n.x,i[0][0],i[1][0]-(o?.width??0)),y:cl(n.y,i[0][1],i[1][1]-(o?.height??0))});function Z0(n,i,o){const{width:s,height:r}=Vn(o),{x:u,y:f}=o.internals.positionAbsolute;return li(n,[[u,f],[u+s,f+r]],i)}const ay=(n,i,o)=>n<i?cl(Math.abs(n-i),1,i)/i:n>o?-cl(Math.abs(n-o),1,i)/i:0,$0=(n,i,o=15,s=40)=>{const r=ay(n.x,s,i.width-s)*o,u=ay(n.y,s,i.height-s)*o;return[r,u]},Gr=(n,i)=>({x:Math.min(n.x,i.x),y:Math.min(n.y,i.y),x2:Math.max(n.x2,i.x2),y2:Math.max(n.y2,i.y2)}),Fd=({x:n,y:i,width:o,height:s})=>({x:n,y:i,x2:n+o,y2:i+s}),kr=({x:n,y:i,x2:o,y2:s})=>({x:n,y:i,width:o-n,height:s-i}),ul=(n,i=[0,0])=>{const{x:o,y:s}=df(n)?n.internals.positionAbsolute:jo(n,i);return{x:o,y:s,width:n.measured?.width??n.width??n.initialWidth??0,height:n.measured?.height??n.height??n.initialHeight??0}},jr=(n,i=[0,0])=>{const{x:o,y:s}=df(n)?n.internals.positionAbsolute:jo(n,i);return{x:o,y:s,x2:o+(n.measured?.width??n.width??n.initialWidth??0),y2:s+(n.measured?.height??n.height??n.initialHeight??0)}},K0=(n,i)=>kr(Gr(Fd(n),Fd(i))),Ao=(n,i)=>{const o=Math.max(0,Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)),s=Math.max(0,Math.min(n.y+n.height,i.y+i.height)-Math.max(n.y,i.y));return Math.ceil(o*s)},iy=n=>nn(n.width)&&nn(n.height)&&nn(n.x)&&nn(n.y),nn=n=>!isNaN(n)&&isFinite(n),pN=(n,i)=>{},Ho=(n,i=[1,1])=>({x:i[0]*Math.round(n.x/i[0]),y:i[1]*Math.round(n.y/i[1])}),Lo=({x:n,y:i},[o,s,r],u=!1,f=[1,1])=>{const g={x:(n-o)/r,y:(i-s)/r};return u?Ho(g,f):g},Or=({x:n,y:i},[o,s,r])=>({x:n*r+o,y:i*r+s});function Ji(n,i){if(typeof n=="number")return Math.floor((i-i/(1+n))*.5);if(typeof n=="string"&&n.endsWith("px")){const o=parseFloat(n);if(!Number.isNaN(o))return Math.floor(o)}if(typeof n=="string"&&n.endsWith("%")){const o=parseFloat(n);if(!Number.isNaN(o))return Math.floor(i*o*.01)}return console.error(`[React Flow] The padding value "${n}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function yN(n,i,o){if(typeof n=="string"||typeof n=="number"){const s=Ji(n,o),r=Ji(n,i);return{top:s,right:r,bottom:s,left:r,x:r*2,y:s*2}}if(typeof n=="object"){const s=Ji(n.top??n.y??0,o),r=Ji(n.bottom??n.y??0,o),u=Ji(n.left??n.x??0,i),f=Ji(n.right??n.x??0,i);return{top:s,right:f,bottom:r,left:u,x:u+f,y:s+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vN(n,i,o,s,r,u){const{x:f,y:g}=Or(n,[i,o,s]),{x:p,y:h}=Or({x:n.x+n.width,y:n.y+n.height},[i,o,s]),m=r-p,v=u-h;return{left:Math.floor(f),top:Math.floor(g),right:Math.floor(m),bottom:Math.floor(v)}}const hf=(n,i,o,s,r,u)=>{const f=yN(u,i,o),g=(i-f.x)/n.width,p=(o-f.y)/n.height,h=Math.min(g,p),m=cl(h,s,r),v=n.x+n.width/2,y=n.y+n.height/2,x=i/2-v*m,E=o/2-y*m,C=vN(n,x,E,m,i,o),A={left:Math.min(C.left-f.left,0),top:Math.min(C.top-f.top,0),right:Math.min(C.right-f.right,0),bottom:Math.min(C.bottom-f.bottom,0)};return{x:x-A.left+A.right,y:E-A.top+A.bottom,zoom:m}},Co=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function dl(n){return n!=null&&n!=="parent"}function Vn(n){return{width:n.measured?.width??n.width??n.initialWidth??0,height:n.measured?.height??n.height??n.initialHeight??0}}function Q0(n){return(n.measured?.width??n.width??n.initialWidth)!==void 0&&(n.measured?.height??n.height??n.initialHeight)!==void 0}function F0(n,i={width:0,height:0},o,s,r){const u={...n},f=s.get(o);if(f){const g=f.origin||r;u.x+=f.internals.positionAbsolute.x-(i.width??0)*g[0],u.y+=f.internals.positionAbsolute.y-(i.height??0)*g[1]}return u}function ly(n,i){if(n.size!==i.size)return!1;for(const o of n)if(!i.has(o))return!1;return!0}function SN(){let n,i;return{promise:new Promise((s,r)=>{n=s,i=r}),resolve:n,reject:i}}function bN(n){return{...G0,...n||{}}}function bo(n,{snapGrid:i=[0,0],snapToGrid:o=!1,transform:s,containerBounds:r}){const{x:u,y:f}=an(n),g=Lo({x:u-(r?.left??0),y:f-(r?.top??0)},s),{x:p,y:h}=o?Ho(g,i):g;return{xSnapped:p,ySnapped:h,...g}}const gf=n=>({width:n.offsetWidth,height:n.offsetHeight}),J0=n=>n?.getRootNode?.()||window?.document,xN=["INPUT","SELECT","TEXTAREA"];function P0(n){const i=n.composedPath?.()?.[0]||n.target;return i?.nodeType!==1?!1:xN.includes(i.nodeName)||i.hasAttribute("contenteditable")||!!i.closest(".nokey")}const W0=n=>"clientX"in n,an=(n,i)=>{const o=W0(n),s=o?n.clientX:n.touches?.[0].clientX,r=o?n.clientY:n.touches?.[0].clientY;return{x:s-(i?.left??0),y:r-(i?.top??0)}},oy=(n,i,o,s,r)=>{const u=i.querySelectorAll(`.${n}`);return!u||!u.length?null:Array.from(u).map(f=>{const g=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),type:n,nodeId:r,position:f.getAttribute("data-handlepos"),x:(g.left-o.left)/s,y:(g.top-o.top)/s,...gf(f)}})};function ev({sourceX:n,sourceY:i,targetX:o,targetY:s,sourceControlX:r,sourceControlY:u,targetControlX:f,targetControlY:g}){const p=n*.125+r*.375+f*.375+o*.125,h=i*.125+u*.375+g*.375+s*.125,m=Math.abs(p-n),v=Math.abs(h-i);return[p,h,m,v]}function gr(n,i){return n>=0?.5*n:i*25*Math.sqrt(-n)}function sy({pos:n,x1:i,y1:o,x2:s,y2:r,c:u}){switch(n){case me.Left:return[i-gr(i-s,u),o];case me.Right:return[i+gr(s-i,u),o];case me.Top:return[i,o-gr(o-r,u)];case me.Bottom:return[i,o+gr(r-o,u)]}}function tv({sourceX:n,sourceY:i,sourcePosition:o=me.Bottom,targetX:s,targetY:r,targetPosition:u=me.Top,curvature:f=.25}){const[g,p]=sy({pos:o,x1:n,y1:i,x2:s,y2:r,c:f}),[h,m]=sy({pos:u,x1:s,y1:r,x2:n,y2:i,c:f}),[v,y,x,E]=ev({sourceX:n,sourceY:i,targetX:s,targetY:r,sourceControlX:g,sourceControlY:p,targetControlX:h,targetControlY:m});return[`M${n},${i} C${g},${p} ${h},${m} ${s},${r}`,v,y,x,E]}function nv({sourceX:n,sourceY:i,targetX:o,targetY:s}){const r=Math.abs(o-n)/2,u=o<n?o+r:o-r,f=Math.abs(s-i)/2,g=s<i?s+f:s-f;return[u,g,r,f]}function _N({sourceNode:n,targetNode:i,selected:o=!1,zIndex:s=0,elevateOnSelect:r=!1,zIndexMode:u="basic"}){if(u==="manual")return s;const f=r&&o?s+1e3:s,g=Math.max(n.parentId||r&&n.selected?n.internals.z:0,i.parentId||r&&i.selected?i.internals.z:0);return f+g}function wN({sourceNode:n,targetNode:i,width:o,height:s,transform:r}){const u=Gr(jr(n),jr(i));u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const f={x:-r[0]/r[2],y:-r[1]/r[2],width:o/r[2],height:s/r[2]};return Ao(f,kr(u))>0}const EN=({source:n,sourceHandle:i,target:o,targetHandle:s})=>`xy-edge__${n}${i||""}-${o}${s||""}`,NN=(n,i)=>i.some(o=>o.source===n.source&&o.target===n.target&&(o.sourceHandle===n.sourceHandle||!o.sourceHandle&&!n.sourceHandle)&&(o.targetHandle===n.targetHandle||!o.targetHandle&&!n.targetHandle)),TN=(n,i,o={})=>{if(!n.source||!n.target)return i;const s=o.getEdgeId||EN;let r;return V0(n)?r={...n}:r={...n,id:s(n)},NN(r,i)?i:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,i.concat(r))};function av({sourceX:n,sourceY:i,targetX:o,targetY:s}){const[r,u,f,g]=nv({sourceX:n,sourceY:i,targetX:o,targetY:s});return[`M ${n},${i}L ${o},${s}`,r,u,f,g]}const ry={[me.Left]:{x:-1,y:0},[me.Right]:{x:1,y:0},[me.Top]:{x:0,y:-1},[me.Bottom]:{x:0,y:1}},AN=({source:n,sourcePosition:i=me.Bottom,target:o})=>i===me.Left||i===me.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1},cy=(n,i)=>Math.sqrt(Math.pow(i.x-n.x,2)+Math.pow(i.y-n.y,2));function CN({source:n,sourcePosition:i=me.Bottom,target:o,targetPosition:s=me.Top,center:r,offset:u,stepPosition:f}){const g=ry[i],p=ry[s],h={x:n.x+g.x*u,y:n.y+g.y*u},m={x:o.x+p.x*u,y:o.y+p.y*u},v=AN({source:h,sourcePosition:i,target:m}),y=v.x!==0?"x":"y",x=v[y];let E=[],C,A;const M={x:0,y:0},H={x:0,y:0},[,,_,z]=nv({sourceX:n.x,sourceY:n.y,targetX:o.x,targetY:o.y});if(g[y]*p[y]===-1){y==="x"?(C=r.x??h.x+(m.x-h.x)*f,A=r.y??(h.y+m.y)/2):(C=r.x??(h.x+m.x)/2,A=r.y??h.y+(m.y-h.y)*f);const B=[{x:C,y:h.y},{x:C,y:m.y}],Z=[{x:h.x,y:A},{x:m.x,y:A}];g[y]===x?E=y==="x"?B:Z:E=y==="x"?Z:B}else{const B=[{x:h.x,y:m.y}],Z=[{x:m.x,y:h.y}];if(y==="x"?E=g.x===x?Z:B:E=g.y===x?B:Z,i===s){const D=Math.abs(n[y]-o[y]);if(D<=u){const k=Math.min(u-1,u-D);g[y]===x?M[y]=(h[y]>n[y]?-1:1)*k:H[y]=(m[y]>o[y]?-1:1)*k}}if(i!==s){const D=y==="x"?"y":"x",k=g[y]===p[D],T=h[D]>m[D],U=h[D]<m[D];(g[y]===1&&(!k&&T||k&&U)||g[y]!==1&&(!k&&U||k&&T))&&(E=y==="x"?B:Z)}const oe={x:h.x+M.x,y:h.y+M.y},$={x:m.x+H.x,y:m.y+H.y},ee=Math.max(Math.abs(oe.x-E[0].x),Math.abs($.x-E[0].x)),se=Math.max(Math.abs(oe.y-E[0].y),Math.abs($.y-E[0].y));ee>=se?(C=(oe.x+$.x)/2,A=E[0].y):(C=E[0].x,A=(oe.y+$.y)/2)}const Y={x:h.x+M.x,y:h.y+M.y},O={x:m.x+H.x,y:m.y+H.y};return[[n,...Y.x!==E[0].x||Y.y!==E[0].y?[Y]:[],...E,...O.x!==E[E.length-1].x||O.y!==E[E.length-1].y?[O]:[],o],C,A,_,z]}function MN(n,i,o,s){const r=Math.min(cy(n,i)/2,cy(i,o)/2,s),{x:u,y:f}=i;if(n.x===u&&u===o.x||n.y===f&&f===o.y)return`L${u} ${f}`;if(n.y===f){const h=n.x<o.x?-1:1,m=n.y<o.y?1:-1;return`L ${u+r*h},${f}Q ${u},${f} ${u},${f+r*m}`}const g=n.x<o.x?1:-1,p=n.y<o.y?-1:1;return`L ${u},${f+r*p}Q ${u},${f} ${u+r*g},${f}`}function Jd({sourceX:n,sourceY:i,sourcePosition:o=me.Bottom,targetX:s,targetY:r,targetPosition:u=me.Top,borderRadius:f=5,centerX:g,centerY:p,offset:h=20,stepPosition:m=.5}){const[v,y,x,E,C]=CN({source:{x:n,y:i},sourcePosition:o,target:{x:s,y:r},targetPosition:u,center:{x:g,y:p},offset:h,stepPosition:m});let A=`M${v[0].x} ${v[0].y}`;for(let M=1;M<v.length-1;M++)A+=MN(v[M-1],v[M],v[M+1],f);return A+=`L${v[v.length-1].x} ${v[v.length-1].y}`,[A,y,x,E,C]}function uy(n){return n&&!!(n.internals.handleBounds||n.handles?.length)&&!!(n.measured.width||n.width||n.initialWidth)}function zN(n){const{sourceNode:i,targetNode:o}=n;if(!uy(i)||!uy(o))return null;const s=i.internals.handleBounds||dy(i.handles),r=o.internals.handleBounds||dy(o.handles),u=fy(s?.source??[],n.sourceHandle),f=fy(n.connectionMode===rl.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),n.targetHandle);if(!u||!f)return n.onError?.("008",mn.error008(u?"target":"source",{id:n.id,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle})),null;const g=u?.position||me.Bottom,p=f?.position||me.Top,h=oi(i,u,g),m=oi(o,f,p);return{sourceX:h.x,sourceY:h.y,targetX:m.x,targetY:m.y,sourcePosition:g,targetPosition:p}}function dy(n){if(!n)return null;const i=[],o=[];for(const s of n)s.width=s.width??1,s.height=s.height??1,s.type==="source"?i.push(s):s.type==="target"&&o.push(s);return{source:i,target:o}}function oi(n,i,o=me.Left,s=!1){const r=(i?.x??0)+n.internals.positionAbsolute.x,u=(i?.y??0)+n.internals.positionAbsolute.y,{width:f,height:g}=i??Vn(n);if(s)return{x:r+f/2,y:u+g/2};switch(i?.position??o){case me.Top:return{x:r+f/2,y:u};case me.Right:return{x:r+f,y:u+g/2};case me.Bottom:return{x:r+f/2,y:u+g};case me.Left:return{x:r,y:u+g/2}}}function fy(n,i){return n&&(i?n.find(o=>o.id===i):n[0])||null}function Pd(n,i){return n?typeof n=="string"?n:`${i?`${i}__`:""}${Object.keys(n).sort().map(s=>`${s}=${n[s]}`).join("&")}`:""}function DN(n,{id:i,defaultColor:o,defaultMarkerStart:s,defaultMarkerEnd:r}){const u=new Set;return n.reduce((f,g)=>([g.markerStart||s,g.markerEnd||r].forEach(p=>{if(p&&typeof p=="object"){const h=Pd(p,i);u.has(h)||(f.push({id:h,color:p.color||o,...p}),u.add(h))}}),f),[]).sort((f,g)=>f.id.localeCompare(g.id))}const iv=1e3,RN=10,mf={nodeOrigin:[0,0],nodeExtent:No,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},jN={...mf,checkEquality:!0};function pf(n,i){const o={...n};for(const s in i)i[s]!==void 0&&(o[s]=i[s]);return o}function ON(n,i,o){const s=pf(mf,o);for(const r of n.values())if(r.parentId)vf(r,n,i,s);else{const u=jo(r,s.nodeOrigin),f=dl(r.extent)?r.extent:s.nodeExtent,g=li(u,f,Vn(r));r.internals.positionAbsolute=g}}function HN(n,i){if(!n.handles)return n.measured?i?.internals.handleBounds:void 0;const o=[],s=[];for(const r of n.handles){const u={id:r.id,width:r.width??1,height:r.height??1,nodeId:n.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?o.push(u):r.type==="target"&&s.push(u)}return{source:o,target:s}}function yf(n){return n==="manual"}function Wd(n,i,o,s={}){const r=pf(jN,s),u={i:0},f=new Map(i),g=r?.elevateNodesOnSelect&&!yf(r.zIndexMode)?iv:0;let p=n.length>0,h=!1;i.clear(),o.clear();for(const m of n){let v=f.get(m.id);if(r.checkEquality&&m===v?.internals.userNode)i.set(m.id,v);else{const y=jo(m,r.nodeOrigin),x=dl(m.extent)?m.extent:r.nodeExtent,E=li(y,x,Vn(m));v={...r.defaults,...m,measured:{width:m.measured?.width,height:m.measured?.height},internals:{positionAbsolute:E,handleBounds:HN(m,v),z:lv(m,g,r.zIndexMode),userNode:m}},i.set(m.id,v)}(v.measured===void 0||v.measured.width===void 0||v.measured.height===void 0)&&!v.hidden&&(p=!1),m.parentId&&vf(v,i,o,s,u),h||=m.selected??!1}return{nodesInitialized:p,hasSelectedNodes:h}}function LN(n,i){if(!n.parentId)return;const o=i.get(n.parentId);o?o.set(n.id,n):i.set(n.parentId,new Map([[n.id,n]]))}function vf(n,i,o,s,r){const{elevateNodesOnSelect:u,nodeOrigin:f,nodeExtent:g,zIndexMode:p}=pf(mf,s),h=n.parentId,m=i.get(h);if(!m){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}LN(n,o),r&&!m.parentId&&m.internals.rootParentIndex===void 0&&p==="auto"&&(m.internals.rootParentIndex=++r.i,m.internals.z=m.internals.z+r.i*RN),r&&m.internals.rootParentIndex!==void 0&&(r.i=m.internals.rootParentIndex);const v=u&&!yf(p)?iv:0,{x:y,y:x,z:E}=UN(n,m,f,g,v,p),{positionAbsolute:C}=n.internals,A=y!==C.x||x!==C.y;(A||E!==n.internals.z)&&i.set(n.id,{...n,internals:{...n.internals,positionAbsolute:A?{x:y,y:x}:C,z:E}})}function lv(n,i,o){const s=nn(n.zIndex)?n.zIndex:0;return yf(o)?s:s+(n.selected?i:0)}function UN(n,i,o,s,r,u){const{x:f,y:g}=i.internals.positionAbsolute,p=Vn(n),h=jo(n,o),m=dl(n.extent)?li(h,n.extent,p):h;let v=li({x:f+m.x,y:g+m.y},s,p);n.extent==="parent"&&(v=Z0(v,p,i));const y=lv(n,r,u),x=i.internals.z??0;return{x:v.x,y:v.y,z:x>=y?x+1:y}}function Sf(n,i,o,s=[0,0]){const r=[],u=new Map;for(const f of n){const g=i.get(f.parentId);if(!g)continue;const p=u.get(f.parentId)?.expandedRect??ul(g),h=K0(p,f.rect);u.set(f.parentId,{expandedRect:h,parent:g})}return u.size>0&&u.forEach(({expandedRect:f,parent:g},p)=>{const h=g.internals.positionAbsolute,m=Vn(g),v=g.origin??s,y=f.x<h.x?Math.round(Math.abs(h.x-f.x)):0,x=f.y<h.y?Math.round(Math.abs(h.y-f.y)):0,E=Math.max(m.width,Math.round(f.width)),C=Math.max(m.height,Math.round(f.height)),A=(E-m.width)*v[0],M=(C-m.height)*v[1];(y>0||x>0||A||M)&&(r.push({id:p,type:"position",position:{x:g.position.x-y+A,y:g.position.y-x+M}}),o.get(p)?.forEach(H=>{n.some(_=>_.id===H.id)||r.push({id:H.id,type:"position",position:{x:H.position.x+y,y:H.position.y+x}})})),(m.width<f.width||m.height<f.height||y||x)&&r.push({id:p,type:"dimensions",setAttributes:!0,dimensions:{width:E+(y?v[0]*y-A:0),height:C+(x?v[1]*x-M:0)}})}),r}function BN(n,i,o,s,r,u,f){const g=s?.querySelector(".xyflow__viewport");let p=!1;if(!g)return{changes:[],updatedInternals:p};const h=[],m=window.getComputedStyle(g),{m22:v}=new window.DOMMatrixReadOnly(m.transform),y=[];for(const x of n.values()){const E=i.get(x.id);if(!E)continue;if(E.hidden){i.set(E.id,{...E,internals:{...E.internals,handleBounds:void 0}}),p=!0;continue}const C=gf(x.nodeElement),A=E.measured.width!==C.width||E.measured.height!==C.height;if(!!(C.width&&C.height&&(A||!E.internals.handleBounds||x.force))){const H=x.nodeElement.getBoundingClientRect(),_=dl(E.extent)?E.extent:u;let{positionAbsolute:z}=E.internals;E.parentId&&E.extent==="parent"?z=Z0(z,C,i.get(E.parentId)):_&&(z=li(z,_,C));const Y={...E,measured:C,internals:{...E.internals,positionAbsolute:z,handleBounds:{source:oy("source",x.nodeElement,H,v,E.id),target:oy("target",x.nodeElement,H,v,E.id)}}};i.set(E.id,Y),E.parentId&&vf(Y,i,o,{nodeOrigin:r,zIndexMode:f}),p=!0,A&&(h.push({id:E.id,type:"dimensions",dimensions:C}),E.expandParent&&E.parentId&&y.push({id:E.id,parentId:E.parentId,rect:ul(Y,r)}))}}if(y.length>0){const x=Sf(y,i,o,r);h.push(...x)}return{changes:h,updatedInternals:p}}async function IN({delta:n,panZoom:i,transform:o,translateExtent:s,width:r,height:u}){if(!i||!n.x&&!n.y)return Promise.resolve(!1);const f=await i.setViewportConstrained({x:o[0]+n.x,y:o[1]+n.y,zoom:o[2]},[[0,0],[r,u]],s),g=!!f&&(f.x!==o[0]||f.y!==o[1]||f.k!==o[2]);return Promise.resolve(g)}function hy(n,i,o,s,r,u){let f=r;const g=s.get(f)||new Map;s.set(f,g.set(o,i)),f=`${r}-${n}`;const p=s.get(f)||new Map;if(s.set(f,p.set(o,i)),u){f=`${r}-${n}-${u}`;const h=s.get(f)||new Map;s.set(f,h.set(o,i))}}function ov(n,i,o){n.clear(),i.clear();for(const s of o){const{source:r,target:u,sourceHandle:f=null,targetHandle:g=null}=s,p={edgeId:s.id,source:r,target:u,sourceHandle:f,targetHandle:g},h=`${r}-${f}--${u}-${g}`,m=`${u}-${g}--${r}-${f}`;hy("source",p,m,n,r,f),hy("target",p,h,n,u,g),i.set(s.id,s)}}function sv(n,i){if(!n.parentId)return!1;const o=i.get(n.parentId);return o?o.selected?!0:sv(o,i):!1}function gy(n,i,o){let s=n;do{if(s?.matches?.(i))return!0;if(s===o)return!1;s=s?.parentElement}while(s);return!1}function qN(n,i,o,s){const r=new Map;for(const[u,f]of n)if((f.selected||f.id===s)&&(!f.parentId||!sv(f,n))&&(f.draggable||i&&typeof f.draggable>"u")){const g=n.get(u);g&&r.set(u,{id:u,position:g.position||{x:0,y:0},distance:{x:o.x-g.internals.positionAbsolute.x,y:o.y-g.internals.positionAbsolute.y},extent:g.extent,parentId:g.parentId,origin:g.origin,expandParent:g.expandParent,internals:{positionAbsolute:g.internals.positionAbsolute||{x:0,y:0}},measured:{width:g.measured.width??0,height:g.measured.height??0}})}return r}function zd({nodeId:n,dragItems:i,nodeLookup:o,dragging:s=!0}){const r=[];for(const[f,g]of i){const p=o.get(f)?.internals.userNode;p&&r.push({...p,position:g.position,dragging:s})}if(!n)return[r[0],r];const u=o.get(n)?.internals.userNode;return[u?{...u,position:i.get(n)?.position||u.position,dragging:s}:r[0],r]}function GN({dragItems:n,snapGrid:i,x:o,y:s}){const r=n.values().next().value;if(!r)return null;const u={x:o-r.distance.x,y:s-r.distance.y},f=Ho(u,i);return{x:f.x-u.x,y:f.y-u.y}}function kN({onNodeMouseDown:n,getStoreItems:i,onDragStart:o,onDrag:s,onDragStop:r}){let u={x:null,y:null},f=0,g=new Map,p=!1,h={x:0,y:0},m=null,v=!1,y=null,x=!1,E=!1,C=null;function A({noDragClassName:H,handleSelector:_,domNode:z,isSelectable:Y,nodeId:O,nodeClickDistance:I=0}){y=Bt(z);function B({x:ee,y:se}){const{nodeLookup:D,nodeExtent:k,snapGrid:T,snapToGrid:U,nodeOrigin:G,onNodeDrag:R,onSelectionDrag:F,onError:N,updateNodePositions:j}=i();u={x:ee,y:se};let W=!1;const te=g.size>1,ce=te&&k?Fd(Oo(g)):null,de=te&&U?GN({dragItems:g,snapGrid:T,x:ee,y:se}):null;for(const[ue,re]of g){if(!D.has(ue))continue;let fe={x:ee-re.distance.x,y:se-re.distance.y};U&&(fe=de?{x:Math.round(fe.x+de.x),y:Math.round(fe.y+de.y)}:Ho(fe,T));let Ee=null;if(te&&k&&!re.extent&&ce){const{positionAbsolute:Se}=re.internals,Ce=Se.x-ce.x+k[0][0],Ie=Se.x+re.measured.width-ce.x2+k[1][0],Le=Se.y-ce.y+k[0][1],ct=Se.y+re.measured.height-ce.y2+k[1][1];Ee=[[Ce,Le],[Ie,ct]]}const{position:xe,positionAbsolute:ye}=X0({nodeId:ue,nextPosition:fe,nodeLookup:D,nodeExtent:Ee||k,nodeOrigin:G,onError:N});W=W||re.position.x!==xe.x||re.position.y!==xe.y,re.position=xe,re.internals.positionAbsolute=ye}if(E=E||W,!!W&&(j(g,!0),C&&(s||R||!O&&F))){const[ue,re]=zd({nodeId:O,dragItems:g,nodeLookup:D});s?.(C,g,ue,re),R?.(C,ue,re),O||F?.(C,re)}}async function Z(){if(!m)return;const{transform:ee,panBy:se,autoPanSpeed:D,autoPanOnNodeDrag:k}=i();if(!k){p=!1,cancelAnimationFrame(f);return}const[T,U]=$0(h,m,D);(T!==0||U!==0)&&(u.x=(u.x??0)-T/ee[2],u.y=(u.y??0)-U/ee[2],await se({x:T,y:U})&&B(u)),f=requestAnimationFrame(Z)}function oe(ee){const{nodeLookup:se,multiSelectionActive:D,nodesDraggable:k,transform:T,snapGrid:U,snapToGrid:G,selectNodesOnDrag:R,onNodeDragStart:F,onSelectionDragStart:N,unselectNodesAndEdges:j}=i();v=!0,(!R||!Y)&&!D&&O&&(se.get(O)?.selected||j()),Y&&R&&O&&n?.(O);const W=bo(ee.sourceEvent,{transform:T,snapGrid:U,snapToGrid:G,containerBounds:m});if(u=W,g=qN(se,k,W,O),g.size>0&&(o||F||!O&&N)){const[te,ce]=zd({nodeId:O,dragItems:g,nodeLookup:se});o?.(ee.sourceEvent,g,te,ce),F?.(ee.sourceEvent,te,ce),O||N?.(ee.sourceEvent,ce)}}const $=E0().clickDistance(I).on("start",ee=>{const{domNode:se,nodeDragThreshold:D,transform:k,snapGrid:T,snapToGrid:U}=i();m=se?.getBoundingClientRect()||null,x=!1,E=!1,C=ee.sourceEvent,D===0&&oe(ee),u=bo(ee.sourceEvent,{transform:k,snapGrid:T,snapToGrid:U,containerBounds:m}),h=an(ee.sourceEvent,m)}).on("drag",ee=>{const{autoPanOnNodeDrag:se,transform:D,snapGrid:k,snapToGrid:T,nodeDragThreshold:U,nodeLookup:G}=i(),R=bo(ee.sourceEvent,{transform:D,snapGrid:k,snapToGrid:T,containerBounds:m});if(C=ee.sourceEvent,(ee.sourceEvent.type==="touchmove"&&ee.sourceEvent.touches.length>1||O&&!G.has(O))&&(x=!0),!x){if(!p&&se&&v&&(p=!0,Z()),!v){const F=an(ee.sourceEvent,m),N=F.x-h.x,j=F.y-h.y;Math.sqrt(N*N+j*j)>U&&oe(ee)}(u.x!==R.xSnapped||u.y!==R.ySnapped)&&g&&v&&(h=an(ee.sourceEvent,m),B(R))}}).on("end",ee=>{if(!(!v||x)&&(p=!1,v=!1,cancelAnimationFrame(f),g.size>0)){const{nodeLookup:se,updateNodePositions:D,onNodeDragStop:k,onSelectionDragStop:T}=i();if(E&&(D(g,!1),E=!1),r||k||!O&&T){const[U,G]=zd({nodeId:O,dragItems:g,nodeLookup:se,dragging:!1});r?.(ee.sourceEvent,g,U,G),k?.(ee.sourceEvent,U,G),O||T?.(ee.sourceEvent,G)}}}).filter(ee=>{const se=ee.target;return!ee.button&&(!H||!gy(se,`.${H}`,z))&&(!_||gy(se,_,z))});y.call($)}function M(){y?.on(".drag",null)}return{update:A,destroy:M}}function YN(n,i,o){const s=[],r={x:n.x-o,y:n.y-o,width:o*2,height:o*2};for(const u of i.values())Ao(r,ul(u))>0&&s.push(u);return s}const VN=250;function XN(n,i,o,s){let r=[],u=1/0;const f=YN(n,o,i+VN);for(const g of f){const p=[...g.internals.handleBounds?.source??[],...g.internals.handleBounds?.target??[]];for(const h of p){if(s.nodeId===h.nodeId&&s.type===h.type&&s.id===h.id)continue;const{x:m,y:v}=oi(g,h,h.position,!0),y=Math.sqrt(Math.pow(m-n.x,2)+Math.pow(v-n.y,2));y>i||(y<u?(r=[{...h,x:m,y:v}],u=y):y===u&&r.push({...h,x:m,y:v}))}}if(!r.length)return null;if(r.length>1){const g=s.type==="source"?"target":"source";return r.find(p=>p.type===g)??r[0]}return r[0]}function rv(n,i,o,s,r,u=!1){const f=s.get(n);if(!f)return null;const g=r==="strict"?f.internals.handleBounds?.[i]:[...f.internals.handleBounds?.source??[],...f.internals.handleBounds?.target??[]],p=(o?g?.find(h=>h.id===o):g?.[0])??null;return p&&u?{...p,...oi(f,p,p.position,!0)}:p}function cv(n,i){return n||(i?.classList.contains("target")?"target":i?.classList.contains("source")?"source":null)}function ZN(n,i){let o=null;return i?o=!0:n&&!i&&(o=!1),o}const uv=()=>!0;function $N(n,{connectionMode:i,connectionRadius:o,handleId:s,nodeId:r,edgeUpdaterType:u,isTarget:f,domNode:g,nodeLookup:p,lib:h,autoPanOnConnect:m,flowId:v,panBy:y,cancelConnection:x,onConnectStart:E,onConnect:C,onConnectEnd:A,isValidConnection:M=uv,onReconnectEnd:H,updateConnection:_,getTransform:z,getFromHandle:Y,autoPanSpeed:O,dragThreshold:I=1,handleDomNode:B}){const Z=J0(n.target);let oe=0,$;const{x:ee,y:se}=an(n),D=cv(u,B),k=g?.getBoundingClientRect();let T=!1;if(!k||!D)return;const U=rv(r,D,s,p,i);if(!U)return;let G=an(n,k),R=!1,F=null,N=!1,j=null;function W(){if(!m||!k)return;const[xe,ye]=$0(G,k,O);y({x:xe,y:ye}),oe=requestAnimationFrame(W)}const te={...U,nodeId:r,type:D,position:U.position},ce=p.get(r);let ue={inProgress:!0,isValid:null,from:oi(ce,te,me.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:ce,to:G,toHandle:null,toPosition:ny[te.position],toNode:null,pointer:G};function re(){T=!0,_(ue),E?.(n,{nodeId:r,handleId:s,handleType:D})}I===0&&re();function fe(xe){if(!T){const{x:ct,y:Kt}=an(xe),zt=ct-ee,Qt=Kt-se;if(!(zt*zt+Qt*Qt>I*I))return;re()}if(!Y()||!te){Ee(xe);return}const ye=z();G=an(xe,k),$=XN(Lo(G,ye,!1,[1,1]),o,p,te),R||(W(),R=!0);const Se=dv(xe,{handle:$,connectionMode:i,fromNodeId:r,fromHandleId:s,fromType:f?"target":"source",isValidConnection:M,doc:Z,lib:h,flowId:v,nodeLookup:p});j=Se.handleDomNode,F=Se.connection,N=ZN(!!$,Se.isValid);const Ce=p.get(r),Ie=Ce?oi(Ce,te,me.Left,!0):ue.from,Le={...ue,from:Ie,isValid:N,to:Se.toHandle&&N?Or({x:Se.toHandle.x,y:Se.toHandle.y},ye):G,toHandle:Se.toHandle,toPosition:N&&Se.toHandle?Se.toHandle.position:ny[te.position],toNode:Se.toHandle?p.get(Se.toHandle.nodeId):null,pointer:G};_(Le),ue=Le}function Ee(xe){if(!("touches"in xe&&xe.touches.length>0)){if(T){($||j)&&F&&N&&C?.(F);const{inProgress:ye,...Se}=ue,Ce={...Se,toPosition:ue.toHandle?ue.toPosition:null};A?.(xe,Ce),u&&H?.(xe,Ce)}x(),cancelAnimationFrame(oe),R=!1,N=!1,F=null,j=null,Z.removeEventListener("mousemove",fe),Z.removeEventListener("mouseup",Ee),Z.removeEventListener("touchmove",fe),Z.removeEventListener("touchend",Ee)}}Z.addEventListener("mousemove",fe),Z.addEventListener("mouseup",Ee),Z.addEventListener("touchmove",fe),Z.addEventListener("touchend",Ee)}function dv(n,{handle:i,connectionMode:o,fromNodeId:s,fromHandleId:r,fromType:u,doc:f,lib:g,flowId:p,isValidConnection:h=uv,nodeLookup:m}){const v=u==="target",y=i?f.querySelector(`.${g}-flow__handle[data-id="${p}-${i?.nodeId}-${i?.id}-${i?.type}"]`):null,{x,y:E}=an(n),C=f.elementFromPoint(x,E),A=C?.classList.contains(`${g}-flow__handle`)?C:y,M={handleDomNode:A,isValid:!1,connection:null,toHandle:null};if(A){const H=cv(void 0,A),_=A.getAttribute("data-nodeid"),z=A.getAttribute("data-handleid"),Y=A.classList.contains("connectable"),O=A.classList.contains("connectableend");if(!_||!H)return M;const I={source:v?_:s,sourceHandle:v?z:r,target:v?s:_,targetHandle:v?r:z};M.connection=I;const Z=Y&&O&&(o===rl.Strict?v&&H==="source"||!v&&H==="target":_!==s||z!==r);M.isValid=Z&&h(I),M.toHandle=rv(_,H,z,m,o,!0)}return M}const ef={onPointerDown:$N,isValid:dv};function KN({domNode:n,panZoom:i,getTransform:o,getViewScale:s}){const r=Bt(n);function u({translateExtent:g,width:p,height:h,zoomStep:m=1,pannable:v=!0,zoomable:y=!0,inversePan:x=!1}){const E=_=>{if(_.sourceEvent.type!=="wheel"||!i)return;const z=o(),Y=_.sourceEvent.ctrlKey&&Co()?10:1,O=-_.sourceEvent.deltaY*(_.sourceEvent.deltaMode===1?.05:_.sourceEvent.deltaMode?1:.002)*m,I=z[2]*Math.pow(2,O*Y);i.scaleTo(I)};let C=[0,0];const A=_=>{(_.sourceEvent.type==="mousedown"||_.sourceEvent.type==="touchstart")&&(C=[_.sourceEvent.clientX??_.sourceEvent.touches[0].clientX,_.sourceEvent.clientY??_.sourceEvent.touches[0].clientY])},M=_=>{const z=o();if(_.sourceEvent.type!=="mousemove"&&_.sourceEvent.type!=="touchmove"||!i)return;const Y=[_.sourceEvent.clientX??_.sourceEvent.touches[0].clientX,_.sourceEvent.clientY??_.sourceEvent.touches[0].clientY],O=[Y[0]-C[0],Y[1]-C[1]];C=Y;const I=s()*Math.max(z[2],Math.log(z[2]))*(x?-1:1),B={x:z[0]-O[0]*I,y:z[1]-O[1]*I},Z=[[0,0],[p,h]];i.setViewportConstrained({x:B.x,y:B.y,zoom:z[2]},Z,g)},H=I0().on("start",A).on("zoom",v?M:null).on("zoom.wheel",y?E:null);r.call(H,{})}function f(){r.on("zoom",null)}return{update:u,destroy:f,pointer:en}}const Yr=n=>({x:n.x,y:n.y,zoom:n.k}),Dd=({x:n,y:i,zoom:o})=>qr.translate(n,i).scale(o),el=(n,i)=>n.target.closest(`.${i}`),fv=(n,i)=>i===2&&Array.isArray(n)&&n.includes(2),QN=n=>((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2,Rd=(n,i=0,o=QN,s=()=>{})=>{const r=typeof i=="number"&&i>0;return r||s(),r?n.transition().duration(i).ease(o).on("end",s):n},hv=n=>{const i=n.ctrlKey&&Co()?10:1;return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*i};function FN({zoomPanValues:n,noWheelClassName:i,d3Selection:o,d3Zoom:s,panOnScrollMode:r,panOnScrollSpeed:u,zoomOnPinch:f,onPanZoomStart:g,onPanZoom:p,onPanZoomEnd:h}){return m=>{if(el(m,i))return m.ctrlKey&&m.preventDefault(),!1;m.preventDefault(),m.stopImmediatePropagation();const v=o.property("__zoom").k||1;if(m.ctrlKey&&f){const A=en(m),M=hv(m),H=v*Math.pow(2,M);s.scaleTo(o,H,A,m);return}const y=m.deltaMode===1?20:1;let x=r===ni.Vertical?0:m.deltaX*y,E=r===ni.Horizontal?0:m.deltaY*y;!Co()&&m.shiftKey&&r!==ni.Vertical&&(x=m.deltaY*y,E=0),s.translateBy(o,-(x/v)*u,-(E/v)*u,{internal:!0});const C=Yr(o.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling?(p?.(m,C),n.panScrollTimeout=setTimeout(()=>{h?.(m,C),n.isPanScrolling=!1},150)):(n.isPanScrolling=!0,g?.(m,C))}}function JN({noWheelClassName:n,preventScrolling:i,d3ZoomHandler:o}){return function(s,r){const u=s.type==="wheel",f=!i&&u&&!s.ctrlKey,g=el(s,n);if(s.ctrlKey&&u&&g&&s.preventDefault(),f||g)return null;s.preventDefault(),o.call(this,s,r)}}function PN({zoomPanValues:n,onDraggingChange:i,onPanZoomStart:o}){return s=>{if(s.sourceEvent?.internal)return;const r=Yr(s.transform);n.mouseButton=s.sourceEvent?.button||0,n.isZoomingOrPanning=!0,n.prevViewport=r,s.sourceEvent?.type==="mousedown"&&i(!0),o&&o?.(s.sourceEvent,r)}}function WN({zoomPanValues:n,panOnDrag:i,onPaneContextMenu:o,onTransformChange:s,onPanZoom:r}){return u=>{n.usedRightMouseButton=!!(o&&fv(i,n.mouseButton??0)),u.sourceEvent?.sync||s([u.transform.x,u.transform.y,u.transform.k]),r&&!u.sourceEvent?.internal&&r?.(u.sourceEvent,Yr(u.transform))}}function eT({zoomPanValues:n,panOnDrag:i,panOnScroll:o,onDraggingChange:s,onPanZoomEnd:r,onPaneContextMenu:u}){return f=>{if(!f.sourceEvent?.internal&&(n.isZoomingOrPanning=!1,u&&fv(i,n.mouseButton??0)&&!n.usedRightMouseButton&&f.sourceEvent&&u(f.sourceEvent),n.usedRightMouseButton=!1,s(!1),r)){const g=Yr(f.transform);n.prevViewport=g,clearTimeout(n.timerId),n.timerId=setTimeout(()=>{r?.(f.sourceEvent,g)},o?150:0)}}}function tT({zoomActivationKeyPressed:n,zoomOnScroll:i,zoomOnPinch:o,panOnDrag:s,panOnScroll:r,zoomOnDoubleClick:u,userSelectionActive:f,noWheelClassName:g,noPanClassName:p,lib:h,connectionInProgress:m}){return v=>{const y=n||i,x=o&&v.ctrlKey,E=v.type==="wheel";if(v.button===1&&v.type==="mousedown"&&(el(v,`${h}-flow__node`)||el(v,`${h}-flow__edge`)))return!0;if(!s&&!y&&!r&&!u&&!o||f||m&&!E||el(v,g)&&E||el(v,p)&&(!E||r&&E&&!n)||!o&&v.ctrlKey&&E)return!1;if(!o&&v.type==="touchstart"&&v.touches?.length>1)return v.preventDefault(),!1;if(!y&&!r&&!x&&E||!s&&(v.type==="mousedown"||v.type==="touchstart")||Array.isArray(s)&&!s.includes(v.button)&&v.type==="mousedown")return!1;const C=Array.isArray(s)&&s.includes(v.button)||!v.button||v.button<=1;return(!v.ctrlKey||E)&&C}}function nT({domNode:n,minZoom:i,maxZoom:o,translateExtent:s,viewport:r,onPanZoom:u,onPanZoomStart:f,onPanZoomEnd:g,onDraggingChange:p}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},m=n.getBoundingClientRect(),v=I0().scaleExtent([i,o]).translateExtent(s),y=Bt(n).call(v);H({x:r.x,y:r.y,zoom:cl(r.zoom,i,o)},[[0,0],[m.width,m.height]],s);const x=y.on("wheel.zoom"),E=y.on("dblclick.zoom");v.wheelDelta(hv);function C($,ee){return y?new Promise(se=>{v?.interpolate(ee?.interpolate==="linear"?So:xr).transform(Rd(y,ee?.duration,ee?.ease,()=>se(!0)),$)}):Promise.resolve(!1)}function A({noWheelClassName:$,noPanClassName:ee,onPaneContextMenu:se,userSelectionActive:D,panOnScroll:k,panOnDrag:T,panOnScrollMode:U,panOnScrollSpeed:G,preventScrolling:R,zoomOnPinch:F,zoomOnScroll:N,zoomOnDoubleClick:j,zoomActivationKeyPressed:W,lib:te,onTransformChange:ce,connectionInProgress:de,paneClickDistance:ue,selectionOnDrag:re}){D&&!h.isZoomingOrPanning&&M();const fe=k&&!W&&!D;v.clickDistance(re?1/0:!nn(ue)||ue<0?0:ue);const Ee=fe?FN({zoomPanValues:h,noWheelClassName:$,d3Selection:y,d3Zoom:v,panOnScrollMode:U,panOnScrollSpeed:G,zoomOnPinch:F,onPanZoomStart:f,onPanZoom:u,onPanZoomEnd:g}):JN({noWheelClassName:$,preventScrolling:R,d3ZoomHandler:x});if(y.on("wheel.zoom",Ee,{passive:!1}),!D){const ye=PN({zoomPanValues:h,onDraggingChange:p,onPanZoomStart:f});v.on("start",ye);const Se=WN({zoomPanValues:h,panOnDrag:T,onPaneContextMenu:!!se,onPanZoom:u,onTransformChange:ce});v.on("zoom",Se);const Ce=eT({zoomPanValues:h,panOnDrag:T,panOnScroll:k,onPaneContextMenu:se,onPanZoomEnd:g,onDraggingChange:p});v.on("end",Ce)}const xe=tT({zoomActivationKeyPressed:W,panOnDrag:T,zoomOnScroll:N,panOnScroll:k,zoomOnDoubleClick:j,zoomOnPinch:F,userSelectionActive:D,noPanClassName:ee,noWheelClassName:$,lib:te,connectionInProgress:de});v.filter(xe),j?y.on("dblclick.zoom",E):y.on("dblclick.zoom",null)}function M(){v.on("zoom",null)}async function H($,ee,se){const D=Dd($),k=v?.constrain()(D,ee,se);return k&&await C(k),new Promise(T=>T(k))}async function _($,ee){const se=Dd($);return await C(se,ee),new Promise(D=>D(se))}function z($){if(y){const ee=Dd($),se=y.property("__zoom");(se.k!==$.zoom||se.x!==$.x||se.y!==$.y)&&v?.transform(y,ee,null,{sync:!0})}}function Y(){const $=y?B0(y.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}function O($,ee){return y?new Promise(se=>{v?.interpolate(ee?.interpolate==="linear"?So:xr).scaleTo(Rd(y,ee?.duration,ee?.ease,()=>se(!0)),$)}):Promise.resolve(!1)}function I($,ee){return y?new Promise(se=>{v?.interpolate(ee?.interpolate==="linear"?So:xr).scaleBy(Rd(y,ee?.duration,ee?.ease,()=>se(!0)),$)}):Promise.resolve(!1)}function B($){v?.scaleExtent($)}function Z($){v?.translateExtent($)}function oe($){const ee=!nn($)||$<0?0:$;v?.clickDistance(ee)}return{update:A,destroy:M,setViewport:_,setViewportConstrained:H,getViewport:Y,scaleTo:O,scaleBy:I,setScaleExtent:B,setTranslateExtent:Z,syncViewport:z,setClickDistance:oe}}var fl;(function(n){n.Line="line",n.Handle="handle"})(fl||(fl={}));function aT({width:n,prevWidth:i,height:o,prevHeight:s,affectsX:r,affectsY:u}){const f=n-i,g=o-s,p=[f>0?1:f<0?-1:0,g>0?1:g<0?-1:0];return f&&r&&(p[0]=p[0]*-1),g&&u&&(p[1]=p[1]*-1),p}function my(n){const i=n.includes("right")||n.includes("left"),o=n.includes("bottom")||n.includes("top"),s=n.includes("left"),r=n.includes("top");return{isHorizontal:i,isVertical:o,affectsX:s,affectsY:r}}function xa(n,i){return Math.max(0,i-n)}function _a(n,i){return Math.max(0,n-i)}function mr(n,i,o){return Math.max(0,i-n,n-o)}function py(n,i){return n?!i:i}function iT(n,i,o,s,r,u,f,g){let{affectsX:p,affectsY:h}=i;const{isHorizontal:m,isVertical:v}=i,y=m&&v,{xSnapped:x,ySnapped:E}=o,{minWidth:C,maxWidth:A,minHeight:M,maxHeight:H}=s,{x:_,y:z,width:Y,height:O,aspectRatio:I}=n;let B=Math.floor(m?x-n.pointerX:0),Z=Math.floor(v?E-n.pointerY:0);const oe=Y+(p?-B:B),$=O+(h?-Z:Z),ee=-u[0]*Y,se=-u[1]*O;let D=mr(oe,C,A),k=mr($,M,H);if(f){let G=0,R=0;p&&B<0?G=xa(_+B+ee,f[0][0]):!p&&B>0&&(G=_a(_+oe+ee,f[1][0])),h&&Z<0?R=xa(z+Z+se,f[0][1]):!h&&Z>0&&(R=_a(z+$+se,f[1][1])),D=Math.max(D,G),k=Math.max(k,R)}if(g){let G=0,R=0;p&&B>0?G=_a(_+B,g[0][0]):!p&&B<0&&(G=xa(_+oe,g[1][0])),h&&Z>0?R=_a(z+Z,g[0][1]):!h&&Z<0&&(R=xa(z+$,g[1][1])),D=Math.max(D,G),k=Math.max(k,R)}if(r){if(m){const G=mr(oe/I,M,H)*I;if(D=Math.max(D,G),f){let R=0;!p&&!h||p&&!h&&y?R=_a(z+se+oe/I,f[1][1])*I:R=xa(z+se+(p?B:-B)/I,f[0][1])*I,D=Math.max(D,R)}if(g){let R=0;!p&&!h||p&&!h&&y?R=xa(z+oe/I,g[1][1])*I:R=_a(z+(p?B:-B)/I,g[0][1])*I,D=Math.max(D,R)}}if(v){const G=mr($*I,C,A)/I;if(k=Math.max(k,G),f){let R=0;!p&&!h||h&&!p&&y?R=_a(_+$*I+ee,f[1][0])/I:R=xa(_+(h?Z:-Z)*I+ee,f[0][0])/I,k=Math.max(k,R)}if(g){let R=0;!p&&!h||h&&!p&&y?R=xa(_+$*I,g[1][0])/I:R=_a(_+(h?Z:-Z)*I,g[0][0])/I,k=Math.max(k,R)}}}Z=Z+(Z<0?k:-k),B=B+(B<0?D:-D),r&&(y?oe>$*I?Z=(py(p,h)?-B:B)/I:B=(py(p,h)?-Z:Z)*I:m?(Z=B/I,h=p):(B=Z*I,p=h));const T=p?_+B:_,U=h?z+Z:z;return{width:Y+(p?-B:B),height:O+(h?-Z:Z),x:u[0]*B*(p?-1:1)+T,y:u[1]*Z*(h?-1:1)+U}}const gv={width:0,height:0,x:0,y:0},lT={...gv,pointerX:0,pointerY:0,aspectRatio:1};function oT(n){return[[0,0],[n.measured.width,n.measured.height]]}function sT(n,i,o){const s=i.position.x+n.position.x,r=i.position.y+n.position.y,u=n.measured.width??0,f=n.measured.height??0,g=o[0]*u,p=o[1]*f;return[[s-g,r-p],[s+u-g,r+f-p]]}function rT({domNode:n,nodeId:i,getStoreItems:o,onChange:s,onEnd:r}){const u=Bt(n);let f={controlDirection:my("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function g({controlPosition:h,boundaries:m,keepAspectRatio:v,resizeDirection:y,onResizeStart:x,onResize:E,onResizeEnd:C,shouldResize:A}){let M={...gv},H={...lT};f={boundaries:m,resizeDirection:y,keepAspectRatio:v,controlDirection:my(h)};let _,z=null,Y=[],O,I,B,Z=!1;const oe=E0().on("start",$=>{const{nodeLookup:ee,transform:se,snapGrid:D,snapToGrid:k,nodeOrigin:T,paneDomNode:U}=o();if(_=ee.get(i),!_)return;z=U?.getBoundingClientRect()??null;const{xSnapped:G,ySnapped:R}=bo($.sourceEvent,{transform:se,snapGrid:D,snapToGrid:k,containerBounds:z});M={width:_.measured.width??0,height:_.measured.height??0,x:_.position.x??0,y:_.position.y??0},H={...M,pointerX:G,pointerY:R,aspectRatio:M.width/M.height},O=void 0,_.parentId&&(_.extent==="parent"||_.expandParent)&&(O=ee.get(_.parentId),I=O&&_.extent==="parent"?oT(O):void 0),Y=[],B=void 0;for(const[F,N]of ee)if(N.parentId===i&&(Y.push({id:F,position:{...N.position},extent:N.extent}),N.extent==="parent"||N.expandParent)){const j=sT(N,_,N.origin??T);B?B=[[Math.min(j[0][0],B[0][0]),Math.min(j[0][1],B[0][1])],[Math.max(j[1][0],B[1][0]),Math.max(j[1][1],B[1][1])]]:B=j}x?.($,{...M})}).on("drag",$=>{const{transform:ee,snapGrid:se,snapToGrid:D,nodeOrigin:k}=o(),T=bo($.sourceEvent,{transform:ee,snapGrid:se,snapToGrid:D,containerBounds:z}),U=[];if(!_)return;const{x:G,y:R,width:F,height:N}=M,j={},W=_.origin??k,{width:te,height:ce,x:de,y:ue}=iT(H,f.controlDirection,T,f.boundaries,f.keepAspectRatio,W,I,B),re=te!==F,fe=ce!==N,Ee=de!==G&&re,xe=ue!==R&&fe;if(!Ee&&!xe&&!re&&!fe)return;if((Ee||xe||W[0]===1||W[1]===1)&&(j.x=Ee?de:M.x,j.y=xe?ue:M.y,M.x=j.x,M.y=j.y,Y.length>0)){const Ie=de-G,Le=ue-R;for(const ct of Y)ct.position={x:ct.position.x-Ie+W[0]*(te-F),y:ct.position.y-Le+W[1]*(ce-N)},U.push(ct)}if((re||fe)&&(j.width=re&&(!f.resizeDirection||f.resizeDirection==="horizontal")?te:M.width,j.height=fe&&(!f.resizeDirection||f.resizeDirection==="vertical")?ce:M.height,M.width=j.width,M.height=j.height),O&&_.expandParent){const Ie=W[0]*(j.width??0);j.x&&j.x<Ie&&(M.x=Ie,H.x=H.x-(j.x-Ie));const Le=W[1]*(j.height??0);j.y&&j.y<Le&&(M.y=Le,H.y=H.y-(j.y-Le))}const ye=aT({width:M.width,prevWidth:F,height:M.height,prevHeight:N,affectsX:f.controlDirection.affectsX,affectsY:f.controlDirection.affectsY}),Se={...M,direction:ye};A?.($,Se)!==!1&&(Z=!0,E?.($,Se),s(j,U))}).on("end",$=>{Z&&(C?.($,{...M}),r?.({...M}),Z=!1)});u.call(oe)}function p(){u.on(".drag",null)}return{update:g,destroy:p}}var jd={exports:{}},Od={},Hd={exports:{}},Ld={};var yy;function cT(){if(yy)return Ld;yy=1;var n=zo();function i(v,y){return v===y&&(v!==0||1/v===1/y)||v!==v&&y!==y}var o=typeof Object.is=="function"?Object.is:i,s=n.useState,r=n.useEffect,u=n.useLayoutEffect,f=n.useDebugValue;function g(v,y){var x=y(),E=s({inst:{value:x,getSnapshot:y}}),C=E[0].inst,A=E[1];return u(function(){C.value=x,C.getSnapshot=y,p(C)&&A({inst:C})},[v,x,y]),r(function(){return p(C)&&A({inst:C}),v(function(){p(C)&&A({inst:C})})},[v]),f(x),x}function p(v){var y=v.getSnapshot;v=v.value;try{var x=y();return!o(v,x)}catch{return!0}}function h(v,y){return y()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:g;return Ld.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:m,Ld}var vy;function uT(){return vy||(vy=1,Hd.exports=cT()),Hd.exports}var Sy;function dT(){if(Sy)return Od;Sy=1;var n=zo(),i=uT();function o(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var s=typeof Object.is=="function"?Object.is:o,r=i.useSyncExternalStore,u=n.useRef,f=n.useEffect,g=n.useMemo,p=n.useDebugValue;return Od.useSyncExternalStoreWithSelector=function(h,m,v,y,x){var E=u(null);if(E.current===null){var C={hasValue:!1,value:null};E.current=C}else C=E.current;E=g(function(){function M(O){if(!H){if(H=!0,_=O,O=y(O),x!==void 0&&C.hasValue){var I=C.value;if(x(I,O))return z=I}return z=O}if(I=z,s(_,O))return I;var B=y(O);return x!==void 0&&x(I,B)?(_=O,I):(_=O,z=B)}var H=!1,_,z,Y=v===void 0?null:v;return[function(){return M(m())},Y===null?void 0:function(){return M(Y())}]},[m,v,y,x]);var A=r(h,E[0],E[1]);return f(function(){C.hasValue=!0,C.value=A},[A]),p(A),A},Od}var by;function fT(){return by||(by=1,jd.exports=dT()),jd.exports}var hT=fT();const gT=Zy(hT),mT={},xy=n=>{let i;const o=new Set,s=(m,v)=>{const y=typeof m=="function"?m(i):m;if(!Object.is(y,i)){const x=i;i=v??(typeof y!="object"||y===null)?y:Object.assign({},i,y),o.forEach(E=>E(i,x))}},r=()=>i,p={setState:s,getState:r,getInitialState:()=>h,subscribe:m=>(o.add(m),()=>o.delete(m)),destroy:()=>{(mT?"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."),o.clear()}},h=i=n(s,r,p);return p},pT=n=>n?xy(n):xy,{useDebugValue:yT}=go,{useSyncExternalStoreWithSelector:vT}=gT,ST=n=>n;function mv(n,i=ST,o){const s=vT(n.subscribe,n.getState,n.getServerState||n.getInitialState,i,o);return yT(s),s}const _y=(n,i)=>{const o=pT(n),s=(r,u=i)=>mv(o,r,u);return Object.assign(s,o),s},bT=(n,i)=>n?_y(n,i):_y;function Ke(n,i){if(Object.is(n,i))return!0;if(typeof n!="object"||n===null||typeof i!="object"||i===null)return!1;if(n instanceof Map&&i instanceof Map){if(n.size!==i.size)return!1;for(const[s,r]of n)if(!Object.is(r,i.get(s)))return!1;return!0}if(n instanceof Set&&i instanceof Set){if(n.size!==i.size)return!1;for(const s of n)if(!i.has(s))return!1;return!0}const o=Object.keys(n);if(o.length!==Object.keys(i).length)return!1;for(const s of o)if(!Object.prototype.hasOwnProperty.call(i,s)||!Object.is(n[s],i[s]))return!1;return!0}$y();const Vr=V.createContext(null),xT=Vr.Provider,pv=mn.error001();function Re(n,i){const o=V.useContext(Vr);if(o===null)throw new Error(pv);return mv(o,n,i)}function Qe(){const n=V.useContext(Vr);if(n===null)throw new Error(pv);return V.useMemo(()=>({getState:n.getState,setState:n.setState,subscribe:n.subscribe}),[n])}const wy={display:"none"},_T={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},yv="react-flow__node-desc",vv="react-flow__edge-desc",wT="react-flow__aria-live",ET=n=>n.ariaLiveMessage,NT=n=>n.ariaLabelConfig;function TT({rfId:n}){const i=Re(ET);return S.jsx("div",{id:`${wT}-${n}`,"aria-live":"assertive","aria-atomic":"true",style:_T,children:i})}function AT({rfId:n,disableKeyboardA11y:i}){const o=Re(NT);return S.jsxs(S.Fragment,{children:[S.jsx("div",{id:`${yv}-${n}`,style:wy,children:i?o["node.a11yDescription.default"]:o["node.a11yDescription.keyboardDisabled"]}),S.jsx("div",{id:`${vv}-${n}`,style:wy,children:o["edge.a11yDescription.default"]}),!i&&S.jsx(TT,{rfId:n})]})}const Xr=V.forwardRef(({position:n="top-left",children:i,className:o,style:s,...r},u)=>{const f=`${n}`.split("-");return S.jsx("div",{className:ot(["react-flow__panel",o,...f]),style:s,ref:u,...r,children:i})});Xr.displayName="Panel";function CT({proOptions:n,position:i="bottom-right"}){return n?.hideAttribution?null:S.jsx(Xr,{position:i,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:S.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const MT=n=>{const i=[],o=[];for(const[,s]of n.nodeLookup)s.selected&&i.push(s.internals.userNode);for(const[,s]of n.edgeLookup)s.selected&&o.push(s);return{selectedNodes:i,selectedEdges:o}},pr=n=>n.id;function zT(n,i){return Ke(n.selectedNodes.map(pr),i.selectedNodes.map(pr))&&Ke(n.selectedEdges.map(pr),i.selectedEdges.map(pr))}function DT({onSelectionChange:n}){const i=Qe(),{selectedNodes:o,selectedEdges:s}=Re(MT,zT);return V.useEffect(()=>{const r={nodes:o,edges:s};n?.(r),i.getState().onSelectionChangeHandlers.forEach(u=>u(r))},[o,s,n]),null}const RT=n=>!!n.onSelectionChangeHandlers;function jT({onSelectionChange:n}){const i=Re(RT);return n||i?S.jsx(DT,{onSelectionChange:n}):null}const tf=typeof window<"u"?V.useLayoutEffect:V.useEffect,Sv=[0,0],OT={x:0,y:0,zoom:1},HT=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Ey=[...HT,"rfId"],LT=n=>({setNodes:n.setNodes,setEdges:n.setEdges,setMinZoom:n.setMinZoom,setMaxZoom:n.setMaxZoom,setTranslateExtent:n.setTranslateExtent,setNodeExtent:n.setNodeExtent,reset:n.reset,setDefaultNodesAndEdges:n.setDefaultNodesAndEdges}),Ny={translateExtent:No,nodeOrigin:Sv,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function UT(n){const{setNodes:i,setEdges:o,setMinZoom:s,setMaxZoom:r,setTranslateExtent:u,setNodeExtent:f,reset:g,setDefaultNodesAndEdges:p}=Re(LT,Ke),h=Qe();tf(()=>(p(n.defaultNodes,n.defaultEdges),()=>{m.current=Ny,g()}),[]);const m=V.useRef(Ny);return tf(()=>{for(const v of Ey){const y=n[v],x=m.current[v];y!==x&&(typeof n[v]>"u"||(v==="nodes"?i(y):v==="edges"?o(y):v==="minZoom"?s(y):v==="maxZoom"?r(y):v==="translateExtent"?u(y):v==="nodeExtent"?f(y):v==="ariaLabelConfig"?h.setState({ariaLabelConfig:bN(y)}):v==="fitView"?h.setState({fitViewQueued:y}):v==="fitViewOptions"?h.setState({fitViewOptions:y}):h.setState({[v]:y})))}m.current=n},Ey.map(v=>n[v])),null}function Ty(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function BT(n){const[i,o]=V.useState(n==="system"?null:n);return V.useEffect(()=>{if(n!=="system"){o(n);return}const s=Ty(),r=()=>o(s?.matches?"dark":"light");return r(),s?.addEventListener("change",r),()=>{s?.removeEventListener("change",r)}},[n]),i!==null?i:Ty()?.matches?"dark":"light"}const Ay=typeof document<"u"?document:null;function Mo(n=null,i={target:Ay,actInsideInputWithModifier:!0}){const[o,s]=V.useState(!1),r=V.useRef(!1),u=V.useRef(new Set([])),[f,g]=V.useMemo(()=>{if(n!==null){const h=(Array.isArray(n)?n:[n]).filter(v=>typeof v=="string").map(v=>v.replace("+",`
|
|
16
|
-
`).replace(`
|
|
17
|
-
|
|
18
|
-
`,`
|
|
19
|
-
+`).split(`
|
|
20
|
-
`)),m=h.reduce((v,y)=>v.concat(...y),[]);return[h,m]}return[[],[]]},[n]);return V.useEffect(()=>{const p=i?.target??Ay,h=i?.actInsideInputWithModifier??!0;if(n!==null){const m=x=>{if(r.current=x.ctrlKey||x.metaKey||x.shiftKey||x.altKey,(!r.current||r.current&&!h)&&P0(x))return!1;const C=My(x.code,g);if(u.current.add(x[C]),Cy(f,u.current,!1)){const A=x.composedPath?.()?.[0]||x.target,M=A?.nodeName==="BUTTON"||A?.nodeName==="A";i.preventDefault!==!1&&(r.current||!M)&&x.preventDefault(),s(!0)}},v=x=>{const E=My(x.code,g);Cy(f,u.current,!0)?(s(!1),u.current.clear()):u.current.delete(x[E]),x.key==="Meta"&&u.current.clear(),r.current=!1},y=()=>{u.current.clear(),s(!1)};return p?.addEventListener("keydown",m),p?.addEventListener("keyup",v),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{p?.removeEventListener("keydown",m),p?.removeEventListener("keyup",v),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[n,s]),o}function Cy(n,i,o){return n.filter(s=>o||s.length===i.size).some(s=>s.every(r=>i.has(r)))}function My(n,i){return i.includes(n)?"code":"key"}const IT=()=>{const n=Qe();return V.useMemo(()=>({zoomIn:i=>{const{panZoom:o}=n.getState();return o?o.scaleBy(1.2,i):Promise.resolve(!1)},zoomOut:i=>{const{panZoom:o}=n.getState();return o?o.scaleBy(1/1.2,i):Promise.resolve(!1)},zoomTo:(i,o)=>{const{panZoom:s}=n.getState();return s?s.scaleTo(i,o):Promise.resolve(!1)},getZoom:()=>n.getState().transform[2],setViewport:async(i,o)=>{const{transform:[s,r,u],panZoom:f}=n.getState();return f?(await f.setViewport({x:i.x??s,y:i.y??r,zoom:i.zoom??u},o),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[i,o,s]=n.getState().transform;return{x:i,y:o,zoom:s}},setCenter:async(i,o,s)=>n.getState().setCenter(i,o,s),fitBounds:async(i,o)=>{const{width:s,height:r,minZoom:u,maxZoom:f,panZoom:g}=n.getState(),p=hf(i,s,r,u,f,o?.padding??.1);return g?(await g.setViewport(p,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(i,o={})=>{const{transform:s,snapGrid:r,snapToGrid:u,domNode:f}=n.getState();if(!f)return i;const{x:g,y:p}=f.getBoundingClientRect(),h={x:i.x-g,y:i.y-p},m=o.snapGrid??r,v=o.snapToGrid??u;return Lo(h,s,v,m)},flowToScreenPosition:i=>{const{transform:o,domNode:s}=n.getState();if(!s)return i;const{x:r,y:u}=s.getBoundingClientRect(),f=Or(i,o);return{x:f.x+r,y:f.y+u}}}),[])};function bv(n,i){const o=[],s=new Map,r=[];for(const u of n)if(u.type==="add"){r.push(u);continue}else if(u.type==="remove"||u.type==="replace")s.set(u.id,[u]);else{const f=s.get(u.id);f?f.push(u):s.set(u.id,[u])}for(const u of i){const f=s.get(u.id);if(!f){o.push(u);continue}if(f[0].type==="remove")continue;if(f[0].type==="replace"){o.push({...f[0].item});continue}const g={...u};for(const p of f)qT(p,g);o.push(g)}return r.length&&r.forEach(u=>{u.index!==void 0?o.splice(u.index,0,{...u.item}):o.push({...u.item})}),o}function qT(n,i){switch(n.type){case"select":{i.selected=n.selected;break}case"position":{typeof n.position<"u"&&(i.position=n.position),typeof n.dragging<"u"&&(i.dragging=n.dragging);break}case"dimensions":{typeof n.dimensions<"u"&&(i.measured={...n.dimensions},n.setAttributes&&((n.setAttributes===!0||n.setAttributes==="width")&&(i.width=n.dimensions.width),(n.setAttributes===!0||n.setAttributes==="height")&&(i.height=n.dimensions.height))),typeof n.resizing=="boolean"&&(i.resizing=n.resizing);break}}}function xv(n,i){return bv(n,i)}function _v(n,i){return bv(n,i)}function Ja(n,i){return{id:n,type:"select",selected:i}}function tl(n,i=new Set,o=!1){const s=[];for(const[r,u]of n){const f=i.has(r);!(u.selected===void 0&&!f)&&u.selected!==f&&(o&&(u.selected=f),s.push(Ja(u.id,f)))}return s}function zy({items:n=[],lookup:i}){const o=[],s=new Map(n.map(r=>[r.id,r]));for(const[r,u]of n.entries()){const f=i.get(u.id),g=f?.internals?.userNode??f;g!==void 0&&g!==u&&o.push({id:u.id,item:u,type:"replace"}),g===void 0&&o.push({item:u,type:"add",index:r})}for(const[r]of i)s.get(r)===void 0&&o.push({id:r,type:"remove"});return o}function Dy(n){return{id:n.id,type:"remove"}}const Ry=n=>uN(n),GT=n=>V0(n);function wv(n){return V.forwardRef(n)}function jy(n){const[i,o]=V.useState(BigInt(0)),[s]=V.useState(()=>kT(()=>o(r=>r+BigInt(1))));return tf(()=>{const r=s.get();r.length&&(n(r),s.reset())},[i]),s}function kT(n){let i=[];return{get:()=>i,reset:()=>{i=[]},push:o=>{i.push(o),n()}}}const Ev=V.createContext(null);function YT({children:n}){const i=Qe(),o=V.useCallback(g=>{const{nodes:p=[],setNodes:h,hasDefaultNodes:m,onNodesChange:v,nodeLookup:y,fitViewQueued:x,onNodesChangeMiddlewareMap:E}=i.getState();let C=p;for(const M of g)C=typeof M=="function"?M(C):M;let A=zy({items:C,lookup:y});for(const M of E.values())A=M(A);m&&h(C),A.length>0?v?.(A):x&&window.requestAnimationFrame(()=>{const{fitViewQueued:M,nodes:H,setNodes:_}=i.getState();M&&_(H)})},[]),s=jy(o),r=V.useCallback(g=>{const{edges:p=[],setEdges:h,hasDefaultEdges:m,onEdgesChange:v,edgeLookup:y}=i.getState();let x=p;for(const E of g)x=typeof E=="function"?E(x):E;m?h(x):v&&v(zy({items:x,lookup:y}))},[]),u=jy(r),f=V.useMemo(()=>({nodeQueue:s,edgeQueue:u}),[]);return S.jsx(Ev.Provider,{value:f,children:n})}function VT(){const n=V.useContext(Ev);if(!n)throw new Error("useBatchContext must be used within a BatchProvider");return n}const XT=n=>!!n.panZoom;function Zr(){const n=IT(),i=Qe(),o=VT(),s=Re(XT),r=V.useMemo(()=>{const u=v=>i.getState().nodeLookup.get(v),f=v=>{o.nodeQueue.push(v)},g=v=>{o.edgeQueue.push(v)},p=v=>{const{nodeLookup:y,nodeOrigin:x}=i.getState(),E=Ry(v)?v:y.get(v.id),C=E.parentId?F0(E.position,E.measured,E.parentId,y,x):E.position,A={...E,position:C,width:E.measured?.width??E.width,height:E.measured?.height??E.height};return ul(A)},h=(v,y,x={replace:!1})=>{f(E=>E.map(C=>{if(C.id===v){const A=typeof y=="function"?y(C):y;return x.replace&&Ry(A)?A:{...C,...A}}return C}))},m=(v,y,x={replace:!1})=>{g(E=>E.map(C=>{if(C.id===v){const A=typeof y=="function"?y(C):y;return x.replace&>(A)?A:{...C,...A}}return C}))};return{getNodes:()=>i.getState().nodes.map(v=>({...v})),getNode:v=>u(v)?.internals.userNode,getInternalNode:u,getEdges:()=>{const{edges:v=[]}=i.getState();return v.map(y=>({...y}))},getEdge:v=>i.getState().edgeLookup.get(v),setNodes:f,setEdges:g,addNodes:v=>{const y=Array.isArray(v)?v:[v];o.nodeQueue.push(x=>[...x,...y])},addEdges:v=>{const y=Array.isArray(v)?v:[v];o.edgeQueue.push(x=>[...x,...y])},toObject:()=>{const{nodes:v=[],edges:y=[],transform:x}=i.getState(),[E,C,A]=x;return{nodes:v.map(M=>({...M})),edges:y.map(M=>({...M})),viewport:{x:E,y:C,zoom:A}}},deleteElements:async({nodes:v=[],edges:y=[]})=>{const{nodes:x,edges:E,onNodesDelete:C,onEdgesDelete:A,triggerNodeChanges:M,triggerEdgeChanges:H,onDelete:_,onBeforeDelete:z}=i.getState(),{nodes:Y,edges:O}=await mN({nodesToRemove:v,edgesToRemove:y,nodes:x,edges:E,onBeforeDelete:z}),I=O.length>0,B=Y.length>0;if(I){const Z=O.map(Dy);A?.(O),H(Z)}if(B){const Z=Y.map(Dy);C?.(Y),M(Z)}return(B||I)&&_?.({nodes:Y,edges:O}),{deletedNodes:Y,deletedEdges:O}},getIntersectingNodes:(v,y=!0,x)=>{const E=iy(v),C=E?v:p(v),A=x!==void 0;return C?(x||i.getState().nodes).filter(M=>{const H=i.getState().nodeLookup.get(M.id);if(H&&!E&&(M.id===v.id||!H.internals.positionAbsolute))return!1;const _=ul(A?M:H),z=Ao(_,C);return y&&z>0||z>=_.width*_.height||z>=C.width*C.height}):[]},isNodeIntersecting:(v,y,x=!0)=>{const C=iy(v)?v:p(v);if(!C)return!1;const A=Ao(C,y);return x&&A>0||A>=y.width*y.height||A>=C.width*C.height},updateNode:h,updateNodeData:(v,y,x={replace:!1})=>{h(v,E=>{const C=typeof y=="function"?y(E):y;return x.replace?{...E,data:C}:{...E,data:{...E.data,...C}}},x)},updateEdge:m,updateEdgeData:(v,y,x={replace:!1})=>{m(v,E=>{const C=typeof y=="function"?y(E):y;return x.replace?{...E,data:C}:{...E,data:{...E.data,...C}}},x)},getNodesBounds:v=>{const{nodeLookup:y,nodeOrigin:x}=i.getState();return dN(v,{nodeLookup:y,nodeOrigin:x})},getHandleConnections:({type:v,id:y,nodeId:x})=>Array.from(i.getState().connectionLookup.get(`${x}-${v}${y?`-${y}`:""}`)?.values()??[]),getNodeConnections:({type:v,handleId:y,nodeId:x})=>Array.from(i.getState().connectionLookup.get(`${x}${v?y?`-${v}-${y}`:`-${v}`:""}`)?.values()??[]),fitView:async v=>{const y=i.getState().fitViewResolver??SN();return i.setState({fitViewQueued:!0,fitViewOptions:v,fitViewResolver:y}),o.nodeQueue.push(x=>[...x]),y.promise}}},[]);return V.useMemo(()=>({...r,...n,viewportInitialized:s}),[s])}const Oy=n=>n.selected,ZT=typeof window<"u"?window:void 0;function $T({deleteKeyCode:n,multiSelectionKeyCode:i}){const o=Qe(),{deleteElements:s}=Zr(),r=Mo(n,{actInsideInputWithModifier:!1}),u=Mo(i,{target:ZT});V.useEffect(()=>{if(r){const{edges:f,nodes:g}=o.getState();s({nodes:g.filter(Oy),edges:f.filter(Oy)}),o.setState({nodesSelectionActive:!1})}},[r]),V.useEffect(()=>{o.setState({multiSelectionActive:u})},[u])}function KT(n){const i=Qe();V.useEffect(()=>{const o=()=>{if(!n.current||!(n.current.checkVisibility?.()??!0))return!1;const s=gf(n.current);(s.height===0||s.width===0)&&i.getState().onError?.("004",mn.error004()),i.setState({width:s.width||500,height:s.height||500})};if(n.current){o(),window.addEventListener("resize",o);const s=new ResizeObserver(()=>o());return s.observe(n.current),()=>{window.removeEventListener("resize",o),s&&n.current&&s.unobserve(n.current)}}},[])}const $r={position:"absolute",width:"100%",height:"100%",top:0,left:0},QT=n=>({userSelectionActive:n.userSelectionActive,lib:n.lib,connectionInProgress:n.connection.inProgress});function FT({onPaneContextMenu:n,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:s=!1,panOnScrollSpeed:r=.5,panOnScrollMode:u=ni.Free,zoomOnDoubleClick:f=!0,panOnDrag:g=!0,defaultViewport:p,translateExtent:h,minZoom:m,maxZoom:v,zoomActivationKeyCode:y,preventScrolling:x=!0,children:E,noWheelClassName:C,noPanClassName:A,onViewportChange:M,isControlledViewport:H,paneClickDistance:_,selectionOnDrag:z}){const Y=Qe(),O=V.useRef(null),{userSelectionActive:I,lib:B,connectionInProgress:Z}=Re(QT,Ke),oe=Mo(y),$=V.useRef();KT(O);const ee=V.useCallback(se=>{M?.({x:se[0],y:se[1],zoom:se[2]}),H||Y.setState({transform:se})},[M,H]);return V.useEffect(()=>{if(O.current){$.current=nT({domNode:O.current,minZoom:m,maxZoom:v,translateExtent:h,viewport:p,onDraggingChange:T=>Y.setState(U=>U.paneDragging===T?U:{paneDragging:T}),onPanZoomStart:(T,U)=>{const{onViewportChangeStart:G,onMoveStart:R}=Y.getState();R?.(T,U),G?.(U)},onPanZoom:(T,U)=>{const{onViewportChange:G,onMove:R}=Y.getState();R?.(T,U),G?.(U)},onPanZoomEnd:(T,U)=>{const{onViewportChangeEnd:G,onMoveEnd:R}=Y.getState();R?.(T,U),G?.(U)}});const{x:se,y:D,zoom:k}=$.current.getViewport();return Y.setState({panZoom:$.current,transform:[se,D,k],domNode:O.current.closest(".react-flow")}),()=>{$.current?.destroy()}}},[]),V.useEffect(()=>{$.current?.update({onPaneContextMenu:n,zoomOnScroll:i,zoomOnPinch:o,panOnScroll:s,panOnScrollSpeed:r,panOnScrollMode:u,zoomOnDoubleClick:f,panOnDrag:g,zoomActivationKeyPressed:oe,preventScrolling:x,noPanClassName:A,userSelectionActive:I,noWheelClassName:C,lib:B,onTransformChange:ee,connectionInProgress:Z,selectionOnDrag:z,paneClickDistance:_})},[n,i,o,s,r,u,f,g,oe,x,A,I,C,B,ee,Z,z,_]),S.jsx("div",{className:"react-flow__renderer",ref:O,style:$r,children:E})}const JT=n=>({userSelectionActive:n.userSelectionActive,userSelectionRect:n.userSelectionRect});function PT(){const{userSelectionActive:n,userSelectionRect:i}=Re(JT,Ke);return n&&i?S.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:i.width,height:i.height,transform:`translate(${i.x}px, ${i.y}px)`}}):null}const Ud=(n,i)=>o=>{o.target===i.current&&n?.(o)},WT=n=>({userSelectionActive:n.userSelectionActive,elementsSelectable:n.elementsSelectable,connectionInProgress:n.connection.inProgress,dragging:n.paneDragging});function eA({isSelecting:n,selectionKeyPressed:i,selectionMode:o=To.Full,panOnDrag:s,paneClickDistance:r,selectionOnDrag:u,onSelectionStart:f,onSelectionEnd:g,onPaneClick:p,onPaneContextMenu:h,onPaneScroll:m,onPaneMouseEnter:v,onPaneMouseMove:y,onPaneMouseLeave:x,children:E}){const C=Qe(),{userSelectionActive:A,elementsSelectable:M,dragging:H,connectionInProgress:_}=Re(WT,Ke),z=M&&(n||A),Y=V.useRef(null),O=V.useRef(),I=V.useRef(new Set),B=V.useRef(new Set),Z=V.useRef(!1),oe=G=>{if(Z.current||_){Z.current=!1;return}p?.(G),C.getState().resetSelectedElements(),C.setState({nodesSelectionActive:!1})},$=G=>{if(Array.isArray(s)&&s?.includes(2)){G.preventDefault();return}h?.(G)},ee=m?G=>m(G):void 0,se=G=>{Z.current&&(G.stopPropagation(),Z.current=!1)},D=G=>{const{domNode:R}=C.getState();if(O.current=R?.getBoundingClientRect(),!O.current)return;const F=G.target===Y.current;if(!F&&!!G.target.closest(".nokey")||!n||!(u&&F||i)||G.button!==0||!G.isPrimary)return;G.target?.setPointerCapture?.(G.pointerId),Z.current=!1;const{x:W,y:te}=an(G.nativeEvent,O.current);C.setState({userSelectionRect:{width:0,height:0,startX:W,startY:te,x:W,y:te}}),F||(G.stopPropagation(),G.preventDefault())},k=G=>{const{userSelectionRect:R,transform:F,nodeLookup:N,edgeLookup:j,connectionLookup:W,triggerNodeChanges:te,triggerEdgeChanges:ce,defaultEdgeOptions:de,resetSelectedElements:ue}=C.getState();if(!O.current||!R)return;const{x:re,y:fe}=an(G.nativeEvent,O.current),{startX:Ee,startY:xe}=R;if(!Z.current){const Le=i?0:r;if(Math.hypot(re-Ee,fe-xe)<=Le)return;ue(),f?.(G)}Z.current=!0;const ye={startX:Ee,startY:xe,x:re<Ee?re:Ee,y:fe<xe?fe:xe,width:Math.abs(re-Ee),height:Math.abs(fe-xe)},Se=I.current,Ce=B.current;I.current=new Set(ff(N,ye,F,o===To.Partial,!0).map(Le=>Le.id)),B.current=new Set;const Ie=de?.selectable??!0;for(const Le of I.current){const ct=W.get(Le);if(ct)for(const{edgeId:Kt}of ct.values()){const zt=j.get(Kt);zt&&(zt.selectable??Ie)&&B.current.add(Kt)}}if(!ly(Se,I.current)){const Le=tl(N,I.current,!0);te(Le)}if(!ly(Ce,B.current)){const Le=tl(j,B.current);ce(Le)}C.setState({userSelectionRect:ye,userSelectionActive:!0,nodesSelectionActive:!1})},T=G=>{G.button===0&&(G.target?.releasePointerCapture?.(G.pointerId),!A&&G.target===Y.current&&C.getState().userSelectionRect&&oe?.(G),C.setState({userSelectionActive:!1,userSelectionRect:null}),Z.current&&(g?.(G),C.setState({nodesSelectionActive:I.current.size>0})))},U=s===!0||Array.isArray(s)&&s.includes(0);return S.jsxs("div",{className:ot(["react-flow__pane",{draggable:U,dragging:H,selection:n}]),onClick:z?void 0:Ud(oe,Y),onContextMenu:Ud($,Y),onWheel:Ud(ee,Y),onPointerEnter:z?void 0:v,onPointerMove:z?k:y,onPointerUp:z?T:void 0,onPointerDownCapture:z?D:void 0,onClickCapture:z?se:void 0,onPointerLeave:x,ref:Y,style:$r,children:[E,S.jsx(PT,{})]})}function nf({id:n,store:i,unselect:o=!1,nodeRef:s}){const{addSelectedNodes:r,unselectNodesAndEdges:u,multiSelectionActive:f,nodeLookup:g,onError:p}=i.getState(),h=g.get(n);if(!h){p?.("012",mn.error012(n));return}i.setState({nodesSelectionActive:!1}),h.selected?(o||h.selected&&f)&&(u({nodes:[h],edges:[]}),requestAnimationFrame(()=>s?.current?.blur())):r([n])}function Nv({nodeRef:n,disabled:i=!1,noDragClassName:o,handleSelector:s,nodeId:r,isSelectable:u,nodeClickDistance:f}){const g=Qe(),[p,h]=V.useState(!1),m=V.useRef();return V.useEffect(()=>{m.current=kN({getStoreItems:()=>g.getState(),onNodeMouseDown:v=>{nf({id:v,store:g,nodeRef:n})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),V.useEffect(()=>{if(!(i||!n.current||!m.current))return m.current.update({noDragClassName:o,handleSelector:s,domNode:n.current,isSelectable:u,nodeId:r,nodeClickDistance:f}),()=>{m.current?.destroy()}},[o,s,i,u,n,r,f]),p}const tA=n=>i=>i.selected&&(i.draggable||n&&typeof i.draggable>"u");function Tv(){const n=Qe();return V.useCallback(o=>{const{nodeExtent:s,snapToGrid:r,snapGrid:u,nodesDraggable:f,onError:g,updateNodePositions:p,nodeLookup:h,nodeOrigin:m}=n.getState(),v=new Map,y=tA(f),x=r?u[0]:5,E=r?u[1]:5,C=o.direction.x*x*o.factor,A=o.direction.y*E*o.factor;for(const[,M]of h){if(!y(M))continue;let H={x:M.internals.positionAbsolute.x+C,y:M.internals.positionAbsolute.y+A};r&&(H=Ho(H,u));const{position:_,positionAbsolute:z}=X0({nodeId:M.id,nextPosition:H,nodeLookup:h,nodeExtent:s,nodeOrigin:m,onError:g});M.position=_,M.internals.positionAbsolute=z,v.set(M.id,M)}p(v)},[])}const bf=V.createContext(null),nA=bf.Provider;bf.Consumer;const Av=()=>V.useContext(bf),aA=n=>({connectOnClick:n.connectOnClick,noPanClassName:n.noPanClassName,rfId:n.rfId}),iA=(n,i,o)=>s=>{const{connectionClickStartHandle:r,connectionMode:u,connection:f}=s,{fromHandle:g,toHandle:p,isValid:h}=f,m=p?.nodeId===n&&p?.id===i&&p?.type===o;return{connectingFrom:g?.nodeId===n&&g?.id===i&&g?.type===o,connectingTo:m,clickConnecting:r?.nodeId===n&&r?.id===i&&r?.type===o,isPossibleEndHandle:u===rl.Strict?g?.type!==o:n!==g?.nodeId||i!==g?.id,connectionInProcess:!!g,clickConnectionInProcess:!!r,valid:m&&h}};function lA({type:n="source",position:i=me.Top,isValidConnection:o,isConnectable:s=!0,isConnectableStart:r=!0,isConnectableEnd:u=!0,id:f,onConnect:g,children:p,className:h,onMouseDown:m,onTouchStart:v,...y},x){const E=f||null,C=n==="target",A=Qe(),M=Av(),{connectOnClick:H,noPanClassName:_,rfId:z}=Re(aA,Ke),{connectingFrom:Y,connectingTo:O,clickConnecting:I,isPossibleEndHandle:B,connectionInProcess:Z,clickConnectionInProcess:oe,valid:$}=Re(iA(M,E,n),Ke);M||A.getState().onError?.("010",mn.error010());const ee=k=>{const{defaultEdgeOptions:T,onConnect:U,hasDefaultEdges:G}=A.getState(),R={...T,...k};if(G){const{edges:F,setEdges:N}=A.getState();N(TN(R,F))}U?.(R),g?.(R)},se=k=>{if(!M)return;const T=W0(k.nativeEvent);if(r&&(T&&k.button===0||!T)){const U=A.getState();ef.onPointerDown(k.nativeEvent,{handleDomNode:k.currentTarget,autoPanOnConnect:U.autoPanOnConnect,connectionMode:U.connectionMode,connectionRadius:U.connectionRadius,domNode:U.domNode,nodeLookup:U.nodeLookup,lib:U.lib,isTarget:C,handleId:E,nodeId:M,flowId:U.rfId,panBy:U.panBy,cancelConnection:U.cancelConnection,onConnectStart:U.onConnectStart,onConnectEnd:(...G)=>A.getState().onConnectEnd?.(...G),updateConnection:U.updateConnection,onConnect:ee,isValidConnection:o||((...G)=>A.getState().isValidConnection?.(...G)??!0),getTransform:()=>A.getState().transform,getFromHandle:()=>A.getState().connection.fromHandle,autoPanSpeed:U.autoPanSpeed,dragThreshold:U.connectionDragThreshold})}T?m?.(k):v?.(k)},D=k=>{const{onClickConnectStart:T,onClickConnectEnd:U,connectionClickStartHandle:G,connectionMode:R,isValidConnection:F,lib:N,rfId:j,nodeLookup:W,connection:te}=A.getState();if(!M||!G&&!r)return;if(!G){T?.(k.nativeEvent,{nodeId:M,handleId:E,handleType:n}),A.setState({connectionClickStartHandle:{nodeId:M,type:n,id:E}});return}const ce=J0(k.target),de=o||F,{connection:ue,isValid:re}=ef.isValid(k.nativeEvent,{handle:{nodeId:M,id:E,type:n},connectionMode:R,fromNodeId:G.nodeId,fromHandleId:G.id||null,fromType:G.type,isValidConnection:de,flowId:j,doc:ce,lib:N,nodeLookup:W});re&&ue&&ee(ue);const fe=structuredClone(te);delete fe.inProgress,fe.toPosition=fe.toHandle?fe.toHandle.position:null,U?.(k,fe),A.setState({connectionClickStartHandle:null})};return S.jsx("div",{"data-handleid":E,"data-nodeid":M,"data-handlepos":i,"data-id":`${z}-${M}-${E}-${n}`,className:ot(["react-flow__handle",`react-flow__handle-${i}`,"nodrag",_,h,{source:!C,target:C,connectable:s,connectablestart:r,connectableend:u,clickconnecting:I,connectingfrom:Y,connectingto:O,valid:$,connectionindicator:s&&(!Z||B)&&(Z||oe?u:r)}]),onMouseDown:se,onTouchStart:se,onClick:H?D:void 0,ref:x,...y,children:p})}const hl=V.memo(wv(lA));function oA({data:n,isConnectable:i,sourcePosition:o=me.Bottom}){return S.jsxs(S.Fragment,{children:[n?.label,S.jsx(hl,{type:"source",position:o,isConnectable:i})]})}function sA({data:n,isConnectable:i,targetPosition:o=me.Top,sourcePosition:s=me.Bottom}){return S.jsxs(S.Fragment,{children:[S.jsx(hl,{type:"target",position:o,isConnectable:i}),n?.label,S.jsx(hl,{type:"source",position:s,isConnectable:i})]})}function rA(){return null}function cA({data:n,isConnectable:i,targetPosition:o=me.Top}){return S.jsxs(S.Fragment,{children:[S.jsx(hl,{type:"target",position:o,isConnectable:i}),n?.label]})}const Hr={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Hy={input:oA,default:sA,output:cA,group:rA};function uA(n){return n.internals.handleBounds===void 0?{width:n.width??n.initialWidth??n.style?.width,height:n.height??n.initialHeight??n.style?.height}:{width:n.width??n.style?.width,height:n.height??n.style?.height}}const dA=n=>{const{width:i,height:o,x:s,y:r}=Oo(n.nodeLookup,{filter:u=>!!u.selected});return{width:nn(i)?i:null,height:nn(o)?o:null,userSelectionActive:n.userSelectionActive,transformString:`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]}) translate(${s}px,${r}px)`}};function fA({onSelectionContextMenu:n,noPanClassName:i,disableKeyboardA11y:o}){const s=Qe(),{width:r,height:u,transformString:f,userSelectionActive:g}=Re(dA,Ke),p=Tv(),h=V.useRef(null);V.useEffect(()=>{o||h.current?.focus({preventScroll:!0})},[o]);const m=!g&&r!==null&&u!==null;if(Nv({nodeRef:h,disabled:!m}),!m)return null;const v=n?x=>{const E=s.getState().nodes.filter(C=>C.selected);n(x,E)}:void 0,y=x=>{Object.prototype.hasOwnProperty.call(Hr,x.key)&&(x.preventDefault(),p({direction:Hr[x.key],factor:x.shiftKey?4:1}))};return S.jsx("div",{className:ot(["react-flow__nodesselection","react-flow__container",i]),style:{transform:f},children:S.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:o?void 0:-1,onKeyDown:o?void 0:y,style:{width:r,height:u}})})}const Ly=typeof window<"u"?window:void 0,hA=n=>({nodesSelectionActive:n.nodesSelectionActive,userSelectionActive:n.userSelectionActive});function Cv({children:n,onPaneClick:i,onPaneMouseEnter:o,onPaneMouseMove:s,onPaneMouseLeave:r,onPaneContextMenu:u,onPaneScroll:f,paneClickDistance:g,deleteKeyCode:p,selectionKeyCode:h,selectionOnDrag:m,selectionMode:v,onSelectionStart:y,onSelectionEnd:x,multiSelectionKeyCode:E,panActivationKeyCode:C,zoomActivationKeyCode:A,elementsSelectable:M,zoomOnScroll:H,zoomOnPinch:_,panOnScroll:z,panOnScrollSpeed:Y,panOnScrollMode:O,zoomOnDoubleClick:I,panOnDrag:B,defaultViewport:Z,translateExtent:oe,minZoom:$,maxZoom:ee,preventScrolling:se,onSelectionContextMenu:D,noWheelClassName:k,noPanClassName:T,disableKeyboardA11y:U,onViewportChange:G,isControlledViewport:R}){const{nodesSelectionActive:F,userSelectionActive:N}=Re(hA,Ke),j=Mo(h,{target:Ly}),W=Mo(C,{target:Ly}),te=W||B,ce=W||z,de=m&&te!==!0,ue=j||N||de;return $T({deleteKeyCode:p,multiSelectionKeyCode:E}),S.jsx(FT,{onPaneContextMenu:u,elementsSelectable:M,zoomOnScroll:H,zoomOnPinch:_,panOnScroll:ce,panOnScrollSpeed:Y,panOnScrollMode:O,zoomOnDoubleClick:I,panOnDrag:!j&&te,defaultViewport:Z,translateExtent:oe,minZoom:$,maxZoom:ee,zoomActivationKeyCode:A,preventScrolling:se,noWheelClassName:k,noPanClassName:T,onViewportChange:G,isControlledViewport:R,paneClickDistance:g,selectionOnDrag:de,children:S.jsxs(eA,{onSelectionStart:y,onSelectionEnd:x,onPaneClick:i,onPaneMouseEnter:o,onPaneMouseMove:s,onPaneMouseLeave:r,onPaneContextMenu:u,onPaneScroll:f,panOnDrag:te,isSelecting:!!ue,selectionMode:v,selectionKeyPressed:j,paneClickDistance:g,selectionOnDrag:de,children:[n,F&&S.jsx(fA,{onSelectionContextMenu:D,noPanClassName:T,disableKeyboardA11y:U})]})})}Cv.displayName="FlowRenderer";const gA=V.memo(Cv),mA=n=>i=>n?ff(i.nodeLookup,{x:0,y:0,width:i.width,height:i.height},i.transform,!0).map(o=>o.id):Array.from(i.nodeLookup.keys());function pA(n){return Re(V.useCallback(mA(n),[n]),Ke)}const yA=n=>n.updateNodeInternals;function vA(){const n=Re(yA),[i]=V.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(o=>{const s=new Map;o.forEach(r=>{const u=r.target.getAttribute("data-id");s.set(u,{id:u,nodeElement:r.target,force:!0})}),n(s)}));return V.useEffect(()=>()=>{i?.disconnect()},[i]),i}function SA({node:n,nodeType:i,hasDimensions:o,resizeObserver:s}){const r=Qe(),u=V.useRef(null),f=V.useRef(null),g=V.useRef(n.sourcePosition),p=V.useRef(n.targetPosition),h=V.useRef(i),m=o&&!!n.internals.handleBounds;return V.useEffect(()=>{u.current&&!n.hidden&&(!m||f.current!==u.current)&&(f.current&&s?.unobserve(f.current),s?.observe(u.current),f.current=u.current)},[m,n.hidden]),V.useEffect(()=>()=>{f.current&&(s?.unobserve(f.current),f.current=null)},[]),V.useEffect(()=>{if(u.current){const v=h.current!==i,y=g.current!==n.sourcePosition,x=p.current!==n.targetPosition;(v||y||x)&&(h.current=i,g.current=n.sourcePosition,p.current=n.targetPosition,r.getState().updateNodeInternals(new Map([[n.id,{id:n.id,nodeElement:u.current,force:!0}]])))}},[n.id,i,n.sourcePosition,n.targetPosition]),u}function bA({id:n,onClick:i,onMouseEnter:o,onMouseMove:s,onMouseLeave:r,onContextMenu:u,onDoubleClick:f,nodesDraggable:g,elementsSelectable:p,nodesConnectable:h,nodesFocusable:m,resizeObserver:v,noDragClassName:y,noPanClassName:x,disableKeyboardA11y:E,rfId:C,nodeTypes:A,nodeClickDistance:M,onError:H}){const{node:_,internals:z,isParent:Y}=Re(re=>{const fe=re.nodeLookup.get(n),Ee=re.parentLookup.has(n);return{node:fe,internals:fe.internals,isParent:Ee}},Ke);let O=_.type||"default",I=A?.[O]||Hy[O];I===void 0&&(H?.("003",mn.error003(O)),O="default",I=A?.default||Hy.default);const B=!!(_.draggable||g&&typeof _.draggable>"u"),Z=!!(_.selectable||p&&typeof _.selectable>"u"),oe=!!(_.connectable||h&&typeof _.connectable>"u"),$=!!(_.focusable||m&&typeof _.focusable>"u"),ee=Qe(),se=Q0(_),D=SA({node:_,nodeType:O,hasDimensions:se,resizeObserver:v}),k=Nv({nodeRef:D,disabled:_.hidden||!B,noDragClassName:y,handleSelector:_.dragHandle,nodeId:n,isSelectable:Z,nodeClickDistance:M}),T=Tv();if(_.hidden)return null;const U=Vn(_),G=uA(_),R=Z||B||i||o||s||r,F=o?re=>o(re,{...z.userNode}):void 0,N=s?re=>s(re,{...z.userNode}):void 0,j=r?re=>r(re,{...z.userNode}):void 0,W=u?re=>u(re,{...z.userNode}):void 0,te=f?re=>f(re,{...z.userNode}):void 0,ce=re=>{const{selectNodesOnDrag:fe,nodeDragThreshold:Ee}=ee.getState();Z&&(!fe||!B||Ee>0)&&nf({id:n,store:ee,nodeRef:D}),i&&i(re,{...z.userNode})},de=re=>{if(!(P0(re.nativeEvent)||E)){if(q0.includes(re.key)&&Z){const fe=re.key==="Escape";nf({id:n,store:ee,unselect:fe,nodeRef:D})}else if(B&&_.selected&&Object.prototype.hasOwnProperty.call(Hr,re.key)){re.preventDefault();const{ariaLabelConfig:fe}=ee.getState();ee.setState({ariaLiveMessage:fe["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~z.positionAbsolute.x,y:~~z.positionAbsolute.y})}),T({direction:Hr[re.key],factor:re.shiftKey?4:1})}}},ue=()=>{if(E||!D.current?.matches(":focus-visible"))return;const{transform:re,width:fe,height:Ee,autoPanOnNodeFocus:xe,setCenter:ye}=ee.getState();if(!xe)return;ff(new Map([[n,_]]),{x:0,y:0,width:fe,height:Ee},re,!0).length>0||ye(_.position.x+U.width/2,_.position.y+U.height/2,{zoom:re[2]})};return S.jsx("div",{className:ot(["react-flow__node",`react-flow__node-${O}`,{[x]:B},_.className,{selected:_.selected,selectable:Z,parent:Y,draggable:B,dragging:k}]),ref:D,style:{zIndex:z.z,transform:`translate(${z.positionAbsolute.x}px,${z.positionAbsolute.y}px)`,pointerEvents:R?"all":"none",visibility:se?"visible":"hidden",..._.style,...G},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:F,onMouseMove:N,onMouseLeave:j,onContextMenu:W,onClick:ce,onDoubleClick:te,onKeyDown:$?de:void 0,tabIndex:$?0:void 0,onFocus:$?ue:void 0,role:_.ariaRole??($?"group":void 0),"aria-roledescription":"node","aria-describedby":E?void 0:`${yv}-${C}`,"aria-label":_.ariaLabel,..._.domAttributes,children:S.jsx(nA,{value:n,children:S.jsx(I,{id:n,data:_.data,type:O,positionAbsoluteX:z.positionAbsolute.x,positionAbsoluteY:z.positionAbsolute.y,selected:_.selected??!1,selectable:Z,draggable:B,deletable:_.deletable??!0,isConnectable:oe,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:k,dragHandle:_.dragHandle,zIndex:z.z,parentId:_.parentId,...U})})})}var xA=V.memo(bA);const _A=n=>({nodesDraggable:n.nodesDraggable,nodesConnectable:n.nodesConnectable,nodesFocusable:n.nodesFocusable,elementsSelectable:n.elementsSelectable,onError:n.onError});function Mv(n){const{nodesDraggable:i,nodesConnectable:o,nodesFocusable:s,elementsSelectable:r,onError:u}=Re(_A,Ke),f=pA(n.onlyRenderVisibleElements),g=vA();return S.jsx("div",{className:"react-flow__nodes",style:$r,children:f.map(p=>S.jsx(xA,{id:p,nodeTypes:n.nodeTypes,nodeExtent:n.nodeExtent,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:g,nodesDraggable:i,nodesConnectable:o,nodesFocusable:s,elementsSelectable:r,nodeClickDistance:n.nodeClickDistance,onError:u},p))})}Mv.displayName="NodeRenderer";const wA=V.memo(Mv);function EA(n){return Re(V.useCallback(o=>{if(!n)return o.edges.map(r=>r.id);const s=[];if(o.width&&o.height)for(const r of o.edges){const u=o.nodeLookup.get(r.source),f=o.nodeLookup.get(r.target);u&&f&&wN({sourceNode:u,targetNode:f,width:o.width,height:o.height,transform:o.transform})&&s.push(r.id)}return s},[n]),Ke)}const NA=({color:n="none",strokeWidth:i=1})=>{const o={strokeWidth:i,...n&&{stroke:n}};return S.jsx("polyline",{className:"arrow",style:o,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},TA=({color:n="none",strokeWidth:i=1})=>{const o={strokeWidth:i,...n&&{stroke:n,fill:n}};return S.jsx("polyline",{className:"arrowclosed",style:o,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Uy={[Rr.Arrow]:NA,[Rr.ArrowClosed]:TA};function AA(n){const i=Qe();return V.useMemo(()=>Object.prototype.hasOwnProperty.call(Uy,n)?Uy[n]:(i.getState().onError?.("009",mn.error009(n)),null),[n])}const CA=({id:n,type:i,color:o,width:s=12.5,height:r=12.5,markerUnits:u="strokeWidth",strokeWidth:f,orient:g="auto-start-reverse"})=>{const p=AA(i);return p?S.jsx("marker",{className:"react-flow__arrowhead",id:n,markerWidth:`${s}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:u,orient:g,refX:"0",refY:"0",children:S.jsx(p,{color:o,strokeWidth:f})}):null},zv=({defaultColor:n,rfId:i})=>{const o=Re(u=>u.edges),s=Re(u=>u.defaultEdgeOptions),r=V.useMemo(()=>DN(o,{id:i,defaultColor:n,defaultMarkerStart:s?.markerStart,defaultMarkerEnd:s?.markerEnd}),[o,s,i,n]);return r.length?S.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:S.jsx("defs",{children:r.map(u=>S.jsx(CA,{id:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,strokeWidth:u.strokeWidth,orient:u.orient},u.id))})}):null};zv.displayName="MarkerDefinitions";var MA=V.memo(zv);function Dv({x:n,y:i,label:o,labelStyle:s,labelShowBg:r=!0,labelBgStyle:u,labelBgPadding:f=[2,4],labelBgBorderRadius:g=2,children:p,className:h,...m}){const[v,y]=V.useState({x:1,y:0,width:0,height:0}),x=ot(["react-flow__edge-textwrapper",h]),E=V.useRef(null);return V.useEffect(()=>{if(E.current){const C=E.current.getBBox();y({x:C.x,y:C.y,width:C.width,height:C.height})}},[o]),o?S.jsxs("g",{transform:`translate(${n-v.width/2} ${i-v.height/2})`,className:x,visibility:v.width?"visible":"hidden",...m,children:[r&&S.jsx("rect",{width:v.width+2*f[0],x:-f[0],y:-f[1],height:v.height+2*f[1],className:"react-flow__edge-textbg",style:u,rx:g,ry:g}),S.jsx("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:E,style:s,children:o}),p]}):null}Dv.displayName="EdgeText";const zA=V.memo(Dv);function Kr({path:n,labelX:i,labelY:o,label:s,labelStyle:r,labelShowBg:u,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:p,interactionWidth:h=20,...m}){return S.jsxs(S.Fragment,{children:[S.jsx("path",{...m,d:n,fill:"none",className:ot(["react-flow__edge-path",m.className])}),h?S.jsx("path",{d:n,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,s&&nn(i)&&nn(o)?S.jsx(zA,{x:i,y:o,label:s,labelStyle:r,labelShowBg:u,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:p}):null]})}function By({pos:n,x1:i,y1:o,x2:s,y2:r}){return n===me.Left||n===me.Right?[.5*(i+s),o]:[i,.5*(o+r)]}function Rv({sourceX:n,sourceY:i,sourcePosition:o=me.Bottom,targetX:s,targetY:r,targetPosition:u=me.Top}){const[f,g]=By({pos:o,x1:n,y1:i,x2:s,y2:r}),[p,h]=By({pos:u,x1:s,y1:r,x2:n,y2:i}),[m,v,y,x]=ev({sourceX:n,sourceY:i,targetX:s,targetY:r,sourceControlX:f,sourceControlY:g,targetControlX:p,targetControlY:h});return[`M${n},${i} C${f},${g} ${p},${h} ${s},${r}`,m,v,y,x]}function jv(n){return V.memo(({id:i,sourceX:o,sourceY:s,targetX:r,targetY:u,sourcePosition:f,targetPosition:g,label:p,labelStyle:h,labelShowBg:m,labelBgStyle:v,labelBgPadding:y,labelBgBorderRadius:x,style:E,markerEnd:C,markerStart:A,interactionWidth:M})=>{const[H,_,z]=Rv({sourceX:o,sourceY:s,sourcePosition:f,targetX:r,targetY:u,targetPosition:g}),Y=n.isInternal?void 0:i;return S.jsx(Kr,{id:Y,path:H,labelX:_,labelY:z,label:p,labelStyle:h,labelShowBg:m,labelBgStyle:v,labelBgPadding:y,labelBgBorderRadius:x,style:E,markerEnd:C,markerStart:A,interactionWidth:M})})}const DA=jv({isInternal:!1}),Ov=jv({isInternal:!0});DA.displayName="SimpleBezierEdge";Ov.displayName="SimpleBezierEdgeInternal";function Hv(n){return V.memo(({id:i,sourceX:o,sourceY:s,targetX:r,targetY:u,label:f,labelStyle:g,labelShowBg:p,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:v,style:y,sourcePosition:x=me.Bottom,targetPosition:E=me.Top,markerEnd:C,markerStart:A,pathOptions:M,interactionWidth:H})=>{const[_,z,Y]=Jd({sourceX:o,sourceY:s,sourcePosition:x,targetX:r,targetY:u,targetPosition:E,borderRadius:M?.borderRadius,offset:M?.offset,stepPosition:M?.stepPosition}),O=n.isInternal?void 0:i;return S.jsx(Kr,{id:O,path:_,labelX:z,labelY:Y,label:f,labelStyle:g,labelShowBg:p,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:v,style:y,markerEnd:C,markerStart:A,interactionWidth:H})})}const Lv=Hv({isInternal:!1}),Uv=Hv({isInternal:!0});Lv.displayName="SmoothStepEdge";Uv.displayName="SmoothStepEdgeInternal";function Bv(n){return V.memo(({id:i,...o})=>{const s=n.isInternal?void 0:i;return S.jsx(Lv,{...o,id:s,pathOptions:V.useMemo(()=>({borderRadius:0,offset:o.pathOptions?.offset}),[o.pathOptions?.offset])})})}const RA=Bv({isInternal:!1}),Iv=Bv({isInternal:!0});RA.displayName="StepEdge";Iv.displayName="StepEdgeInternal";function qv(n){return V.memo(({id:i,sourceX:o,sourceY:s,targetX:r,targetY:u,label:f,labelStyle:g,labelShowBg:p,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:v,style:y,markerEnd:x,markerStart:E,interactionWidth:C})=>{const[A,M,H]=av({sourceX:o,sourceY:s,targetX:r,targetY:u}),_=n.isInternal?void 0:i;return S.jsx(Kr,{id:_,path:A,labelX:M,labelY:H,label:f,labelStyle:g,labelShowBg:p,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:v,style:y,markerEnd:x,markerStart:E,interactionWidth:C})})}const jA=qv({isInternal:!1}),Gv=qv({isInternal:!0});jA.displayName="StraightEdge";Gv.displayName="StraightEdgeInternal";function kv(n){return V.memo(({id:i,sourceX:o,sourceY:s,targetX:r,targetY:u,sourcePosition:f=me.Bottom,targetPosition:g=me.Top,label:p,labelStyle:h,labelShowBg:m,labelBgStyle:v,labelBgPadding:y,labelBgBorderRadius:x,style:E,markerEnd:C,markerStart:A,pathOptions:M,interactionWidth:H})=>{const[_,z,Y]=tv({sourceX:o,sourceY:s,sourcePosition:f,targetX:r,targetY:u,targetPosition:g,curvature:M?.curvature}),O=n.isInternal?void 0:i;return S.jsx(Kr,{id:O,path:_,labelX:z,labelY:Y,label:p,labelStyle:h,labelShowBg:m,labelBgStyle:v,labelBgPadding:y,labelBgBorderRadius:x,style:E,markerEnd:C,markerStart:A,interactionWidth:H})})}const OA=kv({isInternal:!1}),Yv=kv({isInternal:!0});OA.displayName="BezierEdge";Yv.displayName="BezierEdgeInternal";const Iy={default:Yv,straight:Gv,step:Iv,smoothstep:Uv,simplebezier:Ov},qy={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},HA=(n,i,o)=>o===me.Left?n-i:o===me.Right?n+i:n,LA=(n,i,o)=>o===me.Top?n-i:o===me.Bottom?n+i:n,Gy="react-flow__edgeupdater";function ky({position:n,centerX:i,centerY:o,radius:s=10,onMouseDown:r,onMouseEnter:u,onMouseOut:f,type:g}){return S.jsx("circle",{onMouseDown:r,onMouseEnter:u,onMouseOut:f,className:ot([Gy,`${Gy}-${g}`]),cx:HA(i,s,n),cy:LA(o,s,n),r:s,stroke:"transparent",fill:"transparent"})}function UA({isReconnectable:n,reconnectRadius:i,edge:o,sourceX:s,sourceY:r,targetX:u,targetY:f,sourcePosition:g,targetPosition:p,onReconnect:h,onReconnectStart:m,onReconnectEnd:v,setReconnecting:y,setUpdateHover:x}){const E=Qe(),C=(z,Y)=>{if(z.button!==0)return;const{autoPanOnConnect:O,domNode:I,connectionMode:B,connectionRadius:Z,lib:oe,onConnectStart:$,cancelConnection:ee,nodeLookup:se,rfId:D,panBy:k,updateConnection:T}=E.getState(),U=Y.type==="target",G=(N,j)=>{y(!1),v?.(N,o,Y.type,j)},R=N=>h?.(o,N),F=(N,j)=>{y(!0),m?.(z,o,Y.type),$?.(N,j)};ef.onPointerDown(z.nativeEvent,{autoPanOnConnect:O,connectionMode:B,connectionRadius:Z,domNode:I,handleId:Y.id,nodeId:Y.nodeId,nodeLookup:se,isTarget:U,edgeUpdaterType:Y.type,lib:oe,flowId:D,cancelConnection:ee,panBy:k,isValidConnection:(...N)=>E.getState().isValidConnection?.(...N)??!0,onConnect:R,onConnectStart:F,onConnectEnd:(...N)=>E.getState().onConnectEnd?.(...N),onReconnectEnd:G,updateConnection:T,getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,dragThreshold:E.getState().connectionDragThreshold,handleDomNode:z.currentTarget})},A=z=>C(z,{nodeId:o.target,id:o.targetHandle??null,type:"target"}),M=z=>C(z,{nodeId:o.source,id:o.sourceHandle??null,type:"source"}),H=()=>x(!0),_=()=>x(!1);return S.jsxs(S.Fragment,{children:[(n===!0||n==="source")&&S.jsx(ky,{position:g,centerX:s,centerY:r,radius:i,onMouseDown:A,onMouseEnter:H,onMouseOut:_,type:"source"}),(n===!0||n==="target")&&S.jsx(ky,{position:p,centerX:u,centerY:f,radius:i,onMouseDown:M,onMouseEnter:H,onMouseOut:_,type:"target"})]})}function BA({id:n,edgesFocusable:i,edgesReconnectable:o,elementsSelectable:s,onClick:r,onDoubleClick:u,onContextMenu:f,onMouseEnter:g,onMouseMove:p,onMouseLeave:h,reconnectRadius:m,onReconnect:v,onReconnectStart:y,onReconnectEnd:x,rfId:E,edgeTypes:C,noPanClassName:A,onError:M,disableKeyboardA11y:H}){let _=Re(ye=>ye.edgeLookup.get(n));const z=Re(ye=>ye.defaultEdgeOptions);_=z?{...z,..._}:_;let Y=_.type||"default",O=C?.[Y]||Iy[Y];O===void 0&&(M?.("011",mn.error011(Y)),Y="default",O=C?.default||Iy.default);const I=!!(_.focusable||i&&typeof _.focusable>"u"),B=typeof v<"u"&&(_.reconnectable||o&&typeof _.reconnectable>"u"),Z=!!(_.selectable||s&&typeof _.selectable>"u"),oe=V.useRef(null),[$,ee]=V.useState(!1),[se,D]=V.useState(!1),k=Qe(),{zIndex:T,sourceX:U,sourceY:G,targetX:R,targetY:F,sourcePosition:N,targetPosition:j}=Re(V.useCallback(ye=>{const Se=ye.nodeLookup.get(_.source),Ce=ye.nodeLookup.get(_.target);if(!Se||!Ce)return{zIndex:_.zIndex,...qy};const Ie=zN({id:n,sourceNode:Se,targetNode:Ce,sourceHandle:_.sourceHandle||null,targetHandle:_.targetHandle||null,connectionMode:ye.connectionMode,onError:M});return{zIndex:_N({selected:_.selected,zIndex:_.zIndex,sourceNode:Se,targetNode:Ce,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...Ie||qy}},[_.source,_.target,_.sourceHandle,_.targetHandle,_.selected,_.zIndex]),Ke),W=V.useMemo(()=>_.markerStart?`url('#${Pd(_.markerStart,E)}')`:void 0,[_.markerStart,E]),te=V.useMemo(()=>_.markerEnd?`url('#${Pd(_.markerEnd,E)}')`:void 0,[_.markerEnd,E]);if(_.hidden||U===null||G===null||R===null||F===null)return null;const ce=ye=>{const{addSelectedEdges:Se,unselectNodesAndEdges:Ce,multiSelectionActive:Ie}=k.getState();Z&&(k.setState({nodesSelectionActive:!1}),_.selected&&Ie?(Ce({nodes:[],edges:[_]}),oe.current?.blur()):Se([n])),r&&r(ye,_)},de=u?ye=>{u(ye,{..._})}:void 0,ue=f?ye=>{f(ye,{..._})}:void 0,re=g?ye=>{g(ye,{..._})}:void 0,fe=p?ye=>{p(ye,{..._})}:void 0,Ee=h?ye=>{h(ye,{..._})}:void 0,xe=ye=>{if(!H&&q0.includes(ye.key)&&Z){const{unselectNodesAndEdges:Se,addSelectedEdges:Ce}=k.getState();ye.key==="Escape"?(oe.current?.blur(),Se({edges:[_]})):Ce([n])}};return S.jsx("svg",{style:{zIndex:T},children:S.jsxs("g",{className:ot(["react-flow__edge",`react-flow__edge-${Y}`,_.className,A,{selected:_.selected,animated:_.animated,inactive:!Z&&!r,updating:$,selectable:Z}]),onClick:ce,onDoubleClick:de,onContextMenu:ue,onMouseEnter:re,onMouseMove:fe,onMouseLeave:Ee,onKeyDown:I?xe:void 0,tabIndex:I?0:void 0,role:_.ariaRole??(I?"group":"img"),"aria-roledescription":"edge","data-id":n,"data-testid":`rf__edge-${n}`,"aria-label":_.ariaLabel===null?void 0:_.ariaLabel||`Edge from ${_.source} to ${_.target}`,"aria-describedby":I?`${vv}-${E}`:void 0,ref:oe,..._.domAttributes,children:[!se&&S.jsx(O,{id:n,source:_.source,target:_.target,type:_.type,selected:_.selected,animated:_.animated,selectable:Z,deletable:_.deletable??!0,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,sourceX:U,sourceY:G,targetX:R,targetY:F,sourcePosition:N,targetPosition:j,data:_.data,style:_.style,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerStart:W,markerEnd:te,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth}),B&&S.jsx(UA,{edge:_,isReconnectable:B,reconnectRadius:m,onReconnect:v,onReconnectStart:y,onReconnectEnd:x,sourceX:U,sourceY:G,targetX:R,targetY:F,sourcePosition:N,targetPosition:j,setUpdateHover:ee,setReconnecting:D})]})})}var IA=V.memo(BA);const qA=n=>({edgesFocusable:n.edgesFocusable,edgesReconnectable:n.edgesReconnectable,elementsSelectable:n.elementsSelectable,connectionMode:n.connectionMode,onError:n.onError});function Vv({defaultMarkerColor:n,onlyRenderVisibleElements:i,rfId:o,edgeTypes:s,noPanClassName:r,onReconnect:u,onEdgeContextMenu:f,onEdgeMouseEnter:g,onEdgeMouseMove:p,onEdgeMouseLeave:h,onEdgeClick:m,reconnectRadius:v,onEdgeDoubleClick:y,onReconnectStart:x,onReconnectEnd:E,disableKeyboardA11y:C}){const{edgesFocusable:A,edgesReconnectable:M,elementsSelectable:H,onError:_}=Re(qA,Ke),z=EA(i);return S.jsxs("div",{className:"react-flow__edges",children:[S.jsx(MA,{defaultColor:n,rfId:o}),z.map(Y=>S.jsx(IA,{id:Y,edgesFocusable:A,edgesReconnectable:M,elementsSelectable:H,noPanClassName:r,onReconnect:u,onContextMenu:f,onMouseEnter:g,onMouseMove:p,onMouseLeave:h,onClick:m,reconnectRadius:v,onDoubleClick:y,onReconnectStart:x,onReconnectEnd:E,rfId:o,onError:_,edgeTypes:s,disableKeyboardA11y:C},Y))]})}Vv.displayName="EdgeRenderer";const GA=V.memo(Vv),kA=n=>`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]})`;function YA({children:n}){const i=Re(kA);return S.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:i},children:n})}function VA(n){const i=Zr(),o=V.useRef(!1);V.useEffect(()=>{!o.current&&i.viewportInitialized&&n&&(setTimeout(()=>n(i),1),o.current=!0)},[n,i.viewportInitialized])}const XA=n=>n.panZoom?.syncViewport;function ZA(n){const i=Re(XA),o=Qe();return V.useEffect(()=>{n&&(i?.(n),o.setState({transform:[n.x,n.y,n.zoom]}))},[n,i]),null}function $A(n){return n.connection.inProgress?{...n.connection,to:Lo(n.connection.to,n.transform)}:{...n.connection}}function KA(n){return $A}function QA(n){const i=KA();return Re(i,Ke)}const FA=n=>({nodesConnectable:n.nodesConnectable,isValid:n.connection.isValid,inProgress:n.connection.inProgress,width:n.width,height:n.height});function JA({containerStyle:n,style:i,type:o,component:s}){const{nodesConnectable:r,width:u,height:f,isValid:g,inProgress:p}=Re(FA,Ke);return!(u&&r&&p)?null:S.jsx("svg",{style:n,width:u,height:f,className:"react-flow__connectionline react-flow__container",children:S.jsx("g",{className:ot(["react-flow__connection",Y0(g)]),children:S.jsx(Xv,{style:i,type:o,CustomComponent:s,isValid:g})})})}const Xv=({style:n,type:i=wa.Bezier,CustomComponent:o,isValid:s})=>{const{inProgress:r,from:u,fromNode:f,fromHandle:g,fromPosition:p,to:h,toNode:m,toHandle:v,toPosition:y,pointer:x}=QA();if(!r)return;if(o)return S.jsx(o,{connectionLineType:i,connectionLineStyle:n,fromNode:f,fromHandle:g,fromX:u.x,fromY:u.y,toX:h.x,toY:h.y,fromPosition:p,toPosition:y,connectionStatus:Y0(s),toNode:m,toHandle:v,pointer:x});let E="";const C={sourceX:u.x,sourceY:u.y,sourcePosition:p,targetX:h.x,targetY:h.y,targetPosition:y};switch(i){case wa.Bezier:[E]=tv(C);break;case wa.SimpleBezier:[E]=Rv(C);break;case wa.Step:[E]=Jd({...C,borderRadius:0});break;case wa.SmoothStep:[E]=Jd(C);break;default:[E]=av(C)}return S.jsx("path",{d:E,fill:"none",className:"react-flow__connection-path",style:n})};Xv.displayName="ConnectionLine";const PA={};function Yy(n=PA){V.useRef(n),Qe(),V.useEffect(()=>{},[n])}function WA(){Qe(),V.useRef(!1),V.useEffect(()=>{},[])}function Zv({nodeTypes:n,edgeTypes:i,onInit:o,onNodeClick:s,onEdgeClick:r,onNodeDoubleClick:u,onEdgeDoubleClick:f,onNodeMouseEnter:g,onNodeMouseMove:p,onNodeMouseLeave:h,onNodeContextMenu:m,onSelectionContextMenu:v,onSelectionStart:y,onSelectionEnd:x,connectionLineType:E,connectionLineStyle:C,connectionLineComponent:A,connectionLineContainerStyle:M,selectionKeyCode:H,selectionOnDrag:_,selectionMode:z,multiSelectionKeyCode:Y,panActivationKeyCode:O,zoomActivationKeyCode:I,deleteKeyCode:B,onlyRenderVisibleElements:Z,elementsSelectable:oe,defaultViewport:$,translateExtent:ee,minZoom:se,maxZoom:D,preventScrolling:k,defaultMarkerColor:T,zoomOnScroll:U,zoomOnPinch:G,panOnScroll:R,panOnScrollSpeed:F,panOnScrollMode:N,zoomOnDoubleClick:j,panOnDrag:W,onPaneClick:te,onPaneMouseEnter:ce,onPaneMouseMove:de,onPaneMouseLeave:ue,onPaneScroll:re,onPaneContextMenu:fe,paneClickDistance:Ee,nodeClickDistance:xe,onEdgeContextMenu:ye,onEdgeMouseEnter:Se,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ie,reconnectRadius:Le,onReconnect:ct,onReconnectStart:Kt,onReconnectEnd:zt,noDragClassName:Qt,noWheelClassName:yn,noPanClassName:Na,disableKeyboardA11y:Ta,nodeExtent:dt,rfId:si,viewport:vn,onViewportChange:Xn}){return Yy(n),Yy(i),WA(),VA(o),ZA(vn),S.jsx(gA,{onPaneClick:te,onPaneMouseEnter:ce,onPaneMouseMove:de,onPaneMouseLeave:ue,onPaneContextMenu:fe,onPaneScroll:re,paneClickDistance:Ee,deleteKeyCode:B,selectionKeyCode:H,selectionOnDrag:_,selectionMode:z,onSelectionStart:y,onSelectionEnd:x,multiSelectionKeyCode:Y,panActivationKeyCode:O,zoomActivationKeyCode:I,elementsSelectable:oe,zoomOnScroll:U,zoomOnPinch:G,zoomOnDoubleClick:j,panOnScroll:R,panOnScrollSpeed:F,panOnScrollMode:N,panOnDrag:W,defaultViewport:$,translateExtent:ee,minZoom:se,maxZoom:D,onSelectionContextMenu:v,preventScrolling:k,noDragClassName:Qt,noWheelClassName:yn,noPanClassName:Na,disableKeyboardA11y:Ta,onViewportChange:Xn,isControlledViewport:!!vn,children:S.jsxs(YA,{children:[S.jsx(GA,{edgeTypes:i,onEdgeClick:r,onEdgeDoubleClick:f,onReconnect:ct,onReconnectStart:Kt,onReconnectEnd:zt,onlyRenderVisibleElements:Z,onEdgeContextMenu:ye,onEdgeMouseEnter:Se,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ie,reconnectRadius:Le,defaultMarkerColor:T,noPanClassName:Na,disableKeyboardA11y:Ta,rfId:si}),S.jsx(JA,{style:C,type:E,component:A,containerStyle:M}),S.jsx("div",{className:"react-flow__edgelabel-renderer"}),S.jsx(wA,{nodeTypes:n,onNodeClick:s,onNodeDoubleClick:u,onNodeMouseEnter:g,onNodeMouseMove:p,onNodeMouseLeave:h,onNodeContextMenu:m,nodeClickDistance:xe,onlyRenderVisibleElements:Z,noPanClassName:Na,noDragClassName:Qt,disableKeyboardA11y:Ta,nodeExtent:dt,rfId:si}),S.jsx("div",{className:"react-flow__viewport-portal"})]})})}Zv.displayName="GraphView";const eC=V.memo(Zv),Vy=({nodes:n,edges:i,defaultNodes:o,defaultEdges:s,width:r,height:u,fitView:f,fitViewOptions:g,minZoom:p=.5,maxZoom:h=2,nodeOrigin:m,nodeExtent:v,zIndexMode:y="basic"}={})=>{const x=new Map,E=new Map,C=new Map,A=new Map,M=s??i??[],H=o??n??[],_=m??[0,0],z=v??No;ov(C,A,M);const{nodesInitialized:Y}=Wd(H,x,E,{nodeOrigin:_,nodeExtent:z,zIndexMode:y});let O=[0,0,1];if(f&&r&&u){const I=Oo(x,{filter:$=>!!(($.width||$.initialWidth)&&($.height||$.initialHeight))}),{x:B,y:Z,zoom:oe}=hf(I,r,u,p,h,g?.padding??.1);O=[B,Z,oe]}return{rfId:"1",width:r??0,height:u??0,transform:O,nodes:H,nodesInitialized:Y,nodeLookup:x,parentLookup:E,edges:M,edgeLookup:A,connectionLookup:C,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:o!==void 0,hasDefaultEdges:s!==void 0,panZoom:null,minZoom:p,maxZoom:h,translateExtent:No,nodeExtent:z,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:rl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:_,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:f??!1,fitViewOptions:g,fitViewResolver:null,connection:{...k0},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:pN,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:G0,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},tC=({nodes:n,edges:i,defaultNodes:o,defaultEdges:s,width:r,height:u,fitView:f,fitViewOptions:g,minZoom:p,maxZoom:h,nodeOrigin:m,nodeExtent:v,zIndexMode:y})=>bT((x,E)=>{async function C(){const{nodeLookup:A,panZoom:M,fitViewOptions:H,fitViewResolver:_,width:z,height:Y,minZoom:O,maxZoom:I}=E();M&&(await gN({nodes:A,width:z,height:Y,panZoom:M,minZoom:O,maxZoom:I},H),_?.resolve(!0),x({fitViewResolver:null}))}return{...Vy({nodes:n,edges:i,width:r,height:u,fitView:f,fitViewOptions:g,minZoom:p,maxZoom:h,nodeOrigin:m,nodeExtent:v,defaultNodes:o,defaultEdges:s,zIndexMode:y}),setNodes:A=>{const{nodeLookup:M,parentLookup:H,nodeOrigin:_,elevateNodesOnSelect:z,fitViewQueued:Y,zIndexMode:O,nodesSelectionActive:I}=E(),{nodesInitialized:B,hasSelectedNodes:Z}=Wd(A,M,H,{nodeOrigin:_,nodeExtent:v,elevateNodesOnSelect:z,checkEquality:!0,zIndexMode:O}),oe=I&&Z;Y&&B?(C(),x({nodes:A,nodesInitialized:B,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:oe})):x({nodes:A,nodesInitialized:B,nodesSelectionActive:oe})},setEdges:A=>{const{connectionLookup:M,edgeLookup:H}=E();ov(M,H,A),x({edges:A})},setDefaultNodesAndEdges:(A,M)=>{if(A){const{setNodes:H}=E();H(A),x({hasDefaultNodes:!0})}if(M){const{setEdges:H}=E();H(M),x({hasDefaultEdges:!0})}},updateNodeInternals:A=>{const{triggerNodeChanges:M,nodeLookup:H,parentLookup:_,domNode:z,nodeOrigin:Y,nodeExtent:O,debug:I,fitViewQueued:B,zIndexMode:Z}=E(),{changes:oe,updatedInternals:$}=BN(A,H,_,z,Y,O,Z);$&&(ON(H,_,{nodeOrigin:Y,nodeExtent:O,zIndexMode:Z}),B?(C(),x({fitViewQueued:!1,fitViewOptions:void 0})):x({}),oe?.length>0&&(I&&console.log("React Flow: trigger node changes",oe),M?.(oe)))},updateNodePositions:(A,M=!1)=>{const H=[];let _=[];const{nodeLookup:z,triggerNodeChanges:Y,connection:O,updateConnection:I,onNodesChangeMiddlewareMap:B}=E();for(const[Z,oe]of A){const $=z.get(Z),ee=!!($?.expandParent&&$?.parentId&&oe?.position),se={id:Z,type:"position",position:ee?{x:Math.max(0,oe.position.x),y:Math.max(0,oe.position.y)}:oe.position,dragging:M};if($&&O.inProgress&&O.fromNode.id===$.id){const D=oi($,O.fromHandle,me.Left,!0);I({...O,from:D})}ee&&$.parentId&&H.push({id:Z,parentId:$.parentId,rect:{...oe.internals.positionAbsolute,width:oe.measured.width??0,height:oe.measured.height??0}}),_.push(se)}if(H.length>0){const{parentLookup:Z,nodeOrigin:oe}=E(),$=Sf(H,z,Z,oe);_.push(...$)}for(const Z of B.values())_=Z(_);Y(_)},triggerNodeChanges:A=>{const{onNodesChange:M,setNodes:H,nodes:_,hasDefaultNodes:z,debug:Y}=E();if(A?.length){if(z){const O=xv(A,_);H(O)}Y&&console.log("React Flow: trigger node changes",A),M?.(A)}},triggerEdgeChanges:A=>{const{onEdgesChange:M,setEdges:H,edges:_,hasDefaultEdges:z,debug:Y}=E();if(A?.length){if(z){const O=_v(A,_);H(O)}Y&&console.log("React Flow: trigger edge changes",A),M?.(A)}},addSelectedNodes:A=>{const{multiSelectionActive:M,edgeLookup:H,nodeLookup:_,triggerNodeChanges:z,triggerEdgeChanges:Y}=E();if(M){const O=A.map(I=>Ja(I,!0));z(O);return}z(tl(_,new Set([...A]),!0)),Y(tl(H))},addSelectedEdges:A=>{const{multiSelectionActive:M,edgeLookup:H,nodeLookup:_,triggerNodeChanges:z,triggerEdgeChanges:Y}=E();if(M){const O=A.map(I=>Ja(I,!0));Y(O);return}Y(tl(H,new Set([...A]))),z(tl(_,new Set,!0))},unselectNodesAndEdges:({nodes:A,edges:M}={})=>{const{edges:H,nodes:_,nodeLookup:z,triggerNodeChanges:Y,triggerEdgeChanges:O}=E(),I=A||_,B=M||H,Z=[];for(const $ of I){if(!$.selected)continue;const ee=z.get($.id);ee&&(ee.selected=!1),Z.push(Ja($.id,!1))}const oe=[];for(const $ of B)$.selected&&oe.push(Ja($.id,!1));Y(Z),O(oe)},setMinZoom:A=>{const{panZoom:M,maxZoom:H}=E();M?.setScaleExtent([A,H]),x({minZoom:A})},setMaxZoom:A=>{const{panZoom:M,minZoom:H}=E();M?.setScaleExtent([H,A]),x({maxZoom:A})},setTranslateExtent:A=>{E().panZoom?.setTranslateExtent(A),x({translateExtent:A})},resetSelectedElements:()=>{const{edges:A,nodes:M,triggerNodeChanges:H,triggerEdgeChanges:_,elementsSelectable:z}=E();if(!z)return;const Y=M.reduce((I,B)=>B.selected?[...I,Ja(B.id,!1)]:I,[]),O=A.reduce((I,B)=>B.selected?[...I,Ja(B.id,!1)]:I,[]);H(Y),_(O)},setNodeExtent:A=>{const{nodes:M,nodeLookup:H,parentLookup:_,nodeOrigin:z,elevateNodesOnSelect:Y,nodeExtent:O,zIndexMode:I}=E();A[0][0]===O[0][0]&&A[0][1]===O[0][1]&&A[1][0]===O[1][0]&&A[1][1]===O[1][1]||(Wd(M,H,_,{nodeOrigin:z,nodeExtent:A,elevateNodesOnSelect:Y,checkEquality:!1,zIndexMode:I}),x({nodeExtent:A}))},panBy:A=>{const{transform:M,width:H,height:_,panZoom:z,translateExtent:Y}=E();return IN({delta:A,panZoom:z,transform:M,translateExtent:Y,width:H,height:_})},setCenter:async(A,M,H)=>{const{width:_,height:z,maxZoom:Y,panZoom:O}=E();if(!O)return Promise.resolve(!1);const I=typeof H?.zoom<"u"?H.zoom:Y;return await O.setViewport({x:_/2-A*I,y:z/2-M*I,zoom:I},{duration:H?.duration,ease:H?.ease,interpolate:H?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{x({connection:{...k0}})},updateConnection:A=>{x({connection:A})},reset:()=>x({...Vy()})}},Object.is);function $v({initialNodes:n,initialEdges:i,defaultNodes:o,defaultEdges:s,initialWidth:r,initialHeight:u,initialMinZoom:f,initialMaxZoom:g,initialFitViewOptions:p,fitView:h,nodeOrigin:m,nodeExtent:v,zIndexMode:y,children:x}){const[E]=V.useState(()=>tC({nodes:n,edges:i,defaultNodes:o,defaultEdges:s,width:r,height:u,fitView:h,minZoom:f,maxZoom:g,fitViewOptions:p,nodeOrigin:m,nodeExtent:v,zIndexMode:y}));return S.jsx(xT,{value:E,children:S.jsx(YT,{children:x})})}function nC({children:n,nodes:i,edges:o,defaultNodes:s,defaultEdges:r,width:u,height:f,fitView:g,fitViewOptions:p,minZoom:h,maxZoom:m,nodeOrigin:v,nodeExtent:y,zIndexMode:x}){return V.useContext(Vr)?S.jsx(S.Fragment,{children:n}):S.jsx($v,{initialNodes:i,initialEdges:o,defaultNodes:s,defaultEdges:r,initialWidth:u,initialHeight:f,fitView:g,initialFitViewOptions:p,initialMinZoom:h,initialMaxZoom:m,nodeOrigin:v,nodeExtent:y,zIndexMode:x,children:n})}const aC={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function iC({nodes:n,edges:i,defaultNodes:o,defaultEdges:s,className:r,nodeTypes:u,edgeTypes:f,onNodeClick:g,onEdgeClick:p,onInit:h,onMove:m,onMoveStart:v,onMoveEnd:y,onConnect:x,onConnectStart:E,onConnectEnd:C,onClickConnectStart:A,onClickConnectEnd:M,onNodeMouseEnter:H,onNodeMouseMove:_,onNodeMouseLeave:z,onNodeContextMenu:Y,onNodeDoubleClick:O,onNodeDragStart:I,onNodeDrag:B,onNodeDragStop:Z,onNodesDelete:oe,onEdgesDelete:$,onDelete:ee,onSelectionChange:se,onSelectionDragStart:D,onSelectionDrag:k,onSelectionDragStop:T,onSelectionContextMenu:U,onSelectionStart:G,onSelectionEnd:R,onBeforeDelete:F,connectionMode:N,connectionLineType:j=wa.Bezier,connectionLineStyle:W,connectionLineComponent:te,connectionLineContainerStyle:ce,deleteKeyCode:de="Backspace",selectionKeyCode:ue="Shift",selectionOnDrag:re=!1,selectionMode:fe=To.Full,panActivationKeyCode:Ee="Space",multiSelectionKeyCode:xe=Co()?"Meta":"Control",zoomActivationKeyCode:ye=Co()?"Meta":"Control",snapToGrid:Se,snapGrid:Ce,onlyRenderVisibleElements:Ie=!1,selectNodesOnDrag:Le,nodesDraggable:ct,autoPanOnNodeFocus:Kt,nodesConnectable:zt,nodesFocusable:Qt,nodeOrigin:yn=Sv,edgesFocusable:Na,edgesReconnectable:Ta,elementsSelectable:dt=!0,defaultViewport:si=OT,minZoom:vn=.5,maxZoom:Xn=2,translateExtent:Aa=No,preventScrolling:Qr=!0,nodeExtent:ri,defaultMarkerColor:Fr="#b1b1b7",zoomOnScroll:Jr=!0,zoomOnPinch:Ca=!0,panOnScroll:vt=!1,panOnScrollSpeed:on=.5,panOnScrollMode:St=ni.Free,zoomOnDoubleClick:Pr=!0,panOnDrag:Wr=!0,onPaneClick:ec,onPaneMouseEnter:ci,onPaneMouseMove:ui,onPaneMouseLeave:di,onPaneScroll:Sn,onPaneContextMenu:fi,paneClickDistance:Ma=1,nodeClickDistance:tc=0,children:Uo,onReconnect:gl,onReconnectStart:za,onReconnectEnd:nc,onEdgeContextMenu:Bo,onEdgeDoubleClick:Io,onEdgeMouseEnter:qo,onEdgeMouseMove:ml,onEdgeMouseLeave:pl,reconnectRadius:Go=10,onNodesChange:ko,onEdgesChange:sn,noDragClassName:st="nodrag",noWheelClassName:pt="nowheel",noPanClassName:bn="nopan",fitView:hi,fitViewOptions:Yo,connectOnClick:ac,attributionPosition:Vo,proOptions:Da,defaultEdgeOptions:yl,elevateNodesOnSelect:Zn=!0,elevateEdgesOnSelect:$n=!1,disableKeyboardA11y:Kn=!1,autoPanOnConnect:Qn,autoPanOnNodeDrag:et,autoPanSpeed:Xo,connectionRadius:Zo,isValidConnection:xn,onError:Fn,style:ic,id:vl,nodeDragThreshold:$o,connectionDragThreshold:lc,viewport:gi,onViewportChange:mi,width:Ft,height:xt,colorMode:Ko="light",debug:oc,onScroll:pi,ariaLabelConfig:Qo,zIndexMode:Ra="basic",...sc},_t){const ja=vl||"1",Fo=BT(Ko),Sl=V.useCallback(_n=>{_n.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),pi?.(_n)},[pi]);return S.jsx("div",{"data-testid":"rf__wrapper",...sc,onScroll:Sl,style:{...ic,...aC},ref:_t,className:ot(["react-flow",r,Fo]),id:vl,role:"application",children:S.jsxs(nC,{nodes:n,edges:i,width:Ft,height:xt,fitView:hi,fitViewOptions:Yo,minZoom:vn,maxZoom:Xn,nodeOrigin:yn,nodeExtent:ri,zIndexMode:Ra,children:[S.jsx(UT,{nodes:n,edges:i,defaultNodes:o,defaultEdges:s,onConnect:x,onConnectStart:E,onConnectEnd:C,onClickConnectStart:A,onClickConnectEnd:M,nodesDraggable:ct,autoPanOnNodeFocus:Kt,nodesConnectable:zt,nodesFocusable:Qt,edgesFocusable:Na,edgesReconnectable:Ta,elementsSelectable:dt,elevateNodesOnSelect:Zn,elevateEdgesOnSelect:$n,minZoom:vn,maxZoom:Xn,nodeExtent:ri,onNodesChange:ko,onEdgesChange:sn,snapToGrid:Se,snapGrid:Ce,connectionMode:N,translateExtent:Aa,connectOnClick:ac,defaultEdgeOptions:yl,fitView:hi,fitViewOptions:Yo,onNodesDelete:oe,onEdgesDelete:$,onDelete:ee,onNodeDragStart:I,onNodeDrag:B,onNodeDragStop:Z,onSelectionDrag:k,onSelectionDragStart:D,onSelectionDragStop:T,onMove:m,onMoveStart:v,onMoveEnd:y,noPanClassName:bn,nodeOrigin:yn,rfId:ja,autoPanOnConnect:Qn,autoPanOnNodeDrag:et,autoPanSpeed:Xo,onError:Fn,connectionRadius:Zo,isValidConnection:xn,selectNodesOnDrag:Le,nodeDragThreshold:$o,connectionDragThreshold:lc,onBeforeDelete:F,debug:oc,ariaLabelConfig:Qo,zIndexMode:Ra}),S.jsx(eC,{onInit:h,onNodeClick:g,onEdgeClick:p,onNodeMouseEnter:H,onNodeMouseMove:_,onNodeMouseLeave:z,onNodeContextMenu:Y,onNodeDoubleClick:O,nodeTypes:u,edgeTypes:f,connectionLineType:j,connectionLineStyle:W,connectionLineComponent:te,connectionLineContainerStyle:ce,selectionKeyCode:ue,selectionOnDrag:re,selectionMode:fe,deleteKeyCode:de,multiSelectionKeyCode:xe,panActivationKeyCode:Ee,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Ie,defaultViewport:si,translateExtent:Aa,minZoom:vn,maxZoom:Xn,preventScrolling:Qr,zoomOnScroll:Jr,zoomOnPinch:Ca,zoomOnDoubleClick:Pr,panOnScroll:vt,panOnScrollSpeed:on,panOnScrollMode:St,panOnDrag:Wr,onPaneClick:ec,onPaneMouseEnter:ci,onPaneMouseMove:ui,onPaneMouseLeave:di,onPaneScroll:Sn,onPaneContextMenu:fi,paneClickDistance:Ma,nodeClickDistance:tc,onSelectionContextMenu:U,onSelectionStart:G,onSelectionEnd:R,onReconnect:gl,onReconnectStart:za,onReconnectEnd:nc,onEdgeContextMenu:Bo,onEdgeDoubleClick:Io,onEdgeMouseEnter:qo,onEdgeMouseMove:ml,onEdgeMouseLeave:pl,reconnectRadius:Go,defaultMarkerColor:Fr,noDragClassName:st,noWheelClassName:pt,noPanClassName:bn,rfId:ja,disableKeyboardA11y:Kn,nodeExtent:ri,viewport:gi,onViewportChange:mi}),S.jsx(jT,{onSelectionChange:se}),Uo,S.jsx(CT,{proOptions:Da,position:Vo}),S.jsx(AT,{rfId:ja,disableKeyboardA11y:Kn})]})})}var lC=wv(iC);function oC({dimensions:n,lineWidth:i,variant:o,className:s}){return S.jsx("path",{strokeWidth:i,d:`M${n[0]/2} 0 V${n[1]} M0 ${n[1]/2} H${n[0]}`,className:ot(["react-flow__background-pattern",o,s])})}function sC({radius:n,className:i}){return S.jsx("circle",{cx:n,cy:n,r:n,className:ot(["react-flow__background-pattern","dots",i])})}var Ea;(function(n){n.Lines="lines",n.Dots="dots",n.Cross="cross"})(Ea||(Ea={}));const rC={[Ea.Dots]:1,[Ea.Lines]:1,[Ea.Cross]:6},cC=n=>({transform:n.transform,patternId:`pattern-${n.rfId}`});function Kv({id:n,variant:i=Ea.Dots,gap:o=20,size:s,lineWidth:r=1,offset:u=0,color:f,bgColor:g,style:p,className:h,patternClassName:m}){const v=V.useRef(null),{transform:y,patternId:x}=Re(cC,Ke),E=s||rC[i],C=i===Ea.Dots,A=i===Ea.Cross,M=Array.isArray(o)?o:[o,o],H=[M[0]*y[2]||1,M[1]*y[2]||1],_=E*y[2],z=Array.isArray(u)?u:[u,u],Y=A?[_,_]:H,O=[z[0]*y[2]||1+Y[0]/2,z[1]*y[2]||1+Y[1]/2],I=`${x}${n||""}`;return S.jsxs("svg",{className:ot(["react-flow__background",h]),style:{...p,...$r,"--xy-background-color-props":g,"--xy-background-pattern-color-props":f},ref:v,"data-testid":"rf__background",children:[S.jsx("pattern",{id:I,x:y[0]%H[0],y:y[1]%H[1],width:H[0],height:H[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${O[0]},-${O[1]})`,children:C?S.jsx(sC,{radius:_/2,className:m}):S.jsx(oC,{dimensions:Y,lineWidth:r,variant:i,className:m})}),S.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${I})`})]})}Kv.displayName="Background";const uC=V.memo(Kv);function dC(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:S.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function fC(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:S.jsx("path",{d:"M0 0h32v4.2H0z"})})}function hC(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:S.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 gC(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.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 mC(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.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 yr({children:n,className:i,...o}){return S.jsx("button",{type:"button",className:ot(["react-flow__controls-button",i]),...o,children:n})}const pC=n=>({isInteractive:n.nodesDraggable||n.nodesConnectable||n.elementsSelectable,minZoomReached:n.transform[2]<=n.minZoom,maxZoomReached:n.transform[2]>=n.maxZoom,ariaLabelConfig:n.ariaLabelConfig});function Qv({style:n,showZoom:i=!0,showFitView:o=!0,showInteractive:s=!0,fitViewOptions:r,onZoomIn:u,onZoomOut:f,onFitView:g,onInteractiveChange:p,className:h,children:m,position:v="bottom-left",orientation:y="vertical","aria-label":x}){const E=Qe(),{isInteractive:C,minZoomReached:A,maxZoomReached:M,ariaLabelConfig:H}=Re(pC,Ke),{zoomIn:_,zoomOut:z,fitView:Y}=Zr(),O=()=>{_(),u?.()},I=()=>{z(),f?.()},B=()=>{Y(r),g?.()},Z=()=>{E.setState({nodesDraggable:!C,nodesConnectable:!C,elementsSelectable:!C}),p?.(!C)},oe=y==="horizontal"?"horizontal":"vertical";return S.jsxs(Xr,{className:ot(["react-flow__controls",oe,h]),position:v,style:n,"data-testid":"rf__controls","aria-label":x??H["controls.ariaLabel"],children:[i&&S.jsxs(S.Fragment,{children:[S.jsx(yr,{onClick:O,className:"react-flow__controls-zoomin",title:H["controls.zoomIn.ariaLabel"],"aria-label":H["controls.zoomIn.ariaLabel"],disabled:M,children:S.jsx(dC,{})}),S.jsx(yr,{onClick:I,className:"react-flow__controls-zoomout",title:H["controls.zoomOut.ariaLabel"],"aria-label":H["controls.zoomOut.ariaLabel"],disabled:A,children:S.jsx(fC,{})})]}),o&&S.jsx(yr,{className:"react-flow__controls-fitview",onClick:B,title:H["controls.fitView.ariaLabel"],"aria-label":H["controls.fitView.ariaLabel"],children:S.jsx(hC,{})}),s&&S.jsx(yr,{className:"react-flow__controls-interactive",onClick:Z,title:H["controls.interactive.ariaLabel"],"aria-label":H["controls.interactive.ariaLabel"],children:C?S.jsx(mC,{}):S.jsx(gC,{})}),m]})}Qv.displayName="Controls";const yC=V.memo(Qv);function vC({id:n,x:i,y:o,width:s,height:r,style:u,color:f,strokeColor:g,strokeWidth:p,className:h,borderRadius:m,shapeRendering:v,selected:y,onClick:x}){const{background:E,backgroundColor:C}=u||{},A=f||E||C;return S.jsx("rect",{className:ot(["react-flow__minimap-node",{selected:y},h]),x:i,y:o,rx:m,ry:m,width:s,height:r,style:{fill:A,stroke:g,strokeWidth:p},shapeRendering:v,onClick:x?M=>x(M,n):void 0})}const SC=V.memo(vC),bC=n=>n.nodes.map(i=>i.id),Bd=n=>n instanceof Function?n:()=>n;function xC({nodeStrokeColor:n,nodeColor:i,nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:r,nodeComponent:u=SC,onClick:f}){const g=Re(bC,Ke),p=Bd(i),h=Bd(n),m=Bd(o),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return S.jsx(S.Fragment,{children:g.map(y=>S.jsx(wC,{id:y,nodeColorFunc:p,nodeStrokeColorFunc:h,nodeClassNameFunc:m,nodeBorderRadius:s,nodeStrokeWidth:r,NodeComponent:u,onClick:f,shapeRendering:v},y))})}function _C({id:n,nodeColorFunc:i,nodeStrokeColorFunc:o,nodeClassNameFunc:s,nodeBorderRadius:r,nodeStrokeWidth:u,shapeRendering:f,NodeComponent:g,onClick:p}){const{node:h,x:m,y:v,width:y,height:x}=Re(E=>{const C=E.nodeLookup.get(n);if(!C)return{node:void 0,x:0,y:0,width:0,height:0};const A=C.internals.userNode,{x:M,y:H}=C.internals.positionAbsolute,{width:_,height:z}=Vn(A);return{node:A,x:M,y:H,width:_,height:z}},Ke);return!h||h.hidden||!Q0(h)?null:S.jsx(g,{x:m,y:v,width:y,height:x,style:h.style,selected:!!h.selected,className:s(h),color:i(h),borderRadius:r,strokeColor:o(h),strokeWidth:u,shapeRendering:f,onClick:p,id:h.id})}const wC=V.memo(_C);var EC=V.memo(xC);const NC=200,TC=150,AC=n=>!n.hidden,CC=n=>{const i={x:-n.transform[0]/n.transform[2],y:-n.transform[1]/n.transform[2],width:n.width/n.transform[2],height:n.height/n.transform[2]};return{viewBB:i,boundingRect:n.nodeLookup.size>0?K0(Oo(n.nodeLookup,{filter:AC}),i):i,rfId:n.rfId,panZoom:n.panZoom,translateExtent:n.translateExtent,flowWidth:n.width,flowHeight:n.height,ariaLabelConfig:n.ariaLabelConfig}},MC="react-flow__minimap-desc";function Fv({style:n,className:i,nodeStrokeColor:o,nodeColor:s,nodeClassName:r="",nodeBorderRadius:u=5,nodeStrokeWidth:f,nodeComponent:g,bgColor:p,maskColor:h,maskStrokeColor:m,maskStrokeWidth:v,position:y="bottom-right",onClick:x,onNodeClick:E,pannable:C=!1,zoomable:A=!1,ariaLabel:M,inversePan:H,zoomStep:_=1,offsetScale:z=5}){const Y=Qe(),O=V.useRef(null),{boundingRect:I,viewBB:B,rfId:Z,panZoom:oe,translateExtent:$,flowWidth:ee,flowHeight:se,ariaLabelConfig:D}=Re(CC,Ke),k=n?.width??NC,T=n?.height??TC,U=I.width/k,G=I.height/T,R=Math.max(U,G),F=R*k,N=R*T,j=z*R,W=I.x-(F-I.width)/2-j,te=I.y-(N-I.height)/2-j,ce=F+j*2,de=N+j*2,ue=`${MC}-${Z}`,re=V.useRef(0),fe=V.useRef();re.current=R,V.useEffect(()=>{if(O.current&&oe)return fe.current=KN({domNode:O.current,panZoom:oe,getTransform:()=>Y.getState().transform,getViewScale:()=>re.current}),()=>{fe.current?.destroy()}},[oe]),V.useEffect(()=>{fe.current?.update({translateExtent:$,width:ee,height:se,inversePan:H,pannable:C,zoomStep:_,zoomable:A})},[C,A,H,_,$,ee,se]);const Ee=x?Se=>{const[Ce,Ie]=fe.current?.pointer(Se)||[0,0];x(Se,{x:Ce,y:Ie})}:void 0,xe=E?V.useCallback((Se,Ce)=>{const Ie=Y.getState().nodeLookup.get(Ce).internals.userNode;E(Se,Ie)},[]):void 0,ye=M??D["minimap.ariaLabel"];return S.jsx(Xr,{position:y,style:{...n,"--xy-minimap-background-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-width-props":typeof v=="number"?v*R:void 0,"--xy-minimap-node-background-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-width-props":typeof f=="number"?f:void 0},className:ot(["react-flow__minimap",i]),"data-testid":"rf__minimap",children:S.jsxs("svg",{width:k,height:T,viewBox:`${W} ${te} ${ce} ${de}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ue,ref:O,onClick:Ee,children:[ye&&S.jsx("title",{id:ue,children:ye}),S.jsx(EC,{onClick:xe,nodeColor:s,nodeStrokeColor:o,nodeBorderRadius:u,nodeClassName:r,nodeStrokeWidth:f,nodeComponent:g}),S.jsx("path",{className:"react-flow__minimap-mask",d:`M${W-j},${te-j}h${ce+j*2}v${de+j*2}h${-ce-j*2}z
|
|
21
|
-
M${B.x},${B.y}h${B.width}v${B.height}h${-B.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Fv.displayName="MiniMap";const zC=V.memo(Fv),DC=n=>i=>n?`${Math.max(1/i.transform[2],1)}`:void 0,RC={[fl.Line]:"right",[fl.Handle]:"bottom-right"};function jC({nodeId:n,position:i,variant:o=fl.Handle,className:s,style:r=void 0,children:u,color:f,minWidth:g=10,minHeight:p=10,maxWidth:h=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:v=!1,resizeDirection:y,autoScale:x=!0,shouldResize:E,onResizeStart:C,onResize:A,onResizeEnd:M}){const H=Av(),_=typeof n=="string"?n:H,z=Qe(),Y=V.useRef(null),O=o===fl.Handle,I=Re(V.useCallback(DC(O&&x),[O,x]),Ke),B=V.useRef(null),Z=i??RC[o];V.useEffect(()=>{if(!(!Y.current||!_))return B.current||(B.current=rT({domNode:Y.current,nodeId:_,getStoreItems:()=>{const{nodeLookup:$,transform:ee,snapGrid:se,snapToGrid:D,nodeOrigin:k,domNode:T}=z.getState();return{nodeLookup:$,transform:ee,snapGrid:se,snapToGrid:D,nodeOrigin:k,paneDomNode:T}},onChange:($,ee)=>{const{triggerNodeChanges:se,nodeLookup:D,parentLookup:k,nodeOrigin:T}=z.getState(),U=[],G={x:$.x,y:$.y},R=D.get(_);if(R&&R.expandParent&&R.parentId){const F=R.origin??T,N=$.width??R.measured.width??0,j=$.height??R.measured.height??0,W={id:R.id,parentId:R.parentId,rect:{width:N,height:j,...F0({x:$.x??R.position.x,y:$.y??R.position.y},{width:N,height:j},R.parentId,D,F)}},te=Sf([W],D,k,T);U.push(...te),G.x=$.x?Math.max(F[0]*N,$.x):void 0,G.y=$.y?Math.max(F[1]*j,$.y):void 0}if(G.x!==void 0&&G.y!==void 0){const F={id:_,type:"position",position:{...G}};U.push(F)}if($.width!==void 0&&$.height!==void 0){const N={id:_,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:$.width,height:$.height}};U.push(N)}for(const F of ee){const N={...F,type:"position"};U.push(N)}se(U)},onEnd:({width:$,height:ee})=>{const se={id:_,type:"dimensions",resizing:!1,dimensions:{width:$,height:ee}};z.getState().triggerNodeChanges([se])}})),B.current.update({controlPosition:Z,boundaries:{minWidth:g,minHeight:p,maxWidth:h,maxHeight:m},keepAspectRatio:v,resizeDirection:y,onResizeStart:C,onResize:A,onResizeEnd:M,shouldResize:E}),()=>{B.current?.destroy()}},[Z,g,p,h,m,v,C,A,M,E]);const oe=Z.split("-");return S.jsx("div",{className:ot(["react-flow__resize-control","nodrag",...oe,o,s]),ref:Y,style:{...r,scale:I,...f&&{[O?"backgroundColor":"borderColor"]:f}},children:u})}V.memo(jC);const Id=5;function OC({id:n,data:i,selected:o}){const{t:s}=Ve(),r=i,u=ae(D=>D.updateNodePrompt),f=ae(D=>D.addNodeReferences),g=ae(D=>D.removeNodeReference),p=ae(D=>D.generateNode),h=ae(D=>D.addChildNode),m=ae(D=>D.duplicateBranchRoot),v=ae(D=>D.deleteNode),y=V.useRef(null),[x,E]=V.useState(!1),C=r.referenceImages??[],A=r.status==="pending"||r.status==="reconciling",M=!r.parentServerNodeId&&!A&&C.length<Id,H=V.useCallback(D=>u(n,D.target.value),[n,u]),_=V.useCallback(()=>{p(n)},[n,p]),z=V.useCallback(()=>{r.status==="ready"&&h(n)},[n,r.status,h]),Y=V.useCallback(()=>{m(n)},[n,m]),O=V.useCallback(()=>v(n),[n,v]),I=D=>{if(!D)return[];const k=[];for(const T of Array.from(D)){if(T.kind!=="file"||!T.type.startsWith("image/"))continue;const U=T.getAsFile();U&&k.push(U)}return k},B=D=>{if(D.preventDefault(),D.stopPropagation(),E(!1),!M)return;const k=Array.from(D.dataTransfer.files).filter(T=>T.type.startsWith("image/"));k.length>0&&f(n,k)},Z=D=>{D.preventDefault(),D.stopPropagation(),M&&!x&&E(!0)},oe=D=>{D.currentTarget.contains(D.relatedTarget)||E(!1)},$=D=>{const k=I(D.clipboardData?.items??null);if(k.length===0||(D.preventDefault(),D.stopPropagation(),!M))return;const T=Id-C.length;f(n,k.slice(0,T))},se=(()=>{switch(r.status){case"empty":return s("node.empty");case"pending":return s("node.pending");case"reconciling":return r.pendingPhase?s("node.reconcilingPhase",{phase:r.pendingPhase}):s("node.reconciling");case"ready":return[r.webSearchCalls?s("node.readyWithSearch",{elapsed:r.elapsed??"?",searches:r.webSearchCalls}):s("node.ready",{elapsed:r.elapsed??"?"}),Wy(r.model)].filter(Boolean).join(" · ");case"stale":return r.error?s("node.staleWithError",{error:r.error}):s("node.stale");case"asset-missing":return r.error?s("node.assetMissingWithError",{error:r.error}):s("node.assetMissing");case"error":return s("node.error",{error:r.error??s("node.errorUnknown")});default:return""}})();return S.jsxs("div",{className:`image-node image-node--${r.status}${o?" image-node--selected":""}`,children:[r.parentServerNodeId?S.jsx(hl,{type:"target",position:me.Left,className:"image-node__handle"}):null,S.jsx("div",{className:"image-node__preview",children:r.imageUrl&&r.status!=="asset-missing"?S.jsx("img",{src:r.imageUrl,alt:s("node.nodeImageAlt")}):A&&r.partialImageUrl?S.jsx("img",{className:"image-node__partial",src:r.partialImageUrl,alt:s("node.partialImageAlt")}):A?S.jsx("div",{className:"image-node__skeleton"}):r.status==="asset-missing"?S.jsx("div",{className:"image-node__placeholder",children:s("node.noAsset")}):r.status==="stale"?S.jsx("div",{className:"image-node__placeholder",children:s("node.stateStale")}):S.jsx("div",{className:"image-node__placeholder",children:s("node.noImage")})}),S.jsxs("div",{className:`image-node__composer nodrag${x?" is-dragging":""}`,onDrop:B,onDragOver:Z,onDragLeave:oe,onPaste:$,children:[C.length>0?S.jsx("div",{className:"image-node__refs",children:C.map((D,k)=>S.jsxs("div",{className:"image-node__ref-chip",title:s("node.refAlt",{n:k+1}),children:[S.jsx("img",{src:D,alt:s("node.refAlt",{n:k+1})}),S.jsx("button",{type:"button",className:"image-node__ref-remove",onClick:()=>g(n,k),disabled:A,"aria-label":s("node.removeRef",{n:k+1}),children:"×"})]},k))}):null,S.jsx("textarea",{className:"image-node__prompt",value:r.prompt,onChange:H,onKeyDown:D=>D.stopPropagation(),placeholder:r.parentServerNodeId?s("node.editPromptPlaceholder"):s("node.promptPlaceholder"),rows:2,disabled:A}),S.jsxs("div",{className:"image-node__composer-bar",children:[S.jsx("button",{type:"button",className:"image-node__attach",onClick:()=>M&&y.current?.click(),disabled:!M,title:r.parentServerNodeId?s("node.nodeRefsUnsupportedForEdit"):s("node.attachRefTitle"),children:s("node.attachRef")}),x?S.jsx("span",{className:"image-node__drop-hint",children:s("node.dropRefs")}):C.length>0?S.jsxs("span",{className:"image-node__ref-count",children:[C.length,"/",Id]}):null]}),S.jsx("input",{ref:y,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:D=>{const k=Array.from(D.target.files??[]);k.length>0&&f(n,k),D.target.value=""}})]}),S.jsxs("div",{className:"image-node__footer",children:[S.jsx("span",{className:"image-node__status",title:se,children:se}),S.jsxs("div",{className:"image-node__actions nodrag",children:[S.jsx("button",{type:"button",onClick:_,disabled:A,children:r.status==="ready"?s("node.regenerate"):s("node.generate")}),r.status==="ready"?S.jsxs(S.Fragment,{children:[S.jsx("button",{type:"button",onClick:z,title:s("node.addChildTitle"),children:s("node.addChild")}),S.jsx("button",{type:"button",onClick:Y,title:s("node.duplicateBranchTitle"),children:s("node.duplicateBranch")})]}):null,S.jsx("button",{type:"button",onClick:O,className:"image-node__del",title:s("node.deleteTitle"),children:"×"})]})]}),S.jsx(hl,{type:"source",position:me.Right,className:"image-node__handle image-node__handle--source"})]})}const HC=V.memo(OC);function LC(){const{t:n}=Ve(),i=ae(_=>_.graphNodes),o=ae(_=>_.graphEdges),s=ae(_=>_.setGraphNodes),r=ae(_=>_.setGraphEdges),u=ae(_=>_.addRootNode),f=ae(_=>_.addChildNodeAt),g=ae(_=>_.connectNodes),p=ae(_=>_.deleteNodes),h=ae(_=>_.sessionLoading),m=ae(_=>_.resolvedTheme),{screenToFlowPosition:v}=Zr(),y=V.useRef(null),x=V.useMemo(()=>({imageNode:HC}),[]),E=V.useCallback(_=>s(xv(_,i)),[i,s]),C=V.useCallback(_=>r(_v(_,o)),[o,r]),A=V.useCallback(_=>{_.source&&_.target&&g(_.source,_.target)},[g]),M=V.useCallback((_,z)=>{if(z.isValid)return;const Y=z.fromNode?.id;if(!Y)return;const O="touches"in _?_.changedTouches[0].clientX:_.clientX,I="touches"in _?_.changedTouches[0].clientY:_.clientY,B=v({x:O,y:I});f(Y,B)},[f,v]),H=V.useCallback(_=>p(_.map(z=>z.id)),[p]);return S.jsxs("main",{className:"node-canvas",ref:y,children:[h&&S.jsx("div",{className:"node-canvas__loading",children:n("nodeCanvas.loading")}),i.length===0?S.jsx("button",{type:"button",className:"node-canvas__plus",onClick:()=>u(),children:n("nodeCanvas.addFirst")}):S.jsxs(S.Fragment,{children:[S.jsxs(lC,{nodes:i,edges:o,onNodesChange:E,onEdgesChange:C,onConnect:A,onConnectEnd:M,onNodesDelete:H,nodeTypes:x,connectionRadius:32,fitView:!0,deleteKeyCode:["Delete","Backspace"],proOptions:{hideAttribution:!0},children:[S.jsx(uC,{gap:24,color:m==="light"?"#d9dee6":"#2a2a2a"}),S.jsx(yC,{className:"node-canvas__controls"}),S.jsx(zC,{pannable:!0,zoomable:!0,maskColor:m==="light"?"rgba(246, 247, 251, 0.72)":"rgba(10, 10, 10, 0.7)",nodeColor:m==="light"?"#1f2430":"#f0f0f0",nodeStrokeColor:m==="light"?"#ffffff":"#1a1a1a",style:{background:m==="light"?"#ffffff":"#141414",border:`1px solid ${m==="light"?"#d9dee6":"#2a2a2a"}`}})]}),S.jsx("button",{type:"button",className:"node-canvas__add-root",onClick:()=>u(),title:n("nodeCanvas.addRootTitle"),children:"+"}),S.jsx("div",{className:"node-canvas__hint",children:n("nodeCanvas.hint")})]})]})}function UC(){return S.jsx($v,{children:S.jsx(LC,{})})}function Gn({title:n,help:i,items:o,value:s,onChange:r}){return S.jsxs("div",{className:"option-group",children:[n?S.jsx("div",{className:"section-title",children:n}):null,S.jsx("div",{className:"option-row",children:o.map(u=>S.jsxs("button",{className:`option-btn${u.value===s?" active":""}`,style:u.color?{color:u.color}:void 0,disabled:u.disabled,onClick:()=>r(u.value),type:"button",children:[u.label,u.sub?S.jsxs(S.Fragment,{children:[S.jsx("br",{}),S.jsx("span",{className:"option-sub",children:u.sub})]}):null]},u.value))}),i?S.jsx("p",{className:"option-help",children:i}):null]})}function fo(n){return n.map(i=>({value:i.value,label:i.label,sub:i.sub}))}function BC(){const n=ae(x=>x.sizePreset),i=ae(x=>x.setSizePreset),o=ae(x=>x.customW),s=ae(x=>x.customH),r=ae(x=>x.setCustomSize),{t:u}=Ve(),[f,g]=V.useState(String(o)),[p,h]=V.useState(String(s)),m=n==="custom";V.useEffect(()=>{g(String(o)),h(String(s))},[o,s]);function v(){const x=il(f,o),E=il(p,s);r(x,E),g(String(x)),h(String(E))}function y(x){x.key==="Enter"&&(x.preventDefault(),v())}return S.jsxs("div",{className:"option-group",children:[S.jsx("div",{className:"section-title",children:u("size.title")}),S.jsx(Gn,{title:"",items:fo(P1),value:n,onChange:i}),S.jsx(Gn,{title:"",items:fo(W1),value:n,onChange:i}),S.jsx(Gn,{title:"",items:fo(e2),value:n,onChange:i}),S.jsx(Gn,{title:"",items:fo(t2),value:n,onChange:i}),S.jsx(Gn,{title:"",items:fo(n2()),value:n,onChange:i}),m?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"option-row",children:[S.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"custom-size-input",value:f,onChange:x=>g(x.target.value.replace(/\D/g,"")),onBlur:v,onKeyDown:y,placeholder:u("size.width")}),S.jsx("span",{style:{color:"var(--text-dim)",alignSelf:"center",fontFamily:"var(--mono)",fontSize:12},children:"x"}),S.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"custom-size-input",value:p,onChange:x=>h(x.target.value.replace(/\D/g,"")),onBlur:v,onKeyDown:y,placeholder:u("size.height")})]}),S.jsx("div",{className:"size-hint",children:u("size.hint")})]}):null]})}const IC={low:{"1024x1024":.006,"1024x1536":.005,"1536x1024":.005,"1024x1360":.005,"1360x1024":.005,"1024x1824":.006,"1824x1024":.006,"2048x2048":.012,"2048x1152":.009,"1152x2048":.009,"3824x2160":.023,"2160x3824":.023,auto:.006},medium:{"1024x1024":.053,"1024x1536":.041,"1536x1024":.041,"1024x1360":.041,"1360x1024":.041,"1024x1824":.05,"1824x1024":.05,"2048x2048":.106,"2048x1152":.08,"1152x2048":.08,"3824x2160":.2,"2160x3824":.2,auto:.053},high:{"1024x1024":.211,"1024x1536":.165,"1536x1024":.165,"1024x1360":.165,"1360x1024":.165,"1024x1824":.2,"1824x1024":.2,"2048x2048":.422,"2048x1152":.32,"1152x2048":.32,"3824x2160":.8,"2160x3824":.8,auto:.211}};function qC(n,i){return IC[n]?.[i]??0}function GC(){const{t:n}=Ve(),i=ae(h=>h.provider),o=ae(h=>h.quality),r=ae(h=>h.getResolvedSize)(),u=i==="oauth",f=qC(o,r),g=u?n("cost.free"):n("cost.approx",{amount:f.toFixed(3)}),p=u?"var(--green)":void 0;return S.jsxs("div",{className:"cost-estimate",children:[S.jsx("span",{children:n("cost.label")}),S.jsx("span",{className:"price",style:p?{color:p}:void 0,children:g})]})}const kC=[{value:"png",label:"PNG"},{value:"jpeg",label:"JPEG"},{value:"webp",label:"WebP"}],YC=[{value:"1",label:"1"},{value:"2",label:"2"},{value:"4",label:"4"}];function VC(){const n=ae(A=>A.rightPanelOpen),i=ae(A=>A.toggleRightPanel),{t:o}=Ve(),[s,r]=V.useState(typeof window<"u"?window.matchMedia("(max-width: 800px)").matches:!1);V.useEffect(()=>{if(typeof window>"u")return;const A=window.matchMedia("(max-width: 800px)"),M=()=>r(A.matches);return A.addEventListener("change",M),()=>A.removeEventListener("change",M)},[]);const u=s?n:!0,f=ae(A=>A.quality),g=ae(A=>A.setQuality),p=ae(A=>A.format),h=ae(A=>A.setFormat),m=ae(A=>A.moderation),v=ae(A=>A.setModeration),y=ae(A=>A.count),x=ae(A=>A.setCount),E=[{value:"low",label:o("quality.lowLabel"),sub:o("quality.lowSub")},{value:"medium",label:o("quality.mediumLabel"),sub:o("quality.mediumSub")},{value:"high",label:o("quality.highLabel"),sub:o("quality.highSub")}],C=[{value:"auto",label:o("moderation.autoLabel"),sub:o("moderation.autoSub")},{value:"low",label:o("moderation.lowLabel"),sub:o("moderation.lowSub"),color:"var(--amber)"}];return S.jsxs(S.Fragment,{children:[s&&n?S.jsx("div",{className:"right-panel-backdrop",role:"button","aria-label":o("panel.closeSettings"),onClick:i}):null,S.jsxs("aside",{className:`right-panel${n?"":" collapsed"}${s&&u?" drawer-open":""}`,"aria-label":o("panel.detailSettings"),children:[S.jsx("button",{type:"button",className:"right-panel-toggle","aria-expanded":n,"aria-controls":"right-panel-body",onClick:i,title:o(n?"panel.toggleHide":"panel.toggleShow"),children:s?o(n?"panel.close":"panel.open"):n?">":"<"}),S.jsxs("div",{id:"right-panel-body",className:"right-panel-body",hidden:!n,children:[S.jsx("div",{className:"section-title",children:o("panel.detailSettings")}),S.jsx(Gn,{title:o("quality.title"),items:E,value:f,onChange:g}),S.jsx(BC,{}),S.jsx(Gn,{title:o("format.title"),items:kC,value:p,onChange:h}),S.jsx(Gn,{title:o("moderation.title"),items:C,value:m,onChange:v}),S.jsx("p",{className:"option-help",children:o("moderation.explain")}),S.jsx(Gn,{title:o("count.title"),items:YC,value:String(y),onChange:A=>x(Number(A))}),S.jsx(GC,{})]})]})]})}function XC(){const[n,i]=V.useState(null),[o,s]=V.useState(!1);return V.useEffect(()=>{let r=!1;return px().then(u=>{r||i(u)}).catch(()=>{r||s(!0)}),()=>{r=!0}},[]),{data:n,error:o}}function ZC(){const[n,i]=V.useState(null);return V.useEffect(()=>{let o=!1,s=null;const r=async()=>{try{const u=await mx();if(o)return;i(u),u.status==="starting"&&(s=setTimeout(r,3e3))}catch{o||i(null)}};return r(),()=>{o=!0,s&&clearTimeout(s)}},[]),n}function $C(n){return n==="ready"?"Ready":n==="auth_required"?"Login required":n==="starting"?"Starting":n==="offline"?"Offline":"Checking"}function KC(){const{t:n}=Ve(),i=ZC(),{data:o,error:s}=XC(),r=o?.apiKeySource==="env"||o?.apiKeySource==="config"||o?.apiKeyValid===!0,u=i?.status==="ready",f=o?.apiKeySource==="config"?n("settings.account.apiSourceConfig"):n("settings.account.apiSourceEnv");return S.jsxs(S.Fragment,{children:[S.jsxs("article",{className:"settings-row",children:[S.jsxs("div",{className:"settings-row__copy",children:[S.jsx("p",{className:"settings-eyebrow",children:n("settings.account.primaryEyebrow")}),S.jsx("h4",{children:n("settings.account.oauthTitle")}),S.jsx("p",{children:n("settings.account.oauthBody")})]}),S.jsxs("div",{className:`settings-status${u?" is-ok":""}`,children:[S.jsx("span",{"aria-hidden":"true"}),$C(i?.status)]})]}),r?S.jsxs("article",{className:"settings-row",children:[S.jsxs("div",{className:"settings-row__copy",children:[S.jsx("p",{className:"settings-eyebrow",children:f}),S.jsx("h4",{children:n("settings.account.apiTitle")}),S.jsx("p",{children:n("settings.account.apiBody")})]}),S.jsxs("div",{className:"settings-status is-muted",children:[S.jsx("span",{"aria-hidden":"true"}),n(s?"settings.account.apiUnknown":"settings.account.apiDisabled")]})]}):null]})}const QC={ko:"KO",en:"EN"};function FC(){const{t:n,locale:i}=Ve(),o=ae(s=>s.setLocale);return S.jsx("div",{className:"lang-toggle",role:"group","aria-label":n("language.label"),children:Z1.map(s=>S.jsx("button",{type:"button",className:`lang-toggle__btn ${i===s?"is-active":""}`,onClick:()=>o(s),"aria-pressed":i===s,title:n(`language.${s}`),children:S.jsx("span",{className:"lang-toggle__label",children:QC[s]})},s))})}const JC=["system","dark","light"];function PC(){const{t:n}=Ve(),i=ae(s=>s.theme),o=ae(s=>s.setTheme);return S.jsx("div",{className:"theme-toggle",role:"group","aria-label":n("theme.label"),children:JC.map(s=>S.jsx("button",{type:"button",className:`theme-toggle__btn ${i===s?"is-active":""}`,onClick:()=>o(s),"aria-pressed":i===s,title:n(`theme.${s}`),children:n(`theme.${s}`)},s))})}const qd=["account","generation","appearance","language","future"];function ho({id:n,setRef:i,children:o}){const{t:s}=Ve();return S.jsxs("section",{id:n,ref:r=>i(n,r),className:"settings-section","aria-labelledby":`settings-section-${n}`,children:[S.jsx("header",{className:"settings-section__header",children:S.jsxs("div",{children:[S.jsx("h3",{id:`settings-section-${n}`,children:s(`settings.sections.${n}.title`)}),S.jsx("p",{children:s(`settings.sections.${n}.hint`)})]})}),S.jsx("div",{className:"settings-section__body",children:o})]})}function WC(){const{t:n}=Ve(),i=ae(m=>m.activeSettingsSection),o=ae(m=>m.setActiveSettingsSection),s=ae(m=>m.closeSettings),r=V.useRef(null),u=V.useRef(null),f=V.useRef(!1),g=V.useRef({account:null,generation:null,appearance:null,language:null,future:null}),p=(m,v)=>{g.current[m]=v},h=m=>{o(m),f.current=!0,g.current[m]?.scrollIntoView({behavior:"auto",block:"start"}),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{f.current=!1,u.current=null},120)};return V.useEffect(()=>{const m=v=>{v.key==="Escape"&&s()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[s]),V.useEffect(()=>{const m=r.current;if(!m||typeof IntersectionObserver!="function")return;const v=new IntersectionObserver(y=>{if(f.current)return;const E=y.filter(C=>C.isIntersecting).sort((C,A)=>A.intersectionRatio-C.intersectionRatio)[0]?.target.id;E&&qd.includes(E)&&o(E)},{root:m,threshold:[.35,.6]});for(const y of qd){const x=g.current[y];x&&v.observe(x)}return()=>v.disconnect()},[o]),V.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]),S.jsx("main",{ref:r,className:"settings-workspace","aria-labelledby":"settings-title",children:S.jsxs("div",{className:"settings-shell",children:[S.jsxs("header",{className:"settings-header",children:[S.jsxs("div",{children:[S.jsx("p",{className:"settings-eyebrow",children:n("settings.eyebrow")}),S.jsx("h2",{id:"settings-title",children:n("settings.title")}),S.jsx("p",{children:n("settings.subtitle")})]}),S.jsx("button",{type:"button",className:"settings-close",onClick:s,"aria-label":n("settings.closeAria"),title:n("settings.closeTitle"),children:"X"})]}),S.jsxs("div",{className:"settings-layout",children:[S.jsx("nav",{className:"settings-nav","aria-label":n("settings.navAria"),children:qd.map(m=>S.jsxs("button",{type:"button",className:`settings-nav__item${i===m?" is-active":""}`,onClick:()=>h(m),"aria-label":n("settings.jumpTo",{section:n(`settings.sections.${m}.title`)}),children:[S.jsx("span",{children:n(`settings.sections.${m}.title`)}),S.jsx("small",{children:n(`settings.sections.${m}.hint`)})]},m))}),S.jsxs("section",{className:"settings-content","aria-label":n("settings.contentAria"),children:[S.jsx(ho,{id:"account",setRef:p,children:S.jsx(KC,{})}),S.jsx(ho,{id:"generation",setRef:p,children:S.jsxs("article",{className:"settings-row",children:[S.jsxs("div",{className:"settings-row__copy",children:[S.jsx("h4",{children:n("settings.imageModel.title")}),S.jsx("p",{children:n("settings.imageModel.body")}),S.jsx("p",{className:"settings-row__microcopy",children:n("settings.imageModel.unsupportedHelp")})]}),S.jsx("div",{className:"settings-row__control",children:S.jsx(c0,{variant:"settings"})})]})}),S.jsx(ho,{id:"appearance",setRef:p,children:S.jsxs("article",{className:"settings-row",children:[S.jsxs("div",{className:"settings-row__copy",children:[S.jsx("h4",{children:n("settings.appearance.themeTitle")}),S.jsx("p",{children:n("settings.appearance.themeBody")})]}),S.jsx("div",{className:"settings-row__control",children:S.jsx(PC,{})})]})}),S.jsx(ho,{id:"language",setRef:p,children:S.jsxs("article",{className:"settings-row",children:[S.jsxs("div",{className:"settings-row__copy",children:[S.jsx("h4",{children:n("settings.language.title")}),S.jsx("p",{children:n("settings.language.body")})]}),S.jsx("div",{className:"settings-row__control",children:S.jsx(FC,{})})]})}),S.jsx(ho,{id:"future",setRef:p,children:S.jsxs("article",{className:"settings-note",children:[S.jsx("h4",{children:n("settings.future.title")}),S.jsx("p",{children:n("settings.future.body")})]})})]})]})]})})}function eM(){const n=ae(r=>r.toast),[i,o]=V.useState(!1);if(V.useEffect(()=>{if(!n)return;o(!0);const r=setTimeout(()=>o(!1),3e3);return()=>clearTimeout(r)},[n]),!n)return null;const s=["toast",i?"visible":"",n.error?"error":""].filter(Boolean).join(" ");return S.jsx("div",{className:s,children:n.message})}function tM(){const{t:n}=Ve(),i=ae(v=>v.errorCard),o=ae(v=>v.dismissErrorCard);if(!i)return null;const s=vo[i.code]??vo.UNKNOWN,r=`${s.cardKey??"errorCard.unknown"}.title`,u=`${s.cardKey??"errorCard.unknown"}.body`,f=s.cta?`${s.cardKey??"errorCard.unknown"}.cta`:null,g=n(r),p=n(u),h=f?n(f):null,m=()=>{if(s.cta==="reload"){window.location.reload();return}else o()};return S.jsx("div",{className:"error-card-backdrop",role:"alertdialog","aria-labelledby":"error-card-title",children:S.jsxs("div",{className:"error-card",children:[S.jsx("div",{className:"error-card__icon","aria-hidden":"true",children:S.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[S.jsx("circle",{cx:"12",cy:"12",r:"10"}),S.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),S.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),S.jsxs("div",{className:"error-card__content",children:[S.jsx("h3",{id:"error-card-title",className:"error-card__title",children:g}),S.jsx("p",{className:"error-card__body",children:p}),i.fallbackMessage&&S.jsxs("details",{className:"error-card__details",children:[S.jsx("summary",{children:n("errorCard.details")}),S.jsx("pre",{children:i.fallbackMessage})]}),S.jsxs("div",{className:"error-card__actions",children:[S.jsx("button",{type:"button",className:"btn btn--ghost",onClick:o,children:n("errorCard.close")}),h&&S.jsx("button",{type:"button",className:"btn btn--primary",onClick:m,children:h})]})]})]})})}const Xy="ima2.storageNoticeDismissed.0.09.23";function nM(n){if(!n)return"earlier";const i=new Date(n);if(Number.isNaN(i.getTime()))return"earlier";const s=Math.floor((new Date().getTime()-i.getTime())/864e5);return s===0?"today":s===1?"yesterday":s<7?"thisWeek":i.toLocaleDateString("ko-KR",{year:"numeric",month:"short",day:"numeric"})}function aM(){const{t:n}=Ve(),i=ae(R=>R.galleryOpen),o=ae(R=>R.closeGallery),s=ae(R=>R.history),r=ae(R=>R.selectHistory),u=ae(R=>R.currentImage),f=ae(R=>R.removeFromHistory),g=ae(R=>R.addHistoryItem),p=ae(R=>R.showToast),[h,m]=V.useState(""),[v,y]=V.useState("date"),[x,E]=V.useState([]),[C,A]=V.useState([]),[M,H]=V.useState(null),[_,z]=V.useState(null),[Y,O]=V.useState(()=>{try{return localStorage.getItem(Xy)==="1"}catch{return!1}});V.useEffect(()=>{if(!i)return;const R=F=>{F.key==="Escape"&&o()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[i,o]),V.useEffect(()=>{i||(m(""),H(null))},[i]),V.useEffect(()=>{if(!i)return;let R=!1;return(async()=>{try{const F=await Sx();R||z(F)}catch{R||z({generatedDirLabel:"~/.ima2/generated",generatedCount:0,legacyCandidatesScanned:0,legacySourcesFound:0,legacyFilesFound:0,state:"unknown",messageKind:"unknown",recoveryDocsPath:"docs/RECOVER_OLD_IMAGES.md",doctorCommand:"ima2 doctor",overrides:{generatedDir:!1,configDir:!1}})}})(),()=>{R=!0}},[i]),V.useEffect(()=>{if(!i||v!=="session")return;let R=!1;return(async()=>{try{const F=await vx({limit:500});if(R)return;const N=j=>{const W=j.kind,te=W==="classic"||W==="edit"||W==="generate"?W:null;return{image:j.url,url:j.url,filename:j.filename,prompt:j.prompt??void 0,size:j.size??void 0,quality:j.quality??void 0,model:j.model??void 0,provider:j.provider,createdAt:j.createdAt,sessionId:j.sessionId??null,nodeId:j.nodeId??null,clientNodeId:j.clientNodeId??null,kind:te}};E(F.sessions.map(j=>({sessionId:j.sessionId,title:j.title??null,label:j.label??null,displayLabel:j.title||j.label||j.sessionId.slice(0,8),items:j.items.map(N)}))),A(F.loose.map(N))}catch{}})(),()=>{R=!0}},[i,v]);const I=V.useMemo(()=>{const R=h.trim().toLowerCase().normalize("NFC");return R?s.filter(F=>(F.prompt??"").toLowerCase().normalize("NFC").includes(R)||(F.filename??"").toLowerCase().normalize("NFC").includes(R)):s},[s,h]),B=V.useMemo(()=>{const R=new Map;for(const F of I){const N=nM(F.createdAt);R.has(N)||R.set(N,[]),R.get(N).push(F)}return Array.from(R.entries())},[I]);V.useEffect(()=>{if(!M)return;const R=setInterval(()=>{H(F=>!F||Date.now()>=F.expiresAt?null:{...F})},500);return()=>clearInterval(R)},[M]);async function Z(R,F){if(F.stopPropagation(),!!R.filename)try{const N=await xx(R.filename);f(R.filename),H({filename:R.filename,trashId:N.trashId,item:R,expiresAt:Date.now()+9500})}catch(N){console.error("[gallery] delete failed",N)}}async function oe(){if(M)try{await _x(M.filename,M.trashId),g(M.item)}catch(R){console.error("[gallery] restore failed",R)}finally{H(null)}}async function $(){try{await bx()}catch{p(n("toast.openGeneratedDirFailed"),!0)}}function ee(){O(!0);try{localStorage.setItem(Xy,"1")}catch{}}if(!i)return null;const se=R=>R==="earlier"||R==="today"||R==="yesterday"||R==="thisWeek"?n(`gallery.${R}`):R,D=(R,F,N)=>{const j=u?.image===R.image;return S.jsxs("div",{className:`gallery__tile-wrap${j?" gallery__tile-wrap--active":""}`,children:[S.jsxs("button",{type:"button",className:`gallery__tile${j?" gallery__tile--active":""}`,onClick:()=>{r(R),o()},title:R.prompt??"",children:[S.jsx("img",{src:R.thumb||R.image,alt:R.prompt??n("gallery.imageAltFallback"),loading:"lazy",decoding:"async"}),R.prompt&&S.jsx("div",{className:"gallery__caption",children:S.jsx("span",{className:"gallery__caption-text",children:R.prompt})})]}),R.filename&&S.jsx("button",{type:"button",className:"gallery__delete",onClick:W=>Z(R,W),title:n("gallery.deleteTitle"),"aria-label":n("gallery.deleteAria"),children:"×"})]},`${F}-${N}-${R.filename??N}`)},k=v==="session",T=k?x.reduce((R,F)=>R+F.items.length,0)+C.length:I.length,U=_!=null&&_.state!=="ok"&&!Y,G=_?.state==="recoverable"?"gallery.storageNoticeRecoverable":_?.state==="not_found"?"gallery.storageNoticeNotFound":"gallery.storageNoticeUnknown";return S.jsx("div",{className:"gallery-backdrop",onClick:o,role:"presentation",children:S.jsxs("div",{className:"gallery",role:"dialog","aria-modal":"true","aria-label":n("gallery.ariaLabel"),onClick:R=>R.stopPropagation(),children:[S.jsxs("div",{className:"gallery__header",children:[S.jsxs("div",{className:"gallery__title-row",children:[S.jsx("div",{className:"gallery__title",children:n("gallery.title")}),S.jsxs("div",{className:"gallery__meta",children:[n("gallery.total",{n:T}),h?n("gallery.totalFiltered",{n:s.length}):""]}),S.jsxs("div",{className:"gallery__group-toggle",role:"tablist","aria-label":n("gallery.sortByAria"),children:[S.jsx("button",{type:"button",role:"tab","aria-selected":v==="date",className:v==="date"?"active":"",onClick:()=>y("date"),children:n("gallery.sortByDate")}),S.jsx("button",{type:"button",role:"tab","aria-selected":v==="session",className:v==="session"?"active":"",onClick:()=>y("session"),children:n("gallery.sortBySession")})]})]}),S.jsx("input",{type:"text",className:"gallery__search",placeholder:n(k?"gallery.searchDisabledPlaceholder":"gallery.searchPlaceholder"),value:h,onChange:R=>m(R.target.value),autoFocus:!0,disabled:k}),S.jsx("button",{type:"button",className:"gallery__close",onClick:o,"aria-label":n("gallery.closeAria"),title:n("gallery.closeTitle"),children:"×"})]}),S.jsxs("div",{className:`gallery__storage-bar${U?" gallery__storage-bar--notice":""}`,children:[U?S.jsxs("div",{className:"gallery__storage-copy",children:[S.jsx("div",{className:"gallery__storage-title",children:n("gallery.storageNoticeTitle")}),S.jsx("div",{className:"gallery__storage-text",children:n(G)})]}):S.jsx("div",{className:"gallery__storage-copy gallery__storage-copy--quiet",children:_?.generatedDirLabel??"~/.ima2/generated"}),S.jsxs("div",{className:"gallery__storage-actions",children:[S.jsx("button",{type:"button",className:"gallery__storage-button",onClick:$,title:n("gallery.openGeneratedDirTitle"),children:n("gallery.openGeneratedDir")}),U&&S.jsx("button",{type:"button",className:"gallery__storage-button gallery__storage-button--ghost",onClick:ee,children:n("common.close")})]})]}),S.jsx("div",{className:"gallery__scroll",children:k?S.jsxs(S.Fragment,{children:[x.map(R=>S.jsxs("section",{className:"gallery__group",children:[S.jsxs("header",{className:"gallery__group-header",children:[S.jsx("span",{className:"gallery__group-label",title:R.sessionId,children:R.title?R.displayLabel:n("gallery.sessionLabel",{name:R.displayLabel})}),S.jsx("span",{className:"gallery__group-count",children:R.items.length})]}),S.jsx("div",{className:"gallery__grid",children:R.items.map((F,N)=>D(F,R.sessionId,N))})]},R.sessionId)),C.length>0&&S.jsxs("section",{className:"gallery__group",children:[S.jsxs("header",{className:"gallery__group-header",children:[S.jsx("span",{className:"gallery__group-label",children:n("gallery.standalone")}),S.jsx("span",{className:"gallery__group-count",children:C.length})]}),S.jsx("div",{className:"gallery__grid",children:C.map((R,F)=>D(R,"loose",F))})]}),x.length===0&&C.length===0&&S.jsx("div",{className:"gallery__empty",children:n("gallery.emptySessions")})]}):I.length===0?S.jsx("div",{className:"gallery__empty",children:s.length===0?n("gallery.emptyAll"):n("gallery.noResults")}):B.map(([R,F])=>S.jsxs("section",{className:"gallery__group",children:[S.jsxs("header",{className:"gallery__group-header",children:[S.jsx("span",{className:"gallery__group-label",children:se(R)}),S.jsx("span",{className:"gallery__group-count",children:F.length})]}),S.jsx("div",{className:"gallery__grid",children:F.map((N,j)=>D(N,R,j))})]},R))}),M&&S.jsxs("div",{className:"gallery__undo",children:[S.jsx("span",{children:n("gallery.deleted",{filename:M.filename})}),S.jsx("button",{type:"button",onClick:oe,children:n("gallery.undo")}),S.jsx("span",{className:"gallery__undo-timer",children:n("gallery.secondsSuffix",{n:Math.max(0,Math.ceil((M.expiresAt-Date.now())/1e3))})})]})]})})}function iM(n){return n.includes("ratio")?"sizeConfirm.reasonRatio":n.includes("pixels")?"sizeConfirm.reasonPixels":n.includes("min")?"sizeConfirm.reasonMin":n.includes("max")?"sizeConfirm.reasonMax":"sizeConfirm.reasonSnap"}function lM(){const n=ae(g=>g.customSizeConfirm),i=ae(g=>g.confirmCustomSizeAdjustment),o=ae(g=>g.cancelCustomSizeAdjustment),s=V.useRef(null),{t:r}=Ve();if(V.useEffect(()=>{if(!n)return;s.current?.focus();const g=p=>{p.key==="Escape"&&o()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[o,n]),!n)return null;const u=`${n.requestedW}x${n.requestedH}`,f=`${n.adjustedW}x${n.adjustedH}`;return S.jsx("div",{className:"modal-backdrop custom-size-confirm-backdrop",role:"presentation",children:S.jsxs("div",{className:"modal custom-size-confirm",role:"dialog","aria-modal":"true","aria-labelledby":"custom-size-confirm-title","aria-describedby":"custom-size-confirm-body",children:[S.jsx("div",{id:"custom-size-confirm-title",className:"modal__title",children:r("sizeConfirm.title")}),S.jsxs("div",{id:"custom-size-confirm-body",className:"modal__body",children:[S.jsx("p",{children:r("sizeConfirm.body")}),S.jsxs("dl",{className:"size-confirm__pairs",children:[S.jsxs("div",{className:"size-confirm__pair",children:[S.jsx("dt",{children:r("sizeConfirm.requested")}),S.jsx("dd",{children:u})]}),S.jsxs("div",{className:"size-confirm__pair",children:[S.jsx("dt",{children:r("sizeConfirm.adjusted")}),S.jsx("dd",{children:f})]})]}),S.jsx("p",{className:"size-confirm__reason",children:r(iM(n.reasons))})]}),S.jsxs("div",{className:"modal__actions",children:[S.jsx("button",{ref:s,type:"button",className:"modal__btn modal__btn--secondary",onClick:o,children:r("sizeConfirm.cancel")}),S.jsx("button",{type:"button",className:"modal__btn",onClick:()=>{i()},children:r("sizeConfirm.approve")})]})]})})}function oM(){const n=ae(y=>y.hydrateHistory),i=ae(y=>y.loadSessions),o=ae(y=>y.startInFlightPolling),s=ae(y=>y.reconcileInflight),r=ae(y=>y.syncFromStorage),u=ae(y=>y.theme),f=ae(y=>y.resolvedTheme),g=ae(y=>y.settingsOpen),p=ae(y=>y.syncThemeFromStorage),h=ae(y=>y.refreshResolvedTheme),v=ae(y=>y.uiMode);return V.useEffect(()=>{n(),i(),s(),o()},[n,i,s,o]),V.useEffect(()=>{const y=x=>{x.key&&(x.key==="ima2.inFlight"||x.key==="ima2.selectedFilename"?r():x.key==="ima2:theme"&&p())};return window.addEventListener("storage",y),()=>window.removeEventListener("storage",y)},[r,p]),V.useEffect(()=>{document.documentElement.dataset.theme=f,document.documentElement.style.colorScheme=f},[f]),V.useEffect(()=>{if(u!=="system")return;const y=window.matchMedia("(prefers-color-scheme: light)");return y.addEventListener("change",h),()=>y.removeEventListener("change",h)},[h,u]),V.useEffect(()=>{const y=()=>{y2(ae.getState)};return window.addEventListener("beforeunload",y),()=>{window.removeEventListener("beforeunload",y)}},[]),S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:`app${g?" app--settings-open":""}`,"data-theme":f,children:[S.jsx(T2,{}),g?S.jsx(WC,{}):v==="classic"?S.jsx(z2,{}):S.jsx(UC,{}),S.jsx(VC,{})]}),S.jsx(lM,{}),S.jsx(eM,{}),S.jsx(tM,{}),S.jsx(aM,{})]})}ux.createRoot(document.getElementById("root")).render(S.jsx(V.StrictMode,{children:S.jsx(oM,{})}));
|
|
22
|
-
//# sourceMappingURL=index-IHSd1z1a.js.map
|