@origintrail-official/dkg-node-ui 10.0.11 → 10.0.13

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 (37) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +50 -50
  3. package/dist/chain-cursor-stores.js +6 -6
  4. package/dist/chat-memory.js +209 -209
  5. package/dist/db.js +955 -955
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +3 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/telemetry.d.ts +56 -0
  11. package/dist/telemetry.d.ts.map +1 -1
  12. package/dist/telemetry.js +96 -6
  13. package/dist/telemetry.js.map +1 -1
  14. package/dist-ui/assets/{3d-force-graph-Bl6v-uII.js → 3d-force-graph-C9KowW4u.js} +1 -1
  15. package/dist-ui/assets/{AgentHub-D2vaQxlw.js → AgentHub-BVrcom9_.js} +1 -1
  16. package/dist-ui/assets/{AgentProfilePage-BgSTdsjD.js → AgentProfilePage-C9XaTt7j.js} +1 -1
  17. package/dist-ui/assets/{ApproveWalletsModal-D0Ub_eiD.js → ApproveWalletsModal-BdR2mshx.js} +3 -3
  18. package/dist-ui/assets/{ConvictionDetailView-CieVypna.js → ConvictionDetailView-cao48GL1.js} +1 -1
  19. package/dist-ui/assets/{Network-DKw_XEGi.js → Network-B3jCYzr5.js} +1 -1
  20. package/dist-ui/assets/{OnChainProvenanceCard-Dn_IEP7Q.js → OnChainProvenanceCard-DboMX4Aq.js} +1 -1
  21. package/dist-ui/assets/{Operations-BO2C3UWB.js → Operations-Dg1gfLXv.js} +1 -1
  22. package/dist-ui/assets/{PublishingConviction-xKRNHbzk.js → PublishingConviction-Byp6t69e.js} +1 -1
  23. package/dist-ui/assets/{Settings-DC_d9STV.js → Settings-CxI0SKeV.js} +1 -1
  24. package/dist-ui/assets/{ccip-zWfeQL8Q.js → ccip-wJ3OMRuz.js} +1 -1
  25. package/dist-ui/assets/{index-CwRQnNYh.js → index-5DS6xjw0.js} +3 -3
  26. package/dist-ui/assets/index-DOjsv0r7.css +1 -0
  27. package/dist-ui/assets/index-KoAnx9JE.js +1661 -0
  28. package/dist-ui/assets/{jsonld-B67IUHNU-C3ydusi_.js → jsonld-32FQRO67-CDirPi8u.js} +2 -2
  29. package/dist-ui/assets/{jsonld-G-CM-8JR.js → jsonld-CwHW9UDN.js} +1 -1
  30. package/dist-ui/assets/{renderer-3d-OSESAPET-ConXqyK6.js → renderer-3d-2EVDZII7-BNXV6iSu.js} +2 -2
  31. package/dist-ui/assets/{shikiHighlighter-C6lRYd1O.js → shikiHighlighter-C-LWPPSu.js} +1 -1
  32. package/dist-ui/index.html +14 -14
  33. package/package.json +4 -3
  34. package/dist-ui/assets/index-DEtfq9qv.css +0 -1
  35. package/dist-ui/assets/index-hrI-Ir4l.js +0 -1661
  36. /package/dist-ui/assets/{ntriples-SF2LFNMC-DH7OofPp.js → ntriples-ZWBY2WET-DH7OofPp.js} +0 -0
  37. /package/dist-ui/assets/{turtle-BXN4L2BY-BzTu0283.js → turtle-JJPK7LJ5-BzTu0283.js} +0 -0
@@ -1,1661 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CwRQnNYh.js","assets/ordinal-DhEzRPdO.js","assets/OnChainProvenanceCard-Dn_IEP7Q.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/Operations-BO2C3UWB.js","assets/PublishingConviction-xKRNHbzk.js","assets/ApproveWalletsModal-D0Ub_eiD.js","assets/ConvictionDetailView-CieVypna.js"])))=>i.map(i=>d[i]);
2
- var iT=Object.defineProperty;var sT=(e,t,n)=>t in e?iT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var jn=(e,t,n)=>sT(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function a(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();var AG=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 TG(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function a(){return this instanceof a?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}),n}var oh={exports:{}},pl={};/**
3
- * @license React
4
- * react-jsx-runtime.production.js
5
- *
6
- * Copyright (c) Meta Platforms, Inc. and affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var xx;function oT(){if(xx)return pl;xx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,s,l){var u=null;if(l!==void 0&&(u=""+l),s.key!==void 0&&(u=""+s.key),"key"in s){l={};for(var d in s)d!=="key"&&(l[d]=s[d])}else l=s;return s=l.ref,{$$typeof:e,type:a,key:u,ref:s!==void 0?s:null,props:l}}return pl.Fragment=t,pl.jsx=n,pl.jsxs=n,pl}var wx;function lT(){return wx||(wx=1,oh.exports=oT()),oh.exports}var o=lT(),lh={exports:{}},Ge={};/**
11
- * @license React
12
- * react.production.js
13
- *
14
- * Copyright (c) Meta Platforms, Inc. and affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var kx;function cT(){if(kx)return Ge;kx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function b(P){return P===null||typeof P!="object"?null:(P=y&&P[y]||P["@@iterator"],typeof P=="function"?P:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function S(P,G,O){this.props=P,this.context=G,this.refs=N,this.updater=O||k}S.prototype.isReactComponent={},S.prototype.setState=function(P,G){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,G,"setState")},S.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function A(){}A.prototype=S.prototype;function E(P,G,O){this.props=P,this.context=G,this.refs=N,this.updater=O||k}var T=E.prototype=new A;T.constructor=E,j(T,S.prototype),T.isPureReactComponent=!0;var U=Array.isArray;function _(){}var z={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function D(P,G,O){var ne=O.ref;return{$$typeof:e,type:P,key:G,ref:ne!==void 0?ne:null,props:O}}function R(P,G){return D(P.type,G,P.props)}function $(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function F(P){var G={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(O){return G[O]})}var K=/\/+/g;function I(P,G){return typeof P=="object"&&P!==null&&P.key!=null?F(""+P.key):G.toString(36)}function H(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(_,_):(P.status="pending",P.then(function(G){P.status==="pending"&&(P.status="fulfilled",P.value=G)},function(G){P.status==="pending"&&(P.status="rejected",P.reason=G)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function B(P,G,O,ne,ue){var le=typeof P;(le==="undefined"||le==="boolean")&&(P=null);var be=!1;if(P===null)be=!0;else switch(le){case"bigint":case"string":case"number":be=!0;break;case"object":switch(P.$$typeof){case e:case t:be=!0;break;case g:return be=P._init,B(be(P._payload),G,O,ne,ue)}}if(be)return ue=ue(P),be=ne===""?"."+I(P,0):ne,U(ue)?(O="",be!=null&&(O=be.replace(K,"$&/")+"/"),B(ue,G,O,"",function(Ie){return Ie})):ue!=null&&($(ue)&&(ue=R(ue,O+(ue.key==null||P&&P.key===ue.key?"":(""+ue.key).replace(K,"$&/")+"/")+be)),G.push(ue)),1;be=0;var _e=ne===""?".":ne+":";if(U(P))for(var Ee=0;Ee<P.length;Ee++)ne=P[Ee],le=_e+I(ne,Ee),be+=B(ne,G,O,le,ue);else if(Ee=b(P),typeof Ee=="function")for(P=Ee.call(P),Ee=0;!(ne=P.next()).done;)ne=ne.value,le=_e+I(ne,Ee++),be+=B(ne,G,O,le,ue);else if(le==="object"){if(typeof P.then=="function")return B(H(P),G,O,ne,ue);throw G=String(P),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return be}function W(P,G,O){if(P==null)return P;var ne=[],ue=0;return B(P,ne,"","",function(le){return G.call(O,le,ue++)}),ne}function Q(P){if(P._status===-1){var G=P._result;G=G(),G.then(function(O){(P._status===0||P._status===-1)&&(P._status=1,P._result=O)},function(O){(P._status===0||P._status===-1)&&(P._status=2,P._result=O)}),P._status===-1&&(P._status=0,P._result=G)}if(P._status===1)return P._result.default;throw P._result}var V=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},L={map:W,forEach:function(P,G,O){W(P,function(){G.apply(this,arguments)},O)},count:function(P){var G=0;return W(P,function(){G++}),G},toArray:function(P){return W(P,function(G){return G})||[]},only:function(P){if(!$(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Ge.Activity=m,Ge.Children=L,Ge.Component=S,Ge.Fragment=n,Ge.Profiler=s,Ge.PureComponent=E,Ge.StrictMode=a,Ge.Suspense=f,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(P){return z.H.useMemoCache(P)}},Ge.cache=function(P){return function(){return P.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(P,G,O){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var ne=j({},P.props),ue=P.key;if(G!=null)for(le in G.key!==void 0&&(ue=""+G.key),G)!q.call(G,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&G.ref===void 0||(ne[le]=G[le]);var le=arguments.length-2;if(le===1)ne.children=O;else if(1<le){for(var be=Array(le),_e=0;_e<le;_e++)be[_e]=arguments[_e+2];ne.children=be}return D(P.type,ue,ne)},Ge.createContext=function(P){return P={$$typeof:u,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:l,_context:P},P},Ge.createElement=function(P,G,O){var ne,ue={},le=null;if(G!=null)for(ne in G.key!==void 0&&(le=""+G.key),G)q.call(G,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(ue[ne]=G[ne]);var be=arguments.length-2;if(be===1)ue.children=O;else if(1<be){for(var _e=Array(be),Ee=0;Ee<be;Ee++)_e[Ee]=arguments[Ee+2];ue.children=_e}if(P&&P.defaultProps)for(ne in be=P.defaultProps,be)ue[ne]===void 0&&(ue[ne]=be[ne]);return D(P,le,ue)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(P){return{$$typeof:d,render:P}},Ge.isValidElement=$,Ge.lazy=function(P){return{$$typeof:g,_payload:{_status:-1,_result:P},_init:Q}},Ge.memo=function(P,G){return{$$typeof:h,type:P,compare:G===void 0?null:G}},Ge.startTransition=function(P){var G=z.T,O={};z.T=O;try{var ne=P(),ue=z.S;ue!==null&&ue(O,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(_,V)}catch(le){V(le)}finally{G!==null&&O.types!==null&&(G.types=O.types),z.T=G}},Ge.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ge.use=function(P){return z.H.use(P)},Ge.useActionState=function(P,G,O){return z.H.useActionState(P,G,O)},Ge.useCallback=function(P,G){return z.H.useCallback(P,G)},Ge.useContext=function(P){return z.H.useContext(P)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(P,G){return z.H.useDeferredValue(P,G)},Ge.useEffect=function(P,G){return z.H.useEffect(P,G)},Ge.useEffectEvent=function(P){return z.H.useEffectEvent(P)},Ge.useId=function(){return z.H.useId()},Ge.useImperativeHandle=function(P,G,O){return z.H.useImperativeHandle(P,G,O)},Ge.useInsertionEffect=function(P,G){return z.H.useInsertionEffect(P,G)},Ge.useLayoutEffect=function(P,G){return z.H.useLayoutEffect(P,G)},Ge.useMemo=function(P,G){return z.H.useMemo(P,G)},Ge.useOptimistic=function(P,G){return z.H.useOptimistic(P,G)},Ge.useReducer=function(P,G,O){return z.H.useReducer(P,G,O)},Ge.useRef=function(P){return z.H.useRef(P)},Ge.useState=function(P){return z.H.useState(P)},Ge.useSyncExternalStore=function(P,G,O){return z.H.useSyncExternalStore(P,G,O)},Ge.useTransition=function(){return z.H.useTransition()},Ge.version="19.2.4",Ge}var Sx;function dg(){return Sx||(Sx=1,lh.exports=cT()),lh.exports}var w=dg();const Ve=Wl(w);var ch={exports:{}},fl={},uh={exports:{}},dh={};/**
19
- * @license React
20
- * scheduler.production.js
21
- *
22
- * Copyright (c) Meta Platforms, Inc. and affiliates.
23
- *
24
- * This source code is licensed under the MIT license found in the
25
- * LICENSE file in the root directory of this source tree.
26
- */var jx;function uT(){return jx||(jx=1,(function(e){function t(B,W){var Q=B.length;B.push(W);e:for(;0<Q;){var V=Q-1>>>1,L=B[V];if(0<s(L,W))B[V]=W,B[Q]=L,Q=V;else break e}}function n(B){return B.length===0?null:B[0]}function a(B){if(B.length===0)return null;var W=B[0],Q=B.pop();if(Q!==W){B[0]=Q;e:for(var V=0,L=B.length,P=L>>>1;V<P;){var G=2*(V+1)-1,O=B[G],ne=G+1,ue=B[ne];if(0>s(O,Q))ne<L&&0>s(ue,O)?(B[V]=ue,B[ne]=Q,V=ne):(B[V]=O,B[G]=Q,V=G);else if(ne<L&&0>s(ue,Q))B[V]=ue,B[ne]=Q,V=ne;else break e}}return W}function s(B,W){var Q=B.sortIndex-W.sortIndex;return Q!==0?Q:B.id-W.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var f=[],h=[],g=1,m=null,y=3,b=!1,k=!1,j=!1,N=!1,S=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function T(B){for(var W=n(h);W!==null;){if(W.callback===null)a(h);else if(W.startTime<=B)a(h),W.sortIndex=W.expirationTime,t(f,W);else break;W=n(h)}}function U(B){if(j=!1,T(B),!k)if(n(f)!==null)k=!0,_||(_=!0,F());else{var W=n(h);W!==null&&H(U,W.startTime-B)}}var _=!1,z=-1,q=5,D=-1;function R(){return N?!0:!(e.unstable_now()-D<q)}function $(){if(N=!1,_){var B=e.unstable_now();D=B;var W=!0;try{e:{k=!1,j&&(j=!1,A(z),z=-1),b=!0;var Q=y;try{t:{for(T(B),m=n(f);m!==null&&!(m.expirationTime>B&&R());){var V=m.callback;if(typeof V=="function"){m.callback=null,y=m.priorityLevel;var L=V(m.expirationTime<=B);if(B=e.unstable_now(),typeof L=="function"){m.callback=L,T(B),W=!0;break t}m===n(f)&&a(f),T(B)}else a(f);m=n(f)}if(m!==null)W=!0;else{var P=n(h);P!==null&&H(U,P.startTime-B),W=!1}}break e}finally{m=null,y=Q,b=!1}W=void 0}}finally{W?F():_=!1}}}var F;if(typeof E=="function")F=function(){E($)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,I=K.port2;K.port1.onmessage=$,F=function(){I.postMessage(null)}}else F=function(){S($,0)};function H(B,W){z=S(function(){B(e.unstable_now())},W)}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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(B){switch(y){case 1:case 2:case 3:var W=3;break;default:W=y}var Q=y;y=W;try{return B()}finally{y=Q}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(B,W){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Q=y;y=B;try{return W()}finally{y=Q}},e.unstable_scheduleCallback=function(B,W,Q){var V=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?V+Q:V):Q=V,B){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=Q+L,B={id:g++,callback:W,priorityLevel:B,startTime:Q,expirationTime:L,sortIndex:-1},Q>V?(B.sortIndex=Q,t(h,B),n(f)===null&&B===n(h)&&(j?(A(z),z=-1):j=!0,H(U,Q-V))):(B.sortIndex=L,t(f,B),k||b||(k=!0,_||(_=!0,F()))),B},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(B){var W=y;return function(){var Q=y;y=W;try{return B.apply(this,arguments)}finally{y=Q}}}})(dh)),dh}var Cx;function dT(){return Cx||(Cx=1,uh.exports=uT()),uh.exports}var ph={exports:{}},En={};/**
27
- * @license React
28
- * react-dom.production.js
29
- *
30
- * Copyright (c) Meta Platforms, Inc. and affiliates.
31
- *
32
- * This source code is licensed under the MIT license found in the
33
- * LICENSE file in the root directory of this source tree.
34
- */var Nx;function pT(){if(Nx)return En;Nx=1;var e=dg();function t(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function l(f,h,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:m==null?null:""+m,children:f,containerInfo:h,implementation:g}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,h){if(f==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return En.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,En.createPortal=function(f,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return l(f,h,null,g)},En.flushSync=function(f){var h=u.T,g=a.p;try{if(u.T=null,a.p=2,f)return f()}finally{u.T=h,a.p=g,a.d.f()}},En.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,a.d.C(f,h))},En.prefetchDNS=function(f){typeof f=="string"&&a.d.D(f)},En.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var g=h.as,m=d(g,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?a.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:b}):g==="script"&&a.d.X(f,{crossOrigin:m,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},En.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=d(h.as,h.crossOrigin);a.d.M(f,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(f)},En.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,m=d(g,h.crossOrigin);a.d.L(f,g,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},En.preloadModule=function(f,h){if(typeof f=="string")if(h){var g=d(h.as,h.crossOrigin);a.d.m(f,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(f)},En.requestFormReset=function(f){a.d.r(f)},En.unstable_batchedUpdates=function(f,h){return f(h)},En.useFormState=function(f,h,g){return u.H.useFormState(f,h,g)},En.useFormStatus=function(){return u.H.useHostTransitionStatus()},En.version="19.2.4",En}var Ex;function eS(){if(Ex)return ph.exports;Ex=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ph.exports=pT(),ph.exports}/**
35
- * @license React
36
- * react-dom-client.production.js
37
- *
38
- * Copyright (c) Meta Platforms, Inc. and affiliates.
39
- *
40
- * This source code is licensed under the MIT license found in the
41
- * LICENSE file in the root directory of this source tree.
42
- */var Ax;function fT(){if(Ax)return fl;Ax=1;var e=dT(),t=dg(),n=eS();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)i+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var i=r,c=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(c=i.return),r=i.return;while(r)}return i.tag===3?c:null}function u(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function d(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(l(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=l(r),i===null)throw Error(a(188));return i!==r?null:r}for(var c=r,p=i;;){var v=c.return;if(v===null)break;var x=v.alternate;if(x===null){if(p=v.return,p!==null){c=p;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===c)return f(v),r;if(x===p)return f(v),i;x=x.sibling}throw Error(a(188))}if(c.return!==p.return)c=v,p=x;else{for(var C=!1,M=v.child;M;){if(M===c){C=!0,c=v,p=x;break}if(M===p){C=!0,p=v,c=x;break}M=M.sibling}if(!C){for(M=x.child;M;){if(M===c){C=!0,c=x,p=v;break}if(M===p){C=!0,p=x,c=v;break}M=M.sibling}if(!C)throw Error(a(189))}}if(c.alternate!==p)throw Error(a(190))}if(c.tag!==3)throw Error(a(188));return c.stateNode.current===c?r:i}function g(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=g(r),i!==null)return i;r=r.sibling}return null}var m=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),E=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function F(r){return r===null||typeof r!="object"?null:(r=$&&r[$]||r["@@iterator"],typeof r=="function"?r:null)}var K=Symbol.for("react.client.reference");function I(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===K?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case j:return"Fragment";case S:return"Profiler";case N:return"StrictMode";case U:return"Suspense";case _:return"SuspenseList";case D:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case k:return"Portal";case E:return r.displayName||"Context";case A:return(r._context.displayName||"Context")+".Consumer";case T:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case z:return i=r.displayName||null,i!==null?i:I(r.type)||"Memo";case q:i=r._payload,r=r._init;try{return I(r(i))}catch{}}return null}var H=Array.isArray,B=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},V=[],L=-1;function P(r){return{current:r}}function G(r){0>L||(r.current=V[L],V[L]=null,L--)}function O(r,i){L++,V[L]=r.current,r.current=i}var ne=P(null),ue=P(null),le=P(null),be=P(null);function _e(r,i){switch(O(le,i),O(ue,r),O(ne,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?H0(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=H0(i),r=q0(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}G(ne),O(ne,r)}function Ee(){G(ne),G(ue),G(le)}function Ie(r){r.memoizedState!==null&&O(be,r);var i=ne.current,c=q0(i,r.type);i!==c&&(O(ue,r),O(ne,c))}function We(r){ue.current===r&&(G(ne),G(ue)),be.current===r&&(G(be),ll._currentValue=Q)}var Se,ft;function De(r){if(Se===void 0)try{throw Error()}catch(c){var i=c.stack.trim().match(/\n( *(at )?)/);Se=i&&i[1]||"",ft=-1<c.stack.indexOf(`
43
- at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
44
- `+Se+r+ft}var qe=!1;function ke(r,i){if(!r||qe)return"";qe=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(i){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(oe){var se=oe}Reflect.construct(r,[],me)}else{try{me.call()}catch(oe){se=oe}r.call(me.prototype)}}else{try{throw Error()}catch(oe){se=oe}(me=r())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(oe){if(oe&&se&&typeof oe.stack=="string")return[oe.stack,se.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=p.DetermineComponentFrameRoot(),C=x[0],M=x[1];if(C&&M){var Y=C.split(`
45
- `),ae=M.split(`
46
- `);for(v=p=0;p<Y.length&&!Y[p].includes("DetermineComponentFrameRoot");)p++;for(;v<ae.length&&!ae[v].includes("DetermineComponentFrameRoot");)v++;if(p===Y.length||v===ae.length)for(p=Y.length-1,v=ae.length-1;1<=p&&0<=v&&Y[p]!==ae[v];)v--;for(;1<=p&&0<=v;p--,v--)if(Y[p]!==ae[v]){if(p!==1||v!==1)do if(p--,v--,0>v||Y[p]!==ae[v]){var pe=`
47
- `+Y[p].replace(" at new "," at ");return r.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",r.displayName)),pe}while(1<=p&&0<=v);break}}}finally{qe=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?De(c):""}function lt(r,i){switch(r.tag){case 26:case 27:case 5:return De(r.type);case 16:return De("Lazy");case 13:return r.child!==i&&i!==null?De("Suspense Fallback"):De("Suspense");case 19:return De("SuspenseList");case 0:case 15:return ke(r.type,!1);case 11:return ke(r.type.render,!1);case 1:return ke(r.type,!0);case 31:return De("Activity");default:return""}}function xe(r){try{var i="",c=null;do i+=lt(r,c),c=r,r=r.return;while(r);return i}catch(p){return`
48
- Error generating stack: `+p.message+`
49
- `+p.stack}}var Oe=Object.prototype.hasOwnProperty,Ot=e.unstable_scheduleCallback,$t=e.unstable_cancelCallback,Yt=e.unstable_shouldYield,qt=e.unstable_requestPaint,ut=e.unstable_now,ye=e.unstable_getCurrentPriorityLevel,X=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(r){if(typeof Le=="function"&&He(r),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(Ce,r)}catch{}}var Ne=Math.clz32?Math.clz32:Hr,Wt=Math.log,_t=Math.LN2;function Hr(r){return r>>>=0,r===0?32:31-(Wt(r)/_t|0)|0}var dr=256,Fa=262144,Ha=4194304;function pr(r){var i=r&42;if(i!==0)return i;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function qr(r,i,c){var p=r.pendingLanes;if(p===0)return 0;var v=0,x=r.suspendedLanes,C=r.pingedLanes;r=r.warmLanes;var M=p&134217727;return M!==0?(p=M&~x,p!==0?v=pr(p):(C&=M,C!==0?v=pr(C):c||(c=M&~r,c!==0&&(v=pr(c))))):(M=p&~x,M!==0?v=pr(M):C!==0?v=pr(C):c||(c=p&~r,c!==0&&(v=pr(c)))),v===0?0:i!==0&&i!==v&&(i&x)===0&&(x=v&-v,c=i&-i,x>=c||x===32&&(c&4194048)!==0)?i:v}function ca(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function ic(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qa(){var r=Ha;return Ha<<=1,(Ha&62914560)===0&&(Ha=4194304),r}function Ci(r){for(var i=[],c=0;31>c;c++)i.push(r);return i}function ge(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Me(r,i,c,p,v,x){var C=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var M=r.entanglements,Y=r.expirationTimes,ae=r.hiddenUpdates;for(c=C&~c;0<c;){var pe=31-Ne(c),me=1<<pe;M[pe]=0,Y[pe]=-1;var se=ae[pe];if(se!==null)for(ae[pe]=null,pe=0;pe<se.length;pe++){var oe=se[pe];oe!==null&&(oe.lane&=-536870913)}c&=~me}p!==0&&de(r,p,0),x!==0&&v===0&&r.tag!==0&&(r.suspendedLanes|=x&~(C&~i))}function de(r,i,c){r.pendingLanes|=i,r.suspendedLanes&=~i;var p=31-Ne(i);r.entangledLanes|=i,r.entanglements[p]=r.entanglements[p]|1073741824|c&261930}function je(r,i){var c=r.entangledLanes|=i;for(r=r.entanglements;c;){var p=31-Ne(c),v=1<<p;v&i|r[p]&i&&(r[p]|=i),c&=~v}}function Ae(r,i){var c=i&-i;return c=(c&42)!==0?1:tt(c),(c&(r.suspendedLanes|i))!==0?0:c}function tt(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Je(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Ke(){var r=W.p;return r!==0?r:(r=window.event,r===void 0?32:fx(r.type))}function pt(r,i){var c=W.p;try{return W.p=r,i()}finally{W.p=c}}var mn=Math.random().toString(36).slice(2),Gt="__reactFiber$"+mn,un="__reactProps$"+mn,ua="__reactContainer$"+mn,da="__reactEvents$"+mn,fs="__reactListeners$"+mn,Kn="__reactHandles$"+mn,fr="__reactResources$"+mn,Or="__reactMarker$"+mn;function Ga(r){delete r[Gt],delete r[un],delete r[da],delete r[fs],delete r[Kn]}function gn(r){var i=r[Gt];if(i)return i;for(var c=r.parentNode;c;){if(i=c[ua]||c[Gt]){if(c=i.alternate,i.child!==null||c!==null&&c.child!==null)for(r=Q0(r);r!==null;){if(c=r[Gt])return c;r=Q0(r)}return i}r=c,c=r.parentNode}return null}function Nn(r){if(r=r[Gt]||r[ua]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function pa(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function hr(r){var i=r[fr];return i||(i=r[fr]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Lt(r){r[Or]=!0}var jo=new Set,sc={};function mr(r,i){fa(r,i),fa(r+"Capture",i)}function fa(r,i){for(sc[r]=i,r=0;r<i.length;r++)jo.add(i[r])}var tn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),gr={},Gr={};function QN(r){return Oe.call(Gr,r)?!0:Oe.call(gr,r)?!1:tn.test(r)?Gr[r]=!0:(gr[r]=!0,!1)}function oc(r,i,c){if(QN(i))if(c===null)r.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var p=i.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+c)}}function lc(r,i,c){if(c===null)r.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+c)}}function ha(r,i,c,p){if(p===null)r.removeAttribute(c);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(i,c,""+p)}}function vr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Dv(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function XN(r,i,c){var p=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var v=p.get,x=p.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return v.call(this)},set:function(C){c=""+C,x.call(this,C)}}),Object.defineProperty(r,i,{enumerable:p.enumerable}),{getValue:function(){return c},setValue:function(C){c=""+C},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Jd(r){if(!r._valueTracker){var i=Dv(r)?"checked":"value";r._valueTracker=XN(r,i,""+r[i])}}function zv(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var c=i.getValue(),p="";return r&&(p=Dv(r)?r.checked?"true":"false":r.value),r=p,r!==c?(i.setValue(r),!0):!1}function cc(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var JN=/[\n"\\]/g;function yr(r){return r.replace(JN,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function ep(r,i,c,p,v,x,C,M){r.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?r.type=C:r.removeAttribute("type"),i!=null?C==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+vr(i)):r.value!==""+vr(i)&&(r.value=""+vr(i)):C!=="submit"&&C!=="reset"||r.removeAttribute("value"),i!=null?tp(r,C,vr(i)):c!=null?tp(r,C,vr(c)):p!=null&&r.removeAttribute("value"),v==null&&x!=null&&(r.defaultChecked=!!x),v!=null&&(r.checked=v&&typeof v!="function"&&typeof v!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?r.name=""+vr(M):r.removeAttribute("name")}function $v(r,i,c,p,v,x,C,M){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(r.type=x),i!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||i!=null)){Jd(r);return}c=c!=null?""+vr(c):"",i=i!=null?""+vr(i):c,M||i===r.value||(r.value=i),r.defaultValue=i}p=p??v,p=typeof p!="function"&&typeof p!="symbol"&&!!p,r.checked=M?r.checked:!!p,r.defaultChecked=!!p,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(r.name=C),Jd(r)}function tp(r,i,c){i==="number"&&cc(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function hs(r,i,c,p){if(r=r.options,i){i={};for(var v=0;v<c.length;v++)i["$"+c[v]]=!0;for(c=0;c<r.length;c++)v=i.hasOwnProperty("$"+r[c].value),r[c].selected!==v&&(r[c].selected=v),v&&p&&(r[c].defaultSelected=!0)}else{for(c=""+vr(c),i=null,v=0;v<r.length;v++){if(r[v].value===c){r[v].selected=!0,p&&(r[v].defaultSelected=!0);return}i!==null||r[v].disabled||(i=r[v])}i!==null&&(i.selected=!0)}}function Iv(r,i,c){if(i!=null&&(i=""+vr(i),i!==r.value&&(r.value=i),c==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=c!=null?""+vr(c):""}function Pv(r,i,c,p){if(i==null){if(p!=null){if(c!=null)throw Error(a(92));if(H(p)){if(1<p.length)throw Error(a(93));p=p[0]}c=p}c==null&&(c=""),i=c}c=vr(i),r.defaultValue=c,p=r.textContent,p===c&&p!==""&&p!==null&&(r.value=p),Jd(r)}function ms(r,i){if(i){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=i;return}}r.textContent=i}var eE=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Uv(r,i,c){var p=i.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?p?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":p?r.setProperty(i,c):typeof c!="number"||c===0||eE.has(i)?i==="float"?r.cssFloat=c:r[i]=(""+c).trim():r[i]=c+"px"}function Bv(r,i,c){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,c!=null){for(var p in c)!c.hasOwnProperty(p)||i!=null&&i.hasOwnProperty(p)||(p.indexOf("--")===0?r.setProperty(p,""):p==="float"?r.cssFloat="":r[p]="");for(var v in i)p=i[v],i.hasOwnProperty(v)&&c[v]!==p&&Uv(r,v,p)}else for(var x in i)i.hasOwnProperty(x)&&Uv(r,x,i[x])}function np(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var tE=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"]]),nE=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function uc(r){return nE.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function ma(){}var rp=null;function ap(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var gs=null,vs=null;function Fv(r){var i=Nn(r);if(i&&(r=i.stateNode)){var c=r[un]||null;e:switch(r=i.stateNode,i.type){case"input":if(ep(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),i=c.name,c.type==="radio"&&i!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+yr(""+i)+'"][type="radio"]'),i=0;i<c.length;i++){var p=c[i];if(p!==r&&p.form===r.form){var v=p[un]||null;if(!v)throw Error(a(90));ep(p,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(i=0;i<c.length;i++)p=c[i],p.form===r.form&&zv(p)}break e;case"textarea":Iv(r,c.value,c.defaultValue);break e;case"select":i=c.value,i!=null&&hs(r,!!c.multiple,i,!1)}}}var ip=!1;function Hv(r,i,c){if(ip)return r(i,c);ip=!0;try{var p=r(i);return p}finally{if(ip=!1,(gs!==null||vs!==null)&&(Qc(),gs&&(i=gs,r=vs,vs=gs=null,Fv(i),r)))for(i=0;i<r.length;i++)Fv(r[i])}}function Co(r,i){var c=r.stateNode;if(c===null)return null;var p=c[un]||null;if(p===null)return null;c=p[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(r=r.type,p=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!p;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(a(231,i,typeof c));return c}var ga=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sp=!1;if(ga)try{var No={};Object.defineProperty(No,"passive",{get:function(){sp=!0}}),window.addEventListener("test",No,No),window.removeEventListener("test",No,No)}catch{sp=!1}var Va=null,op=null,dc=null;function qv(){if(dc)return dc;var r,i=op,c=i.length,p,v="value"in Va?Va.value:Va.textContent,x=v.length;for(r=0;r<c&&i[r]===v[r];r++);var C=c-r;for(p=1;p<=C&&i[c-p]===v[x-p];p++);return dc=v.slice(r,1<p?1-p:void 0)}function pc(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function fc(){return!0}function Gv(){return!1}function In(r){function i(c,p,v,x,C){this._reactName=c,this._targetInst=v,this.type=p,this.nativeEvent=x,this.target=C,this.currentTarget=null;for(var M in r)r.hasOwnProperty(M)&&(c=r[M],this[M]=c?c(x):x[M]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?fc:Gv,this.isPropagationStopped=Gv,this}return m(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=fc)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=fc)},persist:function(){},isPersistent:fc}),i}var Ni={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hc=In(Ni),Eo=m({},Ni,{view:0,detail:0}),rE=In(Eo),lp,cp,Ao,mc=m({},Eo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dp,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ao&&(Ao&&r.type==="mousemove"?(lp=r.screenX-Ao.screenX,cp=r.screenY-Ao.screenY):cp=lp=0,Ao=r),lp)},movementY:function(r){return"movementY"in r?r.movementY:cp}}),Vv=In(mc),aE=m({},mc,{dataTransfer:0}),iE=In(aE),sE=m({},Eo,{relatedTarget:0}),up=In(sE),oE=m({},Ni,{animationName:0,elapsedTime:0,pseudoElement:0}),lE=In(oE),cE=m({},Ni,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),uE=In(cE),dE=m({},Ni,{data:0}),Wv=In(dE),pE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fE={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"},hE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mE(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=hE[r])?!!i[r]:!1}function dp(){return mE}var gE=m({},Eo,{key:function(r){if(r.key){var i=pE[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=pc(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?fE[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dp,charCode:function(r){return r.type==="keypress"?pc(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?pc(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),vE=In(gE),yE=m({},mc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Zv=In(yE),bE=m({},Eo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dp}),xE=In(bE),wE=m({},Ni,{propertyName:0,elapsedTime:0,pseudoElement:0}),kE=In(wE),SE=m({},mc,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),jE=In(SE),CE=m({},Ni,{newState:0,oldState:0}),NE=In(CE),EE=[9,13,27,32],pp=ga&&"CompositionEvent"in window,To=null;ga&&"documentMode"in document&&(To=document.documentMode);var AE=ga&&"TextEvent"in window&&!To,Kv=ga&&(!pp||To&&8<To&&11>=To),Yv=" ",Qv=!1;function Xv(r,i){switch(r){case"keyup":return EE.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jv(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var ys=!1;function TE(r,i){switch(r){case"compositionend":return Jv(i);case"keypress":return i.which!==32?null:(Qv=!0,Yv);case"textInput":return r=i.data,r===Yv&&Qv?null:r;default:return null}}function _E(r,i){if(ys)return r==="compositionend"||!pp&&Xv(r,i)?(r=qv(),dc=op=Va=null,ys=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Kv&&i.locale!=="ko"?null:i.data;default:return null}}var 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 ey(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!RE[r.type]:i==="textarea"}function ty(r,i,c,p){gs?vs?vs.push(p):vs=[p]:gs=p,i=au(i,"onChange"),0<i.length&&(c=new hc("onChange","change",null,c,p),r.push({event:c,listeners:i}))}var _o=null,Ro=null;function OE(r){$0(r,0)}function gc(r){var i=pa(r);if(zv(i))return r}function ny(r,i){if(r==="change")return i}var ry=!1;if(ga){var fp;if(ga){var hp="oninput"in document;if(!hp){var ay=document.createElement("div");ay.setAttribute("oninput","return;"),hp=typeof ay.oninput=="function"}fp=hp}else fp=!1;ry=fp&&(!document.documentMode||9<document.documentMode)}function iy(){_o&&(_o.detachEvent("onpropertychange",sy),Ro=_o=null)}function sy(r){if(r.propertyName==="value"&&gc(Ro)){var i=[];ty(i,Ro,r,ap(r)),Hv(OE,i)}}function LE(r,i,c){r==="focusin"?(iy(),_o=i,Ro=c,_o.attachEvent("onpropertychange",sy)):r==="focusout"&&iy()}function ME(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return gc(Ro)}function DE(r,i){if(r==="click")return gc(i)}function zE(r,i){if(r==="input"||r==="change")return gc(i)}function $E(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var Yn=typeof Object.is=="function"?Object.is:$E;function Oo(r,i){if(Yn(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var c=Object.keys(r),p=Object.keys(i);if(c.length!==p.length)return!1;for(p=0;p<c.length;p++){var v=c[p];if(!Oe.call(i,v)||!Yn(r[v],i[v]))return!1}return!0}function oy(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function ly(r,i){var c=oy(r);r=0;for(var p;c;){if(c.nodeType===3){if(p=r+c.textContent.length,r<=i&&p>=i)return{node:c,offset:i-r};r=p}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=oy(c)}}function cy(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?cy(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function uy(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=cc(r.document);i instanceof r.HTMLIFrameElement;){try{var c=typeof i.contentWindow.location.href=="string"}catch{c=!1}if(c)r=i.contentWindow;else break;i=cc(r.document)}return i}function mp(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var IE=ga&&"documentMode"in document&&11>=document.documentMode,bs=null,gp=null,Lo=null,vp=!1;function dy(r,i,c){var p=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;vp||bs==null||bs!==cc(p)||(p=bs,"selectionStart"in p&&mp(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Lo&&Oo(Lo,p)||(Lo=p,p=au(gp,"onSelect"),0<p.length&&(i=new hc("onSelect","select",null,i,c),r.push({event:i,listeners:p}),i.target=bs)))}function Ei(r,i){var c={};return c[r.toLowerCase()]=i.toLowerCase(),c["Webkit"+r]="webkit"+i,c["Moz"+r]="moz"+i,c}var xs={animationend:Ei("Animation","AnimationEnd"),animationiteration:Ei("Animation","AnimationIteration"),animationstart:Ei("Animation","AnimationStart"),transitionrun:Ei("Transition","TransitionRun"),transitionstart:Ei("Transition","TransitionStart"),transitioncancel:Ei("Transition","TransitionCancel"),transitionend:Ei("Transition","TransitionEnd")},yp={},py={};ga&&(py=document.createElement("div").style,"AnimationEvent"in window||(delete xs.animationend.animation,delete xs.animationiteration.animation,delete xs.animationstart.animation),"TransitionEvent"in window||delete xs.transitionend.transition);function Ai(r){if(yp[r])return yp[r];if(!xs[r])return r;var i=xs[r],c;for(c in i)if(i.hasOwnProperty(c)&&c in py)return yp[r]=i[c];return r}var fy=Ai("animationend"),hy=Ai("animationiteration"),my=Ai("animationstart"),PE=Ai("transitionrun"),UE=Ai("transitionstart"),BE=Ai("transitioncancel"),gy=Ai("transitionend"),vy=new Map,bp="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");bp.push("scrollEnd");function Lr(r,i){vy.set(r,i),mr(i,[r])}var vc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},br=[],ws=0,xp=0;function yc(){for(var r=ws,i=xp=ws=0;i<r;){var c=br[i];br[i++]=null;var p=br[i];br[i++]=null;var v=br[i];br[i++]=null;var x=br[i];if(br[i++]=null,p!==null&&v!==null){var C=p.pending;C===null?v.next=v:(v.next=C.next,C.next=v),p.pending=v}x!==0&&yy(c,v,x)}}function bc(r,i,c,p){br[ws++]=r,br[ws++]=i,br[ws++]=c,br[ws++]=p,xp|=p,r.lanes|=p,r=r.alternate,r!==null&&(r.lanes|=p)}function wp(r,i,c,p){return bc(r,i,c,p),xc(r)}function Ti(r,i){return bc(r,null,null,i),xc(r)}function yy(r,i,c){r.lanes|=c;var p=r.alternate;p!==null&&(p.lanes|=c);for(var v=!1,x=r.return;x!==null;)x.childLanes|=c,p=x.alternate,p!==null&&(p.childLanes|=c),x.tag===22&&(r=x.stateNode,r===null||r._visibility&1||(v=!0)),r=x,x=x.return;return r.tag===3?(x=r.stateNode,v&&i!==null&&(v=31-Ne(c),r=x.hiddenUpdates,p=r[v],p===null?r[v]=[i]:p.push(i),i.lane=c|536870912),x):null}function xc(r){if(50<tl)throw tl=0,Rf=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var ks={};function FE(r,i,c,p){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qn(r,i,c,p){return new FE(r,i,c,p)}function kp(r){return r=r.prototype,!(!r||!r.isReactComponent)}function va(r,i){var c=r.alternate;return c===null?(c=Qn(r.tag,i,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=i,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,i=r.dependencies,c.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function by(r,i){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,i=c.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function wc(r,i,c,p,v,x){var C=0;if(p=r,typeof r=="function")kp(r)&&(C=1);else if(typeof r=="string")C=WA(r,c,ne.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case D:return r=Qn(31,c,i,v),r.elementType=D,r.lanes=x,r;case j:return _i(c.children,v,x,i);case N:C=8,v|=24;break;case S:return r=Qn(12,c,i,v|2),r.elementType=S,r.lanes=x,r;case U:return r=Qn(13,c,i,v),r.elementType=U,r.lanes=x,r;case _:return r=Qn(19,c,i,v),r.elementType=_,r.lanes=x,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case E:C=10;break e;case A:C=9;break e;case T:C=11;break e;case z:C=14;break e;case q:C=16,p=null;break e}C=29,c=Error(a(130,r===null?"null":typeof r,"")),p=null}return i=Qn(C,c,i,v),i.elementType=r,i.type=p,i.lanes=x,i}function _i(r,i,c,p){return r=Qn(7,r,p,i),r.lanes=c,r}function Sp(r,i,c){return r=Qn(6,r,null,i),r.lanes=c,r}function xy(r){var i=Qn(18,null,null,0);return i.stateNode=r,i}function jp(r,i,c){return i=Qn(4,r.children!==null?r.children:[],r.key,i),i.lanes=c,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var wy=new WeakMap;function xr(r,i){if(typeof r=="object"&&r!==null){var c=wy.get(r);return c!==void 0?c:(i={value:r,source:i,stack:xe(i)},wy.set(r,i),i)}return{value:r,source:i,stack:xe(i)}}var Ss=[],js=0,kc=null,Mo=0,wr=[],kr=0,Wa=null,Vr=1,Wr="";function ya(r,i){Ss[js++]=Mo,Ss[js++]=kc,kc=r,Mo=i}function ky(r,i,c){wr[kr++]=Vr,wr[kr++]=Wr,wr[kr++]=Wa,Wa=r;var p=Vr;r=Wr;var v=32-Ne(p)-1;p&=~(1<<v),c+=1;var x=32-Ne(i)+v;if(30<x){var C=v-v%5;x=(p&(1<<C)-1).toString(32),p>>=C,v-=C,Vr=1<<32-Ne(i)+v|c<<v|p,Wr=x+r}else Vr=1<<x|c<<v|p,Wr=r}function Cp(r){r.return!==null&&(ya(r,1),ky(r,1,0))}function Np(r){for(;r===kc;)kc=Ss[--js],Ss[js]=null,Mo=Ss[--js],Ss[js]=null;for(;r===Wa;)Wa=wr[--kr],wr[kr]=null,Wr=wr[--kr],wr[kr]=null,Vr=wr[--kr],wr[kr]=null}function Sy(r,i){wr[kr++]=Vr,wr[kr++]=Wr,wr[kr++]=Wa,Vr=i.id,Wr=i.overflow,Wa=r}var xn=null,Mt=null,ct=!1,Za=null,Sr=!1,Ep=Error(a(519));function Ka(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Do(xr(i,r)),Ep}function jy(r){var i=r.stateNode,c=r.type,p=r.memoizedProps;switch(i[Gt]=r,i[un]=p,c){case"dialog":rt("cancel",i),rt("close",i);break;case"iframe":case"object":case"embed":rt("load",i);break;case"video":case"audio":for(c=0;c<rl.length;c++)rt(rl[c],i);break;case"source":rt("error",i);break;case"img":case"image":case"link":rt("error",i),rt("load",i);break;case"details":rt("toggle",i);break;case"input":rt("invalid",i),$v(i,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":rt("invalid",i);break;case"textarea":rt("invalid",i),Pv(i,p.value,p.defaultValue,p.children)}c=p.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||i.textContent===""+c||p.suppressHydrationWarning===!0||B0(i.textContent,c)?(p.popover!=null&&(rt("beforetoggle",i),rt("toggle",i)),p.onScroll!=null&&rt("scroll",i),p.onScrollEnd!=null&&rt("scrollend",i),p.onClick!=null&&(i.onclick=ma),i=!0):i=!1,i||Ka(r,!0)}function Cy(r){for(xn=r.return;xn;)switch(xn.tag){case 5:case 31:case 13:Sr=!1;return;case 27:case 3:Sr=!0;return;default:xn=xn.return}}function Cs(r){if(r!==xn)return!1;if(!ct)return Cy(r),ct=!0,!1;var i=r.tag,c;if((c=i!==3&&i!==27)&&((c=i===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||Vf(r.type,r.memoizedProps)),c=!c),c&&Mt&&Ka(r),Cy(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Mt=Y0(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Mt=Y0(r)}else i===27?(i=Mt,ci(r.type)?(r=Qf,Qf=null,Mt=r):Mt=i):Mt=xn?Cr(r.stateNode.nextSibling):null;return!0}function Ri(){Mt=xn=null,ct=!1}function Ap(){var r=Za;return r!==null&&(Fn===null?Fn=r:Fn.push.apply(Fn,r),Za=null),r}function Do(r){Za===null?Za=[r]:Za.push(r)}var Tp=P(null),Oi=null,ba=null;function Ya(r,i,c){O(Tp,i._currentValue),i._currentValue=c}function xa(r){r._currentValue=Tp.current,G(Tp)}function _p(r,i,c){for(;r!==null;){var p=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,p!==null&&(p.childLanes|=i)):p!==null&&(p.childLanes&i)!==i&&(p.childLanes|=i),r===c)break;r=r.return}}function Rp(r,i,c,p){var v=r.child;for(v!==null&&(v.return=r);v!==null;){var x=v.dependencies;if(x!==null){var C=v.child;x=x.firstContext;e:for(;x!==null;){var M=x;x=v;for(var Y=0;Y<i.length;Y++)if(M.context===i[Y]){x.lanes|=c,M=x.alternate,M!==null&&(M.lanes|=c),_p(x.return,c,r),p||(C=null);break e}x=M.next}}else if(v.tag===18){if(C=v.return,C===null)throw Error(a(341));C.lanes|=c,x=C.alternate,x!==null&&(x.lanes|=c),_p(C,c,r),C=null}else C=v.child;if(C!==null)C.return=v;else for(C=v;C!==null;){if(C===r){C=null;break}if(v=C.sibling,v!==null){v.return=C.return,C=v;break}C=C.return}v=C}}function Ns(r,i,c,p){r=null;for(var v=i,x=!1;v!==null;){if(!x){if((v.flags&524288)!==0)x=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var C=v.alternate;if(C===null)throw Error(a(387));if(C=C.memoizedProps,C!==null){var M=v.type;Yn(v.pendingProps.value,C.value)||(r!==null?r.push(M):r=[M])}}else if(v===be.current){if(C=v.alternate,C===null)throw Error(a(387));C.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(r!==null?r.push(ll):r=[ll])}v=v.return}r!==null&&Rp(i,r,c,p),i.flags|=262144}function Sc(r){for(r=r.firstContext;r!==null;){if(!Yn(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Li(r){Oi=r,ba=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function wn(r){return Ny(Oi,r)}function jc(r,i){return Oi===null&&Li(r),Ny(r,i)}function Ny(r,i){var c=i._currentValue;if(i={context:i,memoizedValue:c,next:null},ba===null){if(r===null)throw Error(a(308));ba=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else ba=ba.next=i;return c}var HE=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(c,p){r.push(p)}};this.abort=function(){i.aborted=!0,r.forEach(function(c){return c()})}},qE=e.unstable_scheduleCallback,GE=e.unstable_NormalPriority,nn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Op(){return{controller:new HE,data:new Map,refCount:0}}function zo(r){r.refCount--,r.refCount===0&&qE(GE,function(){r.controller.abort()})}var $o=null,Lp=0,Es=0,As=null;function VE(r,i){if($o===null){var c=$o=[];Lp=0,Es=$f(),As={status:"pending",value:void 0,then:function(p){c.push(p)}}}return Lp++,i.then(Ey,Ey),i}function Ey(){if(--Lp===0&&$o!==null){As!==null&&(As.status="fulfilled");var r=$o;$o=null,Es=0,As=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function WE(r,i){var c=[],p={status:"pending",value:null,reason:null,then:function(v){c.push(v)}};return r.then(function(){p.status="fulfilled",p.value=i;for(var v=0;v<c.length;v++)(0,c[v])(i)},function(v){for(p.status="rejected",p.reason=v,v=0;v<c.length;v++)(0,c[v])(void 0)}),p}var Ay=B.S;B.S=function(r,i){d0=ut(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&VE(r,i),Ay!==null&&Ay(r,i)};var Mi=P(null);function Mp(){var r=Mi.current;return r!==null?r:Et.pooledCache}function Cc(r,i){i===null?O(Mi,Mi.current):O(Mi,i.pool)}function Ty(){var r=Mp();return r===null?null:{parent:nn._currentValue,pool:r}}var Ts=Error(a(460)),Dp=Error(a(474)),Nc=Error(a(542)),Ec={then:function(){}};function _y(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Ry(r,i,c){switch(c=r[c],c===void 0?r.push(i):c!==i&&(i.then(ma,ma),i=c),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Ly(r),r;default:if(typeof i.status=="string")i.then(ma,ma);else{if(r=Et,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(p){if(i.status==="pending"){var v=i;v.status="fulfilled",v.value=p}},function(p){if(i.status==="pending"){var v=i;v.status="rejected",v.reason=p}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Ly(r),r}throw zi=i,Ts}}function Di(r){try{var i=r._init;return i(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(zi=c,Ts):c}}var zi=null;function Oy(){if(zi===null)throw Error(a(459));var r=zi;return zi=null,r}function Ly(r){if(r===Ts||r===Nc)throw Error(a(483))}var _s=null,Io=0;function Ac(r){var i=Io;return Io+=1,_s===null&&(_s=[]),Ry(_s,r,i)}function Po(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function Tc(r,i){throw i.$$typeof===y?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function My(r){function i(te,J){if(r){var re=te.deletions;re===null?(te.deletions=[J],te.flags|=16):re.push(J)}}function c(te,J){if(!r)return null;for(;J!==null;)i(te,J),J=J.sibling;return null}function p(te){for(var J=new Map;te!==null;)te.key!==null?J.set(te.key,te):J.set(te.index,te),te=te.sibling;return J}function v(te,J){return te=va(te,J),te.index=0,te.sibling=null,te}function x(te,J,re){return te.index=re,r?(re=te.alternate,re!==null?(re=re.index,re<J?(te.flags|=67108866,J):re):(te.flags|=67108866,J)):(te.flags|=1048576,J)}function C(te){return r&&te.alternate===null&&(te.flags|=67108866),te}function M(te,J,re,fe){return J===null||J.tag!==6?(J=Sp(re,te.mode,fe),J.return=te,J):(J=v(J,re),J.return=te,J)}function Y(te,J,re,fe){var ze=re.type;return ze===j?pe(te,J,re.props.children,fe,re.key):J!==null&&(J.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===q&&Di(ze)===J.type)?(J=v(J,re.props),Po(J,re),J.return=te,J):(J=wc(re.type,re.key,re.props,null,te.mode,fe),Po(J,re),J.return=te,J)}function ae(te,J,re,fe){return J===null||J.tag!==4||J.stateNode.containerInfo!==re.containerInfo||J.stateNode.implementation!==re.implementation?(J=jp(re,te.mode,fe),J.return=te,J):(J=v(J,re.children||[]),J.return=te,J)}function pe(te,J,re,fe,ze){return J===null||J.tag!==7?(J=_i(re,te.mode,fe,ze),J.return=te,J):(J=v(J,re),J.return=te,J)}function me(te,J,re){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=Sp(""+J,te.mode,re),J.return=te,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return re=wc(J.type,J.key,J.props,null,te.mode,re),Po(re,J),re.return=te,re;case k:return J=jp(J,te.mode,re),J.return=te,J;case q:return J=Di(J),me(te,J,re)}if(H(J)||F(J))return J=_i(J,te.mode,re,null),J.return=te,J;if(typeof J.then=="function")return me(te,Ac(J),re);if(J.$$typeof===E)return me(te,jc(te,J),re);Tc(te,J)}return null}function se(te,J,re,fe){var ze=J!==null?J.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return ze!==null?null:M(te,J,""+re,fe);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case b:return re.key===ze?Y(te,J,re,fe):null;case k:return re.key===ze?ae(te,J,re,fe):null;case q:return re=Di(re),se(te,J,re,fe)}if(H(re)||F(re))return ze!==null?null:pe(te,J,re,fe,null);if(typeof re.then=="function")return se(te,J,Ac(re),fe);if(re.$$typeof===E)return se(te,J,jc(te,re),fe);Tc(te,re)}return null}function oe(te,J,re,fe,ze){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return te=te.get(re)||null,M(J,te,""+fe,ze);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case b:return te=te.get(fe.key===null?re:fe.key)||null,Y(J,te,fe,ze);case k:return te=te.get(fe.key===null?re:fe.key)||null,ae(J,te,fe,ze);case q:return fe=Di(fe),oe(te,J,re,fe,ze)}if(H(fe)||F(fe))return te=te.get(re)||null,pe(J,te,fe,ze,null);if(typeof fe.then=="function")return oe(te,J,re,Ac(fe),ze);if(fe.$$typeof===E)return oe(te,J,re,jc(J,fe),ze);Tc(J,fe)}return null}function Te(te,J,re,fe){for(var ze=null,ht=null,Re=J,Qe=J=0,ot=null;Re!==null&&Qe<re.length;Qe++){Re.index>Qe?(ot=Re,Re=null):ot=Re.sibling;var mt=se(te,Re,re[Qe],fe);if(mt===null){Re===null&&(Re=ot);break}r&&Re&&mt.alternate===null&&i(te,Re),J=x(mt,J,Qe),ht===null?ze=mt:ht.sibling=mt,ht=mt,Re=ot}if(Qe===re.length)return c(te,Re),ct&&ya(te,Qe),ze;if(Re===null){for(;Qe<re.length;Qe++)Re=me(te,re[Qe],fe),Re!==null&&(J=x(Re,J,Qe),ht===null?ze=Re:ht.sibling=Re,ht=Re);return ct&&ya(te,Qe),ze}for(Re=p(Re);Qe<re.length;Qe++)ot=oe(Re,te,Qe,re[Qe],fe),ot!==null&&(r&&ot.alternate!==null&&Re.delete(ot.key===null?Qe:ot.key),J=x(ot,J,Qe),ht===null?ze=ot:ht.sibling=ot,ht=ot);return r&&Re.forEach(function(hi){return i(te,hi)}),ct&&ya(te,Qe),ze}function Be(te,J,re,fe){if(re==null)throw Error(a(151));for(var ze=null,ht=null,Re=J,Qe=J=0,ot=null,mt=re.next();Re!==null&&!mt.done;Qe++,mt=re.next()){Re.index>Qe?(ot=Re,Re=null):ot=Re.sibling;var hi=se(te,Re,mt.value,fe);if(hi===null){Re===null&&(Re=ot);break}r&&Re&&hi.alternate===null&&i(te,Re),J=x(hi,J,Qe),ht===null?ze=hi:ht.sibling=hi,ht=hi,Re=ot}if(mt.done)return c(te,Re),ct&&ya(te,Qe),ze;if(Re===null){for(;!mt.done;Qe++,mt=re.next())mt=me(te,mt.value,fe),mt!==null&&(J=x(mt,J,Qe),ht===null?ze=mt:ht.sibling=mt,ht=mt);return ct&&ya(te,Qe),ze}for(Re=p(Re);!mt.done;Qe++,mt=re.next())mt=oe(Re,te,Qe,mt.value,fe),mt!==null&&(r&&mt.alternate!==null&&Re.delete(mt.key===null?Qe:mt.key),J=x(mt,J,Qe),ht===null?ze=mt:ht.sibling=mt,ht=mt);return r&&Re.forEach(function(aT){return i(te,aT)}),ct&&ya(te,Qe),ze}function Ct(te,J,re,fe){if(typeof re=="object"&&re!==null&&re.type===j&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case b:e:{for(var ze=re.key;J!==null;){if(J.key===ze){if(ze=re.type,ze===j){if(J.tag===7){c(te,J.sibling),fe=v(J,re.props.children),fe.return=te,te=fe;break e}}else if(J.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===q&&Di(ze)===J.type){c(te,J.sibling),fe=v(J,re.props),Po(fe,re),fe.return=te,te=fe;break e}c(te,J);break}else i(te,J);J=J.sibling}re.type===j?(fe=_i(re.props.children,te.mode,fe,re.key),fe.return=te,te=fe):(fe=wc(re.type,re.key,re.props,null,te.mode,fe),Po(fe,re),fe.return=te,te=fe)}return C(te);case k:e:{for(ze=re.key;J!==null;){if(J.key===ze)if(J.tag===4&&J.stateNode.containerInfo===re.containerInfo&&J.stateNode.implementation===re.implementation){c(te,J.sibling),fe=v(J,re.children||[]),fe.return=te,te=fe;break e}else{c(te,J);break}else i(te,J);J=J.sibling}fe=jp(re,te.mode,fe),fe.return=te,te=fe}return C(te);case q:return re=Di(re),Ct(te,J,re,fe)}if(H(re))return Te(te,J,re,fe);if(F(re)){if(ze=F(re),typeof ze!="function")throw Error(a(150));return re=ze.call(re),Be(te,J,re,fe)}if(typeof re.then=="function")return Ct(te,J,Ac(re),fe);if(re.$$typeof===E)return Ct(te,J,jc(te,re),fe);Tc(te,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,J!==null&&J.tag===6?(c(te,J.sibling),fe=v(J,re),fe.return=te,te=fe):(c(te,J),fe=Sp(re,te.mode,fe),fe.return=te,te=fe),C(te)):c(te,J)}return function(te,J,re,fe){try{Io=0;var ze=Ct(te,J,re,fe);return _s=null,ze}catch(Re){if(Re===Ts||Re===Nc)throw Re;var ht=Qn(29,Re,null,te.mode);return ht.lanes=fe,ht.return=te,ht}finally{}}}var $i=My(!0),Dy=My(!1),Qa=!1;function zp(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $p(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Xa(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Ja(r,i,c){var p=r.updateQueue;if(p===null)return null;if(p=p.shared,(yt&2)!==0){var v=p.pending;return v===null?i.next=i:(i.next=v.next,v.next=i),p.pending=i,i=xc(r),yy(r,null,c),i}return bc(r,p,i,c),xc(r)}function Uo(r,i,c){if(i=i.updateQueue,i!==null&&(i=i.shared,(c&4194048)!==0)){var p=i.lanes;p&=r.pendingLanes,c|=p,i.lanes=c,je(r,c)}}function Ip(r,i){var c=r.updateQueue,p=r.alternate;if(p!==null&&(p=p.updateQueue,c===p)){var v=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var C={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?v=x=C:x=x.next=C,c=c.next}while(c!==null);x===null?v=x=i:x=x.next=i}else v=x=i;c={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:p.shared,callbacks:p.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=i:r.next=i,c.lastBaseUpdate=i}var Pp=!1;function Bo(){if(Pp){var r=As;if(r!==null)throw r}}function Fo(r,i,c,p){Pp=!1;var v=r.updateQueue;Qa=!1;var x=v.firstBaseUpdate,C=v.lastBaseUpdate,M=v.shared.pending;if(M!==null){v.shared.pending=null;var Y=M,ae=Y.next;Y.next=null,C===null?x=ae:C.next=ae,C=Y;var pe=r.alternate;pe!==null&&(pe=pe.updateQueue,M=pe.lastBaseUpdate,M!==C&&(M===null?pe.firstBaseUpdate=ae:M.next=ae,pe.lastBaseUpdate=Y))}if(x!==null){var me=v.baseState;C=0,pe=ae=Y=null,M=x;do{var se=M.lane&-536870913,oe=se!==M.lane;if(oe?(st&se)===se:(p&se)===se){se!==0&&se===Es&&(Pp=!0),pe!==null&&(pe=pe.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var Te=r,Be=M;se=i;var Ct=c;switch(Be.tag){case 1:if(Te=Be.payload,typeof Te=="function"){me=Te.call(Ct,me,se);break e}me=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Be.payload,se=typeof Te=="function"?Te.call(Ct,me,se):Te,se==null)break e;me=m({},me,se);break e;case 2:Qa=!0}}se=M.callback,se!==null&&(r.flags|=64,oe&&(r.flags|=8192),oe=v.callbacks,oe===null?v.callbacks=[se]:oe.push(se))}else oe={lane:se,tag:M.tag,payload:M.payload,callback:M.callback,next:null},pe===null?(ae=pe=oe,Y=me):pe=pe.next=oe,C|=se;if(M=M.next,M===null){if(M=v.shared.pending,M===null)break;oe=M,M=oe.next,oe.next=null,v.lastBaseUpdate=oe,v.shared.pending=null}}while(!0);pe===null&&(Y=me),v.baseState=Y,v.firstBaseUpdate=ae,v.lastBaseUpdate=pe,x===null&&(v.shared.lanes=0),ai|=C,r.lanes=C,r.memoizedState=me}}function zy(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function $y(r,i){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)zy(c[r],i)}var Rs=P(null),_c=P(0);function Iy(r,i){r=Ta,O(_c,r),O(Rs,i),Ta=r|i.baseLanes}function Up(){O(_c,Ta),O(Rs,Rs.current)}function Bp(){Ta=_c.current,G(Rs),G(_c)}var Xn=P(null),jr=null;function ei(r){var i=r.alternate;O(Qt,Qt.current&1),O(Xn,r),jr===null&&(i===null||Rs.current!==null||i.memoizedState!==null)&&(jr=r)}function Fp(r){O(Qt,Qt.current),O(Xn,r),jr===null&&(jr=r)}function Py(r){r.tag===22?(O(Qt,Qt.current),O(Xn,r),jr===null&&(jr=r)):ti()}function ti(){O(Qt,Qt.current),O(Xn,Xn.current)}function Jn(r){G(Xn),jr===r&&(jr=null),G(Qt)}var Qt=P(0);function Rc(r){for(var i=r;i!==null;){if(i.tag===13){var c=i.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Kf(c)||Yf(c)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var wa=0,Ye=null,St=null,rn=null,Oc=!1,Os=!1,Ii=!1,Lc=0,Ho=0,Ls=null,ZE=0;function Zt(){throw Error(a(321))}function Hp(r,i){if(i===null)return!1;for(var c=0;c<i.length&&c<r.length;c++)if(!Yn(r[c],i[c]))return!1;return!0}function qp(r,i,c,p,v,x){return wa=x,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,B.H=r===null||r.memoizedState===null?kb:sf,Ii=!1,x=c(p,v),Ii=!1,Os&&(x=By(i,c,p,v)),Uy(r),x}function Uy(r){B.H=Vo;var i=St!==null&&St.next!==null;if(wa=0,rn=St=Ye=null,Oc=!1,Ho=0,Ls=null,i)throw Error(a(300));r===null||an||(r=r.dependencies,r!==null&&Sc(r)&&(an=!0))}function By(r,i,c,p){Ye=r;var v=0;do{if(Os&&(Ls=null),Ho=0,Os=!1,25<=v)throw Error(a(301));if(v+=1,rn=St=null,r.updateQueue!=null){var x=r.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}B.H=Sb,x=i(c,p)}while(Os);return x}function KE(){var r=B.H,i=r.useState()[0];return i=typeof i.then=="function"?qo(i):i,r=r.useState()[0],(St!==null?St.memoizedState:null)!==r&&(Ye.flags|=1024),i}function Gp(){var r=Lc!==0;return Lc=0,r}function Vp(r,i,c){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~c}function Wp(r){if(Oc){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Oc=!1}wa=0,rn=St=Ye=null,Os=!1,Ho=Lc=0,Ls=null}function Rn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rn===null?Ye.memoizedState=rn=r:rn=rn.next=r,rn}function Xt(){if(St===null){var r=Ye.alternate;r=r!==null?r.memoizedState:null}else r=St.next;var i=rn===null?Ye.memoizedState:rn.next;if(i!==null)rn=i,St=r;else{if(r===null)throw Ye.alternate===null?Error(a(467)):Error(a(310));St=r,r={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},rn===null?Ye.memoizedState=rn=r:rn=rn.next=r}return rn}function Mc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function qo(r){var i=Ho;return Ho+=1,Ls===null&&(Ls=[]),r=Ry(Ls,r,i),i=Ye,(rn===null?i.memoizedState:rn.next)===null&&(i=i.alternate,B.H=i===null||i.memoizedState===null?kb:sf),r}function Dc(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return qo(r);if(r.$$typeof===E)return wn(r)}throw Error(a(438,String(r)))}function Zp(r){var i=null,c=Ye.updateQueue;if(c!==null&&(i=c.memoCache),i==null){var p=Ye.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(i={data:p.data.map(function(v){return v.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),c===null&&(c=Mc(),Ye.updateQueue=c),c.memoCache=i,c=i.data[i.index],c===void 0)for(c=i.data[i.index]=Array(r),p=0;p<r;p++)c[p]=R;return i.index++,c}function ka(r,i){return typeof i=="function"?i(r):i}function zc(r){var i=Xt();return Kp(i,St,r)}function Kp(r,i,c){var p=r.queue;if(p===null)throw Error(a(311));p.lastRenderedReducer=c;var v=r.baseQueue,x=p.pending;if(x!==null){if(v!==null){var C=v.next;v.next=x.next,x.next=C}i.baseQueue=v=x,p.pending=null}if(x=r.baseState,v===null)r.memoizedState=x;else{i=v.next;var M=C=null,Y=null,ae=i,pe=!1;do{var me=ae.lane&-536870913;if(me!==ae.lane?(st&me)===me:(wa&me)===me){var se=ae.revertLane;if(se===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),me===Es&&(pe=!0);else if((wa&se)===se){ae=ae.next,se===Es&&(pe=!0);continue}else me={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Y===null?(M=Y=me,C=x):Y=Y.next=me,Ye.lanes|=se,ai|=se;me=ae.action,Ii&&c(x,me),x=ae.hasEagerState?ae.eagerState:c(x,me)}else se={lane:me,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Y===null?(M=Y=se,C=x):Y=Y.next=se,Ye.lanes|=me,ai|=me;ae=ae.next}while(ae!==null&&ae!==i);if(Y===null?C=x:Y.next=M,!Yn(x,r.memoizedState)&&(an=!0,pe&&(c=As,c!==null)))throw c;r.memoizedState=x,r.baseState=C,r.baseQueue=Y,p.lastRenderedState=x}return v===null&&(p.lanes=0),[r.memoizedState,p.dispatch]}function Yp(r){var i=Xt(),c=i.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=r;var p=c.dispatch,v=c.pending,x=i.memoizedState;if(v!==null){c.pending=null;var C=v=v.next;do x=r(x,C.action),C=C.next;while(C!==v);Yn(x,i.memoizedState)||(an=!0),i.memoizedState=x,i.baseQueue===null&&(i.baseState=x),c.lastRenderedState=x}return[x,p]}function Fy(r,i,c){var p=Ye,v=Xt(),x=ct;if(x){if(c===void 0)throw Error(a(407));c=c()}else c=i();var C=!Yn((St||v).memoizedState,c);if(C&&(v.memoizedState=c,an=!0),v=v.queue,Jp(Gy.bind(null,p,v,r),[r]),v.getSnapshot!==i||C||rn!==null&&rn.memoizedState.tag&1){if(p.flags|=2048,Ms(9,{destroy:void 0},qy.bind(null,p,v,c,i),null),Et===null)throw Error(a(349));x||(wa&127)!==0||Hy(p,i,c)}return c}function Hy(r,i,c){r.flags|=16384,r={getSnapshot:i,value:c},i=Ye.updateQueue,i===null?(i=Mc(),Ye.updateQueue=i,i.stores=[r]):(c=i.stores,c===null?i.stores=[r]:c.push(r))}function qy(r,i,c,p){i.value=c,i.getSnapshot=p,Vy(i)&&Wy(r)}function Gy(r,i,c){return c(function(){Vy(i)&&Wy(r)})}function Vy(r){var i=r.getSnapshot;r=r.value;try{var c=i();return!Yn(r,c)}catch{return!0}}function Wy(r){var i=Ti(r,2);i!==null&&Hn(i,r,2)}function Qp(r){var i=Rn();if(typeof r=="function"){var c=r;if(r=c(),Ii){et(!0);try{c()}finally{et(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:r},i}function Zy(r,i,c,p){return r.baseState=c,Kp(r,St,typeof p=="function"?p:ka)}function YE(r,i,c,p,v){if(Pc(r))throw Error(a(485));if(r=i.action,r!==null){var x={payload:v,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){x.listeners.push(C)}};B.T!==null?c(!0):x.isTransition=!1,p(x),c=i.pending,c===null?(x.next=i.pending=x,Ky(i,x)):(x.next=c.next,i.pending=c.next=x)}}function Ky(r,i){var c=i.action,p=i.payload,v=r.state;if(i.isTransition){var x=B.T,C={};B.T=C;try{var M=c(v,p),Y=B.S;Y!==null&&Y(C,M),Yy(r,i,M)}catch(ae){Xp(r,i,ae)}finally{x!==null&&C.types!==null&&(x.types=C.types),B.T=x}}else try{x=c(v,p),Yy(r,i,x)}catch(ae){Xp(r,i,ae)}}function Yy(r,i,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(p){Qy(r,i,p)},function(p){return Xp(r,i,p)}):Qy(r,i,c)}function Qy(r,i,c){i.status="fulfilled",i.value=c,Xy(i),r.state=c,i=r.pending,i!==null&&(c=i.next,c===i?r.pending=null:(c=c.next,i.next=c,Ky(r,c)))}function Xp(r,i,c){var p=r.pending;if(r.pending=null,p!==null){p=p.next;do i.status="rejected",i.reason=c,Xy(i),i=i.next;while(i!==p)}r.action=null}function Xy(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Jy(r,i){return i}function eb(r,i){if(ct){var c=Et.formState;if(c!==null){e:{var p=Ye;if(ct){if(Mt){t:{for(var v=Mt,x=Sr;v.nodeType!==8;){if(!x){v=null;break t}if(v=Cr(v.nextSibling),v===null){v=null;break t}}x=v.data,v=x==="F!"||x==="F"?v:null}if(v){Mt=Cr(v.nextSibling),p=v.data==="F!";break e}}Ka(p)}p=!1}p&&(i=c[0])}}return c=Rn(),c.memoizedState=c.baseState=i,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jy,lastRenderedState:i},c.queue=p,c=bb.bind(null,Ye,p),p.dispatch=c,p=Qp(!1),x=af.bind(null,Ye,!1,p.queue),p=Rn(),v={state:i,dispatch:null,action:r,pending:null},p.queue=v,c=YE.bind(null,Ye,v,x,c),v.dispatch=c,p.memoizedState=r,[i,c,!1]}function tb(r){var i=Xt();return nb(i,St,r)}function nb(r,i,c){if(i=Kp(r,i,Jy)[0],r=zc(ka)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var p=qo(i)}catch(C){throw C===Ts?Nc:C}else p=i;i=Xt();var v=i.queue,x=v.dispatch;return c!==i.memoizedState&&(Ye.flags|=2048,Ms(9,{destroy:void 0},QE.bind(null,v,c),null)),[p,x,r]}function QE(r,i){r.action=i}function rb(r){var i=Xt(),c=St;if(c!==null)return nb(i,c,r);Xt(),i=i.memoizedState,c=Xt();var p=c.queue.dispatch;return c.memoizedState=r,[i,p,!1]}function Ms(r,i,c,p){return r={tag:r,create:c,deps:p,inst:i,next:null},i=Ye.updateQueue,i===null&&(i=Mc(),Ye.updateQueue=i),c=i.lastEffect,c===null?i.lastEffect=r.next=r:(p=c.next,c.next=r,r.next=p,i.lastEffect=r),r}function ab(){return Xt().memoizedState}function $c(r,i,c,p){var v=Rn();Ye.flags|=r,v.memoizedState=Ms(1|i,{destroy:void 0},c,p===void 0?null:p)}function Ic(r,i,c,p){var v=Xt();p=p===void 0?null:p;var x=v.memoizedState.inst;St!==null&&p!==null&&Hp(p,St.memoizedState.deps)?v.memoizedState=Ms(i,x,c,p):(Ye.flags|=r,v.memoizedState=Ms(1|i,x,c,p))}function ib(r,i){$c(8390656,8,r,i)}function Jp(r,i){Ic(2048,8,r,i)}function XE(r){Ye.flags|=4;var i=Ye.updateQueue;if(i===null)i=Mc(),Ye.updateQueue=i,i.events=[r];else{var c=i.events;c===null?i.events=[r]:c.push(r)}}function sb(r){var i=Xt().memoizedState;return XE({ref:i,nextImpl:r}),function(){if((yt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function ob(r,i){return Ic(4,2,r,i)}function lb(r,i){return Ic(4,4,r,i)}function cb(r,i){if(typeof i=="function"){r=r();var c=i(r);return function(){typeof c=="function"?c():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function ub(r,i,c){c=c!=null?c.concat([r]):null,Ic(4,4,cb.bind(null,i,r),c)}function ef(){}function db(r,i){var c=Xt();i=i===void 0?null:i;var p=c.memoizedState;return i!==null&&Hp(i,p[1])?p[0]:(c.memoizedState=[r,i],r)}function pb(r,i){var c=Xt();i=i===void 0?null:i;var p=c.memoizedState;if(i!==null&&Hp(i,p[1]))return p[0];if(p=r(),Ii){et(!0);try{r()}finally{et(!1)}}return c.memoizedState=[p,i],p}function tf(r,i,c){return c===void 0||(wa&1073741824)!==0&&(st&261930)===0?r.memoizedState=i:(r.memoizedState=c,r=f0(),Ye.lanes|=r,ai|=r,c)}function fb(r,i,c,p){return Yn(c,i)?c:Rs.current!==null?(r=tf(r,c,p),Yn(r,i)||(an=!0),r):(wa&42)===0||(wa&1073741824)!==0&&(st&261930)===0?(an=!0,r.memoizedState=c):(r=f0(),Ye.lanes|=r,ai|=r,i)}function hb(r,i,c,p,v){var x=W.p;W.p=x!==0&&8>x?x:8;var C=B.T,M={};B.T=M,af(r,!1,i,c);try{var Y=v(),ae=B.S;if(ae!==null&&ae(M,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var pe=WE(Y,p);Go(r,i,pe,nr(r))}else Go(r,i,p,nr(r))}catch(me){Go(r,i,{then:function(){},status:"rejected",reason:me},nr())}finally{W.p=x,C!==null&&M.types!==null&&(C.types=M.types),B.T=C}}function JE(){}function nf(r,i,c,p){if(r.tag!==5)throw Error(a(476));var v=mb(r).queue;hb(r,v,i,Q,c===null?JE:function(){return gb(r),c(p)})}function mb(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:Q},next:null};var c={};return i.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:c},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function gb(r){var i=mb(r);i.next===null&&(i=r.alternate.memoizedState),Go(r,i.next.queue,{},nr())}function rf(){return wn(ll)}function vb(){return Xt().memoizedState}function yb(){return Xt().memoizedState}function eA(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var c=nr();r=Xa(c);var p=Ja(i,r,c);p!==null&&(Hn(p,i,c),Uo(p,i,c)),i={cache:Op()},r.payload=i;return}i=i.return}}function tA(r,i,c){var p=nr();c={lane:p,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Pc(r)?xb(i,c):(c=wp(r,i,c,p),c!==null&&(Hn(c,r,p),wb(c,i,p)))}function bb(r,i,c){var p=nr();Go(r,i,c,p)}function Go(r,i,c,p){var v={lane:p,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Pc(r))xb(i,v);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=i.lastRenderedReducer,x!==null))try{var C=i.lastRenderedState,M=x(C,c);if(v.hasEagerState=!0,v.eagerState=M,Yn(M,C))return bc(r,i,v,0),Et===null&&yc(),!1}catch{}finally{}if(c=wp(r,i,v,p),c!==null)return Hn(c,r,p),wb(c,i,p),!0}return!1}function af(r,i,c,p){if(p={lane:2,revertLane:$f(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Pc(r)){if(i)throw Error(a(479))}else i=wp(r,c,p,2),i!==null&&Hn(i,r,2)}function Pc(r){var i=r.alternate;return r===Ye||i!==null&&i===Ye}function xb(r,i){Os=Oc=!0;var c=r.pending;c===null?i.next=i:(i.next=c.next,c.next=i),r.pending=i}function wb(r,i,c){if((c&4194048)!==0){var p=i.lanes;p&=r.pendingLanes,c|=p,i.lanes=c,je(r,c)}}var Vo={readContext:wn,use:Dc,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};Vo.useEffectEvent=Zt;var kb={readContext:wn,use:Dc,useCallback:function(r,i){return Rn().memoizedState=[r,i===void 0?null:i],r},useContext:wn,useEffect:ib,useImperativeHandle:function(r,i,c){c=c!=null?c.concat([r]):null,$c(4194308,4,cb.bind(null,i,r),c)},useLayoutEffect:function(r,i){return $c(4194308,4,r,i)},useInsertionEffect:function(r,i){$c(4,2,r,i)},useMemo:function(r,i){var c=Rn();i=i===void 0?null:i;var p=r();if(Ii){et(!0);try{r()}finally{et(!1)}}return c.memoizedState=[p,i],p},useReducer:function(r,i,c){var p=Rn();if(c!==void 0){var v=c(i);if(Ii){et(!0);try{c(i)}finally{et(!1)}}}else v=i;return p.memoizedState=p.baseState=v,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:v},p.queue=r,r=r.dispatch=tA.bind(null,Ye,r),[p.memoizedState,r]},useRef:function(r){var i=Rn();return r={current:r},i.memoizedState=r},useState:function(r){r=Qp(r);var i=r.queue,c=bb.bind(null,Ye,i);return i.dispatch=c,[r.memoizedState,c]},useDebugValue:ef,useDeferredValue:function(r,i){var c=Rn();return tf(c,r,i)},useTransition:function(){var r=Qp(!1);return r=hb.bind(null,Ye,r.queue,!0,!1),Rn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,c){var p=Ye,v=Rn();if(ct){if(c===void 0)throw Error(a(407));c=c()}else{if(c=i(),Et===null)throw Error(a(349));(st&127)!==0||Hy(p,i,c)}v.memoizedState=c;var x={value:c,getSnapshot:i};return v.queue=x,ib(Gy.bind(null,p,x,r),[r]),p.flags|=2048,Ms(9,{destroy:void 0},qy.bind(null,p,x,c,i),null),c},useId:function(){var r=Rn(),i=Et.identifierPrefix;if(ct){var c=Wr,p=Vr;c=(p&~(1<<32-Ne(p)-1)).toString(32)+c,i="_"+i+"R_"+c,c=Lc++,0<c&&(i+="H"+c.toString(32)),i+="_"}else c=ZE++,i="_"+i+"r_"+c.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:rf,useFormState:eb,useActionState:eb,useOptimistic:function(r){var i=Rn();i.memoizedState=i.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=c,i=af.bind(null,Ye,!0,c),c.dispatch=i,[r,i]},useMemoCache:Zp,useCacheRefresh:function(){return Rn().memoizedState=eA.bind(null,Ye)},useEffectEvent:function(r){var i=Rn(),c={impl:r};return i.memoizedState=c,function(){if((yt&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},sf={readContext:wn,use:Dc,useCallback:db,useContext:wn,useEffect:Jp,useImperativeHandle:ub,useInsertionEffect:ob,useLayoutEffect:lb,useMemo:pb,useReducer:zc,useRef:ab,useState:function(){return zc(ka)},useDebugValue:ef,useDeferredValue:function(r,i){var c=Xt();return fb(c,St.memoizedState,r,i)},useTransition:function(){var r=zc(ka)[0],i=Xt().memoizedState;return[typeof r=="boolean"?r:qo(r),i]},useSyncExternalStore:Fy,useId:vb,useHostTransitionStatus:rf,useFormState:tb,useActionState:tb,useOptimistic:function(r,i){var c=Xt();return Zy(c,St,r,i)},useMemoCache:Zp,useCacheRefresh:yb};sf.useEffectEvent=sb;var Sb={readContext:wn,use:Dc,useCallback:db,useContext:wn,useEffect:Jp,useImperativeHandle:ub,useInsertionEffect:ob,useLayoutEffect:lb,useMemo:pb,useReducer:Yp,useRef:ab,useState:function(){return Yp(ka)},useDebugValue:ef,useDeferredValue:function(r,i){var c=Xt();return St===null?tf(c,r,i):fb(c,St.memoizedState,r,i)},useTransition:function(){var r=Yp(ka)[0],i=Xt().memoizedState;return[typeof r=="boolean"?r:qo(r),i]},useSyncExternalStore:Fy,useId:vb,useHostTransitionStatus:rf,useFormState:rb,useActionState:rb,useOptimistic:function(r,i){var c=Xt();return St!==null?Zy(c,St,r,i):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:Zp,useCacheRefresh:yb};Sb.useEffectEvent=sb;function of(r,i,c,p){i=r.memoizedState,c=c(p,i),c=c==null?i:m({},i,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var lf={enqueueSetState:function(r,i,c){r=r._reactInternals;var p=nr(),v=Xa(p);v.payload=i,c!=null&&(v.callback=c),i=Ja(r,v,p),i!==null&&(Hn(i,r,p),Uo(i,r,p))},enqueueReplaceState:function(r,i,c){r=r._reactInternals;var p=nr(),v=Xa(p);v.tag=1,v.payload=i,c!=null&&(v.callback=c),i=Ja(r,v,p),i!==null&&(Hn(i,r,p),Uo(i,r,p))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var c=nr(),p=Xa(c);p.tag=2,i!=null&&(p.callback=i),i=Ja(r,p,c),i!==null&&(Hn(i,r,c),Uo(i,r,c))}};function jb(r,i,c,p,v,x,C){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(p,x,C):i.prototype&&i.prototype.isPureReactComponent?!Oo(c,p)||!Oo(v,x):!0}function Cb(r,i,c,p){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(c,p),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(c,p),i.state!==r&&lf.enqueueReplaceState(i,i.state,null)}function Pi(r,i){var c=i;if("ref"in i){c={};for(var p in i)p!=="ref"&&(c[p]=i[p])}if(r=r.defaultProps){c===i&&(c=m({},c));for(var v in r)c[v]===void 0&&(c[v]=r[v])}return c}function Nb(r){vc(r)}function Eb(r){console.error(r)}function Ab(r){vc(r)}function Uc(r,i){try{var c=r.onUncaughtError;c(i.value,{componentStack:i.stack})}catch(p){setTimeout(function(){throw p})}}function Tb(r,i,c){try{var p=r.onCaughtError;p(c.value,{componentStack:c.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function cf(r,i,c){return c=Xa(c),c.tag=3,c.payload={element:null},c.callback=function(){Uc(r,i)},c}function _b(r){return r=Xa(r),r.tag=3,r}function Rb(r,i,c,p){var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var x=p.value;r.payload=function(){return v(x)},r.callback=function(){Tb(i,c,p)}}var C=c.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(r.callback=function(){Tb(i,c,p),typeof v!="function"&&(ii===null?ii=new Set([this]):ii.add(this));var M=p.stack;this.componentDidCatch(p.value,{componentStack:M!==null?M:""})})}function nA(r,i,c,p,v){if(c.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(i=c.alternate,i!==null&&Ns(i,c,v,!0),c=Xn.current,c!==null){switch(c.tag){case 31:case 13:return jr===null?Xc():c.alternate===null&&Kt===0&&(Kt=3),c.flags&=-257,c.flags|=65536,c.lanes=v,p===Ec?c.flags|=16384:(i=c.updateQueue,i===null?c.updateQueue=new Set([p]):i.add(p),Mf(r,p,v)),!1;case 22:return c.flags|=65536,p===Ec?c.flags|=16384:(i=c.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([p])},c.updateQueue=i):(c=i.retryQueue,c===null?i.retryQueue=new Set([p]):c.add(p)),Mf(r,p,v)),!1}throw Error(a(435,c.tag))}return Mf(r,p,v),Xc(),!1}if(ct)return i=Xn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=v,p!==Ep&&(r=Error(a(422),{cause:p}),Do(xr(r,c)))):(p!==Ep&&(i=Error(a(423),{cause:p}),Do(xr(i,c))),r=r.current.alternate,r.flags|=65536,v&=-v,r.lanes|=v,p=xr(p,c),v=cf(r.stateNode,p,v),Ip(r,v),Kt!==4&&(Kt=2)),!1;var x=Error(a(520),{cause:p});if(x=xr(x,c),el===null?el=[x]:el.push(x),Kt!==4&&(Kt=2),i===null)return!0;p=xr(p,c),c=i;do{switch(c.tag){case 3:return c.flags|=65536,r=v&-v,c.lanes|=r,r=cf(c.stateNode,p,r),Ip(c,r),!1;case 1:if(i=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ii===null||!ii.has(x))))return c.flags|=65536,v&=-v,c.lanes|=v,v=_b(v),Rb(v,r,c,p),Ip(c,v),!1}c=c.return}while(c!==null);return!1}var uf=Error(a(461)),an=!1;function kn(r,i,c,p){i.child=r===null?Dy(i,null,c,p):$i(i,r.child,c,p)}function Ob(r,i,c,p,v){c=c.render;var x=i.ref;if("ref"in p){var C={};for(var M in p)M!=="ref"&&(C[M]=p[M])}else C=p;return Li(i),p=qp(r,i,c,C,x,v),M=Gp(),r!==null&&!an?(Vp(r,i,v),Sa(r,i,v)):(ct&&M&&Cp(i),i.flags|=1,kn(r,i,p,v),i.child)}function Lb(r,i,c,p,v){if(r===null){var x=c.type;return typeof x=="function"&&!kp(x)&&x.defaultProps===void 0&&c.compare===null?(i.tag=15,i.type=x,Mb(r,i,x,p,v)):(r=wc(c.type,null,p,i,i.mode,v),r.ref=i.ref,r.return=i,i.child=r)}if(x=r.child,!yf(r,v)){var C=x.memoizedProps;if(c=c.compare,c=c!==null?c:Oo,c(C,p)&&r.ref===i.ref)return Sa(r,i,v)}return i.flags|=1,r=va(x,p),r.ref=i.ref,r.return=i,i.child=r}function Mb(r,i,c,p,v){if(r!==null){var x=r.memoizedProps;if(Oo(x,p)&&r.ref===i.ref)if(an=!1,i.pendingProps=p=x,yf(r,v))(r.flags&131072)!==0&&(an=!0);else return i.lanes=r.lanes,Sa(r,i,v)}return df(r,i,c,p,v)}function Db(r,i,c,p){var v=p.children,x=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((i.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,r!==null){for(p=i.child=r.child,v=0;p!==null;)v=v|p.lanes|p.childLanes,p=p.sibling;p=v&~x}else p=0,i.child=null;return zb(r,i,x,c,p)}if((c&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&Cc(i,x!==null?x.cachePool:null),x!==null?Iy(i,x):Up(),Py(i);else return p=i.lanes=536870912,zb(r,i,x!==null?x.baseLanes|c:c,c,p)}else x!==null?(Cc(i,x.cachePool),Iy(i,x),ti(),i.memoizedState=null):(r!==null&&Cc(i,null),Up(),ti());return kn(r,i,v,c),i.child}function Wo(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function zb(r,i,c,p,v){var x=Mp();return x=x===null?null:{parent:nn._currentValue,pool:x},i.memoizedState={baseLanes:c,cachePool:x},r!==null&&Cc(i,null),Up(),Py(i),r!==null&&Ns(r,i,p,!0),i.childLanes=v,null}function Bc(r,i){return i=Hc({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function $b(r,i,c){return $i(i,r.child,null,c),r=Bc(i,i.pendingProps),r.flags|=2,Jn(i),i.memoizedState=null,r}function rA(r,i,c){var p=i.pendingProps,v=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(ct){if(p.mode==="hidden")return r=Bc(i,p),i.lanes=536870912,Wo(null,r);if(Fp(i),(r=Mt)?(r=K0(r,Sr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Wa!==null?{id:Vr,overflow:Wr}:null,retryLane:536870912,hydrationErrors:null},c=xy(r),c.return=i,i.child=c,xn=i,Mt=null)):r=null,r===null)throw Ka(i);return i.lanes=536870912,null}return Bc(i,p)}var x=r.memoizedState;if(x!==null){var C=x.dehydrated;if(Fp(i),v)if(i.flags&256)i.flags&=-257,i=$b(r,i,c);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(an||Ns(r,i,c,!1),v=(c&r.childLanes)!==0,an||v){if(p=Et,p!==null&&(C=Ae(p,c),C!==0&&C!==x.retryLane))throw x.retryLane=C,Ti(r,C),Hn(p,r,C),uf;Xc(),i=$b(r,i,c)}else r=x.treeContext,Mt=Cr(C.nextSibling),xn=i,ct=!0,Za=null,Sr=!1,r!==null&&Sy(i,r),i=Bc(i,p),i.flags|=4096;return i}return r=va(r.child,{mode:p.mode,children:p.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Fc(r,i){var c=i.ref;if(c===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(a(284));(r===null||r.ref!==c)&&(i.flags|=4194816)}}function df(r,i,c,p,v){return Li(i),c=qp(r,i,c,p,void 0,v),p=Gp(),r!==null&&!an?(Vp(r,i,v),Sa(r,i,v)):(ct&&p&&Cp(i),i.flags|=1,kn(r,i,c,v),i.child)}function Ib(r,i,c,p,v,x){return Li(i),i.updateQueue=null,c=By(i,p,c,v),Uy(r),p=Gp(),r!==null&&!an?(Vp(r,i,x),Sa(r,i,x)):(ct&&p&&Cp(i),i.flags|=1,kn(r,i,c,x),i.child)}function Pb(r,i,c,p,v){if(Li(i),i.stateNode===null){var x=ks,C=c.contextType;typeof C=="object"&&C!==null&&(x=wn(C)),x=new c(p,x),i.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=lf,i.stateNode=x,x._reactInternals=i,x=i.stateNode,x.props=p,x.state=i.memoizedState,x.refs={},zp(i),C=c.contextType,x.context=typeof C=="object"&&C!==null?wn(C):ks,x.state=i.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(of(i,c,C,p),x.state=i.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(C=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),C!==x.state&&lf.enqueueReplaceState(x,x.state,null),Fo(i,p,x,v),Bo(),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308),p=!0}else if(r===null){x=i.stateNode;var M=i.memoizedProps,Y=Pi(c,M);x.props=Y;var ae=x.context,pe=c.contextType;C=ks,typeof pe=="object"&&pe!==null&&(C=wn(pe));var me=c.getDerivedStateFromProps;pe=typeof me=="function"||typeof x.getSnapshotBeforeUpdate=="function",M=i.pendingProps!==M,pe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(M||ae!==C)&&Cb(i,x,p,C),Qa=!1;var se=i.memoizedState;x.state=se,Fo(i,p,x,v),Bo(),ae=i.memoizedState,M||se!==ae||Qa?(typeof me=="function"&&(of(i,c,me,p),ae=i.memoizedState),(Y=Qa||jb(i,c,Y,p,se,ae,C))?(pe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(i.flags|=4194308)):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=p,i.memoizedState=ae),x.props=p,x.state=ae,x.context=C,p=Y):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),p=!1)}else{x=i.stateNode,$p(r,i),C=i.memoizedProps,pe=Pi(c,C),x.props=pe,me=i.pendingProps,se=x.context,ae=c.contextType,Y=ks,typeof ae=="object"&&ae!==null&&(Y=wn(ae)),M=c.getDerivedStateFromProps,(ae=typeof M=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(C!==me||se!==Y)&&Cb(i,x,p,Y),Qa=!1,se=i.memoizedState,x.state=se,Fo(i,p,x,v),Bo();var oe=i.memoizedState;C!==me||se!==oe||Qa||r!==null&&r.dependencies!==null&&Sc(r.dependencies)?(typeof M=="function"&&(of(i,c,M,p),oe=i.memoizedState),(pe=Qa||jb(i,c,pe,p,se,oe,Y)||r!==null&&r.dependencies!==null&&Sc(r.dependencies))?(ae||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(p,oe,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"||C===r.memoizedProps&&se===r.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||C===r.memoizedProps&&se===r.memoizedState||(i.flags|=1024),i.memoizedProps=p,i.memoizedState=oe),x.props=p,x.state=oe,x.context=Y,p=pe):(typeof x.componentDidUpdate!="function"||C===r.memoizedProps&&se===r.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||C===r.memoizedProps&&se===r.memoizedState||(i.flags|=1024),p=!1)}return x=p,Fc(r,i),p=(i.flags&128)!==0,x||p?(x=i.stateNode,c=p&&typeof c.getDerivedStateFromError!="function"?null:x.render(),i.flags|=1,r!==null&&p?(i.child=$i(i,r.child,null,v),i.child=$i(i,null,c,v)):kn(r,i,c,v),i.memoizedState=x.state,r=i.child):r=Sa(r,i,v),r}function Ub(r,i,c,p){return Ri(),i.flags|=256,kn(r,i,c,p),i.child}var pf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ff(r){return{baseLanes:r,cachePool:Ty()}}function hf(r,i,c){return r=r!==null?r.childLanes&~c:0,i&&(r|=tr),r}function Bb(r,i,c){var p=i.pendingProps,v=!1,x=(i.flags&128)!==0,C;if((C=x)||(C=r!==null&&r.memoizedState===null?!1:(Qt.current&2)!==0),C&&(v=!0,i.flags&=-129),C=(i.flags&32)!==0,i.flags&=-33,r===null){if(ct){if(v?ei(i):ti(),(r=Mt)?(r=K0(r,Sr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Wa!==null?{id:Vr,overflow:Wr}:null,retryLane:536870912,hydrationErrors:null},c=xy(r),c.return=i,i.child=c,xn=i,Mt=null)):r=null,r===null)throw Ka(i);return Yf(r)?i.lanes=32:i.lanes=536870912,null}var M=p.children;return p=p.fallback,v?(ti(),v=i.mode,M=Hc({mode:"hidden",children:M},v),p=_i(p,v,c,null),M.return=i,p.return=i,M.sibling=p,i.child=M,p=i.child,p.memoizedState=ff(c),p.childLanes=hf(r,C,c),i.memoizedState=pf,Wo(null,p)):(ei(i),mf(i,M))}var Y=r.memoizedState;if(Y!==null&&(M=Y.dehydrated,M!==null)){if(x)i.flags&256?(ei(i),i.flags&=-257,i=gf(r,i,c)):i.memoizedState!==null?(ti(),i.child=r.child,i.flags|=128,i=null):(ti(),M=p.fallback,v=i.mode,p=Hc({mode:"visible",children:p.children},v),M=_i(M,v,c,null),M.flags|=2,p.return=i,M.return=i,p.sibling=M,i.child=p,$i(i,r.child,null,c),p=i.child,p.memoizedState=ff(c),p.childLanes=hf(r,C,c),i.memoizedState=pf,i=Wo(null,p));else if(ei(i),Yf(M)){if(C=M.nextSibling&&M.nextSibling.dataset,C)var ae=C.dgst;C=ae,p=Error(a(419)),p.stack="",p.digest=C,Do({value:p,source:null,stack:null}),i=gf(r,i,c)}else if(an||Ns(r,i,c,!1),C=(c&r.childLanes)!==0,an||C){if(C=Et,C!==null&&(p=Ae(C,c),p!==0&&p!==Y.retryLane))throw Y.retryLane=p,Ti(r,p),Hn(C,r,p),uf;Kf(M)||Xc(),i=gf(r,i,c)}else Kf(M)?(i.flags|=192,i.child=r.child,i=null):(r=Y.treeContext,Mt=Cr(M.nextSibling),xn=i,ct=!0,Za=null,Sr=!1,r!==null&&Sy(i,r),i=mf(i,p.children),i.flags|=4096);return i}return v?(ti(),M=p.fallback,v=i.mode,Y=r.child,ae=Y.sibling,p=va(Y,{mode:"hidden",children:p.children}),p.subtreeFlags=Y.subtreeFlags&65011712,ae!==null?M=va(ae,M):(M=_i(M,v,c,null),M.flags|=2),M.return=i,p.return=i,p.sibling=M,i.child=p,Wo(null,p),p=i.child,M=r.child.memoizedState,M===null?M=ff(c):(v=M.cachePool,v!==null?(Y=nn._currentValue,v=v.parent!==Y?{parent:Y,pool:Y}:v):v=Ty(),M={baseLanes:M.baseLanes|c,cachePool:v}),p.memoizedState=M,p.childLanes=hf(r,C,c),i.memoizedState=pf,Wo(r.child,p)):(ei(i),c=r.child,r=c.sibling,c=va(c,{mode:"visible",children:p.children}),c.return=i,c.sibling=null,r!==null&&(C=i.deletions,C===null?(i.deletions=[r],i.flags|=16):C.push(r)),i.child=c,i.memoizedState=null,c)}function mf(r,i){return i=Hc({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Hc(r,i){return r=Qn(22,r,null,i),r.lanes=0,r}function gf(r,i,c){return $i(i,r.child,null,c),r=mf(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function Fb(r,i,c){r.lanes|=i;var p=r.alternate;p!==null&&(p.lanes|=i),_p(r.return,i,c)}function vf(r,i,c,p,v,x){var C=r.memoizedState;C===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:p,tail:c,tailMode:v,treeForkCount:x}:(C.isBackwards=i,C.rendering=null,C.renderingStartTime=0,C.last=p,C.tail=c,C.tailMode=v,C.treeForkCount=x)}function Hb(r,i,c){var p=i.pendingProps,v=p.revealOrder,x=p.tail;p=p.children;var C=Qt.current,M=(C&2)!==0;if(M?(C=C&1|2,i.flags|=128):C&=1,O(Qt,C),kn(r,i,p,c),p=ct?Mo:0,!M&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Fb(r,c,i);else if(r.tag===19)Fb(r,c,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(v){case"forwards":for(c=i.child,v=null;c!==null;)r=c.alternate,r!==null&&Rc(r)===null&&(v=c),c=c.sibling;c=v,c===null?(v=i.child,i.child=null):(v=c.sibling,c.sibling=null),vf(i,!1,v,c,x,p);break;case"backwards":case"unstable_legacy-backwards":for(c=null,v=i.child,i.child=null;v!==null;){if(r=v.alternate,r!==null&&Rc(r)===null){i.child=v;break}r=v.sibling,v.sibling=c,c=v,v=r}vf(i,!0,c,null,x,p);break;case"together":vf(i,!1,null,null,void 0,p);break;default:i.memoizedState=null}return i.child}function Sa(r,i,c){if(r!==null&&(i.dependencies=r.dependencies),ai|=i.lanes,(c&i.childLanes)===0)if(r!==null){if(Ns(r,i,c,!1),(c&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(a(153));if(i.child!==null){for(r=i.child,c=va(r,r.pendingProps),i.child=c,c.return=i;r.sibling!==null;)r=r.sibling,c=c.sibling=va(r,r.pendingProps),c.return=i;c.sibling=null}return i.child}function yf(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&Sc(r)))}function aA(r,i,c){switch(i.tag){case 3:_e(i,i.stateNode.containerInfo),Ya(i,nn,r.memoizedState.cache),Ri();break;case 27:case 5:Ie(i);break;case 4:_e(i,i.stateNode.containerInfo);break;case 10:Ya(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Fp(i),null;break;case 13:var p=i.memoizedState;if(p!==null)return p.dehydrated!==null?(ei(i),i.flags|=128,null):(c&i.child.childLanes)!==0?Bb(r,i,c):(ei(i),r=Sa(r,i,c),r!==null?r.sibling:null);ei(i);break;case 19:var v=(r.flags&128)!==0;if(p=(c&i.childLanes)!==0,p||(Ns(r,i,c,!1),p=(c&i.childLanes)!==0),v){if(p)return Hb(r,i,c);i.flags|=128}if(v=i.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),O(Qt,Qt.current),p)break;return null;case 22:return i.lanes=0,Db(r,i,c,i.pendingProps);case 24:Ya(i,nn,r.memoizedState.cache)}return Sa(r,i,c)}function qb(r,i,c){if(r!==null)if(r.memoizedProps!==i.pendingProps)an=!0;else{if(!yf(r,c)&&(i.flags&128)===0)return an=!1,aA(r,i,c);an=(r.flags&131072)!==0}else an=!1,ct&&(i.flags&1048576)!==0&&ky(i,Mo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var p=i.pendingProps;if(r=Di(i.elementType),i.type=r,typeof r=="function")kp(r)?(p=Pi(r,p),i.tag=1,i=Pb(null,i,r,p,c)):(i.tag=0,i=df(null,i,r,p,c));else{if(r!=null){var v=r.$$typeof;if(v===T){i.tag=11,i=Ob(null,i,r,p,c);break e}else if(v===z){i.tag=14,i=Lb(null,i,r,p,c);break e}}throw i=I(r)||r,Error(a(306,i,""))}}return i;case 0:return df(r,i,i.type,i.pendingProps,c);case 1:return p=i.type,v=Pi(p,i.pendingProps),Pb(r,i,p,v,c);case 3:e:{if(_e(i,i.stateNode.containerInfo),r===null)throw Error(a(387));p=i.pendingProps;var x=i.memoizedState;v=x.element,$p(r,i),Fo(i,p,null,c);var C=i.memoizedState;if(p=C.cache,Ya(i,nn,p),p!==x.cache&&Rp(i,[nn],c,!0),Bo(),p=C.element,x.isDehydrated)if(x={element:p,isDehydrated:!1,cache:C.cache},i.updateQueue.baseState=x,i.memoizedState=x,i.flags&256){i=Ub(r,i,p,c);break e}else if(p!==v){v=xr(Error(a(424)),i),Do(v),i=Ub(r,i,p,c);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Mt=Cr(r.firstChild),xn=i,ct=!0,Za=null,Sr=!0,c=Dy(i,null,p,c),i.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Ri(),p===v){i=Sa(r,i,c);break e}kn(r,i,p,c)}i=i.child}return i;case 26:return Fc(r,i),r===null?(c=tx(i.type,null,i.pendingProps,null))?i.memoizedState=c:ct||(c=i.type,r=i.pendingProps,p=iu(le.current).createElement(c),p[Gt]=i,p[un]=r,Sn(p,c,r),Lt(p),i.stateNode=p):i.memoizedState=tx(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Ie(i),r===null&&ct&&(p=i.stateNode=X0(i.type,i.pendingProps,le.current),xn=i,Sr=!0,v=Mt,ci(i.type)?(Qf=v,Mt=Cr(p.firstChild)):Mt=v),kn(r,i,i.pendingProps.children,c),Fc(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&ct&&((v=p=Mt)&&(p=MA(p,i.type,i.pendingProps,Sr),p!==null?(i.stateNode=p,xn=i,Mt=Cr(p.firstChild),Sr=!1,v=!0):v=!1),v||Ka(i)),Ie(i),v=i.type,x=i.pendingProps,C=r!==null?r.memoizedProps:null,p=x.children,Vf(v,x)?p=null:C!==null&&Vf(v,C)&&(i.flags|=32),i.memoizedState!==null&&(v=qp(r,i,KE,null,null,c),ll._currentValue=v),Fc(r,i),kn(r,i,p,c),i.child;case 6:return r===null&&ct&&((r=c=Mt)&&(c=DA(c,i.pendingProps,Sr),c!==null?(i.stateNode=c,xn=i,Mt=null,r=!0):r=!1),r||Ka(i)),null;case 13:return Bb(r,i,c);case 4:return _e(i,i.stateNode.containerInfo),p=i.pendingProps,r===null?i.child=$i(i,null,p,c):kn(r,i,p,c),i.child;case 11:return Ob(r,i,i.type,i.pendingProps,c);case 7:return kn(r,i,i.pendingProps,c),i.child;case 8:return kn(r,i,i.pendingProps.children,c),i.child;case 12:return kn(r,i,i.pendingProps.children,c),i.child;case 10:return p=i.pendingProps,Ya(i,i.type,p.value),kn(r,i,p.children,c),i.child;case 9:return v=i.type._context,p=i.pendingProps.children,Li(i),v=wn(v),p=p(v),i.flags|=1,kn(r,i,p,c),i.child;case 14:return Lb(r,i,i.type,i.pendingProps,c);case 15:return Mb(r,i,i.type,i.pendingProps,c);case 19:return Hb(r,i,c);case 31:return rA(r,i,c);case 22:return Db(r,i,c,i.pendingProps);case 24:return Li(i),p=wn(nn),r===null?(v=Mp(),v===null&&(v=Et,x=Op(),v.pooledCache=x,x.refCount++,x!==null&&(v.pooledCacheLanes|=c),v=x),i.memoizedState={parent:p,cache:v},zp(i),Ya(i,nn,v)):((r.lanes&c)!==0&&($p(r,i),Fo(i,null,null,c),Bo()),v=r.memoizedState,x=i.memoizedState,v.parent!==p?(v={parent:p,cache:p},i.memoizedState=v,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=v),Ya(i,nn,p)):(p=x.cache,Ya(i,nn,p),p!==v.cache&&Rp(i,[nn],c,!0))),kn(r,i,i.pendingProps.children,c),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function ja(r){r.flags|=4}function bf(r,i,c,p,v){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(v&335544128)===v)if(r.stateNode.complete)r.flags|=8192;else if(v0())r.flags|=8192;else throw zi=Ec,Dp}else r.flags&=-16777217}function Gb(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!sx(i))if(v0())r.flags|=8192;else throw zi=Ec,Dp}function qc(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?qa():536870912,r.lanes|=i,Is|=i)}function Zo(r,i){if(!ct)switch(r.tailMode){case"hidden":i=r.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var p=null;c!==null;)c.alternate!==null&&(p=c),c=c.sibling;p===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:p.sibling=null}}function Dt(r){var i=r.alternate!==null&&r.alternate.child===r.child,c=0,p=0;if(i)for(var v=r.child;v!==null;)c|=v.lanes|v.childLanes,p|=v.subtreeFlags&65011712,p|=v.flags&65011712,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)c|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=p,r.childLanes=c,i}function iA(r,i,c){var p=i.pendingProps;switch(Np(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(i),null;case 1:return Dt(i),null;case 3:return c=i.stateNode,p=null,r!==null&&(p=r.memoizedState.cache),i.memoizedState.cache!==p&&(i.flags|=2048),xa(nn),Ee(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Cs(i)?ja(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Ap())),Dt(i),null;case 26:var v=i.type,x=i.memoizedState;return r===null?(ja(i),x!==null?(Dt(i),Gb(i,x)):(Dt(i),bf(i,v,null,p,c))):x?x!==r.memoizedState?(ja(i),Dt(i),Gb(i,x)):(Dt(i),i.flags&=-16777217):(r=r.memoizedProps,r!==p&&ja(i),Dt(i),bf(i,v,r,p,c)),null;case 27:if(We(i),c=le.current,v=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==p&&ja(i);else{if(!p){if(i.stateNode===null)throw Error(a(166));return Dt(i),null}r=ne.current,Cs(i)?jy(i):(r=X0(v,p,c),i.stateNode=r,ja(i))}return Dt(i),null;case 5:if(We(i),v=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==p&&ja(i);else{if(!p){if(i.stateNode===null)throw Error(a(166));return Dt(i),null}if(x=ne.current,Cs(i))jy(i);else{var C=iu(le.current);switch(x){case 1:x=C.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:x=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":x=C.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":x=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":x=C.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof p.is=="string"?C.createElement("select",{is:p.is}):C.createElement("select"),p.multiple?x.multiple=!0:p.size&&(x.size=p.size);break;default:x=typeof p.is=="string"?C.createElement(v,{is:p.is}):C.createElement(v)}}x[Gt]=i,x[un]=p;e:for(C=i.child;C!==null;){if(C.tag===5||C.tag===6)x.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===i)break e;for(;C.sibling===null;){if(C.return===null||C.return===i)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}i.stateNode=x;e:switch(Sn(x,v,p),v){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&ja(i)}}return Dt(i),bf(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,c),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==p&&ja(i);else{if(typeof p!="string"&&i.stateNode===null)throw Error(a(166));if(r=le.current,Cs(i)){if(r=i.stateNode,c=i.memoizedProps,p=null,v=xn,v!==null)switch(v.tag){case 27:case 5:p=v.memoizedProps}r[Gt]=i,r=!!(r.nodeValue===c||p!==null&&p.suppressHydrationWarning===!0||B0(r.nodeValue,c)),r||Ka(i,!0)}else r=iu(r).createTextNode(p),r[Gt]=i,i.stateNode=r}return Dt(i),null;case 31:if(c=i.memoizedState,r===null||r.memoizedState!==null){if(p=Cs(i),c!==null){if(r===null){if(!p)throw Error(a(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[Gt]=i}else Ri(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Dt(i),r=!1}else c=Ap(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return i.flags&256?(Jn(i),i):(Jn(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Dt(i),null;case 13:if(p=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(v=Cs(i),p!==null&&p.dehydrated!==null){if(r===null){if(!v)throw Error(a(318));if(v=i.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(a(317));v[Gt]=i}else Ri(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Dt(i),v=!1}else v=Ap(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=v),v=!0;if(!v)return i.flags&256?(Jn(i),i):(Jn(i),null)}return Jn(i),(i.flags&128)!==0?(i.lanes=c,i):(c=p!==null,r=r!==null&&r.memoizedState!==null,c&&(p=i.child,v=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(v=p.alternate.memoizedState.cachePool.pool),x=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(x=p.memoizedState.cachePool.pool),x!==v&&(p.flags|=2048)),c!==r&&c&&(i.child.flags|=8192),qc(i,i.updateQueue),Dt(i),null);case 4:return Ee(),r===null&&Bf(i.stateNode.containerInfo),Dt(i),null;case 10:return xa(i.type),Dt(i),null;case 19:if(G(Qt),p=i.memoizedState,p===null)return Dt(i),null;if(v=(i.flags&128)!==0,x=p.rendering,x===null)if(v)Zo(p,!1);else{if(Kt!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(x=Rc(r),x!==null){for(i.flags|=128,Zo(p,!1),r=x.updateQueue,i.updateQueue=r,qc(i,r),i.subtreeFlags=0,r=c,c=i.child;c!==null;)by(c,r),c=c.sibling;return O(Qt,Qt.current&1|2),ct&&ya(i,p.treeForkCount),i.child}r=r.sibling}p.tail!==null&&ut()>Kc&&(i.flags|=128,v=!0,Zo(p,!1),i.lanes=4194304)}else{if(!v)if(r=Rc(x),r!==null){if(i.flags|=128,v=!0,r=r.updateQueue,i.updateQueue=r,qc(i,r),Zo(p,!0),p.tail===null&&p.tailMode==="hidden"&&!x.alternate&&!ct)return Dt(i),null}else 2*ut()-p.renderingStartTime>Kc&&c!==536870912&&(i.flags|=128,v=!0,Zo(p,!1),i.lanes=4194304);p.isBackwards?(x.sibling=i.child,i.child=x):(r=p.last,r!==null?r.sibling=x:i.child=x,p.last=x)}return p.tail!==null?(r=p.tail,p.rendering=r,p.tail=r.sibling,p.renderingStartTime=ut(),r.sibling=null,c=Qt.current,O(Qt,v?c&1|2:c&1),ct&&ya(i,p.treeForkCount),r):(Dt(i),null);case 22:case 23:return Jn(i),Bp(),p=i.memoizedState!==null,r!==null?r.memoizedState!==null!==p&&(i.flags|=8192):p&&(i.flags|=8192),p?(c&536870912)!==0&&(i.flags&128)===0&&(Dt(i),i.subtreeFlags&6&&(i.flags|=8192)):Dt(i),c=i.updateQueue,c!==null&&qc(i,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),p=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(p=i.memoizedState.cachePool.pool),p!==c&&(i.flags|=2048),r!==null&&G(Mi),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),i.memoizedState.cache!==c&&(i.flags|=2048),xa(nn),Dt(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function sA(r,i){switch(Np(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return xa(nn),Ee(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return We(i),null;case 31:if(i.memoizedState!==null){if(Jn(i),i.alternate===null)throw Error(a(340));Ri()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Jn(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Ri()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return G(Qt),null;case 4:return Ee(),null;case 10:return xa(i.type),null;case 22:case 23:return Jn(i),Bp(),r!==null&&G(Mi),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return xa(nn),null;case 25:return null;default:return null}}function Vb(r,i){switch(Np(i),i.tag){case 3:xa(nn),Ee();break;case 26:case 27:case 5:We(i);break;case 4:Ee();break;case 31:i.memoizedState!==null&&Jn(i);break;case 13:Jn(i);break;case 19:G(Qt);break;case 10:xa(i.type);break;case 22:case 23:Jn(i),Bp(),r!==null&&G(Mi);break;case 24:xa(nn)}}function Ko(r,i){try{var c=i.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var v=p.next;c=v;do{if((c.tag&r)===r){p=void 0;var x=c.create,C=c.inst;p=x(),C.destroy=p}c=c.next}while(c!==v)}}catch(M){kt(i,i.return,M)}}function ni(r,i,c){try{var p=i.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var x=v.next;p=x;do{if((p.tag&r)===r){var C=p.inst,M=C.destroy;if(M!==void 0){C.destroy=void 0,v=i;var Y=c,ae=M;try{ae()}catch(pe){kt(v,Y,pe)}}}p=p.next}while(p!==x)}}catch(pe){kt(i,i.return,pe)}}function Wb(r){var i=r.updateQueue;if(i!==null){var c=r.stateNode;try{$y(i,c)}catch(p){kt(r,r.return,p)}}}function Zb(r,i,c){c.props=Pi(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(p){kt(r,i,p)}}function Yo(r,i){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var p=r.stateNode;break;case 30:p=r.stateNode;break;default:p=r.stateNode}typeof c=="function"?r.refCleanup=c(p):c.current=p}}catch(v){kt(r,i,v)}}function Zr(r,i){var c=r.ref,p=r.refCleanup;if(c!==null)if(typeof p=="function")try{p()}catch(v){kt(r,i,v)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(v){kt(r,i,v)}else c.current=null}function Kb(r){var i=r.type,c=r.memoizedProps,p=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":c.autoFocus&&p.focus();break e;case"img":c.src?p.src=c.src:c.srcSet&&(p.srcset=c.srcSet)}}catch(v){kt(r,r.return,v)}}function xf(r,i,c){try{var p=r.stateNode;AA(p,r.type,c,i),p[un]=i}catch(v){kt(r,r.return,v)}}function Yb(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ci(r.type)||r.tag===4}function wf(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Yb(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ci(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function kf(r,i,c){var p=r.tag;if(p===5||p===6)r=r.stateNode,i?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,i):(i=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,i.appendChild(r),c=c._reactRootContainer,c!=null||i.onclick!==null||(i.onclick=ma));else if(p!==4&&(p===27&&ci(r.type)&&(c=r.stateNode,i=null),r=r.child,r!==null))for(kf(r,i,c),r=r.sibling;r!==null;)kf(r,i,c),r=r.sibling}function Gc(r,i,c){var p=r.tag;if(p===5||p===6)r=r.stateNode,i?c.insertBefore(r,i):c.appendChild(r);else if(p!==4&&(p===27&&ci(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Gc(r,i,c),r=r.sibling;r!==null;)Gc(r,i,c),r=r.sibling}function Qb(r){var i=r.stateNode,c=r.memoizedProps;try{for(var p=r.type,v=i.attributes;v.length;)i.removeAttributeNode(v[0]);Sn(i,p,c),i[Gt]=r,i[un]=c}catch(x){kt(r,r.return,x)}}var Ca=!1,sn=!1,Sf=!1,Xb=typeof WeakSet=="function"?WeakSet:Set,vn=null;function oA(r,i){if(r=r.containerInfo,qf=pu,r=uy(r),mp(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var p=c.getSelection&&c.getSelection();if(p&&p.rangeCount!==0){c=p.anchorNode;var v=p.anchorOffset,x=p.focusNode;p=p.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var C=0,M=-1,Y=-1,ae=0,pe=0,me=r,se=null;t:for(;;){for(var oe;me!==c||v!==0&&me.nodeType!==3||(M=C+v),me!==x||p!==0&&me.nodeType!==3||(Y=C+p),me.nodeType===3&&(C+=me.nodeValue.length),(oe=me.firstChild)!==null;)se=me,me=oe;for(;;){if(me===r)break t;if(se===c&&++ae===v&&(M=C),se===x&&++pe===p&&(Y=C),(oe=me.nextSibling)!==null)break;me=se,se=me.parentNode}me=oe}c=M===-1||Y===-1?null:{start:M,end:Y}}else c=null}c=c||{start:0,end:0}}else c=null;for(Gf={focusedElem:r,selectionRange:c},pu=!1,vn=i;vn!==null;)if(i=vn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,vn=r;else for(;vn!==null;){switch(i=vn,x=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)v=r[c],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&x!==null){r=void 0,c=i,v=x.memoizedProps,x=x.memoizedState,p=c.stateNode;try{var Te=Pi(c.type,v);r=p.getSnapshotBeforeUpdate(Te,x),p.__reactInternalSnapshotBeforeUpdate=r}catch(Be){kt(c,c.return,Be)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,c=r.nodeType,c===9)Zf(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Zf(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=i.sibling,r!==null){r.return=i.return,vn=r;break}vn=i.return}}function Jb(r,i,c){var p=c.flags;switch(c.tag){case 0:case 11:case 15:Ea(r,c),p&4&&Ko(5,c);break;case 1:if(Ea(r,c),p&4)if(r=c.stateNode,i===null)try{r.componentDidMount()}catch(C){kt(c,c.return,C)}else{var v=Pi(c.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(v,i,r.__reactInternalSnapshotBeforeUpdate)}catch(C){kt(c,c.return,C)}}p&64&&Wb(c),p&512&&Yo(c,c.return);break;case 3:if(Ea(r,c),p&64&&(r=c.updateQueue,r!==null)){if(i=null,c.child!==null)switch(c.child.tag){case 27:case 5:i=c.child.stateNode;break;case 1:i=c.child.stateNode}try{$y(r,i)}catch(C){kt(c,c.return,C)}}break;case 27:i===null&&p&4&&Qb(c);case 26:case 5:Ea(r,c),i===null&&p&4&&Kb(c),p&512&&Yo(c,c.return);break;case 12:Ea(r,c);break;case 31:Ea(r,c),p&4&&n0(r,c);break;case 13:Ea(r,c),p&4&&r0(r,c),p&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=gA.bind(null,c),zA(r,c))));break;case 22:if(p=c.memoizedState!==null||Ca,!p){i=i!==null&&i.memoizedState!==null||sn,v=Ca;var x=sn;Ca=p,(sn=i)&&!x?Aa(r,c,(c.subtreeFlags&8772)!==0):Ea(r,c),Ca=v,sn=x}break;case 30:break;default:Ea(r,c)}}function e0(r){var i=r.alternate;i!==null&&(r.alternate=null,e0(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Ga(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var It=null,Pn=!1;function Na(r,i,c){for(c=c.child;c!==null;)t0(r,i,c),c=c.sibling}function t0(r,i,c){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(Ce,c)}catch{}switch(c.tag){case 26:sn||Zr(c,i),Na(r,i,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:sn||Zr(c,i);var p=It,v=Pn;ci(c.type)&&(It=c.stateNode,Pn=!1),Na(r,i,c),il(c.stateNode),It=p,Pn=v;break;case 5:sn||Zr(c,i);case 6:if(p=It,v=Pn,It=null,Na(r,i,c),It=p,Pn=v,It!==null)if(Pn)try{(It.nodeType===9?It.body:It.nodeName==="HTML"?It.ownerDocument.body:It).removeChild(c.stateNode)}catch(x){kt(c,i,x)}else try{It.removeChild(c.stateNode)}catch(x){kt(c,i,x)}break;case 18:It!==null&&(Pn?(r=It,W0(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),Vs(r)):W0(It,c.stateNode));break;case 4:p=It,v=Pn,It=c.stateNode.containerInfo,Pn=!0,Na(r,i,c),It=p,Pn=v;break;case 0:case 11:case 14:case 15:ni(2,c,i),sn||ni(4,c,i),Na(r,i,c);break;case 1:sn||(Zr(c,i),p=c.stateNode,typeof p.componentWillUnmount=="function"&&Zb(c,i,p)),Na(r,i,c);break;case 21:Na(r,i,c);break;case 22:sn=(p=sn)||c.memoizedState!==null,Na(r,i,c),sn=p;break;default:Na(r,i,c)}}function n0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Vs(r)}catch(c){kt(i,i.return,c)}}}function r0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Vs(r)}catch(c){kt(i,i.return,c)}}function lA(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new Xb),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new Xb),i;default:throw Error(a(435,r.tag))}}function Vc(r,i){var c=lA(r);i.forEach(function(p){if(!c.has(p)){c.add(p);var v=vA.bind(null,r,p);p.then(v,v)}})}function Un(r,i){var c=i.deletions;if(c!==null)for(var p=0;p<c.length;p++){var v=c[p],x=r,C=i,M=C;e:for(;M!==null;){switch(M.tag){case 27:if(ci(M.type)){It=M.stateNode,Pn=!1;break e}break;case 5:It=M.stateNode,Pn=!1;break e;case 3:case 4:It=M.stateNode.containerInfo,Pn=!0;break e}M=M.return}if(It===null)throw Error(a(160));t0(x,C,v),It=null,Pn=!1,x=v.alternate,x!==null&&(x.return=null),v.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)a0(i,r),i=i.sibling}var Mr=null;function a0(r,i){var c=r.alternate,p=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Un(i,r),Bn(r),p&4&&(ni(3,r,r.return),Ko(3,r),ni(5,r,r.return));break;case 1:Un(i,r),Bn(r),p&512&&(sn||c===null||Zr(c,c.return)),p&64&&Ca&&(r=r.updateQueue,r!==null&&(p=r.callbacks,p!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?p:c.concat(p))));break;case 26:var v=Mr;if(Un(i,r),Bn(r),p&512&&(sn||c===null||Zr(c,c.return)),p&4){var x=c!==null?c.memoizedState:null;if(p=r.memoizedState,c===null)if(p===null)if(r.stateNode===null){e:{p=r.type,c=r.memoizedProps,v=v.ownerDocument||v;t:switch(p){case"title":x=v.getElementsByTagName("title")[0],(!x||x[Or]||x[Gt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=v.createElement(p),v.head.insertBefore(x,v.querySelector("head > title"))),Sn(x,p,c),x[Gt]=r,Lt(x),p=x;break e;case"link":var C=ax("link","href",v).get(p+(c.href||""));if(C){for(var M=0;M<C.length;M++)if(x=C[M],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){C.splice(M,1);break t}}x=v.createElement(p),Sn(x,p,c),v.head.appendChild(x);break;case"meta":if(C=ax("meta","content",v).get(p+(c.content||""))){for(M=0;M<C.length;M++)if(x=C[M],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){C.splice(M,1);break t}}x=v.createElement(p),Sn(x,p,c),v.head.appendChild(x);break;default:throw Error(a(468,p))}x[Gt]=r,Lt(x),p=x}r.stateNode=p}else ix(v,r.type,r.stateNode);else r.stateNode=rx(v,p,r.memoizedProps);else x!==p?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,p===null?ix(v,r.type,r.stateNode):rx(v,p,r.memoizedProps)):p===null&&r.stateNode!==null&&xf(r,r.memoizedProps,c.memoizedProps)}break;case 27:Un(i,r),Bn(r),p&512&&(sn||c===null||Zr(c,c.return)),c!==null&&p&4&&xf(r,r.memoizedProps,c.memoizedProps);break;case 5:if(Un(i,r),Bn(r),p&512&&(sn||c===null||Zr(c,c.return)),r.flags&32){v=r.stateNode;try{ms(v,"")}catch(Te){kt(r,r.return,Te)}}p&4&&r.stateNode!=null&&(v=r.memoizedProps,xf(r,v,c!==null?c.memoizedProps:v)),p&1024&&(Sf=!0);break;case 6:if(Un(i,r),Bn(r),p&4){if(r.stateNode===null)throw Error(a(162));p=r.memoizedProps,c=r.stateNode;try{c.nodeValue=p}catch(Te){kt(r,r.return,Te)}}break;case 3:if(lu=null,v=Mr,Mr=su(i.containerInfo),Un(i,r),Mr=v,Bn(r),p&4&&c!==null&&c.memoizedState.isDehydrated)try{Vs(i.containerInfo)}catch(Te){kt(r,r.return,Te)}Sf&&(Sf=!1,i0(r));break;case 4:p=Mr,Mr=su(r.stateNode.containerInfo),Un(i,r),Bn(r),Mr=p;break;case 12:Un(i,r),Bn(r);break;case 31:Un(i,r),Bn(r),p&4&&(p=r.updateQueue,p!==null&&(r.updateQueue=null,Vc(r,p)));break;case 13:Un(i,r),Bn(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Zc=ut()),p&4&&(p=r.updateQueue,p!==null&&(r.updateQueue=null,Vc(r,p)));break;case 22:v=r.memoizedState!==null;var Y=c!==null&&c.memoizedState!==null,ae=Ca,pe=sn;if(Ca=ae||v,sn=pe||Y,Un(i,r),sn=pe,Ca=ae,Bn(r),p&8192)e:for(i=r.stateNode,i._visibility=v?i._visibility&-2:i._visibility|1,v&&(c===null||Y||Ca||sn||Ui(r)),c=null,i=r;;){if(i.tag===5||i.tag===26){if(c===null){Y=c=i;try{if(x=Y.stateNode,v)C=x.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{M=Y.stateNode;var me=Y.memoizedProps.style,se=me!=null&&me.hasOwnProperty("display")?me.display:null;M.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Te){kt(Y,Y.return,Te)}}}else if(i.tag===6){if(c===null){Y=i;try{Y.stateNode.nodeValue=v?"":Y.memoizedProps}catch(Te){kt(Y,Y.return,Te)}}}else if(i.tag===18){if(c===null){Y=i;try{var oe=Y.stateNode;v?Z0(oe,!0):Z0(Y.stateNode,!1)}catch(Te){kt(Y,Y.return,Te)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;c===i&&(c=null),i=i.return}c===i&&(c=null),i.sibling.return=i.return,i=i.sibling}p&4&&(p=r.updateQueue,p!==null&&(c=p.retryQueue,c!==null&&(p.retryQueue=null,Vc(r,c))));break;case 19:Un(i,r),Bn(r),p&4&&(p=r.updateQueue,p!==null&&(r.updateQueue=null,Vc(r,p)));break;case 30:break;case 21:break;default:Un(i,r),Bn(r)}}function Bn(r){var i=r.flags;if(i&2){try{for(var c,p=r.return;p!==null;){if(Yb(p)){c=p;break}p=p.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var v=c.stateNode,x=wf(r);Gc(r,x,v);break;case 5:var C=c.stateNode;c.flags&32&&(ms(C,""),c.flags&=-33);var M=wf(r);Gc(r,M,C);break;case 3:case 4:var Y=c.stateNode.containerInfo,ae=wf(r);kf(r,ae,Y);break;default:throw Error(a(161))}}catch(pe){kt(r,r.return,pe)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function i0(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;i0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ea(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Jb(r,i.alternate,i),i=i.sibling}function Ui(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:ni(4,i,i.return),Ui(i);break;case 1:Zr(i,i.return);var c=i.stateNode;typeof c.componentWillUnmount=="function"&&Zb(i,i.return,c),Ui(i);break;case 27:il(i.stateNode);case 26:case 5:Zr(i,i.return),Ui(i);break;case 22:i.memoizedState===null&&Ui(i);break;case 30:Ui(i);break;default:Ui(i)}r=r.sibling}}function Aa(r,i,c){for(c=c&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var p=i.alternate,v=r,x=i,C=x.flags;switch(x.tag){case 0:case 11:case 15:Aa(v,x,c),Ko(4,x);break;case 1:if(Aa(v,x,c),p=x,v=p.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ae){kt(p,p.return,ae)}if(p=x,v=p.updateQueue,v!==null){var M=p.stateNode;try{var Y=v.shared.hiddenCallbacks;if(Y!==null)for(v.shared.hiddenCallbacks=null,v=0;v<Y.length;v++)zy(Y[v],M)}catch(ae){kt(p,p.return,ae)}}c&&C&64&&Wb(x),Yo(x,x.return);break;case 27:Qb(x);case 26:case 5:Aa(v,x,c),c&&p===null&&C&4&&Kb(x),Yo(x,x.return);break;case 12:Aa(v,x,c);break;case 31:Aa(v,x,c),c&&C&4&&n0(v,x);break;case 13:Aa(v,x,c),c&&C&4&&r0(v,x);break;case 22:x.memoizedState===null&&Aa(v,x,c),Yo(x,x.return);break;case 30:break;default:Aa(v,x,c)}i=i.sibling}}function jf(r,i){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&zo(c))}function Cf(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&zo(r))}function Dr(r,i,c,p){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)s0(r,i,c,p),i=i.sibling}function s0(r,i,c,p){var v=i.flags;switch(i.tag){case 0:case 11:case 15:Dr(r,i,c,p),v&2048&&Ko(9,i);break;case 1:Dr(r,i,c,p);break;case 3:Dr(r,i,c,p),v&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&zo(r)));break;case 12:if(v&2048){Dr(r,i,c,p),r=i.stateNode;try{var x=i.memoizedProps,C=x.id,M=x.onPostCommit;typeof M=="function"&&M(C,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(Y){kt(i,i.return,Y)}}else Dr(r,i,c,p);break;case 31:Dr(r,i,c,p);break;case 13:Dr(r,i,c,p);break;case 23:break;case 22:x=i.stateNode,C=i.alternate,i.memoizedState!==null?x._visibility&2?Dr(r,i,c,p):Qo(r,i):x._visibility&2?Dr(r,i,c,p):(x._visibility|=2,Ds(r,i,c,p,(i.subtreeFlags&10256)!==0||!1)),v&2048&&jf(C,i);break;case 24:Dr(r,i,c,p),v&2048&&Cf(i.alternate,i);break;default:Dr(r,i,c,p)}}function Ds(r,i,c,p,v){for(v=v&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var x=r,C=i,M=c,Y=p,ae=C.flags;switch(C.tag){case 0:case 11:case 15:Ds(x,C,M,Y,v),Ko(8,C);break;case 23:break;case 22:var pe=C.stateNode;C.memoizedState!==null?pe._visibility&2?Ds(x,C,M,Y,v):Qo(x,C):(pe._visibility|=2,Ds(x,C,M,Y,v)),v&&ae&2048&&jf(C.alternate,C);break;case 24:Ds(x,C,M,Y,v),v&&ae&2048&&Cf(C.alternate,C);break;default:Ds(x,C,M,Y,v)}i=i.sibling}}function Qo(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var c=r,p=i,v=p.flags;switch(p.tag){case 22:Qo(c,p),v&2048&&jf(p.alternate,p);break;case 24:Qo(c,p),v&2048&&Cf(p.alternate,p);break;default:Qo(c,p)}i=i.sibling}}var Xo=8192;function zs(r,i,c){if(r.subtreeFlags&Xo)for(r=r.child;r!==null;)o0(r,i,c),r=r.sibling}function o0(r,i,c){switch(r.tag){case 26:zs(r,i,c),r.flags&Xo&&r.memoizedState!==null&&ZA(c,Mr,r.memoizedState,r.memoizedProps);break;case 5:zs(r,i,c);break;case 3:case 4:var p=Mr;Mr=su(r.stateNode.containerInfo),zs(r,i,c),Mr=p;break;case 22:r.memoizedState===null&&(p=r.alternate,p!==null&&p.memoizedState!==null?(p=Xo,Xo=16777216,zs(r,i,c),Xo=p):zs(r,i,c));break;default:zs(r,i,c)}}function l0(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function Jo(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var p=i[c];vn=p,u0(p,r)}l0(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)c0(r),r=r.sibling}function c0(r){switch(r.tag){case 0:case 11:case 15:Jo(r),r.flags&2048&&ni(9,r,r.return);break;case 3:Jo(r);break;case 12:Jo(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Wc(r)):Jo(r);break;default:Jo(r)}}function Wc(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var p=i[c];vn=p,u0(p,r)}l0(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:ni(8,i,i.return),Wc(i);break;case 22:c=i.stateNode,c._visibility&2&&(c._visibility&=-3,Wc(i));break;default:Wc(i)}r=r.sibling}}function u0(r,i){for(;vn!==null;){var c=vn;switch(c.tag){case 0:case 11:case 15:ni(8,c,i);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var p=c.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:zo(c.memoizedState.cache)}if(p=c.child,p!==null)p.return=c,vn=p;else e:for(c=r;vn!==null;){p=vn;var v=p.sibling,x=p.return;if(e0(p),p===c){vn=null;break e}if(v!==null){v.return=x,vn=v;break e}vn=x}}}var cA={getCacheForType:function(r){var i=wn(nn),c=i.data.get(r);return c===void 0&&(c=r(),i.data.set(r,c)),c},cacheSignal:function(){return wn(nn).controller.signal}},uA=typeof WeakMap=="function"?WeakMap:Map,yt=0,Et=null,nt=null,st=0,wt=0,er=null,ri=!1,$s=!1,Nf=!1,Ta=0,Kt=0,ai=0,Bi=0,Ef=0,tr=0,Is=0,el=null,Fn=null,Af=!1,Zc=0,d0=0,Kc=1/0,Yc=null,ii=null,dn=0,si=null,Ps=null,_a=0,Tf=0,_f=null,p0=null,tl=0,Rf=null;function nr(){return(yt&2)!==0&&st!==0?st&-st:B.T!==null?$f():Ke()}function f0(){if(tr===0)if((st&536870912)===0||ct){var r=Fa;Fa<<=1,(Fa&3932160)===0&&(Fa=262144),tr=r}else tr=536870912;return r=Xn.current,r!==null&&(r.flags|=32),tr}function Hn(r,i,c){(r===Et&&(wt===2||wt===9)||r.cancelPendingCommit!==null)&&(Us(r,0),oi(r,st,tr,!1)),ge(r,c),((yt&2)===0||r!==Et)&&(r===Et&&((yt&2)===0&&(Bi|=c),Kt===4&&oi(r,st,tr,!1)),Kr(r))}function h0(r,i,c){if((yt&6)!==0)throw Error(a(327));var p=!c&&(i&127)===0&&(i&r.expiredLanes)===0||ca(r,i),v=p?fA(r,i):Lf(r,i,!0),x=p;do{if(v===0){$s&&!p&&oi(r,i,0,!1);break}else{if(c=r.current.alternate,x&&!dA(c)){v=Lf(r,i,!1),x=!1;continue}if(v===2){if(x=i,r.errorRecoveryDisabledLanes&x)var C=0;else C=r.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){i=C;e:{var M=r;v=el;var Y=M.current.memoizedState.isDehydrated;if(Y&&(Us(M,C).flags|=256),C=Lf(M,C,!1),C!==2){if(Nf&&!Y){M.errorRecoveryDisabledLanes|=x,Bi|=x,v=4;break e}x=Fn,Fn=v,x!==null&&(Fn===null?Fn=x:Fn.push.apply(Fn,x))}v=C}if(x=!1,v!==2)continue}}if(v===1){Us(r,0),oi(r,i,0,!0);break}e:{switch(p=r,x=v,x){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:oi(p,i,tr,!ri);break e;case 2:Fn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(v=Zc+300-ut(),10<v)){if(oi(p,i,tr,!ri),qr(p,0,!0)!==0)break e;_a=i,p.timeoutHandle=G0(m0.bind(null,p,c,Fn,Yc,Af,i,tr,Bi,Is,ri,x,"Throttled",-0,0),v);break e}m0(p,c,Fn,Yc,Af,i,tr,Bi,Is,ri,x,null,-0,0)}}break}while(!0);Kr(r)}function m0(r,i,c,p,v,x,C,M,Y,ae,pe,me,se,oe){if(r.timeoutHandle=-1,me=i.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ma},o0(i,x,me);var Te=(x&62914560)===x?Zc-ut():(x&4194048)===x?d0-ut():0;if(Te=KA(me,Te),Te!==null){_a=x,r.cancelPendingCommit=Te(S0.bind(null,r,i,x,c,p,v,C,M,Y,pe,me,null,se,oe)),oi(r,x,C,!ae);return}}S0(r,i,x,c,p,v,C,M,Y)}function dA(r){for(var i=r;;){var c=i.tag;if((c===0||c===11||c===15)&&i.flags&16384&&(c=i.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var p=0;p<c.length;p++){var v=c[p],x=v.getSnapshot;v=v.value;try{if(!Yn(x(),v))return!1}catch{return!1}}if(c=i.child,i.subtreeFlags&16384&&c!==null)c.return=i,i=c;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function oi(r,i,c,p){i&=~Ef,i&=~Bi,r.suspendedLanes|=i,r.pingedLanes&=~i,p&&(r.warmLanes|=i),p=r.expirationTimes;for(var v=i;0<v;){var x=31-Ne(v),C=1<<x;p[x]=-1,v&=~C}c!==0&&de(r,c,i)}function Qc(){return(yt&6)===0?(nl(0),!1):!0}function Of(){if(nt!==null){if(wt===0)var r=nt.return;else r=nt,ba=Oi=null,Wp(r),_s=null,Io=0,r=nt;for(;r!==null;)Vb(r.alternate,r),r=r.return;nt=null}}function Us(r,i){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,RA(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),_a=0,Of(),Et=r,nt=c=va(r.current,null),st=i,wt=0,er=null,ri=!1,$s=ca(r,i),Nf=!1,Is=tr=Ef=Bi=ai=Kt=0,Fn=el=null,Af=!1,(i&8)!==0&&(i|=i&32);var p=r.entangledLanes;if(p!==0)for(r=r.entanglements,p&=i;0<p;){var v=31-Ne(p),x=1<<v;i|=r[v],p&=~x}return Ta=i,yc(),c}function g0(r,i){Ye=null,B.H=Vo,i===Ts||i===Nc?(i=Oy(),wt=3):i===Dp?(i=Oy(),wt=4):wt=i===uf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,er=i,nt===null&&(Kt=1,Uc(r,xr(i,r.current)))}function v0(){var r=Xn.current;return r===null?!0:(st&4194048)===st?jr===null:(st&62914560)===st||(st&536870912)!==0?r===jr:!1}function y0(){var r=B.H;return B.H=Vo,r===null?Vo:r}function b0(){var r=B.A;return B.A=cA,r}function Xc(){Kt=4,ri||(st&4194048)!==st&&Xn.current!==null||($s=!0),(ai&134217727)===0&&(Bi&134217727)===0||Et===null||oi(Et,st,tr,!1)}function Lf(r,i,c){var p=yt;yt|=2;var v=y0(),x=b0();(Et!==r||st!==i)&&(Yc=null,Us(r,i)),i=!1;var C=Kt;e:do try{if(wt!==0&&nt!==null){var M=nt,Y=er;switch(wt){case 8:Of(),C=6;break e;case 3:case 2:case 9:case 6:Xn.current===null&&(i=!0);var ae=wt;if(wt=0,er=null,Bs(r,M,Y,ae),c&&$s){C=0;break e}break;default:ae=wt,wt=0,er=null,Bs(r,M,Y,ae)}}pA(),C=Kt;break}catch(pe){g0(r,pe)}while(!0);return i&&r.shellSuspendCounter++,ba=Oi=null,yt=p,B.H=v,B.A=x,nt===null&&(Et=null,st=0,yc()),C}function pA(){for(;nt!==null;)x0(nt)}function fA(r,i){var c=yt;yt|=2;var p=y0(),v=b0();Et!==r||st!==i?(Yc=null,Kc=ut()+500,Us(r,i)):$s=ca(r,i);e:do try{if(wt!==0&&nt!==null){i=nt;var x=er;t:switch(wt){case 1:wt=0,er=null,Bs(r,i,x,1);break;case 2:case 9:if(_y(x)){wt=0,er=null,w0(i);break}i=function(){wt!==2&&wt!==9||Et!==r||(wt=7),Kr(r)},x.then(i,i);break e;case 3:wt=7;break e;case 4:wt=5;break e;case 7:_y(x)?(wt=0,er=null,w0(i)):(wt=0,er=null,Bs(r,i,x,7));break;case 5:var C=null;switch(nt.tag){case 26:C=nt.memoizedState;case 5:case 27:var M=nt;if(C?sx(C):M.stateNode.complete){wt=0,er=null;var Y=M.sibling;if(Y!==null)nt=Y;else{var ae=M.return;ae!==null?(nt=ae,Jc(ae)):nt=null}break t}}wt=0,er=null,Bs(r,i,x,5);break;case 6:wt=0,er=null,Bs(r,i,x,6);break;case 8:Of(),Kt=6;break e;default:throw Error(a(462))}}hA();break}catch(pe){g0(r,pe)}while(!0);return ba=Oi=null,B.H=p,B.A=v,yt=c,nt!==null?0:(Et=null,st=0,yc(),Kt)}function hA(){for(;nt!==null&&!Yt();)x0(nt)}function x0(r){var i=qb(r.alternate,r,Ta);r.memoizedProps=r.pendingProps,i===null?Jc(r):nt=i}function w0(r){var i=r,c=i.alternate;switch(i.tag){case 15:case 0:i=Ib(c,i,i.pendingProps,i.type,void 0,st);break;case 11:i=Ib(c,i,i.pendingProps,i.type.render,i.ref,st);break;case 5:Wp(i);default:Vb(c,i),i=nt=by(i,Ta),i=qb(c,i,Ta)}r.memoizedProps=r.pendingProps,i===null?Jc(r):nt=i}function Bs(r,i,c,p){ba=Oi=null,Wp(i),_s=null,Io=0;var v=i.return;try{if(nA(r,v,i,c,st)){Kt=1,Uc(r,xr(c,r.current)),nt=null;return}}catch(x){if(v!==null)throw nt=v,x;Kt=1,Uc(r,xr(c,r.current)),nt=null;return}i.flags&32768?(ct||p===1?r=!0:$s||(st&536870912)!==0?r=!1:(ri=r=!0,(p===2||p===9||p===3||p===6)&&(p=Xn.current,p!==null&&p.tag===13&&(p.flags|=16384))),k0(i,r)):Jc(i)}function Jc(r){var i=r;do{if((i.flags&32768)!==0){k0(i,ri);return}r=i.return;var c=iA(i.alternate,i,Ta);if(c!==null){nt=c;return}if(i=i.sibling,i!==null){nt=i;return}nt=i=r}while(i!==null);Kt===0&&(Kt=5)}function k0(r,i){do{var c=sA(r.alternate,r);if(c!==null){c.flags&=32767,nt=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!i&&(r=r.sibling,r!==null)){nt=r;return}nt=r=c}while(r!==null);Kt=6,nt=null}function S0(r,i,c,p,v,x,C,M,Y){r.cancelPendingCommit=null;do eu();while(dn!==0);if((yt&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(x=i.lanes|i.childLanes,x|=xp,Me(r,c,x,C,M,Y),r===Et&&(nt=Et=null,st=0),Ps=i,si=r,_a=c,Tf=x,_f=v,p0=p,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,yA(ee,function(){return A0(),null})):(r.callbackNode=null,r.callbackPriority=0),p=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||p){p=B.T,B.T=null,v=W.p,W.p=2,C=yt,yt|=4;try{oA(r,i,c)}finally{yt=C,W.p=v,B.T=p}}dn=1,j0(),C0(),N0()}}function j0(){if(dn===1){dn=0;var r=si,i=Ps,c=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||c){c=B.T,B.T=null;var p=W.p;W.p=2;var v=yt;yt|=4;try{a0(i,r);var x=Gf,C=uy(r.containerInfo),M=x.focusedElem,Y=x.selectionRange;if(C!==M&&M&&M.ownerDocument&&cy(M.ownerDocument.documentElement,M)){if(Y!==null&&mp(M)){var ae=Y.start,pe=Y.end;if(pe===void 0&&(pe=ae),"selectionStart"in M)M.selectionStart=ae,M.selectionEnd=Math.min(pe,M.value.length);else{var me=M.ownerDocument||document,se=me&&me.defaultView||window;if(se.getSelection){var oe=se.getSelection(),Te=M.textContent.length,Be=Math.min(Y.start,Te),Ct=Y.end===void 0?Be:Math.min(Y.end,Te);!oe.extend&&Be>Ct&&(C=Ct,Ct=Be,Be=C);var te=ly(M,Be),J=ly(M,Ct);if(te&&J&&(oe.rangeCount!==1||oe.anchorNode!==te.node||oe.anchorOffset!==te.offset||oe.focusNode!==J.node||oe.focusOffset!==J.offset)){var re=me.createRange();re.setStart(te.node,te.offset),oe.removeAllRanges(),Be>Ct?(oe.addRange(re),oe.extend(J.node,J.offset)):(re.setEnd(J.node,J.offset),oe.addRange(re))}}}}for(me=[],oe=M;oe=oe.parentNode;)oe.nodeType===1&&me.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;M<me.length;M++){var fe=me[M];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}pu=!!qf,Gf=qf=null}finally{yt=v,W.p=p,B.T=c}}r.current=i,dn=2}}function C0(){if(dn===2){dn=0;var r=si,i=Ps,c=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||c){c=B.T,B.T=null;var p=W.p;W.p=2;var v=yt;yt|=4;try{Jb(r,i.alternate,i)}finally{yt=v,W.p=p,B.T=c}}dn=3}}function N0(){if(dn===4||dn===3){dn=0,qt();var r=si,i=Ps,c=_a,p=p0;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?dn=5:(dn=0,Ps=si=null,E0(r,r.pendingLanes));var v=r.pendingLanes;if(v===0&&(ii=null),Je(c),i=i.stateNode,Fe&&typeof Fe.onCommitFiberRoot=="function")try{Fe.onCommitFiberRoot(Ce,i,void 0,(i.current.flags&128)===128)}catch{}if(p!==null){i=B.T,v=W.p,W.p=2,B.T=null;try{for(var x=r.onRecoverableError,C=0;C<p.length;C++){var M=p[C];x(M.value,{componentStack:M.stack})}}finally{B.T=i,W.p=v}}(_a&3)!==0&&eu(),Kr(r),v=r.pendingLanes,(c&261930)!==0&&(v&42)!==0?r===Rf?tl++:(tl=0,Rf=r):tl=0,nl(0)}}function E0(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,zo(i)))}function eu(){return j0(),C0(),N0(),A0()}function A0(){if(dn!==5)return!1;var r=si,i=Tf;Tf=0;var c=Je(_a),p=B.T,v=W.p;try{W.p=32>c?32:c,B.T=null,c=_f,_f=null;var x=si,C=_a;if(dn=0,Ps=si=null,_a=0,(yt&6)!==0)throw Error(a(331));var M=yt;if(yt|=4,c0(x.current),s0(x,x.current,C,c),yt=M,nl(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(Ce,x)}catch{}return!0}finally{W.p=v,B.T=p,E0(r,i)}}function T0(r,i,c){i=xr(c,i),i=cf(r.stateNode,i,2),r=Ja(r,i,2),r!==null&&(ge(r,2),Kr(r))}function kt(r,i,c){if(r.tag===3)T0(r,r,c);else for(;i!==null;){if(i.tag===3){T0(i,r,c);break}else if(i.tag===1){var p=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(ii===null||!ii.has(p))){r=xr(c,r),c=_b(2),p=Ja(i,c,2),p!==null&&(Rb(c,p,i,r),ge(p,2),Kr(p));break}}i=i.return}}function Mf(r,i,c){var p=r.pingCache;if(p===null){p=r.pingCache=new uA;var v=new Set;p.set(i,v)}else v=p.get(i),v===void 0&&(v=new Set,p.set(i,v));v.has(c)||(Nf=!0,v.add(c),r=mA.bind(null,r,i,c),i.then(r,r))}function mA(r,i,c){var p=r.pingCache;p!==null&&p.delete(i),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Et===r&&(st&c)===c&&(Kt===4||Kt===3&&(st&62914560)===st&&300>ut()-Zc?(yt&2)===0&&Us(r,0):Ef|=c,Is===st&&(Is=0)),Kr(r)}function _0(r,i){i===0&&(i=qa()),r=Ti(r,i),r!==null&&(ge(r,i),Kr(r))}function gA(r){var i=r.memoizedState,c=0;i!==null&&(c=i.retryLane),_0(r,c)}function vA(r,i){var c=0;switch(r.tag){case 31:case 13:var p=r.stateNode,v=r.memoizedState;v!==null&&(c=v.retryLane);break;case 19:p=r.stateNode;break;case 22:p=r.stateNode._retryCache;break;default:throw Error(a(314))}p!==null&&p.delete(i),_0(r,c)}function yA(r,i){return Ot(r,i)}var tu=null,Fs=null,Df=!1,nu=!1,zf=!1,li=0;function Kr(r){r!==Fs&&r.next===null&&(Fs===null?tu=Fs=r:Fs=Fs.next=r),nu=!0,Df||(Df=!0,xA())}function nl(r,i){if(!zf&&nu){zf=!0;do for(var c=!1,p=tu;p!==null;){if(r!==0){var v=p.pendingLanes;if(v===0)var x=0;else{var C=p.suspendedLanes,M=p.pingedLanes;x=(1<<31-Ne(42|r)+1)-1,x&=v&~(C&~M),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,M0(p,x))}else x=st,x=qr(p,p===Et?x:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(x&3)===0||ca(p,x)||(c=!0,M0(p,x));p=p.next}while(c);zf=!1}}function bA(){R0()}function R0(){nu=Df=!1;var r=0;li!==0&&_A()&&(r=li);for(var i=ut(),c=null,p=tu;p!==null;){var v=p.next,x=O0(p,i);x===0?(p.next=null,c===null?tu=v:c.next=v,v===null&&(Fs=c)):(c=p,(r!==0||(x&3)!==0)&&(nu=!0)),p=v}dn!==0&&dn!==5||nl(r),li!==0&&(li=0)}function O0(r,i){for(var c=r.suspendedLanes,p=r.pingedLanes,v=r.expirationTimes,x=r.pendingLanes&-62914561;0<x;){var C=31-Ne(x),M=1<<C,Y=v[C];Y===-1?((M&c)===0||(M&p)!==0)&&(v[C]=ic(M,i)):Y<=i&&(r.expiredLanes|=M),x&=~M}if(i=Et,c=st,c=qr(r,r===i?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),p=r.callbackNode,c===0||r===i&&(wt===2||wt===9)||r.cancelPendingCommit!==null)return p!==null&&p!==null&&$t(p),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||ca(r,c)){if(i=c&-c,i===r.callbackPriority)return i;switch(p!==null&&$t(p),Je(c)){case 2:case 8:c=Z;break;case 32:c=ee;break;case 268435456:c=he;break;default:c=ee}return p=L0.bind(null,r),c=Ot(c,p),r.callbackPriority=i,r.callbackNode=c,i}return p!==null&&p!==null&&$t(p),r.callbackPriority=2,r.callbackNode=null,2}function L0(r,i){if(dn!==0&&dn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(eu()&&r.callbackNode!==c)return null;var p=st;return p=qr(r,r===Et?p:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),p===0?null:(h0(r,p,i),O0(r,ut()),r.callbackNode!=null&&r.callbackNode===c?L0.bind(null,r):null)}function M0(r,i){if(eu())return null;h0(r,i,!0)}function xA(){OA(function(){(yt&6)!==0?Ot(X,bA):R0()})}function $f(){if(li===0){var r=Es;r===0&&(r=dr,dr<<=1,(dr&261888)===0&&(dr=256)),li=r}return li}function D0(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:uc(""+r)}function z0(r,i){var c=i.ownerDocument.createElement("input");return c.name=i.name,c.value=i.value,r.id&&c.setAttribute("form",r.id),i.parentNode.insertBefore(c,i),r=new FormData(r),c.parentNode.removeChild(c),r}function wA(r,i,c,p,v){if(i==="submit"&&c&&c.stateNode===v){var x=D0((v[un]||null).action),C=p.submitter;C&&(i=(i=C[un]||null)?D0(i.formAction):C.getAttribute("formAction"),i!==null&&(x=i,C=null));var M=new hc("action","action",null,p,v);r.push({event:M,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(li!==0){var Y=C?z0(v,C):new FormData(v);nf(c,{pending:!0,data:Y,method:v.method,action:x},null,Y)}}else typeof x=="function"&&(M.preventDefault(),Y=C?z0(v,C):new FormData(v),nf(c,{pending:!0,data:Y,method:v.method,action:x},x,Y))},currentTarget:v}]})}}for(var If=0;If<bp.length;If++){var Pf=bp[If],kA=Pf.toLowerCase(),SA=Pf[0].toUpperCase()+Pf.slice(1);Lr(kA,"on"+SA)}Lr(fy,"onAnimationEnd"),Lr(hy,"onAnimationIteration"),Lr(my,"onAnimationStart"),Lr("dblclick","onDoubleClick"),Lr("focusin","onFocus"),Lr("focusout","onBlur"),Lr(PE,"onTransitionRun"),Lr(UE,"onTransitionStart"),Lr(BE,"onTransitionCancel"),Lr(gy,"onTransitionEnd"),fa("onMouseEnter",["mouseout","mouseover"]),fa("onMouseLeave",["mouseout","mouseover"]),fa("onPointerEnter",["pointerout","pointerover"]),fa("onPointerLeave",["pointerout","pointerover"]),mr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),mr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),mr("onBeforeInput",["compositionend","keypress","textInput","paste"]),mr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),mr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),mr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var rl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),jA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(rl));function $0(r,i){i=(i&4)!==0;for(var c=0;c<r.length;c++){var p=r[c],v=p.event;p=p.listeners;e:{var x=void 0;if(i)for(var C=p.length-1;0<=C;C--){var M=p[C],Y=M.instance,ae=M.currentTarget;if(M=M.listener,Y!==x&&v.isPropagationStopped())break e;x=M,v.currentTarget=ae;try{x(v)}catch(pe){vc(pe)}v.currentTarget=null,x=Y}else for(C=0;C<p.length;C++){if(M=p[C],Y=M.instance,ae=M.currentTarget,M=M.listener,Y!==x&&v.isPropagationStopped())break e;x=M,v.currentTarget=ae;try{x(v)}catch(pe){vc(pe)}v.currentTarget=null,x=Y}}}}function rt(r,i){var c=i[da];c===void 0&&(c=i[da]=new Set);var p=r+"__bubble";c.has(p)||(I0(i,r,2,!1),c.add(p))}function Uf(r,i,c){var p=0;i&&(p|=4),I0(c,r,p,i)}var ru="_reactListening"+Math.random().toString(36).slice(2);function Bf(r){if(!r[ru]){r[ru]=!0,jo.forEach(function(c){c!=="selectionchange"&&(jA.has(c)||Uf(c,!1,r),Uf(c,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[ru]||(i[ru]=!0,Uf("selectionchange",!1,i))}}function I0(r,i,c,p){switch(fx(i)){case 2:var v=XA;break;case 8:v=JA;break;default:v=nh}c=v.bind(null,i,c,r),v=void 0,!sp||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(v=!0),p?v!==void 0?r.addEventListener(i,c,{capture:!0,passive:v}):r.addEventListener(i,c,!0):v!==void 0?r.addEventListener(i,c,{passive:v}):r.addEventListener(i,c,!1)}function Ff(r,i,c,p,v){var x=p;if((i&1)===0&&(i&2)===0&&p!==null)e:for(;;){if(p===null)return;var C=p.tag;if(C===3||C===4){var M=p.stateNode.containerInfo;if(M===v)break;if(C===4)for(C=p.return;C!==null;){var Y=C.tag;if((Y===3||Y===4)&&C.stateNode.containerInfo===v)return;C=C.return}for(;M!==null;){if(C=gn(M),C===null)return;if(Y=C.tag,Y===5||Y===6||Y===26||Y===27){p=x=C;continue e}M=M.parentNode}}p=p.return}Hv(function(){var ae=x,pe=ap(c),me=[];e:{var se=vy.get(r);if(se!==void 0){var oe=hc,Te=r;switch(r){case"keypress":if(pc(c)===0)break e;case"keydown":case"keyup":oe=vE;break;case"focusin":Te="focus",oe=up;break;case"focusout":Te="blur",oe=up;break;case"beforeblur":case"afterblur":oe=up;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=Vv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=iE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=xE;break;case fy:case hy:case my:oe=lE;break;case gy:oe=kE;break;case"scroll":case"scrollend":oe=rE;break;case"wheel":oe=jE;break;case"copy":case"cut":case"paste":oe=uE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=Zv;break;case"toggle":case"beforetoggle":oe=NE}var Be=(i&4)!==0,Ct=!Be&&(r==="scroll"||r==="scrollend"),te=Be?se!==null?se+"Capture":null:se;Be=[];for(var J=ae,re;J!==null;){var fe=J;if(re=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||re===null||te===null||(fe=Co(J,te),fe!=null&&Be.push(al(J,fe,re))),Ct)break;J=J.return}0<Be.length&&(se=new oe(se,Te,null,c,pe),me.push({event:se,listeners:Be}))}}if((i&7)===0){e:{if(se=r==="mouseover"||r==="pointerover",oe=r==="mouseout"||r==="pointerout",se&&c!==rp&&(Te=c.relatedTarget||c.fromElement)&&(gn(Te)||Te[ua]))break e;if((oe||se)&&(se=pe.window===pe?pe:(se=pe.ownerDocument)?se.defaultView||se.parentWindow:window,oe?(Te=c.relatedTarget||c.toElement,oe=ae,Te=Te?gn(Te):null,Te!==null&&(Ct=l(Te),Be=Te.tag,Te!==Ct||Be!==5&&Be!==27&&Be!==6)&&(Te=null)):(oe=null,Te=ae),oe!==Te)){if(Be=Vv,fe="onMouseLeave",te="onMouseEnter",J="mouse",(r==="pointerout"||r==="pointerover")&&(Be=Zv,fe="onPointerLeave",te="onPointerEnter",J="pointer"),Ct=oe==null?se:pa(oe),re=Te==null?se:pa(Te),se=new Be(fe,J+"leave",oe,c,pe),se.target=Ct,se.relatedTarget=re,fe=null,gn(pe)===ae&&(Be=new Be(te,J+"enter",Te,c,pe),Be.target=re,Be.relatedTarget=Ct,fe=Be),Ct=fe,oe&&Te)t:{for(Be=CA,te=oe,J=Te,re=0,fe=te;fe;fe=Be(fe))re++;fe=0;for(var ze=J;ze;ze=Be(ze))fe++;for(;0<re-fe;)te=Be(te),re--;for(;0<fe-re;)J=Be(J),fe--;for(;re--;){if(te===J||J!==null&&te===J.alternate){Be=te;break t}te=Be(te),J=Be(J)}Be=null}else Be=null;oe!==null&&P0(me,se,oe,Be,!1),Te!==null&&Ct!==null&&P0(me,Ct,Te,Be,!0)}}e:{if(se=ae?pa(ae):window,oe=se.nodeName&&se.nodeName.toLowerCase(),oe==="select"||oe==="input"&&se.type==="file")var ht=ny;else if(ey(se))if(ry)ht=zE;else{ht=ME;var Re=LE}else oe=se.nodeName,!oe||oe.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ae&&np(ae.elementType)&&(ht=ny):ht=DE;if(ht&&(ht=ht(r,ae))){ty(me,ht,c,pe);break e}Re&&Re(r,se,ae),r==="focusout"&&ae&&se.type==="number"&&ae.memoizedProps.value!=null&&tp(se,"number",se.value)}switch(Re=ae?pa(ae):window,r){case"focusin":(ey(Re)||Re.contentEditable==="true")&&(bs=Re,gp=ae,Lo=null);break;case"focusout":Lo=gp=bs=null;break;case"mousedown":vp=!0;break;case"contextmenu":case"mouseup":case"dragend":vp=!1,dy(me,c,pe);break;case"selectionchange":if(IE)break;case"keydown":case"keyup":dy(me,c,pe)}var Qe;if(pp)e:{switch(r){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else ys?Xv(r,c)&&(ot="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(ot="onCompositionStart");ot&&(Kv&&c.locale!=="ko"&&(ys||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&ys&&(Qe=qv()):(Va=pe,op="value"in Va?Va.value:Va.textContent,ys=!0)),Re=au(ae,ot),0<Re.length&&(ot=new Wv(ot,r,null,c,pe),me.push({event:ot,listeners:Re}),Qe?ot.data=Qe:(Qe=Jv(c),Qe!==null&&(ot.data=Qe)))),(Qe=AE?TE(r,c):_E(r,c))&&(ot=au(ae,"onBeforeInput"),0<ot.length&&(Re=new Wv("onBeforeInput","beforeinput",null,c,pe),me.push({event:Re,listeners:ot}),Re.data=Qe)),wA(me,r,ae,c,pe)}$0(me,i)})}function al(r,i,c){return{instance:r,listener:i,currentTarget:c}}function au(r,i){for(var c=i+"Capture",p=[];r!==null;){var v=r,x=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||x===null||(v=Co(r,c),v!=null&&p.unshift(al(r,v,x)),v=Co(r,i),v!=null&&p.push(al(r,v,x))),r.tag===3)return p;r=r.return}return[]}function CA(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function P0(r,i,c,p,v){for(var x=i._reactName,C=[];c!==null&&c!==p;){var M=c,Y=M.alternate,ae=M.stateNode;if(M=M.tag,Y!==null&&Y===p)break;M!==5&&M!==26&&M!==27||ae===null||(Y=ae,v?(ae=Co(c,x),ae!=null&&C.unshift(al(c,ae,Y))):v||(ae=Co(c,x),ae!=null&&C.push(al(c,ae,Y)))),c=c.return}C.length!==0&&r.push({event:i,listeners:C})}var NA=/\r\n?/g,EA=/\u0000|\uFFFD/g;function U0(r){return(typeof r=="string"?r:""+r).replace(NA,`
50
- `).replace(EA,"")}function B0(r,i){return i=U0(i),U0(r)===i}function jt(r,i,c,p,v,x){switch(c){case"children":typeof p=="string"?i==="body"||i==="textarea"&&p===""||ms(r,p):(typeof p=="number"||typeof p=="bigint")&&i!=="body"&&ms(r,""+p);break;case"className":lc(r,"class",p);break;case"tabIndex":lc(r,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":lc(r,c,p);break;case"style":Bv(r,p,x);break;case"data":if(i!=="object"){lc(r,"data",p);break}case"src":case"href":if(p===""&&(i!=="a"||c!=="href")){r.removeAttribute(c);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){r.removeAttribute(c);break}p=uc(""+p),r.setAttribute(c,p);break;case"action":case"formAction":if(typeof p=="function"){r.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(c==="formAction"?(i!=="input"&&jt(r,i,"name",v.name,v,null),jt(r,i,"formEncType",v.formEncType,v,null),jt(r,i,"formMethod",v.formMethod,v,null),jt(r,i,"formTarget",v.formTarget,v,null)):(jt(r,i,"encType",v.encType,v,null),jt(r,i,"method",v.method,v,null),jt(r,i,"target",v.target,v,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){r.removeAttribute(c);break}p=uc(""+p),r.setAttribute(c,p);break;case"onClick":p!=null&&(r.onclick=ma);break;case"onScroll":p!=null&&rt("scroll",r);break;case"onScrollEnd":p!=null&&rt("scrollend",r);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(a(61));if(c=p.__html,c!=null){if(v.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"multiple":r.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":r.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){r.removeAttribute("xlink:href");break}c=uc(""+p),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?r.setAttribute(c,""+p):r.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":p&&typeof p!="function"&&typeof p!="symbol"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":p===!0?r.setAttribute(c,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?r.setAttribute(c,p):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?r.setAttribute(c,p):r.removeAttribute(c);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?r.removeAttribute(c):r.setAttribute(c,p);break;case"popover":rt("beforetoggle",r),rt("toggle",r),oc(r,"popover",p);break;case"xlinkActuate":ha(r,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":ha(r,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":ha(r,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":ha(r,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":ha(r,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":ha(r,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":ha(r,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":ha(r,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":ha(r,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":oc(r,"is",p);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=tE.get(c)||c,oc(r,c,p))}}function Hf(r,i,c,p,v,x){switch(c){case"style":Bv(r,p,x);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(a(61));if(c=p.__html,c!=null){if(v.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"children":typeof p=="string"?ms(r,p):(typeof p=="number"||typeof p=="bigint")&&ms(r,""+p);break;case"onScroll":p!=null&&rt("scroll",r);break;case"onScrollEnd":p!=null&&rt("scrollend",r);break;case"onClick":p!=null&&(r.onclick=ma);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!sc.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(v=c.endsWith("Capture"),i=c.slice(2,v?c.length-7:void 0),x=r[un]||null,x=x!=null?x[c]:null,typeof x=="function"&&r.removeEventListener(i,x,v),typeof p=="function")){typeof x!="function"&&x!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(i,p,v);break e}c in r?r[c]=p:p===!0?r.setAttribute(c,""):oc(r,c,p)}}}function Sn(r,i,c){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":rt("error",r),rt("load",r);var p=!1,v=!1,x;for(x in c)if(c.hasOwnProperty(x)){var C=c[x];if(C!=null)switch(x){case"src":p=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:jt(r,i,x,C,c,null)}}v&&jt(r,i,"srcSet",c.srcSet,c,null),p&&jt(r,i,"src",c.src,c,null);return;case"input":rt("invalid",r);var M=x=C=v=null,Y=null,ae=null;for(p in c)if(c.hasOwnProperty(p)){var pe=c[p];if(pe!=null)switch(p){case"name":v=pe;break;case"type":C=pe;break;case"checked":Y=pe;break;case"defaultChecked":ae=pe;break;case"value":x=pe;break;case"defaultValue":M=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(a(137,i));break;default:jt(r,i,p,pe,c,null)}}$v(r,x,M,Y,ae,C,v,!1);return;case"select":rt("invalid",r),p=C=x=null;for(v in c)if(c.hasOwnProperty(v)&&(M=c[v],M!=null))switch(v){case"value":x=M;break;case"defaultValue":C=M;break;case"multiple":p=M;default:jt(r,i,v,M,c,null)}i=x,c=C,r.multiple=!!p,i!=null?hs(r,!!p,i,!1):c!=null&&hs(r,!!p,c,!0);return;case"textarea":rt("invalid",r),x=v=p=null;for(C in c)if(c.hasOwnProperty(C)&&(M=c[C],M!=null))switch(C){case"value":p=M;break;case"defaultValue":v=M;break;case"children":x=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(a(91));break;default:jt(r,i,C,M,c,null)}Pv(r,p,v,x);return;case"option":for(Y in c)if(c.hasOwnProperty(Y)&&(p=c[Y],p!=null))switch(Y){case"selected":r.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:jt(r,i,Y,p,c,null)}return;case"dialog":rt("beforetoggle",r),rt("toggle",r),rt("cancel",r),rt("close",r);break;case"iframe":case"object":rt("load",r);break;case"video":case"audio":for(p=0;p<rl.length;p++)rt(rl[p],r);break;case"image":rt("error",r),rt("load",r);break;case"details":rt("toggle",r);break;case"embed":case"source":case"link":rt("error",r),rt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in c)if(c.hasOwnProperty(ae)&&(p=c[ae],p!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:jt(r,i,ae,p,c,null)}return;default:if(np(i)){for(pe in c)c.hasOwnProperty(pe)&&(p=c[pe],p!==void 0&&Hf(r,i,pe,p,c,void 0));return}}for(M in c)c.hasOwnProperty(M)&&(p=c[M],p!=null&&jt(r,i,M,p,c,null))}function AA(r,i,c,p){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,x=null,C=null,M=null,Y=null,ae=null,pe=null;for(oe in c){var me=c[oe];if(c.hasOwnProperty(oe)&&me!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":Y=me;default:p.hasOwnProperty(oe)||jt(r,i,oe,null,p,me)}}for(var se in p){var oe=p[se];if(me=c[se],p.hasOwnProperty(se)&&(oe!=null||me!=null))switch(se){case"type":x=oe;break;case"name":v=oe;break;case"checked":ae=oe;break;case"defaultChecked":pe=oe;break;case"value":C=oe;break;case"defaultValue":M=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,i));break;default:oe!==me&&jt(r,i,se,oe,p,me)}}ep(r,C,M,Y,ae,pe,x,v);return;case"select":oe=C=M=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)||jt(r,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":M=x;break;case"multiple":C=x;default:x!==Y&&jt(r,i,v,x,p,Y)}i=M,c=C,p=oe,se!=null?hs(r,!!c,se,!1):!!p!=!!c&&(i!=null?hs(r,!!c,i,!0):hs(r,!!c,c?[]:"",!1));return;case"textarea":oe=se=null;for(M in c)if(v=c[M],c.hasOwnProperty(M)&&v!=null&&!p.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:jt(r,i,M,null,p,v)}for(C in p)if(v=p[C],x=c[C],p.hasOwnProperty(C)&&(v!=null||x!=null))switch(C){case"value":se=v;break;case"defaultValue":oe=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(a(91));break;default:v!==x&&jt(r,i,C,v,p,x)}Iv(r,se,oe);return;case"option":for(var Te in c)if(se=c[Te],c.hasOwnProperty(Te)&&se!=null&&!p.hasOwnProperty(Te))switch(Te){case"selected":r.selected=!1;break;default:jt(r,i,Te,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":r.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:jt(r,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)&&jt(r,i,Be,null,p,se);for(ae in p)if(se=p[ae],oe=c[ae],p.hasOwnProperty(ae)&&se!==oe&&(se!=null||oe!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,i));break;default:jt(r,i,ae,se,p,oe)}return;default:if(np(i)){for(var Ct in c)se=c[Ct],c.hasOwnProperty(Ct)&&se!==void 0&&!p.hasOwnProperty(Ct)&&Hf(r,i,Ct,void 0,p,se);for(pe in p)se=p[pe],oe=c[pe],!p.hasOwnProperty(pe)||se===oe||se===void 0&&oe===void 0||Hf(r,i,pe,se,p,oe);return}}for(var te in c)se=c[te],c.hasOwnProperty(te)&&se!=null&&!p.hasOwnProperty(te)&&jt(r,i,te,null,p,se);for(me in p)se=p[me],oe=c[me],!p.hasOwnProperty(me)||se===oe||se==null&&oe==null||jt(r,i,me,se,p,oe)}function F0(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function TA(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,c=performance.getEntriesByType("resource"),p=0;p<c.length;p++){var v=c[p],x=v.transferSize,C=v.initiatorType,M=v.duration;if(x&&M&&F0(C)){for(C=0,M=v.responseEnd,p+=1;p<c.length;p++){var Y=c[p],ae=Y.startTime;if(ae>M)break;var pe=Y.transferSize,me=Y.initiatorType;pe&&F0(me)&&(Y=Y.responseEnd,C+=pe*(Y<M?1:(M-ae)/(Y-ae)))}if(--p,i+=8*(x+C)/(v.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var qf=null,Gf=null;function iu(r){return r.nodeType===9?r:r.ownerDocument}function H0(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function q0(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Vf(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Wf=null;function _A(){var r=window.event;return r&&r.type==="popstate"?r===Wf?!1:(Wf=r,!0):(Wf=null,!1)}var G0=typeof setTimeout=="function"?setTimeout:void 0,RA=typeof clearTimeout=="function"?clearTimeout:void 0,V0=typeof Promise=="function"?Promise:void 0,OA=typeof queueMicrotask=="function"?queueMicrotask:typeof V0<"u"?function(r){return V0.resolve(null).then(r).catch(LA)}:G0;function LA(r){setTimeout(function(){throw r})}function ci(r){return r==="head"}function W0(r,i){var c=i,p=0;do{var v=c.nextSibling;if(r.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"||c==="/&"){if(p===0){r.removeChild(v),Vs(i);return}p--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")p++;else if(c==="html")il(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,il(c);for(var x=c.firstChild;x;){var C=x.nextSibling,M=x.nodeName;x[Or]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=C}}else c==="body"&&il(r.ownerDocument.body);c=v}while(c);Vs(i)}function Z0(r,i){var c=r;r=0;do{var p=c.nextSibling;if(c.nodeType===1?i?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(i?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),p&&p.nodeType===8)if(c=p.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=p}while(c)}function Zf(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var c=i;switch(i=i.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Zf(c),Ga(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function MA(r,i,c,p){for(;r.nodeType===1;){var v=c;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!p&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(p){if(!r[Or])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(x=r.getAttribute("rel"),x==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(x!==v.rel||r.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||r.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||r.getAttribute("title")!==(v.title==null?null:v.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(x=r.getAttribute("src"),(x!==(v.src==null?null:v.src)||r.getAttribute("type")!==(v.type==null?null:v.type)||r.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&x&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var x=v.name==null?null:""+v.name;if(v.type==="hidden"&&r.getAttribute("name")===x)return r}else return r;if(r=Cr(r.nextSibling),r===null)break}return null}function DA(r,i,c){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=Cr(r.nextSibling),r===null))return null;return r}function K0(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Cr(r.nextSibling),r===null))return null;return r}function Kf(r){return r.data==="$?"||r.data==="$~"}function Yf(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function zA(r,i){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||c.readyState!=="loading")i();else{var p=function(){i(),c.removeEventListener("DOMContentLoaded",p)};c.addEventListener("DOMContentLoaded",p),r._reactRetry=p}}function Cr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Qf=null;function Y0(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(i===0)return Cr(r.nextSibling);i--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||i++}r=r.nextSibling}return null}function Q0(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(i===0)return r;i--}else c!=="/$"&&c!=="/&"||i++}r=r.previousSibling}return null}function X0(r,i,c){switch(i=iu(c),r){case"html":if(r=i.documentElement,!r)throw Error(a(452));return r;case"head":if(r=i.head,!r)throw Error(a(453));return r;case"body":if(r=i.body,!r)throw Error(a(454));return r;default:throw Error(a(451))}}function il(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Ga(r)}var Nr=new Map,J0=new Set;function su(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ra=W.d;W.d={f:$A,r:IA,D:PA,C:UA,L:BA,m:FA,X:qA,S:HA,M:GA};function $A(){var r=Ra.f(),i=Qc();return r||i}function IA(r){var i=Nn(r);i!==null&&i.tag===5&&i.type==="form"?gb(i):Ra.r(r)}var Hs=typeof document>"u"?null:document;function ex(r,i,c){var p=Hs;if(p&&typeof i=="string"&&i){var v=yr(i);v='link[rel="'+r+'"][href="'+v+'"]',typeof c=="string"&&(v+='[crossorigin="'+c+'"]'),J0.has(v)||(J0.add(v),r={rel:r,crossOrigin:c,href:i},p.querySelector(v)===null&&(i=p.createElement("link"),Sn(i,"link",r),Lt(i),p.head.appendChild(i)))}}function PA(r){Ra.D(r),ex("dns-prefetch",r,null)}function UA(r,i){Ra.C(r,i),ex("preconnect",r,i)}function BA(r,i,c){Ra.L(r,i,c);var p=Hs;if(p&&r&&i){var v='link[rel="preload"][as="'+yr(i)+'"]';i==="image"&&c&&c.imageSrcSet?(v+='[imagesrcset="'+yr(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(v+='[imagesizes="'+yr(c.imageSizes)+'"]')):v+='[href="'+yr(r)+'"]';var x=v;switch(i){case"style":x=qs(r);break;case"script":x=Gs(r)}Nr.has(x)||(r=m({rel:"preload",href:i==="image"&&c&&c.imageSrcSet?void 0:r,as:i},c),Nr.set(x,r),p.querySelector(v)!==null||i==="style"&&p.querySelector(sl(x))||i==="script"&&p.querySelector(ol(x))||(i=p.createElement("link"),Sn(i,"link",r),Lt(i),p.head.appendChild(i)))}}function FA(r,i){Ra.m(r,i);var c=Hs;if(c&&r){var p=i&&typeof i.as=="string"?i.as:"script",v='link[rel="modulepreload"][as="'+yr(p)+'"][href="'+yr(r)+'"]',x=v;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Gs(r)}if(!Nr.has(x)&&(r=m({rel:"modulepreload",href:r},i),Nr.set(x,r),c.querySelector(v)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(ol(x)))return}p=c.createElement("link"),Sn(p,"link",r),Lt(p),c.head.appendChild(p)}}}function HA(r,i,c){Ra.S(r,i,c);var p=Hs;if(p&&r){var v=hr(p).hoistableStyles,x=qs(r);i=i||"default";var C=v.get(x);if(!C){var M={loading:0,preload:null};if(C=p.querySelector(sl(x)))M.loading=5;else{r=m({rel:"stylesheet",href:r,"data-precedence":i},c),(c=Nr.get(x))&&Xf(r,c);var Y=C=p.createElement("link");Lt(Y),Sn(Y,"link",r),Y._p=new Promise(function(ae,pe){Y.onload=ae,Y.onerror=pe}),Y.addEventListener("load",function(){M.loading|=1}),Y.addEventListener("error",function(){M.loading|=2}),M.loading|=4,ou(C,i,p)}C={type:"stylesheet",instance:C,count:1,state:M},v.set(x,C)}}}function qA(r,i){Ra.X(r,i);var c=Hs;if(c&&r){var p=hr(c).hoistableScripts,v=Gs(r),x=p.get(v);x||(x=c.querySelector(ol(v)),x||(r=m({src:r,async:!0},i),(i=Nr.get(v))&&Jf(r,i),x=c.createElement("script"),Lt(x),Sn(x,"link",r),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(v,x))}}function GA(r,i){Ra.M(r,i);var c=Hs;if(c&&r){var p=hr(c).hoistableScripts,v=Gs(r),x=p.get(v);x||(x=c.querySelector(ol(v)),x||(r=m({src:r,async:!0,type:"module"},i),(i=Nr.get(v))&&Jf(r,i),x=c.createElement("script"),Lt(x),Sn(x,"link",r),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(v,x))}}function tx(r,i,c,p){var v=(v=le.current)?su(v):null;if(!v)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(i=qs(c.href),c=hr(v).hoistableStyles,p=c.get(i),p||(p={type:"style",instance:null,count:0,state:null},c.set(i,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=qs(c.href);var x=hr(v).hoistableStyles,C=x.get(r);if(C||(v=v.ownerDocument||v,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,C),(x=v.querySelector(sl(r)))&&!x._p&&(C.instance=x,C.state.loading=5),Nr.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Nr.set(r,c),x||VA(v,r,c,C.state))),i&&p===null)throw Error(a(528,""));return C}if(i&&p!==null)throw Error(a(529,""));return null;case"script":return i=c.async,c=c.src,typeof c=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Gs(c),c=hr(v).hoistableScripts,p=c.get(i),p||(p={type:"script",instance:null,count:0,state:null},c.set(i,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function qs(r){return'href="'+yr(r)+'"'}function sl(r){return'link[rel="stylesheet"]['+r+"]"}function nx(r){return m({},r,{"data-precedence":r.precedence,precedence:null})}function VA(r,i,c,p){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?p.loading=1:(i=r.createElement("link"),p.preload=i,i.addEventListener("load",function(){return p.loading|=1}),i.addEventListener("error",function(){return p.loading|=2}),Sn(i,"link",c),Lt(i),r.head.appendChild(i))}function Gs(r){return'[src="'+yr(r)+'"]'}function ol(r){return"script[async]"+r}function rx(r,i,c){if(i.count++,i.instance===null)switch(i.type){case"style":var p=r.querySelector('style[data-href~="'+yr(c.href)+'"]');if(p)return i.instance=p,Lt(p),p;var v=m({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return p=(r.ownerDocument||r).createElement("style"),Lt(p),Sn(p,"style",v),ou(p,c.precedence,r),i.instance=p;case"stylesheet":v=qs(c.href);var x=r.querySelector(sl(v));if(x)return i.state.loading|=4,i.instance=x,Lt(x),x;p=nx(c),(v=Nr.get(v))&&Xf(p,v),x=(r.ownerDocument||r).createElement("link"),Lt(x);var C=x;return C._p=new Promise(function(M,Y){C.onload=M,C.onerror=Y}),Sn(x,"link",p),i.state.loading|=4,ou(x,c.precedence,r),i.instance=x;case"script":return x=Gs(c.src),(v=r.querySelector(ol(x)))?(i.instance=v,Lt(v),v):(p=c,(v=Nr.get(x))&&(p=m({},c),Jf(p,v)),r=r.ownerDocument||r,v=r.createElement("script"),Lt(v),Sn(v,"link",p),r.head.appendChild(v),i.instance=v);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(p=i.instance,i.state.loading|=4,ou(p,c.precedence,r));return i.instance}function ou(r,i,c){for(var p=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=p.length?p[p.length-1]:null,x=v,C=0;C<p.length;C++){var M=p[C];if(M.dataset.precedence===i)x=M;else if(x!==v)break}x?x.parentNode.insertBefore(r,x.nextSibling):(i=c.nodeType===9?c.head:c,i.insertBefore(r,i.firstChild))}function Xf(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function Jf(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var lu=null;function ax(r,i,c){if(lu===null){var p=new Map,v=lu=new Map;v.set(c,p)}else v=lu,p=v.get(c),p||(p=new Map,v.set(c,p));if(p.has(r))return p;for(p.set(r,null),c=c.getElementsByTagName(r),v=0;v<c.length;v++){var x=c[v];if(!(x[Or]||x[Gt]||r==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var C=x.getAttribute(i)||"";C=r+C;var M=p.get(C);M?M.push(x):p.set(C,[x])}}return p}function ix(r,i,c){r=r.ownerDocument||r,r.head.insertBefore(c,i==="title"?r.querySelector("head > title"):null)}function WA(r,i,c){if(c===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function sx(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function ZA(r,i,c,p){if(c.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var v=qs(p.href),x=i.querySelector(sl(v));if(x){i=x._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=cu.bind(r),i.then(r,r)),c.state.loading|=4,c.instance=x,Lt(x);return}x=i.ownerDocument||i,p=nx(p),(v=Nr.get(v))&&Xf(p,v),x=x.createElement("link"),Lt(x);var C=x;C._p=new Promise(function(M,Y){C.onload=M,C.onerror=Y}),Sn(x,"link",p),c.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,i),(i=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=cu.bind(r),i.addEventListener("load",c),i.addEventListener("error",c))}}var eh=0;function KA(r,i){return r.stylesheets&&r.count===0&&du(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var p=setTimeout(function(){if(r.stylesheets&&du(r,r.stylesheets),r.unsuspend){var x=r.unsuspend;r.unsuspend=null,x()}},6e4+i);0<r.imgBytes&&eh===0&&(eh=62500*TA());var v=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&du(r,r.stylesheets),r.unsuspend)){var x=r.unsuspend;r.unsuspend=null,x()}},(r.imgBytes>eh?50:800)+i);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(p),clearTimeout(v)}}:null}function cu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)du(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var uu=null;function du(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,uu=new Map,i.forEach(YA,r),uu=null,cu.call(r))}function YA(r,i){if(!(i.state.loading&4)){var c=uu.get(r);if(c)var p=c.get(null);else{c=new Map,uu.set(r,c);for(var v=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<v.length;x++){var C=v[x];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(c.set(C.dataset.precedence,C),p=C)}p&&c.set(null,p)}v=i.instance,C=v.getAttribute("data-precedence"),x=c.get(C)||p,x===p&&c.set(null,v),c.set(C,v),this.count++,p=cu.bind(this),v.addEventListener("load",p),v.addEventListener("error",p),x?x.parentNode.insertBefore(v,x.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(v,r.firstChild)),i.state.loading|=4}}var ll={$$typeof:E,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function QA(r,i,c,p,v,x,C,M,Y){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ci(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ci(0),this.hiddenUpdates=Ci(null),this.identifierPrefix=p,this.onUncaughtError=v,this.onCaughtError=x,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function ox(r,i,c,p,v,x,C,M,Y,ae,pe,me){return r=new QA(r,i,c,C,Y,ae,pe,me,M),i=1,x===!0&&(i|=24),x=Qn(3,null,null,i),r.current=x,x.stateNode=r,i=Op(),i.refCount++,r.pooledCache=i,i.refCount++,x.memoizedState={element:p,isDehydrated:c,cache:i},zp(x),r}function lx(r){return r?(r=ks,r):ks}function cx(r,i,c,p,v,x){v=lx(v),p.context===null?p.context=v:p.pendingContext=v,p=Xa(i),p.payload={element:c},x=x===void 0?null:x,x!==null&&(p.callback=x),c=Ja(r,p,i),c!==null&&(Hn(c,r,i),Uo(c,r,i))}function ux(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<i?c:i}}function th(r,i){ux(r,i),(r=r.alternate)&&ux(r,i)}function dx(r){if(r.tag===13||r.tag===31){var i=Ti(r,67108864);i!==null&&Hn(i,r,67108864),th(r,67108864)}}function px(r){if(r.tag===13||r.tag===31){var i=nr();i=tt(i);var c=Ti(r,i);c!==null&&Hn(c,r,i),th(r,i)}}var pu=!0;function XA(r,i,c,p){var v=B.T;B.T=null;var x=W.p;try{W.p=2,nh(r,i,c,p)}finally{W.p=x,B.T=v}}function JA(r,i,c,p){var v=B.T;B.T=null;var x=W.p;try{W.p=8,nh(r,i,c,p)}finally{W.p=x,B.T=v}}function nh(r,i,c,p){if(pu){var v=rh(p);if(v===null)Ff(r,i,p,fu,c),hx(r,p);else if(tT(v,r,i,c,p))p.stopPropagation();else if(hx(r,p),i&4&&-1<eT.indexOf(r)){for(;v!==null;){var x=Nn(v);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var C=pr(x.pendingLanes);if(C!==0){var M=x;for(M.pendingLanes|=2,M.entangledLanes|=2;C;){var Y=1<<31-Ne(C);M.entanglements[1]|=Y,C&=~Y}Kr(x),(yt&6)===0&&(Kc=ut()+500,nl(0))}}break;case 31:case 13:M=Ti(x,2),M!==null&&Hn(M,x,2),Qc(),th(x,2)}if(x=rh(p),x===null&&Ff(r,i,p,fu,c),x===v)break;v=x}v!==null&&p.stopPropagation()}else Ff(r,i,p,null,c)}}function rh(r){return r=ap(r),ah(r)}var fu=null;function ah(r){if(fu=null,r=gn(r),r!==null){var i=l(r);if(i===null)r=null;else{var c=i.tag;if(c===13){if(r=u(i),r!==null)return r;r=null}else if(c===31){if(r=d(i),r!==null)return r;r=null}else if(c===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return fu=r,null}function fx(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ye()){case X:return 2;case Z:return 8;case ee:case ce:return 32;case he:return 268435456;default:return 32}default:return 32}}var ih=!1,ui=null,di=null,pi=null,cl=new Map,ul=new Map,fi=[],eT="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function hx(r,i){switch(r){case"focusin":case"focusout":ui=null;break;case"dragenter":case"dragleave":di=null;break;case"mouseover":case"mouseout":pi=null;break;case"pointerover":case"pointerout":cl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":ul.delete(i.pointerId)}}function dl(r,i,c,p,v,x){return r===null||r.nativeEvent!==x?(r={blockedOn:i,domEventName:c,eventSystemFlags:p,nativeEvent:x,targetContainers:[v]},i!==null&&(i=Nn(i),i!==null&&dx(i)),r):(r.eventSystemFlags|=p,i=r.targetContainers,v!==null&&i.indexOf(v)===-1&&i.push(v),r)}function tT(r,i,c,p,v){switch(i){case"focusin":return ui=dl(ui,r,i,c,p,v),!0;case"dragenter":return di=dl(di,r,i,c,p,v),!0;case"mouseover":return pi=dl(pi,r,i,c,p,v),!0;case"pointerover":var x=v.pointerId;return cl.set(x,dl(cl.get(x)||null,r,i,c,p,v)),!0;case"gotpointercapture":return x=v.pointerId,ul.set(x,dl(ul.get(x)||null,r,i,c,p,v)),!0}return!1}function mx(r){var i=gn(r.target);if(i!==null){var c=l(i);if(c!==null){if(i=c.tag,i===13){if(i=u(c),i!==null){r.blockedOn=i,pt(r.priority,function(){px(c)});return}}else if(i===31){if(i=d(c),i!==null){r.blockedOn=i,pt(r.priority,function(){px(c)});return}}else if(i===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function hu(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var c=rh(r.nativeEvent);if(c===null){c=r.nativeEvent;var p=new c.constructor(c.type,c);rp=p,c.target.dispatchEvent(p),rp=null}else return i=Nn(c),i!==null&&dx(i),r.blockedOn=c,!1;i.shift()}return!0}function gx(r,i,c){hu(r)&&c.delete(i)}function nT(){ih=!1,ui!==null&&hu(ui)&&(ui=null),di!==null&&hu(di)&&(di=null),pi!==null&&hu(pi)&&(pi=null),cl.forEach(gx),ul.forEach(gx)}function mu(r,i){r.blockedOn===i&&(r.blockedOn=null,ih||(ih=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,nT)))}var gu=null;function vx(r){gu!==r&&(gu=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){gu===r&&(gu=null);for(var i=0;i<r.length;i+=3){var c=r[i],p=r[i+1],v=r[i+2];if(typeof p!="function"){if(ah(p||c)===null)continue;break}var x=Nn(c);x!==null&&(r.splice(i,3),i-=3,nf(x,{pending:!0,data:v,method:c.method,action:p},p,v))}}))}function Vs(r){function i(Y){return mu(Y,r)}ui!==null&&mu(ui,r),di!==null&&mu(di,r),pi!==null&&mu(pi,r),cl.forEach(i),ul.forEach(i);for(var c=0;c<fi.length;c++){var p=fi[c];p.blockedOn===r&&(p.blockedOn=null)}for(;0<fi.length&&(c=fi[0],c.blockedOn===null);)mx(c),c.blockedOn===null&&fi.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(p=0;p<c.length;p+=3){var v=c[p],x=c[p+1],C=v[un]||null;if(typeof x=="function")C||vx(c);else if(C){var M=null;if(x&&x.hasAttribute("formAction")){if(v=x,C=x[un]||null)M=C.formAction;else if(ah(v)!==null)continue}else M=C.action;typeof M=="function"?c[p+1]=M:(c.splice(p,3),p-=3),vx(c)}}}function yx(){function r(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(C){return v=C})},focusReset:"manual",scroll:"manual"})}function i(){v!==null&&(v(),v=null),p||setTimeout(c,20)}function c(){if(!p&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,v=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(c,100),function(){p=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),v!==null&&(v(),v=null)}}}function sh(r){this._internalRoot=r}vu.prototype.render=sh.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var c=i.current,p=nr();cx(c,p,r,i,null,null)},vu.prototype.unmount=sh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;cx(r.current,2,null,r,null,null),Qc(),i[ua]=null}};function vu(r){this._internalRoot=r}vu.prototype.unstable_scheduleHydration=function(r){if(r){var i=Ke();r={blockedOn:null,target:r,priority:i};for(var c=0;c<fi.length&&i!==0&&i<fi[c].priority;c++);fi.splice(c,0,r),c===0&&mx(r)}};var bx=t.version;if(bx!=="19.2.4")throw Error(a(527,bx,"19.2.4"));W.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var rT={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,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(rT),Fe=yu}catch{}}return fl.createRoot=function(r,i){if(!s(r))throw Error(a(299));var c=!1,p="",v=Nb,x=Eb,C=Ab;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(p=i.identifierPrefix),i.onUncaughtError!==void 0&&(v=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(C=i.onRecoverableError)),i=ox(r,1,!1,null,null,c,p,null,v,x,C,yx),r[ua]=i.current,Bf(r),new sh(i)},fl.hydrateRoot=function(r,i,c){if(!s(r))throw Error(a(299));var p=!1,v="",x=Nb,C=Eb,M=Ab,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&&(C=c.onCaughtError),c.onRecoverableError!==void 0&&(M=c.onRecoverableError),c.formState!==void 0&&(Y=c.formState)),i=ox(r,1,!0,i,c??null,p,v,Y,x,C,M,yx),i.context=lx(null),c=i.current,p=nr(),p=tt(p),v=Xa(p),v.callback=null,Ja(c,v,p),c=p,i.current.lanes=c,ge(i,c),Kr(i),r[ua]=i.current,Bf(r),new vu(i)},fl.version="19.2.4",fl}var Tx;function hT(){if(Tx)return ch.exports;Tx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ch.exports=fT(),ch.exports}var mT=hT();/**
51
- * react-router v7.17.0
52
- *
53
- * Copyright (c) Remix Software Inc.
54
- *
55
- * This source code is licensed under the MIT license found in the
56
- * LICENSE.md file in the root directory of this source tree.
57
- *
58
- * @license MIT
59
- */var _x="popstate";function Rx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function gT(e={}){function t(a,s){var h;let l=(h=s.state)==null?void 0:h.masked,{pathname:u,search:d,hash:f}=l||a.location;return bm("",{pathname:u,search:d,hash:f},s.state&&s.state.usr||null,s.state&&s.state.key||"default",l?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,s){return typeof s=="string"?s:$l(s)}return yT(t,n,null,e)}function Bt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Br(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function vT(){return Math.random().toString(36).substring(2,10)}function Ox(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function bm(e,t,n=null,a,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?go(t):t,state:n,key:t&&t.key||a||vT(),mask:s}}function $l({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function go(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function yT(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:l=!1}=a,u=s.history,d="POP",f=null,h=g();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function g(){return(u.state||{idx:null}).idx}function m(){d="POP";let N=g(),S=N==null?null:N-h;h=N,f&&f({action:d,location:j.location,delta:S})}function y(N,S){d="PUSH";let A=Rx(N)?N:bm(j.location,N,S);h=g()+1;let E=Ox(A,h),T=j.createHref(A.mask||A);try{u.pushState(E,"",T)}catch(U){if(U instanceof DOMException&&U.name==="DataCloneError")throw U;s.location.assign(T)}l&&f&&f({action:d,location:j.location,delta:1})}function b(N,S){d="REPLACE";let A=Rx(N)?N:bm(j.location,N,S);h=g();let E=Ox(A,h),T=j.createHref(A.mask||A);u.replaceState(E,"",T),l&&f&&f({action:d,location:j.location,delta:0})}function k(N){return bT(s,N)}let j={get action(){return d},get location(){return e(s,u)},listen(N){if(f)throw new Error("A history only accepts one active listener");return s.addEventListener(_x,m),f=N,()=>{s.removeEventListener(_x,m),f=null}},createHref(N){return t(s,N)},createURL:k,encodeLocation(N){let S=k(N);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:y,replace:b,go(N){return u.go(N)}};return j}function bT(e,t,n=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),Bt(a,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:$l(t);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=a+s),new URL(s,a)}function tS(e,t,n="/"){return xT(e,t,n,!1)}function xT(e,t,n,a,s){let l=typeof t=="string"?go(t):t,u=$a(l.pathname||"/",n);if(u==null)return null;let d=wT(e),f=null,h=LT(u);for(let g=0;f==null&&g<d.length;++g)f=RT(d[g],h,a);return f}function wT(e){let t=nS(e);return kT(t),t}function nS(e,t=[],n=[],a="",s=!1){let l=(u,d,f=s,h)=>{let g={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(a)&&f)return;Bt(g.relativePath.startsWith(a),`Absolute route path "${g.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(a.length)}let m=Pr([a,g.relativePath]),y=n.concat(g);u.children&&u.children.length>0&&(Bt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),nS(u.children,t,y,m,f)),!(u.path==null&&!u.index)&&t.push({path:m,score:TT(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 rS(u.path))l(u,d,!0,h)}),t}function rS(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,s=n.endsWith("?"),l=n.replace(/\?$/,"");if(a.length===0)return s?[l,""]:[l];let u=rS(a.join("/")),d=[];return d.push(...u.map(f=>f===""?l:[l,f].join("/"))),s&&d.push(...u),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function kT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:_T(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var ST=/^:[\w-]+$/,jT=3,CT=2,NT=1,ET=10,AT=-2,Lx=e=>e==="*";function TT(e,t){let n=e.split("/"),a=n.length;return n.some(Lx)&&(a+=AT),t&&(a+=CT),n.filter(s=>!Lx(s)).reduce((s,l)=>s+(ST.test(l)?jT:l===""?NT:ET),a)}function _T(e,t){return e.length===t.length&&e.slice(0,-1).every((a,s)=>a===t[s])?e[e.length-1]-t[t.length-1]:0}function RT(e,t,n=!1){let{routesMeta:a}=e,s={},l="/",u=[];for(let d=0;d<a.length;++d){let f=a[d],h=d===a.length-1,g=l==="/"?t:t.slice(l.length)||"/",m=rd({path:f.relativePath,caseSensitive:f.caseSensitive,end:h},g),y=f.route;if(!m&&h&&n&&!a[a.length-1].route.index&&(m=rd({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},g)),!m)return null;Object.assign(s,m.params),u.push({params:s,pathname:Pr([l,m.pathname]),pathnameBase:$T(Pr([l,m.pathnameBase])),route:y}),m.pathnameBase!=="/"&&(l=Pr([l,m.pathnameBase]))}return u}function rd(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=OT(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let l=s[0],u=l.replace(/(.)\/+$/,"$1"),d=s.slice(1);return{params:a.reduce((h,{paramName:g,isOptional:m},y)=>{if(g==="*"){let k=d[y]||"";u=l.slice(0,l.length-k.length).replace(/(.)\/+$/,"$1")}const b=d[y];return m&&!b?h[g]=void 0:h[g]=(b||"").replace(/%2F/g,"/"),h},{}),pathname:l,pathnameBase:u,pattern:e}}function OT(e,t=!1,n=!0){Br(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,f,h,g)=>{if(a.push({paramName:d,isOptional:f!=null}),f){let m=g.charAt(h+u.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),a]}function LT(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Br(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function $a(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}var MT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function DT(e,t="/"){let{pathname:n,search:a="",hash:s=""}=typeof e=="string"?go(e):e,l;return n?(n=aS(n),n.startsWith("/")?l=Mx(n.substring(1),"/"):l=Mx(n,t)):l=t,{pathname:l,search:IT(a),hash:PT(s)}}function Mx(e,t){let n=ad(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function fh(e,t,n,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function zT(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function pg(e){let t=zT(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function _d(e,t,n,a=!1){let s;typeof e=="string"?s=go(e):(s={...e},Bt(!s.pathname||!s.pathname.includes("?"),fh("?","pathname","search",s)),Bt(!s.pathname||!s.pathname.includes("#"),fh("#","pathname","hash",s)),Bt(!s.search||!s.search.includes("#"),fh("#","search","hash",s)));let l=e===""||s.pathname==="",u=l?"/":s.pathname,d;if(u==null)d=n;else{let m=t.length-1;if(!a&&u.startsWith("..")){let y=u.split("/");for(;y[0]==="..";)y.shift(),m-=1;s.pathname=y.join("/")}d=m>=0?t[m]:"/"}let f=DT(s,d),h=u&&u!=="/"&&u.endsWith("/"),g=(l||u===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||g)&&(f.pathname+="/"),f}var aS=e=>e.replace(/\/\/+/g,"/"),Pr=e=>aS(e.join("/")),ad=e=>e.replace(/\/+$/,""),$T=e=>ad(e).replace(/^\/*/,"/"),IT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,PT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,UT=class{constructor(e,t,n,a=!1){this.status=e,this.statusText=t||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function BT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function FT(e){let t=e.map(n=>n.route.path).filter(Boolean);return Pr(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"||!MT.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=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=$a(u.pathname,t);u.origin===l.origin&&d!=null?n=d+u.search+u.hash:s=!0}catch{Br(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var oS=["POST","PUT","PATCH","DELETE"];new Set(oS);var HT=["GET",...oS];new Set(HT);var vo=w.createContext(null);vo.displayName="DataRouter";var Rd=w.createContext(null);Rd.displayName="DataRouterState";var lS=w.createContext(!1);function qT(){return w.useContext(lS)}var cS=w.createContext({isTransitioning:!1});cS.displayName="ViewTransition";var GT=w.createContext(new Map);GT.displayName="Fetchers";var VT=w.createContext(null);VT.displayName="Await";var ur=w.createContext(null);ur.displayName="Navigation";var Zl=w.createContext(null);Zl.displayName="Location";var oa=w.createContext({outlet:null,matches:[],isDataRoute:!1});oa.displayName="Route";var fg=w.createContext(null);fg.displayName="RouteError";var uS="REACT_ROUTER_ERROR",WT="REDIRECT",ZT="ROUTE_ERROR_RESPONSE";function KT(e){if(e.startsWith(`${uS}:${WT}:{`))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 YT(e){if(e.startsWith(`${uS}:${ZT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new UT(t.status,t.statusText,t.data)}catch{}}function QT(e,{relative:t}={}){Bt(yo(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=w.useContext(ur),{hash:s,pathname:l,search:u}=Kl(e,{relative:t}),d=l;return n!=="/"&&(d=l==="/"?n:Pr([n,l])),a.createHref({pathname:d,search:u,hash:s})}function yo(){return w.useContext(Zl)!=null}function Fr(){return Bt(yo(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(Zl).location}var dS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function pS(e){w.useContext(ur).static||w.useLayoutEffect(e)}function hg(){let{isDataRoute:e}=w.useContext(oa);return e?u2():XT()}function XT(){Bt(yo(),"useNavigate() may be used only in the context of a <Router> component.");let e=w.useContext(vo),{basename:t,navigator:n}=w.useContext(ur),{matches:a}=w.useContext(oa),{pathname:s}=Fr(),l=JSON.stringify(pg(a)),u=w.useRef(!1);return pS(()=>{u.current=!0}),w.useCallback((f,h={})=>{if(Br(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:Pr([t,g.pathname])),(h.replace?n.replace:n.push)(g,h.state,h)},[t,n,l,s,e])}w.createContext(null);function Kl(e,{relative:t}={}){let{matches:n}=w.useContext(oa),{pathname:a}=Fr(),s=JSON.stringify(pg(n));return w.useMemo(()=>_d(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function JT(e,t){return fS(e,t)}function fS(e,t,n){var N;Bt(yo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=w.useContext(ur),{matches:s}=w.useContext(oa),l=s[s.length-1],u=l?l.params:{},d=l?l.pathname:"/",f=l?l.pathnameBase:"/",h=l&&l.route;{let S=h&&h.path||"";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=Fr(),m;if(t){let S=typeof t=="string"?go(t):t;Bt(f==="/"||((N=S.pathname)==null?void 0:N.startsWith(f)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${S.pathname}" was given in the \`location\` prop.`),m=S}else m=g;let y=m.pathname||"/",b=y;if(f!=="/"){let S=f.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(S.length).join("/")}let k=n&&n.state.matches.length?n.state.matches.map(S=>Object.assign(S,{route:n.manifest[S.route.id]||S.route})):tS(e,{pathname:b});Br(h||k!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Br(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=a2(k&&k.map(S=>Object.assign({},S,{params:Object.assign({},u,S.params),pathname:Pr([f,a.encodeLocation?a.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?f:Pr([f,a.encodeLocation?a.encodeLocation(S.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),s,n);return t&&j?w.createElement(Zl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},j):j}function e2(){let e=c2(),t=BT(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:a},l={padding:"2px 4px",backgroundColor:a},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:l},"ErrorBoundary")," or"," ",w.createElement("code",{style:l},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:s},n):null,u)}var t2=w.createElement(e2,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=YT(e.digest);n&&(e=n)}let t=e!==void 0?w.createElement(oa.Provider,{value:this.props.routeContext},w.createElement(fg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?w.createElement(n2,{error:e},t):t}};hS.contextType=lS;var hh=new WeakMap;function n2({children:e,error:t}){let{basename:n}=w.useContext(ur);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=KT(t.digest);if(a){let s=hh.get(t);if(s)throw s;let l=sS(a.location,n);if(iS&&!hh.get(t))if(l.isExternal||a.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:a.replace}));throw hh.set(t,u),u}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function r2({routeContext:e,match:t,children:n}){let a=w.useContext(vo);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(oa.Provider,{value:e},n)}function a2(e,t=[],n){let a=n==null?void 0:n.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let s=e,l=a==null?void 0:a.errors;if(l!=null){let g=s.findIndex(m=>m.route.id&&(l==null?void 0:l[m.route.id])!==void 0);Bt(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let u=!1,d=-1;if(n&&a){u=a.renderFallback;for(let g=0;g<s.length;g++){let m=s[g];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(d=g),m.route.id){let{loaderData:y,errors:b}=a,k=m.route.loader&&!y.hasOwnProperty(m.route.id)&&(!b||b[m.route.id]===void 0);if(m.route.lazy||k){n.isStatic&&(u=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let f=n==null?void 0:n.onError,h=a&&f?(g,m)=>{var y,b;f(g,{location:a.location,params:((b=(y=a.matches)==null?void 0:y[0])==null?void 0:b.params)??{},pattern:FT(a.matches),errorInfo:m})}:void 0;return s.reduceRight((g,m,y)=>{let b,k=!1,j=null,N=null;a&&(b=l&&m.route.id?l[m.route.id]:void 0,j=m.route.errorElement||t2,u&&(d<0&&y===0?(mS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,N=null):d===y&&(k=!0,N=m.route.hydrateFallbackElement||null)));let S=t.concat(s.slice(0,y+1)),A=()=>{let E;return b?E=j:k?E=N:m.route.Component?E=w.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=g,w.createElement(r2,{match:m,routeContext:{outlet:g,matches:S,isDataRoute:a!=null},children:E})};return a&&(m.route.ErrorBoundary||m.route.errorElement||y===0)?w.createElement(hS,{location:a.location,revalidation:a.revalidation,component:j,error:b,children:A(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):A()},null)}function mg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function i2(e){let t=w.useContext(vo);return Bt(t,mg(e)),t}function s2(e){let t=w.useContext(Rd);return Bt(t,mg(e)),t}function o2(e){let t=w.useContext(oa);return Bt(t,mg(e)),t}function gg(e){let t=o2(e),n=t.matches[t.matches.length-1];return Bt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function l2(){return gg("useRouteId")}function c2(){var a;let e=w.useContext(fg),t=s2("useRouteError"),n=gg("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function u2(){let{router:e}=i2("useNavigate"),t=gg("useNavigate"),n=w.useRef(!1);return pS(()=>{n.current=!0}),w.useCallback(async(s,l={})=>{Br(n.current,dS),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...l}))},[e,t])}var Dx={};function mS(e,t,n){!t&&!Dx[e]&&(Dx[e]=!0,Br(!1,n))}w.memo(d2);function d2({routes:e,manifest:t,future:n,state:a,isStatic:s,onError:l}){return fS(e,void 0,{manifest:t,state:a,isStatic:s,onError:l})}function El({to:e,replace:t,state:n,relative:a}){Bt(yo(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=w.useContext(ur);Br(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=w.useContext(oa),{pathname:u}=Fr(),d=hg(),f=_d(e,pg(l),u,a==="path"),h=JSON.stringify(f);return w.useEffect(()=>{d(JSON.parse(h),{replace:t,state:n,relative:a})},[d,h,a,t,n]),null}function vi(e){Bt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function p2({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:l=!1,useTransitions:u}){Bt(!yo(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=w.useMemo(()=>({basename:d,navigator:s,static:l,useTransitions:u,future:{}}),[d,s,l,u]);typeof n=="string"&&(n=go(n));let{pathname:h="/",search:g="",hash:m="",state:y=null,key:b="default",mask:k}=n,j=w.useMemo(()=>{let N=$a(h,d);return N==null?null:{location:{pathname:N,search:g,hash:m,state:y,key:b,mask:k},navigationType:a}},[d,h,g,m,y,b,a,k]);return Br(j!=null,`<Router basename="${d}"> is not able to match the URL "${h}${g}${m}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:w.createElement(ur.Provider,{value:f},w.createElement(Zl.Provider,{children:t,value:j}))}function f2({children:e,location:t}){return JT(xm(e),t)}function xm(e,t=[]){let n=[];return w.Children.forEach(e,(a,s)=>{if(!w.isValidElement(a))return;let l=[...t,s];if(a.type===w.Fragment){n.push.apply(n,xm(a.props.children,l));return}Bt(a.type===vi,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Bt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let u={id:a.props.id||l.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(u.children=xm(a.props.children,l)),n.push(u)}),n}var Hu="get",qu="application/x-www-form-urlencoded";function Od(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function h2(e){return Od(e)&&e.tagName.toLowerCase()==="button"}function m2(e){return Od(e)&&e.tagName.toLowerCase()==="form"}function g2(e){return Od(e)&&e.tagName.toLowerCase()==="input"}function v2(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function y2(e,t){return e.button===0&&(!t||t==="_self")&&!v2(e)}var bu=null;function b2(){if(bu===null)try{new FormData(document.createElement("form"),0),bu=!1}catch{bu=!0}return bu}var x2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function mh(e){return e!=null&&!x2.has(e)?(Br(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${qu}"`),null):e}function w2(e,t){let n,a,s,l,u;if(m2(e)){let d=e.getAttribute("action");a=d?$a(d,t):null,n=e.getAttribute("method")||Hu,s=mh(e.getAttribute("enctype"))||qu,l=new FormData(e)}else if(h2(e)||g2(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||d.getAttribute("action");if(a=f?$a(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Hu,s=mh(e.getAttribute("formenctype"))||mh(d.getAttribute("enctype"))||qu,l=new FormData(d,e),!b2()){let{name:h,type:g,value:m}=e;if(g==="image"){let y=h?`${h}.`:"";l.append(`${y}x`,"0"),l.append(`${y}y`,"0")}else h&&l.append(h,m)}}else{if(Od(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Hu,a=null,s=qu,u=e}return l&&s==="text/plain"&&(u=l,l=void 0),{action:a,method:n.toLowerCase(),encType:s,formData:l,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function gS(e,t,n,a){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${a}`:s.pathname=`${s.pathname}.${a}`:s.pathname==="/"?s.pathname=`_root.${a}`:t&&$a(s.pathname,t)==="/"?s.pathname=`${ad(t)}/_root.${a}`:s.pathname=`${ad(s.pathname)}.${a}`,s}async function k2(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 S2(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 j2(e,t,n){let a=await Promise.all(e.map(async s=>{let l=t.routes[s.route.id];if(l){let u=await k2(l,n);return u.links?u.links():[]}return[]}));return A2(a.flat(1).filter(S2).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function zx(e,t,n,a,s,l){let u=(f,h)=>n[h]?f.route.id!==n[h].route.id:!0,d=(f,h)=>{var g;return n[h].pathname!==f.pathname||((g=n[h].route.path)==null?void 0:g.endsWith("*"))&&n[h].params["*"]!==f.params["*"]};return l==="assets"?t.filter((f,h)=>u(f,h)||d(f,h)):l==="data"?t.filter((f,h)=>{var m;let g=a.routes[f.route.id];if(!g||!g.hasLoader)return!1;if(u(f,h)||d(f,h))return!0;if(f.route.shouldRevalidate){let y=f.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function C2(e,t,{includeHydrateFallback:n}={}){return N2(e.map(a=>{let s=t.routes[a.route.id];if(!s)return[];let l=[s.module];return s.clientActionModule&&(l=l.concat(s.clientActionModule)),s.clientLoaderModule&&(l=l.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(l=l.concat(s.hydrateFallbackModule)),s.imports&&(l=l.concat(s.imports)),l}).flat(1))}function N2(e){return[...new Set(e)]}function E2(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function A2(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let l=JSON.stringify(E2(s));return n.has(l)||(n.add(l),a.push({key:l,link:s})),a},[])}function yg(){let e=w.useContext(vo);return vg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function T2(){let e=w.useContext(Rd);return vg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var bg=w.createContext(void 0);bg.displayName="FrameworkContext";function xg(){let e=w.useContext(bg);return vg(e,"You must render this element inside a <HydratedRouter> element"),e}function _2(e,t){let n=w.useContext(bg),[a,s]=w.useState(!1),[l,u]=w.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:h,onMouseLeave:g,onTouchStart:m}=t,y=w.useRef(null);w.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let j=S=>{S.forEach(A=>{u(A.isIntersecting)})},N=new IntersectionObserver(j,{threshold:.5});return y.current&&N.observe(y.current),()=>{N.disconnect()}}},[e]),w.useEffect(()=>{if(a){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[a]);let b=()=>{s(!0)},k=()=>{s(!1),u(!1)};return n?e!=="intent"?[l,y,{}]:[l,y,{onFocus:hl(d,b),onBlur:hl(f,k),onMouseEnter:hl(h,b),onMouseLeave:hl(g,k),onTouchStart:hl(m,b)}]:[!1,y,{}]}function hl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function R2({page:e,...t}){let n=qT(),{router:a}=yg(),s=w.useMemo(()=>tS(a.routes,e,a.basename),[a.routes,e,a.basename]);return s?n?w.createElement(L2,{page:e,matches:s,...t}):w.createElement(M2,{page:e,matches:s,...t}):null}function O2(e){let{manifest:t,routeModules:n}=xg(),[a,s]=w.useState([]);return w.useEffect(()=>{let l=!1;return j2(e,t,n).then(u=>{l||s(u)}),()=>{l=!0}},[e,t,n]),a}function L2({page:e,matches:t,...n}){let a=Fr(),{future:s}=xg(),{basename:l}=yg(),u=w.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let d=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,a,t]);return w.createElement(w.Fragment,null,u.map(d=>w.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function M2({page:e,matches:t,...n}){let a=Fr(),{future:s,manifest:l,routeModules:u}=xg(),{basename:d}=yg(),{loaderData:f,matches:h}=T2(),g=w.useMemo(()=>zx(e,t,h,l,a,"data"),[e,t,h,l,a]),m=w.useMemo(()=>zx(e,t,h,l,a,"assets"),[e,t,h,l,a]),y=w.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let j=new Set,N=!1;if(t.forEach(A=>{var T;let E=l.routes[A.route.id];!E||!E.hasLoader||(!g.some(U=>U.route.id===A.route.id)&&A.route.id in f&&((T=u[A.route.id])!=null&&T.shouldRevalidate)||E.hasClientLoader?N=!0:j.add(A.route.id))}),j.size===0)return[];let S=gS(e,d,s.v8_trailingSlashAwareDataRequests,"data");return N&&j.size>0&&S.searchParams.set("_routes",t.filter(A=>j.has(A.route.id)).map(A=>A.route.id).join(",")),[S.pathname+S.search]},[d,s.v8_trailingSlashAwareDataRequests,f,a,l,g,t,e,u]),b=w.useMemo(()=>C2(m,l),[m,l]),k=O2(m);return w.createElement(w.Fragment,null,y.map(j=>w.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),b.map(j=>w.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),k.map(({key:j,link:N})=>w.createElement("link",{key:j,nonce:n.nonce,...N,crossOrigin:N.crossOrigin??n.crossOrigin})))}function D2(...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 $2({basename:e,children:t,useTransitions:n,window:a}){let s=w.useRef();s.current==null&&(s.current=gT({window:a,v5Compat:!0}));let l=s.current,[u,d]=w.useState({action:l.action,location:l.location}),f=w.useCallback(h=>{n===!1?d(h):w.startTransition(()=>d(h))},[n]);return w.useLayoutEffect(()=>l.listen(f),[l,f]),w.createElement(p2,{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:a="none",relative:s,reloadDocument:l,replace:u,mask:d,state:f,target:h,to:g,preventScrollReset:m,viewTransition:y,defaultShouldRevalidate:b,...k},j){let{basename:N,navigator:S,useTransitions:A}=w.useContext(ur),E=typeof g=="string"&&vS.test(g),T=sS(g,N);g=T.to;let U=QT(g,{relative:s}),_=Fr(),z=null;if(d){let H=_d(d,[],_.mask?_.mask.pathname:"/",!0);N!=="/"&&(H.pathname=H.pathname==="/"?N:Pr([N,H.pathname])),z=S.createHref(H)}let[q,D,R]=_2(a,k),$=B2(g,{replace:u,mask:d,state:f,target:h,preventScrollReset:m,relative:s,viewTransition:y,defaultShouldRevalidate:b,useTransitions:A});function F(H){t&&t(H),H.defaultPrevented||$(H)}let K=!(T.isExternal||l),I=w.createElement("a",{...k,...R,href:(K?z:void 0)||T.absoluteURL||U,onClick:K?F:t,ref:D2(j,D),target:h,"data-discover":!E&&n==="render"?"true":void 0});return q&&!E?w.createElement(w.Fragment,null,I,w.createElement(R2,{page:U})):I});yS.displayName="Link";var I2=w.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:l,to:u,viewTransition:d,children:f,...h},g){let m=Kl(u,{relative:h.relative}),y=Fr(),b=w.useContext(Rd),{navigator:k,basename:j}=w.useContext(ur),N=b!=null&&V2(m)&&d===!0,S=k.encodeLocation?k.encodeLocation(m).pathname:m.pathname,A=y.pathname,E=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(A=A.toLowerCase(),E=E?E.toLowerCase():null,S=S.toLowerCase()),E&&j&&(E=$a(E,j)||E);const T=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let U=A===S||!s&&A.startsWith(S)&&A.charAt(T)==="/",_=E!=null&&(E===S||!s&&E.startsWith(S)&&E.charAt(S.length)==="/"),z={isActive:U,isPending:_,isTransitioning:N},q=U?t:void 0,D;typeof a=="function"?D=a(z):D=[a,U?"active":null,_?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let R=typeof l=="function"?l(z):l;return w.createElement(yS,{...h,"aria-current":q,className:D,ref:g,style:R,to:u,viewTransition:d},typeof f=="function"?f(z):f)});I2.displayName="NavLink";var P2=w.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:l,method:u=Hu,action:d,onSubmit:f,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:y,...b},k)=>{let{useTransitions:j}=w.useContext(ur),N=q2(),S=G2(d,{relative:h}),A=u.toLowerCase()==="get"?"get":"post",E=typeof d=="string"&&vS.test(d),T=U=>{if(f&&f(U),U.defaultPrevented)return;U.preventDefault();let _=U.nativeEvent.submitter,z=(_==null?void 0:_.getAttribute("formmethod"))||u,q=()=>N(_||U.currentTarget,{fetcherKey:t,method:z,navigate:n,replace:s,state:l,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:y});j&&n!==!1?w.startTransition(()=>q()):q()};return w.createElement("form",{ref:k,method:A,action:S,onSubmit:a?f:T,...b,"data-discover":!E&&e==="render"?"true":void 0})});P2.displayName="Form";function U2(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 Bt(t,U2(e)),t}function B2(e,{target:t,replace:n,mask:a,state:s,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f,useTransitions:h}={}){let g=hg(),m=Fr(),y=Kl(e,{relative:u});return w.useCallback(b=>{if(y2(b,t)){b.preventDefault();let k=n!==void 0?n:$l(m)===$l(y),j=()=>g(e,{replace:k,mask:a,state:s,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f});h?w.startTransition(()=>j()):j()}},[m,g,y,n,a,s,t,e,l,u,d,f,h])}var F2=0,H2=()=>`__${String(++F2)}__`;function q2(){let{router:e}=bS("useSubmit"),{basename:t}=w.useContext(ur),n=l2(),a=e.fetch,s=e.navigate;return w.useCallback(async(l,u={})=>{let{action:d,method:f,encType:h,formData:g,body:m}=w2(l,t);if(u.navigate===!1){let y=u.fetcherKey||H2();await a(y,n,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:m,formMethod:u.method||f,formEncType:u.encType||h,flushSync:u.flushSync})}else await s(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:m,formMethod:u.method||f,formEncType:u.encType||h,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[a,s,t,n])}function G2(e,{relative:t}={}){let{basename:n}=w.useContext(ur),a=w.useContext(oa);Bt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),l={...Kl(e||".",{relative:t})},u=Fr();if(e==null){l.search=u.search;let d=new URLSearchParams(l.search),f=d.getAll("index");if(f.some(g=>g==="")){d.delete("index"),f.filter(m=>m).forEach(m=>d.append("index",m));let g=d.toString();l.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:Pr([n,l.pathname])),$l(l)}function V2(e,{relative:t}={}){let n=w.useContext(cS);Bt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=bS("useViewTransitionState"),s=Kl(e,{relative:t});if(!n.isTransitioning)return!1;let l=$a(n.currentLocation.pathname,a)||n.currentLocation.pathname,u=$a(n.nextLocation.pathname,a)||n.nextLocation.pathname;return rd(s.pathname,u)!=null||rd(s.pathname,l)!=null}var W2=eS();const Z2="modulepreload",K2=function(e){return"/ui/"+e},$x={},gt=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let u=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));s=u(n.map(h=>{if(h=K2(h),h in $x)return;$x[h]=!0;const g=h.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${m}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":Z2,g||(y.as="script"),y.crossOrigin="",y.href=h,f&&y.setAttribute("nonce",f),document.head.appendChild(y),g)return new Promise((b,k)=>{y.addEventListener("load",b),y.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return s.then(u=>{for(const d of u||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})},Ix=e=>{let t;const n=new Set,a=(h,g)=>{const m=typeof h=="function"?h(t):h;if(!Object.is(m,t)){const y=t;t=g??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(b=>b(t,y))}},s=()=>t,d={setState:a,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h))},f=t=e(a,s,d);return d},Y2=(e=>e?Ix(e):Ix),Q2=e=>e;function X2(e,t=Q2){const n=Ve.useSyncExternalStore(e.subscribe,Ve.useCallback(()=>t(e.getState()),[e,t]),Ve.useCallback(()=>t(e.getInitialState()),[e,t]));return Ve.useDebugValue(n),n}const Px=e=>{const t=Y2(e),n=a=>X2(t,a);return Object.assign(n,t),n},is=(e=>e?Px(e):Px),xS="dkg-layout",J2=260,Yr={leftCollapsed:!1,rightCollapsed:!1,bottomCollapsed:!0,leftSectionMyProjectsOpen:!0,leftSectionIntegrationsOpen:!1,leftWidth:240,rightWidth:360,bottomHeight:J2},wS=140,kS=400,SS=200,jS=500,CS=120,id=600,e_=240;function t_(e,t){if(typeof document>"u")return t;const n=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),a=parseFloat(n);return Number.isFinite(a)?a:t}function sd(){const e=t_("--header-h",44),t=typeof window<"u"&&window.innerHeight?window.innerHeight:0;if(!t)return id;const n=t-e-e_;return Math.max(0,Math.min(id,n))}function Gu(e,t,n){return Math.max(t,Math.min(n,e))}function gh(e,t,n,a){return typeof e!="number"||!Number.isFinite(e)?t:Gu(e,n,a)}function n_(){try{const e=localStorage.getItem(xS);if(!e)return Yr;const t=JSON.parse(e);return{leftCollapsed:typeof t.leftCollapsed=="boolean"?t.leftCollapsed:Yr.leftCollapsed,rightCollapsed:typeof t.rightCollapsed=="boolean"?t.rightCollapsed:Yr.rightCollapsed,bottomCollapsed:typeof t.bottomCollapsed=="boolean"?t.bottomCollapsed:Yr.bottomCollapsed,leftSectionMyProjectsOpen:typeof t.leftSectionMyProjectsOpen=="boolean"?t.leftSectionMyProjectsOpen:Yr.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:typeof t.leftSectionIntegrationsOpen=="boolean"?t.leftSectionIntegrationsOpen:Yr.leftSectionIntegrationsOpen,leftWidth:gh(t.leftWidth,Yr.leftWidth,wS,kS),rightWidth:gh(t.rightWidth,Yr.rightWidth,SS,jS),bottomHeight:gh(t.bottomHeight,Yr.bottomHeight,CS,id)}}catch{return Yr}}let xu=null;function Oa(e){xu&&clearTimeout(xu),xu=setTimeout(()=>{xu=null;try{localStorage.setItem(xS,JSON.stringify(e))}catch{}},150)}function La(e){return{leftCollapsed:e.leftCollapsed,rightCollapsed:e.rightCollapsed,bottomCollapsed:e.bottomCollapsed,leftSectionMyProjectsOpen:e.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:e.leftSectionIntegrationsOpen,leftWidth:e.leftWidth,rightWidth:e.rightWidth,bottomHeight:e.bottomHeight}}const mi=n_(),Vn=is((e,t)=>({leftCollapsed:mi.leftCollapsed,rightCollapsed:mi.rightCollapsed,bottomCollapsed:mi.bottomCollapsed,bottomMaximised:!1,leftSectionMyProjectsOpen:mi.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:mi.leftSectionIntegrationsOpen,theme:localStorage.getItem("dkg-theme")||"dark",leftWidth:mi.leftWidth,rightWidth:mi.rightWidth,bottomHeight:mi.bottomHeight,toggleLeft:()=>{e(n=>({leftCollapsed:!n.leftCollapsed})),Oa(La(t()))},toggleRight:()=>{e(n=>({rightCollapsed:!n.rightCollapsed})),Oa(La(t()))},toggleBottom:()=>{e(n=>({bottomCollapsed:!n.bottomCollapsed,bottomMaximised:!1})),Oa(La(t()))},toggleBottomMaximised:()=>{e(n=>({bottomMaximised:!n.bottomMaximised,bottomCollapsed:!1})),Oa(La(t()))},toggleLeftSectionMyProjects:()=>{e(n=>({leftSectionMyProjectsOpen:!n.leftSectionMyProjectsOpen})),Oa(La(t()))},toggleLeftSectionIntegrations:()=>{e(n=>({leftSectionIntegrationsOpen:!n.leftSectionIntegrationsOpen})),Oa(La(t()))},setTheme:n=>{localStorage.setItem("dkg-theme",n),e({theme:n})},setLeftWidth:n=>{e({leftWidth:Gu(n,wS,kS)}),Oa(La(t()))},setRightWidth:n=>{e({rightWidth:Gu(n,SS,jS)}),Oa(La(t()))},setBottomHeight:n=>{const a=Math.min(CS,sd());e({bottomHeight:Gu(n,a,id)}),Oa(La(t()))}})),wg=is(e=>({agents:[],activeAgentName:null,nodeStatus:null,setAgents:t=>e({agents:t}),setActiveAgent:t=>e({activeAgentName:t}),setNodeStatus:t=>e({nodeStatus:t})})),r_=[{id:"dashboard",label:"Dashboard",closable:!1}],fn=is((e,t)=>({tabs:r_,activeTabId:"dashboard",openTab:n=>{const{tabs:a}=t();a.find(s=>s.id===n.id)?e({activeTabId:n.id}):e({tabs:[...a,n],activeTabId:n.id})},closeTab:n=>{var d;const{tabs:a,activeTabId:s}=t(),l=a.filter(f=>f.id!==n);if(l.length===0)return;const u=s===n?((d=l[Math.max(0,a.findIndex(f=>f.id===n)-1)])==null?void 0:d.id)??l[0].id:s;e({tabs:l,activeTabId:u})},setActiveTab:n=>e({activeTabId:n})})),_r="";function Ft(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}class $n extends Error{constructor(n,a,s){super(a??`HTTP ${n}`);jn(this,"status");jn(this,"body");this.status=n,this.body=s}}async function kg(e,t={},n=1e4){try{return await fetch(e,{...t,signal:AbortSignal.timeout(n)})}catch(a){throw a instanceof Error&&a.name==="TimeoutError"?new Error(`Request timed out after ${Math.round(n/1e3)}s`):a}}async function xt(e){const t=await fetch(`${_r}${e}`,{headers:Ft()});if(!t.ok){const n=await t.json().catch(()=>({})),a=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new $n(t.status,a,n)}return t.json()}async function bo(e){const t=await fetch(`${_r}${e}`,{headers:Ft()});if(!t.ok){const n=await t.json().catch(()=>({})),a=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new $n(t.status,a,n)}return t.json()}async function NS(e,t){const n=await kg(`${_r}${e}`,{headers:Ft()},t);if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new $n(n.status,s,a)}return n.json()}async function bn(e,t){const n=await fetch(`${_r}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify(t)});if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new $n(n.status,s,a)}return n.json()}async function Sg(e,t){const n=await fetch(`${_r}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify(t)});if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}async function a_(e){const t=await fetch(`${_r}${e}`,{method:"DELETE",headers:Ft()});if(!t.ok){const n=await t.json().catch(()=>({})),a=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new $n(t.status,a,n)}return t.json()}const od=(e,t,n)=>{const a=new URLSearchParams;t&&a.set("key",t),n!=null&&n.extended&&a.set("extended","1");const s=a.toString();return bo(`/api/pca/${encodeURIComponent(e)}${s?`?${s}`:""}`).then(l=>n!=null&&n.extended?{...l,extendedRequested:!0}:l)},_G=e=>bn("/api/pca",{tokens:e.tokens,primaryNode:e.primaryNode}),RG=(e,t)=>bn(`/api/pca/${encodeURIComponent(e)}/agent`,{agent:t}),OG=(e,t)=>a_(`/api/pca/${encodeURIComponent(e)}/agent/${encodeURIComponent(t)}`),LG=(e,t)=>bn(`/api/pca/${encodeURIComponent(e)}/funds`,{tokens:t}),MG=e=>bn(`/api/pca/${encodeURIComponent(e)}/settle`,{}),DG=e=>bo(`/api/pca/${encodeURIComponent(e)}/agents`),i_=e=>bo(`/api/pca/agent/${encodeURIComponent(e)}`),zG=e=>bo("/api/pca/mine?hydrate=1"),$G=e=>bo(`/api/pca/designatable-nodes${e!=null&&e.fresh?"?fresh=1":""}`),s_=()=>bo("/api/pca/contracts");function ES(e){var n;if(!(e instanceof $n))return!1;const t=(n=e.body)==null?void 0:n.code;return typeof t=="string"&&(t.startsWith("RPC_")||t==="TIMEOUT")}function IG(e){return e instanceof $n&&e.status===503&&!ES(e)}function PG(e){if(!(e instanceof $n)||e.status!==503)return!1;const t=e.body;return(t==null?void 0:t.code)==="PCA_LOOKUP_READ_FAILED"||(t==null?void 0:t.error)==="PCA_LOOKUP_READ_FAILED"}const o_=["PrimaryNodeNotInShardingTable","PrimaryNodeUnchanged","PrimaryNodeChangeRateLimited","ZeroPrimaryNode","InvalidAmount","ZeroAgentAddress","TokenTransferFailed","NotAccountOwner","AgentAlreadyRegistered","AgentNotRegistered","AgentCapReached","AccountExpired","AccountAlreadyFullySettled","UnknownAccount"];function UG(e,t={}){if(!(e instanceof $n))return null;const n=e.status,a=e.body??{},s=typeof a.error=="string"&&a.error.length>0?a.error:e.message,l=t.accountId?`PCA #${t.accountId}`:"this Publisher Conviction Account",u=a.existingAccountId!=null?String(a.existingAccountId):void 0;if(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=o_.find(f=>new RegExp(`\\b${f}\\b`).test(s));if(d){let f;switch(d){case"InvalidAmount":f="Enter a TRAC amount greater than 0.";break;case"PrimaryNodeNotInShardingTable":f="That primary node isn't a staked node in the sharding table.";break;case"ZeroPrimaryNode":f="Choose a staked node as the primary node.";break;case"PrimaryNodeUnchanged":f="That's already this account's primary node.";break;case"PrimaryNodeChangeRateLimited":f="The primary node was changed too recently — try again later.";break;case"ZeroAgentAddress":f="Enter a valid operational wallet address.";break;case"TokenTransferFailed":f="The TRAC transfer failed — check the owner wallet's TRAC balance and allowance.";break;case"NotAccountOwner":f=`This node isn't the owner of ${l}, so it can't manage it.`;break;case"UnknownAccount":f=`${l} doesn't exist.`;break;case"AgentAlreadyRegistered":f=u?`This operational wallet is already an approved publishing wallet on PCA #${u} — deregister it there first.`:"This operational wallet is already approved on another PCA — deregister it there first.";break;case"AgentNotRegistered":f=`This operational wallet isn't an approved publishing wallet on ${l}.`;break;case"AgentCapReached":f=`${l} already has the maximum 100 approved publishing wallets.`;break;case"AccountExpired":f=`${l} has expired.`;break;case"AccountAlreadyFullySettled":f=`${l} is already fully settled.`;break;default:f=s}return{code:d,status:n,message:f,...u?{existingAccountId:u}:{}}}return n===404?{code:"UnknownAccount",status:n,message:`${l} doesn't exist.`}:n===403?{code:"NotAccountOwner",status:n,message:`This node isn't the owner of ${l}, so it can't manage it.`}:n===400?{code:"BadRequest",status:n,message:s}:n===409?{code:"Conflict",status:n,message:s}:n>=500?{code:"ServerError",status:n,message:"Something went wrong talking to the chain — try again."}:{code:"Unknown",status:n,message:s}}const Ux="did:dkg:context-graph:",AS=6e4;function TS(e){const t=e.trim();return t.startsWith(Ux)?t.slice(Ux.length):t}class wm extends Error{constructor(n,a={}){super(n);jn(this,"status");jn(this,"code");jn(this,"source");jn(this,"details");jn(this,"correlationId");jn(this,"timeoutMs");jn(this,"target");jn(this,"route");jn(this,"integrationId");jn(this,"retryable");this.name="LocalAgentApiError",Object.assign(this,a)}}const jg=()=>xt("/api/status"),BG=()=>xt("/api/settings/retention"),FG=e=>Sg("/api/settings/retention",{retentionDays:e}),HG=()=>xt("/api/settings/telemetry"),qG=e=>Sg("/api/settings/telemetry",{enabled:e}),l_=()=>xt("/api/connections"),c_=(e,t=1e4)=>kg(`${_r}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify({multiaddr:e})},t).then(async n=>{if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}),u_=(e,t=2e4)=>kg(`${_r}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify({peerId:e})},t).then(async n=>{if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}),Cg=()=>xt("/api/agents"),d_=()=>xt("/api/metrics"),GG=(e,t,n=300)=>xt(`/api/metrics/history?from=${e}&to=${t}&maxPoints=${n}`),p_=(e={})=>{const t=new URLSearchParams({...e,phases:"1"}).toString();return xt(`/api/operations?${t}`)},VG=e=>xt(`/api/operations/${e}`),WG=e=>{const t=e?`?periodMs=${e}`:"";return xt(`/api/error-hotspots${t}`)},ZG=(e={})=>{const t=new URLSearchParams;e.phase&&t.set("phase",e.phase),e.operationName&&t.set("operationName",e.operationName),e.periodMs&&t.set("periodMs",String(e.periodMs)),e.q&&t.set("q",e.q),e.limit&&t.set("limit",String(e.limit));const n=t.toString();return xt(`/api/failed-operations${n?"?"+n:""}`)},KG=e=>xt(`/api/replication/summary${e?`?periodMs=${e}`:""}`),YG=e=>xt(`/api/replication/per-cg${e?`?periodMs=${e}`:""}`),QG=(e={})=>{const t=new URLSearchParams;e.periodMs&&t.set("periodMs",String(e.periodMs)),e.bucketMs&&t.set("bucketMs",String(e.bucketMs)),e.cg&&t.set("cg",e.cg);const n=t.toString();return xt(`/api/replication/timeline${n?"?"+n:""}`)},XG=()=>xt("/api/replication/cursors"),JG=(e,t=100)=>xt(`/api/replication/events?cg=${encodeURIComponent(e)}&limit=${t}`),eV=e=>xt(`/api/success-rates?periodMs=${e}`),tV=(e,t)=>{const n=`periodMs=${e}${t?`&bucketMs=${t}`:""}`;return xt(`/api/per-type-stats?${n}`)},f_=(e={})=>{const t=new URLSearchParams;e.lines&&t.set("lines",String(e.lines)),e.q&&t.set("q",e.q);const n=t.toString();return xt(`/api/node-log${n?"?"+n:""}`)};async function Ld(){return{contextGraphs:((await NS("/api/context-graph/list",AS)).contextGraphs??[]).filter(n=>!n.isSystem)}}const Yl=()=>xt("/api/agent/identity");async function h_(e,t,n,a){const s=new AbortController,l=setTimeout(()=>s.abort(),3e4);try{const u=await fetch(`${_r}/api/context-graph/create`,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify({id:e,name:t,description:n,...a!=null&&a.register?{register:!0}:{},...a!=null&&a.allowedAgents?{allowedAgents:a.allowedAgents}:{},...(a==null?void 0:a.accessPolicy)!==void 0?{accessPolicy:a.accessPolicy}:{},...(a==null?void 0:a.publishPolicy)!==void 0?{publishPolicy:a.publishPolicy}:{}}),signal:s.signal});if(!u.ok){const d=await u.json().catch(()=>({}));throw new Error((d==null?void 0:d.error)??`HTTP ${u.status}`)}return u.json()}catch(u){throw u.name==="AbortError"?new Error("Creating project is taking longer than expected — it may still complete in the background. Refresh the page in a moment."):u}finally{clearTimeout(l)}}const m_=(e,t)=>bn(`/api/context-graph/${encodeURIComponent(e)}/remove-participant`,{agentAddress:t}),_S=e=>xt(`/api/context-graph/${encodeURIComponent(e)}/participants`),g_=e=>bn(`/api/context-graph/${encodeURIComponent(e)}/sign-join`,{}),v_=(e,t)=>bn(`/api/context-graph/${encodeURIComponent(e)}/request-join`,t),RS=e=>xt(`/api/context-graph/${encodeURIComponent(e)}/join-requests`),Ng=(e,t)=>bn(`/api/context-graph/${encodeURIComponent(e)}/approve-join`,{agentAddress:t}),Eg=(e,t)=>bn(`/api/context-graph/${encodeURIComponent(e)}/reject-join`,{agentAddress:t}),y_={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 b_(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 y_[t]}async function OS(e,t,n,a){const s=new FormData;s.append("file",n),s.append("contextGraphId",t);const l=b_(n);l&&s.append("contentType",l);const u=await fetch(`${_r}/api/knowledge-assets/${encodeURIComponent(e)}/wm/import-file`,{method:"POST",headers:Ft(),body:s});if(!u.ok){const d=await u.json().catch(()=>({}));throw new Error((d==null?void 0:d.error)??`HTTP ${u.status}`)}return u.json()}const vh=new Map;function ld(e){const t=JSON.stringify(e),n=vh.get(t);if(n)return n;const a=(async()=>{const s=await fetch(`${_r}/api/query`,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:t});if(!s.ok){const l=await s.json().catch(()=>({})),u=(l==null?void 0:l.error)??`HTTP ${s.status}`;throw new $n(s.status,u,l)}return s.json()})().finally(()=>{vh.delete(t)});return vh.set(t,a),a}const or=(e,t,n,a,s,l)=>ld({sparql:e,contextGraphId:t,includeSharedMemory:n,graphSuffix:a,view:s,includeContextGraphPartitions:l});async function x_(e){var l,u,d;const n=`SELECT ?name ?ual WHERE {
62
- GRAPH <${`did:dkg:context-graph:${e}/_meta`}> {
63
- ?lc <http://dkg.io/ontology/assertionName> ?name ;
64
- <http://dkg.io/ontology/reservedUal> ?ual .
65
- }
66
- }`,a=await or(n,e),s={};for(const f of((l=a==null?void 0:a.result)==null?void 0:l.bindings)??[]){const h=typeof f.name=="string"?f.name:(u=f.name)==null?void 0:u.value,g=typeof f.ual=="string"?f.ual:(d=f.ual)==null?void 0:d.value;h&&g&&!s[h]&&(s[h]=g)}return s}const w_=(e,t)=>bn("/api/profile/query-catalog/write",{contextGraphId:e,quads:t}),k_=new Set(["clearAfter","publishEpochs","publisherNodeIdentityIdOverride"]),S_=e=>{if(typeof e=="string"&&/^\d+$/.test(e))return e;throw new Error("publisherNodeIdentityIdOverride must be passed as a decimal string")},j_=(e,t=[])=>{if(!e)return;const n=Object.keys(e).filter(l=>!k_.has(l)&&!t.includes(l));if(n.length>0)throw new Error(`Unsupported finalized publish option(s): ${n.join(", ")}`);const a={};e.clearAfter!==void 0&&(a.clearSharedMemoryAfter=e.clearAfter),e.publishEpochs!==void 0&&(a.publishEpochs=e.publishEpochs);const s=e.publisherNodeIdentityIdOverride;return s!==void 0&&(a.publisherNodeIdentityIdOverride=S_(s)),Object.keys(a).length>0?a:void 0};function C_(e){const t=e;if(Array.isArray(t.entities))throw Object.assign(new Error("Knowledge Assets are shared atomically; root-entity selection is not supported"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(t.entities!==void 0&&t.entities!=="all")throw Object.assign(new Error("Knowledge Assets are shared atomically; omit entities to share the complete asset"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(t.skipSeal===!0)throw Object.assign(new Error("Knowledge Assets are always sealed before sharing"),{code:"UNSEALED_SHARE_BLOCKED"});if(t.skipSeal!==void 0&&t.skipSeal!==!1)throw new TypeError("skipSeal must be false or omitted");if(t.awaitCuratorAck!==void 0&&typeof t.awaitCuratorAck!="boolean")throw new TypeError("awaitCuratorAck must be a boolean when supplied");return{...t.subGraphName?{subGraphName:t.subGraphName}:{},awaitCuratorAck:t.awaitCuratorAck??!0}}const N_=(e,t,n={})=>{const a=C_(n);return bn(`/api/knowledge-assets/${encodeURIComponent(t)}/swm/share`,{contextGraphId:TS(e),...a.subGraphName?{subGraphName:a.subGraphName}:{},awaitCuratorAck:a.awaitCuratorAck})},Ag=(e,t,n={})=>{const a=j_(n,["subGraphName"]);return bn(`/api/knowledge-assets/${encodeURIComponent(t)}/vm/publish`,{contextGraphId:TS(e),...n.subGraphName?{subGraphName:n.subGraphName}:{},...a?{options:a}:{}})};async function Tg(e,t){let n=0,a=0,s;const l=[];let u=null,d=0n,f=0n,h=0n,g=0n,m,y=!0,b=!0;for(const j of t)try{const N=await Ag(e,j.name,j.subGraph?{subGraphName:j.subGraph}:{});n+=1,N.contextGraphError&&(a+=1,s===void 0&&(s=N.contextGraphError));const S=N;(!u||S.status==="confirmed"&&S.txHash&&!S.contextGraphError)&&(u=S);const A=S.convictionCostCovered;if(A)try{d+=BigInt(A.baseCost),f+=BigInt(A.discountedCost),h+=BigInt(A.drawnFromEpoch),g+=BigInt(A.drawnFromTopUp),m?(A.accountId!==m.accountId&&(y=!1),A.epoch!==m.epoch&&(b=!1)):m=A}catch{}}catch(N){const S=(N==null?void 0:N.message)??"publish failed";l.push({name:j.name,...j.subGraph?{subGraph:j.subGraph}:{},error:S})}const k=m?{...y&&m.accountId?{accountId:m.accountId}:{},...b&&m.epoch!=null?{epoch:m.epoch}:{},baseCost:d.toString(),discountedCost:f.toString(),drawnFromEpoch:h.toString(),drawnFromTopUp:g.toString()}:void 0;return{published:n,total:t.length,partial:a,partialError:s,failures:l,sample:u,convictionCostCovered:k}}async function Ql(e,t="wm"){var j,N,S,A,E,T,U,_;if(t==="swm"){const z=`did:dkg:context-graph:${e}/_meta`,q=`did:dkg:context-graph:${e}/`,D=`urn:dkg:assertion:${e}:`,R=`SELECT ?g ?vm WHERE {
67
- GRAPH <${z}> {
68
- ?g <http://dkg.io/ontology/memoryLayer> "SWM"
69
- OPTIONAL { ?g <http://dkg.io/ontology/vmCurrentAssertion> ?vm }
70
- }
71
- FILTER(!CONTAINS(STR(?g), "/meta/assertion/"))
72
- }`,$=await or(R,e),F=((j=$==null?void 0:$.result)==null?void 0:j.bindings)??[],K=new Set,I=[];for(const W of F){const Q=typeof W.g=="string"?W.g:(N=W.g)==null?void 0:N.value;if(!Q)continue;const V=typeof W.vm=="string"?W.vm:(S=W.vm)==null?void 0:S.value;let L,P;if(Q.startsWith(q)){const O=Q.slice(q.length).split("/");if(O.length===3&&O[0]==="assertion")P=O[2];else if(O.length===4&&O[1]==="assertion")L=O[0],P=O[3];else continue}else if(Q.startsWith(D)){const O=Q.slice(D.length);let ne=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(O);ne?P=ne[2]:(ne=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(O),ne&&(L=ne[1],P=ne[3]))}else continue;if(!P||L==="meta")continue;const G=`${L??""} ${P}`;I.push({key:G,name:P,subGraph:L,g:Q}),V&&K.add(G)}const H=new Set,B=[];for(const W of I)K.has(W.key)||H.has(W.key)||(H.add(W.key),B.push({name:W.name,graphUri:W.g,subGraph:W.subGraph}));return B}const n=`did:dkg:context-graph:${e}/_meta`,a=`did:dkg:context-graph:${e}/`,s='FILTER(!CONTAINS(STR(?g), "/meta/assertion/"))',l=`SELECT ?g WHERE {
73
- GRAPH <${n}> { ?g <http://dkg.io/ontology/memoryLayer> "WM" }
74
- ${s}
75
- }`,u=`SELECT ?g (COUNT(*) AS ?cnt) WHERE {
76
- GRAPH <${n}> {
77
- ?g <http://dkg.io/ontology/memoryLayer> "WM" ;
78
- <http://dkg.io/ontology/assertionGraph> ?dg
79
- }
80
- GRAPH ?dg { ?s ?p ?o }
81
- ${s}
82
- } GROUP BY ?g`,[d,f]=await Promise.all([ld({sparql:l,contextGraphId:e,includeContextGraphPartitions:!0}),ld({sparql:u,contextGraphId:e,includeContextGraphPartitions:!0}).catch(()=>null)]),h=((A=d==null?void 0:d.result)==null?void 0:A.bindings)??[],g=new Map;for(const z of((E=f==null?void 0:f.result)==null?void 0:E.bindings)??[]){const q=typeof z.g=="string"?z.g:(T=z.g)==null?void 0:T.value,D=typeof z.cnt=="string"?z.cnt:(U=z.cnt)==null?void 0:U.value,R=typeof D=="string"?D.match(/^"?(\d+)/):null,$=R?parseInt(R[1],10):NaN;q&&Number.isFinite($)&&g.set(q,$)}const m=[],y=new Set,b=`urn:dkg:assertion:${e}:`,k=[...h].sort((z,q)=>{var $,F;const D=(typeof z.g=="string"?z.g:($=z.g)==null?void 0:$.value)??"",R=(typeof q.g=="string"?q.g:(F=q.g)==null?void 0:F.value)??"";return(D.startsWith(a)?0:1)-(R.startsWith(a)?0:1)});for(const z of k){const q=typeof z.g=="string"?z.g:(_=z.g)==null?void 0:_.value;if(!q)continue;let D,R;if(q.startsWith(a)){const K=q.slice(a.length).split("/");if(K.length===3&&K[0]==="assertion")R=K[2];else if(K.length===4&&K[1]==="assertion")D=K[0],R=K[3];else continue}else if(q.startsWith(b)){const K=q.slice(b.length);let I=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(K);I?R=I[2]:(I=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(K),I&&(D=I[1],R=I[3]))}else continue;if(!R||D==="meta")continue;const $=`${D??""}\0${R}`;if(y.has($))continue;y.add($);const F=g.get(q);m.push({name:R,graphUri:q,tripleCount:F,subGraph:D})}return m}const lo=(e,t,n,a)=>{if(Array.isArray(n))throw Object.assign(new Error("Knowledge Assets are shared atomically; root-entity selection is not supported"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(typeof n=="string"&&n!=="all")throw Object.assign(new Error("Knowledge Assets are shared atomically; omit entities to share the complete asset"),{code:"KA_ATOMIC_SHARE_REQUIRED"});const s=n===void 0||typeof n=="string"?{subGraphName:a}:{...n,subGraphName:n.subGraphName??a};return N_(e,t,s)};function _g(e,t){return t.promotedCount>0?{kind:"success",promotedCount:t.promotedCount,message:`Shared the complete Knowledge Asset ${e} to Shared Working Memory (${t.promotedCount} triple${t.promotedCount===1?"":"s"}).`}:{kind:"noop",message:`${e} was not newly shared. Its complete Knowledge Asset may already be in Shared Working Memory, or its content is still being committed — refresh and try again.`}}function co(e,t){if(t instanceof $n&&t.status===413){const n=t.body;if((n==null?void 0:n.code)==="SWM_GOSSIP_PAYLOAD_TOO_LARGE")return{kind:"payload-too-large",actualBytes:typeof n.actualBytes=="number"?n.actualBytes:void 0,limitBytes:typeof n.limitBytes=="number"?n.limitBytes:void 0,message:`${e} is too large to share atomically. Split its content into smaller Knowledge Assets before sharing.`}}if(t instanceof $n&&t.status===409){const n=t.body;if((n==null?void 0:n.code)==="ASSERTION_NOT_PERSISTED"){const a=typeof n.expectedTripleCount=="number"?n.expectedTripleCount:void 0;return{kind:"not-persisted",expectedTripleCount:a,message:a?`${e} was imported with ${a} extracted triple${a===1?"":"s"} but the data graph is empty. Re-import the source file (or re-write the assertion) before promoting.`:`${e}'s data graph is empty but its extraction metadata says it should hold content. Re-import the source file before promoting.`}}}return null}const E_=(e,t,n)=>{const a=new URLSearchParams({contextGraphId:t});return n&&a.set("subGraphName",n),xt(`/api/knowledge-assets/${encodeURIComponent(e)}/wm/extraction-status?${a}`)};function Vu(e,t){const n=e.startsWith("sha256:")||e.startsWith("keccak256:")?e:`sha256:${e}`,a=t?`?contentType=${encodeURIComponent(t)}`:"";return`${_r}/api/file/${encodeURIComponent(n)}${a}`}const A_="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 T_=(e=20)=>xt(`/api/memory/sessions?limit=${e}`),__=(e,t={})=>{const n=new URLSearchParams;t.limit&&Number.isInteger(t.limit)&&t.limit>0&&n.set("limit",String(t.limit)),(t.order==="desc"||t.order==="asc")&&n.set("order",t.order);const a=n.toString();return xt(`/api/memory/sessions/${encodeURIComponent(e)}${a?`?${a}`:""}`)};function LS(e,t){var n,a,s;return{text:e,correlationId:(t==null?void 0:t.correlationId)??crypto.randomUUID(),...t!=null&&t.identity?{identity:t.identity}:{},...t!=null&&t.sessionId?{sessionId:t.sessionId}:{},...t!=null&&t.profile?{profile:t.profile}:{},...t!=null&&t.persistUserMessage?{persistUserMessage:t.persistUserMessage}:{},...(n=t==null?void 0:t.attachments)!=null&&n.length?{attachmentRefs:t.attachments}:{},...(a=t==null?void 0:t.attachmentImportResults)!=null&&a.length?{attachmentImportResults:t.attachmentImportResults}:{},...(s=t==null?void 0:t.contextEntries)!=null&&s.length?{contextEntries:t.contextEntries}:{},...t!=null&&t.contextGraphId?{contextGraphId:t.contextGraphId}:{}}}async function R_(e,t={}){var m;const n=await fetch("/api/openclaw-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Ft()},body:JSON.stringify(LS(e,t)),signal:t.signal});if(!n.ok){const y=await n.json().catch(()=>({}));throw cd(y,`Request failed (${n.status})`,n.status)}const a=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!a.includes("text/event-stream")){const y=await n.json();return(m=t.onEvent)==null||m.call(t,{type:"final",...y}),y}const s=n.body.getReader(),l=new TextDecoder;let u="",d,f;const h=y=>{var b;(b=t.onEvent)==null||b.call(t,y),y.type==="error"?f=cd(y,y.error||"Stream failed"):y.type==="final"&&(d={text:y.text,correlationId:y.correlationId,...y.sessionId?{sessionId:y.sessionId}:{},...y.turnId?{turnId:y.turnId}:{}})},g=y=>{let b=u.indexOf(`
83
- `);for(;b!==-1;){const k=u.slice(0,b).trim();if(u=u.slice(b+1),b=u.indexOf(`
84
- `),!k.startsWith("data:"))continue;const j=k.slice(5).trim();if(j){try{h(JSON.parse(j))}catch{}if(f)return}}if(y&&u.trim().startsWith("data:")){const k=u.trim().slice(5).trim();if(!k)return;try{h(JSON.parse(k))}catch{}u=""}};for(;;){const{done:y,value:b}=await s.read();if(y||(u+=l.decode(b,{stream:!0}),g(!1),f))break}if(u+=l.decode(),g(!0),f)throw f;if(!d)throw new Error("Stream ended without final payload");return d}const O_=()=>xt("/api/openclaw-channel/health");async function L_(e,t={}){var y;const n=await fetch("/api/hermes-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Ft()},body:JSON.stringify(LS(e,t)),signal:t.signal});if(!n.ok){const b=await n.json().catch(()=>({}));throw cd(b,`Request failed (${n.status})`,n.status)}const a=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!a.includes("text/event-stream")){const b=await n.json();return(y=t.onEvent)==null||y.call(t,{type:"final",...b}),b}const s=n.body.getReader(),l=new TextDecoder;let u="",d,f;const h=b=>b.type==="delta"?{type:"text_delta",delta:b.text??""}:b,g=b=>{var k;(k=t.onEvent)==null||k.call(t,b),b.type==="error"?f=cd(b,b.error||"Stream failed"):b.type==="final"&&(d={text:b.text,correlationId:b.correlationId,...b.sessionId?{sessionId:b.sessionId}:{},...b.turnId?{turnId:b.turnId}:{}})},m=b=>{let k=u.indexOf(`
85
- `);for(;k!==-1;){const j=u.slice(0,k).trim();if(u=u.slice(k+1),k=u.indexOf(`
86
- `),!j.startsWith("data:"))continue;const N=j.slice(5).trim();if(N){try{g(h(JSON.parse(N)))}catch{}if(f)return}}if(b&&u.trim().startsWith("data:")){const j=u.trim().slice(5).trim();if(!j)return;try{g(h(JSON.parse(j)))}catch{}u=""}};for(;;){const{done:b,value:k}=await s.read();if(b||(u+=l.decode(k,{stream:!0}),m(!1),f))break}if(u+=l.decode(),m(!0),f)throw f;if(!d)throw new Error("Stream ended without final payload");return d}const M_=()=>xt("/api/hermes-channel/health");function D_(e,t){if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e,a=typeof n.error=="string"&&n.error.trim()?n.error.trim():t;if(n.details===void 0||n.details===null)return a;const s=typeof n.details=="string"?n.details.trim():JSON.stringify(n.details);return!s||s===a?a:`${a}: ${s}`}function cd(e,t,n){if(!e||typeof e!="object"||Array.isArray(e))return new wm(t,{status:n});const a=e,s=D_(a,t),l=f=>{const h=a[f];return typeof h=="string"&&h.trim()?h.trim():void 0},u=f=>{const h=a[f];return typeof h=="number"&&Number.isFinite(h)?h:void 0},d=f=>{const h=a[f];return typeof h=="boolean"?h:void 0};return new wm(s,{status:n,code:l("code"),source:l("source"),details:l("details"),correlationId:l("correlationId"),timeoutMs:u("timeoutMs"),target:l("target"),route:l("route"),integrationId:l("integrationId"),retryable:d("retryable")})}const Md={openclaw:{connectSupported:!0,chatSupported:!0,defaultSessionId:({integrationId:e})=>`${e}:dkg-ui`,resolveChatContext:({integrationId:e,sessionId:t})=>{if(!t)return{};const n=`${e}:dkg-ui:`;if(!t.startsWith(n))return{};const a=t.slice(n.length).trim();return a?{identity:a}:{}},fetchHealth:O_,streamChat:R_},hermes:{connectSupported:!0,chatSupported:!0,defaultSessionId:({integrationId:e,record:t,health:n})=>U_(e,t,n),resolveChatContext:({sessionId:e,profile:t})=>({...e?{sessionId:e}:{},...t?{profile:t}:{}}),fetchHealth:M_,streamChat:L_}};function to(e){var n,a;const t=e.trim().toLowerCase();return((a=(n=Md[t])==null?void 0:n.defaultSessionId)==null?void 0:a.call(n,{integrationId:t}))??null}function z_(e,t){return t!=null&&t.trim()?t.trim():to(e)}async function $_(e,t=50){const n=a=>{if(a.turnId)return`urn:dkg:chat:turn:${encodeURIComponent(a.turnId)}:${encodeURIComponent(a.author)}`;const s=`${e}
87
- ${a.author}
88
- ${a.ts}
89
- ${a.text}`;let l=2166136261;for(let u=0;u<s.length;u+=1)l^=s.charCodeAt(u),l=Math.imul(l,16777619);return`urn:dkg:chat:session:${encodeURIComponent(e)}:message:${(l>>>0).toString(16)}`};try{return[...(await __(e,{limit:t,order:"desc"})).messages].reverse().map(s=>({uri:s.uri||n(s),text:s.text,author:s.author,ts:s.ts,turnId:s.turnId,persistStatus:s.persistStatus,failureReason:s.failureReason,attachmentRefs:s.attachmentRefs,toolCalls:s.toolCalls}))}catch(a){if(a instanceof $n&&a.status===404)return[];throw a}}function I_(e){var t,n,a;return!!((t=e.transport)!=null&&t.bridgeUrl||(n=e.transport)!=null&&n.gatewayUrl||(a=e.transport)!=null&&a.healthUrl)}function km(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return null}function P_(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||Rg(e)}function Rg(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function U_(e,t,n){const a=(t==null?void 0:t.metadata)??{},s=km(n==null?void 0:n.profile,a.profileName,a.profile),l=km(a.hermesHome),u=l?null:B_(t),d=[s?`profile-${P_(s)}`:null,l?`home-${Rg(l)}`:null,u].filter(f=>f!=null);return d.length?`${e}:dkg-ui:${d.join(":")}`:`${e}:dkg-ui`}function B_(e){const t=e==null?void 0:e.transport;if(!t)return null;const n=[t.kind,t.bridgeUrl,t.gatewayUrl,t.healthUrl].filter(a=>typeof a=="string"&&a.trim().length>0);return n.length?`transport-${Rg(n.join("|"))}`:null}function F_(e){return e?typeof e=="string"?e:[e.provider,e.mode,e.status].filter(Boolean).join(" / ")||null:null}function H_(e,t){if(e==="degraded")return!0;const n=String((t==null?void 0:t.status)??"").toLowerCase(),a=t==null?void 0:t.memory;return n.includes("degraded")||n.includes("conflict")||typeof a=="object"&&a!=null&&a.conflict===!0}function MS(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Bx(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 q_(e){if(e.target==="bridge")return{target:"bridge",details:e.bridge};if(e.target==="gateway")return{target:"gateway",details:e.gateway};const t=Bx(e.bridge),n=Bx(e.gateway);return t<0&&n<0?{}:t>=n?{target:"bridge",details:e.bridge}:{target:"gateway",details:e.gateway}}function G_(e){if(!e)return null;const{target:t,details:n}=q_(e);if(!MS(n))return e;const a=typeof n.ok=="boolean"?n.ok:void 0;return{...n,...e,ok:e.ok===!1?!1:a??e.ok,target:e.target??t,profile:e.profile??n.profile,memory:e.memory??n.memory,status:e.status??n.status,error:e.error??n.error}}function V_(e,t){if(String(e.id??"").toLowerCase()!=="hermes")return null;const n=t==null?void 0:t.profile,a=n?`profile ${n}`:"the configured profile",s=F_(t==null?void 0:t.memory),l=typeof(t==null?void 0:t.memory)=="object"&&t.memory!=null?t.memory:null;return(l==null?void 0:l.conflict)===!0||String((t==null?void 0:t.status)??"").toLowerCase().includes("conflict")?`${e.name} ${a} has a memory provider conflict${s?` (${s})`:""}.`:t!=null&&t.ok?`${e.name} ${a} is connected${s?` with ${s} memory`:""}.`:t!=null&&t.status?`${e.name} ${a} reports ${t.status}${s?` (${s})`:""}.`:null}async function Og(e){var T,U,_,z,q,D,R,$,F,K,I,H,B,W;const t=String(e.id??"").toLowerCase(),n=Md[t],a=((T=e.capabilities)==null?void 0:T.localChat)===!0&&(n==null?void 0:n.chatSupported)===!0,s=a&&((U=e.capabilities)==null?void 0:U.chatAttachments)===!0,l=((_=e.capabilities)==null?void 0:_.connectFromUi)===!0&&(n==null?void 0:n.connectSupported)===!0,u=e.enabled===!0,d=(z=e.runtime)==null?void 0:z.status,f=u&&a&&(n!=null&&n.fetchHealth)?G_(await n.fetchHealth().catch(()=>null)):null,h=H_(d,f),g=(f==null?void 0:f.ok)===!0&&!h,m=g,y=u&&a&&(g||d==="connecting"||d==="degraded"||((q=e.runtime)==null?void 0:q.ready)===!0||I_(e)),b=V_(e,f),k=(D=n==null?void 0:n.defaultSessionId)==null?void 0:D.call(n,{integrationId:t,record:e,health:f}),j=t==="hermes"?km(f==null?void 0:f.profile,(R=e.metadata)==null?void 0:R.profileName,($=e.metadata)==null?void 0:$.profile):void 0;let N,S,A;y&&h?(N="degraded",S="Degraded",A=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&&((K=e.runtime)==null?void 0:K.status)==="connecting"?(N="connecting",S="Connecting",A=((I=e.runtime)==null?void 0:I.lastError)??`${e.name} is registered and still starting up.`):m?(N="chat_ready",S="Chat ready",A=`${e.name} is connected to this node and ready for chat.`):y?(N="bridge_offline",S="Bridge offline",A=b??(f==null?void 0:f.error)??((H=e.runtime)==null?void 0:H.lastError)??`${e.name} is attached to this node, but it is not responding right now.`):n?(N="available",S=l?"Ready to connect":"Awaiting chat bridge",A=u?`${e.name} is registered, but this panel is waiting for the framework chat bridge.`:((B=e.runtime)==null?void 0:B.lastError)??`Use the node-served skill plus ${e.name} onboarding to attach an existing local agent.`):(N="coming_soon",S=u?"Registered, panel pending":"Next integration",A=u?`${e.name} is registered on the node, but the right-panel chat bridge is not wired yet.`:"The local-agent registry is in place so this framework can plug into the same side-panel flow next.");const E=m?"Connected":N==="connecting"?"Connecting":N==="degraded"?"Degraded":y?"Unavailable":l?"Ready to connect":"Coming next";return{id:t,name:e.name,framework:e.name,description:e.description,defaultSessionId:k,profile:j,chatSupported:a,chatAttachments:s,connectSupported:l,configured:u,detected:u||g,persistentChat:y,chatReady:g,bridgeOnline:m,bridgeStatusLabel:E,status:N,statusLabel:S,detail:A,error:g?void 0:(f==null?void 0:f.error)??((W=e.runtime)==null?void 0:W.lastError)??void 0,target:f==null?void 0:f.target,source:u||n?"live":"planned"}}async function Dd(){const e=await xt("/api/local-agent-integrations"),t=await Promise.all((e.integrations??[]).map(Og));return t.sort((n,a)=>{const s=n.id==="openclaw"?0:1,l=a.id==="openclaw"?0:1;return s!==l?s-l:n.persistentChat!==a.persistentChat?n.persistentChat?-1:1:n.name.localeCompare(a.name)}),{integrations:t}}async function W_(e){const t=e.trim().toLowerCase(),n=Md[t];if(!(n!=null&&n.connectSupported))throw new Error(`${e} local connect is not available yet.`);const a=await bn("/api/local-agent-integrations/connect",{id:t,metadata:{source:"node-ui"}}),s=a.integration?await Og(a.integration):(await Dd()).integrations.find(l=>l.id===t);if(!s)throw new Error(`Missing local agent integration: ${t}`);return{integration:s,notice:a.notice}}async function Z_(e){const t=e.trim().toLowerCase();await Sg(`/api/local-agent-integrations/${encodeURIComponent(t)}`,{enabled:!1,runtime:{status:"disconnected",ready:!1,lastError:null}})}async function K_(e){const t=e.trim().toLowerCase(),n=await bn(`/api/local-agent-integrations/${encodeURIComponent(t)}/refresh`,{}),a=n.integration?await Og(n.integration):(await Dd()).integrations.find(s=>s.id===t);if(!a)throw new Error(`Missing local agent integration: ${t}`);return{integration:a,notice:n.notice}}async function Fx(e,t=50,n={}){const a=z_(e,n.sessionId);return a?$_(a,t):[]}async function Y_(e){var n;const t=(n=e.sessionId)==null?void 0:n.trim();if(!t)throw new Error("Missing Hermes session id");return bn("/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 Q_(e,t){if(e.trim().toLowerCase()==="hermes")return Y_(t);throw new Error(`${e} local chat persistence is not available yet.`)}async function X_(e,t,n={}){var l;const a=e.trim().toLowerCase(),s=Md[a];if(s!=null&&s.streamChat){const{sessionId:u,profile:d,...f}=n;return s.streamChat(t,{...f,...(l=s.resolveChatContext)==null?void 0:l.call(s,{integrationId:a,sessionId:u,profile:d})})}throw new Error(`${e} local chat is not available yet.`)}const J_=()=>xt("/api/economics"),Lg=()=>xt("/api/wallets/balances"),nV=()=>bn("/api/shutdown",{}),eR=e=>bn("/api/subscribe",{contextGraphId:e}),tR=()=>xt("/api/notifications"),DS=e=>bn("/api/notifications/read",e?{ids:e}:{}),Mg=e=>NS(`/api/sub-graph/list?contextGraphId=${encodeURIComponent(e)}`,AS),nR={name:"my-dkg-node",networkName:"DKG Mainnet",connectedPeers:12,synced:!0,version:"10.0.0-rc"},rR={total_kcs:1842,confirmed_kcs:1623,tentative_kcs:219},aR={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}]},iR={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"}]},sR={"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:[]}},oR={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},lR={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}]},cR={agentAddress:"0x1111111111111111111111111111111111111111",agentDid:"did:dkg:agent:0x1111111111111111111111111111111111111111",name:"mock-node-agent",framework:"mock",peerId:"QmMockNodeAgentPeer000000000000000000000000",nodeIdentityId:"mock-node-identity"},uR={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"},dR={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},pR={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},fR={sessions:[{session:"sess-abc123",messages:[{author:"user",text:"What drug interactions should I know about warfarin?",ts:"2026-04-11T10:00:00Z"},{author:"assistant",text:"Warfarin has significant interactions with aspirin, NSAIDs, and several antibiotics. The most critical ones involve...",ts:"2026-04-11T10:00:05Z"}]},{session:"sess-def456",messages:[{author:"user",text:"Summarize the latest climate data for Arctic ice",ts:"2026-04-10T14:00:00Z"},{author:"assistant",text:"Based on the latest projections in the verifiable memory...",ts:"2026-04-10T14:00:03Z"}]}]};function rr(e,t=50){return new Promise(n=>setTimeout(()=>n(e),t))}const ar={fetchStatus:()=>rr(nR),fetchMetrics:()=>rr(rR),fetchAgents:()=>rr(aR),fetchContextGraphs:()=>rr(iR),fetchOperationsWithPhases:()=>rr(oR),fetchEconomics:()=>rr(lR),fetchWalletsBalances:()=>rr(uR),fetchCurrentAgent:()=>rr(cR),listParticipants:e=>rr(sR[e]??{contextGraphId:e,allowedAgents:[]}),fetchSubGraphs:e=>rr({contextGraphId:e,subGraphs:[]}),fetchNotificationsFeed:()=>rr(dR),fetchNodeLog:()=>rr(pR),fetchMemorySessions:()=>rr(fR)};let Ma=null,ml=null;const hR=5e3,Hx=2,mR=250,Sm=new Set;function gR(){return Ma===!0}function vR(e){return Sm.add(e),e(Ma===!0),()=>{Sm.delete(e)}}function yR(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}function bR(e){return new Promise(t=>setTimeout(t,e))}async function xR(){for(let e=1;e<=Hx;e+=1){try{const t=await fetch("/api/status",{cache:"no-store",headers:yR(),signal:AbortSignal.timeout(hR)});if(t.ok||t.status===401)return!1}catch{}e<Hx&&await bR(mR)}return!0}async function wR(){if(Ma!==null)return Ma;if(ml)return ml;ml=(async()=>(Ma=await xR(),typeof window<"u"&&(window.__DKG_USING_MOCKS__=Ma,Ma&&console.warn("[dkg-ui] /api/status unreachable (timeout/5xx/network) — falling back to demo (mock) data. The UI is NOT showing live node state.")),Sm.forEach(e=>e(Ma)),Ma))();try{return await ml}finally{ml=null}}async function ir(e,t){return await wR()?t():e()}const Tn={fetchStatus:()=>ir(jg,ar.fetchStatus),fetchMetrics:()=>ir(d_,ar.fetchMetrics),fetchAgents:()=>ir(Cg,ar.fetchAgents),fetchContextGraphs:()=>ir(Ld,ar.fetchContextGraphs),fetchOperationsWithPhases:e=>ir(()=>p_(e),ar.fetchOperationsWithPhases),fetchEconomics:()=>ir(J_,ar.fetchEconomics),fetchWalletsBalances:()=>ir(Lg,ar.fetchWalletsBalances),fetchCurrentAgent:()=>ir(Yl,ar.fetchCurrentAgent),listParticipants:e=>ir(()=>_S(e),()=>ar.listParticipants(e)),fetchSubGraphs:e=>ir(()=>Mg(e),()=>ar.fetchSubGraphs(e)),fetchNotificationsFeed:()=>ir(tR,ar.fetchNotificationsFeed),fetchNodeLog:e=>ir(()=>f_(e),ar.fetchNodeLog),fetchMemorySessions:e=>ir(()=>T_(e),ar.fetchMemorySessions),markNotificationsRead:DS,executeQuery:or},kR=6e4;let wi={data:null,loading:!0,error:null},ta=null,_l=null,Al=0,xi="";const ud=new Set;function Ki(){if(typeof window>"u")return"";const e=window.__DKG_TOKEN__;return e?`Bearer ${e}`:""}function Wu(e){xi=e,wi={data:null,loading:!0,error:null}}function yh(){const e=Ki();return e!==xi&&Wu(e),wi}function Zu(){for(const e of ud)e()}function bh(e){wi=e,Zu()}function dd(){const e=Al,t=Ki();if((ta==null?void 0:ta.authKey)===t)return ta.promise;t!==xi?(Wu(t),Zu()):bh({...wi,loading:!0,error:null});const n=Tn.fetchCurrentAgent().then(a=>{if(e===Al){if(t!==Ki()){const s=Ki(),l=xi!==s||wi.loading;xi!==s&&(Wu(s),Zu()),l&&dd();return}bh({data:a,loading:!1,error:null})}}).catch(a=>{if(e===Al){if(t!==Ki()){const s=Ki(),l=xi!==s||wi.loading;xi!==s&&(Wu(s),Zu()),l&&dd();return}bh({data:wi.data,loading:!1,error:a instanceof Error?a.message:"Failed to load current agent"})}}).finally(()=>{e===Al&&(ta==null?void 0:ta.promise)===n&&(ta=null)});return ta={authKey:t,promise:n},n}function SR(){dd(),!_l&&(_l=setInterval(()=>{dd()},kR))}function jR(){ud.size>0||!_l||(clearInterval(_l),_l=null,Al+=1,ta=null,wi={data:null,loading:!0,error:null},xi=Ki())}function zd(){const[e,t]=w.useState(yh);return w.useEffect(()=>{const n=()=>t(yh());return ud.add(n),t(yh()),SR(),()=>{ud.delete(n),jR()}},[]),e}const Tr=is(e=>({contextGraphs:[],loading:!1,activeProjectId:null,setContextGraphs:t=>e({contextGraphs:t}),setLoading:t=>e({loading:t}),setActiveProject:t=>e({activeProjectId:t})})),no=new Set;let yn=null,Ku=null;const CR=350;function qx(e){return e==="wm"||e==="swm"||e==="vm"}function NR(e){const t=e.layers;return Array.isArray(t)?t.filter(qx):qx(e.layer)?[e.layer]:[]}function ER(e,t,n){if(!t||e.contextGraphId!==t)return!1;if(!n||n.length===0)return!0;const a=NR(e);return a.length===0?!0:n.some(s=>a.includes(s))}function zS(){if(yn)return;const e=typeof window<"u"?window.__DKG_TOKEN__:void 0,t=e?`/api/events?token=${encodeURIComponent(e)}`:"/api/events";yn=new EventSource(t);const n=a=>s=>{let l={};try{l=JSON.parse(s.data)}catch{}const u={type:a,data:l};for(const d of no)try{d(u)}catch{}};yn.addEventListener("join_request",n("join_request")),yn.addEventListener("join_approved",n("join_approved")),yn.addEventListener("join_rejected",n("join_rejected")),yn.addEventListener("project_synced",n("project_synced")),yn.addEventListener("memory_graph_changed",n("memory_graph_changed")),yn.addEventListener("notification",n("notification")),yn.addEventListener("connected",n("connected")),yn.onerror=()=>{yn==null||yn.close(),yn=null,no.size>0&&(Ku=setTimeout(zS,3e3))}}function AR(){Ku&&(clearTimeout(Ku),Ku=null),yn==null||yn.close(),yn=null}function TR(e){return no.add(e),no.size===1&&zS(),()=>{no.delete(e),no.size===0&&AR()}}function ss(e){const t=w.useRef(e);t.current=e,w.useEffect(()=>TR(n=>t.current(n)),[])}function xo(e,t,n={}){var f;const a=w.useRef(t),s=w.useRef(null);a.current=t;const l=n.debounceMs??CR,u=w.useMemo(()=>n.layers??[],[(f=n.layers)==null?void 0:f.join("|")]),d=w.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]);ss(w.useCallback(h=>{h.type==="memory_graph_changed"&&ER(h.data,e,u)&&(d(),s.current=setTimeout(()=>{s.current=null,a.current(h.data)},l))},[d,e,l,u])),w.useEffect(()=>d,[d])}function Xl(e,t,n={}){const a=w.useRef(e);a.current=e;const s=w.useRef(n);s.current=n,w.useEffect(()=>{if(t<=0)return;let l=null,u=!1;const d=()=>{l||u||(l=setInterval(()=>a.current(),t))},f=()=>{l&&(clearInterval(l),l=null)},h=()=>{if(document.hidden){f();return}a.current(),d()};return s.current.runImmediately!==!1&&!document.hidden&&a.current(),document.hidden||d(),document.addEventListener("visibilitychange",h),()=>{u=!0,document.removeEventListener("visibilitychange",h),f()}},[t])}const _R="No pending join request found";function RR(e){const t=[];for(const n of e)n.type==="join_request"&&t.push({id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,agentAddress:n.meta.agentAddress,agentName:n.meta.agentName,ts:n.ts,read:n.read===1});return t.sort((n,a)=>a.ts-n.ts),t}function OR(e){const t=[];for(const n of e)n.type==="assertion_activity"?t.push({kind:"digest",id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,event:n.meta.kind,count:n.meta.count,...n.meta.soleAuthor&&n.meta.actorAgentDid?{actorAgentDid:n.meta.actorAgentDid,actorAgentName:n.meta.actorAgentName}:{},...n.meta.bySelf?{bySelf:!0}:{},ts:n.ts,read:n.read===1}):n.type==="join_approved"||n.type==="join_rejected"?t.push({kind:n.type,id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,ts:n.ts,read:n.read===1}):n.type==="pca_cost_covered"&&t.push({kind:"pca_cost_covered",id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,covered:n.meta,publisherAddress:n.meta.publisherAddress,ts:n.ts,read:n.read===1});return t.sort((n,a)=>a.ts-n.ts),t}function Gx(e){return e.filter(t=>t.type!=="join_request"&&t.read===0).map(t=>t.id)}function Vx(e){const t=e instanceof Error?e.message:String(e);if(t.includes(_R))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 LR(){const[e,t]=w.useState(null),[n,a]=w.useState("loading"),[s,l]=w.useState(!1),u=w.useRef(!1),d=w.useCallback(()=>{Tn.fetchNotificationsFeed().then(E=>{u.current=!0,t(E),l(!1),a(E.scopeUnknown?"identity-pending":"ready")}).catch(()=>{u.current?l(!0):a("error")})},[]);Xl(d,6e4);const f=w.useRef(null),h=w.useCallback(()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{f.current=null,d()},400)},[d]);w.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),ss(w.useCallback(E=>{E.type==="notification"&&h()},[h]));const g=w.useMemo(()=>RR((e==null?void 0:e.notifications)??[]),[e]),m=w.useMemo(()=>OR((e==null?void 0:e.notifications)??[]),[e]),y=(e==null?void 0:e.badgeCount)??0,b=w.useMemo(()=>Gx((e==null?void 0:e.notifications)??[]).length>0,[e]),k=w.useCallback(E=>{E.length!==0&&(t(T=>{if(!T)return T;const U=new Set(E.map(String));return{...T,notifications:T.notifications.map(_=>U.has(String(_.id))?{..._,read:1}:_)}}),DS(E).then(d).catch(()=>{}))},[d]),j=w.useCallback(()=>{k(Gx((e==null?void 0:e.notifications)??[]))},[e,k]),N=w.useCallback(async(E,T)=>{try{return await Ng(E,T),d(),{ok:!0}}catch(U){const _=Vx(U);return _.ok&&_.alreadyHandled&&d(),_}},[d]),S=w.useCallback(async(E,T)=>{try{return await Eg(E,T),d(),{ok:!0}}catch(U){const _=Vx(U);return _.ok&&_.alreadyHandled&&d(),_}},[d]),A=w.useCallback(()=>{l(!1),a(u.current?"ready":"loading"),d()},[d]);return{joinRequests:g,activity:m,unread:y,hasInformationalUnread:b,status:n,refreshError:s,partialActivityError:!1,approve:N,deny:S,markSeen:k,markAllInformationalSeen:j,retry:A}}const MR="dkg-pca",DR=150;function zR(e){return[String(e.chainId).toLowerCase(),e.nft.toLowerCase(),e.token.toLowerCase()].join(":")}function yi(e){return e?`${MR}:${e}`:null}const xh={trackedIds:[],createPending:null,topUpPending:{}};function Rl(e){return typeof e=="string"&&/^\d+$/.test(e)}function $R(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const a of e)Rl(a)&&!t.has(a)&&(t.add(a),n.push(a));return n}function IR(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 PR(e){if(e==null||typeof e!="object")return{};const t={};for(const[n,a]of Object.entries(e)){if(!Rl(n)||a==null||typeof a!="object")continue;const s=a;s.accountId===n&&(typeof s.ownerEoa!="string"||s.ownerEoa.length===0||typeof s.txHash!="string"||s.txHash.length===0||typeof s.submittedAt!="number"||!Number.isFinite(s.submittedAt)||(t[n]={accountId:n,ownerEoa:s.ownerEoa,txHash:s.txHash,submittedAt:s.submittedAt,...typeof s.tokens=="string"?{tokens:s.tokens}:{},...typeof s.previousTopUpBufferTrac=="string"?{previousTopUpBufferTrac:s.previousTopUpBufferTrac}:{}}))}return t}function $S(e){const t=yi(e);if(!t)return{...xh};try{const n=localStorage.getItem(t);if(!n)return{...xh};const a=JSON.parse(n);return{trackedIds:$R(a.trackedIds),createPending:IR(a.createPending),topUpPending:PR(a.topUpPending)}}catch{return{...xh}}}let ra=null;function wu(e,t){e&&(ra&&clearTimeout(ra),ra=setTimeout(()=>{ra=null;try{localStorage.setItem(e,JSON.stringify(t))}catch{}},DR))}function wh(e,t){if(ra&&(clearTimeout(ra),ra=null),!e)return!1;try{return localStorage.setItem(e,JSON.stringify(t)),!0}catch{return!1}}function Fi(e){return{trackedIds:e.trackedIds,createPending:e.createPending,topUpPending:e.topUpPending}}const ku=$S(null),Pl=is((e,t)=>({scopeKey:null,trackedIds:ku.trackedIds,createPending:ku.createPending,topUpPending:ku.topUpPending,createPendingPersisted:ku.createPending!=null,setScope:n=>{if(t().scopeKey===n)return;ra&&(clearTimeout(ra),ra=null);const a=$S(n);e({scopeKey:n,trackedIds:a.trackedIds,createPending:a.createPending,topUpPending:a.topUpPending,createPendingPersisted:a.createPending!=null})},trackAccount:n=>{Rl(n)&&(e(a=>a.trackedIds.includes(n)?a:{trackedIds:[...a.trackedIds,n]}),wu(yi(t().scopeKey),Fi(t())))},untrackAccount:n=>{e(a=>a.trackedIds.includes(n)?{trackedIds:a.trackedIds.filter(s=>s!==n)}:a),wu(yi(t().scopeKey),Fi(t()))},isTracked:n=>t().trackedIds.includes(n),setCreatePending:n=>{e({createPending:n});const a=wh(yi(t().scopeKey),Fi(t()));return e({createPendingPersisted:a}),a},clearCreatePending:()=>{e({createPending:null,createPendingPersisted:!1}),wu(yi(t().scopeKey),Fi(t()))},setTopUpPending:n=>{Rl(n.accountId)&&(e(a=>({topUpPending:{...a.topUpPending,[n.accountId]:n}})),wh(yi(t().scopeKey),Fi(t())))},clearTopUpPending:n=>{e(a=>{if(!a.topUpPending[n])return a;const s={...a.topUpPending};return delete s[n],{topUpPending:s}}),wu(yi(t().scopeKey),Fi(t()))},finishCreate:n=>{e(a=>({createPending:null,createPendingPersisted:!1,trackedIds:Rl(n)&&!a.trackedIds.includes(n)?[...a.trackedIds,n]:a.trackedIds})),wh(yi(t().scopeKey),Fi(t()))}}));function kh(e){if(!e)return!1;try{return BigInt(e)>0n}catch{return!1}}function 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 Dg(e){return kh(e.topUpBuffer)?!0:e.remainingAllowance!==void 0?kh(e.remainingAllowance):e.extendedRequested?null:kh(e.baseEpochAllowance)}function UR(e){return Dg(e)===!0}function BR(e){return e.remainingAllowance!==void 0&&Dg(e)===!1}const US=90,BS=10080*60;function FR(e,t=Math.floor(Date.now()/1e3)){const{expiresAtTimestamp:n,fullySwept:a,agentCount:s}=e,l=typeof n=="number"&&n>0;return IS(e,t)?"expired":a?"swept":BR(e)?"insolvent":typeof s=="number"&&s>=US?"cap-near":l&&n-t<=BS?"expiring":"healthy"}function HR(e,t){return!PS(e,t)&&UR(e)}function qR(e){return(e==null?void 0:e.adapterSupported)===!1?null:(e==null?void 0:e.registered)??null}function jm(e,t){var u;const n=qR(e.probedKey);if(n===null)return{outcome:"inconclusive",registered:null,adapterUnsupported:((u=e.probedKey)==null?void 0:u.adapterSupported)===!1};if(n===!1)return{outcome:"unregistered",registered:!1};const a=PS(e,t),s=Dg(e);if(s===null)return{outcome:"inconclusive",registered:null,adapterUnsupported:!1};const l=s;return!a&&l?{outcome:"covers",registered:!0}:{outcome:"uncovered",registered:!0,dead:a,hasBudget:l}}const Wx=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();async function GR(e,t){const n={accountId:e,snapshot:null,error:null,notFound:!1,classification:"unknown",ownerIsPrimaryWallet:!1,health:null,walletProbes:[],approvedCount:0,walletCount:t.length,probesInconclusive:!1};let a;try{a=await od(e,void 0,{extended:!0})}catch(h){return{...n,error:h,notFound:h instanceof $n&&h.status===404}}const s=await Promise.all(t.map(h=>od(e,h,{extended:!0}).then(g=>({wallet:h,registered:jm(g).registered})).catch(()=>({wallet:h,registered:null})))),l=s.filter(h=>h.registered===!0).length,u=s.some(h=>h.registered===null),f=t.some(h=>Wx(h,a.owner))?"owned":l>0?"approved":"unknown";return{accountId:e,snapshot:a,error:null,notFound:!1,classification:f,ownerIsPrimaryWallet:Wx(t[0],a.owner),health:FR(a),walletProbes:s,approvedCount:l,walletCount:t.length,probesInconclusive:u}}const ro=new Map;function Zx(e){for(const t of e.subs)t()}async function pd(e){const t=++e.seq;if(e.ids.length===0){if(t!==e.seq)return;e.data={wallets:[],walletsError:!1,accounts:[]},e.error=null,e.loading=!1,Zx(e);return}try{const n=await Lg().catch(()=>null),a=(n==null?void 0:n.wallets)??[],s=!n||!!n.error,l=await Promise.all(e.ids.map(u=>GR(u,a)));if(t!==e.seq)return;e.data={wallets:a,walletsError:s,accounts:l},e.error=null}catch(n){if(t!==e.seq)return;e.error=(n==null?void 0:n.message)??"Failed to resolve PCAs."}finally{t===e.seq&&(e.loading=!1,Zx(e))}}function Sh(e){e.timer||e.intervalMs<=0||typeof document<"u"&&document.hidden||(e.timer=setInterval(()=>pd(e),e.intervalMs))}function jh(e){e.timer&&(clearInterval(e.timer),e.timer=null)}function VR(e,t,n,a){let s=ro.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},ro.set(e,s)),s.subs.add(a),l){const u=s,d=()=>{typeof document>"u"||(document.hidden?jh(u):(pd(u),Sh(u)))};s.onVisibility=d,typeof document<"u"&&document.addEventListener("visibilitychange",d),pd(s),Sh(s)}else n<s.intervalMs&&(s.intervalMs=n,jh(s),Sh(s));return()=>{const u=ro.get(e);u&&(u.subs.delete(a),u.subs.size===0&&(jh(u),u.onVisibility&&typeof document<"u"&&document.removeEventListener("visibilitychange",u.onVisibility),ro.delete(e)))}}const WR=[];function FS(e=3e4,t=[]){var j,N,S;const n=Pl(A=>A.trackedIds),a=t.join(","),s=w.useMemo(()=>[...n,...t.filter(A=>!n.includes(A))],[n.join(","),a]),l=s.join(","),[,u]=w.useReducer(A=>A+1,0);w.useEffect(()=>VR(l,s,e,u),[l,e]);const d=ro.get(l),f=((j=d==null?void 0:d.data)==null?void 0:j.accounts)??WR,h=d?d.loading:!0,g=(d==null?void 0:d.error)??null,{bestCoveringDiscountBps:m,covered:y}=w.useMemo(()=>{let A=null;for(const E of f){if(!E.snapshot||E.approvedCount<=0||!HR(E.snapshot))continue;const T=E.snapshot.discountBps;typeof T=="number"&&(A==null||T>A)&&(A=T)}return{bestCoveringDiscountBps:A,covered:A!=null}},[f]),b=((N=d==null?void 0:d.data)==null?void 0:N.wallets)??[],k=((S=d==null?void 0:d.data)==null?void 0:S.walletsError)??!1;return{accounts:f,wallets:b,walletsError:k,walletsInconclusive:k&&b.length===0,loading:h,error:g,refresh:()=>{const A=ro.get(l);A&&pd(A)},bestCoveringDiscountBps:m,covered:y}}let Ch=null;function HS(){const e=Pl(n=>n.scopeKey),t=Pl(n=>n.setScope);w.useEffect(()=>{e||Ch||(Ch=s_().then(n=>{t(zR(n))}).catch(()=>{}).finally(()=>{Ch=null}))},[e,t])}function ZR(){HS();const{accounts:e}=FS(3e4);return w.useMemo(()=>{const t=[],n=Math.floor(Date.now()/1e3);for(const a of e){const s=a.snapshot;if(!s)continue;const l=a.accountId,u=typeof s.expiresAtTimestamp=="number"&&s.expiresAtTimestamp>0,d=u&&n>=s.expiresAtTimestamp;d?t.push({id:`pca-${l}-expired`,accountId:l,kind:"expired",severity:"danger",title:`PCA #${l} has expired`,message:"Publishes no longer get its discount. Create a replacement account to keep saving."}):u&&s.expiresAtTimestamp-n<=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."}),a.classification==="owned"&&a.approvedCount===0&&!a.probesInconclusive&&!d&&t.push({id:`pca-${l}-fallthrough`,accountId:l,kind:"fallthrough",severity:"warn",title:`PCA #${l} discounts nothing yet`,message:"Publishes from this node pay the direct cost until you approve this node’s operational wallets."})}return t},[e])}function Ul(e,t=new Date){if(e==null||e==="")return"";const n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return"";if(n.toDateString()===t.toDateString())return n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});const s=new Date(t);if(s.setDate(t.getDate()-1),n.toDateString()===s.toDateString())return`Yesterday ${n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`;const l=t.getTime()-n.getTime();return l>=0&&l<10080*60*1e3?`${n.toLocaleDateString(void 0,{weekday:"short"})} ${n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`:n.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}/**
90
- * @license lucide-react v1.14.0 - ISC
91
- *
92
- * This source code is licensed under the ISC license.
93
- * See the LICENSE file in the root directory of this source tree.
94
- */const qS=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim();/**
95
- * @license lucide-react v1.14.0 - ISC
96
- *
97
- * This source code is licensed under the ISC license.
98
- * See the LICENSE file in the root directory of this source tree.
99
- */const KR=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 YR=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase());/**
105
- * @license lucide-react v1.14.0 - ISC
106
- *
107
- * This source code is licensed under the ISC license.
108
- * See the LICENSE file in the root directory of this source tree.
109
- */const Kx=e=>{const t=YR(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
110
- * @license lucide-react v1.14.0 - ISC
111
- *
112
- * This source code is licensed under the ISC license.
113
- * See the LICENSE file in the root directory of this source tree.
114
- */var Nh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
115
- * @license lucide-react v1.14.0 - ISC
116
- *
117
- * This source code is licensed under the ISC license.
118
- * See the LICENSE file in the root directory of this source tree.
119
- */const QR=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},XR=w.createContext({}),JR=()=>w.useContext(XR),eO=w.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:a,className:s="",children:l,iconNode:u,...d},f)=>{const{size:h=24,strokeWidth:g=2,absoluteStrokeWidth:m=!1,color:y="currentColor",className:b=""}=JR()??{},k=a??m?Number(n??g)*24/Number(t??h):n??g;return w.createElement("svg",{ref:f,...Nh,width:t??h??Nh.width,height:t??h??Nh.height,stroke:e??y,strokeWidth:k,className:qS("lucide",b,s),...!l&&!QR(d)&&{"aria-hidden":"true"},...d},[...u.map(([j,N])=>w.createElement(j,N)),...Array.isArray(l)?l:[l]])});/**
120
- * @license lucide-react v1.14.0 - ISC
121
- *
122
- * This source code is licensed under the ISC license.
123
- * See the LICENSE file in the root directory of this source tree.
124
- */const cn=(e,t)=>{const n=w.forwardRef(({className:a,...s},l)=>w.createElement(eO,{ref:l,iconNode:t,className:qS(`lucide-${KR(Kx(e))}`,`lucide-${e}`,a),...s}));return n.displayName=Kx(e),n};/**
125
- * @license lucide-react v1.14.0 - ISC
126
- *
127
- * This source code is licensed under the ISC license.
128
- * See the LICENSE file in the root directory of this source tree.
129
- */const tO=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],nO=cn("arrow-down",tO);/**
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 rO=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],aO=cn("arrow-up",rO);/**
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 iO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],sO=cn("ban",iO);/**
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 oO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],lO=cn("check",oO);/**
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 cO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],uO=cn("chevron-down",cO);/**
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 dO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cm=cn("chevron-right",dO);/**
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 pO=[["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"}]],fO=cn("copy",pO);/**
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 hO=[["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"}]],mO=cn("ellipsis",hO);/**
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 gO=[["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"}]],vO=cn("folder",gO);/**
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 yO=[["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"}]],bO=cn("globe",yO);/**
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 xO=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],wO=cn("loader-circle",xO);/**
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 kO=[["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"}]],SO=cn("lock",kO);/**
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 jO=[["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"}]],CO=cn("paperclip",jO);/**
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 NO=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Yx=cn("share-2",NO);/**
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 EO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],AO=cn("square",EO);/**
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 TO=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],_O=cn("trending-up",TO);/**
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 RO=[["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"}]],OO=cn("upload",RO);/**
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 LO=[["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"}]],MO=cn("users-round",LO);/**
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 DO=[["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"}]],zO=cn("wallet",DO);/**
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 $O=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],IO=cn("x",$O),Eh={1:"ETH",8453:"ETH",84532:"ETH",11155111:"ETH",31337:"ETH",100:"xDAI",10200:"xDAI",2043:"NEURO",20430:"NEURO"};function GS(e){var a;if(e==null)return"ETH";const t=String(e);if(Eh[t])return Eh[t];const n=(a=t.match(/(\d+)\s*$/))==null?void 0:a[1];return n&&Eh[n]||"ETH"}function rV(e,t=6,n=4){const a=(e??"").trim();return a.length<=t+n+1?a:`${a.slice(0,t)}…${a.slice(-n)}`}const Ah="—";function PO(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 a=Math.abs(n),s=a>0&&a<10?t:0;return new Intl.NumberFormat("en-US",{minimumFractionDigits:0,maximumFractionDigits:s}).format(n)}function UO(e,t=2){if(e==null||e==="")return"—";let n;try{n=BigInt(e)}catch{return"—"}const a=n<0n;a&&(n=-n);const s=10n**18n,l=n/s,u=(n%s+s).toString().slice(1).slice(0,t);return PO(`${a?"-":""}${l}.${u||"0"}`,t)}const BO=new Set(["84532","11155111","31337","10200","20430"]);function aV(e){if(e==null)return!1;const t=String(e),n=t.includes(":")?t.split(":").pop():t;return BO.has(n)}function iV(e,t=Math.floor(Date.now()/1e3)){if(!e||e<=0)return"Expiry unknown";const n=e-t,a=Math.round(Math.abs(n)/86400);return n<=0?a===0?"Expired today":`Expired ~${a} day${a===1?"":"s"} ago`:`Expires in ~${a} day${a===1?"":"s"}`}function 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 a=(n/100).toFixed(n%100===0?0:1),s=e.accountId?`via PCA #${e.accountId}`:"across multiple PCAs";return o.jsxs("span",{className:["badge","badge-success","v10-pca-discount-applied",t].filter(Boolean).join(" "),"data-testid":"pca-discount-badge",role:"status",children:[o.jsx("span",{"aria-hidden":"true",children:"◉ "}),"Discount applied — −",a,"% ",s]})}function FO(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 HO={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 qO({verdict:e,accountId:t,discountBps:n,accountUntracked:a=!1,reasons:s=[],ownerPublish:l=!1,variant:u="banner",children:d,className:f=""}){const h=HO[e],g=e==="fallthrough"||e==="fallthrough-no-funds",m=g?"alert":"status",y=g?"assertive":"polite",b=t?`PCA #${t}`:"a PCA",k=a?" (not tracked by this node)":"",j=FO(n),N=" unless this graph’s registration escrow already covers it",S=s.length>0?` Reason: ${s.join("; ")}.`:"";if(u==="chip"){const E=e==="eligible"?`Funded by ${b}${k}${j?` (${j} discount)`:""}`:e==="fallthrough"?"⚠ No PCA discount":e==="fallthrough-no-funds"?"⚠ Publish will fail":"PCA status unknown";return o.jsx("span",{className:["v10-pca-verdict-chip",h.toneClass,f].filter(Boolean).join(" "),"data-testid":"pca-eligibility-chip","data-verdict":e,children:o.jsx("span",{className:"v10-pca-verdict-chip-label",role:m,"aria-live":y,children:E})})}let A;return e==="eligible"?A=o.jsxs(o.Fragment,{children:["This publish will use ",b,k,j?` (${j} discount)`:"",".",l?`${N}.`:""]}):e==="fallthrough"?A=o.jsxs(o.Fragment,{children:["No PCA discount on this publish — it will attempt to pay the direct cost from the signing wallet’s TRAC",j?`, forfeiting ${b}’s ${j} discount`:"",l?N:"","; the publish fails if that TRAC is below the fee.",S]}):e==="fallthrough-no-funds"?A=o.jsxs(o.Fragment,{children:["This publish will FAIL — no signing wallet can cover it",j?`, forfeiting ${b}’s ${j} discount`:"",l?N:"",".",S]}):A=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}),A]}),d&&o.jsx("div",{className:"v10-pca-verdict-actions",children:d})]})}const fd=new Map,Nm=new Set;let Qx=!1;function GO(){const e=[...fd.values()];for(const t of Nm)t(e)}function VO(e){const t=e.detail;fd.has(t.info.uuid)||(fd.set(t.info.uuid,t),GO())}function WO(){Qx||typeof window>"u"||(Qx=!0,window.addEventListener("eip6963:announceProvider",VO),window.dispatchEvent(new Event("eip6963:requestProvider")))}function ZO(e){return Nm.add(e),e([...fd.values()]),()=>{Nm.delete(e)}}function Em(e){var a;if(typeof e=="number")return e;const t=(a=String(e).match(/(\d+)\s*$/))==null?void 0:a[1],n=t?Number(t):NaN;if(!Number.isFinite(n))throw new Error(`Unrecognized chainId: ${e}`);return n}function KO(e){return`0x${Em(e).toString(16)}`}const zg="dkg-node-ui:wallet-provider-rdns";function YO(e){var t;try{(t=globalThis.localStorage)==null||t.setItem(zg,e)}catch{}}function QO(){var e;try{return((e=globalThis.localStorage)==null?void 0:e.getItem(zg))??null}catch{return null}}function Xx(){var e;try{(e=globalThis.localStorage)==null||e.removeItem(zg)}catch{}}const ZS=new Set(["app.phantom"]),XO=300;function JO(e){return e.filter(t=>!ZS.has(t.info.rdns))}function eL(e,t){if(!t)return null;const n=e.filter(a=>a.info.rdns===t);return n.length===1?n[0]:null}function sV(e){return e.address!=null&&e.expectedChainId!=null&&e.chainId!==e.expectedChainId}function tL(e){return(e.walletRpcUrls??[]).filter(t=>/^https?:\/\//i.test(t))}let Su=!1,ju=null,Jx=!1;const oV=is((e,t)=>{function n(s){s.on&&(s.on("accountsChanged",(...l)=>{const u=l[0],d=(u==null?void 0:u[0])??null;if(d===null){t().disconnect();return}e({address:d})}),s.on("chainChanged",(...l)=>{e({chainId:parseInt(l[0],16)})}),s.on("disconnect",()=>t().disconnect()))}async function a(s){const l=s.provider;try{const u=await l.request({method:"eth_accounts"});if(u.length===0){Xx();return}const d=await l.request({method:"eth_chainId"});n(l),e({provider:l,providerInfo:s.info,address:u[0],chainId:parseInt(d,16)})}catch(u){console.warn("[wallet] silent reconnect failed",u)}}return{discovered:[],unsupported:[],provider:null,providerInfo:null,address:null,chainId:null,expectedChainId:null,bootstrap:null,setBootstrap(s){e({bootstrap:s,expectedChainId:Em(s.chainId)})},initWallet(){if(typeof window>"u"||(WO(),Jx))return;Jx=!0;const s=QO();ZO(l=>{e({discovered:JO(l),unsupported:l.filter(u=>ZS.has(u.info.rdns))}),!(!s||Su)&&(ju&&clearTimeout(ju),ju=setTimeout(()=>{if(ju=null,Su)return;const u=eL(t().discovered,s);u&&(Su=!0,a(u))},XO))})},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)}),YO(s.info.rdns),Su=!1},disconnect(){e({provider:null,providerInfo:null,address:null,chainId:null}),Xx()},async switchToExpectedChain(){const{provider:s,bootstrap:l}=t();if(!s)throw new Error("Wallet not connected.");if(!l)throw new Error("Chain not bootstrapped.");const u=KO(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=tL(l);if(h.length===0)throw new Error("Wallet does not know this chain and the node did not provide wallet-public RPC URLs. Add the network in your wallet, then try again.");await s.request({method:"wallet_addEthereumChain",params:[{chainId:u,chainName:`chain-${Em(l.chainId)}`,nativeCurrency:{name:f,symbol:f,decimals:18},rpcUrls:h}]})}else throw d}}}});function $g(e,t){return e&&e.trim()?e:t.length>20?`${t.slice(0,16)}…`:t}function e1(e){return e.length>12?`${e.slice(0,6)}…${e.slice(-4)}`:e}function nL({item:e,onApprove:t,onDeny:n,onOpen:a}){var g;const[s,l]=w.useState({kind:"idle"}),u=$g(e.contextGraphName,e.cgId),d=((g=e.agentName)==null?void 0:g.trim())||e1(e.agentAddress),f=async m=>{l({kind:"working",action:m});const b=await(m==="approve"?t:n)(e.cgId,e.agentAddress);if(b.ok){const k=b.alreadyHandled?"Already handled":m==="approve"?`Approved — ${d} can now access ${u}`:`Request from ${d} declined`;l({kind:"done",label:k})}else{const k=b.roleError?`You're no longer the curator of ${u}`:m==="approve"?"Couldn’t approve":"Couldn’t deny";l({kind:"error",action:m,message:k})}};if(s.kind==="done")return o.jsxs("div",{className:"v10-notif-row v10-notif-row-terminal",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"v10-notif-glyph","aria-hidden":"true",children:"✓"}),o.jsx("span",{className:"v10-notif-terminal-text",children:s.label})]});const h=s.kind==="working";return o.jsxs("div",{className:"v10-notif-row v10-notif-row-join",children:[o.jsx("span",{className:"v10-notif-glyph v10-notif-glyph-join","aria-hidden":"true",children:"🔑"}),o.jsxs("div",{className:"v10-notif-row-body",children:[o.jsx("div",{className:"v10-notif-row-title",children:"Join request"}),o.jsxs("div",{className:"v10-notif-row-detail",children:[o.jsx("span",{className:"v10-notif-actor",children:d})," wants to join"," ",o.jsx("button",{type:"button",className:"v10-notif-cg-link",onClick:()=>a(e.cgId),title:`Open ${u}`,children:u})]}),o.jsxs("div",{className:"v10-notif-row-sub",children:[o.jsx("span",{className:"v10-notif-addr",title:e.agentAddress,children:e1(e.agentAddress)}),o.jsx("span",{className:"v10-notif-dot",children:"·"}),o.jsx("span",{className:"v10-notif-time",title:new Date(e.ts).toLocaleString(),children:Ul(e.ts)})]}),s.kind==="error"&&o.jsxs("div",{className:"v10-notif-row-error",role:"status","aria-live":"polite",children:[s.message," ",o.jsx("button",{type:"button",className:"v10-notif-retry",onClick:()=>f(s.action),children:"Retry"})]}),o.jsx("span",{className:"v10-sr-only",role:"status","aria-live":"polite",children:h?s.action==="approve"?"Approving…":"Denying…":""})]}),o.jsx("div",{className:"v10-notif-row-actions",children:s.kind==="confirming-deny"?o.jsxs("span",{className:"v10-notif-deny-confirm",role:"group","aria-label":"Confirm deny",onKeyDown:m=>{m.key==="Escape"&&(m.stopPropagation(),l({kind:"idle"}))},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||l({kind:"idle"})},children:[o.jsx("span",{className:"v10-notif-deny-confirm-label",children:"Deny?"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-deny",onClick:()=>f("deny"),"aria-label":`Confirm deny join request from ${d} for ${u}`,children:"Yes"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-ghost",onClick:()=>l({kind:"idle"}),autoFocus:!0,children:"Cancel"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-approve",onClick:()=>f("approve"),disabled:h,"aria-label":`Approve join request from ${d} for ${u}`,children:h&&s.action==="approve"?"…":"Approve"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-ghost",onClick:()=>l({kind:"confirming-deny"}),disabled:h,"aria-label":`Deny join request from ${d} for ${u}`,children:h&&s.action==="deny"?"…":"Deny"})]})})]})}const rL={created:"+",promoted:"⇡",published:"◉"};function aL(e,t,n){const a=t,s=a===1?"assertion":"assertions";return e==="created"?n?`${n} added ${a} ${s}`:`${a} new ${s} added`:e==="promoted"?n?`${n} promoted ${a} ${s}`:`${a} ${s} promoted`:n?`${n} published ${a} ${s} to Verifiable Memory`:`${a} ${s} published to Verifiable Memory`}function iL({item:e,onOpen:t}){var d;const n=$g(e.contextGraphName,e.cgId),a=e.bySelf?"You":((d=e.actorAgentName)==null?void 0:d.trim())||void 0,s=aL(e.event,e.count,a),l=Ul(e.ts),u=`${s} in ${n}${l?`, ${l}`:""}. Open ${n} recent activity.`;return o.jsxs("button",{type:"button",className:`v10-notif-row v10-notif-row-activity v10-notif-activity-${e.event}${e.bySelf?" v10-notif-by-self":""}${e.read?"":" v10-notif-unread"}`,onClick:()=>t(e.cgId),title:`Open ${n} · recent activity`,"aria-label":u,children:[o.jsx("span",{className:`v10-notif-glyph v10-notif-glyph-${e.event}`,"aria-hidden":"true",children:rL[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 sL({item:e,onOpen:t}){const n=$g(e.contextGraphName,e.cgId),a=e.kind==="join_approved",s=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`v10-notif-glyph ${a?"v10-notif-glyph-approved":"v10-notif-glyph-rejected"}`,"aria-hidden":"true",children:a?"✓":"✕"}),o.jsxs("span",{className:"v10-notif-row-body",children:[o.jsx("span",{className:"v10-notif-row-title",children:a?"Request approved":"Request declined"}),o.jsx("span",{className:"v10-notif-row-detail",children:a?o.jsxs(o.Fragment,{children:["You can now access ",o.jsx("span",{className:"v10-notif-cg-name",children:n})]}):o.jsxs(o.Fragment,{children:["Your request to join ",o.jsx("span",{className:"v10-notif-cg-name",children:n})," wasn’t approved"]})})]}),o.jsx("span",{className:"v10-notif-time",title:new Date(e.ts).toLocaleString(),children:Ul(e.ts)})]});if(a){const l=Ul(e.ts);return o.jsx("button",{type:"button",className:`v10-notif-row v10-notif-row-confirm v10-notif-confirm-approved${e.read?"":" v10-notif-unread"}`,onClick:()=>t(e.cgId),title:`Open ${n}`,"aria-label":`Request approved: you can now access ${n}${l?`, ${l}`:""}. Open ${n}.`,children:s})}return o.jsx("div",{className:`v10-notif-row v10-notif-row-confirm v10-notif-confirm-rejected${e.read?"":" v10-notif-unread"}`,"aria-disabled":"true",children:s})}function oL({item:e}){var h;const t=VS(e.covered),n=t!=null?(t/100).toFixed(t%100===0?0:1):null;let a=null;try{const g=BigInt(e.covered.baseCost),m=BigInt(e.covered.discountedCost);g>0n&&m>=0n&&m<g&&(a=UO((g-m).toString()))}catch{a=null}const s=`PCA #${e.covered.accountId}`,l=(h=e.contextGraphName)!=null&&h.trim()?` in ${e.contextGraphName.trim()}`:"",u=n!=null?"Publishing discount applied":"Publishing fee covered",d=n!=null?`−${n}% via ${s}${a?` · saved ${a} TRAC`:""}${l}`:`via ${s}${l}`,f=Ul(e.ts);return o.jsxs("div",{className:`v10-notif-row v10-notif-row-confirm v10-notif-pca-discount${e.read?"":" v10-notif-unread"}`,role:"status","aria-label":`${u}, ${d}${f?`, ${f}`:""}.`,children:[o.jsx("span",{className:"v10-notif-glyph v10-notif-glyph-approved","aria-hidden":"true",children:"◉"}),o.jsxs("span",{className:"v10-notif-row-body","aria-hidden":"true",children:[o.jsx("span",{className:"v10-notif-row-title",children:u}),o.jsx("span",{className:"v10-notif-row-detail",children:d})]}),o.jsx("span",{className:"v10-notif-time","aria-hidden":"true",title:new Date(e.ts).toLocaleString(),children:f})]})}function lL({feed:e,onOpenContextGraph:t,pcaAlerts:n=[],onOpenPca:a,id:s,paneRef:l}){const{joinRequests:u,activity:d,status:f,refreshError:h,partialActivityError:g,hasInformationalUnread:m,approve:y,deny:b,markSeen:k,markAllInformationalSeen:j}=e,N=(U,_)=>{k([_]),t(U)},S=u.length>0,A=d.length>0,E=n.length>0,T=!S&&!A&&!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(U=>o.jsxs("div",{className:"v10-pca-alert-row","data-severity":U.severity,"data-testid":"pca-bell-alert",role:U.severity==="danger"?"alert":"status",children:[o.jsx("div",{className:"v10-pca-alert-title",children:U.title}),o.jsx("div",{className:"v10-pca-alert-msg",children:U.message}),a&&o.jsxs("button",{type:"button",className:"v10-pca-alert-action",onClick:()=>a(U.accountId),children:["Manage PCA #",U.accountId]})]},U.id))})]}),f==="identity-pending"?o.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Verifying access…"}):f==="loading"&&T?o.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Loading notifications…"}):f==="error"&&T?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"})]}):T?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(U=>o.jsx(nL,{item:U,onApprove:y,onDeny:b,onOpen:t},U.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."}),A?o.jsx("div",{className:"v10-notif-section-rows",children:d.map(U=>U.kind==="digest"?o.jsx(iL,{item:U,onOpen:_=>N(_,U.id)},U.id):U.kind==="pca_cost_covered"?o.jsx(oL,{item:U},U.id):o.jsx(sL,{item:U,onOpen:_=>N(_,U.id)},U.id))}):!g&&o.jsx("div",{className:"v10-notif-section-empty",children:"No recent activity."})]})]})]})]})}const cL=o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),o.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),t1="v10-notifications-pane";function uL(){const e=LR(),t=ZR(),[n,a]=w.useState(!1),s=w.useRef(null),l=w.useRef(null),u=Tr(b=>b.setActiveProject),{openTab:d}=fn(),f=w.useRef(null),h=w.useCallback((b=!1)=>{var k;a(!1),b&&((k=l.current)==null||k.focus())},[]);w.useEffect(()=>{if(!n)return;const b=k=>{s.current&&!s.current.contains(k.target)&&h()};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n,h]),w.useEffect(()=>{if(!n)return;const b=f.current;if(!b)return;const k=b.querySelector(".v10-notif-section-action .v10-notif-btn-approve"),j=b.querySelector(".v10-notif-section-rows button, .v10-notif-section-rows a[href]"),N=b.querySelector('button:not(.v10-notif-pane-markread), [href], [tabindex]:not([tabindex="-1"])');(k??j??N??b).focus()},[n]);const g=w.useCallback(b=>{u(b),d({id:`project:${b}`,label:b.slice(0,16),closable:!0}),h()},[u,d,h]),m=w.useCallback(b=>{d({id:`conviction:${b}`,label:`PCA #${b}`,closable:!0}),h()},[d,h]),y=e.unread+t.length;return o.jsxs("div",{className:"v10-header-notif-wrap",ref:s,onKeyDown:n?b=>{b.key==="Escape"&&(b.stopPropagation(),h(!0))}:void 0,children:[o.jsxs("button",{ref:l,className:"v10-header-icon-btn",onClick:()=>a(b=>!b),title:y>0?`Notifications (${y} unread)`:"Notifications","aria-label":y>0?`Notifications, ${y} unread`:"Notifications","aria-haspopup":"dialog","aria-expanded":n,"aria-controls":n?t1:void 0,children:[cL,y>0&&o.jsx("span",{className:"v10-header-notif-badge",children:y})]}),n&&o.jsx(lL,{id:t1,paneRef:f,feed:e,onOpenContextGraph:g,pcaAlerts:t,onOpenPca:m})]})}function dL(e,t,n,a,s){const l=[e?"Synced with the network":"Syncing with the network",`${t} peer${t===1?"":"s"} (${n} direct, ${a} relayed)`];return s>0&&l.push(`Uptime ${pL(s)}`),l.join(`
225
- `)}function pL(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),a=Math.floor(t%86400/3600),s=Math.floor(t%3600/60),l=[];return n>0&&l.push(`${n}d`),(a>0||n>0)&&l.push(`${a}h`),l.push(`${s}m`),l.join(" ")}const fL=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"})]})}),hL=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"})]}),mL=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"})}),gL=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"})]}),vL=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"})]}),yL=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"})]}),bL=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"})}),xL=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 wL(){var N,S;const{theme:e,setTheme:t,leftCollapsed:n,toggleLeft:a,rightCollapsed:s,toggleRight:l}=Vn(),u=wg(A=>A.nodeStatus),d=zd().data,{openTab:f}=fn(),h=(u==null?void 0:u.connectedPeers)??(u==null?void 0:u.peerCount)??0,g=((N=u==null?void 0:u.connections)==null?void 0:N.direct)??0,m=((S=u==null?void 0:u.connections)==null?void 0:S.relayed)??0,y=(u==null?void 0:u.uptimeMs)??0,k=u!=null&&(u==null?void 0:u.synced)!==!1,j=dL(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"}),fL]})]}),o.jsx("button",{className:`v10-header-icon-btn ${n?"":"active-toggle"}`,onClick:a,title:"Toggle sidebar",children:gL}),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(uL,{}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"operations",label:"Observability",closable:!0}),title:"Observability",children:bL}),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:xL}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"settings",label:"Settings",closable:!0}),title:"Settings",children:yL}),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"?hL:mL}),o.jsx("button",{className:`v10-header-icon-btn ${s?"":"active-toggle"}`,onClick:l,title:"Toggle agent panel",children:vL})]})]})}function kL(){const e=localStorage.getItem("dkg-journey-stage");return e==="1"?1:e==="2"?2:0}const Ig=is((e,t)=>({stage:kL(),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})}})),SL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .\r
227
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\r
228
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\r
229
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\r
230
- @prefix dcterms: <http://purl.org/dc/terms/> .\r
231
- @prefix schema: <http://schema.org/> .\r
232
- @prefix foaf: <http://xmlns.com/foaf/0.1/> .\r
233
- @prefix prov: <http://www.w3.org/ns/prov#> .\r
234
- @prefix skos: <http://www.w3.org/2004/02/skos/core#> .\r
235
- @prefix bibo: <http://purl.org/ontology/bibo/> .\r
236
- @prefix fabio: <http://purl.org/spar/fabio/> .\r
237
- @prefix cito: <http://purl.org/spar/cito/> .\r
238
- @prefix frbr: <http://purl.org/vocab/frbr/core#> .\r
239
- \r
240
- @prefix chat: <http://dkg.io/ontology/chat/> .\r
241
- @prefix dkg: <http://dkg.io/ontology/> .\r
242
- @prefix : <http://dkg.io/ontology/book-research/> .\r
243
- \r
244
- <http://dkg.io/ontology/book-research/>\r
245
- a owl:Ontology ;\r
246
- dcterms:title "DKG Book Research Project Ontology (v1)" ;\r
247
- dcterms:description """Starter ontology for projects that research and\r
248
- write books, papers, or long-form non-fiction. Built on schema.org +\r
249
- BIBO + the SPAR family (FaBiO, CiTO) + FRBR + SKOS so it composes with\r
250
- existing scholarly publishing infrastructure.""" ;\r
251
- owl:versionInfo "1.0.0" ;\r
252
- dcterms:created "2026-04-18"^^xsd:date ;\r
253
- owl:imports\r
254
- <http://schema.org/> , <http://purl.org/dc/terms/> ,\r
255
- <http://www.w3.org/ns/prov#> , <http://xmlns.com/foaf/0.1/> ,\r
256
- <http://www.w3.org/2004/02/skos/core#> ,\r
257
- <http://purl.org/ontology/bibo/> ,\r
258
- <http://purl.org/spar/fabio/> ,\r
259
- <http://purl.org/spar/cito/> ,\r
260
- <http://purl.org/vocab/frbr/core#> .\r
261
- \r
262
- # ─── Universal annotation predicates (shared across all starters) ───\r
263
- chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
264
- chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .\r
265
- chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .\r
266
- chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .\r
267
- chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .\r
268
- chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .\r
269
- \r
270
- # ─── Universal annotation entities ──────────────────────────────────\r
271
- :Concept rdfs:subClassOf skos:Concept .\r
272
- :Topic rdfs:subClassOf skos:Concept .\r
273
- :Question rdfs:subClassOf schema:Question .\r
274
- :Finding rdfs:subClassOf prov:Entity .\r
275
- \r
276
- # ─── Book-research specific ─────────────────────────────────────────\r
277
- \r
278
- :Hypothesis a owl:Class ;\r
279
- rdfs:label "Hypothesis" ;\r
280
- rdfs:comment "A claim under investigation. Supersedes when refuted; promotes to a Finding when supported." ;\r
281
- rdfs:subClassOf prov:Entity .\r
282
- \r
283
- :Argument a owl:Class ;\r
284
- rdfs:label "Argument" ;\r
285
- rdfs:comment "A reasoned position taken on a Hypothesis or other entity." ;\r
286
- rdfs:subClassOf prov:Entity .\r
287
- \r
288
- :Counterexample a owl:Class ;\r
289
- rdfs:label "Counterexample" ;\r
290
- rdfs:comment "Evidence that refutes a Hypothesis or Argument." ;\r
291
- rdfs:subClassOf prov:Entity .\r
292
- \r
293
- :Quote a owl:Class ;\r
294
- rdfs:label "Quote" ;\r
295
- rdfs:comment "Verbatim passage extracted from a source. Subclass of bibo:Quote so it composes with bibliographic tools." ;\r
296
- rdfs:subClassOf bibo:Quote .\r
297
- \r
298
- :supports a owl:ObjectProperty ;\r
299
- rdfs:label "supports" ;\r
300
- rdfs:comment "An Argument or Quote supports a Hypothesis." ;\r
301
- rdfs:subPropertyOf cito:agreesWith .\r
302
- \r
303
- :refutes a owl:ObjectProperty ;\r
304
- rdfs:label "refutes" ;\r
305
- rdfs:comment "An Argument, Counterexample, or Quote refutes a Hypothesis." ;\r
306
- rdfs:subPropertyOf cito:disagreesWith .\r
307
- \r
308
- :cites a owl:ObjectProperty ;\r
309
- rdfs:label "cites" ;\r
310
- rdfs:subPropertyOf cito:cites ;\r
311
- rdfs:range bibo:Document .\r
312
- \r
313
- # ─── URI patterns ───────────────────────────────────────────────────\r
314
- :UriPattern rdfs:label "URI minting pattern" .\r
315
- \r
316
- :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .\r
317
- :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .\r
318
- :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .\r
319
- :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .\r
320
- :hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .\r
321
- :argument-pattern a :UriPattern ; skos:notation "urn:dkg:argument:<slug>" .\r
322
- :quote-pattern a :UriPattern ; skos:notation "urn:dkg:quote:<slug>" .\r
323
- :citation-pattern a :UriPattern ; skos:notation "urn:dkg:citation:<slug>" ;\r
324
- skos:definition "Bibliographic citation; aligned with bibo:Document via cito:cites." .\r
325
- \r
326
- :slug-normalisation a skos:Note ;\r
327
- skos:definition "Lowercase → ASCII-fold → strip stopwords (the/a/an/of/for/and/or/to/in/on/with) → hyphenate → ≤60 chars. Apply BEFORE comparing free-text recall results (\`dkg_memory_search\`) to decide reuse-vs-mint." .\r
328
- `,jL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .\r
329
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\r
330
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\r
331
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\r
332
- @prefix dcterms: <http://purl.org/dc/terms/> .\r
333
- @prefix schema: <http://schema.org/> .\r
334
- @prefix foaf: <http://xmlns.com/foaf/0.1/> .\r
335
- @prefix prov: <http://www.w3.org/ns/prov#> .\r
336
- @prefix skos: <http://www.w3.org/2004/02/skos/core#> .\r
337
- @prefix doap: <http://usefulinc.com/ns/doap#> .\r
338
- \r
339
- # DKG project namespaces — v1 ontology for any "coding project"\r
340
- # context graph. Imports widely-adopted Linked Data vocabs first;\r
341
- # only declares extensions for genuinely net-new concepts.\r
342
- @prefix chat: <http://dkg.io/ontology/chat/> .\r
343
- @prefix code: <http://dkg.io/ontology/code/> .\r
344
- @prefix github: <http://dkg.io/ontology/github/> .\r
345
- @prefix decisions: <http://dkg.io/ontology/decisions/> .\r
346
- @prefix tasks: <http://dkg.io/ontology/tasks/> .\r
347
- @prefix agent: <http://dkg.io/ontology/agent/> .\r
348
- @prefix dkg: <http://dkg.io/ontology/> .\r
349
- \r
350
- @prefix : <http://dkg.io/ontology/coding-project/> .\r
351
- \r
352
- # ─── Ontology header ────────────────────────────────────────────────\r
353
- <http://dkg.io/ontology/coding-project/>\r
354
- a owl:Ontology ;\r
355
- dcterms:title "DKG Coding Project Ontology (v1)" ;\r
356
- dcterms:description """The starter ontology for any DKG context graph that\r
357
- represents a software project — its decisions, tasks, code structure, GitHub\r
358
- activity, agents, and chat. Designed to be \`owl:imports\`-ed by per-project\r
359
- ontologies, which add their own extensions on top.\r
360
- \r
361
- Every predicate is either reused from a globally-adopted vocabulary\r
362
- (schema.org, DCTerms, PROV-O, FOAF, SKOS, DOAP) or declared here as a\r
363
- project-specific extension. Companion document \`agent-guide.md\` translates\r
364
- this formal model into operational instructions for AI coding agents.""" ;\r
365
- dcterms:creator "branarakic" ;\r
366
- owl:versionInfo "1.0.0" ;\r
367
- dcterms:created "2026-04-18"^^xsd:date ;\r
368
- owl:imports\r
369
- <http://schema.org/> ,\r
370
- <http://purl.org/dc/terms/> ,\r
371
- <http://www.w3.org/ns/prov#> ,\r
372
- <http://xmlns.com/foaf/0.1/> ,\r
373
- <http://www.w3.org/2004/02/skos/core#> ,\r
374
- <http://usefulinc.com/ns/doap#> .\r
375
- \r
376
- # ─── Section 1 — Universal annotation primitives ────────────────────\r
377
- # Predicates expressing what each chat turn was ABOUT — written into\r
378
- # the project's \`chat\` sub-graph by the capture-chat hook (and later\r
379
- # read by \`dkg_query\` / \`dkg_memory_search\`). These predicates apply\r
380
- # to ANY project type, not just coding.\r
381
- \r
382
- chat:topic\r
383
- a owl:DatatypeProperty ;\r
384
- rdfs:label "topic" ;\r
385
- rdfs:comment "Free-text topical bucket the chat turn lives under. Multiple per turn; emit liberally. Renderer can use these to cluster the activity feed." ;\r
386
- rdfs:domain chat:Turn ;\r
387
- rdfs:range xsd:string .\r
388
- \r
389
- chat:mentions\r
390
- a owl:ObjectProperty ;\r
391
- rdfs:label "mentions" ;\r
392
- rdfs:comment "An entity the chat turn referenced. The most common edge in the graph. To find existing entities to reuse before minting fresh URIs, use \`dkg_memory_search\` (free-text recall across WM/SWM/VM)." ;\r
393
- rdfs:domain chat:Turn ;\r
394
- rdfs:range owl:Thing ;\r
395
- rdfs:subPropertyOf schema:mentions .\r
396
- \r
397
- chat:examines\r
398
- a owl:ObjectProperty ;\r
399
- rdfs:label "examines" ;\r
400
- rdfs:comment "Entity the chat turn walked through in detail (vs just mentioning in passing). Implies the agent or operator is ANALYSING the entity, not merely citing it." ;\r
401
- rdfs:domain chat:Turn ;\r
402
- rdfs:range owl:Thing .\r
403
- \r
404
- chat:proposes\r
405
- a owl:ObjectProperty ;\r
406
- rdfs:label "proposes" ;\r
407
- rdfs:comment "An idea/decision/task the chat turn put forward. Often points at a freshly-minted Decision or Task entity created in the same write batch." ;\r
408
- rdfs:domain chat:Turn ;\r
409
- rdfs:range owl:Thing .\r
410
- \r
411
- chat:concludes\r
412
- a owl:ObjectProperty ;\r
413
- rdfs:label "concludes" ;\r
414
- rdfs:comment "A Finding entity the chat turn produced — a claim worth preserving as a first-class node, separate from the turn body." ;\r
415
- rdfs:domain chat:Turn ;\r
416
- rdfs:range :Finding .\r
417
- \r
418
- chat:asks\r
419
- a owl:ObjectProperty ;\r
420
- rdfs:label "asks" ;\r
421
- rdfs:comment "A Question entity the chat turn left open. Tracking these lets a future query surface 'what did we never resolve?'." ;\r
422
- rdfs:domain chat:Turn ;\r
423
- rdfs:range :Question .\r
424
- \r
425
- # ─── Section 2 — Universal annotation entity classes ────────────────\r
426
- \r
427
- :Concept\r
428
- a owl:Class ;\r
429
- rdfs:label "Concept" ;\r
430
- rdfs:comment "A free-text concept emerging from chat that doesn't fit into a more specific class. Aligned with skos:Concept so it composes with any knowledge organisation system." ;\r
431
- rdfs:subClassOf skos:Concept .\r
432
- \r
433
- :Topic\r
434
- a owl:Class ;\r
435
- rdfs:label "Topic" ;\r
436
- rdfs:comment "A broad topical bucket grouping related concepts/turns/entities. URI pattern: urn:dkg:topic:<slug>." ;\r
437
- rdfs:subClassOf skos:Concept .\r
438
- \r
439
- :Question\r
440
- a owl:Class ;\r
441
- rdfs:label "Question" ;\r
442
- rdfs:comment "An open question raised in chat that hasn't been answered yet. URI pattern: urn:dkg:question:<slug>. Resolved by linking a chat:Turn or :Finding via :answers." ;\r
443
- rdfs:subClassOf schema:Question .\r
444
- \r
445
- :Finding\r
446
- a owl:Class ;\r
447
- rdfs:label "Finding" ;\r
448
- rdfs:comment "A claim or observation worth preserving as a first-class entity, separate from the chat turn that produced it. URI pattern: urn:dkg:finding:<slug>. Findings can be cited by future Decisions, Tasks, and chat turns." ;\r
449
- rdfs:subClassOf prov:Entity .\r
450
- \r
451
- :answers\r
452
- a owl:ObjectProperty ;\r
453
- rdfs:label "answers" ;\r
454
- rdfs:comment "Links a Finding (or chat turn) to the Question it resolves." ;\r
455
- rdfs:domain owl:Thing ;\r
456
- rdfs:range :Question .\r
457
- \r
458
- :supersedes\r
459
- a owl:ObjectProperty ;\r
460
- rdfs:label "supersedes" ;\r
461
- rdfs:comment "This entity replaces an older one (e.g. a revised Finding supersedes an earlier one)." ;\r
462
- rdfs:range owl:Thing ;\r
463
- owl:inverseOf prov:wasRevisionOf .\r
464
- \r
465
- # ─── Section 3 — Coding-project-specific classes ────────────────────\r
466
- # Formalises the predicates already used informally in\r
467
- # scripts/lib/ontology.mjs, anchoring them in PROV-O and schema.org.\r
468
- \r
469
- decisions:Decision\r
470
- a owl:Class ;\r
471
- rdfs:label "Decision" ;\r
472
- rdfs:comment "An architectural decision the project made — context, outcome, consequences. Modelled as a prov:Activity because it represents a deliberate act of choosing." ;\r
473
- rdfs:subClassOf prov:Activity, schema:Action .\r
474
- \r
475
- decisions:context\r
476
- a owl:DatatypeProperty ;\r
477
- rdfs:label "context" ;\r
478
- rdfs:domain decisions:Decision ;\r
479
- rdfs:range xsd:string ;\r
480
- rdfs:comment "Why this decision was being made — problem, constraints, alternatives considered." .\r
481
- \r
482
- decisions:outcome\r
483
- a owl:DatatypeProperty ;\r
484
- rdfs:label "outcome" ;\r
485
- rdfs:domain decisions:Decision ;\r
486
- rdfs:range xsd:string ;\r
487
- rdfs:comment "The chosen direction — the decision itself, in one paragraph." .\r
488
- \r
489
- decisions:consequences\r
490
- a owl:DatatypeProperty ;\r
491
- rdfs:label "consequences" ;\r
492
- rdfs:domain decisions:Decision ;\r
493
- rdfs:range xsd:string ;\r
494
- rdfs:comment "What this implies going forward — trade-offs, follow-ups." .\r
495
- \r
496
- decisions:status\r
497
- a owl:DatatypeProperty ;\r
498
- rdfs:label "status" ;\r
499
- rdfs:domain decisions:Decision ;\r
500
- rdfs:range xsd:string ;\r
501
- rdfs:comment "One of: proposed | accepted | rejected | superseded." .\r
502
- \r
503
- tasks:Task\r
504
- a owl:Class ;\r
505
- rdfs:label "Task" ;\r
506
- rdfs:comment "A piece of planned or in-flight work on the project." ;\r
507
- rdfs:subClassOf schema:Action .\r
508
- \r
509
- tasks:status\r
510
- a owl:DatatypeProperty ;\r
511
- rdfs:label "status" ;\r
512
- rdfs:domain tasks:Task ;\r
513
- rdfs:range xsd:string ;\r
514
- rdfs:comment "One of: todo | in_progress | blocked | done | cancelled." .\r
515
- \r
516
- tasks:priority\r
517
- a owl:DatatypeProperty ;\r
518
- rdfs:label "priority" ;\r
519
- rdfs:domain tasks:Task ;\r
520
- rdfs:range xsd:string ;\r
521
- rdfs:comment "One of: p0 | p1 | p2 | p3." .\r
522
- \r
523
- tasks:relatedDecision\r
524
- a owl:ObjectProperty ;\r
525
- rdfs:label "related decision" ;\r
526
- rdfs:domain tasks:Task ;\r
527
- rdfs:range decisions:Decision ;\r
528
- rdfs:comment "The Decision this task implements or follows from." .\r
529
- \r
530
- tasks:dependsOn\r
531
- a owl:ObjectProperty ;\r
532
- rdfs:label "depends on" ;\r
533
- rdfs:domain tasks:Task ;\r
534
- rdfs:range tasks:Task .\r
535
- \r
536
- tasks:touches\r
537
- a owl:ObjectProperty ;\r
538
- rdfs:label "touches" ;\r
539
- rdfs:domain tasks:Task ;\r
540
- rdfs:range owl:Thing ;\r
541
- rdfs:comment "A code:File or code:Package this task edits." .\r
542
- \r
543
- # Code structure — aligned with schema:SoftwareSourceCode + DOAP.\r
544
- \r
545
- code:Package\r
546
- a owl:Class ;\r
547
- rdfs:label "Package" ;\r
548
- rdfs:subClassOf doap:Project, schema:SoftwareApplication .\r
549
- \r
550
- code:File\r
551
- a owl:Class ;\r
552
- rdfs:label "Source file" ;\r
553
- rdfs:subClassOf schema:SoftwareSourceCode .\r
554
- \r
555
- code:Function a owl:Class ; rdfs:label "Function" .\r
556
- code:Class a owl:Class ; rdfs:label "Class" .\r
557
- code:Interface a owl:Class ; rdfs:label "Interface" .\r
558
- \r
559
- # GitHub — minimal aliasing onto schema.org where sensible.\r
560
- \r
561
- github:Repository\r
562
- a owl:Class ;\r
563
- rdfs:label "GitHub repository" ;\r
564
- rdfs:subClassOf schema:SoftwareSourceCode, doap:Project .\r
565
- \r
566
- github:PullRequest\r
567
- a owl:Class ;\r
568
- rdfs:label "Pull request" ;\r
569
- rdfs:subClassOf schema:CreativeWork .\r
570
- \r
571
- github:Issue\r
572
- a owl:Class ;\r
573
- rdfs:label "GitHub issue" ;\r
574
- rdfs:subClassOf schema:Question, schema:CreativeWork .\r
575
- \r
576
- # ─── Section 4 — Chat sub-graph classes ─────────────────────────────\r
577
- \r
578
- chat:Session\r
579
- a owl:Class ;\r
580
- rdfs:label "Chat session" ;\r
581
- rdfs:comment "One conversation between an operator and their coding assistant (Cursor window, Claude Code thread, etc.)." ;\r
582
- rdfs:subClassOf schema:Conversation .\r
583
- \r
584
- chat:Turn\r
585
- a owl:Class ;\r
586
- rdfs:label "Chat turn" ;\r
587
- rdfs:comment "One user-prompt + assistant-response pair within a Session. Carries provenance via prov:wasAttributedTo." ;\r
588
- rdfs:subClassOf schema:Message, prov:Entity .\r
589
- \r
590
- chat:userPrompt a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
591
- chat:assistantResponse a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
592
- chat:turnIndex a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:integer .\r
593
- chat:inSession a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range chat:Session .\r
594
- chat:speakerTool a owl:DatatypeProperty ; rdfs:range xsd:string ;\r
595
- rdfs:comment "Identifier of the coding assistant that produced the turn (e.g. 'cursor', 'claude-code')." .\r
596
- chat:privacy a owl:DatatypeProperty ; rdfs:domain chat:Session ; rdfs:range xsd:string ;\r
597
- rdfs:comment "One of: private | team | public. Controls auto-promote behaviour of the capture hook." .\r
598
- \r
599
- # ─── Section 5 — Agent identity ─────────────────────────────────────\r
600
- \r
601
- agent:Agent\r
602
- a owl:Class ;\r
603
- rdfs:label "Agent" ;\r
604
- rdfs:subClassOf prov:Agent, foaf:Agent .\r
605
- \r
606
- agent:HumanAgent rdfs:subClassOf agent:Agent, foaf:Person .\r
607
- agent:AIAgent rdfs:subClassOf agent:Agent, schema:SoftwareApplication .\r
608
- \r
609
- agent:framework\r
610
- a owl:DatatypeProperty ;\r
611
- rdfs:label "framework" ;\r
612
- rdfs:domain agent:AIAgent ;\r
613
- rdfs:range xsd:string ;\r
614
- rdfs:comment "Name of the agent runtime — 'cursor', 'claude-code', 'openclaw', 'hermes', etc." .\r
615
- \r
616
- agent:operator\r
617
- a owl:ObjectProperty ;\r
618
- rdfs:label "operator" ;\r
619
- rdfs:domain agent:AIAgent ;\r
620
- rdfs:range agent:HumanAgent ;\r
621
- rdfs:comment "The human operator who runs and is responsible for this AI agent." .\r
622
- \r
623
- # ─── Section 6 — URI minting conventions (machine-readable) ─────────\r
624
- # These are encoded as SKOS notes so an agent reading the ontology can\r
625
- # pull them out programmatically. The agent guide repeats them in\r
626
- # prose for human readability.\r
627
- \r
628
- :UriPattern\r
629
- a owl:Class ;\r
630
- rdfs:label "URI minting pattern" ;\r
631
- rdfs:comment "Documents the URI shape the agent should produce when minting a new entity of a given type." .\r
632
- \r
633
- :concept-pattern a :UriPattern ;\r
634
- skos:notation "urn:dkg:concept:<slug>" ;\r
635
- skos:definition "Free-text concept; aligned with skos:Concept." .\r
636
- :topic-pattern a :UriPattern ;\r
637
- skos:notation "urn:dkg:topic:<slug>" ;\r
638
- skos:definition "Broad topical bucket grouping related entities." .\r
639
- :question-pattern a :UriPattern ;\r
640
- skos:notation "urn:dkg:question:<slug>" ;\r
641
- skos:definition "An open question awaiting an answer." .\r
642
- :finding-pattern a :UriPattern ;\r
643
- skos:notation "urn:dkg:finding:<slug>" ;\r
644
- skos:definition "A claim or observation worth preserving as a first-class node." .\r
645
- :decision-pattern a :UriPattern ;\r
646
- skos:notation "urn:dkg:decision:<slug>" ;\r
647
- skos:definition "An architectural decision (coding-project specific)." .\r
648
- :task-pattern a :UriPattern ;\r
649
- skos:notation "urn:dkg:task:<slug>" ;\r
650
- skos:definition "A piece of planned or in-flight work (coding-project specific)." .\r
651
- \r
652
- # ─── Section 7 — Slug normalisation rule (deterministic) ────────────\r
653
- \r
654
- :slug-normalisation a skos:Note ;\r
655
- skos:prefLabel "slug normalisation" ;\r
656
- skos:definition """To compute the canonical slug from a free-text label:\r
657
- 1. Lowercase.\r
658
- 2. Apply Unicode NFKD then strip combining marks (ASCII fold).\r
659
- 3. Strip common stopwords (the / a / an / of / for / and / or / to / in / on / with).\r
660
- 4. Replace any run of non-[a-z0-9] with a single hyphen.\r
661
- 5. Trim leading/trailing hyphens.\r
662
- 6. Truncate to 60 characters max.\r
663
- \r
664
- Example: "the Tree-Sitter library", "Tree sitter", "TREE_SITTER" all\r
665
- normalise to "tree-sitter". Always apply this BEFORE comparing free-text\r
666
- recall results (\`dkg_memory_search\`) in the look-before-mint protocol.""" .\r
667
- `,CL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .\r
668
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\r
669
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\r
670
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\r
671
- @prefix dcterms: <http://purl.org/dc/terms/> .\r
672
- @prefix schema: <http://schema.org/> .\r
673
- @prefix foaf: <http://xmlns.com/foaf/0.1/> .\r
674
- @prefix prov: <http://www.w3.org/ns/prov#> .\r
675
- @prefix skos: <http://www.w3.org/2004/02/skos/core#> .\r
676
- @prefix bibo: <http://purl.org/ontology/bibo/> .\r
677
- \r
678
- @prefix chat: <http://dkg.io/ontology/chat/> .\r
679
- @prefix : <http://dkg.io/ontology/narrative-writing/> .\r
680
- \r
681
- <http://dkg.io/ontology/narrative-writing/>\r
682
- a owl:Ontology ;\r
683
- dcterms:title "DKG Narrative Writing Project Ontology (v1)" ;\r
684
- dcterms:description """Starter for fiction or narrative non-fiction\r
685
- projects: novels, screenplays, biographies. Tracks Characters, Scenes,\r
686
- Plot Points, Themes, and the relationships between them.""" ;\r
687
- owl:versionInfo "1.0.0" ;\r
688
- dcterms:created "2026-04-18"^^xsd:date ;\r
689
- owl:imports\r
690
- <http://schema.org/> , <http://purl.org/dc/terms/> ,\r
691
- <http://xmlns.com/foaf/0.1/> ,\r
692
- <http://www.w3.org/2004/02/skos/core#> ,\r
693
- <http://purl.org/ontology/bibo/> .\r
694
- \r
695
- # ─── Universal annotation predicates ────────────────────────────────\r
696
- chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
697
- chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .\r
698
- chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
699
- chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
700
- chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .\r
701
- chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .\r
702
- \r
703
- # ─── Universal annotation entities ──────────────────────────────────\r
704
- :Concept rdfs:subClassOf skos:Concept .\r
705
- :Topic rdfs:subClassOf skos:Concept .\r
706
- :Question rdfs:subClassOf schema:Question .\r
707
- :Finding rdfs:subClassOf prov:Entity .\r
708
- \r
709
- # ─── Narrative-writing-specific ─────────────────────────────────────\r
710
- \r
711
- :Character a owl:Class ;\r
712
- rdfs:label "Character" ;\r
713
- rdfs:comment "A character in the narrative — fictional or historical." ;\r
714
- rdfs:subClassOf foaf:Person, schema:Person .\r
715
- \r
716
- :Scene a owl:Class ;\r
717
- rdfs:label "Scene" ;\r
718
- rdfs:comment "A discrete unit of narrative action — a single place/time/event in the story." ;\r
719
- rdfs:subClassOf schema:Event .\r
720
- \r
721
- :PlotPoint a owl:Class ;\r
722
- rdfs:label "Plot point" ;\r
723
- rdfs:comment "A structural moment in the narrative arc (inciting incident, climax, resolution, etc.)." .\r
724
- \r
725
- :Theme a owl:Class ;\r
726
- rdfs:label "Theme" ;\r
727
- rdfs:comment "A unifying idea explored across the narrative." ;\r
728
- rdfs:subClassOf skos:Concept .\r
729
- \r
730
- :Setting a owl:Class ;\r
731
- rdfs:label "Setting" ;\r
732
- rdfs:comment "A place + time context within which Scenes occur." .\r
733
- \r
734
- :appearsIn a owl:ObjectProperty ;\r
735
- rdfs:label "appears in" ;\r
736
- rdfs:domain :Character ;\r
737
- rdfs:range :Scene .\r
738
- \r
739
- :setIn a owl:ObjectProperty ;\r
740
- rdfs:label "set in" ;\r
741
- rdfs:domain :Scene ;\r
742
- rdfs:range :Setting .\r
743
- \r
744
- :develops a owl:ObjectProperty ;\r
745
- rdfs:label "develops" ;\r
746
- rdfs:comment "A Scene or PlotPoint develops a Theme or a Character arc." ;\r
747
- rdfs:range owl:Thing .\r
748
- \r
749
- :precedes a owl:ObjectProperty ;\r
750
- rdfs:label "precedes" ;\r
751
- rdfs:domain :Scene ;\r
752
- rdfs:range :Scene .\r
753
- \r
754
- # ─── URI patterns ───────────────────────────────────────────────────\r
755
- :UriPattern rdfs:label "URI minting pattern" .\r
756
- \r
757
- :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .\r
758
- :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .\r
759
- :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .\r
760
- :character-pattern a :UriPattern ; skos:notation "urn:dkg:character:<slug>" .\r
761
- :scene-pattern a :UriPattern ; skos:notation "urn:dkg:scene:<slug>" .\r
762
- :plotpoint-pattern a :UriPattern ; skos:notation "urn:dkg:plotpoint:<slug>" .\r
763
- :theme-pattern a :UriPattern ; skos:notation "urn:dkg:theme:<slug>" .\r
764
- :setting-pattern a :UriPattern ; skos:notation "urn:dkg:setting:<slug>" .\r
765
- \r
766
- :slug-normalisation a skos:Note ;\r
767
- skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .\r
768
- `,NL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .\r
769
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\r
770
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\r
771
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\r
772
- @prefix dcterms: <http://purl.org/dc/terms/> .\r
773
- @prefix schema: <http://schema.org/> .\r
774
- @prefix foaf: <http://xmlns.com/foaf/0.1/> .\r
775
- @prefix prov: <http://www.w3.org/ns/prov#> .\r
776
- @prefix skos: <http://www.w3.org/2004/02/skos/core#> .\r
777
- @prefix time: <http://www.w3.org/2006/time#> .\r
778
- \r
779
- @prefix chat: <http://dkg.io/ontology/chat/> .\r
780
- @prefix : <http://dkg.io/ontology/pkm/> .\r
781
- \r
782
- <http://dkg.io/ontology/pkm/>\r
783
- a owl:Ontology ;\r
784
- dcterms:title "DKG Personal Knowledge Management Ontology (v1)" ;\r
785
- dcterms:description """Starter for personal/team knowledge gardens.\r
786
- Notes, highlights, questions, insights — the daily-driver vocabulary\r
787
- of an Obsidian/Roam-style PKM workflow, but graph-native and shareable\r
788
- with teammates' agents.""" ;\r
789
- owl:versionInfo "1.0.0" ;\r
790
- dcterms:created "2026-04-18"^^xsd:date ;\r
791
- owl:imports\r
792
- <http://schema.org/> , <http://purl.org/dc/terms/> ,\r
793
- <http://xmlns.com/foaf/0.1/> ,\r
794
- <http://www.w3.org/2004/02/skos/core#> ,\r
795
- <http://www.w3.org/2006/time#> .\r
796
- \r
797
- # ─── Universal annotation predicates ────────────────────────────────\r
798
- chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
799
- chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .\r
800
- chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
801
- chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
802
- chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Insight .\r
803
- chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .\r
804
- \r
805
- # ─── Universal annotation entities ──────────────────────────────────\r
806
- :Concept rdfs:subClassOf skos:Concept .\r
807
- :Topic rdfs:subClassOf skos:Concept .\r
808
- :Question rdfs:subClassOf schema:Question .\r
809
- :Finding rdfs:subClassOf prov:Entity .\r
810
- \r
811
- # ─── PKM-specific ────────────────────────────────────────────────────\r
812
- \r
813
- :Note a owl:Class ;\r
814
- rdfs:label "Note" ;\r
815
- rdfs:comment "An atomic note — a single self-contained thought worth capturing. The fundamental unit of a PKM graph." ;\r
816
- rdfs:subClassOf schema:CreativeWork .\r
817
- \r
818
- :Highlight a owl:Class ;\r
819
- rdfs:label "Highlight" ;\r
820
- rdfs:comment "A passage of text marked as significant from a source (article, book, transcript). Carries provenance back to the source." ;\r
821
- rdfs:subClassOf schema:Quotation .\r
822
- \r
823
- :Insight a owl:Class ;\r
824
- rdfs:label "Insight" ;\r
825
- rdfs:comment "A connection or realisation that synthesises across multiple Notes/Highlights. Promotes from a chat turn via chat:concludes." ;\r
826
- rdfs:subClassOf prov:Entity .\r
827
- \r
828
- :relatedTo a owl:ObjectProperty ;\r
829
- rdfs:label "related to" ;\r
830
- rdfs:subPropertyOf skos:related .\r
831
- \r
832
- :references a owl:ObjectProperty ;\r
833
- rdfs:label "references" ;\r
834
- rdfs:subPropertyOf dcterms:references .\r
835
- \r
836
- :source a owl:ObjectProperty ;\r
837
- rdfs:label "source" ;\r
838
- rdfs:domain :Highlight ;\r
839
- rdfs:range schema:CreativeWork ;\r
840
- rdfs:comment "Where a Highlight was extracted from." ;\r
841
- rdfs:subPropertyOf dcterms:source .\r
842
- \r
843
- # ─── URI patterns ───────────────────────────────────────────────────\r
844
- :UriPattern rdfs:label "URI minting pattern" .\r
845
- \r
846
- :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .\r
847
- :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .\r
848
- :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .\r
849
- :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .\r
850
- :note-pattern a :UriPattern ; skos:notation "urn:dkg:note:<slug>" .\r
851
- :highlight-pattern a :UriPattern ; skos:notation "urn:dkg:highlight:<slug>" .\r
852
- :insight-pattern a :UriPattern ; skos:notation "urn:dkg:insight:<slug>" .\r
853
- \r
854
- :slug-normalisation a skos:Note ;\r
855
- skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .\r
856
- `,EL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .\r
857
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\r
858
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\r
859
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\r
860
- @prefix dcterms: <http://purl.org/dc/terms/> .\r
861
- @prefix schema: <http://schema.org/> .\r
862
- @prefix prov: <http://www.w3.org/ns/prov#> .\r
863
- @prefix skos: <http://www.w3.org/2004/02/skos/core#> .\r
864
- @prefix dcat: <http://www.w3.org/ns/dcat#> .\r
865
- @prefix fabio: <http://purl.org/spar/fabio/> .\r
866
- @prefix time: <http://www.w3.org/2006/time#> .\r
867
- \r
868
- @prefix chat: <http://dkg.io/ontology/chat/> .\r
869
- @prefix : <http://dkg.io/ontology/scientific-research/> .\r
870
- \r
871
- <http://dkg.io/ontology/scientific-research/>\r
872
- a owl:Ontology ;\r
873
- dcterms:title "DKG Scientific Research Project Ontology (v1)" ;\r
874
- dcterms:description """Starter for empirical scientific research:\r
875
- hypotheses → experiments → results → reproducibility chains. Composes\r
876
- with FaBiO for scholarly works, DCAT for datasets, PROV-O for\r
877
- provenance, OWL Time for sequencing.""" ;\r
878
- owl:versionInfo "1.0.0" ;\r
879
- dcterms:created "2026-04-18"^^xsd:date ;\r
880
- owl:imports\r
881
- <http://schema.org/> , <http://purl.org/dc/terms/> ,\r
882
- <http://www.w3.org/ns/prov#> ,\r
883
- <http://www.w3.org/2004/02/skos/core#> ,\r
884
- <http://www.w3.org/ns/dcat#> ,\r
885
- <http://purl.org/spar/fabio/> ,\r
886
- <http://www.w3.org/2006/time#> .\r
887
- \r
888
- # ─── Universal annotation predicates ────────────────────────────────\r
889
- chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .\r
890
- chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .\r
891
- chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
892
- chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .\r
893
- chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Result .\r
894
- chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .\r
895
- \r
896
- # ─── Universal annotation entities ──────────────────────────────────\r
897
- :Concept rdfs:subClassOf skos:Concept .\r
898
- :Topic rdfs:subClassOf skos:Concept .\r
899
- :Question rdfs:subClassOf schema:Question .\r
900
- :Finding rdfs:subClassOf prov:Entity .\r
901
- \r
902
- # ─── Scientific-research-specific ───────────────────────────────────\r
903
- \r
904
- :Hypothesis a owl:Class ;\r
905
- rdfs:label "Hypothesis" ;\r
906
- rdfs:comment "A testable claim. Linked to Experiments via :testedBy and to Results via :supportedBy / :refutedBy." ;\r
907
- rdfs:subClassOf prov:Entity .\r
908
- \r
909
- :Experiment a owl:Class ;\r
910
- rdfs:label "Experiment" ;\r
911
- rdfs:comment "A defined procedure executed to test a Hypothesis. Subclass of prov:Activity for full provenance." ;\r
912
- rdfs:subClassOf prov:Activity .\r
913
- \r
914
- :Method a owl:Class ;\r
915
- rdfs:label "Method" ;\r
916
- rdfs:comment "A reusable methodology applied within Experiments." ;\r
917
- rdfs:subClassOf prov:Plan .\r
918
- \r
919
- :Result a owl:Class ;\r
920
- rdfs:label "Result" ;\r
921
- rdfs:comment "An outcome produced by an Experiment — quantitative or qualitative." ;\r
922
- rdfs:subClassOf prov:Entity .\r
923
- \r
924
- :Dataset a owl:Class ;\r
925
- rdfs:label "Dataset" ;\r
926
- rdfs:comment "An input or output dataset for an Experiment. Aligned with DCAT." ;\r
927
- rdfs:subClassOf dcat:Dataset .\r
928
- \r
929
- :testedBy a owl:ObjectProperty ;\r
930
- rdfs:label "tested by" ;\r
931
- rdfs:domain :Hypothesis ;\r
932
- rdfs:range :Experiment .\r
933
- \r
934
- :supportedBy a owl:ObjectProperty ;\r
935
- rdfs:label "supported by" ;\r
936
- rdfs:domain :Hypothesis ;\r
937
- rdfs:range :Result .\r
938
- \r
939
- :refutedBy a owl:ObjectProperty ;\r
940
- rdfs:label "refuted by" ;\r
941
- rdfs:domain :Hypothesis ;\r
942
- rdfs:range :Result .\r
943
- \r
944
- :usesDataset a owl:ObjectProperty ;\r
945
- rdfs:label "uses dataset" ;\r
946
- rdfs:domain :Experiment ;\r
947
- rdfs:range :Dataset .\r
948
- \r
949
- :reproducedBy a owl:ObjectProperty ;\r
950
- rdfs:label "reproduced by" ;\r
951
- rdfs:domain :Experiment ;\r
952
- rdfs:range :Experiment ;\r
953
- rdfs:comment "An Experiment that successfully reproduced this one's Results." .\r
954
- \r
955
- # ─── URI patterns ───────────────────────────────────────────────────\r
956
- :UriPattern rdfs:label "URI minting pattern" .\r
957
- \r
958
- :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .\r
959
- :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .\r
960
- :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .\r
961
- :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .\r
962
- :hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .\r
963
- :experiment-pattern a :UriPattern ; skos:notation "urn:dkg:experiment:<slug>" .\r
964
- :method-pattern a :UriPattern ; skos:notation "urn:dkg:method:<slug>" .\r
965
- :result-pattern a :UriPattern ; skos:notation "urn:dkg:result:<slug>" .\r
966
- :dataset-pattern a :UriPattern ; skos:notation "urn:dkg:dataset:<slug>" .\r
967
- \r
968
- :slug-normalisation a skos:Note ;\r
969
- skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .\r
970
- `,AL=`# Book-research agent guide\r
971
- \r
972
- This starter ships an RDF ontology for **book-research projects** —\r
973
- research notebooks anchored in scholarly sources (citations, quotes,\r
974
- arguments, hypotheses). The formal schema lives in \`ontology.ttl\`\r
975
- alongside this guide.\r
976
- \r
977
- For V10 MCP tool usage, see\r
978
- [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).\r
979
- The tool surface to use against this ontology:\r
980
- \r
981
- - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)\r
982
- - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")\r
983
- - \`dkg_knowledge_asset_share\` — share with peers (SWM)\r
984
- - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL\r
985
- - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall\r
986
- \r
987
- The longer per-domain agent-guide walkthrough format will return when\r
988
- the V10 ontology endpoint and per-project annotation workflow stabilise.\r
989
- `,TL=`# Coding-project agent guide\r
990
- \r
991
- This starter ships an RDF ontology for **coding projects** —\r
992
- shared project memory for AI coding agents (decisions, tasks, code\r
993
- references, GitHub activity, chat turns). The formal schema lives in\r
994
- \`ontology.ttl\` alongside this guide.\r
995
- \r
996
- For V10 MCP tool usage, see\r
997
- [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).\r
998
- The tool surface to use against this ontology:\r
999
- \r
1000
- - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)\r
1001
- - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")\r
1002
- - \`dkg_knowledge_asset_share\` — share with peers (SWM)\r
1003
- - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL\r
1004
- - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall\r
1005
- \r
1006
- The longer per-domain agent-guide walkthrough format will return when\r
1007
- the V10 ontology endpoint and per-project annotation workflow stabilise.\r
1008
- `,_L=`# Narrative-writing agent guide\r
1009
- \r
1010
- This starter ships an RDF ontology for **narrative-writing projects** —\r
1011
- the structural elements of long-form narrative (Characters, Scenes,\r
1012
- PlotPoints, Themes, Settings) and their relationships. The formal\r
1013
- schema lives in \`ontology.ttl\` alongside this guide.\r
1014
- \r
1015
- For V10 MCP tool usage, see\r
1016
- [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).\r
1017
- The tool surface to use against this ontology:\r
1018
- \r
1019
- - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)\r
1020
- - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")\r
1021
- - \`dkg_knowledge_asset_share\` — share with peers (SWM)\r
1022
- - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL\r
1023
- - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall\r
1024
- \r
1025
- The longer per-domain agent-guide walkthrough format will return when\r
1026
- the V10 ontology endpoint and per-project annotation workflow stabilise.\r
1027
- `,RL=`# PKM agent guide\r
1028
- \r
1029
- This starter ships an RDF ontology for **PKM (Personal Knowledge\r
1030
- Management) projects** — Notes, Highlights, Insights, and the links\r
1031
- that grow a knowledge garden organically. The formal schema lives in\r
1032
- \`ontology.ttl\` alongside this guide.\r
1033
- \r
1034
- For V10 MCP tool usage, see\r
1035
- [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).\r
1036
- The tool surface to use against this ontology:\r
1037
- \r
1038
- - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)\r
1039
- - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")\r
1040
- - \`dkg_knowledge_asset_share\` — share with peers (SWM)\r
1041
- - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL\r
1042
- - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall\r
1043
- \r
1044
- The longer per-domain agent-guide walkthrough format will return when\r
1045
- the V10 ontology endpoint and per-project annotation workflow stabilise.\r
1046
- `,OL=`# Scientific-research agent guide\r
1047
- \r
1048
- This starter ships an RDF ontology for **scientific-research projects** —\r
1049
- the empirical research arc (Hypotheses → Experiments → Results →\r
1050
- Reproducibility chains), anchored in PROV-O and FaBiO so the graph\r
1051
- composes with existing scholarly publishing infrastructure. The formal\r
1052
- schema lives in \`ontology.ttl\` alongside this guide.\r
1053
- \r
1054
- For V10 MCP tool usage, see\r
1055
- [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).\r
1056
- The tool surface to use against this ontology:\r
1057
- \r
1058
- - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)\r
1059
- - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")\r
1060
- - \`dkg_knowledge_asset_share\` — share with peers (SWM)\r
1061
- - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL\r
1062
- - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall\r
1063
- \r
1064
- The longer per-domain agent-guide walkthrough format will return when\r
1065
- the V10 ontology endpoint and per-project annotation workflow stabilise.\r
1066
- `,LL=/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>"{}|\\^`\x00-\x20]+$/;function ML(e){return e?LL.test(e):!1}function KS(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}const Nt={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",schema:"http://schema.org/",dcterms:"http://purl.org/dc/terms/",xsd:"http://www.w3.org/2001/XMLSchema#",prov:"http://www.w3.org/ns/prov#",owl:"http://www.w3.org/2002/07/owl#"};function bi(e){if(!ML(e))throw new Error(`Invalid /wm/write IRI object: ${e}`);return e}function Er(e){return`"${KS(e)}"`}function Cu(e,t){return`"${KS(e)}"^^<${bi(t)}>`}function DL({contextGraphId:e,starterSlug:t,ttl:n,guide:a,nowIso:s=new Date().toISOString()}){if(!e)throw new Error("contextGraphId is required");if(!t)throw new Error("starterSlug is required");const l=bi(`urn:dkg:project:${e}:ontology`),u=bi(`${l}:agent-guide`),d=[{subject:l,predicate:Nt.rdf+"type",object:bi(Nt.owl+"Ontology")},{subject:l,predicate:Nt.rdf+"type",object:bi(Nt.prov+"Entity")},{subject:l,predicate:Nt.rdfs+"label",object:Er(`Project ontology — ${e}`)},{subject:l,predicate:Nt.schema+"name",object:Er(`Project ontology — ${e}`)},{subject:l,predicate:Nt.dcterms+"title",object:Er(`Project ontology — ${e}`)},{subject:l,predicate:Nt.dcterms+"description",object:Er(`The active ontology for context graph ${e}, derived from the '${t}' starter.`)},{subject:l,predicate:Nt.dcterms+"created",object:Cu(s,Nt.xsd+"dateTime")},{subject:l,predicate:Nt.dcterms+"modified",object:Cu(s,Nt.xsd+"dateTime")},{subject:l,predicate:Nt.dcterms+"source",object:Er(t)},{subject:l,predicate:Nt.schema+"encodingFormat",object:Er("text/turtle")},{subject:l,predicate:Nt.schema+"text",object:Er(n)},{subject:l,predicate:Nt.dcterms+"references",object:bi(u)},{subject:u,predicate:Nt.rdf+"type",object:bi(Nt.schema+"DigitalDocument")},{subject:u,predicate:Nt.rdfs+"label",object:Er(`Agent guide — ${e} ontology`)},{subject:u,predicate:Nt.schema+"name",object:Er(`Agent guide — ${e} ontology`)},{subject:u,predicate:Nt.dcterms+"title",object:Er(`Agent guide — ${e} ontology`)},{subject:u,predicate:Nt.dcterms+"created",object:Cu(s,Nt.xsd+"dateTime")},{subject:u,predicate:Nt.dcterms+"modified",object:Cu(s,Nt.xsd+"dateTime")},{subject:u,predicate:Nt.schema+"encodingFormat",object:Er("text/markdown")},{subject:u,predicate:Nt.schema+"text",object:Er(a)},{subject:u,predicate:Nt.schema+"about",object:bi(l)}];return{ontologyUri:l,guideUri:u,quads:d}}async function Nu(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify(t)});if(!n.ok){const a=await n.json().catch(()=>({})),s=(a==null?void 0:a.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}const zL=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/ontology.ttl":SL,"../../../../mcp-dkg/templates/ontologies/coding-project/ontology.ttl":jL,"../../../../mcp-dkg/templates/ontologies/narrative-writing/ontology.ttl":CL,"../../../../mcp-dkg/templates/ontologies/pkm/ontology.ttl":NL,"../../../../mcp-dkg/templates/ontologies/scientific-research/ontology.ttl":EL}),$L=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/agent-guide.md":AL,"../../../../mcp-dkg/templates/ontologies/coding-project/agent-guide.md":TL,"../../../../mcp-dkg/templates/ontologies/narrative-writing/agent-guide.md":_L,"../../../../mcp-dkg/templates/ontologies/pkm/agent-guide.md":RL,"../../../../mcp-dkg/templates/ontologies/scientific-research/agent-guide.md":OL});function IL(){const e={};for(const[t,n]of Object.entries(zL)){const a=t.match(/ontologies\/([^/]+)\/ontology\.ttl$/);if(!a)continue;const s=a[1];e[s]={ttl:n,guide:""}}for(const[t,n]of Object.entries($L)){const a=t.match(/ontologies\/([^/]+)\/agent-guide\.md$/);if(!a)continue;const s=a[1];e[s]&&(e[s].guide=n)}return e}const Pg=IL(),PL=[{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 UL(){return PL.filter(e=>Pg[e.slug])}function BL(e){return Pg[e]??null}async function FL(e,t){const n=BL(t);if(!n)throw new Error(`Unknown ontology starter '${t}'. Available: ${Object.keys(Pg).join(", ")}`);if(!n.ttl||!n.guide)throw new Error(`Starter '${t}' is missing ontology.ttl or agent-guide.md.`);await Nu("/api/sub-graph/create",{contextGraphId:e,subGraphName:"meta"}).catch(d=>{if(!String((d==null?void 0:d.message)??d).includes("already exists"))throw d});const{ontologyUri:a,guideUri:s,quads:l}=DL({contextGraphId:e,starterSlug:t,ttl:n.ttl,guide:n.guide});await Nu("/api/knowledge-assets/project-ontology/wm/discard",{contextGraphId:e,subGraphName:"meta"}).catch(d=>{const f=String((d==null?void 0:d.message)??d);if(!/404|not found/i.test(f))throw d}),await Nu("/api/knowledge-assets/project-ontology/wm/write",{contextGraphId:e,subGraphName:"meta",quads:l});const u=await Nu("/api/knowledge-assets/project-ontology/swm/share",{contextGraphId:e,subGraphName:"meta"});if(!u.swmShared||!u.sealed||!u.publishReady)throw new Error("Project ontology atomic share did not reach Shared Working Memory");return{ontologyUri:a,guideUri:s,tripleCount:l.length}}async function Ug(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify(t)}),a=await n.text();let s;if(a)try{s=JSON.parse(a)}catch{s={raw:a}}if(!n.ok){const l=(s==null?void 0:s.error)??`HTTP ${n.status}`;throw new Error(typeof l=="string"?l:JSON.stringify(l))}return s}function HL(e,t={}){return Ug(`/api/context-graph/${encodeURIComponent(e)}/manifest/publish`,t)}function qL(e,t){return Ug(`/api/context-graph/${encodeURIComponent(e)}/manifest/plan-install`,t)}function GL(e,t){return Ug(`/api/context-graph/${encodeURIComponent(e)}/manifest/install`,t)}const n1="dkg.wireWorkspace.parentDir",r1="dkg.wireWorkspace.nickname",a1="dkg.wireWorkspace.tools",Th=[{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 VL(e,t){const n=t.split("/"),a=n[n.length-1]??"";return a||(e??"project").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function WL(e){if(!e)return"";const t=e.hostname.replace(/\.local$/,"").replace(/-/g," ");return`${e.username} @ ${t}`}function i1(e){return e==="both"?["cursor","claude-code"]:[e]}function YS({contextGraphId:e,projectName:t,defaultAgentNickname:n,onDone:a,onCancel:s,variant:l}){var K;const u=w.useMemo(()=>VL(t,e),[t,e]),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(""),[b,k]=w.useState(""),[j,N]=w.useState("cursor"),[S,A]=w.useState(!1),[E,T]=w.useState(null),[U,_]=w.useState(null),[z,q]=w.useState(null);w.useEffect(()=>{let I=!1;return(async()=>{try{const[H,B]=await Promise.all([fetch("/api/host/info",{headers:Ft()}).then(V=>V.ok?V.json():null),Yl().catch(()=>null)]);if(I)return;if(H){f(H);const V=typeof window<"u"&&window.localStorage.getItem(n1)||H.defaultWorkspaceParent;y(`${V}/${u}`)}B&&g(B);const W=typeof window<"u"&&window.localStorage.getItem(r1);n?k(n):W?k(W):H&&k(WL(H));const Q=typeof window<"u"&&window.localStorage.getItem(a1);Q&&(Q==="cursor"||Q==="claude-code"||Q==="both")&&N(Q)}catch(H){I||console.warn("[WireWorkspacePanel] host info / identity fetch failed:",H)}})(),()=>{I=!0}},[u,n]);function D(I){typeof window>"u"||(window.localStorage.setItem(n1,I),b&&window.localStorage.setItem(r1,b),window.localStorage.setItem(a1,j))}async function R(){A(!0),T(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 H=await qL(e,{workspaceRoot:I,agentNickname:b.trim(),tools:i1(j)});_(H);const B=I.lastIndexOf("/");B>0&&D(I.slice(0,B))}catch(I){T((I==null?void 0:I.message)||"Preview failed")}finally{A(!1)}}async function $(){A(!0),T(null);try{const I=m.trim(),H=await GL(e,{workspaceRoot:I,agentNickname:b.trim(),tools:i1(j)});q(H)}catch(I){T((I==null?void 0:I.message)||"Install failed")}finally{A(!1)}}if(z)return o.jsxs("div",{children:[o.jsxs("div",{style:{padding:"12px 14px",borderRadius:8,marginBottom:14,fontSize:12,background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.25)",color:"var(--accent-green)"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:6},children:"Workspace wired."}),"Open ",o.jsx("code",{style:{fontFamily:"var(--font-mono)"},children:m})," in ",j==="claude-code"?"Claude Code":j==="both"?"Cursor or Claude Code":"Cursor",". On the first chat, your agent will see the project ontology",l==="join"?", tasks, and decisions":" you publish via the canonical assertion-write flow","."]}),o.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginBottom:8},children:"Files written:"}),o.jsxs("pre",{style:{fontSize:10,fontFamily:"var(--font-mono)",maxHeight:200,overflow:"auto",padding:10,borderRadius:6,background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",margin:0},children:[z.written.map(I=>`${I.action.padEnd(9)} ${I.absPath} (${I.bytesWritten.toLocaleString()} bytes)`).join(`
1067
- `),z.skipped.length?`
1068
-
1069
- Skipped:
1070
- `+z.skipped.map(I=>` - ${I}`).join(`
1071
- `):"",z.warnings.length?`
1072
-
1073
- Warnings:
1074
- `+z.warnings.map(I=>` - ${I}`).join(`
1075
- `):""]}),o.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:14},children:o.jsx("button",{className:"v10-modal-btn primary",onClick:a,children:"Done"})})]});if(U)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:U.markdown}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:14,gap:10},children:[o.jsx("button",{className:"v10-modal-btn",onClick:()=>{_(null),T(null)},disabled:S,children:"← Back"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{className:"v10-modal-btn",onClick:a,disabled:S,children:"Skip for now"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:$,disabled:S,children:S?"Installing…":"Install"})]})]})]});const F=((K=Th.find(I=>I.value===j&&!I.disabled))==null?void 0:K.description)??Th[0].description;return o.jsxs("div",{children:[o.jsxs("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:14,fontSize:12,background:"rgba(59, 130, 246, 0.08)",border:"1px solid rgba(59, 130, 246, 0.25)",color:"var(--accent-primary, #3b82f6)"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:4},children:l==="create"?"Wire your local workspace":"Wire this project locally"}),l==="create"?"Choose a directory for the new project and which coding tool you want it wired for. The daemon will populate the workspace with the right config files so your agent can join the project from turn one.":"Choose a local directory for this project and which coding tool you want it wired for. The daemon will populate the workspace with the right config files so your agent can collaborate on this project."]}),E&&o.jsx("div",{className:"v10-modal-error",style:{marginBottom:12},children:E}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Workspace path"}),o.jsx("input",{className:"v10-form-input",type:"text",value:m,onChange:I=>y(I.target.value),placeholder:d?`${d.defaultWorkspaceParent}/${u}`:"/Users/you/code/project",spellCheck:!1,style:{fontFamily:"var(--font-mono)",fontSize:12}}),o.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:["Absolute path. Created if it doesn't exist. Daemon writes only inside this dir (plus optionally ",o.jsx("code",{children:"~/.claude/settings.json"})," if Claude Code is selected).",d&&o.jsxs(o.Fragment,{children:[" Defaulted from your ",o.jsx("code",{children:"$HOME"})," = ",o.jsx("code",{children:d.homedir}),"."]})]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Coding tool to wire"}),o.jsx("select",{className:"v10-form-select",value:j,onChange:I=>N(I.target.value),children:Th.map((I,H)=>o.jsx("option",{value:I.disabled?"__disabled__":I.value,disabled:I.disabled,children:I.label},`${I.label}-${H}`))}),o.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:F})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Your agent identity"}),o.jsx("input",{className:"v10-form-input",type:"text",value:h?`urn:dkg:agent:${h.agentAddress.toLowerCase()}`:"fetching…",disabled:!0,spellCheck:!1,style:{fontFamily:"var(--font-mono)",fontSize:11,opacity:.75}}),o.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:["Cryptographic URI derived from this node's wallet address. Same on every project on this machine. Attribution (",o.jsx("code",{children:"prov:wasAttributedTo"}),") on every chat turn uses this URI."]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Nickname for this agent"}),o.jsx("input",{className:"v10-form-input",type:"text",value:b,onChange:I=>k(I.target.value),placeholder:"e.g. Alice on laptop 1",spellCheck:!1,maxLength:80}),o.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:"Free-form human label rendered as the agent's name in chips, lists, and rdfs:label triples. Doesn't affect attribution — only changes how you appear to others."})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:14,gap:10},children:[s?o.jsx("button",{className:"v10-modal-btn",onClick:s,disabled:S,children:"Cancel"}):o.jsx("button",{className:"v10-modal-btn",onClick:a,disabled:S,children:"Skip for now"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:R,disabled:S||!m.trim()||!b.trim(),children:S?"Loading preview…":"Preview install"})]})]})}const s1='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex="-1"])';function Ji(e,t){const n=w.useRef(null),a=w.useRef(null);w.useEffect(()=>{if(e)return a.current=document.activeElement??null,queueMicrotask(()=>{const l=n.current;if(!l)return;const u=l.querySelector(s1),f=l.querySelector("[autofocus]")??u;f?f.focus():(l.hasAttribute("tabindex")||l.setAttribute("tabindex","-1"),l.focus())}),()=>{var l,u;(u=(l=a.current)==null?void 0:l.focus)==null||u.call(l)}},[e]),w.useEffect(()=>{if(!e)return;const l=u=>{if(u.key==="Escape"){u.stopPropagation(),t();return}if(u.key!=="Tab")return;const d=n.current;if(!d)return;const f=Array.from(d.querySelectorAll(s1)).filter(y=>y.offsetParent!==null||y===document.activeElement);if(f.length===0){u.preventDefault(),d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus();return}const h=f[0],g=f[f.length-1],m=document.activeElement;if(m===d){u.preventDefault(),(u.shiftKey?g:h).focus();return}u.shiftKey&&m===h?(u.preventDefault(),g.focus()):!u.shiftKey&&m===g&&(u.preventDefault(),h.focus())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e,t]);const s=w.useCallback(l=>{l.target===l.currentTarget&&t()},[t]);return{dialogRef:n,onBackdropClick:s}}const uo=80,ZL=/<\/?[a-z][^>]*>/i,KL=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,YL=/[a-z0-9]/i;function QL(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=QL(e);return t=t.replace(/[<>]/g,""),t=t.replace(KL,""),t=t.replace(/\s+/g," "),t=t.trim(),t.length>uo&&(t=t.slice(0,uo)),t}function o1(e){const t=QS(e);return t?YL.test(t)?ZL.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>uo?`Name was trimmed to ${uo} characters (was ${e.length}).`:null:"Name must contain at least one letter or digit.":"Enter a name with at least one letter or digit."}function l1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function XL({open:e,onClose:t}){var ut,ye;const[n,a]=w.useState(""),[s,l]=w.useState(""),[u,d]=w.useState("curated"),[f,h]=w.useState("curator-only"),[g,m]=w.useState(!1),[y,b]=w.useState("community"),k=UL(),[j,N]=w.useState(((ut=k[0])==null?void 0:ut.slug)??"coding-project"),[S,A]=w.useState(!1),[E,T]=w.useState("off"),[U,_]=w.useState("7d"),[z,q]=w.useState("100k"),[D,R]=w.useState(!1),[$,F]=w.useState(""),[K,I]=w.useState(null),[H,B]=w.useState(null),[W,Q]=w.useState(null),[V,L]=w.useState(null),[P,G]=w.useState(""),[O,ne]=w.useState(!0),[ue,le]=w.useState(!1),{setContextGraphs:be,contextGraphs:_e,setActiveProject:Ee}=Tr(),{openTab:Ie}=fn(),{setStage:We,stage:Se}=Ig(),ft=()=>{ne(!0),le(!1),Yl().then(X=>{Q(X.agentAddress),le(!1)}).catch(()=>{Q(null),le(!0)}).finally(()=>ne(!1))};w.useEffect(()=>{e&&(B(null),ft())},[e]);const De=Ji(e&&!V,t),qe=Ji(e&&!!V,()=>{L(null),G(""),B(null),a(""),l(""),t()});if(!e)return null;const ke=QS(n),lt=l1(ke),xe=W&&lt?`${W}/${lt}`:lt?`<agent-address>/${lt}`:"",Oe=n?o1(n):null,Ot=X=>{a(X)},$t=async()=>{const X=ke;if(!X||Oe)return;R(!0),I(null),B(null),F(g?"Registering context graph on the network…":"Creating context graph locally…");const Z=l1(X);if(!W){I("Agent identity is still loading. Please wait a moment and try again."),R(!1);return}const ee=`${W}/${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:W?[W]:[],register:g}:{accessPolicy:he,publishPolicy:Le,register:g},Ce=await h_(ee,X,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),B(Ne)}if(y==="community"||y==="agent")try{F(`Installing '${j}' ontology…`),await FL(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 HL(Ce.created,{})}catch(Ne){Fe=!1,console.warn("[CreateProjectModal] manifest publish failed:",Ne),F(`Context graph created, but manifest publish failed: ${(Ne==null?void 0:Ne.message)??Ne}`)}F("Refreshing context graph list…");const{contextGraphs:et}=await Ld();be(et??[]),Ee(Ce.created),Ie({id:`project:${Ce.created}`,label:X,closable:!0}),Se<2&&We(2),Fe?(G(X),L(Ce.created),F("")):setTimeout(()=>{a(""),l(""),F(""),t()},2500)}catch(ce){const he=(ce==null?void 0:ce.message)||"Failed to create context graph";he.includes("already exists")||he.includes("409")?I("A context graph with this ID already exists. Try a different name."):(he.includes("taking longer"),I(he)),F("")}finally{R(!1)}},Yt=_e.length===0;function qt(){L(null),G(""),B(null),a(""),l(""),t()}return V?o.jsx("div",{className:"v10-modal-overlay",onClick:qe.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:qe.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-wire-modal-title",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:qt,"aria-label":"Close wire workspace dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsxs("div",{id:"dkg-wire-modal-title",className:"v10-modal-title",children:["Wire workspace for ",P]}),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:[H&&o.jsx("div",{className:"v10-modal-warning",children:H}),o.jsx(YS,{contextGraphId:V,projectName:P,variant:"create",onDone:qt})]})]})}):o.jsx("div",{className:"v10-modal-overlay",onClick:De.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:De.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-create-cg-title","aria-describedby":"dkg-create-cg-subtitle",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close create context graph dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-create-cg-title",className:"v10-modal-title",children:"Create New Context Graph"}),o.jsx("div",{id:"dkg-create-cg-subtitle",className:"v10-modal-subtitle",children:"A context graph gives your agent structured memory — a place to draft, share, and publish knowledge."})]}),o.jsxs("div",{className:"v10-modal-body",children:[K&&o.jsx("div",{className:"v10-modal-error",children:K}),H&&o.jsx("div",{className:"v10-modal-warning",children:H}),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:X=>Ot(X.target.value),autoFocus:!0,maxLength:uo,"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}/${uo} 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:X=>l(X.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:X=>m(X.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:X=>N(X.target.value),children:k.map(X=>o.jsx("option",{value:X.slug,children:X.displayName},X.slug))}),o.jsx("div",{style:{marginTop:6,fontSize:11,color:"var(--text-tertiary)"},children:(ye=k.find(X=>X.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:()=>A(!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:U,disabled:!0,children:[o.jsx("option",{value:"7d",children:"7 days (default)"}),o.jsx("option",{value:"1h",children:"1 hour"}),o.jsx("option",{value:"1d",children:"1 day"}),o.jsx("option",{value:"30d",children:"30 days"})]})]}),o.jsxs("div",{className:"v10-form-group",style:{marginBottom:0},children:[o.jsxs("label",{className:"v10-form-label",children:["SWM Size Cap ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("select",{className:"v10-form-select",value:z,disabled:!0,children:[o.jsx("option",{value:"100k",children:"100K triples (default)"}),o.jsx("option",{value:"10k",children:"10K triples"}),o.jsx("option",{value:"1m",children:"1M triples"})]})]})]})]}),o.jsxs("div",{className:"v10-modal-footer",children:[o.jsx("button",{className:"v10-modal-btn",onClick:t,children:"Cancel"}),ue&&o.jsx("button",{className:"v10-modal-btn",onClick:ft,disabled:O,children:O?"Retrying…":"Retry Loading Agent"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:$t,disabled:!n.trim()||!!o1(n)||D||!W||O,children:D?$||"Creating…":W?"Create Context Graph":ue?"Agent unavailable":"Loading agent…"})]})]})})}function Bg(e){return{agentDid:e.agentDid,peerId:e.peerId}}function es(e){if(!(e!=null&&e.trim()))return"unknown";const t=e.trim().replace(/^["']|["']$/g,"").toLowerCase();return t==="private"?"private":t==="public"?"public":"unknown"}function Jt(e){let t=e.trim().replace(/^["']|["']$/g,"");t.startsWith("<")&&t.endsWith(">")&&(t=t.slice(1,-1));const n="did:dkg:agent:";if(t.length>=n.length&&t.slice(0,n.length).toLowerCase()===n.toLowerCase()){const s=t.slice(n.length),l=/^(0x[a-fA-F0-9]{40})$/i.exec(s);return l?`${n}${l[1].toLowerCase()}`:`${n}${s}`}return/^0x[a-fA-F0-9]{40}$/.exec(t)?`${n}${t.toLowerCase()}`:t.toLowerCase()}function $d(e,t){var n,a;return e.callerInvolved===!0?!0:e.callerInvolved===!1||!((n=t==null?void 0:t.agentDid)!=null&&n.trim())?!1:!!((a=e.curator)!=null&&a.trim()&&Jt(e.curator)===Jt(t.agentDid))}function JL(e,t,n){const a=e.filter(s=>$d(s,t));if(n&&!a.some(s=>s.id===n)){const s=e.find(l=>l.id===n);if(s)return[s,...a]}return a}function e4(e,t){return!($d(e,t)||es(e.accessPolicy)!=="public")}function t4(e){return e.subscribed===!0||e.synced===!0?"project":"catalogue"}function n4(e){return e.alreadyMember===!0||e.autoApproved===!0||e.status==="approved"||e.status==="already-member"}const c1=/^(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|12D3Koo[1-9A-HJ-NP-Za-km-z]{45,53})$/;function r4(e){var b;const t=e.trim().replace(/\\n/g,`
1076
- `),n=t.split(`
1077
- `).map(k=>k.trim()).filter(Boolean),a=n[0]??"",s=n.slice(1).join(" ").trim(),l=t.match(/(?:^|\s)(\/(?:ip4|ip6|dns|dns4|dns6|dnsaddr)\/\S+)/),u=((b=l==null?void 0:l[1])==null?void 0:b.replace(/\s+/g,""))??null,d=s.replace(/\s+/g,""),f=d.startsWith("/")?d:u;let h=null;if(f){const k=f.match(/\/p2p\/([^/]+)$/);k&&c1.test(k[1])&&(h=k[1])}else for(const k of[s,...n.slice(1)]){const j=k.trim();if(c1.test(j)){h=j;break}}let g=a;u&&g.includes(u)&&(g=g.replace(u,"")),g=g.replace(/\s*@\s*$/,"").trim();const y=(n.length>1||s.length>0)&&h===null&&f===null;return{cgId:g,curatorPeerId:h,legacyMultiaddr:f,hasUnparsedExtra:y}}function a4(e,t){return!e.hasUnparsedExtra&&t.some(n=>n.id===e.cgId&&es(n.accessPolicy)==="public")}function u1(e,t){const n=r4(e);return a4(n,t)?{kind:"publicSubscribe",invite:n,validationError:p1(n,{allowBareContextGraphId:!0}),idleLabel:"Subscribe",sendingLabel:"Subscribing…"}:{kind:"privateJoin",invite:n,validationError:p1(n),idleLabel:"Request to Join",sendingLabel:"Sending request…"}}async function d1(e){if(e.curatorPeerId){await u_(e.curatorPeerId).catch(()=>{});return}e.legacyMultiaddr&&(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 c_(e.legacyMultiaddr).catch(()=>{}))}function p1(e,t={}){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&&!t.allowBareContextGraphId)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 i4(e){if(e instanceof $n&&e.status===502){const t=s4(e.body);if(t.length===0)return"Request signed, but we couldn't deliver it to any reachable curator. Try again in a moment once your node has discovered more peers, or ask the curator for an updated invite.";const n=t.join("; "),a=t.some(o4),s=a?"Curator rejected this join request.":"Couldn't deliver this join request to the curator.",l=l4(n,a);return l?`${s} Reason: ${n}. ${l}`:`${s} Reason: ${n}.`}return e instanceof Error&&e.message?e.message:"Failed to send join request"}function s4(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 o4(e){const t=e.replace(/^[^:]+:\s*/,"").trim();return!(!t||/^dial failed\b/i.test(t)||/^not curator$/i.test(t))}function l4(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 c4({open:e,onClose:t,initialContextGraphId:n}){const[a,s]=w.useState(n??""),[l,u]=w.useState("idle"),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(null),[b,k]=w.useState(""),{contextGraphs:j,setContextGraphs:N,setActiveProject:S}=Tr(),{openTab:A}=fn();w.useEffect(()=>{n&&s(n)},[n]),w.useEffect(()=>{e||(s(n??""),f(null),u("idle"),g(null))},[e,n]);const E=w.useCallback(B=>{S(B.id),A({id:`project:${B.id}`,label:B.name||B.id,closable:!0})},[S,A]),T=w.useCallback(async(B,W)=>{const{contextGraphs:Q}=await Ld(),V=Q??[];N(V);const L=V.find(P=>P.id===B)??W;return L&&E(L),L},[N,E]),U=w.useCallback(async B=>{u("approved");try{const W=await T(B);W&&(k(W.name??B),y(B))}catch{}},[T]),_=w.useCallback(B=>{var Q;if(!(!h||B.type!=="join_approved"&&B.type!=="join_rejected"||((Q=B.data)==null?void 0:Q.contextGraphId)!==h)){if(B.type==="join_rejected"){u("rejected");return}U(h)}},[h,U]);ss(_);const z=Ji(e&&!m,t),q=Ji(e&&!!m,()=>{y(null),k(""),t()});if(!e)return null;const D=async()=>{const B=u1(a,j);if(B.validationError){f(B.validationError);return}const{cgId:W,curatorPeerId:Q}=B.invite;if(f(null),B.kind==="publicSubscribe"){u("sending");try{const L=j.find(P=>P.id===W);await d1(B.invite),await eR(W),await T(W,L),t()}catch(L){f(L instanceof Error?L.message:"Could not subscribe to this public context graph."),u("idle")}return}const V=j.find(L=>L.id===W);if(V){E(V),t();return}u("sending");try{await d1(B.invite);const L=await g_(W),P=await Yl().then(O=>O.name).catch(()=>{}),G=await v_(W,{delegation:L.delegation,agentName:P,curatorPeerId:Q??void 0});if(g(W),n4(G)){await U(W);return}u("pending")}catch(L){f(i4(L)),u("idle")}};function R(){y(null),k(""),t()}if(m)return o.jsx("div",{className:"v10-modal-overlay",onClick:q.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:q.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-join-wire-title",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:R,"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(YS,{contextGraphId:m,projectName:b,variant:"join",onDone:R})})]})});const $=l==="sending",F=l==="pending",K=l==="approved",I=l==="rejected",H=u1(a,j);return o.jsx("div",{className:"v10-modal-overlay",onClick:z.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:z.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:"Enter a discovered public Context Graph ID to subscribe, or paste a curator invite for a private graph."})]}),o.jsxs("div",{className:"v10-modal-body",children:[d&&o.jsx("div",{className:"v10-modal-error",children:d}),F&&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."}),K&&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…"}),I&&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:"Context Graph ID or Invite Code"}),o.jsx("textarea",{id:"dkg-cg-invite",name:"dkg-cg-invite",className:"v10-form-textarea",placeholder:`Public: paste a Context Graph ID
1078
-
1079
- Private: paste the curator invite
1080
- my-context-graph-abc123
1081
- 12D3KooW...`,value:a,onChange:B=>s(B.target.value),autoFocus:!0,rows:3,disabled:$||F||K,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:F||K?"Close":"Cancel"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:D,disabled:!a.trim()||$||F||K,children:$?H.sendingLabel:F?"Awaiting approval…":K?"Approved":H.idleLabel})]})]})})}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 Fg(){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)},[]),a=w.useCallback(()=>{f1(new Set)},[]);return{hidden:e,hide:n,unhideAll:a}}function h1({cg:e,isActive:t,onSelect:n,onHide:a}){return o.jsx("div",{className:"v10-tree-section",children:o.jsxs("div",{className:`v10-tree-section-header ${t?"active":""}`,onClick:n,children:[o.jsx("span",{className:"v10-tree-project-dot"}),o.jsx("span",{className:"v10-tree-section-label",children:e.name||e.id.slice(0,16)}),o.jsx("button",{type:"button",className:"v10-tree-hide-btn",title:"Hide this context graph from the sidebar (reversible)",onClick:s=>{s.stopPropagation(),a()},children:"×"})]})})}function u4({cg:e,isBrowsing:t,onBrowse:n,onSubscribe:a,onHide:s}){const l=e.name||e.id.slice(0,16);return o.jsx("div",{className:"v10-tree-section",children:o.jsxs("div",{className:`v10-tree-section-header catalogue ${t?"active":""}`,children:[o.jsx("span",{className:"v10-tree-project-dot"}),o.jsx("span",{className:"v10-tree-section-label",children:l}),o.jsx("button",{type:"button",className:"v10-tree-catalogue-btn","aria-label":`Browse ${l}`,onClick:n,children:"Browse"}),o.jsx("button",{type:"button",className:"v10-tree-catalogue-btn primary","aria-label":`Subscribe to ${l}`,onClick:a,children:"Subscribe"}),o.jsx("button",{type:"button",className:"v10-tree-hide-btn",title:"Hide this context graph from the sidebar (reversible)",onClick:s,children:"×"})]})})}function d4(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 p4(){const[e,t]=w.useState([]),[n,a]=w.useState(null),s=w.useCallback(()=>{Dd().then(l=>{t(l.integrations),a(null)}).catch(l=>a(l.message))},[]);return Xl(s,3e4),o.jsxs("div",{className:"v10-tree-items",style:{display:"block"},children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:.5,padding:"6px 12px 2px 24px"},children:"Agents"}),n&&o.jsx("div",{style:{fontSize:11,color:"var(--accent-orange, #f97316)",padding:"4px 12px 4px 24px"},children:n}),!n&&e.length===0&&o.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 12px 4px 24px",fontStyle:"italic"},children:"No agents detected."}),e.map(l=>o.jsxs("div",{className:"v10-tree-item",title:l.detail,style:{cursor:"default"},children:[o.jsx("span",{"aria-label":l.statusLabel,style:{width:7,height:7,borderRadius:"50%",background:d4(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 f4(){const e=Vn(V=>V.leftSectionMyProjectsOpen),t=Vn(V=>V.leftSectionIntegrationsOpen),n=Vn(V=>V.toggleLeftSectionMyProjects),a=Vn(V=>V.toggleLeftSectionIntegrations),s=w.useId(),l=w.useId(),{openTab:u,activeTabId:d,setActiveTab:f}=fn(),{contextGraphs:h,setContextGraphs:g,setLoading:m,activeProjectId:y,setActiveProject:b}=Tr(),k=Ig(V=>V.stage),[j,N]=w.useState("explorer"),{hidden:S,hide:A,unhideAll:E}=Fg(),T=zd().data,U=T?Bg(T):null,_=h.filter(V=>!S.has(V.id)),z=_.filter(V=>$d(V,U)),q=_.filter(V=>e4(V,U)),D=h.length-_.length,[R,$]=w.useState(!1),[F,K]=w.useState(!1),[I,H]=w.useState(),B=w.useCallback(V=>{H(V),K(!0)},[]),W=w.useCallback(()=>{K(!1),H(void 0)},[]),Q=w.useCallback(()=>{m(!0),Tn.fetchContextGraphs().then(({contextGraphs:V})=>g(V??[])).catch(()=>{}).finally(()=>m(!1))},[g,m]);return Xl(Q,6e4),ss(w.useCallback(V=>{(V.type==="join_approved"||V.type==="project_synced")&&Q()},[Q])),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:()=>$(!0),children:"+ New Context Graph"}),o.jsx("button",{className:"v10-new-project-btn",onClick:()=>B(),children:"↗ Join Context Graph"})]}),o.jsxs("div",{className:"v10-tree-header",children:[o.jsx("button",{className:`v10-tree-mode-btn ${j==="explorer"?"active":""}`,onClick:()=>N("explorer"),children:"Context Graphs"}),o.jsx("button",{className:`v10-tree-mode-btn ${j==="oracle"?"active":""}`,onClick:()=>N("oracle"),children:"Context Oracle"})]}),j==="explorer"&&o.jsxs("div",{className:"v10-tree-content",children:[o.jsxs("div",{className:`v10-tree-dashboard ${d==="dashboard"?"active":""}`,onClick:()=>{f("dashboard"),b(null)},children:[o.jsx("span",{children:"▦"})," Dashboard"]}),h.length===0&&k<=1&&o.jsxs("div",{className:"v10-journey-empty-card",children:[o.jsx("div",{className:"v10-jec-title",children:"No context graphs yet"}),o.jsx("div",{className:"v10-jec-hint",children:k===0?"Connect an agent to get started.":"Create your first context graph to give your agent structured memory."}),k===1&&o.jsx("button",{className:"v10-new-project-btn",style:{margin:0},onClick:()=>$(!0),children:"+ Create First Context Graph"})]}),(h.length>0||k>=2)&&o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header","aria-expanded":e,"aria-controls":s,onClick:n,children:[o.jsx(Cm,{size:14,className:`v10-peer-group-chevron ${e?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:"My Context Graphs"})]}),e&&o.jsx("div",{id:s,className:"v10-peer-group-body",children:z.length===0?o.jsx("div",{className:"v10-tree-item",style:{cursor:"default",color:"var(--text-tertiary)",fontStyle:"italic"},children:o.jsx("span",{className:"v10-tree-item-label",children:"No context graphs in this view yet."})}):z.map(V=>o.jsx(h1,{cg:V,isActive:y===V.id,onSelect:()=>{b(V.id),u({id:`project:${V.id}`,label:V.name||V.id.slice(0,16),closable:!0})},onHide:()=>{A(V.id),y===V.id&&b(null)}},V.id))})]}),D>0&&o.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:E,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",D," hidden context graph",D!==1?"s":""]}),k>=1&&o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header","aria-expanded":t,"aria-controls":l,onClick:a,children:[o.jsx(Cm,{size:14,className:`v10-peer-group-chevron ${t?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:"Integrations"})]}),t&&o.jsx("div",{id:l,className:"v10-peer-group-body",children:o.jsx(p4,{})})]})]}),j==="oracle"&&o.jsxs("div",{className:"v10-tree-content",children:[q.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-tree-group-label",children:"Context Oracle"}),q.map(V=>{const L=()=>{A(V.id),y===V.id&&b(null)};return t4(V)==="catalogue"?o.jsx(u4,{cg:V,isBrowsing:d===`project:${V.id}`,onBrowse:()=>{b(null),u({id:`project:${V.id}`,label:V.name||V.id.slice(0,16),closable:!0})},onSubscribe:()=>B(V.id),onHide:L},V.id):o.jsx(h1,{cg:V,isActive:y===V.id,onSelect:()=>{b(V.id),u({id:`project:${V.id}`,label:V.name||V.id.slice(0,16),closable:!0})},onHide:L},V.id)})]}),q.length===0&&o.jsxs("p",{style:{fontSize:12,color:"var(--text-tertiary)",padding:"20px 12px",textAlign:"center",lineHeight:1.5},children:["No discovered public Context Graphs yet. Public graphs appear here as soon as your node discovers them; use ",o.jsx("strong",{children:"Join Context Graph"})," to subscribe by ID."]}),D>0&&o.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:E,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",D," hidden context graph",D!==1?"s":""]})]}),o.jsx(XL,{open:R,onClose:()=>$(!1)}),o.jsx(c4,{open:F,onClose:W,initialContextGraphId:I})]})}function lr(e,t=[],n=0){const[a,s]=w.useState(null),[l,u]=w.useState(!0),[d,f]=w.useState(null),h=w.useRef(!0),g=w.useCallback(async()=>{try{const m=await e();h.current&&(s(m),f(null))}catch(m){if(h.current){if((m==null?void 0:m.status)===401){const y=!!window.__DKG_TOKEN__,b=sessionStorage.getItem("__dkg_401_reloaded")==="1";if(y&&!b){sessionStorage.setItem("__dkg_401_reloaded","1"),window.location.reload();return}f("Authentication expired — please refresh the page.");return}f(m.message)}}finally{h.current&&u(!1)}},t);return w.useEffect(()=>{h.current=!0,u(!0),g();let m=null;const y=()=>{n<=0||m||(m=setInterval(g,n))},b=()=>{m&&(clearInterval(m),m=null)},k=()=>{typeof document>"u"||(document.hidden?b():(g(),y()))};return(typeof document>"u"||!document.hidden)&&y(),typeof document<"u"&&document.addEventListener("visibilitychange",k),()=>{h.current=!1,b(),typeof document<"u"&&document.removeEventListener("visibilitychange",k)}},[g,n]),{data:a,loading:l,error:d,refresh:g}}function lV(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 h4(e,t=new Date){if(e==null||e==="")return"—";const n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return"—";if(n.toDateString()===t.toDateString())return n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"});const a=new Date(t);if(a.setDate(t.getDate()-1),n.toDateString()===a.toDateString())return`Yesterday ${n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`;const s=t.getTime()-n.getTime();return s>=0&&s<10080*60*1e3?`${n.toLocaleDateString(void 0,{weekday:"short"})} ${n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:n.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function g1(e,t=8){return e?e.length<=t*2?e:e.slice(0,t)+"..."+e.slice(-4):"—"}function m4(){const e=Tr(m=>m.contextGraphs),t=Tr(m=>m.setContextGraphs),{hidden:n}=Fg(),[a,s]=w.useState(null),[l,u]=w.useState(!0),[d,f]=w.useState(()=>e.length===0),h=w.useCallback(()=>{Tn.fetchContextGraphs().then(({contextGraphs:m})=>t(m??[])).catch(()=>{}).finally(()=>f(!1))},[t]);return w.useEffect(()=>{h();const m=setInterval(h,6e4);return()=>clearInterval(m)},[h]),ss(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),Tn.fetchCurrentAgent().then(y=>{m&&s(Bg(y))}).catch(()=>{}).finally(()=>{m&&u(!1)}),()=>{m=!1}},[e]),{myCgs:w.useMemo(()=>e.filter(m=>!n.has(m.id)).filter(m=>$d(m,a)),[e,n,a]),identity:a,identityLoading:l,cgsLoading:d}}const Hg=["http://schema.org/name","http://www.w3.org/2000/01/rdf-schema#label","http://purl.org/dc/terms/title","http://purl.org/dc/elements/1.1/title","http://xmlns.com/foaf/0.1/name"];function Id(e={}){const t={predicates:[...e.extraPredicates??[],...Hg]};return e.minZoomForLabels!==void 0&&(t.minZoomForLabels=e.minZoomForLabels),t}function Pd(e){if(!e)return"";const t=e.match(/^"([\s\S]*)"(?:\^\^<[^>]+>)?(?:@[A-Za-z0-9-]+)?$/);if(!t)return e;try{return JSON.parse(`"${t[1]}"`)}catch{return t[1]}}const 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 Yu(e){const t=bt(e);return!t||t.startsWith('"')||/\s/.test(t)?!1:t.startsWith("_:")?!0:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function bt(e){const t=e.trim();return t.startsWith('"')?t:t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function ao(e){if(!e)return"—";if(e.startsWith('"'))return Pd(e);const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),a=Math.max(t,n);return a>=0?e.slice(a+1):e}function qg(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),a=e.lastIndexOf(":"),s=Math.max(t,n,a),l=s>=0?e.slice(s+1):e;try{return decodeURIComponent(l)}catch{return l}}function g4(e){const t=qg(e).trim();return t?(/^[0-9a-f-]{16,}$/i.test(t)?t.replace(/-/g,"").slice(0,12):t).replace(/[_-]+/g," ").trim():""}function v4(e,t){return e===t&&/^urn:dkg:extraction:[^\s]+$/i.test(t)}function y4(e,t){return e===t&&Yu(t)}function b4(e){const t=g4(e.uri),n=e.types.map(ao).find(a=>a&&a!=="Thing"&&a!=="Entity");return/^urn:dkg:extraction:[^\s]+$/i.test(e.uri)?t?`Extraction ${t}`:"Extraction":n?t&&t!==n?`${n} ${t}`:n:t||ao(e.uri)}function x4(e){for(const n of Hg){const a=e.properties.get(n),s=a==null?void 0:a.find(l=>l.trim().length>0);if(s)return s}const t=ao(e.uri);return e.label&&(e.label!==t||!y4(e.label,e.uri))&&!v4(e.label,e.uri)?e.label:b4(e)}const JS=5e4,ej=2e4,tj=2e4;function w4(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 k4(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 S4(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 j4(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const a=e.slice(n.length),s=a.indexOf("/"),l=s>=0?a.slice(0,s):a;if(!(!l||l.startsWith("_")||l==="assertion"||l==="meta"))return l}const y1={wm:"loading",swm:"loading",vm:"loading"},C4={wm:"error",swm:"error",vm:"error"};async function Rh(e,t,n){var a,s;try{const{layerLimit:l,...u}=n??{},d={sparql:e,contextGraphId:t,...u},f=await ld(d),h=((a=f==null?void 0:f.result)==null?void 0:a.bindings)??((s=f==null?void 0:f.results)==null?void 0:s.bindings)??[],g=typeof l=="number"&&h.length>=l;return{triples:h.map(y=>{const b=Eu(y.g);return{subject:Eu(y.s)??"",predicate:Eu(y.p)??"",object:Eu(y.o)??"",subGraph:b?j4(b,t):void 0}}).filter(y=>y.subject&&y.predicate&&y.object),ok:!0,truncated:g}}catch{return{triples:[],ok:!1,truncated:!1}}}function N4(e){var f;const t=new Map,n=new Map,a=new Map,s=new Map,l=new Map;function u(h,g,m){let y=s.get(h);y||(y=new Map,s.set(h,y));let b=y.get(g);if(b||(b=new Set,y.set(g,b)),b.has(m))return!1;b.add(m);let k=l.get(h);return k||(k={working:0,shared:0,verified:0},l.set(h,k)),k[g]++,!0}function d(h){const g=bt(h);let m=t.get(g);return m||(m={uri:g,label: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=bt(h.object);g.types.includes(m)||g.types.push(m)}else if(Yu(h.object)){const m=bt(h.object),y=d(m);y.layers.add(h.layer),h.subGraph&&y.subGraphs.add(h.subGraph);const b=n.get(g.uri)??new Set,k=`${h.predicate}\0${m}`;b.has(k)||(b.add(k),n.set(g.uri,b),g.connections.push({predicate:h.predicate,targetUri:m,targetLabel:ao(m)}))}else{const m=a.get(g.uri)??new Set,y=`${h.predicate}\0${h.object}`;if(!m.has(y)){m.add(y),a.set(g.uri,m);const b=g.properties.get(h.predicate)??[];b.push(Pd(h.object)),g.properties.set(h.predicate,b)}}}for(const h of t.values())h.label=x4(h),h.layers.has("verified")?h.trustLevel="verified":h.layers.has("shared")?h.trustLevel="shared":h.trustLevel="working";for(const h of e){const g=bt(h.subject),m=t.get(g);if(m&&m.trustLevel!==h.layer)continue;const y=Yu(h.object)?bt(h.object):h.object,b=Yu(h.object);if(b){const j=t.get(y);if(j&&j.trustLevel!==h.layer)continue}const k=`${g}\0${h.predicate}\0${y}`;if(m&&u(m.uri,h.layer,k),h.predicate===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=N4;function rj(e){return e.types.length>0||e.properties.size>0||e.connections.length>0}function Gg(e,t){const n=(t==null?void 0:t.signalErrors)??!1,[a,s]=w.useState([]),[l,u]=w.useState(!0),[d,f]=w.useState(null),[h,g]=w.useState(!1),[m,y]=w.useState(y1),b=w.useRef(0),k=w.useCallback(async()=>{if(!e)return;const T=++b.current;u(!0),f(null),g(!1),y(y1);try{const U={includeContextGraphPartitions:!0},[_,z,q]=await Promise.all([Rh(w4(e),e,{...U,layerLimit:JS}),Rh(k4(e),e,{...U,layerLimit:ej}),Rh(S4(e),e,{...U,layerLimit:tj})]);if(T!==b.current)return;const D=[..._.triples.map(K=>({...K,layer:"working"})),...z.triples.map(K=>({...K,layer:"shared"})),...q.triples.map(K=>({...K,layer:"verified"}))];s(D),y({wm:_.ok?"ok":"error",swm:z.ok?"ok":"error",vm:q.ok?"ok":"error"});const R=[_,z,q],$=R.filter(K=>!K.ok).length,F=R.some(K=>K.truncated);g($>0&&$<3||F),f(n&&$===3?"Failed to load memory data":null)}catch(U){T===b.current&&(f(U.message??"Failed to load memory data"),y(C4))}finally{T===b.current&&u(!1)}},[e,n]);xo(e,k),w.useEffect(()=>{k()},[k]);const j=w.useMemo(()=>nj(a),[a]),N=w.useMemo(()=>[...j.values()].filter(rj).sort((T,U)=>{const _={verified:0,shared:1,working:2},z=_[T.trustLevel]-_[U.trustLevel];if(z!==0)return z;const q=T.tripleCount??0,D=U.tripleCount??0;return D!==q?D-q:T.label.localeCompare(U.label)}),[j]),S=w.useMemo(()=>{const T=new Set;return a.filter(U=>{const _=`${U.subject}|${U.predicate}|${U.object}`;return T.has(_)?!1:(T.add(_),!0)}).map(({subject:U,predicate:_,object:z,subGraph:q})=>({subject:U,predicate:_,object:z,subGraph:q}))},[a]),A=w.useMemo(()=>{const T=new Map;for(const[U,_]of j)T.set(U,_.trustLevel);return T},[j]),E=w.useMemo(()=>{let T=0,U=0,_=0;for(const z of N)z.trustLevel==="verified"?_++:z.trustLevel==="shared"?U++:T++;return{wm:T,swm:U,vm:_,total:N.length}},[N]);return{entities:j,entityList:N,allTriples:a,graphTriples:S,trustMap:A,counts:E,loading:l,error:d,partial:h,layerStatus:m,refresh:k}}const Jl="http://dkg.io/viz/",aj=`${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 E4(e){const t=e.opId.slice(0,10);try{const a=new Date(e.publishedAt).toISOString().slice(11,16);return`anchor ${t} · ${a}UTC`}catch{return`anchor ${t}`}}function A4(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 T4(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 _4(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const a=e.slice(n.length),s=a.indexOf("/");if(s<0)return;const l=a.slice(0,s);if(!(!l||l.startsWith("_")))return l}function R4(e){const t=e.lastIndexOf(":");return t>=0?e.slice(t+1):e}function O4(e,t){const n=[],a=new Set;for(const s of e){const l=t?s.roots.filter(d=>t.has(d)):s.roots;if(l.length===0)continue;const u=`urn:dkg:viz:anchor:${s.opId}`;n.push({subject:u,predicate:b1,object:aj,subGraph:s.subGraph}),n.push({subject:u,predicate:x1,object:`"${E4(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}),a.has(h)||(a.add(h),n.push({subject:h,predicate:b1,object:ij,subGraph:s.subGraph}),n.push({subject:h,predicate:x1,object:`"${A4(f)}"`,subGraph:s.subGraph}),n.push({subject:h,predicate:w1,object:`"${f}"`,subGraph:s.subGraph}))}}return n}function L4(e,t){const[n,a]=w.useState([]),[s,l]=w.useState(!1),[u,d]=w.useState(null),f=w.useRef(0);w.useEffect(()=>{if(!e){a([]),l(!1);return}const y=++f.current;l(!0),d(null),(async()=>{var b;try{const k=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify({sparql:T4(e)})});if(!k.ok)throw new Error(`SPARQL query failed: ${k.status}`);const j=await k.json(),N=((b=j==null?void 0:j.result)==null?void 0:b.bindings)??[],S=new Map;for(const A of N){const E=gl(A.op),T=gl(A.root),U=gl(A.agent),_=gl(A.publishedAt),z=gl(A.g);if(!E||!T||!U||!_)continue;let q=S.get(E);q||(q={opId:R4(E),opUri:E,agents:[],roots:[],publishedAt:_,subGraph:z?_4(z,e):void 0},S.set(E,q)),q.roots.includes(T)||q.roots.push(T),q.agents.includes(U)||q.agents.push(U)}if(y!==f.current)return;a([...S.values()].sort((A,E)=>E.publishedAt.localeCompare(A.publishedAt)))}catch(k){if(y!==f.current)return;d((k==null?void 0:k.message)??"Failed to load anchors"),a([])}finally{y===f.current&&l(!1)}})()},[e]);const h=w.useMemo(()=>{if(!t)return null;const y=[];if(t instanceof Set)for(const b of t)y.push(b);else for(const b of t)y.push(b);return y.sort(),y.join("|")},[t]),g=w.useMemo(()=>h==null?null:new Set(h.length===0?[]:h.split("|")),[h]),m=w.useMemo(()=>O4(n,g),[n,g]);return{anchors:n,decorationTriples:m,loading:s,error:u}}function M4(e){return e.activeSubGraph?!1:e.activeLayer==="swm"}const Yi={verified:"#22c55e",shared:"#f59e0b",working:"#64748b"},Ws={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"}},D4="http://www.w3.org/ns/prov#wasAttributedTo",wo="http://dkg.io/ontology/agent/",z4=wo+"createdBy",$4=wo+"promotedBy",I4=wo+"publishedBy",P4=wo+"createdAt",U4=wo+"promotedAt",B4=wo+"publishedAt";function Ud(e){for(const t of e.connections)if(t.predicate===D4)return t.targetUri;return null}function F4(e,t){const n=t==="created"?z4:t==="promoted"?$4:I4;for(const a of e.connections)if(a.predicate===n)return a.targetUri;return Ud(e)}function H4(e,t){const n=t==="created"?P4:t==="promoted"?U4:B4,a=e.properties.get(n);return(a==null?void 0:a[0])??null}function k1(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),a=Math.max(t,n);return a>=0?e.slice(a+1):e}function Zs(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),a=Math.max(t,n);return(a>=0?e.slice(a+1):e).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ")}function Bd(e,t){var s,l;if(t)for(const u of e.types){const d=t.forType(u),f=k1(u),h=d.label??f;if(d.icon||d.color||d.label)return{icon:d.icon??((s=Ws[f])==null?void 0:s.icon)??Ws.Thing.icon,group:d.label??((l=Ws[f])==null?void 0:l.group)??Ws.Thing.group,color:d.color,type:h}}const n=e.types[0]?k1(e.types[0]):"Entity";return{...Ws[n]??Ws.Thing,type:n}}const zn={wm:{icon:"◇",color:"#64748b",title:"Working Memory",desc:"Private agent scratchpad — ephemeral, fast local storage",trustLabel:"Working",trustLevel:"working"},swm:{icon:"◈",color:"#f59e0b",title:"Shared Working Memory",desc:"Team workspace — shared proposals, TTL-bounded",trustLabel:"Shared",trustLevel:"shared"},vm:{icon:"◉",color:"#22c55e",title:"Verifiable Memory",desc:"Endorsed, published, on-chain knowledge",trustLabel:"Verifiable",trustLevel:"verified"}};function ia(e,t=2){const n=e==="working"?"wm":e==="shared"?"swm":e==="verified"?"vm":e,a=t!==1;return n==="vm"?a?"Knowledge Assets":"Knowledge Asset":a?"Entities":"Entity"}const Gn="http://dkg.io/ontology/code/",cj={[Gn+"Package"]:"#a855f7",[Gn+"File"]:"#3b82f6",[Gn+"Class"]:"#22c55e",[Gn+"Interface"]:"#06b6d4",[Gn+"Function"]:"#f59e0b",[Gn+"TypeAlias"]:"#ec4899",[Gn+"Enum"]:"#ef4444",[Gn+"ExternalModule"]:"#64748b",[aj]:"#f5a524",[ij]:"#c084fc"},uj={[Gn+"imports"]:"#60a5fa",[Gn+"contains"]:"#a855f7",[Gn+"definedIn"]:"#3b82f6",[Gn+"exports"]:"#f59e0b",[Gn+"extends"]:"#22c55e",[Gn+"implements"]:"#06b6d4",[sj]:"#f5a524",[oj]:"#c084fc",[lj]:"#22c55e"};function Vg(e){return{"https://schema.org/":e,"http://www.w3.org/ns/prov#":e,"http://xmlns.com/foaf/0.1/":e,"http://purl.org/dc/terms/":e}}function q4(e,t){const{color:n}=zn[e],a=e==="vm";return{labelMode:"humanized",renderer:"2d",labels:Id({minZoomForLabels:a?.2:.3}),style:{classColors:cj,predicateColors:uj,namespaceColors:Vg(n),...t&&Object.keys(t).length>0?{nodeColors:t}:{},defaultNodeColor:n,defaultEdgeColor:a?"#4ade80":"#64748b",edgeWidth:a?1.8:1.2,fontSize:a?12:11,gradient:!0,gradientIntensity:a?.65:.4},hexagon:{baseSize:a?13:11,minSize:a?8:7,maxSize:a?42:28,scaleWithDegree:!0},focus:{maxNodes:3e3,hops:999}}}function G4(e){const t=["http://schema.org/description","http://schema.org/text"];for(const n of t){const a=e.properties.get(n);if(a!=null&&a[0])return a[0]}return null}function V4(e,t,n=2){const a=d=>bt(d.subject),s=d=>bt(d.object),l=new Set([e]);let u=new Set([e]);for(let d=0;d<n;d++){const f=new Set;for(const h of t){const g=a(h),m=s(h);u.has(g)&&!l.has(m)&&f.add(m),u.has(m)&&!l.has(g)&&f.add(g)}for(const h of f)l.add(h);if(u=f,u.size===0)break}return t.filter(d=>l.has(a(d))&&l.has(s(d)))}function dj(e,t){const n=t.lastIndexOf("/"),a=t.lastIndexOf("#"),s=t.lastIndexOf(":"),l=Math.max(n,a,s),u=l>=0?t.slice(l+1):t,d=(()=>{try{return decodeURIComponent(u)}catch{return u}})();if(/^urn:dkg:extraction:[^\s]+$/i.test(t)){const f=d.replace(/-/g,"").replace(/_+/g," ").slice(0,12).trim();return f?`Extraction ${f}`:"Extraction"}return d||t}function Wg(e){const t=e.trim();return!t||t.startsWith('"')?!1:t.startsWith("_:")||t.startsWith("<")&&t.endsWith(">")?!0:/\s/.test(t)?!1:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function Tm(e,t){return!t.isRoot&&e.subGraph===t.slug?!0:e.subGraph?!1:t.scopedUris.has(e.subject)?!0:t.requireResourceObject?Wg(e.object)&&t.scopedUris.has(e.object):t.scopedUris.has(e.object)}function pj(e,t){const n=t.get(bt(e.subject));return n!==void 0&&n.trustLevel!==e.layer}function fj(e,t){if(!Wg(e.object))return!1;const n=t.get(bt(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,a=[];for(const s of e){if(mj(s,t))continue;const l=`${bt(s.subject)}|${s.predicate}|${bt(s.object)}`;n.has(l)||(n.add(l),a.push(s))}return a}function Zg(e){return w.useMemo(()=>{const t=_m(e.allTriples,e.entities);return{triples:t,total:t.length}},[e.allTriples,e.entities])}function gj(e){return w.useMemo(()=>{const t=new Set,n=new Set,a=new Set,s=new Set;let l=0,u=0,d=0,f=0;for(const h of e.allTriples){const g=`${bt(h.subject)}|${h.predicate}|${bt(h.object)}`;!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"&&!a.has(g)&&(a.add(g),d++))}return{wm:l,swm:u,vm:d,canonical:f}},[e.allTriples,e.entities])}function W4(e,t){const n=zn[t].trustLevel;return w.useMemo(()=>{const a=new Set,s=[];for(const l of e.allTriples){if(l.layer!==n||hj(l,e.entities))continue;const u=`${bt(l.subject)}|${l.predicate}|${bt(l.object)}`;a.has(u)||(a.add(u),s.push(l))}return s},[e.allTriples,e.entities,n])}const Z4="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function K4(e){const t=e.trim();return(t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t)===Z4}function hd(e,t,n){const a=[],s=n==null?void 0:n.focalSubjects;for(const l of e){const u=bt(l.subject);!t.has(u)&&!(s!=null&&s.has(u))||Wg(l.object)&&!K4(l.predicate)&&!t.has(bt(l.object))||a.push(l)}return a}const Oh="http://dkg.io/ontology/sourceContentType",S1="http://dkg.io/ontology/markdownForm",j1="http://dkg.io/ontology/sourceFile",C1="http://dkg.io/ontology/size";function Y4(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 Q4(e){const[t,n]=e.split("-"),a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=Math.max(0,Math.min(11,parseInt(n,10)-1));return`${a[s]} ${t}`}function Qu(e,t){const n=e.properties.get(t),a=n==null?void 0:n[0];if(!a)return null;const s=a.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),l=Date.parse(s);return Number.isNaN(l)?null:l}function X4(e){const t=Date.now()-e;if(t<0)return"just now";const n=Math.floor(t/1e3);if(n<45)return"just now";const a=Math.floor(n/60);if(a<60)return`${a}m ago`;const s=Math.floor(a/60);if(s<24)return`${s}h ago`;const l=Math.floor(s/24);return l<30?`${l}d ago`:new Date(e).toISOString().slice(0,10)}function J4(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 eM(e){if(!(e==null||e===""))return`Exact balance: ${e} (full precision from chain)`}function tM(e){if(e==null)return"—";const t=e/100;return`${t%1===0?t.toFixed(0):t.toFixed(1)}%`}function nM(){HS();const e=wg(l=>{var u;return(u=l.nodeStatus)==null?void 0:u.nodeRole}),t=fn(l=>l.openTab),{covered:n,bestCoveringDiscountBps:a,walletsInconclusive:s}=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?`${tM(a)} discount`:"None — publishing at the direct cost"}),o.jsxs("button",{type:"button",className:"v10-ws-pca-cta",onClick:()=>t({id:"conviction",label:"Publisher Conviction",closable:!0}),children:[e==="edge"?"Get added to a PCA":"Set up PCA"," ->"]})]})}const rM="Context graphs you created or joined — scoped knowledge domains with configurable access (private, curated and peer-shared, or public) where agents build and collaborate on shared context with verifiable provenance.",Rm=[{key:"wm",label:"Working Memory",short:"WM",color:"var(--layer-working)",desc:"Private agent drafts — free, self-attested, persists locally."},{key:"swm",label:"Shared Working Memory",short:"SWM",color:"var(--layer-shared)",desc:"Team proposals — free, gossip-replicated across context-graph peers."},{key:"vm",label:"Verifiable Memory",short:"VM",color:"var(--layer-verified)",desc:"On-chain knowledge — permanent, verifiable, requires TRAC to publish."}],Au={1:"Ethereum",8453:"Base",84532:"Base Sepolia",100:"Gnosis",10200:"Chiado",2043:"NeuroWeb",20430:"NeuroWeb Testnet"};function Lh(e){var s;const t=GS(e);if(e==null)return{name:"Unknown chain",gas:t};const n=String(e);if(Au[n])return{name:Au[n],gas:t};const a=(s=n.match(/(\d+)\s*$/))==null?void 0:s[1];return a&&Au[a]?{name:Au[a],gas:t}:{name:a?`Chain ${a}`:`Chain ${n}`,gas:t}}function vl(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(e<1e4?1:0)}k`.replace(".0",""):`${(e/1e6).toFixed(1)}M`.replace(".0","")}function Mh({label:e,value:t,sub:n,accentColor:a,children:s,icon:l,className:u}){return o.jsxs("div",{className:`stat-card v10-anim-mount${u?` ${u}`:""}`,children:[a&&o.jsx("div",{className:"accent",style:{background:a}}),o.jsxs("div",{className:"stat-label",children:[l,e]}),t!=null&&t!==""&&o.jsx("div",{className:"stat-value",children:t}),s,n!=null&&n!==""&&o.jsx("div",{className:"stat-sub",children:n})]})}function N1({counts:e}){const t=e.wm+e.swm+e.vm,n=Rm.map(a=>`${a.short} ${e[a.key]}`).join(" · ");return o.jsx("div",{className:"v10-layerbar","aria-label":n,children:t===0?o.jsx("span",{className:"v10-layerbar-empty"}):Rm.map(a=>{const s=e[a.key]/t*100;return s<=0?null:o.jsx("span",{className:"v10-layerbar-seg",title:`${a.label} (${e[a.key]}) — ${a.desc}`,style:{width:`${s}%`,background:a.color}},a.key)})})}function aM(){return o.jsx("div",{className:"v10-layer-legend",children:Rm.map(e=>o.jsxs("span",{className:"v10-layer-legend-item",title:`${e.label} — ${e.desc}`,children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:e.color}}),e.short]},e.key))})}function iM({curator:e,joined:t,refreshing:n}){const a=e+t,s=`Curator ${e} · Joined ${t}`,l="var(--accent-green)",u="var(--text-secondary)";return o.jsxs("div",{className:`v10-cg-rolesplit${n?" is-refreshing":""}`,title:n?"Refreshing — agent identity is being re-checked":void 0,"aria-busy":n||void 0,children:[o.jsx("div",{className:"v10-layerbar","aria-label":s,children:a===0?o.jsx("span",{className:"v10-layerbar-empty"}):o.jsxs(o.Fragment,{children:[e>0&&o.jsx("span",{className:"v10-layerbar-seg",title:`Curator (${e}) — context graphs you created and curate`,style:{width:`${e/a*100}%`,background:l}}),t>0&&o.jsx("span",{className:"v10-layerbar-seg",title:`Joined (${t}) — context graphs you joined as a member`,style:{width:`${t/a*100}%`,background:u}})]})}),o.jsxs("div",{className:"v10-layer-legend",children:[o.jsxs("span",{className:"v10-layer-legend-item",title:"Curator — context graphs you created and curate",children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:l}}),"Curator ",e]}),o.jsxs("span",{className:"v10-layer-legend-item",title:"Joined — context graphs you joined as a member",children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:u}}),"Joined ",t]})]})]})}function sM({cg:e,identity:t,onReport:n,onOpen:a}){var z,q;const s=Gg(e.id,{signalErrors:!0}),[l,u]=w.useState(null),[d,f]=w.useState(!1),h=l===null&&!d,g=w.useRef(!0),m=w.useRef(0),y=w.useCallback(()=>{const D=++m.current;Tn.listParticipants(e.id).then(R=>{g.current&&D===m.current&&(u((R.allowedAgents??[]).map(Jt)),f(!1))}).catch(()=>{g.current&&D===m.current&&(u(null),f(!0))})},[e.id]);w.useEffect(()=>{g.current=!0,u(null),f(!1),y();const D=setInterval(y,3e4);return()=>{g.current=!1,clearInterval(D)}},[y]),ss(w.useCallback(D=>{var $,F;if(D.type!=="join_approved"&&D.type!=="join_rejected"&&D.type!=="project_synced")return;const R=(($=D.data)==null?void 0:$.contextGraphId)??((F=D.data)==null?void 0:F.projectId);R&&R!==e.id||y()},[e.id,y]));const b=es(e.accessPolicy)==="public",k=w.useMemo(()=>{var F;if(b)return null;const D=(F=e.curator)==null?void 0:F.trim(),R=D?Jt(D):null;if(l===null)return d&&R?[R]:null;const $=new Set(l);return R&&$.add(R),[...$]},[l,d,e.curator,b]),j=Number.isFinite(e.assetCount??e.assets)?e.assetCount??e.assets:0,N=w.useMemo(()=>{if(s.error)return{wm:0,swm:0,vm:0,total:j};const D=new Set(s.allTriples.map(R=>R.subject)).size;return{wm:s.counts.wm,swm:s.counts.swm,vm:s.counts.vm,total:D}},[s.error,s.allTriples,s.counts.wm,s.counts.swm,s.counts.vm,j]),S=gj(s),A=w.useMemo(()=>({wm:S.wm,swm:S.swm,vm:S.vm,total:S.canonical}),[S]),E=[s.loading?1:0,s.error?1:0,s.partial?1:0,h?1:0,d?1:0,b?1:0,N.wm,N.swm,N.vm,N.total,A.wm,A.swm,A.vm,A.total,k?k.slice().sort().join(","):"∅"].join("|");w.useEffect(()=>{n(e.id,{entities:N,triples:A,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 T=es(e.accessPolicy),U=T==="private"?"Curated":T==="public"?"Public":"Unknown",_=!!((z=e.curator)!=null&&z.trim()&&((q=t==null?void 0:t.agentDid)!=null&&q.trim())&&Jt(e.curator)===Jt(t.agentDid));return o.jsxs("button",{className:"v10-cg-row",onClick:()=>a(e),children:[o.jsx("span",{className:"v10-cg-cell v10-cg-name",children:e.name||e.id.slice(0,16)}),o.jsx("span",{className:"v10-cg-cell v10-cg-type",title:`${U} context graph`,"aria-label":`${U} context graph`,children:T==="private"?o.jsx(SO,{size:13,"aria-hidden":"true"}):T==="public"?o.jsx(bO,{size:13,"aria-hidden":"true"}):o.jsx("span",{className:"v10-cg-dim",children:"—"})}),o.jsx("span",{className:"v10-cg-cell v10-cg-size",children:s.loading?o.jsx("span",{className:"v10-stat-loading",children:"loading…"}):s.error?o.jsxs("span",{title:"Live entity count unavailable — showing the published Knowledge-Asset summary, not the full WM/SWM/VM entity total",children:[vl(N.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"KA (summary)"})," · ",o.jsx("span",{className:"v10-cg-dim",children:"— triples"})]}):s.partial?o.jsxs("span",{title:"Partial — one or more memory layers were unavailable; counts are a lower bound",children:["~",vl(N.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ~",vl(A.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"triples"})]}):o.jsxs(o.Fragment,{children:[vl(N.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ",vl(A.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"triples"})]})}),o.jsx("span",{className:"v10-cg-cell v10-cg-agents",children:k===null?o.jsx("span",{className:"v10-cg-dim",children:"—"}):d?o.jsxs("span",{title:"Participant list unavailable — curator-only lower bound",children:["~",k.length]}):k.length}),o.jsx("span",{className:"v10-cg-cell v10-cg-role",children:o.jsx("span",{className:`v10-cg-badge v10-cg-badge-${_?"curator":"joined"}`,children:_?"CURATOR":"JOINED"})})]})}const E1={wm:0,swm:0,vm:0,total:0};function oM(){var _,z;const{data:e}=lr(Tn.fetchStatus,[],1e4),{data:t}=lr(Tn.fetchEconomics,[],6e4),{data:n,loading:a,error:s}=lr(Tn.fetchWalletsBalances,[],3e4),{openTab:l}=fn(),{setActiveProject:u}=Tr(),{myCgs:d,identity:f,identityLoading:h,cgsLoading:g}=m4(),m=(h||g)&&d.length===0,[y,b]=w.useState({}),k=w.useCallback((q,D)=>{b(R=>{var $;return(($=R[q])==null?void 0:$.sig)===D.sig?R:{...R,[q]:D}})},[]);w.useEffect(()=>{const q=new Set(d.map(D=>D.id));b(D=>{const R=Object.keys(D);if(R.every(F=>q.has(F)))return D;const $={};for(const F of R)q.has(F)&&($[F]=D[F]);return $})},[d]);const j=w.useMemo(()=>{const q={...E1},D={...E1},R=new Set;let $=!1,F=!1,K=!1,I=!1,H=!1;for(const W of d){const Q=y[W.id];if(!Q){$=!0,F=!0;continue}Q.sizeLoading&&($=!0),Q.agentsLoading&&(F=!0),Q.sizeError&&(K=!0),Q.sizeFallback&&(H=!0),(Q.agentsError||Q.agentsUnknown)&&(I=!0);for(const V of["wm","swm","vm","total"])q[V]+=Q.entities[V],D[V]+=Q.triples[V];for(const V of Q.agents)R.add(V)}const B=d.length>0;return{entities:q,triples:D,agentCount:R.size,sizeLoading:B&&$,agentsLoading:B&&F,sizePartial:K,agentsPartial:I,triplesUnknown:B&&K&&D.total===0,sizeApprox:B&&H,hasCgs:B}},[d,y]),N=w.useMemo(()=>{var $,F;const q=($=f==null?void 0:f.agentDid)!=null&&$.trim()?Jt(f.agentDid):null;let D=0,R=0;for(const K of d)!!(q&&((F=K.curator)!=null&&F.trim())&&Jt(K.curator)===q)?D++:R++;return{curator:D,joined:R}},[d,f]),S=[{label:"24h",display:"Last 24h"},{label:"7d",display:"Last 7d"},{label:"30d",display:"Last 30d"}],A=q=>{if(q==null||typeof q=="string"&&q.trim()==="")return"—";const D=Number(q);return isFinite(D)?D.toLocaleString(void 0,{maximumFractionDigits:D>=1e3?0:2}):String(q)},E=S.map(q=>{var R;const D=(R=t==null?void 0:t.periods)==null?void 0:R.find($=>$.label===q.label);return{display:q.display,publishes:D?String(D.publishCount):"—",trac:D?A(D.totalTrac):"—"}});n!=null&&n.symbol;const T=(n==null?void 0:n.balances)??[],U=q=>q.length>12?`${q.slice(0,6)}…${q.slice(-4)}`:q;return o.jsxs("div",{className:"v10-dashboard",children:[o.jsxs("div",{className:"v10-dash-header",children:[o.jsx("h1",{className:"v10-dash-title",children:"Dashboard"}),o.jsxs("p",{className:"v10-dash-subtitle",children:[(e==null?void 0:e.name)||"DKG Node"," · ",(e==null?void 0:e.networkName)||"network",(n==null?void 0:n.chainId)!=null?` · ${Lh(n.chainId).name}`:""]})]}),o.jsxs("div",{className:"v10-dash-stats v10-dash-stats-3",children:[o.jsx(Mh,{label:"My Context Graphs",className:"v10-stat-tight",icon:o.jsx(Yx,{size:13,"aria-hidden":!0}),value:m?o.jsx("span",{className:"v10-stat-loading",children:"loading…"}):d.length,accentColor:"var(--accent-blue)",sub:rM,children:j.hasCgs&&!m?o.jsx(iM,{curator:N.curator,joined:N.joined,refreshing:h}):null}),o.jsxs(Mh,{label:"Context Graph Size",icon:o.jsx(_O,{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(aM,{})]}):o.jsx("div",{className:"v10-stat-empty",children:"—"}),o.jsx("div",{className:"stat-sub",children:j.hasCgs?j.sizePartial?"Some context graphs could not report size; total is partial.":"Totals across all your context graphs, summed over Working, Shared Working & Verifiable Memory. Knowledge Assets are entities that have been published to Verifiable Memory.":"No context graphs yet."})]}),o.jsx(Mh,{label:"Collaborating Agents",icon:o.jsx(MO,{size:13,"aria-hidden":!0}),value:j.hasCgs?j.agentsLoading?o.jsx("span",{className:"v10-stat-loading",children:"loading…"}):j.agentsPartial?`~${j.agentCount}`:j.agentCount:o.jsx("span",{className:"v10-stat-empty",children:"—"}),sub:j.hasCgs?j.agentsPartial?"Some context graphs could not report agents; count is partial.":"Unique agents — your own and others' — allow-listed and collaborating across your context graphs.":"No context graphs yet.",accentColor:"var(--purple)"})]}),o.jsxs("div",{className:"v10-dash-grid v10-dash-grid-2",children:[o.jsxs("div",{className:"v10-dash-section v10-dash-section-wide v10-anim-mount",children:[o.jsxs("div",{className:"v10-dash-section-header",children:[o.jsxs("div",{className:"v10-dash-section-title",children:[o.jsx(Yx,{size:13,"aria-hidden":!0}),o.jsx("h3",{children:"My Context Graphs"})]}),o.jsx("span",{className:"v10-dash-section-badge",children:d.length})]}),m?o.jsx("p",{className:"v10-cg-empty",children:"Loading context graphs…"}):d.length===0?o.jsx("p",{className:"v10-cg-empty",children:"No context graphs yet — create or join one from the sidebar."}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-cg-colhead",children:[o.jsx("span",{className:"v10-cg-cell v10-cg-name",children:"Name"}),o.jsx("span",{className:"v10-cg-cell v10-cg-type",children:"Type"}),o.jsx("span",{className:"v10-cg-cell v10-cg-size",children:"Size"}),o.jsx("span",{className:"v10-cg-cell v10-cg-agents",title:"Agents allow-listed with access to this context graph",children:"Agents"}),o.jsx("span",{className:"v10-cg-cell v10-cg-role",children:"Role"})]}),o.jsx("div",{className:"v10-cg-list",children:d.map(q=>o.jsx(sM,{cg:q,identity:f,onReport:k,onOpen:D=>{u(D.id),l({id:`project:${D.id}`,label:D.name||D.id.slice(0,12),closable:!0})}},q.id))})]})]}),o.jsxs("div",{className:"v10-dash-section v10-anim-mount",children:[o.jsx("div",{className:"v10-dash-section-header",children:o.jsxs("div",{className:"v10-dash-section-title",children:[o.jsx(zO,{size:13,"aria-hidden":!0}),o.jsx("h3",{children:"Wallets and Spending"})]})}),(n==null?void 0:n.chainId)!=null?o.jsxs("div",{className:"v10-ws-chain-row",children:[o.jsx("span",{className:"v10-ws-chain-label",children:"Chain"}),o.jsx("span",{className:"v10-ws-chain-value",children:Lh(n.chainId).name})]}):null,o.jsx("div",{className:"v10-ws-subhead",children:"Node wallets"}),a&&!n?o.jsx("p",{className:"v10-cg-empty",children:"Loading wallets…"}):T.length>0?o.jsxs("div",{className:"v10-ws-wtable",children:[o.jsxs("div",{className:"v10-ws-wrow v10-ws-whead",children:[o.jsx("span",{children:"Wallet"}),o.jsx("span",{children:"TRAC"}),o.jsxs("span",{children:["Gas (",Lh(n==null?void 0:n.chainId).gas,")"]})]}),T.map(q=>o.jsxs("div",{className:"v10-ws-wrow",children:[o.jsx("span",{className:"v10-ws-addr",title:q.address,children:U(q.address)}),o.jsx("span",{className:"v10-ws-bal",children:A(q.trac)}),o.jsx("span",{className:"v10-ws-bal-sec",title:eM(q.eth),children:J4(q.eth)})]},q.address))]}):(((_=n==null?void 0:n.wallets)==null?void 0:_.length)??0)>0?o.jsx("ul",{className:"v10-ws-wallets",children:((n==null?void 0:n.wallets)??[]).map(q=>o.jsxs("li",{className:"v10-ws-wallet",children:[o.jsx("span",{className:"v10-ws-addr",title:q,children:U(q)}),o.jsx("span",{className:"v10-cg-dim",children:"—"})]},q))}):n!=null&&n.error||s?o.jsx("p",{className:"v10-cg-empty",children:"Wallet balances unavailable."}):o.jsx("p",{className:"v10-cg-empty",children:"No node wallets found."}),(n!=null&&n.error||s)&&(T.length>0||(((z=n==null?void 0:n.wallets)==null?void 0:z.length)??0)>0)?o.jsx("p",{className:"v10-ws-note",children:"Balances may be stale — the chain/RPC reported an error."}):null,o.jsx("div",{className:"v10-ws-subhead",children:"Spending"}),o.jsxs("div",{className:"v10-ws-spend",children:[o.jsxs("div",{className:"v10-ws-spend-head",children:[o.jsx("span",{children:"Period"}),o.jsx("span",{title:"Publishes to Verifiable Memory that spent TRAC on-chain. Free SWM/local/testnet publishes are not counted (they don't burn TRAC).",children:"Publishes to VM"}),o.jsx("span",{children:"TRAC"})]}),E.map(q=>o.jsxs("div",{className:"v10-ws-spend-row",children:[o.jsx("span",{className:"v10-cg-dim",children:q.display}),o.jsx("span",{className:"v10-ws-spend-val",children:q.publishes}),o.jsx("span",{className:"v10-ws-spend-val",children:q.trac})]},q.display))]}),o.jsx(nM,{})]})]})]})}const lM=new Set(["meta"]),$r="__root__";function Kg(e){return!lM.has(e.name)}const cM=".md, .docx, .pdf, .txt, .csv, .json, .ttl, .rdf, .owl, .py, .ts, .js, .tsx, .jsx, .java, .go, .rs, .c, .cpp, .html, .xml, .yaml, .yml";function A1(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function uM(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 dM({open:e,onClose:t,contextGraphId:n,contextGraphName:a}){var Q;const[s,l]=w.useState([]),[u,d]=w.useState(!0),[f,h]=w.useState(!0),[g,m]=w.useState("idle"),[y,b]=w.useState(0),[k,j]=w.useState([]),[N,S]=w.useState(null),[A,E]=w.useState(!1),T=w.useRef(null),U=w.useCallback(V=>{const L=Array.from(V);l(P=>{const G=new Set(P.map(ne=>`${ne.file.name}:${ne.file.size}`)),O=L.filter(ne=>!G.has(`${ne.name}:${ne.size}`));return[...P,...O.map(ne=>({file:ne,id:`${ne.name}-${ne.size}-${Date.now()}`}))]})},[]),_=V=>{l(L=>L.filter(P=>P.id!==V))},z=V=>{V.preventDefault(),V.stopPropagation(),E(!0)},q=V=>{V.preventDefault(),V.stopPropagation(),E(!1)},D=V=>{V.preventDefault(),V.stopPropagation(),E(!1),V.dataTransfer.files.length>0&&U(V.dataTransfer.files)},R=async()=>{if(s.length===0)return;m("uploading"),b(0),j([]),S(null);const V=[];for(let P=0;P<s.length;P++){b(P);const{file:G}=s[P],O=G.name.replace(/[^a-zA-Z0-9._-]/g,"_"),ne=`${Date.now().toString(36)}-${P}-${O}`;try{const ue=await OS(ne,n,G),le=ue.extraction.tripleCount??ue.extraction.triplesWritten;V.push({fileName:G.name,status:ue.extraction.status==="completed"?"success":ue.extraction.status==="skipped"?"skipped":"error",triplesWritten:le,error:ue.extraction.error})}catch(ue){V.push({fileName:G.name,status:"error",error:(ue==null?void 0:ue.message)??"Upload failed"})}}j(V),b(s.length);const L=V.some(P=>P.status==="error");m(L?"error":"done")},$=()=>{g!=="uploading"&&(l([]),j([]),m("idle"),S(null),b(0),t())},{dialogRef:F,onBackdropClick:K}=Ji(e,$);if(!e)return null;const I=k.reduce((V,L)=>V+(L.triplesWritten??0),0),H=k.filter(V=>V.status==="success").length,B=k.filter(V=>V.status==="skipped").length,W=k.filter(V=>V.status==="error").length;return o.jsx("div",{className:"v10-modal-overlay",onClick:K,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:F,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-import-modal-title",children:[o.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{id:"dkg-import-modal-title",className:"v10-modal-title",children:"Import to Working Memory"}),o.jsx("div",{className:"v10-modal-subtitle",children:a?o.jsxs(o.Fragment,{children:["Upload files to ",o.jsx("strong",{children:a})," — your agent will extract structured knowledge."]}):o.jsx(o.Fragment,{children:"Upload files — your agent will extract structured knowledge and add it to working memory."})})]}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:$,disabled:g==="uploading","aria-label":"Close import dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:g==="uploading"?"not-allowed":"pointer"},children:"×"})]}),o.jsxs("div",{className:"v10-modal-body",children:[N&&o.jsx("div",{className:"v10-modal-error",children:N}),g==="idle"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`v10-import-dropzone ${A?"drag-over":""}`,onClick:()=>{var V;return(V=T.current)==null?void 0:V.click()},onDragOver:z,onDragLeave:q,onDrop:D,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: ",cM]}),o.jsx("input",{ref:T,type:"file",multiple:!0,style:{display:"none"},onChange:V=>{V.target.files&&U(V.target.files),V.target.value=""}})]}),s.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-import-file-list",children:s.map(V=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:uM(V.file.name)}),o.jsx("span",{className:"v10-import-file-name",children:V.file.name}),o.jsx("span",{className:"v10-import-file-size",children:A1(V.file.size)}),o.jsx("button",{className:"v10-import-file-remove",onClick:()=>_(V.id),title:"Remove",children:"×"})]},V.id))}),o.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginBottom:12},children:[s.length," file",s.length!==1?"s":""," selected · ",A1(s.reduce((V,L)=>V+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:((Q=s[y])==null?void 0:Q.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 ${W>0?"error":"success"}`,"data-testid":"import-result","data-import-status":W>0?"error":"success","data-import-triples":I,children:W===0?o.jsxs(o.Fragment,{children:[H>0&&o.jsxs(o.Fragment,{children:["Successfully imported ",H," file",H!==1?"s":"",".",I>0&&o.jsxs(o.Fragment,{children:[" Extracted ",o.jsx("strong",{children:I.toLocaleString()})," triples into working memory."]})]}),B>0&&o.jsxs(o.Fragment,{children:[H>0?" ":"","Stored ",B," file",B!==1?"s":""," as source — no structured knowledge was extracted yet (extraction for these file types is coming soon)."]})]}):o.jsxs(o.Fragment,{children:[H," file",H!==1?"s":""," imported",B>0&&o.jsxs(o.Fragment,{children:[", ",B," stored without extraction"]}),", ",W," 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((V,L)=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:V.status==="success"?"✓":V.status==="skipped"?"–":"✗"}),o.jsx("span",{className:"v10-import-file-name",children:V.fileName}),o.jsx("span",{className:"v10-import-file-size",style:V.status==="error"?{color:"var(--text-danger)"}:void 0,children:V.status==="success"&&V.triplesWritten!=null?`${V.triplesWritten} triples`:V.status==="skipped"?"stored (no extraction)":V.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:$,children:"Cancel"}),o.jsxs("button",{className:"v10-modal-btn primary",onClick:R,disabled:s.length===0,children:["Start Import (",s.length," file",s.length!==1?"s":"",")"]})]}),g==="uploading"&&o.jsx("button",{className:"v10-modal-btn",disabled:!0,children:"Importing…"}),(g==="done"||g==="error")&&o.jsx("button",{className:"v10-modal-btn primary",onClick:$,children:"Done"})]})]})})}function pM(e){return e.length<=12?e:`${e.slice(0,6)}…${e.slice(-4)}`}function fM({open:e,onClose:t,contextGraphId:n,contextGraphName:a}){const[s,l]=w.useState(null),[u,d]=w.useState(null),[f,h]=w.useState([]),[g,m]=w.useState(null),[y,b]=w.useState([]),[k,j]=w.useState([]),[N,S]=w.useState(null),[A,E]=w.useState("allowlist");w.useEffect(()=>{e&&(fetch("/api/status",{headers:Ft()}).then($=>$.json()).then($=>{typeof($==null?void 0:$.peerId)=="string"&&$.peerId.length>0&&d($.peerId)}).catch(()=>{}),_S(n).then($=>h($.allowedAgents)).catch(()=>h([])),Cg().then($=>{const F=($.agents??[]).filter(K=>K.connectionStatus!=="self");b(F)}).catch(()=>b([])),RS(n).then($=>j($.requests)).catch(()=>j([])))},[e,n]);const{dialogRef:T,onBackdropClick:U}=Ji(e,t);if(!e)return null;const _=u?`${n}
1128
- ${u}`:null,z=($,F)=>{navigator.clipboard.writeText($).then(()=>{l(F),setTimeout(()=>l(null),2e3)}).catch(()=>{})},q=async $=>{try{await m_(n,$),h(F=>F.filter(K=>K!==$))}catch{}},D=async $=>{S($);try{await Ng(n,$),j(F=>F.filter(K=>K.agentAddress!==$)),h(F=>[...new Set([...F,$])])}catch(F){m((F==null?void 0:F.message)||"Failed to approve")}finally{S(null)}},R=async $=>{S($);try{await Eg(n,$),j(F=>F.filter(K=>K.agentAddress!==$))}catch(F){m((F==null?void 0:F.message)||"Failed to reject")}finally{S(null)}};return o.jsx("div",{className:"v10-modal-overlay",onClick:U,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:T,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-share-modal-title",children:[o.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{id:"dkg-share-modal-title",className:"v10-modal-title",children:"Share Context Graph"}),o.jsxs("div",{className:"v10-modal-subtitle",children:["Invite agents to collaborate on ",o.jsx("strong",{children:a}),"."]})]}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close share dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:"pointer"},children:"×"})]}),o.jsxs("div",{className:"v10-modal-body",children:[o.jsxs("div",{style:{display:"flex",gap:0,marginBottom:16,borderBottom:"1px solid var(--border-default)"},children:[o.jsx("button",{onClick:()=>E("allowlist"),style:{padding:"8px 16px",fontSize:12,fontWeight:A==="allowlist"?600:400,background:"none",border:"none",cursor:"pointer",color:A==="allowlist"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:A==="allowlist"?"2px solid var(--accent-primary)":"2px solid transparent"},children:"Allowlist"}),o.jsxs("button",{onClick:()=>E("requests"),style:{padding:"8px 16px",fontSize:12,fontWeight:A==="requests"?600:400,background:"none",border:"none",cursor:"pointer",color:A==="requests"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:A==="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})]})]}),A==="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($=>{const F=y.find(K=>{var I;return((I=K.agentAddress)==null?void 0:I.toLowerCase())===$.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:pM($)})]}):$}),o.jsx("button",{onClick:()=>q($),style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",fontSize:12,padding:"0 4px"},title:"Remove agent",children:"×"})]},$)})}),f.length===0&&o.jsx("div",{style:{padding:"8px 12px",borderRadius:6,fontSize:11,color:"var(--text-tertiary)",background:"var(--bg-surface)",border:"1px dashed var(--border-default)",marginBottom:8},children:"No agents on allowlist — context graph is open to anyone who subscribes."})]}),o.jsx("div",{className:"v10-form-divider"}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Invite Code"}),_===null?o.jsx("div",{style:{padding:"8px 12px",borderRadius:6,fontSize:11,color:"var(--text-tertiary)",background:"var(--bg-surface)",border:"1px dashed var(--border-default)"},children:"Loading peer ID…"}):o.jsxs("div",{style:{position:"relative"},children:[o.jsx("pre",{style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:6,padding:"10px 12px",fontSize:11,lineHeight:1.6,fontFamily:"var(--font-mono)",color:"var(--text-primary)",overflow:"auto",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-all"},children:_}),o.jsx("button",{className:"v10-modal-btn primary",onClick:()=>z(_,"invite"),style:{position:"absolute",top:6,right:6,fontSize:10,padding:"4px 10px",height:26,cursor:"pointer"},children:s==="invite"?"Copied":"Copy Invite"})]})]})]}),A==="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($=>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:[$.name&&o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:500},children:$.name}),o.jsx("span",{style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",fontSize:10},children:$.agentAddress}),o.jsxs("span",{style:{fontSize:9,color:"var(--text-tertiary)"},children:["Requested ",new Date($.timestamp).toLocaleString()]})]}),o.jsxs("div",{style:{display:"flex",gap:6},children:[o.jsx("button",{onClick:()=>D($.agentAddress),disabled:N===$.agentAddress,style:{background:"rgba(34, 197, 94, 0.15)",color:"var(--text-success)",border:"1px solid rgba(34, 197, 94, 0.3)",cursor:"pointer",borderRadius:4,fontSize:10,padding:"4px 10px",fontWeight:600},children:N===$.agentAddress?"…":"Approve"}),o.jsx("button",{onClick:()=>R($.agentAddress),disabled:N===$.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"})]})]},$.agentAddress)),g&&o.jsx("div",{style:{fontSize:10,color:"var(--text-danger)",marginTop:4},children:g})]})]}),o.jsx("div",{className:"v10-modal-footer",children:o.jsx("button",{className:"v10-modal-btn",onClick:t,children:"Done"})})]})})}async function Hi(e,t){var a;const n=await or(e,t);return((a=n==null?void 0:n.result)==null?void 0:a.bindings)??[]}const qi={displayName:"Project",primaryColor:"#a855f7",accentColor:"#22c55e"},hM=e=>({slug:e,displayName:e,icon:"•",color:"#64748b",rank:99}),mM={slug:$r,displayName:"Root",description:"Entities not in any subgraph (Context Graph root)",icon:"⊘",rank:99},gM=e=>({typeIri:e,label:e.split(/[/#]/).pop()||e,color:"#64748b"}),os="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 at(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 Om(e){const t=at(e),n=parseInt(t,10);return Number.isFinite(n)?n:0}function ls(e){return`FILTER(strstarts(str(?g), "${`did:dkg:context-graph:${e}/meta`.replace(/"/g,'\\"')}"))`}function vM(e){return`PREFIX prof: <${os}>
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
- ${ls(e)}
1141
- } LIMIT 1`}function yM(e){return`PREFIX prof: <${os}>
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
- ${ls(e)}
1157
- }`}function bM(e){return`PREFIX prof: <${os}>
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
- ${ls(e)}
1170
- }
1171
- GROUP BY ?chip ?subGraph ?type ?predicate ?label`}function xM(e){return`PREFIX prof: <${os}>
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
- ${ls(e)}
1183
- }`}function wM(e){return`PREFIX prof: <${os}>
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
- ${ls(e)}
1198
- }`}function kM(e,t){const n=new Map;for(const f of e){const h=zr(f.catalog);if(!h)continue;const g=h.split(":catalog:").pop()??h;n.set(h,{slug:g,subGraph:at(f.subGraph),name:at(f.name)||g,description:at(f.description)||void 0,rank:Om(f.rank)||99,queries:[]})}const a=t.map(f=>{const h=zr(f.q),g=h.split(":query:").pop()??h,m=at(f.subGraph),y=zr(f.catalog),b=y?n.get(y):void 0,k=`default:${m}`;return{slug:g,subGraph:m,catalogSlug:(b==null?void 0:b.slug)??k,catalogName:(b==null?void 0:b.name)??"Queries",catalogDescription:b==null?void 0:b.description,catalogRank:(b==null?void 0:b.rank)??999,name:at(f.name)||g,description:at(f.description)||void 0,sparql:at(f.sparql),resultColumn:at(f.column)||"",rank:Om(f.rank)||99}}).filter(f=>f.subGraph&&f.sparql).sort((f,h)=>f.subGraph.localeCompare(h.subGraph)||f.catalogRank-h.catalogRank||f.catalogName.localeCompare(h.catalogName)||f.rank-h.rank||f.name.localeCompare(h.name)),s=new Map;for(const f of n.values())s.set(`${f.subGraph}|${f.slug}`,{...f,queries:[]});for(const f of a){const h=`${f.subGraph}|${f.catalogSlug}`,g=s.get(h);if(g){g.queries.push(f);continue}s.set(h,{slug:f.catalogSlug,subGraph:f.subGraph,name:f.catalogName,description:f.catalogDescription,rank:f.catalogRank,queries:[f]})}const l=Array.from(s.values()).filter(f=>f.queries.length>0).map(f=>({...f,queries:[...f.queries].sort((h,g)=>h.rank-g.rank||h.name.localeCompare(g.name))})).sort((f,h)=>f.subGraph.localeCompare(h.subGraph)||f.rank-h.rank||f.name.localeCompare(h.name)),u=new Map,d=new Map;for(const f of l){const h=u.get(f.subGraph)??[];h.push(f),u.set(f.subGraph,h);const g=d.get(f.subGraph)??[];g.push(...f.queries),d.set(f.subGraph,g)}return{queryCatalogs:l,savedQueries:a,catalogsBySubGraph:u,queriesBySubGraph:d}}function SM(e){return`PREFIX prof: <${os}>
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
- ${ls(e)}
1215
- }`}function jM(e){return`PREFIX prof: <${os}>
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
- ${ls(e)}
1230
- }
1231
- GROUP BY ?view ?name ?description ?nodeSize`}function zr(e){const t=vj(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function CM(e){const[t,n]=w.useState(!0),[a,s]=w.useState(),[l,u]=w.useState(qi.displayName),[d,f]=w.useState(),[h,g]=w.useState(qi.primaryColor),[m,y]=w.useState(qi.accentColor),[b,k]=w.useState([]),[j,N]=w.useState([]),[S,A]=w.useState([]),[E,T]=w.useState([]),[U,_]=w.useState([]),[z,q]=w.useState([]),D=w.useRef(new Map),R=w.useRef(new Map),$=w.useRef(new Map),F=w.useRef(new Map),K=w.useRef(new Map),I=w.useRef(new Map);w.useEffect(()=>{if(!e){n(!1);return}let P=!1;return(async()=>{n(!0),s(void 0);try{const[G,O,ne,ue,le,be,_e]=await Promise.all([Hi(vM(e),e).catch(()=>[]),Hi(yM(e),e).catch(()=>[]),Hi(SM(e),e).catch(()=>[]),Hi(jM(e),e).catch(()=>[]),Hi(bM(e),e).catch(()=>[]),Hi(xM(e),e).catch(()=>[]),Hi(wM(e),e).catch(()=>[])]);if(P)return;const Ee=e;if(G[0]){const ke=G[0];u(at(ke.name)||Ee),f(at(ke.description)||void 0),g(at(ke.primary)||qi.primaryColor),y(at(ke.accent)||qi.accentColor)}else u(Ee),f(void 0),g(qi.primaryColor),y(qi.accentColor);const Ie=O.map(ke=>({slug:at(ke.slug),displayName:at(ke.displayName)||at(ke.slug),description:at(ke.description)||void 0,icon:at(ke.icon)||void 0,color:at(ke.color)||void 0,rank:Om(ke.rank)||99,timelinePredicate:zr(ke.timelinePredicate)||void 0,sourceAssertion:at(ke.sourceAssertion)||void 0})).filter(ke=>ke.slug).sort((ke,lt)=>ke.rank-lt.rank);k(Ie),R.current=new Map(Ie.map(ke=>[ke.slug,ke]));const We=ne.map(ke=>({typeIri:zr(ke.type),label:at(ke.label)||void 0,icon:at(ke.icon)||void 0,color:at(ke.color)||void 0,detailHint:at(ke.detailHint)||void 0,promoteLabel:at(ke.promoteLabel)||void 0,promoteHint:at(ke.promoteHint)||void 0,publishLabel:at(ke.publishLabel)||void 0,publishHint:at(ke.publishHint)||void 0})).filter(ke=>ke.typeIri);N(We),D.current=new Map(We.map(ke=>[ke.typeIri,ke]));const Se=ue.map(ke=>{const lt=zr(ke.view),xe=lt.split(":view:").pop()??lt;return{slug:xe,name:at(ke.name)||xe,description:at(ke.description)||void 0,nodeSize:at(ke.nodeSize)||void 0,includeTypes:at(ke.includeTypes).split("|").map(Oe=>zr(Oe.trim())).filter(Boolean),emphasizePredicates:at(ke.emphasizePredicates).split("|").map(Oe=>zr(Oe.trim())).filter(Boolean)}});A(Se),$.current=new Map(Se.map(ke=>[ke.slug,ke]));const ft=le.map(ke=>{const lt=zr(ke.chip),xe=lt.split(":chip:").pop()??lt,Oe=at(ke.values).split("|").map(Ot=>at(Ot.trim())).filter(Boolean);return{slug:xe,subGraph:at(ke.subGraph),typeIri:zr(ke.type),predicate:zr(ke.predicate),label:at(ke.label)||"Filter",values:Oe}}).filter(ke=>ke.subGraph&&ke.predicate&&ke.values.length>0);T(ft);const De=new Map;for(const ke of ft){const lt=De.get(ke.subGraph)??[];lt.push(ke),De.set(ke.subGraph,lt)}F.current=De;const qe=kM(be,_e);_(qe.queryCatalogs),q(qe.savedQueries),K.current=qe.catalogsBySubGraph,I.current=qe.queriesBySubGraph}catch(G){P||s((G==null?void 0:G.message)??String(G))}finally{P||n(!1)}})(),()=>{P=!0}},[e]);const H=w.useCallback(P=>P===$r?mM:R.current.get(P)??hM(P),[]),B=w.useCallback(P=>D.current.get(P)??gM(P),[]),W=w.useCallback(P=>$.current.get(P),[]),Q=w.useCallback(P=>F.current.get(P)??[],[]),V=w.useCallback(P=>K.current.get(P)??[],[]),L=w.useCallback(P=>I.current.get(P)??[],[]);return{contextGraphId:e??"",displayName:l,description:d,primaryColor:h,accentColor:m,subGraphs:b,typeBindings:j,views:S,filterChips:E,queryCatalogs:U,savedQueries:z,loading:t,error:a,forSubGraph:H,forType:B,view:W,chipsFor:Q,savedQueryCatalogsFor:V,savedQueriesFor:L}}const yj=Ve.createContext(null);function Ua(){return w.useContext(yj)}const NM="http://dkg.io/ontology/agent/";function EM(e){return`FILTER(strstarts(str(?g), "${`did:dkg:context-graph:${e}/meta`.replace(/"/g,'\\"')}"))`}function AM(e){return`PREFIX ag: <${NM}>
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
- ${EM(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 Qr(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 T1(e){const t=bj(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function TM(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 _M(e){const t=new Map;for(const n of e){const a=T1(n.a);if(!a)continue;const s=t.get(a),l=Qr(n.kindAi)==="ai"||Qr(n.kind)==="ai"?"ai":Qr(n.kind)==="human"?"human":(s==null?void 0:s.kind)??"ai",u={uri:a,name:Qr(n.name)||Qr(n.label)||a.split(":").pop()||a,kind:l,framework:Qr(n.fw)||(s==null?void 0:s.framework),operatorUri:T1(n.op)||(s==null?void 0:s.operatorUri),walletAddress:Qr(n.wallet)||(s==null?void 0:s.walletAddress),peerId:Qr(n.peerId)||(s==null?void 0:s.peerId),avatar:Qr(n.avatar)||(s==null?void 0:s.avatar),reputation:Qr(n.reputation)||(s==null?void 0:s.reputation),color:TM(a)};u.kind==="human"&&!u.framework&&(u.framework="human"),t.set(a,u)}for(const n of t.values())if(n.operatorUri){const a=t.get(n.operatorUri);a&&(n.operatorName=a.name)}return t}function RM(e){const[t,n]=w.useState(()=>new Map),[a,s]=w.useState(!0),[l,u]=w.useState(),d=w.useRef(new Map);w.useEffect(()=>{if(!e){s(!1);return}let m=!1;return(async()=>{var y;s(!0),u(void 0);try{const b=await or(AM(e),e);if(m)return;const k=((y=b==null?void 0:b.result)==null?void 0:y.bindings)??[],j=_M(k);n(j),d.current=j}catch(b){m||u((b==null?void 0:b.message)??String(b))}finally{m||s(!1)}})(),()=>{m=!0}},[e]);const f=w.useCallback(m=>d.current.get(m),[]),h=Ve.useMemo(()=>[...t.values()].sort((m,y)=>m.name.localeCompare(y.name)),[t]),g=w.useCallback(m=>{},[]);return{agents:t,list:h,loading:a,error:l,get:f,openAgent:g}}const xj=Ve.createContext(null);function cs(){return w.useContext(xj)}const Lm=["#6366f1","#14b8a6","#f43f5e","#facc15","#8b5cf6","#10b981","#0ea5e9","#d946ef"],_1=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 OM(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 LM(e){return e.startsWith("did:")||e.startsWith("12D3")?e:/^0x[0-9a-fA-F]{40}$/.test(e)?`did:dkg:agent:${e}`:e}function MM(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const a=e.slice(n.length),s=a.indexOf("/");if(s<0)return;const l=a.slice(0,s);if(!(!l||l.startsWith("_")))return l}function DM(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 R1(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)%Lm.length}function wj(e){const[t,n]=w.useState(new Map),[a,s]=w.useState([]),[l,u]=w.useState([]),[d,f]=w.useState(null),[h,g]=w.useState(!1),[m,y]=w.useState(void 0),b=w.useRef(0);w.useEffect(()=>{if(!e){b.current+=1,n(new Map),s([]),u([]),g(!1),y(void 0);return}const S=++b.current,A=new AbortController;let E=!1,T;const U=()=>!E&&S===b.current;return g(!0),f(null),(async()=>{var _;try{const z=new Promise((B,W)=>{T=setTimeout(()=>{A.abort(),W(new Error(`SWM attribution query timed out after ${Math.round(_1/1e3)}s`))},_1)}),q=(async()=>{const B=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Ft()},signal:A.signal,body:JSON.stringify({sparql:DM(e)})});if(!B.ok)throw new Error(`SPARQL query failed: ${B.status}`);return B.json()})(),D=await Promise.race([q,z]),$=(((_=D==null?void 0:D.result)==null?void 0:_.bindings)??[]).slice().reverse(),F=new Map,K=new Map,I=[];for(const B of $){const W=yl(B.op),Q=yl(B.root),V=yl(B.agent),L=yl(B.publishedAt),P=yl(B.g);if(!W||!Q||!V||!L)continue;const G=LM(V),O=P?MM(P,e):void 0;I.push({opUri:W,rootUri:Q,agent:G,publishedAt:L,subGraph:O});const ne={agent:G,opUri:W,publishedAt:L,subGraph:O},ue=F.get(Q);ue?ue.some(be=>be.agent===G)||ue.push(ne):F.set(Q,[ne]);let le=K.get(G);le||(le=new Set,K.set(G,le)),le.add(Q)}const H=[...K.entries()].map(([B,W])=>({agent:B,color:Lm[R1(B)],label:OM(B),entityCount:W.size})).sort((B,W)=>W.entityCount-B.entityCount);if(!U())return;n(F),s(I),u(H),y(e)}catch(z){if(!U())return;f((z==null?void 0:z.message)??"Failed to load SWM attributions"),n(new Map),s([]),u([]),y(e)}finally{T&&clearTimeout(T),U()&&g(!1)}})(),()=>{E=!0,T&&clearTimeout(T),A.abort()}},[e]);const{nodeColors:k,conflicts:j}=w.useMemo(()=>{const S={},A=[];for(const[E,T]of t)T.length!==0&&(T.length===1?S[E]=Lm[R1(T[0].agent)]:(A.push(E),S[E]="#f59e0b"));return{nodeColors:S,conflicts:A}},[t]);return{resultContextGraphId:m,attributions:t,events:a,palette:l,nodeColors:k,conflicts:j,loading:!!(e&&(h||m!==e)),error:d}}function zM(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,Mm="http://dkg.io/ontology/";function $M(e){const t=`did:dkg:context-graph:${e}/_meta`;return`PREFIX dkg: <${Mm}>
1265
- PREFIX prov: <http://www.w3.org/ns/prov#>
1266
- SELECT ?event ?type ?assertion ?name ?agent ?ts ?subGraphName ?assertionGraph (COUNT(DISTINCT ?root) AS ?entityCount) (COUNT(DISTINCT ?subjRoot) AS ?subjectEntityCount) WHERE {
1267
- GRAPH <${t}> {
1268
- ?event a ?type ;
1269
- prov:startedAtTime ?ts .
1270
- FILTER(?type IN (dkg:AssertionCreated, dkg:AssertionPromoted))
1271
- OPTIONAL { ?event prov:wasAssociatedWith ?agentAssoc }
1272
- OPTIONAL { ?event prov:generated ?gen }
1273
- OPTIONAL { ?event prov:used ?used }
1274
- BIND(COALESCE(?gen, ?used) AS ?assertion)
1275
- ?assertion dkg:assertionName ?name .
1276
- OPTIONAL { ?assertion prov:wasAttributedTo ?agentAttr }
1277
- BIND(COALESCE(?agentAssoc, ?agentAttr) AS ?agent)
1278
- OPTIONAL { ?assertion dkg:subGraphName ?subGraphName }
1279
- OPTIONAL { ?assertion dkg:assertionGraph ?assertionGraph }
1280
- OPTIONAL { ?event dkg:rootEntity ?root }
1281
- OPTIONAL { ?assertion dkg:rootEntity ?subjRoot }
1282
- }
1283
- } GROUP BY ?event ?type ?assertion ?name ?agent ?ts ?subGraphName ?assertionGraph
1284
- ORDER BY DESC(?ts) LIMIT 5000`}function Xr(e){if(e!=null)return typeof e=="string"?e.startsWith('"')?e.replace(/^"/,"").replace(/"(\^\^<[^>]*>)?$/,""):e:typeof e=="object"&&e!==null&&"value"in e?String(e.value):String(e)}function IM(e){return e===`${Mm}AssertionCreated`?"created":e===`${Mm}AssertionPromoted`?"promoted":null}function PM(e){const[t,n]=w.useState([]),[a,s]=w.useState(!!e),[l,u]=w.useState(null),[d,f]=w.useState(void 0),h=w.useRef(void 0),g=w.useRef(void 0);return w.useEffect(()=>{if(!e){s(!1);return}h.current!=null&&h.current!==e&&(n([]),u(null),f(void 0),g.current=void 0);let m=!1;const y=new AbortController;let b;return h.current=e,s(!0),u(null),(async()=>{var k;try{const j=new Promise((T,U)=>{b=setTimeout(()=>{y.abort(),U(new Error(`Assertion-lifecycle query timed out after ${Math.round(O1/1e3)}s`))},O1)}),N=(async()=>{const T=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Ft()},signal:y.signal,body:JSON.stringify({sparql:$M(e),contextGraphId:e})});if(!T.ok)throw new Error(`SPARQL query failed: ${T.status}`);return T.json()})(),S=await Promise.race([N,j]);if(m||h.current!==e)return;const A=((k=S==null?void 0:S.result)==null?void 0:k.bindings)??[],E=[];for(const T of A){const U=Xr(T.event),_=Xr(T.type),z=Xr(T.assertion),q=Xr(T.name),D=Xr(T.agent),R=Xr(T.ts);if(!U||!z||!D||!R)continue;const $=IM(_);if(!$)continue;let F;if($==="promoted"){const H=Xr(T.entityCount),B=H!=null?Number(H):NaN;if(Number.isFinite(B)&&B>0)F=B;else{const W=Xr(T.subjectEntityCount),Q=W!=null?Number(W):NaN;Number.isFinite(Q)&&Q>=0&&(F=Q)}}let I=Xr(T.subGraphName);if(I===void 0){const H=Xr(T.assertionGraph);H&&(I=zM(H,e))}E.push({eventUri:U,kind:$,assertionUri:z,assertionName:q??"",agentUri:D,publishedAt:R,subGraph:I,entityCount:F})}n(E),f(e),g.current=e,u(null)}catch(j){if(m||(j==null?void 0:j.name)==="AbortError")return;u(j.message??String(j)),g.current!==e&&n([]),f(e),g.current=e}finally{b&&clearTimeout(b),m||s(!1)}})(),()=>{m=!0,y.abort(),b&&clearTimeout(b)}},[e]),w.useMemo(()=>({resultContextGraphId:d,events:t,loading:a,error:l}),[d,t,a,l])}const UM=["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"],BM="http://www.w3.org/ns/prov#wasAttributedTo",FM=new Set(["http://dkg.io/ontology/decisions/Decision","http://dkg.io/ontology/tasks/Task","http://dkg.io/ontology/github/PullRequest","http://dkg.io/ontology/github/Issue","http://dkg.io/ontology/github/Commit"]);function Yg(e){const t=e.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),n=new Date(t);return Number.isFinite(n.getTime())?n:null}function Qg(e,t,n,a){const s=n?n.toISOString():"no-ts";return a&&a!==t?`${e}|${t}|${a}|${s}`:`${e}|${t}|${s}`}function HM(e){for(const t of UM){const n=e.properties.get(t);if(n!=null&&n.length)for(const a of n){const s=Yg(a);if(s)return s}}return null}function qM(e){for(const t of e.connections)if(t.predicate===BM)return t.targetUri;return null}function GM(e){for(const t of e.types)if(FM.has(t))return t;return null}function VM(e){for(const t of e.subGraphs)if(t!=="meta")return t;return null}function WM(e,t={}){const{limit:n=200,agentUri:a,typeIri:s,subGraph:l,includeUndated:u=!0,excludeEvents:d}=t,f=d?[...d].sort().join(","):"";return w.useMemo(()=>{const h=d&&d.length>0?new Set(d):null,g=[];for(const m of e){const y=GM(m);if(s&&y!==s)continue;const b=HM(m);if(!b&&(!u||!y))continue;const k=qM(m);if(a&&k!==a)continue;const j=VM(m);if(l&&j!==l)continue;const N=y?"typed":"added";if(h&&h.has(N))continue;const S=Qg(N,m.uri,b);g.push({id:S,entity:m,at:b,authorUri:k,kindUri:y,subGraph:j,layer:m.trustLevel,event:N,clickable:!0})}return g.sort((m,y)=>m.at&&y.at?y.at.getTime()-m.at.getTime():m.at&&!y.at?-1:!m.at&&y.at?1:m.entity.label.localeCompare(y.entity.label)),{items:g.slice(0,n),hasMore:g.length>n}},[e,n,a,s,l,u,f])}function ZM(e,t=new Date){const n=g=>{const m=new Date(g);return m.setHours(0,0,0,0),m},a=n(t),s=new Date(a.getTime()-1440*60*1e3),l=new Date(a.getTime()-10080*60*1e3),u={},d=[],f=(g,m,y)=>{u[g]||(u[g]={key:g,label:m,items:[]},d.push(g)),u[g].items.push(y)};for(const g of e){if(!g.at){f("undated","Undated",g);continue}const m=n(g.at);if(m.getTime()===a.getTime())f("today","Today",g);else if(m.getTime()===s.getTime())f("yesterday","Yesterday",g);else if(g.at.getTime()>=l.getTime())f("this-week","Earlier this week",g);else{const y=g.at.toLocaleString(void 0,{month:"long",year:"numeric"});f(`m-${y}`,y,g)}}const h=d.indexOf("undated");return h!==-1&&h<d.length-1&&(d.splice(h,1),d.push("undated")),d.map(g=>u[g])}function KM(e,t){const{entitiesByUri:n,agentUri:a,subGraph:s,limit:l=200}=t,u=[];for(const d of e){if(a&&d.agent!==a||s&&d.subGraph!==s)continue;const f=Yg(d.publishedAt);if(!f)continue;const h=bt(d.rootUri),g=n.get(h),m=g!=null;u.push({id:Qg("promoted",d.opUri,f,h),entity:g??YM(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 YM(e){return{uri:e,label:qg(e),types:[],trustLevel:"shared",layers:new Set(["shared"]),subGraphs:new Set,properties:new Map,connections:[]}}function QM(e,t={}){const{agentUri:n,subGraph:a,limit:s=200}=t,l=[];for(const u of e){if(n&&u.agentUri!==n||a&&u.subGraph!==a)continue;const d=Yg(u.publishedAt);if(!d)continue;const f=u.kind==="promoted"?"promoted":"added",h=u.kind==="promoted"?"shared":"working",g=bt(u.assertionUri);l.push({id:Qg(f,u.eventUri,d,g),entity:{uri:g,label:u.assertionName||qg(g),types:[],trustLevel:h,layers:new Set([h]),subGraphs:u.subGraph?new Set([u.subGraph]):new Set,properties:new Map,connections:[]},at:d,authorUri:u.agentUri,kindUri:null,subGraph:u.subGraph??null,layer:h,event:f,entityCount:u.entityCount,clickable:!1})}return l.sort((u,d)=>u.at&&d.at?d.at.getTime()-u.at.getTime():u.at&&!d.at?-1:!u.at&&d.at?1:u.entity.label.localeCompare(d.entity.label)),l.slice(0,s)}function XM(e,t={}){const{swmEvents:n,lifecycleEvents:a,...s}=t,l=a!=null,d=WM(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=QM(a,{agentUri:s.agentUri,subGraph:s.subGraph,limit:Number.POSITIVE_INFINITY});else{const y=new Map;for(const b of e)y.set(b.uri,b);h=KM(n,{entitiesByUri:y,agentUri:s.agentUri,subGraph:s.subGraph,limit:Number.POSITIVE_INFINITY})}const g=[...d.items,...h];g.sort((y,b)=>y.at&&b.at?b.at.getTime()-y.at.getTime():y.at&&!b.at?-1:!y.at&&b.at?1:y.entity.label.localeCompare(b.entity.label));const m=d.hasMore||g.length>f;return{items:g.slice(0,f),hasMore:m}},[d,n,a,l,e,s.agentUri,s.subGraph,s.limit,t.typeIri])}function kj(e,t=new Date){if(!e)return"—";const n=t.getTime()-e.getTime(),a=Math.abs(n),s=n<0,l=6e4,u=l*60,d=u*24;return a<l?s?"in a moment":"just now":a<u?s?`in ${Math.floor(a/l)}m`:`${Math.floor(a/l)}m ago`:a<d?s?`in ${Math.floor(a/u)}h`:`${Math.floor(a/u)}h ago`:a<7*d?s?`in ${Math.floor(a/d)}d`:`${Math.floor(a/d)}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}const L1={"claude-code":"⦿",openclaw:"◈",hermes:"⬡",gemini:"✧",human:"👤"};function JM(e,t){return e&&L1[e]?L1[e]:t==="human"?"👤":"◉"}function eD(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 tD(e){const t=e.trim();return t.length<=11?t:`${t.slice(0,6)}…${t.slice(-4)}`}const ts=({agent:e,fallbackUri:t,size:n="sm",showOperator:a=!1,onOpenAgent:s,className:l=""})=>{const u=cs();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?tD(t.split(":").pop()??t):"unknown"),g=(e==null?void 0:e.kind)??"ai",m=e==null?void 0:e.framework,y=JM(m,g),b=(e==null?void 0:e.color)??"hsl(0, 0%, 55%)",k=[h,m?`framework: ${m}`:null,e!=null&&e.operatorName?`operator: ${e.operatorName}`:null,e!=null&&e.walletAddress?`wallet: ${e.walletAddress}`:null,e!=null&&e.peerId?`peer: ${e.peerId.slice(0,20)}…`:null,e!=null&&e.reputation?`— ${e.reputation}`:null,f].filter(Boolean).join(`
1285
- `),j=d?()=>d(f):void 0,N=!!j;return o.jsxs("span",{className:`v10-agent-chip v10-agent-chip-${n}${N?" interactive":""} ${l}`,style:{"--agent-color":b},onClick:j?S=>{S.stopPropagation(),j()}:void 0,title:k,role:N?"button":void 0,tabIndex:N?0:void 0,children:[o.jsxs("span",{className:"v10-agent-chip-avatar",style:{background:b},children:[o.jsx("span",{className:"v10-agent-chip-initials",children:eD(h)}),o.jsx("span",{className:"v10-agent-chip-glyph",title:m??g,children:y})]}),o.jsxs("span",{className:"v10-agent-chip-body",children:[o.jsx("span",{className:"v10-agent-chip-name",children:h}),n==="lg"&&((e==null?void 0:e.operatorName)||m)&&o.jsxs("span",{className:"v10-agent-chip-sub",children:[m&&g==="ai"&&o.jsx("span",{className:"v10-agent-chip-fw",children:m}),(e==null?void 0:e.operatorName)&&g==="ai"&&o.jsxs(o.Fragment,{children:[m&&o.jsx("span",{className:"v10-agent-chip-sep",children:"·"}),o.jsxs("span",{className:"v10-agent-chip-op",children:["driven by ",e.operatorName]})]}),g==="human"&&o.jsx("span",{className:"v10-agent-chip-fw",children:"human"})]}),n==="md"&&a&&(e==null?void 0:e.operatorName)&&g==="ai"&&o.jsx("span",{className:"v10-agent-chip-sub",children:o.jsxs("span",{className:"v10-agent-chip-op",children:["· ",e.operatorName]})})]})]})},Dh={working:"#64748b",shared:"#f59e0b",verified:"#22c55e"},nD={working:"◇",shared:"◈",verified:"◉"},rD=200,aD=({entities:e,agentUri:t,typeIri:n,subGraph:a,limit:s,includeUndated:l=!0,swmEvents:u,lifecycleEvents:d,lifecycleError:f,title:h,onSelectEntity:g,onOpenAgent:m,emptyHint:y,className:b=""})=>{const{items:k,hasMore:j}=XM(e,{agentUri:t,typeIri:n,subGraph:a,limit:s,includeUndated:l,swmEvents:u,lifecycleEvents:d}),N=Ve.useMemo(()=>ZM(k),[k]),S=cs(),A=Ua(),T=j?`${s??rD}+`:String(k.length),U=f!=null&&k.length===0,_=h?o.jsxs("div",{className:"v10-activity-feed-title",children:[o.jsx("span",{className:"v10-activity-feed-title-label",children:h}),o.jsx("span",{className:"v10-activity-feed-title-count","data-state":U?"error":void 0,children:U?"—":T})]}):null,z=f?o.jsx("div",{className:"v10-activity-feed-error",role:"status","aria-live":"polite",title:f,children:"Couldn't load recent activity."}):null;return k.length===0?o.jsxs("div",{className:`v10-activity-feed v10-activity-feed-empty ${b}`,children:[_,z??o.jsx("div",{className:"v10-activity-feed-empty-hint",children:y??"No activity with a timestamp yet."})]}):o.jsxs("div",{className:`v10-activity-feed ${b}`,children:[_,z,N.map(q=>o.jsxs("div",{className:"v10-activity-feed-bucket",children:[o.jsxs("div",{className:"v10-activity-feed-bucket-head",children:[o.jsx("span",{className:"v10-activity-feed-bucket-label",children:q.label}),o.jsx("span",{className:"v10-activity-feed-bucket-count",children:q.items.length})]}),o.jsx("div",{className:"v10-activity-feed-items",children:q.items.map(D=>o.jsx(iD,{item:D,agents:S,profile:A,onSelectEntity:g,onOpenAgent:m},D.id))})]},q.key))]})};function iD({item:e,agents:t,profile:n,onSelectEntity:a,onOpenAgent:s}){const l=e.authorUri?t==null?void 0:t.get(e.authorUri):null,u=e.event==="typed",d=u&&e.kindUri?n==null?void 0:n.forType(e.kindUri):null,f=e.event==="added"?"Added":e.event==="promoted"?e.entityCount!=null&&e.entityCount>0?`Promoted to SWM · ${e.entityCount} ${e.entityCount===1?"entity":"entities"}`:"Promoted to SWM":e.event==="published"?"Published to VM":(d==null?void 0:d.label)??(e.kindUri?e.kindUri.split(/[#/]/).pop():null)??"Entity",h=e.event==="added"?"+":e.event==="promoted"?"⇡":e.event==="published"?"◉":(d==null?void 0:d.icon)??"◆",g=e.event==="promoted"?Dh.shared:e.event==="published"?Dh.verified:e.event==="added"?"#64748b":(d==null?void 0:d.color)??"#a855f7",m=Dh[e.layer],y=u?sD(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:nD[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-${oD(y)}`,children:y}),(l||e.authorUri)&&o.jsx("span",{className:"v10-activity-feed-author",children:o.jsx(ts,{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:()=>a(e.entity.uri),title:b,children:k}):o.jsx("div",{className:"v10-activity-feed-row v10-activity-feed-row-static",title:b,"aria-disabled":"true",children:k})}function sD(e){var n;const t=["http://dkg.io/ontology/decisions/status","http://dkg.io/ontology/tasks/status","http://dkg.io/ontology/github/state"];for(const a of t){const s=(n=e.properties.get(a))==null?void 0:n[0];if(s)return s}return null}function oD(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 lD={wm:"working",swm:"shared",vm:"verified"};function cD(e){var y,b,k,j;const t=new Map;if(!e)return t;const n="http://dkg.io/ontology/decisions/status",a="http://dkg.io/ontology/tasks/status",s="http://dkg.io/ontology/tasks/priority",l="http://dkg.io/ontology/github/state",u="http://dkg.io/ontology/decisions/Decision",d="http://dkg.io/ontology/tasks/Task",f="http://dkg.io/ontology/github/PullRequest";let h=0,g=0,m=0;for(const N of e)if(N.types.includes(u))((y=N.properties.get(n))==null?void 0:y[0])==="proposed"&&h++;else if(N.types.includes(d)){const S=(b=N.properties.get(s))==null?void 0:b[0],A=(k=N.properties.get(a))==null?void 0:k[0];S==="p0"&&A!=="done"&&A!=="cancelled"&&g++}else N.types.includes(f)&&((j=N.properties.get(l))==null?void 0:j[0])==="open"&&m++;return h>0&&t.set("decisions",{label:`${h} proposed`,tone:"warn"}),g>0&&t.set("tasks",{label:`${g} p0`,tone:"danger"}),m>0&&t.set("github",{label:`${m} open`,tone:"info"}),t}const zh=({contextGraphId:e,profile:t,selected:n,onSelect:a,entities:s,layer:l,enabledScope:u,allTriplesTotal:d})=>{const[f,h]=Ve.useState([]),[g,m]=Ve.useState(!0),y=Ve.useMemo(()=>cD(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([lD[l]]):null,[u,l]),j=Ve.useMemo(()=>{if(!s)return null;const I=new Map;for(const H of s)if(!(k&&!k.has(H.trustLevel)))for(const B of H.subGraphs)I.set(B,(I.get(B)??0)+1);return I},[k,s]),N=Ve.useMemo(()=>{if(!s)return null;let I=0;for(const H of s)k&&!k.has(H.trustLevel)||I++;return I},[k,s]),S=Ve.useMemo(()=>{if(!s)return null;let I=0;for(const H of s)k&&!k.has(H.trustLevel)||H.subGraphs.size>0||I++;return I},[k,s]),A=Ve.useCallback(()=>{const I=++b.current;m(!0),Mg(e).then(H=>{I===b.current&&h(H.subGraphs??[])}).catch(()=>{}).finally(()=>{I===b.current&&m(!1)})},[e]);Ve.useEffect(()=>(A(),()=>{b.current++}),[A]),xo(e,A);const E=Ve.useMemo(()=>f.filter(Kg).map(I=>{const H=t.forSubGraph(I.name),B=j!==null?j.get(I.name)??0:I.entityCount;return{slug:I.name,icon:H.icon??"•",color:H.color??"#64748b",displayName:H.displayName??I.name,description:H.description??I.description,rank:H.rank??99,entityCount:B,tripleCount:I.tripleCount,layerScoped:j!==null}}).sort((I,H)=>I.rank-H.rank),[f,t,j]),U=S!==null&&S>0||n===$r;if(g&&E.length===0&&!U||E.length===0&&!U)return null;const _=N??E.reduce((I,H)=>I+H.entityCount,0),z=E.reduce((I,H)=>I+H.tripleCount,0),q={working:"Working Memory",shared:"Shared Working Memory",verified:"Verifiable Memory"},D=k?[...k].map(I=>q[I]).join(" + "):null,R=D?` in ${D}`:"",F=`Total distinct entities — includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph · ${_} entities${R}${D?"":` · ${d??z} triples`}`,K=`All — total distinct entities. Includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph. ${_} entities${R}.`;return o.jsxs("div",{className:"v10-subgraph-bar",children:[o.jsx("div",{className:"v10-subgraph-bar-label",children:"Subgraphs"}),o.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===null?" active":""}`,onClick:()=>a(null),title:F,"aria-label":K,children:[o.jsx("span",{className:"v10-subgraph-chip-icon",children:"⊚"}),o.jsx("span",{className:"v10-subgraph-chip-label",children:"All"}),o.jsx("span",{className:"v10-subgraph-chip-count",children:_})]}),E.map(I=>{const H=y.get(I.slug);return o.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===I.slug?" active":""}${H?" has-badge":""}`,onClick:()=>a(I.slug,l),title:`${I.displayName}${I.description?" · "+I.description:""} · ${I.entityCount} entities${R}${D?"":` · ${I.tripleCount} triples`}${H?" · "+H.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}),H&&o.jsxs("span",{className:`v10-subgraph-chip-badge tone-${H.tone}`,children:[o.jsx("span",{className:"v10-subgraph-chip-badge-dot"}),H.label]})]},I.slug)}),U&&(()=>{const I=S??0,H=n===$r;return o.jsxs("button",{type:"button",className:`v10-subgraph-chip v10-subgraph-chip-root${H?" active":""}`,"data-active":H,"data-count":I,onClick:()=>a($r,l),title:`Entities not in any subgraph (Context Graph root) · ${I} entities${R}`,"aria-label":"Entities not in any subgraph (Context Graph root)",children:[o.jsx("span",{className:"v10-subgraph-chip-icon",children:"⊘"}),o.jsx("span",{className:"v10-subgraph-chip-label",children:"Root"}),o.jsx("span",{className:"v10-subgraph-chip-count",children:I})]})})()]})},Xg="context-graph-primer",Sj={id:Xg,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 ln({icon:e,title:t,description:n,actions:a=[],tone:s="neutral",compact:l=!1,inline:u=!1,className:d=""}){const f={"--v10-empty-accent":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}),a.length>0&&o.jsx("div",{className:"v10-empty-state-actions",children:a.map(h=>o.jsx("button",{type:"button",className:`v10-empty-state-action ${h.variant??"secondary"}`,onClick:h.onClick,"data-testid":h.testId,children:h.label},h.label))})]})]})}function Fd({items:e,layer:t,compact:n=!1,className:a=""}){const s=t?{"--v10-stat-accent":jj[t]}:void 0;return o.jsx("div",{className:["v10-stat-strip",n?"compact":"",a].filter(Boolean).join(" "),"data-layer":t,style:s,children:e.map((l,u)=>o.jsxs("div",{className:"v10-stat-strip-cell","data-stat-id":l.id,title:l.tooltip,children:[o.jsx("span",{className:"v10-stat-strip-label",children:l.label}),o.jsx("span",{className:"v10-stat-strip-value",children:l.value}),l.hint&&o.jsx("span",{className:"v10-stat-strip-hint",children:l.hint})]},l.id??u))})}const Jg=w.lazy(()=>gt(()=>import("./index-CwRQnNYh.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),uD="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",dD=new Map(Hg.map((e,t)=>[e,t]));function Dm(e){const t=e.trim();return!t||t.startsWith('"')?!1:t.startsWith("_:")||t.startsWith("<")&&t.endsWith(">")?!0:/\s/.test(t)?!1:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function Da(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function pD(e){const t=new Set,n=new Map,a=new Map,s=new Map;for(const d of e){const f=Da(d.subject);t.add(f);const h=dD.get(d.predicate);if(h!==void 0){const m=Pd(d.object).trim();if(m){const y=s.get(f);(y===void 0||h<y)&&(a.set(f,m),s.set(f,h))}}if(Da(d.predicate)===uD||!Dm(d.object))continue;const g=Da(d.object);n.set(f,(n.get(f)??0)+1),n.set(g,(n.get(g)??0)+1)}const l=[...t].filter(d=>(n.get(d)??0)===0).map(d=>({uri:d,label:a.get(d)??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(Da(d.subject))&&!u.has(Da(d.object))),singletonItems:l}}function fD(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 hD({items:e,onSelect:t}){return e.length===0?null:o.jsxs("div",{className:"v10-graph-singleton-shelf","aria-label":"Standalone entities without visible links",children:[o.jsxs("div",{className:"v10-graph-singleton-head",title:"Entities with no visible links are grouped here to keep the graph readable.",children:[o.jsx("span",{children:"Standalone entities"}),o.jsx("span",{children:e.length})]}),o.jsx("div",{className:"v10-graph-singleton-list",children:e.map(({uri:n,label:a})=>o.jsx("button",{type:"button",className:"v10-graph-singleton-item",title:n,onClick:()=>t==null?void 0:t(n),children:a},n))})]})}const mD=2500;function M1(e,t=mD){if(e.length<=t)return e;const n=new Map;for(const u of e)n.set(u.subject,(n.get(u.subject)??0)+1);const a=[...n.entries()].sort((u,d)=>d[1]-u[1]).map(([u])=>u),s=new Set;let l=0;for(const u of a){const d=n.get(u)??0;l+d>t||(s.add(u),l+=d)}return s.size===0&&a.length>0&&s.add(a[0]),e.filter(u=>s.has(u.subject)).slice(0,t)}function Xu({title:e,scopeLabel:t,tone:n,className:a,rail:s,overlay:l,showScopeLabel:u=!0,singletonItems:d=[],onSingletonClick:f,renderGraph:h}){const[g,m]=w.useState(!1);w.useEffect(()=>{if(!g)return;const k=j=>{j.key==="Escape"&&m(!1)};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[g]);const y=o.jsx("button",{type:"button",className:`v10-graph-expand-btn${u?"":" in-canvas"}`,onClick:()=>m(!0),title:`Expand ${e}`,"aria-label":`Expand ${e}`,children:"⤢"}),b=k=>o.jsxs(o.Fragment,{children:[u&&!k&&o.jsxs("div",{className:"v10-graph-shell-bar",children:[o.jsx("div",{className:"v10-graph-scope",title:t,children:t}),y]}),o.jsxs("div",{className:"v10-graph-body",children:[o.jsxs("div",{className:"v10-graph-canvas",children:[!u&&!k&&y,o.jsx("div",{className:"v10-graph-view",children:h(k)}),l&&o.jsx("div",{className:"v10-graph-overlay",children:l}),o.jsx(hD,{items:d,onSelect:f})]}),s&&o.jsx("aside",{className:"v10-graph-rail",children:s})]})]});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`v10-graph-shell v10-graph-shell-${n}${a?` ${a}`:""}`,children:!g&&b(!1)}),g&&o.jsx("div",{className:"v10-graph-expanded-backdrop",role:"dialog","aria-modal":"true","aria-label":`${e} expanded`,onClick:k=>{k.target===k.currentTarget&&m(!1)},children:o.jsxs("div",{className:`v10-graph-expanded-panel v10-graph-shell-${n}`,children:[o.jsxs("div",{className:"v10-graph-expanded-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"v10-graph-expanded-title",children:e}),o.jsx("div",{className:"v10-graph-expanded-subtitle",children:t})]}),o.jsx("button",{type:"button",className:"v10-graph-expanded-close",onClick:()=>m(!1),"aria-label":`Close expanded ${e}`,children:"×"})]}),o.jsx("div",{className:"v10-graph-expanded-body",children:b(!0)})]})})]})}function Cj({layer:e,triples:t,onNodeClick:n,contextGraphId:a,scopeLabel:s,trustLegendActiveLayer:l,title:u,scopeEntities:d,swmAttribution:f,layerEntities:h,nodeColorsOverride:g}){const{title:m}=zn[e],y=u??m,b=Vn(L=>L.theme),k=w.useMemo(()=>{if(e!=="vm")return;const L=new Set;for(const P of t)L.add(P.subject),Dm(P.object)&&L.add(P.object);return L},[t,e]),{anchors:j,decorationTriples:N}=L4(e==="vm"&&a?a:void 0,k),S=wj(e==="swm"&&a&&!f?a:void 0),A=f??S,E=w.useMemo(()=>{if(!h||h.length===0)return t;const L=new Set;for(const P of h)L.add(bt(P.uri));return hd(t,L)},[t,h]),T=w.useMemo(()=>{const L=new Set,P=[],G=O=>{const ne=`${O.subject}|${O.predicate}|${O.object}`;L.has(ne)||(L.add(ne),P.push({subject:O.subject,predicate:O.predicate,object:O.object}))};for(const O of E)G(O);for(const O of N)G(O);return P},[E,N]),U=T,_=w.useMemo(()=>{const L=e==="swm"?A.nodeColors:void 0;if(!(!L&&!g))return L?g?{...L,...g}:L:g},[e,A.nodeColors,g]),z=w.useMemo(()=>q4(e,_),[e,_]),{canvasTriples:q,singletonItems:D}=w.useMemo(()=>pD(U),[U]),R=w.useMemo(()=>{if(!d||d.length===0)return D;const L=new Set(D.map(G=>Da(G.uri)));for(const G of q)L.add(Da(G.subject)),Dm(G.object)&&L.add(Da(G.object));const P=[];for(const G of d){const O=Da(G.uri);L.has(O)||(L.add(O),P.push({uri:O,label:G.label||dj(void 0,O)}))}return P.length===0?D:[...D,...P].sort((G,O)=>G.label.localeCompare(O.label))},[D,q,d]),$=`${a??"context"}:${e}`,F=e==="swm"&&!!a&&A.loading,K=`${y} graph`,I=s??fD(e),H=l===null&&!!s,B=l===null?void 0:l??e,Q=e==="vm"&&j.length>0||e==="swm"&&A.palette.length>0?o.jsxs(o.Fragment,{children:[e==="vm"&&j.length>0&&o.jsx(vD,{anchors:j}),e==="swm"&&A.palette.length>0&&o.jsx(gD,{palette:A.palette,conflicts:A.conflicts.length})]}):null,V=w.useMemo(()=>({name:`${$}:${b}`,palette:b}),[$,b]);return T.length===0&&R.length===0?o.jsx(Xu,{title:K,scopeLabel:I,tone:e,className:"v10-graph-view-fill",showScopeLabel:H,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(ln,{compact:!0,tone:e,icon:zn[e].icon,title:`No triples in ${y}`,description:"The graph will appear when this layer has connected triples."})})}):F?o.jsx(Xu,{title:K,scopeLabel:I,tone:"swm",className:"v10-graph-view-fill",showScopeLabel:H,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(ln,{compact:!0,tone:"swm",icon:zn.swm.icon,title:"Loading Shared Working Memory attribution...",description:"Agent colors are being prepared before the graph renders."})})}):o.jsx(Xu,{title:K,scopeLabel:I,tone:e,className:"v10-graph-view-fill",overlay:Q,showScopeLabel:H,singletonItems:R,onSingletonClick:L=>n==null?void 0:n(B?{id:L,trustLayer:B}:{id:L}),renderGraph:L=>q.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(Jg,{data:q,format:"triples",options:z,viewConfig:V,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:B?P=>n==null?void 0:n({...P,trustLayer:B}):n,initialFit:!0},`${$}:${L?"expanded":"inline"}:${q.length}`)}):o.jsx("div",{className:"v10-graph-placeholder v10-graph-placeholder-centered",children:"Connected graph appears when this layer has linked entities."})})}function gD({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 vD({anchors:e}){var s;const t=w.useMemo(()=>{const l=new Set;for(const u of e)for(const d of u.agents)l.add(d);return l.size},[e]),n=(s=e[0])==null?void 0:s.publishedAt,a=(()=>{if(!n)return null;try{return new Date(n).toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return null}})();return o.jsxs("div",{className:"v10-vm-legend","aria-label":"Verifiable Memory legend",children:[o.jsxs("div",{className:"v10-vm-legend-row v10-vm-legend-head",children:[o.jsx("span",{children:"VM provenance layer"}),o.jsxs("span",{className:"v10-vm-legend-count",children:[e.length," anchor",e.length===1?"":"s"]})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#f5a524"},children:"◉"}),o.jsx("span",{className:"v10-vm-legend-label",children:"On-chain anchor"})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#c084fc"},children:"◈"}),o.jsxs("span",{className:"v10-vm-legend-label",children:["Agent identity (",t,")"]})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#4ade80"},children:"—"}),o.jsx("span",{className:"v10-vm-legend-label",children:"Signed / anchored edge"})]}),a&&o.jsxs("div",{className:"v10-vm-legend-foot",children:["Latest: ",a]})]})}function yD({active:e,counts:t,onSwitch:n,onShare:a,onImport:s,onRefresh:l}){const[u,d]=w.useState(!1),f=w.useRef(null),h=g=>{d(!1),n(g)};return w.useEffect(()=>{if(!u)return;const g=m=>{var b;const y=m.target;y&&((b=f.current)!=null&&b.contains(y))||d(!1)};return document.addEventListener("pointerdown",g),()=>document.removeEventListener("pointerdown",g)},[u]),o.jsxs("div",{className:"v10-layer-switcher",children:[o.jsxs("button",{className:`v10-layer-switch-btn ${e==="overview"?"active":""}`,"data-layer":"overview","aria-label":"Overview",title:"Overview",onClick:()=>h("overview"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"◎"}),o.jsx("span",{className:"v10-layer-switch-label",children:"Overview"})]}),o.jsx("span",{className:"v10-layer-switch-separator","aria-hidden":"true"}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="wm"?"active":""}`,"data-layer":"wm","aria-label":"Working Memory",title:"Working Memory",onClick:()=>h("wm"),children:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#64748b"},children:"◇"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Working Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"WM"}),t.wm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.wm})]}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="swm"?"active":""}`,"data-layer":"swm","aria-label":"Shared Working Memory",title:"Shared Working Memory",onClick:()=>h("swm"),children:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#f59e0b"},children:"◈"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Shared Working Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"SWM"}),t.swm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.swm})]}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="vm"?"active":""}`,"data-layer":"vm","aria-label":"Verifiable Memory",title:"Verifiable Memory",onClick:()=>h("vm"),children:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#22c55e"},children:"◉"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Verifiable Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"VM"}),t.vm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.vm})]}),o.jsx("span",{className:"v10-layer-switch-separator","aria-hidden":"true"}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="graph-overview"?"active":""}`,"data-layer":"graph-overview","aria-label":"Subgraphs",title:"Subgraphs",onClick:()=>h("graph-overview"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⌬"}),o.jsx("span",{className:"v10-layer-switch-label",children:"Subgraphs"})]}),o.jsxs("div",{ref:f,className:"v10-layer-more",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||d(!1)},children:[o.jsxs("button",{type:"button",className:`v10-layer-switch-btn v10-layer-more-btn ${e==="query"?"active":""}`,"data-layer":"query","aria-haspopup":"menu","aria-expanded":u,"aria-label":"More Context Graph views",title:"More Context Graph views",onClick:()=>d(g=>!g),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⋯"}),o.jsx("span",{className:"v10-layer-switch-label",children:"More"})]}),u&&o.jsx("div",{className:"v10-layer-more-menu",role:"menu",children:o.jsxs("button",{type:"button",role:"menuitem",className:`v10-layer-more-item ${e==="query"?"active":""}`,onClick:()=>h("query"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⟐"}),"Query Catalogue"]})})]}),o.jsx("div",{className:"v10-layer-switcher-spacer"}),o.jsxs("div",{className:"v10-layer-switcher-actions",children:[o.jsxs("button",{className:"v10-layer-action-btn",onClick:a,"aria-label":"Share Context Graph",children:[o.jsx("span",{className:"v10-layer-action-icon",children:"⤴"}),o.jsx("span",{className:"v10-layer-action-label",children:"Share"})]}),o.jsxs("button",{className:"v10-layer-action-btn",onClick:s,"aria-label":"Import into Context Graph",children:[o.jsx("span",{className:"v10-layer-action-icon",children:"↑"}),o.jsx("span",{className:"v10-layer-action-label",children:"Import"})]}),o.jsx("button",{className:"v10-layer-action-btn",onClick:l,"aria-label":"Refresh Context Graph data",children:o.jsx("span",{className:"v10-layer-action-icon",children:"↻"})})]})]})}function bD({cg:e,profile:t,activeSubGraph:n,onClearSubGraph:a}){const s=e.name||t.displayName||e.id;return o.jsxs("div",{className:"v10-project-strip",style:{"--sg-color":(n==null?void 0:n.color)??t.primaryColor},children:[o.jsx("span",{className:"v10-project-strip-dot",style:{background:t.primaryColor}}),o.jsx("button",{type:"button",className:"v10-project-strip-name",onClick:n?a:void 0,disabled:!n,title:n?"Back to context graph overview":e.id,children:s}),n?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-project-strip-sep",children:"›"}),o.jsxs("span",{className:"v10-project-strip-sg",children:[o.jsx("span",{className:"v10-project-strip-sg-icon",style:{color:n.color},children:n.icon??"•"}),n.displayName??n.slug]}),n.description&&o.jsx("span",{className:"v10-project-strip-desc",title:n.description,children:n.description})]}):e.description&&o.jsx("span",{className:"v10-project-strip-desc",title:e.description,children:e.description})]})}function xD(e,t,n,a,s){const l=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",u=new Set([t==null?void 0:t.agentDid,t==null?void 0:t.agentAddress].filter(h=>typeof h=="string"&&h.trim().length>0).map(Jt)),d=u.size>0;return l&&d&&u.has(Jt(l))?{label:"Curator",title:"This agent is the curator for this Context Graph.",tone:"curator"}:(e==null?void 0:e.callerInvolved)===!0?l&&!d&&n==="loading"?{label:"Role checking",title:"This agent is involved in this Context Graph; curator status is still loading.",tone:"unknown"}:l&&!d&&n==="error"?{label:"Role unknown",title:"This agent is involved in this Context Graph, but curator status could not be confirmed.",tone:"unknown"}:{label:"Joined",title:"This agent is involved in this Context Graph; curator status is shown only when identity metadata confirms it.",tone:"participant"}:(e==null?void 0:e.callerInvolved)===!1?{label:"Not joined",title:"This agent is not listed as curator or participant for this Context Graph.",tone:"viewer"}:s==="ok"&&a.map(h=>h.trim()).filter(Boolean).some(h=>u.has(Jt(h)))?{label:"Joined",title:"This agent is listed as a participant for this Context Graph.",tone:"participant"}:{label:"Role unknown",title:"The node did not provide enough role metadata for this Context Graph.",tone:"unknown"}}function wD(e,t,n){if(es(e==null?void 0:e.accessPolicy)==="public")return{id:"participants",value:"Open",label:"Public access",tooltip:"Public Context Graphs do not have an authoritative allowlist count."};if(n==="loading")return{id:"participants",value:"...",label:"Agents with access",tooltip:"Participant list is loading."};if(n==="error")return{id:"participants",value:"Unavailable",label:"Agents with access",tooltip:"Participant list unavailable; access count is unknown."};const s=new Set(t.map(u=>u.trim()).filter(Boolean).map(Jt)),l=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";return l&&s.add(Jt(l)),{id:"participants",value:s.size.toLocaleString(),label:"Agents with access",tooltip:"Includes the curator plus allowlisted participants reported by the node."}}function kD(e){const t=es(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 SD({cg:e,currentAgent:t,currentAgentStatus:n="ok"}){var d,f;const a=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";if(!a)return"unknown";const s=((d=t==null?void 0:t.agentDid)==null?void 0:d.trim())??"",l=((f=t==null?void 0:t.agentAddress)==null?void 0:f.trim())??"",u=s||l;return u?Jt(a)===Jt(u)?"curator":"not-curator":"unknown"}function jD(e){return new Set([e==null?void 0:e.agentDid,e==null?void 0:e.agentAddress].filter(t=>typeof t=="string"&&t.trim().length>0).map(Jt))}function CD({cg:e,memory:t,subGraphCount:n,subGraphFetchFailed:a=!1,participants:s,participantsStatus:l="ok",currentAgent:u,currentAgentStatus:d="ok",onSwitchLayer:f,onOpenPrimer:h}){var V,L,P;const{wm:g,swm:m,vm:y}=t.counts,b=g+m+y,k=xD(e,u??null,d,s,l),j=kD(e==null?void 0:e.accessPolicy),N=wD(e,s,l),S=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",A=S?Jt(S):"",E=es(e==null?void 0:e.accessPolicy)==="public",T=jD(u??null),U=Object.values(t.layerStatus??{}),_=U.filter(G=>G==="error").length,z=!t.loading&&U.length===3&&_===3,q=!t.loading&&_>0,D=t.loading?"Loading memory layers...":z||t.error?"Live memory counts are unavailable.":t.partial||q?"One or more layer counts are currently a lower bound.":"Canonical current-layer entity counts.",R=z?"Unavailable":b.toLocaleString(),{total:$}=Zg(t),F=!t.loading&&(t.partial||q),K=z?"Unavailable":t.loading&&$===0?"...":F?`${$.toLocaleString()}+`:$.toLocaleString(),I=z?"Live triple counts are unavailable.":F?"One or more layer triple counts are currently a lower bound.":"Canonical triple total across all layers.",H=n==null?a?"Unavailable":"...":n.toLocaleString(),B=n==null?a?"Sub-graph list is currently unavailable.":"Sub-graph count is loading.":"Topical partitions inside this Context Graph.",W=[{key:"wm",label:"Working Memory",desc:"Private staging area",count:g,status:((V=t.layerStatus)==null?void 0:V.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:((P=t.layerStatus)==null?void 0:P.vm)??"ok",color:"#22c55e"}],Q=W.some(G=>G.status==="error");return o.jsxs("div",{className:"v10-po",children:[o.jsxs("div",{className:"v10-po-identity","data-section":"identity",children:[o.jsxs("div",{className:"v10-po-identity-pairs",children:[o.jsxs("div",{className:"v10-po-identity-pair",children:[o.jsx("span",{className:"v10-po-identity-label",children:"Your role:"}),o.jsx("span",{className:"v10-po-badge","data-role":k.tone,title:k.title,children:k.label})]}),o.jsxs("div",{className:"v10-po-identity-pair",children:[o.jsx("span",{className:"v10-po-identity-label",children:"Context Graph:"}),o.jsx("span",{className:"v10-po-badge","data-cg-type":j.tone,title:j.title,children:j.label})]})]}),h&&o.jsx("button",{type:"button",className:"v10-po-identity-primer",onClick:h,title:"Open the Context Graph primer",children:"What is a Context Graph?"})]}),o.jsxs("div",{"data-section":"at-a-glance",className:"v10-po-stat-block",children:[o.jsx("div",{className:"v10-po-section-title",children:"At a glance"}),o.jsx(Fd,{className:"v10-po-stat-strip",items:[{id:"entities",value:R,label:"Entities",tooltip:D},{id:"triples",value:K,label:"Triples",tooltip:I},{id:"subgraphs",value:H,label:"Subgraphs",tooltip:B},N]})]}),o.jsxs("div",{className:"v10-po-pipeline","data-section":"pipeline","aria-label":"Knowledge Pipeline",children:[o.jsx("div",{className:"v10-po-pipeline-head",children:o.jsxs("div",{children:[o.jsx("div",{className:"v10-po-section-title",children:"Knowledge Pipeline"}),o.jsx("div",{className:"v10-po-section-desc",children:"Entities move from private staging to shared review; published assertion bundles become Knowledge Assets with on-chain provenance."})]})}),o.jsx("div",{className:"v10-po-pipeline-track","aria-hidden":"true",children:!Q&&b>0?W.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:W.map((G,O)=>o.jsxs("button",{type:"button",className:`v10-po-pipeline-step ${G.key}`,onClick:()=>f==null?void 0:f(G.key),style:{"--po-layer-color":G.color},children:[o.jsx("span",{className:"v10-po-pipeline-step-index",children:O+1}),o.jsxs("span",{className:"v10-po-pipeline-step-copy",children:[o.jsx("span",{className:"v10-po-pipeline-step-label",children:G.label}),o.jsx("span",{className:"v10-po-pipeline-step-desc",children:G.desc})]}),o.jsx("span",{className:"v10-po-pipeline-step-count",children:G.status==="error"?"Unavailable":`${G.count.toLocaleString()} ${ia(G.key,G.count)}`})]},G.key))})]}),o.jsxs("div",{className:"v10-po-people","data-section":"participants",children:[o.jsx("div",{className:"v10-po-section-title",children:"Participant agents"}),(()=>{const G="did:dkg:agent:",O=le=>le.toLowerCase().startsWith(G)?le.slice(G.length):le,ne=new Set,ue=[];if(S&&l==="ok"){const le=Jt(S);ne.add(le),ue.push({display:O(S),full:S,canonical:le})}if(l==="ok")for(const le of s){const be=Jt(le);ne.has(be)||(ne.add(be),ue.push({display:O(le),full:le,canonical:be}))}if(ue.length===0){const le=E?"This Context Graph is public — anyone can subscribe.":l==="loading"?"Loading participant agents...":l==="error"?"Participant list unavailable.":"No participant agents recorded yet.";return o.jsx("div",{className:"v10-po-people-empty",children:le})}return o.jsx("div",{className:"v10-po-participants-list",children:ue.map(({display:le,full:be,canonical:_e})=>{const Ee=T.has(_e),Ie=!!A&&_e===A,We=`${le.slice(0,6)}…${le.slice(-4)}`,Se=[We];return Ee&&Se.push("you"),Ie&&Se.push("curator"),o.jsxs("span",{className:`v10-po-participant${Ee?" is-self":""}${Ie?" is-curator":""}`,title:be,"aria-label":Se.join(" "),children:[o.jsx("span",{className:"v10-po-participant-name",children:We}),Ee&&o.jsx("span",{className:"v10-po-participant-tag",children:"you"}),Ie&&o.jsx("span",{className:"v10-po-participant-tag",children:"curator"})]},_e)})})})()]})]})}function ND({contextGraphId:e,curatorStatus:t,onParticipantsChanged:n}){const[a,s]=w.useState([]),[l,u]=w.useState(null),[d,f]=w.useState("loading"),h=w.useRef(0),g=w.useCallback(()=>{if(t!=="curator"){s([]),f("idle");return}const b=++h.current;f("loading"),RS(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]),ss(w.useCallback(b=>{var k;b.type!=="join_request"&&b.type!=="join_approved"&&b.type!=="join_rejected"||((k=b.data)==null?void 0:k.contextGraphId)===e&&g()},[e,g])),t==="not-curator")return null;if(t==="unknown")return o.jsxs("section",{className:"v10-po-join","data-section":"join-requests",children:[o.jsx("header",{className:"v10-po-join-head",children:o.jsx("span",{className:"v10-po-section-title",children:"Pending join requests"})}),o.jsx("div",{className:"v10-po-join-empty",children:"Verifying access…"})]});const m=async b=>{u(b);try{await Ng(e,b),s(k=>k.filter(j=>j.agentAddress!==b)),n==null||n()}catch{}finally{u(null)}},y=async b=>{u(b);try{await Eg(e,b),s(k=>k.filter(j=>j.agentAddress!==b)),n==null||n()}catch{}finally{u(null)}};return o.jsxs("section",{className:"v10-po-join","data-section":"join-requests",children:[o.jsxs("header",{className:"v10-po-join-head",children:[o.jsx("span",{className:"v10-po-section-title",children:"Pending join requests"}),o.jsx("span",{className:"v10-po-join-count","data-empty":a.length===0?"true":"false",children:a.length})]}),d==="loading"?o.jsx("div",{className:"v10-po-join-empty",children:"Loading join requests..."}):d==="error"?o.jsx("div",{className:"v10-po-join-empty",children:"Join requests are currently unavailable."}):a.length===0?o.jsx("div",{className:"v10-po-join-empty",children:"No pending join requests."}):o.jsx("div",{className:"v10-po-join-list",children:a.map(b=>o.jsxs("div",{className:"v10-po-join-item",children:[o.jsxs("div",{className:"v10-po-join-info",children:[o.jsx("span",{className:"v10-po-join-name",children:b.name||`${b.agentAddress.slice(0,6)}…${b.agentAddress.slice(-4)}`}),o.jsxs("span",{className:"v10-po-join-addr",title:b.agentAddress,children:[b.agentAddress.slice(0,10),"…"]})]}),o.jsxs("div",{className:"v10-po-join-actions",children:[o.jsx("button",{className:"v10-po-join-btn approve",onClick:()=>m(b.agentAddress),disabled:l===b.agentAddress,children:l===b.agentAddress?"…":"✓ Approve"}),o.jsx("button",{className:"v10-po-join-btn reject",onClick:()=>y(b.agentAddress),disabled:l===b.agentAddress,"aria-label":"Reject join request",children:"✕"})]})]},b.agentAddress))})]})}function ED({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 AD=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();function TD(e,t=0){const n=Pl(u=>u.trackedIds),a=n.join(","),{data:s,loading:l}=lr(async()=>{if(n.length===0)return{wallets:[],ownerPublish:!1,resolved:!1};const u=await Lg().catch(()=>null),d=(u==null?void 0:u.wallets)??[];let f=!1;try{const{contextGraphs:g}=await Ld(),m=(g??[]).find(b=>(b==null?void 0:b.id)===e),y=m==null?void 0:m.curator;if(y){const b=await Yl().catch(()=>null);f=!!(b!=null&&b.agentDid&&Jt(y)===Jt(b.agentDid))}}catch{f=!1}return{wallets:await Promise.all(d.map(async g=>{var T;const m=(T=u==null?void 0:u.balances)==null?void 0:T.find(U=>AD(U.address,g)),y=m==null,b=m!=null&&Number(m.eth)>0,k=m!=null&&Number(m.trac)>0;let j,N=!1,S=!1,A,E=!1;for(const U of n){const _=await od(U,g,{extended:!0}).catch(()=>null);if(_===null){E=!0;continue}const z=jm(_);if(z.outcome==="inconclusive"){E=!0;continue}if(z.outcome!=="unregistered"){if(z.outcome==="covers"){j={accountId:U,discountBps:_.discountBps,untracked:!1};break}z.dead&&(N=!0,A||(A=U)),z.hasBudget||(S=!0)}}if(!j&&!E&&!N&&!S){const U=await i_(g).catch(()=>{});if(U===void 0)E=!0;else if(U.accountId!=null&&!n.includes(U.accountId)){const _=U.accountId,z=await od(_,g,{extended:!0}).catch(()=>null);if(z===null)E=!0;else{const q=jm(z);q.outcome==="covers"?j={accountId:_,discountBps:z.discountBps,untracked:!0}:q.outcome==="uncovered"?(q.dead&&(N=!0,A||(A=_)),q.hasBudget||(S=!0)):E=!0}}}return{wallet:g,covered:!!j,accountId:j==null?void 0:j.accountId,discountBps:j==null?void 0:j.discountBps,coverUntracked:(j==null?void 0:j.untracked)??!1,deadAccountId:j?void 0:A,inconclusive:!j&&E,balanceUnknown:y,gasFunded:b,hasTrac:k,sawExpired:N,sawInsolvent:S}})),ownerPublish:f,resolved:d.length>0}},[a,e],t);return w.useMemo(()=>{const u=(s==null?void 0:s.wallets)??[],d=(s==null?void 0:s.ownerPublish)??!1,f=(s==null?void 0:s.resolved)??!1;if(n.length===0||!f||u.length===0)return{verdict:"unknown",loading:l,ownerPublish:d,anyGasFunded:!1,reasons:[],conditions:{approved:!1,gasFunded:!1,notExpired:!1,solvent:!1},wallets:u};const h=u.filter(S=>S.covered),g=u.filter(S=>!S.covered),m=g.filter(S=>!S.inconclusive&&!S.balanceUnknown),y=g.filter(S=>S.inconclusive||S.balanceUnknown),b={approved:g.length===0,gasFunded:u.every(S=>S.gasFunded),notExpired:!u.some(S=>S.sawExpired),solvent:!u.some(S=>S.sawInsolvent)};let k;const j=[];if(g.length===0)h.some(S=>S.gasFunded||S.balanceUnknown)?k="eligible":(k="fallthrough-no-funds",j.push("every approved signing wallet is out of gas"));else if(m.length===0&&y.length>0)k="unknown";else{const S=u.some(A=>(A.covered||A.hasTrac)&&A.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(A=>A.sawExpired)&&j.push("a PCA has expired or been fully swept"),u.some(A=>A.sawInsolvent)&&j.push("a PCA is out of budget"),b.gasFunded||j.push("a signing wallet has no gas"),g.some(A=>A.inconclusive)&&j.push("a wallet’s PCA coverage couldn’t be checked"),g.some(A=>A.balanceUnknown)&&j.push("a signing wallet’s balance couldn’t be checked"))}const N=h.reduce((S,A)=>(A.discountBps??-1)>((S==null?void 0:S.discountBps)??-1)?A:S,void 0);return{verdict:k,loading:l,accountId:N==null?void 0:N.accountId,discountBps:N==null?void 0:N.discountBps,accountUntracked:N==null?void 0:N.coverUntracked,ownerPublish:d,anyGasFunded:u.some(S=>S.gasFunded||S.balanceUnknown),reasons:j,conditions:b,wallets:u}},[s,l,n.length])}function _D(e){return e.verdict==="fallthrough-no-funds"&&!(e.ownerPublish&&e.anyGasFunded)}function RD(e){const t=Pl(u=>u.trackedIds),n=TD(e,3e4),a=_D(n),s="Publish will fail — no signing wallet can fund it (coverage or gas).",l=t.length>0;return{blocked:a,reason:s,chipVisible:l,eligibility:n}}function OD({verdict:e,accountId:t,discountBps:n,accountUntracked:a,ownerPublish:s,id:l}){return o.jsx("div",{className:"v10-pca-publish-chip",id:l,"data-testid":"pca-publish-eligibility",children:o.jsx(qO,{variant:"chip",verdict:e,accountId:t,discountBps:n,accountUntracked:a,ownerPublish:s})})}function ev({title:e,agent:t,footnote:n,dismissed:a,onDismiss:s,children:l}){return o.jsxs("div",{className:`v10-gen-widget ${a?"dissolved":""}`,children:[o.jsxs("div",{className:"v10-gen-widget-header",children:[o.jsx("span",{className:"v10-gen-widget-title",children:e}),o.jsxs("div",{className:"v10-gen-widget-right",children:[t&&o.jsxs("span",{className:"v10-gen-widget-agent",children:[o.jsx("span",{className:"v10-gen-widget-agent-dot"}),t]}),s&&o.jsx("button",{className:"v10-gen-widget-dismiss",onClick:s,children:"✕"})]})]}),o.jsx("div",{className:"v10-gen-widget-body",children:l}),n&&o.jsx("div",{className:"v10-gen-widget-footnote",children:n})]})}function LD({entities:e}){const t=Ua(),n=w.useMemo(()=>{const a=new Map;for(const s of e){const{icon:l,type:u}=Bd(s,t),d=a.get(u);d?d.count++:a.set(u,{icon:l,count:1})}return[...a.entries()].sort((s,l)=>l[1].count-s[1].count)},[e,t]);return n.length===0?null:o.jsx(ev,{title:"Entity Types",children:o.jsx(Fd,{compact:!0,items:n.map(([a,{icon:s,count:l}])=>({id:a,label:`${s} ${a}`,value:l}))})})}function MD({entities:e,entityCount:t,triples:n,layer:a}){const s=w.useMemo(()=>e.filter(d=>d.properties.has("http://dkg.io/ontology/sourceContentType")).length,[e]),l=w.useMemo(()=>e.reduce((d,f)=>d+f.connections.length,0),[e]),u=e.length>0?(l/e.length).toFixed(1):"0";return o.jsx(ev,{title:"Layer Stats",children:o.jsx(Fd,{compact:!0,layer:a,items:[{id:"entities",label:ia(a,t),value:t},{id:"triples",label:"Triples",value:n},{id:"connections",label:"Connections",value:l},{id:"avg",label:"Avg. connections / entity",value:u},...s>0?[{id:"documents",label:"Documents",value:s}]:[]]})})}function Nj(e,t){const[n,a]=w.useState(!1),[s,l]=w.useState(null),[u,d]=w.useState(null),f=w.useCallback(async(h,g)=>{a(!0),d(null),l(null);try{const m=await h();l(m),e==null||e({ok:!0,text:m}),t==null||t()}catch(m){const y=g(m);d(y),e==null||e({ok:!1,text:y})}finally{a(!1)}},[e,t]);return{busy:n,result:s,error:u,run:f}}function Ej({title:e,footnote:t,context:n,result:a,error:s,extras:l,children:u}){return o.jsxs(ev,{title:e,footnote:t,children:[o.jsx("div",{className:"v10-decision-context",style:{marginBottom:10},children:n}),a&&o.jsxs("div",{"data-testid":"layer-action-result",style:{fontSize:11,color:"var(--text-success)",marginBottom:8},children:["✓ ",a]}),s&&o.jsxs("div",{"data-testid":"layer-action-error",style:{fontSize:11,color:"var(--text-danger)",marginBottom:8},children:["✕ ",s]}),l,o.jsx("div",{className:"v10-decision-actions",children:u})]})}function DD({count:e,contextGraphId:t,onComplete:n,onResult:a}){const{busy:s,result:l,error:u,run:d}=Nj(a,n),f=w.useCallback(()=>{let m=null;d(async()=>{const y=await Ql(t,"wm");let b=0;for(const j of y)m=j.name,(await lo(t,j.name,j.subGraph?{subGraphName:j.subGraph}:{})).promotedCount===0&&(b+=1);const k=y.length-b;if(k>0){const j=b>0?` (${b} already shared or still committing)`:"";return`Shared ${k} complete Knowledge Asset${k!==1?"s":""} to Shared Memory${j}`}return"No Knowledge Assets were newly shared — all were already in Shared Memory or still committing."},y=>{const b=co(m??"an assertion",y);return b?b.message:(y==null?void 0:y.message)??"Action failed"})},[t,d]);if(e===0)return null;const h="#f59e0b",g=ia("wm",e).toLowerCase();return o.jsx(Ej,{title:"Share complete Knowledge Assets",footnote:"Shares each complete owning Knowledge Asset atomically to Shared Working Memory.",context:o.jsxs(o.Fragment,{children:["The displayed ",g," will be shared through their complete owning Knowledge Assets for collaborative review."]}),result:l,error:u,children:o.jsx("button",{"data-testid":"widget-promote-all-btn",className:"v10-decision-btn approve",style:{borderColor:`${h}50`,color:"var(--text-warning)",background:`${h}15`,opacity:s?.5:1},disabled:s,onClick:f,children:s?"...":"✓ Share Complete KAs → Shared"})})}function zD({count:e,contextGraphId:t,onComplete:n,onResult:a}){const[s,l]=w.useState(null),{busy:u,result:d,error:f,run:h}=Nj(a,n),g=RD(t),m=w.useId(),y=w.useId(),b=[g.chipVisible?m:null,g.blocked?y:null].filter(Boolean).join(" ")||void 0,k=w.useCallback(()=>{g.blocked||h(async()=>{l(null);const N=await Ql(t,"swm"),S=await Tg(t,N);if(S.published>0){const A=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${A}${E}`}if(N.length===0)return"Nothing to publish — promote assertions to Shared Memory first.";throw new Error(S.failures[0]?`${S.failures[0].name}: ${S.failures[0].error}`:"Publish failed")},N=>(N==null?void 0:N.message)??"Action failed")},[t,h,g.blocked]);if(e===0)return null;const j=ia("swm",e).toLowerCase();return o.jsx(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(OD,{...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 $D({layer:e,entities:t,entityCount:n,tripleCount:a,contextGraphId:s,onComplete:l}){const[u,d]=w.useState(null),f=u&&o.jsxs("div",{"data-testid":u.ok?"layer-action-result":"layer-action-error",style:{fontSize:11,color:u.ok?"var(--text-success)":"var(--text-danger)",marginBottom:8},children:[u.ok?"✓":"✕"," ",u.text]});return n===0?o.jsxs("div",{className:"v10-layer-widgets-strip empty",children:[f,o.jsx(ln,{compact:!0,tone:e,icon:zn[e].icon,title:`No ${ia(e,2).toLowerCase()} yet`,description:e==="wm"?"Import data or chat with agents to populate Working Memory.":e==="swm"?"Seal and share complete Knowledge Assets from Working Memory with the team.":"Publish complete Knowledge Assets from Shared Working Memory to verify them on-chain."})]}):o.jsxs("div",{className:"v10-layer-widgets-strip",children:[o.jsxs("div",{className:"v10-layer-widgets-strip-stats",children:[o.jsx(MD,{entities:t,entityCount:n,triples:a,layer:e}),o.jsx(LD,{entities:t})]}),(e==="wm"||e==="swm")&&s&&o.jsx("div",{className:"v10-layer-widgets-strip-action",children:e==="wm"?o.jsx(DD,{count:n,contextGraphId:s,onComplete:l,onResult:d}):o.jsx(zD,{count:n,contextGraphId:s,onComplete:l,onResult:d})})]})}const tv="doc:";function ID(e,t,n){return`${tv}${e}|${t}|${n}`}function PD(e,t,n){return e?{ref:e,contentType:"text/markdown"}:t?{ref:t,contentType:n}:{ref:void 0,contentType:n}}function UD(e){const t=e.slice(tv.length),n=t.indexOf("|"),a=t.lastIndexOf("|");return n<0?{docRef:t,contentType:""}:{docRef:t.slice(n+1,a),contentType:t.slice(a+1)}}function nv(e,t){if(e.length<=t)return e;const n=t-1,a=Math.ceil(n/2),s=n-a;return`${e.slice(0,a)}…${e.slice(-s)}`}const BD={working:{layerKey:"wm",icon:"◇",label:"Working"},shared:{layerKey:"swm",icon:"◈",label:"Shared"},verified:{layerKey:"vm",icon:"◉",label:"Verifiable"}};function Aj({entities:e,layerKey:t,layerIcon:n,onSelectEntity:a,onOpenAgent:s,externallySorted:l=!1,sortLabel:u,headerExtra:d,timestampPredicate:f,perEntityTrustBadge:h=!1}){const g=Ua(),m=cs(),y=ia(t,e.length).toLowerCase(),b=w.useMemo(()=>{if(l)return e;const N=[...e];return N.sort((S,A)=>{const E=S.tripleCount??0;return(A.tripleCount??0)-E}),N},[e,l]),k=t==="vm"?"Verifiable":t==="swm"?"Shared":"Working";if(e.length===0)return o.jsx("div",{className:"v10-entity-list empty",children:o.jsx(ln,{compact:!0,tone:t,icon:n,title:`No ${ia(t,2).toLowerCase()} yet`,description:`This view will fill when matching ${ia(t,2).toLowerCase()} are available.`})});const j=u??(l?"click to open":"sorted by triples · click to open");return o.jsxs("div",{className:"v10-entity-list",children:[o.jsxs("div",{className:"v10-entity-list-header",children:[o.jsxs("span",{className:"v10-entity-list-count",children:[b.length," ",y]}),o.jsx("span",{className:"v10-entity-list-hint",children:j}),d&&o.jsx("span",{className:"v10-entity-list-extra",children:d})]}),b.map(N=>{const{icon:S,type:A}=Bd(N,g),E=N.tripleCount??0,T=Ud(N),U=T?m==null?void 0:m.get(T):null,_=f?Qu(N,f):null;return o.jsxs("div",{className:"v10-entity-card",onClick:z=>{z.stopPropagation(),a(N.uri)},children:[o.jsx("span",{className:"v10-entity-card-icon",children:S}),o.jsxs("div",{className:"v10-entity-card-main",children:[o.jsx("div",{className:"v10-entity-card-title",children:N.label}),o.jsxs("div",{className:"v10-entity-card-meta",children:[(U||T)&&o.jsx(ts,{agent:U??void 0,fallbackUri:T??void 0,size:"sm",onOpenAgent:s}),A&&A!=="Entity"&&o.jsxs("span",{className:"v10-entity-type-pill",children:[S," ",A]}),_!=null&&o.jsx("span",{className:"v10-entity-card-timestamp",title:new Date(_).toLocaleString(),children:X4(_)}),o.jsxs("span",{className:"v10-entity-card-triples",children:[E," triples"]})]})]}),h?(()=>{const z=BD[N.trustLevel];return o.jsxs("span",{className:`v10-trust-badge ${z.layerKey}`,title:`${z.label} Memory`,children:[z.icon," ",z.label]})})():o.jsxs("span",{className:`v10-trust-badge ${t}`,children:[n," ",k]})]},N.uri)})]})}function FD({layer:e,entities:t,tripleCount:n,layerTriples:a,contextGraphId:s,memory:l,activeTab:u,onTabChange:d,onSelectEntity:f,onNodeClick:h,footer:g,swmAttribution:m}){var T;const y=zn[e],b=ia(e,2),k=((T=l.layerStatus)==null?void 0:T.vm)??(l.loading?"loading":l.error?"error":"ok"),j=e==="vm"&&k==="loading"&&t.length===0,N=e==="vm"&&k==="error"&&t.length===0,S=e==="vm"&&k==="ok"&&t.length===0,A=l.counts[e],E=U=>_=>{_.stopPropagation(),d(U)};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-layer-expand-tabs",children:[o.jsx("button",{className:`v10-layer-expand-tab ${u==="items"?"active":""}`,onClick:E("items"),children:b}),e!=="vm"&&o.jsx("button",{className:`v10-layer-expand-tab ${u==="assertions"?"active":""}`,onClick:E("assertions"),children:"Assertions"}),o.jsx("button",{className:`v10-layer-expand-tab ${u==="graph"?"active":""}`,onClick:E("graph"),children:"Graph"}),o.jsx("button",{className:`v10-layer-expand-tab ${u==="docs"?"active":""}`,onClick:E("docs"),children:"Documents"})]}),u==="items"&&o.jsxs("div",{className:"v10-layer-expand-body entities-tab","data-cg-scroll-key":`layer:${e}:items`,children:[e==="vm"&&!j&&!N&&o.jsx(HD,{entities:t,tripleCount:n,contextGraphId:s}),j?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(ln,{compact:!0,tone:"vm",icon:zn.vm.icon,title:"Loading Verifiable Memory...",description:"Knowledge Assets are being read from the verified layer."})}):N?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(ln,{compact:!0,tone:"vm",icon:zn.vm.icon,title:"Verifiable Memory status unavailable.",description:"This node could not read the verified layer right now."})}):!S&&o.jsxs(o.Fragment,{children:[o.jsx($D,{layer:e,entities:t,entityCount:A,tripleCount:n,contextGraphId:s,onComplete:l.refresh}),o.jsx(Aj,{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(qD,{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:a,onNodeClick:h,contextGraphId:s,swmAttribution:e==="swm"?m:void 0,layerEntities:t})}),u==="docs"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(Tj,{entities:t,contextGraphId:s,scrollKey:`layer:${e}:docs`})})]})}function HD({entities:e,tripleCount:t,contextGraphId:n}){const a=e.length,s=new Set;for(const u of e)for(const d of u.types)s.add(d);const l=s.size;return a===0?o.jsxs("div",{className:"v10-vm-hero v10-vm-hero-empty",children:[o.jsxs("div",{className:"v10-vm-hero-title",children:[o.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),o.jsxs("div",{className:"v10-vm-hero-heading",children:[o.jsx("span",{className:"v10-vm-hero-headline",children:"Nothing published yet"}),o.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),o.jsx(ln,{compact:!0,className:"v10-vm-empty-state",tone:"vm",icon:zn.vm.icon,title:"No Knowledge Assets yet.",description:"Publish complete Knowledge Assets from Shared Working Memory to verify them on-chain."})]}):o.jsxs("div",{className:"v10-vm-hero",children:[o.jsxs("div",{className:"v10-vm-hero-title",children:[o.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),o.jsxs("div",{className:"v10-vm-hero-heading",children:[o.jsx("span",{className:"v10-vm-hero-headline",children:"On-chain anchored · cryptographically signed"}),o.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),o.jsx(Fd,{className:"v10-vm-hero-stats",layer:"vm",items:[{id:"assets",value:a,label:"Knowledge Assets"},{id:"triples",value:t.toLocaleString(),label:"Verifiable Triples"},{id:"types",value:l,label:"Entity Types"}]}),o.jsxs("div",{className:"v10-vm-hero-strip",children:[o.jsxs("div",{className:"v10-vm-hero-chip",title:"Multi-agent endorsement",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#22c55e"}}),"Consensus"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Published to the DKG blockchain anchor",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#3b82f6"}}),"On-chain"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Each contribution bound to a DID",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#a855f7"}}),"Agent Identity"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Tamper-evident via content hashing",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#f59e0b"}}),"Content Hash"]})]})]})}function qD({contextGraphId:e,layer:t,onComplete:n,scrollKey:a}){const{data:s,loading:l,refresh:u}=lr(()=>Ql(e,t),[e,t],0),{data:d}=lr(()=>x_(e),[e,t],0),[f,h]=w.useState(null),[g,m]=w.useState(null),[y,b]=w.useState(null),k=w.useCallback(async E=>{h(E.graphUri),m(null),b(null);try{if(t==="wm"){const T=await lo(e,E.name,E.subGraph?{subGraphName:E.subGraph}:{}),U=_g(E.name,T);m(U.message)}else{const T=await Ag(e,E.name,E.subGraph?{subGraphName:E.subGraph}:{});m(T.contextGraphError?`Published ${E.name} on-chain — ⚠ ${Il(T.contextGraphError)}`:`Published ${E.name} to Verifiable Memory`)}u(),n()}catch(T){const U=co(E.name,T);b(U?U.message:(T==null?void 0:T.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 T=0;for(const _ of s)E=_.name,(await lo(e,_.name,_.subGraph?{subGraphName:_.subGraph}:{})).promotedCount===0&&(T+=1);const U=s.length-T;if(U>0){const _=T>0?` (${T} already shared or still committing)`:"";m(`Shared ${U} complete Knowledge Asset${U!==1?"s":""}${_}`)}else m("No Knowledge Assets were newly shared — all were already in Shared Memory or still committing.")}else{const T=await Tg(e,s);if(T.published>0){const U=T.failures.length?` (${T.failures.length} could not be published)`:"",_=T.partial>0?` — ⚠ ${T.partial}: ${Il(T.partialError)}`:"";m(`Published ${T.published} knowledge asset${T.published!==1?"s":""} to Verifiable Memory${U}${_}`)}else throw new Error(T.failures[0]?`${T.failures[0].name}: ${T.failures[0].error}`:"Publish failed")}u(),n()}catch(T){const U=co(E??"selected assertion",T);b(U?U.message:(T==null?void 0:T.message)??"Action failed")}finally{h(null)}},[s,e,t,u,n]),N={flex:1,overflow:"auto"};if(l)return o.jsx("div",{className:"v10-layer-empty-shell",style:N,"data-cg-scroll-key":a,children:o.jsx(ln,{compact:!0,tone:t,icon:zn[t].icon,title:"Loading assertions..."})});if(!(s!=null&&s.length))return o.jsx("div",{className:"v10-layer-empty-shell",style:N,"data-cg-scroll-key":a,children:o.jsx(ln,{tone:t,icon:zn[t].icon,title:t==="swm"?"No Shared Working Memory assertions listed yet.":"No Working Memory assertions yet.",description:t==="swm"?"Promoted assertion contents are available as Shared Working Memory entities. The assertion list will populate once promoted assertions are exposed by the node.":"Create or import data to stage assertions in Working Memory."})});const S=t==="wm"?"Share Complete KA → Shared":"Publish to VM",A=t==="wm"?"Share Complete KAs → Shared":"Publish all to Verifiable Memory";return o.jsxs("div",{style:N,"data-cg-scroll-key":a,children:[o.jsxs("div",{style:{padding:"8px 16px",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid var(--border-subtle)"},children:[o.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:[s.length," assertion",s.length!==1?"s":""]}),o.jsx("button",{className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:f!==null,onClick:j,style:{opacity:f==="__all__"?.5:1},children:f==="__all__"?"...":A})]}),g&&o.jsxs("div",{"data-testid":t==="wm"?"assertion-promote-result":"assertion-publish-result",style:{padding:"6px 16px",fontSize:11,color:"var(--text-success)"},children:["✓ ",g]}),y&&o.jsxs("div",{"data-testid":t==="wm"?"assertion-promote-result":"assertion-publish-result",style:{padding:"6px 16px",fontSize:11,color:"var(--text-danger)"},children:["✕ ",y]}),s.map(E=>o.jsxs("div",{className:"v10-item-row","data-testid":"assertion-list-row",children:[o.jsx("span",{className:"v10-item-icon",children:"▤"}),o.jsxs("div",{className:"v10-item-info",children:[o.jsx("div",{className:"v10-item-name",style:{fontFamily:"var(--font-mono)",fontSize:11},children:E.name}),(d==null?void 0:d[E.name])&&o.jsx("div",{className:"v10-item-ual",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",opacity:.7,wordBreak:"break-all",marginTop:1},title:d[E.name],children:d[E.name]}),o.jsxs("div",{className:"v10-item-meta-row",children:[E.tripleCount!=null&&o.jsxs("span",{className:"v10-item-count",children:[E.tripleCount," triples"]}),E.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${E.subGraph}`,children:["› ",nv(E.subGraph,18)]})]})]}),o.jsx("button",{"data-testid":"assertion-row-action",className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:f!==null,onClick:T=>{T.stopPropagation(),k(E)},style:{opacity:f===E.graphUri?.5:1,flexShrink:0},children:f===E.graphUri?"...":S})]},E.graphUri))]})}function GD({layer:e,memory:t,onNodeClick:n,onSelectEntity:a,contextGraphId:s,activeTab:l,onTabChange:u,swmAttribution:d}){const f=zn[e],h=w.useMemo(()=>t.entityList.filter(m=>m.trustLevel===f.trustLevel),[t.entityList,f.trustLevel]),g=W4(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(FD,{layer:e,entities:h,tripleCount:g.length,layerTriples:g,contextGraphId:s,memory:t,activeTab:l,onTabChange:u,onSelectEntity:a,onNodeClick:n,swmAttribution:d})})]})}function Tj({entities:e,contextGraphId:t,scrollKey:n}){const a=fn(u=>u.openTab),s=w.useMemo(()=>e.filter(u=>u.properties.has(Oh)),[e]),l=u=>{var y,b,k;const d=(y=u.connections.find(j=>j.predicate===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(Oh))==null?void 0:k[0])??"",{ref:g,contentType:m}=PD(d,f,h);a({id:ID(t??"",g??u.uri,m),label:u.label,closable:!0,icon:"📄"})};return s.length===0?o.jsx("div",{className:"v10-docs-placeholder v10-layer-empty-shell",style:{flex:1},"data-cg-scroll-key":n,children:o.jsx(ln,{compact:!0,title:"No documents in this layer yet.",description:"Import a file to add document-backed entities."})}):o.jsx("div",{className:"v10-layer-detail-content","data-cg-scroll-key":n,children:o.jsx("div",{className:"v10-items-list",children:s.map(u=>{var m,y,b,k;const d=((m=u.properties.get(Oh))==null?void 0:m[0])??"",f=(y=u.connections.find(j=>j.predicate===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 _j(e){return`SELECT ?g ?s ?p ?o WHERE {
1287
- GRAPH ?g { ?s ?p ?o }
1288
- ${zm(e)}
1289
- }
1290
- LIMIT 1000`}const sa="__context_graph",po="ui-saved-queries",md="Saved queries",gd="User-created SPARQL saved in this node profile for this Context Graph.",Jr="http://dkg.io/ontology/profile/",D1="http://schema.org/",z1="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",VD="http://www.w3.org/2001/XMLSchema#integer";function $1(e){return JSON.stringify(e)}function zm(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 WD(e){const t="whole-context-graph",n="Context graph",s=sa,l=u=>({subGraph:s,catalogSlug:t,catalogName:n,catalogDescription:"Ready-made SPARQL included with the Node UI for common Context Graph checks.",catalogRank:-100,resultColumn:"",...u});return{slug:t,subGraph:s,name:n,description:"Ready-made SPARQL included with the Node UI for common Context Graph checks.",rank:-100,queries:[l({slug:"all-triples",name:"All triples",description:"Show triples across available non-private graphs in this context graph.",sparql:_j(e),resultColumn:"o",rank:1}),l({slug:"graphs",name:"Graphs",description:"List available non-private named graphs and triple counts.",sparql:`SELECT ?g (COUNT(*) AS ?triples) WHERE {
1297
- GRAPH ?g { ?s ?p ?o }
1298
- ${zm(e)}
1299
- }
1300
- GROUP BY ?g
1301
- ORDER BY DESC(?triples)
1302
- LIMIT 100`,resultColumn:"g",rank:2}),l({slug:"types",name:"Types",description:"Count entities by RDF type across the context graph.",sparql:`SELECT ?type (COUNT(DISTINCT ?s) AS ?entities) WHERE {
1303
- GRAPH ?g { ?s a ?type }
1304
- ${zm(e)}
1305
- }
1306
- GROUP BY ?type
1307
- ORDER BY DESC(?entities)
1308
- LIMIT 100`,resultColumn:"type",rank:3})]}}function ZD(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}"^^<${VD}>`}function KD(e,t,n,a){const s=Date.now(),l=`${ZD(t)}-${s.toString(36)}`,u=I1(e,"catalog",po),d=I1(e,"query",l),f={slug:l,subGraph:sa,catalogSlug:po,catalogName:md,catalogDescription:gd,catalogRank:50,name:t,description:n||void 0,sparql:a,resultColumn:"",rank:s},h=[{subject:u,predicate:z1,object:`${Jr}QueryCatalog`,graph:""},{subject:u,predicate:`${Jr}forSubGraph`,object:Gi(sa),graph:""},{subject:u,predicate:`${Jr}displayName`,object:Gi(md),graph:""},{subject:u,predicate:`${D1}description`,object:Gi(gd),graph:""},{subject:u,predicate:`${Jr}rank`,object:P1(50),graph:""},{subject:d,predicate:z1,object:`${Jr}SavedQuery`,graph:""},{subject:d,predicate:`${Jr}forSubGraph`,object:Gi(sa),graph:""},{subject:d,predicate:`${Jr}inCatalog`,object:u,graph:""},{subject:d,predicate:`${Jr}displayName`,object:Gi(t),graph:""},{subject:d,predicate:`${Jr}sparqlQuery`,object:Gi(a),graph:""},{subject:d,predicate:`${Jr}rank`,object:P1(s),graph:""}];return n&&h.push({subject:d,predicate:`${D1}description`,object:Gi(n),graph:""}),{query:f,quads:h}}function YD(e,t){const n=`${sa}|${po}`,a=e.map(l=>({...l,queries:[...l.queries]})),s=a.find(l=>`${l.subGraph}|${l.slug}`===n);return s?(s.queries=[...s.queries,t].sort((l,u)=>l.rank-u.rank||l.name.localeCompare(u.name)),a):[...a,{slug:po,subGraph:sa,name:md,description:gd,rank:50,queries:[t]}]}function U1(e){const t=new Map;for(const n of e){const a=`${n.subGraph}|${n.slug}`,s=t.get(a);if(!s){t.set(a,{...n,queries:[...n.queries]});continue}const l=new Map(s.queries.map(u=>[`${u.subGraph}|${u.catalogSlug}|${u.slug}`,u]));for(const u of n.queries){const d=`${u.subGraph}|${u.catalogSlug}|${u.slug}`;l.has(d)||l.set(d,u)}s.queries=Array.from(l.values()).sort((u,d)=>u.rank-d.rank||u.name.localeCompare(d.name))}return Array.from(t.values()).sort((n,a)=>n.subGraph.localeCompare(a.subGraph)||n.rank-a.rank||n.name.localeCompare(a.name))}function QD(e){return e==null?"":typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function XD(e){return e?e.length<=140?e:`${e.slice(0,110)}...${e.slice(-24)}`:"—"}function Hd(e){return e.subGraph===sa&&e.slug==="whole-context-graph"}function JD(e){return e.subGraph===sa?"context":"subgraph"}function ez(e,t,n){return Hd(e)?"Built-in presets":e.subGraph===sa&&e.slug===po?md:t==="context"?e.name:`${n??e.subGraph}: ${e.name}`}function tz(e){return Hd(e)?"UI-provided SPARQL for common Context Graph checks.":e.subGraph===sa&&e.slug===po?gd:e.description??""}function nz(e,t){return Hd(e)?"Preset":t==="context"?"Saved":"Subgraph"}function rz(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 az({contextGraphId:e}){const t=Ua(),n=w.useMemo(()=>_j(e),[e]),[a,s]=w.useState(n),[l,u]=w.useState(n),[d,f]=w.useState(null),[h,g]=w.useState([]),[m,y]=w.useState(!1),[b,k]=w.useState(""),[j,N]=w.useState(""),[S,A]=w.useState(!1),[E,T]=w.useState(null),[U,_]=w.useState(null),z=w.useMemo(()=>WD(e),[e]),q=w.useMemo(()=>U1([z,...h,...(t==null?void 0:t.queryCatalogs)??[]]),[z,h,t==null?void 0:t.queryCatalogs]),D=w.useMemo(()=>t!=null&&t.loading||t!=null&&t.error?U1([z,...h]):q,[z,h,t==null?void 0:t.error,t==null?void 0:t.loading,q]);w.useEffect(()=>{s(n),u(n),f(null),g([]),y(!1),k(""),N(""),T(null),_(null)},[n]);const{data:R,loading:$,error:F,refresh:K}=lr(()=>or(l,e),[l,e],0),I=w.useMemo(()=>{var G,O;return((G=R==null?void 0:R.result)==null?void 0:G.bindings)??((O=R==null?void 0:R.results)==null?void 0:O.bindings)??[]},[R]),H=w.useMemo(()=>q.some(G=>!Hd(G)&&G.queries.length>0),[q]),B=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]),W=w.useCallback(()=>{const G=a.trim();if(G){if(f(null),_(null),T(null),G===l){K();return}u(G)}},[l,a,K]),Q=w.useCallback(()=>{s(n),f(null),_(null),T(null),l===n?K():u(n)},[l,n,K]),V=w.useCallback((G,O)=>{const ne=O.trim();if(ne){if(f(G),s(ne),_(null),T(null),l===ne){K();return}u(ne)}},[l,K]),L=w.useCallback(()=>{const G=a.trim().split(`
1309
- `).find(O=>O.trim());k(G?G.replace(/\s+/g," ").slice(0,60):""),N(""),T(null),_(null),y(!0)},[a]),P=w.useCallback(async G=>{G.preventDefault();const O=b.trim(),ne=j.trim(),ue=a.trim();if(!O){T("Name is required.");return}if(!ue){T("Query is empty.");return}A(!0),T(null),_(null);try{const{query:le,quads:be}=KD(e,O,ne,ue);await w_(e,be),g(Ee=>YD(Ee,le));const _e=`${le.subGraph}|${le.catalogSlug}|${le.slug}`;f(_e),s(le.sparql),l===le.sparql?K():u(le.sparql),k(""),N(""),y(!1),_("Saved to catalogue.")}catch(le){T((le==null?void 0:le.message)??"Failed to save query.")}finally{A(!1)}},[l,e,a,K,j,b]);return o.jsxs("div",{className:"v10-memory-layer-view v10-cg-query-view",children:[o.jsxs("div",{className:"v10-mlv-header",children:[o.jsx("span",{className:"v10-mlv-icon",children:"⟐"}),o.jsxs("div",{children:[o.jsx("h2",{className:"v10-mlv-title",children:"Query Catalogue"}),o.jsx("p",{className:"v10-mlv-desc",children:"Reusable SPARQL for this Context Graph. Use UI presets or save queries for people and local agents to reuse."})]})]}),o.jsxs("section",{className:"v10-cg-query-zone v10-cg-query-zone-catalog","aria-labelledby":"query-catalogue-saved-title",children:[o.jsx("div",{className:"v10-cg-query-zone-header",children:o.jsxs("div",{children:[o.jsx("span",{className:"v10-cg-query-eyebrow",children:"Query Library"}),o.jsx("h3",{id:"query-catalogue-saved-title",children:"Choose a query"}),o.jsx("p",{children:"Load a preset or saved query into the editor below."})]})}),(t==null?void 0:t.loading)&&o.jsx(ln,{compact:!0,inline:!0,tone:"query",icon:"?",title:"Loading saved queries...",description:"Built-in presets are available while saved queries load from this node profile."}),(t==null?void 0:t.error)&&o.jsx(ln,{compact:!0,inline:!0,tone:"danger",icon:"!",title:"Saved query catalogue unavailable",description:t.error}),D.length>0&&o.jsx("div",{className:"v10-cg-query-catalog-groups",children:D.map(G=>{const O=JD(G),ne=O==="context"||t==null?void 0:t.forSubGraph(G.subGraph),ue=(ne==null?void 0:ne.color)??"#38bdf8",le=ez(G,O,ne==null?void 0:ne.displayName),be=tz(G),_e=nz(G,O);return o.jsxs("div",{className:"v10-cg-query-catalog-group",style:{"--sg-color":ue},children:[o.jsx("div",{className:"v10-cg-query-catalog-group-header",children:o.jsxs("div",{children:[o.jsxs("div",{className:"v10-cg-query-catalog-title-row",children:[o.jsx("span",{className:"v10-cg-query-catalog-kind",children:_e}),o.jsx("h4",{children:le})]}),be&&o.jsx("p",{children:be})]})}),o.jsx("div",{className:"v10-cg-query-list",children:G.queries.map(Ee=>{const Ie=`${Ee.subGraph}|${Ee.catalogSlug}|${Ee.slug}`,We=d===Ie&&l===Ee.sparql,Se=Ee.description?`${Ee.name}. ${Ee.description}`:Ee.name;return o.jsxs("button",{type:"button",className:`v10-cg-query-chip${We?" active":""}`,title:Se,"aria-label":`Load query: ${Se}`,onClick:()=>V(Ie,Ee.sparql),children:[o.jsx("span",{className:"v10-cg-query-chip-title",children:Ee.name}),Ee.description&&o.jsx("span",{className:"v10-cg-query-chip-desc",children:Ee.description})]},Ie)})})]},`${G.subGraph}|${G.slug}`)})}),!(t!=null&&t.loading)&&!(t!=null&&t.error)&&q.length>0&&!H&&o.jsx(ln,{compact:!0,inline:!0,tone:"query",icon:"?",title:"No saved queries yet.",description:"Use Save after editing SPARQL to keep a reusable query for this Context Graph."})]}),o.jsxs("section",{className:"v10-cg-query-zone v10-cg-query-zone-editor","aria-labelledby":"query-catalogue-editor-title",children:[o.jsx("div",{className:"v10-cg-query-zone-header",children:o.jsxs("div",{children:[o.jsx("span",{className:"v10-cg-query-eyebrow",children:"Ad-hoc SPARQL"}),o.jsx("h3",{id:"query-catalogue-editor-title",children:"Editor and results"}),o.jsx("p",{children:"Run a one-off query against this Context Graph, or save it when it should become reusable."})]})}),o.jsxs("div",{className:"v10-cg-query-editor",children:[o.jsx("textarea",{className:"v10-cg-query-textarea","aria-label":"SPARQL editor",value:a,onChange:G=>{s(G.target.value),f(null)},spellCheck:!1}),o.jsxs("div",{className:"v10-cg-query-actions",children:[o.jsx("button",{className:"v10-mlv-run-btn",type:"button",onClick:W,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:Q,children:"Reset"})]})]}),m&&o.jsxs("form",{className:"v10-cg-query-save-panel",onSubmit:P,children:[o.jsxs("label",{className:"v10-cg-query-save-field",children:[o.jsx("span",{children:"Name"}),o.jsx("input",{type:"text",value:b,onChange:G=>k(G.target.value),placeholder:"Query name",maxLength:80})]}),o.jsxs("label",{className:"v10-cg-query-save-field",children:[o.jsx("span",{children:"Description"}),o.jsx("input",{type:"text",value:j,onChange:G=>N(G.target.value),placeholder:"Optional",maxLength:180})]}),o.jsxs("div",{className:"v10-cg-query-save-actions",children:[o.jsx("button",{type:"button",className:"v10-mlv-clear-btn",onClick:()=>y(!1),disabled:S,children:"Cancel"}),o.jsx("button",{type:"submit",className:"v10-mlv-run-btn",disabled:S,children:S?"Saving...":"Save query"})]})]}),U&&o.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-success)"},children:U}),E&&o.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-danger)"},children:E}),o.jsxs("div",{className:"v10-cg-query-results",children:[$&&o.jsx(ln,{compact:!0,tone:"query",icon:"?",title:"Loading query results..."}),F&&o.jsx(ln,{compact:!0,tone:"danger",icon:"!",title:"Query could not run.",description:rz(F)}),!$&&!F&&I.length===0&&o.jsx(ln,{compact:!0,tone:"query",icon:"?",title:"No results for this query.",description:"Adjust the query or run a saved query against this Context Graph."}),!$&&!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:B.map(G=>o.jsx("th",{children:G},G))})}),o.jsx("tbody",{children:I.map((G,O)=>o.jsx("tr",{children:B.map(ne=>{const ue=QD(G[ne]);return o.jsx("td",{className:"v10-mlv-cell",title:ue,children:XD(ue)},ne)})},O))})]})]})]})]})]})}const Rj="http://dkg.io/ontology/",iz="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 $h(e){const t=Oj(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1]:t}function sz(e){const t=Oj(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function oz(e,t){return`PREFIX dkg: <${Rj}>
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 lz(e,t){return`PREFIX dkg: <${Rj}>
1317
- PREFIX prov: <${iz}>
1318
- SELECT ?op ?publishedAt ?agent WHERE {
1319
- GRAPH ?g {
1320
- ?op a dkg:WorkspaceOperation ;
1321
- dkg:rootEntity <${t}> ;
1322
- dkg:publishedAt ?publishedAt .
1323
- OPTIONAL { ?op prov:wasAttributedTo ?agent }
1324
- }
1325
- FILTER(
1326
- STRSTARTS(STR(?g), "did:dkg:context-graph:${e}") &&
1327
- CONTAINS(STR(?g), "_shared_memory_meta")
1328
- )
1329
- } ORDER BY DESC(?publishedAt) LIMIT 1`}const Ih={ual:null,opId:null,owner:null,publishedAt:null,publisherPeerId:null,loading:!1};function cz(e,t,n=!0){const[a,s]=w.useState(()=>({...Ih})),l=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){s({...Ih});return}const u=++l.current;s(d=>({...d,loading:!0,error:void 0})),(async()=>{var d,f;try{const[h,g]=await Promise.all([or(oz(e,t),e).catch(()=>null),or(lz(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?sz(y.op):null,k=y?$h(y.publishedAt):null,j=y!=null&&y.agent?$h(y.agent):null,N=m?$h(m.owner):null;s({ual:b,opId:b?b.slice(b.lastIndexOf(":")+1):null,owner:N,publishedAt:k||null,publisherPeerId:j,loading:!1})}catch(h){if(u!==l.current)return;s({...Ih,loading:!1,error:(h==null?void 0:h.message)??String(h)})}})()},[e,t,n]),a}function 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 Ks(e,t=6,n=4){return e?e.length<=t+n+2?e:`${e.slice(0,t)}…${e.slice(-n)}`:""}const rv="http://dkg.io/ontology/",Vi={status:"idle",ual:null,txHash:null,blockNumber:null,kaId:null,author:null,finalizedAt:null,agent:null};function Cn(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 Tu(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 uz(e,t){const n=`did:dkg:context-graph:${e}/_meta`,a=Si(t);return`PREFIX dkg: <${rv}>
1330
- PREFIX prov: <http://www.w3.org/ns/prov#>
1331
- SELECT ?asrt ?tx ?block ?kaId ?batchId ?finalizedAt ?ual ?agentLc ?ualSelf ?agentSelf WHERE {
1332
- GRAPH <${n}> {
1333
- ?asrt dkg:publishedAtTx ?tx ;
1334
- dkg:publishedAtBlock ?block .
1335
- FILTER(
1336
- STRSTARTS("${a}", STR(?asrt)) ||
1337
- EXISTS { ?asrt dkg:assertionRootEntity <${t}> } ||
1338
- EXISTS { ?asrt dkg:assertionEntity <${t}> }
1339
- )
1340
- OPTIONAL { ?asrt dkg:publishedAtKaId ?kaId . }
1341
- OPTIONAL { ?asrt dkg:assertionFinalizedAt ?finalizedAt . }
1342
- OPTIONAL {
1343
- ?lc dkg:rootEntity <${t}> ;
1344
- dkg:reservedUal ?ual .
1345
- # Pin the lifecycle URN to the FULL assertion scope (cg + optional
1346
- # subGraphName), not just {addr}:{name} — otherwise a same-named
1347
- # assertion in a sibling sub-graph (urn:dkg:assertion:{cg}:{other}:{addr}:{name})
1348
- # also STRENDS-matches and leaks the wrong reservedUal/agent/batchId.
1349
- # cgId is a build-time constant, so anchor on it as a literal and keep its
1350
- # slashes intact (wallet-scoped cgIds like "<addr>/<name>" embed RAW in the
1351
- # URN via assertionLifecycleUri); only the [/sub]/{addr}/{name} tail derived
1352
- # from ?asrt is "/"->":" converted (sub/addr/name cannot contain "/").
1353
- FILTER(STRENDS(STR(?lc), CONCAT(
1354
- ":${Si(e)}",
1355
- REPLACE(STRBEFORE(STRAFTER(STR(?asrt), "did:dkg:context-graph:${Si(e)}"), "/assertion/"), "/", ":"),
1356
- ":",
1357
- REPLACE(STRAFTER(STR(?asrt), "/assertion/"), "/", ":")
1358
- )))
1359
- OPTIONAL { ?lc prov:wasAttributedTo ?agentLc . }
1360
- }
1361
- OPTIONAL { ?asrt dkg:reservedUal ?ualSelf . }
1362
- OPTIONAL { ?asrt prov:wasAttributedTo ?agentSelf . }
1363
- BIND(IRI(COALESCE(?ualSelf, ?ual)) AS ?ualNode)
1364
- OPTIONAL { ?ualNode dkg:batchId ?batchId . }
1365
- }
1366
- } ORDER BY DESC(STRSTARTS("${a}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function dz(e){const t=e.match(/\/assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function pz(e,t){return`PREFIX dkg: <${rv}>
1367
- SELECT ?source ?agent ?ts WHERE {
1368
- GRAPH ?g {
1369
- ?op a dkg:ShareTransition ;
1370
- dkg:entities <${t}> ;
1371
- dkg:source ?source ;
1372
- dkg:agent ?agent ;
1373
- dkg:timestamp ?ts .
1374
- }
1375
- FILTER(
1376
- STRSTARTS(STR(?g), "did:dkg:context-graph:${Si(e)}/") &&
1377
- CONTAINS(STR(?g), "_shared_memory_meta")
1378
- )
1379
- } ORDER BY DESC(?ts) LIMIT 1`}function fz(e,t,n,a){const s=`did:dkg:context-graph:${e}/_meta`,l=`/assertion/${n}/${a}`,u=Si(t);return`PREFIX dkg: <${rv}>
1380
- SELECT ?ual ?tx ?block ?kaId ?finalizedAt WHERE {
1381
- GRAPH <${s}> {
1382
- ?asrt dkg:publishedAtTx ?tx ;
1383
- dkg:publishedAtBlock ?block .
1384
- OPTIONAL { ?asrt dkg:publishedAtKaId ?kaId . }
1385
- FILTER(STRENDS(STR(?asrt), "${Si(l)}"))
1386
- OPTIONAL { ?asrt dkg:assertionFinalizedAt ?finalizedAt . }
1387
- OPTIONAL {
1388
- ?lc dkg:rootEntity <${t}> ;
1389
- dkg:reservedUal ?ual .
1390
- FILTER(STRENDS(STR(?lc), "${Si(`:${n}:${a}`)}"))
1391
- }
1392
- }
1393
- } ORDER BY DESC(STRSTARTS("${u}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function hz(e){const t=e.match(/^assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function mz(e,t,n=!0){const[a,s]=w.useState(()=>({...Vi})),l=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){s({...Vi});return}const u=++l.current;s({...Vi,status:"loading"}),(async()=>{var d,f,h;try{const g=F1(t);if(!g){s({...Vi,status:"offchain"});return}const m=await or(uz(e,g),e);if(u!==l.current)return;const y=(((d=m==null?void 0:m.result)==null?void 0:d.bindings)??[])[0];if(y!=null&&y.tx){const R=y.asrt?Tu(Cn(y.asrt)):"",$=dz(R),F=($==null?void 0:$.addr)??null,I=(y.agentSelf?Tu(Cn(y.agentSelf)):"")||(y.agentLc?Tu(Cn(y.agentLc)):"")||(F?`did:dkg:agent:${F.toLowerCase()}`:null),H=(y.ualSelf?Cn(y.ualSelf):"")||(y.ual?Cn(y.ual):""),B=(y.kaId?Cn(y.kaId):"")||(y.batchId?Cn(y.batchId):"");s({status:"verified",ual:H||null,txHash:Cn(y.tx)||null,blockNumber:y.block?Cn(y.block):null,kaId:B||null,author:F,finalizedAt:y.finalizedAt?Cn(y.finalizedAt):null,agent:I});return}const b=await or(pz(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=Cn(k.source),N=hz(j),S=k.agent?Tu(Cn(k.agent)):null,A=(N==null?void 0:N.addr)??null;if(!N||!F1(N.addr)||!Si(N.name)){s({...Vi,status:"offchain",author:A,agent:S});return}const E=await or(fz(e,g,N.addr,N.name),e);if(u!==l.current)return;const T=(((h=E==null?void 0:E.result)==null?void 0:h.bindings)??[])[0],U=T!=null&&T.ual?Cn(T.ual):null,_=T!=null&&T.tx?Cn(T.tx):null,z=T!=null&&T.block?Cn(T.block):null,q=T!=null&&T.kaId?Cn(T.kaId):null,D=T!=null&&T.finalizedAt?Cn(T.finalizedAt):null;s({status:_?"verified":"offchain",ual:U||null,txHash:_||null,blockNumber:z||null,kaId:q||null,author:A,finalizedAt:D||null,agent:S})}catch(g){if(u!==l.current)return;s({...Vi,status:"error",error:(g==null?void 0:g.message)??String(g)})}})()},[e,t,n]),a}const gz=({contextGraphId:e,entityUri:t,enabled:n})=>{const a=cs(),s=cz(e,t,n),l=mz(e,t,n),{data:u}=lr(jg,[],6e4),d=u==null?void 0:u.blockExplorerUrl,f=l.ual??s.ual,h=l.status==="verified";if(!n||s.loading||!s.ual&&!s.owner&&!s.publishedAt&&!h)return null;const g=s.publishedAt?vz(s.publishedAt):null,m=s.publisherPeerId&&a?B1(s.publisherPeerId,a.agents):null,y=m?(a==null?void 0:a.get(m))??null:null,b=s.owner&&a?B1(s.owner,a.agents):null,k=b?(a==null?void 0:a.get(b))??null:null,j=N=>{var S;(S=navigator.clipboard)==null||S.writeText(N).catch(()=>{})};return o.jsxs("div",{className:"v10-vm-identity",children:[o.jsxs("div",{className:"v10-vm-identity-head",children:[o.jsx("span",{className:"v10-vm-identity-glyph",children:"◉"}),o.jsx("span",{className:"v10-vm-identity-title",children:"On-chain identity"}),o.jsx("span",{className:"v10-vm-identity-badge",children:"VERIFIED"})]}),f&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"UAL"}),o.jsx("span",{className:"v10-vm-identity-val mono",title:f,children:f}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(f),title:"Copy UAL",children:"⎘"})]}),h&&l.txHash&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"Tx"}),d?o.jsxs("a",{className:"v10-vm-identity-val mono",href:`${d}/tx/${l.txHash}`,target:"_blank",rel:"noopener noreferrer",title:l.txHash,children:[Ks(l.txHash,10,8)," ↗"]}):o.jsx("span",{className:"v10-vm-identity-val mono",title:l.txHash,children:Ks(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:Ks(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(ts,{agent:k,size:"sm"}),k.walletAddress&&o.jsx("span",{className:"v10-vm-identity-wallet mono",title:k.walletAddress,children:Ks(k.walletAddress,6,4)})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-vm-identity-val mono",title:s.owner??"",children:Ks(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(ts,{agent:y,size:"sm"}):o.jsx("span",{className:"v10-vm-identity-val mono",title:s.publisherPeerId??"",children:Ks(s.publisherPeerId,8,6)})]})]})};function vz(e){const t=new Date(e.replace(/^"|"$/g,""));return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):e}function ve(e,t,n){function a(d,f){var h;Object.defineProperty(d,"_zod",{value:d._zod??{},enumerable:!1}),(h=d._zod).traits??(h.traits=new Set),d._zod.traits.add(e),t(d,f);for(const g in u.prototype)g in d||Object.defineProperty(d,g,{value:u.prototype[g].bind(d)});d._zod.constr=u,d._zod.def=f}const s=(n==null?void 0:n.Parent)??Object;class l extends s{}Object.defineProperty(l,"name",{value:e});function u(d){var f;const h=n!=null&&n.Parent?new l:this;a(h,d),(f=h._zod).deferred??(f.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(u,"init",{value:a}),Object.defineProperty(u,Symbol.hasInstance,{value:d=>{var f,h;return n!=null&&n.Parent&&d instanceof n.Parent?!0:(h=(f=d==null?void 0:d._zod)==null?void 0:f.traits)==null?void 0:h.has(e)}}),Object.defineProperty(u,"name",{value:e}),u}class Bl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Lj={};function ns(e){return Lj}function Mj(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,s])=>t.indexOf(+a)===-1).map(([a,s])=>s)}function yz(e,t){return typeof t=="bigint"?t.toString():t}function Dj(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function av(e){return e==null}function iv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function bz(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=n>a?n:a,l=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(t.toFixed(s).replace(".",""));return l%u/10**s}function Ut(e,t,n){Object.defineProperty(e,t,{get(){{const a=n();return e[t]=a,a}},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function sv(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function bl(e){return JSON.stringify(e)}const zj=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function $m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const xz=Dj(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Im(e){if($m(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!($m(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const wz=new Set(["string","number","symbol"]);function qd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function us(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(a._zod.parent=e),a}function Ue(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function kz(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Sz={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 jz(e,t){const n={},a=e._zod.def;for(const s in t){if(!(s in a.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(n[s]=a.shape[s])}return us(e,{...e._zod.def,shape:n,checks:[]})}function Cz(e,t){const n={...e._zod.def.shape},a=e._zod.def;for(const s in t){if(!(s in a.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete n[s]}return us(e,{...e._zod.def,shape:n,checks:[]})}function Nz(e,t){if(!Im(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const a={...e._zod.def.shape,...t};return sv(this,"shape",a),a},checks:[]};return us(e,n)}function Ez(e,t){return us(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return sv(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function Az(e,t,n){const a=t._zod.def.shape,s={...a};if(n)for(const l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(s[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(const l in a)s[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return us(t,{...t._zod.def,shape:s,checks:[]})}function Tz(e,t,n){const a=t._zod.def.shape,s={...a};if(n)for(const l in n){if(!(l in s))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(s[l]=new e({type:"nonoptional",innerType:a[l]}))}else for(const l in a)s[l]=new e({type:"nonoptional",innerType:a[l]});return us(t,{...t._zod.def,shape:s,checks:[]})}function Ol(e,t=0){var n;for(let a=t;a<e.issues.length;a++)if(((n=e.issues[a])==null?void 0:n.continue)!==!0)return!0;return!1}function ov(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function _u(e){return typeof e=="string"?e:e==null?void 0:e.message}function rs(e,t,n){var s,l,u,d,f,h;const a={...e,path:e.path??[]};if(!e.message){const g=_u((u=(l=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:l.error)==null?void 0:u.call(l,e))??_u((d=t==null?void 0:t.error)==null?void 0:d.call(t,e))??_u((f=n.customError)==null?void 0:f.call(n,e))??_u((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";a.message=g}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function lv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Fl(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const $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,yz,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ij=ve("$ZodError",$j),Pj=ve("$ZodError",$j,{Parent:Error});function _z(e,t=n=>n.message){const n={},a=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):a.push(t(s));return{formErrors:a,fieldErrors:n}}function Rz(e,t){const n=t||function(l){return l.message},a={_errors:[]},s=l=>{for(const u of l.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>s({issues:d}));else if(u.code==="invalid_key")s({issues:u.issues});else if(u.code==="invalid_element")s({issues:u.issues});else if(u.path.length===0)a._errors.push(n(u));else{let d=a,f=0;for(;f<u.path.length;){const h=u.path[f];f===u.path.length-1?(d[h]=d[h]||{_errors:[]},d[h]._errors.push(n(u))):d[h]=d[h]||{_errors:[]},d=d[h],f++}}};return s(e),a}const Oz=e=>(t,n,a,s)=>{const l=a?Object.assign(a,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},l);if(u instanceof Promise)throw new Bl;if(u.issues.length){const d=new((s==null?void 0:s.Err)??e)(u.issues.map(f=>rs(f,l,ns())));throw zj(d,s==null?void 0:s.callee),d}return u.value},Lz=e=>async(t,n,a,s)=>{const l=a?Object.assign(a,{async:!0}):{async:!0};let u=t._zod.run({value:n,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const d=new((s==null?void 0:s.Err)??e)(u.issues.map(f=>rs(f,l,ns())));throw zj(d,s==null?void 0:s.callee),d}return u.value},Uj=e=>(t,n,a)=>{const s=a?{...a,async:!1}:{async:!1},l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new Bl;return l.issues.length?{success:!1,error:new(e??Ij)(l.issues.map(u=>rs(u,s,ns())))}:{success:!0,data:l.value}},Mz=Uj(Pj),Bj=e=>async(t,n,a)=>{const s=a?Object.assign(a,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},s);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>rs(u,s,ns())))}:{success:!0,data:l.value}},Dz=Bj(Pj),zz=/^[cC][^\s-]{8,}$/,$z=/^[0-9a-z]+$/,Iz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Pz=/^[0-9a-vA-V]{20}$/,Uz=/^[A-Za-z0-9]{27}$/,Bz=/^[a-zA-Z0-9_-]{21}$/,Fz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Hz=/^([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)$/,qz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Gz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Vz(){return new RegExp(Gz,"u")}const Wz=/^(?:(?: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])$/,Zz=/^(([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})$/,Kz=/^((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])$/,Yz=/^(([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])$/,Qz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fj=/^[A-Za-z0-9_-]*$/,Xz=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Jz=/^\+(?:[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])))",e$=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 t$(e){return new RegExp(`^${qj(e)}$`)}function n$(e){const t=qj({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const a=`${t}(?:${n.join("|")})`;return new RegExp(`^${Hj}T(?:${a})$`)}const r$=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}$`)},a$=/^\d+$/,i$=/^-?\d+(?:\.\d+)?/i,s$=/^[^A-Z]*$/,o$=/^[^a-z]*$/,Wn=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)=>{Wn.init(e,t);const n=Gj[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,l=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<l&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wj=ve("$ZodCheckGreaterThan",(e,t)=>{Wn.init(e,t);const n=Gj[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,l=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),l$=ve("$ZodCheckMultipleOf",(e,t)=>{Wn.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):bz(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})}}),c$=ve("$ZodCheckNumberFormat",(e,t)=>{var u;Wn.init(e,t),t.format=t.format||"float64";const n=(u=t.format)==null?void 0:u.includes("int"),a=n?"int":"number",[s,l]=Sz[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=a$)}),e._zod.check=d=>{const f=d.value;if(n){if(!Number.isInteger(f)){d.issues.push({expected:a,format:t.format,code:"invalid_type",input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?d.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}):d.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort});return}}f<s&&d.issues.push({origin:"number",input:f,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),f>l&&d.issues.push({origin:"number",input:f,code:"too_big",maximum:l,inst:e})}}),u$=ve("$ZodCheckMaxLength",(e,t)=>{var n;Wn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!av(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const s=a.value;if(s.length<=t.maximum)return;const u=lv(s);a.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),d$=ve("$ZodCheckMinLength",(e,t)=>{var n;Wn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!av(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const s=a.value;if(s.length>=t.minimum)return;const u=lv(s);a.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),p$=ve("$ZodCheckLengthEquals",(e,t)=>{var n;Wn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!av(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=a=>{const s=a.value,l=s.length;if(l===t.length)return;const u=lv(s),d=l>t.length;a.issues.push({origin:u,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),Gd=ve("$ZodCheckStringFormat",(e,t)=>{var n,a;Wn.init(e,t),e._zod.onattach.push(s=>{const l=s._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),f$=ve("$ZodCheckRegex",(e,t)=>{Gd.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),h$=ve("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=s$),Gd.init(e,t)}),m$=ve("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=o$),Gd.init(e,t)}),g$=ve("$ZodCheckIncludes",(e,t)=>{Wn.init(e,t);const n=qd(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(s=>{const l=s._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(a)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),v$=ve("$ZodCheckStartsWith",(e,t)=>{Wn.init(e,t);const n=new RegExp(`^${qd(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),y$=ve("$ZodCheckEndsWith",(e,t)=>{Wn.init(e,t);const n=new RegExp(`.*${qd(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),b$=ve("$ZodCheckOverwrite",(e,t)=>{Wn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class x${constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
1394
- `).filter(u=>u),s=Math.min(...a.map(u=>u.length-u.trimStart().length)),l=a.map(u=>u.slice(s)).map(u=>" ".repeat(this.indent*2)+u);for(const u of l)this.content.push(u)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(l=>` ${l}`)];return new t(...n,s.join(`
1395
- `))}}const w$={major:4,minor:0,patch:0},en=ve("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=w$;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const l of a)for(const u of l._zod.onattach)u(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const l=(u,d,f)=>{let h=Ol(u),g;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(h)continue;const y=u.issues.length,b=m._zod.check(u);if(b instanceof Promise&&(f==null?void 0:f.async)===!1)throw new Bl;if(g||b instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await b,u.issues.length!==y&&(h||(h=Ol(u,y)))});else{if(u.issues.length===y)continue;h||(h=Ol(u,y))}}return g?g.then(()=>u):u};e._zod.run=(u,d)=>{const f=e._zod.parse(u,d);if(f instanceof Promise){if(d.async===!1)throw new Bl;return f.then(h=>l(h,a,d))}return l(f,a,d)}}e["~standard"]={validate:l=>{var u;try{const d=Mz(e,l);return d.success?{value:d.data}:{issues:(u=d.error)==null?void 0:u.issues}}catch{return Dz(e,l).then(f=>{var h;return f.success?{value:f.data}:{issues:(h=f.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}}),cv=ve("$ZodString",(e,t)=>{var n;en.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??r$(e._zod.bag),e._zod.parse=(a,s)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),Ht=ve("$ZodStringFormat",(e,t)=>{Gd.init(e,t),cv.init(e,t)}),k$=ve("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Hz),Ht.init(e,t)}),S$=ve("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=H1(a))}else t.pattern??(t.pattern=H1());Ht.init(e,t)}),j$=ve("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=qz),Ht.init(e,t)}),C$=ve("$ZodURL",(e,t)=>{Ht.init(e,t),e._zod.check=n=>{try{const a=n.value,s=new URL(a),l=s.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Xz.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!a.endsWith("/")&&l.endsWith("/")?n.value=l.slice(0,-1):n.value=l;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),N$=ve("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Vz()),Ht.init(e,t)}),E$=ve("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Bz),Ht.init(e,t)}),A$=ve("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=zz),Ht.init(e,t)}),T$=ve("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=$z),Ht.init(e,t)}),_$=ve("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Iz),Ht.init(e,t)}),R$=ve("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Pz),Ht.init(e,t)}),O$=ve("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Uz),Ht.init(e,t)}),L$=ve("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=n$(t)),Ht.init(e,t)}),M$=ve("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=e$),Ht.init(e,t)}),D$=ve("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=t$(t)),Ht.init(e,t)}),z$=ve("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Fz),Ht.init(e,t)}),$$=ve("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Wz),Ht.init(e,t),e._zod.onattach.push(n=>{const a=n._zod.bag;a.format="ipv4"})}),I$=ve("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Zz),Ht.init(e,t),e._zod.onattach.push(n=>{const a=n._zod.bag;a.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),P$=ve("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Kz),Ht.init(e,t)}),U$=ve("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Yz),Ht.init(e,t),e._zod.check=n=>{const[a,s]=n.value.split("/");try{if(!s)throw new Error;const l=Number(s);if(`${l}`!==s)throw new Error;if(l<0||l>128)throw new Error;new URL(`http://[${a}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Zj(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const B$=ve("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Qz),Ht.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 F$(e){if(!Fj.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Zj(n)}const H$=ve("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fj),Ht.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{F$(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),q$=ve("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Jz),Ht.init(e,t)});function G$(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const s=JSON.parse(atob(a));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const V$=ve("$ZodJWT",(e,t)=>{Ht.init(e,t),e._zod.check=n=>{G$(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Kj=ve("$ZodNumber",(e,t)=>{en.init(e,t),e._zod.pattern=e._zod.bag.pattern??i$,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const l=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...l?{received:l}:{}}),n}}),W$=ve("$ZodNumber",(e,t)=>{c$.init(e,t),Kj.init(e,t)}),Z$=ve("$ZodUnknown",(e,t)=>{en.init(e,t),e._zod.parse=n=>n}),K$=ve("$ZodNever",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function q1(e,t,n){e.issues.length&&t.issues.push(...ov(n,e.issues)),t.value[n]=e.value}const Y$=ve("$ZodArray",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const l=[];for(let u=0;u<s.length;u++){const d=s[u],f=t.element._zod.run({value:d,issues:[]},a);f instanceof Promise?l.push(f.then(h=>q1(h,n,u))):q1(f,n,u)}return l.length?Promise.all(l).then(()=>n):n}});function Ru(e,t,n){e.issues.length&&t.issues.push(...ov(n,e.issues)),t.value[n]=e.value}function G1(e,t,n,a){e.issues.length?a[n]===void 0?n in a?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...ov(n,e.issues)):e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}const Q$=ve("$ZodObject",(e,t)=>{en.init(e,t);const n=Dj(()=>{const m=Object.keys(t.shape);for(const b of m)if(!(t.shape[b]instanceof en))throw new Error(`Invalid element at key "${b}": expected a Zod schema`);const y=kz(t.shape);return{shape:t.shape,keys:m,keySet:new Set(m),numKeys:m.length,optionalKeys:new Set(y)}});Ut(e._zod,"propValues",()=>{const m=t.shape,y={};for(const b in m){const k=m[b]._zod;if(k.values){y[b]??(y[b]=new Set);for(const j of k.values)y[b].add(j)}}return y});const a=m=>{const y=new x$(["shape","payload","ctx"]),b=n.value,k=A=>{const E=bl(A);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};y.write("const input = payload.value;");const j=Object.create(null);let N=0;for(const A of b.keys)j[A]=`key_${N++}`;y.write("const newResult = {}");for(const A of b.keys)if(b.optionalKeys.has(A)){const E=j[A];y.write(`const ${E} = ${k(A)};`);const T=bl(A);y.write(`
1396
- if (${E}.issues.length) {
1397
- if (input[${T}] === undefined) {
1398
- if (${T} in input) {
1399
- newResult[${T}] = undefined;
1400
- }
1401
- } else {
1402
- payload.issues = payload.issues.concat(
1403
- ${E}.issues.map((iss) => ({
1404
- ...iss,
1405
- path: iss.path ? [${T}, ...iss.path] : [${T}],
1406
- }))
1407
- );
1408
- }
1409
- } else if (${E}.value === undefined) {
1410
- if (${T} in input) newResult[${T}] = undefined;
1411
- } else {
1412
- newResult[${T}] = ${E}.value;
1413
- }
1414
- `)}else{const E=j[A];y.write(`const ${E} = ${k(A)};`),y.write(`
1415
- if (${E}.issues.length) payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
1416
- ...iss,
1417
- path: iss.path ? [${bl(A)}, ...iss.path] : [${bl(A)}]
1418
- })));`),y.write(`newResult[${bl(A)}] = ${E}.value`)}y.write("payload.value = newResult;"),y.write("return payload;");const S=y.compile();return(A,E)=>S(m,A,E)};let s;const l=$m,u=!Lj.jitless,f=u&&xz.value,h=t.catchall;let g;e._zod.parse=(m,y)=>{g??(g=n.value);const b=m.value;if(!l(b))return m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m;const k=[];if(u&&f&&(y==null?void 0:y.async)===!1&&y.jitless!==!0)s||(s=a(t.shape)),m=s(m,y);else{m.value={};const E=g.shape;for(const T of g.keys){const U=E[T],_=U._zod.run({value:b[T],issues:[]},y),z=U._zod.optin==="optional"&&U._zod.optout==="optional";_ instanceof Promise?k.push(_.then(q=>z?G1(q,m,T,b):Ru(q,m,T))):z?G1(_,m,T,b):Ru(_,m,T)}}if(!h)return k.length?Promise.all(k).then(()=>m):m;const j=[],N=g.keySet,S=h._zod,A=S.def.type;for(const E of Object.keys(b)){if(N.has(E))continue;if(A==="never"){j.push(E);continue}const T=S.run({value:b[E],issues:[]},y);T instanceof Promise?k.push(T.then(U=>Ru(U,m,E))):Ru(T,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,a){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(l=>rs(l,a,ns())))}),t}const X$=ve("$ZodUnion",(e,t)=>{en.init(e,t),Ut(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Ut(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Ut(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Ut(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${n.map(a=>iv(a.source)).join("|")})$`)}}),e._zod.parse=(n,a)=>{let s=!1;const l=[];for(const u of t.options){const d=u._zod.run({value:n.value,issues:[]},a);if(d instanceof Promise)l.push(d),s=!0;else{if(d.issues.length===0)return d;l.push(d)}}return s?Promise.all(l).then(u=>V1(u,n,e,a)):V1(l,n,e,a)}}),J$=ve("$ZodIntersection",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{const s=n.value,l=t.left._zod.run({value:s,issues:[]},a),u=t.right._zod.run({value:s,issues:[]},a);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([f,h])=>W1(n,f,h)):W1(n,l,u)}});function Pm(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Im(e)&&Im(t)){const n=Object.keys(t),a=Object.keys(e).filter(l=>n.indexOf(l)!==-1),s={...e,...t};for(const l of a){const u=Pm(e[l],t[l]);if(!u.valid)return{valid:!1,mergeErrorPath:[l,...u.mergeErrorPath]};s[l]=u.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const s=e[a],l=t[a],u=Pm(s,l);if(!u.valid)return{valid:!1,mergeErrorPath:[a,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function 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 a=Pm(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const eI=ve("$ZodEnum",(e,t)=>{en.init(e,t);const n=Mj(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(a=>wz.has(typeof a)).map(a=>typeof a=="string"?qd(a):a.toString()).join("|")})$`),e._zod.parse=(a,s)=>{const l=a.value;return e._zod.values.has(l)||a.issues.push({code:"invalid_value",values:n,input:l,inst:e}),a}}),tI=ve("$ZodTransform",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{const s=t.transform(n.value,n);if(a.async)return(s instanceof Promise?s:Promise.resolve(s)).then(u=>(n.value=u,n));if(s instanceof Promise)throw new Bl;return n.value=s,n}}),nI=ve("$ZodOptional",(e,t)=>{en.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ut(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ut(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${iv(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,a):n.value===void 0?n:t.innerType._zod.run(n,a)}),rI=ve("$ZodNullable",(e,t)=>{en.init(e,t),Ut(e._zod,"optin",()=>t.innerType._zod.optin),Ut(e._zod,"optout",()=>t.innerType._zod.optout),Ut(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${iv(n.source)}|null)$`):void 0}),Ut(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),aI=ve("$ZodDefault",(e,t)=>{en.init(e,t),e._zod.optin="optional",Ut(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(l=>Z1(l,t)):Z1(s,t)}});function Z1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const iI=ve("$ZodPrefault",(e,t)=>{en.init(e,t),e._zod.optin="optional",Ut(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,a))}),sI=ve("$ZodNonOptional",(e,t)=>{en.init(e,t),Ut(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(l=>K1(l,e)):K1(s,e)}});function K1(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 oI=ve("$ZodCatch",(e,t)=>{en.init(e,t),e._zod.optin="optional",Ut(e._zod,"optout",()=>t.innerType._zod.optout),Ut(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(l=>(n.value=l.value,l.issues.length&&(n.value=t.catchValue({...n,error:{issues:l.issues.map(u=>rs(u,a,ns()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(l=>rs(l,a,ns()))},input:n.value}),n.issues=[]),n)}}),lI=ve("$ZodPipe",(e,t)=>{en.init(e,t),Ut(e._zod,"values",()=>t.in._zod.values),Ut(e._zod,"optin",()=>t.in._zod.optin),Ut(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,a)=>{const s=t.in._zod.run(n,a);return s instanceof Promise?s.then(l=>Y1(l,t,a)):Y1(s,t,a)}});function Y1(e,t,n){return Ol(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const cI=ve("$ZodReadonly",(e,t)=>{en.init(e,t),Ut(e._zod,"propValues",()=>t.innerType._zod.propValues),Ut(e._zod,"values",()=>t.innerType._zod.values),Ut(e._zod,"optin",()=>t.innerType._zod.optin),Ut(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(Q1):Q1(s)}});function Q1(e){return e.value=Object.freeze(e.value),e}const uI=ve("$ZodCustom",(e,t)=>{Wn.init(e,t),en.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,s=t.fn(a);if(s instanceof Promise)return s.then(l=>X1(l,n,a,e));X1(s,n,a,e)}});function X1(e,t,n,a){if(!e){const s={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(s.params=a._zod.def.params),t.issues.push(Fl(s))}}class Yj{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const a=n[0];if(this._map.set(t,a),a&&typeof a=="object"&&"id"in a){if(this._idmap.has(a.id))throw new Error(`ID ${a.id} already exists in the registry`);this._idmap.set(a.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const a={...this.get(n)??{}};return delete a.id,{...a,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function Qj(){return new Yj}const Tl=Qj();function dI(e,t){return new e({type:"string",...Ue(t)})}function pI(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 fI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ue(t)})}function hI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ue(t)})}function mI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ue(t)})}function gI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ue(t)})}function vI(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ue(t)})}function yI(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ue(t)})}function bI(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ue(t)})}function xI(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ue(t)})}function wI(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ue(t)})}function kI(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ue(t)})}function SI(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ue(t)})}function jI(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ue(t)})}function CI(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ue(t)})}function NI(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ue(t)})}function EI(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ue(t)})}function AI(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ue(t)})}function TI(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ue(t)})}function _I(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ue(t)})}function RI(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ue(t)})}function OI(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ue(t)})}function LI(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ue(t)})}function MI(e,t){return new e({type:"string",format:"date",check:"string_format",...Ue(t)})}function DI(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ue(t)})}function zI(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ue(t)})}function $I(e,t){return new e({type:"number",checks:[],...Ue(t)})}function II(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ue(t)})}function PI(e){return new e({type:"unknown"})}function UI(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 Ph(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 Uh(e,t){return new Wj({check:"greater_than",...Ue(t),value:e,inclusive:!0})}function nw(e,t){return new l$({check:"multiple_of",...Ue(t),value:e})}function Xj(e,t){return new u$({check:"max_length",...Ue(t),maximum:e})}function vd(e,t){return new d$({check:"min_length",...Ue(t),minimum:e})}function Jj(e,t){return new p$({check:"length_equals",...Ue(t),length:e})}function BI(e,t){return new f$({check:"string_format",format:"regex",...Ue(t),pattern:e})}function FI(e){return new h$({check:"string_format",format:"lowercase",...Ue(e)})}function HI(e){return new m$({check:"string_format",format:"uppercase",...Ue(e)})}function qI(e,t){return new g$({check:"string_format",format:"includes",...Ue(t),includes:e})}function GI(e,t){return new v$({check:"string_format",format:"starts_with",...Ue(t),prefix:e})}function VI(e,t){return new y$({check:"string_format",format:"ends_with",...Ue(t),suffix:e})}function ec(e){return new b$({check:"overwrite",tx:e})}function WI(e){return ec(t=>t.normalize(e))}function ZI(){return ec(e=>e.trim())}function KI(){return ec(e=>e.toLowerCase())}function YI(){return ec(e=>e.toUpperCase())}function QI(e,t,n){return new e({type:"array",element:t,...Ue(n)})}function XI(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ue(n)})}class rw{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??Tl,this.target=(t==null?void 0:t.target)??"draft-2020-12",this.unrepresentable=(t==null?void 0:t.unrepresentable)??"throw",this.override=(t==null?void 0:t.override)??(()=>{}),this.io=(t==null?void 0:t.io)??"output",this.seen=new Map}process(t,n={path:[],schemaPath:[]}){var m,y,b;var a;const s=t._zod.def,l={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},u=this.seen.get(t);if(u)return u.count++,n.schemaPath.includes(t)&&(u.cycle=n.path),u.schema;const d={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,d);const f=(y=(m=t._zod).toJSONSchema)==null?void 0:y.call(m);if(f)d.schema=f;else{const k={...n,schemaPath:[...n.schemaPath,t],path:n.path},j=t._zod.parent;if(j)d.ref=j,this.process(j,k),this.seen.get(j).isParent=!0;else{const N=d.schema;switch(s.type){case"string":{const S=N;S.type="string";const{minimum:A,maximum:E,format:T,patterns:U,contentEncoding:_}=t._zod.bag;if(typeof A=="number"&&(S.minLength=A),typeof E=="number"&&(S.maxLength=E),T&&(S.format=l[T]??T,S.format===""&&delete S.format),_&&(S.contentEncoding=_),U&&U.size>0){const z=[...U];z.length===1?S.pattern=z[0].source:z.length>1&&(d.schema.allOf=[...z.map(q=>({...this.target==="draft-7"?{type:"string"}:{},pattern:q.source}))])}break}case"number":{const S=N,{minimum:A,maximum:E,format:T,multipleOf:U,exclusiveMaximum:_,exclusiveMinimum:z}=t._zod.bag;typeof T=="string"&&T.includes("int")?S.type="integer":S.type="number",typeof z=="number"&&(S.exclusiveMinimum=z),typeof A=="number"&&(S.minimum=A,typeof z=="number"&&(z>=A?delete S.minimum:delete S.exclusiveMinimum)),typeof _=="number"&&(S.exclusiveMaximum=_),typeof E=="number"&&(S.maximum=E,typeof _=="number"&&(_<=E?delete S.maximum:delete S.exclusiveMaximum)),typeof U=="number"&&(S.multipleOf=U);break}case"boolean":{const S=N;S.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{N.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{N.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const S=N,{minimum:A,maximum:E}=t._zod.bag;typeof A=="number"&&(S.minItems=A),typeof E=="number"&&(S.maxItems=E),S.type="array",S.items=this.process(s.element,{...k,path:[...k.path,"items"]});break}case"object":{const S=N;S.type="object",S.properties={};const A=s.shape;for(const U in A)S.properties[U]=this.process(A[U],{...k,path:[...k.path,"properties",U]});const E=new Set(Object.keys(A)),T=new Set([...E].filter(U=>{const _=s.shape[U]._zod;return this.io==="input"?_.optin===void 0:_.optout===void 0}));T.size>0&&(S.required=Array.from(T)),((b=s.catchall)==null?void 0:b._zod.def.type)==="never"?S.additionalProperties=!1:s.catchall?s.catchall&&(S.additionalProperties=this.process(s.catchall,{...k,path:[...k.path,"additionalProperties"]})):this.io==="output"&&(S.additionalProperties=!1);break}case"union":{const S=N;S.anyOf=s.options.map((A,E)=>this.process(A,{...k,path:[...k.path,"anyOf",E]}));break}case"intersection":{const S=N,A=this.process(s.left,{...k,path:[...k.path,"allOf",0]}),E=this.process(s.right,{...k,path:[...k.path,"allOf",1]}),T=_=>"allOf"in _&&Object.keys(_).length===1,U=[...T(A)?A.allOf:[A],...T(E)?E.allOf:[E]];S.allOf=U;break}case"tuple":{const S=N;S.type="array";const A=s.items.map((U,_)=>this.process(U,{...k,path:[...k.path,"prefixItems",_]}));if(this.target==="draft-2020-12"?S.prefixItems=A:S.items=A,s.rest){const U=this.process(s.rest,{...k,path:[...k.path,"items"]});this.target==="draft-2020-12"?S.items=U:S.additionalItems=U}s.rest&&(S.items=this.process(s.rest,{...k,path:[...k.path,"items"]}));const{minimum:E,maximum:T}=t._zod.bag;typeof E=="number"&&(S.minItems=E),typeof T=="number"&&(S.maxItems=T);break}case"record":{const S=N;S.type="object",S.propertyNames=this.process(s.keyType,{...k,path:[...k.path,"propertyNames"]}),S.additionalProperties=this.process(s.valueType,{...k,path:[...k.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const S=N,A=Mj(s.entries);A.every(E=>typeof E=="number")&&(S.type="number"),A.every(E=>typeof E=="string")&&(S.type="string"),S.enum=A;break}case"literal":{const S=N,A=[];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");A.push(Number(E))}else A.push(E);if(A.length!==0)if(A.length===1){const E=A[0];S.type=E===null?"null":typeof E,S.const=E}else A.every(E=>typeof E=="number")&&(S.type="number"),A.every(E=>typeof E=="string")&&(S.type="string"),A.every(E=>typeof E=="boolean")&&(S.type="string"),A.every(E=>E===null)&&(S.type="null"),S.enum=A;break}case"file":{const S=N,A={type:"string",format:"binary",contentEncoding:"binary"},{minimum:E,maximum:T,mime:U}=t._zod.bag;E!==void 0&&(A.minLength=E),T!==void 0&&(A.maxLength=T),U?U.length===1?(A.contentMediaType=U[0],Object.assign(S,A)):S.anyOf=U.map(_=>({...A,contentMediaType:_})):Object.assign(S,A);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const S=this.process(s.innerType,k);N.anyOf=[S,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,k),d.ref=s.innerType;break}case"success":{const S=N;S.type="boolean";break}case"default":{this.process(s.innerType,k),d.ref=s.innerType,N.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,k),d.ref=s.innerType,this.io==="input"&&(N._prefault=JSON.parse(JSON.stringify(s.defaultValue)));break}case"catch":{this.process(s.innerType,k),d.ref=s.innerType;let S;try{S=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}N.default=S;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const S=N,A=t._zod.pattern;if(!A)throw new Error("Pattern not found in template literal");S.type="string",S.pattern=A.source;break}case"pipe":{const S=this.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;this.process(S,k),d.ref=S;break}case"readonly":{this.process(s.innerType,k),d.ref=s.innerType,N.readOnly=!0;break}case"promise":{this.process(s.innerType,k),d.ref=s.innerType;break}case"optional":{this.process(s.innerType,k),d.ref=s.innerType;break}case"lazy":{const S=t._zod.innerType;this.process(S,k),d.ref=S;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const h=this.metadataRegistry.get(t);return h&&Object.assign(d.schema,h),this.io==="input"&&pn(t)&&(delete d.schema.examples,delete d.schema.default),this.io==="input"&&d.schema._prefault&&((a=d.schema).default??(a.default=d.schema._prefault)),delete d.schema._prefault,this.seen.get(t).schema}emit(t,n){var g,m,y,b,k,j;const a={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},s=this.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=N=>{var U;const S=this.target==="draft-2020-12"?"$defs":"definitions";if(a.external){const _=(U=a.external.registry.get(N[0]))==null?void 0:U.id,z=a.external.uri??(D=>D);if(_)return{ref:z(_)};const q=N[1].defId??N[1].schema.id??`schema${this.counter++}`;return N[1].defId=q,{defId:q,ref:`${z("__shared")}#/${S}/${q}`}}if(N[1]===s)return{ref:"#"};const E=`#/${S}/`,T=N[1].schema.id??`__schema${this.counter++}`;return{defId:T,ref:E+T}},u=N=>{if(N[1].schema.$ref)return;const S=N[1],{ref:A,defId:E}=l(N);S.def={...S.schema},E&&(S.defId=E);const T=S.schema;for(const U in T)delete T[U];T.$ref=A};if(a.cycles==="throw")for(const N of this.seen.entries()){const S=N[1];if(S.cycle)throw new Error(`Cycle detected: #/${(g=S.cycle)==null?void 0:g.join("/")}/<root>
1419
-
1420
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const N of this.seen.entries()){const S=N[1];if(t===N[0]){u(N);continue}if(a.external){const E=(m=a.external.registry.get(N[0]))==null?void 0:m.id;if(t!==N[0]&&E){u(N);continue}}if((y=this.metadataRegistry.get(N[0]))==null?void 0:y.id){u(N);continue}if(S.cycle){u(N);continue}if(S.count>1&&a.reused==="ref"){u(N);continue}}const d=(N,S)=>{const A=this.seen.get(N),E=A.def??A.schema,T={...E};if(A.ref===null)return;const U=A.ref;if(A.ref=null,U){d(U,S);const _=this.seen.get(U).schema;_.$ref&&S.target==="draft-7"?(E.allOf=E.allOf??[],E.allOf.push(_)):(Object.assign(E,_),Object.assign(E,T))}A.isParent||this.override({zodSchema:N,jsonSchema:E,path:A.path??[]})};for(const N of[...this.seen.entries()].reverse())d(N[0],{target:this.target});const f={};if(this.target==="draft-2020-12"?f.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?f.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),(b=a.external)!=null&&b.uri){const N=(k=a.external.registry.get(t))==null?void 0:k.id;if(!N)throw new Error("Schema is missing an `id` property");f.$id=a.external.uri(N)}Object.assign(f,s.def);const h=((j=a.external)==null?void 0:j.defs)??{};for(const N of this.seen.entries()){const S=N[1];S.def&&S.defId&&(h[S.defId]=S.def)}a.external||Object.keys(h).length>0&&(this.target==="draft-2020-12"?f.$defs=h:f.definitions=h);try{return JSON.parse(JSON.stringify(f))}catch{throw new Error("Error converting schema to JSON.")}}}function JI(e,t){if(e instanceof Yj){const a=new rw(t),s={};for(const d of e._idmap.entries()){const[f,h]=d;a.process(h)}const l={},u={registry:e,uri:t==null?void 0:t.uri,defs:s};for(const d of e._idmap.entries()){const[f,h]=d;l[f]=a.emit(h,{...t,external:u})}if(Object.keys(s).length>0){const d=a.target==="draft-2020-12"?"$defs":"definitions";l.__shared={[d]:s}}return{schemas:l}}const n=new rw(t);return n.process(e),n.emit(e,t)}function pn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;switch(s.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return pn(s.element,n);case"object":{for(const l in s.shape)if(pn(s.shape[l],n))return!0;return!1}case"union":{for(const l of s.options)if(pn(l,n))return!0;return!1}case"intersection":return pn(s.left,n)||pn(s.right,n);case"tuple":{for(const l of s.items)if(pn(l,n))return!0;return!!(s.rest&&pn(s.rest,n))}case"record":return pn(s.keyType,n)||pn(s.valueType,n);case"map":return pn(s.keyType,n)||pn(s.valueType,n);case"set":return pn(s.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return pn(s.innerType,n);case"lazy":return pn(s.getter(),n);case"default":return pn(s.innerType,n);case"prefault":return pn(s.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return pn(s.in,n)||pn(s.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${s.type}`)}const e3=ve("ZodISODateTime",(e,t)=>{L$.init(e,t),Vt.init(e,t)});function t3(e){return LI(e3,e)}const n3=ve("ZodISODate",(e,t)=>{M$.init(e,t),Vt.init(e,t)});function r3(e){return MI(n3,e)}const a3=ve("ZodISOTime",(e,t)=>{D$.init(e,t),Vt.init(e,t)});function i3(e){return DI(a3,e)}const s3=ve("ZodISODuration",(e,t)=>{z$.init(e,t),Vt.init(e,t)});function o3(e){return zI(s3,e)}const l3=(e,t)=>{Ij.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Rz(e,n)},flatten:{value:n=>_z(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Vd=ve("ZodError",l3,{Parent:Error}),c3=Oz(Vd),u3=Lz(Vd),d3=Uj(Vd),p3=Bj(Vd),hn=ve("ZodType",(e,t)=>(en.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),e.clone=(n,a)=>us(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>c3(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>d3(e,n,a),e.parseAsync=async(n,a)=>u3(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>p3(e,n,a),e.spa=e.safeParseAsync,e.refine=(n,a)=>e.check(t6(n,a)),e.superRefine=n=>e.check(n6(n)),e.overwrite=n=>e.check(ec(n)),e.optional=()=>ow(e),e.nullable=()=>lw(e),e.nullish=()=>ow(lw(e)),e.nonoptional=n=>W3(e,n),e.array=()=>Ia(e),e.or=n=>uv([e,n]),e.and=n=>P3(e,n),e.transform=n=>cw(e,B3(n)),e.default=n=>q3(e,n),e.prefault=n=>V3(e,n),e.catch=n=>K3(e,n),e.pipe=n=>cw(e,n),e.readonly=()=>X3(e),e.describe=n=>{const a=e.clone();return Tl.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=Tl.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Tl.get(e);const a=e.clone();return Tl.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),eC=ve("_ZodString",(e,t)=>{cv.init(e,t),hn.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...a)=>e.check(BI(...a)),e.includes=(...a)=>e.check(qI(...a)),e.startsWith=(...a)=>e.check(GI(...a)),e.endsWith=(...a)=>e.check(VI(...a)),e.min=(...a)=>e.check(vd(...a)),e.max=(...a)=>e.check(Xj(...a)),e.length=(...a)=>e.check(Jj(...a)),e.nonempty=(...a)=>e.check(vd(1,...a)),e.lowercase=a=>e.check(FI(a)),e.uppercase=a=>e.check(HI(a)),e.trim=()=>e.check(ZI()),e.normalize=(...a)=>e.check(WI(...a)),e.toLowerCase=()=>e.check(KI()),e.toUpperCase=()=>e.check(YI())}),f3=ve("ZodString",(e,t)=>{cv.init(e,t),eC.init(e,t),e.email=n=>e.check(pI(h3,n)),e.url=n=>e.check(vI(m3,n)),e.jwt=n=>e.check(OI(_3,n)),e.emoji=n=>e.check(yI(g3,n)),e.guid=n=>e.check(J1(aw,n)),e.uuid=n=>e.check(fI(Ou,n)),e.uuidv4=n=>e.check(hI(Ou,n)),e.uuidv6=n=>e.check(mI(Ou,n)),e.uuidv7=n=>e.check(gI(Ou,n)),e.nanoid=n=>e.check(bI(v3,n)),e.guid=n=>e.check(J1(aw,n)),e.cuid=n=>e.check(xI(y3,n)),e.cuid2=n=>e.check(wI(b3,n)),e.ulid=n=>e.check(kI(x3,n)),e.base64=n=>e.check(TI(E3,n)),e.base64url=n=>e.check(_I(A3,n)),e.xid=n=>e.check(SI(w3,n)),e.ksuid=n=>e.check(jI(k3,n)),e.ipv4=n=>e.check(CI(S3,n)),e.ipv6=n=>e.check(NI(j3,n)),e.cidrv4=n=>e.check(EI(C3,n)),e.cidrv6=n=>e.check(AI(N3,n)),e.e164=n=>e.check(RI(T3,n)),e.datetime=n=>e.check(t3(n)),e.date=n=>e.check(r3(n)),e.time=n=>e.check(i3(n)),e.duration=n=>e.check(o3(n))});function $e(e){return dI(f3,e)}const Vt=ve("ZodStringFormat",(e,t)=>{Ht.init(e,t),eC.init(e,t)}),h3=ve("ZodEmail",(e,t)=>{j$.init(e,t),Vt.init(e,t)}),aw=ve("ZodGUID",(e,t)=>{k$.init(e,t),Vt.init(e,t)}),Ou=ve("ZodUUID",(e,t)=>{S$.init(e,t),Vt.init(e,t)}),m3=ve("ZodURL",(e,t)=>{C$.init(e,t),Vt.init(e,t)}),g3=ve("ZodEmoji",(e,t)=>{N$.init(e,t),Vt.init(e,t)}),v3=ve("ZodNanoID",(e,t)=>{E$.init(e,t),Vt.init(e,t)}),y3=ve("ZodCUID",(e,t)=>{A$.init(e,t),Vt.init(e,t)}),b3=ve("ZodCUID2",(e,t)=>{T$.init(e,t),Vt.init(e,t)}),x3=ve("ZodULID",(e,t)=>{_$.init(e,t),Vt.init(e,t)}),w3=ve("ZodXID",(e,t)=>{R$.init(e,t),Vt.init(e,t)}),k3=ve("ZodKSUID",(e,t)=>{O$.init(e,t),Vt.init(e,t)}),S3=ve("ZodIPv4",(e,t)=>{$$.init(e,t),Vt.init(e,t)}),j3=ve("ZodIPv6",(e,t)=>{I$.init(e,t),Vt.init(e,t)}),C3=ve("ZodCIDRv4",(e,t)=>{P$.init(e,t),Vt.init(e,t)}),N3=ve("ZodCIDRv6",(e,t)=>{U$.init(e,t),Vt.init(e,t)}),E3=ve("ZodBase64",(e,t)=>{B$.init(e,t),Vt.init(e,t)}),A3=ve("ZodBase64URL",(e,t)=>{H$.init(e,t),Vt.init(e,t)}),T3=ve("ZodE164",(e,t)=>{q$.init(e,t),Vt.init(e,t)}),_3=ve("ZodJWT",(e,t)=>{V$.init(e,t),Vt.init(e,t)}),tC=ve("ZodNumber",(e,t)=>{Kj.init(e,t),hn.init(e,t),e.gt=(a,s)=>e.check(tw(a,s)),e.gte=(a,s)=>e.check(Uh(a,s)),e.min=(a,s)=>e.check(Uh(a,s)),e.lt=(a,s)=>e.check(ew(a,s)),e.lte=(a,s)=>e.check(Ph(a,s)),e.max=(a,s)=>e.check(Ph(a,s)),e.int=a=>e.check(iw(a)),e.safe=a=>e.check(iw(a)),e.positive=a=>e.check(tw(0,a)),e.nonnegative=a=>e.check(Uh(0,a)),e.negative=a=>e.check(ew(0,a)),e.nonpositive=a=>e.check(Ph(0,a)),e.multipleOf=(a,s)=>e.check(nw(a,s)),e.step=(a,s)=>e.check(nw(a,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function aa(e){return $I(tC,e)}const R3=ve("ZodNumberFormat",(e,t)=>{W$.init(e,t),tC.init(e,t)});function iw(e){return II(R3,e)}const O3=ve("ZodUnknown",(e,t)=>{Z$.init(e,t),hn.init(e,t)});function sw(){return PI(O3)}const L3=ve("ZodNever",(e,t)=>{K$.init(e,t),hn.init(e,t)});function M3(e){return UI(L3,e)}const D3=ve("ZodArray",(e,t)=>{Y$.init(e,t),hn.init(e,t),e.element=t.element,e.min=(n,a)=>e.check(vd(n,a)),e.nonempty=n=>e.check(vd(1,n)),e.max=(n,a)=>e.check(Xj(n,a)),e.length=(n,a)=>e.check(Jj(n,a)),e.unwrap=()=>e.element});function Ia(e,t){return QI(D3,e,t)}const z3=ve("ZodObject",(e,t)=>{Q$.init(e,t),hn.init(e,t),Ut(e,"shape",()=>t.shape),e.keyof=()=>fo(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:sw()}),e.loose=()=>e.clone({...e._zod.def,catchall:sw()}),e.strict=()=>e.clone({...e._zod.def,catchall:M3()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Nz(e,n),e.merge=n=>Ez(e,n),e.pick=n=>jz(e,n),e.omit=n=>Cz(e,n),e.partial=(...n)=>Az(nC,e,n[0]),e.required=(...n)=>Tz(rC,e,n[0])});function Pt(e,t){const n={type:"object",get shape(){return sv(this,"shape",{...e}),this.shape},...Ue(t)};return new z3(n)}const $3=ve("ZodUnion",(e,t)=>{X$.init(e,t),hn.init(e,t),e.options=t.options});function uv(e,t){return new $3({type:"union",options:e,...Ue(t)})}const I3=ve("ZodIntersection",(e,t)=>{J$.init(e,t),hn.init(e,t)});function P3(e,t){return new I3({type:"intersection",left:e,right:t})}const Um=ve("ZodEnum",(e,t)=>{eI.init(e,t),hn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,s)=>{const l={};for(const u of a)if(n.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Um({...t,checks:[],...Ue(s),entries:l})},e.exclude=(a,s)=>{const l={...t.entries};for(const u of a)if(n.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new Um({...t,checks:[],...Ue(s),entries:l})}});function fo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Um({type:"enum",entries:n,...Ue(t)})}const U3=ve("ZodTransform",(e,t)=>{tI.init(e,t),hn.init(e,t),e._zod.parse=(n,a)=>{n.addIssue=l=>{if(typeof l=="string")n.issues.push(Fl(l,n.value,t));else{const u=l;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=n.value),u.inst??(u.inst=e),u.continue??(u.continue=!0),n.issues.push(Fl(u))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(l=>(n.value=l,n)):(n.value=s,n)}});function B3(e){return new U3({type:"transform",transform:e})}const nC=ve("ZodOptional",(e,t)=>{nI.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ow(e){return new nC({type:"optional",innerType:e})}const F3=ve("ZodNullable",(e,t)=>{rI.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function lw(e){return new F3({type:"nullable",innerType:e})}const H3=ve("ZodDefault",(e,t)=>{aI.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function q3(e,t){return new H3({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const G3=ve("ZodPrefault",(e,t)=>{iI.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function V3(e,t){return new G3({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const rC=ve("ZodNonOptional",(e,t)=>{sI.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function W3(e,t){return new rC({type:"nonoptional",innerType:e,...Ue(t)})}const Z3=ve("ZodCatch",(e,t)=>{oI.init(e,t),hn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function K3(e,t){return new Z3({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Y3=ve("ZodPipe",(e,t)=>{lI.init(e,t),hn.init(e,t),e.in=t.in,e.out=t.out});function cw(e,t){return new Y3({type:"pipe",in:e,out:t})}const Q3=ve("ZodReadonly",(e,t)=>{cI.init(e,t),hn.init(e,t)});function X3(e){return new Q3({type:"readonly",innerType:e})}const J3=ve("ZodCustom",(e,t)=>{uI.init(e,t),hn.init(e,t)});function e6(e){const t=new Wn({check:"custom"});return t._zod.check=e,t}function t6(e,t={}){return XI(J3,e,t)}function n6(e){const t=e6(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(Fl(a,n.value,t._zod.def));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(Fl(s))}},e(n.value,n)));return t}function Bh(e,t){if(!t||e==null)return;if(!t.includes("."))return e[t];let n=e;for(const a of t.split(".")){if(n==null)return;n=n[a]}return n}function Ze(e){if(typeof e=="number")return e;if(typeof e=="string"){const t=Number(e);return isNaN(t)?0:t}return typeof e=="boolean"&&e?1:0}const dv={Count:{name:"Count",signature:"Count(array) → number",description:"Returns array length",fn:e=>Array.isArray(e)?e.length:0},First:{name:"First",signature:"First(array) → element",description:"Returns first element of array",fn:e=>Array.isArray(e)?e[0]??null:null},Last:{name:"Last",signature:"Last(array) → element",description:"Returns last element of array",fn:e=>Array.isArray(e)?e[e.length-1]??null:null},Sum:{name:"Sum",signature:"Sum(numbers[]) → number",description:"Sum of numeric array",fn:e=>Array.isArray(e)?e.reduce((t,n)=>t+Ze(n),0):0},Avg:{name:"Avg",signature:"Avg(numbers[]) → number",description:"Average of numeric array",fn:e=>Array.isArray(e)&&e.length?e.reduce((t,n)=>t+Ze(n),0)/e.length:0},Min:{name:"Min",signature:"Min(numbers[]) → number",description:"Minimum value in array",fn:e=>Array.isArray(e)&&e.length?e.reduce((t,n)=>Math.min(t,Ze(n)),Ze(e[0])):0},Max:{name:"Max",signature:"Max(numbers[]) → number",description:"Maximum value in array",fn:e=>Array.isArray(e)&&e.length?e.reduce((t,n)=>Math.max(t,Ze(n)),Ze(e[0])):0},Sort:{name:"Sort",signature:"Sort(array, field, direction?) → sorted array",description:'Sort array by field. Direction: "asc" (default) or "desc"',fn:(e,t,n)=>{if(!Array.isArray(e))return e;const a=String(t??""),s=String(n??"asc")==="desc";return[...e].sort((l,u)=>{const d=a?Bh(l,a):l,f=a?Bh(u,a):u,h=typeof d=="number"||typeof d=="string"&&!isNaN(Number(d))&&d!=="",g=typeof f=="number"||typeof f=="string"&&!isNaN(Number(f))&&f!=="";if(h&&g){const y=Ze(d)-Ze(f);return s?-y:y}const m=String(d??"").localeCompare(String(f??""));return s?-m:m})}},Filter:{name:"Filter",signature:'Filter(array, field, operator: "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains", value) → filtered array',description:"Filter array by field value",fn:(e,t,n,a)=>{if(!Array.isArray(e))return[];const s=String(t??""),l=String(n??"==");return e.filter(u=>{const d=s?Bh(u,s):u;switch(l){case"==":return d==a;case"!=":return d!=a;case">":return Ze(d)>Ze(a);case"<":return Ze(d)<Ze(a);case">=":return Ze(d)>=Ze(a);case"<=":return Ze(d)<=Ze(a);case"contains":return String(d??"").includes(String(a??""));default:return!1}})}},Round:{name:"Round",signature:"Round(number, decimals?) → number",description:"Round to N decimal places (default 0)",fn:(e,t)=>{const n=Ze(e),a=t!=null?Ze(t):0,s=Math.pow(10,a);return Math.round(n*s)/s}},Abs:{name:"Abs",signature:"Abs(number) → number",description:"Absolute value",fn:e=>Math.abs(Ze(e))},Floor:{name:"Floor",signature:"Floor(number) → number",description:"Round down to nearest integer",fn:e=>Math.floor(Ze(e))},Ceil:{name:"Ceil",signature:"Ceil(number) → number",description:"Round up to nearest integer",fn:e=>Math.ceil(Ze(e))}},pv=new Set(["Each"]),r6={Each:{signature:"Each(array, varName, template)",description:"Evaluate template for each element. varName is the loop variable — use it ONLY inside the template expression (inline). Do NOT create a separate statement for the template."}},Ir={Run:"run",ToAssistant:"continue_conversation",OpenUrl:"open_url",Set:"set",Reset:"reset"},aC=new Set(["Action",...Object.keys(Ir)]),a6=new Set([...Object.keys(dv),...pv,...aC]);function Hl(e){return a6.has(e)}const ki={Query:"Query",Mutation:"Mutation"};function yd(e){return e in ki}function bd(e){const t=e.type;if(t==="string"){const n=e.enum;return n?n.map(a=>`"${a}"`).join(" | "):"string"}if(t==="number"||t==="integer")return"number";if(t==="boolean")return"boolean";if(t==="array"){const n=e.items;return n?`${bd(n)}[]`:"any[]"}if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const a=e.required??[];return`{${Object.entries(n).map(([s,l])=>`${s}${a.includes(s)?"":"?"}: ${bd(l)}`).join(", ")}}`}return"object"}return"any"}function 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 a={};for(const[s,l]of Object.entries(n))a[s]=iC(l);return a}return{}}return null}const i6="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 s6(e,t){const n=["## Syntax Rules","","1. Each statement is on its own line: `identifier = Expression`",`2. \`root\` is the entry point — every program must define \`root = ${e}(...)\``,'3. Expressions are: strings ("..."), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)',"4. Use references for readability: define `name = ...` on one line, then use `name` later","5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.",'6. Arguments are POSITIONAL (order matters, not names). Write `Stack([children], "row", "l")` NOT `Stack([children], direction: "row", gap: "l")` — colon syntax is NOT supported and silently breaks',"7. Optional arguments can be omitted from the end"];let a=8;return t.bindings&&n.push(`${a++}. Declare mutable state with \`$varName = defaultValue\`. Components marked with \`$binding\` can read/write these. Undeclared $variables are auto-created with null default.`),t.supportsExpressions&&n.push(`${a++}. String concatenation: \`"text" + $var + "more"\``,`${a++}. Dot member access: \`query.field\` reads a field; on arrays it extracts that field from every element`,`${a++}. Index access: \`arr[0]\`, \`data[index]\``,`${a++}. Arithmetic operators: +, -, *, /, % (work on numbers; + is string concat when either side is a string)`,`${a++}. Comparison: ==, !=, >, <, >=, <=`,`${a++}. Logical: &&, ||, ! (prefix)`,`${a++}. Ternary: \`condition ? valueIfTrue : valueIfFalse\``,`${a++}. Parentheses for grouping: \`(a + b) * c\``),n.push("- Strings use double quotes with backslash escaping"),n.join(`
1421
- `)}function o6(){const e=Object.values(dv).map(n=>`@${n.signature} — ${n.description}`),t=Object.values(r6).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 l6(){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 c6(){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 u6(e){const t=['- @ToAssistant("message") — Send a message to the assistant (for conversational buttons like "Tell me more", "Explain this")','- @OpenUrl("https://...") — Navigate to a URL'];e.bindings&&t.push("- @Set($variable, value) — Set a $variable to a specific value",'- @Reset($var1, $var2, ...) — Reset $variables to their declared defaults (e.g. @Reset($title, $priority) restores $title="" and $priority="medium")'),e.toolCalls&&t.unshift("- @Run(queryOrMutationRef) — Execute a Mutation or re-fetch a Query (ref must be a declared Query/Mutation)");const n=[];e.toolCalls&&n.push('Example — mutation + refresh + reset (PREFERRED pattern):\n```\n$binding = "default"\nresult = Mutation("tool_name", {field: $binding})\ndata = Query("tool_name", {}, {rows: []})\nonSubmit = Action([@Run(result), @Run(data), @Reset($binding)])\n```'),n.push('Example — simple nav:\n```\nviewBtn = Button("View", Action([@OpenUrl("https://example.com")]))\n```');const a=['- Action can be assigned to a variable or inlined: Button("Go", onSubmit) and Button("Go", Action([...])) both work'];return e.toolCalls&&a.push("- If a @Run(mutation) step fails, remaining steps are skipped (halt on failure)","- @Run(queryRef) re-fetches the query (fire-and-forget, cannot fail)"),`## Action — Button Behavior
1465
-
1466
- Action([@steps...]) wires button clicks to operations. Steps are @-prefixed built-in actions. Steps execute in order.
1467
- Buttons without an explicit Action prop automatically send their label to the assistant (equivalent to Action([@ToAssistant(label)])).
1468
-
1469
- Available steps:
1470
- ${t.join(`
1471
- `)}
1472
-
1473
- ${n.join(`
1474
-
1475
- `)}
1476
-
1477
- ${a.join(`
1478
- `)}`}function d6(){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 p6(){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 f6(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 h6(){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 m6(){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 g6(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 v6(e){let t="";if(e.inputSchema){const s=e.inputSchema.properties,l=e.inputSchema.required??[];s&&Object.keys(s).length>0&&(t=Object.entries(s).map(([u,d])=>`${u}${l.includes(u)?"":"?"}: ${bd(d)}`).join(", "))}let n="";e.outputSchema&&(n=` → ${bd(e.outputSchema)}`);let a=`- ${e.name}(${t})${n}`;return e.description&&(a+=`
1608
- ${e.description}`),a}function y6(e){const t=[],n=[],a=[];for(const l of e)typeof l=="string"?n.push(l):a.push(l);t.push("## Available Tools"),t.push(""),t.push("Use these with Query() for read operations or Mutation() for write operations. The LLM decides which is appropriate based on the tool's purpose."),t.push("");for(const l of n)t.push(`- ${l}`);for(const l of a)t.push(v6(l));const s=a.filter(l=>l.outputSchema);if(s.length>0){t.push(""),t.push("### Default values for Query results"),t.push(""),t.push("Use these shapes as minimal Query defaults:");for(const l of s){const u=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 b6(e,t){var s,l;const n=["## Component Signatures","","Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming."];if(t.usesActionExpression){const u=[t.toolCalls?"@Run":"","@ToAssistant","@OpenUrl",t.bindings?"@Set":"",t.bindings?"@Reset":""].filter(Boolean);n.push(`Props typed \`ActionExpression\` accept an Action([@steps...]) expression. See the Action section for available steps (${u.join(", ")}).`)}(t.bindings||Object.values(e.components).some(u=>{var d;return(d=u.signature)==null?void 0:d.includes("$binding")}))&&n.push("Props marked `$binding<type>` accept a `$variable` reference for two-way binding.");const a=u=>u.description?`${u.signature} — ${u.description}`:u.signature;if((s=e.componentGroups)!=null&&s.length){const u=new Set;for(const f of e.componentGroups){n.push("",`### ${f.name}`);for(const h of f.components){if(u.has(h))continue;const g=e.components[h];g&&(u.add(h),n.push(a(g)))}if((l=f.notes)!=null&&l.length)for(const h of f.notes)n.push(h)}const d=Object.keys(e.components).filter(f=>!u.has(f));if(d.length){n.push("","### Other");for(const f of d){const h=e.components[f];n.push(a(h))}}}else{n.push("");for(const[,u]of Object.entries(e.components))n.push(a(u))}return n.join(`
1610
- `)}function x6(e){var h,g,m;const t=e.root??"Root",n=!!((h=e.tools)!=null&&h.length),a=e.toolCalls??n,s=e.bindings??a,l=a||s,u=Object.values(e.components).some(y=>{var b;return(b=y.signature)==null?void 0:b.includes("ActionExpression")}),d=[];d.push(e.preamble??i6),d.push(""),d.push(s6(t,{supportsExpressions:l,bindings:s})),d.push(""),d.push(b6(e,{toolCalls:a,bindings:s,usesActionExpression:u})),l&&(d.push(""),d.push(o6())),a&&(d.push(""),d.push(l6()),d.push(""),d.push(c6())),u&&(d.push(""),d.push(u6({toolCalls:a,bindings:s}))),a&&s&&(d.push(""),d.push(d6())),a&&(d.push(""),d.push(m6())),(g=e.tools)!=null&&g.length&&(d.push(""),d.push(y6(e.tools))),d.push(""),d.push(f6(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(p6())),e.inlineMode&&(d.push(""),d.push(h6())),d.push(g6(t,{toolCalls:a,bindings:s})),(m=e.additionalRules)!=null&&m.length){d.push("");for(const y of e.additionalRules)d.push(`- ${y}`)}return d.join(`
1611
- `)}const w6=new WeakSet;function Ll(e){return typeof e=="object"&&e!==null&&w6.has(e)}const sC=new WeakMap;function k6(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 S6(e){return k6(e.props,e.name),sC.set(e.props,e.name),{...e,ref:e.props}}function Pa(e){var t;return(t=e==null?void 0:e._zod)==null?void 0:t.def}function fv(e){var t;return(t=Pa(e))==null?void 0:t.type}function oC(e){const t=fv(e);return t==="optional"||t==="default"||t==="nullable"}function tc(e){let t=e,n=Pa(t);for(;(n==null?void 0:n.type)==="optional"||(n==null?void 0:n.type)==="default"||(n==null?void 0:n.type)==="nullable";)t=n.innerType,n=Pa(t);return t}function lC(e){return fv(tc(e))==="array"}function j6(e){const t=Pa(tc(e));if((t==null?void 0:t.type)==="array")return t.element??t.innerType}function C6(e){const t=Pa(tc(e));if((t==null?void 0:t.type)==="enum"){if(Array.isArray(t.values))return t.values;if(t.entries&&typeof t.entries=="object")return Object.keys(t.entries)}}function N6(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=Pa(e);if((t==null?void 0:t.type)==="union"&&Array.isArray(t.options))return t.options}function E6(e){const t=Pa(e);if((t==null?void 0:t.type)==="object"&&t.shape&&typeof t.shape=="object")return t.shape}function Js(e,t){const n=Ll(e),a=A6(tc(e),t);if(a)return n?`$binding<${a}>`:a}function A6(e,t){var d;const n=N6(e,t);if(n)return n;const a=uw(e);if(a){const f=a.map(h=>Js(h,t)).filter(Boolean);if(f.length>0)return f.join(" | ")}if(lC(e)){const f=j6(e);if(!f)return;const h=Js(f,t);return h?uw(tc(f))!==void 0?`(${h})[]`:`${h}[]`:void 0}const s=fv(e);if(s==="string")return"string";if(s==="number")return"number";if(s==="boolean")return"boolean";if(s==="any")return"any";if(s==="record"){const f=Pa(e);return`Record<${Js(f==null?void 0:f.keyType,t)??"string"}, ${Js(f==null?void 0:f.valueType,t)??"any"}>`}const l=C6(e);if(l)return l.map(f=>`"${f}"`).join(" | ");if(s==="literal"){const f=(d=Pa(e))==null?void 0:d.values;if(Array.isArray(f)&&f.length===1){const h=f[0];return typeof h=="string"?`"${h}"`:String(h)}}const u=E6(e);return u?`{${Object.entries(u).map(([f,h])=>{const g=oC(h)?"?":"",m=Js(h,t);return m?`${f}${g}: ${m}`:`${f}${g}`}).join(", ")}}`:"any"}function T6(e,t){return Object.entries(e).map(([n,a])=>({name:n,isOptional:oC(a),isArray:lC(a),typeAnnotation:Js(a,t)}))}function _6(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[a,s]of Object.entries(e))n[a]={signature:_6(a,T6(s.props.shape,t)),description:s.description};return n}function R6(e){const t={},n=Qj();for(const a of e.components)n.add(a.props,{id:a.name}),t[a.name]=a;if(e.root&&!t[e.root]){const a=Object.keys(t).join(", ");throw new Error(`[createLibrary] Root component "${e.root}" was not found in components. Available components: ${a}`)}return{components:t,componentGroups:e.componentGroups,root:e.root,prompt(a){return x6({root:e.root,components:dw(t,n),componentGroups:e.componentGroups,...a})},toSpec(){return{root:e.root,components:dw(t,n),componentGroups:e.componentGroups}},toJSONSchema(){const a=Pt(Object.fromEntries(Object.entries(t).map(([s,l])=>[s,l.props])));return JI(a,{metadata:n})}}}function za(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return t.type==="element"&&typeof t.typeName=="string"&&typeof t.props=="object"&&t.props!==null&&typeof t.partial=="boolean"}let Lu=(function(e){return e.ContinueConversation="continue_conversation",e.OpenUrl="open_url",e})({});function O6(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 L6=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function io(e){return!e||typeof e!="object"||Array.isArray(e)?!1:L6.has(e.k)}function M6(e,t){const n=a=>{switch(t(a),a.k){case"Comp":a.args.forEach(n),Object.values(a.mappedProps??{}).forEach(n);break;case"Arr":a.els.forEach(n);break;case"Obj":a.entries.forEach(([,s])=>n(s));break;case"BinOp":n(a.left),n(a.right);break;case"UnaryOp":n(a.operand);break;case"Ternary":n(a.cond),n(a.then),n(a.else);break;case"Member":n(a.obj);break;case"Index":n(a.obj),n(a.index);break;case"Assign":n(a.value);break}};n(e)}let ie=(function(e){return e[e.Newline=0]="Newline",e[e.LParen=1]="LParen",e[e.RParen=2]="RParen",e[e.LBrack=3]="LBrack",e[e.RBrack=4]="RBrack",e[e.LBrace=5]="LBrace",e[e.RBrace=6]="RBrace",e[e.Comma=7]="Comma",e[e.Colon=8]="Colon",e[e.Equals=9]="Equals",e[e.True=10]="True",e[e.False=11]="False",e[e.Null=12]="Null",e[e.EOF=13]="EOF",e[e.Str=14]="Str",e[e.Num=15]="Num",e[e.Ident=16]="Ident",e[e.Type=17]="Type",e[e.StateVar=18]="StateVar",e[e.Dot=19]="Dot",e[e.Plus=20]="Plus",e[e.Minus=21]="Minus",e[e.Star=22]="Star",e[e.Slash=23]="Slash",e[e.Percent=24]="Percent",e[e.EqEq=25]="EqEq",e[e.NotEq=26]="NotEq",e[e.Greater=27]="Greater",e[e.Less=28]="Less",e[e.GreaterEq=29]="GreaterEq",e[e.LessEq=30]="LessEq",e[e.And=31]="And",e[e.Or=32]="Or",e[e.Not=33]="Not",e[e.Question=34]="Question",e[e.BuiltinCall=35]="BuiltinCall",e})({});const D6=1,pw=2,fw=3,Fh=4,xl=5,Hh=6,Mu=7,hw=8,z6=9;function mw(e){let t=0;const n=()=>e[t]??{t:ie.EOF},a=()=>{const y=n();return t++,y},s=y=>{n().t===y&&t++};function l(y){switch(y.t){case ie.Question:return D6;case ie.Or:return pw;case ie.And:return fw;case ie.EqEq:case ie.NotEq:return Fh;case ie.Greater:case ie.Less:case ie.GreaterEq:case ie.LessEq:return xl;case ie.Plus:case ie.Minus:return Hh;case ie.Star:case ie.Slash:case ie.Percent:return Mu;case ie.Dot:case ie.LBrack:return z6;default:return 0}}function u(y=0){let b=d();for(;l(n())>y;)b=f(b);return b}function d(){var b,k;const y=n();if(y.t===ie.Str)return a(),{k:"Str",v:y.v};if(y.t===ie.Num)return a(),{k:"Num",v:y.v};if(y.t===ie.True)return a(),{k:"Bool",v:!0};if(y.t===ie.False)return a(),{k:"Bool",v:!1};if(y.t===ie.Null)return a(),{k:"Null"};if(y.t===ie.LBrack)return g();if(y.t===ie.LBrace)return m();if(y.t===ie.StateVar){const j=y.v;return a(),n().t===ie.Equals?(a(),{k:"Assign",target:j,value:u(0)}):{k:"StateRef",n:j}}if(y.t===ie.Type){const j=y.v;return((b=e[t+1])==null?void 0:b.t)===ie.LParen&&(!Hl(j)||j==="Action")?h():(a(),{k:"Ref",n:j})}if(y.t===ie.BuiltinCall)return((k=e[t+1])==null?void 0:k.t)===ie.LParen?h():(a(),{k:"Ref",n:y.v});if(y.t===ie.Ident)return a(),{k:"Ref",n:y.v};if(y.t===ie.Not)return a(),{k:"UnaryOp",op:"!",operand:u(hw)};if(y.t===ie.Minus)return a(),{k:"UnaryOp",op:"-",operand:u(hw)};if(y.t===ie.LParen){a();const j=u(0);return s(ie.RParen),j}return a(),{k:"Null"}}function f(y){const b=n();if(b.t===ie.Plus)return a(),{k:"BinOp",op:"+",left:y,right:u(Hh)};if(b.t===ie.Minus)return a(),{k:"BinOp",op:"-",left:y,right:u(Hh)};if(b.t===ie.Star)return a(),{k:"BinOp",op:"*",left:y,right:u(Mu)};if(b.t===ie.Slash)return a(),{k:"BinOp",op:"/",left:y,right:u(Mu)};if(b.t===ie.Percent)return a(),{k:"BinOp",op:"%",left:y,right:u(Mu)};if(b.t===ie.EqEq)return a(),{k:"BinOp",op:"==",left:y,right:u(Fh)};if(b.t===ie.NotEq)return a(),{k:"BinOp",op:"!=",left:y,right:u(Fh)};if(b.t===ie.Greater)return a(),{k:"BinOp",op:">",left:y,right:u(xl)};if(b.t===ie.Less)return a(),{k:"BinOp",op:"<",left:y,right:u(xl)};if(b.t===ie.GreaterEq)return a(),{k:"BinOp",op:">=",left:y,right:u(xl)};if(b.t===ie.LessEq)return a(),{k:"BinOp",op:"<=",left:y,right:u(xl)};if(b.t===ie.And)return a(),{k:"BinOp",op:"&&",left:y,right:u(fw)};if(b.t===ie.Or)return a(),{k:"BinOp",op:"||",left:y,right:u(pw)};if(b.t===ie.Question){a();const k=u(0);return s(ie.Colon),{k:"Ternary",cond:y,then:k,else:u(0)}}if(b.t===ie.Dot){a();const k=n();return{k:"Member",obj:y,field:k.t===ie.Ident||k.t===ie.Type||k.t===ie.Str||k.t===ie.Num?(a(),String(k.v)):k.t===ie.StateVar?(a(),k.v.replace(/^\$/,"")):(a(),"?")}}if(b.t===ie.LBrack){a();const k=u(0);return s(ie.RBrack),{k:"Index",obj:y,index:k}}return y}function h(){const y=n().v;a(),s(ie.LParen);const b=[];for(;n().t!==ie.RParen&&n().t!==ie.EOF;)b.push(u(0)),n().t===ie.Comma&&a();return s(ie.RParen),{k:"Comp",name:y,args:b}}function g(){a();const y=[];for(;n().t!==ie.RBrack&&n().t!==ie.EOF;)y.push(u(0)),n().t===ie.Comma&&a();return s(ie.RBrack),{k:"Arr",els:y}}function m(){a();const y=[];for(;n().t!==ie.RBrace&&n().t!==ie.EOF;){const b=n(),k=b.t===ie.Ident||b.t===ie.Str||b.t===ie.Type||b.t===ie.Num?(a(),String(b.v)):b.t===ie.StateVar?(a(),b.v.replace(/^\$/,"")):(a(),"?");s(ie.Colon),y.push([k,u(0)]),n().t===ie.Comma&&a()}return s(ie.RBrace),{k:"Obj",entries:y}}return u(0)}function gw(e){const t=[];let n=0;const a=e.length;for(;n<a;){for(;n<a&&(e[n]===" "||e[n]===" "||e[n]==="\r");)n++;if(n>=a)break;const s=e[n];if(s===`
1612
- `){t.push({t:ie.Newline}),n++;continue}if(s==="("){t.push({t:ie.LParen}),n++;continue}if(s===")"){t.push({t:ie.RParen}),n++;continue}if(s==="["){t.push({t:ie.LBrack}),n++;continue}if(s==="]"){t.push({t:ie.RBrack}),n++;continue}if(s==="{"){t.push({t:ie.LBrace}),n++;continue}if(s==="}"){t.push({t:ie.RBrace}),n++;continue}if(s===","){t.push({t:ie.Comma}),n++;continue}if(s===":"){t.push({t:ie.Colon}),n++;continue}if(s==="="){n+1<a&&e[n+1]==="="?(t.push({t:ie.EqEq}),n+=2):(t.push({t:ie.Equals}),n++);continue}if(s==="!"){n+1<a&&e[n+1]==="="?(t.push({t:ie.NotEq}),n+=2):(t.push({t:ie.Not}),n++);continue}if(s===">"){n+1<a&&e[n+1]==="="?(t.push({t:ie.GreaterEq}),n+=2):(t.push({t:ie.Greater}),n++);continue}if(s==="<"){n+1<a&&e[n+1]==="="?(t.push({t:ie.LessEq}),n+=2):(t.push({t:ie.Less}),n++);continue}if(s==="&"){n+1<a&&e[n+1]==="&"?(t.push({t:ie.And}),n+=2):(t.push({t:ie.And}),n++);continue}if(s==="|"){n+1<a&&e[n+1]==="|"?(t.push({t:ie.Or}),n+=2):(t.push({t:ie.Or}),n++);continue}if(s==="."){t.push({t:ie.Dot}),n++;continue}if(s==="?"){t.push({t:ie.Question}),n++;continue}if(s==="+"){t.push({t:ie.Plus}),n++;continue}if(s==="*"){t.push({t:ie.Star}),n++;continue}if(s==="/"){t.push({t:ie.Slash}),n++;continue}if(s==="%"){t.push({t:ie.Percent}),n++;continue}if(s==='"'){const d=n;n++;let f=!1;for(;n<a;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,f=!0;break}else n++;const h=e.slice(d,n);try{const g=f?h:h+'"';t.push({t:ie.Str,v:JSON.parse(g)})}catch{const g=h.replace(/^"|"$/g,"");t.push({t:ie.Str,v:g})}continue}if(s==="'"){n++;let d="";for(;n<a;)if(e[n]==="\\"){if(n++,n<a){const f=e[n];f==="'"?d+="'":f==="\\"?d+="\\":f==="n"?d+=`
1613
- `:f==="t"?d+=" ":d+=f,n++}}else if(e[n]==="'"){n++;break}else d+=e[n],n++;t.push({t:ie.Str,v:d});continue}if(s==="-"){const d=t.length>0?t[t.length-1]:null;if(!(!(d!=null&&(d.t===ie.Num||d.t===ie.Str||d.t===ie.Ident||d.t===ie.Type||d.t===ie.RParen||d.t===ie.RBrack||d.t===ie.True||d.t===ie.False||d.t===ie.Null||d.t===ie.StateVar||d.t===ie.BuiltinCall))&&n+1<a&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:ie.Minus}),n++;continue}}const l=s>="0"&&s<="9",u=s==="-"&&n+1<a&&e[n+1]>="0"&&e[n+1]<="9";if(l||u){const d=n;for(e[n]==="-"&&n++;n<a&&e[n]>="0"&&e[n]<="9";)n++;if(n<a&&e[n]==="."&&n+1<a&&e[n+1]>="0"&&e[n+1]<="9")for(n++;n<a&&e[n]>="0"&&e[n]<="9";)n++;if(n<a&&(e[n]==="e"||e[n]==="E"))for(n++,n<a&&(e[n]==="+"||e[n]==="-")&&n++;n<a&&e[n]>="0"&&e[n]<="9";)n++;t.push({t:ie.Num,v:+e.slice(d,n)});continue}if(s==="$"&&n+1<a&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){const d=n;for(n++;n<a&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:ie.StateVar,v:e.slice(d,n)});continue}if(s>="a"&&s<="z"||s>="A"&&s<="Z"||s==="_"){const d=n;for(;n<a&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;const f=e.slice(d,n);if(f==="true"){t.push({t:ie.True});continue}if(f==="false"){t.push({t:ie.False});continue}if(f==="null"){t.push({t:ie.Null});continue}const h=s>="A"&&s<="Z"?ie.Type:ie.Ident;t.push({t:h,v:f});continue}if(s==="@"&&n+1<a&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){n++;const d=n;for(;n<a&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:ie.BuiltinCall,v:e.slice(d,n)});continue}n++}return t.push({t:ie.EOF}),t}function Ju(e){return e==null||typeof e!="object"?!1:io(e)?!0:Array.isArray(e)?e.some(Ju):za(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 a=t.syms.get(e);if((l=t.unreached)==null||l.delete(e),a.k==="Comp"&&yd(a.name))return{k:"RuntimeRef",n:e,refType:a.name===ki.Mutation?"mutation":"query"};t.visited.add(e);const s=t.currentStatementId;t.currentStatementId=e;try{const u=n==="value"?so(a,t):Bm(a,t);return n==="value"&&za(u)&&(u.statementId=e),u}finally{t.currentStatementId=s,t.visited.delete(e)}}function uC(e,t,n){if(!pv.has(e.name)||e.args.length<3)return null;const a=e.args[1],s=a.k==="Ref"?a.n:a.k==="Str"?a.v:null;if(!s)return null;const l=new Set(n);l.add(s);const u=e.args.map((d,f)=>f===1?d:Mn(d,t,l));return{...e,args:u}}function Mn(e,t,n){var a;switch(e.k){case"Ref":return n.has(e.n)?e: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)||yd(e.name))return{...e,args:l};const u=(a=t.cat)==null?void 0:a.get(e.name);if(u){const d={};for(let f=0;f<u.params.length&&f<l.length;f++)d[u.params[f].name]=l[f];return{...e,args:l,mappedProps:d}}return t.errors.push({code:"unknown-component",component:e.name,path:"",message:`Unknown component "${e.name}" — not found in catalog or builtins`,statementId:t.currentStatementId}),{...e,args:l}}case"Arr":return{...e,els:e.els.map(s=>Mn(s,t,n))};case"Obj":return{...e,entries:e.entries.map(([s,l])=>[s,Mn(l,t,n)])};case"BinOp":return{...e,left:Mn(e.left,t,n),right:Mn(e.right,t,n)};case"UnaryOp":return{...e,operand:Mn(e.operand,t,n)};case"Ternary":return{...e,cond:Mn(e.cond,t,n),then:Mn(e.then,t,n),else:Mn(e.else,t,n)};case"Member":return{...e,obj:Mn(e.obj,t,n)};case"Index":return{...e,obj:Mn(e.obj,t,n),index:Mn(e.index,t,n)};case"Assign":return{...e,value:Mn(e.value,t,n)};default:return e}}function Bm(e,t){return Mn(e,t,new Set)}function so(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 a=[];for(const s of e.els){if(s.k==="Ph")continue;const l=so(s,t);l===null&&(s.k==="Comp"||s.k==="Ref")||a.push(l)}return a}case"Obj":{const a={};for(const[s,l]of e.entries)a[s]=so(l,t);return a}case"Comp":{const{name:a,args:s}=e;if(Hl(a)){const f=uC(e,t,new Set);return f||{...e,args:s.map(h=>Bm(h,t))}}if(yd(a))return t.errors.push({code:"inline-reserved",component:a,path:"",message:`${a}() must be declared as a top-level statement, not used inline as a value`,statementId:t.currentStatementId}),null;const l=(n=t.cat)==null?void 0:n.get(a),u={};if(l){for(let h=0;h<l.params.length&&h<s.length;h++)u[l.params[h].name]=so(s[h],t);if(s.length>l.params.length){const h=s.length-l.params.length;t.errors.push({code:"excess-args",component:a,path:"",message:`${a} takes ${l.params.length} arg(s), got ${s.length} (${h} excess dropped)`,statementId:t.currentStatementId})}const f=l.params.filter(h=>h.required&&(!(h.name in u)||u[h.name]===null));if(f.length){const h=f.filter(g=>g.defaultValue!==void 0?(u[g.name]=g.defaultValue,!1):!0);if(h.length){for(const g of h){const m=g.name in u;t.errors.push({code:m?"null-required":"missing-required",component:a,path:`/${g.name}`,message:m?`required field "${g.name}" cannot be null`:`missing required field "${g.name}"`,statementId:t.currentStatementId})}return null}}}else if(!Hl(a)&&!yd(a))return t.errors.push({code:"unknown-component",component:a,path:"",message:`Unknown component "${a}" — not found in catalog or builtins`,statementId:t.currentStatementId}),null;const d=Object.values(u).some(f=>Ju(f));return{type:"element",typeName:a,props:u,partial:t.partial,hasDynamicProps:d}}default:return O6(e)?Bm(e,t):e}}function $6(e){const t=[];let n=!1,a=!1;for(let l=0;l<e.length;l++){const u=e[l];if(a){a=!1;continue}if(u==="\\"&&n){a=!0;continue}if(n){u===n&&(n=!1);continue}if(u==='"'||u==="'"){n=u;continue}u==="("||u==="["||u==="{"?t.push(u):(u===")"&&t[t.length-1]==="("||u==="]"&&t[t.length-1]==="["||u==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(n||t.length>0))return{text:e,wasIncomplete:!1};let s=e;n&&(a&&(s+="\\"),s+=n);for(let l=t.length-1;l>=0;l--)s+=t[l]==="("?")":t[l]==="["?"]":"}";return{text:s,wasIncomplete:!0}}function 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 a=e[n];if(a.t!==ie.Ident&&a.t!==ie.Type&&a.t!==ie.StateVar){for(;n<e.length&&e[n].t!==ie.Newline&&e[n].t!==ie.EOF;)n++;continue}const s=a.v,l=a.t;if(n++,n>=e.length||e[n].t!==ie.Equals){for(;n<e.length&&e[n].t!==ie.Newline&&e[n].t!==ie.EOF;)n++;continue}n++;const u=[];let d=0,f=0;for(;n<e.length&&e[n].t!==ie.EOF;){const h=e[n].t;if(h===ie.Newline&&d<=0&&f<=0){let g=n+1;for(;g<e.length&&e[g].t===ie.Newline;)g++;const m=g<e.length?e[g].t:ie.EOF;if(m===ie.Question||m===ie.Colon&&f>0){n++;continue}break}if(h===ie.Newline){n++;continue}h===ie.LParen||h===ie.LBrack||h===ie.LBrace?d++:(h===ie.RParen||h===ie.RBrack||h===ie.RBrace)&&d>0?d--:h===ie.Question&&d===0?f++:h===ie.Colon&&d===0&&f>0&&f--,u.push(e[n++])}u.length&&t.push({id:s,idTokenType:l,tokens:u})}return t}function ed(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function dC(e){if(!io(e))return[];const t=new Set;return M6(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 I6(e,t){const n={},a=[],s=[];for(const l of e)switch(l.kind){case"state":n[l.id]=so(l.init,t);break;case"query":a.push({statementId:l.id,toolAST:l.call.args[0]??null,argsAST:l.call.args[1]??null,defaultsAST:l.call.args[2]??null,refreshAST:l.call.args[3]??null,deps:l.deps,complete:!0});break;case"mutation":s.push({statementId:l.id,toolAST:l.call.args[0]??null,argsAST:l.call.args[1]??null});break}for(const l of e){const u=l.kind==="state"?[l.init]:l.kind==="value"?[l.expr]:l.kind==="query"||l.kind==="mutation"?l.call.args:[];for(const d of u)for(const f of dC(d))f in n||(n[f]=null)}return{stateDeclarations:n,queryStatements:a,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 P6(e,t,n,a){var l;if(e.has(bw))return bw;if(a&&e.has(a))return a;const s=a?t.find(u=>xw(u)&&u.expr.name===a):void 0;return s?s.id:((l=t.find(xw))==null?void 0:l.id)??n}function Du(e,t,n,a,s,l,u){const d=P6(e,t,n,u);if(!e.has(d))return ed(a);const f=new Map;for(const[A,E]of e)f.set(A,E.kind==="state"?E.init:E.expr);const h=[],g=[],m=new Set;for(const[A,E]of e)A!==d&&(E.kind==="state"||E.kind==="query"||E.kind==="mutation"||m.add(A));const y={syms:f,cat:l,errors:g,unres:h,visited:new Set,partial:a,currentStatementId:d,unreached:m},b=so(f.get(d),y),k=za(b)?b:null;k&&(k.statementId=d);const{stateDeclarations:j,queryStatements:N,mutationStatements:S}=I6(t,y);return{root:k,meta:{incomplete:a,unresolved:h,orphaned:[...m],statementCount:s,errors:g},stateDeclarations:j,queryStatements:N,mutationStatements:S}}function U6(e){const t=[];let n=0;for(;n<e.length;){const a=e.indexOf("```",n);if(a===-1)break;let s=a+3;for(;s<e.length&&e[s]!==`
1614
- `;)s++;if(s>=e.length){t.push(e.slice(a+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}s++;let l=!1,u=-1,d=s;for(;d<e.length;){const f=e[d];if(l){if(f==="\\"&&d+1<e.length){d+=2;continue}f==='"'&&(l=!1),d++;continue}if(f==='"'){l=!0,d++;continue}if(f==="`"&&d+1<e.length&&e[d+1]==="`"&&d+2<e.length&&e[d+2]==="`"){u=d;break}d++}u!==-1?(t.push(e.slice(s,u)),n=u+3):(t.push(e.slice(s)),n=e.length)}if(t.length>0)return t.join(`
1615
- `);if(e.startsWith("```")){let a=3;for(;a<e.length&&e[a]!==`
1616
- `;)a++;const s=a<e.length?a+1:3,l=e.slice(s),u=l.lastIndexOf("```");return u!==-1?l.slice(0,u):l}return e}function ww(e){return e.split(`
1617
- `).map(t=>{let n=!1;for(let a=0;a<t.length;a++){const s=t[a];if(n){if(s==="\\"&&a+1<t.length){a++;continue}s===n&&(n=!1);continue}if(s==='"'||s==="'"){n=s;continue}if(s==="/"&&t[a+1]==="/"||s==="#")return t.substring(0,a).trimEnd()}return t}).join(`
1618
- `)}function B6(e,t){let n="",a=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=a;for(let N=a;N<n.length;N++){const S=n[N];if(k){k=!1;continue}if(S==="\\"&&b){k=!0;continue}if(b){S===b&&(b=!1);continue}if(S==='"'||S==="'"){b=S;continue}if(S==="("||S==="["||S==="{")m++;else if(S===")"||S==="]"||S==="}")m=Math.max(0,m-1);else if(S==="?"&&m===0)y++;else if(S===":"&&m===0&&y>0)y--;else if(S===`
1619
- `&&m<=0&&y<=0){let A=N+1;for(;A<n.length&&(n[A]===" "||n[A]===" "||n[A]==="\r"||n[A]===`
1620
- `);)A++;if(A<n.length&&(n[A]==="?"||n[A]===":"&&y>0))continue;const E=n.slice(j,N).trim();E&&d(E),j=N+1,a=N+1}}return j}function h(){const m=f(),y=n.slice(m).trim();if(!y)return l===0?ed():Du(s,[...s.values()],u,!1,l,e,t);const b=ww(U6(y)).trim();if(!b)return l===0?ed():Du(s,[...s.values()],u,!1,l,e,t);const{text:k,wasIncomplete:j}=$6(b),N=vw(gw(k));if(!N.length)return l===0?ed(j):Du(s,[...s.values()],u,j,l,e,t);const S=new Map(s);for(const A of N){if(s.has(A.id))continue;const E=yw(A,mw(A.tokens));S.set(A.id,E)}return Du(S,[...S.values()],u||N[0].id,j,l+N.length,e,t)}function g(){n="",a=0,s.clear(),l=0,u=""}return{push(m){return n+=m,h()},set(m){(m.length<n.length||!m.startsWith(n))&&g();const y=m.slice(n.length);return y&&(n+=y),h()},getResult:h}}function F6(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function H6(e){const t=new Map,n=e.$defs??{};for(const[a,s]of Object.entries(n)){const l=s.properties??{},u=s.required??[],d=Object.keys(l).map(f=>({name:f,required:u.includes(f),defaultValue:F6(l[f])}));t.set(a,{params:d})}return t}function q6(e,t){return B6(H6(e),t)}function G6(e,t){if(!(t!=null&&t.properties))return;const n=new Set(t.required??[]);return`Signature: ${e}(${Object.keys(t.properties).map(a=>n.has(a)?`${a}*`:a).join(", ")}) — * marks required`}function V6(e,t,n){return e.map(a=>{var l;const s={source:"parser",code:a.code,message:a.message,component:a.component,path:a.path||void 0,statementId:a.statementId};return a.code==="unknown-component"&&n.length?s.hint=`Available components: ${n.join(", ")}`:a.code==="missing-required"||a.code==="null-required"?s.hint=G6(a.component,(l=t.$defs)==null?void 0:l[a.component]):a.code==="inline-reserved"&&(s.hint=`Declare as a top-level statement: myVar = ${a.component}(...)`),s})}function W6(e){return typeof e=="object"&&e!==null&&e.__reactive==="assign"}function vt(e,t,n){var a,s,l;switch(e.k){case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"StateRef":return((a=t.extraScope)==null?void 0:a[e.n])??t.getState(e.n);case"Ref":case"RuntimeRef":return t.resolveRef(e.n);case"Arr":return e.els.map(u=>vt(u,t));case"Obj":return Object.fromEntries(e.entries.map(([u,d])=>[u,vt(d,t)]));case"Comp":{if(pv.has(e.name))return K6(e.name,e.args,t,n);const u=dv[e.name];if(u){const d=e.args.map(f=>vt(f,t));return u.fn(...d)}if(aC.has(e.name))return Z6(e.name,e.args,t);if(e.mappedProps){const d=n==null?void 0:n.library.components[e.name],f={};for(const[g,m]of Object.entries(e.mappedProps)){const y=(l=(s=d==null?void 0:d.props)==null?void 0:s.shape)==null?void 0:l[g];m.k==="StateRef"&&y&&Ll(y)?f[g]={__reactive:"assign",target:m.n,expr:{k:"StateRef",n:"$value"}}:m.k==="StateRef"?f[g]=n?t.getState(m.n):m:f[g]=vt(m,t,n)}const h={type:"element",typeName:e.name,props:f,partial:!1,hasDynamicProps:!0};if(n)for(const[g,m]of Object.entries(f))za(m)?f[g]=xd(m,t,n):Array.isArray(m)&&(f[g]=m.map(y=>za(y)?xd(y,t,n):y));return h}return console.warn(`[openui] Unexpected unmapped Comp node: ${e.name}`),null}case"BinOp":{if(e.op==="&&"){const f=vt(e.left,t);return f&&vt(e.right,t)}if(e.op==="||"){const f=vt(e.left,t);return f||vt(e.right,t)}const u=vt(e.left,t),d=vt(e.right,t);switch(e.op){case"+":return typeof u=="string"||typeof d=="string"?String(u??"")+String(d??""):Ze(u)+Ze(d);case"-":return Ze(u)-Ze(d);case"*":return Ze(u)*Ze(d);case"/":return Ze(d)===0?0:Ze(u)/Ze(d);case"%":return Ze(d)===0?0:Ze(u)%Ze(d);case"==":return u==d;case"!=":return u!=d;case">":return Ze(u)>Ze(d);case"<":return Ze(u)<Ze(d);case">=":return Ze(u)>=Ze(d);case"<=":return Ze(u)<=Ze(d);default:return null}}case"UnaryOp":return e.op==="!"?!vt(e.operand,t):e.op==="-"?-Ze(vt(e.operand,t)):null;case"Ternary":return vt(e.cond,t)?vt(e.then,t):vt(e.else,t);case"Member":{const u=vt(e.obj,t);return u==null?null:Array.isArray(u)?e.field==="length"?u.length:u.map(d=>(d==null?void 0:d[e.field])??null):u[e.field]}case"Index":{const u=vt(e.obj,t),d=vt(e.index,t);return u==null||d==null?null:Array.isArray(u)?u[Ze(d)]:u[String(d)]}case"Assign":return{__reactive:"assign",target:e.target,expr:e.value}}}function xd(e,t,n){var l,u;if(e.hasDynamicProps===!1)return e;const a=n.library.components[e.typeName],s={};for(const[d,f]of Object.entries(e.props)){const h=(u=(l=a==null?void 0:a.props)==null?void 0:l.shape)==null?void 0:u[d];s[d]=pC(f,t,n,h)}return{...e,props:s}}function pC(e,t,n,a){return fC(e,t,n,a,{recurseElement:s=>xd(s,t,n),recurse:(s,l)=>pC(s,t,n,l)})}function Fm(e){return e==null?{k:"Null"}:typeof e=="string"?{k:"Str",v:e}:typeof e=="number"?{k:"Num",v:e}:typeof e=="boolean"?{k:"Bool",v:e}:Array.isArray(e)?{k:"Arr",els:e.map(Fm)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,Fm(n)])}:{k:"Null"}}function Z6(e,t,n){switch(e){case"Action":{const a=t.length>0?vt(t[0],n):[];return{steps:(Array.isArray(a)?a:[]).filter(s=>s!=null&&typeof s=="object"&&"type"in s)}}case"Run":{if(t.length===0)return null;const a=t[0];return a.k==="RuntimeRef"?{type:Ir.Run,statementId:a.n,refType:a.refType}:null}case"ToAssistant":{const a=t.length>0?String(vt(t[0],n)??""):"",s=t.length>1?String(vt(t[1],n)??""):void 0;return{type:Ir.ToAssistant,message:a,context:s}}case"OpenUrl":{const a=t.length>0?String(vt(t[0],n)??""):"";return{type:Ir.OpenUrl,url:a}}case"Set":{if(t.length<2)return null;const a=t[0];return a.k!=="StateRef"?null:{type:Ir.Set,target:a.n,valueAST:t[1]}}case"Reset":{const a=t.filter(s=>s.k==="StateRef").map(s=>s.n);return a.length===0?null:{type:Ir.Reset,targets:a}}default:return null}}function Ln(e,t,n){switch(e.k){case"Ref":return e.n===t?Fm(n):e;case"Member":if(io(e.obj)){const a=Ln(e.obj,t,n);if(a.k==="Obj"){const s=a.entries.find(([l])=>l===e.field);if(s)return s[1]}return{...e,obj:a}}return e;case"Index":return{...e,obj:io(e.obj)?Ln(e.obj,t,n):e.obj,index:io(e.index)?Ln(e.index,t,n):e.index};case"BinOp":return{...e,left:Ln(e.left,t,n),right:Ln(e.right,t,n)};case"UnaryOp":return{...e,operand:Ln(e.operand,t,n)};case"Ternary":return{...e,cond:Ln(e.cond,t,n),then:Ln(e.then,t,n),else:Ln(e.else,t,n)};case"Arr":return{...e,els:e.els.map(a=>Ln(a,t,n))};case"Obj":return{...e,entries:e.entries.map(([a,s])=>[a,Ln(s,t,n)])};case"Comp":{const a={...e,args:e.args.map(s=>Ln(s,t,n))};if(e.mappedProps){const s={};for(const[l,u]of Object.entries(e.mappedProps))s[l]=Ln(u,t,n);a.mappedProps=s}return a}case"Assign":return{...e,value:Ln(e.value,t,n)};default:return e}}function K6(e,t,n,a){if(e==="Each"){if(t.length<3)return[];const s=vt(t[0],n);if(!Array.isArray(s))return[];const l=t[1].k==="Ref"?t[1].n:t[1].k==="Str"?t[1].v:null;if(!l)return[];const u=t[2];return s.map((d,f)=>{const h=Ln(u,l,d),g={...n,resolveRef:y=>y===l?d:n.resolveRef(y)},m=vt(h,g,a);return a&&za(m)?xd(m,g,a):m})}return null}function fC(e,t,n,a,s){if(e==null||typeof e!="object")return e;if(io(e)){if(e.k==="StateRef"&&a&&Ll(a))return{__reactive:"assign",target:e.n,expr:{k:"StateRef",n:"$value"}};const d=vt(e,t,n);return za(d)?s.recurseElement(d):Array.isArray(d)?d.map(f=>za(f)?s.recurseElement(f):f):W6(d)&&!(a&&Ll(a))?t.getState(d.target)??null:d}if(typeof e=="string"&&a&&Ll(a))return e;if(Array.isArray(e))return e.map(d=>s.recurse(d,a));if(za(e))return s.recurseElement(e);const l=e;if("steps"in l&&Array.isArray(l.steps)||"type"in l&&"valueAST"in l)return e;let u=!1;for(const d of Object.values(l))if(typeof d=="object"&&d!==null){u=!0;break}if(u){const d={};for(const[f,h]of Object.entries(l))d[f]=s.recurse(h,a);return d}return e}function hC(e,t){var l,u,d;if(e.hasDynamicProps===!1)return e;const n={library:t.library},a=t.library.components[e.typeName],s={};for(const[f,h]of Object.entries(e.props)){const g=(u=(l=a==null?void 0:a.props)==null?void 0:l.shape)==null?void 0:u[f];try{s[f]=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,a){return fC(e,t.ctx,n,a,{recurseElement:s=>hC(s,t),recurse:(s,l)=>mC(s,t,n,l)})}var Hm=class extends Error{constructor(t){super(`MCP tool error: ${t||"Unknown error"}`);jn(this,"toolErrorText");this.name="McpToolError",this.toolErrorText=t}};function Y6(e){var n,a;if(e.isError){const s=(n=e.content)==null?void 0:n.filter(l=>l.type==="text").map(l=>l.text).join(`
1621
- `);throw new Hm(s||"Unknown error")}if(e.structuredContent!=null)return e.structuredContent;const t=(a=e.content)==null?void 0:a.filter(s=>s.type==="text").map(s=>s.text??"");if(t!=null&&t.length){const s=t.join("");try{return JSON.parse(s)}catch{return s}}return null}var qm=class extends Error{constructor(t,n=[]){super(`[openui] No handler for tool "${t}". Available: ${n.join(", ")||"(none)"}`);jn(this,"toolName");jn(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 a={};for(const s of Object.keys(n).sort())a[s]=n[s];return a}if(n===void 0)return"__undefined__";if(typeof n=="number"){if(Number.isNaN(n))return"__NaN__";if(n===1/0)return"__Inf__";if(n===-1/0)return"__-Inf__"}return n})}function Q6(e,t,n){const a=n!=null?"::"+kw(n):"";return e+"::"+kw(t)+a}function X6(e){const t=new Map,n=new Map,a=new Map,s=new Set;let l={__openui_loading:[],__openui_refetching:[],__openui_errors:[]},u=JSON.stringify(l),d=!1,f=0;function h(){const D={__openui_loading:[],__openui_refetching:[],__openui_errors:[]};for(const[R,$]of t){const F=a.get($.cacheKey);if(F&&F.data!==void 0)D[R]=F.data;else if($.prevCacheKey){const K=a.get($.prevCacheKey);K&&K.data!==void 0?D[R]=K.data:D[R]=$.defaults}else D[R]=$.defaults;$.loading&&(D.__openui_loading.push(R),$.everFetched&&D.__openui_refetching.push(R)),$.error&&D.__openui_errors.push($.error)}for(const[R,$]of n)D[R]=$.result,$.error&&D.__openui_errors.push($.error);try{const R=JSON.stringify(D);if(R===u)return!1;l=D,u=R}catch{l=D,u=""}return!0}function g(){for(const D of[...s])D()}async function m(D,R){if(!e)return;const $=t.get(R);if(!$)return;const F=D,K=$.toolName,I=$.args;let H=a.get(F);H?H.inFlight=!0:(H={data:void 0,inFlight:!0},a.set(F,H)),$.loading=!0,h(),g();try{const B=await e.callTool(K,I??{});if(d)return;const W=t.get(R);if(!W||W.cacheKey!==F){H.inFlight=!1;return}if(H.data=B??null,W.everFetched=!0,W.error=void 0,W.prevCacheKey&&W.prevCacheKey!==F){const Q=W.prevCacheKey;W.prevCacheKey=void 0,y(Q)}}catch(B){const W=t.get(R);W&&W.cacheKey===F&&(B instanceof qm?W.error={source:"query",code:"tool-not-found",message:`Query tool "${K}" not found`,statementId:R,component:"Query",toolName:K,hint:B.availableTools.length?`Available tools: ${B.availableTools.join(", ")}`:void 0}:B instanceof Hm?W.error={source:"query",code:"mcp-error",message:`Query "${K}" returned an error: ${B.toolErrorText}`,statementId:R,component:"Query",toolName:K}:W.error={source:"query",code:"tool-error",message:`Query "${K}" failed: ${B instanceof Error?B.message:String(B)}`,statementId:R,component:"Query",toolName:K}),console.error(`Query "${K}" failed:`,B)}finally{H.inFlight=!1;const B=t.get(R);B&&B.cacheKey===F?(B.loading=!1,h()&&g(),B.needsRefetch&&(B.needsRefetch=!1,m(B.cacheKey,R))):h()&&g()}}function y(D){for(const R of t.values())if(R.cacheKey===D||R.prevCacheKey===D)return;a.delete(D)}function b(D){if(d)return;const R=new Set(D.map($=>$.statementId));for(const[$,F]of t)R.has($)||(F.timer&&clearInterval(F.timer),t.delete($),y(F.cacheKey),F.prevCacheKey&&y(F.prevCacheKey));for(const $ of D){if(!$.complete)continue;const F=Q6($.toolName,$.args,$.deps),K=t.get($.statementId);K?(K.cacheKey!==F&&(K.prevCacheKey=K.cacheKey),K.toolName=$.toolName,K.args=$.args,K.defaults=$.defaults,K.cacheKey=F):t.set($.statementId,{toolName:$.toolName,args:$.args,defaults:$.defaults,cacheKey:F,loading:!1,everFetched:!1,refreshInterval:0,needsRefetch:!1});const I=t.get($.statementId),H=a.get(F),B=H&&H.data!==void 0&&!H.inFlight;e&&!B&&!(H!=null&&H.inFlight)&&m(F,$.statementId);const W=$.refreshInterval??0;W!==I.refreshInterval&&(I.timer&&(clearInterval(I.timer),I.timer=void 0),W>0&&(I.timer=setInterval(()=>{var Q;d||!e||(Q=a.get(I.cacheKey))!=null&&Q.inFlight||m(I.cacheKey,$.statementId)},W*1e3)),I.refreshInterval=W)}h()&&g()}function k(D){const R=t.get(D);if(!R)return null;const $=a.get(R.cacheKey);if($&&$.data!==void 0)return $.data;if(R.prevCacheKey){const F=a.get(R.prevCacheKey);if(F&&F.data!==void 0)return F.data}return R.defaults}function j(D){var R;return((R=t.get(D))==null?void 0:R.loading)??!1}function N(){for(const D of t.values())if(D.loading)return!0;return!1}function S(D){var $;if(d||!e)return;const R=D!=null&&D.length?D.filter(F=>t.has(F)):[...t.keys()];for(const F of R){const K=t.get(F);K&&(($=a.get(K.cacheKey))!=null&&$.inFlight?K.needsRefetch=!0:m(K.cacheKey,F))}}function A(D){const R=new Set(D.map($=>$.statementId));for(const $ of n.keys())R.has($)||n.delete($);for(const $ of D){const F=n.get($.statementId);F?F.toolName!==$.toolName&&(F.toolName=$.toolName,F.result={status:"idle",data:null,error:null},F.error=void 0):n.set($.statementId,{toolName:$.toolName,result:{status:"idle"}})}h()&&g()}async function E(D,R,$){if(d||!e)return!1;const F=n.get(D);if(!F||F.result.status==="loading")return!1;const K=f;F.result={status:"loading"},h(),g();let I=!1;try{const H=await e.callTool(F.toolName,R);if(d||K!==f)return!1;F.result={status:"success",data:H},F.error=void 0,I=!0}catch(H){if(d||K!==f)return!1;const B=H instanceof Error?H.message:String(H);F.result={status:"error",error:B},H instanceof qm?F.error={source:"mutation",code:"tool-not-found",message:`Mutation tool "${F.toolName}" not found`,statementId:D,component:"Mutation",toolName:F.toolName,hint:H.availableTools.length?`Available tools: ${H.availableTools.join(", ")}`:void 0}:H instanceof Hm?F.error={source:"mutation",code:"mcp-error",message:`Mutation "${F.toolName}" returned an error: ${H.toolErrorText}`,statementId:D,component:"Mutation",toolName:F.toolName}:F.error={source:"mutation",code:"tool-error",message:`Mutation "${F.toolName}" failed: ${B}`,statementId:D,component:"Mutation",toolName:F.toolName}}return h(),g(),I&&($!=null&&$.length)&&S($),I}function T(D){var R;return((R=n.get(D))==null?void 0:R.result)??null}function U(D){return s.add(D),()=>s.delete(D)}function _(){return l}function z(){d=!1}function q(){d=!0,f++,s.clear();for(const D of t.values())D.timer&&(clearInterval(D.timer),D.timer=void 0),D.loading=!1,D.needsRefetch=!1;n.clear()}return{evaluateQueries:b,getResult:k,isLoading:j,isAnyLoading:N,invalidate:S,registerMutations:A,fireMutation:E,getMutationResult:T,subscribe:U,getSnapshot:_,activate:z,dispose:q}}function J6(){const e=new Map,t=new Set;let n={};function a(){const m=[...t];for(const y of m)y()}function s(){n=Object.fromEntries(e)}function l(m){return e.get(m)}function u(m,y){const b=e.get(m);if(!Object.is(b,y)){if(y&&b&&typeof y=="object"&&typeof b=="object"&&!Array.isArray(y)&&!Array.isArray(b)){const k=Object.keys(y),j=Object.keys(b);if(k.length===j.length&&k.every(N=>Object.is(y[N],b[N])))return}e.set(m,y),s(),a()}}function d(m){return t.add(m),()=>{t.delete(m)}}function f(){return n}function h(m,y){for(const b of Object.keys(y))e.set(b,y[b]);for(const b of Object.keys(m))e.has(b)||e.set(b,m[b]);s(),a()}function g(){e.clear(),t.clear(),n={}}return{get:l,set:u,subscribe:d,getSnapshot:f,initialize:h,dispose:g}}function Rr(e){return S6(e)}function eP(e){return R6(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 tP(){return vC().renderNode}w.createContext(void 0);function qh(e){return e&&typeof e=="object"&&!Array.isArray(e)&&"value"in e?e.value:e}function nP({response:e,library:t,isStreaming:n,onAction:a,onStateUpdate:s,initialState:l,toolProvider:u,onError:d},f){const h=w.useMemo(()=>q6(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(W){return g.current={source:"parser",code:"parse-exception",message:`Parser crashed: ${W instanceof Error?W.message:String(W)}`,hint:"The response may contain syntax the parser cannot handle"},null}},[h,e]),y=w.useMemo(()=>J6(),[]),b=w.useMemo(()=>X6(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 W=`${JSON.stringify(m==null?void 0:m.stateDeclarations)}::${JSON.stringify(l)}`;if(k.current===W)return;k.current=W;const Q={};if(l)for(const[V,L]of Object.entries(l))V.startsWith("$")?Q[V]=L:y.set(V,L);y.initialize((m==null?void 0:m.stateDeclarations)??{},Q)},[m==null?void 0:m.stateDeclarations,y,l]);const j=w.useSyncExternalStore(y.subscribe,y.getSnapshot,y.getSnapshot),N=w.useSyncExternalStore(b.subscribe,b.getSnapshot,b.getSnapshot),S=w.useMemo(()=>({getState:W=>qh(y.get(W)),resolveRef:W=>{const Q=b.getMutationResult(W);return Q||b.getResult(W)}}),[y,b]);w.useEffect(()=>{if(n)return;const W=((m==null?void 0:m.queryStatements)??[]).map(Q=>{const V={};if(Q.deps)for(const L of Q.deps)V[L]=j[L];return{statementId:Q.statementId,toolName:Q.toolAST?vt(Q.toolAST,S):"",args:Q.argsAST?vt(Q.argsAST,S):null,defaults:Q.defaultsAST?vt(Q.defaultsAST,S):null,refreshInterval:Q.refreshAST?vt(Q.refreshAST,S):void 0,deps:Object.keys(V).length>0?V:void 0,complete:Q.complete}});b.evaluateQueries(W)},[n,m==null?void 0:m.queryStatements,S,b,j]),w.useEffect(()=>{if(n)return;const W=((m==null?void 0:m.mutationStatements)??[]).map(Q=>({statementId:Q.statementId,toolName:Q.toolAST?vt(Q.toolAST,S):""}));b.registerMutations(W)},[n,m==null?void 0:m.mutationStatements,S,b]);const A=w.useRef({onAction:a,onStateUpdate:s,onError:d});A.current={onAction:a,onStateUpdate:s,onError:d};const E=w.useRef(m);E.current=m;const T=w.useRef(null);w.useEffect(()=>(T.current=y.getSnapshot(),y.subscribe(()=>{var Q,V;const W=y.getSnapshot();W!==T.current&&(T.current=null,(V=(Q=A.current).onStateUpdate)==null||V.call(Q,W))})),[y]);const U=w.useCallback((W,Q)=>{if(!W)return qh(y.get(Q));const V=y.get(W);if(!(!V||typeof V!="object"||Array.isArray(V)))return qh(V[Q])},[y]),_=w.useCallback((W,Q,V,L,P=!0)=>{var O,ne;const G={value:L,componentType:Q};if(!W)y.set(V,G);else{const ue=y.get(W),le=ue&&typeof ue=="object"&&!Array.isArray(ue)?ue:{};y.set(W,{...le,[V]:G})}P&&((ne=(O=A.current).onStateUpdate)==null||ne.call(O,y.getSnapshot()))},[y]),z=w.useCallback(W=>{if(W){const Q=y.get(W);if(Q&&typeof Q=="object"&&!Array.isArray(Q))return{[W]:Q}}return y.getSnapshot()},[y]),q=w.useCallback(async(W,Q,V)=>{var O,ne,ue;const L=z(Q),{onAction:P}=A.current;if(V&&!("steps"in V)){const le=V.type||Lu.ContinueConversation,be={...V.params||{}};V.url&&(be.url=V.url),V.context&&(be.context=V.context),P==null||P({type:le,params:be,humanFriendlyMessage:W,formState:L,formName:Q});return}const G=V;if(G!=null&&G.steps){for(const le of G.steps)switch(le.type){case Ir.Run:if(le.refType==="mutation"){const be=(ne=(O=E.current)==null?void 0:O.mutationStatements)==null?void 0:ne.find(Ee=>Ee.statementId===le.statementId),_e=be!=null&&be.argsAST?vt(be.argsAST,S):{};if(!await b.fireMutation(le.statementId,_e))return}else b.invalidate([le.statementId]);break;case Ir.ToAssistant:P==null||P({type:Lu.ContinueConversation,params:le.context?{context:le.context}:{},humanFriendlyMessage:le.message,formState:L,formName:Q});break;case Ir.OpenUrl:P==null||P({type:Lu.OpenUrl,params:{url:le.url},humanFriendlyMessage:"",formState:L,formName:Q});break;case Ir.Set:{if(!le.valueAST){console.warn(`[openui] Set action for ${le.target} has no valueAST — skipping`);break}const be=vt(le.valueAST,S);y.set(le.target,be);break}case Ir.Reset:{const be=((ue=E.current)==null?void 0:ue.stateDeclarations)??{};for(const _e of le.targets)y.set(_e,be[_e]??null);break}}return}P==null||P({type:Lu.ContinueConversation,params:{},humanFriendlyMessage:W,formState:L,formName:Q})},[b,S,z,y]),D=w.useRef([]),R=w.useRef(n);R.current=n;const $=w.useCallback(W=>{R.current||D.current.push(W)},[]),F=w.useMemo(()=>({library:t,renderNode:f,triggerAction:q,isStreaming:n,getFieldValue:U,setFieldValue:_,store:y,evaluationContext:S,reportError:$}),[t,f,n,q,U,_,y,S,$]),K=w.useRef([]),I=w.useMemo(()=>{if(!(m!=null&&m.root))return m;const W=[],Q={ctx:S,library:t,store:y,errors:W};try{const V=hC(m.root,Q);return K.current=W,{...m,root:V}}catch(V){const L=V instanceof Error?V.message:String(V);return W.push({source:"runtime",code:"runtime-error",message:`Prop evaluation failed: ${L}`}),K.current=W,m}},[m,S,t,y,j,N]),H=N.__openui_loading.length>0,B=w.useRef("");return w.useEffect(()=>{var V,L,P,G;if(n){B.current!==""&&(B.current="",(L=(V=A.current).onError)==null||L.call(V,[]));return}const W=[];g.current&&W.push(g.current),e&&!(m!=null&&m.root)&&!g.current&&W.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=(P=m==null?void 0:m.meta)==null?void 0:P.errors)!=null&&G.length&&W.push(...V6(m.meta.errors,t.toJSONSchema(),Object.keys(t.components))),W.push(...K.current),W.push(...D.current),D.current=[],W.push(...N.__openui_errors??[]);const Q=JSON.stringify(W);if(Q!==B.current){if(B.current=Q,A.current.onError)A.current.onError(W);else if(W.length>0)for(const O of W)console.warn(`[openui] ${O.source}/${O.code}: ${O.message}`)}},[n,e,m,I,N,t]),{result:I,parseResult:m,contextValue:F,isQueryLoading:H}}var rP=class extends w.Component{constructor(t){super(t);jn(this,"lastValidChildren",null);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){this.state.hasError||(this.lastValidChildren=this.props.children)}componentDidUpdate(t){this.state.hasError||(this.lastValidChildren=this.props.children),this.state.hasError&&t.children!==this.props.children&&this.setState({hasError:!1})}componentDidCatch(t){var a,s;const n=this.props.componentName??"Unknown";(s=(a=this.props).onError)==null||s.call(a,{source:"runtime",code:"render-error",component:n,message:`Component ${n} render failed: ${t.message}`})}render(){return this.state.hasError?this.lastValidChildren:this.props.children}};function 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(),a=(s=t.components[e.typeName])==null?void 0:s.component;return a?o.jsx(rP,{componentName:e.typeName,onError:n,children:o.jsx(aP,{el:e,Comp:a})}):null}function aP({el:e,Comp:t}){const n=tP();return o.jsx(t,{props:e.props,renderNode:n})}let Sw=!1;function iP(){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 sP=()=>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 oP({response:e,library:t,isStreaming:n=!1,onAction:a,onStateUpdate:s,initialState:l,onParseResult:u,toolProvider:d,queryLoader:f,onError:h}){w.useInsertionEffect(()=>{iP()},[]);const g=w.useRef(u);g.current=u;const m=w.useRef(d);m.current=d;const y=w.useRef({async callTool(S,A){const E=m.current??null;if(E==null)throw new Error("[openui] toolProvider is null");if(typeof E.callTool=="function")return Y6(await E.callTool({name:S,arguments:A}));const T=E,U=T[S];if(!U)throw new qm(S,Object.keys(T));return U(A)}}),{result:b,parseResult:k,contextValue:j,isQueryLoading:N}=nP({response:e,library:t,isStreaming:n,onAction:a,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:[N&&(f??o.jsx(sP,{})),o.jsx("div",{style:{opacity:N?.7:1,transition:"opacity 0.2s ease"},children:o.jsx(bC,{node:b.root})})]})}):null}w.createContext(null);function lP(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 cP=({props:e,renderNode:t})=>{const n=e.children;return o.jsxs("div",{className:"v10-genui-root",children:[e.title?o.jsx("div",{className:"v10-genui-root-title",children:e.title}):null,Array.isArray(n)?n.map((a,s)=>o.jsx(Ve.Fragment,{children:t(a)},s)):t(n)]})},uP=({props:e})=>{var t;return o.jsxs("div",{className:"v10-genui-card v10-genui-entity-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("div",{className:"v10-genui-card-title",children:e.name}),e.typeLabel?o.jsx("div",{className:"v10-genui-card-type",children:e.typeLabel}):null]}),e.subtitle?o.jsx("div",{className:"v10-genui-card-subtitle",children:e.subtitle}):null,(t=e.chips)!=null&&t.length?o.jsx("div",{className:"v10-genui-chips",children:e.chips.map((n,a)=>o.jsxs("span",{className:`v10-genui-chip tone-${n.tone??"default"}`,children:[o.jsx("span",{className:"v10-genui-chip-label",children:n.label}),o.jsx("span",{className:"v10-genui-chip-value",children:n.value})]},a))}):null]})},dP=({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))}),pP=({props:e})=>o.jsxs("div",{className:"v10-genui-section",children:[e.heading?o.jsx("div",{className:"v10-genui-section-heading",children:e.heading}):null,o.jsx("div",{className:"v10-genui-triple-table",children:e.rows.map((t,n)=>o.jsxs("div",{className:"v10-genui-triple-row",children:[o.jsx("div",{className:"v10-genui-triple-predicate",children:hv(t.predicate)}),o.jsx("div",{className:"v10-genui-triple-object",children:wP(t.object)})]},n))})]}),fP=({props:e})=>o.jsxs("div",{className:"v10-genui-section",children:[e.heading?o.jsx("div",{className:"v10-genui-section-heading",children:e.heading}):null,o.jsx("div",{className:"v10-genui-type-groups",children:e.groups.map((t,n)=>o.jsxs("div",{className:"v10-genui-type-group",children:[o.jsxs("div",{className:"v10-genui-type-group-head",children:[t.icon?o.jsx("span",{className:"v10-genui-type-icon",children:t.icon}):null,o.jsx("span",{className:"v10-genui-type-label",children:t.typeLabel}),o.jsx("span",{className:"v10-genui-type-count",children:t.items.length})]}),o.jsx("div",{className:"v10-genui-type-items",children:t.items.map((a,s)=>o.jsxs("div",{className:"v10-genui-type-item",title:a.uri,children:[o.jsx("div",{className:"v10-genui-type-item-label",children:a.label}),a.sub?o.jsx("div",{className:"v10-genui-type-item-sub",children:a.sub}):null]},s))})]},n))})]}),hP=({props:e})=>o.jsxs("div",{className:"v10-genui-section",children:[o.jsxs("div",{className:"v10-genui-section-heading",children:[o.jsx("span",{children:e.heading}),e.predicate?o.jsxs("span",{className:"v10-genui-section-sub",children:["· ",hv(e.predicate)]}):null]}),o.jsx("div",{className:"v10-genui-crossref",children:e.items.map((t,n)=>o.jsxs("div",{className:"v10-genui-crossref-item",title:t.uri,children:[o.jsx("span",{className:"v10-genui-crossref-label",children:t.label}),t.sub?o.jsx("span",{className:"v10-genui-crossref-sub",children:t.sub}):null]},n))})]}),mP=({props:e})=>o.jsxs("div",{className:"v10-genui-card v10-genui-package-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("span",{className:"v10-genui-card-icon",style:{color:"#a855f7"},children:"📦"}),o.jsx("div",{className:"v10-genui-card-title",children:e.name}),e.folder?o.jsxs("div",{className:"v10-genui-card-type",children:["packages/",e.folder]}):null]}),e.description?o.jsx("div",{className:"v10-genui-card-subtitle",children:e.description}):null,o.jsxs("div",{className:"v10-genui-stats-grid",children:[typeof e.fileCount=="number"&&o.jsx(zu,{label:"Files",value:e.fileCount}),typeof e.classCount=="number"&&o.jsx(zu,{label:"Classes",value:e.classCount}),typeof e.functionCount=="number"&&o.jsx(zu,{label:"Functions",value:e.functionCount}),typeof e.interfaceCount=="number"&&o.jsx(zu,{label:"Interfaces",value:e.interfaceCount})]})]}),gP=({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:SP(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]})]}),vP=({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]}),yP=({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=lP(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]}),bP=({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]})]}),xP=({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,a)=>o.jsxs("div",{className:"v10-genui-vm-signer",children:[o.jsx("div",{className:"v10-genui-vm-signer-dot"}),o.jsxs("div",{className:"v10-genui-vm-signer-body",children:[o.jsx("div",{className:"v10-genui-vm-signer-label",children:n.label??kP(n.did)}),o.jsx("div",{className:"v10-genui-vm-signer-did",children:n.did})]}),typeof n.reputation=="number"?o.jsxs("div",{className:"v10-genui-vm-rep",children:["rep ",n.reputation]}):null]},a))]}):null,e.knowledgeAsset?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsx("div",{className:"v10-genui-vm-block-heading",children:"Knowledge asset"}),e.knowledgeAsset.ual?o.jsx(Wi,{label:"ual",value:e.knowledgeAsset.ual,mono:!0}):null,e.knowledgeAsset.contentHash?o.jsx(Wi,{label:"hash",value: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,a)=>o.jsxs("div",{className:"v10-genui-vm-timeline-row",children:[o.jsx("div",{className:"v10-genui-vm-timeline-dot"}),o.jsx("div",{className:"v10-genui-vm-timeline-label",children:n.label}),o.jsx("div",{className:"v10-genui-vm-timeline-at",children:n.at})]},a))]}):null]})]})},zu=({label:e,value:t})=>o.jsxs("div",{className:"v10-genui-stat",children:[o.jsx("div",{className:"v10-genui-stat-value",children:t}),o.jsx("div",{className:"v10-genui-stat-label",children:e})]}),$u=({heading:e,body:t})=>o.jsxs("div",{className:"v10-genui-decision-section",children:[o.jsx("div",{className:"v10-genui-decision-section-heading",children:e}),o.jsx("div",{className:"v10-genui-decision-section-body",children:t})]}),Wi=({label:e,value:t,mono:n})=>o.jsxs("div",{className:"v10-genui-prov-row",children:[o.jsx("span",{className:"v10-genui-prov-label",children:e}),o.jsx("span",{className:`v10-genui-prov-value${n?" mono":""}`,children:t})]});function hv(e){return e.replace(/^"|"$/g,"").replace(/^<|>$/g,"").replace("http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdf:").replace("http://www.w3.org/2000/01/rdf-schema#","rdfs:").replace("http://www.w3.org/2001/XMLSchema#","xsd:").replace("http://schema.org/","schema:").replace("http://dkg.io/ontology/code/","code:").replace("http://dkg.io/ontology/github/","gh:").replace("http://dkg.io/ontology/decisions/","dec:").replace("http://dkg.io/ontology/tasks/","task:").replace("http://dkg.io/ontology/profile/","prof:")}function wP(e){return hv(e).replace(/\^\^<?.*$/,"").replace(/^"(.+)"$/,"$1")}function jw(e){return e?e.length<=16?e:`${e.slice(0,8)}…${e.slice(-6)}`:""}function kP(e){return e?e.length>22?`${e.slice(0,12)}…${e.slice(-6)}`:e:""}function SP(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}const jP=Rr({name:"EntityDetail",description:"Root container for a single-entity detail view. Accepts any number of child blocks (EntityCard, PackageCard, VerifiedProvenancePanel, etc.). Always use this as the outermost element.",props:Pt({title:$e().optional().describe("Optional top-of-panel title override (defaults to the entity rdfs:label)")}),component:cP}),CP=Rr({name:"EntityCard",description:"Compact header card for any entity: name, rdf:type label, optional subtitle, and up to 6 small stat chips.",props:Pt({name:$e().describe("Display name / label of the entity"),typeLabel:$e().optional().describe('Human-readable rdf:type label (e.g. "Package", "Pull Request")'),subtitle:$e().optional().describe("Short supporting text (e.g. path, author, date)"),chips:Ia(Pt({label:$e(),value:$e(),tone:fo(["default","success","warn","danger","info"]).optional()})).max(6).optional()}),component:uP}),NP=Rr({name:"EntityStatsGrid",description:"Grid of numeric stats with labels. Use for summarising counts (files, classes, additions, deletions).",props:Pt({stats:Ia(Pt({label:$e(),value:uv([$e(),aa()]),hint:$e().optional()})).min(1).max(8)}),component:dP}),EP=Rr({name:"TripleTable",description:"Fallback raw-triples table. Use sparingly — only when the entity has no better structured components in this library.",props:Pt({heading:$e().optional(),rows:Ia(Pt({predicate:$e(),object:$e()})).max(60)}),component:pP}),AP=Rr({name:"EntityTypeList",description:"Grouped list of child entities by rdf:type. Great for showing a File's contained classes/functions/interfaces as separate sections.",props:Pt({heading:$e().optional(),groups:Ia(Pt({typeLabel:$e(),icon:$e().optional(),items:Ia(Pt({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(30)})).max(8)}),component:fP}),TP=Rr({name:"CrossRefList",description:"List of cross-references following a single predicate (e.g. code:imports, github:affects, decisions:affects). Each item can show a short subtitle.",props:Pt({heading:$e().describe('Human-readable heading (e.g. "Imports", "Affected files")'),predicate:$e().optional(),items:Ia(Pt({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(40)}),component:hP}),_P=Rr({name:"PackageCard",description:"Specialised card for a code:Package entity: name, folder, description, and a mini-stats strip.",props:Pt({name:$e(),folder:$e().optional(),description:$e().optional(),fileCount:aa().optional(),classCount:aa().optional(),functionCount:aa().optional(),interfaceCount:aa().optional()}),component:mP}),RP=Rr({name:"FileCard",description:"Specialised card for a code:File entity: path, language, line count, owning package.",props:Pt({path:$e(),language:$e().optional(),lineCount:aa().optional(),packageName:$e().optional()}),component:gP}),OP=Rr({name:"DecisionCard",description:"Specialised card for a decisions:Decision entity: title, status badge, date, context/outcome quoted sections.",props:Pt({title:$e(),status:fo(["proposed","accepted","rejected","superseded"]).optional(),date:$e().optional(),context:$e().optional(),outcome:$e().optional(),consequences:$e().optional(),alternatives:$e().optional()}),component:vP}),LP=Rr({name:"PRCard",description:"Specialised card for a github:PullRequest entity: title + #number, state, author, merged badge, body preview.",props:Pt({title:$e(),number:aa().optional(),state:fo(["open","closed","merged"]).optional(),author:$e().optional(),mergedAt:$e().optional(),body:$e().optional(),url:$e().optional()}),component:yP}),MP=Rr({name:"TaskCard",description:"Specialised card for a tasks:Task entity: title, status chip, priority, assignee, estimate.",props:Pt({title:$e(),status:fo(["todo","in_progress","blocked","done","cancelled"]).optional(),priority:fo(["p0","p1","p2","p3"]).optional(),assignee:$e().optional(),estimate:aa().optional()}),component:bP}),DP=Rr({name:"VerifiedProvenancePanel",description:"The Verifiable Memory hero block. Use at the top of any entity in the VM layer. Surfaces on-chain anchor (tx hash, block), consensus (signing agents with reputation), knowledge-asset identity (UAL, content hash, TRAC locked, NFT token id), and finalisation timeline.",props:Pt({onChain:Pt({txHash:$e().optional(),blockNumber:uv([$e(),aa()]).optional(),chain:$e().optional()}).optional(),consensus:Pt({signers:Ia(Pt({did:$e(),label:$e().optional(),reputation:aa().optional(),signature:$e().optional()})).max(10).optional(),quorum:$e().optional().describe('e.g. "3 of 5"')}).optional(),knowledgeAsset:Pt({ual:$e().optional(),contentHash:$e().optional(),tracLocked:$e().optional(),tokenId:$e().optional()}).optional(),timeline:Ia(Pt({label:$e(),at:$e()})).max(6).optional()}),component:xP}),xC=eP({components:[jP,CP,NP,EP,AP,TP,_P,RP,OP,LP,MP,DP],root:"EntityDetail",componentGroups:[{name:"Generic",components:["EntityDetail","EntityCard","EntityStatsGrid","EntityTypeList","CrossRefList","TripleTable"]},{name:"Code domain",components:["PackageCard","FileCard"]},{name:"GitHub domain",components:["PRCard"]},{name:"Decisions & tasks",components:["DecisionCard","TaskCard"]},{name:"Verifiable memory",components:["VerifiedProvenancePanel"]}]});let Gh=null;function zP(){return Gh===null&&(Gh=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."]})),Gh}async function*$P(e){const t=await fetch("/api/genui/render",{method:"POST",headers:{"Content-Type":"application/json",...Ft()},body:JSON.stringify({contextGraphId:e.contextGraphId,entityUri:e.entityUri,libraryPrompt:e.libraryPrompt}),signal:e.signal});if(!t.ok||!t.body){let l=`HTTP ${t.status}`;try{const u=await t.json();u!=null&&u.error&&(l=u.error)}catch{}yield{type:"error",error:l};return}const n=t.body.getReader(),a=new TextDecoder;let s="";try{for(;;){const{value:l,done:u}=await n.read();if(u)break;s+=a.decode(l,{stream:!0});let d;for(;(d=s.indexOf(`
1622
-
1623
- `))!==-1;){const f=s.slice(0,d);s=s.slice(d+2);const h=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 a of e.split(`
1624
- `))a.startsWith("event:")?t=a.slice(6).trim():a.startsWith("data:")&&(n+=a.slice(5).trim());if(!n)return null;try{const a=JSON.parse(n);switch(t){case"start":return{type:"start",...a};case"delta":return{type:"delta",text:a.text??""};case"final":return{type:"final",content:a.content??""};case"error":return{type:"error",error:a.error??"unknown error"};case"done":return{type:"done"};default:return null}}catch{return null}}const IP=({contextGraphId:e,entityUri:t,placeholder:n,fallback:a})=>{const[s,l]=Ve.useState(""),[u,d]=Ve.useState(!0),[f,h]=Ve.useState(null);return Ve.useEffect(()=>{const g=new AbortController;let m="";return l(""),h(null),d(!0),(async()=>{try{const y=zP();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?a?o.jsx(o.Fragment,{children:a(f)}):o.jsx(UP,{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(oP,{response:s,library:xC,isStreaming:u})})},PP="LLM not configured",UP=({error:e})=>{const t=fn(a=>a.openTab);return e.includes(PP)?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 a=t.forSubGraph(n),s=(a==null?void 0:a.color)??"#64748b",l=(a==null?void 0:a.icon)??"•",u=(a==null?void 0:a.displayName)??n;return o.jsxs("span",{className:"v10-subgraph-badge",style:{"--sg-color":s},title:`In sub-graph: ${u}`,children:[o.jsx("span",{className:"v10-subgraph-badge-icon",style:{color:s},children:l}),o.jsx("span",{className:"v10-subgraph-badge-label",children:u})]})}function BP({entity:e,contextGraphId:t,onVerified:n}){const a=Ua(),[s,l]=w.useState(!1),[u,d]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState(null),y=e.trustLevel,b=w.useMemo(()=>{if(!a)return null;for(const E of e.types){const T=a.forType(E);if(T&&(y==="working"&&(T.promoteLabel||T.promoteHint)||y==="shared"&&(T.publishLabel||T.publishHint)))return T}return null},[e.types,a,y]),k=w.useMemo(()=>{if(!a)return null;for(const E of e.subGraphs){if(E==="meta")continue;const T=a.forSubGraph(E);if(T!=null&&T.sourceAssertion)return{binding:T,subGraph:E}}return null},[e.subGraphs,a]);if(y==="verified"||!b)return null;const j=y==="working"?{kind:"promote",label:b.promoteLabel??"Promote to Shared Memory",hint:b.promoteHint??"Shares the complete owning Knowledge Asset with the team.",busyCopy:"Sharing…",disabled:!(k!=null&&k.binding.sourceAssertion),disabledReason:k!=null&&k.binding.sourceAssertion?null:`No sourceAssertion declared on the sub-graph profile — add profile:sourceAssertion to the SubGraphBinding for "${[...e.subGraphs].filter(E=>E!=="meta")[0]??"?"}".`}:{kind:"publish",label:b.publishLabel??"Verify on DKG",hint:b.publishHint??"Publishes the complete owning Knowledge Asset on-chain.",busyCopy:"Anchoring…",disabled:!(k!=null&&k.binding.sourceAssertion),disabledReason:k!=null&&k.binding.sourceAssertion?null:"This entity is not part of a named Shared-Memory asset, so it cannot be published to Verifiable Memory from here."},N=async()=>{if(j.disabled)return;l(!0),m(null),d(null),h(j.kind);const E=(k==null?void 0:k.binding.sourceAssertion)??"assertion";try{if(j.kind==="promote"){const T=await lo(t,k.binding.sourceAssertion,k.subGraph?{subGraphName:k.subGraph}:{});d(_g(E,T))}else{const T=await Ag(t,k.binding.sourceAssertion,k.subGraph?{subGraphName:k.subGraph}:{});d(T)}n()}catch(T){const U=j.kind==="promote"?co(E,T):null,_=U?U.message:(T==null?void 0:T.message)??"Action failed";m(_)}finally{l(!1)}},S=E=>!!E&&"status"in E,A=E=>!!E&&"kind"in E;return o.jsxs("div",{className:`v10-ka-verify v10-ka-verify-${j.kind}`,children:[o.jsxs("div",{className:"v10-ka-verify-head",children:[o.jsx("span",{className:"v10-ka-verify-arrow",children:j.kind==="promote"?"◈":"◉"}),o.jsx("span",{className:"v10-ka-verify-title",children:j.label})]}),o.jsx("div",{className:"v10-ka-verify-hint",children:j.hint}),j.disabledReason&&o.jsxs("div",{className:"v10-ka-verify-err",children:["! ",j.disabledReason]}),!u&&o.jsx("button",{className:`v10-ka-verify-btn ${j.kind}`,onClick:N,disabled:s||j.disabled,children:s?j.busyCopy:j.label}),g&&o.jsxs("div",{className:"v10-ka-verify-err",children:["✕ ",g]}),u&&f==="promote"&&A(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"&&A(u)&&u.kind!=="success"&&o.jsxs("div",{className:"v10-ka-verify-err",children:["! ",u.message]}),u&&f==="publish"&&S(u)&&(()=>{var U,_;const E=u.status==="confirmed"&&!!u.txHash,T=E&&!!u.contextGraphError;return o.jsxs("div",{className:E?T?"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?T?"⚠":"✓":"✕"," ",u.status,E?T?` (${A_})`:"":" (NOT on-chain)"]})]}),T&&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]})]}),((_=(U=u.kas)==null?void 0:U[0])==null?void 0:_.tokenId)&&o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Token"}),o.jsxs("span",{className:"v10-ka-verify-ok-val mono",children:["#",u.kas[0].tokenId]})]})]})})()]})}function FP({entity:e,allEntities:t,allTriples:n,onNavigate:a,onClose:s,contextGraphId:l,onRefresh:u,onOpenAgent:d}){const[f,h]=w.useState("content"),g=Vn(I=>I.theme),m=Ua(),y=cs(),{icon:b,type:k}=Bd(e,m),j=G4(e),N=Ud(e),S=N?(y==null?void 0:y.get(N))??null:null,A=e.trustLevel==="verified"?"vm":e.trustLevel==="shared"?"swm":"wm",E=e.trustLevel==="verified"?"Verifiable Memory":e.trustLevel==="shared"?"Shared Working Memory":"Working Memory",T=ia(e.trustLevel,1),U=w.useMemo(()=>{const I=[];for(const[,H]of t)for(const B of H.connections)B.targetUri===e.uri&&I.push({pred:Zs(B.predicate),entity:H});return I},[e.uri,t]),_=w.useMemo(()=>n.filter(I=>bt(I.subject)===e.uri||bt(I.object)===e.uri),[e.uri,n]),z=w.useMemo(()=>V4(e.uri,n,1),[e.uri,n]),q=w.useMemo(()=>{const I=new Set;for(const H of t.values())rj(H)&&I.add(bt(H.uri));return I},[t]),D=w.useMemo(()=>new Set([bt(e.uri)]),[e.uri]),R=w.useMemo(()=>hd(z,q,{focalSubjects:D}),[z,q,D]),$=w.useMemo(()=>{const I=Yi[e.trustLevel];return{labelMode:"humanized",renderer:"2d",labels:Id({minZoomForLabels:.2}),style:{namespaceColors:Vg(I),defaultNodeColor:I,defaultEdgeColor:"#475569",edgeWidth:1,fontSize:11},hexagon:{baseSize:7,minSize:4,maxSize:10,scaleWithDegree:!0},focus:{maxNodes:500,hops:999}}},[e.trustLevel]),F=w.useMemo(()=>({name:`entity-${e.uri}-${g}`,palette:g,focal:{uri:e.uri,sizeMultiplier:2.4}}),[e.uri,g]),K=_.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:T}),o.jsxs("div",{className:"v10-ka-name",children:[b," ",e.label,o.jsx("span",{className:`v10-trust-badge ${A}`,children:E})]}),o.jsxs("div",{className:"v10-ka-ual",children:[e.uri," · ",k," · ",K," triples"]})]}),(S||N)&&o.jsxs("div",{className:"v10-ka-header-author",children:[o.jsx("div",{className:"v10-ka-header-author-label",children:"Proposed by"}),o.jsx(ts,{agent:S??void 0,fallbackUri:N??void 0,size:"lg",showOperator:!0,onOpenAgent:d})]})]}),o.jsxs("div",{className:"v10-ka-split",children:[o.jsxs("div",{className:"v10-ka-left",children:[o.jsxs("div",{className:"v10-content-tabs",style:{margin:"0 -20px",padding:"0 20px",background:"transparent"},children:[o.jsx("button",{className:`v10-content-tab ${f==="content"?"active":""}`,onClick:()=>h("content"),children:"Content"}),o.jsx("button",{className:`v10-content-tab ${f==="triples"?"active":""}`,onClick:()=>h("triples"),children:"Triples"}),o.jsx("button",{className:`v10-content-tab ${f==="graph"?"active":""}`,onClick:()=>h("graph"),children:"Graph"})]}),f==="content"&&o.jsxs(o.Fragment,{children:[!e.types.map(H=>m==null?void 0:m.forType(H)).find(H=>H==null?void 0:H.detailHint)||!(m!=null&&m.contextGraphId)?null:o.jsx("div",{className:"v10-ka-section",children:o.jsx(IP,{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,H])=>o.jsxs("div",{className:"v10-ka-prop",children:[o.jsx("span",{className:"v10-ka-prop-key",children:Zs(I)}),o.jsx("span",{className:"v10-ka-prop-val",children:H.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,H)=>{const B=t.get(I.targetUri);return o.jsxs("button",{className:"v10-ka-conn",onClick:()=>a(I.targetUri),children:[o.jsx("span",{className:"v10-ka-conn-pred",children:Zs(I.predicate)}),o.jsx("span",{className:"v10-ka-conn-arrow",children:"→"}),o.jsx("span",{className:"v10-ka-conn-target",children:I.targetLabel}),B&&o.jsx(Nw,{entity:B,profile:m})]},H)})]}),U.length>0&&o.jsxs("div",{className:"v10-ka-section",children:[o.jsxs("div",{className:"v10-ka-section-title",children:["Referenced by (",U.length,")"]}),U.map((I,H)=>o.jsxs("button",{className:"v10-ka-conn",onClick:()=>a(I.entity.uri),children:[o.jsx("span",{className:"v10-ka-conn-target",children:I.entity.label}),o.jsx(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})]},H))]}),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:[K," triples"]}),o.jsxs("span",{className:"v10-ka-meta-item",children:[e.connections.length," links"]})]})]}),f==="triples"&&o.jsxs("div",{style:{marginTop:8,overflowX:"auto",border:"1px solid var(--border-default)",borderRadius:6},children:[o.jsxs("table",{className:"v10-ka-triples-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Subject"}),o.jsx("th",{children:"Predicate"}),o.jsx("th",{children:"Object"})]})}),o.jsx("tbody",{children:_.slice(0,50).map((I,H)=>o.jsxs("tr",{children:[o.jsx("td",{title:I.subject,children:Zs(I.subject)}),o.jsx("td",{title:I.predicate,children:Zs(I.predicate)}),o.jsx("td",{title:I.object,children:I.object.startsWith('"')?Pd(I.object).slice(0,60):Zs(I.object)})]},H))})]}),o.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",padding:"6px 8px"},children:[Math.min(_.length,50)," of ",_.length," triples shown"]})]}),f==="graph"&&o.jsx(Xu,{title:`${e.label} graph`,scopeLabel:`Entity detail graph: 1-hop neighborhood around ${e.label}.`,tone:A,className:"v10-ka-graph-shell",renderGraph:I=>R.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(Jg,{data:R,format:"triples",options:$,viewConfig:F,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:H=>(H==null?void 0:H.id)&&H.id!==e.uri&&a(H.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(gz,{contextGraphId:l,entityUri:e.uri,enabled:e.trustLevel==="verified"}),o.jsx("div",{className:"v10-ka-section-title",children:"Provenance Trail"}),o.jsx(HP,{entity:e}),o.jsx(BP,{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:K})]}),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 HP({entity:e}){const t=cs(),n=u=>{const d=F4(e,u),f=H4(e,u),h=d?t==null?void 0:t.get(d):null;return{uri:d,at:f,agent:h}},a=n("created"),s=n("promoted"),l=n("published");return o.jsxs("div",{className:"v10-ka-timeline",children:[e.trustLevel==="verified"&&o.jsx(Vh,{toneClass:"verified",title:"Published to Verifiable Memory",actionWord:"Published",agent:l.agent,agentUri:l.uri,at:l.at}),(e.trustLevel==="shared"||e.trustLevel==="verified")&&o.jsx(Vh,{toneClass:"shared",title:"Promoted to Shared Working Memory",actionWord:"Promoted",agent:s.agent,agentUri:s.uri,at:s.at}),o.jsx(Vh,{toneClass:"created",title:"Created in Working Memory",actionWord:"Created",agent:a.agent,agentUri:a.uri,at:a.at})]})}function Vh({toneClass:e,title:t,actionWord:n,agent:a,agentUri:s,at:l}){const u=l?Y4(l):null;return o.jsxs("div",{className:"v10-ka-event",children:[o.jsx("div",{className:`v10-ka-event-dot ${e}`}),o.jsxs("div",{className:"v10-ka-event-header",children:[o.jsx("span",{className:"v10-ka-event-title",children:t}),u&&o.jsx("time",{className:"v10-ka-event-time",dateTime:l??void 0,children:u})]}),(a||s)&&o.jsxs("div",{className:"v10-ka-event-attribution",children:[o.jsxs("span",{className:"v10-ka-event-attribution-prefix",children:[n," by"]}),o.jsx(ts,{agent:a??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 qP({contextGraphId:e,memory:t,onNodeClick:n,onSelectSubGraph:a}){const s=Ua(),[l,u]=w.useState([]),[d,f]=w.useState(!0),[h,g]=w.useState(null);w.useEffect(()=>{let _=!1;return f(!0),g(null),Mg(e).then(z=>{_||u(z.subGraphs??[])}).catch(z=>{_||g(z instanceof Error?z.message:"Failed to load subgraphs")}).finally(()=>{_||f(!1)}),()=>{_=!0}},[e]);const{total:m}=Zg(t),y=Object.values(t.layerStatus??{}),b=t.loading||y.some(_=>_==="loading"),k=t.error!==null||t.partial||y.some(_=>_==="error"),j=w.useMemo(()=>{const _=new Map;for(const z of t.entityList){const q=bt(z.uri);for(const D of z.subGraphs){let R=_.get(D);R||(R=new Set,_.set(D,R)),R.add(q)}}return _},[t.entityList]),{triplesBySubGraph:N,tripleCountBySubGraph:S}=w.useMemo(()=>{const _=new Map;for(const D of t.allTriples){if(!D.subGraph)continue;let R=_.get(D.subGraph);R||(R=[],_.set(D.subGraph,R)),R.push(D)}for(const D of t.allTriples)if(!D.subGraph){for(const[R,$]of j)if(Tm(D,{slug:R,isRoot:!1,scopedUris:$})){let F=_.get(R);F||(F=[],_.set(R,F)),F.push(D)}}const z=new Map,q=new Map;for(const[D,R]of _){const F=_m(R,t.entities).map(K=>({subject:K.subject,predicate:K.predicate,object:K.object}));q.set(D,F.length),z.set(D,M1(F))}return{triplesBySubGraph:z,tripleCountBySubGraph:q}},[t.allTriples,t.entities,j]),A=w.useMemo(()=>{const _=new Map;for(const z of t.entityList)for(const q of z.subGraphs){let D=_.get(q);D||(D={wm:0,swm:0,vm:0},_.set(q,D)),z.trustLevel==="verified"?D.vm++:z.trustLevel==="shared"?D.swm++:D.wm++}return _},[t.entityList]),E=w.useMemo(()=>{const _=new Map;for(const z of t.entityList){const q=bt(z.uri);for(const D of z.subGraphs){let R=_.get(D);R||(R=new Map,_.set(D,R)),R.set(q,z.trustLevel),q!==z.uri&&R.set(z.uri,z.trustLevel)}}return _},[t.entityList]),T=w.useMemo(()=>l.filter(Kg).map(_=>{const z=(s==null?void 0:s.forSubGraph(_.name))??{},q=N.get(_.name)??[],D=j.get(_.name)??new Set,R=E.get(_.name)??new Map;return{slug:_.name,icon:z.icon??"•",color:z.color??"#64748b",displayName:z.displayName??_.name,description:z.description,rank:z.rank??99,entityCount:D.size>0?D.size:_.entityCount,tripleCount:S.get(_.name)??0,triples:hd(q,D),layerCounts:A.get(_.name)??{wm:0,swm:0,vm:0},entityTrustByUri:R}}).sort((_,z)=>_.rank-z.rank),[l,s,N,S,A,j,E]),U=w.useMemo(()=>{const _=[],z=new Set,q=new Map;let D=0,R=0,$=0;for(const Q of t.entityList){if(Q.subGraphs.size>0)continue;_.push(Q);const V=bt(Q.uri);z.add(V),q.set(V,Q.trustLevel),V!==Q.uri&&q.set(Q.uri,Q.trustLevel),Q.trustLevel==="verified"?$++:Q.trustLevel==="shared"?R++:D++}const F=t.allTriples.filter(Q=>!Q.subGraph),K=_m(F,t.entities).map(Q=>({subject:Q.subject,predicate:Q.predicate,object:Q.object})),I=K.length,H=hd(K,z),B=M1(H),W=(s==null?void 0:s.forSubGraph($r))??{};return{slug:$r,icon:W.icon??"⊘",color:W.color??"#64748b",displayName:W.displayName??"Root",description:W.description,rank:999,entityCount:_.length,tripleCount:I,triples:B,layerCounts:{wm:D,swm:R,vm:$},entityTrustByUri:q}},[t.entityList,t.allTriples,t.entities,s]);return d&&T.length===0?o.jsx(ln,{compact:!0,icon:"#",title:"Loading subgraphs...",className:"v10-sgov-state"}):h&&T.length===0?o.jsx(ln,{icon:"!",title:"Couldn't load subgraphs.",description:"Refresh the page to try again.",tone:"danger",className:"v10-sgov-state"}):T.length===0&&U.entityCount===0?o.jsx(ln,{icon:"#",title:"No subgraphs in this Context Graph yet.",description:o.jsxs(o.Fragment,{children:["A subgraph is a named topical slice of this Context Graph (e.g. ",o.jsx("code",{children:"recipes"}),", ",o.jsx("code",{children:"decisions"}),"). Agents create one when they scope an assertion to a subgraph. All current entities live in the Context Graph root."]}),actions:[{label:"View root",onClick:()=>a($r),variant:"primary"}],className:"v10-sgov-state"}):o.jsxs("div",{className:"v10-sgov",children:[o.jsxs("div",{className:"v10-sgov-header",children:[o.jsx("div",{className:"v10-sgov-title",children:"Subgraphs"}),o.jsxs("div",{className:"v10-sgov-sub",children:[T.length," named subgraphs · ",t.counts.total," entities · ",m," triples"]})]}),o.jsxs("div",{className:"v10-sgov-grid",children:[T.map(_=>o.jsx(Aw,{card:_,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>a(_.slug)},_.slug)),o.jsx(Aw,{card:U,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>a($r),variant:"root"},$r)]})]})}function Aw({card:e,isHydrating:t=!1,isFailedOrPartial:n=!1,onNodeClick:a,onOpen:s,variant:l}){const u=w.useMemo(()=>{const h={};for(const[g,m]of e.entityTrustByUri)h[g]=Yi[m];return h},[e.entityTrustByUri]),d=w.useMemo(()=>({labelMode:"humanized",renderer:"2d",labels:Id({minZoomForLabels:.8}),style:{classColors:cj,predicateColors:uj,namespaceColors:Vg(e.color),...Object.keys(u).length>0?{nodeColors:u}:{},defaultNodeColor:e.color,defaultEdgeColor:"#475569",edgeWidth:1,fontSize:12,gradient:!0,gradientIntensity:.35},hexagon:{baseSize:6,minSize:3,maxSize:16,scaleWithDegree:!0},focus:{maxNodes:5e3,hops:999}}),[e.color,u]),f=l==="root";return o.jsxs("div",{className:`v10-sgov-card${f?" root":""}`,style:f?void 0:{"--sg-color":e.color,borderColor:e.color+"55"},children:[o.jsxs("div",{className:"v10-sgov-card-head",children:[o.jsx("span",{className:"v10-sgov-card-icon",style:f?void 0:{color:e.color},children:e.icon}),o.jsxs("div",{className:"v10-sgov-card-title-wrap",children:[o.jsx("div",{className:"v10-sgov-card-title",children:e.displayName}),e.description&&o.jsx("div",{className:"v10-sgov-card-desc",title:e.description,children:e.description})]}),o.jsx("button",{type:"button",className:"v10-sgov-card-open",onClick:s,title:`Focus on ${e.displayName}`,children:"↗"})]}),o.jsxs("div",{className:"v10-sgov-card-stats",children:[o.jsxs("span",{className:"v10-sgov-card-stat",children:[o.jsx("b",{children:e.entityCount})," entities"]}),o.jsxs("span",{className:"v10-sgov-card-stat",title:t&&e.tripleCount===0?"Loading triples for this subgraph…":n?e.tripleCount===0?"Some layers unavailable; count may be incomplete.":`${e.tripleCount} triples (some layers unavailable; count may be incomplete).`:t?`${e.tripleCount} triples (still loading; count may grow).`:e.tripleCount!==e.triples.length?`${e.tripleCount} triples in this subgraph's scope; ${e.triples.length} rendered (some in-scope edges aren't drawn — either endpoints outside this subgraph, or cap-trimmed in dense buckets).`:void 0,children:[o.jsx("b",{children:t&&e.tripleCount===0?"…":e.tripleCount})," triples"]})]}),o.jsx("div",{className:"v10-sgov-card-pyramid",children:o.jsx(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(Jg,{data:e.triples,format:"triples",options:d,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:a,initialFit:!0})})})]})}function wC({counts:e,activeLayers:t,onClickLayer:n,compact:a=!1}){const s=e.wm+e.swm+e.vm;if(s===0)return a?null:o.jsx("div",{className:"v10-minibar v10-minibar-empty",children:"No data"});const l=[{key:"verified",short:"VM",count:e.vm,color:"#22c55e",label:"Verifiable"},{key:"shared",short:"SWM",count:e.swm,color:"#f59e0b",label:"Shared"},{key:"working",short:"WM",count:e.wm,color:"#64748b",label:"Working"}],u=!!n;return o.jsxs("div",{className:`v10-minibar${a?" compact":""}`,children:[!a&&o.jsx("div",{className:"v10-minibar-bar",children:l.filter(d=>d.count>0).map(d=>{const f=d.count/s*100,h=t?t.has(d.key):!0;return o.jsx("div",{className:`v10-minibar-seg${h?"":" dim"}`,style:{width:`${f}%`,background:d.color},title:`${d.label}: ${d.count}`},d.key)})}),o.jsx("div",{className:"v10-minibar-legend",children:l.map(d=>{const f=t?t.has(d.key):!0;return o.jsxs("button",{type:"button",className:`v10-minibar-chip${f?"":" dim"}${u?" interactive":""}`,onClick:u?()=>n(d.key):void 0,disabled:!u,title:`${d.label} Memory — ${d.count} entities${u?" (click to toggle)":""}`,children:[o.jsx("span",{className:"v10-minibar-dot",style:{background:d.color}}),o.jsx("span",{className:"v10-minibar-short",children:d.short}),o.jsx("span",{className:"v10-minibar-count",children:d.count})]},d.key)})})]})}function GP({items:e,color:t,onSelectEntity:n,scrollKey:a}){const s=Ua(),l=cs(),u=w.useMemo(()=>{const d=new Map;for(const f of e){const h=`${f.date.getFullYear()}-${String(f.date.getMonth()+1).padStart(2,"0")}`,g=d.get(h)??[];g.push(f),d.set(h,g)}return[...d.entries()].sort((f,h)=>f[0].localeCompare(h[0]))},[e]);return e.length===0?o.jsx("div",{className:"v10-subgraph-timeline-empty","data-cg-scroll-key":a,children:o.jsx(ln,{compact:!0,title:"No timeline values yet.",description:"Entities in this sub-graph do not currently expose the configured timeline field."})}):o.jsx("div",{className:"v10-subgraph-timeline","data-cg-scroll-key":a,children:u.map(([d,f])=>o.jsxs("div",{className:"v10-subgraph-timeline-bucket",children:[o.jsxs("div",{className:"v10-subgraph-timeline-bucket-head",children:[o.jsx("span",{className:"v10-subgraph-timeline-bucket-dot",style:{background:t}}),o.jsx("span",{className:"v10-subgraph-timeline-bucket-label",children:Q4(d)}),o.jsx("span",{className:"v10-subgraph-timeline-bucket-count",children:f.length})]}),o.jsx("div",{className:"v10-subgraph-timeline-items",children:f.map(({entity:h,date:g})=>{const{icon:m}=Bd(h,s),y=Ud(h),b=y?l==null?void 0:l.get(y):null;return o.jsxs("button",{className:"v10-subgraph-timeline-item",onClick:()=>n(h.uri),title:`${h.label} · ${g.toISOString().slice(0,10)}`,children:[o.jsx("span",{className:"v10-subgraph-timeline-item-icon",children:m}),o.jsx("span",{className:"v10-subgraph-timeline-item-label",children:h.label}),(b||y)&&o.jsx(ts,{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 VP({slug:e,rawMemory:t,contextGraphId:n,onNodeClick:a,onSelectEntity:s,activeTab:l,onTabChange:u,initialLayer:d,initialEnabledLayers:f,onEnabledLayersChange:h}){const g=Ua(),m=g==null?void 0:g.forSubGraph(e),y=(g==null?void 0:g.chipsFor(e))??[],b=(g==null?void 0:g.savedQueryCatalogsFor(e))??[],k=m==null?void 0:m.timelinePredicate,[j,N]=w.useState("items"),S=l??j,A=S==="timeline"&&!k?"items":S,E=u??N,[T,U]=w.useState(m!=null&&m.timelinePredicate?"created-desc":"triples");w.useEffect(()=>{U(m!=null&&m.timelinePredicate?"created-desc":"triples")},[e,m==null?void 0:m.timelinePredicate]);const _=w.useMemo(()=>f&&f.size>0?new Set(f):d==="wm"?new Set(["working"]):d==="swm"?new Set(["shared"]):d==="vm"?new Set(["verified"]):new Set(["working","shared","verified"]),[d,f]),[z,q]=w.useState(_);w.useEffect(()=>{h==null||h(z)},[z,h]);const[D,R]=w.useState(new Map),[$,F]=w.useState(null),[K,I]=w.useState(null),[H,B]=w.useState(!1),[W,Q]=w.useState(null),V=e===$r,L=w.useMemo(()=>{const ee=[];for(const ce of t.entityList)(V?ce.subGraphs.size===0:ce.subGraphs.has(e))&&ee.push(ce);return ee},[t.entityList,e,V]),P=w.useMemo(()=>new Set(L.map(ee=>ee.uri)),[L]),G=w.useMemo(()=>t.graphTriples.filter(ee=>Tm(ee,{slug:e,isRoot:V,scopedUris:P})),[t.graphTriples,P,e,V]),O=w.useMemo(()=>{let ee=0,ce=0,he=0;for(const Le of L)Le.trustLevel==="verified"?he++:Le.trustLevel==="shared"?ce++:ee++;return{wm:ee,swm:ce,vm:he,total:L.length}},[L]),ne=w.useMemo(()=>{if(z.size!==1)return null;const ee=z.values().next().value;return ee==="verified"?"vm":ee==="shared"?"swm":ee==="working"?"wm":null},[z]),ue=w.useMemo(()=>{let ee=L;if(z.size<3&&(ee=ee.filter(ce=>z.has(ce.trustLevel))),D.size>0)for(const ce of y){const he=D.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 K&&(ee=ee.filter(ce=>K.has(ce.uri))),ee},[L,z,D,y,K]),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(D.size>0)for(const Fe of y){const et=D.get(Fe.slug);if(!et||et.size===0)continue;const Ne=Ce.properties.get(Fe.predicate);if(!Ne||Ne.length===0||!Ne.some(Wt=>et.has(Wt)))return!1}return!(K&&!K.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||!Tm(Ce,{slug:e,isRoot:V,scopedUris:P,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,P,e,V,L,y,D,K])??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(D.size>0)for(const he of y){const Le=D.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!(K&&!K.has(ce.uri))})}return ue},[ne,L,ue,y,D,K]),We=w.useMemo(()=>Ie.map(ee=>({uri:ee.uri,label:ee.label})),[Ie]),Se=w.useMemo(()=>{if(ne)return;const ee={};for(const ce of Ie){ee[ce.uri]=Yi[ce.trustLevel];const he=bt(ce.uri);he!==ce.uri&&(ee[he]=Yi[ce.trustLevel])}return ee},[ne,Ie]),ft=z.size===3?"All layers":ne?zn[ne].title:Array.from(z).map(ee=>zn[ee==="verified"?"vm":ee==="shared"?"swm":"wm"].trustLabel).join(" + "),De=w.useMemo(()=>{if(!k)return[];const ee=[];for(const ce of ue){const he=Qu(ce,k);he!=null&&ee.push({entity:ce,date:new Date(he)})}return ee.sort((ce,he)=>ce.date.getTime()-he.date.getTime()),ee},[ue,k]),qe=w.useMemo(()=>{const ee=[...ue];if((T==="created-desc"||T==="created-asc")&&k){const ce=T==="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 T==="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,T,k]),ke=T==="created-desc"?"newest first · click to open":T==="created-asc"?"oldest first · click to open":T==="label"?"A → Z · click to open":"sorted by triples · click to open",lt=w.useCallback(ee=>{q(ce=>{const he=new Set(ce);return he.has(ee)?he.size>1&&he.delete(ee):he.add(ee),he})},[]),xe=w.useCallback((ee,ce)=>{R(he=>{const Le=new Map(he),He=new Set(Le.get(ee)??[]);return He.has(ce)?He.delete(ce):He.add(ce),He.size===0?Le.delete(ee):Le.set(ee,He),Le})},[]),Oe=w.useCallback(()=>{F(null),I(null),Q(null)},[]),Ot=w.useCallback(async ee=>{var ce;B(!0),Q(null),F(ee.slug);try{const he=await or(ee.sparql,n),Le=((ce=he==null?void 0:he.result)==null?void 0:ce.bindings)??[],He=ee.resultColumn||"uri",Ce=new Set;for(const Fe of Le){const et=Fe[He];if(!et)continue;const Ne=typeof et=="string"?et:String(et),Wt=Ne.startsWith("<")&&Ne.endsWith(">")?Ne.slice(1,-1):Ne;Ce.add(Wt)}I(Ce)}catch(he){Q((he==null?void 0:he.message)??String(he)),I(null),F(null)}finally{B(!1)}},[n]),$t=(m==null?void 0:m.color)??(V?"var(--text-tertiary)":"#64748b"),Yt=(m==null?void 0:m.icon)??"•",qt=(m==null?void 0:m.displayName)??e,ut=m==null?void 0:m.description;w.useEffect(()=>{q(_),R(new Map),Oe()},[e,Oe,_]),w.useEffect(()=>{l||N("items")},[e,l]),w.useEffect(()=>{S!==A&&E(A)},[S,A,E]);const X=!(z.size===_.size&&[...z].every(ee=>_.has(ee)))||D.size>0||!!K,Z=()=>{q(new Set(_)),R(new Map),Oe()};return o.jsxs("div",{className:"v10-layer-detail v10-subgraph-detail",style:{"--sg-color":$t},children:[o.jsxs("div",{className:"v10-subgraph-detail-header",children:[o.jsx("span",{className:"v10-subgraph-detail-icon",style:{color:$t},children:Yt}),o.jsxs("div",{className:"v10-subgraph-detail-title-wrap",children:[o.jsx("div",{className:"v10-subgraph-detail-title",children:qt}),ut&&o.jsx("div",{className:"v10-subgraph-detail-desc",children:ut})]}),o.jsx(wC,{counts:{wm:O.wm,swm:O.swm,vm:O.vm},activeLayers:z,onClickLayer:lt,compact:!0})]}),o.jsxs("div",{className:"v10-subgraph-cross-layer",children:[o.jsx("div",{className:"v10-subgraph-cross-layer-lede",children:V?"Root entities, across the three memory layers:":"This subgraph, across the three memory layers:"}),o.jsxs("div",{className:"v10-subgraph-cross-layer-strip","data-testid":"cross-layer-strip",children:[o.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"wm","aria-pressed":z.has("working"),onClick:()=>lt("working"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Yi.working},children:"◇"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Working"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:O.wm})]}),o.jsx("span",{className:"v10-subgraph-cross-layer-arrow","aria-hidden":"true",children:"→"}),o.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"swm","aria-pressed":z.has("shared"),onClick:()=>lt("shared"),title:ne==="swm"?"Showing Shared Working Memory only — graph is colored by contributing agent (see legend).":void 0,children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Yi.shared},children:"◈"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Shared"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:O.swm})]}),o.jsx("span",{className:"v10-subgraph-cross-layer-arrow","aria-hidden":"true",children:"→"}),o.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"vm","aria-pressed":z.has("verified"),onClick:()=>lt("verified"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Yi.verified},children:"◉"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Verifiable"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:O.vm})]})]}),o.jsxs("span",{className:`v10-subgraph-active-layer-pill${z.size===3?" all-layers":""}`,"data-testid":"active-layer-pill",children:[o.jsx("span",{className:"v10-subgraph-active-layer-pill-label",children:"Active layer:"}),o.jsx("span",{className:"v10-subgraph-active-layer-pill-value",children:ft})]})]}),b.length>0&&o.jsxs("div",{className:"v10-subgraph-savedqueries",children:[o.jsx("span",{className:"v10-subgraph-savedqueries-label",children:"Query catalog"}),b.map(ee=>o.jsxs(Ve.Fragment,{children:[o.jsx("span",{className:"v10-subgraph-savedqueries-label",title:ee.description||ee.name,style:{marginLeft:8,opacity:.8},children:ee.name}),ee.queries.map(ce=>{const he=$===ce.slug;return o.jsxs("button",{type:"button",className:`v10-subgraph-savedquery${he?" active":""}`,onClick:()=>he?Oe():Ot(ce),title:ce.description||ce.name,disabled:H&&!he,children:[o.jsx("span",{className:"v10-subgraph-savedquery-glyph",children:H&&he?"…":he?"✓":"◎"}),ce.name]},ce.slug)})]},ee.slug)),W&&o.jsx("span",{className:"v10-subgraph-savedquery-error",title:W,children:"✕ query failed"}),K&&$&&o.jsxs("span",{className:"v10-subgraph-savedquery-count",children:[K.size," match",K.size===1?"":"es"]})]}),y.length>0&&o.jsxs("div",{className:"v10-subgraph-filters",children:[y.map(ee=>{const ce=D.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)}),X&&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 ${A==="items"?"active":""}`,onClick:()=>E("items"),children:["Entities (",ue.length,ue.length!==L.length?` / ${L.length}`:"",")"]}),o.jsx("button",{className:`v10-layer-expand-tab ${A==="graph"?"active":""}`,onClick:()=>E("graph"),children:"Graph"}),k&&o.jsx("button",{className:`v10-layer-expand-tab ${A==="timeline"?"active":""}`,onClick:()=>E("timeline"),children:"Timeline"}),o.jsx("button",{className:`v10-layer-expand-tab ${A==="docs"?"active":""}`,onClick:()=>E("docs"),children:"Documents"})]}),A==="items"&&o.jsx("div",{className:"v10-layer-expand-body entities-tab","data-cg-scroll-key":`subgraph:${e}:items`,children:o.jsx(Aj,{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:T,onChange:ee=>U(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)"})]})]})})}),A==="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:a,contextGraphId:n,title:qt,scopeLabel:`Subgraph graph: ${qt} entities and entity-to-entity triples from loaded subgraph data.`,trustLegendActiveLayer:ne,scopeEntities:We,layerEntities:Ie,nodeColorsOverride:Se})}),A==="timeline"&&k&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(GP,{items:De,color:$t,onSelectEntity:s,scrollKey:`subgraph:${e}:timeline`})}),A==="docs"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(Tj,{entities:ue,contextGraphId:n,scrollKey:`subgraph:${e}:docs`})})]})]})}const WP={wm:"items",swm:"items",vm:"items"},Tw={wm:"working",swm:"shared",vm:"verified"};function Wh(e){return e==="wm"||e==="swm"||e==="vm"}function ZP(e){const t=new Set;return e.filter(n=>{const a=`${bt(n.subject)}|${n.predicate}|${bt(n.object)}`;return t.has(a)?!1:(t.add(a),!0)})}function _w(e,t){if(typeof document>"u")return t;const n=document.querySelectorAll("[data-cg-scroll-key]");for(const a of n)if(a.dataset.cgScrollKey===e)return a;return t}function KP({contextGraphId:e}){const{data:t,error:n,loading:a,refresh:s}=lr(Tn.fetchContextGraphs,[],3e4),[l,u]=w.useState(!1),[d,f]=w.useState(!1),[h,g]=w.useState("overview"),[m,y]=w.useState(null),[b,k]=w.useState({contextGraphId:null,list:[],status:"loading"}),[j,N]=w.useState(null),[S,A]=w.useState(!1),E=w.useRef(0),[T,U]=w.useState(null),[_,z]=w.useState(null),q=w.useRef(null),[D,R]=w.useState(null),$=w.useCallback(de=>{q.current=de,R(de)},[]),F=w.useRef(null),K=w.useCallback(de=>{F.current=de,de===null&&(q.current=null,R(null)),U(de)},[]),[I,H]=w.useState(null),B=w.useRef(null);w.useEffect(()=>{B.current=m},[m]);const[W,Q]=w.useState(WP),[V,L]=w.useState({}),P=w.useRef(null),G=w.useRef(null),O=w.useRef(null),ne=w.useRef(0),ue=CM(e),le=RM(e),be=fn(de=>de.openTab),{data:_e,loading:Ee,error:Ie}=zd(),We=w.useCallback(()=>T?`subgraph:${T}:${V[T]??"items"}`:Wh(h)?`layer:${h}:${W[h]}`:"page",[h,T,W,V]),Se=w.useCallback(de=>{const je=de??We(),Ae=_w(je,P.current);return{activeLayer:h,activeSubGraph:T,layerTabs:{...W},subGraphTabs:{...V},scroll:{key:je,top:(Ae==null?void 0:Ae.scrollTop)??0},subGraphEnabledLayers:T!==null&&q.current?new Set(q.current):null}},[h,T,We,W,V]),ft=w.useCallback(de=>{const je=()=>{const Ae=_w(de.key,P.current);Ae&&(Ae.scrollTop=de.top)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(je):setTimeout(je,0)},[]),De=w.useCallback((de,je)=>{(!B.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,T,W,V,ft]),w.useEffect(()=>{const de=je=>{const Ae=je.detail;Ae&&Ae.contextGraphId===e&&typeof Ae.entityUri=="string"&&(H(null),De(Ae.entityUri))};return window.addEventListener("v10:open-entity",de),()=>window.removeEventListener("v10:open-entity",de)},[e,De]);const ke=w.useCallback(de=>{var tt;const je=de.startsWith("urn:dkg:agent:")?de.slice(14):de,Ae=((tt=le.get(de))==null?void 0:tt.name)??je;be({id:`agent:${e}|${je}`,label:`@ ${Ae}`,closable:!0})},[le,e,be]),lt=w.useMemo(()=>({...le,openAgent:ke}),[le,ke]),xe=w.useMemo(()=>{var de;return(de=t==null?void 0:t.contextGraphs)==null?void 0:de.find(je=>je.id===e)},[t,e]),Oe=Gg(e,{signalErrors:!0}),Ot=Zg(Oe).total,$t=M4({activeLayer:h,activeSubGraph:T}),Yt=wj($t?e:void 0),qt=!T&&h==="overview",ut=PM(qt?e:void 0),ye=qt?ut.resultContextGraphId===e?ut.events:[]:void 0,X=qt&&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"}),Tn.listParticipants(de).then(Ae=>{ne.current===je&&k({contextGraphId:de,list:Ae.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;Tn.fetchSubGraphs(e).then(je=>{if(E.current!==de)return;const Ae=(je.subGraphs??[]).filter(Kg).length;N(Ae),A(!1)}).catch(()=>{E.current===de&&(N(null),A(!0))})},[e]);w.useEffect(()=>{N(null),A(!1),ee()},[ee]),xo(e,ee);const ce=I?Tw[I]:null,he=w.useMemo(()=>ce?Oe.allTriples.filter(de=>de.layer===ce):Oe.graphTriples,[Oe.allTriples,Oe.graphTriples,ce]),Le=w.useMemo(()=>ce?ZP(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),H(null),qe())},[m,Ce,Oe.loading,qe]);const Fe=w.useCallback((de,je)=>{const Ae=F.current;if(qe(),K(de),de===null)z(null);else if(je!==void 0){const tt=new Set([Tw[je]]);z(tt),q.current=tt,R(tt)}else{if(Ae!==null&&de===Ae)return;if(Ae!==null&&q.current){const tt=new Set(q.current);z(tt),q.current=tt,R(tt)}else z(null),q.current=null,R(null)}y(null),H(null)},[qe,K]),et=w.useCallback(de=>{qe(),g(de),y(null),H(null),K(null),z(null)},[qe,K]),Ne=w.useCallback((de,je)=>{Q(Ae=>Ae[de]===je?Ae:{...Ae,[de]:je})},[]),Wt=w.useCallback((de,je)=>{L(Ae=>Ae[de]===je?Ae:{...Ae,[de]:je})},[]),_t=w.useCallback((de,je,Ae)=>{const tt=B.current!=null;De(de,je),H(Je=>Ae??(tt?Je:null))},[De]),Hr=w.useCallback(()=>{const de=G.current;if(G.current=null,y(null),H(null),!!de){if(g(de.activeLayer),K(de.activeSubGraph),de.activeSubGraph!==null&&de.subGraphEnabledLayers){const je=new Set(de.subGraphEnabledLayers);z(je),q.current=je,R(je)}Q(de.layerTabs),L(de.subGraphTabs),O.current=de.scroll}},[K]),dr=w.useCallback(de=>{if(!(de!=null&&de.id))return;const je=Wh(de.trustLayer)?de.trustLayer:void 0;_t(de.id,void 0,je)},[_t]),Fa=w.useCallback(de=>{const je=Wh(h)?h:void 0;_t(de,void 0,je)},[h,_t]),Ha=w.useCallback(de=>{_t(de,"page")},[_t]),pr=w.useCallback(()=>{be(Sj)},[be]),qr=!!n&&/authentication|unauthor|expired|sign in|log in/i.test(n);if(!xe)return n||t&&!a?o.jsxs("div",{className:"v10-view-placeholder",children:[o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:12,marginBottom:10},children:n?qr?n:"Failed to load context graph.":"Context graph not found."}),qr?o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:()=>window.location.reload(),children:"Refresh page"}):o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:s,children:"Retry"})]}):o.jsx("div",{className:"v10-view-placeholder",children:o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:12},children:"Loading context graph..."})});const ca=T?ue.forSubGraph(T):null,qa=!Oe.loading&&!Oe.error&&!Oe.partial?Oe.entityList:void 0,Ci=Ce?"entity":T?"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:qr?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:n}),o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:()=>window.location.reload(),children:"Refresh page"})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Couldn’t refresh context-graph data — showing last known values."}),o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:s,children:"Retry"})]})}),o.jsx(bD,{cg:xe,profile:ue,activeSubGraph:ca,onClearSubGraph:()=>Fe(null)}),o.jsx(yD,{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:P,children:[Ce&&o.jsx(FP,{entity:Ce,allEntities:He,allTriples:Le,onNavigate:_t,onClose:Hr,contextGraphId:e,onRefresh:Oe.refresh}),T&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(Ew,{}),o.jsx(zh,{contextGraphId:e,profile:ue,selected:T,entities:qa,onSelect:Fe,enabledScope:D??void 0,allTriplesTotal:Ot}),o.jsx(VP,{slug:T,rawMemory:Oe,contextGraphId:e,onNodeClick:dr,onSelectEntity:_t,activeTab:V[T]??"items",onTabChange:de=>Wt(T,de),initialEnabledLayers:_??void 0,onEnabledLayersChange:$})]}),!T&&h==="overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(CD,{cg:xe,memory:Oe,subGraphCount:j,subGraphFetchFailed:S,participants:ge,participantsStatus:Me,currentAgent:_e??null,currentAgentStatus:Ee?"loading":Ie?"error":"ok",onSwitchLayer:et,onOpenPrimer:pr}),o.jsx(ND,{contextGraphId:e,curatorStatus:SD({cg:xe,currentAgent:_e??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(aD,{entities:Oe.entityList,lifecycleEvents:ye,lifecycleError:X,onSelectEntity:Ha,title:"Recent activity",limit:40,includeUndated:!1,emptyHint:"Once knowledge starts being added and managed in this context graph, activities will show up here as a live feed.",className:"v10-overview-activity"})}),o.jsx(ED,{onOpenPrimer:pr})]}),!T&&h==="graph-overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(Ew,{}),o.jsx(zh,{contextGraphId:e,profile:ue,selected:null,entities:qa,onSelect:Fe,allTriplesTotal:Ot}),o.jsx(qP,{contextGraphId:e,memory:Oe,onNodeClick:dr,onSelectSubGraph:Fe})]}),!T&&h==="query"&&!Ce&&o.jsx(az,{contextGraphId:e}),!T&&(h==="wm"||h==="swm"||h==="vm")&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(zh,{contextGraphId:e,profile:ue,selected:T,entities:qa,onSelect:Fe,layer:h}),o.jsx(GD,{layer:h,memory:Oe,onNodeClick:dr,onSelectEntity:Fa,contextGraphId:e,activeTab:W[h],onTabChange:de=>Ne(h,de),swmAttribution:Yt})]})]}),o.jsx(dM,{open:l,onClose:()=>u(!1),contextGraphId:xe.id,contextGraphName:xe.name}),o.jsx(fM,{open:d,onClose:()=>f(!1),contextGraphId:xe.id,contextGraphName:xe.name})]})})})}const YP=[{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 QP(){const e=fn(n=>n.closeTab),t=Ve.useCallback(()=>e(Xg),[e]);return Ve.useEffect(()=>{const n=a=>{a.key==="Escape"&&(a.preventDefault(),t())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),o.jsxs("div",{className:"v10-primer-view",children:[o.jsxs("header",{className:"v10-primer-header",children:[o.jsx("button",{type:"button",className:"v10-primer-back",onClick:t,"aria-label":"Close primer and return to the previous tab",children:"← Back"}),o.jsx("p",{className:"v10-primer-kicker",children:"Context Graph Primer"}),o.jsx("h1",{children:"What is a Context Graph?"}),o.jsx("p",{children:"A Context Graph is a shared knowledge workspace where agents stage, review, organize, and publish structured memory."})]}),o.jsxs("section",{className:"v10-primer-pipeline","aria-label":"Context Graph pipeline",children:[o.jsx("span",{className:"wm",children:"Working Memory"}),o.jsx("span",{className:"connector","aria-hidden":"true"}),o.jsx("span",{className:"swm",children:"Shared Working Memory"}),o.jsx("span",{className:"connector","aria-hidden":"true"}),o.jsx("span",{className:"vm",children:"Verifiable Memory"})]}),o.jsx("div",{className:"v10-primer-sections",children:YP.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 XP={"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 Rw(e){const t=XP[e];return t?t==="markdown"?"text":t:"binary"}async function Ow(e){const t=await fetch(e,{headers:Ft()});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=await t.blob();return URL.createObjectURL(n)}function JP({open:e,onClose:t,assertionName:n,contextGraphId:a,subGraphName:s}){const[l,u]=w.useState(null),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(!0),[b,k]=w.useState(null);w.useEffect(()=>{if(e)return y(!0),k(null),u(null),f(null),g(null),E_(n,a,s).then(async T=>{u(T);const U=Rw(T.detectedContentType),_=Vu(T.fileHash,T.detectedContentType);if(U==="text"){const z=await fetch(_,{headers:Ft()});z.ok&&f(await z.text())}else if(U==="pdf"||U==="image"){const z=await Ow(_);g(z)}}).catch(T=>k(T.message??"Failed to load file info")).finally(()=>y(!1)),()=>{h&&URL.revokeObjectURL(h)}},[e,n,a,s]),w.useEffect(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);const{dialogRef:j,onBackdropClick:N}=Ji(e,t);if(!e)return null;const S=l?Rw(l.detectedContentType):null,A=l?Vu(l.fileHash,l.detectedContentType):null,E=async(T,U)=>{try{const _=await Ow(T),z=document.createElement("a");z.href=_,z.download=U,z.click(),URL.revokeObjectURL(_)}catch{window.open(T,"_blank")}};return o.jsx("div",{className:"v10-modal-overlay",onClick:N,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box v10-file-preview-modal",ref:j,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-file-preview-title",children:[o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-file-preview-title",className:"v10-modal-title",children:n}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close file preview",title:"Close (Esc)",children:"×"})]}),m&&o.jsx("div",{className:"v10-file-preview-loading",children:"Loading file preview..."}),b&&o.jsxs("div",{className:"v10-file-preview-error",children:[o.jsx("p",{children:b}),o.jsx("p",{style:{fontSize:11,marginTop:4},children:"File preview requires the extraction status to still be cached on the node. If the node was restarted, the preview metadata may be unavailable."})]}),l&&!m&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-file-preview-meta",children:[o.jsx("span",{className:"v10-file-preview-meta-item",children:l.detectedContentType}),o.jsxs("span",{className:"v10-file-preview-meta-item",children:[l.tripleCount," triples extracted"]}),o.jsx("span",{className:"v10-file-preview-meta-item",children:l.pipelineUsed}),l.completedAt&&o.jsx("span",{className:"v10-file-preview-meta-item",children:new Date(l.completedAt).toLocaleString()})]}),o.jsxs("div",{className:"v10-file-preview-content",children:[S==="pdf"&&h&&o.jsx("iframe",{src:h,className:"v10-file-preview-iframe",title:`Preview: ${n}`}),S==="image"&&h&&o.jsx("img",{src:h,alt:n,className:"v10-file-preview-image"}),S==="text"&&d!=null&&o.jsx("pre",{className:"v10-file-preview-text",children:d}),S==="binary"&&o.jsxs("div",{className:"v10-file-preview-binary",children:[o.jsx("p",{children:"This file type cannot be previewed directly."}),A&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>E(A,n),children:"Download file"})]})]}),o.jsxs("div",{className:"v10-file-preview-footer",children:[A&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>E(A,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 e5=w.lazy(()=>gt(()=>import("./index-CwRQnNYh.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),t5=w.lazy(()=>gt(()=>import("./index-CwRQnNYh.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.NodePanel}))),n5=w.lazy(()=>gt(()=>import("./OnChainProvenanceCard-Dn_IEP7Q.js"),__vite__mapDeps([2,0,1])).then(e=>({default:e.OnChainProvenanceCard}))),r5={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."}},a5={labelMode:"humanized",renderer:"2d",labels:Id({extraPredicates:["http://schema.org/text"]}),style:{classColors:{"http://schema.org/Person":"#f472b6","http://schema.org/Organization":"#fb923c","http://schema.org/Place":"#34d399","http://schema.org/Product":"#c084fc","http://schema.org/Event":"#facc15","http://schema.org/CreativeWork":"#7dd3fc","http://schema.org/Thing":"#94a3b8"},defaultNodeColor:"#94a3b8",defaultEdgeColor:"#5f8598",edgeWidth:.9},hexagon:{baseSize:4,minSize:3,maxSize:6,scaleWithDegree:!0},focus:{maxNodes:3e3,hops:999}},i5=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"})]}),s5=o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"6",cy:"6",r:"3"}),o.jsx("circle",{cx:"18",cy:"6",r:"3"}),o.jsx("circle",{cx:"6",cy:"18",r:"3"}),o.jsx("circle",{cx:"18",cy:"18",r:"3"}),o.jsx("line",{x1:"8.5",y1:"7.5",x2:"15.5",y2:"16.5"}),o.jsx("line",{x1:"15.5",y1:"7.5",x2:"8.5",y2:"16.5"})]});function Zh({layer:e,contextGraphId:t,externalQuery:n,externalQueryKey:a,queryPresetOptions:s}){var Ie,We;const l=r5[e],[u,d]=w.useState("graph"),[f,h]=w.useState(""),[g,m]=w.useState(""),[y,b]=w.useState(""),[k,j]=w.useState(""),[N,S]=w.useState("any"),[A,E]=w.useState(50),[T,U]=w.useState(""),[_,z]=w.useState("any"),[q,D]=w.useState(50),[R,$]=w.useState(e!=="vm"),F=Ve.useRef(e);Ve.useEffect(()=>{F.current!==e&&(F.current=e,h(""),$(e!=="vm"),m(""),b(""),j(""),S("any"),E(50),U(""),z("any"),D(50))},[e]),Ve.useEffect(()=>{n!==void 0&&(h(""),m(n),b(n))},[n,a]);const K=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"?c5({query:T,field:_,limit:q}):"SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 500",[t,e,_,q,T]),I=y||K,H=e==="swm"?"_shared_memory":void 0,B=e==="swm",W=e==="vm"?"verifiable-memory":void 0,Q=e==="wm"&&I===K,{data:V,loading:L,error:P,refresh:G}=lr(()=>or(I,t,B,H,W,Q),[I,t,B,H,W,Q],0);xo(t,G,{layers:[e]});const{data:O}=lr(jg,[],3e4),ne=O==null?void 0:O.blockExplorerUrl,ue=w.useCallback(()=>{const Se=g.trim();if(Se===y){G();return}b(Se)},[y,g,G]),le=w.useCallback(()=>{const Se=k!==T||N!==_||A!==q;if(Se&&(U(k),z(N),D(A)),y){b("");return}Se||G()},[y,_,q,T,N,A,k,G]),be=((Ie=V==null?void 0:V.result)==null?void 0:Ie.bindings)??((We=V==null?void 0:V.results)==null?void 0:We.bindings)??[],_e=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(o5,{contextGraphId:t,onPromoted:G}),e==="swm"&&o.jsx(l5,{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:()=>$(Se=>!Se),children:R?"Hide SPARQL":"Advanced SPARQL"})]}),o.jsxs("div",{className:"v10-vm-search-controls",children:[o.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Search verifiable memory...",value:k,onChange:Se=>j(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&le()}}),o.jsxs("select",{className:"v10-vm-search-select",value:N,onChange:Se=>S(Se.target.value),children:[o.jsx("option",{value:"any",children:"Any field"}),o.jsx("option",{value:"subject",children:"Subject"}),o.jsx("option",{value:"predicate",children:"Predicate"}),o.jsx("option",{value:"object",children:"Object"})]}),o.jsxs("select",{className:"v10-vm-search-select",value:String(A),onChange:Se=>E(Number.parseInt(Se.target.value,10)||50),children:[o.jsx("option",{value:"25",children:"25 rows"}),o.jsx("option",{value:"50",children:"50 rows"}),o.jsx("option",{value:"100",children:"100 rows"}),o.jsx("option",{value:"200",children:"200 rows"})]}),o.jsx("button",{className:"v10-mlv-run-btn",onClick:le,children:"Search"})]})]}),(e!=="vm"||R)&&o.jsxs("div",{className:"v10-mlv-query-bar",children:[s!=null&&s.length?o.jsxs("select",{className:"v10-vm-search-select",value:f,onChange:Se=>{const ft=Se.target.value;h(ft);const De=s.find(ke=>ke.label===ft),qe=(De==null?void 0:De.query)??"";m(qe),b(qe)},children:[o.jsx("option",{value:"",children:"Select common query..."}),s.map(Se=>o.jsx("option",{value:Se.label,children:Se.label},Se.label))]}):o.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Custom SPARQL query...",value:g,onChange:Se=>m(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&ue()}}),o.jsx("button",{className:"v10-mlv-run-btn",onClick:ue,children:"Run"}),y&&o.jsx("button",{className:"v10-mlv-clear-btn",onClick:()=>b(""),title:"Reset to full layer overview",children:"Reset"}),o.jsxs("div",{className:"v10-mlv-view-toggle",children:[o.jsx("button",{className:`v10-mlv-toggle-btn ${u==="table"?"active":""}`,onClick:()=>d("table"),title:"Table view",children:i5}),o.jsx("button",{className:`v10-mlv-toggle-btn ${u==="graph"?"active":""}`,onClick:()=>d("graph"),title:"Graph view",children:s5})]})]}),L&&o.jsx("p",{className:"v10-mlv-status",children:"Loading..."}),P&&o.jsxs("p",{className:"v10-mlv-status",style:{color:"var(--accent-red)"},children:["Error: ",P]}),!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&&_e.length>0&&u==="graph"&&o.jsxs("div",{className:"v10-mlv-graph-container",children:[o.jsxs("div",{className:"v10-mlv-graph-info",children:[o.jsxs("span",{children:[_e.length," triples"]}),y&&o.jsx("span",{className:"v10-mlv-graph-info-custom",children:"filtered"})]}),o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"v10-mlv-graph-loading",children:"Loading graph renderer..."}),children:o.jsxs(e5,{data:_e,format:"triples",options:a5,style:{width:"100%",height:"100%"},onNodeClick:Ee,initialFit:!0,children:[o.jsx(t5,{className:"v10-mlv-node-panel",showUri:!0,showTypes:!0,showProperties:!0,showMetadata:!1,maxValueLength:150}),o.jsx(n5,{contextGraphId:t,layer:e,explorerUrl:ne})]})})]})]})}function o5({contextGraphId:e,onPromoted:t}){const{data:n,loading:a,refresh:s}=lr(()=>Ql(e,"wm"),[e],0);xo(e,s,{layers:["wm"]});const[l,u]=w.useState(null),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(null),b=w.useCallback(async j=>{u(j.graphUri),f(null),g(null);try{const N=await lo(e,j.name,j.subGraph?{subGraphName:j.subGraph}:{}),S=_g(j.name,N);f({message:S.message+(j.subGraph?` (in ${j.subGraph})`:""),kind:S.kind==="success"?"success":"noop",subGraph:j.subGraph}),s(),t()}catch(N){const S=co(j.name,N);g(S?{message:S.message,kind:"not-persisted"}:{message:(N==null?void 0:N.message)??"Promote failed",kind:"other"})}finally{u(null)}},[e,s,t]),k=w.useCallback(async()=>{if(!(n!=null&&n.length))return;u("__all__"),f(null),g(null);let j=0,N=null;try{for(const E of n)N=E.name,(await lo(e,E.name,E.subGraph?{subGraphName:E.subGraph}:{})).promotedCount===0&&(j+=1);const S=n.length-j,A=j>0?` (${j} already shared or still committing)`:"";f({message:S>0?`Shared ${S} complete Knowledge Asset${S===1?"":"s"} to Shared Working Memory${A}.`:"No Knowledge Assets were newly shared — all were already in Shared Working Memory or still committing.",kind:S>0?"success":"noop"}),s(),t()}catch(S){const A=co(N??"selected assertion",S);g(A?{message:A.message,kind:"not-persisted"}:{message:(S==null?void 0:S.message)??"Promote failed",kind:"other"})}finally{u(null)}},[n,e,s,t]);return a?o.jsx("div",{className:"v10-assertion-list-loading",children:"Loading assertions..."}):n!=null&&n.length?o.jsxs("div",{className:"v10-assertion-list",children:[o.jsxs("div",{className:"v10-assertion-list-header",children:[o.jsxs("span",{className:"v10-assertion-list-title",children:["Assertions in Working Memory (",n.length,")"]}),o.jsx("button",{className:"v10-btn-promote-all",disabled:l!==null,onClick:k,children:l==="__all__"?"Sharing...":"Share Complete KAs → SWM"})]}),o.jsx("div",{className:"v10-assertion-items",children:n.map(j=>o.jsxs("div",{className:"v10-assertion-item",children:[o.jsxs("div",{className:"v10-assertion-item-info",children:[o.jsx("button",{className:"v10-assertion-item-name clickable",title:j.graphUri,onClick:()=>y({name:j.name,subGraph:j.subGraph}),children:j.name}),j.tripleCount!=null&&o.jsxs("span",{className:"v10-assertion-item-count",children:[j.tripleCount," triples"]}),j.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${j.subGraph}`,children:["› ",nv(j.subGraph,18)]})]}),o.jsx("button",{className:"v10-btn-promote",disabled:l!==null,onClick:()=>b(j),title:"Share this complete Knowledge Asset to Shared Working Memory",children:l===j.graphUri?"Promoting...":"→ SWM"})]},j.graphUri))}),d&&o.jsx("div",{className:d.kind==="success"?"v10-promote-result success":"v10-promote-result info",children:d.message}),h&&o.jsx("div",{className:"v10-promote-result error",children:h.message}),m&&o.jsx(JP,{open:!0,onClose:()=>y(null),assertionName:m.name,subGraphName:m.subGraph,contextGraphId:e})]}):null}function l5({contextGraphId:e,onPublished:t}){const{data:n,loading:a,refresh:s}=lr(()=>Ql(e,"swm"),[e],0);xo(e,s,{layers:["swm"]});const[l,u]=w.useState(new Set),[d,f]=w.useState(!1),[h,g]=w.useState(null),[m,y]=w.useState(null),b=(n==null?void 0:n.map(z=>z.graphUri))??[],k=b.length>0&&b.every(z=>l.has(z)),j=w.useCallback(z=>{u(q=>{const D=new Set(q);return D.has(z)?D.delete(z):D.add(z),D})},[]),N=w.useCallback(()=>{u(k?new Set:new Set(b))},[k,b]),S=w.useCallback(async z=>{if(z.length!==0){f(!0),g(null),y(null);try{g(await Tg(e,z)),u(new Set),s(),t()}catch(q){y((q==null?void 0:q.message)??"Publish failed")}finally{f(!1)}}},[e,s,t]),A=w.useCallback(()=>{const z=(n??[]).filter(q=>l.has(q.graphUri));return S(z)},[n,l,S]),E=w.useCallback(()=>S(n??[]),[n,S]),T=(n==null?void 0:n.reduce((z,q)=>z+(q.tripleCount??0),0))??0,U=(n==null?void 0:n.filter(z=>l.has(z.graphUri)).reduce((z,q)=>z+(q.tripleCount??0),0))??0,_=!a&&(!n||n.length===0);return a?o.jsx("div",{className:"v10-assertion-list-loading",children:"Loading SWM contents..."}):_?o.jsxs("div",{className:"v10-publish-panel",children:[o.jsx("div",{className:"v10-publish-panel-header",children:o.jsx("span",{className:"v10-publish-panel-title",children:"Publish to Verifiable Memory"})}),o.jsx("div",{className:"v10-publish-panel-empty",children:"No data in Shared Working Memory yet. Promote assertions from Working Memory first."})]}):o.jsxs("div",{className:"v10-publish-panel",children:[o.jsxs("div",{className:"v10-publish-panel-header",children:[o.jsxs("span",{className:"v10-publish-panel-title",children:["Knowledge assets in Shared Working Memory (",n.length," asset",n.length===1?"":"s"," · ",T," triples)"]}),o.jsxs("div",{className:"v10-publish-panel-header-actions",children:[o.jsx("button",{className:"v10-publish-panel-refresh",onClick:s,title:"Refresh",children:"↻"}),o.jsx("button",{className:"v10-btn-promote-all",disabled:d,onClick:E,children:d&&l.size===0?"Publishing...":"Publish All → VM"})]})]}),o.jsxs("div",{className:"v10-publish-select-bar",children:[o.jsxs("label",{className:"v10-publish-select-all",children:[o.jsx("input",{type:"checkbox",checked:k,onChange:N}),o.jsx("span",{children:"Select all"})]}),l.size>0&&o.jsx("button",{className:"v10-btn-publish",disabled:d,onClick:A,children:d?"Publishing...":`Publish ${l.size} selected (${U} triples) → VM`})]}),o.jsx("div",{className:"v10-assertion-items",children:n.map(z=>o.jsxs("div",{className:`v10-assertion-item ${l.has(z.graphUri)?"selected":""}`,children:[o.jsx("label",{className:"v10-publish-entity-check",children:o.jsx("input",{type:"checkbox",checked:l.has(z.graphUri),onChange:()=>j(z.graphUri)})}),o.jsxs("div",{className:"v10-assertion-item-info",children:[o.jsx("span",{className:"v10-assertion-item-name",title:z.graphUri,children:z.name}),z.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${z.subGraph}`,children:["› ",nv(z.subGraph,18)]}),z.tripleCount!=null&&o.jsxs("span",{className:"v10-assertion-item-count",children:[z.tripleCount," triples"]})]})]},z.graphUri))}),h&&(()=>{const{published:z,total:q,partial:D,partialError:R,failures:$,sample:F,convictionCostCovered:K}=h,I=z===q&&z>0&&D===0,H=(F==null?void 0:F.status)==="confirmed"&&!!F.txHash;return o.jsxs("div",{className:`v10-publish-result-card ${I?"success":"error"}`,children:[o.jsx("div",{className:"v10-publish-result-title",children:z>0?`Published ${z} of ${q} knowledge asset${q===1?"":"s"} to Verifiable Memory`:"NOT published to Verifiable Memory"}),D>0&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:["⚠ ",D," asset",D===1?"":"s",": ",Il(R)]}),$.length>0&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:[$.length," asset",$.length===1?"":"s"," could not be published — ",$[0].name,": ",$[0].error,$.length>1?` (+${$.length-1} more)`:""]}),o.jsxs("div",{className:"v10-publish-result-details",children:[(F==null?void 0:F.kaId)!=null&&o.jsxs("div",{children:[o.jsx("span",{className:"v10-publish-result-label",children:"Knowledge Asset:"})," ",F.kaId]}),H?o.jsxs("div",{className:"v10-publish-result-tx",children:[o.jsx("span",{className:"v10-publish-result-label",children:"Tx hash:"})," ",o.jsx("span",{className:"mono",title:F.txHash,children:F.txHash}),F.blockNumber!=null&&o.jsxs("span",{className:"v10-publish-result-block",children:[" (block ",F.blockNumber,")"]})]}):o.jsxs("div",{className:"v10-publish-result-details",children:["Verifiable Memory requires a confirmed ",o.jsx("code",{children:"KCCreated"})," event. If a publish did not land on-chain, check the node logs (typically a missing publisher wallet, an unfunded signer, or a chain adapter that isn't V10-ready)."]}),o.jsx(WS,{convictionCostCovered:K})]})]})})(),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("/"),a=Math.max(t,n);return a>=0?e.slice(a+1):e}function c5(e){const t=Number.isFinite(e.limit)&&e.limit>0?Math.floor(e.limit):50,n=e.query.trim();if(!n)return`SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT ${t}`;const a=u5(n.toLowerCase()),s={subject:`CONTAINS(LCASE(STR(?s)), "${a}")`,predicate:`CONTAINS(LCASE(STR(?p)), "${a}")`,object:`CONTAINS(LCASE(STR(?o)), "${a}")`};return`SELECT ?s ?p ?o WHERE { ?s ?p ?o . FILTER(${e.field==="any"?`(${s.subject} || ${s.predicate} || ${s.object})`:s[e.field]}) } LIMIT ${t}`}function u5(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"}],d5=["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 p5(){const{contextGraphs:e}=Tr(),{hidden:t}=Fg(),n=w.useMemo(()=>e.filter(a=>!t.has(a.id)),[e,t]);return o.jsxs("div",{className:"v10-memstack",children:[o.jsxs("div",{className:"v10-memstack-head",children:[o.jsx("h1",{className:"v10-memstack-title",children:"Memory Stack"}),o.jsxs("p",{className:"v10-memstack-sub",children:["Every layer across every context graph, at a glance. ",n.length," visible context graph",n.length===1?"":"s"," · hidden context graphs are skipped."]})]}),n.length===0?o.jsx("div",{className:"v10-memstack-empty",children:"No visible context graphs. Create one from the sidebar or un-hide dismissed ones."}):o.jsxs("div",{className:"v10-memstack-table",children:[o.jsxs("div",{className:"v10-memstack-colheads",children:[o.jsx("div",{className:"v10-memstack-colhead project"}),kC.map(a=>o.jsxs("div",{className:"v10-memstack-colhead",style:{color:a.color},children:[o.jsx("span",{className:"v10-memstack-colhead-icon",children:a.icon}),o.jsx("span",{className:"v10-memstack-colhead-title",children:a.title}),o.jsx("span",{className:"v10-memstack-colhead-desc",children:a.desc})]},a.key))]}),n.map(a=>o.jsx(f5,{cg:a},a.id))]})]})}function f5({cg:e}){const t=Gg(e.id),{openTab:n}=fn(),a=gj(t),s=w.useMemo(()=>{const u={working:{entities:[],tripleCount:a.wm},shared:{entities:[],tripleCount:a.swm},verified:{entities:[],tripleCount:a.vm}};for(const d of t.entityList)u[d.trustLevel].entities.push(d);for(const d of Object.keys(u))u[d].entities.sort((f,h)=>{const g=Gm(f),m=Gm(h);return g&&m?m-g:g?-1:m?1:f.label.localeCompare(h.label)});return u},[t.entityList,a]),l=()=>n({id:`project:${e.id}`,label:e.name||e.id.slice(0,16),closable:!0});return o.jsxs("div",{className:"v10-memstack-row",children:[o.jsxs("div",{className:"v10-memstack-project",children:[o.jsxs("button",{type:"button",className:"v10-memstack-project-btn",onClick:l,children:[o.jsx("span",{className:"v10-memstack-project-dot"}),o.jsx("span",{className:"v10-memstack-project-name",children:e.name||e.id})]}),e.description&&o.jsx("div",{className:"v10-memstack-project-desc",title:e.description,children:e.description}),t.loading&&!t.entityList.length&&o.jsx("div",{className:"v10-memstack-project-status",children:"loading…"}),t.error&&o.jsx("div",{className:"v10-memstack-project-status error",children:t.error})]}),kC.map(u=>{const d=s[u.key];return o.jsx(h5,{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 h5({cgId:e,color:t,layerTitle:n,tabPrefix:a,entityCount:s,tripleCount:l,recent:u,onOpenLayer:d}){const f=s===0;return o.jsxs("div",{className:`v10-memstack-cell${f?" empty":""}`,style:{"--cell-color":t},children:[o.jsxs("div",{className:"v10-memstack-cell-stats",children:[o.jsx("span",{className:"v10-memstack-cell-n",children:s}),o.jsxs("span",{className:"v10-memstack-cell-n-lbl",children:["entit",s===1?"y":"ies"]}),o.jsx("span",{className:"v10-memstack-cell-sep",children:"·"}),o.jsx("span",{className:"v10-memstack-cell-t",children:l.toLocaleString()}),o.jsx("span",{className:"v10-memstack-cell-t-lbl",children:"triples"})]}),u.length>0?o.jsx("ul",{className:"v10-memstack-cell-recent",children:u.map(h=>o.jsxs("li",{className:"v10-memstack-cell-recent-item",title:h.label,children:[o.jsx("span",{className:"v10-memstack-cell-recent-bullet"}),o.jsx("span",{className:"v10-memstack-cell-recent-label",children:h.label}),o.jsx("span",{className:"v10-memstack-cell-recent-time",children:kj(m5(h))})]},h.uri))}):o.jsxs("div",{className:"v10-memstack-cell-empty-hint",children:["Nothing in ",a.toUpperCase()," yet"]}),!f&&o.jsxs("button",{type:"button",className:"v10-memstack-cell-open",onClick:d,title:`Open ${n}`,children:["Open ",a.toUpperCase()," →"]})]})}function Gm(e){var t;for(const n of d5){const a=(t=e.properties.get(n))==null?void 0:t[0];if(!a)continue;const s=new Date(a.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"));if(Number.isFinite(s.getTime()))return s.getTime()}return null}function m5(e){const t=Gm(e);return t?new Date(t):null}function g5(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const v5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,y5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,b5={};function Lw(e,t){return(b5.jsx?y5:v5).test(e)}const x5=/[ \t\n\f\r]/g;function w5(e){return typeof e=="object"?e.type==="text"?Mw(e.value):!1:Mw(e)}function Mw(e){return e.replace(x5,"")===""}class nc{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}nc.prototype.normal={};nc.prototype.property={};nc.prototype.space=void 0;function SC(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new nc(n,a,t)}function Vm(e){return e.toLowerCase()}class Zn{constructor(t,n){this.attribute=n,this.property=t}}Zn.prototype.attribute="";Zn.prototype.booleanish=!1;Zn.prototype.boolean=!1;Zn.prototype.commaOrSpaceSeparated=!1;Zn.prototype.commaSeparated=!1;Zn.prototype.defined=!1;Zn.prototype.mustUseProperty=!1;Zn.prototype.number=!1;Zn.prototype.overloadedBoolean=!1;Zn.prototype.property="";Zn.prototype.spaceSeparated=!1;Zn.prototype.space=void 0;let k5=0;const Xe=ds(),on=ds(),Wm=ds(),we=ds(),Rt=ds(),oo=ds(),sr=ds();function ds(){return 2**++k5}const Zm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:on,commaOrSpaceSeparated:sr,commaSeparated:oo,number:we,overloadedBoolean:Wm,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),Yh=Object.keys(Zm);class mv extends Zn{constructor(t,n,a,s){let l=-1;if(super(t,n),Dw(this,"space",s),typeof a=="number")for(;++l<Yh.length;){const u=Yh[l];Dw(this,Yh[l],(a&Zm[u])===Zm[u])}}}mv.prototype.defined=!0;function Dw(e,t,n){n&&(e[t]=n)}function ko(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const l=new mv(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(l.mustUseProperty=!0),t[a]=l,n[Vm(a)]=a,n[Vm(l.attribute)]=a}return new nc(t,n,e.space)}const jC=ko({properties:{ariaActiveDescendant:null,ariaAtomic:on,ariaAutoComplete:null,ariaBusy:on,ariaChecked:on,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:on,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:on,ariaFlowTo:Rt,ariaGrabbed:on,ariaHasPopup:null,ariaHidden:on,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:we,ariaLive:null,ariaModal:on,ariaMultiLine:on,ariaMultiSelectable:on,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:on,ariaReadOnly:on,ariaRelevant:null,ariaRequired:on,ariaRoleDescription:Rt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:on,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function CC(e,t){return t in e?e[t]:t}function NC(e,t){return CC(e,t.toLowerCase())}const S5=ko({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:oo,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:Xe,allowPaymentRequest:Xe,allowUserMedia:Xe,alt:null,as:null,async:Xe,autoCapitalize:null,autoComplete:Rt,autoFocus:Xe,autoPlay:Xe,blocking:Rt,capture:null,charSet:null,checked:Xe,cite:null,className:Rt,cols:we,colSpan:null,content:null,contentEditable:on,controls:Xe,controlsList:Rt,coords:we|oo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:Wm,draggable:on,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:Rt,height:we,hidden:Wm,high:we,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:Xe,inputMode:null,integrity:null,is:null,isMap:Xe,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:Xe,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xe,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Xe,muted:Xe,name:null,nonce:null,noModule:Xe,noValidate:Xe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Xe,optimum:we,pattern:null,ping:Rt,placeholder:null,playsInline:Xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xe,referrerPolicy:null,rel:Rt,required:Xe,reversed:Xe,rows:we,rowSpan:we,sandbox:Rt,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:on,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:on,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xe,declare:Xe,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:on,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Xe,disableRemotePlayback:Xe,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:NC}),j5=ko({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:sr,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:Rt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:oo,g2:oo,glyphName:oo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:sr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:we,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sr,rev:sr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sr,requiredFeatures:sr,requiredFonts:sr,requiredFormats:sr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:sr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sr,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform: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()}}),AC=ko({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:NC}),TC=ko({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),C5={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"},N5=/[A-Z]/g,zw=/-[a-z]/g,E5=/^data[-\w.:]+$/i;function A5(e,t){const n=Vm(t);let a=t,s=Zn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&E5.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(zw,_5);a="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!zw.test(l)){let u=l.replace(N5,T5);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}s=mv}return new s(a,t)}function T5(e){return"-"+e.toLowerCase()}function _5(e){return e.charAt(1).toUpperCase()}const R5=SC([jC,S5,EC,AC,TC],"html"),gv=SC([jC,j5,EC,AC,TC],"svg");function O5(e){return e.join(" ").trim()}var Qs={},Qh,$w;function L5(){if($w)return Qh;$w=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
1625
- `,h="/",g="*",m="",y="comment",b="declaration";function k(N,S){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];S=S||{};var A=1,E=1;function T(I){var H=I.match(t);H&&(A+=H.length);var B=I.lastIndexOf(f);E=~B?I.length-B:E+I.length}function U(){var I={line:A,column:E};return function(H){return H.position=new _(I),D(),H}}function _(I){this.start=I,this.end={line:A,column:E},this.source=S.source}_.prototype.content=N;function z(I){var H=new Error(S.source+":"+A+":"+E+": "+I);if(H.reason=I,H.filename=S.source,H.line=A,H.column=E,H.source=N,!S.silent)throw H}function q(I){var H=I.exec(N);if(H){var B=H[0];return T(B),N=N.slice(B.length),H}}function D(){q(n)}function R(I){var H;for(I=I||[];H=$();)H!==!1&&I.push(H);return I}function $(){var I=U();if(!(h!=N.charAt(0)||g!=N.charAt(1))){for(var H=2;m!=N.charAt(H)&&(g!=N.charAt(H)||h!=N.charAt(H+1));)++H;if(H+=2,m===N.charAt(H-1))return z("End of comment missing");var B=N.slice(2,H-2);return E+=2,T(B),N=N.slice(H),E+=2,I({type:y,comment:B})}}function F(){var I=U(),H=q(a);if(H){if($(),!q(s))return z("property missing ':'");var B=q(l),W=I({type:b,property:j(H[0].replace(e,m)),value:B?j(B[0].replace(e,m)):m});return q(u),W}}function K(){var I=[];R(I);for(var H;H=F();)H!==!1&&(I.push(H),R(I));return I}return D(),K()}function j(N){return N?N.replace(d,m):m}return Qh=k,Qh}var Iw;function M5(){if(Iw)return Qs;Iw=1;var e=Qs&&Qs.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.default=n;const t=e(L5());function n(a,s){let l=null;if(!a||typeof a!="string")return l;const u=(0,t.default)(a),d=typeof s=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:h,value:g}=f;d?s(h,g,f):g&&(l=l||{},l[h]=g)}),l}return Qs}var wl={},Pw;function D5(){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=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,l=function(h){return!h||n.test(h)||e.test(h)},u=function(h,g){return g.toUpperCase()},d=function(h,g){return"".concat(g,"-")},f=function(h,g){return g===void 0&&(g={}),l(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(s,d):h=h.replace(a,d),h.replace(t,u))};return wl.camelCase=f,wl}var kl,Uw;function z5(){if(Uw)return kl;Uw=1;var e=kl&&kl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(M5()),n=D5();function a(s,l){var u={};return!s||typeof s!="string"||(0,t.default)(s,function(d,f){d&&f&&(u[(0,n.camelCase)(d,l)]=f)}),u}return a.default=a,kl=a,kl}var $5=z5();const I5=Wl($5),_C=RC("end"),vv=RC("start");function RC(e){return t;function t(n){const a=n&&n.position&&n.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function P5(e){const t=vv(e),n=_C(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 _n extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",l={},u=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?s=t:!l.cause&&t&&(u=!0,s=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof a=="string"){const f=a.indexOf(":");f===-1?l.ruleId=a:(l.source=a.slice(0,f),l.ruleId=a.slice(f+1))}if(!l.place&&l.ancestors&&l.ancestors){const f=l.ancestors[l.ancestors.length-1];f&&(l.place=f.position)}const d=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=d?d.line:void 0,this.name=Ml(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=u&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}_n.prototype.file="";_n.prototype.name="";_n.prototype.reason="";_n.prototype.message="";_n.prototype.stack="";_n.prototype.column=void 0;_n.prototype.line=void 0;_n.prototype.ancestors=void 0;_n.prototype.cause=void 0;_n.prototype.fatal=void 0;_n.prototype.place=void 0;_n.prototype.ruleId=void 0;_n.prototype.source=void 0;const yv={}.hasOwnProperty,U5=new Map,B5=/[A-Z]/g,F5=new Set(["table","tbody","thead","tfoot","tr"]),H5=new Set(["td","th"]),OC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function q5(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=X5(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=Q5(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?gv:R5,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 G5(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return V5(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Z5(e,t,n);if(t.type==="mdxjsEsm")return W5(e,t);if(t.type==="root")return K5(e,t,n);if(t.type==="text")return Y5(e,t)}function G5(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=gv,e.schema=s),e.ancestors.push(t);const l=DC(e,t.tagName,!1),u=J5(e,t);let d=xv(e,t);return F5.has(t.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!w5(f):!0})),MC(e,u,l,t),bv(u,d),e.ancestors.pop(),e.schema=a,e.create(t,l,u,n)}function V5(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}ql(e,t.position)}function W5(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ql(e,t.position)}function Z5(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=gv,e.schema=s),e.ancestors.push(t);const l=t.name===null?e.Fragment:DC(e,t.name,!0),u=eU(e,t),d=xv(e,t);return MC(e,u,l,t),bv(u,d),e.ancestors.pop(),e.schema=a,e.create(t,l,u,n)}function K5(e,t,n){const a={};return bv(a,xv(e,t)),e.create(t,e.Fragment,a,n)}function Y5(e,t){return t.value}function MC(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function bv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Q5(e,t,n){return a;function a(s,l,u,d){const h=Array.isArray(u.children)?n:t;return d?h(l,u,d):h(l,u)}}function X5(e,t){return n;function n(a,s,l,u){const d=Array.isArray(l.children),f=vv(a);return t(s,l,u,d,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function J5(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&yv.call(t.properties,s)){const l=tU(e,s,t.properties[s]);if(l){const[u,d]=l;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&H5.has(t.tagName)?a=d:n[u]=d}}if(a){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function eU(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const l=a.data.estree.body[0];l.type;const u=l.expression;u.type;const d=u.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else ql(e,t.position);else{const s=a.name;let l;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const d=a.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else ql(e,t.position);else l=a.value===null?!0:a.value;n[s]=l}return n}function xv(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:U5;for(;++a<t.children.length;){const l=t.children[a];let u;if(e.passKeys){const f=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(f){const h=s.get(f)||0;u=f+"-"+h,s.set(f,h+1)}}const d=LC(e,l,u);d!==void 0&&n.push(d)}return n}function tU(e,t,n){const a=A5(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?g5(n):O5(n)),a.property==="style"){let s=typeof n=="object"?n:nU(e,String(n));return e.stylePropertyNameCase==="css"&&(s=rU(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?C5[a.property]||a.property:a.attribute,n]}}function nU(e,t){try{return I5(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new _n("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=OC+"#cannot-parse-style-attribute",s}}function DC(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let l=-1,u;for(;++l<s.length;){const d=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}a=u}else a=Lw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return yv.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);ql(e)}function ql(e,t){const n=new _n("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=OC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function rU(e){const t={};let n;for(n in e)yv.call(e,n)&&(t[aU(n)]=e[n]);return t}function aU(e){let t=e.replace(B5,iU);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function iU(e){return"-"+e.toLowerCase()}const Xh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},sU={};function wv(e,t){const n=sU,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return zC(e,a,s)}function zC(e,t,n){if(oU(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 a=[];let s=-1;for(;++s<e.length;)a[s]=zC(e[s],t,n);return a.join("")}function oU(e){return!!(e&&typeof e=="object")}const qw=document.createElement("i");function kv(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 cr(e,t,n,a){const s=e.length;let l=0,u;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,a.length<1e4)u=Array.from(a),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);l<a.length;)u=a.slice(l,l+1e4),u.unshift(t,0),e.splice(...u),l+=1e4,t+=1e4}function Ar(e,t){return e.length>0?(cr(e,e.length,0,t),e):t}const Gw={}.hasOwnProperty;function $C(e){const t={};let n=-1;for(;++n<e.length;)lU(t,e[n]);return t}function lU(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];cU(s[u],Array.isArray(d)?d:d?[d]:[])}}}function cU(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);cr(e,0,0,a)}function 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 Ur(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Dn=ji(/[A-Za-z]/),An=ji(/[\dA-Za-z]/),uU=ji(/[#-'*+\--9=?A-Z^-~]/);function wd(e){return e!==null&&(e<32||e===127)}const Ym=ji(/\d/),dU=ji(/[\dA-Fa-f]/),pU=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 Wd=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,a=0,s=0;for(;++n<e.length;){const l=e.charCodeAt(n);let u="";if(l===37&&An(e.charCodeAt(n+1))&&An(e.charCodeAt(n+2)))s=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(u=String.fromCharCode(l));else if(l>55295&&l<57344){const d=e.charCodeAt(n+1);l<56320&&d>56319&&d<57344?(u=String.fromCharCode(l,d),s=1):u="�"}else u=String.fromCharCode(l);u&&(t.push(e.slice(a,n),encodeURIComponent(u)),a=n+s+1,u=""),s&&(n+=s,s=0)}return t.join("")+e.slice(a)}function dt(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let l=0;return u;function u(f){return it(f)?(e.enter(n),d(f)):t(f)}function d(f){return it(f)&&l++<s?(e.consume(f),d):(e.exit(n),t(f))}}const fU={tokenize:hU};function hU(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let n;return t;function a(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),dt(e,t,"linePrefix")}function s(d){return e.enter("paragraph"),l(d)}function l(d){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,u(d)}function u(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Pe(d)?(e.consume(d),e.exit("chunkText"),l):(e.consume(d),u)}}const mU={tokenize:gU},Vw={tokenize:vU};function gU(e){const t=this,n=[];let a=0,s,l,u;return d;function d(E){if(a<n.length){const T=n[a];return t.containerState=T[1],e.attempt(T[0].continuation,f,h)(E)}return h(E)}function f(E){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&A();const T=t.events.length;let U=T,_;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){_=t.events[U][1].end;break}S(a);let z=T;for(;z<t.events.length;)t.events[z][1].end={..._},z++;return cr(t.events,U+1,0,t.events.slice(T)),t.events.length=z,h(E)}return d(E)}function h(E){if(a===n.length){if(!s)return y(E);if(s.currentConstruct&&s.currentConstruct.concrete)return k(E);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Vw,g,m)(E)}function g(E){return s&&A(),S(a),y(E)}function m(E){return t.parser.lazy[t.now().line]=a!==n.length,u=t.now().offset,k(E)}function y(E){return t.containerState={},e.attempt(Vw,b,k)(E)}function b(E){return a++,n.push([t.currentConstruct,t.containerState]),y(E)}function k(E){if(E===null){s&&A(),S(0),e.consume(E);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:l}),j(E)}function j(E){if(E===null){N(e.exit("chunkFlow"),!0),S(0),e.consume(E);return}return Pe(E)?(e.consume(E),N(e.exit("chunkFlow")),a=0,t.interrupt=void 0,d):(e.consume(E),j)}function N(E,T){const U=t.sliceStream(E);if(T&&U.push(null),E.previous=l,l&&(l.next=E),l=E,s.defineSkip(E.start),s.write(U),t.parser.lazy[E.start.line]){let _=s.events.length;for(;_--;)if(s.events[_][1].start.offset<u&&(!s.events[_][1].end||s.events[_][1].end.offset>u))return;const z=t.events.length;let q=z,D,R;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if(D){R=t.events[q][1].end;break}D=!0}for(S(a),_=z;_<t.events.length;)t.events[_][1].end={...R},_++;cr(t.events,q+1,0,t.events.slice(z)),t.events.length=_}}function S(E){let T=n.length;for(;T-- >E;){const U=n[T];t.containerState=U[1],U[0].exit.call(t,e)}n.length=E}function A(){s.write([null]),l=void 0,s=void 0,t.containerState._closeFlow=void 0}}function vU(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(Wd(e))return 2}function Zd(e,t,n){const a=[];let s=-1;for(;++s<e.length;){const l=e[s].resolveAll;l&&!a.includes(l)&&(t=l(t,n),a.push(l))}return t}const Qm={name:"attention",resolveAll:yU,tokenize:bU};function yU(e,t){let n=-1,a,s,l,u,d,f,h,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[a][1].end},y={...e[n][1].start};Ww(m,-f),Ww(y,f),u={type:f>1?"strongSequence":"emphasisSequence",start:m,end:{...e[a][1].end}},d={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},l={type:f>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},s={type:f>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[a][1].end={...u.start},e[n][1].start={...d.end},h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=Ar(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=Ar(h,[["enter",s,t],["enter",u,t],["exit",u,t],["enter",l,t]]),h=Ar(h,Zd(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=Ar(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=Ar(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,cr(e,a-1,n-a+3,h),n=a+h.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function bU(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=ho(a);let l;return u;function u(f){return l=f,e.enter("attentionSequence"),d(f)}function d(f){if(f===l)return e.consume(f),d;const h=e.exit("attentionSequence"),g=ho(f),m=!g||g===2&&s||n.includes(f),y=!s||s===2&&g||n.includes(a);return h._open=!!(l===42?m:m&&(s||!y)),h._close=!!(l===42?y:y&&(g||!m)),t(f)}}function Ww(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const xU={name:"autolink",tokenize:wU};function wU(e,t,n){let a=0;return s;function s(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(b){return Dn(b)?(e.consume(b),u):b===64?n(b):h(b)}function u(b){return b===43||b===45||b===46||An(b)?(a=1,d(b)):h(b)}function d(b){return b===58?(e.consume(b),a=0,f):(b===43||b===45||b===46||An(b))&&a++<32?(e.consume(b),d):(a=0,h(b))}function f(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||wd(b)?n(b):(e.consume(b),f)}function h(b){return b===64?(e.consume(b),g):uU(b)?(e.consume(b),h):n(b)}function g(b){return An(b)?m(b):n(b)}function m(b){return b===46?(e.consume(b),a=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||An(b))&&a++<63){const k=b===45?y:m;return e.consume(b),k}return n(b)}}const rc={partial:!0,tokenize:kU};function kU(e,t,n){return a;function a(l){return it(l)?dt(e,s,"linePrefix")(l):s(l)}function s(l){return l===null||Pe(l)?t(l):n(l)}}const PC={continuation:{tokenize:jU},exit:CU,name:"blockQuote",tokenize:SU};function SU(e,t,n){const a=this;return s;function s(u){if(u===62){const d=a.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),l}return n(u)}function l(u){return it(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function jU(e,t,n){const a=this;return s;function s(u){return it(u)?dt(e,l,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):l(u)}function l(u){return e.attempt(PC,t,n)(u)}}function CU(e){e.exit("blockQuote")}const UC={name:"characterEscape",tokenize:NU};function NU(e,t,n){return a;function a(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),s}function s(l){return pU(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const BC={name:"characterReference",tokenize:EU};function EU(e,t,n){const a=this;let s=0,l,u;return d;function d(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),f}function f(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),l=31,u=An,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=dU,g):(e.enter("characterReferenceValue"),l=7,u=Ym,g(m))}function g(m){if(m===59&&s){const y=e.exit("characterReferenceValue");return u===An&&!kv(a.sliceSerialize(y))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(m)&&s++<l?(e.consume(m),g):n(m)}}const Zw={partial:!0,tokenize:TU},Kw={concrete:!0,name:"codeFenced",tokenize:AU};function AU(e,t,n){const a=this,s={partial:!0,tokenize:U};let l=0,u=0,d;return f;function f(_){return h(_)}function h(_){const z=a.events[a.events.length-1];return l=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,d=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(_)}function g(_){return _===d?(u++,e.consume(_),g):u<3?n(_):(e.exit("codeFencedFenceSequence"),it(_)?dt(e,m,"whitespace")(_):m(_))}function m(_){return _===null||Pe(_)?(e.exit("codeFencedFence"),a.interrupt?t(_):e.check(Zw,j,T)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(_))}function y(_){return _===null||Pe(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(_)):it(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),dt(e,b,"whitespace")(_)):_===96&&_===d?n(_):(e.consume(_),y)}function b(_){return _===null||Pe(_)?m(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(_))}function k(_){return _===null||Pe(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(_)):_===96&&_===d?n(_):(e.consume(_),k)}function j(_){return e.attempt(s,T,N)(_)}function N(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),S}function S(_){return l>0&&it(_)?dt(e,A,"linePrefix",l+1)(_):A(_)}function A(_){return _===null||Pe(_)?e.check(Zw,j,T)(_):(e.enter("codeFlowValue"),E(_))}function E(_){return _===null||Pe(_)?(e.exit("codeFlowValue"),A(_)):(e.consume(_),E)}function T(_){return e.exit("codeFenced"),t(_)}function U(_,z,q){let D=0;return R;function R(H){return _.enter("lineEnding"),_.consume(H),_.exit("lineEnding"),$}function $(H){return _.enter("codeFencedFence"),it(H)?dt(_,F,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):F(H)}function F(H){return H===d?(_.enter("codeFencedFenceSequence"),K(H)):q(H)}function K(H){return H===d?(D++,_.consume(H),K):D>=u?(_.exit("codeFencedFenceSequence"),it(H)?dt(_,I,"whitespace")(H):I(H)):q(H)}function I(H){return H===null||Pe(H)?(_.exit("codeFencedFence"),z(H)):q(H)}}}function TU(e,t,n){const a=this;return s;function s(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l)}function l(u){return a.parser.lazy[a.now().line]?n(u):t(u)}}const Jh={name:"codeIndented",tokenize:RU},_U={partial:!0,tokenize:OU};function RU(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),dt(e,l,"linePrefix",5)(h)}function l(h){const g=a.events[a.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?u(h):n(h)}function u(h){return h===null?f(h):Pe(h)?e.attempt(_U,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 OU(e,t,n){const a=this;return s;function s(u){return a.parser.lazy[a.now().line]?n(u):Pe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):dt(e,l,"linePrefix",5)(u)}function l(u){const d=a.events[a.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):Pe(u)?s(u):n(u)}}const LU={name:"codeText",previous:DU,resolve:MU,tokenize:zU};function MU(e){let t=e.length-4,n=3,a,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a<t;)if(e[a][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(a=n-1,t++;++a<=t;)s===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(s=a):(a===t||e[a][1].type==="lineEnding")&&(e[s][1].type="codeTextData",a!==s+2&&(e[s][1].end=e[a-1][1].end,e.splice(s+2,a-s-2),t-=a-s-2,a=s+2),s=void 0);return e}function DU(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function zU(e,t,n){let a=0,s,l;return u;function u(m){return e.enter("codeText"),e.enter("codeTextSequence"),d(m)}function d(m){return m===96?(e.consume(m),a++,d):(e.exit("codeTextSequence"),f(m))}function f(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),f):m===96?(l=e.enter("codeTextSequence"),s=0,g(m)):Pe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):(e.enter("codeTextData"),h(m))}function h(m){return m===null||m===32||m===96||Pe(m)?(e.exit("codeTextData"),f(m)):(e.consume(m),h)}function g(m){return m===96?(e.consume(m),s++,g):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(l.type="codeTextData",h(m))}}class $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 a=n??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const s=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return a&&Sl(this.left,a),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Sl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Sl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Sl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Sl(this.left,n.reverse())}}}function Sl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function FC(e){const t={};let n=-1,a,s,l,u,d,f,h;const g=new $U(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(a=g.get(n),n&&a[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(f=a[1]._tokenizer.events,l=0,l<f.length&&f[l][1].type==="lineEndingBlank"&&(l+=2),l<f.length&&f[l][1].type==="content"))for(;++l<f.length&&f[l][1].type!=="content";)f[l][1].type==="chunkText"&&(f[l][1]._isInFirstContentOfListItem=!0,l++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,IU(g,n)),n=t[n],h=!0);else if(a[1]._container){for(l=n,s=void 0;l--;)if(u=g.get(l),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),u[1].type="lineEnding",s=l);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;s&&(a[1].end={...g.get(s)[1].start},d=g.slice(s,n),d.unshift(a),g.splice(s,n-s+1,d))}}return cr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function IU(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const l=[];let u=n._tokenizer;u||(u=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const d=u.events,f=[],h={};let g,m,y=-1,b=n,k=0,j=0;const N=[j];for(;b;){for(;e.get(++s)[1]!==b;);l.push(s),b._tokenizer||(g=a.sliceStream(b),b.next||g.push(null),m&&u.defineSkip(b.start),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++y<d.length;)d[y][0]==="exit"&&d[y-1][0]==="enter"&&d[y][1].type===d[y-1][1].type&&d[y][1].start.line!==d[y][1].end.line&&(j=y+1,N.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(u.events=[],b?(b._tokenizer=void 0,b.previous=void 0):N.pop(),y=N.length;y--;){const S=d.slice(N[y],N[y+1]),A=l.pop();f.push([A,A+S.length-1]),e.splice(A,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 PU={resolve:BU,tokenize:FU},UU={partial:!0,tokenize:HU};function BU(e){return FC(e),e}function FU(e,t){let n;return a;function a(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(d)}function s(d){return d===null?l(d):Pe(d)?e.check(UU,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 HU(e,t,n){const a=this;return s;function s(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),dt(e,l,"linePrefix")}function l(u){if(u===null||Pe(u))return n(u);const d=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):e.interrupt(a.parser.constructs.flow,n,t)(u)}}function HC(e,t,n,a,s,l,u,d,f){const h=f||Number.POSITIVE_INFINITY;let g=0;return m;function m(S){return S===60?(e.enter(a),e.enter(s),e.enter(l),e.consume(S),e.exit(l),y):S===null||S===32||S===41||wd(S)?n(S):(e.enter(a),e.enter(u),e.enter(d),e.enter("chunkString",{contentType:"string"}),j(S))}function y(S){return S===62?(e.enter(l),e.consume(S),e.exit(l),e.exit(s),e.exit(a),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(S))}function b(S){return S===62?(e.exit("chunkString"),e.exit(d),y(S)):S===null||S===60||Pe(S)?n(S):(e.consume(S),S===92?k:b)}function k(S){return S===60||S===62||S===92?(e.consume(S),b):b(S)}function j(S){return!g&&(S===null||S===41||Tt(S))?(e.exit("chunkString"),e.exit(d),e.exit(u),e.exit(a),t(S)):g<h&&S===40?(e.consume(S),g++,j):S===41?(e.consume(S),g--,j):S===null||S===32||S===40||wd(S)?n(S):(e.consume(S),S===92?N:j)}function N(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function qC(e,t,n,a,s,l){const u=this;let d=0,f;return h;function h(b){return e.enter(a),e.enter(s),e.consume(b),e.exit(s),e.enter(l),g}function g(b){return d>999||b===null||b===91||b===93&&!f||b===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?n(b):b===93?(e.exit(l),e.enter(s),e.consume(b),e.exit(s),e.exit(a),t):Pe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||Pe(b)||d++>999?(e.exit("chunkString"),g(b)):(e.consume(b),f||(f=!it(b)),b===92?y:m)}function y(b){return b===91||b===92||b===93?(e.consume(b),d++,m):m(b)}}function GC(e,t,n,a,s,l){let u;return d;function d(y){return y===34||y===39||y===40?(e.enter(a),e.enter(s),e.consume(y),e.exit(s),u=y===40?41:y,f):n(y)}function f(y){return y===u?(e.enter(s),e.consume(y),e.exit(s),e.exit(a),t):(e.enter(l),h(y))}function h(y){return y===u?(e.exit(l),f(u)):y===null?n(y):Pe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),dt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===u||y===null||Pe(y)?(e.exit("chunkString"),h(y)):(e.consume(y),y===92?m:g)}function m(y){return y===u||y===92?(e.consume(y),g):g(y)}}function Dl(e,t){let n;return a;function a(s){return Pe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):it(s)?dt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const qU={name:"definition",tokenize:VU},GU={partial:!0,tokenize:WU};function VU(e,t,n){const a=this;let s;return l;function l(b){return e.enter("definition"),u(b)}function u(b){return qC.call(a,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return s=Ur(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),f):n(b)}function f(b){return Tt(b)?Dl(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(GU,m,m)(b)}function m(b){return it(b)?dt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||Pe(b)?(e.exit("definition"),a.parser.defined.push(s),t(b)):n(b)}}function WU(e,t,n){return a;function a(d){return Tt(d)?Dl(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 ZU={name:"hardBreakEscape",tokenize:KU};function KU(e,t,n){return a;function a(l){return e.enter("hardBreakEscape"),e.consume(l),s}function s(l){return Pe(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const YU={name:"headingAtx",resolve:QU,tokenize:XU};function QU(e,t){let n=e.length-2,a=3,s,l;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(s={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},l={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},cr(e,a,n-a+1,[["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t]])),e}function XU(e,t,n){let a=0;return s;function s(g){return e.enter("atxHeading"),l(g)}function l(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&a++<6?(e.consume(g),u):g===null||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 JU=["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"],Yw=["pre","script","style","textarea"],e8={concrete:!0,name:"htmlFlow",resolveTo:r8,tokenize:a8},t8={partial:!0,tokenize:s8},n8={partial:!0,tokenize:i8};function r8(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 a8(e,t,n){const a=this;let s,l,u,d,f;return h;function h(O){return g(O)}function g(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),m}function m(O){return O===33?(e.consume(O),y):O===47?(e.consume(O),l=!0,j):O===63?(e.consume(O),s=3,a.interrupt?t:L):Dn(O)?(e.consume(O),u=String.fromCharCode(O),N):n(O)}function y(O){return O===45?(e.consume(O),s=2,b):O===91?(e.consume(O),s=5,d=0,k):Dn(O)?(e.consume(O),s=4,a.interrupt?t:L):n(O)}function b(O){return O===45?(e.consume(O),a.interrupt?t:L):n(O)}function k(O){const ne="CDATA[";return O===ne.charCodeAt(d++)?(e.consume(O),d===ne.length?a.interrupt?t:F:k):n(O)}function j(O){return Dn(O)?(e.consume(O),u=String.fromCharCode(O),N):n(O)}function N(O){if(O===null||O===47||O===62||Tt(O)){const ne=O===47,ue=u.toLowerCase();return!ne&&!l&&Yw.includes(ue)?(s=1,a.interrupt?t(O):F(O)):JU.includes(u.toLowerCase())?(s=6,ne?(e.consume(O),S):a.interrupt?t(O):F(O)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(O):l?A(O):E(O))}return O===45||An(O)?(e.consume(O),u+=String.fromCharCode(O),N):n(O)}function S(O){return O===62?(e.consume(O),a.interrupt?t:F):n(O)}function A(O){return it(O)?(e.consume(O),A):R(O)}function E(O){return O===47?(e.consume(O),R):O===58||O===95||Dn(O)?(e.consume(O),T):it(O)?(e.consume(O),E):R(O)}function T(O){return O===45||O===46||O===58||O===95||An(O)?(e.consume(O),T):U(O)}function U(O){return O===61?(e.consume(O),_):it(O)?(e.consume(O),U):E(O)}function _(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),f=O,z):it(O)?(e.consume(O),_):q(O)}function z(O){return O===f?(e.consume(O),f=null,D):O===null||Pe(O)?n(O):(e.consume(O),z)}function q(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||Tt(O)?U(O):(e.consume(O),q)}function D(O){return O===47||O===62||it(O)?E(O):n(O)}function R(O){return O===62?(e.consume(O),$):n(O)}function $(O){return O===null||Pe(O)?F(O):it(O)?(e.consume(O),$):n(O)}function F(O){return O===45&&s===2?(e.consume(O),B):O===60&&s===1?(e.consume(O),W):O===62&&s===4?(e.consume(O),P):O===63&&s===3?(e.consume(O),L):O===93&&s===5?(e.consume(O),V):Pe(O)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(t8,G,K)(O)):O===null||Pe(O)?(e.exit("htmlFlowData"),K(O)):(e.consume(O),F)}function K(O){return e.check(n8,I,G)(O)}function I(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),H}function H(O){return O===null||Pe(O)?K(O):(e.enter("htmlFlowData"),F(O))}function B(O){return O===45?(e.consume(O),L):F(O)}function W(O){return O===47?(e.consume(O),u="",Q):F(O)}function Q(O){if(O===62){const ne=u.toLowerCase();return Yw.includes(ne)?(e.consume(O),P):F(O)}return Dn(O)&&u.length<8?(e.consume(O),u+=String.fromCharCode(O),Q):F(O)}function V(O){return O===93?(e.consume(O),L):F(O)}function L(O){return O===62?(e.consume(O),P):O===45&&s===2?(e.consume(O),L):F(O)}function P(O){return O===null||Pe(O)?(e.exit("htmlFlowData"),G(O)):(e.consume(O),P)}function G(O){return e.exit("htmlFlow"),t(O)}}function i8(e,t,n){const a=this;return s;function s(u){return Pe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):n(u)}function l(u){return a.parser.lazy[a.now().line]?n(u):t(u)}}function s8(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(rc,t,n)}}const o8={name:"htmlText",tokenize:l8};function l8(e,t,n){const a=this;let s,l,u;return d;function d(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),f}function f(L){return L===33?(e.consume(L),h):L===47?(e.consume(L),U):L===63?(e.consume(L),E):Dn(L)?(e.consume(L),q):n(L)}function h(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),l=0,k):Dn(L)?(e.consume(L),A):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,W(L)):(e.consume(L),m)}function y(L){return L===45?(e.consume(L),b):m(L)}function b(L){return L===62?B(L):L===45?y(L):m(L)}function k(L){const P="CDATA[";return L===P.charCodeAt(l++)?(e.consume(L),l===P.length?j:k):n(L)}function j(L){return L===null?n(L):L===93?(e.consume(L),N):Pe(L)?(u=j,W(L)):(e.consume(L),j)}function N(L){return L===93?(e.consume(L),S):j(L)}function S(L){return L===62?B(L):L===93?(e.consume(L),S):j(L)}function A(L){return L===null||L===62?B(L):Pe(L)?(u=A,W(L)):(e.consume(L),A)}function E(L){return L===null?n(L):L===63?(e.consume(L),T):Pe(L)?(u=E,W(L)):(e.consume(L),E)}function T(L){return L===62?B(L):E(L)}function U(L){return Dn(L)?(e.consume(L),_):n(L)}function _(L){return L===45||An(L)?(e.consume(L),_):z(L)}function z(L){return Pe(L)?(u=z,W(L)):it(L)?(e.consume(L),z):B(L)}function q(L){return L===45||An(L)?(e.consume(L),q):L===47||L===62||Tt(L)?D(L):n(L)}function D(L){return L===47?(e.consume(L),B):L===58||L===95||Dn(L)?(e.consume(L),R):Pe(L)?(u=D,W(L)):it(L)?(e.consume(L),D):B(L)}function R(L){return L===45||L===46||L===58||L===95||An(L)?(e.consume(L),R):$(L)}function $(L){return L===61?(e.consume(L),F):Pe(L)?(u=$,W(L)):it(L)?(e.consume(L),$):D(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,K):Pe(L)?(u=F,W(L)):it(L)?(e.consume(L),F):(e.consume(L),I)}function K(L){return L===s?(e.consume(L),s=void 0,H):L===null?n(L):Pe(L)?(u=K,W(L)):(e.consume(L),K)}function I(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||Tt(L)?D(L):(e.consume(L),I)}function H(L){return L===47||L===62||Tt(L)?D(L):n(L)}function B(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function W(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),Q}function Q(L){return it(L)?dt(e,V,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):V(L)}function V(L){return e.enter("htmlTextData"),u(L)}}const Sv={name:"labelEnd",resolveAll:p8,resolveTo:f8,tokenize:h8},c8={tokenize:m8},u8={tokenize:g8},d8={tokenize:v8};function p8(e){let t=-1;const n=[];for(;++t<e.length;){const a=e[t][1];if(n.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const s=a.type==="labelImage"?4:2;a.type="data",t+=s}}return e.length!==n.length&&cr(e,0,e.length,n),e}function f8(e,t){let n=e.length,a=0,s,l,u,d;for(;n--;)if(s=e[n][1],l){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(l=n,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(u=n);const f={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[l][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[l+a+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",f,t],["enter",h,t]],d=Ar(d,e.slice(l+1,l+a+3)),d=Ar(d,[["enter",g,t]]),d=Ar(d,Zd(t.parser.constructs.insideSpan.null,e.slice(l+a+4,u-3),t)),d=Ar(d,[["exit",g,t],e[u-2],e[u-1],["exit",h,t]]),d=Ar(d,e.slice(u+1)),d=Ar(d,[["exit",f,t]]),cr(e,l,e.length,d),e}function h8(e,t,n){const a=this;let s=a.events.length,l,u;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){l=a.events[s][1];break}return d;function d(y){return l?l._inactive?m(y):(u=a.parser.defined.includes(Ur(a.sliceSerialize({start:l.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),f):n(y)}function f(y){return y===40?e.attempt(c8,g,u?g:m)(y):y===91?e.attempt(u8,g,u?h:m)(y):u?g(y):m(y)}function h(y){return e.attempt(d8,g,m)(y)}function g(y){return t(y)}function m(y){return l._balanced=!0,n(y)}}function m8(e,t,n){return a;function a(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),s}function s(m){return Tt(m)?Dl(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)?Dl(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)?Dl(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function g8(e,t,n){const a=this;return s;function s(d){return qC.call(a,e,l,u,"reference","referenceMarker","referenceString")(d)}function l(d){return a.parser.defined.includes(Ur(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function u(d){return n(d)}}function v8(e,t,n){return a;function a(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),s}function s(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const y8={name:"labelStartImage",resolveAll:Sv.resolveAll,tokenize:b8};function b8(e,t,n){const a=this;return s;function s(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),u):n(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):t(d)}}const x8={name:"labelStartLink",resolveAll:Sv.resolveAll,tokenize:w8};function w8(e,t,n){const a=this;return s;function s(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),l}function l(u){return u===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(u):t(u)}}const em={name:"lineEnding",tokenize:k8};function k8(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),dt(e,t,"linePrefix")}}const td={name:"thematicBreak",tokenize:S8};function S8(e,t,n){let a=0,s;return l;function l(h){return e.enter("thematicBreak"),u(h)}function u(h){return s=h,d(h)}function d(h){return h===s?(e.enter("thematicBreakSequence"),f(h)):a>=3&&(h===null||Pe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function f(h){return h===s?(e.consume(h),a++,f):(e.exit("thematicBreakSequence"),it(h)?dt(e,d,"whitespace")(h):d(h))}}const qn={continuation:{tokenize:E8},exit:T8,name:"list",tokenize:N8},j8={partial:!0,tokenize:_8},C8={partial:!0,tokenize:A8};function N8(e,t,n){const a=this,s=a.events[a.events.length-1];let l=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,u=0;return d;function d(b){const k=a.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||b===a.containerState.marker:Ym(b)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(td,n,h)(b):h(b);if(!a.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(b)}return n(b)}function f(b){return Ym(b)&&++u<10?(e.consume(b),f):(!a.interrupt||u<2)&&(a.containerState.marker?b===a.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),h(b)):n(b)}function h(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||b,e.check(rc,a.interrupt?n:g,e.attempt(j8,y,m))}function g(b){return a.containerState.initialBlankLine=!0,l++,y(b)}function m(b){return it(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return a.containerState.size=l+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function E8(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(rc,s,l);function s(d){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,dt(e,t,"listItemIndent",a.containerState.size+1)(d)}function l(d){return a.containerState.furtherBlankLines||!it(d)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,u(d)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(C8,t,u)(d))}function u(d){return a.containerState._closeFlow=!0,a.interrupt=void 0,dt(e,e.attempt(qn,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function A8(e,t,n){const a=this;return dt(e,s,"listItemIndent",a.containerState.size+1);function s(l){const u=a.events[a.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===a.containerState.size?t(l):n(l)}}function T8(e){e.exit(this.containerState.type)}function _8(e,t,n){const a=this;return dt(e,s,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(l){const u=a.events[a.events.length-1];return!it(l)&&u&&u[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const Qw={name:"setextUnderline",resolveTo:R8,tokenize:O8};function R8(e,t){let n=e.length,a,s,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const u={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",l?(e.splice(s,0,["enter",u,t]),e.splice(l+1,0,["exit",e[a][1],t]),e[a][1].end={...e[l][1].end}):e[a][1]=u,e.push(["exit",u,t]),e}function O8(e,t,n){const a=this;let s;return l;function l(h){let g=a.events.length,m;for(;g--;)if(a.events[g][1].type!=="lineEnding"&&a.events[g][1].type!=="linePrefix"&&a.events[g][1].type!=="content"){m=a.events[g][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||m)?(e.enter("setextHeadingLine"),s=h,u(h)):n(h)}function u(h){return e.enter("setextHeadingLineSequence"),d(h)}function d(h){return h===s?(e.consume(h),d):(e.exit("setextHeadingLineSequence"),it(h)?dt(e,f,"lineSuffix")(h):f(h))}function f(h){return h===null||Pe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const L8={tokenize:M8};function M8(e){const t=this,n=e.attempt(rc,a,e.attempt(this.parser.constructs.flowInitial,s,dt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(PU,s)),"linePrefix")));return n;function a(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const D8={resolveAll:WC()},z8=VC("string"),$8=VC("text");function VC(e){return{resolveAll:WC(e==="text"?I8:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],l=n.attempt(s,u,d);return u;function u(g){return h(g)?l(g):d(g)}function d(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),f}function f(g){return h(g)?(n.exit("data"),l(g)):(n.consume(g),f)}function h(g){if(g===null)return!0;const m=s[g];let y=-1;if(m)for(;++y<m.length;){const b=m[y];if(!b.previous||b.previous.call(a,a.previous))return!0}return!1}}}function WC(e){return t;function t(n,a){let s=-1,l;for(;++s<=n.length;)l===void 0?n[s]&&n[s][1].type==="data"&&(l=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==l+2&&(n[l][1].end=n[s-1][1].end,n.splice(l+2,s-l-2),s=l+2),l=void 0);return e?e(n,a):n}}function I8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const a=e[n-1][1],s=t.sliceStream(a);let l=s.length,u=-1,d=0,f;for(;l--;){const h=s[l];if(typeof h=="string"){for(u=h.length;h.charCodeAt(u-1)===32;)d++,u--;if(u)break;u=-1}else if(h===-2)f=!0,d++;else if(h!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const h={type:n===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?u:a.start._bufferIndex+u,_index:a.start._index+l,line:a.end.line,column:a.end.column-d,offset:a.end.offset-d},end:{...a.end}};a.end={...h.start},a.start.offset===a.end.offset?Object.assign(a,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const P8={42:qn,43:qn,45:qn,48:qn,49:qn,50:qn,51:qn,52:qn,53:qn,54:qn,55:qn,56:qn,57:qn,62:PC},U8={91:qU},B8={[-2]:Jh,[-1]:Jh,32:Jh},F8={35:YU,42:td,45:[Qw,td],60:e8,61:Qw,95:td,96:Kw,126:Kw},H8={38:BC,92:UC},q8={[-5]:em,[-4]:em,[-3]:em,33:y8,38:BC,42:Qm,60:[xU,o8],91:x8,92:[ZU,UC],93:Sv,95:Qm,96:LU},G8={null:[Qm,D8]},V8={null:[42,95]},W8={null:[]},Z8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:V8,contentInitial:U8,disable:W8,document:P8,flow:F8,flowInitial:B8,insideSpan:G8,string:H8,text:q8},Symbol.toStringTag,{value:"Module"}));function K8(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},l=[];let u=[],d=[];const f={attempt:z(U),check:z(_),consume:A,enter:E,exit:T,interrupt:z(_,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:m};let g=t.tokenize.call(h,f);return t.resolveAll&&l.push(t),h;function m($){return u=Ar(u,$),N(),u[u.length-1]!==null?[]:(q(t,0),h.events=Zd(l,h.events,h),h.events)}function y($,F){return Q8(b($),F)}function b($){return Y8(u,$)}function k(){const{_bufferIndex:$,_index:F,line:K,column:I,offset:H}=a;return{_bufferIndex:$,_index:F,line:K,column:I,offset:H}}function j($){s[$.line]=$.column,R()}function N(){let $;for(;a._index<u.length;){const F=u[a._index];if(typeof F=="string")for($=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===$&&a._bufferIndex<F.length;)S(F.charCodeAt(a._bufferIndex));else S(F)}}function S($){g=g($)}function A($){Pe($)?(a.line++,a.column=1,a.offset+=$===-3?2:1,R()):$!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===u[a._index].length&&(a._bufferIndex=-1,a._index++)),h.previous=$}function E($,F){const K=F||{};return K.type=$,K.start=k(),h.events.push(["enter",K,h]),d.push(K),K}function T($){const F=d.pop();return F.end=k(),h.events.push(["exit",F,h]),F}function U($,F){q($,F.from)}function _($,F){F.restore()}function z($,F){return K;function K(I,H,B){let W,Q,V,L;return Array.isArray(I)?G(I):"tokenize"in I?G([I]):P(I);function P(le){return be;function be(_e){const Ee=_e!==null&&le[_e],Ie=_e!==null&&le.null,We=[...Array.isArray(Ee)?Ee:Ee?[Ee]:[],...Array.isArray(Ie)?Ie:Ie?[Ie]:[]];return G(We)(_e)}}function G(le){return W=le,Q=0,le.length===0?B:O(le[Q])}function O(le){return be;function be(_e){return L=D(),V=le,le.partial||(h.currentConstruct=le),le.name&&h.parser.constructs.disable.null.includes(le.name)?ue():le.tokenize.call(F?Object.assign(Object.create(h),F):h,f,ne,ue)(_e)}}function ne(le){return $(V,L),H}function ue(le){return L.restore(),++Q<W.length?O(W[Q]):B}}}function q($,F){$.resolveAll&&!l.includes($)&&l.push($),$.resolve&&cr(h.events,F,h.events.length-F,$.resolve(h.events.slice(F),h)),$.resolveTo&&(h.events=$.resolveTo(h.events,h))}function D(){const $=k(),F=h.previous,K=h.currentConstruct,I=h.events.length,H=Array.from(d);return{from:I,restore:B};function B(){a=$,h.previous=F,h.currentConstruct=K,h.events.length=I,d=H,R()}}function R(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function Y8(e,t){const n=t.start._index,a=t.start._bufferIndex,s=t.end._index,l=t.end._bufferIndex;let u;if(n===s)u=[e[n].slice(a,l)];else{if(u=e.slice(n,s),a>-1){const d=u[0];typeof d=="string"?u[0]=d.slice(a):u.shift()}l>0&&u.push(e[s].slice(0,l))}return u}function Q8(e,t){let n=-1;const a=[];let s;for(;++n<e.length;){const l=e[n];let u;if(typeof l=="string")u=l;else switch(l){case-5:{u="\r";break}case-4:{u=`
1626
- `;break}case-3:{u=`\r
1627
- `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&s)continue;u=" ";break}default:u=String.fromCharCode(l)}s=l===-2,a.push(u)}return a.join("")}function X8(e){const a={constructs:$C([Z8,...(e||{}).extensions||[]]),content:s(fU),defined:[],document:s(mU),flow:s(L8),lazy:{},string:s(z8),text:s($8)};return a;function s(l){return u;function u(d){return K8(a,l,d)}}}function J8(e){for(;!FC(e););return e}const Xw=/[\0\t\n\r]/g;function e9(){let e=1,t="",n=!0,a;return s;function s(l,u,d){const f=[];let h,g,m,y,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(u||void 0).decode(l)),m=0,t="",n&&(l.charCodeAt(0)===65279&&m++,n=void 0);m<l.length;){if(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&&a)f.push(-3),a=void 0;else switch(a&&(f.push(-5),a=void 0),m<y&&(f.push(l.slice(m,y)),e+=y-m),b){case 0:{f.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,f.push(-2);e++<g;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:a=!0,e=1}m=y+1}return d&&(a&&f.push(-5),t&&f.push(t),f.push(null)),f}}const t9=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function n9(e){return e.replace(t9,r9)}function r9(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 kv(n)||e}const ZC={}.hasOwnProperty;function a9(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),i9(n)(J8(X8(n).document().write(e9()(e,t,!0))))}function i9(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Oe),autolinkProtocol:D,autolinkEmail:D,atxHeading:l(qe),blockQuote:l(Ie),characterEscape:D,characterReference:D,codeFenced:l(We),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:l(We,u),codeText:l(Se,u),codeTextData:D,data:D,codeFlowValue:D,definition:l(ft),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:l(De),hardBreakEscape:l(ke),hardBreakTrailing:l(ke),htmlFlow:l(lt,u),htmlFlowData:D,htmlText:l(lt,u),htmlTextData:D,image:l(xe),label:u,link:l(Oe),listItem:l($t),listItemValue:y,listOrdered:l(Ot,m),listUnordered:l(Ot),paragraph:l(Yt),reference:O,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:l(qe),strong:l(qt),thematicBreak:l(ye)},exit:{atxHeading:f(),atxHeadingSequence:U,autolink:f(),autolinkEmail:Ee,autolinkProtocol:_e,blockQuote:f(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:le,characterReference:be,codeFenced:f(N),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:k,codeFlowValue:R,codeIndented:f(S),codeText:f(H),codeTextData:R,data:R,definition:f(),definitionDestinationString:T,definitionLabelString:A,definitionTitleString:E,emphasis:f(),hardBreakEscape:f(F),hardBreakTrailing:f(F),htmlFlow:f(K),htmlFlowData:R,htmlText:f(I),htmlTextData:R,image:f(W),label:V,labelText:Q,lineEnding:$,link:f(B),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:ne,resourceDestinationString:L,resourceTitleString:P,resource:G,setextHeading:f(q),setextHeadingLineSequence:z,setextHeadingText:_,strong:f(),thematicBreak:f()}};KC(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(X){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<X.length;)if(X[he][1].type==="listOrdered"||X[he][1].type==="listUnordered")if(X[he][0]==="enter")ce.push(he);else{const Le=ce.pop();he=s(X,Le,he)}for(he=-1;++he<X.length;){const Le=t[X[he][0]];ZC.call(Le,X[he][1].type)&&Le[X[he][1].type].call(Object.assign({sliceSerialize:X[he][2].sliceSerialize},ee),X[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(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:gi(X.length>0?X[X.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(X,Z,ee){let ce=Z-1,he=-1,Le=!1,He,Ce,Fe,et;for(;++ce<=ee;){const Ne=X[ce];switch(Ne[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ne[0]==="enter"?he++:he--,et=void 0;break}case"lineEndingBlank":{Ne[0]==="enter"&&(He&&!et&&!he&&!Fe&&(Fe=ce),et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:et=void 0}if(!he&&Ne[0]==="enter"&&Ne[1].type==="listItemPrefix"||he===-1&&Ne[0]==="exit"&&(Ne[1].type==="listUnordered"||Ne[1].type==="listOrdered")){if(He){let Wt=ce;for(Ce=void 0;Wt--;){const _t=X[Wt];if(_t[1].type==="lineEnding"||_t[1].type==="lineEndingBlank"){if(_t[0]==="exit")continue;Ce&&(X[Ce][1].type="lineEndingBlank",Le=!0),_t[1].type="lineEnding",Ce=Wt}else if(!(_t[1].type==="linePrefix"||_t[1].type==="blockQuotePrefix"||_t[1].type==="blockQuotePrefixWhitespace"||_t[1].type==="blockQuoteMarker"||_t[1].type==="listItemIndent"))break}Fe&&(!Ce||Fe<Ce)&&(He._spread=!0),He.end=Object.assign({},Ce?X[Ce][1].start:Ne[1].end),X.splice(Ce||ce,0,["exit",He,Ne[2]]),ce++,ee++}if(Ne[1].type==="listItemPrefix"){const Wt={type:"listItem",_spread:!1,start:Object.assign({},Ne[1].start),end:void 0};He=Wt,X.splice(ce,0,["enter",Wt,Ne[2]]),ce++,ee++,Fe=void 0,et=!0}}}return X[Z][1]._spread=Le,ee}function l(X,Z){return ee;function ee(ce){d.call(this,X(ce),ce),Z&&Z.call(this,ce)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(X,Z,ee){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([Z,ee||void 0]),X.position={start:gi(Z.start),end:void 0}}function f(X){return Z;function Z(ee){X&&X.call(this,ee),h.call(this,ee)}}function h(X,Z){const ee=this.stack.pop(),ce=this.tokenStack.pop();if(ce)ce[0].type!==X.type&&(Z?Z.call(this,X,ce[0]):(ce[1]||Jw).call(this,X,ce[0]));else throw new Error("Cannot close `"+X.type+"` ("+Ml({start:X.start,end:X.end})+"): it’s not open");ee.position.end=gi(X.end)}function g(){return wv(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function y(X){if(this.data.expectingFirstListItemValue){const Z=this.stack[this.stack.length-2];Z.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function b(){const X=this.resume(),Z=this.stack[this.stack.length-1];Z.lang=X}function k(){const X=this.resume(),Z=this.stack[this.stack.length-1];Z.meta=X}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const X=this.resume(),Z=this.stack[this.stack.length-1];Z.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const X=this.resume(),Z=this.stack[this.stack.length-1];Z.value=X.replace(/(\r?\n|\r)$/g,"")}function A(X){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.label=Z,ee.identifier=Ur(this.sliceSerialize(X)).toLowerCase()}function E(){const X=this.resume(),Z=this.stack[this.stack.length-1];Z.title=X}function T(){const X=this.resume(),Z=this.stack[this.stack.length-1];Z.url=X}function U(X){const Z=this.stack[this.stack.length-1];if(!Z.depth){const ee=this.sliceSerialize(X).length;Z.depth=ee}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function z(X){const Z=this.stack[this.stack.length-1];Z.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function D(X){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(X.start),end:void 0},ee.push(ce)),this.stack.push(ce)}function R(X){const Z=this.stack.pop();Z.value+=this.sliceSerialize(X),Z.position.end=gi(X.end)}function $(X){const Z=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ee=Z.children[Z.children.length-1];ee.position.end=gi(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Z.type)&&(D.call(this,X),R.call(this,X))}function F(){this.data.atHardBreak=!0}function K(){const X=this.resume(),Z=this.stack[this.stack.length-1];Z.value=X}function I(){const X=this.resume(),Z=this.stack[this.stack.length-1];Z.value=X}function H(){const X=this.resume(),Z=this.stack[this.stack.length-1];Z.value=X}function B(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=Z,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function W(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=Z,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function Q(X){const Z=this.sliceSerialize(X),ee=this.stack[this.stack.length-2];ee.label=n9(Z),ee.identifier=Ur(Z).toLowerCase()}function V(){const X=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=X.children;ee.children=ce}else ee.alt=Z}function L(){const X=this.resume(),Z=this.stack[this.stack.length-1];Z.url=X}function P(){const X=this.resume(),Z=this.stack[this.stack.length-1];Z.title=X}function G(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function ne(X){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.label=Z,ee.identifier=Ur(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function ue(X){this.data.characterReferenceType=X.type}function le(X){const Z=this.sliceSerialize(X),ee=this.data.characterReferenceType;let ce;ee?(ce=IC(Z,ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ce=kv(Z);const he=this.stack[this.stack.length-1];he.value+=ce}function be(X){const Z=this.stack.pop();Z.position.end=gi(X.end)}function _e(X){R.call(this,X);const Z=this.stack[this.stack.length-1];Z.url=this.sliceSerialize(X)}function Ee(X){R.call(this,X);const Z=this.stack[this.stack.length-1];Z.url="mailto:"+this.sliceSerialize(X)}function Ie(){return{type:"blockquote",children:[]}}function We(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function ft(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function qe(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function lt(){return{type:"html",value:""}}function xe(){return{type:"image",title:null,url:"",alt:null}}function Oe(){return{type:"link",title:null,url:"",children:[]}}function Ot(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function $t(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function Yt(){return{type:"paragraph",children:[]}}function qt(){return{type:"strong",children:[]}}function ut(){return{type:"text",value:""}}function ye(){return{type:"thematicBreak"}}}function gi(e){return{line:e.line,column:e.column,offset:e.offset}}function KC(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?KC(e,a):s9(e,a)}}function s9(e,t){let n;for(n in t)if(ZC.call(t,n))switch(n){case"canContainEols":{const a=t[n];a&&e[n].push(...a);break}case"transforms":{const a=t[n];a&&e[n].push(...a);break}case"enter":case"exit":{const a=t[n];a&&Object.assign(e[n],a);break}}}function 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 o9(e){const t=this;t.parser=n;function n(a){return a9(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function l9(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 c9(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
1628
- `}]}function u9(e,t){const n=t.value?t.value+`
1629
- `:"",a={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(a.className=["language-"+s[0]]);let l={type:"element",tagName:"code",properties:a,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function d9(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function p9(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function f9(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=So(a.toLowerCase()),l=e.footnoteOrder.indexOf(a);let u,d=e.footnoteCounts.get(a);d===void 0?(d=0,e.footnoteOrder.push(a),u=e.footnoteOrder.length):u=l+1,d+=1,e.footnoteCounts.set(a,d);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,f);const h={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,h),e.applyData(t,h)}function h9(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 m9(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function YC(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const s=e.all(t),l=s[0];l&&l.type==="text"?l.value="["+l.value:s.unshift({type:"text",value:"["});const u=s[s.length-1];return u&&u.type==="text"?u.value+=a:s.push({type:"text",value:a}),s}function g9(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return YC(e,t);const s={src:So(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(s.title=a.title);const l={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,l),e.applyData(t,l)}function v9(e,t){const n={src:So(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function y9(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const a={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,a),e.applyData(t,a)}function b9(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return YC(e,t);const s={href:So(a.url||"")};a.title!==null&&a.title!==void 0&&(s.title=a.title);const l={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function x9(e,t){const n={href:So(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function w9(e,t,n){const a=e.all(t),s=n?k9(n):QC(t),l={},u=[];if(typeof t.checked=="boolean"){const g=a[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},a.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let d=-1;for(;++d<a.length;){const g=a[d];(s||d!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
1630
- `}),g.type==="element"&&g.tagName==="p"&&!s?u.push(...g.children):u.push(g)}const f=a[a.length-1];f&&(s||f.type!=="element"||f.tagName!=="p")&&u.push({type:"text",value:`
1631
- `});const h={type:"element",tagName:"li",properties:l,children:u};return e.patch(t,h),e.applyData(t,h)}function k9(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let a=-1;for(;!t&&++a<n.length;)t=QC(n[a])}return t}function QC(e){const t=e.spread;return t??e.children.length>1}function S9(e,t){const n={},a=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<a.length;){const u=a[s];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function j9(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function C9(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function N9(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function E9(e,t){const n=e.all(t),a=n.shift(),s=[];if(a){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],u),s.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=vv(t.children[1]),f=_C(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 A9(e,t,n){const a=n?n.children:void 0,l=(a?a.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,d=u?u.length:t.children.length;let f=-1;const h=[];for(;++f<d;){const m=t.children[f],y={},b=u?u[f]:void 0;b&&(y.align=b);let k={type:"element",tagName:l,properties:y,children:[]};m&&(k.children=e.all(m),e.patch(m,k),k=e.applyData(m,k)),h.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,g),e.applyData(t,g)}function T9(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 _9(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const l=[];for(;a;)l.push(nk(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return l.push(nk(t.slice(s),s>0,!1)),l.join("")}function nk(e,t,n){let a=0,s=e.length;if(t){let l=e.codePointAt(a);for(;l===ek||l===tk;)a++,l=e.codePointAt(a)}if(n){let l=e.codePointAt(s-1);for(;l===ek||l===tk;)s--,l=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function R9(e,t){const n={type:"text",value:_9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function O9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const L9={blockquote:l9,break:c9,code:u9,delete:d9,emphasis:p9,footnoteReference:f9,heading:h9,html:m9,imageReference:g9,image:v9,inlineCode:y9,linkReference:b9,link:x9,listItem:w9,list:S9,paragraph:j9,root:C9,strong:N9,table:E9,tableCell:T9,tableRow:A9,text:R9,thematicBreak:O9,toml:Iu,yaml:Iu,definition:Iu,footnoteDefinition:Iu};function Iu(){}const XC=-1,Kd=0,zl=1,kd=2,jv=3,Cv=4,Nv=5,Ev=6,JC=7,eN=8,M9=typeof self=="object"?self:globalThis,rk=(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 M9[e](t)},D9=(e,t)=>{const n=(s,l)=>(e.set(l,s),s),a=s=>{if(e.has(s))return e.get(s);const[l,u]=t[s];switch(l){case Kd:case XC:return n(u,s);case zl:{const d=n([],s);for(const f of u)d.push(a(f));return d}case kd:{const d=n({},s);for(const[f,h]of u)d[a(f)]=a(h);return d}case jv:return n(new Date(u),s);case Cv:{const{source:d,flags:f}=u;return n(new RegExp(d,f),s)}case Nv:{const d=n(new Map,s);for(const[f,h]of u)d.set(a(f),a(h));return d}case Ev:{const d=n(new Set,s);for(const f of u)d.add(a(f));return d}case JC:{const{name:d,message:f}=u;return n(rk(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(rk(l,u),s)};return a},ak=e=>D9(new Map,e)(0),Xs="",{toString:z9}={},{keys:$9}=Object,jl=e=>{const t=typeof e;if(t!=="object"||!e)return[Kd,t];const n=z9.call(e).slice(8,-1);switch(n){case"Array":return[zl,Xs];case"Object":return[kd,Xs];case"Date":return[jv,Xs];case"RegExp":return[Cv,Xs];case"Map":return[Nv,Xs];case"Set":return[Ev,Xs];case"DataView":return[zl,n]}return n.includes("Array")?[zl,n]:n.includes("Error")?[JC,n]:[kd,n]},Pu=([e,t])=>e===Kd&&(t==="function"||t==="symbol"),I9=(e,t,n,a)=>{const s=(u,d)=>{const f=a.push(u)-1;return n.set(d,f),f},l=u=>{if(n.has(u))return n.get(u);let[d,f]=jl(u);switch(d){case Kd:{let g=u;switch(f){case"bigint":d=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 zl:{if(f){let y=u;return f==="DataView"?y=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(y=new Uint8Array(u)),s([f,[...y]],u)}const g=[],m=s([d,g],u);for(const y of u)g.push(l(y));return m}case kd:{if(f)switch(f){case"BigInt":return s([f,u.toString()],u);case"Boolean":case"Number":case"String":return s([f,u.valueOf()],u)}if(t&&"toJSON"in u)return l(u.toJSON());const g=[],m=s([d,g],u);for(const y of $9(u))(e||!Pu(jl(u[y])))&&g.push([l(y),l(u[y])]);return m}case jv:return s([d,u.toISOString()],u);case Cv:{const{source:g,flags:m}=u;return s([d,{source:g,flags:m}],u)}case Nv:{const g=[],m=s([d,g],u);for(const[y,b]of u)(e||!(Pu(jl(y))||Pu(jl(b))))&&g.push([l(y),l(b)]);return m}case Ev:{const g=[],m=s([d,g],u);for(const y of u)(e||!Pu(jl(y)))&&g.push(l(y));return m}}const{message:h}=u;return s([d,{name:f,message:h}],u)};return l},ik=(e,{json:t,lossy:n}={})=>{const a=[];return I9(!(t||n),!!t,new Map,a)(e),a},Sd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ak(ik(e,t)):structuredClone(e):(e,t)=>ak(ik(e,t));function P9(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 U9(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function B9(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||P9,a=e.options.footnoteBackLabel||U9,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 A=typeof n=="string"?n:n(f,b);typeof A=="string"&&(A={type:"text",value:A}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(f,b),className:["data-footnote-backref"]},children:Array.isArray(A)?A:[A]})}const N=g[g.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const A=N.children[N.children.length-1];A&&A.type==="text"?A.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(...k)}else g.push(...k);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(g,!0)};e.patch(h,S),d.push(S)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...Sd(u),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
1632
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
1633
- `}]}}const Yd=(function(e){if(e==null)return G9;if(typeof e=="function")return Qd(e);if(typeof e=="object")return Array.isArray(e)?F9(e):H9(e);if(typeof e=="string")return q9(e);throw new Error("Expected function, string, or object as test")});function F9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Yd(e[n]);return Qd(a);function a(...s){let l=-1;for(;++l<t.length;)if(t[l].apply(this,s))return!0;return!1}}function H9(e){const t=e;return Qd(n);function n(a){const s=a;let l;for(l in e)if(s[l]!==t[l])return!1;return!0}}function q9(e){return Qd(t);function t(n){return n&&n.type===e}}function Qd(e){return t;function t(n,a,s){return!!(V9(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function G9(){return!0}function V9(e){return e!==null&&typeof e=="object"&&"type"in e}const tN=[],W9=!0,Xm=!1,Z9="skip";function nN(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const l=Yd(s),u=a?-1:1;d(e,void 0,[])();function d(f,h,g){const m=f&&typeof f=="object"?f:{};if(typeof m.type=="string"){const b=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(f.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=tN,k,j,N;if((!t||l(f,h,g[g.length-1]||void 0))&&(b=K9(n(f,g)),b[0]===Xm))return b;if("children"in f&&f.children){const S=f;if(S.children&&b[0]!==Z9)for(j=(a?S.children.length:-1)+u,N=g.concat(S);j>-1&&j<S.children.length;){const A=S.children[j];if(k=d(A,j,N)(),k[0]===Xm)return k;j=typeof k[1]=="number"?k[1]:j+u}}return b}}}function K9(e){return Array.isArray(e)?e:typeof e=="number"?[W9,e]:e==null?tN:[e]}function Av(e,t,n,a){let s,l,u;typeof t=="function"&&typeof n!="function"?(l=void 0,u=t,s=n):(l=t,u=n,s=a),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 Jm={}.hasOwnProperty,Y9={};function Q9(e,t){const n=t||Y9,a=new Map,s=new Map,l=new Map,u={...L9,...n.handlers},d={all:h,applyData:J9,definitionById:a,footnoteById:s,footnoteCounts:l,footnoteOrder:[],handlers:u,one:f,options:n,patch:X9,wrap:tB};return Av(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?a:s,y=String(g.identifier).toUpperCase();m.has(y)||m.set(y,g)}}),d;function f(g,m){const y=g.type,b=d.handlers[y];if(Jm.call(d.handlers,y)&&b)return b(d,g,m);if(d.options.passThrough&&d.options.passThrough.includes(y)){if("children"in g){const{children:j,...N}=g,S=Sd(N);return S.children=d.all(g),S}return Sd(g)}return(d.options.unknownHandler||eB)(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 X9(e,t){e.position&&(t.position=P5(e))}function J9(e,t){let n=t;if(e&&e.data){const a=e.data.hName,s=e.data.hChildren,l=e.data.hProperties;if(typeof a=="string")if(n.type==="element")n.tagName=a;else{const u="children"in n?n.children:[n];n={type:"element",tagName:a,properties:{},children:u}}n.type==="element"&&l&&Object.assign(n.properties,Sd(l)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function eB(e,t){const n=t.data||{},a="value"in t&&!(Jm.call(n,"hProperties")||Jm.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function tB(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
1634
- `});++a<e.length;)a&&n.push({type:"text",value:`
1635
- `}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
1636
- `}),n}function 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=Q9(e,t),a=n.one(e,void 0),s=B9(n),l=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&l.children.push({type:"text",value:`
1637
- `},s),l}function nB(e,t){return e&&"run"in e?async function(n,a){const s=ok(n,{file:a,...t});await e.run(s,a)}:function(n,a){return ok(n,{file:a,...e||t})}}function lk(e){if(e)throw e}var tm,ck;function rB(){if(ck)return tm;ck=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},l=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!m)return!1;var y;for(y in h);return typeof y>"u"||e.call(h,y)},u=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},d=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(a)return a(h,g).value}else return;return h[g]};return tm=function f(){var h,g,m,y,b,k,j=arguments[0],N=1,S=arguments.length,A=!1;for(typeof j=="boolean"&&(A=j,j=arguments[1]||{},N=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});N<S;++N)if(h=arguments[N],h!=null)for(g in h)m=d(j,g),y=d(h,g),j!==y&&(A&&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(A,k,y)})):typeof y<"u"&&u(j,{name:g,newValue:y}));return j},tm}var aB=rB();const nm=Wl(aB);function eg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function iB(){const e=[],t={run:n,use:a};return t;function n(...s){let l=-1;const u=s.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);d(null,...s);function d(f,...h){const g=e[++l];let m=-1;if(f){u(f);return}for(;++m<s.length;)(h[m]===null||h[m]===void 0)&&(h[m]=s[m]);s=h,g?sB(g,d)(...h):u(null,...h)}}function a(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function sB(e,t){let n;return a;function a(...u){const d=e.length>u.length;let f;d&&u.push(s);try{f=e.apply(this,u)}catch(h){const g=h;if(d&&n)throw g;return s(g)}d||(f&&f.then&&typeof f.then=="function"?f.then(l,s):f instanceof Error?s(f):l(f))}function s(u,...d){n||(n=!0,t(u,...d))}function l(u){s(null,u)}}const na={basename:oB,dirname:lB,extname:cB,join:uB,sep:"/"};function oB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ac(e);let n=0,a=-1,s=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else a<0&&(l=!0,a=s+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let u=-1,d=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else u<0&&(l=!0,u=s+1),d>-1&&(e.codePointAt(s)===t.codePointAt(d--)?d<0&&(a=s):(d=-1,a=u));return n===a?a=u:a<0&&(a=e.length),e.slice(n,a)}function lB(e){if(ac(e),e.length===0)return".";let t=-1,n=e.length,a;for(;--n;)if(e.codePointAt(n)===47){if(a){t=n;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function cB(e){ac(e);let t=e.length,n=-1,a=0,s=-1,l=0,u;for(;t--;){const d=e.codePointAt(t);if(d===47){if(u){a=t+1;break}continue}n<0&&(u=!0,n=t+1),d===46?s<0?s=t:l!==1&&(l=1):s>-1&&(l=-1)}return s<0||n<0||l===0||l===1&&s===n-1&&s===a+1?"":e.slice(s,n)}function uB(...e){let t=-1,n;for(;++t<e.length;)ac(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":dB(n)}function dB(e){ac(e);const t=e.codePointAt(0)===47;let n=pB(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function pB(e,t){let n="",a=0,s=-1,l=0,u=-1,d,f;for(;++u<=e.length;){if(u<e.length)d=e.codePointAt(u);else{if(d===47)break;d=47}if(d===47){if(!(s===u-1||l===1))if(s!==u-1&&l===2){if(n.length<2||a!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",a=0):(n=n.slice(0,f),a=n.length-1-n.lastIndexOf("/")),s=u,l=0;continue}}else if(n.length>0){n="",a=0,s=u,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(s+1,u):n=e.slice(s+1,u),a=u-s-1;s=u,l=0}else d===46&&l>-1?l++:l=-1}return n}function ac(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const fB={cwd:hB};function hB(){return"/"}function tg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function mB(e){if(typeof e=="string")e=new URL(e);else if(!tg(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return gB(e)}function gB(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const a=t.codePointAt(n+2);if(a===70||a===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const rm=["history","path","basename","stem","extname","dirname"];class rN{constructor(t){let n;t?tg(t)?n={path:t}:typeof t=="string"||vB(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":fB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<rm.length;){const l=rm[a];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let s;for(s in n)rm.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?na.basename(this.path):void 0}set basename(t){im(t,"basename"),am(t,"basename"),this.path=na.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?na.dirname(this.path):void 0}set dirname(t){uk(this.basename,"dirname"),this.path=na.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?na.extname(this.path):void 0}set extname(t){if(am(t,"extname"),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=na.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){tg(t)&&(t=mB(t)),im(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?na.basename(this.path,this.extname):void 0}set stem(t){im(t,"stem"),am(t,"stem"),this.path=na.join(this.dirname||"",t+(this.extname||""))}fail(t,n,a){const s=this.message(t,n,a);throw s.fatal=!0,s}info(t,n,a){const s=this.message(t,n,a);return s.fatal=void 0,s}message(t,n,a){const s=new _n(t,n,a);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function am(e,t){if(e&&e.includes(na.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+na.sep+"`")}function im(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function uk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function vB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yB=(function(e){const a=this.constructor.prototype,s=a[e],l=function(){return s.apply(l,arguments)};return Object.setPrototypeOf(l,a),l}),bB={}.hasOwnProperty;class Tv extends yB{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=iB()}copy(){const t=new Tv;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(nm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(lm("data",this.frozen),this.namespace[t]=n,this):bB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(lm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const s=n.call(t,...a);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Uu(t),a=this.parser||this.Parser;return sm("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),sm("process",this.parser||this.Parser),om("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(l,u){const d=Uu(t),f=a.parse(d);a.run(f,d,function(g,m,y){if(g||!m||!y)return h(g);const b=m,k=a.stringify(b,y);kB(k)?y.value=k:y.result=k,h(g,y)});function h(g,m){g||!m?u(g):l?l(m):n(void 0,m)}}}processSync(t){let n=!1,a;return this.freeze(),sm("processSync",this.parser||this.Parser),om("processSync",this.compiler||this.Compiler),this.process(t,s),pk("processSync","process",n),a;function s(l,u){n=!0,lk(l),a=u}}run(t,n,a){dk(t),this.freeze();const s=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?l(void 0,a):new Promise(l);function l(u,d){const f=Uu(n);s.run(t,f,h);function h(g,m,y){const b=m||t;g?d(g):u?u(b):a(void 0,b,y)}}}runSync(t,n){let a=!1,s;return this.run(t,n,l),pk("runSync","run",a),s;function l(u,d){lk(u),s=d,a=!0}}stringify(t,n){this.freeze();const a=Uu(n),s=this.compiler||this.Compiler;return om("stringify",s),dk(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(lm("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(h){if(typeof h=="function")f(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...m]=h;f(g,m)}else u(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function u(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(h.plugins),h.settings&&(s.settings=nm(!0,s.settings,h.settings))}function d(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const m=h[g];l(m)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function f(h,g){let m=-1,y=-1;for(;++m<a.length;)if(a[m][0]===h){y=m;break}if(y===-1)a.push([h,...g]);else if(g.length>0){let[b,...k]=g;const j=a[y][1];eg(j)&&eg(b)&&(b=nm(!0,j,b)),a[y]=[h,b,...k]}}}}const xB=new Tv().freeze();function sm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function om(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function lm(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function dk(e){if(!eg(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 wB(e)?e:new rN(e)}function wB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function kB(e){return typeof e=="string"||SB(e)}function SB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const jB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",fk=[],hk={allowDangerousHtml:!0},CB=/^(https?|ircs?|mailto|xmpp)$/i,NB=[{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 EB(e){const t=AB(e),n=TB(e);return _B(t.runSync(t.parse(n),n),e)}function AB(e){const t=e.rehypePlugins||fk,n=e.remarkPlugins||fk,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...hk}:hk;return xB().use(o9).use(n).use(nB,a).use(t)}function TB(e){const t=e.children||"",n=new rN;return typeof t=="string"&&(n.value=t),n}function _B(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,l=t.disallowedElements,u=t.skipHtml,d=t.unwrapDisallowed,f=t.urlTransform||RB;for(const g of NB)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+jB+g.id,void 0);return Av(e,h),q5(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function h(g,m,y){if(g.type==="raw"&&y&&typeof m=="number")return u?y.children.splice(m,1):y.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let b;for(b in Xh)if(Object.hasOwn(Xh,b)&&Object.hasOwn(g.properties,b)){const k=g.properties[b],j=Xh[b];(j===null||j.includes(g.tagName))&&(g.properties[b]=f(String(k||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):l?l.includes(g.tagName):!1;if(!b&&a&&typeof m=="number"&&(b=!a(g,m,y)),b&&y&&typeof m=="number")return d&&g.children?y.children.splice(m,1,...g.children):y.children.splice(m,1),m}}}function RB(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||a!==-1&&t>a||CB.test(e.slice(0,t))?e:""}function mk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,s=n.indexOf(t);for(;s!==-1;)a++,s=n.indexOf(t,s+t.length);return a}function OB(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function aN(e,t,n){const s=Yd((n||{}).ignore||[]),l=LB(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 N=m.children.indexOf(h);let S=!1,A=[];y.lastIndex=0;let E=y.exec(h.value);for(;E;){const T=E.index,U={index:E.index,input:E.input,stack:[...g,h]};let _=b(...E,U);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?y.lastIndex=T+1:(k!==T&&A.push({type:"text",value:h.value.slice(k,T)}),Array.isArray(_)?A.push(..._):_&&A.push(_),k=T+E[0].length,S=!0),!y.global)break;E=y.exec(h.value)}return S?(k<h.value.length&&A.push({type:"text",value:h.value.slice(k)}),m.children.splice(N,1,...A)):A=[h],N+A.length}}function LB(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<n.length;){const s=n[a];t.push([MB(s[0]),DB(s[1])])}return t}function MB(e){return typeof e=="string"?new RegExp(OB(e),"g"):e}function DB(e){return typeof e=="function"?e:function(){return e}}const cm="phrasing",um=["autolink","link","image","label"];function zB(){return{transforms:[HB],enter:{literalAutolink:IB,literalAutolinkEmail:dm,literalAutolinkHttp:dm,literalAutolinkWww:dm},exit:{literalAutolink:FB,literalAutolinkEmail:BB,literalAutolinkHttp:PB,literalAutolinkWww:UB}}}function $B(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:cm,notInConstruct:um},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:cm,notInConstruct:um},{character:":",before:"[ps]",after:"\\/",inConstruct:cm,notInConstruct:um}]}}function IB(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function dm(e){this.config.enter.autolinkProtocol.call(this,e)}function PB(e){this.config.exit.autolinkProtocol.call(this,e)}function UB(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 BB(e){this.config.exit.autolinkEmail.call(this,e)}function FB(e){this.exit(e)}function HB(e){aN(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,qB],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),GB]],{ignore:["link","linkReference"]})}function qB(e,t,n,a,s){let l="";if(!iN(s)||(/^w/i.test(t)&&(n=t+n,t="",l="http://"),!VB(n)))return!1;const u=WB(n+a);if(!u[0])return!1;const d={type:"link",title:null,url:l+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[d,{type:"text",value:u[1]}]:d}function GB(e,t,n,a){return!iN(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function VB(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 WB(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const s=mk(e,"(");let l=mk(e,")");for(;a!==-1&&s>l;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),l++;return[e,n]}function iN(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||as(n)||Wd(n))&&(!t||n!==47)}sN.peek=nF;function ZB(){this.buffer()}function KB(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function YB(){this.buffer()}function QB(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function XB(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ur(this.sliceSerialize(e)).toLowerCase(),n.label=t}function JB(e){this.exit(e)}function eF(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ur(this.sliceSerialize(e)).toLowerCase(),n.label=t}function tF(e){this.exit(e)}function nF(){return"["}function sN(e,t,n,a){const s=n.createTracker(a);let l=s.move("[^");const u=n.enter("footnoteReference"),d=n.enter("reference");return l+=s.move(n.safe(n.associationId(e),{after:"]",before:l})),d(),u(),l+=s.move("]"),l}function rF(){return{enter:{gfmFootnoteCallString:ZB,gfmFootnoteCall:KB,gfmFootnoteDefinitionLabelString:YB,gfmFootnoteDefinition:QB},exit:{gfmFootnoteCallString:XB,gfmFootnoteCall:JB,gfmFootnoteDefinitionLabelString:eF,gfmFootnoteDefinition:tF}}}function aF(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:sN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,s,l,u){const d=l.createTracker(u);let f=d.move("[^");const h=l.enter("footnoteDefinition"),g=l.enter("label");return f+=d.move(l.safe(l.associationId(a),{before:f,after:"]"})),g(),f+=d.move("]:"),a.children&&a.children.length>0&&(d.shift(4),f+=d.move((t?`
1638
- `:" ")+l.indentLines(l.containerFlow(a,d.current()),t?oN:iF))),h(),f}}function iF(e,t,n){return t===0?e:oN(e,t,n)}function oN(e,t,n){return(n?"":" ")+e}const sF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];lN.peek=dF;function oF(){return{canContainEols:["delete"],enter:{strikethrough:cF},exit:{strikethrough:uF}}}function lF(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:sF}],handlers:{delete:lN}}}function cF(e){this.enter({type:"delete",children:[]},e)}function uF(e){this.exit(e)}function lN(e,t,n,a){const s=n.createTracker(a),l=n.enter("strikethrough");let u=s.move("~~");return u+=n.containerPhrasing(e,{...s.current(),before:u,after:"~"}),u+=s.move("~~"),l(),u}function dF(){return"~"}function pF(e){return e.length}function fF(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||pF,l=[],u=[],d=[],f=[];let h=0,g=-1;for(;++g<e.length;){const j=[],N=[];let S=-1;for(e[g].length>h&&(h=e[g].length);++S<e[g].length;){const A=hF(e[g][S]);if(n.alignDelimiters!==!1){const E=s(A);N[S]=E,(f[S]===void 0||E>f[S])&&(f[S]=E)}j.push(A)}u[g]=j,d[g]=N}let m=-1;if(typeof a=="object"&&"length"in a)for(;++m<h;)l[m]=gk(a[m]);else{const j=gk(a);for(;++m<h;)l[m]=j}m=-1;const y=[],b=[];for(;++m<h;){const j=l[m];let N="",S="";j===99?(N=":",S=":"):j===108?N=":":j===114&&(S=":");let A=n.alignDelimiters===!1?1:Math.max(1,f[m]-N.length-S.length);const E=N+"-".repeat(A)+S;n.alignDelimiters!==!1&&(A=N.length+A+S.length,A>f[m]&&(f[m]=A),b[m]=A),y[m]=E}u.splice(1,0,y),d.splice(1,0,b),g=-1;const k=[];for(;++g<u.length;){const j=u[g],N=d[g];m=-1;const S=[];for(;++m<h;){const A=j[m]||"";let E="",T="";if(n.alignDelimiters!==!1){const U=f[m]-(N[m]||0),_=l[m];_===114?E=" ".repeat(U):_===99?U%2?(E=" ".repeat(U/2+.5),T=" ".repeat(U/2-.5)):(E=" ".repeat(U/2),T=E):T=" ".repeat(U)}n.delimiterStart!==!1&&!m&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&A==="")&&(n.delimiterStart!==!1||m)&&S.push(" "),n.alignDelimiters!==!1&&S.push(E),S.push(A),n.alignDelimiters!==!1&&S.push(T),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 hF(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 mF(e,t,n,a){const s=n.enter("blockquote"),l=n.createTracker(a);l.move("> "),l.shift(2);const u=n.indentLines(n.containerFlow(e,l.current()),gF);return s(),u}function gF(e,t,n){return">"+(n?"":" ")+e}function vF(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 a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function yk(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
1640
- `&&vF(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
1641
- `}function yF(e,t){const n=String(e);let a=n.indexOf(t),s=a,l=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===s?++l>u&&(u=l):l=1,s=a+t.length,a=n.indexOf(t,s);return u}function bF(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 xF(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 wF(e,t,n,a){const s=xF(n),l=e.value||"",u=s==="`"?"GraveAccent":"Tilde";if(bF(e,n)){const m=n.enter("codeIndented"),y=n.indentLines(l,kF);return m(),y}const d=n.createTracker(a),f=s.repeat(Math.max(yF(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 kF(e,t,n){return(n?"":" ")+e}function _v(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function SF(e,t,n,a){const s=_v(n),l=s==='"'?"Quote":"Apostrophe",u=n.enter("definition");let d=n.enter("label");const f=n.createTracker(a);let h=f.move("[");return h+=f.move(n.safe(n.associationId(e),{before:h,after:"]",...f.current()})),h+=f.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(d=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":`
1645
- `,...f.current()}))),d(),e.title&&(d=n.enter(`title${l}`),h+=f.move(" "+s),h+=f.move(n.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),d()),u(),h}function jF(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Gl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function jd(e,t,n){const a=ho(e),s=ho(t);return a===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}cN.peek=CF;function cN(e,t,n,a){const s=jF(n),l=n.enter("emphasis"),u=n.createTracker(a),d=u.move(s);let f=u.move(n.containerPhrasing(e,{after:s,before:d,...u.current()}));const h=f.charCodeAt(0),g=jd(a.before.charCodeAt(a.before.length-1),h,s);g.inside&&(f=Gl(h)+f.slice(1));const m=f.charCodeAt(f.length-1),y=jd(a.after.charCodeAt(0),m,s);y.inside&&(f=f.slice(0,-1)+Gl(m));const b=u.move(s);return l(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},d+f+b}function CF(e,t,n){return n.options.emphasis||"*"}function NF(e,t){let n=!1;return Av(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Xm}),!!((!e.depth||e.depth<3)&&wv(e)&&(t.options.setext||n))}function EF(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(a);if(NF(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=AF;function uN(e){return e.value||""}function AF(){return"<"}dN.peek=TF;function dN(e,t,n,a){const s=_v(n),l=s==='"'?"Quote":"Apostrophe",u=n.enter("image");let d=n.enter("label");const f=n.createTracker(a);let h=f.move("![");return h+=f.move(n.safe(e.alt,{before:h,after:"]",...f.current()})),h+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(d=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=n.enter(`title${l}`),h+=f.move(" "+s),h+=f.move(n.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),d()),h+=f.move(")"),u(),h}function TF(){return"!"}pN.peek=_F;function pN(e,t,n,a){const s=e.referenceType,l=n.enter("imageReference");let u=n.enter("label");const d=n.createTracker(a);let f=d.move("![");const h=n.safe(e.alt,{before:f,after:"]",...d.current()});f+=d.move(h+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return u(),n.stack=g,l(),s==="full"||!h||h!==m?f+=d.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function _F(){return"!"}fN.peek=RF;function fN(e,t,n){let a=e.value||"",s="`",l=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(a);)s+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++l<n.unsafe.length;){const u=n.unsafe[l],d=n.compilePattern(u);let f;if(u.atBreak)for(;f=d.exec(a);){let h=f.index;a.charCodeAt(h)===10&&a.charCodeAt(h-1)===13&&h--,a=a.slice(0,h)+" "+a.slice(f.index+1)}}return s+a+s}function RF(){return"`"}function hN(e,t){const n=wv(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}mN.peek=OF;function mN(e,t,n,a){const s=_v(n),l=s==='"'?"Quote":"Apostrophe",u=n.createTracker(a);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 OF(e,t,n){return hN(e,n)?"<":"["}gN.peek=LF;function gN(e,t,n,a){const s=e.referenceType,l=n.enter("linkReference");let u=n.enter("label");const d=n.createTracker(a);let f=d.move("[");const h=n.containerPhrasing(e,{before:f,after:"]",...d.current()});f+=d.move(h+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return u(),n.stack=g,l(),s==="full"||!h||h!==m?f+=d.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function LF(){return"["}function Rv(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function MF(e){const t=Rv(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function DF(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 zF(e,t,n,a){const s=n.enter("list"),l=n.bulletCurrent;let u=e.ordered?DF(n):Rv(n);const d=e.ordered?u==="."?")":".":MF(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,a);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 IF(e,t,n,a){const s=$F(n);let l=n.bulletCurrent||Rv(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let u=l.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const d=n.createTracker(a);d.move(l+" ".repeat(u-l.length)),d.shift(u);const f=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,d.current()),g);return f(),h;function g(m,y,b){return y?(b?"":" ".repeat(u))+m:(b?l:l+" ".repeat(u-l.length))+m}}function PF(e,t,n,a){const s=n.enter("paragraph"),l=n.enter("phrasing"),u=n.containerPhrasing(e,a);return l(),s(),u}const UF=Yd(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function BF(e,t,n,a){return(e.children.some(function(u){return UF(u)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function FF(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=HF;function yN(e,t,n,a){const s=FF(n),l=n.enter("strong"),u=n.createTracker(a),d=u.move(s+s);let f=u.move(n.containerPhrasing(e,{after:s,before:d,...u.current()}));const h=f.charCodeAt(0),g=jd(a.before.charCodeAt(a.before.length-1),h,s);g.inside&&(f=Gl(h)+f.slice(1));const m=f.charCodeAt(f.length-1),y=jd(a.after.charCodeAt(0),m,s);y.inside&&(f=f.slice(0,-1)+Gl(m));const b=u.move(s+s);return l(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},d+f+b}function HF(e,t,n){return n.options.strong||"*"}function qF(e,t,n,a){return n.safe(e.value,a)}function GF(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 VF(e,t,n){const a=(vN(n)+(n.options.ruleSpaces?" ":"")).repeat(GF(n));return n.options.ruleSpaces?a.slice(0,-1):a}const bN={blockquote:mF,break:yk,code:wF,definition:SF,emphasis:cN,hardBreak:yk,heading:EF,html:uN,image:dN,imageReference:pN,inlineCode:fN,link:mN,linkReference:gN,list:zF,listItem:IF,paragraph:PF,root:BF,strong:yN,text:qF,thematicBreak:VF};function WF(){return{enter:{table:ZF,tableData:bk,tableHeader:bk,tableRow:YF},exit:{codeText:QF,table:KF,tableData:pm,tableHeader:pm,tableRow:pm}}}function ZF(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 KF(e){this.exit(e),this.data.inTable=void 0}function YF(e){this.enter({type:"tableRow",children:[]},e)}function pm(e){this.exit(e)}function bk(e){this.enter({type:"tableCell",children:[]},e)}function QF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,XF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function XF(e,t){return t==="|"?t:e}function JF(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
1651
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:u,tableCell:f,tableRow:d}};function u(b,k,j,N){return h(g(b,j,N),b.align)}function d(b,k,j,N){const S=m(b,j,N),A=h([S]);return A.slice(0,A.indexOf(`
1652
- `))}function f(b,k,j,N){const S=j.enter("tableCell"),A=j.enter("phrasing"),E=j.containerPhrasing(b,{...N,before:l,after:l});return A(),S(),E}function h(b,k){return fF(b,{align:k,alignDelimiters:a,padding:n,stringLength:s})}function g(b,k,j){const N=b.children;let S=-1;const A=[],E=k.enter("table");for(;++S<N.length;)A[S]=m(N[S],k,j);return E(),A}function m(b,k,j){const N=b.children;let S=-1;const A=[],E=k.enter("tableRow");for(;++S<N.length;)A[S]=f(N[S],b,k,j);return E(),A}function y(b,k,j){let N=bN.inlineCode(b,k,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function eH(){return{exit:{taskListCheckValueChecked:xk,taskListCheckValueUnchecked:xk,paragraph:nH}}}function tH(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:rH}}}function xk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function nH(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const a=n.children[0];if(a&&a.type==="text"){const s=t.children;let l=-1,u;for(;++l<s.length;){const d=s[l];if(d.type==="paragraph"){u=d;break}}u===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function rH(e,t,n,a){const s=e.children[0],l=typeof e.checked=="boolean"&&s&&s.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",d=n.createTracker(a);l&&d.move(u);let f=bN.listItem(e,t,n,{...a,...d.current()});return l&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),f;function h(g){return g+u}}function aH(){return[zB(),rF(),oF(),WF(),eH()]}function iH(e){return{extensions:[$B(),aF(e),lF(),JF(e),tH()]}}const sH={tokenize:pH,partial:!0},xN={tokenize:fH,partial:!0},wN={tokenize:hH,partial:!0},kN={tokenize:mH,partial:!0},oH={tokenize:gH,partial:!0},SN={name:"wwwAutolink",tokenize:uH,previous:CN},jN={name:"protocolAutolink",tokenize:dH,previous:NN},Ba={name:"emailAutolink",tokenize:cH,previous:EN},la={};function lH(){return{text:la}}let Zi=48;for(;Zi<123;)la[Zi]=Ba,Zi++,Zi===58?Zi=65:Zi===91&&(Zi=97);la[43]=Ba;la[45]=Ba;la[46]=Ba;la[95]=Ba;la[72]=[Ba,jN];la[104]=[Ba,jN];la[87]=[Ba,SN];la[119]=[Ba,SN];function cH(e,t,n){const a=this;let s,l;return u;function u(m){return!ng(m)||!EN.call(a,a.previous)||Ov(a.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(m))}function d(m){return ng(m)?(e.consume(m),d):m===64?(e.consume(m),f):n(m)}function f(m){return m===46?e.check(oH,g,h)(m):m===45||m===95||An(m)?(l=!0,e.consume(m),f):g(m)}function h(m){return e.consume(m),s=!0,f}function g(m){return l&&s&&Dn(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function uH(e,t,n){const a=this;return s;function s(u){return u!==87&&u!==119||!CN.call(a,a.previous)||Ov(a.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(sH,e.attempt(xN,e.attempt(wN,l),n),n)(u))}function l(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function dH(e,t,n){const a=this;let s="",l=!1;return u;function u(m){return(m===72||m===104)&&NN.call(a,a.previous)&&!Ov(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(m),e.consume(m),d):n(m)}function d(m){if(Dn(m)&&s.length<5)return s+=String.fromCodePoint(m),e.consume(m),d;if(m===58){const y=s.toLowerCase();if(y==="http"||y==="https")return e.consume(m),f}return n(m)}function f(m){return m===47?(e.consume(m),l?h:(l=!0,f)):n(m)}function h(m){return m===null||wd(m)||Tt(m)||as(m)||Wd(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 pH(e,t,n){let a=0;return s;function s(u){return(u===87||u===119)&&a<3?(a++,e.consume(u),s):u===46&&a===3?(e.consume(u),l):n(u)}function l(u){return u===null?n(u):t(u)}}function fH(e,t,n){let a,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&&Wd(h)?f(h):(l=!0,e.consume(h),u)}function d(h){return h===95?a=!0:(s=a,a=void 0),e.consume(h),u}function f(h){return s||a||!l?n(h):t(h)}}function hH(e,t){let n=0,a=0;return s;function s(u){return u===40?(n++,e.consume(u),s):u===41&&a<n?l(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(kN,t,l)(u):u===null||Tt(u)||as(u)?t(u):(e.consume(u),s)}function l(u){return u===41&&a++,e.consume(u),s}}function mH(e,t,n){return a;function a(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),a):d===38?(e.consume(d),l):d===93?(e.consume(d),s):d===60||d===null||Tt(d)||as(d)?t(d):n(d)}function s(d){return d===null||d===40||d===91||Tt(d)||as(d)?t(d):a(d)}function l(d){return Dn(d)?u(d):n(d)}function u(d){return d===59?(e.consume(d),a):Dn(d)?(e.consume(d),u):n(d)}}function gH(e,t,n){return a;function a(l){return e.consume(l),s}function s(l){return An(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!Dn(e)}function EN(e){return!(e===47||ng(e))}function ng(e){return e===43||e===45||e===46||e===95||An(e)}function Ov(e){let t=e.length,n=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){n=!0;break}if(a._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const vH={tokenize:CH,partial:!0};function yH(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:kH,continuation:{tokenize:SH},exit:jH}},text:{91:{name:"gfmFootnoteCall",tokenize:wH},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:bH,resolveTo:xH}}}}function bH(e,t,n){const a=this;let s=a.events.length;const l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u;for(;s--;){const f=a.events[s][1];if(f.type==="labelImage"){u=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return d;function d(f){if(!u||!u._balanced)return n(f);const h=Ur(a.sliceSerialize({start:u.end,end:a.now()}));return h.codePointAt(0)!==94||!l.includes(h.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function xH(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},d=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...d),e}function wH(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l=0,u;return d;function d(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),f}function f(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(m){if(l>999||m===93&&!u||m===null||m===91||Tt(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return s.includes(Ur(a.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return 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 kH(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l,u=0,d;return f;function f(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(k)}function g(k){if(u>999||k===93&&!d||k===null||k===91||Tt(k))return n(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return l=Ur(a.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return 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 SH(e,t,n){return e.check(rc,t,e.attempt(vH,t,n))}function jH(e){e.exit("gfmFootnoteDefinition")}function CH(e,t,n){const a=this;return dt(e,s,"gfmFootnoteDefinitionIndent",5);function s(l){const u=a.events[a.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(l):n(l)}}function NH(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:l,resolveAll:s};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function s(u,d){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let h=f;for(;h--;)if(u[h][0]==="exit"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[h][1].end.offset-u[h][1].start.offset){u[f][1].type="strikethroughSequence",u[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},u[h][1].start),end:Object.assign({},u[f][1].end)},m={type:"strikethroughText",start:Object.assign({},u[h][1].end),end:Object.assign({},u[f][1].start)},y=[["enter",g,d],["enter",u[h][1],d],["exit",u[h][1],d],["enter",m,d]],b=d.parser.constructs.insideSpan.null;b&&cr(y,y.length,0,Zd(b,u.slice(h+1,f),d)),cr(y,y.length,0,[["exit",m,d],["enter",u[f][1],d],["exit",u[f][1],d],["exit",g,d]]),cr(u,h-1,f-h+3,y),f=h+y.length-2;break}}for(f=-1;++f<u.length;)u[f][1].type==="strikethroughSequenceTemporary"&&(u[f][1].type="data");return u}function l(u,d,f){const h=this.previous,g=this.events;let m=0;return y;function y(k){return h===126&&g[g.length-1][1].type!=="characterEscape"?f(k):(u.enter("strikethroughSequenceTemporary"),b(k))}function b(k){const j=ho(h);if(k===126)return m>1?f(k):(u.consume(k),m++,b);if(m<2&&!n)return f(k);const N=u.exit("strikethroughSequenceTemporary"),S=ho(k);return N._open=!S||S===2&&!!j,N._close=!j||j===2&&!!S,d(k)}}}class EH{constructor(){this.map=[]}add(t,n,a){AH(this,t,n,a)}consume(t){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let s=a.pop();for(;s;){for(const l of s)t.push(l);s=a.pop()}this.map.length=0}}function AH(e,t,n,a){let s=0;if(!(n===0&&a.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...a);return}s+=1}e.map.push([t,n,a])}}function TH(e,t){let n=!1;const a=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=a.length-1;a[l]=a[l]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function _H(){return{flow:{null:{name:"table",tokenize:RH,resolveAll:OH}}}}function RH(e,t,n){const a=this;let s=0,l=0,u;return d;function d(R){let $=a.events.length-1;for(;$>-1;){const I=a.events[$][1].type;if(I==="lineEnding"||I==="linePrefix")$--;else break}const F=$>-1?a.events[$][1].type:null,K=F==="tableHead"||F==="tableRow"?_:f;return K===_&&a.parser.lazy[a.now().line]?n(R):K(R)}function f(R){return e.enter("tableHead"),e.enter("tableRow"),h(R)}function h(R){return R===124||(u=!0,l+=1),g(R)}function g(R){return R===null?n(R):Pe(R)?l>1?(l=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),b):n(R):it(R)?dt(e,g,"whitespace")(R):(l+=1,u&&(u=!1,s+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),m(R)))}function m(R){return R===null||R===124||Tt(R)?(e.exit("data"),g(R)):(e.consume(R),R===92?y:m)}function y(R){return R===92||R===124?(e.consume(R),m):m(R)}function b(R){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(R):(e.enter("tableDelimiterRow"),u=!1,it(R)?dt(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):k(R))}function k(R){return R===45||R===58?N(R):R===124?(u=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),j):U(R)}function j(R){return it(R)?dt(e,N,"whitespace")(R):N(R)}function N(R){return R===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),S):R===45?(l+=1,S(R)):R===null||Pe(R)?T(R):U(R)}function S(R){return R===45?(e.enter("tableDelimiterFiller"),A(R)):U(R)}function A(R){return R===45?(e.consume(R),A):R===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(R))}function E(R){return it(R)?dt(e,T,"whitespace")(R):T(R)}function T(R){return R===124?k(R):R===null||Pe(R)?!u||s!==l?U(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):U(R)}function U(R){return n(R)}function _(R){return e.enter("tableRow"),z(R)}function z(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),z):R===null||Pe(R)?(e.exit("tableRow"),t(R)):it(R)?dt(e,z,"whitespace")(R):(e.enter("data"),q(R))}function q(R){return R===null||R===124||Tt(R)?(e.exit("data"),z(R)):(e.consume(R),R===92?D:q)}function D(R){return R===92||R===124?(e.consume(R),q):q(R)}}function OH(e,t){let n=-1,a=!0,s=0,l=[0,0,0,0],u=[0,0,0,0],d=!1,f=0,h,g,m;const y=new EH;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"?(a=!0,m=void 0,l=[0,0,0,0],u=[0,n+1,0,0],d&&(d=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",g,t]])),s=k.type==="tableDelimiterRow"?2:g?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,u[2]===0&&(l[1]!==0&&(u[0]=u[1],m=Bu(y,t,l,s,void 0,m),l=[0,0,0,0]),u[2]=n)):k.type==="tableCellDivider"&&(a?a=!1:(l[1]!==0&&(u[0]=u[1],m=Bu(y,t,l,s,void 0,m)),l=u,u=[l[1],n,0,0])):k.type==="tableHead"?(d=!0,f=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(f=n,l[1]!==0?(u[0]=u[1],m=Bu(y,t,l,s,n,m)):u[1]!==0&&(m=Bu(y,t,u,s,n,m)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&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=TH(t.events,n))}return e}function Bu(e,t,n,a,s,l){const u=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(l.end=Object.assign({},eo(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const f=eo(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=eo(t.events,n[2]),g=eo(t.events,n[3]),m={type:d,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",m,t]]),a!==2){const y=t.events[n[2]],b=t.events[n[3]];if(y[1].end=Object.assign({},b[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,j=n[3]-n[2]-1;e.add(k,j,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return s!==void 0&&(l.end=Object.assign({},eo(t.events,s)),e.add(s,0,[["exit",l,t]]),l=void 0),l}function wk(e,t,n,a,s){const l=[],u=eo(t.events,n);s&&(s.end=Object.assign({},u),l.push(["exit",s,t])),a.end=Object.assign({},u),l.push(["exit",a,t]),e.add(n+1,0,l)}function eo(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const LH={name:"tasklistCheck",tokenize:DH};function MH(){return{text:{91:LH}}}function DH(e,t,n){const a=this;return s;function s(f){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),l)}function l(f){return 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:zH},t,n)(f):n(f)}}function zH(e,t,n){return dt(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function $H(e){return $C([lH(),yH(),NH(e),_H(),MH()])}const IH={};function PH(e){const t=this,n=e||IH,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),l=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),u=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push($H(n)),l.push(aH()),u.push(iH(n))}function UH(e){aN(e,[/\r?\n|\r/g,BH])}function BH(){return{type:"break"}}function FH(){return function(e){UH(e)}}const AN=[{aliases:{sh:"sh",shell:"sh",zsh:"sh",bash:"bash"},load:()=>gt(()=>import("./bash-Yzrsuije.js"),[])},{aliases:{css:"css"},load:()=>gt(()=>import("./css-CLj8gQPS.js"),[])},{aliases:{diff:"diff",patch:"diff"},load:()=>gt(()=>import("./diff-D97Zzqfu.js"),[])},{aliases:{dockerfile:"dockerfile",docker:"dockerfile"},load:()=>gt(()=>import("./dockerfile-BcOcwvcX.js"),[])},{aliases:{go:"go",golang:"go"},load:()=>gt(()=>import("./go-C27-OAKa.js"),[])},{aliases:{html:"html"},load:()=>gt(()=>import("./html-pp8916En.js"),__vite__mapDeps([3,4,5]))},{aliases:{js:"js",javascript:"js"},load:()=>gt(()=>import("./javascript-wDzz0qaB.js"),[])},{aliases:{json:"json"},load:()=>gt(()=>import("./json-Cp-IABpG.js"),[])},{aliases:{jsx:"jsx"},load:()=>gt(()=>import("./jsx-g9-lgVsj.js"),[])},{aliases:{md:"md",markdown:"md"},load:()=>gt(()=>import("./markdown-Cvjx9yec.js"),[])},{aliases:{py:"py",python:"py"},load:()=>gt(()=>import("./python-B6aJPvgy.js"),[])},{aliases:{rust:"rust",rs:"rust"},load:()=>gt(()=>import("./rust-B1yitclQ.js"),[])},{aliases:{solidity:"solidity",sol:"solidity"},load:()=>gt(()=>import("./solidity-rGO070M0.js"),[])},{aliases:{sparql:"sparql"},load:()=>gt(()=>import("./sparql-DVZY-KUA.js"),[])},{aliases:{sql:"sql"},load:()=>gt(()=>import("./sql-BLtJtn59.js"),[])},{aliases:{toml:"toml"},load:()=>gt(()=>import("./toml-vGWfd6FD.js"),[])},{aliases:{tsx:"tsx"},load:()=>gt(()=>import("./tsx-COt5Ahok.js"),[])},{aliases:{ts:"ts",typescript:"ts"},load:()=>gt(()=>import("./typescript-BPQ3VLAy.js"),[])},{aliases:{xml:"xml"},load:()=>gt(()=>import("./xml-B8PEiB0p.js"),[])},{aliases:{yaml:"yaml",yml:"yaml"},load:()=>gt(()=>import("./yaml-Buea-lGh.js"),[])}],TN=Object.freeze(Object.assign({},...AN.map(({aliases:e})=>e)));Object.freeze(Object.keys(TN));function HH(e){if(!e)return null;const t=e.toLowerCase().trim();return TN[t]??null}async function cV(){return(await Promise.all(AN.map(({load:t})=>t()))).flatMap(({default:t})=>t).filter((t,n,a)=>a.findIndex(s=>s.name===t.name)===n)}let Cl=null;function qH(){return Cl||(Cl=gt(()=>import("./shikiHighlighter-C6lRYd1O.js"),[]).then(e=>e.createHighlighter()).catch(e=>{throw Cl=null,e}),Cl)}function GH({code:e,lang:t}){const n=HH(t),[a,s]=w.useState(null),[l,u]=w.useState(!1),f=Vn(m=>m.theme)==="light"?"github-light":"github-dark",h=w.useRef(null);w.useEffect(()=>{if(!n){s(null);return}let m=!1;return qH().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(lO,{size:14,"aria-hidden":"true"}):o.jsx(fO,{size:14,"aria-hidden":"true"})}),o.jsx("span",{className:"v10-md-copy-announce","aria-live":"polite",children:l?"Copied":""}),n&&o.jsx("span",{className:"v10-md-pre-lang","aria-hidden":"true",children:n}),a?o.jsx("div",{className:"v10-md-pre-rendered",dangerouslySetInnerHTML:{__html:a}}):o.jsx("pre",{className:"v10-md-pre-fallback",children:o.jsx("code",{children:e})})]})}function VH(){return e=>{let t="none",n=null;const a=new Set(["img","hr","br"]),s=(d,f)=>{const h=d.children;if(Array.isArray(h))for(let g=0;g<h.length;g++){const m=h[g];if(m.type==="text"&&typeof m.value=="string"&&m.value.trim().length>0)f?t="code":(n={siblings:h,index:g},t="text");else if(m.type==="element"){const y=m.tagName;y==="pre"?(t="code",s(m,!0)):y&&a.has(y)?t="leaf":s(m,f)}}},l=e;s(l,!1);const u={type:"element",tagName:"span",properties:{className:["v10-chat-cursor"]},children:[]};if(t==="text"&&n){const{siblings:d,index:f}=n;d.splice(f+1,0,u)}else t==="leaf"&&Array.isArray(l.children)&&l.children.push(u)}}function WH(e){return e?/^https?:\/\//i.test(e)?"http":/^mailto:/i.test(e)?"mailto":"inert":"inert"}function _N({content:e,streaming:t}){return o.jsx("div",{className:"v10-md",children:o.jsx(EB,{remarkPlugins:[PH,FH],rehypePlugins:t?[VH]:[],components:{img:({src:n,alt:a,title:s})=>o.jsxs("span",{className:"v10-md-image-placeholder",title:s||(typeof n=="string"?n:void 0),children:["[image",a?`: ${a}`:"","]"]}),h1:({children:n})=>o.jsx("h1",{className:"v10-md-h1",children:n}),h2:({children:n})=>o.jsx("h2",{className:"v10-md-h2",children:n}),h3:({children:n})=>o.jsx("h3",{className:"v10-md-h3",children:n}),h4:({children:n})=>o.jsx("h4",{className:"v10-md-h4",children:n}),h5:({children:n})=>o.jsx("h5",{className:"v10-md-h5",children:n}),h6:({children:n})=>o.jsx("h6",{className:"v10-md-h6",children:n}),p:({children:n})=>o.jsx("p",{className:"v10-md-p",children:n}),ul:({children:n})=>o.jsx("ul",{className:"v10-md-ul",children:n}),ol:({children:n})=>o.jsx("ol",{className:"v10-md-ol",children:n}),li:({children:n})=>o.jsx("li",{className:"v10-md-li",children:n}),a:({href:n,children:a})=>{const s=WH(n);return s==="http"?o.jsx("a",{className:"v10-md-link",href:n,target:"_blank",rel:"noopener noreferrer",children:a}):s==="mailto"?o.jsx("a",{className:"v10-md-link",href:n,children:a}):o.jsx("span",{className:"v10-md-link v10-md-link-inert",title:n,children:a})},blockquote:({children:n})=>o.jsx("blockquote",{className:"v10-md-blockquote",children:n}),hr:()=>o.jsx("hr",{className:"v10-md-hr"}),table:({children:n})=>o.jsx("div",{className:"v10-md-table-scroll",children:o.jsx("table",{className:"v10-md-table",children:n})}),thead:({children:n,node:a,...s})=>o.jsx("thead",{className:"v10-md-thead",...s,children:n}),tbody:({children:n,node:a,...s})=>o.jsx("tbody",{className:"v10-md-tbody",...s,children:n}),tr:({children:n,node:a,...s})=>o.jsx("tr",{className:"v10-md-tr",...s,children:n}),th:({children:n,node:a,...s})=>o.jsx("th",{className:"v10-md-th",...s,children:n}),td:({children:n,node:a,...s})=>o.jsx("td",{className:"v10-md-td",...s,children:n}),pre:({children:n,node:a})=>{var l,u,d;const s=(l=a==null?void 0:a.children)==null?void 0:l[0];if((s==null?void 0:s.tagName)==="code"){const f=((d=(u=s.properties)==null?void 0:u.className)==null?void 0:d[0])??"",h=/language-([\w-]+)/.exec(f),g=(s.children??[]).map(m=>(m==null?void 0:m.value)??"").join("").replace(/\n$/,"");return o.jsx(GH,{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 ZH=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"})]}),KH=Ve.lazy(()=>gt(()=>import("./Operations-BO2C3UWB.js"),__vite__mapDeps([6,1])).then(e=>({default:e.OperationsPage}))),YH=Ve.lazy(()=>gt(()=>import("./AgentHub-D2vaQxlw.js"),[]).then(e=>({default:e.AgentHubPage}))),QH=Ve.lazy(()=>gt(()=>import("./Settings-DC_d9STV.js"),[]).then(e=>({default:e.SettingsPage}))),XH=Ve.lazy(()=>gt(()=>import("./AgentProfilePage-BgSTdsjD.js"),[]).then(e=>({default:e.AgentProfilePage}))),JH=Ve.lazy(()=>gt(()=>import("./PublishingConviction-xKRNHbzk.js"),__vite__mapDeps([7,8])).then(e=>({default:e.PublishingConvictionPage}))),e7=Ve.lazy(()=>gt(()=>import("./ConvictionDetailView-CieVypna.js"),__vite__mapDeps([9,8])).then(e=>({default:e.ConvictionDetailView})));function t7(){const{tabs:e,activeTabId:t,setActiveTab:n,closeTab:a}=fn();return o.jsx("div",{className:"v10-center-tabs",children:e.map(s=>o.jsxs("button",{className:`v10-center-tab ${s.id===t?"active":""}`,onClick:()=>n(s.id),children:[o.jsx("span",{className:"v10-center-tab-label",children:s.label}),s.closable&&o.jsx("span",{className:"v10-center-tab-close",onClick:l=>{l.stopPropagation(),a(s.id)},children:ZH})]},s.id))})}const n7=["text/","application/json","application/xml","application/javascript","application/x-yaml"];function r7(e){return n7.some(t=>e.startsWith(t))}function a7({docRef:e,contentType:t}){const{tabs:n,activeTabId:a,closeTab:s}=fn(),l=fn(R=>R.setActiveTab),[u,d]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState(""),[y,b]=w.useState(!0),[k,j]=w.useState(null),[N,S]=w.useState("formatted"),A=e.startsWith("urn:dkg:file:"),E=n.find(R=>R.id===a),T=(E==null?void 0:E.label)??"Document",U=()=>{const R=n.find($=>$.id.startsWith("project:"));R&&l(R.id),s(a)};w.useEffect(()=>{let R=!1;if(b(!0),j(null),d(null),h(null),m(""),!A){b(!1);return}const $=e.replace("urn:dkg:file:",""),F=new AbortController;return fetch(Vu($,t||void 0),{headers:Ft(),signal:F.signal}).then(async K=>{if(!K.ok)throw new Error(`HTTP ${K.status}`);const I=K.headers.get("content-type")??"application/octet-stream";if(!R)if(m(I),r7(I)){const H=await K.text();R||(d(H),b(!1))}else if(I.startsWith("image/")){const H=await K.blob();R||(h(URL.createObjectURL(H)),b(!1))}else if(I==="application/pdf"){const H=await K.blob();R||(h(URL.createObjectURL(H)),b(!1))}else{const H=await K.text();R||(d(H),b(!1))}}).catch(K=>{R||(j(K.message),b(!1))}),()=>{R=!0,F.abort()}},[e,A,t]),w.useEffect(()=>{S("formatted")},[e]),w.useEffect(()=>{const R=f;return()=>{R&&URL.revokeObjectURL(R)}},[f]);const _=g.startsWith("image/"),z=g==="application/pdf",q=g.startsWith("text/markdown")||t.startsWith("text/markdown"),D=!y&&!k&&A&&q&&u!==null;return o.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},children:[o.jsxs("div",{style:{flexShrink:0,display:"flex",alignItems:"center",gap:10,padding:"8px 16px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:[o.jsx("button",{onClick:U,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:["📄 ",T]}),D&&o.jsx("div",{role:"group","aria-label":"Document view mode",style:{marginLeft:"auto",display:"flex",gap:2,padding:2,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-surface)"},children:["formatted","raw"].map(R=>{const $=N===R;return o.jsx("button",{type:"button","aria-pressed":$,onClick:()=>S(R),style:{border:"none",borderRadius:4,cursor:"pointer",padding:"3px 12px",fontSize:11,fontWeight:600,fontFamily:"var(--font-sans)",color:$?"var(--text-primary)":"var(--text-secondary)",background:$?"var(--bg-elevated)":"transparent"},children:R==="formatted"?"Formatted":"Raw"},R)})})]}),o.jsx("div",{style:{flex:1,overflow:"auto",padding:"20px 24px"},children:A?o.jsxs(o.Fragment,{children:[y&&o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:12},children:"Loading document..."}),k&&o.jsxs("div",{style:{color:"var(--accent-red)",fontSize:12},children:["Failed to load: ",k]}),!y&&_&&f&&o.jsx("img",{src:f,alt:T,style:{maxWidth:"100%",borderRadius:8}}),!y&&z&&f&&o.jsx("iframe",{src:f,title:T,style:{width:"100%",height:"100%",border:"none",borderRadius:8}}),u!==null&&!_&&!z&&q&&N==="formatted"&&o.jsx("div",{style:{background:"var(--bg-surface)",borderRadius:8,padding:"16px 20px",border:"1px solid var(--border-default)",color:"var(--text-primary)"},children:o.jsx(_N,{content:u})}),u!==null&&!_&&!z&&!(q&&N==="formatted")&&o.jsx("pre",{style:{fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.7,color:"var(--text-primary)",whiteSpace:"pre-wrap",wordBreak:"break-word",background:"var(--bg-surface)",borderRadius:8,padding:16,border:"1px solid var(--border-default)",margin:0},children:u})]}):o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,height:"100%",color:"var(--text-tertiary)",textAlign:"center"},children:[o.jsx("span",{style:{fontSize:28,opacity:.6},children:"📄"}),o.jsx("span",{style:{fontSize:13,fontWeight:600,color:"var(--text-secondary)"},children:"Source file not available for this document"}),o.jsx("span",{style:{fontSize:12,maxWidth:360,lineHeight:1.6},children:"This document was indexed into the graph without a stored source file, so there is nothing to preview here. You can still explore its extracted entities and relationships in the graph."})]})})]})}function i7(){const e=fn(t=>t.activeTabId);if(e==="dashboard")return o.jsx(oM,{});if(e==="operations")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading operations..."}),children:o.jsx(KH,{})});if(e==="agent-hub")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading agent hub..."}),children:o.jsx(YH,{})});if(e==="settings")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading settings..."}),children:o.jsx(QH,{})});if(e==="conviction")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading Publisher Conviction..."}),children:o.jsx(JH,{})});if(e==="memory-stack")return o.jsx(p5,{});if(e===Xg)return o.jsx(QP,{});if(e.startsWith("project:")){const t=e.slice(8);return o.jsx(KP,{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(e7,{accountId:t})})}if(e.startsWith("agent:")){const t=e.slice(6),n=t.indexOf("|");if(n>0){const a=t.slice(0,n),s=t.slice(n+1),l=s.includes(":")?s:`urn:dkg:agent:${s}`;return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading agent…"}),children:o.jsx(XH,{contextGraphId:a,agentUri:l})})}}if(e.startsWith(tv)){const{docRef:t,contentType:n}=UD(e);return o.jsx(a7,{docRef:t,contentType:n})}return e.startsWith("wm:")?o.jsx(Zh,{layer:"wm",contextGraphId:e.slice(3)}):e.startsWith("swm:")?o.jsx(Zh,{layer:"swm",contextGraphId:e.slice(4)}):e.startsWith("vm:")?o.jsx(Zh,{layer:"vm",contextGraphId:e.slice(3)}):o.jsx("div",{className:"v10-view-placeholder",children:o.jsxs("p",{style:{color:"var(--text-tertiary)",fontSize:12},children:['View "',e,'" coming soon.']})})}function s7(){return o.jsxs("div",{className:"v10-panel-center",children:[o.jsx(t7,{}),o.jsx("div",{className:"v10-center-content",children:o.jsx(i7,{})})]})}const o7=["Node Log","Transactions"],l7=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"})}),c7=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"})]}),u7=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"})]}),d7=/(\x1B\[[0-9;]*[mGKHFJA-Z]|\[[0-9;]*m)/g;function p7(e){return e.replace(d7,"")}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 f7={error:"var(--accent-red, #ef4444)",warn:"var(--accent-yellow, #f59e0b)",info:"var(--text-primary)",debug:"var(--text-tertiary)"};function h7(e){const t=w.useRef(null),n=w.useRef(!0);return w.useEffect(()=>{const a=t.current;if(!a)return;const s=()=>{n.current=a.scrollHeight-a.scrollTop-a.clientHeight<40};return a.addEventListener("scroll",s),()=>a.removeEventListener("scroll",s)},[]),w.useEffect(()=>{n.current&&t.current&&(t.current.scrollTop=t.current.scrollHeight)},[e]),t}function m7(){const[e,t]=w.useState([]),[n,a]=w.useState(""),[s,l]=w.useState("all"),u=w.useCallback(()=>{Tn.fetchNodeLog({lines:300,q:n||void 0}).then(({lines:g})=>t((g??[]).map(p7))).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=h7(f);return o.jsxs("div",{className:"v10-log-container",children:[o.jsxs("div",{className:"v10-log-toolbar",children:[o.jsx("input",{id:"dkg-node-log-filter",name:"dkg-node-log-filter",type:"text",placeholder:"Filter logs...",className:"v10-log-filter",value:n,onChange:g=>a(g.target.value),"aria-label":"Filter node log lines"}),o.jsxs("select",{id:"dkg-node-log-level",name:"dkg-node-log-level",className:"v10-log-level-select",value:s,onChange:g=>l(g.target.value),"aria-label":"Filter node log level",children:[o.jsx("option",{value:"all",children:"All"}),o.jsx("option",{value:"error",children:"Error"}),o.jsx("option",{value:"warn",children:"Warn"}),o.jsx("option",{value:"info",children:"Info"}),o.jsx("option",{value:"debug",children:"Debug"})]})]}),o.jsxs("div",{className:"v10-log-output",ref:h,children:[d.map((g,m)=>o.jsx("div",{className:"v10-log-line",style:{color:f7[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 g7=new Set(["publish","publishFromSWM","update","ka-update","verify","reconstruct"]),v7={publish:"#22c55e",publishFromSWM:"#16a34a",update:"#14b8a6","ka-update":"#0d9488",verify:"#8b5cf6",reconstruct:"#fb923c"};function y7(){const[e,t]=w.useState([]),[n,a]=w.useState(null),s=w.useCallback(()=>{const l=String(Date.now()-216e5),u=[...g7].join(",");Tn.fetchOperationsWithPhases({limit:"100",from:l,names:u}).then(d=>{t((d==null?void 0:d.operations)??[])}).catch(()=>{})},[]);return w.useEffect(()=>{s();const l=setInterval(s,1e4);return()=>clearInterval(l)},[s]),e.length===0?o.jsx("div",{style:{padding:"20px 16px",color:"var(--text-tertiary)",fontSize:12},children:"No publish, update, or verify activity in the last 6 hours."}):o.jsx("div",{className:"v10-log-output",style:{overflowY:"auto",flex:1},children:o.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:11},children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)",color:"var(--text-secondary)",textAlign:"left"},children:[o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Type"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"ID"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Status"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Duration"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Time"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Tx Hash"})]})}),o.jsx("tbody",{children:e.map(l=>{const u=(l.phases??[]).find(h=>h.phase==="chain"),d=l.tx_hash??(u==null?void 0:u.tx_hash),f=n===l.operation_id;return o.jsxs(Ve.Fragment,{children:[o.jsxs("tr",{onClick:()=>a(h=>h===l.operation_id?null:l.operation_id),style:{borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",background:f?"rgba(255,255,255,.03)":void 0},children:[o.jsx("td",{style:{padding:"7px 12px",color:v7[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?h4(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 b7(){const{bottomCollapsed:e,toggleBottom:t,bottomMaximised:n,toggleBottomMaximised:a,bottomHeight:s,setBottomHeight:l}=Vn(),[u,d]=w.useState("Node Log"),f=w.useRef(null),h=w.useRef(s);h.current=s,w.useEffect(()=>{const m=f.current;if(!m)return;let y=0;const b=N=>{const S=y-N.clientY;y=N.clientY,l(h.current+S)},k=()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",k),document.body.style.cursor="",document.body.style.userSelect="",m.classList.remove("active")},j=N=>{N.preventDefault(),y=N.clientY,document.addEventListener("mousemove",b),document.addEventListener("mouseup",k),document.body.style.cursor="row-resize",document.body.style.userSelect="none",m.classList.add("active")};return m.addEventListener("mousedown",j),()=>m.removeEventListener("mousedown",j)},[l]);const g=e?void 0:n?"80vh":Math.min(s,sd());return o.jsxs("div",{className:`v10-panel-bottom ${e?"collapsed":""} ${n?"maximised":""}`,style:e?void 0:{height:g},children:[!e&&!n&&o.jsx("div",{className:"v10-resize-handle-v",ref:f,title:"Drag to resize"}),o.jsxs("div",{className:"v10-bottom-tabs",children:[o7.map(m=>o.jsx("button",{className:`v10-bottom-tab ${m===u?"active":""}`,onClick:()=>{d(m),e&&t()},children:m},m)),o.jsx("div",{style:{flex:1}}),o.jsx("button",{className:"v10-bottom-toggle",onClick:a,title:n?"Restore":"Maximise",style:{display:e?"none":void 0},children:n?u7:c7}),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:l7})})]}),!e&&o.jsxs("div",{className:"v10-bottom-content",children:[u==="Node Log"&&o.jsx(m7,{}),u==="Transactions"&&o.jsx(y7,{})]})]})}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 Cd(e){if(e==null||e==="")return"";const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.valueOf())?typeof e=="string"?e:"":t.toLocaleString([],{dateStyle:"medium",timeStyle:"short"})}function rg(e){if(e==null||e==="")return;const t=e instanceof Date?e:new Date(e);if(!Number.isNaN(t.valueOf()))return t.toISOString()}function x7(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function w7(e){var n;const t=((n=e.split(".").pop())==null?void 0:n.toLowerCase())??"";return["md","txt","csv","json","xml","yaml","yml"].includes(t)?"TXT":["pdf"].includes(t)?"PDF":["docx","doc"].includes(t)?"DOC":["png","jpg","jpeg","webp"].includes(t)?"IMG":["py","ts","js","tsx","jsx","java","go","rs","c","cpp"].includes(t)?"CODE":"FILE"}function ag(e,t){var n;return((n=e.find(a=>a.id===t))==null?void 0:n.name)??t}function k7(e){return e.startsWith("did:dkg:context-graph:")?e:`did:dkg:context-graph:${e}`}function S7(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 ON(e){return e.status==="queued"||e.status==="completed"||e.status==="skipped"}function LN(e){return e.name.trim()}function j7(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:LN(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 C7(e){const t=[];return{results:e.flatMap(a=>{if(a.status!=="skipped"||!a.result)return[];t.push(a.id);const s=a.result,l=s.extraction;return[{id:a.id,fileName:LN(a.file),contextGraphId:a.contextGraphId,assertionName:a.assertionName,assertionUri:s.assertionUri,fileHash:s.fileHash,detectedContentType:s.detectedContentType,extractionStatus:"skipped",pipelineUsed:l.pipelineUsed??null,tripleCount:l.tripleCount??l.triplesWritten??0,...s.rootEntity?{rootEntity:s.rootEntity}:{},...l.mdIntermediateHash?{mdIntermediateHash:l.mdIntermediateHash}:{},...l.error?{error:l.error}:{}}]}),deliveredDraftIds:t}}function MN(e){return e.length===0?"":e.length===1?`Attachment import result: ${S7(e[0].fileName)}.`:`Attached ${e.length} document import results.`}function N7(e,t){const n=[RN(e),MN(t)].filter(a=>a.length>0).map(a=>a.replace(/\.$/,""));return n.length?`${n.join("; ")}.`:""}function E7(e,t,n){const a=[];if(t){const s=ag(e,t);a.push({key:"target_context_graph",label:"Target context graph id",value:t}),a.push({key:"target_context_graph_uri",label:"Target context graph URI",value:k7(t)}),a.push({key:"target_context_graph_name",label:"Target context graph name",value:s})}return n!=null&&n.agentAddress&&a.push({key:"current_agent_address",label:"Current agent address",value:n.agentAddress}),n!=null&&n.agentDid&&a.push({key:"current_agent_did",label:"Current agent DID",value:n.agentDid}),n!=null&&n.peerId&&a.push({key:"current_agent_peer_id",label:"Current agent peer ID",value:n.peerId}),a}const A7="https://docs.openclaw.ai/",T7="https://github.com/openclaw/openclaw/releases",Xi="__add_agent__",_7=["openclaw"];function R7(e,t){const n=t instanceof Error?t.message:String(t??"Unknown error");if(t instanceof wm){if(t.code==="HERMES_BRIDGE_RESPONSE_TIMEOUT")return`${e.name} bridge response timed out.`;if(t.code==="HERMES_GATEWAY_RESPONSE_TIMEOUT")return`${e.name} gateway response timed out.`;if(t.code==="OPENCLAW_BRIDGE_RESPONSE_TIMEOUT")return`${e.name} bridge response timed out.`;if(t.code==="OPENCLAW_GATEWAY_RESPONSE_TIMEOUT")return`${e.name} gateway response timed out.`;if(t.code==="SWM_SYNC_TIMEOUT"||t.source==="background-sync")return"Background sync timed out. The chat request was not marked as failed by the local-agent bridge."}return/OpenClaw bridge unreachable/i.test(n)?`${e.name} is unavailable right now.`:/Hermes bridge unreachable/i.test(n)?`${e.name} is unavailable right now.`:/gateway response timeout/i.test(n)?`${e.name} gateway response timed out.`:/bridge response timeout/i.test(n)||/aborted due to timeout/i.test(n)?`${e.name} bridge response timed out.`:/Agent response timeout/i.test(n)?`${e.name} took too long to respond.`:/Agent returned no text response/i.test(n)||/\(no response\)/i.test(n)?`${e.name} did not return a text reply.`:n}let O7=0;function L7(e,t,n){const a=e.trim();return a?a===t?!0:n==="Request cancelled."&&a===n:!1}function M7(e,t,n,a){return e&&L7(e,t,n)?{content:e,synthesized:!0}:e?a==="hermes"?{content:e,failureNotice:t,synthesized:!1}:{content:e,synthesized:!1}:{content:"",failureNotice:t,synthesized:!0}}function jk(e,t=""){const n=e.author.toLowerCase(),a=n.includes("assistant")||n.includes("agent")?"assistant":"user",s=typeof e.failureReason=="string"&&e.failureReason.trim()?e.failureReason.trim():void 0,l=a==="assistant"&&(e.persistStatus==="failed"||!!s),u=`Error: ${s??"The local agent turn failed."}`,d=l?M7(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:${++O7}`,uri:e.uri,turnId:e.turnId,role:a,content:f,ts:Cd(e.ts),tsRaw:rg(e.ts),attachments:e.attachmentRefs,failureNotice:d==null?void 0:d.failureNotice,synthesized:(d==null?void 0:d.synthesized)??!h}}function D7(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,a=[];for(const s of[...t,...e]){const l=D7(s);n.has(l)||(n.add(l),a.push(s))}return a}function Nk(e,t,n){const a=typeof n=="string"&&n.trim()?n.trim():t;return!a||a===t?e:e.map(s=>s.turnId===t?{...s,turnId:a}:s)}function Ek(e){return e.replace(/\r\n/g,`
1653
- `).replace(/^(?:[ \t]*\n)+/,"").replace(/(?:\n[ \t]*)+$/,"")}function z7(e,t,n,a,s){const l=Ek(e),u=s?Ek(s):"";if(t==="assistant"&&a&&l.trim()===""&&!u)return o.jsx("span",{className:"v10-chat-thinking",role:"status","aria-live":"polite",children:"Thinking…"});if(t==="assistant"&&!n&&l.trim()!=="")return o.jsxs(o.Fragment,{children:[o.jsx(_N,{content:l,streaming:a&&!u}),u&&o.jsxs("span",{className:"v10-chat-plaintext v10-chat-failure-notice",children:[u,a&&o.jsx("span",{className:"v10-chat-cursor"})]})]});const d=[l,u].filter(Boolean).join(`
1654
-
1655
- `);return o.jsxs("span",{className:"v10-chat-plaintext",children:[d,a&&o.jsx("span",{className:"v10-chat-cursor"})]})}function ig(){return ig=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},ig.apply(null,arguments)}function $7(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;n[a]=e[a]}return n}var I7=w.useLayoutEffect,P7=function(t){var n=Ve.useRef(t);return I7(function(){n.current=t}),n},Ak=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},U7=function(t,n){var a=Ve.useRef();return Ve.useCallback(function(s){t.current=s,a.current&&Ak(a.current,null),a.current=n,n&&Ak(n,s)},[n])},Tk={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},B7=function(t){Object.keys(Tk).forEach(function(n){t.style.setProperty(n,Tk[n],"important")})},_k=B7,On=null,Rk=function(t,n){var a=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?a+n.borderSize:a-n.paddingSize};function F7(e,t,n,a){n===void 0&&(n=1),a===void 0&&(a=1/0),On||(On=document.createElement("textarea"),On.setAttribute("tabindex","-1"),On.setAttribute("aria-hidden","true"),_k(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]}),_k(On),On.value=t;var f=Rk(On,e);On.value=t,f=Rk(On,e),On.value="x";var h=On.scrollHeight-s,g=h*n;d==="border-box"&&(g=g+s+l),f=Math.max(g,f);var m=h*a;return d==="border-box"&&(m=m+s+l),f=Math.min(m,f),[f,h]}var Ok=function(){},H7=function(t,n){return t.reduce(function(a,s){return a[s]=n[s],a},{})},q7=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],G7=!!document.documentElement.currentStyle,V7=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var a=H7(q7,n),s=a.boxSizing;if(s==="")return null;G7&&s==="border-box"&&(a.width=parseFloat(a.width)+parseFloat(a.borderRightWidth)+parseFloat(a.borderLeftWidth)+parseFloat(a.paddingRight)+parseFloat(a.paddingLeft)+"px");var l=parseFloat(a.paddingBottom)+parseFloat(a.paddingTop),u=parseFloat(a.borderBottomWidth)+parseFloat(a.borderTopWidth);return{sizingStyle:a,paddingSize:l,borderSize:u}},W7=V7;function Lv(e,t,n){var a=P7(n);w.useLayoutEffect(function(){var s=function(u){return a.current(u)};if(e)return e.addEventListener(t,s),function(){return e.removeEventListener(t,s)}},[])}var Z7=function(t,n){Lv(document.body,"reset",function(a){t.current.form===a.target&&n(a)})},K7=function(t){Lv(window,"resize",t)},Y7=function(t){Lv(document.fonts,"loadingdone",t)},Q7=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],X7=function(t,n){var a=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,Q7),m=g.value!==void 0,y=w.useRef(null),b=U7(y,n),k=w.useRef(0),j=w.useRef(),N=function(){var E=y.current,T=a&&j.current?j.current:W7(E);if(T){j.current=T;var U=F7(T,E.value||E.placeholder||"x",l,s),_=U[0],z=U[1];k.current!==_&&(k.current=_,E.style.setProperty("height",_+"px","important"),h(_,{rowHeight:z}))}},S=function(E){m||N(),d(E)};return w.useLayoutEffect(N),Z7(y,function(){if(!m){var A=y.current.value;requestAnimationFrame(function(){var E=y.current;E&&A!==E.value&&N()})}}),K7(N),Y7(N),w.createElement("textarea",ig({},g,{onChange:S,ref:b}))},J7=w.forwardRef(X7),fm={exports:{}},hm,Lk;function eq(){if(Lk)return hm;Lk=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return hm=e,hm}var mm,Mk;function tq(){if(Mk)return mm;Mk=1;var e=eq();function t(){}function n(){}return n.resetWarningCache=t,mm=function(){function a(u,d,f,h,g,m){if(m!==e){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}}a.isRequired=a;function s(){return a}var l={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:s,element:a,elementType:a,instanceOf:s,node:a,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:n,resetWarningCache:t};return l.PropTypes=l,l},mm}var Dk;function nq(){return Dk||(Dk=1,fm.exports=tq()()),fm.exports}var rq=nq();const At=Wl(rq);function ps(e,t,n,a){function s(l){return l instanceof n?l:new n(function(u){u(l)})}return new(n||(n=Promise))(function(l,u){function d(g){try{h(a.next(g))}catch(m){u(m)}}function f(g){try{h(a.throw(g))}catch(m){u(m)}}function h(g){g.done?l(g.value):s(g.value).then(d,f)}h((a=a.apply(e,t||[])).next())})}const aq=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function mo(e,t,n){const a=iq(e),{webkitRelativePath:s}=e,l=typeof t=="string"?t:typeof s=="string"&&s.length>0?s:`./${e.name}`;return typeof a.path!="string"&&zk(a,"path",l),zk(a,"relativePath",l),a}function iq(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const a=t.split(".").pop().toLowerCase(),s=aq.get(a);s&&Object.defineProperty(e,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return e}function zk(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const sq=[".DS_Store","Thumbs.db"];function oq(e){return ps(this,void 0,void 0,function*(){return Nd(e)&&lq(e.dataTransfer)?pq(e.dataTransfer,e.type):cq(e)?uq(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?dq(e):[]})}function lq(e){return Nd(e)}function cq(e){return Nd(e)&&Nd(e.target)}function Nd(e){return typeof e=="object"&&e!==null}function uq(e){return sg(e.target.files).map(t=>mo(t))}function dq(e){return ps(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>mo(n))})}function pq(e,t){return ps(this,void 0,void 0,function*(){if(e.items){const n=sg(e.items).filter(s=>s.kind==="file");if(t!=="drop")return n;const a=yield Promise.all(n.map(fq));return $k(DN(a))}return $k(sg(e.files).map(n=>mo(n)))})}function $k(e){return e.filter(t=>sq.indexOf(t.name)===-1)}function sg(e){if(e===null)return[];const t=[];for(let n=0;n<e.length;n++){const a=e[n];t.push(a)}return t}function fq(e){if(typeof e.webkitGetAsEntry!="function")return Ik(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?zN(t):Ik(e,t)}function DN(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?DN(n):[n]],[])}function Ik(e,t){return ps(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const l=yield e.getAsFileSystemHandle();if(l===null)throw new Error(`${e} is not a File`);if(l!==void 0){const u=yield l.getFile();return u.handle=l,mo(u)}}const a=e.getAsFile();if(!a)throw new Error(`${e} is not a File`);return mo(a,(n=t==null?void 0:t.fullPath)!==null&&n!==void 0?n:void 0)})}function hq(e){return ps(this,void 0,void 0,function*(){return e.isDirectory?zN(e):mq(e)})}function zN(e){const t=e.createReader();return new Promise((n,a)=>{const s=[];function l(){t.readEntries(u=>ps(this,void 0,void 0,function*(){if(u.length){const d=Promise.all(u.map(hq));s.push(d),l()}else try{const d=yield Promise.all(s);n(d)}catch(d){a(d)}}),u=>{a(u)})}l()})}function mq(e){return ps(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(a=>{const s=mo(a,e.fullPath);t(s)},a=>{n(a)})})})}var Fu={},Pk;function gq(){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 a=e.name||"",s=(e.type||"").toLowerCase(),l=s.replace(/\/.*$/,"");return n.some(function(u){var d=u.trim().toLowerCase();return d.charAt(0)==="."?a.toLowerCase().endsWith(d):d.endsWith("/*")?l===d.replace(/\/.*$/,""):s===d})}return!0}),Fu}var vq=gq();const gm=Wl(vq);function Uk(e){return xq(e)||bq(e)||IN(e)||yq()}function yq(){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 bq(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function xq(e){if(Array.isArray(e))return og(e)}function Bk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,a)}return n}function 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(a){$N(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bk(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function $N(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 Sq(e)||kq(e,t)||IN(e,t)||wq()}function wq(){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 IN(e,t){if(e){if(typeof e=="string")return og(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return og(e,t)}}function og(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function kq(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var a=[],s=!0,l=!1,u,d;try{for(n=n.call(e);!(s=(u=n.next()).done)&&(a.push(u.value),!(t&&a.length===t));s=!0);}catch(f){l=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(l)throw d}}return a}}function Sq(e){if(Array.isArray(e))return e}var jq=typeof gm=="function"?gm:gm.default,Cq="file-invalid-type",Nq="file-too-large",Eq="file-too-small",Aq="too-many-files",Tq=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),a=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:Cq,message:"File type must be ".concat(a)}},Hk=function(t){return{code:Nq,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},qk=function(t){return{code:Eq,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},_q={code:Aq,message:"Too many files"};function Rq(e){return e.type===""&&typeof e.getAsFile=="function"}function PN(e,t){var n=e.type==="application/x-moz-file"||jq(e,t)||Rq(e);return[n,n?null:Tq(t)]}function UN(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 Oq(e){var t=e.files,n=e.accept,a=e.minSize,s=e.maxSize,l=e.multiple,u=e.maxFiles,d=e.validator;return!l&&t.length>1||l&&u>=1&&t.length>u?!1:t.every(function(f){var h=PN(f,n),g=Vl(h,1),m=g[0],y=UN(f,a,s),b=Vl(y,1),k=b[0],j=d?d(f):null;return m&&k&&!j})}function Ed(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Nl(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function Gk(e){e.preventDefault()}function Lq(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function Mq(e){return e.indexOf("Edge/")!==-1}function Dq(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Lq(e)||Mq(e)}function ea(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(a){for(var s=arguments.length,l=new Array(s>1?s-1:0),u=1;u<s;u++)l[u-1]=arguments[u];return t.some(function(d){return!Ed(a)&&d&&d.apply(void 0,[a].concat(l)),Ed(a)})}}function zq(){return"showOpenFilePicker"in window}function $q(e){if(Qi(e)){var t=Object.entries(e).filter(function(n){var a=Vl(n,2),s=a[0],l=a[1],u=!0;return BN(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(FN))&&(console.warn('Skipped "'.concat(s,'" because an invalid file extension was provided.')),u=!1),u}).reduce(function(n,a){var s=Vl(a,2),l=s[0],u=s[1];return Fk(Fk({},n),{},$N({},l,u))},{});return[{description:"Files",accept:t}]}return e}function Iq(e){if(Qi(e))return Object.entries(e).reduce(function(t,n){var a=Vl(n,2),s=a[0],l=a[1];return[].concat(Uk(t),[s],Uk(l))},[]).filter(function(t){return BN(t)||FN(t)}).join(",")}function Pq(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function Uq(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function BN(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function FN(e){return/^.*\.[\w]+$/.test(e)}var Bq=["children"],Fq=["open"],Hq=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],qq=["refKey","onChange","onClick"];function Vk(e){return Wq(e)||Vq(e)||HN(e)||Gq()}function Gq(){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 Vq(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Wq(e){if(Array.isArray(e))return lg(e)}function vm(e,t){return Yq(e)||Kq(e,t)||HN(e,t)||Zq()}function Zq(){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 HN(e,t){if(e){if(typeof e=="string")return lg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lg(e,t)}}function lg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function Kq(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var a=[],s=!0,l=!1,u,d;try{for(n=n.call(e);!(s=(u=n.next()).done)&&(a.push(u.value),!(t&&a.length===t));s=!0);}catch(f){l=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(l)throw d}}return a}}function Yq(e){if(Array.isArray(e))return e}function Wk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,a)}return n}function zt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wk(Object(n),!0).forEach(function(a){cg(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wk(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function cg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ad(e,t){if(e==null)return{};var n=Qq(e,t),a,s;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s<l.length;s++)a=l[s],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}function Qq(e,t){if(e==null)return{};var n={},a=Object.keys(e),s,l;for(l=0;l<a.length;l++)s=a[l],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Mv=w.forwardRef(function(e,t){var n=e.children,a=Ad(e,Bq),s=GN(a),l=s.open,u=Ad(s,Fq);return w.useImperativeHandle(t,function(){return{open:l}},[l]),Ve.createElement(w.Fragment,null,n(zt(zt({},u),{},{open:l})))});Mv.displayName="Dropzone";var qN={disabled:!1,getFilesFromEvent:oq,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};Mv.defaultProps=qN;Mv.propTypes={children:At.func,accept:At.objectOf(At.arrayOf(At.string)),multiple:At.bool,preventDropOnDocument:At.bool,noClick:At.bool,noKeyboard:At.bool,noDrag:At.bool,noDragEventsBubbling:At.bool,minSize:At.number,maxSize:At.number,maxFiles:At.number,disabled:At.bool,getFilesFromEvent:At.func,onFileDialogCancel:At.func,onFileDialogOpen:At.func,useFsAccessApi:At.bool,autoFocus:At.bool,onDragEnter:At.func,onDragLeave:At.func,onDragOver:At.func,onDrop:At.func,onDropAccepted:At.func,onDropRejected:At.func,onError:At.func,validator:At.func};var ug={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function GN(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=zt(zt({},qN),e),n=t.accept,a=t.disabled,s=t.getFilesFromEvent,l=t.maxSize,u=t.minSize,d=t.multiple,f=t.maxFiles,h=t.onDragEnter,g=t.onDragLeave,m=t.onDragOver,y=t.onDrop,b=t.onDropAccepted,k=t.onDropRejected,j=t.onFileDialogCancel,N=t.onFileDialogOpen,S=t.useFsAccessApi,A=t.autoFocus,E=t.preventDropOnDocument,T=t.noClick,U=t.noKeyboard,_=t.noDrag,z=t.noDragEventsBubbling,q=t.onError,D=t.validator,R=w.useMemo(function(){return Iq(n)},[n]),$=w.useMemo(function(){return $q(n)},[n]),F=w.useMemo(function(){return typeof N=="function"?N:Zk},[N]),K=w.useMemo(function(){return typeof j=="function"?j:Zk},[j]),I=w.useRef(null),H=w.useRef(null),B=w.useReducer(Xq,ug),W=vm(B,2),Q=W[0],V=W[1],L=Q.isFocused,P=Q.isFileDialogActive,G=w.useRef(typeof window<"u"&&window.isSecureContext&&S&&zq()),O=function(){!G.current&&P&&setTimeout(function(){if(H.current){var X=H.current.files;X.length||(V({type:"closeDialog"}),K())}},300)};w.useEffect(function(){return window.addEventListener("focus",O,!1),function(){window.removeEventListener("focus",O,!1)}},[H,P,K,G]);var ne=w.useRef([]),ue=w.useRef([]),le=function(X){I.current&&I.current.contains(X.target)||(X.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)&&V({isDragGlobal:!0,type:"setDragGlobal"})},X=function(he){ue.current=ue.current.filter(function(Le){return Le!==he.target&&Le!==null}),!(ue.current.length>0)&&V({isDragGlobal:!1,type:"setDragGlobal"})},Z=function(){ue.current=[],V({isDragGlobal:!1,type:"setDragGlobal"})},ee=function(){ue.current=[],V({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",ye,!1),document.addEventListener("dragleave",X,!1),document.addEventListener("dragend",Z,!1),document.addEventListener("drop",ee,!1),function(){document.removeEventListener("dragenter",ye),document.removeEventListener("dragleave",X),document.removeEventListener("dragend",Z),document.removeEventListener("drop",ee)}},[I]),w.useEffect(function(){return!a&&A&&I.current&&I.current.focus(),function(){}},[I,A,a]);var be=w.useCallback(function(ye){q?q(ye):console.error(ye)},[q]),_e=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),$t(ye),ne.current=[].concat(Vk(ne.current),[ye.target]),Nl(ye)&&Promise.resolve(s(ye)).then(function(X){if(!(Ed(ye)&&!z)){var Z=X.length,ee=Z>0&&Oq({files:X,accept:R,minSize:u,maxSize:l,multiple:d,maxFiles:f,validator:D}),ce=Z>0&&!ee;V({isDragAccept:ee,isDragReject:ce,isDragActive:!0,type:"setDraggedFiles"}),h&&h(ye)}}).catch(function(X){return be(X)})},[s,h,be,z,R,u,l,d,f,D]),Ee=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),$t(ye);var X=Nl(ye);if(X&&ye.dataTransfer)try{ye.dataTransfer.dropEffect="copy"}catch{}return X&&m&&m(ye),!1},[m,z]),Ie=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),$t(ye);var X=ne.current.filter(function(ee){return I.current&&I.current.contains(ee)}),Z=X.indexOf(ye.target);Z!==-1&&X.splice(Z,1),ne.current=X,!(X.length>0)&&(V({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Nl(ye)&&g&&g(ye))},[I,g,z]),We=w.useCallback(function(ye,X){var Z=[],ee=[];ye.forEach(function(ce){var he=PN(ce,R),Le=vm(he,2),He=Le[0],Ce=Le[1],Fe=UN(ce,u,l),et=vm(Fe,2),Ne=et[0],Wt=et[1],_t=D?D(ce):null;if(He&&Ne&&!_t)Z.push(ce);else{var Hr=[Ce,Wt];_t&&(Hr=Hr.concat(_t)),ee.push({file:ce,errors:Hr.filter(function(dr){return dr})})}}),(!d&&Z.length>1||d&&f>=1&&Z.length>f)&&(Z.forEach(function(ce){ee.push({file:ce,errors:[_q]})}),Z.splice(0)),V({acceptedFiles:Z,fileRejections:ee,type:"setFiles"}),y&&y(Z,ee,X),ee.length>0&&k&&k(ee,X),Z.length>0&&b&&b(Z,X)},[V,d,R,u,l,f,y,b,k,D]),Se=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),$t(ye),ne.current=[],Nl(ye)&&Promise.resolve(s(ye)).then(function(X){Ed(ye)&&!z||We(X,ye)}).catch(function(X){return be(X)}),V({type:"reset"})},[s,We,be,z]),ft=w.useCallback(function(){if(G.current){V({type:"openDialog"}),F();var ye={multiple:d,types:$};window.showOpenFilePicker(ye).then(function(X){return s(X)}).then(function(X){We(X,null),V({type:"closeDialog"})}).catch(function(X){Pq(X)?(K(X),V({type:"closeDialog"})):Uq(X)?(G.current=!1,H.current?(H.current.value=null,H.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(X)});return}H.current&&(V({type:"openDialog"}),F(),H.current.value=null,H.current.click())},[V,F,K,S,We,be,$,d]),De=w.useCallback(function(ye){!I.current||!I.current.isEqualNode(ye.target)||(ye.key===" "||ye.key==="Enter"||ye.keyCode===32||ye.keyCode===13)&&(ye.preventDefault(),ft())},[I,ft]),qe=w.useCallback(function(){V({type:"focus"})},[]),ke=w.useCallback(function(){V({type:"blur"})},[]),lt=w.useCallback(function(){T||(Dq()?setTimeout(ft,0):ft())},[T,ft]),xe=function(X){return a?null:X},Oe=function(X){return U?null:xe(X)},Ot=function(X){return _?null:xe(X)},$t=function(X){z&&X.stopPropagation()},Yt=w.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=ye.refKey,Z=X===void 0?"ref":X,ee=ye.role,ce=ye.onKeyDown,he=ye.onFocus,Le=ye.onBlur,He=ye.onClick,Ce=ye.onDragEnter,Fe=ye.onDragOver,et=ye.onDragLeave,Ne=ye.onDrop,Wt=Ad(ye,Hq);return zt(zt(cg({onKeyDown:Oe(ea(ce,De)),onFocus:Oe(ea(he,qe)),onBlur:Oe(ea(Le,ke)),onClick:xe(ea(He,lt)),onDragEnter:Ot(ea(Ce,_e)),onDragOver:Ot(ea(Fe,Ee)),onDragLeave:Ot(ea(et,Ie)),onDrop:Ot(ea(Ne,Se)),role:typeof ee=="string"&&ee!==""?ee:"presentation"},Z,I),!a&&!U?{tabIndex:0}:{}),Wt)}},[I,De,qe,ke,lt,_e,Ee,Ie,Se,U,_,a]),qt=w.useCallback(function(ye){ye.stopPropagation()},[]),ut=w.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=ye.refKey,Z=X===void 0?"ref":X,ee=ye.onChange,ce=ye.onClick,he=Ad(ye,qq),Le=cg({accept:R,multiple:d,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:xe(ea(ee,Se)),onClick:xe(ea(ce,qt)),tabIndex:-1},Z,H);return zt(zt({},Le),he)}},[H,n,d,Se,a]);return zt(zt({},Q),{},{isFocused:L&&!a,getRootProps:Yt,getInputProps:ut,rootRef:I,inputRef:H,open:xe(ft)})}function Xq(e,t){switch(t.type){case"focus":return zt(zt({},e),{},{isFocused:!0});case"blur":return zt(zt({},e),{},{isFocused:!1});case"openDialog":return zt(zt({},ug),{},{isFileDialogActive:!0});case"closeDialog":return zt(zt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return zt(zt({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return zt(zt({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return zt(zt({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return zt({},ug);default:return e}}function Zk(){}function Jq({value:e,onChange:t,options:n,placeholder:a="Select…",disabled:s=!1,className:l,ariaLabel:u,prefixIcon:d}){const[f,h]=w.useState(!1),[g,m]=w.useState(null),[y,b]=w.useState(()=>{const D=n.findIndex(R=>R.value===e);return D>=0?D:0}),k=w.useRef(null),j=w.useRef(null),N=w.useRef(null),S=n.find(D=>D.value===e),A=(S==null?void 0:S.label)??a,E=w.useCallback(()=>{var D;h(!1),(D=j.current)==null||D.focus()},[]),T=w.useCallback(()=>{const D=j.current;if(!D)return;const R=D.getBoundingClientRect(),$=Math.min(240,n.length*36+16),F=window.innerHeight-R.bottom,K=R.top,I=F<$+16&&K>F?"above":"below";m({left:R.left,top:I==="below"?R.bottom+4:R.top-4,width:R.width,placement:I})},[n.length]);w.useLayoutEffect(()=>{f&&T()},[f,T]),w.useEffect(()=>{if(!f)return;const D=()=>T(),R=()=>T(),$=K=>{var H,B;const I=K.target;(H=k.current)!=null&&H.contains(I)||(B=N.current)!=null&&B.contains(I)||h(!1)},F=K=>{K.key==="Escape"&&(K.preventDefault(),E())};return window.addEventListener("scroll",D,!0),window.addEventListener("resize",R),document.addEventListener("mousedown",$),document.addEventListener("keydown",F),()=>{window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",R),document.removeEventListener("mousedown",$),document.removeEventListener("keydown",F)}},[f,E,T]),w.useEffect(()=>{if(f){const D=n.findIndex(R=>R.value===e);b(D>=0?D:0),requestAnimationFrame(()=>{var R;return(R=N.current)==null?void 0:R.focus()})}},[f,e,n]),w.useEffect(()=>{s&&f&&h(!1)},[s,f]);const U=D=>{s||(D.key==="ArrowDown"||D.key==="Enter"||D.key===" ")&&(D.preventDefault(),h(!0))},_=D=>{var R;if(D.key==="ArrowDown")D.preventDefault(),b($=>{var F;for(let K=1;K<=n.length;K++){const I=($+K)%n.length;if(!((F=n[I])!=null&&F.disabled))return I}return $});else if(D.key==="ArrowUp")D.preventDefault(),b($=>{var F;for(let K=1;K<=n.length;K++){const I=($-K+n.length)%n.length;if(!((F=n[I])!=null&&F.disabled))return I}return $});else if(D.key==="Enter"){D.preventDefault();const $=n[y];$&&!$.disabled&&(t($.value),E())}else if(D.key==="Home"){D.preventDefault();const $=n.findIndex(F=>!F.disabled);$>=0&&b($)}else if(D.key==="End"){D.preventDefault();let $=-1;for(let F=n.length-1;F>=0;F--)if(!((R=n[F])!=null&&R.disabled)){$=F;break}$>=0&&b($)}},z=["v10-select",l,s?"disabled":"",f?"open":""].filter(Boolean).join(" "),q=g?g.placement==="below"?{position:"fixed",left:g.left,top:g.top,width:g.width}:{position:"fixed",left:g.left,top:g.top,width:g.width,transform:"translateY(-100%)"}:void 0;return o.jsxs("div",{ref:k,className:z,children:[o.jsxs("button",{ref:j,type:"button",className:"v10-select-trigger",onClick:()=>!s&&h(D=>!D),onKeyDown:U,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:A}),o.jsx(uO,{className:"v10-select-caret",size:12,"aria-hidden":"true"})]}),f&&g&&W2.createPortal(o.jsxs("ul",{ref:N,className:`v10-select-menu v10-select-menu-${g.placement}`,role:"listbox",tabIndex:-1,onKeyDown:_,style:q,children:[n.length===0&&o.jsx("li",{className:"v10-select-option empty","aria-disabled":"true",children:"No options"}),n.map((D,R)=>o.jsx("li",{role:"option","aria-selected":D.value===e,title:D.label,className:["v10-select-option",D.value===e?"selected":"",R===y?"highlighted":"",D.disabled?"disabled":""].filter(Boolean).join(" "),onMouseEnter:()=>b(R),onMouseDown:$=>$.preventDefault(),onClick:()=>{s||D.disabled||(t(D.value),E())},children:D.label},D.value))]}),document.body)]})}function Kk(e){return e.bridgeOnline?"connected":e.status==="connecting"?"known":e.status==="degraded"?"degraded":"offline"}function eG(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 tG(e){const[t,n]=w.useState(!1),[a,s]=w.useState(!1),l=w.useRef(null),u=w.useRef(null),d=w.useRef(null);w.useLayoutEffect(()=>{if(!t)return;const m=d.current,y=u.current;if(!m||!y)return;const k=(y.closest(".v10-panel-right")||document.body).getBoundingClientRect();y.getBoundingClientRect().left+m.offsetWidth>k.right-4?s(!0):s(!1)},[t]);const f=w.useCallback(()=>{var m;n(!1),(m=u.current)==null||m.focus()},[]);w.useEffect(()=>{if(!t)return;const m=b=>{var k;(k=l.current)!=null&&k.contains(b.target)||n(!1)},y=b=>{b.key==="Escape"&&(b.preventDefault(),f())};return document.addEventListener("mousedown",m),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",y)}},[t,f]),w.useEffect(()=>{var y;if(!t)return;const m=(y=d.current)==null?void 0:y.querySelector(".v10-agent-tab-menu-item:not(:disabled)");m==null||m.focus()},[t]);const h=m=>{(m.key==="ArrowDown"||m.key==="Enter"||m.key===" ")&&(m.preventDefault(),n(!0))},g=m=>{var N,S;if(m.key==="Tab"){n(!1);return}if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;m.preventDefault();const y=Array.from(((N=d.current)==null?void 0:N.querySelectorAll(".v10-agent-tab-menu-item:not(:disabled)"))??[]);if(y.length===0)return;const b=y.findIndex(A=>A===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(mO,{"aria-hidden":"true",size:14})}),t&&o.jsxs("div",{ref:d,className:`v10-agent-tab-menu-popover${a?" align-right":""}`,role:"menu",onKeyDown:g,children:[o.jsxs("div",{className:"v10-agent-tab-menu-status","aria-hidden":"true",children:[o.jsx("span",{className:`v10-agents-stat-dot ${e.statusDotClass}`}),o.jsx("span",{children:e.statusLabel})]}),o.jsx("button",{type:"button",role:"menuitem",className:"v10-agent-tab-menu-item",disabled:e.refreshBusy,onClick:()=>{f(),e.onRefresh()},children:e.refreshBusy?"Refreshing…":"Refresh"}),e.canDisconnect&&o.jsx("button",{type:"button",role:"menuitem",className:"v10-agent-tab-menu-item danger",onClick:()=>{f(),e.onDisconnect()},children:"Disconnect"})]})]})}function VN(e,t){return(t==null?void 0:t.trim())||`integration:${e}`}function Td(e){const t=e.sessionId??e.defaultSessionId??to(e.integrationId);return{integrationId:e.integrationId,sessionId:t,stateKey:VN(e.integrationId,t)}}function WN(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 ZN(e){var n;if(e.selectedSessionId==null)return!1;const t=e.integrations.find(a=>a.id===e.integrationId);return!(((n=WN(e.selectedSessionId,e.integrations))==null?void 0:n.id)!==e.integrationId||t!=null&&t.defaultSessionId&&e.selectedSessionId!==t.defaultSessionId&&rG(e.integrationId,e.selectedSessionId))}function nG(e){return ZN(e)}function rG(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 Yk(e,t){const n=e.flatMap(a=>{var d;const s=WN(a.session,t);if(!s)return[];const l=a.messages.find(f=>f.author==="user"),u=a.messages[a.messages.length-1];return[{sessionId:a.session,integrationId:s.id,integrationName:s.name,preview:((d=l==null?void 0:l.text)==null?void 0:d.slice(0,60))||a.session,messageCount:a.messages.length,lastTs:u==null?void 0:u.ts}]});return n.sort((a,s)=>{const l=Date.parse(a.lastTs??""),u=Date.parse(s.lastTs??"");return Number.isFinite(l)&&Number.isFinite(u)?u-l:String(s.lastTs??"").localeCompare(String(a.lastTs??""))}),n}function KN(e,t,n,a,s){var u;const l=Td({integrationId:e,sessionId:t,defaultSessionId:s});return(((u=n[l.stateKey])==null?void 0:u.length)??0)>0||(l.sessionId?a.some(d=>d.sessionId===l.sessionId):!1)}function YN(e,t,n){const a=VN(e,null);return Object.entries(t).some(([s,l])=>l.length>0&&(s===a||s.startsWith(`${e}:`)))||n.some(s=>s.integrationId===e)}function aG(e){const t=[...e.integrations].sort(Xd),n=t.filter(d=>d.persistentChat),a=t.find(d=>d.id===e.selectedIntegrationId)??n[0]??null,s=a?Td({integrationId:a.id,sessionId:e.selectedSessionId,defaultSessionId:a.defaultSessionId}):null,l=a?KN(a.id,e.selectedSessionId,e.localMessagesByConversation,e.sessions,a.defaultSessionId):!1,u=a?YN(a.id,e.localMessagesByConversation,e.sessions):!1;return{sortedIntegrations:t,connectedIntegrations:n,selectedIntegration:a,selectedConversation:s,selectedHasConversation:l,selectedIntegrationHasAnyConversation:u}}function iG(e){const t=e.selectedIntegration,n=!!(t&&!t.persistentChat&&e.selectedHasConversation),a=!!(t&&!t.persistentChat&&e.selectedIntegrationHasAnyConversation),s=a?[t,...e.connectedAgents.filter(d=>d.id!==t.id)]:e.connectedAgents,l=e.selectedIntegrationId===Xi||!t&&e.connectedAgents.length===0||!!(t&&!t.persistentChat&&!e.selectedIntegrationHasAnyConversation),u=!e.localHistoryLoaded&&e.localMessagesCount===0&&!!(t!=null&&t.persistentChat||e.selectedHasConversation);return{showingSessionHistory:n,showingStoredSessions:a,visibleAgentTabs:s,showAddFlow:l,shouldShowConversationLoader:u}}function Xd(e,t){const n=e.id==="openclaw"?0:1,a=t.id==="openclaw"?0:1;return n!==a?n-a:e.persistentChat!==t.persistentChat?e.persistentChat?-1:1:e.name.localeCompare(t.name)}function nd(e,t){return[...e.filter(n=>n.id!==t.id),t].sort(Xd)}function sG(e,t){const n=e.find(u=>u.id===t);if(!n)return e;const a=n.connectSupported,s=a?"available":"coming_soon",l=a?"Ready to connect":"Coming next";return nd(e,{...n,configured:!1,detected:!1,persistentChat:!1,chatReady:!1,bridgeOnline:!1,bridgeStatusLabel:l,status:s,statusLabel:l,detail:a?`${n.name} is no longer attached to this node. Reconnect from the + tab when you want live chat again.`:n.detail,error:void 0,target:void 0})}function oG(e){const t=e.selectedItem;return e.selectedIntegrationId===Xi||t!=null&&(t.persistentChat||KN(e.selectedIntegrationId,e.selectedSessionId,e.localMessagesByConversation,e.sessionSummaries,t.defaultSessionId)||YN(e.selectedIntegrationId,e.localMessagesByConversation,e.sessionSummaries))}function lG(e){var X;const{integrations:t,selectedIntegrationId:n,selectedIntegration:a,selectedSessionId:s,selectedHasConversation:l,selectedIntegrationHasAnyConversation:u,onSelectIntegration:d,onConnectIntegration:f,onDisconnectIntegration:h,onRefreshIntegration:g,connectBusyId:m,refreshBusyId:y,connectNotice:b,connectError:k,localMessages:j,localHistoryLoaded:N,localChatEndRef:S,localInput:A,onLocalInputChange:E,onSendLocalMessage:T,onStopLocalStream:U,localSending:_,activeProjectId:z,availableProjects:q,projectsLoading:D,onSelectProject:R,attachments:$,onAddAttachments:F,onRemoveAttachment:K}=e,I=e.selectableProjects??q,H=$,B=H.some(ON),W=[...new Set(H.map(Z=>Z.contextGraphId))],Q=H.some(Z=>Z.status==="uploading"),L=j.some(Z=>Z.streaming)?"streaming":Q?"uploading":"idle",P=H.length>0&&H.some(Z=>Z.contextGraphId!==z),G=w.useRef(null),O=w.useRef(null),[ne,ue]=w.useState(null),le=w.useCallback(Z=>{O.current=Z,ue(Z)},[]),[be,_e]=w.useState(!1),Ee=w.useCallback(()=>{const Z=O.current;if(!Z)return;const ee=Z.scrollHeight-Z.scrollTop-Z.clientHeight;_e(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;_e(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;_e(ce>40)};Z();const ee=new MutationObserver(Z);return ee.observe(ne,{childList:!0,subtree:!0,characterData:!0}),()=>ee.disconnect()},[ne]);const We=(X=e.selectedIntegration)!=null&&X.chatAttachments?e.activeProjectId?e.localSending?"sending":null:"noProject":"unsupported",Se=We===null,ft=w.useCallback(Z=>{Se&&F(Z)},[Se,F]),De=GN({onDrop:ft,noClick:!0,noKeyboard:!0}),qe=[...t].sort(Xd),ke=qe.filter(Z=>Z.persistentChat),lt=qe.filter(Z=>!Z.persistentChat),xe=a,{showingSessionHistory:Oe,showingStoredSessions:Ot,visibleAgentTabs:$t,showAddFlow:Yt,shouldShowConversationLoader:qt}=iG({connectedAgents:ke,selectedIntegration:a,selectedIntegrationId:n,selectedHasConversation:l,selectedIntegrationHasAnyConversation:u,localHistoryLoaded:N,localMessagesCount:j.length}),ut=_||!(xe!=null&&xe.chatReady),ye=!ut&&!Q&&(A.trim()!==""||B);return o.jsxs("div",{className:"v10-agents-tab",children:[o.jsxs("div",{className:"v10-agent-subtabs",role:"tablist","aria-label":"Integrated agents",children:[$t.map(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:ZN({integrationId:Z.id,selectedSessionId:s,integrations:t}),sessionId:Z.defaultSessionId}),role:"tab","aria-selected":ee,children:[o.jsx("span",{className:`v10-agents-stat-dot ${Kk(Z)}`}),o.jsx("span",{children:Z.name})]}),ee&&o.jsx(tG,{integration:Z,statusLabel:eG(Z,Oe),statusDotClass:Kk(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:A7,target:"_blank",rel:"noreferrer",children:"Docs"}),o.jsx("a",{className:"v10-agent-link-btn",href:T7,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",{...De.getRootProps({className:"v10-local-agent-chat-shell"}),children:[o.jsx("input",{...De.getInputProps()}),b&&o.jsx("div",{className:"v10-local-agent-notice",children:b}),k&&o.jsx("div",{className:"v10-local-agent-error",children:k}),!xe.chatReady&&o.jsx("div",{className:`v10-local-agent-warning ${xe.status==="connecting"?"connecting":"offline"}`,children:Oe?`${xe.name} is not currently attached to this node. Session history remains available here; reconnect from the + tab when you want live chat again.`:xe.status==="connecting"?`${xe.name} is still finishing setup. This chat tab stays in place and will go live automatically when the connection is ready.`:xe.status==="degraded"?xe.detail:Ot?`${xe.name} has saved sessions on this node. Open one from Sessions or reconnect from the + tab to resume live chat here.`:`${xe.name} is temporarily unavailable. Refresh after it recovers to resume chatting here.`}),De.isDragActive&&o.jsx("div",{className:`v10-drop-overlay active ${Se?"accept":"refuse"}`,role:"status","aria-live":"polite",children:o.jsxs("div",{className:"v10-drop-overlay-card",children:[Se?o.jsx(OO,{className:"v10-drop-overlay-icon",size:32,"aria-hidden":"true"}):o.jsx(sO,{className:"v10-drop-overlay-icon",size:32,"aria-hidden":"true"}),o.jsx("div",{className:"v10-drop-overlay-title",children:Se?`Drop files to attach to ${ag(q,z)}`:We==="sending"?"Wait for the current send to finish.":We==="unsupported"?`${xe.name} doesn't accept file attachments.`:"Choose a context graph before attaching files."}),o.jsx("div",{className:"v10-drop-overlay-hint",children:Se?"Release to upload to this conversation.":We==="sending"?"Drop will be accepted once the agent reply lands.":We==="unsupported"?"Try a different agent that supports attachments.":"Use the picker below the composer."})]})}),o.jsxs("div",{className:"v10-chat-messages v10-local-agent-messages",ref:le,onScroll:Ee,children:[qt&&o.jsx("div",{className:"v10-agent-empty-state",children:"Loading the latest conversation from DKG memory..."}),!qt&&j.length===0&&(()=>{const Z=Oe?{title:"No turns in this session yet.",hint:`Reconnect ${xe.name} from the + tab to start a new live thread.`}:Ot?{title:`${xe.name} has saved sessions.`,hint:"Open one from Sessions, or reconnect from + to start fresh."}:xe.chatReady?{title:`Start a conversation with ${xe.name}.`,hint:'Try: "What can you help me with?"'}:{title:`${xe.name} is offline.`,hint:"Conversation history stays here while the bridge reconnects."};return o.jsxs("div",{className:"v10-agent-empty-state",children:[o.jsx("div",{className:"v10-agent-empty-state-title",children: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:z7(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(nO,{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:[H.length>0&&o.jsx("div",{className:"v10-attachment-chips",role:"list","aria-label":"Attached files",children:H.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:w7(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:x7(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:()=>K(Z.id),disabled:_,"aria-label":`Remove ${Z.file.name}`,title:"Remove attachment",children:o.jsx(IO,{size:12,"aria-hidden":"true"})})]},Z.id)})}),P&&o.jsx("div",{className:"v10-local-agent-copy",style:{margin:0,color:"var(--text-tertiary)"},children:W.length>1?"Queued files keep their stored targets and may span multiple projects.":`Queued files keep their stored target (${ag(q,W[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(J7,{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:A,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&&T();return}if((Z.ctrlKey||Z.metaKey)&&Z.key==="Enter"){Z.preventDefault(),ye&&T();return}Z.key==="Escape"&&A.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(CO,{size:14,"aria-hidden":"true"})}),o.jsx("div",{className:"v10-composer-target",children:o.jsx(Jq,{className:"v10-local-agent-target-select",value:z??"",onChange:R,options:[...z?[{value:"",label:"No context graph (clear selection)"}]:[],...I.map(Z=>({value:Z.id,label:Z.name}))],placeholder:D?"Loading context graphs…":"Choose a context graph",disabled:D||!z&&I.length===0,ariaLabel:"Active project",prefixIcon:o.jsx(vO,{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"?U:T,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(AO,{size:12,"aria-hidden":"true"}):L==="uploading"?o.jsx(wO,{className:"v10-local-agent-inline-send-spinner",size:14,"aria-hidden":"true"}):o.jsx(aO,{size:14,"aria-hidden":"true"})})]})]})})]})})]})]})}function ym(e){return e.length>12?e.slice(-8):e}function cG(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 uG(e,t){const n=new Map;for(const g of t){if(!g.peerId)continue;const m=n.get(g.peerId)??[];m.push(g),n.set(g.peerId,m)}const a=new Map;for(const g of e){if(!g.peerId)continue;const m=a.get(g.peerId)??{hasDirect:!1,hasRelay:!1,openedAt:null},y=m.hasDirect||g.transport==="direct",b=m.hasRelay||g.transport==="relayed",k=g.openedAt!=null?m.openedAt!=null?Math.min(m.openedAt,g.openedAt):g.openedAt:m.openedAt;a.set(g.peerId,{hasDirect:y,hasRelay:b,openedAt:k})}const s=g=>{var m;return(m=g.find(y=>y.name))==null?void 0:m.name},l=g=>g.reduce((m,y)=>y.lastSeen!=null&&(m==null||y.lastSeen>m)?y.lastSeen:m,void 0),u=[],d=new Set;for(const[g,m]of a){const y=n.get(g)??[];u.push({peerId:g,name:s(y),transport:m.hasDirect?"direct":"relayed",hasDirect:m.hasDirect,hasRelay:m.hasRelay,openedAt:m.openedAt,connected:!0,lastSeen:l(y),agents:y}),d.add(g)}for(const[g,m]of n){if(d.has(g))continue;const y=m.filter(N=>N.connectionStatus==="connected");if(y.length===0)continue;const b=y.some(N=>N.connectionTransport==="direct"),k=y.some(N=>N.connectionTransport==="relayed"),j=k&&!b?"relayed":"direct";u.push({peerId:g,name:s(m),transport:j,hasDirect:b,hasRelay:k,openedAt:null,connected:!0,lastSeen:l(m),agents:m}),d.add(g)}const f=[];for(const[g,m]of n){if(d.has(g))continue;const y=l(m);y!=null&&f.push({peerId:g,name:s(m),transport:"direct",hasDirect:!1,hasRelay:!1,openedAt:null,connected:!1,lastSeen:y,agents:m})}f.sort((g,m)=>(m.lastSeen??0)-(g.lastSeen??0));const h=u.filter(g=>g.transport==="direct").length;return{connected:u,recentlySeen:f,directCount:h,relayedCount:u.length-h}}function dG({peer:e}){var g;const[t,n]=w.useState(!1),a=w.useId(),s=3,l=e.connected?"connected":"offline",u=((g=e.name)==null?void 0:g.trim())||ym(e.peerId),d=t?e.agents:e.agents.slice(0,s),f=e.connected?e.transport:"Disconnected",h=e.connected&&e.hasDirect&&e.hasRelay?"Direct + relay paths active — direct shown":void 0;return o.jsxs("div",{className:`v10-agent-card v10-peer-card ${l}`,children:[o.jsxs("div",{className:"v10-agent-card-header",children:[o.jsx("span",{className:`v10-agent-card-dot ${l}`}),o.jsx("span",{className:"v10-peer-card-name",children:u}),o.jsx("span",{className:"v10-agent-card-badge",title:h,children:f})]}),o.jsxs("div",{className:"v10-peer-card-meta",children:[o.jsx("span",{title:e.peerId,children:ym(e.peerId)}),e.connected&&e.openedAt!=null&&o.jsxs("span",{children:["up ",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:a,className:"v10-peer-card-chips","aria-label":`Agents on ${u}`,children:[d.map((m,y)=>o.jsx("li",{className:"v10-peer-chip",title:m.agentUri||"",children:o.jsx("span",{className:"v10-peer-chip-label",children:cG(m.agentUri)||ym(m.peerId)})},m.agentUri||`${e.peerId}:${y}`)),e.agents.length>s&&o.jsx("li",{children:o.jsx("button",{type:"button",className:"v10-peer-chip-more","aria-expanded":t,"aria-controls":a,onClick:()=>n(m=>!m),children:t?"Show less":`+${e.agents.length-s} more`})})]})]})}function Qk(e){const{label:t,peers:n,expanded:a,onToggle:s,emptyMessage:l}=e;return o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header",onClick:s,"aria-expanded":a,children:[o.jsx(Cm,{size:14,className:`v10-peer-group-chevron ${a?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:t}),o.jsx("span",{className:"v10-peer-group-count",children:n.length})]}),a&&o.jsx("div",{className:"v10-peer-group-body",children:n.length===0?o.jsx("div",{className:"v10-agent-empty-state",children:l}):n.map(u=>o.jsx(dG,{peer:u},u.peerId))})]})}function pG(e){const{peerAgents:t,connections:n,loading:a,onRefresh:s}=e,[l,u]=w.useState(!0),[d,f]=w.useState(!1),{connected:h,recentlySeen:g,directCount:m,relayedCount:y}=uG(n.rows,t);return o.jsxs("div",{className:"v10-agent-scroll-tab",children:[o.jsxs("div",{className:"v10-agents-summary",children:[o.jsxs("span",{className:"v10-agents-stat",children:[o.jsx("span",{className:`v10-agents-stat-dot ${h.length>0||n.total>0?"connected":"known"}`}),o.jsxs("span",{title:"Unique libp2p peers connected to this node — matches the count in the header.",children:[h.length," peer",h.length===1?"":"s"]})]}),o.jsxs("span",{className:"v10-agents-stat",title:"Preferred transport per peer (peers reachable via direct + relay are bucketed under direct)",children:[m," direct / ",y," relayed"]}),o.jsx("button",{className:"v10-agents-refresh",onClick:s,title:"Refresh network peers",children:"Refresh"})]}),a&&o.jsx("p",{className:"v10-agents-loading",children:"Loading peers..."}),!a&&h.length===0&&g.length===0&&n.total===0&&o.jsx("div",{className:"v10-agent-empty-state",children:"No network peers detected yet."}),!a&&h.length===0&&n.total>0&&o.jsxs("div",{className:"v10-agent-empty-state",children:["Connected to ",n.total," peer",n.total===1?"":"s"," (peer metadata syncing…)."]}),(h.length>0||g.length>0)&&o.jsxs(o.Fragment,{children:[o.jsx(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 fG(e){const{sessions:t,onOpenSession:n}=e;return o.jsx("div",{className:"v10-agent-scroll-tab",children:o.jsxs("div",{className:"v10-sessions-list",children:[o.jsx("div",{className:"v10-local-agent-copy",style:{marginBottom:12},children:"Sessions track DKG-persisted conversations for your integrated agents."}),t.length===0?o.jsx("p",{className:"v10-agent-empty-state",children:"No integrated-agent sessions yet."}):t.map(a=>o.jsxs("button",{className:"v10-session-item",onClick:()=>n(a),children:[o.jsxs("span",{className:"v10-session-preview",children:[a.integrationName,": ",a.preview]}),o.jsxs("span",{className:"v10-session-count",children:[a.messageCount," msg",a.messageCount!==1?"s":"",a.lastTs?` - ${Cd(a.lastTs)}`:""]})]},a.sessionId))]})})}function hG(){return zd().data}function mG(){const{stage:e,advance:t}=Ig(),[n,a]=w.useState("agents"),[s,l]=w.useState([]),[u,d]=w.useState([]),[f,h]=w.useState({total:0,direct:0,relayed:0,rows:[]}),[g,m]=w.useState(!0),y=hG(),[b,k]=w.useState([]),[j,N]=w.useState("openclaw"),[S,A]=w.useState(()=>to("openclaw")),[E,T]=w.useState(null),[U,_]=w.useState(null),[z,q]=w.useState(null),[D,R]=w.useState(null),[$,F]=w.useState({}),[K,I]=w.useState({}),[H,B]=w.useState({}),[W,Q]=w.useState({}),[V,L]=w.useState({}),P=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(to("openclaw")),_e=Tr(ge=>ge.contextGraphs),Ee=Tr(ge=>ge.loading),Ie=Tr(ge=>ge.activeProjectId),We=Tr(ge=>ge.setActiveProject),Se=w.useMemo(()=>JL(_e,y?Bg(y):null,Ie),[_e,y,Ie]),ft=Yk(s,b),{selectedIntegration:De,selectedConversation:qe,selectedHasConversation:ke,selectedIntegrationHasAnyConversation:lt}=aG({integrations:b,selectedIntegrationId:j,selectedSessionId:S,localMessagesByConversation:$,sessions:ft}),xe=(qe==null?void 0:qe.stateKey)??null,Oe=xe?$[xe]??[]:[],Ot=xe?W[xe]??!1:!1,$t=xe?K[xe]??"":"",Yt=xe?H[xe]??!1:!1,qt=xe?V[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=$},[$]),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]??[])}))},[]),X=w.useCallback((ge,Me)=>{ge&&I(de=>({...de,[ge]:Me}))},[]),Z=w.useCallback((ge,Me)=>{B(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 Ae=new Set((V[ge]??[]).map(Ke=>`${Ke.contextGraphId}:${Ke.file.name}:${Ke.file.size}:${Ke.file.lastModified}`)),tt=je.filter(Ke=>{const pt=`${de}:${Ke.name}:${Ke.size}:${Ke.lastModified}`;return Ae.has(pt)?!1:(Ae.add(pt),!0)});if(tt.length===0)return;const Je=tt.map(Ke=>({id:`${ge}:${Ke.name}:${Ke.size}:${Ke.lastModified}:${crypto.randomUUID()}`,file:Ke,contextGraphId:de,assertionName:`${Date.now().toString(36)}-${crypto.randomUUID().slice(0,8)}-${Ke.name.replace(/[^a-zA-Z0-9._-]/g,"_")}`,status:"queued"}));ee(ge,Ke=>[...Ke,...Je])},[V,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,Ae=>Ae.map(tt=>tt.id===je.id?{...tt,status:"uploading",error:void 0}:tt));try{const Ae=await OS(je.assertionName,je.contextGraphId,je.file),tt=Ae.extraction.status==="completed"?"completed":Ae.extraction.status==="skipped"?"skipped":"error",Je={...je,status:tt,result:Ae,error:Ae.extraction.error};de.push(Je),ee(ge,Ke=>Ke.map(pt=>pt.id===je.id?Je:pt))}catch(Ae){const tt={...je,status:"error",error:(Ae==null?void 0:Ae.message)??"Upload failed"};de.push(tt),ee(ge,Je=>Je.map(Ke=>Ke.id===je.id?tt:Ke))}}return de},[ee]),Le=w.useCallback((ge,Me)=>{ee(ge,de=>de.filter(je=>je.id!==Me))},[ee]),He=w.useCallback((ge,Me)=>{const de=new Set(Me);ee(ge,je=>je.filter(Ae=>!de.has(Ae.id)))},[ee]),Ce=w.useCallback((ge,Me={})=>{N(ge),ge!==Xi&&(Me.preserveSession||A(Me.sessionId??to(ge)))},[]),Fe=w.useCallback(()=>{Tn.fetchMemorySessions(50).then(({sessions:ge})=>l(ge??[])).catch(()=>{})},[]),et=w.useCallback(async()=>{try{const[ge,Me]=await Promise.all([Cg().catch(()=>({agents:[]})),l_().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=Yk(ne.current,ge),de=[...ge].sort(Xd).filter(pt=>pt.persistentChat),je=le.current,Ae=be.current,tt=ge.find(pt=>pt.id===je)??null,Je=oG({selectedIntegrationId:je,selectedItem:tt,selectedSessionId:Ae,localMessagesByConversation:ue.current,sessionSummaries:Me});if(!Je){const pt=de[0];Ce((pt==null?void 0:pt.id)??Xi,{sessionId:(pt==null?void 0:pt.defaultSessionId)??null})}const Ke=de[0];Ke&&!G.current&&je!==Xi?(G.current=!0,Ce(Ke.id,{sessionId:Ke.defaultSessionId}),a("agents")):!Ke&&!Je&&(G.current=!1,Ce(Xi))}catch{}},[Ce]),Wt=w.useCallback(async(ge,Me=null,de=null)=>{const je=Td({integrationId:ge,sessionId:Me,defaultSessionId:de});Q(Ae=>({...Ae,[je.stateKey]:!1}));try{const tt=(await Fx(ge,100,{sessionId:je.sessionId??void 0})).map(Je=>jk(Je,ge));ye(je.stateKey,Je=>Ck(Je,tt))}catch{ye(je.stateKey,Ae=>Ae)}finally{Q(Ae=>({...Ae,[je.stateKey]:!0})),Fe()}},[Fe,ye]);w.useEffect(()=>{Fe(),et(),Ne()},[Fe,et,Ne]),w.useEffect(()=>{for(const ge of _7)Wt(ge,to(ge))},[]);const _t=w.useCallback(()=>{Fe(),et()},[Fe,et]);Xl(_t,15e3,{runImmediately:!1});const Hr=b.some(ge=>ge.persistentChat&&(!ge.chatReady||ge.status==="connecting"))?3e3:15e3;w.useEffect(()=>{const ge=setInterval(()=>{Ne()},Hr);return()=>clearInterval(ge)},[Hr,Ne]),w.useEffect(()=>{if(!(De!=null&&De.chatSupported)||!De.persistentChat&&!ke){xe&&Q(Me=>({...Me,[xe]:!1}));return}let ge=!1;return(async()=>await Wt(De.id,(qe==null?void 0:qe.sessionId)??null,De.defaultSessionId??null))(),()=>{ge=!0}},[Wt,qe==null?void 0:qe.sessionId,xe,ke,De==null?void 0:De.defaultSessionId,De==null?void 0:De.chatSupported,De==null?void 0:De.id,De==null?void 0:De.persistentChat]);const dr=w.useCallback(async()=>{const ge=De,Me=qe,de=$t.trim(),je=qt,Ae=je.some(ON);if(!(ge!=null&&ge.chatSupported)||!ge.chatReady||Yt||!Me||!de&&!Ae)return;const tt=ge.id,Je=Me.stateKey;Z(Je,!0),q(null);let Ke=null,pt="",mn="",Gt="",un="",ua=[],da=[],fs=[];try{da=await he(Je,je);const Kn=da.map(tn=>j7(tn)).filter(tn=>tn!=null),fr=C7(da);if(!de&&Kn.length===0&&fr.results.length===0)return;mn=crypto.randomUUID();const Or=MN(fr.results),Ga=[de,Or].filter(tn=>tn.length>0).join(`
1660
-
1661
- `);Gt=de?Ga:N7(Kn,fr.results);const gn=de?Ga:"";ua=Kn,fs=[...Kn.map(tn=>tn.id).filter(tn=>typeof tn=="string"&&tn.length>0),...fr.deliveredDraftIds];const pa=`local:${Je}:${mn}:user`;pt=`local:${Je}:${mn}:assistant`;const hr=new Date,Lt=Cd(hr),jo=rg(hr);ye(Je,tn=>[...tn,{id:pa,turnId:mn,role:"user",content:Gt,ts:Lt,tsRaw:jo,attachments:Kn},{id:pt,turnId:mn,role:"assistant",content:"",ts:Lt,tsRaw:jo,streaming:!0}]),X(Je,""),fs.length>0&&He(Je,fs),Ke=new AbortController,P.current.set(Je,Ke);const sc=[...E7(_e,Ie,y)],mr=await X_(tt,gn,{correlationId:mn,signal:Ke==null?void 0:Ke.signal,sessionId:Me.sessionId??void 0,profile:ge.profile,persistUserMessage:gn?void 0:Gt,attachments:Kn,attachmentImportResults:fr.results,contextEntries:sc,contextGraphId:Ie??void 0,onEvent:tn=>{tn.type==="text_delta"&&(un+=tn.delta,ye(Je,gr=>gr.map(Gr=>Gr.id===pt?{...Gr,content:Gr.content+tn.delta}:Gr)))}}),fa=new Date;ye(Je,tn=>Nk(tn,mn,mr.turnId).map(gr=>{var Gr;return gr.id===pt?{...gr,content:mr.text||gr.content,turnId:((Gr=mr.turnId)==null?void 0:Gr.trim())||gr.turnId,streaming:!1,synthesized:!mr.text&&!gr.content?!0:gr.synthesized,ts:Cd(fa),tsRaw:rg(fa)}:gr})),Fe(),e===0&&t()}catch(Kn){const fr=(Kn==null?void 0:Kn.name)==="AbortError",Or=fr?"Request cancelled.":R7(ge,Kn),Ga=fr?Or:`Error: ${Or}`;pt&&ye(Je,gn=>gn.map(Nn=>Nn.id===pt?{...Nn,content:un,failureNotice:Ga,streaming:!1,synthesized:!un}:Nn)),!fr&&tt==="hermes"&&pt&&Gt&&(async()=>{try{const gn=await Q_(tt,{sessionId:Me.sessionId??void 0,correlationId:mn||void 0,userMessage:Gt,assistantReply:un,failureReason:Or,profile:ge.profile,attachments:ua,contextGraphId:Ie??void 0});gn.turnId&&ye(Je,Nn=>Nk(Nn,mn,gn.turnId)),Fe()}catch{}})(),fs.length>0&&da.length>0&&L(gn=>{const Nn=gn[Je]??[],pa=new Set(Nn.map(Lt=>Lt.id)),hr=da.filter(Lt=>!pa.has(Lt.id));return hr.length===0?gn:{...gn,[Je]:[...hr,...Nn]}}),Ne()}finally{Z(Je,!1),P.current.get(Je)===Ke&&P.current.delete(Je)}},[Ie,t,_e,y,Fe,$t,Yt,he,qt,Ne,qe,De,He,X,Z,e,ye]),Fa=w.useCallback(()=>{if(!xe)return;const ge=P.current.get(xe);ge==null||ge.abort()},[xe]),Ha=w.useCallback(async ge=>{T(ge),q(null),_(null);try{const Me=await W_(ge);k(Ae=>nd(Ae,Me.integration)),await Ne();const de=nd(b,Me.integration),je=nG({integrationId:ge,selectedSessionId:S,integrations:de});Ce(ge,{preserveSession:je,sessionId:Me.integration.defaultSessionId}),G.current=!0,_(Me.notice??(Me.integration.chatReady?`${Me.integration.name} is connected and chat-ready.`:`${Me.integration.name} attach is in progress. The node will keep checking for a live bridge.`)),a("agents")}catch(Me){await Ne(),q(Me.message)}finally{T(null)}},[b,Ne,S,Ce]),pr=w.useCallback(async ge=>{q(null),_(null);try{await Z_(ge),k(Me=>sG(Me,ge)),G.current=!1,Ce(ge,{preserveSession:j===ge}),_("The local agent was disconnected from this node. Session history remains available here."),a("agents"),await Ne()}catch(Me){q(Me.message)}},[Ne,j,Ce]),qr=w.useCallback(async ge=>{var Ae,tt,Je;if(D===ge)return;R(ge),q(null),_(null);const Me=Td({integrationId:ge,sessionId:j===ge?be.current:null,defaultSessionId:(Ae=b.find(Ke=>Ke.id===ge))==null?void 0:Ae.defaultSessionId}),[de,je]=await Promise.allSettled([K_(ge),Fx(ge,100,{sessionId:Me.sessionId??void 0})]);try{if(de.status==="fulfilled"?(k(Ke=>nd(Ke,de.value.integration)),de.value.notice&&_(de.value.notice)):q(((tt=de.reason)==null?void 0:tt.message)??"Failed to refresh integration."),je.status==="fulfilled"){const Ke=je.value.map(pt=>jk(pt,ge));ye(Me.stateKey,pt=>Ck(pt,Ke)),Q(pt=>({...pt,[Me.stateKey]:!0}))}else de.status==="fulfilled"&&q(((Je=je.reason)==null?void 0:Je.message)??"Failed to refresh conversation.")}finally{R(null)}},[b,D,j,ye]),ca=w.useCallback(ge=>{Ce(ge.integrationId,{sessionId:ge.sessionId}),a("agents")},[Ce]),ic=w.useCallback(ge=>{We(ge||null)},[We]),qa=w.useCallback(ge=>{!xe||!Ie||ce(xe,ge,Ie)},[Ie,ce,xe]),Ci=w.useCallback(ge=>{xe&&Le(xe,ge)},[Le,xe]);return o.jsxs("div",{className:"v10-panel-right",children:[o.jsxs("div",{className:"v10-agent-mode-tabs",children:[o.jsx("button",{className:`v10-agent-mode-tab ${n==="agents"?"active":""}`,onClick:()=>a("agents"),children:"Agents"}),o.jsx("button",{className:`v10-agent-mode-tab ${n==="network"?"active":""}`,onClick:()=>a("network"),children:"Network"}),o.jsx("button",{className:`v10-agent-mode-tab ${n==="sessions"?"active":""}`,onClick:()=>a("sessions"),children:"Sessions"})]}),n==="agents"&&o.jsx(lG,{integrations:b,selectedIntegrationId:j,selectedIntegration:De,selectedSessionId:S,selectedHasConversation:ke,selectedIntegrationHasAnyConversation:lt,onSelectIntegration:Ce,onConnectIntegration:Ha,onDisconnectIntegration:pr,onRefreshIntegration:qr,connectBusyId:E,refreshBusyId:D,connectNotice:U,connectError:z,localMessages:Oe,localHistoryLoaded:Ot,localChatEndRef:O,localInput:$t,onLocalInputChange:ge=>X(xe,ge),onSendLocalMessage:dr,onStopLocalStream:Fa,localSending:Yt,activeProjectId:Ie,availableProjects:_e,selectableProjects:Se,projectsLoading:Ee,onSelectProject:ic,attachments:qt,onAddAttachments:qa,onRemoveAttachment:Ci}),n==="network"&&o.jsx(pG,{peerAgents:u,connections:f,loading:g,onRefresh:et}),n==="sessions"&&o.jsx(fG,{sessions:ft,onOpenSession:ca})]})}function gG(e,t=document){const n=e==="light";t.documentElement.classList.toggle("light",n),t.body.classList.toggle("light",n)}function vG(){const{toggleLeft:e,toggleRight:t,toggleBottom:n}=Vn();w.useEffect(()=>{const a=s=>{if(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement||!(s.metaKey||s.ctrlKey))return;const u=s.key.toLowerCase();if(s.shiftKey&&u==="b"){s.preventDefault(),t();return}if(!s.shiftKey){if(u==="b"){s.preventDefault(),e();return}if(u==="j"){s.preventDefault(),n();return}}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,t,n])}const Xk={"/observability":{id:"operations",label:"Observability"},"/operations":{id:"operations",label:"Observability"},"/settings":{id:"settings",label:"Settings"}},yG={operations:"/observability",settings:"/settings",dashboard:"/"};function bG(){const{pathname:e}=Fr(),t=hg(),n=fn(s=>s.openTab),a=fn(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=yG[a];if(s){s!==e&&t(s,{replace:!0});return}Xk[e]&&t("/",{replace:!0})},[a,e,t])}function xG(){const[e,t]=w.useState(gR());return w.useEffect(()=>vR(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 wG(){const e=wg(t=>t.setNodeStatus);Xl(()=>{Tn.fetchStatus().then(e).catch(()=>{})},1e4)}function Jk(e){const t=w.useRef(null),n=w.useRef(e);return n.current=e,w.useEffect(()=>{const a=t.current;if(!a)return;let s=0;const l=f=>{const h=f.clientX-s;s=f.clientX,n.current(h)},u=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u),document.body.style.cursor="",document.body.style.userSelect="",a.classList.remove("active")},d=f=>{f.preventDefault(),s=f.clientX,document.addEventListener("mousemove",l),document.addEventListener("mouseup",u),document.body.style.cursor="col-resize",document.body.style.userSelect="none",a.classList.add("active")};return a.addEventListener("mousedown",d),()=>a.removeEventListener("mousedown",d)},[]),t}function kG(e){const t=w.useRef(e);t.current=e;const[n,a]=w.useState(null);return w.useEffect(()=>{if(!n)return;let s=0;const l=f=>{const h=f.clientY-s;s=f.clientY,t.current(h)},u=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u),document.body.style.cursor="",document.body.style.userSelect="",n.classList.remove("active")},d=f=>{f.preventDefault(),s=f.clientY,document.addEventListener("mousemove",l),document.addEventListener("mouseup",u),document.body.style.cursor="row-resize",document.body.style.userSelect="none",n.classList.add("active")};return n.addEventListener("mousedown",d),()=>{n.removeEventListener("mousedown",d),u()}},[n]),w.useCallback(s=>a(s),[])}function SG(){wG(),vG(),bG();const{leftCollapsed:e,rightCollapsed:t,bottomCollapsed:n,theme:a,leftWidth:s,rightWidth:l,setLeftWidth:u,setRightWidth:d,setBottomHeight:f}=Vn(),[,h]=w.useState(0);w.useEffect(()=>{gG(a)},[a]),w.useEffect(()=>{const N=()=>h(S=>S+1);return window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),w.useLayoutEffect(()=>{const N=window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("resize"))});return()=>window.cancelAnimationFrame(N)},[e,t]);const g=w.useCallback(N=>{const S=Vn.getState().leftWidth;u(Math.max(140,Math.min(400,S+N)))},[u]),m=w.useCallback(N=>{const S=Vn.getState().rightWidth;d(Math.max(200,Math.min(500,S-N)))},[d]),y=w.useCallback(N=>{const S=Math.min(Vn.getState().bottomHeight,sd());f(Math.min(S-N,sd()))},[f]),b=Jk(g),k=Jk(m),j=kG(y);return o.jsxs("div",{className:"v10-app",children:[o.jsx(xG,{}),o.jsx(wL,{}),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(f4,{})}),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(s7,{})}),!n&&o.jsx("div",{className:"v10-resize-handle-v",ref:j}),o.jsx(b7,{})]}),!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(mG,{})})]})]})]})}const jG=Ve.lazy(()=>gt(()=>import("./Network-DKw_XEGi.js"),[]).then(e=>({default:e.NetworkPage})));function CG(){const e=fn(t=>t.openTab);return w.useLayoutEffect(()=>{e(Sj)},[e]),o.jsx(El,{to:"/",replace:!0})}function NG(){return o.jsxs(f2,{children:[o.jsx(vi,{path:"/network",element:o.jsx(Ve.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading..."}),children:o.jsx(jG,{})})}),o.jsx(vi,{path:"/context-graph-primer",element:o.jsx(CG,{})}),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(SG,{})})]})}mT.createRoot(document.getElementById("root")).render(o.jsx(Ve.StrictMode,{children:o.jsx($2,{basename:"/ui",children:o.jsx(NG,{})})}));export{iV as $,aD as A,tV as B,lO as C,XG as D,ln as E,JG as F,YG as G,$n as H,KG as I,QG as J,BG as K,yS as L,jg as M,eV as N,HG as O,mG as P,Lg as Q,Ve as R,Fd as S,A5 as T,lV as U,m1 as V,zO as W,J4 as X,eM as Y,PO as Z,gt as _,ts as a,h4 as a0,UO as a1,TG as a2,Wl as a3,UR as a4,FR as a5,R5 as a6,PS as a7,IG as a8,PG as a9,RM as aA,cs as aB,wg as aC,mz as aD,lr as aE,Gg as aF,Ji as aG,FS as aH,HS as aI,Pl as aJ,CM as aK,Ua as aL,Tr as aM,fn as aN,oV as aO,w5 as aP,HR as aa,aV as ab,sV as ac,o as ad,$G as ae,DG as af,s_ as ag,cV as ah,GS as ai,Em as aj,RG as ak,i_ as al,OG as am,MG as an,zR as ao,LG as ap,w as aq,g1 as ar,nV as as,g5 as at,O5 as au,gv as av,rV as aw,Ks as ax,FG as ay,qG as az,xj as b,uO as c,fO as d,wO as e,yj as f,At as g,Ft as h,mk as i,jm as j,AG as k,cn as l,_G as m,UG as n,Wx as o,Cg as p,l_ as q,WG as r,ZG as s,d_ as t,GG as u,zG as v,f_ as w,VG as x,p_ as y,od as z};