@origintrail-official/dkg-node-ui 10.0.6 → 10.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +50 -50
  3. package/dist/chain-cursor-stores.js +6 -6
  4. package/dist/chat-memory.js +209 -209
  5. package/dist/db.d.ts +127 -1
  6. package/dist/db.d.ts.map +1 -1
  7. package/dist/db.js +1356 -675
  8. package/dist/db.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist-ui/assets/{3d-force-graph-Beyt80PS.js → 3d-force-graph-BOxtBjdk.js} +1 -1
  13. package/dist-ui/assets/{AgentHub-BGlM0TkX.js → AgentHub-BwBMYiaM.js} +1 -1
  14. package/dist-ui/assets/{AgentProfilePage-BK2nv-IH.js → AgentProfilePage-Bufz0Md_.js} +1 -1
  15. package/dist-ui/assets/{ApproveWalletsModal-CZrl51Kn.js → ApproveWalletsModal-B8bQTpiR.js} +3 -3
  16. package/dist-ui/assets/{ConvictionDetailView-CP2aS_DI.js → ConvictionDetailView-CiwcbT2W.js} +1 -1
  17. package/dist-ui/assets/{Network-DiXYe0aB.js → Network-C8AvmIfL.js} +1 -1
  18. package/dist-ui/assets/{OnChainProvenanceCard-BykYhleb.js → OnChainProvenanceCard-Dga51ZJL.js} +1 -1
  19. package/dist-ui/assets/{Operations-Cgg0jP9m.js → Operations-BhRo3Qzg.js} +1 -1
  20. package/dist-ui/assets/{PublishingConviction-DGtPr9Cs.js → PublishingConviction-DzvXFq9z.js} +1 -1
  21. package/dist-ui/assets/{Settings-dSId2mSF.js → Settings-CwO6V6er.js} +1 -1
  22. package/dist-ui/assets/{ccip-DUvYIt92.js → ccip-BxPhmAn8.js} +1 -1
  23. package/dist-ui/assets/{index-DOIKXU1s.js → index-BTD4QwAm.js} +3 -3
  24. package/dist-ui/assets/index-Btc8omeP.js +1661 -0
  25. package/dist-ui/assets/{jsonld-32FQRO67-XkBT-pPz.js → jsonld-B67IUHNU-Xa0S85WB.js} +2 -2
  26. package/dist-ui/assets/{jsonld-BQ18nHYe.js → jsonld-DzfKKFxR.js} +1 -1
  27. package/dist-ui/assets/{renderer-3d-2EVDZII7-DlPF04Rl.js → renderer-3d-OSESAPET-xkehb8k9.js} +2 -2
  28. package/dist-ui/assets/{shikiHighlighter-BhEVT05C.js → shikiHighlighter-DRJC8bc5.js} +1 -1
  29. package/dist-ui/index.html +13 -13
  30. package/package.json +3 -3
  31. package/dist-ui/assets/index-DJH2KcPG.js +0 -1661
  32. /package/dist-ui/assets/{ntriples-ZWBY2WET-DH7OofPp.js → ntriples-SF2LFNMC-DH7OofPp.js} +0 -0
  33. /package/dist-ui/assets/{turtle-JJPK7LJ5-BzTu0283.js → turtle-BXN4L2BY-BzTu0283.js} +0 -0
@@ -0,0 +1,1661 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BTD4QwAm.js","assets/ordinal-DhEzRPdO.js","assets/OnChainProvenanceCard-Dga51ZJL.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/Operations-BhRo3Qzg.js","assets/PublishingConviction-DzvXFq9z.js","assets/ApproveWalletsModal-B8bQTpiR.js","assets/ConvictionDetailView-CiwcbT2W.js"])))=>i.map(i=>d[i]);
2
+ var nA=Object.defineProperty;var rA=(e,t,n)=>t in e?nA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Sn=(e,t,n)=>rA(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function a(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();var kG=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function SG(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function a(){return this instanceof a?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}),n}var oh={exports:{}},pl={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var xx;function aA(){if(xx)return pl;xx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,s,l){var u=null;if(l!==void 0&&(u=""+l),s.key!==void 0&&(u=""+s.key),"key"in s){l={};for(var d in s)d!=="key"&&(l[d]=s[d])}else l=s;return s=l.ref,{$$typeof:e,type:a,key:u,ref:s!==void 0?s:null,props:l}}return pl.Fragment=t,pl.jsx=n,pl.jsxs=n,pl}var wx;function iA(){return wx||(wx=1,oh.exports=aA()),oh.exports}var o=iA(),lh={exports:{}},Ge={};/**
11
+ * @license React
12
+ * react.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var kx;function sA(){if(kx)return Ge;kx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function b(U){return U===null||typeof U!="object"?null:(U=y&&U[y]||U["@@iterator"],typeof U=="function"?U:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function S(U,G,O){this.props=U,this.context=G,this.refs=N,this.updater=O||k}S.prototype.isReactComponent={},S.prototype.setState=function(U,G){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,G,"setState")},S.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function T(){}T.prototype=S.prototype;function E(U,G,O){this.props=U,this.context=G,this.refs=N,this.updater=O||k}var A=E.prototype=new T;A.constructor=E,j(A,S.prototype),A.isPureReactComponent=!0;var B=Array.isArray;function _(){}var z={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function M(U,G,O){var ne=O.ref;return{$$typeof:e,type:U,key:G,ref:ne!==void 0?ne:null,props:O}}function R(U,G){return M(U.type,G,U.props)}function P(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function F(U){var G={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(O){return G[O]})}var Z=/\/+/g;function I(U,G){return typeof U=="object"&&U!==null&&U.key!=null?F(""+U.key):G.toString(36)}function $(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(_,_):(U.status="pending",U.then(function(G){U.status==="pending"&&(U.status="fulfilled",U.value=G)},function(G){U.status==="pending"&&(U.status="rejected",U.reason=G)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function H(U,G,O,ne,ue){var le=typeof U;(le==="undefined"||le==="boolean")&&(U=null);var be=!1;if(U===null)be=!0;else switch(le){case"bigint":case"string":case"number":be=!0;break;case"object":switch(U.$$typeof){case e:case t:be=!0;break;case g:return be=U._init,H(be(U._payload),G,O,ne,ue)}}if(be)return ue=ue(U),be=ne===""?"."+I(U,0):ne,B(ue)?(O="",be!=null&&(O=be.replace(Z,"$&/")+"/"),H(ue,G,O,"",function(Ie){return Ie})):ue!=null&&(P(ue)&&(ue=R(ue,O+(ue.key==null||U&&U.key===ue.key?"":(""+ue.key).replace(Z,"$&/")+"/")+be)),G.push(ue)),1;be=0;var _e=ne===""?".":ne+":";if(B(U))for(var Ee=0;Ee<U.length;Ee++)ne=U[Ee],le=_e+I(ne,Ee),be+=H(ne,G,O,le,ue);else if(Ee=b(U),typeof Ee=="function")for(U=Ee.call(U),Ee=0;!(ne=U.next()).done;)ne=ne.value,le=_e+I(ne,Ee++),be+=H(ne,G,O,le,ue);else if(le==="object"){if(typeof U.then=="function")return H($(U),G,O,ne,ue);throw G=String(U),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return be}function V(U,G,O){if(U==null)return U;var ne=[],ue=0;return H(U,ne,"","",function(le){return G.call(O,le,ue++)}),ne}function X(U){if(U._status===-1){var G=U._result;G=G(),G.then(function(O){(U._status===0||U._status===-1)&&(U._status=1,U._result=O)},function(O){(U._status===0||U._status===-1)&&(U._status=2,U._result=O)}),U._status===-1&&(U._status=0,U._result=G)}if(U._status===1)return U._result.default;throw U._result}var Y=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},L={map:V,forEach:function(U,G,O){V(U,function(){G.apply(this,arguments)},O)},count:function(U){var G=0;return V(U,function(){G++}),G},toArray:function(U){return V(U,function(G){return G})||[]},only:function(U){if(!P(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Ge.Activity=m,Ge.Children=L,Ge.Component=S,Ge.Fragment=n,Ge.Profiler=s,Ge.PureComponent=E,Ge.StrictMode=a,Ge.Suspense=f,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(U){return z.H.useMemoCache(U)}},Ge.cache=function(U){return function(){return U.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(U,G,O){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var ne=j({},U.props),ue=U.key;if(G!=null)for(le in G.key!==void 0&&(ue=""+G.key),G)!q.call(G,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&G.ref===void 0||(ne[le]=G[le]);var le=arguments.length-2;if(le===1)ne.children=O;else if(1<le){for(var be=Array(le),_e=0;_e<le;_e++)be[_e]=arguments[_e+2];ne.children=be}return M(U.type,ue,ne)},Ge.createContext=function(U){return U={$$typeof:u,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:l,_context:U},U},Ge.createElement=function(U,G,O){var ne,ue={},le=null;if(G!=null)for(ne in G.key!==void 0&&(le=""+G.key),G)q.call(G,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(ue[ne]=G[ne]);var be=arguments.length-2;if(be===1)ue.children=O;else if(1<be){for(var _e=Array(be),Ee=0;Ee<be;Ee++)_e[Ee]=arguments[Ee+2];ue.children=_e}if(U&&U.defaultProps)for(ne in be=U.defaultProps,be)ue[ne]===void 0&&(ue[ne]=be[ne]);return M(U,le,ue)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(U){return{$$typeof:d,render:U}},Ge.isValidElement=P,Ge.lazy=function(U){return{$$typeof:g,_payload:{_status:-1,_result:U},_init:X}},Ge.memo=function(U,G){return{$$typeof:h,type:U,compare:G===void 0?null:G}},Ge.startTransition=function(U){var G=z.T,O={};z.T=O;try{var ne=U(),ue=z.S;ue!==null&&ue(O,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(_,Y)}catch(le){Y(le)}finally{G!==null&&O.types!==null&&(G.types=O.types),z.T=G}},Ge.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ge.use=function(U){return z.H.use(U)},Ge.useActionState=function(U,G,O){return z.H.useActionState(U,G,O)},Ge.useCallback=function(U,G){return z.H.useCallback(U,G)},Ge.useContext=function(U){return z.H.useContext(U)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(U,G){return z.H.useDeferredValue(U,G)},Ge.useEffect=function(U,G){return z.H.useEffect(U,G)},Ge.useEffectEvent=function(U){return z.H.useEffectEvent(U)},Ge.useId=function(){return z.H.useId()},Ge.useImperativeHandle=function(U,G,O){return z.H.useImperativeHandle(U,G,O)},Ge.useInsertionEffect=function(U,G){return z.H.useInsertionEffect(U,G)},Ge.useLayoutEffect=function(U,G){return z.H.useLayoutEffect(U,G)},Ge.useMemo=function(U,G){return z.H.useMemo(U,G)},Ge.useOptimistic=function(U,G){return z.H.useOptimistic(U,G)},Ge.useReducer=function(U,G,O){return z.H.useReducer(U,G,O)},Ge.useRef=function(U){return z.H.useRef(U)},Ge.useState=function(U){return z.H.useState(U)},Ge.useSyncExternalStore=function(U,G,O){return z.H.useSyncExternalStore(U,G,O)},Ge.useTransition=function(){return z.H.useTransition()},Ge.version="19.2.4",Ge}var Sx;function dg(){return Sx||(Sx=1,lh.exports=sA()),lh.exports}var w=dg();const Ve=Wl(w);var ch={exports:{}},fl={},uh={exports:{}},dh={};/**
19
+ * @license React
20
+ * scheduler.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var jx;function oA(){return jx||(jx=1,(function(e){function t(H,V){var X=H.length;H.push(V);e:for(;0<X;){var Y=X-1>>>1,L=H[Y];if(0<s(L,V))H[Y]=V,H[X]=L,X=Y;else break e}}function n(H){return H.length===0?null:H[0]}function a(H){if(H.length===0)return null;var V=H[0],X=H.pop();if(X!==V){H[0]=X;e:for(var Y=0,L=H.length,U=L>>>1;Y<U;){var G=2*(Y+1)-1,O=H[G],ne=G+1,ue=H[ne];if(0>s(O,X))ne<L&&0>s(ue,O)?(H[Y]=ue,H[ne]=X,Y=ne):(H[Y]=O,H[G]=X,Y=G);else if(ne<L&&0>s(ue,X))H[Y]=ue,H[ne]=X,Y=ne;else break e}}return V}function s(H,V){var X=H.sortIndex-V.sortIndex;return X!==0?X:H.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var f=[],h=[],g=1,m=null,y=3,b=!1,k=!1,j=!1,N=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function A(H){for(var V=n(h);V!==null;){if(V.callback===null)a(h);else if(V.startTime<=H)a(h),V.sortIndex=V.expirationTime,t(f,V);else break;V=n(h)}}function B(H){if(j=!1,A(H),!k)if(n(f)!==null)k=!0,_||(_=!0,F());else{var V=n(h);V!==null&&$(B,V.startTime-H)}}var _=!1,z=-1,q=5,M=-1;function R(){return N?!0:!(e.unstable_now()-M<q)}function P(){if(N=!1,_){var H=e.unstable_now();M=H;var V=!0;try{e:{k=!1,j&&(j=!1,T(z),z=-1),b=!0;var X=y;try{t:{for(A(H),m=n(f);m!==null&&!(m.expirationTime>H&&R());){var Y=m.callback;if(typeof Y=="function"){m.callback=null,y=m.priorityLevel;var L=Y(m.expirationTime<=H);if(H=e.unstable_now(),typeof L=="function"){m.callback=L,A(H),V=!0;break t}m===n(f)&&a(f),A(H)}else a(f);m=n(f)}if(m!==null)V=!0;else{var U=n(h);U!==null&&$(B,U.startTime-H),V=!1}}break e}finally{m=null,y=X,b=!1}V=void 0}}finally{V?F():_=!1}}}var F;if(typeof E=="function")F=function(){E(P)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,I=Z.port2;Z.port1.onmessage=P,F=function(){I.postMessage(null)}}else F=function(){S(P,0)};function $(H,V){z=S(function(){H(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(H){switch(y){case 1:case 2:case 3:var V=3;break;default:V=y}var X=y;y=V;try{return H()}finally{y=X}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(H,V){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var X=y;y=H;try{return V()}finally{y=X}},e.unstable_scheduleCallback=function(H,V,X){var Y=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?Y+X:Y):X=Y,H){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=X+L,H={id:g++,callback:V,priorityLevel:H,startTime:X,expirationTime:L,sortIndex:-1},X>Y?(H.sortIndex=X,t(h,H),n(f)===null&&H===n(h)&&(j?(T(z),z=-1):j=!0,$(B,X-Y))):(H.sortIndex=L,t(f,H),k||b||(k=!0,_||(_=!0,F()))),H},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(H){var V=y;return function(){var X=y;y=V;try{return H.apply(this,arguments)}finally{y=X}}}})(dh)),dh}var Cx;function lA(){return Cx||(Cx=1,uh.exports=oA()),uh.exports}var ph={exports:{}},En={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var Nx;function cA(){if(Nx)return En;Nx=1;var e=dg();function t(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function l(f,h,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:m==null?null:""+m,children:f,containerInfo:h,implementation:g}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,h){if(f==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return En.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,En.createPortal=function(f,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return l(f,h,null,g)},En.flushSync=function(f){var h=u.T,g=a.p;try{if(u.T=null,a.p=2,f)return f()}finally{u.T=h,a.p=g,a.d.f()}},En.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,a.d.C(f,h))},En.prefetchDNS=function(f){typeof f=="string"&&a.d.D(f)},En.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var g=h.as,m=d(g,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?a.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:b}):g==="script"&&a.d.X(f,{crossOrigin:m,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},En.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=d(h.as,h.crossOrigin);a.d.M(f,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(f)},En.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,m=d(g,h.crossOrigin);a.d.L(f,g,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},En.preloadModule=function(f,h){if(typeof f=="string")if(h){var g=d(h.as,h.crossOrigin);a.d.m(f,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(f)},En.requestFormReset=function(f){a.d.r(f)},En.unstable_batchedUpdates=function(f,h){return f(h)},En.useFormState=function(f,h,g){return u.H.useFormState(f,h,g)},En.useFormStatus=function(){return u.H.useHostTransitionStatus()},En.version="19.2.4",En}var Ex;function Qk(){if(Ex)return ph.exports;Ex=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ph.exports=cA(),ph.exports}/**
35
+ * @license React
36
+ * react-dom-client.production.js
37
+ *
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */var Tx;function uA(){if(Tx)return fl;Tx=1;var e=lA(),t=dg(),n=Qk();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)i+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var i=r,c=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(c=i.return),r=i.return;while(r)}return i.tag===3?c:null}function u(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function d(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(l(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=l(r),i===null)throw Error(a(188));return i!==r?null:r}for(var c=r,p=i;;){var v=c.return;if(v===null)break;var x=v.alternate;if(x===null){if(p=v.return,p!==null){c=p;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===c)return f(v),r;if(x===p)return f(v),i;x=x.sibling}throw Error(a(188))}if(c.return!==p.return)c=v,p=x;else{for(var C=!1,D=v.child;D;){if(D===c){C=!0,c=v,p=x;break}if(D===p){C=!0,p=v,c=x;break}D=D.sibling}if(!C){for(D=x.child;D;){if(D===c){C=!0,c=x,p=v;break}if(D===p){C=!0,p=x,c=v;break}D=D.sibling}if(!C)throw Error(a(189))}}if(c.alternate!==p)throw Error(a(190))}if(c.tag!==3)throw Error(a(188));return c.stateNode.current===c?r:i}function g(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=g(r),i!==null)return i;r=r.sibling}return null}var m=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),E=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function F(r){return r===null||typeof r!="object"?null:(r=P&&r[P]||r["@@iterator"],typeof r=="function"?r:null)}var Z=Symbol.for("react.client.reference");function I(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===Z?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case j:return"Fragment";case S:return"Profiler";case N:return"StrictMode";case B:return"Suspense";case _:return"SuspenseList";case M:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case k:return"Portal";case E:return r.displayName||"Context";case T:return(r._context.displayName||"Context")+".Consumer";case A:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case z:return i=r.displayName||null,i!==null?i:I(r.type)||"Memo";case q:i=r._payload,r=r._init;try{return I(r(i))}catch{}}return null}var $=Array.isArray,H=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},Y=[],L=-1;function U(r){return{current:r}}function G(r){0>L||(r.current=Y[L],Y[L]=null,L--)}function O(r,i){L++,Y[L]=r.current,r.current=i}var ne=U(null),ue=U(null),le=U(null),be=U(null);function _e(r,i){switch(O(le,i),O(ue,r),O(ne,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?H0(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=H0(i),r=q0(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}G(ne),O(ne,r)}function Ee(){G(ne),G(ue),G(le)}function Ie(r){r.memoizedState!==null&&O(be,r);var i=ne.current,c=q0(i,r.type);i!==c&&(O(ue,r),O(ne,c))}function We(r){ue.current===r&&(G(ne),G(ue)),be.current===r&&(G(be),ll._currentValue=X)}var Se,ft;function De(r){if(Se===void 0)try{throw Error()}catch(c){var i=c.stack.trim().match(/\n( *(at )?)/);Se=i&&i[1]||"",ft=-1<c.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+Se+r+ft}var qe=!1;function ke(r,i){if(!r||qe)return"";qe=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(i){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(oe){var se=oe}Reflect.construct(r,[],me)}else{try{me.call()}catch(oe){se=oe}r.call(me.prototype)}}else{try{throw Error()}catch(oe){se=oe}(me=r())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(oe){if(oe&&se&&typeof oe.stack=="string")return[oe.stack,se.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=p.DetermineComponentFrameRoot(),C=x[0],D=x[1];if(C&&D){var K=C.split(`
45
+ `),ae=D.split(`
46
+ `);for(v=p=0;p<K.length&&!K[p].includes("DetermineComponentFrameRoot");)p++;for(;v<ae.length&&!ae[v].includes("DetermineComponentFrameRoot");)v++;if(p===K.length||v===ae.length)for(p=K.length-1,v=ae.length-1;1<=p&&0<=v&&K[p]!==ae[v];)v--;for(;1<=p&&0<=v;p--,v--)if(K[p]!==ae[v]){if(p!==1||v!==1)do if(p--,v--,0>v||K[p]!==ae[v]){var pe=`
47
+ `+K[p].replace(" at new "," at ");return r.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",r.displayName)),pe}while(1<=p&&0<=v);break}}}finally{qe=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?De(c):""}function lt(r,i){switch(r.tag){case 26:case 27:case 5:return De(r.type);case 16:return De("Lazy");case 13:return r.child!==i&&i!==null?De("Suspense Fallback"):De("Suspense");case 19:return De("SuspenseList");case 0:case 15:return ke(r.type,!1);case 11:return ke(r.type.render,!1);case 1:return ke(r.type,!0);case 31:return De("Activity");default:return""}}function xe(r){try{var i="",c=null;do i+=lt(r,c),c=r,r=r.return;while(r);return i}catch(p){return`
48
+ Error generating stack: `+p.message+`
49
+ `+p.stack}}var Oe=Object.prototype.hasOwnProperty,Ot=e.unstable_scheduleCallback,$t=e.unstable_cancelCallback,Yt=e.unstable_shouldYield,qt=e.unstable_requestPaint,ut=e.unstable_now,ye=e.unstable_getCurrentPriorityLevel,Q=e.unstable_ImmediatePriority,W=e.unstable_UserBlockingPriority,ee=e.unstable_NormalPriority,ce=e.unstable_LowPriority,he=e.unstable_IdlePriority,Le=e.log,He=e.unstable_setDisableYieldValue,Ce=null,Fe=null;function et(r){if(typeof Le=="function"&&He(r),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(Ce,r)}catch{}}var Ne=Math.clz32?Math.clz32:Hr,Wt=Math.log,_t=Math.LN2;function Hr(r){return r>>>=0,r===0?32:31-(Wt(r)/_t|0)|0}var dr=256,Fa=262144,Ha=4194304;function pr(r){var i=r&42;if(i!==0)return i;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function qr(r,i,c){var p=r.pendingLanes;if(p===0)return 0;var v=0,x=r.suspendedLanes,C=r.pingedLanes;r=r.warmLanes;var D=p&134217727;return D!==0?(p=D&~x,p!==0?v=pr(p):(C&=D,C!==0?v=pr(C):c||(c=D&~r,c!==0&&(v=pr(c))))):(D=p&~x,D!==0?v=pr(D):C!==0?v=pr(C):c||(c=p&~r,c!==0&&(v=pr(c)))),v===0?0:i!==0&&i!==v&&(i&x)===0&&(x=v&-v,c=i&-i,x>=c||x===32&&(c&4194048)!==0)?i:v}function ca(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function ic(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 qa(){var r=Ha;return Ha<<=1,(Ha&62914560)===0&&(Ha=4194304),r}function Ci(r){for(var i=[],c=0;31>c;c++)i.push(r);return i}function ge(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Me(r,i,c,p,v,x){var C=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var D=r.entanglements,K=r.expirationTimes,ae=r.hiddenUpdates;for(c=C&~c;0<c;){var pe=31-Ne(c),me=1<<pe;D[pe]=0,K[pe]=-1;var se=ae[pe];if(se!==null)for(ae[pe]=null,pe=0;pe<se.length;pe++){var oe=se[pe];oe!==null&&(oe.lane&=-536870913)}c&=~me}p!==0&&de(r,p,0),x!==0&&v===0&&r.tag!==0&&(r.suspendedLanes|=x&~(C&~i))}function de(r,i,c){r.pendingLanes|=i,r.suspendedLanes&=~i;var p=31-Ne(i);r.entangledLanes|=i,r.entanglements[p]=r.entanglements[p]|1073741824|c&261930}function je(r,i){var c=r.entangledLanes|=i;for(r=r.entanglements;c;){var p=31-Ne(c),v=1<<p;v&i|r[p]&i&&(r[p]|=i),c&=~v}}function Te(r,i){var c=i&-i;return c=(c&42)!==0?1:tt(c),(c&(r.suspendedLanes|i))!==0?0:c}function tt(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Je(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Ke(){var r=V.p;return r!==0?r:(r=window.event,r===void 0?32:fx(r.type))}function pt(r,i){var c=V.p;try{return V.p=r,i()}finally{V.p=c}}var mn=Math.random().toString(36).slice(2),Gt="__reactFiber$"+mn,un="__reactProps$"+mn,ua="__reactContainer$"+mn,da="__reactEvents$"+mn,ps="__reactListeners$"+mn,Kn="__reactHandles$"+mn,fr="__reactResources$"+mn,Or="__reactMarker$"+mn;function Ga(r){delete r[Gt],delete r[un],delete r[da],delete r[ps],delete r[Kn]}function gn(r){var i=r[Gt];if(i)return i;for(var c=r.parentNode;c;){if(i=c[ua]||c[Gt]){if(c=i.alternate,i.child!==null||c!==null&&c.child!==null)for(r=Q0(r);r!==null;){if(c=r[Gt])return c;r=Q0(r)}return i}r=c,c=r.parentNode}return null}function Nn(r){if(r=r[Gt]||r[ua]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function pa(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function hr(r){var i=r[fr];return i||(i=r[fr]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Lt(r){r[Or]=!0}var jo=new Set,sc={};function mr(r,i){fa(r,i),fa(r+"Capture",i)}function fa(r,i){for(sc[r]=i,r=0;r<i.length;r++)jo.add(i[r])}var tn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),gr={},Gr={};function ZN(r){return Oe.call(Gr,r)?!0:Oe.call(gr,r)?!1:tn.test(r)?Gr[r]=!0:(gr[r]=!0,!1)}function oc(r,i,c){if(ZN(i))if(c===null)r.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var p=i.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+c)}}function lc(r,i,c){if(c===null)r.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+c)}}function ha(r,i,c,p){if(p===null)r.removeAttribute(c);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(i,c,""+p)}}function vr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Dv(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function KN(r,i,c){var p=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var v=p.get,x=p.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return v.call(this)},set:function(C){c=""+C,x.call(this,C)}}),Object.defineProperty(r,i,{enumerable:p.enumerable}),{getValue:function(){return c},setValue:function(C){c=""+C},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Jd(r){if(!r._valueTracker){var i=Dv(r)?"checked":"value";r._valueTracker=KN(r,i,""+r[i])}}function zv(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var c=i.getValue(),p="";return r&&(p=Dv(r)?r.checked?"true":"false":r.value),r=p,r!==c?(i.setValue(r),!0):!1}function cc(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var YN=/[\n"\\]/g;function yr(r){return r.replace(YN,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function ep(r,i,c,p,v,x,C,D){r.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?r.type=C:r.removeAttribute("type"),i!=null?C==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+vr(i)):r.value!==""+vr(i)&&(r.value=""+vr(i)):C!=="submit"&&C!=="reset"||r.removeAttribute("value"),i!=null?tp(r,C,vr(i)):c!=null?tp(r,C,vr(c)):p!=null&&r.removeAttribute("value"),v==null&&x!=null&&(r.defaultChecked=!!x),v!=null&&(r.checked=v&&typeof v!="function"&&typeof v!="symbol"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?r.name=""+vr(D):r.removeAttribute("name")}function $v(r,i,c,p,v,x,C,D){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(r.type=x),i!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||i!=null)){Jd(r);return}c=c!=null?""+vr(c):"",i=i!=null?""+vr(i):c,D||i===r.value||(r.value=i),r.defaultValue=i}p=p??v,p=typeof p!="function"&&typeof p!="symbol"&&!!p,r.checked=D?r.checked:!!p,r.defaultChecked=!!p,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(r.name=C),Jd(r)}function tp(r,i,c){i==="number"&&cc(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function fs(r,i,c,p){if(r=r.options,i){i={};for(var v=0;v<c.length;v++)i["$"+c[v]]=!0;for(c=0;c<r.length;c++)v=i.hasOwnProperty("$"+r[c].value),r[c].selected!==v&&(r[c].selected=v),v&&p&&(r[c].defaultSelected=!0)}else{for(c=""+vr(c),i=null,v=0;v<r.length;v++){if(r[v].value===c){r[v].selected=!0,p&&(r[v].defaultSelected=!0);return}i!==null||r[v].disabled||(i=r[v])}i!==null&&(i.selected=!0)}}function Iv(r,i,c){if(i!=null&&(i=""+vr(i),i!==r.value&&(r.value=i),c==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=c!=null?""+vr(c):""}function Pv(r,i,c,p){if(i==null){if(p!=null){if(c!=null)throw Error(a(92));if($(p)){if(1<p.length)throw Error(a(93));p=p[0]}c=p}c==null&&(c=""),i=c}c=vr(i),r.defaultValue=c,p=r.textContent,p===c&&p!==""&&p!==null&&(r.value=p),Jd(r)}function hs(r,i){if(i){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=i;return}}r.textContent=i}var QN=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Uv(r,i,c){var p=i.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?p?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":p?r.setProperty(i,c):typeof c!="number"||c===0||QN.has(i)?i==="float"?r.cssFloat=c:r[i]=(""+c).trim():r[i]=c+"px"}function Bv(r,i,c){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,c!=null){for(var p in c)!c.hasOwnProperty(p)||i!=null&&i.hasOwnProperty(p)||(p.indexOf("--")===0?r.setProperty(p,""):p==="float"?r.cssFloat="":r[p]="");for(var v in i)p=i[v],i.hasOwnProperty(v)&&c[v]!==p&&Uv(r,v,p)}else for(var x in i)i.hasOwnProperty(x)&&Uv(r,x,i[x])}function np(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var XN=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),JN=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function uc(r){return JN.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function ma(){}var rp=null;function ap(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ms=null,gs=null;function Fv(r){var i=Nn(r);if(i&&(r=i.stateNode)){var c=r[un]||null;e:switch(r=i.stateNode,i.type){case"input":if(ep(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),i=c.name,c.type==="radio"&&i!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+yr(""+i)+'"][type="radio"]'),i=0;i<c.length;i++){var p=c[i];if(p!==r&&p.form===r.form){var v=p[un]||null;if(!v)throw Error(a(90));ep(p,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(i=0;i<c.length;i++)p=c[i],p.form===r.form&&zv(p)}break e;case"textarea":Iv(r,c.value,c.defaultValue);break e;case"select":i=c.value,i!=null&&fs(r,!!c.multiple,i,!1)}}}var ip=!1;function Hv(r,i,c){if(ip)return r(i,c);ip=!0;try{var p=r(i);return p}finally{if(ip=!1,(ms!==null||gs!==null)&&(Qc(),ms&&(i=ms,r=gs,gs=ms=null,Fv(i),r)))for(i=0;i<r.length;i++)Fv(r[i])}}function Co(r,i){var c=r.stateNode;if(c===null)return null;var p=c[un]||null;if(p===null)return null;c=p[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(r=r.type,p=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!p;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(a(231,i,typeof c));return c}var ga=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sp=!1;if(ga)try{var No={};Object.defineProperty(No,"passive",{get:function(){sp=!0}}),window.addEventListener("test",No,No),window.removeEventListener("test",No,No)}catch{sp=!1}var Va=null,op=null,dc=null;function qv(){if(dc)return dc;var r,i=op,c=i.length,p,v="value"in Va?Va.value:Va.textContent,x=v.length;for(r=0;r<c&&i[r]===v[r];r++);var C=c-r;for(p=1;p<=C&&i[c-p]===v[x-p];p++);return dc=v.slice(r,1<p?1-p:void 0)}function pc(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function fc(){return!0}function Gv(){return!1}function In(r){function i(c,p,v,x,C){this._reactName=c,this._targetInst=v,this.type=p,this.nativeEvent=x,this.target=C,this.currentTarget=null;for(var D in r)r.hasOwnProperty(D)&&(c=r[D],this[D]=c?c(x):x[D]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?fc:Gv,this.isPropagationStopped=Gv,this}return m(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=fc)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=fc)},persist:function(){},isPersistent:fc}),i}var Ni={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hc=In(Ni),Eo=m({},Ni,{view:0,detail:0}),eE=In(Eo),lp,cp,To,mc=m({},Eo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dp,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==To&&(To&&r.type==="mousemove"?(lp=r.screenX-To.screenX,cp=r.screenY-To.screenY):cp=lp=0,To=r),lp)},movementY:function(r){return"movementY"in r?r.movementY:cp}}),Vv=In(mc),tE=m({},mc,{dataTransfer:0}),nE=In(tE),rE=m({},Eo,{relatedTarget:0}),up=In(rE),aE=m({},Ni,{animationName:0,elapsedTime:0,pseudoElement:0}),iE=In(aE),sE=m({},Ni,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),oE=In(sE),lE=m({},Ni,{data:0}),Wv=In(lE),cE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uE={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},dE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pE(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=dE[r])?!!i[r]:!1}function dp(){return pE}var fE=m({},Eo,{key:function(r){if(r.key){var i=cE[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=pc(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?uE[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dp,charCode:function(r){return r.type==="keypress"?pc(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?pc(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),hE=In(fE),mE=m({},mc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Zv=In(mE),gE=m({},Eo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dp}),vE=In(gE),yE=m({},Ni,{propertyName:0,elapsedTime:0,pseudoElement:0}),bE=In(yE),xE=m({},mc,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),wE=In(xE),kE=m({},Ni,{newState:0,oldState:0}),SE=In(kE),jE=[9,13,27,32],pp=ga&&"CompositionEvent"in window,Ao=null;ga&&"documentMode"in document&&(Ao=document.documentMode);var CE=ga&&"TextEvent"in window&&!Ao,Kv=ga&&(!pp||Ao&&8<Ao&&11>=Ao),Yv=" ",Qv=!1;function Xv(r,i){switch(r){case"keyup":return jE.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jv(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var vs=!1;function NE(r,i){switch(r){case"compositionend":return Jv(i);case"keypress":return i.which!==32?null:(Qv=!0,Yv);case"textInput":return r=i.data,r===Yv&&Qv?null:r;default:return null}}function EE(r,i){if(vs)return r==="compositionend"||!pp&&Xv(r,i)?(r=qv(),dc=op=Va=null,vs=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Kv&&i.locale!=="ko"?null:i.data;default:return null}}var TE={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ey(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!TE[r.type]:i==="textarea"}function ty(r,i,c,p){ms?gs?gs.push(p):gs=[p]:ms=p,i=au(i,"onChange"),0<i.length&&(c=new hc("onChange","change",null,c,p),r.push({event:c,listeners:i}))}var _o=null,Ro=null;function AE(r){$0(r,0)}function gc(r){var i=pa(r);if(zv(i))return r}function ny(r,i){if(r==="change")return i}var ry=!1;if(ga){var fp;if(ga){var hp="oninput"in document;if(!hp){var ay=document.createElement("div");ay.setAttribute("oninput","return;"),hp=typeof ay.oninput=="function"}fp=hp}else fp=!1;ry=fp&&(!document.documentMode||9<document.documentMode)}function iy(){_o&&(_o.detachEvent("onpropertychange",sy),Ro=_o=null)}function sy(r){if(r.propertyName==="value"&&gc(Ro)){var i=[];ty(i,Ro,r,ap(r)),Hv(AE,i)}}function _E(r,i,c){r==="focusin"?(iy(),_o=i,Ro=c,_o.attachEvent("onpropertychange",sy)):r==="focusout"&&iy()}function RE(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return gc(Ro)}function OE(r,i){if(r==="click")return gc(i)}function LE(r,i){if(r==="input"||r==="change")return gc(i)}function ME(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var Yn=typeof Object.is=="function"?Object.is:ME;function Oo(r,i){if(Yn(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var c=Object.keys(r),p=Object.keys(i);if(c.length!==p.length)return!1;for(p=0;p<c.length;p++){var v=c[p];if(!Oe.call(i,v)||!Yn(r[v],i[v]))return!1}return!0}function oy(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function ly(r,i){var c=oy(r);r=0;for(var p;c;){if(c.nodeType===3){if(p=r+c.textContent.length,r<=i&&p>=i)return{node:c,offset:i-r};r=p}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=oy(c)}}function cy(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?cy(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function uy(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=cc(r.document);i instanceof r.HTMLIFrameElement;){try{var c=typeof i.contentWindow.location.href=="string"}catch{c=!1}if(c)r=i.contentWindow;else break;i=cc(r.document)}return i}function mp(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var DE=ga&&"documentMode"in document&&11>=document.documentMode,ys=null,gp=null,Lo=null,vp=!1;function dy(r,i,c){var p=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;vp||ys==null||ys!==cc(p)||(p=ys,"selectionStart"in p&&mp(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Lo&&Oo(Lo,p)||(Lo=p,p=au(gp,"onSelect"),0<p.length&&(i=new hc("onSelect","select",null,i,c),r.push({event:i,listeners:p}),i.target=ys)))}function Ei(r,i){var c={};return c[r.toLowerCase()]=i.toLowerCase(),c["Webkit"+r]="webkit"+i,c["Moz"+r]="moz"+i,c}var bs={animationend:Ei("Animation","AnimationEnd"),animationiteration:Ei("Animation","AnimationIteration"),animationstart:Ei("Animation","AnimationStart"),transitionrun:Ei("Transition","TransitionRun"),transitionstart:Ei("Transition","TransitionStart"),transitioncancel:Ei("Transition","TransitionCancel"),transitionend:Ei("Transition","TransitionEnd")},yp={},py={};ga&&(py=document.createElement("div").style,"AnimationEvent"in window||(delete bs.animationend.animation,delete bs.animationiteration.animation,delete bs.animationstart.animation),"TransitionEvent"in window||delete bs.transitionend.transition);function Ti(r){if(yp[r])return yp[r];if(!bs[r])return r;var i=bs[r],c;for(c in i)if(i.hasOwnProperty(c)&&c in py)return yp[r]=i[c];return r}var fy=Ti("animationend"),hy=Ti("animationiteration"),my=Ti("animationstart"),zE=Ti("transitionrun"),$E=Ti("transitionstart"),IE=Ti("transitioncancel"),gy=Ti("transitionend"),vy=new Map,bp="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");bp.push("scrollEnd");function Lr(r,i){vy.set(r,i),mr(i,[r])}var vc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},br=[],xs=0,xp=0;function yc(){for(var r=xs,i=xp=xs=0;i<r;){var c=br[i];br[i++]=null;var p=br[i];br[i++]=null;var v=br[i];br[i++]=null;var x=br[i];if(br[i++]=null,p!==null&&v!==null){var C=p.pending;C===null?v.next=v:(v.next=C.next,C.next=v),p.pending=v}x!==0&&yy(c,v,x)}}function bc(r,i,c,p){br[xs++]=r,br[xs++]=i,br[xs++]=c,br[xs++]=p,xp|=p,r.lanes|=p,r=r.alternate,r!==null&&(r.lanes|=p)}function wp(r,i,c,p){return bc(r,i,c,p),xc(r)}function Ai(r,i){return bc(r,null,null,i),xc(r)}function yy(r,i,c){r.lanes|=c;var p=r.alternate;p!==null&&(p.lanes|=c);for(var v=!1,x=r.return;x!==null;)x.childLanes|=c,p=x.alternate,p!==null&&(p.childLanes|=c),x.tag===22&&(r=x.stateNode,r===null||r._visibility&1||(v=!0)),r=x,x=x.return;return r.tag===3?(x=r.stateNode,v&&i!==null&&(v=31-Ne(c),r=x.hiddenUpdates,p=r[v],p===null?r[v]=[i]:p.push(i),i.lane=c|536870912),x):null}function xc(r){if(50<tl)throw tl=0,Rf=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var ws={};function PE(r,i,c,p){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qn(r,i,c,p){return new PE(r,i,c,p)}function kp(r){return r=r.prototype,!(!r||!r.isReactComponent)}function va(r,i){var c=r.alternate;return c===null?(c=Qn(r.tag,i,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=i,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,i=r.dependencies,c.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function by(r,i){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,i=c.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function wc(r,i,c,p,v,x){var C=0;if(p=r,typeof r=="function")kp(r)&&(C=1);else if(typeof r=="string")C=qT(r,c,ne.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case M:return r=Qn(31,c,i,v),r.elementType=M,r.lanes=x,r;case j:return _i(c.children,v,x,i);case N:C=8,v|=24;break;case S:return r=Qn(12,c,i,v|2),r.elementType=S,r.lanes=x,r;case B:return r=Qn(13,c,i,v),r.elementType=B,r.lanes=x,r;case _:return r=Qn(19,c,i,v),r.elementType=_,r.lanes=x,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case E:C=10;break e;case T:C=9;break e;case A:C=11;break e;case z:C=14;break e;case q:C=16,p=null;break e}C=29,c=Error(a(130,r===null?"null":typeof r,"")),p=null}return i=Qn(C,c,i,v),i.elementType=r,i.type=p,i.lanes=x,i}function _i(r,i,c,p){return r=Qn(7,r,p,i),r.lanes=c,r}function Sp(r,i,c){return r=Qn(6,r,null,i),r.lanes=c,r}function xy(r){var i=Qn(18,null,null,0);return i.stateNode=r,i}function jp(r,i,c){return i=Qn(4,r.children!==null?r.children:[],r.key,i),i.lanes=c,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var wy=new WeakMap;function xr(r,i){if(typeof r=="object"&&r!==null){var c=wy.get(r);return c!==void 0?c:(i={value:r,source:i,stack:xe(i)},wy.set(r,i),i)}return{value:r,source:i,stack:xe(i)}}var ks=[],Ss=0,kc=null,Mo=0,wr=[],kr=0,Wa=null,Vr=1,Wr="";function ya(r,i){ks[Ss++]=Mo,ks[Ss++]=kc,kc=r,Mo=i}function ky(r,i,c){wr[kr++]=Vr,wr[kr++]=Wr,wr[kr++]=Wa,Wa=r;var p=Vr;r=Wr;var v=32-Ne(p)-1;p&=~(1<<v),c+=1;var x=32-Ne(i)+v;if(30<x){var C=v-v%5;x=(p&(1<<C)-1).toString(32),p>>=C,v-=C,Vr=1<<32-Ne(i)+v|c<<v|p,Wr=x+r}else Vr=1<<x|c<<v|p,Wr=r}function Cp(r){r.return!==null&&(ya(r,1),ky(r,1,0))}function Np(r){for(;r===kc;)kc=ks[--Ss],ks[Ss]=null,Mo=ks[--Ss],ks[Ss]=null;for(;r===Wa;)Wa=wr[--kr],wr[kr]=null,Wr=wr[--kr],wr[kr]=null,Vr=wr[--kr],wr[kr]=null}function Sy(r,i){wr[kr++]=Vr,wr[kr++]=Wr,wr[kr++]=Wa,Vr=i.id,Wr=i.overflow,Wa=r}var bn=null,Mt=null,ct=!1,Za=null,Sr=!1,Ep=Error(a(519));function Ka(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Do(xr(i,r)),Ep}function jy(r){var i=r.stateNode,c=r.type,p=r.memoizedProps;switch(i[Gt]=r,i[un]=p,c){case"dialog":rt("cancel",i),rt("close",i);break;case"iframe":case"object":case"embed":rt("load",i);break;case"video":case"audio":for(c=0;c<rl.length;c++)rt(rl[c],i);break;case"source":rt("error",i);break;case"img":case"image":case"link":rt("error",i),rt("load",i);break;case"details":rt("toggle",i);break;case"input":rt("invalid",i),$v(i,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":rt("invalid",i);break;case"textarea":rt("invalid",i),Pv(i,p.value,p.defaultValue,p.children)}c=p.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||i.textContent===""+c||p.suppressHydrationWarning===!0||B0(i.textContent,c)?(p.popover!=null&&(rt("beforetoggle",i),rt("toggle",i)),p.onScroll!=null&&rt("scroll",i),p.onScrollEnd!=null&&rt("scrollend",i),p.onClick!=null&&(i.onclick=ma),i=!0):i=!1,i||Ka(r,!0)}function Cy(r){for(bn=r.return;bn;)switch(bn.tag){case 5:case 31:case 13:Sr=!1;return;case 27:case 3:Sr=!0;return;default:bn=bn.return}}function js(r){if(r!==bn)return!1;if(!ct)return Cy(r),ct=!0,!1;var i=r.tag,c;if((c=i!==3&&i!==27)&&((c=i===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||Vf(r.type,r.memoizedProps)),c=!c),c&&Mt&&Ka(r),Cy(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Mt=Y0(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Mt=Y0(r)}else i===27?(i=Mt,ci(r.type)?(r=Qf,Qf=null,Mt=r):Mt=i):Mt=bn?Cr(r.stateNode.nextSibling):null;return!0}function Ri(){Mt=bn=null,ct=!1}function Tp(){var r=Za;return r!==null&&(Fn===null?Fn=r:Fn.push.apply(Fn,r),Za=null),r}function Do(r){Za===null?Za=[r]:Za.push(r)}var Ap=U(null),Oi=null,ba=null;function Ya(r,i,c){O(Ap,i._currentValue),i._currentValue=c}function xa(r){r._currentValue=Ap.current,G(Ap)}function _p(r,i,c){for(;r!==null;){var p=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,p!==null&&(p.childLanes|=i)):p!==null&&(p.childLanes&i)!==i&&(p.childLanes|=i),r===c)break;r=r.return}}function Rp(r,i,c,p){var v=r.child;for(v!==null&&(v.return=r);v!==null;){var x=v.dependencies;if(x!==null){var C=v.child;x=x.firstContext;e:for(;x!==null;){var D=x;x=v;for(var K=0;K<i.length;K++)if(D.context===i[K]){x.lanes|=c,D=x.alternate,D!==null&&(D.lanes|=c),_p(x.return,c,r),p||(C=null);break e}x=D.next}}else if(v.tag===18){if(C=v.return,C===null)throw Error(a(341));C.lanes|=c,x=C.alternate,x!==null&&(x.lanes|=c),_p(C,c,r),C=null}else C=v.child;if(C!==null)C.return=v;else for(C=v;C!==null;){if(C===r){C=null;break}if(v=C.sibling,v!==null){v.return=C.return,C=v;break}C=C.return}v=C}}function Cs(r,i,c,p){r=null;for(var v=i,x=!1;v!==null;){if(!x){if((v.flags&524288)!==0)x=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var C=v.alternate;if(C===null)throw Error(a(387));if(C=C.memoizedProps,C!==null){var D=v.type;Yn(v.pendingProps.value,C.value)||(r!==null?r.push(D):r=[D])}}else if(v===be.current){if(C=v.alternate,C===null)throw Error(a(387));C.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(r!==null?r.push(ll):r=[ll])}v=v.return}r!==null&&Rp(i,r,c,p),i.flags|=262144}function Sc(r){for(r=r.firstContext;r!==null;){if(!Yn(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Li(r){Oi=r,ba=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function xn(r){return Ny(Oi,r)}function jc(r,i){return Oi===null&&Li(r),Ny(r,i)}function Ny(r,i){var c=i._currentValue;if(i={context:i,memoizedValue:c,next:null},ba===null){if(r===null)throw Error(a(308));ba=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else ba=ba.next=i;return c}var UE=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(c,p){r.push(p)}};this.abort=function(){i.aborted=!0,r.forEach(function(c){return c()})}},BE=e.unstable_scheduleCallback,FE=e.unstable_NormalPriority,nn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Op(){return{controller:new UE,data:new Map,refCount:0}}function zo(r){r.refCount--,r.refCount===0&&BE(FE,function(){r.controller.abort()})}var $o=null,Lp=0,Ns=0,Es=null;function HE(r,i){if($o===null){var c=$o=[];Lp=0,Ns=$f(),Es={status:"pending",value:void 0,then:function(p){c.push(p)}}}return Lp++,i.then(Ey,Ey),i}function Ey(){if(--Lp===0&&$o!==null){Es!==null&&(Es.status="fulfilled");var r=$o;$o=null,Ns=0,Es=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function qE(r,i){var c=[],p={status:"pending",value:null,reason:null,then:function(v){c.push(v)}};return r.then(function(){p.status="fulfilled",p.value=i;for(var v=0;v<c.length;v++)(0,c[v])(i)},function(v){for(p.status="rejected",p.reason=v,v=0;v<c.length;v++)(0,c[v])(void 0)}),p}var Ty=H.S;H.S=function(r,i){d0=ut(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&HE(r,i),Ty!==null&&Ty(r,i)};var Mi=U(null);function Mp(){var r=Mi.current;return r!==null?r:Et.pooledCache}function Cc(r,i){i===null?O(Mi,Mi.current):O(Mi,i.pool)}function Ay(){var r=Mp();return r===null?null:{parent:nn._currentValue,pool:r}}var Ts=Error(a(460)),Dp=Error(a(474)),Nc=Error(a(542)),Ec={then:function(){}};function _y(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Ry(r,i,c){switch(c=r[c],c===void 0?r.push(i):c!==i&&(i.then(ma,ma),i=c),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Ly(r),r;default:if(typeof i.status=="string")i.then(ma,ma);else{if(r=Et,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(p){if(i.status==="pending"){var v=i;v.status="fulfilled",v.value=p}},function(p){if(i.status==="pending"){var v=i;v.status="rejected",v.reason=p}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Ly(r),r}throw zi=i,Ts}}function Di(r){try{var i=r._init;return i(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(zi=c,Ts):c}}var zi=null;function Oy(){if(zi===null)throw Error(a(459));var r=zi;return zi=null,r}function Ly(r){if(r===Ts||r===Nc)throw Error(a(483))}var As=null,Io=0;function Tc(r){var i=Io;return Io+=1,As===null&&(As=[]),Ry(As,r,i)}function Po(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function Ac(r,i){throw i.$$typeof===y?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function My(r){function i(te,J){if(r){var re=te.deletions;re===null?(te.deletions=[J],te.flags|=16):re.push(J)}}function c(te,J){if(!r)return null;for(;J!==null;)i(te,J),J=J.sibling;return null}function p(te){for(var J=new Map;te!==null;)te.key!==null?J.set(te.key,te):J.set(te.index,te),te=te.sibling;return J}function v(te,J){return te=va(te,J),te.index=0,te.sibling=null,te}function x(te,J,re){return te.index=re,r?(re=te.alternate,re!==null?(re=re.index,re<J?(te.flags|=67108866,J):re):(te.flags|=67108866,J)):(te.flags|=1048576,J)}function C(te){return r&&te.alternate===null&&(te.flags|=67108866),te}function D(te,J,re,fe){return J===null||J.tag!==6?(J=Sp(re,te.mode,fe),J.return=te,J):(J=v(J,re),J.return=te,J)}function K(te,J,re,fe){var ze=re.type;return ze===j?pe(te,J,re.props.children,fe,re.key):J!==null&&(J.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===q&&Di(ze)===J.type)?(J=v(J,re.props),Po(J,re),J.return=te,J):(J=wc(re.type,re.key,re.props,null,te.mode,fe),Po(J,re),J.return=te,J)}function ae(te,J,re,fe){return J===null||J.tag!==4||J.stateNode.containerInfo!==re.containerInfo||J.stateNode.implementation!==re.implementation?(J=jp(re,te.mode,fe),J.return=te,J):(J=v(J,re.children||[]),J.return=te,J)}function pe(te,J,re,fe,ze){return J===null||J.tag!==7?(J=_i(re,te.mode,fe,ze),J.return=te,J):(J=v(J,re),J.return=te,J)}function me(te,J,re){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=Sp(""+J,te.mode,re),J.return=te,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return re=wc(J.type,J.key,J.props,null,te.mode,re),Po(re,J),re.return=te,re;case k:return J=jp(J,te.mode,re),J.return=te,J;case q:return J=Di(J),me(te,J,re)}if($(J)||F(J))return J=_i(J,te.mode,re,null),J.return=te,J;if(typeof J.then=="function")return me(te,Tc(J),re);if(J.$$typeof===E)return me(te,jc(te,J),re);Ac(te,J)}return null}function se(te,J,re,fe){var ze=J!==null?J.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return ze!==null?null:D(te,J,""+re,fe);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case b:return re.key===ze?K(te,J,re,fe):null;case k:return re.key===ze?ae(te,J,re,fe):null;case q:return re=Di(re),se(te,J,re,fe)}if($(re)||F(re))return ze!==null?null:pe(te,J,re,fe,null);if(typeof re.then=="function")return se(te,J,Tc(re),fe);if(re.$$typeof===E)return se(te,J,jc(te,re),fe);Ac(te,re)}return null}function oe(te,J,re,fe,ze){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return te=te.get(re)||null,D(J,te,""+fe,ze);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case b:return te=te.get(fe.key===null?re:fe.key)||null,K(J,te,fe,ze);case k:return te=te.get(fe.key===null?re:fe.key)||null,ae(J,te,fe,ze);case q:return fe=Di(fe),oe(te,J,re,fe,ze)}if($(fe)||F(fe))return te=te.get(re)||null,pe(J,te,fe,ze,null);if(typeof fe.then=="function")return oe(te,J,re,Tc(fe),ze);if(fe.$$typeof===E)return oe(te,J,re,jc(J,fe),ze);Ac(J,fe)}return null}function Ae(te,J,re,fe){for(var ze=null,ht=null,Re=J,Qe=J=0,ot=null;Re!==null&&Qe<re.length;Qe++){Re.index>Qe?(ot=Re,Re=null):ot=Re.sibling;var mt=se(te,Re,re[Qe],fe);if(mt===null){Re===null&&(Re=ot);break}r&&Re&&mt.alternate===null&&i(te,Re),J=x(mt,J,Qe),ht===null?ze=mt:ht.sibling=mt,ht=mt,Re=ot}if(Qe===re.length)return c(te,Re),ct&&ya(te,Qe),ze;if(Re===null){for(;Qe<re.length;Qe++)Re=me(te,re[Qe],fe),Re!==null&&(J=x(Re,J,Qe),ht===null?ze=Re:ht.sibling=Re,ht=Re);return ct&&ya(te,Qe),ze}for(Re=p(Re);Qe<re.length;Qe++)ot=oe(Re,te,Qe,re[Qe],fe),ot!==null&&(r&&ot.alternate!==null&&Re.delete(ot.key===null?Qe:ot.key),J=x(ot,J,Qe),ht===null?ze=ot:ht.sibling=ot,ht=ot);return r&&Re.forEach(function(hi){return i(te,hi)}),ct&&ya(te,Qe),ze}function Be(te,J,re,fe){if(re==null)throw Error(a(151));for(var ze=null,ht=null,Re=J,Qe=J=0,ot=null,mt=re.next();Re!==null&&!mt.done;Qe++,mt=re.next()){Re.index>Qe?(ot=Re,Re=null):ot=Re.sibling;var hi=se(te,Re,mt.value,fe);if(hi===null){Re===null&&(Re=ot);break}r&&Re&&hi.alternate===null&&i(te,Re),J=x(hi,J,Qe),ht===null?ze=hi:ht.sibling=hi,ht=hi,Re=ot}if(mt.done)return c(te,Re),ct&&ya(te,Qe),ze;if(Re===null){for(;!mt.done;Qe++,mt=re.next())mt=me(te,mt.value,fe),mt!==null&&(J=x(mt,J,Qe),ht===null?ze=mt:ht.sibling=mt,ht=mt);return ct&&ya(te,Qe),ze}for(Re=p(Re);!mt.done;Qe++,mt=re.next())mt=oe(Re,te,Qe,mt.value,fe),mt!==null&&(r&&mt.alternate!==null&&Re.delete(mt.key===null?Qe:mt.key),J=x(mt,J,Qe),ht===null?ze=mt:ht.sibling=mt,ht=mt);return r&&Re.forEach(function(tA){return i(te,tA)}),ct&&ya(te,Qe),ze}function Ct(te,J,re,fe){if(typeof re=="object"&&re!==null&&re.type===j&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case b:e:{for(var ze=re.key;J!==null;){if(J.key===ze){if(ze=re.type,ze===j){if(J.tag===7){c(te,J.sibling),fe=v(J,re.props.children),fe.return=te,te=fe;break e}}else if(J.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===q&&Di(ze)===J.type){c(te,J.sibling),fe=v(J,re.props),Po(fe,re),fe.return=te,te=fe;break e}c(te,J);break}else i(te,J);J=J.sibling}re.type===j?(fe=_i(re.props.children,te.mode,fe,re.key),fe.return=te,te=fe):(fe=wc(re.type,re.key,re.props,null,te.mode,fe),Po(fe,re),fe.return=te,te=fe)}return C(te);case k:e:{for(ze=re.key;J!==null;){if(J.key===ze)if(J.tag===4&&J.stateNode.containerInfo===re.containerInfo&&J.stateNode.implementation===re.implementation){c(te,J.sibling),fe=v(J,re.children||[]),fe.return=te,te=fe;break e}else{c(te,J);break}else i(te,J);J=J.sibling}fe=jp(re,te.mode,fe),fe.return=te,te=fe}return C(te);case q:return re=Di(re),Ct(te,J,re,fe)}if($(re))return Ae(te,J,re,fe);if(F(re)){if(ze=F(re),typeof ze!="function")throw Error(a(150));return re=ze.call(re),Be(te,J,re,fe)}if(typeof re.then=="function")return Ct(te,J,Tc(re),fe);if(re.$$typeof===E)return Ct(te,J,jc(te,re),fe);Ac(te,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,J!==null&&J.tag===6?(c(te,J.sibling),fe=v(J,re),fe.return=te,te=fe):(c(te,J),fe=Sp(re,te.mode,fe),fe.return=te,te=fe),C(te)):c(te,J)}return function(te,J,re,fe){try{Io=0;var ze=Ct(te,J,re,fe);return As=null,ze}catch(Re){if(Re===Ts||Re===Nc)throw Re;var ht=Qn(29,Re,null,te.mode);return ht.lanes=fe,ht.return=te,ht}finally{}}}var $i=My(!0),Dy=My(!1),Qa=!1;function zp(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $p(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Xa(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Ja(r,i,c){var p=r.updateQueue;if(p===null)return null;if(p=p.shared,(yt&2)!==0){var v=p.pending;return v===null?i.next=i:(i.next=v.next,v.next=i),p.pending=i,i=xc(r),yy(r,null,c),i}return bc(r,p,i,c),xc(r)}function Uo(r,i,c){if(i=i.updateQueue,i!==null&&(i=i.shared,(c&4194048)!==0)){var p=i.lanes;p&=r.pendingLanes,c|=p,i.lanes=c,je(r,c)}}function Ip(r,i){var c=r.updateQueue,p=r.alternate;if(p!==null&&(p=p.updateQueue,c===p)){var v=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var C={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?v=x=C:x=x.next=C,c=c.next}while(c!==null);x===null?v=x=i:x=x.next=i}else v=x=i;c={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:p.shared,callbacks:p.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=i:r.next=i,c.lastBaseUpdate=i}var Pp=!1;function Bo(){if(Pp){var r=Es;if(r!==null)throw r}}function Fo(r,i,c,p){Pp=!1;var v=r.updateQueue;Qa=!1;var x=v.firstBaseUpdate,C=v.lastBaseUpdate,D=v.shared.pending;if(D!==null){v.shared.pending=null;var K=D,ae=K.next;K.next=null,C===null?x=ae:C.next=ae,C=K;var pe=r.alternate;pe!==null&&(pe=pe.updateQueue,D=pe.lastBaseUpdate,D!==C&&(D===null?pe.firstBaseUpdate=ae:D.next=ae,pe.lastBaseUpdate=K))}if(x!==null){var me=v.baseState;C=0,pe=ae=K=null,D=x;do{var se=D.lane&-536870913,oe=se!==D.lane;if(oe?(st&se)===se:(p&se)===se){se!==0&&se===Ns&&(Pp=!0),pe!==null&&(pe=pe.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var Ae=r,Be=D;se=i;var Ct=c;switch(Be.tag){case 1:if(Ae=Be.payload,typeof Ae=="function"){me=Ae.call(Ct,me,se);break e}me=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Be.payload,se=typeof Ae=="function"?Ae.call(Ct,me,se):Ae,se==null)break e;me=m({},me,se);break e;case 2:Qa=!0}}se=D.callback,se!==null&&(r.flags|=64,oe&&(r.flags|=8192),oe=v.callbacks,oe===null?v.callbacks=[se]:oe.push(se))}else oe={lane:se,tag:D.tag,payload:D.payload,callback:D.callback,next:null},pe===null?(ae=pe=oe,K=me):pe=pe.next=oe,C|=se;if(D=D.next,D===null){if(D=v.shared.pending,D===null)break;oe=D,D=oe.next,oe.next=null,v.lastBaseUpdate=oe,v.shared.pending=null}}while(!0);pe===null&&(K=me),v.baseState=K,v.firstBaseUpdate=ae,v.lastBaseUpdate=pe,x===null&&(v.shared.lanes=0),ai|=C,r.lanes=C,r.memoizedState=me}}function zy(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function $y(r,i){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)zy(c[r],i)}var _s=U(null),_c=U(0);function Iy(r,i){r=Aa,O(_c,r),O(_s,i),Aa=r|i.baseLanes}function Up(){O(_c,Aa),O(_s,_s.current)}function Bp(){Aa=_c.current,G(_s),G(_c)}var Xn=U(null),jr=null;function ei(r){var i=r.alternate;O(Qt,Qt.current&1),O(Xn,r),jr===null&&(i===null||_s.current!==null||i.memoizedState!==null)&&(jr=r)}function Fp(r){O(Qt,Qt.current),O(Xn,r),jr===null&&(jr=r)}function Py(r){r.tag===22?(O(Qt,Qt.current),O(Xn,r),jr===null&&(jr=r)):ti()}function ti(){O(Qt,Qt.current),O(Xn,Xn.current)}function Jn(r){G(Xn),jr===r&&(jr=null),G(Qt)}var Qt=U(0);function Rc(r){for(var i=r;i!==null;){if(i.tag===13){var c=i.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Kf(c)||Yf(c)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var wa=0,Ye=null,St=null,rn=null,Oc=!1,Rs=!1,Ii=!1,Lc=0,Ho=0,Os=null,GE=0;function Zt(){throw Error(a(321))}function Hp(r,i){if(i===null)return!1;for(var c=0;c<i.length&&c<r.length;c++)if(!Yn(r[c],i[c]))return!1;return!0}function qp(r,i,c,p,v,x){return wa=x,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,H.H=r===null||r.memoizedState===null?kb:sf,Ii=!1,x=c(p,v),Ii=!1,Rs&&(x=By(i,c,p,v)),Uy(r),x}function Uy(r){H.H=Vo;var i=St!==null&&St.next!==null;if(wa=0,rn=St=Ye=null,Oc=!1,Ho=0,Os=null,i)throw Error(a(300));r===null||an||(r=r.dependencies,r!==null&&Sc(r)&&(an=!0))}function By(r,i,c,p){Ye=r;var v=0;do{if(Rs&&(Os=null),Ho=0,Rs=!1,25<=v)throw Error(a(301));if(v+=1,rn=St=null,r.updateQueue!=null){var x=r.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}H.H=Sb,x=i(c,p)}while(Rs);return x}function VE(){var r=H.H,i=r.useState()[0];return i=typeof i.then=="function"?qo(i):i,r=r.useState()[0],(St!==null?St.memoizedState:null)!==r&&(Ye.flags|=1024),i}function Gp(){var r=Lc!==0;return Lc=0,r}function Vp(r,i,c){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~c}function Wp(r){if(Oc){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Oc=!1}wa=0,rn=St=Ye=null,Rs=!1,Ho=Lc=0,Os=null}function Rn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rn===null?Ye.memoizedState=rn=r:rn=rn.next=r,rn}function Xt(){if(St===null){var r=Ye.alternate;r=r!==null?r.memoizedState:null}else r=St.next;var i=rn===null?Ye.memoizedState:rn.next;if(i!==null)rn=i,St=r;else{if(r===null)throw Ye.alternate===null?Error(a(467)):Error(a(310));St=r,r={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},rn===null?Ye.memoizedState=rn=r:rn=rn.next=r}return rn}function Mc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function qo(r){var i=Ho;return Ho+=1,Os===null&&(Os=[]),r=Ry(Os,r,i),i=Ye,(rn===null?i.memoizedState:rn.next)===null&&(i=i.alternate,H.H=i===null||i.memoizedState===null?kb:sf),r}function Dc(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return qo(r);if(r.$$typeof===E)return xn(r)}throw Error(a(438,String(r)))}function Zp(r){var i=null,c=Ye.updateQueue;if(c!==null&&(i=c.memoCache),i==null){var p=Ye.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(i={data:p.data.map(function(v){return v.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),c===null&&(c=Mc(),Ye.updateQueue=c),c.memoCache=i,c=i.data[i.index],c===void 0)for(c=i.data[i.index]=Array(r),p=0;p<r;p++)c[p]=R;return i.index++,c}function ka(r,i){return typeof i=="function"?i(r):i}function zc(r){var i=Xt();return Kp(i,St,r)}function Kp(r,i,c){var p=r.queue;if(p===null)throw Error(a(311));p.lastRenderedReducer=c;var v=r.baseQueue,x=p.pending;if(x!==null){if(v!==null){var C=v.next;v.next=x.next,x.next=C}i.baseQueue=v=x,p.pending=null}if(x=r.baseState,v===null)r.memoizedState=x;else{i=v.next;var D=C=null,K=null,ae=i,pe=!1;do{var me=ae.lane&-536870913;if(me!==ae.lane?(st&me)===me:(wa&me)===me){var se=ae.revertLane;if(se===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),me===Ns&&(pe=!0);else if((wa&se)===se){ae=ae.next,se===Ns&&(pe=!0);continue}else me={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},K===null?(D=K=me,C=x):K=K.next=me,Ye.lanes|=se,ai|=se;me=ae.action,Ii&&c(x,me),x=ae.hasEagerState?ae.eagerState:c(x,me)}else se={lane:me,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},K===null?(D=K=se,C=x):K=K.next=se,Ye.lanes|=me,ai|=me;ae=ae.next}while(ae!==null&&ae!==i);if(K===null?C=x:K.next=D,!Yn(x,r.memoizedState)&&(an=!0,pe&&(c=Es,c!==null)))throw c;r.memoizedState=x,r.baseState=C,r.baseQueue=K,p.lastRenderedState=x}return v===null&&(p.lanes=0),[r.memoizedState,p.dispatch]}function Yp(r){var i=Xt(),c=i.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=r;var p=c.dispatch,v=c.pending,x=i.memoizedState;if(v!==null){c.pending=null;var C=v=v.next;do x=r(x,C.action),C=C.next;while(C!==v);Yn(x,i.memoizedState)||(an=!0),i.memoizedState=x,i.baseQueue===null&&(i.baseState=x),c.lastRenderedState=x}return[x,p]}function Fy(r,i,c){var p=Ye,v=Xt(),x=ct;if(x){if(c===void 0)throw Error(a(407));c=c()}else c=i();var C=!Yn((St||v).memoizedState,c);if(C&&(v.memoizedState=c,an=!0),v=v.queue,Jp(Gy.bind(null,p,v,r),[r]),v.getSnapshot!==i||C||rn!==null&&rn.memoizedState.tag&1){if(p.flags|=2048,Ls(9,{destroy:void 0},qy.bind(null,p,v,c,i),null),Et===null)throw Error(a(349));x||(wa&127)!==0||Hy(p,i,c)}return c}function Hy(r,i,c){r.flags|=16384,r={getSnapshot:i,value:c},i=Ye.updateQueue,i===null?(i=Mc(),Ye.updateQueue=i,i.stores=[r]):(c=i.stores,c===null?i.stores=[r]:c.push(r))}function qy(r,i,c,p){i.value=c,i.getSnapshot=p,Vy(i)&&Wy(r)}function Gy(r,i,c){return c(function(){Vy(i)&&Wy(r)})}function Vy(r){var i=r.getSnapshot;r=r.value;try{var c=i();return!Yn(r,c)}catch{return!0}}function Wy(r){var i=Ai(r,2);i!==null&&Hn(i,r,2)}function Qp(r){var i=Rn();if(typeof r=="function"){var c=r;if(r=c(),Ii){et(!0);try{c()}finally{et(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:r},i}function Zy(r,i,c,p){return r.baseState=c,Kp(r,St,typeof p=="function"?p:ka)}function WE(r,i,c,p,v){if(Pc(r))throw Error(a(485));if(r=i.action,r!==null){var x={payload:v,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){x.listeners.push(C)}};H.T!==null?c(!0):x.isTransition=!1,p(x),c=i.pending,c===null?(x.next=i.pending=x,Ky(i,x)):(x.next=c.next,i.pending=c.next=x)}}function Ky(r,i){var c=i.action,p=i.payload,v=r.state;if(i.isTransition){var x=H.T,C={};H.T=C;try{var D=c(v,p),K=H.S;K!==null&&K(C,D),Yy(r,i,D)}catch(ae){Xp(r,i,ae)}finally{x!==null&&C.types!==null&&(x.types=C.types),H.T=x}}else try{x=c(v,p),Yy(r,i,x)}catch(ae){Xp(r,i,ae)}}function Yy(r,i,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(p){Qy(r,i,p)},function(p){return Xp(r,i,p)}):Qy(r,i,c)}function Qy(r,i,c){i.status="fulfilled",i.value=c,Xy(i),r.state=c,i=r.pending,i!==null&&(c=i.next,c===i?r.pending=null:(c=c.next,i.next=c,Ky(r,c)))}function Xp(r,i,c){var p=r.pending;if(r.pending=null,p!==null){p=p.next;do i.status="rejected",i.reason=c,Xy(i),i=i.next;while(i!==p)}r.action=null}function Xy(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Jy(r,i){return i}function eb(r,i){if(ct){var c=Et.formState;if(c!==null){e:{var p=Ye;if(ct){if(Mt){t:{for(var v=Mt,x=Sr;v.nodeType!==8;){if(!x){v=null;break t}if(v=Cr(v.nextSibling),v===null){v=null;break t}}x=v.data,v=x==="F!"||x==="F"?v:null}if(v){Mt=Cr(v.nextSibling),p=v.data==="F!";break e}}Ka(p)}p=!1}p&&(i=c[0])}}return c=Rn(),c.memoizedState=c.baseState=i,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jy,lastRenderedState:i},c.queue=p,c=bb.bind(null,Ye,p),p.dispatch=c,p=Qp(!1),x=af.bind(null,Ye,!1,p.queue),p=Rn(),v={state:i,dispatch:null,action:r,pending:null},p.queue=v,c=WE.bind(null,Ye,v,x,c),v.dispatch=c,p.memoizedState=r,[i,c,!1]}function tb(r){var i=Xt();return nb(i,St,r)}function nb(r,i,c){if(i=Kp(r,i,Jy)[0],r=zc(ka)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var p=qo(i)}catch(C){throw C===Ts?Nc:C}else p=i;i=Xt();var v=i.queue,x=v.dispatch;return c!==i.memoizedState&&(Ye.flags|=2048,Ls(9,{destroy:void 0},ZE.bind(null,v,c),null)),[p,x,r]}function ZE(r,i){r.action=i}function rb(r){var i=Xt(),c=St;if(c!==null)return nb(i,c,r);Xt(),i=i.memoizedState,c=Xt();var p=c.queue.dispatch;return c.memoizedState=r,[i,p,!1]}function Ls(r,i,c,p){return r={tag:r,create:c,deps:p,inst:i,next:null},i=Ye.updateQueue,i===null&&(i=Mc(),Ye.updateQueue=i),c=i.lastEffect,c===null?i.lastEffect=r.next=r:(p=c.next,c.next=r,r.next=p,i.lastEffect=r),r}function ab(){return Xt().memoizedState}function $c(r,i,c,p){var v=Rn();Ye.flags|=r,v.memoizedState=Ls(1|i,{destroy:void 0},c,p===void 0?null:p)}function Ic(r,i,c,p){var v=Xt();p=p===void 0?null:p;var x=v.memoizedState.inst;St!==null&&p!==null&&Hp(p,St.memoizedState.deps)?v.memoizedState=Ls(i,x,c,p):(Ye.flags|=r,v.memoizedState=Ls(1|i,x,c,p))}function ib(r,i){$c(8390656,8,r,i)}function Jp(r,i){Ic(2048,8,r,i)}function KE(r){Ye.flags|=4;var i=Ye.updateQueue;if(i===null)i=Mc(),Ye.updateQueue=i,i.events=[r];else{var c=i.events;c===null?i.events=[r]:c.push(r)}}function sb(r){var i=Xt().memoizedState;return KE({ref:i,nextImpl:r}),function(){if((yt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function ob(r,i){return Ic(4,2,r,i)}function lb(r,i){return Ic(4,4,r,i)}function cb(r,i){if(typeof i=="function"){r=r();var c=i(r);return function(){typeof c=="function"?c():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function ub(r,i,c){c=c!=null?c.concat([r]):null,Ic(4,4,cb.bind(null,i,r),c)}function ef(){}function db(r,i){var c=Xt();i=i===void 0?null:i;var p=c.memoizedState;return i!==null&&Hp(i,p[1])?p[0]:(c.memoizedState=[r,i],r)}function pb(r,i){var c=Xt();i=i===void 0?null:i;var p=c.memoizedState;if(i!==null&&Hp(i,p[1]))return p[0];if(p=r(),Ii){et(!0);try{r()}finally{et(!1)}}return c.memoizedState=[p,i],p}function tf(r,i,c){return c===void 0||(wa&1073741824)!==0&&(st&261930)===0?r.memoizedState=i:(r.memoizedState=c,r=f0(),Ye.lanes|=r,ai|=r,c)}function fb(r,i,c,p){return Yn(c,i)?c:_s.current!==null?(r=tf(r,c,p),Yn(r,i)||(an=!0),r):(wa&42)===0||(wa&1073741824)!==0&&(st&261930)===0?(an=!0,r.memoizedState=c):(r=f0(),Ye.lanes|=r,ai|=r,i)}function hb(r,i,c,p,v){var x=V.p;V.p=x!==0&&8>x?x:8;var C=H.T,D={};H.T=D,af(r,!1,i,c);try{var K=v(),ae=H.S;if(ae!==null&&ae(D,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var pe=qE(K,p);Go(r,i,pe,nr(r))}else Go(r,i,p,nr(r))}catch(me){Go(r,i,{then:function(){},status:"rejected",reason:me},nr())}finally{V.p=x,C!==null&&D.types!==null&&(C.types=D.types),H.T=C}}function YE(){}function nf(r,i,c,p){if(r.tag!==5)throw Error(a(476));var v=mb(r).queue;hb(r,v,i,X,c===null?YE:function(){return gb(r),c(p)})}function mb(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:X},next:null};var c={};return i.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:c},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function gb(r){var i=mb(r);i.next===null&&(i=r.alternate.memoizedState),Go(r,i.next.queue,{},nr())}function rf(){return xn(ll)}function vb(){return Xt().memoizedState}function yb(){return Xt().memoizedState}function QE(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var c=nr();r=Xa(c);var p=Ja(i,r,c);p!==null&&(Hn(p,i,c),Uo(p,i,c)),i={cache:Op()},r.payload=i;return}i=i.return}}function XE(r,i,c){var p=nr();c={lane:p,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Pc(r)?xb(i,c):(c=wp(r,i,c,p),c!==null&&(Hn(c,r,p),wb(c,i,p)))}function bb(r,i,c){var p=nr();Go(r,i,c,p)}function Go(r,i,c,p){var v={lane:p,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Pc(r))xb(i,v);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=i.lastRenderedReducer,x!==null))try{var C=i.lastRenderedState,D=x(C,c);if(v.hasEagerState=!0,v.eagerState=D,Yn(D,C))return bc(r,i,v,0),Et===null&&yc(),!1}catch{}finally{}if(c=wp(r,i,v,p),c!==null)return Hn(c,r,p),wb(c,i,p),!0}return!1}function af(r,i,c,p){if(p={lane:2,revertLane:$f(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Pc(r)){if(i)throw Error(a(479))}else i=wp(r,c,p,2),i!==null&&Hn(i,r,2)}function Pc(r){var i=r.alternate;return r===Ye||i!==null&&i===Ye}function xb(r,i){Rs=Oc=!0;var c=r.pending;c===null?i.next=i:(i.next=c.next,c.next=i),r.pending=i}function wb(r,i,c){if((c&4194048)!==0){var p=i.lanes;p&=r.pendingLanes,c|=p,i.lanes=c,je(r,c)}}var Vo={readContext:xn,use:Dc,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};Vo.useEffectEvent=Zt;var kb={readContext:xn,use:Dc,useCallback:function(r,i){return Rn().memoizedState=[r,i===void 0?null:i],r},useContext:xn,useEffect:ib,useImperativeHandle:function(r,i,c){c=c!=null?c.concat([r]):null,$c(4194308,4,cb.bind(null,i,r),c)},useLayoutEffect:function(r,i){return $c(4194308,4,r,i)},useInsertionEffect:function(r,i){$c(4,2,r,i)},useMemo:function(r,i){var c=Rn();i=i===void 0?null:i;var p=r();if(Ii){et(!0);try{r()}finally{et(!1)}}return c.memoizedState=[p,i],p},useReducer:function(r,i,c){var p=Rn();if(c!==void 0){var v=c(i);if(Ii){et(!0);try{c(i)}finally{et(!1)}}}else v=i;return p.memoizedState=p.baseState=v,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:v},p.queue=r,r=r.dispatch=XE.bind(null,Ye,r),[p.memoizedState,r]},useRef:function(r){var i=Rn();return r={current:r},i.memoizedState=r},useState:function(r){r=Qp(r);var i=r.queue,c=bb.bind(null,Ye,i);return i.dispatch=c,[r.memoizedState,c]},useDebugValue:ef,useDeferredValue:function(r,i){var c=Rn();return tf(c,r,i)},useTransition:function(){var r=Qp(!1);return r=hb.bind(null,Ye,r.queue,!0,!1),Rn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,c){var p=Ye,v=Rn();if(ct){if(c===void 0)throw Error(a(407));c=c()}else{if(c=i(),Et===null)throw Error(a(349));(st&127)!==0||Hy(p,i,c)}v.memoizedState=c;var x={value:c,getSnapshot:i};return v.queue=x,ib(Gy.bind(null,p,x,r),[r]),p.flags|=2048,Ls(9,{destroy:void 0},qy.bind(null,p,x,c,i),null),c},useId:function(){var r=Rn(),i=Et.identifierPrefix;if(ct){var c=Wr,p=Vr;c=(p&~(1<<32-Ne(p)-1)).toString(32)+c,i="_"+i+"R_"+c,c=Lc++,0<c&&(i+="H"+c.toString(32)),i+="_"}else c=GE++,i="_"+i+"r_"+c.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:rf,useFormState:eb,useActionState:eb,useOptimistic:function(r){var i=Rn();i.memoizedState=i.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=c,i=af.bind(null,Ye,!0,c),c.dispatch=i,[r,i]},useMemoCache:Zp,useCacheRefresh:function(){return Rn().memoizedState=QE.bind(null,Ye)},useEffectEvent:function(r){var i=Rn(),c={impl:r};return i.memoizedState=c,function(){if((yt&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},sf={readContext:xn,use:Dc,useCallback:db,useContext:xn,useEffect:Jp,useImperativeHandle:ub,useInsertionEffect:ob,useLayoutEffect:lb,useMemo:pb,useReducer:zc,useRef:ab,useState:function(){return zc(ka)},useDebugValue:ef,useDeferredValue:function(r,i){var c=Xt();return fb(c,St.memoizedState,r,i)},useTransition:function(){var r=zc(ka)[0],i=Xt().memoizedState;return[typeof r=="boolean"?r:qo(r),i]},useSyncExternalStore:Fy,useId:vb,useHostTransitionStatus:rf,useFormState:tb,useActionState:tb,useOptimistic:function(r,i){var c=Xt();return Zy(c,St,r,i)},useMemoCache:Zp,useCacheRefresh:yb};sf.useEffectEvent=sb;var Sb={readContext:xn,use:Dc,useCallback:db,useContext:xn,useEffect:Jp,useImperativeHandle:ub,useInsertionEffect:ob,useLayoutEffect:lb,useMemo:pb,useReducer:Yp,useRef:ab,useState:function(){return Yp(ka)},useDebugValue:ef,useDeferredValue:function(r,i){var c=Xt();return St===null?tf(c,r,i):fb(c,St.memoizedState,r,i)},useTransition:function(){var r=Yp(ka)[0],i=Xt().memoizedState;return[typeof r=="boolean"?r:qo(r),i]},useSyncExternalStore:Fy,useId:vb,useHostTransitionStatus:rf,useFormState:rb,useActionState:rb,useOptimistic:function(r,i){var c=Xt();return St!==null?Zy(c,St,r,i):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:Zp,useCacheRefresh:yb};Sb.useEffectEvent=sb;function of(r,i,c,p){i=r.memoizedState,c=c(p,i),c=c==null?i:m({},i,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var lf={enqueueSetState:function(r,i,c){r=r._reactInternals;var p=nr(),v=Xa(p);v.payload=i,c!=null&&(v.callback=c),i=Ja(r,v,p),i!==null&&(Hn(i,r,p),Uo(i,r,p))},enqueueReplaceState:function(r,i,c){r=r._reactInternals;var p=nr(),v=Xa(p);v.tag=1,v.payload=i,c!=null&&(v.callback=c),i=Ja(r,v,p),i!==null&&(Hn(i,r,p),Uo(i,r,p))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var c=nr(),p=Xa(c);p.tag=2,i!=null&&(p.callback=i),i=Ja(r,p,c),i!==null&&(Hn(i,r,c),Uo(i,r,c))}};function jb(r,i,c,p,v,x,C){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(p,x,C):i.prototype&&i.prototype.isPureReactComponent?!Oo(c,p)||!Oo(v,x):!0}function Cb(r,i,c,p){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(c,p),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(c,p),i.state!==r&&lf.enqueueReplaceState(i,i.state,null)}function Pi(r,i){var c=i;if("ref"in i){c={};for(var p in i)p!=="ref"&&(c[p]=i[p])}if(r=r.defaultProps){c===i&&(c=m({},c));for(var v in r)c[v]===void 0&&(c[v]=r[v])}return c}function Nb(r){vc(r)}function Eb(r){console.error(r)}function Tb(r){vc(r)}function Uc(r,i){try{var c=r.onUncaughtError;c(i.value,{componentStack:i.stack})}catch(p){setTimeout(function(){throw p})}}function Ab(r,i,c){try{var p=r.onCaughtError;p(c.value,{componentStack:c.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function cf(r,i,c){return c=Xa(c),c.tag=3,c.payload={element:null},c.callback=function(){Uc(r,i)},c}function _b(r){return r=Xa(r),r.tag=3,r}function Rb(r,i,c,p){var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var x=p.value;r.payload=function(){return v(x)},r.callback=function(){Ab(i,c,p)}}var C=c.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(r.callback=function(){Ab(i,c,p),typeof v!="function"&&(ii===null?ii=new Set([this]):ii.add(this));var D=p.stack;this.componentDidCatch(p.value,{componentStack:D!==null?D:""})})}function JE(r,i,c,p,v){if(c.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(i=c.alternate,i!==null&&Cs(i,c,v,!0),c=Xn.current,c!==null){switch(c.tag){case 31:case 13:return jr===null?Xc():c.alternate===null&&Kt===0&&(Kt=3),c.flags&=-257,c.flags|=65536,c.lanes=v,p===Ec?c.flags|=16384:(i=c.updateQueue,i===null?c.updateQueue=new Set([p]):i.add(p),Mf(r,p,v)),!1;case 22:return c.flags|=65536,p===Ec?c.flags|=16384:(i=c.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([p])},c.updateQueue=i):(c=i.retryQueue,c===null?i.retryQueue=new Set([p]):c.add(p)),Mf(r,p,v)),!1}throw Error(a(435,c.tag))}return Mf(r,p,v),Xc(),!1}if(ct)return i=Xn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=v,p!==Ep&&(r=Error(a(422),{cause:p}),Do(xr(r,c)))):(p!==Ep&&(i=Error(a(423),{cause:p}),Do(xr(i,c))),r=r.current.alternate,r.flags|=65536,v&=-v,r.lanes|=v,p=xr(p,c),v=cf(r.stateNode,p,v),Ip(r,v),Kt!==4&&(Kt=2)),!1;var x=Error(a(520),{cause:p});if(x=xr(x,c),el===null?el=[x]:el.push(x),Kt!==4&&(Kt=2),i===null)return!0;p=xr(p,c),c=i;do{switch(c.tag){case 3:return c.flags|=65536,r=v&-v,c.lanes|=r,r=cf(c.stateNode,p,r),Ip(c,r),!1;case 1:if(i=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ii===null||!ii.has(x))))return c.flags|=65536,v&=-v,c.lanes|=v,v=_b(v),Rb(v,r,c,p),Ip(c,v),!1}c=c.return}while(c!==null);return!1}var uf=Error(a(461)),an=!1;function wn(r,i,c,p){i.child=r===null?Dy(i,null,c,p):$i(i,r.child,c,p)}function Ob(r,i,c,p,v){c=c.render;var x=i.ref;if("ref"in p){var C={};for(var D in p)D!=="ref"&&(C[D]=p[D])}else C=p;return Li(i),p=qp(r,i,c,C,x,v),D=Gp(),r!==null&&!an?(Vp(r,i,v),Sa(r,i,v)):(ct&&D&&Cp(i),i.flags|=1,wn(r,i,p,v),i.child)}function Lb(r,i,c,p,v){if(r===null){var x=c.type;return typeof x=="function"&&!kp(x)&&x.defaultProps===void 0&&c.compare===null?(i.tag=15,i.type=x,Mb(r,i,x,p,v)):(r=wc(c.type,null,p,i,i.mode,v),r.ref=i.ref,r.return=i,i.child=r)}if(x=r.child,!yf(r,v)){var C=x.memoizedProps;if(c=c.compare,c=c!==null?c:Oo,c(C,p)&&r.ref===i.ref)return Sa(r,i,v)}return i.flags|=1,r=va(x,p),r.ref=i.ref,r.return=i,i.child=r}function Mb(r,i,c,p,v){if(r!==null){var x=r.memoizedProps;if(Oo(x,p)&&r.ref===i.ref)if(an=!1,i.pendingProps=p=x,yf(r,v))(r.flags&131072)!==0&&(an=!0);else return i.lanes=r.lanes,Sa(r,i,v)}return df(r,i,c,p,v)}function Db(r,i,c,p){var v=p.children,x=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((i.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,r!==null){for(p=i.child=r.child,v=0;p!==null;)v=v|p.lanes|p.childLanes,p=p.sibling;p=v&~x}else p=0,i.child=null;return zb(r,i,x,c,p)}if((c&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&Cc(i,x!==null?x.cachePool:null),x!==null?Iy(i,x):Up(),Py(i);else return p=i.lanes=536870912,zb(r,i,x!==null?x.baseLanes|c:c,c,p)}else x!==null?(Cc(i,x.cachePool),Iy(i,x),ti(),i.memoizedState=null):(r!==null&&Cc(i,null),Up(),ti());return wn(r,i,v,c),i.child}function Wo(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function zb(r,i,c,p,v){var x=Mp();return x=x===null?null:{parent:nn._currentValue,pool:x},i.memoizedState={baseLanes:c,cachePool:x},r!==null&&Cc(i,null),Up(),Py(i),r!==null&&Cs(r,i,p,!0),i.childLanes=v,null}function Bc(r,i){return i=Hc({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function $b(r,i,c){return $i(i,r.child,null,c),r=Bc(i,i.pendingProps),r.flags|=2,Jn(i),i.memoizedState=null,r}function eT(r,i,c){var p=i.pendingProps,v=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(ct){if(p.mode==="hidden")return r=Bc(i,p),i.lanes=536870912,Wo(null,r);if(Fp(i),(r=Mt)?(r=K0(r,Sr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Wa!==null?{id:Vr,overflow:Wr}:null,retryLane:536870912,hydrationErrors:null},c=xy(r),c.return=i,i.child=c,bn=i,Mt=null)):r=null,r===null)throw Ka(i);return i.lanes=536870912,null}return Bc(i,p)}var x=r.memoizedState;if(x!==null){var C=x.dehydrated;if(Fp(i),v)if(i.flags&256)i.flags&=-257,i=$b(r,i,c);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(an||Cs(r,i,c,!1),v=(c&r.childLanes)!==0,an||v){if(p=Et,p!==null&&(C=Te(p,c),C!==0&&C!==x.retryLane))throw x.retryLane=C,Ai(r,C),Hn(p,r,C),uf;Xc(),i=$b(r,i,c)}else r=x.treeContext,Mt=Cr(C.nextSibling),bn=i,ct=!0,Za=null,Sr=!1,r!==null&&Sy(i,r),i=Bc(i,p),i.flags|=4096;return i}return r=va(r.child,{mode:p.mode,children:p.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Fc(r,i){var c=i.ref;if(c===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(a(284));(r===null||r.ref!==c)&&(i.flags|=4194816)}}function df(r,i,c,p,v){return Li(i),c=qp(r,i,c,p,void 0,v),p=Gp(),r!==null&&!an?(Vp(r,i,v),Sa(r,i,v)):(ct&&p&&Cp(i),i.flags|=1,wn(r,i,c,v),i.child)}function Ib(r,i,c,p,v,x){return Li(i),i.updateQueue=null,c=By(i,p,c,v),Uy(r),p=Gp(),r!==null&&!an?(Vp(r,i,x),Sa(r,i,x)):(ct&&p&&Cp(i),i.flags|=1,wn(r,i,c,x),i.child)}function Pb(r,i,c,p,v){if(Li(i),i.stateNode===null){var x=ws,C=c.contextType;typeof C=="object"&&C!==null&&(x=xn(C)),x=new c(p,x),i.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=lf,i.stateNode=x,x._reactInternals=i,x=i.stateNode,x.props=p,x.state=i.memoizedState,x.refs={},zp(i),C=c.contextType,x.context=typeof C=="object"&&C!==null?xn(C):ws,x.state=i.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(of(i,c,C,p),x.state=i.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(C=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),C!==x.state&&lf.enqueueReplaceState(x,x.state,null),Fo(i,p,x,v),Bo(),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308),p=!0}else if(r===null){x=i.stateNode;var D=i.memoizedProps,K=Pi(c,D);x.props=K;var ae=x.context,pe=c.contextType;C=ws,typeof pe=="object"&&pe!==null&&(C=xn(pe));var me=c.getDerivedStateFromProps;pe=typeof me=="function"||typeof x.getSnapshotBeforeUpdate=="function",D=i.pendingProps!==D,pe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(D||ae!==C)&&Cb(i,x,p,C),Qa=!1;var se=i.memoizedState;x.state=se,Fo(i,p,x,v),Bo(),ae=i.memoizedState,D||se!==ae||Qa?(typeof me=="function"&&(of(i,c,me,p),ae=i.memoizedState),(K=Qa||jb(i,c,K,p,se,ae,C))?(pe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(i.flags|=4194308)):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=p,i.memoizedState=ae),x.props=p,x.state=ae,x.context=C,p=K):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),p=!1)}else{x=i.stateNode,$p(r,i),C=i.memoizedProps,pe=Pi(c,C),x.props=pe,me=i.pendingProps,se=x.context,ae=c.contextType,K=ws,typeof ae=="object"&&ae!==null&&(K=xn(ae)),D=c.getDerivedStateFromProps,(ae=typeof D=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(C!==me||se!==K)&&Cb(i,x,p,K),Qa=!1,se=i.memoizedState,x.state=se,Fo(i,p,x,v),Bo();var oe=i.memoizedState;C!==me||se!==oe||Qa||r!==null&&r.dependencies!==null&&Sc(r.dependencies)?(typeof D=="function"&&(of(i,c,D,p),oe=i.memoizedState),(pe=Qa||jb(i,c,pe,p,se,oe,K)||r!==null&&r.dependencies!==null&&Sc(r.dependencies))?(ae||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(p,oe,K),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(p,oe,K)),typeof x.componentDidUpdate=="function"&&(i.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof x.componentDidUpdate!="function"||C===r.memoizedProps&&se===r.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||C===r.memoizedProps&&se===r.memoizedState||(i.flags|=1024),i.memoizedProps=p,i.memoizedState=oe),x.props=p,x.state=oe,x.context=K,p=pe):(typeof x.componentDidUpdate!="function"||C===r.memoizedProps&&se===r.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||C===r.memoizedProps&&se===r.memoizedState||(i.flags|=1024),p=!1)}return x=p,Fc(r,i),p=(i.flags&128)!==0,x||p?(x=i.stateNode,c=p&&typeof c.getDerivedStateFromError!="function"?null:x.render(),i.flags|=1,r!==null&&p?(i.child=$i(i,r.child,null,v),i.child=$i(i,null,c,v)):wn(r,i,c,v),i.memoizedState=x.state,r=i.child):r=Sa(r,i,v),r}function Ub(r,i,c,p){return Ri(),i.flags|=256,wn(r,i,c,p),i.child}var pf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ff(r){return{baseLanes:r,cachePool:Ay()}}function hf(r,i,c){return r=r!==null?r.childLanes&~c:0,i&&(r|=tr),r}function Bb(r,i,c){var p=i.pendingProps,v=!1,x=(i.flags&128)!==0,C;if((C=x)||(C=r!==null&&r.memoizedState===null?!1:(Qt.current&2)!==0),C&&(v=!0,i.flags&=-129),C=(i.flags&32)!==0,i.flags&=-33,r===null){if(ct){if(v?ei(i):ti(),(r=Mt)?(r=K0(r,Sr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Wa!==null?{id:Vr,overflow:Wr}:null,retryLane:536870912,hydrationErrors:null},c=xy(r),c.return=i,i.child=c,bn=i,Mt=null)):r=null,r===null)throw Ka(i);return Yf(r)?i.lanes=32:i.lanes=536870912,null}var D=p.children;return p=p.fallback,v?(ti(),v=i.mode,D=Hc({mode:"hidden",children:D},v),p=_i(p,v,c,null),D.return=i,p.return=i,D.sibling=p,i.child=D,p=i.child,p.memoizedState=ff(c),p.childLanes=hf(r,C,c),i.memoizedState=pf,Wo(null,p)):(ei(i),mf(i,D))}var K=r.memoizedState;if(K!==null&&(D=K.dehydrated,D!==null)){if(x)i.flags&256?(ei(i),i.flags&=-257,i=gf(r,i,c)):i.memoizedState!==null?(ti(),i.child=r.child,i.flags|=128,i=null):(ti(),D=p.fallback,v=i.mode,p=Hc({mode:"visible",children:p.children},v),D=_i(D,v,c,null),D.flags|=2,p.return=i,D.return=i,p.sibling=D,i.child=p,$i(i,r.child,null,c),p=i.child,p.memoizedState=ff(c),p.childLanes=hf(r,C,c),i.memoizedState=pf,i=Wo(null,p));else if(ei(i),Yf(D)){if(C=D.nextSibling&&D.nextSibling.dataset,C)var ae=C.dgst;C=ae,p=Error(a(419)),p.stack="",p.digest=C,Do({value:p,source:null,stack:null}),i=gf(r,i,c)}else if(an||Cs(r,i,c,!1),C=(c&r.childLanes)!==0,an||C){if(C=Et,C!==null&&(p=Te(C,c),p!==0&&p!==K.retryLane))throw K.retryLane=p,Ai(r,p),Hn(C,r,p),uf;Kf(D)||Xc(),i=gf(r,i,c)}else Kf(D)?(i.flags|=192,i.child=r.child,i=null):(r=K.treeContext,Mt=Cr(D.nextSibling),bn=i,ct=!0,Za=null,Sr=!1,r!==null&&Sy(i,r),i=mf(i,p.children),i.flags|=4096);return i}return v?(ti(),D=p.fallback,v=i.mode,K=r.child,ae=K.sibling,p=va(K,{mode:"hidden",children:p.children}),p.subtreeFlags=K.subtreeFlags&65011712,ae!==null?D=va(ae,D):(D=_i(D,v,c,null),D.flags|=2),D.return=i,p.return=i,p.sibling=D,i.child=p,Wo(null,p),p=i.child,D=r.child.memoizedState,D===null?D=ff(c):(v=D.cachePool,v!==null?(K=nn._currentValue,v=v.parent!==K?{parent:K,pool:K}:v):v=Ay(),D={baseLanes:D.baseLanes|c,cachePool:v}),p.memoizedState=D,p.childLanes=hf(r,C,c),i.memoizedState=pf,Wo(r.child,p)):(ei(i),c=r.child,r=c.sibling,c=va(c,{mode:"visible",children:p.children}),c.return=i,c.sibling=null,r!==null&&(C=i.deletions,C===null?(i.deletions=[r],i.flags|=16):C.push(r)),i.child=c,i.memoizedState=null,c)}function mf(r,i){return i=Hc({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Hc(r,i){return r=Qn(22,r,null,i),r.lanes=0,r}function gf(r,i,c){return $i(i,r.child,null,c),r=mf(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function Fb(r,i,c){r.lanes|=i;var p=r.alternate;p!==null&&(p.lanes|=i),_p(r.return,i,c)}function vf(r,i,c,p,v,x){var C=r.memoizedState;C===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:p,tail:c,tailMode:v,treeForkCount:x}:(C.isBackwards=i,C.rendering=null,C.renderingStartTime=0,C.last=p,C.tail=c,C.tailMode=v,C.treeForkCount=x)}function Hb(r,i,c){var p=i.pendingProps,v=p.revealOrder,x=p.tail;p=p.children;var C=Qt.current,D=(C&2)!==0;if(D?(C=C&1|2,i.flags|=128):C&=1,O(Qt,C),wn(r,i,p,c),p=ct?Mo:0,!D&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Fb(r,c,i);else if(r.tag===19)Fb(r,c,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(v){case"forwards":for(c=i.child,v=null;c!==null;)r=c.alternate,r!==null&&Rc(r)===null&&(v=c),c=c.sibling;c=v,c===null?(v=i.child,i.child=null):(v=c.sibling,c.sibling=null),vf(i,!1,v,c,x,p);break;case"backwards":case"unstable_legacy-backwards":for(c=null,v=i.child,i.child=null;v!==null;){if(r=v.alternate,r!==null&&Rc(r)===null){i.child=v;break}r=v.sibling,v.sibling=c,c=v,v=r}vf(i,!0,c,null,x,p);break;case"together":vf(i,!1,null,null,void 0,p);break;default:i.memoizedState=null}return i.child}function Sa(r,i,c){if(r!==null&&(i.dependencies=r.dependencies),ai|=i.lanes,(c&i.childLanes)===0)if(r!==null){if(Cs(r,i,c,!1),(c&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(a(153));if(i.child!==null){for(r=i.child,c=va(r,r.pendingProps),i.child=c,c.return=i;r.sibling!==null;)r=r.sibling,c=c.sibling=va(r,r.pendingProps),c.return=i;c.sibling=null}return i.child}function yf(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&Sc(r)))}function tT(r,i,c){switch(i.tag){case 3:_e(i,i.stateNode.containerInfo),Ya(i,nn,r.memoizedState.cache),Ri();break;case 27:case 5:Ie(i);break;case 4:_e(i,i.stateNode.containerInfo);break;case 10:Ya(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Fp(i),null;break;case 13:var p=i.memoizedState;if(p!==null)return p.dehydrated!==null?(ei(i),i.flags|=128,null):(c&i.child.childLanes)!==0?Bb(r,i,c):(ei(i),r=Sa(r,i,c),r!==null?r.sibling:null);ei(i);break;case 19:var v=(r.flags&128)!==0;if(p=(c&i.childLanes)!==0,p||(Cs(r,i,c,!1),p=(c&i.childLanes)!==0),v){if(p)return Hb(r,i,c);i.flags|=128}if(v=i.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),O(Qt,Qt.current),p)break;return null;case 22:return i.lanes=0,Db(r,i,c,i.pendingProps);case 24:Ya(i,nn,r.memoizedState.cache)}return Sa(r,i,c)}function qb(r,i,c){if(r!==null)if(r.memoizedProps!==i.pendingProps)an=!0;else{if(!yf(r,c)&&(i.flags&128)===0)return an=!1,tT(r,i,c);an=(r.flags&131072)!==0}else an=!1,ct&&(i.flags&1048576)!==0&&ky(i,Mo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var p=i.pendingProps;if(r=Di(i.elementType),i.type=r,typeof r=="function")kp(r)?(p=Pi(r,p),i.tag=1,i=Pb(null,i,r,p,c)):(i.tag=0,i=df(null,i,r,p,c));else{if(r!=null){var v=r.$$typeof;if(v===A){i.tag=11,i=Ob(null,i,r,p,c);break e}else if(v===z){i.tag=14,i=Lb(null,i,r,p,c);break e}}throw i=I(r)||r,Error(a(306,i,""))}}return i;case 0:return df(r,i,i.type,i.pendingProps,c);case 1:return p=i.type,v=Pi(p,i.pendingProps),Pb(r,i,p,v,c);case 3:e:{if(_e(i,i.stateNode.containerInfo),r===null)throw Error(a(387));p=i.pendingProps;var x=i.memoizedState;v=x.element,$p(r,i),Fo(i,p,null,c);var C=i.memoizedState;if(p=C.cache,Ya(i,nn,p),p!==x.cache&&Rp(i,[nn],c,!0),Bo(),p=C.element,x.isDehydrated)if(x={element:p,isDehydrated:!1,cache:C.cache},i.updateQueue.baseState=x,i.memoizedState=x,i.flags&256){i=Ub(r,i,p,c);break e}else if(p!==v){v=xr(Error(a(424)),i),Do(v),i=Ub(r,i,p,c);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Mt=Cr(r.firstChild),bn=i,ct=!0,Za=null,Sr=!0,c=Dy(i,null,p,c),i.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Ri(),p===v){i=Sa(r,i,c);break e}wn(r,i,p,c)}i=i.child}return i;case 26:return Fc(r,i),r===null?(c=tx(i.type,null,i.pendingProps,null))?i.memoizedState=c:ct||(c=i.type,r=i.pendingProps,p=iu(le.current).createElement(c),p[Gt]=i,p[un]=r,kn(p,c,r),Lt(p),i.stateNode=p):i.memoizedState=tx(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Ie(i),r===null&&ct&&(p=i.stateNode=X0(i.type,i.pendingProps,le.current),bn=i,Sr=!0,v=Mt,ci(i.type)?(Qf=v,Mt=Cr(p.firstChild)):Mt=v),wn(r,i,i.pendingProps.children,c),Fc(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&ct&&((v=p=Mt)&&(p=RT(p,i.type,i.pendingProps,Sr),p!==null?(i.stateNode=p,bn=i,Mt=Cr(p.firstChild),Sr=!1,v=!0):v=!1),v||Ka(i)),Ie(i),v=i.type,x=i.pendingProps,C=r!==null?r.memoizedProps:null,p=x.children,Vf(v,x)?p=null:C!==null&&Vf(v,C)&&(i.flags|=32),i.memoizedState!==null&&(v=qp(r,i,VE,null,null,c),ll._currentValue=v),Fc(r,i),wn(r,i,p,c),i.child;case 6:return r===null&&ct&&((r=c=Mt)&&(c=OT(c,i.pendingProps,Sr),c!==null?(i.stateNode=c,bn=i,Mt=null,r=!0):r=!1),r||Ka(i)),null;case 13:return Bb(r,i,c);case 4:return _e(i,i.stateNode.containerInfo),p=i.pendingProps,r===null?i.child=$i(i,null,p,c):wn(r,i,p,c),i.child;case 11:return Ob(r,i,i.type,i.pendingProps,c);case 7:return wn(r,i,i.pendingProps,c),i.child;case 8:return wn(r,i,i.pendingProps.children,c),i.child;case 12:return wn(r,i,i.pendingProps.children,c),i.child;case 10:return p=i.pendingProps,Ya(i,i.type,p.value),wn(r,i,p.children,c),i.child;case 9:return v=i.type._context,p=i.pendingProps.children,Li(i),v=xn(v),p=p(v),i.flags|=1,wn(r,i,p,c),i.child;case 14:return Lb(r,i,i.type,i.pendingProps,c);case 15:return Mb(r,i,i.type,i.pendingProps,c);case 19:return Hb(r,i,c);case 31:return eT(r,i,c);case 22:return Db(r,i,c,i.pendingProps);case 24:return Li(i),p=xn(nn),r===null?(v=Mp(),v===null&&(v=Et,x=Op(),v.pooledCache=x,x.refCount++,x!==null&&(v.pooledCacheLanes|=c),v=x),i.memoizedState={parent:p,cache:v},zp(i),Ya(i,nn,v)):((r.lanes&c)!==0&&($p(r,i),Fo(i,null,null,c),Bo()),v=r.memoizedState,x=i.memoizedState,v.parent!==p?(v={parent:p,cache:p},i.memoizedState=v,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=v),Ya(i,nn,p)):(p=x.cache,Ya(i,nn,p),p!==v.cache&&Rp(i,[nn],c,!0))),wn(r,i,i.pendingProps.children,c),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function ja(r){r.flags|=4}function bf(r,i,c,p,v){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(v&335544128)===v)if(r.stateNode.complete)r.flags|=8192;else if(v0())r.flags|=8192;else throw zi=Ec,Dp}else r.flags&=-16777217}function Gb(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!sx(i))if(v0())r.flags|=8192;else throw zi=Ec,Dp}function qc(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?qa():536870912,r.lanes|=i,$s|=i)}function Zo(r,i){if(!ct)switch(r.tailMode){case"hidden":i=r.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var p=null;c!==null;)c.alternate!==null&&(p=c),c=c.sibling;p===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:p.sibling=null}}function Dt(r){var i=r.alternate!==null&&r.alternate.child===r.child,c=0,p=0;if(i)for(var v=r.child;v!==null;)c|=v.lanes|v.childLanes,p|=v.subtreeFlags&65011712,p|=v.flags&65011712,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)c|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=p,r.childLanes=c,i}function nT(r,i,c){var p=i.pendingProps;switch(Np(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(i),null;case 1:return Dt(i),null;case 3:return c=i.stateNode,p=null,r!==null&&(p=r.memoizedState.cache),i.memoizedState.cache!==p&&(i.flags|=2048),xa(nn),Ee(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(js(i)?ja(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Tp())),Dt(i),null;case 26:var v=i.type,x=i.memoizedState;return r===null?(ja(i),x!==null?(Dt(i),Gb(i,x)):(Dt(i),bf(i,v,null,p,c))):x?x!==r.memoizedState?(ja(i),Dt(i),Gb(i,x)):(Dt(i),i.flags&=-16777217):(r=r.memoizedProps,r!==p&&ja(i),Dt(i),bf(i,v,r,p,c)),null;case 27:if(We(i),c=le.current,v=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==p&&ja(i);else{if(!p){if(i.stateNode===null)throw Error(a(166));return Dt(i),null}r=ne.current,js(i)?jy(i):(r=X0(v,p,c),i.stateNode=r,ja(i))}return Dt(i),null;case 5:if(We(i),v=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==p&&ja(i);else{if(!p){if(i.stateNode===null)throw Error(a(166));return Dt(i),null}if(x=ne.current,js(i))jy(i);else{var C=iu(le.current);switch(x){case 1:x=C.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:x=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":x=C.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":x=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":x=C.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof p.is=="string"?C.createElement("select",{is:p.is}):C.createElement("select"),p.multiple?x.multiple=!0:p.size&&(x.size=p.size);break;default:x=typeof p.is=="string"?C.createElement(v,{is:p.is}):C.createElement(v)}}x[Gt]=i,x[un]=p;e:for(C=i.child;C!==null;){if(C.tag===5||C.tag===6)x.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===i)break e;for(;C.sibling===null;){if(C.return===null||C.return===i)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}i.stateNode=x;e:switch(kn(x,v,p),v){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&ja(i)}}return Dt(i),bf(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,c),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==p&&ja(i);else{if(typeof p!="string"&&i.stateNode===null)throw Error(a(166));if(r=le.current,js(i)){if(r=i.stateNode,c=i.memoizedProps,p=null,v=bn,v!==null)switch(v.tag){case 27:case 5:p=v.memoizedProps}r[Gt]=i,r=!!(r.nodeValue===c||p!==null&&p.suppressHydrationWarning===!0||B0(r.nodeValue,c)),r||Ka(i,!0)}else r=iu(r).createTextNode(p),r[Gt]=i,i.stateNode=r}return Dt(i),null;case 31:if(c=i.memoizedState,r===null||r.memoizedState!==null){if(p=js(i),c!==null){if(r===null){if(!p)throw Error(a(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[Gt]=i}else Ri(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Dt(i),r=!1}else c=Tp(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return i.flags&256?(Jn(i),i):(Jn(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Dt(i),null;case 13:if(p=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(v=js(i),p!==null&&p.dehydrated!==null){if(r===null){if(!v)throw Error(a(318));if(v=i.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(a(317));v[Gt]=i}else Ri(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Dt(i),v=!1}else v=Tp(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=v),v=!0;if(!v)return i.flags&256?(Jn(i),i):(Jn(i),null)}return Jn(i),(i.flags&128)!==0?(i.lanes=c,i):(c=p!==null,r=r!==null&&r.memoizedState!==null,c&&(p=i.child,v=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(v=p.alternate.memoizedState.cachePool.pool),x=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(x=p.memoizedState.cachePool.pool),x!==v&&(p.flags|=2048)),c!==r&&c&&(i.child.flags|=8192),qc(i,i.updateQueue),Dt(i),null);case 4:return Ee(),r===null&&Bf(i.stateNode.containerInfo),Dt(i),null;case 10:return xa(i.type),Dt(i),null;case 19:if(G(Qt),p=i.memoizedState,p===null)return Dt(i),null;if(v=(i.flags&128)!==0,x=p.rendering,x===null)if(v)Zo(p,!1);else{if(Kt!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(x=Rc(r),x!==null){for(i.flags|=128,Zo(p,!1),r=x.updateQueue,i.updateQueue=r,qc(i,r),i.subtreeFlags=0,r=c,c=i.child;c!==null;)by(c,r),c=c.sibling;return O(Qt,Qt.current&1|2),ct&&ya(i,p.treeForkCount),i.child}r=r.sibling}p.tail!==null&&ut()>Kc&&(i.flags|=128,v=!0,Zo(p,!1),i.lanes=4194304)}else{if(!v)if(r=Rc(x),r!==null){if(i.flags|=128,v=!0,r=r.updateQueue,i.updateQueue=r,qc(i,r),Zo(p,!0),p.tail===null&&p.tailMode==="hidden"&&!x.alternate&&!ct)return Dt(i),null}else 2*ut()-p.renderingStartTime>Kc&&c!==536870912&&(i.flags|=128,v=!0,Zo(p,!1),i.lanes=4194304);p.isBackwards?(x.sibling=i.child,i.child=x):(r=p.last,r!==null?r.sibling=x:i.child=x,p.last=x)}return p.tail!==null?(r=p.tail,p.rendering=r,p.tail=r.sibling,p.renderingStartTime=ut(),r.sibling=null,c=Qt.current,O(Qt,v?c&1|2:c&1),ct&&ya(i,p.treeForkCount),r):(Dt(i),null);case 22:case 23:return Jn(i),Bp(),p=i.memoizedState!==null,r!==null?r.memoizedState!==null!==p&&(i.flags|=8192):p&&(i.flags|=8192),p?(c&536870912)!==0&&(i.flags&128)===0&&(Dt(i),i.subtreeFlags&6&&(i.flags|=8192)):Dt(i),c=i.updateQueue,c!==null&&qc(i,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),p=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(p=i.memoizedState.cachePool.pool),p!==c&&(i.flags|=2048),r!==null&&G(Mi),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),i.memoizedState.cache!==c&&(i.flags|=2048),xa(nn),Dt(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function rT(r,i){switch(Np(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return xa(nn),Ee(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return We(i),null;case 31:if(i.memoizedState!==null){if(Jn(i),i.alternate===null)throw Error(a(340));Ri()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Jn(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Ri()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return G(Qt),null;case 4:return Ee(),null;case 10:return xa(i.type),null;case 22:case 23:return Jn(i),Bp(),r!==null&&G(Mi),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return xa(nn),null;case 25:return null;default:return null}}function Vb(r,i){switch(Np(i),i.tag){case 3:xa(nn),Ee();break;case 26:case 27:case 5:We(i);break;case 4:Ee();break;case 31:i.memoizedState!==null&&Jn(i);break;case 13:Jn(i);break;case 19:G(Qt);break;case 10:xa(i.type);break;case 22:case 23:Jn(i),Bp(),r!==null&&G(Mi);break;case 24:xa(nn)}}function Ko(r,i){try{var c=i.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var v=p.next;c=v;do{if((c.tag&r)===r){p=void 0;var x=c.create,C=c.inst;p=x(),C.destroy=p}c=c.next}while(c!==v)}}catch(D){kt(i,i.return,D)}}function ni(r,i,c){try{var p=i.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var x=v.next;p=x;do{if((p.tag&r)===r){var C=p.inst,D=C.destroy;if(D!==void 0){C.destroy=void 0,v=i;var K=c,ae=D;try{ae()}catch(pe){kt(v,K,pe)}}}p=p.next}while(p!==x)}}catch(pe){kt(i,i.return,pe)}}function Wb(r){var i=r.updateQueue;if(i!==null){var c=r.stateNode;try{$y(i,c)}catch(p){kt(r,r.return,p)}}}function Zb(r,i,c){c.props=Pi(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(p){kt(r,i,p)}}function Yo(r,i){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var p=r.stateNode;break;case 30:p=r.stateNode;break;default:p=r.stateNode}typeof c=="function"?r.refCleanup=c(p):c.current=p}}catch(v){kt(r,i,v)}}function Zr(r,i){var c=r.ref,p=r.refCleanup;if(c!==null)if(typeof p=="function")try{p()}catch(v){kt(r,i,v)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(v){kt(r,i,v)}else c.current=null}function Kb(r){var i=r.type,c=r.memoizedProps,p=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":c.autoFocus&&p.focus();break e;case"img":c.src?p.src=c.src:c.srcSet&&(p.srcset=c.srcSet)}}catch(v){kt(r,r.return,v)}}function xf(r,i,c){try{var p=r.stateNode;CT(p,r.type,c,i),p[un]=i}catch(v){kt(r,r.return,v)}}function Yb(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ci(r.type)||r.tag===4}function wf(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Yb(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ci(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function kf(r,i,c){var p=r.tag;if(p===5||p===6)r=r.stateNode,i?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,i):(i=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,i.appendChild(r),c=c._reactRootContainer,c!=null||i.onclick!==null||(i.onclick=ma));else if(p!==4&&(p===27&&ci(r.type)&&(c=r.stateNode,i=null),r=r.child,r!==null))for(kf(r,i,c),r=r.sibling;r!==null;)kf(r,i,c),r=r.sibling}function Gc(r,i,c){var p=r.tag;if(p===5||p===6)r=r.stateNode,i?c.insertBefore(r,i):c.appendChild(r);else if(p!==4&&(p===27&&ci(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Gc(r,i,c),r=r.sibling;r!==null;)Gc(r,i,c),r=r.sibling}function Qb(r){var i=r.stateNode,c=r.memoizedProps;try{for(var p=r.type,v=i.attributes;v.length;)i.removeAttributeNode(v[0]);kn(i,p,c),i[Gt]=r,i[un]=c}catch(x){kt(r,r.return,x)}}var Ca=!1,sn=!1,Sf=!1,Xb=typeof WeakSet=="function"?WeakSet:Set,vn=null;function aT(r,i){if(r=r.containerInfo,qf=pu,r=uy(r),mp(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var p=c.getSelection&&c.getSelection();if(p&&p.rangeCount!==0){c=p.anchorNode;var v=p.anchorOffset,x=p.focusNode;p=p.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var C=0,D=-1,K=-1,ae=0,pe=0,me=r,se=null;t:for(;;){for(var oe;me!==c||v!==0&&me.nodeType!==3||(D=C+v),me!==x||p!==0&&me.nodeType!==3||(K=C+p),me.nodeType===3&&(C+=me.nodeValue.length),(oe=me.firstChild)!==null;)se=me,me=oe;for(;;){if(me===r)break t;if(se===c&&++ae===v&&(D=C),se===x&&++pe===p&&(K=C),(oe=me.nextSibling)!==null)break;me=se,se=me.parentNode}me=oe}c=D===-1||K===-1?null:{start:D,end:K}}else c=null}c=c||{start:0,end:0}}else c=null;for(Gf={focusedElem:r,selectionRange:c},pu=!1,vn=i;vn!==null;)if(i=vn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,vn=r;else for(;vn!==null;){switch(i=vn,x=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)v=r[c],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&x!==null){r=void 0,c=i,v=x.memoizedProps,x=x.memoizedState,p=c.stateNode;try{var Ae=Pi(c.type,v);r=p.getSnapshotBeforeUpdate(Ae,x),p.__reactInternalSnapshotBeforeUpdate=r}catch(Be){kt(c,c.return,Be)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,c=r.nodeType,c===9)Zf(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Zf(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=i.sibling,r!==null){r.return=i.return,vn=r;break}vn=i.return}}function Jb(r,i,c){var p=c.flags;switch(c.tag){case 0:case 11:case 15:Ea(r,c),p&4&&Ko(5,c);break;case 1:if(Ea(r,c),p&4)if(r=c.stateNode,i===null)try{r.componentDidMount()}catch(C){kt(c,c.return,C)}else{var v=Pi(c.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(v,i,r.__reactInternalSnapshotBeforeUpdate)}catch(C){kt(c,c.return,C)}}p&64&&Wb(c),p&512&&Yo(c,c.return);break;case 3:if(Ea(r,c),p&64&&(r=c.updateQueue,r!==null)){if(i=null,c.child!==null)switch(c.child.tag){case 27:case 5:i=c.child.stateNode;break;case 1:i=c.child.stateNode}try{$y(r,i)}catch(C){kt(c,c.return,C)}}break;case 27:i===null&&p&4&&Qb(c);case 26:case 5:Ea(r,c),i===null&&p&4&&Kb(c),p&512&&Yo(c,c.return);break;case 12:Ea(r,c);break;case 31:Ea(r,c),p&4&&n0(r,c);break;case 13:Ea(r,c),p&4&&r0(r,c),p&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=fT.bind(null,c),LT(r,c))));break;case 22:if(p=c.memoizedState!==null||Ca,!p){i=i!==null&&i.memoizedState!==null||sn,v=Ca;var x=sn;Ca=p,(sn=i)&&!x?Ta(r,c,(c.subtreeFlags&8772)!==0):Ea(r,c),Ca=v,sn=x}break;case 30:break;default:Ea(r,c)}}function e0(r){var i=r.alternate;i!==null&&(r.alternate=null,e0(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Ga(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var It=null,Pn=!1;function Na(r,i,c){for(c=c.child;c!==null;)t0(r,i,c),c=c.sibling}function t0(r,i,c){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(Ce,c)}catch{}switch(c.tag){case 26:sn||Zr(c,i),Na(r,i,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:sn||Zr(c,i);var p=It,v=Pn;ci(c.type)&&(It=c.stateNode,Pn=!1),Na(r,i,c),il(c.stateNode),It=p,Pn=v;break;case 5:sn||Zr(c,i);case 6:if(p=It,v=Pn,It=null,Na(r,i,c),It=p,Pn=v,It!==null)if(Pn)try{(It.nodeType===9?It.body:It.nodeName==="HTML"?It.ownerDocument.body:It).removeChild(c.stateNode)}catch(x){kt(c,i,x)}else try{It.removeChild(c.stateNode)}catch(x){kt(c,i,x)}break;case 18:It!==null&&(Pn?(r=It,W0(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),Gs(r)):W0(It,c.stateNode));break;case 4:p=It,v=Pn,It=c.stateNode.containerInfo,Pn=!0,Na(r,i,c),It=p,Pn=v;break;case 0:case 11:case 14:case 15:ni(2,c,i),sn||ni(4,c,i),Na(r,i,c);break;case 1:sn||(Zr(c,i),p=c.stateNode,typeof p.componentWillUnmount=="function"&&Zb(c,i,p)),Na(r,i,c);break;case 21:Na(r,i,c);break;case 22:sn=(p=sn)||c.memoizedState!==null,Na(r,i,c),sn=p;break;default:Na(r,i,c)}}function n0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Gs(r)}catch(c){kt(i,i.return,c)}}}function r0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Gs(r)}catch(c){kt(i,i.return,c)}}function iT(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new Xb),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new Xb),i;default:throw Error(a(435,r.tag))}}function Vc(r,i){var c=iT(r);i.forEach(function(p){if(!c.has(p)){c.add(p);var v=hT.bind(null,r,p);p.then(v,v)}})}function Un(r,i){var c=i.deletions;if(c!==null)for(var p=0;p<c.length;p++){var v=c[p],x=r,C=i,D=C;e:for(;D!==null;){switch(D.tag){case 27:if(ci(D.type)){It=D.stateNode,Pn=!1;break e}break;case 5:It=D.stateNode,Pn=!1;break e;case 3:case 4:It=D.stateNode.containerInfo,Pn=!0;break e}D=D.return}if(It===null)throw Error(a(160));t0(x,C,v),It=null,Pn=!1,x=v.alternate,x!==null&&(x.return=null),v.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)a0(i,r),i=i.sibling}var Mr=null;function a0(r,i){var c=r.alternate,p=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Un(i,r),Bn(r),p&4&&(ni(3,r,r.return),Ko(3,r),ni(5,r,r.return));break;case 1:Un(i,r),Bn(r),p&512&&(sn||c===null||Zr(c,c.return)),p&64&&Ca&&(r=r.updateQueue,r!==null&&(p=r.callbacks,p!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?p:c.concat(p))));break;case 26:var v=Mr;if(Un(i,r),Bn(r),p&512&&(sn||c===null||Zr(c,c.return)),p&4){var x=c!==null?c.memoizedState:null;if(p=r.memoizedState,c===null)if(p===null)if(r.stateNode===null){e:{p=r.type,c=r.memoizedProps,v=v.ownerDocument||v;t:switch(p){case"title":x=v.getElementsByTagName("title")[0],(!x||x[Or]||x[Gt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=v.createElement(p),v.head.insertBefore(x,v.querySelector("head > title"))),kn(x,p,c),x[Gt]=r,Lt(x),p=x;break e;case"link":var C=ax("link","href",v).get(p+(c.href||""));if(C){for(var D=0;D<C.length;D++)if(x=C[D],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){C.splice(D,1);break t}}x=v.createElement(p),kn(x,p,c),v.head.appendChild(x);break;case"meta":if(C=ax("meta","content",v).get(p+(c.content||""))){for(D=0;D<C.length;D++)if(x=C[D],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){C.splice(D,1);break t}}x=v.createElement(p),kn(x,p,c),v.head.appendChild(x);break;default:throw Error(a(468,p))}x[Gt]=r,Lt(x),p=x}r.stateNode=p}else ix(v,r.type,r.stateNode);else r.stateNode=rx(v,p,r.memoizedProps);else x!==p?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,p===null?ix(v,r.type,r.stateNode):rx(v,p,r.memoizedProps)):p===null&&r.stateNode!==null&&xf(r,r.memoizedProps,c.memoizedProps)}break;case 27:Un(i,r),Bn(r),p&512&&(sn||c===null||Zr(c,c.return)),c!==null&&p&4&&xf(r,r.memoizedProps,c.memoizedProps);break;case 5:if(Un(i,r),Bn(r),p&512&&(sn||c===null||Zr(c,c.return)),r.flags&32){v=r.stateNode;try{hs(v,"")}catch(Ae){kt(r,r.return,Ae)}}p&4&&r.stateNode!=null&&(v=r.memoizedProps,xf(r,v,c!==null?c.memoizedProps:v)),p&1024&&(Sf=!0);break;case 6:if(Un(i,r),Bn(r),p&4){if(r.stateNode===null)throw Error(a(162));p=r.memoizedProps,c=r.stateNode;try{c.nodeValue=p}catch(Ae){kt(r,r.return,Ae)}}break;case 3:if(lu=null,v=Mr,Mr=su(i.containerInfo),Un(i,r),Mr=v,Bn(r),p&4&&c!==null&&c.memoizedState.isDehydrated)try{Gs(i.containerInfo)}catch(Ae){kt(r,r.return,Ae)}Sf&&(Sf=!1,i0(r));break;case 4:p=Mr,Mr=su(r.stateNode.containerInfo),Un(i,r),Bn(r),Mr=p;break;case 12:Un(i,r),Bn(r);break;case 31:Un(i,r),Bn(r),p&4&&(p=r.updateQueue,p!==null&&(r.updateQueue=null,Vc(r,p)));break;case 13:Un(i,r),Bn(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Zc=ut()),p&4&&(p=r.updateQueue,p!==null&&(r.updateQueue=null,Vc(r,p)));break;case 22:v=r.memoizedState!==null;var K=c!==null&&c.memoizedState!==null,ae=Ca,pe=sn;if(Ca=ae||v,sn=pe||K,Un(i,r),sn=pe,Ca=ae,Bn(r),p&8192)e:for(i=r.stateNode,i._visibility=v?i._visibility&-2:i._visibility|1,v&&(c===null||K||Ca||sn||Ui(r)),c=null,i=r;;){if(i.tag===5||i.tag===26){if(c===null){K=c=i;try{if(x=K.stateNode,v)C=x.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{D=K.stateNode;var me=K.memoizedProps.style,se=me!=null&&me.hasOwnProperty("display")?me.display:null;D.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Ae){kt(K,K.return,Ae)}}}else if(i.tag===6){if(c===null){K=i;try{K.stateNode.nodeValue=v?"":K.memoizedProps}catch(Ae){kt(K,K.return,Ae)}}}else if(i.tag===18){if(c===null){K=i;try{var oe=K.stateNode;v?Z0(oe,!0):Z0(K.stateNode,!1)}catch(Ae){kt(K,K.return,Ae)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;c===i&&(c=null),i=i.return}c===i&&(c=null),i.sibling.return=i.return,i=i.sibling}p&4&&(p=r.updateQueue,p!==null&&(c=p.retryQueue,c!==null&&(p.retryQueue=null,Vc(r,c))));break;case 19:Un(i,r),Bn(r),p&4&&(p=r.updateQueue,p!==null&&(r.updateQueue=null,Vc(r,p)));break;case 30:break;case 21:break;default:Un(i,r),Bn(r)}}function Bn(r){var i=r.flags;if(i&2){try{for(var c,p=r.return;p!==null;){if(Yb(p)){c=p;break}p=p.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var v=c.stateNode,x=wf(r);Gc(r,x,v);break;case 5:var C=c.stateNode;c.flags&32&&(hs(C,""),c.flags&=-33);var D=wf(r);Gc(r,D,C);break;case 3:case 4:var K=c.stateNode.containerInfo,ae=wf(r);kf(r,ae,K);break;default:throw Error(a(161))}}catch(pe){kt(r,r.return,pe)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function i0(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;i0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ea(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Jb(r,i.alternate,i),i=i.sibling}function Ui(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:ni(4,i,i.return),Ui(i);break;case 1:Zr(i,i.return);var c=i.stateNode;typeof c.componentWillUnmount=="function"&&Zb(i,i.return,c),Ui(i);break;case 27:il(i.stateNode);case 26:case 5:Zr(i,i.return),Ui(i);break;case 22:i.memoizedState===null&&Ui(i);break;case 30:Ui(i);break;default:Ui(i)}r=r.sibling}}function Ta(r,i,c){for(c=c&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var p=i.alternate,v=r,x=i,C=x.flags;switch(x.tag){case 0:case 11:case 15:Ta(v,x,c),Ko(4,x);break;case 1:if(Ta(v,x,c),p=x,v=p.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ae){kt(p,p.return,ae)}if(p=x,v=p.updateQueue,v!==null){var D=p.stateNode;try{var K=v.shared.hiddenCallbacks;if(K!==null)for(v.shared.hiddenCallbacks=null,v=0;v<K.length;v++)zy(K[v],D)}catch(ae){kt(p,p.return,ae)}}c&&C&64&&Wb(x),Yo(x,x.return);break;case 27:Qb(x);case 26:case 5:Ta(v,x,c),c&&p===null&&C&4&&Kb(x),Yo(x,x.return);break;case 12:Ta(v,x,c);break;case 31:Ta(v,x,c),c&&C&4&&n0(v,x);break;case 13:Ta(v,x,c),c&&C&4&&r0(v,x);break;case 22:x.memoizedState===null&&Ta(v,x,c),Yo(x,x.return);break;case 30:break;default:Ta(v,x,c)}i=i.sibling}}function jf(r,i){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&zo(c))}function Cf(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&zo(r))}function Dr(r,i,c,p){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)s0(r,i,c,p),i=i.sibling}function s0(r,i,c,p){var v=i.flags;switch(i.tag){case 0:case 11:case 15:Dr(r,i,c,p),v&2048&&Ko(9,i);break;case 1:Dr(r,i,c,p);break;case 3:Dr(r,i,c,p),v&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&zo(r)));break;case 12:if(v&2048){Dr(r,i,c,p),r=i.stateNode;try{var x=i.memoizedProps,C=x.id,D=x.onPostCommit;typeof D=="function"&&D(C,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(K){kt(i,i.return,K)}}else Dr(r,i,c,p);break;case 31:Dr(r,i,c,p);break;case 13:Dr(r,i,c,p);break;case 23:break;case 22:x=i.stateNode,C=i.alternate,i.memoizedState!==null?x._visibility&2?Dr(r,i,c,p):Qo(r,i):x._visibility&2?Dr(r,i,c,p):(x._visibility|=2,Ms(r,i,c,p,(i.subtreeFlags&10256)!==0||!1)),v&2048&&jf(C,i);break;case 24:Dr(r,i,c,p),v&2048&&Cf(i.alternate,i);break;default:Dr(r,i,c,p)}}function Ms(r,i,c,p,v){for(v=v&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var x=r,C=i,D=c,K=p,ae=C.flags;switch(C.tag){case 0:case 11:case 15:Ms(x,C,D,K,v),Ko(8,C);break;case 23:break;case 22:var pe=C.stateNode;C.memoizedState!==null?pe._visibility&2?Ms(x,C,D,K,v):Qo(x,C):(pe._visibility|=2,Ms(x,C,D,K,v)),v&&ae&2048&&jf(C.alternate,C);break;case 24:Ms(x,C,D,K,v),v&&ae&2048&&Cf(C.alternate,C);break;default:Ms(x,C,D,K,v)}i=i.sibling}}function Qo(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var c=r,p=i,v=p.flags;switch(p.tag){case 22:Qo(c,p),v&2048&&jf(p.alternate,p);break;case 24:Qo(c,p),v&2048&&Cf(p.alternate,p);break;default:Qo(c,p)}i=i.sibling}}var Xo=8192;function Ds(r,i,c){if(r.subtreeFlags&Xo)for(r=r.child;r!==null;)o0(r,i,c),r=r.sibling}function o0(r,i,c){switch(r.tag){case 26:Ds(r,i,c),r.flags&Xo&&r.memoizedState!==null&&GT(c,Mr,r.memoizedState,r.memoizedProps);break;case 5:Ds(r,i,c);break;case 3:case 4:var p=Mr;Mr=su(r.stateNode.containerInfo),Ds(r,i,c),Mr=p;break;case 22:r.memoizedState===null&&(p=r.alternate,p!==null&&p.memoizedState!==null?(p=Xo,Xo=16777216,Ds(r,i,c),Xo=p):Ds(r,i,c));break;default:Ds(r,i,c)}}function l0(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function Jo(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var p=i[c];vn=p,u0(p,r)}l0(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)c0(r),r=r.sibling}function c0(r){switch(r.tag){case 0:case 11:case 15:Jo(r),r.flags&2048&&ni(9,r,r.return);break;case 3:Jo(r);break;case 12:Jo(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Wc(r)):Jo(r);break;default:Jo(r)}}function Wc(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var p=i[c];vn=p,u0(p,r)}l0(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:ni(8,i,i.return),Wc(i);break;case 22:c=i.stateNode,c._visibility&2&&(c._visibility&=-3,Wc(i));break;default:Wc(i)}r=r.sibling}}function u0(r,i){for(;vn!==null;){var c=vn;switch(c.tag){case 0:case 11:case 15:ni(8,c,i);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var p=c.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:zo(c.memoizedState.cache)}if(p=c.child,p!==null)p.return=c,vn=p;else e:for(c=r;vn!==null;){p=vn;var v=p.sibling,x=p.return;if(e0(p),p===c){vn=null;break e}if(v!==null){v.return=x,vn=v;break e}vn=x}}}var sT={getCacheForType:function(r){var i=xn(nn),c=i.data.get(r);return c===void 0&&(c=r(),i.data.set(r,c)),c},cacheSignal:function(){return xn(nn).controller.signal}},oT=typeof WeakMap=="function"?WeakMap:Map,yt=0,Et=null,nt=null,st=0,wt=0,er=null,ri=!1,zs=!1,Nf=!1,Aa=0,Kt=0,ai=0,Bi=0,Ef=0,tr=0,$s=0,el=null,Fn=null,Tf=!1,Zc=0,d0=0,Kc=1/0,Yc=null,ii=null,dn=0,si=null,Is=null,_a=0,Af=0,_f=null,p0=null,tl=0,Rf=null;function nr(){return(yt&2)!==0&&st!==0?st&-st:H.T!==null?$f():Ke()}function f0(){if(tr===0)if((st&536870912)===0||ct){var r=Fa;Fa<<=1,(Fa&3932160)===0&&(Fa=262144),tr=r}else tr=536870912;return r=Xn.current,r!==null&&(r.flags|=32),tr}function Hn(r,i,c){(r===Et&&(wt===2||wt===9)||r.cancelPendingCommit!==null)&&(Ps(r,0),oi(r,st,tr,!1)),ge(r,c),((yt&2)===0||r!==Et)&&(r===Et&&((yt&2)===0&&(Bi|=c),Kt===4&&oi(r,st,tr,!1)),Kr(r))}function h0(r,i,c){if((yt&6)!==0)throw Error(a(327));var p=!c&&(i&127)===0&&(i&r.expiredLanes)===0||ca(r,i),v=p?uT(r,i):Lf(r,i,!0),x=p;do{if(v===0){zs&&!p&&oi(r,i,0,!1);break}else{if(c=r.current.alternate,x&&!lT(c)){v=Lf(r,i,!1),x=!1;continue}if(v===2){if(x=i,r.errorRecoveryDisabledLanes&x)var C=0;else C=r.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){i=C;e:{var D=r;v=el;var K=D.current.memoizedState.isDehydrated;if(K&&(Ps(D,C).flags|=256),C=Lf(D,C,!1),C!==2){if(Nf&&!K){D.errorRecoveryDisabledLanes|=x,Bi|=x,v=4;break e}x=Fn,Fn=v,x!==null&&(Fn===null?Fn=x:Fn.push.apply(Fn,x))}v=C}if(x=!1,v!==2)continue}}if(v===1){Ps(r,0),oi(r,i,0,!0);break}e:{switch(p=r,x=v,x){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:oi(p,i,tr,!ri);break e;case 2:Fn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(v=Zc+300-ut(),10<v)){if(oi(p,i,tr,!ri),qr(p,0,!0)!==0)break e;_a=i,p.timeoutHandle=G0(m0.bind(null,p,c,Fn,Yc,Tf,i,tr,Bi,$s,ri,x,"Throttled",-0,0),v);break e}m0(p,c,Fn,Yc,Tf,i,tr,Bi,$s,ri,x,null,-0,0)}}break}while(!0);Kr(r)}function m0(r,i,c,p,v,x,C,D,K,ae,pe,me,se,oe){if(r.timeoutHandle=-1,me=i.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ma},o0(i,x,me);var Ae=(x&62914560)===x?Zc-ut():(x&4194048)===x?d0-ut():0;if(Ae=VT(me,Ae),Ae!==null){_a=x,r.cancelPendingCommit=Ae(S0.bind(null,r,i,x,c,p,v,C,D,K,pe,me,null,se,oe)),oi(r,x,C,!ae);return}}S0(r,i,x,c,p,v,C,D,K)}function lT(r){for(var i=r;;){var c=i.tag;if((c===0||c===11||c===15)&&i.flags&16384&&(c=i.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var p=0;p<c.length;p++){var v=c[p],x=v.getSnapshot;v=v.value;try{if(!Yn(x(),v))return!1}catch{return!1}}if(c=i.child,i.subtreeFlags&16384&&c!==null)c.return=i,i=c;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function oi(r,i,c,p){i&=~Ef,i&=~Bi,r.suspendedLanes|=i,r.pingedLanes&=~i,p&&(r.warmLanes|=i),p=r.expirationTimes;for(var v=i;0<v;){var x=31-Ne(v),C=1<<x;p[x]=-1,v&=~C}c!==0&&de(r,c,i)}function Qc(){return(yt&6)===0?(nl(0),!1):!0}function Of(){if(nt!==null){if(wt===0)var r=nt.return;else r=nt,ba=Oi=null,Wp(r),As=null,Io=0,r=nt;for(;r!==null;)Vb(r.alternate,r),r=r.return;nt=null}}function Ps(r,i){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,TT(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),_a=0,Of(),Et=r,nt=c=va(r.current,null),st=i,wt=0,er=null,ri=!1,zs=ca(r,i),Nf=!1,$s=tr=Ef=Bi=ai=Kt=0,Fn=el=null,Tf=!1,(i&8)!==0&&(i|=i&32);var p=r.entangledLanes;if(p!==0)for(r=r.entanglements,p&=i;0<p;){var v=31-Ne(p),x=1<<v;i|=r[v],p&=~x}return Aa=i,yc(),c}function g0(r,i){Ye=null,H.H=Vo,i===Ts||i===Nc?(i=Oy(),wt=3):i===Dp?(i=Oy(),wt=4):wt=i===uf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,er=i,nt===null&&(Kt=1,Uc(r,xr(i,r.current)))}function v0(){var r=Xn.current;return r===null?!0:(st&4194048)===st?jr===null:(st&62914560)===st||(st&536870912)!==0?r===jr:!1}function y0(){var r=H.H;return H.H=Vo,r===null?Vo:r}function b0(){var r=H.A;return H.A=sT,r}function Xc(){Kt=4,ri||(st&4194048)!==st&&Xn.current!==null||(zs=!0),(ai&134217727)===0&&(Bi&134217727)===0||Et===null||oi(Et,st,tr,!1)}function Lf(r,i,c){var p=yt;yt|=2;var v=y0(),x=b0();(Et!==r||st!==i)&&(Yc=null,Ps(r,i)),i=!1;var C=Kt;e:do try{if(wt!==0&&nt!==null){var D=nt,K=er;switch(wt){case 8:Of(),C=6;break e;case 3:case 2:case 9:case 6:Xn.current===null&&(i=!0);var ae=wt;if(wt=0,er=null,Us(r,D,K,ae),c&&zs){C=0;break e}break;default:ae=wt,wt=0,er=null,Us(r,D,K,ae)}}cT(),C=Kt;break}catch(pe){g0(r,pe)}while(!0);return i&&r.shellSuspendCounter++,ba=Oi=null,yt=p,H.H=v,H.A=x,nt===null&&(Et=null,st=0,yc()),C}function cT(){for(;nt!==null;)x0(nt)}function uT(r,i){var c=yt;yt|=2;var p=y0(),v=b0();Et!==r||st!==i?(Yc=null,Kc=ut()+500,Ps(r,i)):zs=ca(r,i);e:do try{if(wt!==0&&nt!==null){i=nt;var x=er;t:switch(wt){case 1:wt=0,er=null,Us(r,i,x,1);break;case 2:case 9:if(_y(x)){wt=0,er=null,w0(i);break}i=function(){wt!==2&&wt!==9||Et!==r||(wt=7),Kr(r)},x.then(i,i);break e;case 3:wt=7;break e;case 4:wt=5;break e;case 7:_y(x)?(wt=0,er=null,w0(i)):(wt=0,er=null,Us(r,i,x,7));break;case 5:var C=null;switch(nt.tag){case 26:C=nt.memoizedState;case 5:case 27:var D=nt;if(C?sx(C):D.stateNode.complete){wt=0,er=null;var K=D.sibling;if(K!==null)nt=K;else{var ae=D.return;ae!==null?(nt=ae,Jc(ae)):nt=null}break t}}wt=0,er=null,Us(r,i,x,5);break;case 6:wt=0,er=null,Us(r,i,x,6);break;case 8:Of(),Kt=6;break e;default:throw Error(a(462))}}dT();break}catch(pe){g0(r,pe)}while(!0);return ba=Oi=null,H.H=p,H.A=v,yt=c,nt!==null?0:(Et=null,st=0,yc(),Kt)}function dT(){for(;nt!==null&&!Yt();)x0(nt)}function x0(r){var i=qb(r.alternate,r,Aa);r.memoizedProps=r.pendingProps,i===null?Jc(r):nt=i}function w0(r){var i=r,c=i.alternate;switch(i.tag){case 15:case 0:i=Ib(c,i,i.pendingProps,i.type,void 0,st);break;case 11:i=Ib(c,i,i.pendingProps,i.type.render,i.ref,st);break;case 5:Wp(i);default:Vb(c,i),i=nt=by(i,Aa),i=qb(c,i,Aa)}r.memoizedProps=r.pendingProps,i===null?Jc(r):nt=i}function Us(r,i,c,p){ba=Oi=null,Wp(i),As=null,Io=0;var v=i.return;try{if(JE(r,v,i,c,st)){Kt=1,Uc(r,xr(c,r.current)),nt=null;return}}catch(x){if(v!==null)throw nt=v,x;Kt=1,Uc(r,xr(c,r.current)),nt=null;return}i.flags&32768?(ct||p===1?r=!0:zs||(st&536870912)!==0?r=!1:(ri=r=!0,(p===2||p===9||p===3||p===6)&&(p=Xn.current,p!==null&&p.tag===13&&(p.flags|=16384))),k0(i,r)):Jc(i)}function Jc(r){var i=r;do{if((i.flags&32768)!==0){k0(i,ri);return}r=i.return;var c=nT(i.alternate,i,Aa);if(c!==null){nt=c;return}if(i=i.sibling,i!==null){nt=i;return}nt=i=r}while(i!==null);Kt===0&&(Kt=5)}function k0(r,i){do{var c=rT(r.alternate,r);if(c!==null){c.flags&=32767,nt=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!i&&(r=r.sibling,r!==null)){nt=r;return}nt=r=c}while(r!==null);Kt=6,nt=null}function S0(r,i,c,p,v,x,C,D,K){r.cancelPendingCommit=null;do eu();while(dn!==0);if((yt&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(x=i.lanes|i.childLanes,x|=xp,Me(r,c,x,C,D,K),r===Et&&(nt=Et=null,st=0),Is=i,si=r,_a=c,Af=x,_f=v,p0=p,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,mT(ee,function(){return T0(),null})):(r.callbackNode=null,r.callbackPriority=0),p=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||p){p=H.T,H.T=null,v=V.p,V.p=2,C=yt,yt|=4;try{aT(r,i,c)}finally{yt=C,V.p=v,H.T=p}}dn=1,j0(),C0(),N0()}}function j0(){if(dn===1){dn=0;var r=si,i=Is,c=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||c){c=H.T,H.T=null;var p=V.p;V.p=2;var v=yt;yt|=4;try{a0(i,r);var x=Gf,C=uy(r.containerInfo),D=x.focusedElem,K=x.selectionRange;if(C!==D&&D&&D.ownerDocument&&cy(D.ownerDocument.documentElement,D)){if(K!==null&&mp(D)){var ae=K.start,pe=K.end;if(pe===void 0&&(pe=ae),"selectionStart"in D)D.selectionStart=ae,D.selectionEnd=Math.min(pe,D.value.length);else{var me=D.ownerDocument||document,se=me&&me.defaultView||window;if(se.getSelection){var oe=se.getSelection(),Ae=D.textContent.length,Be=Math.min(K.start,Ae),Ct=K.end===void 0?Be:Math.min(K.end,Ae);!oe.extend&&Be>Ct&&(C=Ct,Ct=Be,Be=C);var te=ly(D,Be),J=ly(D,Ct);if(te&&J&&(oe.rangeCount!==1||oe.anchorNode!==te.node||oe.anchorOffset!==te.offset||oe.focusNode!==J.node||oe.focusOffset!==J.offset)){var re=me.createRange();re.setStart(te.node,te.offset),oe.removeAllRanges(),Be>Ct?(oe.addRange(re),oe.extend(J.node,J.offset)):(re.setEnd(J.node,J.offset),oe.addRange(re))}}}}for(me=[],oe=D;oe=oe.parentNode;)oe.nodeType===1&&me.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;D<me.length;D++){var fe=me[D];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}pu=!!qf,Gf=qf=null}finally{yt=v,V.p=p,H.T=c}}r.current=i,dn=2}}function C0(){if(dn===2){dn=0;var r=si,i=Is,c=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||c){c=H.T,H.T=null;var p=V.p;V.p=2;var v=yt;yt|=4;try{Jb(r,i.alternate,i)}finally{yt=v,V.p=p,H.T=c}}dn=3}}function N0(){if(dn===4||dn===3){dn=0,qt();var r=si,i=Is,c=_a,p=p0;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?dn=5:(dn=0,Is=si=null,E0(r,r.pendingLanes));var v=r.pendingLanes;if(v===0&&(ii=null),Je(c),i=i.stateNode,Fe&&typeof Fe.onCommitFiberRoot=="function")try{Fe.onCommitFiberRoot(Ce,i,void 0,(i.current.flags&128)===128)}catch{}if(p!==null){i=H.T,v=V.p,V.p=2,H.T=null;try{for(var x=r.onRecoverableError,C=0;C<p.length;C++){var D=p[C];x(D.value,{componentStack:D.stack})}}finally{H.T=i,V.p=v}}(_a&3)!==0&&eu(),Kr(r),v=r.pendingLanes,(c&261930)!==0&&(v&42)!==0?r===Rf?tl++:(tl=0,Rf=r):tl=0,nl(0)}}function E0(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,zo(i)))}function eu(){return j0(),C0(),N0(),T0()}function T0(){if(dn!==5)return!1;var r=si,i=Af;Af=0;var c=Je(_a),p=H.T,v=V.p;try{V.p=32>c?32:c,H.T=null,c=_f,_f=null;var x=si,C=_a;if(dn=0,Is=si=null,_a=0,(yt&6)!==0)throw Error(a(331));var D=yt;if(yt|=4,c0(x.current),s0(x,x.current,C,c),yt=D,nl(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(Ce,x)}catch{}return!0}finally{V.p=v,H.T=p,E0(r,i)}}function A0(r,i,c){i=xr(c,i),i=cf(r.stateNode,i,2),r=Ja(r,i,2),r!==null&&(ge(r,2),Kr(r))}function kt(r,i,c){if(r.tag===3)A0(r,r,c);else for(;i!==null;){if(i.tag===3){A0(i,r,c);break}else if(i.tag===1){var p=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(ii===null||!ii.has(p))){r=xr(c,r),c=_b(2),p=Ja(i,c,2),p!==null&&(Rb(c,p,i,r),ge(p,2),Kr(p));break}}i=i.return}}function Mf(r,i,c){var p=r.pingCache;if(p===null){p=r.pingCache=new oT;var v=new Set;p.set(i,v)}else v=p.get(i),v===void 0&&(v=new Set,p.set(i,v));v.has(c)||(Nf=!0,v.add(c),r=pT.bind(null,r,i,c),i.then(r,r))}function pT(r,i,c){var p=r.pingCache;p!==null&&p.delete(i),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Et===r&&(st&c)===c&&(Kt===4||Kt===3&&(st&62914560)===st&&300>ut()-Zc?(yt&2)===0&&Ps(r,0):Ef|=c,$s===st&&($s=0)),Kr(r)}function _0(r,i){i===0&&(i=qa()),r=Ai(r,i),r!==null&&(ge(r,i),Kr(r))}function fT(r){var i=r.memoizedState,c=0;i!==null&&(c=i.retryLane),_0(r,c)}function hT(r,i){var c=0;switch(r.tag){case 31:case 13:var p=r.stateNode,v=r.memoizedState;v!==null&&(c=v.retryLane);break;case 19:p=r.stateNode;break;case 22:p=r.stateNode._retryCache;break;default:throw Error(a(314))}p!==null&&p.delete(i),_0(r,c)}function mT(r,i){return Ot(r,i)}var tu=null,Bs=null,Df=!1,nu=!1,zf=!1,li=0;function Kr(r){r!==Bs&&r.next===null&&(Bs===null?tu=Bs=r:Bs=Bs.next=r),nu=!0,Df||(Df=!0,vT())}function nl(r,i){if(!zf&&nu){zf=!0;do for(var c=!1,p=tu;p!==null;){if(r!==0){var v=p.pendingLanes;if(v===0)var x=0;else{var C=p.suspendedLanes,D=p.pingedLanes;x=(1<<31-Ne(42|r)+1)-1,x&=v&~(C&~D),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,M0(p,x))}else x=st,x=qr(p,p===Et?x:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(x&3)===0||ca(p,x)||(c=!0,M0(p,x));p=p.next}while(c);zf=!1}}function gT(){R0()}function R0(){nu=Df=!1;var r=0;li!==0&&ET()&&(r=li);for(var i=ut(),c=null,p=tu;p!==null;){var v=p.next,x=O0(p,i);x===0?(p.next=null,c===null?tu=v:c.next=v,v===null&&(Bs=c)):(c=p,(r!==0||(x&3)!==0)&&(nu=!0)),p=v}dn!==0&&dn!==5||nl(r),li!==0&&(li=0)}function O0(r,i){for(var c=r.suspendedLanes,p=r.pingedLanes,v=r.expirationTimes,x=r.pendingLanes&-62914561;0<x;){var C=31-Ne(x),D=1<<C,K=v[C];K===-1?((D&c)===0||(D&p)!==0)&&(v[C]=ic(D,i)):K<=i&&(r.expiredLanes|=D),x&=~D}if(i=Et,c=st,c=qr(r,r===i?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),p=r.callbackNode,c===0||r===i&&(wt===2||wt===9)||r.cancelPendingCommit!==null)return p!==null&&p!==null&&$t(p),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||ca(r,c)){if(i=c&-c,i===r.callbackPriority)return i;switch(p!==null&&$t(p),Je(c)){case 2:case 8:c=W;break;case 32:c=ee;break;case 268435456:c=he;break;default:c=ee}return p=L0.bind(null,r),c=Ot(c,p),r.callbackPriority=i,r.callbackNode=c,i}return p!==null&&p!==null&&$t(p),r.callbackPriority=2,r.callbackNode=null,2}function L0(r,i){if(dn!==0&&dn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(eu()&&r.callbackNode!==c)return null;var p=st;return p=qr(r,r===Et?p:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),p===0?null:(h0(r,p,i),O0(r,ut()),r.callbackNode!=null&&r.callbackNode===c?L0.bind(null,r):null)}function M0(r,i){if(eu())return null;h0(r,i,!0)}function vT(){AT(function(){(yt&6)!==0?Ot(Q,gT):R0()})}function $f(){if(li===0){var r=Ns;r===0&&(r=dr,dr<<=1,(dr&261888)===0&&(dr=256)),li=r}return li}function D0(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:uc(""+r)}function z0(r,i){var c=i.ownerDocument.createElement("input");return c.name=i.name,c.value=i.value,r.id&&c.setAttribute("form",r.id),i.parentNode.insertBefore(c,i),r=new FormData(r),c.parentNode.removeChild(c),r}function yT(r,i,c,p,v){if(i==="submit"&&c&&c.stateNode===v){var x=D0((v[un]||null).action),C=p.submitter;C&&(i=(i=C[un]||null)?D0(i.formAction):C.getAttribute("formAction"),i!==null&&(x=i,C=null));var D=new hc("action","action",null,p,v);r.push({event:D,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(li!==0){var K=C?z0(v,C):new FormData(v);nf(c,{pending:!0,data:K,method:v.method,action:x},null,K)}}else typeof x=="function"&&(D.preventDefault(),K=C?z0(v,C):new FormData(v),nf(c,{pending:!0,data:K,method:v.method,action:x},x,K))},currentTarget:v}]})}}for(var If=0;If<bp.length;If++){var Pf=bp[If],bT=Pf.toLowerCase(),xT=Pf[0].toUpperCase()+Pf.slice(1);Lr(bT,"on"+xT)}Lr(fy,"onAnimationEnd"),Lr(hy,"onAnimationIteration"),Lr(my,"onAnimationStart"),Lr("dblclick","onDoubleClick"),Lr("focusin","onFocus"),Lr("focusout","onBlur"),Lr(zE,"onTransitionRun"),Lr($E,"onTransitionStart"),Lr(IE,"onTransitionCancel"),Lr(gy,"onTransitionEnd"),fa("onMouseEnter",["mouseout","mouseover"]),fa("onMouseLeave",["mouseout","mouseover"]),fa("onPointerEnter",["pointerout","pointerover"]),fa("onPointerLeave",["pointerout","pointerover"]),mr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),mr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),mr("onBeforeInput",["compositionend","keypress","textInput","paste"]),mr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),mr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),mr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var rl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),wT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(rl));function $0(r,i){i=(i&4)!==0;for(var c=0;c<r.length;c++){var p=r[c],v=p.event;p=p.listeners;e:{var x=void 0;if(i)for(var C=p.length-1;0<=C;C--){var D=p[C],K=D.instance,ae=D.currentTarget;if(D=D.listener,K!==x&&v.isPropagationStopped())break e;x=D,v.currentTarget=ae;try{x(v)}catch(pe){vc(pe)}v.currentTarget=null,x=K}else for(C=0;C<p.length;C++){if(D=p[C],K=D.instance,ae=D.currentTarget,D=D.listener,K!==x&&v.isPropagationStopped())break e;x=D,v.currentTarget=ae;try{x(v)}catch(pe){vc(pe)}v.currentTarget=null,x=K}}}}function rt(r,i){var c=i[da];c===void 0&&(c=i[da]=new Set);var p=r+"__bubble";c.has(p)||(I0(i,r,2,!1),c.add(p))}function Uf(r,i,c){var p=0;i&&(p|=4),I0(c,r,p,i)}var ru="_reactListening"+Math.random().toString(36).slice(2);function Bf(r){if(!r[ru]){r[ru]=!0,jo.forEach(function(c){c!=="selectionchange"&&(wT.has(c)||Uf(c,!1,r),Uf(c,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[ru]||(i[ru]=!0,Uf("selectionchange",!1,i))}}function I0(r,i,c,p){switch(fx(i)){case 2:var v=KT;break;case 8:v=YT;break;default:v=nh}c=v.bind(null,i,c,r),v=void 0,!sp||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(v=!0),p?v!==void 0?r.addEventListener(i,c,{capture:!0,passive:v}):r.addEventListener(i,c,!0):v!==void 0?r.addEventListener(i,c,{passive:v}):r.addEventListener(i,c,!1)}function Ff(r,i,c,p,v){var x=p;if((i&1)===0&&(i&2)===0&&p!==null)e:for(;;){if(p===null)return;var C=p.tag;if(C===3||C===4){var D=p.stateNode.containerInfo;if(D===v)break;if(C===4)for(C=p.return;C!==null;){var K=C.tag;if((K===3||K===4)&&C.stateNode.containerInfo===v)return;C=C.return}for(;D!==null;){if(C=gn(D),C===null)return;if(K=C.tag,K===5||K===6||K===26||K===27){p=x=C;continue e}D=D.parentNode}}p=p.return}Hv(function(){var ae=x,pe=ap(c),me=[];e:{var se=vy.get(r);if(se!==void 0){var oe=hc,Ae=r;switch(r){case"keypress":if(pc(c)===0)break e;case"keydown":case"keyup":oe=hE;break;case"focusin":Ae="focus",oe=up;break;case"focusout":Ae="blur",oe=up;break;case"beforeblur":case"afterblur":oe=up;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=Vv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=nE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=vE;break;case fy:case hy:case my:oe=iE;break;case gy:oe=bE;break;case"scroll":case"scrollend":oe=eE;break;case"wheel":oe=wE;break;case"copy":case"cut":case"paste":oe=oE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=Zv;break;case"toggle":case"beforetoggle":oe=SE}var Be=(i&4)!==0,Ct=!Be&&(r==="scroll"||r==="scrollend"),te=Be?se!==null?se+"Capture":null:se;Be=[];for(var J=ae,re;J!==null;){var fe=J;if(re=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||re===null||te===null||(fe=Co(J,te),fe!=null&&Be.push(al(J,fe,re))),Ct)break;J=J.return}0<Be.length&&(se=new oe(se,Ae,null,c,pe),me.push({event:se,listeners:Be}))}}if((i&7)===0){e:{if(se=r==="mouseover"||r==="pointerover",oe=r==="mouseout"||r==="pointerout",se&&c!==rp&&(Ae=c.relatedTarget||c.fromElement)&&(gn(Ae)||Ae[ua]))break e;if((oe||se)&&(se=pe.window===pe?pe:(se=pe.ownerDocument)?se.defaultView||se.parentWindow:window,oe?(Ae=c.relatedTarget||c.toElement,oe=ae,Ae=Ae?gn(Ae):null,Ae!==null&&(Ct=l(Ae),Be=Ae.tag,Ae!==Ct||Be!==5&&Be!==27&&Be!==6)&&(Ae=null)):(oe=null,Ae=ae),oe!==Ae)){if(Be=Vv,fe="onMouseLeave",te="onMouseEnter",J="mouse",(r==="pointerout"||r==="pointerover")&&(Be=Zv,fe="onPointerLeave",te="onPointerEnter",J="pointer"),Ct=oe==null?se:pa(oe),re=Ae==null?se:pa(Ae),se=new Be(fe,J+"leave",oe,c,pe),se.target=Ct,se.relatedTarget=re,fe=null,gn(pe)===ae&&(Be=new Be(te,J+"enter",Ae,c,pe),Be.target=re,Be.relatedTarget=Ct,fe=Be),Ct=fe,oe&&Ae)t:{for(Be=kT,te=oe,J=Ae,re=0,fe=te;fe;fe=Be(fe))re++;fe=0;for(var ze=J;ze;ze=Be(ze))fe++;for(;0<re-fe;)te=Be(te),re--;for(;0<fe-re;)J=Be(J),fe--;for(;re--;){if(te===J||J!==null&&te===J.alternate){Be=te;break t}te=Be(te),J=Be(J)}Be=null}else Be=null;oe!==null&&P0(me,se,oe,Be,!1),Ae!==null&&Ct!==null&&P0(me,Ct,Ae,Be,!0)}}e:{if(se=ae?pa(ae):window,oe=se.nodeName&&se.nodeName.toLowerCase(),oe==="select"||oe==="input"&&se.type==="file")var ht=ny;else if(ey(se))if(ry)ht=LE;else{ht=RE;var Re=_E}else oe=se.nodeName,!oe||oe.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ae&&np(ae.elementType)&&(ht=ny):ht=OE;if(ht&&(ht=ht(r,ae))){ty(me,ht,c,pe);break e}Re&&Re(r,se,ae),r==="focusout"&&ae&&se.type==="number"&&ae.memoizedProps.value!=null&&tp(se,"number",se.value)}switch(Re=ae?pa(ae):window,r){case"focusin":(ey(Re)||Re.contentEditable==="true")&&(ys=Re,gp=ae,Lo=null);break;case"focusout":Lo=gp=ys=null;break;case"mousedown":vp=!0;break;case"contextmenu":case"mouseup":case"dragend":vp=!1,dy(me,c,pe);break;case"selectionchange":if(DE)break;case"keydown":case"keyup":dy(me,c,pe)}var Qe;if(pp)e:{switch(r){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else vs?Xv(r,c)&&(ot="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(ot="onCompositionStart");ot&&(Kv&&c.locale!=="ko"&&(vs||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&vs&&(Qe=qv()):(Va=pe,op="value"in Va?Va.value:Va.textContent,vs=!0)),Re=au(ae,ot),0<Re.length&&(ot=new Wv(ot,r,null,c,pe),me.push({event:ot,listeners:Re}),Qe?ot.data=Qe:(Qe=Jv(c),Qe!==null&&(ot.data=Qe)))),(Qe=CE?NE(r,c):EE(r,c))&&(ot=au(ae,"onBeforeInput"),0<ot.length&&(Re=new Wv("onBeforeInput","beforeinput",null,c,pe),me.push({event:Re,listeners:ot}),Re.data=Qe)),yT(me,r,ae,c,pe)}$0(me,i)})}function al(r,i,c){return{instance:r,listener:i,currentTarget:c}}function au(r,i){for(var c=i+"Capture",p=[];r!==null;){var v=r,x=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||x===null||(v=Co(r,c),v!=null&&p.unshift(al(r,v,x)),v=Co(r,i),v!=null&&p.push(al(r,v,x))),r.tag===3)return p;r=r.return}return[]}function kT(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function P0(r,i,c,p,v){for(var x=i._reactName,C=[];c!==null&&c!==p;){var D=c,K=D.alternate,ae=D.stateNode;if(D=D.tag,K!==null&&K===p)break;D!==5&&D!==26&&D!==27||ae===null||(K=ae,v?(ae=Co(c,x),ae!=null&&C.unshift(al(c,ae,K))):v||(ae=Co(c,x),ae!=null&&C.push(al(c,ae,K)))),c=c.return}C.length!==0&&r.push({event:i,listeners:C})}var ST=/\r\n?/g,jT=/\u0000|\uFFFD/g;function U0(r){return(typeof r=="string"?r:""+r).replace(ST,`
50
+ `).replace(jT,"")}function B0(r,i){return i=U0(i),U0(r)===i}function jt(r,i,c,p,v,x){switch(c){case"children":typeof p=="string"?i==="body"||i==="textarea"&&p===""||hs(r,p):(typeof p=="number"||typeof p=="bigint")&&i!=="body"&&hs(r,""+p);break;case"className":lc(r,"class",p);break;case"tabIndex":lc(r,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":lc(r,c,p);break;case"style":Bv(r,p,x);break;case"data":if(i!=="object"){lc(r,"data",p);break}case"src":case"href":if(p===""&&(i!=="a"||c!=="href")){r.removeAttribute(c);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){r.removeAttribute(c);break}p=uc(""+p),r.setAttribute(c,p);break;case"action":case"formAction":if(typeof p=="function"){r.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(c==="formAction"?(i!=="input"&&jt(r,i,"name",v.name,v,null),jt(r,i,"formEncType",v.formEncType,v,null),jt(r,i,"formMethod",v.formMethod,v,null),jt(r,i,"formTarget",v.formTarget,v,null)):(jt(r,i,"encType",v.encType,v,null),jt(r,i,"method",v.method,v,null),jt(r,i,"target",v.target,v,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){r.removeAttribute(c);break}p=uc(""+p),r.setAttribute(c,p);break;case"onClick":p!=null&&(r.onclick=ma);break;case"onScroll":p!=null&&rt("scroll",r);break;case"onScrollEnd":p!=null&&rt("scrollend",r);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(a(61));if(c=p.__html,c!=null){if(v.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"multiple":r.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":r.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){r.removeAttribute("xlink:href");break}c=uc(""+p),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?r.setAttribute(c,""+p):r.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":p&&typeof p!="function"&&typeof p!="symbol"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":p===!0?r.setAttribute(c,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?r.setAttribute(c,p):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?r.setAttribute(c,p):r.removeAttribute(c);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?r.removeAttribute(c):r.setAttribute(c,p);break;case"popover":rt("beforetoggle",r),rt("toggle",r),oc(r,"popover",p);break;case"xlinkActuate":ha(r,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":ha(r,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":ha(r,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":ha(r,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":ha(r,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":ha(r,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":ha(r,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":ha(r,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":ha(r,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":oc(r,"is",p);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=XN.get(c)||c,oc(r,c,p))}}function Hf(r,i,c,p,v,x){switch(c){case"style":Bv(r,p,x);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(a(61));if(c=p.__html,c!=null){if(v.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"children":typeof p=="string"?hs(r,p):(typeof p=="number"||typeof p=="bigint")&&hs(r,""+p);break;case"onScroll":p!=null&&rt("scroll",r);break;case"onScrollEnd":p!=null&&rt("scrollend",r);break;case"onClick":p!=null&&(r.onclick=ma);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!sc.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(v=c.endsWith("Capture"),i=c.slice(2,v?c.length-7:void 0),x=r[un]||null,x=x!=null?x[c]:null,typeof x=="function"&&r.removeEventListener(i,x,v),typeof p=="function")){typeof x!="function"&&x!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(i,p,v);break e}c in r?r[c]=p:p===!0?r.setAttribute(c,""):oc(r,c,p)}}}function kn(r,i,c){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":rt("error",r),rt("load",r);var p=!1,v=!1,x;for(x in c)if(c.hasOwnProperty(x)){var C=c[x];if(C!=null)switch(x){case"src":p=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:jt(r,i,x,C,c,null)}}v&&jt(r,i,"srcSet",c.srcSet,c,null),p&&jt(r,i,"src",c.src,c,null);return;case"input":rt("invalid",r);var D=x=C=v=null,K=null,ae=null;for(p in c)if(c.hasOwnProperty(p)){var pe=c[p];if(pe!=null)switch(p){case"name":v=pe;break;case"type":C=pe;break;case"checked":K=pe;break;case"defaultChecked":ae=pe;break;case"value":x=pe;break;case"defaultValue":D=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(a(137,i));break;default:jt(r,i,p,pe,c,null)}}$v(r,x,D,K,ae,C,v,!1);return;case"select":rt("invalid",r),p=C=x=null;for(v in c)if(c.hasOwnProperty(v)&&(D=c[v],D!=null))switch(v){case"value":x=D;break;case"defaultValue":C=D;break;case"multiple":p=D;default:jt(r,i,v,D,c,null)}i=x,c=C,r.multiple=!!p,i!=null?fs(r,!!p,i,!1):c!=null&&fs(r,!!p,c,!0);return;case"textarea":rt("invalid",r),x=v=p=null;for(C in c)if(c.hasOwnProperty(C)&&(D=c[C],D!=null))switch(C){case"value":p=D;break;case"defaultValue":v=D;break;case"children":x=D;break;case"dangerouslySetInnerHTML":if(D!=null)throw Error(a(91));break;default:jt(r,i,C,D,c,null)}Pv(r,p,v,x);return;case"option":for(K in c)if(c.hasOwnProperty(K)&&(p=c[K],p!=null))switch(K){case"selected":r.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:jt(r,i,K,p,c,null)}return;case"dialog":rt("beforetoggle",r),rt("toggle",r),rt("cancel",r),rt("close",r);break;case"iframe":case"object":rt("load",r);break;case"video":case"audio":for(p=0;p<rl.length;p++)rt(rl[p],r);break;case"image":rt("error",r),rt("load",r);break;case"details":rt("toggle",r);break;case"embed":case"source":case"link":rt("error",r),rt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in c)if(c.hasOwnProperty(ae)&&(p=c[ae],p!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:jt(r,i,ae,p,c,null)}return;default:if(np(i)){for(pe in c)c.hasOwnProperty(pe)&&(p=c[pe],p!==void 0&&Hf(r,i,pe,p,c,void 0));return}}for(D in c)c.hasOwnProperty(D)&&(p=c[D],p!=null&&jt(r,i,D,p,c,null))}function CT(r,i,c,p){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,x=null,C=null,D=null,K=null,ae=null,pe=null;for(oe in c){var me=c[oe];if(c.hasOwnProperty(oe)&&me!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":K=me;default:p.hasOwnProperty(oe)||jt(r,i,oe,null,p,me)}}for(var se in p){var oe=p[se];if(me=c[se],p.hasOwnProperty(se)&&(oe!=null||me!=null))switch(se){case"type":x=oe;break;case"name":v=oe;break;case"checked":ae=oe;break;case"defaultChecked":pe=oe;break;case"value":C=oe;break;case"defaultValue":D=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,i));break;default:oe!==me&&jt(r,i,se,oe,p,me)}}ep(r,C,D,K,ae,pe,x,v);return;case"select":oe=C=D=se=null;for(x in c)if(K=c[x],c.hasOwnProperty(x)&&K!=null)switch(x){case"value":break;case"multiple":oe=K;default:p.hasOwnProperty(x)||jt(r,i,x,null,p,K)}for(v in p)if(x=p[v],K=c[v],p.hasOwnProperty(v)&&(x!=null||K!=null))switch(v){case"value":se=x;break;case"defaultValue":D=x;break;case"multiple":C=x;default:x!==K&&jt(r,i,v,x,p,K)}i=D,c=C,p=oe,se!=null?fs(r,!!c,se,!1):!!p!=!!c&&(i!=null?fs(r,!!c,i,!0):fs(r,!!c,c?[]:"",!1));return;case"textarea":oe=se=null;for(D in c)if(v=c[D],c.hasOwnProperty(D)&&v!=null&&!p.hasOwnProperty(D))switch(D){case"value":break;case"children":break;default:jt(r,i,D,null,p,v)}for(C in p)if(v=p[C],x=c[C],p.hasOwnProperty(C)&&(v!=null||x!=null))switch(C){case"value":se=v;break;case"defaultValue":oe=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(a(91));break;default:v!==x&&jt(r,i,C,v,p,x)}Iv(r,se,oe);return;case"option":for(var Ae in c)if(se=c[Ae],c.hasOwnProperty(Ae)&&se!=null&&!p.hasOwnProperty(Ae))switch(Ae){case"selected":r.selected=!1;break;default:jt(r,i,Ae,null,p,se)}for(K in p)if(se=p[K],oe=c[K],p.hasOwnProperty(K)&&se!==oe&&(se!=null||oe!=null))switch(K){case"selected":r.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:jt(r,i,K,se,p,oe)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Be in c)se=c[Be],c.hasOwnProperty(Be)&&se!=null&&!p.hasOwnProperty(Be)&&jt(r,i,Be,null,p,se);for(ae in p)if(se=p[ae],oe=c[ae],p.hasOwnProperty(ae)&&se!==oe&&(se!=null||oe!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,i));break;default:jt(r,i,ae,se,p,oe)}return;default:if(np(i)){for(var Ct in c)se=c[Ct],c.hasOwnProperty(Ct)&&se!==void 0&&!p.hasOwnProperty(Ct)&&Hf(r,i,Ct,void 0,p,se);for(pe in p)se=p[pe],oe=c[pe],!p.hasOwnProperty(pe)||se===oe||se===void 0&&oe===void 0||Hf(r,i,pe,se,p,oe);return}}for(var te in c)se=c[te],c.hasOwnProperty(te)&&se!=null&&!p.hasOwnProperty(te)&&jt(r,i,te,null,p,se);for(me in p)se=p[me],oe=c[me],!p.hasOwnProperty(me)||se===oe||se==null&&oe==null||jt(r,i,me,se,p,oe)}function F0(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function NT(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,c=performance.getEntriesByType("resource"),p=0;p<c.length;p++){var v=c[p],x=v.transferSize,C=v.initiatorType,D=v.duration;if(x&&D&&F0(C)){for(C=0,D=v.responseEnd,p+=1;p<c.length;p++){var K=c[p],ae=K.startTime;if(ae>D)break;var pe=K.transferSize,me=K.initiatorType;pe&&F0(me)&&(K=K.responseEnd,C+=pe*(K<D?1:(D-ae)/(K-ae)))}if(--p,i+=8*(x+C)/(v.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var qf=null,Gf=null;function iu(r){return r.nodeType===9?r:r.ownerDocument}function H0(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function q0(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Vf(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Wf=null;function ET(){var r=window.event;return r&&r.type==="popstate"?r===Wf?!1:(Wf=r,!0):(Wf=null,!1)}var G0=typeof setTimeout=="function"?setTimeout:void 0,TT=typeof clearTimeout=="function"?clearTimeout:void 0,V0=typeof Promise=="function"?Promise:void 0,AT=typeof queueMicrotask=="function"?queueMicrotask:typeof V0<"u"?function(r){return V0.resolve(null).then(r).catch(_T)}:G0;function _T(r){setTimeout(function(){throw r})}function ci(r){return r==="head"}function W0(r,i){var c=i,p=0;do{var v=c.nextSibling;if(r.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"||c==="/&"){if(p===0){r.removeChild(v),Gs(i);return}p--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")p++;else if(c==="html")il(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,il(c);for(var x=c.firstChild;x;){var C=x.nextSibling,D=x.nodeName;x[Or]||D==="SCRIPT"||D==="STYLE"||D==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=C}}else c==="body"&&il(r.ownerDocument.body);c=v}while(c);Gs(i)}function Z0(r,i){var c=r;r=0;do{var p=c.nextSibling;if(c.nodeType===1?i?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(i?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),p&&p.nodeType===8)if(c=p.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=p}while(c)}function Zf(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var c=i;switch(i=i.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Zf(c),Ga(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function RT(r,i,c,p){for(;r.nodeType===1;){var v=c;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!p&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(p){if(!r[Or])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(x=r.getAttribute("rel"),x==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(x!==v.rel||r.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||r.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||r.getAttribute("title")!==(v.title==null?null:v.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(x=r.getAttribute("src"),(x!==(v.src==null?null:v.src)||r.getAttribute("type")!==(v.type==null?null:v.type)||r.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&x&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var x=v.name==null?null:""+v.name;if(v.type==="hidden"&&r.getAttribute("name")===x)return r}else return r;if(r=Cr(r.nextSibling),r===null)break}return null}function OT(r,i,c){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=Cr(r.nextSibling),r===null))return null;return r}function K0(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Cr(r.nextSibling),r===null))return null;return r}function Kf(r){return r.data==="$?"||r.data==="$~"}function Yf(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function LT(r,i){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||c.readyState!=="loading")i();else{var p=function(){i(),c.removeEventListener("DOMContentLoaded",p)};c.addEventListener("DOMContentLoaded",p),r._reactRetry=p}}function Cr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Qf=null;function Y0(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(i===0)return Cr(r.nextSibling);i--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||i++}r=r.nextSibling}return null}function Q0(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(i===0)return r;i--}else c!=="/$"&&c!=="/&"||i++}r=r.previousSibling}return null}function X0(r,i,c){switch(i=iu(c),r){case"html":if(r=i.documentElement,!r)throw Error(a(452));return r;case"head":if(r=i.head,!r)throw Error(a(453));return r;case"body":if(r=i.body,!r)throw Error(a(454));return r;default:throw Error(a(451))}}function il(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Ga(r)}var Nr=new Map,J0=new Set;function su(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ra=V.d;V.d={f:MT,r:DT,D:zT,C:$T,L:IT,m:PT,X:BT,S:UT,M:FT};function MT(){var r=Ra.f(),i=Qc();return r||i}function DT(r){var i=Nn(r);i!==null&&i.tag===5&&i.type==="form"?gb(i):Ra.r(r)}var Fs=typeof document>"u"?null:document;function ex(r,i,c){var p=Fs;if(p&&typeof i=="string"&&i){var v=yr(i);v='link[rel="'+r+'"][href="'+v+'"]',typeof c=="string"&&(v+='[crossorigin="'+c+'"]'),J0.has(v)||(J0.add(v),r={rel:r,crossOrigin:c,href:i},p.querySelector(v)===null&&(i=p.createElement("link"),kn(i,"link",r),Lt(i),p.head.appendChild(i)))}}function zT(r){Ra.D(r),ex("dns-prefetch",r,null)}function $T(r,i){Ra.C(r,i),ex("preconnect",r,i)}function IT(r,i,c){Ra.L(r,i,c);var p=Fs;if(p&&r&&i){var v='link[rel="preload"][as="'+yr(i)+'"]';i==="image"&&c&&c.imageSrcSet?(v+='[imagesrcset="'+yr(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(v+='[imagesizes="'+yr(c.imageSizes)+'"]')):v+='[href="'+yr(r)+'"]';var x=v;switch(i){case"style":x=Hs(r);break;case"script":x=qs(r)}Nr.has(x)||(r=m({rel:"preload",href:i==="image"&&c&&c.imageSrcSet?void 0:r,as:i},c),Nr.set(x,r),p.querySelector(v)!==null||i==="style"&&p.querySelector(sl(x))||i==="script"&&p.querySelector(ol(x))||(i=p.createElement("link"),kn(i,"link",r),Lt(i),p.head.appendChild(i)))}}function PT(r,i){Ra.m(r,i);var c=Fs;if(c&&r){var p=i&&typeof i.as=="string"?i.as:"script",v='link[rel="modulepreload"][as="'+yr(p)+'"][href="'+yr(r)+'"]',x=v;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=qs(r)}if(!Nr.has(x)&&(r=m({rel:"modulepreload",href:r},i),Nr.set(x,r),c.querySelector(v)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(ol(x)))return}p=c.createElement("link"),kn(p,"link",r),Lt(p),c.head.appendChild(p)}}}function UT(r,i,c){Ra.S(r,i,c);var p=Fs;if(p&&r){var v=hr(p).hoistableStyles,x=Hs(r);i=i||"default";var C=v.get(x);if(!C){var D={loading:0,preload:null};if(C=p.querySelector(sl(x)))D.loading=5;else{r=m({rel:"stylesheet",href:r,"data-precedence":i},c),(c=Nr.get(x))&&Xf(r,c);var K=C=p.createElement("link");Lt(K),kn(K,"link",r),K._p=new Promise(function(ae,pe){K.onload=ae,K.onerror=pe}),K.addEventListener("load",function(){D.loading|=1}),K.addEventListener("error",function(){D.loading|=2}),D.loading|=4,ou(C,i,p)}C={type:"stylesheet",instance:C,count:1,state:D},v.set(x,C)}}}function BT(r,i){Ra.X(r,i);var c=Fs;if(c&&r){var p=hr(c).hoistableScripts,v=qs(r),x=p.get(v);x||(x=c.querySelector(ol(v)),x||(r=m({src:r,async:!0},i),(i=Nr.get(v))&&Jf(r,i),x=c.createElement("script"),Lt(x),kn(x,"link",r),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(v,x))}}function FT(r,i){Ra.M(r,i);var c=Fs;if(c&&r){var p=hr(c).hoistableScripts,v=qs(r),x=p.get(v);x||(x=c.querySelector(ol(v)),x||(r=m({src:r,async:!0,type:"module"},i),(i=Nr.get(v))&&Jf(r,i),x=c.createElement("script"),Lt(x),kn(x,"link",r),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(v,x))}}function tx(r,i,c,p){var v=(v=le.current)?su(v):null;if(!v)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(i=Hs(c.href),c=hr(v).hoistableStyles,p=c.get(i),p||(p={type:"style",instance:null,count:0,state:null},c.set(i,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=Hs(c.href);var x=hr(v).hoistableStyles,C=x.get(r);if(C||(v=v.ownerDocument||v,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,C),(x=v.querySelector(sl(r)))&&!x._p&&(C.instance=x,C.state.loading=5),Nr.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Nr.set(r,c),x||HT(v,r,c,C.state))),i&&p===null)throw Error(a(528,""));return C}if(i&&p!==null)throw Error(a(529,""));return null;case"script":return i=c.async,c=c.src,typeof c=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=qs(c),c=hr(v).hoistableScripts,p=c.get(i),p||(p={type:"script",instance:null,count:0,state:null},c.set(i,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function Hs(r){return'href="'+yr(r)+'"'}function sl(r){return'link[rel="stylesheet"]['+r+"]"}function nx(r){return m({},r,{"data-precedence":r.precedence,precedence:null})}function HT(r,i,c,p){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?p.loading=1:(i=r.createElement("link"),p.preload=i,i.addEventListener("load",function(){return p.loading|=1}),i.addEventListener("error",function(){return p.loading|=2}),kn(i,"link",c),Lt(i),r.head.appendChild(i))}function qs(r){return'[src="'+yr(r)+'"]'}function ol(r){return"script[async]"+r}function rx(r,i,c){if(i.count++,i.instance===null)switch(i.type){case"style":var p=r.querySelector('style[data-href~="'+yr(c.href)+'"]');if(p)return i.instance=p,Lt(p),p;var v=m({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return p=(r.ownerDocument||r).createElement("style"),Lt(p),kn(p,"style",v),ou(p,c.precedence,r),i.instance=p;case"stylesheet":v=Hs(c.href);var x=r.querySelector(sl(v));if(x)return i.state.loading|=4,i.instance=x,Lt(x),x;p=nx(c),(v=Nr.get(v))&&Xf(p,v),x=(r.ownerDocument||r).createElement("link"),Lt(x);var C=x;return C._p=new Promise(function(D,K){C.onload=D,C.onerror=K}),kn(x,"link",p),i.state.loading|=4,ou(x,c.precedence,r),i.instance=x;case"script":return x=qs(c.src),(v=r.querySelector(ol(x)))?(i.instance=v,Lt(v),v):(p=c,(v=Nr.get(x))&&(p=m({},c),Jf(p,v)),r=r.ownerDocument||r,v=r.createElement("script"),Lt(v),kn(v,"link",p),r.head.appendChild(v),i.instance=v);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(p=i.instance,i.state.loading|=4,ou(p,c.precedence,r));return i.instance}function ou(r,i,c){for(var p=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=p.length?p[p.length-1]:null,x=v,C=0;C<p.length;C++){var D=p[C];if(D.dataset.precedence===i)x=D;else if(x!==v)break}x?x.parentNode.insertBefore(r,x.nextSibling):(i=c.nodeType===9?c.head:c,i.insertBefore(r,i.firstChild))}function Xf(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function Jf(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var lu=null;function ax(r,i,c){if(lu===null){var p=new Map,v=lu=new Map;v.set(c,p)}else v=lu,p=v.get(c),p||(p=new Map,v.set(c,p));if(p.has(r))return p;for(p.set(r,null),c=c.getElementsByTagName(r),v=0;v<c.length;v++){var x=c[v];if(!(x[Or]||x[Gt]||r==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var C=x.getAttribute(i)||"";C=r+C;var D=p.get(C);D?D.push(x):p.set(C,[x])}}return p}function ix(r,i,c){r=r.ownerDocument||r,r.head.insertBefore(c,i==="title"?r.querySelector("head > title"):null)}function qT(r,i,c){if(c===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function sx(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function GT(r,i,c,p){if(c.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var v=Hs(p.href),x=i.querySelector(sl(v));if(x){i=x._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=cu.bind(r),i.then(r,r)),c.state.loading|=4,c.instance=x,Lt(x);return}x=i.ownerDocument||i,p=nx(p),(v=Nr.get(v))&&Xf(p,v),x=x.createElement("link"),Lt(x);var C=x;C._p=new Promise(function(D,K){C.onload=D,C.onerror=K}),kn(x,"link",p),c.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,i),(i=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=cu.bind(r),i.addEventListener("load",c),i.addEventListener("error",c))}}var eh=0;function VT(r,i){return r.stylesheets&&r.count===0&&du(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var p=setTimeout(function(){if(r.stylesheets&&du(r,r.stylesheets),r.unsuspend){var x=r.unsuspend;r.unsuspend=null,x()}},6e4+i);0<r.imgBytes&&eh===0&&(eh=62500*NT());var v=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&du(r,r.stylesheets),r.unsuspend)){var x=r.unsuspend;r.unsuspend=null,x()}},(r.imgBytes>eh?50:800)+i);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(p),clearTimeout(v)}}:null}function cu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)du(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var uu=null;function du(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,uu=new Map,i.forEach(WT,r),uu=null,cu.call(r))}function WT(r,i){if(!(i.state.loading&4)){var c=uu.get(r);if(c)var p=c.get(null);else{c=new Map,uu.set(r,c);for(var v=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<v.length;x++){var C=v[x];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(c.set(C.dataset.precedence,C),p=C)}p&&c.set(null,p)}v=i.instance,C=v.getAttribute("data-precedence"),x=c.get(C)||p,x===p&&c.set(null,v),c.set(C,v),this.count++,p=cu.bind(this),v.addEventListener("load",p),v.addEventListener("error",p),x?x.parentNode.insertBefore(v,x.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(v,r.firstChild)),i.state.loading|=4}}var ll={$$typeof:E,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function ZT(r,i,c,p,v,x,C,D,K){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ci(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ci(0),this.hiddenUpdates=Ci(null),this.identifierPrefix=p,this.onUncaughtError=v,this.onCaughtError=x,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function ox(r,i,c,p,v,x,C,D,K,ae,pe,me){return r=new ZT(r,i,c,C,K,ae,pe,me,D),i=1,x===!0&&(i|=24),x=Qn(3,null,null,i),r.current=x,x.stateNode=r,i=Op(),i.refCount++,r.pooledCache=i,i.refCount++,x.memoizedState={element:p,isDehydrated:c,cache:i},zp(x),r}function lx(r){return r?(r=ws,r):ws}function cx(r,i,c,p,v,x){v=lx(v),p.context===null?p.context=v:p.pendingContext=v,p=Xa(i),p.payload={element:c},x=x===void 0?null:x,x!==null&&(p.callback=x),c=Ja(r,p,i),c!==null&&(Hn(c,r,i),Uo(c,r,i))}function ux(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<i?c:i}}function th(r,i){ux(r,i),(r=r.alternate)&&ux(r,i)}function dx(r){if(r.tag===13||r.tag===31){var i=Ai(r,67108864);i!==null&&Hn(i,r,67108864),th(r,67108864)}}function px(r){if(r.tag===13||r.tag===31){var i=nr();i=tt(i);var c=Ai(r,i);c!==null&&Hn(c,r,i),th(r,i)}}var pu=!0;function KT(r,i,c,p){var v=H.T;H.T=null;var x=V.p;try{V.p=2,nh(r,i,c,p)}finally{V.p=x,H.T=v}}function YT(r,i,c,p){var v=H.T;H.T=null;var x=V.p;try{V.p=8,nh(r,i,c,p)}finally{V.p=x,H.T=v}}function nh(r,i,c,p){if(pu){var v=rh(p);if(v===null)Ff(r,i,p,fu,c),hx(r,p);else if(XT(v,r,i,c,p))p.stopPropagation();else if(hx(r,p),i&4&&-1<QT.indexOf(r)){for(;v!==null;){var x=Nn(v);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var C=pr(x.pendingLanes);if(C!==0){var D=x;for(D.pendingLanes|=2,D.entangledLanes|=2;C;){var K=1<<31-Ne(C);D.entanglements[1]|=K,C&=~K}Kr(x),(yt&6)===0&&(Kc=ut()+500,nl(0))}}break;case 31:case 13:D=Ai(x,2),D!==null&&Hn(D,x,2),Qc(),th(x,2)}if(x=rh(p),x===null&&Ff(r,i,p,fu,c),x===v)break;v=x}v!==null&&p.stopPropagation()}else Ff(r,i,p,null,c)}}function rh(r){return r=ap(r),ah(r)}var fu=null;function ah(r){if(fu=null,r=gn(r),r!==null){var i=l(r);if(i===null)r=null;else{var c=i.tag;if(c===13){if(r=u(i),r!==null)return r;r=null}else if(c===31){if(r=d(i),r!==null)return r;r=null}else if(c===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return fu=r,null}function fx(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ye()){case Q:return 2;case W:return 8;case ee:case ce:return 32;case he:return 268435456;default:return 32}default:return 32}}var ih=!1,ui=null,di=null,pi=null,cl=new Map,ul=new Map,fi=[],QT="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function hx(r,i){switch(r){case"focusin":case"focusout":ui=null;break;case"dragenter":case"dragleave":di=null;break;case"mouseover":case"mouseout":pi=null;break;case"pointerover":case"pointerout":cl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":ul.delete(i.pointerId)}}function dl(r,i,c,p,v,x){return r===null||r.nativeEvent!==x?(r={blockedOn:i,domEventName:c,eventSystemFlags:p,nativeEvent:x,targetContainers:[v]},i!==null&&(i=Nn(i),i!==null&&dx(i)),r):(r.eventSystemFlags|=p,i=r.targetContainers,v!==null&&i.indexOf(v)===-1&&i.push(v),r)}function XT(r,i,c,p,v){switch(i){case"focusin":return ui=dl(ui,r,i,c,p,v),!0;case"dragenter":return di=dl(di,r,i,c,p,v),!0;case"mouseover":return pi=dl(pi,r,i,c,p,v),!0;case"pointerover":var x=v.pointerId;return cl.set(x,dl(cl.get(x)||null,r,i,c,p,v)),!0;case"gotpointercapture":return x=v.pointerId,ul.set(x,dl(ul.get(x)||null,r,i,c,p,v)),!0}return!1}function mx(r){var i=gn(r.target);if(i!==null){var c=l(i);if(c!==null){if(i=c.tag,i===13){if(i=u(c),i!==null){r.blockedOn=i,pt(r.priority,function(){px(c)});return}}else if(i===31){if(i=d(c),i!==null){r.blockedOn=i,pt(r.priority,function(){px(c)});return}}else if(i===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function hu(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var c=rh(r.nativeEvent);if(c===null){c=r.nativeEvent;var p=new c.constructor(c.type,c);rp=p,c.target.dispatchEvent(p),rp=null}else return i=Nn(c),i!==null&&dx(i),r.blockedOn=c,!1;i.shift()}return!0}function gx(r,i,c){hu(r)&&c.delete(i)}function JT(){ih=!1,ui!==null&&hu(ui)&&(ui=null),di!==null&&hu(di)&&(di=null),pi!==null&&hu(pi)&&(pi=null),cl.forEach(gx),ul.forEach(gx)}function mu(r,i){r.blockedOn===i&&(r.blockedOn=null,ih||(ih=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,JT)))}var gu=null;function vx(r){gu!==r&&(gu=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){gu===r&&(gu=null);for(var i=0;i<r.length;i+=3){var c=r[i],p=r[i+1],v=r[i+2];if(typeof p!="function"){if(ah(p||c)===null)continue;break}var x=Nn(c);x!==null&&(r.splice(i,3),i-=3,nf(x,{pending:!0,data:v,method:c.method,action:p},p,v))}}))}function Gs(r){function i(K){return mu(K,r)}ui!==null&&mu(ui,r),di!==null&&mu(di,r),pi!==null&&mu(pi,r),cl.forEach(i),ul.forEach(i);for(var c=0;c<fi.length;c++){var p=fi[c];p.blockedOn===r&&(p.blockedOn=null)}for(;0<fi.length&&(c=fi[0],c.blockedOn===null);)mx(c),c.blockedOn===null&&fi.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(p=0;p<c.length;p+=3){var v=c[p],x=c[p+1],C=v[un]||null;if(typeof x=="function")C||vx(c);else if(C){var D=null;if(x&&x.hasAttribute("formAction")){if(v=x,C=x[un]||null)D=C.formAction;else if(ah(v)!==null)continue}else D=C.action;typeof D=="function"?c[p+1]=D:(c.splice(p,3),p-=3),vx(c)}}}function yx(){function r(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(C){return v=C})},focusReset:"manual",scroll:"manual"})}function i(){v!==null&&(v(),v=null),p||setTimeout(c,20)}function c(){if(!p&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,v=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(c,100),function(){p=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),v!==null&&(v(),v=null)}}}function sh(r){this._internalRoot=r}vu.prototype.render=sh.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var c=i.current,p=nr();cx(c,p,r,i,null,null)},vu.prototype.unmount=sh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;cx(r.current,2,null,r,null,null),Qc(),i[ua]=null}};function vu(r){this._internalRoot=r}vu.prototype.unstable_scheduleHydration=function(r){if(r){var i=Ke();r={blockedOn:null,target:r,priority:i};for(var c=0;c<fi.length&&i!==0&&i<fi[c].priority;c++);fi.splice(c,0,r),c===0&&mx(r)}};var bx=t.version;if(bx!=="19.2.4")throw Error(a(527,bx,"19.2.4"));V.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var eA={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yu.isDisabled&&yu.supportsFiber)try{Ce=yu.inject(eA),Fe=yu}catch{}}return fl.createRoot=function(r,i){if(!s(r))throw Error(a(299));var c=!1,p="",v=Nb,x=Eb,C=Tb;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(p=i.identifierPrefix),i.onUncaughtError!==void 0&&(v=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(C=i.onRecoverableError)),i=ox(r,1,!1,null,null,c,p,null,v,x,C,yx),r[ua]=i.current,Bf(r),new sh(i)},fl.hydrateRoot=function(r,i,c){if(!s(r))throw Error(a(299));var p=!1,v="",x=Nb,C=Eb,D=Tb,K=null;return c!=null&&(c.unstable_strictMode===!0&&(p=!0),c.identifierPrefix!==void 0&&(v=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(C=c.onCaughtError),c.onRecoverableError!==void 0&&(D=c.onRecoverableError),c.formState!==void 0&&(K=c.formState)),i=ox(r,1,!0,i,c??null,p,v,K,x,C,D,yx),i.context=lx(null),c=i.current,p=nr(),p=tt(p),v=Xa(p),v.callback=null,Ja(c,v,p),c=p,i.current.lanes=c,ge(i,c),Kr(i),r[ua]=i.current,Bf(r),new vu(i)},fl.version="19.2.4",fl}var Ax;function dA(){if(Ax)return ch.exports;Ax=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ch.exports=uA(),ch.exports}var pA=dA();/**
51
+ * react-router v7.17.0
52
+ *
53
+ * Copyright (c) Remix Software Inc.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE.md file in the root directory of this source tree.
57
+ *
58
+ * @license MIT
59
+ */var _x="popstate";function Rx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function fA(e={}){function t(a,s){var h;let l=(h=s.state)==null?void 0:h.masked,{pathname:u,search:d,hash:f}=l||a.location;return bm("",{pathname:u,search:d,hash:f},s.state&&s.state.usr||null,s.state&&s.state.key||"default",l?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,s){return typeof s=="string"?s:$l(s)}return mA(t,n,null,e)}function Bt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Br(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function hA(){return Math.random().toString(36).substring(2,10)}function Ox(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function bm(e,t,n=null,a,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?go(t):t,state:n,key:t&&t.key||a||hA(),mask:s}}function $l({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function go(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function mA(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:l=!1}=a,u=s.history,d="POP",f=null,h=g();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function g(){return(u.state||{idx:null}).idx}function m(){d="POP";let N=g(),S=N==null?null:N-h;h=N,f&&f({action:d,location:j.location,delta:S})}function y(N,S){d="PUSH";let T=Rx(N)?N:bm(j.location,N,S);h=g()+1;let E=Ox(T,h),A=j.createHref(T.mask||T);try{u.pushState(E,"",A)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;s.location.assign(A)}l&&f&&f({action:d,location:j.location,delta:1})}function b(N,S){d="REPLACE";let T=Rx(N)?N:bm(j.location,N,S);h=g();let E=Ox(T,h),A=j.createHref(T.mask||T);u.replaceState(E,"",A),l&&f&&f({action:d,location:j.location,delta:0})}function k(N){return gA(s,N)}let j={get action(){return d},get location(){return e(s,u)},listen(N){if(f)throw new Error("A history only accepts one active listener");return s.addEventListener(_x,m),f=N,()=>{s.removeEventListener(_x,m),f=null}},createHref(N){return t(s,N)},createURL:k,encodeLocation(N){let S=k(N);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:y,replace:b,go(N){return u.go(N)}};return j}function gA(e,t,n=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),Bt(a,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:$l(t);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=a+s),new URL(s,a)}function Xk(e,t,n="/"){return vA(e,t,n,!1)}function vA(e,t,n,a,s){let l=typeof t=="string"?go(t):t,u=$a(l.pathname||"/",n);if(u==null)return null;let d=yA(e),f=null,h=_A(u);for(let g=0;f==null&&g<d.length;++g)f=TA(d[g],h,a);return f}function yA(e){let t=Jk(e);return bA(t),t}function Jk(e,t=[],n=[],a="",s=!1){let l=(u,d,f=s,h)=>{let g={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(a)&&f)return;Bt(g.relativePath.startsWith(a),`Absolute route path "${g.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(a.length)}let m=Pr([a,g.relativePath]),y=n.concat(g);u.children&&u.children.length>0&&(Bt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),Jk(u.children,t,y,m,f)),!(u.path==null&&!u.index)&&t.push({path:m,score:NA(m,u.index),routesMeta:y})};return e.forEach((u,d)=>{var f;if(u.path===""||!((f=u.path)!=null&&f.includes("?")))l(u,d);else for(let h of eS(u.path))l(u,d,!0,h)}),t}function eS(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,s=n.endsWith("?"),l=n.replace(/\?$/,"");if(a.length===0)return s?[l,""]:[l];let u=eS(a.join("/")),d=[];return d.push(...u.map(f=>f===""?l:[l,f].join("/"))),s&&d.push(...u),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function bA(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:EA(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var xA=/^:[\w-]+$/,wA=3,kA=2,SA=1,jA=10,CA=-2,Lx=e=>e==="*";function NA(e,t){let n=e.split("/"),a=n.length;return n.some(Lx)&&(a+=CA),t&&(a+=kA),n.filter(s=>!Lx(s)).reduce((s,l)=>s+(xA.test(l)?wA:l===""?SA:jA),a)}function EA(e,t){return e.length===t.length&&e.slice(0,-1).every((a,s)=>a===t[s])?e[e.length-1]-t[t.length-1]:0}function TA(e,t,n=!1){let{routesMeta:a}=e,s={},l="/",u=[];for(let d=0;d<a.length;++d){let f=a[d],h=d===a.length-1,g=l==="/"?t:t.slice(l.length)||"/",m=rd({path:f.relativePath,caseSensitive:f.caseSensitive,end:h},g),y=f.route;if(!m&&h&&n&&!a[a.length-1].route.index&&(m=rd({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},g)),!m)return null;Object.assign(s,m.params),u.push({params:s,pathname:Pr([l,m.pathname]),pathnameBase:MA(Pr([l,m.pathnameBase])),route:y}),m.pathnameBase!=="/"&&(l=Pr([l,m.pathnameBase]))}return u}function rd(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=AA(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let l=s[0],u=l.replace(/(.)\/+$/,"$1"),d=s.slice(1);return{params:a.reduce((h,{paramName:g,isOptional:m},y)=>{if(g==="*"){let k=d[y]||"";u=l.slice(0,l.length-k.length).replace(/(.)\/+$/,"$1")}const b=d[y];return m&&!b?h[g]=void 0:h[g]=(b||"").replace(/%2F/g,"/"),h},{}),pathname:l,pathnameBase:u,pattern:e}}function AA(e,t=!1,n=!0){Br(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,f,h,g)=>{if(a.push({paramName:d,isOptional:f!=null}),f){let m=g.charAt(h+u.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),a]}function _A(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Br(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function $a(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}var RA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function OA(e,t="/"){let{pathname:n,search:a="",hash:s=""}=typeof e=="string"?go(e):e,l;return n?(n=tS(n),n.startsWith("/")?l=Mx(n.substring(1),"/"):l=Mx(n,t)):l=t,{pathname:l,search:DA(a),hash:zA(s)}}function Mx(e,t){let n=ad(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function fh(e,t,n,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function LA(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function pg(e){let t=LA(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function _d(e,t,n,a=!1){let s;typeof e=="string"?s=go(e):(s={...e},Bt(!s.pathname||!s.pathname.includes("?"),fh("?","pathname","search",s)),Bt(!s.pathname||!s.pathname.includes("#"),fh("#","pathname","hash",s)),Bt(!s.search||!s.search.includes("#"),fh("#","search","hash",s)));let l=e===""||s.pathname==="",u=l?"/":s.pathname,d;if(u==null)d=n;else{let m=t.length-1;if(!a&&u.startsWith("..")){let y=u.split("/");for(;y[0]==="..";)y.shift(),m-=1;s.pathname=y.join("/")}d=m>=0?t[m]:"/"}let f=OA(s,d),h=u&&u!=="/"&&u.endsWith("/"),g=(l||u===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||g)&&(f.pathname+="/"),f}var tS=e=>e.replace(/\/\/+/g,"/"),Pr=e=>tS(e.join("/")),ad=e=>e.replace(/\/+$/,""),MA=e=>ad(e).replace(/^\/*/,"/"),DA=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,zA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,$A=class{constructor(e,t,n,a=!1){this.status=e,this.statusText=t||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function IA(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function PA(e){let t=e.map(n=>n.route.path).filter(Boolean);return Pr(t)||"/"}var nS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function rS(e,t){let n=e;if(typeof n!="string"||!RA.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(nS)try{let l=new URL(window.location.href),u=n.startsWith("//")?new URL(l.protocol+n):new URL(n),d=$a(u.pathname,t);u.origin===l.origin&&d!=null?n=d+u.search+u.hash:s=!0}catch{Br(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var aS=["POST","PUT","PATCH","DELETE"];new Set(aS);var UA=["GET",...aS];new Set(UA);var vo=w.createContext(null);vo.displayName="DataRouter";var Rd=w.createContext(null);Rd.displayName="DataRouterState";var iS=w.createContext(!1);function BA(){return w.useContext(iS)}var sS=w.createContext({isTransitioning:!1});sS.displayName="ViewTransition";var FA=w.createContext(new Map);FA.displayName="Fetchers";var HA=w.createContext(null);HA.displayName="Await";var ur=w.createContext(null);ur.displayName="Navigation";var Zl=w.createContext(null);Zl.displayName="Location";var oa=w.createContext({outlet:null,matches:[],isDataRoute:!1});oa.displayName="Route";var fg=w.createContext(null);fg.displayName="RouteError";var oS="REACT_ROUTER_ERROR",qA="REDIRECT",GA="ROUTE_ERROR_RESPONSE";function VA(e){if(e.startsWith(`${oS}:${qA}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function WA(e){if(e.startsWith(`${oS}:${GA}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new $A(t.status,t.statusText,t.data)}catch{}}function ZA(e,{relative:t}={}){Bt(yo(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=w.useContext(ur),{hash:s,pathname:l,search:u}=Kl(e,{relative:t}),d=l;return n!=="/"&&(d=l==="/"?n:Pr([n,l])),a.createHref({pathname:d,search:u,hash:s})}function yo(){return w.useContext(Zl)!=null}function Fr(){return Bt(yo(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(Zl).location}var lS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function cS(e){w.useContext(ur).static||w.useLayoutEffect(e)}function hg(){let{isDataRoute:e}=w.useContext(oa);return e?o2():KA()}function KA(){Bt(yo(),"useNavigate() may be used only in the context of a <Router> component.");let e=w.useContext(vo),{basename:t,navigator:n}=w.useContext(ur),{matches:a}=w.useContext(oa),{pathname:s}=Fr(),l=JSON.stringify(pg(a)),u=w.useRef(!1);return cS(()=>{u.current=!0}),w.useCallback((f,h={})=>{if(Br(u.current,lS),!u.current)return;if(typeof f=="number"){n.go(f);return}let g=_d(f,JSON.parse(l),s,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Pr([t,g.pathname])),(h.replace?n.replace:n.push)(g,h.state,h)},[t,n,l,s,e])}w.createContext(null);function Kl(e,{relative:t}={}){let{matches:n}=w.useContext(oa),{pathname:a}=Fr(),s=JSON.stringify(pg(n));return w.useMemo(()=>_d(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function YA(e,t){return uS(e,t)}function uS(e,t,n){var N;Bt(yo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=w.useContext(ur),{matches:s}=w.useContext(oa),l=s[s.length-1],u=l?l.params:{},d=l?l.pathname:"/",f=l?l.pathnameBase:"/",h=l&&l.route;{let S=h&&h.path||"";pS(d,!h||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${S}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
60
+
61
+ Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let g=Fr(),m;if(t){let S=typeof t=="string"?go(t):t;Bt(f==="/"||((N=S.pathname)==null?void 0:N.startsWith(f)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${S.pathname}" was given in the \`location\` prop.`),m=S}else m=g;let y=m.pathname||"/",b=y;if(f!=="/"){let S=f.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(S.length).join("/")}let k=n&&n.state.matches.length?n.state.matches.map(S=>Object.assign(S,{route:n.manifest[S.route.id]||S.route})):Xk(e,{pathname:b});Br(h||k!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Br(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=t2(k&&k.map(S=>Object.assign({},S,{params:Object.assign({},u,S.params),pathname:Pr([f,a.encodeLocation?a.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?f:Pr([f,a.encodeLocation?a.encodeLocation(S.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),s,n);return t&&j?w.createElement(Zl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},j):j}function QA(){let e=s2(),t=IA(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:a},l={padding:"2px 4px",backgroundColor:a},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:l},"ErrorBoundary")," or"," ",w.createElement("code",{style:l},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:s},n):null,u)}var XA=w.createElement(QA,null),dS=class extends w.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=WA(e.digest);n&&(e=n)}let t=e!==void 0?w.createElement(oa.Provider,{value:this.props.routeContext},w.createElement(fg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?w.createElement(JA,{error:e},t):t}};dS.contextType=iS;var hh=new WeakMap;function JA({children:e,error:t}){let{basename:n}=w.useContext(ur);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=VA(t.digest);if(a){let s=hh.get(t);if(s)throw s;let l=rS(a.location,n);if(nS&&!hh.get(t))if(l.isExternal||a.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:a.replace}));throw hh.set(t,u),u}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function e2({routeContext:e,match:t,children:n}){let a=w.useContext(vo);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(oa.Provider,{value:e},n)}function t2(e,t=[],n){let a=n==null?void 0:n.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let s=e,l=a==null?void 0:a.errors;if(l!=null){let g=s.findIndex(m=>m.route.id&&(l==null?void 0:l[m.route.id])!==void 0);Bt(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let u=!1,d=-1;if(n&&a){u=a.renderFallback;for(let g=0;g<s.length;g++){let m=s[g];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(d=g),m.route.id){let{loaderData:y,errors:b}=a,k=m.route.loader&&!y.hasOwnProperty(m.route.id)&&(!b||b[m.route.id]===void 0);if(m.route.lazy||k){n.isStatic&&(u=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let f=n==null?void 0:n.onError,h=a&&f?(g,m)=>{var y,b;f(g,{location:a.location,params:((b=(y=a.matches)==null?void 0:y[0])==null?void 0:b.params)??{},pattern:PA(a.matches),errorInfo:m})}:void 0;return s.reduceRight((g,m,y)=>{let b,k=!1,j=null,N=null;a&&(b=l&&m.route.id?l[m.route.id]:void 0,j=m.route.errorElement||XA,u&&(d<0&&y===0?(pS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,N=null):d===y&&(k=!0,N=m.route.hydrateFallbackElement||null)));let S=t.concat(s.slice(0,y+1)),T=()=>{let E;return b?E=j:k?E=N:m.route.Component?E=w.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=g,w.createElement(e2,{match:m,routeContext:{outlet:g,matches:S,isDataRoute:a!=null},children:E})};return a&&(m.route.ErrorBoundary||m.route.errorElement||y===0)?w.createElement(dS,{location:a.location,revalidation:a.revalidation,component:j,error:b,children:T(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):T()},null)}function mg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function n2(e){let t=w.useContext(vo);return Bt(t,mg(e)),t}function r2(e){let t=w.useContext(Rd);return Bt(t,mg(e)),t}function a2(e){let t=w.useContext(oa);return Bt(t,mg(e)),t}function gg(e){let t=a2(e),n=t.matches[t.matches.length-1];return Bt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function i2(){return gg("useRouteId")}function s2(){var a;let e=w.useContext(fg),t=r2("useRouteError"),n=gg("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function o2(){let{router:e}=n2("useNavigate"),t=gg("useNavigate"),n=w.useRef(!1);return cS(()=>{n.current=!0}),w.useCallback(async(s,l={})=>{Br(n.current,lS),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...l}))},[e,t])}var Dx={};function pS(e,t,n){!t&&!Dx[e]&&(Dx[e]=!0,Br(!1,n))}w.memo(l2);function l2({routes:e,manifest:t,future:n,state:a,isStatic:s,onError:l}){return uS(e,void 0,{manifest:t,state:a,isStatic:s,onError:l})}function El({to:e,replace:t,state:n,relative:a}){Bt(yo(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=w.useContext(ur);Br(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=w.useContext(oa),{pathname:u}=Fr(),d=hg(),f=_d(e,pg(l),u,a==="path"),h=JSON.stringify(f);return w.useEffect(()=>{d(JSON.parse(h),{replace:t,state:n,relative:a})},[d,h,a,t,n]),null}function vi(e){Bt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function c2({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:l=!1,useTransitions:u}){Bt(!yo(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=w.useMemo(()=>({basename:d,navigator:s,static:l,useTransitions:u,future:{}}),[d,s,l,u]);typeof n=="string"&&(n=go(n));let{pathname:h="/",search:g="",hash:m="",state:y=null,key:b="default",mask:k}=n,j=w.useMemo(()=>{let N=$a(h,d);return N==null?null:{location:{pathname:N,search:g,hash:m,state:y,key:b,mask:k},navigationType:a}},[d,h,g,m,y,b,a,k]);return Br(j!=null,`<Router basename="${d}"> is not able to match the URL "${h}${g}${m}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:w.createElement(ur.Provider,{value:f},w.createElement(Zl.Provider,{children:t,value:j}))}function u2({children:e,location:t}){return YA(xm(e),t)}function xm(e,t=[]){let n=[];return w.Children.forEach(e,(a,s)=>{if(!w.isValidElement(a))return;let l=[...t,s];if(a.type===w.Fragment){n.push.apply(n,xm(a.props.children,l));return}Bt(a.type===vi,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Bt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let u={id:a.props.id||l.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(u.children=xm(a.props.children,l)),n.push(u)}),n}var Hu="get",qu="application/x-www-form-urlencoded";function Od(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function d2(e){return Od(e)&&e.tagName.toLowerCase()==="button"}function p2(e){return Od(e)&&e.tagName.toLowerCase()==="form"}function f2(e){return Od(e)&&e.tagName.toLowerCase()==="input"}function h2(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function m2(e,t){return e.button===0&&(!t||t==="_self")&&!h2(e)}var bu=null;function g2(){if(bu===null)try{new FormData(document.createElement("form"),0),bu=!1}catch{bu=!0}return bu}var v2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function mh(e){return e!=null&&!v2.has(e)?(Br(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${qu}"`),null):e}function y2(e,t){let n,a,s,l,u;if(p2(e)){let d=e.getAttribute("action");a=d?$a(d,t):null,n=e.getAttribute("method")||Hu,s=mh(e.getAttribute("enctype"))||qu,l=new FormData(e)}else if(d2(e)||f2(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||d.getAttribute("action");if(a=f?$a(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Hu,s=mh(e.getAttribute("formenctype"))||mh(d.getAttribute("enctype"))||qu,l=new FormData(d,e),!g2()){let{name:h,type:g,value:m}=e;if(g==="image"){let y=h?`${h}.`:"";l.append(`${y}x`,"0"),l.append(`${y}y`,"0")}else h&&l.append(h,m)}}else{if(Od(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Hu,a=null,s=qu,u=e}return l&&s==="text/plain"&&(u=l,l=void 0),{action:a,method:n.toLowerCase(),encType:s,formData:l,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function fS(e,t,n,a){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${a}`:s.pathname=`${s.pathname}.${a}`:s.pathname==="/"?s.pathname=`_root.${a}`:t&&$a(s.pathname,t)==="/"?s.pathname=`${ad(t)}/_root.${a}`:s.pathname=`${ad(s.pathname)}.${a}`,s}async function b2(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function x2(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function w2(e,t,n){let a=await Promise.all(e.map(async s=>{let l=t.routes[s.route.id];if(l){let u=await b2(l,n);return u.links?u.links():[]}return[]}));return C2(a.flat(1).filter(x2).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function zx(e,t,n,a,s,l){let u=(f,h)=>n[h]?f.route.id!==n[h].route.id:!0,d=(f,h)=>{var g;return n[h].pathname!==f.pathname||((g=n[h].route.path)==null?void 0:g.endsWith("*"))&&n[h].params["*"]!==f.params["*"]};return l==="assets"?t.filter((f,h)=>u(f,h)||d(f,h)):l==="data"?t.filter((f,h)=>{var m;let g=a.routes[f.route.id];if(!g||!g.hasLoader)return!1;if(u(f,h)||d(f,h))return!0;if(f.route.shouldRevalidate){let y=f.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function k2(e,t,{includeHydrateFallback:n}={}){return S2(e.map(a=>{let s=t.routes[a.route.id];if(!s)return[];let l=[s.module];return s.clientActionModule&&(l=l.concat(s.clientActionModule)),s.clientLoaderModule&&(l=l.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(l=l.concat(s.hydrateFallbackModule)),s.imports&&(l=l.concat(s.imports)),l}).flat(1))}function S2(e){return[...new Set(e)]}function j2(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function C2(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let l=JSON.stringify(j2(s));return n.has(l)||(n.add(l),a.push({key:l,link:s})),a},[])}function yg(){let e=w.useContext(vo);return vg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function N2(){let e=w.useContext(Rd);return vg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var bg=w.createContext(void 0);bg.displayName="FrameworkContext";function xg(){let e=w.useContext(bg);return vg(e,"You must render this element inside a <HydratedRouter> element"),e}function E2(e,t){let n=w.useContext(bg),[a,s]=w.useState(!1),[l,u]=w.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:h,onMouseLeave:g,onTouchStart:m}=t,y=w.useRef(null);w.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let j=S=>{S.forEach(T=>{u(T.isIntersecting)})},N=new IntersectionObserver(j,{threshold:.5});return y.current&&N.observe(y.current),()=>{N.disconnect()}}},[e]),w.useEffect(()=>{if(a){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[a]);let b=()=>{s(!0)},k=()=>{s(!1),u(!1)};return n?e!=="intent"?[l,y,{}]:[l,y,{onFocus:hl(d,b),onBlur:hl(f,k),onMouseEnter:hl(h,b),onMouseLeave:hl(g,k),onTouchStart:hl(m,b)}]:[!1,y,{}]}function hl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function T2({page:e,...t}){let n=BA(),{router:a}=yg(),s=w.useMemo(()=>Xk(a.routes,e,a.basename),[a.routes,e,a.basename]);return s?n?w.createElement(_2,{page:e,matches:s,...t}):w.createElement(R2,{page:e,matches:s,...t}):null}function A2(e){let{manifest:t,routeModules:n}=xg(),[a,s]=w.useState([]);return w.useEffect(()=>{let l=!1;return w2(e,t,n).then(u=>{l||s(u)}),()=>{l=!0}},[e,t,n]),a}function _2({page:e,matches:t,...n}){let a=Fr(),{future:s}=xg(),{basename:l}=yg(),u=w.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let d=fS(e,l,s.v8_trailingSlashAwareDataRequests,"rsc"),f=!1,h=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?f=!0:h.push(g.route.id);return f&&h.length>0&&d.searchParams.set("_routes",h.join(",")),[d.pathname+d.search]},[l,s.v8_trailingSlashAwareDataRequests,e,a,t]);return w.createElement(w.Fragment,null,u.map(d=>w.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function R2({page:e,matches:t,...n}){let a=Fr(),{future:s,manifest:l,routeModules:u}=xg(),{basename:d}=yg(),{loaderData:f,matches:h}=N2(),g=w.useMemo(()=>zx(e,t,h,l,a,"data"),[e,t,h,l,a]),m=w.useMemo(()=>zx(e,t,h,l,a,"assets"),[e,t,h,l,a]),y=w.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let j=new Set,N=!1;if(t.forEach(T=>{var A;let E=l.routes[T.route.id];!E||!E.hasLoader||(!g.some(B=>B.route.id===T.route.id)&&T.route.id in f&&((A=u[T.route.id])!=null&&A.shouldRevalidate)||E.hasClientLoader?N=!0:j.add(T.route.id))}),j.size===0)return[];let S=fS(e,d,s.v8_trailingSlashAwareDataRequests,"data");return N&&j.size>0&&S.searchParams.set("_routes",t.filter(T=>j.has(T.route.id)).map(T=>T.route.id).join(",")),[S.pathname+S.search]},[d,s.v8_trailingSlashAwareDataRequests,f,a,l,g,t,e,u]),b=w.useMemo(()=>k2(m,l),[m,l]),k=A2(m);return w.createElement(w.Fragment,null,y.map(j=>w.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),b.map(j=>w.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),k.map(({key:j,link:N})=>w.createElement("link",{key:j,nonce:n.nonce,...N,crossOrigin:N.crossOrigin??n.crossOrigin})))}function O2(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var L2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{L2&&(window.__reactRouterVersion="7.17.0")}catch{}function M2({basename:e,children:t,useTransitions:n,window:a}){let s=w.useRef();s.current==null&&(s.current=fA({window:a,v5Compat:!0}));let l=s.current,[u,d]=w.useState({action:l.action,location:l.location}),f=w.useCallback(h=>{n===!1?d(h):w.startTransition(()=>d(h))},[n]);return w.useLayoutEffect(()=>l.listen(f),[l,f]),w.createElement(c2,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:l,useTransitions:n})}var hS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mS=w.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:s,reloadDocument:l,replace:u,mask:d,state:f,target:h,to:g,preventScrollReset:m,viewTransition:y,defaultShouldRevalidate:b,...k},j){let{basename:N,navigator:S,useTransitions:T}=w.useContext(ur),E=typeof g=="string"&&hS.test(g),A=rS(g,N);g=A.to;let B=ZA(g,{relative:s}),_=Fr(),z=null;if(d){let $=_d(d,[],_.mask?_.mask.pathname:"/",!0);N!=="/"&&($.pathname=$.pathname==="/"?N:Pr([N,$.pathname])),z=S.createHref($)}let[q,M,R]=E2(a,k),P=I2(g,{replace:u,mask:d,state:f,target:h,preventScrollReset:m,relative:s,viewTransition:y,defaultShouldRevalidate:b,useTransitions:T});function F($){t&&t($),$.defaultPrevented||P($)}let Z=!(A.isExternal||l),I=w.createElement("a",{...k,...R,href:(Z?z:void 0)||A.absoluteURL||B,onClick:Z?F:t,ref:O2(j,M),target:h,"data-discover":!E&&n==="render"?"true":void 0});return q&&!E?w.createElement(w.Fragment,null,I,w.createElement(T2,{page:B})):I});mS.displayName="Link";var D2=w.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:l,to:u,viewTransition:d,children:f,...h},g){let m=Kl(u,{relative:h.relative}),y=Fr(),b=w.useContext(Rd),{navigator:k,basename:j}=w.useContext(ur),N=b!=null&&H2(m)&&d===!0,S=k.encodeLocation?k.encodeLocation(m).pathname:m.pathname,T=y.pathname,E=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(T=T.toLowerCase(),E=E?E.toLowerCase():null,S=S.toLowerCase()),E&&j&&(E=$a(E,j)||E);const A=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let B=T===S||!s&&T.startsWith(S)&&T.charAt(A)==="/",_=E!=null&&(E===S||!s&&E.startsWith(S)&&E.charAt(S.length)==="/"),z={isActive:B,isPending:_,isTransitioning:N},q=B?t:void 0,M;typeof a=="function"?M=a(z):M=[a,B?"active":null,_?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let R=typeof l=="function"?l(z):l;return w.createElement(mS,{...h,"aria-current":q,className:M,ref:g,style:R,to:u,viewTransition:d},typeof f=="function"?f(z):f)});D2.displayName="NavLink";var z2=w.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:l,method:u=Hu,action:d,onSubmit:f,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:y,...b},k)=>{let{useTransitions:j}=w.useContext(ur),N=B2(),S=F2(d,{relative:h}),T=u.toLowerCase()==="get"?"get":"post",E=typeof d=="string"&&hS.test(d),A=B=>{if(f&&f(B),B.defaultPrevented)return;B.preventDefault();let _=B.nativeEvent.submitter,z=(_==null?void 0:_.getAttribute("formmethod"))||u,q=()=>N(_||B.currentTarget,{fetcherKey:t,method:z,navigate:n,replace:s,state:l,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:y});j&&n!==!1?w.startTransition(()=>q()):q()};return w.createElement("form",{ref:k,method:T,action:S,onSubmit:a?f:A,...b,"data-discover":!E&&e==="render"?"true":void 0})});z2.displayName="Form";function $2(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function gS(e){let t=w.useContext(vo);return Bt(t,$2(e)),t}function I2(e,{target:t,replace:n,mask:a,state:s,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f,useTransitions:h}={}){let g=hg(),m=Fr(),y=Kl(e,{relative:u});return w.useCallback(b=>{if(m2(b,t)){b.preventDefault();let k=n!==void 0?n:$l(m)===$l(y),j=()=>g(e,{replace:k,mask:a,state:s,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f});h?w.startTransition(()=>j()):j()}},[m,g,y,n,a,s,t,e,l,u,d,f,h])}var P2=0,U2=()=>`__${String(++P2)}__`;function B2(){let{router:e}=gS("useSubmit"),{basename:t}=w.useContext(ur),n=i2(),a=e.fetch,s=e.navigate;return w.useCallback(async(l,u={})=>{let{action:d,method:f,encType:h,formData:g,body:m}=y2(l,t);if(u.navigate===!1){let y=u.fetcherKey||U2();await a(y,n,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:m,formMethod:u.method||f,formEncType:u.encType||h,flushSync:u.flushSync})}else await s(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:m,formMethod:u.method||f,formEncType:u.encType||h,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[a,s,t,n])}function F2(e,{relative:t}={}){let{basename:n}=w.useContext(ur),a=w.useContext(oa);Bt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),l={...Kl(e||".",{relative:t})},u=Fr();if(e==null){l.search=u.search;let d=new URLSearchParams(l.search),f=d.getAll("index");if(f.some(g=>g==="")){d.delete("index"),f.filter(m=>m).forEach(m=>d.append("index",m));let g=d.toString();l.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:Pr([n,l.pathname])),$l(l)}function H2(e,{relative:t}={}){let n=w.useContext(sS);Bt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=gS("useViewTransitionState"),s=Kl(e,{relative:t});if(!n.isTransitioning)return!1;let l=$a(n.currentLocation.pathname,a)||n.currentLocation.pathname,u=$a(n.nextLocation.pathname,a)||n.nextLocation.pathname;return rd(s.pathname,u)!=null||rd(s.pathname,l)!=null}var q2=Qk();const G2="modulepreload",V2=function(e){return"/ui/"+e},$x={},gt=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let u=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));s=u(n.map(h=>{if(h=V2(h),h in $x)return;$x[h]=!0;const g=h.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${m}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":G2,g||(y.as="script"),y.crossOrigin="",y.href=h,f&&y.setAttribute("nonce",f),document.head.appendChild(y),g)return new Promise((b,k)=>{y.addEventListener("load",b),y.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return s.then(u=>{for(const d of u||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})},Ix=e=>{let t;const n=new Set,a=(h,g)=>{const m=typeof h=="function"?h(t):h;if(!Object.is(m,t)){const y=t;t=g??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(b=>b(t,y))}},s=()=>t,d={setState:a,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h))},f=t=e(a,s,d);return d},W2=(e=>e?Ix(e):Ix),Z2=e=>e;function K2(e,t=Z2){const n=Ve.useSyncExternalStore(e.subscribe,Ve.useCallback(()=>t(e.getState()),[e,t]),Ve.useCallback(()=>t(e.getInitialState()),[e,t]));return Ve.useDebugValue(n),n}const Px=e=>{const t=W2(e),n=a=>K2(t,a);return Object.assign(n,t),n},as=(e=>e?Px(e):Px),vS="dkg-layout",Y2=260,Yr={leftCollapsed:!1,rightCollapsed:!1,bottomCollapsed:!0,leftSectionMyProjectsOpen:!0,leftSectionIntegrationsOpen:!1,leftWidth:240,rightWidth:360,bottomHeight:Y2},yS=140,bS=400,xS=200,wS=500,kS=120,id=600,Q2=240;function X2(e,t){if(typeof document>"u")return t;const n=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),a=parseFloat(n);return Number.isFinite(a)?a:t}function sd(){const e=X2("--header-h",44),t=typeof window<"u"&&window.innerHeight?window.innerHeight:0;if(!t)return id;const n=t-e-Q2;return Math.max(0,Math.min(id,n))}function Gu(e,t,n){return Math.max(t,Math.min(n,e))}function gh(e,t,n,a){return typeof e!="number"||!Number.isFinite(e)?t:Gu(e,n,a)}function J2(){try{const e=localStorage.getItem(vS);if(!e)return Yr;const t=JSON.parse(e);return{leftCollapsed:typeof t.leftCollapsed=="boolean"?t.leftCollapsed:Yr.leftCollapsed,rightCollapsed:typeof t.rightCollapsed=="boolean"?t.rightCollapsed:Yr.rightCollapsed,bottomCollapsed:typeof t.bottomCollapsed=="boolean"?t.bottomCollapsed:Yr.bottomCollapsed,leftSectionMyProjectsOpen:typeof t.leftSectionMyProjectsOpen=="boolean"?t.leftSectionMyProjectsOpen:Yr.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:typeof t.leftSectionIntegrationsOpen=="boolean"?t.leftSectionIntegrationsOpen:Yr.leftSectionIntegrationsOpen,leftWidth:gh(t.leftWidth,Yr.leftWidth,yS,bS),rightWidth:gh(t.rightWidth,Yr.rightWidth,xS,wS),bottomHeight:gh(t.bottomHeight,Yr.bottomHeight,kS,id)}}catch{return Yr}}let xu=null;function Oa(e){xu&&clearTimeout(xu),xu=setTimeout(()=>{xu=null;try{localStorage.setItem(vS,JSON.stringify(e))}catch{}},150)}function La(e){return{leftCollapsed:e.leftCollapsed,rightCollapsed:e.rightCollapsed,bottomCollapsed:e.bottomCollapsed,leftSectionMyProjectsOpen:e.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:e.leftSectionIntegrationsOpen,leftWidth:e.leftWidth,rightWidth:e.rightWidth,bottomHeight:e.bottomHeight}}const mi=J2(),Vn=as((e,t)=>({leftCollapsed:mi.leftCollapsed,rightCollapsed:mi.rightCollapsed,bottomCollapsed:mi.bottomCollapsed,bottomMaximised:!1,leftSectionMyProjectsOpen:mi.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:mi.leftSectionIntegrationsOpen,theme:localStorage.getItem("dkg-theme")||"dark",leftWidth:mi.leftWidth,rightWidth:mi.rightWidth,bottomHeight:mi.bottomHeight,toggleLeft:()=>{e(n=>({leftCollapsed:!n.leftCollapsed})),Oa(La(t()))},toggleRight:()=>{e(n=>({rightCollapsed:!n.rightCollapsed})),Oa(La(t()))},toggleBottom:()=>{e(n=>({bottomCollapsed:!n.bottomCollapsed,bottomMaximised:!1})),Oa(La(t()))},toggleBottomMaximised:()=>{e(n=>({bottomMaximised:!n.bottomMaximised,bottomCollapsed:!1})),Oa(La(t()))},toggleLeftSectionMyProjects:()=>{e(n=>({leftSectionMyProjectsOpen:!n.leftSectionMyProjectsOpen})),Oa(La(t()))},toggleLeftSectionIntegrations:()=>{e(n=>({leftSectionIntegrationsOpen:!n.leftSectionIntegrationsOpen})),Oa(La(t()))},setTheme:n=>{localStorage.setItem("dkg-theme",n),e({theme:n})},setLeftWidth:n=>{e({leftWidth:Gu(n,yS,bS)}),Oa(La(t()))},setRightWidth:n=>{e({rightWidth:Gu(n,xS,wS)}),Oa(La(t()))},setBottomHeight:n=>{const a=Math.min(kS,sd());e({bottomHeight:Gu(n,a,id)}),Oa(La(t()))}})),wg=as(e=>({agents:[],activeAgentName:null,nodeStatus:null,setAgents:t=>e({agents:t}),setActiveAgent:t=>e({activeAgentName:t}),setNodeStatus:t=>e({nodeStatus:t})})),e_=[{id:"dashboard",label:"Dashboard",closable:!1}],fn=as((e,t)=>({tabs:e_,activeTabId:"dashboard",openTab:n=>{const{tabs:a}=t();a.find(s=>s.id===n.id)?e({activeTabId:n.id}):e({tabs:[...a,n],activeTabId:n.id})},closeTab:n=>{var d;const{tabs:a,activeTabId:s}=t(),l=a.filter(f=>f.id!==n);if(l.length===0)return;const u=s===n?((d=l[Math.max(0,a.findIndex(f=>f.id===n)-1)])==null?void 0:d.id)??l[0].id:s;e({tabs:l,activeTabId:u})},setActiveTab:n=>e({activeTabId:n})})),_r="";function Ft(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}class $n extends Error{constructor(n,a,s){super(a??`HTTP ${n}`);Sn(this,"status");Sn(this,"body");this.status=n,this.body=s}}async function kg(e,t={},n=1e4){try{return await fetch(e,{...t,signal:AbortSignal.timeout(n)})}catch(a){throw a instanceof Error&&a.name==="TimeoutError"?new Error(`Request timed out after ${Math.round(n/1e3)}s`):a}}async function xt(e){const t=await fetch(`${_r}${e}`,{headers:Ft()});if(!t.ok){const n=await t.json().catch(()=>({})),a=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new $n(t.status,a,n)}return t.json()}async function bo(e){const t=await fetch(`${_r}${e}`,{headers:Ft()});if(!t.ok){const n=await t.json().catch(()=>({})),a=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new $n(t.status,a,n)}return t.json()}async function SS(e,t){const n=await kg(`${_r}${e}`,{headers:Ft()},t);if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new $n(n.status,s,a)}return n.json()}async function Cn(e,t){const n=await fetch(`${_r}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify(t)});if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new $n(n.status,s,a)}return n.json()}async function Sg(e,t){const n=await fetch(`${_r}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify(t)});if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}async function t_(e){const t=await fetch(`${_r}${e}`,{method:"DELETE",headers:Ft()});if(!t.ok){const n=await t.json().catch(()=>({})),a=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new $n(t.status,a,n)}return t.json()}const od=(e,t,n)=>{const a=new URLSearchParams;t&&a.set("key",t),n!=null&&n.extended&&a.set("extended","1");const s=a.toString();return bo(`/api/pca/${encodeURIComponent(e)}${s?`?${s}`:""}`).then(l=>n!=null&&n.extended?{...l,extendedRequested:!0}:l)},jG=e=>Cn("/api/pca",{tokens:e.tokens,primaryNode:e.primaryNode}),CG=(e,t)=>Cn(`/api/pca/${encodeURIComponent(e)}/agent`,{agent:t}),NG=(e,t)=>t_(`/api/pca/${encodeURIComponent(e)}/agent/${encodeURIComponent(t)}`),EG=(e,t)=>Cn(`/api/pca/${encodeURIComponent(e)}/funds`,{tokens:t}),TG=e=>Cn(`/api/pca/${encodeURIComponent(e)}/settle`,{}),AG=e=>bo(`/api/pca/${encodeURIComponent(e)}/agents`),n_=e=>bo(`/api/pca/agent/${encodeURIComponent(e)}`),_G=e=>bo("/api/pca/mine?hydrate=1"),RG=e=>bo(`/api/pca/designatable-nodes${e!=null&&e.fresh?"?fresh=1":""}`),r_=()=>bo("/api/pca/contracts");function jS(e){var n;if(!(e instanceof $n))return!1;const t=(n=e.body)==null?void 0:n.code;return typeof t=="string"&&(t.startsWith("RPC_")||t==="TIMEOUT")}function OG(e){return e instanceof $n&&e.status===503&&!jS(e)}function LG(e){if(!(e instanceof $n)||e.status!==503)return!1;const t=e.body;return(t==null?void 0:t.code)==="PCA_LOOKUP_READ_FAILED"||(t==null?void 0:t.error)==="PCA_LOOKUP_READ_FAILED"}const a_=["PrimaryNodeNotInShardingTable","PrimaryNodeUnchanged","PrimaryNodeChangeRateLimited","ZeroPrimaryNode","InvalidAmount","ZeroAgentAddress","TokenTransferFailed","NotAccountOwner","AgentAlreadyRegistered","AgentNotRegistered","AgentCapReached","AccountExpired","AccountAlreadyFullySettled","UnknownAccount"];function MG(e,t={}){if(!(e instanceof $n))return null;const n=e.status,a=e.body??{},s=typeof a.error=="string"&&a.error.length>0?a.error:e.message,l=t.accountId?`PCA #${t.accountId}`:"this Publisher Conviction Account",u=a.existingAccountId!=null?String(a.existingAccountId):void 0;if(jS(e))return{code:"ServerError",status:n,message:"The chain RPC is temporarily unavailable — try again."};if(n===503)return{code:"FEATURE_UNAVAILABLE",status:n,message:"Publisher Conviction Accounts aren't available on this network."};const d=a_.find(f=>new RegExp(`\\b${f}\\b`).test(s));if(d){let f;switch(d){case"InvalidAmount":f="Enter a TRAC amount greater than 0.";break;case"PrimaryNodeNotInShardingTable":f="That primary node isn't a staked node in the sharding table.";break;case"ZeroPrimaryNode":f="Choose a staked node as the primary node.";break;case"PrimaryNodeUnchanged":f="That's already this account's primary node.";break;case"PrimaryNodeChangeRateLimited":f="The primary node was changed too recently — try again later.";break;case"ZeroAgentAddress":f="Enter a valid operational wallet address.";break;case"TokenTransferFailed":f="The TRAC transfer failed — check the owner wallet's TRAC balance and allowance.";break;case"NotAccountOwner":f=`This node isn't the owner of ${l}, so it can't manage it.`;break;case"UnknownAccount":f=`${l} doesn't exist.`;break;case"AgentAlreadyRegistered":f=u?`This operational wallet is already an approved publishing wallet on PCA #${u} — deregister it there first.`:"This operational wallet is already approved on another PCA — deregister it there first.";break;case"AgentNotRegistered":f=`This operational wallet isn't an approved publishing wallet on ${l}.`;break;case"AgentCapReached":f=`${l} already has the maximum 100 approved publishing wallets.`;break;case"AccountExpired":f=`${l} has expired.`;break;case"AccountAlreadyFullySettled":f=`${l} is already fully settled.`;break;default:f=s}return{code:d,status:n,message:f,...u?{existingAccountId:u}:{}}}return n===404?{code:"UnknownAccount",status:n,message:`${l} doesn't exist.`}:n===403?{code:"NotAccountOwner",status:n,message:`This node isn't the owner of ${l}, so it can't manage it.`}:n===400?{code:"BadRequest",status:n,message:s}:n===409?{code:"Conflict",status:n,message:s}:n>=500?{code:"ServerError",status:n,message:"Something went wrong talking to the chain — try again."}:{code:"Unknown",status:n,message:s}}const Ux="did:dkg:context-graph:",CS=6e4;function NS(e){const t=e.trim();return t.startsWith(Ux)?t.slice(Ux.length):t}class wm extends Error{constructor(n,a={}){super(n);Sn(this,"status");Sn(this,"code");Sn(this,"source");Sn(this,"details");Sn(this,"correlationId");Sn(this,"timeoutMs");Sn(this,"target");Sn(this,"route");Sn(this,"integrationId");Sn(this,"retryable");this.name="LocalAgentApiError",Object.assign(this,a)}}const jg=()=>xt("/api/status"),DG=()=>xt("/api/settings/retention"),zG=e=>Sg("/api/settings/retention",{retentionDays:e}),$G=()=>xt("/api/settings/telemetry"),IG=e=>Sg("/api/settings/telemetry",{enabled:e}),i_=()=>xt("/api/connections"),s_=(e,t=1e4)=>kg(`${_r}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify({multiaddr:e})},t).then(async n=>{if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}),o_=(e,t=2e4)=>kg(`${_r}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify({peerId:e})},t).then(async n=>{if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}),Cg=()=>xt("/api/agents"),l_=()=>xt("/api/metrics"),PG=(e,t,n=300)=>xt(`/api/metrics/history?from=${e}&to=${t}&maxPoints=${n}`),c_=(e={})=>{const t=new URLSearchParams({...e,phases:"1"}).toString();return xt(`/api/operations?${t}`)},UG=e=>xt(`/api/operations/${e}`),BG=e=>{const t=e?`?periodMs=${e}`:"";return xt(`/api/error-hotspots${t}`)},FG=(e={})=>{const t=new URLSearchParams;e.phase&&t.set("phase",e.phase),e.operationName&&t.set("operationName",e.operationName),e.periodMs&&t.set("periodMs",String(e.periodMs)),e.q&&t.set("q",e.q),e.limit&&t.set("limit",String(e.limit));const n=t.toString();return xt(`/api/failed-operations${n?"?"+n:""}`)},HG=e=>xt(`/api/replication/summary${e?`?periodMs=${e}`:""}`),qG=e=>xt(`/api/replication/per-cg${e?`?periodMs=${e}`:""}`),GG=(e={})=>{const t=new URLSearchParams;e.periodMs&&t.set("periodMs",String(e.periodMs)),e.bucketMs&&t.set("bucketMs",String(e.bucketMs)),e.cg&&t.set("cg",e.cg);const n=t.toString();return xt(`/api/replication/timeline${n?"?"+n:""}`)},VG=()=>xt("/api/replication/cursors"),WG=(e,t=100)=>xt(`/api/replication/events?cg=${encodeURIComponent(e)}&limit=${t}`),ZG=e=>xt(`/api/success-rates?periodMs=${e}`),KG=(e,t)=>{const n=`periodMs=${e}${t?`&bucketMs=${t}`:""}`;return xt(`/api/per-type-stats?${n}`)},u_=(e={})=>{const t=new URLSearchParams;e.lines&&t.set("lines",String(e.lines)),e.q&&t.set("q",e.q);const n=t.toString();return xt(`/api/node-log${n?"?"+n:""}`)};async function Ld(){return{contextGraphs:((await SS("/api/context-graph/list",CS)).contextGraphs??[]).filter(n=>!n.isSystem)}}const Yl=()=>xt("/api/agent/identity");async function d_(e,t,n,a){const s=new AbortController,l=setTimeout(()=>s.abort(),3e4);try{const u=await fetch(`${_r}/api/context-graph/create`,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify({id:e,name:t,description:n,...a!=null&&a.register?{register:!0}:{},...a!=null&&a.allowedAgents?{allowedAgents:a.allowedAgents}:{},...(a==null?void 0:a.accessPolicy)!==void 0?{accessPolicy:a.accessPolicy}:{},...(a==null?void 0:a.publishPolicy)!==void 0?{publishPolicy:a.publishPolicy}:{}}),signal:s.signal});if(!u.ok){const d=await u.json().catch(()=>({}));throw new Error((d==null?void 0:d.error)??`HTTP ${u.status}`)}return u.json()}catch(u){throw u.name==="AbortError"?new Error("Creating project is taking longer than expected — it may still complete in the background. Refresh the page in a moment."):u}finally{clearTimeout(l)}}const p_=(e,t)=>Cn(`/api/context-graph/${encodeURIComponent(e)}/remove-participant`,{agentAddress:t}),ES=e=>xt(`/api/context-graph/${encodeURIComponent(e)}/participants`),f_=e=>Cn(`/api/context-graph/${encodeURIComponent(e)}/sign-join`,{}),h_=(e,t)=>Cn(`/api/context-graph/${encodeURIComponent(e)}/request-join`,t),TS=e=>xt(`/api/context-graph/${encodeURIComponent(e)}/join-requests`),Ng=(e,t)=>Cn(`/api/context-graph/${encodeURIComponent(e)}/approve-join`,{agentAddress:t}),Eg=(e,t)=>Cn(`/api/context-graph/${encodeURIComponent(e)}/reject-join`,{agentAddress:t}),m_={md:"text/markdown",markdown:"text/markdown",txt:"text/plain",csv:"text/csv",json:"application/json",xml:"application/xml",yaml:"text/yaml",yml:"text/yaml",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",doc:"application/msword",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",epub:"application/epub+zip",ttl:"text/turtle",rdf:"application/rdf+xml",owl:"application/rdf+xml",html:"text/html",htm:"text/html",py:"text/x-python",ts:"text/typescript",js:"text/javascript",tsx:"text/typescript",jsx:"text/javascript",java:"text/x-java",go:"text/x-go",rs:"text/x-rust",c:"text/x-c",cpp:"text/x-c++",h:"text/x-c",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};function g_(e){var n;if(e.type&&e.type!=="application/octet-stream")return e.type;const t=((n=e.name.split(".").pop())==null?void 0:n.toLowerCase())??"";return m_[t]}async function AS(e,t,n,a){const s=new FormData;s.append("file",n),s.append("contextGraphId",t);const l=g_(n);l&&s.append("contentType",l);const u=await fetch(`${_r}/api/knowledge-assets/${encodeURIComponent(e)}/wm/import-file`,{method:"POST",headers:Ft(),body:s});if(!u.ok){const d=await u.json().catch(()=>({}));throw new Error((d==null?void 0:d.error)??`HTTP ${u.status}`)}return u.json()}const vh=new Map;function ld(e){const t=JSON.stringify(e),n=vh.get(t);if(n)return n;const a=(async()=>{const s=await fetch(`${_r}/api/query`,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:t});if(!s.ok){const l=await s.json().catch(()=>({})),u=(l==null?void 0:l.error)??`HTTP ${s.status}`;throw new $n(s.status,u,l)}return s.json()})().finally(()=>{vh.delete(t)});return vh.set(t,a),a}const or=(e,t,n,a,s,l)=>ld({sparql:e,contextGraphId:t,includeSharedMemory:n,graphSuffix:a,view:s,includeContextGraphPartitions:l});async function v_(e){var l,u,d;const n=`SELECT ?name ?ual WHERE {
62
+ GRAPH <${`did:dkg:context-graph:${e}/_meta`}> {
63
+ ?lc <http://dkg.io/ontology/assertionName> ?name ;
64
+ <http://dkg.io/ontology/reservedUal> ?ual .
65
+ }
66
+ }`,a=await or(n,e),s={};for(const f of((l=a==null?void 0:a.result)==null?void 0:l.bindings)??[]){const h=typeof f.name=="string"?f.name:(u=f.name)==null?void 0:u.value,g=typeof f.ual=="string"?f.ual:(d=f.ual)==null?void 0:d.value;h&&g&&!s[h]&&(s[h]=g)}return s}const y_=(e,t)=>Cn("/api/profile/query-catalog/write",{contextGraphId:e,quads:t}),b_=new Set(["clearAfter","publishEpochs","publisherNodeIdentityIdOverride"]),x_=e=>{if(typeof e=="string"&&/^\d+$/.test(e))return e;throw new Error("publisherNodeIdentityIdOverride must be passed as a decimal string")},w_=(e,t=[])=>{if(!e)return;const n=Object.keys(e).filter(l=>!b_.has(l)&&!t.includes(l));if(n.length>0)throw new Error(`Unsupported finalized publish option(s): ${n.join(", ")}`);const a={};e.clearAfter!==void 0&&(a.clearSharedMemoryAfter=e.clearAfter),e.publishEpochs!==void 0&&(a.publishEpochs=e.publishEpochs);const s=e.publisherNodeIdentityIdOverride;return s!==void 0&&(a.publisherNodeIdentityIdOverride=x_(s)),Object.keys(a).length>0?a:void 0};function k_(e){const t=e;if(Array.isArray(t.entities))throw Object.assign(new Error("Knowledge Assets are shared atomically; root-entity selection is not supported"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(t.entities!==void 0&&t.entities!=="all")throw Object.assign(new Error("Knowledge Assets are shared atomically; omit entities to share the complete asset"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(t.skipSeal===!0)throw Object.assign(new Error("Knowledge Assets are always sealed before sharing"),{code:"UNSEALED_SHARE_BLOCKED"});if(t.skipSeal!==void 0&&t.skipSeal!==!1)throw new TypeError("skipSeal must be false or omitted");return t.subGraphName?{subGraphName:t.subGraphName}:{}}const S_=(e,t,n={})=>{const a=k_(n);return Cn(`/api/knowledge-assets/${encodeURIComponent(t)}/swm/share`,{contextGraphId:NS(e),...a.subGraphName?{subGraphName:a.subGraphName}:{}})},Tg=(e,t,n={})=>{const a=w_(n,["subGraphName"]);return Cn(`/api/knowledge-assets/${encodeURIComponent(t)}/vm/publish`,{contextGraphId:NS(e),...n.subGraphName?{subGraphName:n.subGraphName}:{},...a?{options:a}:{}})};async function Ag(e,t){let n=0,a=0,s;const l=[];let u=null,d=0n,f=0n,h=0n,g=0n,m,y=!0,b=!0;for(const j of t)try{const N=await Tg(e,j.name,j.subGraph?{subGraphName:j.subGraph}:{});n+=1,N.contextGraphError&&(a+=1,s===void 0&&(s=N.contextGraphError));const S=N;(!u||S.status==="confirmed"&&S.txHash&&!S.contextGraphError)&&(u=S);const T=S.convictionCostCovered;if(T)try{d+=BigInt(T.baseCost),f+=BigInt(T.discountedCost),h+=BigInt(T.drawnFromEpoch),g+=BigInt(T.drawnFromTopUp),m?(T.accountId!==m.accountId&&(y=!1),T.epoch!==m.epoch&&(b=!1)):m=T}catch{}}catch(N){const S=(N==null?void 0:N.message)??"publish failed";l.push({name:j.name,...j.subGraph?{subGraph:j.subGraph}:{},error:S})}const k=m?{...y&&m.accountId?{accountId:m.accountId}:{},...b&&m.epoch!=null?{epoch:m.epoch}:{},baseCost:d.toString(),discountedCost:f.toString(),drawnFromEpoch:h.toString(),drawnFromTopUp:g.toString()}:void 0;return{published:n,total:t.length,partial:a,partialError:s,failures:l,sample:u,convictionCostCovered:k}}async function Ql(e,t="wm"){var j,N,S,T,E,A,B,_;if(t==="swm"){const z=`did:dkg:context-graph:${e}/_meta`,q=`did:dkg:context-graph:${e}/`,M=`urn:dkg:assertion:${e}:`,R=`SELECT ?g ?vm WHERE {
67
+ GRAPH <${z}> {
68
+ ?g <http://dkg.io/ontology/memoryLayer> "SWM"
69
+ OPTIONAL { ?g <http://dkg.io/ontology/vmCurrentAssertion> ?vm }
70
+ }
71
+ FILTER(!CONTAINS(STR(?g), "/meta/assertion/"))
72
+ }`,P=await or(R,e),F=((j=P==null?void 0:P.result)==null?void 0:j.bindings)??[],Z=new Set,I=[];for(const V of F){const X=typeof V.g=="string"?V.g:(N=V.g)==null?void 0:N.value;if(!X)continue;const Y=typeof V.vm=="string"?V.vm:(S=V.vm)==null?void 0:S.value;let L,U;if(X.startsWith(q)){const O=X.slice(q.length).split("/");if(O.length===3&&O[0]==="assertion")U=O[2];else if(O.length===4&&O[1]==="assertion")L=O[0],U=O[3];else continue}else if(X.startsWith(M)){const O=X.slice(M.length);let ne=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(O);ne?U=ne[2]:(ne=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(O),ne&&(L=ne[1],U=ne[3]))}else continue;if(!U||L==="meta")continue;const G=`${L??""} ${U}`;I.push({key:G,name:U,subGraph:L,g:X}),Y&&Z.add(G)}const $=new Set,H=[];for(const V of I)Z.has(V.key)||$.has(V.key)||($.add(V.key),H.push({name:V.name,graphUri:V.g,subGraph:V.subGraph}));return H}const n=`did:dkg:context-graph:${e}/_meta`,a=`did:dkg:context-graph:${e}/`,s='FILTER(!CONTAINS(STR(?g), "/meta/assertion/"))',l=`SELECT ?g WHERE {
73
+ GRAPH <${n}> { ?g <http://dkg.io/ontology/memoryLayer> "WM" }
74
+ ${s}
75
+ }`,u=`SELECT ?g (COUNT(*) AS ?cnt) WHERE {
76
+ GRAPH <${n}> {
77
+ ?g <http://dkg.io/ontology/memoryLayer> "WM" ;
78
+ <http://dkg.io/ontology/assertionGraph> ?dg
79
+ }
80
+ GRAPH ?dg { ?s ?p ?o }
81
+ ${s}
82
+ } GROUP BY ?g`,[d,f]=await Promise.all([ld({sparql:l,contextGraphId:e,includeContextGraphPartitions:!0}),ld({sparql:u,contextGraphId:e,includeContextGraphPartitions:!0}).catch(()=>null)]),h=((T=d==null?void 0:d.result)==null?void 0:T.bindings)??[],g=new Map;for(const z of((E=f==null?void 0:f.result)==null?void 0:E.bindings)??[]){const q=typeof z.g=="string"?z.g:(A=z.g)==null?void 0:A.value,M=typeof z.cnt=="string"?z.cnt:(B=z.cnt)==null?void 0:B.value,R=typeof M=="string"?M.match(/^"?(\d+)/):null,P=R?parseInt(R[1],10):NaN;q&&Number.isFinite(P)&&g.set(q,P)}const m=[],y=new Set,b=`urn:dkg:assertion:${e}:`,k=[...h].sort((z,q)=>{var P,F;const M=(typeof z.g=="string"?z.g:(P=z.g)==null?void 0:P.value)??"",R=(typeof q.g=="string"?q.g:(F=q.g)==null?void 0:F.value)??"";return(M.startsWith(a)?0:1)-(R.startsWith(a)?0:1)});for(const z of k){const q=typeof z.g=="string"?z.g:(_=z.g)==null?void 0:_.value;if(!q)continue;let M,R;if(q.startsWith(a)){const Z=q.slice(a.length).split("/");if(Z.length===3&&Z[0]==="assertion")R=Z[2];else if(Z.length===4&&Z[1]==="assertion")M=Z[0],R=Z[3];else continue}else if(q.startsWith(b)){const Z=q.slice(b.length);let I=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(Z);I?R=I[2]:(I=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(Z),I&&(M=I[1],R=I[3]))}else continue;if(!R||M==="meta")continue;const P=`${M??""}\0${R}`;if(y.has(P))continue;y.add(P);const F=g.get(q);m.push({name:R,graphUri:q,tripleCount:F,subGraph:M})}return m}const oo=(e,t,n,a)=>{if(Array.isArray(n))throw Object.assign(new Error("Knowledge Assets are shared atomically; root-entity selection is not supported"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(typeof n=="string"&&n!=="all")throw Object.assign(new Error("Knowledge Assets are shared atomically; omit entities to share the complete asset"),{code:"KA_ATOMIC_SHARE_REQUIRED"});const s=n===void 0||typeof n=="string"?a:n.subGraphName??a;return S_(e,t,{subGraphName:s})};function _g(e,t){return t.promotedCount>0?{kind:"success",promotedCount:t.promotedCount,message:`Shared the complete Knowledge Asset ${e} to Shared Working Memory (${t.promotedCount} triple${t.promotedCount===1?"":"s"}).`}:{kind:"noop",message:`${e} was not newly shared. Its complete Knowledge Asset may already be in Shared Working Memory, or its content is still being committed — refresh and try again.`}}function lo(e,t){if(t instanceof $n&&t.status===413){const n=t.body;if((n==null?void 0:n.code)==="SWM_GOSSIP_PAYLOAD_TOO_LARGE")return{kind:"payload-too-large",actualBytes:typeof n.actualBytes=="number"?n.actualBytes:void 0,limitBytes:typeof n.limitBytes=="number"?n.limitBytes:void 0,message:`${e} is too large to share atomically. Split its content into smaller Knowledge Assets before sharing.`}}if(t instanceof $n&&t.status===409){const n=t.body;if((n==null?void 0:n.code)==="ASSERTION_NOT_PERSISTED"){const a=typeof n.expectedTripleCount=="number"?n.expectedTripleCount:void 0;return{kind:"not-persisted",expectedTripleCount:a,message:a?`${e} was imported with ${a} extracted triple${a===1?"":"s"} but the data graph is empty. Re-import the source file (or re-write the assertion) before promoting.`:`${e}'s data graph is empty but its extraction metadata says it should hold content. Re-import the source file before promoting.`}}}return null}const j_=(e,t,n)=>{const a=new URLSearchParams({contextGraphId:t});return n&&a.set("subGraphName",n),xt(`/api/knowledge-assets/${encodeURIComponent(e)}/wm/extraction-status?${a}`)};function Vu(e,t){const n=e.startsWith("sha256:")||e.startsWith("keccak256:")?e:`sha256:${e}`,a=t?`?contentType=${encodeURIComponent(t)}`:"";return`${_r}/api/file/${encodeURIComponent(n)}${a}`}const C_="binding incomplete";function Il(e){const t="Published on-chain, but linking it into the context graph did not complete, so context-graph views may be incomplete.";return e?`${t} (${e})`:t}const N_=(e=20)=>xt(`/api/memory/sessions?limit=${e}`),E_=(e,t={})=>{const n=new URLSearchParams;t.limit&&Number.isInteger(t.limit)&&t.limit>0&&n.set("limit",String(t.limit)),(t.order==="desc"||t.order==="asc")&&n.set("order",t.order);const a=n.toString();return xt(`/api/memory/sessions/${encodeURIComponent(e)}${a?`?${a}`:""}`)};function _S(e,t){var n,a,s;return{text:e,correlationId:(t==null?void 0:t.correlationId)??crypto.randomUUID(),...t!=null&&t.identity?{identity:t.identity}:{},...t!=null&&t.sessionId?{sessionId:t.sessionId}:{},...t!=null&&t.profile?{profile:t.profile}:{},...t!=null&&t.persistUserMessage?{persistUserMessage:t.persistUserMessage}:{},...(n=t==null?void 0:t.attachments)!=null&&n.length?{attachmentRefs:t.attachments}:{},...(a=t==null?void 0:t.attachmentImportResults)!=null&&a.length?{attachmentImportResults:t.attachmentImportResults}:{},...(s=t==null?void 0:t.contextEntries)!=null&&s.length?{contextEntries:t.contextEntries}:{},...t!=null&&t.contextGraphId?{contextGraphId:t.contextGraphId}:{}}}async function T_(e,t={}){var m;const n=await fetch("/api/openclaw-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Ft()},body:JSON.stringify(_S(e,t)),signal:t.signal});if(!n.ok){const y=await n.json().catch(()=>({}));throw cd(y,`Request failed (${n.status})`,n.status)}const a=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!a.includes("text/event-stream")){const y=await n.json();return(m=t.onEvent)==null||m.call(t,{type:"final",...y}),y}const s=n.body.getReader(),l=new TextDecoder;let u="",d,f;const h=y=>{var b;(b=t.onEvent)==null||b.call(t,y),y.type==="error"?f=cd(y,y.error||"Stream failed"):y.type==="final"&&(d={text:y.text,correlationId:y.correlationId,...y.sessionId?{sessionId:y.sessionId}:{},...y.turnId?{turnId:y.turnId}:{}})},g=y=>{let b=u.indexOf(`
83
+ `);for(;b!==-1;){const k=u.slice(0,b).trim();if(u=u.slice(b+1),b=u.indexOf(`
84
+ `),!k.startsWith("data:"))continue;const j=k.slice(5).trim();if(j){try{h(JSON.parse(j))}catch{}if(f)return}}if(y&&u.trim().startsWith("data:")){const k=u.trim().slice(5).trim();if(!k)return;try{h(JSON.parse(k))}catch{}u=""}};for(;;){const{done:y,value:b}=await s.read();if(y||(u+=l.decode(b,{stream:!0}),g(!1),f))break}if(u+=l.decode(),g(!0),f)throw f;if(!d)throw new Error("Stream ended without final payload");return d}const A_=()=>xt("/api/openclaw-channel/health");async function __(e,t={}){var y;const n=await fetch("/api/hermes-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Ft()},body:JSON.stringify(_S(e,t)),signal:t.signal});if(!n.ok){const b=await n.json().catch(()=>({}));throw cd(b,`Request failed (${n.status})`,n.status)}const a=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!a.includes("text/event-stream")){const b=await n.json();return(y=t.onEvent)==null||y.call(t,{type:"final",...b}),b}const s=n.body.getReader(),l=new TextDecoder;let u="",d,f;const h=b=>b.type==="delta"?{type:"text_delta",delta:b.text??""}:b,g=b=>{var k;(k=t.onEvent)==null||k.call(t,b),b.type==="error"?f=cd(b,b.error||"Stream failed"):b.type==="final"&&(d={text:b.text,correlationId:b.correlationId,...b.sessionId?{sessionId:b.sessionId}:{},...b.turnId?{turnId:b.turnId}:{}})},m=b=>{let k=u.indexOf(`
85
+ `);for(;k!==-1;){const j=u.slice(0,k).trim();if(u=u.slice(k+1),k=u.indexOf(`
86
+ `),!j.startsWith("data:"))continue;const N=j.slice(5).trim();if(N){try{g(h(JSON.parse(N)))}catch{}if(f)return}}if(b&&u.trim().startsWith("data:")){const j=u.trim().slice(5).trim();if(!j)return;try{g(h(JSON.parse(j)))}catch{}u=""}};for(;;){const{done:b,value:k}=await s.read();if(b||(u+=l.decode(k,{stream:!0}),m(!1),f))break}if(u+=l.decode(),m(!0),f)throw f;if(!d)throw new Error("Stream ended without final payload");return d}const R_=()=>xt("/api/hermes-channel/health");function O_(e,t){if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e,a=typeof n.error=="string"&&n.error.trim()?n.error.trim():t;if(n.details===void 0||n.details===null)return a;const s=typeof n.details=="string"?n.details.trim():JSON.stringify(n.details);return!s||s===a?a:`${a}: ${s}`}function cd(e,t,n){if(!e||typeof e!="object"||Array.isArray(e))return new wm(t,{status:n});const a=e,s=O_(a,t),l=f=>{const h=a[f];return typeof h=="string"&&h.trim()?h.trim():void 0},u=f=>{const h=a[f];return typeof h=="number"&&Number.isFinite(h)?h:void 0},d=f=>{const h=a[f];return typeof h=="boolean"?h:void 0};return new wm(s,{status:n,code:l("code"),source:l("source"),details:l("details"),correlationId:l("correlationId"),timeoutMs:u("timeoutMs"),target:l("target"),route:l("route"),integrationId:l("integrationId"),retryable:d("retryable")})}const Md={openclaw:{connectSupported:!0,chatSupported:!0,defaultSessionId:({integrationId:e})=>`${e}:dkg-ui`,resolveChatContext:({integrationId:e,sessionId:t})=>{if(!t)return{};const n=`${e}:dkg-ui:`;if(!t.startsWith(n))return{};const a=t.slice(n.length).trim();return a?{identity:a}:{}},fetchHealth:A_,streamChat:T_},hermes:{connectSupported:!0,chatSupported:!0,defaultSessionId:({integrationId:e,record:t,health:n})=>$_(e,t,n),resolveChatContext:({sessionId:e,profile:t})=>({...e?{sessionId:e}:{},...t?{profile:t}:{}}),fetchHealth:R_,streamChat:__}};function eo(e){var n,a;const t=e.trim().toLowerCase();return((a=(n=Md[t])==null?void 0:n.defaultSessionId)==null?void 0:a.call(n,{integrationId:t}))??null}function L_(e,t){return t!=null&&t.trim()?t.trim():eo(e)}async function M_(e,t=50){const n=a=>{if(a.turnId)return`urn:dkg:chat:turn:${encodeURIComponent(a.turnId)}:${encodeURIComponent(a.author)}`;const s=`${e}
87
+ ${a.author}
88
+ ${a.ts}
89
+ ${a.text}`;let l=2166136261;for(let u=0;u<s.length;u+=1)l^=s.charCodeAt(u),l=Math.imul(l,16777619);return`urn:dkg:chat:session:${encodeURIComponent(e)}:message:${(l>>>0).toString(16)}`};try{return[...(await E_(e,{limit:t,order:"desc"})).messages].reverse().map(s=>({uri:s.uri||n(s),text:s.text,author:s.author,ts:s.ts,turnId:s.turnId,persistStatus:s.persistStatus,failureReason:s.failureReason,attachmentRefs:s.attachmentRefs,toolCalls:s.toolCalls}))}catch(a){if(a instanceof $n&&a.status===404)return[];throw a}}function D_(e){var t,n,a;return!!((t=e.transport)!=null&&t.bridgeUrl||(n=e.transport)!=null&&n.gatewayUrl||(a=e.transport)!=null&&a.healthUrl)}function km(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return null}function z_(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||Rg(e)}function Rg(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function $_(e,t,n){const a=(t==null?void 0:t.metadata)??{},s=km(n==null?void 0:n.profile,a.profileName,a.profile),l=km(a.hermesHome),u=l?null:I_(t),d=[s?`profile-${z_(s)}`:null,l?`home-${Rg(l)}`:null,u].filter(f=>f!=null);return d.length?`${e}:dkg-ui:${d.join(":")}`:`${e}:dkg-ui`}function I_(e){const t=e==null?void 0:e.transport;if(!t)return null;const n=[t.kind,t.bridgeUrl,t.gatewayUrl,t.healthUrl].filter(a=>typeof a=="string"&&a.trim().length>0);return n.length?`transport-${Rg(n.join("|"))}`:null}function P_(e){return e?typeof e=="string"?e:[e.provider,e.mode,e.status].filter(Boolean).join(" / ")||null:null}function U_(e,t){if(e==="degraded")return!0;const n=String((t==null?void 0:t.status)??"").toLowerCase(),a=t==null?void 0:t.memory;return n.includes("degraded")||n.includes("conflict")||typeof a=="object"&&a!=null&&a.conflict===!0}function RS(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Bx(e){if(!RS(e))return-1;let t=e.ok===!1?100:0;return e.profile&&(t+=10),e.memory&&(t+=10),e.status&&(t+=10),e.error&&(t+=10),e.ok===!0&&(t+=1),t}function B_(e){if(e.target==="bridge")return{target:"bridge",details:e.bridge};if(e.target==="gateway")return{target:"gateway",details:e.gateway};const t=Bx(e.bridge),n=Bx(e.gateway);return t<0&&n<0?{}:t>=n?{target:"bridge",details:e.bridge}:{target:"gateway",details:e.gateway}}function F_(e){if(!e)return null;const{target:t,details:n}=B_(e);if(!RS(n))return e;const a=typeof n.ok=="boolean"?n.ok:void 0;return{...n,...e,ok:e.ok===!1?!1:a??e.ok,target:e.target??t,profile:e.profile??n.profile,memory:e.memory??n.memory,status:e.status??n.status,error:e.error??n.error}}function H_(e,t){if(String(e.id??"").toLowerCase()!=="hermes")return null;const n=t==null?void 0:t.profile,a=n?`profile ${n}`:"the configured profile",s=P_(t==null?void 0:t.memory),l=typeof(t==null?void 0:t.memory)=="object"&&t.memory!=null?t.memory:null;return(l==null?void 0:l.conflict)===!0||String((t==null?void 0:t.status)??"").toLowerCase().includes("conflict")?`${e.name} ${a} has a memory provider conflict${s?` (${s})`:""}.`:t!=null&&t.ok?`${e.name} ${a} is connected${s?` with ${s} memory`:""}.`:t!=null&&t.status?`${e.name} ${a} reports ${t.status}${s?` (${s})`:""}.`:null}async function Og(e){var A,B,_,z,q,M,R,P,F,Z,I,$,H,V;const t=String(e.id??"").toLowerCase(),n=Md[t],a=((A=e.capabilities)==null?void 0:A.localChat)===!0&&(n==null?void 0:n.chatSupported)===!0,s=a&&((B=e.capabilities)==null?void 0:B.chatAttachments)===!0,l=((_=e.capabilities)==null?void 0:_.connectFromUi)===!0&&(n==null?void 0:n.connectSupported)===!0,u=e.enabled===!0,d=(z=e.runtime)==null?void 0:z.status,f=u&&a&&(n!=null&&n.fetchHealth)?F_(await n.fetchHealth().catch(()=>null)):null,h=U_(d,f),g=(f==null?void 0:f.ok)===!0&&!h,m=g,y=u&&a&&(g||d==="connecting"||d==="degraded"||((q=e.runtime)==null?void 0:q.ready)===!0||D_(e)),b=H_(e,f),k=(M=n==null?void 0:n.defaultSessionId)==null?void 0:M.call(n,{integrationId:t,record:e,health:f}),j=t==="hermes"?km(f==null?void 0:f.profile,(R=e.metadata)==null?void 0:R.profileName,(P=e.metadata)==null?void 0:P.profile):void 0;let N,S,T;y&&h?(N="degraded",S="Degraded",T=b??(f==null?void 0:f.error)??((F=e.runtime)==null?void 0:F.lastError)??`${e.name} is attached to this node, but one capability is degraded.`):y&&((Z=e.runtime)==null?void 0:Z.status)==="connecting"?(N="connecting",S="Connecting",T=((I=e.runtime)==null?void 0:I.lastError)??`${e.name} is registered and still starting up.`):m?(N="chat_ready",S="Chat ready",T=`${e.name} is connected to this node and ready for chat.`):y?(N="bridge_offline",S="Bridge offline",T=b??(f==null?void 0:f.error)??(($=e.runtime)==null?void 0:$.lastError)??`${e.name} is attached to this node, but it is not responding right now.`):n?(N="available",S=l?"Ready to connect":"Awaiting chat bridge",T=u?`${e.name} is registered, but this panel is waiting for the framework chat bridge.`:((H=e.runtime)==null?void 0:H.lastError)??`Use the node-served skill plus ${e.name} onboarding to attach an existing local agent.`):(N="coming_soon",S=u?"Registered, panel pending":"Next integration",T=u?`${e.name} is registered on the node, but the right-panel chat bridge is not wired yet.`:"The local-agent registry is in place so this framework can plug into the same side-panel flow next.");const E=m?"Connected":N==="connecting"?"Connecting":N==="degraded"?"Degraded":y?"Unavailable":l?"Ready to connect":"Coming next";return{id:t,name:e.name,framework:e.name,description:e.description,defaultSessionId:k,profile:j,chatSupported:a,chatAttachments:s,connectSupported:l,configured:u,detected:u||g,persistentChat:y,chatReady:g,bridgeOnline:m,bridgeStatusLabel:E,status:N,statusLabel:S,detail:T,error:g?void 0:(f==null?void 0:f.error)??((V=e.runtime)==null?void 0:V.lastError)??void 0,target:f==null?void 0:f.target,source:u||n?"live":"planned"}}async function Dd(){const e=await xt("/api/local-agent-integrations"),t=await Promise.all((e.integrations??[]).map(Og));return t.sort((n,a)=>{const s=n.id==="openclaw"?0:1,l=a.id==="openclaw"?0:1;return s!==l?s-l:n.persistentChat!==a.persistentChat?n.persistentChat?-1:1:n.name.localeCompare(a.name)}),{integrations:t}}async function q_(e){const t=e.trim().toLowerCase(),n=Md[t];if(!(n!=null&&n.connectSupported))throw new Error(`${e} local connect is not available yet.`);const a=await Cn("/api/local-agent-integrations/connect",{id:t,metadata:{source:"node-ui"}}),s=a.integration?await Og(a.integration):(await Dd()).integrations.find(l=>l.id===t);if(!s)throw new Error(`Missing local agent integration: ${t}`);return{integration:s,notice:a.notice}}async function G_(e){const t=e.trim().toLowerCase();await Sg(`/api/local-agent-integrations/${encodeURIComponent(t)}`,{enabled:!1,runtime:{status:"disconnected",ready:!1,lastError:null}})}async function V_(e){const t=e.trim().toLowerCase(),n=await Cn(`/api/local-agent-integrations/${encodeURIComponent(t)}/refresh`,{}),a=n.integration?await Og(n.integration):(await Dd()).integrations.find(s=>s.id===t);if(!a)throw new Error(`Missing local agent integration: ${t}`);return{integration:a,notice:n.notice}}async function Fx(e,t=50,n={}){const a=L_(e,n.sessionId);return a?M_(a,t):[]}async function W_(e){var n;const t=(n=e.sessionId)==null?void 0:n.trim();if(!t)throw new Error("Missing Hermes session id");return Cn("/api/hermes-channel/persist-turn",{sessionId:t,userMessage:e.userMessage,assistantReply:e.assistantReply??"",correlationId:e.correlationId,attachmentRefs:e.attachments,persistenceState:"failed",failureReason:e.failureReason,contextGraphId:e.contextGraphId,profile:e.profile,metadata:{source:"node-ui-failed-turn"}})}async function Z_(e,t){if(e.trim().toLowerCase()==="hermes")return W_(t);throw new Error(`${e} local chat persistence is not available yet.`)}async function K_(e,t,n={}){var l;const a=e.trim().toLowerCase(),s=Md[a];if(s!=null&&s.streamChat){const{sessionId:u,profile:d,...f}=n;return s.streamChat(t,{...f,...(l=s.resolveChatContext)==null?void 0:l.call(s,{integrationId:a,sessionId:u,profile:d})})}throw new Error(`${e} local chat is not available yet.`)}const Y_=()=>xt("/api/economics"),Lg=()=>xt("/api/wallets/balances"),YG=()=>Cn("/api/shutdown",{}),Q_=()=>xt("/api/notifications"),OS=e=>Cn("/api/notifications/read",e?{ids:e}:{}),Mg=e=>SS(`/api/sub-graph/list?contextGraphId=${encodeURIComponent(e)}`,CS),X_={name:"my-dkg-node",networkName:"DKG Mainnet",connectedPeers:12,synced:!0,version:"10.0.0-rc"},J_={total_kcs:1842,confirmed_kcs:1623,tentative_kcs:219},eR={agents:[{name:"my-dkg-node",peerId:"QmYourNode123",connectionStatus:"self"},{name:"research-agent",peerId:"QmResearch456",connectionStatus:"connected",lastSeen:Date.now()},{name:"data-curator",peerId:"QmCurator789",connectionStatus:"connected",lastSeen:Date.now()-6e4},{name:"pharma-bot",peerId:"QmPharma012",connectionStatus:"discovered",lastSeen:Date.now()-3e5}]},tR={contextGraphs:[{id:"cg:pharma-drug-interactions",name:"Pharma Drug Interactions",description:"Drug interaction knowledge graph for clinical decision support",assetCount:227,agentCount:3,callerInvolved:!0,curator:"did:dkg:agent:0x1111111111111111111111111111111111111111"},{id:"cg:climate-science",name:"Climate Science",description:"Climate research data and projections",assetCount:45,agentCount:2,callerInvolved:!0,curator:"did:dkg:agent:0x1111111111111111111111111111111111111111"},{id:"cg:supply-chain-eu",name:"EU Supply Chain",description:"European supply chain provenance tracking",assetCount:89,agentCount:1,callerInvolved:!0,curator:"did:dkg:agent:0x5555555555555555555555555555555555555555"}]},nR={"cg:pharma-drug-interactions":{contextGraphId:"cg:pharma-drug-interactions",allowedAgents:["0x2222222222222222222222222222222222222222","0x3333333333333333333333333333333333333333"]},"cg:climate-science":{contextGraphId:"cg:climate-science",allowedAgents:["0x4444444444444444444444444444444444444444"]},"cg:supply-chain-eu":{contextGraphId:"cg:supply-chain-eu",allowedAgents:[]}},rR={operations:[{id:"op-1",name:"publish",status:"completed",startedAt:Date.now()-12e4},{id:"op-2",name:"query",status:"completed",startedAt:Date.now()-3e5},{id:"op-3",name:"publish",status:"completed",startedAt:Date.now()-6e5},{id:"op-4",name:"chat",status:"completed",startedAt:Date.now()-9e5},{id:"op-5",name:"sync",status:"failed",startedAt:Date.now()-18e5},{id:"op-6",name:"publish",status:"completed",startedAt:Date.now()-36e5}],total:6},aR={periods:[{label:"24h",publishCount:3,successCount:3,totalGasEth:7e-4,totalTrac:9.1,avgGasEth:23e-5,avgTrac:3.03},{label:"7d",publishCount:14,successCount:12,totalGasEth:.0034,totalTrac:42.5,avgGasEth:24e-5,avgTrac:3.04},{label:"30d",publishCount:47,successCount:43,totalGasEth:.012,totalTrac:156.8,avgGasEth:26e-5,avgTrac:3.34}]},iR={agentAddress:"0x1111111111111111111111111111111111111111",agentDid:"did:dkg:agent:0x1111111111111111111111111111111111111111",name:"mock-node-agent",framework:"mock",peerId:"QmMockNodeAgentPeer000000000000000000000000",nodeIdentityId:"mock-node-identity"},sR={wallets:["0xA1b2C3d4E5f60718293a4B5c6D7e8F9012345678","0xB2c3D4e5F60718293a4B5c6D7e8F90123456789a","0xC3d4E5f60718293a4B5c6D7e8F90123456789aB1"],balances:[{address:"0xA1b2C3d4E5f60718293a4B5c6D7e8F9012345678",eth:"0.842",trac:"1250.50",symbol:"TRAC"},{address:"0xB2c3D4e5F60718293a4B5c6D7e8F90123456789a",eth:"0.310",trac:"480.00",symbol:"TRAC"},{address:"0xC3d4E5f60718293a4B5c6D7e8F90123456789aB1",eth:"0.005",trac:"0.00",symbol:"TRAC"}],chainId:"8453",rpcUrl:"https://mock.rpc",symbol:"TRAC"},oR={notifications:[{type:"join_request",id:101,ts:Date.now()-12e4,read:0,contextGraphId:"cg:pharma-drug-interactions",meta:{contextGraphName:"Pharma Drug Interactions",agentAddress:"0xab12cd34ef56ab78cd90ab12cd34ef56ab78cd90",agentName:"research-agent"}},{type:"assertion_activity",id:"activity:cg:pharma-drug-interactions:promoted:29812",ts:Date.now()-3e5,read:0,contextGraphId:"cg:pharma-drug-interactions",meta:{contextGraphName:"Pharma Drug Interactions",kind:"promoted",count:3,actorAgentDid:"did:dkg:agent:0xdana00000000000000000000000000000000dana",actorAgentName:"Dana",soleAuthor:!0}},{type:"join_approved",id:102,ts:Date.now()-9e5,read:1,contextGraphId:"cg:climate-arctic",meta:{contextGraphName:"Arctic Climate",agentAddress:"0x0000000000000000000000000000000000000001"}}],badgeCount:2},lR={lines:["[2026-04-11 10:30:01] INFO Node started on port 8900","[2026-04-11 10:30:02] INFO Connected to DKG mainnet","[2026-04-11 10:30:03] INFO Discovered 12 peers","[2026-04-11 10:30:05] INFO Syncing context graph cg:pharma-drug-interactions","[2026-04-11 10:30:08] INFO Sync complete: 227 assets, 3 agents","[2026-04-11 10:30:15] INFO Agent research-agent connected via libp2p","[2026-04-11 10:31:00] INFO Publish operation started: warfarin-aspirin-001","[2026-04-11 10:31:12] INFO Triple store updated: +34 triples","[2026-04-11 10:31:15] INFO Publish complete: warfarin-aspirin-001 → Verifiable Memory","[2026-04-11 10:32:00] DEBUG SPARQL query executed in 23ms (42 results)","[2026-04-11 10:33:00] INFO Gossip: received 3 proposals from data-curator","[2026-04-11 10:34:00] INFO SWM cleanup: 0 expired triples removed","[2026-04-11 10:35:00] INFO Heartbeat: 12 peers, 1842 KAs, memory 245MB"],totalSize:13},cR={sessions:[{session:"sess-abc123",messages:[{author:"user",text:"What drug interactions should I know about warfarin?",ts:"2026-04-11T10:00:00Z"},{author:"assistant",text:"Warfarin has significant interactions with aspirin, NSAIDs, and several antibiotics. The most critical ones involve...",ts:"2026-04-11T10:00:05Z"}]},{session:"sess-def456",messages:[{author:"user",text:"Summarize the latest climate data for Arctic ice",ts:"2026-04-10T14:00:00Z"},{author:"assistant",text:"Based on the latest projections in the verifiable memory...",ts:"2026-04-10T14:00:03Z"}]}]};function rr(e,t=50){return new Promise(n=>setTimeout(()=>n(e),t))}const ar={fetchStatus:()=>rr(X_),fetchMetrics:()=>rr(J_),fetchAgents:()=>rr(eR),fetchContextGraphs:()=>rr(tR),fetchOperationsWithPhases:()=>rr(rR),fetchEconomics:()=>rr(aR),fetchWalletsBalances:()=>rr(sR),fetchCurrentAgent:()=>rr(iR),listParticipants:e=>rr(nR[e]??{contextGraphId:e,allowedAgents:[]}),fetchSubGraphs:e=>rr({contextGraphId:e,subGraphs:[]}),fetchNotificationsFeed:()=>rr(oR),fetchNodeLog:()=>rr(lR),fetchMemorySessions:()=>rr(cR)};let Ma=null,ml=null;const uR=5e3,Hx=2,dR=250,Sm=new Set;function pR(){return Ma===!0}function fR(e){return Sm.add(e),e(Ma===!0),()=>{Sm.delete(e)}}function hR(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}function mR(e){return new Promise(t=>setTimeout(t,e))}async function gR(){for(let e=1;e<=Hx;e+=1){try{const t=await fetch("/api/status",{cache:"no-store",headers:hR(),signal:AbortSignal.timeout(uR)});if(t.ok||t.status===401)return!1}catch{}e<Hx&&await mR(dR)}return!0}async function vR(){if(Ma!==null)return Ma;if(ml)return ml;ml=(async()=>(Ma=await gR(),typeof window<"u"&&(window.__DKG_USING_MOCKS__=Ma,Ma&&console.warn("[dkg-ui] /api/status unreachable (timeout/5xx/network) — falling back to demo (mock) data. The UI is NOT showing live node state.")),Sm.forEach(e=>e(Ma)),Ma))();try{return await ml}finally{ml=null}}async function ir(e,t){return await vR()?t():e()}const An={fetchStatus:()=>ir(jg,ar.fetchStatus),fetchMetrics:()=>ir(l_,ar.fetchMetrics),fetchAgents:()=>ir(Cg,ar.fetchAgents),fetchContextGraphs:()=>ir(Ld,ar.fetchContextGraphs),fetchOperationsWithPhases:e=>ir(()=>c_(e),ar.fetchOperationsWithPhases),fetchEconomics:()=>ir(Y_,ar.fetchEconomics),fetchWalletsBalances:()=>ir(Lg,ar.fetchWalletsBalances),fetchCurrentAgent:()=>ir(Yl,ar.fetchCurrentAgent),listParticipants:e=>ir(()=>ES(e),()=>ar.listParticipants(e)),fetchSubGraphs:e=>ir(()=>Mg(e),()=>ar.fetchSubGraphs(e)),fetchNotificationsFeed:()=>ir(Q_,ar.fetchNotificationsFeed),fetchNodeLog:e=>ir(()=>u_(e),ar.fetchNodeLog),fetchMemorySessions:e=>ir(()=>N_(e),ar.fetchMemorySessions),markNotificationsRead:OS,executeQuery:or},yR=6e4;let wi={data:null,loading:!0,error:null},ta=null,_l=null,Tl=0,xi="";const ud=new Set;function Ki(){if(typeof window>"u")return"";const e=window.__DKG_TOKEN__;return e?`Bearer ${e}`:""}function Wu(e){xi=e,wi={data:null,loading:!0,error:null}}function yh(){const e=Ki();return e!==xi&&Wu(e),wi}function Zu(){for(const e of ud)e()}function bh(e){wi=e,Zu()}function dd(){const e=Tl,t=Ki();if((ta==null?void 0:ta.authKey)===t)return ta.promise;t!==xi?(Wu(t),Zu()):bh({...wi,loading:!0,error:null});const n=An.fetchCurrentAgent().then(a=>{if(e===Tl){if(t!==Ki()){const s=Ki(),l=xi!==s||wi.loading;xi!==s&&(Wu(s),Zu()),l&&dd();return}bh({data:a,loading:!1,error:null})}}).catch(a=>{if(e===Tl){if(t!==Ki()){const s=Ki(),l=xi!==s||wi.loading;xi!==s&&(Wu(s),Zu()),l&&dd();return}bh({data:wi.data,loading:!1,error:a instanceof Error?a.message:"Failed to load current agent"})}}).finally(()=>{e===Tl&&(ta==null?void 0:ta.promise)===n&&(ta=null)});return ta={authKey:t,promise:n},n}function bR(){dd(),!_l&&(_l=setInterval(()=>{dd()},yR))}function xR(){ud.size>0||!_l||(clearInterval(_l),_l=null,Tl+=1,ta=null,wi={data:null,loading:!0,error:null},xi=Ki())}function zd(){const[e,t]=w.useState(yh);return w.useEffect(()=>{const n=()=>t(yh());return ud.add(n),t(yh()),bR(),()=>{ud.delete(n),xR()}},[]),e}const Ar=as(e=>({contextGraphs:[],loading:!1,activeProjectId:null,setContextGraphs:t=>e({contextGraphs:t}),setLoading:t=>e({loading:t}),setActiveProject:t=>e({activeProjectId:t})})),to=new Set;let yn=null,Ku=null;const wR=350;function qx(e){return e==="wm"||e==="swm"||e==="vm"}function kR(e){const t=e.layers;return Array.isArray(t)?t.filter(qx):qx(e.layer)?[e.layer]:[]}function SR(e,t,n){if(!t||e.contextGraphId!==t)return!1;if(!n||n.length===0)return!0;const a=kR(e);return a.length===0?!0:n.some(s=>a.includes(s))}function LS(){if(yn)return;const e=typeof window<"u"?window.__DKG_TOKEN__:void 0,t=e?`/api/events?token=${encodeURIComponent(e)}`:"/api/events";yn=new EventSource(t);const n=a=>s=>{let l={};try{l=JSON.parse(s.data)}catch{}const u={type:a,data:l};for(const d of to)try{d(u)}catch{}};yn.addEventListener("join_request",n("join_request")),yn.addEventListener("join_approved",n("join_approved")),yn.addEventListener("join_rejected",n("join_rejected")),yn.addEventListener("project_synced",n("project_synced")),yn.addEventListener("memory_graph_changed",n("memory_graph_changed")),yn.addEventListener("notification",n("notification")),yn.addEventListener("connected",n("connected")),yn.onerror=()=>{yn==null||yn.close(),yn=null,to.size>0&&(Ku=setTimeout(LS,3e3))}}function jR(){Ku&&(clearTimeout(Ku),Ku=null),yn==null||yn.close(),yn=null}function CR(e){return to.add(e),to.size===1&&LS(),()=>{to.delete(e),to.size===0&&jR()}}function is(e){const t=w.useRef(e);t.current=e,w.useEffect(()=>CR(n=>t.current(n)),[])}function xo(e,t,n={}){var f;const a=w.useRef(t),s=w.useRef(null);a.current=t;const l=n.debounceMs??wR,u=w.useMemo(()=>n.layers??[],[(f=n.layers)==null?void 0:f.join("|")]),d=w.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]);is(w.useCallback(h=>{h.type==="memory_graph_changed"&&SR(h.data,e,u)&&(d(),s.current=setTimeout(()=>{s.current=null,a.current(h.data)},l))},[d,e,l,u])),w.useEffect(()=>d,[d])}function Xl(e,t,n={}){const a=w.useRef(e);a.current=e;const s=w.useRef(n);s.current=n,w.useEffect(()=>{if(t<=0)return;let l=null,u=!1;const d=()=>{l||u||(l=setInterval(()=>a.current(),t))},f=()=>{l&&(clearInterval(l),l=null)},h=()=>{if(document.hidden){f();return}a.current(),d()};return s.current.runImmediately!==!1&&!document.hidden&&a.current(),document.hidden||d(),document.addEventListener("visibilitychange",h),()=>{u=!0,document.removeEventListener("visibilitychange",h),f()}},[t])}const NR="No pending join request found";function ER(e){const t=[];for(const n of e)n.type==="join_request"&&t.push({id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,agentAddress:n.meta.agentAddress,agentName:n.meta.agentName,ts:n.ts,read:n.read===1});return t.sort((n,a)=>a.ts-n.ts),t}function TR(e){const t=[];for(const n of e)n.type==="assertion_activity"?t.push({kind:"digest",id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,event:n.meta.kind,count:n.meta.count,...n.meta.soleAuthor&&n.meta.actorAgentDid?{actorAgentDid:n.meta.actorAgentDid,actorAgentName:n.meta.actorAgentName}:{},...n.meta.bySelf?{bySelf:!0}:{},ts:n.ts,read:n.read===1}):n.type==="join_approved"||n.type==="join_rejected"?t.push({kind:n.type,id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,ts:n.ts,read:n.read===1}):n.type==="pca_cost_covered"&&t.push({kind:"pca_cost_covered",id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,covered:n.meta,publisherAddress:n.meta.publisherAddress,ts:n.ts,read:n.read===1});return t.sort((n,a)=>a.ts-n.ts),t}function Gx(e){return e.filter(t=>t.type!=="join_request"&&t.read===0).map(t=>t.id)}function Vx(e){const t=e instanceof Error?e.message:String(e);if(t.includes(NR))return{ok:!0,alreadyHandled:!0};const n=/context graph creator|manage (invitations|join requests)|curator/i.test(t);return{ok:!1,error:t,roleError:n}}function AR(){const[e,t]=w.useState(null),[n,a]=w.useState("loading"),[s,l]=w.useState(!1),u=w.useRef(!1),d=w.useCallback(()=>{An.fetchNotificationsFeed().then(E=>{u.current=!0,t(E),l(!1),a(E.scopeUnknown?"identity-pending":"ready")}).catch(()=>{u.current?l(!0):a("error")})},[]);Xl(d,6e4);const f=w.useRef(null),h=w.useCallback(()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{f.current=null,d()},400)},[d]);w.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),is(w.useCallback(E=>{E.type==="notification"&&h()},[h]));const g=w.useMemo(()=>ER((e==null?void 0:e.notifications)??[]),[e]),m=w.useMemo(()=>TR((e==null?void 0:e.notifications)??[]),[e]),y=(e==null?void 0:e.badgeCount)??0,b=w.useMemo(()=>Gx((e==null?void 0:e.notifications)??[]).length>0,[e]),k=w.useCallback(E=>{E.length!==0&&(t(A=>{if(!A)return A;const B=new Set(E.map(String));return{...A,notifications:A.notifications.map(_=>B.has(String(_.id))?{..._,read:1}:_)}}),OS(E).then(d).catch(()=>{}))},[d]),j=w.useCallback(()=>{k(Gx((e==null?void 0:e.notifications)??[]))},[e,k]),N=w.useCallback(async(E,A)=>{try{return await Ng(E,A),d(),{ok:!0}}catch(B){const _=Vx(B);return _.ok&&_.alreadyHandled&&d(),_}},[d]),S=w.useCallback(async(E,A)=>{try{return await Eg(E,A),d(),{ok:!0}}catch(B){const _=Vx(B);return _.ok&&_.alreadyHandled&&d(),_}},[d]),T=w.useCallback(()=>{l(!1),a(u.current?"ready":"loading"),d()},[d]);return{joinRequests:g,activity:m,unread:y,hasInformationalUnread:b,status:n,refreshError:s,partialActivityError:!1,approve:N,deny:S,markSeen:k,markAllInformationalSeen:j,retry:T}}const _R="dkg-pca",RR=150;function OR(e){return[String(e.chainId).toLowerCase(),e.nft.toLowerCase(),e.token.toLowerCase()].join(":")}function yi(e){return e?`${_R}:${e}`:null}const xh={trackedIds:[],createPending:null,topUpPending:{}};function Rl(e){return typeof e=="string"&&/^\d+$/.test(e)}function LR(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const a of e)Rl(a)&&!t.has(a)&&(t.add(a),n.push(a));return n}function MR(e){if(e==null||typeof e!="object")return null;const t=e;return typeof t.ownerEoa!="string"||t.ownerEoa.length===0||typeof t.submittedAt!="number"||!Number.isFinite(t.submittedAt)?null:{ownerEoa:t.ownerEoa,submittedAt:t.submittedAt,...typeof t.txHash=="string"&&t.txHash.length>0?{txHash:t.txHash}:{}}}function DR(e){if(e==null||typeof e!="object")return{};const t={};for(const[n,a]of Object.entries(e)){if(!Rl(n)||a==null||typeof a!="object")continue;const s=a;s.accountId===n&&(typeof s.ownerEoa!="string"||s.ownerEoa.length===0||typeof s.txHash!="string"||s.txHash.length===0||typeof s.submittedAt!="number"||!Number.isFinite(s.submittedAt)||(t[n]={accountId:n,ownerEoa:s.ownerEoa,txHash:s.txHash,submittedAt:s.submittedAt,...typeof s.tokens=="string"?{tokens:s.tokens}:{},...typeof s.previousTopUpBufferTrac=="string"?{previousTopUpBufferTrac:s.previousTopUpBufferTrac}:{}}))}return t}function MS(e){const t=yi(e);if(!t)return{...xh};try{const n=localStorage.getItem(t);if(!n)return{...xh};const a=JSON.parse(n);return{trackedIds:LR(a.trackedIds),createPending:MR(a.createPending),topUpPending:DR(a.topUpPending)}}catch{return{...xh}}}let ra=null;function wu(e,t){e&&(ra&&clearTimeout(ra),ra=setTimeout(()=>{ra=null;try{localStorage.setItem(e,JSON.stringify(t))}catch{}},RR))}function wh(e,t){if(ra&&(clearTimeout(ra),ra=null),!e)return!1;try{return localStorage.setItem(e,JSON.stringify(t)),!0}catch{return!1}}function Fi(e){return{trackedIds:e.trackedIds,createPending:e.createPending,topUpPending:e.topUpPending}}const ku=MS(null),Pl=as((e,t)=>({scopeKey:null,trackedIds:ku.trackedIds,createPending:ku.createPending,topUpPending:ku.topUpPending,createPendingPersisted:ku.createPending!=null,setScope:n=>{if(t().scopeKey===n)return;ra&&(clearTimeout(ra),ra=null);const a=MS(n);e({scopeKey:n,trackedIds:a.trackedIds,createPending:a.createPending,topUpPending:a.topUpPending,createPendingPersisted:a.createPending!=null})},trackAccount:n=>{Rl(n)&&(e(a=>a.trackedIds.includes(n)?a:{trackedIds:[...a.trackedIds,n]}),wu(yi(t().scopeKey),Fi(t())))},untrackAccount:n=>{e(a=>a.trackedIds.includes(n)?{trackedIds:a.trackedIds.filter(s=>s!==n)}:a),wu(yi(t().scopeKey),Fi(t()))},isTracked:n=>t().trackedIds.includes(n),setCreatePending:n=>{e({createPending:n});const a=wh(yi(t().scopeKey),Fi(t()));return e({createPendingPersisted:a}),a},clearCreatePending:()=>{e({createPending:null,createPendingPersisted:!1}),wu(yi(t().scopeKey),Fi(t()))},setTopUpPending:n=>{Rl(n.accountId)&&(e(a=>({topUpPending:{...a.topUpPending,[n.accountId]:n}})),wh(yi(t().scopeKey),Fi(t())))},clearTopUpPending:n=>{e(a=>{if(!a.topUpPending[n])return a;const s={...a.topUpPending};return delete s[n],{topUpPending:s}}),wu(yi(t().scopeKey),Fi(t()))},finishCreate:n=>{e(a=>({createPending:null,createPendingPersisted:!1,trackedIds:Rl(n)&&!a.trackedIds.includes(n)?[...a.trackedIds,n]:a.trackedIds})),wh(yi(t().scopeKey),Fi(t()))}}));function kh(e){if(!e)return!1;try{return BigInt(e)>0n}catch{return!1}}function DS(e,t=Math.floor(Date.now()/1e3)){const{expiresAtTimestamp:n}=e;return typeof n=="number"&&n>0&&t>=n}function zS(e,t){return DS(e,t)||!!e.fullySwept}function Dg(e){return kh(e.topUpBuffer)?!0:e.remainingAllowance!==void 0?kh(e.remainingAllowance):e.extendedRequested?null:kh(e.baseEpochAllowance)}function zR(e){return Dg(e)===!0}function $R(e){return e.remainingAllowance!==void 0&&Dg(e)===!1}const $S=90,IS=10080*60;function IR(e,t=Math.floor(Date.now()/1e3)){const{expiresAtTimestamp:n,fullySwept:a,agentCount:s}=e,l=typeof n=="number"&&n>0;return DS(e,t)?"expired":a?"swept":$R(e)?"insolvent":typeof s=="number"&&s>=$S?"cap-near":l&&n-t<=IS?"expiring":"healthy"}function PR(e,t){return!zS(e,t)&&zR(e)}function UR(e){return(e==null?void 0:e.adapterSupported)===!1?null:(e==null?void 0:e.registered)??null}function jm(e,t){var u;const n=UR(e.probedKey);if(n===null)return{outcome:"inconclusive",registered:null,adapterUnsupported:((u=e.probedKey)==null?void 0:u.adapterSupported)===!1};if(n===!1)return{outcome:"unregistered",registered:!1};const a=zS(e,t),s=Dg(e);if(s===null)return{outcome:"inconclusive",registered:null,adapterUnsupported:!1};const l=s;return!a&&l?{outcome:"covers",registered:!0}:{outcome:"uncovered",registered:!0,dead:a,hasBudget:l}}const Wx=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();async function BR(e,t){const n={accountId:e,snapshot:null,error:null,notFound:!1,classification:"unknown",ownerIsPrimaryWallet:!1,health:null,walletProbes:[],approvedCount:0,walletCount:t.length,probesInconclusive:!1};let a;try{a=await od(e,void 0,{extended:!0})}catch(h){return{...n,error:h,notFound:h instanceof $n&&h.status===404}}const s=await Promise.all(t.map(h=>od(e,h,{extended:!0}).then(g=>({wallet:h,registered:jm(g).registered})).catch(()=>({wallet:h,registered:null})))),l=s.filter(h=>h.registered===!0).length,u=s.some(h=>h.registered===null),f=t.some(h=>Wx(h,a.owner))?"owned":l>0?"approved":"unknown";return{accountId:e,snapshot:a,error:null,notFound:!1,classification:f,ownerIsPrimaryWallet:Wx(t[0],a.owner),health:IR(a),walletProbes:s,approvedCount:l,walletCount:t.length,probesInconclusive:u}}const no=new Map;function Zx(e){for(const t of e.subs)t()}async function pd(e){const t=++e.seq;if(e.ids.length===0){if(t!==e.seq)return;e.data={wallets:[],walletsError:!1,accounts:[]},e.error=null,e.loading=!1,Zx(e);return}try{const n=await Lg().catch(()=>null),a=(n==null?void 0:n.wallets)??[],s=!n||!!n.error,l=await Promise.all(e.ids.map(u=>BR(u,a)));if(t!==e.seq)return;e.data={wallets:a,walletsError:s,accounts:l},e.error=null}catch(n){if(t!==e.seq)return;e.error=(n==null?void 0:n.message)??"Failed to resolve PCAs."}finally{t===e.seq&&(e.loading=!1,Zx(e))}}function Sh(e){e.timer||e.intervalMs<=0||typeof document<"u"&&document.hidden||(e.timer=setInterval(()=>pd(e),e.intervalMs))}function jh(e){e.timer&&(clearInterval(e.timer),e.timer=null)}function FR(e,t,n,a){let s=no.get(e);const l=!s;if(s||(s={ids:t,data:null,loading:!0,error:null,subs:new Set,timer:null,intervalMs:n,onVisibility:null,seq:0},no.set(e,s)),s.subs.add(a),l){const u=s,d=()=>{typeof document>"u"||(document.hidden?jh(u):(pd(u),Sh(u)))};s.onVisibility=d,typeof document<"u"&&document.addEventListener("visibilitychange",d),pd(s),Sh(s)}else n<s.intervalMs&&(s.intervalMs=n,jh(s),Sh(s));return()=>{const u=no.get(e);u&&(u.subs.delete(a),u.subs.size===0&&(jh(u),u.onVisibility&&typeof document<"u"&&document.removeEventListener("visibilitychange",u.onVisibility),no.delete(e)))}}const HR=[];function PS(e=3e4,t=[]){var j,N,S;const n=Pl(T=>T.trackedIds),a=t.join(","),s=w.useMemo(()=>[...n,...t.filter(T=>!n.includes(T))],[n.join(","),a]),l=s.join(","),[,u]=w.useReducer(T=>T+1,0);w.useEffect(()=>FR(l,s,e,u),[l,e]);const d=no.get(l),f=((j=d==null?void 0:d.data)==null?void 0:j.accounts)??HR,h=d?d.loading:!0,g=(d==null?void 0:d.error)??null,{bestCoveringDiscountBps:m,covered:y}=w.useMemo(()=>{let T=null;for(const E of f){if(!E.snapshot||E.approvedCount<=0||!PR(E.snapshot))continue;const A=E.snapshot.discountBps;typeof A=="number"&&(T==null||A>T)&&(T=A)}return{bestCoveringDiscountBps:T,covered:T!=null}},[f]),b=((N=d==null?void 0:d.data)==null?void 0:N.wallets)??[],k=((S=d==null?void 0:d.data)==null?void 0:S.walletsError)??!1;return{accounts:f,wallets:b,walletsError:k,walletsInconclusive:k&&b.length===0,loading:h,error:g,refresh:()=>{const T=no.get(l);T&&pd(T)},bestCoveringDiscountBps:m,covered:y}}let Ch=null;function US(){const e=Pl(n=>n.scopeKey),t=Pl(n=>n.setScope);w.useEffect(()=>{e||Ch||(Ch=r_().then(n=>{t(OR(n))}).catch(()=>{}).finally(()=>{Ch=null}))},[e,t])}function qR(){US();const{accounts:e}=PS(3e4);return w.useMemo(()=>{const t=[],n=Math.floor(Date.now()/1e3);for(const a of e){const s=a.snapshot;if(!s)continue;const l=a.accountId,u=typeof s.expiresAtTimestamp=="number"&&s.expiresAtTimestamp>0,d=u&&n>=s.expiresAtTimestamp;d?t.push({id:`pca-${l}-expired`,accountId:l,kind:"expired",severity:"danger",title:`PCA #${l} has expired`,message:"Publishes no longer get its discount. Create a replacement account to keep saving."}):u&&s.expiresAtTimestamp-n<=IS&&t.push({id:`pca-${l}-expiring`,accountId:l,kind:"expiring",severity:"warn",title:`PCA #${l} is expiring soon`,message:"Top-up can’t extend the lock period — plan a replacement before it expires."}),s.fullySwept&&t.push({id:`pca-${l}-swept`,accountId:l,kind:"swept",severity:"warn",title:`PCA #${l} is fully swept`,message:"Its epoch budgets have been swept to the staker reward pool."}),typeof s.agentCount=="number"&&s.agentCount>=$S&&t.push({id:`pca-${l}-cap`,accountId:l,kind:"cap-near",severity:"warn",title:`PCA #${l} is near the 100-wallet cap`,message:"Deregister unused wallets to make room before approving more."}),a.classification==="owned"&&a.approvedCount===0&&!a.probesInconclusive&&!d&&t.push({id:`pca-${l}-fallthrough`,accountId:l,kind:"fallthrough",severity:"warn",title:`PCA #${l} discounts nothing yet`,message:"Publishes from this node pay the direct cost until you approve this node’s operational wallets."})}return t},[e])}function Ul(e,t=new Date){if(e==null||e==="")return"";const n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return"";if(n.toDateString()===t.toDateString())return n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});const s=new Date(t);if(s.setDate(t.getDate()-1),n.toDateString()===s.toDateString())return`Yesterday ${n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`;const l=t.getTime()-n.getTime();return l>=0&&l<10080*60*1e3?`${n.toLocaleDateString(void 0,{weekday:"short"})} ${n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`:n.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}/**
90
+ * @license lucide-react v1.14.0 - ISC
91
+ *
92
+ * This source code is licensed under the ISC license.
93
+ * See the LICENSE file in the root directory of this source tree.
94
+ */const BS=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim();/**
95
+ * @license lucide-react v1.14.0 - ISC
96
+ *
97
+ * This source code is licensed under the ISC license.
98
+ * See the LICENSE file in the root directory of this source tree.
99
+ */const GR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
100
+ * @license lucide-react v1.14.0 - ISC
101
+ *
102
+ * This source code is licensed under the ISC license.
103
+ * See the LICENSE file in the root directory of this source tree.
104
+ */const VR=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase());/**
105
+ * @license lucide-react v1.14.0 - ISC
106
+ *
107
+ * This source code is licensed under the ISC license.
108
+ * See the LICENSE file in the root directory of this source tree.
109
+ */const Kx=e=>{const t=VR(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
110
+ * @license lucide-react v1.14.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ */var Nh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
115
+ * @license lucide-react v1.14.0 - ISC
116
+ *
117
+ * This source code is licensed under the ISC license.
118
+ * See the LICENSE file in the root directory of this source tree.
119
+ */const WR=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},ZR=w.createContext({}),KR=()=>w.useContext(ZR),YR=w.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:a,className:s="",children:l,iconNode:u,...d},f)=>{const{size:h=24,strokeWidth:g=2,absoluteStrokeWidth:m=!1,color:y="currentColor",className:b=""}=KR()??{},k=a??m?Number(n??g)*24/Number(t??h):n??g;return w.createElement("svg",{ref:f,...Nh,width:t??h??Nh.width,height:t??h??Nh.height,stroke:e??y,strokeWidth:k,className:BS("lucide",b,s),...!l&&!WR(d)&&{"aria-hidden":"true"},...d},[...u.map(([j,N])=>w.createElement(j,N)),...Array.isArray(l)?l:[l]])});/**
120
+ * @license lucide-react v1.14.0 - ISC
121
+ *
122
+ * This source code is licensed under the ISC license.
123
+ * See the LICENSE file in the root directory of this source tree.
124
+ */const cn=(e,t)=>{const n=w.forwardRef(({className:a,...s},l)=>w.createElement(YR,{ref:l,iconNode:t,className:BS(`lucide-${GR(Kx(e))}`,`lucide-${e}`,a),...s}));return n.displayName=Kx(e),n};/**
125
+ * @license lucide-react v1.14.0 - ISC
126
+ *
127
+ * This source code is licensed under the ISC license.
128
+ * See the LICENSE file in the root directory of this source tree.
129
+ */const QR=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],XR=cn("arrow-down",QR);/**
130
+ * @license lucide-react v1.14.0 - ISC
131
+ *
132
+ * This source code is licensed under the ISC license.
133
+ * See the LICENSE file in the root directory of this source tree.
134
+ */const JR=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],eO=cn("arrow-up",JR);/**
135
+ * @license lucide-react v1.14.0 - ISC
136
+ *
137
+ * This source code is licensed under the ISC license.
138
+ * See the LICENSE file in the root directory of this source tree.
139
+ */const tO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],nO=cn("ban",tO);/**
140
+ * @license lucide-react v1.14.0 - ISC
141
+ *
142
+ * This source code is licensed under the ISC license.
143
+ * See the LICENSE file in the root directory of this source tree.
144
+ */const rO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],aO=cn("check",rO);/**
145
+ * @license lucide-react v1.14.0 - ISC
146
+ *
147
+ * This source code is licensed under the ISC license.
148
+ * See the LICENSE file in the root directory of this source tree.
149
+ */const iO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],sO=cn("chevron-down",iO);/**
150
+ * @license lucide-react v1.14.0 - ISC
151
+ *
152
+ * This source code is licensed under the ISC license.
153
+ * See the LICENSE file in the root directory of this source tree.
154
+ */const oO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cm=cn("chevron-right",oO);/**
155
+ * @license lucide-react v1.14.0 - ISC
156
+ *
157
+ * This source code is licensed under the ISC license.
158
+ * See the LICENSE file in the root directory of this source tree.
159
+ */const lO=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],cO=cn("copy",lO);/**
160
+ * @license lucide-react v1.14.0 - ISC
161
+ *
162
+ * This source code is licensed under the ISC license.
163
+ * See the LICENSE file in the root directory of this source tree.
164
+ */const uO=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],dO=cn("ellipsis",uO);/**
165
+ * @license lucide-react v1.14.0 - ISC
166
+ *
167
+ * This source code is licensed under the ISC license.
168
+ * See the LICENSE file in the root directory of this source tree.
169
+ */const pO=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],fO=cn("folder",pO);/**
170
+ * @license lucide-react v1.14.0 - ISC
171
+ *
172
+ * This source code is licensed under the ISC license.
173
+ * See the LICENSE file in the root directory of this source tree.
174
+ */const hO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],mO=cn("globe",hO);/**
175
+ * @license lucide-react v1.14.0 - ISC
176
+ *
177
+ * This source code is licensed under the ISC license.
178
+ * See the LICENSE file in the root directory of this source tree.
179
+ */const gO=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],vO=cn("loader-circle",gO);/**
180
+ * @license lucide-react v1.14.0 - ISC
181
+ *
182
+ * This source code is licensed under the ISC license.
183
+ * See the LICENSE file in the root directory of this source tree.
184
+ */const yO=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],bO=cn("lock",yO);/**
185
+ * @license lucide-react v1.14.0 - ISC
186
+ *
187
+ * This source code is licensed under the ISC license.
188
+ * See the LICENSE file in the root directory of this source tree.
189
+ */const xO=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],wO=cn("paperclip",xO);/**
190
+ * @license lucide-react v1.14.0 - ISC
191
+ *
192
+ * This source code is licensed under the ISC license.
193
+ * See the LICENSE file in the root directory of this source tree.
194
+ */const kO=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Yx=cn("share-2",kO);/**
195
+ * @license lucide-react v1.14.0 - ISC
196
+ *
197
+ * This source code is licensed under the ISC license.
198
+ * See the LICENSE file in the root directory of this source tree.
199
+ */const SO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],jO=cn("square",SO);/**
200
+ * @license lucide-react v1.14.0 - ISC
201
+ *
202
+ * This source code is licensed under the ISC license.
203
+ * See the LICENSE file in the root directory of this source tree.
204
+ */const CO=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],NO=cn("trending-up",CO);/**
205
+ * @license lucide-react v1.14.0 - ISC
206
+ *
207
+ * This source code is licensed under the ISC license.
208
+ * See the LICENSE file in the root directory of this source tree.
209
+ */const EO=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],TO=cn("upload",EO);/**
210
+ * @license lucide-react v1.14.0 - ISC
211
+ *
212
+ * This source code is licensed under the ISC license.
213
+ * See the LICENSE file in the root directory of this source tree.
214
+ */const AO=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],_O=cn("users-round",AO);/**
215
+ * @license lucide-react v1.14.0 - ISC
216
+ *
217
+ * This source code is licensed under the ISC license.
218
+ * See the LICENSE file in the root directory of this source tree.
219
+ */const RO=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],OO=cn("wallet",RO);/**
220
+ * @license lucide-react v1.14.0 - ISC
221
+ *
222
+ * This source code is licensed under the ISC license.
223
+ * See the LICENSE file in the root directory of this source tree.
224
+ */const LO=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],MO=cn("x",LO),Eh={1:"ETH",8453:"ETH",84532:"ETH",11155111:"ETH",31337:"ETH",100:"xDAI",10200:"xDAI",2043:"NEURO",20430:"NEURO"};function FS(e){var a;if(e==null)return"ETH";const t=String(e);if(Eh[t])return Eh[t];const n=(a=t.match(/(\d+)\s*$/))==null?void 0:a[1];return n&&Eh[n]||"ETH"}function QG(e,t=6,n=4){const a=(e??"").trim();return a.length<=t+n+1?a:`${a.slice(0,t)}…${a.slice(-n)}`}const Th="—";function DO(e,t=2){if(e==null)return Th;let n;if(typeof e=="number")n=e;else{const l=String(e).trim();if(!/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(l))return Th;n=Number(l)}if(!Number.isFinite(n))return Th;const a=Math.abs(n),s=a>0&&a<10?t:0;return new Intl.NumberFormat("en-US",{minimumFractionDigits:0,maximumFractionDigits:s}).format(n)}function zO(e,t=2){if(e==null||e==="")return"—";let n;try{n=BigInt(e)}catch{return"—"}const a=n<0n;a&&(n=-n);const s=10n**18n,l=n/s,u=(n%s+s).toString().slice(1).slice(0,t);return DO(`${a?"-":""}${l}.${u||"0"}`,t)}const $O=new Set(["84532","11155111","31337","10200","20430"]);function XG(e){if(e==null)return!1;const t=String(e),n=t.includes(":")?t.split(":").pop():t;return $O.has(n)}function JG(e,t=Math.floor(Date.now()/1e3)){if(!e||e<=0)return"Expiry unknown";const n=e-t,a=Math.round(Math.abs(n)/86400);return n<=0?a===0?"Expired today":`Expired ~${a} day${a===1?"":"s"} ago`:`Expires in ~${a} day${a===1?"":"s"}`}function HS(e){if(!e)return null;let t,n;try{t=BigInt(e.baseCost),n=BigInt(e.discountedCost)}catch{return null}return t<=0n||n<0n||n>=t?null:Number(((t-n)*10000n+t/2n)/t)}function qS({convictionCostCovered:e,className:t=""}){const n=HS(e);if(e==null||n==null)return null;const a=(n/100).toFixed(n%100===0?0:1),s=e.accountId?`via PCA #${e.accountId}`:"across multiple PCAs";return o.jsxs("span",{className:["badge","badge-success","v10-pca-discount-applied",t].filter(Boolean).join(" "),"data-testid":"pca-discount-badge",role:"status",children:[o.jsx("span",{"aria-hidden":"true",children:"◉ "}),"Discount applied — −",a,"% ",s]})}function IO(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;const t=e/100;return`${t.toFixed(t%1===0?0:1)}%`}const PO={eligible:{glyph:"◉",toneClass:"v10-pca-verdict-green"},fallthrough:{glyph:"⚠",toneClass:"v10-pca-verdict-amber"},"fallthrough-no-funds":{glyph:"⚠",toneClass:"v10-pca-verdict-danger"},unknown:{glyph:"◌",toneClass:"v10-pca-verdict-neutral"}};function UO({verdict:e,accountId:t,discountBps:n,accountUntracked:a=!1,reasons:s=[],ownerPublish:l=!1,variant:u="banner",children:d,className:f=""}){const h=PO[e],g=e==="fallthrough"||e==="fallthrough-no-funds",m=g?"alert":"status",y=g?"assertive":"polite",b=t?`PCA #${t}`:"a PCA",k=a?" (not tracked by this node)":"",j=IO(n),N=" unless this graph’s registration escrow already covers it",S=s.length>0?` Reason: ${s.join("; ")}.`:"";if(u==="chip"){const E=e==="eligible"?`Funded by ${b}${k}${j?` (${j} discount)`:""}`:e==="fallthrough"?"⚠ No PCA discount":e==="fallthrough-no-funds"?"⚠ Publish will fail":"PCA status unknown";return o.jsx("span",{className:["v10-pca-verdict-chip",h.toneClass,f].filter(Boolean).join(" "),"data-testid":"pca-eligibility-chip","data-verdict":e,children:o.jsx("span",{className:"v10-pca-verdict-chip-label",role:m,"aria-live":y,children:E})})}let T;return e==="eligible"?T=o.jsxs(o.Fragment,{children:["This publish will use ",b,k,j?` (${j} discount)`:"",".",l?`${N}.`:""]}):e==="fallthrough"?T=o.jsxs(o.Fragment,{children:["No PCA discount on this publish — it will attempt to pay the direct cost from the signing wallet’s TRAC",j?`, forfeiting ${b}’s ${j} discount`:"",l?N:"","; the publish fails if that TRAC is below the fee.",S]}):e==="fallthrough-no-funds"?T=o.jsxs(o.Fragment,{children:["This publish will FAIL — no signing wallet can cover it",j?`, forfeiting ${b}’s ${j} discount`:"",l?N:"",".",S]}):T=o.jsx(o.Fragment,{children:"Couldn’t confirm PCA eligibility — you may pay the direct cost."}),o.jsxs("div",{className:["v10-pca-verdict-banner",h.toneClass,f].filter(Boolean).join(" "),"data-testid":"pca-eligibility-verdict","data-verdict":e,role:m,"aria-live":y,children:[o.jsxs("p",{className:"v10-pca-verdict-message",children:[o.jsx("span",{className:"v10-pca-verdict-glyph","aria-hidden":"true",children:h.glyph}),T]}),d&&o.jsx("div",{className:"v10-pca-verdict-actions",children:d})]})}const fd=new Map,Nm=new Set;let Qx=!1;function BO(){const e=[...fd.values()];for(const t of Nm)t(e)}function FO(e){const t=e.detail;fd.has(t.info.uuid)||(fd.set(t.info.uuid,t),BO())}function HO(){Qx||typeof window>"u"||(Qx=!0,window.addEventListener("eip6963:announceProvider",FO),window.dispatchEvent(new Event("eip6963:requestProvider")))}function qO(e){return Nm.add(e),e([...fd.values()]),()=>{Nm.delete(e)}}function Em(e){var a;if(typeof e=="number")return e;const t=(a=String(e).match(/(\d+)\s*$/))==null?void 0:a[1],n=t?Number(t):NaN;if(!Number.isFinite(n))throw new Error(`Unrecognized chainId: ${e}`);return n}function GO(e){return`0x${Em(e).toString(16)}`}const zg="dkg-node-ui:wallet-provider-rdns";function VO(e){var t;try{(t=globalThis.localStorage)==null||t.setItem(zg,e)}catch{}}function WO(){var e;try{return((e=globalThis.localStorage)==null?void 0:e.getItem(zg))??null}catch{return null}}function Xx(){var e;try{(e=globalThis.localStorage)==null||e.removeItem(zg)}catch{}}const GS=new Set(["app.phantom"]),ZO=300;function KO(e){return e.filter(t=>!GS.has(t.info.rdns))}function YO(e,t){if(!t)return null;const n=e.filter(a=>a.info.rdns===t);return n.length===1?n[0]:null}function eV(e){return e.address!=null&&e.expectedChainId!=null&&e.chainId!==e.expectedChainId}function QO(e){return(e.walletRpcUrls??[]).filter(t=>/^https?:\/\//i.test(t))}let Su=!1,ju=null,Jx=!1;const tV=as((e,t)=>{function n(s){s.on&&(s.on("accountsChanged",(...l)=>{const u=l[0],d=(u==null?void 0:u[0])??null;if(d===null){t().disconnect();return}e({address:d})}),s.on("chainChanged",(...l)=>{e({chainId:parseInt(l[0],16)})}),s.on("disconnect",()=>t().disconnect()))}async function a(s){const l=s.provider;try{const u=await l.request({method:"eth_accounts"});if(u.length===0){Xx();return}const d=await l.request({method:"eth_chainId"});n(l),e({provider:l,providerInfo:s.info,address:u[0],chainId:parseInt(d,16)})}catch(u){console.warn("[wallet] silent reconnect failed",u)}}return{discovered:[],unsupported:[],provider:null,providerInfo:null,address:null,chainId:null,expectedChainId:null,bootstrap:null,setBootstrap(s){e({bootstrap:s,expectedChainId:Em(s.chainId)})},initWallet(){if(typeof window>"u"||(HO(),Jx))return;Jx=!0;const s=WO();qO(l=>{e({discovered:KO(l),unsupported:l.filter(u=>GS.has(u.info.rdns))}),!(!s||Su)&&(ju&&clearTimeout(ju),ju=setTimeout(()=>{if(ju=null,Su)return;const u=YO(t().discovered,s);u&&(Su=!0,a(u))},ZO))})},async connect(s){const l=s.provider,u=await l.request({method:"eth_requestAccounts"}),d=await l.request({method:"eth_chainId"});n(l),e({provider:l,providerInfo:s.info,address:u[0]??null,chainId:parseInt(d,16)}),VO(s.info.rdns),Su=!1},disconnect(){e({provider:null,providerInfo:null,address:null,chainId:null}),Xx()},async switchToExpectedChain(){const{provider:s,bootstrap:l}=t();if(!s)throw new Error("Wallet not connected.");if(!l)throw new Error("Chain not bootstrapped.");const u=GO(l.chainId);try{await s.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]})}catch(d){if((d==null?void 0:d.code)===4902){const f=FS(l.chainId),h=QO(l);if(h.length===0)throw new Error("Wallet does not know this chain and the node did not provide wallet-public RPC URLs. Add the network in your wallet, then try again.");await s.request({method:"wallet_addEthereumChain",params:[{chainId:u,chainName:`chain-${Em(l.chainId)}`,nativeCurrency:{name:f,symbol:f,decimals:18},rpcUrls:h}]})}else throw d}}}});function $g(e,t){return e&&e.trim()?e:t.length>20?`${t.slice(0,16)}…`:t}function e1(e){return e.length>12?`${e.slice(0,6)}…${e.slice(-4)}`:e}function XO({item:e,onApprove:t,onDeny:n,onOpen:a}){var g;const[s,l]=w.useState({kind:"idle"}),u=$g(e.contextGraphName,e.cgId),d=((g=e.agentName)==null?void 0:g.trim())||e1(e.agentAddress),f=async m=>{l({kind:"working",action:m});const b=await(m==="approve"?t:n)(e.cgId,e.agentAddress);if(b.ok){const k=b.alreadyHandled?"Already handled":m==="approve"?`Approved — ${d} can now access ${u}`:`Request from ${d} declined`;l({kind:"done",label:k})}else{const k=b.roleError?`You're no longer the curator of ${u}`:m==="approve"?"Couldn’t approve":"Couldn’t deny";l({kind:"error",action:m,message:k})}};if(s.kind==="done")return o.jsxs("div",{className:"v10-notif-row v10-notif-row-terminal",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"v10-notif-glyph","aria-hidden":"true",children:"✓"}),o.jsx("span",{className:"v10-notif-terminal-text",children:s.label})]});const h=s.kind==="working";return o.jsxs("div",{className:"v10-notif-row v10-notif-row-join",children:[o.jsx("span",{className:"v10-notif-glyph v10-notif-glyph-join","aria-hidden":"true",children:"🔑"}),o.jsxs("div",{className:"v10-notif-row-body",children:[o.jsx("div",{className:"v10-notif-row-title",children:"Join request"}),o.jsxs("div",{className:"v10-notif-row-detail",children:[o.jsx("span",{className:"v10-notif-actor",children:d})," wants to join"," ",o.jsx("button",{type:"button",className:"v10-notif-cg-link",onClick:()=>a(e.cgId),title:`Open ${u}`,children:u})]}),o.jsxs("div",{className:"v10-notif-row-sub",children:[o.jsx("span",{className:"v10-notif-addr",title:e.agentAddress,children:e1(e.agentAddress)}),o.jsx("span",{className:"v10-notif-dot",children:"·"}),o.jsx("span",{className:"v10-notif-time",title:new Date(e.ts).toLocaleString(),children:Ul(e.ts)})]}),s.kind==="error"&&o.jsxs("div",{className:"v10-notif-row-error",role:"status","aria-live":"polite",children:[s.message," ",o.jsx("button",{type:"button",className:"v10-notif-retry",onClick:()=>f(s.action),children:"Retry"})]}),o.jsx("span",{className:"v10-sr-only",role:"status","aria-live":"polite",children:h?s.action==="approve"?"Approving…":"Denying…":""})]}),o.jsx("div",{className:"v10-notif-row-actions",children:s.kind==="confirming-deny"?o.jsxs("span",{className:"v10-notif-deny-confirm",role:"group","aria-label":"Confirm deny",onKeyDown:m=>{m.key==="Escape"&&(m.stopPropagation(),l({kind:"idle"}))},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||l({kind:"idle"})},children:[o.jsx("span",{className:"v10-notif-deny-confirm-label",children:"Deny?"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-deny",onClick:()=>f("deny"),"aria-label":`Confirm deny join request from ${d} for ${u}`,children:"Yes"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-ghost",onClick:()=>l({kind:"idle"}),autoFocus:!0,children:"Cancel"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-approve",onClick:()=>f("approve"),disabled:h,"aria-label":`Approve join request from ${d} for ${u}`,children:h&&s.action==="approve"?"…":"Approve"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-ghost",onClick:()=>l({kind:"confirming-deny"}),disabled:h,"aria-label":`Deny join request from ${d} for ${u}`,children:h&&s.action==="deny"?"…":"Deny"})]})})]})}const JO={created:"+",promoted:"⇡",published:"◉"};function eL(e,t,n){const a=t,s=a===1?"assertion":"assertions";return e==="created"?n?`${n} added ${a} ${s}`:`${a} new ${s} added`:e==="promoted"?n?`${n} promoted ${a} ${s}`:`${a} ${s} promoted`:n?`${n} published ${a} ${s} to Verifiable Memory`:`${a} ${s} published to Verifiable Memory`}function tL({item:e,onOpen:t}){var d;const n=$g(e.contextGraphName,e.cgId),a=e.bySelf?"You":((d=e.actorAgentName)==null?void 0:d.trim())||void 0,s=eL(e.event,e.count,a),l=Ul(e.ts),u=`${s} in ${n}${l?`, ${l}`:""}. Open ${n} recent activity.`;return o.jsxs("button",{type:"button",className:`v10-notif-row v10-notif-row-activity v10-notif-activity-${e.event}${e.bySelf?" v10-notif-by-self":""}${e.read?"":" v10-notif-unread"}`,onClick:()=>t(e.cgId),title:`Open ${n} · recent activity`,"aria-label":u,children:[o.jsx("span",{className:`v10-notif-glyph v10-notif-glyph-${e.event}`,"aria-hidden":"true",children:JO[e.event]}),o.jsx("span",{className:"v10-notif-row-body","aria-hidden":"true",children:o.jsxs("span",{className:"v10-notif-row-detail",children:[s," in ",o.jsx("span",{className:"v10-notif-cg-name",children:n})]})}),o.jsx("span",{className:"v10-notif-time","aria-hidden":"true",title:new Date(e.ts).toLocaleString(),children:l})]})}function nL({item:e,onOpen:t}){const n=$g(e.contextGraphName,e.cgId),a=e.kind==="join_approved",s=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`v10-notif-glyph ${a?"v10-notif-glyph-approved":"v10-notif-glyph-rejected"}`,"aria-hidden":"true",children:a?"✓":"✕"}),o.jsxs("span",{className:"v10-notif-row-body",children:[o.jsx("span",{className:"v10-notif-row-title",children:a?"Request approved":"Request declined"}),o.jsx("span",{className:"v10-notif-row-detail",children:a?o.jsxs(o.Fragment,{children:["You can now access ",o.jsx("span",{className:"v10-notif-cg-name",children:n})]}):o.jsxs(o.Fragment,{children:["Your request to join ",o.jsx("span",{className:"v10-notif-cg-name",children:n})," wasn’t approved"]})})]}),o.jsx("span",{className:"v10-notif-time",title:new Date(e.ts).toLocaleString(),children:Ul(e.ts)})]});if(a){const l=Ul(e.ts);return o.jsx("button",{type:"button",className:`v10-notif-row v10-notif-row-confirm v10-notif-confirm-approved${e.read?"":" v10-notif-unread"}`,onClick:()=>t(e.cgId),title:`Open ${n}`,"aria-label":`Request approved: you can now access ${n}${l?`, ${l}`:""}. Open ${n}.`,children:s})}return o.jsx("div",{className:`v10-notif-row v10-notif-row-confirm v10-notif-confirm-rejected${e.read?"":" v10-notif-unread"}`,"aria-disabled":"true",children:s})}function rL({item:e}){var h;const t=HS(e.covered),n=t!=null?(t/100).toFixed(t%100===0?0:1):null;let a=null;try{const g=BigInt(e.covered.baseCost),m=BigInt(e.covered.discountedCost);g>0n&&m>=0n&&m<g&&(a=zO((g-m).toString()))}catch{a=null}const s=`PCA #${e.covered.accountId}`,l=(h=e.contextGraphName)!=null&&h.trim()?` in ${e.contextGraphName.trim()}`:"",u=n!=null?"Publishing discount applied":"Publishing fee covered",d=n!=null?`−${n}% via ${s}${a?` · saved ${a} TRAC`:""}${l}`:`via ${s}${l}`,f=Ul(e.ts);return o.jsxs("div",{className:`v10-notif-row v10-notif-row-confirm v10-notif-pca-discount${e.read?"":" v10-notif-unread"}`,role:"status","aria-label":`${u}, ${d}${f?`, ${f}`:""}.`,children:[o.jsx("span",{className:"v10-notif-glyph v10-notif-glyph-approved","aria-hidden":"true",children:"◉"}),o.jsxs("span",{className:"v10-notif-row-body","aria-hidden":"true",children:[o.jsx("span",{className:"v10-notif-row-title",children:u}),o.jsx("span",{className:"v10-notif-row-detail",children:d})]}),o.jsx("span",{className:"v10-notif-time","aria-hidden":"true",title:new Date(e.ts).toLocaleString(),children:f})]})}function aL({feed:e,onOpenContextGraph:t,pcaAlerts:n=[],onOpenPca:a,id:s,paneRef:l}){const{joinRequests:u,activity:d,status:f,refreshError:h,partialActivityError:g,hasInformationalUnread:m,approve:y,deny:b,markSeen:k,markAllInformationalSeen:j}=e,N=(B,_)=>{k([_]),t(B)},S=u.length>0,T=d.length>0,E=n.length>0,A=!S&&!T&&!E;return o.jsxs("div",{className:"v10-notif-pane",role:"region","aria-label":"Notifications",id:s,ref:l,tabIndex:-1,children:[o.jsxs("div",{className:"v10-notif-pane-titlebar",children:[o.jsx("div",{className:"v10-notif-pane-title",children:"Notifications"}),m&&o.jsx("button",{type:"button",className:"v10-notif-pane-markread",onClick:j,title:"Mark informational notifications as read",children:"Mark all read"})]}),o.jsxs("div",{className:"v10-notif-pane-body",children:[E&&o.jsxs("section",{className:"v10-notif-section v10-notif-section-pca","aria-label":"Publisher Conviction",children:[o.jsxs("div",{className:"v10-notif-section-head",children:[o.jsx("span",{className:"v10-notif-section-label",children:"Publisher Conviction"}),o.jsx("span",{className:"v10-notif-section-count",children:n.length})]}),o.jsx("div",{className:"v10-notif-section-rows",children:n.map(B=>o.jsxs("div",{className:"v10-pca-alert-row","data-severity":B.severity,"data-testid":"pca-bell-alert",role:B.severity==="danger"?"alert":"status",children:[o.jsx("div",{className:"v10-pca-alert-title",children:B.title}),o.jsx("div",{className:"v10-pca-alert-msg",children:B.message}),a&&o.jsxs("button",{type:"button",className:"v10-pca-alert-action",onClick:()=>a(B.accountId),children:["Manage PCA #",B.accountId]})]},B.id))})]}),f==="identity-pending"?o.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Verifying access…"}):f==="loading"&&A?o.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Loading notifications…"}):f==="error"&&A?o.jsxs("div",{className:"v10-notif-pane-error",role:"status","aria-live":"polite",children:["Couldn’t load notifications."," ",o.jsx("button",{type:"button",className:"v10-notif-retry",onClick:e.retry,children:"Retry"})]}):A?o.jsxs("div",{className:"v10-notif-pane-empty",role:"status",children:[o.jsx("div",{className:"v10-notif-pane-empty-lead",children:"You’re all caught up."}),o.jsx("div",{className:"v10-notif-pane-empty-sub",children:"Join requests, approvals, and new activity in your context graphs will show up here."})]}):o.jsxs(o.Fragment,{children:[h&&o.jsxs("div",{className:"v10-notif-pane-error v10-notif-pane-error-inline",role:"status","aria-live":"polite",children:["Couldn’t refresh notifications."," ",o.jsx("button",{type:"button",className:"v10-notif-retry",onClick:e.retry,children:"Retry"})]}),S&&o.jsxs("section",{className:"v10-notif-section v10-notif-section-action","aria-label":"Needs your action",children:[o.jsxs("div",{className:"v10-notif-section-head",children:[o.jsx("span",{className:"v10-notif-section-label",children:"Needs your action"}),o.jsx("span",{className:"v10-notif-section-count",children:u.length})]}),o.jsx("div",{className:"v10-notif-section-rows",children:u.map(B=>o.jsx(XO,{item:B,onApprove:y,onDeny:b,onOpen:t},B.id))})]}),o.jsxs("section",{className:"v10-notif-section v10-notif-section-activity","aria-label":"Activity",children:[o.jsx("div",{className:"v10-notif-section-head",children:o.jsx("span",{className:"v10-notif-section-label",children:"Activity"})}),g&&o.jsx("div",{className:"v10-notif-pane-error v10-notif-pane-error-inline",role:"status","aria-live":"polite",children:"Recent activity couldn’t load."}),T?o.jsx("div",{className:"v10-notif-section-rows",children:d.map(B=>B.kind==="digest"?o.jsx(tL,{item:B,onOpen:_=>N(_,B.id)},B.id):B.kind==="pca_cost_covered"?o.jsx(rL,{item:B},B.id):o.jsx(nL,{item:B,onOpen:_=>N(_,B.id)},B.id))}):!g&&o.jsx("div",{className:"v10-notif-section-empty",children:"No recent activity."})]})]})]})]})}const iL=o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),o.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),t1="v10-notifications-pane";function sL(){const e=AR(),t=qR(),[n,a]=w.useState(!1),s=w.useRef(null),l=w.useRef(null),u=Ar(b=>b.setActiveProject),{openTab:d}=fn(),f=w.useRef(null),h=w.useCallback((b=!1)=>{var k;a(!1),b&&((k=l.current)==null||k.focus())},[]);w.useEffect(()=>{if(!n)return;const b=k=>{s.current&&!s.current.contains(k.target)&&h()};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n,h]),w.useEffect(()=>{if(!n)return;const b=f.current;if(!b)return;const k=b.querySelector(".v10-notif-section-action .v10-notif-btn-approve"),j=b.querySelector(".v10-notif-section-rows button, .v10-notif-section-rows a[href]"),N=b.querySelector('button:not(.v10-notif-pane-markread), [href], [tabindex]:not([tabindex="-1"])');(k??j??N??b).focus()},[n]);const g=w.useCallback(b=>{u(b),d({id:`project:${b}`,label:b.slice(0,16),closable:!0}),h()},[u,d,h]),m=w.useCallback(b=>{d({id:`conviction:${b}`,label:`PCA #${b}`,closable:!0}),h()},[d,h]),y=e.unread+t.length;return o.jsxs("div",{className:"v10-header-notif-wrap",ref:s,onKeyDown:n?b=>{b.key==="Escape"&&(b.stopPropagation(),h(!0))}:void 0,children:[o.jsxs("button",{ref:l,className:"v10-header-icon-btn",onClick:()=>a(b=>!b),title:y>0?`Notifications (${y} unread)`:"Notifications","aria-label":y>0?`Notifications, ${y} unread`:"Notifications","aria-haspopup":"dialog","aria-expanded":n,"aria-controls":n?t1:void 0,children:[iL,y>0&&o.jsx("span",{className:"v10-header-notif-badge",children:y})]}),n&&o.jsx(aL,{id:t1,paneRef:f,feed:e,onOpenContextGraph:g,pcaAlerts:t,onOpenPca:m})]})}function oL(e,t,n,a,s){const l=[e?"Synced with the network":"Syncing with the network",`${t} peer${t===1?"":"s"} (${n} direct, ${a} relayed)`];return s>0&&l.push(`Uptime ${lL(s)}`),l.join(`
225
+ `)}function lL(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),a=Math.floor(t%86400/3600),s=Math.floor(t%3600/60),l=[];return n>0&&l.push(`${n}d`),(a>0||n>0)&&l.push(`${a}h`),l.push(`${s}m`),l.join(" ")}const cL=o.jsx("span",{className:"v10-header-ot-wordmark",children:o.jsxs("svg",{width:"60",height:"13",viewBox:"0 0 180 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:[o.jsx("path",{d:"M55.0428 28.0111C59.7903 28.0111 62.6388 24.531 62.6388 20.3908C62.6388 16.2806 59.7903 12.8005 55.0428 12.8005C50.325 12.8005 47.4766 16.2806 47.4766 20.3908C47.4766 24.531 50.325 28.0111 55.0428 28.0111ZM55.0428 24.621C52.6988 24.621 51.3932 22.6709 51.3932 20.3908C51.3932 18.1407 52.6988 16.1906 55.0428 16.1906C57.3869 16.1906 58.7221 18.1407 58.7221 20.3908C58.7221 22.6709 57.3869 24.621 55.0428 24.621Z",fill:"currentColor"}),o.jsx("path",{d:"M65.4344 27.6511H69.2027V18.0807C69.8258 17.1507 71.4874 16.4606 72.7336 16.4606C73.149 16.4606 73.5051 16.4906 73.7721 16.5507V12.8305C71.9918 12.8305 70.2115 13.8505 69.2027 15.1406V13.1605H65.4344V27.6511Z",fill:"currentColor"}),o.jsx("path",{d:"M77.9959 11.0304C79.2421 11.0304 80.251 10.0104 80.251 8.75031C80.251 7.49026 79.2421 6.47021 77.9959 6.47021C76.7794 6.47021 75.7409 7.49026 75.7409 8.75031C75.7409 10.0104 76.7794 11.0304 77.9959 11.0304ZM76.1266 27.6511H79.8949V13.1605H76.1266V27.6511Z",fill:"currentColor"}),o.jsx("path",{d:"M83.3347 31.3713C85.115 32.9614 87.0437 33.5314 89.5064 33.5314C93.0373 33.5314 97.2507 32.1813 97.2507 26.6611V13.1605H93.4527V15.0206C92.2955 13.5505 90.7526 12.8005 89.0317 12.8005C85.4117 12.8005 82.7116 15.4406 82.7116 20.1808C82.7116 25.011 85.4414 27.5611 89.0317 27.5611C90.7823 27.5611 92.3252 26.7211 93.4527 25.281V26.7511C93.4527 29.6012 91.3164 30.4113 89.5064 30.4113C87.6964 30.4113 86.1832 29.9012 85.026 28.6112L83.3347 31.3713ZM93.4527 22.5209C92.8296 23.4509 91.4647 24.171 90.2185 24.171C88.0822 24.171 86.5986 22.6709 86.5986 20.1808C86.5986 17.6907 88.0822 16.1906 90.2185 16.1906C91.4647 16.1906 92.8296 16.8807 93.4527 17.8407V22.5209Z",fill:"currentColor"}),o.jsx("path",{d:"M102.857 11.0304C104.104 11.0304 105.113 10.0104 105.113 8.75031C105.113 7.49026 104.104 6.47021 102.857 6.47021C101.641 6.47021 100.602 7.49026 100.602 8.75031C100.602 10.0104 101.641 11.0304 102.857 11.0304ZM100.988 27.6511H104.756V13.1605H100.988V27.6511Z",fill:"currentColor"}),o.jsx("path",{d:"M118.166 27.6511H121.934V17.4207C121.934 14.6006 120.421 12.8005 117.276 12.8005C114.932 12.8005 113.181 13.9405 112.261 15.0506V13.1605H108.493V27.6511H112.261V17.9007C112.884 17.0307 114.042 16.1906 115.525 16.1906C117.127 16.1906 118.166 16.8807 118.166 18.8908V27.6511Z",fill:"currentColor"}),o.jsx("path",{d:"M130.483 28.0111C132.055 28.0111 133.064 27.5911 133.628 27.0811L132.827 24.201C132.619 24.411 132.085 24.621 131.521 24.621C130.69 24.621 130.216 23.931 130.216 23.0309V16.4906H133.123V13.1605H130.216V9.20033H126.418V13.1605H124.044V16.4906H126.418V24.051C126.418 26.6311 127.842 28.0111 130.483 28.0111Z",fill:"currentColor"}),o.jsx("path",{d:"M135.702 27.6511H139.47V18.0807C140.093 17.1507 141.755 16.4606 143.001 16.4606C143.416 16.4606 143.772 16.4906 144.039 16.5507V12.8305C142.259 12.8305 140.479 13.8505 139.47 15.1406V13.1605H135.702V27.6511Z",fill:"currentColor"}),o.jsx("path",{d:"M156.245 27.6511H160.043V13.1605H156.245V15.0206C155.117 13.5505 153.515 12.8005 151.824 12.8005C148.174 12.8005 145.474 15.6806 145.474 20.4208C145.474 25.251 148.204 28.0111 151.824 28.0111C153.545 28.0111 155.117 27.2311 156.245 25.8211V27.6511ZM156.245 22.9709C155.592 23.931 154.257 24.621 152.981 24.621C150.845 24.621 149.361 22.9109 149.361 20.4208C149.361 17.9007 150.845 16.2206 152.981 16.2206C154.257 16.2206 155.592 16.9107 156.245 17.8707V22.9709Z",fill:"currentColor"}),o.jsx("path",{d:"M165.649 11.0304C166.895 11.0304 167.904 10.0104 167.904 8.75031C167.904 7.49026 166.895 6.47021 165.649 6.47021C164.432 6.47021 163.394 7.49026 163.394 8.75031C163.394 10.0104 164.432 11.0304 165.649 11.0304ZM163.78 27.6511H167.548V13.1605H163.78V27.6511Z",fill:"currentColor"}),o.jsx("path",{d:"M175.32 28.0111C176.863 28.0111 177.871 27.5911 178.435 27.0811L177.634 24.201C177.456 24.411 176.922 24.621 176.358 24.621C175.527 24.621 175.053 23.931 175.053 23.0309V7.64026H171.284V24.051C171.284 26.6311 172.679 28.0111 175.32 28.0111Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.781 9.94781C14.2903 9.94781 9.8385 14.4484 9.8385 20.0008C9.8385 25.5525 14.2903 30.0531 19.781 30.0531C22.833 30.0531 25.5632 28.6622 27.3869 26.4736L34.9141 32.8796C31.2855 37.2341 25.8532 40.0016 19.781 40.0016C8.85592 40.0016 0 31.0467 0 20.0008C0 8.95432 8.85592 0 19.781 0V9.94781ZM36.8737 30.0724L28.3719 25.0628C28.662 24.5606 28.9105 24.0308 29.112 23.4781L38.3464 26.9194C37.9453 28.0192 37.4508 29.0732 36.8737 30.0724ZM29.7216 20.0007H39.5609C39.5609 18.8159 39.4583 17.6554 39.2628 16.5272L29.5719 18.2549C29.6701 18.822 29.7216 19.4053 29.7216 20.0007ZM34.988 7.20831L27.425 13.5712C27.0546 13.1215 26.646 12.7054 26.2045 12.3272L32.5596 4.73338C33.4381 5.4858 34.251 6.31374 34.988 7.20831Z",fill:"currentColor"})]})}),uL=o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("circle",{cx:"12",cy:"12",r:"5"}),o.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),o.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),o.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),o.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),o.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),o.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),o.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),o.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}),dL=o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),pL=o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),fL=o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"15",y1:"3",x2:"15",y2:"21"})]}),hL=o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"12",cy:"12",r:"3"}),o.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),mL=o.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),gL=o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.78 4.78 4 4 0 0 1-6.74 0 4 4 0 0 1-4.78-4.78 4 4 0 0 1 0-6.75z"}),o.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),o.jsx("circle",{cx:"9.5",cy:"9.5",r:".5"}),o.jsx("circle",{cx:"14.5",cy:"14.5",r:".5"})]});function vL(){var N,S;const{theme:e,setTheme:t,leftCollapsed:n,toggleLeft:a,rightCollapsed:s,toggleRight:l}=Vn(),u=wg(T=>T.nodeStatus),d=zd().data,{openTab:f}=fn(),h=(u==null?void 0:u.connectedPeers)??(u==null?void 0:u.peerCount)??0,g=((N=u==null?void 0:u.connections)==null?void 0:N.direct)??0,m=((S=u==null?void 0:u.connections)==null?void 0:S.relayed)??0,y=(u==null?void 0:u.uptimeMs)??0,k=u!=null&&(u==null?void 0:u.synced)!==!1,j=oL(k,h,g,m,y);return o.jsxs("header",{className:"v10-header",children:[o.jsxs("div",{className:"v10-header-logo",children:[o.jsxs("span",{className:"v10-header-logo-text",children:["DKG ",o.jsx("span",{className:"v10-header-logo-version",children:"v10"})]}),o.jsxs("div",{className:"v10-header-logo-ot","aria-label":"Powered by OriginTrail",children:[o.jsx("span",{className:"v10-header-logo-ot-by",children:"powered by"}),cL]})]}),o.jsx("button",{className:`v10-header-icon-btn ${n?"":"active-toggle"}`,onClick:a,title:"Toggle sidebar",children:pL}),o.jsx("div",{className:"v10-header-sep"}),o.jsxs("div",{className:"v10-header-agent-switcher",title:d?`${d.agentDid}
226
+ ${d.agentAddress}`:void 0,children:[o.jsx("span",{className:"v10-header-agent-dot"}),o.jsx("span",{className:"v10-header-agent-name",children:(d!=null&&d.name&&d.name!=="**"?d.name:null)||(u==null?void 0:u.name)||"Agent"}),(d==null?void 0:d.agentAddress)&&o.jsxs("span",{className:"v10-header-agent-addr",children:[d.agentAddress.slice(0,6),"…",d.agentAddress.slice(-4)]})]}),o.jsx("div",{className:"v10-header-spacer"}),o.jsxs("div",{className:"v10-header-meta",title:j,children:[o.jsx("span",{className:`v10-header-status-dot ${k?"online":"offline"}`}),o.jsx("span",{children:k?"synced":"syncing"}),o.jsx("span",{className:"v10-header-meta-sep",children:"·"}),o.jsxs("span",{children:[h," peer",h!==1?"s":""]})]}),o.jsxs("div",{className:"v10-header-actions",children:[o.jsx(sL,{}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"operations",label:"Observability",closable:!0}),title:"Observability",children:mL}),o.jsx("button",{className:"v10-header-icon-btn","data-testid":"pca-launch-btn",onClick:()=>f({id:"conviction",label:"Publisher Conviction",closable:!0}),title:"Publisher Conviction - publishing discounts",children:gL}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"settings",label:"Settings",closable:!0}),title:"Settings",children:hL}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>t(e==="dark"?"light":"dark"),title:e==="dark"?"Switch to light mode":"Switch to dark mode",children:e==="dark"?uL:dL}),o.jsx("button",{className:`v10-header-icon-btn ${s?"":"active-toggle"}`,onClick:l,title:"Toggle agent panel",children:fL})]})]})}function yL(){const e=localStorage.getItem("dkg-journey-stage");return e==="1"?1:e==="2"?2:0}const Ig=as((e,t)=>({stage:yL(),setStage:n=>{localStorage.setItem("dkg-journey-stage",String(n)),e({stage:n})},advance:()=>{const n=Math.min(t().stage+1,2);localStorage.setItem("dkg-journey-stage",String(n)),e({stage:n})}})),bL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .\r
227
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\r
228
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\r
229
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\r
230
+ @prefix dcterms: <http://purl.org/dc/terms/> .\r
231
+ @prefix schema: <http://schema.org/> .\r
232
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .\r
233
+ @prefix prov: <http://www.w3.org/ns/prov#> .\r
234
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .\r
235
+ @prefix bibo: <http://purl.org/ontology/bibo/> .\r
236
+ @prefix fabio: <http://purl.org/spar/fabio/> .\r
237
+ @prefix cito: <http://purl.org/spar/cito/> .\r
238
+ @prefix frbr: <http://purl.org/vocab/frbr/core#> .\r
239
+ \r
240
+ @prefix chat: <http://dkg.io/ontology/chat/> .\r
241
+ @prefix dkg: <http://dkg.io/ontology/> .\r
242
+ @prefix : <http://dkg.io/ontology/book-research/> .\r
243
+ \r
244
+ <http://dkg.io/ontology/book-research/>\r
245
+ a owl:Ontology ;\r
246
+ dcterms:title "DKG Book Research Project Ontology (v1)" ;\r
247
+ dcterms:description """Starter ontology for projects that research and\r
248
+ write books, papers, or long-form non-fiction. Built on schema.org +\r
249
+ BIBO + the SPAR family (FaBiO, CiTO) + FRBR + SKOS so it composes with\r
250
+ existing scholarly publishing infrastructure.""" ;\r
251
+ owl:versionInfo "1.0.0" ;\r
252
+ dcterms:created "2026-04-18"^^xsd:date ;\r
253
+ owl:imports\r
254
+ <http://schema.org/> , <http://purl.org/dc/terms/> ,\r
255
+ <http://www.w3.org/ns/prov#> , <http://xmlns.com/foaf/0.1/> ,\r
256
+ <http://www.w3.org/2004/02/skos/core#> ,\r
257
+ <http://purl.org/ontology/bibo/> ,\r
258
+ <http://purl.org/spar/fabio/> ,\r
259
+ <http://purl.org/spar/cito/> ,\r
260
+ <http://purl.org/vocab/frbr/core#> .\r
261
+ \r
262
+ # ─── Universal annotation predicates (shared across all starters) ───\r
263
+ chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
264
+ chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .\r
265
+ chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .\r
266
+ chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .\r
267
+ chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .\r
268
+ chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .\r
269
+ \r
270
+ # ─── Universal annotation entities ──────────────────────────────────\r
271
+ :Concept rdfs:subClassOf skos:Concept .\r
272
+ :Topic rdfs:subClassOf skos:Concept .\r
273
+ :Question rdfs:subClassOf schema:Question .\r
274
+ :Finding rdfs:subClassOf prov:Entity .\r
275
+ \r
276
+ # ─── Book-research specific ─────────────────────────────────────────\r
277
+ \r
278
+ :Hypothesis a owl:Class ;\r
279
+ rdfs:label "Hypothesis" ;\r
280
+ rdfs:comment "A claim under investigation. Supersedes when refuted; promotes to a Finding when supported." ;\r
281
+ rdfs:subClassOf prov:Entity .\r
282
+ \r
283
+ :Argument a owl:Class ;\r
284
+ rdfs:label "Argument" ;\r
285
+ rdfs:comment "A reasoned position taken on a Hypothesis or other entity." ;\r
286
+ rdfs:subClassOf prov:Entity .\r
287
+ \r
288
+ :Counterexample a owl:Class ;\r
289
+ rdfs:label "Counterexample" ;\r
290
+ rdfs:comment "Evidence that refutes a Hypothesis or Argument." ;\r
291
+ rdfs:subClassOf prov:Entity .\r
292
+ \r
293
+ :Quote a owl:Class ;\r
294
+ rdfs:label "Quote" ;\r
295
+ rdfs:comment "Verbatim passage extracted from a source. Subclass of bibo:Quote so it composes with bibliographic tools." ;\r
296
+ rdfs:subClassOf bibo:Quote .\r
297
+ \r
298
+ :supports a owl:ObjectProperty ;\r
299
+ rdfs:label "supports" ;\r
300
+ rdfs:comment "An Argument or Quote supports a Hypothesis." ;\r
301
+ rdfs:subPropertyOf cito:agreesWith .\r
302
+ \r
303
+ :refutes a owl:ObjectProperty ;\r
304
+ rdfs:label "refutes" ;\r
305
+ rdfs:comment "An Argument, Counterexample, or Quote refutes a Hypothesis." ;\r
306
+ rdfs:subPropertyOf cito:disagreesWith .\r
307
+ \r
308
+ :cites a owl:ObjectProperty ;\r
309
+ rdfs:label "cites" ;\r
310
+ rdfs:subPropertyOf cito:cites ;\r
311
+ rdfs:range bibo:Document .\r
312
+ \r
313
+ # ─── URI patterns ───────────────────────────────────────────────────\r
314
+ :UriPattern rdfs:label "URI minting pattern" .\r
315
+ \r
316
+ :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .\r
317
+ :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .\r
318
+ :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .\r
319
+ :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .\r
320
+ :hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .\r
321
+ :argument-pattern a :UriPattern ; skos:notation "urn:dkg:argument:<slug>" .\r
322
+ :quote-pattern a :UriPattern ; skos:notation "urn:dkg:quote:<slug>" .\r
323
+ :citation-pattern a :UriPattern ; skos:notation "urn:dkg:citation:<slug>" ;\r
324
+ skos:definition "Bibliographic citation; aligned with bibo:Document via cito:cites." .\r
325
+ \r
326
+ :slug-normalisation a skos:Note ;\r
327
+ skos:definition "Lowercase → ASCII-fold → strip stopwords (the/a/an/of/for/and/or/to/in/on/with) → hyphenate → ≤60 chars. Apply BEFORE comparing free-text recall results (\`dkg_memory_search\`) to decide reuse-vs-mint." .\r
328
+ `,xL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .\r
329
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\r
330
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\r
331
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\r
332
+ @prefix dcterms: <http://purl.org/dc/terms/> .\r
333
+ @prefix schema: <http://schema.org/> .\r
334
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .\r
335
+ @prefix prov: <http://www.w3.org/ns/prov#> .\r
336
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .\r
337
+ @prefix doap: <http://usefulinc.com/ns/doap#> .\r
338
+ \r
339
+ # DKG project namespaces — v1 ontology for any "coding project"\r
340
+ # context graph. Imports widely-adopted Linked Data vocabs first;\r
341
+ # only declares extensions for genuinely net-new concepts.\r
342
+ @prefix chat: <http://dkg.io/ontology/chat/> .\r
343
+ @prefix code: <http://dkg.io/ontology/code/> .\r
344
+ @prefix github: <http://dkg.io/ontology/github/> .\r
345
+ @prefix decisions: <http://dkg.io/ontology/decisions/> .\r
346
+ @prefix tasks: <http://dkg.io/ontology/tasks/> .\r
347
+ @prefix agent: <http://dkg.io/ontology/agent/> .\r
348
+ @prefix dkg: <http://dkg.io/ontology/> .\r
349
+ \r
350
+ @prefix : <http://dkg.io/ontology/coding-project/> .\r
351
+ \r
352
+ # ─── Ontology header ────────────────────────────────────────────────\r
353
+ <http://dkg.io/ontology/coding-project/>\r
354
+ a owl:Ontology ;\r
355
+ dcterms:title "DKG Coding Project Ontology (v1)" ;\r
356
+ dcterms:description """The starter ontology for any DKG context graph that\r
357
+ represents a software project — its decisions, tasks, code structure, GitHub\r
358
+ activity, agents, and chat. Designed to be \`owl:imports\`-ed by per-project\r
359
+ ontologies, which add their own extensions on top.\r
360
+ \r
361
+ Every predicate is either reused from a globally-adopted vocabulary\r
362
+ (schema.org, DCTerms, PROV-O, FOAF, SKOS, DOAP) or declared here as a\r
363
+ project-specific extension. Companion document \`agent-guide.md\` translates\r
364
+ this formal model into operational instructions for AI coding agents.""" ;\r
365
+ dcterms:creator "branarakic" ;\r
366
+ owl:versionInfo "1.0.0" ;\r
367
+ dcterms:created "2026-04-18"^^xsd:date ;\r
368
+ owl:imports\r
369
+ <http://schema.org/> ,\r
370
+ <http://purl.org/dc/terms/> ,\r
371
+ <http://www.w3.org/ns/prov#> ,\r
372
+ <http://xmlns.com/foaf/0.1/> ,\r
373
+ <http://www.w3.org/2004/02/skos/core#> ,\r
374
+ <http://usefulinc.com/ns/doap#> .\r
375
+ \r
376
+ # ─── Section 1 — Universal annotation primitives ────────────────────\r
377
+ # Predicates expressing what each chat turn was ABOUT — written into\r
378
+ # the project's \`chat\` sub-graph by the capture-chat hook (and later\r
379
+ # read by \`dkg_query\` / \`dkg_memory_search\`). These predicates apply\r
380
+ # to ANY project type, not just coding.\r
381
+ \r
382
+ chat:topic\r
383
+ a owl:DatatypeProperty ;\r
384
+ rdfs:label "topic" ;\r
385
+ rdfs:comment "Free-text topical bucket the chat turn lives under. Multiple per turn; emit liberally. Renderer can use these to cluster the activity feed." ;\r
386
+ rdfs:domain chat:Turn ;\r
387
+ rdfs:range xsd:string .\r
388
+ \r
389
+ chat:mentions\r
390
+ a owl:ObjectProperty ;\r
391
+ rdfs:label "mentions" ;\r
392
+ rdfs:comment "An entity the chat turn referenced. The most common edge in the graph. To find existing entities to reuse before minting fresh URIs, use \`dkg_memory_search\` (free-text recall across WM/SWM/VM)." ;\r
393
+ rdfs:domain chat:Turn ;\r
394
+ rdfs:range owl:Thing ;\r
395
+ rdfs:subPropertyOf schema:mentions .\r
396
+ \r
397
+ chat:examines\r
398
+ a owl:ObjectProperty ;\r
399
+ rdfs:label "examines" ;\r
400
+ rdfs:comment "Entity the chat turn walked through in detail (vs just mentioning in passing). Implies the agent or operator is ANALYSING the entity, not merely citing it." ;\r
401
+ rdfs:domain chat:Turn ;\r
402
+ rdfs:range owl:Thing .\r
403
+ \r
404
+ chat:proposes\r
405
+ a owl:ObjectProperty ;\r
406
+ rdfs:label "proposes" ;\r
407
+ rdfs:comment "An idea/decision/task the chat turn put forward. Often points at a freshly-minted Decision or Task entity created in the same write batch." ;\r
408
+ rdfs:domain chat:Turn ;\r
409
+ rdfs:range owl:Thing .\r
410
+ \r
411
+ chat:concludes\r
412
+ a owl:ObjectProperty ;\r
413
+ rdfs:label "concludes" ;\r
414
+ rdfs:comment "A Finding entity the chat turn produced — a claim worth preserving as a first-class node, separate from the turn body." ;\r
415
+ rdfs:domain chat:Turn ;\r
416
+ rdfs:range :Finding .\r
417
+ \r
418
+ chat:asks\r
419
+ a owl:ObjectProperty ;\r
420
+ rdfs:label "asks" ;\r
421
+ rdfs:comment "A Question entity the chat turn left open. Tracking these lets a future query surface 'what did we never resolve?'." ;\r
422
+ rdfs:domain chat:Turn ;\r
423
+ rdfs:range :Question .\r
424
+ \r
425
+ # ─── Section 2 — Universal annotation entity classes ────────────────\r
426
+ \r
427
+ :Concept\r
428
+ a owl:Class ;\r
429
+ rdfs:label "Concept" ;\r
430
+ rdfs:comment "A free-text concept emerging from chat that doesn't fit into a more specific class. Aligned with skos:Concept so it composes with any knowledge organisation system." ;\r
431
+ rdfs:subClassOf skos:Concept .\r
432
+ \r
433
+ :Topic\r
434
+ a owl:Class ;\r
435
+ rdfs:label "Topic" ;\r
436
+ rdfs:comment "A broad topical bucket grouping related concepts/turns/entities. URI pattern: urn:dkg:topic:<slug>." ;\r
437
+ rdfs:subClassOf skos:Concept .\r
438
+ \r
439
+ :Question\r
440
+ a owl:Class ;\r
441
+ rdfs:label "Question" ;\r
442
+ rdfs:comment "An open question raised in chat that hasn't been answered yet. URI pattern: urn:dkg:question:<slug>. Resolved by linking a chat:Turn or :Finding via :answers." ;\r
443
+ rdfs:subClassOf schema:Question .\r
444
+ \r
445
+ :Finding\r
446
+ a owl:Class ;\r
447
+ rdfs:label "Finding" ;\r
448
+ rdfs:comment "A claim or observation worth preserving as a first-class entity, separate from the chat turn that produced it. URI pattern: urn:dkg:finding:<slug>. Findings can be cited by future Decisions, Tasks, and chat turns." ;\r
449
+ rdfs:subClassOf prov:Entity .\r
450
+ \r
451
+ :answers\r
452
+ a owl:ObjectProperty ;\r
453
+ rdfs:label "answers" ;\r
454
+ rdfs:comment "Links a Finding (or chat turn) to the Question it resolves." ;\r
455
+ rdfs:domain owl:Thing ;\r
456
+ rdfs:range :Question .\r
457
+ \r
458
+ :supersedes\r
459
+ a owl:ObjectProperty ;\r
460
+ rdfs:label "supersedes" ;\r
461
+ rdfs:comment "This entity replaces an older one (e.g. a revised Finding supersedes an earlier one)." ;\r
462
+ rdfs:range owl:Thing ;\r
463
+ owl:inverseOf prov:wasRevisionOf .\r
464
+ \r
465
+ # ─── Section 3 — Coding-project-specific classes ────────────────────\r
466
+ # Formalises the predicates already used informally in\r
467
+ # scripts/lib/ontology.mjs, anchoring them in PROV-O and schema.org.\r
468
+ \r
469
+ decisions:Decision\r
470
+ a owl:Class ;\r
471
+ rdfs:label "Decision" ;\r
472
+ rdfs:comment "An architectural decision the project made — context, outcome, consequences. Modelled as a prov:Activity because it represents a deliberate act of choosing." ;\r
473
+ rdfs:subClassOf prov:Activity, schema:Action .\r
474
+ \r
475
+ decisions:context\r
476
+ a owl:DatatypeProperty ;\r
477
+ rdfs:label "context" ;\r
478
+ rdfs:domain decisions:Decision ;\r
479
+ rdfs:range xsd:string ;\r
480
+ rdfs:comment "Why this decision was being made — problem, constraints, alternatives considered." .\r
481
+ \r
482
+ decisions:outcome\r
483
+ a owl:DatatypeProperty ;\r
484
+ rdfs:label "outcome" ;\r
485
+ rdfs:domain decisions:Decision ;\r
486
+ rdfs:range xsd:string ;\r
487
+ rdfs:comment "The chosen direction — the decision itself, in one paragraph." .\r
488
+ \r
489
+ decisions:consequences\r
490
+ a owl:DatatypeProperty ;\r
491
+ rdfs:label "consequences" ;\r
492
+ rdfs:domain decisions:Decision ;\r
493
+ rdfs:range xsd:string ;\r
494
+ rdfs:comment "What this implies going forward — trade-offs, follow-ups." .\r
495
+ \r
496
+ decisions:status\r
497
+ a owl:DatatypeProperty ;\r
498
+ rdfs:label "status" ;\r
499
+ rdfs:domain decisions:Decision ;\r
500
+ rdfs:range xsd:string ;\r
501
+ rdfs:comment "One of: proposed | accepted | rejected | superseded." .\r
502
+ \r
503
+ tasks:Task\r
504
+ a owl:Class ;\r
505
+ rdfs:label "Task" ;\r
506
+ rdfs:comment "A piece of planned or in-flight work on the project." ;\r
507
+ rdfs:subClassOf schema:Action .\r
508
+ \r
509
+ tasks:status\r
510
+ a owl:DatatypeProperty ;\r
511
+ rdfs:label "status" ;\r
512
+ rdfs:domain tasks:Task ;\r
513
+ rdfs:range xsd:string ;\r
514
+ rdfs:comment "One of: todo | in_progress | blocked | done | cancelled." .\r
515
+ \r
516
+ tasks:priority\r
517
+ a owl:DatatypeProperty ;\r
518
+ rdfs:label "priority" ;\r
519
+ rdfs:domain tasks:Task ;\r
520
+ rdfs:range xsd:string ;\r
521
+ rdfs:comment "One of: p0 | p1 | p2 | p3." .\r
522
+ \r
523
+ tasks:relatedDecision\r
524
+ a owl:ObjectProperty ;\r
525
+ rdfs:label "related decision" ;\r
526
+ rdfs:domain tasks:Task ;\r
527
+ rdfs:range decisions:Decision ;\r
528
+ rdfs:comment "The Decision this task implements or follows from." .\r
529
+ \r
530
+ tasks:dependsOn\r
531
+ a owl:ObjectProperty ;\r
532
+ rdfs:label "depends on" ;\r
533
+ rdfs:domain tasks:Task ;\r
534
+ rdfs:range tasks:Task .\r
535
+ \r
536
+ tasks:touches\r
537
+ a owl:ObjectProperty ;\r
538
+ rdfs:label "touches" ;\r
539
+ rdfs:domain tasks:Task ;\r
540
+ rdfs:range owl:Thing ;\r
541
+ rdfs:comment "A code:File or code:Package this task edits." .\r
542
+ \r
543
+ # Code structure — aligned with schema:SoftwareSourceCode + DOAP.\r
544
+ \r
545
+ code:Package\r
546
+ a owl:Class ;\r
547
+ rdfs:label "Package" ;\r
548
+ rdfs:subClassOf doap:Project, schema:SoftwareApplication .\r
549
+ \r
550
+ code:File\r
551
+ a owl:Class ;\r
552
+ rdfs:label "Source file" ;\r
553
+ rdfs:subClassOf schema:SoftwareSourceCode .\r
554
+ \r
555
+ code:Function a owl:Class ; rdfs:label "Function" .\r
556
+ code:Class a owl:Class ; rdfs:label "Class" .\r
557
+ code:Interface a owl:Class ; rdfs:label "Interface" .\r
558
+ \r
559
+ # GitHub — minimal aliasing onto schema.org where sensible.\r
560
+ \r
561
+ github:Repository\r
562
+ a owl:Class ;\r
563
+ rdfs:label "GitHub repository" ;\r
564
+ rdfs:subClassOf schema:SoftwareSourceCode, doap:Project .\r
565
+ \r
566
+ github:PullRequest\r
567
+ a owl:Class ;\r
568
+ rdfs:label "Pull request" ;\r
569
+ rdfs:subClassOf schema:CreativeWork .\r
570
+ \r
571
+ github:Issue\r
572
+ a owl:Class ;\r
573
+ rdfs:label "GitHub issue" ;\r
574
+ rdfs:subClassOf schema:Question, schema:CreativeWork .\r
575
+ \r
576
+ # ─── Section 4 — Chat sub-graph classes ─────────────────────────────\r
577
+ \r
578
+ chat:Session\r
579
+ a owl:Class ;\r
580
+ rdfs:label "Chat session" ;\r
581
+ rdfs:comment "One conversation between an operator and their coding assistant (Cursor window, Claude Code thread, etc.)." ;\r
582
+ rdfs:subClassOf schema:Conversation .\r
583
+ \r
584
+ chat:Turn\r
585
+ a owl:Class ;\r
586
+ rdfs:label "Chat turn" ;\r
587
+ rdfs:comment "One user-prompt + assistant-response pair within a Session. Carries provenance via prov:wasAttributedTo." ;\r
588
+ rdfs:subClassOf schema:Message, prov:Entity .\r
589
+ \r
590
+ chat:userPrompt a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
591
+ chat:assistantResponse a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
592
+ chat:turnIndex a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:integer .\r
593
+ chat:inSession a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range chat:Session .\r
594
+ chat:speakerTool a owl:DatatypeProperty ; rdfs:range xsd:string ;\r
595
+ rdfs:comment "Identifier of the coding assistant that produced the turn (e.g. 'cursor', 'claude-code')." .\r
596
+ chat:privacy a owl:DatatypeProperty ; rdfs:domain chat:Session ; rdfs:range xsd:string ;\r
597
+ rdfs:comment "One of: private | team | public. Controls auto-promote behaviour of the capture hook." .\r
598
+ \r
599
+ # ─── Section 5 — Agent identity ─────────────────────────────────────\r
600
+ \r
601
+ agent:Agent\r
602
+ a owl:Class ;\r
603
+ rdfs:label "Agent" ;\r
604
+ rdfs:subClassOf prov:Agent, foaf:Agent .\r
605
+ \r
606
+ agent:HumanAgent rdfs:subClassOf agent:Agent, foaf:Person .\r
607
+ agent:AIAgent rdfs:subClassOf agent:Agent, schema:SoftwareApplication .\r
608
+ \r
609
+ agent:framework\r
610
+ a owl:DatatypeProperty ;\r
611
+ rdfs:label "framework" ;\r
612
+ rdfs:domain agent:AIAgent ;\r
613
+ rdfs:range xsd:string ;\r
614
+ rdfs:comment "Name of the agent runtime — 'cursor', 'claude-code', 'openclaw', 'hermes', etc." .\r
615
+ \r
616
+ agent:operator\r
617
+ a owl:ObjectProperty ;\r
618
+ rdfs:label "operator" ;\r
619
+ rdfs:domain agent:AIAgent ;\r
620
+ rdfs:range agent:HumanAgent ;\r
621
+ rdfs:comment "The human operator who runs and is responsible for this AI agent." .\r
622
+ \r
623
+ # ─── Section 6 — URI minting conventions (machine-readable) ─────────\r
624
+ # These are encoded as SKOS notes so an agent reading the ontology can\r
625
+ # pull them out programmatically. The agent guide repeats them in\r
626
+ # prose for human readability.\r
627
+ \r
628
+ :UriPattern\r
629
+ a owl:Class ;\r
630
+ rdfs:label "URI minting pattern" ;\r
631
+ rdfs:comment "Documents the URI shape the agent should produce when minting a new entity of a given type." .\r
632
+ \r
633
+ :concept-pattern a :UriPattern ;\r
634
+ skos:notation "urn:dkg:concept:<slug>" ;\r
635
+ skos:definition "Free-text concept; aligned with skos:Concept." .\r
636
+ :topic-pattern a :UriPattern ;\r
637
+ skos:notation "urn:dkg:topic:<slug>" ;\r
638
+ skos:definition "Broad topical bucket grouping related entities." .\r
639
+ :question-pattern a :UriPattern ;\r
640
+ skos:notation "urn:dkg:question:<slug>" ;\r
641
+ skos:definition "An open question awaiting an answer." .\r
642
+ :finding-pattern a :UriPattern ;\r
643
+ skos:notation "urn:dkg:finding:<slug>" ;\r
644
+ skos:definition "A claim or observation worth preserving as a first-class node." .\r
645
+ :decision-pattern a :UriPattern ;\r
646
+ skos:notation "urn:dkg:decision:<slug>" ;\r
647
+ skos:definition "An architectural decision (coding-project specific)." .\r
648
+ :task-pattern a :UriPattern ;\r
649
+ skos:notation "urn:dkg:task:<slug>" ;\r
650
+ skos:definition "A piece of planned or in-flight work (coding-project specific)." .\r
651
+ \r
652
+ # ─── Section 7 — Slug normalisation rule (deterministic) ────────────\r
653
+ \r
654
+ :slug-normalisation a skos:Note ;\r
655
+ skos:prefLabel "slug normalisation" ;\r
656
+ skos:definition """To compute the canonical slug from a free-text label:\r
657
+ 1. Lowercase.\r
658
+ 2. Apply Unicode NFKD then strip combining marks (ASCII fold).\r
659
+ 3. Strip common stopwords (the / a / an / of / for / and / or / to / in / on / with).\r
660
+ 4. Replace any run of non-[a-z0-9] with a single hyphen.\r
661
+ 5. Trim leading/trailing hyphens.\r
662
+ 6. Truncate to 60 characters max.\r
663
+ \r
664
+ Example: "the Tree-Sitter library", "Tree sitter", "TREE_SITTER" all\r
665
+ normalise to "tree-sitter". Always apply this BEFORE comparing free-text\r
666
+ recall results (\`dkg_memory_search\`) in the look-before-mint protocol.""" .\r
667
+ `,wL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .\r
668
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\r
669
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\r
670
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\r
671
+ @prefix dcterms: <http://purl.org/dc/terms/> .\r
672
+ @prefix schema: <http://schema.org/> .\r
673
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .\r
674
+ @prefix prov: <http://www.w3.org/ns/prov#> .\r
675
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .\r
676
+ @prefix bibo: <http://purl.org/ontology/bibo/> .\r
677
+ \r
678
+ @prefix chat: <http://dkg.io/ontology/chat/> .\r
679
+ @prefix : <http://dkg.io/ontology/narrative-writing/> .\r
680
+ \r
681
+ <http://dkg.io/ontology/narrative-writing/>\r
682
+ a owl:Ontology ;\r
683
+ dcterms:title "DKG Narrative Writing Project Ontology (v1)" ;\r
684
+ dcterms:description """Starter for fiction or narrative non-fiction\r
685
+ projects: novels, screenplays, biographies. Tracks Characters, Scenes,\r
686
+ Plot Points, Themes, and the relationships between them.""" ;\r
687
+ owl:versionInfo "1.0.0" ;\r
688
+ dcterms:created "2026-04-18"^^xsd:date ;\r
689
+ owl:imports\r
690
+ <http://schema.org/> , <http://purl.org/dc/terms/> ,\r
691
+ <http://xmlns.com/foaf/0.1/> ,\r
692
+ <http://www.w3.org/2004/02/skos/core#> ,\r
693
+ <http://purl.org/ontology/bibo/> .\r
694
+ \r
695
+ # ─── Universal annotation predicates ────────────────────────────────\r
696
+ chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
697
+ chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .\r
698
+ chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
699
+ chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
700
+ chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .\r
701
+ chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .\r
702
+ \r
703
+ # ─── Universal annotation entities ──────────────────────────────────\r
704
+ :Concept rdfs:subClassOf skos:Concept .\r
705
+ :Topic rdfs:subClassOf skos:Concept .\r
706
+ :Question rdfs:subClassOf schema:Question .\r
707
+ :Finding rdfs:subClassOf prov:Entity .\r
708
+ \r
709
+ # ─── Narrative-writing-specific ─────────────────────────────────────\r
710
+ \r
711
+ :Character a owl:Class ;\r
712
+ rdfs:label "Character" ;\r
713
+ rdfs:comment "A character in the narrative — fictional or historical." ;\r
714
+ rdfs:subClassOf foaf:Person, schema:Person .\r
715
+ \r
716
+ :Scene a owl:Class ;\r
717
+ rdfs:label "Scene" ;\r
718
+ rdfs:comment "A discrete unit of narrative action — a single place/time/event in the story." ;\r
719
+ rdfs:subClassOf schema:Event .\r
720
+ \r
721
+ :PlotPoint a owl:Class ;\r
722
+ rdfs:label "Plot point" ;\r
723
+ rdfs:comment "A structural moment in the narrative arc (inciting incident, climax, resolution, etc.)." .\r
724
+ \r
725
+ :Theme a owl:Class ;\r
726
+ rdfs:label "Theme" ;\r
727
+ rdfs:comment "A unifying idea explored across the narrative." ;\r
728
+ rdfs:subClassOf skos:Concept .\r
729
+ \r
730
+ :Setting a owl:Class ;\r
731
+ rdfs:label "Setting" ;\r
732
+ rdfs:comment "A place + time context within which Scenes occur." .\r
733
+ \r
734
+ :appearsIn a owl:ObjectProperty ;\r
735
+ rdfs:label "appears in" ;\r
736
+ rdfs:domain :Character ;\r
737
+ rdfs:range :Scene .\r
738
+ \r
739
+ :setIn a owl:ObjectProperty ;\r
740
+ rdfs:label "set in" ;\r
741
+ rdfs:domain :Scene ;\r
742
+ rdfs:range :Setting .\r
743
+ \r
744
+ :develops a owl:ObjectProperty ;\r
745
+ rdfs:label "develops" ;\r
746
+ rdfs:comment "A Scene or PlotPoint develops a Theme or a Character arc." ;\r
747
+ rdfs:range owl:Thing .\r
748
+ \r
749
+ :precedes a owl:ObjectProperty ;\r
750
+ rdfs:label "precedes" ;\r
751
+ rdfs:domain :Scene ;\r
752
+ rdfs:range :Scene .\r
753
+ \r
754
+ # ─── URI patterns ───────────────────────────────────────────────────\r
755
+ :UriPattern rdfs:label "URI minting pattern" .\r
756
+ \r
757
+ :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .\r
758
+ :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .\r
759
+ :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .\r
760
+ :character-pattern a :UriPattern ; skos:notation "urn:dkg:character:<slug>" .\r
761
+ :scene-pattern a :UriPattern ; skos:notation "urn:dkg:scene:<slug>" .\r
762
+ :plotpoint-pattern a :UriPattern ; skos:notation "urn:dkg:plotpoint:<slug>" .\r
763
+ :theme-pattern a :UriPattern ; skos:notation "urn:dkg:theme:<slug>" .\r
764
+ :setting-pattern a :UriPattern ; skos:notation "urn:dkg:setting:<slug>" .\r
765
+ \r
766
+ :slug-normalisation a skos:Note ;\r
767
+ skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .\r
768
+ `,kL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .\r
769
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\r
770
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\r
771
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\r
772
+ @prefix dcterms: <http://purl.org/dc/terms/> .\r
773
+ @prefix schema: <http://schema.org/> .\r
774
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .\r
775
+ @prefix prov: <http://www.w3.org/ns/prov#> .\r
776
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .\r
777
+ @prefix time: <http://www.w3.org/2006/time#> .\r
778
+ \r
779
+ @prefix chat: <http://dkg.io/ontology/chat/> .\r
780
+ @prefix : <http://dkg.io/ontology/pkm/> .\r
781
+ \r
782
+ <http://dkg.io/ontology/pkm/>\r
783
+ a owl:Ontology ;\r
784
+ dcterms:title "DKG Personal Knowledge Management Ontology (v1)" ;\r
785
+ dcterms:description """Starter for personal/team knowledge gardens.\r
786
+ Notes, highlights, questions, insights — the daily-driver vocabulary\r
787
+ of an Obsidian/Roam-style PKM workflow, but graph-native and shareable\r
788
+ with teammates' agents.""" ;\r
789
+ owl:versionInfo "1.0.0" ;\r
790
+ dcterms:created "2026-04-18"^^xsd:date ;\r
791
+ owl:imports\r
792
+ <http://schema.org/> , <http://purl.org/dc/terms/> ,\r
793
+ <http://xmlns.com/foaf/0.1/> ,\r
794
+ <http://www.w3.org/2004/02/skos/core#> ,\r
795
+ <http://www.w3.org/2006/time#> .\r
796
+ \r
797
+ # ─── Universal annotation predicates ────────────────────────────────\r
798
+ chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
799
+ chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .\r
800
+ chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
801
+ chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
802
+ chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Insight .\r
803
+ chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .\r
804
+ \r
805
+ # ─── Universal annotation entities ──────────────────────────────────\r
806
+ :Concept rdfs:subClassOf skos:Concept .\r
807
+ :Topic rdfs:subClassOf skos:Concept .\r
808
+ :Question rdfs:subClassOf schema:Question .\r
809
+ :Finding rdfs:subClassOf prov:Entity .\r
810
+ \r
811
+ # ─── PKM-specific ────────────────────────────────────────────────────\r
812
+ \r
813
+ :Note a owl:Class ;\r
814
+ rdfs:label "Note" ;\r
815
+ rdfs:comment "An atomic note — a single self-contained thought worth capturing. The fundamental unit of a PKM graph." ;\r
816
+ rdfs:subClassOf schema:CreativeWork .\r
817
+ \r
818
+ :Highlight a owl:Class ;\r
819
+ rdfs:label "Highlight" ;\r
820
+ rdfs:comment "A passage of text marked as significant from a source (article, book, transcript). Carries provenance back to the source." ;\r
821
+ rdfs:subClassOf schema:Quotation .\r
822
+ \r
823
+ :Insight a owl:Class ;\r
824
+ rdfs:label "Insight" ;\r
825
+ rdfs:comment "A connection or realisation that synthesises across multiple Notes/Highlights. Promotes from a chat turn via chat:concludes." ;\r
826
+ rdfs:subClassOf prov:Entity .\r
827
+ \r
828
+ :relatedTo a owl:ObjectProperty ;\r
829
+ rdfs:label "related to" ;\r
830
+ rdfs:subPropertyOf skos:related .\r
831
+ \r
832
+ :references a owl:ObjectProperty ;\r
833
+ rdfs:label "references" ;\r
834
+ rdfs:subPropertyOf dcterms:references .\r
835
+ \r
836
+ :source a owl:ObjectProperty ;\r
837
+ rdfs:label "source" ;\r
838
+ rdfs:domain :Highlight ;\r
839
+ rdfs:range schema:CreativeWork ;\r
840
+ rdfs:comment "Where a Highlight was extracted from." ;\r
841
+ rdfs:subPropertyOf dcterms:source .\r
842
+ \r
843
+ # ─── URI patterns ───────────────────────────────────────────────────\r
844
+ :UriPattern rdfs:label "URI minting pattern" .\r
845
+ \r
846
+ :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .\r
847
+ :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .\r
848
+ :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .\r
849
+ :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .\r
850
+ :note-pattern a :UriPattern ; skos:notation "urn:dkg:note:<slug>" .\r
851
+ :highlight-pattern a :UriPattern ; skos:notation "urn:dkg:highlight:<slug>" .\r
852
+ :insight-pattern a :UriPattern ; skos:notation "urn:dkg:insight:<slug>" .\r
853
+ \r
854
+ :slug-normalisation a skos:Note ;\r
855
+ skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .\r
856
+ `,SL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .\r
857
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\r
858
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\r
859
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\r
860
+ @prefix dcterms: <http://purl.org/dc/terms/> .\r
861
+ @prefix schema: <http://schema.org/> .\r
862
+ @prefix prov: <http://www.w3.org/ns/prov#> .\r
863
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .\r
864
+ @prefix dcat: <http://www.w3.org/ns/dcat#> .\r
865
+ @prefix fabio: <http://purl.org/spar/fabio/> .\r
866
+ @prefix time: <http://www.w3.org/2006/time#> .\r
867
+ \r
868
+ @prefix chat: <http://dkg.io/ontology/chat/> .\r
869
+ @prefix : <http://dkg.io/ontology/scientific-research/> .\r
870
+ \r
871
+ <http://dkg.io/ontology/scientific-research/>\r
872
+ a owl:Ontology ;\r
873
+ dcterms:title "DKG Scientific Research Project Ontology (v1)" ;\r
874
+ dcterms:description """Starter for empirical scientific research:\r
875
+ hypotheses → experiments → results → reproducibility chains. Composes\r
876
+ with FaBiO for scholarly works, DCAT for datasets, PROV-O for\r
877
+ provenance, OWL Time for sequencing.""" ;\r
878
+ owl:versionInfo "1.0.0" ;\r
879
+ dcterms:created "2026-04-18"^^xsd:date ;\r
880
+ owl:imports\r
881
+ <http://schema.org/> , <http://purl.org/dc/terms/> ,\r
882
+ <http://www.w3.org/ns/prov#> ,\r
883
+ <http://www.w3.org/2004/02/skos/core#> ,\r
884
+ <http://www.w3.org/ns/dcat#> ,\r
885
+ <http://purl.org/spar/fabio/> ,\r
886
+ <http://www.w3.org/2006/time#> .\r
887
+ \r
888
+ # ─── Universal annotation predicates ────────────────────────────────\r
889
+ chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
890
+ chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .\r
891
+ chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
892
+ chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
893
+ chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Result .\r
894
+ chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .\r
895
+ \r
896
+ # ─── Universal annotation entities ──────────────────────────────────\r
897
+ :Concept rdfs:subClassOf skos:Concept .\r
898
+ :Topic rdfs:subClassOf skos:Concept .\r
899
+ :Question rdfs:subClassOf schema:Question .\r
900
+ :Finding rdfs:subClassOf prov:Entity .\r
901
+ \r
902
+ # ─── Scientific-research-specific ───────────────────────────────────\r
903
+ \r
904
+ :Hypothesis a owl:Class ;\r
905
+ rdfs:label "Hypothesis" ;\r
906
+ rdfs:comment "A testable claim. Linked to Experiments via :testedBy and to Results via :supportedBy / :refutedBy." ;\r
907
+ rdfs:subClassOf prov:Entity .\r
908
+ \r
909
+ :Experiment a owl:Class ;\r
910
+ rdfs:label "Experiment" ;\r
911
+ rdfs:comment "A defined procedure executed to test a Hypothesis. Subclass of prov:Activity for full provenance." ;\r
912
+ rdfs:subClassOf prov:Activity .\r
913
+ \r
914
+ :Method a owl:Class ;\r
915
+ rdfs:label "Method" ;\r
916
+ rdfs:comment "A reusable methodology applied within Experiments." ;\r
917
+ rdfs:subClassOf prov:Plan .\r
918
+ \r
919
+ :Result a owl:Class ;\r
920
+ rdfs:label "Result" ;\r
921
+ rdfs:comment "An outcome produced by an Experiment — quantitative or qualitative." ;\r
922
+ rdfs:subClassOf prov:Entity .\r
923
+ \r
924
+ :Dataset a owl:Class ;\r
925
+ rdfs:label "Dataset" ;\r
926
+ rdfs:comment "An input or output dataset for an Experiment. Aligned with DCAT." ;\r
927
+ rdfs:subClassOf dcat:Dataset .\r
928
+ \r
929
+ :testedBy a owl:ObjectProperty ;\r
930
+ rdfs:label "tested by" ;\r
931
+ rdfs:domain :Hypothesis ;\r
932
+ rdfs:range :Experiment .\r
933
+ \r
934
+ :supportedBy a owl:ObjectProperty ;\r
935
+ rdfs:label "supported by" ;\r
936
+ rdfs:domain :Hypothesis ;\r
937
+ rdfs:range :Result .\r
938
+ \r
939
+ :refutedBy a owl:ObjectProperty ;\r
940
+ rdfs:label "refuted by" ;\r
941
+ rdfs:domain :Hypothesis ;\r
942
+ rdfs:range :Result .\r
943
+ \r
944
+ :usesDataset a owl:ObjectProperty ;\r
945
+ rdfs:label "uses dataset" ;\r
946
+ rdfs:domain :Experiment ;\r
947
+ rdfs:range :Dataset .\r
948
+ \r
949
+ :reproducedBy a owl:ObjectProperty ;\r
950
+ rdfs:label "reproduced by" ;\r
951
+ rdfs:domain :Experiment ;\r
952
+ rdfs:range :Experiment ;\r
953
+ rdfs:comment "An Experiment that successfully reproduced this one's Results." .\r
954
+ \r
955
+ # ─── URI patterns ───────────────────────────────────────────────────\r
956
+ :UriPattern rdfs:label "URI minting pattern" .\r
957
+ \r
958
+ :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .\r
959
+ :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .\r
960
+ :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .\r
961
+ :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .\r
962
+ :hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .\r
963
+ :experiment-pattern a :UriPattern ; skos:notation "urn:dkg:experiment:<slug>" .\r
964
+ :method-pattern a :UriPattern ; skos:notation "urn:dkg:method:<slug>" .\r
965
+ :result-pattern a :UriPattern ; skos:notation "urn:dkg:result:<slug>" .\r
966
+ :dataset-pattern a :UriPattern ; skos:notation "urn:dkg:dataset:<slug>" .\r
967
+ \r
968
+ :slug-normalisation a skos:Note ;\r
969
+ skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .\r
970
+ `,jL=`# Book-research agent guide\r
971
+ \r
972
+ This starter ships an RDF ontology for **book-research projects** —\r
973
+ research notebooks anchored in scholarly sources (citations, quotes,\r
974
+ arguments, hypotheses). The formal schema lives in \`ontology.ttl\`\r
975
+ alongside this guide.\r
976
+ \r
977
+ For V10 MCP tool usage, see\r
978
+ [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).\r
979
+ The tool surface to use against this ontology:\r
980
+ \r
981
+ - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)\r
982
+ - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")\r
983
+ - \`dkg_knowledge_asset_share\` — share with peers (SWM)\r
984
+ - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL\r
985
+ - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall\r
986
+ \r
987
+ The longer per-domain agent-guide walkthrough format will return when\r
988
+ the V10 ontology endpoint and per-project annotation workflow stabilise.\r
989
+ `,CL=`# Coding-project agent guide\r
990
+ \r
991
+ This starter ships an RDF ontology for **coding projects** —\r
992
+ shared project memory for AI coding agents (decisions, tasks, code\r
993
+ references, GitHub activity, chat turns). The formal schema lives in\r
994
+ \`ontology.ttl\` alongside this guide.\r
995
+ \r
996
+ For V10 MCP tool usage, see\r
997
+ [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).\r
998
+ The tool surface to use against this ontology:\r
999
+ \r
1000
+ - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)\r
1001
+ - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")\r
1002
+ - \`dkg_knowledge_asset_share\` — share with peers (SWM)\r
1003
+ - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL\r
1004
+ - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall\r
1005
+ \r
1006
+ The longer per-domain agent-guide walkthrough format will return when\r
1007
+ the V10 ontology endpoint and per-project annotation workflow stabilise.\r
1008
+ `,NL=`# Narrative-writing agent guide\r
1009
+ \r
1010
+ This starter ships an RDF ontology for **narrative-writing projects** —\r
1011
+ the structural elements of long-form narrative (Characters, Scenes,\r
1012
+ PlotPoints, Themes, Settings) and their relationships. The formal\r
1013
+ schema lives in \`ontology.ttl\` alongside this guide.\r
1014
+ \r
1015
+ For V10 MCP tool usage, see\r
1016
+ [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).\r
1017
+ The tool surface to use against this ontology:\r
1018
+ \r
1019
+ - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)\r
1020
+ - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")\r
1021
+ - \`dkg_knowledge_asset_share\` — share with peers (SWM)\r
1022
+ - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL\r
1023
+ - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall\r
1024
+ \r
1025
+ The longer per-domain agent-guide walkthrough format will return when\r
1026
+ the V10 ontology endpoint and per-project annotation workflow stabilise.\r
1027
+ `,EL=`# PKM agent guide\r
1028
+ \r
1029
+ This starter ships an RDF ontology for **PKM (Personal Knowledge\r
1030
+ Management) projects** — Notes, Highlights, Insights, and the links\r
1031
+ that grow a knowledge garden organically. The formal schema lives in\r
1032
+ \`ontology.ttl\` alongside this guide.\r
1033
+ \r
1034
+ For V10 MCP tool usage, see\r
1035
+ [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).\r
1036
+ The tool surface to use against this ontology:\r
1037
+ \r
1038
+ - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)\r
1039
+ - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")\r
1040
+ - \`dkg_knowledge_asset_share\` — share with peers (SWM)\r
1041
+ - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL\r
1042
+ - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall\r
1043
+ \r
1044
+ The longer per-domain agent-guide walkthrough format will return when\r
1045
+ the V10 ontology endpoint and per-project annotation workflow stabilise.\r
1046
+ `,TL=`# Scientific-research agent guide\r
1047
+ \r
1048
+ This starter ships an RDF ontology for **scientific-research projects** —\r
1049
+ the empirical research arc (Hypotheses → Experiments → Results →\r
1050
+ Reproducibility chains), anchored in PROV-O and FaBiO so the graph\r
1051
+ composes with existing scholarly publishing infrastructure. The formal\r
1052
+ schema lives in \`ontology.ttl\` alongside this guide.\r
1053
+ \r
1054
+ For V10 MCP tool usage, see\r
1055
+ [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).\r
1056
+ The tool surface to use against this ontology:\r
1057
+ \r
1058
+ - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)\r
1059
+ - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")\r
1060
+ - \`dkg_knowledge_asset_share\` — share with peers (SWM)\r
1061
+ - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL\r
1062
+ - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall\r
1063
+ \r
1064
+ The longer per-domain agent-guide walkthrough format will return when\r
1065
+ the V10 ontology endpoint and per-project annotation workflow stabilise.\r
1066
+ `,AL=/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>"{}|\\^`\x00-\x20]+$/;function _L(e){return e?AL.test(e):!1}function VS(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}const Nt={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",schema:"http://schema.org/",dcterms:"http://purl.org/dc/terms/",xsd:"http://www.w3.org/2001/XMLSchema#",prov:"http://www.w3.org/ns/prov#",owl:"http://www.w3.org/2002/07/owl#"};function bi(e){if(!_L(e))throw new Error(`Invalid /wm/write IRI object: ${e}`);return e}function Er(e){return`"${VS(e)}"`}function Cu(e,t){return`"${VS(e)}"^^<${bi(t)}>`}function RL({contextGraphId:e,starterSlug:t,ttl:n,guide:a,nowIso:s=new Date().toISOString()}){if(!e)throw new Error("contextGraphId is required");if(!t)throw new Error("starterSlug is required");const l=bi(`urn:dkg:project:${e}:ontology`),u=bi(`${l}:agent-guide`),d=[{subject:l,predicate:Nt.rdf+"type",object:bi(Nt.owl+"Ontology")},{subject:l,predicate:Nt.rdf+"type",object:bi(Nt.prov+"Entity")},{subject:l,predicate:Nt.rdfs+"label",object:Er(`Project ontology — ${e}`)},{subject:l,predicate:Nt.schema+"name",object:Er(`Project ontology — ${e}`)},{subject:l,predicate:Nt.dcterms+"title",object:Er(`Project ontology — ${e}`)},{subject:l,predicate:Nt.dcterms+"description",object:Er(`The active ontology for context graph ${e}, derived from the '${t}' starter.`)},{subject:l,predicate:Nt.dcterms+"created",object:Cu(s,Nt.xsd+"dateTime")},{subject:l,predicate:Nt.dcterms+"modified",object:Cu(s,Nt.xsd+"dateTime")},{subject:l,predicate:Nt.dcterms+"source",object:Er(t)},{subject:l,predicate:Nt.schema+"encodingFormat",object:Er("text/turtle")},{subject:l,predicate:Nt.schema+"text",object:Er(n)},{subject:l,predicate:Nt.dcterms+"references",object:bi(u)},{subject:u,predicate:Nt.rdf+"type",object:bi(Nt.schema+"DigitalDocument")},{subject:u,predicate:Nt.rdfs+"label",object:Er(`Agent guide — ${e} ontology`)},{subject:u,predicate:Nt.schema+"name",object:Er(`Agent guide — ${e} ontology`)},{subject:u,predicate:Nt.dcterms+"title",object:Er(`Agent guide — ${e} ontology`)},{subject:u,predicate:Nt.dcterms+"created",object:Cu(s,Nt.xsd+"dateTime")},{subject:u,predicate:Nt.dcterms+"modified",object:Cu(s,Nt.xsd+"dateTime")},{subject:u,predicate:Nt.schema+"encodingFormat",object:Er("text/markdown")},{subject:u,predicate:Nt.schema+"text",object:Er(a)},{subject:u,predicate:Nt.schema+"about",object:bi(l)}];return{ontologyUri:l,guideUri:u,quads:d}}async function Nu(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify(t)});if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}const OL=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/ontology.ttl":bL,"../../../../mcp-dkg/templates/ontologies/coding-project/ontology.ttl":xL,"../../../../mcp-dkg/templates/ontologies/narrative-writing/ontology.ttl":wL,"../../../../mcp-dkg/templates/ontologies/pkm/ontology.ttl":kL,"../../../../mcp-dkg/templates/ontologies/scientific-research/ontology.ttl":SL}),LL=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/agent-guide.md":jL,"../../../../mcp-dkg/templates/ontologies/coding-project/agent-guide.md":CL,"../../../../mcp-dkg/templates/ontologies/narrative-writing/agent-guide.md":NL,"../../../../mcp-dkg/templates/ontologies/pkm/agent-guide.md":EL,"../../../../mcp-dkg/templates/ontologies/scientific-research/agent-guide.md":TL});function ML(){const e={};for(const[t,n]of Object.entries(OL)){const a=t.match(/ontologies\/([^/]+)\/ontology\.ttl$/);if(!a)continue;const s=a[1];e[s]={ttl:n,guide:""}}for(const[t,n]of Object.entries(LL)){const a=t.match(/ontologies\/([^/]+)\/agent-guide\.md$/);if(!a)continue;const s=a[1];e[s]&&(e[s].guide=n)}return e}const Pg=ML(),DL=[{slug:"coding-project",displayName:"Coding project",description:"Software projects: decisions, tasks, code, GitHub. The v1 reference ontology."},{slug:"book-research",displayName:"Book / paper research",description:"Long-form non-fiction: hypotheses, arguments, citations, quotes. Built on BIBO + SPAR."},{slug:"pkm",displayName:"Personal knowledge management",description:"Notes, highlights, insights — daily-driver PKM workflow. Composes with SKOS."},{slug:"scientific-research",displayName:"Scientific research",description:"Empirical research: hypotheses → experiments → results → reproducibility. Built on PROV-O + DCAT + FaBiO."},{slug:"narrative-writing",displayName:"Narrative writing",description:"Fiction or narrative non-fiction: characters, scenes, plot points, themes."}];function zL(){return DL.filter(e=>Pg[e.slug])}function $L(e){return Pg[e]??null}async function IL(e,t){const n=$L(t);if(!n)throw new Error(`Unknown ontology starter '${t}'. Available: ${Object.keys(Pg).join(", ")}`);if(!n.ttl||!n.guide)throw new Error(`Starter '${t}' is missing ontology.ttl or agent-guide.md.`);await Nu("/api/sub-graph/create",{contextGraphId:e,subGraphName:"meta"}).catch(d=>{if(!String((d==null?void 0:d.message)??d).includes("already exists"))throw d});const{ontologyUri:a,guideUri:s,quads:l}=RL({contextGraphId:e,starterSlug:t,ttl:n.ttl,guide:n.guide});await Nu("/api/knowledge-assets/project-ontology/wm/discard",{contextGraphId:e,subGraphName:"meta"}).catch(d=>{const f=String((d==null?void 0:d.message)??d);if(!/404|not found/i.test(f))throw d}),await Nu("/api/knowledge-assets/project-ontology/wm/write",{contextGraphId:e,subGraphName:"meta",quads:l});const u=await Nu("/api/knowledge-assets/project-ontology/swm/share",{contextGraphId:e,subGraphName:"meta"});if(!u.swmShared||!u.sealed||!u.publishReady)throw new Error("Project ontology atomic share did not reach Shared Working Memory");return{ontologyUri:a,guideUri:s,tripleCount:l.length}}async function Ug(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify(t)}),a=await n.text();let s;if(a)try{s=JSON.parse(a)}catch{s={raw:a}}if(!n.ok){const l=(s==null?void 0:s.error)??`HTTP ${n.status}`;throw new Error(typeof l=="string"?l:JSON.stringify(l))}return s}function PL(e,t={}){return Ug(`/api/context-graph/${encodeURIComponent(e)}/manifest/publish`,t)}function UL(e,t){return Ug(`/api/context-graph/${encodeURIComponent(e)}/manifest/plan-install`,t)}function BL(e,t){return Ug(`/api/context-graph/${encodeURIComponent(e)}/manifest/install`,t)}const n1="dkg.wireWorkspace.parentDir",r1="dkg.wireWorkspace.nickname",a1="dkg.wireWorkspace.tools",Ah=[{value:"cursor",label:"Cursor",description:"Wires .cursor/mcp.json + hooks + rules into the workspace."},{value:"claude-code",label:"Claude Code",description:"Merges hooks into ~/.claude/settings.json. Requires Claude Code installed."},{value:"both",label:"Both Cursor and Claude Code",description:"Wires both tools so either can operate on this project."},{value:"cursor",label:"Codex (coming soon)",description:"Codex CLI integration isn't shipped yet — pick another tool for now.",disabled:!0,comingSoon:!0}];function FL(e,t){const n=t.split("/"),a=n[n.length-1]??"";return a||(e??"project").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function HL(e){if(!e)return"";const t=e.hostname.replace(/\.local$/,"").replace(/-/g," ");return`${e.username} @ ${t}`}function i1(e){return e==="both"?["cursor","claude-code"]:[e]}function WS({contextGraphId:e,projectName:t,defaultAgentNickname:n,onDone:a,onCancel:s,variant:l}){var Z;const u=w.useMemo(()=>FL(t,e),[t,e]),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(""),[b,k]=w.useState(""),[j,N]=w.useState("cursor"),[S,T]=w.useState(!1),[E,A]=w.useState(null),[B,_]=w.useState(null),[z,q]=w.useState(null);w.useEffect(()=>{let I=!1;return(async()=>{try{const[$,H]=await Promise.all([fetch("/api/host/info",{headers:Ft()}).then(Y=>Y.ok?Y.json():null),Yl().catch(()=>null)]);if(I)return;if($){f($);const Y=typeof window<"u"&&window.localStorage.getItem(n1)||$.defaultWorkspaceParent;y(`${Y}/${u}`)}H&&g(H);const V=typeof window<"u"&&window.localStorage.getItem(r1);n?k(n):V?k(V):$&&k(HL($));const X=typeof window<"u"&&window.localStorage.getItem(a1);X&&(X==="cursor"||X==="claude-code"||X==="both")&&N(X)}catch($){I||console.warn("[WireWorkspacePanel] host info / identity fetch failed:",$)}})(),()=>{I=!0}},[u,n]);function M(I){typeof window>"u"||(window.localStorage.setItem(n1,I),b&&window.localStorage.setItem(r1,b),window.localStorage.setItem(a1,j))}async function R(){T(!0),A(null);try{const I=m.trim();if(!I||I.startsWith("~"))throw new Error("Workspace path must be an absolute path (start with `/`). The daemon will create the directory if it does not exist.");const $=await UL(e,{workspaceRoot:I,agentNickname:b.trim(),tools:i1(j)});_($);const H=I.lastIndexOf("/");H>0&&M(I.slice(0,H))}catch(I){A((I==null?void 0:I.message)||"Preview failed")}finally{T(!1)}}async function P(){T(!0),A(null);try{const I=m.trim(),$=await BL(e,{workspaceRoot:I,agentNickname:b.trim(),tools:i1(j)});q($)}catch(I){A((I==null?void 0:I.message)||"Install failed")}finally{T(!1)}}if(z)return o.jsxs("div",{children:[o.jsxs("div",{style:{padding:"12px 14px",borderRadius:8,marginBottom:14,fontSize:12,background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.25)",color:"var(--accent-green)"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:6},children:"Workspace wired."}),"Open ",o.jsx("code",{style:{fontFamily:"var(--font-mono)"},children:m})," in ",j==="claude-code"?"Claude Code":j==="both"?"Cursor or Claude Code":"Cursor",". On the first chat, your agent will see the project ontology",l==="join"?", tasks, and decisions":" you publish via the canonical assertion-write flow","."]}),o.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginBottom:8},children:"Files written:"}),o.jsxs("pre",{style:{fontSize:10,fontFamily:"var(--font-mono)",maxHeight:200,overflow:"auto",padding:10,borderRadius:6,background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",margin:0},children:[z.written.map(I=>`${I.action.padEnd(9)} ${I.absPath} (${I.bytesWritten.toLocaleString()} bytes)`).join(`
1067
+ `),z.skipped.length?`
1068
+
1069
+ Skipped:
1070
+ `+z.skipped.map(I=>` - ${I}`).join(`
1071
+ `):"",z.warnings.length?`
1072
+
1073
+ Warnings:
1074
+ `+z.warnings.map(I=>` - ${I}`).join(`
1075
+ `):""]}),o.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:14},children:o.jsx("button",{className:"v10-modal-btn primary",onClick:a,children:"Done"})})]});if(B)return o.jsxs("div",{children:[E&&o.jsx("div",{className:"v10-modal-error",style:{marginBottom:12},children:E}),o.jsx("div",{style:{marginBottom:10,fontSize:11,color:"var(--text-secondary)"},children:"Review the install plan. Files are only written when you click Install."}),o.jsx("pre",{style:{fontSize:10,fontFamily:"var(--font-mono)",maxHeight:320,overflow:"auto",padding:12,borderRadius:6,background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",margin:0,whiteSpace:"pre-wrap"},children:B.markdown}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:14,gap:10},children:[o.jsx("button",{className:"v10-modal-btn",onClick:()=>{_(null),A(null)},disabled:S,children:"← Back"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{className:"v10-modal-btn",onClick:a,disabled:S,children:"Skip for now"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:P,disabled:S,children:S?"Installing…":"Install"})]})]})]});const F=((Z=Ah.find(I=>I.value===j&&!I.disabled))==null?void 0:Z.description)??Ah[0].description;return o.jsxs("div",{children:[o.jsxs("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:14,fontSize:12,background:"rgba(59, 130, 246, 0.08)",border:"1px solid rgba(59, 130, 246, 0.25)",color:"var(--accent-primary, #3b82f6)"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:4},children:l==="create"?"Wire your local workspace":"Wire this project locally"}),l==="create"?"Choose a directory for the new project and which coding tool you want it wired for. The daemon will populate the workspace with the right config files so your agent can join the project from turn one.":"Choose a local directory for this project and which coding tool you want it wired for. The daemon will populate the workspace with the right config files so your agent can collaborate on this project."]}),E&&o.jsx("div",{className:"v10-modal-error",style:{marginBottom:12},children:E}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Workspace path"}),o.jsx("input",{className:"v10-form-input",type:"text",value:m,onChange:I=>y(I.target.value),placeholder:d?`${d.defaultWorkspaceParent}/${u}`:"/Users/you/code/project",spellCheck:!1,style:{fontFamily:"var(--font-mono)",fontSize:12}}),o.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:["Absolute path. Created if it doesn't exist. Daemon writes only inside this dir (plus optionally ",o.jsx("code",{children:"~/.claude/settings.json"})," if Claude Code is selected).",d&&o.jsxs(o.Fragment,{children:[" Defaulted from your ",o.jsx("code",{children:"$HOME"})," = ",o.jsx("code",{children:d.homedir}),"."]})]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Coding tool to wire"}),o.jsx("select",{className:"v10-form-select",value:j,onChange:I=>N(I.target.value),children:Ah.map((I,$)=>o.jsx("option",{value:I.disabled?"__disabled__":I.value,disabled:I.disabled,children:I.label},`${I.label}-${$}`))}),o.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:F})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Your agent identity"}),o.jsx("input",{className:"v10-form-input",type:"text",value:h?`urn:dkg:agent:${h.agentAddress.toLowerCase()}`:"fetching…",disabled:!0,spellCheck:!1,style:{fontFamily:"var(--font-mono)",fontSize:11,opacity:.75}}),o.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:["Cryptographic URI derived from this node's wallet address. Same on every project on this machine. Attribution (",o.jsx("code",{children:"prov:wasAttributedTo"}),") on every chat turn uses this URI."]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Nickname for this agent"}),o.jsx("input",{className:"v10-form-input",type:"text",value:b,onChange:I=>k(I.target.value),placeholder:"e.g. Alice on laptop 1",spellCheck:!1,maxLength:80}),o.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:"Free-form human label rendered as the agent's name in chips, lists, and rdfs:label triples. Doesn't affect attribution — only changes how you appear to others."})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:14,gap:10},children:[s?o.jsx("button",{className:"v10-modal-btn",onClick:s,disabled:S,children:"Cancel"}):o.jsx("button",{className:"v10-modal-btn",onClick:a,disabled:S,children:"Skip for now"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:R,disabled:S||!m.trim()||!b.trim(),children:S?"Loading preview…":"Preview install"})]})]})}const s1='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex="-1"])';function Ji(e,t){const n=w.useRef(null),a=w.useRef(null);w.useEffect(()=>{if(e)return a.current=document.activeElement??null,queueMicrotask(()=>{const l=n.current;if(!l)return;const u=l.querySelector(s1),f=l.querySelector("[autofocus]")??u;f?f.focus():(l.hasAttribute("tabindex")||l.setAttribute("tabindex","-1"),l.focus())}),()=>{var l,u;(u=(l=a.current)==null?void 0:l.focus)==null||u.call(l)}},[e]),w.useEffect(()=>{if(!e)return;const l=u=>{if(u.key==="Escape"){u.stopPropagation(),t();return}if(u.key!=="Tab")return;const d=n.current;if(!d)return;const f=Array.from(d.querySelectorAll(s1)).filter(y=>y.offsetParent!==null||y===document.activeElement);if(f.length===0){u.preventDefault(),d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus();return}const h=f[0],g=f[f.length-1],m=document.activeElement;if(m===d){u.preventDefault(),(u.shiftKey?g:h).focus();return}u.shiftKey&&m===h?(u.preventDefault(),g.focus()):!u.shiftKey&&m===g&&(u.preventDefault(),h.focus())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e,t]);const s=w.useCallback(l=>{l.target===l.currentTarget&&t()},[t]);return{dialogRef:n,onBackdropClick:s}}const co=80,qL=/<\/?[a-z][^>]*>/i,GL=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,VL=/[a-z0-9]/i;function WL(e){let t="",n=0;for(;n<e.length;){if(e.charCodeAt(n)===60){const s=e.charCodeAt(n+1);if(s>=65&&s<=90||s>=97&&s<=122||s===47){const u=e.indexOf(">",n+1);if(u===-1)break;n=u+1;continue}}t+=e[n],n+=1}return t}function ZS(e){if(typeof e!="string")return"";let t=WL(e);return t=t.replace(/[<>]/g,""),t=t.replace(GL,""),t=t.replace(/\s+/g," "),t=t.trim(),t.length>co&&(t=t.slice(0,co)),t}function o1(e){const t=ZS(e);return t?VL.test(t)?qL.test(e)?"HTML tags are not allowed in the name — they have been stripped automatically.":/[<>]/.test(e)?"Angle brackets (< or >) are not allowed in the name — they and any text consumed by an unclosed tag have been stripped automatically.":e.length>co?`Name was trimmed to ${co} characters (was ${e.length}).`:null:"Name must contain at least one letter or digit.":"Enter a name with at least one letter or digit."}function l1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function ZL({open:e,onClose:t}){var ut,ye;const[n,a]=w.useState(""),[s,l]=w.useState(""),[u,d]=w.useState("curated"),[f,h]=w.useState("curator-only"),[g,m]=w.useState(!1),[y,b]=w.useState("community"),k=zL(),[j,N]=w.useState(((ut=k[0])==null?void 0:ut.slug)??"coding-project"),[S,T]=w.useState(!1),[E,A]=w.useState("off"),[B,_]=w.useState("7d"),[z,q]=w.useState("100k"),[M,R]=w.useState(!1),[P,F]=w.useState(""),[Z,I]=w.useState(null),[$,H]=w.useState(null),[V,X]=w.useState(null),[Y,L]=w.useState(null),[U,G]=w.useState(""),[O,ne]=w.useState(!0),[ue,le]=w.useState(!1),{setContextGraphs:be,contextGraphs:_e,setActiveProject:Ee}=Ar(),{openTab:Ie}=fn(),{setStage:We,stage:Se}=Ig(),ft=()=>{ne(!0),le(!1),Yl().then(Q=>{X(Q.agentAddress),le(!1)}).catch(()=>{X(null),le(!0)}).finally(()=>ne(!1))};w.useEffect(()=>{e&&(H(null),ft())},[e]);const De=Ji(e&&!Y,t),qe=Ji(e&&!!Y,()=>{L(null),G(""),H(null),a(""),l(""),t()});if(!e)return null;const ke=ZS(n),lt=l1(ke),xe=V&&lt?`${V}/${lt}`:lt?`<agent-address>/${lt}`:"",Oe=n?o1(n):null,Ot=Q=>{a(Q)},$t=async()=>{const Q=ke;if(!Q||Oe)return;R(!0),I(null),H(null),F(g?"Registering context graph on the network…":"Creating context graph locally…");const W=l1(Q);if(!V){I("Agent identity is still loading. Please wait a moment and try again."),R(!1);return}const ee=`${V}/${W}`;try{const ce=setTimeout(()=>F(g?"On-chain registration in progress — this can take up to 30s…":"Setting up local context graph…"),5e3),he=u==="curated"?1:0,Le=f==="curator-only"?0:1,He=u==="curated"?{accessPolicy:he,publishPolicy:Le,allowedAgents:V?[V]:[],register:g}:{accessPolicy:he,publishPolicy:Le,register:g},Ce=await d_(ee,Q,s.trim()||void 0,He);if(clearTimeout(ce),g&&Ce.registered===!1){const Ne=`On-chain registration failed: ${Ce.registerError??"unknown error"}. Project is created locally and usable for everything except Verifiable Memory publishing. Retry registration from the project's Settings when ready.`;console.warn("[CreateProjectModal]",Ne),H(Ne)}if(y==="community"||y==="agent")try{F(`Installing '${j}' ontology…`),await IL(Ce.created,j)}catch(Ne){console.warn("[CreateProjectModal] ontology install failed:",Ne),F(`Context graph created, but ontology install failed: ${(Ne==null?void 0:Ne.message)??Ne}`)}let Fe=!0;try{F("Publishing context graph manifest…"),await PL(Ce.created,{})}catch(Ne){Fe=!1,console.warn("[CreateProjectModal] manifest publish failed:",Ne),F(`Context graph created, but manifest publish failed: ${(Ne==null?void 0:Ne.message)??Ne}`)}F("Refreshing context graph list…");const{contextGraphs:et}=await Ld();be(et??[]),Ee(Ce.created),Ie({id:`project:${Ce.created}`,label:Q,closable:!0}),Se<2&&We(2),Fe?(G(Q),L(Ce.created),F("")):setTimeout(()=>{a(""),l(""),F(""),t()},2500)}catch(ce){const he=(ce==null?void 0:ce.message)||"Failed to create context graph";he.includes("already exists")||he.includes("409")?I("A context graph with this ID already exists. Try a different name."):(he.includes("taking longer"),I(he)),F("")}finally{R(!1)}},Yt=_e.length===0;function qt(){L(null),G(""),H(null),a(""),l(""),t()}return Y?o.jsx("div",{className:"v10-modal-overlay",onClick:qe.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:qe.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-wire-modal-title",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:qt,"aria-label":"Close wire workspace dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsxs("div",{id:"dkg-wire-modal-title",className:"v10-modal-title",children:["Wire workspace for ",U]}),o.jsx("div",{className:"v10-modal-subtitle",children:"Context graph created. Now wire a local workspace so you can plan it from your own Cursor."})]}),o.jsxs("div",{className:"v10-modal-body",children:[$&&o.jsx("div",{className:"v10-modal-warning",children:$}),o.jsx(WS,{contextGraphId:Y,projectName:U,variant:"create",onDone:qt})]})]})}):o.jsx("div",{className:"v10-modal-overlay",onClick:De.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:De.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-create-cg-title","aria-describedby":"dkg-create-cg-subtitle",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close create context graph dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-create-cg-title",className:"v10-modal-title",children:"Create New Context Graph"}),o.jsx("div",{id:"dkg-create-cg-subtitle",className:"v10-modal-subtitle",children:"A context graph gives your agent structured memory — a place to draft, share, and publish knowledge."})]}),o.jsxs("div",{className:"v10-modal-body",children:[Z&&o.jsx("div",{className:"v10-modal-error",children:Z}),$&&o.jsx("div",{className:"v10-modal-warning",children:$}),Yt&&o.jsxs("div",{className:"v10-modal-tip",children:[o.jsx("div",{className:"v10-modal-tip-title",children:"First context graph tip"}),"This is your agent's first memory space. Consider importing any existing knowledge your agent has — notes, documents, conversation logs — so it can build on what it already knows."]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-name",children:"Context Graph Name"}),o.jsx("input",{id:"dkg-cg-name",name:"dkg-cg-name",className:"v10-form-input",type:"text",placeholder:"e.g. Pharma Drug Interactions",value:n,onChange:Q=>Ot(Q.target.value),autoFocus:!0,maxLength:co,"aria-invalid":Oe?"true":"false","aria-describedby":"dkg-cg-name-help",autoComplete:"off",spellCheck:!0}),o.jsx("div",{id:"dkg-cg-name-help",style:{marginTop:4,fontSize:11,color:Oe?"var(--red, #f87171)":"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:Oe||(xe?`ID: did:dkg:context-graph:${xe}`:`${n.length}/${co} characters`)})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-description",children:"Description"}),o.jsx("textarea",{id:"dkg-cg-description",name:"dkg-cg-description",className:"v10-form-textarea",placeholder:"What should your agent remember? Describe the domain, goals, or context...",value:s,onChange:Q=>l(Q.target.value),"aria-label":"Context graph description"})]}),o.jsx("div",{className:"v10-form-divider"}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Sharing"}),o.jsxs("div",{className:"v10-form-radio-group",children:[o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:u==="curated",onChange:()=>d("curated")}),"Invite-only — only invited agents can read and subscribe"]}),o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:u==="public",onChange:()=>d("public")}),"Open — publicly discoverable; anyone can subscribe"]})]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Contribution"}),o.jsxs("div",{className:"v10-form-radio-group",children:[o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:f==="curator-only",onChange:()=>h("curator-only")}),"Curators-only — only the curator may publish to Verifiable Memory"]}),o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:f==="open",onChange:()=>h("open")}),"Open — any wallet may publish to Verifiable Memory (not just members)"]})]}),u==="curated"&&f==="open"&&o.jsxs("div",{style:{marginTop:6,fontSize:11,color:"var(--text-tertiary)"},children:["Note: an invite-only sharing graph with open contribution still lets ",o.jsx("em",{children:"any"})," wallet publish to Verifiable Memory — the on-chain publish check is not gated by the allowlist. See SPEC_CG_MEMORY_MODEL §2.5."]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"On-chain registration"}),o.jsxs("label",{className:"v10-form-radio",style:{display:"flex",alignItems:"flex-start",gap:8},children:[o.jsx("input",{type:"checkbox",checked:g,onChange:Q=>m(Q.target.checked),style:{marginTop:3}}),o.jsxs("span",{children:["Register on chain now (required for Verifiable Memory publishing)",o.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:4},children:"Off by default — the project is created locally and can be registered later from its Settings tab when your wallet is funded and a working RPC is configured."})]})]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Ontology"}),o.jsxs("div",{className:"v10-form-radio-group",children:[o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:y==="community",onChange:()=>b("community")}),"Choose a starter — install one of the bundled context-graph-type ontologies"]}),y==="community"&&o.jsxs("div",{style:{marginLeft:24,marginTop:4,marginBottom:8},children:[o.jsx("select",{className:"v10-form-select",value:j,onChange:Q=>N(Q.target.value),children:k.map(Q=>o.jsx("option",{value:Q.slug,children:Q.displayName},Q.slug))}),o.jsx("div",{style:{marginTop:6,fontSize:11,color:"var(--text-tertiary)"},children:(ye=k.find(Q=>Q.slug===j))==null?void 0:ye.description})]}),o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:y==="agent",onChange:()=>b("agent")}),"Let agent decide — defaults to the closest starter (v1)"]}),y==="agent"&&o.jsxs("div",{className:"v10-form-radio-desc",style:{marginLeft:24,marginTop:4,marginBottom:8},children:["v1 installs the ",o.jsx("code",{children:j})," starter as a sensible default. A future release will have the agent draft a context-graph-specific ontology by extending the closest starter from the context graph description."]}),o.jsxs("label",{className:"v10-form-radio",style:{opacity:.5},children:[o.jsx("input",{type:"radio",checked:y==="upload",onChange:()=>b("upload"),disabled:!0}),"Upload an ontology file (.ttl, .owl, .rdf) ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]})]})]}),o.jsxs("div",{className:"v10-form-advanced-toggle",onClick:()=>T(!S),children:[o.jsx("span",{className:`v10-form-adv-chevron ${S?"open":""}`,children:"▸"}),o.jsx("span",{children:"Advanced settings"})]}),S&&o.jsxs("div",{className:"v10-form-advanced-body",style:{opacity:.5,pointerEvents:"none"},children:[o.jsxs("div",{className:"v10-form-group",children:[o.jsxs("label",{className:"v10-form-label",children:["Consensus Quorum ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("select",{className:"v10-form-select",value:E,disabled:!0,children:[o.jsx("option",{value:"off",children:"Off — no consensus verification required"}),o.jsx("option",{value:"2of3",children:"2 of 3 — lightweight consensus"}),o.jsx("option",{value:"3of5",children:"3 of 5 — standard consensus (recommended for teams)"}),o.jsx("option",{value:"custom",children:"Custom — set your own M of N"})]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsxs("label",{className:"v10-form-label",children:["SWM TTL ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("select",{className:"v10-form-select",value:B,disabled:!0,children:[o.jsx("option",{value:"7d",children:"7 days (default)"}),o.jsx("option",{value:"1h",children:"1 hour"}),o.jsx("option",{value:"1d",children:"1 day"}),o.jsx("option",{value:"30d",children:"30 days"})]})]}),o.jsxs("div",{className:"v10-form-group",style:{marginBottom:0},children:[o.jsxs("label",{className:"v10-form-label",children:["SWM Size Cap ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("select",{className:"v10-form-select",value:z,disabled:!0,children:[o.jsx("option",{value:"100k",children:"100K triples (default)"}),o.jsx("option",{value:"10k",children:"10K triples"}),o.jsx("option",{value:"1m",children:"1M triples"})]})]})]})]}),o.jsxs("div",{className:"v10-modal-footer",children:[o.jsx("button",{className:"v10-modal-btn",onClick:t,children:"Cancel"}),ue&&o.jsx("button",{className:"v10-modal-btn",onClick:ft,disabled:O,children:O?"Retrying…":"Retry Loading Agent"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:$t,disabled:!n.trim()||!!o1(n)||M||!V||O,children:M?P||"Creating…":V?"Create Context Graph":ue?"Agent unavailable":"Loading agent…"})]})]})})}function KL(e){return e.alreadyMember===!0||e.autoApproved===!0||e.status==="approved"||e.status==="already-member"}const c1=/^(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|12D3Koo[1-9A-HJ-NP-Za-km-z]{45,53})$/;function YL(e){var b;const t=e.trim().replace(/\\n/g,`
1076
+ `),n=t.split(`
1077
+ `).map(k=>k.trim()).filter(Boolean),a=n[0]??"",s=n.slice(1).join(" ").trim(),l=t.match(/(?:^|\s)(\/(?:ip4|ip6|dns|dns4|dns6|dnsaddr)\/\S+)/),u=((b=l==null?void 0:l[1])==null?void 0:b.replace(/\s+/g,""))??null,d=s.replace(/\s+/g,""),f=d.startsWith("/")?d:u;let h=null;if(f){const k=f.match(/\/p2p\/([^/]+)$/);k&&c1.test(k[1])&&(h=k[1])}else for(const k of[s,...n.slice(1)]){const j=k.trim();if(c1.test(j)){h=j;break}}let g=a;u&&g.includes(u)&&(g=g.replace(u,"")),g=g.replace(/\s*@\s*$/,"").trim();const y=(n.length>1||s.length>0)&&h===null&&f===null;return{cgId:g,curatorPeerId:h,legacyMultiaddr:f,hasUnparsedExtra:y}}function QL(e){if(!e.cgId)return"Missing context graph ID";if(e.hasUnparsedExtra)return"Invite contains a second line that is not a valid peer ID (12D3Koo…) or multiaddr (/ip4/…). Check for typos.";if(!e.curatorPeerId&&!e.legacyMultiaddr)return"This invite is missing the curator peer id. Ask the curator to regenerate the invite from the Share Context Graph dialog.";if(e.legacyMultiaddr){if(!e.legacyMultiaddr.startsWith("/"))return"Invalid curator multiaddr";if(!e.legacyMultiaddr.includes("/p2p/"))return"Curator multiaddr is missing peer ID"}return null}function XL(e){if(e instanceof $n&&e.status===502){const t=JL(e.body);if(t.length===0)return"Request signed, but we couldn't deliver it to any reachable curator. Try again in a moment once your node has discovered more peers, or ask the curator for an updated invite.";const n=t.join("; "),a=t.some(e4),s=a?"Curator rejected this join request.":"Couldn't deliver this join request to the curator.",l=t4(n,a);return l?`${s} Reason: ${n}. ${l}`:`${s} Reason: ${n}.`}return e instanceof Error&&e.message?e.message:"Failed to send join request"}function JL(e){if(!e||typeof e!="object")return[];const t=e.errors;return Array.isArray(t)?t.filter(n=>typeof n=="string"&&n.length>0):[]}function e4(e){const t=e.replace(/^[^:]+:\s*/,"").trim();return!(!t||/^dial failed\b/i.test(t)||/^not curator$/i.test(t))}function t4(e,t){return t?/scope mismatch/i.test(e)?"This usually means your daemon's network config has a stale ContextGraphsHub address — pull the latest release (or `git pull && pnpm install && pnpm run build:runtime`) and try again.":/unknown CG/i.test(e)?"The curator doesn't recognise this context graph id — double-check the invite, or ask the curator to share an updated one.":null:/not curator/i.test(e)?"Your node reached other peers, but none of them curate this context graph. Make sure the curator's daemon is online and the invite carries the right curator peer id.":null}function n4({open:e,onClose:t,initialContextGraphId:n}){const[a,s]=w.useState(n??""),[l,u]=w.useState("idle"),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(null),[b,k]=w.useState(""),{contextGraphs:j,setContextGraphs:N,setActiveProject:S}=Ar(),{openTab:T}=fn();w.useEffect(()=>{n&&s(n)},[n]),w.useEffect(()=>{e||(s(n??""),f(null),u("idle"),g(null))},[e,n]);const E=w.useCallback(async Z=>{u("approved");try{const{contextGraphs:I}=await Ld();N(I??[]);const $=I==null?void 0:I.find(H=>H.id===Z);$&&(S($.id),T({id:`project:${$.id}`,label:$.name||$.id,closable:!0}),k($.name??Z),y(Z))}catch{}},[N,S,T]),A=w.useCallback(Z=>{var $;if(!(!h||Z.type!=="join_approved"&&Z.type!=="join_rejected"||(($=Z.data)==null?void 0:$.contextGraphId)!==h)){if(Z.type==="join_rejected"){u("rejected");return}E(h)}},[h,E]);is(A);const B=Ji(e&&!m,t),_=Ji(e&&!!m,()=>{y(null),k(""),t()});if(!e)return null;const z=async()=>{const Z=YL(a),I=QL(Z);if(I){f(I);return}const{cgId:$,curatorPeerId:H,legacyMultiaddr:V}=Z;f(null);const X=j.find(Y=>Y.id===$);if(X){S(X.id),T({id:`project:${X.id}`,label:X.name||X.id,closable:!0}),t();return}u("sending");try{H?await o_(H).catch(()=>{}):V&&(console.warn("[DKG] This invite uses a legacy multiaddr (deprecated). Ask the curator to regenerate using the current Share Context Graph modal — V10 invites carry a peer id and resolve via DHT, so they survive relay rotations."),await s_(V).catch(()=>{}));const Y=await f_($),L=await Yl().then(G=>G.name).catch(()=>{}),U=await h_($,{delegation:Y.delegation,agentName:L,curatorPeerId:H??void 0});if(g($),KL(U)){await E($);return}u("pending")}catch(Y){f(XL(Y)),u("idle")}};function q(){y(null),k(""),t()}if(m)return o.jsx("div",{className:"v10-modal-overlay",onClick:_.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:_.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-join-wire-title",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:q,"aria-label":"Close wire workspace dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsxs("div",{id:"dkg-join-wire-title",className:"v10-modal-title",children:["Wire workspace for ",b]}),o.jsx("div",{className:"v10-modal-subtitle",children:"Curator approved. Now wire a local workspace so this Cursor can collaborate on the context graph."})]}),o.jsx("div",{className:"v10-modal-body",children:o.jsx(WS,{contextGraphId:m,projectName:b,variant:"join",onDone:q})})]})});const M=l==="sending",R=l==="pending",P=l==="approved",F=l==="rejected";return o.jsx("div",{className:"v10-modal-overlay",onClick:B.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:B.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-join-cg-title","aria-describedby":"dkg-join-cg-subtitle",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close join context graph dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-join-cg-title",className:"v10-modal-title",children:"Join a Context Graph"}),o.jsx("div",{id:"dkg-join-cg-subtitle",className:"v10-modal-subtitle",children:"Paste the invite from the curator. Your node will send a signed join request and wait for approval."})]}),o.jsxs("div",{className:"v10-modal-body",children:[d&&o.jsx("div",{className:"v10-modal-error",children:d}),R&&o.jsx("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:16,fontSize:12,background:"rgba(59, 130, 246, 0.08)",border:"1px solid rgba(59, 130, 246, 0.25)",color:"var(--accent-primary, #3b82f6)"},children:"Join request sent. Waiting for the curator to approve — this modal will move forward automatically once they do."}),P&&o.jsx("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:16,fontSize:12,background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.25)",color:"var(--accent-green)"},children:"Approved! Loading context graph…"}),F&&o.jsx("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:16,fontSize:12,background:"rgba(245, 158, 11, 0.08)",border:"1px solid rgba(245, 158, 11, 0.25)",color:"var(--accent-warning, #f59e0b)"},children:"The curator declined this join request."}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-invite",children:"Invite Code"}),o.jsx("textarea",{id:"dkg-cg-invite",name:"dkg-cg-invite",className:"v10-form-textarea",placeholder:`Paste the invite code from the context graph curator.
1078
+
1079
+ e.g.
1080
+ my-context-graph-abc123
1081
+ 12D3KooW...`,value:a,onChange:Z=>s(Z.target.value),autoFocus:!0,rows:3,disabled:M||R||P,style:{fontFamily:"var(--font-mono)",fontSize:11},"aria-label":"Context graph invite code",autoComplete:"off",spellCheck:!1})]})]}),o.jsxs("div",{className:"v10-modal-footer",children:[o.jsx("button",{className:"v10-modal-btn",onClick:t,children:R||P?"Close":"Cancel"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:z,disabled:!a.trim()||M||R||P,children:M?"Sending request…":R?"Awaiting approval…":P?"Approved":"Request to Join"})]})]})})}const KS="v10:hiddenProjectIds",Tm="v10:hidden-projects-change";function _h(){try{const e=localStorage.getItem(KS);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t:[])}catch{return new Set}}function u1(e){try{localStorage.setItem(KS,JSON.stringify([...e])),window.dispatchEvent(new Event(Tm))}catch{}}function Bg(){const[e,t]=w.useState(()=>_h());w.useEffect(()=>{const s=()=>t(_h());return window.addEventListener(Tm,s),window.addEventListener("storage",s),()=>{window.removeEventListener(Tm,s),window.removeEventListener("storage",s)}},[]);const n=w.useCallback(s=>{const l=new Set(_h());l.add(s),u1(l)},[]),a=w.useCallback(()=>{u1(new Set)},[]);return{hidden:e,hide:n,unhideAll:a}}function Fg(e){return{agentDid:e.agentDid,peerId:e.peerId}}function uo(e){if(!(e!=null&&e.trim()))return"unknown";const t=e.trim().replace(/^["']|["']$/g,"").toLowerCase();return t==="private"?"private":t==="public"?"public":"unknown"}function Jt(e){let t=e.trim().replace(/^["']|["']$/g,"");t.startsWith("<")&&t.endsWith(">")&&(t=t.slice(1,-1));const n="did:dkg:agent:";if(t.length>=n.length&&t.slice(0,n.length).toLowerCase()===n.toLowerCase()){const s=t.slice(n.length),l=/^(0x[a-fA-F0-9]{40})$/i.exec(s);return l?`${n}${l[1].toLowerCase()}`:`${n}${s}`}return/^0x[a-fA-F0-9]{40}$/.exec(t)?`${n}${t.toLowerCase()}`:t.toLowerCase()}function $d(e,t){var n,a;return e.callerInvolved===!0?!0:e.callerInvolved===!1||!((n=t==null?void 0:t.agentDid)!=null&&n.trim())?!1:!!((a=e.curator)!=null&&a.trim()&&Jt(e.curator)===Jt(t.agentDid))}function r4(e,t,n){const a=e.filter(s=>$d(s,t));if(n&&!a.some(s=>s.id===n)){const s=e.find(l=>l.id===n);if(s)return[s,...a]}return a}function a4(e,t){return $d(e,t)||uo(e.accessPolicy)!=="public"?!1:e.subscribed===!0||e.synced===!0}function d1({cg:e,isActive:t,onSelect:n,onHide:a}){return o.jsx("div",{className:"v10-tree-section",children:o.jsxs("div",{className:`v10-tree-section-header ${t?"active":""}`,onClick:n,children:[o.jsx("span",{className:"v10-tree-project-dot"}),o.jsx("span",{className:"v10-tree-section-label",children:e.name||e.id.slice(0,16)}),o.jsx("button",{type:"button",className:"v10-tree-hide-btn",title:"Hide this context graph from the sidebar (reversible)",onClick:s=>{s.stopPropagation(),a()},children:"×"})]})})}function i4(e){switch(e){case"chat_ready":return"var(--accent-green, #22c55e)";case"connecting":return"var(--accent-yellow, #eab308)";case"degraded":case"bridge_offline":return"var(--accent-orange, #f97316)";case"available":case"coming_soon":default:return"var(--text-tertiary, #6b7280)"}}function s4(){const[e,t]=w.useState([]),[n,a]=w.useState(null),s=w.useCallback(()=>{Dd().then(l=>{t(l.integrations),a(null)}).catch(l=>a(l.message))},[]);return Xl(s,3e4),o.jsxs("div",{className:"v10-tree-items",style:{display:"block"},children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:.5,padding:"6px 12px 2px 24px"},children:"Agents"}),n&&o.jsx("div",{style:{fontSize:11,color:"var(--accent-orange, #f97316)",padding:"4px 12px 4px 24px"},children:n}),!n&&e.length===0&&o.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 12px 4px 24px",fontStyle:"italic"},children:"No agents detected."}),e.map(l=>o.jsxs("div",{className:"v10-tree-item",title:l.detail,style:{cursor:"default"},children:[o.jsx("span",{"aria-label":l.statusLabel,style:{width:7,height:7,borderRadius:"50%",background:i4(l.status),flexShrink:0}}),o.jsx("span",{className:"v10-tree-item-label",children:l.name}),o.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:4},children:l.statusLabel})]},l.id))]})}function o4(){const e=Vn($=>$.leftSectionMyProjectsOpen),t=Vn($=>$.leftSectionIntegrationsOpen),n=Vn($=>$.toggleLeftSectionMyProjects),a=Vn($=>$.toggleLeftSectionIntegrations),s=w.useId(),l=w.useId(),{openTab:u,activeTabId:d,setActiveTab:f}=fn(),{contextGraphs:h,setContextGraphs:g,setLoading:m,activeProjectId:y,setActiveProject:b}=Ar(),k=Ig($=>$.stage),[j,N]=w.useState("explorer"),{hidden:S,hide:T,unhideAll:E}=Bg(),A=zd().data,B=A?Fg(A):null,_=h.filter($=>!S.has($.id)),z=_.filter($=>$d($,B)),q=_.filter($=>a4($,B)),M=h.length-_.length,[R,P]=w.useState(!1),[F,Z]=w.useState(!1),I=w.useCallback(()=>{m(!0),An.fetchContextGraphs().then(({contextGraphs:$})=>g($??[])).catch(()=>{}).finally(()=>m(!1))},[g,m]);return Xl(I,6e4),is(w.useCallback($=>{($.type==="join_approved"||$.type==="project_synced")&&I()},[I])),o.jsxs("div",{className:"v10-panel-left",children:[o.jsxs("div",{style:{display:"flex",gap:4,padding:"8px 8px 4px"},children:[o.jsx("button",{className:"v10-new-project-btn",onClick:()=>P(!0),children:"+ New Context Graph"}),o.jsx("button",{className:"v10-new-project-btn",onClick:()=>Z(!0),children:"↗ Join Context Graph"})]}),o.jsxs("div",{className:"v10-tree-header",children:[o.jsx("button",{className:`v10-tree-mode-btn ${j==="explorer"?"active":""}`,onClick:()=>N("explorer"),children:"Context Graphs"}),o.jsx("button",{className:`v10-tree-mode-btn ${j==="oracle"?"active":""}`,onClick:()=>N("oracle"),children:"Context Oracle"})]}),j==="explorer"&&o.jsxs("div",{className:"v10-tree-content",children:[o.jsxs("div",{className:`v10-tree-dashboard ${d==="dashboard"?"active":""}`,onClick:()=>{f("dashboard"),b(null)},children:[o.jsx("span",{children:"▦"})," Dashboard"]}),h.length===0&&k<=1&&o.jsxs("div",{className:"v10-journey-empty-card",children:[o.jsx("div",{className:"v10-jec-title",children:"No context graphs yet"}),o.jsx("div",{className:"v10-jec-hint",children:k===0?"Connect an agent to get started.":"Create your first context graph to give your agent structured memory."}),k===1&&o.jsx("button",{className:"v10-new-project-btn",style:{margin:0},onClick:()=>P(!0),children:"+ Create First Context Graph"})]}),(h.length>0||k>=2)&&o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header","aria-expanded":e,"aria-controls":s,onClick:n,children:[o.jsx(Cm,{size:14,className:`v10-peer-group-chevron ${e?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:"My Context Graphs"})]}),e&&o.jsx("div",{id:s,className:"v10-peer-group-body",children:z.length===0?o.jsx("div",{className:"v10-tree-item",style:{cursor:"default",color:"var(--text-tertiary)",fontStyle:"italic"},children:o.jsx("span",{className:"v10-tree-item-label",children:"No context graphs in this view yet."})}):z.map($=>o.jsx(d1,{cg:$,isActive:y===$.id,onSelect:()=>{b($.id),u({id:`project:${$.id}`,label:$.name||$.id.slice(0,16),closable:!0})},onHide:()=>{T($.id),y===$.id&&b(null)}},$.id))})]}),M>0&&o.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:E,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",M," hidden context graph",M!==1?"s":""]}),k>=1&&o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header","aria-expanded":t,"aria-controls":l,onClick:a,children:[o.jsx(Cm,{size:14,className:`v10-peer-group-chevron ${t?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:"Integrations"})]}),t&&o.jsx("div",{id:l,className:"v10-peer-group-body",children:o.jsx(s4,{})})]})]}),j==="oracle"&&o.jsxs("div",{className:"v10-tree-content",children:[q.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-tree-group-label",children:"Context Oracle"}),q.map($=>o.jsx(d1,{cg:$,isActive:y===$.id,onSelect:()=>{b($.id),u({id:`project:${$.id}`,label:$.name||$.id.slice(0,16),closable:!0})},onHide:()=>{T($.id),y===$.id&&b(null)}},$.id))]}),q.length===0&&o.jsxs("p",{style:{fontSize:12,color:"var(--text-tertiary)",padding:"20px 12px",textAlign:"center",lineHeight:1.5},children:["No public catalogue entries yet. Context graphs you sync or curate appear under ",o.jsx("strong",{children:"Context Graphs"}),"; non-private graphs you discover but haven't joined list here — use ",o.jsx("strong",{children:"Join Context Graph"})," to subscribe."]}),M>0&&o.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:E,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",M," hidden context graph",M!==1?"s":""]})]}),o.jsx(ZL,{open:R,onClose:()=>P(!1)}),o.jsx(n4,{open:F,onClose:()=>Z(!1)})]})}function lr(e,t=[],n=0){const[a,s]=w.useState(null),[l,u]=w.useState(!0),[d,f]=w.useState(null),h=w.useRef(!0),g=w.useCallback(async()=>{try{const m=await e();h.current&&(s(m),f(null))}catch(m){if(h.current){if((m==null?void 0:m.status)===401){const y=!!window.__DKG_TOKEN__,b=sessionStorage.getItem("__dkg_401_reloaded")==="1";if(y&&!b){sessionStorage.setItem("__dkg_401_reloaded","1"),window.location.reload();return}f("Authentication expired — please refresh the page.");return}f(m.message)}}finally{h.current&&u(!1)}},t);return w.useEffect(()=>{h.current=!0,u(!0),g();let m=null;const y=()=>{n<=0||m||(m=setInterval(g,n))},b=()=>{m&&(clearInterval(m),m=null)},k=()=>{typeof document>"u"||(document.hidden?b():(g(),y()))};return(typeof document>"u"||!document.hidden)&&y(),typeof document<"u"&&document.addEventListener("visibilitychange",k),()=>{h.current=!1,b(),typeof document<"u"&&document.removeEventListener("visibilitychange",k)}},[g,n]),{data:a,loading:l,error:d,refresh:g}}function nV(e){return e==null?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(2)} GB`}function p1(e){if(e==null)return"—";if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;if(e<36e5)return`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`;const t=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4);return`${t}h ${n}m`}function l4(e,t=new Date){if(e==null||e==="")return"—";const n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return"—";if(n.toDateString()===t.toDateString())return n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"});const a=new Date(t);if(a.setDate(t.getDate()-1),n.toDateString()===a.toDateString())return`Yesterday ${n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`;const s=t.getTime()-n.getTime();return s>=0&&s<10080*60*1e3?`${n.toLocaleDateString(void 0,{weekday:"short"})} ${n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:n.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function f1(e,t=8){return e?e.length<=t*2?e:e.slice(0,t)+"..."+e.slice(-4):"—"}function c4(){const e=Ar(m=>m.contextGraphs),t=Ar(m=>m.setContextGraphs),{hidden:n}=Bg(),[a,s]=w.useState(null),[l,u]=w.useState(!0),[d,f]=w.useState(()=>e.length===0),h=w.useCallback(()=>{An.fetchContextGraphs().then(({contextGraphs:m})=>t(m??[])).catch(()=>{}).finally(()=>f(!1))},[t]);return w.useEffect(()=>{h();const m=setInterval(h,6e4);return()=>clearInterval(m)},[h]),is(w.useCallback(m=>{m.type!=="join_approved"&&m.type!=="join_rejected"&&m.type!=="project_synced"||h()},[h])),w.useEffect(()=>{let m=!0;return u(!0),An.fetchCurrentAgent().then(y=>{m&&s(Fg(y))}).catch(()=>{}).finally(()=>{m&&u(!1)}),()=>{m=!1}},[e]),{myCgs:w.useMemo(()=>e.filter(m=>!n.has(m.id)).filter(m=>$d(m,a)),[e,n,a]),identity:a,identityLoading:l,cgsLoading:d}}const Hg=["http://schema.org/name","http://www.w3.org/2000/01/rdf-schema#label","http://purl.org/dc/terms/title","http://purl.org/dc/elements/1.1/title","http://xmlns.com/foaf/0.1/name"];function Id(e={}){const t={predicates:[...e.extraPredicates??[],...Hg]};return e.minZoomForLabels!==void 0&&(t.minZoomForLabels=e.minZoomForLabels),t}function Pd(e){if(!e)return"";const t=e.match(/^"([\s\S]*)"(?:\^\^<[^>]+>)?(?:@[A-Za-z0-9-]+)?$/);if(!t)return e;try{return JSON.parse(`"${t[1]}"`)}catch{return t[1]}}const h1="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function Eu(e){if(e!=null)return typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function Yu(e){const t=bt(e);return!t||t.startsWith('"')||/\s/.test(t)?!1:t.startsWith("_:")?!0:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function bt(e){const t=e.trim();return t.startsWith('"')?t:t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function ro(e){if(!e)return"—";if(e.startsWith('"'))return Pd(e);const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),a=Math.max(t,n);return a>=0?e.slice(a+1):e}function qg(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),a=e.lastIndexOf(":"),s=Math.max(t,n,a),l=s>=0?e.slice(s+1):e;try{return decodeURIComponent(l)}catch{return l}}function u4(e){const t=qg(e).trim();return t?(/^[0-9a-f-]{16,}$/i.test(t)?t.replace(/-/g,"").slice(0,12):t).replace(/[_-]+/g," ").trim():""}function d4(e,t){return e===t&&/^urn:dkg:extraction:[^\s]+$/i.test(t)}function p4(e,t){return e===t&&Yu(t)}function f4(e){const t=u4(e.uri),n=e.types.map(ro).find(a=>a&&a!=="Thing"&&a!=="Entity");return/^urn:dkg:extraction:[^\s]+$/i.test(e.uri)?t?`Extraction ${t}`:"Extraction":n?t&&t!==n?`${n} ${t}`:n:t||ro(e.uri)}function h4(e){for(const n of Hg){const a=e.properties.get(n),s=a==null?void 0:a.find(l=>l.trim().length>0);if(s)return s}const t=ro(e.uri);return e.label&&(e.label!==t||!p4(e.label,e.uri))&&!d4(e.label,e.uri)?e.label:f4(e)}const YS=5e4,QS=2e4,XS=2e4;function m4(e){const t=`did:dkg:context-graph:${e}`;return`SELECT ?s ?p ?o ?g WHERE {
1082
+ GRAPH ?g { ?s ?p ?o }
1083
+ FILTER(
1084
+ STRSTARTS(STR(?g), "${t}/") &&
1085
+ (CONTAINS(STR(?g), "/assertion/") || CONTAINS(STR(?g), "/_working_memory/")) &&
1086
+ STR(?g) != "${t}/meta" &&
1087
+ !CONTAINS(STR(?g), "/meta/") &&
1088
+ !STRENDS(STR(?g), "/_meta")
1089
+ )
1090
+ } LIMIT ${YS}`}function g4(e){const t=`did:dkg:context-graph:${e}`;return`SELECT ?s ?p ?o ?g WHERE {
1091
+ GRAPH ?g { ?s ?p ?o }
1092
+ FILTER(
1093
+ STRSTARTS(STR(?g), "${t}") &&
1094
+ (STRENDS(STR(?g), "/_shared_memory") || CONTAINS(STR(?g), "/_shared_memory/")) &&
1095
+ STR(?g) != "${t}/meta/_shared_memory" &&
1096
+ !CONTAINS(STR(?g), "/meta/") &&
1097
+ !CONTAINS(STR(?g), "/_shared_memory/staging/") &&
1098
+ ?p != <http://dkg.io/ontology/workspaceOwner>
1099
+ )
1100
+ } LIMIT ${QS}`}function v4(e){const t=`did:dkg:context-graph:${e}`;return`SELECT ?s ?p ?o ?g WHERE {
1101
+ GRAPH ?g { ?s ?p ?o }
1102
+ FILTER(
1103
+ STRSTARTS(STR(?g), "${t}") &&
1104
+ !CONTAINS(STR(?g), "/assertion/") &&
1105
+ !CONTAINS(STR(?g), "/_working_memory") &&
1106
+ !CONTAINS(STR(?g), "/_shared_memory") &&
1107
+ !CONTAINS(STR(?g), "_verifiable_memory_meta") &&
1108
+ !STRENDS(STR(?g), "/_meta") &&
1109
+ STR(?g) != "${t}/meta" &&
1110
+ !CONTAINS(STR(?g), "/meta/") &&
1111
+ !CONTAINS(STR(?g), "/_private") &&
1112
+ !CONTAINS(STR(?g), "/_rules")
1113
+ )
1114
+ } LIMIT ${XS}`}function y4(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const a=e.slice(n.length),s=a.indexOf("/"),l=s>=0?a.slice(0,s):a;if(!(!l||l.startsWith("_")||l==="assertion"||l==="meta"))return l}const m1={wm:"loading",swm:"loading",vm:"loading"},b4={wm:"error",swm:"error",vm:"error"};async function Rh(e,t,n){var a,s;try{const{layerLimit:l,...u}=n??{},d={sparql:e,contextGraphId:t,...u},f=await ld(d),h=((a=f==null?void 0:f.result)==null?void 0:a.bindings)??((s=f==null?void 0:f.results)==null?void 0:s.bindings)??[],g=typeof l=="number"&&h.length>=l;return{triples:h.map(y=>{const b=Eu(y.g);return{subject:Eu(y.s)??"",predicate:Eu(y.p)??"",object:Eu(y.o)??"",subGraph:b?y4(b,t):void 0}}).filter(y=>y.subject&&y.predicate&&y.object),ok:!0,truncated:g}}catch{return{triples:[],ok:!1,truncated:!1}}}function x4(e){var f;const t=new Map,n=new Map,a=new Map,s=new Map,l=new Map;function u(h,g,m){let y=s.get(h);y||(y=new Map,s.set(h,y));let b=y.get(g);if(b||(b=new Set,y.set(g,b)),b.has(m))return!1;b.add(m);let k=l.get(h);return k||(k={working:0,shared:0,verified:0},l.set(h,k)),k[g]++,!0}function d(h){const g=bt(h);let m=t.get(g);return m||(m={uri:g,label:ro(g),types:[],trustLevel:"working",layers:new Set,subGraphs:new Set,properties:new Map,connections:[],tripleCount:0},t.set(g,m)),m}for(const h of e){const g=d(h.subject);if(g.layers.add(h.layer),h.subGraph&&g.subGraphs.add(h.subGraph),h.predicate===h1){const m=bt(h.object);g.types.includes(m)||g.types.push(m)}else if(Yu(h.object)){const m=bt(h.object),y=d(m);y.layers.add(h.layer),h.subGraph&&y.subGraphs.add(h.subGraph);const b=n.get(g.uri)??new Set,k=`${h.predicate}\0${m}`;b.has(k)||(b.add(k),n.set(g.uri,b),g.connections.push({predicate:h.predicate,targetUri:m,targetLabel:ro(m)}))}else{const m=a.get(g.uri)??new Set,y=`${h.predicate}\0${h.object}`;if(!m.has(y)){m.add(y),a.set(g.uri,m);const b=g.properties.get(h.predicate)??[];b.push(Pd(h.object)),g.properties.set(h.predicate,b)}}}for(const h of t.values())h.label=h4(h),h.layers.has("verified")?h.trustLevel="verified":h.layers.has("shared")?h.trustLevel="shared":h.trustLevel="working";for(const h of e){const g=bt(h.subject),m=t.get(g);if(m&&m.trustLevel!==h.layer)continue;const y=Yu(h.object)?bt(h.object):h.object,b=Yu(h.object);if(b){const j=t.get(y);if(j&&j.trustLevel!==h.layer)continue}const k=`${g}\0${h.predicate}\0${y}`;if(m&&u(m.uri,h.layer,k),h.predicate===h1){if(y!==g){const j=t.get(y);j&&u(j.uri,h.layer,k)}}else if(b&&y!==g){const j=t.get(y);j&&u(j.uri,h.layer,k)}}for(const h of t.values()){const g=l.get(h.uri);h.tripleCount=g?g[h.trustLevel]:0}for(const h of t.values())for(const g of h.connections)g.targetLabel=((f=t.get(g.targetUri))==null?void 0:f.label)??ro(g.targetUri);return t}const JS=x4;function ej(e){return e.types.length>0||e.properties.size>0||e.connections.length>0}function Gg(e,t){const n=(t==null?void 0:t.signalErrors)??!1,[a,s]=w.useState([]),[l,u]=w.useState(!0),[d,f]=w.useState(null),[h,g]=w.useState(!1),[m,y]=w.useState(m1),b=w.useRef(0),k=w.useCallback(async()=>{if(!e)return;const A=++b.current;u(!0),f(null),g(!1),y(m1);try{const B={includeContextGraphPartitions:!0},[_,z,q]=await Promise.all([Rh(m4(e),e,{...B,layerLimit:YS}),Rh(g4(e),e,{...B,layerLimit:QS}),Rh(v4(e),e,{...B,layerLimit:XS})]);if(A!==b.current)return;const M=[..._.triples.map(Z=>({...Z,layer:"working"})),...z.triples.map(Z=>({...Z,layer:"shared"})),...q.triples.map(Z=>({...Z,layer:"verified"}))];s(M),y({wm:_.ok?"ok":"error",swm:z.ok?"ok":"error",vm:q.ok?"ok":"error"});const R=[_,z,q],P=R.filter(Z=>!Z.ok).length,F=R.some(Z=>Z.truncated);g(P>0&&P<3||F),f(n&&P===3?"Failed to load memory data":null)}catch(B){A===b.current&&(f(B.message??"Failed to load memory data"),y(b4))}finally{A===b.current&&u(!1)}},[e,n]);xo(e,k),w.useEffect(()=>{k()},[k]);const j=w.useMemo(()=>JS(a),[a]),N=w.useMemo(()=>[...j.values()].filter(ej).sort((A,B)=>{const _={verified:0,shared:1,working:2},z=_[A.trustLevel]-_[B.trustLevel];if(z!==0)return z;const q=A.tripleCount??0,M=B.tripleCount??0;return M!==q?M-q:A.label.localeCompare(B.label)}),[j]),S=w.useMemo(()=>{const A=new Set;return a.filter(B=>{const _=`${B.subject}|${B.predicate}|${B.object}`;return A.has(_)?!1:(A.add(_),!0)}).map(({subject:B,predicate:_,object:z,subGraph:q})=>({subject:B,predicate:_,object:z,subGraph:q}))},[a]),T=w.useMemo(()=>{const A=new Map;for(const[B,_]of j)A.set(B,_.trustLevel);return A},[j]),E=w.useMemo(()=>{let A=0,B=0,_=0;for(const z of N)z.trustLevel==="verified"?_++:z.trustLevel==="shared"?B++:A++;return{wm:A,swm:B,vm:_,total:N.length}},[N]);return{entities:j,entityList:N,allTriples:a,graphTriples:S,trustMap:T,counts:E,loading:l,error:d,partial:h,layerStatus:m,refresh:k}}const Jl="http://dkg.io/viz/",tj=`${Jl}OnChainAnchor`,nj=`${Jl}AgentIdentity`,rj=`${Jl}anchoredIn`,aj=`${Jl}signedBy`,ij=`${Jl}consensus`,g1="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",v1="http://schema.org/name",y1="http://schema.org/description";function gl(e){if(e!=null)return typeof e=="string"?e.startsWith('"')?e.replace(/^"/,"").replace(/"(\^\^<[^>]*>)?$/,""):e:typeof e=="object"&&e!==null&&"value"in e?String(e.value):String(e)}function w4(e){const t=e.opId.slice(0,10);try{const a=new Date(e.publishedAt).toISOString().slice(11,16);return`anchor ${t} · ${a}UTC`}catch{return`anchor ${t}`}}function k4(e){if(e.startsWith("did:dkg:agent:")){const t=e.slice(14);return t.startsWith("0x")?t.slice(0,6)+"…"+t.slice(-4):t.slice(0,6)+"…"+t.slice(-6)}return e.length>18?e.slice(0,8)+"…"+e.slice(-6):e}function S4(e){return`PREFIX dkg: <http://dkg.io/ontology/>
1115
+ PREFIX prov: <http://www.w3.org/ns/prov#>
1116
+ SELECT ?op ?root ?agent ?publishedAt ?g WHERE {
1117
+ GRAPH ?g {
1118
+ ?op a dkg:WorkspaceOperation ;
1119
+ dkg:rootEntity ?root ;
1120
+ dkg:publishedAt ?publishedAt ;
1121
+ prov:wasAttributedTo ?agent .
1122
+ }
1123
+ FILTER(
1124
+ STRSTARTS(STR(?g), "${`did:dkg:context-graph:${e}/`}") &&
1125
+ CONTAINS(STR(?g), "_shared_memory_meta")
1126
+ )
1127
+ } ORDER BY ?publishedAt LIMIT 2000`}function j4(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const a=e.slice(n.length),s=a.indexOf("/");if(s<0)return;const l=a.slice(0,s);if(!(!l||l.startsWith("_")))return l}function C4(e){const t=e.lastIndexOf(":");return t>=0?e.slice(t+1):e}function N4(e,t){const n=[],a=new Set;for(const s of e){const l=t?s.roots.filter(d=>t.has(d)):s.roots;if(l.length===0)continue;const u=`urn:dkg:viz:anchor:${s.opId}`;n.push({subject:u,predicate:g1,object:tj,subGraph:s.subGraph}),n.push({subject:u,predicate:v1,object:`"${w4(s)}"`,subGraph:s.subGraph}),n.push({subject:u,predicate:y1,object:`"Published ${s.roots.length} KA${s.roots.length===1?"":"s"} · ${new Date(s.publishedAt).toISOString()}"`,subGraph:s.subGraph});for(const d of l)n.push({subject:d,predicate:rj,object:u,subGraph:s.subGraph}),n.push({subject:d,predicate:ij,object:`"${s.agents.length}-of-${s.agents.length}"`,subGraph:s.subGraph});for(const d of s.agents){const f=d.startsWith("did:")||d.startsWith("12D3")?d:`did:dkg:agent:${d}`,h=`urn:dkg:viz:agent:${encodeURIComponent(f)}`;n.push({subject:u,predicate:aj,object:h,subGraph:s.subGraph}),a.has(h)||(a.add(h),n.push({subject:h,predicate:g1,object:nj,subGraph:s.subGraph}),n.push({subject:h,predicate:v1,object:`"${k4(f)}"`,subGraph:s.subGraph}),n.push({subject:h,predicate:y1,object:`"${f}"`,subGraph:s.subGraph}))}}return n}function E4(e,t){const[n,a]=w.useState([]),[s,l]=w.useState(!1),[u,d]=w.useState(null),f=w.useRef(0);w.useEffect(()=>{if(!e){a([]),l(!1);return}const y=++f.current;l(!0),d(null),(async()=>{var b;try{const k=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify({sparql:S4(e)})});if(!k.ok)throw new Error(`SPARQL query failed: ${k.status}`);const j=await k.json(),N=((b=j==null?void 0:j.result)==null?void 0:b.bindings)??[],S=new Map;for(const T of N){const E=gl(T.op),A=gl(T.root),B=gl(T.agent),_=gl(T.publishedAt),z=gl(T.g);if(!E||!A||!B||!_)continue;let q=S.get(E);q||(q={opId:C4(E),opUri:E,agents:[],roots:[],publishedAt:_,subGraph:z?j4(z,e):void 0},S.set(E,q)),q.roots.includes(A)||q.roots.push(A),q.agents.includes(B)||q.agents.push(B)}if(y!==f.current)return;a([...S.values()].sort((T,E)=>E.publishedAt.localeCompare(T.publishedAt)))}catch(k){if(y!==f.current)return;d((k==null?void 0:k.message)??"Failed to load anchors"),a([])}finally{y===f.current&&l(!1)}})()},[e]);const h=w.useMemo(()=>{if(!t)return null;const y=[];if(t instanceof Set)for(const b of t)y.push(b);else for(const b of t)y.push(b);return y.sort(),y.join("|")},[t]),g=w.useMemo(()=>h==null?null:new Set(h.length===0?[]:h.split("|")),[h]),m=w.useMemo(()=>N4(n,g),[n,g]);return{anchors:n,decorationTriples:m,loading:s,error:u}}function T4(e){return e.activeSubGraph?!1:e.activeLayer==="swm"}const Yi={verified:"#22c55e",shared:"#f59e0b",working:"#64748b"},Vs={Person:{icon:"👤",group:"People"},SoftwareApplication:{icon:"💻",group:"Software"},SoftwareSourceCode:{icon:"📦",group:"Code"},Organization:{icon:"🏢",group:"Organizations"},Event:{icon:"📅",group:"Events"},ChooseAction:{icon:"⚡",group:"Decisions"},DefinedTerm:{icon:"📘",group:"Concepts"},CreativeWork:{icon:"📄",group:"Documents"},Product:{icon:"🪙",group:"Products"},ConversationTurn:{icon:"💬",group:"Conversations"},Thing:{icon:"◆",group:"Other"},Package:{icon:"📦",group:"Packages"},File:{icon:"📄",group:"Files"},Class:{icon:"🔷",group:"Classes"},Interface:{icon:"🔶",group:"Interfaces"},Function:{icon:"ƒ",group:"Functions"},TypeAlias:{icon:"🏷️",group:"Types"},Enum:{icon:"🔢",group:"Enums"},ExternalModule:{icon:"🌐",group:"External Modules"}},A4="http://www.w3.org/ns/prov#wasAttributedTo",wo="http://dkg.io/ontology/agent/",_4=wo+"createdBy",R4=wo+"promotedBy",O4=wo+"publishedBy",L4=wo+"createdAt",M4=wo+"promotedAt",D4=wo+"publishedAt";function Ud(e){for(const t of e.connections)if(t.predicate===A4)return t.targetUri;return null}function z4(e,t){const n=t==="created"?_4:t==="promoted"?R4:O4;for(const a of e.connections)if(a.predicate===n)return a.targetUri;return Ud(e)}function $4(e,t){const n=t==="created"?L4:t==="promoted"?M4:D4,a=e.properties.get(n);return(a==null?void 0:a[0])??null}function b1(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),a=Math.max(t,n);return a>=0?e.slice(a+1):e}function Ws(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),a=Math.max(t,n);return(a>=0?e.slice(a+1):e).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ")}function Bd(e,t){var s,l;if(t)for(const u of e.types){const d=t.forType(u),f=b1(u),h=d.label??f;if(d.icon||d.color||d.label)return{icon:d.icon??((s=Vs[f])==null?void 0:s.icon)??Vs.Thing.icon,group:d.label??((l=Vs[f])==null?void 0:l.group)??Vs.Thing.group,color:d.color,type:h}}const n=e.types[0]?b1(e.types[0]):"Entity";return{...Vs[n]??Vs.Thing,type:n}}const zn={wm:{icon:"◇",color:"#64748b",title:"Working Memory",desc:"Private agent scratchpad — ephemeral, fast local storage",trustLabel:"Working",trustLevel:"working"},swm:{icon:"◈",color:"#f59e0b",title:"Shared Working Memory",desc:"Team workspace — shared proposals, TTL-bounded",trustLabel:"Shared",trustLevel:"shared"},vm:{icon:"◉",color:"#22c55e",title:"Verifiable Memory",desc:"Endorsed, published, on-chain knowledge",trustLabel:"Verifiable",trustLevel:"verified"}};function ia(e,t=2){const n=e==="working"?"wm":e==="shared"?"swm":e==="verified"?"vm":e,a=t!==1;return n==="vm"?a?"Knowledge Assets":"Knowledge Asset":a?"Entities":"Entity"}const Gn="http://dkg.io/ontology/code/",sj={[Gn+"Package"]:"#a855f7",[Gn+"File"]:"#3b82f6",[Gn+"Class"]:"#22c55e",[Gn+"Interface"]:"#06b6d4",[Gn+"Function"]:"#f59e0b",[Gn+"TypeAlias"]:"#ec4899",[Gn+"Enum"]:"#ef4444",[Gn+"ExternalModule"]:"#64748b",[tj]:"#f5a524",[nj]:"#c084fc"},oj={[Gn+"imports"]:"#60a5fa",[Gn+"contains"]:"#a855f7",[Gn+"definedIn"]:"#3b82f6",[Gn+"exports"]:"#f59e0b",[Gn+"extends"]:"#22c55e",[Gn+"implements"]:"#06b6d4",[rj]:"#f5a524",[aj]:"#c084fc",[ij]:"#22c55e"};function Vg(e){return{"https://schema.org/":e,"http://www.w3.org/ns/prov#":e,"http://xmlns.com/foaf/0.1/":e,"http://purl.org/dc/terms/":e}}function I4(e,t){const{color:n}=zn[e],a=e==="vm";return{labelMode:"humanized",renderer:"2d",labels:Id({minZoomForLabels:a?.2:.3}),style:{classColors:sj,predicateColors:oj,namespaceColors:Vg(n),...t&&Object.keys(t).length>0?{nodeColors:t}:{},defaultNodeColor:n,defaultEdgeColor:a?"#4ade80":"#64748b",edgeWidth:a?1.8:1.2,fontSize:a?12:11,gradient:!0,gradientIntensity:a?.65:.4},hexagon:{baseSize:a?13:11,minSize:a?8:7,maxSize:a?42:28,scaleWithDegree:!0},focus:{maxNodes:3e3,hops:999}}}function P4(e){const t=["http://schema.org/description","http://schema.org/text"];for(const n of t){const a=e.properties.get(n);if(a!=null&&a[0])return a[0]}return null}function U4(e,t,n=2){const a=d=>bt(d.subject),s=d=>bt(d.object),l=new Set([e]);let u=new Set([e]);for(let d=0;d<n;d++){const f=new Set;for(const h of t){const g=a(h),m=s(h);u.has(g)&&!l.has(m)&&f.add(m),u.has(m)&&!l.has(g)&&f.add(g)}for(const h of f)l.add(h);if(u=f,u.size===0)break}return t.filter(d=>l.has(a(d))&&l.has(s(d)))}function lj(e,t){const n=t.lastIndexOf("/"),a=t.lastIndexOf("#"),s=t.lastIndexOf(":"),l=Math.max(n,a,s),u=l>=0?t.slice(l+1):t,d=(()=>{try{return decodeURIComponent(u)}catch{return u}})();if(/^urn:dkg:extraction:[^\s]+$/i.test(t)){const f=d.replace(/-/g,"").replace(/_+/g," ").slice(0,12).trim();return f?`Extraction ${f}`:"Extraction"}return d||t}function Wg(e){const t=e.trim();return!t||t.startsWith('"')?!1:t.startsWith("_:")||t.startsWith("<")&&t.endsWith(">")?!0:/\s/.test(t)?!1:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function Am(e,t){return!t.isRoot&&e.subGraph===t.slug?!0:e.subGraph?!1:t.scopedUris.has(e.subject)?!0:t.requireResourceObject?Wg(e.object)&&t.scopedUris.has(e.object):t.scopedUris.has(e.object)}function cj(e,t){const n=t.get(bt(e.subject));return n!==void 0&&n.trustLevel!==e.layer}function uj(e,t){if(!Wg(e.object))return!1;const n=t.get(bt(e.object));return n!==void 0&&n.trustLevel!==e.layer}function dj(e,t){return cj(e,t)||uj(e,t)}function pj(e,t){return cj(e,t)&&uj(e,t)}function _m(e,t){const n=new Set,a=[];for(const s of e){if(pj(s,t))continue;const l=`${bt(s.subject)}|${s.predicate}|${bt(s.object)}`;n.has(l)||(n.add(l),a.push(s))}return a}function Zg(e){return w.useMemo(()=>{const t=_m(e.allTriples,e.entities);return{triples:t,total:t.length}},[e.allTriples,e.entities])}function fj(e){return w.useMemo(()=>{const t=new Set,n=new Set,a=new Set,s=new Set;let l=0,u=0,d=0,f=0;for(const h of e.allTriples){const g=`${bt(h.subject)}|${h.predicate}|${bt(h.object)}`;!pj(h,e.entities)&&!s.has(g)&&(s.add(g),f++),dj(h,e.entities)||(h.layer==="working"&&!t.has(g)?(t.add(g),l++):h.layer==="shared"&&!n.has(g)?(n.add(g),u++):h.layer==="verified"&&!a.has(g)&&(a.add(g),d++))}return{wm:l,swm:u,vm:d,canonical:f}},[e.allTriples,e.entities])}function B4(e,t){const n=zn[t].trustLevel;return w.useMemo(()=>{const a=new Set,s=[];for(const l of e.allTriples){if(l.layer!==n||dj(l,e.entities))continue;const u=`${bt(l.subject)}|${l.predicate}|${bt(l.object)}`;a.has(u)||(a.add(u),s.push(l))}return s},[e.allTriples,e.entities,n])}const F4="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function H4(e){const t=e.trim();return(t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t)===F4}function hd(e,t,n){const a=[],s=n==null?void 0:n.focalSubjects;for(const l of e){const u=bt(l.subject);!t.has(u)&&!(s!=null&&s.has(u))||Wg(l.object)&&!H4(l.predicate)&&!t.has(bt(l.object))||a.push(l)}return a}const Oh="http://dkg.io/ontology/sourceContentType",x1="http://dkg.io/ontology/markdownForm",w1="http://dkg.io/ontology/sourceFile",k1="http://dkg.io/ontology/size";function q4(e){const t=e.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),n=new Date(t);return Number.isFinite(n.getTime())?n.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):t}function G4(e){const[t,n]=e.split("-"),a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=Math.max(0,Math.min(11,parseInt(n,10)-1));return`${a[s]} ${t}`}function Qu(e,t){const n=e.properties.get(t),a=n==null?void 0:n[0];if(!a)return null;const s=a.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),l=Date.parse(s);return Number.isNaN(l)?null:l}function V4(e){const t=Date.now()-e;if(t<0)return"just now";const n=Math.floor(t/1e3);if(n<45)return"just now";const a=Math.floor(n/60);if(a<60)return`${a}m ago`;const s=Math.floor(a/60);if(s<24)return`${s}h ago`;const l=Math.floor(s/24);return l<30?`${l}d ago`:new Date(e).toISOString().slice(0,10)}function W4(e,t=6){if(e==null||e==="")return"—";const n=typeof e=="number"?e:parseFloat(String(e));if(!Number.isFinite(n))return"—";if(n===0)return"0";const s=n.toFixed(t).replace(/\.?0+$/,"");return n>0&&Number(s)===0?`< ${1/Math.pow(10,t)}`:s}function Z4(e){if(!(e==null||e===""))return`Exact balance: ${e} (full precision from chain)`}function K4(e){if(e==null)return"—";const t=e/100;return`${t%1===0?t.toFixed(0):t.toFixed(1)}%`}function Y4(){US();const e=wg(l=>{var u;return(u=l.nodeStatus)==null?void 0:u.nodeRole}),t=fn(l=>l.openTab),{covered:n,bestCoveringDiscountBps:a,walletsInconclusive:s}=PS();return o.jsxs("div",{className:"v10-ws-pca",children:[o.jsx("span",{className:"v10-ws-pca-label",children:"Publishing discount"}),o.jsx("span",{className:"v10-ws-pca-value","data-covered":n,children:s?"Couldn’t verify your wallets — retry":n?`${K4(a)} discount`:"None — publishing at the direct cost"}),o.jsxs("button",{type:"button",className:"v10-ws-pca-cta",onClick:()=>t({id:"conviction",label:"Publisher Conviction",closable:!0}),children:[e==="edge"?"Get added to a PCA":"Set up PCA"," ->"]})]})}const Q4="Context graphs you created or joined — scoped knowledge domains with configurable access (private, curated and peer-shared, or public) where agents build and collaborate on shared context with verifiable provenance.",Rm=[{key:"wm",label:"Working Memory",short:"WM",color:"var(--layer-working)",desc:"Private agent drafts — free, self-attested, persists locally."},{key:"swm",label:"Shared Working Memory",short:"SWM",color:"var(--layer-shared)",desc:"Team proposals — free, gossip-replicated across context-graph peers."},{key:"vm",label:"Verifiable Memory",short:"VM",color:"var(--layer-verified)",desc:"On-chain knowledge — permanent, verifiable, requires TRAC to publish."}],Tu={1:"Ethereum",8453:"Base",84532:"Base Sepolia",100:"Gnosis",10200:"Chiado",2043:"NeuroWeb",20430:"NeuroWeb Testnet"};function Lh(e){var s;const t=FS(e);if(e==null)return{name:"Unknown chain",gas:t};const n=String(e);if(Tu[n])return{name:Tu[n],gas:t};const a=(s=n.match(/(\d+)\s*$/))==null?void 0:s[1];return a&&Tu[a]?{name:Tu[a],gas:t}:{name:a?`Chain ${a}`:`Chain ${n}`,gas:t}}function vl(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(e<1e4?1:0)}k`.replace(".0",""):`${(e/1e6).toFixed(1)}M`.replace(".0","")}function Mh({label:e,value:t,sub:n,accentColor:a,children:s,icon:l,className:u}){return o.jsxs("div",{className:`stat-card v10-anim-mount${u?` ${u}`:""}`,children:[a&&o.jsx("div",{className:"accent",style:{background:a}}),o.jsxs("div",{className:"stat-label",children:[l,e]}),t!=null&&t!==""&&o.jsx("div",{className:"stat-value",children:t}),s,n!=null&&n!==""&&o.jsx("div",{className:"stat-sub",children:n})]})}function S1({counts:e}){const t=e.wm+e.swm+e.vm,n=Rm.map(a=>`${a.short} ${e[a.key]}`).join(" · ");return o.jsx("div",{className:"v10-layerbar","aria-label":n,children:t===0?o.jsx("span",{className:"v10-layerbar-empty"}):Rm.map(a=>{const s=e[a.key]/t*100;return s<=0?null:o.jsx("span",{className:"v10-layerbar-seg",title:`${a.label} (${e[a.key]}) — ${a.desc}`,style:{width:`${s}%`,background:a.color}},a.key)})})}function X4(){return o.jsx("div",{className:"v10-layer-legend",children:Rm.map(e=>o.jsxs("span",{className:"v10-layer-legend-item",title:`${e.label} — ${e.desc}`,children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:e.color}}),e.short]},e.key))})}function J4({curator:e,joined:t,refreshing:n}){const a=e+t,s=`Curator ${e} · Joined ${t}`,l="var(--accent-green)",u="var(--text-secondary)";return o.jsxs("div",{className:`v10-cg-rolesplit${n?" is-refreshing":""}`,title:n?"Refreshing — agent identity is being re-checked":void 0,"aria-busy":n||void 0,children:[o.jsx("div",{className:"v10-layerbar","aria-label":s,children:a===0?o.jsx("span",{className:"v10-layerbar-empty"}):o.jsxs(o.Fragment,{children:[e>0&&o.jsx("span",{className:"v10-layerbar-seg",title:`Curator (${e}) — context graphs you created and curate`,style:{width:`${e/a*100}%`,background:l}}),t>0&&o.jsx("span",{className:"v10-layerbar-seg",title:`Joined (${t}) — context graphs you joined as a member`,style:{width:`${t/a*100}%`,background:u}})]})}),o.jsxs("div",{className:"v10-layer-legend",children:[o.jsxs("span",{className:"v10-layer-legend-item",title:"Curator — context graphs you created and curate",children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:l}}),"Curator ",e]}),o.jsxs("span",{className:"v10-layer-legend-item",title:"Joined — context graphs you joined as a member",children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:u}}),"Joined ",t]})]})]})}function eM({cg:e,identity:t,onReport:n,onOpen:a}){var z,q;const s=Gg(e.id,{signalErrors:!0}),[l,u]=w.useState(null),[d,f]=w.useState(!1),h=l===null&&!d,g=w.useRef(!0),m=w.useRef(0),y=w.useCallback(()=>{const M=++m.current;An.listParticipants(e.id).then(R=>{g.current&&M===m.current&&(u((R.allowedAgents??[]).map(Jt)),f(!1))}).catch(()=>{g.current&&M===m.current&&(u(null),f(!0))})},[e.id]);w.useEffect(()=>{g.current=!0,u(null),f(!1),y();const M=setInterval(y,3e4);return()=>{g.current=!1,clearInterval(M)}},[y]),is(w.useCallback(M=>{var P,F;if(M.type!=="join_approved"&&M.type!=="join_rejected"&&M.type!=="project_synced")return;const R=((P=M.data)==null?void 0:P.contextGraphId)??((F=M.data)==null?void 0:F.projectId);R&&R!==e.id||y()},[e.id,y]));const b=uo(e.accessPolicy)==="public",k=w.useMemo(()=>{var F;if(b)return null;const M=(F=e.curator)==null?void 0:F.trim(),R=M?Jt(M):null;if(l===null)return d&&R?[R]:null;const P=new Set(l);return R&&P.add(R),[...P]},[l,d,e.curator,b]),j=Number.isFinite(e.assetCount??e.assets)?e.assetCount??e.assets:0,N=w.useMemo(()=>{if(s.error)return{wm:0,swm:0,vm:0,total:j};const M=new Set(s.allTriples.map(R=>R.subject)).size;return{wm:s.counts.wm,swm:s.counts.swm,vm:s.counts.vm,total:M}},[s.error,s.allTriples,s.counts.wm,s.counts.swm,s.counts.vm,j]),S=fj(s),T=w.useMemo(()=>({wm:S.wm,swm:S.swm,vm:S.vm,total:S.canonical}),[S]),E=[s.loading?1:0,s.error?1:0,s.partial?1:0,h?1:0,d?1:0,b?1:0,N.wm,N.swm,N.vm,N.total,T.wm,T.swm,T.vm,T.total,k?k.slice().sort().join(","):"∅"].join("|");w.useEffect(()=>{n(e.id,{entities:N,triples:T,agents:k??[],sizeLoading:s.loading,sizeError:!!s.error||s.partial,sizeFallback:!!s.error,agentsLoading:h,agentsError:d,agentsUnknown:b,sig:E})},[e.id,E]);const A=uo(e.accessPolicy),B=A==="private"?"Curated":A==="public"?"Public":"Unknown",_=!!((z=e.curator)!=null&&z.trim()&&((q=t==null?void 0:t.agentDid)!=null&&q.trim())&&Jt(e.curator)===Jt(t.agentDid));return o.jsxs("button",{className:"v10-cg-row",onClick:()=>a(e),children:[o.jsx("span",{className:"v10-cg-cell v10-cg-name",children:e.name||e.id.slice(0,16)}),o.jsx("span",{className:"v10-cg-cell v10-cg-type",title:`${B} context graph`,"aria-label":`${B} context graph`,children:A==="private"?o.jsx(bO,{size:13,"aria-hidden":"true"}):A==="public"?o.jsx(mO,{size:13,"aria-hidden":"true"}):o.jsx("span",{className:"v10-cg-dim",children:"—"})}),o.jsx("span",{className:"v10-cg-cell v10-cg-size",children:s.loading?o.jsx("span",{className:"v10-stat-loading",children:"loading…"}):s.error?o.jsxs("span",{title:"Live entity count unavailable — showing the published Knowledge-Asset summary, not the full WM/SWM/VM entity total",children:[vl(N.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"KA (summary)"})," · ",o.jsx("span",{className:"v10-cg-dim",children:"— triples"})]}):s.partial?o.jsxs("span",{title:"Partial — one or more memory layers were unavailable; counts are a lower bound",children:["~",vl(N.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ~",vl(T.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"triples"})]}):o.jsxs(o.Fragment,{children:[vl(N.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ",vl(T.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"triples"})]})}),o.jsx("span",{className:"v10-cg-cell v10-cg-agents",children:k===null?o.jsx("span",{className:"v10-cg-dim",children:"—"}):d?o.jsxs("span",{title:"Participant list unavailable — curator-only lower bound",children:["~",k.length]}):k.length}),o.jsx("span",{className:"v10-cg-cell v10-cg-role",children:o.jsx("span",{className:`v10-cg-badge v10-cg-badge-${_?"curator":"joined"}`,children:_?"CURATOR":"JOINED"})})]})}const j1={wm:0,swm:0,vm:0,total:0};function tM(){var _,z;const{data:e}=lr(An.fetchStatus,[],1e4),{data:t}=lr(An.fetchEconomics,[],6e4),{data:n,loading:a,error:s}=lr(An.fetchWalletsBalances,[],3e4),{openTab:l}=fn(),{setActiveProject:u}=Ar(),{myCgs:d,identity:f,identityLoading:h,cgsLoading:g}=c4(),m=(h||g)&&d.length===0,[y,b]=w.useState({}),k=w.useCallback((q,M)=>{b(R=>{var P;return((P=R[q])==null?void 0:P.sig)===M.sig?R:{...R,[q]:M}})},[]);w.useEffect(()=>{const q=new Set(d.map(M=>M.id));b(M=>{const R=Object.keys(M);if(R.every(F=>q.has(F)))return M;const P={};for(const F of R)q.has(F)&&(P[F]=M[F]);return P})},[d]);const j=w.useMemo(()=>{const q={...j1},M={...j1},R=new Set;let P=!1,F=!1,Z=!1,I=!1,$=!1;for(const V of d){const X=y[V.id];if(!X){P=!0,F=!0;continue}X.sizeLoading&&(P=!0),X.agentsLoading&&(F=!0),X.sizeError&&(Z=!0),X.sizeFallback&&($=!0),(X.agentsError||X.agentsUnknown)&&(I=!0);for(const Y of["wm","swm","vm","total"])q[Y]+=X.entities[Y],M[Y]+=X.triples[Y];for(const Y of X.agents)R.add(Y)}const H=d.length>0;return{entities:q,triples:M,agentCount:R.size,sizeLoading:H&&P,agentsLoading:H&&F,sizePartial:Z,agentsPartial:I,triplesUnknown:H&&Z&&M.total===0,sizeApprox:H&&$,hasCgs:H}},[d,y]),N=w.useMemo(()=>{var P,F;const q=(P=f==null?void 0:f.agentDid)!=null&&P.trim()?Jt(f.agentDid):null;let M=0,R=0;for(const Z of d)!!(q&&((F=Z.curator)!=null&&F.trim())&&Jt(Z.curator)===q)?M++:R++;return{curator:M,joined:R}},[d,f]),S=[{label:"24h",display:"Last 24h"},{label:"7d",display:"Last 7d"},{label:"30d",display:"Last 30d"}],T=q=>{if(q==null||typeof q=="string"&&q.trim()==="")return"—";const M=Number(q);return isFinite(M)?M.toLocaleString(void 0,{maximumFractionDigits:M>=1e3?0:2}):String(q)},E=S.map(q=>{var R;const M=(R=t==null?void 0:t.periods)==null?void 0:R.find(P=>P.label===q.label);return{display:q.display,publishes:M?String(M.publishCount):"—",trac:M?T(M.totalTrac):"—"}});n!=null&&n.symbol;const A=(n==null?void 0:n.balances)??[],B=q=>q.length>12?`${q.slice(0,6)}…${q.slice(-4)}`:q;return o.jsxs("div",{className:"v10-dashboard",children:[o.jsxs("div",{className:"v10-dash-header",children:[o.jsx("h1",{className:"v10-dash-title",children:"Dashboard"}),o.jsxs("p",{className:"v10-dash-subtitle",children:[(e==null?void 0:e.name)||"DKG Node"," · ",(e==null?void 0:e.networkName)||"network",(n==null?void 0:n.chainId)!=null?` · ${Lh(n.chainId).name}`:""]})]}),o.jsxs("div",{className:"v10-dash-stats v10-dash-stats-3",children:[o.jsx(Mh,{label:"My Context Graphs",className:"v10-stat-tight",icon:o.jsx(Yx,{size:13,"aria-hidden":!0}),value:m?o.jsx("span",{className:"v10-stat-loading",children:"loading…"}):d.length,accentColor:"var(--accent-blue)",sub:Q4,children:j.hasCgs&&!m?o.jsx(J4,{curator:N.curator,joined:N.joined,refreshing:h}):null}),o.jsxs(Mh,{label:"Context Graph Size",icon:o.jsx(NO,{size:13,"aria-hidden":!0}),className:"v10-stat-tight",accentColor:"var(--accent-green)",children:[j.hasCgs?j.sizeLoading?o.jsx("div",{className:"v10-stat-loading",children:"loading…"}):o.jsxs("div",{className:"v10-cg-size-detail",children:[o.jsxs("div",{className:"v10-cg-size-metric",children:[o.jsxs("div",{className:"v10-cg-size-num",children:[o.jsxs("span",{className:"v10-cg-size-big",children:[j.sizeApprox&&!j.triplesUnknown?"~":"",j.entities.total.toLocaleString()]}),j.triplesUnknown?o.jsx("span",{className:"v10-cg-dim",title:"Live entity count unavailable — showing the published Knowledge-Asset summary (not the full WM/SWM/VM entity total)",children:"Knowledge Assets (summary)"}):j.sizeApprox?o.jsx("span",{className:"v10-cg-dim",title:"Some context graphs reported only their Knowledge-Asset summary — this total mixes summary and live counts and is approximate",children:"entities / KA · approx."}):o.jsx("span",{className:"v10-cg-dim",children:"entities / Knowledge Assets"})]}),j.triplesUnknown||j.sizeApprox?null:o.jsx(S1,{counts:j.entities})]}),o.jsxs("div",{className:"v10-cg-size-metric",children:[o.jsxs("div",{className:"v10-cg-size-num",children:[o.jsx("span",{className:"v10-cg-size-big",children:j.triplesUnknown?"—":`${j.sizeApprox?"~":""}${j.triples.total.toLocaleString()}`}),o.jsx("span",{className:"v10-cg-dim",children:"triples"})]}),j.triplesUnknown||j.sizeApprox?null:o.jsx(S1,{counts:j.triples})]}),o.jsx(X4,{})]}):o.jsx("div",{className:"v10-stat-empty",children:"—"}),o.jsx("div",{className:"stat-sub",children:j.hasCgs?j.sizePartial?"Some context graphs could not report size; total is partial.":"Totals across all your context graphs, summed over Working, Shared Working & Verifiable Memory. Knowledge Assets are entities that have been published to Verifiable Memory.":"No context graphs yet."})]}),o.jsx(Mh,{label:"Collaborating Agents",icon:o.jsx(_O,{size:13,"aria-hidden":!0}),value:j.hasCgs?j.agentsLoading?o.jsx("span",{className:"v10-stat-loading",children:"loading…"}):j.agentsPartial?`~${j.agentCount}`:j.agentCount:o.jsx("span",{className:"v10-stat-empty",children:"—"}),sub:j.hasCgs?j.agentsPartial?"Some context graphs could not report agents; count is partial.":"Unique agents — your own and others' — allow-listed and collaborating across your context graphs.":"No context graphs yet.",accentColor:"var(--purple)"})]}),o.jsxs("div",{className:"v10-dash-grid v10-dash-grid-2",children:[o.jsxs("div",{className:"v10-dash-section v10-dash-section-wide v10-anim-mount",children:[o.jsxs("div",{className:"v10-dash-section-header",children:[o.jsxs("div",{className:"v10-dash-section-title",children:[o.jsx(Yx,{size:13,"aria-hidden":!0}),o.jsx("h3",{children:"My Context Graphs"})]}),o.jsx("span",{className:"v10-dash-section-badge",children:d.length})]}),m?o.jsx("p",{className:"v10-cg-empty",children:"Loading context graphs…"}):d.length===0?o.jsx("p",{className:"v10-cg-empty",children:"No context graphs yet — create or join one from the sidebar."}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-cg-colhead",children:[o.jsx("span",{className:"v10-cg-cell v10-cg-name",children:"Name"}),o.jsx("span",{className:"v10-cg-cell v10-cg-type",children:"Type"}),o.jsx("span",{className:"v10-cg-cell v10-cg-size",children:"Size"}),o.jsx("span",{className:"v10-cg-cell v10-cg-agents",title:"Agents allow-listed with access to this context graph",children:"Agents"}),o.jsx("span",{className:"v10-cg-cell v10-cg-role",children:"Role"})]}),o.jsx("div",{className:"v10-cg-list",children:d.map(q=>o.jsx(eM,{cg:q,identity:f,onReport:k,onOpen:M=>{u(M.id),l({id:`project:${M.id}`,label:M.name||M.id.slice(0,12),closable:!0})}},q.id))})]})]}),o.jsxs("div",{className:"v10-dash-section v10-anim-mount",children:[o.jsx("div",{className:"v10-dash-section-header",children:o.jsxs("div",{className:"v10-dash-section-title",children:[o.jsx(OO,{size:13,"aria-hidden":!0}),o.jsx("h3",{children:"Wallets and Spending"})]})}),(n==null?void 0:n.chainId)!=null?o.jsxs("div",{className:"v10-ws-chain-row",children:[o.jsx("span",{className:"v10-ws-chain-label",children:"Chain"}),o.jsx("span",{className:"v10-ws-chain-value",children:Lh(n.chainId).name})]}):null,o.jsx("div",{className:"v10-ws-subhead",children:"Node wallets"}),a&&!n?o.jsx("p",{className:"v10-cg-empty",children:"Loading wallets…"}):A.length>0?o.jsxs("div",{className:"v10-ws-wtable",children:[o.jsxs("div",{className:"v10-ws-wrow v10-ws-whead",children:[o.jsx("span",{children:"Wallet"}),o.jsx("span",{children:"TRAC"}),o.jsxs("span",{children:["Gas (",Lh(n==null?void 0:n.chainId).gas,")"]})]}),A.map(q=>o.jsxs("div",{className:"v10-ws-wrow",children:[o.jsx("span",{className:"v10-ws-addr",title:q.address,children:B(q.address)}),o.jsx("span",{className:"v10-ws-bal",children:T(q.trac)}),o.jsx("span",{className:"v10-ws-bal-sec",title:Z4(q.eth),children:W4(q.eth)})]},q.address))]}):(((_=n==null?void 0:n.wallets)==null?void 0:_.length)??0)>0?o.jsx("ul",{className:"v10-ws-wallets",children:((n==null?void 0:n.wallets)??[]).map(q=>o.jsxs("li",{className:"v10-ws-wallet",children:[o.jsx("span",{className:"v10-ws-addr",title:q,children:B(q)}),o.jsx("span",{className:"v10-cg-dim",children:"—"})]},q))}):n!=null&&n.error||s?o.jsx("p",{className:"v10-cg-empty",children:"Wallet balances unavailable."}):o.jsx("p",{className:"v10-cg-empty",children:"No node wallets found."}),(n!=null&&n.error||s)&&(A.length>0||(((z=n==null?void 0:n.wallets)==null?void 0:z.length)??0)>0)?o.jsx("p",{className:"v10-ws-note",children:"Balances may be stale — the chain/RPC reported an error."}):null,o.jsx("div",{className:"v10-ws-subhead",children:"Spending"}),o.jsxs("div",{className:"v10-ws-spend",children:[o.jsxs("div",{className:"v10-ws-spend-head",children:[o.jsx("span",{children:"Period"}),o.jsx("span",{title:"Publishes to Verifiable Memory that spent TRAC on-chain. Free SWM/local/testnet publishes are not counted (they don't burn TRAC).",children:"Publishes to VM"}),o.jsx("span",{children:"TRAC"})]}),E.map(q=>o.jsxs("div",{className:"v10-ws-spend-row",children:[o.jsx("span",{className:"v10-cg-dim",children:q.display}),o.jsx("span",{className:"v10-ws-spend-val",children:q.publishes}),o.jsx("span",{className:"v10-ws-spend-val",children:q.trac})]},q.display))]}),o.jsx(Y4,{})]})]})]})}const nM=new Set(["meta"]),$r="__root__";function Kg(e){return!nM.has(e.name)}const rM=".md, .docx, .pdf, .txt, .csv, .json, .ttl, .rdf, .owl, .py, .ts, .js, .tsx, .jsx, .java, .go, .rs, .c, .cpp, .html, .xml, .yaml, .yml";function C1(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function aM(e){var n;const t=((n=e.split(".").pop())==null?void 0:n.toLowerCase())??"";return["md","txt"].includes(t)?"📝":["pdf"].includes(t)?"📕":["docx","doc"].includes(t)?"📄":["csv","json","xml","yaml","yml"].includes(t)?"📊":["ttl","rdf","owl"].includes(t)?"🔗":["py","ts","js","tsx","jsx","java","go","rs","c","cpp"].includes(t)?"💻":["png","jpg","jpeg","webp"].includes(t)?"🖼️":"📄"}function iM({open:e,onClose:t,contextGraphId:n,contextGraphName:a}){var X;const[s,l]=w.useState([]),[u,d]=w.useState(!0),[f,h]=w.useState(!0),[g,m]=w.useState("idle"),[y,b]=w.useState(0),[k,j]=w.useState([]),[N,S]=w.useState(null),[T,E]=w.useState(!1),A=w.useRef(null),B=w.useCallback(Y=>{const L=Array.from(Y);l(U=>{const G=new Set(U.map(ne=>`${ne.file.name}:${ne.file.size}`)),O=L.filter(ne=>!G.has(`${ne.name}:${ne.size}`));return[...U,...O.map(ne=>({file:ne,id:`${ne.name}-${ne.size}-${Date.now()}`}))]})},[]),_=Y=>{l(L=>L.filter(U=>U.id!==Y))},z=Y=>{Y.preventDefault(),Y.stopPropagation(),E(!0)},q=Y=>{Y.preventDefault(),Y.stopPropagation(),E(!1)},M=Y=>{Y.preventDefault(),Y.stopPropagation(),E(!1),Y.dataTransfer.files.length>0&&B(Y.dataTransfer.files)},R=async()=>{if(s.length===0)return;m("uploading"),b(0),j([]),S(null);const Y=[];for(let U=0;U<s.length;U++){b(U);const{file:G}=s[U],O=G.name.replace(/[^a-zA-Z0-9._-]/g,"_"),ne=`${Date.now().toString(36)}-${U}-${O}`;try{const ue=await AS(ne,n,G),le=ue.extraction.tripleCount??ue.extraction.triplesWritten;Y.push({fileName:G.name,status:ue.extraction.status==="completed"?"success":ue.extraction.status==="skipped"?"skipped":"error",triplesWritten:le,error:ue.extraction.error})}catch(ue){Y.push({fileName:G.name,status:"error",error:(ue==null?void 0:ue.message)??"Upload failed"})}}j(Y),b(s.length);const L=Y.some(U=>U.status==="error");m(L?"error":"done")},P=()=>{g!=="uploading"&&(l([]),j([]),m("idle"),S(null),b(0),t())},{dialogRef:F,onBackdropClick:Z}=Ji(e,P);if(!e)return null;const I=k.reduce((Y,L)=>Y+(L.triplesWritten??0),0),$=k.filter(Y=>Y.status==="success").length,H=k.filter(Y=>Y.status==="skipped").length,V=k.filter(Y=>Y.status==="error").length;return o.jsx("div",{className:"v10-modal-overlay",onClick:Z,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:F,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-import-modal-title",children:[o.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{id:"dkg-import-modal-title",className:"v10-modal-title",children:"Import to Working Memory"}),o.jsx("div",{className:"v10-modal-subtitle",children:a?o.jsxs(o.Fragment,{children:["Upload files to ",o.jsx("strong",{children:a})," — your agent will extract structured knowledge."]}):o.jsx(o.Fragment,{children:"Upload files — your agent will extract structured knowledge and add it to working memory."})})]}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:P,disabled:g==="uploading","aria-label":"Close import dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:g==="uploading"?"not-allowed":"pointer"},children:"×"})]}),o.jsxs("div",{className:"v10-modal-body",children:[N&&o.jsx("div",{className:"v10-modal-error",children:N}),g==="idle"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`v10-import-dropzone ${T?"drag-over":""}`,onClick:()=>{var Y;return(Y=A.current)==null?void 0:Y.click()},onDragOver:z,onDragLeave:q,onDrop:M,children:[o.jsx("div",{className:"v10-import-dropzone-label",children:"Drag files here, or click to browse"}),o.jsx("div",{className:"v10-import-dropzone-hint",style:{marginTop:4},children:"Your agent will extract structured knowledge and add it to working memory."}),o.jsxs("div",{className:"v10-import-dropzone-hint",style:{marginTop:8},children:["Supported: ",rM]}),o.jsx("input",{ref:A,type:"file",multiple:!0,style:{display:"none"},onChange:Y=>{Y.target.files&&B(Y.target.files),Y.target.value=""}})]}),s.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-import-file-list",children:s.map(Y=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:aM(Y.file.name)}),o.jsx("span",{className:"v10-import-file-name",children:Y.file.name}),o.jsx("span",{className:"v10-import-file-size",children:C1(Y.file.size)}),o.jsx("button",{className:"v10-import-file-remove",onClick:()=>_(Y.id),title:"Remove",children:"×"})]},Y.id))}),o.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginBottom:12},children:[s.length," file",s.length!==1?"s":""," selected · ",C1(s.reduce((Y,L)=>Y+L.file.size,0))," total"]})]}),o.jsx("div",{className:"v10-form-divider"}),o.jsxs("div",{className:"v10-form-label",style:{marginBottom:8},children:["Ingestion Options ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("label",{className:"v10-import-option",style:{opacity:.5,pointerEvents:"none"},children:[o.jsx("input",{type:"checkbox",checked:f,disabled:!0,readOnly:!0}),"Store original files as Knowledge Assets"]}),o.jsxs("label",{className:"v10-import-option",style:{opacity:.5,pointerEvents:"none"},children:[o.jsx("input",{type:"checkbox",checked:u,disabled:!0,readOnly:!0}),"Let agent extract structured knowledge from content"]})]}),g==="uploading"&&o.jsxs("div",{className:"v10-import-progress",children:[o.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)",fontWeight:500},children:["Importing files… (",y+1," of ",s.length,")"]}),o.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:4},children:((X=s[y])==null?void 0:X.file.name)??"…"}),o.jsx("div",{className:"v10-import-progress-bar",children:o.jsx("div",{className:"v10-import-progress-fill",style:{width:`${(y+.5)/s.length*100}%`}})}),o.jsxs("div",{className:"v10-import-progress-text",children:[y," of ",s.length," files processed"]})]}),(g==="done"||g==="error")&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`v10-import-result ${V>0?"error":"success"}`,"data-testid":"import-result","data-import-status":V>0?"error":"success","data-import-triples":I,children:V===0?o.jsxs(o.Fragment,{children:[$>0&&o.jsxs(o.Fragment,{children:["Successfully imported ",$," file",$!==1?"s":"",".",I>0&&o.jsxs(o.Fragment,{children:[" Extracted ",o.jsx("strong",{children:I.toLocaleString()})," triples into working memory."]})]}),H>0&&o.jsxs(o.Fragment,{children:[$>0?" ":"","Stored ",H," file",H!==1?"s":""," as source — no structured knowledge was extracted yet (extraction for these file types is coming soon)."]})]}):o.jsxs(o.Fragment,{children:[$," file",$!==1?"s":""," imported",H>0&&o.jsxs(o.Fragment,{children:[", ",H," stored without extraction"]}),", ",V," failed.",I>0&&o.jsxs(o.Fragment,{children:[" ",I.toLocaleString()," triples extracted."]})]})}),k.length>0&&o.jsx("div",{className:"v10-import-file-list",style:{marginTop:12},children:k.map((Y,L)=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:Y.status==="success"?"✓":Y.status==="skipped"?"–":"✗"}),o.jsx("span",{className:"v10-import-file-name",children:Y.fileName}),o.jsx("span",{className:"v10-import-file-size",style:Y.status==="error"?{color:"var(--text-danger)"}:void 0,children:Y.status==="success"&&Y.triplesWritten!=null?`${Y.triplesWritten} triples`:Y.status==="skipped"?"stored (no extraction)":Y.error??"failed"})]},L))})]})]}),o.jsxs("div",{className:"v10-modal-footer",children:[g==="idle"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"v10-modal-btn",onClick:P,children:"Cancel"}),o.jsxs("button",{className:"v10-modal-btn primary",onClick:R,disabled:s.length===0,children:["Start Import (",s.length," file",s.length!==1?"s":"",")"]})]}),g==="uploading"&&o.jsx("button",{className:"v10-modal-btn",disabled:!0,children:"Importing…"}),(g==="done"||g==="error")&&o.jsx("button",{className:"v10-modal-btn primary",onClick:P,children:"Done"})]})]})})}function sM(e){return e.length<=12?e:`${e.slice(0,6)}…${e.slice(-4)}`}function oM({open:e,onClose:t,contextGraphId:n,contextGraphName:a}){const[s,l]=w.useState(null),[u,d]=w.useState(null),[f,h]=w.useState([]),[g,m]=w.useState(null),[y,b]=w.useState([]),[k,j]=w.useState([]),[N,S]=w.useState(null),[T,E]=w.useState("allowlist");w.useEffect(()=>{e&&(fetch("/api/status",{headers:Ft()}).then(P=>P.json()).then(P=>{typeof(P==null?void 0:P.peerId)=="string"&&P.peerId.length>0&&d(P.peerId)}).catch(()=>{}),ES(n).then(P=>h(P.allowedAgents)).catch(()=>h([])),Cg().then(P=>{const F=(P.agents??[]).filter(Z=>Z.connectionStatus!=="self");b(F)}).catch(()=>b([])),TS(n).then(P=>j(P.requests)).catch(()=>j([])))},[e,n]);const{dialogRef:A,onBackdropClick:B}=Ji(e,t);if(!e)return null;const _=u?`${n}
1128
+ ${u}`:null,z=(P,F)=>{navigator.clipboard.writeText(P).then(()=>{l(F),setTimeout(()=>l(null),2e3)}).catch(()=>{})},q=async P=>{try{await p_(n,P),h(F=>F.filter(Z=>Z!==P))}catch{}},M=async P=>{S(P);try{await Ng(n,P),j(F=>F.filter(Z=>Z.agentAddress!==P)),h(F=>[...new Set([...F,P])])}catch(F){m((F==null?void 0:F.message)||"Failed to approve")}finally{S(null)}},R=async P=>{S(P);try{await Eg(n,P),j(F=>F.filter(Z=>Z.agentAddress!==P))}catch(F){m((F==null?void 0:F.message)||"Failed to reject")}finally{S(null)}};return o.jsx("div",{className:"v10-modal-overlay",onClick:B,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:A,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-share-modal-title",children:[o.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{id:"dkg-share-modal-title",className:"v10-modal-title",children:"Share Context Graph"}),o.jsxs("div",{className:"v10-modal-subtitle",children:["Invite agents to collaborate on ",o.jsx("strong",{children:a}),"."]})]}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close share dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:"pointer"},children:"×"})]}),o.jsxs("div",{className:"v10-modal-body",children:[o.jsxs("div",{style:{display:"flex",gap:0,marginBottom:16,borderBottom:"1px solid var(--border-default)"},children:[o.jsx("button",{onClick:()=>E("allowlist"),style:{padding:"8px 16px",fontSize:12,fontWeight:T==="allowlist"?600:400,background:"none",border:"none",cursor:"pointer",color:T==="allowlist"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:T==="allowlist"?"2px solid var(--accent-primary)":"2px solid transparent"},children:"Allowlist"}),o.jsxs("button",{onClick:()=>E("requests"),style:{padding:"8px 16px",fontSize:12,fontWeight:T==="requests"?600:400,background:"none",border:"none",cursor:"pointer",color:T==="requests"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:T==="requests"?"2px solid var(--accent-primary)":"2px solid transparent",position:"relative"},children:["Join Requests",k.length>0&&o.jsx("span",{style:{position:"absolute",top:4,right:4,background:"var(--accent-red, #ef4444)",color:"var(--text-on-accent)",borderRadius:999,fontSize:9,fontWeight:700,padding:"1px 5px",minWidth:16,textAlign:"center"},children:k.length})]})]}),T==="allowlist"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Allowed Agents"}),o.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:8},children:["Only agents on this list can read and write to the context graph. To add someone, share the Invite Code below — they'll send a signed join request you can approve in the ",o.jsx("strong",{children:"Join Requests"})," tab."]}),f.length>0&&o.jsx("div",{style:{marginBottom:8,display:"flex",flexDirection:"column",gap:4},children:f.map(P=>{const F=y.find(Z=>{var I;return((I=Z.agentAddress)==null?void 0:I.toLowerCase())===P.toLowerCase()});return o.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",borderRadius:6,fontSize:11,fontFamily:"var(--font-mono)",background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[o.jsx("span",{style:{color:"var(--text-primary)"},children:F?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{fontFamily:"var(--font-body)",fontWeight:500},children:F.name})," ",o.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:sM(P)})]}):P}),o.jsx("button",{onClick:()=>q(P),style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",fontSize:12,padding:"0 4px"},title:"Remove agent",children:"×"})]},P)})}),f.length===0&&o.jsx("div",{style:{padding:"8px 12px",borderRadius:6,fontSize:11,color:"var(--text-tertiary)",background:"var(--bg-surface)",border:"1px dashed var(--border-default)",marginBottom:8},children:"No agents on allowlist — context graph is open to anyone who subscribes."})]}),o.jsx("div",{className:"v10-form-divider"}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Invite Code"}),_===null?o.jsx("div",{style:{padding:"8px 12px",borderRadius:6,fontSize:11,color:"var(--text-tertiary)",background:"var(--bg-surface)",border:"1px dashed var(--border-default)"},children:"Loading peer ID…"}):o.jsxs("div",{style:{position:"relative"},children:[o.jsx("pre",{style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:6,padding:"10px 12px",fontSize:11,lineHeight:1.6,fontFamily:"var(--font-mono)",color:"var(--text-primary)",overflow:"auto",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-all"},children:_}),o.jsx("button",{className:"v10-modal-btn primary",onClick:()=>z(_,"invite"),style:{position:"absolute",top:6,right:6,fontSize:10,padding:"4px 10px",height:26,cursor:"pointer"},children:s==="invite"?"Copied":"Copy Invite"})]})]})]}),T==="requests"&&o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Pending Join Requests"}),o.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:8},children:"Agents who submitted a signed request to join this context graph. Approve to add them to the allowlist."}),k.length===0&&o.jsx("div",{style:{padding:"16px 12px",borderRadius:6,fontSize:11,textAlign:"center",color:"var(--text-tertiary)",background:"var(--bg-surface)",border:"1px dashed var(--border-default)"},children:"No pending join requests."}),k.map(P=>o.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 10px",borderRadius:6,fontSize:11,background:"var(--bg-surface)",border:"1px solid var(--border-default)",marginBottom:4},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[P.name&&o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:500},children:P.name}),o.jsx("span",{style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",fontSize:10},children:P.agentAddress}),o.jsxs("span",{style:{fontSize:9,color:"var(--text-tertiary)"},children:["Requested ",new Date(P.timestamp).toLocaleString()]})]}),o.jsxs("div",{style:{display:"flex",gap:6},children:[o.jsx("button",{onClick:()=>M(P.agentAddress),disabled:N===P.agentAddress,style:{background:"rgba(34, 197, 94, 0.15)",color:"var(--text-success)",border:"1px solid rgba(34, 197, 94, 0.3)",cursor:"pointer",borderRadius:4,fontSize:10,padding:"4px 10px",fontWeight:600},children:N===P.agentAddress?"…":"Approve"}),o.jsx("button",{onClick:()=>R(P.agentAddress),disabled:N===P.agentAddress,style:{background:"rgba(239, 68, 68, 0.1)",color:"var(--text-danger)",border:"1px solid rgba(239, 68, 68, 0.2)",cursor:"pointer",borderRadius:4,fontSize:10,padding:"4px 10px",fontWeight:600},children:"Reject"})]})]},P.agentAddress)),g&&o.jsx("div",{style:{fontSize:10,color:"var(--text-danger)",marginTop:4},children:g})]})]}),o.jsx("div",{className:"v10-modal-footer",children:o.jsx("button",{className:"v10-modal-btn",onClick:t,children:"Done"})})]})})}async function Hi(e,t){var a;const n=await or(e,t);return((a=n==null?void 0:n.result)==null?void 0:a.bindings)??[]}const qi={displayName:"Project",primaryColor:"#a855f7",accentColor:"#22c55e"},lM=e=>({slug:e,displayName:e,icon:"•",color:"#64748b",rank:99}),cM={slug:$r,displayName:"Root",description:"Entities not in any subgraph (Context Graph root)",icon:"⊘",rank:99},uM=e=>({typeIri:e,label:e.split(/[/#]/).pop()||e,color:"#64748b"}),ss="http://dkg.io/ontology/profile/";function hj(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function at(e){const t=hj(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
1129
+ `).replace(/\\\\/g,"\\"):t}function Om(e){const t=at(e),n=parseInt(t,10);return Number.isFinite(n)?n:0}function os(e){return`FILTER(strstarts(str(?g), "${`did:dkg:context-graph:${e}/meta`.replace(/"/g,'\\"')}"))`}function dM(e){return`PREFIX prof: <${ss}>
1130
+ PREFIX schema: <http://schema.org/>
1131
+ SELECT ?profile ?name ?description ?primary ?accent
1132
+ WHERE {
1133
+ GRAPH ?g {
1134
+ ?profile a prof:Profile .
1135
+ OPTIONAL { ?profile prof:displayName ?name }
1136
+ OPTIONAL { ?profile schema:description ?description }
1137
+ OPTIONAL { ?profile prof:primaryColor ?primary }
1138
+ OPTIONAL { ?profile prof:accentColor ?accent }
1139
+ }
1140
+ ${os(e)}
1141
+ } LIMIT 1`}function pM(e){return`PREFIX prof: <${ss}>
1142
+ PREFIX schema: <http://schema.org/>
1143
+ SELECT ?slug ?displayName ?description ?icon ?color ?rank ?timelinePredicate ?sourceAssertion
1144
+ WHERE {
1145
+ GRAPH ?g {
1146
+ ?b a prof:SubGraphBinding ;
1147
+ prof:forSubGraph ?slug .
1148
+ OPTIONAL { ?b prof:displayName ?displayName }
1149
+ OPTIONAL { ?b schema:description ?description }
1150
+ OPTIONAL { ?b prof:icon ?icon }
1151
+ OPTIONAL { ?b prof:color ?color }
1152
+ OPTIONAL { ?b prof:rank ?rank }
1153
+ OPTIONAL { ?b prof:timelinePredicate ?timelinePredicate }
1154
+ OPTIONAL { ?b prof:sourceAssertion ?sourceAssertion }
1155
+ }
1156
+ ${os(e)}
1157
+ }`}function fM(e){return`PREFIX prof: <${ss}>
1158
+ SELECT ?chip ?subGraph ?type ?predicate ?label
1159
+ (GROUP_CONCAT(DISTINCT ?v; separator="|") AS ?values)
1160
+ WHERE {
1161
+ GRAPH ?g {
1162
+ ?chip a prof:FilterChip ;
1163
+ prof:forSubGraph ?subGraph ;
1164
+ prof:forType ?type ;
1165
+ prof:onPredicate ?predicate ;
1166
+ prof:chipValue ?v .
1167
+ OPTIONAL { ?chip prof:label ?label }
1168
+ }
1169
+ ${os(e)}
1170
+ }
1171
+ GROUP BY ?chip ?subGraph ?type ?predicate ?label`}function hM(e){return`PREFIX prof: <${ss}>
1172
+ PREFIX schema: <http://schema.org/>
1173
+ SELECT ?catalog ?subGraph ?name ?description ?rank
1174
+ WHERE {
1175
+ GRAPH ?g {
1176
+ ?catalog a prof:QueryCatalog ;
1177
+ prof:forSubGraph ?subGraph .
1178
+ OPTIONAL { ?catalog prof:displayName ?name }
1179
+ OPTIONAL { ?catalog schema:description ?description }
1180
+ OPTIONAL { ?catalog prof:rank ?rank }
1181
+ }
1182
+ ${os(e)}
1183
+ }`}function mM(e){return`PREFIX prof: <${ss}>
1184
+ PREFIX schema: <http://schema.org/>
1185
+ SELECT ?q ?subGraph ?catalog ?name ?description ?sparql ?column ?rank
1186
+ WHERE {
1187
+ GRAPH ?g {
1188
+ ?q a prof:SavedQuery ;
1189
+ prof:forSubGraph ?subGraph ;
1190
+ prof:sparqlQuery ?sparql .
1191
+ OPTIONAL { ?q prof:inCatalog ?catalog }
1192
+ OPTIONAL { ?q prof:displayName ?name }
1193
+ OPTIONAL { ?q schema:description ?description }
1194
+ OPTIONAL { ?q prof:resultColumn ?column }
1195
+ OPTIONAL { ?q prof:rank ?rank }
1196
+ }
1197
+ ${os(e)}
1198
+ }`}function gM(e,t){const n=new Map;for(const f of e){const h=zr(f.catalog);if(!h)continue;const g=h.split(":catalog:").pop()??h;n.set(h,{slug:g,subGraph:at(f.subGraph),name:at(f.name)||g,description:at(f.description)||void 0,rank:Om(f.rank)||99,queries:[]})}const a=t.map(f=>{const h=zr(f.q),g=h.split(":query:").pop()??h,m=at(f.subGraph),y=zr(f.catalog),b=y?n.get(y):void 0,k=`default:${m}`;return{slug:g,subGraph:m,catalogSlug:(b==null?void 0:b.slug)??k,catalogName:(b==null?void 0:b.name)??"Queries",catalogDescription:b==null?void 0:b.description,catalogRank:(b==null?void 0:b.rank)??999,name:at(f.name)||g,description:at(f.description)||void 0,sparql:at(f.sparql),resultColumn:at(f.column)||"",rank:Om(f.rank)||99}}).filter(f=>f.subGraph&&f.sparql).sort((f,h)=>f.subGraph.localeCompare(h.subGraph)||f.catalogRank-h.catalogRank||f.catalogName.localeCompare(h.catalogName)||f.rank-h.rank||f.name.localeCompare(h.name)),s=new Map;for(const f of n.values())s.set(`${f.subGraph}|${f.slug}`,{...f,queries:[]});for(const f of a){const h=`${f.subGraph}|${f.catalogSlug}`,g=s.get(h);if(g){g.queries.push(f);continue}s.set(h,{slug:f.catalogSlug,subGraph:f.subGraph,name:f.catalogName,description:f.catalogDescription,rank:f.catalogRank,queries:[f]})}const l=Array.from(s.values()).filter(f=>f.queries.length>0).map(f=>({...f,queries:[...f.queries].sort((h,g)=>h.rank-g.rank||h.name.localeCompare(g.name))})).sort((f,h)=>f.subGraph.localeCompare(h.subGraph)||f.rank-h.rank||f.name.localeCompare(h.name)),u=new Map,d=new Map;for(const f of l){const h=u.get(f.subGraph)??[];h.push(f),u.set(f.subGraph,h);const g=d.get(f.subGraph)??[];g.push(...f.queries),d.set(f.subGraph,g)}return{queryCatalogs:l,savedQueries:a,catalogsBySubGraph:u,queriesBySubGraph:d}}function vM(e){return`PREFIX prof: <${ss}>
1199
+ SELECT ?type ?label ?icon ?color ?detailHint
1200
+ ?promoteLabel ?promoteHint ?publishLabel ?publishHint
1201
+ WHERE {
1202
+ GRAPH ?g {
1203
+ ?b a prof:EntityTypeBinding ;
1204
+ prof:forType ?type .
1205
+ OPTIONAL { ?b prof:label ?label }
1206
+ OPTIONAL { ?b prof:icon ?icon }
1207
+ OPTIONAL { ?b prof:color ?color }
1208
+ OPTIONAL { ?b prof:detailHint ?detailHint }
1209
+ OPTIONAL { ?b prof:promoteLabel ?promoteLabel }
1210
+ OPTIONAL { ?b prof:promoteHint ?promoteHint }
1211
+ OPTIONAL { ?b prof:publishLabel ?publishLabel }
1212
+ OPTIONAL { ?b prof:publishHint ?publishHint }
1213
+ }
1214
+ ${os(e)}
1215
+ }`}function yM(e){return`PREFIX prof: <${ss}>
1216
+ PREFIX schema: <http://schema.org/>
1217
+ SELECT ?view ?name ?description ?nodeSize
1218
+ (GROUP_CONCAT(DISTINCT ?incType; separator="|") AS ?includeTypes)
1219
+ (GROUP_CONCAT(DISTINCT ?empPred; separator="|") AS ?emphasizePredicates)
1220
+ WHERE {
1221
+ GRAPH ?g {
1222
+ ?view a prof:ViewConfig .
1223
+ OPTIONAL { ?view prof:displayName ?name }
1224
+ OPTIONAL { ?view schema:description ?description }
1225
+ OPTIONAL { ?view prof:nodeSize ?nodeSize }
1226
+ OPTIONAL { ?view prof:includeType ?incType }
1227
+ OPTIONAL { ?view prof:emphasizePredicate ?empPred }
1228
+ }
1229
+ ${os(e)}
1230
+ }
1231
+ GROUP BY ?view ?name ?description ?nodeSize`}function zr(e){const t=hj(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function bM(e){const[t,n]=w.useState(!0),[a,s]=w.useState(),[l,u]=w.useState(qi.displayName),[d,f]=w.useState(),[h,g]=w.useState(qi.primaryColor),[m,y]=w.useState(qi.accentColor),[b,k]=w.useState([]),[j,N]=w.useState([]),[S,T]=w.useState([]),[E,A]=w.useState([]),[B,_]=w.useState([]),[z,q]=w.useState([]),M=w.useRef(new Map),R=w.useRef(new Map),P=w.useRef(new Map),F=w.useRef(new Map),Z=w.useRef(new Map),I=w.useRef(new Map);w.useEffect(()=>{if(!e){n(!1);return}let U=!1;return(async()=>{n(!0),s(void 0);try{const[G,O,ne,ue,le,be,_e]=await Promise.all([Hi(dM(e),e).catch(()=>[]),Hi(pM(e),e).catch(()=>[]),Hi(vM(e),e).catch(()=>[]),Hi(yM(e),e).catch(()=>[]),Hi(fM(e),e).catch(()=>[]),Hi(hM(e),e).catch(()=>[]),Hi(mM(e),e).catch(()=>[])]);if(U)return;const Ee=e;if(G[0]){const ke=G[0];u(at(ke.name)||Ee),f(at(ke.description)||void 0),g(at(ke.primary)||qi.primaryColor),y(at(ke.accent)||qi.accentColor)}else u(Ee),f(void 0),g(qi.primaryColor),y(qi.accentColor);const Ie=O.map(ke=>({slug:at(ke.slug),displayName:at(ke.displayName)||at(ke.slug),description:at(ke.description)||void 0,icon:at(ke.icon)||void 0,color:at(ke.color)||void 0,rank:Om(ke.rank)||99,timelinePredicate:zr(ke.timelinePredicate)||void 0,sourceAssertion:at(ke.sourceAssertion)||void 0})).filter(ke=>ke.slug).sort((ke,lt)=>ke.rank-lt.rank);k(Ie),R.current=new Map(Ie.map(ke=>[ke.slug,ke]));const We=ne.map(ke=>({typeIri:zr(ke.type),label:at(ke.label)||void 0,icon:at(ke.icon)||void 0,color:at(ke.color)||void 0,detailHint:at(ke.detailHint)||void 0,promoteLabel:at(ke.promoteLabel)||void 0,promoteHint:at(ke.promoteHint)||void 0,publishLabel:at(ke.publishLabel)||void 0,publishHint:at(ke.publishHint)||void 0})).filter(ke=>ke.typeIri);N(We),M.current=new Map(We.map(ke=>[ke.typeIri,ke]));const Se=ue.map(ke=>{const lt=zr(ke.view),xe=lt.split(":view:").pop()??lt;return{slug:xe,name:at(ke.name)||xe,description:at(ke.description)||void 0,nodeSize:at(ke.nodeSize)||void 0,includeTypes:at(ke.includeTypes).split("|").map(Oe=>zr(Oe.trim())).filter(Boolean),emphasizePredicates:at(ke.emphasizePredicates).split("|").map(Oe=>zr(Oe.trim())).filter(Boolean)}});T(Se),P.current=new Map(Se.map(ke=>[ke.slug,ke]));const ft=le.map(ke=>{const lt=zr(ke.chip),xe=lt.split(":chip:").pop()??lt,Oe=at(ke.values).split("|").map(Ot=>at(Ot.trim())).filter(Boolean);return{slug:xe,subGraph:at(ke.subGraph),typeIri:zr(ke.type),predicate:zr(ke.predicate),label:at(ke.label)||"Filter",values:Oe}}).filter(ke=>ke.subGraph&&ke.predicate&&ke.values.length>0);A(ft);const De=new Map;for(const ke of ft){const lt=De.get(ke.subGraph)??[];lt.push(ke),De.set(ke.subGraph,lt)}F.current=De;const qe=gM(be,_e);_(qe.queryCatalogs),q(qe.savedQueries),Z.current=qe.catalogsBySubGraph,I.current=qe.queriesBySubGraph}catch(G){U||s((G==null?void 0:G.message)??String(G))}finally{U||n(!1)}})(),()=>{U=!0}},[e]);const $=w.useCallback(U=>U===$r?cM:R.current.get(U)??lM(U),[]),H=w.useCallback(U=>M.current.get(U)??uM(U),[]),V=w.useCallback(U=>P.current.get(U),[]),X=w.useCallback(U=>F.current.get(U)??[],[]),Y=w.useCallback(U=>Z.current.get(U)??[],[]),L=w.useCallback(U=>I.current.get(U)??[],[]);return{contextGraphId:e??"",displayName:l,description:d,primaryColor:h,accentColor:m,subGraphs:b,typeBindings:j,views:S,filterChips:E,queryCatalogs:B,savedQueries:z,loading:t,error:a,forSubGraph:$,forType:H,view:V,chipsFor:X,savedQueryCatalogsFor:Y,savedQueriesFor:L}}const mj=Ve.createContext(null);function Ua(){return w.useContext(mj)}const xM="http://dkg.io/ontology/agent/";function wM(e){return`FILTER(strstarts(str(?g), "${`did:dkg:context-graph:${e}/meta`.replace(/"/g,'\\"')}"))`}function kM(e){return`PREFIX ag: <${xM}>
1232
+ PREFIX schema: <http://schema.org/>
1233
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
1234
+ SELECT ?a ?kind ?name ?label ?fw ?op ?wallet ?peerId ?avatar ?reputation
1235
+ WHERE {
1236
+ GRAPH ?g {
1237
+ ?a a ag:Agent .
1238
+ OPTIONAL { ?a a ag:HumanAgent . BIND("human" AS ?kind) }
1239
+ OPTIONAL { ?a a ag:AIAgent . BIND("ai" AS ?kindAi) }
1240
+ OPTIONAL { ?a schema:name ?name }
1241
+ OPTIONAL { ?a rdfs:label ?label }
1242
+ OPTIONAL { ?a ag:framework ?fw }
1243
+ OPTIONAL { ?a ag:operator ?op }
1244
+ OPTIONAL { ?a ag:walletAddress ?wallet }
1245
+ OPTIONAL { ?a ag:peerId ?peerId }
1246
+ OPTIONAL { ?a ag:avatar ?avatar }
1247
+ OPTIONAL { ?a ag:reputation ?reputation }
1248
+ }
1249
+ ${wM(e)}
1250
+ }`}function gj(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function Qr(e){const t=gj(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
1251
+ `).replace(/\\\\/g,"\\"):t}function N1(e){const t=gj(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function SM(e){let t=0;for(let s=0;s<e.length;s++)t=t*31+e.charCodeAt(s)|0;return`hsl(${((t%360+360)%360+25)%360}, 55%, 58%)`}function jM(e){const t=new Map;for(const n of e){const a=N1(n.a);if(!a)continue;const s=t.get(a),l=Qr(n.kindAi)==="ai"||Qr(n.kind)==="ai"?"ai":Qr(n.kind)==="human"?"human":(s==null?void 0:s.kind)??"ai",u={uri:a,name:Qr(n.name)||Qr(n.label)||a.split(":").pop()||a,kind:l,framework:Qr(n.fw)||(s==null?void 0:s.framework),operatorUri:N1(n.op)||(s==null?void 0:s.operatorUri),walletAddress:Qr(n.wallet)||(s==null?void 0:s.walletAddress),peerId:Qr(n.peerId)||(s==null?void 0:s.peerId),avatar:Qr(n.avatar)||(s==null?void 0:s.avatar),reputation:Qr(n.reputation)||(s==null?void 0:s.reputation),color:SM(a)};u.kind==="human"&&!u.framework&&(u.framework="human"),t.set(a,u)}for(const n of t.values())if(n.operatorUri){const a=t.get(n.operatorUri);a&&(n.operatorName=a.name)}return t}function CM(e){const[t,n]=w.useState(()=>new Map),[a,s]=w.useState(!0),[l,u]=w.useState(),d=w.useRef(new Map);w.useEffect(()=>{if(!e){s(!1);return}let m=!1;return(async()=>{var y;s(!0),u(void 0);try{const b=await or(kM(e),e);if(m)return;const k=((y=b==null?void 0:b.result)==null?void 0:y.bindings)??[],j=jM(k);n(j),d.current=j}catch(b){m||u((b==null?void 0:b.message)??String(b))}finally{m||s(!1)}})(),()=>{m=!0}},[e]);const f=w.useCallback(m=>d.current.get(m),[]),h=Ve.useMemo(()=>[...t.values()].sort((m,y)=>m.name.localeCompare(y.name)),[t]),g=w.useCallback(m=>{},[]);return{agents:t,list:h,loading:a,error:l,get:f,openAgent:g}}const vj=Ve.createContext(null);function ls(){return w.useContext(vj)}const Lm=["#6366f1","#14b8a6","#f43f5e","#facc15","#8b5cf6","#10b981","#0ea5e9","#d946ef"],E1=1e4;function yl(e){if(e!=null)return typeof e=="string"?e.startsWith('"')?e.replace(/^"/,"").replace(/"(\^\^<[^>]*>)?$/,""):e:typeof e=="object"&&e!==null&&"value"in e?String(e.value):String(e)}function NM(e){if(e.startsWith("did:dkg:agent:")){const t=e.slice(14);return t.startsWith("0x")?t.slice(0,6)+"…"+t.slice(-4):t.slice(0,6)+"…"+t.slice(-6)}return e.length>18?e.slice(0,8)+"…"+e.slice(-6):e}function EM(e){return e.startsWith("did:")||e.startsWith("12D3")?e:/^0x[0-9a-fA-F]{40}$/.test(e)?`did:dkg:agent:${e}`:e}function TM(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const a=e.slice(n.length),s=a.indexOf("/");if(s<0)return;const l=a.slice(0,s);if(!(!l||l.startsWith("_")))return l}function AM(e){return`PREFIX dkg: <http://dkg.io/ontology/>
1252
+ PREFIX prov: <http://www.w3.org/ns/prov#>
1253
+ SELECT ?op ?root ?agent ?publishedAt ?g WHERE {
1254
+ GRAPH ?g {
1255
+ ?op a dkg:WorkspaceOperation ;
1256
+ dkg:rootEntity ?root ;
1257
+ dkg:publishedAt ?publishedAt ;
1258
+ prov:wasAttributedTo ?agent .
1259
+ }
1260
+ FILTER(
1261
+ STRSTARTS(STR(?g), "${`did:dkg:context-graph:${e}/`}") &&
1262
+ CONTAINS(STR(?g), "_shared_memory_meta")
1263
+ )
1264
+ } ORDER BY DESC(?publishedAt) LIMIT 5000`}function T1(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)%Lm.length}function yj(e){const[t,n]=w.useState(new Map),[a,s]=w.useState([]),[l,u]=w.useState([]),[d,f]=w.useState(null),[h,g]=w.useState(!1),[m,y]=w.useState(void 0),b=w.useRef(0);w.useEffect(()=>{if(!e){b.current+=1,n(new Map),s([]),u([]),g(!1),y(void 0);return}const S=++b.current,T=new AbortController;let E=!1,A;const B=()=>!E&&S===b.current;return g(!0),f(null),(async()=>{var _;try{const z=new Promise((H,V)=>{A=setTimeout(()=>{T.abort(),V(new Error(`SWM attribution query timed out after ${Math.round(E1/1e3)}s`))},E1)}),q=(async()=>{const H=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Ft()},signal:T.signal,body:JSON.stringify({sparql:AM(e)})});if(!H.ok)throw new Error(`SPARQL query failed: ${H.status}`);return H.json()})(),M=await Promise.race([q,z]),P=(((_=M==null?void 0:M.result)==null?void 0:_.bindings)??[]).slice().reverse(),F=new Map,Z=new Map,I=[];for(const H of P){const V=yl(H.op),X=yl(H.root),Y=yl(H.agent),L=yl(H.publishedAt),U=yl(H.g);if(!V||!X||!Y||!L)continue;const G=EM(Y),O=U?TM(U,e):void 0;I.push({opUri:V,rootUri:X,agent:G,publishedAt:L,subGraph:O});const ne={agent:G,opUri:V,publishedAt:L,subGraph:O},ue=F.get(X);ue?ue.some(be=>be.agent===G)||ue.push(ne):F.set(X,[ne]);let le=Z.get(G);le||(le=new Set,Z.set(G,le)),le.add(X)}const $=[...Z.entries()].map(([H,V])=>({agent:H,color:Lm[T1(H)],label:NM(H),entityCount:V.size})).sort((H,V)=>V.entityCount-H.entityCount);if(!B())return;n(F),s(I),u($),y(e)}catch(z){if(!B())return;f((z==null?void 0:z.message)??"Failed to load SWM attributions"),n(new Map),s([]),u([]),y(e)}finally{A&&clearTimeout(A),B()&&g(!1)}})(),()=>{E=!0,A&&clearTimeout(A),T.abort()}},[e]);const{nodeColors:k,conflicts:j}=w.useMemo(()=>{const S={},T=[];for(const[E,A]of t)A.length!==0&&(A.length===1?S[E]=Lm[T1(A[0].agent)]:(T.push(E),S[E]="#f59e0b"));return{nodeColors:S,conflicts:T}},[t]);return{resultContextGraphId:m,attributions:t,events:a,palette:l,nodeColors:k,conflicts:j,loading:!!(e&&(h||m!==e)),error:d}}function _M(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const s=e.slice(n.length).split("/");if(s[0]!=="assertion"&&s.length>=2&&s[1]==="assertion")return s[0]}const A1=1e4,Mm="http://dkg.io/ontology/";function RM(e){const t=`did:dkg:context-graph:${e}/_meta`;return`PREFIX dkg: <${Mm}>
1265
+ PREFIX prov: <http://www.w3.org/ns/prov#>
1266
+ SELECT ?event ?type ?assertion ?name ?agent ?ts ?subGraphName ?assertionGraph (COUNT(DISTINCT ?root) AS ?entityCount) (COUNT(DISTINCT ?subjRoot) AS ?subjectEntityCount) WHERE {
1267
+ GRAPH <${t}> {
1268
+ ?event a ?type ;
1269
+ prov:startedAtTime ?ts .
1270
+ FILTER(?type IN (dkg:AssertionCreated, dkg:AssertionPromoted))
1271
+ OPTIONAL { ?event prov:wasAssociatedWith ?agentAssoc }
1272
+ OPTIONAL { ?event prov:generated ?gen }
1273
+ OPTIONAL { ?event prov:used ?used }
1274
+ BIND(COALESCE(?gen, ?used) AS ?assertion)
1275
+ ?assertion dkg:assertionName ?name .
1276
+ OPTIONAL { ?assertion prov:wasAttributedTo ?agentAttr }
1277
+ BIND(COALESCE(?agentAssoc, ?agentAttr) AS ?agent)
1278
+ OPTIONAL { ?assertion dkg:subGraphName ?subGraphName }
1279
+ OPTIONAL { ?assertion dkg:assertionGraph ?assertionGraph }
1280
+ OPTIONAL { ?event dkg:rootEntity ?root }
1281
+ OPTIONAL { ?assertion dkg:rootEntity ?subjRoot }
1282
+ }
1283
+ } GROUP BY ?event ?type ?assertion ?name ?agent ?ts ?subGraphName ?assertionGraph
1284
+ ORDER BY DESC(?ts) LIMIT 5000`}function Xr(e){if(e!=null)return typeof e=="string"?e.startsWith('"')?e.replace(/^"/,"").replace(/"(\^\^<[^>]*>)?$/,""):e:typeof e=="object"&&e!==null&&"value"in e?String(e.value):String(e)}function OM(e){return e===`${Mm}AssertionCreated`?"created":e===`${Mm}AssertionPromoted`?"promoted":null}function LM(e){const[t,n]=w.useState([]),[a,s]=w.useState(!!e),[l,u]=w.useState(null),[d,f]=w.useState(void 0),h=w.useRef(void 0),g=w.useRef(void 0);return w.useEffect(()=>{if(!e){s(!1);return}h.current!=null&&h.current!==e&&(n([]),u(null),f(void 0),g.current=void 0);let m=!1;const y=new AbortController;let b;return h.current=e,s(!0),u(null),(async()=>{var k;try{const j=new Promise((A,B)=>{b=setTimeout(()=>{y.abort(),B(new Error(`Assertion-lifecycle query timed out after ${Math.round(A1/1e3)}s`))},A1)}),N=(async()=>{const A=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Ft()},signal:y.signal,body:JSON.stringify({sparql:RM(e),contextGraphId:e})});if(!A.ok)throw new Error(`SPARQL query failed: ${A.status}`);return A.json()})(),S=await Promise.race([N,j]);if(m||h.current!==e)return;const T=((k=S==null?void 0:S.result)==null?void 0:k.bindings)??[],E=[];for(const A of T){const B=Xr(A.event),_=Xr(A.type),z=Xr(A.assertion),q=Xr(A.name),M=Xr(A.agent),R=Xr(A.ts);if(!B||!z||!M||!R)continue;const P=OM(_);if(!P)continue;let F;if(P==="promoted"){const $=Xr(A.entityCount),H=$!=null?Number($):NaN;if(Number.isFinite(H)&&H>0)F=H;else{const V=Xr(A.subjectEntityCount),X=V!=null?Number(V):NaN;Number.isFinite(X)&&X>=0&&(F=X)}}let I=Xr(A.subGraphName);if(I===void 0){const $=Xr(A.assertionGraph);$&&(I=_M($,e))}E.push({eventUri:B,kind:P,assertionUri:z,assertionName:q??"",agentUri:M,publishedAt:R,subGraph:I,entityCount:F})}n(E),f(e),g.current=e,u(null)}catch(j){if(m||(j==null?void 0:j.name)==="AbortError")return;u(j.message??String(j)),g.current!==e&&n([]),f(e),g.current=e}finally{b&&clearTimeout(b),m||s(!1)}})(),()=>{m=!0,y.abort(),b&&clearTimeout(b)}},[e]),w.useMemo(()=>({resultContextGraphId:d,events:t,loading:a,error:l}),[d,t,a,l])}const MM=["http://purl.org/dc/terms/created","http://dkg.io/ontology/github/mergedAt","http://dkg.io/ontology/github/closedAt","http://dkg.io/ontology/decisions/date","http://dkg.io/ontology/tasks/dueDate"],DM="http://www.w3.org/ns/prov#wasAttributedTo",zM=new Set(["http://dkg.io/ontology/decisions/Decision","http://dkg.io/ontology/tasks/Task","http://dkg.io/ontology/github/PullRequest","http://dkg.io/ontology/github/Issue","http://dkg.io/ontology/github/Commit"]);function Yg(e){const t=e.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),n=new Date(t);return Number.isFinite(n.getTime())?n:null}function Qg(e,t,n,a){const s=n?n.toISOString():"no-ts";return a&&a!==t?`${e}|${t}|${a}|${s}`:`${e}|${t}|${s}`}function $M(e){for(const t of MM){const n=e.properties.get(t);if(n!=null&&n.length)for(const a of n){const s=Yg(a);if(s)return s}}return null}function IM(e){for(const t of e.connections)if(t.predicate===DM)return t.targetUri;return null}function PM(e){for(const t of e.types)if(zM.has(t))return t;return null}function UM(e){for(const t of e.subGraphs)if(t!=="meta")return t;return null}function BM(e,t={}){const{limit:n=200,agentUri:a,typeIri:s,subGraph:l,includeUndated:u=!0,excludeEvents:d}=t,f=d?[...d].sort().join(","):"";return w.useMemo(()=>{const h=d&&d.length>0?new Set(d):null,g=[];for(const m of e){const y=PM(m);if(s&&y!==s)continue;const b=$M(m);if(!b&&(!u||!y))continue;const k=IM(m);if(a&&k!==a)continue;const j=UM(m);if(l&&j!==l)continue;const N=y?"typed":"added";if(h&&h.has(N))continue;const S=Qg(N,m.uri,b);g.push({id:S,entity:m,at:b,authorUri:k,kindUri:y,subGraph:j,layer:m.trustLevel,event:N,clickable:!0})}return g.sort((m,y)=>m.at&&y.at?y.at.getTime()-m.at.getTime():m.at&&!y.at?-1:!m.at&&y.at?1:m.entity.label.localeCompare(y.entity.label)),{items:g.slice(0,n),hasMore:g.length>n}},[e,n,a,s,l,u,f])}function FM(e,t=new Date){const n=g=>{const m=new Date(g);return m.setHours(0,0,0,0),m},a=n(t),s=new Date(a.getTime()-1440*60*1e3),l=new Date(a.getTime()-10080*60*1e3),u={},d=[],f=(g,m,y)=>{u[g]||(u[g]={key:g,label:m,items:[]},d.push(g)),u[g].items.push(y)};for(const g of e){if(!g.at){f("undated","Undated",g);continue}const m=n(g.at);if(m.getTime()===a.getTime())f("today","Today",g);else if(m.getTime()===s.getTime())f("yesterday","Yesterday",g);else if(g.at.getTime()>=l.getTime())f("this-week","Earlier this week",g);else{const y=g.at.toLocaleString(void 0,{month:"long",year:"numeric"});f(`m-${y}`,y,g)}}const h=d.indexOf("undated");return h!==-1&&h<d.length-1&&(d.splice(h,1),d.push("undated")),d.map(g=>u[g])}function HM(e,t){const{entitiesByUri:n,agentUri:a,subGraph:s,limit:l=200}=t,u=[];for(const d of e){if(a&&d.agent!==a||s&&d.subGraph!==s)continue;const f=Yg(d.publishedAt);if(!f)continue;const h=bt(d.rootUri),g=n.get(h),m=g!=null;u.push({id:Qg("promoted",d.opUri,f,h),entity:g??qM(h),at:f,authorUri:d.agent,kindUri:null,subGraph:d.subGraph??null,layer:"shared",event:"promoted",clickable:m})}return u.sort((d,f)=>d.at&&f.at?f.at.getTime()-d.at.getTime():d.at&&!f.at?-1:!d.at&&f.at?1:d.entity.label.localeCompare(f.entity.label)),u.slice(0,l)}function qM(e){return{uri:e,label:qg(e),types:[],trustLevel:"shared",layers:new Set(["shared"]),subGraphs:new Set,properties:new Map,connections:[]}}function GM(e,t={}){const{agentUri:n,subGraph:a,limit:s=200}=t,l=[];for(const u of e){if(n&&u.agentUri!==n||a&&u.subGraph!==a)continue;const d=Yg(u.publishedAt);if(!d)continue;const f=u.kind==="promoted"?"promoted":"added",h=u.kind==="promoted"?"shared":"working",g=bt(u.assertionUri);l.push({id:Qg(f,u.eventUri,d,g),entity:{uri:g,label:u.assertionName||qg(g),types:[],trustLevel:h,layers:new Set([h]),subGraphs:u.subGraph?new Set([u.subGraph]):new Set,properties:new Map,connections:[]},at:d,authorUri:u.agentUri,kindUri:null,subGraph:u.subGraph??null,layer:h,event:f,entityCount:u.entityCount,clickable:!1})}return l.sort((u,d)=>u.at&&d.at?d.at.getTime()-u.at.getTime():u.at&&!d.at?-1:!u.at&&d.at?1:u.entity.label.localeCompare(d.entity.label)),l.slice(0,s)}function VM(e,t={}){const{swmEvents:n,lifecycleEvents:a,...s}=t,l=a!=null,d=BM(e,{...s,excludeEvents:l?["added"]:void 0});return w.useMemo(()=>{const f=s.limit??200;if(t.typeIri)return{items:d.items,hasMore:d.hasMore};if(!l&&(!n||n.length===0))return{items:d.items,hasMore:d.hasMore};let h;if(l)h=GM(a,{agentUri:s.agentUri,subGraph:s.subGraph,limit:Number.POSITIVE_INFINITY});else{const y=new Map;for(const b of e)y.set(b.uri,b);h=HM(n,{entitiesByUri:y,agentUri:s.agentUri,subGraph:s.subGraph,limit:Number.POSITIVE_INFINITY})}const g=[...d.items,...h];g.sort((y,b)=>y.at&&b.at?b.at.getTime()-y.at.getTime():y.at&&!b.at?-1:!y.at&&b.at?1:y.entity.label.localeCompare(b.entity.label));const m=d.hasMore||g.length>f;return{items:g.slice(0,f),hasMore:m}},[d,n,a,l,e,s.agentUri,s.subGraph,s.limit,t.typeIri])}function bj(e,t=new Date){if(!e)return"—";const n=t.getTime()-e.getTime(),a=Math.abs(n),s=n<0,l=6e4,u=l*60,d=u*24;return a<l?s?"in a moment":"just now":a<u?s?`in ${Math.floor(a/l)}m`:`${Math.floor(a/l)}m ago`:a<d?s?`in ${Math.floor(a/u)}h`:`${Math.floor(a/u)}h ago`:a<7*d?s?`in ${Math.floor(a/d)}d`:`${Math.floor(a/d)}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}const _1={"claude-code":"⦿",openclaw:"◈",hermes:"⬡",gemini:"✧",human:"👤"};function WM(e,t){return e&&_1[e]?_1[e]:t==="human"?"👤":"◉"}function ZM(e){const t=e.trim();if(!t)return"?";const n=t.split(/[\s_-]+/).filter(Boolean);return n.length===1?n[0].slice(0,2).toUpperCase():(n[0][0]+(n[1][0]??"")).toUpperCase()}function KM(e){const t=e.trim();return t.length<=11?t:`${t.slice(0,6)}…${t.slice(-4)}`}const es=({agent:e,fallbackUri:t,size:n="sm",showOperator:a=!1,onOpenAgent:s,className:l=""})=>{const u=ls();if(!e&&!t)return null;const d=s??(u==null?void 0:u.openAgent),f=(e==null?void 0:e.uri)??t,h=(e==null?void 0:e.name)??(t?KM(t.split(":").pop()??t):"unknown"),g=(e==null?void 0:e.kind)??"ai",m=e==null?void 0:e.framework,y=WM(m,g),b=(e==null?void 0:e.color)??"hsl(0, 0%, 55%)",k=[h,m?`framework: ${m}`:null,e!=null&&e.operatorName?`operator: ${e.operatorName}`:null,e!=null&&e.walletAddress?`wallet: ${e.walletAddress}`:null,e!=null&&e.peerId?`peer: ${e.peerId.slice(0,20)}…`:null,e!=null&&e.reputation?`— ${e.reputation}`:null,f].filter(Boolean).join(`
1285
+ `),j=d?()=>d(f):void 0,N=!!j;return o.jsxs("span",{className:`v10-agent-chip v10-agent-chip-${n}${N?" interactive":""} ${l}`,style:{"--agent-color":b},onClick:j?S=>{S.stopPropagation(),j()}:void 0,title:k,role:N?"button":void 0,tabIndex:N?0:void 0,children:[o.jsxs("span",{className:"v10-agent-chip-avatar",style:{background:b},children:[o.jsx("span",{className:"v10-agent-chip-initials",children:ZM(h)}),o.jsx("span",{className:"v10-agent-chip-glyph",title:m??g,children:y})]}),o.jsxs("span",{className:"v10-agent-chip-body",children:[o.jsx("span",{className:"v10-agent-chip-name",children:h}),n==="lg"&&((e==null?void 0:e.operatorName)||m)&&o.jsxs("span",{className:"v10-agent-chip-sub",children:[m&&g==="ai"&&o.jsx("span",{className:"v10-agent-chip-fw",children:m}),(e==null?void 0:e.operatorName)&&g==="ai"&&o.jsxs(o.Fragment,{children:[m&&o.jsx("span",{className:"v10-agent-chip-sep",children:"·"}),o.jsxs("span",{className:"v10-agent-chip-op",children:["driven by ",e.operatorName]})]}),g==="human"&&o.jsx("span",{className:"v10-agent-chip-fw",children:"human"})]}),n==="md"&&a&&(e==null?void 0:e.operatorName)&&g==="ai"&&o.jsx("span",{className:"v10-agent-chip-sub",children:o.jsxs("span",{className:"v10-agent-chip-op",children:["· ",e.operatorName]})})]})]})},Dh={working:"#64748b",shared:"#f59e0b",verified:"#22c55e"},YM={working:"◇",shared:"◈",verified:"◉"},QM=200,XM=({entities:e,agentUri:t,typeIri:n,subGraph:a,limit:s,includeUndated:l=!0,swmEvents:u,lifecycleEvents:d,lifecycleError:f,title:h,onSelectEntity:g,onOpenAgent:m,emptyHint:y,className:b=""})=>{const{items:k,hasMore:j}=VM(e,{agentUri:t,typeIri:n,subGraph:a,limit:s,includeUndated:l,swmEvents:u,lifecycleEvents:d}),N=Ve.useMemo(()=>FM(k),[k]),S=ls(),T=Ua(),A=j?`${s??QM}+`:String(k.length),B=f!=null&&k.length===0,_=h?o.jsxs("div",{className:"v10-activity-feed-title",children:[o.jsx("span",{className:"v10-activity-feed-title-label",children:h}),o.jsx("span",{className:"v10-activity-feed-title-count","data-state":B?"error":void 0,children:B?"—":A})]}):null,z=f?o.jsx("div",{className:"v10-activity-feed-error",role:"status","aria-live":"polite",title:f,children:"Couldn't load recent activity."}):null;return k.length===0?o.jsxs("div",{className:`v10-activity-feed v10-activity-feed-empty ${b}`,children:[_,z??o.jsx("div",{className:"v10-activity-feed-empty-hint",children:y??"No activity with a timestamp yet."})]}):o.jsxs("div",{className:`v10-activity-feed ${b}`,children:[_,z,N.map(q=>o.jsxs("div",{className:"v10-activity-feed-bucket",children:[o.jsxs("div",{className:"v10-activity-feed-bucket-head",children:[o.jsx("span",{className:"v10-activity-feed-bucket-label",children:q.label}),o.jsx("span",{className:"v10-activity-feed-bucket-count",children:q.items.length})]}),o.jsx("div",{className:"v10-activity-feed-items",children:q.items.map(M=>o.jsx(JM,{item:M,agents:S,profile:T,onSelectEntity:g,onOpenAgent:m},M.id))})]},q.key))]})};function JM({item:e,agents:t,profile:n,onSelectEntity:a,onOpenAgent:s}){const l=e.authorUri?t==null?void 0:t.get(e.authorUri):null,u=e.event==="typed",d=u&&e.kindUri?n==null?void 0:n.forType(e.kindUri):null,f=e.event==="added"?"Added":e.event==="promoted"?e.entityCount!=null&&e.entityCount>0?`Promoted to SWM · ${e.entityCount} ${e.entityCount===1?"entity":"entities"}`:"Promoted to SWM":e.event==="published"?"Published to VM":(d==null?void 0:d.label)??(e.kindUri?e.kindUri.split(/[#/]/).pop():null)??"Entity",h=e.event==="added"?"+":e.event==="promoted"?"⇡":e.event==="published"?"◉":(d==null?void 0:d.icon)??"◆",g=e.event==="promoted"?Dh.shared:e.event==="published"?Dh.verified:e.event==="added"?"#64748b":(d==null?void 0:d.color)??"#a855f7",m=Dh[e.layer],y=u?eD(e.entity):null,b=(()=>{const j=[];return e.event!=="typed"&&j.push(f),j.push(e.entity.label),e.at&&j.push(e.at.toISOString()),j.join(`
1286
+ `)})(),k=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-activity-feed-layer",style:{color:m},title:`${e.layer} memory`,children:YM[e.layer]}),o.jsxs("span",{className:"v10-activity-feed-type",style:{"--type-color":g},children:[o.jsx("span",{className:"v10-activity-feed-type-icon",children:h}),o.jsx("span",{className:"v10-activity-feed-type-label",children:f})]}),o.jsx("span",{className:"v10-activity-feed-title-text",children:e.entity.label}),y&&o.jsx("span",{className:`v10-activity-feed-status status-${tD(y)}`,children:y}),(l||e.authorUri)&&o.jsx("span",{className:"v10-activity-feed-author",children:o.jsx(es,{agent:l??void 0,fallbackUri:e.authorUri??void 0,size:"sm",onOpenAgent:s})}),o.jsx("span",{className:"v10-activity-feed-time",title:e.at?e.at.toLocaleString():"no timestamp",children:bj(e.at)})]});return e.clickable?o.jsx("button",{type:"button",className:"v10-activity-feed-row",onClick:()=>a(e.entity.uri),title:b,children:k}):o.jsx("div",{className:"v10-activity-feed-row v10-activity-feed-row-static",title:b,"aria-disabled":"true",children:k})}function eD(e){var n;const t=["http://dkg.io/ontology/decisions/status","http://dkg.io/ontology/tasks/status","http://dkg.io/ontology/github/state"];for(const a of t){const s=(n=e.properties.get(a))==null?void 0:n[0];if(s)return s}return null}function tD(e){switch(e){case"accepted":case"done":case"merged":return"good";case"proposed":case"in_progress":case"open":return"warn";case"rejected":case"superseded":case"blocked":case"cancelled":return"bad";default:return"neutral"}}const nD={wm:"working",swm:"shared",vm:"verified"};function rD(e){var y,b,k,j;const t=new Map;if(!e)return t;const n="http://dkg.io/ontology/decisions/status",a="http://dkg.io/ontology/tasks/status",s="http://dkg.io/ontology/tasks/priority",l="http://dkg.io/ontology/github/state",u="http://dkg.io/ontology/decisions/Decision",d="http://dkg.io/ontology/tasks/Task",f="http://dkg.io/ontology/github/PullRequest";let h=0,g=0,m=0;for(const N of e)if(N.types.includes(u))((y=N.properties.get(n))==null?void 0:y[0])==="proposed"&&h++;else if(N.types.includes(d)){const S=(b=N.properties.get(s))==null?void 0:b[0],T=(k=N.properties.get(a))==null?void 0:k[0];S==="p0"&&T!=="done"&&T!=="cancelled"&&g++}else N.types.includes(f)&&((j=N.properties.get(l))==null?void 0:j[0])==="open"&&m++;return h>0&&t.set("decisions",{label:`${h} proposed`,tone:"warn"}),g>0&&t.set("tasks",{label:`${g} p0`,tone:"danger"}),m>0&&t.set("github",{label:`${m} open`,tone:"info"}),t}const zh=({contextGraphId:e,profile:t,selected:n,onSelect:a,entities:s,layer:l,enabledScope:u,allTriplesTotal:d})=>{const[f,h]=Ve.useState([]),[g,m]=Ve.useState(!0),y=Ve.useMemo(()=>rD(s),[s]),b=Ve.useRef(0),k=Ve.useMemo(()=>u&&u.size>0&&u.size<3?new Set(u):u&&u.size>=3?null:l?new Set([nD[l]]):null,[u,l]),j=Ve.useMemo(()=>{if(!s)return null;const I=new Map;for(const $ of s)if(!(k&&!k.has($.trustLevel)))for(const H of $.subGraphs)I.set(H,(I.get(H)??0)+1);return I},[k,s]),N=Ve.useMemo(()=>{if(!s)return null;let I=0;for(const $ of s)k&&!k.has($.trustLevel)||I++;return I},[k,s]),S=Ve.useMemo(()=>{if(!s)return null;let I=0;for(const $ of s)k&&!k.has($.trustLevel)||$.subGraphs.size>0||I++;return I},[k,s]),T=Ve.useCallback(()=>{const I=++b.current;m(!0),Mg(e).then($=>{I===b.current&&h($.subGraphs??[])}).catch(()=>{}).finally(()=>{I===b.current&&m(!1)})},[e]);Ve.useEffect(()=>(T(),()=>{b.current++}),[T]),xo(e,T);const E=Ve.useMemo(()=>f.filter(Kg).map(I=>{const $=t.forSubGraph(I.name),H=j!==null?j.get(I.name)??0:I.entityCount;return{slug:I.name,icon:$.icon??"•",color:$.color??"#64748b",displayName:$.displayName??I.name,description:$.description??I.description,rank:$.rank??99,entityCount:H,tripleCount:I.tripleCount,layerScoped:j!==null}}).sort((I,$)=>I.rank-$.rank),[f,t,j]),B=S!==null&&S>0||n===$r;if(g&&E.length===0&&!B||E.length===0&&!B)return null;const _=N??E.reduce((I,$)=>I+$.entityCount,0),z=E.reduce((I,$)=>I+$.tripleCount,0),q={working:"Working Memory",shared:"Shared Working Memory",verified:"Verifiable Memory"},M=k?[...k].map(I=>q[I]).join(" + "):null,R=M?` in ${M}`:"",F=`Total distinct entities — includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph · ${_} entities${R}${M?"":` · ${d??z} triples`}`,Z=`All — total distinct entities. Includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph. ${_} entities${R}.`;return o.jsxs("div",{className:"v10-subgraph-bar",children:[o.jsx("div",{className:"v10-subgraph-bar-label",children:"Subgraphs"}),o.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===null?" active":""}`,onClick:()=>a(null),title:F,"aria-label":Z,children:[o.jsx("span",{className:"v10-subgraph-chip-icon",children:"⊚"}),o.jsx("span",{className:"v10-subgraph-chip-label",children:"All"}),o.jsx("span",{className:"v10-subgraph-chip-count",children:_})]}),E.map(I=>{const $=y.get(I.slug);return o.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===I.slug?" active":""}${$?" has-badge":""}`,onClick:()=>a(I.slug,l),title:`${I.displayName}${I.description?" · "+I.description:""} · ${I.entityCount} entities${R}${M?"":` · ${I.tripleCount} triples`}${$?" · "+$.label:""}`,style:{"--sg-color":I.color},children:[o.jsx("span",{className:"v10-subgraph-chip-icon",style:{color:I.color},children:I.icon}),o.jsx("span",{className:"v10-subgraph-chip-label",children:I.displayName}),o.jsx("span",{className:"v10-subgraph-chip-count",children:I.entityCount}),$&&o.jsxs("span",{className:`v10-subgraph-chip-badge tone-${$.tone}`,children:[o.jsx("span",{className:"v10-subgraph-chip-badge-dot"}),$.label]})]},I.slug)}),B&&(()=>{const I=S??0,$=n===$r;return o.jsxs("button",{type:"button",className:`v10-subgraph-chip v10-subgraph-chip-root${$?" active":""}`,"data-active":$,"data-count":I,onClick:()=>a($r,l),title:`Entities not in any subgraph (Context Graph root) · ${I} entities${R}`,"aria-label":"Entities not in any subgraph (Context Graph root)",children:[o.jsx("span",{className:"v10-subgraph-chip-icon",children:"⊘"}),o.jsx("span",{className:"v10-subgraph-chip-label",children:"Root"}),o.jsx("span",{className:"v10-subgraph-chip-count",children:I})]})})()]})},Xg="context-graph-primer",xj={id:Xg,label:"What is a Context Graph?",closable:!0},wj={neutral:"var(--border-strong)",wm:"var(--layer-working, #64748b)",swm:"var(--layer-shared, #f59e0b)",vm:"var(--layer-verified, #22c55e)",danger:"var(--text-danger)",query:"#38bdf8",warning:"var(--text-warning)"};function ln({icon:e,title:t,description:n,actions:a=[],tone:s="neutral",compact:l=!1,inline:u=!1,className:d=""}){const f={"--v10-empty-accent":wj[s]};return o.jsxs("div",{className:["v10-empty-state",l?"compact":"",u?"inline":"",d].filter(Boolean).join(" "),"data-tone":s,style:f,children:[e&&o.jsx("div",{className:"v10-empty-state-icon","aria-hidden":"true",children:e}),o.jsxs("div",{className:"v10-empty-state-copy",children:[o.jsx("div",{className:"v10-empty-state-title",children:t}),n&&o.jsx("div",{className:"v10-empty-state-desc",children:n}),a.length>0&&o.jsx("div",{className:"v10-empty-state-actions",children:a.map(h=>o.jsx("button",{type:"button",className:`v10-empty-state-action ${h.variant??"secondary"}`,onClick:h.onClick,"data-testid":h.testId,children:h.label},h.label))})]})]})}function Fd({items:e,layer:t,compact:n=!1,className:a=""}){const s=t?{"--v10-stat-accent":wj[t]}:void 0;return o.jsx("div",{className:["v10-stat-strip",n?"compact":"",a].filter(Boolean).join(" "),"data-layer":t,style:s,children:e.map((l,u)=>o.jsxs("div",{className:"v10-stat-strip-cell","data-stat-id":l.id,title:l.tooltip,children:[o.jsx("span",{className:"v10-stat-strip-label",children:l.label}),o.jsx("span",{className:"v10-stat-strip-value",children:l.value}),l.hint&&o.jsx("span",{className:"v10-stat-strip-hint",children:l.hint})]},l.id??u))})}const Jg=w.lazy(()=>gt(()=>import("./index-BTD4QwAm.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),aD="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",iD=new Map(Hg.map((e,t)=>[e,t]));function Dm(e){const t=e.trim();return!t||t.startsWith('"')?!1:t.startsWith("_:")||t.startsWith("<")&&t.endsWith(">")?!0:/\s/.test(t)?!1:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function Da(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function sD(e){const t=new Set,n=new Map,a=new Map,s=new Map;for(const d of e){const f=Da(d.subject);t.add(f);const h=iD.get(d.predicate);if(h!==void 0){const m=Pd(d.object).trim();if(m){const y=s.get(f);(y===void 0||h<y)&&(a.set(f,m),s.set(f,h))}}if(Da(d.predicate)===aD||!Dm(d.object))continue;const g=Da(d.object);n.set(f,(n.get(f)??0)+1),n.set(g,(n.get(g)??0)+1)}const l=[...t].filter(d=>(n.get(d)??0)===0).map(d=>({uri:d,label:a.get(d)??lj(void 0,d)})).sort((d,f)=>d.label.localeCompare(f.label));if(l.length===0)return{canvasTriples:e,singletonItems:l};const u=new Set(l.map(d=>d.uri));return{canvasTriples:e.filter(d=>!u.has(Da(d.subject))&&!u.has(Da(d.object))),singletonItems:l}}function oD(e){return e==="wm"?"Working Memory graph: local entities connected by entity-to-entity triples from loaded layer data.":e==="swm"?"Shared Working Memory graph: promoted shared entities connected by entity-to-entity triples from loaded layer data.":"Verifiable Memory graph: published knowledge assets, provenance anchors, and connected entity-to-entity triples from loaded layer data."}function lD({items:e,onSelect:t}){return e.length===0?null:o.jsxs("div",{className:"v10-graph-singleton-shelf","aria-label":"Standalone entities without visible links",children:[o.jsxs("div",{className:"v10-graph-singleton-head",title:"Entities with no visible links are grouped here to keep the graph readable.",children:[o.jsx("span",{children:"Standalone entities"}),o.jsx("span",{children:e.length})]}),o.jsx("div",{className:"v10-graph-singleton-list",children:e.map(({uri:n,label:a})=>o.jsx("button",{type:"button",className:"v10-graph-singleton-item",title:n,onClick:()=>t==null?void 0:t(n),children:a},n))})]})}const cD=2500;function R1(e,t=cD){if(e.length<=t)return e;const n=new Map;for(const u of e)n.set(u.subject,(n.get(u.subject)??0)+1);const a=[...n.entries()].sort((u,d)=>d[1]-u[1]).map(([u])=>u),s=new Set;let l=0;for(const u of a){const d=n.get(u)??0;l+d>t||(s.add(u),l+=d)}return s.size===0&&a.length>0&&s.add(a[0]),e.filter(u=>s.has(u.subject)).slice(0,t)}function Xu({title:e,scopeLabel:t,tone:n,className:a,rail:s,overlay:l,showScopeLabel:u=!0,singletonItems:d=[],onSingletonClick:f,renderGraph:h}){const[g,m]=w.useState(!1);w.useEffect(()=>{if(!g)return;const k=j=>{j.key==="Escape"&&m(!1)};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[g]);const y=o.jsx("button",{type:"button",className:`v10-graph-expand-btn${u?"":" in-canvas"}`,onClick:()=>m(!0),title:`Expand ${e}`,"aria-label":`Expand ${e}`,children:"⤢"}),b=k=>o.jsxs(o.Fragment,{children:[u&&!k&&o.jsxs("div",{className:"v10-graph-shell-bar",children:[o.jsx("div",{className:"v10-graph-scope",title:t,children:t}),y]}),o.jsxs("div",{className:"v10-graph-body",children:[o.jsxs("div",{className:"v10-graph-canvas",children:[!u&&!k&&y,o.jsx("div",{className:"v10-graph-view",children:h(k)}),l&&o.jsx("div",{className:"v10-graph-overlay",children:l}),o.jsx(lD,{items:d,onSelect:f})]}),s&&o.jsx("aside",{className:"v10-graph-rail",children:s})]})]});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`v10-graph-shell v10-graph-shell-${n}${a?` ${a}`:""}`,children:!g&&b(!1)}),g&&o.jsx("div",{className:"v10-graph-expanded-backdrop",role:"dialog","aria-modal":"true","aria-label":`${e} expanded`,onClick:k=>{k.target===k.currentTarget&&m(!1)},children:o.jsxs("div",{className:`v10-graph-expanded-panel v10-graph-shell-${n}`,children:[o.jsxs("div",{className:"v10-graph-expanded-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"v10-graph-expanded-title",children:e}),o.jsx("div",{className:"v10-graph-expanded-subtitle",children:t})]}),o.jsx("button",{type:"button",className:"v10-graph-expanded-close",onClick:()=>m(!1),"aria-label":`Close expanded ${e}`,children:"×"})]}),o.jsx("div",{className:"v10-graph-expanded-body",children:b(!0)})]})})]})}function kj({layer:e,triples:t,onNodeClick:n,contextGraphId:a,scopeLabel:s,trustLegendActiveLayer:l,title:u,scopeEntities:d,swmAttribution:f,layerEntities:h,nodeColorsOverride:g}){const{title:m}=zn[e],y=u??m,b=Vn(L=>L.theme),k=w.useMemo(()=>{if(e!=="vm")return;const L=new Set;for(const U of t)L.add(U.subject),Dm(U.object)&&L.add(U.object);return L},[t,e]),{anchors:j,decorationTriples:N}=E4(e==="vm"&&a?a:void 0,k),S=yj(e==="swm"&&a&&!f?a:void 0),T=f??S,E=w.useMemo(()=>{if(!h||h.length===0)return t;const L=new Set;for(const U of h)L.add(bt(U.uri));return hd(t,L)},[t,h]),A=w.useMemo(()=>{const L=new Set,U=[],G=O=>{const ne=`${O.subject}|${O.predicate}|${O.object}`;L.has(ne)||(L.add(ne),U.push({subject:O.subject,predicate:O.predicate,object:O.object}))};for(const O of E)G(O);for(const O of N)G(O);return U},[E,N]),B=A,_=w.useMemo(()=>{const L=e==="swm"?T.nodeColors:void 0;if(!(!L&&!g))return L?g?{...L,...g}:L:g},[e,T.nodeColors,g]),z=w.useMemo(()=>I4(e,_),[e,_]),{canvasTriples:q,singletonItems:M}=w.useMemo(()=>sD(B),[B]),R=w.useMemo(()=>{if(!d||d.length===0)return M;const L=new Set(M.map(G=>Da(G.uri)));for(const G of q)L.add(Da(G.subject)),Dm(G.object)&&L.add(Da(G.object));const U=[];for(const G of d){const O=Da(G.uri);L.has(O)||(L.add(O),U.push({uri:O,label:G.label||lj(void 0,O)}))}return U.length===0?M:[...M,...U].sort((G,O)=>G.label.localeCompare(O.label))},[M,q,d]),P=`${a??"context"}:${e}`,F=e==="swm"&&!!a&&T.loading,Z=`${y} graph`,I=s??oD(e),$=l===null&&!!s,H=l===null?void 0:l??e,X=e==="vm"&&j.length>0||e==="swm"&&T.palette.length>0?o.jsxs(o.Fragment,{children:[e==="vm"&&j.length>0&&o.jsx(dD,{anchors:j}),e==="swm"&&T.palette.length>0&&o.jsx(uD,{palette:T.palette,conflicts:T.conflicts.length})]}):null,Y=w.useMemo(()=>({name:`${P}:${b}`,palette:b}),[P,b]);return A.length===0&&R.length===0?o.jsx(Xu,{title:Z,scopeLabel:I,tone:e,className:"v10-graph-view-fill",showScopeLabel:$,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(ln,{compact:!0,tone:e,icon:zn[e].icon,title:`No triples in ${y}`,description:"The graph will appear when this layer has connected triples."})})}):F?o.jsx(Xu,{title:Z,scopeLabel:I,tone:"swm",className:"v10-graph-view-fill",showScopeLabel:$,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(ln,{compact:!0,tone:"swm",icon:zn.swm.icon,title:"Loading Shared Working Memory attribution...",description:"Agent colors are being prepared before the graph renders."})})}):o.jsx(Xu,{title:Z,scopeLabel:I,tone:e,className:"v10-graph-view-fill",overlay:X,showScopeLabel:$,singletonItems:R,onSingletonClick:L=>n==null?void 0:n(H?{id:L,trustLayer:H}:{id:L}),renderGraph:L=>q.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(Jg,{data:q,format:"triples",options:z,viewConfig:Y,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:H?U=>n==null?void 0:n({...U,trustLayer:H}):n,initialFit:!0},`${P}:${L?"expanded":"inline"}:${q.length}`)}):o.jsx("div",{className:"v10-graph-placeholder v10-graph-placeholder-centered",children:"Connected graph appears when this layer has linked entities."})})}function uD({palette:e,conflicts:t}){return o.jsxs("div",{className:"v10-swm-legend","aria-label":"SWM attribution legend",children:[o.jsxs("div",{className:"v10-swm-legend-row v10-swm-legend-head",children:[o.jsx("span",{children:"SWM attribution"}),o.jsxs("span",{className:"v10-swm-legend-count",children:[e.length," agent",e.length===1?"":"s"]})]}),e.slice(0,8).map(n=>o.jsxs("div",{className:"v10-swm-legend-row",title:n.agent,children:[o.jsx("span",{className:"v10-swm-legend-swatch",style:{background:n.color}}),o.jsx("span",{className:"v10-swm-legend-label",children:n.label}),o.jsx("span",{className:"v10-swm-legend-metric",children:n.entityCount})]},n.agent)),t>0&&o.jsxs("div",{className:"v10-swm-legend-row v10-swm-legend-conflict",children:[o.jsx("span",{className:"v10-swm-legend-swatch",style:{background:"#f59e0b"},children:"!"}),o.jsx("span",{className:"v10-swm-legend-label",children:"In review"}),o.jsx("span",{className:"v10-swm-legend-metric",children:t})]})]})}function dD({anchors:e}){var s;const t=w.useMemo(()=>{const l=new Set;for(const u of e)for(const d of u.agents)l.add(d);return l.size},[e]),n=(s=e[0])==null?void 0:s.publishedAt,a=(()=>{if(!n)return null;try{return new Date(n).toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return null}})();return o.jsxs("div",{className:"v10-vm-legend","aria-label":"Verifiable Memory legend",children:[o.jsxs("div",{className:"v10-vm-legend-row v10-vm-legend-head",children:[o.jsx("span",{children:"VM provenance layer"}),o.jsxs("span",{className:"v10-vm-legend-count",children:[e.length," anchor",e.length===1?"":"s"]})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#f5a524"},children:"◉"}),o.jsx("span",{className:"v10-vm-legend-label",children:"On-chain anchor"})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#c084fc"},children:"◈"}),o.jsxs("span",{className:"v10-vm-legend-label",children:["Agent identity (",t,")"]})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#4ade80"},children:"—"}),o.jsx("span",{className:"v10-vm-legend-label",children:"Signed / anchored edge"})]}),a&&o.jsxs("div",{className:"v10-vm-legend-foot",children:["Latest: ",a]})]})}function pD({active:e,counts:t,onSwitch:n,onShare:a,onImport:s,onRefresh:l}){const[u,d]=w.useState(!1),f=w.useRef(null),h=g=>{d(!1),n(g)};return w.useEffect(()=>{if(!u)return;const g=m=>{var b;const y=m.target;y&&((b=f.current)!=null&&b.contains(y))||d(!1)};return document.addEventListener("pointerdown",g),()=>document.removeEventListener("pointerdown",g)},[u]),o.jsxs("div",{className:"v10-layer-switcher",children:[o.jsxs("button",{className:`v10-layer-switch-btn ${e==="overview"?"active":""}`,"data-layer":"overview","aria-label":"Overview",title:"Overview",onClick:()=>h("overview"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"◎"}),o.jsx("span",{className:"v10-layer-switch-label",children:"Overview"})]}),o.jsx("span",{className:"v10-layer-switch-separator","aria-hidden":"true"}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="wm"?"active":""}`,"data-layer":"wm","aria-label":"Working Memory",title:"Working Memory",onClick:()=>h("wm"),children:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#64748b"},children:"◇"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Working Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"WM"}),t.wm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.wm})]}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="swm"?"active":""}`,"data-layer":"swm","aria-label":"Shared Working Memory",title:"Shared Working Memory",onClick:()=>h("swm"),children:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#f59e0b"},children:"◈"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Shared Working Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"SWM"}),t.swm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.swm})]}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="vm"?"active":""}`,"data-layer":"vm","aria-label":"Verifiable Memory",title:"Verifiable Memory",onClick:()=>h("vm"),children:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#22c55e"},children:"◉"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Verifiable Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"VM"}),t.vm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.vm})]}),o.jsx("span",{className:"v10-layer-switch-separator","aria-hidden":"true"}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="graph-overview"?"active":""}`,"data-layer":"graph-overview","aria-label":"Subgraphs",title:"Subgraphs",onClick:()=>h("graph-overview"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⌬"}),o.jsx("span",{className:"v10-layer-switch-label",children:"Subgraphs"})]}),o.jsxs("div",{ref:f,className:"v10-layer-more",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||d(!1)},children:[o.jsxs("button",{type:"button",className:`v10-layer-switch-btn v10-layer-more-btn ${e==="query"?"active":""}`,"data-layer":"query","aria-haspopup":"menu","aria-expanded":u,"aria-label":"More Context Graph views",title:"More Context Graph views",onClick:()=>d(g=>!g),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⋯"}),o.jsx("span",{className:"v10-layer-switch-label",children:"More"})]}),u&&o.jsx("div",{className:"v10-layer-more-menu",role:"menu",children:o.jsxs("button",{type:"button",role:"menuitem",className:`v10-layer-more-item ${e==="query"?"active":""}`,onClick:()=>h("query"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⟐"}),"Query Catalogue"]})})]}),o.jsx("div",{className:"v10-layer-switcher-spacer"}),o.jsxs("div",{className:"v10-layer-switcher-actions",children:[o.jsxs("button",{className:"v10-layer-action-btn",onClick:a,"aria-label":"Share Context Graph",children:[o.jsx("span",{className:"v10-layer-action-icon",children:"⤴"}),o.jsx("span",{className:"v10-layer-action-label",children:"Share"})]}),o.jsxs("button",{className:"v10-layer-action-btn",onClick:s,"aria-label":"Import into Context Graph",children:[o.jsx("span",{className:"v10-layer-action-icon",children:"↑"}),o.jsx("span",{className:"v10-layer-action-label",children:"Import"})]}),o.jsx("button",{className:"v10-layer-action-btn",onClick:l,"aria-label":"Refresh Context Graph data",children:o.jsx("span",{className:"v10-layer-action-icon",children:"↻"})})]})]})}function fD({cg:e,profile:t,activeSubGraph:n,onClearSubGraph:a}){const s=e.name||t.displayName||e.id;return o.jsxs("div",{className:"v10-project-strip",style:{"--sg-color":(n==null?void 0:n.color)??t.primaryColor},children:[o.jsx("span",{className:"v10-project-strip-dot",style:{background:t.primaryColor}}),o.jsx("button",{type:"button",className:"v10-project-strip-name",onClick:n?a:void 0,disabled:!n,title:n?"Back to context graph overview":e.id,children:s}),n?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-project-strip-sep",children:"›"}),o.jsxs("span",{className:"v10-project-strip-sg",children:[o.jsx("span",{className:"v10-project-strip-sg-icon",style:{color:n.color},children:n.icon??"•"}),n.displayName??n.slug]}),n.description&&o.jsx("span",{className:"v10-project-strip-desc",title:n.description,children:n.description})]}):e.description&&o.jsx("span",{className:"v10-project-strip-desc",title:e.description,children:e.description})]})}function hD(e,t,n,a,s){const l=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",u=new Set([t==null?void 0:t.agentDid,t==null?void 0:t.agentAddress].filter(h=>typeof h=="string"&&h.trim().length>0).map(Jt)),d=u.size>0;return l&&d&&u.has(Jt(l))?{label:"Curator",title:"This agent is the curator for this Context Graph.",tone:"curator"}:(e==null?void 0:e.callerInvolved)===!0?l&&!d&&n==="loading"?{label:"Role checking",title:"This agent is involved in this Context Graph; curator status is still loading.",tone:"unknown"}:l&&!d&&n==="error"?{label:"Role unknown",title:"This agent is involved in this Context Graph, but curator status could not be confirmed.",tone:"unknown"}:{label:"Joined",title:"This agent is involved in this Context Graph; curator status is shown only when identity metadata confirms it.",tone:"participant"}:(e==null?void 0:e.callerInvolved)===!1?{label:"Not joined",title:"This agent is not listed as curator or participant for this Context Graph.",tone:"viewer"}:s==="ok"&&a.map(h=>h.trim()).filter(Boolean).some(h=>u.has(Jt(h)))?{label:"Joined",title:"This agent is listed as a participant for this Context Graph.",tone:"participant"}:{label:"Role unknown",title:"The node did not provide enough role metadata for this Context Graph.",tone:"unknown"}}function mD(e,t,n){if(uo(e==null?void 0:e.accessPolicy)==="public")return{id:"participants",value:"Open",label:"Public access",tooltip:"Public Context Graphs do not have an authoritative allowlist count."};if(n==="loading")return{id:"participants",value:"...",label:"Agents with access",tooltip:"Participant list is loading."};if(n==="error")return{id:"participants",value:"Unavailable",label:"Agents with access",tooltip:"Participant list unavailable; access count is unknown."};const s=new Set(t.map(u=>u.trim()).filter(Boolean).map(Jt)),l=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";return l&&s.add(Jt(l)),{id:"participants",value:s.size.toLocaleString(),label:"Agents with access",tooltip:"Includes the curator plus allowlisted participants reported by the node."}}function gD(e){const t=uo(e);return t==="public"?{label:"Public",title:"Public Context Graph.",tone:"public"}:t==="private"?{label:"Curated",title:"Curated Context Graph with access controlled by the curator.",tone:"curated"}:{label:"Access unknown",title:"The node did not provide an access policy for this Context Graph.",tone:"unknown"}}function vD({cg:e,currentAgent:t,currentAgentStatus:n="ok"}){var d,f;const a=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";if(!a)return"unknown";const s=((d=t==null?void 0:t.agentDid)==null?void 0:d.trim())??"",l=((f=t==null?void 0:t.agentAddress)==null?void 0:f.trim())??"",u=s||l;return u?Jt(a)===Jt(u)?"curator":"not-curator":"unknown"}function yD(e){return new Set([e==null?void 0:e.agentDid,e==null?void 0:e.agentAddress].filter(t=>typeof t=="string"&&t.trim().length>0).map(Jt))}function bD({cg:e,memory:t,subGraphCount:n,subGraphFetchFailed:a=!1,participants:s,participantsStatus:l="ok",currentAgent:u,currentAgentStatus:d="ok",onSwitchLayer:f,onOpenPrimer:h}){var Y,L,U;const{wm:g,swm:m,vm:y}=t.counts,b=g+m+y,k=hD(e,u??null,d,s,l),j=gD(e==null?void 0:e.accessPolicy),N=mD(e,s,l),S=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",T=S?Jt(S):"",E=uo(e==null?void 0:e.accessPolicy)==="public",A=yD(u??null),B=Object.values(t.layerStatus??{}),_=B.filter(G=>G==="error").length,z=!t.loading&&B.length===3&&_===3,q=!t.loading&&_>0,M=t.loading?"Loading memory layers...":z||t.error?"Live memory counts are unavailable.":t.partial||q?"One or more layer counts are currently a lower bound.":"Canonical current-layer entity counts.",R=z?"Unavailable":b.toLocaleString(),{total:P}=Zg(t),F=!t.loading&&(t.partial||q),Z=z?"Unavailable":t.loading&&P===0?"...":F?`${P.toLocaleString()}+`:P.toLocaleString(),I=z?"Live triple counts are unavailable.":F?"One or more layer triple counts are currently a lower bound.":"Canonical triple total across all layers.",$=n==null?a?"Unavailable":"...":n.toLocaleString(),H=n==null?a?"Sub-graph list is currently unavailable.":"Sub-graph count is loading.":"Topical partitions inside this Context Graph.",V=[{key:"wm",label:"Working Memory",desc:"Private staging area",count:g,status:((Y=t.layerStatus)==null?void 0:Y.wm)??"ok",color:"#64748b"},{key:"swm",label:"Shared Working Memory",desc:"Collaborative review",count:m,status:((L=t.layerStatus)==null?void 0:L.swm)??"ok",color:"#f59e0b"},{key:"vm",label:"Verifiable Memory",desc:"Published on-chain",count:y,status:((U=t.layerStatus)==null?void 0:U.vm)??"ok",color:"#22c55e"}],X=V.some(G=>G.status==="error");return o.jsxs("div",{className:"v10-po",children:[o.jsxs("div",{className:"v10-po-identity","data-section":"identity",children:[o.jsxs("div",{className:"v10-po-identity-pairs",children:[o.jsxs("div",{className:"v10-po-identity-pair",children:[o.jsx("span",{className:"v10-po-identity-label",children:"Your role:"}),o.jsx("span",{className:"v10-po-badge","data-role":k.tone,title:k.title,children:k.label})]}),o.jsxs("div",{className:"v10-po-identity-pair",children:[o.jsx("span",{className:"v10-po-identity-label",children:"Context Graph:"}),o.jsx("span",{className:"v10-po-badge","data-cg-type":j.tone,title:j.title,children:j.label})]})]}),h&&o.jsx("button",{type:"button",className:"v10-po-identity-primer",onClick:h,title:"Open the Context Graph primer",children:"What is a Context Graph?"})]}),o.jsxs("div",{"data-section":"at-a-glance",className:"v10-po-stat-block",children:[o.jsx("div",{className:"v10-po-section-title",children:"At a glance"}),o.jsx(Fd,{className:"v10-po-stat-strip",items:[{id:"entities",value:R,label:"Entities",tooltip:M},{id:"triples",value:Z,label:"Triples",tooltip:I},{id:"subgraphs",value:$,label:"Subgraphs",tooltip:H},N]})]}),o.jsxs("div",{className:"v10-po-pipeline","data-section":"pipeline","aria-label":"Knowledge Pipeline",children:[o.jsx("div",{className:"v10-po-pipeline-head",children:o.jsxs("div",{children:[o.jsx("div",{className:"v10-po-section-title",children:"Knowledge Pipeline"}),o.jsx("div",{className:"v10-po-section-desc",children:"Entities move from private staging to shared review; published assertion bundles become Knowledge Assets with on-chain provenance."})]})}),o.jsx("div",{className:"v10-po-pipeline-track","aria-hidden":"true",children:!X&&b>0?V.map(G=>{const O=G.count>0?G.count/b*100:0;return o.jsx("span",{className:`v10-po-pipeline-seg ${G.key}`,style:{width:`${O}%`,background:G.color}},G.key)}):o.jsx("span",{className:"v10-po-pipeline-empty"})}),o.jsx("div",{className:"v10-po-pipeline-steps",children:V.map((G,O)=>o.jsxs("button",{type:"button",className:`v10-po-pipeline-step ${G.key}`,onClick:()=>f==null?void 0:f(G.key),style:{"--po-layer-color":G.color},children:[o.jsx("span",{className:"v10-po-pipeline-step-index",children:O+1}),o.jsxs("span",{className:"v10-po-pipeline-step-copy",children:[o.jsx("span",{className:"v10-po-pipeline-step-label",children:G.label}),o.jsx("span",{className:"v10-po-pipeline-step-desc",children:G.desc})]}),o.jsx("span",{className:"v10-po-pipeline-step-count",children:G.status==="error"?"Unavailable":`${G.count.toLocaleString()} ${ia(G.key,G.count)}`})]},G.key))})]}),o.jsxs("div",{className:"v10-po-people","data-section":"participants",children:[o.jsx("div",{className:"v10-po-section-title",children:"Participant agents"}),(()=>{const G="did:dkg:agent:",O=le=>le.toLowerCase().startsWith(G)?le.slice(G.length):le,ne=new Set,ue=[];if(S&&l==="ok"){const le=Jt(S);ne.add(le),ue.push({display:O(S),full:S,canonical:le})}if(l==="ok")for(const le of s){const be=Jt(le);ne.has(be)||(ne.add(be),ue.push({display:O(le),full:le,canonical:be}))}if(ue.length===0){const le=E?"This Context Graph is public — anyone can subscribe.":l==="loading"?"Loading participant agents...":l==="error"?"Participant list unavailable.":"No participant agents recorded yet.";return o.jsx("div",{className:"v10-po-people-empty",children:le})}return o.jsx("div",{className:"v10-po-participants-list",children:ue.map(({display:le,full:be,canonical:_e})=>{const Ee=A.has(_e),Ie=!!T&&_e===T,We=`${le.slice(0,6)}…${le.slice(-4)}`,Se=[We];return Ee&&Se.push("you"),Ie&&Se.push("curator"),o.jsxs("span",{className:`v10-po-participant${Ee?" is-self":""}${Ie?" is-curator":""}`,title:be,"aria-label":Se.join(" "),children:[o.jsx("span",{className:"v10-po-participant-name",children:We}),Ee&&o.jsx("span",{className:"v10-po-participant-tag",children:"you"}),Ie&&o.jsx("span",{className:"v10-po-participant-tag",children:"curator"})]},_e)})})})()]})]})}function xD({contextGraphId:e,curatorStatus:t,onParticipantsChanged:n}){const[a,s]=w.useState([]),[l,u]=w.useState(null),[d,f]=w.useState("loading"),h=w.useRef(0),g=w.useCallback(()=>{if(t!=="curator"){s([]),f("idle");return}const b=++h.current;f("loading"),TS(e).then(k=>{h.current===b&&(s(k.requests.filter(j=>j.status==="pending")),f("idle"))}).catch(()=>{h.current===b&&(s([]),f("error"))})},[e,t]);if(w.useEffect(()=>(g(),()=>{h.current++}),[g]),is(w.useCallback(b=>{var k;b.type!=="join_request"&&b.type!=="join_approved"&&b.type!=="join_rejected"||((k=b.data)==null?void 0:k.contextGraphId)===e&&g()},[e,g])),t==="not-curator")return null;if(t==="unknown")return o.jsxs("section",{className:"v10-po-join","data-section":"join-requests",children:[o.jsx("header",{className:"v10-po-join-head",children:o.jsx("span",{className:"v10-po-section-title",children:"Pending join requests"})}),o.jsx("div",{className:"v10-po-join-empty",children:"Verifying access…"})]});const m=async b=>{u(b);try{await Ng(e,b),s(k=>k.filter(j=>j.agentAddress!==b)),n==null||n()}catch{}finally{u(null)}},y=async b=>{u(b);try{await Eg(e,b),s(k=>k.filter(j=>j.agentAddress!==b)),n==null||n()}catch{}finally{u(null)}};return o.jsxs("section",{className:"v10-po-join","data-section":"join-requests",children:[o.jsxs("header",{className:"v10-po-join-head",children:[o.jsx("span",{className:"v10-po-section-title",children:"Pending join requests"}),o.jsx("span",{className:"v10-po-join-count","data-empty":a.length===0?"true":"false",children:a.length})]}),d==="loading"?o.jsx("div",{className:"v10-po-join-empty",children:"Loading join requests..."}):d==="error"?o.jsx("div",{className:"v10-po-join-empty",children:"Join requests are currently unavailable."}):a.length===0?o.jsx("div",{className:"v10-po-join-empty",children:"No pending join requests."}):o.jsx("div",{className:"v10-po-join-list",children:a.map(b=>o.jsxs("div",{className:"v10-po-join-item",children:[o.jsxs("div",{className:"v10-po-join-info",children:[o.jsx("span",{className:"v10-po-join-name",children:b.name||`${b.agentAddress.slice(0,6)}…${b.agentAddress.slice(-4)}`}),o.jsxs("span",{className:"v10-po-join-addr",title:b.agentAddress,children:[b.agentAddress.slice(0,10),"…"]})]}),o.jsxs("div",{className:"v10-po-join-actions",children:[o.jsx("button",{className:"v10-po-join-btn approve",onClick:()=>m(b.agentAddress),disabled:l===b.agentAddress,children:l===b.agentAddress?"…":"✓ Approve"}),o.jsx("button",{className:"v10-po-join-btn reject",onClick:()=>y(b.agentAddress),disabled:l===b.agentAddress,"aria-label":"Reject join request",children:"✕"})]})]},b.agentAddress))})]})}function wD({onOpenPrimer:e}){return o.jsxs("div",{className:"v10-po-primer-footer","data-section":"primer",children:[o.jsx("span",{className:"v10-po-primer-footer-lede",children:"New here?"}),o.jsx("span",{className:"v10-po-primer-footer-arrow","aria-hidden":"true",children:"→"}),o.jsx("button",{type:"button",className:"v10-po-primer-footer-link",onClick:e,children:"What is a Context Graph?"}),o.jsx("div",{className:"v10-po-primer-footer-sub",children:"A short primer on context graphs, the WM → SWM → VM pipeline, and how participant agents collaborate."})]})}const kD=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();function SD(e,t=0){const n=Pl(u=>u.trackedIds),a=n.join(","),{data:s,loading:l}=lr(async()=>{if(n.length===0)return{wallets:[],ownerPublish:!1,resolved:!1};const u=await Lg().catch(()=>null),d=(u==null?void 0:u.wallets)??[];let f=!1;try{const{contextGraphs:g}=await Ld(),m=(g??[]).find(b=>(b==null?void 0:b.id)===e),y=m==null?void 0:m.curator;if(y){const b=await Yl().catch(()=>null);f=!!(b!=null&&b.agentDid&&Jt(y)===Jt(b.agentDid))}}catch{f=!1}return{wallets:await Promise.all(d.map(async g=>{var A;const m=(A=u==null?void 0:u.balances)==null?void 0:A.find(B=>kD(B.address,g)),y=m==null,b=m!=null&&Number(m.eth)>0,k=m!=null&&Number(m.trac)>0;let j,N=!1,S=!1,T,E=!1;for(const B of n){const _=await od(B,g,{extended:!0}).catch(()=>null);if(_===null){E=!0;continue}const z=jm(_);if(z.outcome==="inconclusive"){E=!0;continue}if(z.outcome!=="unregistered"){if(z.outcome==="covers"){j={accountId:B,discountBps:_.discountBps,untracked:!1};break}z.dead&&(N=!0,T||(T=B)),z.hasBudget||(S=!0)}}if(!j&&!E&&!N&&!S){const B=await n_(g).catch(()=>{});if(B===void 0)E=!0;else if(B.accountId!=null&&!n.includes(B.accountId)){const _=B.accountId,z=await od(_,g,{extended:!0}).catch(()=>null);if(z===null)E=!0;else{const q=jm(z);q.outcome==="covers"?j={accountId:_,discountBps:z.discountBps,untracked:!0}:q.outcome==="uncovered"?(q.dead&&(N=!0,T||(T=_)),q.hasBudget||(S=!0)):E=!0}}}return{wallet:g,covered:!!j,accountId:j==null?void 0:j.accountId,discountBps:j==null?void 0:j.discountBps,coverUntracked:(j==null?void 0:j.untracked)??!1,deadAccountId:j?void 0:T,inconclusive:!j&&E,balanceUnknown:y,gasFunded:b,hasTrac:k,sawExpired:N,sawInsolvent:S}})),ownerPublish:f,resolved:d.length>0}},[a,e],t);return w.useMemo(()=>{const u=(s==null?void 0:s.wallets)??[],d=(s==null?void 0:s.ownerPublish)??!1,f=(s==null?void 0:s.resolved)??!1;if(n.length===0||!f||u.length===0)return{verdict:"unknown",loading:l,ownerPublish:d,anyGasFunded:!1,reasons:[],conditions:{approved:!1,gasFunded:!1,notExpired:!1,solvent:!1},wallets:u};const h=u.filter(S=>S.covered),g=u.filter(S=>!S.covered),m=g.filter(S=>!S.inconclusive&&!S.balanceUnknown),y=g.filter(S=>S.inconclusive||S.balanceUnknown),b={approved:g.length===0,gasFunded:u.every(S=>S.gasFunded),notExpired:!u.some(S=>S.sawExpired),solvent:!u.some(S=>S.sawInsolvent)};let k;const j=[];if(g.length===0)h.some(S=>S.gasFunded||S.balanceUnknown)?k="eligible":(k="fallthrough-no-funds",j.push("every approved signing wallet is out of gas"));else if(m.length===0&&y.length>0)k="unknown";else{const S=u.some(T=>(T.covered||T.hasTrac)&&T.gasFunded);!S&&y.length>0?k="unknown":(k=S?"fallthrough":"fallthrough-no-funds",j.push(`${h.length} of ${u.length} signing wallets approved`),u.some(T=>T.sawExpired)&&j.push("a PCA has expired or been fully swept"),u.some(T=>T.sawInsolvent)&&j.push("a PCA is out of budget"),b.gasFunded||j.push("a signing wallet has no gas"),g.some(T=>T.inconclusive)&&j.push("a wallet’s PCA coverage couldn’t be checked"),g.some(T=>T.balanceUnknown)&&j.push("a signing wallet’s balance couldn’t be checked"))}const N=h.reduce((S,T)=>(T.discountBps??-1)>((S==null?void 0:S.discountBps)??-1)?T:S,void 0);return{verdict:k,loading:l,accountId:N==null?void 0:N.accountId,discountBps:N==null?void 0:N.discountBps,accountUntracked:N==null?void 0:N.coverUntracked,ownerPublish:d,anyGasFunded:u.some(S=>S.gasFunded||S.balanceUnknown),reasons:j,conditions:b,wallets:u}},[s,l,n.length])}function jD(e){return e.verdict==="fallthrough-no-funds"&&!(e.ownerPublish&&e.anyGasFunded)}function CD(e){const t=Pl(u=>u.trackedIds),n=SD(e,3e4),a=jD(n),s="Publish will fail — no signing wallet can fund it (coverage or gas).",l=t.length>0;return{blocked:a,reason:s,chipVisible:l,eligibility:n}}function ND({verdict:e,accountId:t,discountBps:n,accountUntracked:a,ownerPublish:s,id:l}){return o.jsx("div",{className:"v10-pca-publish-chip",id:l,"data-testid":"pca-publish-eligibility",children:o.jsx(UO,{variant:"chip",verdict:e,accountId:t,discountBps:n,accountUntracked:a,ownerPublish:s})})}function ev({title:e,agent:t,footnote:n,dismissed:a,onDismiss:s,children:l}){return o.jsxs("div",{className:`v10-gen-widget ${a?"dissolved":""}`,children:[o.jsxs("div",{className:"v10-gen-widget-header",children:[o.jsx("span",{className:"v10-gen-widget-title",children:e}),o.jsxs("div",{className:"v10-gen-widget-right",children:[t&&o.jsxs("span",{className:"v10-gen-widget-agent",children:[o.jsx("span",{className:"v10-gen-widget-agent-dot"}),t]}),s&&o.jsx("button",{className:"v10-gen-widget-dismiss",onClick:s,children:"✕"})]})]}),o.jsx("div",{className:"v10-gen-widget-body",children:l}),n&&o.jsx("div",{className:"v10-gen-widget-footnote",children:n})]})}function ED({entities:e}){const t=Ua(),n=w.useMemo(()=>{const a=new Map;for(const s of e){const{icon:l,type:u}=Bd(s,t),d=a.get(u);d?d.count++:a.set(u,{icon:l,count:1})}return[...a.entries()].sort((s,l)=>l[1].count-s[1].count)},[e,t]);return n.length===0?null:o.jsx(ev,{title:"Entity Types",children:o.jsx(Fd,{compact:!0,items:n.map(([a,{icon:s,count:l}])=>({id:a,label:`${s} ${a}`,value:l}))})})}function TD({entities:e,entityCount:t,triples:n,layer:a}){const s=w.useMemo(()=>e.filter(d=>d.properties.has("http://dkg.io/ontology/sourceContentType")).length,[e]),l=w.useMemo(()=>e.reduce((d,f)=>d+f.connections.length,0),[e]),u=e.length>0?(l/e.length).toFixed(1):"0";return o.jsx(ev,{title:"Layer Stats",children:o.jsx(Fd,{compact:!0,layer:a,items:[{id:"entities",label:ia(a,t),value:t},{id:"triples",label:"Triples",value:n},{id:"connections",label:"Connections",value:l},{id:"avg",label:"Avg. connections / entity",value:u},...s>0?[{id:"documents",label:"Documents",value:s}]:[]]})})}function Sj(e,t){const[n,a]=w.useState(!1),[s,l]=w.useState(null),[u,d]=w.useState(null),f=w.useCallback(async(h,g)=>{a(!0),d(null),l(null);try{const m=await h();l(m),e==null||e({ok:!0,text:m}),t==null||t()}catch(m){const y=g(m);d(y),e==null||e({ok:!1,text:y})}finally{a(!1)}},[e,t]);return{busy:n,result:s,error:u,run:f}}function jj({title:e,footnote:t,context:n,result:a,error:s,extras:l,children:u}){return o.jsxs(ev,{title:e,footnote:t,children:[o.jsx("div",{className:"v10-decision-context",style:{marginBottom:10},children:n}),a&&o.jsxs("div",{"data-testid":"layer-action-result",style:{fontSize:11,color:"var(--text-success)",marginBottom:8},children:["✓ ",a]}),s&&o.jsxs("div",{"data-testid":"layer-action-error",style:{fontSize:11,color:"var(--text-danger)",marginBottom:8},children:["✕ ",s]}),l,o.jsx("div",{className:"v10-decision-actions",children:u})]})}function AD({count:e,contextGraphId:t,onComplete:n,onResult:a}){const{busy:s,result:l,error:u,run:d}=Sj(a,n),f=w.useCallback(()=>{let m=null;d(async()=>{const y=await Ql(t,"wm");let b=0;for(const j of y)m=j.name,(await oo(t,j.name,j.subGraph?{subGraphName:j.subGraph}:{})).promotedCount===0&&(b+=1);const k=y.length-b;if(k>0){const j=b>0?` (${b} already shared or still committing)`:"";return`Shared ${k} complete Knowledge Asset${k!==1?"s":""} to Shared Memory${j}`}return"No Knowledge Assets were newly shared — all were already in Shared Memory or still committing."},y=>{const b=lo(m??"an assertion",y);return b?b.message:(y==null?void 0:y.message)??"Action failed"})},[t,d]);if(e===0)return null;const h="#f59e0b",g=ia("wm",e).toLowerCase();return o.jsx(jj,{title:"Share complete Knowledge Assets",footnote:"Shares each complete owning Knowledge Asset atomically to Shared Working Memory.",context:o.jsxs(o.Fragment,{children:["The displayed ",g," will be shared through their complete owning Knowledge Assets for collaborative review."]}),result:l,error:u,children:o.jsx("button",{"data-testid":"widget-promote-all-btn",className:"v10-decision-btn approve",style:{borderColor:`${h}50`,color:"var(--text-warning)",background:`${h}15`,opacity:s?.5:1},disabled:s,onClick:f,children:s?"...":"✓ Share Complete KAs → Shared"})})}function _D({count:e,contextGraphId:t,onComplete:n,onResult:a}){const[s,l]=w.useState(null),{busy:u,result:d,error:f,run:h}=Sj(a,n),g=CD(t),m=w.useId(),y=w.useId(),b=[g.chipVisible?m:null,g.blocked?y:null].filter(Boolean).join(" ")||void 0,k=w.useCallback(()=>{g.blocked||h(async()=>{l(null);const N=await Ql(t,"swm"),S=await Ag(t,N);if(S.published>0){const T=S.failures.length?` (${S.failures.length} assertion${S.failures.length===1?"":"s"} could not be published)`:"",E=S.partial>0?` — ⚠ ${S.partial}: ${Il(S.partialError)}`:"";return l(S.convictionCostCovered??null),`Published ${S.published} knowledge asset${S.published!==1?"s":""} to Verifiable Memory${T}${E}`}if(N.length===0)return"Nothing to publish — promote assertions to Shared Memory first.";throw new Error(S.failures[0]?`${S.failures[0].name}: ${S.failures[0].error}`:"Publish failed")},N=>(N==null?void 0:N.message)??"Action failed")},[t,h,g.blocked]);if(e===0)return null;const j=ia("swm",e).toLowerCase();return o.jsx(jj,{title:"Publish",footnote:`Moves ${j} from this layer to Verifiable Memory.`,context:o.jsxs(o.Fragment,{children:[e," ",j," in this layer can be published to Verifiable Memory on-chain."]}),result:d,error:f,extras:o.jsxs(o.Fragment,{children:[o.jsx(qS,{convictionCostCovered:s}),g.chipVisible&&o.jsx(ND,{...g.eligibility,id:m}),g.blocked&&o.jsx("span",{id:y,className:"v10-sr-only",children:g.reason})]}),children:o.jsx("button",{"data-testid":"widget-publish-vm-btn",className:"v10-decision-btn primary-cta publish-vm",style:{opacity:u||g.blocked?.5:1},disabled:u,"aria-disabled":g.blocked||void 0,title:g.blocked?g.reason:void 0,"aria-describedby":b,onClick:k,children:u?"...":"◉ Publish to Verifiable Memory"})})}function RD({layer:e,entities:t,entityCount:n,tripleCount:a,contextGraphId:s,onComplete:l}){const[u,d]=w.useState(null),f=u&&o.jsxs("div",{"data-testid":u.ok?"layer-action-result":"layer-action-error",style:{fontSize:11,color:u.ok?"var(--text-success)":"var(--text-danger)",marginBottom:8},children:[u.ok?"✓":"✕"," ",u.text]});return n===0?o.jsxs("div",{className:"v10-layer-widgets-strip empty",children:[f,o.jsx(ln,{compact:!0,tone:e,icon:zn[e].icon,title:`No ${ia(e,2).toLowerCase()} yet`,description:e==="wm"?"Import data or chat with agents to populate Working Memory.":e==="swm"?"Seal and share complete Knowledge Assets from Working Memory with the team.":"Publish complete Knowledge Assets from Shared Working Memory to verify them on-chain."})]}):o.jsxs("div",{className:"v10-layer-widgets-strip",children:[o.jsxs("div",{className:"v10-layer-widgets-strip-stats",children:[o.jsx(TD,{entities:t,entityCount:n,triples:a,layer:e}),o.jsx(ED,{entities:t})]}),(e==="wm"||e==="swm")&&s&&o.jsx("div",{className:"v10-layer-widgets-strip-action",children:e==="wm"?o.jsx(AD,{count:n,contextGraphId:s,onComplete:l,onResult:d}):o.jsx(_D,{count:n,contextGraphId:s,onComplete:l,onResult:d})})]})}const tv="doc:";function OD(e,t,n){return`${tv}${e}|${t}|${n}`}function LD(e,t,n){return e?{ref:e,contentType:"text/markdown"}:t?{ref:t,contentType:n}:{ref:void 0,contentType:n}}function MD(e){const t=e.slice(tv.length),n=t.indexOf("|"),a=t.lastIndexOf("|");return n<0?{docRef:t,contentType:""}:{docRef:t.slice(n+1,a),contentType:t.slice(a+1)}}function nv(e,t){if(e.length<=t)return e;const n=t-1,a=Math.ceil(n/2),s=n-a;return`${e.slice(0,a)}…${e.slice(-s)}`}const DD={working:{layerKey:"wm",icon:"◇",label:"Working"},shared:{layerKey:"swm",icon:"◈",label:"Shared"},verified:{layerKey:"vm",icon:"◉",label:"Verifiable"}};function Cj({entities:e,layerKey:t,layerIcon:n,onSelectEntity:a,onOpenAgent:s,externallySorted:l=!1,sortLabel:u,headerExtra:d,timestampPredicate:f,perEntityTrustBadge:h=!1}){const g=Ua(),m=ls(),y=ia(t,e.length).toLowerCase(),b=w.useMemo(()=>{if(l)return e;const N=[...e];return N.sort((S,T)=>{const E=S.tripleCount??0;return(T.tripleCount??0)-E}),N},[e,l]),k=t==="vm"?"Verifiable":t==="swm"?"Shared":"Working";if(e.length===0)return o.jsx("div",{className:"v10-entity-list empty",children:o.jsx(ln,{compact:!0,tone:t,icon:n,title:`No ${ia(t,2).toLowerCase()} yet`,description:`This view will fill when matching ${ia(t,2).toLowerCase()} are available.`})});const j=u??(l?"click to open":"sorted by triples · click to open");return o.jsxs("div",{className:"v10-entity-list",children:[o.jsxs("div",{className:"v10-entity-list-header",children:[o.jsxs("span",{className:"v10-entity-list-count",children:[b.length," ",y]}),o.jsx("span",{className:"v10-entity-list-hint",children:j}),d&&o.jsx("span",{className:"v10-entity-list-extra",children:d})]}),b.map(N=>{const{icon:S,type:T}=Bd(N,g),E=N.tripleCount??0,A=Ud(N),B=A?m==null?void 0:m.get(A):null,_=f?Qu(N,f):null;return o.jsxs("div",{className:"v10-entity-card",onClick:z=>{z.stopPropagation(),a(N.uri)},children:[o.jsx("span",{className:"v10-entity-card-icon",children:S}),o.jsxs("div",{className:"v10-entity-card-main",children:[o.jsx("div",{className:"v10-entity-card-title",children:N.label}),o.jsxs("div",{className:"v10-entity-card-meta",children:[(B||A)&&o.jsx(es,{agent:B??void 0,fallbackUri:A??void 0,size:"sm",onOpenAgent:s}),T&&T!=="Entity"&&o.jsxs("span",{className:"v10-entity-type-pill",children:[S," ",T]}),_!=null&&o.jsx("span",{className:"v10-entity-card-timestamp",title:new Date(_).toLocaleString(),children:V4(_)}),o.jsxs("span",{className:"v10-entity-card-triples",children:[E," triples"]})]})]}),h?(()=>{const z=DD[N.trustLevel];return o.jsxs("span",{className:`v10-trust-badge ${z.layerKey}`,title:`${z.label} Memory`,children:[z.icon," ",z.label]})})():o.jsxs("span",{className:`v10-trust-badge ${t}`,children:[n," ",k]})]},N.uri)})]})}function zD({layer:e,entities:t,tripleCount:n,layerTriples:a,contextGraphId:s,memory:l,activeTab:u,onTabChange:d,onSelectEntity:f,onNodeClick:h,footer:g,swmAttribution:m}){var A;const y=zn[e],b=ia(e,2),k=((A=l.layerStatus)==null?void 0:A.vm)??(l.loading?"loading":l.error?"error":"ok"),j=e==="vm"&&k==="loading"&&t.length===0,N=e==="vm"&&k==="error"&&t.length===0,S=e==="vm"&&k==="ok"&&t.length===0,T=l.counts[e],E=B=>_=>{_.stopPropagation(),d(B)};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-layer-expand-tabs",children:[o.jsx("button",{className:`v10-layer-expand-tab ${u==="items"?"active":""}`,onClick:E("items"),children:b}),e!=="vm"&&o.jsx("button",{className:`v10-layer-expand-tab ${u==="assertions"?"active":""}`,onClick:E("assertions"),children:"Assertions"}),o.jsx("button",{className:`v10-layer-expand-tab ${u==="graph"?"active":""}`,onClick:E("graph"),children:"Graph"}),o.jsx("button",{className:`v10-layer-expand-tab ${u==="docs"?"active":""}`,onClick:E("docs"),children:"Documents"})]}),u==="items"&&o.jsxs("div",{className:"v10-layer-expand-body entities-tab","data-cg-scroll-key":`layer:${e}:items`,children:[e==="vm"&&!j&&!N&&o.jsx($D,{entities:t,tripleCount:n,contextGraphId:s}),j?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(ln,{compact:!0,tone:"vm",icon:zn.vm.icon,title:"Loading Verifiable Memory...",description:"Knowledge Assets are being read from the verified layer."})}):N?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(ln,{compact:!0,tone:"vm",icon:zn.vm.icon,title:"Verifiable Memory status unavailable.",description:"This node could not read the verified layer right now."})}):!S&&o.jsxs(o.Fragment,{children:[o.jsx(RD,{layer:e,entities:t,entityCount:T,tripleCount:n,contextGraphId:s,onComplete:l.refresh}),o.jsx(Cj,{entities:t,layerKey:e,layerIcon:y.icon,onSelectEntity:f})]}),g]}),u==="assertions"&&e!=="vm"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(ID,{contextGraphId:s,layer:e,onComplete:l.refresh,scrollKey:`layer:${e}:assertions`})}),u==="graph"&&o.jsx("div",{className:"v10-layer-expand-body full-width","data-cg-scroll-key":`layer:${e}:graph`,children:o.jsx(kj,{layer:e,triples:a,onNodeClick:h,contextGraphId:s,swmAttribution:e==="swm"?m:void 0,layerEntities:t})}),u==="docs"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(Nj,{entities:t,contextGraphId:s,scrollKey:`layer:${e}:docs`})})]})}function $D({entities:e,tripleCount:t,contextGraphId:n}){const a=e.length,s=new Set;for(const u of e)for(const d of u.types)s.add(d);const l=s.size;return a===0?o.jsxs("div",{className:"v10-vm-hero v10-vm-hero-empty",children:[o.jsxs("div",{className:"v10-vm-hero-title",children:[o.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),o.jsxs("div",{className:"v10-vm-hero-heading",children:[o.jsx("span",{className:"v10-vm-hero-headline",children:"Nothing published yet"}),o.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),o.jsx(ln,{compact:!0,className:"v10-vm-empty-state",tone:"vm",icon:zn.vm.icon,title:"No Knowledge Assets yet.",description:"Publish complete Knowledge Assets from Shared Working Memory to verify them on-chain."})]}):o.jsxs("div",{className:"v10-vm-hero",children:[o.jsxs("div",{className:"v10-vm-hero-title",children:[o.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),o.jsxs("div",{className:"v10-vm-hero-heading",children:[o.jsx("span",{className:"v10-vm-hero-headline",children:"On-chain anchored · cryptographically signed"}),o.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),o.jsx(Fd,{className:"v10-vm-hero-stats",layer:"vm",items:[{id:"assets",value:a,label:"Knowledge Assets"},{id:"triples",value:t.toLocaleString(),label:"Verifiable Triples"},{id:"types",value:l,label:"Entity Types"}]}),o.jsxs("div",{className:"v10-vm-hero-strip",children:[o.jsxs("div",{className:"v10-vm-hero-chip",title:"Multi-agent endorsement",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#22c55e"}}),"Consensus"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Published to the DKG blockchain anchor",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#3b82f6"}}),"On-chain"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Each contribution bound to a DID",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#a855f7"}}),"Agent Identity"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Tamper-evident via content hashing",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#f59e0b"}}),"Content Hash"]})]})]})}function ID({contextGraphId:e,layer:t,onComplete:n,scrollKey:a}){const{data:s,loading:l,refresh:u}=lr(()=>Ql(e,t),[e,t],0),{data:d}=lr(()=>v_(e),[e,t],0),[f,h]=w.useState(null),[g,m]=w.useState(null),[y,b]=w.useState(null),k=w.useCallback(async E=>{h(E.graphUri),m(null),b(null);try{if(t==="wm"){const A=await oo(e,E.name,E.subGraph?{subGraphName:E.subGraph}:{}),B=_g(E.name,A);m(B.message)}else{const A=await Tg(e,E.name,E.subGraph?{subGraphName:E.subGraph}:{});m(A.contextGraphError?`Published ${E.name} on-chain — ⚠ ${Il(A.contextGraphError)}`:`Published ${E.name} to Verifiable Memory`)}u(),n()}catch(A){const B=lo(E.name,A);b(B?B.message:(A==null?void 0:A.message)??"Action failed")}finally{h(null)}},[e,t,u,n]),j=w.useCallback(async()=>{if(!(s!=null&&s.length))return;h("__all__"),m(null),b(null);let E=null;try{if(t==="wm"){let A=0;for(const _ of s)E=_.name,(await oo(e,_.name,_.subGraph?{subGraphName:_.subGraph}:{})).promotedCount===0&&(A+=1);const B=s.length-A;if(B>0){const _=A>0?` (${A} already shared or still committing)`:"";m(`Shared ${B} complete Knowledge Asset${B!==1?"s":""}${_}`)}else m("No Knowledge Assets were newly shared — all were already in Shared Memory or still committing.")}else{const A=await Ag(e,s);if(A.published>0){const B=A.failures.length?` (${A.failures.length} could not be published)`:"",_=A.partial>0?` — ⚠ ${A.partial}: ${Il(A.partialError)}`:"";m(`Published ${A.published} knowledge asset${A.published!==1?"s":""} to Verifiable Memory${B}${_}`)}else throw new Error(A.failures[0]?`${A.failures[0].name}: ${A.failures[0].error}`:"Publish failed")}u(),n()}catch(A){const B=lo(E??"selected assertion",A);b(B?B.message:(A==null?void 0:A.message)??"Action failed")}finally{h(null)}},[s,e,t,u,n]),N={flex:1,overflow:"auto"};if(l)return o.jsx("div",{className:"v10-layer-empty-shell",style:N,"data-cg-scroll-key":a,children:o.jsx(ln,{compact:!0,tone:t,icon:zn[t].icon,title:"Loading assertions..."})});if(!(s!=null&&s.length))return o.jsx("div",{className:"v10-layer-empty-shell",style:N,"data-cg-scroll-key":a,children:o.jsx(ln,{tone:t,icon:zn[t].icon,title:t==="swm"?"No Shared Working Memory assertions listed yet.":"No Working Memory assertions yet.",description:t==="swm"?"Promoted assertion contents are available as Shared Working Memory entities. The assertion list will populate once promoted assertions are exposed by the node.":"Create or import data to stage assertions in Working Memory."})});const S=t==="wm"?"Share Complete KA → Shared":"Publish to VM",T=t==="wm"?"Share Complete KAs → Shared":"Publish all to Verifiable Memory";return o.jsxs("div",{style:N,"data-cg-scroll-key":a,children:[o.jsxs("div",{style:{padding:"8px 16px",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid var(--border-subtle)"},children:[o.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:[s.length," assertion",s.length!==1?"s":""]}),o.jsx("button",{className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:f!==null,onClick:j,style:{opacity:f==="__all__"?.5:1},children:f==="__all__"?"...":T})]}),g&&o.jsxs("div",{"data-testid":t==="wm"?"assertion-promote-result":"assertion-publish-result",style:{padding:"6px 16px",fontSize:11,color:"var(--text-success)"},children:["✓ ",g]}),y&&o.jsxs("div",{"data-testid":t==="wm"?"assertion-promote-result":"assertion-publish-result",style:{padding:"6px 16px",fontSize:11,color:"var(--text-danger)"},children:["✕ ",y]}),s.map(E=>o.jsxs("div",{className:"v10-item-row","data-testid":"assertion-list-row",children:[o.jsx("span",{className:"v10-item-icon",children:"▤"}),o.jsxs("div",{className:"v10-item-info",children:[o.jsx("div",{className:"v10-item-name",style:{fontFamily:"var(--font-mono)",fontSize:11},children:E.name}),(d==null?void 0:d[E.name])&&o.jsx("div",{className:"v10-item-ual",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",opacity:.7,wordBreak:"break-all",marginTop:1},title:d[E.name],children:d[E.name]}),o.jsxs("div",{className:"v10-item-meta-row",children:[E.tripleCount!=null&&o.jsxs("span",{className:"v10-item-count",children:[E.tripleCount," triples"]}),E.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${E.subGraph}`,children:["› ",nv(E.subGraph,18)]})]})]}),o.jsx("button",{"data-testid":"assertion-row-action",className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:f!==null,onClick:A=>{A.stopPropagation(),k(E)},style:{opacity:f===E.graphUri?.5:1,flexShrink:0},children:f===E.graphUri?"...":S})]},E.graphUri))]})}function PD({layer:e,memory:t,onNodeClick:n,onSelectEntity:a,contextGraphId:s,activeTab:l,onTabChange:u,swmAttribution:d}){const f=zn[e],h=w.useMemo(()=>t.entityList.filter(m=>m.trustLevel===f.trustLevel),[t.entityList,f.trustLevel]),g=B4(t,e);return o.jsxs("div",{className:"v10-layer-detail",children:[o.jsxs("div",{className:"v10-layer-detail-header",children:[o.jsx("span",{className:"v10-layer-detail-icon",style:{color:f.color},children:f.icon}),o.jsxs("div",{children:[o.jsx("div",{className:"v10-layer-detail-title",children:f.title}),o.jsx("div",{className:"v10-layer-detail-desc",children:f.desc})]}),o.jsx("div",{className:"v10-layer-detail-actions"})]}),o.jsx("div",{className:"v10-layer-detail-body",children:o.jsx(zD,{layer:e,entities:h,tripleCount:g.length,layerTriples:g,contextGraphId:s,memory:t,activeTab:l,onTabChange:u,onSelectEntity:a,onNodeClick:n,swmAttribution:d})})]})}function Nj({entities:e,contextGraphId:t,scrollKey:n}){const a=fn(u=>u.openTab),s=w.useMemo(()=>e.filter(u=>u.properties.has(Oh)),[e]),l=u=>{var y,b,k;const d=(y=u.connections.find(j=>j.predicate===x1))==null?void 0:y.targetUri,f=(b=u.connections.find(j=>j.predicate===w1))==null?void 0:b.targetUri,h=((k=u.properties.get(Oh))==null?void 0:k[0])??"",{ref:g,contentType:m}=LD(d,f,h);a({id:OD(t??"",g??u.uri,m),label:u.label,closable:!0,icon:"📄"})};return s.length===0?o.jsx("div",{className:"v10-docs-placeholder v10-layer-empty-shell",style:{flex:1},"data-cg-scroll-key":n,children:o.jsx(ln,{compact:!0,title:"No documents in this layer yet.",description:"Import a file to add document-backed entities."})}):o.jsx("div",{className:"v10-layer-detail-content","data-cg-scroll-key":n,children:o.jsx("div",{className:"v10-items-list",children:s.map(u=>{var m,y,b,k;const d=((m=u.properties.get(Oh))==null?void 0:m[0])??"",f=(y=u.connections.find(j=>j.predicate===x1||j.predicate===w1))==null?void 0:y.targetUri,h=f?e.find(j=>j.uri===f):void 0,g=((b=h==null?void 0:h.properties.get(k1))==null?void 0:b[0])??((k=u.properties.get(k1))==null?void 0:k[0]);return o.jsxs("div",{className:"v10-item-row",onClick:()=>l(u),children:[o.jsx("span",{className:"v10-item-icon",children:"📄"}),o.jsxs("div",{className:"v10-item-info",children:[o.jsx("div",{className:"v10-item-name",children:u.label}),o.jsxs("div",{className:"v10-item-meta-row",children:[d&&o.jsx("span",{className:"v10-item-type",children:d}),g&&o.jsxs("span",{className:"v10-item-count",children:["· ",Math.round(parseInt(g)/1024),"KB"]})]})]}),o.jsx("button",{className:"v10-item-promote-btn",onClick:j=>{j.stopPropagation(),l(u)},children:"Open →"})]},u.uri)})})})}function Ej(e){return`SELECT ?g ?s ?p ?o WHERE {
1287
+ GRAPH ?g { ?s ?p ?o }
1288
+ ${zm(e)}
1289
+ }
1290
+ LIMIT 1000`}const sa="__context_graph",po="ui-saved-queries",md="Saved queries",gd="User-created SPARQL saved in this node profile for this Context Graph.",Jr="http://dkg.io/ontology/profile/",O1="http://schema.org/",L1="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",UD="http://www.w3.org/2001/XMLSchema#integer";function M1(e){return JSON.stringify(e)}function zm(e){const t=`did:dkg:context-graph:${e}`,n=`${t}/`;return`FILTER(
1291
+ (
1292
+ STR(?g) = ${M1(t)} ||
1293
+ STRSTARTS(STR(?g), ${M1(n)})
1294
+ ) &&
1295
+ !CONTAINS(STR(?g), "/_private")
1296
+ )`}function BD(e){const t="whole-context-graph",n="Context graph",s=sa,l=u=>({subGraph:s,catalogSlug:t,catalogName:n,catalogDescription:"Ready-made SPARQL included with the Node UI for common Context Graph checks.",catalogRank:-100,resultColumn:"",...u});return{slug:t,subGraph:s,name:n,description:"Ready-made SPARQL included with the Node UI for common Context Graph checks.",rank:-100,queries:[l({slug:"all-triples",name:"All triples",description:"Show triples across available non-private graphs in this context graph.",sparql:Ej(e),resultColumn:"o",rank:1}),l({slug:"graphs",name:"Graphs",description:"List available non-private named graphs and triple counts.",sparql:`SELECT ?g (COUNT(*) AS ?triples) WHERE {
1297
+ GRAPH ?g { ?s ?p ?o }
1298
+ ${zm(e)}
1299
+ }
1300
+ GROUP BY ?g
1301
+ ORDER BY DESC(?triples)
1302
+ LIMIT 100`,resultColumn:"g",rank:2}),l({slug:"types",name:"Types",description:"Count entities by RDF type across the context graph.",sparql:`SELECT ?type (COUNT(DISTINCT ?s) AS ?entities) WHERE {
1303
+ GRAPH ?g { ?s a ?type }
1304
+ ${zm(e)}
1305
+ }
1306
+ GROUP BY ?type
1307
+ ORDER BY DESC(?entities)
1308
+ LIMIT 100`,resultColumn:"type",rank:3})]}}function FD(e){return e.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"saved-query"}function D1(e,t,n){return`urn:dkg:profile:${encodeURIComponent(e)}:${t}:${encodeURIComponent(n)}`}function Gi(e){return JSON.stringify(e)}function z1(e){return`"${e}"^^<${UD}>`}function HD(e,t,n,a){const s=Date.now(),l=`${FD(t)}-${s.toString(36)}`,u=D1(e,"catalog",po),d=D1(e,"query",l),f={slug:l,subGraph:sa,catalogSlug:po,catalogName:md,catalogDescription:gd,catalogRank:50,name:t,description:n||void 0,sparql:a,resultColumn:"",rank:s},h=[{subject:u,predicate:L1,object:`${Jr}QueryCatalog`,graph:""},{subject:u,predicate:`${Jr}forSubGraph`,object:Gi(sa),graph:""},{subject:u,predicate:`${Jr}displayName`,object:Gi(md),graph:""},{subject:u,predicate:`${O1}description`,object:Gi(gd),graph:""},{subject:u,predicate:`${Jr}rank`,object:z1(50),graph:""},{subject:d,predicate:L1,object:`${Jr}SavedQuery`,graph:""},{subject:d,predicate:`${Jr}forSubGraph`,object:Gi(sa),graph:""},{subject:d,predicate:`${Jr}inCatalog`,object:u,graph:""},{subject:d,predicate:`${Jr}displayName`,object:Gi(t),graph:""},{subject:d,predicate:`${Jr}sparqlQuery`,object:Gi(a),graph:""},{subject:d,predicate:`${Jr}rank`,object:z1(s),graph:""}];return n&&h.push({subject:d,predicate:`${O1}description`,object:Gi(n),graph:""}),{query:f,quads:h}}function qD(e,t){const n=`${sa}|${po}`,a=e.map(l=>({...l,queries:[...l.queries]})),s=a.find(l=>`${l.subGraph}|${l.slug}`===n);return s?(s.queries=[...s.queries,t].sort((l,u)=>l.rank-u.rank||l.name.localeCompare(u.name)),a):[...a,{slug:po,subGraph:sa,name:md,description:gd,rank:50,queries:[t]}]}function $1(e){const t=new Map;for(const n of e){const a=`${n.subGraph}|${n.slug}`,s=t.get(a);if(!s){t.set(a,{...n,queries:[...n.queries]});continue}const l=new Map(s.queries.map(u=>[`${u.subGraph}|${u.catalogSlug}|${u.slug}`,u]));for(const u of n.queries){const d=`${u.subGraph}|${u.catalogSlug}|${u.slug}`;l.has(d)||l.set(d,u)}s.queries=Array.from(l.values()).sort((u,d)=>u.rank-d.rank||u.name.localeCompare(d.name))}return Array.from(t.values()).sort((n,a)=>n.subGraph.localeCompare(a.subGraph)||n.rank-a.rank||n.name.localeCompare(a.name))}function GD(e){return e==null?"":typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function VD(e){return e?e.length<=140?e:`${e.slice(0,110)}...${e.slice(-24)}`:"—"}function Hd(e){return e.subGraph===sa&&e.slug==="whole-context-graph"}function WD(e){return e.subGraph===sa?"context":"subgraph"}function ZD(e,t,n){return Hd(e)?"Built-in presets":e.subGraph===sa&&e.slug===po?md:t==="context"?e.name:`${n??e.subGraph}: ${e.name}`}function KD(e){return Hd(e)?"UI-provided SPARQL for common Context Graph checks.":e.subGraph===sa&&e.slug===po?gd:e.description??""}function YD(e,t){return Hd(e)?"Preset":t==="context"?"Saved":"Subgraph"}function QD(e){return o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Review the query or node response details, then try again."}),e&&o.jsx("span",{className:"v10-cg-query-error-detail",children:e})]})}function XD({contextGraphId:e}){const t=Ua(),n=w.useMemo(()=>Ej(e),[e]),[a,s]=w.useState(n),[l,u]=w.useState(n),[d,f]=w.useState(null),[h,g]=w.useState([]),[m,y]=w.useState(!1),[b,k]=w.useState(""),[j,N]=w.useState(""),[S,T]=w.useState(!1),[E,A]=w.useState(null),[B,_]=w.useState(null),z=w.useMemo(()=>BD(e),[e]),q=w.useMemo(()=>$1([z,...h,...(t==null?void 0:t.queryCatalogs)??[]]),[z,h,t==null?void 0:t.queryCatalogs]),M=w.useMemo(()=>t!=null&&t.loading||t!=null&&t.error?$1([z,...h]):q,[z,h,t==null?void 0:t.error,t==null?void 0:t.loading,q]);w.useEffect(()=>{s(n),u(n),f(null),g([]),y(!1),k(""),N(""),A(null),_(null)},[n]);const{data:R,loading:P,error:F,refresh:Z}=lr(()=>or(l,e),[l,e],0),I=w.useMemo(()=>{var G,O;return((G=R==null?void 0:R.result)==null?void 0:G.bindings)??((O=R==null?void 0:R.results)==null?void 0:O.bindings)??[]},[R]),$=w.useMemo(()=>q.some(G=>!Hd(G)&&G.queries.length>0),[q]),H=w.useMemo(()=>{const G=[];for(const O of I)for(const ne of Object.keys(O))G.includes(ne)||G.push(ne);return G},[I]),V=w.useCallback(()=>{const G=a.trim();if(G){if(f(null),_(null),A(null),G===l){Z();return}u(G)}},[l,a,Z]),X=w.useCallback(()=>{s(n),f(null),_(null),A(null),l===n?Z():u(n)},[l,n,Z]),Y=w.useCallback((G,O)=>{const ne=O.trim();if(ne){if(f(G),s(ne),_(null),A(null),l===ne){Z();return}u(ne)}},[l,Z]),L=w.useCallback(()=>{const G=a.trim().split(`
1309
+ `).find(O=>O.trim());k(G?G.replace(/\s+/g," ").slice(0,60):""),N(""),A(null),_(null),y(!0)},[a]),U=w.useCallback(async G=>{G.preventDefault();const O=b.trim(),ne=j.trim(),ue=a.trim();if(!O){A("Name is required.");return}if(!ue){A("Query is empty.");return}T(!0),A(null),_(null);try{const{query:le,quads:be}=HD(e,O,ne,ue);await y_(e,be),g(Ee=>qD(Ee,le));const _e=`${le.subGraph}|${le.catalogSlug}|${le.slug}`;f(_e),s(le.sparql),l===le.sparql?Z():u(le.sparql),k(""),N(""),y(!1),_("Saved to catalogue.")}catch(le){A((le==null?void 0:le.message)??"Failed to save query.")}finally{T(!1)}},[l,e,a,Z,j,b]);return o.jsxs("div",{className:"v10-memory-layer-view v10-cg-query-view",children:[o.jsxs("div",{className:"v10-mlv-header",children:[o.jsx("span",{className:"v10-mlv-icon",children:"⟐"}),o.jsxs("div",{children:[o.jsx("h2",{className:"v10-mlv-title",children:"Query Catalogue"}),o.jsx("p",{className:"v10-mlv-desc",children:"Reusable SPARQL for this Context Graph. Use UI presets or save queries for people and local agents to reuse."})]})]}),o.jsxs("section",{className:"v10-cg-query-zone v10-cg-query-zone-catalog","aria-labelledby":"query-catalogue-saved-title",children:[o.jsx("div",{className:"v10-cg-query-zone-header",children:o.jsxs("div",{children:[o.jsx("span",{className:"v10-cg-query-eyebrow",children:"Query Library"}),o.jsx("h3",{id:"query-catalogue-saved-title",children:"Choose a query"}),o.jsx("p",{children:"Load a preset or saved query into the editor below."})]})}),(t==null?void 0:t.loading)&&o.jsx(ln,{compact:!0,inline:!0,tone:"query",icon:"?",title:"Loading saved queries...",description:"Built-in presets are available while saved queries load from this node profile."}),(t==null?void 0:t.error)&&o.jsx(ln,{compact:!0,inline:!0,tone:"danger",icon:"!",title:"Saved query catalogue unavailable",description:t.error}),M.length>0&&o.jsx("div",{className:"v10-cg-query-catalog-groups",children:M.map(G=>{const O=WD(G),ne=O==="context"||t==null?void 0:t.forSubGraph(G.subGraph),ue=(ne==null?void 0:ne.color)??"#38bdf8",le=ZD(G,O,ne==null?void 0:ne.displayName),be=KD(G),_e=YD(G,O);return o.jsxs("div",{className:"v10-cg-query-catalog-group",style:{"--sg-color":ue},children:[o.jsx("div",{className:"v10-cg-query-catalog-group-header",children:o.jsxs("div",{children:[o.jsxs("div",{className:"v10-cg-query-catalog-title-row",children:[o.jsx("span",{className:"v10-cg-query-catalog-kind",children:_e}),o.jsx("h4",{children:le})]}),be&&o.jsx("p",{children:be})]})}),o.jsx("div",{className:"v10-cg-query-list",children:G.queries.map(Ee=>{const Ie=`${Ee.subGraph}|${Ee.catalogSlug}|${Ee.slug}`,We=d===Ie&&l===Ee.sparql,Se=Ee.description?`${Ee.name}. ${Ee.description}`:Ee.name;return o.jsxs("button",{type:"button",className:`v10-cg-query-chip${We?" active":""}`,title:Se,"aria-label":`Load query: ${Se}`,onClick:()=>Y(Ie,Ee.sparql),children:[o.jsx("span",{className:"v10-cg-query-chip-title",children:Ee.name}),Ee.description&&o.jsx("span",{className:"v10-cg-query-chip-desc",children:Ee.description})]},Ie)})})]},`${G.subGraph}|${G.slug}`)})}),!(t!=null&&t.loading)&&!(t!=null&&t.error)&&q.length>0&&!$&&o.jsx(ln,{compact:!0,inline:!0,tone:"query",icon:"?",title:"No saved queries yet.",description:"Use Save after editing SPARQL to keep a reusable query for this Context Graph."})]}),o.jsxs("section",{className:"v10-cg-query-zone v10-cg-query-zone-editor","aria-labelledby":"query-catalogue-editor-title",children:[o.jsx("div",{className:"v10-cg-query-zone-header",children:o.jsxs("div",{children:[o.jsx("span",{className:"v10-cg-query-eyebrow",children:"Ad-hoc SPARQL"}),o.jsx("h3",{id:"query-catalogue-editor-title",children:"Editor and results"}),o.jsx("p",{children:"Run a one-off query against this Context Graph, or save it when it should become reusable."})]})}),o.jsxs("div",{className:"v10-cg-query-editor",children:[o.jsx("textarea",{className:"v10-cg-query-textarea","aria-label":"SPARQL editor",value:a,onChange:G=>{s(G.target.value),f(null)},spellCheck:!1}),o.jsxs("div",{className:"v10-cg-query-actions",children:[o.jsx("button",{className:"v10-mlv-run-btn",type:"button",onClick:V,children:"Run"}),o.jsx("button",{className:"v10-mlv-save-btn",type:"button",onClick:L,children:"Save"}),o.jsx("button",{className:"v10-mlv-clear-btn",type:"button",onClick:X,children:"Reset"})]})]}),m&&o.jsxs("form",{className:"v10-cg-query-save-panel",onSubmit:U,children:[o.jsxs("label",{className:"v10-cg-query-save-field",children:[o.jsx("span",{children:"Name"}),o.jsx("input",{type:"text",value:b,onChange:G=>k(G.target.value),placeholder:"Query name",maxLength:80})]}),o.jsxs("label",{className:"v10-cg-query-save-field",children:[o.jsx("span",{children:"Description"}),o.jsx("input",{type:"text",value:j,onChange:G=>N(G.target.value),placeholder:"Optional",maxLength:180})]}),o.jsxs("div",{className:"v10-cg-query-save-actions",children:[o.jsx("button",{type:"button",className:"v10-mlv-clear-btn",onClick:()=>y(!1),disabled:S,children:"Cancel"}),o.jsx("button",{type:"submit",className:"v10-mlv-run-btn",disabled:S,children:S?"Saving...":"Save query"})]})]}),B&&o.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-success)"},children:B}),E&&o.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-danger)"},children:E}),o.jsxs("div",{className:"v10-cg-query-results",children:[P&&o.jsx(ln,{compact:!0,tone:"query",icon:"?",title:"Loading query results..."}),F&&o.jsx(ln,{compact:!0,tone:"danger",icon:"!",title:"Query could not run.",description:QD(F)}),!P&&!F&&I.length===0&&o.jsx(ln,{compact:!0,tone:"query",icon:"?",title:"No results for this query.",description:"Adjust the query or run a saved query against this Context Graph."}),!P&&!F&&I.length>0&&o.jsxs("div",{className:"v10-mlv-table-wrap",children:[o.jsxs("div",{className:"v10-mlv-result-count",children:[I.length," result",I.length===1?"":"s"]}),o.jsxs("table",{className:"v10-mlv-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:H.map(G=>o.jsx("th",{children:G},G))})}),o.jsx("tbody",{children:I.map((G,O)=>o.jsx("tr",{children:H.map(ne=>{const ue=GD(G[ne]);return o.jsx("td",{className:"v10-mlv-cell",title:ue,children:VD(ue)},ne)})},O))})]})]})]})]})]})}const Tj="http://dkg.io/ontology/",JD="http://www.w3.org/ns/prov#";function Aj(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function $h(e){const t=Aj(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1]:t}function ez(e){const t=Aj(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function tz(e,t){return`PREFIX dkg: <${Tj}>
1310
+ SELECT ?owner WHERE {
1311
+ GRAPH ?g { <${t}> dkg:workspaceOwner ?owner . }
1312
+ FILTER(
1313
+ STRSTARTS(STR(?g), "did:dkg:context-graph:${e}") &&
1314
+ CONTAINS(STR(?g), "_shared_memory_meta")
1315
+ )
1316
+ } LIMIT 1`}function nz(e,t){return`PREFIX dkg: <${Tj}>
1317
+ PREFIX prov: <${JD}>
1318
+ SELECT ?op ?publishedAt ?agent WHERE {
1319
+ GRAPH ?g {
1320
+ ?op a dkg:WorkspaceOperation ;
1321
+ dkg:rootEntity <${t}> ;
1322
+ dkg:publishedAt ?publishedAt .
1323
+ OPTIONAL { ?op prov:wasAttributedTo ?agent }
1324
+ }
1325
+ FILTER(
1326
+ STRSTARTS(STR(?g), "did:dkg:context-graph:${e}") &&
1327
+ CONTAINS(STR(?g), "_shared_memory_meta")
1328
+ )
1329
+ } ORDER BY DESC(?publishedAt) LIMIT 1`}const Ih={ual:null,opId:null,owner:null,publishedAt:null,publisherPeerId:null,loading:!1};function rz(e,t,n=!0){const[a,s]=w.useState(()=>({...Ih})),l=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){s({...Ih});return}const u=++l.current;s(d=>({...d,loading:!0,error:void 0})),(async()=>{var d,f;try{const[h,g]=await Promise.all([or(tz(e,t),e).catch(()=>null),or(nz(e,t),e).catch(()=>null)]);if(u!==l.current)return;const m=(((d=h==null?void 0:h.result)==null?void 0:d.bindings)??[])[0],y=(((f=g==null?void 0:g.result)==null?void 0:f.bindings)??[])[0],b=y?ez(y.op):null,k=y?$h(y.publishedAt):null,j=y!=null&&y.agent?$h(y.agent):null,N=m?$h(m.owner):null;s({ual:b,opId:b?b.slice(b.lastIndexOf(":")+1):null,owner:N,publishedAt:k||null,publisherPeerId:j,loading:!1})}catch(h){if(u!==l.current)return;s({...Ih,loading:!1,error:(h==null?void 0:h.message)??String(h)})}})()},[e,t,n]),a}function I1(e,t){if(!e)return null;for(const n of t.values())if(n.peerId&&n.peerId===e)return n.uri;return null}function Zs(e,t=6,n=4){return e?e.length<=t+n+2?e:`${e.slice(0,t)}…${e.slice(-n)}`:""}const rv="http://dkg.io/ontology/",Vi={status:"idle",ual:null,txHash:null,blockNumber:null,kaId:null,author:null,finalizedAt:null,agent:null};function jn(e){if(e==null)return"";if(typeof e=="string")return e.startsWith('"')?e.replace(/^"/,"").replace(/"(\^\^<[^>]*>|@[\w-]+)?$/,""):e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function Au(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function Si(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}function P1(e){return/[<>"{}|\\^`\s]/.test(e)?"":e}function az(e,t){const n=`did:dkg:context-graph:${e}/_meta`,a=Si(t);return`PREFIX dkg: <${rv}>
1330
+ PREFIX prov: <http://www.w3.org/ns/prov#>
1331
+ SELECT ?asrt ?tx ?block ?kaId ?batchId ?finalizedAt ?ual ?agentLc ?ualSelf ?agentSelf WHERE {
1332
+ GRAPH <${n}> {
1333
+ ?asrt dkg:publishedAtTx ?tx ;
1334
+ dkg:publishedAtBlock ?block .
1335
+ FILTER(
1336
+ STRSTARTS("${a}", STR(?asrt)) ||
1337
+ EXISTS { ?asrt dkg:assertionRootEntity <${t}> } ||
1338
+ EXISTS { ?asrt dkg:assertionEntity <${t}> }
1339
+ )
1340
+ OPTIONAL { ?asrt dkg:publishedAtKaId ?kaId . }
1341
+ OPTIONAL { ?asrt dkg:assertionFinalizedAt ?finalizedAt . }
1342
+ OPTIONAL {
1343
+ ?lc dkg:rootEntity <${t}> ;
1344
+ dkg:reservedUal ?ual .
1345
+ # Pin the lifecycle URN to the FULL assertion scope (cg + optional
1346
+ # subGraphName), not just {addr}:{name} — otherwise a same-named
1347
+ # assertion in a sibling sub-graph (urn:dkg:assertion:{cg}:{other}:{addr}:{name})
1348
+ # also STRENDS-matches and leaks the wrong reservedUal/agent/batchId.
1349
+ # cgId is a build-time constant, so anchor on it as a literal and keep its
1350
+ # slashes intact (wallet-scoped cgIds like "<addr>/<name>" embed RAW in the
1351
+ # URN via assertionLifecycleUri); only the [/sub]/{addr}/{name} tail derived
1352
+ # from ?asrt is "/"->":" converted (sub/addr/name cannot contain "/").
1353
+ FILTER(STRENDS(STR(?lc), CONCAT(
1354
+ ":${Si(e)}",
1355
+ REPLACE(STRBEFORE(STRAFTER(STR(?asrt), "did:dkg:context-graph:${Si(e)}"), "/assertion/"), "/", ":"),
1356
+ ":",
1357
+ REPLACE(STRAFTER(STR(?asrt), "/assertion/"), "/", ":")
1358
+ )))
1359
+ OPTIONAL { ?lc prov:wasAttributedTo ?agentLc . }
1360
+ }
1361
+ OPTIONAL { ?asrt dkg:reservedUal ?ualSelf . }
1362
+ OPTIONAL { ?asrt prov:wasAttributedTo ?agentSelf . }
1363
+ BIND(IRI(COALESCE(?ualSelf, ?ual)) AS ?ualNode)
1364
+ OPTIONAL { ?ualNode dkg:batchId ?batchId . }
1365
+ }
1366
+ } ORDER BY DESC(STRSTARTS("${a}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function iz(e){const t=e.match(/\/assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function sz(e,t){return`PREFIX dkg: <${rv}>
1367
+ SELECT ?source ?agent ?ts WHERE {
1368
+ GRAPH ?g {
1369
+ ?op a dkg:ShareTransition ;
1370
+ dkg:entities <${t}> ;
1371
+ dkg:source ?source ;
1372
+ dkg:agent ?agent ;
1373
+ dkg:timestamp ?ts .
1374
+ }
1375
+ FILTER(
1376
+ STRSTARTS(STR(?g), "did:dkg:context-graph:${Si(e)}/") &&
1377
+ CONTAINS(STR(?g), "_shared_memory_meta")
1378
+ )
1379
+ } ORDER BY DESC(?ts) LIMIT 1`}function oz(e,t,n,a){const s=`did:dkg:context-graph:${e}/_meta`,l=`/assertion/${n}/${a}`,u=Si(t);return`PREFIX dkg: <${rv}>
1380
+ SELECT ?ual ?tx ?block ?kaId ?finalizedAt WHERE {
1381
+ GRAPH <${s}> {
1382
+ ?asrt dkg:publishedAtTx ?tx ;
1383
+ dkg:publishedAtBlock ?block .
1384
+ OPTIONAL { ?asrt dkg:publishedAtKaId ?kaId . }
1385
+ FILTER(STRENDS(STR(?asrt), "${Si(l)}"))
1386
+ OPTIONAL { ?asrt dkg:assertionFinalizedAt ?finalizedAt . }
1387
+ OPTIONAL {
1388
+ ?lc dkg:rootEntity <${t}> ;
1389
+ dkg:reservedUal ?ual .
1390
+ FILTER(STRENDS(STR(?lc), "${Si(`:${n}:${a}`)}"))
1391
+ }
1392
+ }
1393
+ } ORDER BY DESC(STRSTARTS("${u}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function lz(e){const t=e.match(/^assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function cz(e,t,n=!0){const[a,s]=w.useState(()=>({...Vi})),l=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){s({...Vi});return}const u=++l.current;s({...Vi,status:"loading"}),(async()=>{var d,f,h;try{const g=P1(t);if(!g){s({...Vi,status:"offchain"});return}const m=await or(az(e,g),e);if(u!==l.current)return;const y=(((d=m==null?void 0:m.result)==null?void 0:d.bindings)??[])[0];if(y!=null&&y.tx){const R=y.asrt?Au(jn(y.asrt)):"",P=iz(R),F=(P==null?void 0:P.addr)??null,I=(y.agentSelf?Au(jn(y.agentSelf)):"")||(y.agentLc?Au(jn(y.agentLc)):"")||(F?`did:dkg:agent:${F.toLowerCase()}`:null),$=(y.ualSelf?jn(y.ualSelf):"")||(y.ual?jn(y.ual):""),H=(y.kaId?jn(y.kaId):"")||(y.batchId?jn(y.batchId):"");s({status:"verified",ual:$||null,txHash:jn(y.tx)||null,blockNumber:y.block?jn(y.block):null,kaId:H||null,author:F,finalizedAt:y.finalizedAt?jn(y.finalizedAt):null,agent:I});return}const b=await or(sz(e,g));if(u!==l.current)return;const k=(((f=b==null?void 0:b.result)==null?void 0:f.bindings)??[])[0];if(!k){s({...Vi,status:"offchain"});return}const j=jn(k.source),N=lz(j),S=k.agent?Au(jn(k.agent)):null,T=(N==null?void 0:N.addr)??null;if(!N||!P1(N.addr)||!Si(N.name)){s({...Vi,status:"offchain",author:T,agent:S});return}const E=await or(oz(e,g,N.addr,N.name),e);if(u!==l.current)return;const A=(((h=E==null?void 0:E.result)==null?void 0:h.bindings)??[])[0],B=A!=null&&A.ual?jn(A.ual):null,_=A!=null&&A.tx?jn(A.tx):null,z=A!=null&&A.block?jn(A.block):null,q=A!=null&&A.kaId?jn(A.kaId):null,M=A!=null&&A.finalizedAt?jn(A.finalizedAt):null;s({status:_?"verified":"offchain",ual:B||null,txHash:_||null,blockNumber:z||null,kaId:q||null,author:T,finalizedAt:M||null,agent:S})}catch(g){if(u!==l.current)return;s({...Vi,status:"error",error:(g==null?void 0:g.message)??String(g)})}})()},[e,t,n]),a}const uz=({contextGraphId:e,entityUri:t,enabled:n})=>{const a=ls(),s=rz(e,t,n),l=cz(e,t,n),{data:u}=lr(jg,[],6e4),d=u==null?void 0:u.blockExplorerUrl,f=l.ual??s.ual,h=l.status==="verified";if(!n||s.loading||!s.ual&&!s.owner&&!s.publishedAt&&!h)return null;const g=s.publishedAt?dz(s.publishedAt):null,m=s.publisherPeerId&&a?I1(s.publisherPeerId,a.agents):null,y=m?(a==null?void 0:a.get(m))??null:null,b=s.owner&&a?I1(s.owner,a.agents):null,k=b?(a==null?void 0:a.get(b))??null:null,j=N=>{var S;(S=navigator.clipboard)==null||S.writeText(N).catch(()=>{})};return o.jsxs("div",{className:"v10-vm-identity",children:[o.jsxs("div",{className:"v10-vm-identity-head",children:[o.jsx("span",{className:"v10-vm-identity-glyph",children:"◉"}),o.jsx("span",{className:"v10-vm-identity-title",children:"On-chain identity"}),o.jsx("span",{className:"v10-vm-identity-badge",children:"VERIFIED"})]}),f&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"UAL"}),o.jsx("span",{className:"v10-vm-identity-val mono",title:f,children:f}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(f),title:"Copy UAL",children:"⎘"})]}),h&&l.txHash&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"Tx"}),d?o.jsxs("a",{className:"v10-vm-identity-val mono",href:`${d}/tx/${l.txHash}`,target:"_blank",rel:"noopener noreferrer",title:l.txHash,children:[Zs(l.txHash,10,8)," ↗"]}):o.jsx("span",{className:"v10-vm-identity-val mono",title:l.txHash,children:Zs(l.txHash,10,8)}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(l.txHash),title:"Copy transaction hash",children:"⎘"}),l.blockNumber&&o.jsxs("span",{className:"v10-vm-identity-opid mono",children:["· block ",l.blockNumber]})]}),h&&l.kaId&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"KA id"}),o.jsx("span",{className:"v10-vm-identity-val mono",title:l.kaId,children:Zs(l.kaId,8,8)}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(l.kaId),title:"Copy KA id",children:"⎘"})]}),(k||s.owner)&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"Owner"}),k?o.jsxs("span",{className:"v10-vm-identity-val",children:[o.jsx(es,{agent:k,size:"sm"}),k.walletAddress&&o.jsx("span",{className:"v10-vm-identity-wallet mono",title:k.walletAddress,children:Zs(k.walletAddress,6,4)})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-vm-identity-val mono",title:s.owner??"",children:Zs(s.owner,8,6)}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(s.owner),title:"Copy owner id",children:"⎘"})]})]}),g&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"Published"}),o.jsx("span",{className:"v10-vm-identity-val",title:s.publishedAt??"",children:g}),s.opId&&o.jsxs("span",{className:"v10-vm-identity-opid mono",title:`Anchor op: ${s.opId}`,children:["· anchor ",s.opId.slice(0,10)]})]}),(y||s.publisherPeerId)&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"By"}),y?o.jsx(es,{agent:y,size:"sm"}):o.jsx("span",{className:"v10-vm-identity-val mono",title:s.publisherPeerId??"",children:Zs(s.publisherPeerId,8,6)})]})]})};function dz(e){const t=new Date(e.replace(/^"|"$/g,""));return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):e}function ve(e,t,n){function a(d,f){var h;Object.defineProperty(d,"_zod",{value:d._zod??{},enumerable:!1}),(h=d._zod).traits??(h.traits=new Set),d._zod.traits.add(e),t(d,f);for(const g in u.prototype)g in d||Object.defineProperty(d,g,{value:u.prototype[g].bind(d)});d._zod.constr=u,d._zod.def=f}const s=(n==null?void 0:n.Parent)??Object;class l extends s{}Object.defineProperty(l,"name",{value:e});function u(d){var f;const h=n!=null&&n.Parent?new l:this;a(h,d),(f=h._zod).deferred??(f.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(u,"init",{value:a}),Object.defineProperty(u,Symbol.hasInstance,{value:d=>{var f,h;return n!=null&&n.Parent&&d instanceof n.Parent?!0:(h=(f=d==null?void 0:d._zod)==null?void 0:f.traits)==null?void 0:h.has(e)}}),Object.defineProperty(u,"name",{value:e}),u}class Bl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const _j={};function ts(e){return _j}function Rj(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,s])=>t.indexOf(+a)===-1).map(([a,s])=>s)}function pz(e,t){return typeof t=="bigint"?t.toString():t}function Oj(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function av(e){return e==null}function iv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function fz(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=n>a?n:a,l=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(t.toFixed(s).replace(".",""));return l%u/10**s}function Ut(e,t,n){Object.defineProperty(e,t,{get(){{const a=n();return e[t]=a,a}},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function sv(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function bl(e){return JSON.stringify(e)}const Lj=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function $m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const hz=Oj(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Im(e){if($m(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!($m(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const mz=new Set(["string","number","symbol"]);function qd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cs(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(a._zod.parent=e),a}function Ue(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function gz(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const vz={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function yz(e,t){const n={},a=e._zod.def;for(const s in t){if(!(s in a.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(n[s]=a.shape[s])}return cs(e,{...e._zod.def,shape:n,checks:[]})}function bz(e,t){const n={...e._zod.def.shape},a=e._zod.def;for(const s in t){if(!(s in a.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete n[s]}return cs(e,{...e._zod.def,shape:n,checks:[]})}function xz(e,t){if(!Im(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const a={...e._zod.def.shape,...t};return sv(this,"shape",a),a},checks:[]};return cs(e,n)}function wz(e,t){return cs(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return sv(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function kz(e,t,n){const a=t._zod.def.shape,s={...a};if(n)for(const l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(s[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(const l in a)s[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return cs(t,{...t._zod.def,shape:s,checks:[]})}function Sz(e,t,n){const a=t._zod.def.shape,s={...a};if(n)for(const l in n){if(!(l in s))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(s[l]=new e({type:"nonoptional",innerType:a[l]}))}else for(const l in a)s[l]=new e({type:"nonoptional",innerType:a[l]});return cs(t,{...t._zod.def,shape:s,checks:[]})}function Ol(e,t=0){var n;for(let a=t;a<e.issues.length;a++)if(((n=e.issues[a])==null?void 0:n.continue)!==!0)return!0;return!1}function ov(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function _u(e){return typeof e=="string"?e:e==null?void 0:e.message}function ns(e,t,n){var s,l,u,d,f,h;const a={...e,path:e.path??[]};if(!e.message){const g=_u((u=(l=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:l.error)==null?void 0:u.call(l,e))??_u((d=t==null?void 0:t.error)==null?void 0:d.call(t,e))??_u((f=n.customError)==null?void 0:f.call(n,e))??_u((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";a.message=g}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function lv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Fl(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const Mj=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,pz,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Dj=ve("$ZodError",Mj),zj=ve("$ZodError",Mj,{Parent:Error});function jz(e,t=n=>n.message){const n={},a=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):a.push(t(s));return{formErrors:a,fieldErrors:n}}function Cz(e,t){const n=t||function(l){return l.message},a={_errors:[]},s=l=>{for(const u of l.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>s({issues:d}));else if(u.code==="invalid_key")s({issues:u.issues});else if(u.code==="invalid_element")s({issues:u.issues});else if(u.path.length===0)a._errors.push(n(u));else{let d=a,f=0;for(;f<u.path.length;){const h=u.path[f];f===u.path.length-1?(d[h]=d[h]||{_errors:[]},d[h]._errors.push(n(u))):d[h]=d[h]||{_errors:[]},d=d[h],f++}}};return s(e),a}const Nz=e=>(t,n,a,s)=>{const l=a?Object.assign(a,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},l);if(u instanceof Promise)throw new Bl;if(u.issues.length){const d=new((s==null?void 0:s.Err)??e)(u.issues.map(f=>ns(f,l,ts())));throw Lj(d,s==null?void 0:s.callee),d}return u.value},Ez=e=>async(t,n,a,s)=>{const l=a?Object.assign(a,{async:!0}):{async:!0};let u=t._zod.run({value:n,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const d=new((s==null?void 0:s.Err)??e)(u.issues.map(f=>ns(f,l,ts())));throw Lj(d,s==null?void 0:s.callee),d}return u.value},$j=e=>(t,n,a)=>{const s=a?{...a,async:!1}:{async:!1},l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new Bl;return l.issues.length?{success:!1,error:new(e??Dj)(l.issues.map(u=>ns(u,s,ts())))}:{success:!0,data:l.value}},Tz=$j(zj),Ij=e=>async(t,n,a)=>{const s=a?Object.assign(a,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},s);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>ns(u,s,ts())))}:{success:!0,data:l.value}},Az=Ij(zj),_z=/^[cC][^\s-]{8,}$/,Rz=/^[0-9a-z]+$/,Oz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lz=/^[0-9a-vA-V]{20}$/,Mz=/^[A-Za-z0-9]{27}$/,Dz=/^[a-zA-Z0-9_-]{21}$/,zz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$z=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,U1=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,Iz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Pz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Uz(){return new RegExp(Pz,"u")}const Bz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Fz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Hz=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,qz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Gz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Pj=/^[A-Za-z0-9_-]*$/,Vz=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Wz=/^\+(?:[0-9]){6,14}[0-9]$/,Uj="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Zz=new RegExp(`^${Uj}$`);function Bj(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Kz(e){return new RegExp(`^${Bj(e)}$`)}function Yz(e){const t=Bj({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const a=`${t}(?:${n.join("|")})`;return new RegExp(`^${Uj}T(?:${a})$`)}const Qz=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Xz=/^\d+$/,Jz=/^-?\d+(?:\.\d+)?/i,e$=/^[^A-Z]*$/,t$=/^[^a-z]*$/,Wn=ve("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Fj={number:"number",bigint:"bigint",object:"date"},Hj=ve("$ZodCheckLessThan",(e,t)=>{Wn.init(e,t);const n=Fj[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,l=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<l&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qj=ve("$ZodCheckGreaterThan",(e,t)=>{Wn.init(e,t);const n=Fj[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,l=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),n$=ve("$ZodCheckMultipleOf",(e,t)=>{Wn.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):fz(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),r$=ve("$ZodCheckNumberFormat",(e,t)=>{var u;Wn.init(e,t),t.format=t.format||"float64";const n=(u=t.format)==null?void 0:u.includes("int"),a=n?"int":"number",[s,l]=vz[t.format];e._zod.onattach.push(d=>{const f=d._zod.bag;f.format=t.format,f.minimum=s,f.maximum=l,n&&(f.pattern=Xz)}),e._zod.check=d=>{const f=d.value;if(n){if(!Number.isInteger(f)){d.issues.push({expected:a,format:t.format,code:"invalid_type",input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?d.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}):d.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort});return}}f<s&&d.issues.push({origin:"number",input:f,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),f>l&&d.issues.push({origin:"number",input:f,code:"too_big",maximum:l,inst:e})}}),a$=ve("$ZodCheckMaxLength",(e,t)=>{var n;Wn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!av(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const s=a.value;if(s.length<=t.maximum)return;const u=lv(s);a.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),i$=ve("$ZodCheckMinLength",(e,t)=>{var n;Wn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!av(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const s=a.value;if(s.length>=t.minimum)return;const u=lv(s);a.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),s$=ve("$ZodCheckLengthEquals",(e,t)=>{var n;Wn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!av(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=a=>{const s=a.value,l=s.length;if(l===t.length)return;const u=lv(s),d=l>t.length;a.issues.push({origin:u,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),Gd=ve("$ZodCheckStringFormat",(e,t)=>{var n,a;Wn.init(e,t),e._zod.onattach.push(s=>{const l=s._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),o$=ve("$ZodCheckRegex",(e,t)=>{Gd.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),l$=ve("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=e$),Gd.init(e,t)}),c$=ve("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=t$),Gd.init(e,t)}),u$=ve("$ZodCheckIncludes",(e,t)=>{Wn.init(e,t);const n=qd(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(s=>{const l=s._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(a)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),d$=ve("$ZodCheckStartsWith",(e,t)=>{Wn.init(e,t);const n=new RegExp(`^${qd(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),p$=ve("$ZodCheckEndsWith",(e,t)=>{Wn.init(e,t);const n=new RegExp(`.*${qd(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),f$=ve("$ZodCheckOverwrite",(e,t)=>{Wn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class h${constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
1394
+ `).filter(u=>u),s=Math.min(...a.map(u=>u.length-u.trimStart().length)),l=a.map(u=>u.slice(s)).map(u=>" ".repeat(this.indent*2)+u);for(const u of l)this.content.push(u)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(l=>` ${l}`)];return new t(...n,s.join(`
1395
+ `))}}const m$={major:4,minor:0,patch:0},en=ve("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=m$;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const l of a)for(const u of l._zod.onattach)u(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const l=(u,d,f)=>{let h=Ol(u),g;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(h)continue;const y=u.issues.length,b=m._zod.check(u);if(b instanceof Promise&&(f==null?void 0:f.async)===!1)throw new Bl;if(g||b instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await b,u.issues.length!==y&&(h||(h=Ol(u,y)))});else{if(u.issues.length===y)continue;h||(h=Ol(u,y))}}return g?g.then(()=>u):u};e._zod.run=(u,d)=>{const f=e._zod.parse(u,d);if(f instanceof Promise){if(d.async===!1)throw new Bl;return f.then(h=>l(h,a,d))}return l(f,a,d)}}e["~standard"]={validate:l=>{var u;try{const d=Tz(e,l);return d.success?{value:d.data}:{issues:(u=d.error)==null?void 0:u.issues}}catch{return Az(e,l).then(f=>{var h;return f.success?{value:f.data}:{issues:(h=f.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}}),cv=ve("$ZodString",(e,t)=>{var n;en.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Qz(e._zod.bag),e._zod.parse=(a,s)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),Ht=ve("$ZodStringFormat",(e,t)=>{Gd.init(e,t),cv.init(e,t)}),g$=ve("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=$z),Ht.init(e,t)}),v$=ve("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=U1(a))}else t.pattern??(t.pattern=U1());Ht.init(e,t)}),y$=ve("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Iz),Ht.init(e,t)}),b$=ve("$ZodURL",(e,t)=>{Ht.init(e,t),e._zod.check=n=>{try{const a=n.value,s=new URL(a),l=s.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Vz.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!a.endsWith("/")&&l.endsWith("/")?n.value=l.slice(0,-1):n.value=l;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),x$=ve("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Uz()),Ht.init(e,t)}),w$=ve("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Dz),Ht.init(e,t)}),k$=ve("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=_z),Ht.init(e,t)}),S$=ve("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Rz),Ht.init(e,t)}),j$=ve("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Oz),Ht.init(e,t)}),C$=ve("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Lz),Ht.init(e,t)}),N$=ve("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Mz),Ht.init(e,t)}),E$=ve("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Yz(t)),Ht.init(e,t)}),T$=ve("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Zz),Ht.init(e,t)}),A$=ve("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Kz(t)),Ht.init(e,t)}),_$=ve("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=zz),Ht.init(e,t)}),R$=ve("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Bz),Ht.init(e,t),e._zod.onattach.push(n=>{const a=n._zod.bag;a.format="ipv4"})}),O$=ve("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Fz),Ht.init(e,t),e._zod.onattach.push(n=>{const a=n._zod.bag;a.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),L$=ve("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Hz),Ht.init(e,t)}),M$=ve("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=qz),Ht.init(e,t),e._zod.check=n=>{const[a,s]=n.value.split("/");try{if(!s)throw new Error;const l=Number(s);if(`${l}`!==s)throw new Error;if(l<0||l>128)throw new Error;new URL(`http://[${a}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Gj(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const D$=ve("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Gz),Ht.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{Gj(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function z$(e){if(!Pj.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Gj(n)}const $$=ve("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Pj),Ht.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{z$(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),I$=ve("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Wz),Ht.init(e,t)});function P$(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const s=JSON.parse(atob(a));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const U$=ve("$ZodJWT",(e,t)=>{Ht.init(e,t),e._zod.check=n=>{P$(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Vj=ve("$ZodNumber",(e,t)=>{en.init(e,t),e._zod.pattern=e._zod.bag.pattern??Jz,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const l=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...l?{received:l}:{}}),n}}),B$=ve("$ZodNumber",(e,t)=>{r$.init(e,t),Vj.init(e,t)}),F$=ve("$ZodUnknown",(e,t)=>{en.init(e,t),e._zod.parse=n=>n}),H$=ve("$ZodNever",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function B1(e,t,n){e.issues.length&&t.issues.push(...ov(n,e.issues)),t.value[n]=e.value}const q$=ve("$ZodArray",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const l=[];for(let u=0;u<s.length;u++){const d=s[u],f=t.element._zod.run({value:d,issues:[]},a);f instanceof Promise?l.push(f.then(h=>B1(h,n,u))):B1(f,n,u)}return l.length?Promise.all(l).then(()=>n):n}});function Ru(e,t,n){e.issues.length&&t.issues.push(...ov(n,e.issues)),t.value[n]=e.value}function F1(e,t,n,a){e.issues.length?a[n]===void 0?n in a?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...ov(n,e.issues)):e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}const G$=ve("$ZodObject",(e,t)=>{en.init(e,t);const n=Oj(()=>{const m=Object.keys(t.shape);for(const b of m)if(!(t.shape[b]instanceof en))throw new Error(`Invalid element at key "${b}": expected a Zod schema`);const y=gz(t.shape);return{shape:t.shape,keys:m,keySet:new Set(m),numKeys:m.length,optionalKeys:new Set(y)}});Ut(e._zod,"propValues",()=>{const m=t.shape,y={};for(const b in m){const k=m[b]._zod;if(k.values){y[b]??(y[b]=new Set);for(const j of k.values)y[b].add(j)}}return y});const a=m=>{const y=new h$(["shape","payload","ctx"]),b=n.value,k=T=>{const E=bl(T);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};y.write("const input = payload.value;");const j=Object.create(null);let N=0;for(const T of b.keys)j[T]=`key_${N++}`;y.write("const newResult = {}");for(const T of b.keys)if(b.optionalKeys.has(T)){const E=j[T];y.write(`const ${E} = ${k(T)};`);const A=bl(T);y.write(`
1396
+ if (${E}.issues.length) {
1397
+ if (input[${A}] === undefined) {
1398
+ if (${A} in input) {
1399
+ newResult[${A}] = undefined;
1400
+ }
1401
+ } else {
1402
+ payload.issues = payload.issues.concat(
1403
+ ${E}.issues.map((iss) => ({
1404
+ ...iss,
1405
+ path: iss.path ? [${A}, ...iss.path] : [${A}],
1406
+ }))
1407
+ );
1408
+ }
1409
+ } else if (${E}.value === undefined) {
1410
+ if (${A} in input) newResult[${A}] = undefined;
1411
+ } else {
1412
+ newResult[${A}] = ${E}.value;
1413
+ }
1414
+ `)}else{const E=j[T];y.write(`const ${E} = ${k(T)};`),y.write(`
1415
+ if (${E}.issues.length) payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
1416
+ ...iss,
1417
+ path: iss.path ? [${bl(T)}, ...iss.path] : [${bl(T)}]
1418
+ })));`),y.write(`newResult[${bl(T)}] = ${E}.value`)}y.write("payload.value = newResult;"),y.write("return payload;");const S=y.compile();return(T,E)=>S(m,T,E)};let s;const l=$m,u=!_j.jitless,f=u&&hz.value,h=t.catchall;let g;e._zod.parse=(m,y)=>{g??(g=n.value);const b=m.value;if(!l(b))return m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m;const k=[];if(u&&f&&(y==null?void 0:y.async)===!1&&y.jitless!==!0)s||(s=a(t.shape)),m=s(m,y);else{m.value={};const E=g.shape;for(const A of g.keys){const B=E[A],_=B._zod.run({value:b[A],issues:[]},y),z=B._zod.optin==="optional"&&B._zod.optout==="optional";_ instanceof Promise?k.push(_.then(q=>z?F1(q,m,A,b):Ru(q,m,A))):z?F1(_,m,A,b):Ru(_,m,A)}}if(!h)return k.length?Promise.all(k).then(()=>m):m;const j=[],N=g.keySet,S=h._zod,T=S.def.type;for(const E of Object.keys(b)){if(N.has(E))continue;if(T==="never"){j.push(E);continue}const A=S.run({value:b[E],issues:[]},y);A instanceof Promise?k.push(A.then(B=>Ru(B,m,E))):Ru(A,m,E)}return j.length&&m.issues.push({code:"unrecognized_keys",keys:j,input:b,inst:e}),k.length?Promise.all(k).then(()=>m):m}});function H1(e,t,n,a){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(l=>ns(l,a,ts())))}),t}const V$=ve("$ZodUnion",(e,t)=>{en.init(e,t),Ut(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Ut(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Ut(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Ut(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${n.map(a=>iv(a.source)).join("|")})$`)}}),e._zod.parse=(n,a)=>{let s=!1;const l=[];for(const u of t.options){const d=u._zod.run({value:n.value,issues:[]},a);if(d instanceof Promise)l.push(d),s=!0;else{if(d.issues.length===0)return d;l.push(d)}}return s?Promise.all(l).then(u=>H1(u,n,e,a)):H1(l,n,e,a)}}),W$=ve("$ZodIntersection",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{const s=n.value,l=t.left._zod.run({value:s,issues:[]},a),u=t.right._zod.run({value:s,issues:[]},a);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([f,h])=>q1(n,f,h)):q1(n,l,u)}});function Pm(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Im(e)&&Im(t)){const n=Object.keys(t),a=Object.keys(e).filter(l=>n.indexOf(l)!==-1),s={...e,...t};for(const l of a){const u=Pm(e[l],t[l]);if(!u.valid)return{valid:!1,mergeErrorPath:[l,...u.mergeErrorPath]};s[l]=u.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const s=e[a],l=t[a],u=Pm(s,l);if(!u.valid)return{valid:!1,mergeErrorPath:[a,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function q1(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Ol(e))return e;const a=Pm(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Z$=ve("$ZodEnum",(e,t)=>{en.init(e,t);const n=Rj(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(a=>mz.has(typeof a)).map(a=>typeof a=="string"?qd(a):a.toString()).join("|")})$`),e._zod.parse=(a,s)=>{const l=a.value;return e._zod.values.has(l)||a.issues.push({code:"invalid_value",values:n,input:l,inst:e}),a}}),K$=ve("$ZodTransform",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{const s=t.transform(n.value,n);if(a.async)return(s instanceof Promise?s:Promise.resolve(s)).then(u=>(n.value=u,n));if(s instanceof Promise)throw new Bl;return n.value=s,n}}),Y$=ve("$ZodOptional",(e,t)=>{en.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ut(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ut(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${iv(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,a):n.value===void 0?n:t.innerType._zod.run(n,a)}),Q$=ve("$ZodNullable",(e,t)=>{en.init(e,t),Ut(e._zod,"optin",()=>t.innerType._zod.optin),Ut(e._zod,"optout",()=>t.innerType._zod.optout),Ut(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${iv(n.source)}|null)$`):void 0}),Ut(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),X$=ve("$ZodDefault",(e,t)=>{en.init(e,t),e._zod.optin="optional",Ut(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(l=>G1(l,t)):G1(s,t)}});function G1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const J$=ve("$ZodPrefault",(e,t)=>{en.init(e,t),e._zod.optin="optional",Ut(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,a))}),eI=ve("$ZodNonOptional",(e,t)=>{en.init(e,t),Ut(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(l=>V1(l,e)):V1(s,e)}});function V1(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const tI=ve("$ZodCatch",(e,t)=>{en.init(e,t),e._zod.optin="optional",Ut(e._zod,"optout",()=>t.innerType._zod.optout),Ut(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(l=>(n.value=l.value,l.issues.length&&(n.value=t.catchValue({...n,error:{issues:l.issues.map(u=>ns(u,a,ts()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(l=>ns(l,a,ts()))},input:n.value}),n.issues=[]),n)}}),nI=ve("$ZodPipe",(e,t)=>{en.init(e,t),Ut(e._zod,"values",()=>t.in._zod.values),Ut(e._zod,"optin",()=>t.in._zod.optin),Ut(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,a)=>{const s=t.in._zod.run(n,a);return s instanceof Promise?s.then(l=>W1(l,t,a)):W1(s,t,a)}});function W1(e,t,n){return Ol(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const rI=ve("$ZodReadonly",(e,t)=>{en.init(e,t),Ut(e._zod,"propValues",()=>t.innerType._zod.propValues),Ut(e._zod,"values",()=>t.innerType._zod.values),Ut(e._zod,"optin",()=>t.innerType._zod.optin),Ut(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(Z1):Z1(s)}});function Z1(e){return e.value=Object.freeze(e.value),e}const aI=ve("$ZodCustom",(e,t)=>{Wn.init(e,t),en.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,s=t.fn(a);if(s instanceof Promise)return s.then(l=>K1(l,n,a,e));K1(s,n,a,e)}});function K1(e,t,n,a){if(!e){const s={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(s.params=a._zod.def.params),t.issues.push(Fl(s))}}class Wj{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const a=n[0];if(this._map.set(t,a),a&&typeof a=="object"&&"id"in a){if(this._idmap.has(a.id))throw new Error(`ID ${a.id} already exists in the registry`);this._idmap.set(a.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const a={...this.get(n)??{}};return delete a.id,{...a,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function Zj(){return new Wj}const Al=Zj();function iI(e,t){return new e({type:"string",...Ue(t)})}function sI(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ue(t)})}function Y1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ue(t)})}function oI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ue(t)})}function lI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ue(t)})}function cI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ue(t)})}function uI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ue(t)})}function dI(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ue(t)})}function pI(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ue(t)})}function fI(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ue(t)})}function hI(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ue(t)})}function mI(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ue(t)})}function gI(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ue(t)})}function vI(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ue(t)})}function yI(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ue(t)})}function bI(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ue(t)})}function xI(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ue(t)})}function wI(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ue(t)})}function kI(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ue(t)})}function SI(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ue(t)})}function jI(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ue(t)})}function CI(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ue(t)})}function NI(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ue(t)})}function EI(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ue(t)})}function TI(e,t){return new e({type:"string",format:"date",check:"string_format",...Ue(t)})}function AI(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ue(t)})}function _I(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ue(t)})}function RI(e,t){return new e({type:"number",checks:[],...Ue(t)})}function OI(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ue(t)})}function LI(e){return new e({type:"unknown"})}function MI(e,t){return new e({type:"never",...Ue(t)})}function Q1(e,t){return new Hj({check:"less_than",...Ue(t),value:e,inclusive:!1})}function Ph(e,t){return new Hj({check:"less_than",...Ue(t),value:e,inclusive:!0})}function X1(e,t){return new qj({check:"greater_than",...Ue(t),value:e,inclusive:!1})}function Uh(e,t){return new qj({check:"greater_than",...Ue(t),value:e,inclusive:!0})}function J1(e,t){return new n$({check:"multiple_of",...Ue(t),value:e})}function Kj(e,t){return new a$({check:"max_length",...Ue(t),maximum:e})}function vd(e,t){return new i$({check:"min_length",...Ue(t),minimum:e})}function Yj(e,t){return new s$({check:"length_equals",...Ue(t),length:e})}function DI(e,t){return new o$({check:"string_format",format:"regex",...Ue(t),pattern:e})}function zI(e){return new l$({check:"string_format",format:"lowercase",...Ue(e)})}function $I(e){return new c$({check:"string_format",format:"uppercase",...Ue(e)})}function II(e,t){return new u$({check:"string_format",format:"includes",...Ue(t),includes:e})}function PI(e,t){return new d$({check:"string_format",format:"starts_with",...Ue(t),prefix:e})}function UI(e,t){return new p$({check:"string_format",format:"ends_with",...Ue(t),suffix:e})}function ec(e){return new f$({check:"overwrite",tx:e})}function BI(e){return ec(t=>t.normalize(e))}function FI(){return ec(e=>e.trim())}function HI(){return ec(e=>e.toLowerCase())}function qI(){return ec(e=>e.toUpperCase())}function GI(e,t,n){return new e({type:"array",element:t,...Ue(n)})}function VI(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ue(n)})}class ew{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??Al,this.target=(t==null?void 0:t.target)??"draft-2020-12",this.unrepresentable=(t==null?void 0:t.unrepresentable)??"throw",this.override=(t==null?void 0:t.override)??(()=>{}),this.io=(t==null?void 0:t.io)??"output",this.seen=new Map}process(t,n={path:[],schemaPath:[]}){var m,y,b;var a;const s=t._zod.def,l={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},u=this.seen.get(t);if(u)return u.count++,n.schemaPath.includes(t)&&(u.cycle=n.path),u.schema;const d={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,d);const f=(y=(m=t._zod).toJSONSchema)==null?void 0:y.call(m);if(f)d.schema=f;else{const k={...n,schemaPath:[...n.schemaPath,t],path:n.path},j=t._zod.parent;if(j)d.ref=j,this.process(j,k),this.seen.get(j).isParent=!0;else{const N=d.schema;switch(s.type){case"string":{const S=N;S.type="string";const{minimum:T,maximum:E,format:A,patterns:B,contentEncoding:_}=t._zod.bag;if(typeof T=="number"&&(S.minLength=T),typeof E=="number"&&(S.maxLength=E),A&&(S.format=l[A]??A,S.format===""&&delete S.format),_&&(S.contentEncoding=_),B&&B.size>0){const z=[...B];z.length===1?S.pattern=z[0].source:z.length>1&&(d.schema.allOf=[...z.map(q=>({...this.target==="draft-7"?{type:"string"}:{},pattern:q.source}))])}break}case"number":{const S=N,{minimum:T,maximum:E,format:A,multipleOf:B,exclusiveMaximum:_,exclusiveMinimum:z}=t._zod.bag;typeof A=="string"&&A.includes("int")?S.type="integer":S.type="number",typeof z=="number"&&(S.exclusiveMinimum=z),typeof T=="number"&&(S.minimum=T,typeof z=="number"&&(z>=T?delete S.minimum:delete S.exclusiveMinimum)),typeof _=="number"&&(S.exclusiveMaximum=_),typeof E=="number"&&(S.maximum=E,typeof _=="number"&&(_<=E?delete S.maximum:delete S.exclusiveMaximum)),typeof B=="number"&&(S.multipleOf=B);break}case"boolean":{const S=N;S.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{N.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{N.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const S=N,{minimum:T,maximum:E}=t._zod.bag;typeof T=="number"&&(S.minItems=T),typeof E=="number"&&(S.maxItems=E),S.type="array",S.items=this.process(s.element,{...k,path:[...k.path,"items"]});break}case"object":{const S=N;S.type="object",S.properties={};const T=s.shape;for(const B in T)S.properties[B]=this.process(T[B],{...k,path:[...k.path,"properties",B]});const E=new Set(Object.keys(T)),A=new Set([...E].filter(B=>{const _=s.shape[B]._zod;return this.io==="input"?_.optin===void 0:_.optout===void 0}));A.size>0&&(S.required=Array.from(A)),((b=s.catchall)==null?void 0:b._zod.def.type)==="never"?S.additionalProperties=!1:s.catchall?s.catchall&&(S.additionalProperties=this.process(s.catchall,{...k,path:[...k.path,"additionalProperties"]})):this.io==="output"&&(S.additionalProperties=!1);break}case"union":{const S=N;S.anyOf=s.options.map((T,E)=>this.process(T,{...k,path:[...k.path,"anyOf",E]}));break}case"intersection":{const S=N,T=this.process(s.left,{...k,path:[...k.path,"allOf",0]}),E=this.process(s.right,{...k,path:[...k.path,"allOf",1]}),A=_=>"allOf"in _&&Object.keys(_).length===1,B=[...A(T)?T.allOf:[T],...A(E)?E.allOf:[E]];S.allOf=B;break}case"tuple":{const S=N;S.type="array";const T=s.items.map((B,_)=>this.process(B,{...k,path:[...k.path,"prefixItems",_]}));if(this.target==="draft-2020-12"?S.prefixItems=T:S.items=T,s.rest){const B=this.process(s.rest,{...k,path:[...k.path,"items"]});this.target==="draft-2020-12"?S.items=B:S.additionalItems=B}s.rest&&(S.items=this.process(s.rest,{...k,path:[...k.path,"items"]}));const{minimum:E,maximum:A}=t._zod.bag;typeof E=="number"&&(S.minItems=E),typeof A=="number"&&(S.maxItems=A);break}case"record":{const S=N;S.type="object",S.propertyNames=this.process(s.keyType,{...k,path:[...k.path,"propertyNames"]}),S.additionalProperties=this.process(s.valueType,{...k,path:[...k.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const S=N,T=Rj(s.entries);T.every(E=>typeof E=="number")&&(S.type="number"),T.every(E=>typeof E=="string")&&(S.type="string"),S.enum=T;break}case"literal":{const S=N,T=[];for(const E of s.values)if(E===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof E=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");T.push(Number(E))}else T.push(E);if(T.length!==0)if(T.length===1){const E=T[0];S.type=E===null?"null":typeof E,S.const=E}else T.every(E=>typeof E=="number")&&(S.type="number"),T.every(E=>typeof E=="string")&&(S.type="string"),T.every(E=>typeof E=="boolean")&&(S.type="string"),T.every(E=>E===null)&&(S.type="null"),S.enum=T;break}case"file":{const S=N,T={type:"string",format:"binary",contentEncoding:"binary"},{minimum:E,maximum:A,mime:B}=t._zod.bag;E!==void 0&&(T.minLength=E),A!==void 0&&(T.maxLength=A),B?B.length===1?(T.contentMediaType=B[0],Object.assign(S,T)):S.anyOf=B.map(_=>({...T,contentMediaType:_})):Object.assign(S,T);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const S=this.process(s.innerType,k);N.anyOf=[S,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,k),d.ref=s.innerType;break}case"success":{const S=N;S.type="boolean";break}case"default":{this.process(s.innerType,k),d.ref=s.innerType,N.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,k),d.ref=s.innerType,this.io==="input"&&(N._prefault=JSON.parse(JSON.stringify(s.defaultValue)));break}case"catch":{this.process(s.innerType,k),d.ref=s.innerType;let S;try{S=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}N.default=S;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const S=N,T=t._zod.pattern;if(!T)throw new Error("Pattern not found in template literal");S.type="string",S.pattern=T.source;break}case"pipe":{const S=this.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;this.process(S,k),d.ref=S;break}case"readonly":{this.process(s.innerType,k),d.ref=s.innerType,N.readOnly=!0;break}case"promise":{this.process(s.innerType,k),d.ref=s.innerType;break}case"optional":{this.process(s.innerType,k),d.ref=s.innerType;break}case"lazy":{const S=t._zod.innerType;this.process(S,k),d.ref=S;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const h=this.metadataRegistry.get(t);return h&&Object.assign(d.schema,h),this.io==="input"&&pn(t)&&(delete d.schema.examples,delete d.schema.default),this.io==="input"&&d.schema._prefault&&((a=d.schema).default??(a.default=d.schema._prefault)),delete d.schema._prefault,this.seen.get(t).schema}emit(t,n){var g,m,y,b,k,j;const a={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},s=this.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=N=>{var B;const S=this.target==="draft-2020-12"?"$defs":"definitions";if(a.external){const _=(B=a.external.registry.get(N[0]))==null?void 0:B.id,z=a.external.uri??(M=>M);if(_)return{ref:z(_)};const q=N[1].defId??N[1].schema.id??`schema${this.counter++}`;return N[1].defId=q,{defId:q,ref:`${z("__shared")}#/${S}/${q}`}}if(N[1]===s)return{ref:"#"};const E=`#/${S}/`,A=N[1].schema.id??`__schema${this.counter++}`;return{defId:A,ref:E+A}},u=N=>{if(N[1].schema.$ref)return;const S=N[1],{ref:T,defId:E}=l(N);S.def={...S.schema},E&&(S.defId=E);const A=S.schema;for(const B in A)delete A[B];A.$ref=T};if(a.cycles==="throw")for(const N of this.seen.entries()){const S=N[1];if(S.cycle)throw new Error(`Cycle detected: #/${(g=S.cycle)==null?void 0:g.join("/")}/<root>
1419
+
1420
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const N of this.seen.entries()){const S=N[1];if(t===N[0]){u(N);continue}if(a.external){const E=(m=a.external.registry.get(N[0]))==null?void 0:m.id;if(t!==N[0]&&E){u(N);continue}}if((y=this.metadataRegistry.get(N[0]))==null?void 0:y.id){u(N);continue}if(S.cycle){u(N);continue}if(S.count>1&&a.reused==="ref"){u(N);continue}}const d=(N,S)=>{const T=this.seen.get(N),E=T.def??T.schema,A={...E};if(T.ref===null)return;const B=T.ref;if(T.ref=null,B){d(B,S);const _=this.seen.get(B).schema;_.$ref&&S.target==="draft-7"?(E.allOf=E.allOf??[],E.allOf.push(_)):(Object.assign(E,_),Object.assign(E,A))}T.isParent||this.override({zodSchema:N,jsonSchema:E,path:T.path??[]})};for(const N of[...this.seen.entries()].reverse())d(N[0],{target:this.target});const f={};if(this.target==="draft-2020-12"?f.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?f.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),(b=a.external)!=null&&b.uri){const N=(k=a.external.registry.get(t))==null?void 0:k.id;if(!N)throw new Error("Schema is missing an `id` property");f.$id=a.external.uri(N)}Object.assign(f,s.def);const h=((j=a.external)==null?void 0:j.defs)??{};for(const N of this.seen.entries()){const S=N[1];S.def&&S.defId&&(h[S.defId]=S.def)}a.external||Object.keys(h).length>0&&(this.target==="draft-2020-12"?f.$defs=h:f.definitions=h);try{return JSON.parse(JSON.stringify(f))}catch{throw new Error("Error converting schema to JSON.")}}}function WI(e,t){if(e instanceof Wj){const a=new ew(t),s={};for(const d of e._idmap.entries()){const[f,h]=d;a.process(h)}const l={},u={registry:e,uri:t==null?void 0:t.uri,defs:s};for(const d of e._idmap.entries()){const[f,h]=d;l[f]=a.emit(h,{...t,external:u})}if(Object.keys(s).length>0){const d=a.target==="draft-2020-12"?"$defs":"definitions";l.__shared={[d]:s}}return{schemas:l}}const n=new ew(t);return n.process(e),n.emit(e,t)}function pn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;switch(s.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return pn(s.element,n);case"object":{for(const l in s.shape)if(pn(s.shape[l],n))return!0;return!1}case"union":{for(const l of s.options)if(pn(l,n))return!0;return!1}case"intersection":return pn(s.left,n)||pn(s.right,n);case"tuple":{for(const l of s.items)if(pn(l,n))return!0;return!!(s.rest&&pn(s.rest,n))}case"record":return pn(s.keyType,n)||pn(s.valueType,n);case"map":return pn(s.keyType,n)||pn(s.valueType,n);case"set":return pn(s.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return pn(s.innerType,n);case"lazy":return pn(s.getter(),n);case"default":return pn(s.innerType,n);case"prefault":return pn(s.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return pn(s.in,n)||pn(s.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${s.type}`)}const ZI=ve("ZodISODateTime",(e,t)=>{E$.init(e,t),Vt.init(e,t)});function KI(e){return EI(ZI,e)}const YI=ve("ZodISODate",(e,t)=>{T$.init(e,t),Vt.init(e,t)});function QI(e){return TI(YI,e)}const XI=ve("ZodISOTime",(e,t)=>{A$.init(e,t),Vt.init(e,t)});function JI(e){return AI(XI,e)}const e3=ve("ZodISODuration",(e,t)=>{_$.init(e,t),Vt.init(e,t)});function t3(e){return _I(e3,e)}const n3=(e,t)=>{Dj.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Cz(e,n)},flatten:{value:n=>jz(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Vd=ve("ZodError",n3,{Parent:Error}),r3=Nz(Vd),a3=Ez(Vd),i3=$j(Vd),s3=Ij(Vd),hn=ve("ZodType",(e,t)=>(en.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),e.clone=(n,a)=>cs(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>r3(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>i3(e,n,a),e.parseAsync=async(n,a)=>a3(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>s3(e,n,a),e.spa=e.safeParseAsync,e.refine=(n,a)=>e.check(K3(n,a)),e.superRefine=n=>e.check(Y3(n)),e.overwrite=n=>e.check(ec(n)),e.optional=()=>aw(e),e.nullable=()=>iw(e),e.nullish=()=>aw(iw(e)),e.nonoptional=n=>B3(e,n),e.array=()=>Ia(e),e.or=n=>uv([e,n]),e.and=n=>L3(e,n),e.transform=n=>sw(e,D3(n)),e.default=n=>I3(e,n),e.prefault=n=>U3(e,n),e.catch=n=>H3(e,n),e.pipe=n=>sw(e,n),e.readonly=()=>V3(e),e.describe=n=>{const a=e.clone();return Al.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=Al.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Al.get(e);const a=e.clone();return Al.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Qj=ve("_ZodString",(e,t)=>{cv.init(e,t),hn.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...a)=>e.check(DI(...a)),e.includes=(...a)=>e.check(II(...a)),e.startsWith=(...a)=>e.check(PI(...a)),e.endsWith=(...a)=>e.check(UI(...a)),e.min=(...a)=>e.check(vd(...a)),e.max=(...a)=>e.check(Kj(...a)),e.length=(...a)=>e.check(Yj(...a)),e.nonempty=(...a)=>e.check(vd(1,...a)),e.lowercase=a=>e.check(zI(a)),e.uppercase=a=>e.check($I(a)),e.trim=()=>e.check(FI()),e.normalize=(...a)=>e.check(BI(...a)),e.toLowerCase=()=>e.check(HI()),e.toUpperCase=()=>e.check(qI())}),o3=ve("ZodString",(e,t)=>{cv.init(e,t),Qj.init(e,t),e.email=n=>e.check(sI(l3,n)),e.url=n=>e.check(dI(c3,n)),e.jwt=n=>e.check(NI(j3,n)),e.emoji=n=>e.check(pI(u3,n)),e.guid=n=>e.check(Y1(tw,n)),e.uuid=n=>e.check(oI(Ou,n)),e.uuidv4=n=>e.check(lI(Ou,n)),e.uuidv6=n=>e.check(cI(Ou,n)),e.uuidv7=n=>e.check(uI(Ou,n)),e.nanoid=n=>e.check(fI(d3,n)),e.guid=n=>e.check(Y1(tw,n)),e.cuid=n=>e.check(hI(p3,n)),e.cuid2=n=>e.check(mI(f3,n)),e.ulid=n=>e.check(gI(h3,n)),e.base64=n=>e.check(SI(w3,n)),e.base64url=n=>e.check(jI(k3,n)),e.xid=n=>e.check(vI(m3,n)),e.ksuid=n=>e.check(yI(g3,n)),e.ipv4=n=>e.check(bI(v3,n)),e.ipv6=n=>e.check(xI(y3,n)),e.cidrv4=n=>e.check(wI(b3,n)),e.cidrv6=n=>e.check(kI(x3,n)),e.e164=n=>e.check(CI(S3,n)),e.datetime=n=>e.check(KI(n)),e.date=n=>e.check(QI(n)),e.time=n=>e.check(JI(n)),e.duration=n=>e.check(t3(n))});function $e(e){return iI(o3,e)}const Vt=ve("ZodStringFormat",(e,t)=>{Ht.init(e,t),Qj.init(e,t)}),l3=ve("ZodEmail",(e,t)=>{y$.init(e,t),Vt.init(e,t)}),tw=ve("ZodGUID",(e,t)=>{g$.init(e,t),Vt.init(e,t)}),Ou=ve("ZodUUID",(e,t)=>{v$.init(e,t),Vt.init(e,t)}),c3=ve("ZodURL",(e,t)=>{b$.init(e,t),Vt.init(e,t)}),u3=ve("ZodEmoji",(e,t)=>{x$.init(e,t),Vt.init(e,t)}),d3=ve("ZodNanoID",(e,t)=>{w$.init(e,t),Vt.init(e,t)}),p3=ve("ZodCUID",(e,t)=>{k$.init(e,t),Vt.init(e,t)}),f3=ve("ZodCUID2",(e,t)=>{S$.init(e,t),Vt.init(e,t)}),h3=ve("ZodULID",(e,t)=>{j$.init(e,t),Vt.init(e,t)}),m3=ve("ZodXID",(e,t)=>{C$.init(e,t),Vt.init(e,t)}),g3=ve("ZodKSUID",(e,t)=>{N$.init(e,t),Vt.init(e,t)}),v3=ve("ZodIPv4",(e,t)=>{R$.init(e,t),Vt.init(e,t)}),y3=ve("ZodIPv6",(e,t)=>{O$.init(e,t),Vt.init(e,t)}),b3=ve("ZodCIDRv4",(e,t)=>{L$.init(e,t),Vt.init(e,t)}),x3=ve("ZodCIDRv6",(e,t)=>{M$.init(e,t),Vt.init(e,t)}),w3=ve("ZodBase64",(e,t)=>{D$.init(e,t),Vt.init(e,t)}),k3=ve("ZodBase64URL",(e,t)=>{$$.init(e,t),Vt.init(e,t)}),S3=ve("ZodE164",(e,t)=>{I$.init(e,t),Vt.init(e,t)}),j3=ve("ZodJWT",(e,t)=>{U$.init(e,t),Vt.init(e,t)}),Xj=ve("ZodNumber",(e,t)=>{Vj.init(e,t),hn.init(e,t),e.gt=(a,s)=>e.check(X1(a,s)),e.gte=(a,s)=>e.check(Uh(a,s)),e.min=(a,s)=>e.check(Uh(a,s)),e.lt=(a,s)=>e.check(Q1(a,s)),e.lte=(a,s)=>e.check(Ph(a,s)),e.max=(a,s)=>e.check(Ph(a,s)),e.int=a=>e.check(nw(a)),e.safe=a=>e.check(nw(a)),e.positive=a=>e.check(X1(0,a)),e.nonnegative=a=>e.check(Uh(0,a)),e.negative=a=>e.check(Q1(0,a)),e.nonpositive=a=>e.check(Ph(0,a)),e.multipleOf=(a,s)=>e.check(J1(a,s)),e.step=(a,s)=>e.check(J1(a,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function aa(e){return RI(Xj,e)}const C3=ve("ZodNumberFormat",(e,t)=>{B$.init(e,t),Xj.init(e,t)});function nw(e){return OI(C3,e)}const N3=ve("ZodUnknown",(e,t)=>{F$.init(e,t),hn.init(e,t)});function rw(){return LI(N3)}const E3=ve("ZodNever",(e,t)=>{H$.init(e,t),hn.init(e,t)});function T3(e){return MI(E3,e)}const A3=ve("ZodArray",(e,t)=>{q$.init(e,t),hn.init(e,t),e.element=t.element,e.min=(n,a)=>e.check(vd(n,a)),e.nonempty=n=>e.check(vd(1,n)),e.max=(n,a)=>e.check(Kj(n,a)),e.length=(n,a)=>e.check(Yj(n,a)),e.unwrap=()=>e.element});function Ia(e,t){return GI(A3,e,t)}const _3=ve("ZodObject",(e,t)=>{G$.init(e,t),hn.init(e,t),Ut(e,"shape",()=>t.shape),e.keyof=()=>fo(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:rw()}),e.loose=()=>e.clone({...e._zod.def,catchall:rw()}),e.strict=()=>e.clone({...e._zod.def,catchall:T3()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>xz(e,n),e.merge=n=>wz(e,n),e.pick=n=>yz(e,n),e.omit=n=>bz(e,n),e.partial=(...n)=>kz(Jj,e,n[0]),e.required=(...n)=>Sz(eC,e,n[0])});function Pt(e,t){const n={type:"object",get shape(){return sv(this,"shape",{...e}),this.shape},...Ue(t)};return new _3(n)}const R3=ve("ZodUnion",(e,t)=>{V$.init(e,t),hn.init(e,t),e.options=t.options});function uv(e,t){return new R3({type:"union",options:e,...Ue(t)})}const O3=ve("ZodIntersection",(e,t)=>{W$.init(e,t),hn.init(e,t)});function L3(e,t){return new O3({type:"intersection",left:e,right:t})}const Um=ve("ZodEnum",(e,t)=>{Z$.init(e,t),hn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,s)=>{const l={};for(const u of a)if(n.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Um({...t,checks:[],...Ue(s),entries:l})},e.exclude=(a,s)=>{const l={...t.entries};for(const u of a)if(n.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new Um({...t,checks:[],...Ue(s),entries:l})}});function fo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Um({type:"enum",entries:n,...Ue(t)})}const M3=ve("ZodTransform",(e,t)=>{K$.init(e,t),hn.init(e,t),e._zod.parse=(n,a)=>{n.addIssue=l=>{if(typeof l=="string")n.issues.push(Fl(l,n.value,t));else{const u=l;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=n.value),u.inst??(u.inst=e),u.continue??(u.continue=!0),n.issues.push(Fl(u))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(l=>(n.value=l,n)):(n.value=s,n)}});function D3(e){return new M3({type:"transform",transform:e})}const Jj=ve("ZodOptional",(e,t)=>{Y$.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function aw(e){return new Jj({type:"optional",innerType:e})}const z3=ve("ZodNullable",(e,t)=>{Q$.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function iw(e){return new z3({type:"nullable",innerType:e})}const $3=ve("ZodDefault",(e,t)=>{X$.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function I3(e,t){return new $3({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const P3=ve("ZodPrefault",(e,t)=>{J$.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function U3(e,t){return new P3({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const eC=ve("ZodNonOptional",(e,t)=>{eI.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function B3(e,t){return new eC({type:"nonoptional",innerType:e,...Ue(t)})}const F3=ve("ZodCatch",(e,t)=>{tI.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function H3(e,t){return new F3({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const q3=ve("ZodPipe",(e,t)=>{nI.init(e,t),hn.init(e,t),e.in=t.in,e.out=t.out});function sw(e,t){return new q3({type:"pipe",in:e,out:t})}const G3=ve("ZodReadonly",(e,t)=>{rI.init(e,t),hn.init(e,t)});function V3(e){return new G3({type:"readonly",innerType:e})}const W3=ve("ZodCustom",(e,t)=>{aI.init(e,t),hn.init(e,t)});function Z3(e){const t=new Wn({check:"custom"});return t._zod.check=e,t}function K3(e,t={}){return VI(W3,e,t)}function Y3(e){const t=Z3(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(Fl(a,n.value,t._zod.def));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(Fl(s))}},e(n.value,n)));return t}function Bh(e,t){if(!t||e==null)return;if(!t.includes("."))return e[t];let n=e;for(const a of t.split(".")){if(n==null)return;n=n[a]}return n}function Ze(e){if(typeof e=="number")return e;if(typeof e=="string"){const t=Number(e);return isNaN(t)?0:t}return typeof e=="boolean"&&e?1:0}const dv={Count:{name:"Count",signature:"Count(array) → number",description:"Returns array length",fn:e=>Array.isArray(e)?e.length:0},First:{name:"First",signature:"First(array) → element",description:"Returns first element of array",fn:e=>Array.isArray(e)?e[0]??null:null},Last:{name:"Last",signature:"Last(array) → element",description:"Returns last element of array",fn:e=>Array.isArray(e)?e[e.length-1]??null:null},Sum:{name:"Sum",signature:"Sum(numbers[]) → number",description:"Sum of numeric array",fn:e=>Array.isArray(e)?e.reduce((t,n)=>t+Ze(n),0):0},Avg:{name:"Avg",signature:"Avg(numbers[]) → number",description:"Average of numeric array",fn:e=>Array.isArray(e)&&e.length?e.reduce((t,n)=>t+Ze(n),0)/e.length:0},Min:{name:"Min",signature:"Min(numbers[]) → number",description:"Minimum value in array",fn:e=>Array.isArray(e)&&e.length?e.reduce((t,n)=>Math.min(t,Ze(n)),Ze(e[0])):0},Max:{name:"Max",signature:"Max(numbers[]) → number",description:"Maximum value in array",fn:e=>Array.isArray(e)&&e.length?e.reduce((t,n)=>Math.max(t,Ze(n)),Ze(e[0])):0},Sort:{name:"Sort",signature:"Sort(array, field, direction?) → sorted array",description:'Sort array by field. Direction: "asc" (default) or "desc"',fn:(e,t,n)=>{if(!Array.isArray(e))return e;const a=String(t??""),s=String(n??"asc")==="desc";return[...e].sort((l,u)=>{const d=a?Bh(l,a):l,f=a?Bh(u,a):u,h=typeof d=="number"||typeof d=="string"&&!isNaN(Number(d))&&d!=="",g=typeof f=="number"||typeof f=="string"&&!isNaN(Number(f))&&f!=="";if(h&&g){const y=Ze(d)-Ze(f);return s?-y:y}const m=String(d??"").localeCompare(String(f??""));return s?-m:m})}},Filter:{name:"Filter",signature:'Filter(array, field, operator: "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains", value) → filtered array',description:"Filter array by field value",fn:(e,t,n,a)=>{if(!Array.isArray(e))return[];const s=String(t??""),l=String(n??"==");return e.filter(u=>{const d=s?Bh(u,s):u;switch(l){case"==":return d==a;case"!=":return d!=a;case">":return Ze(d)>Ze(a);case"<":return Ze(d)<Ze(a);case">=":return Ze(d)>=Ze(a);case"<=":return Ze(d)<=Ze(a);case"contains":return String(d??"").includes(String(a??""));default:return!1}})}},Round:{name:"Round",signature:"Round(number, decimals?) → number",description:"Round to N decimal places (default 0)",fn:(e,t)=>{const n=Ze(e),a=t!=null?Ze(t):0,s=Math.pow(10,a);return Math.round(n*s)/s}},Abs:{name:"Abs",signature:"Abs(number) → number",description:"Absolute value",fn:e=>Math.abs(Ze(e))},Floor:{name:"Floor",signature:"Floor(number) → number",description:"Round down to nearest integer",fn:e=>Math.floor(Ze(e))},Ceil:{name:"Ceil",signature:"Ceil(number) → number",description:"Round up to nearest integer",fn:e=>Math.ceil(Ze(e))}},pv=new Set(["Each"]),Q3={Each:{signature:"Each(array, varName, template)",description:"Evaluate template for each element. varName is the loop variable — use it ONLY inside the template expression (inline). Do NOT create a separate statement for the template."}},Ir={Run:"run",ToAssistant:"continue_conversation",OpenUrl:"open_url",Set:"set",Reset:"reset"},tC=new Set(["Action",...Object.keys(Ir)]),X3=new Set([...Object.keys(dv),...pv,...tC]);function Hl(e){return X3.has(e)}const ki={Query:"Query",Mutation:"Mutation"};function yd(e){return e in ki}function bd(e){const t=e.type;if(t==="string"){const n=e.enum;return n?n.map(a=>`"${a}"`).join(" | "):"string"}if(t==="number"||t==="integer")return"number";if(t==="boolean")return"boolean";if(t==="array"){const n=e.items;return n?`${bd(n)}[]`:"any[]"}if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const a=e.required??[];return`{${Object.entries(n).map(([s,l])=>`${s}${a.includes(s)?"":"?"}: ${bd(l)}`).join(", ")}}`}return"object"}return"any"}function nC(e){const t=e.type;if(t==="string")return"";if(t==="number"||t==="integer")return 0;if(t==="boolean")return!1;if(t==="array")return[];if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const a={};for(const[s,l]of Object.entries(n))a[s]=nC(l);return a}return{}}return null}const J3="You are an AI assistant that responds using openui-lang, a declarative UI language. Your ENTIRE response must be valid openui-lang code — no markdown, no explanations, just openui-lang.";function e6(e,t){const n=["## Syntax Rules","","1. Each statement is on its own line: `identifier = Expression`",`2. \`root\` is the entry point — every program must define \`root = ${e}(...)\``,'3. Expressions are: strings ("..."), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)',"4. Use references for readability: define `name = ...` on one line, then use `name` later","5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.",'6. Arguments are POSITIONAL (order matters, not names). Write `Stack([children], "row", "l")` NOT `Stack([children], direction: "row", gap: "l")` — colon syntax is NOT supported and silently breaks',"7. Optional arguments can be omitted from the end"];let a=8;return t.bindings&&n.push(`${a++}. Declare mutable state with \`$varName = defaultValue\`. Components marked with \`$binding\` can read/write these. Undeclared $variables are auto-created with null default.`),t.supportsExpressions&&n.push(`${a++}. String concatenation: \`"text" + $var + "more"\``,`${a++}. Dot member access: \`query.field\` reads a field; on arrays it extracts that field from every element`,`${a++}. Index access: \`arr[0]\`, \`data[index]\``,`${a++}. Arithmetic operators: +, -, *, /, % (work on numbers; + is string concat when either side is a string)`,`${a++}. Comparison: ==, !=, >, <, >=, <=`,`${a++}. Logical: &&, ||, ! (prefix)`,`${a++}. Ternary: \`condition ? valueIfTrue : valueIfFalse\``,`${a++}. Parentheses for grouping: \`(a + b) * c\``),n.push("- Strings use double quotes with backslash escaping"),n.join(`
1421
+ `)}function t6(){const e=Object.values(dv).map(n=>`@${n.signature} — ${n.description}`),t=Object.values(Q3).map(n=>`@${n.signature} — ${n.description}`);return`## Built-in Functions
1422
+
1423
+ Data functions prefixed with \`@\` to distinguish from components. These are the ONLY functions available — do NOT invent new ones.
1424
+ Use @-prefixed built-in functions (@Count, @Sum, @Avg, @Min, @Max, @Round) on Query results — do NOT hardcode computed values.
1425
+
1426
+ ${[...e,...t].join(`
1427
+ `)}
1428
+
1429
+ Builtins compose — output of one is input to the next:
1430
+ \`@Count(@Filter(data.rows, "field", "==", "val"))\` for KPIs/chart values, \`@Round(@Avg(data.rows.score), 1)\`, \`@Each(data.rows, "item", Comp(item.field))\` for per-item rendering.
1431
+ Array pluck: \`data.rows.field\` extracts a field from every row → use with @Sum, @Avg, charts, tables.
1432
+
1433
+ IMPORTANT @Each rule: The loop variable (e.g. "item") is ONLY available inside the @Each template expression. Always inline the template — do NOT extract it to a separate statement.
1434
+ CORRECT: \`Col("Actions", @Each(rows, "t", Button("Edit", Action([@Set($id, t.id)]))))\`
1435
+ WRONG: \`myBtn = Button("Edit", Action([@Set($id, t.id)]))\` then \`Col("Actions", @Each(rows, "t", myBtn))\` — t is undefined in myBtn.`}function n6(){return`## Query — Live Data Fetching
1436
+
1437
+ Fetch data from available tools. Returns defaults instantly, swaps in real data when it arrives.
1438
+
1439
+ \`\`\`
1440
+ metrics = Query("tool_name", {arg1: value, arg2: $binding}, {defaultField: 0, defaultData: []}, refreshInterval?)
1441
+ \`\`\`
1442
+
1443
+ - First arg: tool name (string)
1444
+ - Second arg: arguments object (may reference $bindings — re-fetches automatically on change)
1445
+ - Third arg: default data (rendered immediately before fetch resolves)
1446
+ - Fourth arg (optional): refresh interval in seconds (e.g. 30 for auto-refresh every 30s)
1447
+ - Use dot access on results: metrics.totalEvents, metrics.data.day (array pluck)
1448
+ - Query results must use regular identifiers: \`metrics = Query(...)\`, NOT \`$metrics = Query(...)\`
1449
+ - Manual refresh: \`Button("Refresh", Action([@Run(query1), @Run(query2)]), "secondary")\` — re-fetches the listed queries
1450
+ - Refresh all queries: create Action with @Run for each query`}function r6(){return`## Mutation — Write Operations
1451
+
1452
+ Execute state-changing tool calls (create, update, delete). Unlike Query (auto-fetches on render), Mutation fires only on button click via Action.
1453
+
1454
+ \`\`\`
1455
+ result = Mutation("tool_name", {arg1: $binding, arg2: "value"})
1456
+ \`\`\`
1457
+
1458
+ - First arg: tool name (string)
1459
+ - Second arg: arguments object (evaluated with current $binding values at click time)
1460
+ - result.status: "idle" | "loading" | "success" | "error"
1461
+ - result.data: tool response on success
1462
+ - result.error: error message on failure
1463
+ - Mutation results use regular identifiers: \`result = Mutation(...)\`, NOT \`$result\`
1464
+ - Show loading state: \`result.status == "loading" ? TextContent("Saving...") : null\``}function a6(e){const t=['- @ToAssistant("message") — Send a message to the assistant (for conversational buttons like "Tell me more", "Explain this")','- @OpenUrl("https://...") — Navigate to a URL'];e.bindings&&t.push("- @Set($variable, value) — Set a $variable to a specific value",'- @Reset($var1, $var2, ...) — Reset $variables to their declared defaults (e.g. @Reset($title, $priority) restores $title="" and $priority="medium")'),e.toolCalls&&t.unshift("- @Run(queryOrMutationRef) — Execute a Mutation or re-fetch a Query (ref must be a declared Query/Mutation)");const n=[];e.toolCalls&&n.push('Example — mutation + refresh + reset (PREFERRED pattern):\n```\n$binding = "default"\nresult = Mutation("tool_name", {field: $binding})\ndata = Query("tool_name", {}, {rows: []})\nonSubmit = Action([@Run(result), @Run(data), @Reset($binding)])\n```'),n.push('Example — simple nav:\n```\nviewBtn = Button("View", Action([@OpenUrl("https://example.com")]))\n```');const a=['- Action can be assigned to a variable or inlined: Button("Go", onSubmit) and Button("Go", Action([...])) both work'];return e.toolCalls&&a.push("- If a @Run(mutation) step fails, remaining steps are skipped (halt on failure)","- @Run(queryRef) re-fetches the query (fire-and-forget, cannot fail)"),`## Action — Button Behavior
1465
+
1466
+ Action([@steps...]) wires button clicks to operations. Steps are @-prefixed built-in actions. Steps execute in order.
1467
+ Buttons without an explicit Action prop automatically send their label to the assistant (equivalent to Action([@ToAssistant(label)])).
1468
+
1469
+ Available steps:
1470
+ ${t.join(`
1471
+ `)}
1472
+
1473
+ ${n.join(`
1474
+
1475
+ `)}
1476
+
1477
+ ${a.join(`
1478
+ `)}`}function i6(){return`## Interactive Filters
1479
+
1480
+ To let the user filter data with a dropdown:
1481
+ 1. Declare a $variable with a default: \`$dateRange = "14"\`
1482
+ 2. Create a Select with name, items, and binding: \`Select("dateRange", [SelectItem("7", "Last 7 days"), ...], null, null, $dateRange)\`
1483
+ 3. Wrap in FormControl for a label: \`FormControl("Date Range", Select(...))\`
1484
+ 4. Pass $dateRange in Query args: \`Query("tool", {dateRange: $dateRange}, {defaults})\`
1485
+ 5. When the user changes the Select, $dateRange updates and the Query automatically re-fetches
1486
+
1487
+ FILTER WIRING RULE: If a $binding filter is visible in the UI, EVERY relevant Query MUST reference that $binding in its args. Never show a filter dropdown while hardcoding the query args.
1488
+
1489
+ Rules for $variables:
1490
+ - $variables hold simple values (strings or numbers), NOT arrays or objects
1491
+ - $variables must be bound to a Select/Input component via the value argument (last positional arg) to be interactive
1492
+ - Queries must use regular identifiers (NOT $variables): \`metrics = Query(...)\` not \`$metrics = Query(...)\`
1493
+ - **Auto-declare**: You do NOT need to explicitly declare $variables. If you use \`$foo\` without declaring it, the parser auto-creates \`$foo = null\`. You can still declare explicitly to set a default: \`$days = "14"\`
1494
+
1495
+ ## Forms
1496
+
1497
+ Simple form — no $bindings needed. Field values are managed internally by the Form via the name prop:
1498
+ \`\`\`
1499
+ contactForm = Form("contact", submitBtn, [nameField, emailField])
1500
+ nameField = FormControl("Name", Input("name", "Your name", "text", {required: true}))
1501
+ emailField = FormControl("Email", Input("email", "your@email.com", "email", {required: true, email: true}))
1502
+ submitBtn = Button("Submit")
1503
+ \`\`\`
1504
+
1505
+ Use $bindings when you need to read field values elsewhere (in Action context, Query args, or conditionals). They are auto-declared:
1506
+ \`\`\`
1507
+ $role = "engineer"
1508
+ contactForm = Form("contact", submitBtn, [nameField, emailField, roleField])
1509
+ nameField = FormControl("Name", Input("name", "Enter your name", "text", {required: true}, $name))
1510
+ emailField = FormControl("Email", Input("email", "Enter your email", "email", {required: true, email: true}, $email))
1511
+ roleField = FormControl("Role", Select("role", [SelectItem("engineer", "Engineer"), SelectItem("designer", "Designer"), SelectItem("pm", "PM")], null, {required: true}, $role))
1512
+ submitBtn = Button("Submit")
1513
+ \`\`\`
1514
+
1515
+ For form + mutation patterns (create, refresh, reset), see the Action section example above.
1516
+
1517
+ IMPORTANT: Always add validation rules to form fields used with Mutations. Use OBJECT syntax: {required: true, email: true, minLength: 8}. The renderer shows error messages automatically and blocks submit when validation fails.`}function s6(){return`## Edit Mode
1518
+
1519
+ The runtime merges by statement name: same name = replace, new name = append.
1520
+ Output ONLY statements that changed or are new. Everything else is kept automatically.
1521
+
1522
+ ### Delete
1523
+ To remove a component, update the parent to exclude it from its children array. Orphaned statements are automatically garbage-collected.
1524
+ Example — remove chart: \`root = Stack([header, kpiRow, table])\` — chart is no longer in the children list, so it and any statements only it referenced are auto-deleted.
1525
+
1526
+ ### Patch size guide
1527
+ - Changing a title or label: 1 statement
1528
+ - Adding a component: 2-3 statements (the new component + parent update)
1529
+ - Removing a component: 1 statement (re-declare parent without the removed child)
1530
+ - Adding a filter + wiring to query: 3-5 statements
1531
+ - Restructuring into tabs: 5-10 statements
1532
+
1533
+ ### Rules
1534
+ - Reuse existing statement names exactly — do not rename
1535
+ - Do NOT re-emit unchanged statements — the runtime keeps them
1536
+ - A typical edit patch is 1-10 statements, not 20+
1537
+ - If the existing code already satisfies the request, output only the root statement
1538
+ - NEVER output the entire program as a patch. Only output what actually changes
1539
+ - If you are about to output more than 10 statements, reconsider — most edits need fewer`}function o6(e,t){const n=[`1. \`root = ${e}(...)\` — UI shell appears immediately`];return t.supportsExpressions?(n.push("2. $variable declarations — state ready for bindings"),n.push("3. Query statements — defaults resolve immediately so components render with data"),n.push("4. Component definitions — fill in with data already available"),n.push("5. Data values — leaf content last")):(n.push("2. Component definitions — fill in as they stream"),n.push("3. Data values — leaf content last")),`## Hoisting & Streaming (CRITICAL)
1540
+
1541
+ openui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.
1542
+
1543
+ During streaming, the output is re-parsed on every chunk. Undefined references are temporarily unresolved and appear once their definitions stream in. This creates a progressive top-down reveal — structure first, then data fills in.
1544
+
1545
+ **Recommended statement order for optimal streaming:**
1546
+ ${n.join(`
1547
+ `)}
1548
+
1549
+ Always write the root = ${e}(...) statement first so the UI shell appears immediately, even before child data has streamed in.`}function l6(){return`## Inline Mode
1550
+
1551
+ You are in inline mode. You can respond in two ways:
1552
+
1553
+ ### 1. Code response (when the user wants to CREATE or CHANGE the UI)
1554
+ Wrap openui-lang code in triple-backtick fences. You can include explanatory text before/after:
1555
+
1556
+ Here's your dashboard:
1557
+
1558
+ \`\`\`openui-lang
1559
+ root = RootComp([header, content])
1560
+ header = SomeHeader("Title")
1561
+ content = SomeContent("Hello world")
1562
+ \`\`\`
1563
+
1564
+ I created a simple layout with a header.
1565
+
1566
+ ### 2. Text-only response (when the user asks a QUESTION)
1567
+ If the user asks "what is this?", "explain the chart", "how does this work", etc. — respond with plain text. Do NOT output any openui-lang code. The existing dashboard stays unchanged.
1568
+
1569
+ ### Rules
1570
+ - When the user asks for changes, output ONLY the changed/new statements in a fenced block
1571
+ - When the user asks a question, respond with text only — NO code. The dashboard stays unchanged.
1572
+ - The parser extracts code from fences automatically. Text outside fences is shown as chat.`}function c6(){return`## Data Workflow
1573
+
1574
+ When tools are available, follow this workflow:
1575
+ 1. FIRST: Call the most relevant tool to inspect the real data shape before generating code
1576
+ 2. Use Query() for READ operations (data that should stay live) — NEVER hardcode tool results as literal arrays or objects
1577
+ 3. Use Mutation() for WRITE operations (create, update, delete) — triggered by button clicks via Action([@Run(mutationRef)])
1578
+ 4. Use the real data from step 1 as condensed Query defaults (3-5 rows) so the UI renders immediately
1579
+ 5. Use @-prefixed builtins (@Count, @Filter, @Sort, @Sum) on Query results for KPIs and aggregations — the runtime evaluates these live on every refresh
1580
+ 6. Hardcoded arrays are ONLY for static display data (labels, options) where no tool exists
1581
+
1582
+ WRONG — you called a tool and got data back, but you inlined the results:
1583
+ \`\`\`
1584
+ openCount = 2
1585
+ item1 = SomeComp("first item title")
1586
+ item2 = SomeComp("second item title")
1587
+ list = Stack([item1, item2])
1588
+ chart = SomeChart(["A", "B"], [12, 8])
1589
+ \`\`\`
1590
+ This is static — it shows stale data and won't update. Creating item1, item2, item3... manually is ALWAYS wrong when a tool exists.
1591
+
1592
+ RIGHT — use Query() for live data, Mutation() for writes, @builtins to derive values:
1593
+ \`\`\`
1594
+ data = Query("tool_name", {}, {rows: []})
1595
+ openCount = @Count(@Filter(data.rows, "field", "==", "value"))
1596
+ list = @Each(data.rows, "item", SomeComp(item.title, item.field))
1597
+ createResult = Mutation("create_tool", {title: $title})
1598
+ submitBtn = Button("Create", Action([@Run(createResult), @Run(data), @Reset($title)]))
1599
+ \`\`\`
1600
+ Everything derives from the Query — when data refreshes, the entire dashboard updates automatically.`}function u6(e,t){const n=[`1. root = ${e}(...) is the FIRST line (for optimal streaming).`,"2. Every referenced name is defined. Every defined name (other than root) is reachable from root."];return t.toolCalls&&n.push("3. Every Query result is referenced by at least one component."),t.bindings&&n.push(`${t.toolCalls?"4":"3"}. Every $binding appears in at least one component or expression.`),`## Important Rules
1601
+ - When asked about data, generate realistic/plausible data
1602
+ - Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)
1603
+
1604
+ ## Final Verification
1605
+ Before finishing, walk your output and verify:
1606
+ ${n.join(`
1607
+ `)}`}function d6(e){let t="";if(e.inputSchema){const s=e.inputSchema.properties,l=e.inputSchema.required??[];s&&Object.keys(s).length>0&&(t=Object.entries(s).map(([u,d])=>`${u}${l.includes(u)?"":"?"}: ${bd(d)}`).join(", "))}let n="";e.outputSchema&&(n=` → ${bd(e.outputSchema)}`);let a=`- ${e.name}(${t})${n}`;return e.description&&(a+=`
1608
+ ${e.description}`),a}function p6(e){const t=[],n=[],a=[];for(const l of e)typeof l=="string"?n.push(l):a.push(l);t.push("## Available Tools"),t.push(""),t.push("Use these with Query() for read operations or Mutation() for write operations. The LLM decides which is appropriate based on the tool's purpose."),t.push("");for(const l of n)t.push(`- ${l}`);for(const l of a)t.push(d6(l));const s=a.filter(l=>l.outputSchema);if(s.length>0){t.push(""),t.push("### Default values for Query results"),t.push(""),t.push("Use these shapes as minimal Query defaults:");for(const l of s){const u=nC(l.outputSchema);t.push(`- ${l.name}: \`${JSON.stringify(u)}\``)}}return t.push(""),t.push("CRITICAL: Use ONLY the tools listed above in Query() and Mutation() calls. Do NOT invent or guess tool names. If the user asks for functionality that doesn't match any available tool, use realistic mock data instead of fabricating a tool call."),t.join(`
1609
+ `)}function f6(e,t){var s,l;const n=["## Component Signatures","","Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming."];if(t.usesActionExpression){const u=[t.toolCalls?"@Run":"","@ToAssistant","@OpenUrl",t.bindings?"@Set":"",t.bindings?"@Reset":""].filter(Boolean);n.push(`Props typed \`ActionExpression\` accept an Action([@steps...]) expression. See the Action section for available steps (${u.join(", ")}).`)}(t.bindings||Object.values(e.components).some(u=>{var d;return(d=u.signature)==null?void 0:d.includes("$binding")}))&&n.push("Props marked `$binding<type>` accept a `$variable` reference for two-way binding.");const a=u=>u.description?`${u.signature} — ${u.description}`:u.signature;if((s=e.componentGroups)!=null&&s.length){const u=new Set;for(const f of e.componentGroups){n.push("",`### ${f.name}`);for(const h of f.components){if(u.has(h))continue;const g=e.components[h];g&&(u.add(h),n.push(a(g)))}if((l=f.notes)!=null&&l.length)for(const h of f.notes)n.push(h)}const d=Object.keys(e.components).filter(f=>!u.has(f));if(d.length){n.push("","### Other");for(const f of d){const h=e.components[f];n.push(a(h))}}}else{n.push("");for(const[,u]of Object.entries(e.components))n.push(a(u))}return n.join(`
1610
+ `)}function h6(e){var h,g,m;const t=e.root??"Root",n=!!((h=e.tools)!=null&&h.length),a=e.toolCalls??n,s=e.bindings??a,l=a||s,u=Object.values(e.components).some(y=>{var b;return(b=y.signature)==null?void 0:b.includes("ActionExpression")}),d=[];d.push(e.preamble??J3),d.push(""),d.push(e6(t,{supportsExpressions:l,bindings:s})),d.push(""),d.push(f6(e,{toolCalls:a,bindings:s,usesActionExpression:u})),l&&(d.push(""),d.push(t6())),a&&(d.push(""),d.push(n6()),d.push(""),d.push(r6())),u&&(d.push(""),d.push(a6({toolCalls:a,bindings:s}))),a&&s&&(d.push(""),d.push(i6())),a&&(d.push(""),d.push(c6())),(g=e.tools)!=null&&g.length&&(d.push(""),d.push(p6(e.tools))),d.push(""),d.push(o6(t,{supportsExpressions:l}));const f=[...e.examples??[],...e.toolExamples??[]];if(f.length){d.push(""),d.push("## Examples"),d.push("");for(const y of f)d.push(y),d.push("")}if(e.editMode&&(d.push(""),d.push(s6())),e.inlineMode&&(d.push(""),d.push(l6())),d.push(u6(t,{toolCalls:a,bindings:s})),(m=e.additionalRules)!=null&&m.length){d.push("");for(const y of e.additionalRules)d.push(`- ${y}`)}return d.join(`
1611
+ `)}const m6=new WeakSet;function Ll(e){return typeof e=="object"&&e!==null&&m6.has(e)}const rC=new WeakMap;function g6(e,t){if(e!=null&&typeof e=="object"&&"_def"in e&&!("_zod"in e))throw new Error(`[OpenUI] Component "${t}" was defined with a Zod 3 schema. OpenUI requires Zod 4 schemas. If you're on zod@3.25+, import from "zod/v4" instead of "zod". See: https://zod.dev/v4/versioning`)}function v6(e){return g6(e.props,e.name),rC.set(e.props,e.name),{...e,ref:e.props}}function Pa(e){var t;return(t=e==null?void 0:e._zod)==null?void 0:t.def}function fv(e){var t;return(t=Pa(e))==null?void 0:t.type}function aC(e){const t=fv(e);return t==="optional"||t==="default"||t==="nullable"}function tc(e){let t=e,n=Pa(t);for(;(n==null?void 0:n.type)==="optional"||(n==null?void 0:n.type)==="default"||(n==null?void 0:n.type)==="nullable";)t=n.innerType,n=Pa(t);return t}function iC(e){return fv(tc(e))==="array"}function y6(e){const t=Pa(tc(e));if((t==null?void 0:t.type)==="array")return t.element??t.innerType}function b6(e){const t=Pa(tc(e));if((t==null?void 0:t.type)==="enum"){if(Array.isArray(t.values))return t.values;if(t.entries&&typeof t.entries=="object")return Object.keys(t.entries)}}function x6(e,t){try{const n=t.get(e);if(n!=null&&n.id)return n.id}catch{}if(typeof e=="object"&&e!==null)return rC.get(e)}function ow(e){const t=Pa(e);if((t==null?void 0:t.type)==="union"&&Array.isArray(t.options))return t.options}function w6(e){const t=Pa(e);if((t==null?void 0:t.type)==="object"&&t.shape&&typeof t.shape=="object")return t.shape}function Xs(e,t){const n=Ll(e),a=k6(tc(e),t);if(a)return n?`$binding<${a}>`:a}function k6(e,t){var d;const n=x6(e,t);if(n)return n;const a=ow(e);if(a){const f=a.map(h=>Xs(h,t)).filter(Boolean);if(f.length>0)return f.join(" | ")}if(iC(e)){const f=y6(e);if(!f)return;const h=Xs(f,t);return h?ow(tc(f))!==void 0?`(${h})[]`:`${h}[]`:void 0}const s=fv(e);if(s==="string")return"string";if(s==="number")return"number";if(s==="boolean")return"boolean";if(s==="any")return"any";if(s==="record"){const f=Pa(e);return`Record<${Xs(f==null?void 0:f.keyType,t)??"string"}, ${Xs(f==null?void 0:f.valueType,t)??"any"}>`}const l=b6(e);if(l)return l.map(f=>`"${f}"`).join(" | ");if(s==="literal"){const f=(d=Pa(e))==null?void 0:d.values;if(Array.isArray(f)&&f.length===1){const h=f[0];return typeof h=="string"?`"${h}"`:String(h)}}const u=w6(e);return u?`{${Object.entries(u).map(([f,h])=>{const g=aC(h)?"?":"",m=Xs(h,t);return m?`${f}${g}: ${m}`:`${f}${g}`}).join(", ")}}`:"any"}function S6(e,t){return Object.entries(e).map(([n,a])=>({name:n,isOptional:aC(a),isArray:iC(a),typeAnnotation:Xs(a,t)}))}function j6(e,t){return`${e}(${t.map(n=>n.typeAnnotation?n.isOptional?`${n.name}?: ${n.typeAnnotation}`:`${n.name}: ${n.typeAnnotation}`:n.isArray?n.isOptional?`[${n.name}]?`:`[${n.name}]`:n.isOptional?`${n.name}?`:n.name).join(", ")})`}function lw(e,t){const n={};for(const[a,s]of Object.entries(e))n[a]={signature:j6(a,S6(s.props.shape,t)),description:s.description};return n}function C6(e){const t={},n=Zj();for(const a of e.components)n.add(a.props,{id:a.name}),t[a.name]=a;if(e.root&&!t[e.root]){const a=Object.keys(t).join(", ");throw new Error(`[createLibrary] Root component "${e.root}" was not found in components. Available components: ${a}`)}return{components:t,componentGroups:e.componentGroups,root:e.root,prompt(a){return h6({root:e.root,components:lw(t,n),componentGroups:e.componentGroups,...a})},toSpec(){return{root:e.root,components:lw(t,n),componentGroups:e.componentGroups}},toJSONSchema(){const a=Pt(Object.fromEntries(Object.entries(t).map(([s,l])=>[s,l.props])));return WI(a,{metadata:n})}}}function za(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return t.type==="element"&&typeof t.typeName=="string"&&typeof t.props=="object"&&t.props!==null&&typeof t.partial=="boolean"}let Lu=(function(e){return e.ContinueConversation="continue_conversation",e.OpenUrl="open_url",e})({});function N6(e){switch(e.k){case"StateRef":case"RuntimeRef":case"BinOp":case"UnaryOp":case"Ternary":case"Member":case"Index":case"Assign":return!0;default:return!1}}const E6=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function ao(e){return!e||typeof e!="object"||Array.isArray(e)?!1:E6.has(e.k)}function T6(e,t){const n=a=>{switch(t(a),a.k){case"Comp":a.args.forEach(n),Object.values(a.mappedProps??{}).forEach(n);break;case"Arr":a.els.forEach(n);break;case"Obj":a.entries.forEach(([,s])=>n(s));break;case"BinOp":n(a.left),n(a.right);break;case"UnaryOp":n(a.operand);break;case"Ternary":n(a.cond),n(a.then),n(a.else);break;case"Member":n(a.obj);break;case"Index":n(a.obj),n(a.index);break;case"Assign":n(a.value);break}};n(e)}let ie=(function(e){return e[e.Newline=0]="Newline",e[e.LParen=1]="LParen",e[e.RParen=2]="RParen",e[e.LBrack=3]="LBrack",e[e.RBrack=4]="RBrack",e[e.LBrace=5]="LBrace",e[e.RBrace=6]="RBrace",e[e.Comma=7]="Comma",e[e.Colon=8]="Colon",e[e.Equals=9]="Equals",e[e.True=10]="True",e[e.False=11]="False",e[e.Null=12]="Null",e[e.EOF=13]="EOF",e[e.Str=14]="Str",e[e.Num=15]="Num",e[e.Ident=16]="Ident",e[e.Type=17]="Type",e[e.StateVar=18]="StateVar",e[e.Dot=19]="Dot",e[e.Plus=20]="Plus",e[e.Minus=21]="Minus",e[e.Star=22]="Star",e[e.Slash=23]="Slash",e[e.Percent=24]="Percent",e[e.EqEq=25]="EqEq",e[e.NotEq=26]="NotEq",e[e.Greater=27]="Greater",e[e.Less=28]="Less",e[e.GreaterEq=29]="GreaterEq",e[e.LessEq=30]="LessEq",e[e.And=31]="And",e[e.Or=32]="Or",e[e.Not=33]="Not",e[e.Question=34]="Question",e[e.BuiltinCall=35]="BuiltinCall",e})({});const A6=1,cw=2,uw=3,Fh=4,xl=5,Hh=6,Mu=7,dw=8,_6=9;function pw(e){let t=0;const n=()=>e[t]??{t:ie.EOF},a=()=>{const y=n();return t++,y},s=y=>{n().t===y&&t++};function l(y){switch(y.t){case ie.Question:return A6;case ie.Or:return cw;case ie.And:return uw;case ie.EqEq:case ie.NotEq:return Fh;case ie.Greater:case ie.Less:case ie.GreaterEq:case ie.LessEq:return xl;case ie.Plus:case ie.Minus:return Hh;case ie.Star:case ie.Slash:case ie.Percent:return Mu;case ie.Dot:case ie.LBrack:return _6;default:return 0}}function u(y=0){let b=d();for(;l(n())>y;)b=f(b);return b}function d(){var b,k;const y=n();if(y.t===ie.Str)return a(),{k:"Str",v:y.v};if(y.t===ie.Num)return a(),{k:"Num",v:y.v};if(y.t===ie.True)return a(),{k:"Bool",v:!0};if(y.t===ie.False)return a(),{k:"Bool",v:!1};if(y.t===ie.Null)return a(),{k:"Null"};if(y.t===ie.LBrack)return g();if(y.t===ie.LBrace)return m();if(y.t===ie.StateVar){const j=y.v;return a(),n().t===ie.Equals?(a(),{k:"Assign",target:j,value:u(0)}):{k:"StateRef",n:j}}if(y.t===ie.Type){const j=y.v;return((b=e[t+1])==null?void 0:b.t)===ie.LParen&&(!Hl(j)||j==="Action")?h():(a(),{k:"Ref",n:j})}if(y.t===ie.BuiltinCall)return((k=e[t+1])==null?void 0:k.t)===ie.LParen?h():(a(),{k:"Ref",n:y.v});if(y.t===ie.Ident)return a(),{k:"Ref",n:y.v};if(y.t===ie.Not)return a(),{k:"UnaryOp",op:"!",operand:u(dw)};if(y.t===ie.Minus)return a(),{k:"UnaryOp",op:"-",operand:u(dw)};if(y.t===ie.LParen){a();const j=u(0);return s(ie.RParen),j}return a(),{k:"Null"}}function f(y){const b=n();if(b.t===ie.Plus)return a(),{k:"BinOp",op:"+",left:y,right:u(Hh)};if(b.t===ie.Minus)return a(),{k:"BinOp",op:"-",left:y,right:u(Hh)};if(b.t===ie.Star)return a(),{k:"BinOp",op:"*",left:y,right:u(Mu)};if(b.t===ie.Slash)return a(),{k:"BinOp",op:"/",left:y,right:u(Mu)};if(b.t===ie.Percent)return a(),{k:"BinOp",op:"%",left:y,right:u(Mu)};if(b.t===ie.EqEq)return a(),{k:"BinOp",op:"==",left:y,right:u(Fh)};if(b.t===ie.NotEq)return a(),{k:"BinOp",op:"!=",left:y,right:u(Fh)};if(b.t===ie.Greater)return a(),{k:"BinOp",op:">",left:y,right:u(xl)};if(b.t===ie.Less)return a(),{k:"BinOp",op:"<",left:y,right:u(xl)};if(b.t===ie.GreaterEq)return a(),{k:"BinOp",op:">=",left:y,right:u(xl)};if(b.t===ie.LessEq)return a(),{k:"BinOp",op:"<=",left:y,right:u(xl)};if(b.t===ie.And)return a(),{k:"BinOp",op:"&&",left:y,right:u(uw)};if(b.t===ie.Or)return a(),{k:"BinOp",op:"||",left:y,right:u(cw)};if(b.t===ie.Question){a();const k=u(0);return s(ie.Colon),{k:"Ternary",cond:y,then:k,else:u(0)}}if(b.t===ie.Dot){a();const k=n();return{k:"Member",obj:y,field:k.t===ie.Ident||k.t===ie.Type||k.t===ie.Str||k.t===ie.Num?(a(),String(k.v)):k.t===ie.StateVar?(a(),k.v.replace(/^\$/,"")):(a(),"?")}}if(b.t===ie.LBrack){a();const k=u(0);return s(ie.RBrack),{k:"Index",obj:y,index:k}}return y}function h(){const y=n().v;a(),s(ie.LParen);const b=[];for(;n().t!==ie.RParen&&n().t!==ie.EOF;)b.push(u(0)),n().t===ie.Comma&&a();return s(ie.RParen),{k:"Comp",name:y,args:b}}function g(){a();const y=[];for(;n().t!==ie.RBrack&&n().t!==ie.EOF;)y.push(u(0)),n().t===ie.Comma&&a();return s(ie.RBrack),{k:"Arr",els:y}}function m(){a();const y=[];for(;n().t!==ie.RBrace&&n().t!==ie.EOF;){const b=n(),k=b.t===ie.Ident||b.t===ie.Str||b.t===ie.Type||b.t===ie.Num?(a(),String(b.v)):b.t===ie.StateVar?(a(),b.v.replace(/^\$/,"")):(a(),"?");s(ie.Colon),y.push([k,u(0)]),n().t===ie.Comma&&a()}return s(ie.RBrace),{k:"Obj",entries:y}}return u(0)}function fw(e){const t=[];let n=0;const a=e.length;for(;n<a;){for(;n<a&&(e[n]===" "||e[n]===" "||e[n]==="\r");)n++;if(n>=a)break;const s=e[n];if(s===`
1612
+ `){t.push({t:ie.Newline}),n++;continue}if(s==="("){t.push({t:ie.LParen}),n++;continue}if(s===")"){t.push({t:ie.RParen}),n++;continue}if(s==="["){t.push({t:ie.LBrack}),n++;continue}if(s==="]"){t.push({t:ie.RBrack}),n++;continue}if(s==="{"){t.push({t:ie.LBrace}),n++;continue}if(s==="}"){t.push({t:ie.RBrace}),n++;continue}if(s===","){t.push({t:ie.Comma}),n++;continue}if(s===":"){t.push({t:ie.Colon}),n++;continue}if(s==="="){n+1<a&&e[n+1]==="="?(t.push({t:ie.EqEq}),n+=2):(t.push({t:ie.Equals}),n++);continue}if(s==="!"){n+1<a&&e[n+1]==="="?(t.push({t:ie.NotEq}),n+=2):(t.push({t:ie.Not}),n++);continue}if(s===">"){n+1<a&&e[n+1]==="="?(t.push({t:ie.GreaterEq}),n+=2):(t.push({t:ie.Greater}),n++);continue}if(s==="<"){n+1<a&&e[n+1]==="="?(t.push({t:ie.LessEq}),n+=2):(t.push({t:ie.Less}),n++);continue}if(s==="&"){n+1<a&&e[n+1]==="&"?(t.push({t:ie.And}),n+=2):(t.push({t:ie.And}),n++);continue}if(s==="|"){n+1<a&&e[n+1]==="|"?(t.push({t:ie.Or}),n+=2):(t.push({t:ie.Or}),n++);continue}if(s==="."){t.push({t:ie.Dot}),n++;continue}if(s==="?"){t.push({t:ie.Question}),n++;continue}if(s==="+"){t.push({t:ie.Plus}),n++;continue}if(s==="*"){t.push({t:ie.Star}),n++;continue}if(s==="/"){t.push({t:ie.Slash}),n++;continue}if(s==="%"){t.push({t:ie.Percent}),n++;continue}if(s==='"'){const d=n;n++;let f=!1;for(;n<a;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,f=!0;break}else n++;const h=e.slice(d,n);try{const g=f?h:h+'"';t.push({t:ie.Str,v:JSON.parse(g)})}catch{const g=h.replace(/^"|"$/g,"");t.push({t:ie.Str,v:g})}continue}if(s==="'"){n++;let d="";for(;n<a;)if(e[n]==="\\"){if(n++,n<a){const f=e[n];f==="'"?d+="'":f==="\\"?d+="\\":f==="n"?d+=`
1613
+ `:f==="t"?d+=" ":d+=f,n++}}else if(e[n]==="'"){n++;break}else d+=e[n],n++;t.push({t:ie.Str,v:d});continue}if(s==="-"){const d=t.length>0?t[t.length-1]:null;if(!(!(d!=null&&(d.t===ie.Num||d.t===ie.Str||d.t===ie.Ident||d.t===ie.Type||d.t===ie.RParen||d.t===ie.RBrack||d.t===ie.True||d.t===ie.False||d.t===ie.Null||d.t===ie.StateVar||d.t===ie.BuiltinCall))&&n+1<a&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:ie.Minus}),n++;continue}}const l=s>="0"&&s<="9",u=s==="-"&&n+1<a&&e[n+1]>="0"&&e[n+1]<="9";if(l||u){const d=n;for(e[n]==="-"&&n++;n<a&&e[n]>="0"&&e[n]<="9";)n++;if(n<a&&e[n]==="."&&n+1<a&&e[n+1]>="0"&&e[n+1]<="9")for(n++;n<a&&e[n]>="0"&&e[n]<="9";)n++;if(n<a&&(e[n]==="e"||e[n]==="E"))for(n++,n<a&&(e[n]==="+"||e[n]==="-")&&n++;n<a&&e[n]>="0"&&e[n]<="9";)n++;t.push({t:ie.Num,v:+e.slice(d,n)});continue}if(s==="$"&&n+1<a&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){const d=n;for(n++;n<a&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:ie.StateVar,v:e.slice(d,n)});continue}if(s>="a"&&s<="z"||s>="A"&&s<="Z"||s==="_"){const d=n;for(;n<a&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;const f=e.slice(d,n);if(f==="true"){t.push({t:ie.True});continue}if(f==="false"){t.push({t:ie.False});continue}if(f==="null"){t.push({t:ie.Null});continue}const h=s>="A"&&s<="Z"?ie.Type:ie.Ident;t.push({t:h,v:f});continue}if(s==="@"&&n+1<a&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){n++;const d=n;for(;n<a&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:ie.BuiltinCall,v:e.slice(d,n)});continue}n++}return t.push({t:ie.EOF}),t}function Ju(e){return e==null||typeof e!="object"?!1:ao(e)?!0:Array.isArray(e)?e.some(Ju):za(e)?Object.values(e.props).some(Ju):Object.values(e).some(Ju)}function sC(e,t,n){var l;if(t.visited.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;if(!t.syms.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;const a=t.syms.get(e);if((l=t.unreached)==null||l.delete(e),a.k==="Comp"&&yd(a.name))return{k:"RuntimeRef",n:e,refType:a.name===ki.Mutation?"mutation":"query"};t.visited.add(e);const s=t.currentStatementId;t.currentStatementId=e;try{const u=n==="value"?io(a,t):Bm(a,t);return n==="value"&&za(u)&&(u.statementId=e),u}finally{t.currentStatementId=s,t.visited.delete(e)}}function oC(e,t,n){if(!pv.has(e.name)||e.args.length<3)return null;const a=e.args[1],s=a.k==="Ref"?a.n:a.k==="Str"?a.v:null;if(!s)return null;const l=new Set(n);l.add(s);const u=e.args.map((d,f)=>f===1?d:Mn(d,t,l));return{...e,args:u}}function Mn(e,t,n){var a;switch(e.k){case"Ref":return n.has(e.n)?e:sC(e.n,t,"expr");case"Ph":return e;case"Comp":{const s=oC(e,t,n);if(s)return s;const l=e.args.map(d=>Mn(d,t,n));if(Hl(e.name)||yd(e.name))return{...e,args:l};const u=(a=t.cat)==null?void 0:a.get(e.name);if(u){const d={};for(let f=0;f<u.params.length&&f<l.length;f++)d[u.params[f].name]=l[f];return{...e,args:l,mappedProps:d}}return t.errors.push({code:"unknown-component",component:e.name,path:"",message:`Unknown component "${e.name}" — not found in catalog or builtins`,statementId:t.currentStatementId}),{...e,args:l}}case"Arr":return{...e,els:e.els.map(s=>Mn(s,t,n))};case"Obj":return{...e,entries:e.entries.map(([s,l])=>[s,Mn(l,t,n)])};case"BinOp":return{...e,left:Mn(e.left,t,n),right:Mn(e.right,t,n)};case"UnaryOp":return{...e,operand:Mn(e.operand,t,n)};case"Ternary":return{...e,cond:Mn(e.cond,t,n),then:Mn(e.then,t,n),else:Mn(e.else,t,n)};case"Member":return{...e,obj:Mn(e.obj,t,n)};case"Index":return{...e,obj:Mn(e.obj,t,n),index:Mn(e.index,t,n)};case"Assign":return{...e,value:Mn(e.value,t,n)};default:return e}}function Bm(e,t){return Mn(e,t,new Set)}function io(e,t){var n;switch(e.k){case"Ref":return sC(e.n,t,"value");case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"Arr":{const a=[];for(const s of e.els){if(s.k==="Ph")continue;const l=io(s,t);l===null&&(s.k==="Comp"||s.k==="Ref")||a.push(l)}return a}case"Obj":{const a={};for(const[s,l]of e.entries)a[s]=io(l,t);return a}case"Comp":{const{name:a,args:s}=e;if(Hl(a)){const f=oC(e,t,new Set);return f||{...e,args:s.map(h=>Bm(h,t))}}if(yd(a))return t.errors.push({code:"inline-reserved",component:a,path:"",message:`${a}() must be declared as a top-level statement, not used inline as a value`,statementId:t.currentStatementId}),null;const l=(n=t.cat)==null?void 0:n.get(a),u={};if(l){for(let h=0;h<l.params.length&&h<s.length;h++)u[l.params[h].name]=io(s[h],t);if(s.length>l.params.length){const h=s.length-l.params.length;t.errors.push({code:"excess-args",component:a,path:"",message:`${a} takes ${l.params.length} arg(s), got ${s.length} (${h} excess dropped)`,statementId:t.currentStatementId})}const f=l.params.filter(h=>h.required&&(!(h.name in u)||u[h.name]===null));if(f.length){const h=f.filter(g=>g.defaultValue!==void 0?(u[g.name]=g.defaultValue,!1):!0);if(h.length){for(const g of h){const m=g.name in u;t.errors.push({code:m?"null-required":"missing-required",component:a,path:`/${g.name}`,message:m?`required field "${g.name}" cannot be null`:`missing required field "${g.name}"`,statementId:t.currentStatementId})}return null}}}else if(!Hl(a)&&!yd(a))return t.errors.push({code:"unknown-component",component:a,path:"",message:`Unknown component "${a}" — not found in catalog or builtins`,statementId:t.currentStatementId}),null;const d=Object.values(u).some(f=>Ju(f));return{type:"element",typeName:a,props:u,partial:t.partial,hasDynamicProps:d}}default:return N6(e)?Bm(e,t):e}}function R6(e){const t=[];let n=!1,a=!1;for(let l=0;l<e.length;l++){const u=e[l];if(a){a=!1;continue}if(u==="\\"&&n){a=!0;continue}if(n){u===n&&(n=!1);continue}if(u==='"'||u==="'"){n=u;continue}u==="("||u==="["||u==="{"?t.push(u):(u===")"&&t[t.length-1]==="("||u==="]"&&t[t.length-1]==="["||u==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(n||t.length>0))return{text:e,wasIncomplete:!1};let s=e;n&&(a&&(s+="\\"),s+=n);for(let l=t.length-1;l>=0;l--)s+=t[l]==="("?")":t[l]==="["?"]":"}";return{text:s,wasIncomplete:!0}}function hw(e){const t=[];let n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===ie.Newline;)n++;if(n>=e.length||e[n].t===ie.EOF)break;const a=e[n];if(a.t!==ie.Ident&&a.t!==ie.Type&&a.t!==ie.StateVar){for(;n<e.length&&e[n].t!==ie.Newline&&e[n].t!==ie.EOF;)n++;continue}const s=a.v,l=a.t;if(n++,n>=e.length||e[n].t!==ie.Equals){for(;n<e.length&&e[n].t!==ie.Newline&&e[n].t!==ie.EOF;)n++;continue}n++;const u=[];let d=0,f=0;for(;n<e.length&&e[n].t!==ie.EOF;){const h=e[n].t;if(h===ie.Newline&&d<=0&&f<=0){let g=n+1;for(;g<e.length&&e[g].t===ie.Newline;)g++;const m=g<e.length?e[g].t:ie.EOF;if(m===ie.Question||m===ie.Colon&&f>0){n++;continue}break}if(h===ie.Newline){n++;continue}h===ie.LParen||h===ie.LBrack||h===ie.LBrace?d++:(h===ie.RParen||h===ie.RBrack||h===ie.RBrace)&&d>0?d--:h===ie.Question&&d===0?f++:h===ie.Colon&&d===0&&f>0&&f--,u.push(e[n++])}u.length&&t.push({id:s,idTokenType:l,tokens:u})}return t}function ed(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function lC(e){if(!ao(e))return[];const t=new Set;return T6(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function mw(e,t){if(t.k==="Comp"&&t.name===ki.Query){const n=lC(t.args[1]);return{kind:"query",id:e.id,call:{callee:ki.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===ki.Mutation?{kind:"mutation",id:e.id,call:{callee:ki.Mutation,args:t.args},expr:t}:e.idTokenType===ie.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function O6(e,t){const n={},a=[],s=[];for(const l of e)switch(l.kind){case"state":n[l.id]=io(l.init,t);break;case"query":a.push({statementId:l.id,toolAST:l.call.args[0]??null,argsAST:l.call.args[1]??null,defaultsAST:l.call.args[2]??null,refreshAST:l.call.args[3]??null,deps:l.deps,complete:!0});break;case"mutation":s.push({statementId:l.id,toolAST:l.call.args[0]??null,argsAST:l.call.args[1]??null});break}for(const l of e){const u=l.kind==="state"?[l.init]:l.kind==="value"?[l.expr]:l.kind==="query"||l.kind==="mutation"?l.call.args:[];for(const d of u)for(const f of lC(d))f in n||(n[f]=null)}return{stateDeclarations:n,queryStatements:a,mutationStatements:s}}const gw="root";function vw(e){return e.kind==="value"&&e.expr.k==="Comp"&&!Hl(e.expr.name)&&e.expr.name!==ki.Query&&e.expr.name!==ki.Mutation}function L6(e,t,n,a){var l;if(e.has(gw))return gw;if(a&&e.has(a))return a;const s=a?t.find(u=>vw(u)&&u.expr.name===a):void 0;return s?s.id:((l=t.find(vw))==null?void 0:l.id)??n}function Du(e,t,n,a,s,l,u){const d=L6(e,t,n,u);if(!e.has(d))return ed(a);const f=new Map;for(const[T,E]of e)f.set(T,E.kind==="state"?E.init:E.expr);const h=[],g=[],m=new Set;for(const[T,E]of e)T!==d&&(E.kind==="state"||E.kind==="query"||E.kind==="mutation"||m.add(T));const y={syms:f,cat:l,errors:g,unres:h,visited:new Set,partial:a,currentStatementId:d,unreached:m},b=io(f.get(d),y),k=za(b)?b:null;k&&(k.statementId=d);const{stateDeclarations:j,queryStatements:N,mutationStatements:S}=O6(t,y);return{root:k,meta:{incomplete:a,unresolved:h,orphaned:[...m],statementCount:s,errors:g},stateDeclarations:j,queryStatements:N,mutationStatements:S}}function M6(e){const t=[];let n=0;for(;n<e.length;){const a=e.indexOf("```",n);if(a===-1)break;let s=a+3;for(;s<e.length&&e[s]!==`
1614
+ `;)s++;if(s>=e.length){t.push(e.slice(a+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}s++;let l=!1,u=-1,d=s;for(;d<e.length;){const f=e[d];if(l){if(f==="\\"&&d+1<e.length){d+=2;continue}f==='"'&&(l=!1),d++;continue}if(f==='"'){l=!0,d++;continue}if(f==="`"&&d+1<e.length&&e[d+1]==="`"&&d+2<e.length&&e[d+2]==="`"){u=d;break}d++}u!==-1?(t.push(e.slice(s,u)),n=u+3):(t.push(e.slice(s)),n=e.length)}if(t.length>0)return t.join(`
1615
+ `);if(e.startsWith("```")){let a=3;for(;a<e.length&&e[a]!==`
1616
+ `;)a++;const s=a<e.length?a+1:3,l=e.slice(s),u=l.lastIndexOf("```");return u!==-1?l.slice(0,u):l}return e}function yw(e){return e.split(`
1617
+ `).map(t=>{let n=!1;for(let a=0;a<t.length;a++){const s=t[a];if(n){if(s==="\\"&&a+1<t.length){a++;continue}s===n&&(n=!1);continue}if(s==='"'||s==="'"){n=s;continue}if(s==="/"&&t[a+1]==="/"||s==="#")return t.substring(0,a).trimEnd()}return t}).join(`
1618
+ `)}function D6(e,t){let n="",a=0;const s=new Map;let l=0,u="";function d(m){const y=yw(m).trim();if(!(!y||/^```/.test(y)))for(const b of hw(fw(y))){const k=mw(b,pw(b.tokens));s.set(b.id,k),l++,u||(u=b.id)}}function f(){let m=0,y=0,b=!1,k=!1,j=a;for(let N=a;N<n.length;N++){const S=n[N];if(k){k=!1;continue}if(S==="\\"&&b){k=!0;continue}if(b){S===b&&(b=!1);continue}if(S==='"'||S==="'"){b=S;continue}if(S==="("||S==="["||S==="{")m++;else if(S===")"||S==="]"||S==="}")m=Math.max(0,m-1);else if(S==="?"&&m===0)y++;else if(S===":"&&m===0&&y>0)y--;else if(S===`
1619
+ `&&m<=0&&y<=0){let T=N+1;for(;T<n.length&&(n[T]===" "||n[T]===" "||n[T]==="\r"||n[T]===`
1620
+ `);)T++;if(T<n.length&&(n[T]==="?"||n[T]===":"&&y>0))continue;const E=n.slice(j,N).trim();E&&d(E),j=N+1,a=N+1}}return j}function h(){const m=f(),y=n.slice(m).trim();if(!y)return l===0?ed():Du(s,[...s.values()],u,!1,l,e,t);const b=yw(M6(y)).trim();if(!b)return l===0?ed():Du(s,[...s.values()],u,!1,l,e,t);const{text:k,wasIncomplete:j}=R6(b),N=hw(fw(k));if(!N.length)return l===0?ed(j):Du(s,[...s.values()],u,j,l,e,t);const S=new Map(s);for(const T of N){if(s.has(T.id))continue;const E=mw(T,pw(T.tokens));S.set(T.id,E)}return Du(S,[...S.values()],u||N[0].id,j,l+N.length,e,t)}function g(){n="",a=0,s.clear(),l=0,u=""}return{push(m){return n+=m,h()},set(m){(m.length<n.length||!m.startsWith(n))&&g();const y=m.slice(n.length);return y&&(n+=y),h()},getResult:h}}function z6(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function $6(e){const t=new Map,n=e.$defs??{};for(const[a,s]of Object.entries(n)){const l=s.properties??{},u=s.required??[],d=Object.keys(l).map(f=>({name:f,required:u.includes(f),defaultValue:z6(l[f])}));t.set(a,{params:d})}return t}function I6(e,t){return D6($6(e),t)}function P6(e,t){if(!(t!=null&&t.properties))return;const n=new Set(t.required??[]);return`Signature: ${e}(${Object.keys(t.properties).map(a=>n.has(a)?`${a}*`:a).join(", ")}) — * marks required`}function U6(e,t,n){return e.map(a=>{var l;const s={source:"parser",code:a.code,message:a.message,component:a.component,path:a.path||void 0,statementId:a.statementId};return a.code==="unknown-component"&&n.length?s.hint=`Available components: ${n.join(", ")}`:a.code==="missing-required"||a.code==="null-required"?s.hint=P6(a.component,(l=t.$defs)==null?void 0:l[a.component]):a.code==="inline-reserved"&&(s.hint=`Declare as a top-level statement: myVar = ${a.component}(...)`),s})}function B6(e){return typeof e=="object"&&e!==null&&e.__reactive==="assign"}function vt(e,t,n){var a,s,l;switch(e.k){case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"StateRef":return((a=t.extraScope)==null?void 0:a[e.n])??t.getState(e.n);case"Ref":case"RuntimeRef":return t.resolveRef(e.n);case"Arr":return e.els.map(u=>vt(u,t));case"Obj":return Object.fromEntries(e.entries.map(([u,d])=>[u,vt(d,t)]));case"Comp":{if(pv.has(e.name))return H6(e.name,e.args,t,n);const u=dv[e.name];if(u){const d=e.args.map(f=>vt(f,t));return u.fn(...d)}if(tC.has(e.name))return F6(e.name,e.args,t);if(e.mappedProps){const d=n==null?void 0:n.library.components[e.name],f={};for(const[g,m]of Object.entries(e.mappedProps)){const y=(l=(s=d==null?void 0:d.props)==null?void 0:s.shape)==null?void 0:l[g];m.k==="StateRef"&&y&&Ll(y)?f[g]={__reactive:"assign",target:m.n,expr:{k:"StateRef",n:"$value"}}:m.k==="StateRef"?f[g]=n?t.getState(m.n):m:f[g]=vt(m,t,n)}const h={type:"element",typeName:e.name,props:f,partial:!1,hasDynamicProps:!0};if(n)for(const[g,m]of Object.entries(f))za(m)?f[g]=xd(m,t,n):Array.isArray(m)&&(f[g]=m.map(y=>za(y)?xd(y,t,n):y));return h}return console.warn(`[openui] Unexpected unmapped Comp node: ${e.name}`),null}case"BinOp":{if(e.op==="&&"){const f=vt(e.left,t);return f&&vt(e.right,t)}if(e.op==="||"){const f=vt(e.left,t);return f||vt(e.right,t)}const u=vt(e.left,t),d=vt(e.right,t);switch(e.op){case"+":return typeof u=="string"||typeof d=="string"?String(u??"")+String(d??""):Ze(u)+Ze(d);case"-":return Ze(u)-Ze(d);case"*":return Ze(u)*Ze(d);case"/":return Ze(d)===0?0:Ze(u)/Ze(d);case"%":return Ze(d)===0?0:Ze(u)%Ze(d);case"==":return u==d;case"!=":return u!=d;case">":return Ze(u)>Ze(d);case"<":return Ze(u)<Ze(d);case">=":return Ze(u)>=Ze(d);case"<=":return Ze(u)<=Ze(d);default:return null}}case"UnaryOp":return e.op==="!"?!vt(e.operand,t):e.op==="-"?-Ze(vt(e.operand,t)):null;case"Ternary":return vt(e.cond,t)?vt(e.then,t):vt(e.else,t);case"Member":{const u=vt(e.obj,t);return u==null?null:Array.isArray(u)?e.field==="length"?u.length:u.map(d=>(d==null?void 0:d[e.field])??null):u[e.field]}case"Index":{const u=vt(e.obj,t),d=vt(e.index,t);return u==null||d==null?null:Array.isArray(u)?u[Ze(d)]:u[String(d)]}case"Assign":return{__reactive:"assign",target:e.target,expr:e.value}}}function xd(e,t,n){var l,u;if(e.hasDynamicProps===!1)return e;const a=n.library.components[e.typeName],s={};for(const[d,f]of Object.entries(e.props)){const h=(u=(l=a==null?void 0:a.props)==null?void 0:l.shape)==null?void 0:u[d];s[d]=cC(f,t,n,h)}return{...e,props:s}}function cC(e,t,n,a){return uC(e,t,n,a,{recurseElement:s=>xd(s,t,n),recurse:(s,l)=>cC(s,t,n,l)})}function Fm(e){return e==null?{k:"Null"}:typeof e=="string"?{k:"Str",v:e}:typeof e=="number"?{k:"Num",v:e}:typeof e=="boolean"?{k:"Bool",v:e}:Array.isArray(e)?{k:"Arr",els:e.map(Fm)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,Fm(n)])}:{k:"Null"}}function F6(e,t,n){switch(e){case"Action":{const a=t.length>0?vt(t[0],n):[];return{steps:(Array.isArray(a)?a:[]).filter(s=>s!=null&&typeof s=="object"&&"type"in s)}}case"Run":{if(t.length===0)return null;const a=t[0];return a.k==="RuntimeRef"?{type:Ir.Run,statementId:a.n,refType:a.refType}:null}case"ToAssistant":{const a=t.length>0?String(vt(t[0],n)??""):"",s=t.length>1?String(vt(t[1],n)??""):void 0;return{type:Ir.ToAssistant,message:a,context:s}}case"OpenUrl":{const a=t.length>0?String(vt(t[0],n)??""):"";return{type:Ir.OpenUrl,url:a}}case"Set":{if(t.length<2)return null;const a=t[0];return a.k!=="StateRef"?null:{type:Ir.Set,target:a.n,valueAST:t[1]}}case"Reset":{const a=t.filter(s=>s.k==="StateRef").map(s=>s.n);return a.length===0?null:{type:Ir.Reset,targets:a}}default:return null}}function Ln(e,t,n){switch(e.k){case"Ref":return e.n===t?Fm(n):e;case"Member":if(ao(e.obj)){const a=Ln(e.obj,t,n);if(a.k==="Obj"){const s=a.entries.find(([l])=>l===e.field);if(s)return s[1]}return{...e,obj:a}}return e;case"Index":return{...e,obj:ao(e.obj)?Ln(e.obj,t,n):e.obj,index:ao(e.index)?Ln(e.index,t,n):e.index};case"BinOp":return{...e,left:Ln(e.left,t,n),right:Ln(e.right,t,n)};case"UnaryOp":return{...e,operand:Ln(e.operand,t,n)};case"Ternary":return{...e,cond:Ln(e.cond,t,n),then:Ln(e.then,t,n),else:Ln(e.else,t,n)};case"Arr":return{...e,els:e.els.map(a=>Ln(a,t,n))};case"Obj":return{...e,entries:e.entries.map(([a,s])=>[a,Ln(s,t,n)])};case"Comp":{const a={...e,args:e.args.map(s=>Ln(s,t,n))};if(e.mappedProps){const s={};for(const[l,u]of Object.entries(e.mappedProps))s[l]=Ln(u,t,n);a.mappedProps=s}return a}case"Assign":return{...e,value:Ln(e.value,t,n)};default:return e}}function H6(e,t,n,a){if(e==="Each"){if(t.length<3)return[];const s=vt(t[0],n);if(!Array.isArray(s))return[];const l=t[1].k==="Ref"?t[1].n:t[1].k==="Str"?t[1].v:null;if(!l)return[];const u=t[2];return s.map((d,f)=>{const h=Ln(u,l,d),g={...n,resolveRef:y=>y===l?d:n.resolveRef(y)},m=vt(h,g,a);return a&&za(m)?xd(m,g,a):m})}return null}function uC(e,t,n,a,s){if(e==null||typeof e!="object")return e;if(ao(e)){if(e.k==="StateRef"&&a&&Ll(a))return{__reactive:"assign",target:e.n,expr:{k:"StateRef",n:"$value"}};const d=vt(e,t,n);return za(d)?s.recurseElement(d):Array.isArray(d)?d.map(f=>za(f)?s.recurseElement(f):f):B6(d)&&!(a&&Ll(a))?t.getState(d.target)??null:d}if(typeof e=="string"&&a&&Ll(a))return e;if(Array.isArray(e))return e.map(d=>s.recurse(d,a));if(za(e))return s.recurseElement(e);const l=e;if("steps"in l&&Array.isArray(l.steps)||"type"in l&&"valueAST"in l)return e;let u=!1;for(const d of Object.values(l))if(typeof d=="object"&&d!==null){u=!0;break}if(u){const d={};for(const[f,h]of Object.entries(l))d[f]=s.recurse(h,a);return d}return e}function dC(e,t){var l,u,d;if(e.hasDynamicProps===!1)return e;const n={library:t.library},a=t.library.components[e.typeName],s={};for(const[f,h]of Object.entries(e.props)){const g=(u=(l=a==null?void 0:a.props)==null?void 0:l.shape)==null?void 0:u[f];try{s[f]=pC(h,t,n,g)}catch(m){s[f]=h;const y=m instanceof Error?m.message:String(m);(d=t.errors)==null||d.push({source:"runtime",code:"runtime-error",component:e.typeName,statementId:e.statementId,message:`Evaluating prop "${f}" on ${e.typeName} failed: ${y}`,hint:`Check the expression used for prop "${f}"`})}}return{...e,props:s}}function pC(e,t,n,a){return uC(e,t.ctx,n,a,{recurseElement:s=>dC(s,t),recurse:(s,l)=>pC(s,t,n,l)})}var Hm=class extends Error{constructor(t){super(`MCP tool error: ${t||"Unknown error"}`);Sn(this,"toolErrorText");this.name="McpToolError",this.toolErrorText=t}};function q6(e){var n,a;if(e.isError){const s=(n=e.content)==null?void 0:n.filter(l=>l.type==="text").map(l=>l.text).join(`
1621
+ `);throw new Hm(s||"Unknown error")}if(e.structuredContent!=null)return e.structuredContent;const t=(a=e.content)==null?void 0:a.filter(s=>s.type==="text").map(s=>s.text??"");if(t!=null&&t.length){const s=t.join("");try{return JSON.parse(s)}catch{return s}}return null}var qm=class extends Error{constructor(t,n=[]){super(`[openui] No handler for tool "${t}". Available: ${n.join(", ")||"(none)"}`);Sn(this,"toolName");Sn(this,"availableTools");this.name="ToolNotFoundError",this.toolName=t,this.availableTools=n}};function bw(e){return JSON.stringify(e,(t,n)=>{if(n&&typeof n=="object"&&!Array.isArray(n)){const a={};for(const s of Object.keys(n).sort())a[s]=n[s];return a}if(n===void 0)return"__undefined__";if(typeof n=="number"){if(Number.isNaN(n))return"__NaN__";if(n===1/0)return"__Inf__";if(n===-1/0)return"__-Inf__"}return n})}function G6(e,t,n){const a=n!=null?"::"+bw(n):"";return e+"::"+bw(t)+a}function V6(e){const t=new Map,n=new Map,a=new Map,s=new Set;let l={__openui_loading:[],__openui_refetching:[],__openui_errors:[]},u=JSON.stringify(l),d=!1,f=0;function h(){const M={__openui_loading:[],__openui_refetching:[],__openui_errors:[]};for(const[R,P]of t){const F=a.get(P.cacheKey);if(F&&F.data!==void 0)M[R]=F.data;else if(P.prevCacheKey){const Z=a.get(P.prevCacheKey);Z&&Z.data!==void 0?M[R]=Z.data:M[R]=P.defaults}else M[R]=P.defaults;P.loading&&(M.__openui_loading.push(R),P.everFetched&&M.__openui_refetching.push(R)),P.error&&M.__openui_errors.push(P.error)}for(const[R,P]of n)M[R]=P.result,P.error&&M.__openui_errors.push(P.error);try{const R=JSON.stringify(M);if(R===u)return!1;l=M,u=R}catch{l=M,u=""}return!0}function g(){for(const M of[...s])M()}async function m(M,R){if(!e)return;const P=t.get(R);if(!P)return;const F=M,Z=P.toolName,I=P.args;let $=a.get(F);$?$.inFlight=!0:($={data:void 0,inFlight:!0},a.set(F,$)),P.loading=!0,h(),g();try{const H=await e.callTool(Z,I??{});if(d)return;const V=t.get(R);if(!V||V.cacheKey!==F){$.inFlight=!1;return}if($.data=H??null,V.everFetched=!0,V.error=void 0,V.prevCacheKey&&V.prevCacheKey!==F){const X=V.prevCacheKey;V.prevCacheKey=void 0,y(X)}}catch(H){const V=t.get(R);V&&V.cacheKey===F&&(H instanceof qm?V.error={source:"query",code:"tool-not-found",message:`Query tool "${Z}" not found`,statementId:R,component:"Query",toolName:Z,hint:H.availableTools.length?`Available tools: ${H.availableTools.join(", ")}`:void 0}:H instanceof Hm?V.error={source:"query",code:"mcp-error",message:`Query "${Z}" returned an error: ${H.toolErrorText}`,statementId:R,component:"Query",toolName:Z}:V.error={source:"query",code:"tool-error",message:`Query "${Z}" failed: ${H instanceof Error?H.message:String(H)}`,statementId:R,component:"Query",toolName:Z}),console.error(`Query "${Z}" failed:`,H)}finally{$.inFlight=!1;const H=t.get(R);H&&H.cacheKey===F?(H.loading=!1,h()&&g(),H.needsRefetch&&(H.needsRefetch=!1,m(H.cacheKey,R))):h()&&g()}}function y(M){for(const R of t.values())if(R.cacheKey===M||R.prevCacheKey===M)return;a.delete(M)}function b(M){if(d)return;const R=new Set(M.map(P=>P.statementId));for(const[P,F]of t)R.has(P)||(F.timer&&clearInterval(F.timer),t.delete(P),y(F.cacheKey),F.prevCacheKey&&y(F.prevCacheKey));for(const P of M){if(!P.complete)continue;const F=G6(P.toolName,P.args,P.deps),Z=t.get(P.statementId);Z?(Z.cacheKey!==F&&(Z.prevCacheKey=Z.cacheKey),Z.toolName=P.toolName,Z.args=P.args,Z.defaults=P.defaults,Z.cacheKey=F):t.set(P.statementId,{toolName:P.toolName,args:P.args,defaults:P.defaults,cacheKey:F,loading:!1,everFetched:!1,refreshInterval:0,needsRefetch:!1});const I=t.get(P.statementId),$=a.get(F),H=$&&$.data!==void 0&&!$.inFlight;e&&!H&&!($!=null&&$.inFlight)&&m(F,P.statementId);const V=P.refreshInterval??0;V!==I.refreshInterval&&(I.timer&&(clearInterval(I.timer),I.timer=void 0),V>0&&(I.timer=setInterval(()=>{var X;d||!e||(X=a.get(I.cacheKey))!=null&&X.inFlight||m(I.cacheKey,P.statementId)},V*1e3)),I.refreshInterval=V)}h()&&g()}function k(M){const R=t.get(M);if(!R)return null;const P=a.get(R.cacheKey);if(P&&P.data!==void 0)return P.data;if(R.prevCacheKey){const F=a.get(R.prevCacheKey);if(F&&F.data!==void 0)return F.data}return R.defaults}function j(M){var R;return((R=t.get(M))==null?void 0:R.loading)??!1}function N(){for(const M of t.values())if(M.loading)return!0;return!1}function S(M){var P;if(d||!e)return;const R=M!=null&&M.length?M.filter(F=>t.has(F)):[...t.keys()];for(const F of R){const Z=t.get(F);Z&&((P=a.get(Z.cacheKey))!=null&&P.inFlight?Z.needsRefetch=!0:m(Z.cacheKey,F))}}function T(M){const R=new Set(M.map(P=>P.statementId));for(const P of n.keys())R.has(P)||n.delete(P);for(const P of M){const F=n.get(P.statementId);F?F.toolName!==P.toolName&&(F.toolName=P.toolName,F.result={status:"idle",data:null,error:null},F.error=void 0):n.set(P.statementId,{toolName:P.toolName,result:{status:"idle"}})}h()&&g()}async function E(M,R,P){if(d||!e)return!1;const F=n.get(M);if(!F||F.result.status==="loading")return!1;const Z=f;F.result={status:"loading"},h(),g();let I=!1;try{const $=await e.callTool(F.toolName,R);if(d||Z!==f)return!1;F.result={status:"success",data:$},F.error=void 0,I=!0}catch($){if(d||Z!==f)return!1;const H=$ instanceof Error?$.message:String($);F.result={status:"error",error:H},$ instanceof qm?F.error={source:"mutation",code:"tool-not-found",message:`Mutation tool "${F.toolName}" not found`,statementId:M,component:"Mutation",toolName:F.toolName,hint:$.availableTools.length?`Available tools: ${$.availableTools.join(", ")}`:void 0}:$ instanceof Hm?F.error={source:"mutation",code:"mcp-error",message:`Mutation "${F.toolName}" returned an error: ${$.toolErrorText}`,statementId:M,component:"Mutation",toolName:F.toolName}:F.error={source:"mutation",code:"tool-error",message:`Mutation "${F.toolName}" failed: ${H}`,statementId:M,component:"Mutation",toolName:F.toolName}}return h(),g(),I&&(P!=null&&P.length)&&S(P),I}function A(M){var R;return((R=n.get(M))==null?void 0:R.result)??null}function B(M){return s.add(M),()=>s.delete(M)}function _(){return l}function z(){d=!1}function q(){d=!0,f++,s.clear();for(const M of t.values())M.timer&&(clearInterval(M.timer),M.timer=void 0),M.loading=!1,M.needsRefetch=!1;n.clear()}return{evaluateQueries:b,getResult:k,isLoading:j,isAnyLoading:N,invalidate:S,registerMutations:T,fireMutation:E,getMutationResult:A,subscribe:B,getSnapshot:_,activate:z,dispose:q}}function W6(){const e=new Map,t=new Set;let n={};function a(){const m=[...t];for(const y of m)y()}function s(){n=Object.fromEntries(e)}function l(m){return e.get(m)}function u(m,y){const b=e.get(m);if(!Object.is(b,y)){if(y&&b&&typeof y=="object"&&typeof b=="object"&&!Array.isArray(y)&&!Array.isArray(b)){const k=Object.keys(y),j=Object.keys(b);if(k.length===j.length&&k.every(N=>Object.is(y[N],b[N])))return}e.set(m,y),s(),a()}}function d(m){return t.add(m),()=>{t.delete(m)}}function f(){return n}function h(m,y){for(const b of Object.keys(y))e.set(b,y[b]);for(const b of Object.keys(m))e.has(b)||e.set(b,m[b]);s(),a()}function g(){e.clear(),t.clear(),n={}}return{get:l,set:u,subscribe:d,getSnapshot:f,initialize:h,dispose:g}}function Rr(e){return v6(e)}function Z6(e){return C6(e)}const fC=w.createContext(null);function hC(){const e=w.useContext(fC);if(!e)throw new Error("useOpenUI must be used within a <Renderer /> component.");return e}function K6(){return hC().renderNode}w.createContext(void 0);function qh(e){return e&&typeof e=="object"&&!Array.isArray(e)&&"value"in e?e.value:e}function Y6({response:e,library:t,isStreaming:n,onAction:a,onStateUpdate:s,initialState:l,toolProvider:u,onError:d},f){const h=w.useMemo(()=>I6(t.toJSONSchema(),t.root),[t]),g=w.useRef(null),m=w.useMemo(()=>{if(g.current=null,!e)return null;try{return h.set(e)}catch(V){return g.current={source:"parser",code:"parse-exception",message:`Parser crashed: ${V instanceof Error?V.message:String(V)}`,hint:"The response may contain syntax the parser cannot handle"},null}},[h,e]),y=w.useMemo(()=>W6(),[]),b=w.useMemo(()=>V6(u??null),[u]);w.useEffect(()=>(b.activate(),()=>b.dispose()),[b]);const k=w.useRef(Symbol());w.useEffect(()=>{if(!(m!=null&&m.stateDeclarations)&&!l)return;const V=`${JSON.stringify(m==null?void 0:m.stateDeclarations)}::${JSON.stringify(l)}`;if(k.current===V)return;k.current=V;const X={};if(l)for(const[Y,L]of Object.entries(l))Y.startsWith("$")?X[Y]=L:y.set(Y,L);y.initialize((m==null?void 0:m.stateDeclarations)??{},X)},[m==null?void 0:m.stateDeclarations,y,l]);const j=w.useSyncExternalStore(y.subscribe,y.getSnapshot,y.getSnapshot),N=w.useSyncExternalStore(b.subscribe,b.getSnapshot,b.getSnapshot),S=w.useMemo(()=>({getState:V=>qh(y.get(V)),resolveRef:V=>{const X=b.getMutationResult(V);return X||b.getResult(V)}}),[y,b]);w.useEffect(()=>{if(n)return;const V=((m==null?void 0:m.queryStatements)??[]).map(X=>{const Y={};if(X.deps)for(const L of X.deps)Y[L]=j[L];return{statementId:X.statementId,toolName:X.toolAST?vt(X.toolAST,S):"",args:X.argsAST?vt(X.argsAST,S):null,defaults:X.defaultsAST?vt(X.defaultsAST,S):null,refreshInterval:X.refreshAST?vt(X.refreshAST,S):void 0,deps:Object.keys(Y).length>0?Y:void 0,complete:X.complete}});b.evaluateQueries(V)},[n,m==null?void 0:m.queryStatements,S,b,j]),w.useEffect(()=>{if(n)return;const V=((m==null?void 0:m.mutationStatements)??[]).map(X=>({statementId:X.statementId,toolName:X.toolAST?vt(X.toolAST,S):""}));b.registerMutations(V)},[n,m==null?void 0:m.mutationStatements,S,b]);const T=w.useRef({onAction:a,onStateUpdate:s,onError:d});T.current={onAction:a,onStateUpdate:s,onError:d};const E=w.useRef(m);E.current=m;const A=w.useRef(null);w.useEffect(()=>(A.current=y.getSnapshot(),y.subscribe(()=>{var X,Y;const V=y.getSnapshot();V!==A.current&&(A.current=null,(Y=(X=T.current).onStateUpdate)==null||Y.call(X,V))})),[y]);const B=w.useCallback((V,X)=>{if(!V)return qh(y.get(X));const Y=y.get(V);if(!(!Y||typeof Y!="object"||Array.isArray(Y)))return qh(Y[X])},[y]),_=w.useCallback((V,X,Y,L,U=!0)=>{var O,ne;const G={value:L,componentType:X};if(!V)y.set(Y,G);else{const ue=y.get(V),le=ue&&typeof ue=="object"&&!Array.isArray(ue)?ue:{};y.set(V,{...le,[Y]:G})}U&&((ne=(O=T.current).onStateUpdate)==null||ne.call(O,y.getSnapshot()))},[y]),z=w.useCallback(V=>{if(V){const X=y.get(V);if(X&&typeof X=="object"&&!Array.isArray(X))return{[V]:X}}return y.getSnapshot()},[y]),q=w.useCallback(async(V,X,Y)=>{var O,ne,ue;const L=z(X),{onAction:U}=T.current;if(Y&&!("steps"in Y)){const le=Y.type||Lu.ContinueConversation,be={...Y.params||{}};Y.url&&(be.url=Y.url),Y.context&&(be.context=Y.context),U==null||U({type:le,params:be,humanFriendlyMessage:V,formState:L,formName:X});return}const G=Y;if(G!=null&&G.steps){for(const le of G.steps)switch(le.type){case Ir.Run:if(le.refType==="mutation"){const be=(ne=(O=E.current)==null?void 0:O.mutationStatements)==null?void 0:ne.find(Ee=>Ee.statementId===le.statementId),_e=be!=null&&be.argsAST?vt(be.argsAST,S):{};if(!await b.fireMutation(le.statementId,_e))return}else b.invalidate([le.statementId]);break;case Ir.ToAssistant:U==null||U({type:Lu.ContinueConversation,params:le.context?{context:le.context}:{},humanFriendlyMessage:le.message,formState:L,formName:X});break;case Ir.OpenUrl:U==null||U({type:Lu.OpenUrl,params:{url:le.url},humanFriendlyMessage:"",formState:L,formName:X});break;case Ir.Set:{if(!le.valueAST){console.warn(`[openui] Set action for ${le.target} has no valueAST — skipping`);break}const be=vt(le.valueAST,S);y.set(le.target,be);break}case Ir.Reset:{const be=((ue=E.current)==null?void 0:ue.stateDeclarations)??{};for(const _e of le.targets)y.set(_e,be[_e]??null);break}}return}U==null||U({type:Lu.ContinueConversation,params:{},humanFriendlyMessage:V,formState:L,formName:X})},[b,S,z,y]),M=w.useRef([]),R=w.useRef(n);R.current=n;const P=w.useCallback(V=>{R.current||M.current.push(V)},[]),F=w.useMemo(()=>({library:t,renderNode:f,triggerAction:q,isStreaming:n,getFieldValue:B,setFieldValue:_,store:y,evaluationContext:S,reportError:P}),[t,f,n,q,B,_,y,S,P]),Z=w.useRef([]),I=w.useMemo(()=>{if(!(m!=null&&m.root))return m;const V=[],X={ctx:S,library:t,store:y,errors:V};try{const Y=dC(m.root,X);return Z.current=V,{...m,root:Y}}catch(Y){const L=Y instanceof Error?Y.message:String(Y);return V.push({source:"runtime",code:"runtime-error",message:`Prop evaluation failed: ${L}`}),Z.current=V,m}},[m,S,t,y,j,N]),$=N.__openui_loading.length>0,H=w.useRef("");return w.useEffect(()=>{var Y,L,U,G;if(n){H.current!==""&&(H.current="",(L=(Y=T.current).onError)==null||L.call(Y,[]));return}const V=[];g.current&&V.push(g.current),e&&!(m!=null&&m.root)&&!g.current&&V.push({source:"parser",code:"parse-failed",message:m?"Code parsed but produced no renderable root component":"Response could not be parsed as valid openui-lang",hint:`The entire response must be valid openui-lang code starting with root = ${t.root??"Root"}(...)`}),(G=(U=m==null?void 0:m.meta)==null?void 0:U.errors)!=null&&G.length&&V.push(...U6(m.meta.errors,t.toJSONSchema(),Object.keys(t.components))),V.push(...Z.current),V.push(...M.current),M.current=[],V.push(...N.__openui_errors??[]);const X=JSON.stringify(V);if(X!==H.current){if(H.current=X,T.current.onError)T.current.onError(V);else if(V.length>0)for(const O of V)console.warn(`[openui] ${O.source}/${O.code}: ${O.message}`)}},[n,e,m,I,N,t]),{result:I,parseResult:m,contextValue:F,isQueryLoading:$}}var Q6=class extends w.Component{constructor(t){super(t);Sn(this,"lastValidChildren",null);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){this.state.hasError||(this.lastValidChildren=this.props.children)}componentDidUpdate(t){this.state.hasError||(this.lastValidChildren=this.props.children),this.state.hasError&&t.children!==this.props.children&&this.setState({hasError:!1})}componentDidCatch(t){var a,s;const n=this.props.componentName??"Unknown";(s=(a=this.props).onError)==null||s.call(a,{source:"runtime",code:"render-error",component:n,message:`Component ${n} render failed: ${t.message}`})}render(){return this.state.hasError?this.lastValidChildren:this.props.children}};function mC(e){if(e==null)return null;if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map((t,n)=>o.jsx(w.Fragment,{children:mC(t)},n));if(typeof e=="object"&&e!==null){const t=e;if(t.type==="element")return o.jsx(gC,{node:t})}return null}function gC({node:e}){var s;const{library:t,reportError:n}=hC(),a=(s=t.components[e.typeName])==null?void 0:s.component;return a?o.jsx(Q6,{componentName:e.typeName,onError:n,children:o.jsx(X6,{el:e,Comp:a})}):null}function X6({el:e,Comp:t}){const n=K6();return o.jsx(t,{props:e.props,renderNode:n})}let xw=!1;function J6(){if(xw||typeof document>"u")return;xw=!0;const e=document.createElement("style");e.textContent="@keyframes openui-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }",document.head.appendChild(e)}const eP=()=>o.jsx("div",{style:{position:"absolute",top:8,right:8,width:16,height:16,border:"2px solid #e5e7eb",borderTopColor:"#3b82f6",borderRadius:"50%",animation:"openui-spin 0.6s linear infinite",zIndex:10}});function tP({response:e,library:t,isStreaming:n=!1,onAction:a,onStateUpdate:s,initialState:l,onParseResult:u,toolProvider:d,queryLoader:f,onError:h}){w.useInsertionEffect(()=>{J6()},[]);const g=w.useRef(u);g.current=u;const m=w.useRef(d);m.current=d;const y=w.useRef({async callTool(S,T){const E=m.current??null;if(E==null)throw new Error("[openui] toolProvider is null");if(typeof E.callTool=="function")return q6(await E.callTool({name:S,arguments:T}));const A=E,B=A[S];if(!B)throw new qm(S,Object.keys(A));return B(T)}}),{result:b,parseResult:k,contextValue:j,isQueryLoading:N}=Y6({response:e,library:t,isStreaming:n,onAction:a,onStateUpdate:s,initialState:l,toolProvider:d!=null?y.current:null,onError:h},mC);return w.useEffect(()=>{var S;(S=g.current)==null||S.call(g,k)},[k]),b!=null&&b.root?o.jsx(fC.Provider,{value:j,children:o.jsxs("div",{style:{position:"relative"},children:[N&&(f??o.jsx(eP,{})),o.jsx("div",{style:{opacity:N?.7:1,transition:"opacity 0.2s ease"},children:o.jsx(gC,{node:b.root})})]})}):null}w.createContext(null);function nP(e){if(typeof e!="string")return null;const t=e.trim();if(!t)return null;try{const n=new URL(t,"https://placeholder.invalid");return n.origin==="https://placeholder.invalid"||n.protocol==="http:"||n.protocol==="https:"||n.protocol==="mailto:"?t:null}catch{return null}}const rP=({props:e,renderNode:t})=>{const n=e.children;return o.jsxs("div",{className:"v10-genui-root",children:[e.title?o.jsx("div",{className:"v10-genui-root-title",children:e.title}):null,Array.isArray(n)?n.map((a,s)=>o.jsx(Ve.Fragment,{children:t(a)},s)):t(n)]})},aP=({props:e})=>{var t;return o.jsxs("div",{className:"v10-genui-card v10-genui-entity-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("div",{className:"v10-genui-card-title",children:e.name}),e.typeLabel?o.jsx("div",{className:"v10-genui-card-type",children:e.typeLabel}):null]}),e.subtitle?o.jsx("div",{className:"v10-genui-card-subtitle",children:e.subtitle}):null,(t=e.chips)!=null&&t.length?o.jsx("div",{className:"v10-genui-chips",children:e.chips.map((n,a)=>o.jsxs("span",{className:`v10-genui-chip tone-${n.tone??"default"}`,children:[o.jsx("span",{className:"v10-genui-chip-label",children:n.label}),o.jsx("span",{className:"v10-genui-chip-value",children:n.value})]},a))}):null]})},iP=({props:e})=>o.jsx("div",{className:"v10-genui-stats-grid",children:e.stats.map((t,n)=>o.jsxs("div",{className:"v10-genui-stat",title:t.hint,children:[o.jsx("div",{className:"v10-genui-stat-value",children:t.value}),o.jsx("div",{className:"v10-genui-stat-label",children:t.label})]},n))}),sP=({props:e})=>o.jsxs("div",{className:"v10-genui-section",children:[e.heading?o.jsx("div",{className:"v10-genui-section-heading",children:e.heading}):null,o.jsx("div",{className:"v10-genui-triple-table",children:e.rows.map((t,n)=>o.jsxs("div",{className:"v10-genui-triple-row",children:[o.jsx("div",{className:"v10-genui-triple-predicate",children:hv(t.predicate)}),o.jsx("div",{className:"v10-genui-triple-object",children:mP(t.object)})]},n))})]}),oP=({props:e})=>o.jsxs("div",{className:"v10-genui-section",children:[e.heading?o.jsx("div",{className:"v10-genui-section-heading",children:e.heading}):null,o.jsx("div",{className:"v10-genui-type-groups",children:e.groups.map((t,n)=>o.jsxs("div",{className:"v10-genui-type-group",children:[o.jsxs("div",{className:"v10-genui-type-group-head",children:[t.icon?o.jsx("span",{className:"v10-genui-type-icon",children:t.icon}):null,o.jsx("span",{className:"v10-genui-type-label",children:t.typeLabel}),o.jsx("span",{className:"v10-genui-type-count",children:t.items.length})]}),o.jsx("div",{className:"v10-genui-type-items",children:t.items.map((a,s)=>o.jsxs("div",{className:"v10-genui-type-item",title:a.uri,children:[o.jsx("div",{className:"v10-genui-type-item-label",children:a.label}),a.sub?o.jsx("div",{className:"v10-genui-type-item-sub",children:a.sub}):null]},s))})]},n))})]}),lP=({props:e})=>o.jsxs("div",{className:"v10-genui-section",children:[o.jsxs("div",{className:"v10-genui-section-heading",children:[o.jsx("span",{children:e.heading}),e.predicate?o.jsxs("span",{className:"v10-genui-section-sub",children:["· ",hv(e.predicate)]}):null]}),o.jsx("div",{className:"v10-genui-crossref",children:e.items.map((t,n)=>o.jsxs("div",{className:"v10-genui-crossref-item",title:t.uri,children:[o.jsx("span",{className:"v10-genui-crossref-label",children:t.label}),t.sub?o.jsx("span",{className:"v10-genui-crossref-sub",children:t.sub}):null]},n))})]}),cP=({props:e})=>o.jsxs("div",{className:"v10-genui-card v10-genui-package-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("span",{className:"v10-genui-card-icon",style:{color:"#a855f7"},children:"📦"}),o.jsx("div",{className:"v10-genui-card-title",children:e.name}),e.folder?o.jsxs("div",{className:"v10-genui-card-type",children:["packages/",e.folder]}):null]}),e.description?o.jsx("div",{className:"v10-genui-card-subtitle",children:e.description}):null,o.jsxs("div",{className:"v10-genui-stats-grid",children:[typeof e.fileCount=="number"&&o.jsx(zu,{label:"Files",value:e.fileCount}),typeof e.classCount=="number"&&o.jsx(zu,{label:"Classes",value:e.classCount}),typeof e.functionCount=="number"&&o.jsx(zu,{label:"Functions",value:e.functionCount}),typeof e.interfaceCount=="number"&&o.jsx(zu,{label:"Interfaces",value:e.interfaceCount})]})]}),uP=({props:e})=>o.jsxs("div",{className:"v10-genui-card v10-genui-file-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("span",{className:"v10-genui-card-icon",style:{color:"#3b82f6"},children:"📄"}),o.jsx("div",{className:"v10-genui-card-title",children:vP(e.path)}),e.language?o.jsxs("div",{className:"v10-genui-card-type",children:[".",e.language]}):null]}),o.jsx("div",{className:"v10-genui-card-subtitle",children:e.path}),o.jsxs("div",{className:"v10-genui-chips",children:[e.packageName?o.jsxs("span",{className:"v10-genui-chip tone-info",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"pkg"}),o.jsx("span",{className:"v10-genui-chip-value",children:e.packageName})]}):null,typeof e.lineCount=="number"?o.jsxs("span",{className:"v10-genui-chip",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"lines"}),o.jsx("span",{className:"v10-genui-chip-value",children:e.lineCount})]}):null]})]}),dP=({props:e})=>o.jsxs("div",{className:"v10-genui-card v10-genui-decision-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("span",{className:"v10-genui-card-icon",style:{color:"#ef4444"},children:"◆"}),o.jsx("div",{className:"v10-genui-card-title",children:e.title}),e.status?o.jsx("div",{className:`v10-genui-status-chip status-${e.status}`,children:e.status}):null]}),e.date?o.jsxs("div",{className:"v10-genui-card-subtitle",children:["Decided ",e.date]}):null,e.context?o.jsx($u,{heading:"Context",body:e.context}):null,e.outcome?o.jsx($u,{heading:"Outcome",body:e.outcome}):null,e.consequences?o.jsx($u,{heading:"Consequences",body:e.consequences}):null,e.alternatives?o.jsx($u,{heading:"Alternatives considered",body:e.alternatives}):null]}),pP=({props:e})=>o.jsxs("div",{className:"v10-genui-card v10-genui-pr-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("span",{className:"v10-genui-card-icon",style:{color:"#f59e0b"},children:"⇄"}),o.jsxs("div",{className:"v10-genui-card-title",children:[typeof e.number=="number"?o.jsxs("span",{className:"v10-genui-pr-num",children:["#",e.number]}):null,e.title]}),e.state?o.jsx("div",{className:`v10-genui-status-chip pr-state-${e.state}`,children:e.state}):null]}),o.jsxs("div",{className:"v10-genui-chips",children:[e.author?o.jsxs("span",{className:"v10-genui-chip",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"by"}),o.jsx("span",{className:"v10-genui-chip-value",children:e.author})]}):null,e.mergedAt?o.jsxs("span",{className:"v10-genui-chip tone-success",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"merged"}),o.jsx("span",{className:"v10-genui-chip-value",children:e.mergedAt.split("T")[0]})]}):null,(()=>{const t=nP(e.url);return t?o.jsxs("a",{className:"v10-genui-chip tone-info",href:t,target:"_blank",rel:"noopener noreferrer",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"view"}),o.jsx("span",{className:"v10-genui-chip-value",children:"github"})]}):null})()]}),e.body?o.jsx("div",{className:"v10-genui-pr-body",children:e.body}):null]}),fP=({props:e})=>o.jsxs("div",{className:"v10-genui-card v10-genui-task-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("span",{className:"v10-genui-card-icon",style:{color:"#06b6d4"},children:"✓"}),o.jsx("div",{className:"v10-genui-card-title",children:e.title}),e.status?o.jsx("div",{className:`v10-genui-status-chip task-status-${e.status}`,children:e.status.replace("_"," ")}):null,e.priority?o.jsx("div",{className:`v10-genui-priority-chip priority-${e.priority}`,children:e.priority.toUpperCase()}):null]}),o.jsxs("div",{className:"v10-genui-chips",children:[e.assignee?o.jsxs("span",{className:"v10-genui-chip",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"assignee"}),o.jsxs("span",{className:"v10-genui-chip-value",children:["@",e.assignee]})]}):null,typeof e.estimate=="number"?o.jsxs("span",{className:"v10-genui-chip",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"est"}),o.jsxs("span",{className:"v10-genui-chip-value",children:[e.estimate,"h"]})]}):null]})]}),hP=({props:e})=>{var t;return o.jsxs("div",{className:"v10-genui-vm-panel",children:[o.jsxs("div",{className:"v10-genui-vm-panel-head",children:[o.jsxs("div",{className:"v10-genui-vm-badge",children:[o.jsx("span",{className:"v10-genui-vm-badge-dot"}),"Verifiable Memory"]}),o.jsx("div",{className:"v10-genui-vm-title",children:"On-chain provenance"})]}),o.jsxs("div",{className:"v10-genui-vm-grid",children:[e.onChain?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsx("div",{className:"v10-genui-vm-block-heading",children:"Anchoring"}),e.onChain.txHash?o.jsx(Wi,{label:"tx",value:ww(e.onChain.txHash),mono:!0}):null,e.onChain.blockNumber?o.jsx(Wi,{label:"block",value:String(e.onChain.blockNumber),mono:!0}):null,e.onChain.chain?o.jsx(Wi,{label:"chain",value:e.onChain.chain}):null]}):null,e.consensus?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsxs("div",{className:"v10-genui-vm-block-heading",children:["Consensus ",e.consensus.quorum?o.jsx("span",{className:"v10-genui-vm-quorum",children:e.consensus.quorum}):null]}),(e.consensus.signers??[]).map((n,a)=>o.jsxs("div",{className:"v10-genui-vm-signer",children:[o.jsx("div",{className:"v10-genui-vm-signer-dot"}),o.jsxs("div",{className:"v10-genui-vm-signer-body",children:[o.jsx("div",{className:"v10-genui-vm-signer-label",children:n.label??gP(n.did)}),o.jsx("div",{className:"v10-genui-vm-signer-did",children:n.did})]}),typeof n.reputation=="number"?o.jsxs("div",{className:"v10-genui-vm-rep",children:["rep ",n.reputation]}):null]},a))]}):null,e.knowledgeAsset?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsx("div",{className:"v10-genui-vm-block-heading",children:"Knowledge asset"}),e.knowledgeAsset.ual?o.jsx(Wi,{label:"ual",value:e.knowledgeAsset.ual,mono:!0}):null,e.knowledgeAsset.contentHash?o.jsx(Wi,{label:"hash",value:ww(e.knowledgeAsset.contentHash),mono:!0}):null,e.knowledgeAsset.tracLocked?o.jsx(Wi,{label:"trac",value:e.knowledgeAsset.tracLocked}):null,e.knowledgeAsset.tokenId?o.jsx(Wi,{label:"nft",value:`#${e.knowledgeAsset.tokenId}`}):null]}):null,(t=e.timeline)!=null&&t.length?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsx("div",{className:"v10-genui-vm-block-heading",children:"Timeline"}),e.timeline.map((n,a)=>o.jsxs("div",{className:"v10-genui-vm-timeline-row",children:[o.jsx("div",{className:"v10-genui-vm-timeline-dot"}),o.jsx("div",{className:"v10-genui-vm-timeline-label",children:n.label}),o.jsx("div",{className:"v10-genui-vm-timeline-at",children:n.at})]},a))]}):null]})]})},zu=({label:e,value:t})=>o.jsxs("div",{className:"v10-genui-stat",children:[o.jsx("div",{className:"v10-genui-stat-value",children:t}),o.jsx("div",{className:"v10-genui-stat-label",children:e})]}),$u=({heading:e,body:t})=>o.jsxs("div",{className:"v10-genui-decision-section",children:[o.jsx("div",{className:"v10-genui-decision-section-heading",children:e}),o.jsx("div",{className:"v10-genui-decision-section-body",children:t})]}),Wi=({label:e,value:t,mono:n})=>o.jsxs("div",{className:"v10-genui-prov-row",children:[o.jsx("span",{className:"v10-genui-prov-label",children:e}),o.jsx("span",{className:`v10-genui-prov-value${n?" mono":""}`,children:t})]});function hv(e){return e.replace(/^"|"$/g,"").replace(/^<|>$/g,"").replace("http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdf:").replace("http://www.w3.org/2000/01/rdf-schema#","rdfs:").replace("http://www.w3.org/2001/XMLSchema#","xsd:").replace("http://schema.org/","schema:").replace("http://dkg.io/ontology/code/","code:").replace("http://dkg.io/ontology/github/","gh:").replace("http://dkg.io/ontology/decisions/","dec:").replace("http://dkg.io/ontology/tasks/","task:").replace("http://dkg.io/ontology/profile/","prof:")}function mP(e){return hv(e).replace(/\^\^<?.*$/,"").replace(/^"(.+)"$/,"$1")}function ww(e){return e?e.length<=16?e:`${e.slice(0,8)}…${e.slice(-6)}`:""}function gP(e){return e?e.length>22?`${e.slice(0,12)}…${e.slice(-6)}`:e:""}function vP(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}const yP=Rr({name:"EntityDetail",description:"Root container for a single-entity detail view. Accepts any number of child blocks (EntityCard, PackageCard, VerifiedProvenancePanel, etc.). Always use this as the outermost element.",props:Pt({title:$e().optional().describe("Optional top-of-panel title override (defaults to the entity rdfs:label)")}),component:rP}),bP=Rr({name:"EntityCard",description:"Compact header card for any entity: name, rdf:type label, optional subtitle, and up to 6 small stat chips.",props:Pt({name:$e().describe("Display name / label of the entity"),typeLabel:$e().optional().describe('Human-readable rdf:type label (e.g. "Package", "Pull Request")'),subtitle:$e().optional().describe("Short supporting text (e.g. path, author, date)"),chips:Ia(Pt({label:$e(),value:$e(),tone:fo(["default","success","warn","danger","info"]).optional()})).max(6).optional()}),component:aP}),xP=Rr({name:"EntityStatsGrid",description:"Grid of numeric stats with labels. Use for summarising counts (files, classes, additions, deletions).",props:Pt({stats:Ia(Pt({label:$e(),value:uv([$e(),aa()]),hint:$e().optional()})).min(1).max(8)}),component:iP}),wP=Rr({name:"TripleTable",description:"Fallback raw-triples table. Use sparingly — only when the entity has no better structured components in this library.",props:Pt({heading:$e().optional(),rows:Ia(Pt({predicate:$e(),object:$e()})).max(60)}),component:sP}),kP=Rr({name:"EntityTypeList",description:"Grouped list of child entities by rdf:type. Great for showing a File's contained classes/functions/interfaces as separate sections.",props:Pt({heading:$e().optional(),groups:Ia(Pt({typeLabel:$e(),icon:$e().optional(),items:Ia(Pt({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(30)})).max(8)}),component:oP}),SP=Rr({name:"CrossRefList",description:"List of cross-references following a single predicate (e.g. code:imports, github:affects, decisions:affects). Each item can show a short subtitle.",props:Pt({heading:$e().describe('Human-readable heading (e.g. "Imports", "Affected files")'),predicate:$e().optional(),items:Ia(Pt({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(40)}),component:lP}),jP=Rr({name:"PackageCard",description:"Specialised card for a code:Package entity: name, folder, description, and a mini-stats strip.",props:Pt({name:$e(),folder:$e().optional(),description:$e().optional(),fileCount:aa().optional(),classCount:aa().optional(),functionCount:aa().optional(),interfaceCount:aa().optional()}),component:cP}),CP=Rr({name:"FileCard",description:"Specialised card for a code:File entity: path, language, line count, owning package.",props:Pt({path:$e(),language:$e().optional(),lineCount:aa().optional(),packageName:$e().optional()}),component:uP}),NP=Rr({name:"DecisionCard",description:"Specialised card for a decisions:Decision entity: title, status badge, date, context/outcome quoted sections.",props:Pt({title:$e(),status:fo(["proposed","accepted","rejected","superseded"]).optional(),date:$e().optional(),context:$e().optional(),outcome:$e().optional(),consequences:$e().optional(),alternatives:$e().optional()}),component:dP}),EP=Rr({name:"PRCard",description:"Specialised card for a github:PullRequest entity: title + #number, state, author, merged badge, body preview.",props:Pt({title:$e(),number:aa().optional(),state:fo(["open","closed","merged"]).optional(),author:$e().optional(),mergedAt:$e().optional(),body:$e().optional(),url:$e().optional()}),component:pP}),TP=Rr({name:"TaskCard",description:"Specialised card for a tasks:Task entity: title, status chip, priority, assignee, estimate.",props:Pt({title:$e(),status:fo(["todo","in_progress","blocked","done","cancelled"]).optional(),priority:fo(["p0","p1","p2","p3"]).optional(),assignee:$e().optional(),estimate:aa().optional()}),component:fP}),AP=Rr({name:"VerifiedProvenancePanel",description:"The Verifiable Memory hero block. Use at the top of any entity in the VM layer. Surfaces on-chain anchor (tx hash, block), consensus (signing agents with reputation), knowledge-asset identity (UAL, content hash, TRAC locked, NFT token id), and finalisation timeline.",props:Pt({onChain:Pt({txHash:$e().optional(),blockNumber:uv([$e(),aa()]).optional(),chain:$e().optional()}).optional(),consensus:Pt({signers:Ia(Pt({did:$e(),label:$e().optional(),reputation:aa().optional(),signature:$e().optional()})).max(10).optional(),quorum:$e().optional().describe('e.g. "3 of 5"')}).optional(),knowledgeAsset:Pt({ual:$e().optional(),contentHash:$e().optional(),tracLocked:$e().optional(),tokenId:$e().optional()}).optional(),timeline:Ia(Pt({label:$e(),at:$e()})).max(6).optional()}),component:hP}),vC=Z6({components:[yP,bP,xP,wP,kP,SP,jP,CP,NP,EP,TP,AP],root:"EntityDetail",componentGroups:[{name:"Generic",components:["EntityDetail","EntityCard","EntityStatsGrid","EntityTypeList","CrossRefList","TripleTable"]},{name:"Code domain",components:["PackageCard","FileCard"]},{name:"GitHub domain",components:["PRCard"]},{name:"Decisions & tasks",components:["DecisionCard","TaskCard"]},{name:"Verifiable memory",components:["VerifiedProvenancePanel"]}]});let Gh=null;function _P(){return Gh===null&&(Gh=vC.prompt({preamble:"You are composing a single-entity detail panel for the DKG Node UI. Use only the components below to build a rich, structured view. Always wrap the response in the EntityDetail root element.",additionalRules:["Prefer specialised cards (PackageCard, PRCard, DecisionCard, TaskCard, FileCard) when the rdf:type matches.","Include VerifiedProvenancePanel at the very top if the entity appears in verifiable memory or has on-chain / signature triples.","Keep the tree compact: aim for 3–8 top-level blocks.","Do not invent triple data — only use values present in the provided triples."]})),Gh}async function*RP(e){const t=await fetch("/api/genui/render",{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify({contextGraphId:e.contextGraphId,entityUri:e.entityUri,libraryPrompt:e.libraryPrompt}),signal:e.signal});if(!t.ok||!t.body){let l=`HTTP ${t.status}`;try{const u=await t.json();u!=null&&u.error&&(l=u.error)}catch{}yield{type:"error",error:l};return}const n=t.body.getReader(),a=new TextDecoder;let s="";try{for(;;){const{value:l,done:u}=await n.read();if(u)break;s+=a.decode(l,{stream:!0});let d;for(;(d=s.indexOf(`
1622
+
1623
+ `))!==-1;){const f=s.slice(0,d);s=s.slice(d+2);const h=kw(f);h&&(yield h)}}if(s.trim()){const l=kw(s);l&&(yield l)}}finally{n.releaseLock()}}function kw(e){let t="message",n="";for(const a of e.split(`
1624
+ `))a.startsWith("event:")?t=a.slice(6).trim():a.startsWith("data:")&&(n+=a.slice(5).trim());if(!n)return null;try{const a=JSON.parse(n);switch(t){case"start":return{type:"start",...a};case"delta":return{type:"delta",text:a.text??""};case"final":return{type:"final",content:a.content??""};case"error":return{type:"error",error:a.error??"unknown error"};case"done":return{type:"done"};default:return null}}catch{return null}}const OP=({contextGraphId:e,entityUri:t,placeholder:n,fallback:a})=>{const[s,l]=Ve.useState(""),[u,d]=Ve.useState(!0),[f,h]=Ve.useState(null);return Ve.useEffect(()=>{const g=new AbortController;let m="";return l(""),h(null),d(!0),(async()=>{try{const y=_P();for await(const b of RP({contextGraphId:e,entityUri:t,libraryPrompt:y,signal:g.signal}))if(b.type==="delta")m+=b.text,l(m);else if(b.type==="final")b.content&&(m=b.content,l(b.content));else if(b.type==="error"){h(b.error);break}else if(b.type==="done")break}catch(y){y.name!=="AbortError"&&h(y.message)}finally{d(!1)}})(),()=>g.abort()},[e,t]),f?a?o.jsx(o.Fragment,{children:a(f)}):o.jsx(MP,{error:f}):!s&&u?o.jsx(o.Fragment,{children:n??o.jsx("div",{className:"v10-genui-loading",children:"Composing detail view…"})}):o.jsx("div",{className:"v10-genui-panel",children:o.jsx(tP,{response:s,library:vC,isStreaming:u})})},LP="LLM not configured",MP=({error:e})=>{const t=fn(a=>a.openTab);return e.includes(LP)?o.jsxs("div",{className:"v10-genui-error v10-genui-error-cta",children:[o.jsxs("div",{className:"v10-genui-error-head",children:[o.jsx("span",{className:"v10-genui-error-icon",children:"⚙"}),o.jsxs("div",{children:[o.jsx("div",{className:"v10-genui-error-title",children:"Set up your LLM to enable GenUI"}),o.jsx("div",{className:"v10-genui-error-desc",children:"GenUI streams entity detail views from an OpenAI-compatible model. Add an API key in Settings and open this entity again."})]})]}),o.jsx("button",{className:"v10-genui-error-cta-btn",onClick:()=>t({id:"settings",label:"Settings",closable:!0}),children:"Open Settings →"})]}):o.jsxs("div",{className:"v10-genui-error",children:["GenUI unavailable: ",e]})};function Sw({entity:e,profile:t}){const n=w.useMemo(()=>{for(const d of e.subGraphs)if(d!=="meta")return d;return null},[e.subGraphs]);if(!n||!t)return null;const a=t.forSubGraph(n),s=(a==null?void 0:a.color)??"#64748b",l=(a==null?void 0:a.icon)??"•",u=(a==null?void 0:a.displayName)??n;return o.jsxs("span",{className:"v10-subgraph-badge",style:{"--sg-color":s},title:`In sub-graph: ${u}`,children:[o.jsx("span",{className:"v10-subgraph-badge-icon",style:{color:s},children:l}),o.jsx("span",{className:"v10-subgraph-badge-label",children:u})]})}function DP({entity:e,contextGraphId:t,onVerified:n}){const a=Ua(),[s,l]=w.useState(!1),[u,d]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState(null),y=e.trustLevel,b=w.useMemo(()=>{if(!a)return null;for(const E of e.types){const A=a.forType(E);if(A&&(y==="working"&&(A.promoteLabel||A.promoteHint)||y==="shared"&&(A.publishLabel||A.publishHint)))return A}return null},[e.types,a,y]),k=w.useMemo(()=>{if(!a)return null;for(const E of e.subGraphs){if(E==="meta")continue;const A=a.forSubGraph(E);if(A!=null&&A.sourceAssertion)return{binding:A,subGraph:E}}return null},[e.subGraphs,a]);if(y==="verified"||!b)return null;const j=y==="working"?{kind:"promote",label:b.promoteLabel??"Promote to Shared Memory",hint:b.promoteHint??"Shares the complete owning Knowledge Asset with the team.",busyCopy:"Sharing…",disabled:!(k!=null&&k.binding.sourceAssertion),disabledReason:k!=null&&k.binding.sourceAssertion?null:`No sourceAssertion declared on the sub-graph profile — add profile:sourceAssertion to the SubGraphBinding for "${[...e.subGraphs].filter(E=>E!=="meta")[0]??"?"}".`}:{kind:"publish",label:b.publishLabel??"Verify on DKG",hint:b.publishHint??"Publishes the complete owning Knowledge Asset on-chain.",busyCopy:"Anchoring…",disabled:!(k!=null&&k.binding.sourceAssertion),disabledReason:k!=null&&k.binding.sourceAssertion?null:"This entity is not part of a named Shared-Memory asset, so it cannot be published to Verifiable Memory from here."},N=async()=>{if(j.disabled)return;l(!0),m(null),d(null),h(j.kind);const E=(k==null?void 0:k.binding.sourceAssertion)??"assertion";try{if(j.kind==="promote"){const A=await oo(t,k.binding.sourceAssertion,k.subGraph?{subGraphName:k.subGraph}:{});d(_g(E,A))}else{const A=await Tg(t,k.binding.sourceAssertion,k.subGraph?{subGraphName:k.subGraph}:{});d(A)}n()}catch(A){const B=j.kind==="promote"?lo(E,A):null,_=B?B.message:(A==null?void 0:A.message)??"Action failed";m(_)}finally{l(!1)}},S=E=>!!E&&"status"in E,T=E=>!!E&&"kind"in E;return o.jsxs("div",{className:`v10-ka-verify v10-ka-verify-${j.kind}`,children:[o.jsxs("div",{className:"v10-ka-verify-head",children:[o.jsx("span",{className:"v10-ka-verify-arrow",children:j.kind==="promote"?"◈":"◉"}),o.jsx("span",{className:"v10-ka-verify-title",children:j.label})]}),o.jsx("div",{className:"v10-ka-verify-hint",children:j.hint}),j.disabledReason&&o.jsxs("div",{className:"v10-ka-verify-err",children:["! ",j.disabledReason]}),!u&&o.jsx("button",{className:`v10-ka-verify-btn ${j.kind}`,onClick:N,disabled:s||j.disabled,children:s?j.busyCopy:j.label}),g&&o.jsxs("div",{className:"v10-ka-verify-err",children:["✕ ",g]}),u&&f==="promote"&&T(u)&&u.kind==="success"&&o.jsxs("div",{className:"v10-ka-verify-ok",children:[o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Promoted"}),o.jsxs("span",{className:"v10-ka-verify-ok-val",children:["✓ ",u.promotedCount," triple",u.promotedCount===1?"":"s"," now in Shared Memory"]})]}),o.jsx("div",{className:"v10-ka-verify-hint",style:{marginTop:6},children:"Refresh the entity to see the next step appear."})]}),u&&f==="promote"&&T(u)&&u.kind!=="success"&&o.jsxs("div",{className:"v10-ka-verify-err",children:["! ",u.message]}),u&&f==="publish"&&S(u)&&(()=>{var B,_;const E=u.status==="confirmed"&&!!u.txHash,A=E&&!!u.contextGraphError;return o.jsxs("div",{className:E?A?"v10-ka-verify-warn":"v10-ka-verify-ok":"v10-ka-verify-err",children:[o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Status"}),o.jsxs("span",{className:"v10-ka-verify-ok-val",children:[E?A?"⚠":"✓":"✕"," ",u.status,E?A?` (${C_})`:"":" (NOT on-chain)"]})]}),A&&o.jsx("div",{className:"v10-ka-verify-hint",style:{marginTop:6},children:Il(u.contextGraphError)}),u.txHash?o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"TX hash"}),o.jsx("span",{className:"v10-ka-verify-ok-val mono",title:u.txHash,children:u.txHash})]}):o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"TX hash"}),o.jsx("span",{className:"v10-ka-verify-ok-val",children:"none — on-chain submission skipped"})]}),u.blockNumber!=null&&o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Block"}),o.jsxs("span",{className:"v10-ka-verify-ok-val mono",children:["#",u.blockNumber]})]}),((_=(B=u.kas)==null?void 0:B[0])==null?void 0:_.tokenId)&&o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Token"}),o.jsxs("span",{className:"v10-ka-verify-ok-val mono",children:["#",u.kas[0].tokenId]})]})]})})()]})}function zP({entity:e,allEntities:t,allTriples:n,onNavigate:a,onClose:s,contextGraphId:l,onRefresh:u,onOpenAgent:d}){const[f,h]=w.useState("content"),g=Vn(I=>I.theme),m=Ua(),y=ls(),{icon:b,type:k}=Bd(e,m),j=P4(e),N=Ud(e),S=N?(y==null?void 0:y.get(N))??null:null,T=e.trustLevel==="verified"?"vm":e.trustLevel==="shared"?"swm":"wm",E=e.trustLevel==="verified"?"Verifiable Memory":e.trustLevel==="shared"?"Shared Working Memory":"Working Memory",A=ia(e.trustLevel,1),B=w.useMemo(()=>{const I=[];for(const[,$]of t)for(const H of $.connections)H.targetUri===e.uri&&I.push({pred:Ws(H.predicate),entity:$});return I},[e.uri,t]),_=w.useMemo(()=>n.filter(I=>bt(I.subject)===e.uri||bt(I.object)===e.uri),[e.uri,n]),z=w.useMemo(()=>U4(e.uri,n,1),[e.uri,n]),q=w.useMemo(()=>{const I=new Set;for(const $ of t.values())ej($)&&I.add(bt($.uri));return I},[t]),M=w.useMemo(()=>new Set([bt(e.uri)]),[e.uri]),R=w.useMemo(()=>hd(z,q,{focalSubjects:M}),[z,q,M]),P=w.useMemo(()=>{const I=Yi[e.trustLevel];return{labelMode:"humanized",renderer:"2d",labels:Id({minZoomForLabels:.2}),style:{namespaceColors:Vg(I),defaultNodeColor:I,defaultEdgeColor:"#475569",edgeWidth:1,fontSize:11},hexagon:{baseSize:7,minSize:4,maxSize:10,scaleWithDegree:!0},focus:{maxNodes:500,hops:999}}},[e.trustLevel]),F=w.useMemo(()=>({name:`entity-${e.uri}-${g}`,palette:g,focal:{uri:e.uri,sizeMultiplier:2.4}}),[e.uri,g]),Z=_.length;return o.jsxs("div",{className:"v10-ka-detail",children:[o.jsxs("div",{className:"v10-ka-header",children:[o.jsx("button",{className:"v10-ka-back",onClick:s,children:"← Back to Context Graph"}),o.jsxs("div",{className:"v10-ka-header-left",children:[o.jsx("div",{className:"v10-ka-label",children:A}),o.jsxs("div",{className:"v10-ka-name",children:[b," ",e.label,o.jsx("span",{className:`v10-trust-badge ${T}`,children:E})]}),o.jsxs("div",{className:"v10-ka-ual",children:[e.uri," · ",k," · ",Z," triples"]})]}),(S||N)&&o.jsxs("div",{className:"v10-ka-header-author",children:[o.jsx("div",{className:"v10-ka-header-author-label",children:"Proposed by"}),o.jsx(es,{agent:S??void 0,fallbackUri:N??void 0,size:"lg",showOperator:!0,onOpenAgent:d})]})]}),o.jsxs("div",{className:"v10-ka-split",children:[o.jsxs("div",{className:"v10-ka-left",children:[o.jsxs("div",{className:"v10-content-tabs",style:{margin:"0 -20px",padding:"0 20px",background:"transparent"},children:[o.jsx("button",{className:`v10-content-tab ${f==="content"?"active":""}`,onClick:()=>h("content"),children:"Content"}),o.jsx("button",{className:`v10-content-tab ${f==="triples"?"active":""}`,onClick:()=>h("triples"),children:"Triples"}),o.jsx("button",{className:`v10-content-tab ${f==="graph"?"active":""}`,onClick:()=>h("graph"),children:"Graph"})]}),f==="content"&&o.jsxs(o.Fragment,{children:[!e.types.map($=>m==null?void 0:m.forType($)).find($=>$==null?void 0:$.detailHint)||!(m!=null&&m.contextGraphId)?null:o.jsx("div",{className:"v10-ka-section",children:o.jsx(OP,{contextGraphId:m.contextGraphId,entityUri:e.uri})}),j&&o.jsx("div",{className:"v10-ka-section",children:o.jsx("div",{className:"v10-ka-desc",children:o.jsx("p",{children:j})})}),e.properties.size>0&&o.jsxs("div",{className:"v10-ka-section",children:[o.jsx("div",{className:"v10-ka-section-title",children:"Properties"}),[...e.properties].map(([I,$])=>o.jsxs("div",{className:"v10-ka-prop",children:[o.jsx("span",{className:"v10-ka-prop-key",children:Ws(I)}),o.jsx("span",{className:"v10-ka-prop-val",children:$.join(", ")})]},I))]}),e.connections.length>0&&o.jsxs("div",{className:"v10-ka-section",children:[o.jsxs("div",{className:"v10-ka-section-title",children:["References (",e.connections.length,")"]}),e.connections.map((I,$)=>{const H=t.get(I.targetUri);return o.jsxs("button",{className:"v10-ka-conn",onClick:()=>a(I.targetUri),children:[o.jsx("span",{className:"v10-ka-conn-pred",children:Ws(I.predicate)}),o.jsx("span",{className:"v10-ka-conn-arrow",children:"→"}),o.jsx("span",{className:"v10-ka-conn-target",children:I.targetLabel}),H&&o.jsx(Sw,{entity:H,profile:m})]},$)})]}),B.length>0&&o.jsxs("div",{className:"v10-ka-section",children:[o.jsxs("div",{className:"v10-ka-section-title",children:["Referenced by (",B.length,")"]}),B.map((I,$)=>o.jsxs("button",{className:"v10-ka-conn",onClick:()=>a(I.entity.uri),children:[o.jsx("span",{className:"v10-ka-conn-target",children:I.entity.label}),o.jsx(Sw,{entity:I.entity,profile:m}),o.jsx("span",{className:"v10-ka-conn-arrow",children:"→"}),o.jsx("span",{className:"v10-ka-conn-pred",children:I.pred})]},$))]}),o.jsxs("div",{className:"v10-ka-meta",children:[o.jsxs("span",{className:"v10-ka-meta-item",children:[b," ",k]}),o.jsxs("span",{className:"v10-ka-meta-item",children:[Z," triples"]}),o.jsxs("span",{className:"v10-ka-meta-item",children:[e.connections.length," links"]})]})]}),f==="triples"&&o.jsxs("div",{style:{marginTop:8,overflowX:"auto",border:"1px solid var(--border-default)",borderRadius:6},children:[o.jsxs("table",{className:"v10-ka-triples-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Subject"}),o.jsx("th",{children:"Predicate"}),o.jsx("th",{children:"Object"})]})}),o.jsx("tbody",{children:_.slice(0,50).map((I,$)=>o.jsxs("tr",{children:[o.jsx("td",{title:I.subject,children:Ws(I.subject)}),o.jsx("td",{title:I.predicate,children:Ws(I.predicate)}),o.jsx("td",{title:I.object,children:I.object.startsWith('"')?Pd(I.object).slice(0,60):Ws(I.object)})]},$))})]}),o.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",padding:"6px 8px"},children:[Math.min(_.length,50)," of ",_.length," triples shown"]})]}),f==="graph"&&o.jsx(Xu,{title:`${e.label} graph`,scopeLabel:`Entity detail graph: 1-hop neighborhood around ${e.label}.`,tone:T,className:"v10-ka-graph-shell",renderGraph:I=>R.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(Jg,{data:R,format:"triples",options:P,viewConfig:F,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:$=>($==null?void 0:$.id)&&$.id!==e.uri&&a($.id),initialFit:!0,initialFocus:e.uri},`${e.uri}:${I?"expanded":"inline"}`)}):o.jsx("div",{className:"v10-graph-placeholder v10-graph-placeholder-centered",children:"No neighborhood data"})})]}),o.jsxs("div",{className:"v10-ka-right",children:[o.jsx(uz,{contextGraphId:l,entityUri:e.uri,enabled:e.trustLevel==="verified"}),o.jsx("div",{className:"v10-ka-section-title",children:"Provenance Trail"}),o.jsx($P,{entity:e}),o.jsx(DP,{entity:e,contextGraphId:l,onVerified:u}),o.jsxs("div",{style:{marginTop:16,padding:"10px 12px",borderRadius:6,background:"var(--bg-surface)",border:"1px solid var(--border-subtle)"},children:[o.jsx("div",{className:"v10-ka-section-title",style:{marginBottom:6},children:"Entity Summary"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4,fontSize:10},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Type"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:k})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Triples"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:Z})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Links"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:e.connections.length})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Layer"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:E.split(" ")[0]})]})]})]})]})]})]})}function $P({entity:e}){const t=ls(),n=u=>{const d=z4(e,u),f=$4(e,u),h=d?t==null?void 0:t.get(d):null;return{uri:d,at:f,agent:h}},a=n("created"),s=n("promoted"),l=n("published");return o.jsxs("div",{className:"v10-ka-timeline",children:[e.trustLevel==="verified"&&o.jsx(Vh,{toneClass:"verified",title:"Published to Verifiable Memory",actionWord:"Published",agent:l.agent,agentUri:l.uri,at:l.at}),(e.trustLevel==="shared"||e.trustLevel==="verified")&&o.jsx(Vh,{toneClass:"shared",title:"Promoted to Shared Working Memory",actionWord:"Promoted",agent:s.agent,agentUri:s.uri,at:s.at}),o.jsx(Vh,{toneClass:"created",title:"Created in Working Memory",actionWord:"Created",agent:a.agent,agentUri:a.uri,at:a.at})]})}function Vh({toneClass:e,title:t,actionWord:n,agent:a,agentUri:s,at:l}){const u=l?q4(l):null;return o.jsxs("div",{className:"v10-ka-event",children:[o.jsx("div",{className:`v10-ka-event-dot ${e}`}),o.jsxs("div",{className:"v10-ka-event-header",children:[o.jsx("span",{className:"v10-ka-event-title",children:t}),u&&o.jsx("time",{className:"v10-ka-event-time",dateTime:l??void 0,children:u})]}),(a||s)&&o.jsxs("div",{className:"v10-ka-event-attribution",children:[o.jsxs("span",{className:"v10-ka-event-attribution-prefix",children:[n," by"]}),o.jsx(es,{agent:a??void 0,fallbackUri:s??void 0,size:"sm"})]})]})}function jw(){return o.jsxs("div",{className:"v10-subgraph-explorer-header",children:[o.jsx("div",{className:"v10-subgraph-explorer-title",children:"Subgraph Explorer"}),o.jsx("p",{className:"v10-subgraph-explorer-intro",children:"Subgraphs are optional topical partitions inside this Context Graph. An entity belongs to one or more memory layers and, optionally, to one or more subgraphs. Entities in no subgraph live in the context graph root."})]})}function IP({contextGraphId:e,memory:t,onNodeClick:n,onSelectSubGraph:a}){const s=Ua(),[l,u]=w.useState([]),[d,f]=w.useState(!0),[h,g]=w.useState(null);w.useEffect(()=>{let _=!1;return f(!0),g(null),Mg(e).then(z=>{_||u(z.subGraphs??[])}).catch(z=>{_||g(z instanceof Error?z.message:"Failed to load subgraphs")}).finally(()=>{_||f(!1)}),()=>{_=!0}},[e]);const{total:m}=Zg(t),y=Object.values(t.layerStatus??{}),b=t.loading||y.some(_=>_==="loading"),k=t.error!==null||t.partial||y.some(_=>_==="error"),j=w.useMemo(()=>{const _=new Map;for(const z of t.entityList){const q=bt(z.uri);for(const M of z.subGraphs){let R=_.get(M);R||(R=new Set,_.set(M,R)),R.add(q)}}return _},[t.entityList]),{triplesBySubGraph:N,tripleCountBySubGraph:S}=w.useMemo(()=>{const _=new Map;for(const M of t.allTriples){if(!M.subGraph)continue;let R=_.get(M.subGraph);R||(R=[],_.set(M.subGraph,R)),R.push(M)}for(const M of t.allTriples)if(!M.subGraph){for(const[R,P]of j)if(Am(M,{slug:R,isRoot:!1,scopedUris:P})){let F=_.get(R);F||(F=[],_.set(R,F)),F.push(M)}}const z=new Map,q=new Map;for(const[M,R]of _){const F=_m(R,t.entities).map(Z=>({subject:Z.subject,predicate:Z.predicate,object:Z.object}));q.set(M,F.length),z.set(M,R1(F))}return{triplesBySubGraph:z,tripleCountBySubGraph:q}},[t.allTriples,t.entities,j]),T=w.useMemo(()=>{const _=new Map;for(const z of t.entityList)for(const q of z.subGraphs){let M=_.get(q);M||(M={wm:0,swm:0,vm:0},_.set(q,M)),z.trustLevel==="verified"?M.vm++:z.trustLevel==="shared"?M.swm++:M.wm++}return _},[t.entityList]),E=w.useMemo(()=>{const _=new Map;for(const z of t.entityList){const q=bt(z.uri);for(const M of z.subGraphs){let R=_.get(M);R||(R=new Map,_.set(M,R)),R.set(q,z.trustLevel),q!==z.uri&&R.set(z.uri,z.trustLevel)}}return _},[t.entityList]),A=w.useMemo(()=>l.filter(Kg).map(_=>{const z=(s==null?void 0:s.forSubGraph(_.name))??{},q=N.get(_.name)??[],M=j.get(_.name)??new Set,R=E.get(_.name)??new Map;return{slug:_.name,icon:z.icon??"•",color:z.color??"#64748b",displayName:z.displayName??_.name,description:z.description,rank:z.rank??99,entityCount:M.size>0?M.size:_.entityCount,tripleCount:S.get(_.name)??0,triples:hd(q,M),layerCounts:T.get(_.name)??{wm:0,swm:0,vm:0},entityTrustByUri:R}}).sort((_,z)=>_.rank-z.rank),[l,s,N,S,T,j,E]),B=w.useMemo(()=>{const _=[],z=new Set,q=new Map;let M=0,R=0,P=0;for(const X of t.entityList){if(X.subGraphs.size>0)continue;_.push(X);const Y=bt(X.uri);z.add(Y),q.set(Y,X.trustLevel),Y!==X.uri&&q.set(X.uri,X.trustLevel),X.trustLevel==="verified"?P++:X.trustLevel==="shared"?R++:M++}const F=t.allTriples.filter(X=>!X.subGraph),Z=_m(F,t.entities).map(X=>({subject:X.subject,predicate:X.predicate,object:X.object})),I=Z.length,$=hd(Z,z),H=R1($),V=(s==null?void 0:s.forSubGraph($r))??{};return{slug:$r,icon:V.icon??"⊘",color:V.color??"#64748b",displayName:V.displayName??"Root",description:V.description,rank:999,entityCount:_.length,tripleCount:I,triples:H,layerCounts:{wm:M,swm:R,vm:P},entityTrustByUri:q}},[t.entityList,t.allTriples,t.entities,s]);return d&&A.length===0?o.jsx(ln,{compact:!0,icon:"#",title:"Loading subgraphs...",className:"v10-sgov-state"}):h&&A.length===0?o.jsx(ln,{icon:"!",title:"Couldn't load subgraphs.",description:"Refresh the page to try again.",tone:"danger",className:"v10-sgov-state"}):A.length===0&&B.entityCount===0?o.jsx(ln,{icon:"#",title:"No subgraphs in this Context Graph yet.",description:o.jsxs(o.Fragment,{children:["A subgraph is a named topical slice of this Context Graph (e.g. ",o.jsx("code",{children:"recipes"}),", ",o.jsx("code",{children:"decisions"}),"). Agents create one when they scope an assertion to a subgraph. All current entities live in the Context Graph root."]}),actions:[{label:"View root",onClick:()=>a($r),variant:"primary"}],className:"v10-sgov-state"}):o.jsxs("div",{className:"v10-sgov",children:[o.jsxs("div",{className:"v10-sgov-header",children:[o.jsx("div",{className:"v10-sgov-title",children:"Subgraphs"}),o.jsxs("div",{className:"v10-sgov-sub",children:[A.length," named subgraphs · ",t.counts.total," entities · ",m," triples"]})]}),o.jsxs("div",{className:"v10-sgov-grid",children:[A.map(_=>o.jsx(Cw,{card:_,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>a(_.slug)},_.slug)),o.jsx(Cw,{card:B,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>a($r),variant:"root"},$r)]})]})}function Cw({card:e,isHydrating:t=!1,isFailedOrPartial:n=!1,onNodeClick:a,onOpen:s,variant:l}){const u=w.useMemo(()=>{const h={};for(const[g,m]of e.entityTrustByUri)h[g]=Yi[m];return h},[e.entityTrustByUri]),d=w.useMemo(()=>({labelMode:"humanized",renderer:"2d",labels:Id({minZoomForLabels:.8}),style:{classColors:sj,predicateColors:oj,namespaceColors:Vg(e.color),...Object.keys(u).length>0?{nodeColors:u}:{},defaultNodeColor:e.color,defaultEdgeColor:"#475569",edgeWidth:1,fontSize:12,gradient:!0,gradientIntensity:.35},hexagon:{baseSize:6,minSize:3,maxSize:16,scaleWithDegree:!0},focus:{maxNodes:5e3,hops:999}}),[e.color,u]),f=l==="root";return o.jsxs("div",{className:`v10-sgov-card${f?" root":""}`,style:f?void 0:{"--sg-color":e.color,borderColor:e.color+"55"},children:[o.jsxs("div",{className:"v10-sgov-card-head",children:[o.jsx("span",{className:"v10-sgov-card-icon",style:f?void 0:{color:e.color},children:e.icon}),o.jsxs("div",{className:"v10-sgov-card-title-wrap",children:[o.jsx("div",{className:"v10-sgov-card-title",children:e.displayName}),e.description&&o.jsx("div",{className:"v10-sgov-card-desc",title:e.description,children:e.description})]}),o.jsx("button",{type:"button",className:"v10-sgov-card-open",onClick:s,title:`Focus on ${e.displayName}`,children:"↗"})]}),o.jsxs("div",{className:"v10-sgov-card-stats",children:[o.jsxs("span",{className:"v10-sgov-card-stat",children:[o.jsx("b",{children:e.entityCount})," entities"]}),o.jsxs("span",{className:"v10-sgov-card-stat",title:t&&e.tripleCount===0?"Loading triples for this subgraph…":n?e.tripleCount===0?"Some layers unavailable; count may be incomplete.":`${e.tripleCount} triples (some layers unavailable; count may be incomplete).`:t?`${e.tripleCount} triples (still loading; count may grow).`:e.tripleCount!==e.triples.length?`${e.tripleCount} triples in this subgraph's scope; ${e.triples.length} rendered (some in-scope edges aren't drawn — either endpoints outside this subgraph, or cap-trimmed in dense buckets).`:void 0,children:[o.jsx("b",{children:t&&e.tripleCount===0?"…":e.tripleCount})," triples"]})]}),o.jsx("div",{className:"v10-sgov-card-pyramid",children:o.jsx(yC,{counts:e.layerCounts,compact:!0})}),o.jsx("div",{className:"v10-sgov-card-graph",children:e.triples.length===0?o.jsx("div",{className:"v10-sgov-card-empty",children:e.entityCount>0?"Promoted — open to view":"No data yet"}):o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"v10-sgov-card-empty",children:"Loading…"}),children:o.jsx(Jg,{data:e.triples,format:"triples",options:d,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:a,initialFit:!0})})})]})}function yC({counts:e,activeLayers:t,onClickLayer:n,compact:a=!1}){const s=e.wm+e.swm+e.vm;if(s===0)return a?null:o.jsx("div",{className:"v10-minibar v10-minibar-empty",children:"No data"});const l=[{key:"verified",short:"VM",count:e.vm,color:"#22c55e",label:"Verifiable"},{key:"shared",short:"SWM",count:e.swm,color:"#f59e0b",label:"Shared"},{key:"working",short:"WM",count:e.wm,color:"#64748b",label:"Working"}],u=!!n;return o.jsxs("div",{className:`v10-minibar${a?" compact":""}`,children:[!a&&o.jsx("div",{className:"v10-minibar-bar",children:l.filter(d=>d.count>0).map(d=>{const f=d.count/s*100,h=t?t.has(d.key):!0;return o.jsx("div",{className:`v10-minibar-seg${h?"":" dim"}`,style:{width:`${f}%`,background:d.color},title:`${d.label}: ${d.count}`},d.key)})}),o.jsx("div",{className:"v10-minibar-legend",children:l.map(d=>{const f=t?t.has(d.key):!0;return o.jsxs("button",{type:"button",className:`v10-minibar-chip${f?"":" dim"}${u?" interactive":""}`,onClick:u?()=>n(d.key):void 0,disabled:!u,title:`${d.label} Memory — ${d.count} entities${u?" (click to toggle)":""}`,children:[o.jsx("span",{className:"v10-minibar-dot",style:{background:d.color}}),o.jsx("span",{className:"v10-minibar-short",children:d.short}),o.jsx("span",{className:"v10-minibar-count",children:d.count})]},d.key)})})]})}function PP({items:e,color:t,onSelectEntity:n,scrollKey:a}){const s=Ua(),l=ls(),u=w.useMemo(()=>{const d=new Map;for(const f of e){const h=`${f.date.getFullYear()}-${String(f.date.getMonth()+1).padStart(2,"0")}`,g=d.get(h)??[];g.push(f),d.set(h,g)}return[...d.entries()].sort((f,h)=>f[0].localeCompare(h[0]))},[e]);return e.length===0?o.jsx("div",{className:"v10-subgraph-timeline-empty","data-cg-scroll-key":a,children:o.jsx(ln,{compact:!0,title:"No timeline values yet.",description:"Entities in this sub-graph do not currently expose the configured timeline field."})}):o.jsx("div",{className:"v10-subgraph-timeline","data-cg-scroll-key":a,children:u.map(([d,f])=>o.jsxs("div",{className:"v10-subgraph-timeline-bucket",children:[o.jsxs("div",{className:"v10-subgraph-timeline-bucket-head",children:[o.jsx("span",{className:"v10-subgraph-timeline-bucket-dot",style:{background:t}}),o.jsx("span",{className:"v10-subgraph-timeline-bucket-label",children:G4(d)}),o.jsx("span",{className:"v10-subgraph-timeline-bucket-count",children:f.length})]}),o.jsx("div",{className:"v10-subgraph-timeline-items",children:f.map(({entity:h,date:g})=>{const{icon:m}=Bd(h,s),y=Ud(h),b=y?l==null?void 0:l.get(y):null;return o.jsxs("button",{className:"v10-subgraph-timeline-item",onClick:()=>n(h.uri),title:`${h.label} · ${g.toISOString().slice(0,10)}`,children:[o.jsx("span",{className:"v10-subgraph-timeline-item-icon",children:m}),o.jsx("span",{className:"v10-subgraph-timeline-item-label",children:h.label}),(b||y)&&o.jsx(es,{agent:b??void 0,fallbackUri:y??void 0,size:"sm"}),o.jsx("span",{className:"v10-subgraph-timeline-item-date",children:g.toISOString().slice(0,10)})]},h.uri)})})]},d))})}function UP({slug:e,rawMemory:t,contextGraphId:n,onNodeClick:a,onSelectEntity:s,activeTab:l,onTabChange:u,initialLayer:d,initialEnabledLayers:f,onEnabledLayersChange:h}){const g=Ua(),m=g==null?void 0:g.forSubGraph(e),y=(g==null?void 0:g.chipsFor(e))??[],b=(g==null?void 0:g.savedQueryCatalogsFor(e))??[],k=m==null?void 0:m.timelinePredicate,[j,N]=w.useState("items"),S=l??j,T=S==="timeline"&&!k?"items":S,E=u??N,[A,B]=w.useState(m!=null&&m.timelinePredicate?"created-desc":"triples");w.useEffect(()=>{B(m!=null&&m.timelinePredicate?"created-desc":"triples")},[e,m==null?void 0:m.timelinePredicate]);const _=w.useMemo(()=>f&&f.size>0?new Set(f):d==="wm"?new Set(["working"]):d==="swm"?new Set(["shared"]):d==="vm"?new Set(["verified"]):new Set(["working","shared","verified"]),[d,f]),[z,q]=w.useState(_);w.useEffect(()=>{h==null||h(z)},[z,h]);const[M,R]=w.useState(new Map),[P,F]=w.useState(null),[Z,I]=w.useState(null),[$,H]=w.useState(!1),[V,X]=w.useState(null),Y=e===$r,L=w.useMemo(()=>{const ee=[];for(const ce of t.entityList)(Y?ce.subGraphs.size===0:ce.subGraphs.has(e))&&ee.push(ce);return ee},[t.entityList,e,Y]),U=w.useMemo(()=>new Set(L.map(ee=>ee.uri)),[L]),G=w.useMemo(()=>t.graphTriples.filter(ee=>Am(ee,{slug:e,isRoot:Y,scopedUris:U})),[t.graphTriples,U,e,Y]),O=w.useMemo(()=>{let ee=0,ce=0,he=0;for(const Le of L)Le.trustLevel==="verified"?he++:Le.trustLevel==="shared"?ce++:ee++;return{wm:ee,swm:ce,vm:he,total:L.length}},[L]),ne=w.useMemo(()=>{if(z.size!==1)return null;const ee=z.values().next().value;return ee==="verified"?"vm":ee==="shared"?"swm":ee==="working"?"wm":null},[z]),ue=w.useMemo(()=>{let ee=L;if(z.size<3&&(ee=ee.filter(ce=>z.has(ce.trustLevel))),M.size>0)for(const ce of y){const he=M.get(ce.slug);!he||he.size===0||(ee=ee.filter(Le=>{const He=Le.properties.get(ce.predicate);return!He||He.length===0?!1:He.some(Ce=>he.has(Ce))}))}return Z&&(ee=ee.filter(ce=>Z.has(ce.uri))),ee},[L,z,M,y,Z]),le=w.useMemo(()=>new Set(ue.map(ee=>ee.uri)),[ue]),be=w.useMemo(()=>ue.length===L.length?G:G.filter(ee=>le.has(ee.subject)||le.has(ee.object)),[G,L,ue,le]),Ee=w.useMemo(()=>{if(!ne)return null;const ee=ne==="vm"?"verified":ne==="swm"?"shared":"working",ce=L.filter(Ce=>{if(!Ce.layers.has(ee))return!1;if(M.size>0)for(const Fe of y){const et=M.get(Fe.slug);if(!et||et.size===0)continue;const Ne=Ce.properties.get(Fe.predicate);if(!Ne||Ne.length===0||!Ne.some(Wt=>et.has(Wt)))return!1}return!(Z&&!Z.has(Ce.uri))}),he=new Set(ce.map(Ce=>Ce.uri)),Le=new Set,He=[];for(const Ce of t.allTriples){if(Ce.layer!==ee||!Am(Ce,{slug:e,isRoot:Y,scopedUris:U,requireResourceObject:!0})||!(he.has(Ce.subject)||he.has(Ce.object)))continue;const Fe=`${Ce.subject}|${Ce.predicate}|${Ce.object}`;Le.has(Fe)||(Le.add(Fe),He.push({subject:Ce.subject,predicate:Ce.predicate,object:Ce.object,subGraph:Ce.subGraph}))}return He},[ne,t.allTriples,U,e,Y,L,y,M,Z])??be,Ie=w.useMemo(()=>{if(ne){const ee=ne==="vm"?"verified":ne==="swm"?"shared":"working";return L.filter(ce=>{if(!ce.layers.has(ee))return!1;if(M.size>0)for(const he of y){const Le=M.get(he.slug);if(!Le||Le.size===0)continue;const He=ce.properties.get(he.predicate);if(!He||He.length===0||!He.some(Ce=>Le.has(Ce)))return!1}return!(Z&&!Z.has(ce.uri))})}return ue},[ne,L,ue,y,M,Z]),We=w.useMemo(()=>Ie.map(ee=>({uri:ee.uri,label:ee.label})),[Ie]),Se=w.useMemo(()=>{if(ne)return;const ee={};for(const ce of Ie){ee[ce.uri]=Yi[ce.trustLevel];const he=bt(ce.uri);he!==ce.uri&&(ee[he]=Yi[ce.trustLevel])}return ee},[ne,Ie]),ft=z.size===3?"All layers":ne?zn[ne].title:Array.from(z).map(ee=>zn[ee==="verified"?"vm":ee==="shared"?"swm":"wm"].trustLabel).join(" + "),De=w.useMemo(()=>{if(!k)return[];const ee=[];for(const ce of ue){const he=Qu(ce,k);he!=null&&ee.push({entity:ce,date:new Date(he)})}return ee.sort((ce,he)=>ce.date.getTime()-he.date.getTime()),ee},[ue,k]),qe=w.useMemo(()=>{const ee=[...ue];if((A==="created-desc"||A==="created-asc")&&k){const ce=A==="created-desc"?-1:1;return ee.sort((he,Le)=>{const He=Qu(he,k),Ce=Qu(Le,k);return He==null&&Ce==null?0:He==null?1:Ce==null?-1:(He-Ce)*ce}),ee}return A==="label"?(ee.sort((ce,he)=>(ce.label??"").localeCompare(he.label??"")),ee):(ee.sort((ce,he)=>{const Le=ce.tripleCount??0;return(he.tripleCount??0)-Le}),ee)},[ue,A,k]),ke=A==="created-desc"?"newest first · click to open":A==="created-asc"?"oldest first · click to open":A==="label"?"A → Z · click to open":"sorted by triples · click to open",lt=w.useCallback(ee=>{q(ce=>{const he=new Set(ce);return he.has(ee)?he.size>1&&he.delete(ee):he.add(ee),he})},[]),xe=w.useCallback((ee,ce)=>{R(he=>{const Le=new Map(he),He=new Set(Le.get(ee)??[]);return He.has(ce)?He.delete(ce):He.add(ce),He.size===0?Le.delete(ee):Le.set(ee,He),Le})},[]),Oe=w.useCallback(()=>{F(null),I(null),X(null)},[]),Ot=w.useCallback(async ee=>{var ce;H(!0),X(null),F(ee.slug);try{const he=await or(ee.sparql,n),Le=((ce=he==null?void 0:he.result)==null?void 0:ce.bindings)??[],He=ee.resultColumn||"uri",Ce=new Set;for(const Fe of Le){const et=Fe[He];if(!et)continue;const Ne=typeof et=="string"?et:String(et),Wt=Ne.startsWith("<")&&Ne.endsWith(">")?Ne.slice(1,-1):Ne;Ce.add(Wt)}I(Ce)}catch(he){X((he==null?void 0:he.message)??String(he)),I(null),F(null)}finally{H(!1)}},[n]),$t=(m==null?void 0:m.color)??(Y?"var(--text-tertiary)":"#64748b"),Yt=(m==null?void 0:m.icon)??"•",qt=(m==null?void 0:m.displayName)??e,ut=m==null?void 0:m.description;w.useEffect(()=>{q(_),R(new Map),Oe()},[e,Oe,_]),w.useEffect(()=>{l||N("items")},[e,l]),w.useEffect(()=>{S!==T&&E(T)},[S,T,E]);const Q=!(z.size===_.size&&[...z].every(ee=>_.has(ee)))||M.size>0||!!Z,W=()=>{q(new Set(_)),R(new Map),Oe()};return o.jsxs("div",{className:"v10-layer-detail v10-subgraph-detail",style:{"--sg-color":$t},children:[o.jsxs("div",{className:"v10-subgraph-detail-header",children:[o.jsx("span",{className:"v10-subgraph-detail-icon",style:{color:$t},children:Yt}),o.jsxs("div",{className:"v10-subgraph-detail-title-wrap",children:[o.jsx("div",{className:"v10-subgraph-detail-title",children:qt}),ut&&o.jsx("div",{className:"v10-subgraph-detail-desc",children:ut})]}),o.jsx(yC,{counts:{wm:O.wm,swm:O.swm,vm:O.vm},activeLayers:z,onClickLayer:lt,compact:!0})]}),o.jsxs("div",{className:"v10-subgraph-cross-layer",children:[o.jsx("div",{className:"v10-subgraph-cross-layer-lede",children:Y?"Root entities, across the three memory layers:":"This subgraph, across the three memory layers:"}),o.jsxs("div",{className:"v10-subgraph-cross-layer-strip","data-testid":"cross-layer-strip",children:[o.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"wm","aria-pressed":z.has("working"),onClick:()=>lt("working"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Yi.working},children:"◇"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Working"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:O.wm})]}),o.jsx("span",{className:"v10-subgraph-cross-layer-arrow","aria-hidden":"true",children:"→"}),o.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"swm","aria-pressed":z.has("shared"),onClick:()=>lt("shared"),title:ne==="swm"?"Showing Shared Working Memory only — graph is colored by contributing agent (see legend).":void 0,children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Yi.shared},children:"◈"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Shared"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:O.swm})]}),o.jsx("span",{className:"v10-subgraph-cross-layer-arrow","aria-hidden":"true",children:"→"}),o.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"vm","aria-pressed":z.has("verified"),onClick:()=>lt("verified"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Yi.verified},children:"◉"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Verifiable"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:O.vm})]})]}),o.jsxs("span",{className:`v10-subgraph-active-layer-pill${z.size===3?" all-layers":""}`,"data-testid":"active-layer-pill",children:[o.jsx("span",{className:"v10-subgraph-active-layer-pill-label",children:"Active layer:"}),o.jsx("span",{className:"v10-subgraph-active-layer-pill-value",children:ft})]})]}),b.length>0&&o.jsxs("div",{className:"v10-subgraph-savedqueries",children:[o.jsx("span",{className:"v10-subgraph-savedqueries-label",children:"Query catalog"}),b.map(ee=>o.jsxs(Ve.Fragment,{children:[o.jsx("span",{className:"v10-subgraph-savedqueries-label",title:ee.description||ee.name,style:{marginLeft:8,opacity:.8},children:ee.name}),ee.queries.map(ce=>{const he=P===ce.slug;return o.jsxs("button",{type:"button",className:`v10-subgraph-savedquery${he?" active":""}`,onClick:()=>he?Oe():Ot(ce),title:ce.description||ce.name,disabled:$&&!he,children:[o.jsx("span",{className:"v10-subgraph-savedquery-glyph",children:$&&he?"…":he?"✓":"◎"}),ce.name]},ce.slug)})]},ee.slug)),V&&o.jsx("span",{className:"v10-subgraph-savedquery-error",title:V,children:"✕ query failed"}),Z&&P&&o.jsxs("span",{className:"v10-subgraph-savedquery-count",children:[Z.size," match",Z.size===1?"":"es"]})]}),y.length>0&&o.jsxs("div",{className:"v10-subgraph-filters",children:[y.map(ee=>{const ce=M.get(ee.slug)??new Set;return o.jsxs("div",{className:"v10-subgraph-filter-row",children:[o.jsx("span",{className:"v10-subgraph-filter-label",children:ee.label}),o.jsx("div",{className:"v10-subgraph-filter-chips",children:ee.values.map(he=>{const Le=ce.has(he);return o.jsx("button",{type:"button",className:`v10-subgraph-filter-chip${Le?" active":""}`,onClick:()=>xe(ee.slug,he),children:he},he)})})]},ee.slug)}),Q&&o.jsx("button",{type:"button",className:"v10-subgraph-filter-reset",onClick:W,children:"Reset filters"})]}),o.jsxs("div",{className:"v10-layer-detail-body",children:[o.jsxs("div",{className:"v10-layer-expand-tabs",children:[o.jsxs("button",{className:`v10-layer-expand-tab ${T==="items"?"active":""}`,onClick:()=>E("items"),children:["Entities (",ue.length,ue.length!==L.length?` / ${L.length}`:"",")"]}),o.jsx("button",{className:`v10-layer-expand-tab ${T==="graph"?"active":""}`,onClick:()=>E("graph"),children:"Graph"}),k&&o.jsx("button",{className:`v10-layer-expand-tab ${T==="timeline"?"active":""}`,onClick:()=>E("timeline"),children:"Timeline"}),o.jsx("button",{className:`v10-layer-expand-tab ${T==="docs"?"active":""}`,onClick:()=>E("docs"),children:"Documents"})]}),T==="items"&&o.jsx("div",{className:"v10-layer-expand-body entities-tab","data-cg-scroll-key":`subgraph:${e}:items`,children:o.jsx(Cj,{entities:qe,layerKey:"wm",layerIcon:Yt,onSelectEntity:s,externallySorted:!0,sortLabel:ke,timestampPredicate:k,perEntityTrustBadge:!0,headerExtra:o.jsxs("label",{className:"v10-entity-list-sort",children:[o.jsx("span",{className:"v10-entity-list-sort-label",children:"Sort"}),o.jsxs("select",{className:"v10-entity-list-sort-select",value:A,onChange:ee=>B(ee.target.value),"aria-label":"Sort entities",children:[k&&o.jsxs(o.Fragment,{children:[o.jsx("option",{value:"created-desc",children:"Newest first"}),o.jsx("option",{value:"created-asc",children:"Oldest first"})]}),o.jsx("option",{value:"triples",children:"Most triples"}),o.jsx("option",{value:"label",children:"Label (A→Z)"})]})]})})}),T==="graph"&&o.jsx("div",{className:"v10-layer-expand-body full-width","data-cg-scroll-key":`subgraph:${e}:graph`,children:o.jsx(kj,{layer:ne??"wm",triples:Ee,onNodeClick:a,contextGraphId:n,title:qt,scopeLabel:`Subgraph graph: ${qt} entities and entity-to-entity triples from loaded subgraph data.`,trustLegendActiveLayer:ne,scopeEntities:We,layerEntities:Ie,nodeColorsOverride:Se})}),T==="timeline"&&k&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(PP,{items:De,color:$t,onSelectEntity:s,scrollKey:`subgraph:${e}:timeline`})}),T==="docs"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(Nj,{entities:ue,contextGraphId:n,scrollKey:`subgraph:${e}:docs`})})]})]})}const BP={wm:"items",swm:"items",vm:"items"},Nw={wm:"working",swm:"shared",vm:"verified"};function Wh(e){return e==="wm"||e==="swm"||e==="vm"}function FP(e){const t=new Set;return e.filter(n=>{const a=`${bt(n.subject)}|${n.predicate}|${bt(n.object)}`;return t.has(a)?!1:(t.add(a),!0)})}function Ew(e,t){if(typeof document>"u")return t;const n=document.querySelectorAll("[data-cg-scroll-key]");for(const a of n)if(a.dataset.cgScrollKey===e)return a;return t}function HP({contextGraphId:e}){const{data:t,error:n,loading:a,refresh:s}=lr(An.fetchContextGraphs,[],3e4),[l,u]=w.useState(!1),[d,f]=w.useState(!1),[h,g]=w.useState("overview"),[m,y]=w.useState(null),[b,k]=w.useState({contextGraphId:null,list:[],status:"loading"}),[j,N]=w.useState(null),[S,T]=w.useState(!1),E=w.useRef(0),[A,B]=w.useState(null),[_,z]=w.useState(null),q=w.useRef(null),[M,R]=w.useState(null),P=w.useCallback(de=>{q.current=de,R(de)},[]),F=w.useRef(null),Z=w.useCallback(de=>{F.current=de,de===null&&(q.current=null,R(null)),B(de)},[]),[I,$]=w.useState(null),H=w.useRef(null);w.useEffect(()=>{H.current=m},[m]);const[V,X]=w.useState(BP),[Y,L]=w.useState({}),U=w.useRef(null),G=w.useRef(null),O=w.useRef(null),ne=w.useRef(0),ue=bM(e),le=CM(e),be=fn(de=>de.openTab),{data:_e,loading:Ee,error:Ie}=zd(),We=w.useCallback(()=>A?`subgraph:${A}:${Y[A]??"items"}`:Wh(h)?`layer:${h}:${V[h]}`:"page",[h,A,V,Y]),Se=w.useCallback(de=>{const je=de??We(),Te=Ew(je,U.current);return{activeLayer:h,activeSubGraph:A,layerTabs:{...V},subGraphTabs:{...Y},scroll:{key:je,top:(Te==null?void 0:Te.scrollTop)??0},subGraphEnabledLayers:A!==null&&q.current?new Set(q.current):null}},[h,A,We,V,Y]),ft=w.useCallback(de=>{const je=()=>{const Te=Ew(de.key,U.current);Te&&(Te.scrollTop=de.top)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(je):setTimeout(je,0)},[]),De=w.useCallback((de,je)=>{(!H.current||!G.current)&&(G.current=Se(je)),y(de)},[Se]),qe=w.useCallback(()=>{G.current=null},[]);w.useEffect(()=>{if(m)return;const de=O.current;de&&(O.current=null,ft(de))},[m,h,A,V,Y,ft]),w.useEffect(()=>{const de=je=>{const Te=je.detail;Te&&Te.contextGraphId===e&&typeof Te.entityUri=="string"&&($(null),De(Te.entityUri))};return window.addEventListener("v10:open-entity",de),()=>window.removeEventListener("v10:open-entity",de)},[e,De]);const ke=w.useCallback(de=>{var tt;const je=de.startsWith("urn:dkg:agent:")?de.slice(14):de,Te=((tt=le.get(de))==null?void 0:tt.name)??je;be({id:`agent:${e}|${je}`,label:`@ ${Te}`,closable:!0})},[le,e,be]),lt=w.useMemo(()=>({...le,openAgent:ke}),[le,ke]),xe=w.useMemo(()=>{var de;return(de=t==null?void 0:t.contextGraphs)==null?void 0:de.find(je=>je.id===e)},[t,e]),Oe=Gg(e,{signalErrors:!0}),Ot=Zg(Oe).total,$t=T4({activeLayer:h,activeSubGraph:A}),Yt=yj($t?e:void 0),qt=!A&&h==="overview",ut=LM(qt?e:void 0),ye=qt?ut.resultContextGraphId===e?ut.events:[]:void 0,Q=qt&&ut.resultContextGraphId===e?ut.error:null,W=w.useCallback(()=>{const de=xe==null?void 0:xe.id;if(!de)return;const je=ne.current+1;ne.current=je,k({contextGraphId:de,list:[],status:"loading"}),An.listParticipants(de).then(Te=>{ne.current===je&&k({contextGraphId:de,list:Te.allowedAgents,status:"ok"})}).catch(()=>{ne.current===je&&k({contextGraphId:de,list:[],status:"error"})})},[xe==null?void 0:xe.id]);w.useEffect(()=>{W()},[W]);const ee=w.useCallback(()=>{const de=++E.current;An.fetchSubGraphs(e).then(je=>{if(E.current!==de)return;const Te=(je.subGraphs??[]).filter(Kg).length;N(Te),T(!1)}).catch(()=>{E.current===de&&(N(null),T(!0))})},[e]);w.useEffect(()=>{N(null),T(!1),ee()},[ee]),xo(e,ee);const ce=I?Nw[I]:null,he=w.useMemo(()=>ce?Oe.allTriples.filter(de=>de.layer===ce):Oe.graphTriples,[Oe.allTriples,Oe.graphTriples,ce]),Le=w.useMemo(()=>ce?FP(he):he,[he,ce]),He=w.useMemo(()=>ce?JS(he):Oe.entities,[he,Oe.entities,ce]),Ce=w.useMemo(()=>m?He.get(m)??null:null,[m,He]);w.useEffect(()=>{!m||Ce||Oe.loading||(y(null),$(null),qe())},[m,Ce,Oe.loading,qe]);const Fe=w.useCallback((de,je)=>{const Te=F.current;if(qe(),Z(de),de===null)z(null);else if(je!==void 0){const tt=new Set([Nw[je]]);z(tt),q.current=tt,R(tt)}else{if(Te!==null&&de===Te)return;if(Te!==null&&q.current){const tt=new Set(q.current);z(tt),q.current=tt,R(tt)}else z(null),q.current=null,R(null)}y(null),$(null)},[qe,Z]),et=w.useCallback(de=>{qe(),g(de),y(null),$(null),Z(null),z(null)},[qe,Z]),Ne=w.useCallback((de,je)=>{X(Te=>Te[de]===je?Te:{...Te,[de]:je})},[]),Wt=w.useCallback((de,je)=>{L(Te=>Te[de]===je?Te:{...Te,[de]:je})},[]),_t=w.useCallback((de,je,Te)=>{const tt=H.current!=null;De(de,je),$(Je=>Te??(tt?Je:null))},[De]),Hr=w.useCallback(()=>{const de=G.current;if(G.current=null,y(null),$(null),!!de){if(g(de.activeLayer),Z(de.activeSubGraph),de.activeSubGraph!==null&&de.subGraphEnabledLayers){const je=new Set(de.subGraphEnabledLayers);z(je),q.current=je,R(je)}X(de.layerTabs),L(de.subGraphTabs),O.current=de.scroll}},[Z]),dr=w.useCallback(de=>{if(!(de!=null&&de.id))return;const je=Wh(de.trustLayer)?de.trustLayer:void 0;_t(de.id,void 0,je)},[_t]),Fa=w.useCallback(de=>{const je=Wh(h)?h:void 0;_t(de,void 0,je)},[h,_t]),Ha=w.useCallback(de=>{_t(de,"page")},[_t]),pr=w.useCallback(()=>{be(xj)},[be]),qr=!!n&&/authentication|unauthor|expired|sign in|log in/i.test(n);if(!xe)return n||t&&!a?o.jsxs("div",{className:"v10-view-placeholder",children:[o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:12,marginBottom:10},children:n?qr?n:"Failed to load context graph.":"Context graph not found."}),qr?o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:()=>window.location.reload(),children:"Refresh page"}):o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:s,children:"Retry"})]}):o.jsx("div",{className:"v10-view-placeholder",children:o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:12},children:"Loading context graph..."})});const ca=A?ue.forSubGraph(A):null,qa=!Oe.loading&&!Oe.error&&!Oe.partial?Oe.entityList:void 0,Ci=Ce?"entity":A?"subgraph":h,ge=b.contextGraphId===xe.id?b.list:[],Me=b.contextGraphId===xe.id?b.status:"loading";return o.jsx(mj.Provider,{value:ue,children:o.jsx(vj.Provider,{value:lt,children:o.jsxs("div",{className:"v10-memory-explorer",children:[n&&o.jsx("div",{className:"v10-stale-banner",role:"status",children:qr?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:n}),o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:()=>window.location.reload(),children:"Refresh page"})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Couldn’t refresh context-graph data — showing last known values."}),o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:s,children:"Retry"})]})}),o.jsx(fD,{cg:xe,profile:ue,activeSubGraph:ca,onClearSubGraph:()=>Fe(null)}),o.jsx(pD,{active:h,counts:Oe.counts,onSwitch:et,onShare:()=>f(!0),onImport:()=>u(!0),onRefresh:Oe.refresh}),o.jsxs("main",{className:"v10-memory-explorer-page","data-view":Ci,"data-cg-scroll-key":"page",ref:U,children:[Ce&&o.jsx(zP,{entity:Ce,allEntities:He,allTriples:Le,onNavigate:_t,onClose:Hr,contextGraphId:e,onRefresh:Oe.refresh}),A&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(jw,{}),o.jsx(zh,{contextGraphId:e,profile:ue,selected:A,entities:qa,onSelect:Fe,enabledScope:M??void 0,allTriplesTotal:Ot}),o.jsx(UP,{slug:A,rawMemory:Oe,contextGraphId:e,onNodeClick:dr,onSelectEntity:_t,activeTab:Y[A]??"items",onTabChange:de=>Wt(A,de),initialEnabledLayers:_??void 0,onEnabledLayersChange:P})]}),!A&&h==="overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(bD,{cg:xe,memory:Oe,subGraphCount:j,subGraphFetchFailed:S,participants:ge,participantsStatus:Me,currentAgent:_e??null,currentAgentStatus:Ee?"loading":Ie?"error":"ok",onSwitchLayer:et,onOpenPrimer:pr}),o.jsx(xD,{contextGraphId:e,curatorStatus:vD({cg:xe,currentAgent:_e??null,currentAgentStatus:Ee?"loading":Ie?"error":"ok"}),onParticipantsChanged:W}),Oe.loading&&o.jsx("div",{className:"v10-me-loading",children:o.jsx("div",{className:"v10-me-loading-text",children:"Loading memory..."})}),Oe.error&&o.jsxs("div",{className:"v10-me-error",children:["Error: ",Oe.error]}),o.jsx("div",{"data-section":"activity",children:o.jsx(XM,{entities:Oe.entityList,lifecycleEvents:ye,lifecycleError:Q,onSelectEntity:Ha,title:"Recent activity",limit:40,includeUndated:!1,emptyHint:"Once knowledge starts being added and managed in this context graph, activities will show up here as a live feed.",className:"v10-overview-activity"})}),o.jsx(wD,{onOpenPrimer:pr})]}),!A&&h==="graph-overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(jw,{}),o.jsx(zh,{contextGraphId:e,profile:ue,selected:null,entities:qa,onSelect:Fe,allTriplesTotal:Ot}),o.jsx(IP,{contextGraphId:e,memory:Oe,onNodeClick:dr,onSelectSubGraph:Fe})]}),!A&&h==="query"&&!Ce&&o.jsx(XD,{contextGraphId:e}),!A&&(h==="wm"||h==="swm"||h==="vm")&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(zh,{contextGraphId:e,profile:ue,selected:A,entities:qa,onSelect:Fe,layer:h}),o.jsx(PD,{layer:h,memory:Oe,onNodeClick:dr,onSelectEntity:Fa,contextGraphId:e,activeTab:V[h],onTabChange:de=>Ne(h,de),swmAttribution:Yt})]})]}),o.jsx(iM,{open:l,onClose:()=>u(!1),contextGraphId:xe.id,contextGraphName:xe.name}),o.jsx(oM,{open:d,onClose:()=>f(!1),contextGraphId:xe.id,contextGraphName:xe.name})]})})})}const qP=[{title:"Memory layers",body:"Working Memory is private staging, Shared Working Memory is the collaborative review layer, and Verifiable Memory is the published on-chain layer. Counts show where entities live now."},{title:"Subgraphs",body:"Subgraphs organize the same Context Graph by topic or source. They cut across memory layers, so a subgraph can contain Working, Shared Working, and Verifiable Memory at the same time."},{title:"Entities and Knowledge Assets",body:"Working Memory and Shared Working Memory contain entities. When published, an assertion/triple bundle is anchored as a Knowledge Asset in Verifiable Memory, giving included entities on-chain provenance."},{title:"Assertions",body:"Assertions are batches of triples that explain how entities entered or moved through the Context Graph. They are useful for reviewing provenance and lifecycle state."},{title:"Roles",body:"A curator controls access and publication policy. A participant can collaborate inside the Context Graph according to that policy."}];function GP(){const e=fn(n=>n.closeTab),t=Ve.useCallback(()=>e(Xg),[e]);return Ve.useEffect(()=>{const n=a=>{a.key==="Escape"&&(a.preventDefault(),t())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),o.jsxs("div",{className:"v10-primer-view",children:[o.jsxs("header",{className:"v10-primer-header",children:[o.jsx("button",{type:"button",className:"v10-primer-back",onClick:t,"aria-label":"Close primer and return to the previous tab",children:"← Back"}),o.jsx("p",{className:"v10-primer-kicker",children:"Context Graph Primer"}),o.jsx("h1",{children:"What is a Context Graph?"}),o.jsx("p",{children:"A Context Graph is a shared knowledge workspace where agents stage, review, organize, and publish structured memory."})]}),o.jsxs("section",{className:"v10-primer-pipeline","aria-label":"Context Graph pipeline",children:[o.jsx("span",{className:"wm",children:"Working Memory"}),o.jsx("span",{className:"connector","aria-hidden":"true"}),o.jsx("span",{className:"swm",children:"Shared Working Memory"}),o.jsx("span",{className:"connector","aria-hidden":"true"}),o.jsx("span",{className:"vm",children:"Verifiable Memory"})]}),o.jsx("div",{className:"v10-primer-sections",children:qP.map(n=>o.jsxs("section",{className:"v10-primer-section",children:[o.jsx("h2",{children:n.title}),o.jsx("p",{children:n.body})]},n.title))})]})}const VP={"application/pdf":"pdf","application/json":"text","text/plain":"text","text/csv":"text","text/markdown":"markdown","image/png":"image","image/jpeg":"image","image/gif":"image","image/webp":"image"};function Tw(e){const t=VP[e];return t?t==="markdown"?"text":t:"binary"}async function Aw(e){const t=await fetch(e,{headers:Ft()});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=await t.blob();return URL.createObjectURL(n)}function WP({open:e,onClose:t,assertionName:n,contextGraphId:a,subGraphName:s}){const[l,u]=w.useState(null),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(!0),[b,k]=w.useState(null);w.useEffect(()=>{if(e)return y(!0),k(null),u(null),f(null),g(null),j_(n,a,s).then(async A=>{u(A);const B=Tw(A.detectedContentType),_=Vu(A.fileHash,A.detectedContentType);if(B==="text"){const z=await fetch(_,{headers:Ft()});z.ok&&f(await z.text())}else if(B==="pdf"||B==="image"){const z=await Aw(_);g(z)}}).catch(A=>k(A.message??"Failed to load file info")).finally(()=>y(!1)),()=>{h&&URL.revokeObjectURL(h)}},[e,n,a,s]),w.useEffect(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);const{dialogRef:j,onBackdropClick:N}=Ji(e,t);if(!e)return null;const S=l?Tw(l.detectedContentType):null,T=l?Vu(l.fileHash,l.detectedContentType):null,E=async(A,B)=>{try{const _=await Aw(A),z=document.createElement("a");z.href=_,z.download=B,z.click(),URL.revokeObjectURL(_)}catch{window.open(A,"_blank")}};return o.jsx("div",{className:"v10-modal-overlay",onClick:N,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box v10-file-preview-modal",ref:j,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-file-preview-title",children:[o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-file-preview-title",className:"v10-modal-title",children:n}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close file preview",title:"Close (Esc)",children:"×"})]}),m&&o.jsx("div",{className:"v10-file-preview-loading",children:"Loading file preview..."}),b&&o.jsxs("div",{className:"v10-file-preview-error",children:[o.jsx("p",{children:b}),o.jsx("p",{style:{fontSize:11,marginTop:4},children:"File preview requires the extraction status to still be cached on the node. If the node was restarted, the preview metadata may be unavailable."})]}),l&&!m&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-file-preview-meta",children:[o.jsx("span",{className:"v10-file-preview-meta-item",children:l.detectedContentType}),o.jsxs("span",{className:"v10-file-preview-meta-item",children:[l.tripleCount," triples extracted"]}),o.jsx("span",{className:"v10-file-preview-meta-item",children:l.pipelineUsed}),l.completedAt&&o.jsx("span",{className:"v10-file-preview-meta-item",children:new Date(l.completedAt).toLocaleString()})]}),o.jsxs("div",{className:"v10-file-preview-content",children:[S==="pdf"&&h&&o.jsx("iframe",{src:h,className:"v10-file-preview-iframe",title:`Preview: ${n}`}),S==="image"&&h&&o.jsx("img",{src:h,alt:n,className:"v10-file-preview-image"}),S==="text"&&d!=null&&o.jsx("pre",{className:"v10-file-preview-text",children:d}),S==="binary"&&o.jsxs("div",{className:"v10-file-preview-binary",children:[o.jsx("p",{children:"This file type cannot be previewed directly."}),T&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>E(T,n),children:"Download file"})]})]}),o.jsxs("div",{className:"v10-file-preview-footer",children:[T&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>E(T,n),children:"Download original"}),l.mdIntermediateHash&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>E(Vu(l.mdIntermediateHash,"text/markdown"),`${n}.md`),children:"Download markdown intermediate"})]})]})]})})}const ZP=w.lazy(()=>gt(()=>import("./index-BTD4QwAm.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),KP=w.lazy(()=>gt(()=>import("./index-BTD4QwAm.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.NodePanel}))),YP=w.lazy(()=>gt(()=>import("./OnChainProvenanceCard-Dga51ZJL.js"),__vite__mapDeps([2,0,1])).then(e=>({default:e.OnChainProvenanceCard}))),QP={wm:{label:"Working Memory",color:"var(--layer-working)",icon:"◇",description:"Private agent drafts. Fast local storage."},swm:{label:"Shared Working Memory",color:"var(--layer-shared)",icon:"◈",description:"Shared proposals with collaborators. TTL-bounded."},vm:{label:"Verifiable Memory",color:"var(--layer-verified)",icon:"◉",description:"Endorsed, published, on-chain knowledge."}},XP={labelMode:"humanized",renderer:"2d",labels:Id({extraPredicates:["http://schema.org/text"]}),style:{classColors:{"http://schema.org/Person":"#f472b6","http://schema.org/Organization":"#fb923c","http://schema.org/Place":"#34d399","http://schema.org/Product":"#c084fc","http://schema.org/Event":"#facc15","http://schema.org/CreativeWork":"#7dd3fc","http://schema.org/Thing":"#94a3b8"},defaultNodeColor:"#94a3b8",defaultEdgeColor:"#5f8598",edgeWidth:.9},hexagon:{baseSize:4,minSize:3,maxSize:6,scaleWithDegree:!0},focus:{maxNodes:3e3,hops:999}},JP=o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),o.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),o.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),e5=o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"6",cy:"6",r:"3"}),o.jsx("circle",{cx:"18",cy:"6",r:"3"}),o.jsx("circle",{cx:"6",cy:"18",r:"3"}),o.jsx("circle",{cx:"18",cy:"18",r:"3"}),o.jsx("line",{x1:"8.5",y1:"7.5",x2:"15.5",y2:"16.5"}),o.jsx("line",{x1:"15.5",y1:"7.5",x2:"8.5",y2:"16.5"})]});function Zh({layer:e,contextGraphId:t,externalQuery:n,externalQueryKey:a,queryPresetOptions:s}){var Ie,We;const l=QP[e],[u,d]=w.useState("graph"),[f,h]=w.useState(""),[g,m]=w.useState(""),[y,b]=w.useState(""),[k,j]=w.useState(""),[N,S]=w.useState("any"),[T,E]=w.useState(50),[A,B]=w.useState(""),[_,z]=w.useState("any"),[q,M]=w.useState(50),[R,P]=w.useState(e!=="vm"),F=Ve.useRef(e);Ve.useEffect(()=>{F.current!==e&&(F.current=e,h(""),P(e!=="vm"),m(""),b(""),j(""),S("any"),E(50),B(""),z("any"),M(50))},[e]),Ve.useEffect(()=>{n!==void 0&&(h(""),m(n),b(n))},[n,a]);const Z=w.useMemo(()=>e==="wm"?`SELECT ?s ?p ?o WHERE { GRAPH <${`did:dkg:context-graph:${t}/_meta`}> { ?g <http://dkg.io/ontology/memoryLayer> "WM" } GRAPH ?g { ?s ?p ?o } FILTER(!CONTAINS(STR(?g), "/meta/assertion/")) } LIMIT 1000`:e==="vm"?r5({query:A,field:_,limit:q}):"SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 500",[t,e,_,q,A]),I=y||Z,$=e==="swm"?"_shared_memory":void 0,H=e==="swm",V=e==="vm"?"verifiable-memory":void 0,X=e==="wm"&&I===Z,{data:Y,loading:L,error:U,refresh:G}=lr(()=>or(I,t,H,$,V,X),[I,t,H,$,V,X],0);xo(t,G,{layers:[e]});const{data:O}=lr(jg,[],3e4),ne=O==null?void 0:O.blockExplorerUrl,ue=w.useCallback(()=>{const Se=g.trim();if(Se===y){G();return}b(Se)},[y,g,G]),le=w.useCallback(()=>{const Se=k!==A||N!==_||T!==q;if(Se&&(B(k),z(N),M(T)),y){b("");return}Se||G()},[y,_,q,A,N,T,k,G]),be=((Ie=Y==null?void 0:Y.result)==null?void 0:Ie.bindings)??((We=Y==null?void 0:Y.results)==null?void 0:We.bindings)??[],_e=w.useMemo(()=>be.map(Se=>({subject:Ks(Se.s)??"",predicate:Ks(Se.p)??"",object:Ks(Se.o)??""})).filter(Se=>Se.subject&&Se.predicate&&Se.object),[be]),Ee=w.useCallback(Se=>{Se!=null&&Se.id&&b(`SELECT (<${Se.id}> AS ?s) ?p ?o WHERE { <${Se.id}> ?p ?o } LIMIT 100`)},[]);return o.jsxs("div",{className:"v10-memory-layer-view",children:[o.jsxs("div",{className:"v10-mlv-header",children:[o.jsx("span",{className:"v10-mlv-icon",style:{color:l.color},children:l.icon}),o.jsxs("div",{children:[o.jsx("h2",{className:"v10-mlv-title",children:l.label}),o.jsx("p",{className:"v10-mlv-desc",children:l.description})]})]}),e==="wm"&&o.jsx(t5,{contextGraphId:t,onPromoted:G}),e==="swm"&&o.jsx(n5,{contextGraphId:t,onPublished:G}),e==="vm"&&o.jsxs("div",{className:"v10-vm-search-panel",children:[o.jsxs("div",{className:"v10-vm-search-header",children:[o.jsxs("div",{children:[o.jsx("div",{className:"v10-vm-search-title",children:"Search Verifiable Memory"}),o.jsx("div",{className:"v10-vm-search-desc",children:"Search published triples by subject, predicate, object, or across all fields."})]}),o.jsx("button",{className:"v10-vm-search-toggle",type:"button",onClick:()=>P(Se=>!Se),children:R?"Hide SPARQL":"Advanced SPARQL"})]}),o.jsxs("div",{className:"v10-vm-search-controls",children:[o.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Search verifiable memory...",value:k,onChange:Se=>j(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&le()}}),o.jsxs("select",{className:"v10-vm-search-select",value:N,onChange:Se=>S(Se.target.value),children:[o.jsx("option",{value:"any",children:"Any field"}),o.jsx("option",{value:"subject",children:"Subject"}),o.jsx("option",{value:"predicate",children:"Predicate"}),o.jsx("option",{value:"object",children:"Object"})]}),o.jsxs("select",{className:"v10-vm-search-select",value:String(T),onChange:Se=>E(Number.parseInt(Se.target.value,10)||50),children:[o.jsx("option",{value:"25",children:"25 rows"}),o.jsx("option",{value:"50",children:"50 rows"}),o.jsx("option",{value:"100",children:"100 rows"}),o.jsx("option",{value:"200",children:"200 rows"})]}),o.jsx("button",{className:"v10-mlv-run-btn",onClick:le,children:"Search"})]})]}),(e!=="vm"||R)&&o.jsxs("div",{className:"v10-mlv-query-bar",children:[s!=null&&s.length?o.jsxs("select",{className:"v10-vm-search-select",value:f,onChange:Se=>{const ft=Se.target.value;h(ft);const De=s.find(ke=>ke.label===ft),qe=(De==null?void 0:De.query)??"";m(qe),b(qe)},children:[o.jsx("option",{value:"",children:"Select common query..."}),s.map(Se=>o.jsx("option",{value:Se.label,children:Se.label},Se.label))]}):o.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Custom SPARQL query...",value:g,onChange:Se=>m(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&ue()}}),o.jsx("button",{className:"v10-mlv-run-btn",onClick:ue,children:"Run"}),y&&o.jsx("button",{className:"v10-mlv-clear-btn",onClick:()=>b(""),title:"Reset to full layer overview",children:"Reset"}),o.jsxs("div",{className:"v10-mlv-view-toggle",children:[o.jsx("button",{className:`v10-mlv-toggle-btn ${u==="table"?"active":""}`,onClick:()=>d("table"),title:"Table view",children:JP}),o.jsx("button",{className:`v10-mlv-toggle-btn ${u==="graph"?"active":""}`,onClick:()=>d("graph"),title:"Graph view",children:e5})]})]}),L&&o.jsx("p",{className:"v10-mlv-status",children:"Loading..."}),U&&o.jsxs("p",{className:"v10-mlv-status",style:{color:"var(--accent-red)"},children:["Error: ",U]}),!L&&be.length===0&&o.jsxs("div",{className:"v10-mlv-empty",children:[o.jsxs("p",{children:["No triples found in ",l.label.toLowerCase(),"."]}),o.jsxs("p",{style:{fontSize:11,marginTop:4},children:[e==="wm"&&"Import files or chat with your agent to generate working memory.",e==="swm"&&"Promote assertions from working memory to share with collaborators.",e==="vm"&&"Publish shared memory to create verified on-chain knowledge."]})]}),!L&&be.length>0&&u==="table"&&o.jsxs("div",{className:"v10-mlv-table-wrap",children:[o.jsxs("div",{className:"v10-mlv-result-count",children:[be.length," triples"]}),o.jsxs("table",{className:"v10-mlv-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Subject"}),o.jsx("th",{children:"Predicate"}),o.jsx("th",{children:"Object"})]})}),o.jsx("tbody",{children:be.map((Se,ft)=>o.jsxs("tr",{children:[o.jsx("td",{className:"v10-mlv-cell",children:Kh(Ks(Se.s))}),o.jsx("td",{className:"v10-mlv-cell",children:Kh(Ks(Se.p))}),o.jsx("td",{className:"v10-mlv-cell",children:Kh(Ks(Se.o))})]},ft))})]})]}),!L&&_e.length>0&&u==="graph"&&o.jsxs("div",{className:"v10-mlv-graph-container",children:[o.jsxs("div",{className:"v10-mlv-graph-info",children:[o.jsxs("span",{children:[_e.length," triples"]}),y&&o.jsx("span",{className:"v10-mlv-graph-info-custom",children:"filtered"})]}),o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"v10-mlv-graph-loading",children:"Loading graph renderer..."}),children:o.jsxs(ZP,{data:_e,format:"triples",options:XP,style:{width:"100%",height:"100%"},onNodeClick:Ee,initialFit:!0,children:[o.jsx(KP,{className:"v10-mlv-node-panel",showUri:!0,showTypes:!0,showProperties:!0,showMetadata:!1,maxValueLength:150}),o.jsx(YP,{contextGraphId:t,layer:e,explorerUrl:ne})]})})]})]})}function t5({contextGraphId:e,onPromoted:t}){const{data:n,loading:a,refresh:s}=lr(()=>Ql(e,"wm"),[e],0);xo(e,s,{layers:["wm"]});const[l,u]=w.useState(null),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(null),b=w.useCallback(async j=>{u(j.graphUri),f(null),g(null);try{const N=await oo(e,j.name,j.subGraph?{subGraphName:j.subGraph}:{}),S=_g(j.name,N);f({message:S.message+(j.subGraph?` (in ${j.subGraph})`:""),kind:S.kind==="success"?"success":"noop",subGraph:j.subGraph}),s(),t()}catch(N){const S=lo(j.name,N);g(S?{message:S.message,kind:"not-persisted"}:{message:(N==null?void 0:N.message)??"Promote failed",kind:"other"})}finally{u(null)}},[e,s,t]),k=w.useCallback(async()=>{if(!(n!=null&&n.length))return;u("__all__"),f(null),g(null);let j=0,N=null;try{for(const E of n)N=E.name,(await oo(e,E.name,E.subGraph?{subGraphName:E.subGraph}:{})).promotedCount===0&&(j+=1);const S=n.length-j,T=j>0?` (${j} already shared or still committing)`:"";f({message:S>0?`Shared ${S} complete Knowledge Asset${S===1?"":"s"} to Shared Working Memory${T}.`:"No Knowledge Assets were newly shared — all were already in Shared Working Memory or still committing.",kind:S>0?"success":"noop"}),s(),t()}catch(S){const T=lo(N??"selected assertion",S);g(T?{message:T.message,kind:"not-persisted"}:{message:(S==null?void 0:S.message)??"Promote failed",kind:"other"})}finally{u(null)}},[n,e,s,t]);return a?o.jsx("div",{className:"v10-assertion-list-loading",children:"Loading assertions..."}):n!=null&&n.length?o.jsxs("div",{className:"v10-assertion-list",children:[o.jsxs("div",{className:"v10-assertion-list-header",children:[o.jsxs("span",{className:"v10-assertion-list-title",children:["Assertions in Working Memory (",n.length,")"]}),o.jsx("button",{className:"v10-btn-promote-all",disabled:l!==null,onClick:k,children:l==="__all__"?"Sharing...":"Share Complete KAs → SWM"})]}),o.jsx("div",{className:"v10-assertion-items",children:n.map(j=>o.jsxs("div",{className:"v10-assertion-item",children:[o.jsxs("div",{className:"v10-assertion-item-info",children:[o.jsx("button",{className:"v10-assertion-item-name clickable",title:j.graphUri,onClick:()=>y({name:j.name,subGraph:j.subGraph}),children:j.name}),j.tripleCount!=null&&o.jsxs("span",{className:"v10-assertion-item-count",children:[j.tripleCount," triples"]}),j.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${j.subGraph}`,children:["› ",nv(j.subGraph,18)]})]}),o.jsx("button",{className:"v10-btn-promote",disabled:l!==null,onClick:()=>b(j),title:"Share this complete Knowledge Asset to Shared Working Memory",children:l===j.graphUri?"Promoting...":"→ SWM"})]},j.graphUri))}),d&&o.jsx("div",{className:d.kind==="success"?"v10-promote-result success":"v10-promote-result info",children:d.message}),h&&o.jsx("div",{className:"v10-promote-result error",children:h.message}),m&&o.jsx(WP,{open:!0,onClose:()=>y(null),assertionName:m.name,subGraphName:m.subGraph,contextGraphId:e})]}):null}function n5({contextGraphId:e,onPublished:t}){const{data:n,loading:a,refresh:s}=lr(()=>Ql(e,"swm"),[e],0);xo(e,s,{layers:["swm"]});const[l,u]=w.useState(new Set),[d,f]=w.useState(!1),[h,g]=w.useState(null),[m,y]=w.useState(null),b=(n==null?void 0:n.map(z=>z.graphUri))??[],k=b.length>0&&b.every(z=>l.has(z)),j=w.useCallback(z=>{u(q=>{const M=new Set(q);return M.has(z)?M.delete(z):M.add(z),M})},[]),N=w.useCallback(()=>{u(k?new Set:new Set(b))},[k,b]),S=w.useCallback(async z=>{if(z.length!==0){f(!0),g(null),y(null);try{g(await Ag(e,z)),u(new Set),s(),t()}catch(q){y((q==null?void 0:q.message)??"Publish failed")}finally{f(!1)}}},[e,s,t]),T=w.useCallback(()=>{const z=(n??[]).filter(q=>l.has(q.graphUri));return S(z)},[n,l,S]),E=w.useCallback(()=>S(n??[]),[n,S]),A=(n==null?void 0:n.reduce((z,q)=>z+(q.tripleCount??0),0))??0,B=(n==null?void 0:n.filter(z=>l.has(z.graphUri)).reduce((z,q)=>z+(q.tripleCount??0),0))??0,_=!a&&(!n||n.length===0);return a?o.jsx("div",{className:"v10-assertion-list-loading",children:"Loading SWM contents..."}):_?o.jsxs("div",{className:"v10-publish-panel",children:[o.jsx("div",{className:"v10-publish-panel-header",children:o.jsx("span",{className:"v10-publish-panel-title",children:"Publish to Verifiable Memory"})}),o.jsx("div",{className:"v10-publish-panel-empty",children:"No data in Shared Working Memory yet. Promote assertions from Working Memory first."})]}):o.jsxs("div",{className:"v10-publish-panel",children:[o.jsxs("div",{className:"v10-publish-panel-header",children:[o.jsxs("span",{className:"v10-publish-panel-title",children:["Knowledge assets in Shared Working Memory (",n.length," asset",n.length===1?"":"s"," · ",A," triples)"]}),o.jsxs("div",{className:"v10-publish-panel-header-actions",children:[o.jsx("button",{className:"v10-publish-panel-refresh",onClick:s,title:"Refresh",children:"↻"}),o.jsx("button",{className:"v10-btn-promote-all",disabled:d,onClick:E,children:d&&l.size===0?"Publishing...":"Publish All → VM"})]})]}),o.jsxs("div",{className:"v10-publish-select-bar",children:[o.jsxs("label",{className:"v10-publish-select-all",children:[o.jsx("input",{type:"checkbox",checked:k,onChange:N}),o.jsx("span",{children:"Select all"})]}),l.size>0&&o.jsx("button",{className:"v10-btn-publish",disabled:d,onClick:T,children:d?"Publishing...":`Publish ${l.size} selected (${B} triples) → VM`})]}),o.jsx("div",{className:"v10-assertion-items",children:n.map(z=>o.jsxs("div",{className:`v10-assertion-item ${l.has(z.graphUri)?"selected":""}`,children:[o.jsx("label",{className:"v10-publish-entity-check",children:o.jsx("input",{type:"checkbox",checked:l.has(z.graphUri),onChange:()=>j(z.graphUri)})}),o.jsxs("div",{className:"v10-assertion-item-info",children:[o.jsx("span",{className:"v10-assertion-item-name",title:z.graphUri,children:z.name}),z.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${z.subGraph}`,children:["› ",nv(z.subGraph,18)]}),z.tripleCount!=null&&o.jsxs("span",{className:"v10-assertion-item-count",children:[z.tripleCount," triples"]})]})]},z.graphUri))}),h&&(()=>{const{published:z,total:q,partial:M,partialError:R,failures:P,sample:F,convictionCostCovered:Z}=h,I=z===q&&z>0&&M===0,$=(F==null?void 0:F.status)==="confirmed"&&!!F.txHash;return o.jsxs("div",{className:`v10-publish-result-card ${I?"success":"error"}`,children:[o.jsx("div",{className:"v10-publish-result-title",children:z>0?`Published ${z} of ${q} knowledge asset${q===1?"":"s"} to Verifiable Memory`:"NOT published to Verifiable Memory"}),M>0&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:["⚠ ",M," asset",M===1?"":"s",": ",Il(R)]}),P.length>0&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:[P.length," asset",P.length===1?"":"s"," could not be published — ",P[0].name,": ",P[0].error,P.length>1?` (+${P.length-1} more)`:""]}),o.jsxs("div",{className:"v10-publish-result-details",children:[(F==null?void 0:F.kaId)!=null&&o.jsxs("div",{children:[o.jsx("span",{className:"v10-publish-result-label",children:"Knowledge Asset:"})," ",F.kaId]}),$?o.jsxs("div",{className:"v10-publish-result-tx",children:[o.jsx("span",{className:"v10-publish-result-label",children:"Tx hash:"})," ",o.jsx("span",{className:"mono",title:F.txHash,children:F.txHash}),F.blockNumber!=null&&o.jsxs("span",{className:"v10-publish-result-block",children:[" (block ",F.blockNumber,")"]})]}):o.jsxs("div",{className:"v10-publish-result-details",children:["Verifiable Memory requires a confirmed ",o.jsx("code",{children:"KCCreated"})," event. If a publish did not land on-chain, check the node logs (typically a missing publisher wallet, an unfunded signer, or a chain adapter that isn't V10-ready)."]}),o.jsx(qS,{convictionCostCovered:Z})]})]})})(),m&&o.jsx("div",{className:"v10-publish-result-card error",children:m})]})}function Ks(e){if(e!=null)return typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function Kh(e){if(!e)return"—";const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),a=Math.max(t,n);return a>=0?e.slice(a+1):e}function r5(e){const t=Number.isFinite(e.limit)&&e.limit>0?Math.floor(e.limit):50,n=e.query.trim();if(!n)return`SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT ${t}`;const a=a5(n.toLowerCase()),s={subject:`CONTAINS(LCASE(STR(?s)), "${a}")`,predicate:`CONTAINS(LCASE(STR(?p)), "${a}")`,object:`CONTAINS(LCASE(STR(?o)), "${a}")`};return`SELECT ?s ?p ?o WHERE { ?s ?p ?o . FILTER(${e.field==="any"?`(${s.subject} || ${s.predicate} || ${s.object})`:s[e.field]}) } LIMIT ${t}`}function a5(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}const bC=[{key:"working",title:"Working Memory",short:"WM",icon:"◇",color:"#64748b",desc:"Private agent drafts",tabPrefix:"wm"},{key:"shared",title:"Shared Working Memory",short:"SWM",icon:"◈",color:"#f59e0b",desc:"Team proposals",tabPrefix:"swm"},{key:"verified",title:"Verifiable Memory",short:"VM",icon:"◉",color:"#22c55e",desc:"On-chain knowledge",tabPrefix:"vm"}],i5=["http://purl.org/dc/terms/created","http://dkg.io/ontology/github/mergedAt","http://dkg.io/ontology/github/closedAt","http://dkg.io/ontology/decisions/date","http://dkg.io/ontology/tasks/dueDate"];function s5(){const{contextGraphs:e}=Ar(),{hidden:t}=Bg(),n=w.useMemo(()=>e.filter(a=>!t.has(a.id)),[e,t]);return o.jsxs("div",{className:"v10-memstack",children:[o.jsxs("div",{className:"v10-memstack-head",children:[o.jsx("h1",{className:"v10-memstack-title",children:"Memory Stack"}),o.jsxs("p",{className:"v10-memstack-sub",children:["Every layer across every context graph, at a glance. ",n.length," visible context graph",n.length===1?"":"s"," · hidden context graphs are skipped."]})]}),n.length===0?o.jsx("div",{className:"v10-memstack-empty",children:"No visible context graphs. Create one from the sidebar or un-hide dismissed ones."}):o.jsxs("div",{className:"v10-memstack-table",children:[o.jsxs("div",{className:"v10-memstack-colheads",children:[o.jsx("div",{className:"v10-memstack-colhead project"}),bC.map(a=>o.jsxs("div",{className:"v10-memstack-colhead",style:{color:a.color},children:[o.jsx("span",{className:"v10-memstack-colhead-icon",children:a.icon}),o.jsx("span",{className:"v10-memstack-colhead-title",children:a.title}),o.jsx("span",{className:"v10-memstack-colhead-desc",children:a.desc})]},a.key))]}),n.map(a=>o.jsx(o5,{cg:a},a.id))]})]})}function o5({cg:e}){const t=Gg(e.id),{openTab:n}=fn(),a=fj(t),s=w.useMemo(()=>{const u={working:{entities:[],tripleCount:a.wm},shared:{entities:[],tripleCount:a.swm},verified:{entities:[],tripleCount:a.vm}};for(const d of t.entityList)u[d.trustLevel].entities.push(d);for(const d of Object.keys(u))u[d].entities.sort((f,h)=>{const g=Gm(f),m=Gm(h);return g&&m?m-g:g?-1:m?1:f.label.localeCompare(h.label)});return u},[t.entityList,a]),l=()=>n({id:`project:${e.id}`,label:e.name||e.id.slice(0,16),closable:!0});return o.jsxs("div",{className:"v10-memstack-row",children:[o.jsxs("div",{className:"v10-memstack-project",children:[o.jsxs("button",{type:"button",className:"v10-memstack-project-btn",onClick:l,children:[o.jsx("span",{className:"v10-memstack-project-dot"}),o.jsx("span",{className:"v10-memstack-project-name",children:e.name||e.id})]}),e.description&&o.jsx("div",{className:"v10-memstack-project-desc",title:e.description,children:e.description}),t.loading&&!t.entityList.length&&o.jsx("div",{className:"v10-memstack-project-status",children:"loading…"}),t.error&&o.jsx("div",{className:"v10-memstack-project-status error",children:t.error})]}),bC.map(u=>{const d=s[u.key];return o.jsx(l5,{cgId:e.id,color:u.color,layerTitle:u.title,tabPrefix:u.tabPrefix,entityCount:d.entities.length,tripleCount:d.tripleCount,recent:d.entities.slice(0,4),onOpenLayer:()=>n({id:`${u.tabPrefix}:${e.id}`,label:`${u.short} · ${e.name||e.id.slice(0,12)}`,closable:!0})},u.key)})]})}function l5({cgId:e,color:t,layerTitle:n,tabPrefix:a,entityCount:s,tripleCount:l,recent:u,onOpenLayer:d}){const f=s===0;return o.jsxs("div",{className:`v10-memstack-cell${f?" empty":""}`,style:{"--cell-color":t},children:[o.jsxs("div",{className:"v10-memstack-cell-stats",children:[o.jsx("span",{className:"v10-memstack-cell-n",children:s}),o.jsxs("span",{className:"v10-memstack-cell-n-lbl",children:["entit",s===1?"y":"ies"]}),o.jsx("span",{className:"v10-memstack-cell-sep",children:"·"}),o.jsx("span",{className:"v10-memstack-cell-t",children:l.toLocaleString()}),o.jsx("span",{className:"v10-memstack-cell-t-lbl",children:"triples"})]}),u.length>0?o.jsx("ul",{className:"v10-memstack-cell-recent",children:u.map(h=>o.jsxs("li",{className:"v10-memstack-cell-recent-item",title:h.label,children:[o.jsx("span",{className:"v10-memstack-cell-recent-bullet"}),o.jsx("span",{className:"v10-memstack-cell-recent-label",children:h.label}),o.jsx("span",{className:"v10-memstack-cell-recent-time",children:bj(c5(h))})]},h.uri))}):o.jsxs("div",{className:"v10-memstack-cell-empty-hint",children:["Nothing in ",a.toUpperCase()," yet"]}),!f&&o.jsxs("button",{type:"button",className:"v10-memstack-cell-open",onClick:d,title:`Open ${n}`,children:["Open ",a.toUpperCase()," →"]})]})}function Gm(e){var t;for(const n of i5){const a=(t=e.properties.get(n))==null?void 0:t[0];if(!a)continue;const s=new Date(a.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"));if(Number.isFinite(s.getTime()))return s.getTime()}return null}function c5(e){const t=Gm(e);return t?new Date(t):null}function u5(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const d5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,p5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,f5={};function _w(e,t){return(f5.jsx?p5:d5).test(e)}const h5=/[ \t\n\f\r]/g;function m5(e){return typeof e=="object"?e.type==="text"?Rw(e.value):!1:Rw(e)}function Rw(e){return e.replace(h5,"")===""}class nc{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}nc.prototype.normal={};nc.prototype.property={};nc.prototype.space=void 0;function xC(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new nc(n,a,t)}function Vm(e){return e.toLowerCase()}class Zn{constructor(t,n){this.attribute=n,this.property=t}}Zn.prototype.attribute="";Zn.prototype.booleanish=!1;Zn.prototype.boolean=!1;Zn.prototype.commaOrSpaceSeparated=!1;Zn.prototype.commaSeparated=!1;Zn.prototype.defined=!1;Zn.prototype.mustUseProperty=!1;Zn.prototype.number=!1;Zn.prototype.overloadedBoolean=!1;Zn.prototype.property="";Zn.prototype.spaceSeparated=!1;Zn.prototype.space=void 0;let g5=0;const Xe=us(),on=us(),Wm=us(),we=us(),Rt=us(),so=us(),sr=us();function us(){return 2**++g5}const Zm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:on,commaOrSpaceSeparated:sr,commaSeparated:so,number:we,overloadedBoolean:Wm,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),Yh=Object.keys(Zm);class mv extends Zn{constructor(t,n,a,s){let l=-1;if(super(t,n),Ow(this,"space",s),typeof a=="number")for(;++l<Yh.length;){const u=Yh[l];Ow(this,Yh[l],(a&Zm[u])===Zm[u])}}}mv.prototype.defined=!0;function Ow(e,t,n){n&&(e[t]=n)}function ko(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const l=new mv(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(l.mustUseProperty=!0),t[a]=l,n[Vm(a)]=a,n[Vm(l.attribute)]=a}return new nc(t,n,e.space)}const wC=ko({properties:{ariaActiveDescendant:null,ariaAtomic:on,ariaAutoComplete:null,ariaBusy:on,ariaChecked:on,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:on,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:on,ariaFlowTo:Rt,ariaGrabbed:on,ariaHasPopup:null,ariaHidden:on,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:we,ariaLive:null,ariaModal:on,ariaMultiLine:on,ariaMultiSelectable:on,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:on,ariaReadOnly:on,ariaRelevant:null,ariaRequired:on,ariaRoleDescription:Rt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:on,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function kC(e,t){return t in e?e[t]:t}function SC(e,t){return kC(e,t.toLowerCase())}const v5=ko({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:so,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:Xe,allowPaymentRequest:Xe,allowUserMedia:Xe,alt:null,as:null,async:Xe,autoCapitalize:null,autoComplete:Rt,autoFocus:Xe,autoPlay:Xe,blocking:Rt,capture:null,charSet:null,checked:Xe,cite:null,className:Rt,cols:we,colSpan:null,content:null,contentEditable:on,controls:Xe,controlsList:Rt,coords:we|so,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:Wm,draggable:on,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:Rt,height:we,hidden:Wm,high:we,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:Xe,inputMode:null,integrity:null,is:null,isMap:Xe,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:Xe,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xe,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Xe,muted:Xe,name:null,nonce:null,noModule:Xe,noValidate:Xe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Xe,optimum:we,pattern:null,ping:Rt,placeholder:null,playsInline:Xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xe,referrerPolicy:null,rel:Rt,required:Xe,reversed:Xe,rows:we,rowSpan:we,sandbox:Rt,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:on,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:on,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xe,declare:Xe,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:on,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Xe,disableRemotePlayback:Xe,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:SC}),y5=ko({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:sr,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:Rt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:so,g2:so,glyphName:so,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:sr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:we,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sr,rev:sr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sr,requiredFeatures:sr,requiredFonts:sr,requiredFormats:sr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:sr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sr,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:kC}),jC=ko({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),CC=ko({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:SC}),NC=ko({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),b5={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},x5=/[A-Z]/g,Lw=/-[a-z]/g,w5=/^data[-\w.:]+$/i;function k5(e,t){const n=Vm(t);let a=t,s=Zn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&w5.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Lw,j5);a="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Lw.test(l)){let u=l.replace(x5,S5);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}s=mv}return new s(a,t)}function S5(e){return"-"+e.toLowerCase()}function j5(e){return e.charAt(1).toUpperCase()}const C5=xC([wC,v5,jC,CC,NC],"html"),gv=xC([wC,y5,jC,CC,NC],"svg");function N5(e){return e.join(" ").trim()}var Ys={},Qh,Mw;function E5(){if(Mw)return Qh;Mw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
1625
+ `,h="/",g="*",m="",y="comment",b="declaration";function k(N,S){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];S=S||{};var T=1,E=1;function A(I){var $=I.match(t);$&&(T+=$.length);var H=I.lastIndexOf(f);E=~H?I.length-H:E+I.length}function B(){var I={line:T,column:E};return function($){return $.position=new _(I),M(),$}}function _(I){this.start=I,this.end={line:T,column:E},this.source=S.source}_.prototype.content=N;function z(I){var $=new Error(S.source+":"+T+":"+E+": "+I);if($.reason=I,$.filename=S.source,$.line=T,$.column=E,$.source=N,!S.silent)throw $}function q(I){var $=I.exec(N);if($){var H=$[0];return A(H),N=N.slice(H.length),$}}function M(){q(n)}function R(I){var $;for(I=I||[];$=P();)$!==!1&&I.push($);return I}function P(){var I=B();if(!(h!=N.charAt(0)||g!=N.charAt(1))){for(var $=2;m!=N.charAt($)&&(g!=N.charAt($)||h!=N.charAt($+1));)++$;if($+=2,m===N.charAt($-1))return z("End of comment missing");var H=N.slice(2,$-2);return E+=2,A(H),N=N.slice($),E+=2,I({type:y,comment:H})}}function F(){var I=B(),$=q(a);if($){if(P(),!q(s))return z("property missing ':'");var H=q(l),V=I({type:b,property:j($[0].replace(e,m)),value:H?j(H[0].replace(e,m)):m});return q(u),V}}function Z(){var I=[];R(I);for(var $;$=F();)$!==!1&&(I.push($),R(I));return I}return M(),Z()}function j(N){return N?N.replace(d,m):m}return Qh=k,Qh}var Dw;function T5(){if(Dw)return Ys;Dw=1;var e=Ys&&Ys.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.default=n;const t=e(E5());function n(a,s){let l=null;if(!a||typeof a!="string")return l;const u=(0,t.default)(a),d=typeof s=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:h,value:g}=f;d?s(h,g,f):g&&(l=l||{},l[h]=g)}),l}return Ys}var wl={},zw;function A5(){if(zw)return wl;zw=1,Object.defineProperty(wl,"__esModule",{value:!0}),wl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,l=function(h){return!h||n.test(h)||e.test(h)},u=function(h,g){return g.toUpperCase()},d=function(h,g){return"".concat(g,"-")},f=function(h,g){return g===void 0&&(g={}),l(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(s,d):h=h.replace(a,d),h.replace(t,u))};return wl.camelCase=f,wl}var kl,$w;function _5(){if($w)return kl;$w=1;var e=kl&&kl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(T5()),n=A5();function a(s,l){var u={};return!s||typeof s!="string"||(0,t.default)(s,function(d,f){d&&f&&(u[(0,n.camelCase)(d,l)]=f)}),u}return a.default=a,kl=a,kl}var R5=_5();const O5=Wl(R5),EC=TC("end"),vv=TC("start");function TC(e){return t;function t(n){const a=n&&n.position&&n.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function L5(e){const t=vv(e),n=EC(e);if(t&&n)return{start:t,end:n}}function Ml(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Iw(e.position):"start"in e||"end"in e?Iw(e):"line"in e||"column"in e?Km(e):""}function Km(e){return Pw(e&&e.line)+":"+Pw(e&&e.column)}function Iw(e){return Km(e&&e.start)+"-"+Km(e&&e.end)}function Pw(e){return e&&typeof e=="number"?e:1}class _n extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",l={},u=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?s=t:!l.cause&&t&&(u=!0,s=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof a=="string"){const f=a.indexOf(":");f===-1?l.ruleId=a:(l.source=a.slice(0,f),l.ruleId=a.slice(f+1))}if(!l.place&&l.ancestors&&l.ancestors){const f=l.ancestors[l.ancestors.length-1];f&&(l.place=f.position)}const d=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=d?d.line:void 0,this.name=Ml(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=u&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}_n.prototype.file="";_n.prototype.name="";_n.prototype.reason="";_n.prototype.message="";_n.prototype.stack="";_n.prototype.column=void 0;_n.prototype.line=void 0;_n.prototype.ancestors=void 0;_n.prototype.cause=void 0;_n.prototype.fatal=void 0;_n.prototype.place=void 0;_n.prototype.ruleId=void 0;_n.prototype.source=void 0;const yv={}.hasOwnProperty,M5=new Map,D5=/[A-Z]/g,z5=new Set(["table","tbody","thead","tfoot","tr"]),$5=new Set(["td","th"]),AC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function I5(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=V5(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=G5(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?gv:C5,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=_C(s,e,void 0);return l&&typeof l!="string"?l:s.create(e,s.Fragment,{children:l||void 0},void 0)}function _C(e,t,n){if(t.type==="element")return P5(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return U5(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return F5(e,t,n);if(t.type==="mdxjsEsm")return B5(e,t);if(t.type==="root")return H5(e,t,n);if(t.type==="text")return q5(e,t)}function P5(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=gv,e.schema=s),e.ancestors.push(t);const l=OC(e,t.tagName,!1),u=W5(e,t);let d=xv(e,t);return z5.has(t.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!m5(f):!0})),RC(e,u,l,t),bv(u,d),e.ancestors.pop(),e.schema=a,e.create(t,l,u,n)}function U5(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}ql(e,t.position)}function B5(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ql(e,t.position)}function F5(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=gv,e.schema=s),e.ancestors.push(t);const l=t.name===null?e.Fragment:OC(e,t.name,!0),u=Z5(e,t),d=xv(e,t);return RC(e,u,l,t),bv(u,d),e.ancestors.pop(),e.schema=a,e.create(t,l,u,n)}function H5(e,t,n){const a={};return bv(a,xv(e,t)),e.create(t,e.Fragment,a,n)}function q5(e,t){return t.value}function RC(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function bv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function G5(e,t,n){return a;function a(s,l,u,d){const h=Array.isArray(u.children)?n:t;return d?h(l,u,d):h(l,u)}}function V5(e,t){return n;function n(a,s,l,u){const d=Array.isArray(l.children),f=vv(a);return t(s,l,u,d,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function W5(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&yv.call(t.properties,s)){const l=K5(e,s,t.properties[s]);if(l){const[u,d]=l;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&$5.has(t.tagName)?a=d:n[u]=d}}if(a){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function Z5(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const l=a.data.estree.body[0];l.type;const u=l.expression;u.type;const d=u.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else ql(e,t.position);else{const s=a.name;let l;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const d=a.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else ql(e,t.position);else l=a.value===null?!0:a.value;n[s]=l}return n}function xv(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:M5;for(;++a<t.children.length;){const l=t.children[a];let u;if(e.passKeys){const f=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(f){const h=s.get(f)||0;u=f+"-"+h,s.set(f,h+1)}}const d=_C(e,l,u);d!==void 0&&n.push(d)}return n}function K5(e,t,n){const a=k5(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?u5(n):N5(n)),a.property==="style"){let s=typeof n=="object"?n:Y5(e,String(n));return e.stylePropertyNameCase==="css"&&(s=Q5(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?b5[a.property]||a.property:a.attribute,n]}}function Y5(e,t){try{return O5(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new _n("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=AC+"#cannot-parse-style-attribute",s}}function OC(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let l=-1,u;for(;++l<s.length;){const d=_w(s[l])?{type:"Identifier",name:s[l]}:{type:"Literal",value:s[l]};u=u?{type:"MemberExpression",object:u,property:d,computed:!!(l&&d.type==="Literal"),optional:!1}:d}a=u}else a=_w(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return yv.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);ql(e)}function ql(e,t){const n=new _n("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=AC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Q5(e){const t={};let n;for(n in e)yv.call(e,n)&&(t[X5(n)]=e[n]);return t}function X5(e){let t=e.replace(D5,J5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function J5(e){return"-"+e.toLowerCase()}const Xh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},eU={};function wv(e,t){const n=eU,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return LC(e,a,s)}function LC(e,t,n){if(tU(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Uw(e.children,t,n)}return Array.isArray(e)?Uw(e,t,n):""}function Uw(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=LC(e[s],t,n);return a.join("")}function tU(e){return!!(e&&typeof e=="object")}const Bw=document.createElement("i");function kv(e){const t="&"+e+";";Bw.innerHTML=t;const n=Bw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function cr(e,t,n,a){const s=e.length;let l=0,u;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,a.length<1e4)u=Array.from(a),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);l<a.length;)u=a.slice(l,l+1e4),u.unshift(t,0),e.splice(...u),l+=1e4,t+=1e4}function Tr(e,t){return e.length>0?(cr(e,e.length,0,t),e):t}const Fw={}.hasOwnProperty;function MC(e){const t={};let n=-1;for(;++n<e.length;)nU(t,e[n]);return t}function nU(e,t){let n;for(n in t){const s=(Fw.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let u;if(l)for(u in l){Fw.call(s,u)||(s[u]=[]);const d=l[u];rU(s[u],Array.isArray(d)?d:d?[d]:[])}}}function rU(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);cr(e,0,0,a)}function DC(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ur(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Dn=ji(/[A-Za-z]/),Tn=ji(/[\dA-Za-z]/),aU=ji(/[#-'*+\--9=?A-Z^-~]/);function wd(e){return e!==null&&(e<32||e===127)}const Ym=ji(/\d/),iU=ji(/[\dA-Fa-f]/),sU=ji(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function At(e){return e!==null&&(e<0||e===32)}function it(e){return e===-2||e===-1||e===32}const Wd=ji(new RegExp("\\p{P}|\\p{S}","u")),rs=ji(/\s/);function ji(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function So(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const l=e.charCodeAt(n);let u="";if(l===37&&Tn(e.charCodeAt(n+1))&&Tn(e.charCodeAt(n+2)))s=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(u=String.fromCharCode(l));else if(l>55295&&l<57344){const d=e.charCodeAt(n+1);l<56320&&d>56319&&d<57344?(u=String.fromCharCode(l,d),s=1):u="�"}else u=String.fromCharCode(l);u&&(t.push(e.slice(a,n),encodeURIComponent(u)),a=n+s+1,u=""),s&&(n+=s,s=0)}return t.join("")+e.slice(a)}function dt(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let l=0;return u;function u(f){return it(f)?(e.enter(n),d(f)):t(f)}function d(f){return it(f)&&l++<s?(e.consume(f),d):(e.exit(n),t(f))}}const oU={tokenize:lU};function lU(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let n;return t;function a(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),dt(e,t,"linePrefix")}function s(d){return e.enter("paragraph"),l(d)}function l(d){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,u(d)}function u(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Pe(d)?(e.consume(d),e.exit("chunkText"),l):(e.consume(d),u)}}const cU={tokenize:uU},Hw={tokenize:dU};function uU(e){const t=this,n=[];let a=0,s,l,u;return d;function d(E){if(a<n.length){const A=n[a];return t.containerState=A[1],e.attempt(A[0].continuation,f,h)(E)}return h(E)}function f(E){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&T();const A=t.events.length;let B=A,_;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){_=t.events[B][1].end;break}S(a);let z=A;for(;z<t.events.length;)t.events[z][1].end={..._},z++;return cr(t.events,B+1,0,t.events.slice(A)),t.events.length=z,h(E)}return d(E)}function h(E){if(a===n.length){if(!s)return y(E);if(s.currentConstruct&&s.currentConstruct.concrete)return k(E);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Hw,g,m)(E)}function g(E){return s&&T(),S(a),y(E)}function m(E){return t.parser.lazy[t.now().line]=a!==n.length,u=t.now().offset,k(E)}function y(E){return t.containerState={},e.attempt(Hw,b,k)(E)}function b(E){return a++,n.push([t.currentConstruct,t.containerState]),y(E)}function k(E){if(E===null){s&&T(),S(0),e.consume(E);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:l}),j(E)}function j(E){if(E===null){N(e.exit("chunkFlow"),!0),S(0),e.consume(E);return}return Pe(E)?(e.consume(E),N(e.exit("chunkFlow")),a=0,t.interrupt=void 0,d):(e.consume(E),j)}function N(E,A){const B=t.sliceStream(E);if(A&&B.push(null),E.previous=l,l&&(l.next=E),l=E,s.defineSkip(E.start),s.write(B),t.parser.lazy[E.start.line]){let _=s.events.length;for(;_--;)if(s.events[_][1].start.offset<u&&(!s.events[_][1].end||s.events[_][1].end.offset>u))return;const z=t.events.length;let q=z,M,R;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if(M){R=t.events[q][1].end;break}M=!0}for(S(a),_=z;_<t.events.length;)t.events[_][1].end={...R},_++;cr(t.events,q+1,0,t.events.slice(z)),t.events.length=_}}function S(E){let A=n.length;for(;A-- >E;){const B=n[A];t.containerState=B[1],B[0].exit.call(t,e)}n.length=E}function T(){s.write([null]),l=void 0,s=void 0,t.containerState._closeFlow=void 0}}function dU(e,t,n){return dt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ho(e){if(e===null||At(e)||rs(e))return 1;if(Wd(e))return 2}function Zd(e,t,n){const a=[];let s=-1;for(;++s<e.length;){const l=e[s].resolveAll;l&&!a.includes(l)&&(t=l(t,n),a.push(l))}return t}const Qm={name:"attention",resolveAll:pU,tokenize:fU};function pU(e,t){let n=-1,a,s,l,u,d,f,h,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[a][1].end},y={...e[n][1].start};qw(m,-f),qw(y,f),u={type:f>1?"strongSequence":"emphasisSequence",start:m,end:{...e[a][1].end}},d={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},l={type:f>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},s={type:f>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[a][1].end={...u.start},e[n][1].start={...d.end},h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=Tr(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=Tr(h,[["enter",s,t],["enter",u,t],["exit",u,t],["enter",l,t]]),h=Tr(h,Zd(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=Tr(h,[["exit",l,t],["enter",d,t],["exit",d,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=Tr(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,cr(e,a-1,n-a+3,h),n=a+h.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function fU(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=ho(a);let l;return u;function u(f){return l=f,e.enter("attentionSequence"),d(f)}function d(f){if(f===l)return e.consume(f),d;const h=e.exit("attentionSequence"),g=ho(f),m=!g||g===2&&s||n.includes(f),y=!s||s===2&&g||n.includes(a);return h._open=!!(l===42?m:m&&(s||!y)),h._close=!!(l===42?y:y&&(g||!m)),t(f)}}function qw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const hU={name:"autolink",tokenize:mU};function mU(e,t,n){let a=0;return s;function s(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(b){return Dn(b)?(e.consume(b),u):b===64?n(b):h(b)}function u(b){return b===43||b===45||b===46||Tn(b)?(a=1,d(b)):h(b)}function d(b){return b===58?(e.consume(b),a=0,f):(b===43||b===45||b===46||Tn(b))&&a++<32?(e.consume(b),d):(a=0,h(b))}function f(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||wd(b)?n(b):(e.consume(b),f)}function h(b){return b===64?(e.consume(b),g):aU(b)?(e.consume(b),h):n(b)}function g(b){return Tn(b)?m(b):n(b)}function m(b){return b===46?(e.consume(b),a=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||Tn(b))&&a++<63){const k=b===45?y:m;return e.consume(b),k}return n(b)}}const rc={partial:!0,tokenize:gU};function gU(e,t,n){return a;function a(l){return it(l)?dt(e,s,"linePrefix")(l):s(l)}function s(l){return l===null||Pe(l)?t(l):n(l)}}const zC={continuation:{tokenize:yU},exit:bU,name:"blockQuote",tokenize:vU};function vU(e,t,n){const a=this;return s;function s(u){if(u===62){const d=a.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),l}return n(u)}function l(u){return it(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function yU(e,t,n){const a=this;return s;function s(u){return it(u)?dt(e,l,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):l(u)}function l(u){return e.attempt(zC,t,n)(u)}}function bU(e){e.exit("blockQuote")}const $C={name:"characterEscape",tokenize:xU};function xU(e,t,n){return a;function a(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),s}function s(l){return sU(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const IC={name:"characterReference",tokenize:wU};function wU(e,t,n){const a=this;let s=0,l,u;return d;function d(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),f}function f(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),l=31,u=Tn,g(m))}function h(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,u=iU,g):(e.enter("characterReferenceValue"),l=7,u=Ym,g(m))}function g(m){if(m===59&&s){const y=e.exit("characterReferenceValue");return u===Tn&&!kv(a.sliceSerialize(y))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(m)&&s++<l?(e.consume(m),g):n(m)}}const Gw={partial:!0,tokenize:SU},Vw={concrete:!0,name:"codeFenced",tokenize:kU};function kU(e,t,n){const a=this,s={partial:!0,tokenize:B};let l=0,u=0,d;return f;function f(_){return h(_)}function h(_){const z=a.events[a.events.length-1];return l=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,d=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(_)}function g(_){return _===d?(u++,e.consume(_),g):u<3?n(_):(e.exit("codeFencedFenceSequence"),it(_)?dt(e,m,"whitespace")(_):m(_))}function m(_){return _===null||Pe(_)?(e.exit("codeFencedFence"),a.interrupt?t(_):e.check(Gw,j,A)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(_))}function y(_){return _===null||Pe(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(_)):it(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),dt(e,b,"whitespace")(_)):_===96&&_===d?n(_):(e.consume(_),y)}function b(_){return _===null||Pe(_)?m(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(_))}function k(_){return _===null||Pe(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(_)):_===96&&_===d?n(_):(e.consume(_),k)}function j(_){return e.attempt(s,A,N)(_)}function N(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),S}function S(_){return l>0&&it(_)?dt(e,T,"linePrefix",l+1)(_):T(_)}function T(_){return _===null||Pe(_)?e.check(Gw,j,A)(_):(e.enter("codeFlowValue"),E(_))}function E(_){return _===null||Pe(_)?(e.exit("codeFlowValue"),T(_)):(e.consume(_),E)}function A(_){return e.exit("codeFenced"),t(_)}function B(_,z,q){let M=0;return R;function R($){return _.enter("lineEnding"),_.consume($),_.exit("lineEnding"),P}function P($){return _.enter("codeFencedFence"),it($)?dt(_,F,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):F($)}function F($){return $===d?(_.enter("codeFencedFenceSequence"),Z($)):q($)}function Z($){return $===d?(M++,_.consume($),Z):M>=u?(_.exit("codeFencedFenceSequence"),it($)?dt(_,I,"whitespace")($):I($)):q($)}function I($){return $===null||Pe($)?(_.exit("codeFencedFence"),z($)):q($)}}}function SU(e,t,n){const a=this;return s;function s(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l)}function l(u){return a.parser.lazy[a.now().line]?n(u):t(u)}}const Jh={name:"codeIndented",tokenize:CU},jU={partial:!0,tokenize:NU};function CU(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),dt(e,l,"linePrefix",5)(h)}function l(h){const g=a.events[a.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?u(h):n(h)}function u(h){return h===null?f(h):Pe(h)?e.attempt(jU,u,f)(h):(e.enter("codeFlowValue"),d(h))}function d(h){return h===null||Pe(h)?(e.exit("codeFlowValue"),u(h)):(e.consume(h),d)}function f(h){return e.exit("codeIndented"),t(h)}}function NU(e,t,n){const a=this;return s;function s(u){return a.parser.lazy[a.now().line]?n(u):Pe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):dt(e,l,"linePrefix",5)(u)}function l(u){const d=a.events[a.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):Pe(u)?s(u):n(u)}}const EU={name:"codeText",previous:AU,resolve:TU,tokenize:_U};function TU(e){let t=e.length-4,n=3,a,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a<t;)if(e[a][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(a=n-1,t++;++a<=t;)s===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(s=a):(a===t||e[a][1].type==="lineEnding")&&(e[s][1].type="codeTextData",a!==s+2&&(e[s][1].end=e[a-1][1].end,e.splice(s+2,a-s-2),t-=a-s-2,a=s+2),s=void 0);return e}function AU(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _U(e,t,n){let a=0,s,l;return u;function u(m){return e.enter("codeText"),e.enter("codeTextSequence"),d(m)}function d(m){return m===96?(e.consume(m),a++,d):(e.exit("codeTextSequence"),f(m))}function f(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),f):m===96?(l=e.enter("codeTextSequence"),s=0,g(m)):Pe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):(e.enter("codeTextData"),h(m))}function h(m){return m===null||m===32||m===96||Pe(m)?(e.exit("codeTextData"),f(m)):(e.consume(m),h)}function g(m){return m===96?(e.consume(m),s++,g):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(l.type="codeTextData",h(m))}}class RU{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const a=n??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const s=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return a&&Sl(this.left,a),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Sl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Sl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Sl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Sl(this.left,n.reverse())}}}function Sl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function PC(e){const t={};let n=-1,a,s,l,u,d,f,h;const g=new RU(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(a=g.get(n),n&&a[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(f=a[1]._tokenizer.events,l=0,l<f.length&&f[l][1].type==="lineEndingBlank"&&(l+=2),l<f.length&&f[l][1].type==="content"))for(;++l<f.length&&f[l][1].type!=="content";)f[l][1].type==="chunkText"&&(f[l][1]._isInFirstContentOfListItem=!0,l++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,OU(g,n)),n=t[n],h=!0);else if(a[1]._container){for(l=n,s=void 0;l--;)if(u=g.get(l),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),u[1].type="lineEnding",s=l);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;s&&(a[1].end={...g.get(s)[1].start},d=g.slice(s,n),d.unshift(a),g.splice(s,n-s+1,d))}}return cr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function OU(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const l=[];let u=n._tokenizer;u||(u=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const d=u.events,f=[],h={};let g,m,y=-1,b=n,k=0,j=0;const N=[j];for(;b;){for(;e.get(++s)[1]!==b;);l.push(s),b._tokenizer||(g=a.sliceStream(b),b.next||g.push(null),m&&u.defineSkip(b.start),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++y<d.length;)d[y][0]==="exit"&&d[y-1][0]==="enter"&&d[y][1].type===d[y-1][1].type&&d[y][1].start.line!==d[y][1].end.line&&(j=y+1,N.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(u.events=[],b?(b._tokenizer=void 0,b.previous=void 0):N.pop(),y=N.length;y--;){const S=d.slice(N[y],N[y+1]),T=l.pop();f.push([T,T+S.length-1]),e.splice(T,2,S)}for(f.reverse(),y=-1;++y<f.length;)h[k+f[y][0]]=k+f[y][1],k+=f[y][1]-f[y][0]-1;return h}const LU={resolve:DU,tokenize:zU},MU={partial:!0,tokenize:$U};function DU(e){return PC(e),e}function zU(e,t){let n;return a;function a(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(d)}function s(d){return d===null?l(d):Pe(d)?e.check(MU,u,l)(d):(e.consume(d),s)}function l(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function u(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function $U(e,t,n){const a=this;return s;function s(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),dt(e,l,"linePrefix")}function l(u){if(u===null||Pe(u))return n(u);const d=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):e.interrupt(a.parser.constructs.flow,n,t)(u)}}function UC(e,t,n,a,s,l,u,d,f){const h=f||Number.POSITIVE_INFINITY;let g=0;return m;function m(S){return S===60?(e.enter(a),e.enter(s),e.enter(l),e.consume(S),e.exit(l),y):S===null||S===32||S===41||wd(S)?n(S):(e.enter(a),e.enter(u),e.enter(d),e.enter("chunkString",{contentType:"string"}),j(S))}function y(S){return S===62?(e.enter(l),e.consume(S),e.exit(l),e.exit(s),e.exit(a),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(S))}function b(S){return S===62?(e.exit("chunkString"),e.exit(d),y(S)):S===null||S===60||Pe(S)?n(S):(e.consume(S),S===92?k:b)}function k(S){return S===60||S===62||S===92?(e.consume(S),b):b(S)}function j(S){return!g&&(S===null||S===41||At(S))?(e.exit("chunkString"),e.exit(d),e.exit(u),e.exit(a),t(S)):g<h&&S===40?(e.consume(S),g++,j):S===41?(e.consume(S),g--,j):S===null||S===32||S===40||wd(S)?n(S):(e.consume(S),S===92?N:j)}function N(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function BC(e,t,n,a,s,l){const u=this;let d=0,f;return h;function h(b){return e.enter(a),e.enter(s),e.consume(b),e.exit(s),e.enter(l),g}function g(b){return d>999||b===null||b===91||b===93&&!f||b===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?n(b):b===93?(e.exit(l),e.enter(s),e.consume(b),e.exit(s),e.exit(a),t):Pe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||Pe(b)||d++>999?(e.exit("chunkString"),g(b)):(e.consume(b),f||(f=!it(b)),b===92?y:m)}function y(b){return b===91||b===92||b===93?(e.consume(b),d++,m):m(b)}}function FC(e,t,n,a,s,l){let u;return d;function d(y){return y===34||y===39||y===40?(e.enter(a),e.enter(s),e.consume(y),e.exit(s),u=y===40?41:y,f):n(y)}function f(y){return y===u?(e.enter(s),e.consume(y),e.exit(s),e.exit(a),t):(e.enter(l),h(y))}function h(y){return y===u?(e.exit(l),f(u)):y===null?n(y):Pe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),dt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===u||y===null||Pe(y)?(e.exit("chunkString"),h(y)):(e.consume(y),y===92?m:g)}function m(y){return y===u||y===92?(e.consume(y),g):g(y)}}function Dl(e,t){let n;return a;function a(s){return Pe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):it(s)?dt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const IU={name:"definition",tokenize:UU},PU={partial:!0,tokenize:BU};function UU(e,t,n){const a=this;let s;return l;function l(b){return e.enter("definition"),u(b)}function u(b){return BC.call(a,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return s=Ur(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),f):n(b)}function f(b){return At(b)?Dl(e,h)(b):h(b)}function h(b){return UC(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(PU,m,m)(b)}function m(b){return it(b)?dt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||Pe(b)?(e.exit("definition"),a.parser.defined.push(s),t(b)):n(b)}}function BU(e,t,n){return a;function a(d){return At(d)?Dl(e,s)(d):n(d)}function s(d){return FC(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function l(d){return it(d)?dt(e,u,"whitespace")(d):u(d)}function u(d){return d===null||Pe(d)?t(d):n(d)}}const FU={name:"hardBreakEscape",tokenize:HU};function HU(e,t,n){return a;function a(l){return e.enter("hardBreakEscape"),e.consume(l),s}function s(l){return Pe(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const qU={name:"headingAtx",resolve:GU,tokenize:VU};function GU(e,t){let n=e.length-2,a=3,s,l;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(s={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},l={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},cr(e,a,n-a+1,[["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t]])),e}function VU(e,t,n){let a=0;return s;function s(g){return e.enter("atxHeading"),l(g)}function l(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&a++<6?(e.consume(g),u):g===null||At(g)?(e.exit("atxHeadingSequence"),d(g)):n(g)}function d(g){return g===35?(e.enter("atxHeadingSequence"),f(g)):g===null||Pe(g)?(e.exit("atxHeading"),t(g)):it(g)?dt(e,d,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function f(g){return g===35?(e.consume(g),f):(e.exit("atxHeadingSequence"),d(g))}function h(g){return g===null||g===35||At(g)?(e.exit("atxHeadingText"),d(g)):(e.consume(g),h)}}const WU=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ww=["pre","script","style","textarea"],ZU={concrete:!0,name:"htmlFlow",resolveTo:QU,tokenize:XU},KU={partial:!0,tokenize:e8},YU={partial:!0,tokenize:JU};function QU(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function XU(e,t,n){const a=this;let s,l,u,d,f;return h;function h(O){return g(O)}function g(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),m}function m(O){return O===33?(e.consume(O),y):O===47?(e.consume(O),l=!0,j):O===63?(e.consume(O),s=3,a.interrupt?t:L):Dn(O)?(e.consume(O),u=String.fromCharCode(O),N):n(O)}function y(O){return O===45?(e.consume(O),s=2,b):O===91?(e.consume(O),s=5,d=0,k):Dn(O)?(e.consume(O),s=4,a.interrupt?t:L):n(O)}function b(O){return O===45?(e.consume(O),a.interrupt?t:L):n(O)}function k(O){const ne="CDATA[";return O===ne.charCodeAt(d++)?(e.consume(O),d===ne.length?a.interrupt?t:F:k):n(O)}function j(O){return Dn(O)?(e.consume(O),u=String.fromCharCode(O),N):n(O)}function N(O){if(O===null||O===47||O===62||At(O)){const ne=O===47,ue=u.toLowerCase();return!ne&&!l&&Ww.includes(ue)?(s=1,a.interrupt?t(O):F(O)):WU.includes(u.toLowerCase())?(s=6,ne?(e.consume(O),S):a.interrupt?t(O):F(O)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(O):l?T(O):E(O))}return O===45||Tn(O)?(e.consume(O),u+=String.fromCharCode(O),N):n(O)}function S(O){return O===62?(e.consume(O),a.interrupt?t:F):n(O)}function T(O){return it(O)?(e.consume(O),T):R(O)}function E(O){return O===47?(e.consume(O),R):O===58||O===95||Dn(O)?(e.consume(O),A):it(O)?(e.consume(O),E):R(O)}function A(O){return O===45||O===46||O===58||O===95||Tn(O)?(e.consume(O),A):B(O)}function B(O){return O===61?(e.consume(O),_):it(O)?(e.consume(O),B):E(O)}function _(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),f=O,z):it(O)?(e.consume(O),_):q(O)}function z(O){return O===f?(e.consume(O),f=null,M):O===null||Pe(O)?n(O):(e.consume(O),z)}function q(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||At(O)?B(O):(e.consume(O),q)}function M(O){return O===47||O===62||it(O)?E(O):n(O)}function R(O){return O===62?(e.consume(O),P):n(O)}function P(O){return O===null||Pe(O)?F(O):it(O)?(e.consume(O),P):n(O)}function F(O){return O===45&&s===2?(e.consume(O),H):O===60&&s===1?(e.consume(O),V):O===62&&s===4?(e.consume(O),U):O===63&&s===3?(e.consume(O),L):O===93&&s===5?(e.consume(O),Y):Pe(O)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(KU,G,Z)(O)):O===null||Pe(O)?(e.exit("htmlFlowData"),Z(O)):(e.consume(O),F)}function Z(O){return e.check(YU,I,G)(O)}function I(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),$}function $(O){return O===null||Pe(O)?Z(O):(e.enter("htmlFlowData"),F(O))}function H(O){return O===45?(e.consume(O),L):F(O)}function V(O){return O===47?(e.consume(O),u="",X):F(O)}function X(O){if(O===62){const ne=u.toLowerCase();return Ww.includes(ne)?(e.consume(O),U):F(O)}return Dn(O)&&u.length<8?(e.consume(O),u+=String.fromCharCode(O),X):F(O)}function Y(O){return O===93?(e.consume(O),L):F(O)}function L(O){return O===62?(e.consume(O),U):O===45&&s===2?(e.consume(O),L):F(O)}function U(O){return O===null||Pe(O)?(e.exit("htmlFlowData"),G(O)):(e.consume(O),U)}function G(O){return e.exit("htmlFlow"),t(O)}}function JU(e,t,n){const a=this;return s;function s(u){return Pe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):n(u)}function l(u){return a.parser.lazy[a.now().line]?n(u):t(u)}}function e8(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(rc,t,n)}}const t8={name:"htmlText",tokenize:n8};function n8(e,t,n){const a=this;let s,l,u;return d;function d(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),f}function f(L){return L===33?(e.consume(L),h):L===47?(e.consume(L),B):L===63?(e.consume(L),E):Dn(L)?(e.consume(L),q):n(L)}function h(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),l=0,k):Dn(L)?(e.consume(L),T):n(L)}function g(L){return L===45?(e.consume(L),b):n(L)}function m(L){return L===null?n(L):L===45?(e.consume(L),y):Pe(L)?(u=m,V(L)):(e.consume(L),m)}function y(L){return L===45?(e.consume(L),b):m(L)}function b(L){return L===62?H(L):L===45?y(L):m(L)}function k(L){const U="CDATA[";return L===U.charCodeAt(l++)?(e.consume(L),l===U.length?j:k):n(L)}function j(L){return L===null?n(L):L===93?(e.consume(L),N):Pe(L)?(u=j,V(L)):(e.consume(L),j)}function N(L){return L===93?(e.consume(L),S):j(L)}function S(L){return L===62?H(L):L===93?(e.consume(L),S):j(L)}function T(L){return L===null||L===62?H(L):Pe(L)?(u=T,V(L)):(e.consume(L),T)}function E(L){return L===null?n(L):L===63?(e.consume(L),A):Pe(L)?(u=E,V(L)):(e.consume(L),E)}function A(L){return L===62?H(L):E(L)}function B(L){return Dn(L)?(e.consume(L),_):n(L)}function _(L){return L===45||Tn(L)?(e.consume(L),_):z(L)}function z(L){return Pe(L)?(u=z,V(L)):it(L)?(e.consume(L),z):H(L)}function q(L){return L===45||Tn(L)?(e.consume(L),q):L===47||L===62||At(L)?M(L):n(L)}function M(L){return L===47?(e.consume(L),H):L===58||L===95||Dn(L)?(e.consume(L),R):Pe(L)?(u=M,V(L)):it(L)?(e.consume(L),M):H(L)}function R(L){return L===45||L===46||L===58||L===95||Tn(L)?(e.consume(L),R):P(L)}function P(L){return L===61?(e.consume(L),F):Pe(L)?(u=P,V(L)):it(L)?(e.consume(L),P):M(L)}function F(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),s=L,Z):Pe(L)?(u=F,V(L)):it(L)?(e.consume(L),F):(e.consume(L),I)}function Z(L){return L===s?(e.consume(L),s=void 0,$):L===null?n(L):Pe(L)?(u=Z,V(L)):(e.consume(L),Z)}function I(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||At(L)?M(L):(e.consume(L),I)}function $(L){return L===47||L===62||At(L)?M(L):n(L)}function H(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function V(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),X}function X(L){return it(L)?dt(e,Y,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):Y(L)}function Y(L){return e.enter("htmlTextData"),u(L)}}const Sv={name:"labelEnd",resolveAll:s8,resolveTo:o8,tokenize:l8},r8={tokenize:c8},a8={tokenize:u8},i8={tokenize:d8};function s8(e){let t=-1;const n=[];for(;++t<e.length;){const a=e[t][1];if(n.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const s=a.type==="labelImage"?4:2;a.type="data",t+=s}}return e.length!==n.length&&cr(e,0,e.length,n),e}function o8(e,t){let n=e.length,a=0,s,l,u,d;for(;n--;)if(s=e[n][1],l){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(l=n,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(u=n);const f={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[l][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[l+a+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",f,t],["enter",h,t]],d=Tr(d,e.slice(l+1,l+a+3)),d=Tr(d,[["enter",g,t]]),d=Tr(d,Zd(t.parser.constructs.insideSpan.null,e.slice(l+a+4,u-3),t)),d=Tr(d,[["exit",g,t],e[u-2],e[u-1],["exit",h,t]]),d=Tr(d,e.slice(u+1)),d=Tr(d,[["exit",f,t]]),cr(e,l,e.length,d),e}function l8(e,t,n){const a=this;let s=a.events.length,l,u;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){l=a.events[s][1];break}return d;function d(y){return l?l._inactive?m(y):(u=a.parser.defined.includes(Ur(a.sliceSerialize({start:l.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),f):n(y)}function f(y){return y===40?e.attempt(r8,g,u?g:m)(y):y===91?e.attempt(a8,g,u?h:m)(y):u?g(y):m(y)}function h(y){return e.attempt(i8,g,m)(y)}function g(y){return t(y)}function m(y){return l._balanced=!0,n(y)}}function c8(e,t,n){return a;function a(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),s}function s(m){return At(m)?Dl(e,l)(m):l(m)}function l(m){return m===41?g(m):UC(e,u,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function u(m){return At(m)?Dl(e,f)(m):g(m)}function d(m){return n(m)}function f(m){return m===34||m===39||m===40?FC(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function h(m){return At(m)?Dl(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function u8(e,t,n){const a=this;return s;function s(d){return BC.call(a,e,l,u,"reference","referenceMarker","referenceString")(d)}function l(d){return a.parser.defined.includes(Ur(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function u(d){return n(d)}}function d8(e,t,n){return a;function a(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),s}function s(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const p8={name:"labelStartImage",resolveAll:Sv.resolveAll,tokenize:f8};function f8(e,t,n){const a=this;return s;function s(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),u):n(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):t(d)}}const h8={name:"labelStartLink",resolveAll:Sv.resolveAll,tokenize:m8};function m8(e,t,n){const a=this;return s;function s(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),l}function l(u){return u===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(u):t(u)}}const em={name:"lineEnding",tokenize:g8};function g8(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),dt(e,t,"linePrefix")}}const td={name:"thematicBreak",tokenize:v8};function v8(e,t,n){let a=0,s;return l;function l(h){return e.enter("thematicBreak"),u(h)}function u(h){return s=h,d(h)}function d(h){return h===s?(e.enter("thematicBreakSequence"),f(h)):a>=3&&(h===null||Pe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function f(h){return h===s?(e.consume(h),a++,f):(e.exit("thematicBreakSequence"),it(h)?dt(e,d,"whitespace")(h):d(h))}}const qn={continuation:{tokenize:w8},exit:S8,name:"list",tokenize:x8},y8={partial:!0,tokenize:j8},b8={partial:!0,tokenize:k8};function x8(e,t,n){const a=this,s=a.events[a.events.length-1];let l=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,u=0;return d;function d(b){const k=a.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||b===a.containerState.marker:Ym(b)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(td,n,h)(b):h(b);if(!a.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(b)}return n(b)}function f(b){return Ym(b)&&++u<10?(e.consume(b),f):(!a.interrupt||u<2)&&(a.containerState.marker?b===a.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),h(b)):n(b)}function h(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||b,e.check(rc,a.interrupt?n:g,e.attempt(y8,y,m))}function g(b){return a.containerState.initialBlankLine=!0,l++,y(b)}function m(b){return it(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return a.containerState.size=l+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function w8(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(rc,s,l);function s(d){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,dt(e,t,"listItemIndent",a.containerState.size+1)(d)}function l(d){return a.containerState.furtherBlankLines||!it(d)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,u(d)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(b8,t,u)(d))}function u(d){return a.containerState._closeFlow=!0,a.interrupt=void 0,dt(e,e.attempt(qn,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function k8(e,t,n){const a=this;return dt(e,s,"listItemIndent",a.containerState.size+1);function s(l){const u=a.events[a.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===a.containerState.size?t(l):n(l)}}function S8(e){e.exit(this.containerState.type)}function j8(e,t,n){const a=this;return dt(e,s,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(l){const u=a.events[a.events.length-1];return!it(l)&&u&&u[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const Zw={name:"setextUnderline",resolveTo:C8,tokenize:N8};function C8(e,t){let n=e.length,a,s,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const u={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",l?(e.splice(s,0,["enter",u,t]),e.splice(l+1,0,["exit",e[a][1],t]),e[a][1].end={...e[l][1].end}):e[a][1]=u,e.push(["exit",u,t]),e}function N8(e,t,n){const a=this;let s;return l;function l(h){let g=a.events.length,m;for(;g--;)if(a.events[g][1].type!=="lineEnding"&&a.events[g][1].type!=="linePrefix"&&a.events[g][1].type!=="content"){m=a.events[g][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||m)?(e.enter("setextHeadingLine"),s=h,u(h)):n(h)}function u(h){return e.enter("setextHeadingLineSequence"),d(h)}function d(h){return h===s?(e.consume(h),d):(e.exit("setextHeadingLineSequence"),it(h)?dt(e,f,"lineSuffix")(h):f(h))}function f(h){return h===null||Pe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const E8={tokenize:T8};function T8(e){const t=this,n=e.attempt(rc,a,e.attempt(this.parser.constructs.flowInitial,s,dt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(LU,s)),"linePrefix")));return n;function a(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const A8={resolveAll:qC()},_8=HC("string"),R8=HC("text");function HC(e){return{resolveAll:qC(e==="text"?O8:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],l=n.attempt(s,u,d);return u;function u(g){return h(g)?l(g):d(g)}function d(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),f}function f(g){return h(g)?(n.exit("data"),l(g)):(n.consume(g),f)}function h(g){if(g===null)return!0;const m=s[g];let y=-1;if(m)for(;++y<m.length;){const b=m[y];if(!b.previous||b.previous.call(a,a.previous))return!0}return!1}}}function qC(e){return t;function t(n,a){let s=-1,l;for(;++s<=n.length;)l===void 0?n[s]&&n[s][1].type==="data"&&(l=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==l+2&&(n[l][1].end=n[s-1][1].end,n.splice(l+2,s-l-2),s=l+2),l=void 0);return e?e(n,a):n}}function O8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const a=e[n-1][1],s=t.sliceStream(a);let l=s.length,u=-1,d=0,f;for(;l--;){const h=s[l];if(typeof h=="string"){for(u=h.length;h.charCodeAt(u-1)===32;)d++,u--;if(u)break;u=-1}else if(h===-2)f=!0,d++;else if(h!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const h={type:n===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?u:a.start._bufferIndex+u,_index:a.start._index+l,line:a.end.line,column:a.end.column-d,offset:a.end.offset-d},end:{...a.end}};a.end={...h.start},a.start.offset===a.end.offset?Object.assign(a,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const L8={42:qn,43:qn,45:qn,48:qn,49:qn,50:qn,51:qn,52:qn,53:qn,54:qn,55:qn,56:qn,57:qn,62:zC},M8={91:IU},D8={[-2]:Jh,[-1]:Jh,32:Jh},z8={35:qU,42:td,45:[Zw,td],60:ZU,61:Zw,95:td,96:Vw,126:Vw},$8={38:IC,92:$C},I8={[-5]:em,[-4]:em,[-3]:em,33:p8,38:IC,42:Qm,60:[hU,t8],91:h8,92:[FU,$C],93:Sv,95:Qm,96:EU},P8={null:[Qm,A8]},U8={null:[42,95]},B8={null:[]},F8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:U8,contentInitial:M8,disable:B8,document:L8,flow:z8,flowInitial:D8,insideSpan:P8,string:$8,text:I8},Symbol.toStringTag,{value:"Module"}));function H8(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},l=[];let u=[],d=[];const f={attempt:z(B),check:z(_),consume:T,enter:E,exit:A,interrupt:z(_,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:m};let g=t.tokenize.call(h,f);return t.resolveAll&&l.push(t),h;function m(P){return u=Tr(u,P),N(),u[u.length-1]!==null?[]:(q(t,0),h.events=Zd(l,h.events,h),h.events)}function y(P,F){return G8(b(P),F)}function b(P){return q8(u,P)}function k(){const{_bufferIndex:P,_index:F,line:Z,column:I,offset:$}=a;return{_bufferIndex:P,_index:F,line:Z,column:I,offset:$}}function j(P){s[P.line]=P.column,R()}function N(){let P;for(;a._index<u.length;){const F=u[a._index];if(typeof F=="string")for(P=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===P&&a._bufferIndex<F.length;)S(F.charCodeAt(a._bufferIndex));else S(F)}}function S(P){g=g(P)}function T(P){Pe(P)?(a.line++,a.column=1,a.offset+=P===-3?2:1,R()):P!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===u[a._index].length&&(a._bufferIndex=-1,a._index++)),h.previous=P}function E(P,F){const Z=F||{};return Z.type=P,Z.start=k(),h.events.push(["enter",Z,h]),d.push(Z),Z}function A(P){const F=d.pop();return F.end=k(),h.events.push(["exit",F,h]),F}function B(P,F){q(P,F.from)}function _(P,F){F.restore()}function z(P,F){return Z;function Z(I,$,H){let V,X,Y,L;return Array.isArray(I)?G(I):"tokenize"in I?G([I]):U(I);function U(le){return be;function be(_e){const Ee=_e!==null&&le[_e],Ie=_e!==null&&le.null,We=[...Array.isArray(Ee)?Ee:Ee?[Ee]:[],...Array.isArray(Ie)?Ie:Ie?[Ie]:[]];return G(We)(_e)}}function G(le){return V=le,X=0,le.length===0?H:O(le[X])}function O(le){return be;function be(_e){return L=M(),Y=le,le.partial||(h.currentConstruct=le),le.name&&h.parser.constructs.disable.null.includes(le.name)?ue():le.tokenize.call(F?Object.assign(Object.create(h),F):h,f,ne,ue)(_e)}}function ne(le){return P(Y,L),$}function ue(le){return L.restore(),++X<V.length?O(V[X]):H}}}function q(P,F){P.resolveAll&&!l.includes(P)&&l.push(P),P.resolve&&cr(h.events,F,h.events.length-F,P.resolve(h.events.slice(F),h)),P.resolveTo&&(h.events=P.resolveTo(h.events,h))}function M(){const P=k(),F=h.previous,Z=h.currentConstruct,I=h.events.length,$=Array.from(d);return{from:I,restore:H};function H(){a=P,h.previous=F,h.currentConstruct=Z,h.events.length=I,d=$,R()}}function R(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function q8(e,t){const n=t.start._index,a=t.start._bufferIndex,s=t.end._index,l=t.end._bufferIndex;let u;if(n===s)u=[e[n].slice(a,l)];else{if(u=e.slice(n,s),a>-1){const d=u[0];typeof d=="string"?u[0]=d.slice(a):u.shift()}l>0&&u.push(e[s].slice(0,l))}return u}function G8(e,t){let n=-1;const a=[];let s;for(;++n<e.length;){const l=e[n];let u;if(typeof l=="string")u=l;else switch(l){case-5:{u="\r";break}case-4:{u=`
1626
+ `;break}case-3:{u=`\r
1627
+ `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&s)continue;u=" ";break}default:u=String.fromCharCode(l)}s=l===-2,a.push(u)}return a.join("")}function V8(e){const a={constructs:MC([F8,...(e||{}).extensions||[]]),content:s(oU),defined:[],document:s(cU),flow:s(E8),lazy:{},string:s(_8),text:s(R8)};return a;function s(l){return u;function u(d){return H8(a,l,d)}}}function W8(e){for(;!PC(e););return e}const Kw=/[\0\t\n\r]/g;function Z8(){let e=1,t="",n=!0,a;return s;function s(l,u,d){const f=[];let h,g,m,y,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(u||void 0).decode(l)),m=0,t="",n&&(l.charCodeAt(0)===65279&&m++,n=void 0);m<l.length;){if(Kw.lastIndex=m,h=Kw.exec(l),y=h&&h.index!==void 0?h.index:l.length,b=l.charCodeAt(y),!h){t=l.slice(m);break}if(b===10&&m===y&&a)f.push(-3),a=void 0;else switch(a&&(f.push(-5),a=void 0),m<y&&(f.push(l.slice(m,y)),e+=y-m),b){case 0:{f.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,f.push(-2);e++<g;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:a=!0,e=1}m=y+1}return d&&(a&&f.push(-5),t&&f.push(t),f.push(null)),f}}const K8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Y8(e){return e.replace(K8,Q8)}function Q8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),l=s===120||s===88;return DC(n.slice(l?2:1),l?16:10)}return kv(n)||e}const GC={}.hasOwnProperty;function X8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),J8(n)(W8(V8(n).document().write(Z8()(e,t,!0))))}function J8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Oe),autolinkProtocol:M,autolinkEmail:M,atxHeading:l(qe),blockQuote:l(Ie),characterEscape:M,characterReference:M,codeFenced:l(We),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:l(We,u),codeText:l(Se,u),codeTextData:M,data:M,codeFlowValue:M,definition:l(ft),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:l(De),hardBreakEscape:l(ke),hardBreakTrailing:l(ke),htmlFlow:l(lt,u),htmlFlowData:M,htmlText:l(lt,u),htmlTextData:M,image:l(xe),label:u,link:l(Oe),listItem:l($t),listItemValue:y,listOrdered:l(Ot,m),listUnordered:l(Ot),paragraph:l(Yt),reference:O,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:l(qe),strong:l(qt),thematicBreak:l(ye)},exit:{atxHeading:f(),atxHeadingSequence:B,autolink:f(),autolinkEmail:Ee,autolinkProtocol:_e,blockQuote:f(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:le,characterReference:be,codeFenced:f(N),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:k,codeFlowValue:R,codeIndented:f(S),codeText:f($),codeTextData:R,data:R,definition:f(),definitionDestinationString:A,definitionLabelString:T,definitionTitleString:E,emphasis:f(),hardBreakEscape:f(F),hardBreakTrailing:f(F),htmlFlow:f(Z),htmlFlowData:R,htmlText:f(I),htmlTextData:R,image:f(V),label:Y,labelText:X,lineEnding:P,link:f(H),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:ne,resourceDestinationString:L,resourceTitleString:U,resource:G,setextHeading:f(q),setextHeadingLineSequence:z,setextHeadingText:_,strong:f(),thematicBreak:f()}};VC(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(Q){let W={type:"root",children:[]};const ee={stack:[W],tokenStack:[],config:t,enter:d,exit:h,buffer:u,resume:g,data:n},ce=[];let he=-1;for(;++he<Q.length;)if(Q[he][1].type==="listOrdered"||Q[he][1].type==="listUnordered")if(Q[he][0]==="enter")ce.push(he);else{const Le=ce.pop();he=s(Q,Le,he)}for(he=-1;++he<Q.length;){const Le=t[Q[he][0]];GC.call(Le,Q[he][1].type)&&Le[Q[he][1].type].call(Object.assign({sliceSerialize:Q[he][2].sliceSerialize},ee),Q[he][1])}if(ee.tokenStack.length>0){const Le=ee.tokenStack[ee.tokenStack.length-1];(Le[1]||Yw).call(ee,void 0,Le[0])}for(W.position={start:gi(Q.length>0?Q[0][1].start:{line:1,column:1,offset:0}),end:gi(Q.length>0?Q[Q.length-2][1].end:{line:1,column:1,offset:0})},he=-1;++he<t.transforms.length;)W=t.transforms[he](W)||W;return W}function s(Q,W,ee){let ce=W-1,he=-1,Le=!1,He,Ce,Fe,et;for(;++ce<=ee;){const Ne=Q[ce];switch(Ne[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ne[0]==="enter"?he++:he--,et=void 0;break}case"lineEndingBlank":{Ne[0]==="enter"&&(He&&!et&&!he&&!Fe&&(Fe=ce),et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:et=void 0}if(!he&&Ne[0]==="enter"&&Ne[1].type==="listItemPrefix"||he===-1&&Ne[0]==="exit"&&(Ne[1].type==="listUnordered"||Ne[1].type==="listOrdered")){if(He){let Wt=ce;for(Ce=void 0;Wt--;){const _t=Q[Wt];if(_t[1].type==="lineEnding"||_t[1].type==="lineEndingBlank"){if(_t[0]==="exit")continue;Ce&&(Q[Ce][1].type="lineEndingBlank",Le=!0),_t[1].type="lineEnding",Ce=Wt}else if(!(_t[1].type==="linePrefix"||_t[1].type==="blockQuotePrefix"||_t[1].type==="blockQuotePrefixWhitespace"||_t[1].type==="blockQuoteMarker"||_t[1].type==="listItemIndent"))break}Fe&&(!Ce||Fe<Ce)&&(He._spread=!0),He.end=Object.assign({},Ce?Q[Ce][1].start:Ne[1].end),Q.splice(Ce||ce,0,["exit",He,Ne[2]]),ce++,ee++}if(Ne[1].type==="listItemPrefix"){const Wt={type:"listItem",_spread:!1,start:Object.assign({},Ne[1].start),end:void 0};He=Wt,Q.splice(ce,0,["enter",Wt,Ne[2]]),ce++,ee++,Fe=void 0,et=!0}}}return Q[W][1]._spread=Le,ee}function l(Q,W){return ee;function ee(ce){d.call(this,Q(ce),ce),W&&W.call(this,ce)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(Q,W,ee){this.stack[this.stack.length-1].children.push(Q),this.stack.push(Q),this.tokenStack.push([W,ee||void 0]),Q.position={start:gi(W.start),end:void 0}}function f(Q){return W;function W(ee){Q&&Q.call(this,ee),h.call(this,ee)}}function h(Q,W){const ee=this.stack.pop(),ce=this.tokenStack.pop();if(ce)ce[0].type!==Q.type&&(W?W.call(this,Q,ce[0]):(ce[1]||Yw).call(this,Q,ce[0]));else throw new Error("Cannot close `"+Q.type+"` ("+Ml({start:Q.start,end:Q.end})+"): it’s not open");ee.position.end=gi(Q.end)}function g(){return wv(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function y(Q){if(this.data.expectingFirstListItemValue){const W=this.stack[this.stack.length-2];W.start=Number.parseInt(this.sliceSerialize(Q),10),this.data.expectingFirstListItemValue=void 0}}function b(){const Q=this.resume(),W=this.stack[this.stack.length-1];W.lang=Q}function k(){const Q=this.resume(),W=this.stack[this.stack.length-1];W.meta=Q}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const Q=this.resume(),W=this.stack[this.stack.length-1];W.value=Q.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const Q=this.resume(),W=this.stack[this.stack.length-1];W.value=Q.replace(/(\r?\n|\r)$/g,"")}function T(Q){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.label=W,ee.identifier=Ur(this.sliceSerialize(Q)).toLowerCase()}function E(){const Q=this.resume(),W=this.stack[this.stack.length-1];W.title=Q}function A(){const Q=this.resume(),W=this.stack[this.stack.length-1];W.url=Q}function B(Q){const W=this.stack[this.stack.length-1];if(!W.depth){const ee=this.sliceSerialize(Q).length;W.depth=ee}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function z(Q){const W=this.stack[this.stack.length-1];W.depth=this.sliceSerialize(Q).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function M(Q){const ee=this.stack[this.stack.length-1].children;let ce=ee[ee.length-1];(!ce||ce.type!=="text")&&(ce=ut(),ce.position={start:gi(Q.start),end:void 0},ee.push(ce)),this.stack.push(ce)}function R(Q){const W=this.stack.pop();W.value+=this.sliceSerialize(Q),W.position.end=gi(Q.end)}function P(Q){const W=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ee=W.children[W.children.length-1];ee.position.end=gi(Q.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(W.type)&&(M.call(this,Q),R.call(this,Q))}function F(){this.data.atHardBreak=!0}function Z(){const Q=this.resume(),W=this.stack[this.stack.length-1];W.value=Q}function I(){const Q=this.resume(),W=this.stack[this.stack.length-1];W.value=Q}function $(){const Q=this.resume(),W=this.stack[this.stack.length-1];W.value=Q}function H(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=W,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function V(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=W,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function X(Q){const W=this.sliceSerialize(Q),ee=this.stack[this.stack.length-2];ee.label=Y8(W),ee.identifier=Ur(W).toLowerCase()}function Y(){const Q=this.stack[this.stack.length-1],W=this.resume(),ee=this.stack[this.stack.length-1];if(this.data.inReference=!0,ee.type==="link"){const ce=Q.children;ee.children=ce}else ee.alt=W}function L(){const Q=this.resume(),W=this.stack[this.stack.length-1];W.url=Q}function U(){const Q=this.resume(),W=this.stack[this.stack.length-1];W.title=Q}function G(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function ne(Q){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.label=W,ee.identifier=Ur(this.sliceSerialize(Q)).toLowerCase(),this.data.referenceType="full"}function ue(Q){this.data.characterReferenceType=Q.type}function le(Q){const W=this.sliceSerialize(Q),ee=this.data.characterReferenceType;let ce;ee?(ce=DC(W,ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ce=kv(W);const he=this.stack[this.stack.length-1];he.value+=ce}function be(Q){const W=this.stack.pop();W.position.end=gi(Q.end)}function _e(Q){R.call(this,Q);const W=this.stack[this.stack.length-1];W.url=this.sliceSerialize(Q)}function Ee(Q){R.call(this,Q);const W=this.stack[this.stack.length-1];W.url="mailto:"+this.sliceSerialize(Q)}function Ie(){return{type:"blockquote",children:[]}}function We(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function ft(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function qe(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function lt(){return{type:"html",value:""}}function xe(){return{type:"image",title:null,url:"",alt:null}}function Oe(){return{type:"link",title:null,url:"",children:[]}}function Ot(Q){return{type:"list",ordered:Q.type==="listOrdered",start:null,spread:Q._spread,children:[]}}function $t(Q){return{type:"listItem",spread:Q._spread,checked:null,children:[]}}function Yt(){return{type:"paragraph",children:[]}}function qt(){return{type:"strong",children:[]}}function ut(){return{type:"text",value:""}}function ye(){return{type:"thematicBreak"}}}function gi(e){return{line:e.line,column:e.column,offset:e.offset}}function VC(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?VC(e,a):e9(e,a)}}function e9(e,t){let n;for(n in t)if(GC.call(t,n))switch(n){case"canContainEols":{const a=t[n];a&&e[n].push(...a);break}case"transforms":{const a=t[n];a&&e[n].push(...a);break}case"enter":case"exit":{const a=t[n];a&&Object.assign(e[n],a);break}}}function Yw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ml({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ml({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ml({start:t.start,end:t.end})+") is still open")}function t9(e){const t=this;t.parser=n;function n(a){return X8(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function n9(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function r9(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
1628
+ `}]}function a9(e,t){const n=t.value?t.value+`
1629
+ `:"",a={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(a.className=["language-"+s[0]]);let l={type:"element",tagName:"code",properties:a,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function i9(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function s9(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function o9(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=So(a.toLowerCase()),l=e.footnoteOrder.indexOf(a);let u,d=e.footnoteCounts.get(a);d===void 0?(d=0,e.footnoteOrder.push(a),u=e.footnoteOrder.length):u=l+1,d+=1,e.footnoteCounts.set(a,d);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,f);const h={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,h),e.applyData(t,h)}function l9(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function c9(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function WC(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const s=e.all(t),l=s[0];l&&l.type==="text"?l.value="["+l.value:s.unshift({type:"text",value:"["});const u=s[s.length-1];return u&&u.type==="text"?u.value+=a:s.push({type:"text",value:a}),s}function u9(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return WC(e,t);const s={src:So(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(s.title=a.title);const l={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,l),e.applyData(t,l)}function d9(e,t){const n={src:So(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function p9(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const a={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,a),e.applyData(t,a)}function f9(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return WC(e,t);const s={href:So(a.url||"")};a.title!==null&&a.title!==void 0&&(s.title=a.title);const l={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function h9(e,t){const n={href:So(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function m9(e,t,n){const a=e.all(t),s=n?g9(n):ZC(t),l={},u=[];if(typeof t.checked=="boolean"){const g=a[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},a.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let d=-1;for(;++d<a.length;){const g=a[d];(s||d!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
1630
+ `}),g.type==="element"&&g.tagName==="p"&&!s?u.push(...g.children):u.push(g)}const f=a[a.length-1];f&&(s||f.type!=="element"||f.tagName!=="p")&&u.push({type:"text",value:`
1631
+ `});const h={type:"element",tagName:"li",properties:l,children:u};return e.patch(t,h),e.applyData(t,h)}function g9(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let a=-1;for(;!t&&++a<n.length;)t=ZC(n[a])}return t}function ZC(e){const t=e.spread;return t??e.children.length>1}function v9(e,t){const n={},a=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<a.length;){const u=a[s];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function y9(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function b9(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function x9(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function w9(e,t){const n=e.all(t),a=n.shift(),s=[];if(a){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],u),s.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=vv(t.children[1]),f=EC(t.children[t.children.length-1]);d&&f&&(u.position={start:d,end:f}),s.push(u)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,l),e.applyData(t,l)}function k9(e,t,n){const a=n?n.children:void 0,l=(a?a.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,d=u?u.length:t.children.length;let f=-1;const h=[];for(;++f<d;){const m=t.children[f],y={},b=u?u[f]:void 0;b&&(y.align=b);let k={type:"element",tagName:l,properties:y,children:[]};m&&(k.children=e.all(m),e.patch(m,k),k=e.applyData(m,k)),h.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,g),e.applyData(t,g)}function S9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Qw=9,Xw=32;function j9(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const l=[];for(;a;)l.push(Jw(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return l.push(Jw(t.slice(s),s>0,!1)),l.join("")}function Jw(e,t,n){let a=0,s=e.length;if(t){let l=e.codePointAt(a);for(;l===Qw||l===Xw;)a++,l=e.codePointAt(a)}if(n){let l=e.codePointAt(s-1);for(;l===Qw||l===Xw;)s--,l=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function C9(e,t){const n={type:"text",value:j9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function N9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const E9={blockquote:n9,break:r9,code:a9,delete:i9,emphasis:s9,footnoteReference:o9,heading:l9,html:c9,imageReference:u9,image:d9,inlineCode:p9,linkReference:f9,link:h9,listItem:m9,list:v9,paragraph:y9,root:b9,strong:x9,table:w9,tableCell:S9,tableRow:k9,text:C9,thematicBreak:N9,toml:Iu,yaml:Iu,definition:Iu,footnoteDefinition:Iu};function Iu(){}const KC=-1,Kd=0,zl=1,kd=2,jv=3,Cv=4,Nv=5,Ev=6,YC=7,QC=8,T9=typeof self=="object"?self:globalThis,ek=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new T9[e](t)},A9=(e,t)=>{const n=(s,l)=>(e.set(l,s),s),a=s=>{if(e.has(s))return e.get(s);const[l,u]=t[s];switch(l){case Kd:case KC:return n(u,s);case zl:{const d=n([],s);for(const f of u)d.push(a(f));return d}case kd:{const d=n({},s);for(const[f,h]of u)d[a(f)]=a(h);return d}case jv:return n(new Date(u),s);case Cv:{const{source:d,flags:f}=u;return n(new RegExp(d,f),s)}case Nv:{const d=n(new Map,s);for(const[f,h]of u)d.set(a(f),a(h));return d}case Ev:{const d=n(new Set,s);for(const f of u)d.add(a(f));return d}case YC:{const{name:d,message:f}=u;return n(ek(d,f),s)}case QC:return n(BigInt(u),s);case"BigInt":return n(Object(BigInt(u)),s);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:d}=new Uint8Array(u);return n(new DataView(d),u)}}return n(ek(l,u),s)};return a},tk=e=>A9(new Map,e)(0),Qs="",{toString:_9}={},{keys:R9}=Object,jl=e=>{const t=typeof e;if(t!=="object"||!e)return[Kd,t];const n=_9.call(e).slice(8,-1);switch(n){case"Array":return[zl,Qs];case"Object":return[kd,Qs];case"Date":return[jv,Qs];case"RegExp":return[Cv,Qs];case"Map":return[Nv,Qs];case"Set":return[Ev,Qs];case"DataView":return[zl,n]}return n.includes("Array")?[zl,n]:n.includes("Error")?[YC,n]:[kd,n]},Pu=([e,t])=>e===Kd&&(t==="function"||t==="symbol"),O9=(e,t,n,a)=>{const s=(u,d)=>{const f=a.push(u)-1;return n.set(d,f),f},l=u=>{if(n.has(u))return n.get(u);let[d,f]=jl(u);switch(d){case Kd:{let g=u;switch(f){case"bigint":d=QC,g=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);g=null;break;case"undefined":return s([KC],u)}return s([d,g],u)}case zl:{if(f){let y=u;return f==="DataView"?y=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(y=new Uint8Array(u)),s([f,[...y]],u)}const g=[],m=s([d,g],u);for(const y of u)g.push(l(y));return m}case kd:{if(f)switch(f){case"BigInt":return s([f,u.toString()],u);case"Boolean":case"Number":case"String":return s([f,u.valueOf()],u)}if(t&&"toJSON"in u)return l(u.toJSON());const g=[],m=s([d,g],u);for(const y of R9(u))(e||!Pu(jl(u[y])))&&g.push([l(y),l(u[y])]);return m}case jv:return s([d,u.toISOString()],u);case Cv:{const{source:g,flags:m}=u;return s([d,{source:g,flags:m}],u)}case Nv:{const g=[],m=s([d,g],u);for(const[y,b]of u)(e||!(Pu(jl(y))||Pu(jl(b))))&&g.push([l(y),l(b)]);return m}case Ev:{const g=[],m=s([d,g],u);for(const y of u)(e||!Pu(jl(y)))&&g.push(l(y));return m}}const{message:h}=u;return s([d,{name:f,message:h}],u)};return l},nk=(e,{json:t,lossy:n}={})=>{const a=[];return O9(!(t||n),!!t,new Map,a)(e),a},Sd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?tk(nk(e,t)):structuredClone(e):(e,t)=>tk(nk(e,t));function L9(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function M9(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function D9(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||L9,a=e.options.footnoteBackLabel||M9,s=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let f=-1;for(;++f<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[f]);if(!h)continue;const g=e.all(h),m=String(h.identifier).toUpperCase(),y=So(m.toLowerCase());let b=0;const k=[],j=e.footnoteCounts.get(m);for(;j!==void 0&&++b<=j;){k.length>0&&k.push({type:"text",value:" "});let T=typeof n=="string"?n:n(f,b);typeof T=="string"&&(T={type:"text",value:T}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(f,b),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const N=g[g.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const T=N.children[N.children.length-1];T&&T.type==="text"?T.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(...k)}else g.push(...k);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(g,!0)};e.patch(h,S),d.push(S)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...Sd(u),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
1632
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
1633
+ `}]}}const Yd=(function(e){if(e==null)return P9;if(typeof e=="function")return Qd(e);if(typeof e=="object")return Array.isArray(e)?z9(e):$9(e);if(typeof e=="string")return I9(e);throw new Error("Expected function, string, or object as test")});function z9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Yd(e[n]);return Qd(a);function a(...s){let l=-1;for(;++l<t.length;)if(t[l].apply(this,s))return!0;return!1}}function $9(e){const t=e;return Qd(n);function n(a){const s=a;let l;for(l in e)if(s[l]!==t[l])return!1;return!0}}function I9(e){return Qd(t);function t(n){return n&&n.type===e}}function Qd(e){return t;function t(n,a,s){return!!(U9(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function P9(){return!0}function U9(e){return e!==null&&typeof e=="object"&&"type"in e}const XC=[],B9=!0,Xm=!1,F9="skip";function JC(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const l=Yd(s),u=a?-1:1;d(e,void 0,[])();function d(f,h,g){const m=f&&typeof f=="object"?f:{};if(typeof m.type=="string"){const b=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(f.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=XC,k,j,N;if((!t||l(f,h,g[g.length-1]||void 0))&&(b=H9(n(f,g)),b[0]===Xm))return b;if("children"in f&&f.children){const S=f;if(S.children&&b[0]!==F9)for(j=(a?S.children.length:-1)+u,N=g.concat(S);j>-1&&j<S.children.length;){const T=S.children[j];if(k=d(T,j,N)(),k[0]===Xm)return k;j=typeof k[1]=="number"?k[1]:j+u}}return b}}}function H9(e){return Array.isArray(e)?e:typeof e=="number"?[B9,e]:e==null?XC:[e]}function Tv(e,t,n,a){let s,l,u;typeof t=="function"&&typeof n!="function"?(l=void 0,u=t,s=n):(l=t,u=n,s=a),JC(e,l,d,s);function d(f,h){const g=h[h.length-1],m=g?g.children.indexOf(f):void 0;return u(f,m,g)}}const Jm={}.hasOwnProperty,q9={};function G9(e,t){const n=t||q9,a=new Map,s=new Map,l=new Map,u={...E9,...n.handlers},d={all:h,applyData:W9,definitionById:a,footnoteById:s,footnoteCounts:l,footnoteOrder:[],handlers:u,one:f,options:n,patch:V9,wrap:K9};return Tv(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?a:s,y=String(g.identifier).toUpperCase();m.has(y)||m.set(y,g)}}),d;function f(g,m){const y=g.type,b=d.handlers[y];if(Jm.call(d.handlers,y)&&b)return b(d,g,m);if(d.options.passThrough&&d.options.passThrough.includes(y)){if("children"in g){const{children:j,...N}=g,S=Sd(N);return S.children=d.all(g),S}return Sd(g)}return(d.options.unknownHandler||Z9)(d,g,m)}function h(g){const m=[];if("children"in g){const y=g.children;let b=-1;for(;++b<y.length;){const k=d.one(y[b],g);if(k){if(b&&y[b-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=rk(k.value)),!Array.isArray(k)&&k.type==="element")){const j=k.children[0];j&&j.type==="text"&&(j.value=rk(j.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function V9(e,t){e.position&&(t.position=L5(e))}function W9(e,t){let n=t;if(e&&e.data){const a=e.data.hName,s=e.data.hChildren,l=e.data.hProperties;if(typeof a=="string")if(n.type==="element")n.tagName=a;else{const u="children"in n?n.children:[n];n={type:"element",tagName:a,properties:{},children:u}}n.type==="element"&&l&&Object.assign(n.properties,Sd(l)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function Z9(e,t){const n=t.data||{},a="value"in t&&!(Jm.call(n,"hProperties")||Jm.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function K9(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
1634
+ `});++a<e.length;)a&&n.push({type:"text",value:`
1635
+ `}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
1636
+ `}),n}function rk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ak(e,t){const n=G9(e,t),a=n.one(e,void 0),s=D9(n),l=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&l.children.push({type:"text",value:`
1637
+ `},s),l}function Y9(e,t){return e&&"run"in e?async function(n,a){const s=ak(n,{file:a,...t});await e.run(s,a)}:function(n,a){return ak(n,{file:a,...e||t})}}function ik(e){if(e)throw e}var tm,sk;function Q9(){if(sk)return tm;sk=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},l=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!m)return!1;var y;for(y in h);return typeof y>"u"||e.call(h,y)},u=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},d=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(a)return a(h,g).value}else return;return h[g]};return tm=function f(){var h,g,m,y,b,k,j=arguments[0],N=1,S=arguments.length,T=!1;for(typeof j=="boolean"&&(T=j,j=arguments[1]||{},N=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});N<S;++N)if(h=arguments[N],h!=null)for(g in h)m=d(j,g),y=d(h,g),j!==y&&(T&&y&&(l(y)||(b=s(y)))?(b?(b=!1,k=m&&s(m)?m:[]):k=m&&l(m)?m:{},u(j,{name:g,newValue:f(T,k,y)})):typeof y<"u"&&u(j,{name:g,newValue:y}));return j},tm}var X9=Q9();const nm=Wl(X9);function eg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function J9(){const e=[],t={run:n,use:a};return t;function n(...s){let l=-1;const u=s.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);d(null,...s);function d(f,...h){const g=e[++l];let m=-1;if(f){u(f);return}for(;++m<s.length;)(h[m]===null||h[m]===void 0)&&(h[m]=s[m]);s=h,g?eB(g,d)(...h):u(null,...h)}}function a(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function eB(e,t){let n;return a;function a(...u){const d=e.length>u.length;let f;d&&u.push(s);try{f=e.apply(this,u)}catch(h){const g=h;if(d&&n)throw g;return s(g)}d||(f&&f.then&&typeof f.then=="function"?f.then(l,s):f instanceof Error?s(f):l(f))}function s(u,...d){n||(n=!0,t(u,...d))}function l(u){s(null,u)}}const na={basename:tB,dirname:nB,extname:rB,join:aB,sep:"/"};function tB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ac(e);let n=0,a=-1,s=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else a<0&&(l=!0,a=s+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let u=-1,d=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else u<0&&(l=!0,u=s+1),d>-1&&(e.codePointAt(s)===t.codePointAt(d--)?d<0&&(a=s):(d=-1,a=u));return n===a?a=u:a<0&&(a=e.length),e.slice(n,a)}function nB(e){if(ac(e),e.length===0)return".";let t=-1,n=e.length,a;for(;--n;)if(e.codePointAt(n)===47){if(a){t=n;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function rB(e){ac(e);let t=e.length,n=-1,a=0,s=-1,l=0,u;for(;t--;){const d=e.codePointAt(t);if(d===47){if(u){a=t+1;break}continue}n<0&&(u=!0,n=t+1),d===46?s<0?s=t:l!==1&&(l=1):s>-1&&(l=-1)}return s<0||n<0||l===0||l===1&&s===n-1&&s===a+1?"":e.slice(s,n)}function aB(...e){let t=-1,n;for(;++t<e.length;)ac(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":iB(n)}function iB(e){ac(e);const t=e.codePointAt(0)===47;let n=sB(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function sB(e,t){let n="",a=0,s=-1,l=0,u=-1,d,f;for(;++u<=e.length;){if(u<e.length)d=e.codePointAt(u);else{if(d===47)break;d=47}if(d===47){if(!(s===u-1||l===1))if(s!==u-1&&l===2){if(n.length<2||a!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",a=0):(n=n.slice(0,f),a=n.length-1-n.lastIndexOf("/")),s=u,l=0;continue}}else if(n.length>0){n="",a=0,s=u,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(s+1,u):n=e.slice(s+1,u),a=u-s-1;s=u,l=0}else d===46&&l>-1?l++:l=-1}return n}function ac(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const oB={cwd:lB};function lB(){return"/"}function tg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function cB(e){if(typeof e=="string")e=new URL(e);else if(!tg(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return uB(e)}function uB(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const a=t.codePointAt(n+2);if(a===70||a===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const rm=["history","path","basename","stem","extname","dirname"];class eN{constructor(t){let n;t?tg(t)?n={path:t}:typeof t=="string"||dB(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":oB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<rm.length;){const l=rm[a];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let s;for(s in n)rm.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?na.basename(this.path):void 0}set basename(t){im(t,"basename"),am(t,"basename"),this.path=na.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?na.dirname(this.path):void 0}set dirname(t){ok(this.basename,"dirname"),this.path=na.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?na.extname(this.path):void 0}set extname(t){if(am(t,"extname"),ok(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=na.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){tg(t)&&(t=cB(t)),im(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?na.basename(this.path,this.extname):void 0}set stem(t){im(t,"stem"),am(t,"stem"),this.path=na.join(this.dirname||"",t+(this.extname||""))}fail(t,n,a){const s=this.message(t,n,a);throw s.fatal=!0,s}info(t,n,a){const s=this.message(t,n,a);return s.fatal=void 0,s}message(t,n,a){const s=new _n(t,n,a);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function am(e,t){if(e&&e.includes(na.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+na.sep+"`")}function im(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ok(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function dB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pB=(function(e){const a=this.constructor.prototype,s=a[e],l=function(){return s.apply(l,arguments)};return Object.setPrototypeOf(l,a),l}),fB={}.hasOwnProperty;class Av extends pB{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=J9()}copy(){const t=new Av;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(nm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(lm("data",this.frozen),this.namespace[t]=n,this):fB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(lm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const s=n.call(t,...a);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Uu(t),a=this.parser||this.Parser;return sm("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),sm("process",this.parser||this.Parser),om("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(l,u){const d=Uu(t),f=a.parse(d);a.run(f,d,function(g,m,y){if(g||!m||!y)return h(g);const b=m,k=a.stringify(b,y);gB(k)?y.value=k:y.result=k,h(g,y)});function h(g,m){g||!m?u(g):l?l(m):n(void 0,m)}}}processSync(t){let n=!1,a;return this.freeze(),sm("processSync",this.parser||this.Parser),om("processSync",this.compiler||this.Compiler),this.process(t,s),ck("processSync","process",n),a;function s(l,u){n=!0,ik(l),a=u}}run(t,n,a){lk(t),this.freeze();const s=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?l(void 0,a):new Promise(l);function l(u,d){const f=Uu(n);s.run(t,f,h);function h(g,m,y){const b=m||t;g?d(g):u?u(b):a(void 0,b,y)}}}runSync(t,n){let a=!1,s;return this.run(t,n,l),ck("runSync","run",a),s;function l(u,d){ik(u),s=d,a=!0}}stringify(t,n){this.freeze();const a=Uu(n),s=this.compiler||this.Compiler;return om("stringify",s),lk(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(lm("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(h){if(typeof h=="function")f(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...m]=h;f(g,m)}else u(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function u(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(h.plugins),h.settings&&(s.settings=nm(!0,s.settings,h.settings))}function d(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const m=h[g];l(m)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function f(h,g){let m=-1,y=-1;for(;++m<a.length;)if(a[m][0]===h){y=m;break}if(y===-1)a.push([h,...g]);else if(g.length>0){let[b,...k]=g;const j=a[y][1];eg(j)&&eg(b)&&(b=nm(!0,j,b)),a[y]=[h,b,...k]}}}}const hB=new Av().freeze();function sm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function om(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function lm(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function lk(e){if(!eg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ck(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Uu(e){return mB(e)?e:new eN(e)}function mB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function gB(e){return typeof e=="string"||vB(e)}function vB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",uk=[],dk={allowDangerousHtml:!0},bB=/^(https?|ircs?|mailto|xmpp)$/i,xB=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function wB(e){const t=kB(e),n=SB(e);return jB(t.runSync(t.parse(n),n),e)}function kB(e){const t=e.rehypePlugins||uk,n=e.remarkPlugins||uk,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...dk}:dk;return hB().use(t9).use(n).use(Y9,a).use(t)}function SB(e){const t=e.children||"",n=new eN;return typeof t=="string"&&(n.value=t),n}function jB(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,l=t.disallowedElements,u=t.skipHtml,d=t.unwrapDisallowed,f=t.urlTransform||CB;for(const g of xB)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+yB+g.id,void 0);return Tv(e,h),I5(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function h(g,m,y){if(g.type==="raw"&&y&&typeof m=="number")return u?y.children.splice(m,1):y.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let b;for(b in Xh)if(Object.hasOwn(Xh,b)&&Object.hasOwn(g.properties,b)){const k=g.properties[b],j=Xh[b];(j===null||j.includes(g.tagName))&&(g.properties[b]=f(String(k||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):l?l.includes(g.tagName):!1;if(!b&&a&&typeof m=="number"&&(b=!a(g,m,y)),b&&y&&typeof m=="number")return d&&g.children?y.children.splice(m,1,...g.children):y.children.splice(m,1),m}}}function CB(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||a!==-1&&t>a||bB.test(e.slice(0,t))?e:""}function pk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,s=n.indexOf(t);for(;s!==-1;)a++,s=n.indexOf(t,s+t.length);return a}function NB(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function tN(e,t,n){const s=Yd((n||{}).ignore||[]),l=EB(t);let u=-1;for(;++u<l.length;)JC(e,"text",d);function d(h,g){let m=-1,y;for(;++m<g.length;){const b=g[m],k=y?y.children:void 0;if(s(b,k?k.indexOf(b):void 0,y))return;y=b}if(y)return f(h,g)}function f(h,g){const m=g[g.length-1],y=l[u][0],b=l[u][1];let k=0;const N=m.children.indexOf(h);let S=!1,T=[];y.lastIndex=0;let E=y.exec(h.value);for(;E;){const A=E.index,B={index:E.index,input:E.input,stack:[...g,h]};let _=b(...E,B);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?y.lastIndex=A+1:(k!==A&&T.push({type:"text",value:h.value.slice(k,A)}),Array.isArray(_)?T.push(..._):_&&T.push(_),k=A+E[0].length,S=!0),!y.global)break;E=y.exec(h.value)}return S?(k<h.value.length&&T.push({type:"text",value:h.value.slice(k)}),m.children.splice(N,1,...T)):T=[h],N+T.length}}function EB(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<n.length;){const s=n[a];t.push([TB(s[0]),AB(s[1])])}return t}function TB(e){return typeof e=="string"?new RegExp(NB(e),"g"):e}function AB(e){return typeof e=="function"?e:function(){return e}}const cm="phrasing",um=["autolink","link","image","label"];function _B(){return{transforms:[$B],enter:{literalAutolink:OB,literalAutolinkEmail:dm,literalAutolinkHttp:dm,literalAutolinkWww:dm},exit:{literalAutolink:zB,literalAutolinkEmail:DB,literalAutolinkHttp:LB,literalAutolinkWww:MB}}}function RB(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:cm,notInConstruct:um},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:cm,notInConstruct:um},{character:":",before:"[ps]",after:"\\/",inConstruct:cm,notInConstruct:um}]}}function OB(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function dm(e){this.config.enter.autolinkProtocol.call(this,e)}function LB(e){this.config.exit.autolinkProtocol.call(this,e)}function MB(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function DB(e){this.config.exit.autolinkEmail.call(this,e)}function zB(e){this.exit(e)}function $B(e){tN(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,IB],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),PB]],{ignore:["link","linkReference"]})}function IB(e,t,n,a,s){let l="";if(!nN(s)||(/^w/i.test(t)&&(n=t+n,t="",l="http://"),!UB(n)))return!1;const u=BB(n+a);if(!u[0])return!1;const d={type:"link",title:null,url:l+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[d,{type:"text",value:u[1]}]:d}function PB(e,t,n,a){return!nN(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function UB(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function BB(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const s=pk(e,"(");let l=pk(e,")");for(;a!==-1&&s>l;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),l++;return[e,n]}function nN(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||rs(n)||Wd(n))&&(!t||n!==47)}rN.peek=YB;function FB(){this.buffer()}function HB(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function qB(){this.buffer()}function GB(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function VB(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ur(this.sliceSerialize(e)).toLowerCase(),n.label=t}function WB(e){this.exit(e)}function ZB(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ur(this.sliceSerialize(e)).toLowerCase(),n.label=t}function KB(e){this.exit(e)}function YB(){return"["}function rN(e,t,n,a){const s=n.createTracker(a);let l=s.move("[^");const u=n.enter("footnoteReference"),d=n.enter("reference");return l+=s.move(n.safe(n.associationId(e),{after:"]",before:l})),d(),u(),l+=s.move("]"),l}function QB(){return{enter:{gfmFootnoteCallString:FB,gfmFootnoteCall:HB,gfmFootnoteDefinitionLabelString:qB,gfmFootnoteDefinition:GB},exit:{gfmFootnoteCallString:VB,gfmFootnoteCall:WB,gfmFootnoteDefinitionLabelString:ZB,gfmFootnoteDefinition:KB}}}function XB(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:rN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,s,l,u){const d=l.createTracker(u);let f=d.move("[^");const h=l.enter("footnoteDefinition"),g=l.enter("label");return f+=d.move(l.safe(l.associationId(a),{before:f,after:"]"})),g(),f+=d.move("]:"),a.children&&a.children.length>0&&(d.shift(4),f+=d.move((t?`
1638
+ `:" ")+l.indentLines(l.containerFlow(a,d.current()),t?aN:JB))),h(),f}}function JB(e,t,n){return t===0?e:aN(e,t,n)}function aN(e,t,n){return(n?"":" ")+e}const eF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];iN.peek=iF;function tF(){return{canContainEols:["delete"],enter:{strikethrough:rF},exit:{strikethrough:aF}}}function nF(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:eF}],handlers:{delete:iN}}}function rF(e){this.enter({type:"delete",children:[]},e)}function aF(e){this.exit(e)}function iN(e,t,n,a){const s=n.createTracker(a),l=n.enter("strikethrough");let u=s.move("~~");return u+=n.containerPhrasing(e,{...s.current(),before:u,after:"~"}),u+=s.move("~~"),l(),u}function iF(){return"~"}function sF(e){return e.length}function oF(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||sF,l=[],u=[],d=[],f=[];let h=0,g=-1;for(;++g<e.length;){const j=[],N=[];let S=-1;for(e[g].length>h&&(h=e[g].length);++S<e[g].length;){const T=lF(e[g][S]);if(n.alignDelimiters!==!1){const E=s(T);N[S]=E,(f[S]===void 0||E>f[S])&&(f[S]=E)}j.push(T)}u[g]=j,d[g]=N}let m=-1;if(typeof a=="object"&&"length"in a)for(;++m<h;)l[m]=fk(a[m]);else{const j=fk(a);for(;++m<h;)l[m]=j}m=-1;const y=[],b=[];for(;++m<h;){const j=l[m];let N="",S="";j===99?(N=":",S=":"):j===108?N=":":j===114&&(S=":");let T=n.alignDelimiters===!1?1:Math.max(1,f[m]-N.length-S.length);const E=N+"-".repeat(T)+S;n.alignDelimiters!==!1&&(T=N.length+T+S.length,T>f[m]&&(f[m]=T),b[m]=T),y[m]=E}u.splice(1,0,y),d.splice(1,0,b),g=-1;const k=[];for(;++g<u.length;){const j=u[g],N=d[g];m=-1;const S=[];for(;++m<h;){const T=j[m]||"";let E="",A="";if(n.alignDelimiters!==!1){const B=f[m]-(N[m]||0),_=l[m];_===114?E=" ".repeat(B):_===99?B%2?(E=" ".repeat(B/2+.5),A=" ".repeat(B/2-.5)):(E=" ".repeat(B/2),A=E):A=" ".repeat(B)}n.delimiterStart!==!1&&!m&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&T==="")&&(n.delimiterStart!==!1||m)&&S.push(" "),n.alignDelimiters!==!1&&S.push(E),S.push(T),n.alignDelimiters!==!1&&S.push(A),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||m!==h-1)&&S.push("|")}k.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return k.join(`
1639
+ `)}function lF(e){return e==null?"":String(e)}function fk(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function cF(e,t,n,a){const s=n.enter("blockquote"),l=n.createTracker(a);l.move("> "),l.shift(2);const u=n.indentLines(n.containerFlow(e,l.current()),uF);return s(),u}function uF(e,t,n){return">"+(n?"":" ")+e}function dF(e,t){return hk(e,t.inConstruct,!0)&&!hk(e,t.notInConstruct,!1)}function hk(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function mk(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
1640
+ `&&dF(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
1641
+ `}function pF(e,t){const n=String(e);let a=n.indexOf(t),s=a,l=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===s?++l>u&&(u=l):l=1,s=a+t.length,a=n.indexOf(t,s);return u}function fF(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function hF(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function mF(e,t,n,a){const s=hF(n),l=e.value||"",u=s==="`"?"GraveAccent":"Tilde";if(fF(e,n)){const m=n.enter("codeIndented"),y=n.indentLines(l,gF);return m(),y}const d=n.createTracker(a),f=s.repeat(Math.max(pF(l,s)+1,3)),h=n.enter("codeFenced");let g=d.move(f);if(e.lang){const m=n.enter(`codeFencedLang${u}`);g+=d.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...d.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${u}`);g+=d.move(" "),g+=d.move(n.safe(e.meta,{before:g,after:`
1642
+ `,encode:["`"],...d.current()})),m()}return g+=d.move(`
1643
+ `),l&&(g+=d.move(l+`
1644
+ `)),g+=d.move(f),h(),g}function gF(e,t,n){return(n?"":" ")+e}function _v(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function vF(e,t,n,a){const s=_v(n),l=s==='"'?"Quote":"Apostrophe",u=n.enter("definition");let d=n.enter("label");const f=n.createTracker(a);let h=f.move("[");return h+=f.move(n.safe(n.associationId(e),{before:h,after:"]",...f.current()})),h+=f.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(d=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":`
1645
+ `,...f.current()}))),d(),e.title&&(d=n.enter(`title${l}`),h+=f.move(" "+s),h+=f.move(n.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),d()),u(),h}function yF(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Gl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function jd(e,t,n){const a=ho(e),s=ho(t);return a===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}sN.peek=bF;function sN(e,t,n,a){const s=yF(n),l=n.enter("emphasis"),u=n.createTracker(a),d=u.move(s);let f=u.move(n.containerPhrasing(e,{after:s,before:d,...u.current()}));const h=f.charCodeAt(0),g=jd(a.before.charCodeAt(a.before.length-1),h,s);g.inside&&(f=Gl(h)+f.slice(1));const m=f.charCodeAt(f.length-1),y=jd(a.after.charCodeAt(0),m,s);y.inside&&(f=f.slice(0,-1)+Gl(m));const b=u.move(s);return l(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},d+f+b}function bF(e,t,n){return n.options.emphasis||"*"}function xF(e,t){let n=!1;return Tv(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Xm}),!!((!e.depth||e.depth<3)&&wv(e)&&(t.options.setext||n))}function wF(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(a);if(xF(e,n)){const g=n.enter("headingSetext"),m=n.enter("phrasing"),y=n.containerPhrasing(e,{...l.current(),before:`
1646
+ `,after:`
1647
+ `});return m(),g(),y+`
1648
+ `+(s===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
1649
+ `))+1))}const u="#".repeat(s),d=n.enter("headingAtx"),f=n.enter("phrasing");l.move(u+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
1650
+ `,...l.current()});return/^[\t ]/.test(h)&&(h=Gl(h.charCodeAt(0))+h.slice(1)),h=h?u+" "+h:u,n.options.closeAtx&&(h+=" "+u),f(),d(),h}oN.peek=kF;function oN(e){return e.value||""}function kF(){return"<"}lN.peek=SF;function lN(e,t,n,a){const s=_v(n),l=s==='"'?"Quote":"Apostrophe",u=n.enter("image");let d=n.enter("label");const f=n.createTracker(a);let h=f.move("![");return h+=f.move(n.safe(e.alt,{before:h,after:"]",...f.current()})),h+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(d=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=n.enter(`title${l}`),h+=f.move(" "+s),h+=f.move(n.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),d()),h+=f.move(")"),u(),h}function SF(){return"!"}cN.peek=jF;function cN(e,t,n,a){const s=e.referenceType,l=n.enter("imageReference");let u=n.enter("label");const d=n.createTracker(a);let f=d.move("![");const h=n.safe(e.alt,{before:f,after:"]",...d.current()});f+=d.move(h+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return u(),n.stack=g,l(),s==="full"||!h||h!==m?f+=d.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function jF(){return"!"}uN.peek=CF;function uN(e,t,n){let a=e.value||"",s="`",l=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(a);)s+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++l<n.unsafe.length;){const u=n.unsafe[l],d=n.compilePattern(u);let f;if(u.atBreak)for(;f=d.exec(a);){let h=f.index;a.charCodeAt(h)===10&&a.charCodeAt(h-1)===13&&h--,a=a.slice(0,h)+" "+a.slice(f.index+1)}}return s+a+s}function CF(){return"`"}function dN(e,t){const n=wv(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}pN.peek=NF;function pN(e,t,n,a){const s=_v(n),l=s==='"'?"Quote":"Apostrophe",u=n.createTracker(a);let d,f;if(dN(e,n)){const g=n.stack;n.stack=[],d=n.enter("autolink");let m=u.move("<");return m+=u.move(n.containerPhrasing(e,{before:m,after:">",...u.current()})),m+=u.move(">"),d(),n.stack=g,m}d=n.enter("link"),f=n.enter("label");let h=u.move("[");return h+=u.move(n.containerPhrasing(e,{before:h,after:"](",...u.current()})),h+=u.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=u.move("<"),h+=u.move(n.safe(e.url,{before:h,after:">",...u.current()})),h+=u.move(">")):(f=n.enter("destinationRaw"),h+=u.move(n.safe(e.url,{before:h,after:e.title?" ":")",...u.current()}))),f(),e.title&&(f=n.enter(`title${l}`),h+=u.move(" "+s),h+=u.move(n.safe(e.title,{before:h,after:s,...u.current()})),h+=u.move(s),f()),h+=u.move(")"),d(),h}function NF(e,t,n){return dN(e,n)?"<":"["}fN.peek=EF;function fN(e,t,n,a){const s=e.referenceType,l=n.enter("linkReference");let u=n.enter("label");const d=n.createTracker(a);let f=d.move("[");const h=n.containerPhrasing(e,{before:f,after:"]",...d.current()});f+=d.move(h+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return u(),n.stack=g,l(),s==="full"||!h||h!==m?f+=d.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function EF(){return"["}function Rv(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function TF(e){const t=Rv(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function AF(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function hN(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function _F(e,t,n,a){const s=n.enter("list"),l=n.bulletCurrent;let u=e.ordered?AF(n):Rv(n);const d=e.ordered?u==="."?")":".":TF(n);let f=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),hN(n)===u&&g){let m=-1;for(;++m<e.children.length;){const y=e.children[m];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(u=d),n.bulletCurrent=u;const h=n.containerFlow(e,a);return n.bulletLastUsed=u,n.bulletCurrent=l,s(),h}function RF(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function OF(e,t,n,a){const s=RF(n);let l=n.bulletCurrent||Rv(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let u=l.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const d=n.createTracker(a);d.move(l+" ".repeat(u-l.length)),d.shift(u);const f=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,d.current()),g);return f(),h;function g(m,y,b){return y?(b?"":" ".repeat(u))+m:(b?l:l+" ".repeat(u-l.length))+m}}function LF(e,t,n,a){const s=n.enter("paragraph"),l=n.enter("phrasing"),u=n.containerPhrasing(e,a);return l(),s(),u}const MF=Yd(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function DF(e,t,n,a){return(e.children.some(function(u){return MF(u)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function zF(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}mN.peek=$F;function mN(e,t,n,a){const s=zF(n),l=n.enter("strong"),u=n.createTracker(a),d=u.move(s+s);let f=u.move(n.containerPhrasing(e,{after:s,before:d,...u.current()}));const h=f.charCodeAt(0),g=jd(a.before.charCodeAt(a.before.length-1),h,s);g.inside&&(f=Gl(h)+f.slice(1));const m=f.charCodeAt(f.length-1),y=jd(a.after.charCodeAt(0),m,s);y.inside&&(f=f.slice(0,-1)+Gl(m));const b=u.move(s+s);return l(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},d+f+b}function $F(e,t,n){return n.options.strong||"*"}function IF(e,t,n,a){return n.safe(e.value,a)}function PF(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function UF(e,t,n){const a=(hN(n)+(n.options.ruleSpaces?" ":"")).repeat(PF(n));return n.options.ruleSpaces?a.slice(0,-1):a}const gN={blockquote:cF,break:mk,code:mF,definition:vF,emphasis:sN,hardBreak:mk,heading:wF,html:oN,image:lN,imageReference:cN,inlineCode:uN,link:pN,linkReference:fN,list:_F,listItem:OF,paragraph:LF,root:DF,strong:mN,text:IF,thematicBreak:UF};function BF(){return{enter:{table:FF,tableData:gk,tableHeader:gk,tableRow:qF},exit:{codeText:GF,table:HF,tableData:pm,tableHeader:pm,tableRow:pm}}}function FF(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function HF(e){this.exit(e),this.data.inTable=void 0}function qF(e){this.enter({type:"tableRow",children:[]},e)}function pm(e){this.exit(e)}function gk(e){this.enter({type:"tableCell",children:[]},e)}function GF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,VF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function VF(e,t){return t==="|"?t:e}function WF(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
1651
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:u,tableCell:f,tableRow:d}};function u(b,k,j,N){return h(g(b,j,N),b.align)}function d(b,k,j,N){const S=m(b,j,N),T=h([S]);return T.slice(0,T.indexOf(`
1652
+ `))}function f(b,k,j,N){const S=j.enter("tableCell"),T=j.enter("phrasing"),E=j.containerPhrasing(b,{...N,before:l,after:l});return T(),S(),E}function h(b,k){return oF(b,{align:k,alignDelimiters:a,padding:n,stringLength:s})}function g(b,k,j){const N=b.children;let S=-1;const T=[],E=k.enter("table");for(;++S<N.length;)T[S]=m(N[S],k,j);return E(),T}function m(b,k,j){const N=b.children;let S=-1;const T=[],E=k.enter("tableRow");for(;++S<N.length;)T[S]=f(N[S],b,k,j);return E(),T}function y(b,k,j){let N=gN.inlineCode(b,k,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function ZF(){return{exit:{taskListCheckValueChecked:vk,taskListCheckValueUnchecked:vk,paragraph:YF}}}function KF(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:QF}}}function vk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function YF(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const a=n.children[0];if(a&&a.type==="text"){const s=t.children;let l=-1,u;for(;++l<s.length;){const d=s[l];if(d.type==="paragraph"){u=d;break}}u===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function QF(e,t,n,a){const s=e.children[0],l=typeof e.checked=="boolean"&&s&&s.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",d=n.createTracker(a);l&&d.move(u);let f=gN.listItem(e,t,n,{...a,...d.current()});return l&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),f;function h(g){return g+u}}function XF(){return[_B(),QB(),tF(),BF(),ZF()]}function JF(e){return{extensions:[RB(),XB(e),nF(),WF(e),KF()]}}const eH={tokenize:sH,partial:!0},vN={tokenize:oH,partial:!0},yN={tokenize:lH,partial:!0},bN={tokenize:cH,partial:!0},tH={tokenize:uH,partial:!0},xN={name:"wwwAutolink",tokenize:aH,previous:kN},wN={name:"protocolAutolink",tokenize:iH,previous:SN},Ba={name:"emailAutolink",tokenize:rH,previous:jN},la={};function nH(){return{text:la}}let Zi=48;for(;Zi<123;)la[Zi]=Ba,Zi++,Zi===58?Zi=65:Zi===91&&(Zi=97);la[43]=Ba;la[45]=Ba;la[46]=Ba;la[95]=Ba;la[72]=[Ba,wN];la[104]=[Ba,wN];la[87]=[Ba,xN];la[119]=[Ba,xN];function rH(e,t,n){const a=this;let s,l;return u;function u(m){return!ng(m)||!jN.call(a,a.previous)||Ov(a.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(m))}function d(m){return ng(m)?(e.consume(m),d):m===64?(e.consume(m),f):n(m)}function f(m){return m===46?e.check(tH,g,h)(m):m===45||m===95||Tn(m)?(l=!0,e.consume(m),f):g(m)}function h(m){return e.consume(m),s=!0,f}function g(m){return l&&s&&Dn(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function aH(e,t,n){const a=this;return s;function s(u){return u!==87&&u!==119||!kN.call(a,a.previous)||Ov(a.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(eH,e.attempt(vN,e.attempt(yN,l),n),n)(u))}function l(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function iH(e,t,n){const a=this;let s="",l=!1;return u;function u(m){return(m===72||m===104)&&SN.call(a,a.previous)&&!Ov(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(m),e.consume(m),d):n(m)}function d(m){if(Dn(m)&&s.length<5)return s+=String.fromCodePoint(m),e.consume(m),d;if(m===58){const y=s.toLowerCase();if(y==="http"||y==="https")return e.consume(m),f}return n(m)}function f(m){return m===47?(e.consume(m),l?h:(l=!0,f)):n(m)}function h(m){return m===null||wd(m)||At(m)||rs(m)||Wd(m)?n(m):e.attempt(vN,e.attempt(yN,g),n)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function sH(e,t,n){let a=0;return s;function s(u){return(u===87||u===119)&&a<3?(a++,e.consume(u),s):u===46&&a===3?(e.consume(u),l):n(u)}function l(u){return u===null?n(u):t(u)}}function oH(e,t,n){let a,s,l;return u;function u(h){return h===46||h===95?e.check(bN,f,d)(h):h===null||At(h)||rs(h)||h!==45&&Wd(h)?f(h):(l=!0,e.consume(h),u)}function d(h){return h===95?a=!0:(s=a,a=void 0),e.consume(h),u}function f(h){return s||a||!l?n(h):t(h)}}function lH(e,t){let n=0,a=0;return s;function s(u){return u===40?(n++,e.consume(u),s):u===41&&a<n?l(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(bN,t,l)(u):u===null||At(u)||rs(u)?t(u):(e.consume(u),s)}function l(u){return u===41&&a++,e.consume(u),s}}function cH(e,t,n){return a;function a(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),a):d===38?(e.consume(d),l):d===93?(e.consume(d),s):d===60||d===null||At(d)||rs(d)?t(d):n(d)}function s(d){return d===null||d===40||d===91||At(d)||rs(d)?t(d):a(d)}function l(d){return Dn(d)?u(d):n(d)}function u(d){return d===59?(e.consume(d),a):Dn(d)?(e.consume(d),u):n(d)}}function uH(e,t,n){return a;function a(l){return e.consume(l),s}function s(l){return Tn(l)?n(l):t(l)}}function kN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||At(e)}function SN(e){return!Dn(e)}function jN(e){return!(e===47||ng(e))}function ng(e){return e===43||e===45||e===46||e===95||Tn(e)}function Ov(e){let t=e.length,n=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){n=!0;break}if(a._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const dH={tokenize:bH,partial:!0};function pH(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:gH,continuation:{tokenize:vH},exit:yH}},text:{91:{name:"gfmFootnoteCall",tokenize:mH},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:fH,resolveTo:hH}}}}function fH(e,t,n){const a=this;let s=a.events.length;const l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u;for(;s--;){const f=a.events[s][1];if(f.type==="labelImage"){u=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return d;function d(f){if(!u||!u._balanced)return n(f);const h=Ur(a.sliceSerialize({start:u.end,end:a.now()}));return h.codePointAt(0)!==94||!l.includes(h.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function hH(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},d=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...d),e}function mH(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l=0,u;return d;function d(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),f}function f(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(m){if(l>999||m===93&&!u||m===null||m===91||At(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return s.includes(Ur(a.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return At(m)||(u=!0),l++,e.consume(m),m===92?g:h}function g(m){return m===91||m===92||m===93?(e.consume(m),l++,h):h(m)}}function gH(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l,u=0,d;return f;function f(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(k)}function g(k){if(u>999||k===93&&!d||k===null||k===91||At(k))return n(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return l=Ur(a.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return At(k)||(d=!0),u++,e.consume(k),k===92?m:g}function m(k){return k===91||k===92||k===93?(e.consume(k),u++,g):g(k)}function y(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),s.includes(l)||s.push(l),dt(e,b,"gfmFootnoteDefinitionWhitespace")):n(k)}function b(k){return t(k)}}function vH(e,t,n){return e.check(rc,t,e.attempt(dH,t,n))}function yH(e){e.exit("gfmFootnoteDefinition")}function bH(e,t,n){const a=this;return dt(e,s,"gfmFootnoteDefinitionIndent",5);function s(l){const u=a.events[a.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(l):n(l)}}function xH(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:l,resolveAll:s};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function s(u,d){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let h=f;for(;h--;)if(u[h][0]==="exit"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[h][1].end.offset-u[h][1].start.offset){u[f][1].type="strikethroughSequence",u[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},u[h][1].start),end:Object.assign({},u[f][1].end)},m={type:"strikethroughText",start:Object.assign({},u[h][1].end),end:Object.assign({},u[f][1].start)},y=[["enter",g,d],["enter",u[h][1],d],["exit",u[h][1],d],["enter",m,d]],b=d.parser.constructs.insideSpan.null;b&&cr(y,y.length,0,Zd(b,u.slice(h+1,f),d)),cr(y,y.length,0,[["exit",m,d],["enter",u[f][1],d],["exit",u[f][1],d],["exit",g,d]]),cr(u,h-1,f-h+3,y),f=h+y.length-2;break}}for(f=-1;++f<u.length;)u[f][1].type==="strikethroughSequenceTemporary"&&(u[f][1].type="data");return u}function l(u,d,f){const h=this.previous,g=this.events;let m=0;return y;function y(k){return h===126&&g[g.length-1][1].type!=="characterEscape"?f(k):(u.enter("strikethroughSequenceTemporary"),b(k))}function b(k){const j=ho(h);if(k===126)return m>1?f(k):(u.consume(k),m++,b);if(m<2&&!n)return f(k);const N=u.exit("strikethroughSequenceTemporary"),S=ho(k);return N._open=!S||S===2&&!!j,N._close=!j||j===2&&!!S,d(k)}}}class wH{constructor(){this.map=[]}add(t,n,a){kH(this,t,n,a)}consume(t){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let s=a.pop();for(;s;){for(const l of s)t.push(l);s=a.pop()}this.map.length=0}}function kH(e,t,n,a){let s=0;if(!(n===0&&a.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...a);return}s+=1}e.map.push([t,n,a])}}function SH(e,t){let n=!1;const a=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=a.length-1;a[l]=a[l]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function jH(){return{flow:{null:{name:"table",tokenize:CH,resolveAll:NH}}}}function CH(e,t,n){const a=this;let s=0,l=0,u;return d;function d(R){let P=a.events.length-1;for(;P>-1;){const I=a.events[P][1].type;if(I==="lineEnding"||I==="linePrefix")P--;else break}const F=P>-1?a.events[P][1].type:null,Z=F==="tableHead"||F==="tableRow"?_:f;return Z===_&&a.parser.lazy[a.now().line]?n(R):Z(R)}function f(R){return e.enter("tableHead"),e.enter("tableRow"),h(R)}function h(R){return R===124||(u=!0,l+=1),g(R)}function g(R){return R===null?n(R):Pe(R)?l>1?(l=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),b):n(R):it(R)?dt(e,g,"whitespace")(R):(l+=1,u&&(u=!1,s+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),m(R)))}function m(R){return R===null||R===124||At(R)?(e.exit("data"),g(R)):(e.consume(R),R===92?y:m)}function y(R){return R===92||R===124?(e.consume(R),m):m(R)}function b(R){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(R):(e.enter("tableDelimiterRow"),u=!1,it(R)?dt(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):k(R))}function k(R){return R===45||R===58?N(R):R===124?(u=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),j):B(R)}function j(R){return it(R)?dt(e,N,"whitespace")(R):N(R)}function N(R){return R===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),S):R===45?(l+=1,S(R)):R===null||Pe(R)?A(R):B(R)}function S(R){return R===45?(e.enter("tableDelimiterFiller"),T(R)):B(R)}function T(R){return R===45?(e.consume(R),T):R===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(R))}function E(R){return it(R)?dt(e,A,"whitespace")(R):A(R)}function A(R){return R===124?k(R):R===null||Pe(R)?!u||s!==l?B(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):B(R)}function B(R){return n(R)}function _(R){return e.enter("tableRow"),z(R)}function z(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),z):R===null||Pe(R)?(e.exit("tableRow"),t(R)):it(R)?dt(e,z,"whitespace")(R):(e.enter("data"),q(R))}function q(R){return R===null||R===124||At(R)?(e.exit("data"),z(R)):(e.consume(R),R===92?M:q)}function M(R){return R===92||R===124?(e.consume(R),q):q(R)}}function NH(e,t){let n=-1,a=!0,s=0,l=[0,0,0,0],u=[0,0,0,0],d=!1,f=0,h,g,m;const y=new wH;for(;++n<e.length;){const b=e[n],k=b[1];b[0]==="enter"?k.type==="tableHead"?(d=!1,f!==0&&(yk(y,t,f,h,g),g=void 0,f=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",h,t]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(a=!0,m=void 0,l=[0,0,0,0],u=[0,n+1,0,0],d&&(d=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",g,t]])),s=k.type==="tableDelimiterRow"?2:g?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,u[2]===0&&(l[1]!==0&&(u[0]=u[1],m=Bu(y,t,l,s,void 0,m),l=[0,0,0,0]),u[2]=n)):k.type==="tableCellDivider"&&(a?a=!1:(l[1]!==0&&(u[0]=u[1],m=Bu(y,t,l,s,void 0,m)),l=u,u=[l[1],n,0,0])):k.type==="tableHead"?(d=!0,f=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(f=n,l[1]!==0?(u[0]=u[1],m=Bu(y,t,l,s,n,m)):u[1]!==0&&(m=Bu(y,t,u,s,n,m)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&yk(y,t,f,h,g),y.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=SH(t.events,n))}return e}function Bu(e,t,n,a,s,l){const u=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(l.end=Object.assign({},Js(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const f=Js(t.events,n[1]);if(l={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const h=Js(t.events,n[2]),g=Js(t.events,n[3]),m={type:d,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",m,t]]),a!==2){const y=t.events[n[2]],b=t.events[n[3]];if(y[1].end=Object.assign({},b[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,j=n[3]-n[2]-1;e.add(k,j,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return s!==void 0&&(l.end=Object.assign({},Js(t.events,s)),e.add(s,0,[["exit",l,t]]),l=void 0),l}function yk(e,t,n,a,s){const l=[],u=Js(t.events,n);s&&(s.end=Object.assign({},u),l.push(["exit",s,t])),a.end=Object.assign({},u),l.push(["exit",a,t]),e.add(n+1,0,l)}function Js(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const EH={name:"tasklistCheck",tokenize:AH};function TH(){return{text:{91:EH}}}function AH(e,t,n){const a=this;return s;function s(f){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),l)}function l(f){return At(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),u):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),u):n(f)}function u(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(f)}function d(f){return Pe(f)?t(f):it(f)?e.check({tokenize:_H},t,n)(f):n(f)}}function _H(e,t,n){return dt(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function RH(e){return MC([nH(),pH(),xH(e),jH(),TH()])}const OH={};function LH(e){const t=this,n=e||OH,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),l=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),u=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(RH(n)),l.push(XF()),u.push(JF(n))}function MH(e){tN(e,[/\r?\n|\r/g,DH])}function DH(){return{type:"break"}}function zH(){return function(e){MH(e)}}const CN=[{aliases:{sh:"sh",shell:"sh",zsh:"sh",bash:"bash"},load:()=>gt(()=>import("./bash-Yzrsuije.js"),[])},{aliases:{css:"css"},load:()=>gt(()=>import("./css-CLj8gQPS.js"),[])},{aliases:{diff:"diff",patch:"diff"},load:()=>gt(()=>import("./diff-D97Zzqfu.js"),[])},{aliases:{dockerfile:"dockerfile",docker:"dockerfile"},load:()=>gt(()=>import("./dockerfile-BcOcwvcX.js"),[])},{aliases:{go:"go",golang:"go"},load:()=>gt(()=>import("./go-C27-OAKa.js"),[])},{aliases:{html:"html"},load:()=>gt(()=>import("./html-pp8916En.js"),__vite__mapDeps([3,4,5]))},{aliases:{js:"js",javascript:"js"},load:()=>gt(()=>import("./javascript-wDzz0qaB.js"),[])},{aliases:{json:"json"},load:()=>gt(()=>import("./json-Cp-IABpG.js"),[])},{aliases:{jsx:"jsx"},load:()=>gt(()=>import("./jsx-g9-lgVsj.js"),[])},{aliases:{md:"md",markdown:"md"},load:()=>gt(()=>import("./markdown-Cvjx9yec.js"),[])},{aliases:{py:"py",python:"py"},load:()=>gt(()=>import("./python-B6aJPvgy.js"),[])},{aliases:{rust:"rust",rs:"rust"},load:()=>gt(()=>import("./rust-B1yitclQ.js"),[])},{aliases:{solidity:"solidity",sol:"solidity"},load:()=>gt(()=>import("./solidity-rGO070M0.js"),[])},{aliases:{sparql:"sparql"},load:()=>gt(()=>import("./sparql-DVZY-KUA.js"),[])},{aliases:{sql:"sql"},load:()=>gt(()=>import("./sql-BLtJtn59.js"),[])},{aliases:{toml:"toml"},load:()=>gt(()=>import("./toml-vGWfd6FD.js"),[])},{aliases:{tsx:"tsx"},load:()=>gt(()=>import("./tsx-COt5Ahok.js"),[])},{aliases:{ts:"ts",typescript:"ts"},load:()=>gt(()=>import("./typescript-BPQ3VLAy.js"),[])},{aliases:{xml:"xml"},load:()=>gt(()=>import("./xml-B8PEiB0p.js"),[])},{aliases:{yaml:"yaml",yml:"yaml"},load:()=>gt(()=>import("./yaml-Buea-lGh.js"),[])}],NN=Object.freeze(Object.assign({},...CN.map(({aliases:e})=>e)));Object.freeze(Object.keys(NN));function $H(e){if(!e)return null;const t=e.toLowerCase().trim();return NN[t]??null}async function rV(){return(await Promise.all(CN.map(({load:t})=>t()))).flatMap(({default:t})=>t).filter((t,n,a)=>a.findIndex(s=>s.name===t.name)===n)}let Cl=null;function IH(){return Cl||(Cl=gt(()=>import("./shikiHighlighter-DRJC8bc5.js"),[]).then(e=>e.createHighlighter()).catch(e=>{throw Cl=null,e}),Cl)}function PH({code:e,lang:t}){const n=$H(t),[a,s]=w.useState(null),[l,u]=w.useState(!1),f=Vn(m=>m.theme)==="light"?"github-light":"github-dark",h=w.useRef(null);w.useEffect(()=>{if(!n){s(null);return}let m=!1;return IH().then(y=>{if(!m)try{s(y.codeToHtml(e,{lang:n,theme:f}))}catch{s(null)}}).catch(()=>{m||s(null)}),()=>{m=!0}},[e,n,f]),w.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const g=async()=>{try{await navigator.clipboard.writeText(e),u(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>u(!1),1200)}catch{}};return o.jsxs("div",{className:"v10-md-pre",children:[o.jsx("button",{type:"button",className:"v10-md-copy",onClick:g,"aria-label":l?"Copied":"Copy code",title:l?"Copied":"Copy code",children:l?o.jsx(aO,{size:14,"aria-hidden":"true"}):o.jsx(cO,{size:14,"aria-hidden":"true"})}),o.jsx("span",{className:"v10-md-copy-announce","aria-live":"polite",children:l?"Copied":""}),n&&o.jsx("span",{className:"v10-md-pre-lang","aria-hidden":"true",children:n}),a?o.jsx("div",{className:"v10-md-pre-rendered",dangerouslySetInnerHTML:{__html:a}}):o.jsx("pre",{className:"v10-md-pre-fallback",children:o.jsx("code",{children:e})})]})}function UH(){return e=>{let t="none",n=null;const a=new Set(["img","hr","br"]),s=(d,f)=>{const h=d.children;if(Array.isArray(h))for(let g=0;g<h.length;g++){const m=h[g];if(m.type==="text"&&typeof m.value=="string"&&m.value.trim().length>0)f?t="code":(n={siblings:h,index:g},t="text");else if(m.type==="element"){const y=m.tagName;y==="pre"?(t="code",s(m,!0)):y&&a.has(y)?t="leaf":s(m,f)}}},l=e;s(l,!1);const u={type:"element",tagName:"span",properties:{className:["v10-chat-cursor"]},children:[]};if(t==="text"&&n){const{siblings:d,index:f}=n;d.splice(f+1,0,u)}else t==="leaf"&&Array.isArray(l.children)&&l.children.push(u)}}function BH(e){return e?/^https?:\/\//i.test(e)?"http":/^mailto:/i.test(e)?"mailto":"inert":"inert"}function EN({content:e,streaming:t}){return o.jsx("div",{className:"v10-md",children:o.jsx(wB,{remarkPlugins:[LH,zH],rehypePlugins:t?[UH]:[],components:{img:({src:n,alt:a,title:s})=>o.jsxs("span",{className:"v10-md-image-placeholder",title:s||(typeof n=="string"?n:void 0),children:["[image",a?`: ${a}`:"","]"]}),h1:({children:n})=>o.jsx("h1",{className:"v10-md-h1",children:n}),h2:({children:n})=>o.jsx("h2",{className:"v10-md-h2",children:n}),h3:({children:n})=>o.jsx("h3",{className:"v10-md-h3",children:n}),h4:({children:n})=>o.jsx("h4",{className:"v10-md-h4",children:n}),h5:({children:n})=>o.jsx("h5",{className:"v10-md-h5",children:n}),h6:({children:n})=>o.jsx("h6",{className:"v10-md-h6",children:n}),p:({children:n})=>o.jsx("p",{className:"v10-md-p",children:n}),ul:({children:n})=>o.jsx("ul",{className:"v10-md-ul",children:n}),ol:({children:n})=>o.jsx("ol",{className:"v10-md-ol",children:n}),li:({children:n})=>o.jsx("li",{className:"v10-md-li",children:n}),a:({href:n,children:a})=>{const s=BH(n);return s==="http"?o.jsx("a",{className:"v10-md-link",href:n,target:"_blank",rel:"noopener noreferrer",children:a}):s==="mailto"?o.jsx("a",{className:"v10-md-link",href:n,children:a}):o.jsx("span",{className:"v10-md-link v10-md-link-inert",title:n,children:a})},blockquote:({children:n})=>o.jsx("blockquote",{className:"v10-md-blockquote",children:n}),hr:()=>o.jsx("hr",{className:"v10-md-hr"}),table:({children:n})=>o.jsx("div",{className:"v10-md-table-scroll",children:o.jsx("table",{className:"v10-md-table",children:n})}),thead:({children:n,node:a,...s})=>o.jsx("thead",{className:"v10-md-thead",...s,children:n}),tbody:({children:n,node:a,...s})=>o.jsx("tbody",{className:"v10-md-tbody",...s,children:n}),tr:({children:n,node:a,...s})=>o.jsx("tr",{className:"v10-md-tr",...s,children:n}),th:({children:n,node:a,...s})=>o.jsx("th",{className:"v10-md-th",...s,children:n}),td:({children:n,node:a,...s})=>o.jsx("td",{className:"v10-md-td",...s,children:n}),pre:({children:n,node:a})=>{var l,u,d;const s=(l=a==null?void 0:a.children)==null?void 0:l[0];if((s==null?void 0:s.tagName)==="code"){const f=((d=(u=s.properties)==null?void 0:u.className)==null?void 0:d[0])??"",h=/language-([\w-]+)/.exec(f),g=(s.children??[]).map(m=>(m==null?void 0:m.value)??"").join("").replace(/\n$/,"");return o.jsx(PH,{code:g,lang:h==null?void 0:h[1]})}return o.jsx("pre",{children:n})},code:({children:n})=>o.jsx("code",{className:"v10-md-code",children:n})},children:e})})}const FH=o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),HH=Ve.lazy(()=>gt(()=>import("./Operations-BhRo3Qzg.js"),__vite__mapDeps([6,1])).then(e=>({default:e.OperationsPage}))),qH=Ve.lazy(()=>gt(()=>import("./AgentHub-BwBMYiaM.js"),[]).then(e=>({default:e.AgentHubPage}))),GH=Ve.lazy(()=>gt(()=>import("./Settings-CwO6V6er.js"),[]).then(e=>({default:e.SettingsPage}))),VH=Ve.lazy(()=>gt(()=>import("./AgentProfilePage-Bufz0Md_.js"),[]).then(e=>({default:e.AgentProfilePage}))),WH=Ve.lazy(()=>gt(()=>import("./PublishingConviction-DzvXFq9z.js"),__vite__mapDeps([7,8])).then(e=>({default:e.PublishingConvictionPage}))),ZH=Ve.lazy(()=>gt(()=>import("./ConvictionDetailView-CiwcbT2W.js"),__vite__mapDeps([9,8])).then(e=>({default:e.ConvictionDetailView})));function KH(){const{tabs:e,activeTabId:t,setActiveTab:n,closeTab:a}=fn();return o.jsx("div",{className:"v10-center-tabs",children:e.map(s=>o.jsxs("button",{className:`v10-center-tab ${s.id===t?"active":""}`,onClick:()=>n(s.id),children:[o.jsx("span",{className:"v10-center-tab-label",children:s.label}),s.closable&&o.jsx("span",{className:"v10-center-tab-close",onClick:l=>{l.stopPropagation(),a(s.id)},children:FH})]},s.id))})}const YH=["text/","application/json","application/xml","application/javascript","application/x-yaml"];function QH(e){return YH.some(t=>e.startsWith(t))}function XH({docRef:e,contentType:t}){const{tabs:n,activeTabId:a,closeTab:s}=fn(),l=fn(R=>R.setActiveTab),[u,d]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState(""),[y,b]=w.useState(!0),[k,j]=w.useState(null),[N,S]=w.useState("formatted"),T=e.startsWith("urn:dkg:file:"),E=n.find(R=>R.id===a),A=(E==null?void 0:E.label)??"Document",B=()=>{const R=n.find(P=>P.id.startsWith("project:"));R&&l(R.id),s(a)};w.useEffect(()=>{let R=!1;if(b(!0),j(null),d(null),h(null),m(""),!T){b(!1);return}const P=e.replace("urn:dkg:file:",""),F=new AbortController;return fetch(Vu(P,t||void 0),{headers:Ft(),signal:F.signal}).then(async Z=>{if(!Z.ok)throw new Error(`HTTP ${Z.status}`);const I=Z.headers.get("content-type")??"application/octet-stream";if(!R)if(m(I),QH(I)){const $=await Z.text();R||(d($),b(!1))}else if(I.startsWith("image/")){const $=await Z.blob();R||(h(URL.createObjectURL($)),b(!1))}else if(I==="application/pdf"){const $=await Z.blob();R||(h(URL.createObjectURL($)),b(!1))}else{const $=await Z.text();R||(d($),b(!1))}}).catch(Z=>{R||(j(Z.message),b(!1))}),()=>{R=!0,F.abort()}},[e,T,t]),w.useEffect(()=>{S("formatted")},[e]),w.useEffect(()=>{const R=f;return()=>{R&&URL.revokeObjectURL(R)}},[f]);const _=g.startsWith("image/"),z=g==="application/pdf",q=g.startsWith("text/markdown")||t.startsWith("text/markdown"),M=!y&&!k&&T&&q&&u!==null;return o.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},children:[o.jsxs("div",{style:{flexShrink:0,display:"flex",alignItems:"center",gap:10,padding:"8px 16px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:[o.jsx("button",{onClick:B,style:{border:"1px solid var(--border-default)",borderRadius:5,background:"none",color:"var(--text-secondary)",fontSize:11,fontWeight:600,padding:"4px 10px",cursor:"pointer",fontFamily:"var(--font-sans)"},children:"← Back to Project"}),o.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:["📄 ",A]}),M&&o.jsx("div",{role:"group","aria-label":"Document view mode",style:{marginLeft:"auto",display:"flex",gap:2,padding:2,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-surface)"},children:["formatted","raw"].map(R=>{const P=N===R;return o.jsx("button",{type:"button","aria-pressed":P,onClick:()=>S(R),style:{border:"none",borderRadius:4,cursor:"pointer",padding:"3px 12px",fontSize:11,fontWeight:600,fontFamily:"var(--font-sans)",color:P?"var(--text-primary)":"var(--text-secondary)",background:P?"var(--bg-elevated)":"transparent"},children:R==="formatted"?"Formatted":"Raw"},R)})})]}),o.jsx("div",{style:{flex:1,overflow:"auto",padding:"20px 24px"},children:T?o.jsxs(o.Fragment,{children:[y&&o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:12},children:"Loading document..."}),k&&o.jsxs("div",{style:{color:"var(--accent-red)",fontSize:12},children:["Failed to load: ",k]}),!y&&_&&f&&o.jsx("img",{src:f,alt:A,style:{maxWidth:"100%",borderRadius:8}}),!y&&z&&f&&o.jsx("iframe",{src:f,title:A,style:{width:"100%",height:"100%",border:"none",borderRadius:8}}),u!==null&&!_&&!z&&q&&N==="formatted"&&o.jsx("div",{style:{background:"var(--bg-surface)",borderRadius:8,padding:"16px 20px",border:"1px solid var(--border-default)",color:"var(--text-primary)"},children:o.jsx(EN,{content:u})}),u!==null&&!_&&!z&&!(q&&N==="formatted")&&o.jsx("pre",{style:{fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.7,color:"var(--text-primary)",whiteSpace:"pre-wrap",wordBreak:"break-word",background:"var(--bg-surface)",borderRadius:8,padding:16,border:"1px solid var(--border-default)",margin:0},children:u})]}):o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,height:"100%",color:"var(--text-tertiary)",textAlign:"center"},children:[o.jsx("span",{style:{fontSize:28,opacity:.6},children:"📄"}),o.jsx("span",{style:{fontSize:13,fontWeight:600,color:"var(--text-secondary)"},children:"Source file not available for this document"}),o.jsx("span",{style:{fontSize:12,maxWidth:360,lineHeight:1.6},children:"This document was indexed into the graph without a stored source file, so there is nothing to preview here. You can still explore its extracted entities and relationships in the graph."})]})})]})}function JH(){const e=fn(t=>t.activeTabId);if(e==="dashboard")return o.jsx(tM,{});if(e==="operations")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading operations..."}),children:o.jsx(HH,{})});if(e==="agent-hub")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading agent hub..."}),children:o.jsx(qH,{})});if(e==="settings")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading settings..."}),children:o.jsx(GH,{})});if(e==="conviction")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading Publisher Conviction..."}),children:o.jsx(WH,{})});if(e==="memory-stack")return o.jsx(s5,{});if(e===Xg)return o.jsx(GP,{});if(e.startsWith("project:")){const t=e.slice(8);return o.jsx(HP,{contextGraphId:t})}if(e.startsWith("conviction:")){const t=e.slice(11);return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading account..."}),children:o.jsx(ZH,{accountId:t})})}if(e.startsWith("agent:")){const t=e.slice(6),n=t.indexOf("|");if(n>0){const a=t.slice(0,n),s=t.slice(n+1),l=s.includes(":")?s:`urn:dkg:agent:${s}`;return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading agent…"}),children:o.jsx(VH,{contextGraphId:a,agentUri:l})})}}if(e.startsWith(tv)){const{docRef:t,contentType:n}=MD(e);return o.jsx(XH,{docRef:t,contentType:n})}return e.startsWith("wm:")?o.jsx(Zh,{layer:"wm",contextGraphId:e.slice(3)}):e.startsWith("swm:")?o.jsx(Zh,{layer:"swm",contextGraphId:e.slice(4)}):e.startsWith("vm:")?o.jsx(Zh,{layer:"vm",contextGraphId:e.slice(3)}):o.jsx("div",{className:"v10-view-placeholder",children:o.jsxs("p",{style:{color:"var(--text-tertiary)",fontSize:12},children:['View "',e,'" coming soon.']})})}function e7(){return o.jsxs("div",{className:"v10-panel-center",children:[o.jsx(KH,{}),o.jsx("div",{className:"v10-center-content",children:o.jsx(JH,{})})]})}const t7=["Node Log","Transactions"],n7=o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("polyline",{points:"6 9 12 15 18 9"})}),r7=o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("polyline",{points:"15 3 21 3 21 9"}),o.jsx("polyline",{points:"9 21 3 21 3 15"}),o.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),o.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),a7=o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("polyline",{points:"4 14 10 14 10 20"}),o.jsx("polyline",{points:"20 10 14 10 14 4"}),o.jsx("line",{x1:"10",y1:"14",x2:"3",y2:"21"}),o.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"})]}),i7=/(\x1B\[[0-9;]*[mGKHFJA-Z]|\[[0-9;]*m)/g;function s7(e){return e.replace(i7,"")}function bk(e){const t=e.toLowerCase();return t.includes("error")||t.includes(" err ")||t.includes("[error]")?"error":t.includes("warn")||t.includes("[warn]")?"warn":t.includes("debug")||t.includes("[debug]")||t.includes("trace")?"debug":"info"}const o7={error:"var(--accent-red, #ef4444)",warn:"var(--accent-yellow, #f59e0b)",info:"var(--text-primary)",debug:"var(--text-tertiary)"};function l7(e){const t=w.useRef(null),n=w.useRef(!0);return w.useEffect(()=>{const a=t.current;if(!a)return;const s=()=>{n.current=a.scrollHeight-a.scrollTop-a.clientHeight<40};return a.addEventListener("scroll",s),()=>a.removeEventListener("scroll",s)},[]),w.useEffect(()=>{n.current&&t.current&&(t.current.scrollTop=t.current.scrollHeight)},[e]),t}function c7(){const[e,t]=w.useState([]),[n,a]=w.useState(""),[s,l]=w.useState("all"),u=w.useCallback(()=>{An.fetchNodeLog({lines:300,q:n||void 0}).then(({lines:g})=>t((g??[]).map(s7))).catch(()=>{})},[n]);w.useEffect(()=>{u();const g=setInterval(u,3e3);return()=>clearInterval(g)},[u]);const d=e.filter(g=>s==="all"||bk(g)===s),f=d.length>0?d[d.length-1]:"",h=l7(f);return o.jsxs("div",{className:"v10-log-container",children:[o.jsxs("div",{className:"v10-log-toolbar",children:[o.jsx("input",{id:"dkg-node-log-filter",name:"dkg-node-log-filter",type:"text",placeholder:"Filter logs...",className:"v10-log-filter",value:n,onChange:g=>a(g.target.value),"aria-label":"Filter node log lines"}),o.jsxs("select",{id:"dkg-node-log-level",name:"dkg-node-log-level",className:"v10-log-level-select",value:s,onChange:g=>l(g.target.value),"aria-label":"Filter node log level",children:[o.jsx("option",{value:"all",children:"All"}),o.jsx("option",{value:"error",children:"Error"}),o.jsx("option",{value:"warn",children:"Warn"}),o.jsx("option",{value:"info",children:"Info"}),o.jsx("option",{value:"debug",children:"Debug"})]})]}),o.jsxs("div",{className:"v10-log-output",ref:h,children:[d.map((g,m)=>o.jsx("div",{className:"v10-log-line",style:{color:o7[bk(g)]},children:g},m)),d.length===0&&o.jsx("div",{className:"v10-log-line",style:{color:"var(--text-tertiary)"},children:"No log output"})]})]})}const u7=new Set(["publish","publishFromSWM","update","ka-update","verify","reconstruct"]),d7={publish:"#22c55e",publishFromSWM:"#16a34a",update:"#14b8a6","ka-update":"#0d9488",verify:"#8b5cf6",reconstruct:"#fb923c"};function p7(){const[e,t]=w.useState([]),[n,a]=w.useState(null),s=w.useCallback(()=>{const l=String(Date.now()-216e5),u=[...u7].join(",");An.fetchOperationsWithPhases({limit:"100",from:l,names:u}).then(d=>{t((d==null?void 0:d.operations)??[])}).catch(()=>{})},[]);return w.useEffect(()=>{s();const l=setInterval(s,1e4);return()=>clearInterval(l)},[s]),e.length===0?o.jsx("div",{style:{padding:"20px 16px",color:"var(--text-tertiary)",fontSize:12},children:"No publish, update, or verify activity in the last 6 hours."}):o.jsx("div",{className:"v10-log-output",style:{overflowY:"auto",flex:1},children:o.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:11},children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)",color:"var(--text-secondary)",textAlign:"left"},children:[o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Type"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"ID"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Status"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Duration"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Time"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Tx Hash"})]})}),o.jsx("tbody",{children:e.map(l=>{const u=(l.phases??[]).find(h=>h.phase==="chain"),d=l.tx_hash??(u==null?void 0:u.tx_hash),f=n===l.operation_id;return o.jsxs(Ve.Fragment,{children:[o.jsxs("tr",{onClick:()=>a(h=>h===l.operation_id?null:l.operation_id),style:{borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",background:f?"rgba(255,255,255,.03)":void 0},children:[o.jsx("td",{style:{padding:"7px 12px",color:d7[l.operation_name]??"var(--text-secondary)",fontWeight:600},children:l.operation_name}),o.jsx("td",{style:{padding:"7px 12px",fontFamily:"var(--font-mono)",color:"var(--text-secondary)"},children:f1(l.operation_id)}),o.jsx("td",{style:{padding:"7px 12px"},children:o.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,fontWeight:600,background:l.status==="success"?"rgba(34,197,94,.15)":l.status==="error"?"rgba(239,68,68,.15)":"rgba(245,158,11,.15)",color:l.status==="success"?"#22c55e":l.status==="error"?"#ef4444":"#f59e0b"},children:l.status})}),o.jsx("td",{style:{padding:"7px 12px",color:"var(--text-secondary)"},children:l.duration_ms!=null?p1(l.duration_ms):"—"}),o.jsx("td",{style:{padding:"7px 12px",color:"var(--text-secondary)"},children:l.started_at?l4(l.started_at):"—"}),o.jsx("td",{style:{padding:"7px 12px",fontFamily:"var(--font-mono)",color:"var(--text-tertiary)",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d?`${d.slice(0,10)}…`:l.status==="success"?o.jsx("span",{style:{fontFamily:"var(--font-sans)",fontStyle:"italic",color:"var(--text-tertiary)"},children:"local"}):"—"})]}),f&&o.jsx("tr",{style:{background:"rgba(0,0,0,.2)"},children:o.jsxs("td",{colSpan:6,style:{padding:"8px 16px"},children:[o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:16,fontSize:11,color:"var(--text-secondary)"},children:[o.jsxs("span",{children:[o.jsx("b",{children:"ID:"})," ",o.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:l.operation_id})]}),d&&o.jsxs("span",{children:[o.jsx("b",{children:"Tx:"})," ",o.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:d})]}),l.peer_id&&o.jsxs("span",{children:[o.jsx("b",{children:"Peer:"})," ",o.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:f1(l.peer_id)})]}),l.error_message&&o.jsxs("span",{style:{color:"#ef4444"},children:[o.jsx("b",{children:"Error:"})," ",l.error_message]})]}),(l.phases??[]).length>0&&o.jsx("div",{style:{marginTop:8,display:"flex",gap:6,flexWrap:"wrap"},children:l.phases.map(h=>o.jsxs("span",{style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:600,background:"rgba(255,255,255,.06)",color:"var(--text-secondary)"},children:[h.phase," ",h.duration_ms!=null?p1(h.duration_ms):""]},h.phase))})]})})]},l.operation_id)})})]})})}function f7(){const{bottomCollapsed:e,toggleBottom:t,bottomMaximised:n,toggleBottomMaximised:a,bottomHeight:s,setBottomHeight:l}=Vn(),[u,d]=w.useState("Node Log"),f=w.useRef(null),h=w.useRef(s);h.current=s,w.useEffect(()=>{const m=f.current;if(!m)return;let y=0;const b=N=>{const S=y-N.clientY;y=N.clientY,l(h.current+S)},k=()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",k),document.body.style.cursor="",document.body.style.userSelect="",m.classList.remove("active")},j=N=>{N.preventDefault(),y=N.clientY,document.addEventListener("mousemove",b),document.addEventListener("mouseup",k),document.body.style.cursor="row-resize",document.body.style.userSelect="none",m.classList.add("active")};return m.addEventListener("mousedown",j),()=>m.removeEventListener("mousedown",j)},[l]);const g=e?void 0:n?"80vh":Math.min(s,sd());return o.jsxs("div",{className:`v10-panel-bottom ${e?"collapsed":""} ${n?"maximised":""}`,style:e?void 0:{height:g},children:[!e&&!n&&o.jsx("div",{className:"v10-resize-handle-v",ref:f,title:"Drag to resize"}),o.jsxs("div",{className:"v10-bottom-tabs",children:[t7.map(m=>o.jsx("button",{className:`v10-bottom-tab ${m===u?"active":""}`,onClick:()=>{d(m),e&&t()},children:m},m)),o.jsx("div",{style:{flex:1}}),o.jsx("button",{className:"v10-bottom-toggle",onClick:a,title:n?"Restore":"Maximise",style:{display:e?"none":void 0},children:n?a7:r7}),o.jsx("button",{className:"v10-bottom-toggle",onClick:t,title:e?"Expand":"Collapse",children:o.jsx("span",{style:{transform:e?"rotate(180deg)":"none",display:"flex",transition:"transform 0.15s"},children:n7})})]}),!e&&o.jsxs("div",{className:"v10-bottom-content",children:[u==="Node Log"&&o.jsx(c7,{}),u==="Transactions"&&o.jsx(p7,{})]})]})}function xk(e){const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function Cd(e){if(e==null||e==="")return"";const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.valueOf())?typeof e=="string"?e:"":t.toLocaleString([],{dateStyle:"medium",timeStyle:"short"})}function rg(e){if(e==null||e==="")return;const t=e instanceof Date?e:new Date(e);if(!Number.isNaN(t.valueOf()))return t.toISOString()}function h7(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function m7(e){var n;const t=((n=e.split(".").pop())==null?void 0:n.toLowerCase())??"";return["md","txt","csv","json","xml","yaml","yml"].includes(t)?"TXT":["pdf"].includes(t)?"PDF":["docx","doc"].includes(t)?"DOC":["png","jpg","jpeg","webp"].includes(t)?"IMG":["py","ts","js","tsx","jsx","java","go","rs","c","cpp"].includes(t)?"CODE":"FILE"}function ag(e,t){var n;return((n=e.find(a=>a.id===t))==null?void 0:n.name)??t}function g7(e){return e.startsWith("did:dkg:context-graph:")?e:`did:dkg:context-graph:${e}`}function v7(e){return String(e??"").replace(/[\u0000-\u001F\u007F]/g," ").replace(/\s+/g," ").trim()}function TN(e){if(e.length===0)return"";const t=e.map(n=>n.fileName);return t.length<=2?`Attached ${t.join(" and ")}.`:`Attached ${t[0]} and ${t.length-1} more files.`}function AN(e){return e.status==="queued"||e.status==="completed"||e.status==="skipped"}function _N(e){return e.name.trim()}function y7(e){if(e.status!=="completed"||!e.result)return null;const t=e.result.extraction.mdIntermediateHash,n=t??(e.result.detectedContentType==="text/markdown"?e.result.fileHash:void 0);return{id:e.id,fileName:_N(e.file),contextGraphId:e.contextGraphId,assertionName:e.assertionName,assertionUri:e.result.assertionUri,fileHash:e.result.fileHash,detectedContentType:e.result.detectedContentType,rootEntity:e.result.rootEntity,extractionStatus:"completed",tripleCount:e.result.extraction.tripleCount??e.result.extraction.triplesWritten,...t?{mdIntermediateHash:t}:{},...n?{markdownHash:n,markdownForm:`urn:dkg:file:${n}`}:{}}}function b7(e){const t=[];return{results:e.flatMap(a=>{if(a.status!=="skipped"||!a.result)return[];t.push(a.id);const s=a.result,l=s.extraction;return[{id:a.id,fileName:_N(a.file),contextGraphId:a.contextGraphId,assertionName:a.assertionName,assertionUri:s.assertionUri,fileHash:s.fileHash,detectedContentType:s.detectedContentType,extractionStatus:"skipped",pipelineUsed:l.pipelineUsed??null,tripleCount:l.tripleCount??l.triplesWritten??0,...s.rootEntity?{rootEntity:s.rootEntity}:{},...l.mdIntermediateHash?{mdIntermediateHash:l.mdIntermediateHash}:{},...l.error?{error:l.error}:{}}]}),deliveredDraftIds:t}}function RN(e){return e.length===0?"":e.length===1?`Attachment import result: ${v7(e[0].fileName)}.`:`Attached ${e.length} document import results.`}function x7(e,t){const n=[TN(e),RN(t)].filter(a=>a.length>0).map(a=>a.replace(/\.$/,""));return n.length?`${n.join("; ")}.`:""}function w7(e,t,n){const a=[];if(t){const s=ag(e,t);a.push({key:"target_context_graph",label:"Target context graph id",value:t}),a.push({key:"target_context_graph_uri",label:"Target context graph URI",value:g7(t)}),a.push({key:"target_context_graph_name",label:"Target context graph name",value:s})}return n!=null&&n.agentAddress&&a.push({key:"current_agent_address",label:"Current agent address",value:n.agentAddress}),n!=null&&n.agentDid&&a.push({key:"current_agent_did",label:"Current agent DID",value:n.agentDid}),n!=null&&n.peerId&&a.push({key:"current_agent_peer_id",label:"Current agent peer ID",value:n.peerId}),a}const k7="https://docs.openclaw.ai/",S7="https://github.com/openclaw/openclaw/releases",Xi="__add_agent__",j7=["openclaw"];function C7(e,t){const n=t instanceof Error?t.message:String(t??"Unknown error");if(t instanceof wm){if(t.code==="HERMES_BRIDGE_RESPONSE_TIMEOUT")return`${e.name} bridge response timed out.`;if(t.code==="HERMES_GATEWAY_RESPONSE_TIMEOUT")return`${e.name} gateway response timed out.`;if(t.code==="OPENCLAW_BRIDGE_RESPONSE_TIMEOUT")return`${e.name} bridge response timed out.`;if(t.code==="OPENCLAW_GATEWAY_RESPONSE_TIMEOUT")return`${e.name} gateway response timed out.`;if(t.code==="SWM_SYNC_TIMEOUT"||t.source==="background-sync")return"Background sync timed out. The chat request was not marked as failed by the local-agent bridge."}return/OpenClaw bridge unreachable/i.test(n)?`${e.name} is unavailable right now.`:/Hermes bridge unreachable/i.test(n)?`${e.name} is unavailable right now.`:/gateway response timeout/i.test(n)?`${e.name} gateway response timed out.`:/bridge response timeout/i.test(n)||/aborted due to timeout/i.test(n)?`${e.name} bridge response timed out.`:/Agent response timeout/i.test(n)?`${e.name} took too long to respond.`:/Agent returned no text response/i.test(n)||/\(no response\)/i.test(n)?`${e.name} did not return a text reply.`:n}let N7=0;function E7(e,t,n){const a=e.trim();return a?a===t?!0:n==="Request cancelled."&&a===n:!1}function T7(e,t,n,a){return e&&E7(e,t,n)?{content:e,synthesized:!0}:e?a==="hermes"?{content:e,failureNotice:t,synthesized:!1}:{content:e,synthesized:!1}:{content:"",failureNotice:t,synthesized:!0}}function wk(e,t=""){const n=e.author.toLowerCase(),a=n.includes("assistant")||n.includes("agent")?"assistant":"user",s=typeof e.failureReason=="string"&&e.failureReason.trim()?e.failureReason.trim():void 0,l=a==="assistant"&&(e.persistStatus==="failed"||!!s),u=`Error: ${s??"The local agent turn failed."}`,d=l?T7(e.text,u,s,t):null,f=(d==null?void 0:d.content)??(e.text||TN(e.attachmentRefs??[])),h=!!e.text;return{id:e.uri||`local-history:${++N7}`,uri:e.uri,turnId:e.turnId,role:a,content:f,ts:Cd(e.ts),tsRaw:rg(e.ts),attachments:e.attachmentRefs,failureNotice:d==null?void 0:d.failureNotice,synthesized:(d==null?void 0:d.synthesized)??!h}}function A7(e){return e.turnId?`turn:${e.turnId}:${e.role}`:e.uri??`${e.role}:${e.ts??""}:${e.content}`}function kk(e,t){const n=new Set,a=[];for(const s of[...t,...e]){const l=A7(s);n.has(l)||(n.add(l),a.push(s))}return a}function Sk(e,t,n){const a=typeof n=="string"&&n.trim()?n.trim():t;return!a||a===t?e:e.map(s=>s.turnId===t?{...s,turnId:a}:s)}function jk(e){return e.replace(/\r\n/g,`
1653
+ `).replace(/^(?:[ \t]*\n)+/,"").replace(/(?:\n[ \t]*)+$/,"")}function _7(e,t,n,a,s){const l=jk(e),u=s?jk(s):"";if(t==="assistant"&&a&&l.trim()===""&&!u)return o.jsx("span",{className:"v10-chat-thinking",role:"status","aria-live":"polite",children:"Thinking…"});if(t==="assistant"&&!n&&l.trim()!=="")return o.jsxs(o.Fragment,{children:[o.jsx(EN,{content:l,streaming:a&&!u}),u&&o.jsxs("span",{className:"v10-chat-plaintext v10-chat-failure-notice",children:[u,a&&o.jsx("span",{className:"v10-chat-cursor"})]})]});const d=[l,u].filter(Boolean).join(`
1654
+
1655
+ `);return o.jsxs("span",{className:"v10-chat-plaintext",children:[d,a&&o.jsx("span",{className:"v10-chat-cursor"})]})}function ig(){return ig=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},ig.apply(null,arguments)}function R7(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;n[a]=e[a]}return n}var O7=w.useLayoutEffect,L7=function(t){var n=Ve.useRef(t);return O7(function(){n.current=t}),n},Ck=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},M7=function(t,n){var a=Ve.useRef();return Ve.useCallback(function(s){t.current=s,a.current&&Ck(a.current,null),a.current=n,n&&Ck(n,s)},[n])},Nk={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},D7=function(t){Object.keys(Nk).forEach(function(n){t.style.setProperty(n,Nk[n],"important")})},Ek=D7,On=null,Tk=function(t,n){var a=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?a+n.borderSize:a-n.paddingSize};function z7(e,t,n,a){n===void 0&&(n=1),a===void 0&&(a=1/0),On||(On=document.createElement("textarea"),On.setAttribute("tabindex","-1"),On.setAttribute("aria-hidden","true"),Ek(On)),On.parentNode===null&&document.body.appendChild(On);var s=e.paddingSize,l=e.borderSize,u=e.sizingStyle,d=u.boxSizing;Object.keys(u).forEach(function(y){var b=y;On.style[b]=u[b]}),Ek(On),On.value=t;var f=Tk(On,e);On.value=t,f=Tk(On,e),On.value="x";var h=On.scrollHeight-s,g=h*n;d==="border-box"&&(g=g+s+l),f=Math.max(g,f);var m=h*a;return d==="border-box"&&(m=m+s+l),f=Math.min(m,f),[f,h]}var Ak=function(){},$7=function(t,n){return t.reduce(function(a,s){return a[s]=n[s],a},{})},I7=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],P7=!!document.documentElement.currentStyle,U7=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var a=$7(I7,n),s=a.boxSizing;if(s==="")return null;P7&&s==="border-box"&&(a.width=parseFloat(a.width)+parseFloat(a.borderRightWidth)+parseFloat(a.borderLeftWidth)+parseFloat(a.paddingRight)+parseFloat(a.paddingLeft)+"px");var l=parseFloat(a.paddingBottom)+parseFloat(a.paddingTop),u=parseFloat(a.borderBottomWidth)+parseFloat(a.borderTopWidth);return{sizingStyle:a,paddingSize:l,borderSize:u}},B7=U7;function Lv(e,t,n){var a=L7(n);w.useLayoutEffect(function(){var s=function(u){return a.current(u)};if(e)return e.addEventListener(t,s),function(){return e.removeEventListener(t,s)}},[])}var F7=function(t,n){Lv(document.body,"reset",function(a){t.current.form===a.target&&n(a)})},H7=function(t){Lv(window,"resize",t)},q7=function(t){Lv(document.fonts,"loadingdone",t)},G7=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],V7=function(t,n){var a=t.cacheMeasurements,s=t.maxRows,l=t.minRows,u=t.onChange,d=u===void 0?Ak:u,f=t.onHeightChange,h=f===void 0?Ak:f,g=R7(t,G7),m=g.value!==void 0,y=w.useRef(null),b=M7(y,n),k=w.useRef(0),j=w.useRef(),N=function(){var E=y.current,A=a&&j.current?j.current:B7(E);if(A){j.current=A;var B=z7(A,E.value||E.placeholder||"x",l,s),_=B[0],z=B[1];k.current!==_&&(k.current=_,E.style.setProperty("height",_+"px","important"),h(_,{rowHeight:z}))}},S=function(E){m||N(),d(E)};return w.useLayoutEffect(N),F7(y,function(){if(!m){var T=y.current.value;requestAnimationFrame(function(){var E=y.current;E&&T!==E.value&&N()})}}),H7(N),q7(N),w.createElement("textarea",ig({},g,{onChange:S,ref:b}))},W7=w.forwardRef(V7),fm={exports:{}},hm,_k;function Z7(){if(_k)return hm;_k=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return hm=e,hm}var mm,Rk;function K7(){if(Rk)return mm;Rk=1;var e=Z7();function t(){}function n(){}return n.resetWarningCache=t,mm=function(){function a(u,d,f,h,g,m){if(m!==e){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}}a.isRequired=a;function s(){return a}var l={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:s,element:a,elementType:a,instanceOf:s,node:a,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:n,resetWarningCache:t};return l.PropTypes=l,l},mm}var Ok;function Y7(){return Ok||(Ok=1,fm.exports=K7()()),fm.exports}var Q7=Y7();const Tt=Wl(Q7);function ds(e,t,n,a){function s(l){return l instanceof n?l:new n(function(u){u(l)})}return new(n||(n=Promise))(function(l,u){function d(g){try{h(a.next(g))}catch(m){u(m)}}function f(g){try{h(a.throw(g))}catch(m){u(m)}}function h(g){g.done?l(g.value):s(g.value).then(d,f)}h((a=a.apply(e,t||[])).next())})}const X7=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function mo(e,t,n){const a=J7(e),{webkitRelativePath:s}=e,l=typeof t=="string"?t:typeof s=="string"&&s.length>0?s:`./${e.name}`;return typeof a.path!="string"&&Lk(a,"path",l),Lk(a,"relativePath",l),a}function J7(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const a=t.split(".").pop().toLowerCase(),s=X7.get(a);s&&Object.defineProperty(e,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return e}function Lk(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const eq=[".DS_Store","Thumbs.db"];function tq(e){return ds(this,void 0,void 0,function*(){return Nd(e)&&nq(e.dataTransfer)?sq(e.dataTransfer,e.type):rq(e)?aq(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?iq(e):[]})}function nq(e){return Nd(e)}function rq(e){return Nd(e)&&Nd(e.target)}function Nd(e){return typeof e=="object"&&e!==null}function aq(e){return sg(e.target.files).map(t=>mo(t))}function iq(e){return ds(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>mo(n))})}function sq(e,t){return ds(this,void 0,void 0,function*(){if(e.items){const n=sg(e.items).filter(s=>s.kind==="file");if(t!=="drop")return n;const a=yield Promise.all(n.map(oq));return Mk(ON(a))}return Mk(sg(e.files).map(n=>mo(n)))})}function Mk(e){return e.filter(t=>eq.indexOf(t.name)===-1)}function sg(e){if(e===null)return[];const t=[];for(let n=0;n<e.length;n++){const a=e[n];t.push(a)}return t}function oq(e){if(typeof e.webkitGetAsEntry!="function")return Dk(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?LN(t):Dk(e,t)}function ON(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?ON(n):[n]],[])}function Dk(e,t){return ds(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const l=yield e.getAsFileSystemHandle();if(l===null)throw new Error(`${e} is not a File`);if(l!==void 0){const u=yield l.getFile();return u.handle=l,mo(u)}}const a=e.getAsFile();if(!a)throw new Error(`${e} is not a File`);return mo(a,(n=t==null?void 0:t.fullPath)!==null&&n!==void 0?n:void 0)})}function lq(e){return ds(this,void 0,void 0,function*(){return e.isDirectory?LN(e):cq(e)})}function LN(e){const t=e.createReader();return new Promise((n,a)=>{const s=[];function l(){t.readEntries(u=>ds(this,void 0,void 0,function*(){if(u.length){const d=Promise.all(u.map(lq));s.push(d),l()}else try{const d=yield Promise.all(s);n(d)}catch(d){a(d)}}),u=>{a(u)})}l()})}function cq(e){return ds(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(a=>{const s=mo(a,e.fullPath);t(s)},a=>{n(a)})})})}var Fu={},zk;function uq(){return zk||(zk=1,Fu.__esModule=!0,Fu.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(",");if(n.length===0)return!0;var a=e.name||"",s=(e.type||"").toLowerCase(),l=s.replace(/\/.*$/,"");return n.some(function(u){var d=u.trim().toLowerCase();return d.charAt(0)==="."?a.toLowerCase().endsWith(d):d.endsWith("/*")?l===d.replace(/\/.*$/,""):s===d})}return!0}),Fu}var dq=uq();const gm=Wl(dq);function $k(e){return hq(e)||fq(e)||DN(e)||pq()}function pq(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1656
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fq(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function hq(e){if(Array.isArray(e))return og(e)}function Ik(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,a)}return n}function Pk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ik(Object(n),!0).forEach(function(a){MN(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ik(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function MN(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vl(e,t){return vq(e)||gq(e,t)||DN(e,t)||mq()}function mq(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1657
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DN(e,t){if(e){if(typeof e=="string")return og(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return og(e,t)}}function og(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function gq(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var a=[],s=!0,l=!1,u,d;try{for(n=n.call(e);!(s=(u=n.next()).done)&&(a.push(u.value),!(t&&a.length===t));s=!0);}catch(f){l=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(l)throw d}}return a}}function vq(e){if(Array.isArray(e))return e}var yq=typeof gm=="function"?gm:gm.default,bq="file-invalid-type",xq="file-too-large",wq="file-too-small",kq="too-many-files",Sq=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),a=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:bq,message:"File type must be ".concat(a)}},Uk=function(t){return{code:xq,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},Bk=function(t){return{code:wq,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},jq={code:kq,message:"Too many files"};function Cq(e){return e.type===""&&typeof e.getAsFile=="function"}function zN(e,t){var n=e.type==="application/x-moz-file"||yq(e,t)||Cq(e);return[n,n?null:Sq(t)]}function $N(e,t,n){if(Qi(e.size))if(Qi(t)&&Qi(n)){if(e.size>n)return[!1,Uk(n)];if(e.size<t)return[!1,Bk(t)]}else{if(Qi(t)&&e.size<t)return[!1,Bk(t)];if(Qi(n)&&e.size>n)return[!1,Uk(n)]}return[!0,null]}function Qi(e){return e!=null}function Nq(e){var t=e.files,n=e.accept,a=e.minSize,s=e.maxSize,l=e.multiple,u=e.maxFiles,d=e.validator;return!l&&t.length>1||l&&u>=1&&t.length>u?!1:t.every(function(f){var h=zN(f,n),g=Vl(h,1),m=g[0],y=$N(f,a,s),b=Vl(y,1),k=b[0],j=d?d(f):null;return m&&k&&!j})}function Ed(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Nl(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function Fk(e){e.preventDefault()}function Eq(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function Tq(e){return e.indexOf("Edge/")!==-1}function Aq(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Eq(e)||Tq(e)}function ea(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(a){for(var s=arguments.length,l=new Array(s>1?s-1:0),u=1;u<s;u++)l[u-1]=arguments[u];return t.some(function(d){return!Ed(a)&&d&&d.apply(void 0,[a].concat(l)),Ed(a)})}}function _q(){return"showOpenFilePicker"in window}function Rq(e){if(Qi(e)){var t=Object.entries(e).filter(function(n){var a=Vl(n,2),s=a[0],l=a[1],u=!0;return IN(s)||(console.warn('Skipped "'.concat(s,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),u=!1),(!Array.isArray(l)||!l.every(PN))&&(console.warn('Skipped "'.concat(s,'" because an invalid file extension was provided.')),u=!1),u}).reduce(function(n,a){var s=Vl(a,2),l=s[0],u=s[1];return Pk(Pk({},n),{},MN({},l,u))},{});return[{description:"Files",accept:t}]}return e}function Oq(e){if(Qi(e))return Object.entries(e).reduce(function(t,n){var a=Vl(n,2),s=a[0],l=a[1];return[].concat($k(t),[s],$k(l))},[]).filter(function(t){return IN(t)||PN(t)}).join(",")}function Lq(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function Mq(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function IN(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function PN(e){return/^.*\.[\w]+$/.test(e)}var Dq=["children"],zq=["open"],$q=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Iq=["refKey","onChange","onClick"];function Hk(e){return Bq(e)||Uq(e)||UN(e)||Pq()}function Pq(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1658
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uq(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Bq(e){if(Array.isArray(e))return lg(e)}function vm(e,t){return qq(e)||Hq(e,t)||UN(e,t)||Fq()}function Fq(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1659
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UN(e,t){if(e){if(typeof e=="string")return lg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lg(e,t)}}function lg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function Hq(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var a=[],s=!0,l=!1,u,d;try{for(n=n.call(e);!(s=(u=n.next()).done)&&(a.push(u.value),!(t&&a.length===t));s=!0);}catch(f){l=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(l)throw d}}return a}}function qq(e){if(Array.isArray(e))return e}function qk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,a)}return n}function zt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qk(Object(n),!0).forEach(function(a){cg(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qk(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function cg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Td(e,t){if(e==null)return{};var n=Gq(e,t),a,s;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s<l.length;s++)a=l[s],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}function Gq(e,t){if(e==null)return{};var n={},a=Object.keys(e),s,l;for(l=0;l<a.length;l++)s=a[l],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Mv=w.forwardRef(function(e,t){var n=e.children,a=Td(e,Dq),s=FN(a),l=s.open,u=Td(s,zq);return w.useImperativeHandle(t,function(){return{open:l}},[l]),Ve.createElement(w.Fragment,null,n(zt(zt({},u),{},{open:l})))});Mv.displayName="Dropzone";var BN={disabled:!1,getFilesFromEvent:tq,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};Mv.defaultProps=BN;Mv.propTypes={children:Tt.func,accept:Tt.objectOf(Tt.arrayOf(Tt.string)),multiple:Tt.bool,preventDropOnDocument:Tt.bool,noClick:Tt.bool,noKeyboard:Tt.bool,noDrag:Tt.bool,noDragEventsBubbling:Tt.bool,minSize:Tt.number,maxSize:Tt.number,maxFiles:Tt.number,disabled:Tt.bool,getFilesFromEvent:Tt.func,onFileDialogCancel:Tt.func,onFileDialogOpen:Tt.func,useFsAccessApi:Tt.bool,autoFocus:Tt.bool,onDragEnter:Tt.func,onDragLeave:Tt.func,onDragOver:Tt.func,onDrop:Tt.func,onDropAccepted:Tt.func,onDropRejected:Tt.func,onError:Tt.func,validator:Tt.func};var ug={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function FN(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=zt(zt({},BN),e),n=t.accept,a=t.disabled,s=t.getFilesFromEvent,l=t.maxSize,u=t.minSize,d=t.multiple,f=t.maxFiles,h=t.onDragEnter,g=t.onDragLeave,m=t.onDragOver,y=t.onDrop,b=t.onDropAccepted,k=t.onDropRejected,j=t.onFileDialogCancel,N=t.onFileDialogOpen,S=t.useFsAccessApi,T=t.autoFocus,E=t.preventDropOnDocument,A=t.noClick,B=t.noKeyboard,_=t.noDrag,z=t.noDragEventsBubbling,q=t.onError,M=t.validator,R=w.useMemo(function(){return Oq(n)},[n]),P=w.useMemo(function(){return Rq(n)},[n]),F=w.useMemo(function(){return typeof N=="function"?N:Gk},[N]),Z=w.useMemo(function(){return typeof j=="function"?j:Gk},[j]),I=w.useRef(null),$=w.useRef(null),H=w.useReducer(Vq,ug),V=vm(H,2),X=V[0],Y=V[1],L=X.isFocused,U=X.isFileDialogActive,G=w.useRef(typeof window<"u"&&window.isSecureContext&&S&&_q()),O=function(){!G.current&&U&&setTimeout(function(){if($.current){var Q=$.current.files;Q.length||(Y({type:"closeDialog"}),Z())}},300)};w.useEffect(function(){return window.addEventListener("focus",O,!1),function(){window.removeEventListener("focus",O,!1)}},[$,U,Z,G]);var ne=w.useRef([]),ue=w.useRef([]),le=function(Q){I.current&&I.current.contains(Q.target)||(Q.preventDefault(),ne.current=[])};w.useEffect(function(){return E&&(document.addEventListener("dragover",Fk,!1),document.addEventListener("drop",le,!1)),function(){E&&(document.removeEventListener("dragover",Fk),document.removeEventListener("drop",le))}},[I,E]),w.useEffect(function(){var ye=function(he){ue.current=[].concat(Hk(ue.current),[he.target]),Nl(he)&&Y({isDragGlobal:!0,type:"setDragGlobal"})},Q=function(he){ue.current=ue.current.filter(function(Le){return Le!==he.target&&Le!==null}),!(ue.current.length>0)&&Y({isDragGlobal:!1,type:"setDragGlobal"})},W=function(){ue.current=[],Y({isDragGlobal:!1,type:"setDragGlobal"})},ee=function(){ue.current=[],Y({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",ye,!1),document.addEventListener("dragleave",Q,!1),document.addEventListener("dragend",W,!1),document.addEventListener("drop",ee,!1),function(){document.removeEventListener("dragenter",ye),document.removeEventListener("dragleave",Q),document.removeEventListener("dragend",W),document.removeEventListener("drop",ee)}},[I]),w.useEffect(function(){return!a&&T&&I.current&&I.current.focus(),function(){}},[I,T,a]);var be=w.useCallback(function(ye){q?q(ye):console.error(ye)},[q]),_e=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),$t(ye),ne.current=[].concat(Hk(ne.current),[ye.target]),Nl(ye)&&Promise.resolve(s(ye)).then(function(Q){if(!(Ed(ye)&&!z)){var W=Q.length,ee=W>0&&Nq({files:Q,accept:R,minSize:u,maxSize:l,multiple:d,maxFiles:f,validator:M}),ce=W>0&&!ee;Y({isDragAccept:ee,isDragReject:ce,isDragActive:!0,type:"setDraggedFiles"}),h&&h(ye)}}).catch(function(Q){return be(Q)})},[s,h,be,z,R,u,l,d,f,M]),Ee=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),$t(ye);var Q=Nl(ye);if(Q&&ye.dataTransfer)try{ye.dataTransfer.dropEffect="copy"}catch{}return Q&&m&&m(ye),!1},[m,z]),Ie=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),$t(ye);var Q=ne.current.filter(function(ee){return I.current&&I.current.contains(ee)}),W=Q.indexOf(ye.target);W!==-1&&Q.splice(W,1),ne.current=Q,!(Q.length>0)&&(Y({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Nl(ye)&&g&&g(ye))},[I,g,z]),We=w.useCallback(function(ye,Q){var W=[],ee=[];ye.forEach(function(ce){var he=zN(ce,R),Le=vm(he,2),He=Le[0],Ce=Le[1],Fe=$N(ce,u,l),et=vm(Fe,2),Ne=et[0],Wt=et[1],_t=M?M(ce):null;if(He&&Ne&&!_t)W.push(ce);else{var Hr=[Ce,Wt];_t&&(Hr=Hr.concat(_t)),ee.push({file:ce,errors:Hr.filter(function(dr){return dr})})}}),(!d&&W.length>1||d&&f>=1&&W.length>f)&&(W.forEach(function(ce){ee.push({file:ce,errors:[jq]})}),W.splice(0)),Y({acceptedFiles:W,fileRejections:ee,type:"setFiles"}),y&&y(W,ee,Q),ee.length>0&&k&&k(ee,Q),W.length>0&&b&&b(W,Q)},[Y,d,R,u,l,f,y,b,k,M]),Se=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),$t(ye),ne.current=[],Nl(ye)&&Promise.resolve(s(ye)).then(function(Q){Ed(ye)&&!z||We(Q,ye)}).catch(function(Q){return be(Q)}),Y({type:"reset"})},[s,We,be,z]),ft=w.useCallback(function(){if(G.current){Y({type:"openDialog"}),F();var ye={multiple:d,types:P};window.showOpenFilePicker(ye).then(function(Q){return s(Q)}).then(function(Q){We(Q,null),Y({type:"closeDialog"})}).catch(function(Q){Lq(Q)?(Z(Q),Y({type:"closeDialog"})):Mq(Q)?(G.current=!1,$.current?($.current.value=null,$.current.click()):be(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):be(Q)});return}$.current&&(Y({type:"openDialog"}),F(),$.current.value=null,$.current.click())},[Y,F,Z,S,We,be,P,d]),De=w.useCallback(function(ye){!I.current||!I.current.isEqualNode(ye.target)||(ye.key===" "||ye.key==="Enter"||ye.keyCode===32||ye.keyCode===13)&&(ye.preventDefault(),ft())},[I,ft]),qe=w.useCallback(function(){Y({type:"focus"})},[]),ke=w.useCallback(function(){Y({type:"blur"})},[]),lt=w.useCallback(function(){A||(Aq()?setTimeout(ft,0):ft())},[A,ft]),xe=function(Q){return a?null:Q},Oe=function(Q){return B?null:xe(Q)},Ot=function(Q){return _?null:xe(Q)},$t=function(Q){z&&Q.stopPropagation()},Yt=w.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Q=ye.refKey,W=Q===void 0?"ref":Q,ee=ye.role,ce=ye.onKeyDown,he=ye.onFocus,Le=ye.onBlur,He=ye.onClick,Ce=ye.onDragEnter,Fe=ye.onDragOver,et=ye.onDragLeave,Ne=ye.onDrop,Wt=Td(ye,$q);return zt(zt(cg({onKeyDown:Oe(ea(ce,De)),onFocus:Oe(ea(he,qe)),onBlur:Oe(ea(Le,ke)),onClick:xe(ea(He,lt)),onDragEnter:Ot(ea(Ce,_e)),onDragOver:Ot(ea(Fe,Ee)),onDragLeave:Ot(ea(et,Ie)),onDrop:Ot(ea(Ne,Se)),role:typeof ee=="string"&&ee!==""?ee:"presentation"},W,I),!a&&!B?{tabIndex:0}:{}),Wt)}},[I,De,qe,ke,lt,_e,Ee,Ie,Se,B,_,a]),qt=w.useCallback(function(ye){ye.stopPropagation()},[]),ut=w.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Q=ye.refKey,W=Q===void 0?"ref":Q,ee=ye.onChange,ce=ye.onClick,he=Td(ye,Iq),Le=cg({accept:R,multiple:d,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:xe(ea(ee,Se)),onClick:xe(ea(ce,qt)),tabIndex:-1},W,$);return zt(zt({},Le),he)}},[$,n,d,Se,a]);return zt(zt({},X),{},{isFocused:L&&!a,getRootProps:Yt,getInputProps:ut,rootRef:I,inputRef:$,open:xe(ft)})}function Vq(e,t){switch(t.type){case"focus":return zt(zt({},e),{},{isFocused:!0});case"blur":return zt(zt({},e),{},{isFocused:!1});case"openDialog":return zt(zt({},ug),{},{isFileDialogActive:!0});case"closeDialog":return zt(zt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return zt(zt({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return zt(zt({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return zt(zt({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return zt({},ug);default:return e}}function Gk(){}function Wq({value:e,onChange:t,options:n,placeholder:a="Select…",disabled:s=!1,className:l,ariaLabel:u,prefixIcon:d}){const[f,h]=w.useState(!1),[g,m]=w.useState(null),[y,b]=w.useState(()=>{const M=n.findIndex(R=>R.value===e);return M>=0?M:0}),k=w.useRef(null),j=w.useRef(null),N=w.useRef(null),S=n.find(M=>M.value===e),T=(S==null?void 0:S.label)??a,E=w.useCallback(()=>{var M;h(!1),(M=j.current)==null||M.focus()},[]),A=w.useCallback(()=>{const M=j.current;if(!M)return;const R=M.getBoundingClientRect(),P=Math.min(240,n.length*36+16),F=window.innerHeight-R.bottom,Z=R.top,I=F<P+16&&Z>F?"above":"below";m({left:R.left,top:I==="below"?R.bottom+4:R.top-4,width:R.width,placement:I})},[n.length]);w.useLayoutEffect(()=>{f&&A()},[f,A]),w.useEffect(()=>{if(!f)return;const M=()=>A(),R=()=>A(),P=Z=>{var $,H;const I=Z.target;($=k.current)!=null&&$.contains(I)||(H=N.current)!=null&&H.contains(I)||h(!1)},F=Z=>{Z.key==="Escape"&&(Z.preventDefault(),E())};return window.addEventListener("scroll",M,!0),window.addEventListener("resize",R),document.addEventListener("mousedown",P),document.addEventListener("keydown",F),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",R),document.removeEventListener("mousedown",P),document.removeEventListener("keydown",F)}},[f,E,A]),w.useEffect(()=>{if(f){const M=n.findIndex(R=>R.value===e);b(M>=0?M:0),requestAnimationFrame(()=>{var R;return(R=N.current)==null?void 0:R.focus()})}},[f,e,n]),w.useEffect(()=>{s&&f&&h(!1)},[s,f]);const B=M=>{s||(M.key==="ArrowDown"||M.key==="Enter"||M.key===" ")&&(M.preventDefault(),h(!0))},_=M=>{var R;if(M.key==="ArrowDown")M.preventDefault(),b(P=>{var F;for(let Z=1;Z<=n.length;Z++){const I=(P+Z)%n.length;if(!((F=n[I])!=null&&F.disabled))return I}return P});else if(M.key==="ArrowUp")M.preventDefault(),b(P=>{var F;for(let Z=1;Z<=n.length;Z++){const I=(P-Z+n.length)%n.length;if(!((F=n[I])!=null&&F.disabled))return I}return P});else if(M.key==="Enter"){M.preventDefault();const P=n[y];P&&!P.disabled&&(t(P.value),E())}else if(M.key==="Home"){M.preventDefault();const P=n.findIndex(F=>!F.disabled);P>=0&&b(P)}else if(M.key==="End"){M.preventDefault();let P=-1;for(let F=n.length-1;F>=0;F--)if(!((R=n[F])!=null&&R.disabled)){P=F;break}P>=0&&b(P)}},z=["v10-select",l,s?"disabled":"",f?"open":""].filter(Boolean).join(" "),q=g?g.placement==="below"?{position:"fixed",left:g.left,top:g.top,width:g.width}:{position:"fixed",left:g.left,top:g.top,width:g.width,transform:"translateY(-100%)"}:void 0;return o.jsxs("div",{ref:k,className:z,children:[o.jsxs("button",{ref:j,type:"button",className:"v10-select-trigger",onClick:()=>!s&&h(M=>!M),onKeyDown:B,disabled:s,"aria-haspopup":"listbox","aria-expanded":f,"aria-label":u,children:[d&&o.jsx("span",{className:"v10-select-prefix","aria-hidden":"true",children:d}),o.jsx("span",{className:`v10-select-value ${S?"":"placeholder"}`,children:T}),o.jsx(sO,{className:"v10-select-caret",size:12,"aria-hidden":"true"})]}),f&&g&&q2.createPortal(o.jsxs("ul",{ref:N,className:`v10-select-menu v10-select-menu-${g.placement}`,role:"listbox",tabIndex:-1,onKeyDown:_,style:q,children:[n.length===0&&o.jsx("li",{className:"v10-select-option empty","aria-disabled":"true",children:"No options"}),n.map((M,R)=>o.jsx("li",{role:"option","aria-selected":M.value===e,title:M.label,className:["v10-select-option",M.value===e?"selected":"",R===y?"highlighted":"",M.disabled?"disabled":""].filter(Boolean).join(" "),onMouseEnter:()=>b(R),onMouseDown:P=>P.preventDefault(),onClick:()=>{s||M.disabled||(t(M.value),E())},children:M.label},M.value))]}),document.body)]})}function Vk(e){return e.bridgeOnline?"connected":e.status==="connecting"?"known":e.status==="degraded"?"degraded":"offline"}function Zq(e,t){return t?"Session history":e.chatReady?`${e.name} connected`:e.status==="connecting"?`${e.name} is connecting…`:e.status==="degraded"?`${e.name} degraded`:`${e.name} is unavailable`}function Kq(e){const[t,n]=w.useState(!1),[a,s]=w.useState(!1),l=w.useRef(null),u=w.useRef(null),d=w.useRef(null);w.useLayoutEffect(()=>{if(!t)return;const m=d.current,y=u.current;if(!m||!y)return;const k=(y.closest(".v10-panel-right")||document.body).getBoundingClientRect();y.getBoundingClientRect().left+m.offsetWidth>k.right-4?s(!0):s(!1)},[t]);const f=w.useCallback(()=>{var m;n(!1),(m=u.current)==null||m.focus()},[]);w.useEffect(()=>{if(!t)return;const m=b=>{var k;(k=l.current)!=null&&k.contains(b.target)||n(!1)},y=b=>{b.key==="Escape"&&(b.preventDefault(),f())};return document.addEventListener("mousedown",m),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",y)}},[t,f]),w.useEffect(()=>{var y;if(!t)return;const m=(y=d.current)==null?void 0:y.querySelector(".v10-agent-tab-menu-item:not(:disabled)");m==null||m.focus()},[t]);const h=m=>{(m.key==="ArrowDown"||m.key==="Enter"||m.key===" ")&&(m.preventDefault(),n(!0))},g=m=>{var N,S;if(m.key==="Tab"){n(!1);return}if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;m.preventDefault();const y=Array.from(((N=d.current)==null?void 0:N.querySelectorAll(".v10-agent-tab-menu-item:not(:disabled)"))??[]);if(y.length===0)return;const b=y.findIndex(T=>T===document.activeElement),k=m.key==="ArrowDown"?1:-1,j=b===-1?k===1?0:y.length-1:(b+k+y.length)%y.length;(S=y[j])==null||S.focus()};return o.jsxs("div",{className:"v10-agent-tab-menu",ref:l,children:[o.jsx("button",{ref:u,type:"button",className:"v10-agent-tab-menu-trigger","aria-label":`More actions for ${e.integration.name}`,"aria-haspopup":"menu","aria-expanded":t,title:`More actions for ${e.integration.name}`,onClick:m=>{m.stopPropagation(),n(y=>!y)},onKeyDown:h,children:o.jsx(dO,{"aria-hidden":"true",size:14})}),t&&o.jsxs("div",{ref:d,className:`v10-agent-tab-menu-popover${a?" align-right":""}`,role:"menu",onKeyDown:g,children:[o.jsxs("div",{className:"v10-agent-tab-menu-status","aria-hidden":"true",children:[o.jsx("span",{className:`v10-agents-stat-dot ${e.statusDotClass}`}),o.jsx("span",{children:e.statusLabel})]}),o.jsx("button",{type:"button",role:"menuitem",className:"v10-agent-tab-menu-item",disabled:e.refreshBusy,onClick:()=>{f(),e.onRefresh()},children:e.refreshBusy?"Refreshing…":"Refresh"}),e.canDisconnect&&o.jsx("button",{type:"button",role:"menuitem",className:"v10-agent-tab-menu-item danger",onClick:()=>{f(),e.onDisconnect()},children:"Disconnect"})]})]})}function HN(e,t){return(t==null?void 0:t.trim())||`integration:${e}`}function Ad(e){const t=e.sessionId??e.defaultSessionId??eo(e.integrationId);return{integrationId:e.integrationId,sessionId:t,stateKey:HN(e.integrationId,t)}}function qN(e,t){for(const n of t)if(e===n.id||e.startsWith(`${n.id}:`))return{id:n.id,name:n.name};return null}function GN(e){var n;if(e.selectedSessionId==null)return!1;const t=e.integrations.find(a=>a.id===e.integrationId);return!(((n=qN(e.selectedSessionId,e.integrations))==null?void 0:n.id)!==e.integrationId||t!=null&&t.defaultSessionId&&e.selectedSessionId!==t.defaultSessionId&&Qq(e.integrationId,e.selectedSessionId))}function Yq(e){return GN(e)}function Qq(e,t){return t===`${e}:dkg-ui`||t.startsWith(`${e}:dkg-ui:profile-`)||t.startsWith(`${e}:dkg-ui:home-`)||t.startsWith(`${e}:dkg-ui:transport-`)}function Wk(e,t){const n=e.flatMap(a=>{var d;const s=qN(a.session,t);if(!s)return[];const l=a.messages.find(f=>f.author==="user"),u=a.messages[a.messages.length-1];return[{sessionId:a.session,integrationId:s.id,integrationName:s.name,preview:((d=l==null?void 0:l.text)==null?void 0:d.slice(0,60))||a.session,messageCount:a.messages.length,lastTs:u==null?void 0:u.ts}]});return n.sort((a,s)=>{const l=Date.parse(a.lastTs??""),u=Date.parse(s.lastTs??"");return Number.isFinite(l)&&Number.isFinite(u)?u-l:String(s.lastTs??"").localeCompare(String(a.lastTs??""))}),n}function VN(e,t,n,a,s){var u;const l=Ad({integrationId:e,sessionId:t,defaultSessionId:s});return(((u=n[l.stateKey])==null?void 0:u.length)??0)>0||(l.sessionId?a.some(d=>d.sessionId===l.sessionId):!1)}function WN(e,t,n){const a=HN(e,null);return Object.entries(t).some(([s,l])=>l.length>0&&(s===a||s.startsWith(`${e}:`)))||n.some(s=>s.integrationId===e)}function Xq(e){const t=[...e.integrations].sort(Xd),n=t.filter(d=>d.persistentChat),a=t.find(d=>d.id===e.selectedIntegrationId)??n[0]??null,s=a?Ad({integrationId:a.id,sessionId:e.selectedSessionId,defaultSessionId:a.defaultSessionId}):null,l=a?VN(a.id,e.selectedSessionId,e.localMessagesByConversation,e.sessions,a.defaultSessionId):!1,u=a?WN(a.id,e.localMessagesByConversation,e.sessions):!1;return{sortedIntegrations:t,connectedIntegrations:n,selectedIntegration:a,selectedConversation:s,selectedHasConversation:l,selectedIntegrationHasAnyConversation:u}}function Jq(e){const t=e.selectedIntegration,n=!!(t&&!t.persistentChat&&e.selectedHasConversation),a=!!(t&&!t.persistentChat&&e.selectedIntegrationHasAnyConversation),s=a?[t,...e.connectedAgents.filter(d=>d.id!==t.id)]:e.connectedAgents,l=e.selectedIntegrationId===Xi||!t&&e.connectedAgents.length===0||!!(t&&!t.persistentChat&&!e.selectedIntegrationHasAnyConversation),u=!e.localHistoryLoaded&&e.localMessagesCount===0&&!!(t!=null&&t.persistentChat||e.selectedHasConversation);return{showingSessionHistory:n,showingStoredSessions:a,visibleAgentTabs:s,showAddFlow:l,shouldShowConversationLoader:u}}function Xd(e,t){const n=e.id==="openclaw"?0:1,a=t.id==="openclaw"?0:1;return n!==a?n-a:e.persistentChat!==t.persistentChat?e.persistentChat?-1:1:e.name.localeCompare(t.name)}function nd(e,t){return[...e.filter(n=>n.id!==t.id),t].sort(Xd)}function eG(e,t){const n=e.find(u=>u.id===t);if(!n)return e;const a=n.connectSupported,s=a?"available":"coming_soon",l=a?"Ready to connect":"Coming next";return nd(e,{...n,configured:!1,detected:!1,persistentChat:!1,chatReady:!1,bridgeOnline:!1,bridgeStatusLabel:l,status:s,statusLabel:l,detail:a?`${n.name} is no longer attached to this node. Reconnect from the + tab when you want live chat again.`:n.detail,error:void 0,target:void 0})}function tG(e){const t=e.selectedItem;return e.selectedIntegrationId===Xi||t!=null&&(t.persistentChat||VN(e.selectedIntegrationId,e.selectedSessionId,e.localMessagesByConversation,e.sessionSummaries,t.defaultSessionId)||WN(e.selectedIntegrationId,e.localMessagesByConversation,e.sessionSummaries))}function nG(e){var Q;const{integrations:t,selectedIntegrationId:n,selectedIntegration:a,selectedSessionId:s,selectedHasConversation:l,selectedIntegrationHasAnyConversation:u,onSelectIntegration:d,onConnectIntegration:f,onDisconnectIntegration:h,onRefreshIntegration:g,connectBusyId:m,refreshBusyId:y,connectNotice:b,connectError:k,localMessages:j,localHistoryLoaded:N,localChatEndRef:S,localInput:T,onLocalInputChange:E,onSendLocalMessage:A,onStopLocalStream:B,localSending:_,activeProjectId:z,availableProjects:q,projectsLoading:M,onSelectProject:R,attachments:P,onAddAttachments:F,onRemoveAttachment:Z}=e,I=e.selectableProjects??q,$=P,H=$.some(AN),V=[...new Set($.map(W=>W.contextGraphId))],X=$.some(W=>W.status==="uploading"),L=j.some(W=>W.streaming)?"streaming":X?"uploading":"idle",U=$.length>0&&$.some(W=>W.contextGraphId!==z),G=w.useRef(null),O=w.useRef(null),[ne,ue]=w.useState(null),le=w.useCallback(W=>{O.current=W,ue(W)},[]),[be,_e]=w.useState(!1),Ee=w.useCallback(()=>{const W=O.current;if(!W)return;const ee=W.scrollHeight-W.scrollTop-W.clientHeight;_e(ee>40)},[]),Ie=w.useCallback(()=>{const W=O.current;W&&W.scrollTo({top:W.scrollHeight,behavior:"smooth"})},[]);w.useEffect(()=>{const W=O.current;if(!W)return;const ee=requestAnimationFrame(()=>{const ce=W.scrollHeight-W.scrollTop-W.clientHeight;_e(ce>40)});return()=>cancelAnimationFrame(ee)},[n,s,j.length]),w.useEffect(()=>{if(!ne||typeof MutationObserver>"u")return;const W=()=>{const ce=ne.scrollHeight-ne.scrollTop-ne.clientHeight;_e(ce>40)};W();const ee=new MutationObserver(W);return ee.observe(ne,{childList:!0,subtree:!0,characterData:!0}),()=>ee.disconnect()},[ne]);const We=(Q=e.selectedIntegration)!=null&&Q.chatAttachments?e.activeProjectId?e.localSending?"sending":null:"noProject":"unsupported",Se=We===null,ft=w.useCallback(W=>{Se&&F(W)},[Se,F]),De=FN({onDrop:ft,noClick:!0,noKeyboard:!0}),qe=[...t].sort(Xd),ke=qe.filter(W=>W.persistentChat),lt=qe.filter(W=>!W.persistentChat),xe=a,{showingSessionHistory:Oe,showingStoredSessions:Ot,visibleAgentTabs:$t,showAddFlow:Yt,shouldShowConversationLoader:qt}=Jq({connectedAgents:ke,selectedIntegration:a,selectedIntegrationId:n,selectedHasConversation:l,selectedIntegrationHasAnyConversation:u,localHistoryLoaded:N,localMessagesCount:j.length}),ut=_||!(xe!=null&&xe.chatReady),ye=!ut&&!X&&(T.trim()!==""||H);return o.jsxs("div",{className:"v10-agents-tab",children:[o.jsxs("div",{className:"v10-agent-subtabs",role:"tablist","aria-label":"Integrated agents",children:[$t.map(W=>{const ee=(xe==null?void 0:xe.id)===W.id&&!Yt;return o.jsxs("div",{className:`v10-agent-subtab-group ${ee?"active":""}`,children:[o.jsxs("button",{className:`v10-agent-subtab ${ee?"active":""}`,onClick:()=>d(W.id,{preserveSession:GN({integrationId:W.id,selectedSessionId:s,integrations:t}),sessionId:W.defaultSessionId}),role:"tab","aria-selected":ee,children:[o.jsx("span",{className:`v10-agents-stat-dot ${Vk(W)}`}),o.jsx("span",{children:W.name})]}),ee&&o.jsx(Kq,{integration:W,statusLabel:Zq(W,Oe),statusDotClass:Vk(W),refreshBusy:y===W.id,canDisconnect:W.persistentChat,onRefresh:()=>g(W.id),onDisconnect:()=>h(W.id)})]},W.id)}),o.jsx("button",{className:`v10-agent-subtab add ${Yt?"active":""}`,onClick:()=>d(Xi),role:"tab","aria-selected":Yt,"aria-label":"Add another integrated agent",title:"Add another integrated agent",children:"+"})]}),Yt?o.jsxs("div",{className:"v10-agent-add-surface",children:[o.jsx("div",{className:"v10-agents-section-label",children:"Connect Another Agent"}),b&&o.jsx("div",{className:"v10-local-agent-notice",children:b}),k&&o.jsx("div",{className:"v10-local-agent-error",children:k}),o.jsxs("div",{className:"v10-local-agent-list","aria-label":"Available agent integrations",children:[lt.length===0&&o.jsx("div",{className:"v10-agent-empty-state",children:"No additional local agent integrations are available yet."}),lt.map(W=>o.jsxs("div",{className:"v10-local-agent-detail v10-local-agent-choice",children:[o.jsxs("div",{className:"v10-local-agent-detail-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"v10-local-agent-title",children:W.name}),o.jsx("div",{className:"v10-local-agent-subtitle",children:W.description})]}),o.jsx("span",{className:`v10-local-agent-status-pill ${W.status}`,children:W.statusLabel})]}),o.jsx("p",{className:"v10-local-agent-copy",children:W.detail}),W.error&&o.jsx("div",{className:"v10-local-agent-warning offline",role:"status","data-testid":`local-agent-warning-${W.id}`,children:W.error}),W.id==="openclaw"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"v10-local-agent-copy",children:"Connect your local OpenClaw once, then this tab becomes the persistent chat surface for that agent. The node can retry the bridge without forcing you back through setup."}),o.jsxs("div",{className:"v10-local-agent-actions",children:[o.jsx("button",{className:"v10-agent-send-btn secondary",onClick:()=>f(W.id),disabled:m===W.id,children:m===W.id?"Connecting...":"Connect OpenClaw"}),o.jsx("a",{className:"v10-agent-link-btn",href:k7,target:"_blank",rel:"noreferrer",children:"Docs"}),o.jsx("a",{className:"v10-agent-link-btn",href:S7,target:"_blank",rel:"noreferrer",children:"Release Notes"})]})]}),W.id==="hermes"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"v10-local-agent-copy",children:"Connect a local Hermes profile through the node, then this tab becomes the persistent chat surface for that profile."}),W.connectSupported&&o.jsx("div",{className:"v10-local-agent-actions",children:o.jsx("button",{className:"v10-agent-send-btn secondary",onClick:()=>f(W.id),disabled:m===W.id,children:m===W.id?"Connecting...":"Connect Hermes"})})]})]},W.id))]})]}):xe&&o.jsxs("div",{...De.getRootProps({className:"v10-local-agent-chat-shell"}),children:[o.jsx("input",{...De.getInputProps()}),b&&o.jsx("div",{className:"v10-local-agent-notice",children:b}),k&&o.jsx("div",{className:"v10-local-agent-error",children:k}),!xe.chatReady&&o.jsx("div",{className:`v10-local-agent-warning ${xe.status==="connecting"?"connecting":"offline"}`,children:Oe?`${xe.name} is not currently attached to this node. Session history remains available here; reconnect from the + tab when you want live chat again.`:xe.status==="connecting"?`${xe.name} is still finishing setup. This chat tab stays in place and will go live automatically when the connection is ready.`:xe.status==="degraded"?xe.detail:Ot?`${xe.name} has saved sessions on this node. Open one from Sessions or reconnect from the + tab to resume live chat here.`:`${xe.name} is temporarily unavailable. Refresh after it recovers to resume chatting here.`}),De.isDragActive&&o.jsx("div",{className:`v10-drop-overlay active ${Se?"accept":"refuse"}`,role:"status","aria-live":"polite",children:o.jsxs("div",{className:"v10-drop-overlay-card",children:[Se?o.jsx(TO,{className:"v10-drop-overlay-icon",size:32,"aria-hidden":"true"}):o.jsx(nO,{className:"v10-drop-overlay-icon",size:32,"aria-hidden":"true"}),o.jsx("div",{className:"v10-drop-overlay-title",children:Se?`Drop files to attach to ${ag(q,z)}`:We==="sending"?"Wait for the current send to finish.":We==="unsupported"?`${xe.name} doesn't accept file attachments.`:"Choose a context graph before attaching files."}),o.jsx("div",{className:"v10-drop-overlay-hint",children:Se?"Release to upload to this conversation.":We==="sending"?"Drop will be accepted once the agent reply lands.":We==="unsupported"?"Try a different agent that supports attachments.":"Use the picker below the composer."})]})}),o.jsxs("div",{className:"v10-chat-messages v10-local-agent-messages",ref:le,onScroll:Ee,children:[qt&&o.jsx("div",{className:"v10-agent-empty-state",children:"Loading the latest conversation from DKG memory..."}),!qt&&j.length===0&&(()=>{const W=Oe?{title:"No turns in this session yet.",hint:`Reconnect ${xe.name} from the + tab to start a new live thread.`}:Ot?{title:`${xe.name} has saved sessions.`,hint:"Open one from Sessions, or reconnect from + to start fresh."}:xe.chatReady?{title:`Start a conversation with ${xe.name}.`,hint:'Try: "What can you help me with?"'}:{title:`${xe.name} is offline.`,hint:"Conversation history stays here while the bridge reconnects."};return o.jsxs("div",{className:"v10-agent-empty-state",children:[o.jsx("div",{className:"v10-agent-empty-state-title",children:W.title}),o.jsx("div",{className:"v10-agent-empty-state-hint",children:W.hint})]})})(),j.map(W=>o.jsxs("div",{className:`v10-chat-msg ${W.role}`,children:[o.jsx("div",{className:`v10-chat-bubble ${W.role}`,children:_7(W.content,W.role,!!W.synthesized,!!W.streaming,W.failureNotice)}),W.attachments&&W.attachments.length>0&&o.jsx("div",{className:"v10-local-agent-attachment-row",style:{display:"flex",flexWrap:"wrap",gap:6,marginTop:6},children:W.attachments.map(ee=>o.jsx("span",{className:"v10-local-agent-attachment-chip",style:{padding:"2px 8px",borderRadius:999,background:"var(--bg-elevated)",fontSize:11},children:ee.fileName},ee.id??ee.assertionUri??ee.fileHash))}),W.ts&&o.jsx("time",{className:`v10-local-agent-msg-time ${W.role}`,dateTime:W.tsRaw,children:W.ts})]},W.id)),o.jsx("div",{ref:S}),o.jsx("button",{type:"button",className:`v10-scroll-to-bottom ${be?"visible":""}`,onClick:Ie,"aria-label":"Scroll to latest message",title:"Scroll to latest message",tabIndex:be?0:-1,"aria-hidden":!be,children:o.jsx(XR,{size:14,"aria-hidden":"true"})})]}),o.jsx("div",{className:"v10-agent-input-area",children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,width:"100%"},children:[$.length>0&&o.jsx("div",{className:"v10-attachment-chips",role:"list","aria-label":"Attached files",children:$.map(W=>{var he,Le;const ee=((he=W.result)==null?void 0:he.extraction.tripleCount)??((Le=W.result)==null?void 0:Le.extraction.triplesWritten),ce=W.status==="queued"?"Queued":W.status==="uploading"?"Importing…":W.status==="completed"?ee!=null?`Ready · ${ee} triples`:"Ready":W.status==="skipped"?"Stored only":W.error??"Failed";return o.jsxs("div",{className:"v10-attachment-chip","data-status":W.status,role:"listitem",children:[o.jsx("div",{className:"v10-attachment-chip-badge","aria-hidden":"true",children:m7(W.file.name)}),o.jsxs("div",{className:"v10-attachment-chip-body",children:[o.jsx("div",{className:"v10-attachment-chip-name",title:W.file.name,children:W.file.name}),o.jsxs("div",{className:"v10-attachment-chip-meta",children:[o.jsx("span",{children:h7(W.file.size)}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("span",{className:"v10-attachment-chip-status",children:ce})]})]}),o.jsx("button",{type:"button",className:"v10-attachment-chip-remove",onClick:()=>Z(W.id),disabled:_,"aria-label":`Remove ${W.file.name}`,title:"Remove attachment",children:o.jsx(MO,{size:12,"aria-hidden":"true"})})]},W.id)})}),U&&o.jsx("div",{className:"v10-local-agent-copy",style:{margin:0,color:"var(--text-tertiary)"},children:V.length>1?"Queued files keep their stored targets and may span multiple projects.":`Queued files keep their stored target (${ag(q,V[0])}), not the active project.`}),o.jsx("input",{ref:G,type:"file",multiple:!0,style:{display:"none"},onChange:W=>{W.target.files&&(F(W.target.files),W.target.value="")}}),o.jsx("div",{className:"v10-local-agent-composer-row",children:o.jsxs("div",{className:"v10-local-agent-composer-shell",children:[o.jsx(W7,{placeholder:Oe?`Reconnect ${xe.name} to resume live chat...`:xe.chatReady?`Message ${xe.name}...`:xe.status==="connecting"?`${xe.name} is still connecting...`:`${xe.name} bridge offline...`,className:"v10-agent-input",value:T,onChange:W=>E(W.target.value),onKeyDown:W=>{if(!W.nativeEvent.isComposing){if(W.key==="Enter"&&!W.shiftKey&&!W.ctrlKey&&!W.metaKey){W.preventDefault(),ye&&A();return}if((W.ctrlKey||W.metaKey)&&W.key==="Enter"){W.preventDefault(),ye&&A();return}W.key==="Escape"&&T.length>0&&(W.preventDefault(),E(""))}},disabled:ut,minRows:1,maxRows:8}),o.jsxs("div",{className:"v10-composer-controls",children:[o.jsxs("div",{className:"v10-composer-controls-left",children:[o.jsx("button",{type:"button",className:"v10-composer-attach",onClick:()=>{var W;return(W=G.current)==null?void 0:W.click()},disabled:!Se,title:Se?"Attach files":We==="noProject"?"Choose a context graph to attach files":We==="sending"?"Wait for the current message to send":"This agent does not support attachments","aria-label":"Attach files",children:o.jsx(wO,{size:14,"aria-hidden":"true"})}),o.jsx("div",{className:"v10-composer-target",children:o.jsx(Wq,{className:"v10-local-agent-target-select",value:z??"",onChange:R,options:[...z?[{value:"",label:"No context graph (clear selection)"}]:[],...I.map(W=>({value:W.id,label:W.name}))],placeholder:M?"Loading context graphs…":"Choose a context graph",disabled:M||!z&&I.length===0,ariaLabel:"Active project",prefixIcon:o.jsx(fO,{size:12,"aria-hidden":"true"})})})]}),o.jsx("button",{type:"button",className:`v10-local-agent-inline-send v10-local-agent-inline-send-${L}`,onClick:L==="streaming"?B:A,disabled:L==="streaming"?!1:L==="uploading"?!0:!ye,"aria-label":L==="streaming"?"Stop reply":L==="uploading"?"Send message (attachments uploading)":"Send message",title:L==="streaming"?"Stop reply":L==="uploading"?"Send message (attachments uploading)…":"Send message",children:L==="streaming"?o.jsx(jO,{size:12,"aria-hidden":"true"}):L==="uploading"?o.jsx(vO,{className:"v10-local-agent-inline-send-spinner",size:14,"aria-hidden":"true"}):o.jsx(eO,{size:14,"aria-hidden":"true"})})]})]})})]})})]})]})}function ym(e){return e.length>12?e.slice(-8):e}function rG(e){if(!e)return"";const t=e.lastIndexOf(":"),n=t>=0?e.slice(t+1):e;return n.length>10?n.slice(-10):n||e.slice(-8)}function aG(e,t){const n=new Map;for(const g of t){if(!g.peerId)continue;const m=n.get(g.peerId)??[];m.push(g),n.set(g.peerId,m)}const a=new Map;for(const g of e){if(!g.peerId)continue;const m=a.get(g.peerId)??{hasDirect:!1,hasRelay:!1,openedAt:null},y=m.hasDirect||g.transport==="direct",b=m.hasRelay||g.transport==="relayed",k=g.openedAt!=null?m.openedAt!=null?Math.min(m.openedAt,g.openedAt):g.openedAt:m.openedAt;a.set(g.peerId,{hasDirect:y,hasRelay:b,openedAt:k})}const s=g=>{var m;return(m=g.find(y=>y.name))==null?void 0:m.name},l=g=>g.reduce((m,y)=>y.lastSeen!=null&&(m==null||y.lastSeen>m)?y.lastSeen:m,void 0),u=[],d=new Set;for(const[g,m]of a){const y=n.get(g)??[];u.push({peerId:g,name:s(y),transport:m.hasDirect?"direct":"relayed",hasDirect:m.hasDirect,hasRelay:m.hasRelay,openedAt:m.openedAt,connected:!0,lastSeen:l(y),agents:y}),d.add(g)}for(const[g,m]of n){if(d.has(g))continue;const y=m.filter(N=>N.connectionStatus==="connected");if(y.length===0)continue;const b=y.some(N=>N.connectionTransport==="direct"),k=y.some(N=>N.connectionTransport==="relayed"),j=k&&!b?"relayed":"direct";u.push({peerId:g,name:s(m),transport:j,hasDirect:b,hasRelay:k,openedAt:null,connected:!0,lastSeen:l(m),agents:m}),d.add(g)}const f=[];for(const[g,m]of n){if(d.has(g))continue;const y=l(m);y!=null&&f.push({peerId:g,name:s(m),transport:"direct",hasDirect:!1,hasRelay:!1,openedAt:null,connected:!1,lastSeen:y,agents:m})}f.sort((g,m)=>(m.lastSeen??0)-(g.lastSeen??0));const h=u.filter(g=>g.transport==="direct").length;return{connected:u,recentlySeen:f,directCount:h,relayedCount:u.length-h}}function iG({peer:e}){var g;const[t,n]=w.useState(!1),a=w.useId(),s=3,l=e.connected?"connected":"offline",u=((g=e.name)==null?void 0:g.trim())||ym(e.peerId),d=t?e.agents:e.agents.slice(0,s),f=e.connected?e.transport:"Disconnected",h=e.connected&&e.hasDirect&&e.hasRelay?"Direct + relay paths active — direct shown":void 0;return o.jsxs("div",{className:`v10-agent-card v10-peer-card ${l}`,children:[o.jsxs("div",{className:"v10-agent-card-header",children:[o.jsx("span",{className:`v10-agent-card-dot ${l}`}),o.jsx("span",{className:"v10-peer-card-name",children:u}),o.jsx("span",{className:"v10-agent-card-badge",title:h,children:f})]}),o.jsxs("div",{className:"v10-peer-card-meta",children:[o.jsx("span",{title:e.peerId,children:ym(e.peerId)}),e.connected&&e.openedAt!=null&&o.jsxs("span",{children:["up ",xk(Date.now()-e.openedAt)]}),!e.connected&&e.lastSeen!=null&&o.jsxs("span",{children:[xk(Date.now()-e.lastSeen)," ago"]}),e.agents.length>0&&o.jsxs("span",{children:[e.agents.length," agent",e.agents.length===1?"":"s"]})]}),e.agents.length>0&&o.jsxs("ul",{id:a,className:"v10-peer-card-chips","aria-label":`Agents on ${u}`,children:[d.map((m,y)=>o.jsx("li",{className:"v10-peer-chip",title:m.agentUri||"",children:o.jsx("span",{className:"v10-peer-chip-label",children:rG(m.agentUri)||ym(m.peerId)})},m.agentUri||`${e.peerId}:${y}`)),e.agents.length>s&&o.jsx("li",{children:o.jsx("button",{type:"button",className:"v10-peer-chip-more","aria-expanded":t,"aria-controls":a,onClick:()=>n(m=>!m),children:t?"Show less":`+${e.agents.length-s} more`})})]})]})}function Zk(e){const{label:t,peers:n,expanded:a,onToggle:s,emptyMessage:l}=e;return o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header",onClick:s,"aria-expanded":a,children:[o.jsx(Cm,{size:14,className:`v10-peer-group-chevron ${a?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:t}),o.jsx("span",{className:"v10-peer-group-count",children:n.length})]}),a&&o.jsx("div",{className:"v10-peer-group-body",children:n.length===0?o.jsx("div",{className:"v10-agent-empty-state",children:l}):n.map(u=>o.jsx(iG,{peer:u},u.peerId))})]})}function sG(e){const{peerAgents:t,connections:n,loading:a,onRefresh:s}=e,[l,u]=w.useState(!0),[d,f]=w.useState(!1),{connected:h,recentlySeen:g,directCount:m,relayedCount:y}=aG(n.rows,t);return o.jsxs("div",{className:"v10-agent-scroll-tab",children:[o.jsxs("div",{className:"v10-agents-summary",children:[o.jsxs("span",{className:"v10-agents-stat",children:[o.jsx("span",{className:`v10-agents-stat-dot ${h.length>0||n.total>0?"connected":"known"}`}),o.jsxs("span",{title:"Unique libp2p peers connected to this node — matches the count in the header.",children:[h.length," peer",h.length===1?"":"s"]})]}),o.jsxs("span",{className:"v10-agents-stat",title:"Preferred transport per peer (peers reachable via direct + relay are bucketed under direct)",children:[m," direct / ",y," relayed"]}),o.jsx("button",{className:"v10-agents-refresh",onClick:s,title:"Refresh network peers",children:"Refresh"})]}),a&&o.jsx("p",{className:"v10-agents-loading",children:"Loading peers..."}),!a&&h.length===0&&g.length===0&&n.total===0&&o.jsx("div",{className:"v10-agent-empty-state",children:"No network peers detected yet."}),!a&&h.length===0&&n.total>0&&o.jsxs("div",{className:"v10-agent-empty-state",children:["Connected to ",n.total," peer",n.total===1?"":"s"," (peer metadata syncing…)."]}),(h.length>0||g.length>0)&&o.jsxs(o.Fragment,{children:[o.jsx(Zk,{label:"Connected",peers:h,expanded:l,onToggle:()=>u(b=>!b),emptyMessage:"No peers currently connected."}),o.jsx(Zk,{label:"Recently seen",peers:g,expanded:d,onToggle:()=>f(b=>!b),emptyMessage:"No previously-seen peers."})]})]})}function oG(e){const{sessions:t,onOpenSession:n}=e;return o.jsx("div",{className:"v10-agent-scroll-tab",children:o.jsxs("div",{className:"v10-sessions-list",children:[o.jsx("div",{className:"v10-local-agent-copy",style:{marginBottom:12},children:"Sessions track DKG-persisted conversations for your integrated agents."}),t.length===0?o.jsx("p",{className:"v10-agent-empty-state",children:"No integrated-agent sessions yet."}):t.map(a=>o.jsxs("button",{className:"v10-session-item",onClick:()=>n(a),children:[o.jsxs("span",{className:"v10-session-preview",children:[a.integrationName,": ",a.preview]}),o.jsxs("span",{className:"v10-session-count",children:[a.messageCount," msg",a.messageCount!==1?"s":"",a.lastTs?` - ${Cd(a.lastTs)}`:""]})]},a.sessionId))]})})}function lG(){return zd().data}function cG(){const{stage:e,advance:t}=Ig(),[n,a]=w.useState("agents"),[s,l]=w.useState([]),[u,d]=w.useState([]),[f,h]=w.useState({total:0,direct:0,relayed:0,rows:[]}),[g,m]=w.useState(!0),y=lG(),[b,k]=w.useState([]),[j,N]=w.useState("openclaw"),[S,T]=w.useState(()=>eo("openclaw")),[E,A]=w.useState(null),[B,_]=w.useState(null),[z,q]=w.useState(null),[M,R]=w.useState(null),[P,F]=w.useState({}),[Z,I]=w.useState({}),[$,H]=w.useState({}),[V,X]=w.useState({}),[Y,L]=w.useState({}),U=w.useRef(new Map),G=w.useRef(!1),O=w.useRef(null),ne=w.useRef([]),ue=w.useRef({}),le=w.useRef("openclaw"),be=w.useRef(eo("openclaw")),_e=Ar(ge=>ge.contextGraphs),Ee=Ar(ge=>ge.loading),Ie=Ar(ge=>ge.activeProjectId),We=Ar(ge=>ge.setActiveProject),Se=w.useMemo(()=>r4(_e,y?Fg(y):null,Ie),[_e,y,Ie]),ft=Wk(s,b),{selectedIntegration:De,selectedConversation:qe,selectedHasConversation:ke,selectedIntegrationHasAnyConversation:lt}=Xq({integrations:b,selectedIntegrationId:j,selectedSessionId:S,localMessagesByConversation:P,sessions:ft}),xe=(qe==null?void 0:qe.stateKey)??null,Oe=xe?P[xe]??[]:[],Ot=xe?V[xe]??!1:!1,$t=xe?Z[xe]??"":"",Yt=xe?$[xe]??!1:!1,qt=xe?Y[xe]??[]:[],ut=w.useCallback(()=>{var ge;(ge=O.current)==null||ge.scrollIntoView({behavior:"smooth"})},[]);w.useEffect(ut,[xe,Oe,ut]),w.useEffect(()=>{ne.current=s},[s]),w.useEffect(()=>{ue.current=P},[P]),w.useEffect(()=>{le.current=j},[j]),w.useEffect(()=>{be.current=S},[S]);const ye=w.useCallback((ge,Me)=>{F(de=>({...de,[ge]:Me(de[ge]??[])}))},[]),Q=w.useCallback((ge,Me)=>{ge&&I(de=>({...de,[ge]:Me}))},[]),W=w.useCallback((ge,Me)=>{H(de=>({...de,[ge]:Me}))},[]),ee=w.useCallback((ge,Me)=>{L(de=>({...de,[ge]:Me(de[ge]??[])}))},[]),ce=w.useCallback((ge,Me,de)=>{const je=Array.from(Me);if(je.length===0)return;const Te=new Set((Y[ge]??[]).map(Ke=>`${Ke.contextGraphId}:${Ke.file.name}:${Ke.file.size}:${Ke.file.lastModified}`)),tt=je.filter(Ke=>{const pt=`${de}:${Ke.name}:${Ke.size}:${Ke.lastModified}`;return Te.has(pt)?!1:(Te.add(pt),!0)});if(tt.length===0)return;const Je=tt.map(Ke=>({id:`${ge}:${Ke.name}:${Ke.size}:${Ke.lastModified}:${crypto.randomUUID()}`,file:Ke,contextGraphId:de,assertionName:`${Date.now().toString(36)}-${crypto.randomUUID().slice(0,8)}-${Ke.name.replace(/[^a-zA-Z0-9._-]/g,"_")}`,status:"queued"}));ee(ge,Ke=>[...Ke,...Je])},[Y,ee]),he=w.useCallback(async(ge,Me)=>{const de=[];for(const je of Me){if(je.status==="completed"||je.status==="skipped"){de.push(je);continue}ee(ge,Te=>Te.map(tt=>tt.id===je.id?{...tt,status:"uploading",error:void 0}:tt));try{const Te=await AS(je.assertionName,je.contextGraphId,je.file),tt=Te.extraction.status==="completed"?"completed":Te.extraction.status==="skipped"?"skipped":"error",Je={...je,status:tt,result:Te,error:Te.extraction.error};de.push(Je),ee(ge,Ke=>Ke.map(pt=>pt.id===je.id?Je:pt))}catch(Te){const tt={...je,status:"error",error:(Te==null?void 0:Te.message)??"Upload failed"};de.push(tt),ee(ge,Je=>Je.map(Ke=>Ke.id===je.id?tt:Ke))}}return de},[ee]),Le=w.useCallback((ge,Me)=>{ee(ge,de=>de.filter(je=>je.id!==Me))},[ee]),He=w.useCallback((ge,Me)=>{const de=new Set(Me);ee(ge,je=>je.filter(Te=>!de.has(Te.id)))},[ee]),Ce=w.useCallback((ge,Me={})=>{N(ge),ge!==Xi&&(Me.preserveSession||T(Me.sessionId??eo(ge)))},[]),Fe=w.useCallback(()=>{An.fetchMemorySessions(50).then(({sessions:ge})=>l(ge??[])).catch(()=>{})},[]),et=w.useCallback(async()=>{try{const[ge,Me]=await Promise.all([Cg().catch(()=>({agents:[]})),i_().catch(()=>({total:0,direct:0,relayed:0,connections:[]}))]),de=(ge.agents??[]).filter(je=>je.connectionStatus!=="self");d(de),h({total:Me.total??0,direct:Me.direct??0,relayed:Me.relayed??0,rows:Array.isArray(Me.connections)?Me.connections:[]})}catch{}m(!1)},[]),Ne=w.useCallback(async()=>{try{const{integrations:ge}=await Dd();k(ge);const Me=Wk(ne.current,ge),de=[...ge].sort(Xd).filter(pt=>pt.persistentChat),je=le.current,Te=be.current,tt=ge.find(pt=>pt.id===je)??null,Je=tG({selectedIntegrationId:je,selectedItem:tt,selectedSessionId:Te,localMessagesByConversation:ue.current,sessionSummaries:Me});if(!Je){const pt=de[0];Ce((pt==null?void 0:pt.id)??Xi,{sessionId:(pt==null?void 0:pt.defaultSessionId)??null})}const Ke=de[0];Ke&&!G.current&&je!==Xi?(G.current=!0,Ce(Ke.id,{sessionId:Ke.defaultSessionId}),a("agents")):!Ke&&!Je&&(G.current=!1,Ce(Xi))}catch{}},[Ce]),Wt=w.useCallback(async(ge,Me=null,de=null)=>{const je=Ad({integrationId:ge,sessionId:Me,defaultSessionId:de});X(Te=>({...Te,[je.stateKey]:!1}));try{const tt=(await Fx(ge,100,{sessionId:je.sessionId??void 0})).map(Je=>wk(Je,ge));ye(je.stateKey,Je=>kk(Je,tt))}catch{ye(je.stateKey,Te=>Te)}finally{X(Te=>({...Te,[je.stateKey]:!0})),Fe()}},[Fe,ye]);w.useEffect(()=>{Fe(),et(),Ne()},[Fe,et,Ne]),w.useEffect(()=>{for(const ge of j7)Wt(ge,eo(ge))},[]);const _t=w.useCallback(()=>{Fe(),et()},[Fe,et]);Xl(_t,15e3,{runImmediately:!1});const Hr=b.some(ge=>ge.persistentChat&&(!ge.chatReady||ge.status==="connecting"))?3e3:15e3;w.useEffect(()=>{const ge=setInterval(()=>{Ne()},Hr);return()=>clearInterval(ge)},[Hr,Ne]),w.useEffect(()=>{if(!(De!=null&&De.chatSupported)||!De.persistentChat&&!ke){xe&&X(Me=>({...Me,[xe]:!1}));return}let ge=!1;return(async()=>await Wt(De.id,(qe==null?void 0:qe.sessionId)??null,De.defaultSessionId??null))(),()=>{ge=!0}},[Wt,qe==null?void 0:qe.sessionId,xe,ke,De==null?void 0:De.defaultSessionId,De==null?void 0:De.chatSupported,De==null?void 0:De.id,De==null?void 0:De.persistentChat]);const dr=w.useCallback(async()=>{const ge=De,Me=qe,de=$t.trim(),je=qt,Te=je.some(AN);if(!(ge!=null&&ge.chatSupported)||!ge.chatReady||Yt||!Me||!de&&!Te)return;const tt=ge.id,Je=Me.stateKey;W(Je,!0),q(null);let Ke=null,pt="",mn="",Gt="",un="",ua=[],da=[],ps=[];try{da=await he(Je,je);const Kn=da.map(tn=>y7(tn)).filter(tn=>tn!=null),fr=b7(da);if(!de&&Kn.length===0&&fr.results.length===0)return;mn=crypto.randomUUID();const Or=RN(fr.results),Ga=[de,Or].filter(tn=>tn.length>0).join(`
1660
+
1661
+ `);Gt=de?Ga:x7(Kn,fr.results);const gn=de?Ga:"";ua=Kn,ps=[...Kn.map(tn=>tn.id).filter(tn=>typeof tn=="string"&&tn.length>0),...fr.deliveredDraftIds];const pa=`local:${Je}:${mn}:user`;pt=`local:${Je}:${mn}:assistant`;const hr=new Date,Lt=Cd(hr),jo=rg(hr);ye(Je,tn=>[...tn,{id:pa,turnId:mn,role:"user",content:Gt,ts:Lt,tsRaw:jo,attachments:Kn},{id:pt,turnId:mn,role:"assistant",content:"",ts:Lt,tsRaw:jo,streaming:!0}]),Q(Je,""),ps.length>0&&He(Je,ps),Ke=new AbortController,U.current.set(Je,Ke);const sc=[...w7(_e,Ie,y)],mr=await K_(tt,gn,{correlationId:mn,signal:Ke==null?void 0:Ke.signal,sessionId:Me.sessionId??void 0,profile:ge.profile,persistUserMessage:gn?void 0:Gt,attachments:Kn,attachmentImportResults:fr.results,contextEntries:sc,contextGraphId:Ie??void 0,onEvent:tn=>{tn.type==="text_delta"&&(un+=tn.delta,ye(Je,gr=>gr.map(Gr=>Gr.id===pt?{...Gr,content:Gr.content+tn.delta}:Gr)))}}),fa=new Date;ye(Je,tn=>Sk(tn,mn,mr.turnId).map(gr=>{var Gr;return gr.id===pt?{...gr,content:mr.text||gr.content,turnId:((Gr=mr.turnId)==null?void 0:Gr.trim())||gr.turnId,streaming:!1,synthesized:!mr.text&&!gr.content?!0:gr.synthesized,ts:Cd(fa),tsRaw:rg(fa)}:gr})),Fe(),e===0&&t()}catch(Kn){const fr=(Kn==null?void 0:Kn.name)==="AbortError",Or=fr?"Request cancelled.":C7(ge,Kn),Ga=fr?Or:`Error: ${Or}`;pt&&ye(Je,gn=>gn.map(Nn=>Nn.id===pt?{...Nn,content:un,failureNotice:Ga,streaming:!1,synthesized:!un}:Nn)),!fr&&tt==="hermes"&&pt&&Gt&&(async()=>{try{const gn=await Z_(tt,{sessionId:Me.sessionId??void 0,correlationId:mn||void 0,userMessage:Gt,assistantReply:un,failureReason:Or,profile:ge.profile,attachments:ua,contextGraphId:Ie??void 0});gn.turnId&&ye(Je,Nn=>Sk(Nn,mn,gn.turnId)),Fe()}catch{}})(),ps.length>0&&da.length>0&&L(gn=>{const Nn=gn[Je]??[],pa=new Set(Nn.map(Lt=>Lt.id)),hr=da.filter(Lt=>!pa.has(Lt.id));return hr.length===0?gn:{...gn,[Je]:[...hr,...Nn]}}),Ne()}finally{W(Je,!1),U.current.get(Je)===Ke&&U.current.delete(Je)}},[Ie,t,_e,y,Fe,$t,Yt,he,qt,Ne,qe,De,He,Q,W,e,ye]),Fa=w.useCallback(()=>{if(!xe)return;const ge=U.current.get(xe);ge==null||ge.abort()},[xe]),Ha=w.useCallback(async ge=>{A(ge),q(null),_(null);try{const Me=await q_(ge);k(Te=>nd(Te,Me.integration)),await Ne();const de=nd(b,Me.integration),je=Yq({integrationId:ge,selectedSessionId:S,integrations:de});Ce(ge,{preserveSession:je,sessionId:Me.integration.defaultSessionId}),G.current=!0,_(Me.notice??(Me.integration.chatReady?`${Me.integration.name} is connected and chat-ready.`:`${Me.integration.name} attach is in progress. The node will keep checking for a live bridge.`)),a("agents")}catch(Me){await Ne(),q(Me.message)}finally{A(null)}},[b,Ne,S,Ce]),pr=w.useCallback(async ge=>{q(null),_(null);try{await G_(ge),k(Me=>eG(Me,ge)),G.current=!1,Ce(ge,{preserveSession:j===ge}),_("The local agent was disconnected from this node. Session history remains available here."),a("agents"),await Ne()}catch(Me){q(Me.message)}},[Ne,j,Ce]),qr=w.useCallback(async ge=>{var Te,tt,Je;if(M===ge)return;R(ge),q(null),_(null);const Me=Ad({integrationId:ge,sessionId:j===ge?be.current:null,defaultSessionId:(Te=b.find(Ke=>Ke.id===ge))==null?void 0:Te.defaultSessionId}),[de,je]=await Promise.allSettled([V_(ge),Fx(ge,100,{sessionId:Me.sessionId??void 0})]);try{if(de.status==="fulfilled"?(k(Ke=>nd(Ke,de.value.integration)),de.value.notice&&_(de.value.notice)):q(((tt=de.reason)==null?void 0:tt.message)??"Failed to refresh integration."),je.status==="fulfilled"){const Ke=je.value.map(pt=>wk(pt,ge));ye(Me.stateKey,pt=>kk(pt,Ke)),X(pt=>({...pt,[Me.stateKey]:!0}))}else de.status==="fulfilled"&&q(((Je=je.reason)==null?void 0:Je.message)??"Failed to refresh conversation.")}finally{R(null)}},[b,M,j,ye]),ca=w.useCallback(ge=>{Ce(ge.integrationId,{sessionId:ge.sessionId}),a("agents")},[Ce]),ic=w.useCallback(ge=>{We(ge||null)},[We]),qa=w.useCallback(ge=>{!xe||!Ie||ce(xe,ge,Ie)},[Ie,ce,xe]),Ci=w.useCallback(ge=>{xe&&Le(xe,ge)},[Le,xe]);return o.jsxs("div",{className:"v10-panel-right",children:[o.jsxs("div",{className:"v10-agent-mode-tabs",children:[o.jsx("button",{className:`v10-agent-mode-tab ${n==="agents"?"active":""}`,onClick:()=>a("agents"),children:"Agents"}),o.jsx("button",{className:`v10-agent-mode-tab ${n==="network"?"active":""}`,onClick:()=>a("network"),children:"Network"}),o.jsx("button",{className:`v10-agent-mode-tab ${n==="sessions"?"active":""}`,onClick:()=>a("sessions"),children:"Sessions"})]}),n==="agents"&&o.jsx(nG,{integrations:b,selectedIntegrationId:j,selectedIntegration:De,selectedSessionId:S,selectedHasConversation:ke,selectedIntegrationHasAnyConversation:lt,onSelectIntegration:Ce,onConnectIntegration:Ha,onDisconnectIntegration:pr,onRefreshIntegration:qr,connectBusyId:E,refreshBusyId:M,connectNotice:B,connectError:z,localMessages:Oe,localHistoryLoaded:Ot,localChatEndRef:O,localInput:$t,onLocalInputChange:ge=>Q(xe,ge),onSendLocalMessage:dr,onStopLocalStream:Fa,localSending:Yt,activeProjectId:Ie,availableProjects:_e,selectableProjects:Se,projectsLoading:Ee,onSelectProject:ic,attachments:qt,onAddAttachments:qa,onRemoveAttachment:Ci}),n==="network"&&o.jsx(sG,{peerAgents:u,connections:f,loading:g,onRefresh:et}),n==="sessions"&&o.jsx(oG,{sessions:ft,onOpenSession:ca})]})}function uG(e,t=document){const n=e==="light";t.documentElement.classList.toggle("light",n),t.body.classList.toggle("light",n)}function dG(){const{toggleLeft:e,toggleRight:t,toggleBottom:n}=Vn();w.useEffect(()=>{const a=s=>{if(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement||!(s.metaKey||s.ctrlKey))return;const u=s.key.toLowerCase();if(s.shiftKey&&u==="b"){s.preventDefault(),t();return}if(!s.shiftKey){if(u==="b"){s.preventDefault(),e();return}if(u==="j"){s.preventDefault(),n();return}}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,t,n])}const Kk={"/observability":{id:"operations",label:"Observability"},"/operations":{id:"operations",label:"Observability"},"/settings":{id:"settings",label:"Settings"}},pG={operations:"/observability",settings:"/settings",dashboard:"/"};function fG(){const{pathname:e}=Fr(),t=hg(),n=fn(s=>s.openTab),a=fn(s=>s.activeTabId);w.useEffect(()=>{const s=Kk[e];s&&n({id:s.id,label:s.label,closable:!0})},[e,n]),w.useEffect(()=>{const s=pG[a];if(s){s!==e&&t(s,{replace:!0});return}Kk[e]&&t("/",{replace:!0})},[a,e,t])}function hG(){const[e,t]=w.useState(pR());return w.useEffect(()=>fR(t),[]),e?o.jsxs("div",{className:"v10-mock-banner",role:"alert","aria-live":"polite",children:[o.jsx("span",{className:"v10-mock-banner-dot","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"Demo data"})," — the node isn’t responding (it may be down, timing out, or returning errors), so the UI is showing example data, not live node state. Check the daemon, then reload."]}),o.jsx("button",{type:"button",className:"v10-mock-banner-reload",onClick:()=>window.location.reload(),children:"Reload"})]}):null}function mG(){const e=wg(t=>t.setNodeStatus);Xl(()=>{An.fetchStatus().then(e).catch(()=>{})},1e4)}function Yk(e){const t=w.useRef(null),n=w.useRef(e);return n.current=e,w.useEffect(()=>{const a=t.current;if(!a)return;let s=0;const l=f=>{const h=f.clientX-s;s=f.clientX,n.current(h)},u=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u),document.body.style.cursor="",document.body.style.userSelect="",a.classList.remove("active")},d=f=>{f.preventDefault(),s=f.clientX,document.addEventListener("mousemove",l),document.addEventListener("mouseup",u),document.body.style.cursor="col-resize",document.body.style.userSelect="none",a.classList.add("active")};return a.addEventListener("mousedown",d),()=>a.removeEventListener("mousedown",d)},[]),t}function gG(e){const t=w.useRef(e);t.current=e;const[n,a]=w.useState(null);return w.useEffect(()=>{if(!n)return;let s=0;const l=f=>{const h=f.clientY-s;s=f.clientY,t.current(h)},u=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u),document.body.style.cursor="",document.body.style.userSelect="",n.classList.remove("active")},d=f=>{f.preventDefault(),s=f.clientY,document.addEventListener("mousemove",l),document.addEventListener("mouseup",u),document.body.style.cursor="row-resize",document.body.style.userSelect="none",n.classList.add("active")};return n.addEventListener("mousedown",d),()=>{n.removeEventListener("mousedown",d),u()}},[n]),w.useCallback(s=>a(s),[])}function vG(){mG(),dG(),fG();const{leftCollapsed:e,rightCollapsed:t,bottomCollapsed:n,theme:a,leftWidth:s,rightWidth:l,setLeftWidth:u,setRightWidth:d,setBottomHeight:f}=Vn(),[,h]=w.useState(0);w.useEffect(()=>{uG(a)},[a]),w.useEffect(()=>{const N=()=>h(S=>S+1);return window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),w.useLayoutEffect(()=>{const N=window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("resize"))});return()=>window.cancelAnimationFrame(N)},[e,t]);const g=w.useCallback(N=>{const S=Vn.getState().leftWidth;u(Math.max(140,Math.min(400,S+N)))},[u]),m=w.useCallback(N=>{const S=Vn.getState().rightWidth;d(Math.max(200,Math.min(500,S-N)))},[d]),y=w.useCallback(N=>{const S=Math.min(Vn.getState().bottomHeight,sd());f(Math.min(S-N,sd()))},[f]),b=Yk(g),k=Yk(m),j=gG(y);return o.jsxs("div",{className:"v10-app",children:[o.jsx(hG,{}),o.jsx(vL,{}),o.jsxs("div",{className:"v10-app-body",children:[!e&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-panel-left",style:{width:s},children:o.jsx(o4,{})}),o.jsx("div",{className:"v10-resize-handle-h",ref:b})]}),o.jsxs("div",{className:"v10-center-region",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[o.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden"},children:o.jsx(e7,{})}),!n&&o.jsx("div",{className:"v10-resize-handle-v",ref:j}),o.jsx(f7,{})]}),!t&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-resize-handle-h",ref:k}),o.jsx("div",{className:"v10-panel-right",style:{width:l},children:o.jsx(cG,{})})]})]})]})}const yG=Ve.lazy(()=>gt(()=>import("./Network-C8AvmIfL.js"),[]).then(e=>({default:e.NetworkPage})));function bG(){const e=fn(t=>t.openTab);return w.useLayoutEffect(()=>{e(xj)},[e]),o.jsx(El,{to:"/",replace:!0})}function xG(){return o.jsxs(u2,{children:[o.jsx(vi,{path:"/network",element:o.jsx(Ve.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading..."}),children:o.jsx(yG,{})})}),o.jsx(vi,{path:"/context-graph-primer",element:o.jsx(bG,{})}),o.jsx(vi,{path:"/agent",element:o.jsx(El,{to:"/",replace:!0})}),o.jsx(vi,{path:"/explorer",element:o.jsx(El,{to:"/",replace:!0})}),o.jsx(vi,{path:"/messages",element:o.jsx(El,{to:"/",replace:!0})}),o.jsx(vi,{path:"/apps/*",element:o.jsx(El,{to:"/",replace:!0})}),o.jsx(vi,{path:"*",element:o.jsx(vG,{})})]})}pA.createRoot(document.getElementById("root")).render(o.jsx(Ve.StrictMode,{children:o.jsx(M2,{basename:"/ui",children:o.jsx(xG,{})})}));export{JG as $,XM as A,KG as B,aO as C,VG as D,ln as E,WG as F,qG as G,$n as H,HG as I,GG as J,DG as K,mS as L,jg as M,ZG as N,$G as O,cG as P,Lg as Q,Ve as R,Fd as S,k5 as T,nV as U,p1 as V,OO as W,W4 as X,Z4 as Y,DO as Z,gt as _,es as a,l4 as a0,zO as a1,SG as a2,Wl as a3,zR as a4,IR as a5,C5 as a6,zS as a7,OG as a8,LG as a9,CM as aA,ls as aB,wg as aC,cz as aD,lr as aE,Gg as aF,Ji as aG,PS as aH,US as aI,Pl as aJ,bM as aK,Ua as aL,Ar as aM,fn as aN,tV as aO,m5 as aP,PR as aa,XG as ab,eV as ac,o as ad,RG as ae,AG as af,r_ as ag,rV as ah,FS as ai,Em as aj,CG as ak,n_ as al,NG as am,TG as an,OR as ao,EG as ap,w as aq,f1 as ar,YG as as,u5 as at,N5 as au,gv as av,QG as aw,Zs as ax,zG as ay,IG as az,vj as b,sO as c,cO as d,vO as e,mj as f,Tt as g,Ft as h,pk as i,jm as j,kG as k,cn as l,jG as m,MG as n,Wx as o,Cg as p,i_ as q,BG as r,FG as s,l_ as t,PG as u,_G as v,u_ as w,UG as x,c_ as y,od as z};