@origintrail-official/dkg-node-ui 10.0.2 → 10.0.3

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 (50) hide show
  1. package/dist/chain-cursor-stores.d.ts +45 -0
  2. package/dist/chain-cursor-stores.d.ts.map +1 -0
  3. package/dist/chain-cursor-stores.js +107 -0
  4. package/dist/chain-cursor-stores.js.map +1 -0
  5. package/dist/chat-memory.d.ts +0 -17
  6. package/dist/chat-memory.d.ts.map +1 -1
  7. package/dist/chat-memory.js +6 -33
  8. package/dist/chat-memory.js.map +1 -1
  9. package/dist/db.d.ts +15 -0
  10. package/dist/db.d.ts.map +1 -1
  11. package/dist/db.js +40 -1
  12. package/dist/db.js.map +1 -1
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +2 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/notifications-scope.d.ts +19 -0
  18. package/dist/notifications-scope.d.ts.map +1 -1
  19. package/dist/notifications-scope.js +34 -2
  20. package/dist/notifications-scope.js.map +1 -1
  21. package/dist-ui/assets/{3d-force-graph-CcVMtgO4.js → 3d-force-graph-DRDhpplH.js} +1 -1
  22. package/dist-ui/assets/AgentHub-DdUAxJoy.js +1 -0
  23. package/dist-ui/assets/AgentProfilePage-yI8fA4vv.js +1 -0
  24. package/dist-ui/assets/ApproveWalletsModal-9w2edv7e.js +57 -0
  25. package/dist-ui/assets/ConvictionDetailView-CcQMya-y.js +2 -0
  26. package/dist-ui/assets/Network-DpAKVzwi.js +1 -0
  27. package/dist-ui/assets/OnChainProvenanceCard-DMOm3jLz.js +1 -0
  28. package/dist-ui/assets/{Operations-CCMDENBd.js → Operations-DKJFp6hM.js} +1 -1
  29. package/dist-ui/assets/PublishingConviction-1CPHxNwp.js +2 -0
  30. package/dist-ui/assets/Settings-DaYMlGHD.js +1 -0
  31. package/dist-ui/assets/ccip-hCQYqfNz.js +1 -0
  32. package/dist-ui/assets/{index-BrxEjqsW.js → index-Bh_8bMB0.js} +3 -3
  33. package/dist-ui/assets/{index-W4n8cdTA.js → index-CVwCoJrM.js} +10 -10
  34. package/dist-ui/assets/index-D5UiTYlY.css +1 -0
  35. package/dist-ui/assets/index-DGpnb_b1.js +1661 -0
  36. package/dist-ui/assets/{jsonld-32FQRO67-CbN9NJJW.js → jsonld-32FQRO67-C3B_LjZ-.js} +2 -2
  37. package/dist-ui/assets/{jsonld-DkQdPwg5.js → jsonld-CoPRWQuM.js} +1 -1
  38. package/dist-ui/assets/{renderer-3d-2EVDZII7-CTUExXUn.js → renderer-3d-2EVDZII7-Bx6o7Gge.js} +2 -2
  39. package/dist-ui/index.html +2 -2
  40. package/package.json +5 -3
  41. package/dist-ui/assets/Admin-DNNaF7rz.js +0 -45
  42. package/dist-ui/assets/AgentHub-eWb_Tns6.js +0 -1
  43. package/dist-ui/assets/AgentProfilePage-D2T_V6PG.js +0 -1
  44. package/dist-ui/assets/Network-C6MDsv2e.js +0 -1
  45. package/dist-ui/assets/OnChainProvenanceCard-BbrU7jzL.js +0 -1
  46. package/dist-ui/assets/Settings-WaFKYtwQ.js +0 -1
  47. package/dist-ui/assets/ccip-CDdHldzo.js +0 -1
  48. package/dist-ui/assets/formatTrac-BTy0WudH.js +0 -1
  49. package/dist-ui/assets/index-2Gzrk1k3.js +0 -1661
  50. package/dist-ui/assets/index-CmliV5st.css +0 -1
@@ -0,0 +1,1661 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Bh_8bMB0.js","assets/ordinal-DhEzRPdO.js","assets/OnChainProvenanceCard-DMOm3jLz.js","assets/Operations-DKJFp6hM.js","assets/PublishingConviction-1CPHxNwp.js","assets/ApproveWalletsModal-9w2edv7e.js","assets/ConvictionDetailView-CcQMya-y.js"])))=>i.map(i=>d[i]);
2
+ var rA=Object.defineProperty;var iA=(e,t,n)=>t in e?rA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Sn=(e,t,n)=>iA(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(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 r(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 r(){return this instanceof r?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(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var lh={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 kx;function sA(){if(kx)return pl;kx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,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:r,key:u,ref:s!==void 0?s:null,props:l}}return pl.Fragment=t,pl.jsx=n,pl.jsxs=n,pl}var Sx;function oA(){return Sx||(Sx=1,lh.exports=sA()),lh.exports}var o=oA(),ch={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 jx;function lA(){if(jx)return Ge;jx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),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,C={};function S(U,G,O){this.props=U,this.context=G,this.refs=C,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=C,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 R(){}var D={H:null,A:null,T:null,S:null},H=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 _(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 W=/\/+/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(R,R):(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 q(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,q(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(W,"$&/")+"/"),q(ue,G,O,"",function(Ie){return Ie})):ue!=null&&(P(ue)&&(ue=_(ue,O+(ue.key==null||U&&U.key===ue.key?"":(""+ue.key).replace(W,"$&/")+"/")+be)),G.push(ue)),1;be=0;var Re=ne===""?".":ne+":";if(B(U))for(var Ee=0;Ee<U.length;Ee++)ne=U[Ee],le=Re+I(ne,Ee),be+=q(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=Re+I(ne,Ee++),be+=q(ne,G,O,le,ue);else if(le==="object"){if(typeof U.then=="function")return q($(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 q(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 K=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=r,Ge.Suspense=f,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(U){return D.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)!H.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),Re=0;Re<le;Re++)be[Re]=arguments[Re+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)H.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 Re=Array(be),Ee=0;Ee<be;Ee++)Re[Ee]=arguments[Ee+2];ue.children=Re}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=D.T,O={};D.T=O;try{var ne=U(),ue=D.S;ue!==null&&ue(O,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(R,K)}catch(le){K(le)}finally{G!==null&&O.types!==null&&(G.types=O.types),D.T=G}},Ge.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ge.use=function(U){return D.H.use(U)},Ge.useActionState=function(U,G,O){return D.H.useActionState(U,G,O)},Ge.useCallback=function(U,G){return D.H.useCallback(U,G)},Ge.useContext=function(U){return D.H.useContext(U)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(U,G){return D.H.useDeferredValue(U,G)},Ge.useEffect=function(U,G){return D.H.useEffect(U,G)},Ge.useEffectEvent=function(U){return D.H.useEffectEvent(U)},Ge.useId=function(){return D.H.useId()},Ge.useImperativeHandle=function(U,G,O){return D.H.useImperativeHandle(U,G,O)},Ge.useInsertionEffect=function(U,G){return D.H.useInsertionEffect(U,G)},Ge.useLayoutEffect=function(U,G){return D.H.useLayoutEffect(U,G)},Ge.useMemo=function(U,G){return D.H.useMemo(U,G)},Ge.useOptimistic=function(U,G){return D.H.useOptimistic(U,G)},Ge.useReducer=function(U,G,O){return D.H.useReducer(U,G,O)},Ge.useRef=function(U){return D.H.useRef(U)},Ge.useState=function(U){return D.H.useState(U)},Ge.useSyncExternalStore=function(U,G,O){return D.H.useSyncExternalStore(U,G,O)},Ge.useTransition=function(){return D.H.useTransition()},Ge.version="19.2.4",Ge}var Cx;function pg(){return Cx||(Cx=1,ch.exports=lA()),ch.exports}var w=pg();const Ve=Wl(w);var uh={exports:{}},fl={},dh={exports:{}},ph={};/**
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 Nx;function cA(){return Nx||(Nx=1,(function(e){function t(q,V){var X=q.length;q.push(V);e:for(;0<X;){var K=X-1>>>1,L=q[K];if(0<s(L,V))q[K]=V,q[X]=L,X=K;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var V=q[0],X=q.pop();if(X!==V){q[0]=X;e:for(var K=0,L=q.length,U=L>>>1;K<U;){var G=2*(K+1)-1,O=q[G],ne=G+1,ue=q[ne];if(0>s(O,X))ne<L&&0>s(ue,O)?(q[K]=ue,q[ne]=X,K=ne):(q[K]=O,q[G]=X,K=G);else if(ne<L&&0>s(ue,X))q[K]=ue,q[ne]=X,K=ne;else break e}}return V}function s(q,V){var X=q.sortIndex-V.sortIndex;return X!==0?X:q.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,C=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function A(q){for(var V=n(h);V!==null;){if(V.callback===null)r(h);else if(V.startTime<=q)r(h),V.sortIndex=V.expirationTime,t(f,V);else break;V=n(h)}}function B(q){if(j=!1,A(q),!k)if(n(f)!==null)k=!0,R||(R=!0,F());else{var V=n(h);V!==null&&$(B,V.startTime-q)}}var R=!1,D=-1,H=5,M=-1;function _(){return C?!0:!(e.unstable_now()-M<H)}function P(){if(C=!1,R){var q=e.unstable_now();M=q;var V=!0;try{e:{k=!1,j&&(j=!1,T(D),D=-1),b=!0;var X=y;try{t:{for(A(q),m=n(f);m!==null&&!(m.expirationTime>q&&_());){var K=m.callback;if(typeof K=="function"){m.callback=null,y=m.priorityLevel;var L=K(m.expirationTime<=q);if(q=e.unstable_now(),typeof L=="function"){m.callback=L,A(q),V=!0;break t}m===n(f)&&r(f),A(q)}else r(f);m=n(f)}if(m!==null)V=!0;else{var U=n(h);U!==null&&$(B,U.startTime-q),V=!1}}break e}finally{m=null,y=X,b=!1}V=void 0}}finally{V?F():R=!1}}}var F;if(typeof E=="function")F=function(){E(P)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,I=W.port2;W.port1.onmessage=P,F=function(){I.postMessage(null)}}else F=function(){S(P,0)};function $(q,V){D=S(function(){q(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(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(q){switch(y){case 1:case 2:case 3:var V=3;break;default:V=y}var X=y;y=V;try{return q()}finally{y=X}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(q,V){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var X=y;y=q;try{return V()}finally{y=X}},e.unstable_scheduleCallback=function(q,V,X){var K=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?K+X:K):X=K,q){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,q={id:g++,callback:V,priorityLevel:q,startTime:X,expirationTime:L,sortIndex:-1},X>K?(q.sortIndex=X,t(h,q),n(f)===null&&q===n(h)&&(j?(T(D),D=-1):j=!0,$(B,X-K))):(q.sortIndex=L,t(f,q),k||b||(k=!0,R||(R=!0,F()))),q},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(q){var V=y;return function(){var X=y;y=V;try{return q.apply(this,arguments)}finally{y=X}}}})(ph)),ph}var Ex;function uA(){return Ex||(Ex=1,dh.exports=cA()),dh.exports}var fh={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 Tx;function dA(){if(Tx)return En;Tx=1;var e=pg();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 r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function 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=r,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=r.p;try{if(u.T=null,r.p=2,f)return f()}finally{u.T=h,r.p=g,r.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,r.d.C(f,h))},En.prefetchDNS=function(f){typeof f=="string"&&r.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"?r.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:b}):g==="script"&&r.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);r.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&&r.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);r.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);r.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 r.d.m(f)},En.requestFormReset=function(f){r.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 Ax;function eS(){if(Ax)return fh.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(),fh.exports=dA(),fh.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 Rx;function pA(){if(Rx)return fl;Rx=1;var e=uA(),t=pg(),n=eS();function r(a){var i="https://react.dev/errors/"+a;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 #"+a+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function l(a){var i=a,c=a;if(a.alternate)for(;i.return;)i=i.return;else{a=i;do i=a,(i.flags&4098)!==0&&(c=i.return),a=i.return;while(a)}return i.tag===3?c:null}function u(a){if(a.tag===13){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function d(a){if(a.tag===31){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function f(a){if(l(a)!==a)throw Error(r(188))}function h(a){var i=a.alternate;if(!i){if(i=l(a),i===null)throw Error(r(188));return i!==a?null:a}for(var c=a,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),a;if(x===p)return f(v),i;x=x.sibling}throw Error(r(188))}if(c.return!==p.return)c=v,p=x;else{for(var N=!1,z=v.child;z;){if(z===c){N=!0,c=v,p=x;break}if(z===p){N=!0,p=v,c=x;break}z=z.sibling}if(!N){for(z=x.child;z;){if(z===c){N=!0,c=x,p=v;break}if(z===p){N=!0,p=x,c=v;break}z=z.sibling}if(!N)throw Error(r(189))}}if(c.alternate!==p)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?a:i}function g(a){var i=a.tag;if(i===5||i===26||i===27||i===6)return a;for(a=a.child;a!==null;){if(i=g(a),i!==null)return i;a=a.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"),C=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"),R=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),_=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function F(a){return a===null||typeof a!="object"?null:(a=P&&a[P]||a["@@iterator"],typeof a=="function"?a:null)}var W=Symbol.for("react.client.reference");function I(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===W?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case j:return"Fragment";case S:return"Profiler";case C:return"StrictMode";case B:return"Suspense";case R:return"SuspenseList";case M:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case k:return"Portal";case E:return a.displayName||"Context";case T:return(a._context.displayName||"Context")+".Consumer";case A:var i=a.render;return a=a.displayName,a||(a=i.displayName||i.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case D:return i=a.displayName||null,i!==null?i:I(a.type)||"Memo";case H:i=a._payload,a=a._init;try{return I(a(i))}catch{}}return null}var $=Array.isArray,q=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},K=[],L=-1;function U(a){return{current:a}}function G(a){0>L||(a.current=K[L],K[L]=null,L--)}function O(a,i){L++,K[L]=a.current,a.current=i}var ne=U(null),ue=U(null),le=U(null),be=U(null);function Re(a,i){switch(O(le,i),O(ue,a),O(ne,null),i.nodeType){case 9:case 11:a=(a=i.documentElement)&&(a=a.namespaceURI)?G0(a):0;break;default:if(a=i.tagName,i=i.namespaceURI)i=G0(i),a=V0(i,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}G(ne),O(ne,a)}function Ee(){G(ne),G(ue),G(le)}function Ie(a){a.memoizedState!==null&&O(be,a);var i=ne.current,c=V0(i,a.type);i!==c&&(O(ue,a),O(ne,c))}function We(a){ue.current===a&&(G(ne),G(ue)),be.current===a&&(G(be),ll._currentValue=X)}var Se,ft;function ze(a){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+a+ft}var qe=!1;function ke(a,i){if(!a||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(a,[],me)}else{try{me.call()}catch(oe){se=oe}a.call(me.prototype)}}else{try{throw Error()}catch(oe){se=oe}(me=a())&&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(),N=x[0],z=x[1];if(N&&z){var Y=N.split(`
45
+ `),re=z.split(`
46
+ `);for(v=p=0;p<Y.length&&!Y[p].includes("DetermineComponentFrameRoot");)p++;for(;v<re.length&&!re[v].includes("DetermineComponentFrameRoot");)v++;if(p===Y.length||v===re.length)for(p=Y.length-1,v=re.length-1;1<=p&&0<=v&&Y[p]!==re[v];)v--;for(;1<=p&&0<=v;p--,v--)if(Y[p]!==re[v]){if(p!==1||v!==1)do if(p--,v--,0>v||Y[p]!==re[v]){var pe=`
47
+ `+Y[p].replace(" at new "," at ");return a.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",a.displayName)),pe}while(1<=p&&0<=v);break}}}finally{qe=!1,Error.prepareStackTrace=c}return(c=a?a.displayName||a.name:"")?ze(c):""}function lt(a,i){switch(a.tag){case 26:case 27:case 5:return ze(a.type);case 16:return ze("Lazy");case 13:return a.child!==i&&i!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return ke(a.type,!1);case 11:return ke(a.type.render,!1);case 1:return ke(a.type,!0);case 31:return ze("Activity");default:return""}}function xe(a){try{var i="",c=null;do i+=lt(a,c),c=a,a=a.return;while(a);return i}catch(p){return`
48
+ Error generating stack: `+p.message+`
49
+ `+p.stack}}var Oe=Object.prototype.hasOwnProperty,_t=e.unstable_scheduleCallback,Dt=e.unstable_cancelCallback,Yt=e.unstable_shouldYield,Ht=e.unstable_requestPaint,ut=e.unstable_now,ye=e.unstable_getCurrentPriorityLevel,Q=e.unstable_ImmediatePriority,Z=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(a){if(typeof Le=="function"&&He(a),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(Ce,a)}catch{}}var Ne=Math.clz32?Math.clz32:Ha,Vt=Math.log,At=Math.LN2;function Ha(a){return a>>>=0,a===0?32:31-(Vt(a)/At|0)|0}var ua=256,Fr=262144,Hr=4194304;function da(a){var i=a&42;if(i!==0)return i;switch(a&-a){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 a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function qa(a,i,c){var p=a.pendingLanes;if(p===0)return 0;var v=0,x=a.suspendedLanes,N=a.pingedLanes;a=a.warmLanes;var z=p&134217727;return z!==0?(p=z&~x,p!==0?v=da(p):(N&=z,N!==0?v=da(N):c||(c=z&~a,c!==0&&(v=da(c))))):(z=p&~x,z!==0?v=da(z):N!==0?v=da(N):c||(c=p&~a,c!==0&&(v=da(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 cr(a,i){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&i)===0}function ic(a,i){switch(a){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 qr(){var a=Hr;return Hr<<=1,(Hr&62914560)===0&&(Hr=4194304),a}function Ci(a){for(var i=[],c=0;31>c;c++)i.push(a);return i}function ge(a,i){a.pendingLanes|=i,i!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function Me(a,i,c,p,v,x){var N=a.pendingLanes;a.pendingLanes=c,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=c,a.entangledLanes&=c,a.errorRecoveryDisabledLanes&=c,a.shellSuspendCounter=0;var z=a.entanglements,Y=a.expirationTimes,re=a.hiddenUpdates;for(c=N&~c;0<c;){var pe=31-Ne(c),me=1<<pe;z[pe]=0,Y[pe]=-1;var se=re[pe];if(se!==null)for(re[pe]=null,pe=0;pe<se.length;pe++){var oe=se[pe];oe!==null&&(oe.lane&=-536870913)}c&=~me}p!==0&&de(a,p,0),x!==0&&v===0&&a.tag!==0&&(a.suspendedLanes|=x&~(N&~i))}function de(a,i,c){a.pendingLanes|=i,a.suspendedLanes&=~i;var p=31-Ne(i);a.entangledLanes|=i,a.entanglements[p]=a.entanglements[p]|1073741824|c&261930}function je(a,i){var c=a.entangledLanes|=i;for(a=a.entanglements;c;){var p=31-Ne(c),v=1<<p;v&i|a[p]&i&&(a[p]|=i),c&=~v}}function Te(a,i){var c=i&-i;return c=(c&42)!==0?1:tt(c),(c&(a.suspendedLanes|i))!==0?0:c}function tt(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=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:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function Je(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function Ye(){var a=V.p;return a!==0?a:(a=window.event,a===void 0?32:mx(a.type))}function pt(a,i){var c=V.p;try{return V.p=a,i()}finally{V.p=c}}var hn=Math.random().toString(36).slice(2),qt="__reactFiber$"+hn,cn="__reactProps$"+hn,ur="__reactContainer$"+hn,dr="__reactEvents$"+hn,ps="__reactListeners$"+hn,Zn="__reactHandles$"+hn,pa="__reactResources$"+hn,Oa="__reactMarker$"+hn;function Gr(a){delete a[qt],delete a[cn],delete a[dr],delete a[ps],delete a[Zn]}function mn(a){var i=a[qt];if(i)return i;for(var c=a.parentNode;c;){if(i=c[ur]||c[qt]){if(c=i.alternate,i.child!==null||c!==null&&c.child!==null)for(a=J0(a);a!==null;){if(c=a[qt])return c;a=J0(a)}return i}a=c,c=a.parentNode}return null}function Nn(a){if(a=a[qt]||a[ur]){var i=a.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return a}return null}function pr(a){var i=a.tag;if(i===5||i===26||i===27||i===6)return a.stateNode;throw Error(r(33))}function fa(a){var i=a[pa];return i||(i=a[pa]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Ot(a){a[Oa]=!0}var jo=new Set,sc={};function ha(a,i){fr(a,i),fr(a+"Capture",i)}function fr(a,i){for(sc[a]=i,a=0;a<i.length;a++)jo.add(i[a])}var en=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]*$"),ma={},Ga={};function KN(a){return Oe.call(Ga,a)?!0:Oe.call(ma,a)?!1:en.test(a)?Ga[a]=!0:(ma[a]=!0,!1)}function oc(a,i,c){if(KN(i))if(c===null)a.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":a.removeAttribute(i);return;case"boolean":var p=i.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){a.removeAttribute(i);return}}a.setAttribute(i,""+c)}}function lc(a,i,c){if(c===null)a.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(i);return}a.setAttribute(i,""+c)}}function hr(a,i,c,p){if(p===null)a.removeAttribute(c);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(c);return}a.setAttributeNS(i,c,""+p)}}function ga(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function $v(a){var i=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function QN(a,i,c){var p=Object.getOwnPropertyDescriptor(a.constructor.prototype,i);if(!a.hasOwnProperty(i)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var v=p.get,x=p.set;return Object.defineProperty(a,i,{configurable:!0,get:function(){return v.call(this)},set:function(N){c=""+N,x.call(this,N)}}),Object.defineProperty(a,i,{enumerable:p.enumerable}),{getValue:function(){return c},setValue:function(N){c=""+N},stopTracking:function(){a._valueTracker=null,delete a[i]}}}}function ep(a){if(!a._valueTracker){var i=$v(a)?"checked":"value";a._valueTracker=QN(a,i,""+a[i])}}function Iv(a){if(!a)return!1;var i=a._valueTracker;if(!i)return!0;var c=i.getValue(),p="";return a&&(p=$v(a)?a.checked?"true":"false":a.value),a=p,a!==c?(i.setValue(a),!0):!1}function cc(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var XN=/[\n"\\]/g;function va(a){return a.replace(XN,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function tp(a,i,c,p,v,x,N,z){a.name="",N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?a.type=N:a.removeAttribute("type"),i!=null?N==="number"?(i===0&&a.value===""||a.value!=i)&&(a.value=""+ga(i)):a.value!==""+ga(i)&&(a.value=""+ga(i)):N!=="submit"&&N!=="reset"||a.removeAttribute("value"),i!=null?np(a,N,ga(i)):c!=null?np(a,N,ga(c)):p!=null&&a.removeAttribute("value"),v==null&&x!=null&&(a.defaultChecked=!!x),v!=null&&(a.checked=v&&typeof v!="function"&&typeof v!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?a.name=""+ga(z):a.removeAttribute("name")}function Pv(a,i,c,p,v,x,N,z){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(a.type=x),i!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||i!=null)){ep(a);return}c=c!=null?""+ga(c):"",i=i!=null?""+ga(i):c,z||i===a.value||(a.value=i),a.defaultValue=i}p=p??v,p=typeof p!="function"&&typeof p!="symbol"&&!!p,a.checked=z?a.checked:!!p,a.defaultChecked=!!p,N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(a.name=N),ep(a)}function np(a,i,c){i==="number"&&cc(a.ownerDocument)===a||a.defaultValue===""+c||(a.defaultValue=""+c)}function fs(a,i,c,p){if(a=a.options,i){i={};for(var v=0;v<c.length;v++)i["$"+c[v]]=!0;for(c=0;c<a.length;c++)v=i.hasOwnProperty("$"+a[c].value),a[c].selected!==v&&(a[c].selected=v),v&&p&&(a[c].defaultSelected=!0)}else{for(c=""+ga(c),i=null,v=0;v<a.length;v++){if(a[v].value===c){a[v].selected=!0,p&&(a[v].defaultSelected=!0);return}i!==null||a[v].disabled||(i=a[v])}i!==null&&(i.selected=!0)}}function Uv(a,i,c){if(i!=null&&(i=""+ga(i),i!==a.value&&(a.value=i),c==null)){a.defaultValue!==i&&(a.defaultValue=i);return}a.defaultValue=c!=null?""+ga(c):""}function Bv(a,i,c,p){if(i==null){if(p!=null){if(c!=null)throw Error(r(92));if($(p)){if(1<p.length)throw Error(r(93));p=p[0]}c=p}c==null&&(c=""),i=c}c=ga(i),a.defaultValue=c,p=a.textContent,p===c&&p!==""&&p!==null&&(a.value=p),ep(a)}function hs(a,i){if(i){var c=a.firstChild;if(c&&c===a.lastChild&&c.nodeType===3){c.nodeValue=i;return}}a.textContent=i}var JN=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 Fv(a,i,c){var p=i.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?p?a.setProperty(i,""):i==="float"?a.cssFloat="":a[i]="":p?a.setProperty(i,c):typeof c!="number"||c===0||JN.has(i)?i==="float"?a.cssFloat=c:a[i]=(""+c).trim():a[i]=c+"px"}function Hv(a,i,c){if(i!=null&&typeof i!="object")throw Error(r(62));if(a=a.style,c!=null){for(var p in c)!c.hasOwnProperty(p)||i!=null&&i.hasOwnProperty(p)||(p.indexOf("--")===0?a.setProperty(p,""):p==="float"?a.cssFloat="":a[p]="");for(var v in i)p=i[v],i.hasOwnProperty(v)&&c[v]!==p&&Fv(a,v,p)}else for(var x in i)i.hasOwnProperty(x)&&Fv(a,x,i[x])}function ap(a){if(a.indexOf("-")===-1)return!1;switch(a){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 eE=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"]]),tE=/^[\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(a){return tE.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function mr(){}var rp=null;function ip(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var ms=null,gs=null;function qv(a){var i=Nn(a);if(i&&(a=i.stateNode)){var c=a[cn]||null;e:switch(a=i.stateNode,i.type){case"input":if(tp(a,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),i=c.name,c.type==="radio"&&i!=null){for(c=a;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+va(""+i)+'"][type="radio"]'),i=0;i<c.length;i++){var p=c[i];if(p!==a&&p.form===a.form){var v=p[cn]||null;if(!v)throw Error(r(90));tp(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===a.form&&Iv(p)}break e;case"textarea":Uv(a,c.value,c.defaultValue);break e;case"select":i=c.value,i!=null&&fs(a,!!c.multiple,i,!1)}}}var sp=!1;function Gv(a,i,c){if(sp)return a(i,c);sp=!0;try{var p=a(i);return p}finally{if(sp=!1,(ms!==null||gs!==null)&&(Qc(),ms&&(i=ms,a=gs,gs=ms=null,qv(i),a)))for(i=0;i<a.length;i++)qv(a[i])}}function Co(a,i){var c=a.stateNode;if(c===null)return null;var p=c[cn]||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)||(a=a.type,p=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!p;break e;default:a=!1}if(a)return null;if(c&&typeof c!="function")throw Error(r(231,i,typeof c));return c}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),op=!1;if(gr)try{var No={};Object.defineProperty(No,"passive",{get:function(){op=!0}}),window.addEventListener("test",No,No),window.removeEventListener("test",No,No)}catch{op=!1}var Vr=null,lp=null,dc=null;function Vv(){if(dc)return dc;var a,i=lp,c=i.length,p,v="value"in Vr?Vr.value:Vr.textContent,x=v.length;for(a=0;a<c&&i[a]===v[a];a++);var N=c-a;for(p=1;p<=N&&i[c-p]===v[x-p];p++);return dc=v.slice(a,1<p?1-p:void 0)}function pc(a){var i=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&i===13&&(a=13)):a=i,a===10&&(a=13),32<=a||a===13?a:0}function fc(){return!0}function Wv(){return!1}function $n(a){function i(c,p,v,x,N){this._reactName=c,this._targetInst=v,this.type=p,this.nativeEvent=x,this.target=N,this.currentTarget=null;for(var z in a)a.hasOwnProperty(z)&&(c=a[z],this[z]=c?c(x):x[z]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?fc:Wv,this.isPropagationStopped=Wv,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(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hc=$n(Ni),Eo=m({},Ni,{view:0,detail:0}),nE=$n(Eo),cp,up,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:pp,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==To&&(To&&a.type==="mousemove"?(cp=a.screenX-To.screenX,up=a.screenY-To.screenY):up=cp=0,To=a),cp)},movementY:function(a){return"movementY"in a?a.movementY:up}}),Zv=$n(mc),aE=m({},mc,{dataTransfer:0}),rE=$n(aE),iE=m({},Eo,{relatedTarget:0}),dp=$n(iE),sE=m({},Ni,{animationName:0,elapsedTime:0,pseudoElement:0}),oE=$n(sE),lE=m({},Ni,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),cE=$n(lE),uE=m({},Ni,{data:0}),Yv=$n(uE),dE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pE={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"},fE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hE(a){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(a):(a=fE[a])?!!i[a]:!1}function pp(){return hE}var mE=m({},Eo,{key:function(a){if(a.key){var i=dE[a.key]||a.key;if(i!=="Unidentified")return i}return a.type==="keypress"?(a=pc(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?pE[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pp,charCode:function(a){return a.type==="keypress"?pc(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?pc(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),gE=$n(mE),vE=m({},mc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Kv=$n(vE),yE=m({},Eo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pp}),bE=$n(yE),xE=m({},Ni,{propertyName:0,elapsedTime:0,pseudoElement:0}),wE=$n(xE),kE=m({},mc,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),SE=$n(kE),jE=m({},Ni,{newState:0,oldState:0}),CE=$n(jE),NE=[9,13,27,32],fp=gr&&"CompositionEvent"in window,Ao=null;gr&&"documentMode"in document&&(Ao=document.documentMode);var EE=gr&&"TextEvent"in window&&!Ao,Qv=gr&&(!fp||Ao&&8<Ao&&11>=Ao),Xv=" ",Jv=!1;function ey(a,i){switch(a){case"keyup":return NE.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ty(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var vs=!1;function TE(a,i){switch(a){case"compositionend":return ty(i);case"keypress":return i.which!==32?null:(Jv=!0,Xv);case"textInput":return a=i.data,a===Xv&&Jv?null:a;default:return null}}function AE(a,i){if(vs)return a==="compositionend"||!fp&&ey(a,i)?(a=Vv(),dc=lp=Vr=null,vs=!1,a):null;switch(a){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 Qv&&i.locale!=="ko"?null:i.data;default:return null}}var RE={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 ny(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i==="input"?!!RE[a.type]:i==="textarea"}function ay(a,i,c,p){ms?gs?gs.push(p):gs=[p]:ms=p,i=ru(i,"onChange"),0<i.length&&(c=new hc("onChange","change",null,c,p),a.push({event:c,listeners:i}))}var Ro=null,_o=null;function _E(a){P0(a,0)}function gc(a){var i=pr(a);if(Iv(i))return a}function ry(a,i){if(a==="change")return i}var iy=!1;if(gr){var hp;if(gr){var mp="oninput"in document;if(!mp){var sy=document.createElement("div");sy.setAttribute("oninput","return;"),mp=typeof sy.oninput=="function"}hp=mp}else hp=!1;iy=hp&&(!document.documentMode||9<document.documentMode)}function oy(){Ro&&(Ro.detachEvent("onpropertychange",ly),_o=Ro=null)}function ly(a){if(a.propertyName==="value"&&gc(_o)){var i=[];ay(i,_o,a,ip(a)),Gv(_E,i)}}function OE(a,i,c){a==="focusin"?(oy(),Ro=i,_o=c,Ro.attachEvent("onpropertychange",ly)):a==="focusout"&&oy()}function LE(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return gc(_o)}function ME(a,i){if(a==="click")return gc(i)}function zE(a,i){if(a==="input"||a==="change")return gc(i)}function DE(a,i){return a===i&&(a!==0||1/a===1/i)||a!==a&&i!==i}var Yn=typeof Object.is=="function"?Object.is:DE;function Oo(a,i){if(Yn(a,i))return!0;if(typeof a!="object"||a===null||typeof i!="object"||i===null)return!1;var c=Object.keys(a),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(a[v],i[v]))return!1}return!0}function cy(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function uy(a,i){var c=cy(a);a=0;for(var p;c;){if(c.nodeType===3){if(p=a+c.textContent.length,a<=i&&p>=i)return{node:c,offset:i-a};a=p}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=cy(c)}}function dy(a,i){return a&&i?a===i?!0:a&&a.nodeType===3?!1:i&&i.nodeType===3?dy(a,i.parentNode):"contains"in a?a.contains(i):a.compareDocumentPosition?!!(a.compareDocumentPosition(i)&16):!1:!1}function py(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var i=cc(a.document);i instanceof a.HTMLIFrameElement;){try{var c=typeof i.contentWindow.location.href=="string"}catch{c=!1}if(c)a=i.contentWindow;else break;i=cc(a.document)}return i}function gp(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i&&(i==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||i==="textarea"||a.contentEditable==="true")}var $E=gr&&"documentMode"in document&&11>=document.documentMode,ys=null,vp=null,Lo=null,yp=!1;function fy(a,i,c){var p=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;yp||ys==null||ys!==cc(p)||(p=ys,"selectionStart"in p&&gp(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=ru(vp,"onSelect"),0<p.length&&(i=new hc("onSelect","select",null,i,c),a.push({event:i,listeners:p}),i.target=ys)))}function Ei(a,i){var c={};return c[a.toLowerCase()]=i.toLowerCase(),c["Webkit"+a]="webkit"+i,c["Moz"+a]="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")},bp={},hy={};gr&&(hy=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(a){if(bp[a])return bp[a];if(!bs[a])return a;var i=bs[a],c;for(c in i)if(i.hasOwnProperty(c)&&c in hy)return bp[a]=i[c];return a}var my=Ti("animationend"),gy=Ti("animationiteration"),vy=Ti("animationstart"),IE=Ti("transitionrun"),PE=Ti("transitionstart"),UE=Ti("transitioncancel"),yy=Ti("transitionend"),by=new Map,xp="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(" ");xp.push("scrollEnd");function La(a,i){by.set(a,i),ha(i,[a])}var vc=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},ya=[],xs=0,wp=0;function yc(){for(var a=xs,i=wp=xs=0;i<a;){var c=ya[i];ya[i++]=null;var p=ya[i];ya[i++]=null;var v=ya[i];ya[i++]=null;var x=ya[i];if(ya[i++]=null,p!==null&&v!==null){var N=p.pending;N===null?v.next=v:(v.next=N.next,N.next=v),p.pending=v}x!==0&&xy(c,v,x)}}function bc(a,i,c,p){ya[xs++]=a,ya[xs++]=i,ya[xs++]=c,ya[xs++]=p,wp|=p,a.lanes|=p,a=a.alternate,a!==null&&(a.lanes|=p)}function kp(a,i,c,p){return bc(a,i,c,p),xc(a)}function Ai(a,i){return bc(a,null,null,i),xc(a)}function xy(a,i,c){a.lanes|=c;var p=a.alternate;p!==null&&(p.lanes|=c);for(var v=!1,x=a.return;x!==null;)x.childLanes|=c,p=x.alternate,p!==null&&(p.childLanes|=c),x.tag===22&&(a=x.stateNode,a===null||a._visibility&1||(v=!0)),a=x,x=x.return;return a.tag===3?(x=a.stateNode,v&&i!==null&&(v=31-Ne(c),a=x.hiddenUpdates,p=a[v],p===null?a[v]=[i]:p.push(i),i.lane=c|536870912),x):null}function xc(a){if(50<tl)throw tl=0,Of=null,Error(r(185));for(var i=a.return;i!==null;)a=i,i=a.return;return a.tag===3?a.stateNode:null}var ws={};function BE(a,i,c,p){this.tag=a,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 Kn(a,i,c,p){return new BE(a,i,c,p)}function Sp(a){return a=a.prototype,!(!a||!a.isReactComponent)}function vr(a,i){var c=a.alternate;return c===null?(c=Kn(a.tag,i,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=i,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=a.flags&65011712,c.childLanes=a.childLanes,c.lanes=a.lanes,c.child=a.child,c.memoizedProps=a.memoizedProps,c.memoizedState=a.memoizedState,c.updateQueue=a.updateQueue,i=a.dependencies,c.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},c.sibling=a.sibling,c.index=a.index,c.ref=a.ref,c.refCleanup=a.refCleanup,c}function wy(a,i){a.flags&=65011714;var c=a.alternate;return c===null?(a.childLanes=0,a.lanes=i,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=c.childLanes,a.lanes=c.lanes,a.child=c.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=c.memoizedProps,a.memoizedState=c.memoizedState,a.updateQueue=c.updateQueue,a.type=c.type,i=c.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),a}function wc(a,i,c,p,v,x){var N=0;if(p=a,typeof a=="function")Sp(a)&&(N=1);else if(typeof a=="string")N=VT(a,c,ne.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case M:return a=Kn(31,c,i,v),a.elementType=M,a.lanes=x,a;case j:return Ri(c.children,v,x,i);case C:N=8,v|=24;break;case S:return a=Kn(12,c,i,v|2),a.elementType=S,a.lanes=x,a;case B:return a=Kn(13,c,i,v),a.elementType=B,a.lanes=x,a;case R:return a=Kn(19,c,i,v),a.elementType=R,a.lanes=x,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case E:N=10;break e;case T:N=9;break e;case A:N=11;break e;case D:N=14;break e;case H:N=16,p=null;break e}N=29,c=Error(r(130,a===null?"null":typeof a,"")),p=null}return i=Kn(N,c,i,v),i.elementType=a,i.type=p,i.lanes=x,i}function Ri(a,i,c,p){return a=Kn(7,a,p,i),a.lanes=c,a}function jp(a,i,c){return a=Kn(6,a,null,i),a.lanes=c,a}function ky(a){var i=Kn(18,null,null,0);return i.stateNode=a,i}function Cp(a,i,c){return i=Kn(4,a.children!==null?a.children:[],a.key,i),i.lanes=c,i.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},i}var Sy=new WeakMap;function ba(a,i){if(typeof a=="object"&&a!==null){var c=Sy.get(a);return c!==void 0?c:(i={value:a,source:i,stack:xe(i)},Sy.set(a,i),i)}return{value:a,source:i,stack:xe(i)}}var ks=[],Ss=0,kc=null,Mo=0,xa=[],wa=0,Wr=null,Va=1,Wa="";function yr(a,i){ks[Ss++]=Mo,ks[Ss++]=kc,kc=a,Mo=i}function jy(a,i,c){xa[wa++]=Va,xa[wa++]=Wa,xa[wa++]=Wr,Wr=a;var p=Va;a=Wa;var v=32-Ne(p)-1;p&=~(1<<v),c+=1;var x=32-Ne(i)+v;if(30<x){var N=v-v%5;x=(p&(1<<N)-1).toString(32),p>>=N,v-=N,Va=1<<32-Ne(i)+v|c<<v|p,Wa=x+a}else Va=1<<x|c<<v|p,Wa=a}function Np(a){a.return!==null&&(yr(a,1),jy(a,1,0))}function Ep(a){for(;a===kc;)kc=ks[--Ss],ks[Ss]=null,Mo=ks[--Ss],ks[Ss]=null;for(;a===Wr;)Wr=xa[--wa],xa[wa]=null,Wa=xa[--wa],xa[wa]=null,Va=xa[--wa],xa[wa]=null}function Cy(a,i){xa[wa++]=Va,xa[wa++]=Wa,xa[wa++]=Wr,Va=i.id,Wa=i.overflow,Wr=a}var bn=null,Lt=null,ct=!1,Zr=null,ka=!1,Tp=Error(r(519));function Yr(a){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zo(ba(i,a)),Tp}function Ny(a){var i=a.stateNode,c=a.type,p=a.memoizedProps;switch(i[qt]=a,i[cn]=p,c){case"dialog":at("cancel",i),at("close",i);break;case"iframe":case"object":case"embed":at("load",i);break;case"video":case"audio":for(c=0;c<al.length;c++)at(al[c],i);break;case"source":at("error",i);break;case"img":case"image":case"link":at("error",i),at("load",i);break;case"details":at("toggle",i);break;case"input":at("invalid",i),Pv(i,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":at("invalid",i);break;case"textarea":at("invalid",i),Bv(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||H0(i.textContent,c)?(p.popover!=null&&(at("beforetoggle",i),at("toggle",i)),p.onScroll!=null&&at("scroll",i),p.onScrollEnd!=null&&at("scrollend",i),p.onClick!=null&&(i.onclick=mr),i=!0):i=!1,i||Yr(a,!0)}function Ey(a){for(bn=a.return;bn;)switch(bn.tag){case 5:case 31:case 13:ka=!1;return;case 27:case 3:ka=!0;return;default:bn=bn.return}}function js(a){if(a!==bn)return!1;if(!ct)return Ey(a),ct=!0,!1;var i=a.tag,c;if((c=i!==3&&i!==27)&&((c=i===5)&&(c=a.type,c=!(c!=="form"&&c!=="button")||Wf(a.type,a.memoizedProps)),c=!c),c&&Lt&&Yr(a),Ey(a),i===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Lt=X0(a)}else if(i===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Lt=X0(a)}else i===27?(i=Lt,ci(a.type)?(a=Xf,Xf=null,Lt=a):Lt=i):Lt=bn?ja(a.stateNode.nextSibling):null;return!0}function _i(){Lt=bn=null,ct=!1}function Ap(){var a=Zr;return a!==null&&(Bn===null?Bn=a:Bn.push.apply(Bn,a),Zr=null),a}function zo(a){Zr===null?Zr=[a]:Zr.push(a)}var Rp=U(null),Oi=null,br=null;function Kr(a,i,c){O(Rp,i._currentValue),i._currentValue=c}function xr(a){a._currentValue=Rp.current,G(Rp)}function _p(a,i,c){for(;a!==null;){var p=a.alternate;if((a.childLanes&i)!==i?(a.childLanes|=i,p!==null&&(p.childLanes|=i)):p!==null&&(p.childLanes&i)!==i&&(p.childLanes|=i),a===c)break;a=a.return}}function Op(a,i,c,p){var v=a.child;for(v!==null&&(v.return=a);v!==null;){var x=v.dependencies;if(x!==null){var N=v.child;x=x.firstContext;e:for(;x!==null;){var z=x;x=v;for(var Y=0;Y<i.length;Y++)if(z.context===i[Y]){x.lanes|=c,z=x.alternate,z!==null&&(z.lanes|=c),_p(x.return,c,a),p||(N=null);break e}x=z.next}}else if(v.tag===18){if(N=v.return,N===null)throw Error(r(341));N.lanes|=c,x=N.alternate,x!==null&&(x.lanes|=c),_p(N,c,a),N=null}else N=v.child;if(N!==null)N.return=v;else for(N=v;N!==null;){if(N===a){N=null;break}if(v=N.sibling,v!==null){v.return=N.return,N=v;break}N=N.return}v=N}}function Cs(a,i,c,p){a=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 N=v.alternate;if(N===null)throw Error(r(387));if(N=N.memoizedProps,N!==null){var z=v.type;Yn(v.pendingProps.value,N.value)||(a!==null?a.push(z):a=[z])}}else if(v===be.current){if(N=v.alternate,N===null)throw Error(r(387));N.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(a!==null?a.push(ll):a=[ll])}v=v.return}a!==null&&Op(i,a,c,p),i.flags|=262144}function Sc(a){for(a=a.firstContext;a!==null;){if(!Yn(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function Li(a){Oi=a,br=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function xn(a){return Ty(Oi,a)}function jc(a,i){return Oi===null&&Li(a),Ty(a,i)}function Ty(a,i){var c=i._currentValue;if(i={context:i,memoizedValue:c,next:null},br===null){if(a===null)throw Error(r(308));br=i,a.dependencies={lanes:0,firstContext:i},a.flags|=524288}else br=br.next=i;return c}var FE=typeof AbortController<"u"?AbortController:function(){var a=[],i=this.signal={aborted:!1,addEventListener:function(c,p){a.push(p)}};this.abort=function(){i.aborted=!0,a.forEach(function(c){return c()})}},HE=e.unstable_scheduleCallback,qE=e.unstable_NormalPriority,tn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lp(){return{controller:new FE,data:new Map,refCount:0}}function Do(a){a.refCount--,a.refCount===0&&HE(qE,function(){a.controller.abort()})}var $o=null,Mp=0,Ns=0,Es=null;function GE(a,i){if($o===null){var c=$o=[];Mp=0,Ns=If(),Es={status:"pending",value:void 0,then:function(p){c.push(p)}}}return Mp++,i.then(Ay,Ay),i}function Ay(){if(--Mp===0&&$o!==null){Es!==null&&(Es.status="fulfilled");var a=$o;$o=null,Ns=0,Es=null;for(var i=0;i<a.length;i++)(0,a[i])()}}function VE(a,i){var c=[],p={status:"pending",value:null,reason:null,then:function(v){c.push(v)}};return a.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 Ry=q.S;q.S=function(a,i){f0=ut(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&GE(a,i),Ry!==null&&Ry(a,i)};var Mi=U(null);function zp(){var a=Mi.current;return a!==null?a:Nt.pooledCache}function Cc(a,i){i===null?O(Mi,Mi.current):O(Mi,i.pool)}function _y(){var a=zp();return a===null?null:{parent:tn._currentValue,pool:a}}var Ts=Error(r(460)),Dp=Error(r(474)),Nc=Error(r(542)),Ec={then:function(){}};function Oy(a){return a=a.status,a==="fulfilled"||a==="rejected"}function Ly(a,i,c){switch(c=a[c],c===void 0?a.push(i):c!==i&&(i.then(mr,mr),i=c),i.status){case"fulfilled":return i.value;case"rejected":throw a=i.reason,zy(a),a;default:if(typeof i.status=="string")i.then(mr,mr);else{if(a=Nt,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=i,a.status="pending",a.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 a=i.reason,zy(a),a}throw Di=i,Ts}}function zi(a){try{var i=a._init;return i(a._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Di=c,Ts):c}}var Di=null;function My(){if(Di===null)throw Error(r(459));var a=Di;return Di=null,a}function zy(a){if(a===Ts||a===Nc)throw Error(r(483))}var As=null,Io=0;function Tc(a){var i=Io;return Io+=1,As===null&&(As=[]),Ly(As,a,i)}function Po(a,i){i=i.props.ref,a.ref=i!==void 0?i:null}function Ac(a,i){throw i.$$typeof===y?Error(r(525)):(a=Object.prototype.toString.call(i),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":a)))}function Dy(a){function i(te,J){if(a){var ae=te.deletions;ae===null?(te.deletions=[J],te.flags|=16):ae.push(J)}}function c(te,J){if(!a)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=vr(te,J),te.index=0,te.sibling=null,te}function x(te,J,ae){return te.index=ae,a?(ae=te.alternate,ae!==null?(ae=ae.index,ae<J?(te.flags|=67108866,J):ae):(te.flags|=67108866,J)):(te.flags|=1048576,J)}function N(te){return a&&te.alternate===null&&(te.flags|=67108866),te}function z(te,J,ae,fe){return J===null||J.tag!==6?(J=jp(ae,te.mode,fe),J.return=te,J):(J=v(J,ae),J.return=te,J)}function Y(te,J,ae,fe){var De=ae.type;return De===j?pe(te,J,ae.props.children,fe,ae.key):J!==null&&(J.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===H&&zi(De)===J.type)?(J=v(J,ae.props),Po(J,ae),J.return=te,J):(J=wc(ae.type,ae.key,ae.props,null,te.mode,fe),Po(J,ae),J.return=te,J)}function re(te,J,ae,fe){return J===null||J.tag!==4||J.stateNode.containerInfo!==ae.containerInfo||J.stateNode.implementation!==ae.implementation?(J=Cp(ae,te.mode,fe),J.return=te,J):(J=v(J,ae.children||[]),J.return=te,J)}function pe(te,J,ae,fe,De){return J===null||J.tag!==7?(J=Ri(ae,te.mode,fe,De),J.return=te,J):(J=v(J,ae),J.return=te,J)}function me(te,J,ae){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=jp(""+J,te.mode,ae),J.return=te,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return ae=wc(J.type,J.key,J.props,null,te.mode,ae),Po(ae,J),ae.return=te,ae;case k:return J=Cp(J,te.mode,ae),J.return=te,J;case H:return J=zi(J),me(te,J,ae)}if($(J)||F(J))return J=Ri(J,te.mode,ae,null),J.return=te,J;if(typeof J.then=="function")return me(te,Tc(J),ae);if(J.$$typeof===E)return me(te,jc(te,J),ae);Ac(te,J)}return null}function se(te,J,ae,fe){var De=J!==null?J.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return De!==null?null:z(te,J,""+ae,fe);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case b:return ae.key===De?Y(te,J,ae,fe):null;case k:return ae.key===De?re(te,J,ae,fe):null;case H:return ae=zi(ae),se(te,J,ae,fe)}if($(ae)||F(ae))return De!==null?null:pe(te,J,ae,fe,null);if(typeof ae.then=="function")return se(te,J,Tc(ae),fe);if(ae.$$typeof===E)return se(te,J,jc(te,ae),fe);Ac(te,ae)}return null}function oe(te,J,ae,fe,De){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return te=te.get(ae)||null,z(J,te,""+fe,De);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case b:return te=te.get(fe.key===null?ae:fe.key)||null,Y(J,te,fe,De);case k:return te=te.get(fe.key===null?ae:fe.key)||null,re(J,te,fe,De);case H:return fe=zi(fe),oe(te,J,ae,fe,De)}if($(fe)||F(fe))return te=te.get(ae)||null,pe(J,te,fe,De,null);if(typeof fe.then=="function")return oe(te,J,ae,Tc(fe),De);if(fe.$$typeof===E)return oe(te,J,ae,jc(J,fe),De);Ac(J,fe)}return null}function Ae(te,J,ae,fe){for(var De=null,ht=null,_e=J,Qe=J=0,ot=null;_e!==null&&Qe<ae.length;Qe++){_e.index>Qe?(ot=_e,_e=null):ot=_e.sibling;var mt=se(te,_e,ae[Qe],fe);if(mt===null){_e===null&&(_e=ot);break}a&&_e&&mt.alternate===null&&i(te,_e),J=x(mt,J,Qe),ht===null?De=mt:ht.sibling=mt,ht=mt,_e=ot}if(Qe===ae.length)return c(te,_e),ct&&yr(te,Qe),De;if(_e===null){for(;Qe<ae.length;Qe++)_e=me(te,ae[Qe],fe),_e!==null&&(J=x(_e,J,Qe),ht===null?De=_e:ht.sibling=_e,ht=_e);return ct&&yr(te,Qe),De}for(_e=p(_e);Qe<ae.length;Qe++)ot=oe(_e,te,Qe,ae[Qe],fe),ot!==null&&(a&&ot.alternate!==null&&_e.delete(ot.key===null?Qe:ot.key),J=x(ot,J,Qe),ht===null?De=ot:ht.sibling=ot,ht=ot);return a&&_e.forEach(function(hi){return i(te,hi)}),ct&&yr(te,Qe),De}function Be(te,J,ae,fe){if(ae==null)throw Error(r(151));for(var De=null,ht=null,_e=J,Qe=J=0,ot=null,mt=ae.next();_e!==null&&!mt.done;Qe++,mt=ae.next()){_e.index>Qe?(ot=_e,_e=null):ot=_e.sibling;var hi=se(te,_e,mt.value,fe);if(hi===null){_e===null&&(_e=ot);break}a&&_e&&hi.alternate===null&&i(te,_e),J=x(hi,J,Qe),ht===null?De=hi:ht.sibling=hi,ht=hi,_e=ot}if(mt.done)return c(te,_e),ct&&yr(te,Qe),De;if(_e===null){for(;!mt.done;Qe++,mt=ae.next())mt=me(te,mt.value,fe),mt!==null&&(J=x(mt,J,Qe),ht===null?De=mt:ht.sibling=mt,ht=mt);return ct&&yr(te,Qe),De}for(_e=p(_e);!mt.done;Qe++,mt=ae.next())mt=oe(_e,te,Qe,mt.value,fe),mt!==null&&(a&&mt.alternate!==null&&_e.delete(mt.key===null?Qe:mt.key),J=x(mt,J,Qe),ht===null?De=mt:ht.sibling=mt,ht=mt);return a&&_e.forEach(function(aA){return i(te,aA)}),ct&&yr(te,Qe),De}function jt(te,J,ae,fe){if(typeof ae=="object"&&ae!==null&&ae.type===j&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case b:e:{for(var De=ae.key;J!==null;){if(J.key===De){if(De=ae.type,De===j){if(J.tag===7){c(te,J.sibling),fe=v(J,ae.props.children),fe.return=te,te=fe;break e}}else if(J.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===H&&zi(De)===J.type){c(te,J.sibling),fe=v(J,ae.props),Po(fe,ae),fe.return=te,te=fe;break e}c(te,J);break}else i(te,J);J=J.sibling}ae.type===j?(fe=Ri(ae.props.children,te.mode,fe,ae.key),fe.return=te,te=fe):(fe=wc(ae.type,ae.key,ae.props,null,te.mode,fe),Po(fe,ae),fe.return=te,te=fe)}return N(te);case k:e:{for(De=ae.key;J!==null;){if(J.key===De)if(J.tag===4&&J.stateNode.containerInfo===ae.containerInfo&&J.stateNode.implementation===ae.implementation){c(te,J.sibling),fe=v(J,ae.children||[]),fe.return=te,te=fe;break e}else{c(te,J);break}else i(te,J);J=J.sibling}fe=Cp(ae,te.mode,fe),fe.return=te,te=fe}return N(te);case H:return ae=zi(ae),jt(te,J,ae,fe)}if($(ae))return Ae(te,J,ae,fe);if(F(ae)){if(De=F(ae),typeof De!="function")throw Error(r(150));return ae=De.call(ae),Be(te,J,ae,fe)}if(typeof ae.then=="function")return jt(te,J,Tc(ae),fe);if(ae.$$typeof===E)return jt(te,J,jc(te,ae),fe);Ac(te,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,J!==null&&J.tag===6?(c(te,J.sibling),fe=v(J,ae),fe.return=te,te=fe):(c(te,J),fe=jp(ae,te.mode,fe),fe.return=te,te=fe),N(te)):c(te,J)}return function(te,J,ae,fe){try{Io=0;var De=jt(te,J,ae,fe);return As=null,De}catch(_e){if(_e===Ts||_e===Nc)throw _e;var ht=Kn(29,_e,null,te.mode);return ht.lanes=fe,ht.return=te,ht}finally{}}}var $i=Dy(!0),$y=Dy(!1),Qr=!1;function $p(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ip(a,i){a=a.updateQueue,i.updateQueue===a&&(i.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function Xr(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function Jr(a,i,c){var p=a.updateQueue;if(p===null)return null;if(p=p.shared,(vt&2)!==0){var v=p.pending;return v===null?i.next=i:(i.next=v.next,v.next=i),p.pending=i,i=xc(a),xy(a,null,c),i}return bc(a,p,i,c),xc(a)}function Uo(a,i,c){if(i=i.updateQueue,i!==null&&(i=i.shared,(c&4194048)!==0)){var p=i.lanes;p&=a.pendingLanes,c|=p,i.lanes=c,je(a,c)}}function Pp(a,i){var c=a.updateQueue,p=a.alternate;if(p!==null&&(p=p.updateQueue,c===p)){var v=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var N={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?v=x=N:x=x.next=N,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},a.updateQueue=c;return}a=c.lastBaseUpdate,a===null?c.firstBaseUpdate=i:a.next=i,c.lastBaseUpdate=i}var Up=!1;function Bo(){if(Up){var a=Es;if(a!==null)throw a}}function Fo(a,i,c,p){Up=!1;var v=a.updateQueue;Qr=!1;var x=v.firstBaseUpdate,N=v.lastBaseUpdate,z=v.shared.pending;if(z!==null){v.shared.pending=null;var Y=z,re=Y.next;Y.next=null,N===null?x=re:N.next=re,N=Y;var pe=a.alternate;pe!==null&&(pe=pe.updateQueue,z=pe.lastBaseUpdate,z!==N&&(z===null?pe.firstBaseUpdate=re:z.next=re,pe.lastBaseUpdate=Y))}if(x!==null){var me=v.baseState;N=0,pe=re=Y=null,z=x;do{var se=z.lane&-536870913,oe=se!==z.lane;if(oe?(st&se)===se:(p&se)===se){se!==0&&se===Ns&&(Up=!0),pe!==null&&(pe=pe.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var Ae=a,Be=z;se=i;var jt=c;switch(Be.tag){case 1:if(Ae=Be.payload,typeof Ae=="function"){me=Ae.call(jt,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(jt,me,se):Ae,se==null)break e;me=m({},me,se);break e;case 2:Qr=!0}}se=z.callback,se!==null&&(a.flags|=64,oe&&(a.flags|=8192),oe=v.callbacks,oe===null?v.callbacks=[se]:oe.push(se))}else oe={lane:se,tag:z.tag,payload:z.payload,callback:z.callback,next:null},pe===null?(re=pe=oe,Y=me):pe=pe.next=oe,N|=se;if(z=z.next,z===null){if(z=v.shared.pending,z===null)break;oe=z,z=oe.next,oe.next=null,v.lastBaseUpdate=oe,v.shared.pending=null}}while(!0);pe===null&&(Y=me),v.baseState=Y,v.firstBaseUpdate=re,v.lastBaseUpdate=pe,x===null&&(v.shared.lanes=0),ri|=N,a.lanes=N,a.memoizedState=me}}function Iy(a,i){if(typeof a!="function")throw Error(r(191,a));a.call(i)}function Py(a,i){var c=a.callbacks;if(c!==null)for(a.callbacks=null,a=0;a<c.length;a++)Iy(c[a],i)}var Rs=U(null),Rc=U(0);function Uy(a,i){a=Ar,O(Rc,a),O(Rs,i),Ar=a|i.baseLanes}function Bp(){O(Rc,Ar),O(Rs,Rs.current)}function Fp(){Ar=Rc.current,G(Rs),G(Rc)}var Qn=U(null),Sa=null;function ei(a){var i=a.alternate;O(Kt,Kt.current&1),O(Qn,a),Sa===null&&(i===null||Rs.current!==null||i.memoizedState!==null)&&(Sa=a)}function Hp(a){O(Kt,Kt.current),O(Qn,a),Sa===null&&(Sa=a)}function By(a){a.tag===22?(O(Kt,Kt.current),O(Qn,a),Sa===null&&(Sa=a)):ti()}function ti(){O(Kt,Kt.current),O(Qn,Qn.current)}function Xn(a){G(Qn),Sa===a&&(Sa=null),G(Kt)}var Kt=U(0);function _c(a){for(var i=a;i!==null;){if(i.tag===13){var c=i.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Kf(c)||Qf(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===a)break;for(;i.sibling===null;){if(i.return===null||i.return===a)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var wr=0,Ke=null,kt=null,nn=null,Oc=!1,_s=!1,Ii=!1,Lc=0,Ho=0,Os=null,WE=0;function Wt(){throw Error(r(321))}function qp(a,i){if(i===null)return!1;for(var c=0;c<i.length&&c<a.length;c++)if(!Yn(a[c],i[c]))return!1;return!0}function Gp(a,i,c,p,v,x){return wr=x,Ke=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,q.H=a===null||a.memoizedState===null?jb:of,Ii=!1,x=c(p,v),Ii=!1,_s&&(x=Hy(i,c,p,v)),Fy(a),x}function Fy(a){q.H=Vo;var i=kt!==null&&kt.next!==null;if(wr=0,nn=kt=Ke=null,Oc=!1,Ho=0,Os=null,i)throw Error(r(300));a===null||an||(a=a.dependencies,a!==null&&Sc(a)&&(an=!0))}function Hy(a,i,c,p){Ke=a;var v=0;do{if(_s&&(Os=null),Ho=0,_s=!1,25<=v)throw Error(r(301));if(v+=1,nn=kt=null,a.updateQueue!=null){var x=a.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}q.H=Cb,x=i(c,p)}while(_s);return x}function ZE(){var a=q.H,i=a.useState()[0];return i=typeof i.then=="function"?qo(i):i,a=a.useState()[0],(kt!==null?kt.memoizedState:null)!==a&&(Ke.flags|=1024),i}function Vp(){var a=Lc!==0;return Lc=0,a}function Wp(a,i,c){i.updateQueue=a.updateQueue,i.flags&=-2053,a.lanes&=~c}function Zp(a){if(Oc){for(a=a.memoizedState;a!==null;){var i=a.queue;i!==null&&(i.pending=null),a=a.next}Oc=!1}wr=0,nn=kt=Ke=null,_s=!1,Ho=Lc=0,Os=null}function _n(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nn===null?Ke.memoizedState=nn=a:nn=nn.next=a,nn}function Qt(){if(kt===null){var a=Ke.alternate;a=a!==null?a.memoizedState:null}else a=kt.next;var i=nn===null?Ke.memoizedState:nn.next;if(i!==null)nn=i,kt=a;else{if(a===null)throw Ke.alternate===null?Error(r(467)):Error(r(310));kt=a,a={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},nn===null?Ke.memoizedState=nn=a:nn=nn.next=a}return nn}function Mc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function qo(a){var i=Ho;return Ho+=1,Os===null&&(Os=[]),a=Ly(Os,a,i),i=Ke,(nn===null?i.memoizedState:nn.next)===null&&(i=i.alternate,q.H=i===null||i.memoizedState===null?jb:of),a}function zc(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return qo(a);if(a.$$typeof===E)return xn(a)}throw Error(r(438,String(a)))}function Yp(a){var i=null,c=Ke.updateQueue;if(c!==null&&(i=c.memoCache),i==null){var p=Ke.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(),Ke.updateQueue=c),c.memoCache=i,c=i.data[i.index],c===void 0)for(c=i.data[i.index]=Array(a),p=0;p<a;p++)c[p]=_;return i.index++,c}function kr(a,i){return typeof i=="function"?i(a):i}function Dc(a){var i=Qt();return Kp(i,kt,a)}function Kp(a,i,c){var p=a.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=c;var v=a.baseQueue,x=p.pending;if(x!==null){if(v!==null){var N=v.next;v.next=x.next,x.next=N}i.baseQueue=v=x,p.pending=null}if(x=a.baseState,v===null)a.memoizedState=x;else{i=v.next;var z=N=null,Y=null,re=i,pe=!1;do{var me=re.lane&-536870913;if(me!==re.lane?(st&me)===me:(wr&me)===me){var se=re.revertLane;if(se===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),me===Ns&&(pe=!0);else if((wr&se)===se){re=re.next,se===Ns&&(pe=!0);continue}else me={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},Y===null?(z=Y=me,N=x):Y=Y.next=me,Ke.lanes|=se,ri|=se;me=re.action,Ii&&c(x,me),x=re.hasEagerState?re.eagerState:c(x,me)}else se={lane:me,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},Y===null?(z=Y=se,N=x):Y=Y.next=se,Ke.lanes|=me,ri|=me;re=re.next}while(re!==null&&re!==i);if(Y===null?N=x:Y.next=z,!Yn(x,a.memoizedState)&&(an=!0,pe&&(c=Es,c!==null)))throw c;a.memoizedState=x,a.baseState=N,a.baseQueue=Y,p.lastRenderedState=x}return v===null&&(p.lanes=0),[a.memoizedState,p.dispatch]}function Qp(a){var i=Qt(),c=i.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=a;var p=c.dispatch,v=c.pending,x=i.memoizedState;if(v!==null){c.pending=null;var N=v=v.next;do x=a(x,N.action),N=N.next;while(N!==v);Yn(x,i.memoizedState)||(an=!0),i.memoizedState=x,i.baseQueue===null&&(i.baseState=x),c.lastRenderedState=x}return[x,p]}function qy(a,i,c){var p=Ke,v=Qt(),x=ct;if(x){if(c===void 0)throw Error(r(407));c=c()}else c=i();var N=!Yn((kt||v).memoizedState,c);if(N&&(v.memoizedState=c,an=!0),v=v.queue,ef(Wy.bind(null,p,v,a),[a]),v.getSnapshot!==i||N||nn!==null&&nn.memoizedState.tag&1){if(p.flags|=2048,Ls(9,{destroy:void 0},Vy.bind(null,p,v,c,i),null),Nt===null)throw Error(r(349));x||(wr&127)!==0||Gy(p,i,c)}return c}function Gy(a,i,c){a.flags|=16384,a={getSnapshot:i,value:c},i=Ke.updateQueue,i===null?(i=Mc(),Ke.updateQueue=i,i.stores=[a]):(c=i.stores,c===null?i.stores=[a]:c.push(a))}function Vy(a,i,c,p){i.value=c,i.getSnapshot=p,Zy(i)&&Yy(a)}function Wy(a,i,c){return c(function(){Zy(i)&&Yy(a)})}function Zy(a){var i=a.getSnapshot;a=a.value;try{var c=i();return!Yn(a,c)}catch{return!0}}function Yy(a){var i=Ai(a,2);i!==null&&Fn(i,a,2)}function Xp(a){var i=_n();if(typeof a=="function"){var c=a;if(a=c(),Ii){et(!0);try{c()}finally{et(!1)}}}return i.memoizedState=i.baseState=a,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kr,lastRenderedState:a},i}function Ky(a,i,c,p){return a.baseState=c,Kp(a,kt,typeof p=="function"?p:kr)}function YE(a,i,c,p,v){if(Pc(a))throw Error(r(485));if(a=i.action,a!==null){var x={payload:v,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(N){x.listeners.push(N)}};q.T!==null?c(!0):x.isTransition=!1,p(x),c=i.pending,c===null?(x.next=i.pending=x,Qy(i,x)):(x.next=c.next,i.pending=c.next=x)}}function Qy(a,i){var c=i.action,p=i.payload,v=a.state;if(i.isTransition){var x=q.T,N={};q.T=N;try{var z=c(v,p),Y=q.S;Y!==null&&Y(N,z),Xy(a,i,z)}catch(re){Jp(a,i,re)}finally{x!==null&&N.types!==null&&(x.types=N.types),q.T=x}}else try{x=c(v,p),Xy(a,i,x)}catch(re){Jp(a,i,re)}}function Xy(a,i,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(p){Jy(a,i,p)},function(p){return Jp(a,i,p)}):Jy(a,i,c)}function Jy(a,i,c){i.status="fulfilled",i.value=c,eb(i),a.state=c,i=a.pending,i!==null&&(c=i.next,c===i?a.pending=null:(c=c.next,i.next=c,Qy(a,c)))}function Jp(a,i,c){var p=a.pending;if(a.pending=null,p!==null){p=p.next;do i.status="rejected",i.reason=c,eb(i),i=i.next;while(i!==p)}a.action=null}function eb(a){a=a.listeners;for(var i=0;i<a.length;i++)(0,a[i])()}function tb(a,i){return i}function nb(a,i){if(ct){var c=Nt.formState;if(c!==null){e:{var p=Ke;if(ct){if(Lt){t:{for(var v=Lt,x=ka;v.nodeType!==8;){if(!x){v=null;break t}if(v=ja(v.nextSibling),v===null){v=null;break t}}x=v.data,v=x==="F!"||x==="F"?v:null}if(v){Lt=ja(v.nextSibling),p=v.data==="F!";break e}}Yr(p)}p=!1}p&&(i=c[0])}}return c=_n(),c.memoizedState=c.baseState=i,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tb,lastRenderedState:i},c.queue=p,c=wb.bind(null,Ke,p),p.dispatch=c,p=Xp(!1),x=sf.bind(null,Ke,!1,p.queue),p=_n(),v={state:i,dispatch:null,action:a,pending:null},p.queue=v,c=YE.bind(null,Ke,v,x,c),v.dispatch=c,p.memoizedState=a,[i,c,!1]}function ab(a){var i=Qt();return rb(i,kt,a)}function rb(a,i,c){if(i=Kp(a,i,tb)[0],a=Dc(kr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var p=qo(i)}catch(N){throw N===Ts?Nc:N}else p=i;i=Qt();var v=i.queue,x=v.dispatch;return c!==i.memoizedState&&(Ke.flags|=2048,Ls(9,{destroy:void 0},KE.bind(null,v,c),null)),[p,x,a]}function KE(a,i){a.action=i}function ib(a){var i=Qt(),c=kt;if(c!==null)return rb(i,c,a);Qt(),i=i.memoizedState,c=Qt();var p=c.queue.dispatch;return c.memoizedState=a,[i,p,!1]}function Ls(a,i,c,p){return a={tag:a,create:c,deps:p,inst:i,next:null},i=Ke.updateQueue,i===null&&(i=Mc(),Ke.updateQueue=i),c=i.lastEffect,c===null?i.lastEffect=a.next=a:(p=c.next,c.next=a,a.next=p,i.lastEffect=a),a}function sb(){return Qt().memoizedState}function $c(a,i,c,p){var v=_n();Ke.flags|=a,v.memoizedState=Ls(1|i,{destroy:void 0},c,p===void 0?null:p)}function Ic(a,i,c,p){var v=Qt();p=p===void 0?null:p;var x=v.memoizedState.inst;kt!==null&&p!==null&&qp(p,kt.memoizedState.deps)?v.memoizedState=Ls(i,x,c,p):(Ke.flags|=a,v.memoizedState=Ls(1|i,x,c,p))}function ob(a,i){$c(8390656,8,a,i)}function ef(a,i){Ic(2048,8,a,i)}function QE(a){Ke.flags|=4;var i=Ke.updateQueue;if(i===null)i=Mc(),Ke.updateQueue=i,i.events=[a];else{var c=i.events;c===null?i.events=[a]:c.push(a)}}function lb(a){var i=Qt().memoizedState;return QE({ref:i,nextImpl:a}),function(){if((vt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function cb(a,i){return Ic(4,2,a,i)}function ub(a,i){return Ic(4,4,a,i)}function db(a,i){if(typeof i=="function"){a=a();var c=i(a);return function(){typeof c=="function"?c():i(null)}}if(i!=null)return a=a(),i.current=a,function(){i.current=null}}function pb(a,i,c){c=c!=null?c.concat([a]):null,Ic(4,4,db.bind(null,i,a),c)}function tf(){}function fb(a,i){var c=Qt();i=i===void 0?null:i;var p=c.memoizedState;return i!==null&&qp(i,p[1])?p[0]:(c.memoizedState=[a,i],a)}function hb(a,i){var c=Qt();i=i===void 0?null:i;var p=c.memoizedState;if(i!==null&&qp(i,p[1]))return p[0];if(p=a(),Ii){et(!0);try{a()}finally{et(!1)}}return c.memoizedState=[p,i],p}function nf(a,i,c){return c===void 0||(wr&1073741824)!==0&&(st&261930)===0?a.memoizedState=i:(a.memoizedState=c,a=m0(),Ke.lanes|=a,ri|=a,c)}function mb(a,i,c,p){return Yn(c,i)?c:Rs.current!==null?(a=nf(a,c,p),Yn(a,i)||(an=!0),a):(wr&42)===0||(wr&1073741824)!==0&&(st&261930)===0?(an=!0,a.memoizedState=c):(a=m0(),Ke.lanes|=a,ri|=a,i)}function gb(a,i,c,p,v){var x=V.p;V.p=x!==0&&8>x?x:8;var N=q.T,z={};q.T=z,sf(a,!1,i,c);try{var Y=v(),re=q.S;if(re!==null&&re(z,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var pe=VE(Y,p);Go(a,i,pe,ta(a))}else Go(a,i,p,ta(a))}catch(me){Go(a,i,{then:function(){},status:"rejected",reason:me},ta())}finally{V.p=x,N!==null&&z.types!==null&&(N.types=z.types),q.T=N}}function XE(){}function af(a,i,c,p){if(a.tag!==5)throw Error(r(476));var v=vb(a).queue;gb(a,v,i,X,c===null?XE:function(){return yb(a),c(p)})}function vb(a){var i=a.memoizedState;if(i!==null)return i;i={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kr,lastRenderedState:X},next:null};var c={};return i.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kr,lastRenderedState:c},next:null},a.memoizedState=i,a=a.alternate,a!==null&&(a.memoizedState=i),i}function yb(a){var i=vb(a);i.next===null&&(i=a.alternate.memoizedState),Go(a,i.next.queue,{},ta())}function rf(){return xn(ll)}function bb(){return Qt().memoizedState}function xb(){return Qt().memoizedState}function JE(a){for(var i=a.return;i!==null;){switch(i.tag){case 24:case 3:var c=ta();a=Xr(c);var p=Jr(i,a,c);p!==null&&(Fn(p,i,c),Uo(p,i,c)),i={cache:Lp()},a.payload=i;return}i=i.return}}function eT(a,i,c){var p=ta();c={lane:p,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Pc(a)?kb(i,c):(c=kp(a,i,c,p),c!==null&&(Fn(c,a,p),Sb(c,i,p)))}function wb(a,i,c){var p=ta();Go(a,i,c,p)}function Go(a,i,c,p){var v={lane:p,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Pc(a))kb(i,v);else{var x=a.alternate;if(a.lanes===0&&(x===null||x.lanes===0)&&(x=i.lastRenderedReducer,x!==null))try{var N=i.lastRenderedState,z=x(N,c);if(v.hasEagerState=!0,v.eagerState=z,Yn(z,N))return bc(a,i,v,0),Nt===null&&yc(),!1}catch{}finally{}if(c=kp(a,i,v,p),c!==null)return Fn(c,a,p),Sb(c,i,p),!0}return!1}function sf(a,i,c,p){if(p={lane:2,revertLane:If(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Pc(a)){if(i)throw Error(r(479))}else i=kp(a,c,p,2),i!==null&&Fn(i,a,2)}function Pc(a){var i=a.alternate;return a===Ke||i!==null&&i===Ke}function kb(a,i){_s=Oc=!0;var c=a.pending;c===null?i.next=i:(i.next=c.next,c.next=i),a.pending=i}function Sb(a,i,c){if((c&4194048)!==0){var p=i.lanes;p&=a.pendingLanes,c|=p,i.lanes=c,je(a,c)}}var Vo={readContext:xn,use:zc,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt};Vo.useEffectEvent=Wt;var jb={readContext:xn,use:zc,useCallback:function(a,i){return _n().memoizedState=[a,i===void 0?null:i],a},useContext:xn,useEffect:ob,useImperativeHandle:function(a,i,c){c=c!=null?c.concat([a]):null,$c(4194308,4,db.bind(null,i,a),c)},useLayoutEffect:function(a,i){return $c(4194308,4,a,i)},useInsertionEffect:function(a,i){$c(4,2,a,i)},useMemo:function(a,i){var c=_n();i=i===void 0?null:i;var p=a();if(Ii){et(!0);try{a()}finally{et(!1)}}return c.memoizedState=[p,i],p},useReducer:function(a,i,c){var p=_n();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,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:v},p.queue=a,a=a.dispatch=eT.bind(null,Ke,a),[p.memoizedState,a]},useRef:function(a){var i=_n();return a={current:a},i.memoizedState=a},useState:function(a){a=Xp(a);var i=a.queue,c=wb.bind(null,Ke,i);return i.dispatch=c,[a.memoizedState,c]},useDebugValue:tf,useDeferredValue:function(a,i){var c=_n();return nf(c,a,i)},useTransition:function(){var a=Xp(!1);return a=gb.bind(null,Ke,a.queue,!0,!1),_n().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,i,c){var p=Ke,v=_n();if(ct){if(c===void 0)throw Error(r(407));c=c()}else{if(c=i(),Nt===null)throw Error(r(349));(st&127)!==0||Gy(p,i,c)}v.memoizedState=c;var x={value:c,getSnapshot:i};return v.queue=x,ob(Wy.bind(null,p,x,a),[a]),p.flags|=2048,Ls(9,{destroy:void 0},Vy.bind(null,p,x,c,i),null),c},useId:function(){var a=_n(),i=Nt.identifierPrefix;if(ct){var c=Wa,p=Va;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=WE++,i="_"+i+"r_"+c.toString(32)+"_";return a.memoizedState=i},useHostTransitionStatus:rf,useFormState:nb,useActionState:nb,useOptimistic:function(a){var i=_n();i.memoizedState=i.baseState=a;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=c,i=sf.bind(null,Ke,!0,c),c.dispatch=i,[a,i]},useMemoCache:Yp,useCacheRefresh:function(){return _n().memoizedState=JE.bind(null,Ke)},useEffectEvent:function(a){var i=_n(),c={impl:a};return i.memoizedState=c,function(){if((vt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},of={readContext:xn,use:zc,useCallback:fb,useContext:xn,useEffect:ef,useImperativeHandle:pb,useInsertionEffect:cb,useLayoutEffect:ub,useMemo:hb,useReducer:Dc,useRef:sb,useState:function(){return Dc(kr)},useDebugValue:tf,useDeferredValue:function(a,i){var c=Qt();return mb(c,kt.memoizedState,a,i)},useTransition:function(){var a=Dc(kr)[0],i=Qt().memoizedState;return[typeof a=="boolean"?a:qo(a),i]},useSyncExternalStore:qy,useId:bb,useHostTransitionStatus:rf,useFormState:ab,useActionState:ab,useOptimistic:function(a,i){var c=Qt();return Ky(c,kt,a,i)},useMemoCache:Yp,useCacheRefresh:xb};of.useEffectEvent=lb;var Cb={readContext:xn,use:zc,useCallback:fb,useContext:xn,useEffect:ef,useImperativeHandle:pb,useInsertionEffect:cb,useLayoutEffect:ub,useMemo:hb,useReducer:Qp,useRef:sb,useState:function(){return Qp(kr)},useDebugValue:tf,useDeferredValue:function(a,i){var c=Qt();return kt===null?nf(c,a,i):mb(c,kt.memoizedState,a,i)},useTransition:function(){var a=Qp(kr)[0],i=Qt().memoizedState;return[typeof a=="boolean"?a:qo(a),i]},useSyncExternalStore:qy,useId:bb,useHostTransitionStatus:rf,useFormState:ib,useActionState:ib,useOptimistic:function(a,i){var c=Qt();return kt!==null?Ky(c,kt,a,i):(c.baseState=a,[a,c.queue.dispatch])},useMemoCache:Yp,useCacheRefresh:xb};Cb.useEffectEvent=lb;function lf(a,i,c,p){i=a.memoizedState,c=c(p,i),c=c==null?i:m({},i,c),a.memoizedState=c,a.lanes===0&&(a.updateQueue.baseState=c)}var cf={enqueueSetState:function(a,i,c){a=a._reactInternals;var p=ta(),v=Xr(p);v.payload=i,c!=null&&(v.callback=c),i=Jr(a,v,p),i!==null&&(Fn(i,a,p),Uo(i,a,p))},enqueueReplaceState:function(a,i,c){a=a._reactInternals;var p=ta(),v=Xr(p);v.tag=1,v.payload=i,c!=null&&(v.callback=c),i=Jr(a,v,p),i!==null&&(Fn(i,a,p),Uo(i,a,p))},enqueueForceUpdate:function(a,i){a=a._reactInternals;var c=ta(),p=Xr(c);p.tag=2,i!=null&&(p.callback=i),i=Jr(a,p,c),i!==null&&(Fn(i,a,c),Uo(i,a,c))}};function Nb(a,i,c,p,v,x,N){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(p,x,N):i.prototype&&i.prototype.isPureReactComponent?!Oo(c,p)||!Oo(v,x):!0}function Eb(a,i,c,p){a=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(c,p),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(c,p),i.state!==a&&cf.enqueueReplaceState(i,i.state,null)}function Pi(a,i){var c=i;if("ref"in i){c={};for(var p in i)p!=="ref"&&(c[p]=i[p])}if(a=a.defaultProps){c===i&&(c=m({},c));for(var v in a)c[v]===void 0&&(c[v]=a[v])}return c}function Tb(a){vc(a)}function Ab(a){console.error(a)}function Rb(a){vc(a)}function Uc(a,i){try{var c=a.onUncaughtError;c(i.value,{componentStack:i.stack})}catch(p){setTimeout(function(){throw p})}}function _b(a,i,c){try{var p=a.onCaughtError;p(c.value,{componentStack:c.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function uf(a,i,c){return c=Xr(c),c.tag=3,c.payload={element:null},c.callback=function(){Uc(a,i)},c}function Ob(a){return a=Xr(a),a.tag=3,a}function Lb(a,i,c,p){var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var x=p.value;a.payload=function(){return v(x)},a.callback=function(){_b(i,c,p)}}var N=c.stateNode;N!==null&&typeof N.componentDidCatch=="function"&&(a.callback=function(){_b(i,c,p),typeof v!="function"&&(ii===null?ii=new Set([this]):ii.add(this));var z=p.stack;this.componentDidCatch(p.value,{componentStack:z!==null?z:""})})}function tT(a,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=Qn.current,c!==null){switch(c.tag){case 31:case 13:return Sa===null?Xc():c.alternate===null&&Zt===0&&(Zt=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),zf(a,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)),zf(a,p,v)),!1}throw Error(r(435,c.tag))}return zf(a,p,v),Xc(),!1}if(ct)return i=Qn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=v,p!==Tp&&(a=Error(r(422),{cause:p}),zo(ba(a,c)))):(p!==Tp&&(i=Error(r(423),{cause:p}),zo(ba(i,c))),a=a.current.alternate,a.flags|=65536,v&=-v,a.lanes|=v,p=ba(p,c),v=uf(a.stateNode,p,v),Pp(a,v),Zt!==4&&(Zt=2)),!1;var x=Error(r(520),{cause:p});if(x=ba(x,c),el===null?el=[x]:el.push(x),Zt!==4&&(Zt=2),i===null)return!0;p=ba(p,c),c=i;do{switch(c.tag){case 3:return c.flags|=65536,a=v&-v,c.lanes|=a,a=uf(c.stateNode,p,a),Pp(c,a),!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=Ob(v),Lb(v,a,c,p),Pp(c,v),!1}c=c.return}while(c!==null);return!1}var df=Error(r(461)),an=!1;function wn(a,i,c,p){i.child=a===null?$y(i,null,c,p):$i(i,a.child,c,p)}function Mb(a,i,c,p,v){c=c.render;var x=i.ref;if("ref"in p){var N={};for(var z in p)z!=="ref"&&(N[z]=p[z])}else N=p;return Li(i),p=Gp(a,i,c,N,x,v),z=Vp(),a!==null&&!an?(Wp(a,i,v),Sr(a,i,v)):(ct&&z&&Np(i),i.flags|=1,wn(a,i,p,v),i.child)}function zb(a,i,c,p,v){if(a===null){var x=c.type;return typeof x=="function"&&!Sp(x)&&x.defaultProps===void 0&&c.compare===null?(i.tag=15,i.type=x,Db(a,i,x,p,v)):(a=wc(c.type,null,p,i,i.mode,v),a.ref=i.ref,a.return=i,i.child=a)}if(x=a.child,!bf(a,v)){var N=x.memoizedProps;if(c=c.compare,c=c!==null?c:Oo,c(N,p)&&a.ref===i.ref)return Sr(a,i,v)}return i.flags|=1,a=vr(x,p),a.ref=i.ref,a.return=i,i.child=a}function Db(a,i,c,p,v){if(a!==null){var x=a.memoizedProps;if(Oo(x,p)&&a.ref===i.ref)if(an=!1,i.pendingProps=p=x,bf(a,v))(a.flags&131072)!==0&&(an=!0);else return i.lanes=a.lanes,Sr(a,i,v)}return pf(a,i,c,p,v)}function $b(a,i,c,p){var v=p.children,x=a!==null?a.memoizedState:null;if(a===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,a!==null){for(p=i.child=a.child,v=0;p!==null;)v=v|p.lanes|p.childLanes,p=p.sibling;p=v&~x}else p=0,i.child=null;return Ib(a,i,x,c,p)}if((c&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},a!==null&&Cc(i,x!==null?x.cachePool:null),x!==null?Uy(i,x):Bp(),By(i);else return p=i.lanes=536870912,Ib(a,i,x!==null?x.baseLanes|c:c,c,p)}else x!==null?(Cc(i,x.cachePool),Uy(i,x),ti(),i.memoizedState=null):(a!==null&&Cc(i,null),Bp(),ti());return wn(a,i,v,c),i.child}function Wo(a,i){return a!==null&&a.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function Ib(a,i,c,p,v){var x=zp();return x=x===null?null:{parent:tn._currentValue,pool:x},i.memoizedState={baseLanes:c,cachePool:x},a!==null&&Cc(i,null),Bp(),By(i),a!==null&&Cs(a,i,p,!0),i.childLanes=v,null}function Bc(a,i){return i=Hc({mode:i.mode,children:i.children},a.mode),i.ref=a.ref,a.child=i,i.return=a,i}function Pb(a,i,c){return $i(i,a.child,null,c),a=Bc(i,i.pendingProps),a.flags|=2,Xn(i),i.memoizedState=null,a}function nT(a,i,c){var p=i.pendingProps,v=(i.flags&128)!==0;if(i.flags&=-129,a===null){if(ct){if(p.mode==="hidden")return a=Bc(i,p),i.lanes=536870912,Wo(null,a);if(Hp(i),(a=Lt)?(a=Q0(a,ka),a=a!==null&&a.data==="&"?a:null,a!==null&&(i.memoizedState={dehydrated:a,treeContext:Wr!==null?{id:Va,overflow:Wa}:null,retryLane:536870912,hydrationErrors:null},c=ky(a),c.return=i,i.child=c,bn=i,Lt=null)):a=null,a===null)throw Yr(i);return i.lanes=536870912,null}return Bc(i,p)}var x=a.memoizedState;if(x!==null){var N=x.dehydrated;if(Hp(i),v)if(i.flags&256)i.flags&=-257,i=Pb(a,i,c);else if(i.memoizedState!==null)i.child=a.child,i.flags|=128,i=null;else throw Error(r(558));else if(an||Cs(a,i,c,!1),v=(c&a.childLanes)!==0,an||v){if(p=Nt,p!==null&&(N=Te(p,c),N!==0&&N!==x.retryLane))throw x.retryLane=N,Ai(a,N),Fn(p,a,N),df;Xc(),i=Pb(a,i,c)}else a=x.treeContext,Lt=ja(N.nextSibling),bn=i,ct=!0,Zr=null,ka=!1,a!==null&&Cy(i,a),i=Bc(i,p),i.flags|=4096;return i}return a=vr(a.child,{mode:p.mode,children:p.children}),a.ref=i.ref,i.child=a,a.return=i,a}function Fc(a,i){var c=i.ref;if(c===null)a!==null&&a.ref!==null&&(i.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(a===null||a.ref!==c)&&(i.flags|=4194816)}}function pf(a,i,c,p,v){return Li(i),c=Gp(a,i,c,p,void 0,v),p=Vp(),a!==null&&!an?(Wp(a,i,v),Sr(a,i,v)):(ct&&p&&Np(i),i.flags|=1,wn(a,i,c,v),i.child)}function Ub(a,i,c,p,v,x){return Li(i),i.updateQueue=null,c=Hy(i,p,c,v),Fy(a),p=Vp(),a!==null&&!an?(Wp(a,i,x),Sr(a,i,x)):(ct&&p&&Np(i),i.flags|=1,wn(a,i,c,x),i.child)}function Bb(a,i,c,p,v){if(Li(i),i.stateNode===null){var x=ws,N=c.contextType;typeof N=="object"&&N!==null&&(x=xn(N)),x=new c(p,x),i.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=cf,i.stateNode=x,x._reactInternals=i,x=i.stateNode,x.props=p,x.state=i.memoizedState,x.refs={},$p(i),N=c.contextType,x.context=typeof N=="object"&&N!==null?xn(N):ws,x.state=i.memoizedState,N=c.getDerivedStateFromProps,typeof N=="function"&&(lf(i,c,N,p),x.state=i.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(N=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),N!==x.state&&cf.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(a===null){x=i.stateNode;var z=i.memoizedProps,Y=Pi(c,z);x.props=Y;var re=x.context,pe=c.contextType;N=ws,typeof pe=="object"&&pe!==null&&(N=xn(pe));var me=c.getDerivedStateFromProps;pe=typeof me=="function"||typeof x.getSnapshotBeforeUpdate=="function",z=i.pendingProps!==z,pe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(z||re!==N)&&Eb(i,x,p,N),Qr=!1;var se=i.memoizedState;x.state=se,Fo(i,p,x,v),Bo(),re=i.memoizedState,z||se!==re||Qr?(typeof me=="function"&&(lf(i,c,me,p),re=i.memoizedState),(Y=Qr||Nb(i,c,Y,p,se,re,N))?(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=re),x.props=p,x.state=re,x.context=N,p=Y):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),p=!1)}else{x=i.stateNode,Ip(a,i),N=i.memoizedProps,pe=Pi(c,N),x.props=pe,me=i.pendingProps,se=x.context,re=c.contextType,Y=ws,typeof re=="object"&&re!==null&&(Y=xn(re)),z=c.getDerivedStateFromProps,(re=typeof z=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N!==me||se!==Y)&&Eb(i,x,p,Y),Qr=!1,se=i.memoizedState,x.state=se,Fo(i,p,x,v),Bo();var oe=i.memoizedState;N!==me||se!==oe||Qr||a!==null&&a.dependencies!==null&&Sc(a.dependencies)?(typeof z=="function"&&(lf(i,c,z,p),oe=i.memoizedState),(pe=Qr||Nb(i,c,pe,p,se,oe,Y)||a!==null&&a.dependencies!==null&&Sc(a.dependencies))?(re||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(p,oe,Y),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(p,oe,Y)),typeof x.componentDidUpdate=="function"&&(i.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof x.componentDidUpdate!="function"||N===a.memoizedProps&&se===a.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||N===a.memoizedProps&&se===a.memoizedState||(i.flags|=1024),i.memoizedProps=p,i.memoizedState=oe),x.props=p,x.state=oe,x.context=Y,p=pe):(typeof x.componentDidUpdate!="function"||N===a.memoizedProps&&se===a.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||N===a.memoizedProps&&se===a.memoizedState||(i.flags|=1024),p=!1)}return x=p,Fc(a,i),p=(i.flags&128)!==0,x||p?(x=i.stateNode,c=p&&typeof c.getDerivedStateFromError!="function"?null:x.render(),i.flags|=1,a!==null&&p?(i.child=$i(i,a.child,null,v),i.child=$i(i,null,c,v)):wn(a,i,c,v),i.memoizedState=x.state,a=i.child):a=Sr(a,i,v),a}function Fb(a,i,c,p){return _i(),i.flags|=256,wn(a,i,c,p),i.child}var ff={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hf(a){return{baseLanes:a,cachePool:_y()}}function mf(a,i,c){return a=a!==null?a.childLanes&~c:0,i&&(a|=ea),a}function Hb(a,i,c){var p=i.pendingProps,v=!1,x=(i.flags&128)!==0,N;if((N=x)||(N=a!==null&&a.memoizedState===null?!1:(Kt.current&2)!==0),N&&(v=!0,i.flags&=-129),N=(i.flags&32)!==0,i.flags&=-33,a===null){if(ct){if(v?ei(i):ti(),(a=Lt)?(a=Q0(a,ka),a=a!==null&&a.data!=="&"?a:null,a!==null&&(i.memoizedState={dehydrated:a,treeContext:Wr!==null?{id:Va,overflow:Wa}:null,retryLane:536870912,hydrationErrors:null},c=ky(a),c.return=i,i.child=c,bn=i,Lt=null)):a=null,a===null)throw Yr(i);return Qf(a)?i.lanes=32:i.lanes=536870912,null}var z=p.children;return p=p.fallback,v?(ti(),v=i.mode,z=Hc({mode:"hidden",children:z},v),p=Ri(p,v,c,null),z.return=i,p.return=i,z.sibling=p,i.child=z,p=i.child,p.memoizedState=hf(c),p.childLanes=mf(a,N,c),i.memoizedState=ff,Wo(null,p)):(ei(i),gf(i,z))}var Y=a.memoizedState;if(Y!==null&&(z=Y.dehydrated,z!==null)){if(x)i.flags&256?(ei(i),i.flags&=-257,i=vf(a,i,c)):i.memoizedState!==null?(ti(),i.child=a.child,i.flags|=128,i=null):(ti(),z=p.fallback,v=i.mode,p=Hc({mode:"visible",children:p.children},v),z=Ri(z,v,c,null),z.flags|=2,p.return=i,z.return=i,p.sibling=z,i.child=p,$i(i,a.child,null,c),p=i.child,p.memoizedState=hf(c),p.childLanes=mf(a,N,c),i.memoizedState=ff,i=Wo(null,p));else if(ei(i),Qf(z)){if(N=z.nextSibling&&z.nextSibling.dataset,N)var re=N.dgst;N=re,p=Error(r(419)),p.stack="",p.digest=N,zo({value:p,source:null,stack:null}),i=vf(a,i,c)}else if(an||Cs(a,i,c,!1),N=(c&a.childLanes)!==0,an||N){if(N=Nt,N!==null&&(p=Te(N,c),p!==0&&p!==Y.retryLane))throw Y.retryLane=p,Ai(a,p),Fn(N,a,p),df;Kf(z)||Xc(),i=vf(a,i,c)}else Kf(z)?(i.flags|=192,i.child=a.child,i=null):(a=Y.treeContext,Lt=ja(z.nextSibling),bn=i,ct=!0,Zr=null,ka=!1,a!==null&&Cy(i,a),i=gf(i,p.children),i.flags|=4096);return i}return v?(ti(),z=p.fallback,v=i.mode,Y=a.child,re=Y.sibling,p=vr(Y,{mode:"hidden",children:p.children}),p.subtreeFlags=Y.subtreeFlags&65011712,re!==null?z=vr(re,z):(z=Ri(z,v,c,null),z.flags|=2),z.return=i,p.return=i,p.sibling=z,i.child=p,Wo(null,p),p=i.child,z=a.child.memoizedState,z===null?z=hf(c):(v=z.cachePool,v!==null?(Y=tn._currentValue,v=v.parent!==Y?{parent:Y,pool:Y}:v):v=_y(),z={baseLanes:z.baseLanes|c,cachePool:v}),p.memoizedState=z,p.childLanes=mf(a,N,c),i.memoizedState=ff,Wo(a.child,p)):(ei(i),c=a.child,a=c.sibling,c=vr(c,{mode:"visible",children:p.children}),c.return=i,c.sibling=null,a!==null&&(N=i.deletions,N===null?(i.deletions=[a],i.flags|=16):N.push(a)),i.child=c,i.memoizedState=null,c)}function gf(a,i){return i=Hc({mode:"visible",children:i},a.mode),i.return=a,a.child=i}function Hc(a,i){return a=Kn(22,a,null,i),a.lanes=0,a}function vf(a,i,c){return $i(i,a.child,null,c),a=gf(i,i.pendingProps.children),a.flags|=2,i.memoizedState=null,a}function qb(a,i,c){a.lanes|=i;var p=a.alternate;p!==null&&(p.lanes|=i),_p(a.return,i,c)}function yf(a,i,c,p,v,x){var N=a.memoizedState;N===null?a.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:p,tail:c,tailMode:v,treeForkCount:x}:(N.isBackwards=i,N.rendering=null,N.renderingStartTime=0,N.last=p,N.tail=c,N.tailMode=v,N.treeForkCount=x)}function Gb(a,i,c){var p=i.pendingProps,v=p.revealOrder,x=p.tail;p=p.children;var N=Kt.current,z=(N&2)!==0;if(z?(N=N&1|2,i.flags|=128):N&=1,O(Kt,N),wn(a,i,p,c),p=ct?Mo:0,!z&&a!==null&&(a.flags&128)!==0)e:for(a=i.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&qb(a,c,i);else if(a.tag===19)qb(a,c,i);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(v){case"forwards":for(c=i.child,v=null;c!==null;)a=c.alternate,a!==null&&_c(a)===null&&(v=c),c=c.sibling;c=v,c===null?(v=i.child,i.child=null):(v=c.sibling,c.sibling=null),yf(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(a=v.alternate,a!==null&&_c(a)===null){i.child=v;break}a=v.sibling,v.sibling=c,c=v,v=a}yf(i,!0,c,null,x,p);break;case"together":yf(i,!1,null,null,void 0,p);break;default:i.memoizedState=null}return i.child}function Sr(a,i,c){if(a!==null&&(i.dependencies=a.dependencies),ri|=i.lanes,(c&i.childLanes)===0)if(a!==null){if(Cs(a,i,c,!1),(c&i.childLanes)===0)return null}else return null;if(a!==null&&i.child!==a.child)throw Error(r(153));if(i.child!==null){for(a=i.child,c=vr(a,a.pendingProps),i.child=c,c.return=i;a.sibling!==null;)a=a.sibling,c=c.sibling=vr(a,a.pendingProps),c.return=i;c.sibling=null}return i.child}function bf(a,i){return(a.lanes&i)!==0?!0:(a=a.dependencies,!!(a!==null&&Sc(a)))}function aT(a,i,c){switch(i.tag){case 3:Re(i,i.stateNode.containerInfo),Kr(i,tn,a.memoizedState.cache),_i();break;case 27:case 5:Ie(i);break;case 4:Re(i,i.stateNode.containerInfo);break;case 10:Kr(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Hp(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?Hb(a,i,c):(ei(i),a=Sr(a,i,c),a!==null?a.sibling:null);ei(i);break;case 19:var v=(a.flags&128)!==0;if(p=(c&i.childLanes)!==0,p||(Cs(a,i,c,!1),p=(c&i.childLanes)!==0),v){if(p)return Gb(a,i,c);i.flags|=128}if(v=i.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),O(Kt,Kt.current),p)break;return null;case 22:return i.lanes=0,$b(a,i,c,i.pendingProps);case 24:Kr(i,tn,a.memoizedState.cache)}return Sr(a,i,c)}function Vb(a,i,c){if(a!==null)if(a.memoizedProps!==i.pendingProps)an=!0;else{if(!bf(a,c)&&(i.flags&128)===0)return an=!1,aT(a,i,c);an=(a.flags&131072)!==0}else an=!1,ct&&(i.flags&1048576)!==0&&jy(i,Mo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var p=i.pendingProps;if(a=zi(i.elementType),i.type=a,typeof a=="function")Sp(a)?(p=Pi(a,p),i.tag=1,i=Bb(null,i,a,p,c)):(i.tag=0,i=pf(null,i,a,p,c));else{if(a!=null){var v=a.$$typeof;if(v===A){i.tag=11,i=Mb(null,i,a,p,c);break e}else if(v===D){i.tag=14,i=zb(null,i,a,p,c);break e}}throw i=I(a)||a,Error(r(306,i,""))}}return i;case 0:return pf(a,i,i.type,i.pendingProps,c);case 1:return p=i.type,v=Pi(p,i.pendingProps),Bb(a,i,p,v,c);case 3:e:{if(Re(i,i.stateNode.containerInfo),a===null)throw Error(r(387));p=i.pendingProps;var x=i.memoizedState;v=x.element,Ip(a,i),Fo(i,p,null,c);var N=i.memoizedState;if(p=N.cache,Kr(i,tn,p),p!==x.cache&&Op(i,[tn],c,!0),Bo(),p=N.element,x.isDehydrated)if(x={element:p,isDehydrated:!1,cache:N.cache},i.updateQueue.baseState=x,i.memoizedState=x,i.flags&256){i=Fb(a,i,p,c);break e}else if(p!==v){v=ba(Error(r(424)),i),zo(v),i=Fb(a,i,p,c);break e}else{switch(a=i.stateNode.containerInfo,a.nodeType){case 9:a=a.body;break;default:a=a.nodeName==="HTML"?a.ownerDocument.body:a}for(Lt=ja(a.firstChild),bn=i,ct=!0,Zr=null,ka=!0,c=$y(i,null,p,c),i.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(_i(),p===v){i=Sr(a,i,c);break e}wn(a,i,p,c)}i=i.child}return i;case 26:return Fc(a,i),a===null?(c=ax(i.type,null,i.pendingProps,null))?i.memoizedState=c:ct||(c=i.type,a=i.pendingProps,p=iu(le.current).createElement(c),p[qt]=i,p[cn]=a,kn(p,c,a),Ot(p),i.stateNode=p):i.memoizedState=ax(i.type,a.memoizedProps,i.pendingProps,a.memoizedState),null;case 27:return Ie(i),a===null&&ct&&(p=i.stateNode=ex(i.type,i.pendingProps,le.current),bn=i,ka=!0,v=Lt,ci(i.type)?(Xf=v,Lt=ja(p.firstChild)):Lt=v),wn(a,i,i.pendingProps.children,c),Fc(a,i),a===null&&(i.flags|=4194304),i.child;case 5:return a===null&&ct&&((v=p=Lt)&&(p=LT(p,i.type,i.pendingProps,ka),p!==null?(i.stateNode=p,bn=i,Lt=ja(p.firstChild),ka=!1,v=!0):v=!1),v||Yr(i)),Ie(i),v=i.type,x=i.pendingProps,N=a!==null?a.memoizedProps:null,p=x.children,Wf(v,x)?p=null:N!==null&&Wf(v,N)&&(i.flags|=32),i.memoizedState!==null&&(v=Gp(a,i,ZE,null,null,c),ll._currentValue=v),Fc(a,i),wn(a,i,p,c),i.child;case 6:return a===null&&ct&&((a=c=Lt)&&(c=MT(c,i.pendingProps,ka),c!==null?(i.stateNode=c,bn=i,Lt=null,a=!0):a=!1),a||Yr(i)),null;case 13:return Hb(a,i,c);case 4:return Re(i,i.stateNode.containerInfo),p=i.pendingProps,a===null?i.child=$i(i,null,p,c):wn(a,i,p,c),i.child;case 11:return Mb(a,i,i.type,i.pendingProps,c);case 7:return wn(a,i,i.pendingProps,c),i.child;case 8:return wn(a,i,i.pendingProps.children,c),i.child;case 12:return wn(a,i,i.pendingProps.children,c),i.child;case 10:return p=i.pendingProps,Kr(i,i.type,p.value),wn(a,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(a,i,p,c),i.child;case 14:return zb(a,i,i.type,i.pendingProps,c);case 15:return Db(a,i,i.type,i.pendingProps,c);case 19:return Gb(a,i,c);case 31:return nT(a,i,c);case 22:return $b(a,i,c,i.pendingProps);case 24:return Li(i),p=xn(tn),a===null?(v=zp(),v===null&&(v=Nt,x=Lp(),v.pooledCache=x,x.refCount++,x!==null&&(v.pooledCacheLanes|=c),v=x),i.memoizedState={parent:p,cache:v},$p(i),Kr(i,tn,v)):((a.lanes&c)!==0&&(Ip(a,i),Fo(i,null,null,c),Bo()),v=a.memoizedState,x=i.memoizedState,v.parent!==p?(v={parent:p,cache:p},i.memoizedState=v,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=v),Kr(i,tn,p)):(p=x.cache,Kr(i,tn,p),p!==v.cache&&Op(i,[tn],c,!0))),wn(a,i,i.pendingProps.children,c),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function jr(a){a.flags|=4}function xf(a,i,c,p,v){if((i=(a.mode&32)!==0)&&(i=!1),i){if(a.flags|=16777216,(v&335544128)===v)if(a.stateNode.complete)a.flags|=8192;else if(b0())a.flags|=8192;else throw Di=Ec,Dp}else a.flags&=-16777217}function Wb(a,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!lx(i))if(b0())a.flags|=8192;else throw Di=Ec,Dp}function qc(a,i){i!==null&&(a.flags|=4),a.flags&16384&&(i=a.tag!==22?qr():536870912,a.lanes|=i,$s|=i)}function Zo(a,i){if(!ct)switch(a.tailMode){case"hidden":i=a.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?a.tail=null:c.sibling=null;break;case"collapsed":c=a.tail;for(var p=null;c!==null;)c.alternate!==null&&(p=c),c=c.sibling;p===null?i||a.tail===null?a.tail=null:a.tail.sibling=null:p.sibling=null}}function Mt(a){var i=a.alternate!==null&&a.alternate.child===a.child,c=0,p=0;if(i)for(var v=a.child;v!==null;)c|=v.lanes|v.childLanes,p|=v.subtreeFlags&65011712,p|=v.flags&65011712,v.return=a,v=v.sibling;else for(v=a.child;v!==null;)c|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=a,v=v.sibling;return a.subtreeFlags|=p,a.childLanes=c,i}function rT(a,i,c){var p=i.pendingProps;switch(Ep(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(i),null;case 1:return Mt(i),null;case 3:return c=i.stateNode,p=null,a!==null&&(p=a.memoizedState.cache),i.memoizedState.cache!==p&&(i.flags|=2048),xr(tn),Ee(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(a===null||a.child===null)&&(js(i)?jr(i):a===null||a.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Ap())),Mt(i),null;case 26:var v=i.type,x=i.memoizedState;return a===null?(jr(i),x!==null?(Mt(i),Wb(i,x)):(Mt(i),xf(i,v,null,p,c))):x?x!==a.memoizedState?(jr(i),Mt(i),Wb(i,x)):(Mt(i),i.flags&=-16777217):(a=a.memoizedProps,a!==p&&jr(i),Mt(i),xf(i,v,a,p,c)),null;case 27:if(We(i),c=le.current,v=i.type,a!==null&&i.stateNode!=null)a.memoizedProps!==p&&jr(i);else{if(!p){if(i.stateNode===null)throw Error(r(166));return Mt(i),null}a=ne.current,js(i)?Ny(i):(a=ex(v,p,c),i.stateNode=a,jr(i))}return Mt(i),null;case 5:if(We(i),v=i.type,a!==null&&i.stateNode!=null)a.memoizedProps!==p&&jr(i);else{if(!p){if(i.stateNode===null)throw Error(r(166));return Mt(i),null}if(x=ne.current,js(i))Ny(i);else{var N=iu(le.current);switch(x){case 1:x=N.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:x=N.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":x=N.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":x=N.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":x=N.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof p.is=="string"?N.createElement("select",{is:p.is}):N.createElement("select"),p.multiple?x.multiple=!0:p.size&&(x.size=p.size);break;default:x=typeof p.is=="string"?N.createElement(v,{is:p.is}):N.createElement(v)}}x[qt]=i,x[cn]=p;e:for(N=i.child;N!==null;){if(N.tag===5||N.tag===6)x.appendChild(N.stateNode);else if(N.tag!==4&&N.tag!==27&&N.child!==null){N.child.return=N,N=N.child;continue}if(N===i)break e;for(;N.sibling===null;){if(N.return===null||N.return===i)break e;N=N.return}N.sibling.return=N.return,N=N.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&&jr(i)}}return Mt(i),xf(i,i.type,a===null?null:a.memoizedProps,i.pendingProps,c),null;case 6:if(a&&i.stateNode!=null)a.memoizedProps!==p&&jr(i);else{if(typeof p!="string"&&i.stateNode===null)throw Error(r(166));if(a=le.current,js(i)){if(a=i.stateNode,c=i.memoizedProps,p=null,v=bn,v!==null)switch(v.tag){case 27:case 5:p=v.memoizedProps}a[qt]=i,a=!!(a.nodeValue===c||p!==null&&p.suppressHydrationWarning===!0||H0(a.nodeValue,c)),a||Yr(i,!0)}else a=iu(a).createTextNode(p),a[qt]=i,i.stateNode=a}return Mt(i),null;case 31:if(c=i.memoizedState,a===null||a.memoizedState!==null){if(p=js(i),c!==null){if(a===null){if(!p)throw Error(r(318));if(a=i.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[qt]=i}else _i(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Mt(i),a=!1}else c=Ap(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=c),a=!0;if(!a)return i.flags&256?(Xn(i),i):(Xn(i),null);if((i.flags&128)!==0)throw Error(r(558))}return Mt(i),null;case 13:if(p=i.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(v=js(i),p!==null&&p.dehydrated!==null){if(a===null){if(!v)throw Error(r(318));if(v=i.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[qt]=i}else _i(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Mt(i),v=!1}else v=Ap(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=v),v=!0;if(!v)return i.flags&256?(Xn(i),i):(Xn(i),null)}return Xn(i),(i.flags&128)!==0?(i.lanes=c,i):(c=p!==null,a=a!==null&&a.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!==a&&c&&(i.child.flags|=8192),qc(i,i.updateQueue),Mt(i),null);case 4:return Ee(),a===null&&Ff(i.stateNode.containerInfo),Mt(i),null;case 10:return xr(i.type),Mt(i),null;case 19:if(G(Kt),p=i.memoizedState,p===null)return Mt(i),null;if(v=(i.flags&128)!==0,x=p.rendering,x===null)if(v)Zo(p,!1);else{if(Zt!==0||a!==null&&(a.flags&128)!==0)for(a=i.child;a!==null;){if(x=_c(a),x!==null){for(i.flags|=128,Zo(p,!1),a=x.updateQueue,i.updateQueue=a,qc(i,a),i.subtreeFlags=0,a=c,c=i.child;c!==null;)wy(c,a),c=c.sibling;return O(Kt,Kt.current&1|2),ct&&yr(i,p.treeForkCount),i.child}a=a.sibling}p.tail!==null&&ut()>Yc&&(i.flags|=128,v=!0,Zo(p,!1),i.lanes=4194304)}else{if(!v)if(a=_c(x),a!==null){if(i.flags|=128,v=!0,a=a.updateQueue,i.updateQueue=a,qc(i,a),Zo(p,!0),p.tail===null&&p.tailMode==="hidden"&&!x.alternate&&!ct)return Mt(i),null}else 2*ut()-p.renderingStartTime>Yc&&c!==536870912&&(i.flags|=128,v=!0,Zo(p,!1),i.lanes=4194304);p.isBackwards?(x.sibling=i.child,i.child=x):(a=p.last,a!==null?a.sibling=x:i.child=x,p.last=x)}return p.tail!==null?(a=p.tail,p.rendering=a,p.tail=a.sibling,p.renderingStartTime=ut(),a.sibling=null,c=Kt.current,O(Kt,v?c&1|2:c&1),ct&&yr(i,p.treeForkCount),a):(Mt(i),null);case 22:case 23:return Xn(i),Fp(),p=i.memoizedState!==null,a!==null?a.memoizedState!==null!==p&&(i.flags|=8192):p&&(i.flags|=8192),p?(c&536870912)!==0&&(i.flags&128)===0&&(Mt(i),i.subtreeFlags&6&&(i.flags|=8192)):Mt(i),c=i.updateQueue,c!==null&&qc(i,c.retryQueue),c=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),p=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(p=i.memoizedState.cachePool.pool),p!==c&&(i.flags|=2048),a!==null&&G(Mi),null;case 24:return c=null,a!==null&&(c=a.memoizedState.cache),i.memoizedState.cache!==c&&(i.flags|=2048),xr(tn),Mt(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function iT(a,i){switch(Ep(i),i.tag){case 1:return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 3:return xr(tn),Ee(),a=i.flags,(a&65536)!==0&&(a&128)===0?(i.flags=a&-65537|128,i):null;case 26:case 27:case 5:return We(i),null;case 31:if(i.memoizedState!==null){if(Xn(i),i.alternate===null)throw Error(r(340));_i()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 13:if(Xn(i),a=i.memoizedState,a!==null&&a.dehydrated!==null){if(i.alternate===null)throw Error(r(340));_i()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 19:return G(Kt),null;case 4:return Ee(),null;case 10:return xr(i.type),null;case 22:case 23:return Xn(i),Fp(),a!==null&&G(Mi),a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 24:return xr(tn),null;case 25:return null;default:return null}}function Zb(a,i){switch(Ep(i),i.tag){case 3:xr(tn),Ee();break;case 26:case 27:case 5:We(i);break;case 4:Ee();break;case 31:i.memoizedState!==null&&Xn(i);break;case 13:Xn(i);break;case 19:G(Kt);break;case 10:xr(i.type);break;case 22:case 23:Xn(i),Fp(),a!==null&&G(Mi);break;case 24:xr(tn)}}function Yo(a,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&a)===a){p=void 0;var x=c.create,N=c.inst;p=x(),N.destroy=p}c=c.next}while(c!==v)}}catch(z){wt(i,i.return,z)}}function ni(a,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&a)===a){var N=p.inst,z=N.destroy;if(z!==void 0){N.destroy=void 0,v=i;var Y=c,re=z;try{re()}catch(pe){wt(v,Y,pe)}}}p=p.next}while(p!==x)}}catch(pe){wt(i,i.return,pe)}}function Yb(a){var i=a.updateQueue;if(i!==null){var c=a.stateNode;try{Py(i,c)}catch(p){wt(a,a.return,p)}}}function Kb(a,i,c){c.props=Pi(a.type,a.memoizedProps),c.state=a.memoizedState;try{c.componentWillUnmount()}catch(p){wt(a,i,p)}}function Ko(a,i){try{var c=a.ref;if(c!==null){switch(a.tag){case 26:case 27:case 5:var p=a.stateNode;break;case 30:p=a.stateNode;break;default:p=a.stateNode}typeof c=="function"?a.refCleanup=c(p):c.current=p}}catch(v){wt(a,i,v)}}function Za(a,i){var c=a.ref,p=a.refCleanup;if(c!==null)if(typeof p=="function")try{p()}catch(v){wt(a,i,v)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(v){wt(a,i,v)}else c.current=null}function Qb(a){var i=a.type,c=a.memoizedProps,p=a.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){wt(a,a.return,v)}}function wf(a,i,c){try{var p=a.stateNode;ET(p,a.type,c,i),p[cn]=i}catch(v){wt(a,a.return,v)}}function Xb(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&ci(a.type)||a.tag===4}function kf(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Xb(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&ci(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Sf(a,i,c){var p=a.tag;if(p===5||p===6)a=a.stateNode,i?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(a,i):(i=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,i.appendChild(a),c=c._reactRootContainer,c!=null||i.onclick!==null||(i.onclick=mr));else if(p!==4&&(p===27&&ci(a.type)&&(c=a.stateNode,i=null),a=a.child,a!==null))for(Sf(a,i,c),a=a.sibling;a!==null;)Sf(a,i,c),a=a.sibling}function Gc(a,i,c){var p=a.tag;if(p===5||p===6)a=a.stateNode,i?c.insertBefore(a,i):c.appendChild(a);else if(p!==4&&(p===27&&ci(a.type)&&(c=a.stateNode),a=a.child,a!==null))for(Gc(a,i,c),a=a.sibling;a!==null;)Gc(a,i,c),a=a.sibling}function Jb(a){var i=a.stateNode,c=a.memoizedProps;try{for(var p=a.type,v=i.attributes;v.length;)i.removeAttributeNode(v[0]);kn(i,p,c),i[qt]=a,i[cn]=c}catch(x){wt(a,a.return,x)}}var Cr=!1,rn=!1,jf=!1,e0=typeof WeakSet=="function"?WeakSet:Set,gn=null;function sT(a,i){if(a=a.containerInfo,Gf=pu,a=py(a),gp(a)){if("selectionStart"in a)var c={start:a.selectionStart,end:a.selectionEnd};else e:{c=(c=a.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 N=0,z=-1,Y=-1,re=0,pe=0,me=a,se=null;t:for(;;){for(var oe;me!==c||v!==0&&me.nodeType!==3||(z=N+v),me!==x||p!==0&&me.nodeType!==3||(Y=N+p),me.nodeType===3&&(N+=me.nodeValue.length),(oe=me.firstChild)!==null;)se=me,me=oe;for(;;){if(me===a)break t;if(se===c&&++re===v&&(z=N),se===x&&++pe===p&&(Y=N),(oe=me.nextSibling)!==null)break;me=se,se=me.parentNode}me=oe}c=z===-1||Y===-1?null:{start:z,end:Y}}else c=null}c=c||{start:0,end:0}}else c=null;for(Vf={focusedElem:a,selectionRange:c},pu=!1,gn=i;gn!==null;)if(i=gn,a=i.child,(i.subtreeFlags&1028)!==0&&a!==null)a.return=i,gn=a;else for(;gn!==null;){switch(i=gn,x=i.alternate,a=i.flags,i.tag){case 0:if((a&4)!==0&&(a=i.updateQueue,a=a!==null?a.events:null,a!==null))for(c=0;c<a.length;c++)v=a[c],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&x!==null){a=void 0,c=i,v=x.memoizedProps,x=x.memoizedState,p=c.stateNode;try{var Ae=Pi(c.type,v);a=p.getSnapshotBeforeUpdate(Ae,x),p.__reactInternalSnapshotBeforeUpdate=a}catch(Be){wt(c,c.return,Be)}}break;case 3:if((a&1024)!==0){if(a=i.stateNode.containerInfo,c=a.nodeType,c===9)Yf(a);else if(c===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":Yf(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(r(163))}if(a=i.sibling,a!==null){a.return=i.return,gn=a;break}gn=i.return}}function t0(a,i,c){var p=c.flags;switch(c.tag){case 0:case 11:case 15:Er(a,c),p&4&&Yo(5,c);break;case 1:if(Er(a,c),p&4)if(a=c.stateNode,i===null)try{a.componentDidMount()}catch(N){wt(c,c.return,N)}else{var v=Pi(c.type,i.memoizedProps);i=i.memoizedState;try{a.componentDidUpdate(v,i,a.__reactInternalSnapshotBeforeUpdate)}catch(N){wt(c,c.return,N)}}p&64&&Yb(c),p&512&&Ko(c,c.return);break;case 3:if(Er(a,c),p&64&&(a=c.updateQueue,a!==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{Py(a,i)}catch(N){wt(c,c.return,N)}}break;case 27:i===null&&p&4&&Jb(c);case 26:case 5:Er(a,c),i===null&&p&4&&Qb(c),p&512&&Ko(c,c.return);break;case 12:Er(a,c);break;case 31:Er(a,c),p&4&&r0(a,c);break;case 13:Er(a,c),p&4&&i0(a,c),p&64&&(a=c.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(c=mT.bind(null,c),zT(a,c))));break;case 22:if(p=c.memoizedState!==null||Cr,!p){i=i!==null&&i.memoizedState!==null||rn,v=Cr;var x=rn;Cr=p,(rn=i)&&!x?Tr(a,c,(c.subtreeFlags&8772)!==0):Er(a,c),Cr=v,rn=x}break;case 30:break;default:Er(a,c)}}function n0(a){var i=a.alternate;i!==null&&(a.alternate=null,n0(i)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(i=a.stateNode,i!==null&&Gr(i)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}var $t=null,In=!1;function Nr(a,i,c){for(c=c.child;c!==null;)a0(a,i,c),c=c.sibling}function a0(a,i,c){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(Ce,c)}catch{}switch(c.tag){case 26:rn||Za(c,i),Nr(a,i,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:rn||Za(c,i);var p=$t,v=In;ci(c.type)&&($t=c.stateNode,In=!1),Nr(a,i,c),il(c.stateNode),$t=p,In=v;break;case 5:rn||Za(c,i);case 6:if(p=$t,v=In,$t=null,Nr(a,i,c),$t=p,In=v,$t!==null)if(In)try{($t.nodeType===9?$t.body:$t.nodeName==="HTML"?$t.ownerDocument.body:$t).removeChild(c.stateNode)}catch(x){wt(c,i,x)}else try{$t.removeChild(c.stateNode)}catch(x){wt(c,i,x)}break;case 18:$t!==null&&(In?(a=$t,Y0(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,c.stateNode),Gs(a)):Y0($t,c.stateNode));break;case 4:p=$t,v=In,$t=c.stateNode.containerInfo,In=!0,Nr(a,i,c),$t=p,In=v;break;case 0:case 11:case 14:case 15:ni(2,c,i),rn||ni(4,c,i),Nr(a,i,c);break;case 1:rn||(Za(c,i),p=c.stateNode,typeof p.componentWillUnmount=="function"&&Kb(c,i,p)),Nr(a,i,c);break;case 21:Nr(a,i,c);break;case 22:rn=(p=rn)||c.memoizedState!==null,Nr(a,i,c),rn=p;break;default:Nr(a,i,c)}}function r0(a,i){if(i.memoizedState===null&&(a=i.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{Gs(a)}catch(c){wt(i,i.return,c)}}}function i0(a,i){if(i.memoizedState===null&&(a=i.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{Gs(a)}catch(c){wt(i,i.return,c)}}function oT(a){switch(a.tag){case 31:case 13:case 19:var i=a.stateNode;return i===null&&(i=a.stateNode=new e0),i;case 22:return a=a.stateNode,i=a._retryCache,i===null&&(i=a._retryCache=new e0),i;default:throw Error(r(435,a.tag))}}function Vc(a,i){var c=oT(a);i.forEach(function(p){if(!c.has(p)){c.add(p);var v=gT.bind(null,a,p);p.then(v,v)}})}function Pn(a,i){var c=i.deletions;if(c!==null)for(var p=0;p<c.length;p++){var v=c[p],x=a,N=i,z=N;e:for(;z!==null;){switch(z.tag){case 27:if(ci(z.type)){$t=z.stateNode,In=!1;break e}break;case 5:$t=z.stateNode,In=!1;break e;case 3:case 4:$t=z.stateNode.containerInfo,In=!0;break e}z=z.return}if($t===null)throw Error(r(160));a0(x,N,v),$t=null,In=!1,x=v.alternate,x!==null&&(x.return=null),v.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)s0(i,a),i=i.sibling}var Ma=null;function s0(a,i){var c=a.alternate,p=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:Pn(i,a),Un(a),p&4&&(ni(3,a,a.return),Yo(3,a),ni(5,a,a.return));break;case 1:Pn(i,a),Un(a),p&512&&(rn||c===null||Za(c,c.return)),p&64&&Cr&&(a=a.updateQueue,a!==null&&(p=a.callbacks,p!==null&&(c=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=c===null?p:c.concat(p))));break;case 26:var v=Ma;if(Pn(i,a),Un(a),p&512&&(rn||c===null||Za(c,c.return)),p&4){var x=c!==null?c.memoizedState:null;if(p=a.memoizedState,c===null)if(p===null)if(a.stateNode===null){e:{p=a.type,c=a.memoizedProps,v=v.ownerDocument||v;t:switch(p){case"title":x=v.getElementsByTagName("title")[0],(!x||x[Oa]||x[qt]||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[qt]=a,Ot(x),p=x;break e;case"link":var N=sx("link","href",v).get(p+(c.href||""));if(N){for(var z=0;z<N.length;z++)if(x=N[z],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){N.splice(z,1);break t}}x=v.createElement(p),kn(x,p,c),v.head.appendChild(x);break;case"meta":if(N=sx("meta","content",v).get(p+(c.content||""))){for(z=0;z<N.length;z++)if(x=N[z],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){N.splice(z,1);break t}}x=v.createElement(p),kn(x,p,c),v.head.appendChild(x);break;default:throw Error(r(468,p))}x[qt]=a,Ot(x),p=x}a.stateNode=p}else ox(v,a.type,a.stateNode);else a.stateNode=ix(v,p,a.memoizedProps);else x!==p?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,p===null?ox(v,a.type,a.stateNode):ix(v,p,a.memoizedProps)):p===null&&a.stateNode!==null&&wf(a,a.memoizedProps,c.memoizedProps)}break;case 27:Pn(i,a),Un(a),p&512&&(rn||c===null||Za(c,c.return)),c!==null&&p&4&&wf(a,a.memoizedProps,c.memoizedProps);break;case 5:if(Pn(i,a),Un(a),p&512&&(rn||c===null||Za(c,c.return)),a.flags&32){v=a.stateNode;try{hs(v,"")}catch(Ae){wt(a,a.return,Ae)}}p&4&&a.stateNode!=null&&(v=a.memoizedProps,wf(a,v,c!==null?c.memoizedProps:v)),p&1024&&(jf=!0);break;case 6:if(Pn(i,a),Un(a),p&4){if(a.stateNode===null)throw Error(r(162));p=a.memoizedProps,c=a.stateNode;try{c.nodeValue=p}catch(Ae){wt(a,a.return,Ae)}}break;case 3:if(lu=null,v=Ma,Ma=su(i.containerInfo),Pn(i,a),Ma=v,Un(a),p&4&&c!==null&&c.memoizedState.isDehydrated)try{Gs(i.containerInfo)}catch(Ae){wt(a,a.return,Ae)}jf&&(jf=!1,o0(a));break;case 4:p=Ma,Ma=su(a.stateNode.containerInfo),Pn(i,a),Un(a),Ma=p;break;case 12:Pn(i,a),Un(a);break;case 31:Pn(i,a),Un(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Vc(a,p)));break;case 13:Pn(i,a),Un(a),a.child.flags&8192&&a.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Zc=ut()),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Vc(a,p)));break;case 22:v=a.memoizedState!==null;var Y=c!==null&&c.memoizedState!==null,re=Cr,pe=rn;if(Cr=re||v,rn=pe||Y,Pn(i,a),rn=pe,Cr=re,Un(a),p&8192)e:for(i=a.stateNode,i._visibility=v?i._visibility&-2:i._visibility|1,v&&(c===null||Y||Cr||rn||Ui(a)),c=null,i=a;;){if(i.tag===5||i.tag===26){if(c===null){Y=c=i;try{if(x=Y.stateNode,v)N=x.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none";else{z=Y.stateNode;var me=Y.memoizedProps.style,se=me!=null&&me.hasOwnProperty("display")?me.display:null;z.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Ae){wt(Y,Y.return,Ae)}}}else if(i.tag===6){if(c===null){Y=i;try{Y.stateNode.nodeValue=v?"":Y.memoizedProps}catch(Ae){wt(Y,Y.return,Ae)}}}else if(i.tag===18){if(c===null){Y=i;try{var oe=Y.stateNode;v?K0(oe,!0):K0(Y.stateNode,!1)}catch(Ae){wt(Y,Y.return,Ae)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===a)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;c===i&&(c=null),i=i.return}c===i&&(c=null),i.sibling.return=i.return,i=i.sibling}p&4&&(p=a.updateQueue,p!==null&&(c=p.retryQueue,c!==null&&(p.retryQueue=null,Vc(a,c))));break;case 19:Pn(i,a),Un(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Vc(a,p)));break;case 30:break;case 21:break;default:Pn(i,a),Un(a)}}function Un(a){var i=a.flags;if(i&2){try{for(var c,p=a.return;p!==null;){if(Xb(p)){c=p;break}p=p.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var v=c.stateNode,x=kf(a);Gc(a,x,v);break;case 5:var N=c.stateNode;c.flags&32&&(hs(N,""),c.flags&=-33);var z=kf(a);Gc(a,z,N);break;case 3:case 4:var Y=c.stateNode.containerInfo,re=kf(a);Sf(a,re,Y);break;default:throw Error(r(161))}}catch(pe){wt(a,a.return,pe)}a.flags&=-3}i&4096&&(a.flags&=-4097)}function o0(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var i=a;o0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),a=a.sibling}}function Er(a,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)t0(a,i.alternate,i),i=i.sibling}function Ui(a){for(a=a.child;a!==null;){var i=a;switch(i.tag){case 0:case 11:case 14:case 15:ni(4,i,i.return),Ui(i);break;case 1:Za(i,i.return);var c=i.stateNode;typeof c.componentWillUnmount=="function"&&Kb(i,i.return,c),Ui(i);break;case 27:il(i.stateNode);case 26:case 5:Za(i,i.return),Ui(i);break;case 22:i.memoizedState===null&&Ui(i);break;case 30:Ui(i);break;default:Ui(i)}a=a.sibling}}function Tr(a,i,c){for(c=c&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var p=i.alternate,v=a,x=i,N=x.flags;switch(x.tag){case 0:case 11:case 15:Tr(v,x,c),Yo(4,x);break;case 1:if(Tr(v,x,c),p=x,v=p.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(re){wt(p,p.return,re)}if(p=x,v=p.updateQueue,v!==null){var z=p.stateNode;try{var Y=v.shared.hiddenCallbacks;if(Y!==null)for(v.shared.hiddenCallbacks=null,v=0;v<Y.length;v++)Iy(Y[v],z)}catch(re){wt(p,p.return,re)}}c&&N&64&&Yb(x),Ko(x,x.return);break;case 27:Jb(x);case 26:case 5:Tr(v,x,c),c&&p===null&&N&4&&Qb(x),Ko(x,x.return);break;case 12:Tr(v,x,c);break;case 31:Tr(v,x,c),c&&N&4&&r0(v,x);break;case 13:Tr(v,x,c),c&&N&4&&i0(v,x);break;case 22:x.memoizedState===null&&Tr(v,x,c),Ko(x,x.return);break;case 30:break;default:Tr(v,x,c)}i=i.sibling}}function Cf(a,i){var c=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),a=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),a!==c&&(a!=null&&a.refCount++,c!=null&&Do(c))}function Nf(a,i){a=null,i.alternate!==null&&(a=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==a&&(i.refCount++,a!=null&&Do(a))}function za(a,i,c,p){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)l0(a,i,c,p),i=i.sibling}function l0(a,i,c,p){var v=i.flags;switch(i.tag){case 0:case 11:case 15:za(a,i,c,p),v&2048&&Yo(9,i);break;case 1:za(a,i,c,p);break;case 3:za(a,i,c,p),v&2048&&(a=null,i.alternate!==null&&(a=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==a&&(i.refCount++,a!=null&&Do(a)));break;case 12:if(v&2048){za(a,i,c,p),a=i.stateNode;try{var x=i.memoizedProps,N=x.id,z=x.onPostCommit;typeof z=="function"&&z(N,i.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(Y){wt(i,i.return,Y)}}else za(a,i,c,p);break;case 31:za(a,i,c,p);break;case 13:za(a,i,c,p);break;case 23:break;case 22:x=i.stateNode,N=i.alternate,i.memoizedState!==null?x._visibility&2?za(a,i,c,p):Qo(a,i):x._visibility&2?za(a,i,c,p):(x._visibility|=2,Ms(a,i,c,p,(i.subtreeFlags&10256)!==0||!1)),v&2048&&Cf(N,i);break;case 24:za(a,i,c,p),v&2048&&Nf(i.alternate,i);break;default:za(a,i,c,p)}}function Ms(a,i,c,p,v){for(v=v&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var x=a,N=i,z=c,Y=p,re=N.flags;switch(N.tag){case 0:case 11:case 15:Ms(x,N,z,Y,v),Yo(8,N);break;case 23:break;case 22:var pe=N.stateNode;N.memoizedState!==null?pe._visibility&2?Ms(x,N,z,Y,v):Qo(x,N):(pe._visibility|=2,Ms(x,N,z,Y,v)),v&&re&2048&&Cf(N.alternate,N);break;case 24:Ms(x,N,z,Y,v),v&&re&2048&&Nf(N.alternate,N);break;default:Ms(x,N,z,Y,v)}i=i.sibling}}function Qo(a,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var c=a,p=i,v=p.flags;switch(p.tag){case 22:Qo(c,p),v&2048&&Cf(p.alternate,p);break;case 24:Qo(c,p),v&2048&&Nf(p.alternate,p);break;default:Qo(c,p)}i=i.sibling}}var Xo=8192;function zs(a,i,c){if(a.subtreeFlags&Xo)for(a=a.child;a!==null;)c0(a,i,c),a=a.sibling}function c0(a,i,c){switch(a.tag){case 26:zs(a,i,c),a.flags&Xo&&a.memoizedState!==null&&WT(c,Ma,a.memoizedState,a.memoizedProps);break;case 5:zs(a,i,c);break;case 3:case 4:var p=Ma;Ma=su(a.stateNode.containerInfo),zs(a,i,c),Ma=p;break;case 22:a.memoizedState===null&&(p=a.alternate,p!==null&&p.memoizedState!==null?(p=Xo,Xo=16777216,zs(a,i,c),Xo=p):zs(a,i,c));break;default:zs(a,i,c)}}function u0(a){var i=a.alternate;if(i!==null&&(a=i.child,a!==null)){i.child=null;do i=a.sibling,a.sibling=null,a=i;while(a!==null)}}function Jo(a){var i=a.deletions;if((a.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var p=i[c];gn=p,p0(p,a)}u0(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)d0(a),a=a.sibling}function d0(a){switch(a.tag){case 0:case 11:case 15:Jo(a),a.flags&2048&&ni(9,a,a.return);break;case 3:Jo(a);break;case 12:Jo(a);break;case 22:var i=a.stateNode;a.memoizedState!==null&&i._visibility&2&&(a.return===null||a.return.tag!==13)?(i._visibility&=-3,Wc(a)):Jo(a);break;default:Jo(a)}}function Wc(a){var i=a.deletions;if((a.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var p=i[c];gn=p,p0(p,a)}u0(a)}for(a=a.child;a!==null;){switch(i=a,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)}a=a.sibling}}function p0(a,i){for(;gn!==null;){var c=gn;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:Do(c.memoizedState.cache)}if(p=c.child,p!==null)p.return=c,gn=p;else e:for(c=a;gn!==null;){p=gn;var v=p.sibling,x=p.return;if(n0(p),p===c){gn=null;break e}if(v!==null){v.return=x,gn=v;break e}gn=x}}}var lT={getCacheForType:function(a){var i=xn(tn),c=i.data.get(a);return c===void 0&&(c=a(),i.data.set(a,c)),c},cacheSignal:function(){return xn(tn).controller.signal}},cT=typeof WeakMap=="function"?WeakMap:Map,vt=0,Nt=null,nt=null,st=0,xt=0,Jn=null,ai=!1,Ds=!1,Ef=!1,Ar=0,Zt=0,ri=0,Bi=0,Tf=0,ea=0,$s=0,el=null,Bn=null,Af=!1,Zc=0,f0=0,Yc=1/0,Kc=null,ii=null,un=0,si=null,Is=null,Rr=0,Rf=0,_f=null,h0=null,tl=0,Of=null;function ta(){return(vt&2)!==0&&st!==0?st&-st:q.T!==null?If():Ye()}function m0(){if(ea===0)if((st&536870912)===0||ct){var a=Fr;Fr<<=1,(Fr&3932160)===0&&(Fr=262144),ea=a}else ea=536870912;return a=Qn.current,a!==null&&(a.flags|=32),ea}function Fn(a,i,c){(a===Nt&&(xt===2||xt===9)||a.cancelPendingCommit!==null)&&(Ps(a,0),oi(a,st,ea,!1)),ge(a,c),((vt&2)===0||a!==Nt)&&(a===Nt&&((vt&2)===0&&(Bi|=c),Zt===4&&oi(a,st,ea,!1)),Ya(a))}function g0(a,i,c){if((vt&6)!==0)throw Error(r(327));var p=!c&&(i&127)===0&&(i&a.expiredLanes)===0||cr(a,i),v=p?pT(a,i):Mf(a,i,!0),x=p;do{if(v===0){Ds&&!p&&oi(a,i,0,!1);break}else{if(c=a.current.alternate,x&&!uT(c)){v=Mf(a,i,!1),x=!1;continue}if(v===2){if(x=i,a.errorRecoveryDisabledLanes&x)var N=0;else N=a.pendingLanes&-536870913,N=N!==0?N:N&536870912?536870912:0;if(N!==0){i=N;e:{var z=a;v=el;var Y=z.current.memoizedState.isDehydrated;if(Y&&(Ps(z,N).flags|=256),N=Mf(z,N,!1),N!==2){if(Ef&&!Y){z.errorRecoveryDisabledLanes|=x,Bi|=x,v=4;break e}x=Bn,Bn=v,x!==null&&(Bn===null?Bn=x:Bn.push.apply(Bn,x))}v=N}if(x=!1,v!==2)continue}}if(v===1){Ps(a,0),oi(a,i,0,!0);break}e:{switch(p=a,x=v,x){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:oi(p,i,ea,!ai);break e;case 2:Bn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(v=Zc+300-ut(),10<v)){if(oi(p,i,ea,!ai),qa(p,0,!0)!==0)break e;Rr=i,p.timeoutHandle=W0(v0.bind(null,p,c,Bn,Kc,Af,i,ea,Bi,$s,ai,x,"Throttled",-0,0),v);break e}v0(p,c,Bn,Kc,Af,i,ea,Bi,$s,ai,x,null,-0,0)}}break}while(!0);Ya(a)}function v0(a,i,c,p,v,x,N,z,Y,re,pe,me,se,oe){if(a.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:mr},c0(i,x,me);var Ae=(x&62914560)===x?Zc-ut():(x&4194048)===x?f0-ut():0;if(Ae=ZT(me,Ae),Ae!==null){Rr=x,a.cancelPendingCommit=Ae(C0.bind(null,a,i,x,c,p,v,N,z,Y,pe,me,null,se,oe)),oi(a,x,N,!re);return}}C0(a,i,x,c,p,v,N,z,Y)}function uT(a){for(var i=a;;){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===a)break;for(;i.sibling===null;){if(i.return===null||i.return===a)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function oi(a,i,c,p){i&=~Tf,i&=~Bi,a.suspendedLanes|=i,a.pingedLanes&=~i,p&&(a.warmLanes|=i),p=a.expirationTimes;for(var v=i;0<v;){var x=31-Ne(v),N=1<<x;p[x]=-1,v&=~N}c!==0&&de(a,c,i)}function Qc(){return(vt&6)===0?(nl(0),!1):!0}function Lf(){if(nt!==null){if(xt===0)var a=nt.return;else a=nt,br=Oi=null,Zp(a),As=null,Io=0,a=nt;for(;a!==null;)Zb(a.alternate,a),a=a.return;nt=null}}function Ps(a,i){var c=a.timeoutHandle;c!==-1&&(a.timeoutHandle=-1,RT(c)),c=a.cancelPendingCommit,c!==null&&(a.cancelPendingCommit=null,c()),Rr=0,Lf(),Nt=a,nt=c=vr(a.current,null),st=i,xt=0,Jn=null,ai=!1,Ds=cr(a,i),Ef=!1,$s=ea=Tf=Bi=ri=Zt=0,Bn=el=null,Af=!1,(i&8)!==0&&(i|=i&32);var p=a.entangledLanes;if(p!==0)for(a=a.entanglements,p&=i;0<p;){var v=31-Ne(p),x=1<<v;i|=a[v],p&=~x}return Ar=i,yc(),c}function y0(a,i){Ke=null,q.H=Vo,i===Ts||i===Nc?(i=My(),xt=3):i===Dp?(i=My(),xt=4):xt=i===df?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Jn=i,nt===null&&(Zt=1,Uc(a,ba(i,a.current)))}function b0(){var a=Qn.current;return a===null?!0:(st&4194048)===st?Sa===null:(st&62914560)===st||(st&536870912)!==0?a===Sa:!1}function x0(){var a=q.H;return q.H=Vo,a===null?Vo:a}function w0(){var a=q.A;return q.A=lT,a}function Xc(){Zt=4,ai||(st&4194048)!==st&&Qn.current!==null||(Ds=!0),(ri&134217727)===0&&(Bi&134217727)===0||Nt===null||oi(Nt,st,ea,!1)}function Mf(a,i,c){var p=vt;vt|=2;var v=x0(),x=w0();(Nt!==a||st!==i)&&(Kc=null,Ps(a,i)),i=!1;var N=Zt;e:do try{if(xt!==0&&nt!==null){var z=nt,Y=Jn;switch(xt){case 8:Lf(),N=6;break e;case 3:case 2:case 9:case 6:Qn.current===null&&(i=!0);var re=xt;if(xt=0,Jn=null,Us(a,z,Y,re),c&&Ds){N=0;break e}break;default:re=xt,xt=0,Jn=null,Us(a,z,Y,re)}}dT(),N=Zt;break}catch(pe){y0(a,pe)}while(!0);return i&&a.shellSuspendCounter++,br=Oi=null,vt=p,q.H=v,q.A=x,nt===null&&(Nt=null,st=0,yc()),N}function dT(){for(;nt!==null;)k0(nt)}function pT(a,i){var c=vt;vt|=2;var p=x0(),v=w0();Nt!==a||st!==i?(Kc=null,Yc=ut()+500,Ps(a,i)):Ds=cr(a,i);e:do try{if(xt!==0&&nt!==null){i=nt;var x=Jn;t:switch(xt){case 1:xt=0,Jn=null,Us(a,i,x,1);break;case 2:case 9:if(Oy(x)){xt=0,Jn=null,S0(i);break}i=function(){xt!==2&&xt!==9||Nt!==a||(xt=7),Ya(a)},x.then(i,i);break e;case 3:xt=7;break e;case 4:xt=5;break e;case 7:Oy(x)?(xt=0,Jn=null,S0(i)):(xt=0,Jn=null,Us(a,i,x,7));break;case 5:var N=null;switch(nt.tag){case 26:N=nt.memoizedState;case 5:case 27:var z=nt;if(N?lx(N):z.stateNode.complete){xt=0,Jn=null;var Y=z.sibling;if(Y!==null)nt=Y;else{var re=z.return;re!==null?(nt=re,Jc(re)):nt=null}break t}}xt=0,Jn=null,Us(a,i,x,5);break;case 6:xt=0,Jn=null,Us(a,i,x,6);break;case 8:Lf(),Zt=6;break e;default:throw Error(r(462))}}fT();break}catch(pe){y0(a,pe)}while(!0);return br=Oi=null,q.H=p,q.A=v,vt=c,nt!==null?0:(Nt=null,st=0,yc(),Zt)}function fT(){for(;nt!==null&&!Yt();)k0(nt)}function k0(a){var i=Vb(a.alternate,a,Ar);a.memoizedProps=a.pendingProps,i===null?Jc(a):nt=i}function S0(a){var i=a,c=i.alternate;switch(i.tag){case 15:case 0:i=Ub(c,i,i.pendingProps,i.type,void 0,st);break;case 11:i=Ub(c,i,i.pendingProps,i.type.render,i.ref,st);break;case 5:Zp(i);default:Zb(c,i),i=nt=wy(i,Ar),i=Vb(c,i,Ar)}a.memoizedProps=a.pendingProps,i===null?Jc(a):nt=i}function Us(a,i,c,p){br=Oi=null,Zp(i),As=null,Io=0;var v=i.return;try{if(tT(a,v,i,c,st)){Zt=1,Uc(a,ba(c,a.current)),nt=null;return}}catch(x){if(v!==null)throw nt=v,x;Zt=1,Uc(a,ba(c,a.current)),nt=null;return}i.flags&32768?(ct||p===1?a=!0:Ds||(st&536870912)!==0?a=!1:(ai=a=!0,(p===2||p===9||p===3||p===6)&&(p=Qn.current,p!==null&&p.tag===13&&(p.flags|=16384))),j0(i,a)):Jc(i)}function Jc(a){var i=a;do{if((i.flags&32768)!==0){j0(i,ai);return}a=i.return;var c=rT(i.alternate,i,Ar);if(c!==null){nt=c;return}if(i=i.sibling,i!==null){nt=i;return}nt=i=a}while(i!==null);Zt===0&&(Zt=5)}function j0(a,i){do{var c=iT(a.alternate,a);if(c!==null){c.flags&=32767,nt=c;return}if(c=a.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!i&&(a=a.sibling,a!==null)){nt=a;return}nt=a=c}while(a!==null);Zt=6,nt=null}function C0(a,i,c,p,v,x,N,z,Y){a.cancelPendingCommit=null;do eu();while(un!==0);if((vt&6)!==0)throw Error(r(327));if(i!==null){if(i===a.current)throw Error(r(177));if(x=i.lanes|i.childLanes,x|=wp,Me(a,c,x,N,z,Y),a===Nt&&(nt=Nt=null,st=0),Is=i,si=a,Rr=c,Rf=x,_f=v,h0=p,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,vT(ee,function(){return R0(),null})):(a.callbackNode=null,a.callbackPriority=0),p=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||p){p=q.T,q.T=null,v=V.p,V.p=2,N=vt,vt|=4;try{sT(a,i,c)}finally{vt=N,V.p=v,q.T=p}}un=1,N0(),E0(),T0()}}function N0(){if(un===1){un=0;var a=si,i=Is,c=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||c){c=q.T,q.T=null;var p=V.p;V.p=2;var v=vt;vt|=4;try{s0(i,a);var x=Vf,N=py(a.containerInfo),z=x.focusedElem,Y=x.selectionRange;if(N!==z&&z&&z.ownerDocument&&dy(z.ownerDocument.documentElement,z)){if(Y!==null&&gp(z)){var re=Y.start,pe=Y.end;if(pe===void 0&&(pe=re),"selectionStart"in z)z.selectionStart=re,z.selectionEnd=Math.min(pe,z.value.length);else{var me=z.ownerDocument||document,se=me&&me.defaultView||window;if(se.getSelection){var oe=se.getSelection(),Ae=z.textContent.length,Be=Math.min(Y.start,Ae),jt=Y.end===void 0?Be:Math.min(Y.end,Ae);!oe.extend&&Be>jt&&(N=jt,jt=Be,Be=N);var te=uy(z,Be),J=uy(z,jt);if(te&&J&&(oe.rangeCount!==1||oe.anchorNode!==te.node||oe.anchorOffset!==te.offset||oe.focusNode!==J.node||oe.focusOffset!==J.offset)){var ae=me.createRange();ae.setStart(te.node,te.offset),oe.removeAllRanges(),Be>jt?(oe.addRange(ae),oe.extend(J.node,J.offset)):(ae.setEnd(J.node,J.offset),oe.addRange(ae))}}}}for(me=[],oe=z;oe=oe.parentNode;)oe.nodeType===1&&me.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<me.length;z++){var fe=me[z];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}pu=!!Gf,Vf=Gf=null}finally{vt=v,V.p=p,q.T=c}}a.current=i,un=2}}function E0(){if(un===2){un=0;var a=si,i=Is,c=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||c){c=q.T,q.T=null;var p=V.p;V.p=2;var v=vt;vt|=4;try{t0(a,i.alternate,i)}finally{vt=v,V.p=p,q.T=c}}un=3}}function T0(){if(un===4||un===3){un=0,Ht();var a=si,i=Is,c=Rr,p=h0;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?un=5:(un=0,Is=si=null,A0(a,a.pendingLanes));var v=a.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=q.T,v=V.p,V.p=2,q.T=null;try{for(var x=a.onRecoverableError,N=0;N<p.length;N++){var z=p[N];x(z.value,{componentStack:z.stack})}}finally{q.T=i,V.p=v}}(Rr&3)!==0&&eu(),Ya(a),v=a.pendingLanes,(c&261930)!==0&&(v&42)!==0?a===Of?tl++:(tl=0,Of=a):tl=0,nl(0)}}function A0(a,i){(a.pooledCacheLanes&=i)===0&&(i=a.pooledCache,i!=null&&(a.pooledCache=null,Do(i)))}function eu(){return N0(),E0(),T0(),R0()}function R0(){if(un!==5)return!1;var a=si,i=Rf;Rf=0;var c=Je(Rr),p=q.T,v=V.p;try{V.p=32>c?32:c,q.T=null,c=_f,_f=null;var x=si,N=Rr;if(un=0,Is=si=null,Rr=0,(vt&6)!==0)throw Error(r(331));var z=vt;if(vt|=4,d0(x.current),l0(x,x.current,N,c),vt=z,nl(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(Ce,x)}catch{}return!0}finally{V.p=v,q.T=p,A0(a,i)}}function _0(a,i,c){i=ba(c,i),i=uf(a.stateNode,i,2),a=Jr(a,i,2),a!==null&&(ge(a,2),Ya(a))}function wt(a,i,c){if(a.tag===3)_0(a,a,c);else for(;i!==null;){if(i.tag===3){_0(i,a,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))){a=ba(c,a),c=Ob(2),p=Jr(i,c,2),p!==null&&(Lb(c,p,i,a),ge(p,2),Ya(p));break}}i=i.return}}function zf(a,i,c){var p=a.pingCache;if(p===null){p=a.pingCache=new cT;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)||(Ef=!0,v.add(c),a=hT.bind(null,a,i,c),i.then(a,a))}function hT(a,i,c){var p=a.pingCache;p!==null&&p.delete(i),a.pingedLanes|=a.suspendedLanes&c,a.warmLanes&=~c,Nt===a&&(st&c)===c&&(Zt===4||Zt===3&&(st&62914560)===st&&300>ut()-Zc?(vt&2)===0&&Ps(a,0):Tf|=c,$s===st&&($s=0)),Ya(a)}function O0(a,i){i===0&&(i=qr()),a=Ai(a,i),a!==null&&(ge(a,i),Ya(a))}function mT(a){var i=a.memoizedState,c=0;i!==null&&(c=i.retryLane),O0(a,c)}function gT(a,i){var c=0;switch(a.tag){case 31:case 13:var p=a.stateNode,v=a.memoizedState;v!==null&&(c=v.retryLane);break;case 19:p=a.stateNode;break;case 22:p=a.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(i),O0(a,c)}function vT(a,i){return _t(a,i)}var tu=null,Bs=null,Df=!1,nu=!1,$f=!1,li=0;function Ya(a){a!==Bs&&a.next===null&&(Bs===null?tu=Bs=a:Bs=Bs.next=a),nu=!0,Df||(Df=!0,bT())}function nl(a,i){if(!$f&&nu){$f=!0;do for(var c=!1,p=tu;p!==null;){if(a!==0){var v=p.pendingLanes;if(v===0)var x=0;else{var N=p.suspendedLanes,z=p.pingedLanes;x=(1<<31-Ne(42|a)+1)-1,x&=v&~(N&~z),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,D0(p,x))}else x=st,x=qa(p,p===Nt?x:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(x&3)===0||cr(p,x)||(c=!0,D0(p,x));p=p.next}while(c);$f=!1}}function yT(){L0()}function L0(){nu=Df=!1;var a=0;li!==0&&AT()&&(a=li);for(var i=ut(),c=null,p=tu;p!==null;){var v=p.next,x=M0(p,i);x===0?(p.next=null,c===null?tu=v:c.next=v,v===null&&(Bs=c)):(c=p,(a!==0||(x&3)!==0)&&(nu=!0)),p=v}un!==0&&un!==5||nl(a),li!==0&&(li=0)}function M0(a,i){for(var c=a.suspendedLanes,p=a.pingedLanes,v=a.expirationTimes,x=a.pendingLanes&-62914561;0<x;){var N=31-Ne(x),z=1<<N,Y=v[N];Y===-1?((z&c)===0||(z&p)!==0)&&(v[N]=ic(z,i)):Y<=i&&(a.expiredLanes|=z),x&=~z}if(i=Nt,c=st,c=qa(a,a===i?c:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p=a.callbackNode,c===0||a===i&&(xt===2||xt===9)||a.cancelPendingCommit!==null)return p!==null&&p!==null&&Dt(p),a.callbackNode=null,a.callbackPriority=0;if((c&3)===0||cr(a,c)){if(i=c&-c,i===a.callbackPriority)return i;switch(p!==null&&Dt(p),Je(c)){case 2:case 8:c=Z;break;case 32:c=ee;break;case 268435456:c=he;break;default:c=ee}return p=z0.bind(null,a),c=_t(c,p),a.callbackPriority=i,a.callbackNode=c,i}return p!==null&&p!==null&&Dt(p),a.callbackPriority=2,a.callbackNode=null,2}function z0(a,i){if(un!==0&&un!==5)return a.callbackNode=null,a.callbackPriority=0,null;var c=a.callbackNode;if(eu()&&a.callbackNode!==c)return null;var p=st;return p=qa(a,a===Nt?p:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p===0?null:(g0(a,p,i),M0(a,ut()),a.callbackNode!=null&&a.callbackNode===c?z0.bind(null,a):null)}function D0(a,i){if(eu())return null;g0(a,i,!0)}function bT(){_T(function(){(vt&6)!==0?_t(Q,yT):L0()})}function If(){if(li===0){var a=Ns;a===0&&(a=ua,ua<<=1,(ua&261888)===0&&(ua=256)),li=a}return li}function $0(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:uc(""+a)}function I0(a,i){var c=i.ownerDocument.createElement("input");return c.name=i.name,c.value=i.value,a.id&&c.setAttribute("form",a.id),i.parentNode.insertBefore(c,i),a=new FormData(a),c.parentNode.removeChild(c),a}function xT(a,i,c,p,v){if(i==="submit"&&c&&c.stateNode===v){var x=$0((v[cn]||null).action),N=p.submitter;N&&(i=(i=N[cn]||null)?$0(i.formAction):N.getAttribute("formAction"),i!==null&&(x=i,N=null));var z=new hc("action","action",null,p,v);a.push({event:z,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(li!==0){var Y=N?I0(v,N):new FormData(v);af(c,{pending:!0,data:Y,method:v.method,action:x},null,Y)}}else typeof x=="function"&&(z.preventDefault(),Y=N?I0(v,N):new FormData(v),af(c,{pending:!0,data:Y,method:v.method,action:x},x,Y))},currentTarget:v}]})}}for(var Pf=0;Pf<xp.length;Pf++){var Uf=xp[Pf],wT=Uf.toLowerCase(),kT=Uf[0].toUpperCase()+Uf.slice(1);La(wT,"on"+kT)}La(my,"onAnimationEnd"),La(gy,"onAnimationIteration"),La(vy,"onAnimationStart"),La("dblclick","onDoubleClick"),La("focusin","onFocus"),La("focusout","onBlur"),La(IE,"onTransitionRun"),La(PE,"onTransitionStart"),La(UE,"onTransitionCancel"),La(yy,"onTransitionEnd"),fr("onMouseEnter",["mouseout","mouseover"]),fr("onMouseLeave",["mouseout","mouseover"]),fr("onPointerEnter",["pointerout","pointerover"]),fr("onPointerLeave",["pointerout","pointerover"]),ha("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ha("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ha("onBeforeInput",["compositionend","keypress","textInput","paste"]),ha("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ha("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ha("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var al="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(" "),ST=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(al));function P0(a,i){i=(i&4)!==0;for(var c=0;c<a.length;c++){var p=a[c],v=p.event;p=p.listeners;e:{var x=void 0;if(i)for(var N=p.length-1;0<=N;N--){var z=p[N],Y=z.instance,re=z.currentTarget;if(z=z.listener,Y!==x&&v.isPropagationStopped())break e;x=z,v.currentTarget=re;try{x(v)}catch(pe){vc(pe)}v.currentTarget=null,x=Y}else for(N=0;N<p.length;N++){if(z=p[N],Y=z.instance,re=z.currentTarget,z=z.listener,Y!==x&&v.isPropagationStopped())break e;x=z,v.currentTarget=re;try{x(v)}catch(pe){vc(pe)}v.currentTarget=null,x=Y}}}}function at(a,i){var c=i[dr];c===void 0&&(c=i[dr]=new Set);var p=a+"__bubble";c.has(p)||(U0(i,a,2,!1),c.add(p))}function Bf(a,i,c){var p=0;i&&(p|=4),U0(c,a,p,i)}var au="_reactListening"+Math.random().toString(36).slice(2);function Ff(a){if(!a[au]){a[au]=!0,jo.forEach(function(c){c!=="selectionchange"&&(ST.has(c)||Bf(c,!1,a),Bf(c,!0,a))});var i=a.nodeType===9?a:a.ownerDocument;i===null||i[au]||(i[au]=!0,Bf("selectionchange",!1,i))}}function U0(a,i,c,p){switch(mx(i)){case 2:var v=QT;break;case 8:v=XT;break;default:v=ah}c=v.bind(null,i,c,a),v=void 0,!op||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(v=!0),p?v!==void 0?a.addEventListener(i,c,{capture:!0,passive:v}):a.addEventListener(i,c,!0):v!==void 0?a.addEventListener(i,c,{passive:v}):a.addEventListener(i,c,!1)}function Hf(a,i,c,p,v){var x=p;if((i&1)===0&&(i&2)===0&&p!==null)e:for(;;){if(p===null)return;var N=p.tag;if(N===3||N===4){var z=p.stateNode.containerInfo;if(z===v)break;if(N===4)for(N=p.return;N!==null;){var Y=N.tag;if((Y===3||Y===4)&&N.stateNode.containerInfo===v)return;N=N.return}for(;z!==null;){if(N=mn(z),N===null)return;if(Y=N.tag,Y===5||Y===6||Y===26||Y===27){p=x=N;continue e}z=z.parentNode}}p=p.return}Gv(function(){var re=x,pe=ip(c),me=[];e:{var se=by.get(a);if(se!==void 0){var oe=hc,Ae=a;switch(a){case"keypress":if(pc(c)===0)break e;case"keydown":case"keyup":oe=gE;break;case"focusin":Ae="focus",oe=dp;break;case"focusout":Ae="blur",oe=dp;break;case"beforeblur":case"afterblur":oe=dp;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=Zv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=rE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=bE;break;case my:case gy:case vy:oe=oE;break;case yy:oe=wE;break;case"scroll":case"scrollend":oe=nE;break;case"wheel":oe=SE;break;case"copy":case"cut":case"paste":oe=cE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=Kv;break;case"toggle":case"beforetoggle":oe=CE}var Be=(i&4)!==0,jt=!Be&&(a==="scroll"||a==="scrollend"),te=Be?se!==null?se+"Capture":null:se;Be=[];for(var J=re,ae;J!==null;){var fe=J;if(ae=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ae===null||te===null||(fe=Co(J,te),fe!=null&&Be.push(rl(J,fe,ae))),jt)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=a==="mouseover"||a==="pointerover",oe=a==="mouseout"||a==="pointerout",se&&c!==rp&&(Ae=c.relatedTarget||c.fromElement)&&(mn(Ae)||Ae[ur]))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=re,Ae=Ae?mn(Ae):null,Ae!==null&&(jt=l(Ae),Be=Ae.tag,Ae!==jt||Be!==5&&Be!==27&&Be!==6)&&(Ae=null)):(oe=null,Ae=re),oe!==Ae)){if(Be=Zv,fe="onMouseLeave",te="onMouseEnter",J="mouse",(a==="pointerout"||a==="pointerover")&&(Be=Kv,fe="onPointerLeave",te="onPointerEnter",J="pointer"),jt=oe==null?se:pr(oe),ae=Ae==null?se:pr(Ae),se=new Be(fe,J+"leave",oe,c,pe),se.target=jt,se.relatedTarget=ae,fe=null,mn(pe)===re&&(Be=new Be(te,J+"enter",Ae,c,pe),Be.target=ae,Be.relatedTarget=jt,fe=Be),jt=fe,oe&&Ae)t:{for(Be=jT,te=oe,J=Ae,ae=0,fe=te;fe;fe=Be(fe))ae++;fe=0;for(var De=J;De;De=Be(De))fe++;for(;0<ae-fe;)te=Be(te),ae--;for(;0<fe-ae;)J=Be(J),fe--;for(;ae--;){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&&B0(me,se,oe,Be,!1),Ae!==null&&jt!==null&&B0(me,jt,Ae,Be,!0)}}e:{if(se=re?pr(re):window,oe=se.nodeName&&se.nodeName.toLowerCase(),oe==="select"||oe==="input"&&se.type==="file")var ht=ry;else if(ny(se))if(iy)ht=zE;else{ht=LE;var _e=OE}else oe=se.nodeName,!oe||oe.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?re&&ap(re.elementType)&&(ht=ry):ht=ME;if(ht&&(ht=ht(a,re))){ay(me,ht,c,pe);break e}_e&&_e(a,se,re),a==="focusout"&&re&&se.type==="number"&&re.memoizedProps.value!=null&&np(se,"number",se.value)}switch(_e=re?pr(re):window,a){case"focusin":(ny(_e)||_e.contentEditable==="true")&&(ys=_e,vp=re,Lo=null);break;case"focusout":Lo=vp=ys=null;break;case"mousedown":yp=!0;break;case"contextmenu":case"mouseup":case"dragend":yp=!1,fy(me,c,pe);break;case"selectionchange":if($E)break;case"keydown":case"keyup":fy(me,c,pe)}var Qe;if(fp)e:{switch(a){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else vs?ey(a,c)&&(ot="onCompositionEnd"):a==="keydown"&&c.keyCode===229&&(ot="onCompositionStart");ot&&(Qv&&c.locale!=="ko"&&(vs||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&vs&&(Qe=Vv()):(Vr=pe,lp="value"in Vr?Vr.value:Vr.textContent,vs=!0)),_e=ru(re,ot),0<_e.length&&(ot=new Yv(ot,a,null,c,pe),me.push({event:ot,listeners:_e}),Qe?ot.data=Qe:(Qe=ty(c),Qe!==null&&(ot.data=Qe)))),(Qe=EE?TE(a,c):AE(a,c))&&(ot=ru(re,"onBeforeInput"),0<ot.length&&(_e=new Yv("onBeforeInput","beforeinput",null,c,pe),me.push({event:_e,listeners:ot}),_e.data=Qe)),xT(me,a,re,c,pe)}P0(me,i)})}function rl(a,i,c){return{instance:a,listener:i,currentTarget:c}}function ru(a,i){for(var c=i+"Capture",p=[];a!==null;){var v=a,x=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||x===null||(v=Co(a,c),v!=null&&p.unshift(rl(a,v,x)),v=Co(a,i),v!=null&&p.push(rl(a,v,x))),a.tag===3)return p;a=a.return}return[]}function jT(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function B0(a,i,c,p,v){for(var x=i._reactName,N=[];c!==null&&c!==p;){var z=c,Y=z.alternate,re=z.stateNode;if(z=z.tag,Y!==null&&Y===p)break;z!==5&&z!==26&&z!==27||re===null||(Y=re,v?(re=Co(c,x),re!=null&&N.unshift(rl(c,re,Y))):v||(re=Co(c,x),re!=null&&N.push(rl(c,re,Y)))),c=c.return}N.length!==0&&a.push({event:i,listeners:N})}var CT=/\r\n?/g,NT=/\u0000|\uFFFD/g;function F0(a){return(typeof a=="string"?a:""+a).replace(CT,`
50
+ `).replace(NT,"")}function H0(a,i){return i=F0(i),F0(a)===i}function St(a,i,c,p,v,x){switch(c){case"children":typeof p=="string"?i==="body"||i==="textarea"&&p===""||hs(a,p):(typeof p=="number"||typeof p=="bigint")&&i!=="body"&&hs(a,""+p);break;case"className":lc(a,"class",p);break;case"tabIndex":lc(a,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":lc(a,c,p);break;case"style":Hv(a,p,x);break;case"data":if(i!=="object"){lc(a,"data",p);break}case"src":case"href":if(p===""&&(i!=="a"||c!=="href")){a.removeAttribute(c);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(c);break}p=uc(""+p),a.setAttribute(c,p);break;case"action":case"formAction":if(typeof p=="function"){a.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"&&St(a,i,"name",v.name,v,null),St(a,i,"formEncType",v.formEncType,v,null),St(a,i,"formMethod",v.formMethod,v,null),St(a,i,"formTarget",v.formTarget,v,null)):(St(a,i,"encType",v.encType,v,null),St(a,i,"method",v.method,v,null),St(a,i,"target",v.target,v,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(c);break}p=uc(""+p),a.setAttribute(c,p);break;case"onClick":p!=null&&(a.onclick=mr);break;case"onScroll":p!=null&&at("scroll",a);break;case"onScrollEnd":p!=null&&at("scrollend",a);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(c=p.__html,c!=null){if(v.children!=null)throw Error(r(60));a.innerHTML=c}}break;case"multiple":a.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":a.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"){a.removeAttribute("xlink:href");break}c=uc(""+p),a.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"?a.setAttribute(c,""+p):a.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"?a.setAttribute(c,""):a.removeAttribute(c);break;case"capture":case"download":p===!0?a.setAttribute(c,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(c,p):a.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?a.setAttribute(c,p):a.removeAttribute(c);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?a.removeAttribute(c):a.setAttribute(c,p);break;case"popover":at("beforetoggle",a),at("toggle",a),oc(a,"popover",p);break;case"xlinkActuate":hr(a,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":hr(a,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":hr(a,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":hr(a,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":hr(a,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":hr(a,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":hr(a,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":hr(a,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":hr(a,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":oc(a,"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=eE.get(c)||c,oc(a,c,p))}}function qf(a,i,c,p,v,x){switch(c){case"style":Hv(a,p,x);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(c=p.__html,c!=null){if(v.children!=null)throw Error(r(60));a.innerHTML=c}}break;case"children":typeof p=="string"?hs(a,p):(typeof p=="number"||typeof p=="bigint")&&hs(a,""+p);break;case"onScroll":p!=null&&at("scroll",a);break;case"onScrollEnd":p!=null&&at("scrollend",a);break;case"onClick":p!=null&&(a.onclick=mr);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=a[cn]||null,x=x!=null?x[c]:null,typeof x=="function"&&a.removeEventListener(i,x,v),typeof p=="function")){typeof x!="function"&&x!==null&&(c in a?a[c]=null:a.hasAttribute(c)&&a.removeAttribute(c)),a.addEventListener(i,p,v);break e}c in a?a[c]=p:p===!0?a.setAttribute(c,""):oc(a,c,p)}}}function kn(a,i,c){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",a),at("load",a);var p=!1,v=!1,x;for(x in c)if(c.hasOwnProperty(x)){var N=c[x];if(N!=null)switch(x){case"src":p=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:St(a,i,x,N,c,null)}}v&&St(a,i,"srcSet",c.srcSet,c,null),p&&St(a,i,"src",c.src,c,null);return;case"input":at("invalid",a);var z=x=N=v=null,Y=null,re=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":N=pe;break;case"checked":Y=pe;break;case"defaultChecked":re=pe;break;case"value":x=pe;break;case"defaultValue":z=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(r(137,i));break;default:St(a,i,p,pe,c,null)}}Pv(a,x,z,Y,re,N,v,!1);return;case"select":at("invalid",a),p=N=x=null;for(v in c)if(c.hasOwnProperty(v)&&(z=c[v],z!=null))switch(v){case"value":x=z;break;case"defaultValue":N=z;break;case"multiple":p=z;default:St(a,i,v,z,c,null)}i=x,c=N,a.multiple=!!p,i!=null?fs(a,!!p,i,!1):c!=null&&fs(a,!!p,c,!0);return;case"textarea":at("invalid",a),x=v=p=null;for(N in c)if(c.hasOwnProperty(N)&&(z=c[N],z!=null))switch(N){case"value":p=z;break;case"defaultValue":v=z;break;case"children":x=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(91));break;default:St(a,i,N,z,c,null)}Bv(a,p,v,x);return;case"option":for(Y in c)if(c.hasOwnProperty(Y)&&(p=c[Y],p!=null))switch(Y){case"selected":a.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:St(a,i,Y,p,c,null)}return;case"dialog":at("beforetoggle",a),at("toggle",a),at("cancel",a),at("close",a);break;case"iframe":case"object":at("load",a);break;case"video":case"audio":for(p=0;p<al.length;p++)at(al[p],a);break;case"image":at("error",a),at("load",a);break;case"details":at("toggle",a);break;case"embed":case"source":case"link":at("error",a),at("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(re in c)if(c.hasOwnProperty(re)&&(p=c[re],p!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:St(a,i,re,p,c,null)}return;default:if(ap(i)){for(pe in c)c.hasOwnProperty(pe)&&(p=c[pe],p!==void 0&&qf(a,i,pe,p,c,void 0));return}}for(z in c)c.hasOwnProperty(z)&&(p=c[z],p!=null&&St(a,i,z,p,c,null))}function ET(a,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,N=null,z=null,Y=null,re=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":Y=me;default:p.hasOwnProperty(oe)||St(a,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":re=oe;break;case"defaultChecked":pe=oe;break;case"value":N=oe;break;case"defaultValue":z=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(r(137,i));break;default:oe!==me&&St(a,i,se,oe,p,me)}}tp(a,N,z,Y,re,pe,x,v);return;case"select":oe=N=z=se=null;for(x in c)if(Y=c[x],c.hasOwnProperty(x)&&Y!=null)switch(x){case"value":break;case"multiple":oe=Y;default:p.hasOwnProperty(x)||St(a,i,x,null,p,Y)}for(v in p)if(x=p[v],Y=c[v],p.hasOwnProperty(v)&&(x!=null||Y!=null))switch(v){case"value":se=x;break;case"defaultValue":z=x;break;case"multiple":N=x;default:x!==Y&&St(a,i,v,x,p,Y)}i=z,c=N,p=oe,se!=null?fs(a,!!c,se,!1):!!p!=!!c&&(i!=null?fs(a,!!c,i,!0):fs(a,!!c,c?[]:"",!1));return;case"textarea":oe=se=null;for(z in c)if(v=c[z],c.hasOwnProperty(z)&&v!=null&&!p.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:St(a,i,z,null,p,v)}for(N in p)if(v=p[N],x=c[N],p.hasOwnProperty(N)&&(v!=null||x!=null))switch(N){case"value":se=v;break;case"defaultValue":oe=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==x&&St(a,i,N,v,p,x)}Uv(a,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":a.selected=!1;break;default:St(a,i,Ae,null,p,se)}for(Y in p)if(se=p[Y],oe=c[Y],p.hasOwnProperty(Y)&&se!==oe&&(se!=null||oe!=null))switch(Y){case"selected":a.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:St(a,i,Y,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)&&St(a,i,Be,null,p,se);for(re in p)if(se=p[re],oe=c[re],p.hasOwnProperty(re)&&se!==oe&&(se!=null||oe!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,i));break;default:St(a,i,re,se,p,oe)}return;default:if(ap(i)){for(var jt in c)se=c[jt],c.hasOwnProperty(jt)&&se!==void 0&&!p.hasOwnProperty(jt)&&qf(a,i,jt,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||qf(a,i,pe,se,p,oe);return}}for(var te in c)se=c[te],c.hasOwnProperty(te)&&se!=null&&!p.hasOwnProperty(te)&&St(a,i,te,null,p,se);for(me in p)se=p[me],oe=c[me],!p.hasOwnProperty(me)||se===oe||se==null&&oe==null||St(a,i,me,se,p,oe)}function q0(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function TT(){if(typeof performance.getEntriesByType=="function"){for(var a=0,i=0,c=performance.getEntriesByType("resource"),p=0;p<c.length;p++){var v=c[p],x=v.transferSize,N=v.initiatorType,z=v.duration;if(x&&z&&q0(N)){for(N=0,z=v.responseEnd,p+=1;p<c.length;p++){var Y=c[p],re=Y.startTime;if(re>z)break;var pe=Y.transferSize,me=Y.initiatorType;pe&&q0(me)&&(Y=Y.responseEnd,N+=pe*(Y<z?1:(z-re)/(Y-re)))}if(--p,i+=8*(x+N)/(v.duration/1e3),a++,10<a)break}}if(0<a)return i/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var Gf=null,Vf=null;function iu(a){return a.nodeType===9?a:a.ownerDocument}function G0(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function V0(a,i){if(a===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&i==="foreignObject"?0:a}function Wf(a,i){return a==="textarea"||a==="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 Zf=null;function AT(){var a=window.event;return a&&a.type==="popstate"?a===Zf?!1:(Zf=a,!0):(Zf=null,!1)}var W0=typeof setTimeout=="function"?setTimeout:void 0,RT=typeof clearTimeout=="function"?clearTimeout:void 0,Z0=typeof Promise=="function"?Promise:void 0,_T=typeof queueMicrotask=="function"?queueMicrotask:typeof Z0<"u"?function(a){return Z0.resolve(null).then(a).catch(OT)}:W0;function OT(a){setTimeout(function(){throw a})}function ci(a){return a==="head"}function Y0(a,i){var c=i,p=0;do{var v=c.nextSibling;if(a.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"||c==="/&"){if(p===0){a.removeChild(v),Gs(i);return}p--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")p++;else if(c==="html")il(a.ownerDocument.documentElement);else if(c==="head"){c=a.ownerDocument.head,il(c);for(var x=c.firstChild;x;){var N=x.nextSibling,z=x.nodeName;x[Oa]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=N}}else c==="body"&&il(a.ownerDocument.body);c=v}while(c);Gs(i)}function K0(a,i){var c=a;a=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(a===0)break;a--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||a++;c=p}while(c)}function Yf(a){var i=a.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":Yf(c),Gr(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}a.removeChild(c)}}function LT(a,i,c,p){for(;a.nodeType===1;){var v=c;if(a.nodeName.toLowerCase()!==i.toLowerCase()){if(!p&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(p){if(!a[Oa])switch(i){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(x=a.getAttribute("rel"),x==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(x!==v.rel||a.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||a.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||a.getAttribute("title")!==(v.title==null?null:v.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(x=a.getAttribute("src"),(x!==(v.src==null?null:v.src)||a.getAttribute("type")!==(v.type==null?null:v.type)||a.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&x&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(i==="input"&&a.type==="hidden"){var x=v.name==null?null:""+v.name;if(v.type==="hidden"&&a.getAttribute("name")===x)return a}else return a;if(a=ja(a.nextSibling),a===null)break}return null}function MT(a,i,c){if(i==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!c||(a=ja(a.nextSibling),a===null))return null;return a}function Q0(a,i){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!i||(a=ja(a.nextSibling),a===null))return null;return a}function Kf(a){return a.data==="$?"||a.data==="$~"}function Qf(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function zT(a,i){var c=a.ownerDocument;if(a.data==="$~")a._reactRetry=i;else if(a.data!=="$?"||c.readyState!=="loading")i();else{var p=function(){i(),c.removeEventListener("DOMContentLoaded",p)};c.addEventListener("DOMContentLoaded",p),a._reactRetry=p}}function ja(a){for(;a!=null;a=a.nextSibling){var i=a.nodeType;if(i===1||i===3)break;if(i===8){if(i=a.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return a}var Xf=null;function X0(a){a=a.nextSibling;for(var i=0;a;){if(a.nodeType===8){var c=a.data;if(c==="/$"||c==="/&"){if(i===0)return ja(a.nextSibling);i--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||i++}a=a.nextSibling}return null}function J0(a){a=a.previousSibling;for(var i=0;a;){if(a.nodeType===8){var c=a.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(i===0)return a;i--}else c!=="/$"&&c!=="/&"||i++}a=a.previousSibling}return null}function ex(a,i,c){switch(i=iu(c),a){case"html":if(a=i.documentElement,!a)throw Error(r(452));return a;case"head":if(a=i.head,!a)throw Error(r(453));return a;case"body":if(a=i.body,!a)throw Error(r(454));return a;default:throw Error(r(451))}}function il(a){for(var i=a.attributes;i.length;)a.removeAttributeNode(i[0]);Gr(a)}var Ca=new Map,tx=new Set;function su(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var _r=V.d;V.d={f:DT,r:$T,D:IT,C:PT,L:UT,m:BT,X:HT,S:FT,M:qT};function DT(){var a=_r.f(),i=Qc();return a||i}function $T(a){var i=Nn(a);i!==null&&i.tag===5&&i.type==="form"?yb(i):_r.r(a)}var Fs=typeof document>"u"?null:document;function nx(a,i,c){var p=Fs;if(p&&typeof i=="string"&&i){var v=va(i);v='link[rel="'+a+'"][href="'+v+'"]',typeof c=="string"&&(v+='[crossorigin="'+c+'"]'),tx.has(v)||(tx.add(v),a={rel:a,crossOrigin:c,href:i},p.querySelector(v)===null&&(i=p.createElement("link"),kn(i,"link",a),Ot(i),p.head.appendChild(i)))}}function IT(a){_r.D(a),nx("dns-prefetch",a,null)}function PT(a,i){_r.C(a,i),nx("preconnect",a,i)}function UT(a,i,c){_r.L(a,i,c);var p=Fs;if(p&&a&&i){var v='link[rel="preload"][as="'+va(i)+'"]';i==="image"&&c&&c.imageSrcSet?(v+='[imagesrcset="'+va(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(v+='[imagesizes="'+va(c.imageSizes)+'"]')):v+='[href="'+va(a)+'"]';var x=v;switch(i){case"style":x=Hs(a);break;case"script":x=qs(a)}Ca.has(x)||(a=m({rel:"preload",href:i==="image"&&c&&c.imageSrcSet?void 0:a,as:i},c),Ca.set(x,a),p.querySelector(v)!==null||i==="style"&&p.querySelector(sl(x))||i==="script"&&p.querySelector(ol(x))||(i=p.createElement("link"),kn(i,"link",a),Ot(i),p.head.appendChild(i)))}}function BT(a,i){_r.m(a,i);var c=Fs;if(c&&a){var p=i&&typeof i.as=="string"?i.as:"script",v='link[rel="modulepreload"][as="'+va(p)+'"][href="'+va(a)+'"]',x=v;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=qs(a)}if(!Ca.has(x)&&(a=m({rel:"modulepreload",href:a},i),Ca.set(x,a),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",a),Ot(p),c.head.appendChild(p)}}}function FT(a,i,c){_r.S(a,i,c);var p=Fs;if(p&&a){var v=fa(p).hoistableStyles,x=Hs(a);i=i||"default";var N=v.get(x);if(!N){var z={loading:0,preload:null};if(N=p.querySelector(sl(x)))z.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":i},c),(c=Ca.get(x))&&Jf(a,c);var Y=N=p.createElement("link");Ot(Y),kn(Y,"link",a),Y._p=new Promise(function(re,pe){Y.onload=re,Y.onerror=pe}),Y.addEventListener("load",function(){z.loading|=1}),Y.addEventListener("error",function(){z.loading|=2}),z.loading|=4,ou(N,i,p)}N={type:"stylesheet",instance:N,count:1,state:z},v.set(x,N)}}}function HT(a,i){_r.X(a,i);var c=Fs;if(c&&a){var p=fa(c).hoistableScripts,v=qs(a),x=p.get(v);x||(x=c.querySelector(ol(v)),x||(a=m({src:a,async:!0},i),(i=Ca.get(v))&&eh(a,i),x=c.createElement("script"),Ot(x),kn(x,"link",a),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(v,x))}}function qT(a,i){_r.M(a,i);var c=Fs;if(c&&a){var p=fa(c).hoistableScripts,v=qs(a),x=p.get(v);x||(x=c.querySelector(ol(v)),x||(a=m({src:a,async:!0,type:"module"},i),(i=Ca.get(v))&&eh(a,i),x=c.createElement("script"),Ot(x),kn(x,"link",a),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(v,x))}}function ax(a,i,c,p){var v=(v=le.current)?su(v):null;if(!v)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(i=Hs(c.href),c=fa(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"){a=Hs(c.href);var x=fa(v).hoistableStyles,N=x.get(a);if(N||(v=v.ownerDocument||v,N={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(a,N),(x=v.querySelector(sl(a)))&&!x._p&&(N.instance=x,N.state.loading=5),Ca.has(a)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Ca.set(a,c),x||GT(v,a,c,N.state))),i&&p===null)throw Error(r(528,""));return N}if(i&&p!==null)throw Error(r(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=fa(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(r(444,a))}}function Hs(a){return'href="'+va(a)+'"'}function sl(a){return'link[rel="stylesheet"]['+a+"]"}function rx(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function GT(a,i,c,p){a.querySelector('link[rel="preload"][as="style"]['+i+"]")?p.loading=1:(i=a.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),Ot(i),a.head.appendChild(i))}function qs(a){return'[src="'+va(a)+'"]'}function ol(a){return"script[async]"+a}function ix(a,i,c){if(i.count++,i.instance===null)switch(i.type){case"style":var p=a.querySelector('style[data-href~="'+va(c.href)+'"]');if(p)return i.instance=p,Ot(p),p;var v=m({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return p=(a.ownerDocument||a).createElement("style"),Ot(p),kn(p,"style",v),ou(p,c.precedence,a),i.instance=p;case"stylesheet":v=Hs(c.href);var x=a.querySelector(sl(v));if(x)return i.state.loading|=4,i.instance=x,Ot(x),x;p=rx(c),(v=Ca.get(v))&&Jf(p,v),x=(a.ownerDocument||a).createElement("link"),Ot(x);var N=x;return N._p=new Promise(function(z,Y){N.onload=z,N.onerror=Y}),kn(x,"link",p),i.state.loading|=4,ou(x,c.precedence,a),i.instance=x;case"script":return x=qs(c.src),(v=a.querySelector(ol(x)))?(i.instance=v,Ot(v),v):(p=c,(v=Ca.get(x))&&(p=m({},c),eh(p,v)),a=a.ownerDocument||a,v=a.createElement("script"),Ot(v),kn(v,"link",p),a.head.appendChild(v),i.instance=v);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(p=i.instance,i.state.loading|=4,ou(p,c.precedence,a));return i.instance}function ou(a,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,N=0;N<p.length;N++){var z=p[N];if(z.dataset.precedence===i)x=z;else if(x!==v)break}x?x.parentNode.insertBefore(a,x.nextSibling):(i=c.nodeType===9?c.head:c,i.insertBefore(a,i.firstChild))}function Jf(a,i){a.crossOrigin==null&&(a.crossOrigin=i.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=i.referrerPolicy),a.title==null&&(a.title=i.title)}function eh(a,i){a.crossOrigin==null&&(a.crossOrigin=i.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=i.referrerPolicy),a.integrity==null&&(a.integrity=i.integrity)}var lu=null;function sx(a,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(a))return p;for(p.set(a,null),c=c.getElementsByTagName(a),v=0;v<c.length;v++){var x=c[v];if(!(x[Oa]||x[qt]||a==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var N=x.getAttribute(i)||"";N=a+N;var z=p.get(N);z?z.push(x):p.set(N,[x])}}return p}function ox(a,i,c){a=a.ownerDocument||a,a.head.insertBefore(c,i==="title"?a.querySelector("head > title"):null)}function VT(a,i,c){if(c===1||i.itemProp!=null)return!1;switch(a){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 a=i.disabled,typeof i.precedence=="string"&&a==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 lx(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function WT(a,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"&&(a.count++,a=cu.bind(a),i.then(a,a)),c.state.loading|=4,c.instance=x,Ot(x);return}x=i.ownerDocument||i,p=rx(p),(v=Ca.get(v))&&Jf(p,v),x=x.createElement("link"),Ot(x);var N=x;N._p=new Promise(function(z,Y){N.onload=z,N.onerror=Y}),kn(x,"link",p),c.instance=x}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(c,i),(i=c.state.preload)&&(c.state.loading&3)===0&&(a.count++,c=cu.bind(a),i.addEventListener("load",c),i.addEventListener("error",c))}}var th=0;function ZT(a,i){return a.stylesheets&&a.count===0&&du(a,a.stylesheets),0<a.count||0<a.imgCount?function(c){var p=setTimeout(function(){if(a.stylesheets&&du(a,a.stylesheets),a.unsuspend){var x=a.unsuspend;a.unsuspend=null,x()}},6e4+i);0<a.imgBytes&&th===0&&(th=62500*TT());var v=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&du(a,a.stylesheets),a.unsuspend)){var x=a.unsuspend;a.unsuspend=null,x()}},(a.imgBytes>th?50:800)+i);return a.unsuspend=c,function(){a.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 a=this.unsuspend;this.unsuspend=null,a()}}}var uu=null;function du(a,i){a.stylesheets=null,a.unsuspend!==null&&(a.count++,uu=new Map,i.forEach(YT,a),uu=null,cu.call(a))}function YT(a,i){if(!(i.state.loading&4)){var c=uu.get(a);if(c)var p=c.get(null);else{c=new Map,uu.set(a,c);for(var v=a.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<v.length;x++){var N=v[x];(N.nodeName==="LINK"||N.getAttribute("media")!=="not all")&&(c.set(N.dataset.precedence,N),p=N)}p&&c.set(null,p)}v=i.instance,N=v.getAttribute("data-precedence"),x=c.get(N)||p,x===p&&c.set(null,v),c.set(N,v),this.count++,p=cu.bind(this),v.addEventListener("load",p),v.addEventListener("error",p),x?x.parentNode.insertBefore(v,x.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(v,a.firstChild)),i.state.loading|=4}}var ll={$$typeof:E,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function KT(a,i,c,p,v,x,N,z,Y){this.tag=1,this.containerInfo=a,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=N,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function cx(a,i,c,p,v,x,N,z,Y,re,pe,me){return a=new KT(a,i,c,N,Y,re,pe,me,z),i=1,x===!0&&(i|=24),x=Kn(3,null,null,i),a.current=x,x.stateNode=a,i=Lp(),i.refCount++,a.pooledCache=i,i.refCount++,x.memoizedState={element:p,isDehydrated:c,cache:i},$p(x),a}function ux(a){return a?(a=ws,a):ws}function dx(a,i,c,p,v,x){v=ux(v),p.context===null?p.context=v:p.pendingContext=v,p=Xr(i),p.payload={element:c},x=x===void 0?null:x,x!==null&&(p.callback=x),c=Jr(a,p,i),c!==null&&(Fn(c,a,i),Uo(c,a,i))}function px(a,i){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var c=a.retryLane;a.retryLane=c!==0&&c<i?c:i}}function nh(a,i){px(a,i),(a=a.alternate)&&px(a,i)}function fx(a){if(a.tag===13||a.tag===31){var i=Ai(a,67108864);i!==null&&Fn(i,a,67108864),nh(a,67108864)}}function hx(a){if(a.tag===13||a.tag===31){var i=ta();i=tt(i);var c=Ai(a,i);c!==null&&Fn(c,a,i),nh(a,i)}}var pu=!0;function QT(a,i,c,p){var v=q.T;q.T=null;var x=V.p;try{V.p=2,ah(a,i,c,p)}finally{V.p=x,q.T=v}}function XT(a,i,c,p){var v=q.T;q.T=null;var x=V.p;try{V.p=8,ah(a,i,c,p)}finally{V.p=x,q.T=v}}function ah(a,i,c,p){if(pu){var v=rh(p);if(v===null)Hf(a,i,p,fu,c),gx(a,p);else if(eA(v,a,i,c,p))p.stopPropagation();else if(gx(a,p),i&4&&-1<JT.indexOf(a)){for(;v!==null;){var x=Nn(v);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var N=da(x.pendingLanes);if(N!==0){var z=x;for(z.pendingLanes|=2,z.entangledLanes|=2;N;){var Y=1<<31-Ne(N);z.entanglements[1]|=Y,N&=~Y}Ya(x),(vt&6)===0&&(Yc=ut()+500,nl(0))}}break;case 31:case 13:z=Ai(x,2),z!==null&&Fn(z,x,2),Qc(),nh(x,2)}if(x=rh(p),x===null&&Hf(a,i,p,fu,c),x===v)break;v=x}v!==null&&p.stopPropagation()}else Hf(a,i,p,null,c)}}function rh(a){return a=ip(a),ih(a)}var fu=null;function ih(a){if(fu=null,a=mn(a),a!==null){var i=l(a);if(i===null)a=null;else{var c=i.tag;if(c===13){if(a=u(i),a!==null)return a;a=null}else if(c===31){if(a=d(i),a!==null)return a;a=null}else if(c===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;a=null}else i!==a&&(a=null)}}return fu=a,null}function mx(a){switch(a){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 Z:return 8;case ee:case ce:return 32;case he:return 268435456;default:return 32}default:return 32}}var sh=!1,ui=null,di=null,pi=null,cl=new Map,ul=new Map,fi=[],JT="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 gx(a,i){switch(a){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(a,i,c,p,v,x){return a===null||a.nativeEvent!==x?(a={blockedOn:i,domEventName:c,eventSystemFlags:p,nativeEvent:x,targetContainers:[v]},i!==null&&(i=Nn(i),i!==null&&fx(i)),a):(a.eventSystemFlags|=p,i=a.targetContainers,v!==null&&i.indexOf(v)===-1&&i.push(v),a)}function eA(a,i,c,p,v){switch(i){case"focusin":return ui=dl(ui,a,i,c,p,v),!0;case"dragenter":return di=dl(di,a,i,c,p,v),!0;case"mouseover":return pi=dl(pi,a,i,c,p,v),!0;case"pointerover":var x=v.pointerId;return cl.set(x,dl(cl.get(x)||null,a,i,c,p,v)),!0;case"gotpointercapture":return x=v.pointerId,ul.set(x,dl(ul.get(x)||null,a,i,c,p,v)),!0}return!1}function vx(a){var i=mn(a.target);if(i!==null){var c=l(i);if(c!==null){if(i=c.tag,i===13){if(i=u(c),i!==null){a.blockedOn=i,pt(a.priority,function(){hx(c)});return}}else if(i===31){if(i=d(c),i!==null){a.blockedOn=i,pt(a.priority,function(){hx(c)});return}}else if(i===3&&c.stateNode.current.memoizedState.isDehydrated){a.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}a.blockedOn=null}function hu(a){if(a.blockedOn!==null)return!1;for(var i=a.targetContainers;0<i.length;){var c=rh(a.nativeEvent);if(c===null){c=a.nativeEvent;var p=new c.constructor(c.type,c);rp=p,c.target.dispatchEvent(p),rp=null}else return i=Nn(c),i!==null&&fx(i),a.blockedOn=c,!1;i.shift()}return!0}function yx(a,i,c){hu(a)&&c.delete(i)}function tA(){sh=!1,ui!==null&&hu(ui)&&(ui=null),di!==null&&hu(di)&&(di=null),pi!==null&&hu(pi)&&(pi=null),cl.forEach(yx),ul.forEach(yx)}function mu(a,i){a.blockedOn===i&&(a.blockedOn=null,sh||(sh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,tA)))}var gu=null;function bx(a){gu!==a&&(gu=a,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){gu===a&&(gu=null);for(var i=0;i<a.length;i+=3){var c=a[i],p=a[i+1],v=a[i+2];if(typeof p!="function"){if(ih(p||c)===null)continue;break}var x=Nn(c);x!==null&&(a.splice(i,3),i-=3,af(x,{pending:!0,data:v,method:c.method,action:p},p,v))}}))}function Gs(a){function i(Y){return mu(Y,a)}ui!==null&&mu(ui,a),di!==null&&mu(di,a),pi!==null&&mu(pi,a),cl.forEach(i),ul.forEach(i);for(var c=0;c<fi.length;c++){var p=fi[c];p.blockedOn===a&&(p.blockedOn=null)}for(;0<fi.length&&(c=fi[0],c.blockedOn===null);)vx(c),c.blockedOn===null&&fi.shift();if(c=(a.ownerDocument||a).$$reactFormReplay,c!=null)for(p=0;p<c.length;p+=3){var v=c[p],x=c[p+1],N=v[cn]||null;if(typeof x=="function")N||bx(c);else if(N){var z=null;if(x&&x.hasAttribute("formAction")){if(v=x,N=x[cn]||null)z=N.formAction;else if(ih(v)!==null)continue}else z=N.action;typeof z=="function"?c[p+1]=z:(c.splice(p,3),p-=3),bx(c)}}}function xx(){function a(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(N){return v=N})},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",a),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(c,100),function(){p=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),v!==null&&(v(),v=null)}}}function oh(a){this._internalRoot=a}vu.prototype.render=oh.prototype.render=function(a){var i=this._internalRoot;if(i===null)throw Error(r(409));var c=i.current,p=ta();dx(c,p,a,i,null,null)},vu.prototype.unmount=oh.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var i=a.containerInfo;dx(a.current,2,null,a,null,null),Qc(),i[ur]=null}};function vu(a){this._internalRoot=a}vu.prototype.unstable_scheduleHydration=function(a){if(a){var i=Ye();a={blockedOn:null,target:a,priority:i};for(var c=0;c<fi.length&&i!==0&&i<fi[c].priority;c++);fi.splice(c,0,a),c===0&&vx(a)}};var wx=t.version;if(wx!=="19.2.4")throw Error(r(527,wx,"19.2.4"));V.findDOMNode=function(a){var i=a._reactInternals;if(i===void 0)throw typeof a.render=="function"?Error(r(188)):(a=Object.keys(a).join(","),Error(r(268,a)));return a=h(i),a=a!==null?g(a):null,a=a===null?null:a.stateNode,a};var nA={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,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(nA),Fe=yu}catch{}}return fl.createRoot=function(a,i){if(!s(a))throw Error(r(299));var c=!1,p="",v=Tb,x=Ab,N=Rb;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&&(N=i.onRecoverableError)),i=cx(a,1,!1,null,null,c,p,null,v,x,N,xx),a[ur]=i.current,Ff(a),new oh(i)},fl.hydrateRoot=function(a,i,c){if(!s(a))throw Error(r(299));var p=!1,v="",x=Tb,N=Ab,z=Rb,Y=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&&(N=c.onCaughtError),c.onRecoverableError!==void 0&&(z=c.onRecoverableError),c.formState!==void 0&&(Y=c.formState)),i=cx(a,1,!0,i,c??null,p,v,Y,x,N,z,xx),i.context=ux(null),c=i.current,p=ta(),p=tt(p),v=Xr(p),v.callback=null,Jr(c,v,p),c=p,i.current.lanes=c,ge(i,c),Ya(i),a[ur]=i.current,Ff(a),new vu(i)},fl.version="19.2.4",fl}var _x;function fA(){if(_x)return uh.exports;_x=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(),uh.exports=pA(),uh.exports}var hA=fA();/**
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 Ox="popstate";function Lx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function mA(e={}){function t(r,s){var h;let l=(h=s.state)==null?void 0:h.masked,{pathname:u,search:d,hash:f}=l||r.location;return xm("",{pathname:u,search:d,hash:f},s.state&&s.state.usr||null,s.state&&s.state.key||"default",l?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:$l(s)}return vA(t,n,null,e)}function Ut(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ba(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function gA(){return Math.random().toString(36).substring(2,10)}function Mx(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 xm(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?go(t):t,state:n,key:t&&t.key||r||gA(),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 r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function vA(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:l=!1}=r,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 C=g(),S=C==null?null:C-h;h=C,f&&f({action:d,location:j.location,delta:S})}function y(C,S){d="PUSH";let T=Lx(C)?C:xm(j.location,C,S);h=g()+1;let E=Mx(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(C,S){d="REPLACE";let T=Lx(C)?C:xm(j.location,C,S);h=g();let E=Mx(T,h),A=j.createHref(T.mask||T);u.replaceState(E,"",A),l&&f&&f({action:d,location:j.location,delta:0})}function k(C){return yA(s,C)}let j={get action(){return d},get location(){return e(s,u)},listen(C){if(f)throw new Error("A history only accepts one active listener");return s.addEventListener(Ox,m),f=C,()=>{s.removeEventListener(Ox,m),f=null}},createHref(C){return t(s,C)},createURL:k,encodeLocation(C){let S=k(C);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:y,replace:b,go(C){return u.go(C)}};return j}function yA(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Ut(r,"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=r+s),new URL(s,r)}function tS(e,t,n="/"){return bA(e,t,n,!1)}function bA(e,t,n,r,s){let l=typeof t=="string"?go(t):t,u=$r(l.pathname||"/",n);if(u==null)return null;let d=xA(e),f=null,h=OA(u);for(let g=0;f==null&&g<d.length;++g)f=RA(d[g],h,r);return f}function xA(e){let t=nS(e);return wA(t),t}function nS(e,t=[],n=[],r="",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(r)&&f)return;Ut(g.relativePath.startsWith(r),`Absolute route path "${g.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(r.length)}let m=Pa([r,g.relativePath]),y=n.concat(g);u.children&&u.children.length>0&&(Ut(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),nS(u.children,t,y,m,f)),!(u.path==null&&!u.index)&&t.push({path:m,score:TA(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 aS(u.path))l(u,d,!0,h)}),t}function aS(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),l=n.replace(/\?$/,"");if(r.length===0)return s?[l,""]:[l];let u=aS(r.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 wA(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:AA(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var kA=/^:[\w-]+$/,SA=3,jA=2,CA=1,NA=10,EA=-2,zx=e=>e==="*";function TA(e,t){let n=e.split("/"),r=n.length;return n.some(zx)&&(r+=EA),t&&(r+=jA),n.filter(s=>!zx(s)).reduce((s,l)=>s+(kA.test(l)?SA:l===""?CA:NA),r)}function AA(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function RA(e,t,n=!1){let{routesMeta:r}=e,s={},l="/",u=[];for(let d=0;d<r.length;++d){let f=r[d],h=d===r.length-1,g=l==="/"?t:t.slice(l.length)||"/",m=ad({path:f.relativePath,caseSensitive:f.caseSensitive,end:h},g),y=f.route;if(!m&&h&&n&&!r[r.length-1].route.index&&(m=ad({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},g)),!m)return null;Object.assign(s,m.params),u.push({params:s,pathname:Pa([l,m.pathname]),pathnameBase:DA(Pa([l,m.pathnameBase])),route:y}),m.pathnameBase!=="/"&&(l=Pa([l,m.pathnameBase]))}return u}function ad(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=_A(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:r.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 _A(e,t=!1,n=!0){Ba(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 r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,f,h,g)=>{if(r.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("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function OA(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ba(!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 $r(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var LA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function MA(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?go(e):e,l;return n?(n=rS(n),n.startsWith("/")?l=Dx(n.substring(1),"/"):l=Dx(n,t)):l=t,{pathname:l,search:$A(r),hash:IA(s)}}function Dx(e,t){let n=rd(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function hh(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. 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 zA(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function fg(e){let t=zA(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function _d(e,t,n,r=!1){let s;typeof e=="string"?s=go(e):(s={...e},Ut(!s.pathname||!s.pathname.includes("?"),hh("?","pathname","search",s)),Ut(!s.pathname||!s.pathname.includes("#"),hh("#","pathname","hash",s)),Ut(!s.search||!s.search.includes("#"),hh("#","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(!r&&u.startsWith("..")){let y=u.split("/");for(;y[0]==="..";)y.shift(),m-=1;s.pathname=y.join("/")}d=m>=0?t[m]:"/"}let f=MA(s,d),h=u&&u!=="/"&&u.endsWith("/"),g=(l||u===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||g)&&(f.pathname+="/"),f}var rS=e=>e.replace(/\/\/+/g,"/"),Pa=e=>rS(e.join("/")),rd=e=>e.replace(/\/+$/,""),DA=e=>rd(e).replace(/^\/*/,"/"),$A=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,IA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,PA=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function UA(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function BA(e){let t=e.map(n=>n.route.path).filter(Boolean);return Pa(t)||"/"}var iS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function sS(e,t){let n=e;if(typeof n!="string"||!LA.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(iS)try{let l=new URL(window.location.href),u=n.startsWith("//")?new URL(l.protocol+n):new URL(n),d=$r(u.pathname,t);u.origin===l.origin&&d!=null?n=d+u.search+u.hash:s=!0}catch{Ba(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var oS=["POST","PUT","PATCH","DELETE"];new Set(oS);var FA=["GET",...oS];new Set(FA);var vo=w.createContext(null);vo.displayName="DataRouter";var Od=w.createContext(null);Od.displayName="DataRouterState";var lS=w.createContext(!1);function HA(){return w.useContext(lS)}var cS=w.createContext({isTransitioning:!1});cS.displayName="ViewTransition";var qA=w.createContext(new Map);qA.displayName="Fetchers";var GA=w.createContext(null);GA.displayName="Await";var ca=w.createContext(null);ca.displayName="Navigation";var Zl=w.createContext(null);Zl.displayName="Location";var or=w.createContext({outlet:null,matches:[],isDataRoute:!1});or.displayName="Route";var hg=w.createContext(null);hg.displayName="RouteError";var uS="REACT_ROUTER_ERROR",VA="REDIRECT",WA="ROUTE_ERROR_RESPONSE";function ZA(e){if(e.startsWith(`${uS}:${VA}:{`))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 YA(e){if(e.startsWith(`${uS}:${WA}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new PA(t.status,t.statusText,t.data)}catch{}}function KA(e,{relative:t}={}){Ut(yo(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=w.useContext(ca),{hash:s,pathname:l,search:u}=Yl(e,{relative:t}),d=l;return n!=="/"&&(d=l==="/"?n:Pa([n,l])),r.createHref({pathname:d,search:u,hash:s})}function yo(){return w.useContext(Zl)!=null}function Fa(){return Ut(yo(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(Zl).location}var dS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function pS(e){w.useContext(ca).static||w.useLayoutEffect(e)}function mg(){let{isDataRoute:e}=w.useContext(or);return e?c2():QA()}function QA(){Ut(yo(),"useNavigate() may be used only in the context of a <Router> component.");let e=w.useContext(vo),{basename:t,navigator:n}=w.useContext(ca),{matches:r}=w.useContext(or),{pathname:s}=Fa(),l=JSON.stringify(fg(r)),u=w.useRef(!1);return pS(()=>{u.current=!0}),w.useCallback((f,h={})=>{if(Ba(u.current,dS),!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:Pa([t,g.pathname])),(h.replace?n.replace:n.push)(g,h.state,h)},[t,n,l,s,e])}w.createContext(null);function Yl(e,{relative:t}={}){let{matches:n}=w.useContext(or),{pathname:r}=Fa(),s=JSON.stringify(fg(n));return w.useMemo(()=>_d(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function XA(e,t){return fS(e,t)}function fS(e,t,n){var C;Ut(yo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=w.useContext(ca),{matches:s}=w.useContext(or),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||"";mS(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=Fa(),m;if(t){let S=typeof t=="string"?go(t):t;Ut(f==="/"||((C=S.pathname)==null?void 0:C.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})):tS(e,{pathname:b});Ba(h||k!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Ba(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=a2(k&&k.map(S=>Object.assign({},S,{params:Object.assign({},u,S.params),pathname:Pa([f,r.encodeLocation?r.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?f:Pa([f,r.encodeLocation?r.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 JA(){let e=l2(),t=UA(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},l={padding:"2px 4px",backgroundColor:r},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 e2=w.createElement(JA,null),hS=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=YA(e.digest);n&&(e=n)}let t=e!==void 0?w.createElement(or.Provider,{value:this.props.routeContext},w.createElement(hg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?w.createElement(t2,{error:e},t):t}};hS.contextType=lS;var mh=new WeakMap;function t2({children:e,error:t}){let{basename:n}=w.useContext(ca);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=ZA(t.digest);if(r){let s=mh.get(t);if(s)throw s;let l=sS(r.location,n);if(iS&&!mh.get(t))if(l.isExternal||r.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:r.replace}));throw mh.set(t,u),u}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function n2({routeContext:e,match:t,children:n}){let r=w.useContext(vo);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(or.Provider,{value:e},n)}function a2(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,l=r==null?void 0:r.errors;if(l!=null){let g=s.findIndex(m=>m.route.id&&(l==null?void 0:l[m.route.id])!==void 0);Ut(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&&r){u=r.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}=r,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=r&&f?(g,m)=>{var y,b;f(g,{location:r.location,params:((b=(y=r.matches)==null?void 0:y[0])==null?void 0:b.params)??{},pattern:BA(r.matches),errorInfo:m})}:void 0;return s.reduceRight((g,m,y)=>{let b,k=!1,j=null,C=null;r&&(b=l&&m.route.id?l[m.route.id]:void 0,j=m.route.errorElement||e2,u&&(d<0&&y===0?(mS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,C=null):d===y&&(k=!0,C=m.route.hydrateFallbackElement||null)));let S=t.concat(s.slice(0,y+1)),T=()=>{let E;return b?E=j:k?E=C:m.route.Component?E=w.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=g,w.createElement(n2,{match:m,routeContext:{outlet:g,matches:S,isDataRoute:r!=null},children:E})};return r&&(m.route.ErrorBoundary||m.route.errorElement||y===0)?w.createElement(hS,{location:r.location,revalidation:r.revalidation,component:j,error:b,children:T(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):T()},null)}function gg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function r2(e){let t=w.useContext(vo);return Ut(t,gg(e)),t}function i2(e){let t=w.useContext(Od);return Ut(t,gg(e)),t}function s2(e){let t=w.useContext(or);return Ut(t,gg(e)),t}function vg(e){let t=s2(e),n=t.matches[t.matches.length-1];return Ut(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function o2(){return vg("useRouteId")}function l2(){var r;let e=w.useContext(hg),t=i2("useRouteError"),n=vg("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function c2(){let{router:e}=r2("useNavigate"),t=vg("useNavigate"),n=w.useRef(!1);return pS(()=>{n.current=!0}),w.useCallback(async(s,l={})=>{Ba(n.current,dS),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...l}))},[e,t])}var $x={};function mS(e,t,n){!t&&!$x[e]&&($x[e]=!0,Ba(!1,n))}w.memo(u2);function u2({routes:e,manifest:t,future:n,state:r,isStatic:s,onError:l}){return fS(e,void 0,{manifest:t,state:r,isStatic:s,onError:l})}function El({to:e,replace:t,state:n,relative:r}){Ut(yo(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=w.useContext(ca);Ba(!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(or),{pathname:u}=Fa(),d=mg(),f=_d(e,fg(l),u,r==="path"),h=JSON.stringify(f);return w.useEffect(()=>{d(JSON.parse(h),{replace:t,state:n,relative:r})},[d,h,r,t,n]),null}function vi(e){Ut(!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 d2({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:l=!1,useTransitions:u}){Ut(!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 C=$r(h,d);return C==null?null:{location:{pathname:C,search:g,hash:m,state:y,key:b,mask:k},navigationType:r}},[d,h,g,m,y,b,r,k]);return Ba(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(ca.Provider,{value:f},w.createElement(Zl.Provider,{children:t,value:j}))}function p2({children:e,location:t}){return XA(wm(e),t)}function wm(e,t=[]){let n=[];return w.Children.forEach(e,(r,s)=>{if(!w.isValidElement(r))return;let l=[...t,s];if(r.type===w.Fragment){n.push.apply(n,wm(r.props.children,l));return}Ut(r.type===vi,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ut(!r.props.index||!r.props.children,"An index route cannot have child routes.");let u={id:r.props.id||l.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(u.children=wm(r.props.children,l)),n.push(u)}),n}var Hu="get",qu="application/x-www-form-urlencoded";function Ld(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function f2(e){return Ld(e)&&e.tagName.toLowerCase()==="button"}function h2(e){return Ld(e)&&e.tagName.toLowerCase()==="form"}function m2(e){return Ld(e)&&e.tagName.toLowerCase()==="input"}function g2(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function v2(e,t){return e.button===0&&(!t||t==="_self")&&!g2(e)}var bu=null;function y2(){if(bu===null)try{new FormData(document.createElement("form"),0),bu=!1}catch{bu=!0}return bu}var b2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function gh(e){return e!=null&&!b2.has(e)?(Ba(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${qu}"`),null):e}function x2(e,t){let n,r,s,l,u;if(h2(e)){let d=e.getAttribute("action");r=d?$r(d,t):null,n=e.getAttribute("method")||Hu,s=gh(e.getAttribute("enctype"))||qu,l=new FormData(e)}else if(f2(e)||m2(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(r=f?$r(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Hu,s=gh(e.getAttribute("formenctype"))||gh(d.getAttribute("enctype"))||qu,l=new FormData(d,e),!y2()){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(Ld(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Hu,r=null,s=qu,u=e}return l&&s==="text/plain"&&(u=l,l=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:l,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function yg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function gS(e,t,n,r){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}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&$r(s.pathname,t)==="/"?s.pathname=`${rd(t)}/_root.${r}`:s.pathname=`${rd(s.pathname)}.${r}`,s}async function w2(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 k2(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 S2(e,t,n){let r=await Promise.all(e.map(async s=>{let l=t.routes[s.route.id];if(l){let u=await w2(l,n);return u.links?u.links():[]}return[]}));return E2(r.flat(1).filter(k2).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Ix(e,t,n,r,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=r.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 j2(e,t,{includeHydrateFallback:n}={}){return C2(e.map(r=>{let s=t.routes[r.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 C2(e){return[...new Set(e)]}function N2(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function E2(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let l=JSON.stringify(N2(s));return n.has(l)||(n.add(l),r.push({key:l,link:s})),r},[])}function bg(){let e=w.useContext(vo);return yg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function T2(){let e=w.useContext(Od);return yg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var xg=w.createContext(void 0);xg.displayName="FrameworkContext";function wg(){let e=w.useContext(xg);return yg(e,"You must render this element inside a <HydratedRouter> element"),e}function A2(e,t){let n=w.useContext(xg),[r,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)})},C=new IntersectionObserver(j,{threshold:.5});return y.current&&C.observe(y.current),()=>{C.disconnect()}}},[e]),w.useEffect(()=>{if(r){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[r]);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 R2({page:e,...t}){let n=HA(),{router:r}=bg(),s=w.useMemo(()=>tS(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?n?w.createElement(O2,{page:e,matches:s,...t}):w.createElement(L2,{page:e,matches:s,...t}):null}function _2(e){let{manifest:t,routeModules:n}=wg(),[r,s]=w.useState([]);return w.useEffect(()=>{let l=!1;return S2(e,t,n).then(u=>{l||s(u)}),()=>{l=!0}},[e,t,n]),r}function O2({page:e,matches:t,...n}){let r=Fa(),{future:s}=wg(),{basename:l}=bg(),u=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let d=gS(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,r,t]);return w.createElement(w.Fragment,null,u.map(d=>w.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function L2({page:e,matches:t,...n}){let r=Fa(),{future:s,manifest:l,routeModules:u}=wg(),{basename:d}=bg(),{loaderData:f,matches:h}=T2(),g=w.useMemo(()=>Ix(e,t,h,l,r,"data"),[e,t,h,l,r]),m=w.useMemo(()=>Ix(e,t,h,l,r,"assets"),[e,t,h,l,r]),y=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let j=new Set,C=!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?C=!0:j.add(T.route.id))}),j.size===0)return[];let S=gS(e,d,s.v8_trailingSlashAwareDataRequests,"data");return C&&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,r,l,g,t,e,u]),b=w.useMemo(()=>j2(m,l),[m,l]),k=_2(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:C})=>w.createElement("link",{key:j,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function M2(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var z2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{z2&&(window.__reactRouterVersion="7.17.0")}catch{}function D2({basename:e,children:t,useTransitions:n,window:r}){let s=w.useRef();s.current==null&&(s.current=mA({window:r,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(d2,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:l,useTransitions:n})}var vS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yS=w.forwardRef(function({onClick:t,discover:n="render",prefetch:r="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:C,navigator:S,useTransitions:T}=w.useContext(ca),E=typeof g=="string"&&vS.test(g),A=sS(g,C);g=A.to;let B=KA(g,{relative:s}),R=Fa(),D=null;if(d){let $=_d(d,[],R.mask?R.mask.pathname:"/",!0);C!=="/"&&($.pathname=$.pathname==="/"?C:Pa([C,$.pathname])),D=S.createHref($)}let[H,M,_]=A2(r,k),P=U2(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 W=!(A.isExternal||l),I=w.createElement("a",{...k,..._,href:(W?D:void 0)||A.absoluteURL||B,onClick:W?F:t,ref:M2(j,M),target:h,"data-discover":!E&&n==="render"?"true":void 0});return H&&!E?w.createElement(w.Fragment,null,I,w.createElement(R2,{page:B})):I});yS.displayName="Link";var $2=w.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:l,to:u,viewTransition:d,children:f,...h},g){let m=Yl(u,{relative:h.relative}),y=Fa(),b=w.useContext(Od),{navigator:k,basename:j}=w.useContext(ca),C=b!=null&&G2(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=$r(E,j)||E);const A=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let B=T===S||!s&&T.startsWith(S)&&T.charAt(A)==="/",R=E!=null&&(E===S||!s&&E.startsWith(S)&&E.charAt(S.length)==="/"),D={isActive:B,isPending:R,isTransitioning:C},H=B?t:void 0,M;typeof r=="function"?M=r(D):M=[r,B?"active":null,R?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let _=typeof l=="function"?l(D):l;return w.createElement(yS,{...h,"aria-current":H,className:M,ref:g,style:_,to:u,viewTransition:d},typeof f=="function"?f(D):f)});$2.displayName="NavLink";var I2=w.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,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(ca),C=H2(),S=q2(d,{relative:h}),T=u.toLowerCase()==="get"?"get":"post",E=typeof d=="string"&&vS.test(d),A=B=>{if(f&&f(B),B.defaultPrevented)return;B.preventDefault();let R=B.nativeEvent.submitter,D=(R==null?void 0:R.getAttribute("formmethod"))||u,H=()=>C(R||B.currentTarget,{fetcherKey:t,method:D,navigate:n,replace:s,state:l,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:y});j&&n!==!1?w.startTransition(()=>H()):H()};return w.createElement("form",{ref:k,method:T,action:S,onSubmit:r?f:A,...b,"data-discover":!E&&e==="render"?"true":void 0})});I2.displayName="Form";function P2(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bS(e){let t=w.useContext(vo);return Ut(t,P2(e)),t}function U2(e,{target:t,replace:n,mask:r,state:s,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f,useTransitions:h}={}){let g=mg(),m=Fa(),y=Yl(e,{relative:u});return w.useCallback(b=>{if(v2(b,t)){b.preventDefault();let k=n!==void 0?n:$l(m)===$l(y),j=()=>g(e,{replace:k,mask:r,state:s,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f});h?w.startTransition(()=>j()):j()}},[m,g,y,n,r,s,t,e,l,u,d,f,h])}var B2=0,F2=()=>`__${String(++B2)}__`;function H2(){let{router:e}=bS("useSubmit"),{basename:t}=w.useContext(ca),n=o2(),r=e.fetch,s=e.navigate;return w.useCallback(async(l,u={})=>{let{action:d,method:f,encType:h,formData:g,body:m}=x2(l,t);if(u.navigate===!1){let y=u.fetcherKey||F2();await r(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})},[r,s,t,n])}function q2(e,{relative:t}={}){let{basename:n}=w.useContext(ca),r=w.useContext(or);Ut(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),l={...Yl(e||".",{relative:t})},u=Fa();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:Pa([n,l.pathname])),$l(l)}function G2(e,{relative:t}={}){let n=w.useContext(cS);Ut(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=bS("useViewTransitionState"),s=Yl(e,{relative:t});if(!n.isTransitioning)return!1;let l=$r(n.currentLocation.pathname,r)||n.currentLocation.pathname,u=$r(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ad(s.pathname,u)!=null||ad(s.pathname,l)!=null}var V2=eS();const W2="modulepreload",Z2=function(e){return"/ui/"+e},Px={},Aa=function(t,n,r){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=Z2(h),h in Px)return;Px[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":W2,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)})},Ux=e=>{let t;const n=new Set,r=(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:r,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h))},f=t=e(r,s,d);return d},Y2=(e=>e?Ux(e):Ux),K2=e=>e;function Q2(e,t=K2){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 Bx=e=>{const t=Y2(e),n=r=>Q2(t,r);return Object.assign(n,t),n},rs=(e=>e?Bx(e):Bx),xS="dkg-layout",X2=260,Ka={leftCollapsed:!1,rightCollapsed:!1,bottomCollapsed:!0,leftSectionMyProjectsOpen:!0,leftSectionIntegrationsOpen:!1,leftWidth:240,rightWidth:360,bottomHeight:X2},wS=140,kS=400,SS=200,jS=500,CS=120,id=600,J2=240;function eR(e,t){if(typeof document>"u")return t;const n=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),r=parseFloat(n);return Number.isFinite(r)?r:t}function sd(){const e=eR("--header-h",44),t=typeof window<"u"&&window.innerHeight?window.innerHeight:0;if(!t)return id;const n=t-e-J2;return Math.max(0,Math.min(id,n))}function Gu(e,t,n){return Math.max(t,Math.min(n,e))}function vh(e,t,n,r){return typeof e!="number"||!Number.isFinite(e)?t:Gu(e,n,r)}function tR(){try{const e=localStorage.getItem(xS);if(!e)return Ka;const t=JSON.parse(e);return{leftCollapsed:typeof t.leftCollapsed=="boolean"?t.leftCollapsed:Ka.leftCollapsed,rightCollapsed:typeof t.rightCollapsed=="boolean"?t.rightCollapsed:Ka.rightCollapsed,bottomCollapsed:typeof t.bottomCollapsed=="boolean"?t.bottomCollapsed:Ka.bottomCollapsed,leftSectionMyProjectsOpen:typeof t.leftSectionMyProjectsOpen=="boolean"?t.leftSectionMyProjectsOpen:Ka.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:typeof t.leftSectionIntegrationsOpen=="boolean"?t.leftSectionIntegrationsOpen:Ka.leftSectionIntegrationsOpen,leftWidth:vh(t.leftWidth,Ka.leftWidth,wS,kS),rightWidth:vh(t.rightWidth,Ka.rightWidth,SS,jS),bottomHeight:vh(t.bottomHeight,Ka.bottomHeight,CS,id)}}catch{return Ka}}let xu=null;function Or(e){xu&&clearTimeout(xu),xu=setTimeout(()=>{xu=null;try{localStorage.setItem(xS,JSON.stringify(e))}catch{}},150)}function Lr(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=tR(),Gn=rs((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})),Or(Lr(t()))},toggleRight:()=>{e(n=>({rightCollapsed:!n.rightCollapsed})),Or(Lr(t()))},toggleBottom:()=>{e(n=>({bottomCollapsed:!n.bottomCollapsed,bottomMaximised:!1})),Or(Lr(t()))},toggleBottomMaximised:()=>{e(n=>({bottomMaximised:!n.bottomMaximised,bottomCollapsed:!1})),Or(Lr(t()))},toggleLeftSectionMyProjects:()=>{e(n=>({leftSectionMyProjectsOpen:!n.leftSectionMyProjectsOpen})),Or(Lr(t()))},toggleLeftSectionIntegrations:()=>{e(n=>({leftSectionIntegrationsOpen:!n.leftSectionIntegrationsOpen})),Or(Lr(t()))},setTheme:n=>{localStorage.setItem("dkg-theme",n),e({theme:n})},setLeftWidth:n=>{e({leftWidth:Gu(n,wS,kS)}),Or(Lr(t()))},setRightWidth:n=>{e({rightWidth:Gu(n,SS,jS)}),Or(Lr(t()))},setBottomHeight:n=>{const r=Math.min(CS,sd());e({bottomHeight:Gu(n,r,id)}),Or(Lr(t()))}})),kg=rs(e=>({agents:[],activeAgentName:null,nodeStatus:null,setAgents:t=>e({agents:t}),setActiveAgent:t=>e({activeAgentName:t}),setNodeStatus:t=>e({nodeStatus:t})})),nR=[{id:"dashboard",label:"Dashboard",closable:!1}],pn=rs((e,t)=>({tabs:nR,activeTabId:"dashboard",openTab:n=>{const{tabs:r}=t();r.find(s=>s.id===n.id)?e({activeTabId:n.id}):e({tabs:[...r,n],activeTabId:n.id})},closeTab:n=>{var d;const{tabs:r,activeTabId:s}=t(),l=r.filter(f=>f.id!==n);if(l.length===0)return;const u=s===n?((d=l[Math.max(0,r.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})})),Ra="";function Bt(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}class Cn extends Error{constructor(n,r,s){super(r??`HTTP ${n}`);Sn(this,"status");Sn(this,"body");this.status=n,this.body=s}}async function Sg(e,t={},n=1e4){try{return await fetch(e,{...t,signal:AbortSignal.timeout(n)})}catch(r){throw r instanceof Error&&r.name==="TimeoutError"?new Error(`Request timed out after ${Math.round(n/1e3)}s`):r}}async function bt(e){const t=await fetch(`${Ra}${e}`,{headers:Bt()});if(!t.ok){const n=await t.json().catch(()=>({})),r=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Cn(t.status,r,n)}return t.json()}async function bo(e){const t=await fetch(`${Ra}${e}`,{headers:Bt()});if(!t.ok){const n=await t.json().catch(()=>({})),r=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Cn(t.status,r,n)}return t.json()}async function NS(e,t){const n=await Sg(`${Ra}${e}`,{headers:Bt()},t);if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Cn(n.status,s,r)}return n.json()}async function yn(e,t){const n=await fetch(`${Ra}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Cn(n.status,s,r)}return n.json()}async function jg(e,t){const n=await fetch(`${Ra}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}async function aR(e){const t=await fetch(`${Ra}${e}`,{method:"DELETE",headers:Bt()});if(!t.ok){const n=await t.json().catch(()=>({})),r=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Cn(t.status,r,n)}return t.json()}const od=(e,t,n)=>{const r=new URLSearchParams;t&&r.set("key",t),n!=null&&n.extended&&r.set("extended","1");const s=r.toString();return bo(`/api/pca/${encodeURIComponent(e)}${s?`?${s}`:""}`).then(l=>n!=null&&n.extended?{...l,extendedRequested:!0}:l)},jG=e=>yn("/api/pca",{tokens:e.tokens,primaryNode:e.primaryNode}),CG=(e,t)=>yn(`/api/pca/${encodeURIComponent(e)}/agent`,{agent:t}),NG=(e,t)=>aR(`/api/pca/${encodeURIComponent(e)}/agent/${encodeURIComponent(t)}`),EG=(e,t)=>yn(`/api/pca/${encodeURIComponent(e)}/funds`,{tokens:t}),TG=e=>yn(`/api/pca/${encodeURIComponent(e)}/settle`,{}),AG=e=>bo(`/api/pca/${encodeURIComponent(e)}/agents`),rR=e=>bo(`/api/pca/agent/${encodeURIComponent(e)}`),RG=e=>bo("/api/pca/mine?hydrate=1"),_G=e=>bo(`/api/pca/designatable-nodes${e!=null&&e.fresh?"?fresh=1":""}`),iR=()=>bo("/api/pca/contracts");function ES(e){var n;if(!(e instanceof Cn))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 Cn&&e.status===503&&!ES(e)}function LG(e){if(!(e instanceof Cn)||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 sR=["PrimaryNodeNotInShardingTable","PrimaryNodeUnchanged","PrimaryNodeChangeRateLimited","ZeroPrimaryNode","InvalidAmount","ZeroAgentAddress","TokenTransferFailed","NotAccountOwner","AgentAlreadyRegistered","AgentNotRegistered","AgentCapReached","AccountExpired","AccountAlreadyFullySettled","UnknownAccount"];function MG(e,t={}){if(!(e instanceof Cn))return null;const n=e.status,r=e.body??{},s=typeof r.error=="string"&&r.error.length>0?r.error:e.message,l=t.accountId?`PCA #${t.accountId}`:"this Publisher Conviction Account",u=r.existingAccountId!=null?String(r.existingAccountId):void 0;if(ES(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=sR.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 Fx="did:dkg:context-graph:",TS=6e4;function AS(e){const t=e.trim();return t.startsWith(Fx)?t.slice(Fx.length):t}function oR(e){if(e.authorAgentAddress!=null&&e.preSignedAuthorAttestation!=null)throw new Error("authorAgentAddress and preSignedAuthorAttestation are mutually exclusive")}class km extends Error{constructor(n,r={}){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,r)}}const Cg=()=>bt("/api/status"),zG=()=>bt("/api/settings/retention"),DG=e=>jg("/api/settings/retention",{retentionDays:e}),$G=()=>bt("/api/settings/telemetry"),IG=e=>jg("/api/settings/telemetry",{enabled:e}),lR=()=>bt("/api/connections"),cR=(e,t=1e4)=>Sg(`${Ra}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify({multiaddr:e})},t).then(async n=>{if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}),uR=(e,t=2e4)=>Sg(`${Ra}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify({peerId:e})},t).then(async n=>{if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}),Ng=()=>bt("/api/agents"),dR=()=>bt("/api/metrics"),PG=(e,t,n=300)=>bt(`/api/metrics/history?from=${e}&to=${t}&maxPoints=${n}`),pR=(e={})=>{const t=new URLSearchParams({...e,phases:"1"}).toString();return bt(`/api/operations?${t}`)},UG=e=>bt(`/api/operations/${e}`),BG=e=>{const t=e?`?periodMs=${e}`:"";return bt(`/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 bt(`/api/failed-operations${n?"?"+n:""}`)},HG=e=>bt(`/api/replication/summary${e?`?periodMs=${e}`:""}`),qG=e=>bt(`/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 bt(`/api/replication/timeline${n?"?"+n:""}`)},VG=()=>bt("/api/replication/cursors"),WG=(e,t=100)=>bt(`/api/replication/events?cg=${encodeURIComponent(e)}&limit=${t}`),ZG=e=>bt(`/api/success-rates?periodMs=${e}`),YG=(e,t)=>{const n=`periodMs=${e}${t?`&bucketMs=${t}`:""}`;return bt(`/api/per-type-stats?${n}`)},fR=(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 bt(`/api/node-log${n?"?"+n:""}`)};async function Md(){return{contextGraphs:((await NS("/api/context-graph/list",TS)).contextGraphs??[]).filter(n=>!n.isSystem)}}const Kl=()=>bt("/api/agent/identity");async function hR(e,t,n,r){const s=new AbortController,l=setTimeout(()=>s.abort(),3e4);try{const u=await fetch(`${Ra}/api/context-graph/create`,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify({id:e,name:t,description:n,...r!=null&&r.register?{register:!0}:{},...r!=null&&r.allowedAgents?{allowedAgents:r.allowedAgents}:{},...(r==null?void 0:r.accessPolicy)!==void 0?{accessPolicy:r.accessPolicy}:{},...(r==null?void 0:r.publishPolicy)!==void 0?{publishPolicy:r.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 mR=(e,t)=>yn(`/api/context-graph/${encodeURIComponent(e)}/remove-participant`,{agentAddress:t}),RS=e=>bt(`/api/context-graph/${encodeURIComponent(e)}/participants`),gR=e=>yn(`/api/context-graph/${encodeURIComponent(e)}/sign-join`,{}),vR=(e,t)=>yn(`/api/context-graph/${encodeURIComponent(e)}/request-join`,t),_S=e=>bt(`/api/context-graph/${encodeURIComponent(e)}/join-requests`),Eg=(e,t)=>yn(`/api/context-graph/${encodeURIComponent(e)}/approve-join`,{agentAddress:t}),Tg=(e,t)=>yn(`/api/context-graph/${encodeURIComponent(e)}/reject-join`,{agentAddress:t}),yR={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 bR(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 yR[t]}async function OS(e,t,n,r){const s=new FormData;s.append("file",n),s.append("contextGraphId",t);const l=bR(n);l&&s.append("contentType",l);const u=await fetch(`${Ra}/api/knowledge-assets/${encodeURIComponent(e)}/wm/import-file`,{method:"POST",headers:Bt(),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 yh=new Map;function ld(e){const t=JSON.stringify(e),n=yh.get(t);if(n)return n;const r=(async()=>{const s=await fetch(`${Ra}/api/query`,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:t});if(!s.ok){const l=await s.json().catch(()=>({})),u=(l==null?void 0:l.error)??`HTTP ${s.status}`;throw new Cn(s.status,u,l)}return s.json()})().finally(()=>{yh.delete(t)});return yh.set(t,r),r}const sa=(e,t,n,r,s,l)=>ld({sparql:e,contextGraphId:t,includeSharedMemory:n,graphSuffix:r,view:s,includeContextGraphPartitions:l});async function xR(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
+ }`,r=await sa(n,e),s={};for(const f of((l=r==null?void 0:r.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 wR=(e,t)=>yn("/api/profile/query-catalog/write",{contextGraphId:e,quads:t}),kR=new Set(["clearAfter","publishEpochs","publisherNodeIdentityIdOverride"]),SR=e=>{if(typeof e=="string"&&/^\d+$/.test(e))return e;throw new Error("publisherNodeIdentityIdOverride must be passed as a decimal string")},jR=(e,t=[])=>{if(!e)return;const n=Object.keys(e).filter(l=>!kR.has(l)&&!t.includes(l));if(n.length>0)throw new Error(`Unsupported finalized publish option(s): ${n.join(", ")}`);const r={};e.clearAfter!==void 0&&(r.clearSharedMemoryAfter=e.clearAfter),e.publishEpochs!==void 0&&(r.publishEpochs=e.publishEpochs);const s=e.publisherNodeIdentityIdOverride;return s!==void 0&&(r.publisherNodeIdentityIdOverride=SR(s)),Object.keys(r).length>0?r:void 0},cd=(e,t,n={})=>(oR(n),yn(`/api/knowledge-assets/${encodeURIComponent(t)}/wm/finalize`,{contextGraphId:AS(e),...n})),Hx=(e,t,n={})=>{const r=jR(n,["subGraphName"]);return yn(`/api/knowledge-assets/${encodeURIComponent(t)}/vm/publish`,{contextGraphId:AS(e),...n.subGraphName?{subGraphName:n.subGraphName}:{},...r?{options:r}:{}})};class Ag extends Error{constructor(t){super(t??"Share the full asset to Shared Memory before publishing."),this.name="SwmSubsetNotSealableError"}}async function Rg(e,t,n={}){var r,s,l;try{return await Hx(e,t,n)}catch(u){const d=u instanceof Cn&&u.status===409?(r=u.body)==null?void 0:r.code:void 0;if(d!=="PUBLISH_NOT_FULL_SHARE"&&d!=="VM_PUBLISH_PRECONDITION")throw u;try{await cd(e,t,{layer:"swm",...n.subGraphName?{subGraphName:n.subGraphName}:{}})}catch(h){throw h instanceof Cn&&h.status===409&&((s=h.body)==null?void 0:s.code)==="SWM_SUBSET_NOT_SEALABLE"?new Ag((l=h.body)==null?void 0:l.error):h}return{...await Hx(e,t,n),sealed:!0}}}async function _g(e,t){let n=0,r=0,s=0,l;const u=[];let d=null,f=0n,h=0n,g=0n,m=0n,y,b=!0,k=!0;for(const C of t)try{const S=await Rg(e,C.name,C.subGraph?{subGraphName:C.subGraph}:{});n+=1,S.sealed&&(r+=1),S.contextGraphError&&(s+=1,l===void 0&&(l=S.contextGraphError));const T=S;(!d||T.status==="confirmed"&&T.txHash&&!T.contextGraphError)&&(d=T);const E=T.convictionCostCovered;if(E)try{f+=BigInt(E.baseCost),h+=BigInt(E.discountedCost),g+=BigInt(E.drawnFromEpoch),m+=BigInt(E.drawnFromTopUp),y?(E.accountId!==y.accountId&&(b=!1),E.epoch!==y.epoch&&(k=!1)):y=E}catch{}}catch(S){const T=S instanceof Ag?S.message:(S==null?void 0:S.message)??"publish failed";u.push({name:C.name,...C.subGraph?{subGraph:C.subGraph}:{},error:T})}const j=y?{...b&&y.accountId?{accountId:y.accountId}:{},...k&&y.epoch!=null?{epoch:y.epoch}:{},baseCost:f.toString(),discountedCost:h.toString(),drawnFromEpoch:g.toString(),drawnFromTopUp:m.toString()}:void 0;return{published:n,total:t.length,sealed:r,partial:s,partialError:l,failures:u,sample:d,convictionCostCovered:j}}async function Ql(e,t="wm"){var j,C,S,T,E,A,B,R;if(t==="swm"){const D=`did:dkg:context-graph:${e}/_meta`,H=`did:dkg:context-graph:${e}/`,M=`urn:dkg:assertion:${e}:`,_=`SELECT ?g ?vm WHERE {
67
+ GRAPH <${D}> {
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 sa(_,e),F=((j=P==null?void 0:P.result)==null?void 0:j.bindings)??[],W=new Set,I=[];for(const V of F){const X=typeof V.g=="string"?V.g:(C=V.g)==null?void 0:C.value;if(!X)continue;const K=typeof V.vm=="string"?V.vm:(S=V.vm)==null?void 0:S.value;let L,U;if(X.startsWith(H)){const O=X.slice(H.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}),K&&W.add(G)}const $=new Set,q=[];for(const V of I)W.has(V.key)||$.has(V.key)||($.add(V.key),q.push({name:V.name,graphUri:V.g,subGraph:V.subGraph}));return q}const n=`did:dkg:context-graph:${e}/_meta`,r=`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 D of((E=f==null?void 0:f.result)==null?void 0:E.bindings)??[]){const H=typeof D.g=="string"?D.g:(A=D.g)==null?void 0:A.value,M=typeof D.cnt=="string"?D.cnt:(B=D.cnt)==null?void 0:B.value,_=typeof M=="string"?M.match(/^"?(\d+)/):null,P=_?parseInt(_[1],10):NaN;H&&Number.isFinite(P)&&g.set(H,P)}const m=[],y=new Set,b=`urn:dkg:assertion:${e}:`,k=[...h].sort((D,H)=>{var P,F;const M=(typeof D.g=="string"?D.g:(P=D.g)==null?void 0:P.value)??"",_=(typeof H.g=="string"?H.g:(F=H.g)==null?void 0:F.value)??"";return(M.startsWith(r)?0:1)-(_.startsWith(r)?0:1)});for(const D of k){const H=typeof D.g=="string"?D.g:(R=D.g)==null?void 0:R.value;if(!H)continue;let M,_;if(H.startsWith(r)){const W=H.slice(r.length).split("/");if(W.length===3&&W[0]==="assertion")_=W[2];else if(W.length===4&&W[1]==="assertion")M=W[0],_=W[3];else continue}else if(H.startsWith(b)){const W=H.slice(b.length);let I=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(W);I?_=I[2]:(I=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(W),I&&(M=I[1],_=I[3]))}else continue;if(!_||M==="meta")continue;const P=`${M??""}\0${_}`;if(y.has(P))continue;y.add(P);const F=g.get(H);m.push({name:_,graphUri:H,tripleCount:F,subGraph:M})}return m}const oo=(e,t,n="all",r)=>yn(`/api/knowledge-assets/${encodeURIComponent(t)}/swm/share`,{contextGraphId:e,entities:n,...r?{subGraphName:r}:{}});function Og(e,t){return t.promotedCount>0?{kind:"success",promotedCount:t.promotedCount,message:`Promoted ${t.promotedCount} triple${t.promotedCount===1?"":"s"} from ${e} to Shared Working Memory.`}:{kind:"noop",message:`${e} had no triples to promote. It may already be in Shared Working Memory, or the extracted content is still being committed — refresh and try again.`}}function lo(e,t){if(t instanceof Cn&&t.status===413){const n=t.body;if((n==null?void 0:n.code)==="SWM_GOSSIP_PAYLOAD_TOO_LARGE"){const r=typeof n.hint=="string"&&n.hint.length>0?n.hint:"Promote fewer entities per call or split the assertion into smaller root-entity batches.";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 promote to Shared Working Memory. ${r}`}}}if(t instanceof Cn&&t.status===409){const n=t.body;if((n==null?void 0:n.code)==="ASSERTION_NOT_PERSISTED"){const r=typeof n.expectedTripleCount=="number"?n.expectedTripleCount:void 0;return{kind:"not-persisted",expectedTripleCount:r,message:r?`${e} was imported with ${r} extracted triple${r===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 CR=(e,t,n)=>{const r=new URLSearchParams({contextGraphId:t});return n&&r.set("subGraphName",n),bt(`/api/knowledge-assets/${encodeURIComponent(e)}/wm/extraction-status?${r}`)};function Vu(e,t){const n=e.startsWith("sha256:")||e.startsWith("keccak256:")?e:`sha256:${e}`,r=t?`?contentType=${encodeURIComponent(t)}`:"";return`${Ra}/api/file/${encodeURIComponent(n)}${r}`}const NR="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 ER=(e=20)=>bt(`/api/memory/sessions?limit=${e}`),TR=(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 r=n.toString();return bt(`/api/memory/sessions/${encodeURIComponent(e)}${r?`?${r}`:""}`)};function LS(e,t){var n,r,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}:{},...(r=t==null?void 0:t.attachmentImportResults)!=null&&r.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 AR(e,t={}){var m;const n=await fetch("/api/openclaw-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Bt()},body:JSON.stringify(LS(e,t)),signal:t.signal});if(!n.ok){const y=await n.json().catch(()=>({}));throw ud(y,`Request failed (${n.status})`,n.status)}const r=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!r.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=ud(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 RR=()=>bt("/api/openclaw-channel/health");async function _R(e,t={}){var y;const n=await fetch("/api/hermes-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Bt()},body:JSON.stringify(LS(e,t)),signal:t.signal});if(!n.ok){const b=await n.json().catch(()=>({}));throw ud(b,`Request failed (${n.status})`,n.status)}const r=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!r.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=ud(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 C=j.slice(5).trim();if(C){try{g(h(JSON.parse(C)))}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 OR=()=>bt("/api/hermes-channel/health");function LR(e,t){if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e,r=typeof n.error=="string"&&n.error.trim()?n.error.trim():t;if(n.details===void 0||n.details===null)return r;const s=typeof n.details=="string"?n.details.trim():JSON.stringify(n.details);return!s||s===r?r:`${r}: ${s}`}function ud(e,t,n){if(!e||typeof e!="object"||Array.isArray(e))return new km(t,{status:n});const r=e,s=LR(r,t),l=f=>{const h=r[f];return typeof h=="string"&&h.trim()?h.trim():void 0},u=f=>{const h=r[f];return typeof h=="number"&&Number.isFinite(h)?h:void 0},d=f=>{const h=r[f];return typeof h=="boolean"?h:void 0};return new km(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 zd={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 r=t.slice(n.length).trim();return r?{identity:r}:{}},fetchHealth:RR,streamChat:AR},hermes:{connectSupported:!0,chatSupported:!0,defaultSessionId:({integrationId:e,record:t,health:n})=>IR(e,t,n),resolveChatContext:({sessionId:e,profile:t})=>({...e?{sessionId:e}:{},...t?{profile:t}:{}}),fetchHealth:OR,streamChat:_R}};function eo(e){var n,r;const t=e.trim().toLowerCase();return((r=(n=zd[t])==null?void 0:n.defaultSessionId)==null?void 0:r.call(n,{integrationId:t}))??null}function MR(e,t){return t!=null&&t.trim()?t.trim():eo(e)}async function zR(e,t=50){const n=r=>{if(r.turnId)return`urn:dkg:chat:turn:${encodeURIComponent(r.turnId)}:${encodeURIComponent(r.author)}`;const s=`${e}
87
+ ${r.author}
88
+ ${r.ts}
89
+ ${r.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 TR(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(r){if(r instanceof Cn&&r.status===404)return[];throw r}}function DR(e){var t,n,r;return!!((t=e.transport)!=null&&t.bridgeUrl||(n=e.transport)!=null&&n.gatewayUrl||(r=e.transport)!=null&&r.healthUrl)}function Sm(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return null}function $R(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||Lg(e)}function Lg(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 IR(e,t,n){const r=(t==null?void 0:t.metadata)??{},s=Sm(n==null?void 0:n.profile,r.profileName,r.profile),l=Sm(r.hermesHome),u=l?null:PR(t),d=[s?`profile-${$R(s)}`:null,l?`home-${Lg(l)}`:null,u].filter(f=>f!=null);return d.length?`${e}:dkg-ui:${d.join(":")}`:`${e}:dkg-ui`}function PR(e){const t=e==null?void 0:e.transport;if(!t)return null;const n=[t.kind,t.bridgeUrl,t.gatewayUrl,t.healthUrl].filter(r=>typeof r=="string"&&r.trim().length>0);return n.length?`transport-${Lg(n.join("|"))}`:null}function UR(e){return e?typeof e=="string"?e:[e.provider,e.mode,e.status].filter(Boolean).join(" / ")||null:null}function BR(e,t){if(e==="degraded")return!0;const n=String((t==null?void 0:t.status)??"").toLowerCase(),r=t==null?void 0:t.memory;return n.includes("degraded")||n.includes("conflict")||typeof r=="object"&&r!=null&&r.conflict===!0}function MS(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function qx(e){if(!MS(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 FR(e){if(e.target==="bridge")return{target:"bridge",details:e.bridge};if(e.target==="gateway")return{target:"gateway",details:e.gateway};const t=qx(e.bridge),n=qx(e.gateway);return t<0&&n<0?{}:t>=n?{target:"bridge",details:e.bridge}:{target:"gateway",details:e.gateway}}function HR(e){if(!e)return null;const{target:t,details:n}=FR(e);if(!MS(n))return e;const r=typeof n.ok=="boolean"?n.ok:void 0;return{...n,...e,ok:e.ok===!1?!1:r??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 qR(e,t){if(String(e.id??"").toLowerCase()!=="hermes")return null;const n=t==null?void 0:t.profile,r=n?`profile ${n}`:"the configured profile",s=UR(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} ${r} has a memory provider conflict${s?` (${s})`:""}.`:t!=null&&t.ok?`${e.name} ${r} is connected${s?` with ${s} memory`:""}.`:t!=null&&t.status?`${e.name} ${r} reports ${t.status}${s?` (${s})`:""}.`:null}async function Mg(e){var A,B,R,D,H,M,_,P,F,W,I,$,q,V;const t=String(e.id??"").toLowerCase(),n=zd[t],r=((A=e.capabilities)==null?void 0:A.localChat)===!0&&(n==null?void 0:n.chatSupported)===!0,s=r&&((B=e.capabilities)==null?void 0:B.chatAttachments)===!0,l=((R=e.capabilities)==null?void 0:R.connectFromUi)===!0&&(n==null?void 0:n.connectSupported)===!0,u=e.enabled===!0,d=(D=e.runtime)==null?void 0:D.status,f=u&&r&&(n!=null&&n.fetchHealth)?HR(await n.fetchHealth().catch(()=>null)):null,h=BR(d,f),g=(f==null?void 0:f.ok)===!0&&!h,m=g,y=u&&r&&(g||d==="connecting"||d==="degraded"||((H=e.runtime)==null?void 0:H.ready)===!0||DR(e)),b=qR(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"?Sm(f==null?void 0:f.profile,(_=e.metadata)==null?void 0:_.profileName,(P=e.metadata)==null?void 0:P.profile):void 0;let C,S,T;y&&h?(C="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&&((W=e.runtime)==null?void 0:W.status)==="connecting"?(C="connecting",S="Connecting",T=((I=e.runtime)==null?void 0:I.lastError)??`${e.name} is registered and still starting up.`):m?(C="chat_ready",S="Chat ready",T=`${e.name} is connected to this node and ready for chat.`):y?(C="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?(C="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.`:((q=e.runtime)==null?void 0:q.lastError)??`Use the node-served skill plus ${e.name} onboarding to attach an existing local agent.`):(C="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":C==="connecting"?"Connecting":C==="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:r,chatAttachments:s,connectSupported:l,configured:u,detected:u||g,persistentChat:y,chatReady:g,bridgeOnline:m,bridgeStatusLabel:E,status:C,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 bt("/api/local-agent-integrations"),t=await Promise.all((e.integrations??[]).map(Mg));return t.sort((n,r)=>{const s=n.id==="openclaw"?0:1,l=r.id==="openclaw"?0:1;return s!==l?s-l:n.persistentChat!==r.persistentChat?n.persistentChat?-1:1:n.name.localeCompare(r.name)}),{integrations:t}}async function GR(e){const t=e.trim().toLowerCase(),n=zd[t];if(!(n!=null&&n.connectSupported))throw new Error(`${e} local connect is not available yet.`);const r=await yn("/api/local-agent-integrations/connect",{id:t,metadata:{source:"node-ui"}}),s=r.integration?await Mg(r.integration):(await Dd()).integrations.find(l=>l.id===t);if(!s)throw new Error(`Missing local agent integration: ${t}`);return{integration:s,notice:r.notice}}async function VR(e){const t=e.trim().toLowerCase();await jg(`/api/local-agent-integrations/${encodeURIComponent(t)}`,{enabled:!1,runtime:{status:"disconnected",ready:!1,lastError:null}})}async function WR(e){const t=e.trim().toLowerCase(),n=await yn(`/api/local-agent-integrations/${encodeURIComponent(t)}/refresh`,{}),r=n.integration?await Mg(n.integration):(await Dd()).integrations.find(s=>s.id===t);if(!r)throw new Error(`Missing local agent integration: ${t}`);return{integration:r,notice:n.notice}}async function Gx(e,t=50,n={}){const r=MR(e,n.sessionId);return r?zR(r,t):[]}async function ZR(e){var n;const t=(n=e.sessionId)==null?void 0:n.trim();if(!t)throw new Error("Missing Hermes session id");return yn("/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 YR(e,t){if(e.trim().toLowerCase()==="hermes")return ZR(t);throw new Error(`${e} local chat persistence is not available yet.`)}async function KR(e,t,n={}){var l;const r=e.trim().toLowerCase(),s=zd[r];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:r,sessionId:u,profile:d})})}throw new Error(`${e} local chat is not available yet.`)}const QR=()=>bt("/api/economics"),zg=()=>bt("/api/wallets/balances"),KG=()=>yn("/api/shutdown",{}),XR=()=>bt("/api/notifications"),zS=e=>yn("/api/notifications/read",e?{ids:e}:{}),Dg=e=>NS(`/api/sub-graph/list?contextGraphId=${encodeURIComponent(e)}`,TS),JR={name:"my-dkg-node",networkName:"DKG Mainnet",connectedPeers:12,synced:!0,version:"10.0.0-rc"},e_={total_kcs:1842,confirmed_kcs:1623,tentative_kcs:219},t_={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}]},n_={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"}]},a_={"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:[]}},r_={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},i_={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}]},s_={agentAddress:"0x1111111111111111111111111111111111111111",agentDid:"did:dkg:agent:0x1111111111111111111111111111111111111111",name:"mock-node-agent",framework:"mock",peerId:"QmMockNodeAgentPeer000000000000000000000000",nodeIdentityId:"mock-node-identity"},o_={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"},l_={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},c_={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},u_={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 na(e,t=50){return new Promise(n=>setTimeout(()=>n(e),t))}const aa={fetchStatus:()=>na(JR),fetchMetrics:()=>na(e_),fetchAgents:()=>na(t_),fetchContextGraphs:()=>na(n_),fetchOperationsWithPhases:()=>na(r_),fetchEconomics:()=>na(i_),fetchWalletsBalances:()=>na(o_),fetchCurrentAgent:()=>na(s_),listParticipants:e=>na(a_[e]??{contextGraphId:e,allowedAgents:[]}),fetchSubGraphs:e=>na({contextGraphId:e,subGraphs:[]}),fetchNotificationsFeed:()=>na(l_),fetchNodeLog:()=>na(c_),fetchMemorySessions:()=>na(u_)};let Mr=null,ml=null;const d_=5e3,Vx=2,p_=250,jm=new Set;function f_(){return Mr===!0}function h_(e){return jm.add(e),e(Mr===!0),()=>{jm.delete(e)}}function m_(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}function g_(e){return new Promise(t=>setTimeout(t,e))}async function v_(){for(let e=1;e<=Vx;e+=1){try{const t=await fetch("/api/status",{cache:"no-store",headers:m_(),signal:AbortSignal.timeout(d_)});if(t.ok||t.status===401)return!1}catch{}e<Vx&&await g_(p_)}return!0}async function y_(){if(Mr!==null)return Mr;if(ml)return ml;ml=(async()=>(Mr=await v_(),typeof window<"u"&&(window.__DKG_USING_MOCKS__=Mr,Mr&&console.warn("[dkg-ui] /api/status unreachable (timeout/5xx/network) — falling back to demo (mock) data. The UI is NOT showing live node state.")),jm.forEach(e=>e(Mr)),Mr))();try{return await ml}finally{ml=null}}async function ra(e,t){return await y_()?t():e()}const An={fetchStatus:()=>ra(Cg,aa.fetchStatus),fetchMetrics:()=>ra(dR,aa.fetchMetrics),fetchAgents:()=>ra(Ng,aa.fetchAgents),fetchContextGraphs:()=>ra(Md,aa.fetchContextGraphs),fetchOperationsWithPhases:e=>ra(()=>pR(e),aa.fetchOperationsWithPhases),fetchEconomics:()=>ra(QR,aa.fetchEconomics),fetchWalletsBalances:()=>ra(zg,aa.fetchWalletsBalances),fetchCurrentAgent:()=>ra(Kl,aa.fetchCurrentAgent),listParticipants:e=>ra(()=>RS(e),()=>aa.listParticipants(e)),fetchSubGraphs:e=>ra(()=>Dg(e),()=>aa.fetchSubGraphs(e)),fetchNotificationsFeed:()=>ra(XR,aa.fetchNotificationsFeed),fetchNodeLog:e=>ra(()=>fR(e),aa.fetchNodeLog),fetchMemorySessions:e=>ra(()=>ER(e),aa.fetchMemorySessions),markNotificationsRead:zS,executeQuery:sa},b_=6e4;let wi={data:null,loading:!0,error:null},tr=null,Rl=null,Tl=0,xi="";const dd=new Set;function Yi(){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 bh(){const e=Yi();return e!==xi&&Wu(e),wi}function Zu(){for(const e of dd)e()}function xh(e){wi=e,Zu()}function pd(){const e=Tl,t=Yi();if((tr==null?void 0:tr.authKey)===t)return tr.promise;t!==xi?(Wu(t),Zu()):xh({...wi,loading:!0,error:null});const n=An.fetchCurrentAgent().then(r=>{if(e===Tl){if(t!==Yi()){const s=Yi(),l=xi!==s||wi.loading;xi!==s&&(Wu(s),Zu()),l&&pd();return}xh({data:r,loading:!1,error:null})}}).catch(r=>{if(e===Tl){if(t!==Yi()){const s=Yi(),l=xi!==s||wi.loading;xi!==s&&(Wu(s),Zu()),l&&pd();return}xh({data:wi.data,loading:!1,error:r instanceof Error?r.message:"Failed to load current agent"})}}).finally(()=>{e===Tl&&(tr==null?void 0:tr.promise)===n&&(tr=null)});return tr={authKey:t,promise:n},n}function x_(){pd(),!Rl&&(Rl=setInterval(()=>{pd()},b_))}function w_(){dd.size>0||!Rl||(clearInterval(Rl),Rl=null,Tl+=1,tr=null,wi={data:null,loading:!0,error:null},xi=Yi())}function $d(){const[e,t]=w.useState(bh);return w.useEffect(()=>{const n=()=>t(bh());return dd.add(n),t(bh()),x_(),()=>{dd.delete(n),w_()}},[]),e}const Ta=rs(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 vn=null,Yu=null;const k_=350;function Wx(e){return e==="wm"||e==="swm"||e==="vm"}function S_(e){const t=e.layers;return Array.isArray(t)?t.filter(Wx):Wx(e.layer)?[e.layer]:[]}function j_(e,t,n){if(!t||e.contextGraphId!==t)return!1;if(!n||n.length===0)return!0;const r=S_(e);return r.length===0?!0:n.some(s=>r.includes(s))}function DS(){if(vn)return;const e=typeof window<"u"?window.__DKG_TOKEN__:void 0,t=e?`/api/events?token=${encodeURIComponent(e)}`:"/api/events";vn=new EventSource(t);const n=r=>s=>{let l={};try{l=JSON.parse(s.data)}catch{}const u={type:r,data:l};for(const d of to)try{d(u)}catch{}};vn.addEventListener("join_request",n("join_request")),vn.addEventListener("join_approved",n("join_approved")),vn.addEventListener("join_rejected",n("join_rejected")),vn.addEventListener("project_synced",n("project_synced")),vn.addEventListener("memory_graph_changed",n("memory_graph_changed")),vn.addEventListener("notification",n("notification")),vn.addEventListener("connected",n("connected")),vn.onerror=()=>{vn==null||vn.close(),vn=null,to.size>0&&(Yu=setTimeout(DS,3e3))}}function C_(){Yu&&(clearTimeout(Yu),Yu=null),vn==null||vn.close(),vn=null}function N_(e){return to.add(e),to.size===1&&DS(),()=>{to.delete(e),to.size===0&&C_()}}function is(e){const t=w.useRef(e);t.current=e,w.useEffect(()=>N_(n=>t.current(n)),[])}function xo(e,t,n={}){var f;const r=w.useRef(t),s=w.useRef(null);r.current=t;const l=n.debounceMs??k_,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"&&j_(h.data,e,u)&&(d(),s.current=setTimeout(()=>{s.current=null,r.current(h.data)},l))},[d,e,l,u])),w.useEffect(()=>d,[d])}function Xl(e,t,n={}){const r=w.useRef(e);r.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(()=>r.current(),t))},f=()=>{l&&(clearInterval(l),l=null)},h=()=>{if(document.hidden){f();return}r.current(),d()};return s.current.runImmediately!==!1&&!document.hidden&&r.current(),document.hidden||d(),document.addEventListener("visibilitychange",h),()=>{u=!0,document.removeEventListener("visibilitychange",h),f()}},[t])}const E_="No pending join request found";function T_(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,r)=>r.ts-n.ts),t}function A_(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,r)=>r.ts-n.ts),t}function Zx(e){return e.filter(t=>t.type!=="join_request"&&t.read===0).map(t=>t.id)}function Yx(e){const t=e instanceof Error?e.message:String(e);if(t.includes(E_))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 R_(){const[e,t]=w.useState(null),[n,r]=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),r(E.scopeUnknown?"identity-pending":"ready")}).catch(()=>{u.current?l(!0):r("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(()=>T_((e==null?void 0:e.notifications)??[]),[e]),m=w.useMemo(()=>A_((e==null?void 0:e.notifications)??[]),[e]),y=(e==null?void 0:e.badgeCount)??0,b=w.useMemo(()=>Zx((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(R=>B.has(String(R.id))?{...R,read:1}:R)}}),zS(E).then(d).catch(()=>{}))},[d]),j=w.useCallback(()=>{k(Zx((e==null?void 0:e.notifications)??[]))},[e,k]),C=w.useCallback(async(E,A)=>{try{return await Eg(E,A),d(),{ok:!0}}catch(B){const R=Yx(B);return R.ok&&R.alreadyHandled&&d(),R}},[d]),S=w.useCallback(async(E,A)=>{try{return await Tg(E,A),d(),{ok:!0}}catch(B){const R=Yx(B);return R.ok&&R.alreadyHandled&&d(),R}},[d]),T=w.useCallback(()=>{l(!1),r(u.current?"ready":"loading"),d()},[d]);return{joinRequests:g,activity:m,unread:y,hasInformationalUnread:b,status:n,refreshError:s,partialActivityError:!1,approve:C,deny:S,markSeen:k,markAllInformationalSeen:j,retry:T}}const __="dkg-pca",O_=150;function L_(e){return[String(e.chainId).toLowerCase(),e.nft.toLowerCase(),e.token.toLowerCase()].join(":")}function yi(e){return e?`${__}:${e}`:null}const wh={trackedIds:[],createPending:null,topUpPending:{}};function _l(e){return typeof e=="string"&&/^\d+$/.test(e)}function M_(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const r of e)_l(r)&&!t.has(r)&&(t.add(r),n.push(r));return n}function z_(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 D_(e){if(e==null||typeof e!="object")return{};const t={};for(const[n,r]of Object.entries(e)){if(!_l(n)||r==null||typeof r!="object")continue;const s=r;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 $S(e){const t=yi(e);if(!t)return{...wh};try{const n=localStorage.getItem(t);if(!n)return{...wh};const r=JSON.parse(n);return{trackedIds:M_(r.trackedIds),createPending:z_(r.createPending),topUpPending:D_(r.topUpPending)}}catch{return{...wh}}}let ar=null;function wu(e,t){e&&(ar&&clearTimeout(ar),ar=setTimeout(()=>{ar=null;try{localStorage.setItem(e,JSON.stringify(t))}catch{}},O_))}function kh(e,t){if(ar&&(clearTimeout(ar),ar=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=$S(null),Pl=rs((e,t)=>({scopeKey:null,trackedIds:ku.trackedIds,createPending:ku.createPending,topUpPending:ku.topUpPending,createPendingPersisted:ku.createPending!=null,setScope:n=>{if(t().scopeKey===n)return;ar&&(clearTimeout(ar),ar=null);const r=$S(n);e({scopeKey:n,trackedIds:r.trackedIds,createPending:r.createPending,topUpPending:r.topUpPending,createPendingPersisted:r.createPending!=null})},trackAccount:n=>{_l(n)&&(e(r=>r.trackedIds.includes(n)?r:{trackedIds:[...r.trackedIds,n]}),wu(yi(t().scopeKey),Fi(t())))},untrackAccount:n=>{e(r=>r.trackedIds.includes(n)?{trackedIds:r.trackedIds.filter(s=>s!==n)}:r),wu(yi(t().scopeKey),Fi(t()))},isTracked:n=>t().trackedIds.includes(n),setCreatePending:n=>{e({createPending:n});const r=kh(yi(t().scopeKey),Fi(t()));return e({createPendingPersisted:r}),r},clearCreatePending:()=>{e({createPending:null,createPendingPersisted:!1}),wu(yi(t().scopeKey),Fi(t()))},setTopUpPending:n=>{_l(n.accountId)&&(e(r=>({topUpPending:{...r.topUpPending,[n.accountId]:n}})),kh(yi(t().scopeKey),Fi(t())))},clearTopUpPending:n=>{e(r=>{if(!r.topUpPending[n])return r;const s={...r.topUpPending};return delete s[n],{topUpPending:s}}),wu(yi(t().scopeKey),Fi(t()))},finishCreate:n=>{e(r=>({createPending:null,createPendingPersisted:!1,trackedIds:_l(n)&&!r.trackedIds.includes(n)?[...r.trackedIds,n]:r.trackedIds})),kh(yi(t().scopeKey),Fi(t()))}}));function Sh(e){if(!e)return!1;try{return BigInt(e)>0n}catch{return!1}}function IS(e,t=Math.floor(Date.now()/1e3)){const{expiresAtTimestamp:n}=e;return typeof n=="number"&&n>0&&t>=n}function PS(e,t){return IS(e,t)||!!e.fullySwept}function $g(e){return Sh(e.topUpBuffer)?!0:e.remainingAllowance!==void 0?Sh(e.remainingAllowance):e.extendedRequested?null:Sh(e.baseEpochAllowance)}function $_(e){return $g(e)===!0}function I_(e){return e.remainingAllowance!==void 0&&$g(e)===!1}const US=90,BS=10080*60;function P_(e,t=Math.floor(Date.now()/1e3)){const{expiresAtTimestamp:n,fullySwept:r,agentCount:s}=e,l=typeof n=="number"&&n>0;return IS(e,t)?"expired":r?"swept":I_(e)?"insolvent":typeof s=="number"&&s>=US?"cap-near":l&&n-t<=BS?"expiring":"healthy"}function U_(e,t){return!PS(e,t)&&$_(e)}function B_(e){return(e==null?void 0:e.adapterSupported)===!1?null:(e==null?void 0:e.registered)??null}function Cm(e,t){var u;const n=B_(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 r=PS(e,t),s=$g(e);if(s===null)return{outcome:"inconclusive",registered:null,adapterUnsupported:!1};const l=s;return!r&&l?{outcome:"covers",registered:!0}:{outcome:"uncovered",registered:!0,dead:r,hasBudget:l}}const Kx=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();async function F_(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 r;try{r=await od(e,void 0,{extended:!0})}catch(h){return{...n,error:h,notFound:h instanceof Cn&&h.status===404}}const s=await Promise.all(t.map(h=>od(e,h,{extended:!0}).then(g=>({wallet:h,registered:Cm(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=>Kx(h,r.owner))?"owned":l>0?"approved":"unknown";return{accountId:e,snapshot:r,error:null,notFound:!1,classification:f,ownerIsPrimaryWallet:Kx(t[0],r.owner),health:P_(r),walletProbes:s,approvedCount:l,walletCount:t.length,probesInconclusive:u}}const no=new Map;function Qx(e){for(const t of e.subs)t()}async function fd(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,Qx(e);return}try{const n=await zg().catch(()=>null),r=(n==null?void 0:n.wallets)??[],s=!n||!!n.error,l=await Promise.all(e.ids.map(u=>F_(u,r)));if(t!==e.seq)return;e.data={wallets:r,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,Qx(e))}}function jh(e){e.timer||e.intervalMs<=0||typeof document<"u"&&document.hidden||(e.timer=setInterval(()=>fd(e),e.intervalMs))}function Ch(e){e.timer&&(clearInterval(e.timer),e.timer=null)}function H_(e,t,n,r){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(r),l){const u=s,d=()=>{typeof document>"u"||(document.hidden?Ch(u):(fd(u),jh(u)))};s.onVisibility=d,typeof document<"u"&&document.addEventListener("visibilitychange",d),fd(s),jh(s)}else n<s.intervalMs&&(s.intervalMs=n,Ch(s),jh(s));return()=>{const u=no.get(e);u&&(u.subs.delete(r),u.subs.size===0&&(Ch(u),u.onVisibility&&typeof document<"u"&&document.removeEventListener("visibilitychange",u.onVisibility),no.delete(e)))}}const q_=[];function FS(e=3e4,t=[]){var j,C,S;const n=Pl(T=>T.trackedIds),r=t.join(","),s=w.useMemo(()=>[...n,...t.filter(T=>!n.includes(T))],[n.join(","),r]),l=s.join(","),[,u]=w.useReducer(T=>T+1,0);w.useEffect(()=>H_(l,s,e,u),[l,e]);const d=no.get(l),f=((j=d==null?void 0:d.data)==null?void 0:j.accounts)??q_,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||!U_(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=((C=d==null?void 0:d.data)==null?void 0:C.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&&fd(T)},bestCoveringDiscountBps:m,covered:y}}let Nh=null;function HS(){const e=Pl(n=>n.scopeKey),t=Pl(n=>n.setScope);w.useEffect(()=>{e||Nh||(Nh=iR().then(n=>{t(L_(n))}).catch(()=>{}).finally(()=>{Nh=null}))},[e,t])}function G_(){HS();const{accounts:e}=FS(3e4);return w.useMemo(()=>{const t=[],n=Math.floor(Date.now()/1e3);for(const r of e){const s=r.snapshot;if(!s)continue;const l=r.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<=BS&&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>=US&&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."}),r.classification==="owned"&&r.approvedCount===0&&!r.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 qS=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.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 V_=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 W_=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.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 Xx=e=>{const t=W_(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 Eh={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 Z_=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Y_=w.createContext({}),K_=()=>w.useContext(Y_),Q_=w.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:s="",children:l,iconNode:u,...d},f)=>{const{size:h=24,strokeWidth:g=2,absoluteStrokeWidth:m=!1,color:y="currentColor",className:b=""}=K_()??{},k=r??m?Number(n??g)*24/Number(t??h):n??g;return w.createElement("svg",{ref:f,...Eh,width:t??h??Eh.width,height:t??h??Eh.height,stroke:e??y,strokeWidth:k,className:qS("lucide",b,s),...!l&&!Z_(d)&&{"aria-hidden":"true"},...d},[...u.map(([j,C])=>w.createElement(j,C)),...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 ln=(e,t)=>{const n=w.forwardRef(({className:r,...s},l)=>w.createElement(Q_,{ref:l,iconNode:t,className:qS(`lucide-${V_(Xx(e))}`,`lucide-${e}`,r),...s}));return n.displayName=Xx(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 X_=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],J_=ln("arrow-down",X_);/**
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 eO=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],tO=ln("arrow-up",eO);/**
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 nO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],aO=ln("ban",nO);/**
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"}]],iO=ln("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 sO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],oO=ln("chevron-down",sO);/**
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 lO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Nm=ln("chevron-right",lO);/**
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 cO=[["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"}]],uO=ln("copy",cO);/**
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 dO=[["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"}]],pO=ln("ellipsis",dO);/**
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 fO=[["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"}]],hO=ln("folder",fO);/**
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 mO=[["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"}]],gO=ln("globe",mO);/**
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 vO=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],yO=ln("loader-circle",vO);/**
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 bO=[["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"}]],xO=ln("lock",bO);/**
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 wO=[["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"}]],kO=ln("paperclip",wO);/**
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 SO=[["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"}]],Jx=ln("share-2",SO);/**
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 jO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],CO=ln("square",jO);/**
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 NO=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],EO=ln("trending-up",NO);/**
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 TO=[["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"}]],AO=ln("upload",TO);/**
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 RO=[["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=ln("users-round",RO);/**
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 OO=[["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"}]],LO=ln("wallet",OO);/**
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 MO=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zO=ln("x",MO),Th={1:"ETH",8453:"ETH",84532:"ETH",11155111:"ETH",31337:"ETH",100:"xDAI",10200:"xDAI",2043:"NEURO",20430:"NEURO"};function GS(e){var r;if(e==null)return"ETH";const t=String(e);if(Th[t])return Th[t];const n=(r=t.match(/(\d+)\s*$/))==null?void 0:r[1];return n&&Th[n]||"ETH"}function QG(e,t=6,n=4){const r=(e??"").trim();return r.length<=t+n+1?r:`${r.slice(0,t)}…${r.slice(-n)}`}const Ah="—";function DO(e,t=2){if(e==null)return Ah;let n;if(typeof e=="number")n=e;else{const l=String(e).trim();if(!/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(l))return Ah;n=Number(l)}if(!Number.isFinite(n))return Ah;const r=Math.abs(n),s=r>0&&r<10?t:0;return new Intl.NumberFormat("en-US",{minimumFractionDigits:0,maximumFractionDigits:s}).format(n)}function $O(e,t=2){if(e==null||e==="")return"—";let n;try{n=BigInt(e)}catch{return"—"}const r=n<0n;r&&(n=-n);const s=10n**18n,l=n/s,u=(n%s+s).toString().slice(1).slice(0,t);return DO(`${r?"-":""}${l}.${u||"0"}`,t)}const IO=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 IO.has(n)}function JG(e,t=Math.floor(Date.now()/1e3)){if(!e||e<=0)return"Expiry unknown";const n=e-t,r=Math.round(Math.abs(n)/86400);return n<=0?r===0?"Expired today":`Expired ~${r} day${r===1?"":"s"} ago`:`Expires in ~${r} day${r===1?"":"s"}`}function VS(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 WS({convictionCostCovered:e,className:t=""}){const n=VS(e);if(e==null||n==null)return null;const r=(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 — −",r,"% ",s]})}function PO(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 UO={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 BO({verdict:e,accountId:t,discountBps:n,accountUntracked:r=!1,reasons:s=[],ownerPublish:l=!1,variant:u="banner",children:d,className:f=""}){const h=UO[e],g=e==="fallthrough"||e==="fallthrough-no-funds",m=g?"alert":"status",y=g?"assertive":"polite",b=t?`PCA #${t}`:"a PCA",k=r?" (not tracked by this node)":"",j=PO(n),C=" 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?`${C}.`:""]}):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?C:"","; 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?C:"",".",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 hd=new Map,Em=new Set;let e1=!1;function FO(){const e=[...hd.values()];for(const t of Em)t(e)}function HO(e){const t=e.detail;hd.has(t.info.uuid)||(hd.set(t.info.uuid,t),FO())}function qO(){e1||typeof window>"u"||(e1=!0,window.addEventListener("eip6963:announceProvider",HO),window.dispatchEvent(new Event("eip6963:requestProvider")))}function GO(e){return Em.add(e),e([...hd.values()]),()=>{Em.delete(e)}}function Tm(e){var r;if(typeof e=="number")return e;const t=(r=String(e).match(/(\d+)\s*$/))==null?void 0:r[1],n=t?Number(t):NaN;if(!Number.isFinite(n))throw new Error(`Unrecognized chainId: ${e}`);return n}function VO(e){return`0x${Tm(e).toString(16)}`}const Ig="dkg-node-ui:wallet-provider-rdns";function WO(e){var t;try{(t=globalThis.localStorage)==null||t.setItem(Ig,e)}catch{}}function ZO(){var e;try{return((e=globalThis.localStorage)==null?void 0:e.getItem(Ig))??null}catch{return null}}function t1(){var e;try{(e=globalThis.localStorage)==null||e.removeItem(Ig)}catch{}}const ZS=new Set(["app.phantom"]),YO=300;function KO(e){return e.filter(t=>!ZS.has(t.info.rdns))}function QO(e,t){if(!t)return null;const n=e.filter(r=>r.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 XO(e){return(e.walletRpcUrls??[]).filter(t=>/^https?:\/\//i.test(t))}let Su=!1,ju=null,n1=!1;const tV=rs((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 r(s){const l=s.provider;try{const u=await l.request({method:"eth_accounts"});if(u.length===0){t1();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:Tm(s.chainId)})},initWallet(){if(typeof window>"u"||(qO(),n1))return;n1=!0;const s=ZO();GO(l=>{e({discovered:KO(l),unsupported:l.filter(u=>ZS.has(u.info.rdns))}),!(!s||Su)&&(ju&&clearTimeout(ju),ju=setTimeout(()=>{if(ju=null,Su)return;const u=QO(t().discovered,s);u&&(Su=!0,r(u))},YO))})},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)}),WO(s.info.rdns),Su=!1},disconnect(){e({provider:null,providerInfo:null,address:null,chainId:null}),t1()},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=VO(l.chainId);try{await s.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]})}catch(d){if((d==null?void 0:d.code)===4902){const f=GS(l.chainId),h=XO(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-${Tm(l.chainId)}`,nativeCurrency:{name:f,symbol:f,decimals:18},rpcUrls:h}]})}else throw d}}}});function Pg(e,t){return e&&e.trim()?e:t.length>20?`${t.slice(0,16)}…`:t}function a1(e){return e.length>12?`${e.slice(0,6)}…${e.slice(-4)}`:e}function JO({item:e,onApprove:t,onDeny:n,onOpen:r}){var g;const[s,l]=w.useState({kind:"idle"}),u=Pg(e.contextGraphName,e.cgId),d=((g=e.agentName)==null?void 0:g.trim())||a1(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:()=>r(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:a1(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 eL={created:"+",promoted:"⇡",published:"◉"};function tL(e,t,n){const r=t,s=r===1?"assertion":"assertions";return e==="created"?n?`${n} added ${r} ${s}`:`${r} new ${s} added`:e==="promoted"?n?`${n} promoted ${r} ${s}`:`${r} ${s} promoted`:n?`${n} published ${r} ${s} to Verifiable Memory`:`${r} ${s} published to Verifiable Memory`}function nL({item:e,onOpen:t}){var d;const n=Pg(e.contextGraphName,e.cgId),r=e.bySelf?"You":((d=e.actorAgentName)==null?void 0:d.trim())||void 0,s=tL(e.event,e.count,r),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:eL[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 aL({item:e,onOpen:t}){const n=Pg(e.contextGraphName,e.cgId),r=e.kind==="join_approved",s=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`v10-notif-glyph ${r?"v10-notif-glyph-approved":"v10-notif-glyph-rejected"}`,"aria-hidden":"true",children:r?"✓":"✕"}),o.jsxs("span",{className:"v10-notif-row-body",children:[o.jsx("span",{className:"v10-notif-row-title",children:r?"Request approved":"Request declined"}),o.jsx("span",{className:"v10-notif-row-detail",children:r?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(r){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=VS(e.covered),n=t!=null?(t/100).toFixed(t%100===0?0:1):null;let r=null;try{const g=BigInt(e.covered.baseCost),m=BigInt(e.covered.discountedCost);g>0n&&m>=0n&&m<g&&(r=$O((g-m).toString()))}catch{r=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}${r?` · saved ${r} 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 iL({feed:e,onOpenContextGraph:t,pcaAlerts:n=[],onOpenPca:r,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,C=(B,R)=>{k([R]),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}),r&&o.jsxs("button",{type:"button",className:"v10-pca-alert-action",onClick:()=>r(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(JO,{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(nL,{item:B,onOpen:R=>C(R,B.id)},B.id):B.kind==="pca_cost_covered"?o.jsx(rL,{item:B},B.id):o.jsx(aL,{item:B,onOpen:R=>C(R,B.id)},B.id))}):!g&&o.jsx("div",{className:"v10-notif-section-empty",children:"No recent activity."})]})]})]})]})}const sL=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"})]}),r1="v10-notifications-pane";function oL(){const e=R_(),t=G_(),[n,r]=w.useState(!1),s=w.useRef(null),l=w.useRef(null),u=Ta(b=>b.setActiveProject),{openTab:d}=pn(),f=w.useRef(null),h=w.useCallback((b=!1)=>{var k;r(!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]"),C=b.querySelector('button:not(.v10-notif-pane-markread), [href], [tabindex]:not([tabindex="-1"])');(k??j??C??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:()=>r(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?r1:void 0,children:[sL,y>0&&o.jsx("span",{className:"v10-header-notif-badge",children:y})]}),n&&o.jsx(iL,{id:r1,paneRef:f,feed:e,onOpenContextGraph:g,pcaAlerts:t,onOpenPca:m})]})}function lL(e,t,n,r,s){const l=[e?"Synced with the network":"Syncing with the network",`${t} peer${t===1?"":"s"} (${n} direct, ${r} relayed)`];return s>0&&l.push(`Uptime ${cL(s)}`),l.join(`
225
+ `)}function cL(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),s=Math.floor(t%3600/60),l=[];return n>0&&l.push(`${n}d`),(r>0||n>0)&&l.push(`${r}h`),l.push(`${s}m`),l.join(" ")}const uL=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"})]})}),dL=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"})]}),pL=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"})}),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:"9",y1:"3",x2:"9",y2:"21"})]}),hL=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"})]}),mL=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"})]}),gL=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"})}),vL=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 yL(){var C,S;const{theme:e,setTheme:t,leftCollapsed:n,toggleLeft:r,rightCollapsed:s,toggleRight:l}=Gn(),u=kg(T=>T.nodeStatus),d=$d().data,{openTab:f}=pn(),h=(u==null?void 0:u.connectedPeers)??(u==null?void 0:u.peerCount)??0,g=((C=u==null?void 0:u.connections)==null?void 0:C.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=lL(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"}),uL]})]}),o.jsx("button",{className:`v10-header-icon-btn ${n?"":"active-toggle"}`,onClick:r,title:"Toggle sidebar",children:fL}),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(oL,{}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"operations",label:"Observability",closable:!0}),title:"Observability",children:gL}),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:vL}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"settings",label:"Settings",closable:!0}),title:"Settings",children:mL}),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"?dL:pL}),o.jsx("button",{className:`v10-header-icon-btn ${s?"":"active-toggle"}`,onClick:l,title:"Toggle agent panel",children:hL})]})]})}function bL(){const e=localStorage.getItem("dkg-journey-stage");return e==="1"?1:e==="2"?2:0}const Ug=rs((e,t)=>({stage:bL(),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})}})),xL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
227
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
228
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
229
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
230
+ @prefix dcterms: <http://purl.org/dc/terms/> .
231
+ @prefix schema: <http://schema.org/> .
232
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
233
+ @prefix prov: <http://www.w3.org/ns/prov#> .
234
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
235
+ @prefix bibo: <http://purl.org/ontology/bibo/> .
236
+ @prefix fabio: <http://purl.org/spar/fabio/> .
237
+ @prefix cito: <http://purl.org/spar/cito/> .
238
+ @prefix frbr: <http://purl.org/vocab/frbr/core#> .
239
+
240
+ @prefix chat: <http://dkg.io/ontology/chat/> .
241
+ @prefix dkg: <http://dkg.io/ontology/> .
242
+ @prefix : <http://dkg.io/ontology/book-research/> .
243
+
244
+ <http://dkg.io/ontology/book-research/>
245
+ a owl:Ontology ;
246
+ dcterms:title "DKG Book Research Project Ontology (v1)" ;
247
+ dcterms:description """Starter ontology for projects that research and
248
+ write books, papers, or long-form non-fiction. Built on schema.org +
249
+ BIBO + the SPAR family (FaBiO, CiTO) + FRBR + SKOS so it composes with
250
+ existing scholarly publishing infrastructure.""" ;
251
+ owl:versionInfo "1.0.0" ;
252
+ dcterms:created "2026-04-18"^^xsd:date ;
253
+ owl:imports
254
+ <http://schema.org/> , <http://purl.org/dc/terms/> ,
255
+ <http://www.w3.org/ns/prov#> , <http://xmlns.com/foaf/0.1/> ,
256
+ <http://www.w3.org/2004/02/skos/core#> ,
257
+ <http://purl.org/ontology/bibo/> ,
258
+ <http://purl.org/spar/fabio/> ,
259
+ <http://purl.org/spar/cito/> ,
260
+ <http://purl.org/vocab/frbr/core#> .
261
+
262
+ # ─── Universal annotation predicates (shared across all starters) ───
263
+ chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
264
+ chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
265
+ chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .
266
+ chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .
267
+ chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .
268
+ chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
269
+
270
+ # ─── Universal annotation entities ──────────────────────────────────
271
+ :Concept rdfs:subClassOf skos:Concept .
272
+ :Topic rdfs:subClassOf skos:Concept .
273
+ :Question rdfs:subClassOf schema:Question .
274
+ :Finding rdfs:subClassOf prov:Entity .
275
+
276
+ # ─── Book-research specific ─────────────────────────────────────────
277
+
278
+ :Hypothesis a owl:Class ;
279
+ rdfs:label "Hypothesis" ;
280
+ rdfs:comment "A claim under investigation. Supersedes when refuted; promotes to a Finding when supported." ;
281
+ rdfs:subClassOf prov:Entity .
282
+
283
+ :Argument a owl:Class ;
284
+ rdfs:label "Argument" ;
285
+ rdfs:comment "A reasoned position taken on a Hypothesis or other entity." ;
286
+ rdfs:subClassOf prov:Entity .
287
+
288
+ :Counterexample a owl:Class ;
289
+ rdfs:label "Counterexample" ;
290
+ rdfs:comment "Evidence that refutes a Hypothesis or Argument." ;
291
+ rdfs:subClassOf prov:Entity .
292
+
293
+ :Quote a owl:Class ;
294
+ rdfs:label "Quote" ;
295
+ rdfs:comment "Verbatim passage extracted from a source. Subclass of bibo:Quote so it composes with bibliographic tools." ;
296
+ rdfs:subClassOf bibo:Quote .
297
+
298
+ :supports a owl:ObjectProperty ;
299
+ rdfs:label "supports" ;
300
+ rdfs:comment "An Argument or Quote supports a Hypothesis." ;
301
+ rdfs:subPropertyOf cito:agreesWith .
302
+
303
+ :refutes a owl:ObjectProperty ;
304
+ rdfs:label "refutes" ;
305
+ rdfs:comment "An Argument, Counterexample, or Quote refutes a Hypothesis." ;
306
+ rdfs:subPropertyOf cito:disagreesWith .
307
+
308
+ :cites a owl:ObjectProperty ;
309
+ rdfs:label "cites" ;
310
+ rdfs:subPropertyOf cito:cites ;
311
+ rdfs:range bibo:Document .
312
+
313
+ # ─── URI patterns ───────────────────────────────────────────────────
314
+ :UriPattern rdfs:label "URI minting pattern" .
315
+
316
+ :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
317
+ :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
318
+ :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
319
+ :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
320
+ :hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .
321
+ :argument-pattern a :UriPattern ; skos:notation "urn:dkg:argument:<slug>" .
322
+ :quote-pattern a :UriPattern ; skos:notation "urn:dkg:quote:<slug>" .
323
+ :citation-pattern a :UriPattern ; skos:notation "urn:dkg:citation:<slug>" ;
324
+ skos:definition "Bibliographic citation; aligned with bibo:Document via cito:cites." .
325
+
326
+ :slug-normalisation a skos:Note ;
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." .
328
+ `,wL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
329
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
330
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
331
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
332
+ @prefix dcterms: <http://purl.org/dc/terms/> .
333
+ @prefix schema: <http://schema.org/> .
334
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
335
+ @prefix prov: <http://www.w3.org/ns/prov#> .
336
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
337
+ @prefix doap: <http://usefulinc.com/ns/doap#> .
338
+
339
+ # DKG project namespaces — v1 ontology for any "coding project"
340
+ # context graph. Imports widely-adopted Linked Data vocabs first;
341
+ # only declares extensions for genuinely net-new concepts.
342
+ @prefix chat: <http://dkg.io/ontology/chat/> .
343
+ @prefix code: <http://dkg.io/ontology/code/> .
344
+ @prefix github: <http://dkg.io/ontology/github/> .
345
+ @prefix decisions: <http://dkg.io/ontology/decisions/> .
346
+ @prefix tasks: <http://dkg.io/ontology/tasks/> .
347
+ @prefix agent: <http://dkg.io/ontology/agent/> .
348
+ @prefix dkg: <http://dkg.io/ontology/> .
349
+
350
+ @prefix : <http://dkg.io/ontology/coding-project/> .
351
+
352
+ # ─── Ontology header ────────────────────────────────────────────────
353
+ <http://dkg.io/ontology/coding-project/>
354
+ a owl:Ontology ;
355
+ dcterms:title "DKG Coding Project Ontology (v1)" ;
356
+ dcterms:description """The starter ontology for any DKG context graph that
357
+ represents a software project — its decisions, tasks, code structure, GitHub
358
+ activity, agents, and chat. Designed to be \`owl:imports\`-ed by per-project
359
+ ontologies, which add their own extensions on top.
360
+
361
+ Every predicate is either reused from a globally-adopted vocabulary
362
+ (schema.org, DCTerms, PROV-O, FOAF, SKOS, DOAP) or declared here as a
363
+ project-specific extension. Companion document \`agent-guide.md\` translates
364
+ this formal model into operational instructions for AI coding agents.""" ;
365
+ dcterms:creator "branarakic" ;
366
+ owl:versionInfo "1.0.0" ;
367
+ dcterms:created "2026-04-18"^^xsd:date ;
368
+ owl:imports
369
+ <http://schema.org/> ,
370
+ <http://purl.org/dc/terms/> ,
371
+ <http://www.w3.org/ns/prov#> ,
372
+ <http://xmlns.com/foaf/0.1/> ,
373
+ <http://www.w3.org/2004/02/skos/core#> ,
374
+ <http://usefulinc.com/ns/doap#> .
375
+
376
+ # ─── Section 1 — Universal annotation primitives ────────────────────
377
+ # Predicates expressing what each chat turn was ABOUT — written into
378
+ # the project's \`chat\` sub-graph by the capture-chat hook (and later
379
+ # read by \`dkg_query\` / \`dkg_memory_search\`). These predicates apply
380
+ # to ANY project type, not just coding.
381
+
382
+ chat:topic
383
+ a owl:DatatypeProperty ;
384
+ rdfs:label "topic" ;
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." ;
386
+ rdfs:domain chat:Turn ;
387
+ rdfs:range xsd:string .
388
+
389
+ chat:mentions
390
+ a owl:ObjectProperty ;
391
+ rdfs:label "mentions" ;
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)." ;
393
+ rdfs:domain chat:Turn ;
394
+ rdfs:range owl:Thing ;
395
+ rdfs:subPropertyOf schema:mentions .
396
+
397
+ chat:examines
398
+ a owl:ObjectProperty ;
399
+ rdfs:label "examines" ;
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." ;
401
+ rdfs:domain chat:Turn ;
402
+ rdfs:range owl:Thing .
403
+
404
+ chat:proposes
405
+ a owl:ObjectProperty ;
406
+ rdfs:label "proposes" ;
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." ;
408
+ rdfs:domain chat:Turn ;
409
+ rdfs:range owl:Thing .
410
+
411
+ chat:concludes
412
+ a owl:ObjectProperty ;
413
+ rdfs:label "concludes" ;
414
+ rdfs:comment "A Finding entity the chat turn produced — a claim worth preserving as a first-class node, separate from the turn body." ;
415
+ rdfs:domain chat:Turn ;
416
+ rdfs:range :Finding .
417
+
418
+ chat:asks
419
+ a owl:ObjectProperty ;
420
+ rdfs:label "asks" ;
421
+ rdfs:comment "A Question entity the chat turn left open. Tracking these lets a future query surface 'what did we never resolve?'." ;
422
+ rdfs:domain chat:Turn ;
423
+ rdfs:range :Question .
424
+
425
+ # ─── Section 2 — Universal annotation entity classes ────────────────
426
+
427
+ :Concept
428
+ a owl:Class ;
429
+ rdfs:label "Concept" ;
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." ;
431
+ rdfs:subClassOf skos:Concept .
432
+
433
+ :Topic
434
+ a owl:Class ;
435
+ rdfs:label "Topic" ;
436
+ rdfs:comment "A broad topical bucket grouping related concepts/turns/entities. URI pattern: urn:dkg:topic:<slug>." ;
437
+ rdfs:subClassOf skos:Concept .
438
+
439
+ :Question
440
+ a owl:Class ;
441
+ rdfs:label "Question" ;
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." ;
443
+ rdfs:subClassOf schema:Question .
444
+
445
+ :Finding
446
+ a owl:Class ;
447
+ rdfs:label "Finding" ;
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." ;
449
+ rdfs:subClassOf prov:Entity .
450
+
451
+ :answers
452
+ a owl:ObjectProperty ;
453
+ rdfs:label "answers" ;
454
+ rdfs:comment "Links a Finding (or chat turn) to the Question it resolves." ;
455
+ rdfs:domain owl:Thing ;
456
+ rdfs:range :Question .
457
+
458
+ :supersedes
459
+ a owl:ObjectProperty ;
460
+ rdfs:label "supersedes" ;
461
+ rdfs:comment "This entity replaces an older one (e.g. a revised Finding supersedes an earlier one)." ;
462
+ rdfs:range owl:Thing ;
463
+ owl:inverseOf prov:wasRevisionOf .
464
+
465
+ # ─── Section 3 — Coding-project-specific classes ────────────────────
466
+ # Formalises the predicates already used informally in
467
+ # scripts/lib/ontology.mjs, anchoring them in PROV-O and schema.org.
468
+
469
+ decisions:Decision
470
+ a owl:Class ;
471
+ rdfs:label "Decision" ;
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." ;
473
+ rdfs:subClassOf prov:Activity, schema:Action .
474
+
475
+ decisions:context
476
+ a owl:DatatypeProperty ;
477
+ rdfs:label "context" ;
478
+ rdfs:domain decisions:Decision ;
479
+ rdfs:range xsd:string ;
480
+ rdfs:comment "Why this decision was being made — problem, constraints, alternatives considered." .
481
+
482
+ decisions:outcome
483
+ a owl:DatatypeProperty ;
484
+ rdfs:label "outcome" ;
485
+ rdfs:domain decisions:Decision ;
486
+ rdfs:range xsd:string ;
487
+ rdfs:comment "The chosen direction — the decision itself, in one paragraph." .
488
+
489
+ decisions:consequences
490
+ a owl:DatatypeProperty ;
491
+ rdfs:label "consequences" ;
492
+ rdfs:domain decisions:Decision ;
493
+ rdfs:range xsd:string ;
494
+ rdfs:comment "What this implies going forward — trade-offs, follow-ups." .
495
+
496
+ decisions:status
497
+ a owl:DatatypeProperty ;
498
+ rdfs:label "status" ;
499
+ rdfs:domain decisions:Decision ;
500
+ rdfs:range xsd:string ;
501
+ rdfs:comment "One of: proposed | accepted | rejected | superseded." .
502
+
503
+ tasks:Task
504
+ a owl:Class ;
505
+ rdfs:label "Task" ;
506
+ rdfs:comment "A piece of planned or in-flight work on the project." ;
507
+ rdfs:subClassOf schema:Action .
508
+
509
+ tasks:status
510
+ a owl:DatatypeProperty ;
511
+ rdfs:label "status" ;
512
+ rdfs:domain tasks:Task ;
513
+ rdfs:range xsd:string ;
514
+ rdfs:comment "One of: todo | in_progress | blocked | done | cancelled." .
515
+
516
+ tasks:priority
517
+ a owl:DatatypeProperty ;
518
+ rdfs:label "priority" ;
519
+ rdfs:domain tasks:Task ;
520
+ rdfs:range xsd:string ;
521
+ rdfs:comment "One of: p0 | p1 | p2 | p3." .
522
+
523
+ tasks:relatedDecision
524
+ a owl:ObjectProperty ;
525
+ rdfs:label "related decision" ;
526
+ rdfs:domain tasks:Task ;
527
+ rdfs:range decisions:Decision ;
528
+ rdfs:comment "The Decision this task implements or follows from." .
529
+
530
+ tasks:dependsOn
531
+ a owl:ObjectProperty ;
532
+ rdfs:label "depends on" ;
533
+ rdfs:domain tasks:Task ;
534
+ rdfs:range tasks:Task .
535
+
536
+ tasks:touches
537
+ a owl:ObjectProperty ;
538
+ rdfs:label "touches" ;
539
+ rdfs:domain tasks:Task ;
540
+ rdfs:range owl:Thing ;
541
+ rdfs:comment "A code:File or code:Package this task edits." .
542
+
543
+ # Code structure — aligned with schema:SoftwareSourceCode + DOAP.
544
+
545
+ code:Package
546
+ a owl:Class ;
547
+ rdfs:label "Package" ;
548
+ rdfs:subClassOf doap:Project, schema:SoftwareApplication .
549
+
550
+ code:File
551
+ a owl:Class ;
552
+ rdfs:label "Source file" ;
553
+ rdfs:subClassOf schema:SoftwareSourceCode .
554
+
555
+ code:Function a owl:Class ; rdfs:label "Function" .
556
+ code:Class a owl:Class ; rdfs:label "Class" .
557
+ code:Interface a owl:Class ; rdfs:label "Interface" .
558
+
559
+ # GitHub — minimal aliasing onto schema.org where sensible.
560
+
561
+ github:Repository
562
+ a owl:Class ;
563
+ rdfs:label "GitHub repository" ;
564
+ rdfs:subClassOf schema:SoftwareSourceCode, doap:Project .
565
+
566
+ github:PullRequest
567
+ a owl:Class ;
568
+ rdfs:label "Pull request" ;
569
+ rdfs:subClassOf schema:CreativeWork .
570
+
571
+ github:Issue
572
+ a owl:Class ;
573
+ rdfs:label "GitHub issue" ;
574
+ rdfs:subClassOf schema:Question, schema:CreativeWork .
575
+
576
+ # ─── Section 4 — Chat sub-graph classes ─────────────────────────────
577
+
578
+ chat:Session
579
+ a owl:Class ;
580
+ rdfs:label "Chat session" ;
581
+ rdfs:comment "One conversation between an operator and their coding assistant (Cursor window, Claude Code thread, etc.)." ;
582
+ rdfs:subClassOf schema:Conversation .
583
+
584
+ chat:Turn
585
+ a owl:Class ;
586
+ rdfs:label "Chat turn" ;
587
+ rdfs:comment "One user-prompt + assistant-response pair within a Session. Carries provenance via prov:wasAttributedTo." ;
588
+ rdfs:subClassOf schema:Message, prov:Entity .
589
+
590
+ chat:userPrompt a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
591
+ chat:assistantResponse a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
592
+ chat:turnIndex a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:integer .
593
+ chat:inSession a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range chat:Session .
594
+ chat:speakerTool a owl:DatatypeProperty ; rdfs:range xsd:string ;
595
+ rdfs:comment "Identifier of the coding assistant that produced the turn (e.g. 'cursor', 'claude-code')." .
596
+ chat:privacy a owl:DatatypeProperty ; rdfs:domain chat:Session ; rdfs:range xsd:string ;
597
+ rdfs:comment "One of: private | team | public. Controls auto-promote behaviour of the capture hook." .
598
+
599
+ # ─── Section 5 — Agent identity ─────────────────────────────────────
600
+
601
+ agent:Agent
602
+ a owl:Class ;
603
+ rdfs:label "Agent" ;
604
+ rdfs:subClassOf prov:Agent, foaf:Agent .
605
+
606
+ agent:HumanAgent rdfs:subClassOf agent:Agent, foaf:Person .
607
+ agent:AIAgent rdfs:subClassOf agent:Agent, schema:SoftwareApplication .
608
+
609
+ agent:framework
610
+ a owl:DatatypeProperty ;
611
+ rdfs:label "framework" ;
612
+ rdfs:domain agent:AIAgent ;
613
+ rdfs:range xsd:string ;
614
+ rdfs:comment "Name of the agent runtime — 'cursor', 'claude-code', 'openclaw', 'hermes', etc." .
615
+
616
+ agent:operator
617
+ a owl:ObjectProperty ;
618
+ rdfs:label "operator" ;
619
+ rdfs:domain agent:AIAgent ;
620
+ rdfs:range agent:HumanAgent ;
621
+ rdfs:comment "The human operator who runs and is responsible for this AI agent." .
622
+
623
+ # ─── Section 6 — URI minting conventions (machine-readable) ─────────
624
+ # These are encoded as SKOS notes so an agent reading the ontology can
625
+ # pull them out programmatically. The agent guide repeats them in
626
+ # prose for human readability.
627
+
628
+ :UriPattern
629
+ a owl:Class ;
630
+ rdfs:label "URI minting pattern" ;
631
+ rdfs:comment "Documents the URI shape the agent should produce when minting a new entity of a given type." .
632
+
633
+ :concept-pattern a :UriPattern ;
634
+ skos:notation "urn:dkg:concept:<slug>" ;
635
+ skos:definition "Free-text concept; aligned with skos:Concept." .
636
+ :topic-pattern a :UriPattern ;
637
+ skos:notation "urn:dkg:topic:<slug>" ;
638
+ skos:definition "Broad topical bucket grouping related entities." .
639
+ :question-pattern a :UriPattern ;
640
+ skos:notation "urn:dkg:question:<slug>" ;
641
+ skos:definition "An open question awaiting an answer." .
642
+ :finding-pattern a :UriPattern ;
643
+ skos:notation "urn:dkg:finding:<slug>" ;
644
+ skos:definition "A claim or observation worth preserving as a first-class node." .
645
+ :decision-pattern a :UriPattern ;
646
+ skos:notation "urn:dkg:decision:<slug>" ;
647
+ skos:definition "An architectural decision (coding-project specific)." .
648
+ :task-pattern a :UriPattern ;
649
+ skos:notation "urn:dkg:task:<slug>" ;
650
+ skos:definition "A piece of planned or in-flight work (coding-project specific)." .
651
+
652
+ # ─── Section 7 — Slug normalisation rule (deterministic) ────────────
653
+
654
+ :slug-normalisation a skos:Note ;
655
+ skos:prefLabel "slug normalisation" ;
656
+ skos:definition """To compute the canonical slug from a free-text label:
657
+ 1. Lowercase.
658
+ 2. Apply Unicode NFKD then strip combining marks (ASCII fold).
659
+ 3. Strip common stopwords (the / a / an / of / for / and / or / to / in / on / with).
660
+ 4. Replace any run of non-[a-z0-9] with a single hyphen.
661
+ 5. Trim leading/trailing hyphens.
662
+ 6. Truncate to 60 characters max.
663
+
664
+ Example: "the Tree-Sitter library", "Tree sitter", "TREE_SITTER" all
665
+ normalise to "tree-sitter". Always apply this BEFORE comparing free-text
666
+ recall results (\`dkg_memory_search\`) in the look-before-mint protocol.""" .
667
+ `,kL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
668
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
669
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
670
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
671
+ @prefix dcterms: <http://purl.org/dc/terms/> .
672
+ @prefix schema: <http://schema.org/> .
673
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
674
+ @prefix prov: <http://www.w3.org/ns/prov#> .
675
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
676
+ @prefix bibo: <http://purl.org/ontology/bibo/> .
677
+
678
+ @prefix chat: <http://dkg.io/ontology/chat/> .
679
+ @prefix : <http://dkg.io/ontology/narrative-writing/> .
680
+
681
+ <http://dkg.io/ontology/narrative-writing/>
682
+ a owl:Ontology ;
683
+ dcterms:title "DKG Narrative Writing Project Ontology (v1)" ;
684
+ dcterms:description """Starter for fiction or narrative non-fiction
685
+ projects: novels, screenplays, biographies. Tracks Characters, Scenes,
686
+ Plot Points, Themes, and the relationships between them.""" ;
687
+ owl:versionInfo "1.0.0" ;
688
+ dcterms:created "2026-04-18"^^xsd:date ;
689
+ owl:imports
690
+ <http://schema.org/> , <http://purl.org/dc/terms/> ,
691
+ <http://xmlns.com/foaf/0.1/> ,
692
+ <http://www.w3.org/2004/02/skos/core#> ,
693
+ <http://purl.org/ontology/bibo/> .
694
+
695
+ # ─── Universal annotation predicates ────────────────────────────────
696
+ chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
697
+ chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
698
+ chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
699
+ chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
700
+ chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .
701
+ chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
702
+
703
+ # ─── Universal annotation entities ──────────────────────────────────
704
+ :Concept rdfs:subClassOf skos:Concept .
705
+ :Topic rdfs:subClassOf skos:Concept .
706
+ :Question rdfs:subClassOf schema:Question .
707
+ :Finding rdfs:subClassOf prov:Entity .
708
+
709
+ # ─── Narrative-writing-specific ─────────────────────────────────────
710
+
711
+ :Character a owl:Class ;
712
+ rdfs:label "Character" ;
713
+ rdfs:comment "A character in the narrative — fictional or historical." ;
714
+ rdfs:subClassOf foaf:Person, schema:Person .
715
+
716
+ :Scene a owl:Class ;
717
+ rdfs:label "Scene" ;
718
+ rdfs:comment "A discrete unit of narrative action — a single place/time/event in the story." ;
719
+ rdfs:subClassOf schema:Event .
720
+
721
+ :PlotPoint a owl:Class ;
722
+ rdfs:label "Plot point" ;
723
+ rdfs:comment "A structural moment in the narrative arc (inciting incident, climax, resolution, etc.)." .
724
+
725
+ :Theme a owl:Class ;
726
+ rdfs:label "Theme" ;
727
+ rdfs:comment "A unifying idea explored across the narrative." ;
728
+ rdfs:subClassOf skos:Concept .
729
+
730
+ :Setting a owl:Class ;
731
+ rdfs:label "Setting" ;
732
+ rdfs:comment "A place + time context within which Scenes occur." .
733
+
734
+ :appearsIn a owl:ObjectProperty ;
735
+ rdfs:label "appears in" ;
736
+ rdfs:domain :Character ;
737
+ rdfs:range :Scene .
738
+
739
+ :setIn a owl:ObjectProperty ;
740
+ rdfs:label "set in" ;
741
+ rdfs:domain :Scene ;
742
+ rdfs:range :Setting .
743
+
744
+ :develops a owl:ObjectProperty ;
745
+ rdfs:label "develops" ;
746
+ rdfs:comment "A Scene or PlotPoint develops a Theme or a Character arc." ;
747
+ rdfs:range owl:Thing .
748
+
749
+ :precedes a owl:ObjectProperty ;
750
+ rdfs:label "precedes" ;
751
+ rdfs:domain :Scene ;
752
+ rdfs:range :Scene .
753
+
754
+ # ─── URI patterns ───────────────────────────────────────────────────
755
+ :UriPattern rdfs:label "URI minting pattern" .
756
+
757
+ :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
758
+ :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
759
+ :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
760
+ :character-pattern a :UriPattern ; skos:notation "urn:dkg:character:<slug>" .
761
+ :scene-pattern a :UriPattern ; skos:notation "urn:dkg:scene:<slug>" .
762
+ :plotpoint-pattern a :UriPattern ; skos:notation "urn:dkg:plotpoint:<slug>" .
763
+ :theme-pattern a :UriPattern ; skos:notation "urn:dkg:theme:<slug>" .
764
+ :setting-pattern a :UriPattern ; skos:notation "urn:dkg:setting:<slug>" .
765
+
766
+ :slug-normalisation a skos:Note ;
767
+ skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
768
+ `,SL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
769
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
770
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
771
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
772
+ @prefix dcterms: <http://purl.org/dc/terms/> .
773
+ @prefix schema: <http://schema.org/> .
774
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
775
+ @prefix prov: <http://www.w3.org/ns/prov#> .
776
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
777
+ @prefix time: <http://www.w3.org/2006/time#> .
778
+
779
+ @prefix chat: <http://dkg.io/ontology/chat/> .
780
+ @prefix : <http://dkg.io/ontology/pkm/> .
781
+
782
+ <http://dkg.io/ontology/pkm/>
783
+ a owl:Ontology ;
784
+ dcterms:title "DKG Personal Knowledge Management Ontology (v1)" ;
785
+ dcterms:description """Starter for personal/team knowledge gardens.
786
+ Notes, highlights, questions, insights — the daily-driver vocabulary
787
+ of an Obsidian/Roam-style PKM workflow, but graph-native and shareable
788
+ with teammates' agents.""" ;
789
+ owl:versionInfo "1.0.0" ;
790
+ dcterms:created "2026-04-18"^^xsd:date ;
791
+ owl:imports
792
+ <http://schema.org/> , <http://purl.org/dc/terms/> ,
793
+ <http://xmlns.com/foaf/0.1/> ,
794
+ <http://www.w3.org/2004/02/skos/core#> ,
795
+ <http://www.w3.org/2006/time#> .
796
+
797
+ # ─── Universal annotation predicates ────────────────────────────────
798
+ chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
799
+ chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
800
+ chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
801
+ chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
802
+ chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Insight .
803
+ chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
804
+
805
+ # ─── Universal annotation entities ──────────────────────────────────
806
+ :Concept rdfs:subClassOf skos:Concept .
807
+ :Topic rdfs:subClassOf skos:Concept .
808
+ :Question rdfs:subClassOf schema:Question .
809
+ :Finding rdfs:subClassOf prov:Entity .
810
+
811
+ # ─── PKM-specific ────────────────────────────────────────────────────
812
+
813
+ :Note a owl:Class ;
814
+ rdfs:label "Note" ;
815
+ rdfs:comment "An atomic note — a single self-contained thought worth capturing. The fundamental unit of a PKM graph." ;
816
+ rdfs:subClassOf schema:CreativeWork .
817
+
818
+ :Highlight a owl:Class ;
819
+ rdfs:label "Highlight" ;
820
+ rdfs:comment "A passage of text marked as significant from a source (article, book, transcript). Carries provenance back to the source." ;
821
+ rdfs:subClassOf schema:Quotation .
822
+
823
+ :Insight a owl:Class ;
824
+ rdfs:label "Insight" ;
825
+ rdfs:comment "A connection or realisation that synthesises across multiple Notes/Highlights. Promotes from a chat turn via chat:concludes." ;
826
+ rdfs:subClassOf prov:Entity .
827
+
828
+ :relatedTo a owl:ObjectProperty ;
829
+ rdfs:label "related to" ;
830
+ rdfs:subPropertyOf skos:related .
831
+
832
+ :references a owl:ObjectProperty ;
833
+ rdfs:label "references" ;
834
+ rdfs:subPropertyOf dcterms:references .
835
+
836
+ :source a owl:ObjectProperty ;
837
+ rdfs:label "source" ;
838
+ rdfs:domain :Highlight ;
839
+ rdfs:range schema:CreativeWork ;
840
+ rdfs:comment "Where a Highlight was extracted from." ;
841
+ rdfs:subPropertyOf dcterms:source .
842
+
843
+ # ─── URI patterns ───────────────────────────────────────────────────
844
+ :UriPattern rdfs:label "URI minting pattern" .
845
+
846
+ :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
847
+ :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
848
+ :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
849
+ :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
850
+ :note-pattern a :UriPattern ; skos:notation "urn:dkg:note:<slug>" .
851
+ :highlight-pattern a :UriPattern ; skos:notation "urn:dkg:highlight:<slug>" .
852
+ :insight-pattern a :UriPattern ; skos:notation "urn:dkg:insight:<slug>" .
853
+
854
+ :slug-normalisation a skos:Note ;
855
+ skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
856
+ `,jL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
857
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
858
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
859
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
860
+ @prefix dcterms: <http://purl.org/dc/terms/> .
861
+ @prefix schema: <http://schema.org/> .
862
+ @prefix prov: <http://www.w3.org/ns/prov#> .
863
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
864
+ @prefix dcat: <http://www.w3.org/ns/dcat#> .
865
+ @prefix fabio: <http://purl.org/spar/fabio/> .
866
+ @prefix time: <http://www.w3.org/2006/time#> .
867
+
868
+ @prefix chat: <http://dkg.io/ontology/chat/> .
869
+ @prefix : <http://dkg.io/ontology/scientific-research/> .
870
+
871
+ <http://dkg.io/ontology/scientific-research/>
872
+ a owl:Ontology ;
873
+ dcterms:title "DKG Scientific Research Project Ontology (v1)" ;
874
+ dcterms:description """Starter for empirical scientific research:
875
+ hypotheses → experiments → results → reproducibility chains. Composes
876
+ with FaBiO for scholarly works, DCAT for datasets, PROV-O for
877
+ provenance, OWL Time for sequencing.""" ;
878
+ owl:versionInfo "1.0.0" ;
879
+ dcterms:created "2026-04-18"^^xsd:date ;
880
+ owl:imports
881
+ <http://schema.org/> , <http://purl.org/dc/terms/> ,
882
+ <http://www.w3.org/ns/prov#> ,
883
+ <http://www.w3.org/2004/02/skos/core#> ,
884
+ <http://www.w3.org/ns/dcat#> ,
885
+ <http://purl.org/spar/fabio/> ,
886
+ <http://www.w3.org/2006/time#> .
887
+
888
+ # ─── Universal annotation predicates ────────────────────────────────
889
+ chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
890
+ chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
891
+ chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
892
+ chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
893
+ chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Result .
894
+ chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
895
+
896
+ # ─── Universal annotation entities ──────────────────────────────────
897
+ :Concept rdfs:subClassOf skos:Concept .
898
+ :Topic rdfs:subClassOf skos:Concept .
899
+ :Question rdfs:subClassOf schema:Question .
900
+ :Finding rdfs:subClassOf prov:Entity .
901
+
902
+ # ─── Scientific-research-specific ───────────────────────────────────
903
+
904
+ :Hypothesis a owl:Class ;
905
+ rdfs:label "Hypothesis" ;
906
+ rdfs:comment "A testable claim. Linked to Experiments via :testedBy and to Results via :supportedBy / :refutedBy." ;
907
+ rdfs:subClassOf prov:Entity .
908
+
909
+ :Experiment a owl:Class ;
910
+ rdfs:label "Experiment" ;
911
+ rdfs:comment "A defined procedure executed to test a Hypothesis. Subclass of prov:Activity for full provenance." ;
912
+ rdfs:subClassOf prov:Activity .
913
+
914
+ :Method a owl:Class ;
915
+ rdfs:label "Method" ;
916
+ rdfs:comment "A reusable methodology applied within Experiments." ;
917
+ rdfs:subClassOf prov:Plan .
918
+
919
+ :Result a owl:Class ;
920
+ rdfs:label "Result" ;
921
+ rdfs:comment "An outcome produced by an Experiment — quantitative or qualitative." ;
922
+ rdfs:subClassOf prov:Entity .
923
+
924
+ :Dataset a owl:Class ;
925
+ rdfs:label "Dataset" ;
926
+ rdfs:comment "An input or output dataset for an Experiment. Aligned with DCAT." ;
927
+ rdfs:subClassOf dcat:Dataset .
928
+
929
+ :testedBy a owl:ObjectProperty ;
930
+ rdfs:label "tested by" ;
931
+ rdfs:domain :Hypothesis ;
932
+ rdfs:range :Experiment .
933
+
934
+ :supportedBy a owl:ObjectProperty ;
935
+ rdfs:label "supported by" ;
936
+ rdfs:domain :Hypothesis ;
937
+ rdfs:range :Result .
938
+
939
+ :refutedBy a owl:ObjectProperty ;
940
+ rdfs:label "refuted by" ;
941
+ rdfs:domain :Hypothesis ;
942
+ rdfs:range :Result .
943
+
944
+ :usesDataset a owl:ObjectProperty ;
945
+ rdfs:label "uses dataset" ;
946
+ rdfs:domain :Experiment ;
947
+ rdfs:range :Dataset .
948
+
949
+ :reproducedBy a owl:ObjectProperty ;
950
+ rdfs:label "reproduced by" ;
951
+ rdfs:domain :Experiment ;
952
+ rdfs:range :Experiment ;
953
+ rdfs:comment "An Experiment that successfully reproduced this one's Results." .
954
+
955
+ # ─── URI patterns ───────────────────────────────────────────────────
956
+ :UriPattern rdfs:label "URI minting pattern" .
957
+
958
+ :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
959
+ :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
960
+ :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
961
+ :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
962
+ :hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .
963
+ :experiment-pattern a :UriPattern ; skos:notation "urn:dkg:experiment:<slug>" .
964
+ :method-pattern a :UriPattern ; skos:notation "urn:dkg:method:<slug>" .
965
+ :result-pattern a :UriPattern ; skos:notation "urn:dkg:result:<slug>" .
966
+ :dataset-pattern a :UriPattern ; skos:notation "urn:dkg:dataset:<slug>" .
967
+
968
+ :slug-normalisation a skos:Note ;
969
+ skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
970
+ `,CL=`# Book-research agent guide
971
+
972
+ This starter ships an RDF ontology for **book-research projects** —
973
+ research notebooks anchored in scholarly sources (citations, quotes,
974
+ arguments, hypotheses). The formal schema lives in \`ontology.ttl\`
975
+ alongside this guide.
976
+
977
+ For V10 MCP tool usage, see
978
+ [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
979
+ The tool surface to use against this ontology:
980
+
981
+ - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
982
+ - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
983
+ - \`dkg_knowledge_asset_share\` — share with peers (SWM)
984
+ - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
985
+ - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
986
+
987
+ The longer per-domain agent-guide walkthrough format will return when
988
+ the V10 ontology endpoint and per-project annotation workflow stabilise.
989
+ `,NL=`# Coding-project agent guide
990
+
991
+ This starter ships an RDF ontology for **coding projects** —
992
+ shared project memory for AI coding agents (decisions, tasks, code
993
+ references, GitHub activity, chat turns). The formal schema lives in
994
+ \`ontology.ttl\` alongside this guide.
995
+
996
+ For V10 MCP tool usage, see
997
+ [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
998
+ The tool surface to use against this ontology:
999
+
1000
+ - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
1001
+ - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
1002
+ - \`dkg_knowledge_asset_share\` — share with peers (SWM)
1003
+ - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
1004
+ - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
1005
+
1006
+ The longer per-domain agent-guide walkthrough format will return when
1007
+ the V10 ontology endpoint and per-project annotation workflow stabilise.
1008
+ `,EL=`# Narrative-writing agent guide
1009
+
1010
+ This starter ships an RDF ontology for **narrative-writing projects** —
1011
+ the structural elements of long-form narrative (Characters, Scenes,
1012
+ PlotPoints, Themes, Settings) and their relationships. The formal
1013
+ schema lives in \`ontology.ttl\` alongside this guide.
1014
+
1015
+ For V10 MCP tool usage, see
1016
+ [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
1017
+ The tool surface to use against this ontology:
1018
+
1019
+ - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
1020
+ - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
1021
+ - \`dkg_knowledge_asset_share\` — share with peers (SWM)
1022
+ - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
1023
+ - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
1024
+
1025
+ The longer per-domain agent-guide walkthrough format will return when
1026
+ the V10 ontology endpoint and per-project annotation workflow stabilise.
1027
+ `,TL=`# PKM agent guide
1028
+
1029
+ This starter ships an RDF ontology for **PKM (Personal Knowledge
1030
+ Management) projects** — Notes, Highlights, Insights, and the links
1031
+ that grow a knowledge garden organically. The formal schema lives in
1032
+ \`ontology.ttl\` alongside this guide.
1033
+
1034
+ For V10 MCP tool usage, see
1035
+ [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
1036
+ The tool surface to use against this ontology:
1037
+
1038
+ - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
1039
+ - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
1040
+ - \`dkg_knowledge_asset_share\` — share with peers (SWM)
1041
+ - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
1042
+ - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
1043
+
1044
+ The longer per-domain agent-guide walkthrough format will return when
1045
+ the V10 ontology endpoint and per-project annotation workflow stabilise.
1046
+ `,AL=`# Scientific-research agent guide
1047
+
1048
+ This starter ships an RDF ontology for **scientific-research projects** —
1049
+ the empirical research arc (Hypotheses → Experiments → Results →
1050
+ Reproducibility chains), anchored in PROV-O and FaBiO so the graph
1051
+ composes with existing scholarly publishing infrastructure. The formal
1052
+ schema lives in \`ontology.ttl\` alongside this guide.
1053
+
1054
+ For V10 MCP tool usage, see
1055
+ [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
1056
+ The tool surface to use against this ontology:
1057
+
1058
+ - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
1059
+ - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
1060
+ - \`dkg_knowledge_asset_share\` — share with peers (SWM)
1061
+ - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
1062
+ - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
1063
+
1064
+ The longer per-domain agent-guide walkthrough format will return when
1065
+ the V10 ontology endpoint and per-project annotation workflow stabilise.
1066
+ `,RL=/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>"{}|\\^`\x00-\x20]+$/;function _L(e){return e?RL.test(e):!1}function YS(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}const Ct={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 Na(e){return`"${YS(e)}"`}function Cu(e,t){return`"${YS(e)}"^^<${bi(t)}>`}function OL({contextGraphId:e,starterSlug:t,ttl:n,guide:r,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:Ct.rdf+"type",object:bi(Ct.owl+"Ontology")},{subject:l,predicate:Ct.rdf+"type",object:bi(Ct.prov+"Entity")},{subject:l,predicate:Ct.rdfs+"label",object:Na(`Project ontology — ${e}`)},{subject:l,predicate:Ct.schema+"name",object:Na(`Project ontology — ${e}`)},{subject:l,predicate:Ct.dcterms+"title",object:Na(`Project ontology — ${e}`)},{subject:l,predicate:Ct.dcterms+"description",object:Na(`The active ontology for context graph ${e}, derived from the '${t}' starter.`)},{subject:l,predicate:Ct.dcterms+"created",object:Cu(s,Ct.xsd+"dateTime")},{subject:l,predicate:Ct.dcterms+"modified",object:Cu(s,Ct.xsd+"dateTime")},{subject:l,predicate:Ct.dcterms+"source",object:Na(t)},{subject:l,predicate:Ct.schema+"encodingFormat",object:Na("text/turtle")},{subject:l,predicate:Ct.schema+"text",object:Na(n)},{subject:l,predicate:Ct.dcterms+"references",object:bi(u)},{subject:u,predicate:Ct.rdf+"type",object:bi(Ct.schema+"DigitalDocument")},{subject:u,predicate:Ct.rdfs+"label",object:Na(`Agent guide — ${e} ontology`)},{subject:u,predicate:Ct.schema+"name",object:Na(`Agent guide — ${e} ontology`)},{subject:u,predicate:Ct.dcterms+"title",object:Na(`Agent guide — ${e} ontology`)},{subject:u,predicate:Ct.dcterms+"created",object:Cu(s,Ct.xsd+"dateTime")},{subject:u,predicate:Ct.dcterms+"modified",object:Cu(s,Ct.xsd+"dateTime")},{subject:u,predicate:Ct.schema+"encodingFormat",object:Na("text/markdown")},{subject:u,predicate:Ct.schema+"text",object:Na(r)},{subject:u,predicate:Ct.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",...Bt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}const LL=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/ontology.ttl":xL,"../../../../mcp-dkg/templates/ontologies/coding-project/ontology.ttl":wL,"../../../../mcp-dkg/templates/ontologies/narrative-writing/ontology.ttl":kL,"../../../../mcp-dkg/templates/ontologies/pkm/ontology.ttl":SL,"../../../../mcp-dkg/templates/ontologies/scientific-research/ontology.ttl":jL}),ML=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/agent-guide.md":CL,"../../../../mcp-dkg/templates/ontologies/coding-project/agent-guide.md":NL,"../../../../mcp-dkg/templates/ontologies/narrative-writing/agent-guide.md":EL,"../../../../mcp-dkg/templates/ontologies/pkm/agent-guide.md":TL,"../../../../mcp-dkg/templates/ontologies/scientific-research/agent-guide.md":AL});function zL(){const e={};for(const[t,n]of Object.entries(LL)){const r=t.match(/ontologies\/([^/]+)\/ontology\.ttl$/);if(!r)continue;const s=r[1];e[s]={ttl:n,guide:""}}for(const[t,n]of Object.entries(ML)){const r=t.match(/ontologies\/([^/]+)\/agent-guide\.md$/);if(!r)continue;const s=r[1];e[s]&&(e[s].guide=n)}return e}const Bg=zL(),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 $L(){return DL.filter(e=>Bg[e.slug])}function IL(e){return Bg[e]??null}async function PL(e,t){const n=IL(t);if(!n)throw new Error(`Unknown ontology starter '${t}'. Available: ${Object.keys(Bg).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(u=>{if(!String((u==null?void 0:u.message)??u).includes("already exists"))throw u});const{ontologyUri:r,guideUri:s,quads:l}=OL({contextGraphId:e,starterSlug:t,ttl:n.ttl,guide:n.guide});await Nu("/api/knowledge-assets/project-ontology/wm/discard",{contextGraphId:e,subGraphName:"meta"}).catch(u=>{const d=String((u==null?void 0:u.message)??u);if(!/404|not found/i.test(d))throw u}),await Nu("/api/knowledge-assets/project-ontology/wm/write",{contextGraphId:e,subGraphName:"meta",quads:l});try{await Nu("/api/knowledge-assets/project-ontology/swm/share",{contextGraphId:e,subGraphName:"meta",entities:[r,s]})}catch{}return{ontologyUri:r,guideUri:s,tripleCount:l.length}}async function Fg(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify(t)}),r=await n.text();let s;if(r)try{s=JSON.parse(r)}catch{s={raw:r}}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 UL(e,t={}){return Fg(`/api/context-graph/${encodeURIComponent(e)}/manifest/publish`,t)}function BL(e,t){return Fg(`/api/context-graph/${encodeURIComponent(e)}/manifest/plan-install`,t)}function FL(e,t){return Fg(`/api/context-graph/${encodeURIComponent(e)}/manifest/install`,t)}const i1="dkg.wireWorkspace.parentDir",s1="dkg.wireWorkspace.nickname",o1="dkg.wireWorkspace.tools",Rh=[{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 HL(e,t){const n=t.split("/"),r=n[n.length-1]??"";return r||(e??"project").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function qL(e){if(!e)return"";const t=e.hostname.replace(/\.local$/,"").replace(/-/g," ");return`${e.username} @ ${t}`}function l1(e){return e==="both"?["cursor","claude-code"]:[e]}function KS({contextGraphId:e,projectName:t,defaultAgentNickname:n,onDone:r,onCancel:s,variant:l}){var W;const u=w.useMemo(()=>HL(t,e),[t,e]),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(""),[b,k]=w.useState(""),[j,C]=w.useState("cursor"),[S,T]=w.useState(!1),[E,A]=w.useState(null),[B,R]=w.useState(null),[D,H]=w.useState(null);w.useEffect(()=>{let I=!1;return(async()=>{try{const[$,q]=await Promise.all([fetch("/api/host/info",{headers:Bt()}).then(K=>K.ok?K.json():null),Kl().catch(()=>null)]);if(I)return;if($){f($);const K=typeof window<"u"&&window.localStorage.getItem(i1)||$.defaultWorkspaceParent;y(`${K}/${u}`)}q&&g(q);const V=typeof window<"u"&&window.localStorage.getItem(s1);n?k(n):V?k(V):$&&k(qL($));const X=typeof window<"u"&&window.localStorage.getItem(o1);X&&(X==="cursor"||X==="claude-code"||X==="both")&&C(X)}catch($){I||console.warn("[WireWorkspacePanel] host info / identity fetch failed:",$)}})(),()=>{I=!0}},[u,n]);function M(I){typeof window>"u"||(window.localStorage.setItem(i1,I),b&&window.localStorage.setItem(s1,b),window.localStorage.setItem(o1,j))}async function _(){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 BL(e,{workspaceRoot:I,agentNickname:b.trim(),tools:l1(j)});R($);const q=I.lastIndexOf("/");q>0&&M(I.slice(0,q))}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 FL(e,{workspaceRoot:I,agentNickname:b.trim(),tools:l1(j)});H($)}catch(I){A((I==null?void 0:I.message)||"Install failed")}finally{T(!1)}}if(D)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:[D.written.map(I=>`${I.action.padEnd(9)} ${I.absPath} (${I.bytesWritten.toLocaleString()} bytes)`).join(`
1067
+ `),D.skipped.length?`
1068
+
1069
+ Skipped:
1070
+ `+D.skipped.map(I=>` - ${I}`).join(`
1071
+ `):"",D.warnings.length?`
1072
+
1073
+ Warnings:
1074
+ `+D.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:r,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:()=>{R(null),A(null)},disabled:S,children:"← Back"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{className:"v10-modal-btn",onClick:r,disabled:S,children:"Skip for now"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:P,disabled:S,children:S?"Installing…":"Install"})]})]})]});const F=((W=Rh.find(I=>I.value===j&&!I.disabled))==null?void 0:W.description)??Rh[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=>C(I.target.value),children:Rh.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:r,disabled:S,children:"Skip for now"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:_,disabled:S||!m.trim()||!b.trim(),children:S?"Loading preview…":"Preview install"})]})]})}const c1='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),r=w.useRef(null);w.useEffect(()=>{if(e)return r.current=document.activeElement??null,queueMicrotask(()=>{const l=n.current;if(!l)return;const u=l.querySelector(c1),f=l.querySelector("[autofocus]")??u;f?f.focus():(l.hasAttribute("tabindex")||l.setAttribute("tabindex","-1"),l.focus())}),()=>{var l,u;(u=(l=r.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(c1)).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,GL=/<\/?[a-z][^>]*>/i,VL=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,WL=/[a-z0-9]/i;function ZL(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 QS(e){if(typeof e!="string")return"";let t=ZL(e);return t=t.replace(/[<>]/g,""),t=t.replace(VL,""),t=t.replace(/\s+/g," "),t=t.trim(),t.length>co&&(t=t.slice(0,co)),t}function u1(e){const t=QS(e);return t?WL.test(t)?GL.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 d1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function YL({open:e,onClose:t}){var ut,ye;const[n,r]=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=$L(),[j,C]=w.useState(((ut=k[0])==null?void 0:ut.slug)??"coding-project"),[S,T]=w.useState(!1),[E,A]=w.useState("off"),[B,R]=w.useState("7d"),[D,H]=w.useState("100k"),[M,_]=w.useState(!1),[P,F]=w.useState(""),[W,I]=w.useState(null),[$,q]=w.useState(null),[V,X]=w.useState(null),[K,L]=w.useState(null),[U,G]=w.useState(""),[O,ne]=w.useState(!0),[ue,le]=w.useState(!1),{setContextGraphs:be,contextGraphs:Re,setActiveProject:Ee}=Ta(),{openTab:Ie}=pn(),{setStage:We,stage:Se}=Ug(),ft=()=>{ne(!0),le(!1),Kl().then(Q=>{X(Q.agentAddress),le(!1)}).catch(()=>{X(null),le(!0)}).finally(()=>ne(!1))};w.useEffect(()=>{e&&(q(null),ft())},[e]);const ze=Ji(e&&!K,t),qe=Ji(e&&!!K,()=>{L(null),G(""),q(null),r(""),l(""),t()});if(!e)return null;const ke=QS(n),lt=d1(ke),xe=V&&lt?`${V}/${lt}`:lt?`<agent-address>/${lt}`:"",Oe=n?u1(n):null,_t=Q=>{r(Q)},Dt=async()=>{const Q=ke;if(!Q||Oe)return;_(!0),I(null),q(null),F(g?"Registering context graph on the network…":"Creating context graph locally…");const Z=d1(Q);if(!V){I("Agent identity is still loading. Please wait a moment and try again."),_(!1);return}const ee=`${V}/${Z}`;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 hR(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),q(Ne)}if(y==="community"||y==="agent")try{F(`Installing '${j}' ontology…`),await PL(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 UL(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 Md();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(()=>{r(""),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{_(!1)}},Yt=Re.length===0;function Ht(){L(null),G(""),q(null),r(""),l(""),t()}return K?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:Ht,"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(KS,{contextGraphId:K,projectName:U,variant:"create",onDone:Ht})]})]})}):o.jsx("div",{className:"v10-modal-overlay",onClick:ze.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:ze.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:[W&&o.jsx("div",{className:"v10-modal-error",children:W}),$&&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=>_t(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=>C(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:D,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:Dt,disabled:!n.trim()||!!u1(n)||M||!V||O,children:M?P||"Creating…":V?"Create Context Graph":ue?"Agent unavailable":"Loading agent…"})]})]})})}const p1=/^(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|12D3Koo[1-9A-HJ-NP-Za-km-z]{45,53})$/;function KL(e){var b;const t=e.trim().replace(/\\n/g,`
1076
+ `),n=t.split(`
1077
+ `).map(k=>k.trim()).filter(Boolean),r=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&&p1.test(k[1])&&(h=k[1])}else for(const k of[s,...n.slice(1)]){const j=k.trim();if(p1.test(j)){h=j;break}}let g=r;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 Cn&&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("; "),r=t.some(e4),s=r?"Curator rejected this join request.":"Couldn't deliver this join request to the curator.",l=t4(n,r);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[r,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:C,setActiveProject:S}=Ta(),{openTab:T}=pn();w.useEffect(()=>{n&&s(n)},[n]),w.useEffect(()=>{e||(s(n??""),f(null),u("idle"),g(null))},[e,n]);const E=w.useCallback(async W=>{u("approved");try{const{contextGraphs:I}=await Md();C(I??[]);const $=I==null?void 0:I.find(q=>q.id===W);$&&(S($.id),T({id:`project:${$.id}`,label:$.name||$.id,closable:!0}),k($.name??W),y(W))}catch{}},[C,S,T]),A=w.useCallback(W=>{var $;if(!(!h||W.type!=="join_approved"&&W.type!=="join_rejected"||(($=W.data)==null?void 0:$.contextGraphId)!==h)){if(W.type==="join_rejected"){u("rejected");return}E(h)}},[h,E]);is(A);const B=Ji(e&&!m,t),R=Ji(e&&!!m,()=>{y(null),k(""),t()});if(!e)return null;const D=async()=>{const W=KL(r),I=QL(W);if(I){f(I);return}const{cgId:$,curatorPeerId:q,legacyMultiaddr:V}=W;f(null);const X=j.find(K=>K.id===$);if(X){S(X.id),T({id:`project:${X.id}`,label:X.name||X.id,closable:!0}),t();return}u("sending");try{q?await uR(q).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 cR(V).catch(()=>{}));const K=await gR($),L=await Kl().then(G=>G.name).catch(()=>{}),U=await vR($,{delegation:K.delegation,agentName:L,curatorPeerId:q??void 0});if(g($),U.alreadyMember){await E($);return}u("pending")}catch(K){f(XL(K)),u("idle")}};function H(){y(null),k(""),t()}if(m)return o.jsx("div",{className:"v10-modal-overlay",onClick:R.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:R.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-join-wire-title",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:H,"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(KS,{contextGraphId:m,projectName:b,variant:"join",onDone:H})})]})});const M=l==="sending",_=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}),_&&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:r,onChange:W=>s(W.target.value),autoFocus:!0,rows:3,disabled:M||_||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:_||P?"Close":"Cancel"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:D,disabled:!r.trim()||M||_||P,children:M?"Sending request…":_?"Awaiting approval…":P?"Approved":"Request to Join"})]})]})})}const XS="v10:hiddenProjectIds",Am="v10:hidden-projects-change";function _h(){try{const e=localStorage.getItem(XS);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t:[])}catch{return new Set}}function f1(e){try{localStorage.setItem(XS,JSON.stringify([...e])),window.dispatchEvent(new Event(Am))}catch{}}function Hg(){const[e,t]=w.useState(()=>_h());w.useEffect(()=>{const s=()=>t(_h());return window.addEventListener(Am,s),window.addEventListener("storage",s),()=>{window.removeEventListener(Am,s),window.removeEventListener("storage",s)}},[]);const n=w.useCallback(s=>{const l=new Set(_h());l.add(s),f1(l)},[]),r=w.useCallback(()=>{f1(new Set)},[]);return{hidden:e,hide:n,unhideAll:r}}function qg(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 Xt(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 Id(e,t){var n,r;return e.callerInvolved===!0?!0:e.callerInvolved===!1||!((n=t==null?void 0:t.agentDid)!=null&&n.trim())?!1:!!((r=e.curator)!=null&&r.trim()&&Xt(e.curator)===Xt(t.agentDid))}function a4(e,t,n){const r=e.filter(s=>Id(s,t));if(n&&!r.some(s=>s.id===n)){const s=e.find(l=>l.id===n);if(s)return[s,...r]}return r}function r4(e,t){return Id(e,t)||uo(e.accessPolicy)!=="public"?!1:e.subscribed===!0||e.synced===!0}function h1({cg:e,isActive:t,onSelect:n,onHide:r}){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(),r()},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,r]=w.useState(null),s=w.useCallback(()=>{Dd().then(l=>{t(l.integrations),r(null)}).catch(l=>r(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=Gn($=>$.leftSectionMyProjectsOpen),t=Gn($=>$.leftSectionIntegrationsOpen),n=Gn($=>$.toggleLeftSectionMyProjects),r=Gn($=>$.toggleLeftSectionIntegrations),s=w.useId(),l=w.useId(),{openTab:u,activeTabId:d,setActiveTab:f}=pn(),{contextGraphs:h,setContextGraphs:g,setLoading:m,activeProjectId:y,setActiveProject:b}=Ta(),k=Ug($=>$.stage),[j,C]=w.useState("explorer"),{hidden:S,hide:T,unhideAll:E}=Hg(),A=$d().data,B=A?qg(A):null,R=h.filter($=>!S.has($.id)),D=R.filter($=>Id($,B)),H=R.filter($=>r4($,B)),M=h.length-R.length,[_,P]=w.useState(!1),[F,W]=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:()=>W(!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:()=>C("explorer"),children:"Context Graphs"}),o.jsx("button",{className:`v10-tree-mode-btn ${j==="oracle"?"active":""}`,onClick:()=>C("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(Nm,{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:D.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."})}):D.map($=>o.jsx(h1,{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:r,children:[o.jsx(Nm,{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:[H.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-tree-group-label",children:"Context Oracle"}),H.map($=>o.jsx(h1,{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))]}),H.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(YL,{open:_,onClose:()=>P(!1)}),o.jsx(n4,{open:F,onClose:()=>W(!1)})]})}function oa(e,t=[],n=0){const[r,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:r,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 m1(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 r=new Date(t);if(r.setDate(t.getDate()-1),n.toDateString()===r.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 g1(e,t=8){return e?e.length<=t*2?e:e.slice(0,t)+"..."+e.slice(-4):"—"}function c4(){const e=Ta(m=>m.contextGraphs),t=Ta(m=>m.setContextGraphs),{hidden:n}=Hg(),[r,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(qg(y))}).catch(()=>{}).finally(()=>{m&&u(!1)}),()=>{m=!1}},[e]),{myCgs:w.useMemo(()=>e.filter(m=>!n.has(m.id)).filter(m=>Id(m,r)),[e,n,r]),identity:r,identityLoading:l,cgsLoading:d}}const Gg=["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 Pd(e={}){const t={predicates:[...e.extraPredicates??[],...Gg]};return e.minZoomForLabels!==void 0&&(t.minZoomForLabels=e.minZoomForLabels),t}function Ud(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 v1="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 Ku(e){const t=yt(e);return!t||t.startsWith('"')||/\s/.test(t)?!1:t.startsWith("_:")?!0:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function yt(e){const t=e.trim();return t.startsWith('"')?t:t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function ao(e){if(!e)return"—";if(e.startsWith('"'))return Ud(e);const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function Vg(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=e.lastIndexOf(":"),s=Math.max(t,n,r),l=s>=0?e.slice(s+1):e;try{return decodeURIComponent(l)}catch{return l}}function u4(e){const t=Vg(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&&Ku(t)}function f4(e){const t=u4(e.uri),n=e.types.map(ao).find(r=>r&&r!=="Thing"&&r!=="Entity");return/^urn:dkg:extraction:[^\s]+$/i.test(e.uri)?t?`Extraction ${t}`:"Extraction":n?t&&t!==n?`${n} ${t}`:n:t||ao(e.uri)}function h4(e){for(const n of Gg){const r=e.properties.get(n),s=r==null?void 0:r.find(l=>l.trim().length>0);if(s)return s}const t=ao(e.uri);return e.label&&(e.label!==t||!p4(e.label,e.uri))&&!d4(e.label,e.uri)?e.label:f4(e)}const JS=5e4,ej=2e4,tj=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 ${JS}`}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 ${ej}`}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 ${tj}`}function y4(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),s=r.indexOf("/"),l=s>=0?r.slice(0,s):r;if(!(!l||l.startsWith("_")||l==="assertion"||l==="meta"))return l}const y1={wm:"loading",swm:"loading",vm:"loading"},b4={wm:"error",swm:"error",vm:"error"};async function Oh(e,t,n){var r,s;try{const{layerLimit:l,...u}=n??{},d={sparql:e,contextGraphId:t,...u},f=await ld(d),h=((r=f==null?void 0:f.result)==null?void 0:r.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,r=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=yt(h);let m=t.get(g);return m||(m={uri:g,label:ao(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===v1){const m=yt(h.object);g.types.includes(m)||g.types.push(m)}else if(Ku(h.object)){const m=yt(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:ao(m)}))}else{const m=r.get(g.uri)??new Set,y=`${h.predicate}\0${h.object}`;if(!m.has(y)){m.add(y),r.set(g.uri,m);const b=g.properties.get(h.predicate)??[];b.push(Ud(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=yt(h.subject),m=t.get(g);if(m&&m.trustLevel!==h.layer)continue;const y=Ku(h.object)?yt(h.object):h.object,b=Ku(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===v1){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)??ao(g.targetUri);return t}const nj=x4;function aj(e){return e.types.length>0||e.properties.size>0||e.connections.length>0}function Wg(e,t){const n=(t==null?void 0:t.signalErrors)??!1,[r,s]=w.useState([]),[l,u]=w.useState(!0),[d,f]=w.useState(null),[h,g]=w.useState(!1),[m,y]=w.useState(y1),b=w.useRef(0),k=w.useCallback(async()=>{if(!e)return;const A=++b.current;u(!0),f(null),g(!1),y(y1);try{const B={includeContextGraphPartitions:!0},[R,D,H]=await Promise.all([Oh(m4(e),e,{...B,layerLimit:JS}),Oh(g4(e),e,{...B,layerLimit:ej}),Oh(v4(e),e,{...B,layerLimit:tj})]);if(A!==b.current)return;const M=[...R.triples.map(W=>({...W,layer:"working"})),...D.triples.map(W=>({...W,layer:"shared"})),...H.triples.map(W=>({...W,layer:"verified"}))];s(M),y({wm:R.ok?"ok":"error",swm:D.ok?"ok":"error",vm:H.ok?"ok":"error"});const _=[R,D,H],P=_.filter(W=>!W.ok).length,F=_.some(W=>W.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(()=>nj(r),[r]),C=w.useMemo(()=>[...j.values()].filter(aj).sort((A,B)=>{const R={verified:0,shared:1,working:2},D=R[A.trustLevel]-R[B.trustLevel];if(D!==0)return D;const H=A.tripleCount??0,M=B.tripleCount??0;return M!==H?M-H:A.label.localeCompare(B.label)}),[j]),S=w.useMemo(()=>{const A=new Set;return r.filter(B=>{const R=`${B.subject}|${B.predicate}|${B.object}`;return A.has(R)?!1:(A.add(R),!0)}).map(({subject:B,predicate:R,object:D,subGraph:H})=>({subject:B,predicate:R,object:D,subGraph:H}))},[r]),T=w.useMemo(()=>{const A=new Map;for(const[B,R]of j)A.set(B,R.trustLevel);return A},[j]),E=w.useMemo(()=>{let A=0,B=0,R=0;for(const D of C)D.trustLevel==="verified"?R++:D.trustLevel==="shared"?B++:A++;return{wm:A,swm:B,vm:R,total:C.length}},[C]);return{entities:j,entityList:C,allTriples:r,graphTriples:S,trustMap:T,counts:E,loading:l,error:d,partial:h,layerStatus:m,refresh:k}}const Jl="http://dkg.io/viz/",rj=`${Jl}OnChainAnchor`,ij=`${Jl}AgentIdentity`,sj=`${Jl}anchoredIn`,oj=`${Jl}signedBy`,lj=`${Jl}consensus`,b1="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",x1="http://schema.org/name",w1="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 r=new Date(e.publishedAt).toISOString().slice(11,16);return`anchor ${t} · ${r}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 r=e.slice(n.length),s=r.indexOf("/");if(s<0)return;const l=r.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=[],r=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:b1,object:rj,subGraph:s.subGraph}),n.push({subject:u,predicate:x1,object:`"${w4(s)}"`,subGraph:s.subGraph}),n.push({subject:u,predicate:w1,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:sj,object:u,subGraph:s.subGraph}),n.push({subject:d,predicate:lj,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:oj,object:h,subGraph:s.subGraph}),r.has(h)||(r.add(h),n.push({subject:h,predicate:b1,object:ij,subGraph:s.subGraph}),n.push({subject:h,predicate:x1,object:`"${k4(f)}"`,subGraph:s.subGraph}),n.push({subject:h,predicate:w1,object:`"${f}"`,subGraph:s.subGraph}))}}return n}function E4(e,t){const[n,r]=w.useState([]),[s,l]=w.useState(!1),[u,d]=w.useState(null),f=w.useRef(0);w.useEffect(()=>{if(!e){r([]),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",...Bt()},body:JSON.stringify({sparql:S4(e)})});if(!k.ok)throw new Error(`SPARQL query failed: ${k.status}`);const j=await k.json(),C=((b=j==null?void 0:j.result)==null?void 0:b.bindings)??[],S=new Map;for(const T of C){const E=gl(T.op),A=gl(T.root),B=gl(T.agent),R=gl(T.publishedAt),D=gl(T.g);if(!E||!A||!B||!R)continue;let H=S.get(E);H||(H={opId:C4(E),opUri:E,agents:[],roots:[],publishedAt:R,subGraph:D?j4(D,e):void 0},S.set(E,H)),H.roots.includes(A)||H.roots.push(A),H.agents.includes(B)||H.agents.push(B)}if(y!==f.current)return;r([...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"),r([])}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 Ki={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/",R4=wo+"createdBy",_4=wo+"promotedBy",O4=wo+"publishedBy",L4=wo+"createdAt",M4=wo+"promotedAt",z4=wo+"publishedAt";function Bd(e){for(const t of e.connections)if(t.predicate===A4)return t.targetUri;return null}function D4(e,t){const n=t==="created"?R4:t==="promoted"?_4:O4;for(const r of e.connections)if(r.predicate===n)return r.targetUri;return Bd(e)}function $4(e,t){const n=t==="created"?L4:t==="promoted"?M4:z4,r=e.properties.get(n);return(r==null?void 0:r[0])??null}function k1(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function Ws(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return(r>=0?e.slice(r+1):e).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ")}function Fd(e,t){var s,l;if(t)for(const u of e.types){const d=t.forType(u),f=k1(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]?k1(e.types[0]):"Entity";return{...Vs[n]??Vs.Thing,type:n}}const Dn={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 ir(e,t=2){const n=e==="working"?"wm":e==="shared"?"swm":e==="verified"?"vm":e,r=t!==1;return n==="vm"?r?"Knowledge Assets":"Knowledge Asset":r?"Entities":"Entity"}const qn="http://dkg.io/ontology/code/",cj={[qn+"Package"]:"#a855f7",[qn+"File"]:"#3b82f6",[qn+"Class"]:"#22c55e",[qn+"Interface"]:"#06b6d4",[qn+"Function"]:"#f59e0b",[qn+"TypeAlias"]:"#ec4899",[qn+"Enum"]:"#ef4444",[qn+"ExternalModule"]:"#64748b",[rj]:"#f5a524",[ij]:"#c084fc"},uj={[qn+"imports"]:"#60a5fa",[qn+"contains"]:"#a855f7",[qn+"definedIn"]:"#3b82f6",[qn+"exports"]:"#f59e0b",[qn+"extends"]:"#22c55e",[qn+"implements"]:"#06b6d4",[sj]:"#f5a524",[oj]:"#c084fc",[lj]:"#22c55e"};function Zg(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}=Dn[e],r=e==="vm";return{labelMode:"humanized",renderer:"2d",labels:Pd({minZoomForLabels:r?.2:.3}),style:{classColors:cj,predicateColors:uj,namespaceColors:Zg(n),...t&&Object.keys(t).length>0?{nodeColors:t}:{},defaultNodeColor:n,defaultEdgeColor:r?"#4ade80":"#64748b",edgeWidth:r?1.8:1.2,fontSize:r?12:11,gradient:!0,gradientIntensity:r?.65:.4},hexagon:{baseSize:r?13:11,minSize:r?8:7,maxSize:r?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 r=e.properties.get(n);if(r!=null&&r[0])return r[0]}return null}function U4(e,t,n=2){const r=d=>yt(d.subject),s=d=>yt(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=r(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(r(d))&&l.has(s(d)))}function dj(e,t){const n=t.lastIndexOf("/"),r=t.lastIndexOf("#"),s=t.lastIndexOf(":"),l=Math.max(n,r,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 Yg(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 Rm(e,t){return!t.isRoot&&e.subGraph===t.slug?!0:e.subGraph?!1:t.scopedUris.has(e.subject)?!0:t.requireResourceObject?Yg(e.object)&&t.scopedUris.has(e.object):t.scopedUris.has(e.object)}function pj(e,t){const n=t.get(yt(e.subject));return n!==void 0&&n.trustLevel!==e.layer}function fj(e,t){if(!Yg(e.object))return!1;const n=t.get(yt(e.object));return n!==void 0&&n.trustLevel!==e.layer}function hj(e,t){return pj(e,t)||fj(e,t)}function mj(e,t){return pj(e,t)&&fj(e,t)}function _m(e,t){const n=new Set,r=[];for(const s of e){if(mj(s,t))continue;const l=`${yt(s.subject)}|${s.predicate}|${yt(s.object)}`;n.has(l)||(n.add(l),r.push(s))}return r}function Kg(e){return w.useMemo(()=>{const t=_m(e.allTriples,e.entities);return{triples:t,total:t.length}},[e.allTriples,e.entities])}function gj(e){return w.useMemo(()=>{const t=new Set,n=new Set,r=new Set,s=new Set;let l=0,u=0,d=0,f=0;for(const h of e.allTriples){const g=`${yt(h.subject)}|${h.predicate}|${yt(h.object)}`;!mj(h,e.entities)&&!s.has(g)&&(s.add(g),f++),hj(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"&&!r.has(g)&&(r.add(g),d++))}return{wm:l,swm:u,vm:d,canonical:f}},[e.allTriples,e.entities])}function B4(e,t){const n=Dn[t].trustLevel;return w.useMemo(()=>{const r=new Set,s=[];for(const l of e.allTriples){if(l.layer!==n||hj(l,e.entities))continue;const u=`${yt(l.subject)}|${l.predicate}|${yt(l.object)}`;r.has(u)||(r.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 md(e,t,n){const r=[],s=n==null?void 0:n.focalSubjects;for(const l of e){const u=yt(l.subject);!t.has(u)&&!(s!=null&&s.has(u))||Yg(l.object)&&!H4(l.predicate)&&!t.has(yt(l.object))||r.push(l)}return r}const Lh="http://dkg.io/ontology/sourceContentType",S1="http://dkg.io/ontology/markdownForm",j1="http://dkg.io/ontology/sourceFile",C1="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("-"),r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=Math.max(0,Math.min(11,parseInt(n,10)-1));return`${r[s]} ${t}`}function Qu(e,t){const n=e.properties.get(t),r=n==null?void 0:n[0];if(!r)return null;const s=r.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 r=Math.floor(n/60);if(r<60)return`${r}m ago`;const s=Math.floor(r/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 Y4(e){if(e==null)return"—";const t=e/100;return`${t%1===0?t.toFixed(0):t.toFixed(1)}%`}function K4(){HS();const e=kg(l=>{var u;return(u=l.nodeStatus)==null?void 0:u.nodeRole}),t=pn(l=>l.openTab),{covered:n,bestCoveringDiscountBps:r,walletsInconclusive:s}=FS();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?`${Y4(r)} 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.",Om=[{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 Mh(e){var s;const t=GS(e);if(e==null)return{name:"Unknown chain",gas:t};const n=String(e);if(Tu[n])return{name:Tu[n],gas:t};const r=(s=n.match(/(\d+)\s*$/))==null?void 0:s[1];return r&&Tu[r]?{name:Tu[r],gas:t}:{name:r?`Chain ${r}`:`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 zh({label:e,value:t,sub:n,accentColor:r,children:s,icon:l,className:u}){return o.jsxs("div",{className:`stat-card v10-anim-mount${u?` ${u}`:""}`,children:[r&&o.jsx("div",{className:"accent",style:{background:r}}),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 N1({counts:e}){const t=e.wm+e.swm+e.vm,n=Om.map(r=>`${r.short} ${e[r.key]}`).join(" · ");return o.jsx("div",{className:"v10-layerbar","aria-label":n,children:t===0?o.jsx("span",{className:"v10-layerbar-empty"}):Om.map(r=>{const s=e[r.key]/t*100;return s<=0?null:o.jsx("span",{className:"v10-layerbar-seg",title:`${r.label} (${e[r.key]}) — ${r.desc}`,style:{width:`${s}%`,background:r.color}},r.key)})})}function X4(){return o.jsx("div",{className:"v10-layer-legend",children:Om.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 r=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:r===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/r*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/r*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:r}){var D,H;const s=Wg(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(_=>{g.current&&M===m.current&&(u((_.allowedAgents??[]).map(Xt)),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 _=((P=M.data)==null?void 0:P.contextGraphId)??((F=M.data)==null?void 0:F.projectId);_&&_!==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(),_=M?Xt(M):null;if(l===null)return d&&_?[_]:null;const P=new Set(l);return _&&P.add(_),[...P]},[l,d,e.curator,b]),j=Number.isFinite(e.assetCount??e.assets)?e.assetCount??e.assets:0,C=w.useMemo(()=>{if(s.error)return{wm:0,swm:0,vm:0,total:j};const M=new Set(s.allTriples.map(_=>_.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=gj(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,C.wm,C.swm,C.vm,C.total,T.wm,T.swm,T.vm,T.total,k?k.slice().sort().join(","):"∅"].join("|");w.useEffect(()=>{n(e.id,{entities:C,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",R=!!((D=e.curator)!=null&&D.trim()&&((H=t==null?void 0:t.agentDid)!=null&&H.trim())&&Xt(e.curator)===Xt(t.agentDid));return o.jsxs("button",{className:"v10-cg-row",onClick:()=>r(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(xO,{size:13,"aria-hidden":"true"}):A==="public"?o.jsx(gO,{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(C.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(C.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(C.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-${R?"curator":"joined"}`,children:R?"CURATOR":"JOINED"})})]})}const E1={wm:0,swm:0,vm:0,total:0};function tM(){var R,D;const{data:e}=oa(An.fetchStatus,[],1e4),{data:t}=oa(An.fetchEconomics,[],6e4),{data:n,loading:r,error:s}=oa(An.fetchWalletsBalances,[],3e4),{openTab:l}=pn(),{setActiveProject:u}=Ta(),{myCgs:d,identity:f,identityLoading:h,cgsLoading:g}=c4(),m=(h||g)&&d.length===0,[y,b]=w.useState({}),k=w.useCallback((H,M)=>{b(_=>{var P;return((P=_[H])==null?void 0:P.sig)===M.sig?_:{..._,[H]:M}})},[]);w.useEffect(()=>{const H=new Set(d.map(M=>M.id));b(M=>{const _=Object.keys(M);if(_.every(F=>H.has(F)))return M;const P={};for(const F of _)H.has(F)&&(P[F]=M[F]);return P})},[d]);const j=w.useMemo(()=>{const H={...E1},M={...E1},_=new Set;let P=!1,F=!1,W=!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&&(W=!0),X.sizeFallback&&($=!0),(X.agentsError||X.agentsUnknown)&&(I=!0);for(const K of["wm","swm","vm","total"])H[K]+=X.entities[K],M[K]+=X.triples[K];for(const K of X.agents)_.add(K)}const q=d.length>0;return{entities:H,triples:M,agentCount:_.size,sizeLoading:q&&P,agentsLoading:q&&F,sizePartial:W,agentsPartial:I,triplesUnknown:q&&W&&M.total===0,sizeApprox:q&&$,hasCgs:q}},[d,y]),C=w.useMemo(()=>{var P,F;const H=(P=f==null?void 0:f.agentDid)!=null&&P.trim()?Xt(f.agentDid):null;let M=0,_=0;for(const W of d)!!(H&&((F=W.curator)!=null&&F.trim())&&Xt(W.curator)===H)?M++:_++;return{curator:M,joined:_}},[d,f]),S=[{label:"24h",display:"Last 24h"},{label:"7d",display:"Last 7d"},{label:"30d",display:"Last 30d"}],T=H=>{if(H==null||typeof H=="string"&&H.trim()==="")return"—";const M=Number(H);return isFinite(M)?M.toLocaleString(void 0,{maximumFractionDigits:M>=1e3?0:2}):String(H)},E=S.map(H=>{var _;const M=(_=t==null?void 0:t.periods)==null?void 0:_.find(P=>P.label===H.label);return{display:H.display,publishes:M?String(M.publishCount):"—",trac:M?T(M.totalTrac):"—"}});n!=null&&n.symbol;const A=(n==null?void 0:n.balances)??[],B=H=>H.length>12?`${H.slice(0,6)}…${H.slice(-4)}`:H;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?` · ${Mh(n.chainId).name}`:""]})]}),o.jsxs("div",{className:"v10-dash-stats v10-dash-stats-3",children:[o.jsx(zh,{label:"My Context Graphs",className:"v10-stat-tight",icon:o.jsx(Jx,{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:C.curator,joined:C.joined,refreshing:h}):null}),o.jsxs(zh,{label:"Context Graph Size",icon:o.jsx(EO,{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(N1,{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(N1,{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(zh,{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(Jx,{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(H=>o.jsx(eM,{cg:H,identity:f,onReport:k,onOpen:M=>{u(M.id),l({id:`project:${M.id}`,label:M.name||M.id.slice(0,12),closable:!0})}},H.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(LO,{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:Mh(n.chainId).name})]}):null,o.jsx("div",{className:"v10-ws-subhead",children:"Node wallets"}),r&&!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 (",Mh(n==null?void 0:n.chainId).gas,")"]})]}),A.map(H=>o.jsxs("div",{className:"v10-ws-wrow",children:[o.jsx("span",{className:"v10-ws-addr",title:H.address,children:B(H.address)}),o.jsx("span",{className:"v10-ws-bal",children:T(H.trac)}),o.jsx("span",{className:"v10-ws-bal-sec",title:Z4(H.eth),children:W4(H.eth)})]},H.address))]}):(((R=n==null?void 0:n.wallets)==null?void 0:R.length)??0)>0?o.jsx("ul",{className:"v10-ws-wallets",children:((n==null?void 0:n.wallets)??[]).map(H=>o.jsxs("li",{className:"v10-ws-wallet",children:[o.jsx("span",{className:"v10-ws-addr",title:H,children:B(H)}),o.jsx("span",{className:"v10-cg-dim",children:"—"})]},H))}):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||(((D=n==null?void 0:n.wallets)==null?void 0:D.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(H=>o.jsxs("div",{className:"v10-ws-spend-row",children:[o.jsx("span",{className:"v10-cg-dim",children:H.display}),o.jsx("span",{className:"v10-ws-spend-val",children:H.publishes}),o.jsx("span",{className:"v10-ws-spend-val",children:H.trac})]},H.display))]}),o.jsx(K4,{})]})]})]})}const nM=new Set(["meta"]),$a="__root__";function Qg(e){return!nM.has(e.name)}const aM=".md, .docx, .pdf, .txt, .csv, .json, .ttl, .rdf, .owl, .py, .ts, .js, .tsx, .jsx, .java, .go, .rs, .c, .cpp, .html, .xml, .yaml, .yml";function T1(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function rM(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:r}){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([]),[C,S]=w.useState(null),[T,E]=w.useState(!1),A=w.useRef(null),B=w.useCallback(K=>{const L=Array.from(K);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()}`}))]})},[]),R=K=>{l(L=>L.filter(U=>U.id!==K))},D=K=>{K.preventDefault(),K.stopPropagation(),E(!0)},H=K=>{K.preventDefault(),K.stopPropagation(),E(!1)},M=K=>{K.preventDefault(),K.stopPropagation(),E(!1),K.dataTransfer.files.length>0&&B(K.dataTransfer.files)},_=async()=>{if(s.length===0)return;m("uploading"),b(0),j([]),S(null);const K=[];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 OS(ne,n,G),le=ue.extraction.tripleCount??ue.extraction.triplesWritten;K.push({fileName:G.name,status:ue.extraction.status==="completed"?"success":ue.extraction.status==="skipped"?"skipped":"error",triplesWritten:le,error:ue.extraction.error})}catch(ue){K.push({fileName:G.name,status:"error",error:(ue==null?void 0:ue.message)??"Upload failed"})}}j(K),b(s.length);const L=K.some(U=>U.status==="error");m(L?"error":"done")},P=()=>{g!=="uploading"&&(l([]),j([]),m("idle"),S(null),b(0),t())},{dialogRef:F,onBackdropClick:W}=Ji(e,P);if(!e)return null;const I=k.reduce((K,L)=>K+(L.triplesWritten??0),0),$=k.filter(K=>K.status==="success").length,q=k.filter(K=>K.status==="skipped").length,V=k.filter(K=>K.status==="error").length;return o.jsx("div",{className:"v10-modal-overlay",onClick:W,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:r?o.jsxs(o.Fragment,{children:["Upload files to ",o.jsx("strong",{children:r})," — 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:[C&&o.jsx("div",{className:"v10-modal-error",children:C}),g==="idle"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`v10-import-dropzone ${T?"drag-over":""}`,onClick:()=>{var K;return(K=A.current)==null?void 0:K.click()},onDragOver:D,onDragLeave:H,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: ",aM]}),o.jsx("input",{ref:A,type:"file",multiple:!0,style:{display:"none"},onChange:K=>{K.target.files&&B(K.target.files),K.target.value=""}})]}),s.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-import-file-list",children:s.map(K=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:rM(K.file.name)}),o.jsx("span",{className:"v10-import-file-name",children:K.file.name}),o.jsx("span",{className:"v10-import-file-size",children:T1(K.file.size)}),o.jsx("button",{className:"v10-import-file-remove",onClick:()=>R(K.id),title:"Remove",children:"×"})]},K.id))}),o.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginBottom:12},children:[s.length," file",s.length!==1?"s":""," selected · ",T1(s.reduce((K,L)=>K+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."]})]}),q>0&&o.jsxs(o.Fragment,{children:[$>0?" ":"","Stored ",q," file",q!==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",q>0&&o.jsxs(o.Fragment,{children:[", ",q," 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((K,L)=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:K.status==="success"?"✓":K.status==="skipped"?"–":"✗"}),o.jsx("span",{className:"v10-import-file-name",children:K.fileName}),o.jsx("span",{className:"v10-import-file-size",style:K.status==="error"?{color:"var(--text-danger)"}:void 0,children:K.status==="success"&&K.triplesWritten!=null?`${K.triplesWritten} triples`:K.status==="skipped"?"stored (no extraction)":K.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:_,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:r}){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([]),[C,S]=w.useState(null),[T,E]=w.useState("allowlist");w.useEffect(()=>{e&&(fetch("/api/status",{headers:Bt()}).then(P=>P.json()).then(P=>{typeof(P==null?void 0:P.peerId)=="string"&&P.peerId.length>0&&d(P.peerId)}).catch(()=>{}),RS(n).then(P=>h(P.allowedAgents)).catch(()=>h([])),Ng().then(P=>{const F=(P.agents??[]).filter(W=>W.connectionStatus!=="self");b(F)}).catch(()=>b([])),_S(n).then(P=>j(P.requests)).catch(()=>j([])))},[e,n]);const{dialogRef:A,onBackdropClick:B}=Ji(e,t);if(!e)return null;const R=u?`${n}
1128
+ ${u}`:null,D=(P,F)=>{navigator.clipboard.writeText(P).then(()=>{l(F),setTimeout(()=>l(null),2e3)}).catch(()=>{})},H=async P=>{try{await mR(n,P),h(F=>F.filter(W=>W!==P))}catch{}},M=async P=>{S(P);try{await Eg(n,P),j(F=>F.filter(W=>W.agentAddress!==P)),h(F=>[...new Set([...F,P])])}catch(F){m((F==null?void 0:F.message)||"Failed to approve")}finally{S(null)}},_=async P=>{S(P);try{await Tg(n,P),j(F=>F.filter(W=>W.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:r}),"."]})]}),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(W=>{var I;return((I=W.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:()=>H(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"}),R===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:R}),o.jsx("button",{className:"v10-modal-btn primary",onClick:()=>D(R,"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:C===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:C===P.agentAddress?"…":"Approve"}),o.jsx("button",{onClick:()=>_(P.agentAddress),disabled:C===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 r;const n=await sa(e,t);return((r=n==null?void 0:n.result)==null?void 0:r.bindings)??[]}const qi={displayName:"Project",primaryColor:"#a855f7",accentColor:"#22c55e"},lM=e=>({slug:e,displayName:e,icon:"•",color:"#64748b",rank:99}),cM={slug:$a,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 vj(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 rt(e){const t=vj(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
1129
+ `).replace(/\\\\/g,"\\"):t}function Lm(e){const t=rt(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=Da(f.catalog);if(!h)continue;const g=h.split(":catalog:").pop()??h;n.set(h,{slug:g,subGraph:rt(f.subGraph),name:rt(f.name)||g,description:rt(f.description)||void 0,rank:Lm(f.rank)||99,queries:[]})}const r=t.map(f=>{const h=Da(f.q),g=h.split(":query:").pop()??h,m=rt(f.subGraph),y=Da(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:rt(f.name)||g,description:rt(f.description)||void 0,sparql:rt(f.sparql),resultColumn:rt(f.column)||"",rank:Lm(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 r){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:r,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 Da(e){const t=vj(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),[r,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,C]=w.useState([]),[S,T]=w.useState([]),[E,A]=w.useState([]),[B,R]=w.useState([]),[D,H]=w.useState([]),M=w.useRef(new Map),_=w.useRef(new Map),P=w.useRef(new Map),F=w.useRef(new Map),W=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,Re]=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(rt(ke.name)||Ee),f(rt(ke.description)||void 0),g(rt(ke.primary)||qi.primaryColor),y(rt(ke.accent)||qi.accentColor)}else u(Ee),f(void 0),g(qi.primaryColor),y(qi.accentColor);const Ie=O.map(ke=>({slug:rt(ke.slug),displayName:rt(ke.displayName)||rt(ke.slug),description:rt(ke.description)||void 0,icon:rt(ke.icon)||void 0,color:rt(ke.color)||void 0,rank:Lm(ke.rank)||99,timelinePredicate:Da(ke.timelinePredicate)||void 0,sourceAssertion:rt(ke.sourceAssertion)||void 0})).filter(ke=>ke.slug).sort((ke,lt)=>ke.rank-lt.rank);k(Ie),_.current=new Map(Ie.map(ke=>[ke.slug,ke]));const We=ne.map(ke=>({typeIri:Da(ke.type),label:rt(ke.label)||void 0,icon:rt(ke.icon)||void 0,color:rt(ke.color)||void 0,detailHint:rt(ke.detailHint)||void 0,promoteLabel:rt(ke.promoteLabel)||void 0,promoteHint:rt(ke.promoteHint)||void 0,publishLabel:rt(ke.publishLabel)||void 0,publishHint:rt(ke.publishHint)||void 0})).filter(ke=>ke.typeIri);C(We),M.current=new Map(We.map(ke=>[ke.typeIri,ke]));const Se=ue.map(ke=>{const lt=Da(ke.view),xe=lt.split(":view:").pop()??lt;return{slug:xe,name:rt(ke.name)||xe,description:rt(ke.description)||void 0,nodeSize:rt(ke.nodeSize)||void 0,includeTypes:rt(ke.includeTypes).split("|").map(Oe=>Da(Oe.trim())).filter(Boolean),emphasizePredicates:rt(ke.emphasizePredicates).split("|").map(Oe=>Da(Oe.trim())).filter(Boolean)}});T(Se),P.current=new Map(Se.map(ke=>[ke.slug,ke]));const ft=le.map(ke=>{const lt=Da(ke.chip),xe=lt.split(":chip:").pop()??lt,Oe=rt(ke.values).split("|").map(_t=>rt(_t.trim())).filter(Boolean);return{slug:xe,subGraph:rt(ke.subGraph),typeIri:Da(ke.type),predicate:Da(ke.predicate),label:rt(ke.label)||"Filter",values:Oe}}).filter(ke=>ke.subGraph&&ke.predicate&&ke.values.length>0);A(ft);const ze=new Map;for(const ke of ft){const lt=ze.get(ke.subGraph)??[];lt.push(ke),ze.set(ke.subGraph,lt)}F.current=ze;const qe=gM(be,Re);R(qe.queryCatalogs),H(qe.savedQueries),W.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===$a?cM:_.current.get(U)??lM(U),[]),q=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)??[],[]),K=w.useCallback(U=>W.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:D,loading:t,error:r,forSubGraph:$,forType:q,view:V,chipsFor:X,savedQueryCatalogsFor:K,savedQueriesFor:L}}const yj=Ve.createContext(null);function Ur(){return w.useContext(yj)}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 bj(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 Qa(e){const t=bj(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
1251
+ `).replace(/\\\\/g,"\\"):t}function A1(e){const t=bj(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 r=A1(n.a);if(!r)continue;const s=t.get(r),l=Qa(n.kindAi)==="ai"||Qa(n.kind)==="ai"?"ai":Qa(n.kind)==="human"?"human":(s==null?void 0:s.kind)??"ai",u={uri:r,name:Qa(n.name)||Qa(n.label)||r.split(":").pop()||r,kind:l,framework:Qa(n.fw)||(s==null?void 0:s.framework),operatorUri:A1(n.op)||(s==null?void 0:s.operatorUri),walletAddress:Qa(n.wallet)||(s==null?void 0:s.walletAddress),peerId:Qa(n.peerId)||(s==null?void 0:s.peerId),avatar:Qa(n.avatar)||(s==null?void 0:s.avatar),reputation:Qa(n.reputation)||(s==null?void 0:s.reputation),color:SM(r)};u.kind==="human"&&!u.framework&&(u.framework="human"),t.set(r,u)}for(const n of t.values())if(n.operatorUri){const r=t.get(n.operatorUri);r&&(n.operatorName=r.name)}return t}function CM(e){const[t,n]=w.useState(()=>new Map),[r,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 sa(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:r,error:l,get:f,openAgent:g}}const xj=Ve.createContext(null);function ls(){return w.useContext(xj)}const Mm=["#6366f1","#14b8a6","#f43f5e","#facc15","#8b5cf6","#10b981","#0ea5e9","#d946ef"],R1=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 r=e.slice(n.length),s=r.indexOf("/");if(s<0)return;const l=r.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 _1(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)%Mm.length}function wj(e){const[t,n]=w.useState(new Map),[r,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 R;try{const D=new Promise((q,V)=>{A=setTimeout(()=>{T.abort(),V(new Error(`SWM attribution query timed out after ${Math.round(R1/1e3)}s`))},R1)}),H=(async()=>{const q=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Bt()},signal:T.signal,body:JSON.stringify({sparql:AM(e)})});if(!q.ok)throw new Error(`SPARQL query failed: ${q.status}`);return q.json()})(),M=await Promise.race([H,D]),P=(((R=M==null?void 0:M.result)==null?void 0:R.bindings)??[]).slice().reverse(),F=new Map,W=new Map,I=[];for(const q of P){const V=yl(q.op),X=yl(q.root),K=yl(q.agent),L=yl(q.publishedAt),U=yl(q.g);if(!V||!X||!K||!L)continue;const G=EM(K),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=W.get(G);le||(le=new Set,W.set(G,le)),le.add(X)}const $=[...W.entries()].map(([q,V])=>({agent:q,color:Mm[_1(q)],label:NM(q),entityCount:V.size})).sort((q,V)=>V.entityCount-q.entityCount);if(!B())return;n(F),s(I),u($),y(e)}catch(D){if(!B())return;f((D==null?void 0:D.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]=Mm[_1(A[0].agent)]:(T.push(E),S[E]="#f59e0b"));return{nodeColors:S,conflicts:T}},[t]);return{resultContextGraphId:m,attributions:t,events:r,palette:l,nodeColors:k,conflicts:j,loading:!!(e&&(h||m!==e)),error:d}}function RM(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 O1=1e4,zm="http://dkg.io/ontology/";function _M(e){const t=`did:dkg:context-graph:${e}/_meta`;return`PREFIX dkg: <${zm}>
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 Xa(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===`${zm}AssertionCreated`?"created":e===`${zm}AssertionPromoted`?"promoted":null}function LM(e){const[t,n]=w.useState([]),[r,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(O1/1e3)}s`))},O1)}),C=(async()=>{const A=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Bt()},signal:y.signal,body:JSON.stringify({sparql:_M(e),contextGraphId:e})});if(!A.ok)throw new Error(`SPARQL query failed: ${A.status}`);return A.json()})(),S=await Promise.race([C,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=Xa(A.event),R=Xa(A.type),D=Xa(A.assertion),H=Xa(A.name),M=Xa(A.agent),_=Xa(A.ts);if(!B||!D||!M||!_)continue;const P=OM(R);if(!P)continue;let F;if(P==="promoted"){const $=Xa(A.entityCount),q=$!=null?Number($):NaN;if(Number.isFinite(q)&&q>0)F=q;else{const V=Xa(A.subjectEntityCount),X=V!=null?Number(V):NaN;Number.isFinite(X)&&X>=0&&(F=X)}}let I=Xa(A.subGraphName);if(I===void 0){const $=Xa(A.assertionGraph);$&&(I=RM($,e))}E.push({eventUri:B,kind:P,assertionUri:D,assertionName:H??"",agentUri:M,publishedAt:_,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:r,error:l}),[d,t,r,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"],zM="http://www.w3.org/ns/prov#wasAttributedTo",DM=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 Xg(e){const t=e.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),n=new Date(t);return Number.isFinite(n.getTime())?n:null}function Jg(e,t,n,r){const s=n?n.toISOString():"no-ts";return r&&r!==t?`${e}|${t}|${r}|${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 r of n){const s=Xg(r);if(s)return s}}return null}function IM(e){for(const t of e.connections)if(t.predicate===zM)return t.targetUri;return null}function PM(e){for(const t of e.types)if(DM.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:r,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(r&&k!==r)continue;const j=UM(m);if(l&&j!==l)continue;const C=y?"typed":"added";if(h&&h.has(C))continue;const S=Jg(C,m.uri,b);g.push({id:S,entity:m,at:b,authorUri:k,kindUri:y,subGraph:j,layer:m.trustLevel,event:C,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,r,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},r=n(t),s=new Date(r.getTime()-1440*60*1e3),l=new Date(r.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()===r.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:r,subGraph:s,limit:l=200}=t,u=[];for(const d of e){if(r&&d.agent!==r||s&&d.subGraph!==s)continue;const f=Xg(d.publishedAt);if(!f)continue;const h=yt(d.rootUri),g=n.get(h),m=g!=null;u.push({id:Jg("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:Vg(e),types:[],trustLevel:"shared",layers:new Set(["shared"]),subGraphs:new Set,properties:new Map,connections:[]}}function GM(e,t={}){const{agentUri:n,subGraph:r,limit:s=200}=t,l=[];for(const u of e){if(n&&u.agentUri!==n||r&&u.subGraph!==r)continue;const d=Xg(u.publishedAt);if(!d)continue;const f=u.kind==="promoted"?"promoted":"added",h=u.kind==="promoted"?"shared":"working",g=yt(u.assertionUri);l.push({id:Jg(f,u.eventUri,d,g),entity:{uri:g,label:u.assertionName||Vg(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:r,...s}=t,l=r!=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(r,{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,r,l,e,s.agentUri,s.subGraph,s.limit,t.typeIri])}function kj(e,t=new Date){if(!e)return"—";const n=t.getTime()-e.getTime(),r=Math.abs(n),s=n<0,l=6e4,u=l*60,d=u*24;return r<l?s?"in a moment":"just now":r<u?s?`in ${Math.floor(r/l)}m`:`${Math.floor(r/l)}m ago`:r<d?s?`in ${Math.floor(r/u)}h`:`${Math.floor(r/u)}h ago`:r<7*d?s?`in ${Math.floor(r/d)}d`:`${Math.floor(r/d)}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}const L1={"claude-code":"⦿",openclaw:"◈",hermes:"⬡",gemini:"✧",human:"👤"};function WM(e,t){return e&&L1[e]?L1[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 YM(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:r=!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?YM(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,C=!!j;return o.jsxs("span",{className:`v10-agent-chip v10-agent-chip-${n}${C?" interactive":""} ${l}`,style:{"--agent-color":b},onClick:j?S=>{S.stopPropagation(),j()}:void 0,title:k,role:C?"button":void 0,tabIndex:C?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"&&r&&(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"},KM={working:"◇",shared:"◈",verified:"◉"},QM=200,XM=({entities:e,agentUri:t,typeIri:n,subGraph:r,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:r,limit:s,includeUndated:l,swmEvents:u,lifecycleEvents:d}),C=Ve.useMemo(()=>FM(k),[k]),S=ls(),T=Ur(),A=j?`${s??QM}+`:String(k.length),B=f!=null&&k.length===0,R=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,D=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:[R,D??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:[R,D,C.map(H=>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:H.label}),o.jsx("span",{className:"v10-activity-feed-bucket-count",children:H.items.length})]}),o.jsx("div",{className:"v10-activity-feed-items",children:H.items.map(M=>o.jsx(JM,{item:M,agents:S,profile:T,onSelectEntity:g,onOpenAgent:m},M.id))})]},H.key))]})};function JM({item:e,agents:t,profile:n,onSelectEntity:r,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?ez(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:KM[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-${tz(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:kj(e.at)})]});return e.clickable?o.jsx("button",{type:"button",className:"v10-activity-feed-row",onClick:()=>r(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 ez(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 r of t){const s=(n=e.properties.get(r))==null?void 0:n[0];if(s)return s}return null}function tz(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 nz={wm:"working",swm:"shared",vm:"verified"};function az(e){var y,b,k,j;const t=new Map;if(!e)return t;const n="http://dkg.io/ontology/decisions/status",r="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 C of e)if(C.types.includes(u))((y=C.properties.get(n))==null?void 0:y[0])==="proposed"&&h++;else if(C.types.includes(d)){const S=(b=C.properties.get(s))==null?void 0:b[0],T=(k=C.properties.get(r))==null?void 0:k[0];S==="p0"&&T!=="done"&&T!=="cancelled"&&g++}else C.types.includes(f)&&((j=C.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 $h=({contextGraphId:e,profile:t,selected:n,onSelect:r,entities:s,layer:l,enabledScope:u,allTriplesTotal:d})=>{const[f,h]=Ve.useState([]),[g,m]=Ve.useState(!0),y=Ve.useMemo(()=>az(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([nz[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 q of $.subGraphs)I.set(q,(I.get(q)??0)+1);return I},[k,s]),C=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),Dg(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(Qg).map(I=>{const $=t.forSubGraph(I.name),q=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:q,tripleCount:I.tripleCount,layerScoped:j!==null}}).sort((I,$)=>I.rank-$.rank),[f,t,j]),B=S!==null&&S>0||n===$a;if(g&&E.length===0&&!B||E.length===0&&!B)return null;const R=C??E.reduce((I,$)=>I+$.entityCount,0),D=E.reduce((I,$)=>I+$.tripleCount,0),H={working:"Working Memory",shared:"Shared Working Memory",verified:"Verifiable Memory"},M=k?[...k].map(I=>H[I]).join(" + "):null,_=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 · ${R} entities${_}${M?"":` · ${d??D} triples`}`,W=`All — total distinct entities. Includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph. ${R} entities${_}.`;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:()=>r(null),title:F,"aria-label":W,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:R})]}),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:()=>r(I.slug,l),title:`${I.displayName}${I.description?" · "+I.description:""} · ${I.entityCount} entities${_}${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===$a;return o.jsxs("button",{type:"button",className:`v10-subgraph-chip v10-subgraph-chip-root${$?" active":""}`,"data-active":$,"data-count":I,onClick:()=>r($a,l),title:`Entities not in any subgraph (Context Graph root) · ${I} entities${_}`,"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})]})})()]})},ev="context-graph-primer",Sj={id:ev,label:"What is a Context Graph?",closable:!0},jj={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 on({icon:e,title:t,description:n,actions:r=[],tone:s="neutral",compact:l=!1,inline:u=!1,className:d=""}){const f={"--v10-empty-accent":jj[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}),r.length>0&&o.jsx("div",{className:"v10-empty-state-actions",children:r.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 Hd({items:e,layer:t,compact:n=!1,className:r=""}){const s=t?{"--v10-stat-accent":jj[t]}:void 0;return o.jsx("div",{className:["v10-stat-strip",n?"compact":"",r].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 tv=w.lazy(()=>Aa(()=>import("./index-Bh_8bMB0.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),rz="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",iz=new Map(Gg.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 zr(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function sz(e){const t=new Set,n=new Map,r=new Map,s=new Map;for(const d of e){const f=zr(d.subject);t.add(f);const h=iz.get(d.predicate);if(h!==void 0){const m=Ud(d.object).trim();if(m){const y=s.get(f);(y===void 0||h<y)&&(r.set(f,m),s.set(f,h))}}if(zr(d.predicate)===rz||!Dm(d.object))continue;const g=zr(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:r.get(d)??dj(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(zr(d.subject))&&!u.has(zr(d.object))),singletonItems:l}}function oz(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 lz({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:r})=>o.jsx("button",{type:"button",className:"v10-graph-singleton-item",title:n,onClick:()=>t==null?void 0:t(n),children:r},n))})]})}const cz=2500;function M1(e,t=cz){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 r=[...n.entries()].sort((u,d)=>d[1]-u[1]).map(([u])=>u),s=new Set;let l=0;for(const u of r){const d=n.get(u)??0;l+d>t||(s.add(u),l+=d)}return s.size===0&&r.length>0&&s.add(r[0]),e.filter(u=>s.has(u.subject)).slice(0,t)}function Xu({title:e,scopeLabel:t,tone:n,className:r,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(lz,{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}${r?` ${r}`:""}`,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 Cj({layer:e,triples:t,onNodeClick:n,contextGraphId:r,scopeLabel:s,trustLegendActiveLayer:l,title:u,scopeEntities:d,swmAttribution:f,layerEntities:h,nodeColorsOverride:g}){const{title:m}=Dn[e],y=u??m,b=Gn(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:C}=E4(e==="vm"&&r?r:void 0,k),S=wj(e==="swm"&&r&&!f?r: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(yt(U.uri));return md(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 C)G(O);return U},[E,C]),B=A,R=w.useMemo(()=>{const L=e==="swm"?T.nodeColors:void 0;if(!(!L&&!g))return L?g?{...L,...g}:L:g},[e,T.nodeColors,g]),D=w.useMemo(()=>I4(e,R),[e,R]),{canvasTriples:H,singletonItems:M}=w.useMemo(()=>sz(B),[B]),_=w.useMemo(()=>{if(!d||d.length===0)return M;const L=new Set(M.map(G=>zr(G.uri)));for(const G of H)L.add(zr(G.subject)),Dm(G.object)&&L.add(zr(G.object));const U=[];for(const G of d){const O=zr(G.uri);L.has(O)||(L.add(O),U.push({uri:O,label:G.label||dj(void 0,O)}))}return U.length===0?M:[...M,...U].sort((G,O)=>G.label.localeCompare(O.label))},[M,H,d]),P=`${r??"context"}:${e}`,F=e==="swm"&&!!r&&T.loading,W=`${y} graph`,I=s??oz(e),$=l===null&&!!s,q=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(dz,{anchors:j}),e==="swm"&&T.palette.length>0&&o.jsx(uz,{palette:T.palette,conflicts:T.conflicts.length})]}):null,K=w.useMemo(()=>({name:`${P}:${b}`,palette:b}),[P,b]);return A.length===0&&_.length===0?o.jsx(Xu,{title:W,scopeLabel:I,tone:e,className:"v10-graph-view-fill",showScopeLabel:$,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(on,{compact:!0,tone:e,icon:Dn[e].icon,title:`No triples in ${y}`,description:"The graph will appear when this layer has connected triples."})})}):F?o.jsx(Xu,{title:W,scopeLabel:I,tone:"swm",className:"v10-graph-view-fill",showScopeLabel:$,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(on,{compact:!0,tone:"swm",icon:Dn.swm.icon,title:"Loading Shared Working Memory attribution...",description:"Agent colors are being prepared before the graph renders."})})}):o.jsx(Xu,{title:W,scopeLabel:I,tone:e,className:"v10-graph-view-fill",overlay:X,showScopeLabel:$,singletonItems:_,onSingletonClick:L=>n==null?void 0:n(q?{id:L,trustLayer:q}:{id:L}),renderGraph:L=>H.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(tv,{data:H,format:"triples",options:D,viewConfig:K,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:q?U=>n==null?void 0:n({...U,trustLayer:q}):n,initialFit:!0},`${P}:${L?"expanded":"inline"}:${H.length}`)}):o.jsx("div",{className:"v10-graph-placeholder v10-graph-placeholder-centered",children:"Connected graph appears when this layer has linked entities."})})}function uz({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 dz({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,r=(()=>{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"})]}),r&&o.jsxs("div",{className:"v10-vm-legend-foot",children:["Latest: ",r]})]})}function pz({active:e,counts:t,onSwitch:n,onShare:r,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:r,"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 fz({cg:e,profile:t,activeSubGraph:n,onClearSubGraph:r}){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?r: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 hz(e,t,n,r,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(Xt)),d=u.size>0;return l&&d&&u.has(Xt(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"&&r.map(h=>h.trim()).filter(Boolean).some(h=>u.has(Xt(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 mz(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(Xt)),l=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";return l&&s.add(Xt(l)),{id:"participants",value:s.size.toLocaleString(),label:"Agents with access",tooltip:"Includes the curator plus allowlisted participants reported by the node."}}function gz(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 vz({cg:e,currentAgent:t,currentAgentStatus:n="ok"}){var d,f;const r=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";if(!r)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?Xt(r)===Xt(u)?"curator":"not-curator":"unknown"}function yz(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(Xt))}function bz({cg:e,memory:t,subGraphCount:n,subGraphFetchFailed:r=!1,participants:s,participantsStatus:l="ok",currentAgent:u,currentAgentStatus:d="ok",onSwitchLayer:f,onOpenPrimer:h}){var K,L,U;const{wm:g,swm:m,vm:y}=t.counts,b=g+m+y,k=hz(e,u??null,d,s,l),j=gz(e==null?void 0:e.accessPolicy),C=mz(e,s,l),S=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",T=S?Xt(S):"",E=uo(e==null?void 0:e.accessPolicy)==="public",A=yz(u??null),B=Object.values(t.layerStatus??{}),R=B.filter(G=>G==="error").length,D=!t.loading&&B.length===3&&R===3,H=!t.loading&&R>0,M=t.loading?"Loading memory layers...":D||t.error?"Live memory counts are unavailable.":t.partial||H?"One or more layer counts are currently a lower bound.":"Canonical current-layer entity counts.",_=D?"Unavailable":b.toLocaleString(),{total:P}=Kg(t),F=!t.loading&&(t.partial||H),W=D?"Unavailable":t.loading&&P===0?"...":F?`${P.toLocaleString()}+`:P.toLocaleString(),I=D?"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?r?"Unavailable":"...":n.toLocaleString(),q=n==null?r?"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:((K=t.layerStatus)==null?void 0:K.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(Hd,{className:"v10-po-stat-strip",items:[{id:"entities",value:_,label:"Entities",tooltip:M},{id:"triples",value:W,label:"Triples",tooltip:I},{id:"subgraphs",value:$,label:"Subgraphs",tooltip:q},C]})]}),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()} ${ir(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=Xt(S);ne.add(le),ue.push({display:O(S),full:S,canonical:le})}if(l==="ok")for(const le of s){const be=Xt(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:Re})=>{const Ee=A.has(Re),Ie=!!T&&Re===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"})]},Re)})})})()]})]})}function xz({contextGraphId:e,curatorStatus:t,onParticipantsChanged:n}){const[r,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"),_S(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 Eg(e,b),s(k=>k.filter(j=>j.agentAddress!==b)),n==null||n()}catch{}finally{u(null)}},y=async b=>{u(b);try{await Tg(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":r.length===0?"true":"false",children:r.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."}):r.length===0?o.jsx("div",{className:"v10-po-join-empty",children:"No pending join requests."}):o.jsx("div",{className:"v10-po-join-list",children:r.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 wz({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 kz=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();function Sz(e,t=0){const n=Pl(u=>u.trackedIds),r=n.join(","),{data:s,loading:l}=oa(async()=>{if(n.length===0)return{wallets:[],ownerPublish:!1,resolved:!1};const u=await zg().catch(()=>null),d=(u==null?void 0:u.wallets)??[];let f=!1;try{const{contextGraphs:g}=await Md(),m=(g??[]).find(b=>(b==null?void 0:b.id)===e),y=m==null?void 0:m.curator;if(y){const b=await Kl().catch(()=>null);f=!!(b!=null&&b.agentDid&&Xt(y)===Xt(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=>kz(B.address,g)),y=m==null,b=m!=null&&Number(m.eth)>0,k=m!=null&&Number(m.trac)>0;let j,C=!1,S=!1,T,E=!1;for(const B of n){const R=await od(B,g,{extended:!0}).catch(()=>null);if(R===null){E=!0;continue}const D=Cm(R);if(D.outcome==="inconclusive"){E=!0;continue}if(D.outcome!=="unregistered"){if(D.outcome==="covers"){j={accountId:B,discountBps:R.discountBps,untracked:!1};break}D.dead&&(C=!0,T||(T=B)),D.hasBudget||(S=!0)}}if(!j&&!E&&!C&&!S){const B=await rR(g).catch(()=>{});if(B===void 0)E=!0;else if(B.accountId!=null&&!n.includes(B.accountId)){const R=B.accountId,D=await od(R,g,{extended:!0}).catch(()=>null);if(D===null)E=!0;else{const H=Cm(D);H.outcome==="covers"?j={accountId:R,discountBps:D.discountBps,untracked:!0}:H.outcome==="uncovered"?(H.dead&&(C=!0,T||(T=R)),H.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:C,sawInsolvent:S}})),ownerPublish:f,resolved:d.length>0}},[r,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 C=h.reduce((S,T)=>(T.discountBps??-1)>((S==null?void 0:S.discountBps)??-1)?T:S,void 0);return{verdict:k,loading:l,accountId:C==null?void 0:C.accountId,discountBps:C==null?void 0:C.discountBps,accountUntracked:C==null?void 0:C.coverUntracked,ownerPublish:d,anyGasFunded:u.some(S=>S.gasFunded||S.balanceUnknown),reasons:j,conditions:b,wallets:u}},[s,l,n.length])}function jz(e){return e.verdict==="fallthrough-no-funds"&&!(e.ownerPublish&&e.anyGasFunded)}function Cz(e){const t=Pl(u=>u.trackedIds),n=Sz(e,3e4),r=jz(n),s="Publish will fail — no signing wallet can fund it (coverage or gas).",l=t.length>0;return{blocked:r,reason:s,chipVisible:l,eligibility:n}}function Nz({verdict:e,accountId:t,discountBps:n,accountUntracked:r,ownerPublish:s,id:l}){return o.jsx("div",{className:"v10-pca-publish-chip",id:l,"data-testid":"pca-publish-eligibility",children:o.jsx(BO,{variant:"chip",verdict:e,accountId:t,discountBps:n,accountUntracked:r,ownerPublish:s})})}function nv({title:e,agent:t,footnote:n,dismissed:r,onDismiss:s,children:l}){return o.jsxs("div",{className:`v10-gen-widget ${r?"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 Ez({entities:e}){const t=Ur(),n=w.useMemo(()=>{const r=new Map;for(const s of e){const{icon:l,type:u}=Fd(s,t),d=r.get(u);d?d.count++:r.set(u,{icon:l,count:1})}return[...r.entries()].sort((s,l)=>l[1].count-s[1].count)},[e,t]);return n.length===0?null:o.jsx(nv,{title:"Entity Types",children:o.jsx(Hd,{compact:!0,items:n.map(([r,{icon:s,count:l}])=>({id:r,label:`${s} ${r}`,value:l}))})})}function Tz({entities:e,entityCount:t,triples:n,layer:r}){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(nv,{title:"Layer Stats",children:o.jsx(Hd,{compact:!0,layer:r,items:[{id:"entities",label:ir(r,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 Nj(e,t){const[n,r]=w.useState(!1),[s,l]=w.useState(null),[u,d]=w.useState(null),f=w.useCallback(async(h,g)=>{r(!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{r(!1)}},[e,t]);return{busy:n,result:s,error:u,run:f}}function Ej({title:e,footnote:t,context:n,result:r,error:s,extras:l,children:u}){return o.jsxs(nv,{title:e,footnote:t,children:[o.jsx("div",{className:"v10-decision-context",style:{marginBottom:10},children:n}),r&&o.jsxs("div",{"data-testid":"layer-action-result",style:{fontSize:11,color:"var(--text-success)",marginBottom:8},children:["✓ ",r]}),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 Az({count:e,contextGraphId:t,onComplete:n,onResult:r}){const{busy:s,result:l,error:u,run:d}=Nj(r,n),f=w.useCallback(()=>{let m=null;d(async()=>{const y=await Ql(t,"wm");let b=0,k=0;for(const j of y){m=j.name;try{await cd(t,j.name,j.subGraph?{subGraphName:j.subGraph}:{})}catch(S){const T=String((S==null?void 0:S.message)??"");if(!/already|finaliz|sealed|promoted|no quads|reserved/i.test(T))throw S}const C=await oo(t,j.name,"all",j.subGraph);b+=C.promotedCount,C.promotedCount===0&&(k+=1)}if(b>0){const j=k>0?` (${k} had nothing to promote)`:"";return`Promoted ${b} triple${b!==1?"s":""} to Shared Memory${j}`}return"No triples were promoted — every assertion was already in Shared Memory or its content is still being committed."},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=ir("wm",e).toLowerCase();return o.jsx(Ej,{title:"Promote",footnote:`Moves ${g} from this layer to Shared Working Memory.`,context:o.jsxs(o.Fragment,{children:[e," ",g," in this layer can be promoted to Shared Working Memory 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?"...":"✓ Promote All → Shared"})})}function Rz({count:e,contextGraphId:t,onComplete:n,onResult:r}){const[s,l]=w.useState(null),{busy:u,result:d,error:f,run:h}=Nj(r,n),g=Cz(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 C=await Ql(t,"swm"),S=await _g(t,C);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(C.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")},C=>(C==null?void 0:C.message)??"Action failed")},[t,h,g.blocked]);if(e===0)return null;const j=ir("swm",e).toLowerCase();return o.jsx(Ej,{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(WS,{convictionCostCovered:s}),g.chipVisible&&o.jsx(Nz,{...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 _z({layer:e,entities:t,entityCount:n,tripleCount:r,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(on,{compact:!0,tone:e,icon:Dn[e].icon,title:`No ${ir(e,2).toLowerCase()} yet`,description:e==="wm"?"Import data or chat with agents to populate Working Memory.":e==="swm"?"Promote entities from Working Memory to share them with the team.":"Publish entities 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(Tz,{entities:t,entityCount:n,triples:r,layer:e}),o.jsx(Ez,{entities:t})]}),(e==="wm"||e==="swm")&&s&&o.jsx("div",{className:"v10-layer-widgets-strip-action",children:e==="wm"?o.jsx(Az,{count:n,contextGraphId:s,onComplete:l,onResult:d}):o.jsx(Rz,{count:n,contextGraphId:s,onComplete:l,onResult:d})})]})}const av="doc:";function Oz(e,t,n){return`${av}${e}|${t}|${n}`}function Lz(e,t,n){return e?{ref:e,contentType:"text/markdown"}:t?{ref:t,contentType:n}:{ref:void 0,contentType:n}}function Mz(e){const t=e.slice(av.length),n=t.indexOf("|"),r=t.lastIndexOf("|");return n<0?{docRef:t,contentType:""}:{docRef:t.slice(n+1,r),contentType:t.slice(r+1)}}function rv(e,t){if(e.length<=t)return e;const n=t-1,r=Math.ceil(n/2),s=n-r;return`${e.slice(0,r)}…${e.slice(-s)}`}const zz={working:{layerKey:"wm",icon:"◇",label:"Working"},shared:{layerKey:"swm",icon:"◈",label:"Shared"},verified:{layerKey:"vm",icon:"◉",label:"Verifiable"}};function Tj({entities:e,layerKey:t,layerIcon:n,onSelectEntity:r,onOpenAgent:s,externallySorted:l=!1,sortLabel:u,headerExtra:d,timestampPredicate:f,perEntityTrustBadge:h=!1}){const g=Ur(),m=ls(),y=ir(t,e.length).toLowerCase(),b=w.useMemo(()=>{if(l)return e;const C=[...e];return C.sort((S,T)=>{const E=S.tripleCount??0;return(T.tripleCount??0)-E}),C},[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(on,{compact:!0,tone:t,icon:n,title:`No ${ir(t,2).toLowerCase()} yet`,description:`This view will fill when matching ${ir(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(C=>{const{icon:S,type:T}=Fd(C,g),E=C.tripleCount??0,A=Bd(C),B=A?m==null?void 0:m.get(A):null,R=f?Qu(C,f):null;return o.jsxs("div",{className:"v10-entity-card",onClick:D=>{D.stopPropagation(),r(C.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:C.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]}),R!=null&&o.jsx("span",{className:"v10-entity-card-timestamp",title:new Date(R).toLocaleString(),children:V4(R)}),o.jsxs("span",{className:"v10-entity-card-triples",children:[E," triples"]})]})]}),h?(()=>{const D=zz[C.trustLevel];return o.jsxs("span",{className:`v10-trust-badge ${D.layerKey}`,title:`${D.label} Memory`,children:[D.icon," ",D.label]})})():o.jsxs("span",{className:`v10-trust-badge ${t}`,children:[n," ",k]})]},C.uri)})]})}function Dz({layer:e,entities:t,tripleCount:n,layerTriples:r,contextGraphId:s,memory:l,activeTab:u,onTabChange:d,onSelectEntity:f,onNodeClick:h,footer:g,swmAttribution:m}){var A;const y=Dn[e],b=ir(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,C=e==="vm"&&k==="error"&&t.length===0,S=e==="vm"&&k==="ok"&&t.length===0,T=l.counts[e],E=B=>R=>{R.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&&!C&&o.jsx($z,{entities:t,tripleCount:n,contextGraphId:s}),j?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(on,{compact:!0,tone:"vm",icon:Dn.vm.icon,title:"Loading Verifiable Memory...",description:"Knowledge Assets are being read from the verified layer."})}):C?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(on,{compact:!0,tone:"vm",icon:Dn.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(_z,{layer:e,entities:t,entityCount:T,tripleCount:n,contextGraphId:s,onComplete:l.refresh}),o.jsx(Tj,{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(Iz,{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(Cj,{layer:e,triples:r,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(Aj,{entities:t,contextGraphId:s,scrollKey:`layer:${e}:docs`})})]})}function $z({entities:e,tripleCount:t,contextGraphId:n}){const r=e.length,s=new Set;for(const u of e)for(const d of u.types)s.add(d);const l=s.size;return r===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(on,{compact:!0,className:"v10-vm-empty-state",tone:"vm",icon:Dn.vm.icon,title:"No Knowledge Assets yet.",description:"Publish entities 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(Hd,{className:"v10-vm-hero-stats",layer:"vm",items:[{id:"assets",value:r,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 Iz({contextGraphId:e,layer:t,onComplete:n,scrollKey:r}){const{data:s,loading:l,refresh:u}=oa(()=>Ql(e,t),[e,t],0),{data:d}=oa(()=>xR(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"){try{await cd(e,E.name,E.subGraph?{subGraphName:E.subGraph}:{})}catch(R){const D=String((R==null?void 0:R.message)??"");if(!/already|finaliz|sealed|promoted|no quads|reserved/i.test(D))throw R}const A=await oo(e,E.name,"all",E.subGraph),B=Og(E.name,A);m(B.message)}else{const A=await Rg(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,B=0;for(const R of s){E=R.name;try{await cd(e,R.name,R.subGraph?{subGraphName:R.subGraph}:{})}catch(H){const M=String((H==null?void 0:H.message)??"");if(!/already|finaliz|sealed|promoted|no quads|reserved/i.test(M))throw H}const D=await oo(e,R.name,"all",R.subGraph);A+=D.promotedCount,D.promotedCount===0&&(B+=1)}if(A>0){const R=B>0?` (${B} had nothing to promote)`:"";m(`Promoted ${A} triples across ${s.length} assertion${s.length!==1?"s":""}${R}`)}else m("No triples were promoted — every assertion was already in Shared Memory or its content is still being committed.")}else{const A=await _g(e,s);if(A.published>0){const B=A.failures.length?` (${A.failures.length} could not be published)`:"",R=A.partial>0?` — ⚠ ${A.partial}: ${Il(A.partialError)}`:"";m(`Published ${A.published} knowledge asset${A.published!==1?"s":""} to Verifiable Memory${B}${R}`)}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]),C={flex:1,overflow:"auto"};if(l)return o.jsx("div",{className:"v10-layer-empty-shell",style:C,"data-cg-scroll-key":r,children:o.jsx(on,{compact:!0,tone:t,icon:Dn[t].icon,title:"Loading assertions..."})});if(!(s!=null&&s.length))return o.jsx("div",{className:"v10-layer-empty-shell",style:C,"data-cg-scroll-key":r,children:o.jsx(on,{tone:t,icon:Dn[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"?"Promote → Shared":"Publish to VM",T=t==="wm"?"Promote All → Shared":"Publish all to Verifiable Memory";return o.jsxs("div",{style:C,"data-cg-scroll-key":r,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:["› ",rv(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 Pz({layer:e,memory:t,onNodeClick:n,onSelectEntity:r,contextGraphId:s,activeTab:l,onTabChange:u,swmAttribution:d}){const f=Dn[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(Dz,{layer:e,entities:h,tripleCount:g.length,layerTriples:g,contextGraphId:s,memory:t,activeTab:l,onTabChange:u,onSelectEntity:r,onNodeClick:n,swmAttribution:d})})]})}function Aj({entities:e,contextGraphId:t,scrollKey:n}){const r=pn(u=>u.openTab),s=w.useMemo(()=>e.filter(u=>u.properties.has(Lh)),[e]),l=u=>{var y,b,k;const d=(y=u.connections.find(j=>j.predicate===S1))==null?void 0:y.targetUri,f=(b=u.connections.find(j=>j.predicate===j1))==null?void 0:b.targetUri,h=((k=u.properties.get(Lh))==null?void 0:k[0])??"",{ref:g,contentType:m}=Lz(d,f,h);r({id:Oz(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(on,{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(Lh))==null?void 0:m[0])??"",f=(y=u.connections.find(j=>j.predicate===S1||j.predicate===j1))==null?void 0:y.targetUri,h=f?e.find(j=>j.uri===f):void 0,g=((b=h==null?void 0:h.properties.get(C1))==null?void 0:b[0])??((k=u.properties.get(C1))==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 Rj(e){return`SELECT ?g ?s ?p ?o WHERE {
1287
+ GRAPH ?g { ?s ?p ?o }
1288
+ ${$m(e)}
1289
+ }
1290
+ LIMIT 1000`}const sr="__context_graph",po="ui-saved-queries",gd="Saved queries",vd="User-created SPARQL saved in this node profile for this Context Graph.",Ja="http://dkg.io/ontology/profile/",z1="http://schema.org/",D1="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",Uz="http://www.w3.org/2001/XMLSchema#integer";function $1(e){return JSON.stringify(e)}function $m(e){const t=`did:dkg:context-graph:${e}`,n=`${t}/`;return`FILTER(
1291
+ (
1292
+ STR(?g) = ${$1(t)} ||
1293
+ STRSTARTS(STR(?g), ${$1(n)})
1294
+ ) &&
1295
+ !CONTAINS(STR(?g), "/_private")
1296
+ )`}function Bz(e){const t="whole-context-graph",n="Context graph",s=sr,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:Rj(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
+ ${$m(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
+ ${$m(e)}
1305
+ }
1306
+ GROUP BY ?type
1307
+ ORDER BY DESC(?entities)
1308
+ LIMIT 100`,resultColumn:"type",rank:3})]}}function Fz(e){return e.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"saved-query"}function I1(e,t,n){return`urn:dkg:profile:${encodeURIComponent(e)}:${t}:${encodeURIComponent(n)}`}function Gi(e){return JSON.stringify(e)}function P1(e){return`"${e}"^^<${Uz}>`}function Hz(e,t,n,r){const s=Date.now(),l=`${Fz(t)}-${s.toString(36)}`,u=I1(e,"catalog",po),d=I1(e,"query",l),f={slug:l,subGraph:sr,catalogSlug:po,catalogName:gd,catalogDescription:vd,catalogRank:50,name:t,description:n||void 0,sparql:r,resultColumn:"",rank:s},h=[{subject:u,predicate:D1,object:`${Ja}QueryCatalog`,graph:""},{subject:u,predicate:`${Ja}forSubGraph`,object:Gi(sr),graph:""},{subject:u,predicate:`${Ja}displayName`,object:Gi(gd),graph:""},{subject:u,predicate:`${z1}description`,object:Gi(vd),graph:""},{subject:u,predicate:`${Ja}rank`,object:P1(50),graph:""},{subject:d,predicate:D1,object:`${Ja}SavedQuery`,graph:""},{subject:d,predicate:`${Ja}forSubGraph`,object:Gi(sr),graph:""},{subject:d,predicate:`${Ja}inCatalog`,object:u,graph:""},{subject:d,predicate:`${Ja}displayName`,object:Gi(t),graph:""},{subject:d,predicate:`${Ja}sparqlQuery`,object:Gi(r),graph:""},{subject:d,predicate:`${Ja}rank`,object:P1(s),graph:""}];return n&&h.push({subject:d,predicate:`${z1}description`,object:Gi(n),graph:""}),{query:f,quads:h}}function qz(e,t){const n=`${sr}|${po}`,r=e.map(l=>({...l,queries:[...l.queries]})),s=r.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)),r):[...r,{slug:po,subGraph:sr,name:gd,description:vd,rank:50,queries:[t]}]}function U1(e){const t=new Map;for(const n of e){const r=`${n.subGraph}|${n.slug}`,s=t.get(r);if(!s){t.set(r,{...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,r)=>n.subGraph.localeCompare(r.subGraph)||n.rank-r.rank||n.name.localeCompare(r.name))}function Gz(e){return e==null?"":typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function Vz(e){return e?e.length<=140?e:`${e.slice(0,110)}...${e.slice(-24)}`:"—"}function qd(e){return e.subGraph===sr&&e.slug==="whole-context-graph"}function Wz(e){return e.subGraph===sr?"context":"subgraph"}function Zz(e,t,n){return qd(e)?"Built-in presets":e.subGraph===sr&&e.slug===po?gd:t==="context"?e.name:`${n??e.subGraph}: ${e.name}`}function Yz(e){return qd(e)?"UI-provided SPARQL for common Context Graph checks.":e.subGraph===sr&&e.slug===po?vd:e.description??""}function Kz(e,t){return qd(e)?"Preset":t==="context"?"Saved":"Subgraph"}function Qz(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 Xz({contextGraphId:e}){const t=Ur(),n=w.useMemo(()=>Rj(e),[e]),[r,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,C]=w.useState(""),[S,T]=w.useState(!1),[E,A]=w.useState(null),[B,R]=w.useState(null),D=w.useMemo(()=>Bz(e),[e]),H=w.useMemo(()=>U1([D,...h,...(t==null?void 0:t.queryCatalogs)??[]]),[D,h,t==null?void 0:t.queryCatalogs]),M=w.useMemo(()=>t!=null&&t.loading||t!=null&&t.error?U1([D,...h]):H,[D,h,t==null?void 0:t.error,t==null?void 0:t.loading,H]);w.useEffect(()=>{s(n),u(n),f(null),g([]),y(!1),k(""),C(""),A(null),R(null)},[n]);const{data:_,loading:P,error:F,refresh:W}=oa(()=>sa(l,e),[l,e],0),I=w.useMemo(()=>{var G,O;return((G=_==null?void 0:_.result)==null?void 0:G.bindings)??((O=_==null?void 0:_.results)==null?void 0:O.bindings)??[]},[_]),$=w.useMemo(()=>H.some(G=>!qd(G)&&G.queries.length>0),[H]),q=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=r.trim();if(G){if(f(null),R(null),A(null),G===l){W();return}u(G)}},[l,r,W]),X=w.useCallback(()=>{s(n),f(null),R(null),A(null),l===n?W():u(n)},[l,n,W]),K=w.useCallback((G,O)=>{const ne=O.trim();if(ne){if(f(G),s(ne),R(null),A(null),l===ne){W();return}u(ne)}},[l,W]),L=w.useCallback(()=>{const G=r.trim().split(`
1309
+ `).find(O=>O.trim());k(G?G.replace(/\s+/g," ").slice(0,60):""),C(""),A(null),R(null),y(!0)},[r]),U=w.useCallback(async G=>{G.preventDefault();const O=b.trim(),ne=j.trim(),ue=r.trim();if(!O){A("Name is required.");return}if(!ue){A("Query is empty.");return}T(!0),A(null),R(null);try{const{query:le,quads:be}=Hz(e,O,ne,ue);await wR(e,be),g(Ee=>qz(Ee,le));const Re=`${le.subGraph}|${le.catalogSlug}|${le.slug}`;f(Re),s(le.sparql),l===le.sparql?W():u(le.sparql),k(""),C(""),y(!1),R("Saved to catalogue.")}catch(le){A((le==null?void 0:le.message)??"Failed to save query.")}finally{T(!1)}},[l,e,r,W,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(on,{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(on,{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=Wz(G),ne=O==="context"||t==null?void 0:t.forSubGraph(G.subGraph),ue=(ne==null?void 0:ne.color)??"#38bdf8",le=Zz(G,O,ne==null?void 0:ne.displayName),be=Yz(G),Re=Kz(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:Re}),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:()=>K(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)&&H.length>0&&!$&&o.jsx(on,{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:r,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=>C(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(on,{compact:!0,tone:"query",icon:"?",title:"Loading query results..."}),F&&o.jsx(on,{compact:!0,tone:"danger",icon:"!",title:"Query could not run.",description:Qz(F)}),!P&&!F&&I.length===0&&o.jsx(on,{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:q.map(G=>o.jsx("th",{children:G},G))})}),o.jsx("tbody",{children:I.map((G,O)=>o.jsx("tr",{children:q.map(ne=>{const ue=Gz(G[ne]);return o.jsx("td",{className:"v10-mlv-cell",title:ue,children:Vz(ue)},ne)})},O))})]})]})]})]})]})}const _j="http://dkg.io/ontology/",Jz="http://www.w3.org/ns/prov#";function Oj(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 Ih(e){const t=Oj(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1]:t}function eD(e){const t=Oj(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function tD(e,t){return`PREFIX dkg: <${_j}>
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 nD(e,t){return`PREFIX dkg: <${_j}>
1317
+ PREFIX prov: <${Jz}>
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 Ph={ual:null,opId:null,owner:null,publishedAt:null,publisherPeerId:null,loading:!1};function aD(e,t,n=!0){const[r,s]=w.useState(()=>({...Ph})),l=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){s({...Ph});return}const u=++l.current;s(d=>({...d,loading:!0,error:void 0})),(async()=>{var d,f;try{const[h,g]=await Promise.all([sa(tD(e,t),e).catch(()=>null),sa(nD(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?eD(y.op):null,k=y?Ih(y.publishedAt):null,j=y!=null&&y.agent?Ih(y.agent):null,C=m?Ih(m.owner):null;s({ual:b,opId:b?b.slice(b.lastIndexOf(":")+1):null,owner:C,publishedAt:k||null,publisherPeerId:j,loading:!1})}catch(h){if(u!==l.current)return;s({...Ph,loading:!1,error:(h==null?void 0:h.message)??String(h)})}})()},[e,t,n]),r}function B1(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 iv="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 F1(e){return/[<>"{}|\\^`\s]/.test(e)?"":e}function rD(e,t){const n=`did:dkg:context-graph:${e}/_meta`,r=Si(t);return`PREFIX dkg: <${iv}>
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("${r}", 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("${r}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function iD(e){const t=e.match(/\/assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function sD(e,t){return`PREFIX dkg: <${iv}>
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 oD(e,t,n,r){const s=`did:dkg:context-graph:${e}/_meta`,l=`/assertion/${n}/${r}`,u=Si(t);return`PREFIX dkg: <${iv}>
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}:${r}`)}"))
1391
+ }
1392
+ }
1393
+ } ORDER BY DESC(STRSTARTS("${u}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function lD(e){const t=e.match(/^assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function cD(e,t,n=!0){const[r,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=F1(t);if(!g){s({...Vi,status:"offchain"});return}const m=await sa(rD(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 _=y.asrt?Au(jn(y.asrt)):"",P=iD(_),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):""),q=(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:q||null,author:F,finalizedAt:y.finalizedAt?jn(y.finalizedAt):null,agent:I});return}const b=await sa(sD(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),C=lD(j),S=k.agent?Au(jn(k.agent)):null,T=(C==null?void 0:C.addr)??null;if(!C||!F1(C.addr)||!Si(C.name)){s({...Vi,status:"offchain",author:T,agent:S});return}const E=await sa(oD(e,g,C.addr,C.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,R=A!=null&&A.tx?jn(A.tx):null,D=A!=null&&A.block?jn(A.block):null,H=A!=null&&A.kaId?jn(A.kaId):null,M=A!=null&&A.finalizedAt?jn(A.finalizedAt):null;s({status:R?"verified":"offchain",ual:B||null,txHash:R||null,blockNumber:D||null,kaId:H||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]),r}const uD=({contextGraphId:e,entityUri:t,enabled:n})=>{const r=ls(),s=aD(e,t,n),l=cD(e,t,n),{data:u}=oa(Cg,[],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?dD(s.publishedAt):null,m=s.publisherPeerId&&r?B1(s.publisherPeerId,r.agents):null,y=m?(r==null?void 0:r.get(m))??null:null,b=s.owner&&r?B1(s.owner,r.agents):null,k=b?(r==null?void 0:r.get(b))??null:null,j=C=>{var S;(S=navigator.clipboard)==null||S.writeText(C).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 dD(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 r(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;r(h,d),(f=h._zod).deferred??(f.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(u,"init",{value:r}),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 Lj={};function ts(e){return Lj}function Mj(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,s])=>t.indexOf(+r)===-1).map(([r,s])=>s)}function pD(e,t){return typeof t=="bigint"?t.toString():t}function zj(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function sv(e){return e==null}function ov(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function fD(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,l=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(t.toFixed(s).replace(".",""));return l%u/10**s}function Pt(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function lv(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function bl(e){return JSON.stringify(e)}const Dj=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Im(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const hD=zj(()=>{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 Pm(e){if(Im(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Im(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const mD=new Set(["string","number","symbol"]);function Gd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cs(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}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 gD(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const vD={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 yD(e,t){const n={},r=e._zod.def;for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(n[s]=r.shape[s])}return cs(e,{...e._zod.def,shape:n,checks:[]})}function bD(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete n[s]}return cs(e,{...e._zod.def,shape:n,checks:[]})}function xD(e,t){if(!Pm(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return lv(this,"shape",r),r},checks:[]};return cs(e,n)}function wD(e,t){return cs(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return lv(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function kD(e,t,n){const r=t._zod.def.shape,s={...r};if(n)for(const l in n){if(!(l in r))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(s[l]=e?new e({type:"optional",innerType:r[l]}):r[l])}else for(const l in r)s[l]=e?new e({type:"optional",innerType:r[l]}):r[l];return cs(t,{...t._zod.def,shape:s,checks:[]})}function SD(e,t,n){const r=t._zod.def.shape,s={...r};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:r[l]}))}else for(const l in r)s[l]=new e({type:"nonoptional",innerType:r[l]});return cs(t,{...t._zod.def,shape:s,checks:[]})}function Ol(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function cv(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Ru(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 r={...e,path:e.path??[]};if(!e.message){const g=Ru((u=(l=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:l.error)==null?void 0:u.call(l,e))??Ru((d=t==null?void 0:t.error)==null?void 0:d.call(t,e))??Ru((f=n.customError)==null?void 0:f.call(n,e))??Ru((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";r.message=g}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function uv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Fl(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const $j=(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,pD,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ij=ve("$ZodError",$j),Pj=ve("$ZodError",$j,{Parent:Error});function jD(e,t=n=>n.message){const n={},r=[];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))):r.push(t(s));return{formErrors:r,fieldErrors:n}}function CD(e,t){const n=t||function(l){return l.message},r={_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)r._errors.push(n(u));else{let d=r,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),r}const ND=e=>(t,n,r,s)=>{const l=r?Object.assign(r,{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 Dj(d,s==null?void 0:s.callee),d}return u.value},ED=e=>async(t,n,r,s)=>{const l=r?Object.assign(r,{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 Dj(d,s==null?void 0:s.callee),d}return u.value},Uj=e=>(t,n,r)=>{const s=r?{...r,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??Ij)(l.issues.map(u=>ns(u,s,ts())))}:{success:!0,data:l.value}},TD=Uj(Pj),Bj=e=>async(t,n,r)=>{const s=r?Object.assign(r,{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}},AD=Bj(Pj),RD=/^[cC][^\s-]{8,}$/,_D=/^[0-9a-z]+$/,OD=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,LD=/^[0-9a-vA-V]{20}$/,MD=/^[A-Za-z0-9]{27}$/,zD=/^[a-zA-Z0-9_-]{21}$/,DD=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$D=/^([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})$/,H1=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)$/,ID=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,PD="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function UD(){return new RegExp(PD,"u")}const BD=/^(?:(?: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])$/,FD=/^(([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})$/,HD=/^((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])$/,qD=/^(([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])$/,GD=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fj=/^[A-Za-z0-9_-]*$/,VD=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,WD=/^\+(?:[0-9]){6,14}[0-9]$/,Hj="(?:(?:\\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])))",ZD=new RegExp(`^${Hj}$`);function qj(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 YD(e){return new RegExp(`^${qj(e)}$`)}function KD(e){const t=qj({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Hj}T(?:${r})$`)}const QD=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}$`)},XD=/^\d+$/,JD=/^-?\d+(?:\.\d+)?/i,e$=/^[^A-Z]*$/,t$=/^[^a-z]*$/,Vn=ve("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Gj={number:"number",bigint:"bigint",object:"date"},Vj=ve("$ZodCheckLessThan",(e,t)=>{Vn.init(e,t);const n=Gj[typeof t.value];e._zod.onattach.push(r=>{const s=r._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=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wj=ve("$ZodCheckGreaterThan",(e,t)=>{Vn.init(e,t);const n=Gj[typeof t.value];e._zod.onattach.push(r=>{const s=r._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=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),n$=ve("$ZodCheckMultipleOf",(e,t)=>{Vn.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.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):fD(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})}}),a$=ve("$ZodCheckNumberFormat",(e,t)=>{var u;Vn.init(e,t),t.format=t.format||"float64";const n=(u=t.format)==null?void 0:u.includes("int"),r=n?"int":"number",[s,l]=vD[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=XD)}),e._zod.check=d=>{const f=d.value;if(n){if(!Number.isInteger(f)){d.issues.push({expected:r,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:r,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:r,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})}}),r$=ve("$ZodCheckMaxLength",(e,t)=>{var n;Vn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!sv(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const s=r.value;if(s.length<=t.maximum)return;const u=uv(s);r.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;Vn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!sv(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const s=r.value;if(s.length>=t.minimum)return;const u=uv(s);r.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;Vn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!sv(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=r=>{const s=r.value,l=s.length;if(l===t.length)return;const u=uv(s),d=l>t.length;r.issues.push({origin:u,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Vd=ve("$ZodCheckStringFormat",(e,t)=>{var n,r;Vn.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})}):(r=e._zod).check??(r.check=()=>{})}),o$=ve("$ZodCheckRegex",(e,t)=>{Vd.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$),Vd.init(e,t)}),c$=ve("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=t$),Vd.init(e,t)}),u$=ve("$ZodCheckIncludes",(e,t)=>{Vn.init(e,t);const n=Gd(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(s=>{const l=s._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(r)}),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)=>{Vn.init(e,t);const n=new RegExp(`^${Gd(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),p$=ve("$ZodCheckEndsWith",(e,t)=>{Vn.init(e,t);const n=new RegExp(`.*${Gd(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),f$=ve("$ZodCheckOverwrite",(e,t)=>{Vn.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 r=t.split(`
1394
+ `).filter(u=>u),s=Math.min(...r.map(u=>u.length-u.trimStart().length)),l=r.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},Jt=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 r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const l of r)for(const u of l._zod.onattach)u(e);if(r.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,r,d))}return l(f,r,d)}}e["~standard"]={validate:l=>{var u;try{const d=TD(e,l);return d.success?{value:d.data}:{issues:(u=d.error)==null?void 0:u.issues}}catch{return AD(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}}),dv=ve("$ZodString",(e,t)=>{var n;Jt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??QD(e._zod.bag),e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ft=ve("$ZodStringFormat",(e,t)=>{Vd.init(e,t),dv.init(e,t)}),g$=ve("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=$D),Ft.init(e,t)}),v$=ve("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=H1(r))}else t.pattern??(t.pattern=H1());Ft.init(e,t)}),y$=ve("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ID),Ft.init(e,t)}),b$=ve("$ZodURL",(e,t)=>{Ft.init(e,t),e._zod.check=n=>{try{const r=n.value,s=new URL(r),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:VD.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})),!r.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=UD()),Ft.init(e,t)}),w$=ve("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=zD),Ft.init(e,t)}),k$=ve("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=RD),Ft.init(e,t)}),S$=ve("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=_D),Ft.init(e,t)}),j$=ve("$ZodULID",(e,t)=>{t.pattern??(t.pattern=OD),Ft.init(e,t)}),C$=ve("$ZodXID",(e,t)=>{t.pattern??(t.pattern=LD),Ft.init(e,t)}),N$=ve("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=MD),Ft.init(e,t)}),E$=ve("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=KD(t)),Ft.init(e,t)}),T$=ve("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ZD),Ft.init(e,t)}),A$=ve("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=YD(t)),Ft.init(e,t)}),R$=ve("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=DD),Ft.init(e,t)}),_$=ve("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=BD),Ft.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),O$=ve("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=FD),Ft.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.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=HD),Ft.init(e,t)}),M$=ve("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=qD),Ft.init(e,t),e._zod.check=n=>{const[r,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://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Zj(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const z$=ve("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=GD),Ft.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{Zj(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function D$(e){if(!Fj.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Zj(n)}const $$=ve("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fj),Ft.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{D$(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=WD),Ft.init(e,t)});function P$(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));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)=>{Ft.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})}}),Yj=ve("$ZodNumber",(e,t)=>{Jt.init(e,t),e._zod.pattern=e._zod.bag.pattern??JD,e._zod.parse=(n,r)=>{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)=>{a$.init(e,t),Yj.init(e,t)}),F$=ve("$ZodUnknown",(e,t)=>{Jt.init(e,t),e._zod.parse=n=>n}),H$=ve("$ZodNever",(e,t)=>{Jt.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function q1(e,t,n){e.issues.length&&t.issues.push(...cv(n,e.issues)),t.value[n]=e.value}const q$=ve("$ZodArray",(e,t)=>{Jt.init(e,t),e._zod.parse=(n,r)=>{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:[]},r);f instanceof Promise?l.push(f.then(h=>q1(h,n,u))):q1(f,n,u)}return l.length?Promise.all(l).then(()=>n):n}});function _u(e,t,n){e.issues.length&&t.issues.push(...cv(n,e.issues)),t.value[n]=e.value}function G1(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...cv(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const G$=ve("$ZodObject",(e,t)=>{Jt.init(e,t);const n=zj(()=>{const m=Object.keys(t.shape);for(const b of m)if(!(t.shape[b]instanceof Jt))throw new Error(`Invalid element at key "${b}": expected a Zod schema`);const y=gD(t.shape);return{shape:t.shape,keys:m,keySet:new Set(m),numKeys:m.length,optionalKeys:new Set(y)}});Pt(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 r=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 C=0;for(const T of b.keys)j[T]=`key_${C++}`;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=Im,u=!Lj.jitless,f=u&&hD.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=r(t.shape)),m=s(m,y);else{m.value={};const E=g.shape;for(const A of g.keys){const B=E[A],R=B._zod.run({value:b[A],issues:[]},y),D=B._zod.optin==="optional"&&B._zod.optout==="optional";R instanceof Promise?k.push(R.then(H=>D?G1(H,m,A,b):_u(H,m,A))):D?G1(R,m,A,b):_u(R,m,A)}}if(!h)return k.length?Promise.all(k).then(()=>m):m;const j=[],C=g.keySet,S=h._zod,T=S.def.type;for(const E of Object.keys(b)){if(C.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=>_u(B,m,E))):_u(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 V1(e,t,n,r){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,r,ts())))}),t}const V$=ve("$ZodUnion",(e,t)=>{Jt.init(e,t),Pt(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Pt(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Pt(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Pt(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>ov(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let s=!1;const l=[];for(const u of t.options){const d=u._zod.run({value:n.value,issues:[]},r);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=>V1(u,n,e,r)):V1(l,n,e,r)}}),W$=ve("$ZodIntersection",(e,t)=>{Jt.init(e,t),e._zod.parse=(n,r)=>{const s=n.value,l=t.left._zod.run({value:s,issues:[]},r),u=t.right._zod.run({value:s,issues:[]},r);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([f,h])=>W1(n,f,h)):W1(n,l,u)}});function Um(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(Pm(e)&&Pm(t)){const n=Object.keys(t),r=Object.keys(e).filter(l=>n.indexOf(l)!==-1),s={...e,...t};for(const l of r){const u=Um(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 r=0;r<e.length;r++){const s=e[r],l=t[r],u=Um(s,l);if(!u.valid)return{valid:!1,mergeErrorPath:[r,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function W1(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 r=Um(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const Z$=ve("$ZodEnum",(e,t)=>{Jt.init(e,t);const n=Mj(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>mD.has(typeof r)).map(r=>typeof r=="string"?Gd(r):r.toString()).join("|")})$`),e._zod.parse=(r,s)=>{const l=r.value;return e._zod.values.has(l)||r.issues.push({code:"invalid_value",values:n,input:l,inst:e}),r}}),Y$=ve("$ZodTransform",(e,t)=>{Jt.init(e,t),e._zod.parse=(n,r)=>{const s=t.transform(n.value,n);if(r.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}}),K$=ve("$ZodOptional",(e,t)=>{Jt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Pt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Pt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ov(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),Q$=ve("$ZodNullable",(e,t)=>{Jt.init(e,t),Pt(e._zod,"optin",()=>t.innerType._zod.optin),Pt(e._zod,"optout",()=>t.innerType._zod.optout),Pt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ov(n.source)}|null)$`):void 0}),Pt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),X$=ve("$ZodDefault",(e,t)=>{Jt.init(e,t),e._zod.optin="optional",Pt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(l=>Z1(l,t)):Z1(s,t)}});function Z1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const J$=ve("$ZodPrefault",(e,t)=>{Jt.init(e,t),e._zod.optin="optional",Pt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),e3=ve("$ZodNonOptional",(e,t)=>{Jt.init(e,t),Pt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(l=>Y1(l,e)):Y1(s,e)}});function Y1(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 t3=ve("$ZodCatch",(e,t)=>{Jt.init(e,t),e._zod.optin="optional",Pt(e._zod,"optout",()=>t.innerType._zod.optout),Pt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);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,r,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,r,ts()))},input:n.value}),n.issues=[]),n)}}),n3=ve("$ZodPipe",(e,t)=>{Jt.init(e,t),Pt(e._zod,"values",()=>t.in._zod.values),Pt(e._zod,"optin",()=>t.in._zod.optin),Pt(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const s=t.in._zod.run(n,r);return s instanceof Promise?s.then(l=>K1(l,t,r)):K1(s,t,r)}});function K1(e,t,n){return Ol(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const a3=ve("$ZodReadonly",(e,t)=>{Jt.init(e,t),Pt(e._zod,"propValues",()=>t.innerType._zod.propValues),Pt(e._zod,"values",()=>t.innerType._zod.values),Pt(e._zod,"optin",()=>t.innerType._zod.optin),Pt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(Q1):Q1(s)}});function Q1(e){return e.value=Object.freeze(e.value),e}const r3=ve("$ZodCustom",(e,t)=>{Vn.init(e,t),Jt.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,s=t.fn(r);if(s instanceof Promise)return s.then(l=>X1(l,n,r,e));X1(s,n,r,e)}});function X1(e,t,n,r){if(!e){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),t.issues.push(Fl(s))}}class Kj{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.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 r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function Qj(){return new Kj}const Al=Qj();function i3(e,t){return new e({type:"string",...Ue(t)})}function s3(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ue(t)})}function J1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ue(t)})}function o3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ue(t)})}function l3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ue(t)})}function c3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ue(t)})}function u3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ue(t)})}function d3(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ue(t)})}function p3(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ue(t)})}function f3(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ue(t)})}function h3(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ue(t)})}function m3(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ue(t)})}function g3(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ue(t)})}function v3(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ue(t)})}function y3(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ue(t)})}function b3(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ue(t)})}function x3(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ue(t)})}function w3(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ue(t)})}function k3(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ue(t)})}function S3(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ue(t)})}function j3(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ue(t)})}function C3(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ue(t)})}function N3(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ue(t)})}function E3(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ue(t)})}function T3(e,t){return new e({type:"string",format:"date",check:"string_format",...Ue(t)})}function A3(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ue(t)})}function R3(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ue(t)})}function _3(e,t){return new e({type:"number",checks:[],...Ue(t)})}function O3(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ue(t)})}function L3(e){return new e({type:"unknown"})}function M3(e,t){return new e({type:"never",...Ue(t)})}function ew(e,t){return new Vj({check:"less_than",...Ue(t),value:e,inclusive:!1})}function Uh(e,t){return new Vj({check:"less_than",...Ue(t),value:e,inclusive:!0})}function tw(e,t){return new Wj({check:"greater_than",...Ue(t),value:e,inclusive:!1})}function Bh(e,t){return new Wj({check:"greater_than",...Ue(t),value:e,inclusive:!0})}function nw(e,t){return new n$({check:"multiple_of",...Ue(t),value:e})}function Xj(e,t){return new r$({check:"max_length",...Ue(t),maximum:e})}function yd(e,t){return new i$({check:"min_length",...Ue(t),minimum:e})}function Jj(e,t){return new s$({check:"length_equals",...Ue(t),length:e})}function z3(e,t){return new o$({check:"string_format",format:"regex",...Ue(t),pattern:e})}function D3(e){return new l$({check:"string_format",format:"lowercase",...Ue(e)})}function $3(e){return new c$({check:"string_format",format:"uppercase",...Ue(e)})}function I3(e,t){return new u$({check:"string_format",format:"includes",...Ue(t),includes:e})}function P3(e,t){return new d$({check:"string_format",format:"starts_with",...Ue(t),prefix:e})}function U3(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 B3(e){return ec(t=>t.normalize(e))}function F3(){return ec(e=>e.trim())}function H3(){return ec(e=>e.toLowerCase())}function q3(){return ec(e=>e.toUpperCase())}function G3(e,t,n){return new e({type:"array",element:t,...Ue(n)})}function V3(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ue(n)})}class aw{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 r;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 C=d.schema;switch(s.type){case"string":{const S=C;S.type="string";const{minimum:T,maximum:E,format:A,patterns:B,contentEncoding:R}=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),R&&(S.contentEncoding=R),B&&B.size>0){const D=[...B];D.length===1?S.pattern=D[0].source:D.length>1&&(d.schema.allOf=[...D.map(H=>({...this.target==="draft-7"?{type:"string"}:{},pattern:H.source}))])}break}case"number":{const S=C,{minimum:T,maximum:E,format:A,multipleOf:B,exclusiveMaximum:R,exclusiveMinimum:D}=t._zod.bag;typeof A=="string"&&A.includes("int")?S.type="integer":S.type="number",typeof D=="number"&&(S.exclusiveMinimum=D),typeof T=="number"&&(S.minimum=T,typeof D=="number"&&(D>=T?delete S.minimum:delete S.exclusiveMinimum)),typeof R=="number"&&(S.exclusiveMaximum=R),typeof E=="number"&&(S.maximum=E,typeof R=="number"&&(R<=E?delete S.maximum:delete S.exclusiveMaximum)),typeof B=="number"&&(S.multipleOf=B);break}case"boolean":{const S=C;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":{C.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":{C.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const S=C,{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=C;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 R=s.shape[B]._zod;return this.io==="input"?R.optin===void 0:R.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=C;S.anyOf=s.options.map((T,E)=>this.process(T,{...k,path:[...k.path,"anyOf",E]}));break}case"intersection":{const S=C,T=this.process(s.left,{...k,path:[...k.path,"allOf",0]}),E=this.process(s.right,{...k,path:[...k.path,"allOf",1]}),A=R=>"allOf"in R&&Object.keys(R).length===1,B=[...A(T)?T.allOf:[T],...A(E)?E.allOf:[E]];S.allOf=B;break}case"tuple":{const S=C;S.type="array";const T=s.items.map((B,R)=>this.process(B,{...k,path:[...k.path,"prefixItems",R]}));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=C;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=C,T=Mj(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=C,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=C,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(R=>({...T,contentMediaType:R})):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);C.anyOf=[S,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,k),d.ref=s.innerType;break}case"success":{const S=C;S.type="boolean";break}case"default":{this.process(s.innerType,k),d.ref=s.innerType,C.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,k),d.ref=s.innerType,this.io==="input"&&(C._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")}C.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=C,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,C.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"&&dn(t)&&(delete d.schema.examples,delete d.schema.default),this.io==="input"&&d.schema._prefault&&((r=d.schema).default??(r.default=d.schema._prefault)),delete d.schema._prefault,this.seen.get(t).schema}emit(t,n){var g,m,y,b,k,j;const r={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=C=>{var B;const S=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const R=(B=r.external.registry.get(C[0]))==null?void 0:B.id,D=r.external.uri??(M=>M);if(R)return{ref:D(R)};const H=C[1].defId??C[1].schema.id??`schema${this.counter++}`;return C[1].defId=H,{defId:H,ref:`${D("__shared")}#/${S}/${H}`}}if(C[1]===s)return{ref:"#"};const E=`#/${S}/`,A=C[1].schema.id??`__schema${this.counter++}`;return{defId:A,ref:E+A}},u=C=>{if(C[1].schema.$ref)return;const S=C[1],{ref:T,defId:E}=l(C);S.def={...S.schema},E&&(S.defId=E);const A=S.schema;for(const B in A)delete A[B];A.$ref=T};if(r.cycles==="throw")for(const C of this.seen.entries()){const S=C[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 C of this.seen.entries()){const S=C[1];if(t===C[0]){u(C);continue}if(r.external){const E=(m=r.external.registry.get(C[0]))==null?void 0:m.id;if(t!==C[0]&&E){u(C);continue}}if((y=this.metadataRegistry.get(C[0]))==null?void 0:y.id){u(C);continue}if(S.cycle){u(C);continue}if(S.count>1&&r.reused==="ref"){u(C);continue}}const d=(C,S)=>{const T=this.seen.get(C),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 R=this.seen.get(B).schema;R.$ref&&S.target==="draft-7"?(E.allOf=E.allOf??[],E.allOf.push(R)):(Object.assign(E,R),Object.assign(E,A))}T.isParent||this.override({zodSchema:C,jsonSchema:E,path:T.path??[]})};for(const C of[...this.seen.entries()].reverse())d(C[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=r.external)!=null&&b.uri){const C=(k=r.external.registry.get(t))==null?void 0:k.id;if(!C)throw new Error("Schema is missing an `id` property");f.$id=r.external.uri(C)}Object.assign(f,s.def);const h=((j=r.external)==null?void 0:j.defs)??{};for(const C of this.seen.entries()){const S=C[1];S.def&&S.defId&&(h[S.defId]=S.def)}r.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 W3(e,t){if(e instanceof Kj){const r=new aw(t),s={};for(const d of e._idmap.entries()){const[f,h]=d;r.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]=r.emit(h,{...t,external:u})}if(Object.keys(s).length>0){const d=r.target==="draft-2020-12"?"$defs":"definitions";l.__shared={[d]:s}}return{schemas:l}}const n=new aw(t);return n.process(e),n.emit(e,t)}function dn(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 dn(s.element,n);case"object":{for(const l in s.shape)if(dn(s.shape[l],n))return!0;return!1}case"union":{for(const l of s.options)if(dn(l,n))return!0;return!1}case"intersection":return dn(s.left,n)||dn(s.right,n);case"tuple":{for(const l of s.items)if(dn(l,n))return!0;return!!(s.rest&&dn(s.rest,n))}case"record":return dn(s.keyType,n)||dn(s.valueType,n);case"map":return dn(s.keyType,n)||dn(s.valueType,n);case"set":return dn(s.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return dn(s.innerType,n);case"lazy":return dn(s.getter(),n);case"default":return dn(s.innerType,n);case"prefault":return dn(s.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return dn(s.in,n)||dn(s.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${s.type}`)}const Z3=ve("ZodISODateTime",(e,t)=>{E$.init(e,t),Gt.init(e,t)});function Y3(e){return E3(Z3,e)}const K3=ve("ZodISODate",(e,t)=>{T$.init(e,t),Gt.init(e,t)});function Q3(e){return T3(K3,e)}const X3=ve("ZodISOTime",(e,t)=>{A$.init(e,t),Gt.init(e,t)});function J3(e){return A3(X3,e)}const eI=ve("ZodISODuration",(e,t)=>{R$.init(e,t),Gt.init(e,t)});function tI(e){return R3(eI,e)}const nI=(e,t)=>{Ij.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>CD(e,n)},flatten:{value:n=>jD(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Wd=ve("ZodError",nI,{Parent:Error}),aI=ND(Wd),rI=ED(Wd),iI=Uj(Wd),sI=Bj(Wd),fn=ve("ZodType",(e,t)=>(Jt.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>cs(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>aI(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>iI(e,n,r),e.parseAsync=async(n,r)=>rI(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>sI(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(YI(n,r)),e.superRefine=n=>e.check(KI(n)),e.overwrite=n=>e.check(ec(n)),e.optional=()=>ow(e),e.nullable=()=>lw(e),e.nullish=()=>ow(lw(e)),e.nonoptional=n=>BI(e,n),e.array=()=>Ir(e),e.or=n=>pv([e,n]),e.and=n=>LI(e,n),e.transform=n=>cw(e,zI(n)),e.default=n=>II(e,n),e.prefault=n=>UI(e,n),e.catch=n=>HI(e,n),e.pipe=n=>cw(e,n),e.readonly=()=>VI(e),e.describe=n=>{const r=e.clone();return Al.add(r,{description:n}),r},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 r=e.clone();return Al.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),eC=ve("_ZodString",(e,t)=>{dv.init(e,t),fn.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=(...r)=>e.check(z3(...r)),e.includes=(...r)=>e.check(I3(...r)),e.startsWith=(...r)=>e.check(P3(...r)),e.endsWith=(...r)=>e.check(U3(...r)),e.min=(...r)=>e.check(yd(...r)),e.max=(...r)=>e.check(Xj(...r)),e.length=(...r)=>e.check(Jj(...r)),e.nonempty=(...r)=>e.check(yd(1,...r)),e.lowercase=r=>e.check(D3(r)),e.uppercase=r=>e.check($3(r)),e.trim=()=>e.check(F3()),e.normalize=(...r)=>e.check(B3(...r)),e.toLowerCase=()=>e.check(H3()),e.toUpperCase=()=>e.check(q3())}),oI=ve("ZodString",(e,t)=>{dv.init(e,t),eC.init(e,t),e.email=n=>e.check(s3(lI,n)),e.url=n=>e.check(d3(cI,n)),e.jwt=n=>e.check(N3(jI,n)),e.emoji=n=>e.check(p3(uI,n)),e.guid=n=>e.check(J1(rw,n)),e.uuid=n=>e.check(o3(Ou,n)),e.uuidv4=n=>e.check(l3(Ou,n)),e.uuidv6=n=>e.check(c3(Ou,n)),e.uuidv7=n=>e.check(u3(Ou,n)),e.nanoid=n=>e.check(f3(dI,n)),e.guid=n=>e.check(J1(rw,n)),e.cuid=n=>e.check(h3(pI,n)),e.cuid2=n=>e.check(m3(fI,n)),e.ulid=n=>e.check(g3(hI,n)),e.base64=n=>e.check(S3(wI,n)),e.base64url=n=>e.check(j3(kI,n)),e.xid=n=>e.check(v3(mI,n)),e.ksuid=n=>e.check(y3(gI,n)),e.ipv4=n=>e.check(b3(vI,n)),e.ipv6=n=>e.check(x3(yI,n)),e.cidrv4=n=>e.check(w3(bI,n)),e.cidrv6=n=>e.check(k3(xI,n)),e.e164=n=>e.check(C3(SI,n)),e.datetime=n=>e.check(Y3(n)),e.date=n=>e.check(Q3(n)),e.time=n=>e.check(J3(n)),e.duration=n=>e.check(tI(n))});function $e(e){return i3(oI,e)}const Gt=ve("ZodStringFormat",(e,t)=>{Ft.init(e,t),eC.init(e,t)}),lI=ve("ZodEmail",(e,t)=>{y$.init(e,t),Gt.init(e,t)}),rw=ve("ZodGUID",(e,t)=>{g$.init(e,t),Gt.init(e,t)}),Ou=ve("ZodUUID",(e,t)=>{v$.init(e,t),Gt.init(e,t)}),cI=ve("ZodURL",(e,t)=>{b$.init(e,t),Gt.init(e,t)}),uI=ve("ZodEmoji",(e,t)=>{x$.init(e,t),Gt.init(e,t)}),dI=ve("ZodNanoID",(e,t)=>{w$.init(e,t),Gt.init(e,t)}),pI=ve("ZodCUID",(e,t)=>{k$.init(e,t),Gt.init(e,t)}),fI=ve("ZodCUID2",(e,t)=>{S$.init(e,t),Gt.init(e,t)}),hI=ve("ZodULID",(e,t)=>{j$.init(e,t),Gt.init(e,t)}),mI=ve("ZodXID",(e,t)=>{C$.init(e,t),Gt.init(e,t)}),gI=ve("ZodKSUID",(e,t)=>{N$.init(e,t),Gt.init(e,t)}),vI=ve("ZodIPv4",(e,t)=>{_$.init(e,t),Gt.init(e,t)}),yI=ve("ZodIPv6",(e,t)=>{O$.init(e,t),Gt.init(e,t)}),bI=ve("ZodCIDRv4",(e,t)=>{L$.init(e,t),Gt.init(e,t)}),xI=ve("ZodCIDRv6",(e,t)=>{M$.init(e,t),Gt.init(e,t)}),wI=ve("ZodBase64",(e,t)=>{z$.init(e,t),Gt.init(e,t)}),kI=ve("ZodBase64URL",(e,t)=>{$$.init(e,t),Gt.init(e,t)}),SI=ve("ZodE164",(e,t)=>{I$.init(e,t),Gt.init(e,t)}),jI=ve("ZodJWT",(e,t)=>{U$.init(e,t),Gt.init(e,t)}),tC=ve("ZodNumber",(e,t)=>{Yj.init(e,t),fn.init(e,t),e.gt=(r,s)=>e.check(tw(r,s)),e.gte=(r,s)=>e.check(Bh(r,s)),e.min=(r,s)=>e.check(Bh(r,s)),e.lt=(r,s)=>e.check(ew(r,s)),e.lte=(r,s)=>e.check(Uh(r,s)),e.max=(r,s)=>e.check(Uh(r,s)),e.int=r=>e.check(iw(r)),e.safe=r=>e.check(iw(r)),e.positive=r=>e.check(tw(0,r)),e.nonnegative=r=>e.check(Bh(0,r)),e.negative=r=>e.check(ew(0,r)),e.nonpositive=r=>e.check(Uh(0,r)),e.multipleOf=(r,s)=>e.check(nw(r,s)),e.step=(r,s)=>e.check(nw(r,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 rr(e){return _3(tC,e)}const CI=ve("ZodNumberFormat",(e,t)=>{B$.init(e,t),tC.init(e,t)});function iw(e){return O3(CI,e)}const NI=ve("ZodUnknown",(e,t)=>{F$.init(e,t),fn.init(e,t)});function sw(){return L3(NI)}const EI=ve("ZodNever",(e,t)=>{H$.init(e,t),fn.init(e,t)});function TI(e){return M3(EI,e)}const AI=ve("ZodArray",(e,t)=>{q$.init(e,t),fn.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(yd(n,r)),e.nonempty=n=>e.check(yd(1,n)),e.max=(n,r)=>e.check(Xj(n,r)),e.length=(n,r)=>e.check(Jj(n,r)),e.unwrap=()=>e.element});function Ir(e,t){return G3(AI,e,t)}const RI=ve("ZodObject",(e,t)=>{G$.init(e,t),fn.init(e,t),Pt(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:sw()}),e.loose=()=>e.clone({...e._zod.def,catchall:sw()}),e.strict=()=>e.clone({...e._zod.def,catchall:TI()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>xD(e,n),e.merge=n=>wD(e,n),e.pick=n=>yD(e,n),e.omit=n=>bD(e,n),e.partial=(...n)=>kD(nC,e,n[0]),e.required=(...n)=>SD(aC,e,n[0])});function It(e,t){const n={type:"object",get shape(){return lv(this,"shape",{...e}),this.shape},...Ue(t)};return new RI(n)}const _I=ve("ZodUnion",(e,t)=>{V$.init(e,t),fn.init(e,t),e.options=t.options});function pv(e,t){return new _I({type:"union",options:e,...Ue(t)})}const OI=ve("ZodIntersection",(e,t)=>{W$.init(e,t),fn.init(e,t)});function LI(e,t){return new OI({type:"intersection",left:e,right:t})}const Bm=ve("ZodEnum",(e,t)=>{Z$.init(e,t),fn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,s)=>{const l={};for(const u of r)if(n.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Bm({...t,checks:[],...Ue(s),entries:l})},e.exclude=(r,s)=>{const l={...t.entries};for(const u of r)if(n.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new Bm({...t,checks:[],...Ue(s),entries:l})}});function fo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Bm({type:"enum",entries:n,...Ue(t)})}const MI=ve("ZodTransform",(e,t)=>{Y$.init(e,t),fn.init(e,t),e._zod.parse=(n,r)=>{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 zI(e){return new MI({type:"transform",transform:e})}const nC=ve("ZodOptional",(e,t)=>{K$.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ow(e){return new nC({type:"optional",innerType:e})}const DI=ve("ZodNullable",(e,t)=>{Q$.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function lw(e){return new DI({type:"nullable",innerType:e})}const $I=ve("ZodDefault",(e,t)=>{X$.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function II(e,t){return new $I({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const PI=ve("ZodPrefault",(e,t)=>{J$.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function UI(e,t){return new PI({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const aC=ve("ZodNonOptional",(e,t)=>{e3.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function BI(e,t){return new aC({type:"nonoptional",innerType:e,...Ue(t)})}const FI=ve("ZodCatch",(e,t)=>{t3.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function HI(e,t){return new FI({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const qI=ve("ZodPipe",(e,t)=>{n3.init(e,t),fn.init(e,t),e.in=t.in,e.out=t.out});function cw(e,t){return new qI({type:"pipe",in:e,out:t})}const GI=ve("ZodReadonly",(e,t)=>{a3.init(e,t),fn.init(e,t)});function VI(e){return new GI({type:"readonly",innerType:e})}const WI=ve("ZodCustom",(e,t)=>{r3.init(e,t),fn.init(e,t)});function ZI(e){const t=new Vn({check:"custom"});return t._zod.check=e,t}function YI(e,t={}){return V3(WI,e,t)}function KI(e){const t=ZI(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Fl(r,n.value,t._zod.def));else{const s=r;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 Fh(e,t){if(!t||e==null)return;if(!t.includes("."))return e[t];let n=e;for(const r of t.split(".")){if(n==null)return;n=n[r]}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 fv={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 r=String(t??""),s=String(n??"asc")==="desc";return[...e].sort((l,u)=>{const d=r?Fh(l,r):l,f=r?Fh(u,r):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,r)=>{if(!Array.isArray(e))return[];const s=String(t??""),l=String(n??"==");return e.filter(u=>{const d=s?Fh(u,s):u;switch(l){case"==":return d==r;case"!=":return d!=r;case">":return Ze(d)>Ze(r);case"<":return Ze(d)<Ze(r);case">=":return Ze(d)>=Ze(r);case"<=":return Ze(d)<=Ze(r);case"contains":return String(d??"").includes(String(r??""));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),r=t!=null?Ze(t):0,s=Math.pow(10,r);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))}},hv=new Set(["Each"]),QI={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."}},Ia={Run:"run",ToAssistant:"continue_conversation",OpenUrl:"open_url",Set:"set",Reset:"reset"},rC=new Set(["Action",...Object.keys(Ia)]),XI=new Set([...Object.keys(fv),...hv,...rC]);function Hl(e){return XI.has(e)}const ki={Query:"Query",Mutation:"Mutation"};function bd(e){return e in ki}function xd(e){const t=e.type;if(t==="string"){const n=e.enum;return n?n.map(r=>`"${r}"`).join(" | "):"string"}if(t==="number"||t==="integer")return"number";if(t==="boolean")return"boolean";if(t==="array"){const n=e.items;return n?`${xd(n)}[]`:"any[]"}if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const r=e.required??[];return`{${Object.entries(n).map(([s,l])=>`${s}${r.includes(s)?"":"?"}: ${xd(l)}`).join(", ")}}`}return"object"}return"any"}function iC(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 r={};for(const[s,l]of Object.entries(n))r[s]=iC(l);return r}return{}}return null}const JI="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 r=8;return t.bindings&&n.push(`${r++}. 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(`${r++}. String concatenation: \`"text" + $var + "more"\``,`${r++}. Dot member access: \`query.field\` reads a field; on arrays it extracts that field from every element`,`${r++}. Index access: \`arr[0]\`, \`data[index]\``,`${r++}. Arithmetic operators: +, -, *, /, % (work on numbers; + is string concat when either side is a string)`,`${r++}. Comparison: ==, !=, >, <, >=, <=`,`${r++}. Logical: &&, ||, ! (prefix)`,`${r++}. Ternary: \`condition ? valueIfTrue : valueIfFalse\``,`${r++}. Parentheses for grouping: \`(a + b) * c\``),n.push("- Strings use double quotes with backslash escaping"),n.join(`
1421
+ `)}function t6(){const e=Object.values(fv).map(n=>`@${n.signature} — ${n.description}`),t=Object.values(QI).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 a6(){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 r6(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 r=['- Action can be assigned to a variable or inlined: Button("Go", onSubmit) and Button("Go", Action([...])) both work'];return e.toolCalls&&r.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
+ ${r.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)?"":"?"}: ${xd(d)}`).join(", "))}let n="";e.outputSchema&&(n=` → ${xd(e.outputSchema)}`);let r=`- ${e.name}(${t})${n}`;return e.description&&(r+=`
1608
+ ${e.description}`),r}function p6(e){const t=[],n=[],r=[];for(const l of e)typeof l=="string"?n.push(l):r.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 r)t.push(d6(l));const s=r.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=iC(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 r=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(r(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(r(h))}}}else{n.push("");for(const[,u]of Object.entries(e.components))n.push(r(u))}return n.join(`
1610
+ `)}function h6(e){var h,g,m;const t=e.root??"Root",n=!!((h=e.tools)!=null&&h.length),r=e.toolCalls??n,s=e.bindings??r,l=r||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??JI),d.push(""),d.push(e6(t,{supportsExpressions:l,bindings:s})),d.push(""),d.push(f6(e,{toolCalls:r,bindings:s,usesActionExpression:u})),l&&(d.push(""),d.push(t6())),r&&(d.push(""),d.push(n6()),d.push(""),d.push(a6())),u&&(d.push(""),d.push(r6({toolCalls:r,bindings:s}))),r&&s&&(d.push(""),d.push(i6())),r&&(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:r,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 sC=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),sC.set(e.props,e.name),{...e,ref:e.props}}function Pr(e){var t;return(t=e==null?void 0:e._zod)==null?void 0:t.def}function mv(e){var t;return(t=Pr(e))==null?void 0:t.type}function oC(e){const t=mv(e);return t==="optional"||t==="default"||t==="nullable"}function tc(e){let t=e,n=Pr(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=Pr(t);return t}function lC(e){return mv(tc(e))==="array"}function y6(e){const t=Pr(tc(e));if((t==null?void 0:t.type)==="array")return t.element??t.innerType}function b6(e){const t=Pr(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 sC.get(e)}function uw(e){const t=Pr(e);if((t==null?void 0:t.type)==="union"&&Array.isArray(t.options))return t.options}function w6(e){const t=Pr(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),r=k6(tc(e),t);if(r)return n?`$binding<${r}>`:r}function k6(e,t){var d;const n=x6(e,t);if(n)return n;const r=uw(e);if(r){const f=r.map(h=>Xs(h,t)).filter(Boolean);if(f.length>0)return f.join(" | ")}if(lC(e)){const f=y6(e);if(!f)return;const h=Xs(f,t);return h?uw(tc(f))!==void 0?`(${h})[]`:`${h}[]`:void 0}const s=mv(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=Pr(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=Pr(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=oC(h)?"?":"",m=Xs(h,t);return m?`${f}${g}: ${m}`:`${f}${g}`}).join(", ")}}`:"any"}function S6(e,t){return Object.entries(e).map(([n,r])=>({name:n,isOptional:oC(r),isArray:lC(r),typeAnnotation:Xs(r,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 dw(e,t){const n={};for(const[r,s]of Object.entries(e))n[r]={signature:j6(r,S6(s.props.shape,t)),description:s.description};return n}function C6(e){const t={},n=Qj();for(const r of e.components)n.add(r.props,{id:r.name}),t[r.name]=r;if(e.root&&!t[e.root]){const r=Object.keys(t).join(", ");throw new Error(`[createLibrary] Root component "${e.root}" was not found in components. Available components: ${r}`)}return{components:t,componentGroups:e.componentGroups,root:e.root,prompt(r){return h6({root:e.root,components:dw(t,n),componentGroups:e.componentGroups,...r})},toSpec(){return{root:e.root,components:dw(t,n),componentGroups:e.componentGroups}},toJSONSchema(){const r=It(Object.fromEntries(Object.entries(t).map(([s,l])=>[s,l.props])));return W3(r,{metadata:n})}}}function Dr(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 ro(e){return!e||typeof e!="object"||Array.isArray(e)?!1:E6.has(e.k)}function T6(e,t){const n=r=>{switch(t(r),r.k){case"Comp":r.args.forEach(n),Object.values(r.mappedProps??{}).forEach(n);break;case"Arr":r.els.forEach(n);break;case"Obj":r.entries.forEach(([,s])=>n(s));break;case"BinOp":n(r.left),n(r.right);break;case"UnaryOp":n(r.operand);break;case"Ternary":n(r.cond),n(r.then),n(r.else);break;case"Member":n(r.obj);break;case"Index":n(r.obj),n(r.index);break;case"Assign":n(r.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,pw=2,fw=3,Hh=4,xl=5,qh=6,Mu=7,hw=8,R6=9;function mw(e){let t=0;const n=()=>e[t]??{t:ie.EOF},r=()=>{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 pw;case ie.And:return fw;case ie.EqEq:case ie.NotEq:return Hh;case ie.Greater:case ie.Less:case ie.GreaterEq:case ie.LessEq:return xl;case ie.Plus:case ie.Minus:return qh;case ie.Star:case ie.Slash:case ie.Percent:return Mu;case ie.Dot:case ie.LBrack:return R6;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 r(),{k:"Str",v:y.v};if(y.t===ie.Num)return r(),{k:"Num",v:y.v};if(y.t===ie.True)return r(),{k:"Bool",v:!0};if(y.t===ie.False)return r(),{k:"Bool",v:!1};if(y.t===ie.Null)return r(),{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 r(),n().t===ie.Equals?(r(),{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():(r(),{k:"Ref",n:j})}if(y.t===ie.BuiltinCall)return((k=e[t+1])==null?void 0:k.t)===ie.LParen?h():(r(),{k:"Ref",n:y.v});if(y.t===ie.Ident)return r(),{k:"Ref",n:y.v};if(y.t===ie.Not)return r(),{k:"UnaryOp",op:"!",operand:u(hw)};if(y.t===ie.Minus)return r(),{k:"UnaryOp",op:"-",operand:u(hw)};if(y.t===ie.LParen){r();const j=u(0);return s(ie.RParen),j}return r(),{k:"Null"}}function f(y){const b=n();if(b.t===ie.Plus)return r(),{k:"BinOp",op:"+",left:y,right:u(qh)};if(b.t===ie.Minus)return r(),{k:"BinOp",op:"-",left:y,right:u(qh)};if(b.t===ie.Star)return r(),{k:"BinOp",op:"*",left:y,right:u(Mu)};if(b.t===ie.Slash)return r(),{k:"BinOp",op:"/",left:y,right:u(Mu)};if(b.t===ie.Percent)return r(),{k:"BinOp",op:"%",left:y,right:u(Mu)};if(b.t===ie.EqEq)return r(),{k:"BinOp",op:"==",left:y,right:u(Hh)};if(b.t===ie.NotEq)return r(),{k:"BinOp",op:"!=",left:y,right:u(Hh)};if(b.t===ie.Greater)return r(),{k:"BinOp",op:">",left:y,right:u(xl)};if(b.t===ie.Less)return r(),{k:"BinOp",op:"<",left:y,right:u(xl)};if(b.t===ie.GreaterEq)return r(),{k:"BinOp",op:">=",left:y,right:u(xl)};if(b.t===ie.LessEq)return r(),{k:"BinOp",op:"<=",left:y,right:u(xl)};if(b.t===ie.And)return r(),{k:"BinOp",op:"&&",left:y,right:u(fw)};if(b.t===ie.Or)return r(),{k:"BinOp",op:"||",left:y,right:u(pw)};if(b.t===ie.Question){r();const k=u(0);return s(ie.Colon),{k:"Ternary",cond:y,then:k,else:u(0)}}if(b.t===ie.Dot){r();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?(r(),String(k.v)):k.t===ie.StateVar?(r(),k.v.replace(/^\$/,"")):(r(),"?")}}if(b.t===ie.LBrack){r();const k=u(0);return s(ie.RBrack),{k:"Index",obj:y,index:k}}return y}function h(){const y=n().v;r(),s(ie.LParen);const b=[];for(;n().t!==ie.RParen&&n().t!==ie.EOF;)b.push(u(0)),n().t===ie.Comma&&r();return s(ie.RParen),{k:"Comp",name:y,args:b}}function g(){r();const y=[];for(;n().t!==ie.RBrack&&n().t!==ie.EOF;)y.push(u(0)),n().t===ie.Comma&&r();return s(ie.RBrack),{k:"Arr",els:y}}function m(){r();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?(r(),String(b.v)):b.t===ie.StateVar?(r(),b.v.replace(/^\$/,"")):(r(),"?");s(ie.Colon),y.push([k,u(0)]),n().t===ie.Comma&&r()}return s(ie.RBrace),{k:"Obj",entries:y}}return u(0)}function gw(e){const t=[];let n=0;const r=e.length;for(;n<r;){for(;n<r&&(e[n]===" "||e[n]===" "||e[n]==="\r");)n++;if(n>=r)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<r&&e[n+1]==="="?(t.push({t:ie.EqEq}),n+=2):(t.push({t:ie.Equals}),n++);continue}if(s==="!"){n+1<r&&e[n+1]==="="?(t.push({t:ie.NotEq}),n+=2):(t.push({t:ie.Not}),n++);continue}if(s===">"){n+1<r&&e[n+1]==="="?(t.push({t:ie.GreaterEq}),n+=2):(t.push({t:ie.Greater}),n++);continue}if(s==="<"){n+1<r&&e[n+1]==="="?(t.push({t:ie.LessEq}),n+=2):(t.push({t:ie.Less}),n++);continue}if(s==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:ie.And}),n+=2):(t.push({t:ie.And}),n++);continue}if(s==="|"){n+1<r&&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<r;)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<r;)if(e[n]==="\\"){if(n++,n<r){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<r&&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<r&&e[n+1]>="0"&&e[n+1]<="9";if(l||u){const d=n;for(e[n]==="-"&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&e[n]==="."&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")for(n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&(e[n]==="e"||e[n]==="E"))for(n++,n<r&&(e[n]==="+"||e[n]==="-")&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;t.push({t:ie.Num,v:+e.slice(d,n)});continue}if(s==="$"&&n+1<r&&(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<r&&(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<r&&(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<r&&(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<r&&(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:ro(e)?!0:Array.isArray(e)?e.some(Ju):Dr(e)?Object.values(e.props).some(Ju):Object.values(e).some(Ju)}function cC(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 r=t.syms.get(e);if((l=t.unreached)==null||l.delete(e),r.k==="Comp"&&bd(r.name))return{k:"RuntimeRef",n:e,refType:r.name===ki.Mutation?"mutation":"query"};t.visited.add(e);const s=t.currentStatementId;t.currentStatementId=e;try{const u=n==="value"?io(r,t):Fm(r,t);return n==="value"&&Dr(u)&&(u.statementId=e),u}finally{t.currentStatementId=s,t.visited.delete(e)}}function uC(e,t,n){if(!hv.has(e.name)||e.args.length<3)return null;const r=e.args[1],s=r.k==="Ref"?r.n:r.k==="Str"?r.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 r;switch(e.k){case"Ref":return n.has(e.n)?e:cC(e.n,t,"expr");case"Ph":return e;case"Comp":{const s=uC(e,t,n);if(s)return s;const l=e.args.map(d=>Mn(d,t,n));if(Hl(e.name)||bd(e.name))return{...e,args:l};const u=(r=t.cat)==null?void 0:r.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 Fm(e,t){return Mn(e,t,new Set)}function io(e,t){var n;switch(e.k){case"Ref":return cC(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 r=[];for(const s of e.els){if(s.k==="Ph")continue;const l=io(s,t);l===null&&(s.k==="Comp"||s.k==="Ref")||r.push(l)}return r}case"Obj":{const r={};for(const[s,l]of e.entries)r[s]=io(l,t);return r}case"Comp":{const{name:r,args:s}=e;if(Hl(r)){const f=uC(e,t,new Set);return f||{...e,args:s.map(h=>Fm(h,t))}}if(bd(r))return t.errors.push({code:"inline-reserved",component:r,path:"",message:`${r}() 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(r),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:r,path:"",message:`${r} 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:r,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(r)&&!bd(r))return t.errors.push({code:"unknown-component",component:r,path:"",message:`Unknown component "${r}" — not found in catalog or builtins`,statementId:t.currentStatementId}),null;const d=Object.values(u).some(f=>Ju(f));return{type:"element",typeName:r,props:u,partial:t.partial,hasDynamicProps:d}}default:return N6(e)?Fm(e,t):e}}function _6(e){const t=[];let n=!1,r=!1;for(let l=0;l<e.length;l++){const u=e[l];if(r){r=!1;continue}if(u==="\\"&&n){r=!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&&(r&&(s+="\\"),s+=n);for(let l=t.length-1;l>=0;l--)s+=t[l]==="("?")":t[l]==="["?"]":"}";return{text:s,wasIncomplete:!0}}function vw(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 r=e[n];if(r.t!==ie.Ident&&r.t!==ie.Type&&r.t!==ie.StateVar){for(;n<e.length&&e[n].t!==ie.Newline&&e[n].t!==ie.EOF;)n++;continue}const s=r.v,l=r.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 dC(e){if(!ro(e))return[];const t=new Set;return T6(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function yw(e,t){if(t.k==="Comp"&&t.name===ki.Query){const n=dC(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={},r=[],s=[];for(const l of e)switch(l.kind){case"state":n[l.id]=io(l.init,t);break;case"query":r.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 dC(d))f in n||(n[f]=null)}return{stateDeclarations:n,queryStatements:r,mutationStatements:s}}const bw="root";function xw(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,r){var l;if(e.has(bw))return bw;if(r&&e.has(r))return r;const s=r?t.find(u=>xw(u)&&u.expr.name===r):void 0;return s?s.id:((l=t.find(xw))==null?void 0:l.id)??n}function zu(e,t,n,r,s,l,u){const d=L6(e,t,n,u);if(!e.has(d))return ed(r);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:r,currentStatementId:d,unreached:m},b=io(f.get(d),y),k=Dr(b)?b:null;k&&(k.statementId=d);const{stateDeclarations:j,queryStatements:C,mutationStatements:S}=O6(t,y);return{root:k,meta:{incomplete:r,unresolved:h,orphaned:[...m],statementCount:s,errors:g},stateDeclarations:j,queryStatements:C,mutationStatements:S}}function M6(e){const t=[];let n=0;for(;n<e.length;){const r=e.indexOf("```",n);if(r===-1)break;let s=r+3;for(;s<e.length&&e[s]!==`
1614
+ `;)s++;if(s>=e.length){t.push(e.slice(r+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 r=3;for(;r<e.length&&e[r]!==`
1616
+ `;)r++;const s=r<e.length?r+1:3,l=e.slice(s),u=l.lastIndexOf("```");return u!==-1?l.slice(0,u):l}return e}function ww(e){return e.split(`
1617
+ `).map(t=>{let n=!1;for(let r=0;r<t.length;r++){const s=t[r];if(n){if(s==="\\"&&r+1<t.length){r++;continue}s===n&&(n=!1);continue}if(s==='"'||s==="'"){n=s;continue}if(s==="/"&&t[r+1]==="/"||s==="#")return t.substring(0,r).trimEnd()}return t}).join(`
1618
+ `)}function z6(e,t){let n="",r=0;const s=new Map;let l=0,u="";function d(m){const y=ww(m).trim();if(!(!y||/^```/.test(y)))for(const b of vw(gw(y))){const k=yw(b,mw(b.tokens));s.set(b.id,k),l++,u||(u=b.id)}}function f(){let m=0,y=0,b=!1,k=!1,j=r;for(let C=r;C<n.length;C++){const S=n[C];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=C+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,C).trim();E&&d(E),j=C+1,r=C+1}}return j}function h(){const m=f(),y=n.slice(m).trim();if(!y)return l===0?ed():zu(s,[...s.values()],u,!1,l,e,t);const b=ww(M6(y)).trim();if(!b)return l===0?ed():zu(s,[...s.values()],u,!1,l,e,t);const{text:k,wasIncomplete:j}=_6(b),C=vw(gw(k));if(!C.length)return l===0?ed(j):zu(s,[...s.values()],u,j,l,e,t);const S=new Map(s);for(const T of C){if(s.has(T.id))continue;const E=yw(T,mw(T.tokens));S.set(T.id,E)}return zu(S,[...S.values()],u||C[0].id,j,l+C.length,e,t)}function g(){n="",r=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 D6(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function $6(e){const t=new Map,n=e.$defs??{};for(const[r,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:D6(l[f])}));t.set(r,{params:d})}return t}function I6(e,t){return z6($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(r=>n.has(r)?`${r}*`:r).join(", ")}) — * marks required`}function U6(e,t,n){return e.map(r=>{var l;const s={source:"parser",code:r.code,message:r.message,component:r.component,path:r.path||void 0,statementId:r.statementId};return r.code==="unknown-component"&&n.length?s.hint=`Available components: ${n.join(", ")}`:r.code==="missing-required"||r.code==="null-required"?s.hint=P6(r.component,(l=t.$defs)==null?void 0:l[r.component]):r.code==="inline-reserved"&&(s.hint=`Declare as a top-level statement: myVar = ${r.component}(...)`),s})}function B6(e){return typeof e=="object"&&e!==null&&e.__reactive==="assign"}function gt(e,t,n){var r,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((r=t.extraScope)==null?void 0:r[e.n])??t.getState(e.n);case"Ref":case"RuntimeRef":return t.resolveRef(e.n);case"Arr":return e.els.map(u=>gt(u,t));case"Obj":return Object.fromEntries(e.entries.map(([u,d])=>[u,gt(d,t)]));case"Comp":{if(hv.has(e.name))return H6(e.name,e.args,t,n);const u=fv[e.name];if(u){const d=e.args.map(f=>gt(f,t));return u.fn(...d)}if(rC.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]=gt(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))Dr(m)?f[g]=wd(m,t,n):Array.isArray(m)&&(f[g]=m.map(y=>Dr(y)?wd(y,t,n):y));return h}return console.warn(`[openui] Unexpected unmapped Comp node: ${e.name}`),null}case"BinOp":{if(e.op==="&&"){const f=gt(e.left,t);return f&&gt(e.right,t)}if(e.op==="||"){const f=gt(e.left,t);return f||gt(e.right,t)}const u=gt(e.left,t),d=gt(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==="!"?!gt(e.operand,t):e.op==="-"?-Ze(gt(e.operand,t)):null;case"Ternary":return gt(e.cond,t)?gt(e.then,t):gt(e.else,t);case"Member":{const u=gt(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=gt(e.obj,t),d=gt(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 wd(e,t,n){var l,u;if(e.hasDynamicProps===!1)return e;const r=n.library.components[e.typeName],s={};for(const[d,f]of Object.entries(e.props)){const h=(u=(l=r==null?void 0:r.props)==null?void 0:l.shape)==null?void 0:u[d];s[d]=pC(f,t,n,h)}return{...e,props:s}}function pC(e,t,n,r){return fC(e,t,n,r,{recurseElement:s=>wd(s,t,n),recurse:(s,l)=>pC(s,t,n,l)})}function Hm(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(Hm)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,Hm(n)])}:{k:"Null"}}function F6(e,t,n){switch(e){case"Action":{const r=t.length>0?gt(t[0],n):[];return{steps:(Array.isArray(r)?r:[]).filter(s=>s!=null&&typeof s=="object"&&"type"in s)}}case"Run":{if(t.length===0)return null;const r=t[0];return r.k==="RuntimeRef"?{type:Ia.Run,statementId:r.n,refType:r.refType}:null}case"ToAssistant":{const r=t.length>0?String(gt(t[0],n)??""):"",s=t.length>1?String(gt(t[1],n)??""):void 0;return{type:Ia.ToAssistant,message:r,context:s}}case"OpenUrl":{const r=t.length>0?String(gt(t[0],n)??""):"";return{type:Ia.OpenUrl,url:r}}case"Set":{if(t.length<2)return null;const r=t[0];return r.k!=="StateRef"?null:{type:Ia.Set,target:r.n,valueAST:t[1]}}case"Reset":{const r=t.filter(s=>s.k==="StateRef").map(s=>s.n);return r.length===0?null:{type:Ia.Reset,targets:r}}default:return null}}function Ln(e,t,n){switch(e.k){case"Ref":return e.n===t?Hm(n):e;case"Member":if(ro(e.obj)){const r=Ln(e.obj,t,n);if(r.k==="Obj"){const s=r.entries.find(([l])=>l===e.field);if(s)return s[1]}return{...e,obj:r}}return e;case"Index":return{...e,obj:ro(e.obj)?Ln(e.obj,t,n):e.obj,index:ro(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(r=>Ln(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,s])=>[r,Ln(s,t,n)])};case"Comp":{const r={...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);r.mappedProps=s}return r}case"Assign":return{...e,value:Ln(e.value,t,n)};default:return e}}function H6(e,t,n,r){if(e==="Each"){if(t.length<3)return[];const s=gt(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=gt(h,g,r);return r&&Dr(m)?wd(m,g,r):m})}return null}function fC(e,t,n,r,s){if(e==null||typeof e!="object")return e;if(ro(e)){if(e.k==="StateRef"&&r&&Ll(r))return{__reactive:"assign",target:e.n,expr:{k:"StateRef",n:"$value"}};const d=gt(e,t,n);return Dr(d)?s.recurseElement(d):Array.isArray(d)?d.map(f=>Dr(f)?s.recurseElement(f):f):B6(d)&&!(r&&Ll(r))?t.getState(d.target)??null:d}if(typeof e=="string"&&r&&Ll(r))return e;if(Array.isArray(e))return e.map(d=>s.recurse(d,r));if(Dr(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,r);return d}return e}function hC(e,t){var l,u,d;if(e.hasDynamicProps===!1)return e;const n={library:t.library},r=t.library.components[e.typeName],s={};for(const[f,h]of Object.entries(e.props)){const g=(u=(l=r==null?void 0:r.props)==null?void 0:l.shape)==null?void 0:u[f];try{s[f]=mC(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 mC(e,t,n,r){return fC(e,t.ctx,n,r,{recurseElement:s=>hC(s,t),recurse:(s,l)=>mC(s,t,n,l)})}var qm=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,r;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 qm(s||"Unknown error")}if(e.structuredContent!=null)return e.structuredContent;const t=(r=e.content)==null?void 0:r.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 Gm=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 kw(e){return JSON.stringify(e,(t,n)=>{if(n&&typeof n=="object"&&!Array.isArray(n)){const r={};for(const s of Object.keys(n).sort())r[s]=n[s];return r}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 r=n!=null?"::"+kw(n):"";return e+"::"+kw(t)+r}function V6(e){const t=new Map,n=new Map,r=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[_,P]of t){const F=r.get(P.cacheKey);if(F&&F.data!==void 0)M[_]=F.data;else if(P.prevCacheKey){const W=r.get(P.prevCacheKey);W&&W.data!==void 0?M[_]=W.data:M[_]=P.defaults}else M[_]=P.defaults;P.loading&&(M.__openui_loading.push(_),P.everFetched&&M.__openui_refetching.push(_)),P.error&&M.__openui_errors.push(P.error)}for(const[_,P]of n)M[_]=P.result,P.error&&M.__openui_errors.push(P.error);try{const _=JSON.stringify(M);if(_===u)return!1;l=M,u=_}catch{l=M,u=""}return!0}function g(){for(const M of[...s])M()}async function m(M,_){if(!e)return;const P=t.get(_);if(!P)return;const F=M,W=P.toolName,I=P.args;let $=r.get(F);$?$.inFlight=!0:($={data:void 0,inFlight:!0},r.set(F,$)),P.loading=!0,h(),g();try{const q=await e.callTool(W,I??{});if(d)return;const V=t.get(_);if(!V||V.cacheKey!==F){$.inFlight=!1;return}if($.data=q??null,V.everFetched=!0,V.error=void 0,V.prevCacheKey&&V.prevCacheKey!==F){const X=V.prevCacheKey;V.prevCacheKey=void 0,y(X)}}catch(q){const V=t.get(_);V&&V.cacheKey===F&&(q instanceof Gm?V.error={source:"query",code:"tool-not-found",message:`Query tool "${W}" not found`,statementId:_,component:"Query",toolName:W,hint:q.availableTools.length?`Available tools: ${q.availableTools.join(", ")}`:void 0}:q instanceof qm?V.error={source:"query",code:"mcp-error",message:`Query "${W}" returned an error: ${q.toolErrorText}`,statementId:_,component:"Query",toolName:W}:V.error={source:"query",code:"tool-error",message:`Query "${W}" failed: ${q instanceof Error?q.message:String(q)}`,statementId:_,component:"Query",toolName:W}),console.error(`Query "${W}" failed:`,q)}finally{$.inFlight=!1;const q=t.get(_);q&&q.cacheKey===F?(q.loading=!1,h()&&g(),q.needsRefetch&&(q.needsRefetch=!1,m(q.cacheKey,_))):h()&&g()}}function y(M){for(const _ of t.values())if(_.cacheKey===M||_.prevCacheKey===M)return;r.delete(M)}function b(M){if(d)return;const _=new Set(M.map(P=>P.statementId));for(const[P,F]of t)_.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),W=t.get(P.statementId);W?(W.cacheKey!==F&&(W.prevCacheKey=W.cacheKey),W.toolName=P.toolName,W.args=P.args,W.defaults=P.defaults,W.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),$=r.get(F),q=$&&$.data!==void 0&&!$.inFlight;e&&!q&&!($!=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=r.get(I.cacheKey))!=null&&X.inFlight||m(I.cacheKey,P.statementId)},V*1e3)),I.refreshInterval=V)}h()&&g()}function k(M){const _=t.get(M);if(!_)return null;const P=r.get(_.cacheKey);if(P&&P.data!==void 0)return P.data;if(_.prevCacheKey){const F=r.get(_.prevCacheKey);if(F&&F.data!==void 0)return F.data}return _.defaults}function j(M){var _;return((_=t.get(M))==null?void 0:_.loading)??!1}function C(){for(const M of t.values())if(M.loading)return!0;return!1}function S(M){var P;if(d||!e)return;const _=M!=null&&M.length?M.filter(F=>t.has(F)):[...t.keys()];for(const F of _){const W=t.get(F);W&&((P=r.get(W.cacheKey))!=null&&P.inFlight?W.needsRefetch=!0:m(W.cacheKey,F))}}function T(M){const _=new Set(M.map(P=>P.statementId));for(const P of n.keys())_.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,_,P){if(d||!e)return!1;const F=n.get(M);if(!F||F.result.status==="loading")return!1;const W=f;F.result={status:"loading"},h(),g();let I=!1;try{const $=await e.callTool(F.toolName,_);if(d||W!==f)return!1;F.result={status:"success",data:$},F.error=void 0,I=!0}catch($){if(d||W!==f)return!1;const q=$ instanceof Error?$.message:String($);F.result={status:"error",error:q},$ instanceof Gm?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 qm?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: ${q}`,statementId:M,component:"Mutation",toolName:F.toolName}}return h(),g(),I&&(P!=null&&P.length)&&S(P),I}function A(M){var _;return((_=n.get(M))==null?void 0:_.result)??null}function B(M){return s.add(M),()=>s.delete(M)}function R(){return l}function D(){d=!1}function H(){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:C,invalidate:S,registerMutations:T,fireMutation:E,getMutationResult:A,subscribe:B,getSnapshot:R,activate:D,dispose:H}}function W6(){const e=new Map,t=new Set;let n={};function r(){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(C=>Object.is(y[C],b[C])))return}e.set(m,y),s(),r()}}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(),r()}function g(){e.clear(),t.clear(),n={}}return{get:l,set:u,subscribe:d,getSnapshot:f,initialize:h,dispose:g}}function _a(e){return v6(e)}function Z6(e){return C6(e)}const gC=w.createContext(null);function vC(){const e=w.useContext(gC);if(!e)throw new Error("useOpenUI must be used within a <Renderer /> component.");return e}function Y6(){return vC().renderNode}w.createContext(void 0);function Gh(e){return e&&typeof e=="object"&&!Array.isArray(e)&&"value"in e?e.value:e}function K6({response:e,library:t,isStreaming:n,onAction:r,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[K,L]of Object.entries(l))K.startsWith("$")?X[K]=L:y.set(K,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),C=w.useSyncExternalStore(b.subscribe,b.getSnapshot,b.getSnapshot),S=w.useMemo(()=>({getState:V=>Gh(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 K={};if(X.deps)for(const L of X.deps)K[L]=j[L];return{statementId:X.statementId,toolName:X.toolAST?gt(X.toolAST,S):"",args:X.argsAST?gt(X.argsAST,S):null,defaults:X.defaultsAST?gt(X.defaultsAST,S):null,refreshInterval:X.refreshAST?gt(X.refreshAST,S):void 0,deps:Object.keys(K).length>0?K: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?gt(X.toolAST,S):""}));b.registerMutations(V)},[n,m==null?void 0:m.mutationStatements,S,b]);const T=w.useRef({onAction:r,onStateUpdate:s,onError:d});T.current={onAction:r,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,K;const V=y.getSnapshot();V!==A.current&&(A.current=null,(K=(X=T.current).onStateUpdate)==null||K.call(X,V))})),[y]);const B=w.useCallback((V,X)=>{if(!V)return Gh(y.get(X));const K=y.get(V);if(!(!K||typeof K!="object"||Array.isArray(K)))return Gh(K[X])},[y]),R=w.useCallback((V,X,K,L,U=!0)=>{var O,ne;const G={value:L,componentType:X};if(!V)y.set(K,G);else{const ue=y.get(V),le=ue&&typeof ue=="object"&&!Array.isArray(ue)?ue:{};y.set(V,{...le,[K]:G})}U&&((ne=(O=T.current).onStateUpdate)==null||ne.call(O,y.getSnapshot()))},[y]),D=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]),H=w.useCallback(async(V,X,K)=>{var O,ne,ue;const L=D(X),{onAction:U}=T.current;if(K&&!("steps"in K)){const le=K.type||Lu.ContinueConversation,be={...K.params||{}};K.url&&(be.url=K.url),K.context&&(be.context=K.context),U==null||U({type:le,params:be,humanFriendlyMessage:V,formState:L,formName:X});return}const G=K;if(G!=null&&G.steps){for(const le of G.steps)switch(le.type){case Ia.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),Re=be!=null&&be.argsAST?gt(be.argsAST,S):{};if(!await b.fireMutation(le.statementId,Re))return}else b.invalidate([le.statementId]);break;case Ia.ToAssistant:U==null||U({type:Lu.ContinueConversation,params:le.context?{context:le.context}:{},humanFriendlyMessage:le.message,formState:L,formName:X});break;case Ia.OpenUrl:U==null||U({type:Lu.OpenUrl,params:{url:le.url},humanFriendlyMessage:"",formState:L,formName:X});break;case Ia.Set:{if(!le.valueAST){console.warn(`[openui] Set action for ${le.target} has no valueAST — skipping`);break}const be=gt(le.valueAST,S);y.set(le.target,be);break}case Ia.Reset:{const be=((ue=E.current)==null?void 0:ue.stateDeclarations)??{};for(const Re of le.targets)y.set(Re,be[Re]??null);break}}return}U==null||U({type:Lu.ContinueConversation,params:{},humanFriendlyMessage:V,formState:L,formName:X})},[b,S,D,y]),M=w.useRef([]),_=w.useRef(n);_.current=n;const P=w.useCallback(V=>{_.current||M.current.push(V)},[]),F=w.useMemo(()=>({library:t,renderNode:f,triggerAction:H,isStreaming:n,getFieldValue:B,setFieldValue:R,store:y,evaluationContext:S,reportError:P}),[t,f,n,H,B,R,y,S,P]),W=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 K=hC(m.root,X);return W.current=V,{...m,root:K}}catch(K){const L=K instanceof Error?K.message:String(K);return V.push({source:"runtime",code:"runtime-error",message:`Prop evaluation failed: ${L}`}),W.current=V,m}},[m,S,t,y,j,C]),$=C.__openui_loading.length>0,q=w.useRef("");return w.useEffect(()=>{var K,L,U,G;if(n){q.current!==""&&(q.current="",(L=(K=T.current).onError)==null||L.call(K,[]));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(...W.current),V.push(...M.current),M.current=[],V.push(...C.__openui_errors??[]);const X=JSON.stringify(V);if(X!==q.current){if(q.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,C,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 r,s;const n=this.props.componentName??"Unknown";(s=(r=this.props).onError)==null||s.call(r,{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 yC(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:yC(t)},n));if(typeof e=="object"&&e!==null){const t=e;if(t.type==="element")return o.jsx(bC,{node:t})}return null}function bC({node:e}){var s;const{library:t,reportError:n}=vC(),r=(s=t.components[e.typeName])==null?void 0:s.component;return r?o.jsx(Q6,{componentName:e.typeName,onError:n,children:o.jsx(X6,{el:e,Comp:r})}):null}function X6({el:e,Comp:t}){const n=Y6();return o.jsx(t,{props:e.props,renderNode:n})}let Sw=!1;function J6(){if(Sw||typeof document>"u")return;Sw=!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:r,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 Gm(S,Object.keys(A));return B(T)}}),{result:b,parseResult:k,contextValue:j,isQueryLoading:C}=K6({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:s,initialState:l,toolProvider:d!=null?y.current:null,onError:h},yC);return w.useEffect(()=>{var S;(S=g.current)==null||S.call(g,k)},[k]),b!=null&&b.root?o.jsx(gC.Provider,{value:j,children:o.jsxs("div",{style:{position:"relative"},children:[C&&(f??o.jsx(eP,{})),o.jsx("div",{style:{opacity:C?.7:1,transition:"opacity 0.2s ease"},children:o.jsx(bC,{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 aP=({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((r,s)=>o.jsx(Ve.Fragment,{children:t(r)},s)):t(n)]})},rP=({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,r)=>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})]},r))}):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:gv(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((r,s)=>o.jsxs("div",{className:"v10-genui-type-item",title:r.uri,children:[o.jsx("div",{className:"v10-genui-type-item-label",children:r.label}),r.sub?o.jsx("div",{className:"v10-genui-type-item-sub",children:r.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:["· ",gv(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(Du,{label:"Files",value:e.fileCount}),typeof e.classCount=="number"&&o.jsx(Du,{label:"Classes",value:e.classCount}),typeof e.functionCount=="number"&&o.jsx(Du,{label:"Functions",value:e.functionCount}),typeof e.interfaceCount=="number"&&o.jsx(Du,{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:jw(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,r)=>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]},r))]}):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:jw(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,r)=>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})]},r))]}):null]})]})},Du=({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 gv(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 gv(e).replace(/\^\^<?.*$/,"").replace(/^"(.+)"$/,"$1")}function jw(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=_a({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:It({title:$e().optional().describe("Optional top-of-panel title override (defaults to the entity rdfs:label)")}),component:aP}),bP=_a({name:"EntityCard",description:"Compact header card for any entity: name, rdf:type label, optional subtitle, and up to 6 small stat chips.",props:It({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:Ir(It({label:$e(),value:$e(),tone:fo(["default","success","warn","danger","info"]).optional()})).max(6).optional()}),component:rP}),xP=_a({name:"EntityStatsGrid",description:"Grid of numeric stats with labels. Use for summarising counts (files, classes, additions, deletions).",props:It({stats:Ir(It({label:$e(),value:pv([$e(),rr()]),hint:$e().optional()})).min(1).max(8)}),component:iP}),wP=_a({name:"TripleTable",description:"Fallback raw-triples table. Use sparingly — only when the entity has no better structured components in this library.",props:It({heading:$e().optional(),rows:Ir(It({predicate:$e(),object:$e()})).max(60)}),component:sP}),kP=_a({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:It({heading:$e().optional(),groups:Ir(It({typeLabel:$e(),icon:$e().optional(),items:Ir(It({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(30)})).max(8)}),component:oP}),SP=_a({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:It({heading:$e().describe('Human-readable heading (e.g. "Imports", "Affected files")'),predicate:$e().optional(),items:Ir(It({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(40)}),component:lP}),jP=_a({name:"PackageCard",description:"Specialised card for a code:Package entity: name, folder, description, and a mini-stats strip.",props:It({name:$e(),folder:$e().optional(),description:$e().optional(),fileCount:rr().optional(),classCount:rr().optional(),functionCount:rr().optional(),interfaceCount:rr().optional()}),component:cP}),CP=_a({name:"FileCard",description:"Specialised card for a code:File entity: path, language, line count, owning package.",props:It({path:$e(),language:$e().optional(),lineCount:rr().optional(),packageName:$e().optional()}),component:uP}),NP=_a({name:"DecisionCard",description:"Specialised card for a decisions:Decision entity: title, status badge, date, context/outcome quoted sections.",props:It({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=_a({name:"PRCard",description:"Specialised card for a github:PullRequest entity: title + #number, state, author, merged badge, body preview.",props:It({title:$e(),number:rr().optional(),state:fo(["open","closed","merged"]).optional(),author:$e().optional(),mergedAt:$e().optional(),body:$e().optional(),url:$e().optional()}),component:pP}),TP=_a({name:"TaskCard",description:"Specialised card for a tasks:Task entity: title, status chip, priority, assignee, estimate.",props:It({title:$e(),status:fo(["todo","in_progress","blocked","done","cancelled"]).optional(),priority:fo(["p0","p1","p2","p3"]).optional(),assignee:$e().optional(),estimate:rr().optional()}),component:fP}),AP=_a({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:It({onChain:It({txHash:$e().optional(),blockNumber:pv([$e(),rr()]).optional(),chain:$e().optional()}).optional(),consensus:It({signers:Ir(It({did:$e(),label:$e().optional(),reputation:rr().optional(),signature:$e().optional()})).max(10).optional(),quorum:$e().optional().describe('e.g. "3 of 5"')}).optional(),knowledgeAsset:It({ual:$e().optional(),contentHash:$e().optional(),tracLocked:$e().optional(),tokenId:$e().optional()}).optional(),timeline:Ir(It({label:$e(),at:$e()})).max(6).optional()}),component:hP}),xC=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 Vh=null;function RP(){return Vh===null&&(Vh=xC.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."]})),Vh}async function*_P(e){const t=await fetch("/api/genui/render",{method:"POST",headers:{"Content-Type":"application/json",...Bt()},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(),r=new TextDecoder;let s="";try{for(;;){const{value:l,done:u}=await n.read();if(u)break;s+=r.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=Cw(f);h&&(yield h)}}if(s.trim()){const l=Cw(s);l&&(yield l)}}finally{n.releaseLock()}}function Cw(e){let t="message",n="";for(const r of e.split(`
1624
+ `))r.startsWith("event:")?t=r.slice(6).trim():r.startsWith("data:")&&(n+=r.slice(5).trim());if(!n)return null;try{const r=JSON.parse(n);switch(t){case"start":return{type:"start",...r};case"delta":return{type:"delta",text:r.text??""};case"final":return{type:"final",content:r.content??""};case"error":return{type:"error",error:r.error??"unknown error"};case"done":return{type:"done"};default:return null}}catch{return null}}const OP=({contextGraphId:e,entityUri:t,placeholder:n,fallback:r})=>{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=RP();for await(const b of _P({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?r?o.jsx(o.Fragment,{children:r(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:xC,isStreaming:u})})},LP="LLM not configured",MP=({error:e})=>{const t=pn(r=>r.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 Nw({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 r=t.forSubGraph(n),s=(r==null?void 0:r.color)??"#64748b",l=(r==null?void 0:r.icon)??"•",u=(r==null?void 0:r.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 zP({entity:e,contextGraphId:t,onVerified:n}){const r=Ur(),[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(!r)return null;for(const E of e.types){const A=r.forType(E);if(A&&(y==="working"&&(A.promoteLabel||A.promoteHint)||y==="shared"&&(A.publishLabel||A.publishHint)))return A}return null},[e.types,r,y]),k=w.useMemo(()=>{if(!r)return null;for(const E of e.subGraphs){if(E==="meta")continue;const A=r.forSubGraph(E);if(A!=null&&A.sourceAssertion)return{binding:A,subGraph:E}}return null},[e.subGraphs,r]);if(y==="verified"||!b)return null;const j=y==="working"?{kind:"promote",label:b.promoteLabel??"Promote to Shared Memory",hint:b.promoteHint??"Shares this entity 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??"Anchors this entity 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."},C=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,[e.uri],k.subGraph);d(Og(E,A))}else{const A=await Rg(t,k.binding.sourceAssertion,k.subGraph?{subGraphName:k.subGraph}:{});d(A)}n()}catch(A){const B=j.kind==="promote"?lo(E,A):null,R=A instanceof Ag?A.message:B?B.message:(A==null?void 0:A.message)??"Action failed";m(R)}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:C,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,R;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?` (${NR})`:"":" (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]})]}),((R=(B=u.kas)==null?void 0:B[0])==null?void 0:R.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 DP({entity:e,allEntities:t,allTriples:n,onNavigate:r,onClose:s,contextGraphId:l,onRefresh:u,onOpenAgent:d}){const[f,h]=w.useState("content"),g=Gn(I=>I.theme),m=Ur(),y=ls(),{icon:b,type:k}=Fd(e,m),j=P4(e),C=Bd(e),S=C?(y==null?void 0:y.get(C))??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=ir(e.trustLevel,1),B=w.useMemo(()=>{const I=[];for(const[,$]of t)for(const q of $.connections)q.targetUri===e.uri&&I.push({pred:Ws(q.predicate),entity:$});return I},[e.uri,t]),R=w.useMemo(()=>n.filter(I=>yt(I.subject)===e.uri||yt(I.object)===e.uri),[e.uri,n]),D=w.useMemo(()=>U4(e.uri,n,1),[e.uri,n]),H=w.useMemo(()=>{const I=new Set;for(const $ of t.values())aj($)&&I.add(yt($.uri));return I},[t]),M=w.useMemo(()=>new Set([yt(e.uri)]),[e.uri]),_=w.useMemo(()=>md(D,H,{focalSubjects:M}),[D,H,M]),P=w.useMemo(()=>{const I=Ki[e.trustLevel];return{labelMode:"humanized",renderer:"2d",labels:Pd({minZoomForLabels:.2}),style:{namespaceColors:Zg(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]),W=R.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," · ",W," triples"]})]}),(S||C)&&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:C??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 q=t.get(I.targetUri);return o.jsxs("button",{className:"v10-ka-conn",onClick:()=>r(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}),q&&o.jsx(Nw,{entity:q,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:()=>r(I.entity.uri),children:[o.jsx("span",{className:"v10-ka-conn-target",children:I.entity.label}),o.jsx(Nw,{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:[W," 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:R.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('"')?Ud(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(R.length,50)," of ",R.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=>_.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(tv,{data:_,format:"triples",options:P,viewConfig:F,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:$=>($==null?void 0:$.id)&&$.id!==e.uri&&r($.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(uD,{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(zP,{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:W})]}),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=D4(e,u),f=$4(e,u),h=d?t==null?void 0:t.get(d):null;return{uri:d,at:f,agent:h}},r=n("created"),s=n("promoted"),l=n("published");return o.jsxs("div",{className:"v10-ka-timeline",children:[e.trustLevel==="verified"&&o.jsx(Wh,{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(Wh,{toneClass:"shared",title:"Promoted to Shared Working Memory",actionWord:"Promoted",agent:s.agent,agentUri:s.uri,at:s.at}),o.jsx(Wh,{toneClass:"created",title:"Created in Working Memory",actionWord:"Created",agent:r.agent,agentUri:r.uri,at:r.at})]})}function Wh({toneClass:e,title:t,actionWord:n,agent:r,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})]}),(r||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:r??void 0,fallbackUri:s??void 0,size:"sm"})]})]})}function Ew(){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:r}){const s=Ur(),[l,u]=w.useState([]),[d,f]=w.useState(!0),[h,g]=w.useState(null);w.useEffect(()=>{let R=!1;return f(!0),g(null),Dg(e).then(D=>{R||u(D.subGraphs??[])}).catch(D=>{R||g(D instanceof Error?D.message:"Failed to load subgraphs")}).finally(()=>{R||f(!1)}),()=>{R=!0}},[e]);const{total:m}=Kg(t),y=Object.values(t.layerStatus??{}),b=t.loading||y.some(R=>R==="loading"),k=t.error!==null||t.partial||y.some(R=>R==="error"),j=w.useMemo(()=>{const R=new Map;for(const D of t.entityList){const H=yt(D.uri);for(const M of D.subGraphs){let _=R.get(M);_||(_=new Set,R.set(M,_)),_.add(H)}}return R},[t.entityList]),{triplesBySubGraph:C,tripleCountBySubGraph:S}=w.useMemo(()=>{const R=new Map;for(const M of t.allTriples){if(!M.subGraph)continue;let _=R.get(M.subGraph);_||(_=[],R.set(M.subGraph,_)),_.push(M)}for(const M of t.allTriples)if(!M.subGraph){for(const[_,P]of j)if(Rm(M,{slug:_,isRoot:!1,scopedUris:P})){let F=R.get(_);F||(F=[],R.set(_,F)),F.push(M)}}const D=new Map,H=new Map;for(const[M,_]of R){const F=_m(_,t.entities).map(W=>({subject:W.subject,predicate:W.predicate,object:W.object}));H.set(M,F.length),D.set(M,M1(F))}return{triplesBySubGraph:D,tripleCountBySubGraph:H}},[t.allTriples,t.entities,j]),T=w.useMemo(()=>{const R=new Map;for(const D of t.entityList)for(const H of D.subGraphs){let M=R.get(H);M||(M={wm:0,swm:0,vm:0},R.set(H,M)),D.trustLevel==="verified"?M.vm++:D.trustLevel==="shared"?M.swm++:M.wm++}return R},[t.entityList]),E=w.useMemo(()=>{const R=new Map;for(const D of t.entityList){const H=yt(D.uri);for(const M of D.subGraphs){let _=R.get(M);_||(_=new Map,R.set(M,_)),_.set(H,D.trustLevel),H!==D.uri&&_.set(D.uri,D.trustLevel)}}return R},[t.entityList]),A=w.useMemo(()=>l.filter(Qg).map(R=>{const D=(s==null?void 0:s.forSubGraph(R.name))??{},H=C.get(R.name)??[],M=j.get(R.name)??new Set,_=E.get(R.name)??new Map;return{slug:R.name,icon:D.icon??"•",color:D.color??"#64748b",displayName:D.displayName??R.name,description:D.description,rank:D.rank??99,entityCount:M.size>0?M.size:R.entityCount,tripleCount:S.get(R.name)??0,triples:md(H,M),layerCounts:T.get(R.name)??{wm:0,swm:0,vm:0},entityTrustByUri:_}}).sort((R,D)=>R.rank-D.rank),[l,s,C,S,T,j,E]),B=w.useMemo(()=>{const R=[],D=new Set,H=new Map;let M=0,_=0,P=0;for(const X of t.entityList){if(X.subGraphs.size>0)continue;R.push(X);const K=yt(X.uri);D.add(K),H.set(K,X.trustLevel),K!==X.uri&&H.set(X.uri,X.trustLevel),X.trustLevel==="verified"?P++:X.trustLevel==="shared"?_++:M++}const F=t.allTriples.filter(X=>!X.subGraph),W=_m(F,t.entities).map(X=>({subject:X.subject,predicate:X.predicate,object:X.object})),I=W.length,$=md(W,D),q=M1($),V=(s==null?void 0:s.forSubGraph($a))??{};return{slug:$a,icon:V.icon??"⊘",color:V.color??"#64748b",displayName:V.displayName??"Root",description:V.description,rank:999,entityCount:R.length,tripleCount:I,triples:q,layerCounts:{wm:M,swm:_,vm:P},entityTrustByUri:H}},[t.entityList,t.allTriples,t.entities,s]);return d&&A.length===0?o.jsx(on,{compact:!0,icon:"#",title:"Loading subgraphs...",className:"v10-sgov-state"}):h&&A.length===0?o.jsx(on,{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(on,{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:()=>r($a),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(R=>o.jsx(Tw,{card:R,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>r(R.slug)},R.slug)),o.jsx(Tw,{card:B,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>r($a),variant:"root"},$a)]})]})}function Tw({card:e,isHydrating:t=!1,isFailedOrPartial:n=!1,onNodeClick:r,onOpen:s,variant:l}){const u=w.useMemo(()=>{const h={};for(const[g,m]of e.entityTrustByUri)h[g]=Ki[m];return h},[e.entityTrustByUri]),d=w.useMemo(()=>({labelMode:"humanized",renderer:"2d",labels:Pd({minZoomForLabels:.8}),style:{classColors:cj,predicateColors:uj,namespaceColors:Zg(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(wC,{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(tv,{data:e.triples,format:"triples",options:d,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:r,initialFit:!0})})})]})}function wC({counts:e,activeLayers:t,onClickLayer:n,compact:r=!1}){const s=e.wm+e.swm+e.vm;if(s===0)return r?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${r?" compact":""}`,children:[!r&&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:r}){const s=Ur(),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":r,children:o.jsx(on,{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":r,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}=Fd(h,s),y=Bd(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:r,onSelectEntity:s,activeTab:l,onTabChange:u,initialLayer:d,initialEnabledLayers:f,onEnabledLayersChange:h}){const g=Ur(),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,C]=w.useState("items"),S=l??j,T=S==="timeline"&&!k?"items":S,E=u??C,[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 R=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]),[D,H]=w.useState(R);w.useEffect(()=>{h==null||h(D)},[D,h]);const[M,_]=w.useState(new Map),[P,F]=w.useState(null),[W,I]=w.useState(null),[$,q]=w.useState(!1),[V,X]=w.useState(null),K=e===$a,L=w.useMemo(()=>{const ee=[];for(const ce of t.entityList)(K?ce.subGraphs.size===0:ce.subGraphs.has(e))&&ee.push(ce);return ee},[t.entityList,e,K]),U=w.useMemo(()=>new Set(L.map(ee=>ee.uri)),[L]),G=w.useMemo(()=>t.graphTriples.filter(ee=>Rm(ee,{slug:e,isRoot:K,scopedUris:U})),[t.graphTriples,U,e,K]),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(D.size!==1)return null;const ee=D.values().next().value;return ee==="verified"?"vm":ee==="shared"?"swm":ee==="working"?"wm":null},[D]),ue=w.useMemo(()=>{let ee=L;if(D.size<3&&(ee=ee.filter(ce=>D.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 W&&(ee=ee.filter(ce=>W.has(ce.uri))),ee},[L,D,M,y,W]),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(Vt=>et.has(Vt)))return!1}return!(W&&!W.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||!Rm(Ce,{slug:e,isRoot:K,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,K,L,y,M,W])??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!(W&&!W.has(ce.uri))})}return ue},[ne,L,ue,y,M,W]),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]=Ki[ce.trustLevel];const he=yt(ce.uri);he!==ce.uri&&(ee[he]=Ki[ce.trustLevel])}return ee},[ne,Ie]),ft=D.size===3?"All layers":ne?Dn[ne].title:Array.from(D).map(ee=>Dn[ee==="verified"?"vm":ee==="shared"?"swm":"wm"].trustLabel).join(" + "),ze=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=>{H(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)=>{_(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)},[]),_t=w.useCallback(async ee=>{var ce;q(!0),X(null),F(ee.slug);try{const he=await sa(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),Vt=Ne.startsWith("<")&&Ne.endsWith(">")?Ne.slice(1,-1):Ne;Ce.add(Vt)}I(Ce)}catch(he){X((he==null?void 0:he.message)??String(he)),I(null),F(null)}finally{q(!1)}},[n]),Dt=(m==null?void 0:m.color)??(K?"var(--text-tertiary)":"#64748b"),Yt=(m==null?void 0:m.icon)??"•",Ht=(m==null?void 0:m.displayName)??e,ut=m==null?void 0:m.description;w.useEffect(()=>{H(R),_(new Map),Oe()},[e,Oe,R]),w.useEffect(()=>{l||C("items")},[e,l]),w.useEffect(()=>{S!==T&&E(T)},[S,T,E]);const Q=!(D.size===R.size&&[...D].every(ee=>R.has(ee)))||M.size>0||!!W,Z=()=>{H(new Set(R)),_(new Map),Oe()};return o.jsxs("div",{className:"v10-layer-detail v10-subgraph-detail",style:{"--sg-color":Dt},children:[o.jsxs("div",{className:"v10-subgraph-detail-header",children:[o.jsx("span",{className:"v10-subgraph-detail-icon",style:{color:Dt},children:Yt}),o.jsxs("div",{className:"v10-subgraph-detail-title-wrap",children:[o.jsx("div",{className:"v10-subgraph-detail-title",children:Ht}),ut&&o.jsx("div",{className:"v10-subgraph-detail-desc",children:ut})]}),o.jsx(wC,{counts:{wm:O.wm,swm:O.swm,vm:O.vm},activeLayers:D,onClickLayer:lt,compact:!0})]}),o.jsxs("div",{className:"v10-subgraph-cross-layer",children:[o.jsx("div",{className:"v10-subgraph-cross-layer-lede",children:K?"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":D.has("working"),onClick:()=>lt("working"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Ki.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":D.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:Ki.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":D.has("verified"),onClick:()=>lt("verified"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Ki.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${D.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():_t(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"}),W&&P&&o.jsxs("span",{className:"v10-subgraph-savedquery-count",children:[W.size," match",W.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:Z,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(Tj,{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(Cj,{layer:ne??"wm",triples:Ee,onNodeClick:r,contextGraphId:n,title:Ht,scopeLabel:`Subgraph graph: ${Ht} 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:ze,color:Dt,onSelectEntity:s,scrollKey:`subgraph:${e}:timeline`})}),T==="docs"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(Aj,{entities:ue,contextGraphId:n,scrollKey:`subgraph:${e}:docs`})})]})]})}const BP={wm:"items",swm:"items",vm:"items"},Aw={wm:"working",swm:"shared",vm:"verified"};function Zh(e){return e==="wm"||e==="swm"||e==="vm"}function FP(e){const t=new Set;return e.filter(n=>{const r=`${yt(n.subject)}|${n.predicate}|${yt(n.object)}`;return t.has(r)?!1:(t.add(r),!0)})}function Rw(e,t){if(typeof document>"u")return t;const n=document.querySelectorAll("[data-cg-scroll-key]");for(const r of n)if(r.dataset.cgScrollKey===e)return r;return t}function HP({contextGraphId:e}){const{data:t,error:n,loading:r,refresh:s}=oa(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,C]=w.useState(null),[S,T]=w.useState(!1),E=w.useRef(0),[A,B]=w.useState(null),[R,D]=w.useState(null),H=w.useRef(null),[M,_]=w.useState(null),P=w.useCallback(de=>{H.current=de,_(de)},[]),F=w.useRef(null),W=w.useCallback(de=>{F.current=de,de===null&&(H.current=null,_(null)),B(de)},[]),[I,$]=w.useState(null),q=w.useRef(null);w.useEffect(()=>{q.current=m},[m]);const[V,X]=w.useState(BP),[K,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=pn(de=>de.openTab),{data:Re,loading:Ee,error:Ie}=$d(),We=w.useCallback(()=>A?`subgraph:${A}:${K[A]??"items"}`:Zh(h)?`layer:${h}:${V[h]}`:"page",[h,A,V,K]),Se=w.useCallback(de=>{const je=de??We(),Te=Rw(je,U.current);return{activeLayer:h,activeSubGraph:A,layerTabs:{...V},subGraphTabs:{...K},scroll:{key:je,top:(Te==null?void 0:Te.scrollTop)??0},subGraphEnabledLayers:A!==null&&H.current?new Set(H.current):null}},[h,A,We,V,K]),ft=w.useCallback(de=>{const je=()=>{const Te=Rw(de.key,U.current);Te&&(Te.scrollTop=de.top)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(je):setTimeout(je,0)},[]),ze=w.useCallback((de,je)=>{(!q.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,K,ft]),w.useEffect(()=>{const de=je=>{const Te=je.detail;Te&&Te.contextGraphId===e&&typeof Te.entityUri=="string"&&($(null),ze(Te.entityUri))};return window.addEventListener("v10:open-entity",de),()=>window.removeEventListener("v10:open-entity",de)},[e,ze]);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=Wg(e,{signalErrors:!0}),_t=Kg(Oe).total,Dt=T4({activeLayer:h,activeSubGraph:A}),Yt=wj(Dt?e:void 0),Ht=!A&&h==="overview",ut=LM(Ht?e:void 0),ye=Ht?ut.resultContextGraphId===e?ut.events:[]:void 0,Q=Ht&&ut.resultContextGraphId===e?ut.error:null,Z=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(()=>{Z()},[Z]);const ee=w.useCallback(()=>{const de=++E.current;An.fetchSubGraphs(e).then(je=>{if(E.current!==de)return;const Te=(je.subGraphs??[]).filter(Qg).length;C(Te),T(!1)}).catch(()=>{E.current===de&&(C(null),T(!0))})},[e]);w.useEffect(()=>{C(null),T(!1),ee()},[ee]),xo(e,ee);const ce=I?Aw[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?nj(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(),W(de),de===null)D(null);else if(je!==void 0){const tt=new Set([Aw[je]]);D(tt),H.current=tt,_(tt)}else{if(Te!==null&&de===Te)return;if(Te!==null&&H.current){const tt=new Set(H.current);D(tt),H.current=tt,_(tt)}else D(null),H.current=null,_(null)}y(null),$(null)},[qe,W]),et=w.useCallback(de=>{qe(),g(de),y(null),$(null),W(null),D(null)},[qe,W]),Ne=w.useCallback((de,je)=>{X(Te=>Te[de]===je?Te:{...Te,[de]:je})},[]),Vt=w.useCallback((de,je)=>{L(Te=>Te[de]===je?Te:{...Te,[de]:je})},[]),At=w.useCallback((de,je,Te)=>{const tt=q.current!=null;ze(de,je),$(Je=>Te??(tt?Je:null))},[ze]),Ha=w.useCallback(()=>{const de=G.current;if(G.current=null,y(null),$(null),!!de){if(g(de.activeLayer),W(de.activeSubGraph),de.activeSubGraph!==null&&de.subGraphEnabledLayers){const je=new Set(de.subGraphEnabledLayers);D(je),H.current=je,_(je)}X(de.layerTabs),L(de.subGraphTabs),O.current=de.scroll}},[W]),ua=w.useCallback(de=>{if(!(de!=null&&de.id))return;const je=Zh(de.trustLayer)?de.trustLayer:void 0;At(de.id,void 0,je)},[At]),Fr=w.useCallback(de=>{const je=Zh(h)?h:void 0;At(de,void 0,je)},[h,At]),Hr=w.useCallback(de=>{At(de,"page")},[At]),da=w.useCallback(()=>{be(Sj)},[be]),qa=!!n&&/authentication|unauthor|expired|sign in|log in/i.test(n);if(!xe)return n||t&&!r?o.jsxs("div",{className:"v10-view-placeholder",children:[o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:12,marginBottom:10},children:n?qa?n:"Failed to load context graph.":"Context graph not found."}),qa?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 cr=A?ue.forSubGraph(A):null,qr=!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(yj.Provider,{value:ue,children:o.jsx(xj.Provider,{value:lt,children:o.jsxs("div",{className:"v10-memory-explorer",children:[n&&o.jsx("div",{className:"v10-stale-banner",role:"status",children:qa?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(fz,{cg:xe,profile:ue,activeSubGraph:cr,onClearSubGraph:()=>Fe(null)}),o.jsx(pz,{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(DP,{entity:Ce,allEntities:He,allTriples:Le,onNavigate:At,onClose:Ha,contextGraphId:e,onRefresh:Oe.refresh}),A&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(Ew,{}),o.jsx($h,{contextGraphId:e,profile:ue,selected:A,entities:qr,onSelect:Fe,enabledScope:M??void 0,allTriplesTotal:_t}),o.jsx(UP,{slug:A,rawMemory:Oe,contextGraphId:e,onNodeClick:ua,onSelectEntity:At,activeTab:K[A]??"items",onTabChange:de=>Vt(A,de),initialEnabledLayers:R??void 0,onEnabledLayersChange:P})]}),!A&&h==="overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(bz,{cg:xe,memory:Oe,subGraphCount:j,subGraphFetchFailed:S,participants:ge,participantsStatus:Me,currentAgent:Re??null,currentAgentStatus:Ee?"loading":Ie?"error":"ok",onSwitchLayer:et,onOpenPrimer:da}),o.jsx(xz,{contextGraphId:e,curatorStatus:vz({cg:xe,currentAgent:Re??null,currentAgentStatus:Ee?"loading":Ie?"error":"ok"}),onParticipantsChanged:Z}),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:Hr,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(wz,{onOpenPrimer:da})]}),!A&&h==="graph-overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(Ew,{}),o.jsx($h,{contextGraphId:e,profile:ue,selected:null,entities:qr,onSelect:Fe,allTriplesTotal:_t}),o.jsx(IP,{contextGraphId:e,memory:Oe,onNodeClick:ua,onSelectSubGraph:Fe})]}),!A&&h==="query"&&!Ce&&o.jsx(Xz,{contextGraphId:e}),!A&&(h==="wm"||h==="swm"||h==="vm")&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx($h,{contextGraphId:e,profile:ue,selected:A,entities:qr,onSelect:Fe,layer:h}),o.jsx(Pz,{layer:h,memory:Oe,onNodeClick:ua,onSelectEntity:Fr,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=pn(n=>n.closeTab),t=Ve.useCallback(()=>e(ev),[e]);return Ve.useEffect(()=>{const n=r=>{r.key==="Escape"&&(r.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 _w(e){const t=VP[e];return t?t==="markdown"?"text":t:"binary"}async function Ow(e){const t=await fetch(e,{headers:Bt()});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:r,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),CR(n,r,s).then(async A=>{u(A);const B=_w(A.detectedContentType),R=Vu(A.fileHash,A.detectedContentType);if(B==="text"){const D=await fetch(R,{headers:Bt()});D.ok&&f(await D.text())}else if(B==="pdf"||B==="image"){const D=await Ow(R);g(D)}}).catch(A=>k(A.message??"Failed to load file info")).finally(()=>y(!1)),()=>{h&&URL.revokeObjectURL(h)}},[e,n,r,s]),w.useEffect(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);const{dialogRef:j,onBackdropClick:C}=Ji(e,t);if(!e)return null;const S=l?_w(l.detectedContentType):null,T=l?Vu(l.fileHash,l.detectedContentType):null,E=async(A,B)=>{try{const R=await Ow(A),D=document.createElement("a");D.href=R,D.download=B,D.click(),URL.revokeObjectURL(R)}catch{window.open(A,"_blank")}};return o.jsx("div",{className:"v10-modal-overlay",onClick:C,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(()=>Aa(()=>import("./index-Bh_8bMB0.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),YP=w.lazy(()=>Aa(()=>import("./index-Bh_8bMB0.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.NodePanel}))),KP=w.lazy(()=>Aa(()=>import("./OnChainProvenanceCard-DMOm3jLz.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:Pd({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 Yh({layer:e,contextGraphId:t,externalQuery:n,externalQueryKey:r,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(""),[C,S]=w.useState("any"),[T,E]=w.useState(50),[A,B]=w.useState(""),[R,D]=w.useState("any"),[H,M]=w.useState(50),[_,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(""),D("any"),M(50))},[e]),Ve.useEffect(()=>{n!==void 0&&(h(""),m(n),b(n))},[n,r]);const W=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"?a5({query:A,field:R,limit:H}):"SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 500",[t,e,R,H,A]),I=y||W,$=e==="swm"?"_shared_memory":void 0,q=e==="swm",V=e==="vm"?"verifiable-memory":void 0,X=e==="wm"&&I===W,{data:K,loading:L,error:U,refresh:G}=oa(()=>sa(I,t,q,$,V,X),[I,t,q,$,V,X],0);xo(t,G,{layers:[e]});const{data:O}=oa(Cg,[],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||C!==R||T!==H;if(Se&&(B(k),D(C),M(T)),y){b("");return}Se||G()},[y,R,H,A,C,T,k,G]),be=((Ie=K==null?void 0:K.result)==null?void 0:Ie.bindings)??((We=K==null?void 0:K.results)==null?void 0:We.bindings)??[],Re=w.useMemo(()=>be.map(Se=>({subject:Ys(Se.s)??"",predicate:Ys(Se.p)??"",object:Ys(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:_?"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:C,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"||_)&&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 ze=s.find(ke=>ke.label===ft),qe=(ze==null?void 0:ze.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(Ys(Se.s))}),o.jsx("td",{className:"v10-mlv-cell",children:Kh(Ys(Se.p))}),o.jsx("td",{className:"v10-mlv-cell",children:Kh(Ys(Se.o))})]},ft))})]})]}),!L&&Re.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:[Re.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:Re,format:"triples",options:XP,style:{width:"100%",height:"100%"},onNodeClick:Ee,initialFit:!0,children:[o.jsx(YP,{className:"v10-mlv-node-panel",showUri:!0,showTypes:!0,showProperties:!0,showMetadata:!1,maxValueLength:150}),o.jsx(KP,{contextGraphId:t,layer:e,explorerUrl:ne})]})})]})]})}function t5({contextGraphId:e,onPromoted:t}){const{data:n,loading:r,refresh:s}=oa(()=>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 C=await oo(e,j.name,"all",j.subGraph),S=Og(j.name,C);f({message:S.message+(j.subGraph?` (in ${j.subGraph})`:""),kind:S.kind==="success"?"success":"noop",subGraph:j.subGraph}),s(),t()}catch(C){const S=lo(j.name,C);g(S?{message:S.message,kind:"not-persisted"}:{message:(C==null?void 0:C.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,C=0,S=null;try{for(const E of n){S=E.name;const A=await oo(e,E.name,"all",E.subGraph);j+=A.promotedCount,A.promotedCount===0&&(C+=1)}const T=C>0?` (${C} assertion${C===1?"":"s"} had nothing to promote)`:"";f({message:j>0?`Promoted ${j} triple${j===1?"":"s"} across ${n.length} assertion${n.length===1?"":"s"}.${T}`:"No triples were promoted — every assertion was already in Shared Working Memory or its content has not been committed yet.",kind:j>0?"success":"noop"}),s(),t()}catch(T){const E=lo(S??"selected assertion",T);g(E?{message:E.message,kind:"not-persisted"}:{message:(T==null?void 0:T.message)??"Promote failed",kind:"other"})}finally{u(null)}},[n,e,s,t]);return r?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__"?"Promoting...":"Promote All → 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:["› ",rv(j.subGraph,18)]})]}),o.jsx("button",{className:"v10-btn-promote",disabled:l!==null,onClick:()=>b(j),title:"Copy these triples 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:r,refresh:s}=oa(()=>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(D=>D.graphUri))??[],k=b.length>0&&b.every(D=>l.has(D)),j=w.useCallback(D=>{u(H=>{const M=new Set(H);return M.has(D)?M.delete(D):M.add(D),M})},[]),C=w.useCallback(()=>{u(k?new Set:new Set(b))},[k,b]),S=w.useCallback(async D=>{if(D.length!==0){f(!0),g(null),y(null);try{g(await _g(e,D)),u(new Set),s(),t()}catch(H){y((H==null?void 0:H.message)??"Publish failed")}finally{f(!1)}}},[e,s,t]),T=w.useCallback(()=>{const D=(n??[]).filter(H=>l.has(H.graphUri));return S(D)},[n,l,S]),E=w.useCallback(()=>S(n??[]),[n,S]),A=(n==null?void 0:n.reduce((D,H)=>D+(H.tripleCount??0),0))??0,B=(n==null?void 0:n.filter(D=>l.has(D.graphUri)).reduce((D,H)=>D+(H.tripleCount??0),0))??0,R=!r&&(!n||n.length===0);return r?o.jsx("div",{className:"v10-assertion-list-loading",children:"Loading SWM contents..."}):R?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:C}),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(D=>o.jsxs("div",{className:`v10-assertion-item ${l.has(D.graphUri)?"selected":""}`,children:[o.jsx("label",{className:"v10-publish-entity-check",children:o.jsx("input",{type:"checkbox",checked:l.has(D.graphUri),onChange:()=>j(D.graphUri)})}),o.jsxs("div",{className:"v10-assertion-item-info",children:[o.jsx("span",{className:"v10-assertion-item-name",title:D.graphUri,children:D.name}),D.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${D.subGraph}`,children:["› ",rv(D.subGraph,18)]}),D.tripleCount!=null&&o.jsxs("span",{className:"v10-assertion-item-count",children:[D.tripleCount," triples"]})]})]},D.graphUri))}),h&&(()=>{const{published:D,total:H,sealed:M,partial:_,partialError:P,failures:F,sample:W,convictionCostCovered:I}=h,$=D===H&&D>0&&_===0,q=(W==null?void 0:W.status)==="confirmed"&&!!W.txHash;return o.jsxs("div",{className:`v10-publish-result-card ${$?"success":"error"}`,children:[o.jsx("div",{className:"v10-publish-result-title",children:D>0?`Published ${D} of ${H} knowledge asset${H===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?" was":"s were"," sealed in Shared Memory before publishing."]}),_>0&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:["⚠ ",_," asset",_===1?"":"s",": ",Il(P)]}),F.length>0&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:[F.length," asset",F.length===1?"":"s"," could not be published — ",F[0].name,": ",F[0].error,F.length>1?` (+${F.length-1} more)`:""]}),o.jsxs("div",{className:"v10-publish-result-details",children:[(W==null?void 0:W.kaId)!=null&&o.jsxs("div",{children:[o.jsx("span",{className:"v10-publish-result-label",children:"Knowledge Asset:"})," ",W.kaId]}),q?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:W.txHash,children:W.txHash}),W.blockNumber!=null&&o.jsxs("span",{className:"v10-publish-result-block",children:[" (block ",W.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(WS,{convictionCostCovered:I})]})]})})(),m&&o.jsx("div",{className:"v10-publish-result-card error",children:m})]})}function Ys(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("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function a5(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 r=r5(n.toLowerCase()),s={subject:`CONTAINS(LCASE(STR(?s)), "${r}")`,predicate:`CONTAINS(LCASE(STR(?p)), "${r}")`,object:`CONTAINS(LCASE(STR(?o)), "${r}")`};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 r5(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}const kC=[{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}=Ta(),{hidden:t}=Hg(),n=w.useMemo(()=>e.filter(r=>!t.has(r.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"}),kC.map(r=>o.jsxs("div",{className:"v10-memstack-colhead",style:{color:r.color},children:[o.jsx("span",{className:"v10-memstack-colhead-icon",children:r.icon}),o.jsx("span",{className:"v10-memstack-colhead-title",children:r.title}),o.jsx("span",{className:"v10-memstack-colhead-desc",children:r.desc})]},r.key))]}),n.map(r=>o.jsx(o5,{cg:r},r.id))]})]})}function o5({cg:e}){const t=Wg(e.id),{openTab:n}=pn(),r=gj(t),s=w.useMemo(()=>{const u={working:{entities:[],tripleCount:r.wm},shared:{entities:[],tripleCount:r.swm},verified:{entities:[],tripleCount:r.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=Vm(f),m=Vm(h);return g&&m?m-g:g?-1:m?1:f.label.localeCompare(h.label)});return u},[t.entityList,r]),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})]}),kC.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:r,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:kj(c5(h))})]},h.uri))}):o.jsxs("div",{className:"v10-memstack-cell-empty-hint",children:["Nothing in ",r.toUpperCase()," yet"]}),!f&&o.jsxs("button",{type:"button",className:"v10-memstack-cell-open",onClick:d,title:`Open ${n}`,children:["Open ",r.toUpperCase()," →"]})]})}function Vm(e){var t;for(const n of i5){const r=(t=e.properties.get(n))==null?void 0:t[0];if(!r)continue;const s=new Date(r.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"));if(Number.isFinite(s.getTime()))return s.getTime()}return null}function c5(e){const t=Vm(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 Lw(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"?Mw(e.value):!1:Mw(e)}function Mw(e){return e.replace(h5,"")===""}class nc{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}nc.prototype.normal={};nc.prototype.property={};nc.prototype.space=void 0;function SC(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new nc(n,r,t)}function Wm(e){return e.toLowerCase()}class Wn{constructor(t,n){this.attribute=n,this.property=t}}Wn.prototype.attribute="";Wn.prototype.booleanish=!1;Wn.prototype.boolean=!1;Wn.prototype.commaOrSpaceSeparated=!1;Wn.prototype.commaSeparated=!1;Wn.prototype.defined=!1;Wn.prototype.mustUseProperty=!1;Wn.prototype.number=!1;Wn.prototype.overloadedBoolean=!1;Wn.prototype.property="";Wn.prototype.spaceSeparated=!1;Wn.prototype.space=void 0;let g5=0;const Xe=us(),sn=us(),Zm=us(),we=us(),Rt=us(),so=us(),ia=us();function us(){return 2**++g5}const Ym=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:sn,commaOrSpaceSeparated:ia,commaSeparated:so,number:we,overloadedBoolean:Zm,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),Qh=Object.keys(Ym);class vv extends Wn{constructor(t,n,r,s){let l=-1;if(super(t,n),zw(this,"space",s),typeof r=="number")for(;++l<Qh.length;){const u=Qh[l];zw(this,Qh[l],(r&Ym[u])===Ym[u])}}}vv.prototype.defined=!0;function zw(e,t,n){n&&(e[t]=n)}function ko(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const l=new vv(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[Wm(r)]=r,n[Wm(l.attribute)]=r}return new nc(t,n,e.space)}const jC=ko({properties:{ariaActiveDescendant:null,ariaAtomic:sn,ariaAutoComplete:null,ariaBusy:sn,ariaChecked:sn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:sn,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:sn,ariaFlowTo:Rt,ariaGrabbed:sn,ariaHasPopup:null,ariaHidden:sn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:we,ariaLive:null,ariaModal:sn,ariaMultiLine:sn,ariaMultiSelectable:sn,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:sn,ariaReadOnly:sn,ariaRelevant:null,ariaRequired:sn,ariaRoleDescription:Rt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:sn,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 CC(e,t){return t in e?e[t]:t}function NC(e,t){return CC(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:sn,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:Zm,draggable:sn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:Rt,height:we,hidden:Zm,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:sn,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:sn,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:sn,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:NC}),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:ia,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:ia,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:ia,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ia,rev:ia,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ia,requiredFeatures:ia,requiredFonts:ia,requiredFormats:ia,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:ia,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:ia,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:ia,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:CC}),EC=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()}}),TC=ko({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:NC}),AC=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,Dw=/-[a-z]/g,w5=/^data[-\w.:]+$/i;function k5(e,t){const n=Wm(t);let r=t,s=Wn;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(Dw,j5);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Dw.test(l)){let u=l.replace(x5,S5);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}s=vv}return new s(r,t)}function S5(e){return"-"+e.toLowerCase()}function j5(e){return e.charAt(1).toUpperCase()}const C5=SC([jC,v5,EC,TC,AC],"html"),yv=SC([jC,y5,EC,TC,AC],"svg");function N5(e){return e.join(" ").trim()}var Ks={},Xh,$w;function E5(){if($w)return Xh;$w=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\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(C,S){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];S=S||{};var T=1,E=1;function A(I){var $=I.match(t);$&&(T+=$.length);var q=I.lastIndexOf(f);E=~q?I.length-q:E+I.length}function B(){var I={line:T,column:E};return function($){return $.position=new R(I),M(),$}}function R(I){this.start=I,this.end={line:T,column:E},this.source=S.source}R.prototype.content=C;function D(I){var $=new Error(S.source+":"+T+":"+E+": "+I);if($.reason=I,$.filename=S.source,$.line=T,$.column=E,$.source=C,!S.silent)throw $}function H(I){var $=I.exec(C);if($){var q=$[0];return A(q),C=C.slice(q.length),$}}function M(){H(n)}function _(I){var $;for(I=I||[];$=P();)$!==!1&&I.push($);return I}function P(){var I=B();if(!(h!=C.charAt(0)||g!=C.charAt(1))){for(var $=2;m!=C.charAt($)&&(g!=C.charAt($)||h!=C.charAt($+1));)++$;if($+=2,m===C.charAt($-1))return D("End of comment missing");var q=C.slice(2,$-2);return E+=2,A(q),C=C.slice($),E+=2,I({type:y,comment:q})}}function F(){var I=B(),$=H(r);if($){if(P(),!H(s))return D("property missing ':'");var q=H(l),V=I({type:b,property:j($[0].replace(e,m)),value:q?j(q[0].replace(e,m)):m});return H(u),V}}function W(){var I=[];_(I);for(var $;$=F();)$!==!1&&(I.push($),_(I));return I}return M(),W()}function j(C){return C?C.replace(d,m):m}return Xh=k,Xh}var Iw;function T5(){if(Iw)return Ks;Iw=1;var e=Ks&&Ks.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ks,"__esModule",{value:!0}),Ks.default=n;const t=e(E5());function n(r,s){let l=null;if(!r||typeof r!="string")return l;const u=(0,t.default)(r),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 Ks}var wl={},Pw;function A5(){if(Pw)return wl;Pw=1,Object.defineProperty(wl,"__esModule",{value:!0}),wl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(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(r,d),h.replace(t,u))};return wl.camelCase=f,wl}var kl,Uw;function R5(){if(Uw)return kl;Uw=1;var e=kl&&kl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(T5()),n=A5();function r(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 r.default=r,kl=r,kl}var _5=R5();const O5=Wl(_5),RC=_C("end"),bv=_C("start");function _C(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function L5(e){const t=bv(e),n=RC(e);if(t&&n)return{start:t,end:n}}function Ml(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Bw(e.position):"start"in e||"end"in e?Bw(e):"line"in e||"column"in e?Km(e):""}function Km(e){return Fw(e&&e.line)+":"+Fw(e&&e.column)}function Bw(e){return Km(e&&e.start)+"-"+Km(e&&e.end)}function Fw(e){return e&&typeof e=="number"?e:1}class Rn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=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 r=="string"){const f=r.indexOf(":");f===-1?l.ruleId=r:(l.source=r.slice(0,f),l.ruleId=r.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}}Rn.prototype.file="";Rn.prototype.name="";Rn.prototype.reason="";Rn.prototype.message="";Rn.prototype.stack="";Rn.prototype.column=void 0;Rn.prototype.line=void 0;Rn.prototype.ancestors=void 0;Rn.prototype.cause=void 0;Rn.prototype.fatal=void 0;Rn.prototype.place=void 0;Rn.prototype.ruleId=void 0;Rn.prototype.source=void 0;const xv={}.hasOwnProperty,M5=new Map,z5=/[A-Z]/g,D5=new Set(["table","tbody","thead","tfoot","tr"]),$5=new Set(["td","th"]),OC="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 r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=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");r=G5(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?yv:C5,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=LC(s,e,void 0);return l&&typeof l!="string"?l:s.create(e,s.Fragment,{children:l||void 0},void 0)}function LC(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 r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=yv,e.schema=s),e.ancestors.push(t);const l=zC(e,t.tagName,!1),u=W5(e,t);let d=kv(e,t);return D5.has(t.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!m5(f):!0})),MC(e,u,l,t),wv(u,d),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function U5(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}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 r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=yv,e.schema=s),e.ancestors.push(t);const l=t.name===null?e.Fragment:zC(e,t.name,!0),u=Z5(e,t),d=kv(e,t);return MC(e,u,l,t),wv(u,d),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function H5(e,t,n){const r={};return wv(r,kv(e,t)),e.create(t,e.Fragment,r,n)}function q5(e,t){return t.value}function MC(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function wv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function G5(e,t,n){return r;function r(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(r,s,l,u){const d=Array.isArray(l.children),f=bv(r);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 r,s;for(s in t.properties)if(s!=="children"&&xv.call(t.properties,s)){const l=Y5(e,s,t.properties[s]);if(l){const[u,d]=l;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&$5.has(t.tagName)?r=d:n[u]=d}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Z5(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.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=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const d=r.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else ql(e,t.position);else l=r.value===null?!0:r.value;n[s]=l}return n}function kv(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:M5;for(;++r<t.children.length;){const l=t.children[r];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=LC(e,l,u);d!==void 0&&n.push(d)}return n}function Y5(e,t,n){const r=k5(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?u5(n):N5(n)),r.property==="style"){let s=typeof n=="object"?n:K5(e,String(n));return e.stylePropertyNameCase==="css"&&(s=Q5(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?b5[r.property]||r.property:r.attribute,n]}}function K5(e,t){try{return O5(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Rn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=OC+"#cannot-parse-style-attribute",s}}function zC(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let l=-1,u;for(;++l<s.length;){const d=Lw(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}r=u}else r=Lw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return xv.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);ql(e)}function ql(e,t){const n=new Rn("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=OC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Q5(e){const t={};let n;for(n in e)xv.call(e,n)&&(t[X5(n)]=e[n]);return t}function X5(e){let t=e.replace(z5,J5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function J5(e){return"-"+e.toLowerCase()}const Jh={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 Sv(e,t){const n=eU,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return DC(e,r,s)}function DC(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 Hw(e.children,t,n)}return Array.isArray(e)?Hw(e,t,n):""}function Hw(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=DC(e[s],t,n);return r.join("")}function tU(e){return!!(e&&typeof e=="object")}const qw=document.createElement("i");function jv(e){const t="&"+e+";";qw.innerHTML=t;const n=qw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function la(e,t,n,r){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,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);l<r.length;)u=r.slice(l,l+1e4),u.unshift(t,0),e.splice(...u),l+=1e4,t+=1e4}function Ea(e,t){return e.length>0?(la(e,e.length,0,t),e):t}const Gw={}.hasOwnProperty;function $C(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=(Gw.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let u;if(l)for(u in l){Gw.call(s,u)||(s[u]=[]);const d=l[u];aU(s[u],Array.isArray(d)?d:d?[d]:[])}}}function aU(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);la(e,0,0,r)}function IC(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 Ua(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zn=ji(/[A-Za-z]/),Tn=ji(/[\dA-Za-z]/),rU=ji(/[#-'*+\--9=?A-Z^-~]/);function kd(e){return e!==null&&(e<32||e===127)}const Qm=ji(/\d/),iU=ji(/[\dA-Fa-f]/),sU=ji(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function Tt(e){return e!==null&&(e<0||e===32)}function it(e){return e===-2||e===-1||e===32}const Zd=ji(new RegExp("\\p{P}|\\p{S}","u")),as=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,r=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(r,n),encodeURIComponent(u)),r=n+s+1,u=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function dt(e,t,n,r){const s=r?r-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,r,s);let n;return t;function r(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},Vw={tokenize:dU};function uU(e){const t=this,n=[];let r=0,s,l,u;return d;function d(E){if(r<n.length){const A=n[r];return t.containerState=A[1],e.attempt(A[0].continuation,f,h)(E)}return h(E)}function f(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&T();const A=t.events.length;let B=A,R;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){R=t.events[B][1].end;break}S(r);let D=A;for(;D<t.events.length;)t.events[D][1].end={...R},D++;return la(t.events,B+1,0,t.events.slice(A)),t.events.length=D,h(E)}return d(E)}function h(E){if(r===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(Vw,g,m)(E)}function g(E){return s&&T(),S(r),y(E)}function m(E){return t.parser.lazy[t.now().line]=r!==n.length,u=t.now().offset,k(E)}function y(E){return t.containerState={},e.attempt(Vw,b,k)(E)}function b(E){return r++,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){C(e.exit("chunkFlow"),!0),S(0),e.consume(E);return}return Pe(E)?(e.consume(E),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,d):(e.consume(E),j)}function C(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 R=s.events.length;for(;R--;)if(s.events[R][1].start.offset<u&&(!s.events[R][1].end||s.events[R][1].end.offset>u))return;const D=t.events.length;let H=D,M,_;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if(M){_=t.events[H][1].end;break}M=!0}for(S(r),R=D;R<t.events.length;)t.events[R][1].end={..._},R++;la(t.events,H+1,0,t.events.slice(D)),t.events.length=R}}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||Tt(e)||as(e))return 1;if(Zd(e))return 2}function Yd(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const l=e[s].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const Xm={name:"attention",resolveAll:pU,tokenize:fU};function pU(e,t){let n=-1,r,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(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[r][1].end},y={...e[n][1].start};Ww(m,-f),Ww(y,f),u={type:f>1?"strongSequence":"emphasisSequence",start:m,end:{...e[r][1].end}},d={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},l={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:f>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[r][1].end={...u.start},e[n][1].start={...d.end},h=[],e[r][1].end.offset-e[r][1].start.offset&&(h=Ea(h,[["enter",e[r][1],t],["exit",e[r][1],t]])),h=Ea(h,[["enter",s,t],["enter",u,t],["exit",u,t],["enter",l,t]]),h=Ea(h,Yd(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),h=Ea(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=Ea(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,la(e,r-1,n-r+3,h),n=r+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,r=this.previous,s=ho(r);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(r);return h._open=!!(l===42?m:m&&(s||!y)),h._close=!!(l===42?y:y&&(g||!m)),t(f)}}function Ww(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const hU={name:"autolink",tokenize:mU};function mU(e,t,n){let r=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 zn(b)?(e.consume(b),u):b===64?n(b):h(b)}function u(b){return b===43||b===45||b===46||Tn(b)?(r=1,d(b)):h(b)}function d(b){return b===58?(e.consume(b),r=0,f):(b===43||b===45||b===46||Tn(b))&&r++<32?(e.consume(b),d):(r=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||kd(b)?n(b):(e.consume(b),f)}function h(b){return b===64?(e.consume(b),g):rU(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),r=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))&&r++<63){const k=b===45?y:m;return e.consume(b),k}return n(b)}}const ac={partial:!0,tokenize:gU};function gU(e,t,n){return r;function r(l){return it(l)?dt(e,s,"linePrefix")(l):s(l)}function s(l){return l===null||Pe(l)?t(l):n(l)}}const PC={continuation:{tokenize:yU},exit:bU,name:"blockQuote",tokenize:vU};function vU(e,t,n){const r=this;return s;function s(u){if(u===62){const d=r.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 r=this;return s;function s(u){return it(u)?dt(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):l(u)}function l(u){return e.attempt(PC,t,n)(u)}}function bU(e){e.exit("blockQuote")}const UC={name:"characterEscape",tokenize:xU};function xU(e,t,n){return r;function r(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 BC={name:"characterReference",tokenize:wU};function wU(e,t,n){const r=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=Qm,g(m))}function g(m){if(m===59&&s){const y=e.exit("characterReferenceValue");return u===Tn&&!jv(r.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 Zw={partial:!0,tokenize:SU},Yw={concrete:!0,name:"codeFenced",tokenize:kU};function kU(e,t,n){const r=this,s={partial:!0,tokenize:B};let l=0,u=0,d;return f;function f(R){return h(R)}function h(R){const D=r.events[r.events.length-1];return l=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,d=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(R)}function g(R){return R===d?(u++,e.consume(R),g):u<3?n(R):(e.exit("codeFencedFenceSequence"),it(R)?dt(e,m,"whitespace")(R):m(R))}function m(R){return R===null||Pe(R)?(e.exit("codeFencedFence"),r.interrupt?t(R):e.check(Zw,j,A)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(R))}function y(R){return R===null||Pe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(R)):it(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),dt(e,b,"whitespace")(R)):R===96&&R===d?n(R):(e.consume(R),y)}function b(R){return R===null||Pe(R)?m(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(R))}function k(R){return R===null||Pe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(R)):R===96&&R===d?n(R):(e.consume(R),k)}function j(R){return e.attempt(s,A,C)(R)}function C(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),S}function S(R){return l>0&&it(R)?dt(e,T,"linePrefix",l+1)(R):T(R)}function T(R){return R===null||Pe(R)?e.check(Zw,j,A)(R):(e.enter("codeFlowValue"),E(R))}function E(R){return R===null||Pe(R)?(e.exit("codeFlowValue"),T(R)):(e.consume(R),E)}function A(R){return e.exit("codeFenced"),t(R)}function B(R,D,H){let M=0;return _;function _($){return R.enter("lineEnding"),R.consume($),R.exit("lineEnding"),P}function P($){return R.enter("codeFencedFence"),it($)?dt(R,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):F($)}function F($){return $===d?(R.enter("codeFencedFenceSequence"),W($)):H($)}function W($){return $===d?(M++,R.consume($),W):M>=u?(R.exit("codeFencedFenceSequence"),it($)?dt(R,I,"whitespace")($):I($)):H($)}function I($){return $===null||Pe($)?(R.exit("codeFencedFence"),D($)):H($)}}}function SU(e,t,n){const r=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 r.parser.lazy[r.now().line]?n(u):t(u)}}const em={name:"codeIndented",tokenize:CU},jU={partial:!0,tokenize:NU};function CU(e,t,n){const r=this;return s;function s(h){return e.enter("codeIndented"),dt(e,l,"linePrefix",5)(h)}function l(h){const g=r.events[r.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 r=this;return s;function s(u){return r.parser.lazy[r.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=r.events[r.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:RU};function TU(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function AU(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function RU(e,t,n){let r=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),r++,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===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(l.type="codeTextData",h(m))}}class _U{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Sl(this.left,r),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 FC(e){const t={};let n=-1,r,s,l,u,d,f,h;const g=new _U(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(r=g.get(n),n&&r[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(f=r[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(r[0]==="enter")r[1].contentType&&(Object.assign(t,OU(g,n)),n=t[n],h=!0);else if(r[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&&(r[1].end={...g.get(s)[1].start},d=g.slice(s,n),d.unshift(r),g.splice(s,n-s+1,d))}}return la(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function OU(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const l=[];let u=n._tokenizer;u||(u=r.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 C=[j];for(;b;){for(;e.get(++s)[1]!==b;);l.push(s),b._tokenizer||(g=r.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,C.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):C.pop(),y=C.length;y--;){const S=d.slice(C[y],C[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:zU,tokenize:DU},MU={partial:!0,tokenize:$U};function zU(e){return FC(e),e}function DU(e,t){let n;return r;function r(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 r=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=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function HC(e,t,n,r,s,l,u,d,f){const h=f||Number.POSITIVE_INFINITY;let g=0;return m;function m(S){return S===60?(e.enter(r),e.enter(s),e.enter(l),e.consume(S),e.exit(l),y):S===null||S===32||S===41||kd(S)?n(S):(e.enter(r),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(r),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||Tt(S))?(e.exit("chunkString"),e.exit(d),e.exit(u),e.exit(r),t(S)):g<h&&S===40?(e.consume(S),g++,j):S===41?(e.consume(S),g--,j):S===null||S===32||S===40||kd(S)?n(S):(e.consume(S),S===92?C:j)}function C(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function qC(e,t,n,r,s,l){const u=this;let d=0,f;return h;function h(b){return e.enter(r),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(r),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 GC(e,t,n,r,s,l){let u;return d;function d(y){return y===34||y===39||y===40?(e.enter(r),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(r),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 zl(e,t){let n;return r;function r(s){return Pe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):it(s)?dt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const IU={name:"definition",tokenize:UU},PU={partial:!0,tokenize:BU};function UU(e,t,n){const r=this;let s;return l;function l(b){return e.enter("definition"),u(b)}function u(b){return qC.call(r,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return s=Ua(r.sliceSerialize(r.events[r.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 Tt(b)?zl(e,h)(b):h(b)}function h(b){return HC(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"),r.parser.defined.push(s),t(b)):n(b)}}function BU(e,t,n){return r;function r(d){return Tt(d)?zl(e,s)(d):n(d)}function s(d){return GC(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 r;function r(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,r=3,s,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},la(e,r,n-r+1,[["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t]])),e}function VU(e,t,n){let r=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&&r++<6?(e.consume(g),u):g===null||Tt(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||Tt(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"],Kw=["pre","script","style","textarea"],ZU={concrete:!0,name:"htmlFlow",resolveTo:QU,tokenize:XU},YU={partial:!0,tokenize:e8},KU={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 r=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,r.interrupt?t:L):zn(O)?(e.consume(O),u=String.fromCharCode(O),C):n(O)}function y(O){return O===45?(e.consume(O),s=2,b):O===91?(e.consume(O),s=5,d=0,k):zn(O)?(e.consume(O),s=4,r.interrupt?t:L):n(O)}function b(O){return O===45?(e.consume(O),r.interrupt?t:L):n(O)}function k(O){const ne="CDATA[";return O===ne.charCodeAt(d++)?(e.consume(O),d===ne.length?r.interrupt?t:F:k):n(O)}function j(O){return zn(O)?(e.consume(O),u=String.fromCharCode(O),C):n(O)}function C(O){if(O===null||O===47||O===62||Tt(O)){const ne=O===47,ue=u.toLowerCase();return!ne&&!l&&Kw.includes(ue)?(s=1,r.interrupt?t(O):F(O)):WU.includes(u.toLowerCase())?(s=6,ne?(e.consume(O),S):r.interrupt?t(O):F(O)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(O):l?T(O):E(O))}return O===45||Tn(O)?(e.consume(O),u+=String.fromCharCode(O),C):n(O)}function S(O){return O===62?(e.consume(O),r.interrupt?t:F):n(O)}function T(O){return it(O)?(e.consume(O),T):_(O)}function E(O){return O===47?(e.consume(O),_):O===58||O===95||zn(O)?(e.consume(O),A):it(O)?(e.consume(O),E):_(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),R):it(O)?(e.consume(O),B):E(O)}function R(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),f=O,D):it(O)?(e.consume(O),R):H(O)}function D(O){return O===f?(e.consume(O),f=null,M):O===null||Pe(O)?n(O):(e.consume(O),D)}function H(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||Tt(O)?B(O):(e.consume(O),H)}function M(O){return O===47||O===62||it(O)?E(O):n(O)}function _(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),q):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),K):Pe(O)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(YU,G,W)(O)):O===null||Pe(O)?(e.exit("htmlFlowData"),W(O)):(e.consume(O),F)}function W(O){return e.check(KU,I,G)(O)}function I(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),$}function $(O){return O===null||Pe(O)?W(O):(e.enter("htmlFlowData"),F(O))}function q(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 Kw.includes(ne)?(e.consume(O),U):F(O)}return zn(O)&&u.length<8?(e.consume(O),u+=String.fromCharCode(O),X):F(O)}function K(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 r=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 r.parser.lazy[r.now().line]?n(u):t(u)}}function e8(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(ac,t,n)}}const t8={name:"htmlText",tokenize:n8};function n8(e,t,n){const r=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):zn(L)?(e.consume(L),H):n(L)}function h(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),l=0,k):zn(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?q(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),C):Pe(L)?(u=j,V(L)):(e.consume(L),j)}function C(L){return L===93?(e.consume(L),S):j(L)}function S(L){return L===62?q(L):L===93?(e.consume(L),S):j(L)}function T(L){return L===null||L===62?q(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?q(L):E(L)}function B(L){return zn(L)?(e.consume(L),R):n(L)}function R(L){return L===45||Tn(L)?(e.consume(L),R):D(L)}function D(L){return Pe(L)?(u=D,V(L)):it(L)?(e.consume(L),D):q(L)}function H(L){return L===45||Tn(L)?(e.consume(L),H):L===47||L===62||Tt(L)?M(L):n(L)}function M(L){return L===47?(e.consume(L),q):L===58||L===95||zn(L)?(e.consume(L),_):Pe(L)?(u=M,V(L)):it(L)?(e.consume(L),M):q(L)}function _(L){return L===45||L===46||L===58||L===95||Tn(L)?(e.consume(L),_):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,W):Pe(L)?(u=F,V(L)):it(L)?(e.consume(L),F):(e.consume(L),I)}function W(L){return L===s?(e.consume(L),s=void 0,$):L===null?n(L):Pe(L)?(u=W,V(L)):(e.consume(L),W)}function I(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||Tt(L)?M(L):(e.consume(L),I)}function $(L){return L===47||L===62||Tt(L)?M(L):n(L)}function q(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,K,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):K(L)}function K(L){return e.enter("htmlTextData"),u(L)}}const Cv={name:"labelEnd",resolveAll:s8,resolveTo:o8,tokenize:l8},a8={tokenize:c8},r8={tokenize:u8},i8={tokenize:d8};function s8(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&la(e,0,e.length,n),e}function o8(e,t){let n=e.length,r=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")){r=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+r+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",f,t],["enter",h,t]],d=Ea(d,e.slice(l+1,l+r+3)),d=Ea(d,[["enter",g,t]]),d=Ea(d,Yd(t.parser.constructs.insideSpan.null,e.slice(l+r+4,u-3),t)),d=Ea(d,[["exit",g,t],e[u-2],e[u-1],["exit",h,t]]),d=Ea(d,e.slice(u+1)),d=Ea(d,[["exit",f,t]]),la(e,l,e.length,d),e}function l8(e,t,n){const r=this;let s=r.events.length,l,u;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){l=r.events[s][1];break}return d;function d(y){return l?l._inactive?m(y):(u=r.parser.defined.includes(Ua(r.sliceSerialize({start:l.end,end:r.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(a8,g,u?g:m)(y):y===91?e.attempt(r8,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 r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),s}function s(m){return Tt(m)?zl(e,l)(m):l(m)}function l(m){return m===41?g(m):HC(e,u,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function u(m){return Tt(m)?zl(e,f)(m):g(m)}function d(m){return n(m)}function f(m){return m===34||m===39||m===40?GC(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function h(m){return Tt(m)?zl(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 r=this;return s;function s(d){return qC.call(r,e,l,u,"reference","referenceMarker","referenceString")(d)}function l(d){return r.parser.defined.includes(Ua(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function u(d){return n(d)}}function d8(e,t,n){return r;function r(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:Cv.resolveAll,tokenize:f8};function f8(e,t,n){const r=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 r.parser.constructs?n(d):t(d)}}const h8={name:"labelStartLink",resolveAll:Cv.resolveAll,tokenize:m8};function m8(e,t,n){const r=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 r.parser.constructs?n(u):t(u)}}const tm={name:"lineEnding",tokenize:g8};function g8(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),dt(e,t,"linePrefix")}}const td={name:"thematicBreak",tokenize:v8};function v8(e,t,n){let r=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)):r>=3&&(h===null||Pe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function f(h){return h===s?(e.consume(h),r++,f):(e.exit("thematicBreakSequence"),it(h)?dt(e,d,"whitespace")(h):d(h))}}const Hn={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 r=this,s=r.events[r.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=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:Qm(b)){if(r.containerState.type||(r.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(!r.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(b)}return n(b)}function f(b){return Qm(b)&&++u<10?(e.consume(b),f):(!r.interrupt||u<2)&&(r.containerState.marker?b===r.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"),r.containerState.marker=r.containerState.marker||b,e.check(ac,r.interrupt?n:g,e.attempt(y8,y,m))}function g(b){return r.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 r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function w8(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ac,s,l);function s(d){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,dt(e,t,"listItemIndent",r.containerState.size+1)(d)}function l(d){return r.containerState.furtherBlankLines||!it(d)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(d)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(b8,t,u)(d))}function u(d){return r.containerState._closeFlow=!0,r.interrupt=void 0,dt(e,e.attempt(Hn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function k8(e,t,n){const r=this;return dt(e,s,"listItemIndent",r.containerState.size+1);function s(l){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(l):n(l)}}function S8(e){e.exit(this.containerState.type)}function j8(e,t,n){const r=this;return dt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(l){const u=r.events[r.events.length-1];return!it(l)&&u&&u[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const Qw={name:"setextUnderline",resolveTo:C8,tokenize:N8};function C8(e,t){let n=e.length,r,s,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const u={type:"setextHeading",start:{...e[r][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[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function N8(e,t,n){const r=this;let s;return l;function l(h){let g=r.events.length,m;for(;g--;)if(r.events[g][1].type!=="lineEnding"&&r.events[g][1].type!=="linePrefix"&&r.events[g][1].type!=="content"){m=r.events[g][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.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(ac,r,e.attempt(this.parser.constructs.flowInitial,s,dt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(LU,s)),"linePrefix")));return n;function r(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:WC()},R8=VC("string"),_8=VC("text");function VC(e){return{resolveAll:WC(e==="text"?O8:void 0),tokenize:t};function t(n){const r=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(r,r.previous))return!0}return!1}}}function WC(e){return t;function t(n,r){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,r):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 r=e[n-1][1],s=t.sliceStream(r);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:r.start._bufferIndex+u,_index:r.start._index+l,line:r.end.line,column:r.end.column-d,offset:r.end.offset-d},end:{...r.end}};r.end={...h.start},r.start.offset===r.end.offset?Object.assign(r,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const L8={42:Hn,43:Hn,45:Hn,48:Hn,49:Hn,50:Hn,51:Hn,52:Hn,53:Hn,54:Hn,55:Hn,56:Hn,57:Hn,62:PC},M8={91:IU},z8={[-2]:em,[-1]:em,32:em},D8={35:qU,42:td,45:[Qw,td],60:ZU,61:Qw,95:td,96:Yw,126:Yw},$8={38:BC,92:UC},I8={[-5]:tm,[-4]:tm,[-3]:tm,33:p8,38:BC,42:Xm,60:[hU,t8],91:h8,92:[FU,UC],93:Cv,95:Xm,96:EU},P8={null:[Xm,A8]},U8={null:[42,95]},B8={null:[]},F8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:U8,contentInitial:M8,disable:B8,document:L8,flow:D8,flowInitial:z8,insideSpan:P8,string:$8,text:I8},Symbol.toStringTag,{value:"Module"}));function H8(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},l=[];let u=[],d=[];const f={attempt:D(B),check:D(R),consume:T,enter:E,exit:A,interrupt:D(R,{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=Ea(u,P),C(),u[u.length-1]!==null?[]:(H(t,0),h.events=Yd(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:W,column:I,offset:$}=r;return{_bufferIndex:P,_index:F,line:W,column:I,offset:$}}function j(P){s[P.line]=P.column,_()}function C(){let P;for(;r._index<u.length;){const F=u[r._index];if(typeof F=="string")for(P=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<F.length;)S(F.charCodeAt(r._bufferIndex));else S(F)}}function S(P){g=g(P)}function T(P){Pe(P)?(r.line++,r.column=1,r.offset+=P===-3?2:1,_()):P!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===u[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=P}function E(P,F){const W=F||{};return W.type=P,W.start=k(),h.events.push(["enter",W,h]),d.push(W),W}function A(P){const F=d.pop();return F.end=k(),h.events.push(["exit",F,h]),F}function B(P,F){H(P,F.from)}function R(P,F){F.restore()}function D(P,F){return W;function W(I,$,q){let V,X,K,L;return Array.isArray(I)?G(I):"tokenize"in I?G([I]):U(I);function U(le){return be;function be(Re){const Ee=Re!==null&&le[Re],Ie=Re!==null&&le.null,We=[...Array.isArray(Ee)?Ee:Ee?[Ee]:[],...Array.isArray(Ie)?Ie:Ie?[Ie]:[]];return G(We)(Re)}}function G(le){return V=le,X=0,le.length===0?q:O(le[X])}function O(le){return be;function be(Re){return L=M(),K=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)(Re)}}function ne(le){return P(K,L),$}function ue(le){return L.restore(),++X<V.length?O(V[X]):q}}}function H(P,F){P.resolveAll&&!l.includes(P)&&l.push(P),P.resolve&&la(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,W=h.currentConstruct,I=h.events.length,$=Array.from(d);return{from:I,restore:q};function q(){r=P,h.previous=F,h.currentConstruct=W,h.events.length=I,d=$,_()}}function _(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function q8(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,l=t.end._bufferIndex;let u;if(n===s)u=[e[n].slice(r,l)];else{if(u=e.slice(n,s),r>-1){const d=u[0];typeof d=="string"?u[0]=d.slice(r):u.shift()}l>0&&u.push(e[s].slice(0,l))}return u}function G8(e,t){let n=-1;const r=[];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,r.push(u)}return r.join("")}function V8(e){const r={constructs:$C([F8,...(e||{}).extensions||[]]),content:s(oU),defined:[],document:s(cU),flow:s(E8),lazy:{},string:s(R8),text:s(_8)};return r;function s(l){return u;function u(d){return H8(r,l,d)}}}function W8(e){for(;!FC(e););return e}const Xw=/[\0\t\n\r]/g;function Z8(){let e=1,t="",n=!0,r;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(Xw.lastIndex=m,h=Xw.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&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=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:r=!0,e=1}m=y+1}return d&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const Y8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function K8(e){return e.replace(Y8,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 IC(n.slice(l?2:1),l?16:10)}return jv(n)||e}const ZC={}.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(ze),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(Dt),listItemValue:y,listOrdered:l(_t,m),listUnordered:l(_t),paragraph:l(Yt),reference:O,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:l(qe),strong:l(Ht),thematicBreak:l(ye)},exit:{atxHeading:f(),atxHeadingSequence:B,autolink:f(),autolinkEmail:Ee,autolinkProtocol:Re,blockQuote:f(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:le,characterReference:be,codeFenced:f(C),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:k,codeFlowValue:_,codeIndented:f(S),codeText:f($),codeTextData:_,data:_,definition:f(),definitionDestinationString:A,definitionLabelString:T,definitionTitleString:E,emphasis:f(),hardBreakEscape:f(F),hardBreakTrailing:f(F),htmlFlow:f(W),htmlFlowData:_,htmlText:f(I),htmlTextData:_,image:f(V),label:K,labelText:X,lineEnding:P,link:f(q),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:ne,resourceDestinationString:L,resourceTitleString:U,resource:G,setextHeading:f(H),setextHeadingLineSequence:D,setextHeadingText:R,strong:f(),thematicBreak:f()}};YC(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Q){let Z={type:"root",children:[]};const ee={stack:[Z],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]];ZC.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]||Jw).call(ee,void 0,Le[0])}for(Z.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;)Z=t.transforms[he](Z)||Z;return Z}function s(Q,Z,ee){let ce=Z-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 Vt=ce;for(Ce=void 0;Vt--;){const At=Q[Vt];if(At[1].type==="lineEnding"||At[1].type==="lineEndingBlank"){if(At[0]==="exit")continue;Ce&&(Q[Ce][1].type="lineEndingBlank",Le=!0),At[1].type="lineEnding",Ce=Vt}else if(!(At[1].type==="linePrefix"||At[1].type==="blockQuotePrefix"||At[1].type==="blockQuotePrefixWhitespace"||At[1].type==="blockQuoteMarker"||At[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 Vt={type:"listItem",_spread:!1,start:Object.assign({},Ne[1].start),end:void 0};He=Vt,Q.splice(ce,0,["enter",Vt,Ne[2]]),ce++,ee++,Fe=void 0,et=!0}}}return Q[Z][1]._spread=Le,ee}function l(Q,Z){return ee;function ee(ce){d.call(this,Q(ce),ce),Z&&Z.call(this,ce)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(Q,Z,ee){this.stack[this.stack.length-1].children.push(Q),this.stack.push(Q),this.tokenStack.push([Z,ee||void 0]),Q.position={start:gi(Z.start),end:void 0}}function f(Q){return Z;function Z(ee){Q&&Q.call(this,ee),h.call(this,ee)}}function h(Q,Z){const ee=this.stack.pop(),ce=this.tokenStack.pop();if(ce)ce[0].type!==Q.type&&(Z?Z.call(this,Q,ce[0]):(ce[1]||Jw).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 Sv(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function y(Q){if(this.data.expectingFirstListItemValue){const Z=this.stack[this.stack.length-2];Z.start=Number.parseInt(this.sliceSerialize(Q),10),this.data.expectingFirstListItemValue=void 0}}function b(){const Q=this.resume(),Z=this.stack[this.stack.length-1];Z.lang=Q}function k(){const Q=this.resume(),Z=this.stack[this.stack.length-1];Z.meta=Q}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const Q=this.resume(),Z=this.stack[this.stack.length-1];Z.value=Q.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const Q=this.resume(),Z=this.stack[this.stack.length-1];Z.value=Q.replace(/(\r?\n|\r)$/g,"")}function T(Q){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.label=Z,ee.identifier=Ua(this.sliceSerialize(Q)).toLowerCase()}function E(){const Q=this.resume(),Z=this.stack[this.stack.length-1];Z.title=Q}function A(){const Q=this.resume(),Z=this.stack[this.stack.length-1];Z.url=Q}function B(Q){const Z=this.stack[this.stack.length-1];if(!Z.depth){const ee=this.sliceSerialize(Q).length;Z.depth=ee}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function D(Q){const Z=this.stack[this.stack.length-1];Z.depth=this.sliceSerialize(Q).codePointAt(0)===61?1:2}function H(){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 _(Q){const Z=this.stack.pop();Z.value+=this.sliceSerialize(Q),Z.position.end=gi(Q.end)}function P(Q){const Z=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ee=Z.children[Z.children.length-1];ee.position.end=gi(Q.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Z.type)&&(M.call(this,Q),_.call(this,Q))}function F(){this.data.atHardBreak=!0}function W(){const Q=this.resume(),Z=this.stack[this.stack.length-1];Z.value=Q}function I(){const Q=this.resume(),Z=this.stack[this.stack.length-1];Z.value=Q}function $(){const Q=this.resume(),Z=this.stack[this.stack.length-1];Z.value=Q}function q(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=Z,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 Z=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=Z,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function X(Q){const Z=this.sliceSerialize(Q),ee=this.stack[this.stack.length-2];ee.label=K8(Z),ee.identifier=Ua(Z).toLowerCase()}function K(){const Q=this.stack[this.stack.length-1],Z=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=Z}function L(){const Q=this.resume(),Z=this.stack[this.stack.length-1];Z.url=Q}function U(){const Q=this.resume(),Z=this.stack[this.stack.length-1];Z.title=Q}function G(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function ne(Q){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.label=Z,ee.identifier=Ua(this.sliceSerialize(Q)).toLowerCase(),this.data.referenceType="full"}function ue(Q){this.data.characterReferenceType=Q.type}function le(Q){const Z=this.sliceSerialize(Q),ee=this.data.characterReferenceType;let ce;ee?(ce=IC(Z,ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ce=jv(Z);const he=this.stack[this.stack.length-1];he.value+=ce}function be(Q){const Z=this.stack.pop();Z.position.end=gi(Q.end)}function Re(Q){_.call(this,Q);const Z=this.stack[this.stack.length-1];Z.url=this.sliceSerialize(Q)}function Ee(Q){_.call(this,Q);const Z=this.stack[this.stack.length-1];Z.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 ze(){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 _t(Q){return{type:"list",ordered:Q.type==="listOrdered",start:null,spread:Q._spread,children:[]}}function Dt(Q){return{type:"listItem",spread:Q._spread,checked:null,children:[]}}function Yt(){return{type:"paragraph",children:[]}}function Ht(){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 YC(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?YC(e,r):e9(e,r)}}function e9(e,t){let n;for(n in t)if(ZC.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Jw(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(r){return X8(r,{...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 a9(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
1628
+ `}]}function r9(e,t){const n=t.value?t.value+`
1629
+ `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let l={type:"element",tagName:"code",properties:r,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-",r=String(t.identifier).toUpperCase(),s=So(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let u,d=e.footnoteCounts.get(r);d===void 0?(d=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=l+1,d+=1,e.footnoteCounts.set(r,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 KC(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),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+=r:s.push({type:"text",value:r}),s}function u9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return KC(e,t);const s={src:So(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.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 r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function p9(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function f9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return KC(e,t);const s={href:So(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.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 r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function m9(e,t,n){const r=e.all(t),s=n?g9(n):QC(t),l={},u=[];if(typeof t.checked=="boolean"){const g=r[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},r.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<r.length;){const g=r[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=r[r.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 r=-1;for(;!t&&++r<n.length;)t=QC(n[r])}return t}function QC(e){const t=e.spread;return t??e.children.length>1}function v9(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const u=r[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(r,!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),r=n.shift(),s=[];if(r){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!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=bv(t.children[1]),f=RC(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 r=n?n.children:void 0,l=(r?r.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 ek=9,tk=32;function j9(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const l=[];for(;r;)l.push(nk(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return l.push(nk(t.slice(s),s>0,!1)),l.join("")}function nk(e,t,n){let r=0,s=e.length;if(t){let l=e.codePointAt(r);for(;l===ek||l===tk;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(s-1);for(;l===ek||l===tk;)s--,l=e.codePointAt(s-1)}return s>r?e.slice(r,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:a9,code:r9,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 XC=-1,Kd=0,Dl=1,Sd=2,Nv=3,Ev=4,Tv=5,Av=6,JC=7,eN=8,T9=typeof self=="object"?self:globalThis,ak=(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),r=s=>{if(e.has(s))return e.get(s);const[l,u]=t[s];switch(l){case Kd:case XC:return n(u,s);case Dl:{const d=n([],s);for(const f of u)d.push(r(f));return d}case Sd:{const d=n({},s);for(const[f,h]of u)d[r(f)]=r(h);return d}case Nv:return n(new Date(u),s);case Ev:{const{source:d,flags:f}=u;return n(new RegExp(d,f),s)}case Tv:{const d=n(new Map,s);for(const[f,h]of u)d.set(r(f),r(h));return d}case Av:{const d=n(new Set,s);for(const f of u)d.add(r(f));return d}case JC:{const{name:d,message:f}=u;return n(ak(d,f),s)}case eN: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(ak(l,u),s)};return r},rk=e=>A9(new Map,e)(0),Qs="",{toString:R9}={},{keys:_9}=Object,jl=e=>{const t=typeof e;if(t!=="object"||!e)return[Kd,t];const n=R9.call(e).slice(8,-1);switch(n){case"Array":return[Dl,Qs];case"Object":return[Sd,Qs];case"Date":return[Nv,Qs];case"RegExp":return[Ev,Qs];case"Map":return[Tv,Qs];case"Set":return[Av,Qs];case"DataView":return[Dl,n]}return n.includes("Array")?[Dl,n]:n.includes("Error")?[JC,n]:[Sd,n]},Pu=([e,t])=>e===Kd&&(t==="function"||t==="symbol"),O9=(e,t,n,r)=>{const s=(u,d)=>{const f=r.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=eN,g=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);g=null;break;case"undefined":return s([XC],u)}return s([d,g],u)}case Dl:{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 Sd:{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 _9(u))(e||!Pu(jl(u[y])))&&g.push([l(y),l(u[y])]);return m}case Nv:return s([d,u.toISOString()],u);case Ev:{const{source:g,flags:m}=u;return s([d,{source:g,flags:m}],u)}case Tv:{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 Av:{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},ik=(e,{json:t,lossy:n}={})=>{const r=[];return O9(!(t||n),!!t,new Map,r)(e),r},jd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?rk(ik(e,t)):structuredClone(e):(e,t)=>rk(ik(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 z9(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||L9,r=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 r=="string"?r:r(f,b),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const T=C.children[C.children.length-1];T&&T.type==="text"?T.value+=" ":C.children.push({type:"text",value:" "}),C.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:{...jd(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 Qd=(function(e){if(e==null)return P9;if(typeof e=="function")return Xd(e);if(typeof e=="object")return Array.isArray(e)?D9(e):$9(e);if(typeof e=="string")return I9(e);throw new Error("Expected function, string, or object as test")});function D9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Qd(e[n]);return Xd(r);function r(...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 Xd(n);function n(r){const s=r;let l;for(l in e)if(s[l]!==t[l])return!1;return!0}}function I9(e){return Xd(t);function t(n){return n&&n.type===e}}function Xd(e){return t;function t(n,r,s){return!!(U9(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function P9(){return!0}function U9(e){return e!==null&&typeof e=="object"&&"type"in e}const tN=[],B9=!0,Jm=!1,F9="skip";function nN(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const l=Qd(s),u=r?-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=tN,k,j,C;if((!t||l(f,h,g[g.length-1]||void 0))&&(b=H9(n(f,g)),b[0]===Jm))return b;if("children"in f&&f.children){const S=f;if(S.children&&b[0]!==F9)for(j=(r?S.children.length:-1)+u,C=g.concat(S);j>-1&&j<S.children.length;){const T=S.children[j];if(k=d(T,j,C)(),k[0]===Jm)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?tN:[e]}function Rv(e,t,n,r){let s,l,u;typeof t=="function"&&typeof n!="function"?(l=void 0,u=t,s=n):(l=t,u=n,s=r),nN(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 eg={}.hasOwnProperty,q9={};function G9(e,t){const n=t||q9,r=new Map,s=new Map,l=new Map,u={...E9,...n.handlers},d={all:h,applyData:W9,definitionById:r,footnoteById:s,footnoteCounts:l,footnoteOrder:[],handlers:u,one:f,options:n,patch:V9,wrap:Y9};return Rv(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?r: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(eg.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,...C}=g,S=jd(C);return S.children=d.all(g),S}return jd(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=sk(k.value)),!Array.isArray(k)&&k.type==="element")){const j=k.children[0];j&&j.type==="text"&&(j.value=sk(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 r=e.data.hName,s=e.data.hChildren,l=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const u="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:u}}n.type==="element"&&l&&Object.assign(n.properties,jd(l)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function Z9(e,t){const n=t.data||{},r="value"in t&&!(eg.call(n,"hProperties")||eg.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Y9(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
1634
+ `});++r<e.length;)r&&n.push({type:"text",value:`
1635
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
1636
+ `}),n}function sk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ok(e,t){const n=G9(e,t),r=n.one(e,void 0),s=z9(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&l.children.push({type:"text",value:`
1637
+ `},s),l}function K9(e,t){return e&&"run"in e?async function(n,r){const s=ok(n,{file:r,...t});await e.run(s,r)}:function(n,r){return ok(n,{file:r,...e||t})}}function lk(e){if(e)throw e}var nm,ck;function Q9(){if(ck)return nm;ck=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=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(r)return r(h,g).value}else return;return h[g]};return nm=function f(){var h,g,m,y,b,k,j=arguments[0],C=1,S=arguments.length,T=!1;for(typeof j=="boolean"&&(T=j,j=arguments[1]||{},C=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});C<S;++C)if(h=arguments[C],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},nm}var X9=Q9();const am=Wl(X9);function tg(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:r};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 r(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 r;function r(...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 nr={basename:tB,dirname:nB,extname:aB,join:rB,sep:"/"};function tB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');rc(e);let n=0,r=-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 r<0&&(l=!0,r=s+1);return r<0?"":e.slice(n,r)}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&&(r=s):(d=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function nB(e){if(rc(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function aB(e){rc(e);let t=e.length,n=-1,r=0,s=-1,l=0,u;for(;t--;){const d=e.codePointAt(t);if(d===47){if(u){r=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===r+1?"":e.slice(s,n)}function rB(...e){let t=-1,n;for(;++t<e.length;)rc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":iB(n)}function iB(e){rc(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="",r=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||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),s=u,l=0;continue}}else if(n.length>0){n="",r=0,s=u,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,u):n=e.slice(s+1,u),r=u-s-1;s=u,l=0}else d===46&&l>-1?l++:l=-1}return n}function rc(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 ng(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(!ng(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 r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const rm=["history","path","basename","stem","extname","dirname"];class aN{constructor(t){let n;t?ng(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 r=-1;for(;++r<rm.length;){const l=rm[r];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"?nr.basename(this.path):void 0}set basename(t){sm(t,"basename"),im(t,"basename"),this.path=nr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?nr.dirname(this.path):void 0}set dirname(t){uk(this.basename,"dirname"),this.path=nr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?nr.extname(this.path):void 0}set extname(t){if(im(t,"extname"),uk(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=nr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ng(t)&&(t=cB(t)),sm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?nr.basename(this.path,this.extname):void 0}set stem(t){sm(t,"stem"),im(t,"stem"),this.path=nr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Rn(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function im(e,t){if(e&&e.includes(nr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+nr.sep+"`")}function sm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function uk(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 r=this.constructor.prototype,s=r[e],l=function(){return s.apply(l,arguments)};return Object.setPrototypeOf(l,r),l}),fB={}.hasOwnProperty;class _v 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 _v;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(am(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(cm("data",this.frozen),this.namespace[t]=n,this):fB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(cm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Uu(t),r=this.parser||this.Parser;return om("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),om("process",this.parser||this.Parser),lm("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(l,u){const d=Uu(t),f=r.parse(d);r.run(f,d,function(g,m,y){if(g||!m||!y)return h(g);const b=m,k=r.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,r;return this.freeze(),om("processSync",this.parser||this.Parser),lm("processSync",this.compiler||this.Compiler),this.process(t,s),pk("processSync","process",n),r;function s(l,u){n=!0,lk(l),r=u}}run(t,n,r){dk(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?l(void 0,r):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):r(void 0,b,y)}}}runSync(t,n){let r=!1,s;return this.run(t,n,l),pk("runSync","run",r),s;function l(u,d){lk(u),s=d,r=!0}}stringify(t,n){this.freeze();const r=Uu(n),s=this.compiler||this.Compiler;return lm("stringify",s),dk(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(cm("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=am(!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<r.length;)if(r[m][0]===h){y=m;break}if(y===-1)r.push([h,...g]);else if(g.length>0){let[b,...k]=g;const j=r[y][1];tg(j)&&tg(b)&&(b=am(!0,j,b)),r[y]=[h,b,...k]}}}}const hB=new _v().freeze();function om(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function lm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function cm(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 dk(e){if(!tg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function pk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Uu(e){return mB(e)?e:new aN(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",fk=[],hk={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||fk,n=e.remarkPlugins||fk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...hk}:hk;return hB().use(t9).use(n).use(K9,r).use(t)}function SB(e){const t=e.children||"",n=new aN;return typeof t=="string"&&(n.value=t),n}function jB(e,t){const n=t.allowedElements,r=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 Rv(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 Jh)if(Object.hasOwn(Jh,b)&&Object.hasOwn(g.properties,b)){const k=g.properties[b],j=Jh[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&&r&&typeof m=="number"&&(b=!r(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("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||bB.test(e.slice(0,t))?e:""}function mk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function NB(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function rN(e,t,n){const s=Qd((n||{}).ignore||[]),l=EB(t);let u=-1;for(;++u<l.length;)nN(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 C=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 R=b(...E,B);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?y.lastIndex=A+1:(k!==A&&T.push({type:"text",value:h.value.slice(k,A)}),Array.isArray(R)?T.push(...R):R&&T.push(R),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(C,1,...T)):T=[h],C+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 r=-1;for(;++r<n.length;){const s=n[r];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 um="phrasing",dm=["autolink","link","image","label"];function RB(){return{transforms:[$B],enter:{literalAutolink:OB,literalAutolinkEmail:pm,literalAutolinkHttp:pm,literalAutolinkWww:pm},exit:{literalAutolink:DB,literalAutolinkEmail:zB,literalAutolinkHttp:LB,literalAutolinkWww:MB}}}function _B(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:um,notInConstruct:dm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:um,notInConstruct:dm},{character:":",before:"[ps]",after:"\\/",inConstruct:um,notInConstruct:dm}]}}function OB(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function pm(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 zB(e){this.config.exit.autolinkEmail.call(this,e)}function DB(e){this.exit(e)}function $B(e){rN(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,r,s){let l="";if(!iN(s)||(/^w/i.test(t)&&(n=t+n,t="",l="http://"),!UB(n)))return!1;const u=BB(n+r);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,r){return!iN(r,!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],r=n.indexOf(")");const s=mk(e,"(");let l=mk(e,")");for(;r!==-1&&s>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function iN(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||as(n)||Zd(n))&&(!t||n!==47)}sN.peek=KB;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=Ua(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=Ua(this.sliceSerialize(e)).toLowerCase(),n.label=t}function YB(e){this.exit(e)}function KB(){return"["}function sN(e,t,n,r){const s=n.createTracker(r);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:YB}}}function XB(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:sN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,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(r),{before:f,after:"]"})),g(),f+=d.move("]:"),r.children&&r.children.length>0&&(d.shift(4),f+=d.move((t?`
1638
+ `:" ")+l.indentLines(l.containerFlow(r,d.current()),t?oN:JB))),h(),f}}function JB(e,t,n){return t===0?e:oN(e,t,n)}function oN(e,t,n){return(n?"":" ")+e}const eF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];lN.peek=iF;function tF(){return{canContainEols:["delete"],enter:{strikethrough:aF},exit:{strikethrough:rF}}}function nF(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:eF}],handlers:{delete:lN}}}function aF(e){this.enter({type:"delete",children:[]},e)}function rF(e){this.exit(e)}function lN(e,t,n,r){const s=n.createTracker(r),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||{},r=(n.align||[]).concat(),s=n.stringLength||sF,l=[],u=[],d=[],f=[];let h=0,g=-1;for(;++g<e.length;){const j=[],C=[];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);C[S]=E,(f[S]===void 0||E>f[S])&&(f[S]=E)}j.push(T)}u[g]=j,d[g]=C}let m=-1;if(typeof r=="object"&&"length"in r)for(;++m<h;)l[m]=gk(r[m]);else{const j=gk(r);for(;++m<h;)l[m]=j}m=-1;const y=[],b=[];for(;++m<h;){const j=l[m];let C="",S="";j===99?(C=":",S=":"):j===108?C=":":j===114&&(S=":");let T=n.alignDelimiters===!1?1:Math.max(1,f[m]-C.length-S.length);const E=C+"-".repeat(T)+S;n.alignDelimiters!==!1&&(T=C.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],C=d[g];m=-1;const S=[];for(;++m<h;){const T=j[m]||"";let E="",A="";if(n.alignDelimiters!==!1){const B=f[m]-(C[m]||0),R=l[m];R===114?E=" ".repeat(B):R===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 gk(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,r){const s=n.enter("blockquote"),l=n.createTracker(r);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 vk(e,t.inConstruct,!0)&&!vk(e,t.notInConstruct,!1)}function vk(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function yk(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
1640
+ `&&dF(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
1641
+ `}function pF(e,t){const n=String(e);let r=n.indexOf(t),s=r,l=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++l>u&&(u=l):l=1,s=r+t.length,r=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,r){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(r),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 Ov(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,r){const s=Ov(n),l=s==='"'?"Quote":"Apostrophe",u=n.enter("definition");let d=n.enter("label");const f=n.createTracker(r);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 Cd(e,t,n){const r=ho(e),s=ho(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}cN.peek=bF;function cN(e,t,n,r){const s=yF(n),l=n.enter("emphasis"),u=n.createTracker(r),d=u.move(s);let f=u.move(n.containerPhrasing(e,{after:s,before:d,...u.current()}));const h=f.charCodeAt(0),g=Cd(r.before.charCodeAt(r.before.length-1),h,s);g.inside&&(f=Gl(h)+f.slice(1));const m=f.charCodeAt(f.length-1),y=Cd(r.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 Rv(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Jm}),!!((!e.depth||e.depth<3)&&Sv(e)&&(t.options.setext||n))}function wF(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);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}uN.peek=kF;function uN(e){return e.value||""}function kF(){return"<"}dN.peek=SF;function dN(e,t,n,r){const s=Ov(n),l=s==='"'?"Quote":"Apostrophe",u=n.enter("image");let d=n.enter("label");const f=n.createTracker(r);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"!"}pN.peek=jF;function pN(e,t,n,r){const s=e.referenceType,l=n.enter("imageReference");let u=n.enter("label");const d=n.createTracker(r);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"!"}fN.peek=CF;function fN(e,t,n){let r=e.value||"",s="`",l=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l<n.unsafe.length;){const u=n.unsafe[l],d=n.compilePattern(u);let f;if(u.atBreak)for(;f=d.exec(r);){let h=f.index;r.charCodeAt(h)===10&&r.charCodeAt(h-1)===13&&h--,r=r.slice(0,h)+" "+r.slice(f.index+1)}}return s+r+s}function CF(){return"`"}function hN(e,t){const n=Sv(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))}mN.peek=NF;function mN(e,t,n,r){const s=Ov(n),l=s==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let d,f;if(hN(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 hN(e,n)?"<":"["}gN.peek=EF;function gN(e,t,n,r){const s=e.referenceType,l=n.enter("linkReference");let u=n.enter("label");const d=n.createTracker(r);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 Lv(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=Lv(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 vN(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 RF(e,t,n,r){const s=n.enter("list"),l=n.bulletCurrent;let u=e.ordered?AF(n):Lv(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),vN(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,r);return n.bulletLastUsed=u,n.bulletCurrent=l,s(),h}function _F(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,r){const s=_F(n);let l=n.bulletCurrent||Lv(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(r);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,r){const s=n.enter("paragraph"),l=n.enter("phrasing"),u=n.containerPhrasing(e,r);return l(),s(),u}const MF=Qd(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function zF(e,t,n,r){return(e.children.some(function(u){return MF(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function DF(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}yN.peek=$F;function yN(e,t,n,r){const s=DF(n),l=n.enter("strong"),u=n.createTracker(r),d=u.move(s+s);let f=u.move(n.containerPhrasing(e,{after:s,before:d,...u.current()}));const h=f.charCodeAt(0),g=Cd(r.before.charCodeAt(r.before.length-1),h,s);g.inside&&(f=Gl(h)+f.slice(1));const m=f.charCodeAt(f.length-1),y=Cd(r.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,r){return n.safe(e.value,r)}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 r=(vN(n)+(n.options.ruleSpaces?" ":"")).repeat(PF(n));return n.options.ruleSpaces?r.slice(0,-1):r}const bN={blockquote:cF,break:yk,code:mF,definition:vF,emphasis:cN,hardBreak:yk,heading:wF,html:uN,image:dN,imageReference:pN,inlineCode:fN,link:mN,linkReference:gN,list:RF,listItem:OF,paragraph:LF,root:zF,strong:yN,text:IF,thematicBreak:UF};function BF(){return{enter:{table:FF,tableData:bk,tableHeader:bk,tableRow:qF},exit:{codeText:GF,table:HF,tableData:fm,tableHeader:fm,tableRow:fm}}}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 fm(e){this.exit(e)}function bk(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,r=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,C){return h(g(b,j,C),b.align)}function d(b,k,j,C){const S=m(b,j,C),T=h([S]);return T.slice(0,T.indexOf(`
1652
+ `))}function f(b,k,j,C){const S=j.enter("tableCell"),T=j.enter("phrasing"),E=j.containerPhrasing(b,{...C,before:l,after:l});return T(),S(),E}function h(b,k){return oF(b,{align:k,alignDelimiters:r,padding:n,stringLength:s})}function g(b,k,j){const C=b.children;let S=-1;const T=[],E=k.enter("table");for(;++S<C.length;)T[S]=m(C[S],k,j);return E(),T}function m(b,k,j){const C=b.children;let S=-1;const T=[],E=k.enter("tableRow");for(;++S<C.length;)T[S]=f(C[S],b,k,j);return E(),T}function y(b,k,j){let C=bN.inlineCode(b,k,j);return j.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function ZF(){return{exit:{taskListCheckValueChecked:xk,taskListCheckValueUnchecked:xk,paragraph:KF}}}function YF(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:QF}}}function xk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function KF(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let l=-1,u;for(;++l<s.length;){const d=s[l];if(d.type==="paragraph"){u=d;break}}u===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function QF(e,t,n,r){const s=e.children[0],l=typeof e.checked=="boolean"&&s&&s.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",d=n.createTracker(r);l&&d.move(u);let f=bN.listItem(e,t,n,{...r,...d.current()});return l&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),f;function h(g){return g+u}}function XF(){return[RB(),QB(),tF(),BF(),ZF()]}function JF(e){return{extensions:[_B(),XB(e),nF(),WF(e),YF()]}}const eH={tokenize:sH,partial:!0},xN={tokenize:oH,partial:!0},wN={tokenize:lH,partial:!0},kN={tokenize:cH,partial:!0},tH={tokenize:uH,partial:!0},SN={name:"wwwAutolink",tokenize:rH,previous:CN},jN={name:"protocolAutolink",tokenize:iH,previous:NN},Br={name:"emailAutolink",tokenize:aH,previous:EN},lr={};function nH(){return{text:lr}}let Zi=48;for(;Zi<123;)lr[Zi]=Br,Zi++,Zi===58?Zi=65:Zi===91&&(Zi=97);lr[43]=Br;lr[45]=Br;lr[46]=Br;lr[95]=Br;lr[72]=[Br,jN];lr[104]=[Br,jN];lr[87]=[Br,SN];lr[119]=[Br,SN];function aH(e,t,n){const r=this;let s,l;return u;function u(m){return!ag(m)||!EN.call(r,r.previous)||Mv(r.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(m))}function d(m){return ag(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&&zn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function rH(e,t,n){const r=this;return s;function s(u){return u!==87&&u!==119||!CN.call(r,r.previous)||Mv(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(eH,e.attempt(xN,e.attempt(wN,l),n),n)(u))}function l(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function iH(e,t,n){const r=this;let s="",l=!1;return u;function u(m){return(m===72||m===104)&&NN.call(r,r.previous)&&!Mv(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(m),e.consume(m),d):n(m)}function d(m){if(zn(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||kd(m)||Tt(m)||as(m)||Zd(m)?n(m):e.attempt(xN,e.attempt(wN,g),n)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function sH(e,t,n){let r=0;return s;function s(u){return(u===87||u===119)&&r<3?(r++,e.consume(u),s):u===46&&r===3?(e.consume(u),l):n(u)}function l(u){return u===null?n(u):t(u)}}function oH(e,t,n){let r,s,l;return u;function u(h){return h===46||h===95?e.check(kN,f,d)(h):h===null||Tt(h)||as(h)||h!==45&&Zd(h)?f(h):(l=!0,e.consume(h),u)}function d(h){return h===95?r=!0:(s=r,r=void 0),e.consume(h),u}function f(h){return s||r||!l?n(h):t(h)}}function lH(e,t){let n=0,r=0;return s;function s(u){return u===40?(n++,e.consume(u),s):u===41&&r<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(kN,t,l)(u):u===null||Tt(u)||as(u)?t(u):(e.consume(u),s)}function l(u){return u===41&&r++,e.consume(u),s}}function cH(e,t,n){return r;function r(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),r):d===38?(e.consume(d),l):d===93?(e.consume(d),s):d===60||d===null||Tt(d)||as(d)?t(d):n(d)}function s(d){return d===null||d===40||d===91||Tt(d)||as(d)?t(d):r(d)}function l(d){return zn(d)?u(d):n(d)}function u(d){return d===59?(e.consume(d),r):zn(d)?(e.consume(d),u):n(d)}}function uH(e,t,n){return r;function r(l){return e.consume(l),s}function s(l){return Tn(l)?n(l):t(l)}}function CN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function NN(e){return!zn(e)}function EN(e){return!(e===47||ag(e))}function ag(e){return e===43||e===45||e===46||e===95||Tn(e)}function Mv(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const 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 r=this;let s=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;s--;){const f=r.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=Ua(r.sliceSerialize({start:u.end,end:r.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 r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const 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",r,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",r,t]];return e.splice(n,e.length-n+1,...d),e}function mH(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.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||Tt(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return s.includes(Ua(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Tt(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 r=this,s=r.parser.gfmFootnotes||(r.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||Tt(k))return n(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return l=Ua(r.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Tt(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(ac,t,e.attempt(dH,t,n))}function yH(e){e.exit("gfmFootnoteDefinition")}function bH(e,t,n){const r=this;return dt(e,s,"gfmFootnoteDefinitionIndent",5);function s(l){const u=r.events[r.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 r={name:"strikethrough",tokenize:l,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},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&&la(y,y.length,0,Yd(b,u.slice(h+1,f),d)),la(y,y.length,0,[["exit",m,d],["enter",u[f][1],d],["exit",u[f][1],d],["exit",g,d]]),la(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 C=u.exit("strikethroughSequenceTemporary"),S=ho(k);return C._open=!S||S===2&&!!j,C._close=!j||j===2&&!!S,d(k)}}}class wH{constructor(){this.map=[]}add(t,n,r){kH(this,t,n,r)}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 r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const l of s)t.push(l);s=r.pop()}this.map.length=0}}function kH(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function SH(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function jH(){return{flow:{null:{name:"table",tokenize:CH,resolveAll:NH}}}}function CH(e,t,n){const r=this;let s=0,l=0,u;return d;function d(_){let P=r.events.length-1;for(;P>-1;){const I=r.events[P][1].type;if(I==="lineEnding"||I==="linePrefix")P--;else break}const F=P>-1?r.events[P][1].type:null,W=F==="tableHead"||F==="tableRow"?R:f;return W===R&&r.parser.lazy[r.now().line]?n(_):W(_)}function f(_){return e.enter("tableHead"),e.enter("tableRow"),h(_)}function h(_){return _===124||(u=!0,l+=1),g(_)}function g(_){return _===null?n(_):Pe(_)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),b):n(_):it(_)?dt(e,g,"whitespace")(_):(l+=1,u&&(u=!1,s+=1),_===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),m(_)))}function m(_){return _===null||_===124||Tt(_)?(e.exit("data"),g(_)):(e.consume(_),_===92?y:m)}function y(_){return _===92||_===124?(e.consume(_),m):m(_)}function b(_){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(_):(e.enter("tableDelimiterRow"),u=!1,it(_)?dt(e,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):k(_))}function k(_){return _===45||_===58?C(_):_===124?(u=!0,e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),j):B(_)}function j(_){return it(_)?dt(e,C,"whitespace")(_):C(_)}function C(_){return _===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),S):_===45?(l+=1,S(_)):_===null||Pe(_)?A(_):B(_)}function S(_){return _===45?(e.enter("tableDelimiterFiller"),T(_)):B(_)}function T(_){return _===45?(e.consume(_),T):_===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(_))}function E(_){return it(_)?dt(e,A,"whitespace")(_):A(_)}function A(_){return _===124?k(_):_===null||Pe(_)?!u||s!==l?B(_):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(_)):B(_)}function B(_){return n(_)}function R(_){return e.enter("tableRow"),D(_)}function D(_){return _===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),D):_===null||Pe(_)?(e.exit("tableRow"),t(_)):it(_)?dt(e,D,"whitespace")(_):(e.enter("data"),H(_))}function H(_){return _===null||_===124||Tt(_)?(e.exit("data"),D(_)):(e.consume(_),_===92?M:H)}function M(_){return _===92||_===124?(e.consume(_),H):H(_)}}function NH(e,t){let n=-1,r=!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&&(wk(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"?(r=!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")?(r=!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"&&(r?r=!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&&wk(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,r,s,l){const u=r===1?"tableHeader":r===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]]),r!==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 wk(e,t,n,r,s){const l=[],u=Js(t.events,n);s&&(s.end=Object.assign({},u),l.push(["exit",s,t])),r.end=Object.assign({},u),l.push(["exit",r,t]),e.add(n+1,0,l)}function Js(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const EH={name:"tasklistCheck",tokenize:AH};function TH(){return{text:{91:EH}}}function AH(e,t,n){const r=this;return s;function s(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),l)}function l(f){return Tt(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:RH},t,n)(f):n(f)}}function RH(e,t,n){return dt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function _H(e){return $C([nH(),pH(),xH(e),jH(),TH()])}const OH={};function LH(e){const t=this,n=e||OH,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(_H(n)),l.push(XF()),u.push(JF(n))}function MH(e){rN(e,[/\r?\n|\r/g,zH])}function zH(){return{type:"break"}}function DH(){return function(e){MH(e)}}const TN=["ts","tsx","js","jsx","py","sh","bash","json","yaml","sql","sparql","md","html","css","solidity","rust","go","toml","diff","dockerfile","xml"];let Cl=null;function $H(){return Cl||(Cl=Aa(()=>import("./index-CVwCoJrM.js"),[]).then(e=>e.createHighlighter({themes:["github-dark","github-light"],langs:[...TN]})).catch(e=>{throw Cl=null,e}),Cl)}function IH(e){if(!e)return null;const t=e.toLowerCase().trim();return TN.includes(t)?t:t==="typescript"?"ts":t==="javascript"?"js":t==="python"?"py":t==="shell"||t==="zsh"?"sh":t==="yml"?"yaml":t==="markdown"?"md":t==="sol"?"solidity":t==="rs"?"rust":t==="golang"?"go":t==="patch"?"diff":t==="docker"?"dockerfile":null}function PH({code:e,lang:t}){const n=IH(t),[r,s]=w.useState(null),[l,u]=w.useState(!1),f=Gn(m=>m.theme)==="light"?"github-light":"github-dark",h=w.useRef(null);w.useEffect(()=>{if(!n){s(null);return}let m=!1;return $H().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(iO,{size:14,"aria-hidden":"true"}):o.jsx(uO,{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}),r?o.jsx("div",{className:"v10-md-pre-rendered",dangerouslySetInnerHTML:{__html:r}}):o.jsx("pre",{className:"v10-md-pre-fallback",children:o.jsx("code",{children:e})})]})}function UH(){return e=>{let t="none",n=null;const r=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&&r.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 AN({content:e,streaming:t}){return o.jsx("div",{className:"v10-md",children:o.jsx(wB,{remarkPlugins:[LH,DH],rehypePlugins:t?[UH]:[],components:{img:({src:n,alt:r,title:s})=>o.jsxs("span",{className:"v10-md-image-placeholder",title:s||(typeof n=="string"?n:void 0),children:["[image",r?`: ${r}`:"","]"]}),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:r})=>{const s=BH(n);return s==="http"?o.jsx("a",{className:"v10-md-link",href:n,target:"_blank",rel:"noopener noreferrer",children:r}):s==="mailto"?o.jsx("a",{className:"v10-md-link",href:n,children:r}):o.jsx("span",{className:"v10-md-link v10-md-link-inert",title:n,children:r})},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:r,...s})=>o.jsx("thead",{className:"v10-md-thead",...s,children:n}),tbody:({children:n,node:r,...s})=>o.jsx("tbody",{className:"v10-md-tbody",...s,children:n}),tr:({children:n,node:r,...s})=>o.jsx("tr",{className:"v10-md-tr",...s,children:n}),th:({children:n,node:r,...s})=>o.jsx("th",{className:"v10-md-th",...s,children:n}),td:({children:n,node:r,...s})=>o.jsx("td",{className:"v10-md-td",...s,children:n}),pre:({children:n,node:r})=>{var l,u,d;const s=(l=r==null?void 0:r.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(()=>Aa(()=>import("./Operations-DKJFp6hM.js"),__vite__mapDeps([3,1])).then(e=>({default:e.OperationsPage}))),qH=Ve.lazy(()=>Aa(()=>import("./AgentHub-DdUAxJoy.js"),[]).then(e=>({default:e.AgentHubPage}))),GH=Ve.lazy(()=>Aa(()=>import("./Settings-DaYMlGHD.js"),[]).then(e=>({default:e.SettingsPage}))),VH=Ve.lazy(()=>Aa(()=>import("./AgentProfilePage-yI8fA4vv.js"),[]).then(e=>({default:e.AgentProfilePage}))),WH=Ve.lazy(()=>Aa(()=>import("./PublishingConviction-1CPHxNwp.js"),__vite__mapDeps([4,5])).then(e=>({default:e.PublishingConvictionPage}))),ZH=Ve.lazy(()=>Aa(()=>import("./ConvictionDetailView-CcQMya-y.js"),__vite__mapDeps([6,5])).then(e=>({default:e.ConvictionDetailView})));function YH(){const{tabs:e,activeTabId:t,setActiveTab:n,closeTab:r}=pn();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(),r(s.id)},children:FH})]},s.id))})}const KH=["text/","application/json","application/xml","application/javascript","application/x-yaml"];function QH(e){return KH.some(t=>e.startsWith(t))}function XH({docRef:e,contentType:t}){const{tabs:n,activeTabId:r,closeTab:s}=pn(),l=pn(_=>_.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),[C,S]=w.useState("formatted"),T=e.startsWith("urn:dkg:file:"),E=n.find(_=>_.id===r),A=(E==null?void 0:E.label)??"Document",B=()=>{const _=n.find(P=>P.id.startsWith("project:"));_&&l(_.id),s(r)};w.useEffect(()=>{let _=!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:Bt(),signal:F.signal}).then(async W=>{if(!W.ok)throw new Error(`HTTP ${W.status}`);const I=W.headers.get("content-type")??"application/octet-stream";if(!_)if(m(I),QH(I)){const $=await W.text();_||(d($),b(!1))}else if(I.startsWith("image/")){const $=await W.blob();_||(h(URL.createObjectURL($)),b(!1))}else if(I==="application/pdf"){const $=await W.blob();_||(h(URL.createObjectURL($)),b(!1))}else{const $=await W.text();_||(d($),b(!1))}}).catch(W=>{_||(j(W.message),b(!1))}),()=>{_=!0,F.abort()}},[e,T,t]),w.useEffect(()=>{S("formatted")},[e]),w.useEffect(()=>{const _=f;return()=>{_&&URL.revokeObjectURL(_)}},[f]);const R=g.startsWith("image/"),D=g==="application/pdf",H=g.startsWith("text/markdown")||t.startsWith("text/markdown"),M=!y&&!k&&T&&H&&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(_=>{const P=C===_;return o.jsx("button",{type:"button","aria-pressed":P,onClick:()=>S(_),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:_==="formatted"?"Formatted":"Raw"},_)})})]}),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&&R&&f&&o.jsx("img",{src:f,alt:A,style:{maxWidth:"100%",borderRadius:8}}),!y&&D&&f&&o.jsx("iframe",{src:f,title:A,style:{width:"100%",height:"100%",border:"none",borderRadius:8}}),u!==null&&!R&&!D&&H&&C==="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(AN,{content:u})}),u!==null&&!R&&!D&&!(H&&C==="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=pn(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===ev)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 r=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:r,agentUri:l})})}}if(e.startsWith(av)){const{docRef:t,contentType:n}=Mz(e);return o.jsx(XH,{docRef:t,contentType:n})}return e.startsWith("wm:")?o.jsx(Yh,{layer:"wm",contextGraphId:e.slice(3)}):e.startsWith("swm:")?o.jsx(Yh,{layer:"swm",contextGraphId:e.slice(4)}):e.startsWith("vm:")?o.jsx(Yh,{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(YH,{}),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"})}),a7=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"})]}),r7=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 kk(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 r=t.current;if(!r)return;const s=()=>{n.current=r.scrollHeight-r.scrollTop-r.clientHeight<40};return r.addEventListener("scroll",s),()=>r.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,r]=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"||kk(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=>r(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[kk(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,r]=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:()=>r(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:g1(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?m1(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:g1(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?m1(h.duration_ms):""]},h.phase))})]})})]},l.operation_id)})})]})})}function f7(){const{bottomCollapsed:e,toggleBottom:t,bottomMaximised:n,toggleBottomMaximised:r,bottomHeight:s,setBottomHeight:l}=Gn(),[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=C=>{const S=y-C.clientY;y=C.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=C=>{C.preventDefault(),y=C.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:r,title:n?"Restore":"Maximise",style:{display:e?"none":void 0},children:n?r7:a7}),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 Sk(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 Nd(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 ig(e,t){var n;return((n=e.find(r=>r.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 RN(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 _N(e){return e.status==="queued"||e.status==="completed"||e.status==="skipped"}function ON(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:ON(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(r=>{if(r.status!=="skipped"||!r.result)return[];t.push(r.id);const s=r.result,l=s.extraction;return[{id:r.id,fileName:ON(r.file),contextGraphId:r.contextGraphId,assertionName:r.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 LN(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=[RN(e),LN(t)].filter(r=>r.length>0).map(r=>r.replace(/\.$/,""));return n.length?`${n.join("; ")}.`:""}function w7(e,t,n){const r=[];if(t){const s=ig(e,t);r.push({key:"target_context_graph",label:"Target context graph id",value:t}),r.push({key:"target_context_graph_uri",label:"Target context graph URI",value:g7(t)}),r.push({key:"target_context_graph_name",label:"Target context graph name",value:s})}return n!=null&&n.agentAddress&&r.push({key:"current_agent_address",label:"Current agent address",value:n.agentAddress}),n!=null&&n.agentDid&&r.push({key:"current_agent_did",label:"Current agent DID",value:n.agentDid}),n!=null&&n.peerId&&r.push({key:"current_agent_peer_id",label:"Current agent peer ID",value:n.peerId}),r}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 km){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 r=e.trim();return r?r===t?!0:n==="Request cancelled."&&r===n:!1}function T7(e,t,n,r){return e&&E7(e,t,n)?{content:e,synthesized:!0}:e?r==="hermes"?{content:e,failureNotice:t,synthesized:!1}:{content:e,synthesized:!1}:{content:"",failureNotice:t,synthesized:!0}}function jk(e,t=""){const n=e.author.toLowerCase(),r=n.includes("assistant")||n.includes("agent")?"assistant":"user",s=typeof e.failureReason=="string"&&e.failureReason.trim()?e.failureReason.trim():void 0,l=r==="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||RN(e.attachmentRefs??[])),h=!!e.text;return{id:e.uri||`local-history:${++N7}`,uri:e.uri,turnId:e.turnId,role:r,content:f,ts:Nd(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 Ck(e,t){const n=new Set,r=[];for(const s of[...t,...e]){const l=A7(s);n.has(l)||(n.add(l),r.push(s))}return r}function Nk(e,t,n){const r=typeof n=="string"&&n.trim()?n.trim():t;return!r||r===t?e:e.map(s=>s.turnId===t?{...s,turnId:r}:s)}function Ek(e){return e.replace(/\r\n/g,`
1653
+ `).replace(/^(?:[ \t]*\n)+/,"").replace(/(?:\n[ \t]*)+$/,"")}function R7(e,t,n,r,s){const l=Ek(e),u=s?Ek(s):"";if(t==="assistant"&&r&&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(AN,{content:l,streaming:r&&!u}),u&&o.jsxs("span",{className:"v10-chat-plaintext v10-chat-failure-notice",children:[u,r&&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,r&&o.jsx("span",{className:"v10-chat-cursor"})]})}function sg(){return sg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sg.apply(null,arguments)}function _7(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var O7=w.useLayoutEffect,L7=function(t){var n=Ve.useRef(t);return O7(function(){n.current=t}),n},Tk=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},M7=function(t,n){var r=Ve.useRef();return Ve.useCallback(function(s){t.current=s,r.current&&Tk(r.current,null),r.current=n,n&&Tk(n,s)},[n])},Ak={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},z7=function(t){Object.keys(Ak).forEach(function(n){t.style.setProperty(n,Ak[n],"important")})},Rk=z7,On=null,_k=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function D7(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),On||(On=document.createElement("textarea"),On.setAttribute("tabindex","-1"),On.setAttribute("aria-hidden","true"),Rk(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]}),Rk(On),On.value=t;var f=_k(On,e);On.value=t,f=_k(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*r;return d==="border-box"&&(m=m+s+l),f=Math.min(m,f),[f,h]}var Ok=function(){},$7=function(t,n){return t.reduce(function(r,s){return r[s]=n[s],r},{})},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 r=$7(I7,n),s=r.boxSizing;if(s==="")return null;P7&&s==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var l=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),u=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:l,borderSize:u}},B7=U7;function zv(e,t,n){var r=L7(n);w.useLayoutEffect(function(){var s=function(u){return r.current(u)};if(e)return e.addEventListener(t,s),function(){return e.removeEventListener(t,s)}},[])}var F7=function(t,n){zv(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},H7=function(t){zv(window,"resize",t)},q7=function(t){zv(document.fonts,"loadingdone",t)},G7=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],V7=function(t,n){var r=t.cacheMeasurements,s=t.maxRows,l=t.minRows,u=t.onChange,d=u===void 0?Ok:u,f=t.onHeightChange,h=f===void 0?Ok:f,g=_7(t,G7),m=g.value!==void 0,y=w.useRef(null),b=M7(y,n),k=w.useRef(0),j=w.useRef(),C=function(){var E=y.current,A=r&&j.current?j.current:B7(E);if(A){j.current=A;var B=D7(A,E.value||E.placeholder||"x",l,s),R=B[0],D=B[1];k.current!==R&&(k.current=R,E.style.setProperty("height",R+"px","important"),h(R,{rowHeight:D}))}},S=function(E){m||C(),d(E)};return w.useLayoutEffect(C),F7(y,function(){if(!m){var T=y.current.value;requestAnimationFrame(function(){var E=y.current;E&&T!==E.value&&C()})}}),H7(C),q7(C),w.createElement("textarea",sg({},g,{onChange:S,ref:b}))},W7=w.forwardRef(V7),hm={exports:{}},mm,Lk;function Z7(){if(Lk)return mm;Lk=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return mm=e,mm}var gm,Mk;function Y7(){if(Mk)return gm;Mk=1;var e=Z7();function t(){}function n(){}return n.resetWarningCache=t,gm=function(){function r(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}}r.isRequired=r;function s(){return r}var l={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:n,resetWarningCache:t};return l.PropTypes=l,l},gm}var zk;function K7(){return zk||(zk=1,hm.exports=Y7()()),hm.exports}var Q7=K7();const Et=Wl(Q7);function ds(e,t,n,r){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(r.next(g))}catch(m){u(m)}}function f(g){try{h(r.throw(g))}catch(m){u(m)}}function h(g){g.done?l(g.value):s(g.value).then(d,f)}h((r=r.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 r=J7(e),{webkitRelativePath:s}=e,l=typeof t=="string"?t:typeof s=="string"&&s.length>0?s:`./${e.name}`;return typeof r.path!="string"&&Dk(r,"path",l),Dk(r,"relativePath",l),r}function J7(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),s=X7.get(r);s&&Object.defineProperty(e,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return e}function Dk(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 Ed(e)&&nq(e.dataTransfer)?sq(e.dataTransfer,e.type):aq(e)?rq(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?iq(e):[]})}function nq(e){return Ed(e)}function aq(e){return Ed(e)&&Ed(e.target)}function Ed(e){return typeof e=="object"&&e!==null}function rq(e){return og(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=og(e.items).filter(s=>s.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(oq));return $k(MN(r))}return $k(og(e.files).map(n=>mo(n)))})}function $k(e){return e.filter(t=>eq.indexOf(t.name)===-1)}function og(e){if(e===null)return[];const t=[];for(let n=0;n<e.length;n++){const r=e[n];t.push(r)}return t}function oq(e){if(typeof e.webkitGetAsEntry!="function")return Ik(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?zN(t):Ik(e,t)}function MN(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?MN(n):[n]],[])}function Ik(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 r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return mo(r,(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?zN(e):cq(e)})}function zN(e){const t=e.createReader();return new Promise((n,r)=>{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){r(d)}}),u=>{r(u)})}l()})}function cq(e){return ds(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const s=mo(r,e.fullPath);t(s)},r=>{n(r)})})})}var Fu={},Pk;function uq(){return Pk||(Pk=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 r=e.name||"",s=(e.type||"").toLowerCase(),l=s.replace(/\/.*$/,"");return n.some(function(u){var d=u.trim().toLowerCase();return d.charAt(0)==="."?r.toLowerCase().endsWith(d):d.endsWith("/*")?l===d.replace(/\/.*$/,""):s===d})}return!0}),Fu}var dq=uq();const vm=Wl(dq);function Uk(e){return hq(e)||fq(e)||$N(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 lg(e)}function Bk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Fk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bk(Object(n),!0).forEach(function(r){DN(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function DN(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)||$N(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 $N(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,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gq(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],s=!0,l=!1,u,d;try{for(n=n.call(e);!(s=(u=n.next()).done)&&(r.push(u.value),!(t&&r.length===t));s=!0);}catch(f){l=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(l)throw d}}return r}}function vq(e){if(Array.isArray(e))return e}var yq=typeof vm=="function"?vm:vm.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(","),r=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:bq,message:"File type must be ".concat(r)}},Hk=function(t){return{code:xq,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},qk=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 IN(e,t){var n=e.type==="application/x-moz-file"||yq(e,t)||Cq(e);return[n,n?null:Sq(t)]}function PN(e,t,n){if(Qi(e.size))if(Qi(t)&&Qi(n)){if(e.size>n)return[!1,Hk(n)];if(e.size<t)return[!1,qk(t)]}else{if(Qi(t)&&e.size<t)return[!1,qk(t)];if(Qi(n)&&e.size>n)return[!1,Hk(n)]}return[!0,null]}function Qi(e){return e!=null}function Nq(e){var t=e.files,n=e.accept,r=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=IN(f,n),g=Vl(h,1),m=g[0],y=PN(f,r,s),b=Vl(y,1),k=b[0],j=d?d(f):null;return m&&k&&!j})}function Td(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 Gk(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 er(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){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!Td(r)&&d&&d.apply(void 0,[r].concat(l)),Td(r)})}}function Rq(){return"showOpenFilePicker"in window}function _q(e){if(Qi(e)){var t=Object.entries(e).filter(function(n){var r=Vl(n,2),s=r[0],l=r[1],u=!0;return UN(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(BN))&&(console.warn('Skipped "'.concat(s,'" because an invalid file extension was provided.')),u=!1),u}).reduce(function(n,r){var s=Vl(r,2),l=s[0],u=s[1];return Fk(Fk({},n),{},DN({},l,u))},{});return[{description:"Files",accept:t}]}return e}function Oq(e){if(Qi(e))return Object.entries(e).reduce(function(t,n){var r=Vl(n,2),s=r[0],l=r[1];return[].concat(Uk(t),[s],Uk(l))},[]).filter(function(t){return UN(t)||BN(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 UN(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function BN(e){return/^.*\.[\w]+$/.test(e)}var zq=["children"],Dq=["open"],$q=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Iq=["refKey","onChange","onClick"];function Vk(e){return Bq(e)||Uq(e)||FN(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 cg(e)}function ym(e,t){return qq(e)||Hq(e,t)||FN(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 FN(e,t){if(e){if(typeof e=="string")return cg(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 cg(e,t)}}function cg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Hq(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],s=!0,l=!1,u,d;try{for(n=n.call(e);!(s=(u=n.next()).done)&&(r.push(u.value),!(t&&r.length===t));s=!0);}catch(f){l=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(l)throw d}}return r}}function qq(e){if(Array.isArray(e))return e}function Wk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function zt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wk(Object(n),!0).forEach(function(r){ug(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ug(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ad(e,t){if(e==null)return{};var n=Gq(e,t),r,s;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s<l.length;s++)r=l[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gq(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,l;for(l=0;l<r.length;l++)s=r[l],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Dv=w.forwardRef(function(e,t){var n=e.children,r=Ad(e,zq),s=qN(r),l=s.open,u=Ad(s,Dq);return w.useImperativeHandle(t,function(){return{open:l}},[l]),Ve.createElement(w.Fragment,null,n(zt(zt({},u),{},{open:l})))});Dv.displayName="Dropzone";var HN={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};Dv.defaultProps=HN;Dv.propTypes={children:Et.func,accept:Et.objectOf(Et.arrayOf(Et.string)),multiple:Et.bool,preventDropOnDocument:Et.bool,noClick:Et.bool,noKeyboard:Et.bool,noDrag:Et.bool,noDragEventsBubbling:Et.bool,minSize:Et.number,maxSize:Et.number,maxFiles:Et.number,disabled:Et.bool,getFilesFromEvent:Et.func,onFileDialogCancel:Et.func,onFileDialogOpen:Et.func,useFsAccessApi:Et.bool,autoFocus:Et.bool,onDragEnter:Et.func,onDragLeave:Et.func,onDragOver:Et.func,onDrop:Et.func,onDropAccepted:Et.func,onDropRejected:Et.func,onError:Et.func,validator:Et.func};var dg={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function qN(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=zt(zt({},HN),e),n=t.accept,r=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,C=t.onFileDialogOpen,S=t.useFsAccessApi,T=t.autoFocus,E=t.preventDropOnDocument,A=t.noClick,B=t.noKeyboard,R=t.noDrag,D=t.noDragEventsBubbling,H=t.onError,M=t.validator,_=w.useMemo(function(){return Oq(n)},[n]),P=w.useMemo(function(){return _q(n)},[n]),F=w.useMemo(function(){return typeof C=="function"?C:Zk},[C]),W=w.useMemo(function(){return typeof j=="function"?j:Zk},[j]),I=w.useRef(null),$=w.useRef(null),q=w.useReducer(Vq,dg),V=ym(q,2),X=V[0],K=V[1],L=X.isFocused,U=X.isFileDialogActive,G=w.useRef(typeof window<"u"&&window.isSecureContext&&S&&Rq()),O=function(){!G.current&&U&&setTimeout(function(){if($.current){var Q=$.current.files;Q.length||(K({type:"closeDialog"}),W())}},300)};w.useEffect(function(){return window.addEventListener("focus",O,!1),function(){window.removeEventListener("focus",O,!1)}},[$,U,W,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",Gk,!1),document.addEventListener("drop",le,!1)),function(){E&&(document.removeEventListener("dragover",Gk),document.removeEventListener("drop",le))}},[I,E]),w.useEffect(function(){var ye=function(he){ue.current=[].concat(Vk(ue.current),[he.target]),Nl(he)&&K({isDragGlobal:!0,type:"setDragGlobal"})},Q=function(he){ue.current=ue.current.filter(function(Le){return Le!==he.target&&Le!==null}),!(ue.current.length>0)&&K({isDragGlobal:!1,type:"setDragGlobal"})},Z=function(){ue.current=[],K({isDragGlobal:!1,type:"setDragGlobal"})},ee=function(){ue.current=[],K({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",ye,!1),document.addEventListener("dragleave",Q,!1),document.addEventListener("dragend",Z,!1),document.addEventListener("drop",ee,!1),function(){document.removeEventListener("dragenter",ye),document.removeEventListener("dragleave",Q),document.removeEventListener("dragend",Z),document.removeEventListener("drop",ee)}},[I]),w.useEffect(function(){return!r&&T&&I.current&&I.current.focus(),function(){}},[I,T,r]);var be=w.useCallback(function(ye){H?H(ye):console.error(ye)},[H]),Re=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye),ne.current=[].concat(Vk(ne.current),[ye.target]),Nl(ye)&&Promise.resolve(s(ye)).then(function(Q){if(!(Td(ye)&&!D)){var Z=Q.length,ee=Z>0&&Nq({files:Q,accept:_,minSize:u,maxSize:l,multiple:d,maxFiles:f,validator:M}),ce=Z>0&&!ee;K({isDragAccept:ee,isDragReject:ce,isDragActive:!0,type:"setDraggedFiles"}),h&&h(ye)}}).catch(function(Q){return be(Q)})},[s,h,be,D,_,u,l,d,f,M]),Ee=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye);var Q=Nl(ye);if(Q&&ye.dataTransfer)try{ye.dataTransfer.dropEffect="copy"}catch{}return Q&&m&&m(ye),!1},[m,D]),Ie=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye);var Q=ne.current.filter(function(ee){return I.current&&I.current.contains(ee)}),Z=Q.indexOf(ye.target);Z!==-1&&Q.splice(Z,1),ne.current=Q,!(Q.length>0)&&(K({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Nl(ye)&&g&&g(ye))},[I,g,D]),We=w.useCallback(function(ye,Q){var Z=[],ee=[];ye.forEach(function(ce){var he=IN(ce,_),Le=ym(he,2),He=Le[0],Ce=Le[1],Fe=PN(ce,u,l),et=ym(Fe,2),Ne=et[0],Vt=et[1],At=M?M(ce):null;if(He&&Ne&&!At)Z.push(ce);else{var Ha=[Ce,Vt];At&&(Ha=Ha.concat(At)),ee.push({file:ce,errors:Ha.filter(function(ua){return ua})})}}),(!d&&Z.length>1||d&&f>=1&&Z.length>f)&&(Z.forEach(function(ce){ee.push({file:ce,errors:[jq]})}),Z.splice(0)),K({acceptedFiles:Z,fileRejections:ee,type:"setFiles"}),y&&y(Z,ee,Q),ee.length>0&&k&&k(ee,Q),Z.length>0&&b&&b(Z,Q)},[K,d,_,u,l,f,y,b,k,M]),Se=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye),ne.current=[],Nl(ye)&&Promise.resolve(s(ye)).then(function(Q){Td(ye)&&!D||We(Q,ye)}).catch(function(Q){return be(Q)}),K({type:"reset"})},[s,We,be,D]),ft=w.useCallback(function(){if(G.current){K({type:"openDialog"}),F();var ye={multiple:d,types:P};window.showOpenFilePicker(ye).then(function(Q){return s(Q)}).then(function(Q){We(Q,null),K({type:"closeDialog"})}).catch(function(Q){Lq(Q)?(W(Q),K({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&&(K({type:"openDialog"}),F(),$.current.value=null,$.current.click())},[K,F,W,S,We,be,P,d]),ze=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(){K({type:"focus"})},[]),ke=w.useCallback(function(){K({type:"blur"})},[]),lt=w.useCallback(function(){A||(Aq()?setTimeout(ft,0):ft())},[A,ft]),xe=function(Q){return r?null:Q},Oe=function(Q){return B?null:xe(Q)},_t=function(Q){return R?null:xe(Q)},Dt=function(Q){D&&Q.stopPropagation()},Yt=w.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Q=ye.refKey,Z=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,Vt=Ad(ye,$q);return zt(zt(ug({onKeyDown:Oe(er(ce,ze)),onFocus:Oe(er(he,qe)),onBlur:Oe(er(Le,ke)),onClick:xe(er(He,lt)),onDragEnter:_t(er(Ce,Re)),onDragOver:_t(er(Fe,Ee)),onDragLeave:_t(er(et,Ie)),onDrop:_t(er(Ne,Se)),role:typeof ee=="string"&&ee!==""?ee:"presentation"},Z,I),!r&&!B?{tabIndex:0}:{}),Vt)}},[I,ze,qe,ke,lt,Re,Ee,Ie,Se,B,R,r]),Ht=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,Z=Q===void 0?"ref":Q,ee=ye.onChange,ce=ye.onClick,he=Ad(ye,Iq),Le=ug({accept:_,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(er(ee,Se)),onClick:xe(er(ce,Ht)),tabIndex:-1},Z,$);return zt(zt({},Le),he)}},[$,n,d,Se,r]);return zt(zt({},X),{},{isFocused:L&&!r,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({},dg),{},{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({},dg);default:return e}}function Zk(){}function Wq({value:e,onChange:t,options:n,placeholder:r="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(_=>_.value===e);return M>=0?M:0}),k=w.useRef(null),j=w.useRef(null),C=w.useRef(null),S=n.find(M=>M.value===e),T=(S==null?void 0:S.label)??r,E=w.useCallback(()=>{var M;h(!1),(M=j.current)==null||M.focus()},[]),A=w.useCallback(()=>{const M=j.current;if(!M)return;const _=M.getBoundingClientRect(),P=Math.min(240,n.length*36+16),F=window.innerHeight-_.bottom,W=_.top,I=F<P+16&&W>F?"above":"below";m({left:_.left,top:I==="below"?_.bottom+4:_.top-4,width:_.width,placement:I})},[n.length]);w.useLayoutEffect(()=>{f&&A()},[f,A]),w.useEffect(()=>{if(!f)return;const M=()=>A(),_=()=>A(),P=W=>{var $,q;const I=W.target;($=k.current)!=null&&$.contains(I)||(q=C.current)!=null&&q.contains(I)||h(!1)},F=W=>{W.key==="Escape"&&(W.preventDefault(),E())};return window.addEventListener("scroll",M,!0),window.addEventListener("resize",_),document.addEventListener("mousedown",P),document.addEventListener("keydown",F),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",_),document.removeEventListener("mousedown",P),document.removeEventListener("keydown",F)}},[f,E,A]),w.useEffect(()=>{if(f){const M=n.findIndex(_=>_.value===e);b(M>=0?M:0),requestAnimationFrame(()=>{var _;return(_=C.current)==null?void 0:_.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))},R=M=>{var _;if(M.key==="ArrowDown")M.preventDefault(),b(P=>{var F;for(let W=1;W<=n.length;W++){const I=(P+W)%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 W=1;W<=n.length;W++){const I=(P-W+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(!((_=n[F])!=null&&_.disabled)){P=F;break}P>=0&&b(P)}},D=["v10-select",l,s?"disabled":"",f?"open":""].filter(Boolean).join(" "),H=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:D,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(oO,{className:"v10-select-caret",size:12,"aria-hidden":"true"})]}),f&&g&&V2.createPortal(o.jsxs("ul",{ref:C,className:`v10-select-menu v10-select-menu-${g.placement}`,role:"listbox",tabIndex:-1,onKeyDown:R,style:H,children:[n.length===0&&o.jsx("li",{className:"v10-select-option empty","aria-disabled":"true",children:"No options"}),n.map((M,_)=>o.jsx("li",{role:"option","aria-selected":M.value===e,title:M.label,className:["v10-select-option",M.value===e?"selected":"",_===y?"highlighted":"",M.disabled?"disabled":""].filter(Boolean).join(" "),onMouseEnter:()=>b(_),onMouseDown:P=>P.preventDefault(),onClick:()=>{s||M.disabled||(t(M.value),E())},children:M.label},M.value))]}),document.body)]})}function Yk(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 Yq(e){const[t,n]=w.useState(!1),[r,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 C,S;if(m.key==="Tab"){n(!1);return}if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;m.preventDefault();const y=Array.from(((C=d.current)==null?void 0:C.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(pO,{"aria-hidden":"true",size:14})}),t&&o.jsxs("div",{ref:d,className:`v10-agent-tab-menu-popover${r?" 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 GN(e,t){return(t==null?void 0:t.trim())||`integration:${e}`}function Rd(e){const t=e.sessionId??e.defaultSessionId??eo(e.integrationId);return{integrationId:e.integrationId,sessionId:t,stateKey:GN(e.integrationId,t)}}function VN(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 WN(e){var n;if(e.selectedSessionId==null)return!1;const t=e.integrations.find(r=>r.id===e.integrationId);return!(((n=VN(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 Kq(e){return WN(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 Kk(e,t){const n=e.flatMap(r=>{var d;const s=VN(r.session,t);if(!s)return[];const l=r.messages.find(f=>f.author==="user"),u=r.messages[r.messages.length-1];return[{sessionId:r.session,integrationId:s.id,integrationName:s.name,preview:((d=l==null?void 0:l.text)==null?void 0:d.slice(0,60))||r.session,messageCount:r.messages.length,lastTs:u==null?void 0:u.ts}]});return n.sort((r,s)=>{const l=Date.parse(r.lastTs??""),u=Date.parse(s.lastTs??"");return Number.isFinite(l)&&Number.isFinite(u)?u-l:String(s.lastTs??"").localeCompare(String(r.lastTs??""))}),n}function ZN(e,t,n,r,s){var u;const l=Rd({integrationId:e,sessionId:t,defaultSessionId:s});return(((u=n[l.stateKey])==null?void 0:u.length)??0)>0||(l.sessionId?r.some(d=>d.sessionId===l.sessionId):!1)}function YN(e,t,n){const r=GN(e,null);return Object.entries(t).some(([s,l])=>l.length>0&&(s===r||s.startsWith(`${e}:`)))||n.some(s=>s.integrationId===e)}function Xq(e){const t=[...e.integrations].sort(Jd),n=t.filter(d=>d.persistentChat),r=t.find(d=>d.id===e.selectedIntegrationId)??n[0]??null,s=r?Rd({integrationId:r.id,sessionId:e.selectedSessionId,defaultSessionId:r.defaultSessionId}):null,l=r?ZN(r.id,e.selectedSessionId,e.localMessagesByConversation,e.sessions,r.defaultSessionId):!1,u=r?YN(r.id,e.localMessagesByConversation,e.sessions):!1;return{sortedIntegrations:t,connectedIntegrations:n,selectedIntegration:r,selectedConversation:s,selectedHasConversation:l,selectedIntegrationHasAnyConversation:u}}function Jq(e){const t=e.selectedIntegration,n=!!(t&&!t.persistentChat&&e.selectedHasConversation),r=!!(t&&!t.persistentChat&&e.selectedIntegrationHasAnyConversation),s=r?[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:r,visibleAgentTabs:s,showAddFlow:l,shouldShowConversationLoader:u}}function Jd(e,t){const n=e.id==="openclaw"?0:1,r=t.id==="openclaw"?0:1;return n!==r?n-r: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(Jd)}function eG(e,t){const n=e.find(u=>u.id===t);if(!n)return e;const r=n.connectSupported,s=r?"available":"coming_soon",l=r?"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:r?`${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||ZN(e.selectedIntegrationId,e.selectedSessionId,e.localMessagesByConversation,e.sessionSummaries,t.defaultSessionId)||YN(e.selectedIntegrationId,e.localMessagesByConversation,e.sessionSummaries))}function nG(e){var Q;const{integrations:t,selectedIntegrationId:n,selectedIntegration:r,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:C,localChatEndRef:S,localInput:T,onLocalInputChange:E,onSendLocalMessage:A,onStopLocalStream:B,localSending:R,activeProjectId:D,availableProjects:H,projectsLoading:M,onSelectProject:_,attachments:P,onAddAttachments:F,onRemoveAttachment:W}=e,I=e.selectableProjects??H,$=P,q=$.some(_N),V=[...new Set($.map(Z=>Z.contextGraphId))],X=$.some(Z=>Z.status==="uploading"),L=j.some(Z=>Z.streaming)?"streaming":X?"uploading":"idle",U=$.length>0&&$.some(Z=>Z.contextGraphId!==D),G=w.useRef(null),O=w.useRef(null),[ne,ue]=w.useState(null),le=w.useCallback(Z=>{O.current=Z,ue(Z)},[]),[be,Re]=w.useState(!1),Ee=w.useCallback(()=>{const Z=O.current;if(!Z)return;const ee=Z.scrollHeight-Z.scrollTop-Z.clientHeight;Re(ee>40)},[]),Ie=w.useCallback(()=>{const Z=O.current;Z&&Z.scrollTo({top:Z.scrollHeight,behavior:"smooth"})},[]);w.useEffect(()=>{const Z=O.current;if(!Z)return;const ee=requestAnimationFrame(()=>{const ce=Z.scrollHeight-Z.scrollTop-Z.clientHeight;Re(ce>40)});return()=>cancelAnimationFrame(ee)},[n,s,j.length]),w.useEffect(()=>{if(!ne||typeof MutationObserver>"u")return;const Z=()=>{const ce=ne.scrollHeight-ne.scrollTop-ne.clientHeight;Re(ce>40)};Z();const ee=new MutationObserver(Z);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(Z=>{Se&&F(Z)},[Se,F]),ze=qN({onDrop:ft,noClick:!0,noKeyboard:!0}),qe=[...t].sort(Jd),ke=qe.filter(Z=>Z.persistentChat),lt=qe.filter(Z=>!Z.persistentChat),xe=r,{showingSessionHistory:Oe,showingStoredSessions:_t,visibleAgentTabs:Dt,showAddFlow:Yt,shouldShowConversationLoader:Ht}=Jq({connectedAgents:ke,selectedIntegration:r,selectedIntegrationId:n,selectedHasConversation:l,selectedIntegrationHasAnyConversation:u,localHistoryLoaded:C,localMessagesCount:j.length}),ut=R||!(xe!=null&&xe.chatReady),ye=!ut&&!X&&(T.trim()!==""||q);return o.jsxs("div",{className:"v10-agents-tab",children:[o.jsxs("div",{className:"v10-agent-subtabs",role:"tablist","aria-label":"Integrated agents",children:[Dt.map(Z=>{const ee=(xe==null?void 0:xe.id)===Z.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(Z.id,{preserveSession:WN({integrationId:Z.id,selectedSessionId:s,integrations:t}),sessionId:Z.defaultSessionId}),role:"tab","aria-selected":ee,children:[o.jsx("span",{className:`v10-agents-stat-dot ${Yk(Z)}`}),o.jsx("span",{children:Z.name})]}),ee&&o.jsx(Yq,{integration:Z,statusLabel:Zq(Z,Oe),statusDotClass:Yk(Z),refreshBusy:y===Z.id,canDisconnect:Z.persistentChat,onRefresh:()=>g(Z.id),onDisconnect:()=>h(Z.id)})]},Z.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(Z=>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:Z.name}),o.jsx("div",{className:"v10-local-agent-subtitle",children:Z.description})]}),o.jsx("span",{className:`v10-local-agent-status-pill ${Z.status}`,children:Z.statusLabel})]}),o.jsx("p",{className:"v10-local-agent-copy",children:Z.detail}),Z.error&&o.jsx("div",{className:"v10-local-agent-warning offline",role:"status","data-testid":`local-agent-warning-${Z.id}`,children:Z.error}),Z.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(Z.id),disabled:m===Z.id,children:m===Z.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"})]})]}),Z.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."}),Z.connectSupported&&o.jsx("div",{className:"v10-local-agent-actions",children:o.jsx("button",{className:"v10-agent-send-btn secondary",onClick:()=>f(Z.id),disabled:m===Z.id,children:m===Z.id?"Connecting...":"Connect Hermes"})})]})]},Z.id))]})]}):xe&&o.jsxs("div",{...ze.getRootProps({className:"v10-local-agent-chat-shell"}),children:[o.jsx("input",{...ze.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:_t?`${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.`}),ze.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(AO,{className:"v10-drop-overlay-icon",size:32,"aria-hidden":"true"}):o.jsx(aO,{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 ${ig(H,D)}`: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:[Ht&&o.jsx("div",{className:"v10-agent-empty-state",children:"Loading the latest conversation from DKG memory..."}),!Ht&&j.length===0&&(()=>{const Z=Oe?{title:"No turns in this session yet.",hint:`Reconnect ${xe.name} from the + tab to start a new live thread.`}:_t?{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:Z.title}),o.jsx("div",{className:"v10-agent-empty-state-hint",children:Z.hint})]})})(),j.map(Z=>o.jsxs("div",{className:`v10-chat-msg ${Z.role}`,children:[o.jsx("div",{className:`v10-chat-bubble ${Z.role}`,children:R7(Z.content,Z.role,!!Z.synthesized,!!Z.streaming,Z.failureNotice)}),Z.attachments&&Z.attachments.length>0&&o.jsx("div",{className:"v10-local-agent-attachment-row",style:{display:"flex",flexWrap:"wrap",gap:6,marginTop:6},children:Z.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))}),Z.ts&&o.jsx("time",{className:`v10-local-agent-msg-time ${Z.role}`,dateTime:Z.tsRaw,children:Z.ts})]},Z.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(J_,{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(Z=>{var he,Le;const ee=((he=Z.result)==null?void 0:he.extraction.tripleCount)??((Le=Z.result)==null?void 0:Le.extraction.triplesWritten),ce=Z.status==="queued"?"Queued":Z.status==="uploading"?"Importing…":Z.status==="completed"?ee!=null?`Ready · ${ee} triples`:"Ready":Z.status==="skipped"?"Stored only":Z.error??"Failed";return o.jsxs("div",{className:"v10-attachment-chip","data-status":Z.status,role:"listitem",children:[o.jsx("div",{className:"v10-attachment-chip-badge","aria-hidden":"true",children:m7(Z.file.name)}),o.jsxs("div",{className:"v10-attachment-chip-body",children:[o.jsx("div",{className:"v10-attachment-chip-name",title:Z.file.name,children:Z.file.name}),o.jsxs("div",{className:"v10-attachment-chip-meta",children:[o.jsx("span",{children:h7(Z.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:()=>W(Z.id),disabled:R,"aria-label":`Remove ${Z.file.name}`,title:"Remove attachment",children:o.jsx(zO,{size:12,"aria-hidden":"true"})})]},Z.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 (${ig(H,V[0])}), not the active project.`}),o.jsx("input",{ref:G,type:"file",multiple:!0,style:{display:"none"},onChange:Z=>{Z.target.files&&(F(Z.target.files),Z.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:Z=>E(Z.target.value),onKeyDown:Z=>{if(!Z.nativeEvent.isComposing){if(Z.key==="Enter"&&!Z.shiftKey&&!Z.ctrlKey&&!Z.metaKey){Z.preventDefault(),ye&&A();return}if((Z.ctrlKey||Z.metaKey)&&Z.key==="Enter"){Z.preventDefault(),ye&&A();return}Z.key==="Escape"&&T.length>0&&(Z.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 Z;return(Z=G.current)==null?void 0:Z.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(kO,{size:14,"aria-hidden":"true"})}),o.jsx("div",{className:"v10-composer-target",children:o.jsx(Wq,{className:"v10-local-agent-target-select",value:D??"",onChange:_,options:[...D?[{value:"",label:"No context graph (clear selection)"}]:[],...I.map(Z=>({value:Z.id,label:Z.name}))],placeholder:M?"Loading context graphs…":"Choose a context graph",disabled:M||!D&&I.length===0,ariaLabel:"Active project",prefixIcon:o.jsx(hO,{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(CO,{size:12,"aria-hidden":"true"}):L==="uploading"?o.jsx(yO,{className:"v10-local-agent-inline-send-spinner",size:14,"aria-hidden":"true"}):o.jsx(tO,{size:14,"aria-hidden":"true"})})]})]})})]})})]})]})}function bm(e){return e.length>12?e.slice(-8):e}function aG(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 rG(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 r=new Map;for(const g of e){if(!g.peerId)continue;const m=r.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;r.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 r){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(C=>C.connectionStatus==="connected");if(y.length===0)continue;const b=y.some(C=>C.connectionTransport==="direct"),k=y.some(C=>C.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),r=w.useId(),s=3,l=e.connected?"connected":"offline",u=((g=e.name)==null?void 0:g.trim())||bm(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:bm(e.peerId)}),e.connected&&e.openedAt!=null&&o.jsxs("span",{children:["up ",Sk(Date.now()-e.openedAt)]}),!e.connected&&e.lastSeen!=null&&o.jsxs("span",{children:[Sk(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:r,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:aG(m.agentUri)||bm(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":r,onClick:()=>n(m=>!m),children:t?"Show less":`+${e.agents.length-s} more`})})]})]})}function Qk(e){const{label:t,peers:n,expanded:r,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":r,children:[o.jsx(Nm,{size:14,className:`v10-peer-group-chevron ${r?"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})]}),r&&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:r,onRefresh:s}=e,[l,u]=w.useState(!0),[d,f]=w.useState(!1),{connected:h,recentlySeen:g,directCount:m,relayedCount:y}=rG(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"})]}),r&&o.jsx("p",{className:"v10-agents-loading",children:"Loading peers..."}),!r&&h.length===0&&g.length===0&&n.total===0&&o.jsx("div",{className:"v10-agent-empty-state",children:"No network peers detected yet."}),!r&&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(Qk,{label:"Connected",peers:h,expanded:l,onToggle:()=>u(b=>!b),emptyMessage:"No peers currently connected."}),o.jsx(Qk,{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(r=>o.jsxs("button",{className:"v10-session-item",onClick:()=>n(r),children:[o.jsxs("span",{className:"v10-session-preview",children:[r.integrationName,": ",r.preview]}),o.jsxs("span",{className:"v10-session-count",children:[r.messageCount," msg",r.messageCount!==1?"s":"",r.lastTs?` - ${Nd(r.lastTs)}`:""]})]},r.sessionId))]})})}function lG(){return $d().data}function cG(){const{stage:e,advance:t}=Ug(),[n,r]=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,C]=w.useState("openclaw"),[S,T]=w.useState(()=>eo("openclaw")),[E,A]=w.useState(null),[B,R]=w.useState(null),[D,H]=w.useState(null),[M,_]=w.useState(null),[P,F]=w.useState({}),[W,I]=w.useState({}),[$,q]=w.useState({}),[V,X]=w.useState({}),[K,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")),Re=Ta(ge=>ge.contextGraphs),Ee=Ta(ge=>ge.loading),Ie=Ta(ge=>ge.activeProjectId),We=Ta(ge=>ge.setActiveProject),Se=w.useMemo(()=>a4(Re,y?qg(y):null,Ie),[Re,y,Ie]),ft=Kk(s,b),{selectedIntegration:ze,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]??[]:[],_t=xe?V[xe]??!1:!1,Dt=xe?W[xe]??"":"",Yt=xe?$[xe]??!1:!1,Ht=xe?K[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}))},[]),Z=w.useCallback((ge,Me)=>{q(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((K[ge]??[]).map(Ye=>`${Ye.contextGraphId}:${Ye.file.name}:${Ye.file.size}:${Ye.file.lastModified}`)),tt=je.filter(Ye=>{const pt=`${de}:${Ye.name}:${Ye.size}:${Ye.lastModified}`;return Te.has(pt)?!1:(Te.add(pt),!0)});if(tt.length===0)return;const Je=tt.map(Ye=>({id:`${ge}:${Ye.name}:${Ye.size}:${Ye.lastModified}:${crypto.randomUUID()}`,file:Ye,contextGraphId:de,assertionName:`${Date.now().toString(36)}-${crypto.randomUUID().slice(0,8)}-${Ye.name.replace(/[^a-zA-Z0-9._-]/g,"_")}`,status:"queued"}));ee(ge,Ye=>[...Ye,...Je])},[K,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 OS(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,Ye=>Ye.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(Ye=>Ye.id===je.id?tt:Ye))}}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={})=>{C(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([Ng().catch(()=>({agents:[]})),lR().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=Kk(ne.current,ge),de=[...ge].sort(Jd).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 Ye=de[0];Ye&&!G.current&&je!==Xi?(G.current=!0,Ce(Ye.id,{sessionId:Ye.defaultSessionId}),r("agents")):!Ye&&!Je&&(G.current=!1,Ce(Xi))}catch{}},[Ce]),Vt=w.useCallback(async(ge,Me=null,de=null)=>{const je=Rd({integrationId:ge,sessionId:Me,defaultSessionId:de});X(Te=>({...Te,[je.stateKey]:!1}));try{const tt=(await Gx(ge,100,{sessionId:je.sessionId??void 0})).map(Je=>jk(Je,ge));ye(je.stateKey,Je=>Ck(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)Vt(ge,eo(ge))},[]);const At=w.useCallback(()=>{Fe(),et()},[Fe,et]);Xl(At,15e3,{runImmediately:!1});const Ha=b.some(ge=>ge.persistentChat&&(!ge.chatReady||ge.status==="connecting"))?3e3:15e3;w.useEffect(()=>{const ge=setInterval(()=>{Ne()},Ha);return()=>clearInterval(ge)},[Ha,Ne]),w.useEffect(()=>{if(!(ze!=null&&ze.chatSupported)||!ze.persistentChat&&!ke){xe&&X(Me=>({...Me,[xe]:!1}));return}let ge=!1;return(async()=>await Vt(ze.id,(qe==null?void 0:qe.sessionId)??null,ze.defaultSessionId??null))(),()=>{ge=!0}},[Vt,qe==null?void 0:qe.sessionId,xe,ke,ze==null?void 0:ze.defaultSessionId,ze==null?void 0:ze.chatSupported,ze==null?void 0:ze.id,ze==null?void 0:ze.persistentChat]);const ua=w.useCallback(async()=>{const ge=ze,Me=qe,de=Dt.trim(),je=Ht,Te=je.some(_N);if(!(ge!=null&&ge.chatSupported)||!ge.chatReady||Yt||!Me||!de&&!Te)return;const tt=ge.id,Je=Me.stateKey;Z(Je,!0),H(null);let Ye=null,pt="",hn="",qt="",cn="",ur=[],dr=[],ps=[];try{dr=await he(Je,je);const Zn=dr.map(en=>y7(en)).filter(en=>en!=null),pa=b7(dr);if(!de&&Zn.length===0&&pa.results.length===0)return;hn=crypto.randomUUID();const Oa=LN(pa.results),Gr=[de,Oa].filter(en=>en.length>0).join(`
1660
+
1661
+ `);qt=de?Gr:x7(Zn,pa.results);const mn=de?Gr:"";ur=Zn,ps=[...Zn.map(en=>en.id).filter(en=>typeof en=="string"&&en.length>0),...pa.deliveredDraftIds];const pr=`local:${Je}:${hn}:user`;pt=`local:${Je}:${hn}:assistant`;const fa=new Date,Ot=Nd(fa),jo=rg(fa);ye(Je,en=>[...en,{id:pr,turnId:hn,role:"user",content:qt,ts:Ot,tsRaw:jo,attachments:Zn},{id:pt,turnId:hn,role:"assistant",content:"",ts:Ot,tsRaw:jo,streaming:!0}]),Q(Je,""),ps.length>0&&He(Je,ps),Ye=new AbortController,U.current.set(Je,Ye);const sc=[...w7(Re,Ie,y)],ha=await KR(tt,mn,{correlationId:hn,signal:Ye==null?void 0:Ye.signal,sessionId:Me.sessionId??void 0,profile:ge.profile,persistUserMessage:mn?void 0:qt,attachments:Zn,attachmentImportResults:pa.results,contextEntries:sc,contextGraphId:Ie??void 0,onEvent:en=>{en.type==="text_delta"&&(cn+=en.delta,ye(Je,ma=>ma.map(Ga=>Ga.id===pt?{...Ga,content:Ga.content+en.delta}:Ga)))}}),fr=new Date;ye(Je,en=>Nk(en,hn,ha.turnId).map(ma=>{var Ga;return ma.id===pt?{...ma,content:ha.text||ma.content,turnId:((Ga=ha.turnId)==null?void 0:Ga.trim())||ma.turnId,streaming:!1,synthesized:!ha.text&&!ma.content?!0:ma.synthesized,ts:Nd(fr),tsRaw:rg(fr)}:ma})),Fe(),e===0&&t()}catch(Zn){const pa=(Zn==null?void 0:Zn.name)==="AbortError",Oa=pa?"Request cancelled.":C7(ge,Zn),Gr=pa?Oa:`Error: ${Oa}`;pt&&ye(Je,mn=>mn.map(Nn=>Nn.id===pt?{...Nn,content:cn,failureNotice:Gr,streaming:!1,synthesized:!cn}:Nn)),!pa&&tt==="hermes"&&pt&&qt&&(async()=>{try{const mn=await YR(tt,{sessionId:Me.sessionId??void 0,correlationId:hn||void 0,userMessage:qt,assistantReply:cn,failureReason:Oa,profile:ge.profile,attachments:ur,contextGraphId:Ie??void 0});mn.turnId&&ye(Je,Nn=>Nk(Nn,hn,mn.turnId)),Fe()}catch{}})(),ps.length>0&&dr.length>0&&L(mn=>{const Nn=mn[Je]??[],pr=new Set(Nn.map(Ot=>Ot.id)),fa=dr.filter(Ot=>!pr.has(Ot.id));return fa.length===0?mn:{...mn,[Je]:[...fa,...Nn]}}),Ne()}finally{Z(Je,!1),U.current.get(Je)===Ye&&U.current.delete(Je)}},[Ie,t,Re,y,Fe,Dt,Yt,he,Ht,Ne,qe,ze,He,Q,Z,e,ye]),Fr=w.useCallback(()=>{if(!xe)return;const ge=U.current.get(xe);ge==null||ge.abort()},[xe]),Hr=w.useCallback(async ge=>{A(ge),H(null),R(null);try{const Me=await GR(ge);k(Te=>nd(Te,Me.integration)),await Ne();const de=nd(b,Me.integration),je=Kq({integrationId:ge,selectedSessionId:S,integrations:de});Ce(ge,{preserveSession:je,sessionId:Me.integration.defaultSessionId}),G.current=!0,R(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.`)),r("agents")}catch(Me){await Ne(),H(Me.message)}finally{A(null)}},[b,Ne,S,Ce]),da=w.useCallback(async ge=>{H(null),R(null);try{await VR(ge),k(Me=>eG(Me,ge)),G.current=!1,Ce(ge,{preserveSession:j===ge}),R("The local agent was disconnected from this node. Session history remains available here."),r("agents"),await Ne()}catch(Me){H(Me.message)}},[Ne,j,Ce]),qa=w.useCallback(async ge=>{var Te,tt,Je;if(M===ge)return;_(ge),H(null),R(null);const Me=Rd({integrationId:ge,sessionId:j===ge?be.current:null,defaultSessionId:(Te=b.find(Ye=>Ye.id===ge))==null?void 0:Te.defaultSessionId}),[de,je]=await Promise.allSettled([WR(ge),Gx(ge,100,{sessionId:Me.sessionId??void 0})]);try{if(de.status==="fulfilled"?(k(Ye=>nd(Ye,de.value.integration)),de.value.notice&&R(de.value.notice)):H(((tt=de.reason)==null?void 0:tt.message)??"Failed to refresh integration."),je.status==="fulfilled"){const Ye=je.value.map(pt=>jk(pt,ge));ye(Me.stateKey,pt=>Ck(pt,Ye)),X(pt=>({...pt,[Me.stateKey]:!0}))}else de.status==="fulfilled"&&H(((Je=je.reason)==null?void 0:Je.message)??"Failed to refresh conversation.")}finally{_(null)}},[b,M,j,ye]),cr=w.useCallback(ge=>{Ce(ge.integrationId,{sessionId:ge.sessionId}),r("agents")},[Ce]),ic=w.useCallback(ge=>{We(ge||null)},[We]),qr=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:()=>r("agents"),children:"Agents"}),o.jsx("button",{className:`v10-agent-mode-tab ${n==="network"?"active":""}`,onClick:()=>r("network"),children:"Network"}),o.jsx("button",{className:`v10-agent-mode-tab ${n==="sessions"?"active":""}`,onClick:()=>r("sessions"),children:"Sessions"})]}),n==="agents"&&o.jsx(nG,{integrations:b,selectedIntegrationId:j,selectedIntegration:ze,selectedSessionId:S,selectedHasConversation:ke,selectedIntegrationHasAnyConversation:lt,onSelectIntegration:Ce,onConnectIntegration:Hr,onDisconnectIntegration:da,onRefreshIntegration:qa,connectBusyId:E,refreshBusyId:M,connectNotice:B,connectError:D,localMessages:Oe,localHistoryLoaded:_t,localChatEndRef:O,localInput:Dt,onLocalInputChange:ge=>Q(xe,ge),onSendLocalMessage:ua,onStopLocalStream:Fr,localSending:Yt,activeProjectId:Ie,availableProjects:Re,selectableProjects:Se,projectsLoading:Ee,onSelectProject:ic,attachments:Ht,onAddAttachments:qr,onRemoveAttachment:Ci}),n==="network"&&o.jsx(sG,{peerAgents:u,connections:f,loading:g,onRefresh:et}),n==="sessions"&&o.jsx(oG,{sessions:ft,onOpenSession:cr})]})}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}=Gn();w.useEffect(()=>{const r=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",r),()=>window.removeEventListener("keydown",r)},[e,t,n])}const Xk={"/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}=Fa(),t=mg(),n=pn(s=>s.openTab),r=pn(s=>s.activeTabId);w.useEffect(()=>{const s=Xk[e];s&&n({id:s.id,label:s.label,closable:!0})},[e,n]),w.useEffect(()=>{const s=pG[r];if(s){s!==e&&t(s,{replace:!0});return}Xk[e]&&t("/",{replace:!0})},[r,e,t])}function hG(){const[e,t]=w.useState(f_());return w.useEffect(()=>h_(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=kg(t=>t.setNodeStatus);Xl(()=>{An.fetchStatus().then(e).catch(()=>{})},1e4)}function Jk(e){const t=w.useRef(null),n=w.useRef(e);return n.current=e,w.useEffect(()=>{const r=t.current;if(!r)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="",r.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",r.classList.add("active")};return r.addEventListener("mousedown",d),()=>r.removeEventListener("mousedown",d)},[]),t}function gG(e){const t=w.useRef(e);t.current=e;const[n,r]=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=>r(s),[])}function vG(){mG(),dG(),fG();const{leftCollapsed:e,rightCollapsed:t,bottomCollapsed:n,theme:r,leftWidth:s,rightWidth:l,setLeftWidth:u,setRightWidth:d,setBottomHeight:f}=Gn(),[,h]=w.useState(0);w.useEffect(()=>{uG(r)},[r]),w.useEffect(()=>{const C=()=>h(S=>S+1);return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]),w.useLayoutEffect(()=>{const C=window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("resize"))});return()=>window.cancelAnimationFrame(C)},[e,t]);const g=w.useCallback(C=>{const S=Gn.getState().leftWidth;u(Math.max(140,Math.min(400,S+C)))},[u]),m=w.useCallback(C=>{const S=Gn.getState().rightWidth;d(Math.max(200,Math.min(500,S-C)))},[d]),y=w.useCallback(C=>{const S=Math.min(Gn.getState().bottomHeight,sd());f(Math.min(S-C,sd()))},[f]),b=Jk(g),k=Jk(m),j=gG(y);return o.jsxs("div",{className:"v10-app",children:[o.jsx(hG,{}),o.jsx(yL,{}),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(()=>Aa(()=>import("./Network-DpAKVzwi.js"),[]).then(e=>({default:e.NetworkPage})));function bG(){const e=pn(t=>t.openTab);return w.useLayoutEffect(()=>{e(Sj)},[e]),o.jsx(El,{to:"/",replace:!0})}function xG(){return o.jsxs(p2,{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,{})})]})}hA.createRoot(document.getElementById("root")).render(o.jsx(Ve.StrictMode,{children:o.jsx(D2,{basename:"/ui",children:o.jsx(xG,{})})}));export{JG as $,XM as A,YG as B,iO as C,VG as D,on as E,WG as F,qG as G,Cn as H,HG as I,GG as J,zG as K,yS as L,Cg as M,ZG as N,$G as O,cG as P,zg as Q,Ve as R,Hd as S,k5 as T,nV as U,m1 as V,LO as W,W4 as X,Z4 as Y,DO as Z,Aa as _,es as a,l4 as a0,$O as a1,SG as a2,Wl as a3,$_ as a4,P_ as a5,C5 as a6,PS as a7,OG as a8,LG as a9,ls as aA,kg as aB,cD as aC,oa as aD,Wg as aE,Ji as aF,FS as aG,HS as aH,Pl as aI,bM as aJ,Ur as aK,Ta as aL,pn as aM,tV as aN,m5 as aO,U_ as aa,XG as ab,eV as ac,o as ad,_G as ae,AG as af,iR as ag,GS as ah,Tm as ai,CG as aj,rR as ak,NG as al,TG as am,L_ as an,EG as ao,w as ap,g1 as aq,KG as ar,u5 as as,N5 as at,yv as au,QG as av,Zs as aw,DG as ax,IG as ay,CM as az,xj as b,oO as c,uO as d,yO as e,yj as f,Et as g,Bt as h,mk as i,Cm as j,kG as k,ln as l,jG as m,MG as n,Kx as o,Ng as p,lR as q,BG as r,FG as s,dR as t,PG as u,RG as v,fR as w,UG as x,pR as y,od as z};