(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const p of document.querySelectorAll('link[rel="modulepreload"]'))f(p);new MutationObserver(p=>{for(const g of p)if(g.type==="childList")for(const M of g.addedNodes)M.tagName==="LINK"&&M.rel==="modulepreload"&&f(M)}).observe(document,{childList:!0,subtree:!0});function r(p){const g={};return p.integrity&&(g.integrity=p.integrity),p.referrerPolicy&&(g.referrerPolicy=p.referrerPolicy),p.crossOrigin==="use-credentials"?g.credentials="include":p.crossOrigin==="anonymous"?g.credentials="omit":g.credentials="same-origin",g}function f(p){if(p.ep)return;p.ep=!0;const g=r(p);fetch(p.href,g)}})();function O0(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Wf={exports:{}},Tu={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Kd;function D0(){if(Kd)return Tu;Kd=1;var i=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(f,p,g){var M=null;if(g!==void 0&&(M=""+g),p.key!==void 0&&(M=""+p.key),"key"in p){g={};for(var N in p)N!=="key"&&(g[N]=p[N])}else g=p;return p=g.ref,{$$typeof:i,type:f,key:M,ref:p!==void 0?p:null,props:g}}return Tu.Fragment=o,Tu.jsx=r,Tu.jsxs=r,Tu}var Jd;function x0(){return Jd||(Jd=1,Wf.exports=D0()),Wf.exports}var v=x0(),Ff={exports:{}},zu={},If={exports:{}},Pf={};/** * @license React * scheduler.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var kd;function j0(){return kd||(kd=1,(function(i){function o(x,G){var at=x.length;x.push(G);t:for(;0>>1,Ct=x[jt];if(0>>1;jtp(X,at))Zp(it,X)?(x[jt]=it,x[Z]=at,jt=Z):(x[jt]=X,x[U]=at,jt=U);else if(Zp(it,at))x[jt]=it,x[Z]=at,jt=Z;else break t}}return G}function p(x,G){var at=x.sortIndex-G.sortIndex;return at!==0?at:x.id-G.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var g=performance;i.unstable_now=function(){return g.now()}}else{var M=Date,N=M.now();i.unstable_now=function(){return M.now()-N}}var C=[],S=[],w=1,O=null,Q=3,k=!1,I=!1,lt=!1,Nt=!1,yt=typeof setTimeout=="function"?setTimeout:null,el=typeof clearTimeout=="function"?clearTimeout:null,Qt=typeof setImmediate<"u"?setImmediate:null;function nt(x){for(var G=r(S);G!==null;){if(G.callback===null)f(S);else if(G.startTime<=x)f(S),G.sortIndex=G.expirationTime,o(C,G);else break;G=r(S)}}function H(x){if(lt=!1,nt(x),!I)if(r(C)!==null)I=!0,vt||(vt=!0,Kt());else{var G=r(S);G!==null&&ol(H,G.startTime-x)}}var vt=!1,P=-1,Ut=5,Ot=-1;function Ol(){return Nt?!0:!(i.unstable_now()-Otx&&Ol());){var jt=O.callback;if(typeof jt=="function"){O.callback=null,Q=O.priorityLevel;var Ct=jt(O.expirationTime<=x);if(x=i.unstable_now(),typeof Ct=="function"){O.callback=Ct,nt(x),G=!0;break l}O===r(C)&&f(C),nt(x)}else f(C);O=r(C)}if(O!==null)G=!0;else{var h=r(S);h!==null&&ol(H,h.startTime-x),G=!1}}break t}finally{O=null,Q=at,k=!1}G=void 0}}finally{G?Kt():vt=!1}}}var Kt;if(typeof Qt=="function")Kt=function(){Qt($t)};else if(typeof MessageChannel<"u"){var ut=new MessageChannel,Dl=ut.port2;ut.port1.onmessage=$t,Kt=function(){Dl.postMessage(null)}}else Kt=function(){yt($t,0)};function ol(x,G){P=yt(function(){x(i.unstable_now())},G)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(x){x.callback=null},i.unstable_forceFrameRate=function(x){0>x||125jt?(x.sortIndex=at,o(S,x),r(C)===null&&x===r(S)&&(lt?(el(P),P=-1):lt=!0,ol(H,at-jt))):(x.sortIndex=Ct,o(C,x),I||k||(I=!0,vt||(vt=!0,Kt()))),x},i.unstable_shouldYield=Ol,i.unstable_wrapCallback=function(x){var G=Q;return function(){var at=Q;Q=G;try{return x.apply(this,arguments)}finally{Q=at}}}})(Pf)),Pf}var $d;function C0(){return $d||($d=1,If.exports=j0()),If.exports}var ts={exports:{}},ct={};/** * @license React * react.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Wd;function U0(){if(Wd)return ct;Wd=1;var i=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),M=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),S=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),Q=Symbol.iterator;function k(h){return h===null||typeof h!="object"?null:(h=Q&&h[Q]||h["@@iterator"],typeof h=="function"?h:null)}var I={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},lt=Object.assign,Nt={};function yt(h,U,X){this.props=h,this.context=U,this.refs=Nt,this.updater=X||I}yt.prototype.isReactComponent={},yt.prototype.setState=function(h,U){if(typeof h!="object"&&typeof h!="function"&&h!=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,h,U,"setState")},yt.prototype.forceUpdate=function(h){this.updater.enqueueForceUpdate(this,h,"forceUpdate")};function el(){}el.prototype=yt.prototype;function Qt(h,U,X){this.props=h,this.context=U,this.refs=Nt,this.updater=X||I}var nt=Qt.prototype=new el;nt.constructor=Qt,lt(nt,yt.prototype),nt.isPureReactComponent=!0;var H=Array.isArray;function vt(){}var P={H:null,A:null,T:null,S:null},Ut=Object.prototype.hasOwnProperty;function Ot(h,U,X){var Z=X.ref;return{$$typeof:i,type:h,key:U,ref:Z!==void 0?Z:null,props:X}}function Ol(h,U){return Ot(h.type,U,h.props)}function $t(h){return typeof h=="object"&&h!==null&&h.$$typeof===i}function Kt(h){var U={"=":"=0",":":"=2"};return"$"+h.replace(/[=:]/g,function(X){return U[X]})}var ut=/\/+/g;function Dl(h,U){return typeof h=="object"&&h!==null&&h.key!=null?Kt(""+h.key):U.toString(36)}function ol(h){switch(h.status){case"fulfilled":return h.value;case"rejected":throw h.reason;default:switch(typeof h.status=="string"?h.then(vt,vt):(h.status="pending",h.then(function(U){h.status==="pending"&&(h.status="fulfilled",h.value=U)},function(U){h.status==="pending"&&(h.status="rejected",h.reason=U)})),h.status){case"fulfilled":return h.value;case"rejected":throw h.reason}}throw h}function x(h,U,X,Z,it){var ft=typeof h;(ft==="undefined"||ft==="boolean")&&(h=null);var ot=!1;if(h===null)ot=!0;else switch(ft){case"bigint":case"string":case"number":ot=!0;break;case"object":switch(h.$$typeof){case i:case o:ot=!0;break;case w:return ot=h._init,x(ot(h._payload),U,X,Z,it)}}if(ot)return it=it(h),ot=Z===""?"."+Dl(h,0):Z,H(it)?(X="",ot!=null&&(X=ot.replace(ut,"$&/")+"/"),x(it,U,X,"",function(oe){return oe})):it!=null&&($t(it)&&(it=Ol(it,X+(it.key==null||h&&h.key===it.key?"":(""+it.key).replace(ut,"$&/")+"/")+ot)),U.push(it)),1;ot=0;var cl=Z===""?".":Z+":";if(H(h))for(var Wt=0;Wt"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(o){console.error(o)}}return i(),ls.exports=R0(),ls.exports}/** * @license React * react-dom-client.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var th;function B0(){if(th)return zu;th=1;var i=C0(),o=as(),r=H0();function f(t){var l="https://react.dev/errors/"+t;if(1Ct||(t.current=jt[Ct],jt[Ct]=null,Ct--)}function X(t,l){Ct++,jt[Ct]=t.current,t.current=l}var Z=h(null),it=h(null),ft=h(null),ot=h(null);function cl(t,l){switch(X(ft,l),X(it,t),X(Z,null),l.nodeType){case 9:case 11:t=(t=l.documentElement)&&(t=t.namespaceURI)?yd(t):0;break;default:if(t=l.tagName,l=l.namespaceURI)l=yd(l),t=vd(l,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}U(Z),X(Z,t)}function Wt(){U(Z),U(it),U(ft)}function oe(t){t.memoizedState!==null&&X(ot,t);var l=Z.current,e=vd(l,t.type);l!==e&&(X(it,t),X(Z,e))}function $e(t){it.current===t&&(U(Z),U(it)),ot.current===t&&(U(ot),gu._currentValue=at)}var Ee,Ul;function Ae(t){if(Ee===void 0)try{throw Error()}catch(e){var l=e.stack.trim().match(/\n( *(at )?)/);Ee=l&&l[1]||"",Ul=-1)":-1n||d[a]!==_[n]){var D=` `+d[a].replace(" at new "," at ");return t.displayName&&D.includes("")&&(D=D.replace("",t.displayName)),D}while(1<=a&&0<=n);break}}}finally{Nn=!1,Error.prepareStackTrace=e}return(e=t?t.displayName||t.name:"")?Ae(e):""}function W(t,l){switch(t.tag){case 26:case 27:case 5:return Ae(t.type);case 16:return Ae("Lazy");case 13:return t.child!==l&&l!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return Me(t.type,!1);case 11:return Me(t.type.render,!1);case 1:return Me(t.type,!0);case 31:return Ae("Activity");default:return""}}function On(t){try{var l="",e=null;do l+=W(t,e),e=t,t=t.return;while(t);return l}catch(a){return` Error generating stack: `+a.message+` `+a.stack}}var We=Object.prototype.hasOwnProperty,gt=i.unstable_scheduleCallback,Ma=i.unstable_cancelCallback,Vl=i.unstable_shouldYield,al=i.unstable_requestPaint,nl=i.unstable_now,Dn=i.unstable_getCurrentPriorityLevel,xn=i.unstable_ImmediatePriority,re=i.unstable_UserBlockingPriority,be=i.unstable_NormalPriority,Bl=i.unstable_LowPriority,Fe=i.unstable_IdlePriority,Ie=i.log,Na=i.unstable_setDisableYieldValue,Ne=null,xl=null;function Zl(t){if(typeof Ie=="function"&&Na(t),xl&&typeof xl.setStrictMode=="function")try{xl.setStrictMode(Ne,t)}catch{}}var pl=Math.clz32?Math.clz32:b,Xi=Math.log,Mu=Math.LN2;function b(t){return t>>>=0,t===0?32:31-(Xi(t)/Mu|0)|0}var y=256,Y=262144,q=4194304;function V(t){var l=t&42;if(l!==0)return l;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function L(t,l,e){var a=t.pendingLanes;if(a===0)return 0;var n=0,u=t.suspendedLanes,c=t.pingedLanes;t=t.warmLanes;var s=a&134217727;return s!==0?(a=s&~u,a!==0?n=V(a):(c&=s,c!==0?n=V(c):e||(e=s&~t,e!==0&&(n=V(e))))):(s=a&~u,s!==0?n=V(s):c!==0?n=V(c):e||(e=a&~t,e!==0&&(n=V(e)))),n===0?0:l!==0&&l!==n&&(l&u)===0&&(u=n&-n,e=l&-l,u>=e||u===32&&(e&4194048)!==0)?l:n}function K(t,l){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&l)===0}function dt(t,l){switch(t){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 Xt(){var t=q;return q<<=1,(q&62914560)===0&&(q=4194304),t}function Rt(t){for(var l=[],e=0;31>e;e++)l.push(t);return l}function ll(t,l){t.pendingLanes|=l,l!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function B(t,l,e,a,n,u){var c=t.pendingLanes;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=e,t.entangledLanes&=e,t.errorRecoveryDisabledLanes&=e,t.shellSuspendCounter=0;var s=t.entanglements,d=t.expirationTimes,_=t.hiddenUpdates;for(e=c&~e;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var zh=/[\n"\\]/g;function le(t){return t.replace(zh,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Qi(t,l,e,a,n,u,c,s){t.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?t.type=c:t.removeAttribute("type"),l!=null?c==="number"?(l===0&&t.value===""||t.value!=l)&&(t.value=""+Rl(l)):t.value!==""+Rl(l)&&(t.value=""+Rl(l)):c!=="submit"&&c!=="reset"||t.removeAttribute("value"),l!=null?Vi(t,c,Rl(l)):e!=null?Vi(t,c,Rl(e)):a!=null&&t.removeAttribute("value"),n==null&&u!=null&&(t.defaultChecked=!!u),n!=null&&(t.checked=n&&typeof n!="function"&&typeof n!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?t.name=""+Rl(s):t.removeAttribute("name")}function fs(t,l,e,a,n,u,c,s){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),l!=null||e!=null){if(!(u!=="submit"&&u!=="reset"||l!=null)){Gi(t);return}e=e!=null?""+Rl(e):"",l=l!=null?""+Rl(l):e,s||l===t.value||(t.value=l),t.defaultValue=l}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=s?t.checked:!!a,t.defaultChecked=!!a,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(t.name=c),Gi(t)}function Vi(t,l,e){l==="number"&&Nu(t.ownerDocument)===t||t.defaultValue===""+e||(t.defaultValue=""+e)}function Ja(t,l,e,a){if(t=t.options,l){l={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$i=!1;if(Ue)try{var Hn={};Object.defineProperty(Hn,"passive",{get:function(){$i=!0}}),window.addEventListener("test",Hn,Hn),window.removeEventListener("test",Hn,Hn)}catch{$i=!1}var la=null,Wi=null,Du=null;function ys(){if(Du)return Du;var t,l=Wi,e=l.length,a,n="value"in la?la.value:la.textContent,u=n.length;for(t=0;t=wn),Ts=" ",zs=!1;function _s(t,l){switch(t){case"keyup":return Wh.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Es(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Fa=!1;function Ih(t,l){switch(t){case"compositionend":return Es(l);case"keypress":return l.which!==32?null:(zs=!0,Ts);case"textInput":return t=l.data,t===Ts&&zs?null:t;default:return null}}function Ph(t,l){if(Fa)return t==="compositionend"||!lc&&_s(t,l)?(t=ys(),Du=Wi=la=null,Fa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:e,offset:l-t};t=a}t:{for(;e;){if(e.nextSibling){e=e.nextSibling;break t}e=e.parentNode}e=void 0}e=Cs(e)}}function Rs(t,l){return t&&l?t===l?!0:t&&t.nodeType===3?!1:l&&l.nodeType===3?Rs(t,l.parentNode):"contains"in t?t.contains(l):t.compareDocumentPosition?!!(t.compareDocumentPosition(l)&16):!1:!1}function Hs(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var l=Nu(t.document);l instanceof t.HTMLIFrameElement;){try{var e=typeof l.contentWindow.location.href=="string"}catch{e=!1}if(e)t=l.contentWindow;else break;l=Nu(t.document)}return l}function nc(t){var l=t&&t.nodeName&&t.nodeName.toLowerCase();return l&&(l==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||l==="textarea"||t.contentEditable==="true")}var cm=Ue&&"documentMode"in document&&11>=document.documentMode,Ia=null,uc=null,Gn=null,ic=!1;function Bs(t,l,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;ic||Ia==null||Ia!==Nu(a)||(a=Ia,"selectionStart"in a&&nc(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Gn&&Ln(Gn,a)||(Gn=a,a=zi(uc,"onSelect"),0>=c,n-=c,Se=1<<32-pl(l)+n|e<rt?(St=F,F=null):St=F.sibling;var Mt=E(T,F,z[rt],j);if(Mt===null){F===null&&(F=St);break}t&&F&&Mt.alternate===null&&l(T,F),m=u(Mt,m,rt),At===null?tt=Mt:At.sibling=Mt,At=Mt,F=St}if(rt===z.length)return e(T,F),Tt&&He(T,rt),tt;if(F===null){for(;rtrt?(St=F,F=null):St=F.sibling;var _a=E(T,F,Mt.value,j);if(_a===null){F===null&&(F=St);break}t&&F&&_a.alternate===null&&l(T,F),m=u(_a,m,rt),At===null?tt=_a:At.sibling=_a,At=_a,F=St}if(Mt.done)return e(T,F),Tt&&He(T,rt),tt;if(F===null){for(;!Mt.done;rt++,Mt=z.next())Mt=R(T,Mt.value,j),Mt!==null&&(m=u(Mt,m,rt),At===null?tt=Mt:At.sibling=Mt,At=Mt);return Tt&&He(T,rt),tt}for(F=a(F);!Mt.done;rt++,Mt=z.next())Mt=A(F,T,rt,Mt.value,j),Mt!==null&&(t&&Mt.alternate!==null&&F.delete(Mt.key===null?rt:Mt.key),m=u(Mt,m,rt),At===null?tt=Mt:At.sibling=Mt,At=Mt);return t&&F.forEach(function(N0){return l(T,N0)}),Tt&&He(T,rt),tt}function qt(T,m,z,j){if(typeof z=="object"&&z!==null&&z.type===lt&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case k:t:{for(var tt=z.key;m!==null;){if(m.key===tt){if(tt=z.type,tt===lt){if(m.tag===7){e(T,m.sibling),j=n(m,z.props.children),j.return=T,T=j;break t}}else if(m.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===Ut&&Ya(tt)===m.type){e(T,m.sibling),j=n(m,z.props),kn(j,z),j.return=T,T=j;break t}e(T,m);break}else l(T,m);m=m.sibling}z.type===lt?(j=Ca(z.props.children,T.mode,j,z.key),j.return=T,T=j):(j=qu(z.type,z.key,z.props,null,T.mode,j),kn(j,z),j.return=T,T=j)}return c(T);case I:t:{for(tt=z.key;m!==null;){if(m.key===tt)if(m.tag===4&&m.stateNode.containerInfo===z.containerInfo&&m.stateNode.implementation===z.implementation){e(T,m.sibling),j=n(m,z.children||[]),j.return=T,T=j;break t}else{e(T,m);break}else l(T,m);m=m.sibling}j=hc(z,T.mode,j),j.return=T,T=j}return c(T);case Ut:return z=Ya(z),qt(T,m,z,j)}if(ol(z))return J(T,m,z,j);if(Kt(z)){if(tt=Kt(z),typeof tt!="function")throw Error(f(150));return z=tt.call(z),et(T,m,z,j)}if(typeof z.then=="function")return qt(T,m,Ku(z),j);if(z.$$typeof===Qt)return qt(T,m,Gu(T,z),j);Ju(T,z)}return typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint"?(z=""+z,m!==null&&m.tag===6?(e(T,m.sibling),j=n(m,z),j.return=T,T=j):(e(T,m),j=dc(z,T.mode,j),j.return=T,T=j),c(T)):e(T,m)}return function(T,m,z,j){try{Jn=0;var tt=qt(T,m,z,j);return on=null,tt}catch(F){if(F===sn||F===Vu)throw F;var At=Jl(29,F,null,T.mode);return At.lanes=j,At.return=T,At}finally{}}}var qa=uo(!0),io=uo(!1),ia=!1;function Ac(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Mc(t,l){t=t.updateQueue,l.updateQueue===t&&(l.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function ca(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function fa(t,l,e){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(xt&2)!==0){var n=a.pending;return n===null?l.next=l:(l.next=n.next,n.next=l),a.pending=l,l=wu(t),Qs(t,null,e),l}return Yu(t,a,l,e),wu(t)}function $n(t,l,e){if(l=l.updateQueue,l!==null&&(l=l.shared,(e&4194048)!==0)){var a=l.lanes;a&=t.pendingLanes,e|=a,l.lanes=e,Vt(t,e)}}function Nc(t,l){var e=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var n=null,u=null;if(e=e.firstBaseUpdate,e!==null){do{var c={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};u===null?n=u=c:u=u.next=c,e=e.next}while(e!==null);u===null?n=u=l:u=u.next=l}else n=u=l;e={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},t.updateQueue=e;return}t=e.lastBaseUpdate,t===null?e.firstBaseUpdate=l:t.next=l,e.lastBaseUpdate=l}var Oc=!1;function Wn(){if(Oc){var t=fn;if(t!==null)throw t}}function Fn(t,l,e,a){Oc=!1;var n=t.updateQueue;ia=!1;var u=n.firstBaseUpdate,c=n.lastBaseUpdate,s=n.shared.pending;if(s!==null){n.shared.pending=null;var d=s,_=d.next;d.next=null,c===null?u=_:c.next=_,c=d;var D=t.alternate;D!==null&&(D=D.updateQueue,s=D.lastBaseUpdate,s!==c&&(s===null?D.firstBaseUpdate=_:s.next=_,D.lastBaseUpdate=d))}if(u!==null){var R=n.baseState;c=0,D=_=d=null,s=u;do{var E=s.lane&-536870913,A=E!==s.lane;if(A?(pt&E)===E:(a&E)===E){E!==0&&E===cn&&(Oc=!0),D!==null&&(D=D.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});t:{var J=t,et=s;E=l;var qt=e;switch(et.tag){case 1:if(J=et.payload,typeof J=="function"){R=J.call(qt,R,E);break t}R=J;break t;case 3:J.flags=J.flags&-65537|128;case 0:if(J=et.payload,E=typeof J=="function"?J.call(qt,R,E):J,E==null)break t;R=O({},R,E);break t;case 2:ia=!0}}E=s.callback,E!==null&&(t.flags|=64,A&&(t.flags|=8192),A=n.callbacks,A===null?n.callbacks=[E]:A.push(E))}else A={lane:E,tag:s.tag,payload:s.payload,callback:s.callback,next:null},D===null?(_=D=A,d=R):D=D.next=A,c|=E;if(s=s.next,s===null){if(s=n.shared.pending,s===null)break;A=s,s=A.next,A.next=null,n.lastBaseUpdate=A,n.shared.pending=null}}while(!0);D===null&&(d=R),n.baseState=d,n.firstBaseUpdate=_,n.lastBaseUpdate=D,u===null&&(n.shared.lanes=0),ha|=c,t.lanes=c,t.memoizedState=R}}function co(t,l){if(typeof t!="function")throw Error(f(191,t));t.call(l)}function fo(t,l){var e=t.callbacks;if(e!==null)for(t.callbacks=null,t=0;tu?u:8;var c=x.T,s={};x.T=s,Jc(t,!1,l,e);try{var d=n(),_=x.S;if(_!==null&&_(s,d),d!==null&&typeof d=="object"&&typeof d.then=="function"){var D=vm(d,a);tu(t,l,D,Il(t))}else tu(t,l,a,Il(t))}catch(R){tu(t,l,{then:function(){},status:"rejected",reason:R},Il())}finally{G.p=u,c!==null&&s.types!==null&&(c.types=s.types),x.T=c}}function zm(){}function Zc(t,l,e,a){if(t.tag!==5)throw Error(f(476));var n=Lo(t).queue;Xo(t,n,l,at,e===null?zm:function(){return Go(t),e(a)})}function Lo(t){var l=t.memoizedState;if(l!==null)return l;l={memoizedState:at,baseState:at,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qe,lastRenderedState:at},next:null};var e={};return l.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qe,lastRenderedState:e},next:null},t.memoizedState=l,t=t.alternate,t!==null&&(t.memoizedState=l),l}function Go(t){var l=Lo(t);l.next===null&&(l=t.alternate.memoizedState),tu(t,l.next.queue,{},Il())}function Kc(){return Al(gu)}function Qo(){return sl().memoizedState}function Vo(){return sl().memoizedState}function _m(t){for(var l=t.return;l!==null;){switch(l.tag){case 24:case 3:var e=Il();t=ca(e);var a=fa(l,t,e);a!==null&&(Ql(a,l,e),$n(a,l,e)),l={cache:Tc()},t.payload=l;return}l=l.return}}function Em(t,l,e){var a=Il();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},ai(t)?Ko(l,e):(e=oc(t,l,e,a),e!==null&&(Ql(e,t,a),Jo(e,l,a)))}function Zo(t,l,e){var a=Il();tu(t,l,e,a)}function tu(t,l,e,a){var n={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(ai(t))Ko(l,n);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=l.lastRenderedReducer,u!==null))try{var c=l.lastRenderedState,s=u(c,e);if(n.hasEagerState=!0,n.eagerState=s,Kl(s,c))return Yu(t,l,n,0),Gt===null&&Bu(),!1}catch{}finally{}if(e=oc(t,l,n,a),e!==null)return Ql(e,t,a),Jo(e,l,a),!0}return!1}function Jc(t,l,e,a){if(a={lane:2,revertLane:Mf(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ai(t)){if(l)throw Error(f(479))}else l=oc(t,e,a,2),l!==null&&Ql(l,t,2)}function ai(t){var l=t.alternate;return t===st||l!==null&&l===st}function Ko(t,l){dn=Wu=!0;var e=t.pending;e===null?l.next=l:(l.next=e.next,e.next=l),t.pending=l}function Jo(t,l,e){if((e&4194048)!==0){var a=l.lanes;a&=t.pendingLanes,e|=a,l.lanes=e,Vt(t,e)}}var lu={readContext:Al,use:Pu,useCallback:ul,useContext:ul,useEffect:ul,useImperativeHandle:ul,useLayoutEffect:ul,useInsertionEffect:ul,useMemo:ul,useReducer:ul,useRef:ul,useState:ul,useDebugValue:ul,useDeferredValue:ul,useTransition:ul,useSyncExternalStore:ul,useId:ul,useHostTransitionStatus:ul,useFormState:ul,useActionState:ul,useOptimistic:ul,useMemoCache:ul,useCacheRefresh:ul};lu.useEffectEvent=ul;var ko={readContext:Al,use:Pu,useCallback:function(t,l){return Hl().memoizedState=[t,l===void 0?null:l],t},useContext:Al,useEffect:jo,useImperativeHandle:function(t,l,e){e=e!=null?e.concat([t]):null,li(4194308,4,Ho.bind(null,l,t),e)},useLayoutEffect:function(t,l){return li(4194308,4,t,l)},useInsertionEffect:function(t,l){li(4,2,t,l)},useMemo:function(t,l){var e=Hl();l=l===void 0?null:l;var a=t();if(Xa){Zl(!0);try{t()}finally{Zl(!1)}}return e.memoizedState=[a,l],a},useReducer:function(t,l,e){var a=Hl();if(e!==void 0){var n=e(l);if(Xa){Zl(!0);try{e(l)}finally{Zl(!1)}}}else n=l;return a.memoizedState=a.baseState=n,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=Em.bind(null,st,t),[a.memoizedState,t]},useRef:function(t){var l=Hl();return t={current:t},l.memoizedState=t},useState:function(t){t=Xc(t);var l=t.queue,e=Zo.bind(null,st,l);return l.dispatch=e,[t.memoizedState,e]},useDebugValue:Qc,useDeferredValue:function(t,l){var e=Hl();return Vc(e,t,l)},useTransition:function(){var t=Xc(!1);return t=Xo.bind(null,st,t.queue,!0,!1),Hl().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,l,e){var a=st,n=Hl();if(Tt){if(e===void 0)throw Error(f(407));e=e()}else{if(e=l(),Gt===null)throw Error(f(349));(pt&127)!==0||yo(a,l,e)}n.memoizedState=e;var u={value:e,getSnapshot:l};return n.queue=u,jo(go.bind(null,a,u,t),[t]),a.flags|=2048,mn(9,{destroy:void 0},vo.bind(null,a,u,e,l),null),e},useId:function(){var t=Hl(),l=Gt.identifierPrefix;if(Tt){var e=Te,a=Se;e=(a&~(1<<32-pl(a)-1)).toString(32)+e,l="_"+l+"R_"+e,e=Fu++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?c.createElement("select",{is:a.is}):c.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?c.createElement(n,{is:a.is}):c.createElement(n)}}u[Et]=l,u[zt]=a;t:for(c=l.child;c!==null;){if(c.tag===5||c.tag===6)u.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break t;for(;c.sibling===null;){if(c.return===null||c.return===l)break t;c=c.return}c.sibling.return=c.return,c=c.sibling}l.stateNode=u;t:switch(Nl(u,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break t;case"img":a=!0;break t;default:a=!1}a&&Le(l)}}return kt(l),ff(l,l.type,t===null?null:t.memoizedProps,l.pendingProps,e),null;case 6:if(t&&l.stateNode!=null)t.memoizedProps!==a&&Le(l);else{if(typeof a!="string"&&l.stateNode===null)throw Error(f(166));if(t=ft.current,nn(l)){if(t=l.stateNode,e=l.memoizedProps,a=null,n=El,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}t[Et]=l,t=!!(t.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||hd(t.nodeValue,e)),t||na(l,!0)}else t=_i(t).createTextNode(a),t[Et]=l,l.stateNode=t}return kt(l),null;case 31:if(e=l.memoizedState,t===null||t.memoizedState!==null){if(a=nn(l),e!==null){if(t===null){if(!a)throw Error(f(318));if(t=l.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(f(557));t[Et]=l}else Ua(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;kt(l),t=!1}else e=gc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=e),t=!0;if(!t)return l.flags&256?($l(l),l):($l(l),null);if((l.flags&128)!==0)throw Error(f(558))}return kt(l),null;case 13:if(a=l.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(n=nn(l),a!==null&&a.dehydrated!==null){if(t===null){if(!n)throw Error(f(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(f(317));n[Et]=l}else Ua(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;kt(l),n=!1}else n=gc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),n=!0;if(!n)return l.flags&256?($l(l),l):($l(l),null)}return $l(l),(l.flags&128)!==0?(l.lanes=e,l):(e=a!==null,t=t!==null&&t.memoizedState!==null,e&&(a=l.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==n&&(a.flags|=2048)),e!==t&&e&&(l.child.flags|=8192),fi(l,l.updateQueue),kt(l),null);case 4:return Wt(),t===null&&xf(l.stateNode.containerInfo),kt(l),null;case 10:return Ye(l.type),kt(l),null;case 19:if(U(fl),a=l.memoizedState,a===null)return kt(l),null;if(n=(l.flags&128)!==0,u=a.rendering,u===null)if(n)au(a,!1);else{if(il!==0||t!==null&&(t.flags&128)!==0)for(t=l.child;t!==null;){if(u=$u(t),u!==null){for(l.flags|=128,au(a,!1),t=u.updateQueue,l.updateQueue=t,fi(l,t),l.subtreeFlags=0,t=e,e=l.child;e!==null;)Vs(e,t),e=e.sibling;return X(fl,fl.current&1|2),Tt&&He(l,a.treeForkCount),l.child}t=t.sibling}a.tail!==null&&nl()>hi&&(l.flags|=128,n=!0,au(a,!1),l.lanes=4194304)}else{if(!n)if(t=$u(u),t!==null){if(l.flags|=128,n=!0,t=t.updateQueue,l.updateQueue=t,fi(l,t),au(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!Tt)return kt(l),null}else 2*nl()-a.renderingStartTime>hi&&e!==536870912&&(l.flags|=128,n=!0,au(a,!1),l.lanes=4194304);a.isBackwards?(u.sibling=l.child,l.child=u):(t=a.last,t!==null?t.sibling=u:l.child=u,a.last=u)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=nl(),t.sibling=null,e=fl.current,X(fl,n?e&1|2:e&1),Tt&&He(l,a.treeForkCount),t):(kt(l),null);case 22:case 23:return $l(l),xc(),a=l.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(l.flags|=8192):a&&(l.flags|=8192),a?(e&536870912)!==0&&(l.flags&128)===0&&(kt(l),l.subtreeFlags&6&&(l.flags|=8192)):kt(l),e=l.updateQueue,e!==null&&fi(l,e.retryQueue),e=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),a=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(a=l.memoizedState.cachePool.pool),a!==e&&(l.flags|=2048),t!==null&&U(Ba),null;case 24:return e=null,t!==null&&(e=t.memoizedState.cache),l.memoizedState.cache!==e&&(l.flags|=2048),Ye(hl),kt(l),null;case 25:return null;case 30:return null}throw Error(f(156,l.tag))}function Dm(t,l){switch(yc(l),l.tag){case 1:return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 3:return Ye(hl),Wt(),t=l.flags,(t&65536)!==0&&(t&128)===0?(l.flags=t&-65537|128,l):null;case 26:case 27:case 5:return $e(l),null;case 31:if(l.memoizedState!==null){if($l(l),l.alternate===null)throw Error(f(340));Ua()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 13:if($l(l),t=l.memoizedState,t!==null&&t.dehydrated!==null){if(l.alternate===null)throw Error(f(340));Ua()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 19:return U(fl),null;case 4:return Wt(),null;case 10:return Ye(l.type),null;case 22:case 23:return $l(l),xc(),t!==null&&U(Ba),t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 24:return Ye(hl),null;case 25:return null;default:return null}}function br(t,l){switch(yc(l),l.tag){case 3:Ye(hl),Wt();break;case 26:case 27:case 5:$e(l);break;case 4:Wt();break;case 31:l.memoizedState!==null&&$l(l);break;case 13:$l(l);break;case 19:U(fl);break;case 10:Ye(l.type);break;case 22:case 23:$l(l),xc(),t!==null&&U(Ba);break;case 24:Ye(hl)}}function nu(t,l){try{var e=l.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var n=a.next;e=n;do{if((e.tag&t)===t){a=void 0;var u=e.create,c=e.inst;a=u(),c.destroy=a}e=e.next}while(e!==n)}}catch(s){Bt(l,l.return,s)}}function ra(t,l,e){try{var a=l.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var u=n.next;a=u;do{if((a.tag&t)===t){var c=a.inst,s=c.destroy;if(s!==void 0){c.destroy=void 0,n=l;var d=e,_=s;try{_()}catch(D){Bt(n,d,D)}}}a=a.next}while(a!==u)}}catch(D){Bt(l,l.return,D)}}function pr(t){var l=t.updateQueue;if(l!==null){var e=t.stateNode;try{fo(l,e)}catch(a){Bt(t,t.return,a)}}}function Sr(t,l,e){e.props=La(t.type,t.memoizedProps),e.state=t.memoizedState;try{e.componentWillUnmount()}catch(a){Bt(t,l,a)}}function uu(t,l){try{var e=t.ref;if(e!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof e=="function"?t.refCleanup=e(a):e.current=a}}catch(n){Bt(t,l,n)}}function ze(t,l){var e=t.ref,a=t.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(n){Bt(t,l,n)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(n){Bt(t,l,n)}else e.current=null}function Tr(t){var l=t.type,e=t.memoizedProps,a=t.stateNode;try{t:switch(l){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break t;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(n){Bt(t,t.return,n)}}function sf(t,l,e){try{var a=t.stateNode;Fm(a,t.type,e,l),a[zt]=l}catch(n){Bt(t,t.return,n)}}function zr(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ba(t.type)||t.tag===4}function of(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||zr(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ba(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function rf(t,l,e){var a=t.tag;if(a===5||a===6)t=t.stateNode,l?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(t,l):(l=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.appendChild(t),e=e._reactRootContainer,e!=null||l.onclick!==null||(l.onclick=Ce));else if(a!==4&&(a===27&&ba(t.type)&&(e=t.stateNode,l=null),t=t.child,t!==null))for(rf(t,l,e),t=t.sibling;t!==null;)rf(t,l,e),t=t.sibling}function si(t,l,e){var a=t.tag;if(a===5||a===6)t=t.stateNode,l?e.insertBefore(t,l):e.appendChild(t);else if(a!==4&&(a===27&&ba(t.type)&&(e=t.stateNode),t=t.child,t!==null))for(si(t,l,e),t=t.sibling;t!==null;)si(t,l,e),t=t.sibling}function _r(t){var l=t.stateNode,e=t.memoizedProps;try{for(var a=t.type,n=l.attributes;n.length;)l.removeAttributeNode(n[0]);Nl(l,a,e),l[Et]=t,l[zt]=e}catch(u){Bt(t,t.return,u)}}var Ge=!1,vl=!1,df=!1,Er=typeof WeakSet=="function"?WeakSet:Set,_l=null;function xm(t,l){if(t=t.containerInfo,Uf=xi,t=Hs(t),nc(t)){if("selectionStart"in t)var e={start:t.selectionStart,end:t.selectionEnd};else t:{e=(e=t.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var n=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{e.nodeType,u.nodeType}catch{e=null;break t}var c=0,s=-1,d=-1,_=0,D=0,R=t,E=null;l:for(;;){for(var A;R!==e||n!==0&&R.nodeType!==3||(s=c+n),R!==u||a!==0&&R.nodeType!==3||(d=c+a),R.nodeType===3&&(c+=R.nodeValue.length),(A=R.firstChild)!==null;)E=R,R=A;for(;;){if(R===t)break l;if(E===e&&++_===n&&(s=c),E===u&&++D===a&&(d=c),(A=R.nextSibling)!==null)break;R=E,E=R.parentNode}R=A}e=s===-1||d===-1?null:{start:s,end:d}}else e=null}e=e||{start:0,end:0}}else e=null;for(Rf={focusedElem:t,selectionRange:e},xi=!1,_l=l;_l!==null;)if(l=_l,t=l.child,(l.subtreeFlags&1028)!==0&&t!==null)t.return=l,_l=t;else for(;_l!==null;){switch(l=_l,u=l.alternate,t=l.flags,l.tag){case 0:if((t&4)!==0&&(t=l.updateQueue,t=t!==null?t.events:null,t!==null))for(e=0;e title"))),Nl(u,a,e),u[Et]=t,dl(u),a=u;break t;case"link":var c=xd("link","href",n).get(a+(e.href||""));if(c){for(var s=0;sqt&&(c=qt,qt=et,et=c);var T=Us(s,et),m=Us(s,qt);if(T&&m&&(A.rangeCount!==1||A.anchorNode!==T.node||A.anchorOffset!==T.offset||A.focusNode!==m.node||A.focusOffset!==m.offset)){var z=R.createRange();z.setStart(T.node,T.offset),A.removeAllRanges(),et>qt?(A.addRange(z),A.extend(m.node,m.offset)):(z.setEnd(m.node,m.offset),A.addRange(z))}}}}for(R=[],A=s;A=A.parentNode;)A.nodeType===1&&R.push({element:A,left:A.scrollLeft,top:A.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;se?32:e,x.T=null,e=pf,pf=null;var u=ya,c=Je;if(bl=0,pn=ya=null,Je=0,(xt&6)!==0)throw Error(f(331));var s=xt;if(xt|=4,Hr(u.current),Cr(u,u.current,c,e),xt=s,ru(0,!1),xl&&typeof xl.onPostCommitFiberRoot=="function")try{xl.onPostCommitFiberRoot(Ne,u)}catch{}return!0}finally{G.p=n,x.T=a,Pr(t,l)}}function ld(t,l,e){l=ae(e,l),l=Fc(t.stateNode,l,2),t=fa(t,l,2),t!==null&&(ll(t,2),_e(t))}function Bt(t,l,e){if(t.tag===3)ld(t,t,e);else for(;l!==null;){if(l.tag===3){ld(l,t,e);break}else if(l.tag===1){var a=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(ma===null||!ma.has(a))){t=ae(e,t),e=er(2),a=fa(l,e,2),a!==null&&(ar(e,a,l,t),ll(a,2),_e(a));break}}l=l.return}}function _f(t,l,e){var a=t.pingCache;if(a===null){a=t.pingCache=new Um;var n=new Set;a.set(l,n)}else n=a.get(l),n===void 0&&(n=new Set,a.set(l,n));n.has(e)||(yf=!0,n.add(e),t=wm.bind(null,t,l,e),l.then(t,t))}function wm(t,l,e){var a=t.pingCache;a!==null&&a.delete(l),t.pingedLanes|=t.suspendedLanes&e,t.warmLanes&=~e,Gt===t&&(pt&e)===e&&(il===4||il===3&&(pt&62914560)===pt&&300>nl()-di?(xt&2)===0&&Sn(t,0):vf|=e,bn===pt&&(bn=0)),_e(t)}function ed(t,l){l===0&&(l=Xt()),t=ja(t,l),t!==null&&(ll(t,l),_e(t))}function qm(t){var l=t.memoizedState,e=0;l!==null&&(e=l.retryLane),ed(t,e)}function Xm(t,l){var e=0;switch(t.tag){case 31:case 13:var a=t.stateNode,n=t.memoizedState;n!==null&&(e=n.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(f(314))}a!==null&&a.delete(l),ed(t,e)}function Lm(t,l){return gt(t,l)}var pi=null,zn=null,Ef=!1,Si=!1,Af=!1,ga=0;function _e(t){t!==zn&&t.next===null&&(zn===null?pi=zn=t:zn=zn.next=t),Si=!0,Ef||(Ef=!0,Qm())}function ru(t,l){if(!Af&&Si){Af=!0;do for(var e=!1,a=pi;a!==null;){if(t!==0){var n=a.pendingLanes;if(n===0)var u=0;else{var c=a.suspendedLanes,s=a.pingedLanes;u=(1<<31-pl(42|t)+1)-1,u&=n&~(c&~s),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(e=!0,id(a,u))}else u=pt,u=L(a,a===Gt?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||K(a,u)||(e=!0,id(a,u));a=a.next}while(e);Af=!1}}function Gm(){ad()}function ad(){Si=Ef=!1;var t=0;ga!==0&&Pm()&&(t=ga);for(var l=nl(),e=null,a=pi;a!==null;){var n=a.next,u=nd(a,l);u===0?(a.next=null,e===null?pi=n:e.next=n,n===null&&(zn=e)):(e=a,(t!==0||(u&3)!==0)&&(Si=!0)),a=n}bl!==0&&bl!==5||ru(t),ga!==0&&(ga=0)}function nd(t,l){for(var e=t.suspendedLanes,a=t.pingedLanes,n=t.expirationTimes,u=t.pendingLanes&-62914561;0s)break;var D=d.transferSize,R=d.initiatorType;D&&md(R)&&(d=d.responseEnd,c+=D*(d"u"?null:document;function Md(t,l,e){var a=_n;if(a&&typeof l=="string"&&l){var n=le(l);n='link[rel="'+t+'"][href="'+n+'"]',typeof e=="string"&&(n+='[crossorigin="'+e+'"]'),Ad.has(n)||(Ad.add(n),t={rel:t,crossOrigin:e,href:l},a.querySelector(n)===null&&(l=a.createElement("link"),Nl(l,"link",t),dl(l),a.head.appendChild(l)))}}function f0(t){ke.D(t),Md("dns-prefetch",t,null)}function s0(t,l){ke.C(t,l),Md("preconnect",t,l)}function o0(t,l,e){ke.L(t,l,e);var a=_n;if(a&&t&&l){var n='link[rel="preload"][as="'+le(l)+'"]';l==="image"&&e&&e.imageSrcSet?(n+='[imagesrcset="'+le(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(n+='[imagesizes="'+le(e.imageSizes)+'"]')):n+='[href="'+le(t)+'"]';var u=n;switch(l){case"style":u=En(t);break;case"script":u=An(t)}se.has(u)||(t=O({rel:"preload",href:l==="image"&&e&&e.imageSrcSet?void 0:t,as:l},e),se.set(u,t),a.querySelector(n)!==null||l==="style"&&a.querySelector(yu(u))||l==="script"&&a.querySelector(vu(u))||(l=a.createElement("link"),Nl(l,"link",t),dl(l),a.head.appendChild(l)))}}function r0(t,l){ke.m(t,l);var e=_n;if(e&&t){var a=l&&typeof l.as=="string"?l.as:"script",n='link[rel="modulepreload"][as="'+le(a)+'"][href="'+le(t)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=An(t)}if(!se.has(u)&&(t=O({rel:"modulepreload",href:t},l),se.set(u,t),e.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(vu(u)))return}a=e.createElement("link"),Nl(a,"link",t),dl(a),e.head.appendChild(a)}}}function d0(t,l,e){ke.S(t,l,e);var a=_n;if(a&&t){var n=ta(a).hoistableStyles,u=En(t);l=l||"default";var c=n.get(u);if(!c){var s={loading:0,preload:null};if(c=a.querySelector(yu(u)))s.loading=5;else{t=O({rel:"stylesheet",href:t,"data-precedence":l},e),(e=se.get(u))&&Lf(t,e);var d=c=a.createElement("link");dl(d),Nl(d,"link",t),d._p=new Promise(function(_,D){d.onload=_,d.onerror=D}),d.addEventListener("load",function(){s.loading|=1}),d.addEventListener("error",function(){s.loading|=2}),s.loading|=4,Ai(c,l,a)}c={type:"stylesheet",instance:c,count:1,state:s},n.set(u,c)}}}function h0(t,l){ke.X(t,l);var e=_n;if(e&&t){var a=ta(e).hoistableScripts,n=An(t),u=a.get(n);u||(u=e.querySelector(vu(n)),u||(t=O({src:t,async:!0},l),(l=se.get(n))&&Gf(t,l),u=e.createElement("script"),dl(u),Nl(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function m0(t,l){ke.M(t,l);var e=_n;if(e&&t){var a=ta(e).hoistableScripts,n=An(t),u=a.get(n);u||(u=e.querySelector(vu(n)),u||(t=O({src:t,async:!0,type:"module"},l),(l=se.get(n))&&Gf(t,l),u=e.createElement("script"),dl(u),Nl(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function Nd(t,l,e,a){var n=(n=ft.current)?Ei(n):null;if(!n)throw Error(f(446));switch(t){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(l=En(e.href),e=ta(n).hoistableStyles,a=e.get(l),a||(a={type:"style",instance:null,count:0,state:null},e.set(l,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){t=En(e.href);var u=ta(n).hoistableStyles,c=u.get(t);if(c||(n=n.ownerDocument||n,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,c),(u=n.querySelector(yu(t)))&&!u._p&&(c.instance=u,c.state.loading=5),se.has(t)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},se.set(t,e),u||y0(n,t,e,c.state))),l&&a===null)throw Error(f(528,""));return c}if(l&&a!==null)throw Error(f(529,""));return null;case"script":return l=e.async,e=e.src,typeof e=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=An(e),e=ta(n).hoistableScripts,a=e.get(l),a||(a={type:"script",instance:null,count:0,state:null},e.set(l,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(f(444,t))}}function En(t){return'href="'+le(t)+'"'}function yu(t){return'link[rel="stylesheet"]['+t+"]"}function Od(t){return O({},t,{"data-precedence":t.precedence,precedence:null})}function y0(t,l,e,a){t.querySelector('link[rel="preload"][as="style"]['+l+"]")?a.loading=1:(l=t.createElement("link"),a.preload=l,l.addEventListener("load",function(){return a.loading|=1}),l.addEventListener("error",function(){return a.loading|=2}),Nl(l,"link",e),dl(l),t.head.appendChild(l))}function An(t){return'[src="'+le(t)+'"]'}function vu(t){return"script[async]"+t}function Dd(t,l,e){if(l.count++,l.instance===null)switch(l.type){case"style":var a=t.querySelector('style[data-href~="'+le(e.href)+'"]');if(a)return l.instance=a,dl(a),a;var n=O({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),dl(a),Nl(a,"style",n),Ai(a,e.precedence,t),l.instance=a;case"stylesheet":n=En(e.href);var u=t.querySelector(yu(n));if(u)return l.state.loading|=4,l.instance=u,dl(u),u;a=Od(e),(n=se.get(n))&&Lf(a,n),u=(t.ownerDocument||t).createElement("link"),dl(u);var c=u;return c._p=new Promise(function(s,d){c.onload=s,c.onerror=d}),Nl(u,"link",a),l.state.loading|=4,Ai(u,e.precedence,t),l.instance=u;case"script":return u=An(e.src),(n=t.querySelector(vu(u)))?(l.instance=n,dl(n),n):(a=e,(n=se.get(u))&&(a=O({},e),Gf(a,n)),t=t.ownerDocument||t,n=t.createElement("script"),dl(n),Nl(n,"link",a),t.head.appendChild(n),l.instance=n);case"void":return null;default:throw Error(f(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(a=l.instance,l.state.loading|=4,Ai(a,e.precedence,t));return l.instance}function Ai(t,l,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,u=n,c=0;c title"):null)}function v0(t,l,e){if(e===1||l.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return t=l.disabled,typeof l.precedence=="string"&&t==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function Cd(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function g0(t,l,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var n=En(a.href),u=l.querySelector(yu(n));if(u){l=u._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(t.count++,t=Ni.bind(t),l.then(t,t)),e.state.loading|=4,e.instance=u,dl(u);return}u=l.ownerDocument||l,a=Od(a),(n=se.get(n))&&Lf(a,n),u=u.createElement("link"),dl(u);var c=u;c._p=new Promise(function(s,d){c.onload=s,c.onerror=d}),Nl(u,"link",a),e.instance=u}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(e,l),(l=e.state.preload)&&(e.state.loading&3)===0&&(t.count++,e=Ni.bind(t),l.addEventListener("load",e),l.addEventListener("error",e))}}var Qf=0;function b0(t,l){return t.stylesheets&&t.count===0&&Di(t,t.stylesheets),0Qf?50:800)+l);return t.unsuspend=e,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function Ni(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Di(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Oi=null;function Di(t,l){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Oi=new Map,l.forEach(p0,t),Oi=null,Ni.call(t))}function p0(t,l){if(!(l.state.loading&4)){var e=Oi.get(t);if(e)var a=e.get(null);else{e=new Map,Oi.set(t,e);for(var n=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(o){console.error(o)}}return i(),Ff.exports=B0(),Ff.exports}var w0=Y0(),$=as();const Yi=O0($);function q0(i){try{return new URL(i).hostname.replace(/^www\./,"")}catch{return i.slice(0,32)}}function eh(i){if(i==null||!Number.isFinite(i))return null;try{return new Date(i).toLocaleDateString()}catch{return null}}function ah(i){if(!i.trim())return null;const o=Date.parse(i);return Number.isFinite(o)?o:null}function X0(i){return i.split(` `).map(o=>o.trim()).filter(Boolean).map(o=>{const r=o.indexOf("|");return r>=0?{title:o.slice(0,r).trim(),url:o.slice(r+1).trim()}:{url:o}}).filter(o=>o.url)}function L0(i){return(i??[]).map(o=>o.title?`${o.title}|${o.url}`:o.url).join(` `)}const ns=[{id:"text",label:"标题",kind:"title",always:!0,rowHeight:22,isEmpty:i=>{var o;return!((o=i.text)!=null&&o.trim())},preview:i=>{var o;return((o=i.text)==null?void 0:o.trim())||"未命名"},commit:(i,o)=>[{type:"update_text",nodeId:i,text:o.trim()||"未命名"}]},{id:"note",label:"摘要",kind:"textarea",rowHeight:18,isEmpty:i=>{var o;return!((o=i.note)!=null&&o.trim())},preview:i=>{var r;const o=(r=i.note)==null?void 0:r.trim();return o?o.length>48?`${o.slice(0,48)}…`:o:null},commit:(i,o)=>[{type:"update_node_meta",nodeId:i,patch:{note:o.trim()||null}}]},{id:"description",label:"结构化描述 (JSON)",kind:"textarea",rowHeight:36,isEmpty:i=>!i.description||Object.keys(i.description).length===0,preview:i=>{if(!i.description||!Object.keys(i.description).length)return null;const o=JSON.stringify(i.description);return o.length>48?`${o.slice(0,48)}…`:o},commit:(i,o)=>{const r=o.trim();if(!r)return[{type:"update_node_meta",nodeId:i,patch:{description:null}}];try{const f=JSON.parse(r);if(!f||typeof f!="object"||Array.isArray(f))throw new Error("description must be a JSON object");return[{type:"update_node_meta",nodeId:i,patch:{description:f}}]}catch{return[]}}},{id:"imageUrl",label:"配图",kind:"image",imageRow:!0,rowHeight:64,isEmpty:i=>{var o;return!((o=i.imageUrl)!=null&&o.trim())},preview:i=>{var o;return((o=i.imageUrl)==null?void 0:o.trim())||null},commit:(i,o)=>[{type:"update_node_meta",nodeId:i,patch:{imageUrl:o.trim()||null}}]},{id:"tags",label:"标签",kind:"tags",rowHeight:18,isEmpty:i=>{var o;return!(((o=i.tags)==null?void 0:o.length)>0)},preview:i=>{var o;return(o=i.tags)!=null&&o.length?i.tags.slice(0,4).map(r=>`#${r}`).join(" "):null},commit:(i,o)=>{const r=o.split(/[,,]/).map(f=>f.trim()).filter(Boolean);return[{type:"update_node_meta",nodeId:i,patch:{tags:r}}]}},{id:"links",label:"来源",kind:"links",rowHeight:18,isEmpty:i=>{var o;return!(((o=i.links)==null?void 0:o.length)>0)},preview:i=>{var p,g,M;const o=(p=i.links)==null?void 0:p[0];if(!o)return null;const r=((g=o.title)==null?void 0:g.trim())||q0(o.url),f=(((M=i.links)==null?void 0:M.length)??0)>1?` +${i.links.length-1}`:"";return`${r}${f}`},commit:(i,o)=>[{type:"update_node_meta",nodeId:i,patch:{links:X0(o)}}]},{id:"startAt",label:"开始",kind:"datetime",rowHeight:18,isEmpty:i=>i.startAt==null,preview:i=>eh(i.startAt),commit:(i,o)=>[{type:"update_node_meta",nodeId:i,patch:{startAt:ah(o)}}]},{id:"dueAt",label:"截止",kind:"datetime",rowHeight:18,isEmpty:i=>i.dueAt==null,preview:i=>eh(i.dueAt),commit:(i,o)=>[{type:"update_node_meta",nodeId:i,patch:{dueAt:ah(o)}}]},{id:"pinned",label:"固定",kind:"flag",rowHeight:18,isEmpty:i=>!i.pinned,preview:i=>i.pinned?"已钉住":null,commit:(i,o)=>[{type:"set_pinned",nodeId:i,pinned:o==="1"||o==="true"}]}],G0=Object.fromEntries(ns.map(i=>[i.id,i]));function us(i,o=new Set){const r=[];for(const f of ns)(f.always||!f.isEmpty(i)||o.has(f.id))&&r.push({def:f,preview:f.preview(i)});return r}function Q0(i,o=new Set){return ns.filter(r=>!r.always&&r.isEmpty(i)&&!o.has(r.id))}function V0(i,o){switch(o){case"text":return i.text??"";case"note":return i.note??"";case"description":return i.description?JSON.stringify(i.description,null,2):"";case"imageUrl":return i.imageUrl??"";case"tags":return(i.tags??[]).join(", ");case"links":return L0(i.links);case"startAt":return nh(i.startAt);case"dueAt":return nh(i.dueAt);case"pinned":return i.pinned?"1":"0";default:return""}}function nh(i){if(i==null||!Number.isFinite(i))return"";const o=new Date(i),r=f=>String(f).padStart(2,"0");return`${o.getFullYear()}-${r(o.getMonth()+1)}-${r(o.getDate())}T${r(o.getHours())}:${r(o.getMinutes())}`}function Z0(i,o,r){return G0[o].commit(i.id,r,i)}const uh={comfortable:288,compact:248},Ea=36,hh=12,Pl=12,wi=10;function mh(i,o,r=new Set){const f=o?uh.compact:uh.comfortable,p=us(i,r);let g=0;for(const{def:N}of p){if(N.id==="text")continue;const C=N.imageRow?(o?52:64)+4:Math.max(N.rowHeight+12,o?28:32);g+=C+wi}g>0&&(g-=wi);const M=Ea+hh*2+Math.max(g,12);return{w:f,h:Math.max(M,o?84:100)}}const K0='"Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif';function Aa(i,o=400){return`${o===400?"":`${o} `}${i}px ${K0}`}function J0(i,o,r){i.shadowColor=r!=null&&r.selected?"rgba(0, 0, 0, 0.45)":"rgba(0, 0, 0, 0.28)",i.shadowBlur=(r!=null&&r.selected?18:12)/Math.max(.5,o),i.shadowOffsetX=0,i.shadowOffsetY=3/Math.max(.5,o)}function k0(i){i.shadowColor="transparent",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0}function $0(i,o,r=.14){i.save(),i.globalAlpha=r,i.fillStyle=o,i.fill(),i.restore()}function W0(i,o,r,f,p,g=10){i.save(),i.beginPath();const N=Math.min(g,f/2);i.moveTo(o+N,r),i.lineTo(o+4,r),i.lineTo(o+4,r+f),i.lineTo(o+N,r+f),i.quadraticCurveTo(o,r+f,o,r+f-N),i.lineTo(o,r+N),i.quadraticCurveTo(o,r,o+N,r),i.closePath(),i.fillStyle=p,i.globalAlpha=.95,i.fill(),i.restore()}function F0(i,o,r,f,p,g){const N=16/Math.max(.75,Math.min(1.2,g));i.font=Aa(10/Math.max(.75,Math.min(1.2,g)),500);const S=i.measureText(o).width+12;i.beginPath();const w=N/2;return i.moveTo(r+w,f),i.arcTo(r+S,f,r+S,f+N,w),i.arcTo(r+S,f+N,r,f+N,w),i.arcTo(r,f+N,r,f,w),i.arcTo(r,f,r+S,f,w),i.closePath(),i.fillStyle="rgba(255,255,255,0.06)",i.fill(),i.strokeStyle=p.border,i.lineWidth=1/Math.max(.5,g),i.stroke(),i.fillStyle=p.labelSecondary,i.textBaseline="middle",i.fillText(o,r+6,f+N/2),S+4}const _u=new Map;function yh(i,o){const r=_u.get(i);if(r instanceof HTMLImageElement)return r;if(r==="loading"||r==="error")return null;_u.set(i,"loading");const f=new Image;return f.decoding="async",f.crossOrigin="anonymous",f.onload=()=>{_u.set(i,f),o()},f.onerror=()=>{_u.set(i,"error"),o()},f.src=i,null}function I0(i){return _u.get(i)==="error"}function P0(i,o,r){var N,C;if(r!=null&&r.asCard||i.stylePreset==="card")return mh(i,o);let f=o?168:212,p=o?48:60;const g=!!((N=i.tags)!=null&&N.length)||!!((C=i.links)!=null&&C.length)||i.dueAt!=null||!!i.note;p+=g?o?20:26:o?8:10;const M=i.stylePreset;return M==="title"?(f*=1.18,p*=1.15):M==="decision"?(f*=1.08,p*=1.12):M==="note"&&(p*=1.12),i.imageUrl&&(f=Math.max(f,o?200:248),p+=o?78:96),{w:f,h:p}}function ih(i,o,r,f,p,g,M){if(i.beginPath(),o==="decision"){const N=r+p/2,C=f+g/2;i.moveTo(N,f),i.lineTo(r+p,C),i.lineTo(N,f+g),i.lineTo(r,C),i.closePath()}else if(o==="note"){const N=Math.min(12,p*.12);i.moveTo(r,f),i.lineTo(r+p-N,f),i.lineTo(r+p,f+N),i.lineTo(r+p,f+g),i.lineTo(r,f+g),i.closePath()}else if(o==="title"){const N=g/2;qi(i,r,f,p,g,N)}else qi(i,r,f,p,g,M)}function qi(i,o,r,f,p,g){const M=Math.min(g,f/2,p/2);i.moveTo(o+M,r),i.arcTo(o+f,r,o+f,r+p,M),i.arcTo(o+f,r+p,o,r+p,M),i.arcTo(o,r+p,o,r,M),i.arcTo(o,r,o+f,r,M),i.closePath()}function Eu(i,o,r,f){const p=o.replace(/\s+/g," ").trim();if(!p)return[];const g=[];let M=p;for(;M&&g.lengthS*.4&&(S=w);let O=M.slice(0,S).trimEnd();if(M=M.slice(S).trimStart(),g.length===f-1&&M){for(;O.length>1&&i.measureText(`${O}…`).width>r;)O=O.slice(0,-1);g.push(`${O}…`);break}g.push(O)}return g}function ty(i){var r,f;const o=[];if(i.icon){const p=ly[i.icon];p&&o.push(p)}return i.collapsed&&o.push("▸"),(r=i.links)!=null&&r.length&&o.push("🔗"),i.imageUrl&&o.push("🖼"),i.dueAt!=null&&o.push("⏰"),(f=i.tags)!=null&&f.length&&o.push(`#${i.tags.length}`),i.pinned&&o.push("📌"),o}const ly={server:"[服]",database:"[库]",cloud:"[云]",person:"[人]",folder:"[夹]",doc:"[档]",link:"[链]",warning:"[警]",check:"[✓]",star:"[★]",gear:"[设]",globe:"[球]"};function ey(i,o,r,f,p,g,M,N,C){const{w:S,h:w}=mh(o,M),O=us(o),Q=M?12:14;if(i.save(),i.beginPath(),qi(i,r,f,S,w,Q),i.clip(),i.fillStyle=N,i.globalAlpha=.9,i.fillRect(r,f,S,3),i.globalAlpha=1,g<.35){i.fillStyle=p.labelPrimary,i.font=Aa(M?12:13,600),i.textBaseline="middle";const yt=Eu(i,o.text||"未命名",S-Pl*2,2),el=M?14:16,Qt=f+w/2-(yt.length-1)*el/2;yt.forEach((nt,H)=>{i.fillText(nt,r+Pl,Qt+H*el)}),i.restore();return}i.fillStyle="rgba(0,0,0,0.2)",i.fillRect(r,f,S,Ea),i.beginPath(),i.arc(r+14,f+Ea/2,4.5,0,Math.PI*2),i.fillStyle=N,i.fill(),i.fillStyle=p.labelPrimary,i.font=Aa(M?12:13,600),i.textBaseline="middle";const k=S-28-Pl,I=Eu(i,o.text||"未命名",k,M?1:2);if(I.length===1)i.fillText(I[0],r+26,f+Ea/2);else{const el=f+Ea/2-6.5;I.forEach((Qt,nt)=>{i.fillText(Qt,r+26,el+nt*13)})}i.strokeStyle=p.border,i.lineWidth=1/Math.max(.5,g),i.beginPath(),i.moveTo(r+Pl,f+Ea),i.lineTo(r+S-Pl,f+Ea),i.stroke();let lt=f+Ea+hh;const Nt=S-Pl*2;for(const{def:yt,preview:el}of O){if(yt.id==="text")continue;if(yt.imageRow&&el){const P=M?52:64,Ut=yh(el,C);if(i.save(),i.beginPath(),qi(i,r+Pl,lt,Nt,P,8),i.clip(),Ut&&Ut.naturalWidth>0){const Ot=Math.min(Nt/Ut.naturalWidth,P/Ut.naturalHeight),Ol=Ut.naturalWidth*Ot,$t=Ut.naturalHeight*Ot;i.fillStyle="rgba(0,0,0,0.22)",i.fillRect(r+Pl,lt,Nt,P),i.drawImage(Ut,r+Pl+(Nt-Ol)/2,lt+(P-$t)/2,Ol,$t)}else i.fillStyle=p.border,i.fillRect(r+Pl,lt,Nt,P),i.fillStyle=p.labelSecondary,i.font=Aa(11,500),i.textBaseline="middle",i.fillText(I0(el)?"配图失败":"加载中…",r+Pl+10,lt+P/2);i.restore(),lt+=P+wi;continue}i.fillStyle=p.labelSecondary,i.font=Aa(M?10:11,500),i.textBaseline="top",i.fillText(yt.label,r+Pl,lt),i.fillStyle=p.labelPrimary,i.font=Aa(M?11:12,400);const Qt=el??"—",nt=yt.kind==="textarea"?3:2,H=Eu(i,Qt,Nt,nt);let vt=lt+(M?14:15);for(const P of H)i.fillText(P,r+Pl,vt),vt+=M?14:15;lt=Math.max(lt+yt.rowHeight,vt)+wi}i.restore()}const ay=1280,ny=.82;function uy(i){return new Promise((o,r)=>{const f=new FileReader;f.onload=()=>o(String(f.result||"")),f.onerror=()=>r(f.error||new Error("read failed")),f.readAsDataURL(i)})}function iy(i){return new Promise((o,r)=>{const f=new Image;f.onload=()=>o(f),f.onerror=()=>r(new Error("image decode failed")),f.src=i})}async function cy(i){const o=await uy(i),r=await iy(o),f=Math.min(1,ay/Math.max(r.width,r.height)),p=Math.max(1,Math.round(r.width*f)),g=Math.max(1,Math.round(r.height*f)),M=document.createElement("canvas");M.width=p,M.height=g;const N=M.getContext("2d");if(!N)throw new Error("canvas unavailable");N.drawImage(r,0,0,p,g);const C=i.type==="image/png"&&i.size<4e5&&f===1,S=C?"image/png":"image/jpeg";return{dataUrl:M.toDataURL(S,C?void 0:ny),mimeType:S}}async function fy(i){if(!i.type.startsWith("image/"))throw new Error("请选择图片文件");if(i.size>20*1024*1024)throw new Error("原图过大(请小于 20MB)");const{dataUrl:o,mimeType:r}=await cy(i),f=await fetch("/api/uploads",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataBase64:o,mimeType:r,filename:i.name})}),p=await f.json().catch(()=>({}));if(!f.ok||!p.ok||!p.url)throw new Error(p.message||`上传失败 (${f.status})`);return p.url}function vh({node:i,applyOps:o,accent:r,variant:f="overlay",onDragHandlePointerDown:p,showStylePreset:g}){const[M,N]=$.useState(()=>new Set),[C,S]=$.useState(!1);$.useEffect(()=>{N(new Set),S(!1)},[i.id]);const w=$.useMemo(()=>us(i,M),[i,M]),O=$.useMemo(()=>Q0(i,M),[i,M]),Q=(k,I)=>{const lt=Z0(i,k,I);lt.length&&(o(lt,`prop ${k}`),!I.trim()&&k!=="text"&&N(Nt=>{const yt=new Set(Nt);return yt.delete(k),yt}))};return v.jsxs("div",{className:`ns-editor${f==="panel"?" ns-editor--panel":""}`,children:[v.jsxs("div",{className:"ns-editor__header","data-ns-drag-handle":!0,onPointerDown:p,children:[v.jsx("span",{className:"ns-editor__dot",style:r?{background:r}:void 0}),v.jsx("input",{className:"ns-editor__title",defaultValue:i.text,onPointerDown:k=>k.stopPropagation(),onBlur:k=>{k.target.value!==i.text&&Q("text",k.target.value)},onKeyDown:k=>{k.key==="Enter"&&k.target.blur()}},`title-${i.id}-${i.version}`)]}),v.jsxs("div",{className:"ns-editor__body",children:[g?v.jsxs("div",{className:"ns-row",children:[v.jsx("span",{className:"ns-row__label",children:"类型"}),v.jsx("div",{className:"ns-row__ctrl",children:v.jsxs("select",{value:i.stylePreset,onChange:k=>{o([{type:"set_style_preset",nodeId:i.id,stylePreset:k.target.value}],"style")},children:[v.jsx("option",{value:"default",children:"默认外形"}),v.jsx("option",{value:"title",children:"title"}),v.jsx("option",{value:"decision",children:"决策"}),v.jsx("option",{value:"risk",children:"风险"}),v.jsx("option",{value:"note",children:"便签"}),v.jsx("option",{value:"muted",children:"弱化"})]})}),v.jsx("span",{})]}):null,v.jsxs("div",{className:"ns-row",children:[v.jsx("span",{className:"ns-row__label",children:"强调色"}),v.jsx("div",{className:"ns-row__ctrl",children:v.jsx("input",{type:"text",placeholder:"#e74c3c",defaultValue:i.accentColor??"",onBlur:k=>{const lt=k.target.value.trim()||null;(i.accentColor??null)!==lt&&o([{type:"update_node_meta",nodeId:i.id,patch:{accentColor:lt}}])}},`ac-${i.id}-${i.version}`)}),v.jsx("span",{})]}),v.jsxs("div",{className:"ns-row",children:[v.jsx("span",{className:"ns-row__label",children:"图标"}),v.jsx("div",{className:"ns-row__ctrl",children:v.jsxs("select",{value:i.icon??"",onChange:k=>{const I=k.target.value;o([{type:"update_node_meta",nodeId:i.id,patch:{icon:I||null}}])},children:[v.jsx("option",{value:"",children:"无"}),v.jsx("option",{value:"server",children:"🖥 服务器"}),v.jsx("option",{value:"database",children:"🗄 数据库"}),v.jsx("option",{value:"cloud",children:"☁ 云"}),v.jsx("option",{value:"person",children:"👤 人物"}),v.jsx("option",{value:"folder",children:"📁 文件夹"}),v.jsx("option",{value:"doc",children:"📄 文档"}),v.jsx("option",{value:"link",children:"🔗 链接"}),v.jsx("option",{value:"warning",children:"⚠ 警告"}),v.jsx("option",{value:"check",children:"✓ 完成"}),v.jsx("option",{value:"star",children:"★ 星标"}),v.jsx("option",{value:"gear",children:"⚙ 设置"}),v.jsx("option",{value:"globe",children:"🌐 全球"})]})}),v.jsx("span",{})]}),w.filter(k=>k.def.id!=="text").map(({def:k})=>v.jsx(sy,{def:k,node:i,onCommit:I=>Q(k.id,I),onClear:()=>{Q(k.id,""),N(I=>{const lt=new Set(I);return lt.delete(k.id),lt})}},k.id))]}),O.length>0?v.jsxs("div",{className:"ns-add",onPointerDown:k=>k.stopPropagation(),children:[C?v.jsx("div",{className:"ns-add__menu",children:O.map(k=>v.jsx("button",{type:"button",className:"ns-add__item",onClick:I=>{I.preventDefault(),I.stopPropagation(),N(lt=>new Set(lt).add(k.id)),S(!1)},children:k.label},k.id))}):null,v.jsx("button",{type:"button",className:"ns-add__btn",onClick:k=>{k.preventDefault(),k.stopPropagation(),S(I=>!I)},children:"+ 添加字段"})]}):null]})}function sy({def:i,node:o,onCommit:r,onClear:f}){const p=V0(o,i.id),g=!i.always,[M,N]=$.useState(!1),[C,S]=$.useState(null),w=$.useRef(null);return i.kind==="image"?v.jsxs("div",{className:"ns-row",children:[v.jsx("span",{className:"ns-row__label",children:i.label}),v.jsxs("div",{className:"ns-row__ctrl ns-row__ctrl--image",onPointerDown:O=>O.stopPropagation(),children:[p?v.jsx("img",{className:"ns-thumb",src:p,alt:""}):null,v.jsxs("div",{className:"ns-image-actions",children:[v.jsx("button",{type:"button",className:"ns-image-pick",disabled:M,onClick:()=>{var O;return(O=w.current)==null?void 0:O.click()},children:M?"上传中…":"选择文件"}),v.jsx("input",{ref:w,type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",hidden:!0,onChange:O=>{var k;const Q=(k=O.target.files)==null?void 0:k[0];O.target.value="",Q&&(S(null),N(!0),fy(Q).then(I=>r(I)).catch(I=>S(String((I==null?void 0:I.message)||I||"上传失败"))).finally(()=>N(!1)))}}),v.jsx("input",{className:"ns-image-url",defaultValue:p,placeholder:"或粘贴图片 URL",onBlur:O=>{const Q=O.target.value.trim();Q!==(p||"")&&r(Q)},onKeyDown:O=>{O.key==="Enter"&&O.target.blur()}},`${i.id}-${o.id}-${o.version}`),g?v.jsx("button",{type:"button",className:"ns-row__clear",title:"清除",onClick:f,children:"×"}):null]}),C?v.jsx("div",{className:"ns-image-err",children:C}):null,v.jsx("div",{className:"ns-image-hint",children:"支持本地选图或粘贴 https://… 链接"})]})]}):v.jsxs("div",{className:"ns-row",children:[v.jsx("span",{className:"ns-row__label",children:i.label}),v.jsxs("div",{className:"ns-row__ctrl",onPointerDown:O=>O.stopPropagation(),children:[i.kind==="textarea"||i.kind==="links"?v.jsx("textarea",{defaultValue:p,rows:i.kind==="links"?3:2,placeholder:i.kind==="links"?"标题|url 每行一条":"",onBlur:O=>r(O.target.value)},`${i.id}-${o.id}-${o.version}`):i.kind==="datetime"?v.jsx("input",{type:"datetime-local",defaultValue:p,onBlur:O=>r(O.target.value)},`${i.id}-${o.id}-${o.version}`):i.kind==="flag"?v.jsx("button",{type:"button",onClick:()=>r(o.pinned?"0":"1"),children:o.pinned?"解钉":"钉住"}):v.jsx("input",{defaultValue:p,placeholder:i.kind==="tags"?"逗号分隔":"",onBlur:O=>r(O.target.value),onKeyDown:O=>{O.key==="Enter"&&O.target.blur()}},`${i.id}-${o.id}-${o.version}`),g?v.jsx("button",{type:"button",className:"ns-row__clear",title:"清除",onClick:f,children:"×"}):null]})]})}function oy({node:i,applyOps:o,screenX:r,screenY:f,zoom:p,accent:g,width:M,showStylePreset:N}){return v.jsx("div",{className:"ns-overlay",style:{left:r,top:f,width:M,transform:`translate(-50%, -50%) scale(${p})`},children:v.jsx(vh,{node:i,applyOps:o,accent:g,showStylePreset:N})})}const ch=i=>{let o;const r=new Set,f=(S,w)=>{const O=typeof S=="function"?S(o):S;if(!Object.is(O,o)){const Q=o;o=w??(typeof O!="object"||O===null)?O:Object.assign({},o,O),r.forEach(k=>k(o,Q))}},p=()=>o,N={setState:f,getState:p,getInitialState:()=>C,subscribe:S=>(r.add(S),()=>r.delete(S))},C=o=i(f,p,N);return N},ry=(i=>i?ch(i):ch),dy=i=>i;function hy(i,o=dy){const r=Yi.useSyncExternalStore(i.subscribe,Yi.useCallback(()=>o(i.getState()),[i,o]),Yi.useCallback(()=>o(i.getInitialState()),[i,o]));return Yi.useDebugValue(r),r}const fh=i=>{const o=ry(i),r=f=>hy(o,f);return Object.assign(r,o),r},my=(i=>i?fh(i):fh);async function Va(i,o){const r=await fetch(i,{...o,headers:{"Content-Type":"application/json",...(o==null?void 0:o.headers)??{}}}),f=await r.json();if(!r.ok)throw new Error(f.message??f.error??r.statusText);return f}function yy(i,o){const r={...i};for(const[f,p]of Object.entries(o))r[f]={...p};for(const f of Object.keys(r))f in o||delete r[f];return r}function sh(i,o,r){const f={...o};for(const[p,g]of Object.entries(i))!r.has(p)&&f[p]&&(f[p]={...g});for(const p of r)o[p]?f[p]={...o[p]}:i[p]&&(f[p]={...i[p]});return f}const oh=new Map,_t=my((i,o)=>({canvases:[],canvasId:null,canvas:null,nodes:[],edges:[],positions:{},selectedIds:[],selectedEdgeId:null,highlightIds:[],highlightEdgeIds:[],highlightStyle:null,fitViewport:null,leftCollapsed:!1,themeId:localStorage.getItem("mind-map:theme")??"abyss",lastChangeSetId:null,trash:[],loadCanvases:async()=>{const r=await Va("/api/canvases");i({canvases:r.canvases}),!o().canvasId&&r.canvases[0]&&await o().openCanvas(r.canvases[0].id)},openCanvas:async r=>{const f=await Va(`/api/canvases/${r}`);i({canvasId:r,canvas:f.canvas,nodes:f.nodes,edges:f.edges,positions:f.positions,selectedIds:[],selectedEdgeId:null,themeId:f.canvas.prefs.themeId??o().themeId}),await o().loadTrash()},createCanvas:async r=>{const f=await Va("/api/canvases",{method:"POST",body:JSON.stringify({title:r})});await o().loadCanvases(),i({canvasId:f.canvas.id,canvas:f.canvas,nodes:f.nodes,edges:f.edges,positions:f.positions,selectedIds:[]})},patchLocal:r=>{i(f=>({nodes:r.nodes??f.nodes,edges:r.edges??f.edges,positions:r.positions??f.positions,canvas:r.canvas??f.canvas}))},requestFitViewport:r=>i({fitViewport:r}),consumeFitViewport:()=>{const r=o().fitViewport;return r&&i({fitViewport:null}),r},applyOps:async(r,f)=>{const p=o().canvasId;if(!p)return;const g=r.some(Q=>Q.type==="delete_node"||Q.type==="restore_node"),M=r.some(Q=>Q.type==="set_prefs"||Q.type==="update_text"),N=r.length>0&&r.every(Q=>Q.type==="set_pinned"),C=new Set(r.filter(Q=>Q.type==="set_pinned"&&Q.pinned===!0).map(Q=>Q.nodeId)),S={...o().positions},w=await Va(`/api/canvases/${p}/ops`,{method:"POST",body:JSON.stringify({ops:r,origin:"user",summary:f})}),O=N&&C.size>0?sh(S,w.positions,C):yy(S,w.positions);i({canvas:w.canvas,nodes:w.nodes,edges:w.edges,positions:O,lastChangeSetId:w.changeSetId,themeId:w.canvas.prefs.themeId,...w.fitViewport?{fitViewport:w.fitViewport}:{}}),N&&C.size>0&&oh.set(p,{positions:{...O},pinnedIds:[...C],until:Date.now()+2e3}),M&&o().loadCanvases(),g&&o().loadTrash()},applyCanvasPayload:(r,f)=>{const p=r.canvas.id,g=oh.get(p),M=o().positions;let N=r.positions;if(f!=null&&f.preserveUnpinned||g&&g.until>Date.now()){const C=new Set((g==null?void 0:g.pinnedIds)??r.nodes.filter(S=>S.pinned&&S.pos).map(S=>S.id));N=sh((g==null?void 0:g.positions)??M,r.positions,C)}i({canvasId:p,canvas:r.canvas,nodes:r.nodes,edges:r.edges,positions:N,themeId:r.canvas.prefs.themeId??o().themeId})},undo:async()=>{const r=o().canvasId,f=o().lastChangeSetId;if(!r||!f)return;const p=await Va(`/api/canvases/${r}/undo`,{method:"POST",body:JSON.stringify({changeSetId:f})});await o().openCanvas(r),i({lastChangeSetId:p.changeSetId})},setSelection:r=>i({selectedIds:r,selectedEdgeId:null}),setSelectedEdge:r=>i({selectedEdgeId:r,selectedIds:r?[]:o().selectedIds}),flashHighlight:r=>{const f=Array.isArray(r)?{nodeIds:r}:r,p=f.nodeIds??[],g=f.edgeIds??[],M=f.style??null,N=Math.max(500,Math.min(6e4,f.ttlMs??2200));i({highlightIds:p,highlightEdgeIds:g,highlightStyle:M,selectedIds:p.length?p:o().selectedIds,selectedEdgeId:g.length===1?g[0]:o().selectedEdgeId}),window.setTimeout(()=>{const C=_t.getState();C.highlightIds.length===p.length&&C.highlightIds.every((S,w)=>S===p[w])&&C.highlightEdgeIds.length===g.length&&C.highlightEdgeIds.every((S,w)=>S===g[w])&&i({highlightIds:[],highlightEdgeIds:[],highlightStyle:null})},N)},setThemeId:r=>{localStorage.setItem("mind-map:theme",r),i({themeId:r})},setCollapsedPanels:(r,f)=>{r==="left"&&i({leftCollapsed:f})},setPrefs:async r=>{await o().applyOps([{type:"set_prefs",prefs:r}],"update prefs")},setStylePreset:async(r,f)=>{await o().applyOps([{type:"set_style_preset",nodeId:r,stylePreset:f}],"style")},loadTrash:async()=>{const r=o().canvasId;if(!r)return;const f=await Va(`/api/canvases/${r}/trash`);i({trash:f.nodes})},restoreFromTrash:async r=>{const f=o().canvasId;f&&(await Va(`/api/canvases/${f}/trash/${r}/restore`,{method:"POST"}),await o().openCanvas(f),await o().loadTrash())}}));function vy(){const i=_t(S=>S.canvas),o=_t(S=>S.nodes),r=_t(S=>S.edges),f=_t(S=>S.selectedIds),p=_t(S=>S.selectedEdgeId),g=_t(S=>S.applyOps),M=(i==null?void 0:i.prefs.inspectorMode)??"selection",N=$.useMemo(()=>f[0]?o.find(S=>S.id===f[0]):void 0,[o,f]),C=$.useMemo(()=>p?r.find(S=>S.id===p):void 0,[r,p]);return M==="selection"&&!N&&!C?v.jsx("div",{className:"inspector muted",children:"选中节点或边以编辑属性"}):C&&!N?v.jsx(by,{edge:C,applyOps:g}):N?v.jsx(gy,{node:N,applyOps:g}):v.jsx("div",{className:"inspector muted",children:"选中节点或边以编辑属性"})}function gy({node:i,applyOps:o}){return v.jsxs("div",{className:"inspector",children:[v.jsx("div",{className:"inspector__title",children:"节点属性"}),v.jsx(vh,{node:i,applyOps:o,variant:"panel",showStylePreset:!0}),v.jsx("div",{className:"inspector__row",style:{marginTop:8},children:v.jsx("button",{type:"button",onClick:()=>void o([{type:"set_collapsed",nodeId:i.id,collapsed:!i.collapsed}]),children:i.collapsed?"展开":"折叠"})})]})}function by({edge:i,applyOps:o}){var p;const[r,f]=$.useState(((p=i.tags)==null?void 0:p.join(", "))??"");return $.useEffect(()=>{var g;f(((g=i.tags)==null?void 0:g.join(", "))??"")},[i.id,i.version,i.tags]),v.jsxs("div",{className:"inspector",children:[v.jsx("div",{className:"inspector__title",children:"边属性"}),v.jsxs("label",{className:"inspector__field",children:[v.jsx("span",{children:"标签"}),v.jsx("input",{defaultValue:i.label??"",onBlur:g=>{o([{type:"update_edge_meta",edgeId:i.id,patch:{label:g.target.value||null}}])}},`el-${i.id}-${i.version}`)]}),v.jsxs("label",{className:"inspector__field",children:[v.jsx("span",{children:"备注"}),v.jsx("textarea",{defaultValue:i.note??"",rows:2,onBlur:g=>{o([{type:"update_edge_meta",edgeId:i.id,patch:{note:g.target.value||null}}])}},`en-${i.id}-${i.version}`)]}),v.jsxs("label",{className:"inspector__field",children:[v.jsx("span",{children:"线粗 (1-5)"}),v.jsx("input",{type:"number",min:1,max:5,defaultValue:i.weight??1,onBlur:g=>{const M=Number(g.target.value),N=Number.isFinite(M)?Math.max(1,Math.min(5,Math.round(M))):null;o([{type:"update_edge_meta",edgeId:i.id,patch:{weight:N}}])}},`ew-${i.id}-${i.version}`)]}),v.jsxs("label",{className:"inspector__field",children:[v.jsx("span",{children:"线型"}),v.jsxs("select",{defaultValue:i.lineStyle??(i.kind==="relation"?"dashed":"solid"),onChange:g=>{const M=g.target.value;o([{type:"update_edge_meta",edgeId:i.id,patch:{lineStyle:M}}])},children:[v.jsx("option",{value:"solid",children:"实线"}),v.jsx("option",{value:"dashed",children:"虚线"}),v.jsx("option",{value:"dotted",children:"点线"})]},`es-${i.id}-${i.version}`)]}),v.jsxs("label",{className:"inspector__field",children:[v.jsx("span",{children:"箭头"}),v.jsxs("select",{defaultValue:i.direction??(i.kind==="relation"?"forward":"none"),onChange:g=>{const M=g.target.value;o([{type:"update_edge_meta",edgeId:i.id,patch:{direction:M}}])},children:[v.jsx("option",{value:"forward",children:"单向 →"}),v.jsx("option",{value:"both",children:"双向 ↔"}),v.jsx("option",{value:"none",children:"无箭头"})]},`ed-${i.id}-${i.version}`)]}),v.jsxs("label",{className:"inspector__field",children:[v.jsx("span",{children:"标签(逗号分隔)"}),v.jsx("input",{value:r,onChange:g=>f(g.target.value),onBlur:()=>{const g=r.split(/[,,]/).map(M=>M.trim()).filter(Boolean);o([{type:"update_edge_meta",edgeId:i.id,patch:{tags:g}}])}})]}),v.jsxs("div",{className:"muted",style:{fontSize:11},children:[i.kind," · ",i.from.slice(0,8)," → ",i.to.slice(0,8)]})]})}const gh={bgBase:"#101014",bgLayer1:"#1b1e28",labelPrimary:"#f4f5f7",labelSecondary:"#a5adb8",brand:"#5e6ad2",border:"rgba(255,255,255,0.08)",bubble:"rgba(37,42,58,0.9)",warn:"#f59e5b",error:"#ef4444"},bh=[{key:"bgBase",css:"--dsw-alias-bg-base"},{key:"bgLayer1",css:"--dsw-alias-bg-layer-1"},{key:"labelPrimary",css:"--dsw-alias-label-primary"},{key:"labelSecondary",css:"--dsw-alias-label-secondary"},{key:"brand",css:"--dsw-alias-brand-primary"},{key:"border",css:"--dsw-alias-border-l1"},{key:"bubble",css:"--dsw-specific-bubble"},{key:"warn",css:"--dsw-alias-state-warn-primary"},{key:"error",css:"--dsw-alias-state-error-primary"}];function py(i){try{return getComputedStyle(document.documentElement).getPropertyValue(i).trim()}catch{return""}}function Sy(i=window.location.search){const o=new URLSearchParams(i),r=document.documentElement;for(const{key:p,css:g}of bh){const M=o.get(`t_${p}`);M&&r.style.setProperty(g,decodeURIComponent(M))}const f=o.get("colorScheme");(f==="light"||f==="dark")&&(r.dataset.colorScheme=f)}function Ty(){const i={...gh};for(const{key:o,css:r}of bh){const f=py(r);f&&(i[o]=f)}return i}function zy(i,o=8){const r=i.startsWith("#")?i:gh.brand,f=/^#?([0-9a-f]{6})$/i.exec(r.trim()),p=f?parseInt(f[1],16):6187730,g=p>>16&255,M=p>>8&255,N=p&255,C=Math.max(g,M,N)/255,S=Math.min(g,M,N)/255,w=(C+S)/2;let O=0,Q=0;if(C!==S){const I=C-S;Q=w>.5?I/(2-C-S):I/(C+S);const lt=g/255,Nt=M/255,yt=N/255;switch(C){case lt:O=((Nt-yt)/I+(Nt{const M=(g+i/30)%12,N=r-f*Math.max(Math.min(M-3,9-M,1),-1);return Math.round(255*N).toString(16).padStart(2,"0")};return`#${p(0)}${p(8)}${p(4)}`}function es(i,o){const r=new Map;for(const M of o){if(M.deletedAt||M.kind!=="hierarchy"||!M.isPrimaryParent)continue;const N=r.get(M.from)??[];N.push(M.to),r.set(M.from,N)}const f=[i],p=new Set([i]),g=[i];for(;g.length;){const M=g.shift();for(const N of r.get(M)??[])p.has(N)||(p.add(N),f.push(N),g.push(N))}return f}function rh(i,o,r){return es(o,r).includes(i)}function Ey(i,o,r){if(o)return r&&r.ids.includes(i)?{x:o.x+r.dx,y:o.y+r.dy}:o}function Ay({node:i,x:o,y:r}){var M;const f=(i.tags??[]).slice(0,4),p=(i.note??"").trim(),g=((M=i.links)==null?void 0:M.length)??0;return v.jsxs("div",{className:"hover-card",style:{left:o,top:r},children:[v.jsx("div",{className:"hover-card__title",children:i.text}),p?v.jsx("div",{className:"hover-card__note",children:p.slice(0,120)}):null,f.length?v.jsx("div",{className:"hover-card__tags",children:f.map(N=>v.jsx("span",{className:"hover-card__tag",children:N},N))}):null,v.jsxs("div",{className:"hover-card__meta",children:[g?`${g} 链接`:null,i.dueAt!=null?`${g?" · ":""}截止 ${new Date(i.dueAt).toLocaleDateString()}`:null,i.stylePreset!=="default"?`${g||i.dueAt?" · ":""}${i.stylePreset}`:null]})]})}const My={unnamed:"未命名",newNode:"新节点",leftChild:"左侧子主题",rightChild:"右侧子主题",sibling:"兄弟节点",relationLabel:"关联",toolbarAria:"画布工具",controlsAria:"视图控制",backRosterTitle:"返回画布列表",backRoster:"返回",toolSelect:"选择",toolPan:"平移",toolLink:"连线",dragNode:"单点",dragBranch:"整枝",dragNodeTitle:"单点拖拽:只移动当前节点 (N);按住 Shift 也可临时单点",dragBranchTitle:"整枝拖拽:节点与子孙一起移动 (B)",bubble:"气泡",card:"卡片",bubbleTitle:"气泡视图:精简标题",cardTitle:"卡片视图:展开属性面板",unpin:"解钉",unpinTitle:"取消钉住:让选中节点重新参与自动布局",undo:"撤销",fullscreen:"全屏",exitFullscreen:"退出全屏",zoomIn:"放大",zoomInTitle:"放大 (+)",zoomOut:"缩小",zoomOutTitle:"缩小 (-)",fit:"适应画布",fitTitle:"适应画布 (F)",lock:"锁定",unlock:"解锁",lockTitle:"锁定画布 (L)",unlockTitle:"解锁画布 (L)",addLeftChildTitle:"添加左侧子主题",addRightChildTitle:"添加右侧子主题",hintLocked:"已锁定 · 仅浏览/缩放/平移",hintNodeDrag:"单点拖 · 只移动当前节点 · Shift 临时单点 · Esc 取消",hintBranchDrag:"整枝拖 · 空白钉住 · 落到节点换父 · N 单点 · Esc 取消"},Ny={unnamed:"Untitled",newNode:"New node",leftChild:"Left child",rightChild:"Right child",sibling:"Sibling",relationLabel:"Link",toolbarAria:"Canvas tools",controlsAria:"View controls",backRosterTitle:"Back to canvas list",backRoster:"Back",toolSelect:"Select",toolPan:"Pan",toolLink:"Link",dragNode:"Node",dragBranch:"Branch",dragNodeTitle:"Move node only (N); hold Shift for temporary node-drag",dragBranchTitle:"Move node with descendants (B)",bubble:"Bubble",card:"Card",bubbleTitle:"Bubble view: title only",cardTitle:"Card view: property sheet",unpin:"Unpin",unpinTitle:"Unpin selected node for auto layout",undo:"Undo",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",zoomIn:"Zoom in",zoomInTitle:"Zoom in (+)",zoomOut:"Zoom out",zoomOutTitle:"Zoom out (-)",fit:"Fit",fitTitle:"Fit view (F)",lock:"Lock",unlock:"Unlock",lockTitle:"Lock canvas (L)",unlockTitle:"Unlock canvas (L)",addLeftChildTitle:"Add left child",addRightChildTitle:"Add right child",hintLocked:"Locked · browse / zoom / pan only",hintNodeDrag:"Node drag · Shift temp node · Esc cancel",hintBranchDrag:"Branch drag · pin on blank · drop to reparent · N node · Esc cancel"},Oy={zh:My,en:Ny};function Au(i){const o=String(i??"").trim().toLowerCase();return o.startsWith("zh")?"zh":o?"en":typeof navigator<"u"&&String(navigator.language||"").toLowerCase().startsWith("zh")?"zh":"en"}function Dy(i){const o=Au(i);return Oy[o]}const xy="dsh-mind-map:locale";function ph(){try{const i=new URLSearchParams(window.location.search),o=i.get("lang")||i.get("locale");return o?Au(o):null}catch{return null}}function Sh(){var i;try{const o=(i=document.documentElement)==null?void 0:i.lang;return o?Au(o):null}catch{return null}}function jy(){return ph()||Sh()||Au(navigator.language)}function Cy(){const[i,o]=$.useState(jy);$.useEffect(()=>{const f=N=>{const C=Au(N);o(S=>S===C?S:C)},p=N=>{const C=N==null?void 0:N.data;!C||typeof C!="object"||C.type===xy&&f(C.lang??C.locale)};window.addEventListener("message",p);const g=new MutationObserver(()=>{const N=Sh();N&&f(N)});g.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]});const M=ph();return M&&f(M),()=>{window.removeEventListener("message",p),g.disconnect()}},[]);const r=$.useMemo(()=>Dy(i),[i]);return{locale:i,U:r}}const Uy=200,Za=168,Ka=118;function dh(){var Mu;const{U:i}=Cy(),o=$.useRef(null),r=$.useRef(null),f=$.useRef(null),p=_t(b=>b.nodes),g=_t(b=>b.edges),M=_t(b=>b.positions),N=_t(b=>b.selectedIds),C=_t(b=>b.highlightIds),S=_t(b=>b.highlightEdgeIds),w=_t(b=>b.highlightStyle),O=_t(b=>b.canvas),Q=_t(b=>b.applyOps),k=_t(b=>b.setPrefs),I=_t(b=>b.patchLocal),lt=_t(b=>b.setSelection),Nt=_t(b=>b.undo),yt=_t(b=>b.lastChangeSetId),el=typeof window<"u"&&(()=>{try{const b=new URLSearchParams(window.location.search);return b.get("embed")==="1"||b.get("embed")==="true"}catch{return!1}})(),Qt=$.useCallback(()=>{var b;try{(b=window.parent)==null||b.postMessage({type:"dsh-mind-map:back"},"*")}catch{}},[]),nt=$.useCallback(async()=>{var y;const b=f.current;if(b)try{if(document.fullscreenElement){await document.exitFullscreen();return}await b.requestFullscreen()}catch{try{(y=window.parent)==null||y.postMessage({type:"dsh-mind-map:fullscreen"},"*")}catch{}}},[]);$.useEffect(()=>{const b=()=>x(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",b),()=>document.removeEventListener("fullscreenchange",b)},[]);const[H,vt]=$.useState({x:0,y:0,zoom:1}),P=_t(b=>b.fitViewport),Ut=_t(b=>b.consumeFitViewport);$.useEffect(()=>{if(!P)return;const b=Ut();b&&vt(b)},[P,Ut]);const[Ot,Ol]=$.useState("select"),[$t,Kt]=$.useState("node"),[ut,Dl]=$.useState(!1),[ol,x]=$.useState(!1),[G,at]=$.useState(0),[jt,Ct]=$.useState(0),[h,U]=$.useState(null),[X,Z]=$.useState(null),[it,ft]=$.useState(null),[ot,cl]=$.useState(null),[Wt,oe]=$.useState(null),[$e,Ee]=$.useState(!1),[Ul,Ae]=$.useState({w:1,h:1}),[Nn,Me]=$.useState(null),W=$.useRef({mode:"none",lastX:0,lastY:0,space:!1,nodeId:null,startX:0,startY:0,moved:!1,alt:!1,forcePin:!1,startWorldX:0,startWorldY:0,subtreeIds:[]}),On=$.useRef(null);On.current=ot;const We=$.useRef(!1),gt=$.useMemo(()=>Ty(),[G]),Ma=$.useMemo(()=>zy(gt.brand,8),[gt.brand]);$.useEffect(()=>{var Y;const b=()=>at(q=>q+1),y=window.matchMedia("(prefers-color-scheme: light)");return(Y=y.addEventListener)==null||Y.call(y,"change",b),()=>{var q;return(q=y.removeEventListener)==null?void 0:q.call(y,"change",b)}},[]);const Vl=(O==null?void 0:O.prefs.density)==="compact",al=(O==null?void 0:O.prefs.nodeViewMode)!=="bubble",nl=$.useCallback(b=>P0(b,Vl,{asCard:al}),[Vl,al]),Dn=Vl?160:Uy,xn=(O==null?void 0:O.prefs.branchColoring)!==!1,re=$.useMemo(()=>{const b=new Map;if(!xn)return b;const y=p.filter(V=>V.deletedAt?!1:!g.some(L=>L.kind==="hierarchy"&&L.isPrimaryParent&&L.to===V.id));let Y=0;for(const V of y)b.set(V.id,Ma[Y%Ma.length]),Y++;const q=(V,L)=>{for(const K of g)K.kind==="hierarchy"&&K.isPrimaryParent&&K.from===V&&(b.set(K.to,L),q(K.to,L))};for(const[V,L]of b)q(V,L);return b},[p,g,Ma,xn]),be=$.useCallback((b,y)=>{const q=f.current.getBoundingClientRect();return{x:(b-q.left-q.width/2-H.x)/H.zoom,y:(y-q.top-q.height/2-H.y)/H.zoom}},[H]),Bl=$.useCallback(b=>Ey(b,M[b],ot),[M,ot]),Fe=$.useCallback((b,y,Y)=>{for(let q=p.length-1;q>=0;q--){const V=p[q];if(V.deletedAt||Y!=null&&Y.has(V.id))continue;const L=Bl(V.id);if(!L)continue;const{w:K,h:dt}=nl(V);if(b>=L.x-K/2&&b<=L.x+K/2&&y>=L.y-dt/2&&y<=L.y+dt/2)return V.id}return null},[p,Bl,Vl]),Ie=$.useMemo(()=>{let b=0,y=0,Y=0,q=0,V=!1;for(const K of p){if(K.deletedAt)continue;const dt=M[K.id];dt&&(V?(b=Math.min(b,dt.x),y=Math.max(y,dt.x),Y=Math.min(Y,dt.y),q=Math.max(q,dt.y)):(b=dt.x,y=dt.x,Y=dt.y,q=dt.y,V=!0))}if(!V)return{minX:-200,maxX:200,minY:-120,maxY:120};const L=80;return{minX:b-L,maxX:y+L,minY:Y-L,maxY:q+L}},[p,M]),Na=$.useCallback(b=>{vt(y=>({...y,zoom:Math.min(4,Math.max(.02,b))}))},[]),Ne=$.useCallback(()=>{const{minX:b,maxX:y,minY:Y,maxY:q}=Ie,V=Math.max(40,y-b),L=Math.max(40,q-Y),K=Ul.w||1,dt=Ul.h||1,Xt=Math.min(2.5,Math.max(.12,Math.min(K*.86/V,dt*.86/L))),Rt=(b+y)/2,ll=(Y+q)/2;vt({x:-Rt*Xt,y:-ll*Xt,zoom:Xt})},[Ie,Ul]),xl=$.useCallback((b,y)=>{const Y=r.current;if(!Y)return;const q=Y.getBoundingClientRect(),{minX:V,maxX:L,minY:K,maxY:dt}=Ie,Xt=Math.max(1,L-V),Rt=Math.max(1,dt-K),ll=V+(b-q.left)/q.width*Xt,B=K+(y-q.top)/q.height*Rt;vt(Dt=>({...Dt,x:-ll*Dt.zoom,y:-B*Dt.zoom}))},[Ie]),Zl=$.useCallback(()=>{const b=o.current;if(!b)return;const y=b.getContext("2d");if(!y)return;const Y=window.devicePixelRatio||1;y.setTransform(Y,0,0,Y,0,0);const q=b.clientWidth,V=b.clientHeight;y.clearRect(0,0,q,V),y.fillStyle=gt.bgBase,y.fillRect(0,0,q,V),y.save(),y.translate(q/2+H.x,V/2+H.y),y.scale(H.zoom,H.zoom),y.strokeStyle=gt.border,y.lineWidth=1/H.zoom;const L=48,K=Math.floor((-q/2-H.x)/H.zoom/L)*L-L*2,dt=Math.ceil((q/2-H.x)/H.zoom/L)*L+L*2,Xt=Math.floor((-V/2-H.y)/H.zoom/L)*L-L*2,Rt=Math.ceil((V/2-H.y)/H.zoom/L)*L+L*2;y.globalAlpha=.35,y.beginPath();for(let B=K;B<=dt;B+=L)y.moveTo(B,Xt),y.lineTo(B,Rt);for(let B=Xt;B<=Rt;B+=L)y.moveTo(K,B),y.lineTo(dt,B);y.stroke(),y.globalAlpha=1;for(const B of g){if((O==null?void 0:O.prefs.showRelationEdges)===!1&&B.kind==="relation")continue;const Dt=Bl(B.from),Vt=Bl(B.to);if(!Dt||!Vt)continue;const bt=p.find(Lt=>Lt.id===B.from),Ft=p.find(Lt=>Lt.id===B.to),Zt=bt?nl(bt).w:Dn,Sl=Ft?nl(Ft).w:Dn;y.beginPath();const Tl=Dt.x+(Vt.x>=Dt.x?Zt/2:-Zt/2),It=Dt.y,Et=Vt.x+(Vt.x>=Dt.x?-Sl/2:Sl/2),zt=Vt.y,Pt=(Tl+Et)/2;y.moveTo(Tl,It),y.bezierCurveTo(Pt,It,Pt,zt,Et,zt);const jl=Math.max(1,Math.min(5,B.weight??1)),Oe=B.lineStyle??(B.kind==="relation"?"dashed":"solid");Oe==="dotted"?y.setLineDash([2/H.zoom,4/H.zoom]):Oe==="dashed"?y.setLineDash([6/H.zoom,4/H.zoom]):y.setLineDash([]);const de=S.includes(B.id),Pe=(w==null?void 0:w.edgeColor)??gt.brand,De=(w==null?void 0:w.edgeWidth)??3.6;y.strokeStyle=de?Pe:B.kind==="relation"?gt.labelSecondary:re.get(B.to)??gt.brand,y.lineWidth=(de?De:1.2+(jl-1)*.7)/H.zoom,y.stroke(),y.setLineDash([]);const rl=B.direction??(B.kind==="relation"?"forward":"none");if(rl==="forward"||rl==="both"){const Lt=Math.atan2(0,Et-Pt||(Et>=Dt.x?1:-1)),gl=8/H.zoom,he=de?Pe:B.kind==="relation"?gt.labelSecondary:re.get(B.to)??gt.brand;y.beginPath(),y.fillStyle=he,y.moveTo(Et,zt),y.lineTo(Et-gl*Math.cos(Lt-.45),zt-gl*Math.sin(Lt-.45)),y.lineTo(Et-gl*Math.cos(Lt+.45),zt-gl*Math.sin(Lt+.45)),y.closePath(),y.fill()}if(rl==="both"){const Lt=Math.atan2(0,Tl-Pt||(Dt.x>=Vt.x?1:-1)),gl=8/H.zoom,he=de?Pe:B.kind==="relation"?gt.labelSecondary:re.get(B.to)??gt.brand;y.beginPath(),y.fillStyle=he,y.moveTo(Tl,It),y.lineTo(Tl-gl*Math.cos(Lt-.45),It-gl*Math.sin(Lt-.45)),y.lineTo(Tl-gl*Math.cos(Lt+.45),It-gl*Math.sin(Lt+.45)),y.closePath(),y.fill()}B.label&&H.zoom>=.25&&(y.fillStyle=gt.labelSecondary,y.font="11px sans-serif",y.fillText(B.label,Pt,(It+zt)/2-6))}if(it){const B=Bl(it.fromId);B&&(y.beginPath(),y.setLineDash([4/H.zoom,4/H.zoom]),y.strokeStyle=gt.brand,y.moveTo(B.x,B.y),y.lineTo(it.x,it.y),y.stroke(),y.setLineDash([]))}const ll=(O==null?void 0:O.prefs.nodeBadges)??"icons";for(const B of p){if(B.deletedAt)continue;const Dt=Bl(B.id);if(!Dt)continue;const Vt=!!(ot!=null&&ot.ids.includes(B.id)),{w:bt,h:Ft}=nl(B),Zt=Dt.x-bt/2,Sl=Dt.y-Ft/2,Tl=B.accentColor??re.get(B.id)??gt.bubble,It=N.includes(B.id),Et=C.includes(B.id),zt=(w==null?void 0:w.nodeColor)??gt.brand,Pt=X===B.id,jl=Wt===B.id,Oe=$e&&jl;Vt&&(y.globalAlpha=.7),Et&&(w==null?void 0:w.nodeGlow)!==!1?(y.shadowColor=zt,y.shadowBlur=14/H.zoom):J0(y,H.zoom,{selected:It}),y.fillStyle=gt.bgLayer1;const de=al?"card":B.stylePreset,Pe=al?14:B.stylePreset==="title"?Ft/2:12;if(ih(y,de,Zt,Sl,bt,Ft,Pe),y.fill(),$0(y,Tl,al?.1:B.stylePreset==="title"?.22:.14),!al&&B.stylePreset!=="decision"&&B.stylePreset!=="title"&&B.stylePreset!=="note"&&W0(y,Zt,Sl,Ft,Tl,12),!al&&B.stylePreset==="note"?y.setLineDash([4/H.zoom,3/H.zoom]):y.setLineDash([]),y.strokeStyle=Oe?gt.warn:jl?gt.brand:!al&&B.stylePreset==="risk"?gt.warn:Et?zt:It||Pt?gt.brand:Tl,y.lineWidth=(jl||Et||It||al||B.stylePreset==="title"||B.stylePreset==="decision"?2.4:1.35)/H.zoom,!al&&B.stylePreset==="muted"&&(y.globalAlpha=Vt?.4:.55),k0(y),y.stroke(),y.setLineDash([]),y.globalAlpha=Vt?.7:1,al)if(!N.includes(B.id))ey(y,B,Zt,Sl,gt,H.zoom,Vl,Tl,()=>Ct(rl=>rl+1));else{y.fillStyle="rgba(0,0,0,0.2)",y.fillRect(Zt,Sl,bt,36),y.beginPath(),y.arc(Zt+14,Sl+18,4.5,0,Math.PI*2),y.fillStyle=Tl,y.fill(),y.fillStyle=gt.labelPrimary,y.font=Aa(13,600),y.textBaseline="middle";const rl=Eu(y,B.text||i.unnamed,bt-40,1);y.fillText(rl[0]??"?",Zt+26,Sl+18)}else{const rl=14+(B.stylePreset==="decision"||B.stylePreset==="title"||B.stylePreset==="note"?0:4);let Lt=Sl+12;if(B.imageUrl){const zl=Vl?64:78,me=bt-rl-12,Yl=yh(B.imageUrl,()=>Ct(je=>je+1));if(y.save(),y.beginPath(),ih(y,"default",Zt+rl,Lt,me,zl,8),y.clip(),Yl&&Yl.naturalWidth>0){const je=Math.min(me/Yl.naturalWidth,zl/Yl.naturalHeight),te=Yl.naturalWidth*je,Rl=Yl.naturalHeight*je;y.fillStyle="rgba(0,0,0,0.22)",y.fillRect(Zt+rl,Lt,me,zl),y.drawImage(Yl,Zt+rl+(me-te)/2,Lt+(zl-Rl)/2,te,Rl)}else y.fillStyle=gt.border,y.fillRect(Zt+rl,Lt,me,zl);y.restore(),Lt+=zl+8}y.fillStyle=B.stylePreset==="muted"?gt.labelSecondary:gt.labelPrimary;const gl=Vl?12:B.stylePreset==="title"?15:13,he=B.stylePreset==="title"||B.stylePreset==="decision"?600:500;y.font=Aa(gl,he),y.textBaseline="top";const ta=bt-rl-12,dl=(Vl||B.stylePreset==="title",2),jn=Eu(y,B.text||i.unnamed,ta,dl),Cn=gl+3,xe=jn.length*Cn,pe=ll!=="off"&&H.zoom>=.35?ll==="tags"?(B.tags??[]).slice(0,2).map(zl=>`#${zl}`):ty(B).slice(0,4):[],Li=pe.length?20:0;let Un=Lt;if(!B.imageUrl){const zl=Ft-16-Li;Un=Sl+Math.max(10,(zl-xe)/2)}if(jn.forEach((zl,me)=>{y.fillText(zl,Zt+rl,Un+me*Cn)}),pe.length){let zl=Zt+rl;const me=Sl+Ft-22;for(const Yl of pe)zl+=F0(y,Yl,zl,me,gt,H.zoom)}}y.globalAlpha=1}y.restore()},[gt,H,g,Bl,p,re,N,C,S,w,X,it,ot,Wt,$e,Dn,Vl,al,nl,O==null?void 0:O.prefs.showRelationEdges,O==null?void 0:O.prefs.nodeBadges,jt,i]),pl=$.useCallback(()=>{const b=r.current;if(!b)return;const y=b.getContext("2d");if(!y)return;const Y=window.devicePixelRatio||1;b.width=Math.floor(Za*Y),b.height=Math.floor(Ka*Y),b.style.width=`${Za}px`,b.style.height=`${Ka}px`,y.setTransform(Y,0,0,Y,0,0),y.clearRect(0,0,Za,Ka),y.fillStyle=gt.bgLayer1,y.fillRect(0,0,Za,Ka);const{minX:q,maxX:V,minY:L,maxY:K}=Ie,dt=Math.max(1,V-q),Xt=Math.max(1,K-L),Rt=Za/dt,ll=Ka/Xt,B=Math.min(Rt,ll),Dt=(Za-dt*B)/2,Vt=(Ka-Xt*B)/2,bt=(zt,Pt)=>({x:Dt+(zt-q)*B,y:Vt+(Pt-L)*B});y.strokeStyle=gt.border,y.lineWidth=1;for(const zt of g){if(zt.kind!=="hierarchy")continue;const Pt=Bl(zt.from),jl=Bl(zt.to);if(!Pt||!jl)continue;const Oe=bt(Pt.x,Pt.y),de=bt(jl.x,jl.y);y.beginPath(),y.moveTo(Oe.x,Oe.y),y.lineTo(de.x,de.y),y.stroke()}for(const zt of p){if(zt.deletedAt)continue;const Pt=Bl(zt.id);if(!Pt)continue;const jl=bt(Pt.x,Pt.y);y.fillStyle=re.get(zt.id)??gt.brand,y.beginPath(),y.arc(jl.x,jl.y,2.2,0,Math.PI*2),y.fill()}const Ft=Ul.w/H.zoom,Zt=Ul.h/H.zoom,Sl=-H.x/H.zoom,Tl=-H.y/H.zoom,It=bt(Sl-Ft/2,Tl-Zt/2),Et=bt(Sl+Ft/2,Tl+Zt/2);y.strokeStyle=gt.brand,y.lineWidth=1.5,y.strokeRect(It.x,It.y,Math.max(4,Et.x-It.x),Math.max(4,Et.y-It.y))},[gt,Ie,g,Bl,p,re,Ul,H]);$.useEffect(()=>{const b=o.current,y=f.current;if(!b||!y)return;const Y=()=>{const V=y.getBoundingClientRect(),L=window.devicePixelRatio||1;b.width=Math.floor(V.width*L),b.height=Math.floor(V.height*L),b.style.width=`${V.width}px`,b.style.height=`${V.height}px`,Ae({w:V.width,h:V.height}),Zl(),pl()};Y();const q=new ResizeObserver(Y);return q.observe(y),()=>q.disconnect()},[Zl,pl]),$.useEffect(()=>{Zl(),pl()},[Zl,pl]),$.useEffect(()=>{const b=Y=>{var V,L;const q=(V=Y.target)==null?void 0:V.tagName;if(!(q==="INPUT"||q==="TEXTAREA")){if(!Y.metaKey&&!Y.ctrlKey&&!Y.altKey){const K=Y.key.toLowerCase();K==="v"&&Ol("select"),K==="h"&&Ol("pan"),K==="c"&&Ol("link"),K==="b"&&Kt("branch"),K==="n"&&Kt("node"),K==="l"&&Dl(dt=>!dt),K==="f"&&Ne(),(K==="="||K==="+")&&Na(H.zoom*1.15),(K==="-"||K==="_")&&Na(H.zoom/1.15)}if(Y.code==="Space"&&(W.current.space=!0),Y.key==="Alt"&&(W.current.alt=!0),Y.key==="Escape"&&W.current.mode==="node"){Y.preventDefault(),W.current.mode="none",W.current.nodeId=null,W.current.moved=!1,cl(null),oe(null),Ee(!1),Me(null);return}if(!ut){if(Y.key==="Tab"&&!ut){Y.preventDefault();const K=N[0];Q([K?{type:"create_node",text:i.newNode,parentId:K}:{type:"create_node",text:i.newNode}])}if(Y.key==="ArrowLeft"&&N[0]&&!h&&(Y.preventDefault(),Q([{type:"create_node",text:i.leftChild,parentId:N[0],sidePref:-1}])),Y.key==="ArrowRight"&&N[0]&&!h&&(Y.preventDefault(),Q([{type:"create_node",text:i.rightChild,parentId:N[0],sidePref:1}])),(Y.key==="Delete"||Y.key==="Backspace")&&!h){const K=N[0];K&&Q([{type:"delete_node",nodeId:K}])}if(Y.key==="Enter"&&N[0]&&!h){Y.preventDefault();const K=((L=g.find(dt=>dt.kind==="hierarchy"&&dt.isPrimaryParent&&dt.to===N[0]))==null?void 0:L.from)??null;Q([K?{type:"create_node",text:i.sibling,parentId:K}:{type:"create_node",text:i.newNode}])}}}},y=Y=>{Y.code==="Space"&&(W.current.space=!1),Y.key==="Alt"&&(W.current.alt=!1)};return window.addEventListener("keydown",b),window.addEventListener("keyup",y),()=>{window.removeEventListener("keydown",b),window.removeEventListener("keyup",y)}},[Q,O,N,h,g,ut,Ne,Na,H.zoom,i]);const Xi=Nn??(Ot==="pan"||W.current.space?"grab":Ot==="link"?"crosshair":"default");return v.jsxs("div",{className:`canvas-host${ut?" is-locked":""}`,ref:f,style:{cursor:Xi},onWheel:b=>{b.preventDefault();const y=b.deltaY>0?.9:1.1;vt(Y=>({...Y,zoom:Math.min(4,Math.max(.02,Y.zoom*y))}))},onPointerDown:b=>{var L;const y=b.target;if((L=y==null?void 0:y.closest)!=null&&L.call(y,".canvas-toolbar, .canvas-controls, .canvas-minimap, .edit-overlay, .node-handles, .hover-card, .inspector"))return;const Y=be(b.clientX,b.clientY),q=Fe(Y.x,Y.y);if(W.current.lastX=b.clientX,W.current.lastY=b.clientY,W.current.startX=b.clientX,W.current.startY=b.clientY,W.current.moved=!1,W.current.alt=b.altKey,W.current.forcePin=b.ctrlKey||b.metaKey,W.current.startWorldX=Y.x,W.current.startWorldY=Y.y,W.current.subtreeIds=[],b.currentTarget.setPointerCapture(b.pointerId),Ot==="pan"||W.current.space||b.button===1||b.button===2||!q&&Ot!=="link"){W.current.mode="pan",W.current.nodeId=null,q||lt([]),Me("grabbing");return}if(ut){lt(q?[q]:[]),W.current.mode="none";return}if(q&&(Ot==="link"||b.altKey)){W.current.mode="link",W.current.nodeId=q,lt([q]),ft({fromId:q,x:Y.x,y:Y.y});return}if(q&&Ot==="select"){W.current.mode="node",W.current.nodeId=q;const K=b.shiftKey||$t==="node";W.current.subtreeIds=K?[q]:es(q,g),lt([q]);return}W.current.mode="pan",Me("grabbing")},onPointerMove:b=>{let y=be(b.clientX,b.clientY);const Y=b.clientX-W.current.startX,q=b.clientY-W.current.startY;if(Math.hypot(Y,q)>4&&(W.current.moved=!0),W.current.mode==="pan"){const V=b.clientX-W.current.lastX,L=b.clientY-W.current.lastY;W.current.lastX=b.clientX,W.current.lastY=b.clientY,vt(K=>({...K,x:K.x+V,y:K.y+L}));return}if(W.current.mode==="link"&&W.current.nodeId){ft({fromId:W.current.nodeId,x:y.x,y:y.y});return}if(W.current.mode==="node"&&W.current.nodeId&&W.current.moved){const V=W.current.nodeId,L=f.current;if(L){const B=L.getBoundingClientRect(),Dt=48;let Vt=0,bt=0;b.clientXB.right-Dt&&(Vt=-12),b.clientYB.bottom-Dt&&(bt=-12),(Vt||bt)&&(vt(Ft=>({...Ft,x:Ft.x+Vt,y:Ft.y+bt})),W.current.startWorldX+=Vt/H.zoom,W.current.startWorldY+=bt/H.zoom,y=be(b.clientX,b.clientY))}const K=y.x-W.current.startWorldX,dt=y.y-W.current.startWorldY,Xt=W.current.subtreeIds.length>0?W.current.subtreeIds:es(V,g);if(cl({rootId:V,dx:K,dy:dt,ids:Xt}),Me("grabbing"),W.current.forcePin=b.ctrlKey||b.metaKey,W.current.forcePin){oe(null),Ee(!1),Z(null);return}const Rt=new Set(Xt),ll=Fe(y.x,y.y,Rt);if(Z(ll),ll&&ll!==V){const B=rh(ll,V,g);oe(ll),Ee(B)}else oe(null),Ee(!1)}},onPointerUp:b=>{var dt;const y=be(b.clientX,b.clientY),Y=W.current.mode,q=W.current.nodeId,V=W.current.moved,L=On.current,K=W.current.forcePin||b.ctrlKey||b.metaKey;if(!ut&&Y==="link"&&q){const Xt=Fe(y.x,y.y);Xt&&Xt!==q&&Q([{type:"link",from:q,to:Xt,kind:"relation",label:i.relationLabel}]),ft(null)}else if(!ut&&Y==="node"&&q&&V&&L){const Xt=new Set(L.ids),Rt=K||$e?null:Fe(y.x,y.y,Xt);if(Rt&&Rt!==q&&!rh(Rt,q,g)&&Rt){const B=(((dt=M[Rt])==null?void 0:dt.x)??0)<=0?-1:1,Dt={...M};for(const Vt of L.ids){const bt=M[Vt];bt&&(Dt[Vt]={x:bt.x+L.dx,y:bt.y+L.dy})}I({positions:Dt}),cl(null),Q([{type:"move_node",nodeId:q,newParentId:Rt,sidePref:B}])}else{const B={...M},Dt=[],Vt=p.map(bt=>{if(!Xt.has(bt.id))return bt;const Ft=M[bt.id];if(!Ft)return bt;const Zt={x:Ft.x+L.dx,y:Ft.y+L.dy};return B[bt.id]=Zt,Dt.push({type:"set_pinned",nodeId:bt.id,pinned:!0,pos:Zt}),{...bt,pinned:!0,pos:Zt}});I({positions:B,nodes:Vt}),cl(null),Q(Dt,"drag pin")}}else Y==="node"&&q&&!V&<([q]);W.current.mode="none",W.current.nodeId=null,W.current.forcePin=!1,W.current.subtreeIds=[],ft(null),cl(null),oe(null),Ee(!1),Me(null)},onContextMenu:b=>b.preventDefault(),onDoubleClick:b=>{if(ut)return;const y=be(b.clientX,b.clientY),Y=Fe(y.x,y.y);if(Y){const q=p.find(K=>K.id===Y),V=f.current.getBoundingClientRect(),L=Bl(Y);U({id:Y,text:q.text,x:V.width/2+H.x+L.x*H.zoom-70,y:V.height/2+H.y+L.y*H.zoom-16})}else Ot==="select"&&Q([{type:"create_node",text:i.newNode,...N[0]?{parentId:N[0]}:{},sidePref:y.x<0?-1:1}])},children:[v.jsx("canvas",{ref:o}),v.jsxs("div",{className:"canvas-toolbar",role:"toolbar","aria-label":i.toolbarAria,onPointerDown:b=>b.stopPropagation(),children:[el?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"canvas-toolbar__group",children:v.jsx("button",{type:"button",className:"canvas-tool-btn",title:i.backRosterTitle,onClick:Qt,children:i.backRoster})}),v.jsx("div",{className:"canvas-toolbar__sep"})]}):null,v.jsx("div",{className:"canvas-toolbar__group",children:[["select",i.toolSelect,"V"],["pan",i.toolPan,"H"],["link",i.toolLink,"C"]].map(([b,y,Y])=>v.jsx("button",{type:"button",className:`canvas-tool-btn${Ot===b?" is-active":""}`,title:`${y} (${Y})`,"aria-pressed":Ot===b,onClick:()=>Ol(b),children:y},b))}),v.jsx("div",{className:"canvas-toolbar__sep"}),v.jsxs("div",{className:"canvas-toolbar__group",children:[v.jsx("button",{type:"button",className:`canvas-tool-btn${$t==="node"?" is-active":""}`,title:i.dragNodeTitle,"aria-pressed":$t==="node",onClick:()=>Kt("node"),children:i.dragNode}),v.jsx("button",{type:"button",className:`canvas-tool-btn${$t==="branch"?" is-active":""}`,title:i.dragBranchTitle,"aria-pressed":$t==="branch",onClick:()=>Kt("branch"),children:i.dragBranch})]}),v.jsx("div",{className:"canvas-toolbar__sep"}),v.jsxs("div",{className:"canvas-toolbar__group",children:[v.jsx("button",{type:"button",className:`canvas-tool-btn${al?"":" is-active"}`,title:i.bubbleTitle,"aria-pressed":!al,disabled:ut,onClick:()=>{al&&k({nodeViewMode:"bubble"})},children:i.bubble}),v.jsx("button",{type:"button",className:`canvas-tool-btn${al?" is-active":""}`,title:i.cardTitle,"aria-pressed":al,disabled:ut,onClick:()=>{al||k({nodeViewMode:"card"})},children:i.card}),v.jsx("button",{type:"button",className:"canvas-tool-btn",title:i.unpinTitle,disabled:ut||!N[0]||!((Mu=p.find(b=>b.id===N[0]))!=null&&Mu.pinned),onClick:()=>{N[0]&&Q([{type:"set_pinned",nodeId:N[0],pinned:!1}])},children:i.unpin})]}),v.jsx("div",{className:"canvas-toolbar__sep"}),v.jsx("div",{className:"canvas-toolbar__group",children:v.jsx("button",{type:"button",className:"canvas-tool-btn",title:i.undo,disabled:!yt,onClick:()=>void Nt(),children:i.undo})}),v.jsxs("span",{className:"canvas-toolbar__zoom",children:[Math.round(H.zoom*100),"%"]})]}),v.jsxs("div",{className:"canvas-controls",role:"toolbar","aria-label":i.controlsAria,onPointerDown:b=>b.stopPropagation(),children:[v.jsx("button",{type:"button",className:"canvas-controls__btn",title:ol?i.exitFullscreen:i.fullscreen,"aria-label":ol?i.exitFullscreen:i.fullscreen,onClick:()=>void nt(),children:v.jsx(Ry,{exit:ol})}),v.jsx("button",{type:"button",className:"canvas-controls__btn",title:i.zoomInTitle,"aria-label":i.zoomIn,onClick:()=>Na(H.zoom*1.2),children:v.jsx(Hy,{})}),v.jsx("button",{type:"button",className:"canvas-controls__btn",title:i.zoomOutTitle,"aria-label":i.zoomOut,onClick:()=>Na(H.zoom/1.2),children:v.jsx(By,{})}),v.jsx("button",{type:"button",className:"canvas-controls__btn",title:i.fitTitle,"aria-label":i.fit,onClick:Ne,children:v.jsx(Yy,{})}),v.jsx("button",{type:"button",className:`canvas-controls__btn${ut?" is-active":""}`,title:ut?i.unlockTitle:i.lockTitle,"aria-label":ut?i.unlock:i.lock,"aria-pressed":ut,onClick:()=>Dl(b=>!b),children:v.jsx(wy,{locked:ut})})]}),v.jsx("div",{className:"canvas-minimap",onPointerDown:b=>{b.stopPropagation(),We.current=!0,b.currentTarget.setPointerCapture(b.pointerId),xl(b.clientX,b.clientY)},onPointerMove:b=>{We.current&&xl(b.clientX,b.clientY)},onPointerUp:()=>{We.current=!1},onPointerCancel:()=>{We.current=!1},children:v.jsx("canvas",{ref:r,width:Za,height:Ka})}),h&&v.jsx("input",{className:"edit-overlay",style:{left:h.x,top:h.y},autoFocus:!0,value:h.text,onChange:b=>U({...h,text:b.target.value}),onBlur:()=>{Q([{type:"update_text",nodeId:h.id,text:h.text}]),U(null)},onKeyDown:b=>{b.key==="Enter"&&b.target.blur(),b.key==="Escape"&&U(null)}}),!ut&&N[0]&&!ot&&M[N[0]]&&(()=>{const b=N[0],y=p.find(Rt=>Rt.id===b);if(!y||y.deletedAt)return null;const Y=M[b],{w:q}=nl(y),V=Ul.w/2+H.x+Y.x*H.zoom,L=Ul.h/2+H.y+Y.y*H.zoom,K=q/2*H.zoom,dt=Vl?100:140,Xt=Rt=>{const ll=Rt<0?i.leftChild:i.rightChild,B=Vl?160:200;Q([{type:"create_node",text:ll,parentId:b,sidePref:Rt,pos:{x:Y.x+Rt*(q/2+B/2+dt),y:Y.y}}])};return v.jsxs("div",{className:"node-handles",onPointerDown:Rt=>Rt.stopPropagation(),children:[v.jsx("button",{type:"button",className:"node-handle node-handle--left",style:{left:V-K-14,top:L-10},title:i.addLeftChildTitle,onClick:()=>Xt(-1),children:"+"}),v.jsx("button",{type:"button",className:"node-handle node-handle--right",style:{left:V+K-2,top:L-10},title:i.addRightChildTitle,onClick:()=>Xt(1),children:"+"})]})})(),(O==null?void 0:O.prefs.showHoverCard)!==!1&&X&&!ot&&!al&&(()=>{const b=p.find(L=>L.id===X);if(!b)return null;const y=b?M[b.id]:null;if(!y)return null;const{h:Y}=nl(b),q=Ul.w/2+H.x+y.x*H.zoom+12,V=Ul.h/2+H.y+y.y*H.zoom+Y/2*H.zoom+8;return v.jsx(Ay,{node:b,x:q,y:V})})(),!ut&&!ot&&al&&N[0]&&H.zoom>=.35&&(()=>{const b=N[0],y=p.find(K=>K.id===b);if(!y||y.deletedAt)return null;const Y=M[b];if(!Y)return null;const{w:q}=nl(y),V=Ul.w/2+H.x+Y.x*H.zoom,L=Ul.h/2+H.y+Y.y*H.zoom;return v.jsx(oy,{node:y,applyOps:Q,screenX:V,screenY:L,zoom:H.zoom,width:q,accent:re.get(b),showStylePreset:!1})})(),v.jsx("div",{className:"canvas-hint muted",children:ut?i.hintLocked:$t==="node"?i.hintNodeDrag:i.hintBranchDrag})]})}function Ry({exit:i}){return i?v.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:v.jsx("path",{fill:"currentColor",d:"M7 14H5v5h5v-2H7v-3zm12 0h-2v3h-3v2h5v-5zM7 5h3V3H5v5h2V5zm10 0v3h2V3h-5v2h3z"})}):v.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:v.jsx("path",{fill:"currentColor",d:"M7 14H5v5h5v-2H7v-3zm0-9h3V3H5v5h2V5zm12 9h-2v3h-3v2h5v-5zm-2-9V3h-3v2h3v3h2V5h-2z"})})}function Hy(){return v.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:v.jsx("path",{fill:"currentColor",d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"})})}function By(){return v.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:v.jsx("path",{fill:"currentColor",d:"M19 13H5v-2h14v2z"})})}function Yy(){return v.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:v.jsx("path",{fill:"currentColor",d:"M3 5v4h2V7h2V5H3zm0 10v4h4v-2H5v-2H3zm14-10v2h2v2h2V5h-4zm4 10h-2v2h-2v2h4v-4zM7 9h10v6H7V9z"})})}function wy({locked:i}){return i?v.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:v.jsx("path",{fill:"currentColor",d:"M12 17a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm6-7h-1V7a5 5 0 0 0-10 0v3H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2zM9 7a3 3 0 0 1 6 0v3H9V7z"})}):v.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:v.jsx("path",{fill:"currentColor",d:"M12 17a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm6-7h-1V7a5 5 0 0 0-9.9-1h2.1A3 3 0 0 1 15 7v3H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2z"})})}function qy(){try{return new URLSearchParams(window.location.search)}catch{return new URLSearchParams}}function Xy(){const i=$.useMemo(()=>qy(),[]),o=i.get("embed")==="1"||i.get("embed")==="true",r=i.get("canvasId")||"",{canvases:f,canvasId:p,canvas:g,nodes:M,selectedIds:N,leftCollapsed:C,loadCanvases:S,createCanvas:w,openCanvas:O,undo:Q,setCollapsedPanels:k,setPrefs:I,applyOps:lt,trash:Nt,restoreFromTrash:yt}=_t();$.useEffect(()=>{Sy()},[]),$.useEffect(()=>{(async()=>{if(await S(),r){await O(r);return}_t.getState().canvasId||await w("未命名画布")})()},[S,w,O,r]),$.useEffect(()=>{const nt=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`;let H=null,vt=!1,P,Ut,Ot=800;const Ol=(Kt,ut)=>{window.clearTimeout(Ut),Ut=window.setTimeout(async()=>{if(_t.getState().canvasId===Kt)try{const Dl=await fetch(`/api/canvases/${Kt}`).then(ol=>ol.json());_t.getState().applyCanvasPayload(Dl,{preserveUnpinned:ut})}catch{_t.getState().openCanvas(Kt)}},120)},$t=()=>{if(!vt){try{H=new WebSocket(nt)}catch{P=window.setTimeout($t,Ot),Ot=Math.min(8e3,Ot*1.6);return}H.onopen=()=>{Ot=800},H.onmessage=Kt=>{try{const ut=JSON.parse(String(Kt.data));if(ut.type==="canvas/event"&&ut.canvasId&&ut.canvasId===_t.getState().canvasId&&(ut.fitViewport&&_t.getState().requestFitViewport(ut.fitViewport),Ol(ut.canvasId,ut.preserveUnpinned===!0)),ut.type==="canvas/highlight"&&ut.canvasId&&ut.canvasId===_t.getState().canvasId){const Dl=Array.isArray(ut.nodeIds)?ut.nodeIds:[],ol=Array.isArray(ut.edgeIds)?ut.edgeIds:[];_t.getState().flashHighlight({nodeIds:Dl,edgeIds:ol,style:ut.style&&typeof ut.style=="object"?ut.style:null,ttlMs:typeof ut.ttlMs=="number"?ut.ttlMs:ol.length?5e3:2200})}}catch{}},H.onclose=()=>{vt||(P=window.setTimeout($t,Ot),Ot=Math.min(8e3,Ot*1.6))},H.onerror=()=>{try{H==null||H.close()}catch{}}}};return $t(),()=>{vt=!0,window.clearTimeout(P),window.clearTimeout(Ut);try{H==null||H.close()}catch{}}},[]),$.useEffect(()=>{const nt=p;if(!nt)return;const H=window.setTimeout(()=>{fetch(`/api/canvases/${nt}/activity`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({selectionIds:N,focusNodeId:(g==null?void 0:g.focusNodeId)??null,viewport:(g==null?void 0:g.viewport)??{x:0,y:0,zoom:1}})})},200);return()=>window.clearTimeout(H)},[p,N,g==null?void 0:g.focusNodeId,g==null?void 0:g.viewport]);const el=g==null?void 0:g.focusNodeId,Qt=M.filter(nt=>!nt.deletedAt);return o?v.jsx("div",{className:"app-shell embed",children:v.jsx("div",{className:"main embed-main",children:v.jsx(dh,{})})}):v.jsxs("div",{className:"app-shell",children:[v.jsxs("header",{className:"topbar",children:[v.jsx("div",{className:"brand",children:"Mind Map"}),v.jsx("button",{type:"button",onClick:()=>k("left",!C),children:C?"目录":"收目录"}),v.jsx("button",{type:"button",onClick:()=>void w(),children:"新建"}),v.jsx("button",{type:"button",onClick:()=>void Q(),disabled:!_t.getState().lastChangeSetId,children:"撤销"}),v.jsxs("button",{type:"button",onClick:()=>void I({density:(g==null?void 0:g.prefs.density)==="compact"?"comfortable":"compact"}),children:["密度: ",(g==null?void 0:g.prefs.density)??"comfortable"]}),v.jsxs("button",{type:"button",onClick:()=>void I({branchColoring:!((g==null?void 0:g.prefs.branchColoring)??!0)}),children:["分色: ",(g==null?void 0:g.prefs.branchColoring)===!1?"关":"开"]}),v.jsxs("button",{type:"button",onClick:()=>void I({nodeViewMode:(g==null?void 0:g.prefs.nodeViewMode)!=="bubble"?"bubble":"card"}),children:["模式: ",(g==null?void 0:g.prefs.nodeViewMode)!=="bubble"?"卡片":"气泡"]}),v.jsx("button",{type:"button",onClick:()=>{const nt=p;nt&&fetch(`/api/canvases/${nt}/export.json`).then(H=>H.json()).then(H=>{const vt=new Blob([JSON.stringify(H,null,2)],{type:"application/json"}),P=document.createElement("a");P.href=URL.createObjectURL(vt),P.download=`${(g==null?void 0:g.title)??"mindmap"}.json`,P.click()})},children:"导出JSON"}),v.jsx("button",{type:"button",onClick:()=>{const nt=document.querySelector(".canvas-host canvas");nt&&nt.toBlob(H=>{if(!H)return;const vt=document.createElement("a");vt.href=URL.createObjectURL(H),vt.download=`${(g==null?void 0:g.title)??"mindmap"}.png`,vt.click()})},children:"导出PNG"}),v.jsx("div",{className:"spacer"})]}),v.jsxs("div",{className:`main ${C?"left-collapsed":""}`,children:[v.jsxs("aside",{className:"panel",style:{display:C?"none":void 0},children:[v.jsx("div",{className:"panel-header",children:"目录"}),v.jsxs("div",{className:"panel-body",children:[v.jsx("div",{className:"muted",style:{marginBottom:8},children:"画布"}),f.map(nt=>v.jsx("div",{className:`canvas-list-item ${nt.id===p?"active":""}`,onClick:()=>void O(nt.id),children:nt.title},nt.id)),v.jsx("div",{className:"muted",style:{margin:"12px 0 8px"},children:"大纲"}),Qt.map(nt=>v.jsxs("div",{className:`outline-item ${N.includes(nt.id)?"active":""}`,onClick:()=>{_t.getState().setSelection([nt.id]),lt([{type:"set_focus",nodeId:nt.id}])},children:[nt.id===el?"◎ ":"• ",nt.text]},nt.id)),v.jsx("div",{className:"muted",style:{margin:"12px 0 8px"},children:"属性"}),v.jsx(vy,{}),v.jsxs("div",{className:"muted",style:{margin:"12px 0 8px"},children:["回收站 (",Nt.length,")"]}),Nt.length===0&&v.jsx("div",{className:"muted",children:"空"}),Nt.map(nt=>v.jsxs("div",{className:"trash-item",children:[v.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:nt.text}),v.jsx("button",{type:"button",onClick:()=>void yt(nt.id),children:"恢复"})]},nt.id))]})]}),v.jsx(dh,{})]})]})}w0.createRoot(document.getElementById("root")).render(v.jsx(Xy,{}));