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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/chain-cursor-stores.d.ts +45 -0
  2. package/dist/chain-cursor-stores.d.ts.map +1 -0
  3. package/dist/chain-cursor-stores.js +107 -0
  4. package/dist/chain-cursor-stores.js.map +1 -0
  5. package/dist/chat-memory.d.ts +0 -17
  6. package/dist/chat-memory.d.ts.map +1 -1
  7. package/dist/chat-memory.js +6 -33
  8. package/dist/chat-memory.js.map +1 -1
  9. package/dist/db.d.ts +15 -0
  10. package/dist/db.d.ts.map +1 -1
  11. package/dist/db.js +40 -1
  12. package/dist/db.js.map +1 -1
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +2 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/notifications-scope.d.ts +19 -0
  18. package/dist/notifications-scope.d.ts.map +1 -1
  19. package/dist/notifications-scope.js +34 -2
  20. package/dist/notifications-scope.js.map +1 -1
  21. package/dist-ui/assets/{3d-force-graph-CcVMtgO4.js → 3d-force-graph-DRDhpplH.js} +1 -1
  22. package/dist-ui/assets/AgentHub-DdUAxJoy.js +1 -0
  23. package/dist-ui/assets/AgentProfilePage-yI8fA4vv.js +1 -0
  24. package/dist-ui/assets/ApproveWalletsModal-9w2edv7e.js +57 -0
  25. package/dist-ui/assets/ConvictionDetailView-CcQMya-y.js +2 -0
  26. package/dist-ui/assets/Network-DpAKVzwi.js +1 -0
  27. package/dist-ui/assets/OnChainProvenanceCard-DMOm3jLz.js +1 -0
  28. package/dist-ui/assets/{Operations-CCMDENBd.js → Operations-DKJFp6hM.js} +1 -1
  29. package/dist-ui/assets/PublishingConviction-1CPHxNwp.js +2 -0
  30. package/dist-ui/assets/Settings-DaYMlGHD.js +1 -0
  31. package/dist-ui/assets/ccip-hCQYqfNz.js +1 -0
  32. package/dist-ui/assets/{index-BrxEjqsW.js → index-Bh_8bMB0.js} +3 -3
  33. package/dist-ui/assets/{index-W4n8cdTA.js → index-CVwCoJrM.js} +10 -10
  34. package/dist-ui/assets/index-D5UiTYlY.css +1 -0
  35. package/dist-ui/assets/index-DGpnb_b1.js +1661 -0
  36. package/dist-ui/assets/{jsonld-32FQRO67-CbN9NJJW.js → jsonld-32FQRO67-C3B_LjZ-.js} +2 -2
  37. package/dist-ui/assets/{jsonld-DkQdPwg5.js → jsonld-CoPRWQuM.js} +1 -1
  38. package/dist-ui/assets/{renderer-3d-2EVDZII7-CTUExXUn.js → renderer-3d-2EVDZII7-Bx6o7Gge.js} +2 -2
  39. package/dist-ui/index.html +2 -2
  40. package/package.json +5 -3
  41. package/dist-ui/assets/Admin-DNNaF7rz.js +0 -45
  42. package/dist-ui/assets/AgentHub-eWb_Tns6.js +0 -1
  43. package/dist-ui/assets/AgentProfilePage-D2T_V6PG.js +0 -1
  44. package/dist-ui/assets/Network-C6MDsv2e.js +0 -1
  45. package/dist-ui/assets/OnChainProvenanceCard-BbrU7jzL.js +0 -1
  46. package/dist-ui/assets/Settings-WaFKYtwQ.js +0 -1
  47. package/dist-ui/assets/ccip-CDdHldzo.js +0 -1
  48. package/dist-ui/assets/formatTrac-BTy0WudH.js +0 -1
  49. package/dist-ui/assets/index-2Gzrk1k3.js +0 -1661
  50. package/dist-ui/assets/index-CmliV5st.css +0 -1
@@ -1,1661 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BrxEjqsW.js","assets/ordinal-DhEzRPdO.js","assets/OnChainProvenanceCard-BbrU7jzL.js","assets/Operations-CCMDENBd.js","assets/Settings-WaFKYtwQ.js","assets/formatTrac-BTy0WudH.js","assets/Admin-DNNaF7rz.js"])))=>i.map(i=>d[i]);
2
- var oT=Object.defineProperty;var lT=(e,t,n)=>t in e?oT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Sn=(e,t,n)=>lT(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const c of s)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(s){const c={};return s.integrity&&(c.integrity=s.integrity),s.referrerPolicy&&(c.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?c.credentials="include":s.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(s){if(s.ep)return;s.ep=!0;const c=n(s);fetch(s.href,c)}})();var E7=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function T7(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var qf={exports:{}},rl={};/**
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 q0;function cT(){if(q0)return rl;q0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,c){var u=null;if(c!==void 0&&(u=""+c),s.key!==void 0&&(u=""+s.key),"key"in s){c={};for(var d in s)d!=="key"&&(c[d]=s[d])}else c=s;return s=c.ref,{$$typeof:e,type:r,key:u,ref:s!==void 0?s:null,props:c}}return rl.Fragment=t,rl.jsx=n,rl.jsxs=n,rl}var G0;function uT(){return G0||(G0=1,qf.exports=cT()),qf.exports}var o=uT(),Gf={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 V0;function dT(){if(V0)return Ge;V0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=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 x(U){return U===null||typeof U!="object"?null:(U=y&&U[y]||U["@@iterator"],typeof U=="function"?U:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,E={};function S(U,G,O){this.props=U,this.context=G,this.refs=E,this.updater=O||k}S.prototype.isReactComponent={},S.prototype.setState=function(U,G){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,G,"setState")},S.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function T(){}T.prototype=S.prototype;function N(U,G,O){this.props=U,this.context=G,this.refs=E,this.updater=O||k}var A=N.prototype=new T;A.constructor=N,j(A,S.prototype),A.isPureReactComponent=!0;var q=Array.isArray;function R(){}var $={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function z(U,G,O){var ne=O.ref;return{$$typeof:e,type:U,key:G,ref:ne!==void 0?ne:null,props:O}}function _(U,G){return z(U.type,G,U.props)}function P(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function B(U){var G={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(O){return G[O]})}var W=/\/+/g;function I(U,G){return typeof U=="object"&&U!==null&&U.key!=null?B(""+U.key):G.toString(36)}function D(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(R,R):(U.status="pending",U.then(function(G){U.status==="pending"&&(U.status="fulfilled",U.value=G)},function(G){U.status==="pending"&&(U.status="rejected",U.reason=G)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function F(U,G,O,ne,ue){var le=typeof U;(le==="undefined"||le==="boolean")&&(U=null);var be=!1;if(U===null)be=!0;else switch(le){case"bigint":case"string":case"number":be=!0;break;case"object":switch(U.$$typeof){case e:case t:be=!0;break;case g:return be=U._init,F(be(U._payload),G,O,ne,ue)}}if(be)return ue=ue(U),be=ne===""?"."+I(U,0):ne,q(ue)?(O="",be!=null&&(O=be.replace(W,"$&/")+"/"),F(ue,G,O,"",function(Ie){return Ie})):ue!=null&&(P(ue)&&(ue=_(ue,O+(ue.key==null||U&&U.key===ue.key?"":(""+ue.key).replace(W,"$&/")+"/")+be)),G.push(ue)),1;be=0;var Re=ne===""?".":ne+":";if(q(U))for(var Ee=0;Ee<U.length;Ee++)ne=U[Ee],le=Re+I(ne,Ee),be+=F(ne,G,O,le,ue);else if(Ee=x(U),typeof Ee=="function")for(U=Ee.call(U),Ee=0;!(ne=U.next()).done;)ne=ne.value,le=Re+I(ne,Ee++),be+=F(ne,G,O,le,ue);else if(le==="object"){if(typeof U.then=="function")return F(D(U),G,O,ne,ue);throw G=String(U),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return be}function V(U,G,O){if(U==null)return U;var ne=[],ue=0;return F(U,ne,"","",function(le){return G.call(O,le,ue++)}),ne}function X(U){if(U._status===-1){var G=U._result;G=G(),G.then(function(O){(U._status===0||U._status===-1)&&(U._status=1,U._result=O)},function(O){(U._status===0||U._status===-1)&&(U._status=2,U._result=O)}),U._status===-1&&(U._status=0,U._result=G)}if(U._status===1)return U._result.default;throw U._result}var Q=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},L={map:V,forEach:function(U,G,O){V(U,function(){G.apply(this,arguments)},O)},count:function(U){var G=0;return V(U,function(){G++}),G},toArray:function(U){return V(U,function(G){return G})||[]},only:function(U){if(!P(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Ge.Activity=m,Ge.Children=L,Ge.Component=S,Ge.Fragment=n,Ge.Profiler=s,Ge.PureComponent=N,Ge.StrictMode=r,Ge.Suspense=f,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(U){return $.H.useMemoCache(U)}},Ge.cache=function(U){return function(){return U.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(U,G,O){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var ne=j({},U.props),ue=U.key;if(G!=null)for(le in G.key!==void 0&&(ue=""+G.key),G)!H.call(G,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&G.ref===void 0||(ne[le]=G[le]);var le=arguments.length-2;if(le===1)ne.children=O;else if(1<le){for(var be=Array(le),Re=0;Re<le;Re++)be[Re]=arguments[Re+2];ne.children=be}return z(U.type,ue,ne)},Ge.createContext=function(U){return U={$$typeof:u,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:c,_context:U},U},Ge.createElement=function(U,G,O){var ne,ue={},le=null;if(G!=null)for(ne in G.key!==void 0&&(le=""+G.key),G)H.call(G,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(ue[ne]=G[ne]);var be=arguments.length-2;if(be===1)ue.children=O;else if(1<be){for(var Re=Array(be),Ee=0;Ee<be;Ee++)Re[Ee]=arguments[Ee+2];ue.children=Re}if(U&&U.defaultProps)for(ne in be=U.defaultProps,be)ue[ne]===void 0&&(ue[ne]=be[ne]);return z(U,le,ue)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(U){return{$$typeof:d,render:U}},Ge.isValidElement=P,Ge.lazy=function(U){return{$$typeof:g,_payload:{_status:-1,_result:U},_init:X}},Ge.memo=function(U,G){return{$$typeof:h,type:U,compare:G===void 0?null:G}},Ge.startTransition=function(U){var G=$.T,O={};$.T=O;try{var ne=U(),ue=$.S;ue!==null&&ue(O,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(R,Q)}catch(le){Q(le)}finally{G!==null&&O.types!==null&&(G.types=O.types),$.T=G}},Ge.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Ge.use=function(U){return $.H.use(U)},Ge.useActionState=function(U,G,O){return $.H.useActionState(U,G,O)},Ge.useCallback=function(U,G){return $.H.useCallback(U,G)},Ge.useContext=function(U){return $.H.useContext(U)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(U,G){return $.H.useDeferredValue(U,G)},Ge.useEffect=function(U,G){return $.H.useEffect(U,G)},Ge.useEffectEvent=function(U){return $.H.useEffectEvent(U)},Ge.useId=function(){return $.H.useId()},Ge.useImperativeHandle=function(U,G,O){return $.H.useImperativeHandle(U,G,O)},Ge.useInsertionEffect=function(U,G){return $.H.useInsertionEffect(U,G)},Ge.useLayoutEffect=function(U,G){return $.H.useLayoutEffect(U,G)},Ge.useMemo=function(U,G){return $.H.useMemo(U,G)},Ge.useOptimistic=function(U,G){return $.H.useOptimistic(U,G)},Ge.useReducer=function(U,G,O){return $.H.useReducer(U,G,O)},Ge.useRef=function(U){return $.H.useRef(U)},Ge.useState=function(U){return $.H.useState(U)},Ge.useSyncExternalStore=function(U,G,O){return $.H.useSyncExternalStore(U,G,O)},Ge.useTransition=function(){return $.H.useTransition()},Ge.version="19.2.4",Ge}var W0;function $m(){return W0||(W0=1,Gf.exports=dT()),Gf.exports}var w=$m();const Ze=$l(w);var Vf={exports:{}},il={},Wf={exports:{}},Zf={};/**
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 Z0;function pT(){return Z0||(Z0=1,(function(e){function t(F,V){var X=F.length;F.push(V);e:for(;0<X;){var Q=X-1>>>1,L=F[Q];if(0<s(L,V))F[Q]=V,F[X]=L,X=Q;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var V=F[0],X=F.pop();if(X!==V){F[0]=X;e:for(var Q=0,L=F.length,U=L>>>1;Q<U;){var G=2*(Q+1)-1,O=F[G],ne=G+1,ue=F[ne];if(0>s(O,X))ne<L&&0>s(ue,O)?(F[Q]=ue,F[ne]=X,Q=ne):(F[Q]=O,F[G]=X,Q=G);else if(ne<L&&0>s(ue,X))F[Q]=ue,F[ne]=X,Q=ne;else break e}}return V}function s(F,V){var X=F.sortIndex-V.sortIndex;return X!==0?X:F.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.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,x=!1,k=!1,j=!1,E=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function A(F){for(var V=n(h);V!==null;){if(V.callback===null)r(h);else if(V.startTime<=F)r(h),V.sortIndex=V.expirationTime,t(f,V);else break;V=n(h)}}function q(F){if(j=!1,A(F),!k)if(n(f)!==null)k=!0,R||(R=!0,B());else{var V=n(h);V!==null&&D(q,V.startTime-F)}}var R=!1,$=-1,H=5,z=-1;function _(){return E?!0:!(e.unstable_now()-z<H)}function P(){if(E=!1,R){var F=e.unstable_now();z=F;var V=!0;try{e:{k=!1,j&&(j=!1,T($),$=-1),x=!0;var X=y;try{t:{for(A(F),m=n(f);m!==null&&!(m.expirationTime>F&&_());){var Q=m.callback;if(typeof Q=="function"){m.callback=null,y=m.priorityLevel;var L=Q(m.expirationTime<=F);if(F=e.unstable_now(),typeof L=="function"){m.callback=L,A(F),V=!0;break t}m===n(f)&&r(f),A(F)}else r(f);m=n(f)}if(m!==null)V=!0;else{var U=n(h);U!==null&&D(q,U.startTime-F),V=!1}}break e}finally{m=null,y=X,x=!1}V=void 0}}finally{V?B():R=!1}}}var B;if(typeof N=="function")B=function(){N(P)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,I=W.port2;W.port1.onmessage=P,B=function(){I.postMessage(null)}}else B=function(){S(P,0)};function D(F,V){$=S(function(){F(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(F){switch(y){case 1:case 2:case 3:var V=3;break;default:V=y}var X=y;y=V;try{return F()}finally{y=X}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(F,V){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var X=y;y=F;try{return V()}finally{y=X}},e.unstable_scheduleCallback=function(F,V,X){var Q=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?Q+X:Q):X=Q,F){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=X+L,F={id:g++,callback:V,priorityLevel:F,startTime:X,expirationTime:L,sortIndex:-1},X>Q?(F.sortIndex=X,t(h,F),n(f)===null&&F===n(h)&&(j?(T($),$=-1):j=!0,D(q,X-Q))):(F.sortIndex=L,t(f,F),k||x||(k=!0,R||(R=!0,B()))),F},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(F){var V=y;return function(){var X=y;y=V;try{return F.apply(this,arguments)}finally{y=X}}}})(Zf)),Zf}var Y0;function fT(){return Y0||(Y0=1,Wf.exports=pT()),Wf.exports}var Yf={exports:{}},Nn={};/**
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 Q0;function hT(){if(Q0)return Nn;Q0=1;var e=$m();function t(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function c(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 Nn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Nn.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 c(f,h,null,g)},Nn.flushSync=function(f){var h=u.T,g=r.p;try{if(u.T=null,r.p=2,f)return f()}finally{u.T=h,r.p=g,r.d.f()}},Nn.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(f,h))},Nn.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Nn.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,x=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?r.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:x}):g==="script"&&r.d.X(f,{crossOrigin:m,integrity:y,fetchPriority:x,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Nn.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=d(h.as,h.crossOrigin);r.d.M(f,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(f)},Nn.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,m=d(g,h.crossOrigin);r.d.L(f,g,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Nn.preloadModule=function(f,h){if(typeof f=="string")if(h){var g=d(h.as,h.crossOrigin);r.d.m(f,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(f)},Nn.requestFormReset=function(f){r.d.r(f)},Nn.unstable_batchedUpdates=function(f,h){return f(h)},Nn.useFormState=function(f,h,g){return u.H.useFormState(f,h,g)},Nn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Nn.version="19.2.4",Nn}var K0;function gk(){if(K0)return Yf.exports;K0=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(),Yf.exports=hT(),Yf.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 X0;function mT(){if(X0)return il;X0=1;var e=fT(),t=$m(),n=gk();function r(a){var i="https://react.dev/errors/"+a;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)i+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+a+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function c(a){var i=a,l=a;if(a.alternate)for(;i.return;)i=i.return;else{a=i;do i=a,(i.flags&4098)!==0&&(l=i.return),a=i.return;while(a)}return i.tag===3?l:null}function u(a){if(a.tag===13){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function d(a){if(a.tag===31){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function f(a){if(c(a)!==a)throw Error(r(188))}function h(a){var i=a.alternate;if(!i){if(i=c(a),i===null)throw Error(r(188));return i!==a?null:a}for(var l=a,p=i;;){var v=l.return;if(v===null)break;var b=v.alternate;if(b===null){if(p=v.return,p!==null){l=p;continue}break}if(v.child===b.child){for(b=v.child;b;){if(b===l)return f(v),a;if(b===p)return f(v),i;b=b.sibling}throw Error(r(188))}if(l.return!==p.return)l=v,p=b;else{for(var C=!1,M=v.child;M;){if(M===l){C=!0,l=v,p=b;break}if(M===p){C=!0,p=v,l=b;break}M=M.sibling}if(!C){for(M=b.child;M;){if(M===l){C=!0,l=b,p=v;break}if(M===p){C=!0,p=b,l=v;break}M=M.sibling}if(!C)throw Error(r(189))}}if(l.alternate!==p)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?a:i}function g(a){var i=a.tag;if(i===5||i===26||i===27||i===6)return a;for(a=a.child;a!==null;){if(i=g(a),i!==null)return i;a=a.sibling}return null}var m=Object.assign,y=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),N=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),_=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function B(a){return a===null||typeof a!="object"?null:(a=P&&a[P]||a["@@iterator"],typeof a=="function"?a:null)}var W=Symbol.for("react.client.reference");function I(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===W?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case j:return"Fragment";case S:return"Profiler";case E:return"StrictMode";case q:return"Suspense";case R:return"SuspenseList";case z:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case k:return"Portal";case N:return a.displayName||"Context";case T:return(a._context.displayName||"Context")+".Consumer";case A:var i=a.render;return a=a.displayName,a||(a=i.displayName||i.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case $:return i=a.displayName||null,i!==null?i:I(a.type)||"Memo";case H:i=a._payload,a=a._init;try{return I(a(i))}catch{}}return null}var D=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},Q=[],L=-1;function U(a){return{current:a}}function G(a){0>L||(a.current=Q[L],Q[L]=null,L--)}function O(a,i){L++,Q[L]=a.current,a.current=i}var ne=U(null),ue=U(null),le=U(null),be=U(null);function Re(a,i){switch(O(le,i),O(ue,a),O(ne,null),i.nodeType){case 9:case 11:a=(a=i.documentElement)&&(a=a.namespaceURI)?f0(a):0;break;default:if(a=i.tagName,i=i.namespaceURI)i=f0(i),a=h0(i,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}G(ne),O(ne,a)}function Ee(){G(ne),G(ue),G(le)}function Ie(a){a.memoizedState!==null&&O(be,a);var i=ne.current,l=h0(i,a.type);i!==l&&(O(ue,a),O(ne,l))}function Ve(a){ue.current===a&&(G(ne),G(ue)),be.current===a&&(G(be),el._currentValue=X)}var Se,ht;function Me(a){if(Se===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);Se=i&&i[1]||"",ht=-1<l.stack.indexOf(`
43
- at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
44
- `+Se+a+ht}var qe=!1;function ke(a,i){if(!a||qe)return"";qe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(i){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(oe){var se=oe}Reflect.construct(a,[],me)}else{try{me.call()}catch(oe){se=oe}a.call(me.prototype)}}else{try{throw Error()}catch(oe){se=oe}(me=a())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(oe){if(oe&&se&&typeof oe.stack=="string")return[oe.stack,se.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=p.DetermineComponentFrameRoot(),C=b[0],M=b[1];if(C&&M){var Y=C.split(`
45
- `),re=M.split(`
46
- `);for(v=p=0;p<Y.length&&!Y[p].includes("DetermineComponentFrameRoot");)p++;for(;v<re.length&&!re[v].includes("DetermineComponentFrameRoot");)v++;if(p===Y.length||v===re.length)for(p=Y.length-1,v=re.length-1;1<=p&&0<=v&&Y[p]!==re[v];)v--;for(;1<=p&&0<=v;p--,v--)if(Y[p]!==re[v]){if(p!==1||v!==1)do if(p--,v--,0>v||Y[p]!==re[v]){var pe=`
47
- `+Y[p].replace(" at new "," at ");return a.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",a.displayName)),pe}while(1<=p&&0<=v);break}}}finally{qe=!1,Error.prepareStackTrace=l}return(l=a?a.displayName||a.name:"")?Me(l):""}function ct(a,i){switch(a.tag){case 26:case 27:case 5:return Me(a.type);case 16:return Me("Lazy");case 13:return a.child!==i&&i!==null?Me("Suspense Fallback"):Me("Suspense");case 19:return Me("SuspenseList");case 0:case 15:return ke(a.type,!1);case 11:return ke(a.type.render,!1);case 1:return ke(a.type,!0);case 31:return Me("Activity");default:return""}}function xe(a){try{var i="",l=null;do i+=ct(a,l),l=a,a=a.return;while(a);return i}catch(p){return`
48
- Error generating stack: `+p.message+`
49
- `+p.stack}}var Oe=Object.prototype.hasOwnProperty,_t=e.unstable_scheduleCallback,Dt=e.unstable_cancelCallback,Qt=e.unstable_shouldYield,Ft=e.unstable_requestPaint,dt=e.unstable_now,ye=e.unstable_getCurrentPriorityLevel,K=e.unstable_ImmediatePriority,Z=e.unstable_UserBlockingPriority,ee=e.unstable_NormalPriority,ce=e.unstable_LowPriority,he=e.unstable_IdlePriority,Le=e.log,He=e.unstable_setDisableYieldValue,Ce=null,Fe=null;function et(a){if(typeof Le=="function"&&He(a),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(Ce,a)}catch{}}var Ne=Math.clz32?Math.clz32:Ha,Wt=Math.log,At=Math.LN2;function Ha(a){return a>>>=0,a===0?32:31-(Wt(a)/At|0)|0}var la=256,Ur=262144,Br=4194304;function ca(a){var i=a&42;if(i!==0)return i;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function qa(a,i,l){var p=a.pendingLanes;if(p===0)return 0;var v=0,b=a.suspendedLanes,C=a.pingedLanes;a=a.warmLanes;var M=p&134217727;return M!==0?(p=M&~b,p!==0?v=ca(p):(C&=M,C!==0?v=ca(C):l||(l=M&~a,l!==0&&(v=ca(l))))):(M=p&~b,M!==0?v=ca(M):C!==0?v=ca(C):l||(l=p&~a,l!==0&&(v=ca(l)))),v===0?0:i!==0&&i!==v&&(i&b)===0&&(b=v&-v,l=i&-i,b>=l||b===32&&(l&4194048)!==0)?i:v}function or(a,i){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&i)===0}function Zl(a,i){switch(a){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Fr(){var a=Br;return Br<<=1,(Br&62914560)===0&&(Br=4194304),a}function wi(a){for(var i=[],l=0;31>l;l++)i.push(a);return i}function ge(a,i){a.pendingLanes|=i,i!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function ze(a,i,l,p,v,b){var C=a.pendingLanes;a.pendingLanes=l,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=l,a.entangledLanes&=l,a.errorRecoveryDisabledLanes&=l,a.shellSuspendCounter=0;var M=a.entanglements,Y=a.expirationTimes,re=a.hiddenUpdates;for(l=C&~l;0<l;){var pe=31-Ne(l),me=1<<pe;M[pe]=0,Y[pe]=-1;var se=re[pe];if(se!==null)for(re[pe]=null,pe=0;pe<se.length;pe++){var oe=se[pe];oe!==null&&(oe.lane&=-536870913)}l&=~me}p!==0&&de(a,p,0),b!==0&&v===0&&a.tag!==0&&(a.suspendedLanes|=b&~(C&~i))}function de(a,i,l){a.pendingLanes|=i,a.suspendedLanes&=~i;var p=31-Ne(i);a.entangledLanes|=i,a.entanglements[p]=a.entanglements[p]|1073741824|l&261930}function je(a,i){var l=a.entangledLanes|=i;for(a=a.entanglements;l;){var p=31-Ne(l),v=1<<p;v&i|a[p]&i&&(a[p]|=i),l&=~v}}function Te(a,i){var l=i&-i;return l=(l&42)!==0?1:tt(l),(l&(a.suspendedLanes|i))!==0?0:l}function tt(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function Je(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function Ye(){var a=V.p;return a!==0?a:(a=window.event,a===void 0?32:$0(a.type))}function ft(a,i){var l=V.p;try{return V.p=a,i()}finally{V.p=l}}var hn=Math.random().toString(36).slice(2),Ht="__reactFiber$"+hn,cn="__reactProps$"+hn,lr="__reactContainer$"+hn,cr="__reactEvents$"+hn,ss="__reactListeners$"+hn,Wn="__reactHandles$"+hn,ua="__reactResources$"+hn,Aa="__reactMarker$"+hn;function Hr(a){delete a[Ht],delete a[cn],delete a[cr],delete a[ss],delete a[Wn]}function mn(a){var i=a[Ht];if(i)return i;for(var l=a.parentNode;l;){if(i=l[lr]||l[Ht]){if(l=i.alternate,i.child!==null||l!==null&&l.child!==null)for(a=w0(a);a!==null;){if(l=a[Ht])return l;a=w0(a)}return i}a=l,l=a.parentNode}return null}function Cn(a){if(a=a[Ht]||a[lr]){var i=a.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return a}return null}function ur(a){var i=a.tag;if(i===5||i===26||i===27||i===6)return a.stateNode;throw Error(r(33))}function da(a){var i=a[ua];return i||(i=a[ua]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Ot(a){a[Aa]=!0}var go=new Set,Yl={};function pa(a,i){dr(a,i),dr(a+"Capture",i)}function dr(a,i){for(Yl[a]=i,a=0;a<i.length;a++)go.add(i[a])}var en=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fa={},Ga={};function JC(a){return Oe.call(Ga,a)?!0:Oe.call(fa,a)?!1:en.test(a)?Ga[a]=!0:(fa[a]=!0,!1)}function Ql(a,i,l){if(JC(i))if(l===null)a.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":a.removeAttribute(i);return;case"boolean":var p=i.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){a.removeAttribute(i);return}}a.setAttribute(i,""+l)}}function Kl(a,i,l){if(l===null)a.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(i);return}a.setAttribute(i,""+l)}}function pr(a,i,l,p){if(p===null)a.removeAttribute(l);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(l);return}a.setAttributeNS(i,l,""+p)}}function ha(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function iv(a){var i=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function eN(a,i,l){var p=Object.getOwnPropertyDescriptor(a.constructor.prototype,i);if(!a.hasOwnProperty(i)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var v=p.get,b=p.set;return Object.defineProperty(a,i,{configurable:!0,get:function(){return v.call(this)},set:function(C){l=""+C,b.call(this,C)}}),Object.defineProperty(a,i,{enumerable:p.enumerable}),{getValue:function(){return l},setValue:function(C){l=""+C},stopTracking:function(){a._valueTracker=null,delete a[i]}}}}function Dd(a){if(!a._valueTracker){var i=iv(a)?"checked":"value";a._valueTracker=eN(a,i,""+a[i])}}function sv(a){if(!a)return!1;var i=a._valueTracker;if(!i)return!0;var l=i.getValue(),p="";return a&&(p=iv(a)?a.checked?"true":"false":a.value),a=p,a!==l?(i.setValue(a),!0):!1}function Xl(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var tN=/[\n"\\]/g;function ma(a){return a.replace(tN,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function $d(a,i,l,p,v,b,C,M){a.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?a.type=C:a.removeAttribute("type"),i!=null?C==="number"?(i===0&&a.value===""||a.value!=i)&&(a.value=""+ha(i)):a.value!==""+ha(i)&&(a.value=""+ha(i)):C!=="submit"&&C!=="reset"||a.removeAttribute("value"),i!=null?Id(a,C,ha(i)):l!=null?Id(a,C,ha(l)):p!=null&&a.removeAttribute("value"),v==null&&b!=null&&(a.defaultChecked=!!b),v!=null&&(a.checked=v&&typeof v!="function"&&typeof v!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?a.name=""+ha(M):a.removeAttribute("name")}function ov(a,i,l,p,v,b,C,M){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(a.type=b),i!=null||l!=null){if(!(b!=="submit"&&b!=="reset"||i!=null)){Dd(a);return}l=l!=null?""+ha(l):"",i=i!=null?""+ha(i):l,M||i===a.value||(a.value=i),a.defaultValue=i}p=p??v,p=typeof p!="function"&&typeof p!="symbol"&&!!p,a.checked=M?a.checked:!!p,a.defaultChecked=!!p,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(a.name=C),Dd(a)}function Id(a,i,l){i==="number"&&Xl(a.ownerDocument)===a||a.defaultValue===""+l||(a.defaultValue=""+l)}function os(a,i,l,p){if(a=a.options,i){i={};for(var v=0;v<l.length;v++)i["$"+l[v]]=!0;for(l=0;l<a.length;l++)v=i.hasOwnProperty("$"+a[l].value),a[l].selected!==v&&(a[l].selected=v),v&&p&&(a[l].defaultSelected=!0)}else{for(l=""+ha(l),i=null,v=0;v<a.length;v++){if(a[v].value===l){a[v].selected=!0,p&&(a[v].defaultSelected=!0);return}i!==null||a[v].disabled||(i=a[v])}i!==null&&(i.selected=!0)}}function lv(a,i,l){if(i!=null&&(i=""+ha(i),i!==a.value&&(a.value=i),l==null)){a.defaultValue!==i&&(a.defaultValue=i);return}a.defaultValue=l!=null?""+ha(l):""}function cv(a,i,l,p){if(i==null){if(p!=null){if(l!=null)throw Error(r(92));if(D(p)){if(1<p.length)throw Error(r(93));p=p[0]}l=p}l==null&&(l=""),i=l}l=ha(i),a.defaultValue=l,p=a.textContent,p===l&&p!==""&&p!==null&&(a.value=p),Dd(a)}function ls(a,i){if(i){var l=a.firstChild;if(l&&l===a.lastChild&&l.nodeType===3){l.nodeValue=i;return}}a.textContent=i}var nN=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(a,i,l){var p=i.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?p?a.setProperty(i,""):i==="float"?a.cssFloat="":a[i]="":p?a.setProperty(i,l):typeof l!="number"||l===0||nN.has(i)?i==="float"?a.cssFloat=l:a[i]=(""+l).trim():a[i]=l+"px"}function dv(a,i,l){if(i!=null&&typeof i!="object")throw Error(r(62));if(a=a.style,l!=null){for(var p in l)!l.hasOwnProperty(p)||i!=null&&i.hasOwnProperty(p)||(p.indexOf("--")===0?a.setProperty(p,""):p==="float"?a.cssFloat="":a[p]="");for(var v in i)p=i[v],i.hasOwnProperty(v)&&l[v]!==p&&uv(a,v,p)}else for(var b in i)i.hasOwnProperty(b)&&uv(a,b,i[b])}function Pd(a){if(a.indexOf("-")===-1)return!1;switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var aN=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"]]),rN=/^[\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 Jl(a){return rN.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function fr(){}var Ud=null;function Bd(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var cs=null,us=null;function pv(a){var i=Cn(a);if(i&&(a=i.stateNode)){var l=a[cn]||null;e:switch(a=i.stateNode,i.type){case"input":if($d(a,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),i=l.name,l.type==="radio"&&i!=null){for(l=a;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+ma(""+i)+'"][type="radio"]'),i=0;i<l.length;i++){var p=l[i];if(p!==a&&p.form===a.form){var v=p[cn]||null;if(!v)throw Error(r(90));$d(p,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(i=0;i<l.length;i++)p=l[i],p.form===a.form&&sv(p)}break e;case"textarea":lv(a,l.value,l.defaultValue);break e;case"select":i=l.value,i!=null&&os(a,!!l.multiple,i,!1)}}}var Fd=!1;function fv(a,i,l){if(Fd)return a(i,l);Fd=!0;try{var p=a(i);return p}finally{if(Fd=!1,(cs!==null||us!==null)&&(Uc(),cs&&(i=cs,a=us,us=cs=null,pv(i),a)))for(i=0;i<a.length;i++)pv(a[i])}}function vo(a,i){var l=a.stateNode;if(l===null)return null;var p=l[cn]||null;if(p===null)return null;l=p[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(a=a.type,p=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!p;break e;default:a=!1}if(a)return null;if(l&&typeof l!="function")throw Error(r(231,i,typeof l));return l}var hr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hd=!1;if(hr)try{var yo={};Object.defineProperty(yo,"passive",{get:function(){Hd=!0}}),window.addEventListener("test",yo,yo),window.removeEventListener("test",yo,yo)}catch{Hd=!1}var qr=null,qd=null,ec=null;function hv(){if(ec)return ec;var a,i=qd,l=i.length,p,v="value"in qr?qr.value:qr.textContent,b=v.length;for(a=0;a<l&&i[a]===v[a];a++);var C=l-a;for(p=1;p<=C&&i[l-p]===v[b-p];p++);return ec=v.slice(a,1<p?1-p:void 0)}function tc(a){var i=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&i===13&&(a=13)):a=i,a===10&&(a=13),32<=a||a===13?a:0}function nc(){return!0}function mv(){return!1}function Dn(a){function i(l,p,v,b,C){this._reactName=l,this._targetInst=v,this.type=p,this.nativeEvent=b,this.target=C,this.currentTarget=null;for(var M in a)a.hasOwnProperty(M)&&(l=a[M],this[M]=l?l(b):b[M]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?nc:mv,this.isPropagationStopped=mv,this}return m(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=nc)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=nc)},persist:function(){},isPersistent:nc}),i}var ki={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ac=Dn(ki),bo=m({},ki,{view:0,detail:0}),iN=Dn(bo),Gd,Vd,xo,rc=m({},bo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zd,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==xo&&(xo&&a.type==="mousemove"?(Gd=a.screenX-xo.screenX,Vd=a.screenY-xo.screenY):Vd=Gd=0,xo=a),Gd)},movementY:function(a){return"movementY"in a?a.movementY:Vd}}),gv=Dn(rc),sN=m({},rc,{dataTransfer:0}),oN=Dn(sN),lN=m({},bo,{relatedTarget:0}),Wd=Dn(lN),cN=m({},ki,{animationName:0,elapsedTime:0,pseudoElement:0}),uN=Dn(cN),dN=m({},ki,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),pN=Dn(dN),fN=m({},ki,{data:0}),vv=Dn(fN),hN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mN={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"},gN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vN(a){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(a):(a=gN[a])?!!i[a]:!1}function Zd(){return vN}var yN=m({},bo,{key:function(a){if(a.key){var i=hN[a.key]||a.key;if(i!=="Unidentified")return i}return a.type==="keypress"?(a=tc(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?mN[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zd,charCode:function(a){return a.type==="keypress"?tc(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?tc(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),bN=Dn(yN),xN=m({},rc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),yv=Dn(xN),wN=m({},bo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zd}),kN=Dn(wN),SN=m({},ki,{propertyName:0,elapsedTime:0,pseudoElement:0}),jN=Dn(SN),CN=m({},rc,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),NN=Dn(CN),EN=m({},ki,{newState:0,oldState:0}),TN=Dn(EN),AN=[9,13,27,32],Yd=hr&&"CompositionEvent"in window,wo=null;hr&&"documentMode"in document&&(wo=document.documentMode);var RN=hr&&"TextEvent"in window&&!wo,bv=hr&&(!Yd||wo&&8<wo&&11>=wo),xv=" ",wv=!1;function kv(a,i){switch(a){case"keyup":return AN.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sv(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var ds=!1;function _N(a,i){switch(a){case"compositionend":return Sv(i);case"keypress":return i.which!==32?null:(wv=!0,xv);case"textInput":return a=i.data,a===xv&&wv?null:a;default:return null}}function ON(a,i){if(ds)return a==="compositionend"||!Yd&&kv(a,i)?(a=hv(),ec=qd=qr=null,ds=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return bv&&i.locale!=="ko"?null:i.data;default:return null}}var LN={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 jv(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i==="input"?!!LN[a.type]:i==="textarea"}function Cv(a,i,l,p){cs?us?us.push(p):us=[p]:cs=p,i=Wc(i,"onChange"),0<i.length&&(l=new ac("onChange","change",null,l,p),a.push({event:l,listeners:i}))}var ko=null,So=null;function zN(a){o0(a,0)}function ic(a){var i=ur(a);if(sv(i))return a}function Nv(a,i){if(a==="change")return i}var Ev=!1;if(hr){var Qd;if(hr){var Kd="oninput"in document;if(!Kd){var Tv=document.createElement("div");Tv.setAttribute("oninput","return;"),Kd=typeof Tv.oninput=="function"}Qd=Kd}else Qd=!1;Ev=Qd&&(!document.documentMode||9<document.documentMode)}function Av(){ko&&(ko.detachEvent("onpropertychange",Rv),So=ko=null)}function Rv(a){if(a.propertyName==="value"&&ic(So)){var i=[];Cv(i,So,a,Bd(a)),fv(zN,i)}}function MN(a,i,l){a==="focusin"?(Av(),ko=i,So=l,ko.attachEvent("onpropertychange",Rv)):a==="focusout"&&Av()}function DN(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return ic(So)}function $N(a,i){if(a==="click")return ic(i)}function IN(a,i){if(a==="input"||a==="change")return ic(i)}function PN(a,i){return a===i&&(a!==0||1/a===1/i)||a!==a&&i!==i}var Zn=typeof Object.is=="function"?Object.is:PN;function jo(a,i){if(Zn(a,i))return!0;if(typeof a!="object"||a===null||typeof i!="object"||i===null)return!1;var l=Object.keys(a),p=Object.keys(i);if(l.length!==p.length)return!1;for(p=0;p<l.length;p++){var v=l[p];if(!Oe.call(i,v)||!Zn(a[v],i[v]))return!1}return!0}function _v(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Ov(a,i){var l=_v(a);a=0;for(var p;l;){if(l.nodeType===3){if(p=a+l.textContent.length,a<=i&&p>=i)return{node:l,offset:i-a};a=p}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=_v(l)}}function Lv(a,i){return a&&i?a===i?!0:a&&a.nodeType===3?!1:i&&i.nodeType===3?Lv(a,i.parentNode):"contains"in a?a.contains(i):a.compareDocumentPosition?!!(a.compareDocumentPosition(i)&16):!1:!1}function zv(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var i=Xl(a.document);i instanceof a.HTMLIFrameElement;){try{var l=typeof i.contentWindow.location.href=="string"}catch{l=!1}if(l)a=i.contentWindow;else break;i=Xl(a.document)}return i}function Xd(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i&&(i==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||i==="textarea"||a.contentEditable==="true")}var UN=hr&&"documentMode"in document&&11>=document.documentMode,ps=null,Jd=null,Co=null,ep=!1;function Mv(a,i,l){var p=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ep||ps==null||ps!==Xl(p)||(p=ps,"selectionStart"in p&&Xd(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}),Co&&jo(Co,p)||(Co=p,p=Wc(Jd,"onSelect"),0<p.length&&(i=new ac("onSelect","select",null,i,l),a.push({event:i,listeners:p}),i.target=ps)))}function Si(a,i){var l={};return l[a.toLowerCase()]=i.toLowerCase(),l["Webkit"+a]="webkit"+i,l["Moz"+a]="moz"+i,l}var fs={animationend:Si("Animation","AnimationEnd"),animationiteration:Si("Animation","AnimationIteration"),animationstart:Si("Animation","AnimationStart"),transitionrun:Si("Transition","TransitionRun"),transitionstart:Si("Transition","TransitionStart"),transitioncancel:Si("Transition","TransitionCancel"),transitionend:Si("Transition","TransitionEnd")},tp={},Dv={};hr&&(Dv=document.createElement("div").style,"AnimationEvent"in window||(delete fs.animationend.animation,delete fs.animationiteration.animation,delete fs.animationstart.animation),"TransitionEvent"in window||delete fs.transitionend.transition);function ji(a){if(tp[a])return tp[a];if(!fs[a])return a;var i=fs[a],l;for(l in i)if(i.hasOwnProperty(l)&&l in Dv)return tp[a]=i[l];return a}var $v=ji("animationend"),Iv=ji("animationiteration"),Pv=ji("animationstart"),BN=ji("transitionrun"),FN=ji("transitionstart"),HN=ji("transitioncancel"),Uv=ji("transitionend"),Bv=new Map,np="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(" ");np.push("scrollEnd");function Ra(a,i){Bv.set(a,i),pa(i,[a])}var sc=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},ga=[],hs=0,ap=0;function oc(){for(var a=hs,i=ap=hs=0;i<a;){var l=ga[i];ga[i++]=null;var p=ga[i];ga[i++]=null;var v=ga[i];ga[i++]=null;var b=ga[i];if(ga[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}b!==0&&Fv(l,v,b)}}function lc(a,i,l,p){ga[hs++]=a,ga[hs++]=i,ga[hs++]=l,ga[hs++]=p,ap|=p,a.lanes|=p,a=a.alternate,a!==null&&(a.lanes|=p)}function rp(a,i,l,p){return lc(a,i,l,p),cc(a)}function Ci(a,i){return lc(a,null,null,i),cc(a)}function Fv(a,i,l){a.lanes|=l;var p=a.alternate;p!==null&&(p.lanes|=l);for(var v=!1,b=a.return;b!==null;)b.childLanes|=l,p=b.alternate,p!==null&&(p.childLanes|=l),b.tag===22&&(a=b.stateNode,a===null||a._visibility&1||(v=!0)),a=b,b=b.return;return a.tag===3?(b=a.stateNode,v&&i!==null&&(v=31-Ne(l),a=b.hiddenUpdates,p=a[v],p===null?a[v]=[i]:p.push(i),i.lane=l|536870912),b):null}function cc(a){if(50<Wo)throw Wo=0,hf=null,Error(r(185));for(var i=a.return;i!==null;)a=i,i=a.return;return a.tag===3?a.stateNode:null}var ms={};function qN(a,i,l,p){this.tag=a,this.key=l,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 Yn(a,i,l,p){return new qN(a,i,l,p)}function ip(a){return a=a.prototype,!(!a||!a.isReactComponent)}function mr(a,i){var l=a.alternate;return l===null?(l=Yn(a.tag,i,a.key,a.mode),l.elementType=a.elementType,l.type=a.type,l.stateNode=a.stateNode,l.alternate=a,a.alternate=l):(l.pendingProps=i,l.type=a.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=a.flags&65011712,l.childLanes=a.childLanes,l.lanes=a.lanes,l.child=a.child,l.memoizedProps=a.memoizedProps,l.memoizedState=a.memoizedState,l.updateQueue=a.updateQueue,i=a.dependencies,l.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},l.sibling=a.sibling,l.index=a.index,l.ref=a.ref,l.refCleanup=a.refCleanup,l}function Hv(a,i){a.flags&=65011714;var l=a.alternate;return l===null?(a.childLanes=0,a.lanes=i,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=l.childLanes,a.lanes=l.lanes,a.child=l.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=l.memoizedProps,a.memoizedState=l.memoizedState,a.updateQueue=l.updateQueue,a.type=l.type,i=l.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),a}function uc(a,i,l,p,v,b){var C=0;if(p=a,typeof a=="function")ip(a)&&(C=1);else if(typeof a=="string")C=YE(a,l,ne.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case z:return a=Yn(31,l,i,v),a.elementType=z,a.lanes=b,a;case j:return Ni(l.children,v,b,i);case E:C=8,v|=24;break;case S:return a=Yn(12,l,i,v|2),a.elementType=S,a.lanes=b,a;case q:return a=Yn(13,l,i,v),a.elementType=q,a.lanes=b,a;case R:return a=Yn(19,l,i,v),a.elementType=R,a.lanes=b,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case N:C=10;break e;case T:C=9;break e;case A:C=11;break e;case $:C=14;break e;case H:C=16,p=null;break e}C=29,l=Error(r(130,a===null?"null":typeof a,"")),p=null}return i=Yn(C,l,i,v),i.elementType=a,i.type=p,i.lanes=b,i}function Ni(a,i,l,p){return a=Yn(7,a,p,i),a.lanes=l,a}function sp(a,i,l){return a=Yn(6,a,null,i),a.lanes=l,a}function qv(a){var i=Yn(18,null,null,0);return i.stateNode=a,i}function op(a,i,l){return i=Yn(4,a.children!==null?a.children:[],a.key,i),i.lanes=l,i.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},i}var Gv=new WeakMap;function va(a,i){if(typeof a=="object"&&a!==null){var l=Gv.get(a);return l!==void 0?l:(i={value:a,source:i,stack:xe(i)},Gv.set(a,i),i)}return{value:a,source:i,stack:xe(i)}}var gs=[],vs=0,dc=null,No=0,ya=[],ba=0,Gr=null,Va=1,Wa="";function gr(a,i){gs[vs++]=No,gs[vs++]=dc,dc=a,No=i}function Vv(a,i,l){ya[ba++]=Va,ya[ba++]=Wa,ya[ba++]=Gr,Gr=a;var p=Va;a=Wa;var v=32-Ne(p)-1;p&=~(1<<v),l+=1;var b=32-Ne(i)+v;if(30<b){var C=v-v%5;b=(p&(1<<C)-1).toString(32),p>>=C,v-=C,Va=1<<32-Ne(i)+v|l<<v|p,Wa=b+a}else Va=1<<b|l<<v|p,Wa=a}function lp(a){a.return!==null&&(gr(a,1),Vv(a,1,0))}function cp(a){for(;a===dc;)dc=gs[--vs],gs[vs]=null,No=gs[--vs],gs[vs]=null;for(;a===Gr;)Gr=ya[--ba],ya[ba]=null,Wa=ya[--ba],ya[ba]=null,Va=ya[--ba],ya[ba]=null}function Wv(a,i){ya[ba++]=Va,ya[ba++]=Wa,ya[ba++]=Gr,Va=i.id,Wa=i.overflow,Gr=a}var bn=null,Lt=null,ut=!1,Vr=null,xa=!1,up=Error(r(519));function Wr(a){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Eo(va(i,a)),up}function Zv(a){var i=a.stateNode,l=a.type,p=a.memoizedProps;switch(i[Ht]=a,i[cn]=p,l){case"dialog":at("cancel",i),at("close",i);break;case"iframe":case"object":case"embed":at("load",i);break;case"video":case"audio":for(l=0;l<Yo.length;l++)at(Yo[l],i);break;case"source":at("error",i);break;case"img":case"image":case"link":at("error",i),at("load",i);break;case"details":at("toggle",i);break;case"input":at("invalid",i),ov(i,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":at("invalid",i);break;case"textarea":at("invalid",i),cv(i,p.value,p.defaultValue,p.children)}l=p.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||i.textContent===""+l||p.suppressHydrationWarning===!0||d0(i.textContent,l)?(p.popover!=null&&(at("beforetoggle",i),at("toggle",i)),p.onScroll!=null&&at("scroll",i),p.onScrollEnd!=null&&at("scrollend",i),p.onClick!=null&&(i.onclick=fr),i=!0):i=!1,i||Wr(a,!0)}function Yv(a){for(bn=a.return;bn;)switch(bn.tag){case 5:case 31:case 13:xa=!1;return;case 27:case 3:xa=!0;return;default:bn=bn.return}}function ys(a){if(a!==bn)return!1;if(!ut)return Yv(a),ut=!0,!1;var i=a.tag,l;if((l=i!==3&&i!==27)&&((l=i===5)&&(l=a.type,l=!(l!=="form"&&l!=="button")||Af(a.type,a.memoizedProps)),l=!l),l&&Lt&&Wr(a),Yv(a),i===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Lt=x0(a)}else if(i===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Lt=x0(a)}else i===27?(i=Lt,oi(a.type)?(a=zf,zf=null,Lt=a):Lt=i):Lt=bn?ka(a.stateNode.nextSibling):null;return!0}function Ei(){Lt=bn=null,ut=!1}function dp(){var a=Vr;return a!==null&&(Un===null?Un=a:Un.push.apply(Un,a),Vr=null),a}function Eo(a){Vr===null?Vr=[a]:Vr.push(a)}var pp=U(null),Ti=null,vr=null;function Zr(a,i,l){O(pp,i._currentValue),i._currentValue=l}function yr(a){a._currentValue=pp.current,G(pp)}function fp(a,i,l){for(;a!==null;){var p=a.alternate;if((a.childLanes&i)!==i?(a.childLanes|=i,p!==null&&(p.childLanes|=i)):p!==null&&(p.childLanes&i)!==i&&(p.childLanes|=i),a===l)break;a=a.return}}function hp(a,i,l,p){var v=a.child;for(v!==null&&(v.return=a);v!==null;){var b=v.dependencies;if(b!==null){var C=v.child;b=b.firstContext;e:for(;b!==null;){var M=b;b=v;for(var Y=0;Y<i.length;Y++)if(M.context===i[Y]){b.lanes|=l,M=b.alternate,M!==null&&(M.lanes|=l),fp(b.return,l,a),p||(C=null);break e}b=M.next}}else if(v.tag===18){if(C=v.return,C===null)throw Error(r(341));C.lanes|=l,b=C.alternate,b!==null&&(b.lanes|=l),fp(C,l,a),C=null}else C=v.child;if(C!==null)C.return=v;else for(C=v;C!==null;){if(C===a){C=null;break}if(v=C.sibling,v!==null){v.return=C.return,C=v;break}C=C.return}v=C}}function bs(a,i,l,p){a=null;for(var v=i,b=!1;v!==null;){if(!b){if((v.flags&524288)!==0)b=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var C=v.alternate;if(C===null)throw Error(r(387));if(C=C.memoizedProps,C!==null){var M=v.type;Zn(v.pendingProps.value,C.value)||(a!==null?a.push(M):a=[M])}}else if(v===be.current){if(C=v.alternate,C===null)throw Error(r(387));C.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(a!==null?a.push(el):a=[el])}v=v.return}a!==null&&hp(i,a,l,p),i.flags|=262144}function pc(a){for(a=a.firstContext;a!==null;){if(!Zn(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function Ai(a){Ti=a,vr=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function xn(a){return Qv(Ti,a)}function fc(a,i){return Ti===null&&Ai(a),Qv(a,i)}function Qv(a,i){var l=i._currentValue;if(i={context:i,memoizedValue:l,next:null},vr===null){if(a===null)throw Error(r(308));vr=i,a.dependencies={lanes:0,firstContext:i},a.flags|=524288}else vr=vr.next=i;return l}var GN=typeof AbortController<"u"?AbortController:function(){var a=[],i=this.signal={aborted:!1,addEventListener:function(l,p){a.push(p)}};this.abort=function(){i.aborted=!0,a.forEach(function(l){return l()})}},VN=e.unstable_scheduleCallback,WN=e.unstable_NormalPriority,tn={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function mp(){return{controller:new GN,data:new Map,refCount:0}}function To(a){a.refCount--,a.refCount===0&&VN(WN,function(){a.controller.abort()})}var Ao=null,gp=0,xs=0,ws=null;function ZN(a,i){if(Ao===null){var l=Ao=[];gp=0,xs=xf(),ws={status:"pending",value:void 0,then:function(p){l.push(p)}}}return gp++,i.then(Kv,Kv),i}function Kv(){if(--gp===0&&Ao!==null){ws!==null&&(ws.status="fulfilled");var a=Ao;Ao=null,xs=0,ws=null;for(var i=0;i<a.length;i++)(0,a[i])()}}function YN(a,i){var l=[],p={status:"pending",value:null,reason:null,then:function(v){l.push(v)}};return a.then(function(){p.status="fulfilled",p.value=i;for(var v=0;v<l.length;v++)(0,l[v])(i)},function(v){for(p.status="rejected",p.reason=v,v=0;v<l.length;v++)(0,l[v])(void 0)}),p}var Xv=F.S;F.S=function(a,i){Mb=dt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&ZN(a,i),Xv!==null&&Xv(a,i)};var Ri=U(null);function vp(){var a=Ri.current;return a!==null?a:Nt.pooledCache}function hc(a,i){i===null?O(Ri,Ri.current):O(Ri,i.pool)}function Jv(){var a=vp();return a===null?null:{parent:tn._currentValue,pool:a}}var ks=Error(r(460)),yp=Error(r(474)),mc=Error(r(542)),gc={then:function(){}};function ey(a){return a=a.status,a==="fulfilled"||a==="rejected"}function ty(a,i,l){switch(l=a[l],l===void 0?a.push(i):l!==i&&(i.then(fr,fr),i=l),i.status){case"fulfilled":return i.value;case"rejected":throw a=i.reason,ay(a),a;default:if(typeof i.status=="string")i.then(fr,fr);else{if(a=Nt,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=i,a.status="pending",a.then(function(p){if(i.status==="pending"){var v=i;v.status="fulfilled",v.value=p}},function(p){if(i.status==="pending"){var v=i;v.status="rejected",v.reason=p}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw a=i.reason,ay(a),a}throw Oi=i,ks}}function _i(a){try{var i=a._init;return i(a._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Oi=l,ks):l}}var Oi=null;function ny(){if(Oi===null)throw Error(r(459));var a=Oi;return Oi=null,a}function ay(a){if(a===ks||a===mc)throw Error(r(483))}var Ss=null,Ro=0;function vc(a){var i=Ro;return Ro+=1,Ss===null&&(Ss=[]),ty(Ss,a,i)}function _o(a,i){i=i.props.ref,a.ref=i!==void 0?i:null}function yc(a,i){throw i.$$typeof===y?Error(r(525)):(a=Object.prototype.toString.call(i),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":a)))}function ry(a){function i(te,J){if(a){var ae=te.deletions;ae===null?(te.deletions=[J],te.flags|=16):ae.push(J)}}function l(te,J){if(!a)return null;for(;J!==null;)i(te,J),J=J.sibling;return null}function p(te){for(var J=new Map;te!==null;)te.key!==null?J.set(te.key,te):J.set(te.index,te),te=te.sibling;return J}function v(te,J){return te=mr(te,J),te.index=0,te.sibling=null,te}function b(te,J,ae){return te.index=ae,a?(ae=te.alternate,ae!==null?(ae=ae.index,ae<J?(te.flags|=67108866,J):ae):(te.flags|=67108866,J)):(te.flags|=1048576,J)}function C(te){return a&&te.alternate===null&&(te.flags|=67108866),te}function M(te,J,ae,fe){return J===null||J.tag!==6?(J=sp(ae,te.mode,fe),J.return=te,J):(J=v(J,ae),J.return=te,J)}function Y(te,J,ae,fe){var De=ae.type;return De===j?pe(te,J,ae.props.children,fe,ae.key):J!==null&&(J.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===H&&_i(De)===J.type)?(J=v(J,ae.props),_o(J,ae),J.return=te,J):(J=uc(ae.type,ae.key,ae.props,null,te.mode,fe),_o(J,ae),J.return=te,J)}function re(te,J,ae,fe){return J===null||J.tag!==4||J.stateNode.containerInfo!==ae.containerInfo||J.stateNode.implementation!==ae.implementation?(J=op(ae,te.mode,fe),J.return=te,J):(J=v(J,ae.children||[]),J.return=te,J)}function pe(te,J,ae,fe,De){return J===null||J.tag!==7?(J=Ni(ae,te.mode,fe,De),J.return=te,J):(J=v(J,ae),J.return=te,J)}function me(te,J,ae){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=sp(""+J,te.mode,ae),J.return=te,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case x:return ae=uc(J.type,J.key,J.props,null,te.mode,ae),_o(ae,J),ae.return=te,ae;case k:return J=op(J,te.mode,ae),J.return=te,J;case H:return J=_i(J),me(te,J,ae)}if(D(J)||B(J))return J=Ni(J,te.mode,ae,null),J.return=te,J;if(typeof J.then=="function")return me(te,vc(J),ae);if(J.$$typeof===N)return me(te,fc(te,J),ae);yc(te,J)}return null}function se(te,J,ae,fe){var De=J!==null?J.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return De!==null?null:M(te,J,""+ae,fe);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case x:return ae.key===De?Y(te,J,ae,fe):null;case k:return ae.key===De?re(te,J,ae,fe):null;case H:return ae=_i(ae),se(te,J,ae,fe)}if(D(ae)||B(ae))return De!==null?null:pe(te,J,ae,fe,null);if(typeof ae.then=="function")return se(te,J,vc(ae),fe);if(ae.$$typeof===N)return se(te,J,fc(te,ae),fe);yc(te,ae)}return null}function oe(te,J,ae,fe,De){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return te=te.get(ae)||null,M(J,te,""+fe,De);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case x:return te=te.get(fe.key===null?ae:fe.key)||null,Y(J,te,fe,De);case k:return te=te.get(fe.key===null?ae:fe.key)||null,re(J,te,fe,De);case H:return fe=_i(fe),oe(te,J,ae,fe,De)}if(D(fe)||B(fe))return te=te.get(ae)||null,pe(J,te,fe,De,null);if(typeof fe.then=="function")return oe(te,J,ae,vc(fe),De);if(fe.$$typeof===N)return oe(te,J,ae,fc(J,fe),De);yc(J,fe)}return null}function Ae(te,J,ae,fe){for(var De=null,mt=null,_e=J,Ke=J=0,ot=null;_e!==null&&Ke<ae.length;Ke++){_e.index>Ke?(ot=_e,_e=null):ot=_e.sibling;var gt=se(te,_e,ae[Ke],fe);if(gt===null){_e===null&&(_e=ot);break}a&&_e&&gt.alternate===null&&i(te,_e),J=b(gt,J,Ke),mt===null?De=gt:mt.sibling=gt,mt=gt,_e=ot}if(Ke===ae.length)return l(te,_e),ut&&gr(te,Ke),De;if(_e===null){for(;Ke<ae.length;Ke++)_e=me(te,ae[Ke],fe),_e!==null&&(J=b(_e,J,Ke),mt===null?De=_e:mt.sibling=_e,mt=_e);return ut&&gr(te,Ke),De}for(_e=p(_e);Ke<ae.length;Ke++)ot=oe(_e,te,Ke,ae[Ke],fe),ot!==null&&(a&&ot.alternate!==null&&_e.delete(ot.key===null?Ke:ot.key),J=b(ot,J,Ke),mt===null?De=ot:mt.sibling=ot,mt=ot);return a&&_e.forEach(function(pi){return i(te,pi)}),ut&&gr(te,Ke),De}function Be(te,J,ae,fe){if(ae==null)throw Error(r(151));for(var De=null,mt=null,_e=J,Ke=J=0,ot=null,gt=ae.next();_e!==null&&!gt.done;Ke++,gt=ae.next()){_e.index>Ke?(ot=_e,_e=null):ot=_e.sibling;var pi=se(te,_e,gt.value,fe);if(pi===null){_e===null&&(_e=ot);break}a&&_e&&pi.alternate===null&&i(te,_e),J=b(pi,J,Ke),mt===null?De=pi:mt.sibling=pi,mt=pi,_e=ot}if(gt.done)return l(te,_e),ut&&gr(te,Ke),De;if(_e===null){for(;!gt.done;Ke++,gt=ae.next())gt=me(te,gt.value,fe),gt!==null&&(J=b(gt,J,Ke),mt===null?De=gt:mt.sibling=gt,mt=gt);return ut&&gr(te,Ke),De}for(_e=p(_e);!gt.done;Ke++,gt=ae.next())gt=oe(_e,te,Ke,gt.value,fe),gt!==null&&(a&&gt.alternate!==null&&_e.delete(gt.key===null?Ke:gt.key),J=b(gt,J,Ke),mt===null?De=gt:mt.sibling=gt,mt=gt);return a&&_e.forEach(function(sT){return i(te,sT)}),ut&&gr(te,Ke),De}function jt(te,J,ae,fe){if(typeof ae=="object"&&ae!==null&&ae.type===j&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case x:e:{for(var De=ae.key;J!==null;){if(J.key===De){if(De=ae.type,De===j){if(J.tag===7){l(te,J.sibling),fe=v(J,ae.props.children),fe.return=te,te=fe;break e}}else if(J.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===H&&_i(De)===J.type){l(te,J.sibling),fe=v(J,ae.props),_o(fe,ae),fe.return=te,te=fe;break e}l(te,J);break}else i(te,J);J=J.sibling}ae.type===j?(fe=Ni(ae.props.children,te.mode,fe,ae.key),fe.return=te,te=fe):(fe=uc(ae.type,ae.key,ae.props,null,te.mode,fe),_o(fe,ae),fe.return=te,te=fe)}return C(te);case k:e:{for(De=ae.key;J!==null;){if(J.key===De)if(J.tag===4&&J.stateNode.containerInfo===ae.containerInfo&&J.stateNode.implementation===ae.implementation){l(te,J.sibling),fe=v(J,ae.children||[]),fe.return=te,te=fe;break e}else{l(te,J);break}else i(te,J);J=J.sibling}fe=op(ae,te.mode,fe),fe.return=te,te=fe}return C(te);case H:return ae=_i(ae),jt(te,J,ae,fe)}if(D(ae))return Ae(te,J,ae,fe);if(B(ae)){if(De=B(ae),typeof De!="function")throw Error(r(150));return ae=De.call(ae),Be(te,J,ae,fe)}if(typeof ae.then=="function")return jt(te,J,vc(ae),fe);if(ae.$$typeof===N)return jt(te,J,fc(te,ae),fe);yc(te,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,J!==null&&J.tag===6?(l(te,J.sibling),fe=v(J,ae),fe.return=te,te=fe):(l(te,J),fe=sp(ae,te.mode,fe),fe.return=te,te=fe),C(te)):l(te,J)}return function(te,J,ae,fe){try{Ro=0;var De=jt(te,J,ae,fe);return Ss=null,De}catch(_e){if(_e===ks||_e===mc)throw _e;var mt=Yn(29,_e,null,te.mode);return mt.lanes=fe,mt.return=te,mt}finally{}}}var Li=ry(!0),iy=ry(!1),Yr=!1;function bp(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xp(a,i){a=a.updateQueue,i.updateQueue===a&&(i.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function Qr(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function Kr(a,i,l){var p=a.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=cc(a),Fv(a,null,l),i}return lc(a,p,i,l),cc(a)}function Oo(a,i,l){if(i=i.updateQueue,i!==null&&(i=i.shared,(l&4194048)!==0)){var p=i.lanes;p&=a.pendingLanes,l|=p,i.lanes=l,je(a,l)}}function wp(a,i){var l=a.updateQueue,p=a.alternate;if(p!==null&&(p=p.updateQueue,l===p)){var v=null,b=null;if(l=l.firstBaseUpdate,l!==null){do{var C={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};b===null?v=b=C:b=b.next=C,l=l.next}while(l!==null);b===null?v=b=i:b=b.next=i}else v=b=i;l={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:b,shared:p.shared,callbacks:p.callbacks},a.updateQueue=l;return}a=l.lastBaseUpdate,a===null?l.firstBaseUpdate=i:a.next=i,l.lastBaseUpdate=i}var kp=!1;function Lo(){if(kp){var a=ws;if(a!==null)throw a}}function zo(a,i,l,p){kp=!1;var v=a.updateQueue;Yr=!1;var b=v.firstBaseUpdate,C=v.lastBaseUpdate,M=v.shared.pending;if(M!==null){v.shared.pending=null;var Y=M,re=Y.next;Y.next=null,C===null?b=re:C.next=re,C=Y;var pe=a.alternate;pe!==null&&(pe=pe.updateQueue,M=pe.lastBaseUpdate,M!==C&&(M===null?pe.firstBaseUpdate=re:M.next=re,pe.lastBaseUpdate=Y))}if(b!==null){var me=v.baseState;C=0,pe=re=Y=null,M=b;do{var se=M.lane&-536870913,oe=se!==M.lane;if(oe?(st&se)===se:(p&se)===se){se!==0&&se===xs&&(kp=!0),pe!==null&&(pe=pe.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var Ae=a,Be=M;se=i;var jt=l;switch(Be.tag){case 1:if(Ae=Be.payload,typeof Ae=="function"){me=Ae.call(jt,me,se);break e}me=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Be.payload,se=typeof Ae=="function"?Ae.call(jt,me,se):Ae,se==null)break e;me=m({},me,se);break e;case 2:Yr=!0}}se=M.callback,se!==null&&(a.flags|=64,oe&&(a.flags|=8192),oe=v.callbacks,oe===null?v.callbacks=[se]:oe.push(se))}else oe={lane:se,tag:M.tag,payload:M.payload,callback:M.callback,next:null},pe===null?(re=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=re,v.lastBaseUpdate=pe,b===null&&(v.shared.lanes=0),ni|=C,a.lanes=C,a.memoizedState=me}}function sy(a,i){if(typeof a!="function")throw Error(r(191,a));a.call(i)}function oy(a,i){var l=a.callbacks;if(l!==null)for(a.callbacks=null,a=0;a<l.length;a++)sy(l[a],i)}var js=U(null),bc=U(0);function ly(a,i){a=Er,O(bc,a),O(js,i),Er=a|i.baseLanes}function Sp(){O(bc,Er),O(js,js.current)}function jp(){Er=bc.current,G(js),G(bc)}var Qn=U(null),wa=null;function Xr(a){var i=a.alternate;O(Kt,Kt.current&1),O(Qn,a),wa===null&&(i===null||js.current!==null||i.memoizedState!==null)&&(wa=a)}function Cp(a){O(Kt,Kt.current),O(Qn,a),wa===null&&(wa=a)}function cy(a){a.tag===22?(O(Kt,Kt.current),O(Qn,a),wa===null&&(wa=a)):Jr()}function Jr(){O(Kt,Kt.current),O(Qn,Qn.current)}function Kn(a){G(Qn),wa===a&&(wa=null),G(Kt)}var Kt=U(0);function xc(a){for(var i=a;i!==null;){if(i.tag===13){var l=i.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Of(l)||Lf(l)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break;for(;i.sibling===null;){if(i.return===null||i.return===a)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var br=0,Qe=null,kt=null,nn=null,wc=!1,Cs=!1,zi=!1,kc=0,Mo=0,Ns=null,QN=0;function Zt(){throw Error(r(321))}function Np(a,i){if(i===null)return!1;for(var l=0;l<i.length&&l<a.length;l++)if(!Zn(a[l],i[l]))return!1;return!0}function Ep(a,i,l,p,v,b){return br=b,Qe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,F.H=a===null||a.memoizedState===null?Vy:Fp,zi=!1,b=l(p,v),zi=!1,Cs&&(b=dy(i,l,p,v)),uy(a),b}function uy(a){F.H=Io;var i=kt!==null&&kt.next!==null;if(br=0,nn=kt=Qe=null,wc=!1,Mo=0,Ns=null,i)throw Error(r(300));a===null||an||(a=a.dependencies,a!==null&&pc(a)&&(an=!0))}function dy(a,i,l,p){Qe=a;var v=0;do{if(Cs&&(Ns=null),Mo=0,Cs=!1,25<=v)throw Error(r(301));if(v+=1,nn=kt=null,a.updateQueue!=null){var b=a.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}F.H=Wy,b=i(l,p)}while(Cs);return b}function KN(){var a=F.H,i=a.useState()[0];return i=typeof i.then=="function"?Do(i):i,a=a.useState()[0],(kt!==null?kt.memoizedState:null)!==a&&(Qe.flags|=1024),i}function Tp(){var a=kc!==0;return kc=0,a}function Ap(a,i,l){i.updateQueue=a.updateQueue,i.flags&=-2053,a.lanes&=~l}function Rp(a){if(wc){for(a=a.memoizedState;a!==null;){var i=a.queue;i!==null&&(i.pending=null),a=a.next}wc=!1}br=0,nn=kt=Qe=null,Cs=!1,Mo=kc=0,Ns=null}function Rn(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nn===null?Qe.memoizedState=nn=a:nn=nn.next=a,nn}function Xt(){if(kt===null){var a=Qe.alternate;a=a!==null?a.memoizedState:null}else a=kt.next;var i=nn===null?Qe.memoizedState:nn.next;if(i!==null)nn=i,kt=a;else{if(a===null)throw Qe.alternate===null?Error(r(467)):Error(r(310));kt=a,a={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},nn===null?Qe.memoizedState=nn=a:nn=nn.next=a}return nn}function Sc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Do(a){var i=Mo;return Mo+=1,Ns===null&&(Ns=[]),a=ty(Ns,a,i),i=Qe,(nn===null?i.memoizedState:nn.next)===null&&(i=i.alternate,F.H=i===null||i.memoizedState===null?Vy:Fp),a}function jc(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return Do(a);if(a.$$typeof===N)return xn(a)}throw Error(r(438,String(a)))}function _p(a){var i=null,l=Qe.updateQueue;if(l!==null&&(i=l.memoCache),i==null){var p=Qe.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}),l===null&&(l=Sc(),Qe.updateQueue=l),l.memoCache=i,l=i.data[i.index],l===void 0)for(l=i.data[i.index]=Array(a),p=0;p<a;p++)l[p]=_;return i.index++,l}function xr(a,i){return typeof i=="function"?i(a):i}function Cc(a){var i=Xt();return Op(i,kt,a)}function Op(a,i,l){var p=a.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=l;var v=a.baseQueue,b=p.pending;if(b!==null){if(v!==null){var C=v.next;v.next=b.next,b.next=C}i.baseQueue=v=b,p.pending=null}if(b=a.baseState,v===null)a.memoizedState=b;else{i=v.next;var M=C=null,Y=null,re=i,pe=!1;do{var me=re.lane&-536870913;if(me!==re.lane?(st&me)===me:(br&me)===me){var se=re.revertLane;if(se===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),me===xs&&(pe=!0);else if((br&se)===se){re=re.next,se===xs&&(pe=!0);continue}else me={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},Y===null?(M=Y=me,C=b):Y=Y.next=me,Qe.lanes|=se,ni|=se;me=re.action,zi&&l(b,me),b=re.hasEagerState?re.eagerState:l(b,me)}else se={lane:me,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},Y===null?(M=Y=se,C=b):Y=Y.next=se,Qe.lanes|=me,ni|=me;re=re.next}while(re!==null&&re!==i);if(Y===null?C=b:Y.next=M,!Zn(b,a.memoizedState)&&(an=!0,pe&&(l=ws,l!==null)))throw l;a.memoizedState=b,a.baseState=C,a.baseQueue=Y,p.lastRenderedState=b}return v===null&&(p.lanes=0),[a.memoizedState,p.dispatch]}function Lp(a){var i=Xt(),l=i.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var p=l.dispatch,v=l.pending,b=i.memoizedState;if(v!==null){l.pending=null;var C=v=v.next;do b=a(b,C.action),C=C.next;while(C!==v);Zn(b,i.memoizedState)||(an=!0),i.memoizedState=b,i.baseQueue===null&&(i.baseState=b),l.lastRenderedState=b}return[b,p]}function py(a,i,l){var p=Qe,v=Xt(),b=ut;if(b){if(l===void 0)throw Error(r(407));l=l()}else l=i();var C=!Zn((kt||v).memoizedState,l);if(C&&(v.memoizedState=l,an=!0),v=v.queue,Dp(my.bind(null,p,v,a),[a]),v.getSnapshot!==i||C||nn!==null&&nn.memoizedState.tag&1){if(p.flags|=2048,Es(9,{destroy:void 0},hy.bind(null,p,v,l,i),null),Nt===null)throw Error(r(349));b||(br&127)!==0||fy(p,i,l)}return l}function fy(a,i,l){a.flags|=16384,a={getSnapshot:i,value:l},i=Qe.updateQueue,i===null?(i=Sc(),Qe.updateQueue=i,i.stores=[a]):(l=i.stores,l===null?i.stores=[a]:l.push(a))}function hy(a,i,l,p){i.value=l,i.getSnapshot=p,gy(i)&&vy(a)}function my(a,i,l){return l(function(){gy(i)&&vy(a)})}function gy(a){var i=a.getSnapshot;a=a.value;try{var l=i();return!Zn(a,l)}catch{return!0}}function vy(a){var i=Ci(a,2);i!==null&&Bn(i,a,2)}function zp(a){var i=Rn();if(typeof a=="function"){var l=a;if(a=l(),zi){et(!0);try{l()}finally{et(!1)}}}return i.memoizedState=i.baseState=a,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:a},i}function yy(a,i,l,p){return a.baseState=l,Op(a,kt,typeof p=="function"?p:xr)}function XN(a,i,l,p,v){if(Tc(a))throw Error(r(485));if(a=i.action,a!==null){var b={payload:v,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){b.listeners.push(C)}};F.T!==null?l(!0):b.isTransition=!1,p(b),l=i.pending,l===null?(b.next=i.pending=b,by(i,b)):(b.next=l.next,i.pending=l.next=b)}}function by(a,i){var l=i.action,p=i.payload,v=a.state;if(i.isTransition){var b=F.T,C={};F.T=C;try{var M=l(v,p),Y=F.S;Y!==null&&Y(C,M),xy(a,i,M)}catch(re){Mp(a,i,re)}finally{b!==null&&C.types!==null&&(b.types=C.types),F.T=b}}else try{b=l(v,p),xy(a,i,b)}catch(re){Mp(a,i,re)}}function xy(a,i,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(p){wy(a,i,p)},function(p){return Mp(a,i,p)}):wy(a,i,l)}function wy(a,i,l){i.status="fulfilled",i.value=l,ky(i),a.state=l,i=a.pending,i!==null&&(l=i.next,l===i?a.pending=null:(l=l.next,i.next=l,by(a,l)))}function Mp(a,i,l){var p=a.pending;if(a.pending=null,p!==null){p=p.next;do i.status="rejected",i.reason=l,ky(i),i=i.next;while(i!==p)}a.action=null}function ky(a){a=a.listeners;for(var i=0;i<a.length;i++)(0,a[i])()}function Sy(a,i){return i}function jy(a,i){if(ut){var l=Nt.formState;if(l!==null){e:{var p=Qe;if(ut){if(Lt){t:{for(var v=Lt,b=xa;v.nodeType!==8;){if(!b){v=null;break t}if(v=ka(v.nextSibling),v===null){v=null;break t}}b=v.data,v=b==="F!"||b==="F"?v:null}if(v){Lt=ka(v.nextSibling),p=v.data==="F!";break e}}Wr(p)}p=!1}p&&(i=l[0])}}return l=Rn(),l.memoizedState=l.baseState=i,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sy,lastRenderedState:i},l.queue=p,l=Hy.bind(null,Qe,p),p.dispatch=l,p=zp(!1),b=Bp.bind(null,Qe,!1,p.queue),p=Rn(),v={state:i,dispatch:null,action:a,pending:null},p.queue=v,l=XN.bind(null,Qe,v,b,l),v.dispatch=l,p.memoizedState=a,[i,l,!1]}function Cy(a){var i=Xt();return Ny(i,kt,a)}function Ny(a,i,l){if(i=Op(a,i,Sy)[0],a=Cc(xr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var p=Do(i)}catch(C){throw C===ks?mc:C}else p=i;i=Xt();var v=i.queue,b=v.dispatch;return l!==i.memoizedState&&(Qe.flags|=2048,Es(9,{destroy:void 0},JN.bind(null,v,l),null)),[p,b,a]}function JN(a,i){a.action=i}function Ey(a){var i=Xt(),l=kt;if(l!==null)return Ny(i,l,a);Xt(),i=i.memoizedState,l=Xt();var p=l.queue.dispatch;return l.memoizedState=a,[i,p,!1]}function Es(a,i,l,p){return a={tag:a,create:l,deps:p,inst:i,next:null},i=Qe.updateQueue,i===null&&(i=Sc(),Qe.updateQueue=i),l=i.lastEffect,l===null?i.lastEffect=a.next=a:(p=l.next,l.next=a,a.next=p,i.lastEffect=a),a}function Ty(){return Xt().memoizedState}function Nc(a,i,l,p){var v=Rn();Qe.flags|=a,v.memoizedState=Es(1|i,{destroy:void 0},l,p===void 0?null:p)}function Ec(a,i,l,p){var v=Xt();p=p===void 0?null:p;var b=v.memoizedState.inst;kt!==null&&p!==null&&Np(p,kt.memoizedState.deps)?v.memoizedState=Es(i,b,l,p):(Qe.flags|=a,v.memoizedState=Es(1|i,b,l,p))}function Ay(a,i){Nc(8390656,8,a,i)}function Dp(a,i){Ec(2048,8,a,i)}function eE(a){Qe.flags|=4;var i=Qe.updateQueue;if(i===null)i=Sc(),Qe.updateQueue=i,i.events=[a];else{var l=i.events;l===null?i.events=[a]:l.push(a)}}function Ry(a){var i=Xt().memoizedState;return eE({ref:i,nextImpl:a}),function(){if((yt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function _y(a,i){return Ec(4,2,a,i)}function Oy(a,i){return Ec(4,4,a,i)}function Ly(a,i){if(typeof i=="function"){a=a();var l=i(a);return function(){typeof l=="function"?l():i(null)}}if(i!=null)return a=a(),i.current=a,function(){i.current=null}}function zy(a,i,l){l=l!=null?l.concat([a]):null,Ec(4,4,Ly.bind(null,i,a),l)}function $p(){}function My(a,i){var l=Xt();i=i===void 0?null:i;var p=l.memoizedState;return i!==null&&Np(i,p[1])?p[0]:(l.memoizedState=[a,i],a)}function Dy(a,i){var l=Xt();i=i===void 0?null:i;var p=l.memoizedState;if(i!==null&&Np(i,p[1]))return p[0];if(p=a(),zi){et(!0);try{a()}finally{et(!1)}}return l.memoizedState=[p,i],p}function Ip(a,i,l){return l===void 0||(br&1073741824)!==0&&(st&261930)===0?a.memoizedState=i:(a.memoizedState=l,a=$b(),Qe.lanes|=a,ni|=a,l)}function $y(a,i,l,p){return Zn(l,i)?l:js.current!==null?(a=Ip(a,l,p),Zn(a,i)||(an=!0),a):(br&42)===0||(br&1073741824)!==0&&(st&261930)===0?(an=!0,a.memoizedState=l):(a=$b(),Qe.lanes|=a,ni|=a,i)}function Iy(a,i,l,p,v){var b=V.p;V.p=b!==0&&8>b?b:8;var C=F.T,M={};F.T=M,Bp(a,!1,i,l);try{var Y=v(),re=F.S;if(re!==null&&re(M,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var pe=YN(Y,p);$o(a,i,pe,ea(a))}else $o(a,i,p,ea(a))}catch(me){$o(a,i,{then:function(){},status:"rejected",reason:me},ea())}finally{V.p=b,C!==null&&M.types!==null&&(C.types=M.types),F.T=C}}function tE(){}function Pp(a,i,l,p){if(a.tag!==5)throw Error(r(476));var v=Py(a).queue;Iy(a,v,i,X,l===null?tE:function(){return Uy(a),l(p)})}function Py(a){var i=a.memoizedState;if(i!==null)return i;i={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:X},next:null};var l={};return i.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:l},next:null},a.memoizedState=i,a=a.alternate,a!==null&&(a.memoizedState=i),i}function Uy(a){var i=Py(a);i.next===null&&(i=a.alternate.memoizedState),$o(a,i.next.queue,{},ea())}function Up(){return xn(el)}function By(){return Xt().memoizedState}function Fy(){return Xt().memoizedState}function nE(a){for(var i=a.return;i!==null;){switch(i.tag){case 24:case 3:var l=ea();a=Qr(l);var p=Kr(i,a,l);p!==null&&(Bn(p,i,l),Oo(p,i,l)),i={cache:mp()},a.payload=i;return}i=i.return}}function aE(a,i,l){var p=ea();l={lane:p,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Tc(a)?qy(i,l):(l=rp(a,i,l,p),l!==null&&(Bn(l,a,p),Gy(l,i,p)))}function Hy(a,i,l){var p=ea();$o(a,i,l,p)}function $o(a,i,l,p){var v={lane:p,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Tc(a))qy(i,v);else{var b=a.alternate;if(a.lanes===0&&(b===null||b.lanes===0)&&(b=i.lastRenderedReducer,b!==null))try{var C=i.lastRenderedState,M=b(C,l);if(v.hasEagerState=!0,v.eagerState=M,Zn(M,C))return lc(a,i,v,0),Nt===null&&oc(),!1}catch{}finally{}if(l=rp(a,i,v,p),l!==null)return Bn(l,a,p),Gy(l,i,p),!0}return!1}function Bp(a,i,l,p){if(p={lane:2,revertLane:xf(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Tc(a)){if(i)throw Error(r(479))}else i=rp(a,l,p,2),i!==null&&Bn(i,a,2)}function Tc(a){var i=a.alternate;return a===Qe||i!==null&&i===Qe}function qy(a,i){Cs=wc=!0;var l=a.pending;l===null?i.next=i:(i.next=l.next,l.next=i),a.pending=i}function Gy(a,i,l){if((l&4194048)!==0){var p=i.lanes;p&=a.pendingLanes,l|=p,i.lanes=l,je(a,l)}}var Io={readContext:xn,use:jc,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};Io.useEffectEvent=Zt;var Vy={readContext:xn,use:jc,useCallback:function(a,i){return Rn().memoizedState=[a,i===void 0?null:i],a},useContext:xn,useEffect:Ay,useImperativeHandle:function(a,i,l){l=l!=null?l.concat([a]):null,Nc(4194308,4,Ly.bind(null,i,a),l)},useLayoutEffect:function(a,i){return Nc(4194308,4,a,i)},useInsertionEffect:function(a,i){Nc(4,2,a,i)},useMemo:function(a,i){var l=Rn();i=i===void 0?null:i;var p=a();if(zi){et(!0);try{a()}finally{et(!1)}}return l.memoizedState=[p,i],p},useReducer:function(a,i,l){var p=Rn();if(l!==void 0){var v=l(i);if(zi){et(!0);try{l(i)}finally{et(!1)}}}else v=i;return p.memoizedState=p.baseState=v,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:v},p.queue=a,a=a.dispatch=aE.bind(null,Qe,a),[p.memoizedState,a]},useRef:function(a){var i=Rn();return a={current:a},i.memoizedState=a},useState:function(a){a=zp(a);var i=a.queue,l=Hy.bind(null,Qe,i);return i.dispatch=l,[a.memoizedState,l]},useDebugValue:$p,useDeferredValue:function(a,i){var l=Rn();return Ip(l,a,i)},useTransition:function(){var a=zp(!1);return a=Iy.bind(null,Qe,a.queue,!0,!1),Rn().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,i,l){var p=Qe,v=Rn();if(ut){if(l===void 0)throw Error(r(407));l=l()}else{if(l=i(),Nt===null)throw Error(r(349));(st&127)!==0||fy(p,i,l)}v.memoizedState=l;var b={value:l,getSnapshot:i};return v.queue=b,Ay(my.bind(null,p,b,a),[a]),p.flags|=2048,Es(9,{destroy:void 0},hy.bind(null,p,b,l,i),null),l},useId:function(){var a=Rn(),i=Nt.identifierPrefix;if(ut){var l=Wa,p=Va;l=(p&~(1<<32-Ne(p)-1)).toString(32)+l,i="_"+i+"R_"+l,l=kc++,0<l&&(i+="H"+l.toString(32)),i+="_"}else l=QN++,i="_"+i+"r_"+l.toString(32)+"_";return a.memoizedState=i},useHostTransitionStatus:Up,useFormState:jy,useActionState:jy,useOptimistic:function(a){var i=Rn();i.memoizedState=i.baseState=a;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=l,i=Bp.bind(null,Qe,!0,l),l.dispatch=i,[a,i]},useMemoCache:_p,useCacheRefresh:function(){return Rn().memoizedState=nE.bind(null,Qe)},useEffectEvent:function(a){var i=Rn(),l={impl:a};return i.memoizedState=l,function(){if((yt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}},Fp={readContext:xn,use:jc,useCallback:My,useContext:xn,useEffect:Dp,useImperativeHandle:zy,useInsertionEffect:_y,useLayoutEffect:Oy,useMemo:Dy,useReducer:Cc,useRef:Ty,useState:function(){return Cc(xr)},useDebugValue:$p,useDeferredValue:function(a,i){var l=Xt();return $y(l,kt.memoizedState,a,i)},useTransition:function(){var a=Cc(xr)[0],i=Xt().memoizedState;return[typeof a=="boolean"?a:Do(a),i]},useSyncExternalStore:py,useId:By,useHostTransitionStatus:Up,useFormState:Cy,useActionState:Cy,useOptimistic:function(a,i){var l=Xt();return yy(l,kt,a,i)},useMemoCache:_p,useCacheRefresh:Fy};Fp.useEffectEvent=Ry;var Wy={readContext:xn,use:jc,useCallback:My,useContext:xn,useEffect:Dp,useImperativeHandle:zy,useInsertionEffect:_y,useLayoutEffect:Oy,useMemo:Dy,useReducer:Lp,useRef:Ty,useState:function(){return Lp(xr)},useDebugValue:$p,useDeferredValue:function(a,i){var l=Xt();return kt===null?Ip(l,a,i):$y(l,kt.memoizedState,a,i)},useTransition:function(){var a=Lp(xr)[0],i=Xt().memoizedState;return[typeof a=="boolean"?a:Do(a),i]},useSyncExternalStore:py,useId:By,useHostTransitionStatus:Up,useFormState:Ey,useActionState:Ey,useOptimistic:function(a,i){var l=Xt();return kt!==null?yy(l,kt,a,i):(l.baseState=a,[a,l.queue.dispatch])},useMemoCache:_p,useCacheRefresh:Fy};Wy.useEffectEvent=Ry;function Hp(a,i,l,p){i=a.memoizedState,l=l(p,i),l=l==null?i:m({},i,l),a.memoizedState=l,a.lanes===0&&(a.updateQueue.baseState=l)}var qp={enqueueSetState:function(a,i,l){a=a._reactInternals;var p=ea(),v=Qr(p);v.payload=i,l!=null&&(v.callback=l),i=Kr(a,v,p),i!==null&&(Bn(i,a,p),Oo(i,a,p))},enqueueReplaceState:function(a,i,l){a=a._reactInternals;var p=ea(),v=Qr(p);v.tag=1,v.payload=i,l!=null&&(v.callback=l),i=Kr(a,v,p),i!==null&&(Bn(i,a,p),Oo(i,a,p))},enqueueForceUpdate:function(a,i){a=a._reactInternals;var l=ea(),p=Qr(l);p.tag=2,i!=null&&(p.callback=i),i=Kr(a,p,l),i!==null&&(Bn(i,a,l),Oo(i,a,l))}};function Zy(a,i,l,p,v,b,C){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(p,b,C):i.prototype&&i.prototype.isPureReactComponent?!jo(l,p)||!jo(v,b):!0}function Yy(a,i,l,p){a=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(l,p),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(l,p),i.state!==a&&qp.enqueueReplaceState(i,i.state,null)}function Mi(a,i){var l=i;if("ref"in i){l={};for(var p in i)p!=="ref"&&(l[p]=i[p])}if(a=a.defaultProps){l===i&&(l=m({},l));for(var v in a)l[v]===void 0&&(l[v]=a[v])}return l}function Qy(a){sc(a)}function Ky(a){console.error(a)}function Xy(a){sc(a)}function Ac(a,i){try{var l=a.onUncaughtError;l(i.value,{componentStack:i.stack})}catch(p){setTimeout(function(){throw p})}}function Jy(a,i,l){try{var p=a.onCaughtError;p(l.value,{componentStack:l.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function Gp(a,i,l){return l=Qr(l),l.tag=3,l.payload={element:null},l.callback=function(){Ac(a,i)},l}function eb(a){return a=Qr(a),a.tag=3,a}function tb(a,i,l,p){var v=l.type.getDerivedStateFromError;if(typeof v=="function"){var b=p.value;a.payload=function(){return v(b)},a.callback=function(){Jy(i,l,p)}}var C=l.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(a.callback=function(){Jy(i,l,p),typeof v!="function"&&(ai===null?ai=new Set([this]):ai.add(this));var M=p.stack;this.componentDidCatch(p.value,{componentStack:M!==null?M:""})})}function rE(a,i,l,p,v){if(l.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(i=l.alternate,i!==null&&bs(i,l,v,!0),l=Qn.current,l!==null){switch(l.tag){case 31:case 13:return wa===null?Bc():l.alternate===null&&Yt===0&&(Yt=3),l.flags&=-257,l.flags|=65536,l.lanes=v,p===gc?l.flags|=16384:(i=l.updateQueue,i===null?l.updateQueue=new Set([p]):i.add(p),vf(a,p,v)),!1;case 22:return l.flags|=65536,p===gc?l.flags|=16384:(i=l.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([p])},l.updateQueue=i):(l=i.retryQueue,l===null?i.retryQueue=new Set([p]):l.add(p)),vf(a,p,v)),!1}throw Error(r(435,l.tag))}return vf(a,p,v),Bc(),!1}if(ut)return i=Qn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=v,p!==up&&(a=Error(r(422),{cause:p}),Eo(va(a,l)))):(p!==up&&(i=Error(r(423),{cause:p}),Eo(va(i,l))),a=a.current.alternate,a.flags|=65536,v&=-v,a.lanes|=v,p=va(p,l),v=Gp(a.stateNode,p,v),wp(a,v),Yt!==4&&(Yt=2)),!1;var b=Error(r(520),{cause:p});if(b=va(b,l),Vo===null?Vo=[b]:Vo.push(b),Yt!==4&&(Yt=2),i===null)return!0;p=va(p,l),l=i;do{switch(l.tag){case 3:return l.flags|=65536,a=v&-v,l.lanes|=a,a=Gp(l.stateNode,p,a),wp(l,a),!1;case 1:if(i=l.type,b=l.stateNode,(l.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(ai===null||!ai.has(b))))return l.flags|=65536,v&=-v,l.lanes|=v,v=eb(v),tb(v,a,l,p),wp(l,v),!1}l=l.return}while(l!==null);return!1}var Vp=Error(r(461)),an=!1;function wn(a,i,l,p){i.child=a===null?iy(i,null,l,p):Li(i,a.child,l,p)}function nb(a,i,l,p,v){l=l.render;var b=i.ref;if("ref"in p){var C={};for(var M in p)M!=="ref"&&(C[M]=p[M])}else C=p;return Ai(i),p=Ep(a,i,l,C,b,v),M=Tp(),a!==null&&!an?(Ap(a,i,v),wr(a,i,v)):(ut&&M&&lp(i),i.flags|=1,wn(a,i,p,v),i.child)}function ab(a,i,l,p,v){if(a===null){var b=l.type;return typeof b=="function"&&!ip(b)&&b.defaultProps===void 0&&l.compare===null?(i.tag=15,i.type=b,rb(a,i,b,p,v)):(a=uc(l.type,null,p,i,i.mode,v),a.ref=i.ref,a.return=i,i.child=a)}if(b=a.child,!ef(a,v)){var C=b.memoizedProps;if(l=l.compare,l=l!==null?l:jo,l(C,p)&&a.ref===i.ref)return wr(a,i,v)}return i.flags|=1,a=mr(b,p),a.ref=i.ref,a.return=i,i.child=a}function rb(a,i,l,p,v){if(a!==null){var b=a.memoizedProps;if(jo(b,p)&&a.ref===i.ref)if(an=!1,i.pendingProps=p=b,ef(a,v))(a.flags&131072)!==0&&(an=!0);else return i.lanes=a.lanes,wr(a,i,v)}return Wp(a,i,l,p,v)}function ib(a,i,l,p){var v=p.children,b=a!==null?a.memoizedState:null;if(a===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((i.flags&128)!==0){if(b=b!==null?b.baseLanes|l:l,a!==null){for(p=i.child=a.child,v=0;p!==null;)v=v|p.lanes|p.childLanes,p=p.sibling;p=v&~b}else p=0,i.child=null;return sb(a,i,b,l,p)}if((l&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},a!==null&&hc(i,b!==null?b.cachePool:null),b!==null?ly(i,b):Sp(),cy(i);else return p=i.lanes=536870912,sb(a,i,b!==null?b.baseLanes|l:l,l,p)}else b!==null?(hc(i,b.cachePool),ly(i,b),Jr(),i.memoizedState=null):(a!==null&&hc(i,null),Sp(),Jr());return wn(a,i,v,l),i.child}function Po(a,i){return a!==null&&a.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function sb(a,i,l,p,v){var b=vp();return b=b===null?null:{parent:tn._currentValue,pool:b},i.memoizedState={baseLanes:l,cachePool:b},a!==null&&hc(i,null),Sp(),cy(i),a!==null&&bs(a,i,p,!0),i.childLanes=v,null}function Rc(a,i){return i=Oc({mode:i.mode,children:i.children},a.mode),i.ref=a.ref,a.child=i,i.return=a,i}function ob(a,i,l){return Li(i,a.child,null,l),a=Rc(i,i.pendingProps),a.flags|=2,Kn(i),i.memoizedState=null,a}function iE(a,i,l){var p=i.pendingProps,v=(i.flags&128)!==0;if(i.flags&=-129,a===null){if(ut){if(p.mode==="hidden")return a=Rc(i,p),i.lanes=536870912,Po(null,a);if(Cp(i),(a=Lt)?(a=b0(a,xa),a=a!==null&&a.data==="&"?a:null,a!==null&&(i.memoizedState={dehydrated:a,treeContext:Gr!==null?{id:Va,overflow:Wa}:null,retryLane:536870912,hydrationErrors:null},l=qv(a),l.return=i,i.child=l,bn=i,Lt=null)):a=null,a===null)throw Wr(i);return i.lanes=536870912,null}return Rc(i,p)}var b=a.memoizedState;if(b!==null){var C=b.dehydrated;if(Cp(i),v)if(i.flags&256)i.flags&=-257,i=ob(a,i,l);else if(i.memoizedState!==null)i.child=a.child,i.flags|=128,i=null;else throw Error(r(558));else if(an||bs(a,i,l,!1),v=(l&a.childLanes)!==0,an||v){if(p=Nt,p!==null&&(C=Te(p,l),C!==0&&C!==b.retryLane))throw b.retryLane=C,Ci(a,C),Bn(p,a,C),Vp;Bc(),i=ob(a,i,l)}else a=b.treeContext,Lt=ka(C.nextSibling),bn=i,ut=!0,Vr=null,xa=!1,a!==null&&Wv(i,a),i=Rc(i,p),i.flags|=4096;return i}return a=mr(a.child,{mode:p.mode,children:p.children}),a.ref=i.ref,i.child=a,a.return=i,a}function _c(a,i){var l=i.ref;if(l===null)a!==null&&a.ref!==null&&(i.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(r(284));(a===null||a.ref!==l)&&(i.flags|=4194816)}}function Wp(a,i,l,p,v){return Ai(i),l=Ep(a,i,l,p,void 0,v),p=Tp(),a!==null&&!an?(Ap(a,i,v),wr(a,i,v)):(ut&&p&&lp(i),i.flags|=1,wn(a,i,l,v),i.child)}function lb(a,i,l,p,v,b){return Ai(i),i.updateQueue=null,l=dy(i,p,l,v),uy(a),p=Tp(),a!==null&&!an?(Ap(a,i,b),wr(a,i,b)):(ut&&p&&lp(i),i.flags|=1,wn(a,i,l,b),i.child)}function cb(a,i,l,p,v){if(Ai(i),i.stateNode===null){var b=ms,C=l.contextType;typeof C=="object"&&C!==null&&(b=xn(C)),b=new l(p,b),i.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=qp,i.stateNode=b,b._reactInternals=i,b=i.stateNode,b.props=p,b.state=i.memoizedState,b.refs={},bp(i),C=l.contextType,b.context=typeof C=="object"&&C!==null?xn(C):ms,b.state=i.memoizedState,C=l.getDerivedStateFromProps,typeof C=="function"&&(Hp(i,l,C,p),b.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(C=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),C!==b.state&&qp.enqueueReplaceState(b,b.state,null),zo(i,p,b,v),Lo(),b.state=i.memoizedState),typeof b.componentDidMount=="function"&&(i.flags|=4194308),p=!0}else if(a===null){b=i.stateNode;var M=i.memoizedProps,Y=Mi(l,M);b.props=Y;var re=b.context,pe=l.contextType;C=ms,typeof pe=="object"&&pe!==null&&(C=xn(pe));var me=l.getDerivedStateFromProps;pe=typeof me=="function"||typeof b.getSnapshotBeforeUpdate=="function",M=i.pendingProps!==M,pe||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(M||re!==C)&&Yy(i,b,p,C),Yr=!1;var se=i.memoizedState;b.state=se,zo(i,p,b,v),Lo(),re=i.memoizedState,M||se!==re||Yr?(typeof me=="function"&&(Hp(i,l,me,p),re=i.memoizedState),(Y=Yr||Zy(i,l,Y,p,se,re,C))?(pe||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(i.flags|=4194308)):(typeof b.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=p,i.memoizedState=re),b.props=p,b.state=re,b.context=C,p=Y):(typeof b.componentDidMount=="function"&&(i.flags|=4194308),p=!1)}else{b=i.stateNode,xp(a,i),C=i.memoizedProps,pe=Mi(l,C),b.props=pe,me=i.pendingProps,se=b.context,re=l.contextType,Y=ms,typeof re=="object"&&re!==null&&(Y=xn(re)),M=l.getDerivedStateFromProps,(re=typeof M=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(C!==me||se!==Y)&&Yy(i,b,p,Y),Yr=!1,se=i.memoizedState,b.state=se,zo(i,p,b,v),Lo();var oe=i.memoizedState;C!==me||se!==oe||Yr||a!==null&&a.dependencies!==null&&pc(a.dependencies)?(typeof M=="function"&&(Hp(i,l,M,p),oe=i.memoizedState),(pe=Yr||Zy(i,l,pe,p,se,oe,Y)||a!==null&&a.dependencies!==null&&pc(a.dependencies))?(re||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(p,oe,Y),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(p,oe,Y)),typeof b.componentDidUpdate=="function"&&(i.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof b.componentDidUpdate!="function"||C===a.memoizedProps&&se===a.memoizedState||(i.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||C===a.memoizedProps&&se===a.memoizedState||(i.flags|=1024),i.memoizedProps=p,i.memoizedState=oe),b.props=p,b.state=oe,b.context=Y,p=pe):(typeof b.componentDidUpdate!="function"||C===a.memoizedProps&&se===a.memoizedState||(i.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||C===a.memoizedProps&&se===a.memoizedState||(i.flags|=1024),p=!1)}return b=p,_c(a,i),p=(i.flags&128)!==0,b||p?(b=i.stateNode,l=p&&typeof l.getDerivedStateFromError!="function"?null:b.render(),i.flags|=1,a!==null&&p?(i.child=Li(i,a.child,null,v),i.child=Li(i,null,l,v)):wn(a,i,l,v),i.memoizedState=b.state,a=i.child):a=wr(a,i,v),a}function ub(a,i,l,p){return Ei(),i.flags|=256,wn(a,i,l,p),i.child}var Zp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Yp(a){return{baseLanes:a,cachePool:Jv()}}function Qp(a,i,l){return a=a!==null?a.childLanes&~l:0,i&&(a|=Jn),a}function db(a,i,l){var p=i.pendingProps,v=!1,b=(i.flags&128)!==0,C;if((C=b)||(C=a!==null&&a.memoizedState===null?!1:(Kt.current&2)!==0),C&&(v=!0,i.flags&=-129),C=(i.flags&32)!==0,i.flags&=-33,a===null){if(ut){if(v?Xr(i):Jr(),(a=Lt)?(a=b0(a,xa),a=a!==null&&a.data!=="&"?a:null,a!==null&&(i.memoizedState={dehydrated:a,treeContext:Gr!==null?{id:Va,overflow:Wa}:null,retryLane:536870912,hydrationErrors:null},l=qv(a),l.return=i,i.child=l,bn=i,Lt=null)):a=null,a===null)throw Wr(i);return Lf(a)?i.lanes=32:i.lanes=536870912,null}var M=p.children;return p=p.fallback,v?(Jr(),v=i.mode,M=Oc({mode:"hidden",children:M},v),p=Ni(p,v,l,null),M.return=i,p.return=i,M.sibling=p,i.child=M,p=i.child,p.memoizedState=Yp(l),p.childLanes=Qp(a,C,l),i.memoizedState=Zp,Po(null,p)):(Xr(i),Kp(i,M))}var Y=a.memoizedState;if(Y!==null&&(M=Y.dehydrated,M!==null)){if(b)i.flags&256?(Xr(i),i.flags&=-257,i=Xp(a,i,l)):i.memoizedState!==null?(Jr(),i.child=a.child,i.flags|=128,i=null):(Jr(),M=p.fallback,v=i.mode,p=Oc({mode:"visible",children:p.children},v),M=Ni(M,v,l,null),M.flags|=2,p.return=i,M.return=i,p.sibling=M,i.child=p,Li(i,a.child,null,l),p=i.child,p.memoizedState=Yp(l),p.childLanes=Qp(a,C,l),i.memoizedState=Zp,i=Po(null,p));else if(Xr(i),Lf(M)){if(C=M.nextSibling&&M.nextSibling.dataset,C)var re=C.dgst;C=re,p=Error(r(419)),p.stack="",p.digest=C,Eo({value:p,source:null,stack:null}),i=Xp(a,i,l)}else if(an||bs(a,i,l,!1),C=(l&a.childLanes)!==0,an||C){if(C=Nt,C!==null&&(p=Te(C,l),p!==0&&p!==Y.retryLane))throw Y.retryLane=p,Ci(a,p),Bn(C,a,p),Vp;Of(M)||Bc(),i=Xp(a,i,l)}else Of(M)?(i.flags|=192,i.child=a.child,i=null):(a=Y.treeContext,Lt=ka(M.nextSibling),bn=i,ut=!0,Vr=null,xa=!1,a!==null&&Wv(i,a),i=Kp(i,p.children),i.flags|=4096);return i}return v?(Jr(),M=p.fallback,v=i.mode,Y=a.child,re=Y.sibling,p=mr(Y,{mode:"hidden",children:p.children}),p.subtreeFlags=Y.subtreeFlags&65011712,re!==null?M=mr(re,M):(M=Ni(M,v,l,null),M.flags|=2),M.return=i,p.return=i,p.sibling=M,i.child=p,Po(null,p),p=i.child,M=a.child.memoizedState,M===null?M=Yp(l):(v=M.cachePool,v!==null?(Y=tn._currentValue,v=v.parent!==Y?{parent:Y,pool:Y}:v):v=Jv(),M={baseLanes:M.baseLanes|l,cachePool:v}),p.memoizedState=M,p.childLanes=Qp(a,C,l),i.memoizedState=Zp,Po(a.child,p)):(Xr(i),l=a.child,a=l.sibling,l=mr(l,{mode:"visible",children:p.children}),l.return=i,l.sibling=null,a!==null&&(C=i.deletions,C===null?(i.deletions=[a],i.flags|=16):C.push(a)),i.child=l,i.memoizedState=null,l)}function Kp(a,i){return i=Oc({mode:"visible",children:i},a.mode),i.return=a,a.child=i}function Oc(a,i){return a=Yn(22,a,null,i),a.lanes=0,a}function Xp(a,i,l){return Li(i,a.child,null,l),a=Kp(i,i.pendingProps.children),a.flags|=2,i.memoizedState=null,a}function pb(a,i,l){a.lanes|=i;var p=a.alternate;p!==null&&(p.lanes|=i),fp(a.return,i,l)}function Jp(a,i,l,p,v,b){var C=a.memoizedState;C===null?a.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:p,tail:l,tailMode:v,treeForkCount:b}:(C.isBackwards=i,C.rendering=null,C.renderingStartTime=0,C.last=p,C.tail=l,C.tailMode=v,C.treeForkCount=b)}function fb(a,i,l){var p=i.pendingProps,v=p.revealOrder,b=p.tail;p=p.children;var C=Kt.current,M=(C&2)!==0;if(M?(C=C&1|2,i.flags|=128):C&=1,O(Kt,C),wn(a,i,p,l),p=ut?No:0,!M&&a!==null&&(a.flags&128)!==0)e:for(a=i.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&pb(a,l,i);else if(a.tag===19)pb(a,l,i);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(v){case"forwards":for(l=i.child,v=null;l!==null;)a=l.alternate,a!==null&&xc(a)===null&&(v=l),l=l.sibling;l=v,l===null?(v=i.child,i.child=null):(v=l.sibling,l.sibling=null),Jp(i,!1,v,l,b,p);break;case"backwards":case"unstable_legacy-backwards":for(l=null,v=i.child,i.child=null;v!==null;){if(a=v.alternate,a!==null&&xc(a)===null){i.child=v;break}a=v.sibling,v.sibling=l,l=v,v=a}Jp(i,!0,l,null,b,p);break;case"together":Jp(i,!1,null,null,void 0,p);break;default:i.memoizedState=null}return i.child}function wr(a,i,l){if(a!==null&&(i.dependencies=a.dependencies),ni|=i.lanes,(l&i.childLanes)===0)if(a!==null){if(bs(a,i,l,!1),(l&i.childLanes)===0)return null}else return null;if(a!==null&&i.child!==a.child)throw Error(r(153));if(i.child!==null){for(a=i.child,l=mr(a,a.pendingProps),i.child=l,l.return=i;a.sibling!==null;)a=a.sibling,l=l.sibling=mr(a,a.pendingProps),l.return=i;l.sibling=null}return i.child}function ef(a,i){return(a.lanes&i)!==0?!0:(a=a.dependencies,!!(a!==null&&pc(a)))}function sE(a,i,l){switch(i.tag){case 3:Re(i,i.stateNode.containerInfo),Zr(i,tn,a.memoizedState.cache),Ei();break;case 27:case 5:Ie(i);break;case 4:Re(i,i.stateNode.containerInfo);break;case 10:Zr(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Cp(i),null;break;case 13:var p=i.memoizedState;if(p!==null)return p.dehydrated!==null?(Xr(i),i.flags|=128,null):(l&i.child.childLanes)!==0?db(a,i,l):(Xr(i),a=wr(a,i,l),a!==null?a.sibling:null);Xr(i);break;case 19:var v=(a.flags&128)!==0;if(p=(l&i.childLanes)!==0,p||(bs(a,i,l,!1),p=(l&i.childLanes)!==0),v){if(p)return fb(a,i,l);i.flags|=128}if(v=i.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),O(Kt,Kt.current),p)break;return null;case 22:return i.lanes=0,ib(a,i,l,i.pendingProps);case 24:Zr(i,tn,a.memoizedState.cache)}return wr(a,i,l)}function hb(a,i,l){if(a!==null)if(a.memoizedProps!==i.pendingProps)an=!0;else{if(!ef(a,l)&&(i.flags&128)===0)return an=!1,sE(a,i,l);an=(a.flags&131072)!==0}else an=!1,ut&&(i.flags&1048576)!==0&&Vv(i,No,i.index);switch(i.lanes=0,i.tag){case 16:e:{var p=i.pendingProps;if(a=_i(i.elementType),i.type=a,typeof a=="function")ip(a)?(p=Mi(a,p),i.tag=1,i=cb(null,i,a,p,l)):(i.tag=0,i=Wp(null,i,a,p,l));else{if(a!=null){var v=a.$$typeof;if(v===A){i.tag=11,i=nb(null,i,a,p,l);break e}else if(v===$){i.tag=14,i=ab(null,i,a,p,l);break e}}throw i=I(a)||a,Error(r(306,i,""))}}return i;case 0:return Wp(a,i,i.type,i.pendingProps,l);case 1:return p=i.type,v=Mi(p,i.pendingProps),cb(a,i,p,v,l);case 3:e:{if(Re(i,i.stateNode.containerInfo),a===null)throw Error(r(387));p=i.pendingProps;var b=i.memoizedState;v=b.element,xp(a,i),zo(i,p,null,l);var C=i.memoizedState;if(p=C.cache,Zr(i,tn,p),p!==b.cache&&hp(i,[tn],l,!0),Lo(),p=C.element,b.isDehydrated)if(b={element:p,isDehydrated:!1,cache:C.cache},i.updateQueue.baseState=b,i.memoizedState=b,i.flags&256){i=ub(a,i,p,l);break e}else if(p!==v){v=va(Error(r(424)),i),Eo(v),i=ub(a,i,p,l);break e}else{switch(a=i.stateNode.containerInfo,a.nodeType){case 9:a=a.body;break;default:a=a.nodeName==="HTML"?a.ownerDocument.body:a}for(Lt=ka(a.firstChild),bn=i,ut=!0,Vr=null,xa=!0,l=iy(i,null,p,l),i.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Ei(),p===v){i=wr(a,i,l);break e}wn(a,i,p,l)}i=i.child}return i;case 26:return _c(a,i),a===null?(l=C0(i.type,null,i.pendingProps,null))?i.memoizedState=l:ut||(l=i.type,a=i.pendingProps,p=Zc(le.current).createElement(l),p[Ht]=i,p[cn]=a,kn(p,l,a),Ot(p),i.stateNode=p):i.memoizedState=C0(i.type,a.memoizedProps,i.pendingProps,a.memoizedState),null;case 27:return Ie(i),a===null&&ut&&(p=i.stateNode=k0(i.type,i.pendingProps,le.current),bn=i,xa=!0,v=Lt,oi(i.type)?(zf=v,Lt=ka(p.firstChild)):Lt=v),wn(a,i,i.pendingProps.children,l),_c(a,i),a===null&&(i.flags|=4194304),i.child;case 5:return a===null&&ut&&((v=p=Lt)&&(p=DE(p,i.type,i.pendingProps,xa),p!==null?(i.stateNode=p,bn=i,Lt=ka(p.firstChild),xa=!1,v=!0):v=!1),v||Wr(i)),Ie(i),v=i.type,b=i.pendingProps,C=a!==null?a.memoizedProps:null,p=b.children,Af(v,b)?p=null:C!==null&&Af(v,C)&&(i.flags|=32),i.memoizedState!==null&&(v=Ep(a,i,KN,null,null,l),el._currentValue=v),_c(a,i),wn(a,i,p,l),i.child;case 6:return a===null&&ut&&((a=l=Lt)&&(l=$E(l,i.pendingProps,xa),l!==null?(i.stateNode=l,bn=i,Lt=null,a=!0):a=!1),a||Wr(i)),null;case 13:return db(a,i,l);case 4:return Re(i,i.stateNode.containerInfo),p=i.pendingProps,a===null?i.child=Li(i,null,p,l):wn(a,i,p,l),i.child;case 11:return nb(a,i,i.type,i.pendingProps,l);case 7:return wn(a,i,i.pendingProps,l),i.child;case 8:return wn(a,i,i.pendingProps.children,l),i.child;case 12:return wn(a,i,i.pendingProps.children,l),i.child;case 10:return p=i.pendingProps,Zr(i,i.type,p.value),wn(a,i,p.children,l),i.child;case 9:return v=i.type._context,p=i.pendingProps.children,Ai(i),v=xn(v),p=p(v),i.flags|=1,wn(a,i,p,l),i.child;case 14:return ab(a,i,i.type,i.pendingProps,l);case 15:return rb(a,i,i.type,i.pendingProps,l);case 19:return fb(a,i,l);case 31:return iE(a,i,l);case 22:return ib(a,i,l,i.pendingProps);case 24:return Ai(i),p=xn(tn),a===null?(v=vp(),v===null&&(v=Nt,b=mp(),v.pooledCache=b,b.refCount++,b!==null&&(v.pooledCacheLanes|=l),v=b),i.memoizedState={parent:p,cache:v},bp(i),Zr(i,tn,v)):((a.lanes&l)!==0&&(xp(a,i),zo(i,null,null,l),Lo()),v=a.memoizedState,b=i.memoizedState,v.parent!==p?(v={parent:p,cache:p},i.memoizedState=v,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=v),Zr(i,tn,p)):(p=b.cache,Zr(i,tn,p),p!==v.cache&&hp(i,[tn],l,!0))),wn(a,i,i.pendingProps.children,l),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function kr(a){a.flags|=4}function tf(a,i,l,p,v){if((i=(a.mode&32)!==0)&&(i=!1),i){if(a.flags|=16777216,(v&335544128)===v)if(a.stateNode.complete)a.flags|=8192;else if(Bb())a.flags|=8192;else throw Oi=gc,yp}else a.flags&=-16777217}function mb(a,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!R0(i))if(Bb())a.flags|=8192;else throw Oi=gc,yp}function Lc(a,i){i!==null&&(a.flags|=4),a.flags&16384&&(i=a.tag!==22?Fr():536870912,a.lanes|=i,_s|=i)}function Uo(a,i){if(!ut)switch(a.tailMode){case"hidden":i=a.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?a.tail=null:l.sibling=null;break;case"collapsed":l=a.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?i||a.tail===null?a.tail=null:a.tail.sibling=null:p.sibling=null}}function zt(a){var i=a.alternate!==null&&a.alternate.child===a.child,l=0,p=0;if(i)for(var v=a.child;v!==null;)l|=v.lanes|v.childLanes,p|=v.subtreeFlags&65011712,p|=v.flags&65011712,v.return=a,v=v.sibling;else for(v=a.child;v!==null;)l|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=a,v=v.sibling;return a.subtreeFlags|=p,a.childLanes=l,i}function oE(a,i,l){var p=i.pendingProps;switch(cp(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zt(i),null;case 1:return zt(i),null;case 3:return l=i.stateNode,p=null,a!==null&&(p=a.memoizedState.cache),i.memoizedState.cache!==p&&(i.flags|=2048),yr(tn),Ee(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(a===null||a.child===null)&&(ys(i)?kr(i):a===null||a.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,dp())),zt(i),null;case 26:var v=i.type,b=i.memoizedState;return a===null?(kr(i),b!==null?(zt(i),mb(i,b)):(zt(i),tf(i,v,null,p,l))):b?b!==a.memoizedState?(kr(i),zt(i),mb(i,b)):(zt(i),i.flags&=-16777217):(a=a.memoizedProps,a!==p&&kr(i),zt(i),tf(i,v,a,p,l)),null;case 27:if(Ve(i),l=le.current,v=i.type,a!==null&&i.stateNode!=null)a.memoizedProps!==p&&kr(i);else{if(!p){if(i.stateNode===null)throw Error(r(166));return zt(i),null}a=ne.current,ys(i)?Zv(i):(a=k0(v,p,l),i.stateNode=a,kr(i))}return zt(i),null;case 5:if(Ve(i),v=i.type,a!==null&&i.stateNode!=null)a.memoizedProps!==p&&kr(i);else{if(!p){if(i.stateNode===null)throw Error(r(166));return zt(i),null}if(b=ne.current,ys(i))Zv(i);else{var C=Zc(le.current);switch(b){case 1:b=C.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:b=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":b=C.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":b=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":b=C.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof p.is=="string"?C.createElement("select",{is:p.is}):C.createElement("select"),p.multiple?b.multiple=!0:p.size&&(b.size=p.size);break;default:b=typeof p.is=="string"?C.createElement(v,{is:p.is}):C.createElement(v)}}b[Ht]=i,b[cn]=p;e:for(C=i.child;C!==null;){if(C.tag===5||C.tag===6)b.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=b;e:switch(kn(b,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&&kr(i)}}return zt(i),tf(i,i.type,a===null?null:a.memoizedProps,i.pendingProps,l),null;case 6:if(a&&i.stateNode!=null)a.memoizedProps!==p&&kr(i);else{if(typeof p!="string"&&i.stateNode===null)throw Error(r(166));if(a=le.current,ys(i)){if(a=i.stateNode,l=i.memoizedProps,p=null,v=bn,v!==null)switch(v.tag){case 27:case 5:p=v.memoizedProps}a[Ht]=i,a=!!(a.nodeValue===l||p!==null&&p.suppressHydrationWarning===!0||d0(a.nodeValue,l)),a||Wr(i,!0)}else a=Zc(a).createTextNode(p),a[Ht]=i,i.stateNode=a}return zt(i),null;case 31:if(l=i.memoizedState,a===null||a.memoizedState!==null){if(p=ys(i),l!==null){if(a===null){if(!p)throw Error(r(318));if(a=i.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[Ht]=i}else Ei(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;zt(i),a=!1}else l=dp(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=l),a=!0;if(!a)return i.flags&256?(Kn(i),i):(Kn(i),null);if((i.flags&128)!==0)throw Error(r(558))}return zt(i),null;case 13:if(p=i.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(v=ys(i),p!==null&&p.dehydrated!==null){if(a===null){if(!v)throw Error(r(318));if(v=i.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[Ht]=i}else Ei(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;zt(i),v=!1}else v=dp(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=v),v=!0;if(!v)return i.flags&256?(Kn(i),i):(Kn(i),null)}return Kn(i),(i.flags&128)!==0?(i.lanes=l,i):(l=p!==null,a=a!==null&&a.memoizedState!==null,l&&(p=i.child,v=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(v=p.alternate.memoizedState.cachePool.pool),b=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(b=p.memoizedState.cachePool.pool),b!==v&&(p.flags|=2048)),l!==a&&l&&(i.child.flags|=8192),Lc(i,i.updateQueue),zt(i),null);case 4:return Ee(),a===null&&jf(i.stateNode.containerInfo),zt(i),null;case 10:return yr(i.type),zt(i),null;case 19:if(G(Kt),p=i.memoizedState,p===null)return zt(i),null;if(v=(i.flags&128)!==0,b=p.rendering,b===null)if(v)Uo(p,!1);else{if(Yt!==0||a!==null&&(a.flags&128)!==0)for(a=i.child;a!==null;){if(b=xc(a),b!==null){for(i.flags|=128,Uo(p,!1),a=b.updateQueue,i.updateQueue=a,Lc(i,a),i.subtreeFlags=0,a=l,l=i.child;l!==null;)Hv(l,a),l=l.sibling;return O(Kt,Kt.current&1|2),ut&&gr(i,p.treeForkCount),i.child}a=a.sibling}p.tail!==null&&dt()>Ic&&(i.flags|=128,v=!0,Uo(p,!1),i.lanes=4194304)}else{if(!v)if(a=xc(b),a!==null){if(i.flags|=128,v=!0,a=a.updateQueue,i.updateQueue=a,Lc(i,a),Uo(p,!0),p.tail===null&&p.tailMode==="hidden"&&!b.alternate&&!ut)return zt(i),null}else 2*dt()-p.renderingStartTime>Ic&&l!==536870912&&(i.flags|=128,v=!0,Uo(p,!1),i.lanes=4194304);p.isBackwards?(b.sibling=i.child,i.child=b):(a=p.last,a!==null?a.sibling=b:i.child=b,p.last=b)}return p.tail!==null?(a=p.tail,p.rendering=a,p.tail=a.sibling,p.renderingStartTime=dt(),a.sibling=null,l=Kt.current,O(Kt,v?l&1|2:l&1),ut&&gr(i,p.treeForkCount),a):(zt(i),null);case 22:case 23:return Kn(i),jp(),p=i.memoizedState!==null,a!==null?a.memoizedState!==null!==p&&(i.flags|=8192):p&&(i.flags|=8192),p?(l&536870912)!==0&&(i.flags&128)===0&&(zt(i),i.subtreeFlags&6&&(i.flags|=8192)):zt(i),l=i.updateQueue,l!==null&&Lc(i,l.retryQueue),l=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(l=a.memoizedState.cachePool.pool),p=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(p=i.memoizedState.cachePool.pool),p!==l&&(i.flags|=2048),a!==null&&G(Ri),null;case 24:return l=null,a!==null&&(l=a.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),yr(tn),zt(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function lE(a,i){switch(cp(i),i.tag){case 1:return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 3:return yr(tn),Ee(),a=i.flags,(a&65536)!==0&&(a&128)===0?(i.flags=a&-65537|128,i):null;case 26:case 27:case 5:return Ve(i),null;case 31:if(i.memoizedState!==null){if(Kn(i),i.alternate===null)throw Error(r(340));Ei()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 13:if(Kn(i),a=i.memoizedState,a!==null&&a.dehydrated!==null){if(i.alternate===null)throw Error(r(340));Ei()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 19:return G(Kt),null;case 4:return Ee(),null;case 10:return yr(i.type),null;case 22:case 23:return Kn(i),jp(),a!==null&&G(Ri),a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 24:return yr(tn),null;case 25:return null;default:return null}}function gb(a,i){switch(cp(i),i.tag){case 3:yr(tn),Ee();break;case 26:case 27:case 5:Ve(i);break;case 4:Ee();break;case 31:i.memoizedState!==null&&Kn(i);break;case 13:Kn(i);break;case 19:G(Kt);break;case 10:yr(i.type);break;case 22:case 23:Kn(i),jp(),a!==null&&G(Ri);break;case 24:yr(tn)}}function Bo(a,i){try{var l=i.updateQueue,p=l!==null?l.lastEffect:null;if(p!==null){var v=p.next;l=v;do{if((l.tag&a)===a){p=void 0;var b=l.create,C=l.inst;p=b(),C.destroy=p}l=l.next}while(l!==v)}}catch(M){wt(i,i.return,M)}}function ei(a,i,l){try{var p=i.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var b=v.next;p=b;do{if((p.tag&a)===a){var C=p.inst,M=C.destroy;if(M!==void 0){C.destroy=void 0,v=i;var Y=l,re=M;try{re()}catch(pe){wt(v,Y,pe)}}}p=p.next}while(p!==b)}}catch(pe){wt(i,i.return,pe)}}function vb(a){var i=a.updateQueue;if(i!==null){var l=a.stateNode;try{oy(i,l)}catch(p){wt(a,a.return,p)}}}function yb(a,i,l){l.props=Mi(a.type,a.memoizedProps),l.state=a.memoizedState;try{l.componentWillUnmount()}catch(p){wt(a,i,p)}}function Fo(a,i){try{var l=a.ref;if(l!==null){switch(a.tag){case 26:case 27:case 5:var p=a.stateNode;break;case 30:p=a.stateNode;break;default:p=a.stateNode}typeof l=="function"?a.refCleanup=l(p):l.current=p}}catch(v){wt(a,i,v)}}function Za(a,i){var l=a.ref,p=a.refCleanup;if(l!==null)if(typeof p=="function")try{p()}catch(v){wt(a,i,v)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(v){wt(a,i,v)}else l.current=null}function bb(a){var i=a.type,l=a.memoizedProps,p=a.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":l.autoFocus&&p.focus();break e;case"img":l.src?p.src=l.src:l.srcSet&&(p.srcset=l.srcSet)}}catch(v){wt(a,a.return,v)}}function nf(a,i,l){try{var p=a.stateNode;RE(p,a.type,l,i),p[cn]=i}catch(v){wt(a,a.return,v)}}function xb(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&oi(a.type)||a.tag===4}function af(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||xb(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&oi(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function rf(a,i,l){var p=a.tag;if(p===5||p===6)a=a.stateNode,i?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(a,i):(i=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,i.appendChild(a),l=l._reactRootContainer,l!=null||i.onclick!==null||(i.onclick=fr));else if(p!==4&&(p===27&&oi(a.type)&&(l=a.stateNode,i=null),a=a.child,a!==null))for(rf(a,i,l),a=a.sibling;a!==null;)rf(a,i,l),a=a.sibling}function zc(a,i,l){var p=a.tag;if(p===5||p===6)a=a.stateNode,i?l.insertBefore(a,i):l.appendChild(a);else if(p!==4&&(p===27&&oi(a.type)&&(l=a.stateNode),a=a.child,a!==null))for(zc(a,i,l),a=a.sibling;a!==null;)zc(a,i,l),a=a.sibling}function wb(a){var i=a.stateNode,l=a.memoizedProps;try{for(var p=a.type,v=i.attributes;v.length;)i.removeAttributeNode(v[0]);kn(i,p,l),i[Ht]=a,i[cn]=l}catch(b){wt(a,a.return,b)}}var Sr=!1,rn=!1,sf=!1,kb=typeof WeakSet=="function"?WeakSet:Set,gn=null;function cE(a,i){if(a=a.containerInfo,Ef=tu,a=zv(a),Xd(a)){if("selectionStart"in a)var l={start:a.selectionStart,end:a.selectionEnd};else e:{l=(l=a.ownerDocument)&&l.defaultView||window;var p=l.getSelection&&l.getSelection();if(p&&p.rangeCount!==0){l=p.anchorNode;var v=p.anchorOffset,b=p.focusNode;p=p.focusOffset;try{l.nodeType,b.nodeType}catch{l=null;break e}var C=0,M=-1,Y=-1,re=0,pe=0,me=a,se=null;t:for(;;){for(var oe;me!==l||v!==0&&me.nodeType!==3||(M=C+v),me!==b||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===a)break t;if(se===l&&++re===v&&(M=C),se===b&&++pe===p&&(Y=C),(oe=me.nextSibling)!==null)break;me=se,se=me.parentNode}me=oe}l=M===-1||Y===-1?null:{start:M,end:Y}}else l=null}l=l||{start:0,end:0}}else l=null;for(Tf={focusedElem:a,selectionRange:l},tu=!1,gn=i;gn!==null;)if(i=gn,a=i.child,(i.subtreeFlags&1028)!==0&&a!==null)a.return=i,gn=a;else for(;gn!==null;){switch(i=gn,b=i.alternate,a=i.flags,i.tag){case 0:if((a&4)!==0&&(a=i.updateQueue,a=a!==null?a.events:null,a!==null))for(l=0;l<a.length;l++)v=a[l],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&b!==null){a=void 0,l=i,v=b.memoizedProps,b=b.memoizedState,p=l.stateNode;try{var Ae=Mi(l.type,v);a=p.getSnapshotBeforeUpdate(Ae,b),p.__reactInternalSnapshotBeforeUpdate=a}catch(Be){wt(l,l.return,Be)}}break;case 3:if((a&1024)!==0){if(a=i.stateNode.containerInfo,l=a.nodeType,l===9)_f(a);else if(l===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":_f(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(r(163))}if(a=i.sibling,a!==null){a.return=i.return,gn=a;break}gn=i.return}}function Sb(a,i,l){var p=l.flags;switch(l.tag){case 0:case 11:case 15:Cr(a,l),p&4&&Bo(5,l);break;case 1:if(Cr(a,l),p&4)if(a=l.stateNode,i===null)try{a.componentDidMount()}catch(C){wt(l,l.return,C)}else{var v=Mi(l.type,i.memoizedProps);i=i.memoizedState;try{a.componentDidUpdate(v,i,a.__reactInternalSnapshotBeforeUpdate)}catch(C){wt(l,l.return,C)}}p&64&&vb(l),p&512&&Fo(l,l.return);break;case 3:if(Cr(a,l),p&64&&(a=l.updateQueue,a!==null)){if(i=null,l.child!==null)switch(l.child.tag){case 27:case 5:i=l.child.stateNode;break;case 1:i=l.child.stateNode}try{oy(a,i)}catch(C){wt(l,l.return,C)}}break;case 27:i===null&&p&4&&wb(l);case 26:case 5:Cr(a,l),i===null&&p&4&&bb(l),p&512&&Fo(l,l.return);break;case 12:Cr(a,l);break;case 31:Cr(a,l),p&4&&Nb(a,l);break;case 13:Cr(a,l),p&4&&Eb(a,l),p&64&&(a=l.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(l=yE.bind(null,l),IE(a,l))));break;case 22:if(p=l.memoizedState!==null||Sr,!p){i=i!==null&&i.memoizedState!==null||rn,v=Sr;var b=rn;Sr=p,(rn=i)&&!b?Nr(a,l,(l.subtreeFlags&8772)!==0):Cr(a,l),Sr=v,rn=b}break;case 30:break;default:Cr(a,l)}}function jb(a){var i=a.alternate;i!==null&&(a.alternate=null,jb(i)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(i=a.stateNode,i!==null&&Hr(i)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}var $t=null,$n=!1;function jr(a,i,l){for(l=l.child;l!==null;)Cb(a,i,l),l=l.sibling}function Cb(a,i,l){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(Ce,l)}catch{}switch(l.tag){case 26:rn||Za(l,i),jr(a,i,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:rn||Za(l,i);var p=$t,v=$n;oi(l.type)&&($t=l.stateNode,$n=!1),jr(a,i,l),Ko(l.stateNode),$t=p,$n=v;break;case 5:rn||Za(l,i);case 6:if(p=$t,v=$n,$t=null,jr(a,i,l),$t=p,$n=v,$t!==null)if($n)try{($t.nodeType===9?$t.body:$t.nodeName==="HTML"?$t.ownerDocument.body:$t).removeChild(l.stateNode)}catch(b){wt(l,i,b)}else try{$t.removeChild(l.stateNode)}catch(b){wt(l,i,b)}break;case 18:$t!==null&&($n?(a=$t,v0(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,l.stateNode),Ps(a)):v0($t,l.stateNode));break;case 4:p=$t,v=$n,$t=l.stateNode.containerInfo,$n=!0,jr(a,i,l),$t=p,$n=v;break;case 0:case 11:case 14:case 15:ei(2,l,i),rn||ei(4,l,i),jr(a,i,l);break;case 1:rn||(Za(l,i),p=l.stateNode,typeof p.componentWillUnmount=="function"&&yb(l,i,p)),jr(a,i,l);break;case 21:jr(a,i,l);break;case 22:rn=(p=rn)||l.memoizedState!==null,jr(a,i,l),rn=p;break;default:jr(a,i,l)}}function Nb(a,i){if(i.memoizedState===null&&(a=i.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{Ps(a)}catch(l){wt(i,i.return,l)}}}function Eb(a,i){if(i.memoizedState===null&&(a=i.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{Ps(a)}catch(l){wt(i,i.return,l)}}function uE(a){switch(a.tag){case 31:case 13:case 19:var i=a.stateNode;return i===null&&(i=a.stateNode=new kb),i;case 22:return a=a.stateNode,i=a._retryCache,i===null&&(i=a._retryCache=new kb),i;default:throw Error(r(435,a.tag))}}function Mc(a,i){var l=uE(a);i.forEach(function(p){if(!l.has(p)){l.add(p);var v=bE.bind(null,a,p);p.then(v,v)}})}function In(a,i){var l=i.deletions;if(l!==null)for(var p=0;p<l.length;p++){var v=l[p],b=a,C=i,M=C;e:for(;M!==null;){switch(M.tag){case 27:if(oi(M.type)){$t=M.stateNode,$n=!1;break e}break;case 5:$t=M.stateNode,$n=!1;break e;case 3:case 4:$t=M.stateNode.containerInfo,$n=!0;break e}M=M.return}if($t===null)throw Error(r(160));Cb(b,C,v),$t=null,$n=!1,b=v.alternate,b!==null&&(b.return=null),v.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Tb(i,a),i=i.sibling}var _a=null;function Tb(a,i){var l=a.alternate,p=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:In(i,a),Pn(a),p&4&&(ei(3,a,a.return),Bo(3,a),ei(5,a,a.return));break;case 1:In(i,a),Pn(a),p&512&&(rn||l===null||Za(l,l.return)),p&64&&Sr&&(a=a.updateQueue,a!==null&&(p=a.callbacks,p!==null&&(l=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=l===null?p:l.concat(p))));break;case 26:var v=_a;if(In(i,a),Pn(a),p&512&&(rn||l===null||Za(l,l.return)),p&4){var b=l!==null?l.memoizedState:null;if(p=a.memoizedState,l===null)if(p===null)if(a.stateNode===null){e:{p=a.type,l=a.memoizedProps,v=v.ownerDocument||v;t:switch(p){case"title":b=v.getElementsByTagName("title")[0],(!b||b[Aa]||b[Ht]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=v.createElement(p),v.head.insertBefore(b,v.querySelector("head > title"))),kn(b,p,l),b[Ht]=a,Ot(b),p=b;break e;case"link":var C=T0("link","href",v).get(p+(l.href||""));if(C){for(var M=0;M<C.length;M++)if(b=C[M],b.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&b.getAttribute("rel")===(l.rel==null?null:l.rel)&&b.getAttribute("title")===(l.title==null?null:l.title)&&b.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){C.splice(M,1);break t}}b=v.createElement(p),kn(b,p,l),v.head.appendChild(b);break;case"meta":if(C=T0("meta","content",v).get(p+(l.content||""))){for(M=0;M<C.length;M++)if(b=C[M],b.getAttribute("content")===(l.content==null?null:""+l.content)&&b.getAttribute("name")===(l.name==null?null:l.name)&&b.getAttribute("property")===(l.property==null?null:l.property)&&b.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&b.getAttribute("charset")===(l.charSet==null?null:l.charSet)){C.splice(M,1);break t}}b=v.createElement(p),kn(b,p,l),v.head.appendChild(b);break;default:throw Error(r(468,p))}b[Ht]=a,Ot(b),p=b}a.stateNode=p}else A0(v,a.type,a.stateNode);else a.stateNode=E0(v,p,a.memoizedProps);else b!==p?(b===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):b.count--,p===null?A0(v,a.type,a.stateNode):E0(v,p,a.memoizedProps)):p===null&&a.stateNode!==null&&nf(a,a.memoizedProps,l.memoizedProps)}break;case 27:In(i,a),Pn(a),p&512&&(rn||l===null||Za(l,l.return)),l!==null&&p&4&&nf(a,a.memoizedProps,l.memoizedProps);break;case 5:if(In(i,a),Pn(a),p&512&&(rn||l===null||Za(l,l.return)),a.flags&32){v=a.stateNode;try{ls(v,"")}catch(Ae){wt(a,a.return,Ae)}}p&4&&a.stateNode!=null&&(v=a.memoizedProps,nf(a,v,l!==null?l.memoizedProps:v)),p&1024&&(sf=!0);break;case 6:if(In(i,a),Pn(a),p&4){if(a.stateNode===null)throw Error(r(162));p=a.memoizedProps,l=a.stateNode;try{l.nodeValue=p}catch(Ae){wt(a,a.return,Ae)}}break;case 3:if(Kc=null,v=_a,_a=Yc(i.containerInfo),In(i,a),_a=v,Pn(a),p&4&&l!==null&&l.memoizedState.isDehydrated)try{Ps(i.containerInfo)}catch(Ae){wt(a,a.return,Ae)}sf&&(sf=!1,Ab(a));break;case 4:p=_a,_a=Yc(a.stateNode.containerInfo),In(i,a),Pn(a),_a=p;break;case 12:In(i,a),Pn(a);break;case 31:In(i,a),Pn(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Mc(a,p)));break;case 13:In(i,a),Pn(a),a.child.flags&8192&&a.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&($c=dt()),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Mc(a,p)));break;case 22:v=a.memoizedState!==null;var Y=l!==null&&l.memoizedState!==null,re=Sr,pe=rn;if(Sr=re||v,rn=pe||Y,In(i,a),rn=pe,Sr=re,Pn(a),p&8192)e:for(i=a.stateNode,i._visibility=v?i._visibility&-2:i._visibility|1,v&&(l===null||Y||Sr||rn||Di(a)),l=null,i=a;;){if(i.tag===5||i.tag===26){if(l===null){Y=l=i;try{if(b=Y.stateNode,v)C=b.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(Ae){wt(Y,Y.return,Ae)}}}else if(i.tag===6){if(l===null){Y=i;try{Y.stateNode.nodeValue=v?"":Y.memoizedProps}catch(Ae){wt(Y,Y.return,Ae)}}}else if(i.tag===18){if(l===null){Y=i;try{var oe=Y.stateNode;v?y0(oe,!0):y0(Y.stateNode,!1)}catch(Ae){wt(Y,Y.return,Ae)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===a)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;l===i&&(l=null),i=i.return}l===i&&(l=null),i.sibling.return=i.return,i=i.sibling}p&4&&(p=a.updateQueue,p!==null&&(l=p.retryQueue,l!==null&&(p.retryQueue=null,Mc(a,l))));break;case 19:In(i,a),Pn(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Mc(a,p)));break;case 30:break;case 21:break;default:In(i,a),Pn(a)}}function Pn(a){var i=a.flags;if(i&2){try{for(var l,p=a.return;p!==null;){if(xb(p)){l=p;break}p=p.return}if(l==null)throw Error(r(160));switch(l.tag){case 27:var v=l.stateNode,b=af(a);zc(a,b,v);break;case 5:var C=l.stateNode;l.flags&32&&(ls(C,""),l.flags&=-33);var M=af(a);zc(a,M,C);break;case 3:case 4:var Y=l.stateNode.containerInfo,re=af(a);rf(a,re,Y);break;default:throw Error(r(161))}}catch(pe){wt(a,a.return,pe)}a.flags&=-3}i&4096&&(a.flags&=-4097)}function Ab(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var i=a;Ab(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),a=a.sibling}}function Cr(a,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Sb(a,i.alternate,i),i=i.sibling}function Di(a){for(a=a.child;a!==null;){var i=a;switch(i.tag){case 0:case 11:case 14:case 15:ei(4,i,i.return),Di(i);break;case 1:Za(i,i.return);var l=i.stateNode;typeof l.componentWillUnmount=="function"&&yb(i,i.return,l),Di(i);break;case 27:Ko(i.stateNode);case 26:case 5:Za(i,i.return),Di(i);break;case 22:i.memoizedState===null&&Di(i);break;case 30:Di(i);break;default:Di(i)}a=a.sibling}}function Nr(a,i,l){for(l=l&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var p=i.alternate,v=a,b=i,C=b.flags;switch(b.tag){case 0:case 11:case 15:Nr(v,b,l),Bo(4,b);break;case 1:if(Nr(v,b,l),p=b,v=p.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(re){wt(p,p.return,re)}if(p=b,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++)sy(Y[v],M)}catch(re){wt(p,p.return,re)}}l&&C&64&&vb(b),Fo(b,b.return);break;case 27:wb(b);case 26:case 5:Nr(v,b,l),l&&p===null&&C&4&&bb(b),Fo(b,b.return);break;case 12:Nr(v,b,l);break;case 31:Nr(v,b,l),l&&C&4&&Nb(v,b);break;case 13:Nr(v,b,l),l&&C&4&&Eb(v,b);break;case 22:b.memoizedState===null&&Nr(v,b,l),Fo(b,b.return);break;case 30:break;default:Nr(v,b,l)}i=i.sibling}}function of(a,i){var l=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(l=a.memoizedState.cachePool.pool),a=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),a!==l&&(a!=null&&a.refCount++,l!=null&&To(l))}function lf(a,i){a=null,i.alternate!==null&&(a=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==a&&(i.refCount++,a!=null&&To(a))}function Oa(a,i,l,p){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Rb(a,i,l,p),i=i.sibling}function Rb(a,i,l,p){var v=i.flags;switch(i.tag){case 0:case 11:case 15:Oa(a,i,l,p),v&2048&&Bo(9,i);break;case 1:Oa(a,i,l,p);break;case 3:Oa(a,i,l,p),v&2048&&(a=null,i.alternate!==null&&(a=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==a&&(i.refCount++,a!=null&&To(a)));break;case 12:if(v&2048){Oa(a,i,l,p),a=i.stateNode;try{var b=i.memoizedProps,C=b.id,M=b.onPostCommit;typeof M=="function"&&M(C,i.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(Y){wt(i,i.return,Y)}}else Oa(a,i,l,p);break;case 31:Oa(a,i,l,p);break;case 13:Oa(a,i,l,p);break;case 23:break;case 22:b=i.stateNode,C=i.alternate,i.memoizedState!==null?b._visibility&2?Oa(a,i,l,p):Ho(a,i):b._visibility&2?Oa(a,i,l,p):(b._visibility|=2,Ts(a,i,l,p,(i.subtreeFlags&10256)!==0||!1)),v&2048&&of(C,i);break;case 24:Oa(a,i,l,p),v&2048&&lf(i.alternate,i);break;default:Oa(a,i,l,p)}}function Ts(a,i,l,p,v){for(v=v&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var b=a,C=i,M=l,Y=p,re=C.flags;switch(C.tag){case 0:case 11:case 15:Ts(b,C,M,Y,v),Bo(8,C);break;case 23:break;case 22:var pe=C.stateNode;C.memoizedState!==null?pe._visibility&2?Ts(b,C,M,Y,v):Ho(b,C):(pe._visibility|=2,Ts(b,C,M,Y,v)),v&&re&2048&&of(C.alternate,C);break;case 24:Ts(b,C,M,Y,v),v&&re&2048&&lf(C.alternate,C);break;default:Ts(b,C,M,Y,v)}i=i.sibling}}function Ho(a,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var l=a,p=i,v=p.flags;switch(p.tag){case 22:Ho(l,p),v&2048&&of(p.alternate,p);break;case 24:Ho(l,p),v&2048&&lf(p.alternate,p);break;default:Ho(l,p)}i=i.sibling}}var qo=8192;function As(a,i,l){if(a.subtreeFlags&qo)for(a=a.child;a!==null;)_b(a,i,l),a=a.sibling}function _b(a,i,l){switch(a.tag){case 26:As(a,i,l),a.flags&qo&&a.memoizedState!==null&&QE(l,_a,a.memoizedState,a.memoizedProps);break;case 5:As(a,i,l);break;case 3:case 4:var p=_a;_a=Yc(a.stateNode.containerInfo),As(a,i,l),_a=p;break;case 22:a.memoizedState===null&&(p=a.alternate,p!==null&&p.memoizedState!==null?(p=qo,qo=16777216,As(a,i,l),qo=p):As(a,i,l));break;default:As(a,i,l)}}function Ob(a){var i=a.alternate;if(i!==null&&(a=i.child,a!==null)){i.child=null;do i=a.sibling,a.sibling=null,a=i;while(a!==null)}}function Go(a){var i=a.deletions;if((a.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var p=i[l];gn=p,zb(p,a)}Ob(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Lb(a),a=a.sibling}function Lb(a){switch(a.tag){case 0:case 11:case 15:Go(a),a.flags&2048&&ei(9,a,a.return);break;case 3:Go(a);break;case 12:Go(a);break;case 22:var i=a.stateNode;a.memoizedState!==null&&i._visibility&2&&(a.return===null||a.return.tag!==13)?(i._visibility&=-3,Dc(a)):Go(a);break;default:Go(a)}}function Dc(a){var i=a.deletions;if((a.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var p=i[l];gn=p,zb(p,a)}Ob(a)}for(a=a.child;a!==null;){switch(i=a,i.tag){case 0:case 11:case 15:ei(8,i,i.return),Dc(i);break;case 22:l=i.stateNode,l._visibility&2&&(l._visibility&=-3,Dc(i));break;default:Dc(i)}a=a.sibling}}function zb(a,i){for(;gn!==null;){var l=gn;switch(l.tag){case 0:case 11:case 15:ei(8,l,i);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var p=l.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:To(l.memoizedState.cache)}if(p=l.child,p!==null)p.return=l,gn=p;else e:for(l=a;gn!==null;){p=gn;var v=p.sibling,b=p.return;if(jb(p),p===l){gn=null;break e}if(v!==null){v.return=b,gn=v;break e}gn=b}}}var dE={getCacheForType:function(a){var i=xn(tn),l=i.data.get(a);return l===void 0&&(l=a(),i.data.set(a,l)),l},cacheSignal:function(){return xn(tn).controller.signal}},pE=typeof WeakMap=="function"?WeakMap:Map,yt=0,Nt=null,nt=null,st=0,xt=0,Xn=null,ti=!1,Rs=!1,cf=!1,Er=0,Yt=0,ni=0,$i=0,uf=0,Jn=0,_s=0,Vo=null,Un=null,df=!1,$c=0,Mb=0,Ic=1/0,Pc=null,ai=null,un=0,ri=null,Os=null,Tr=0,pf=0,ff=null,Db=null,Wo=0,hf=null;function ea(){return(yt&2)!==0&&st!==0?st&-st:F.T!==null?xf():Ye()}function $b(){if(Jn===0)if((st&536870912)===0||ut){var a=Ur;Ur<<=1,(Ur&3932160)===0&&(Ur=262144),Jn=a}else Jn=536870912;return a=Qn.current,a!==null&&(a.flags|=32),Jn}function Bn(a,i,l){(a===Nt&&(xt===2||xt===9)||a.cancelPendingCommit!==null)&&(Ls(a,0),ii(a,st,Jn,!1)),ge(a,l),((yt&2)===0||a!==Nt)&&(a===Nt&&((yt&2)===0&&($i|=l),Yt===4&&ii(a,st,Jn,!1)),Ya(a))}function Ib(a,i,l){if((yt&6)!==0)throw Error(r(327));var p=!l&&(i&127)===0&&(i&a.expiredLanes)===0||or(a,i),v=p?mE(a,i):gf(a,i,!0),b=p;do{if(v===0){Rs&&!p&&ii(a,i,0,!1);break}else{if(l=a.current.alternate,b&&!fE(l)){v=gf(a,i,!1),b=!1;continue}if(v===2){if(b=i,a.errorRecoveryDisabledLanes&b)var C=0;else C=a.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){i=C;e:{var M=a;v=Vo;var Y=M.current.memoizedState.isDehydrated;if(Y&&(Ls(M,C).flags|=256),C=gf(M,C,!1),C!==2){if(cf&&!Y){M.errorRecoveryDisabledLanes|=b,$i|=b,v=4;break e}b=Un,Un=v,b!==null&&(Un===null?Un=b:Un.push.apply(Un,b))}v=C}if(b=!1,v!==2)continue}}if(v===1){Ls(a,0),ii(a,i,0,!0);break}e:{switch(p=a,b=v,b){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:ii(p,i,Jn,!ti);break e;case 2:Un=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(v=$c+300-dt(),10<v)){if(ii(p,i,Jn,!ti),qa(p,0,!0)!==0)break e;Tr=i,p.timeoutHandle=m0(Pb.bind(null,p,l,Un,Pc,df,i,Jn,$i,_s,ti,b,"Throttled",-0,0),v);break e}Pb(p,l,Un,Pc,df,i,Jn,$i,_s,ti,b,null,-0,0)}}break}while(!0);Ya(a)}function Pb(a,i,l,p,v,b,C,M,Y,re,pe,me,se,oe){if(a.timeoutHandle=-1,me=i.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:fr},_b(i,b,me);var Ae=(b&62914560)===b?$c-dt():(b&4194048)===b?Mb-dt():0;if(Ae=KE(me,Ae),Ae!==null){Tr=b,a.cancelPendingCommit=Ae(Wb.bind(null,a,i,b,l,p,v,C,M,Y,pe,me,null,se,oe)),ii(a,b,C,!re);return}}Wb(a,i,b,l,p,v,C,M,Y)}function fE(a){for(var i=a;;){var l=i.tag;if((l===0||l===11||l===15)&&i.flags&16384&&(l=i.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var p=0;p<l.length;p++){var v=l[p],b=v.getSnapshot;v=v.value;try{if(!Zn(b(),v))return!1}catch{return!1}}if(l=i.child,i.subtreeFlags&16384&&l!==null)l.return=i,i=l;else{if(i===a)break;for(;i.sibling===null;){if(i.return===null||i.return===a)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function ii(a,i,l,p){i&=~uf,i&=~$i,a.suspendedLanes|=i,a.pingedLanes&=~i,p&&(a.warmLanes|=i),p=a.expirationTimes;for(var v=i;0<v;){var b=31-Ne(v),C=1<<b;p[b]=-1,v&=~C}l!==0&&de(a,l,i)}function Uc(){return(yt&6)===0?(Zo(0),!1):!0}function mf(){if(nt!==null){if(xt===0)var a=nt.return;else a=nt,vr=Ti=null,Rp(a),Ss=null,Ro=0,a=nt;for(;a!==null;)gb(a.alternate,a),a=a.return;nt=null}}function Ls(a,i){var l=a.timeoutHandle;l!==-1&&(a.timeoutHandle=-1,LE(l)),l=a.cancelPendingCommit,l!==null&&(a.cancelPendingCommit=null,l()),Tr=0,mf(),Nt=a,nt=l=mr(a.current,null),st=i,xt=0,Xn=null,ti=!1,Rs=or(a,i),cf=!1,_s=Jn=uf=$i=ni=Yt=0,Un=Vo=null,df=!1,(i&8)!==0&&(i|=i&32);var p=a.entangledLanes;if(p!==0)for(a=a.entanglements,p&=i;0<p;){var v=31-Ne(p),b=1<<v;i|=a[v],p&=~b}return Er=i,oc(),l}function Ub(a,i){Qe=null,F.H=Io,i===ks||i===mc?(i=ny(),xt=3):i===yp?(i=ny(),xt=4):xt=i===Vp?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Xn=i,nt===null&&(Yt=1,Ac(a,va(i,a.current)))}function Bb(){var a=Qn.current;return a===null?!0:(st&4194048)===st?wa===null:(st&62914560)===st||(st&536870912)!==0?a===wa:!1}function Fb(){var a=F.H;return F.H=Io,a===null?Io:a}function Hb(){var a=F.A;return F.A=dE,a}function Bc(){Yt=4,ti||(st&4194048)!==st&&Qn.current!==null||(Rs=!0),(ni&134217727)===0&&($i&134217727)===0||Nt===null||ii(Nt,st,Jn,!1)}function gf(a,i,l){var p=yt;yt|=2;var v=Fb(),b=Hb();(Nt!==a||st!==i)&&(Pc=null,Ls(a,i)),i=!1;var C=Yt;e:do try{if(xt!==0&&nt!==null){var M=nt,Y=Xn;switch(xt){case 8:mf(),C=6;break e;case 3:case 2:case 9:case 6:Qn.current===null&&(i=!0);var re=xt;if(xt=0,Xn=null,zs(a,M,Y,re),l&&Rs){C=0;break e}break;default:re=xt,xt=0,Xn=null,zs(a,M,Y,re)}}hE(),C=Yt;break}catch(pe){Ub(a,pe)}while(!0);return i&&a.shellSuspendCounter++,vr=Ti=null,yt=p,F.H=v,F.A=b,nt===null&&(Nt=null,st=0,oc()),C}function hE(){for(;nt!==null;)qb(nt)}function mE(a,i){var l=yt;yt|=2;var p=Fb(),v=Hb();Nt!==a||st!==i?(Pc=null,Ic=dt()+500,Ls(a,i)):Rs=or(a,i);e:do try{if(xt!==0&&nt!==null){i=nt;var b=Xn;t:switch(xt){case 1:xt=0,Xn=null,zs(a,i,b,1);break;case 2:case 9:if(ey(b)){xt=0,Xn=null,Gb(i);break}i=function(){xt!==2&&xt!==9||Nt!==a||(xt=7),Ya(a)},b.then(i,i);break e;case 3:xt=7;break e;case 4:xt=5;break e;case 7:ey(b)?(xt=0,Xn=null,Gb(i)):(xt=0,Xn=null,zs(a,i,b,7));break;case 5:var C=null;switch(nt.tag){case 26:C=nt.memoizedState;case 5:case 27:var M=nt;if(C?R0(C):M.stateNode.complete){xt=0,Xn=null;var Y=M.sibling;if(Y!==null)nt=Y;else{var re=M.return;re!==null?(nt=re,Fc(re)):nt=null}break t}}xt=0,Xn=null,zs(a,i,b,5);break;case 6:xt=0,Xn=null,zs(a,i,b,6);break;case 8:mf(),Yt=6;break e;default:throw Error(r(462))}}gE();break}catch(pe){Ub(a,pe)}while(!0);return vr=Ti=null,F.H=p,F.A=v,yt=l,nt!==null?0:(Nt=null,st=0,oc(),Yt)}function gE(){for(;nt!==null&&!Qt();)qb(nt)}function qb(a){var i=hb(a.alternate,a,Er);a.memoizedProps=a.pendingProps,i===null?Fc(a):nt=i}function Gb(a){var i=a,l=i.alternate;switch(i.tag){case 15:case 0:i=lb(l,i,i.pendingProps,i.type,void 0,st);break;case 11:i=lb(l,i,i.pendingProps,i.type.render,i.ref,st);break;case 5:Rp(i);default:gb(l,i),i=nt=Hv(i,Er),i=hb(l,i,Er)}a.memoizedProps=a.pendingProps,i===null?Fc(a):nt=i}function zs(a,i,l,p){vr=Ti=null,Rp(i),Ss=null,Ro=0;var v=i.return;try{if(rE(a,v,i,l,st)){Yt=1,Ac(a,va(l,a.current)),nt=null;return}}catch(b){if(v!==null)throw nt=v,b;Yt=1,Ac(a,va(l,a.current)),nt=null;return}i.flags&32768?(ut||p===1?a=!0:Rs||(st&536870912)!==0?a=!1:(ti=a=!0,(p===2||p===9||p===3||p===6)&&(p=Qn.current,p!==null&&p.tag===13&&(p.flags|=16384))),Vb(i,a)):Fc(i)}function Fc(a){var i=a;do{if((i.flags&32768)!==0){Vb(i,ti);return}a=i.return;var l=oE(i.alternate,i,Er);if(l!==null){nt=l;return}if(i=i.sibling,i!==null){nt=i;return}nt=i=a}while(i!==null);Yt===0&&(Yt=5)}function Vb(a,i){do{var l=lE(a.alternate,a);if(l!==null){l.flags&=32767,nt=l;return}if(l=a.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!i&&(a=a.sibling,a!==null)){nt=a;return}nt=a=l}while(a!==null);Yt=6,nt=null}function Wb(a,i,l,p,v,b,C,M,Y){a.cancelPendingCommit=null;do Hc();while(un!==0);if((yt&6)!==0)throw Error(r(327));if(i!==null){if(i===a.current)throw Error(r(177));if(b=i.lanes|i.childLanes,b|=ap,ze(a,l,b,C,M,Y),a===Nt&&(nt=Nt=null,st=0),Os=i,ri=a,Tr=l,pf=b,ff=v,Db=p,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,xE(ee,function(){return Xb(),null})):(a.callbackNode=null,a.callbackPriority=0),p=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||p){p=F.T,F.T=null,v=V.p,V.p=2,C=yt,yt|=4;try{cE(a,i,l)}finally{yt=C,V.p=v,F.T=p}}un=1,Zb(),Yb(),Qb()}}function Zb(){if(un===1){un=0;var a=ri,i=Os,l=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||l){l=F.T,F.T=null;var p=V.p;V.p=2;var v=yt;yt|=4;try{Tb(i,a);var b=Tf,C=zv(a.containerInfo),M=b.focusedElem,Y=b.selectionRange;if(C!==M&&M&&M.ownerDocument&&Lv(M.ownerDocument.documentElement,M)){if(Y!==null&&Xd(M)){var re=Y.start,pe=Y.end;if(pe===void 0&&(pe=re),"selectionStart"in M)M.selectionStart=re,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(),Ae=M.textContent.length,Be=Math.min(Y.start,Ae),jt=Y.end===void 0?Be:Math.min(Y.end,Ae);!oe.extend&&Be>jt&&(C=jt,jt=Be,Be=C);var te=Ov(M,Be),J=Ov(M,jt);if(te&&J&&(oe.rangeCount!==1||oe.anchorNode!==te.node||oe.anchorOffset!==te.offset||oe.focusNode!==J.node||oe.focusOffset!==J.offset)){var ae=me.createRange();ae.setStart(te.node,te.offset),oe.removeAllRanges(),Be>jt?(oe.addRange(ae),oe.extend(J.node,J.offset)):(ae.setEnd(J.node,J.offset),oe.addRange(ae))}}}}for(me=[],oe=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}}tu=!!Ef,Tf=Ef=null}finally{yt=v,V.p=p,F.T=l}}a.current=i,un=2}}function Yb(){if(un===2){un=0;var a=ri,i=Os,l=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||l){l=F.T,F.T=null;var p=V.p;V.p=2;var v=yt;yt|=4;try{Sb(a,i.alternate,i)}finally{yt=v,V.p=p,F.T=l}}un=3}}function Qb(){if(un===4||un===3){un=0,Ft();var a=ri,i=Os,l=Tr,p=Db;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?un=5:(un=0,Os=ri=null,Kb(a,a.pendingLanes));var v=a.pendingLanes;if(v===0&&(ai=null),Je(l),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=F.T,v=V.p,V.p=2,F.T=null;try{for(var b=a.onRecoverableError,C=0;C<p.length;C++){var M=p[C];b(M.value,{componentStack:M.stack})}}finally{F.T=i,V.p=v}}(Tr&3)!==0&&Hc(),Ya(a),v=a.pendingLanes,(l&261930)!==0&&(v&42)!==0?a===hf?Wo++:(Wo=0,hf=a):Wo=0,Zo(0)}}function Kb(a,i){(a.pooledCacheLanes&=i)===0&&(i=a.pooledCache,i!=null&&(a.pooledCache=null,To(i)))}function Hc(){return Zb(),Yb(),Qb(),Xb()}function Xb(){if(un!==5)return!1;var a=ri,i=pf;pf=0;var l=Je(Tr),p=F.T,v=V.p;try{V.p=32>l?32:l,F.T=null,l=ff,ff=null;var b=ri,C=Tr;if(un=0,Os=ri=null,Tr=0,(yt&6)!==0)throw Error(r(331));var M=yt;if(yt|=4,Lb(b.current),Rb(b,b.current,C,l),yt=M,Zo(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(Ce,b)}catch{}return!0}finally{V.p=v,F.T=p,Kb(a,i)}}function Jb(a,i,l){i=va(l,i),i=Gp(a.stateNode,i,2),a=Kr(a,i,2),a!==null&&(ge(a,2),Ya(a))}function wt(a,i,l){if(a.tag===3)Jb(a,a,l);else for(;i!==null;){if(i.tag===3){Jb(i,a,l);break}else if(i.tag===1){var p=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(ai===null||!ai.has(p))){a=va(l,a),l=eb(2),p=Kr(i,l,2),p!==null&&(tb(l,p,i,a),ge(p,2),Ya(p));break}}i=i.return}}function vf(a,i,l){var p=a.pingCache;if(p===null){p=a.pingCache=new pE;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(l)||(cf=!0,v.add(l),a=vE.bind(null,a,i,l),i.then(a,a))}function vE(a,i,l){var p=a.pingCache;p!==null&&p.delete(i),a.pingedLanes|=a.suspendedLanes&l,a.warmLanes&=~l,Nt===a&&(st&l)===l&&(Yt===4||Yt===3&&(st&62914560)===st&&300>dt()-$c?(yt&2)===0&&Ls(a,0):uf|=l,_s===st&&(_s=0)),Ya(a)}function e0(a,i){i===0&&(i=Fr()),a=Ci(a,i),a!==null&&(ge(a,i),Ya(a))}function yE(a){var i=a.memoizedState,l=0;i!==null&&(l=i.retryLane),e0(a,l)}function bE(a,i){var l=0;switch(a.tag){case 31:case 13:var p=a.stateNode,v=a.memoizedState;v!==null&&(l=v.retryLane);break;case 19:p=a.stateNode;break;case 22:p=a.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(i),e0(a,l)}function xE(a,i){return _t(a,i)}var qc=null,Ms=null,yf=!1,Gc=!1,bf=!1,si=0;function Ya(a){a!==Ms&&a.next===null&&(Ms===null?qc=Ms=a:Ms=Ms.next=a),Gc=!0,yf||(yf=!0,kE())}function Zo(a,i){if(!bf&&Gc){bf=!0;do for(var l=!1,p=qc;p!==null;){if(a!==0){var v=p.pendingLanes;if(v===0)var b=0;else{var C=p.suspendedLanes,M=p.pingedLanes;b=(1<<31-Ne(42|a)+1)-1,b&=v&~(C&~M),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(l=!0,r0(p,b))}else b=st,b=qa(p,p===Nt?b:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(b&3)===0||or(p,b)||(l=!0,r0(p,b));p=p.next}while(l);bf=!1}}function wE(){t0()}function t0(){Gc=yf=!1;var a=0;si!==0&&OE()&&(a=si);for(var i=dt(),l=null,p=qc;p!==null;){var v=p.next,b=n0(p,i);b===0?(p.next=null,l===null?qc=v:l.next=v,v===null&&(Ms=l)):(l=p,(a!==0||(b&3)!==0)&&(Gc=!0)),p=v}un!==0&&un!==5||Zo(a),si!==0&&(si=0)}function n0(a,i){for(var l=a.suspendedLanes,p=a.pingedLanes,v=a.expirationTimes,b=a.pendingLanes&-62914561;0<b;){var C=31-Ne(b),M=1<<C,Y=v[C];Y===-1?((M&l)===0||(M&p)!==0)&&(v[C]=Zl(M,i)):Y<=i&&(a.expiredLanes|=M),b&=~M}if(i=Nt,l=st,l=qa(a,a===i?l:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p=a.callbackNode,l===0||a===i&&(xt===2||xt===9)||a.cancelPendingCommit!==null)return p!==null&&p!==null&&Dt(p),a.callbackNode=null,a.callbackPriority=0;if((l&3)===0||or(a,l)){if(i=l&-l,i===a.callbackPriority)return i;switch(p!==null&&Dt(p),Je(l)){case 2:case 8:l=Z;break;case 32:l=ee;break;case 268435456:l=he;break;default:l=ee}return p=a0.bind(null,a),l=_t(l,p),a.callbackPriority=i,a.callbackNode=l,i}return p!==null&&p!==null&&Dt(p),a.callbackPriority=2,a.callbackNode=null,2}function a0(a,i){if(un!==0&&un!==5)return a.callbackNode=null,a.callbackPriority=0,null;var l=a.callbackNode;if(Hc()&&a.callbackNode!==l)return null;var p=st;return p=qa(a,a===Nt?p:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p===0?null:(Ib(a,p,i),n0(a,dt()),a.callbackNode!=null&&a.callbackNode===l?a0.bind(null,a):null)}function r0(a,i){if(Hc())return null;Ib(a,i,!0)}function kE(){zE(function(){(yt&6)!==0?_t(K,wE):t0()})}function xf(){if(si===0){var a=xs;a===0&&(a=la,la<<=1,(la&261888)===0&&(la=256)),si=a}return si}function i0(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:Jl(""+a)}function s0(a,i){var l=i.ownerDocument.createElement("input");return l.name=i.name,l.value=i.value,a.id&&l.setAttribute("form",a.id),i.parentNode.insertBefore(l,i),a=new FormData(a),l.parentNode.removeChild(l),a}function SE(a,i,l,p,v){if(i==="submit"&&l&&l.stateNode===v){var b=i0((v[cn]||null).action),C=p.submitter;C&&(i=(i=C[cn]||null)?i0(i.formAction):C.getAttribute("formAction"),i!==null&&(b=i,C=null));var M=new ac("action","action",null,p,v);a.push({event:M,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(si!==0){var Y=C?s0(v,C):new FormData(v);Pp(l,{pending:!0,data:Y,method:v.method,action:b},null,Y)}}else typeof b=="function"&&(M.preventDefault(),Y=C?s0(v,C):new FormData(v),Pp(l,{pending:!0,data:Y,method:v.method,action:b},b,Y))},currentTarget:v}]})}}for(var wf=0;wf<np.length;wf++){var kf=np[wf],jE=kf.toLowerCase(),CE=kf[0].toUpperCase()+kf.slice(1);Ra(jE,"on"+CE)}Ra($v,"onAnimationEnd"),Ra(Iv,"onAnimationIteration"),Ra(Pv,"onAnimationStart"),Ra("dblclick","onDoubleClick"),Ra("focusin","onFocus"),Ra("focusout","onBlur"),Ra(BN,"onTransitionRun"),Ra(FN,"onTransitionStart"),Ra(HN,"onTransitionCancel"),Ra(Uv,"onTransitionEnd"),dr("onMouseEnter",["mouseout","mouseover"]),dr("onMouseLeave",["mouseout","mouseover"]),dr("onPointerEnter",["pointerout","pointerover"]),dr("onPointerLeave",["pointerout","pointerover"]),pa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),pa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),pa("onBeforeInput",["compositionend","keypress","textInput","paste"]),pa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),pa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),pa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yo="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(" "),NE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Yo));function o0(a,i){i=(i&4)!==0;for(var l=0;l<a.length;l++){var p=a[l],v=p.event;p=p.listeners;e:{var b=void 0;if(i)for(var C=p.length-1;0<=C;C--){var M=p[C],Y=M.instance,re=M.currentTarget;if(M=M.listener,Y!==b&&v.isPropagationStopped())break e;b=M,v.currentTarget=re;try{b(v)}catch(pe){sc(pe)}v.currentTarget=null,b=Y}else for(C=0;C<p.length;C++){if(M=p[C],Y=M.instance,re=M.currentTarget,M=M.listener,Y!==b&&v.isPropagationStopped())break e;b=M,v.currentTarget=re;try{b(v)}catch(pe){sc(pe)}v.currentTarget=null,b=Y}}}}function at(a,i){var l=i[cr];l===void 0&&(l=i[cr]=new Set);var p=a+"__bubble";l.has(p)||(l0(i,a,2,!1),l.add(p))}function Sf(a,i,l){var p=0;i&&(p|=4),l0(l,a,p,i)}var Vc="_reactListening"+Math.random().toString(36).slice(2);function jf(a){if(!a[Vc]){a[Vc]=!0,go.forEach(function(l){l!=="selectionchange"&&(NE.has(l)||Sf(l,!1,a),Sf(l,!0,a))});var i=a.nodeType===9?a:a.ownerDocument;i===null||i[Vc]||(i[Vc]=!0,Sf("selectionchange",!1,i))}}function l0(a,i,l,p){switch($0(i)){case 2:var v=eT;break;case 8:v=tT;break;default:v=Pf}l=v.bind(null,i,l,a),v=void 0,!Hd||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(v=!0),p?v!==void 0?a.addEventListener(i,l,{capture:!0,passive:v}):a.addEventListener(i,l,!0):v!==void 0?a.addEventListener(i,l,{passive:v}):a.addEventListener(i,l,!1)}function Cf(a,i,l,p,v){var b=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=mn(M),C===null)return;if(Y=C.tag,Y===5||Y===6||Y===26||Y===27){p=b=C;continue e}M=M.parentNode}}p=p.return}fv(function(){var re=b,pe=Bd(l),me=[];e:{var se=Bv.get(a);if(se!==void 0){var oe=ac,Ae=a;switch(a){case"keypress":if(tc(l)===0)break e;case"keydown":case"keyup":oe=bN;break;case"focusin":Ae="focus",oe=Wd;break;case"focusout":Ae="blur",oe=Wd;break;case"beforeblur":case"afterblur":oe=Wd;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=gv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=oN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=kN;break;case $v:case Iv:case Pv:oe=uN;break;case Uv:oe=jN;break;case"scroll":case"scrollend":oe=iN;break;case"wheel":oe=NN;break;case"copy":case"cut":case"paste":oe=pN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=yv;break;case"toggle":case"beforetoggle":oe=TN}var Be=(i&4)!==0,jt=!Be&&(a==="scroll"||a==="scrollend"),te=Be?se!==null?se+"Capture":null:se;Be=[];for(var J=re,ae;J!==null;){var fe=J;if(ae=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ae===null||te===null||(fe=vo(J,te),fe!=null&&Be.push(Qo(J,fe,ae))),jt)break;J=J.return}0<Be.length&&(se=new oe(se,Ae,null,l,pe),me.push({event:se,listeners:Be}))}}if((i&7)===0){e:{if(se=a==="mouseover"||a==="pointerover",oe=a==="mouseout"||a==="pointerout",se&&l!==Ud&&(Ae=l.relatedTarget||l.fromElement)&&(mn(Ae)||Ae[lr]))break e;if((oe||se)&&(se=pe.window===pe?pe:(se=pe.ownerDocument)?se.defaultView||se.parentWindow:window,oe?(Ae=l.relatedTarget||l.toElement,oe=re,Ae=Ae?mn(Ae):null,Ae!==null&&(jt=c(Ae),Be=Ae.tag,Ae!==jt||Be!==5&&Be!==27&&Be!==6)&&(Ae=null)):(oe=null,Ae=re),oe!==Ae)){if(Be=gv,fe="onMouseLeave",te="onMouseEnter",J="mouse",(a==="pointerout"||a==="pointerover")&&(Be=yv,fe="onPointerLeave",te="onPointerEnter",J="pointer"),jt=oe==null?se:ur(oe),ae=Ae==null?se:ur(Ae),se=new Be(fe,J+"leave",oe,l,pe),se.target=jt,se.relatedTarget=ae,fe=null,mn(pe)===re&&(Be=new Be(te,J+"enter",Ae,l,pe),Be.target=ae,Be.relatedTarget=jt,fe=Be),jt=fe,oe&&Ae)t:{for(Be=EE,te=oe,J=Ae,ae=0,fe=te;fe;fe=Be(fe))ae++;fe=0;for(var De=J;De;De=Be(De))fe++;for(;0<ae-fe;)te=Be(te),ae--;for(;0<fe-ae;)J=Be(J),fe--;for(;ae--;){if(te===J||J!==null&&te===J.alternate){Be=te;break t}te=Be(te),J=Be(J)}Be=null}else Be=null;oe!==null&&c0(me,se,oe,Be,!1),Ae!==null&&jt!==null&&c0(me,jt,Ae,Be,!0)}}e:{if(se=re?ur(re):window,oe=se.nodeName&&se.nodeName.toLowerCase(),oe==="select"||oe==="input"&&se.type==="file")var mt=Nv;else if(jv(se))if(Ev)mt=IN;else{mt=DN;var _e=MN}else oe=se.nodeName,!oe||oe.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?re&&Pd(re.elementType)&&(mt=Nv):mt=$N;if(mt&&(mt=mt(a,re))){Cv(me,mt,l,pe);break e}_e&&_e(a,se,re),a==="focusout"&&re&&se.type==="number"&&re.memoizedProps.value!=null&&Id(se,"number",se.value)}switch(_e=re?ur(re):window,a){case"focusin":(jv(_e)||_e.contentEditable==="true")&&(ps=_e,Jd=re,Co=null);break;case"focusout":Co=Jd=ps=null;break;case"mousedown":ep=!0;break;case"contextmenu":case"mouseup":case"dragend":ep=!1,Mv(me,l,pe);break;case"selectionchange":if(UN)break;case"keydown":case"keyup":Mv(me,l,pe)}var Ke;if(Yd)e:{switch(a){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else ds?kv(a,l)&&(ot="onCompositionEnd"):a==="keydown"&&l.keyCode===229&&(ot="onCompositionStart");ot&&(bv&&l.locale!=="ko"&&(ds||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&ds&&(Ke=hv()):(qr=pe,qd="value"in qr?qr.value:qr.textContent,ds=!0)),_e=Wc(re,ot),0<_e.length&&(ot=new vv(ot,a,null,l,pe),me.push({event:ot,listeners:_e}),Ke?ot.data=Ke:(Ke=Sv(l),Ke!==null&&(ot.data=Ke)))),(Ke=RN?_N(a,l):ON(a,l))&&(ot=Wc(re,"onBeforeInput"),0<ot.length&&(_e=new vv("onBeforeInput","beforeinput",null,l,pe),me.push({event:_e,listeners:ot}),_e.data=Ke)),SE(me,a,re,l,pe)}o0(me,i)})}function Qo(a,i,l){return{instance:a,listener:i,currentTarget:l}}function Wc(a,i){for(var l=i+"Capture",p=[];a!==null;){var v=a,b=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||b===null||(v=vo(a,l),v!=null&&p.unshift(Qo(a,v,b)),v=vo(a,i),v!=null&&p.push(Qo(a,v,b))),a.tag===3)return p;a=a.return}return[]}function EE(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function c0(a,i,l,p,v){for(var b=i._reactName,C=[];l!==null&&l!==p;){var M=l,Y=M.alternate,re=M.stateNode;if(M=M.tag,Y!==null&&Y===p)break;M!==5&&M!==26&&M!==27||re===null||(Y=re,v?(re=vo(l,b),re!=null&&C.unshift(Qo(l,re,Y))):v||(re=vo(l,b),re!=null&&C.push(Qo(l,re,Y)))),l=l.return}C.length!==0&&a.push({event:i,listeners:C})}var TE=/\r\n?/g,AE=/\u0000|\uFFFD/g;function u0(a){return(typeof a=="string"?a:""+a).replace(TE,`
50
- `).replace(AE,"")}function d0(a,i){return i=u0(i),u0(a)===i}function St(a,i,l,p,v,b){switch(l){case"children":typeof p=="string"?i==="body"||i==="textarea"&&p===""||ls(a,p):(typeof p=="number"||typeof p=="bigint")&&i!=="body"&&ls(a,""+p);break;case"className":Kl(a,"class",p);break;case"tabIndex":Kl(a,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":Kl(a,l,p);break;case"style":dv(a,p,b);break;case"data":if(i!=="object"){Kl(a,"data",p);break}case"src":case"href":if(p===""&&(i!=="a"||l!=="href")){a.removeAttribute(l);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(l);break}p=Jl(""+p),a.setAttribute(l,p);break;case"action":case"formAction":if(typeof p=="function"){a.setAttribute(l,"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 b=="function"&&(l==="formAction"?(i!=="input"&&St(a,i,"name",v.name,v,null),St(a,i,"formEncType",v.formEncType,v,null),St(a,i,"formMethod",v.formMethod,v,null),St(a,i,"formTarget",v.formTarget,v,null)):(St(a,i,"encType",v.encType,v,null),St(a,i,"method",v.method,v,null),St(a,i,"target",v.target,v,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(l);break}p=Jl(""+p),a.setAttribute(l,p);break;case"onClick":p!=null&&(a.onclick=fr);break;case"onScroll":p!=null&&at("scroll",a);break;case"onScrollEnd":p!=null&&at("scrollend",a);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(l=p.__html,l!=null){if(v.children!=null)throw Error(r(60));a.innerHTML=l}}break;case"multiple":a.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":a.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){a.removeAttribute("xlink:href");break}l=Jl(""+p),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(l,""+p):a.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":p&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(l,""):a.removeAttribute(l);break;case"capture":case"download":p===!0?a.setAttribute(l,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(l,p):a.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?a.setAttribute(l,p):a.removeAttribute(l);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?a.removeAttribute(l):a.setAttribute(l,p);break;case"popover":at("beforetoggle",a),at("toggle",a),Ql(a,"popover",p);break;case"xlinkActuate":pr(a,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":pr(a,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":pr(a,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":pr(a,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":pr(a,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":pr(a,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":pr(a,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":pr(a,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":pr(a,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":Ql(a,"is",p);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=aN.get(l)||l,Ql(a,l,p))}}function Nf(a,i,l,p,v,b){switch(l){case"style":dv(a,p,b);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(l=p.__html,l!=null){if(v.children!=null)throw Error(r(60));a.innerHTML=l}}break;case"children":typeof p=="string"?ls(a,p):(typeof p=="number"||typeof p=="bigint")&&ls(a,""+p);break;case"onScroll":p!=null&&at("scroll",a);break;case"onScrollEnd":p!=null&&at("scrollend",a);break;case"onClick":p!=null&&(a.onclick=fr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Yl.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(v=l.endsWith("Capture"),i=l.slice(2,v?l.length-7:void 0),b=a[cn]||null,b=b!=null?b[l]:null,typeof b=="function"&&a.removeEventListener(i,b,v),typeof p=="function")){typeof b!="function"&&b!==null&&(l in a?a[l]=null:a.hasAttribute(l)&&a.removeAttribute(l)),a.addEventListener(i,p,v);break e}l in a?a[l]=p:p===!0?a.setAttribute(l,""):Ql(a,l,p)}}}function kn(a,i,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",a),at("load",a);var p=!1,v=!1,b;for(b in l)if(l.hasOwnProperty(b)){var C=l[b];if(C!=null)switch(b){case"src":p=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:St(a,i,b,C,l,null)}}v&&St(a,i,"srcSet",l.srcSet,l,null),p&&St(a,i,"src",l.src,l,null);return;case"input":at("invalid",a);var M=b=C=v=null,Y=null,re=null;for(p in l)if(l.hasOwnProperty(p)){var pe=l[p];if(pe!=null)switch(p){case"name":v=pe;break;case"type":C=pe;break;case"checked":Y=pe;break;case"defaultChecked":re=pe;break;case"value":b=pe;break;case"defaultValue":M=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(r(137,i));break;default:St(a,i,p,pe,l,null)}}ov(a,b,M,Y,re,C,v,!1);return;case"select":at("invalid",a),p=C=b=null;for(v in l)if(l.hasOwnProperty(v)&&(M=l[v],M!=null))switch(v){case"value":b=M;break;case"defaultValue":C=M;break;case"multiple":p=M;default:St(a,i,v,M,l,null)}i=b,l=C,a.multiple=!!p,i!=null?os(a,!!p,i,!1):l!=null&&os(a,!!p,l,!0);return;case"textarea":at("invalid",a),b=v=p=null;for(C in l)if(l.hasOwnProperty(C)&&(M=l[C],M!=null))switch(C){case"value":p=M;break;case"defaultValue":v=M;break;case"children":b=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(r(91));break;default:St(a,i,C,M,l,null)}cv(a,p,v,b);return;case"option":for(Y in l)if(l.hasOwnProperty(Y)&&(p=l[Y],p!=null))switch(Y){case"selected":a.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:St(a,i,Y,p,l,null)}return;case"dialog":at("beforetoggle",a),at("toggle",a),at("cancel",a),at("close",a);break;case"iframe":case"object":at("load",a);break;case"video":case"audio":for(p=0;p<Yo.length;p++)at(Yo[p],a);break;case"image":at("error",a),at("load",a);break;case"details":at("toggle",a);break;case"embed":case"source":case"link":at("error",a),at("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(re in l)if(l.hasOwnProperty(re)&&(p=l[re],p!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:St(a,i,re,p,l,null)}return;default:if(Pd(i)){for(pe in l)l.hasOwnProperty(pe)&&(p=l[pe],p!==void 0&&Nf(a,i,pe,p,l,void 0));return}}for(M in l)l.hasOwnProperty(M)&&(p=l[M],p!=null&&St(a,i,M,p,l,null))}function RE(a,i,l,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,b=null,C=null,M=null,Y=null,re=null,pe=null;for(oe in l){var me=l[oe];if(l.hasOwnProperty(oe)&&me!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":Y=me;default:p.hasOwnProperty(oe)||St(a,i,oe,null,p,me)}}for(var se in p){var oe=p[se];if(me=l[se],p.hasOwnProperty(se)&&(oe!=null||me!=null))switch(se){case"type":b=oe;break;case"name":v=oe;break;case"checked":re=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(r(137,i));break;default:oe!==me&&St(a,i,se,oe,p,me)}}$d(a,C,M,Y,re,pe,b,v);return;case"select":oe=C=M=se=null;for(b in l)if(Y=l[b],l.hasOwnProperty(b)&&Y!=null)switch(b){case"value":break;case"multiple":oe=Y;default:p.hasOwnProperty(b)||St(a,i,b,null,p,Y)}for(v in p)if(b=p[v],Y=l[v],p.hasOwnProperty(v)&&(b!=null||Y!=null))switch(v){case"value":se=b;break;case"defaultValue":M=b;break;case"multiple":C=b;default:b!==Y&&St(a,i,v,b,p,Y)}i=M,l=C,p=oe,se!=null?os(a,!!l,se,!1):!!p!=!!l&&(i!=null?os(a,!!l,i,!0):os(a,!!l,l?[]:"",!1));return;case"textarea":oe=se=null;for(M in l)if(v=l[M],l.hasOwnProperty(M)&&v!=null&&!p.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:St(a,i,M,null,p,v)}for(C in p)if(v=p[C],b=l[C],p.hasOwnProperty(C)&&(v!=null||b!=null))switch(C){case"value":se=v;break;case"defaultValue":oe=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==b&&St(a,i,C,v,p,b)}lv(a,se,oe);return;case"option":for(var Ae in l)if(se=l[Ae],l.hasOwnProperty(Ae)&&se!=null&&!p.hasOwnProperty(Ae))switch(Ae){case"selected":a.selected=!1;break;default:St(a,i,Ae,null,p,se)}for(Y in p)if(se=p[Y],oe=l[Y],p.hasOwnProperty(Y)&&se!==oe&&(se!=null||oe!=null))switch(Y){case"selected":a.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:St(a,i,Y,se,p,oe)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Be in l)se=l[Be],l.hasOwnProperty(Be)&&se!=null&&!p.hasOwnProperty(Be)&&St(a,i,Be,null,p,se);for(re in p)if(se=p[re],oe=l[re],p.hasOwnProperty(re)&&se!==oe&&(se!=null||oe!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,i));break;default:St(a,i,re,se,p,oe)}return;default:if(Pd(i)){for(var jt in l)se=l[jt],l.hasOwnProperty(jt)&&se!==void 0&&!p.hasOwnProperty(jt)&&Nf(a,i,jt,void 0,p,se);for(pe in p)se=p[pe],oe=l[pe],!p.hasOwnProperty(pe)||se===oe||se===void 0&&oe===void 0||Nf(a,i,pe,se,p,oe);return}}for(var te in l)se=l[te],l.hasOwnProperty(te)&&se!=null&&!p.hasOwnProperty(te)&&St(a,i,te,null,p,se);for(me in p)se=p[me],oe=l[me],!p.hasOwnProperty(me)||se===oe||se==null&&oe==null||St(a,i,me,se,p,oe)}function p0(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _E(){if(typeof performance.getEntriesByType=="function"){for(var a=0,i=0,l=performance.getEntriesByType("resource"),p=0;p<l.length;p++){var v=l[p],b=v.transferSize,C=v.initiatorType,M=v.duration;if(b&&M&&p0(C)){for(C=0,M=v.responseEnd,p+=1;p<l.length;p++){var Y=l[p],re=Y.startTime;if(re>M)break;var pe=Y.transferSize,me=Y.initiatorType;pe&&p0(me)&&(Y=Y.responseEnd,C+=pe*(Y<M?1:(M-re)/(Y-re)))}if(--p,i+=8*(b+C)/(v.duration/1e3),a++,10<a)break}}if(0<a)return i/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var Ef=null,Tf=null;function Zc(a){return a.nodeType===9?a:a.ownerDocument}function f0(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function h0(a,i){if(a===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&i==="foreignObject"?0:a}function Af(a,i){return a==="textarea"||a==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Rf=null;function OE(){var a=window.event;return a&&a.type==="popstate"?a===Rf?!1:(Rf=a,!0):(Rf=null,!1)}var m0=typeof setTimeout=="function"?setTimeout:void 0,LE=typeof clearTimeout=="function"?clearTimeout:void 0,g0=typeof Promise=="function"?Promise:void 0,zE=typeof queueMicrotask=="function"?queueMicrotask:typeof g0<"u"?function(a){return g0.resolve(null).then(a).catch(ME)}:m0;function ME(a){setTimeout(function(){throw a})}function oi(a){return a==="head"}function v0(a,i){var l=i,p=0;do{var v=l.nextSibling;if(a.removeChild(l),v&&v.nodeType===8)if(l=v.data,l==="/$"||l==="/&"){if(p===0){a.removeChild(v),Ps(i);return}p--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")p++;else if(l==="html")Ko(a.ownerDocument.documentElement);else if(l==="head"){l=a.ownerDocument.head,Ko(l);for(var b=l.firstChild;b;){var C=b.nextSibling,M=b.nodeName;b[Aa]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&b.rel.toLowerCase()==="stylesheet"||l.removeChild(b),b=C}}else l==="body"&&Ko(a.ownerDocument.body);l=v}while(l);Ps(i)}function y0(a,i){var l=a;a=0;do{var p=l.nextSibling;if(l.nodeType===1?i?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(i?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),p&&p.nodeType===8)if(l=p.data,l==="/$"){if(a===0)break;a--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||a++;l=p}while(l)}function _f(a){var i=a.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var l=i;switch(i=i.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":_f(l),Hr(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}a.removeChild(l)}}function DE(a,i,l,p){for(;a.nodeType===1;){var v=l;if(a.nodeName.toLowerCase()!==i.toLowerCase()){if(!p&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(p){if(!a[Aa])switch(i){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(b=a.getAttribute("rel"),b==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(b!==v.rel||a.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||a.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||a.getAttribute("title")!==(v.title==null?null:v.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(b=a.getAttribute("src"),(b!==(v.src==null?null:v.src)||a.getAttribute("type")!==(v.type==null?null:v.type)||a.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&b&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(i==="input"&&a.type==="hidden"){var b=v.name==null?null:""+v.name;if(v.type==="hidden"&&a.getAttribute("name")===b)return a}else return a;if(a=ka(a.nextSibling),a===null)break}return null}function $E(a,i,l){if(i==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!l||(a=ka(a.nextSibling),a===null))return null;return a}function b0(a,i){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!i||(a=ka(a.nextSibling),a===null))return null;return a}function Of(a){return a.data==="$?"||a.data==="$~"}function Lf(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function IE(a,i){var l=a.ownerDocument;if(a.data==="$~")a._reactRetry=i;else if(a.data!=="$?"||l.readyState!=="loading")i();else{var p=function(){i(),l.removeEventListener("DOMContentLoaded",p)};l.addEventListener("DOMContentLoaded",p),a._reactRetry=p}}function ka(a){for(;a!=null;a=a.nextSibling){var i=a.nodeType;if(i===1||i===3)break;if(i===8){if(i=a.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return a}var zf=null;function x0(a){a=a.nextSibling;for(var i=0;a;){if(a.nodeType===8){var l=a.data;if(l==="/$"||l==="/&"){if(i===0)return ka(a.nextSibling);i--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||i++}a=a.nextSibling}return null}function w0(a){a=a.previousSibling;for(var i=0;a;){if(a.nodeType===8){var l=a.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(i===0)return a;i--}else l!=="/$"&&l!=="/&"||i++}a=a.previousSibling}return null}function k0(a,i,l){switch(i=Zc(l),a){case"html":if(a=i.documentElement,!a)throw Error(r(452));return a;case"head":if(a=i.head,!a)throw Error(r(453));return a;case"body":if(a=i.body,!a)throw Error(r(454));return a;default:throw Error(r(451))}}function Ko(a){for(var i=a.attributes;i.length;)a.removeAttributeNode(i[0]);Hr(a)}var Sa=new Map,S0=new Set;function Yc(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var Ar=V.d;V.d={f:PE,r:UE,D:BE,C:FE,L:HE,m:qE,X:VE,S:GE,M:WE};function PE(){var a=Ar.f(),i=Uc();return a||i}function UE(a){var i=Cn(a);i!==null&&i.tag===5&&i.type==="form"?Uy(i):Ar.r(a)}var Ds=typeof document>"u"?null:document;function j0(a,i,l){var p=Ds;if(p&&typeof i=="string"&&i){var v=ma(i);v='link[rel="'+a+'"][href="'+v+'"]',typeof l=="string"&&(v+='[crossorigin="'+l+'"]'),S0.has(v)||(S0.add(v),a={rel:a,crossOrigin:l,href:i},p.querySelector(v)===null&&(i=p.createElement("link"),kn(i,"link",a),Ot(i),p.head.appendChild(i)))}}function BE(a){Ar.D(a),j0("dns-prefetch",a,null)}function FE(a,i){Ar.C(a,i),j0("preconnect",a,i)}function HE(a,i,l){Ar.L(a,i,l);var p=Ds;if(p&&a&&i){var v='link[rel="preload"][as="'+ma(i)+'"]';i==="image"&&l&&l.imageSrcSet?(v+='[imagesrcset="'+ma(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(v+='[imagesizes="'+ma(l.imageSizes)+'"]')):v+='[href="'+ma(a)+'"]';var b=v;switch(i){case"style":b=$s(a);break;case"script":b=Is(a)}Sa.has(b)||(a=m({rel:"preload",href:i==="image"&&l&&l.imageSrcSet?void 0:a,as:i},l),Sa.set(b,a),p.querySelector(v)!==null||i==="style"&&p.querySelector(Xo(b))||i==="script"&&p.querySelector(Jo(b))||(i=p.createElement("link"),kn(i,"link",a),Ot(i),p.head.appendChild(i)))}}function qE(a,i){Ar.m(a,i);var l=Ds;if(l&&a){var p=i&&typeof i.as=="string"?i.as:"script",v='link[rel="modulepreload"][as="'+ma(p)+'"][href="'+ma(a)+'"]',b=v;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Is(a)}if(!Sa.has(b)&&(a=m({rel:"modulepreload",href:a},i),Sa.set(b,a),l.querySelector(v)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Jo(b)))return}p=l.createElement("link"),kn(p,"link",a),Ot(p),l.head.appendChild(p)}}}function GE(a,i,l){Ar.S(a,i,l);var p=Ds;if(p&&a){var v=da(p).hoistableStyles,b=$s(a);i=i||"default";var C=v.get(b);if(!C){var M={loading:0,preload:null};if(C=p.querySelector(Xo(b)))M.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":i},l),(l=Sa.get(b))&&Mf(a,l);var Y=C=p.createElement("link");Ot(Y),kn(Y,"link",a),Y._p=new Promise(function(re,pe){Y.onload=re,Y.onerror=pe}),Y.addEventListener("load",function(){M.loading|=1}),Y.addEventListener("error",function(){M.loading|=2}),M.loading|=4,Qc(C,i,p)}C={type:"stylesheet",instance:C,count:1,state:M},v.set(b,C)}}}function VE(a,i){Ar.X(a,i);var l=Ds;if(l&&a){var p=da(l).hoistableScripts,v=Is(a),b=p.get(v);b||(b=l.querySelector(Jo(v)),b||(a=m({src:a,async:!0},i),(i=Sa.get(v))&&Df(a,i),b=l.createElement("script"),Ot(b),kn(b,"link",a),l.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},p.set(v,b))}}function WE(a,i){Ar.M(a,i);var l=Ds;if(l&&a){var p=da(l).hoistableScripts,v=Is(a),b=p.get(v);b||(b=l.querySelector(Jo(v)),b||(a=m({src:a,async:!0,type:"module"},i),(i=Sa.get(v))&&Df(a,i),b=l.createElement("script"),Ot(b),kn(b,"link",a),l.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},p.set(v,b))}}function C0(a,i,l,p){var v=(v=le.current)?Yc(v):null;if(!v)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(i=$s(l.href),l=da(v).hoistableStyles,p=l.get(i),p||(p={type:"style",instance:null,count:0,state:null},l.set(i,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){a=$s(l.href);var b=da(v).hoistableStyles,C=b.get(a);if(C||(v=v.ownerDocument||v,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(a,C),(b=v.querySelector(Xo(a)))&&!b._p&&(C.instance=b,C.state.loading=5),Sa.has(a)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Sa.set(a,l),b||ZE(v,a,l,C.state))),i&&p===null)throw Error(r(528,""));return C}if(i&&p!==null)throw Error(r(529,""));return null;case"script":return i=l.async,l=l.src,typeof l=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Is(l),l=da(v).hoistableScripts,p=l.get(i),p||(p={type:"script",instance:null,count:0,state:null},l.set(i,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function $s(a){return'href="'+ma(a)+'"'}function Xo(a){return'link[rel="stylesheet"]['+a+"]"}function N0(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function ZE(a,i,l,p){a.querySelector('link[rel="preload"][as="style"]['+i+"]")?p.loading=1:(i=a.createElement("link"),p.preload=i,i.addEventListener("load",function(){return p.loading|=1}),i.addEventListener("error",function(){return p.loading|=2}),kn(i,"link",l),Ot(i),a.head.appendChild(i))}function Is(a){return'[src="'+ma(a)+'"]'}function Jo(a){return"script[async]"+a}function E0(a,i,l){if(i.count++,i.instance===null)switch(i.type){case"style":var p=a.querySelector('style[data-href~="'+ma(l.href)+'"]');if(p)return i.instance=p,Ot(p),p;var v=m({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return p=(a.ownerDocument||a).createElement("style"),Ot(p),kn(p,"style",v),Qc(p,l.precedence,a),i.instance=p;case"stylesheet":v=$s(l.href);var b=a.querySelector(Xo(v));if(b)return i.state.loading|=4,i.instance=b,Ot(b),b;p=N0(l),(v=Sa.get(v))&&Mf(p,v),b=(a.ownerDocument||a).createElement("link"),Ot(b);var C=b;return C._p=new Promise(function(M,Y){C.onload=M,C.onerror=Y}),kn(b,"link",p),i.state.loading|=4,Qc(b,l.precedence,a),i.instance=b;case"script":return b=Is(l.src),(v=a.querySelector(Jo(b)))?(i.instance=v,Ot(v),v):(p=l,(v=Sa.get(b))&&(p=m({},l),Df(p,v)),a=a.ownerDocument||a,v=a.createElement("script"),Ot(v),kn(v,"link",p),a.head.appendChild(v),i.instance=v);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(p=i.instance,i.state.loading|=4,Qc(p,l.precedence,a));return i.instance}function Qc(a,i,l){for(var p=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=p.length?p[p.length-1]:null,b=v,C=0;C<p.length;C++){var M=p[C];if(M.dataset.precedence===i)b=M;else if(b!==v)break}b?b.parentNode.insertBefore(a,b.nextSibling):(i=l.nodeType===9?l.head:l,i.insertBefore(a,i.firstChild))}function Mf(a,i){a.crossOrigin==null&&(a.crossOrigin=i.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=i.referrerPolicy),a.title==null&&(a.title=i.title)}function Df(a,i){a.crossOrigin==null&&(a.crossOrigin=i.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=i.referrerPolicy),a.integrity==null&&(a.integrity=i.integrity)}var Kc=null;function T0(a,i,l){if(Kc===null){var p=new Map,v=Kc=new Map;v.set(l,p)}else v=Kc,p=v.get(l),p||(p=new Map,v.set(l,p));if(p.has(a))return p;for(p.set(a,null),l=l.getElementsByTagName(a),v=0;v<l.length;v++){var b=l[v];if(!(b[Aa]||b[Ht]||a==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var C=b.getAttribute(i)||"";C=a+C;var M=p.get(C);M?M.push(b):p.set(C,[b])}}return p}function A0(a,i,l){a=a.ownerDocument||a,a.head.insertBefore(l,i==="title"?a.querySelector("head > title"):null)}function YE(a,i,l){if(l===1||i.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return a=i.disabled,typeof i.precedence=="string"&&a==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function R0(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function QE(a,i,l,p){if(l.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var v=$s(p.href),b=i.querySelector(Xo(v));if(b){i=b._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(a.count++,a=Xc.bind(a),i.then(a,a)),l.state.loading|=4,l.instance=b,Ot(b);return}b=i.ownerDocument||i,p=N0(p),(v=Sa.get(v))&&Mf(p,v),b=b.createElement("link"),Ot(b);var C=b;C._p=new Promise(function(M,Y){C.onload=M,C.onerror=Y}),kn(b,"link",p),l.instance=b}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(l,i),(i=l.state.preload)&&(l.state.loading&3)===0&&(a.count++,l=Xc.bind(a),i.addEventListener("load",l),i.addEventListener("error",l))}}var $f=0;function KE(a,i){return a.stylesheets&&a.count===0&&eu(a,a.stylesheets),0<a.count||0<a.imgCount?function(l){var p=setTimeout(function(){if(a.stylesheets&&eu(a,a.stylesheets),a.unsuspend){var b=a.unsuspend;a.unsuspend=null,b()}},6e4+i);0<a.imgBytes&&$f===0&&($f=62500*_E());var v=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&eu(a,a.stylesheets),a.unsuspend)){var b=a.unsuspend;a.unsuspend=null,b()}},(a.imgBytes>$f?50:800)+i);return a.unsuspend=l,function(){a.unsuspend=null,clearTimeout(p),clearTimeout(v)}}:null}function Xc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)eu(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Jc=null;function eu(a,i){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Jc=new Map,i.forEach(XE,a),Jc=null,Xc.call(a))}function XE(a,i){if(!(i.state.loading&4)){var l=Jc.get(a);if(l)var p=l.get(null);else{l=new Map,Jc.set(a,l);for(var v=a.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<v.length;b++){var C=v[b];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(l.set(C.dataset.precedence,C),p=C)}p&&l.set(null,p)}v=i.instance,C=v.getAttribute("data-precedence"),b=l.get(C)||p,b===p&&l.set(null,v),l.set(C,v),this.count++,p=Xc.bind(this),v.addEventListener("load",p),v.addEventListener("error",p),b?b.parentNode.insertBefore(v,b.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(v,a.firstChild)),i.state.loading|=4}}var el={$$typeof:N,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function JE(a,i,l,p,v,b,C,M,Y){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=wi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wi(0),this.hiddenUpdates=wi(null),this.identifierPrefix=p,this.onUncaughtError=v,this.onCaughtError=b,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function _0(a,i,l,p,v,b,C,M,Y,re,pe,me){return a=new JE(a,i,l,C,Y,re,pe,me,M),i=1,b===!0&&(i|=24),b=Yn(3,null,null,i),a.current=b,b.stateNode=a,i=mp(),i.refCount++,a.pooledCache=i,i.refCount++,b.memoizedState={element:p,isDehydrated:l,cache:i},bp(b),a}function O0(a){return a?(a=ms,a):ms}function L0(a,i,l,p,v,b){v=O0(v),p.context===null?p.context=v:p.pendingContext=v,p=Qr(i),p.payload={element:l},b=b===void 0?null:b,b!==null&&(p.callback=b),l=Kr(a,p,i),l!==null&&(Bn(l,a,i),Oo(l,a,i))}function z0(a,i){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var l=a.retryLane;a.retryLane=l!==0&&l<i?l:i}}function If(a,i){z0(a,i),(a=a.alternate)&&z0(a,i)}function M0(a){if(a.tag===13||a.tag===31){var i=Ci(a,67108864);i!==null&&Bn(i,a,67108864),If(a,67108864)}}function D0(a){if(a.tag===13||a.tag===31){var i=ea();i=tt(i);var l=Ci(a,i);l!==null&&Bn(l,a,i),If(a,i)}}var tu=!0;function eT(a,i,l,p){var v=F.T;F.T=null;var b=V.p;try{V.p=2,Pf(a,i,l,p)}finally{V.p=b,F.T=v}}function tT(a,i,l,p){var v=F.T;F.T=null;var b=V.p;try{V.p=8,Pf(a,i,l,p)}finally{V.p=b,F.T=v}}function Pf(a,i,l,p){if(tu){var v=Uf(p);if(v===null)Cf(a,i,p,nu,l),I0(a,p);else if(aT(v,a,i,l,p))p.stopPropagation();else if(I0(a,p),i&4&&-1<nT.indexOf(a)){for(;v!==null;){var b=Cn(v);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var C=ca(b.pendingLanes);if(C!==0){var M=b;for(M.pendingLanes|=2,M.entangledLanes|=2;C;){var Y=1<<31-Ne(C);M.entanglements[1]|=Y,C&=~Y}Ya(b),(yt&6)===0&&(Ic=dt()+500,Zo(0))}}break;case 31:case 13:M=Ci(b,2),M!==null&&Bn(M,b,2),Uc(),If(b,2)}if(b=Uf(p),b===null&&Cf(a,i,p,nu,l),b===v)break;v=b}v!==null&&p.stopPropagation()}else Cf(a,i,p,null,l)}}function Uf(a){return a=Bd(a),Bf(a)}var nu=null;function Bf(a){if(nu=null,a=mn(a),a!==null){var i=c(a);if(i===null)a=null;else{var l=i.tag;if(l===13){if(a=u(i),a!==null)return a;a=null}else if(l===31){if(a=d(i),a!==null)return a;a=null}else if(l===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;a=null}else i!==a&&(a=null)}}return nu=a,null}function $0(a){switch(a){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ye()){case K:return 2;case Z:return 8;case ee:case ce:return 32;case he:return 268435456;default:return 32}default:return 32}}var Ff=!1,li=null,ci=null,ui=null,tl=new Map,nl=new Map,di=[],nT="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 I0(a,i){switch(a){case"focusin":case"focusout":li=null;break;case"dragenter":case"dragleave":ci=null;break;case"mouseover":case"mouseout":ui=null;break;case"pointerover":case"pointerout":tl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":nl.delete(i.pointerId)}}function al(a,i,l,p,v,b){return a===null||a.nativeEvent!==b?(a={blockedOn:i,domEventName:l,eventSystemFlags:p,nativeEvent:b,targetContainers:[v]},i!==null&&(i=Cn(i),i!==null&&M0(i)),a):(a.eventSystemFlags|=p,i=a.targetContainers,v!==null&&i.indexOf(v)===-1&&i.push(v),a)}function aT(a,i,l,p,v){switch(i){case"focusin":return li=al(li,a,i,l,p,v),!0;case"dragenter":return ci=al(ci,a,i,l,p,v),!0;case"mouseover":return ui=al(ui,a,i,l,p,v),!0;case"pointerover":var b=v.pointerId;return tl.set(b,al(tl.get(b)||null,a,i,l,p,v)),!0;case"gotpointercapture":return b=v.pointerId,nl.set(b,al(nl.get(b)||null,a,i,l,p,v)),!0}return!1}function P0(a){var i=mn(a.target);if(i!==null){var l=c(i);if(l!==null){if(i=l.tag,i===13){if(i=u(l),i!==null){a.blockedOn=i,ft(a.priority,function(){D0(l)});return}}else if(i===31){if(i=d(l),i!==null){a.blockedOn=i,ft(a.priority,function(){D0(l)});return}}else if(i===3&&l.stateNode.current.memoizedState.isDehydrated){a.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}a.blockedOn=null}function au(a){if(a.blockedOn!==null)return!1;for(var i=a.targetContainers;0<i.length;){var l=Uf(a.nativeEvent);if(l===null){l=a.nativeEvent;var p=new l.constructor(l.type,l);Ud=p,l.target.dispatchEvent(p),Ud=null}else return i=Cn(l),i!==null&&M0(i),a.blockedOn=l,!1;i.shift()}return!0}function U0(a,i,l){au(a)&&l.delete(i)}function rT(){Ff=!1,li!==null&&au(li)&&(li=null),ci!==null&&au(ci)&&(ci=null),ui!==null&&au(ui)&&(ui=null),tl.forEach(U0),nl.forEach(U0)}function ru(a,i){a.blockedOn===i&&(a.blockedOn=null,Ff||(Ff=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rT)))}var iu=null;function B0(a){iu!==a&&(iu=a,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){iu===a&&(iu=null);for(var i=0;i<a.length;i+=3){var l=a[i],p=a[i+1],v=a[i+2];if(typeof p!="function"){if(Bf(p||l)===null)continue;break}var b=Cn(l);b!==null&&(a.splice(i,3),i-=3,Pp(b,{pending:!0,data:v,method:l.method,action:p},p,v))}}))}function Ps(a){function i(Y){return ru(Y,a)}li!==null&&ru(li,a),ci!==null&&ru(ci,a),ui!==null&&ru(ui,a),tl.forEach(i),nl.forEach(i);for(var l=0;l<di.length;l++){var p=di[l];p.blockedOn===a&&(p.blockedOn=null)}for(;0<di.length&&(l=di[0],l.blockedOn===null);)P0(l),l.blockedOn===null&&di.shift();if(l=(a.ownerDocument||a).$$reactFormReplay,l!=null)for(p=0;p<l.length;p+=3){var v=l[p],b=l[p+1],C=v[cn]||null;if(typeof b=="function")C||B0(l);else if(C){var M=null;if(b&&b.hasAttribute("formAction")){if(v=b,C=b[cn]||null)M=C.formAction;else if(Bf(v)!==null)continue}else M=C.action;typeof M=="function"?l[p+1]=M:(l.splice(p,3),p-=3),B0(l)}}}function F0(){function a(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(C){return v=C})},focusReset:"manual",scroll:"manual"})}function i(){v!==null&&(v(),v=null),p||setTimeout(l,20)}function l(){if(!p&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,v=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(l,100),function(){p=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),v!==null&&(v(),v=null)}}}function Hf(a){this._internalRoot=a}su.prototype.render=Hf.prototype.render=function(a){var i=this._internalRoot;if(i===null)throw Error(r(409));var l=i.current,p=ea();L0(l,p,a,i,null,null)},su.prototype.unmount=Hf.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var i=a.containerInfo;L0(a.current,2,null,a,null,null),Uc(),i[lr]=null}};function su(a){this._internalRoot=a}su.prototype.unstable_scheduleHydration=function(a){if(a){var i=Ye();a={blockedOn:null,target:a,priority:i};for(var l=0;l<di.length&&i!==0&&i<di[l].priority;l++);di.splice(l,0,a),l===0&&P0(a)}};var H0=t.version;if(H0!=="19.2.4")throw Error(r(527,H0,"19.2.4"));V.findDOMNode=function(a){var i=a._reactInternals;if(i===void 0)throw typeof a.render=="function"?Error(r(188)):(a=Object.keys(a).join(","),Error(r(268,a)));return a=h(i),a=a!==null?g(a):null,a=a===null?null:a.stateNode,a};var iT={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ou.isDisabled&&ou.supportsFiber)try{Ce=ou.inject(iT),Fe=ou}catch{}}return il.createRoot=function(a,i){if(!s(a))throw Error(r(299));var l=!1,p="",v=Qy,b=Ky,C=Xy;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(p=i.identifierPrefix),i.onUncaughtError!==void 0&&(v=i.onUncaughtError),i.onCaughtError!==void 0&&(b=i.onCaughtError),i.onRecoverableError!==void 0&&(C=i.onRecoverableError)),i=_0(a,1,!1,null,null,l,p,null,v,b,C,F0),a[lr]=i.current,jf(a),new Hf(i)},il.hydrateRoot=function(a,i,l){if(!s(a))throw Error(r(299));var p=!1,v="",b=Qy,C=Ky,M=Xy,Y=null;return l!=null&&(l.unstable_strictMode===!0&&(p=!0),l.identifierPrefix!==void 0&&(v=l.identifierPrefix),l.onUncaughtError!==void 0&&(b=l.onUncaughtError),l.onCaughtError!==void 0&&(C=l.onCaughtError),l.onRecoverableError!==void 0&&(M=l.onRecoverableError),l.formState!==void 0&&(Y=l.formState)),i=_0(a,1,!0,i,l??null,p,v,Y,b,C,M,F0),i.context=O0(null),l=i.current,p=ea(),p=tt(p),v=Qr(p),v.callback=null,Kr(l,v,p),l=p,i.current.lanes=l,ge(i,l),Ya(i),a[lr]=i.current,jf(a),new su(i)},il.version="19.2.4",il}var J0;function gT(){if(J0)return Vf.exports;J0=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(),Vf.exports=mT(),Vf.exports}var vT=gT();/**
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 ex="popstate";function tx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function yT(e={}){function t(r,s){var h;let c=(h=s.state)==null?void 0:h.masked,{pathname:u,search:d,hash:f}=c||r.location;return Zh("",{pathname:u,search:d,hash:f},s.state&&s.state.usr||null,s.state&&s.state.key||"default",c?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:Tl(s)}return xT(t,n,null,e)}function Ut(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ia(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function bT(){return Math.random().toString(36).substring(2,10)}function nx(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 Zh(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?lo(t):t,state:n,key:t&&t.key||r||bT(),mask:s}}function Tl({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 lo(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function xT(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:c=!1}=r,u=s.history,d="POP",f=null,h=g();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function g(){return(u.state||{idx:null}).idx}function m(){d="POP";let E=g(),S=E==null?null:E-h;h=E,f&&f({action:d,location:j.location,delta:S})}function y(E,S){d="PUSH";let T=tx(E)?E:Zh(j.location,E,S);h=g()+1;let N=nx(T,h),A=j.createHref(T.mask||T);try{u.pushState(N,"",A)}catch(q){if(q instanceof DOMException&&q.name==="DataCloneError")throw q;s.location.assign(A)}c&&f&&f({action:d,location:j.location,delta:1})}function x(E,S){d="REPLACE";let T=tx(E)?E:Zh(j.location,E,S);h=g();let N=nx(T,h),A=j.createHref(T.mask||T);u.replaceState(N,"",A),c&&f&&f({action:d,location:j.location,delta:0})}function k(E){return wT(s,E)}let j={get action(){return d},get location(){return e(s,u)},listen(E){if(f)throw new Error("A history only accepts one active listener");return s.addEventListener(ex,m),f=E,()=>{s.removeEventListener(ex,m),f=null}},createHref(E){return t(s,E)},createURL:k,encodeLocation(E){let S=k(E);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:y,replace:x,go(E){return u.go(E)}};return j}function wT(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Ut(r,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:Tl(t);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function vk(e,t,n="/"){return kT(e,t,n,!1)}function kT(e,t,n,r,s){let c=typeof t=="string"?lo(t):t,u=Mr(c.pathname||"/",n);if(u==null)return null;let d=ST(e),f=null,h=MT(u);for(let g=0;f==null&&g<d.length;++g)f=LT(d[g],h,r);return f}function ST(e){let t=yk(e);return jT(t),t}function yk(e,t=[],n=[],r="",s=!1){let c=(u,d,f=s,h)=>{let g={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(r)&&f)return;Ut(g.relativePath.startsWith(r),`Absolute route path "${g.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(r.length)}let m=Da([r,g.relativePath]),y=n.concat(g);u.children&&u.children.length>0&&(Ut(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),yk(u.children,t,y,m,f)),!(u.path==null&&!u.index)&&t.push({path:m,score:_T(m,u.index),routesMeta:y})};return e.forEach((u,d)=>{var f;if(u.path===""||!((f=u.path)!=null&&f.includes("?")))c(u,d);else for(let h of bk(u.path))c(u,d,!0,h)}),t}function bk(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),c=n.replace(/\?$/,"");if(r.length===0)return s?[c,""]:[c];let u=bk(r.join("/")),d=[];return d.push(...u.map(f=>f===""?c:[c,f].join("/"))),s&&d.push(...u),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function jT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:OT(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var CT=/^:[\w-]+$/,NT=3,ET=2,TT=1,AT=10,RT=-2,ax=e=>e==="*";function _T(e,t){let n=e.split("/"),r=n.length;return n.some(ax)&&(r+=RT),t&&(r+=ET),n.filter(s=>!ax(s)).reduce((s,c)=>s+(CT.test(c)?NT:c===""?TT:AT),r)}function OT(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function LT(e,t,n=!1){let{routesMeta:r}=e,s={},c="/",u=[];for(let d=0;d<r.length;++d){let f=r[d],h=d===r.length-1,g=c==="/"?t:t.slice(c.length)||"/",m=Bu({path:f.relativePath,caseSensitive:f.caseSensitive,end:h},g),y=f.route;if(!m&&h&&n&&!r[r.length-1].route.index&&(m=Bu({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},g)),!m)return null;Object.assign(s,m.params),u.push({params:s,pathname:Da([c,m.pathname]),pathnameBase:PT(Da([c,m.pathnameBase])),route:y}),m.pathnameBase!=="/"&&(c=Da([c,m.pathnameBase]))}return u}function Bu(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=zT(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let c=s[0],u=c.replace(/(.)\/+$/,"$1"),d=s.slice(1);return{params:r.reduce((h,{paramName:g,isOptional:m},y)=>{if(g==="*"){let k=d[y]||"";u=c.slice(0,c.length-k.length).replace(/(.)\/+$/,"$1")}const x=d[y];return m&&!x?h[g]=void 0:h[g]=(x||"").replace(/%2F/g,"/"),h},{}),pathname:c,pathnameBase:u,pattern:e}}function zT(e,t=!1,n=!0){Ia(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,f,h,g)=>{if(r.push({paramName:d,isOptional:f!=null}),f){let m=g.charAt(h+u.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function MT(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ia(!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 Mr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var DT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function $T(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?lo(e):e,c;return n?(n=xk(n),n.startsWith("/")?c=rx(n.substring(1),"/"):c=rx(n,t)):c=t,{pathname:c,search:UT(r),hash:BT(s)}}function rx(e,t){let n=Fu(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Qf(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function IT(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Im(e){let t=IT(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function fd(e,t,n,r=!1){let s;typeof e=="string"?s=lo(e):(s={...e},Ut(!s.pathname||!s.pathname.includes("?"),Qf("?","pathname","search",s)),Ut(!s.pathname||!s.pathname.includes("#"),Qf("#","pathname","hash",s)),Ut(!s.search||!s.search.includes("#"),Qf("#","search","hash",s)));let c=e===""||s.pathname==="",u=c?"/":s.pathname,d;if(u==null)d=n;else{let m=t.length-1;if(!r&&u.startsWith("..")){let y=u.split("/");for(;y[0]==="..";)y.shift(),m-=1;s.pathname=y.join("/")}d=m>=0?t[m]:"/"}let f=$T(s,d),h=u&&u!=="/"&&u.endsWith("/"),g=(c||u===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||g)&&(f.pathname+="/"),f}var xk=e=>e.replace(/\/\/+/g,"/"),Da=e=>xk(e.join("/")),Fu=e=>e.replace(/\/+$/,""),PT=e=>Fu(e).replace(/^\/*/,"/"),UT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,BT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,FT=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function HT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function qT(e){let t=e.map(n=>n.route.path).filter(Boolean);return Da(t)||"/"}var wk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function kk(e,t){let n=e;if(typeof n!="string"||!DT.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(wk)try{let c=new URL(window.location.href),u=n.startsWith("//")?new URL(c.protocol+n):new URL(n),d=Mr(u.pathname,t);u.origin===c.origin&&d!=null?n=d+u.search+u.hash:s=!0}catch{Ia(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Sk=["POST","PUT","PATCH","DELETE"];new Set(Sk);var GT=["GET",...Sk];new Set(GT);var co=w.createContext(null);co.displayName="DataRouter";var hd=w.createContext(null);hd.displayName="DataRouterState";var jk=w.createContext(!1);function VT(){return w.useContext(jk)}var Ck=w.createContext({isTransitioning:!1});Ck.displayName="ViewTransition";var WT=w.createContext(new Map);WT.displayName="Fetchers";var ZT=w.createContext(null);ZT.displayName="Await";var oa=w.createContext(null);oa.displayName="Navigation";var Il=w.createContext(null);Il.displayName="Location";var ir=w.createContext({outlet:null,matches:[],isDataRoute:!1});ir.displayName="Route";var Pm=w.createContext(null);Pm.displayName="RouteError";var Nk="REACT_ROUTER_ERROR",YT="REDIRECT",QT="ROUTE_ERROR_RESPONSE";function KT(e){if(e.startsWith(`${Nk}:${YT}:{`))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 XT(e){if(e.startsWith(`${Nk}:${QT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new FT(t.status,t.statusText,t.data)}catch{}}function JT(e,{relative:t}={}){Ut(uo(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=w.useContext(oa),{hash:s,pathname:c,search:u}=Pl(e,{relative:t}),d=c;return n!=="/"&&(d=c==="/"?n:Da([n,c])),r.createHref({pathname:d,search:u,hash:s})}function uo(){return w.useContext(Il)!=null}function Ua(){return Ut(uo(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(Il).location}var Ek="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Tk(e){w.useContext(oa).static||w.useLayoutEffect(e)}function Um(){let{isDataRoute:e}=w.useContext(ir);return e?pA():eA()}function eA(){Ut(uo(),"useNavigate() may be used only in the context of a <Router> component.");let e=w.useContext(co),{basename:t,navigator:n}=w.useContext(oa),{matches:r}=w.useContext(ir),{pathname:s}=Ua(),c=JSON.stringify(Im(r)),u=w.useRef(!1);return Tk(()=>{u.current=!0}),w.useCallback((f,h={})=>{if(Ia(u.current,Ek),!u.current)return;if(typeof f=="number"){n.go(f);return}let g=fd(f,JSON.parse(c),s,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Da([t,g.pathname])),(h.replace?n.replace:n.push)(g,h.state,h)},[t,n,c,s,e])}w.createContext(null);function Pl(e,{relative:t}={}){let{matches:n}=w.useContext(ir),{pathname:r}=Ua(),s=JSON.stringify(Im(n));return w.useMemo(()=>fd(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function tA(e,t){return Ak(e,t)}function Ak(e,t,n){var E;Ut(uo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=w.useContext(oa),{matches:s}=w.useContext(ir),c=s[s.length-1],u=c?c.params:{},d=c?c.pathname:"/",f=c?c.pathnameBase:"/",h=c&&c.route;{let S=h&&h.path||"";_k(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=Ua(),m;if(t){let S=typeof t=="string"?lo(t):t;Ut(f==="/"||((E=S.pathname)==null?void 0:E.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||"/",x=y;if(f!=="/"){let S=f.replace(/^\//,"").split("/");x="/"+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})):vk(e,{pathname:x});Ia(h||k!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Ia(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=sA(k&&k.map(S=>Object.assign({},S,{params:Object.assign({},u,S.params),pathname:Da([f,r.encodeLocation?r.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?f:Da([f,r.encodeLocation?r.encodeLocation(S.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),s,n);return t&&j?w.createElement(Il.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},j):j}function nA(){let e=dA(),t=HT(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},c={padding:"2px 4px",backgroundColor:r},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:c},"ErrorBoundary")," or"," ",w.createElement("code",{style:c},"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 aA=w.createElement(nA,null),Rk=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=XT(e.digest);n&&(e=n)}let t=e!==void 0?w.createElement(ir.Provider,{value:this.props.routeContext},w.createElement(Pm.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?w.createElement(rA,{error:e},t):t}};Rk.contextType=jk;var Kf=new WeakMap;function rA({children:e,error:t}){let{basename:n}=w.useContext(oa);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=KT(t.digest);if(r){let s=Kf.get(t);if(s)throw s;let c=kk(r.location,n);if(wk&&!Kf.get(t))if(c.isExternal||r.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:r.replace}));throw Kf.set(t,u),u}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function iA({routeContext:e,match:t,children:n}){let r=w.useContext(co);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(ir.Provider,{value:e},n)}function sA(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,c=r==null?void 0:r.errors;if(c!=null){let g=s.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);Ut(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let u=!1,d=-1;if(n&&r){u=r.renderFallback;for(let g=0;g<s.length;g++){let m=s[g];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(d=g),m.route.id){let{loaderData:y,errors:x}=r,k=m.route.loader&&!y.hasOwnProperty(m.route.id)&&(!x||x[m.route.id]===void 0);if(m.route.lazy||k){n.isStatic&&(u=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let f=n==null?void 0:n.onError,h=r&&f?(g,m)=>{var y,x;f(g,{location:r.location,params:((x=(y=r.matches)==null?void 0:y[0])==null?void 0:x.params)??{},pattern:qT(r.matches),errorInfo:m})}:void 0;return s.reduceRight((g,m,y)=>{let x,k=!1,j=null,E=null;r&&(x=c&&m.route.id?c[m.route.id]:void 0,j=m.route.errorElement||aA,u&&(d<0&&y===0?(_k("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,E=null):d===y&&(k=!0,E=m.route.hydrateFallbackElement||null)));let S=t.concat(s.slice(0,y+1)),T=()=>{let N;return x?N=j:k?N=E:m.route.Component?N=w.createElement(m.route.Component,null):m.route.element?N=m.route.element:N=g,w.createElement(iA,{match:m,routeContext:{outlet:g,matches:S,isDataRoute:r!=null},children:N})};return r&&(m.route.ErrorBoundary||m.route.errorElement||y===0)?w.createElement(Rk,{location:r.location,revalidation:r.revalidation,component:j,error:x,children:T(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):T()},null)}function Bm(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function oA(e){let t=w.useContext(co);return Ut(t,Bm(e)),t}function lA(e){let t=w.useContext(hd);return Ut(t,Bm(e)),t}function cA(e){let t=w.useContext(ir);return Ut(t,Bm(e)),t}function Fm(e){let t=cA(e),n=t.matches[t.matches.length-1];return Ut(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function uA(){return Fm("useRouteId")}function dA(){var r;let e=w.useContext(Pm),t=lA("useRouteError"),n=Fm("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function pA(){let{router:e}=oA("useNavigate"),t=Fm("useNavigate"),n=w.useRef(!1);return Tk(()=>{n.current=!0}),w.useCallback(async(s,c={})=>{Ia(n.current,Ek),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...c}))},[e,t])}var ix={};function _k(e,t,n){!t&&!ix[e]&&(ix[e]=!0,Ia(!1,n))}w.memo(fA);function fA({routes:e,manifest:t,future:n,state:r,isStatic:s,onError:c}){return Ak(e,void 0,{manifest:t,state:r,isStatic:s,onError:c})}function bl({to:e,replace:t,state:n,relative:r}){Ut(uo(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=w.useContext(oa);Ia(!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:c}=w.useContext(ir),{pathname:u}=Ua(),d=Um(),f=fd(e,Im(c),u,r==="path"),h=JSON.stringify(f);return w.useEffect(()=>{d(JSON.parse(h),{replace:t,state:n,relative:r})},[d,h,r,t,n]),null}function mi(e){Ut(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function hA({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:c=!1,useTransitions:u}){Ut(!uo(),"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:c,useTransitions:u,future:{}}),[d,s,c,u]);typeof n=="string"&&(n=lo(n));let{pathname:h="/",search:g="",hash:m="",state:y=null,key:x="default",mask:k}=n,j=w.useMemo(()=>{let E=Mr(h,d);return E==null?null:{location:{pathname:E,search:g,hash:m,state:y,key:x,mask:k},navigationType:r}},[d,h,g,m,y,x,r,k]);return Ia(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(oa.Provider,{value:f},w.createElement(Il.Provider,{children:t,value:j}))}function mA({children:e,location:t}){return tA(Yh(e),t)}function Yh(e,t=[]){let n=[];return w.Children.forEach(e,(r,s)=>{if(!w.isValidElement(r))return;let c=[...t,s];if(r.type===w.Fragment){n.push.apply(n,Yh(r.props.children,c));return}Ut(r.type===mi,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ut(!r.props.index||!r.props.children,"An index route cannot have child routes.");let u={id:r.props.id||c.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(u.children=Yh(r.props.children,c)),n.push(u)}),n}var Eu="get",Tu="application/x-www-form-urlencoded";function md(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function gA(e){return md(e)&&e.tagName.toLowerCase()==="button"}function vA(e){return md(e)&&e.tagName.toLowerCase()==="form"}function yA(e){return md(e)&&e.tagName.toLowerCase()==="input"}function bA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xA(e,t){return e.button===0&&(!t||t==="_self")&&!bA(e)}var lu=null;function wA(){if(lu===null)try{new FormData(document.createElement("form"),0),lu=!1}catch{lu=!0}return lu}var kA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Xf(e){return e!=null&&!kA.has(e)?(Ia(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tu}"`),null):e}function SA(e,t){let n,r,s,c,u;if(vA(e)){let d=e.getAttribute("action");r=d?Mr(d,t):null,n=e.getAttribute("method")||Eu,s=Xf(e.getAttribute("enctype"))||Tu,c=new FormData(e)}else if(gA(e)||yA(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||d.getAttribute("action");if(r=f?Mr(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Eu,s=Xf(e.getAttribute("formenctype"))||Xf(d.getAttribute("enctype"))||Tu,c=new FormData(d,e),!wA()){let{name:h,type:g,value:m}=e;if(g==="image"){let y=h?`${h}.`:"";c.append(`${y}x`,"0"),c.append(`${y}y`,"0")}else h&&c.append(h,m)}}else{if(md(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Eu,r=null,s=Tu,u=e}return c&&s==="text/plain"&&(u=c,c=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:c,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Hm(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ok(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&Mr(s.pathname,t)==="/"?s.pathname=`${Fu(t)}/_root.${r}`:s.pathname=`${Fu(s.pathname)}.${r}`,s}async function jA(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 CA(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 NA(e,t,n){let r=await Promise.all(e.map(async s=>{let c=t.routes[s.route.id];if(c){let u=await jA(c,n);return u.links?u.links():[]}return[]}));return RA(r.flat(1).filter(CA).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function sx(e,t,n,r,s,c){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 c==="assets"?t.filter((f,h)=>u(f,h)||d(f,h)):c==="data"?t.filter((f,h)=>{var m;let g=r.routes[f.route.id];if(!g||!g.hasLoader)return!1;if(u(f,h)||d(f,h))return!0;if(f.route.shouldRevalidate){let y=f.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function EA(e,t,{includeHydrateFallback:n}={}){return TA(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let c=[s.module];return s.clientActionModule&&(c=c.concat(s.clientActionModule)),s.clientLoaderModule&&(c=c.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(c=c.concat(s.hydrateFallbackModule)),s.imports&&(c=c.concat(s.imports)),c}).flat(1))}function TA(e){return[...new Set(e)]}function AA(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function RA(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let c=JSON.stringify(AA(s));return n.has(c)||(n.add(c),r.push({key:c,link:s})),r},[])}function qm(){let e=w.useContext(co);return Hm(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function _A(){let e=w.useContext(hd);return Hm(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Gm=w.createContext(void 0);Gm.displayName="FrameworkContext";function Vm(){let e=w.useContext(Gm);return Hm(e,"You must render this element inside a <HydratedRouter> element"),e}function OA(e,t){let n=w.useContext(Gm),[r,s]=w.useState(!1),[c,u]=w.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:h,onMouseLeave:g,onTouchStart:m}=t,y=w.useRef(null);w.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let j=S=>{S.forEach(T=>{u(T.isIntersecting)})},E=new IntersectionObserver(j,{threshold:.5});return y.current&&E.observe(y.current),()=>{E.disconnect()}}},[e]),w.useEffect(()=>{if(r){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[r]);let x=()=>{s(!0)},k=()=>{s(!1),u(!1)};return n?e!=="intent"?[c,y,{}]:[c,y,{onFocus:sl(d,x),onBlur:sl(f,k),onMouseEnter:sl(h,x),onMouseLeave:sl(g,k),onTouchStart:sl(m,x)}]:[!1,y,{}]}function sl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function LA({page:e,...t}){let n=VT(),{router:r}=qm(),s=w.useMemo(()=>vk(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?n?w.createElement(MA,{page:e,matches:s,...t}):w.createElement(DA,{page:e,matches:s,...t}):null}function zA(e){let{manifest:t,routeModules:n}=Vm(),[r,s]=w.useState([]);return w.useEffect(()=>{let c=!1;return NA(e,t,n).then(u=>{c||s(u)}),()=>{c=!0}},[e,t,n]),r}function MA({page:e,matches:t,...n}){let r=Ua(),{future:s}=Vm(),{basename:c}=qm(),u=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let d=Ok(e,c,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]},[c,s.v8_trailingSlashAwareDataRequests,e,r,t]);return w.createElement(w.Fragment,null,u.map(d=>w.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function DA({page:e,matches:t,...n}){let r=Ua(),{future:s,manifest:c,routeModules:u}=Vm(),{basename:d}=qm(),{loaderData:f,matches:h}=_A(),g=w.useMemo(()=>sx(e,t,h,c,r,"data"),[e,t,h,c,r]),m=w.useMemo(()=>sx(e,t,h,c,r,"assets"),[e,t,h,c,r]),y=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let j=new Set,E=!1;if(t.forEach(T=>{var A;let N=c.routes[T.route.id];!N||!N.hasLoader||(!g.some(q=>q.route.id===T.route.id)&&T.route.id in f&&((A=u[T.route.id])!=null&&A.shouldRevalidate)||N.hasClientLoader?E=!0:j.add(T.route.id))}),j.size===0)return[];let S=Ok(e,d,s.v8_trailingSlashAwareDataRequests,"data");return E&&j.size>0&&S.searchParams.set("_routes",t.filter(T=>j.has(T.route.id)).map(T=>T.route.id).join(",")),[S.pathname+S.search]},[d,s.v8_trailingSlashAwareDataRequests,f,r,c,g,t,e,u]),x=w.useMemo(()=>EA(m,c),[m,c]),k=zA(m);return w.createElement(w.Fragment,null,y.map(j=>w.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),x.map(j=>w.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),k.map(({key:j,link:E})=>w.createElement("link",{key:j,nonce:n.nonce,...E,crossOrigin:E.crossOrigin??n.crossOrigin})))}function $A(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var IA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{IA&&(window.__reactRouterVersion="7.17.0")}catch{}function PA({basename:e,children:t,useTransitions:n,window:r}){let s=w.useRef();s.current==null&&(s.current=yT({window:r,v5Compat:!0}));let c=s.current,[u,d]=w.useState({action:c.action,location:c.location}),f=w.useCallback(h=>{n===!1?d(h):w.startTransition(()=>d(h))},[n]);return w.useLayoutEffect(()=>c.listen(f),[c,f]),w.createElement(hA,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:c,useTransitions:n})}var Lk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zk=w.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:c,replace:u,mask:d,state:f,target:h,to:g,preventScrollReset:m,viewTransition:y,defaultShouldRevalidate:x,...k},j){let{basename:E,navigator:S,useTransitions:T}=w.useContext(oa),N=typeof g=="string"&&Lk.test(g),A=kk(g,E);g=A.to;let q=JT(g,{relative:s}),R=Ua(),$=null;if(d){let D=fd(d,[],R.mask?R.mask.pathname:"/",!0);E!=="/"&&(D.pathname=D.pathname==="/"?E:Da([E,D.pathname])),$=S.createHref(D)}let[H,z,_]=OA(r,k),P=HA(g,{replace:u,mask:d,state:f,target:h,preventScrollReset:m,relative:s,viewTransition:y,defaultShouldRevalidate:x,useTransitions:T});function B(D){t&&t(D),D.defaultPrevented||P(D)}let W=!(A.isExternal||c),I=w.createElement("a",{...k,..._,href:(W?$:void 0)||A.absoluteURL||q,onClick:W?B:t,ref:$A(j,z),target:h,"data-discover":!N&&n==="render"?"true":void 0});return H&&!N?w.createElement(w.Fragment,null,I,w.createElement(LA,{page:q})):I});zk.displayName="Link";var UA=w.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:c,to:u,viewTransition:d,children:f,...h},g){let m=Pl(u,{relative:h.relative}),y=Ua(),x=w.useContext(hd),{navigator:k,basename:j}=w.useContext(oa),E=x!=null&&ZA(m)&&d===!0,S=k.encodeLocation?k.encodeLocation(m).pathname:m.pathname,T=y.pathname,N=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(T=T.toLowerCase(),N=N?N.toLowerCase():null,S=S.toLowerCase()),N&&j&&(N=Mr(N,j)||N);const A=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let q=T===S||!s&&T.startsWith(S)&&T.charAt(A)==="/",R=N!=null&&(N===S||!s&&N.startsWith(S)&&N.charAt(S.length)==="/"),$={isActive:q,isPending:R,isTransitioning:E},H=q?t:void 0,z;typeof r=="function"?z=r($):z=[r,q?"active":null,R?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let _=typeof c=="function"?c($):c;return w.createElement(zk,{...h,"aria-current":H,className:z,ref:g,style:_,to:u,viewTransition:d},typeof f=="function"?f($):f)});UA.displayName="NavLink";var BA=w.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:c,method:u=Eu,action:d,onSubmit:f,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:y,...x},k)=>{let{useTransitions:j}=w.useContext(oa),E=VA(),S=WA(d,{relative:h}),T=u.toLowerCase()==="get"?"get":"post",N=typeof d=="string"&&Lk.test(d),A=q=>{if(f&&f(q),q.defaultPrevented)return;q.preventDefault();let R=q.nativeEvent.submitter,$=(R==null?void 0:R.getAttribute("formmethod"))||u,H=()=>E(R||q.currentTarget,{fetcherKey:t,method:$,navigate:n,replace:s,state:c,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:y});j&&n!==!1?w.startTransition(()=>H()):H()};return w.createElement("form",{ref:k,method:T,action:S,onSubmit:r?f:A,...x,"data-discover":!N&&e==="render"?"true":void 0})});BA.displayName="Form";function FA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mk(e){let t=w.useContext(co);return Ut(t,FA(e)),t}function HA(e,{target:t,replace:n,mask:r,state:s,preventScrollReset:c,relative:u,viewTransition:d,defaultShouldRevalidate:f,useTransitions:h}={}){let g=Um(),m=Ua(),y=Pl(e,{relative:u});return w.useCallback(x=>{if(xA(x,t)){x.preventDefault();let k=n!==void 0?n:Tl(m)===Tl(y),j=()=>g(e,{replace:k,mask:r,state:s,preventScrollReset:c,relative:u,viewTransition:d,defaultShouldRevalidate:f});h?w.startTransition(()=>j()):j()}},[m,g,y,n,r,s,t,e,c,u,d,f,h])}var qA=0,GA=()=>`__${String(++qA)}__`;function VA(){let{router:e}=Mk("useSubmit"),{basename:t}=w.useContext(oa),n=uA(),r=e.fetch,s=e.navigate;return w.useCallback(async(c,u={})=>{let{action:d,method:f,encType:h,formData:g,body:m}=SA(c,t);if(u.navigate===!1){let y=u.fetcherKey||GA();await r(y,n,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:m,formMethod:u.method||f,formEncType:u.encType||h,flushSync:u.flushSync})}else await s(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:m,formMethod:u.method||f,formEncType:u.encType||h,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,s,t,n])}function WA(e,{relative:t}={}){let{basename:n}=w.useContext(oa),r=w.useContext(ir);Ut(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),c={...Pl(e||".",{relative:t})},u=Ua();if(e==null){c.search=u.search;let d=new URLSearchParams(c.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();c.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(c.pathname=c.pathname==="/"?n:Da([n,c.pathname])),Tl(c)}function ZA(e,{relative:t}={}){let n=w.useContext(Ck);Ut(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Mk("useViewTransitionState"),s=Pl(e,{relative:t});if(!n.isTransitioning)return!1;let c=Mr(n.currentLocation.pathname,r)||n.currentLocation.pathname,u=Mr(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Bu(s.pathname,u)!=null||Bu(s.pathname,c)!=null}var YA=gk();const QA="modulepreload",KA=function(e){return"/ui/"+e},ox={},Ba=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let u=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));s=u(n.map(h=>{if(h=KA(h),h in ox)return;ox[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":QA,g||(y.as="script"),y.crossOrigin="",y.href=h,f&&y.setAttribute("nonce",f),document.head.appendChild(y),g)return new Promise((x,k)=>{y.addEventListener("load",x),y.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function c(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"&&c(d.reason);return t().catch(c)})},lx=e=>{let t;const n=new Set,r=(h,g)=>{const m=typeof h=="function"?h(t):h;if(!Object.is(m,t)){const y=t;t=g??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(x=>x(t,y))}},s=()=>t,d={setState:r,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h))},f=t=e(r,s,d);return d},XA=(e=>e?lx(e):lx),JA=e=>e;function e2(e,t=JA){const n=Ze.useSyncExternalStore(e.subscribe,Ze.useCallback(()=>t(e.getState()),[e,t]),Ze.useCallback(()=>t(e.getInitialState()),[e,t]));return Ze.useDebugValue(n),n}const cx=e=>{const t=XA(e),n=r=>e2(t,r);return Object.assign(n,t),n},Ul=(e=>e?cx(e):cx),Dk="dkg-layout",t2=260,Qa={leftCollapsed:!1,rightCollapsed:!1,bottomCollapsed:!0,leftSectionMyProjectsOpen:!0,leftSectionIntegrationsOpen:!1,leftWidth:240,rightWidth:360,bottomHeight:t2},$k=140,Ik=400,Pk=200,Uk=500,Bk=120,Hu=600,n2=240;function a2(e,t){if(typeof document>"u")return t;const n=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),r=parseFloat(n);return Number.isFinite(r)?r:t}function qu(){const e=a2("--header-h",44),t=typeof window<"u"&&window.innerHeight?window.innerHeight:0;if(!t)return Hu;const n=t-e-n2;return Math.max(0,Math.min(Hu,n))}function Au(e,t,n){return Math.max(t,Math.min(n,e))}function Jf(e,t,n,r){return typeof e!="number"||!Number.isFinite(e)?t:Au(e,n,r)}function r2(){try{const e=localStorage.getItem(Dk);if(!e)return Qa;const t=JSON.parse(e);return{leftCollapsed:typeof t.leftCollapsed=="boolean"?t.leftCollapsed:Qa.leftCollapsed,rightCollapsed:typeof t.rightCollapsed=="boolean"?t.rightCollapsed:Qa.rightCollapsed,bottomCollapsed:typeof t.bottomCollapsed=="boolean"?t.bottomCollapsed:Qa.bottomCollapsed,leftSectionMyProjectsOpen:typeof t.leftSectionMyProjectsOpen=="boolean"?t.leftSectionMyProjectsOpen:Qa.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:typeof t.leftSectionIntegrationsOpen=="boolean"?t.leftSectionIntegrationsOpen:Qa.leftSectionIntegrationsOpen,leftWidth:Jf(t.leftWidth,Qa.leftWidth,$k,Ik),rightWidth:Jf(t.rightWidth,Qa.rightWidth,Pk,Uk),bottomHeight:Jf(t.bottomHeight,Qa.bottomHeight,Bk,Hu)}}catch{return Qa}}let cu=null;function Rr(e){cu&&clearTimeout(cu),cu=setTimeout(()=>{cu=null;try{localStorage.setItem(Dk,JSON.stringify(e))}catch{}},150)}function _r(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 fi=r2(),qn=Ul((e,t)=>({leftCollapsed:fi.leftCollapsed,rightCollapsed:fi.rightCollapsed,bottomCollapsed:fi.bottomCollapsed,bottomMaximised:!1,leftSectionMyProjectsOpen:fi.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:fi.leftSectionIntegrationsOpen,theme:localStorage.getItem("dkg-theme")||"dark",leftWidth:fi.leftWidth,rightWidth:fi.rightWidth,bottomHeight:fi.bottomHeight,toggleLeft:()=>{e(n=>({leftCollapsed:!n.leftCollapsed})),Rr(_r(t()))},toggleRight:()=>{e(n=>({rightCollapsed:!n.rightCollapsed})),Rr(_r(t()))},toggleBottom:()=>{e(n=>({bottomCollapsed:!n.bottomCollapsed,bottomMaximised:!1})),Rr(_r(t()))},toggleBottomMaximised:()=>{e(n=>({bottomMaximised:!n.bottomMaximised,bottomCollapsed:!1})),Rr(_r(t()))},toggleLeftSectionMyProjects:()=>{e(n=>({leftSectionMyProjectsOpen:!n.leftSectionMyProjectsOpen})),Rr(_r(t()))},toggleLeftSectionIntegrations:()=>{e(n=>({leftSectionIntegrationsOpen:!n.leftSectionIntegrationsOpen})),Rr(_r(t()))},setTheme:n=>{localStorage.setItem("dkg-theme",n),e({theme:n})},setLeftWidth:n=>{e({leftWidth:Au(n,$k,Ik)}),Rr(_r(t()))},setRightWidth:n=>{e({rightWidth:Au(n,Pk,Uk)}),Rr(_r(t()))},setBottomHeight:n=>{const r=Math.min(Bk,qu());e({bottomHeight:Au(n,r,Hu)}),Rr(_r(t()))}})),Fk=Ul(e=>({agents:[],activeAgentName:null,nodeStatus:null,setAgents:t=>e({agents:t}),setActiveAgent:t=>e({activeAgentName:t}),setNodeStatus:t=>e({nodeStatus:t})})),i2=[{id:"dashboard",label:"Dashboard",closable:!1}],yn=Ul((e,t)=>({tabs:i2,activeTabId:"dashboard",openTab:n=>{const{tabs:r}=t();r.find(s=>s.id===n.id)?e({activeTabId:n.id}):e({tabs:[...r,n],activeTabId:n.id})},closeTab:n=>{var d;const{tabs:r,activeTabId:s}=t(),c=r.filter(f=>f.id!==n);if(c.length===0)return;const u=s===n?((d=c[Math.max(0,r.findIndex(f=>f.id===n)-1)])==null?void 0:d.id)??c[0].id:s;e({tabs:c,activeTabId:u})},setActiveTab:n=>e({activeTabId:n})})),Fa="",ux="did:dkg:context-graph:",Hk=6e4;function qk(e){const t=e.trim();return t.startsWith(ux)?t.slice(ux.length):t}function s2(e){if(e.authorAgentAddress!=null&&e.preSignedAuthorAttestation!=null)throw new Error("authorAgentAddress and preSignedAuthorAttestation are mutually exclusive")}function qt(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}class Pa extends Error{constructor(n,r,s){super(r??`HTTP ${n}`);Sn(this,"status");Sn(this,"body");this.status=n,this.body=s}}class Qh extends Error{constructor(n,r={}){super(n);Sn(this,"status");Sn(this,"code");Sn(this,"source");Sn(this,"details");Sn(this,"correlationId");Sn(this,"timeoutMs");Sn(this,"target");Sn(this,"route");Sn(this,"integrationId");Sn(this,"retryable");this.name="LocalAgentApiError",Object.assign(this,r)}}async function Wm(e,t={},n=1e4){try{return await fetch(e,{...t,signal:AbortSignal.timeout(n)})}catch(r){throw r instanceof Error&&r.name==="TimeoutError"?new Error(`Request timed out after ${Math.round(n/1e3)}s`):r}}async function lt(e){const t=await fetch(`${Fa}${e}`,{headers:qt()});if(!t.ok){const n=await t.json().catch(()=>({})),r=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Pa(t.status,r,n)}return t.json()}async function Gk(e,t){const n=await Wm(`${Fa}${e}`,{headers:qt()},t);if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Pa(n.status,s,r)}return n.json()}async function Gt(e,t){const n=await fetch(`${Fa}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...qt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Pa(n.status,s,r)}return n.json()}async function Zm(e,t){const n=await fetch(`${Fa}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...qt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}async function Vk(e){const t=await fetch(`${Fa}${e}`,{method:"DELETE",headers:qt()});if(!t.ok){const n=await t.json().catch(()=>({})),r=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Pa(t.status,r,n)}return t.json()}const Ym=()=>lt("/api/status"),A7=()=>lt("/api/settings/retention"),R7=e=>Zm("/api/settings/retention",{retentionDays:e}),_7=()=>lt("/api/settings/telemetry"),O7=e=>Zm("/api/settings/telemetry",{enabled:e}),o2=()=>lt("/api/connections"),l2=(e,t=1e4)=>Wm(`${Fa}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...qt()},body:JSON.stringify({multiaddr:e})},t).then(async n=>{if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}),c2=(e,t=2e4)=>Wm(`${Fa}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...qt()},body:JSON.stringify({peerId:e})},t).then(async n=>{if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}),Qm=()=>lt("/api/agents"),u2=()=>lt("/api/metrics"),L7=(e,t,n=300)=>lt(`/api/metrics/history?from=${e}&to=${t}&maxPoints=${n}`),d2=(e={})=>{const t=new URLSearchParams({...e,phases:"1"}).toString();return lt(`/api/operations?${t}`)},z7=e=>lt(`/api/operations/${e}`),M7=e=>{const t=e?`?periodMs=${e}`:"";return lt(`/api/error-hotspots${t}`)},D7=(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 lt(`/api/failed-operations${n?"?"+n:""}`)},$7=e=>lt(`/api/replication/summary${e?`?periodMs=${e}`:""}`),I7=e=>lt(`/api/replication/per-cg${e?`?periodMs=${e}`:""}`),P7=(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 lt(`/api/replication/timeline${n?"?"+n:""}`)},U7=()=>lt("/api/replication/cursors"),B7=(e,t=100)=>lt(`/api/replication/events?cg=${encodeURIComponent(e)}&limit=${t}`),F7=e=>lt(`/api/success-rates?periodMs=${e}`),H7=(e,t)=>{const n=`periodMs=${e}${t?`&bucketMs=${t}`:""}`;return lt(`/api/per-type-stats?${n}`)},p2=(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 lt(`/api/node-log${n?"?"+n:""}`)};async function Km(){return{contextGraphs:((await Gk("/api/context-graph/list",Hk)).contextGraphs??[]).filter(n=>!n.isSystem)}}const gd=()=>lt("/api/agent/identity");async function f2(e,t,n,r){const s=new AbortController,c=setTimeout(()=>s.abort(),3e4);try{const u=await fetch(`${Fa}/api/context-graph/create`,{method:"POST",headers:{"Content-Type":"application/json",...qt()},body:JSON.stringify({id:e,name:t,description:n,...r!=null&&r.register?{register:!0}:{},...r!=null&&r.allowedAgents?{allowedAgents:r.allowedAgents}:{},...(r==null?void 0:r.accessPolicy)!==void 0?{accessPolicy:r.accessPolicy}:{},...(r==null?void 0:r.publishPolicy)!==void 0?{publishPolicy:r.publishPolicy}:{}}),signal:s.signal});if(!u.ok){const d=await u.json().catch(()=>({}));throw new Error((d==null?void 0:d.error)??`HTTP ${u.status}`)}return u.json()}catch(u){throw u.name==="AbortError"?new Error("Creating project is taking longer than expected — it may still complete in the background. Refresh the page in a moment."):u}finally{clearTimeout(c)}}const h2=(e,t)=>Gt(`/api/context-graph/${encodeURIComponent(e)}/remove-participant`,{agentAddress:t}),Wk=e=>lt(`/api/context-graph/${encodeURIComponent(e)}/participants`),m2=e=>Gt(`/api/context-graph/${encodeURIComponent(e)}/sign-join`,{}),g2=(e,t)=>Gt(`/api/context-graph/${encodeURIComponent(e)}/request-join`,t),Zk=e=>lt(`/api/context-graph/${encodeURIComponent(e)}/join-requests`),Xm=(e,t)=>Gt(`/api/context-graph/${encodeURIComponent(e)}/approve-join`,{agentAddress:t}),Jm=(e,t)=>Gt(`/api/context-graph/${encodeURIComponent(e)}/reject-join`,{agentAddress:t}),v2={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 y2(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 v2[t]}async function Yk(e,t,n,r){const s=new FormData;s.append("file",n),s.append("contextGraphId",t);const c=y2(n);c&&s.append("contentType",c);const u=await fetch(`${Fa}/api/knowledge-assets/${encodeURIComponent(e)}/wm/import-file`,{method:"POST",headers:qt(),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 eh=new Map;function Gu(e){const t=JSON.stringify(e),n=eh.get(t);if(n)return n;const r=(async()=>{const s=await fetch(`${Fa}/api/query`,{method:"POST",headers:{"Content-Type":"application/json",...qt()},body:t});if(!s.ok){const c=await s.json().catch(()=>({})),u=(c==null?void 0:c.error)??`HTTP ${s.status}`;throw new Pa(s.status,u,c)}return s.json()})().finally(()=>{eh.delete(t)});return eh.set(t,r),r}const ia=(e,t,n,r,s,c)=>Gu({sparql:e,contextGraphId:t,includeSharedMemory:n,graphSuffix:r,view:s,includeContextGraphPartitions:c});async function b2(e){var c,u,d;const n=`SELECT ?name ?ual WHERE {
62
- GRAPH <${`did:dkg:context-graph:${e}/_meta`}> {
63
- ?lc <http://dkg.io/ontology/assertionName> ?name ;
64
- <http://dkg.io/ontology/reservedUal> ?ual .
65
- }
66
- }`,r=await ia(n,e),s={};for(const f of((c=r==null?void 0:r.result)==null?void 0:c.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 x2=(e,t)=>Gt("/api/profile/query-catalog/write",{contextGraphId:e,quads:t}),w2=new Set(["clearAfter","publishEpochs","publisherNodeIdentityIdOverride"]),k2=e=>{if(typeof e=="string"&&/^\d+$/.test(e))return e;throw new Error("publisherNodeIdentityIdOverride must be passed as a decimal string")},S2=(e,t=[])=>{if(!e)return;const n=Object.keys(e).filter(c=>!w2.has(c)&&!t.includes(c));if(n.length>0)throw new Error(`Unsupported finalized publish option(s): ${n.join(", ")}`);const r={};e.clearAfter!==void 0&&(r.clearSharedMemoryAfter=e.clearAfter),e.publishEpochs!==void 0&&(r.publishEpochs=e.publishEpochs);const s=e.publisherNodeIdentityIdOverride;return s!==void 0&&(r.publisherNodeIdentityIdOverride=k2(s)),Object.keys(r).length>0?r:void 0},Vu=(e,t,n={})=>(s2(n),Gt(`/api/knowledge-assets/${encodeURIComponent(t)}/wm/finalize`,{contextGraphId:qk(e),...n})),dx=(e,t,n={})=>{const r=S2(n,["subGraphName"]);return Gt(`/api/knowledge-assets/${encodeURIComponent(t)}/vm/publish`,{contextGraphId:qk(e),...n.subGraphName?{subGraphName:n.subGraphName}:{},...r?{options:r}:{}})};class eg extends Error{constructor(t){super(t??"Share the full asset to Shared Memory before publishing."),this.name="SwmSubsetNotSealableError"}}async function tg(e,t,n={}){var r,s,c;try{return await dx(e,t,n)}catch(u){const d=u instanceof Pa&&u.status===409?(r=u.body)==null?void 0:r.code:void 0;if(d!=="PUBLISH_NOT_FULL_SHARE"&&d!=="VM_PUBLISH_PRECONDITION")throw u;try{await Vu(e,t,{layer:"swm",...n.subGraphName?{subGraphName:n.subGraphName}:{}})}catch(h){throw h instanceof Pa&&h.status===409&&((s=h.body)==null?void 0:s.code)==="SWM_SUBSET_NOT_SEALABLE"?new eg((c=h.body)==null?void 0:c.error):h}return{...await dx(e,t,n),sealed:!0}}}async function ng(e,t){let n=0,r=0,s=0,c;const u=[];let d=null;for(const f of t)try{const h=await tg(e,f.name,f.subGraph?{subGraphName:f.subGraph}:{});n+=1,h.sealed&&(r+=1),h.contextGraphError&&(s+=1,c===void 0&&(c=h.contextGraphError));const g=h;(!d||g.status==="confirmed"&&g.txHash&&!g.contextGraphError)&&(d=g)}catch(h){const g=h instanceof eg?h.message:(h==null?void 0:h.message)??"publish failed";u.push({name:f.name,...f.subGraph?{subGraph:f.subGraph}:{},error:g})}return{published:n,total:t.length,sealed:r,partial:s,partialError:c,failures:u,sample:d}}async function Al(e,t="wm"){var j,E,S,T,N,A,q,R;if(t==="swm"){const $=`did:dkg:context-graph:${e}/_meta`,H=`did:dkg:context-graph:${e}/`,z=`urn:dkg:assertion:${e}:`,_=`SELECT ?g ?vm WHERE {
67
- GRAPH <${$}> {
68
- ?g <http://dkg.io/ontology/memoryLayer> "SWM"
69
- OPTIONAL { ?g <http://dkg.io/ontology/vmCurrentAssertion> ?vm }
70
- }
71
- FILTER(!CONTAINS(STR(?g), "/meta/assertion/"))
72
- }`,P=await ia(_,e),B=((j=P==null?void 0:P.result)==null?void 0:j.bindings)??[],W=new Set,I=[];for(const V of B){const X=typeof V.g=="string"?V.g:(E=V.g)==null?void 0:E.value;if(!X)continue;const Q=typeof V.vm=="string"?V.vm:(S=V.vm)==null?void 0:S.value;let L,U;if(X.startsWith(H)){const O=X.slice(H.length).split("/");if(O.length===3&&O[0]==="assertion")U=O[2];else if(O.length===4&&O[1]==="assertion")L=O[0],U=O[3];else continue}else if(X.startsWith(z)){const O=X.slice(z.length);let ne=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(O);ne?U=ne[2]:(ne=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(O),ne&&(L=ne[1],U=ne[3]))}else continue;if(!U||L==="meta")continue;const G=`${L??""} ${U}`;I.push({key:G,name:U,subGraph:L,g:X}),Q&&W.add(G)}const D=new Set,F=[];for(const V of I)W.has(V.key)||D.has(V.key)||(D.add(V.key),F.push({name:V.name,graphUri:V.g,subGraph:V.subGraph}));return F}const n=`did:dkg:context-graph:${e}/_meta`,r=`did:dkg:context-graph:${e}/`,s='FILTER(!CONTAINS(STR(?g), "/meta/assertion/"))',c=`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([Gu({sparql:c,contextGraphId:e,includeContextGraphPartitions:!0}),Gu({sparql:u,contextGraphId:e,includeContextGraphPartitions:!0}).catch(()=>null)]),h=((T=d==null?void 0:d.result)==null?void 0:T.bindings)??[],g=new Map;for(const $ of((N=f==null?void 0:f.result)==null?void 0:N.bindings)??[]){const H=typeof $.g=="string"?$.g:(A=$.g)==null?void 0:A.value,z=typeof $.cnt=="string"?$.cnt:(q=$.cnt)==null?void 0:q.value,_=typeof z=="string"?z.match(/^"?(\d+)/):null,P=_?parseInt(_[1],10):NaN;H&&Number.isFinite(P)&&g.set(H,P)}const m=[],y=new Set,x=`urn:dkg:assertion:${e}:`,k=[...h].sort(($,H)=>{var P,B;const z=(typeof $.g=="string"?$.g:(P=$.g)==null?void 0:P.value)??"",_=(typeof H.g=="string"?H.g:(B=H.g)==null?void 0:B.value)??"";return(z.startsWith(r)?0:1)-(_.startsWith(r)?0:1)});for(const $ of k){const H=typeof $.g=="string"?$.g:(R=$.g)==null?void 0:R.value;if(!H)continue;let z,_;if(H.startsWith(r)){const W=H.slice(r.length).split("/");if(W.length===3&&W[0]==="assertion")_=W[2];else if(W.length===4&&W[1]==="assertion")z=W[0],_=W[3];else continue}else if(H.startsWith(x)){const W=H.slice(x.length);let I=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(W);I?_=I[2]:(I=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(W),I&&(z=I[1],_=I[3]))}else continue;if(!_||z==="meta")continue;const P=`${z??""}\0${_}`;if(y.has(P))continue;y.add(P);const B=g.get(H);m.push({name:_,graphUri:H,tripleCount:B,subGraph:z})}return m}const eo=(e,t,n="all",r)=>Gt(`/api/knowledge-assets/${encodeURIComponent(t)}/swm/share`,{contextGraphId:e,entities:n,...r?{subGraphName:r}:{}});function ag(e,t){return t.promotedCount>0?{kind:"success",promotedCount:t.promotedCount,message:`Promoted ${t.promotedCount} triple${t.promotedCount===1?"":"s"} from ${e} to Shared Working Memory.`}:{kind:"noop",message:`${e} had no triples to promote. It may already be in Shared Working Memory, or the extracted content is still being committed — refresh and try again.`}}function to(e,t){if(t instanceof Pa&&t.status===413){const n=t.body;if((n==null?void 0:n.code)==="SWM_GOSSIP_PAYLOAD_TOO_LARGE"){const r=typeof n.hint=="string"&&n.hint.length>0?n.hint:"Promote fewer entities per call or split the assertion into smaller root-entity batches.";return{kind:"payload-too-large",actualBytes:typeof n.actualBytes=="number"?n.actualBytes:void 0,limitBytes:typeof n.limitBytes=="number"?n.limitBytes:void 0,message:`${e} is too large to promote to Shared Working Memory. ${r}`}}}if(t instanceof Pa&&t.status===409){const n=t.body;if((n==null?void 0:n.code)==="ASSERTION_NOT_PERSISTED"){const r=typeof n.expectedTripleCount=="number"?n.expectedTripleCount:void 0;return{kind:"not-persisted",expectedTripleCount:r,message:r?`${e} was imported with ${r} extracted triple${r===1?"":"s"} but the data graph is empty. Re-import the source file (or re-write the assertion) before promoting.`:`${e}'s data graph is empty but its extraction metadata says it should hold content. Re-import the source file before promoting.`}}}return null}const j2=(e,t,n)=>{const r=new URLSearchParams({contextGraphId:t});return n&&r.set("subGraphName",n),lt(`/api/knowledge-assets/${encodeURIComponent(e)}/wm/extraction-status?${r}`)};function Ru(e,t){const n=e.startsWith("sha256:")||e.startsWith("keccak256:")?e:`sha256:${e}`,r=t?`?contentType=${encodeURIComponent(t)}`:"";return`${Fa}/api/file/${encodeURIComponent(n)}${r}`}const C2="binding incomplete";function Rl(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 N2=(e=20)=>lt(`/api/memory/sessions?limit=${e}`),E2=(e,t={})=>{const n=new URLSearchParams;t.limit&&Number.isInteger(t.limit)&&t.limit>0&&n.set("limit",String(t.limit)),(t.order==="desc"||t.order==="asc")&&n.set("order",t.order);const r=n.toString();return lt(`/api/memory/sessions/${encodeURIComponent(e)}${r?`?${r}`:""}`)};function Qk(e,t){var n,r,s;return{text:e,correlationId:(t==null?void 0:t.correlationId)??crypto.randomUUID(),...t!=null&&t.identity?{identity:t.identity}:{},...t!=null&&t.sessionId?{sessionId:t.sessionId}:{},...t!=null&&t.profile?{profile:t.profile}:{},...t!=null&&t.persistUserMessage?{persistUserMessage:t.persistUserMessage}:{},...(n=t==null?void 0:t.attachments)!=null&&n.length?{attachmentRefs:t.attachments}:{},...(r=t==null?void 0:t.attachmentImportResults)!=null&&r.length?{attachmentImportResults:t.attachmentImportResults}:{},...(s=t==null?void 0:t.contextEntries)!=null&&s.length?{contextEntries:t.contextEntries}:{},...t!=null&&t.contextGraphId?{contextGraphId:t.contextGraphId}:{}}}async function T2(e,t={}){var m;const n=await fetch("/api/openclaw-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...qt()},body:JSON.stringify(Qk(e,t)),signal:t.signal});if(!n.ok){const y=await n.json().catch(()=>({}));throw Wu(y,`Request failed (${n.status})`,n.status)}const r=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!r.includes("text/event-stream")){const y=await n.json();return(m=t.onEvent)==null||m.call(t,{type:"final",...y}),y}const s=n.body.getReader(),c=new TextDecoder;let u="",d,f;const h=y=>{var x;(x=t.onEvent)==null||x.call(t,y),y.type==="error"?f=Wu(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 x=u.indexOf(`
83
- `);for(;x!==-1;){const k=u.slice(0,x).trim();if(u=u.slice(x+1),x=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:x}=await s.read();if(y||(u+=c.decode(x,{stream:!0}),g(!1),f))break}if(u+=c.decode(),g(!0),f)throw f;if(!d)throw new Error("Stream ended without final payload");return d}const A2=()=>lt("/api/openclaw-channel/health");async function R2(e,t={}){var y;const n=await fetch("/api/hermes-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...qt()},body:JSON.stringify(Qk(e,t)),signal:t.signal});if(!n.ok){const x=await n.json().catch(()=>({}));throw Wu(x,`Request failed (${n.status})`,n.status)}const r=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!r.includes("text/event-stream")){const x=await n.json();return(y=t.onEvent)==null||y.call(t,{type:"final",...x}),x}const s=n.body.getReader(),c=new TextDecoder;let u="",d,f;const h=x=>x.type==="delta"?{type:"text_delta",delta:x.text??""}:x,g=x=>{var k;(k=t.onEvent)==null||k.call(t,x),x.type==="error"?f=Wu(x,x.error||"Stream failed"):x.type==="final"&&(d={text:x.text,correlationId:x.correlationId,...x.sessionId?{sessionId:x.sessionId}:{},...x.turnId?{turnId:x.turnId}:{}})},m=x=>{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 E=j.slice(5).trim();if(E){try{g(h(JSON.parse(E)))}catch{}if(f)return}}if(x&&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:x,value:k}=await s.read();if(x||(u+=c.decode(k,{stream:!0}),m(!1),f))break}if(u+=c.decode(),m(!0),f)throw f;if(!d)throw new Error("Stream ended without final payload");return d}const _2=()=>lt("/api/hermes-channel/health");function O2(e,t){if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e,r=typeof n.error=="string"&&n.error.trim()?n.error.trim():t;if(n.details===void 0||n.details===null)return r;const s=typeof n.details=="string"?n.details.trim():JSON.stringify(n.details);return!s||s===r?r:`${r}: ${s}`}function Wu(e,t,n){if(!e||typeof e!="object"||Array.isArray(e))return new Qh(t,{status:n});const r=e,s=O2(r,t),c=f=>{const h=r[f];return typeof h=="string"&&h.trim()?h.trim():void 0},u=f=>{const h=r[f];return typeof h=="number"&&Number.isFinite(h)?h:void 0},d=f=>{const h=r[f];return typeof h=="boolean"?h:void 0};return new Qh(s,{status:n,code:c("code"),source:c("source"),details:c("details"),correlationId:c("correlationId"),timeoutMs:u("timeoutMs"),target:c("target"),route:c("route"),integrationId:c("integrationId"),retryable:d("retryable")})}const vd={openclaw:{connectSupported:!0,chatSupported:!0,defaultSessionId:({integrationId:e})=>`${e}:dkg-ui`,resolveChatContext:({integrationId:e,sessionId:t})=>{if(!t)return{};const n=`${e}:dkg-ui:`;if(!t.startsWith(n))return{};const r=t.slice(n.length).trim();return r?{identity:r}:{}},fetchHealth:A2,streamChat:T2},hermes:{connectSupported:!0,chatSupported:!0,defaultSessionId:({integrationId:e,record:t,health:n})=>$2(e,t,n),resolveChatContext:({sessionId:e,profile:t})=>({...e?{sessionId:e}:{},...t?{profile:t}:{}}),fetchHealth:_2,streamChat:R2}};function Zs(e){var n,r;const t=e.trim().toLowerCase();return((r=(n=vd[t])==null?void 0:n.defaultSessionId)==null?void 0:r.call(n,{integrationId:t}))??null}function L2(e,t){return t!=null&&t.trim()?t.trim():Zs(e)}async function z2(e,t=50){const n=r=>{if(r.turnId)return`urn:dkg:chat:turn:${encodeURIComponent(r.turnId)}:${encodeURIComponent(r.author)}`;const s=`${e}
87
- ${r.author}
88
- ${r.ts}
89
- ${r.text}`;let c=2166136261;for(let u=0;u<s.length;u+=1)c^=s.charCodeAt(u),c=Math.imul(c,16777619);return`urn:dkg:chat:session:${encodeURIComponent(e)}:message:${(c>>>0).toString(16)}`};try{return[...(await E2(e,{limit:t,order:"desc"})).messages].reverse().map(s=>({uri:s.uri||n(s),text:s.text,author:s.author,ts:s.ts,turnId:s.turnId,persistStatus:s.persistStatus,failureReason:s.failureReason,attachmentRefs:s.attachmentRefs,toolCalls:s.toolCalls}))}catch(r){if(r instanceof Pa&&r.status===404)return[];throw r}}function M2(e){var t,n,r;return!!((t=e.transport)!=null&&t.bridgeUrl||(n=e.transport)!=null&&n.gatewayUrl||(r=e.transport)!=null&&r.healthUrl)}function Kh(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return null}function D2(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 $2(e,t,n){const r=(t==null?void 0:t.metadata)??{},s=Kh(n==null?void 0:n.profile,r.profileName,r.profile),c=Kh(r.hermesHome),u=c?null:I2(t),d=[s?`profile-${D2(s)}`:null,c?`home-${rg(c)}`:null,u].filter(f=>f!=null);return d.length?`${e}:dkg-ui:${d.join(":")}`:`${e}:dkg-ui`}function I2(e){const t=e==null?void 0:e.transport;if(!t)return null;const n=[t.kind,t.bridgeUrl,t.gatewayUrl,t.healthUrl].filter(r=>typeof r=="string"&&r.trim().length>0);return n.length?`transport-${rg(n.join("|"))}`:null}function P2(e){return e?typeof e=="string"?e:[e.provider,e.mode,e.status].filter(Boolean).join(" / ")||null:null}function U2(e,t){if(e==="degraded")return!0;const n=String((t==null?void 0:t.status)??"").toLowerCase(),r=t==null?void 0:t.memory;return n.includes("degraded")||n.includes("conflict")||typeof r=="object"&&r!=null&&r.conflict===!0}function Kk(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function px(e){if(!Kk(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 B2(e){if(e.target==="bridge")return{target:"bridge",details:e.bridge};if(e.target==="gateway")return{target:"gateway",details:e.gateway};const t=px(e.bridge),n=px(e.gateway);return t<0&&n<0?{}:t>=n?{target:"bridge",details:e.bridge}:{target:"gateway",details:e.gateway}}function F2(e){if(!e)return null;const{target:t,details:n}=B2(e);if(!Kk(n))return e;const r=typeof n.ok=="boolean"?n.ok:void 0;return{...n,...e,ok:e.ok===!1?!1:r??e.ok,target:e.target??t,profile:e.profile??n.profile,memory:e.memory??n.memory,status:e.status??n.status,error:e.error??n.error}}function H2(e,t){if(String(e.id??"").toLowerCase()!=="hermes")return null;const n=t==null?void 0:t.profile,r=n?`profile ${n}`:"the configured profile",s=P2(t==null?void 0:t.memory),c=typeof(t==null?void 0:t.memory)=="object"&&t.memory!=null?t.memory:null;return(c==null?void 0:c.conflict)===!0||String((t==null?void 0:t.status)??"").toLowerCase().includes("conflict")?`${e.name} ${r} has a memory provider conflict${s?` (${s})`:""}.`:t!=null&&t.ok?`${e.name} ${r} is connected${s?` with ${s} memory`:""}.`:t!=null&&t.status?`${e.name} ${r} reports ${t.status}${s?` (${s})`:""}.`:null}async function ig(e){var A,q,R,$,H,z,_,P,B,W,I,D,F,V;const t=String(e.id??"").toLowerCase(),n=vd[t],r=((A=e.capabilities)==null?void 0:A.localChat)===!0&&(n==null?void 0:n.chatSupported)===!0,s=r&&((q=e.capabilities)==null?void 0:q.chatAttachments)===!0,c=((R=e.capabilities)==null?void 0:R.connectFromUi)===!0&&(n==null?void 0:n.connectSupported)===!0,u=e.enabled===!0,d=($=e.runtime)==null?void 0:$.status,f=u&&r&&(n!=null&&n.fetchHealth)?F2(await n.fetchHealth().catch(()=>null)):null,h=U2(d,f),g=(f==null?void 0:f.ok)===!0&&!h,m=g,y=u&&r&&(g||d==="connecting"||d==="degraded"||((H=e.runtime)==null?void 0:H.ready)===!0||M2(e)),x=H2(e,f),k=(z=n==null?void 0:n.defaultSessionId)==null?void 0:z.call(n,{integrationId:t,record:e,health:f}),j=t==="hermes"?Kh(f==null?void 0:f.profile,(_=e.metadata)==null?void 0:_.profileName,(P=e.metadata)==null?void 0:P.profile):void 0;let E,S,T;y&&h?(E="degraded",S="Degraded",T=x??(f==null?void 0:f.error)??((B=e.runtime)==null?void 0:B.lastError)??`${e.name} is attached to this node, but one capability is degraded.`):y&&((W=e.runtime)==null?void 0:W.status)==="connecting"?(E="connecting",S="Connecting",T=((I=e.runtime)==null?void 0:I.lastError)??`${e.name} is registered and still starting up.`):m?(E="chat_ready",S="Chat ready",T=`${e.name} is connected to this node and ready for chat.`):y?(E="bridge_offline",S="Bridge offline",T=x??(f==null?void 0:f.error)??((D=e.runtime)==null?void 0:D.lastError)??`${e.name} is attached to this node, but it is not responding right now.`):n?(E="available",S=c?"Ready to connect":"Awaiting chat bridge",T=u?`${e.name} is registered, but this panel is waiting for the framework chat bridge.`:((F=e.runtime)==null?void 0:F.lastError)??`Use the node-served skill plus ${e.name} onboarding to attach an existing local agent.`):(E="coming_soon",S=u?"Registered, panel pending":"Next integration",T=u?`${e.name} is registered on the node, but the right-panel chat bridge is not wired yet.`:"The local-agent registry is in place so this framework can plug into the same side-panel flow next.");const N=m?"Connected":E==="connecting"?"Connecting":E==="degraded"?"Degraded":y?"Unavailable":c?"Ready to connect":"Coming next";return{id:t,name:e.name,framework:e.name,description:e.description,defaultSessionId:k,profile:j,chatSupported:r,chatAttachments:s,connectSupported:c,configured:u,detected:u||g,persistentChat:y,chatReady:g,bridgeOnline:m,bridgeStatusLabel:N,status:E,statusLabel:S,detail:T,error:g?void 0:(f==null?void 0:f.error)??((V=e.runtime)==null?void 0:V.lastError)??void 0,target:f==null?void 0:f.target,source:u||n?"live":"planned"}}async function yd(){const e=await lt("/api/local-agent-integrations"),t=await Promise.all((e.integrations??[]).map(ig));return t.sort((n,r)=>{const s=n.id==="openclaw"?0:1,c=r.id==="openclaw"?0:1;return s!==c?s-c:n.persistentChat!==r.persistentChat?n.persistentChat?-1:1:n.name.localeCompare(r.name)}),{integrations:t}}async function q2(e){const t=e.trim().toLowerCase(),n=vd[t];if(!(n!=null&&n.connectSupported))throw new Error(`${e} local connect is not available yet.`);const r=await Gt("/api/local-agent-integrations/connect",{id:t,metadata:{source:"node-ui"}}),s=r.integration?await ig(r.integration):(await yd()).integrations.find(c=>c.id===t);if(!s)throw new Error(`Missing local agent integration: ${t}`);return{integration:s,notice:r.notice}}async function G2(e){const t=e.trim().toLowerCase();await Zm(`/api/local-agent-integrations/${encodeURIComponent(t)}`,{enabled:!1,runtime:{status:"disconnected",ready:!1,lastError:null}})}async function V2(e){const t=e.trim().toLowerCase(),n=await Gt(`/api/local-agent-integrations/${encodeURIComponent(t)}/refresh`,{}),r=n.integration?await ig(n.integration):(await yd()).integrations.find(s=>s.id===t);if(!r)throw new Error(`Missing local agent integration: ${t}`);return{integration:r,notice:n.notice}}async function fx(e,t=50,n={}){const r=L2(e,n.sessionId);return r?z2(r,t):[]}async function W2(e){var n;const t=(n=e.sessionId)==null?void 0:n.trim();if(!t)throw new Error("Missing Hermes session id");return Gt("/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 Z2(e,t){if(e.trim().toLowerCase()==="hermes")return W2(t);throw new Error(`${e} local chat persistence is not available yet.`)}async function Y2(e,t,n={}){var c;const r=e.trim().toLowerCase(),s=vd[r];if(s!=null&&s.streamChat){const{sessionId:u,profile:d,...f}=n;return s.streamChat(t,{...f,...(c=s.resolveChatContext)==null?void 0:c.call(s,{integrationId:r,sessionId:u,profile:d})})}throw new Error(`${e} local chat is not available yet.`)}const Q2=()=>lt("/api/economics"),K2=()=>lt("/api/wallets/balances"),q7=()=>lt("/api/pca/contracts"),G7=()=>lt("/api/pca"),V7=(e,t)=>lt(`/api/pca/${encodeURIComponent(e)}`),W7=(e,t)=>Gt("/api/pca",{tokens:e,primaryNode:t}),Z7=(e,t)=>Gt(`/api/pca/${encodeURIComponent(e)}/funds`,{tokens:t}),Y7=e=>Gt(`/api/pca/${encodeURIComponent(e)}/settle`,{}),Q7=(e,t)=>Gt(`/api/pca/${encodeURIComponent(e)}/agent`,{agent:t}),K7=(e,t)=>Vk(`/api/pca/${encodeURIComponent(e)}/agent/${encodeURIComponent(t)}`),X7=(e,t)=>Gt(`/api/pca/${encodeURIComponent(e)}/primary-node`,{node:t}),J7=()=>lt("/api/operational-wallets"),eq=e=>Gt("/api/operational-wallets",{address:e}),tq=e=>Vk(`/api/operational-wallets/${encodeURIComponent(e)}`),nq=e=>lt(`/api/agent/${encodeURIComponent(e)}/encryption-keys`),aq=(e,t)=>Gt(`/api/agent/${encodeURIComponent(e)}/rotate-encryption-key`,{retireOld:t}),rq=(e,t)=>Gt(`/api/agent/${encodeURIComponent(e)}/revoke-encryption-key`,{keyId:t}),iq=()=>Gt("/api/agent/publish-profile",{}),sq=()=>Gt("/api/shutdown",{}),X2=()=>lt("/api/notifications"),Xk=e=>Gt("/api/notifications/read",e?{ids:e}:{}),sg=e=>Gk(`/api/sub-graph/list?contextGraphId=${encodeURIComponent(e)}`,Hk),J2={name:"my-dkg-node",networkName:"DKG Mainnet",connectedPeers:12,synced:!0,version:"10.0.0-rc"},eR={total_kcs:1842,confirmed_kcs:1623,tentative_kcs:219},tR={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}]},nR={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"}]},aR={"cg:pharma-drug-interactions":{contextGraphId:"cg:pharma-drug-interactions",allowedAgents:["0x2222222222222222222222222222222222222222","0x3333333333333333333333333333333333333333"]},"cg:climate-science":{contextGraphId:"cg:climate-science",allowedAgents:["0x4444444444444444444444444444444444444444"]},"cg:supply-chain-eu":{contextGraphId:"cg:supply-chain-eu",allowedAgents:[]}},rR={operations:[{id:"op-1",name:"publish",status:"completed",startedAt:Date.now()-12e4},{id:"op-2",name:"query",status:"completed",startedAt:Date.now()-3e5},{id:"op-3",name:"publish",status:"completed",startedAt:Date.now()-6e5},{id:"op-4",name:"chat",status:"completed",startedAt:Date.now()-9e5},{id:"op-5",name:"sync",status:"failed",startedAt:Date.now()-18e5},{id:"op-6",name:"publish",status:"completed",startedAt:Date.now()-36e5}],total:6},iR={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}]},sR={agentAddress:"0x1111111111111111111111111111111111111111",agentDid:"did:dkg:agent:0x1111111111111111111111111111111111111111",name:"mock-node-agent",framework:"mock",peerId:"QmMockNodeAgentPeer000000000000000000000000",nodeIdentityId:"mock-node-identity"},oR={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"},lR={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},cR={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},uR={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 ta(e,t=50){return new Promise(n=>setTimeout(()=>n(e),t))}const na={fetchStatus:()=>ta(J2),fetchMetrics:()=>ta(eR),fetchAgents:()=>ta(tR),fetchContextGraphs:()=>ta(nR),fetchOperationsWithPhases:()=>ta(rR),fetchEconomics:()=>ta(iR),fetchWalletsBalances:()=>ta(oR),fetchCurrentAgent:()=>ta(sR),listParticipants:e=>ta(aR[e]??{contextGraphId:e,allowedAgents:[]}),fetchSubGraphs:e=>ta({contextGraphId:e,subGraphs:[]}),fetchNotificationsFeed:()=>ta(lR),fetchNodeLog:()=>ta(cR),fetchMemorySessions:()=>ta(uR)};let ja=null,ol=null;const Xh=new Set;function dR(){return ja===!0}function pR(e){return Xh.add(e),e(ja===!0),()=>{Xh.delete(e)}}function fR(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}async function hR(){if(ja!==null)return ja;if(ol)return ol;ol=(async()=>{try{const e=await fetch("/api/status",{headers:fR(),signal:AbortSignal.timeout(2e3)});e.ok||e.status===401?ja=!1:ja=!0}catch{ja=!0}return typeof window<"u"&&(window.__DKG_USING_MOCKS__=ja,ja&&console.warn("[dkg-ui] /api/status unreachable (timeout/5xx/network) — falling back to demo (mock) data. The UI is NOT showing live node state.")),Xh.forEach(e=>e(ja)),ja})();try{return await ol}finally{ol=null}}async function aa(e,t){return await hR()?t():e()}const Tn={fetchStatus:()=>aa(Ym,na.fetchStatus),fetchMetrics:()=>aa(u2,na.fetchMetrics),fetchAgents:()=>aa(Qm,na.fetchAgents),fetchContextGraphs:()=>aa(Km,na.fetchContextGraphs),fetchOperationsWithPhases:e=>aa(()=>d2(e),na.fetchOperationsWithPhases),fetchEconomics:()=>aa(Q2,na.fetchEconomics),fetchWalletsBalances:()=>aa(K2,na.fetchWalletsBalances),fetchCurrentAgent:()=>aa(gd,na.fetchCurrentAgent),listParticipants:e=>aa(()=>Wk(e),()=>na.listParticipants(e)),fetchSubGraphs:e=>aa(()=>sg(e),()=>na.fetchSubGraphs(e)),fetchNotificationsFeed:()=>aa(X2,na.fetchNotificationsFeed),fetchNodeLog:e=>aa(()=>p2(e),na.fetchNodeLog),fetchMemorySessions:e=>aa(()=>N2(e),na.fetchMemorySessions),markNotificationsRead:Xk,executeQuery:ia},mR=6e4;let vi={data:null,loading:!0,error:null},tr=null,kl=null,xl=0,gi="";const Zu=new Set;function qi(){if(typeof window>"u")return"";const e=window.__DKG_TOKEN__;return e?`Bearer ${e}`:""}function _u(e){gi=e,vi={data:null,loading:!0,error:null}}function th(){const e=qi();return e!==gi&&_u(e),vi}function Ou(){for(const e of Zu)e()}function nh(e){vi=e,Ou()}function Yu(){const e=xl,t=qi();if((tr==null?void 0:tr.authKey)===t)return tr.promise;t!==gi?(_u(t),Ou()):nh({...vi,loading:!0,error:null});const n=Tn.fetchCurrentAgent().then(r=>{if(e===xl){if(t!==qi()){const s=qi(),c=gi!==s||vi.loading;gi!==s&&(_u(s),Ou()),c&&Yu();return}nh({data:r,loading:!1,error:null})}}).catch(r=>{if(e===xl){if(t!==qi()){const s=qi(),c=gi!==s||vi.loading;gi!==s&&(_u(s),Ou()),c&&Yu();return}nh({data:vi.data,loading:!1,error:r instanceof Error?r.message:"Failed to load current agent"})}}).finally(()=>{e===xl&&(tr==null?void 0:tr.promise)===n&&(tr=null)});return tr={authKey:t,promise:n},n}function gR(){Yu(),!kl&&(kl=setInterval(()=>{Yu()},mR))}function vR(){Zu.size>0||!kl||(clearInterval(kl),kl=null,xl+=1,tr=null,vi={data:null,loading:!0,error:null},gi=qi())}function bd(){const[e,t]=w.useState(th);return w.useEffect(()=>{const n=()=>t(th());return Zu.add(n),t(th()),gR(),()=>{Zu.delete(n),vR()}},[]),e}const Na=Ul(e=>({contextGraphs:[],loading:!1,activeProjectId:null,setContextGraphs:t=>e({contextGraphs:t}),setLoading:t=>e({loading:t}),setActiveProject:t=>e({activeProjectId:t})})),Ys=new Set;let vn=null,Lu=null;const yR=350;function hx(e){return e==="wm"||e==="swm"||e==="vm"}function bR(e){const t=e.layers;return Array.isArray(t)?t.filter(hx):hx(e.layer)?[e.layer]:[]}function xR(e,t,n){if(!t||e.contextGraphId!==t)return!1;if(!n||n.length===0)return!0;const r=bR(e);return r.length===0?!0:n.some(s=>r.includes(s))}function Jk(){if(vn)return;const e=typeof window<"u"?window.__DKG_TOKEN__:void 0,t=e?`/api/events?token=${encodeURIComponent(e)}`:"/api/events";vn=new EventSource(t);const n=r=>s=>{let c={};try{c=JSON.parse(s.data)}catch{}const u={type:r,data:c};for(const d of Ys)try{d(u)}catch{}};vn.addEventListener("join_request",n("join_request")),vn.addEventListener("join_approved",n("join_approved")),vn.addEventListener("join_rejected",n("join_rejected")),vn.addEventListener("project_synced",n("project_synced")),vn.addEventListener("memory_graph_changed",n("memory_graph_changed")),vn.addEventListener("notification",n("notification")),vn.addEventListener("connected",n("connected")),vn.onerror=()=>{vn==null||vn.close(),vn=null,Ys.size>0&&(Lu=setTimeout(Jk,3e3))}}function wR(){Lu&&(clearTimeout(Lu),Lu=null),vn==null||vn.close(),vn=null}function kR(e){return Ys.add(e),Ys.size===1&&Jk(),()=>{Ys.delete(e),Ys.size===0&&wR()}}function Ji(e){const t=w.useRef(e);t.current=e,w.useEffect(()=>kR(n=>t.current(n)),[])}function po(e,t,n={}){var f;const r=w.useRef(t),s=w.useRef(null);r.current=t;const c=n.debounceMs??yR,u=w.useMemo(()=>n.layers??[],[(f=n.layers)==null?void 0:f.join("|")]),d=w.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]);Ji(w.useCallback(h=>{h.type==="memory_graph_changed"&&xR(h.data,e,u)&&(d(),s.current=setTimeout(()=>{s.current=null,r.current(h.data)},c))},[d,e,c,u])),w.useEffect(()=>d,[d])}function Bl(e,t,n={}){const r=w.useRef(e);r.current=e;const s=w.useRef(n);s.current=n,w.useEffect(()=>{if(t<=0)return;let c=null,u=!1;const d=()=>{c||u||(c=setInterval(()=>r.current(),t))},f=()=>{c&&(clearInterval(c),c=null)},h=()=>{if(document.hidden){f();return}r.current(),d()};return s.current.runImmediately!==!1&&!document.hidden&&r.current(),document.hidden||d(),document.addEventListener("visibilitychange",h),()=>{u=!0,document.removeEventListener("visibilitychange",h),f()}},[t])}const SR="No pending join request found";function jR(e){const t=[];for(const n of e)n.type==="join_request"&&t.push({id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,agentAddress:n.meta.agentAddress,agentName:n.meta.agentName,ts:n.ts,read:n.read===1});return t.sort((n,r)=>r.ts-n.ts),t}function CR(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});return t.sort((n,r)=>r.ts-n.ts),t}function mx(e){return e.filter(t=>t.type!=="join_request"&&t.read===0).map(t=>t.id)}function gx(e){const t=e instanceof Error?e.message:String(e);if(t.includes(SR))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 NR(){const[e,t]=w.useState(null),[n,r]=w.useState("loading"),[s,c]=w.useState(!1),u=w.useRef(!1),d=w.useCallback(()=>{Tn.fetchNotificationsFeed().then(N=>{u.current=!0,t(N),c(!1),r(N.scopeUnknown?"identity-pending":"ready")}).catch(()=>{u.current?c(!0):r("error")})},[]);Bl(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)},[]),Ji(w.useCallback(N=>{N.type==="notification"&&h()},[h]));const g=w.useMemo(()=>jR((e==null?void 0:e.notifications)??[]),[e]),m=w.useMemo(()=>CR((e==null?void 0:e.notifications)??[]),[e]),y=(e==null?void 0:e.badgeCount)??0,x=w.useMemo(()=>mx((e==null?void 0:e.notifications)??[]).length>0,[e]),k=w.useCallback(N=>{N.length!==0&&(t(A=>{if(!A)return A;const q=new Set(N.map(String));return{...A,notifications:A.notifications.map(R=>q.has(String(R.id))?{...R,read:1}:R)}}),Xk(N).then(d).catch(()=>{}))},[d]),j=w.useCallback(()=>{k(mx((e==null?void 0:e.notifications)??[]))},[e,k]),E=w.useCallback(async(N,A)=>{try{return await Xm(N,A),d(),{ok:!0}}catch(q){const R=gx(q);return R.ok&&R.alreadyHandled&&d(),R}},[d]),S=w.useCallback(async(N,A)=>{try{return await Jm(N,A),d(),{ok:!0}}catch(q){const R=gx(q);return R.ok&&R.alreadyHandled&&d(),R}},[d]),T=w.useCallback(()=>{c(!1),r(u.current?"ready":"loading"),d()},[d]);return{joinRequests:g,activity:m,unread:y,hasInformationalUnread:x,status:n,refreshError:s,partialActivityError:!1,approve:E,deny:S,markSeen:k,markAllInformationalSeen:j,retry:T}}function Qu(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 c=t.getTime()-n.getTime();return c>=0&&c<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"})}function og(e,t){return e&&e.trim()?e:t.length>20?`${t.slice(0,16)}…`:t}function vx(e){return e.length>12?`${e.slice(0,6)}…${e.slice(-4)}`:e}function ER({item:e,onApprove:t,onDeny:n,onOpen:r}){var g;const[s,c]=w.useState({kind:"idle"}),u=og(e.contextGraphName,e.cgId),d=((g=e.agentName)==null?void 0:g.trim())||vx(e.agentAddress),f=async m=>{c({kind:"working",action:m});const x=await(m==="approve"?t:n)(e.cgId,e.agentAddress);if(x.ok){const k=x.alreadyHandled?"Already handled":m==="approve"?`Approved — ${d} can now access ${u}`:`Request from ${d} declined`;c({kind:"done",label:k})}else{const k=x.roleError?`You're no longer the curator of ${u}`:m==="approve"?"Couldn’t approve":"Couldn’t deny";c({kind:"error",action:m,message:k})}};if(s.kind==="done")return o.jsxs("div",{className:"v10-notif-row v10-notif-row-terminal",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"v10-notif-glyph","aria-hidden":"true",children:"✓"}),o.jsx("span",{className:"v10-notif-terminal-text",children:s.label})]});const h=s.kind==="working";return o.jsxs("div",{className:"v10-notif-row v10-notif-row-join",children:[o.jsx("span",{className:"v10-notif-glyph v10-notif-glyph-join","aria-hidden":"true",children:"🔑"}),o.jsxs("div",{className:"v10-notif-row-body",children:[o.jsx("div",{className:"v10-notif-row-title",children:"Join request"}),o.jsxs("div",{className:"v10-notif-row-detail",children:[o.jsx("span",{className:"v10-notif-actor",children:d})," wants to join"," ",o.jsx("button",{type:"button",className:"v10-notif-cg-link",onClick:()=>r(e.cgId),title:`Open ${u}`,children:u})]}),o.jsxs("div",{className:"v10-notif-row-sub",children:[o.jsx("span",{className:"v10-notif-addr",title:e.agentAddress,children:vx(e.agentAddress)}),o.jsx("span",{className:"v10-notif-dot",children:"·"}),o.jsx("span",{className:"v10-notif-time",title:new Date(e.ts).toLocaleString(),children:Qu(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(),c({kind:"idle"}))},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||c({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:()=>c({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:()=>c({kind:"confirming-deny"}),disabled:h,"aria-label":`Deny join request from ${d} for ${u}`,children:h&&s.action==="deny"?"…":"Deny"})]})})]})}const TR={created:"+",promoted:"⇡",published:"◉"};function AR(e,t,n){const r=t,s=r===1?"assertion":"assertions";return e==="created"?n?`${n} added ${r} ${s}`:`${r} new ${s} added`:e==="promoted"?n?`${n} promoted ${r} ${s}`:`${r} ${s} promoted`:n?`${n} published ${r} ${s} to Verifiable Memory`:`${r} ${s} published to Verifiable Memory`}function RR({item:e,onOpen:t}){var d;const n=og(e.contextGraphName,e.cgId),r=e.bySelf?"You":((d=e.actorAgentName)==null?void 0:d.trim())||void 0,s=AR(e.event,e.count,r),c=Qu(e.ts),u=`${s} in ${n}${c?`, ${c}`:""}. 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:TR[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:c})]})}function _R({item:e,onOpen:t}){const n=og(e.contextGraphName,e.cgId),r=e.kind==="join_approved",s=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`v10-notif-glyph ${r?"v10-notif-glyph-approved":"v10-notif-glyph-rejected"}`,"aria-hidden":"true",children:r?"✓":"✕"}),o.jsxs("span",{className:"v10-notif-row-body",children:[o.jsx("span",{className:"v10-notif-row-title",children:r?"Request approved":"Request declined"}),o.jsx("span",{className:"v10-notif-row-detail",children:r?o.jsxs(o.Fragment,{children:["You can now access ",o.jsx("span",{className:"v10-notif-cg-name",children:n})]}):o.jsxs(o.Fragment,{children:["Your request to join ",o.jsx("span",{className:"v10-notif-cg-name",children:n})," wasn’t approved"]})})]}),o.jsx("span",{className:"v10-notif-time",title:new Date(e.ts).toLocaleString(),children:Qu(e.ts)})]});if(r){const c=Qu(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}${c?`, ${c}`:""}. 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 OR({feed:e,onOpenContextGraph:t,id:n,paneRef:r}){const{joinRequests:s,activity:c,status:u,refreshError:d,partialActivityError:f,hasInformationalUnread:h,approve:g,deny:m,markSeen:y,markAllInformationalSeen:x}=e,k=(T,N)=>{y([N]),t(T)},j=s.length>0,E=c.length>0,S=!j&&!E;return o.jsxs("div",{className:"v10-notif-pane",role:"region","aria-label":"Notifications",id:n,ref:r,tabIndex:-1,children:[o.jsxs("div",{className:"v10-notif-pane-titlebar",children:[o.jsx("div",{className:"v10-notif-pane-title",children:"Notifications"}),h&&o.jsx("button",{type:"button",className:"v10-notif-pane-markread",onClick:x,title:"Mark informational notifications as read",children:"Mark all read"})]}),o.jsx("div",{className:"v10-notif-pane-body",children:u==="identity-pending"?o.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Verifying access…"}):u==="loading"&&S?o.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Loading notifications…"}):u==="error"&&S?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"})]}):S?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:[d&&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"})]}),j&&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:s.length})]}),o.jsx("div",{className:"v10-notif-section-rows",children:s.map(T=>o.jsx(ER,{item:T,onApprove:g,onDeny:m,onOpen:t},T.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"})}),f&&o.jsx("div",{className:"v10-notif-pane-error v10-notif-pane-error-inline",role:"status","aria-live":"polite",children:"Recent activity couldn’t load."}),E?o.jsx("div",{className:"v10-notif-section-rows",children:c.map(T=>T.kind==="digest"?o.jsx(RR,{item:T,onOpen:N=>k(N,T.id)},T.id):o.jsx(_R,{item:T,onOpen:N=>k(N,T.id)},T.id))}):!f&&o.jsx("div",{className:"v10-notif-section-empty",children:"No recent activity."})]})]})})]})}const LR=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"})]}),yx="v10-notifications-pane";function zR(){const e=NR(),[t,n]=w.useState(!1),r=w.useRef(null),s=w.useRef(null),c=Na(m=>m.setActiveProject),{openTab:u}=yn(),d=w.useRef(null),f=w.useCallback((m=!1)=>{var y;n(!1),m&&((y=s.current)==null||y.focus())},[]);w.useEffect(()=>{if(!t)return;const m=y=>{r.current&&!r.current.contains(y.target)&&f()};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[t,f]),w.useEffect(()=>{if(!t)return;const m=d.current;if(!m)return;const y=m.querySelector(".v10-notif-section-action .v10-notif-btn-approve"),x=m.querySelector(".v10-notif-section-rows button, .v10-notif-section-rows a[href]"),k=m.querySelector('button:not(.v10-notif-pane-markread), [href], [tabindex]:not([tabindex="-1"])');(y??x??k??m).focus()},[t]);const h=w.useCallback(m=>{c(m),u({id:`project:${m}`,label:m.slice(0,16),closable:!0}),f()},[c,u,f]),g=e.unread;return o.jsxs("div",{className:"v10-header-notif-wrap",ref:r,onKeyDown:t?m=>{m.key==="Escape"&&(m.stopPropagation(),f(!0))}:void 0,children:[o.jsxs("button",{ref:s,className:"v10-header-icon-btn",onClick:()=>n(m=>!m),title:g>0?`Notifications (${g} unread)`:"Notifications","aria-label":g>0?`Notifications, ${g} unread`:"Notifications","aria-haspopup":"dialog","aria-expanded":t,"aria-controls":t?yx:void 0,children:[LR,g>0&&o.jsx("span",{className:"v10-header-notif-badge",children:g})]}),t&&o.jsx(OR,{id:yx,paneRef:d,feed:e,onOpenContextGraph:h})]})}function MR(e,t,n,r,s){const c=[e?"Synced with the network":"Syncing with the network",`${t} peer${t===1?"":"s"} (${n} direct, ${r} relayed)`];return s>0&&c.push(`Uptime ${DR(s)}`),c.join(`
90
- `)}function DR(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),s=Math.floor(t%3600/60),c=[];return n>0&&c.push(`${n}d`),(r>0||n>0)&&c.push(`${r}h`),c.push(`${s}m`),c.join(" ")}const $R=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"})]})}),IR=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"})]}),PR=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"})}),UR=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"})]}),BR=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"})]}),FR=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"})]}),HR=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"})});function qR(){var E,S;const{theme:e,setTheme:t,leftCollapsed:n,toggleLeft:r,rightCollapsed:s,toggleRight:c}=qn(),u=Fk(T=>T.nodeStatus),d=bd().data,{openTab:f}=yn(),h=(u==null?void 0:u.connectedPeers)??(u==null?void 0:u.peerCount)??0,g=((E=u==null?void 0:u.connections)==null?void 0:E.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=MR(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"}),$R]})]}),o.jsx("button",{className:`v10-header-icon-btn ${n?"":"active-toggle"}`,onClick:r,title:"Toggle sidebar",children:UR}),o.jsx("div",{className:"v10-header-sep"}),o.jsxs("div",{className:"v10-header-agent-switcher",title:d?`${d.agentDid}
91
- ${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(zR,{}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"operations",label:"Observability",closable:!0}),title:"Observability",children:HR}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"settings",label:"Settings",closable:!0}),title:"Settings",children:FR}),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"?IR:PR}),o.jsx("button",{className:`v10-header-icon-btn ${s?"":"active-toggle"}`,onClick:c,title:"Toggle agent panel",children:BR})]})]})}/**
92
- * @license lucide-react v1.14.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const eS=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
97
- * @license lucide-react v1.14.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */const GR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
102
- * @license lucide-react v1.14.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- */const VR=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
107
- * @license lucide-react v1.14.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */const bx=e=>{const t=VR(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
112
- * @license lucide-react v1.14.0 - ISC
113
- *
114
- * This source code is licensed under the ISC license.
115
- * See the LICENSE file in the root directory of this source tree.
116
- */var ah={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"};/**
117
- * @license lucide-react v1.14.0 - ISC
118
- *
119
- * This source code is licensed under the ISC license.
120
- * See the LICENSE file in the root directory of this source tree.
121
- */const WR=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},ZR=w.createContext({}),YR=()=>w.useContext(ZR),QR=w.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:s="",children:c,iconNode:u,...d},f)=>{const{size:h=24,strokeWidth:g=2,absoluteStrokeWidth:m=!1,color:y="currentColor",className:x=""}=YR()??{},k=r??m?Number(n??g)*24/Number(t??h):n??g;return w.createElement("svg",{ref:f,...ah,width:t??h??ah.width,height:t??h??ah.height,stroke:e??y,strokeWidth:k,className:eS("lucide",x,s),...!c&&!WR(d)&&{"aria-hidden":"true"},...d},[...u.map(([j,E])=>w.createElement(j,E)),...Array.isArray(c)?c:[c]])});/**
122
- * @license lucide-react v1.14.0 - ISC
123
- *
124
- * This source code is licensed under the ISC license.
125
- * See the LICENSE file in the root directory of this source tree.
126
- */const ln=(e,t)=>{const n=w.forwardRef(({className:r,...s},c)=>w.createElement(QR,{ref:c,iconNode:t,className:eS(`lucide-${GR(bx(e))}`,`lucide-${e}`,r),...s}));return n.displayName=bx(e),n};/**
127
- * @license lucide-react v1.14.0 - ISC
128
- *
129
- * This source code is licensed under the ISC license.
130
- * See the LICENSE file in the root directory of this source tree.
131
- */const KR=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],XR=ln("arrow-down",KR);/**
132
- * @license lucide-react v1.14.0 - ISC
133
- *
134
- * This source code is licensed under the ISC license.
135
- * See the LICENSE file in the root directory of this source tree.
136
- */const JR=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],e_=ln("arrow-up",JR);/**
137
- * @license lucide-react v1.14.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */const t_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],n_=ln("ban",t_);/**
142
- * @license lucide-react v1.14.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- */const a_=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],r_=ln("check",a_);/**
147
- * @license lucide-react v1.14.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */const i_=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],s_=ln("chevron-down",i_);/**
152
- * @license lucide-react v1.14.0 - ISC
153
- *
154
- * This source code is licensed under the ISC license.
155
- * See the LICENSE file in the root directory of this source tree.
156
- */const o_=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Jh=ln("chevron-right",o_);/**
157
- * @license lucide-react v1.14.0 - ISC
158
- *
159
- * This source code is licensed under the ISC license.
160
- * See the LICENSE file in the root directory of this source tree.
161
- */const l_=[["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"}]],c_=ln("copy",l_);/**
162
- * @license lucide-react v1.14.0 - ISC
163
- *
164
- * This source code is licensed under the ISC license.
165
- * See the LICENSE file in the root directory of this source tree.
166
- */const u_=[["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"}]],d_=ln("ellipsis",u_);/**
167
- * @license lucide-react v1.14.0 - ISC
168
- *
169
- * This source code is licensed under the ISC license.
170
- * See the LICENSE file in the root directory of this source tree.
171
- */const p_=[["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"}]],f_=ln("folder",p_);/**
172
- * @license lucide-react v1.14.0 - ISC
173
- *
174
- * This source code is licensed under the ISC license.
175
- * See the LICENSE file in the root directory of this source tree.
176
- */const h_=[["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"}]],m_=ln("globe",h_);/**
177
- * @license lucide-react v1.14.0 - ISC
178
- *
179
- * This source code is licensed under the ISC license.
180
- * See the LICENSE file in the root directory of this source tree.
181
- */const g_=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],v_=ln("loader-circle",g_);/**
182
- * @license lucide-react v1.14.0 - ISC
183
- *
184
- * This source code is licensed under the ISC license.
185
- * See the LICENSE file in the root directory of this source tree.
186
- */const y_=[["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"}]],b_=ln("lock",y_);/**
187
- * @license lucide-react v1.14.0 - ISC
188
- *
189
- * This source code is licensed under the ISC license.
190
- * See the LICENSE file in the root directory of this source tree.
191
- */const x_=[["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"}]],w_=ln("paperclip",x_);/**
192
- * @license lucide-react v1.14.0 - ISC
193
- *
194
- * This source code is licensed under the ISC license.
195
- * See the LICENSE file in the root directory of this source tree.
196
- */const k_=[["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"}]],xx=ln("share-2",k_);/**
197
- * @license lucide-react v1.14.0 - ISC
198
- *
199
- * This source code is licensed under the ISC license.
200
- * See the LICENSE file in the root directory of this source tree.
201
- */const S_=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],j_=ln("square",S_);/**
202
- * @license lucide-react v1.14.0 - ISC
203
- *
204
- * This source code is licensed under the ISC license.
205
- * See the LICENSE file in the root directory of this source tree.
206
- */const C_=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],N_=ln("trending-up",C_);/**
207
- * @license lucide-react v1.14.0 - ISC
208
- *
209
- * This source code is licensed under the ISC license.
210
- * See the LICENSE file in the root directory of this source tree.
211
- */const E_=[["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"}]],T_=ln("upload",E_);/**
212
- * @license lucide-react v1.14.0 - ISC
213
- *
214
- * This source code is licensed under the ISC license.
215
- * See the LICENSE file in the root directory of this source tree.
216
- */const A_=[["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"}]],R_=ln("users-round",A_);/**
217
- * @license lucide-react v1.14.0 - ISC
218
- *
219
- * This source code is licensed under the ISC license.
220
- * See the LICENSE file in the root directory of this source tree.
221
- */const __=[["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"}]],O_=ln("wallet",__);/**
222
- * @license lucide-react v1.14.0 - ISC
223
- *
224
- * This source code is licensed under the ISC license.
225
- * See the LICENSE file in the root directory of this source tree.
226
- */const L_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],z_=ln("x",L_);function M_(){const e=localStorage.getItem("dkg-journey-stage");return e==="1"?1:e==="2"?2:0}const lg=Ul((e,t)=>({stage:M_(),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})}})),D_=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
227
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
228
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
229
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
230
- @prefix dcterms: <http://purl.org/dc/terms/> .
231
- @prefix schema: <http://schema.org/> .
232
- @prefix foaf: <http://xmlns.com/foaf/0.1/> .
233
- @prefix prov: <http://www.w3.org/ns/prov#> .
234
- @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
235
- @prefix bibo: <http://purl.org/ontology/bibo/> .
236
- @prefix fabio: <http://purl.org/spar/fabio/> .
237
- @prefix cito: <http://purl.org/spar/cito/> .
238
- @prefix frbr: <http://purl.org/vocab/frbr/core#> .
239
-
240
- @prefix chat: <http://dkg.io/ontology/chat/> .
241
- @prefix dkg: <http://dkg.io/ontology/> .
242
- @prefix : <http://dkg.io/ontology/book-research/> .
243
-
244
- <http://dkg.io/ontology/book-research/>
245
- a owl:Ontology ;
246
- dcterms:title "DKG Book Research Project Ontology (v1)" ;
247
- dcterms:description """Starter ontology for projects that research and
248
- write books, papers, or long-form non-fiction. Built on schema.org +
249
- BIBO + the SPAR family (FaBiO, CiTO) + FRBR + SKOS so it composes with
250
- existing scholarly publishing infrastructure.""" ;
251
- owl:versionInfo "1.0.0" ;
252
- dcterms:created "2026-04-18"^^xsd:date ;
253
- owl:imports
254
- <http://schema.org/> , <http://purl.org/dc/terms/> ,
255
- <http://www.w3.org/ns/prov#> , <http://xmlns.com/foaf/0.1/> ,
256
- <http://www.w3.org/2004/02/skos/core#> ,
257
- <http://purl.org/ontology/bibo/> ,
258
- <http://purl.org/spar/fabio/> ,
259
- <http://purl.org/spar/cito/> ,
260
- <http://purl.org/vocab/frbr/core#> .
261
-
262
- # ─── Universal annotation predicates (shared across all starters) ───
263
- chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
264
- chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
265
- chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .
266
- chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .
267
- chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .
268
- chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
269
-
270
- # ─── Universal annotation entities ──────────────────────────────────
271
- :Concept rdfs:subClassOf skos:Concept .
272
- :Topic rdfs:subClassOf skos:Concept .
273
- :Question rdfs:subClassOf schema:Question .
274
- :Finding rdfs:subClassOf prov:Entity .
275
-
276
- # ─── Book-research specific ─────────────────────────────────────────
277
-
278
- :Hypothesis a owl:Class ;
279
- rdfs:label "Hypothesis" ;
280
- rdfs:comment "A claim under investigation. Supersedes when refuted; promotes to a Finding when supported." ;
281
- rdfs:subClassOf prov:Entity .
282
-
283
- :Argument a owl:Class ;
284
- rdfs:label "Argument" ;
285
- rdfs:comment "A reasoned position taken on a Hypothesis or other entity." ;
286
- rdfs:subClassOf prov:Entity .
287
-
288
- :Counterexample a owl:Class ;
289
- rdfs:label "Counterexample" ;
290
- rdfs:comment "Evidence that refutes a Hypothesis or Argument." ;
291
- rdfs:subClassOf prov:Entity .
292
-
293
- :Quote a owl:Class ;
294
- rdfs:label "Quote" ;
295
- rdfs:comment "Verbatim passage extracted from a source. Subclass of bibo:Quote so it composes with bibliographic tools." ;
296
- rdfs:subClassOf bibo:Quote .
297
-
298
- :supports a owl:ObjectProperty ;
299
- rdfs:label "supports" ;
300
- rdfs:comment "An Argument or Quote supports a Hypothesis." ;
301
- rdfs:subPropertyOf cito:agreesWith .
302
-
303
- :refutes a owl:ObjectProperty ;
304
- rdfs:label "refutes" ;
305
- rdfs:comment "An Argument, Counterexample, or Quote refutes a Hypothesis." ;
306
- rdfs:subPropertyOf cito:disagreesWith .
307
-
308
- :cites a owl:ObjectProperty ;
309
- rdfs:label "cites" ;
310
- rdfs:subPropertyOf cito:cites ;
311
- rdfs:range bibo:Document .
312
-
313
- # ─── URI patterns ───────────────────────────────────────────────────
314
- :UriPattern rdfs:label "URI minting pattern" .
315
-
316
- :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
317
- :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
318
- :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
319
- :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
320
- :hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .
321
- :argument-pattern a :UriPattern ; skos:notation "urn:dkg:argument:<slug>" .
322
- :quote-pattern a :UriPattern ; skos:notation "urn:dkg:quote:<slug>" .
323
- :citation-pattern a :UriPattern ; skos:notation "urn:dkg:citation:<slug>" ;
324
- skos:definition "Bibliographic citation; aligned with bibo:Document via cito:cites." .
325
-
326
- :slug-normalisation a skos:Note ;
327
- skos:definition "Lowercase → ASCII-fold → strip stopwords (the/a/an/of/for/and/or/to/in/on/with) → hyphenate → ≤60 chars. Apply BEFORE comparing free-text recall results (\`dkg_memory_search\`) to decide reuse-vs-mint." .
328
- `,$_=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
329
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
330
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
331
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
332
- @prefix dcterms: <http://purl.org/dc/terms/> .
333
- @prefix schema: <http://schema.org/> .
334
- @prefix foaf: <http://xmlns.com/foaf/0.1/> .
335
- @prefix prov: <http://www.w3.org/ns/prov#> .
336
- @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
337
- @prefix doap: <http://usefulinc.com/ns/doap#> .
338
-
339
- # DKG project namespaces — v1 ontology for any "coding project"
340
- # context graph. Imports widely-adopted Linked Data vocabs first;
341
- # only declares extensions for genuinely net-new concepts.
342
- @prefix chat: <http://dkg.io/ontology/chat/> .
343
- @prefix code: <http://dkg.io/ontology/code/> .
344
- @prefix github: <http://dkg.io/ontology/github/> .
345
- @prefix decisions: <http://dkg.io/ontology/decisions/> .
346
- @prefix tasks: <http://dkg.io/ontology/tasks/> .
347
- @prefix agent: <http://dkg.io/ontology/agent/> .
348
- @prefix dkg: <http://dkg.io/ontology/> .
349
-
350
- @prefix : <http://dkg.io/ontology/coding-project/> .
351
-
352
- # ─── Ontology header ────────────────────────────────────────────────
353
- <http://dkg.io/ontology/coding-project/>
354
- a owl:Ontology ;
355
- dcterms:title "DKG Coding Project Ontology (v1)" ;
356
- dcterms:description """The starter ontology for any DKG context graph that
357
- represents a software project — its decisions, tasks, code structure, GitHub
358
- activity, agents, and chat. Designed to be \`owl:imports\`-ed by per-project
359
- ontologies, which add their own extensions on top.
360
-
361
- Every predicate is either reused from a globally-adopted vocabulary
362
- (schema.org, DCTerms, PROV-O, FOAF, SKOS, DOAP) or declared here as a
363
- project-specific extension. Companion document \`agent-guide.md\` translates
364
- this formal model into operational instructions for AI coding agents.""" ;
365
- dcterms:creator "branarakic" ;
366
- owl:versionInfo "1.0.0" ;
367
- dcterms:created "2026-04-18"^^xsd:date ;
368
- owl:imports
369
- <http://schema.org/> ,
370
- <http://purl.org/dc/terms/> ,
371
- <http://www.w3.org/ns/prov#> ,
372
- <http://xmlns.com/foaf/0.1/> ,
373
- <http://www.w3.org/2004/02/skos/core#> ,
374
- <http://usefulinc.com/ns/doap#> .
375
-
376
- # ─── Section 1 — Universal annotation primitives ────────────────────
377
- # Predicates expressing what each chat turn was ABOUT — written into
378
- # the project's \`chat\` sub-graph by the capture-chat hook (and later
379
- # read by \`dkg_query\` / \`dkg_memory_search\`). These predicates apply
380
- # to ANY project type, not just coding.
381
-
382
- chat:topic
383
- a owl:DatatypeProperty ;
384
- rdfs:label "topic" ;
385
- rdfs:comment "Free-text topical bucket the chat turn lives under. Multiple per turn; emit liberally. Renderer can use these to cluster the activity feed." ;
386
- rdfs:domain chat:Turn ;
387
- rdfs:range xsd:string .
388
-
389
- chat:mentions
390
- a owl:ObjectProperty ;
391
- rdfs:label "mentions" ;
392
- rdfs:comment "An entity the chat turn referenced. The most common edge in the graph. To find existing entities to reuse before minting fresh URIs, use \`dkg_memory_search\` (free-text recall across WM/SWM/VM)." ;
393
- rdfs:domain chat:Turn ;
394
- rdfs:range owl:Thing ;
395
- rdfs:subPropertyOf schema:mentions .
396
-
397
- chat:examines
398
- a owl:ObjectProperty ;
399
- rdfs:label "examines" ;
400
- rdfs:comment "Entity the chat turn walked through in detail (vs just mentioning in passing). Implies the agent or operator is ANALYSING the entity, not merely citing it." ;
401
- rdfs:domain chat:Turn ;
402
- rdfs:range owl:Thing .
403
-
404
- chat:proposes
405
- a owl:ObjectProperty ;
406
- rdfs:label "proposes" ;
407
- rdfs:comment "An idea/decision/task the chat turn put forward. Often points at a freshly-minted Decision or Task entity created in the same write batch." ;
408
- rdfs:domain chat:Turn ;
409
- rdfs:range owl:Thing .
410
-
411
- chat:concludes
412
- a owl:ObjectProperty ;
413
- rdfs:label "concludes" ;
414
- rdfs:comment "A Finding entity the chat turn produced — a claim worth preserving as a first-class node, separate from the turn body." ;
415
- rdfs:domain chat:Turn ;
416
- rdfs:range :Finding .
417
-
418
- chat:asks
419
- a owl:ObjectProperty ;
420
- rdfs:label "asks" ;
421
- rdfs:comment "A Question entity the chat turn left open. Tracking these lets a future query surface 'what did we never resolve?'." ;
422
- rdfs:domain chat:Turn ;
423
- rdfs:range :Question .
424
-
425
- # ─── Section 2 — Universal annotation entity classes ────────────────
426
-
427
- :Concept
428
- a owl:Class ;
429
- rdfs:label "Concept" ;
430
- rdfs:comment "A free-text concept emerging from chat that doesn't fit into a more specific class. Aligned with skos:Concept so it composes with any knowledge organisation system." ;
431
- rdfs:subClassOf skos:Concept .
432
-
433
- :Topic
434
- a owl:Class ;
435
- rdfs:label "Topic" ;
436
- rdfs:comment "A broad topical bucket grouping related concepts/turns/entities. URI pattern: urn:dkg:topic:<slug>." ;
437
- rdfs:subClassOf skos:Concept .
438
-
439
- :Question
440
- a owl:Class ;
441
- rdfs:label "Question" ;
442
- rdfs:comment "An open question raised in chat that hasn't been answered yet. URI pattern: urn:dkg:question:<slug>. Resolved by linking a chat:Turn or :Finding via :answers." ;
443
- rdfs:subClassOf schema:Question .
444
-
445
- :Finding
446
- a owl:Class ;
447
- rdfs:label "Finding" ;
448
- rdfs:comment "A claim or observation worth preserving as a first-class entity, separate from the chat turn that produced it. URI pattern: urn:dkg:finding:<slug>. Findings can be cited by future Decisions, Tasks, and chat turns." ;
449
- rdfs:subClassOf prov:Entity .
450
-
451
- :answers
452
- a owl:ObjectProperty ;
453
- rdfs:label "answers" ;
454
- rdfs:comment "Links a Finding (or chat turn) to the Question it resolves." ;
455
- rdfs:domain owl:Thing ;
456
- rdfs:range :Question .
457
-
458
- :supersedes
459
- a owl:ObjectProperty ;
460
- rdfs:label "supersedes" ;
461
- rdfs:comment "This entity replaces an older one (e.g. a revised Finding supersedes an earlier one)." ;
462
- rdfs:range owl:Thing ;
463
- owl:inverseOf prov:wasRevisionOf .
464
-
465
- # ─── Section 3 — Coding-project-specific classes ────────────────────
466
- # Formalises the predicates already used informally in
467
- # scripts/lib/ontology.mjs, anchoring them in PROV-O and schema.org.
468
-
469
- decisions:Decision
470
- a owl:Class ;
471
- rdfs:label "Decision" ;
472
- rdfs:comment "An architectural decision the project made — context, outcome, consequences. Modelled as a prov:Activity because it represents a deliberate act of choosing." ;
473
- rdfs:subClassOf prov:Activity, schema:Action .
474
-
475
- decisions:context
476
- a owl:DatatypeProperty ;
477
- rdfs:label "context" ;
478
- rdfs:domain decisions:Decision ;
479
- rdfs:range xsd:string ;
480
- rdfs:comment "Why this decision was being made — problem, constraints, alternatives considered." .
481
-
482
- decisions:outcome
483
- a owl:DatatypeProperty ;
484
- rdfs:label "outcome" ;
485
- rdfs:domain decisions:Decision ;
486
- rdfs:range xsd:string ;
487
- rdfs:comment "The chosen direction — the decision itself, in one paragraph." .
488
-
489
- decisions:consequences
490
- a owl:DatatypeProperty ;
491
- rdfs:label "consequences" ;
492
- rdfs:domain decisions:Decision ;
493
- rdfs:range xsd:string ;
494
- rdfs:comment "What this implies going forward — trade-offs, follow-ups." .
495
-
496
- decisions:status
497
- a owl:DatatypeProperty ;
498
- rdfs:label "status" ;
499
- rdfs:domain decisions:Decision ;
500
- rdfs:range xsd:string ;
501
- rdfs:comment "One of: proposed | accepted | rejected | superseded." .
502
-
503
- tasks:Task
504
- a owl:Class ;
505
- rdfs:label "Task" ;
506
- rdfs:comment "A piece of planned or in-flight work on the project." ;
507
- rdfs:subClassOf schema:Action .
508
-
509
- tasks:status
510
- a owl:DatatypeProperty ;
511
- rdfs:label "status" ;
512
- rdfs:domain tasks:Task ;
513
- rdfs:range xsd:string ;
514
- rdfs:comment "One of: todo | in_progress | blocked | done | cancelled." .
515
-
516
- tasks:priority
517
- a owl:DatatypeProperty ;
518
- rdfs:label "priority" ;
519
- rdfs:domain tasks:Task ;
520
- rdfs:range xsd:string ;
521
- rdfs:comment "One of: p0 | p1 | p2 | p3." .
522
-
523
- tasks:relatedDecision
524
- a owl:ObjectProperty ;
525
- rdfs:label "related decision" ;
526
- rdfs:domain tasks:Task ;
527
- rdfs:range decisions:Decision ;
528
- rdfs:comment "The Decision this task implements or follows from." .
529
-
530
- tasks:dependsOn
531
- a owl:ObjectProperty ;
532
- rdfs:label "depends on" ;
533
- rdfs:domain tasks:Task ;
534
- rdfs:range tasks:Task .
535
-
536
- tasks:touches
537
- a owl:ObjectProperty ;
538
- rdfs:label "touches" ;
539
- rdfs:domain tasks:Task ;
540
- rdfs:range owl:Thing ;
541
- rdfs:comment "A code:File or code:Package this task edits." .
542
-
543
- # Code structure — aligned with schema:SoftwareSourceCode + DOAP.
544
-
545
- code:Package
546
- a owl:Class ;
547
- rdfs:label "Package" ;
548
- rdfs:subClassOf doap:Project, schema:SoftwareApplication .
549
-
550
- code:File
551
- a owl:Class ;
552
- rdfs:label "Source file" ;
553
- rdfs:subClassOf schema:SoftwareSourceCode .
554
-
555
- code:Function a owl:Class ; rdfs:label "Function" .
556
- code:Class a owl:Class ; rdfs:label "Class" .
557
- code:Interface a owl:Class ; rdfs:label "Interface" .
558
-
559
- # GitHub — minimal aliasing onto schema.org where sensible.
560
-
561
- github:Repository
562
- a owl:Class ;
563
- rdfs:label "GitHub repository" ;
564
- rdfs:subClassOf schema:SoftwareSourceCode, doap:Project .
565
-
566
- github:PullRequest
567
- a owl:Class ;
568
- rdfs:label "Pull request" ;
569
- rdfs:subClassOf schema:CreativeWork .
570
-
571
- github:Issue
572
- a owl:Class ;
573
- rdfs:label "GitHub issue" ;
574
- rdfs:subClassOf schema:Question, schema:CreativeWork .
575
-
576
- # ─── Section 4 — Chat sub-graph classes ─────────────────────────────
577
-
578
- chat:Session
579
- a owl:Class ;
580
- rdfs:label "Chat session" ;
581
- rdfs:comment "One conversation between an operator and their coding assistant (Cursor window, Claude Code thread, etc.)." ;
582
- rdfs:subClassOf schema:Conversation .
583
-
584
- chat:Turn
585
- a owl:Class ;
586
- rdfs:label "Chat turn" ;
587
- rdfs:comment "One user-prompt + assistant-response pair within a Session. Carries provenance via prov:wasAttributedTo." ;
588
- rdfs:subClassOf schema:Message, prov:Entity .
589
-
590
- chat:userPrompt a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
591
- chat:assistantResponse a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
592
- chat:turnIndex a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:integer .
593
- chat:inSession a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range chat:Session .
594
- chat:speakerTool a owl:DatatypeProperty ; rdfs:range xsd:string ;
595
- rdfs:comment "Identifier of the coding assistant that produced the turn (e.g. 'cursor', 'claude-code')." .
596
- chat:privacy a owl:DatatypeProperty ; rdfs:domain chat:Session ; rdfs:range xsd:string ;
597
- rdfs:comment "One of: private | team | public. Controls auto-promote behaviour of the capture hook." .
598
-
599
- # ─── Section 5 — Agent identity ─────────────────────────────────────
600
-
601
- agent:Agent
602
- a owl:Class ;
603
- rdfs:label "Agent" ;
604
- rdfs:subClassOf prov:Agent, foaf:Agent .
605
-
606
- agent:HumanAgent rdfs:subClassOf agent:Agent, foaf:Person .
607
- agent:AIAgent rdfs:subClassOf agent:Agent, schema:SoftwareApplication .
608
-
609
- agent:framework
610
- a owl:DatatypeProperty ;
611
- rdfs:label "framework" ;
612
- rdfs:domain agent:AIAgent ;
613
- rdfs:range xsd:string ;
614
- rdfs:comment "Name of the agent runtime — 'cursor', 'claude-code', 'openclaw', 'hermes', etc." .
615
-
616
- agent:operator
617
- a owl:ObjectProperty ;
618
- rdfs:label "operator" ;
619
- rdfs:domain agent:AIAgent ;
620
- rdfs:range agent:HumanAgent ;
621
- rdfs:comment "The human operator who runs and is responsible for this AI agent." .
622
-
623
- # ─── Section 6 — URI minting conventions (machine-readable) ─────────
624
- # These are encoded as SKOS notes so an agent reading the ontology can
625
- # pull them out programmatically. The agent guide repeats them in
626
- # prose for human readability.
627
-
628
- :UriPattern
629
- a owl:Class ;
630
- rdfs:label "URI minting pattern" ;
631
- rdfs:comment "Documents the URI shape the agent should produce when minting a new entity of a given type." .
632
-
633
- :concept-pattern a :UriPattern ;
634
- skos:notation "urn:dkg:concept:<slug>" ;
635
- skos:definition "Free-text concept; aligned with skos:Concept." .
636
- :topic-pattern a :UriPattern ;
637
- skos:notation "urn:dkg:topic:<slug>" ;
638
- skos:definition "Broad topical bucket grouping related entities." .
639
- :question-pattern a :UriPattern ;
640
- skos:notation "urn:dkg:question:<slug>" ;
641
- skos:definition "An open question awaiting an answer." .
642
- :finding-pattern a :UriPattern ;
643
- skos:notation "urn:dkg:finding:<slug>" ;
644
- skos:definition "A claim or observation worth preserving as a first-class node." .
645
- :decision-pattern a :UriPattern ;
646
- skos:notation "urn:dkg:decision:<slug>" ;
647
- skos:definition "An architectural decision (coding-project specific)." .
648
- :task-pattern a :UriPattern ;
649
- skos:notation "urn:dkg:task:<slug>" ;
650
- skos:definition "A piece of planned or in-flight work (coding-project specific)." .
651
-
652
- # ─── Section 7 — Slug normalisation rule (deterministic) ────────────
653
-
654
- :slug-normalisation a skos:Note ;
655
- skos:prefLabel "slug normalisation" ;
656
- skos:definition """To compute the canonical slug from a free-text label:
657
- 1. Lowercase.
658
- 2. Apply Unicode NFKD then strip combining marks (ASCII fold).
659
- 3. Strip common stopwords (the / a / an / of / for / and / or / to / in / on / with).
660
- 4. Replace any run of non-[a-z0-9] with a single hyphen.
661
- 5. Trim leading/trailing hyphens.
662
- 6. Truncate to 60 characters max.
663
-
664
- Example: "the Tree-Sitter library", "Tree sitter", "TREE_SITTER" all
665
- normalise to "tree-sitter". Always apply this BEFORE comparing free-text
666
- recall results (\`dkg_memory_search\`) in the look-before-mint protocol.""" .
667
- `,I_=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
668
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
669
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
670
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
671
- @prefix dcterms: <http://purl.org/dc/terms/> .
672
- @prefix schema: <http://schema.org/> .
673
- @prefix foaf: <http://xmlns.com/foaf/0.1/> .
674
- @prefix prov: <http://www.w3.org/ns/prov#> .
675
- @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
676
- @prefix bibo: <http://purl.org/ontology/bibo/> .
677
-
678
- @prefix chat: <http://dkg.io/ontology/chat/> .
679
- @prefix : <http://dkg.io/ontology/narrative-writing/> .
680
-
681
- <http://dkg.io/ontology/narrative-writing/>
682
- a owl:Ontology ;
683
- dcterms:title "DKG Narrative Writing Project Ontology (v1)" ;
684
- dcterms:description """Starter for fiction or narrative non-fiction
685
- projects: novels, screenplays, biographies. Tracks Characters, Scenes,
686
- Plot Points, Themes, and the relationships between them.""" ;
687
- owl:versionInfo "1.0.0" ;
688
- dcterms:created "2026-04-18"^^xsd:date ;
689
- owl:imports
690
- <http://schema.org/> , <http://purl.org/dc/terms/> ,
691
- <http://xmlns.com/foaf/0.1/> ,
692
- <http://www.w3.org/2004/02/skos/core#> ,
693
- <http://purl.org/ontology/bibo/> .
694
-
695
- # ─── Universal annotation predicates ────────────────────────────────
696
- chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
697
- chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
698
- chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
699
- chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
700
- chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .
701
- chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
702
-
703
- # ─── Universal annotation entities ──────────────────────────────────
704
- :Concept rdfs:subClassOf skos:Concept .
705
- :Topic rdfs:subClassOf skos:Concept .
706
- :Question rdfs:subClassOf schema:Question .
707
- :Finding rdfs:subClassOf prov:Entity .
708
-
709
- # ─── Narrative-writing-specific ─────────────────────────────────────
710
-
711
- :Character a owl:Class ;
712
- rdfs:label "Character" ;
713
- rdfs:comment "A character in the narrative — fictional or historical." ;
714
- rdfs:subClassOf foaf:Person, schema:Person .
715
-
716
- :Scene a owl:Class ;
717
- rdfs:label "Scene" ;
718
- rdfs:comment "A discrete unit of narrative action — a single place/time/event in the story." ;
719
- rdfs:subClassOf schema:Event .
720
-
721
- :PlotPoint a owl:Class ;
722
- rdfs:label "Plot point" ;
723
- rdfs:comment "A structural moment in the narrative arc (inciting incident, climax, resolution, etc.)." .
724
-
725
- :Theme a owl:Class ;
726
- rdfs:label "Theme" ;
727
- rdfs:comment "A unifying idea explored across the narrative." ;
728
- rdfs:subClassOf skos:Concept .
729
-
730
- :Setting a owl:Class ;
731
- rdfs:label "Setting" ;
732
- rdfs:comment "A place + time context within which Scenes occur." .
733
-
734
- :appearsIn a owl:ObjectProperty ;
735
- rdfs:label "appears in" ;
736
- rdfs:domain :Character ;
737
- rdfs:range :Scene .
738
-
739
- :setIn a owl:ObjectProperty ;
740
- rdfs:label "set in" ;
741
- rdfs:domain :Scene ;
742
- rdfs:range :Setting .
743
-
744
- :develops a owl:ObjectProperty ;
745
- rdfs:label "develops" ;
746
- rdfs:comment "A Scene or PlotPoint develops a Theme or a Character arc." ;
747
- rdfs:range owl:Thing .
748
-
749
- :precedes a owl:ObjectProperty ;
750
- rdfs:label "precedes" ;
751
- rdfs:domain :Scene ;
752
- rdfs:range :Scene .
753
-
754
- # ─── URI patterns ───────────────────────────────────────────────────
755
- :UriPattern rdfs:label "URI minting pattern" .
756
-
757
- :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
758
- :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
759
- :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
760
- :character-pattern a :UriPattern ; skos:notation "urn:dkg:character:<slug>" .
761
- :scene-pattern a :UriPattern ; skos:notation "urn:dkg:scene:<slug>" .
762
- :plotpoint-pattern a :UriPattern ; skos:notation "urn:dkg:plotpoint:<slug>" .
763
- :theme-pattern a :UriPattern ; skos:notation "urn:dkg:theme:<slug>" .
764
- :setting-pattern a :UriPattern ; skos:notation "urn:dkg:setting:<slug>" .
765
-
766
- :slug-normalisation a skos:Note ;
767
- skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
768
- `,P_=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
769
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
770
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
771
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
772
- @prefix dcterms: <http://purl.org/dc/terms/> .
773
- @prefix schema: <http://schema.org/> .
774
- @prefix foaf: <http://xmlns.com/foaf/0.1/> .
775
- @prefix prov: <http://www.w3.org/ns/prov#> .
776
- @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
777
- @prefix time: <http://www.w3.org/2006/time#> .
778
-
779
- @prefix chat: <http://dkg.io/ontology/chat/> .
780
- @prefix : <http://dkg.io/ontology/pkm/> .
781
-
782
- <http://dkg.io/ontology/pkm/>
783
- a owl:Ontology ;
784
- dcterms:title "DKG Personal Knowledge Management Ontology (v1)" ;
785
- dcterms:description """Starter for personal/team knowledge gardens.
786
- Notes, highlights, questions, insights — the daily-driver vocabulary
787
- of an Obsidian/Roam-style PKM workflow, but graph-native and shareable
788
- with teammates' agents.""" ;
789
- owl:versionInfo "1.0.0" ;
790
- dcterms:created "2026-04-18"^^xsd:date ;
791
- owl:imports
792
- <http://schema.org/> , <http://purl.org/dc/terms/> ,
793
- <http://xmlns.com/foaf/0.1/> ,
794
- <http://www.w3.org/2004/02/skos/core#> ,
795
- <http://www.w3.org/2006/time#> .
796
-
797
- # ─── Universal annotation predicates ────────────────────────────────
798
- chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
799
- chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
800
- chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
801
- chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
802
- chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Insight .
803
- chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
804
-
805
- # ─── Universal annotation entities ──────────────────────────────────
806
- :Concept rdfs:subClassOf skos:Concept .
807
- :Topic rdfs:subClassOf skos:Concept .
808
- :Question rdfs:subClassOf schema:Question .
809
- :Finding rdfs:subClassOf prov:Entity .
810
-
811
- # ─── PKM-specific ────────────────────────────────────────────────────
812
-
813
- :Note a owl:Class ;
814
- rdfs:label "Note" ;
815
- rdfs:comment "An atomic note — a single self-contained thought worth capturing. The fundamental unit of a PKM graph." ;
816
- rdfs:subClassOf schema:CreativeWork .
817
-
818
- :Highlight a owl:Class ;
819
- rdfs:label "Highlight" ;
820
- rdfs:comment "A passage of text marked as significant from a source (article, book, transcript). Carries provenance back to the source." ;
821
- rdfs:subClassOf schema:Quotation .
822
-
823
- :Insight a owl:Class ;
824
- rdfs:label "Insight" ;
825
- rdfs:comment "A connection or realisation that synthesises across multiple Notes/Highlights. Promotes from a chat turn via chat:concludes." ;
826
- rdfs:subClassOf prov:Entity .
827
-
828
- :relatedTo a owl:ObjectProperty ;
829
- rdfs:label "related to" ;
830
- rdfs:subPropertyOf skos:related .
831
-
832
- :references a owl:ObjectProperty ;
833
- rdfs:label "references" ;
834
- rdfs:subPropertyOf dcterms:references .
835
-
836
- :source a owl:ObjectProperty ;
837
- rdfs:label "source" ;
838
- rdfs:domain :Highlight ;
839
- rdfs:range schema:CreativeWork ;
840
- rdfs:comment "Where a Highlight was extracted from." ;
841
- rdfs:subPropertyOf dcterms:source .
842
-
843
- # ─── URI patterns ───────────────────────────────────────────────────
844
- :UriPattern rdfs:label "URI minting pattern" .
845
-
846
- :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
847
- :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
848
- :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
849
- :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
850
- :note-pattern a :UriPattern ; skos:notation "urn:dkg:note:<slug>" .
851
- :highlight-pattern a :UriPattern ; skos:notation "urn:dkg:highlight:<slug>" .
852
- :insight-pattern a :UriPattern ; skos:notation "urn:dkg:insight:<slug>" .
853
-
854
- :slug-normalisation a skos:Note ;
855
- skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
856
- `,U_=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
857
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
858
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
859
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
860
- @prefix dcterms: <http://purl.org/dc/terms/> .
861
- @prefix schema: <http://schema.org/> .
862
- @prefix prov: <http://www.w3.org/ns/prov#> .
863
- @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
864
- @prefix dcat: <http://www.w3.org/ns/dcat#> .
865
- @prefix fabio: <http://purl.org/spar/fabio/> .
866
- @prefix time: <http://www.w3.org/2006/time#> .
867
-
868
- @prefix chat: <http://dkg.io/ontology/chat/> .
869
- @prefix : <http://dkg.io/ontology/scientific-research/> .
870
-
871
- <http://dkg.io/ontology/scientific-research/>
872
- a owl:Ontology ;
873
- dcterms:title "DKG Scientific Research Project Ontology (v1)" ;
874
- dcterms:description """Starter for empirical scientific research:
875
- hypotheses → experiments → results → reproducibility chains. Composes
876
- with FaBiO for scholarly works, DCAT for datasets, PROV-O for
877
- provenance, OWL Time for sequencing.""" ;
878
- owl:versionInfo "1.0.0" ;
879
- dcterms:created "2026-04-18"^^xsd:date ;
880
- owl:imports
881
- <http://schema.org/> , <http://purl.org/dc/terms/> ,
882
- <http://www.w3.org/ns/prov#> ,
883
- <http://www.w3.org/2004/02/skos/core#> ,
884
- <http://www.w3.org/ns/dcat#> ,
885
- <http://purl.org/spar/fabio/> ,
886
- <http://www.w3.org/2006/time#> .
887
-
888
- # ─── Universal annotation predicates ────────────────────────────────
889
- chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
890
- chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
891
- chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
892
- chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
893
- chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Result .
894
- chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
895
-
896
- # ─── Universal annotation entities ──────────────────────────────────
897
- :Concept rdfs:subClassOf skos:Concept .
898
- :Topic rdfs:subClassOf skos:Concept .
899
- :Question rdfs:subClassOf schema:Question .
900
- :Finding rdfs:subClassOf prov:Entity .
901
-
902
- # ─── Scientific-research-specific ───────────────────────────────────
903
-
904
- :Hypothesis a owl:Class ;
905
- rdfs:label "Hypothesis" ;
906
- rdfs:comment "A testable claim. Linked to Experiments via :testedBy and to Results via :supportedBy / :refutedBy." ;
907
- rdfs:subClassOf prov:Entity .
908
-
909
- :Experiment a owl:Class ;
910
- rdfs:label "Experiment" ;
911
- rdfs:comment "A defined procedure executed to test a Hypothesis. Subclass of prov:Activity for full provenance." ;
912
- rdfs:subClassOf prov:Activity .
913
-
914
- :Method a owl:Class ;
915
- rdfs:label "Method" ;
916
- rdfs:comment "A reusable methodology applied within Experiments." ;
917
- rdfs:subClassOf prov:Plan .
918
-
919
- :Result a owl:Class ;
920
- rdfs:label "Result" ;
921
- rdfs:comment "An outcome produced by an Experiment — quantitative or qualitative." ;
922
- rdfs:subClassOf prov:Entity .
923
-
924
- :Dataset a owl:Class ;
925
- rdfs:label "Dataset" ;
926
- rdfs:comment "An input or output dataset for an Experiment. Aligned with DCAT." ;
927
- rdfs:subClassOf dcat:Dataset .
928
-
929
- :testedBy a owl:ObjectProperty ;
930
- rdfs:label "tested by" ;
931
- rdfs:domain :Hypothesis ;
932
- rdfs:range :Experiment .
933
-
934
- :supportedBy a owl:ObjectProperty ;
935
- rdfs:label "supported by" ;
936
- rdfs:domain :Hypothesis ;
937
- rdfs:range :Result .
938
-
939
- :refutedBy a owl:ObjectProperty ;
940
- rdfs:label "refuted by" ;
941
- rdfs:domain :Hypothesis ;
942
- rdfs:range :Result .
943
-
944
- :usesDataset a owl:ObjectProperty ;
945
- rdfs:label "uses dataset" ;
946
- rdfs:domain :Experiment ;
947
- rdfs:range :Dataset .
948
-
949
- :reproducedBy a owl:ObjectProperty ;
950
- rdfs:label "reproduced by" ;
951
- rdfs:domain :Experiment ;
952
- rdfs:range :Experiment ;
953
- rdfs:comment "An Experiment that successfully reproduced this one's Results." .
954
-
955
- # ─── URI patterns ───────────────────────────────────────────────────
956
- :UriPattern rdfs:label "URI minting pattern" .
957
-
958
- :concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
959
- :topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
960
- :question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
961
- :finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
962
- :hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .
963
- :experiment-pattern a :UriPattern ; skos:notation "urn:dkg:experiment:<slug>" .
964
- :method-pattern a :UriPattern ; skos:notation "urn:dkg:method:<slug>" .
965
- :result-pattern a :UriPattern ; skos:notation "urn:dkg:result:<slug>" .
966
- :dataset-pattern a :UriPattern ; skos:notation "urn:dkg:dataset:<slug>" .
967
-
968
- :slug-normalisation a skos:Note ;
969
- skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
970
- `,B_=`# Book-research agent guide
971
-
972
- This starter ships an RDF ontology for **book-research projects** —
973
- research notebooks anchored in scholarly sources (citations, quotes,
974
- arguments, hypotheses). The formal schema lives in \`ontology.ttl\`
975
- alongside this guide.
976
-
977
- For V10 MCP tool usage, see
978
- [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
979
- The tool surface to use against this ontology:
980
-
981
- - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
982
- - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
983
- - \`dkg_knowledge_asset_share\` — share with peers (SWM)
984
- - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
985
- - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
986
-
987
- The longer per-domain agent-guide walkthrough format will return when
988
- the V10 ontology endpoint and per-project annotation workflow stabilise.
989
- `,F_=`# Coding-project agent guide
990
-
991
- This starter ships an RDF ontology for **coding projects** —
992
- shared project memory for AI coding agents (decisions, tasks, code
993
- references, GitHub activity, chat turns). The formal schema lives in
994
- \`ontology.ttl\` alongside this guide.
995
-
996
- For V10 MCP tool usage, see
997
- [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
998
- The tool surface to use against this ontology:
999
-
1000
- - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
1001
- - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
1002
- - \`dkg_knowledge_asset_share\` — share with peers (SWM)
1003
- - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
1004
- - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
1005
-
1006
- The longer per-domain agent-guide walkthrough format will return when
1007
- the V10 ontology endpoint and per-project annotation workflow stabilise.
1008
- `,H_=`# Narrative-writing agent guide
1009
-
1010
- This starter ships an RDF ontology for **narrative-writing projects** —
1011
- the structural elements of long-form narrative (Characters, Scenes,
1012
- PlotPoints, Themes, Settings) and their relationships. The formal
1013
- schema lives in \`ontology.ttl\` alongside this guide.
1014
-
1015
- For V10 MCP tool usage, see
1016
- [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
1017
- The tool surface to use against this ontology:
1018
-
1019
- - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
1020
- - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
1021
- - \`dkg_knowledge_asset_share\` — share with peers (SWM)
1022
- - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
1023
- - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
1024
-
1025
- The longer per-domain agent-guide walkthrough format will return when
1026
- the V10 ontology endpoint and per-project annotation workflow stabilise.
1027
- `,q_=`# PKM agent guide
1028
-
1029
- This starter ships an RDF ontology for **PKM (Personal Knowledge
1030
- Management) projects** — Notes, Highlights, Insights, and the links
1031
- that grow a knowledge garden organically. The formal schema lives in
1032
- \`ontology.ttl\` alongside this guide.
1033
-
1034
- For V10 MCP tool usage, see
1035
- [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
1036
- The tool surface to use against this ontology:
1037
-
1038
- - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
1039
- - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
1040
- - \`dkg_knowledge_asset_share\` — share with peers (SWM)
1041
- - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
1042
- - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
1043
-
1044
- The longer per-domain agent-guide walkthrough format will return when
1045
- the V10 ontology endpoint and per-project annotation workflow stabilise.
1046
- `,G_=`# Scientific-research agent guide
1047
-
1048
- This starter ships an RDF ontology for **scientific-research projects** —
1049
- the empirical research arc (Hypotheses → Experiments → Results →
1050
- Reproducibility chains), anchored in PROV-O and FaBiO so the graph
1051
- composes with existing scholarly publishing infrastructure. The formal
1052
- schema lives in \`ontology.ttl\` alongside this guide.
1053
-
1054
- For V10 MCP tool usage, see
1055
- [\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
1056
- The tool surface to use against this ontology:
1057
-
1058
- - \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
1059
- - \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
1060
- - \`dkg_knowledge_asset_share\` — share with peers (SWM)
1061
- - \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
1062
- - \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
1063
-
1064
- The longer per-domain agent-guide walkthrough format will return when
1065
- the V10 ontology endpoint and per-project annotation workflow stabilise.
1066
- `;async function uu(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...qt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}const V_=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/ontology.ttl":D_,"../../../../mcp-dkg/templates/ontologies/coding-project/ontology.ttl":$_,"../../../../mcp-dkg/templates/ontologies/narrative-writing/ontology.ttl":I_,"../../../../mcp-dkg/templates/ontologies/pkm/ontology.ttl":P_,"../../../../mcp-dkg/templates/ontologies/scientific-research/ontology.ttl":U_}),W_=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/agent-guide.md":B_,"../../../../mcp-dkg/templates/ontologies/coding-project/agent-guide.md":F_,"../../../../mcp-dkg/templates/ontologies/narrative-writing/agent-guide.md":H_,"../../../../mcp-dkg/templates/ontologies/pkm/agent-guide.md":q_,"../../../../mcp-dkg/templates/ontologies/scientific-research/agent-guide.md":G_});function Z_(){const e={};for(const[t,n]of Object.entries(V_)){const r=t.match(/ontologies\/([^/]+)\/ontology\.ttl$/);if(!r)continue;const s=r[1];e[s]={ttl:n,guide:""}}for(const[t,n]of Object.entries(W_)){const r=t.match(/ontologies\/([^/]+)\/agent-guide\.md$/);if(!r)continue;const s=r[1];e[s]&&(e[s].guide=n)}return e}const cg=Z_(),Y_=[{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 Q_(){return Y_.filter(e=>cg[e.slug])}function K_(e){return cg[e]??null}const Ct={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",schema:"http://schema.org/",dcterms:"http://purl.org/dc/terms/",xsd:"http://www.w3.org/2001/XMLSchema#",prov:"http://www.w3.org/ns/prov#",owl:"http://www.w3.org/2002/07/owl#"};function X_(e,t,n,r){const s=`urn:dkg:project:${e}:ontology`,c=`${s}:agent-guide`,u=new Date().toISOString(),d=g=>g.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"),f=(g,m)=>m?`"${d(g)}"^^<${m}>`:`"${d(g)}"`,h=[{subject:s,predicate:Ct.rdf+"type",object:`<${Ct.owl}Ontology>`},{subject:s,predicate:Ct.rdf+"type",object:`<${Ct.prov}Entity>`},{subject:s,predicate:Ct.rdfs+"label",object:f(`Project ontology — ${e}`)},{subject:s,predicate:Ct.schema+"name",object:f(`Project ontology — ${e}`)},{subject:s,predicate:Ct.dcterms+"title",object:f(`Project ontology — ${e}`)},{subject:s,predicate:Ct.dcterms+"description",object:f(`The active ontology for context graph ${e}, derived from the '${t}' starter.`)},{subject:s,predicate:Ct.dcterms+"created",object:f(u,Ct.xsd+"dateTime")},{subject:s,predicate:Ct.dcterms+"modified",object:f(u,Ct.xsd+"dateTime")},{subject:s,predicate:Ct.dcterms+"source",object:f(t)},{subject:s,predicate:Ct.schema+"encodingFormat",object:f("text/turtle")},{subject:s,predicate:Ct.schema+"text",object:f(n)},{subject:s,predicate:Ct.dcterms+"references",object:`<${c}>`},{subject:c,predicate:Ct.rdf+"type",object:`<${Ct.schema}DigitalDocument>`},{subject:c,predicate:Ct.rdfs+"label",object:f(`Agent guide — ${e} ontology`)},{subject:c,predicate:Ct.schema+"name",object:f(`Agent guide — ${e} ontology`)},{subject:c,predicate:Ct.dcterms+"title",object:f(`Agent guide — ${e} ontology`)},{subject:c,predicate:Ct.dcterms+"created",object:f(u,Ct.xsd+"dateTime")},{subject:c,predicate:Ct.dcterms+"modified",object:f(u,Ct.xsd+"dateTime")},{subject:c,predicate:Ct.schema+"encodingFormat",object:f("text/markdown")},{subject:c,predicate:Ct.schema+"text",object:f(r)},{subject:c,predicate:Ct.schema+"about",object:`<${s}>`}];return{ontologyUri:s,guideUri:c,quads:h}}async function J_(e,t){const n=K_(t);if(!n)throw new Error(`Unknown ontology starter '${t}'. Available: ${Object.keys(cg).join(", ")}`);if(!n.ttl||!n.guide)throw new Error(`Starter '${t}' is missing ontology.ttl or agent-guide.md.`);await uu("/api/sub-graph/create",{contextGraphId:e,subGraphName:"meta"}).catch(u=>{if(!String((u==null?void 0:u.message)??u).includes("already exists"))throw u});const{ontologyUri:r,guideUri:s,quads:c}=X_(e,t,n.ttl,n.guide);await uu("/api/knowledge-assets/project-ontology/wm/discard",{contextGraphId:e,subGraphName:"meta"}).catch(u=>{const d=String((u==null?void 0:u.message)??u);if(!/404|not found/i.test(d))throw u}),await uu("/api/knowledge-assets/project-ontology/wm/write",{contextGraphId:e,subGraphName:"meta",quads:c});try{await uu("/api/knowledge-assets/project-ontology/swm/share",{contextGraphId:e,subGraphName:"meta",entities:[r,s]})}catch{}return{ontologyUri:r,guideUri:s,tripleCount:c.length}}async function ug(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...qt()},body:JSON.stringify(t)}),r=await n.text();let s;if(r)try{s=JSON.parse(r)}catch{s={raw:r}}if(!n.ok){const c=(s==null?void 0:s.error)??`HTTP ${n.status}`;throw new Error(typeof c=="string"?c:JSON.stringify(c))}return s}function eO(e,t={}){return ug(`/api/context-graph/${encodeURIComponent(e)}/manifest/publish`,t)}function tO(e,t){return ug(`/api/context-graph/${encodeURIComponent(e)}/manifest/plan-install`,t)}function nO(e,t){return ug(`/api/context-graph/${encodeURIComponent(e)}/manifest/install`,t)}const wx="dkg.wireWorkspace.parentDir",kx="dkg.wireWorkspace.nickname",Sx="dkg.wireWorkspace.tools",rh=[{value:"cursor",label:"Cursor",description:"Wires .cursor/mcp.json + hooks + rules into the workspace."},{value:"claude-code",label:"Claude Code",description:"Merges hooks into ~/.claude/settings.json. Requires Claude Code installed."},{value:"both",label:"Both Cursor and Claude Code",description:"Wires both tools so either can operate on this project."},{value:"cursor",label:"Codex (coming soon)",description:"Codex CLI integration isn't shipped yet — pick another tool for now.",disabled:!0,comingSoon:!0}];function aO(e,t){const n=t.split("/"),r=n[n.length-1]??"";return r||(e??"project").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function rO(e){if(!e)return"";const t=e.hostname.replace(/\.local$/,"").replace(/-/g," ");return`${e.username} @ ${t}`}function jx(e){return e==="both"?["cursor","claude-code"]:[e]}function tS({contextGraphId:e,projectName:t,defaultAgentNickname:n,onDone:r,onCancel:s,variant:c}){var W;const u=w.useMemo(()=>aO(t,e),[t,e]),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(""),[x,k]=w.useState(""),[j,E]=w.useState("cursor"),[S,T]=w.useState(!1),[N,A]=w.useState(null),[q,R]=w.useState(null),[$,H]=w.useState(null);w.useEffect(()=>{let I=!1;return(async()=>{try{const[D,F]=await Promise.all([fetch("/api/host/info",{headers:qt()}).then(Q=>Q.ok?Q.json():null),gd().catch(()=>null)]);if(I)return;if(D){f(D);const Q=typeof window<"u"&&window.localStorage.getItem(wx)||D.defaultWorkspaceParent;y(`${Q}/${u}`)}F&&g(F);const V=typeof window<"u"&&window.localStorage.getItem(kx);n?k(n):V?k(V):D&&k(rO(D));const X=typeof window<"u"&&window.localStorage.getItem(Sx);X&&(X==="cursor"||X==="claude-code"||X==="both")&&E(X)}catch(D){I||console.warn("[WireWorkspacePanel] host info / identity fetch failed:",D)}})(),()=>{I=!0}},[u,n]);function z(I){typeof window>"u"||(window.localStorage.setItem(wx,I),x&&window.localStorage.setItem(kx,x),window.localStorage.setItem(Sx,j))}async function _(){T(!0),A(null);try{const I=m.trim();if(!I||I.startsWith("~"))throw new Error("Workspace path must be an absolute path (start with `/`). The daemon will create the directory if it does not exist.");const D=await tO(e,{workspaceRoot:I,agentNickname:x.trim(),tools:jx(j)});R(D);const F=I.lastIndexOf("/");F>0&&z(I.slice(0,F))}catch(I){A((I==null?void 0:I.message)||"Preview failed")}finally{T(!1)}}async function P(){T(!0),A(null);try{const I=m.trim(),D=await nO(e,{workspaceRoot:I,agentNickname:x.trim(),tools:jx(j)});H(D)}catch(I){A((I==null?void 0:I.message)||"Install failed")}finally{T(!1)}}if($)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",c==="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:[$.written.map(I=>`${I.action.padEnd(9)} ${I.absPath} (${I.bytesWritten.toLocaleString()} bytes)`).join(`
1067
- `),$.skipped.length?`
1068
-
1069
- Skipped:
1070
- `+$.skipped.map(I=>` - ${I}`).join(`
1071
- `):"",$.warnings.length?`
1072
-
1073
- Warnings:
1074
- `+$.warnings.map(I=>` - ${I}`).join(`
1075
- `):""]}),o.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:14},children:o.jsx("button",{className:"v10-modal-btn primary",onClick:r,children:"Done"})})]});if(q)return o.jsxs("div",{children:[N&&o.jsx("div",{className:"v10-modal-error",style:{marginBottom:12},children:N}),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:q.markdown}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:14,gap:10},children:[o.jsx("button",{className:"v10-modal-btn",onClick:()=>{R(null),A(null)},disabled:S,children:"← Back"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{className:"v10-modal-btn",onClick:r,disabled:S,children:"Skip for now"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:P,disabled:S,children:S?"Installing…":"Install"})]})]})]});const B=((W=rh.find(I=>I.value===j&&!I.disabled))==null?void 0:W.description)??rh[0].description;return o.jsxs("div",{children:[o.jsxs("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:14,fontSize:12,background:"rgba(59, 130, 246, 0.08)",border:"1px solid rgba(59, 130, 246, 0.25)",color:"var(--accent-primary, #3b82f6)"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:4},children:c==="create"?"Wire your local workspace":"Wire this project locally"}),c==="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."]}),N&&o.jsx("div",{className:"v10-modal-error",style:{marginBottom:12},children:N}),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=>E(I.target.value),children:rh.map((I,D)=>o.jsx("option",{value:I.disabled?"__disabled__":I.value,disabled:I.disabled,children:I.label},`${I.label}-${D}`))}),o.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:B})]}),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:x,onChange:I=>k(I.target.value),placeholder:"e.g. Alice on laptop 1",spellCheck:!1,maxLength:80}),o.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:"Free-form human label rendered as the agent's name in chips, lists, and rdfs:label triples. Doesn't affect attribution — only changes how you appear to others."})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:14,gap:10},children:[s?o.jsx("button",{className:"v10-modal-btn",onClick:s,disabled:S,children:"Cancel"}):o.jsx("button",{className:"v10-modal-btn",onClick:r,disabled:S,children:"Skip for now"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:_,disabled:S||!m.trim()||!x.trim(),children:S?"Loading preview…":"Preview install"})]})]})}const Cx='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex="-1"])';function Zi(e,t){const n=w.useRef(null),r=w.useRef(null);w.useEffect(()=>{if(e)return r.current=document.activeElement??null,queueMicrotask(()=>{const c=n.current;if(!c)return;const u=c.querySelector(Cx),f=c.querySelector("[autofocus]")??u;f?f.focus():(c.hasAttribute("tabindex")||c.setAttribute("tabindex","-1"),c.focus())}),()=>{var c,u;(u=(c=r.current)==null?void 0:c.focus)==null||u.call(c)}},[e]),w.useEffect(()=>{if(!e)return;const c=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(Cx)).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",c,!0),()=>window.removeEventListener("keydown",c,!0)},[e,t]);const s=w.useCallback(c=>{c.target===c.currentTarget&&t()},[t]);return{dialogRef:n,onBackdropClick:s}}const no=80,iO=/<\/?[a-z][^>]*>/i,sO=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,oO=/[a-z0-9]/i;function lO(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 nS(e){if(typeof e!="string")return"";let t=lO(e);return t=t.replace(/[<>]/g,""),t=t.replace(sO,""),t=t.replace(/\s+/g," "),t=t.trim(),t.length>no&&(t=t.slice(0,no)),t}function Nx(e){const t=nS(e);return t?oO.test(t)?iO.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>no?`Name was trimmed to ${no} 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 Ex(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function cO({open:e,onClose:t}){var dt,ye;const[n,r]=w.useState(""),[s,c]=w.useState(""),[u,d]=w.useState("curated"),[f,h]=w.useState("curator-only"),[g,m]=w.useState(!1),[y,x]=w.useState("community"),k=Q_(),[j,E]=w.useState(((dt=k[0])==null?void 0:dt.slug)??"coding-project"),[S,T]=w.useState(!1),[N,A]=w.useState("off"),[q,R]=w.useState("7d"),[$,H]=w.useState("100k"),[z,_]=w.useState(!1),[P,B]=w.useState(""),[W,I]=w.useState(null),[D,F]=w.useState(null),[V,X]=w.useState(null),[Q,L]=w.useState(null),[U,G]=w.useState(""),[O,ne]=w.useState(!0),[ue,le]=w.useState(!1),{setContextGraphs:be,contextGraphs:Re,setActiveProject:Ee}=Na(),{openTab:Ie}=yn(),{setStage:Ve,stage:Se}=lg(),ht=()=>{ne(!0),le(!1),gd().then(K=>{X(K.agentAddress),le(!1)}).catch(()=>{X(null),le(!0)}).finally(()=>ne(!1))};w.useEffect(()=>{e&&(F(null),ht())},[e]);const Me=Zi(e&&!Q,t),qe=Zi(e&&!!Q,()=>{L(null),G(""),F(null),r(""),c(""),t()});if(!e)return null;const ke=nS(n),ct=Ex(ke),xe=V&&ct?`${V}/${ct}`:ct?`<agent-address>/${ct}`:"",Oe=n?Nx(n):null,_t=K=>{r(K)},Dt=async()=>{const K=ke;if(!K||Oe)return;_(!0),I(null),F(null),B(g?"Registering context graph on the network…":"Creating context graph locally…");const Z=Ex(K);if(!V){I("Agent identity is still loading. Please wait a moment and try again."),_(!1);return}const ee=`${V}/${Z}`;try{const ce=setTimeout(()=>B(g?"On-chain registration in progress — this can take up to 30s…":"Setting up local context graph…"),5e3),he=u==="curated"?1:0,Le=f==="curator-only"?0:1,He=u==="curated"?{accessPolicy:he,publishPolicy:Le,allowedAgents:V?[V]:[],register:g}:{accessPolicy:he,publishPolicy:Le,register:g},Ce=await f2(ee,K,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),F(Ne)}if(y==="community"||y==="agent")try{B(`Installing '${j}' ontology…`),await J_(Ce.created,j)}catch(Ne){console.warn("[CreateProjectModal] ontology install failed:",Ne),B(`Context graph created, but ontology install failed: ${(Ne==null?void 0:Ne.message)??Ne}`)}let Fe=!0;try{B("Publishing context graph manifest…"),await eO(Ce.created,{})}catch(Ne){Fe=!1,console.warn("[CreateProjectModal] manifest publish failed:",Ne),B(`Context graph created, but manifest publish failed: ${(Ne==null?void 0:Ne.message)??Ne}`)}B("Refreshing context graph list…");const{contextGraphs:et}=await Km();be(et??[]),Ee(Ce.created),Ie({id:`project:${Ce.created}`,label:K,closable:!0}),Se<2&&Ve(2),Fe?(G(K),L(Ce.created),B("")):setTimeout(()=>{r(""),c(""),B(""),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)),B("")}finally{_(!1)}},Qt=Re.length===0;function Ft(){L(null),G(""),F(null),r(""),c(""),t()}return Q?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:Ft,"aria-label":"Close wire workspace dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsxs("div",{id:"dkg-wire-modal-title",className:"v10-modal-title",children:["Wire workspace for ",U]}),o.jsx("div",{className:"v10-modal-subtitle",children:"Context graph created. Now wire a local workspace so you can plan it from your own Cursor."})]}),o.jsxs("div",{className:"v10-modal-body",children:[D&&o.jsx("div",{className:"v10-modal-warning",children:D}),o.jsx(tS,{contextGraphId:Q,projectName:U,variant:"create",onDone:Ft})]})]})}):o.jsx("div",{className:"v10-modal-overlay",onClick:Me.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:Me.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-create-cg-title","aria-describedby":"dkg-create-cg-subtitle",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close create context graph dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-create-cg-title",className:"v10-modal-title",children:"Create New Context Graph"}),o.jsx("div",{id:"dkg-create-cg-subtitle",className:"v10-modal-subtitle",children:"A context graph gives your agent structured memory — a place to draft, share, and publish knowledge."})]}),o.jsxs("div",{className:"v10-modal-body",children:[W&&o.jsx("div",{className:"v10-modal-error",children:W}),D&&o.jsx("div",{className:"v10-modal-warning",children:D}),Qt&&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:K=>_t(K.target.value),autoFocus:!0,maxLength:no,"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}/${no} 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:K=>c(K.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:K=>m(K.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:()=>x("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:K=>E(K.target.value),children:k.map(K=>o.jsx("option",{value:K.slug,children:K.displayName},K.slug))}),o.jsx("div",{style:{marginTop:6,fontSize:11,color:"var(--text-tertiary)"},children:(ye=k.find(K=>K.slug===j))==null?void 0:ye.description})]}),o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:y==="agent",onChange:()=>x("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:()=>x("upload"),disabled:!0}),"Upload an ontology file (.ttl, .owl, .rdf) ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]})]})]}),o.jsxs("div",{className:"v10-form-advanced-toggle",onClick:()=>T(!S),children:[o.jsx("span",{className:`v10-form-adv-chevron ${S?"open":""}`,children:"▸"}),o.jsx("span",{children:"Advanced settings"})]}),S&&o.jsxs("div",{className:"v10-form-advanced-body",style:{opacity:.5,pointerEvents:"none"},children:[o.jsxs("div",{className:"v10-form-group",children:[o.jsxs("label",{className:"v10-form-label",children:["Consensus Quorum ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("select",{className:"v10-form-select",value:N,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:q,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:$,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:ht,disabled:O,children:O?"Retrying…":"Retry Loading Agent"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:Dt,disabled:!n.trim()||!!Nx(n)||z||!V||O,children:z?P||"Creating…":V?"Create Context Graph":ue?"Agent unavailable":"Loading agent…"})]})]})})}const Tx=/^(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|12D3Koo[1-9A-HJ-NP-Za-km-z]{45,53})$/;function uO(e){var x;const t=e.trim().replace(/\\n/g,`
1076
- `),n=t.split(`
1077
- `).map(k=>k.trim()).filter(Boolean),r=n[0]??"",s=n.slice(1).join(" ").trim(),c=t.match(/(?:^|\s)(\/(?:ip4|ip6|dns|dns4|dns6|dnsaddr)\/\S+)/),u=((x=c==null?void 0:c[1])==null?void 0:x.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&&Tx.test(k[1])&&(h=k[1])}else for(const k of[s,...n.slice(1)]){const j=k.trim();if(Tx.test(j)){h=j;break}}let g=r;u&&g.includes(u)&&(g=g.replace(u,"")),g=g.replace(/\s*@\s*$/,"").trim();const y=(n.length>1||s.length>0)&&h===null&&f===null;return{cgId:g,curatorPeerId:h,legacyMultiaddr:f,hasUnparsedExtra:y}}function dO(e){if(!e.cgId)return"Missing context graph ID";if(e.hasUnparsedExtra)return"Invite contains a second line that is not a valid peer ID (12D3Koo…) or multiaddr (/ip4/…). Check for typos.";if(!e.curatorPeerId&&!e.legacyMultiaddr)return"This invite is missing the curator peer id. Ask the curator to regenerate the invite from the Share Context Graph dialog.";if(e.legacyMultiaddr){if(!e.legacyMultiaddr.startsWith("/"))return"Invalid curator multiaddr";if(!e.legacyMultiaddr.includes("/p2p/"))return"Curator multiaddr is missing peer ID"}return null}function pO(e){if(e instanceof Pa&&e.status===502){const t=fO(e.body);if(t.length===0)return"Request signed, but we couldn't deliver it to any reachable curator. Try again in a moment once your node has discovered more peers, or ask the curator for an updated invite.";const n=t.join("; "),r=t.some(hO),s=r?"Curator rejected this join request.":"Couldn't deliver this join request to the curator.",c=mO(n,r);return c?`${s} Reason: ${n}. ${c}`:`${s} Reason: ${n}.`}return e instanceof Error&&e.message?e.message:"Failed to send join request"}function fO(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 hO(e){const t=e.replace(/^[^:]+:\s*/,"").trim();return!(!t||/^dial failed\b/i.test(t)||/^not curator$/i.test(t))}function mO(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 gO({open:e,onClose:t,initialContextGraphId:n}){const[r,s]=w.useState(n??""),[c,u]=w.useState("idle"),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(null),[x,k]=w.useState(""),{contextGraphs:j,setContextGraphs:E,setActiveProject:S}=Na(),{openTab:T}=yn();w.useEffect(()=>{n&&s(n)},[n]),w.useEffect(()=>{e||(s(n??""),f(null),u("idle"),g(null))},[e,n]);const N=w.useCallback(async W=>{u("approved");try{const{contextGraphs:I}=await Km();E(I??[]);const D=I==null?void 0:I.find(F=>F.id===W);D&&(S(D.id),T({id:`project:${D.id}`,label:D.name||D.id,closable:!0}),k(D.name??W),y(W))}catch{}},[E,S,T]),A=w.useCallback(W=>{var D;if(!(!h||W.type!=="join_approved"&&W.type!=="join_rejected"||((D=W.data)==null?void 0:D.contextGraphId)!==h)){if(W.type==="join_rejected"){u("rejected");return}N(h)}},[h,N]);Ji(A);const q=Zi(e&&!m,t),R=Zi(e&&!!m,()=>{y(null),k(""),t()});if(!e)return null;const $=async()=>{const W=uO(r),I=dO(W);if(I){f(I);return}const{cgId:D,curatorPeerId:F,legacyMultiaddr:V}=W;f(null);const X=j.find(Q=>Q.id===D);if(X){S(X.id),T({id:`project:${X.id}`,label:X.name||X.id,closable:!0}),t();return}u("sending");try{F?await c2(F).catch(()=>{}):V&&(console.warn("[DKG] This invite uses a legacy multiaddr (deprecated). Ask the curator to regenerate using the current Share Context Graph modal — V10 invites carry a peer id and resolve via DHT, so they survive relay rotations."),await l2(V).catch(()=>{}));const Q=await m2(D),L=await gd().then(G=>G.name).catch(()=>{}),U=await g2(D,{delegation:Q.delegation,agentName:L,curatorPeerId:F??void 0});if(g(D),U.alreadyMember){await N(D);return}u("pending")}catch(Q){f(pO(Q)),u("idle")}};function H(){y(null),k(""),t()}if(m)return o.jsx("div",{className:"v10-modal-overlay",onClick:R.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:R.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-join-wire-title",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:H,"aria-label":"Close wire workspace dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsxs("div",{id:"dkg-join-wire-title",className:"v10-modal-title",children:["Wire workspace for ",x]}),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(tS,{contextGraphId:m,projectName:x,variant:"join",onDone:H})})]})});const z=c==="sending",_=c==="pending",P=c==="approved",B=c==="rejected";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-cg-title","aria-describedby":"dkg-join-cg-subtitle",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close join context graph dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-join-cg-title",className:"v10-modal-title",children:"Join a Context Graph"}),o.jsx("div",{id:"dkg-join-cg-subtitle",className:"v10-modal-subtitle",children:"Paste the invite from the curator. Your node will send a signed join request and wait for approval."})]}),o.jsxs("div",{className:"v10-modal-body",children:[d&&o.jsx("div",{className:"v10-modal-error",children:d}),_&&o.jsx("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:16,fontSize:12,background:"rgba(59, 130, 246, 0.08)",border:"1px solid rgba(59, 130, 246, 0.25)",color:"var(--accent-primary, #3b82f6)"},children:"Join request sent. Waiting for the curator to approve — this modal will move forward automatically once they do."}),P&&o.jsx("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:16,fontSize:12,background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.25)",color:"var(--accent-green)"},children:"Approved! Loading context graph…"}),B&&o.jsx("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:16,fontSize:12,background:"rgba(245, 158, 11, 0.08)",border:"1px solid rgba(245, 158, 11, 0.25)",color:"var(--accent-warning, #f59e0b)"},children:"The curator declined this join request."}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-invite",children:"Invite Code"}),o.jsx("textarea",{id:"dkg-cg-invite",name:"dkg-cg-invite",className:"v10-form-textarea",placeholder:`Paste the invite code from the context graph curator.
1078
-
1079
- e.g.
1080
- my-context-graph-abc123
1081
- 12D3KooW...`,value:r,onChange:W=>s(W.target.value),autoFocus:!0,rows:3,disabled:z||_||P,style:{fontFamily:"var(--font-mono)",fontSize:11},"aria-label":"Context graph invite code",autoComplete:"off",spellCheck:!1})]})]}),o.jsxs("div",{className:"v10-modal-footer",children:[o.jsx("button",{className:"v10-modal-btn",onClick:t,children:_||P?"Close":"Cancel"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:$,disabled:!r.trim()||z||_||P,children:z?"Sending request…":_?"Awaiting approval…":P?"Approved":"Request to Join"})]})]})})}const aS="v10:hiddenProjectIds",em="v10:hidden-projects-change";function ih(){try{const e=localStorage.getItem(aS);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t:[])}catch{return new Set}}function Ax(e){try{localStorage.setItem(aS,JSON.stringify([...e])),window.dispatchEvent(new Event(em))}catch{}}function dg(){const[e,t]=w.useState(()=>ih());w.useEffect(()=>{const s=()=>t(ih());return window.addEventListener(em,s),window.addEventListener("storage",s),()=>{window.removeEventListener(em,s),window.removeEventListener("storage",s)}},[]);const n=w.useCallback(s=>{const c=new Set(ih());c.add(s),Ax(c)},[]),r=w.useCallback(()=>{Ax(new Set)},[]);return{hidden:e,hide:n,unhideAll:r}}function pg(e){return{agentDid:e.agentDid,peerId:e.peerId}}function ao(e){if(!(e!=null&&e.trim()))return"unknown";const t=e.trim().replace(/^["']|["']$/g,"").toLowerCase();return t==="private"?"private":t==="public"?"public":"unknown"}function pn(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),c=/^(0x[a-fA-F0-9]{40})$/i.exec(s);return c?`${n}${c[1].toLowerCase()}`:`${n}${s}`}return/^0x[a-fA-F0-9]{40}$/.exec(t)?`${n}${t.toLowerCase()}`:t.toLowerCase()}function xd(e,t){var n,r;return e.callerInvolved===!0?!0:e.callerInvolved===!1||!((n=t==null?void 0:t.agentDid)!=null&&n.trim())?!1:!!((r=e.curator)!=null&&r.trim()&&pn(e.curator)===pn(t.agentDid))}function vO(e,t,n){const r=e.filter(s=>xd(s,t));if(n&&!r.some(s=>s.id===n)){const s=e.find(c=>c.id===n);if(s)return[s,...r]}return r}function yO(e,t){return xd(e,t)||ao(e.accessPolicy)!=="public"?!1:e.subscribed===!0||e.synced===!0}function Rx({cg:e,isActive:t,onSelect:n,onHide:r}){return o.jsx("div",{className:"v10-tree-section",children:o.jsxs("div",{className:`v10-tree-section-header ${t?"active":""}`,onClick:n,children:[o.jsx("span",{className:"v10-tree-project-dot"}),o.jsx("span",{className:"v10-tree-section-label",children:e.name||e.id.slice(0,16)}),o.jsx("button",{type:"button",className:"v10-tree-hide-btn",title:"Hide this context graph from the sidebar (reversible)",onClick:s=>{s.stopPropagation(),r()},children:"×"})]})})}function bO(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 xO(){const[e,t]=w.useState([]),[n,r]=w.useState(null),s=w.useCallback(()=>{yd().then(c=>{t(c.integrations),r(null)}).catch(c=>r(c.message))},[]);return Bl(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(c=>o.jsxs("div",{className:"v10-tree-item",title:c.detail,style:{cursor:"default"},children:[o.jsx("span",{"aria-label":c.statusLabel,style:{width:7,height:7,borderRadius:"50%",background:bO(c.status),flexShrink:0}}),o.jsx("span",{className:"v10-tree-item-label",children:c.name}),o.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:4},children:c.statusLabel})]},c.id))]})}function wO(){const e=qn(D=>D.leftSectionMyProjectsOpen),t=qn(D=>D.leftSectionIntegrationsOpen),n=qn(D=>D.toggleLeftSectionMyProjects),r=qn(D=>D.toggleLeftSectionIntegrations),s=w.useId(),c=w.useId(),{openTab:u,activeTabId:d,setActiveTab:f}=yn(),{contextGraphs:h,setContextGraphs:g,setLoading:m,activeProjectId:y,setActiveProject:x}=Na(),k=lg(D=>D.stage),[j,E]=w.useState("explorer"),{hidden:S,hide:T,unhideAll:N}=dg(),A=bd().data,q=A?pg(A):null,R=h.filter(D=>!S.has(D.id)),$=R.filter(D=>xd(D,q)),H=R.filter(D=>yO(D,q)),z=h.length-R.length,[_,P]=w.useState(!1),[B,W]=w.useState(!1),I=w.useCallback(()=>{m(!0),Tn.fetchContextGraphs().then(({contextGraphs:D})=>g(D??[])).catch(()=>{}).finally(()=>m(!1))},[g,m]);return Bl(I,6e4),Ji(w.useCallback(D=>{(D.type==="join_approved"||D.type==="project_synced")&&I()},[I])),o.jsxs("div",{className:"v10-panel-left",children:[o.jsxs("div",{style:{display:"flex",gap:4,padding:"8px 8px 4px"},children:[o.jsx("button",{className:"v10-new-project-btn",onClick:()=>P(!0),children:"+ New Context Graph"}),o.jsx("button",{className:"v10-new-project-btn",onClick:()=>W(!0),children:"↗ Join Context Graph"})]}),o.jsxs("div",{className:"v10-tree-header",children:[o.jsx("button",{className:`v10-tree-mode-btn ${j==="explorer"?"active":""}`,onClick:()=>E("explorer"),children:"Context Graphs"}),o.jsx("button",{className:`v10-tree-mode-btn ${j==="oracle"?"active":""}`,onClick:()=>E("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"),x(null)},children:[o.jsx("span",{children:"▦"})," Dashboard"]}),h.length===0&&k<=1&&o.jsxs("div",{className:"v10-journey-empty-card",children:[o.jsx("div",{className:"v10-jec-title",children:"No context graphs yet"}),o.jsx("div",{className:"v10-jec-hint",children:k===0?"Connect an agent to get started.":"Create your first context graph to give your agent structured memory."}),k===1&&o.jsx("button",{className:"v10-new-project-btn",style:{margin:0},onClick:()=>P(!0),children:"+ Create First Context Graph"})]}),(h.length>0||k>=2)&&o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header","aria-expanded":e,"aria-controls":s,onClick:n,children:[o.jsx(Jh,{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:$.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."})}):$.map(D=>o.jsx(Rx,{cg:D,isActive:y===D.id,onSelect:()=>{x(D.id),u({id:`project:${D.id}`,label:D.name||D.id.slice(0,16),closable:!0})},onHide:()=>{T(D.id),y===D.id&&x(null)}},D.id))})]}),z>0&&o.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:N,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",z," hidden context graph",z!==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":c,onClick:r,children:[o.jsx(Jh,{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:c,className:"v10-peer-group-body",children:o.jsx(xO,{})})]})]}),j==="oracle"&&o.jsxs("div",{className:"v10-tree-content",children:[H.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-tree-group-label",children:"Context Oracle"}),H.map(D=>o.jsx(Rx,{cg:D,isActive:y===D.id,onSelect:()=>{x(D.id),u({id:`project:${D.id}`,label:D.name||D.id.slice(0,16),closable:!0})},onHide:()=>{T(D.id),y===D.id&&x(null)}},D.id))]}),H.length===0&&o.jsxs("p",{style:{fontSize:12,color:"var(--text-tertiary)",padding:"20px 12px",textAlign:"center",lineHeight:1.5},children:["No public catalogue entries yet. Context graphs you sync or curate appear under ",o.jsx("strong",{children:"Context Graphs"}),"; non-private graphs you discover but haven't joined list here — use ",o.jsx("strong",{children:"Join Context Graph"})," to subscribe."]}),z>0&&o.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:N,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",z," hidden context graph",z!==1?"s":""]})]}),o.jsx(cO,{open:_,onClose:()=>P(!1)}),o.jsx(gO,{open:B,onClose:()=>W(!1)})]})}function Ea(e,t=[],n=0){const[r,s]=w.useState(null),[c,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__,x=sessionStorage.getItem("__dkg_401_reloaded")==="1";if(y&&!x){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))},x=()=>{m&&(clearInterval(m),m=null)},k=()=>{typeof document>"u"||(document.hidden?x():(g(),y()))};return(typeof document>"u"||!document.hidden)&&y(),typeof document<"u"&&document.addEventListener("visibilitychange",k),()=>{h.current=!1,x(),typeof document<"u"&&document.removeEventListener("visibilitychange",k)}},[g,n]),{data:r,loading:c,error:d,refresh:g}}function oq(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 _x(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 kO(e,t=new Date){if(e==null||e==="")return"—";const n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return"—";if(n.toDateString()===t.toDateString())return n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"});const r=new Date(t);if(r.setDate(t.getDate()-1),n.toDateString()===r.toDateString())return`Yesterday ${n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`;const s=t.getTime()-n.getTime();return s>=0&&s<10080*60*1e3?`${n.toLocaleDateString(void 0,{weekday:"short"})} ${n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:n.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ox(e,t=8){return e?e.length<=t*2?e:e.slice(0,t)+"..."+e.slice(-4):"—"}function SO(){const e=Na(m=>m.contextGraphs),t=Na(m=>m.setContextGraphs),{hidden:n}=dg(),[r,s]=w.useState(null),[c,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]),Ji(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(pg(y))}).catch(()=>{}).finally(()=>{m&&u(!1)}),()=>{m=!1}},[e]),{myCgs:w.useMemo(()=>e.filter(m=>!n.has(m.id)).filter(m=>xd(m,r)),[e,n,r]),identity:r,identityLoading:c,cgsLoading:d}}const fg=["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 wd(e={}){const t={predicates:[...e.extraPredicates??[],...fg]};return e.minZoomForLabels!==void 0&&(t.minZoomForLabels=e.minZoomForLabels),t}function kd(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 Lx="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function du(e){if(e!=null)return typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function zu(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 Qs(e){if(!e)return"—";if(e.startsWith('"'))return kd(e);const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function hg(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=e.lastIndexOf(":"),s=Math.max(t,n,r),c=s>=0?e.slice(s+1):e;try{return decodeURIComponent(c)}catch{return c}}function jO(e){const t=hg(e).trim();return t?(/^[0-9a-f-]{16,}$/i.test(t)?t.replace(/-/g,"").slice(0,12):t).replace(/[_-]+/g," ").trim():""}function CO(e,t){return e===t&&/^urn:dkg:extraction:[^\s]+$/i.test(t)}function NO(e,t){return e===t&&zu(t)}function EO(e){const t=jO(e.uri),n=e.types.map(Qs).find(r=>r&&r!=="Thing"&&r!=="Entity");return/^urn:dkg:extraction:[^\s]+$/i.test(e.uri)?t?`Extraction ${t}`:"Extraction":n?t&&t!==n?`${n} ${t}`:n:t||Qs(e.uri)}function TO(e){for(const n of fg){const r=e.properties.get(n),s=r==null?void 0:r.find(c=>c.trim().length>0);if(s)return s}const t=Qs(e.uri);return e.label&&(e.label!==t||!NO(e.label,e.uri))&&!CO(e.label,e.uri)?e.label:EO(e)}const rS=5e4,iS=2e4,sS=2e4;function AO(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 ${rS}`}function RO(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 ${iS}`}function _O(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 ${sS}`}function OO(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),s=r.indexOf("/"),c=s>=0?r.slice(0,s):r;if(!(!c||c.startsWith("_")||c==="assertion"||c==="meta"))return c}const zx={wm:"loading",swm:"loading",vm:"loading"},LO={wm:"error",swm:"error",vm:"error"};async function sh(e,t,n){var r,s;try{const{layerLimit:c,...u}=n??{},d={sparql:e,contextGraphId:t,...u},f=await Gu(d),h=((r=f==null?void 0:f.result)==null?void 0:r.bindings)??((s=f==null?void 0:f.results)==null?void 0:s.bindings)??[],g=typeof c=="number"&&h.length>=c;return{triples:h.map(y=>{const x=du(y.g);return{subject:du(y.s)??"",predicate:du(y.p)??"",object:du(y.o)??"",subGraph:x?OO(x,t):void 0}}).filter(y=>y.subject&&y.predicate&&y.object),ok:!0,truncated:g}}catch{return{triples:[],ok:!1,truncated:!1}}}function zO(e){var f;const t=new Map,n=new Map,r=new Map,s=new Map,c=new Map;function u(h,g,m){let y=s.get(h);y||(y=new Map,s.set(h,y));let x=y.get(g);if(x||(x=new Set,y.set(g,x)),x.has(m))return!1;x.add(m);let k=c.get(h);return k||(k={working:0,shared:0,verified:0},c.set(h,k)),k[g]++,!0}function d(h){const g=bt(h);let m=t.get(g);return m||(m={uri:g,label:Qs(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===Lx){const m=bt(h.object);g.types.includes(m)||g.types.push(m)}else if(zu(h.object)){const m=bt(h.object),y=d(m);y.layers.add(h.layer),h.subGraph&&y.subGraphs.add(h.subGraph);const x=n.get(g.uri)??new Set,k=`${h.predicate}\0${m}`;x.has(k)||(x.add(k),n.set(g.uri,x),g.connections.push({predicate:h.predicate,targetUri:m,targetLabel:Qs(m)}))}else{const m=r.get(g.uri)??new Set,y=`${h.predicate}\0${h.object}`;if(!m.has(y)){m.add(y),r.set(g.uri,m);const x=g.properties.get(h.predicate)??[];x.push(kd(h.object)),g.properties.set(h.predicate,x)}}}for(const h of t.values())h.label=TO(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=zu(h.object)?bt(h.object):h.object,x=zu(h.object);if(x){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===Lx){if(y!==g){const j=t.get(y);j&&u(j.uri,h.layer,k)}}else if(x&&y!==g){const j=t.get(y);j&&u(j.uri,h.layer,k)}}for(const h of t.values()){const g=c.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)??Qs(g.targetUri);return t}const oS=zO;function lS(e){return e.types.length>0||e.properties.size>0||e.connections.length>0}function mg(e,t){const n=(t==null?void 0:t.signalErrors)??!1,[r,s]=w.useState([]),[c,u]=w.useState(!0),[d,f]=w.useState(null),[h,g]=w.useState(!1),[m,y]=w.useState(zx),x=w.useRef(0),k=w.useCallback(async()=>{if(!e)return;const A=++x.current;u(!0),f(null),g(!1),y(zx);try{const q={includeContextGraphPartitions:!0},[R,$,H]=await Promise.all([sh(AO(e),e,{...q,layerLimit:rS}),sh(RO(e),e,{...q,layerLimit:iS}),sh(_O(e),e,{...q,layerLimit:sS})]);if(A!==x.current)return;const z=[...R.triples.map(W=>({...W,layer:"working"})),...$.triples.map(W=>({...W,layer:"shared"})),...H.triples.map(W=>({...W,layer:"verified"}))];s(z),y({wm:R.ok?"ok":"error",swm:$.ok?"ok":"error",vm:H.ok?"ok":"error"});const _=[R,$,H],P=_.filter(W=>!W.ok).length,B=_.some(W=>W.truncated);g(P>0&&P<3||B),f(n&&P===3?"Failed to load memory data":null)}catch(q){A===x.current&&(f(q.message??"Failed to load memory data"),y(LO))}finally{A===x.current&&u(!1)}},[e,n]);po(e,k),w.useEffect(()=>{k()},[k]);const j=w.useMemo(()=>oS(r),[r]),E=w.useMemo(()=>[...j.values()].filter(lS).sort((A,q)=>{const R={verified:0,shared:1,working:2},$=R[A.trustLevel]-R[q.trustLevel];if($!==0)return $;const H=A.tripleCount??0,z=q.tripleCount??0;return z!==H?z-H:A.label.localeCompare(q.label)}),[j]),S=w.useMemo(()=>{const A=new Set;return r.filter(q=>{const R=`${q.subject}|${q.predicate}|${q.object}`;return A.has(R)?!1:(A.add(R),!0)}).map(({subject:q,predicate:R,object:$,subGraph:H})=>({subject:q,predicate:R,object:$,subGraph:H}))},[r]),T=w.useMemo(()=>{const A=new Map;for(const[q,R]of j)A.set(q,R.trustLevel);return A},[j]),N=w.useMemo(()=>{let A=0,q=0,R=0;for(const $ of E)$.trustLevel==="verified"?R++:$.trustLevel==="shared"?q++:A++;return{wm:A,swm:q,vm:R,total:E.length}},[E]);return{entities:j,entityList:E,allTriples:r,graphTriples:S,trustMap:T,counts:N,loading:c,error:d,partial:h,layerStatus:m,refresh:k}}const Fl="http://dkg.io/viz/",cS=`${Fl}OnChainAnchor`,uS=`${Fl}AgentIdentity`,dS=`${Fl}anchoredIn`,pS=`${Fl}signedBy`,fS=`${Fl}consensus`,Mx="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",Dx="http://schema.org/name",$x="http://schema.org/description";function ll(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 MO(e){const t=e.opId.slice(0,10);try{const r=new Date(e.publishedAt).toISOString().slice(11,16);return`anchor ${t} · ${r}UTC`}catch{return`anchor ${t}`}}function DO(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 $O(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 IO(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),s=r.indexOf("/");if(s<0)return;const c=r.slice(0,s);if(!(!c||c.startsWith("_")))return c}function PO(e){const t=e.lastIndexOf(":");return t>=0?e.slice(t+1):e}function UO(e,t){const n=[],r=new Set;for(const s of e){const c=t?s.roots.filter(d=>t.has(d)):s.roots;if(c.length===0)continue;const u=`urn:dkg:viz:anchor:${s.opId}`;n.push({subject:u,predicate:Mx,object:cS,subGraph:s.subGraph}),n.push({subject:u,predicate:Dx,object:`"${MO(s)}"`,subGraph:s.subGraph}),n.push({subject:u,predicate:$x,object:`"Published ${s.roots.length} KA${s.roots.length===1?"":"s"} · ${new Date(s.publishedAt).toISOString()}"`,subGraph:s.subGraph});for(const d of c)n.push({subject:d,predicate:dS,object:u,subGraph:s.subGraph}),n.push({subject:d,predicate:fS,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:pS,object:h,subGraph:s.subGraph}),r.has(h)||(r.add(h),n.push({subject:h,predicate:Mx,object:uS,subGraph:s.subGraph}),n.push({subject:h,predicate:Dx,object:`"${DO(f)}"`,subGraph:s.subGraph}),n.push({subject:h,predicate:$x,object:`"${f}"`,subGraph:s.subGraph}))}}return n}function BO(e,t){const[n,r]=w.useState([]),[s,c]=w.useState(!1),[u,d]=w.useState(null),f=w.useRef(0);w.useEffect(()=>{if(!e){r([]),c(!1);return}const y=++f.current;c(!0),d(null),(async()=>{var x;try{const k=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...qt()},body:JSON.stringify({sparql:$O(e)})});if(!k.ok)throw new Error(`SPARQL query failed: ${k.status}`);const j=await k.json(),E=((x=j==null?void 0:j.result)==null?void 0:x.bindings)??[],S=new Map;for(const T of E){const N=ll(T.op),A=ll(T.root),q=ll(T.agent),R=ll(T.publishedAt),$=ll(T.g);if(!N||!A||!q||!R)continue;let H=S.get(N);H||(H={opId:PO(N),opUri:N,agents:[],roots:[],publishedAt:R,subGraph:$?IO($,e):void 0},S.set(N,H)),H.roots.includes(A)||H.roots.push(A),H.agents.includes(q)||H.agents.push(q)}if(y!==f.current)return;r([...S.values()].sort((T,N)=>N.publishedAt.localeCompare(T.publishedAt)))}catch(k){if(y!==f.current)return;d((k==null?void 0:k.message)??"Failed to load anchors"),r([])}finally{y===f.current&&c(!1)}})()},[e]);const h=w.useMemo(()=>{if(!t)return null;const y=[];if(t instanceof Set)for(const x of t)y.push(x);else for(const x of t)y.push(x);return y.sort(),y.join("|")},[t]),g=w.useMemo(()=>h==null?null:new Set(h.length===0?[]:h.split("|")),[h]),m=w.useMemo(()=>UO(n,g),[n,g]);return{anchors:n,decorationTriples:m,loading:s,error:u}}function FO(e){return e.activeSubGraph?!1:e.activeLayer==="swm"}const Gi={verified:"#22c55e",shared:"#f59e0b",working:"#64748b"},Us={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"}},HO="http://www.w3.org/ns/prov#wasAttributedTo",fo="http://dkg.io/ontology/agent/",qO=fo+"createdBy",GO=fo+"promotedBy",VO=fo+"publishedBy",WO=fo+"createdAt",ZO=fo+"promotedAt",YO=fo+"publishedAt";function Sd(e){for(const t of e.connections)if(t.predicate===HO)return t.targetUri;return null}function QO(e,t){const n=t==="created"?qO:t==="promoted"?GO:VO;for(const r of e.connections)if(r.predicate===n)return r.targetUri;return Sd(e)}function KO(e,t){const n=t==="created"?WO:t==="promoted"?ZO:YO,r=e.properties.get(n);return(r==null?void 0:r[0])??null}function Ix(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function Bs(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return(r>=0?e.slice(r+1):e).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ")}function jd(e,t){var s,c;if(t)for(const u of e.types){const d=t.forType(u),f=Ix(u),h=d.label??f;if(d.icon||d.color||d.label)return{icon:d.icon??((s=Us[f])==null?void 0:s.icon)??Us.Thing.icon,group:d.label??((c=Us[f])==null?void 0:c.group)??Us.Thing.group,color:d.color,type:h}}const n=e.types[0]?Ix(e.types[0]):"Entity";return{...Us[n]??Us.Thing,type:n}}const Mn={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 Lr(e,t=2){const n=e==="working"?"wm":e==="shared"?"swm":e==="verified"?"vm":e,r=t!==1;return n==="vm"?r?"Knowledge Assets":"Knowledge Asset":r?"Entities":"Entity"}const Hn="http://dkg.io/ontology/code/",hS={[Hn+"Package"]:"#a855f7",[Hn+"File"]:"#3b82f6",[Hn+"Class"]:"#22c55e",[Hn+"Interface"]:"#06b6d4",[Hn+"Function"]:"#f59e0b",[Hn+"TypeAlias"]:"#ec4899",[Hn+"Enum"]:"#ef4444",[Hn+"ExternalModule"]:"#64748b",[cS]:"#f5a524",[uS]:"#c084fc"},mS={[Hn+"imports"]:"#60a5fa",[Hn+"contains"]:"#a855f7",[Hn+"definedIn"]:"#3b82f6",[Hn+"exports"]:"#f59e0b",[Hn+"extends"]:"#22c55e",[Hn+"implements"]:"#06b6d4",[dS]:"#f5a524",[pS]:"#c084fc",[fS]:"#22c55e"};function gg(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 XO(e,t){const{color:n}=Mn[e],r=e==="vm";return{labelMode:"humanized",renderer:"2d",labels:wd({minZoomForLabels:r?.2:.3}),style:{classColors:hS,predicateColors:mS,namespaceColors:gg(n),...t&&Object.keys(t).length>0?{nodeColors:t}:{},defaultNodeColor:n,defaultEdgeColor:r?"#4ade80":"#64748b",edgeWidth:r?1.8:1.2,fontSize:r?12:11,gradient:!0,gradientIntensity:r?.65:.4},hexagon:{baseSize:r?13:11,minSize:r?8:7,maxSize:r?42:28,scaleWithDegree:!0},focus:{maxNodes:3e3,hops:999}}}function JO(e){const t=["http://schema.org/description","http://schema.org/text"];for(const n of t){const r=e.properties.get(n);if(r!=null&&r[0])return r[0]}return null}function eL(e,t,n=2){const r=d=>bt(d.subject),s=d=>bt(d.object),c=new Set([e]);let u=new Set([e]);for(let d=0;d<n;d++){const f=new Set;for(const h of t){const g=r(h),m=s(h);u.has(g)&&!c.has(m)&&f.add(m),u.has(m)&&!c.has(g)&&f.add(g)}for(const h of f)c.add(h);if(u=f,u.size===0)break}return t.filter(d=>c.has(r(d))&&c.has(s(d)))}function gS(e,t){const n=t.lastIndexOf("/"),r=t.lastIndexOf("#"),s=t.lastIndexOf(":"),c=Math.max(n,r,s),u=c>=0?t.slice(c+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 vg(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?vg(e.object)&&t.scopedUris.has(e.object):t.scopedUris.has(e.object)}function vS(e,t){const n=t.get(bt(e.subject));return n!==void 0&&n.trustLevel!==e.layer}function yS(e,t){if(!vg(e.object))return!1;const n=t.get(bt(e.object));return n!==void 0&&n.trustLevel!==e.layer}function bS(e,t){return vS(e,t)||yS(e,t)}function xS(e,t){return vS(e,t)&&yS(e,t)}function nm(e,t){const n=new Set,r=[];for(const s of e){if(xS(s,t))continue;const c=`${bt(s.subject)}|${s.predicate}|${bt(s.object)}`;n.has(c)||(n.add(c),r.push(s))}return r}function yg(e){return w.useMemo(()=>{const t=nm(e.allTriples,e.entities);return{triples:t,total:t.length}},[e.allTriples,e.entities])}function wS(e){return w.useMemo(()=>{const t=new Set,n=new Set,r=new Set,s=new Set;let c=0,u=0,d=0,f=0;for(const h of e.allTriples){const g=`${bt(h.subject)}|${h.predicate}|${bt(h.object)}`;!xS(h,e.entities)&&!s.has(g)&&(s.add(g),f++),bS(h,e.entities)||(h.layer==="working"&&!t.has(g)?(t.add(g),c++):h.layer==="shared"&&!n.has(g)?(n.add(g),u++):h.layer==="verified"&&!r.has(g)&&(r.add(g),d++))}return{wm:c,swm:u,vm:d,canonical:f}},[e.allTriples,e.entities])}function tL(e,t){const n=Mn[t].trustLevel;return w.useMemo(()=>{const r=new Set,s=[];for(const c of e.allTriples){if(c.layer!==n||bS(c,e.entities))continue;const u=`${bt(c.subject)}|${c.predicate}|${bt(c.object)}`;r.has(u)||(r.add(u),s.push(c))}return s},[e.allTriples,e.entities,n])}const nL="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function aL(e){const t=e.trim();return(t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t)===nL}function Ku(e,t,n){const r=[],s=n==null?void 0:n.focalSubjects;for(const c of e){const u=bt(c.subject);!t.has(u)&&!(s!=null&&s.has(u))||vg(c.object)&&!aL(c.predicate)&&!t.has(bt(c.object))||r.push(c)}return r}const oh="http://dkg.io/ontology/sourceContentType",Px="http://dkg.io/ontology/markdownForm",Ux="http://dkg.io/ontology/sourceFile",Bx="http://dkg.io/ontology/size";function rL(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 iL(e){const[t,n]=e.split("-"),r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=Math.max(0,Math.min(11,parseInt(n,10)-1));return`${r[s]} ${t}`}function Mu(e,t){const n=e.properties.get(t),r=n==null?void 0:n[0];if(!r)return null;const s=r.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),c=Date.parse(s);return Number.isNaN(c)?null:c}function sL(e){const t=Date.now()-e;if(t<0)return"just now";const n=Math.floor(t/1e3);if(n<45)return"just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const s=Math.floor(r/60);if(s<24)return`${s}h ago`;const c=Math.floor(s/24);return c<30?`${c}d ago`:new Date(e).toISOString().slice(0,10)}function oL(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 lL(e){if(!(e==null||e===""))return`Exact balance: ${e} (full precision from chain)`}const cL="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.",am=[{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."}],pu={1:{name:"Ethereum",gas:"ETH"},8453:{name:"Base",gas:"ETH"},84532:{name:"Base Sepolia",gas:"ETH"},100:{name:"Gnosis",gas:"xDAI"},10200:{name:"Chiado",gas:"xDAI"},2043:{name:"NeuroWeb",gas:"NEURO"},20430:{name:"NeuroWeb Testnet",gas:"NEURO"}};function lh(e){var r;if(e==null)return{name:"Unknown chain",gas:"ETH"};const t=String(e);if(pu[t])return pu[t];const n=(r=t.match(/(\d+)\s*$/))==null?void 0:r[1];return n&&pu[n]?pu[n]:{name:n?`Chain ${n}`:`Chain ${t}`,gas:"ETH"}}function cl(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 ch({label:e,value:t,sub:n,accentColor:r,children:s,icon:c,className:u}){return o.jsxs("div",{className:`stat-card v10-anim-mount${u?` ${u}`:""}`,children:[r&&o.jsx("div",{className:"accent",style:{background:r}}),o.jsxs("div",{className:"stat-label",children:[c,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 Fx({counts:e}){const t=e.wm+e.swm+e.vm,n=am.map(r=>`${r.short} ${e[r.key]}`).join(" · ");return o.jsx("div",{className:"v10-layerbar","aria-label":n,children:t===0?o.jsx("span",{className:"v10-layerbar-empty"}):am.map(r=>{const s=e[r.key]/t*100;return s<=0?null:o.jsx("span",{className:"v10-layerbar-seg",title:`${r.label} (${e[r.key]}) — ${r.desc}`,style:{width:`${s}%`,background:r.color}},r.key)})})}function uL(){return o.jsx("div",{className:"v10-layer-legend",children:am.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 dL({curator:e,joined:t,refreshing:n}){const r=e+t,s=`Curator ${e} · Joined ${t}`,c="var(--accent-green)",u="var(--text-secondary)";return o.jsxs("div",{className:`v10-cg-rolesplit${n?" is-refreshing":""}`,title:n?"Refreshing — agent identity is being re-checked":void 0,"aria-busy":n||void 0,children:[o.jsx("div",{className:"v10-layerbar","aria-label":s,children:r===0?o.jsx("span",{className:"v10-layerbar-empty"}):o.jsxs(o.Fragment,{children:[e>0&&o.jsx("span",{className:"v10-layerbar-seg",title:`Curator (${e}) — context graphs you created and curate`,style:{width:`${e/r*100}%`,background:c}}),t>0&&o.jsx("span",{className:"v10-layerbar-seg",title:`Joined (${t}) — context graphs you joined as a member`,style:{width:`${t/r*100}%`,background:u}})]})}),o.jsxs("div",{className:"v10-layer-legend",children:[o.jsxs("span",{className:"v10-layer-legend-item",title:"Curator — context graphs you created and curate",children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:c}}),"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 pL({cg:e,identity:t,onReport:n,onOpen:r}){var $,H;const s=mg(e.id,{signalErrors:!0}),[c,u]=w.useState(null),[d,f]=w.useState(!1),h=c===null&&!d,g=w.useRef(!0),m=w.useRef(0),y=w.useCallback(()=>{const z=++m.current;Tn.listParticipants(e.id).then(_=>{g.current&&z===m.current&&(u((_.allowedAgents??[]).map(pn)),f(!1))}).catch(()=>{g.current&&z===m.current&&(u(null),f(!0))})},[e.id]);w.useEffect(()=>{g.current=!0,u(null),f(!1),y();const z=setInterval(y,3e4);return()=>{g.current=!1,clearInterval(z)}},[y]),Ji(w.useCallback(z=>{var P,B;if(z.type!=="join_approved"&&z.type!=="join_rejected"&&z.type!=="project_synced")return;const _=((P=z.data)==null?void 0:P.contextGraphId)??((B=z.data)==null?void 0:B.projectId);_&&_!==e.id||y()},[e.id,y]));const x=ao(e.accessPolicy)==="public",k=w.useMemo(()=>{var B;if(x)return null;const z=(B=e.curator)==null?void 0:B.trim(),_=z?pn(z):null;if(c===null)return d&&_?[_]:null;const P=new Set(c);return _&&P.add(_),[...P]},[c,d,e.curator,x]),j=Number.isFinite(e.assetCount??e.assets)?e.assetCount??e.assets:0,E=w.useMemo(()=>{if(s.error)return{wm:0,swm:0,vm:0,total:j};const z=new Set(s.allTriples.map(_=>_.subject)).size;return{wm:s.counts.wm,swm:s.counts.swm,vm:s.counts.vm,total:z}},[s.error,s.allTriples,s.counts.wm,s.counts.swm,s.counts.vm,j]),S=wS(s),T=w.useMemo(()=>({wm:S.wm,swm:S.swm,vm:S.vm,total:S.canonical}),[S]),N=[s.loading?1:0,s.error?1:0,s.partial?1:0,h?1:0,d?1:0,x?1:0,E.wm,E.swm,E.vm,E.total,T.wm,T.swm,T.vm,T.total,k?k.slice().sort().join(","):"∅"].join("|");w.useEffect(()=>{n(e.id,{entities:E,triples:T,agents:k??[],sizeLoading:s.loading,sizeError:!!s.error||s.partial,sizeFallback:!!s.error,agentsLoading:h,agentsError:d,agentsUnknown:x,sig:N})},[e.id,N]);const A=ao(e.accessPolicy),q=A==="private"?"Curated":A==="public"?"Public":"Unknown",R=!!(($=e.curator)!=null&&$.trim()&&((H=t==null?void 0:t.agentDid)!=null&&H.trim())&&pn(e.curator)===pn(t.agentDid));return o.jsxs("button",{className:"v10-cg-row",onClick:()=>r(e),children:[o.jsx("span",{className:"v10-cg-cell v10-cg-name",children:e.name||e.id.slice(0,16)}),o.jsx("span",{className:"v10-cg-cell v10-cg-type",title:`${q} context graph`,"aria-label":`${q} context graph`,children:A==="private"?o.jsx(b_,{size:13,"aria-hidden":"true"}):A==="public"?o.jsx(m_,{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:[cl(E.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:["~",cl(E.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ~",cl(T.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"triples"})]}):o.jsxs(o.Fragment,{children:[cl(E.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ",cl(T.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"triples"})]})}),o.jsx("span",{className:"v10-cg-cell v10-cg-agents",children:k===null?o.jsx("span",{className:"v10-cg-dim",children:"—"}):d?o.jsxs("span",{title:"Participant list unavailable — curator-only lower bound",children:["~",k.length]}):k.length}),o.jsx("span",{className:"v10-cg-cell v10-cg-role",children:o.jsx("span",{className:`v10-cg-badge v10-cg-badge-${R?"curator":"joined"}`,children:R?"CURATOR":"JOINED"})})]})}const Hx={wm:0,swm:0,vm:0,total:0};function fL(){var R,$;const{data:e}=Ea(Tn.fetchStatus,[],1e4),{data:t}=Ea(Tn.fetchEconomics,[],6e4),{data:n,loading:r,error:s}=Ea(Tn.fetchWalletsBalances,[],3e4),{openTab:c}=yn(),{setActiveProject:u}=Na(),{myCgs:d,identity:f,identityLoading:h,cgsLoading:g}=SO(),m=(h||g)&&d.length===0,[y,x]=w.useState({}),k=w.useCallback((H,z)=>{x(_=>{var P;return((P=_[H])==null?void 0:P.sig)===z.sig?_:{..._,[H]:z}})},[]);w.useEffect(()=>{const H=new Set(d.map(z=>z.id));x(z=>{const _=Object.keys(z);if(_.every(B=>H.has(B)))return z;const P={};for(const B of _)H.has(B)&&(P[B]=z[B]);return P})},[d]);const j=w.useMemo(()=>{const H={...Hx},z={...Hx},_=new Set;let P=!1,B=!1,W=!1,I=!1,D=!1;for(const V of d){const X=y[V.id];if(!X){P=!0,B=!0;continue}X.sizeLoading&&(P=!0),X.agentsLoading&&(B=!0),X.sizeError&&(W=!0),X.sizeFallback&&(D=!0),(X.agentsError||X.agentsUnknown)&&(I=!0);for(const Q of["wm","swm","vm","total"])H[Q]+=X.entities[Q],z[Q]+=X.triples[Q];for(const Q of X.agents)_.add(Q)}const F=d.length>0;return{entities:H,triples:z,agentCount:_.size,sizeLoading:F&&P,agentsLoading:F&&B,sizePartial:W,agentsPartial:I,triplesUnknown:F&&W&&z.total===0,sizeApprox:F&&D,hasCgs:F}},[d,y]),E=w.useMemo(()=>{var P,B;const H=(P=f==null?void 0:f.agentDid)!=null&&P.trim()?pn(f.agentDid):null;let z=0,_=0;for(const W of d)!!(H&&((B=W.curator)!=null&&B.trim())&&pn(W.curator)===H)?z++:_++;return{curator:z,joined:_}},[d,f]),S=[{label:"24h",display:"Last 24h"},{label:"7d",display:"Last 7d"},{label:"30d",display:"Last 30d"}],T=H=>{if(H==null||typeof H=="string"&&H.trim()==="")return"—";const z=Number(H);return isFinite(z)?z.toLocaleString(void 0,{maximumFractionDigits:z>=1e3?0:2}):String(H)},N=S.map(H=>{var _;const z=(_=t==null?void 0:t.periods)==null?void 0:_.find(P=>P.label===H.label);return{display:H.display,publishes:z?String(z.publishCount):"—",trac:z?T(z.totalTrac):"—"}});n!=null&&n.symbol;const A=(n==null?void 0:n.balances)??[],q=H=>H.length>12?`${H.slice(0,6)}…${H.slice(-4)}`:H;return o.jsxs("div",{className:"v10-dashboard",children:[o.jsxs("div",{className:"v10-dash-header",children:[o.jsx("h1",{className:"v10-dash-title",children:"Dashboard"}),o.jsxs("p",{className:"v10-dash-subtitle",children:[(e==null?void 0:e.name)||"DKG Node"," · ",(e==null?void 0:e.networkName)||"network",(n==null?void 0:n.chainId)!=null?` · ${lh(n.chainId).name}`:""]})]}),o.jsxs("div",{className:"v10-dash-stats v10-dash-stats-3",children:[o.jsx(ch,{label:"My Context Graphs",className:"v10-stat-tight",icon:o.jsx(xx,{size:13,"aria-hidden":!0}),value:m?o.jsx("span",{className:"v10-stat-loading",children:"loading…"}):d.length,accentColor:"var(--accent-blue)",sub:cL,children:j.hasCgs&&!m?o.jsx(dL,{curator:E.curator,joined:E.joined,refreshing:h}):null}),o.jsxs(ch,{label:"Context Graph Size",icon:o.jsx(N_,{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(Fx,{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(Fx,{counts:j.triples})]}),o.jsx(uL,{})]}):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(ch,{label:"Collaborating Agents",icon:o.jsx(R_,{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(xx,{size:13,"aria-hidden":!0}),o.jsx("h3",{children:"My Context Graphs"})]}),o.jsx("span",{className:"v10-dash-section-badge",children:d.length})]}),m?o.jsx("p",{className:"v10-cg-empty",children:"Loading context graphs…"}):d.length===0?o.jsx("p",{className:"v10-cg-empty",children:"No context graphs yet — create or join one from the sidebar."}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-cg-colhead",children:[o.jsx("span",{className:"v10-cg-cell v10-cg-name",children:"Name"}),o.jsx("span",{className:"v10-cg-cell v10-cg-type",children:"Type"}),o.jsx("span",{className:"v10-cg-cell v10-cg-size",children:"Size"}),o.jsx("span",{className:"v10-cg-cell v10-cg-agents",title:"Agents allow-listed with access to this context graph",children:"Agents"}),o.jsx("span",{className:"v10-cg-cell v10-cg-role",children:"Role"})]}),o.jsx("div",{className:"v10-cg-list",children:d.map(H=>o.jsx(pL,{cg:H,identity:f,onReport:k,onOpen:z=>{u(z.id),c({id:`project:${z.id}`,label:z.name||z.id.slice(0,12),closable:!0})}},H.id))})]})]}),o.jsxs("div",{className:"v10-dash-section v10-anim-mount",children:[o.jsx("div",{className:"v10-dash-section-header",children:o.jsxs("div",{className:"v10-dash-section-title",children:[o.jsx(O_,{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"}),r&&!n?o.jsx("p",{className:"v10-cg-empty",children:"Loading wallets…"}):A.length>0?o.jsxs("div",{className:"v10-ws-wtable",children:[o.jsxs("div",{className:"v10-ws-wrow v10-ws-whead",children:[o.jsx("span",{children:"Wallet"}),o.jsx("span",{children:"TRAC"}),o.jsxs("span",{children:["Gas (",lh(n==null?void 0:n.chainId).gas,")"]})]}),A.map(H=>o.jsxs("div",{className:"v10-ws-wrow",children:[o.jsx("span",{className:"v10-ws-addr",title:H.address,children:q(H.address)}),o.jsx("span",{className:"v10-ws-bal",children:T(H.trac)}),o.jsx("span",{className:"v10-ws-bal-sec",title:lL(H.eth),children:oL(H.eth)})]},H.address))]}):(((R=n==null?void 0:n.wallets)==null?void 0:R.length)??0)>0?o.jsx("ul",{className:"v10-ws-wallets",children:((n==null?void 0:n.wallets)??[]).map(H=>o.jsxs("li",{className:"v10-ws-wallet",children:[o.jsx("span",{className:"v10-ws-addr",title:H,children:q(H)}),o.jsx("span",{className:"v10-cg-dim",children:"—"})]},H))}):n!=null&&n.error||s?o.jsx("p",{className:"v10-cg-empty",children:"Wallet balances unavailable."}):o.jsx("p",{className:"v10-cg-empty",children:"No node wallets found."}),(n!=null&&n.error||s)&&(A.length>0||((($=n==null?void 0:n.wallets)==null?void 0:$.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"})]}),N.map(H=>o.jsxs("div",{className:"v10-ws-spend-row",children:[o.jsx("span",{className:"v10-cg-dim",children:H.display}),o.jsx("span",{className:"v10-ws-spend-val",children:H.publishes}),o.jsx("span",{className:"v10-ws-spend-val",children:H.trac})]},H.display))]})]})]})]})}const hL=new Set(["meta"]),za="__root__";function bg(e){return!hL.has(e.name)}const mL=".md, .docx, .pdf, .txt, .csv, .json, .ttl, .rdf, .owl, .py, .ts, .js, .tsx, .jsx, .java, .go, .rs, .c, .cpp, .html, .xml, .yaml, .yml";function qx(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function gL(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 vL({open:e,onClose:t,contextGraphId:n,contextGraphName:r}){var X;const[s,c]=w.useState([]),[u,d]=w.useState(!0),[f,h]=w.useState(!0),[g,m]=w.useState("idle"),[y,x]=w.useState(0),[k,j]=w.useState([]),[E,S]=w.useState(null),[T,N]=w.useState(!1),A=w.useRef(null),q=w.useCallback(Q=>{const L=Array.from(Q);c(U=>{const G=new Set(U.map(ne=>`${ne.file.name}:${ne.file.size}`)),O=L.filter(ne=>!G.has(`${ne.name}:${ne.size}`));return[...U,...O.map(ne=>({file:ne,id:`${ne.name}-${ne.size}-${Date.now()}`}))]})},[]),R=Q=>{c(L=>L.filter(U=>U.id!==Q))},$=Q=>{Q.preventDefault(),Q.stopPropagation(),N(!0)},H=Q=>{Q.preventDefault(),Q.stopPropagation(),N(!1)},z=Q=>{Q.preventDefault(),Q.stopPropagation(),N(!1),Q.dataTransfer.files.length>0&&q(Q.dataTransfer.files)},_=async()=>{if(s.length===0)return;m("uploading"),x(0),j([]),S(null);const Q=[];for(let U=0;U<s.length;U++){x(U);const{file:G}=s[U],O=G.name.replace(/[^a-zA-Z0-9._-]/g,"_"),ne=`${Date.now().toString(36)}-${U}-${O}`;try{const ue=await Yk(ne,n,G),le=ue.extraction.tripleCount??ue.extraction.triplesWritten;Q.push({fileName:G.name,status:ue.extraction.status==="completed"?"success":ue.extraction.status==="skipped"?"skipped":"error",triplesWritten:le,error:ue.extraction.error})}catch(ue){Q.push({fileName:G.name,status:"error",error:(ue==null?void 0:ue.message)??"Upload failed"})}}j(Q),x(s.length);const L=Q.some(U=>U.status==="error");m(L?"error":"done")},P=()=>{g!=="uploading"&&(c([]),j([]),m("idle"),S(null),x(0),t())},{dialogRef:B,onBackdropClick:W}=Zi(e,P);if(!e)return null;const I=k.reduce((Q,L)=>Q+(L.triplesWritten??0),0),D=k.filter(Q=>Q.status==="success").length,F=k.filter(Q=>Q.status==="skipped").length,V=k.filter(Q=>Q.status==="error").length;return o.jsx("div",{className:"v10-modal-overlay",onClick:W,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:B,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-import-modal-title",children:[o.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{id:"dkg-import-modal-title",className:"v10-modal-title",children:"Import to Working Memory"}),o.jsx("div",{className:"v10-modal-subtitle",children:r?o.jsxs(o.Fragment,{children:["Upload files to ",o.jsx("strong",{children:r})," — your agent will extract structured knowledge."]}):o.jsx(o.Fragment,{children:"Upload files — your agent will extract structured knowledge and add it to working memory."})})]}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:P,disabled:g==="uploading","aria-label":"Close import dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:g==="uploading"?"not-allowed":"pointer"},children:"×"})]}),o.jsxs("div",{className:"v10-modal-body",children:[E&&o.jsx("div",{className:"v10-modal-error",children:E}),g==="idle"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`v10-import-dropzone ${T?"drag-over":""}`,onClick:()=>{var Q;return(Q=A.current)==null?void 0:Q.click()},onDragOver:$,onDragLeave:H,onDrop:z,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: ",mL]}),o.jsx("input",{ref:A,type:"file",multiple:!0,style:{display:"none"},onChange:Q=>{Q.target.files&&q(Q.target.files),Q.target.value=""}})]}),s.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-import-file-list",children:s.map(Q=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:gL(Q.file.name)}),o.jsx("span",{className:"v10-import-file-name",children:Q.file.name}),o.jsx("span",{className:"v10-import-file-size",children:qx(Q.file.size)}),o.jsx("button",{className:"v10-import-file-remove",onClick:()=>R(Q.id),title:"Remove",children:"×"})]},Q.id))}),o.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginBottom:12},children:[s.length," file",s.length!==1?"s":""," selected · ",qx(s.reduce((Q,L)=>Q+L.file.size,0))," total"]})]}),o.jsx("div",{className:"v10-form-divider"}),o.jsxs("div",{className:"v10-form-label",style:{marginBottom:8},children:["Ingestion Options ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("label",{className:"v10-import-option",style:{opacity:.5,pointerEvents:"none"},children:[o.jsx("input",{type:"checkbox",checked:f,disabled:!0,readOnly:!0}),"Store original files as Knowledge Assets"]}),o.jsxs("label",{className:"v10-import-option",style:{opacity:.5,pointerEvents:"none"},children:[o.jsx("input",{type:"checkbox",checked:u,disabled:!0,readOnly:!0}),"Let agent extract structured knowledge from content"]})]}),g==="uploading"&&o.jsxs("div",{className:"v10-import-progress",children:[o.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)",fontWeight:500},children:["Importing files… (",y+1," of ",s.length,")"]}),o.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:4},children:((X=s[y])==null?void 0:X.file.name)??"…"}),o.jsx("div",{className:"v10-import-progress-bar",children:o.jsx("div",{className:"v10-import-progress-fill",style:{width:`${(y+.5)/s.length*100}%`}})}),o.jsxs("div",{className:"v10-import-progress-text",children:[y," of ",s.length," files processed"]})]}),(g==="done"||g==="error")&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`v10-import-result ${V>0?"error":"success"}`,"data-testid":"import-result","data-import-status":V>0?"error":"success","data-import-triples":I,children:V===0?o.jsxs(o.Fragment,{children:[D>0&&o.jsxs(o.Fragment,{children:["Successfully imported ",D," file",D!==1?"s":"",".",I>0&&o.jsxs(o.Fragment,{children:[" Extracted ",o.jsx("strong",{children:I.toLocaleString()})," triples into working memory."]})]}),F>0&&o.jsxs(o.Fragment,{children:[D>0?" ":"","Stored ",F," file",F!==1?"s":""," as source — no structured knowledge was extracted yet (extraction for these file types is coming soon)."]})]}):o.jsxs(o.Fragment,{children:[D," file",D!==1?"s":""," imported",F>0&&o.jsxs(o.Fragment,{children:[", ",F," stored without extraction"]}),", ",V," failed.",I>0&&o.jsxs(o.Fragment,{children:[" ",I.toLocaleString()," triples extracted."]})]})}),k.length>0&&o.jsx("div",{className:"v10-import-file-list",style:{marginTop:12},children:k.map((Q,L)=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:Q.status==="success"?"✓":Q.status==="skipped"?"–":"✗"}),o.jsx("span",{className:"v10-import-file-name",children:Q.fileName}),o.jsx("span",{className:"v10-import-file-size",style:Q.status==="error"?{color:"var(--text-danger)"}:void 0,children:Q.status==="success"&&Q.triplesWritten!=null?`${Q.triplesWritten} triples`:Q.status==="skipped"?"stored (no extraction)":Q.error??"failed"})]},L))})]})]}),o.jsxs("div",{className:"v10-modal-footer",children:[g==="idle"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"v10-modal-btn",onClick:P,children:"Cancel"}),o.jsxs("button",{className:"v10-modal-btn primary",onClick:_,disabled:s.length===0,children:["Start Import (",s.length," file",s.length!==1?"s":"",")"]})]}),g==="uploading"&&o.jsx("button",{className:"v10-modal-btn",disabled:!0,children:"Importing…"}),(g==="done"||g==="error")&&o.jsx("button",{className:"v10-modal-btn primary",onClick:P,children:"Done"})]})]})})}function yL(e){return e.length<=12?e:`${e.slice(0,6)}…${e.slice(-4)}`}function bL({open:e,onClose:t,contextGraphId:n,contextGraphName:r}){const[s,c]=w.useState(null),[u,d]=w.useState(null),[f,h]=w.useState([]),[g,m]=w.useState(null),[y,x]=w.useState([]),[k,j]=w.useState([]),[E,S]=w.useState(null),[T,N]=w.useState("allowlist");w.useEffect(()=>{e&&(fetch("/api/status",{headers:qt()}).then(P=>P.json()).then(P=>{typeof(P==null?void 0:P.peerId)=="string"&&P.peerId.length>0&&d(P.peerId)}).catch(()=>{}),Wk(n).then(P=>h(P.allowedAgents)).catch(()=>h([])),Qm().then(P=>{const B=(P.agents??[]).filter(W=>W.connectionStatus!=="self");x(B)}).catch(()=>x([])),Zk(n).then(P=>j(P.requests)).catch(()=>j([])))},[e,n]);const{dialogRef:A,onBackdropClick:q}=Zi(e,t);if(!e)return null;const R=u?`${n}
1128
- ${u}`:null,$=(P,B)=>{navigator.clipboard.writeText(P).then(()=>{c(B),setTimeout(()=>c(null),2e3)}).catch(()=>{})},H=async P=>{try{await h2(n,P),h(B=>B.filter(W=>W!==P))}catch{}},z=async P=>{S(P);try{await Xm(n,P),j(B=>B.filter(W=>W.agentAddress!==P)),h(B=>[...new Set([...B,P])])}catch(B){m((B==null?void 0:B.message)||"Failed to approve")}finally{S(null)}},_=async P=>{S(P);try{await Jm(n,P),j(B=>B.filter(W=>W.agentAddress!==P))}catch(B){m((B==null?void 0:B.message)||"Failed to reject")}finally{S(null)}};return o.jsx("div",{className:"v10-modal-overlay",onClick:q,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:A,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-share-modal-title",children:[o.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{id:"dkg-share-modal-title",className:"v10-modal-title",children:"Share Context Graph"}),o.jsxs("div",{className:"v10-modal-subtitle",children:["Invite agents to collaborate on ",o.jsx("strong",{children:r}),"."]})]}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close share dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:"pointer"},children:"×"})]}),o.jsxs("div",{className:"v10-modal-body",children:[o.jsxs("div",{style:{display:"flex",gap:0,marginBottom:16,borderBottom:"1px solid var(--border-default)"},children:[o.jsx("button",{onClick:()=>N("allowlist"),style:{padding:"8px 16px",fontSize:12,fontWeight:T==="allowlist"?600:400,background:"none",border:"none",cursor:"pointer",color:T==="allowlist"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:T==="allowlist"?"2px solid var(--accent-primary)":"2px solid transparent"},children:"Allowlist"}),o.jsxs("button",{onClick:()=>N("requests"),style:{padding:"8px 16px",fontSize:12,fontWeight:T==="requests"?600:400,background:"none",border:"none",cursor:"pointer",color:T==="requests"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:T==="requests"?"2px solid var(--accent-primary)":"2px solid transparent",position:"relative"},children:["Join Requests",k.length>0&&o.jsx("span",{style:{position:"absolute",top:4,right:4,background:"var(--accent-red, #ef4444)",color:"var(--text-on-accent)",borderRadius:999,fontSize:9,fontWeight:700,padding:"1px 5px",minWidth:16,textAlign:"center"},children:k.length})]})]}),T==="allowlist"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Allowed Agents"}),o.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:8},children:["Only agents on this list can read and write to the context graph. To add someone, share the Invite Code below — they'll send a signed join request you can approve in the ",o.jsx("strong",{children:"Join Requests"})," tab."]}),f.length>0&&o.jsx("div",{style:{marginBottom:8,display:"flex",flexDirection:"column",gap:4},children:f.map(P=>{const B=y.find(W=>{var I;return((I=W.agentAddress)==null?void 0:I.toLowerCase())===P.toLowerCase()});return o.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",borderRadius:6,fontSize:11,fontFamily:"var(--font-mono)",background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[o.jsx("span",{style:{color:"var(--text-primary)"},children:B?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{fontFamily:"var(--font-body)",fontWeight:500},children:B.name})," ",o.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:yL(P)})]}):P}),o.jsx("button",{onClick:()=>H(P),style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",fontSize:12,padding:"0 4px"},title:"Remove agent",children:"×"})]},P)})}),f.length===0&&o.jsx("div",{style:{padding:"8px 12px",borderRadius:6,fontSize:11,color:"var(--text-tertiary)",background:"var(--bg-surface)",border:"1px dashed var(--border-default)",marginBottom:8},children:"No agents on allowlist — context graph is open to anyone who subscribes."})]}),o.jsx("div",{className:"v10-form-divider"}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Invite Code"}),R===null?o.jsx("div",{style:{padding:"8px 12px",borderRadius:6,fontSize:11,color:"var(--text-tertiary)",background:"var(--bg-surface)",border:"1px dashed var(--border-default)"},children:"Loading peer ID…"}):o.jsxs("div",{style:{position:"relative"},children:[o.jsx("pre",{style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:6,padding:"10px 12px",fontSize:11,lineHeight:1.6,fontFamily:"var(--font-mono)",color:"var(--text-primary)",overflow:"auto",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-all"},children:R}),o.jsx("button",{className:"v10-modal-btn primary",onClick:()=>$(R,"invite"),style:{position:"absolute",top:6,right:6,fontSize:10,padding:"4px 10px",height:26,cursor:"pointer"},children:s==="invite"?"Copied":"Copy Invite"})]})]})]}),T==="requests"&&o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Pending Join Requests"}),o.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:8},children:"Agents who submitted a signed request to join this context graph. Approve to add them to the allowlist."}),k.length===0&&o.jsx("div",{style:{padding:"16px 12px",borderRadius:6,fontSize:11,textAlign:"center",color:"var(--text-tertiary)",background:"var(--bg-surface)",border:"1px dashed var(--border-default)"},children:"No pending join requests."}),k.map(P=>o.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 10px",borderRadius:6,fontSize:11,background:"var(--bg-surface)",border:"1px solid var(--border-default)",marginBottom:4},children:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[P.name&&o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:500},children:P.name}),o.jsx("span",{style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",fontSize:10},children:P.agentAddress}),o.jsxs("span",{style:{fontSize:9,color:"var(--text-tertiary)"},children:["Requested ",new Date(P.timestamp).toLocaleString()]})]}),o.jsxs("div",{style:{display:"flex",gap:6},children:[o.jsx("button",{onClick:()=>z(P.agentAddress),disabled:E===P.agentAddress,style:{background:"rgba(34, 197, 94, 0.15)",color:"var(--text-success)",border:"1px solid rgba(34, 197, 94, 0.3)",cursor:"pointer",borderRadius:4,fontSize:10,padding:"4px 10px",fontWeight:600},children:E===P.agentAddress?"…":"Approve"}),o.jsx("button",{onClick:()=>_(P.agentAddress),disabled:E===P.agentAddress,style:{background:"rgba(239, 68, 68, 0.1)",color:"var(--text-danger)",border:"1px solid rgba(239, 68, 68, 0.2)",cursor:"pointer",borderRadius:4,fontSize:10,padding:"4px 10px",fontWeight:600},children:"Reject"})]})]},P.agentAddress)),g&&o.jsx("div",{style:{fontSize:10,color:"var(--text-danger)",marginTop:4},children:g})]})]}),o.jsx("div",{className:"v10-modal-footer",children:o.jsx("button",{className:"v10-modal-btn",onClick:t,children:"Done"})})]})})}async function Ii(e,t){var r;const n=await ia(e,t);return((r=n==null?void 0:n.result)==null?void 0:r.bindings)??[]}const Pi={displayName:"Project",primaryColor:"#a855f7",accentColor:"#22c55e"},xL=e=>({slug:e,displayName:e,icon:"•",color:"#64748b",rank:99}),wL={slug:za,displayName:"Root",description:"Entities not in any subgraph (Context Graph root)",icon:"⊘",rank:99},kL=e=>({typeIri:e,label:e.split(/[/#]/).pop()||e,color:"#64748b"}),es="http://dkg.io/ontology/profile/";function kS(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function rt(e){const t=kS(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
1129
- `).replace(/\\\\/g,"\\"):t}function rm(e){const t=rt(e),n=parseInt(t,10);return Number.isFinite(n)?n:0}function ts(e){return`FILTER(strstarts(str(?g), "${`did:dkg:context-graph:${e}/meta`.replace(/"/g,'\\"')}"))`}function SL(e){return`PREFIX prof: <${es}>
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
- ${ts(e)}
1141
- } LIMIT 1`}function jL(e){return`PREFIX prof: <${es}>
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
- ${ts(e)}
1157
- }`}function CL(e){return`PREFIX prof: <${es}>
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
- ${ts(e)}
1170
- }
1171
- GROUP BY ?chip ?subGraph ?type ?predicate ?label`}function NL(e){return`PREFIX prof: <${es}>
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
- ${ts(e)}
1183
- }`}function EL(e){return`PREFIX prof: <${es}>
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
- ${ts(e)}
1198
- }`}function TL(e,t){const n=new Map;for(const f of e){const h=La(f.catalog);if(!h)continue;const g=h.split(":catalog:").pop()??h;n.set(h,{slug:g,subGraph:rt(f.subGraph),name:rt(f.name)||g,description:rt(f.description)||void 0,rank:rm(f.rank)||99,queries:[]})}const r=t.map(f=>{const h=La(f.q),g=h.split(":query:").pop()??h,m=rt(f.subGraph),y=La(f.catalog),x=y?n.get(y):void 0,k=`default:${m}`;return{slug:g,subGraph:m,catalogSlug:(x==null?void 0:x.slug)??k,catalogName:(x==null?void 0:x.name)??"Queries",catalogDescription:x==null?void 0:x.description,catalogRank:(x==null?void 0:x.rank)??999,name:rt(f.name)||g,description:rt(f.description)||void 0,sparql:rt(f.sparql),resultColumn:rt(f.column)||"",rank:rm(f.rank)||99}}).filter(f=>f.subGraph&&f.sparql).sort((f,h)=>f.subGraph.localeCompare(h.subGraph)||f.catalogRank-h.catalogRank||f.catalogName.localeCompare(h.catalogName)||f.rank-h.rank||f.name.localeCompare(h.name)),s=new Map;for(const f of n.values())s.set(`${f.subGraph}|${f.slug}`,{...f,queries:[]});for(const f of r){const h=`${f.subGraph}|${f.catalogSlug}`,g=s.get(h);if(g){g.queries.push(f);continue}s.set(h,{slug:f.catalogSlug,subGraph:f.subGraph,name:f.catalogName,description:f.catalogDescription,rank:f.catalogRank,queries:[f]})}const c=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 c){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:c,savedQueries:r,catalogsBySubGraph:u,queriesBySubGraph:d}}function AL(e){return`PREFIX prof: <${es}>
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
- ${ts(e)}
1215
- }`}function RL(e){return`PREFIX prof: <${es}>
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
- ${ts(e)}
1230
- }
1231
- GROUP BY ?view ?name ?description ?nodeSize`}function La(e){const t=kS(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function _L(e){const[t,n]=w.useState(!0),[r,s]=w.useState(),[c,u]=w.useState(Pi.displayName),[d,f]=w.useState(),[h,g]=w.useState(Pi.primaryColor),[m,y]=w.useState(Pi.accentColor),[x,k]=w.useState([]),[j,E]=w.useState([]),[S,T]=w.useState([]),[N,A]=w.useState([]),[q,R]=w.useState([]),[$,H]=w.useState([]),z=w.useRef(new Map),_=w.useRef(new Map),P=w.useRef(new Map),B=w.useRef(new Map),W=w.useRef(new Map),I=w.useRef(new Map);w.useEffect(()=>{if(!e){n(!1);return}let U=!1;return(async()=>{n(!0),s(void 0);try{const[G,O,ne,ue,le,be,Re]=await Promise.all([Ii(SL(e),e).catch(()=>[]),Ii(jL(e),e).catch(()=>[]),Ii(AL(e),e).catch(()=>[]),Ii(RL(e),e).catch(()=>[]),Ii(CL(e),e).catch(()=>[]),Ii(NL(e),e).catch(()=>[]),Ii(EL(e),e).catch(()=>[])]);if(U)return;const Ee=e;if(G[0]){const ke=G[0];u(rt(ke.name)||Ee),f(rt(ke.description)||void 0),g(rt(ke.primary)||Pi.primaryColor),y(rt(ke.accent)||Pi.accentColor)}else u(Ee),f(void 0),g(Pi.primaryColor),y(Pi.accentColor);const Ie=O.map(ke=>({slug:rt(ke.slug),displayName:rt(ke.displayName)||rt(ke.slug),description:rt(ke.description)||void 0,icon:rt(ke.icon)||void 0,color:rt(ke.color)||void 0,rank:rm(ke.rank)||99,timelinePredicate:La(ke.timelinePredicate)||void 0,sourceAssertion:rt(ke.sourceAssertion)||void 0})).filter(ke=>ke.slug).sort((ke,ct)=>ke.rank-ct.rank);k(Ie),_.current=new Map(Ie.map(ke=>[ke.slug,ke]));const Ve=ne.map(ke=>({typeIri:La(ke.type),label:rt(ke.label)||void 0,icon:rt(ke.icon)||void 0,color:rt(ke.color)||void 0,detailHint:rt(ke.detailHint)||void 0,promoteLabel:rt(ke.promoteLabel)||void 0,promoteHint:rt(ke.promoteHint)||void 0,publishLabel:rt(ke.publishLabel)||void 0,publishHint:rt(ke.publishHint)||void 0})).filter(ke=>ke.typeIri);E(Ve),z.current=new Map(Ve.map(ke=>[ke.typeIri,ke]));const Se=ue.map(ke=>{const ct=La(ke.view),xe=ct.split(":view:").pop()??ct;return{slug:xe,name:rt(ke.name)||xe,description:rt(ke.description)||void 0,nodeSize:rt(ke.nodeSize)||void 0,includeTypes:rt(ke.includeTypes).split("|").map(Oe=>La(Oe.trim())).filter(Boolean),emphasizePredicates:rt(ke.emphasizePredicates).split("|").map(Oe=>La(Oe.trim())).filter(Boolean)}});T(Se),P.current=new Map(Se.map(ke=>[ke.slug,ke]));const ht=le.map(ke=>{const ct=La(ke.chip),xe=ct.split(":chip:").pop()??ct,Oe=rt(ke.values).split("|").map(_t=>rt(_t.trim())).filter(Boolean);return{slug:xe,subGraph:rt(ke.subGraph),typeIri:La(ke.type),predicate:La(ke.predicate),label:rt(ke.label)||"Filter",values:Oe}}).filter(ke=>ke.subGraph&&ke.predicate&&ke.values.length>0);A(ht);const Me=new Map;for(const ke of ht){const ct=Me.get(ke.subGraph)??[];ct.push(ke),Me.set(ke.subGraph,ct)}B.current=Me;const qe=TL(be,Re);R(qe.queryCatalogs),H(qe.savedQueries),W.current=qe.catalogsBySubGraph,I.current=qe.queriesBySubGraph}catch(G){U||s((G==null?void 0:G.message)??String(G))}finally{U||n(!1)}})(),()=>{U=!0}},[e]);const D=w.useCallback(U=>U===za?wL:_.current.get(U)??xL(U),[]),F=w.useCallback(U=>z.current.get(U)??kL(U),[]),V=w.useCallback(U=>P.current.get(U),[]),X=w.useCallback(U=>B.current.get(U)??[],[]),Q=w.useCallback(U=>W.current.get(U)??[],[]),L=w.useCallback(U=>I.current.get(U)??[],[]);return{contextGraphId:e??"",displayName:c,description:d,primaryColor:h,accentColor:m,subGraphs:x,typeBindings:j,views:S,filterChips:N,queryCatalogs:q,savedQueries:$,loading:t,error:r,forSubGraph:D,forType:F,view:V,chipsFor:X,savedQueryCatalogsFor:Q,savedQueriesFor:L}}const SS=Ze.createContext(null);function Ir(){return w.useContext(SS)}const OL="http://dkg.io/ontology/agent/";function LL(e){return`FILTER(strstarts(str(?g), "${`did:dkg:context-graph:${e}/meta`.replace(/"/g,'\\"')}"))`}function zL(e){return`PREFIX ag: <${OL}>
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
- ${LL(e)}
1250
- }`}function jS(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 Ka(e){const t=jS(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
1251
- `).replace(/\\\\/g,"\\"):t}function Gx(e){const t=jS(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function ML(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 DL(e){const t=new Map;for(const n of e){const r=Gx(n.a);if(!r)continue;const s=t.get(r),c=Ka(n.kindAi)==="ai"||Ka(n.kind)==="ai"?"ai":Ka(n.kind)==="human"?"human":(s==null?void 0:s.kind)??"ai",u={uri:r,name:Ka(n.name)||Ka(n.label)||r.split(":").pop()||r,kind:c,framework:Ka(n.fw)||(s==null?void 0:s.framework),operatorUri:Gx(n.op)||(s==null?void 0:s.operatorUri),walletAddress:Ka(n.wallet)||(s==null?void 0:s.walletAddress),peerId:Ka(n.peerId)||(s==null?void 0:s.peerId),avatar:Ka(n.avatar)||(s==null?void 0:s.avatar),reputation:Ka(n.reputation)||(s==null?void 0:s.reputation),color:ML(r)};u.kind==="human"&&!u.framework&&(u.framework="human"),t.set(r,u)}for(const n of t.values())if(n.operatorUri){const r=t.get(n.operatorUri);r&&(n.operatorName=r.name)}return t}function $L(e){const[t,n]=w.useState(()=>new Map),[r,s]=w.useState(!0),[c,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 x=await ia(zL(e),e);if(m)return;const k=((y=x==null?void 0:x.result)==null?void 0:y.bindings)??[],j=DL(k);n(j),d.current=j}catch(x){m||u((x==null?void 0:x.message)??String(x))}finally{m||s(!1)}})(),()=>{m=!0}},[e]);const f=w.useCallback(m=>d.current.get(m),[]),h=Ze.useMemo(()=>[...t.values()].sort((m,y)=>m.name.localeCompare(y.name)),[t]),g=w.useCallback(m=>{},[]);return{agents:t,list:h,loading:r,error:c,get:f,openAgent:g}}const CS=Ze.createContext(null);function ns(){return w.useContext(CS)}const im=["#6366f1","#14b8a6","#f43f5e","#facc15","#8b5cf6","#10b981","#0ea5e9","#d946ef"],Vx=1e4;function ul(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 IL(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 PL(e){return e.startsWith("did:")||e.startsWith("12D3")?e:/^0x[0-9a-fA-F]{40}$/.test(e)?`did:dkg:agent:${e}`:e}function UL(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),s=r.indexOf("/");if(s<0)return;const c=r.slice(0,s);if(!(!c||c.startsWith("_")))return c}function BL(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 Wx(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)%im.length}function NS(e){const[t,n]=w.useState(new Map),[r,s]=w.useState([]),[c,u]=w.useState([]),[d,f]=w.useState(null),[h,g]=w.useState(!1),[m,y]=w.useState(void 0),x=w.useRef(0);w.useEffect(()=>{if(!e){x.current+=1,n(new Map),s([]),u([]),g(!1),y(void 0);return}const S=++x.current,T=new AbortController;let N=!1,A;const q=()=>!N&&S===x.current;return g(!0),f(null),(async()=>{var R;try{const $=new Promise((F,V)=>{A=setTimeout(()=>{T.abort(),V(new Error(`SWM attribution query timed out after ${Math.round(Vx/1e3)}s`))},Vx)}),H=(async()=>{const F=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...qt()},signal:T.signal,body:JSON.stringify({sparql:BL(e)})});if(!F.ok)throw new Error(`SPARQL query failed: ${F.status}`);return F.json()})(),z=await Promise.race([H,$]),P=(((R=z==null?void 0:z.result)==null?void 0:R.bindings)??[]).slice().reverse(),B=new Map,W=new Map,I=[];for(const F of P){const V=ul(F.op),X=ul(F.root),Q=ul(F.agent),L=ul(F.publishedAt),U=ul(F.g);if(!V||!X||!Q||!L)continue;const G=PL(Q),O=U?UL(U,e):void 0;I.push({opUri:V,rootUri:X,agent:G,publishedAt:L,subGraph:O});const ne={agent:G,opUri:V,publishedAt:L,subGraph:O},ue=B.get(X);ue?ue.some(be=>be.agent===G)||ue.push(ne):B.set(X,[ne]);let le=W.get(G);le||(le=new Set,W.set(G,le)),le.add(X)}const D=[...W.entries()].map(([F,V])=>({agent:F,color:im[Wx(F)],label:IL(F),entityCount:V.size})).sort((F,V)=>V.entityCount-F.entityCount);if(!q())return;n(B),s(I),u(D),y(e)}catch($){if(!q())return;f(($==null?void 0:$.message)??"Failed to load SWM attributions"),n(new Map),s([]),u([]),y(e)}finally{A&&clearTimeout(A),q()&&g(!1)}})(),()=>{N=!0,A&&clearTimeout(A),T.abort()}},[e]);const{nodeColors:k,conflicts:j}=w.useMemo(()=>{const S={},T=[];for(const[N,A]of t)A.length!==0&&(A.length===1?S[N]=im[Wx(A[0].agent)]:(T.push(N),S[N]="#f59e0b"));return{nodeColors:S,conflicts:T}},[t]);return{resultContextGraphId:m,attributions:t,events:r,palette:c,nodeColors:k,conflicts:j,loading:!!(e&&(h||m!==e)),error:d}}function FL(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 Zx=1e4,sm="http://dkg.io/ontology/";function HL(e){const t=`did:dkg:context-graph:${e}/_meta`;return`PREFIX dkg: <${sm}>
1265
- PREFIX prov: <http://www.w3.org/ns/prov#>
1266
- SELECT ?event ?type ?assertion ?name ?agent ?ts ?subGraphName ?assertionGraph (COUNT(DISTINCT ?root) AS ?entityCount) (COUNT(DISTINCT ?subjRoot) AS ?subjectEntityCount) WHERE {
1267
- GRAPH <${t}> {
1268
- ?event a ?type ;
1269
- prov:startedAtTime ?ts .
1270
- FILTER(?type IN (dkg:AssertionCreated, dkg:AssertionPromoted))
1271
- OPTIONAL { ?event prov:wasAssociatedWith ?agentAssoc }
1272
- OPTIONAL { ?event prov:generated ?gen }
1273
- OPTIONAL { ?event prov:used ?used }
1274
- BIND(COALESCE(?gen, ?used) AS ?assertion)
1275
- ?assertion dkg:assertionName ?name .
1276
- OPTIONAL { ?assertion prov:wasAttributedTo ?agentAttr }
1277
- BIND(COALESCE(?agentAssoc, ?agentAttr) AS ?agent)
1278
- OPTIONAL { ?assertion dkg:subGraphName ?subGraphName }
1279
- OPTIONAL { ?assertion dkg:assertionGraph ?assertionGraph }
1280
- OPTIONAL { ?event dkg:rootEntity ?root }
1281
- OPTIONAL { ?assertion dkg:rootEntity ?subjRoot }
1282
- }
1283
- } GROUP BY ?event ?type ?assertion ?name ?agent ?ts ?subGraphName ?assertionGraph
1284
- ORDER BY DESC(?ts) LIMIT 5000`}function Xa(e){if(e!=null)return typeof e=="string"?e.startsWith('"')?e.replace(/^"/,"").replace(/"(\^\^<[^>]*>)?$/,""):e:typeof e=="object"&&e!==null&&"value"in e?String(e.value):String(e)}function qL(e){return e===`${sm}AssertionCreated`?"created":e===`${sm}AssertionPromoted`?"promoted":null}function GL(e){const[t,n]=w.useState([]),[r,s]=w.useState(!!e),[c,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 x;return h.current=e,s(!0),u(null),(async()=>{var k;try{const j=new Promise((A,q)=>{x=setTimeout(()=>{y.abort(),q(new Error(`Assertion-lifecycle query timed out after ${Math.round(Zx/1e3)}s`))},Zx)}),E=(async()=>{const A=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...qt()},signal:y.signal,body:JSON.stringify({sparql:HL(e),contextGraphId:e})});if(!A.ok)throw new Error(`SPARQL query failed: ${A.status}`);return A.json()})(),S=await Promise.race([E,j]);if(m||h.current!==e)return;const T=((k=S==null?void 0:S.result)==null?void 0:k.bindings)??[],N=[];for(const A of T){const q=Xa(A.event),R=Xa(A.type),$=Xa(A.assertion),H=Xa(A.name),z=Xa(A.agent),_=Xa(A.ts);if(!q||!$||!z||!_)continue;const P=qL(R);if(!P)continue;let B;if(P==="promoted"){const D=Xa(A.entityCount),F=D!=null?Number(D):NaN;if(Number.isFinite(F)&&F>0)B=F;else{const V=Xa(A.subjectEntityCount),X=V!=null?Number(V):NaN;Number.isFinite(X)&&X>=0&&(B=X)}}let I=Xa(A.subGraphName);if(I===void 0){const D=Xa(A.assertionGraph);D&&(I=FL(D,e))}N.push({eventUri:q,kind:P,assertionUri:$,assertionName:H??"",agentUri:z,publishedAt:_,subGraph:I,entityCount:B})}n(N),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{x&&clearTimeout(x),m||s(!1)}})(),()=>{m=!0,y.abort(),x&&clearTimeout(x)}},[e]),w.useMemo(()=>({resultContextGraphId:d,events:t,loading:r,error:c}),[d,t,r,c])}const VL=["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"],WL="http://www.w3.org/ns/prov#wasAttributedTo",ZL=new Set(["http://dkg.io/ontology/decisions/Decision","http://dkg.io/ontology/tasks/Task","http://dkg.io/ontology/github/PullRequest","http://dkg.io/ontology/github/Issue","http://dkg.io/ontology/github/Commit"]);function xg(e){const t=e.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),n=new Date(t);return Number.isFinite(n.getTime())?n:null}function wg(e,t,n,r){const s=n?n.toISOString():"no-ts";return r&&r!==t?`${e}|${t}|${r}|${s}`:`${e}|${t}|${s}`}function YL(e){for(const t of VL){const n=e.properties.get(t);if(n!=null&&n.length)for(const r of n){const s=xg(r);if(s)return s}}return null}function QL(e){for(const t of e.connections)if(t.predicate===WL)return t.targetUri;return null}function KL(e){for(const t of e.types)if(ZL.has(t))return t;return null}function XL(e){for(const t of e.subGraphs)if(t!=="meta")return t;return null}function JL(e,t={}){const{limit:n=200,agentUri:r,typeIri:s,subGraph:c,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=KL(m);if(s&&y!==s)continue;const x=YL(m);if(!x&&(!u||!y))continue;const k=QL(m);if(r&&k!==r)continue;const j=XL(m);if(c&&j!==c)continue;const E=y?"typed":"added";if(h&&h.has(E))continue;const S=wg(E,m.uri,x);g.push({id:S,entity:m,at:x,authorUri:k,kindUri:y,subGraph:j,layer:m.trustLevel,event:E,clickable:!0})}return g.sort((m,y)=>m.at&&y.at?y.at.getTime()-m.at.getTime():m.at&&!y.at?-1:!m.at&&y.at?1:m.entity.label.localeCompare(y.entity.label)),{items:g.slice(0,n),hasMore:g.length>n}},[e,n,r,s,c,u,f])}function e4(e,t=new Date){const n=g=>{const m=new Date(g);return m.setHours(0,0,0,0),m},r=n(t),s=new Date(r.getTime()-1440*60*1e3),c=new Date(r.getTime()-10080*60*1e3),u={},d=[],f=(g,m,y)=>{u[g]||(u[g]={key:g,label:m,items:[]},d.push(g)),u[g].items.push(y)};for(const g of e){if(!g.at){f("undated","Undated",g);continue}const m=n(g.at);if(m.getTime()===r.getTime())f("today","Today",g);else if(m.getTime()===s.getTime())f("yesterday","Yesterday",g);else if(g.at.getTime()>=c.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 t4(e,t){const{entitiesByUri:n,agentUri:r,subGraph:s,limit:c=200}=t,u=[];for(const d of e){if(r&&d.agent!==r||s&&d.subGraph!==s)continue;const f=xg(d.publishedAt);if(!f)continue;const h=bt(d.rootUri),g=n.get(h),m=g!=null;u.push({id:wg("promoted",d.opUri,f,h),entity:g??n4(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,c)}function n4(e){return{uri:e,label:hg(e),types:[],trustLevel:"shared",layers:new Set(["shared"]),subGraphs:new Set,properties:new Map,connections:[]}}function a4(e,t={}){const{agentUri:n,subGraph:r,limit:s=200}=t,c=[];for(const u of e){if(n&&u.agentUri!==n||r&&u.subGraph!==r)continue;const d=xg(u.publishedAt);if(!d)continue;const f=u.kind==="promoted"?"promoted":"added",h=u.kind==="promoted"?"shared":"working",g=bt(u.assertionUri);c.push({id:wg(f,u.eventUri,d,g),entity:{uri:g,label:u.assertionName||hg(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 c.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)),c.slice(0,s)}function r4(e,t={}){const{swmEvents:n,lifecycleEvents:r,...s}=t,c=r!=null,d=JL(e,{...s,excludeEvents:c?["added"]:void 0});return w.useMemo(()=>{const f=s.limit??200;if(t.typeIri)return{items:d.items,hasMore:d.hasMore};if(!c&&(!n||n.length===0))return{items:d.items,hasMore:d.hasMore};let h;if(c)h=a4(r,{agentUri:s.agentUri,subGraph:s.subGraph,limit:Number.POSITIVE_INFINITY});else{const y=new Map;for(const x of e)y.set(x.uri,x);h=t4(n,{entitiesByUri:y,agentUri:s.agentUri,subGraph:s.subGraph,limit:Number.POSITIVE_INFINITY})}const g=[...d.items,...h];g.sort((y,x)=>y.at&&x.at?x.at.getTime()-y.at.getTime():y.at&&!x.at?-1:!y.at&&x.at?1:y.entity.label.localeCompare(x.entity.label));const m=d.hasMore||g.length>f;return{items:g.slice(0,f),hasMore:m}},[d,n,r,c,e,s.agentUri,s.subGraph,s.limit,t.typeIri])}function ES(e,t=new Date){if(!e)return"—";const n=t.getTime()-e.getTime(),r=Math.abs(n),s=n<0,c=6e4,u=c*60,d=u*24;return r<c?s?"in a moment":"just now":r<u?s?`in ${Math.floor(r/c)}m`:`${Math.floor(r/c)}m ago`:r<d?s?`in ${Math.floor(r/u)}h`:`${Math.floor(r/u)}h ago`:r<7*d?s?`in ${Math.floor(r/d)}d`:`${Math.floor(r/d)}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}const Yx={"claude-code":"⦿",openclaw:"◈",hermes:"⬡",gemini:"✧",human:"👤"};function i4(e,t){return e&&Yx[e]?Yx[e]:t==="human"?"👤":"◉"}function s4(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 o4(e){const t=e.trim();return t.length<=11?t:`${t.slice(0,6)}…${t.slice(-4)}`}const Yi=({agent:e,fallbackUri:t,size:n="sm",showOperator:r=!1,onOpenAgent:s,className:c=""})=>{const u=ns();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?o4(t.split(":").pop()??t):"unknown"),g=(e==null?void 0:e.kind)??"ai",m=e==null?void 0:e.framework,y=i4(m,g),x=(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,E=!!j;return o.jsxs("span",{className:`v10-agent-chip v10-agent-chip-${n}${E?" interactive":""} ${c}`,style:{"--agent-color":x},onClick:j?S=>{S.stopPropagation(),j()}:void 0,title:k,role:E?"button":void 0,tabIndex:E?0:void 0,children:[o.jsxs("span",{className:"v10-agent-chip-avatar",style:{background:x},children:[o.jsx("span",{className:"v10-agent-chip-initials",children:s4(h)}),o.jsx("span",{className:"v10-agent-chip-glyph",title:m??g,children:y})]}),o.jsxs("span",{className:"v10-agent-chip-body",children:[o.jsx("span",{className:"v10-agent-chip-name",children:h}),n==="lg"&&((e==null?void 0:e.operatorName)||m)&&o.jsxs("span",{className:"v10-agent-chip-sub",children:[m&&g==="ai"&&o.jsx("span",{className:"v10-agent-chip-fw",children:m}),(e==null?void 0:e.operatorName)&&g==="ai"&&o.jsxs(o.Fragment,{children:[m&&o.jsx("span",{className:"v10-agent-chip-sep",children:"·"}),o.jsxs("span",{className:"v10-agent-chip-op",children:["driven by ",e.operatorName]})]}),g==="human"&&o.jsx("span",{className:"v10-agent-chip-fw",children:"human"})]}),n==="md"&&r&&(e==null?void 0:e.operatorName)&&g==="ai"&&o.jsx("span",{className:"v10-agent-chip-sub",children:o.jsxs("span",{className:"v10-agent-chip-op",children:["· ",e.operatorName]})})]})]})},uh={working:"#64748b",shared:"#f59e0b",verified:"#22c55e"},l4={working:"◇",shared:"◈",verified:"◉"},c4=200,u4=({entities:e,agentUri:t,typeIri:n,subGraph:r,limit:s,includeUndated:c=!0,swmEvents:u,lifecycleEvents:d,lifecycleError:f,title:h,onSelectEntity:g,onOpenAgent:m,emptyHint:y,className:x=""})=>{const{items:k,hasMore:j}=r4(e,{agentUri:t,typeIri:n,subGraph:r,limit:s,includeUndated:c,swmEvents:u,lifecycleEvents:d}),E=Ze.useMemo(()=>e4(k),[k]),S=ns(),T=Ir(),A=j?`${s??c4}+`:String(k.length),q=f!=null&&k.length===0,R=h?o.jsxs("div",{className:"v10-activity-feed-title",children:[o.jsx("span",{className:"v10-activity-feed-title-label",children:h}),o.jsx("span",{className:"v10-activity-feed-title-count","data-state":q?"error":void 0,children:q?"—":A})]}):null,$=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 ${x}`,children:[R,$??o.jsx("div",{className:"v10-activity-feed-empty-hint",children:y??"No activity with a timestamp yet."})]}):o.jsxs("div",{className:`v10-activity-feed ${x}`,children:[R,$,E.map(H=>o.jsxs("div",{className:"v10-activity-feed-bucket",children:[o.jsxs("div",{className:"v10-activity-feed-bucket-head",children:[o.jsx("span",{className:"v10-activity-feed-bucket-label",children:H.label}),o.jsx("span",{className:"v10-activity-feed-bucket-count",children:H.items.length})]}),o.jsx("div",{className:"v10-activity-feed-items",children:H.items.map(z=>o.jsx(d4,{item:z,agents:S,profile:T,onSelectEntity:g,onOpenAgent:m},z.id))})]},H.key))]})};function d4({item:e,agents:t,profile:n,onSelectEntity:r,onOpenAgent:s}){const c=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"?uh.shared:e.event==="published"?uh.verified:e.event==="added"?"#64748b":(d==null?void 0:d.color)??"#a855f7",m=uh[e.layer],y=u?p4(e.entity):null,x=(()=>{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:l4[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-${f4(y)}`,children:y}),(c||e.authorUri)&&o.jsx("span",{className:"v10-activity-feed-author",children:o.jsx(Yi,{agent:c??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:ES(e.at)})]});return e.clickable?o.jsx("button",{type:"button",className:"v10-activity-feed-row",onClick:()=>r(e.entity.uri),title:x,children:k}):o.jsx("div",{className:"v10-activity-feed-row v10-activity-feed-row-static",title:x,"aria-disabled":"true",children:k})}function p4(e){var n;const t=["http://dkg.io/ontology/decisions/status","http://dkg.io/ontology/tasks/status","http://dkg.io/ontology/github/state"];for(const r of t){const s=(n=e.properties.get(r))==null?void 0:n[0];if(s)return s}return null}function f4(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 h4={wm:"working",swm:"shared",vm:"verified"};function m4(e){var y,x,k,j;const t=new Map;if(!e)return t;const n="http://dkg.io/ontology/decisions/status",r="http://dkg.io/ontology/tasks/status",s="http://dkg.io/ontology/tasks/priority",c="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 E of e)if(E.types.includes(u))((y=E.properties.get(n))==null?void 0:y[0])==="proposed"&&h++;else if(E.types.includes(d)){const S=(x=E.properties.get(s))==null?void 0:x[0],T=(k=E.properties.get(r))==null?void 0:k[0];S==="p0"&&T!=="done"&&T!=="cancelled"&&g++}else E.types.includes(f)&&((j=E.properties.get(c))==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 dh=({contextGraphId:e,profile:t,selected:n,onSelect:r,entities:s,layer:c,enabledScope:u,allTriplesTotal:d})=>{const[f,h]=Ze.useState([]),[g,m]=Ze.useState(!0),y=Ze.useMemo(()=>m4(s),[s]),x=Ze.useRef(0),k=Ze.useMemo(()=>u&&u.size>0&&u.size<3?new Set(u):u&&u.size>=3?null:c?new Set([h4[c]]):null,[u,c]),j=Ze.useMemo(()=>{if(!s)return null;const I=new Map;for(const D of s)if(!(k&&!k.has(D.trustLevel)))for(const F of D.subGraphs)I.set(F,(I.get(F)??0)+1);return I},[k,s]),E=Ze.useMemo(()=>{if(!s)return null;let I=0;for(const D of s)k&&!k.has(D.trustLevel)||I++;return I},[k,s]),S=Ze.useMemo(()=>{if(!s)return null;let I=0;for(const D of s)k&&!k.has(D.trustLevel)||D.subGraphs.size>0||I++;return I},[k,s]),T=Ze.useCallback(()=>{const I=++x.current;m(!0),sg(e).then(D=>{I===x.current&&h(D.subGraphs??[])}).catch(()=>{}).finally(()=>{I===x.current&&m(!1)})},[e]);Ze.useEffect(()=>(T(),()=>{x.current++}),[T]),po(e,T);const N=Ze.useMemo(()=>f.filter(bg).map(I=>{const D=t.forSubGraph(I.name),F=j!==null?j.get(I.name)??0:I.entityCount;return{slug:I.name,icon:D.icon??"•",color:D.color??"#64748b",displayName:D.displayName??I.name,description:D.description??I.description,rank:D.rank??99,entityCount:F,tripleCount:I.tripleCount,layerScoped:j!==null}}).sort((I,D)=>I.rank-D.rank),[f,t,j]),q=S!==null&&S>0||n===za;if(g&&N.length===0&&!q||N.length===0&&!q)return null;const R=E??N.reduce((I,D)=>I+D.entityCount,0),$=N.reduce((I,D)=>I+D.tripleCount,0),H={working:"Working Memory",shared:"Shared Working Memory",verified:"Verifiable Memory"},z=k?[...k].map(I=>H[I]).join(" + "):null,_=z?` in ${z}`:"",B=`Total distinct entities — includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph · ${R} entities${_}${z?"":` · ${d??$} triples`}`,W=`All — total distinct entities. Includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph. ${R} entities${_}.`;return o.jsxs("div",{className:"v10-subgraph-bar",children:[o.jsx("div",{className:"v10-subgraph-bar-label",children:"Subgraphs"}),o.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===null?" active":""}`,onClick:()=>r(null),title:B,"aria-label":W,children:[o.jsx("span",{className:"v10-subgraph-chip-icon",children:"⊚"}),o.jsx("span",{className:"v10-subgraph-chip-label",children:"All"}),o.jsx("span",{className:"v10-subgraph-chip-count",children:R})]}),N.map(I=>{const D=y.get(I.slug);return o.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===I.slug?" active":""}${D?" has-badge":""}`,onClick:()=>r(I.slug,c),title:`${I.displayName}${I.description?" · "+I.description:""} · ${I.entityCount} entities${_}${z?"":` · ${I.tripleCount} triples`}${D?" · "+D.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}),D&&o.jsxs("span",{className:`v10-subgraph-chip-badge tone-${D.tone}`,children:[o.jsx("span",{className:"v10-subgraph-chip-badge-dot"}),D.label]})]},I.slug)}),q&&(()=>{const I=S??0,D=n===za;return o.jsxs("button",{type:"button",className:`v10-subgraph-chip v10-subgraph-chip-root${D?" active":""}`,"data-active":D,"data-count":I,onClick:()=>r(za,c),title:`Entities not in any subgraph (Context Graph root) · ${I} entities${_}`,"aria-label":"Entities not in any subgraph (Context Graph root)",children:[o.jsx("span",{className:"v10-subgraph-chip-icon",children:"⊘"}),o.jsx("span",{className:"v10-subgraph-chip-label",children:"Root"}),o.jsx("span",{className:"v10-subgraph-chip-count",children:I})]})})()]})},kg="context-graph-primer",TS={id:kg,label:"What is a Context Graph?",closable:!0},AS={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"};function on({icon:e,title:t,description:n,actions:r=[],tone:s="neutral",compact:c=!1,inline:u=!1,className:d=""}){const f={"--v10-empty-accent":AS[s]};return o.jsxs("div",{className:["v10-empty-state",c?"compact":"",u?"inline":"",d].filter(Boolean).join(" "),"data-tone":s,style:f,children:[e&&o.jsx("div",{className:"v10-empty-state-icon","aria-hidden":"true",children:e}),o.jsxs("div",{className:"v10-empty-state-copy",children:[o.jsx("div",{className:"v10-empty-state-title",children:t}),n&&o.jsx("div",{className:"v10-empty-state-desc",children:n}),r.length>0&&o.jsx("div",{className:"v10-empty-state-actions",children:r.map(h=>o.jsx("button",{type:"button",className:`v10-empty-state-action ${h.variant??"secondary"}`,onClick:h.onClick,children:h.label},h.label))})]})]})}function Cd({items:e,layer:t,compact:n=!1,className:r=""}){const s=t?{"--v10-stat-accent":AS[t]}:void 0;return o.jsx("div",{className:["v10-stat-strip",n?"compact":"",r].filter(Boolean).join(" "),"data-layer":t,style:s,children:e.map((c,u)=>o.jsxs("div",{className:"v10-stat-strip-cell","data-stat-id":c.id,title:c.tooltip,children:[o.jsx("span",{className:"v10-stat-strip-label",children:c.label}),o.jsx("span",{className:"v10-stat-strip-value",children:c.value}),c.hint&&o.jsx("span",{className:"v10-stat-strip-hint",children:c.hint})]},c.id??u))})}const Sg=w.lazy(()=>Ba(()=>import("./index-BrxEjqsW.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),g4="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",v4=new Map(fg.map((e,t)=>[e,t]));function om(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 Or(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function y4(e){const t=new Set,n=new Map,r=new Map,s=new Map;for(const d of e){const f=Or(d.subject);t.add(f);const h=v4.get(d.predicate);if(h!==void 0){const m=kd(d.object).trim();if(m){const y=s.get(f);(y===void 0||h<y)&&(r.set(f,m),s.set(f,h))}}if(Or(d.predicate)===g4||!om(d.object))continue;const g=Or(d.object);n.set(f,(n.get(f)??0)+1),n.set(g,(n.get(g)??0)+1)}const c=[...t].filter(d=>(n.get(d)??0)===0).map(d=>({uri:d,label:r.get(d)??gS(void 0,d)})).sort((d,f)=>d.label.localeCompare(f.label));if(c.length===0)return{canvasTriples:e,singletonItems:c};const u=new Set(c.map(d=>d.uri));return{canvasTriples:e.filter(d=>!u.has(Or(d.subject))&&!u.has(Or(d.object))),singletonItems:c}}function b4(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 x4({items:e,onSelect:t}){return e.length===0?null:o.jsxs("div",{className:"v10-graph-singleton-shelf","aria-label":"Standalone entities without visible links",children:[o.jsxs("div",{className:"v10-graph-singleton-head",title:"Entities with no visible links are grouped here to keep the graph readable.",children:[o.jsx("span",{children:"Standalone entities"}),o.jsx("span",{children:e.length})]}),o.jsx("div",{className:"v10-graph-singleton-list",children:e.map(({uri:n,label:r})=>o.jsx("button",{type:"button",className:"v10-graph-singleton-item",title:n,onClick:()=>t==null?void 0:t(n),children:r},n))})]})}const w4=2500;function Qx(e,t=w4){if(e.length<=t)return e;const n=new Map;for(const u of e)n.set(u.subject,(n.get(u.subject)??0)+1);const r=[...n.entries()].sort((u,d)=>d[1]-u[1]).map(([u])=>u),s=new Set;let c=0;for(const u of r){const d=n.get(u)??0;c+d>t||(s.add(u),c+=d)}return s.size===0&&r.length>0&&s.add(r[0]),e.filter(u=>s.has(u.subject)).slice(0,t)}function Du({title:e,scopeLabel:t,tone:n,className:r,rail:s,overlay:c,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:"⤢"}),x=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)}),c&&o.jsx("div",{className:"v10-graph-overlay",children:c}),o.jsx(x4,{items:d,onSelect:f})]}),s&&o.jsx("aside",{className:"v10-graph-rail",children:s})]})]});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`v10-graph-shell v10-graph-shell-${n}${r?` ${r}`:""}`,children:!g&&x(!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:x(!0)})]})})]})}function RS({layer:e,triples:t,onNodeClick:n,contextGraphId:r,scopeLabel:s,trustLegendActiveLayer:c,title:u,scopeEntities:d,swmAttribution:f,layerEntities:h,nodeColorsOverride:g}){const{title:m}=Mn[e],y=u??m,x=qn(L=>L.theme),k=w.useMemo(()=>{if(e!=="vm")return;const L=new Set;for(const U of t)L.add(U.subject),om(U.object)&&L.add(U.object);return L},[t,e]),{anchors:j,decorationTriples:E}=BO(e==="vm"&&r?r:void 0,k),S=NS(e==="swm"&&r&&!f?r:void 0),T=f??S,N=w.useMemo(()=>{if(!h||h.length===0)return t;const L=new Set;for(const U of h)L.add(bt(U.uri));return Ku(t,L)},[t,h]),A=w.useMemo(()=>{const L=new Set,U=[],G=O=>{const ne=`${O.subject}|${O.predicate}|${O.object}`;L.has(ne)||(L.add(ne),U.push({subject:O.subject,predicate:O.predicate,object:O.object}))};for(const O of N)G(O);for(const O of E)G(O);return U},[N,E]),q=A,R=w.useMemo(()=>{const L=e==="swm"?T.nodeColors:void 0;if(!(!L&&!g))return L?g?{...L,...g}:L:g},[e,T.nodeColors,g]),$=w.useMemo(()=>XO(e,R),[e,R]),{canvasTriples:H,singletonItems:z}=w.useMemo(()=>y4(q),[q]),_=w.useMemo(()=>{if(!d||d.length===0)return z;const L=new Set(z.map(G=>Or(G.uri)));for(const G of H)L.add(Or(G.subject)),om(G.object)&&L.add(Or(G.object));const U=[];for(const G of d){const O=Or(G.uri);L.has(O)||(L.add(O),U.push({uri:O,label:G.label||gS(void 0,O)}))}return U.length===0?z:[...z,...U].sort((G,O)=>G.label.localeCompare(O.label))},[z,H,d]),P=`${r??"context"}:${e}`,B=e==="swm"&&!!r&&T.loading,W=`${y} graph`,I=s??b4(e),D=c===null&&!!s,F=c===null?void 0:c??e,X=e==="vm"&&j.length>0||e==="swm"&&T.palette.length>0?o.jsxs(o.Fragment,{children:[e==="vm"&&j.length>0&&o.jsx(S4,{anchors:j}),e==="swm"&&T.palette.length>0&&o.jsx(k4,{palette:T.palette,conflicts:T.conflicts.length})]}):null,Q=w.useMemo(()=>({name:`${P}:${x}`,palette:x}),[P,x]);return A.length===0&&_.length===0?o.jsx(Du,{title:W,scopeLabel:I,tone:e,className:"v10-graph-view-fill",showScopeLabel:D,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(on,{compact:!0,tone:e,icon:Mn[e].icon,title:`No triples in ${y}`,description:"The graph will appear when this layer has connected triples."})})}):B?o.jsx(Du,{title:W,scopeLabel:I,tone:"swm",className:"v10-graph-view-fill",showScopeLabel:D,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(on,{compact:!0,tone:"swm",icon:Mn.swm.icon,title:"Loading Shared Working Memory attribution...",description:"Agent colors are being prepared before the graph renders."})})}):o.jsx(Du,{title:W,scopeLabel:I,tone:e,className:"v10-graph-view-fill",overlay:X,showScopeLabel:D,singletonItems:_,onSingletonClick:L=>n==null?void 0:n(F?{id:L,trustLayer:F}:{id:L}),renderGraph:L=>H.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(Sg,{data:H,format:"triples",options:$,viewConfig:Q,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:F?U=>n==null?void 0:n({...U,trustLayer:F}):n,initialFit:!0},`${P}:${L?"expanded":"inline"}:${H.length}`)}):o.jsx("div",{className:"v10-graph-placeholder v10-graph-placeholder-centered",children:"Connected graph appears when this layer has linked entities."})})}function k4({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 S4({anchors:e}){var s;const t=w.useMemo(()=>{const c=new Set;for(const u of e)for(const d of u.agents)c.add(d);return c.size},[e]),n=(s=e[0])==null?void 0:s.publishedAt,r=(()=>{if(!n)return null;try{return new Date(n).toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return null}})();return o.jsxs("div",{className:"v10-vm-legend","aria-label":"Verifiable Memory legend",children:[o.jsxs("div",{className:"v10-vm-legend-row v10-vm-legend-head",children:[o.jsx("span",{children:"VM provenance layer"}),o.jsxs("span",{className:"v10-vm-legend-count",children:[e.length," anchor",e.length===1?"":"s"]})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#f5a524"},children:"◉"}),o.jsx("span",{className:"v10-vm-legend-label",children:"On-chain anchor"})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#c084fc"},children:"◈"}),o.jsxs("span",{className:"v10-vm-legend-label",children:["Agent identity (",t,")"]})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#4ade80"},children:"—"}),o.jsx("span",{className:"v10-vm-legend-label",children:"Signed / anchored edge"})]}),r&&o.jsxs("div",{className:"v10-vm-legend-foot",children:["Latest: ",r]})]})}function j4({active:e,counts:t,onSwitch:n,onShare:r,onImport:s,onRefresh:c}){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 x;const y=m.target;y&&((x=f.current)!=null&&x.contains(y))||d(!1)};return document.addEventListener("pointerdown",g),()=>document.removeEventListener("pointerdown",g)},[u]),o.jsxs("div",{className:"v10-layer-switcher",children:[o.jsxs("button",{className:`v10-layer-switch-btn ${e==="overview"?"active":""}`,"data-layer":"overview","aria-label":"Overview",title:"Overview",onClick:()=>h("overview"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"◎"}),o.jsx("span",{className:"v10-layer-switch-label",children:"Overview"})]}),o.jsx("span",{className:"v10-layer-switch-separator","aria-hidden":"true"}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="wm"?"active":""}`,"data-layer":"wm","aria-label":"Working Memory",title:"Working Memory",onClick:()=>h("wm"),children:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#64748b"},children:"◇"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Working Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"WM"}),t.wm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.wm})]}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="swm"?"active":""}`,"data-layer":"swm","aria-label":"Shared Working Memory",title:"Shared Working Memory",onClick:()=>h("swm"),children:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#f59e0b"},children:"◈"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Shared Working Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"SWM"}),t.swm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.swm})]}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="vm"?"active":""}`,"data-layer":"vm","aria-label":"Verifiable Memory",title:"Verifiable Memory",onClick:()=>h("vm"),children:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#22c55e"},children:"◉"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Verifiable Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"VM"}),t.vm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.vm})]}),o.jsx("span",{className:"v10-layer-switch-separator","aria-hidden":"true"}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="graph-overview"?"active":""}`,"data-layer":"graph-overview","aria-label":"Subgraphs",title:"Subgraphs",onClick:()=>h("graph-overview"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⌬"}),o.jsx("span",{className:"v10-layer-switch-label",children:"Subgraphs"})]}),o.jsxs("div",{ref:f,className:"v10-layer-more",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||d(!1)},children:[o.jsxs("button",{type:"button",className:`v10-layer-switch-btn v10-layer-more-btn ${e==="query"?"active":""}`,"data-layer":"query","aria-haspopup":"menu","aria-expanded":u,"aria-label":"More Context Graph views",title:"More Context Graph views",onClick:()=>d(g=>!g),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⋯"}),o.jsx("span",{className:"v10-layer-switch-label",children:"More"})]}),u&&o.jsx("div",{className:"v10-layer-more-menu",role:"menu",children:o.jsxs("button",{type:"button",role:"menuitem",className:`v10-layer-more-item ${e==="query"?"active":""}`,onClick:()=>h("query"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⟐"}),"Query Catalogue"]})})]}),o.jsx("div",{className:"v10-layer-switcher-spacer"}),o.jsxs("div",{className:"v10-layer-switcher-actions",children:[o.jsxs("button",{className:"v10-layer-action-btn",onClick:r,"aria-label":"Share Context Graph",children:[o.jsx("span",{className:"v10-layer-action-icon",children:"⤴"}),o.jsx("span",{className:"v10-layer-action-label",children:"Share"})]}),o.jsxs("button",{className:"v10-layer-action-btn",onClick:s,"aria-label":"Import into Context Graph",children:[o.jsx("span",{className:"v10-layer-action-icon",children:"↑"}),o.jsx("span",{className:"v10-layer-action-label",children:"Import"})]}),o.jsx("button",{className:"v10-layer-action-btn",onClick:c,"aria-label":"Refresh Context Graph data",children:o.jsx("span",{className:"v10-layer-action-icon",children:"↻"})})]})]})}function C4({cg:e,profile:t,activeSubGraph:n,onClearSubGraph:r}){const s=e.name||t.displayName||e.id;return o.jsxs("div",{className:"v10-project-strip",style:{"--sg-color":(n==null?void 0:n.color)??t.primaryColor},children:[o.jsx("span",{className:"v10-project-strip-dot",style:{background:t.primaryColor}}),o.jsx("button",{type:"button",className:"v10-project-strip-name",onClick:n?r:void 0,disabled:!n,title:n?"Back to context graph overview":e.id,children:s}),n?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-project-strip-sep",children:"›"}),o.jsxs("span",{className:"v10-project-strip-sg",children:[o.jsx("span",{className:"v10-project-strip-sg-icon",style:{color:n.color},children:n.icon??"•"}),n.displayName??n.slug]}),n.description&&o.jsx("span",{className:"v10-project-strip-desc",title:n.description,children:n.description})]}):e.description&&o.jsx("span",{className:"v10-project-strip-desc",title:e.description,children:e.description})]})}function N4(e,t,n,r,s){const c=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(pn)),d=u.size>0;return c&&d&&u.has(pn(c))?{label:"Curator",title:"This agent is the curator for this Context Graph.",tone:"curator"}:(e==null?void 0:e.callerInvolved)===!0?c&&!d&&n==="loading"?{label:"Role checking",title:"This agent is involved in this Context Graph; curator status is still loading.",tone:"unknown"}:c&&!d&&n==="error"?{label:"Role unknown",title:"This agent is involved in this Context Graph, but curator status could not be confirmed.",tone:"unknown"}:{label:"Joined",title:"This agent is involved in this Context Graph; curator status is shown only when identity metadata confirms it.",tone:"participant"}:(e==null?void 0:e.callerInvolved)===!1?{label:"Not joined",title:"This agent is not listed as curator or participant for this Context Graph.",tone:"viewer"}:s==="ok"&&r.map(h=>h.trim()).filter(Boolean).some(h=>u.has(pn(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 E4(e,t,n){if(ao(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(pn)),c=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";return c&&s.add(pn(c)),{id:"participants",value:s.size.toLocaleString(),label:"Agents with access",tooltip:"Includes the curator plus allowlisted participants reported by the node."}}function T4(e){const t=ao(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 A4({cg:e,currentAgent:t,currentAgentStatus:n="ok"}){var d,f;const r=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";if(!r)return"unknown";const s=((d=t==null?void 0:t.agentDid)==null?void 0:d.trim())??"",c=((f=t==null?void 0:t.agentAddress)==null?void 0:f.trim())??"",u=s||c;return u?pn(r)===pn(u)?"curator":"not-curator":"unknown"}function R4(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(pn))}function _4({cg:e,memory:t,subGraphCount:n,subGraphFetchFailed:r=!1,participants:s,participantsStatus:c="ok",currentAgent:u,currentAgentStatus:d="ok",onSwitchLayer:f,onOpenPrimer:h}){var Q,L,U;const{wm:g,swm:m,vm:y}=t.counts,x=g+m+y,k=N4(e,u??null,d,s,c),j=T4(e==null?void 0:e.accessPolicy),E=E4(e,s,c),S=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",T=S?pn(S):"",N=ao(e==null?void 0:e.accessPolicy)==="public",A=R4(u??null),q=Object.values(t.layerStatus??{}),R=q.filter(G=>G==="error").length,$=!t.loading&&q.length===3&&R===3,H=!t.loading&&R>0,z=t.loading?"Loading memory layers...":$||t.error?"Live memory counts are unavailable.":t.partial||H?"One or more layer counts are currently a lower bound.":"Canonical current-layer entity counts.",_=$?"Unavailable":x.toLocaleString(),{total:P}=yg(t),B=!t.loading&&(t.partial||H),W=$?"Unavailable":t.loading&&P===0?"...":B?`${P.toLocaleString()}+`:P.toLocaleString(),I=$?"Live triple counts are unavailable.":B?"One or more layer triple counts are currently a lower bound.":"Canonical triple total across all layers.",D=n==null?r?"Unavailable":"...":n.toLocaleString(),F=n==null?r?"Sub-graph list is currently unavailable.":"Sub-graph count is loading.":"Topical partitions inside this Context Graph.",V=[{key:"wm",label:"Working Memory",desc:"Private staging area",count:g,status:((Q=t.layerStatus)==null?void 0:Q.wm)??"ok",color:"#64748b"},{key:"swm",label:"Shared Working Memory",desc:"Collaborative review",count:m,status:((L=t.layerStatus)==null?void 0:L.swm)??"ok",color:"#f59e0b"},{key:"vm",label:"Verifiable Memory",desc:"Published on-chain",count:y,status:((U=t.layerStatus)==null?void 0:U.vm)??"ok",color:"#22c55e"}],X=V.some(G=>G.status==="error");return o.jsxs("div",{className:"v10-po",children:[o.jsxs("div",{className:"v10-po-identity","data-section":"identity",children:[o.jsxs("div",{className:"v10-po-identity-pairs",children:[o.jsxs("div",{className:"v10-po-identity-pair",children:[o.jsx("span",{className:"v10-po-identity-label",children:"Your role:"}),o.jsx("span",{className:"v10-po-badge","data-role":k.tone,title:k.title,children:k.label})]}),o.jsxs("div",{className:"v10-po-identity-pair",children:[o.jsx("span",{className:"v10-po-identity-label",children:"Context Graph:"}),o.jsx("span",{className:"v10-po-badge","data-cg-type":j.tone,title:j.title,children:j.label})]})]}),h&&o.jsx("button",{type:"button",className:"v10-po-identity-primer",onClick:h,title:"Open the Context Graph primer",children:"What is a Context Graph?"})]}),o.jsxs("div",{"data-section":"at-a-glance",className:"v10-po-stat-block",children:[o.jsx("div",{className:"v10-po-section-title",children:"At a glance"}),o.jsx(Cd,{className:"v10-po-stat-strip",items:[{id:"entities",value:_,label:"Entities",tooltip:z},{id:"triples",value:W,label:"Triples",tooltip:I},{id:"subgraphs",value:D,label:"Subgraphs",tooltip:F},E]})]}),o.jsxs("div",{className:"v10-po-pipeline","data-section":"pipeline","aria-label":"Knowledge Pipeline",children:[o.jsx("div",{className:"v10-po-pipeline-head",children:o.jsxs("div",{children:[o.jsx("div",{className:"v10-po-section-title",children:"Knowledge Pipeline"}),o.jsx("div",{className:"v10-po-section-desc",children:"Entities move from private staging to shared review; published assertion bundles become Knowledge Assets with on-chain provenance."})]})}),o.jsx("div",{className:"v10-po-pipeline-track","aria-hidden":"true",children:!X&&x>0?V.map(G=>{const O=G.count>0?G.count/x*100:0;return o.jsx("span",{className:`v10-po-pipeline-seg ${G.key}`,style:{width:`${O}%`,background:G.color}},G.key)}):o.jsx("span",{className:"v10-po-pipeline-empty"})}),o.jsx("div",{className:"v10-po-pipeline-steps",children:V.map((G,O)=>o.jsxs("button",{type:"button",className:`v10-po-pipeline-step ${G.key}`,onClick:()=>f==null?void 0:f(G.key),style:{"--po-layer-color":G.color},children:[o.jsx("span",{className:"v10-po-pipeline-step-index",children:O+1}),o.jsxs("span",{className:"v10-po-pipeline-step-copy",children:[o.jsx("span",{className:"v10-po-pipeline-step-label",children:G.label}),o.jsx("span",{className:"v10-po-pipeline-step-desc",children:G.desc})]}),o.jsx("span",{className:"v10-po-pipeline-step-count",children:G.status==="error"?"Unavailable":`${G.count.toLocaleString()} ${Lr(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&&c==="ok"){const le=pn(S);ne.add(le),ue.push({display:O(S),full:S,canonical:le})}if(c==="ok")for(const le of s){const be=pn(le);ne.has(be)||(ne.add(be),ue.push({display:O(le),full:le,canonical:be}))}if(ue.length===0){const le=N?"This Context Graph is public — anyone can subscribe.":c==="loading"?"Loading participant agents...":c==="error"?"Participant list unavailable.":"No participant agents recorded yet.";return o.jsx("div",{className:"v10-po-people-empty",children:le})}return o.jsx("div",{className:"v10-po-participants-list",children:ue.map(({display:le,full:be,canonical:Re})=>{const Ee=A.has(Re),Ie=!!T&&Re===T,Ve=`${le.slice(0,6)}…${le.slice(-4)}`,Se=[Ve];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:Ve}),Ee&&o.jsx("span",{className:"v10-po-participant-tag",children:"you"}),Ie&&o.jsx("span",{className:"v10-po-participant-tag",children:"curator"})]},Re)})})})()]})]})}function O4({contextGraphId:e,curatorStatus:t,onParticipantsChanged:n}){const[r,s]=w.useState([]),[c,u]=w.useState(null),[d,f]=w.useState("loading"),h=w.useRef(0),g=w.useCallback(()=>{if(t!=="curator"){s([]),f("idle");return}const x=++h.current;f("loading"),Zk(e).then(k=>{h.current===x&&(s(k.requests.filter(j=>j.status==="pending")),f("idle"))}).catch(()=>{h.current===x&&(s([]),f("error"))})},[e,t]);if(w.useEffect(()=>(g(),()=>{h.current++}),[g]),Ji(w.useCallback(x=>{var k;x.type!=="join_request"&&x.type!=="join_approved"&&x.type!=="join_rejected"||((k=x.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 x=>{u(x);try{await Xm(e,x),s(k=>k.filter(j=>j.agentAddress!==x)),n==null||n()}catch{}finally{u(null)}},y=async x=>{u(x);try{await Jm(e,x),s(k=>k.filter(j=>j.agentAddress!==x)),n==null||n()}catch{}finally{u(null)}};return o.jsxs("section",{className:"v10-po-join","data-section":"join-requests",children:[o.jsxs("header",{className:"v10-po-join-head",children:[o.jsx("span",{className:"v10-po-section-title",children:"Pending join requests"}),o.jsx("span",{className:"v10-po-join-count","data-empty":r.length===0?"true":"false",children:r.length})]}),d==="loading"?o.jsx("div",{className:"v10-po-join-empty",children:"Loading join requests..."}):d==="error"?o.jsx("div",{className:"v10-po-join-empty",children:"Join requests are currently unavailable."}):r.length===0?o.jsx("div",{className:"v10-po-join-empty",children:"No pending join requests."}):o.jsx("div",{className:"v10-po-join-list",children:r.map(x=>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:x.name||`${x.agentAddress.slice(0,6)}…${x.agentAddress.slice(-4)}`}),o.jsxs("span",{className:"v10-po-join-addr",title:x.agentAddress,children:[x.agentAddress.slice(0,10),"…"]})]}),o.jsxs("div",{className:"v10-po-join-actions",children:[o.jsx("button",{className:"v10-po-join-btn approve",onClick:()=>m(x.agentAddress),disabled:c===x.agentAddress,children:c===x.agentAddress?"…":"✓ Approve"}),o.jsx("button",{className:"v10-po-join-btn reject",onClick:()=>y(x.agentAddress),disabled:c===x.agentAddress,"aria-label":"Reject join request",children:"✕"})]})]},x.agentAddress))})]})}function L4({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."})]})}function jg({title:e,agent:t,footnote:n,dismissed:r,onDismiss:s,children:c}){return o.jsxs("div",{className:`v10-gen-widget ${r?"dissolved":""}`,children:[o.jsxs("div",{className:"v10-gen-widget-header",children:[o.jsx("span",{className:"v10-gen-widget-title",children:e}),o.jsxs("div",{className:"v10-gen-widget-right",children:[t&&o.jsxs("span",{className:"v10-gen-widget-agent",children:[o.jsx("span",{className:"v10-gen-widget-agent-dot"}),t]}),s&&o.jsx("button",{className:"v10-gen-widget-dismiss",onClick:s,children:"✕"})]})]}),o.jsx("div",{className:"v10-gen-widget-body",children:c}),n&&o.jsx("div",{className:"v10-gen-widget-footnote",children:n})]})}function z4({entities:e}){const t=Ir(),n=w.useMemo(()=>{const r=new Map;for(const s of e){const{icon:c,type:u}=jd(s,t),d=r.get(u);d?d.count++:r.set(u,{icon:c,count:1})}return[...r.entries()].sort((s,c)=>c[1].count-s[1].count)},[e,t]);return n.length===0?null:o.jsx(jg,{title:"Entity Types",children:o.jsx(Cd,{compact:!0,items:n.map(([r,{icon:s,count:c}])=>({id:r,label:`${s} ${r}`,value:c}))})})}function M4({entities:e,entityCount:t,triples:n,layer:r}){const s=w.useMemo(()=>e.filter(d=>d.properties.has("http://dkg.io/ontology/sourceContentType")).length,[e]),c=w.useMemo(()=>e.reduce((d,f)=>d+f.connections.length,0),[e]),u=e.length>0?(c/e.length).toFixed(1):"0";return o.jsx(jg,{title:"Layer Stats",children:o.jsx(Cd,{compact:!0,layer:r,items:[{id:"entities",label:Lr(r,t),value:t},{id:"triples",label:"Triples",value:n},{id:"connections",label:"Connections",value:c},{id:"avg",label:"Avg. connections / entity",value:u},...s>0?[{id:"documents",label:"Documents",value:s}]:[]]})})}function D4({layer:e,count:t,contextGraphId:n,onComplete:r,onResult:s}){const[c,u]=w.useState(!1),[d,f]=w.useState(null),[h,g]=w.useState(null),m=e==="wm";w.useEffect(()=>{d?s==null||s({ok:!0,text:d}):h&&(s==null||s({ok:!1,text:h}))},[d,h]);const y=w.useCallback(async()=>{u(!0),g(null),f(null);let E=null;try{if(m){const S=await Al(n,"wm");let T=0,N=0;for(const A of S){E=A.name;try{await Vu(n,A.name,A.subGraph?{subGraphName:A.subGraph}:{})}catch(R){const $=String((R==null?void 0:R.message)??"");if(!/already|finaliz|sealed|promoted|no quads|reserved/i.test($))throw R}const q=await eo(n,A.name,"all",A.subGraph);T+=q.promotedCount,q.promotedCount===0&&(N+=1)}if(T>0){const A=N>0?` (${N} had nothing to promote)`:"";f(`Promoted ${T} triple${T!==1?"s":""} to Shared Memory${A}`)}else f("No triples were promoted — every assertion was already in Shared Memory or its content is still being committed.")}else{const S=await Al(n,"swm"),T=await ng(n,S);if(T.published>0){const N=T.failures.length?` (${T.failures.length} assertion${T.failures.length===1?"":"s"} could not be published)`:"",A=T.partial>0?` — ⚠ ${T.partial}: ${Rl(T.partialError)}`:"";f(`Published ${T.published} knowledge asset${T.published!==1?"s":""} to Verifiable Memory${N}${A}`)}else if(S.length===0)f("Nothing to publish — promote assertions to Shared Memory first.");else throw new Error(T.failures[0]?`${T.failures[0].name}: ${T.failures[0].error}`:"Publish failed")}r==null||r()}catch(S){const T=to(E??"an assertion",S);g(T?T.message:(S==null?void 0:S.message)??"Action failed")}finally{u(!1)}},[m,n,r]);if(t===0)return null;const x=m?"#f59e0b":"#22c55e",k=m?"Shared Working Memory":"Verifiable Memory",j=Lr(e,t).toLowerCase();return o.jsxs(jg,{title:m?"Promote":"Publish",footnote:`Moves ${j} from this layer to ${k}.`,children:[o.jsxs("div",{className:"v10-decision-context",style:{marginBottom:10},children:[t," ",j," in this layer can be ",m?"promoted to Shared Working Memory for collaborative review":"published to Verifiable Memory on-chain","."]}),d&&o.jsxs("div",{"data-testid":"layer-action-result",style:{fontSize:11,color:"var(--text-success)",marginBottom:8},children:["✓ ",d]}),h&&o.jsxs("div",{"data-testid":"layer-action-result",style:{fontSize:11,color:"var(--text-danger)",marginBottom:8},children:["✕ ",h]}),o.jsx("div",{className:"v10-decision-actions",children:o.jsx("button",{"data-testid":m?"widget-promote-all-btn":"widget-publish-vm-btn",className:m?"v10-decision-btn approve":"v10-decision-btn primary-cta publish-vm",style:m?{borderColor:`${x}50`,color:"var(--text-warning)",background:`${x}15`,opacity:c?.5:1}:{opacity:c?.5:1},disabled:c,onClick:y,children:c?"...":m?"✓ Promote All → Shared":"◉ Publish to Verifiable Memory"})})]})}function $4({layer:e,entities:t,entityCount:n,tripleCount:r,contextGraphId:s,onComplete:c}){const[u,d]=w.useState(null),f=u&&o.jsxs("div",{"data-testid":"layer-action-result",style:{fontSize:11,color:u.ok?"var(--text-success)":"var(--text-danger)",marginBottom:8},children:[u.ok?"✓":"✕"," ",u.text]});return n===0?o.jsxs("div",{className:"v10-layer-widgets-strip empty",children:[f,o.jsx(on,{compact:!0,tone:e,icon:Mn[e].icon,title:`No ${Lr(e,2).toLowerCase()} yet`,description:e==="wm"?"Import data or chat with agents to populate Working Memory.":e==="swm"?"Promote entities from Working Memory to share them with the team.":"Publish entities from Shared Working Memory to verify them on-chain."})]}):o.jsxs("div",{className:"v10-layer-widgets-strip",children:[o.jsxs("div",{className:"v10-layer-widgets-strip-stats",children:[o.jsx(M4,{entities:t,entityCount:n,triples:r,layer:e}),o.jsx(z4,{entities:t})]}),(e==="wm"||e==="swm")&&o.jsx("div",{className:"v10-layer-widgets-strip-action",children:o.jsx(D4,{layer:e,count:n,entities:t,contextGraphId:s,onComplete:c,onResult:d})})]})}const Cg="doc:";function I4(e,t,n){return`${Cg}${e}|${t}|${n}`}function P4(e,t,n){return e?{ref:e,contentType:"text/markdown"}:t?{ref:t,contentType:n}:{ref:void 0,contentType:n}}function U4(e){const t=e.slice(Cg.length),n=t.indexOf("|"),r=t.lastIndexOf("|");return n<0?{docRef:t,contentType:""}:{docRef:t.slice(n+1,r),contentType:t.slice(r+1)}}function Ng(e,t){if(e.length<=t)return e;const n=t-1,r=Math.ceil(n/2),s=n-r;return`${e.slice(0,r)}…${e.slice(-s)}`}const B4={working:{layerKey:"wm",icon:"◇",label:"Working"},shared:{layerKey:"swm",icon:"◈",label:"Shared"},verified:{layerKey:"vm",icon:"◉",label:"Verifiable"}};function _S({entities:e,layerKey:t,layerIcon:n,onSelectEntity:r,onOpenAgent:s,externallySorted:c=!1,sortLabel:u,headerExtra:d,timestampPredicate:f,perEntityTrustBadge:h=!1}){const g=Ir(),m=ns(),y=Lr(t,e.length).toLowerCase(),x=w.useMemo(()=>{if(c)return e;const E=[...e];return E.sort((S,T)=>{const N=S.tripleCount??0;return(T.tripleCount??0)-N}),E},[e,c]),k=t==="vm"?"Verifiable":t==="swm"?"Shared":"Working";if(e.length===0)return o.jsx("div",{className:"v10-entity-list empty",children:o.jsx(on,{compact:!0,tone:t,icon:n,title:`No ${Lr(t,2).toLowerCase()} yet`,description:`This view will fill when matching ${Lr(t,2).toLowerCase()} are available.`})});const j=u??(c?"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:[x.length," ",y]}),o.jsx("span",{className:"v10-entity-list-hint",children:j}),d&&o.jsx("span",{className:"v10-entity-list-extra",children:d})]}),x.map(E=>{const{icon:S,type:T}=jd(E,g),N=E.tripleCount??0,A=Sd(E),q=A?m==null?void 0:m.get(A):null,R=f?Mu(E,f):null;return o.jsxs("div",{className:"v10-entity-card",onClick:$=>{$.stopPropagation(),r(E.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:E.label}),o.jsxs("div",{className:"v10-entity-card-meta",children:[(q||A)&&o.jsx(Yi,{agent:q??void 0,fallbackUri:A??void 0,size:"sm",onOpenAgent:s}),T&&T!=="Entity"&&o.jsxs("span",{className:"v10-entity-type-pill",children:[S," ",T]}),R!=null&&o.jsx("span",{className:"v10-entity-card-timestamp",title:new Date(R).toLocaleString(),children:sL(R)}),o.jsxs("span",{className:"v10-entity-card-triples",children:[N," triples"]})]})]}),h?(()=>{const $=B4[E.trustLevel];return o.jsxs("span",{className:`v10-trust-badge ${$.layerKey}`,title:`${$.label} Memory`,children:[$.icon," ",$.label]})})():o.jsxs("span",{className:`v10-trust-badge ${t}`,children:[n," ",k]})]},E.uri)})]})}function F4({layer:e,entities:t,tripleCount:n,layerTriples:r,contextGraphId:s,memory:c,activeTab:u,onTabChange:d,onSelectEntity:f,onNodeClick:h,footer:g,swmAttribution:m}){var A;const y=Mn[e],x=Lr(e,2),k=((A=c.layerStatus)==null?void 0:A.vm)??(c.loading?"loading":c.error?"error":"ok"),j=e==="vm"&&k==="loading"&&t.length===0,E=e==="vm"&&k==="error"&&t.length===0,S=e==="vm"&&k==="ok"&&t.length===0,T=c.counts[e],N=q=>R=>{R.stopPropagation(),d(q)};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:N("items"),children:x}),e!=="vm"&&o.jsx("button",{className:`v10-layer-expand-tab ${u==="assertions"?"active":""}`,onClick:N("assertions"),children:"Assertions"}),o.jsx("button",{className:`v10-layer-expand-tab ${u==="graph"?"active":""}`,onClick:N("graph"),children:"Graph"}),o.jsx("button",{className:`v10-layer-expand-tab ${u==="docs"?"active":""}`,onClick:N("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&&!E&&o.jsx(H4,{entities:t,tripleCount:n,contextGraphId:s}),j?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(on,{compact:!0,tone:"vm",icon:Mn.vm.icon,title:"Loading Verifiable Memory...",description:"Knowledge Assets are being read from the verified layer."})}):E?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(on,{compact:!0,tone:"vm",icon:Mn.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($4,{layer:e,entities:t,entityCount:T,tripleCount:n,contextGraphId:s,onComplete:c.refresh}),o.jsx(_S,{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(q4,{contextGraphId:s,layer:e,onComplete:c.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(RS,{layer:e,triples:r,onNodeClick:h,contextGraphId:s,swmAttribution:e==="swm"?m:void 0,layerEntities:t})}),u==="docs"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(OS,{entities:t,contextGraphId:s,scrollKey:`layer:${e}:docs`})})]})}function H4({entities:e,tripleCount:t,contextGraphId:n}){const r=e.length,s=new Set;for(const u of e)for(const d of u.types)s.add(d);const c=s.size;return r===0?o.jsxs("div",{className:"v10-vm-hero v10-vm-hero-empty",children:[o.jsxs("div",{className:"v10-vm-hero-title",children:[o.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),o.jsxs("div",{className:"v10-vm-hero-heading",children:[o.jsx("span",{className:"v10-vm-hero-headline",children:"Nothing published yet"}),o.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),o.jsx(on,{compact:!0,className:"v10-vm-empty-state",tone:"vm",icon:Mn.vm.icon,title:"No Knowledge Assets yet.",description:"Publish entities from Shared Working Memory to verify them on-chain."})]}):o.jsxs("div",{className:"v10-vm-hero",children:[o.jsxs("div",{className:"v10-vm-hero-title",children:[o.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),o.jsxs("div",{className:"v10-vm-hero-heading",children:[o.jsx("span",{className:"v10-vm-hero-headline",children:"On-chain anchored · cryptographically signed"}),o.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),o.jsx(Cd,{className:"v10-vm-hero-stats",layer:"vm",items:[{id:"assets",value:r,label:"Knowledge Assets"},{id:"triples",value:t.toLocaleString(),label:"Verifiable Triples"},{id:"types",value:c,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 q4({contextGraphId:e,layer:t,onComplete:n,scrollKey:r}){const{data:s,loading:c,refresh:u}=Ea(()=>Al(e,t),[e,t],0),{data:d}=Ea(()=>b2(e),[e,t],0),[f,h]=w.useState(null),[g,m]=w.useState(null),[y,x]=w.useState(null),k=w.useCallback(async N=>{h(N.graphUri),m(null),x(null);try{if(t==="wm"){try{await Vu(e,N.name,N.subGraph?{subGraphName:N.subGraph}:{})}catch(R){const $=String((R==null?void 0:R.message)??"");if(!/already|finaliz|sealed|promoted|no quads|reserved/i.test($))throw R}const A=await eo(e,N.name,"all",N.subGraph),q=ag(N.name,A);m(q.message)}else{const A=await tg(e,N.name,N.subGraph?{subGraphName:N.subGraph}:{});m(A.contextGraphError?`Published ${N.name} on-chain — ⚠ ${Rl(A.contextGraphError)}`:`Published ${N.name} to Verifiable Memory`)}u(),n()}catch(A){const q=to(N.name,A);x(q?q.message:(A==null?void 0:A.message)??"Action failed")}finally{h(null)}},[e,t,u,n]),j=w.useCallback(async()=>{if(!(s!=null&&s.length))return;h("__all__"),m(null),x(null);let N=null;try{if(t==="wm"){let A=0,q=0;for(const R of s){N=R.name;try{await Vu(e,R.name,R.subGraph?{subGraphName:R.subGraph}:{})}catch(H){const z=String((H==null?void 0:H.message)??"");if(!/already|finaliz|sealed|promoted|no quads|reserved/i.test(z))throw H}const $=await eo(e,R.name,"all",R.subGraph);A+=$.promotedCount,$.promotedCount===0&&(q+=1)}if(A>0){const R=q>0?` (${q} had nothing to promote)`:"";m(`Promoted ${A} triples across ${s.length} assertion${s.length!==1?"s":""}${R}`)}else m("No triples were promoted — every assertion was already in Shared Memory or its content is still being committed.")}else{const A=await ng(e,s);if(A.published>0){const q=A.failures.length?` (${A.failures.length} could not be published)`:"",R=A.partial>0?` — ⚠ ${A.partial}: ${Rl(A.partialError)}`:"";m(`Published ${A.published} knowledge asset${A.published!==1?"s":""} to Verifiable Memory${q}${R}`)}else throw new Error(A.failures[0]?`${A.failures[0].name}: ${A.failures[0].error}`:"Publish failed")}u(),n()}catch(A){const q=to(N??"selected assertion",A);x(q?q.message:(A==null?void 0:A.message)??"Action failed")}finally{h(null)}},[s,e,t,u,n]),E={flex:1,overflow:"auto"};if(c)return o.jsx("div",{className:"v10-layer-empty-shell",style:E,"data-cg-scroll-key":r,children:o.jsx(on,{compact:!0,tone:t,icon:Mn[t].icon,title:"Loading assertions..."})});if(!(s!=null&&s.length))return o.jsx("div",{className:"v10-layer-empty-shell",style:E,"data-cg-scroll-key":r,children:o.jsx(on,{tone:t,icon:Mn[t].icon,title:t==="swm"?"No Shared Working Memory assertions listed yet.":"No Working Memory assertions yet.",description:t==="swm"?"Promoted assertion contents are available as Shared Working Memory entities. The assertion list will populate once promoted assertions are exposed by the node.":"Create or import data to stage assertions in Working Memory."})});const S=t==="wm"?"Promote → Shared":"Publish to VM",T=t==="wm"?"Promote All → Shared":"Publish all to Verifiable Memory";return o.jsxs("div",{style:E,"data-cg-scroll-key":r,children:[o.jsxs("div",{style:{padding:"8px 16px",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid var(--border-subtle)"},children:[o.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:[s.length," assertion",s.length!==1?"s":""]}),o.jsx("button",{className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:f!==null,onClick:j,style:{opacity:f==="__all__"?.5:1},children:f==="__all__"?"...":T})]}),g&&o.jsxs("div",{style:{padding:"6px 16px",fontSize:11,color:"var(--text-success)"},children:["✓ ",g]}),y&&o.jsxs("div",{style:{padding:"6px 16px",fontSize:11,color:"var(--text-danger)"},children:["✕ ",y]}),s.map(N=>o.jsxs("div",{className:"v10-item-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:N.name}),(d==null?void 0:d[N.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[N.name],children:d[N.name]}),o.jsxs("div",{className:"v10-item-meta-row",children:[N.tripleCount!=null&&o.jsxs("span",{className:"v10-item-count",children:[N.tripleCount," triples"]}),N.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${N.subGraph}`,children:["› ",Ng(N.subGraph,18)]})]})]}),o.jsx("button",{className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:f!==null,onClick:A=>{A.stopPropagation(),k(N)},style:{opacity:f===N.graphUri?.5:1,flexShrink:0},children:f===N.graphUri?"...":S})]},N.graphUri))]})}function G4({layer:e,memory:t,onNodeClick:n,onSelectEntity:r,contextGraphId:s,activeTab:c,onTabChange:u,swmAttribution:d}){const f=Mn[e],h=w.useMemo(()=>t.entityList.filter(m=>m.trustLevel===f.trustLevel),[t.entityList,f.trustLevel]),g=tL(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(F4,{layer:e,entities:h,tripleCount:g.length,layerTriples:g,contextGraphId:s,memory:t,activeTab:c,onTabChange:u,onSelectEntity:r,onNodeClick:n,swmAttribution:d})})]})}function OS({entities:e,contextGraphId:t,scrollKey:n}){const r=yn(u=>u.openTab),s=w.useMemo(()=>e.filter(u=>u.properties.has(oh)),[e]),c=u=>{var y,x,k;const d=(y=u.connections.find(j=>j.predicate===Px))==null?void 0:y.targetUri,f=(x=u.connections.find(j=>j.predicate===Ux))==null?void 0:x.targetUri,h=((k=u.properties.get(oh))==null?void 0:k[0])??"",{ref:g,contentType:m}=P4(d,f,h);r({id:I4(t??"",g??u.uri,m),label:u.label,closable:!0,icon:"📄"})};return s.length===0?o.jsx("div",{className:"v10-docs-placeholder v10-layer-empty-shell",style:{flex:1},"data-cg-scroll-key":n,children:o.jsx(on,{compact:!0,title:"No documents in this layer yet.",description:"Import a file to add document-backed entities."})}):o.jsx("div",{className:"v10-layer-detail-content","data-cg-scroll-key":n,children:o.jsx("div",{className:"v10-items-list",children:s.map(u=>{var m,y,x,k;const d=((m=u.properties.get(oh))==null?void 0:m[0])??"",f=(y=u.connections.find(j=>j.predicate===Px||j.predicate===Ux))==null?void 0:y.targetUri,h=f?e.find(j=>j.uri===f):void 0,g=((x=h==null?void 0:h.properties.get(Bx))==null?void 0:x[0])??((k=u.properties.get(Bx))==null?void 0:k[0]);return o.jsxs("div",{className:"v10-item-row",onClick:()=>c(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(),c(u)},children:"Open →"})]},u.uri)})})})}function LS(e){return`SELECT ?g ?s ?p ?o WHERE {
1287
- GRAPH ?g { ?s ?p ?o }
1288
- ${lm(e)}
1289
- }
1290
- LIMIT 1000`}const rr="__context_graph",ro="ui-saved-queries",Xu="Saved queries",Ju="User-created SPARQL saved in this node profile for this Context Graph.",Ja="http://dkg.io/ontology/profile/",Kx="http://schema.org/",Xx="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",V4="http://www.w3.org/2001/XMLSchema#integer";function Jx(e){return JSON.stringify(e)}function lm(e){const t=`did:dkg:context-graph:${e}`,n=`${t}/`;return`FILTER(
1291
- (
1292
- STR(?g) = ${Jx(t)} ||
1293
- STRSTARTS(STR(?g), ${Jx(n)})
1294
- ) &&
1295
- !CONTAINS(STR(?g), "/_private")
1296
- )`}function W4(e){const t="whole-context-graph",n="Context graph",s=rr,c=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:[c({slug:"all-triples",name:"All triples",description:"Show triples across available non-private graphs in this context graph.",sparql:LS(e),resultColumn:"o",rank:1}),c({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
- ${lm(e)}
1299
- }
1300
- GROUP BY ?g
1301
- ORDER BY DESC(?triples)
1302
- LIMIT 100`,resultColumn:"g",rank:2}),c({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
- ${lm(e)}
1305
- }
1306
- GROUP BY ?type
1307
- ORDER BY DESC(?entities)
1308
- LIMIT 100`,resultColumn:"type",rank:3})]}}function Z4(e){return e.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"saved-query"}function e1(e,t,n){return`urn:dkg:profile:${encodeURIComponent(e)}:${t}:${encodeURIComponent(n)}`}function Ui(e){return JSON.stringify(e)}function t1(e){return`"${e}"^^<${V4}>`}function Y4(e,t,n,r){const s=Date.now(),c=`${Z4(t)}-${s.toString(36)}`,u=e1(e,"catalog",ro),d=e1(e,"query",c),f={slug:c,subGraph:rr,catalogSlug:ro,catalogName:Xu,catalogDescription:Ju,catalogRank:50,name:t,description:n||void 0,sparql:r,resultColumn:"",rank:s},h=[{subject:u,predicate:Xx,object:`${Ja}QueryCatalog`,graph:""},{subject:u,predicate:`${Ja}forSubGraph`,object:Ui(rr),graph:""},{subject:u,predicate:`${Ja}displayName`,object:Ui(Xu),graph:""},{subject:u,predicate:`${Kx}description`,object:Ui(Ju),graph:""},{subject:u,predicate:`${Ja}rank`,object:t1(50),graph:""},{subject:d,predicate:Xx,object:`${Ja}SavedQuery`,graph:""},{subject:d,predicate:`${Ja}forSubGraph`,object:Ui(rr),graph:""},{subject:d,predicate:`${Ja}inCatalog`,object:u,graph:""},{subject:d,predicate:`${Ja}displayName`,object:Ui(t),graph:""},{subject:d,predicate:`${Ja}sparqlQuery`,object:Ui(r),graph:""},{subject:d,predicate:`${Ja}rank`,object:t1(s),graph:""}];return n&&h.push({subject:d,predicate:`${Kx}description`,object:Ui(n),graph:""}),{query:f,quads:h}}function Q4(e,t){const n=`${rr}|${ro}`,r=e.map(c=>({...c,queries:[...c.queries]})),s=r.find(c=>`${c.subGraph}|${c.slug}`===n);return s?(s.queries=[...s.queries,t].sort((c,u)=>c.rank-u.rank||c.name.localeCompare(u.name)),r):[...r,{slug:ro,subGraph:rr,name:Xu,description:Ju,rank:50,queries:[t]}]}function n1(e){const t=new Map;for(const n of e){const r=`${n.subGraph}|${n.slug}`,s=t.get(r);if(!s){t.set(r,{...n,queries:[...n.queries]});continue}const c=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}`;c.has(d)||c.set(d,u)}s.queries=Array.from(c.values()).sort((u,d)=>u.rank-d.rank||u.name.localeCompare(d.name))}return Array.from(t.values()).sort((n,r)=>n.subGraph.localeCompare(r.subGraph)||n.rank-r.rank||n.name.localeCompare(r.name))}function K4(e){return e==null?"":typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function X4(e){return e?e.length<=140?e:`${e.slice(0,110)}...${e.slice(-24)}`:"—"}function Nd(e){return e.subGraph===rr&&e.slug==="whole-context-graph"}function J4(e){return e.subGraph===rr?"context":"subgraph"}function ez(e,t,n){return Nd(e)?"Built-in presets":e.subGraph===rr&&e.slug===ro?Xu:t==="context"?e.name:`${n??e.subGraph}: ${e.name}`}function tz(e){return Nd(e)?"UI-provided SPARQL for common Context Graph checks.":e.subGraph===rr&&e.slug===ro?Ju:e.description??""}function nz(e,t){return Nd(e)?"Preset":t==="context"?"Saved":"Subgraph"}function az(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 rz({contextGraphId:e}){const t=Ir(),n=w.useMemo(()=>LS(e),[e]),[r,s]=w.useState(n),[c,u]=w.useState(n),[d,f]=w.useState(null),[h,g]=w.useState([]),[m,y]=w.useState(!1),[x,k]=w.useState(""),[j,E]=w.useState(""),[S,T]=w.useState(!1),[N,A]=w.useState(null),[q,R]=w.useState(null),$=w.useMemo(()=>W4(e),[e]),H=w.useMemo(()=>n1([$,...h,...(t==null?void 0:t.queryCatalogs)??[]]),[$,h,t==null?void 0:t.queryCatalogs]),z=w.useMemo(()=>t!=null&&t.loading||t!=null&&t.error?n1([$,...h]):H,[$,h,t==null?void 0:t.error,t==null?void 0:t.loading,H]);w.useEffect(()=>{s(n),u(n),f(null),g([]),y(!1),k(""),E(""),A(null),R(null)},[n]);const{data:_,loading:P,error:B,refresh:W}=Ea(()=>ia(c,e),[c,e],0),I=w.useMemo(()=>{var G,O;return((G=_==null?void 0:_.result)==null?void 0:G.bindings)??((O=_==null?void 0:_.results)==null?void 0:O.bindings)??[]},[_]),D=w.useMemo(()=>H.some(G=>!Nd(G)&&G.queries.length>0),[H]),F=w.useMemo(()=>{const G=[];for(const O of I)for(const ne of Object.keys(O))G.includes(ne)||G.push(ne);return G},[I]),V=w.useCallback(()=>{const G=r.trim();if(G){if(f(null),R(null),A(null),G===c){W();return}u(G)}},[c,r,W]),X=w.useCallback(()=>{s(n),f(null),R(null),A(null),c===n?W():u(n)},[c,n,W]),Q=w.useCallback((G,O)=>{const ne=O.trim();if(ne){if(f(G),s(ne),R(null),A(null),c===ne){W();return}u(ne)}},[c,W]),L=w.useCallback(()=>{const G=r.trim().split(`
1309
- `).find(O=>O.trim());k(G?G.replace(/\s+/g," ").slice(0,60):""),E(""),A(null),R(null),y(!0)},[r]),U=w.useCallback(async G=>{G.preventDefault();const O=x.trim(),ne=j.trim(),ue=r.trim();if(!O){A("Name is required.");return}if(!ue){A("Query is empty.");return}T(!0),A(null),R(null);try{const{query:le,quads:be}=Y4(e,O,ne,ue);await x2(e,be),g(Ee=>Q4(Ee,le));const Re=`${le.subGraph}|${le.catalogSlug}|${le.slug}`;f(Re),s(le.sparql),c===le.sparql?W():u(le.sparql),k(""),E(""),y(!1),R("Saved to catalogue.")}catch(le){A((le==null?void 0:le.message)??"Failed to save query.")}finally{T(!1)}},[c,e,r,W,j,x]);return o.jsxs("div",{className:"v10-memory-layer-view v10-cg-query-view",children:[o.jsxs("div",{className:"v10-mlv-header",children:[o.jsx("span",{className:"v10-mlv-icon",children:"⟐"}),o.jsxs("div",{children:[o.jsx("h2",{className:"v10-mlv-title",children:"Query Catalogue"}),o.jsx("p",{className:"v10-mlv-desc",children:"Reusable SPARQL for this Context Graph. Use UI presets or save queries for people and local agents to reuse."})]})]}),o.jsxs("section",{className:"v10-cg-query-zone v10-cg-query-zone-catalog","aria-labelledby":"query-catalogue-saved-title",children:[o.jsx("div",{className:"v10-cg-query-zone-header",children:o.jsxs("div",{children:[o.jsx("span",{className:"v10-cg-query-eyebrow",children:"Query Library"}),o.jsx("h3",{id:"query-catalogue-saved-title",children:"Choose a query"}),o.jsx("p",{children:"Load a preset or saved query into the editor below."})]})}),(t==null?void 0:t.loading)&&o.jsx(on,{compact:!0,inline:!0,tone:"query",icon:"?",title:"Loading saved queries...",description:"Built-in presets are available while saved queries load from this node profile."}),(t==null?void 0:t.error)&&o.jsx(on,{compact:!0,inline:!0,tone:"danger",icon:"!",title:"Saved query catalogue unavailable",description:t.error}),z.length>0&&o.jsx("div",{className:"v10-cg-query-catalog-groups",children:z.map(G=>{const O=J4(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),Re=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:Re}),o.jsx("h4",{children:le})]}),be&&o.jsx("p",{children:be})]})}),o.jsx("div",{className:"v10-cg-query-list",children:G.queries.map(Ee=>{const Ie=`${Ee.subGraph}|${Ee.catalogSlug}|${Ee.slug}`,Ve=d===Ie&&c===Ee.sparql,Se=Ee.description?`${Ee.name}. ${Ee.description}`:Ee.name;return o.jsxs("button",{type:"button",className:`v10-cg-query-chip${Ve?" active":""}`,title:Se,"aria-label":`Load query: ${Se}`,onClick:()=>Q(Ie,Ee.sparql),children:[o.jsx("span",{className:"v10-cg-query-chip-title",children:Ee.name}),Ee.description&&o.jsx("span",{className:"v10-cg-query-chip-desc",children:Ee.description})]},Ie)})})]},`${G.subGraph}|${G.slug}`)})}),!(t!=null&&t.loading)&&!(t!=null&&t.error)&&H.length>0&&!D&&o.jsx(on,{compact:!0,inline:!0,tone:"query",icon:"?",title:"No saved queries yet.",description:"Use Save after editing SPARQL to keep a reusable query for this Context Graph."})]}),o.jsxs("section",{className:"v10-cg-query-zone v10-cg-query-zone-editor","aria-labelledby":"query-catalogue-editor-title",children:[o.jsx("div",{className:"v10-cg-query-zone-header",children:o.jsxs("div",{children:[o.jsx("span",{className:"v10-cg-query-eyebrow",children:"Ad-hoc SPARQL"}),o.jsx("h3",{id:"query-catalogue-editor-title",children:"Editor and results"}),o.jsx("p",{children:"Run a one-off query against this Context Graph, or save it when it should become reusable."})]})}),o.jsxs("div",{className:"v10-cg-query-editor",children:[o.jsx("textarea",{className:"v10-cg-query-textarea","aria-label":"SPARQL editor",value:r,onChange:G=>{s(G.target.value),f(null)},spellCheck:!1}),o.jsxs("div",{className:"v10-cg-query-actions",children:[o.jsx("button",{className:"v10-mlv-run-btn",type:"button",onClick:V,children:"Run"}),o.jsx("button",{className:"v10-mlv-save-btn",type:"button",onClick:L,children:"Save"}),o.jsx("button",{className:"v10-mlv-clear-btn",type:"button",onClick:X,children:"Reset"})]})]}),m&&o.jsxs("form",{className:"v10-cg-query-save-panel",onSubmit:U,children:[o.jsxs("label",{className:"v10-cg-query-save-field",children:[o.jsx("span",{children:"Name"}),o.jsx("input",{type:"text",value:x,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=>E(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"})]})]}),q&&o.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-success)"},children:q}),N&&o.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-danger)"},children:N}),o.jsxs("div",{className:"v10-cg-query-results",children:[P&&o.jsx(on,{compact:!0,tone:"query",icon:"?",title:"Loading query results..."}),B&&o.jsx(on,{compact:!0,tone:"danger",icon:"!",title:"Query could not run.",description:az(B)}),!P&&!B&&I.length===0&&o.jsx(on,{compact:!0,tone:"query",icon:"?",title:"No results for this query.",description:"Adjust the query or run a saved query against this Context Graph."}),!P&&!B&&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:F.map(G=>o.jsx("th",{children:G},G))})}),o.jsx("tbody",{children:I.map((G,O)=>o.jsx("tr",{children:F.map(ne=>{const ue=K4(G[ne]);return o.jsx("td",{className:"v10-mlv-cell",title:ue,children:X4(ue)},ne)})},O))})]})]})]})]})]})}const zS="http://dkg.io/ontology/",iz="http://www.w3.org/ns/prov#";function MS(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 ph(e){const t=MS(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1]:t}function sz(e){const t=MS(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: <${zS}>
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: <${zS}>
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 fh={ual:null,opId:null,owner:null,publishedAt:null,publisherPeerId:null,loading:!1};function cz(e,t,n=!0){const[r,s]=w.useState(()=>({...fh})),c=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){s({...fh});return}const u=++c.current;s(d=>({...d,loading:!0,error:void 0})),(async()=>{var d,f;try{const[h,g]=await Promise.all([ia(oz(e,t),e).catch(()=>null),ia(lz(e,t),e).catch(()=>null)]);if(u!==c.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],x=y?sz(y.op):null,k=y?ph(y.publishedAt):null,j=y!=null&&y.agent?ph(y.agent):null,E=m?ph(m.owner):null;s({ual:x,opId:x?x.slice(x.lastIndexOf(":")+1):null,owner:E,publishedAt:k||null,publisherPeerId:j,loading:!1})}catch(h){if(u!==c.current)return;s({...fh,loading:!1,error:(h==null?void 0:h.message)??String(h)})}})()},[e,t,n]),r}function a1(e,t){if(!e)return null;for(const n of t.values())if(n.peerId&&n.peerId===e)return n.uri;return null}function Fs(e,t=6,n=4){return e?e.length<=t+n+2?e:`${e.slice(0,t)}…${e.slice(-n)}`:""}const Eg="http://dkg.io/ontology/",Bi={status:"idle",ual:null,txHash:null,blockNumber:null,kaId:null,author:null,finalizedAt:null,agent:null};function jn(e){if(e==null)return"";if(typeof e=="string")return e.startsWith('"')?e.replace(/^"/,"").replace(/"(\^\^<[^>]*>|@[\w-]+)?$/,""):e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function fu(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function bi(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}function r1(e){return/[<>"{}|\\^`\s]/.test(e)?"":e}function uz(e,t){const n=`did:dkg:context-graph:${e}/_meta`,r=bi(t);return`PREFIX dkg: <${Eg}>
1330
- PREFIX prov: <http://www.w3.org/ns/prov#>
1331
- SELECT ?asrt ?tx ?block ?kaId ?batchId ?finalizedAt ?ual ?agentLc ?ualSelf ?agentSelf WHERE {
1332
- GRAPH <${n}> {
1333
- ?asrt dkg:publishedAtTx ?tx ;
1334
- dkg:publishedAtBlock ?block .
1335
- FILTER(
1336
- STRSTARTS("${r}", STR(?asrt)) ||
1337
- EXISTS { ?asrt dkg:assertionRootEntity <${t}> } ||
1338
- EXISTS { ?asrt dkg:assertionEntity <${t}> }
1339
- )
1340
- OPTIONAL { ?asrt dkg:publishedAtKaId ?kaId . }
1341
- OPTIONAL { ?asrt dkg:assertionFinalizedAt ?finalizedAt . }
1342
- OPTIONAL {
1343
- ?lc dkg:rootEntity <${t}> ;
1344
- dkg:reservedUal ?ual .
1345
- # Pin the lifecycle URN to the FULL assertion scope (cg + optional
1346
- # subGraphName), not just {addr}:{name} — otherwise a same-named
1347
- # assertion in a sibling sub-graph (urn:dkg:assertion:{cg}:{other}:{addr}:{name})
1348
- # also STRENDS-matches and leaks the wrong reservedUal/agent/batchId.
1349
- # cgId is a build-time constant, so anchor on it as a literal and keep its
1350
- # slashes intact (wallet-scoped cgIds like "<addr>/<name>" embed RAW in the
1351
- # URN via assertionLifecycleUri); only the [/sub]/{addr}/{name} tail derived
1352
- # from ?asrt is "/"->":" converted (sub/addr/name cannot contain "/").
1353
- FILTER(STRENDS(STR(?lc), CONCAT(
1354
- ":${bi(e)}",
1355
- REPLACE(STRBEFORE(STRAFTER(STR(?asrt), "did:dkg:context-graph:${bi(e)}"), "/assertion/"), "/", ":"),
1356
- ":",
1357
- REPLACE(STRAFTER(STR(?asrt), "/assertion/"), "/", ":")
1358
- )))
1359
- OPTIONAL { ?lc prov:wasAttributedTo ?agentLc . }
1360
- }
1361
- OPTIONAL { ?asrt dkg:reservedUal ?ualSelf . }
1362
- OPTIONAL { ?asrt prov:wasAttributedTo ?agentSelf . }
1363
- BIND(IRI(COALESCE(?ualSelf, ?ual)) AS ?ualNode)
1364
- OPTIONAL { ?ualNode dkg:batchId ?batchId . }
1365
- }
1366
- } ORDER BY DESC(STRSTARTS("${r}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function dz(e){const t=e.match(/\/assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function pz(e,t){return`PREFIX dkg: <${Eg}>
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:${bi(e)}/") &&
1377
- CONTAINS(STR(?g), "_shared_memory_meta")
1378
- )
1379
- } ORDER BY DESC(?ts) LIMIT 1`}function fz(e,t,n,r){const s=`did:dkg:context-graph:${e}/_meta`,c=`/assertion/${n}/${r}`,u=bi(t);return`PREFIX dkg: <${Eg}>
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), "${bi(c)}"))
1386
- OPTIONAL { ?asrt dkg:assertionFinalizedAt ?finalizedAt . }
1387
- OPTIONAL {
1388
- ?lc dkg:rootEntity <${t}> ;
1389
- dkg:reservedUal ?ual .
1390
- FILTER(STRENDS(STR(?lc), "${bi(`:${n}:${r}`)}"))
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[r,s]=w.useState(()=>({...Bi})),c=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){s({...Bi});return}const u=++c.current;s({...Bi,status:"loading"}),(async()=>{var d,f,h;try{const g=r1(t);if(!g){s({...Bi,status:"offchain"});return}const m=await ia(uz(e,g),e);if(u!==c.current)return;const y=(((d=m==null?void 0:m.result)==null?void 0:d.bindings)??[])[0];if(y!=null&&y.tx){const _=y.asrt?fu(jn(y.asrt)):"",P=dz(_),B=(P==null?void 0:P.addr)??null,I=(y.agentSelf?fu(jn(y.agentSelf)):"")||(y.agentLc?fu(jn(y.agentLc)):"")||(B?`did:dkg:agent:${B.toLowerCase()}`:null),D=(y.ualSelf?jn(y.ualSelf):"")||(y.ual?jn(y.ual):""),F=(y.kaId?jn(y.kaId):"")||(y.batchId?jn(y.batchId):"");s({status:"verified",ual:D||null,txHash:jn(y.tx)||null,blockNumber:y.block?jn(y.block):null,kaId:F||null,author:B,finalizedAt:y.finalizedAt?jn(y.finalizedAt):null,agent:I});return}const x=await ia(pz(e,g));if(u!==c.current)return;const k=(((f=x==null?void 0:x.result)==null?void 0:f.bindings)??[])[0];if(!k){s({...Bi,status:"offchain"});return}const j=jn(k.source),E=hz(j),S=k.agent?fu(jn(k.agent)):null,T=(E==null?void 0:E.addr)??null;if(!E||!r1(E.addr)||!bi(E.name)){s({...Bi,status:"offchain",author:T,agent:S});return}const N=await ia(fz(e,g,E.addr,E.name),e);if(u!==c.current)return;const A=(((h=N==null?void 0:N.result)==null?void 0:h.bindings)??[])[0],q=A!=null&&A.ual?jn(A.ual):null,R=A!=null&&A.tx?jn(A.tx):null,$=A!=null&&A.block?jn(A.block):null,H=A!=null&&A.kaId?jn(A.kaId):null,z=A!=null&&A.finalizedAt?jn(A.finalizedAt):null;s({status:R?"verified":"offchain",ual:q||null,txHash:R||null,blockNumber:$||null,kaId:H||null,author:T,finalizedAt:z||null,agent:S})}catch(g){if(u!==c.current)return;s({...Bi,status:"error",error:(g==null?void 0:g.message)??String(g)})}})()},[e,t,n]),r}const gz=({contextGraphId:e,entityUri:t,enabled:n})=>{const r=ns(),s=cz(e,t,n),c=mz(e,t,n),{data:u}=Ea(Ym,[],6e4),d=u==null?void 0:u.blockExplorerUrl,f=c.ual??s.ual,h=c.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&&r?a1(s.publisherPeerId,r.agents):null,y=m?(r==null?void 0:r.get(m))??null:null,x=s.owner&&r?a1(s.owner,r.agents):null,k=x?(r==null?void 0:r.get(x))??null:null,j=E=>{var S;(S=navigator.clipboard)==null||S.writeText(E).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&&c.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/${c.txHash}`,target:"_blank",rel:"noopener noreferrer",title:c.txHash,children:[Fs(c.txHash,10,8)," ↗"]}):o.jsx("span",{className:"v10-vm-identity-val mono",title:c.txHash,children:Fs(c.txHash,10,8)}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(c.txHash),title:"Copy transaction hash",children:"⎘"}),c.blockNumber&&o.jsxs("span",{className:"v10-vm-identity-opid mono",children:["· block ",c.blockNumber]})]}),h&&c.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:c.kaId,children:Fs(c.kaId,8,8)}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(c.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(Yi,{agent:k,size:"sm"}),k.walletAddress&&o.jsx("span",{className:"v10-vm-identity-wallet mono",title:k.walletAddress,children:Fs(k.walletAddress,6,4)})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-vm-identity-val mono",title:s.owner??"",children:Fs(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(Yi,{agent:y,size:"sm"}):o.jsx("span",{className:"v10-vm-identity-val mono",title:s.publisherPeerId??"",children:Fs(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 r(d,f){var h;Object.defineProperty(d,"_zod",{value:d._zod??{},enumerable:!1}),(h=d._zod).traits??(h.traits=new Set),d._zod.traits.add(e),t(d,f);for(const g in u.prototype)g in d||Object.defineProperty(d,g,{value:u.prototype[g].bind(d)});d._zod.constr=u,d._zod.def=f}const s=(n==null?void 0:n.Parent)??Object;class c extends s{}Object.defineProperty(c,"name",{value:e});function u(d){var f;const h=n!=null&&n.Parent?new c:this;r(h,d),(f=h._zod).deferred??(f.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(u,"init",{value:r}),Object.defineProperty(u,Symbol.hasInstance,{value:d=>{var f,h;return n!=null&&n.Parent&&d instanceof n.Parent?!0:(h=(f=d==null?void 0:d._zod)==null?void 0:f.traits)==null?void 0:h.has(e)}}),Object.defineProperty(u,"name",{value:e}),u}class _l extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const DS={};function Qi(e){return DS}function $S(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,s])=>t.indexOf(+r)===-1).map(([r,s])=>s)}function yz(e,t){return typeof t=="bigint"?t.toString():t}function IS(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Tg(e){return e==null}function Ag(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,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,c=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(t.toFixed(s).replace(".",""));return c%u/10**s}function Pt(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Rg(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function dl(e){return JSON.stringify(e)}const PS=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function cm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const xz=IS(()=>{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 um(e){if(cm(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(cm(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const wz=new Set(["string","number","symbol"]);function Ed(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function as(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function Ue(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function 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={},r=e._zod.def;for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(n[s]=r.shape[s])}return as(e,{...e._zod.def,shape:n,checks:[]})}function Cz(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete n[s]}return as(e,{...e._zod.def,shape:n,checks:[]})}function Nz(e,t){if(!um(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return Rg(this,"shape",r),r},checks:[]};return as(e,n)}function Ez(e,t){return as(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Rg(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function Tz(e,t,n){const r=t._zod.def.shape,s={...r};if(n)for(const c in n){if(!(c in r))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(s[c]=e?new e({type:"optional",innerType:r[c]}):r[c])}else for(const c in r)s[c]=e?new e({type:"optional",innerType:r[c]}):r[c];return as(t,{...t._zod.def,shape:s,checks:[]})}function Az(e,t,n){const r=t._zod.def.shape,s={...r};if(n)for(const c in n){if(!(c in s))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(s[c]=new e({type:"nonoptional",innerType:r[c]}))}else for(const c in r)s[c]=new e({type:"nonoptional",innerType:r[c]});return as(t,{...t._zod.def,shape:s,checks:[]})}function Sl(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function _g(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function hu(e){return typeof e=="string"?e:e==null?void 0:e.message}function Ki(e,t,n){var s,c,u,d,f,h;const r={...e,path:e.path??[]};if(!e.message){const g=hu((u=(c=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:c.error)==null?void 0:u.call(c,e))??hu((d=t==null?void 0:t.error)==null?void 0:d.call(t,e))??hu((f=n.customError)==null?void 0:f.call(n,e))??hu((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";r.message=g}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Og(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ol(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const US=(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})},BS=ve("$ZodError",US),FS=ve("$ZodError",US,{Parent:Error});function Rz(e,t=n=>n.message){const n={},r=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}function _z(e,t){const n=t||function(c){return c.message},r={_errors:[]},s=c=>{for(const u of c.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>s({issues:d}));else if(u.code==="invalid_key")s({issues:u.issues});else if(u.code==="invalid_element")s({issues:u.issues});else if(u.path.length===0)r._errors.push(n(u));else{let d=r,f=0;for(;f<u.path.length;){const h=u.path[f];f===u.path.length-1?(d[h]=d[h]||{_errors:[]},d[h]._errors.push(n(u))):d[h]=d[h]||{_errors:[]},d=d[h],f++}}};return s(e),r}const Oz=e=>(t,n,r,s)=>{const c=r?Object.assign(r,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},c);if(u instanceof Promise)throw new _l;if(u.issues.length){const d=new((s==null?void 0:s.Err)??e)(u.issues.map(f=>Ki(f,c,Qi())));throw PS(d,s==null?void 0:s.callee),d}return u.value},Lz=e=>async(t,n,r,s)=>{const c=r?Object.assign(r,{async:!0}):{async:!0};let u=t._zod.run({value:n,issues:[]},c);if(u instanceof Promise&&(u=await u),u.issues.length){const d=new((s==null?void 0:s.Err)??e)(u.issues.map(f=>Ki(f,c,Qi())));throw PS(d,s==null?void 0:s.callee),d}return u.value},HS=e=>(t,n,r)=>{const s=r?{...r,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new _l;return c.issues.length?{success:!1,error:new(e??BS)(c.issues.map(u=>Ki(u,s,Qi())))}:{success:!0,data:c.value}},zz=HS(FS),qS=e=>async(t,n,r)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},s);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(u=>Ki(u,s,Qi())))}:{success:!0,data:c.value}},Mz=qS(FS),Dz=/^[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})$/,i1=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})$/,Yz=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Qz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Kz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,GS=/^[A-Za-z0-9_-]*$/,Xz=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Jz=/^\+(?:[0-9]){6,14}[0-9]$/,VS="(?:(?:\\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])))",eM=new RegExp(`^${VS}$`);function WS(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 tM(e){return new RegExp(`^${WS(e)}$`)}function nM(e){const t=WS({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${VS}T(?:${r})$`)}const aM=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}$`)},rM=/^\d+$/,iM=/^-?\d+(?:\.\d+)?/i,sM=/^[^A-Z]*$/,oM=/^[^a-z]*$/,Gn=ve("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ZS={number:"number",bigint:"bigint",object:"date"},YS=ve("$ZodCheckLessThan",(e,t)=>{Gn.init(e,t);const n=ZS[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,c=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<c&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),QS=ve("$ZodCheckGreaterThan",(e,t)=>{Gn.init(e,t);const n=ZS[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,c=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>c&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lM=ve("$ZodCheckMultipleOf",(e,t)=>{Gn.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):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})}}),cM=ve("$ZodCheckNumberFormat",(e,t)=>{var u;Gn.init(e,t),t.format=t.format||"float64";const n=(u=t.format)==null?void 0:u.includes("int"),r=n?"int":"number",[s,c]=Sz[t.format];e._zod.onattach.push(d=>{const f=d._zod.bag;f.format=t.format,f.minimum=s,f.maximum=c,n&&(f.pattern=rM)}),e._zod.check=d=>{const f=d.value;if(n){if(!Number.isInteger(f)){d.issues.push({expected:r,format:t.format,code:"invalid_type",input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?d.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):d.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}f<s&&d.issues.push({origin:"number",input:f,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),f>c&&d.issues.push({origin:"number",input:f,code:"too_big",maximum:c,inst:e})}}),uM=ve("$ZodCheckMaxLength",(e,t)=>{var n;Gn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Tg(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const s=r.value;if(s.length<=t.maximum)return;const u=Og(s);r.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),dM=ve("$ZodCheckMinLength",(e,t)=>{var n;Gn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Tg(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const s=r.value;if(s.length>=t.minimum)return;const u=Og(s);r.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),pM=ve("$ZodCheckLengthEquals",(e,t)=>{var n;Gn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Tg(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=r=>{const s=r.value,c=s.length;if(c===t.length)return;const u=Og(s),d=c>t.length;r.issues.push({origin:u,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Td=ve("$ZodCheckStringFormat",(e,t)=>{var n,r;Gn.init(e,t),e._zod.onattach.push(s=>{const c=s._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),fM=ve("$ZodCheckRegex",(e,t)=>{Td.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})}}),hM=ve("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=sM),Td.init(e,t)}),mM=ve("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=oM),Td.init(e,t)}),gM=ve("$ZodCheckIncludes",(e,t)=>{Gn.init(e,t);const n=Ed(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(s=>{const c=s._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(r)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),vM=ve("$ZodCheckStartsWith",(e,t)=>{Gn.init(e,t);const n=new RegExp(`^${Ed(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),yM=ve("$ZodCheckEndsWith",(e,t)=>{Gn.init(e,t);const n=new RegExp(`.*${Ed(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),bM=ve("$ZodCheckOverwrite",(e,t)=>{Gn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class xM{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
1394
- `).filter(u=>u),s=Math.min(...r.map(u=>u.length-u.trimStart().length)),c=r.map(u=>u.slice(s)).map(u=>" ".repeat(this.indent*2)+u);for(const u of c)this.content.push(u)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(c=>` ${c}`)];return new t(...n,s.join(`
1395
- `))}}const wM={major:4,minor:0,patch:0},Jt=ve("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wM;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const c of r)for(const u of c._zod.onattach)u(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const c=(u,d,f)=>{let h=Sl(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,x=m._zod.check(u);if(x instanceof Promise&&(f==null?void 0:f.async)===!1)throw new _l;if(g||x instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await x,u.issues.length!==y&&(h||(h=Sl(u,y)))});else{if(u.issues.length===y)continue;h||(h=Sl(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 _l;return f.then(h=>c(h,r,d))}return c(f,r,d)}}e["~standard"]={validate:c=>{var u;try{const d=zz(e,c);return d.success?{value:d.data}:{issues:(u=d.error)==null?void 0:u.issues}}catch{return Mz(e,c).then(f=>{var h;return f.success?{value:f.data}:{issues:(h=f.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}}),Lg=ve("$ZodString",(e,t)=>{var n;Jt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??aM(e._zod.bag),e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Bt=ve("$ZodStringFormat",(e,t)=>{Td.init(e,t),Lg.init(e,t)}),kM=ve("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Hz),Bt.init(e,t)}),SM=ve("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=i1(r))}else t.pattern??(t.pattern=i1());Bt.init(e,t)}),jM=ve("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=qz),Bt.init(e,t)}),CM=ve("$ZodURL",(e,t)=>{Bt.init(e,t),e._zod.check=n=>{try{const r=n.value,s=new URL(r),c=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})),!r.endsWith("/")&&c.endsWith("/")?n.value=c.slice(0,-1):n.value=c;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),NM=ve("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Vz()),Bt.init(e,t)}),EM=ve("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Bz),Bt.init(e,t)}),TM=ve("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Dz),Bt.init(e,t)}),AM=ve("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=$z),Bt.init(e,t)}),RM=ve("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Iz),Bt.init(e,t)}),_M=ve("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Pz),Bt.init(e,t)}),OM=ve("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Uz),Bt.init(e,t)}),LM=ve("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=nM(t)),Bt.init(e,t)}),zM=ve("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=eM),Bt.init(e,t)}),MM=ve("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=tM(t)),Bt.init(e,t)}),DM=ve("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Fz),Bt.init(e,t)}),$M=ve("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Wz),Bt.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),IM=ve("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Zz),Bt.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),PM=ve("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Yz),Bt.init(e,t)}),UM=ve("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Qz),Bt.init(e,t),e._zod.check=n=>{const[r,s]=n.value.split("/");try{if(!s)throw new Error;const c=Number(s);if(`${c}`!==s)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function KS(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const BM=ve("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Kz),Bt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{KS(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function FM(e){if(!GS.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return KS(n)}const HM=ve("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=GS),Bt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{FM(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),qM=ve("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Jz),Bt.init(e,t)});function GM(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const VM=ve("$ZodJWT",(e,t)=>{Bt.init(e,t),e._zod.check=n=>{GM(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),XS=ve("$ZodNumber",(e,t)=>{Jt.init(e,t),e._zod.pattern=e._zod.bag.pattern??iM,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const c=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,...c?{received:c}:{}}),n}}),WM=ve("$ZodNumber",(e,t)=>{cM.init(e,t),XS.init(e,t)}),ZM=ve("$ZodUnknown",(e,t)=>{Jt.init(e,t),e._zod.parse=n=>n}),YM=ve("$ZodNever",(e,t)=>{Jt.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function s1(e,t,n){e.issues.length&&t.issues.push(..._g(n,e.issues)),t.value[n]=e.value}const QM=ve("$ZodArray",(e,t)=>{Jt.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const c=[];for(let u=0;u<s.length;u++){const d=s[u],f=t.element._zod.run({value:d,issues:[]},r);f instanceof Promise?c.push(f.then(h=>s1(h,n,u))):s1(f,n,u)}return c.length?Promise.all(c).then(()=>n):n}});function mu(e,t,n){e.issues.length&&t.issues.push(..._g(n,e.issues)),t.value[n]=e.value}function o1(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(..._g(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const KM=ve("$ZodObject",(e,t)=>{Jt.init(e,t);const n=IS(()=>{const m=Object.keys(t.shape);for(const x of m)if(!(t.shape[x]instanceof Jt))throw new Error(`Invalid element at key "${x}": 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)}});Pt(e._zod,"propValues",()=>{const m=t.shape,y={};for(const x in m){const k=m[x]._zod;if(k.values){y[x]??(y[x]=new Set);for(const j of k.values)y[x].add(j)}}return y});const r=m=>{const y=new xM(["shape","payload","ctx"]),x=n.value,k=T=>{const N=dl(T);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};y.write("const input = payload.value;");const j=Object.create(null);let E=0;for(const T of x.keys)j[T]=`key_${E++}`;y.write("const newResult = {}");for(const T of x.keys)if(x.optionalKeys.has(T)){const N=j[T];y.write(`const ${N} = ${k(T)};`);const A=dl(T);y.write(`
1396
- if (${N}.issues.length) {
1397
- if (input[${A}] === undefined) {
1398
- if (${A} in input) {
1399
- newResult[${A}] = undefined;
1400
- }
1401
- } else {
1402
- payload.issues = payload.issues.concat(
1403
- ${N}.issues.map((iss) => ({
1404
- ...iss,
1405
- path: iss.path ? [${A}, ...iss.path] : [${A}],
1406
- }))
1407
- );
1408
- }
1409
- } else if (${N}.value === undefined) {
1410
- if (${A} in input) newResult[${A}] = undefined;
1411
- } else {
1412
- newResult[${A}] = ${N}.value;
1413
- }
1414
- `)}else{const N=j[T];y.write(`const ${N} = ${k(T)};`),y.write(`
1415
- if (${N}.issues.length) payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
1416
- ...iss,
1417
- path: iss.path ? [${dl(T)}, ...iss.path] : [${dl(T)}]
1418
- })));`),y.write(`newResult[${dl(T)}] = ${N}.value`)}y.write("payload.value = newResult;"),y.write("return payload;");const S=y.compile();return(T,N)=>S(m,T,N)};let s;const c=cm,u=!DS.jitless,f=u&&xz.value,h=t.catchall;let g;e._zod.parse=(m,y)=>{g??(g=n.value);const x=m.value;if(!c(x))return m.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),m;const k=[];if(u&&f&&(y==null?void 0:y.async)===!1&&y.jitless!==!0)s||(s=r(t.shape)),m=s(m,y);else{m.value={};const N=g.shape;for(const A of g.keys){const q=N[A],R=q._zod.run({value:x[A],issues:[]},y),$=q._zod.optin==="optional"&&q._zod.optout==="optional";R instanceof Promise?k.push(R.then(H=>$?o1(H,m,A,x):mu(H,m,A))):$?o1(R,m,A,x):mu(R,m,A)}}if(!h)return k.length?Promise.all(k).then(()=>m):m;const j=[],E=g.keySet,S=h._zod,T=S.def.type;for(const N of Object.keys(x)){if(E.has(N))continue;if(T==="never"){j.push(N);continue}const A=S.run({value:x[N],issues:[]},y);A instanceof Promise?k.push(A.then(q=>mu(q,m,N))):mu(A,m,N)}return j.length&&m.issues.push({code:"unrecognized_keys",keys:j,input:x,inst:e}),k.length?Promise.all(k).then(()=>m):m}});function l1(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(c=>Ki(c,r,Qi())))}),t}const XM=ve("$ZodUnion",(e,t)=>{Jt.init(e,t),Pt(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Pt(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Pt(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Pt(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>Ag(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let s=!1;const c=[];for(const u of t.options){const d=u._zod.run({value:n.value,issues:[]},r);if(d instanceof Promise)c.push(d),s=!0;else{if(d.issues.length===0)return d;c.push(d)}}return s?Promise.all(c).then(u=>l1(u,n,e,r)):l1(c,n,e,r)}}),JM=ve("$ZodIntersection",(e,t)=>{Jt.init(e,t),e._zod.parse=(n,r)=>{const s=n.value,c=t.left._zod.run({value:s,issues:[]},r),u=t.right._zod.run({value:s,issues:[]},r);return c instanceof Promise||u instanceof Promise?Promise.all([c,u]).then(([f,h])=>c1(n,f,h)):c1(n,c,u)}});function dm(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(um(e)&&um(t)){const n=Object.keys(t),r=Object.keys(e).filter(c=>n.indexOf(c)!==-1),s={...e,...t};for(const c of r){const u=dm(e[c],t[c]);if(!u.valid)return{valid:!1,mergeErrorPath:[c,...u.mergeErrorPath]};s[c]=u.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const s=e[r],c=t[r],u=dm(s,c);if(!u.valid)return{valid:!1,mergeErrorPath:[r,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function c1(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Sl(e))return e;const r=dm(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const eD=ve("$ZodEnum",(e,t)=>{Jt.init(e,t);const n=$S(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>wz.has(typeof r)).map(r=>typeof r=="string"?Ed(r):r.toString()).join("|")})$`),e._zod.parse=(r,s)=>{const c=r.value;return e._zod.values.has(c)||r.issues.push({code:"invalid_value",values:n,input:c,inst:e}),r}}),tD=ve("$ZodTransform",(e,t)=>{Jt.init(e,t),e._zod.parse=(n,r)=>{const s=t.transform(n.value,n);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(u=>(n.value=u,n));if(s instanceof Promise)throw new _l;return n.value=s,n}}),nD=ve("$ZodOptional",(e,t)=>{Jt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Pt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Pt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ag(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),aD=ve("$ZodNullable",(e,t)=>{Jt.init(e,t),Pt(e._zod,"optin",()=>t.innerType._zod.optin),Pt(e._zod,"optout",()=>t.innerType._zod.optout),Pt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ag(n.source)}|null)$`):void 0}),Pt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),rD=ve("$ZodDefault",(e,t)=>{Jt.init(e,t),e._zod.optin="optional",Pt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(c=>u1(c,t)):u1(s,t)}});function u1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const iD=ve("$ZodPrefault",(e,t)=>{Jt.init(e,t),e._zod.optin="optional",Pt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),sD=ve("$ZodNonOptional",(e,t)=>{Jt.init(e,t),Pt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(c=>d1(c,e)):d1(s,e)}});function d1(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 oD=ve("$ZodCatch",(e,t)=>{Jt.init(e,t),e._zod.optin="optional",Pt(e._zod,"optout",()=>t.innerType._zod.optout),Pt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(c=>(n.value=c.value,c.issues.length&&(n.value=t.catchValue({...n,error:{issues:c.issues.map(u=>Ki(u,r,Qi()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(c=>Ki(c,r,Qi()))},input:n.value}),n.issues=[]),n)}}),lD=ve("$ZodPipe",(e,t)=>{Jt.init(e,t),Pt(e._zod,"values",()=>t.in._zod.values),Pt(e._zod,"optin",()=>t.in._zod.optin),Pt(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const s=t.in._zod.run(n,r);return s instanceof Promise?s.then(c=>p1(c,t,r)):p1(s,t,r)}});function p1(e,t,n){return Sl(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const cD=ve("$ZodReadonly",(e,t)=>{Jt.init(e,t),Pt(e._zod,"propValues",()=>t.innerType._zod.propValues),Pt(e._zod,"values",()=>t.innerType._zod.values),Pt(e._zod,"optin",()=>t.innerType._zod.optin),Pt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(f1):f1(s)}});function f1(e){return e.value=Object.freeze(e.value),e}const uD=ve("$ZodCustom",(e,t)=>{Gn.init(e,t),Jt.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,s=t.fn(r);if(s instanceof Promise)return s.then(c=>h1(c,n,r,e));h1(s,n,r,e)}});function h1(e,t,n,r){if(!e){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),t.issues.push(Ol(s))}}class JS{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function ej(){return new JS}const wl=ej();function dD(e,t){return new e({type:"string",...Ue(t)})}function pD(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ue(t)})}function m1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ue(t)})}function fD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ue(t)})}function hD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ue(t)})}function mD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ue(t)})}function gD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ue(t)})}function vD(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ue(t)})}function yD(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ue(t)})}function bD(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ue(t)})}function xD(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ue(t)})}function wD(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ue(t)})}function kD(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ue(t)})}function SD(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ue(t)})}function jD(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ue(t)})}function CD(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ue(t)})}function ND(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ue(t)})}function ED(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ue(t)})}function TD(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ue(t)})}function AD(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ue(t)})}function RD(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ue(t)})}function _D(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ue(t)})}function OD(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ue(t)})}function LD(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ue(t)})}function zD(e,t){return new e({type:"string",format:"date",check:"string_format",...Ue(t)})}function MD(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ue(t)})}function DD(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ue(t)})}function $D(e,t){return new e({type:"number",checks:[],...Ue(t)})}function ID(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ue(t)})}function PD(e){return new e({type:"unknown"})}function UD(e,t){return new e({type:"never",...Ue(t)})}function g1(e,t){return new YS({check:"less_than",...Ue(t),value:e,inclusive:!1})}function hh(e,t){return new YS({check:"less_than",...Ue(t),value:e,inclusive:!0})}function v1(e,t){return new QS({check:"greater_than",...Ue(t),value:e,inclusive:!1})}function mh(e,t){return new QS({check:"greater_than",...Ue(t),value:e,inclusive:!0})}function y1(e,t){return new lM({check:"multiple_of",...Ue(t),value:e})}function tj(e,t){return new uM({check:"max_length",...Ue(t),maximum:e})}function ed(e,t){return new dM({check:"min_length",...Ue(t),minimum:e})}function nj(e,t){return new pM({check:"length_equals",...Ue(t),length:e})}function BD(e,t){return new fM({check:"string_format",format:"regex",...Ue(t),pattern:e})}function FD(e){return new hM({check:"string_format",format:"lowercase",...Ue(e)})}function HD(e){return new mM({check:"string_format",format:"uppercase",...Ue(e)})}function qD(e,t){return new gM({check:"string_format",format:"includes",...Ue(t),includes:e})}function GD(e,t){return new vM({check:"string_format",format:"starts_with",...Ue(t),prefix:e})}function VD(e,t){return new yM({check:"string_format",format:"ends_with",...Ue(t),suffix:e})}function Hl(e){return new bM({check:"overwrite",tx:e})}function WD(e){return Hl(t=>t.normalize(e))}function ZD(){return Hl(e=>e.trim())}function YD(){return Hl(e=>e.toLowerCase())}function QD(){return Hl(e=>e.toUpperCase())}function KD(e,t,n){return new e({type:"array",element:t,...Ue(n)})}function XD(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ue(n)})}class b1{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??wl,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,x;var r;const s=t._zod.def,c={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 E=d.schema;switch(s.type){case"string":{const S=E;S.type="string";const{minimum:T,maximum:N,format:A,patterns:q,contentEncoding:R}=t._zod.bag;if(typeof T=="number"&&(S.minLength=T),typeof N=="number"&&(S.maxLength=N),A&&(S.format=c[A]??A,S.format===""&&delete S.format),R&&(S.contentEncoding=R),q&&q.size>0){const $=[...q];$.length===1?S.pattern=$[0].source:$.length>1&&(d.schema.allOf=[...$.map(H=>({...this.target==="draft-7"?{type:"string"}:{},pattern:H.source}))])}break}case"number":{const S=E,{minimum:T,maximum:N,format:A,multipleOf:q,exclusiveMaximum:R,exclusiveMinimum:$}=t._zod.bag;typeof A=="string"&&A.includes("int")?S.type="integer":S.type="number",typeof $=="number"&&(S.exclusiveMinimum=$),typeof T=="number"&&(S.minimum=T,typeof $=="number"&&($>=T?delete S.minimum:delete S.exclusiveMinimum)),typeof R=="number"&&(S.exclusiveMaximum=R),typeof N=="number"&&(S.maximum=N,typeof R=="number"&&(R<=N?delete S.maximum:delete S.exclusiveMaximum)),typeof q=="number"&&(S.multipleOf=q);break}case"boolean":{const S=E;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":{E.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":{E.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const S=E,{minimum:T,maximum:N}=t._zod.bag;typeof T=="number"&&(S.minItems=T),typeof N=="number"&&(S.maxItems=N),S.type="array",S.items=this.process(s.element,{...k,path:[...k.path,"items"]});break}case"object":{const S=E;S.type="object",S.properties={};const T=s.shape;for(const q in T)S.properties[q]=this.process(T[q],{...k,path:[...k.path,"properties",q]});const N=new Set(Object.keys(T)),A=new Set([...N].filter(q=>{const R=s.shape[q]._zod;return this.io==="input"?R.optin===void 0:R.optout===void 0}));A.size>0&&(S.required=Array.from(A)),((x=s.catchall)==null?void 0:x._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=E;S.anyOf=s.options.map((T,N)=>this.process(T,{...k,path:[...k.path,"anyOf",N]}));break}case"intersection":{const S=E,T=this.process(s.left,{...k,path:[...k.path,"allOf",0]}),N=this.process(s.right,{...k,path:[...k.path,"allOf",1]}),A=R=>"allOf"in R&&Object.keys(R).length===1,q=[...A(T)?T.allOf:[T],...A(N)?N.allOf:[N]];S.allOf=q;break}case"tuple":{const S=E;S.type="array";const T=s.items.map((q,R)=>this.process(q,{...k,path:[...k.path,"prefixItems",R]}));if(this.target==="draft-2020-12"?S.prefixItems=T:S.items=T,s.rest){const q=this.process(s.rest,{...k,path:[...k.path,"items"]});this.target==="draft-2020-12"?S.items=q:S.additionalItems=q}s.rest&&(S.items=this.process(s.rest,{...k,path:[...k.path,"items"]}));const{minimum:N,maximum:A}=t._zod.bag;typeof N=="number"&&(S.minItems=N),typeof A=="number"&&(S.maxItems=A);break}case"record":{const S=E;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=E,T=$S(s.entries);T.every(N=>typeof N=="number")&&(S.type="number"),T.every(N=>typeof N=="string")&&(S.type="string"),S.enum=T;break}case"literal":{const S=E,T=[];for(const N of s.values)if(N===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof N=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");T.push(Number(N))}else T.push(N);if(T.length!==0)if(T.length===1){const N=T[0];S.type=N===null?"null":typeof N,S.const=N}else T.every(N=>typeof N=="number")&&(S.type="number"),T.every(N=>typeof N=="string")&&(S.type="string"),T.every(N=>typeof N=="boolean")&&(S.type="string"),T.every(N=>N===null)&&(S.type="null"),S.enum=T;break}case"file":{const S=E,T={type:"string",format:"binary",contentEncoding:"binary"},{minimum:N,maximum:A,mime:q}=t._zod.bag;N!==void 0&&(T.minLength=N),A!==void 0&&(T.maxLength=A),q?q.length===1?(T.contentMediaType=q[0],Object.assign(S,T)):S.anyOf=q.map(R=>({...T,contentMediaType:R})):Object.assign(S,T);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const S=this.process(s.innerType,k);E.anyOf=[S,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,k),d.ref=s.innerType;break}case"success":{const S=E;S.type="boolean";break}case"default":{this.process(s.innerType,k),d.ref=s.innerType,E.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,k),d.ref=s.innerType,this.io==="input"&&(E._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")}E.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=E,T=t._zod.pattern;if(!T)throw new Error("Pattern not found in template literal");S.type="string",S.pattern=T.source;break}case"pipe":{const S=this.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;this.process(S,k),d.ref=S;break}case"readonly":{this.process(s.innerType,k),d.ref=s.innerType,E.readOnly=!0;break}case"promise":{this.process(s.innerType,k),d.ref=s.innerType;break}case"optional":{this.process(s.innerType,k),d.ref=s.innerType;break}case"lazy":{const S=t._zod.innerType;this.process(S,k),d.ref=S;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const h=this.metadataRegistry.get(t);return h&&Object.assign(d.schema,h),this.io==="input"&&dn(t)&&(delete d.schema.examples,delete d.schema.default),this.io==="input"&&d.schema._prefault&&((r=d.schema).default??(r.default=d.schema._prefault)),delete d.schema._prefault,this.seen.get(t).schema}emit(t,n){var g,m,y,x,k,j;const r={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},s=this.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=E=>{var q;const S=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const R=(q=r.external.registry.get(E[0]))==null?void 0:q.id,$=r.external.uri??(z=>z);if(R)return{ref:$(R)};const H=E[1].defId??E[1].schema.id??`schema${this.counter++}`;return E[1].defId=H,{defId:H,ref:`${$("__shared")}#/${S}/${H}`}}if(E[1]===s)return{ref:"#"};const N=`#/${S}/`,A=E[1].schema.id??`__schema${this.counter++}`;return{defId:A,ref:N+A}},u=E=>{if(E[1].schema.$ref)return;const S=E[1],{ref:T,defId:N}=c(E);S.def={...S.schema},N&&(S.defId=N);const A=S.schema;for(const q in A)delete A[q];A.$ref=T};if(r.cycles==="throw")for(const E of this.seen.entries()){const S=E[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 E of this.seen.entries()){const S=E[1];if(t===E[0]){u(E);continue}if(r.external){const N=(m=r.external.registry.get(E[0]))==null?void 0:m.id;if(t!==E[0]&&N){u(E);continue}}if((y=this.metadataRegistry.get(E[0]))==null?void 0:y.id){u(E);continue}if(S.cycle){u(E);continue}if(S.count>1&&r.reused==="ref"){u(E);continue}}const d=(E,S)=>{const T=this.seen.get(E),N=T.def??T.schema,A={...N};if(T.ref===null)return;const q=T.ref;if(T.ref=null,q){d(q,S);const R=this.seen.get(q).schema;R.$ref&&S.target==="draft-7"?(N.allOf=N.allOf??[],N.allOf.push(R)):(Object.assign(N,R),Object.assign(N,A))}T.isParent||this.override({zodSchema:E,jsonSchema:N,path:T.path??[]})};for(const E of[...this.seen.entries()].reverse())d(E[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}`),(x=r.external)!=null&&x.uri){const E=(k=r.external.registry.get(t))==null?void 0:k.id;if(!E)throw new Error("Schema is missing an `id` property");f.$id=r.external.uri(E)}Object.assign(f,s.def);const h=((j=r.external)==null?void 0:j.defs)??{};for(const E of this.seen.entries()){const S=E[1];S.def&&S.defId&&(h[S.defId]=S.def)}r.external||Object.keys(h).length>0&&(this.target==="draft-2020-12"?f.$defs=h:f.definitions=h);try{return JSON.parse(JSON.stringify(f))}catch{throw new Error("Error converting schema to JSON.")}}}function JD(e,t){if(e instanceof JS){const r=new b1(t),s={};for(const d of e._idmap.entries()){const[f,h]=d;r.process(h)}const c={},u={registry:e,uri:t==null?void 0:t.uri,defs:s};for(const d of e._idmap.entries()){const[f,h]=d;c[f]=r.emit(h,{...t,external:u})}if(Object.keys(s).length>0){const d=r.target==="draft-2020-12"?"$defs":"definitions";c.__shared={[d]:s}}return{schemas:c}}const n=new b1(t);return n.process(e),n.emit(e,t)}function dn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;switch(s.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return dn(s.element,n);case"object":{for(const c in s.shape)if(dn(s.shape[c],n))return!0;return!1}case"union":{for(const c of s.options)if(dn(c,n))return!0;return!1}case"intersection":return dn(s.left,n)||dn(s.right,n);case"tuple":{for(const c of s.items)if(dn(c,n))return!0;return!!(s.rest&&dn(s.rest,n))}case"record":return dn(s.keyType,n)||dn(s.valueType,n);case"map":return dn(s.keyType,n)||dn(s.valueType,n);case"set":return dn(s.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return dn(s.innerType,n);case"lazy":return dn(s.getter(),n);case"default":return dn(s.innerType,n);case"prefault":return dn(s.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return dn(s.in,n)||dn(s.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${s.type}`)}const e$=ve("ZodISODateTime",(e,t)=>{LM.init(e,t),Vt.init(e,t)});function t$(e){return LD(e$,e)}const n$=ve("ZodISODate",(e,t)=>{zM.init(e,t),Vt.init(e,t)});function a$(e){return zD(n$,e)}const r$=ve("ZodISOTime",(e,t)=>{MM.init(e,t),Vt.init(e,t)});function i$(e){return MD(r$,e)}const s$=ve("ZodISODuration",(e,t)=>{DM.init(e,t),Vt.init(e,t)});function o$(e){return DD(s$,e)}const l$=(e,t)=>{BS.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>_z(e,n)},flatten:{value:n=>Rz(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Ad=ve("ZodError",l$,{Parent:Error}),c$=Oz(Ad),u$=Lz(Ad),d$=HS(Ad),p$=qS(Ad),fn=ve("ZodType",(e,t)=>(Jt.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>as(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>c$(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>d$(e,n,r),e.parseAsync=async(n,r)=>u$(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>p$(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(t3(n,r)),e.superRefine=n=>e.check(n3(n)),e.overwrite=n=>e.check(Hl(n)),e.optional=()=>S1(e),e.nullable=()=>j1(e),e.nullish=()=>S1(j1(e)),e.nonoptional=n=>W$(e,n),e.array=()=>Dr(e),e.or=n=>zg([e,n]),e.and=n=>P$(e,n),e.transform=n=>C1(e,B$(n)),e.default=n=>q$(e,n),e.prefault=n=>V$(e,n),e.catch=n=>Y$(e,n),e.pipe=n=>C1(e,n),e.readonly=()=>X$(e),e.describe=n=>{const r=e.clone();return wl.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=wl.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return wl.get(e);const r=e.clone();return wl.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),aj=ve("_ZodString",(e,t)=>{Lg.init(e,t),fn.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(BD(...r)),e.includes=(...r)=>e.check(qD(...r)),e.startsWith=(...r)=>e.check(GD(...r)),e.endsWith=(...r)=>e.check(VD(...r)),e.min=(...r)=>e.check(ed(...r)),e.max=(...r)=>e.check(tj(...r)),e.length=(...r)=>e.check(nj(...r)),e.nonempty=(...r)=>e.check(ed(1,...r)),e.lowercase=r=>e.check(FD(r)),e.uppercase=r=>e.check(HD(r)),e.trim=()=>e.check(ZD()),e.normalize=(...r)=>e.check(WD(...r)),e.toLowerCase=()=>e.check(YD()),e.toUpperCase=()=>e.check(QD())}),f$=ve("ZodString",(e,t)=>{Lg.init(e,t),aj.init(e,t),e.email=n=>e.check(pD(h$,n)),e.url=n=>e.check(vD(m$,n)),e.jwt=n=>e.check(OD(R$,n)),e.emoji=n=>e.check(yD(g$,n)),e.guid=n=>e.check(m1(x1,n)),e.uuid=n=>e.check(fD(gu,n)),e.uuidv4=n=>e.check(hD(gu,n)),e.uuidv6=n=>e.check(mD(gu,n)),e.uuidv7=n=>e.check(gD(gu,n)),e.nanoid=n=>e.check(bD(v$,n)),e.guid=n=>e.check(m1(x1,n)),e.cuid=n=>e.check(xD(y$,n)),e.cuid2=n=>e.check(wD(b$,n)),e.ulid=n=>e.check(kD(x$,n)),e.base64=n=>e.check(AD(E$,n)),e.base64url=n=>e.check(RD(T$,n)),e.xid=n=>e.check(SD(w$,n)),e.ksuid=n=>e.check(jD(k$,n)),e.ipv4=n=>e.check(CD(S$,n)),e.ipv6=n=>e.check(ND(j$,n)),e.cidrv4=n=>e.check(ED(C$,n)),e.cidrv6=n=>e.check(TD(N$,n)),e.e164=n=>e.check(_D(A$,n)),e.datetime=n=>e.check(t$(n)),e.date=n=>e.check(a$(n)),e.time=n=>e.check(i$(n)),e.duration=n=>e.check(o$(n))});function $e(e){return dD(f$,e)}const Vt=ve("ZodStringFormat",(e,t)=>{Bt.init(e,t),aj.init(e,t)}),h$=ve("ZodEmail",(e,t)=>{jM.init(e,t),Vt.init(e,t)}),x1=ve("ZodGUID",(e,t)=>{kM.init(e,t),Vt.init(e,t)}),gu=ve("ZodUUID",(e,t)=>{SM.init(e,t),Vt.init(e,t)}),m$=ve("ZodURL",(e,t)=>{CM.init(e,t),Vt.init(e,t)}),g$=ve("ZodEmoji",(e,t)=>{NM.init(e,t),Vt.init(e,t)}),v$=ve("ZodNanoID",(e,t)=>{EM.init(e,t),Vt.init(e,t)}),y$=ve("ZodCUID",(e,t)=>{TM.init(e,t),Vt.init(e,t)}),b$=ve("ZodCUID2",(e,t)=>{AM.init(e,t),Vt.init(e,t)}),x$=ve("ZodULID",(e,t)=>{RM.init(e,t),Vt.init(e,t)}),w$=ve("ZodXID",(e,t)=>{_M.init(e,t),Vt.init(e,t)}),k$=ve("ZodKSUID",(e,t)=>{OM.init(e,t),Vt.init(e,t)}),S$=ve("ZodIPv4",(e,t)=>{$M.init(e,t),Vt.init(e,t)}),j$=ve("ZodIPv6",(e,t)=>{IM.init(e,t),Vt.init(e,t)}),C$=ve("ZodCIDRv4",(e,t)=>{PM.init(e,t),Vt.init(e,t)}),N$=ve("ZodCIDRv6",(e,t)=>{UM.init(e,t),Vt.init(e,t)}),E$=ve("ZodBase64",(e,t)=>{BM.init(e,t),Vt.init(e,t)}),T$=ve("ZodBase64URL",(e,t)=>{HM.init(e,t),Vt.init(e,t)}),A$=ve("ZodE164",(e,t)=>{qM.init(e,t),Vt.init(e,t)}),R$=ve("ZodJWT",(e,t)=>{VM.init(e,t),Vt.init(e,t)}),rj=ve("ZodNumber",(e,t)=>{XS.init(e,t),fn.init(e,t),e.gt=(r,s)=>e.check(v1(r,s)),e.gte=(r,s)=>e.check(mh(r,s)),e.min=(r,s)=>e.check(mh(r,s)),e.lt=(r,s)=>e.check(g1(r,s)),e.lte=(r,s)=>e.check(hh(r,s)),e.max=(r,s)=>e.check(hh(r,s)),e.int=r=>e.check(w1(r)),e.safe=r=>e.check(w1(r)),e.positive=r=>e.check(v1(0,r)),e.nonnegative=r=>e.check(mh(0,r)),e.negative=r=>e.check(g1(0,r)),e.nonpositive=r=>e.check(hh(0,r)),e.multipleOf=(r,s)=>e.check(y1(r,s)),e.step=(r,s)=>e.check(y1(r,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ar(e){return $D(rj,e)}const _$=ve("ZodNumberFormat",(e,t)=>{WM.init(e,t),rj.init(e,t)});function w1(e){return ID(_$,e)}const O$=ve("ZodUnknown",(e,t)=>{ZM.init(e,t),fn.init(e,t)});function k1(){return PD(O$)}const L$=ve("ZodNever",(e,t)=>{YM.init(e,t),fn.init(e,t)});function z$(e){return UD(L$,e)}const M$=ve("ZodArray",(e,t)=>{QM.init(e,t),fn.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(ed(n,r)),e.nonempty=n=>e.check(ed(1,n)),e.max=(n,r)=>e.check(tj(n,r)),e.length=(n,r)=>e.check(nj(n,r)),e.unwrap=()=>e.element});function Dr(e,t){return KD(M$,e,t)}const D$=ve("ZodObject",(e,t)=>{KM.init(e,t),fn.init(e,t),Pt(e,"shape",()=>t.shape),e.keyof=()=>io(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:k1()}),e.loose=()=>e.clone({...e._zod.def,catchall:k1()}),e.strict=()=>e.clone({...e._zod.def,catchall:z$()}),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)=>Tz(ij,e,n[0]),e.required=(...n)=>Az(sj,e,n[0])});function It(e,t){const n={type:"object",get shape(){return Rg(this,"shape",{...e}),this.shape},...Ue(t)};return new D$(n)}const $$=ve("ZodUnion",(e,t)=>{XM.init(e,t),fn.init(e,t),e.options=t.options});function zg(e,t){return new $$({type:"union",options:e,...Ue(t)})}const I$=ve("ZodIntersection",(e,t)=>{JM.init(e,t),fn.init(e,t)});function P$(e,t){return new I$({type:"intersection",left:e,right:t})}const pm=ve("ZodEnum",(e,t)=>{eD.init(e,t),fn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,s)=>{const c={};for(const u of r)if(n.has(u))c[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new pm({...t,checks:[],...Ue(s),entries:c})},e.exclude=(r,s)=>{const c={...t.entries};for(const u of r)if(n.has(u))delete c[u];else throw new Error(`Key ${u} not found in enum`);return new pm({...t,checks:[],...Ue(s),entries:c})}});function io(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new pm({type:"enum",entries:n,...Ue(t)})}const U$=ve("ZodTransform",(e,t)=>{tD.init(e,t),fn.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=c=>{if(typeof c=="string")n.issues.push(Ol(c,n.value,t));else{const u=c;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(Ol(u))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(c=>(n.value=c,n)):(n.value=s,n)}});function B$(e){return new U$({type:"transform",transform:e})}const ij=ve("ZodOptional",(e,t)=>{nD.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function S1(e){return new ij({type:"optional",innerType:e})}const F$=ve("ZodNullable",(e,t)=>{aD.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function j1(e){return new F$({type:"nullable",innerType:e})}const H$=ve("ZodDefault",(e,t)=>{rD.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function q$(e,t){return new H$({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const G$=ve("ZodPrefault",(e,t)=>{iD.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function V$(e,t){return new G$({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const sj=ve("ZodNonOptional",(e,t)=>{sD.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function W$(e,t){return new sj({type:"nonoptional",innerType:e,...Ue(t)})}const Z$=ve("ZodCatch",(e,t)=>{oD.init(e,t),fn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Y$(e,t){return new Z$({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Q$=ve("ZodPipe",(e,t)=>{lD.init(e,t),fn.init(e,t),e.in=t.in,e.out=t.out});function C1(e,t){return new Q$({type:"pipe",in:e,out:t})}const K$=ve("ZodReadonly",(e,t)=>{cD.init(e,t),fn.init(e,t)});function X$(e){return new K$({type:"readonly",innerType:e})}const J$=ve("ZodCustom",(e,t)=>{uD.init(e,t),fn.init(e,t)});function e3(e){const t=new Gn({check:"custom"});return t._zod.check=e,t}function t3(e,t={}){return XD(J$,e,t)}function n3(e){const t=e3(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Ol(r,n.value,t._zod.def));else{const s=r;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(Ol(s))}},e(n.value,n)));return t}function gh(e,t){if(!t||e==null)return;if(!t.includes("."))return e[t];let n=e;for(const r of t.split(".")){if(n==null)return;n=n[r]}return n}function We(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 Mg={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+We(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+We(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,We(n)),We(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,We(n)),We(e[0])):0},Sort:{name:"Sort",signature:"Sort(array, field, direction?) → sorted array",description:'Sort array by field. Direction: "asc" (default) or "desc"',fn:(e,t,n)=>{if(!Array.isArray(e))return e;const r=String(t??""),s=String(n??"asc")==="desc";return[...e].sort((c,u)=>{const d=r?gh(c,r):c,f=r?gh(u,r):u,h=typeof d=="number"||typeof d=="string"&&!isNaN(Number(d))&&d!=="",g=typeof f=="number"||typeof f=="string"&&!isNaN(Number(f))&&f!=="";if(h&&g){const y=We(d)-We(f);return s?-y:y}const m=String(d??"").localeCompare(String(f??""));return s?-m:m})}},Filter:{name:"Filter",signature:'Filter(array, field, operator: "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains", value) → filtered array',description:"Filter array by field value",fn:(e,t,n,r)=>{if(!Array.isArray(e))return[];const s=String(t??""),c=String(n??"==");return e.filter(u=>{const d=s?gh(u,s):u;switch(c){case"==":return d==r;case"!=":return d!=r;case">":return We(d)>We(r);case"<":return We(d)<We(r);case">=":return We(d)>=We(r);case"<=":return We(d)<=We(r);case"contains":return String(d??"").includes(String(r??""));default:return!1}})}},Round:{name:"Round",signature:"Round(number, decimals?) → number",description:"Round to N decimal places (default 0)",fn:(e,t)=>{const n=We(e),r=t!=null?We(t):0,s=Math.pow(10,r);return Math.round(n*s)/s}},Abs:{name:"Abs",signature:"Abs(number) → number",description:"Absolute value",fn:e=>Math.abs(We(e))},Floor:{name:"Floor",signature:"Floor(number) → number",description:"Round down to nearest integer",fn:e=>Math.floor(We(e))},Ceil:{name:"Ceil",signature:"Ceil(number) → number",description:"Round up to nearest integer",fn:e=>Math.ceil(We(e))}},Dg=new Set(["Each"]),a3={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."}},Ma={Run:"run",ToAssistant:"continue_conversation",OpenUrl:"open_url",Set:"set",Reset:"reset"},oj=new Set(["Action",...Object.keys(Ma)]),r3=new Set([...Object.keys(Mg),...Dg,...oj]);function Ll(e){return r3.has(e)}const yi={Query:"Query",Mutation:"Mutation"};function td(e){return e in yi}function nd(e){const t=e.type;if(t==="string"){const n=e.enum;return n?n.map(r=>`"${r}"`).join(" | "):"string"}if(t==="number"||t==="integer")return"number";if(t==="boolean")return"boolean";if(t==="array"){const n=e.items;return n?`${nd(n)}[]`:"any[]"}if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const r=e.required??[];return`{${Object.entries(n).map(([s,c])=>`${s}${r.includes(s)?"":"?"}: ${nd(c)}`).join(", ")}}`}return"object"}return"any"}function lj(e){const t=e.type;if(t==="string")return"";if(t==="number"||t==="integer")return 0;if(t==="boolean")return!1;if(t==="array")return[];if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const r={};for(const[s,c]of Object.entries(n))r[s]=lj(c);return r}return{}}return null}const i3="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 s3(e,t){const n=["## Syntax Rules","","1. Each statement is on its own line: `identifier = Expression`",`2. \`root\` is the entry point — every program must define \`root = ${e}(...)\``,'3. Expressions are: strings ("..."), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)',"4. Use references for readability: define `name = ...` on one line, then use `name` later","5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.",'6. Arguments are POSITIONAL (order matters, not names). Write `Stack([children], "row", "l")` NOT `Stack([children], direction: "row", gap: "l")` — colon syntax is NOT supported and silently breaks',"7. Optional arguments can be omitted from the end"];let r=8;return t.bindings&&n.push(`${r++}. Declare mutable state with \`$varName = defaultValue\`. Components marked with \`$binding\` can read/write these. Undeclared $variables are auto-created with null default.`),t.supportsExpressions&&n.push(`${r++}. String concatenation: \`"text" + $var + "more"\``,`${r++}. Dot member access: \`query.field\` reads a field; on arrays it extracts that field from every element`,`${r++}. Index access: \`arr[0]\`, \`data[index]\``,`${r++}. Arithmetic operators: +, -, *, /, % (work on numbers; + is string concat when either side is a string)`,`${r++}. Comparison: ==, !=, >, <, >=, <=`,`${r++}. Logical: &&, ||, ! (prefix)`,`${r++}. Ternary: \`condition ? valueIfTrue : valueIfFalse\``,`${r++}. Parentheses for grouping: \`(a + b) * c\``),n.push("- Strings use double quotes with backslash escaping"),n.join(`
1421
- `)}function o3(){const e=Object.values(Mg).map(n=>`@${n.signature} — ${n.description}`),t=Object.values(a3).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 l3(){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 c3(){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 u3(e){const t=['- @ToAssistant("message") — Send a message to the assistant (for conversational buttons like "Tell me more", "Explain this")','- @OpenUrl("https://...") — Navigate to a URL'];e.bindings&&t.push("- @Set($variable, value) — Set a $variable to a specific value",'- @Reset($var1, $var2, ...) — Reset $variables to their declared defaults (e.g. @Reset($title, $priority) restores $title="" and $priority="medium")'),e.toolCalls&&t.unshift("- @Run(queryOrMutationRef) — Execute a Mutation or re-fetch a Query (ref must be a declared Query/Mutation)");const n=[];e.toolCalls&&n.push('Example — mutation + refresh + reset (PREFERRED pattern):\n```\n$binding = "default"\nresult = Mutation("tool_name", {field: $binding})\ndata = Query("tool_name", {}, {rows: []})\nonSubmit = Action([@Run(result), @Run(data), @Reset($binding)])\n```'),n.push('Example — simple nav:\n```\nviewBtn = Button("View", Action([@OpenUrl("https://example.com")]))\n```');const r=['- Action can be assigned to a variable or inlined: Button("Go", onSubmit) and Button("Go", Action([...])) both work'];return e.toolCalls&&r.push("- If a @Run(mutation) step fails, remaining steps are skipped (halt on failure)","- @Run(queryRef) re-fetches the query (fire-and-forget, cannot fail)"),`## Action — Button Behavior
1465
-
1466
- Action([@steps...]) wires button clicks to operations. Steps are @-prefixed built-in actions. Steps execute in order.
1467
- Buttons without an explicit Action prop automatically send their label to the assistant (equivalent to Action([@ToAssistant(label)])).
1468
-
1469
- Available steps:
1470
- ${t.join(`
1471
- `)}
1472
-
1473
- ${n.join(`
1474
-
1475
- `)}
1476
-
1477
- ${r.join(`
1478
- `)}`}function d3(){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 p3(){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 f3(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 h3(){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 m3(){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 g3(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 v3(e){let t="";if(e.inputSchema){const s=e.inputSchema.properties,c=e.inputSchema.required??[];s&&Object.keys(s).length>0&&(t=Object.entries(s).map(([u,d])=>`${u}${c.includes(u)?"":"?"}: ${nd(d)}`).join(", "))}let n="";e.outputSchema&&(n=` → ${nd(e.outputSchema)}`);let r=`- ${e.name}(${t})${n}`;return e.description&&(r+=`
1608
- ${e.description}`),r}function y3(e){const t=[],n=[],r=[];for(const c of e)typeof c=="string"?n.push(c):r.push(c);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 c of n)t.push(`- ${c}`);for(const c of r)t.push(v3(c));const s=r.filter(c=>c.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 c of s){const u=lj(c.outputSchema);t.push(`- ${c.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 b3(e,t){var s,c;const n=["## Component Signatures","","Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming."];if(t.usesActionExpression){const u=[t.toolCalls?"@Run":"","@ToAssistant","@OpenUrl",t.bindings?"@Set":"",t.bindings?"@Reset":""].filter(Boolean);n.push(`Props typed \`ActionExpression\` accept an Action([@steps...]) expression. See the Action section for available steps (${u.join(", ")}).`)}(t.bindings||Object.values(e.components).some(u=>{var d;return(d=u.signature)==null?void 0:d.includes("$binding")}))&&n.push("Props marked `$binding<type>` accept a `$variable` reference for two-way binding.");const r=u=>u.description?`${u.signature} — ${u.description}`:u.signature;if((s=e.componentGroups)!=null&&s.length){const u=new Set;for(const f of e.componentGroups){n.push("",`### ${f.name}`);for(const h of f.components){if(u.has(h))continue;const g=e.components[h];g&&(u.add(h),n.push(r(g)))}if((c=f.notes)!=null&&c.length)for(const h of f.notes)n.push(h)}const d=Object.keys(e.components).filter(f=>!u.has(f));if(d.length){n.push("","### Other");for(const f of d){const h=e.components[f];n.push(r(h))}}}else{n.push("");for(const[,u]of Object.entries(e.components))n.push(r(u))}return n.join(`
1610
- `)}function x3(e){var h,g,m;const t=e.root??"Root",n=!!((h=e.tools)!=null&&h.length),r=e.toolCalls??n,s=e.bindings??r,c=r||s,u=Object.values(e.components).some(y=>{var x;return(x=y.signature)==null?void 0:x.includes("ActionExpression")}),d=[];d.push(e.preamble??i3),d.push(""),d.push(s3(t,{supportsExpressions:c,bindings:s})),d.push(""),d.push(b3(e,{toolCalls:r,bindings:s,usesActionExpression:u})),c&&(d.push(""),d.push(o3())),r&&(d.push(""),d.push(l3()),d.push(""),d.push(c3())),u&&(d.push(""),d.push(u3({toolCalls:r,bindings:s}))),r&&s&&(d.push(""),d.push(d3())),r&&(d.push(""),d.push(m3())),(g=e.tools)!=null&&g.length&&(d.push(""),d.push(y3(e.tools))),d.push(""),d.push(f3(t,{supportsExpressions:c}));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(p3())),e.inlineMode&&(d.push(""),d.push(h3())),d.push(g3(t,{toolCalls:r,bindings:s})),(m=e.additionalRules)!=null&&m.length){d.push("");for(const y of e.additionalRules)d.push(`- ${y}`)}return d.join(`
1611
- `)}const w3=new WeakSet;function jl(e){return typeof e=="object"&&e!==null&&w3.has(e)}const cj=new WeakMap;function k3(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 S3(e){return k3(e.props,e.name),cj.set(e.props,e.name),{...e,ref:e.props}}function $r(e){var t;return(t=e==null?void 0:e._zod)==null?void 0:t.def}function $g(e){var t;return(t=$r(e))==null?void 0:t.type}function uj(e){const t=$g(e);return t==="optional"||t==="default"||t==="nullable"}function ql(e){let t=e,n=$r(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=$r(t);return t}function dj(e){return $g(ql(e))==="array"}function j3(e){const t=$r(ql(e));if((t==null?void 0:t.type)==="array")return t.element??t.innerType}function C3(e){const t=$r(ql(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 N3(e,t){try{const n=t.get(e);if(n!=null&&n.id)return n.id}catch{}if(typeof e=="object"&&e!==null)return cj.get(e)}function N1(e){const t=$r(e);if((t==null?void 0:t.type)==="union"&&Array.isArray(t.options))return t.options}function E3(e){const t=$r(e);if((t==null?void 0:t.type)==="object"&&t.shape&&typeof t.shape=="object")return t.shape}function Vs(e,t){const n=jl(e),r=T3(ql(e),t);if(r)return n?`$binding<${r}>`:r}function T3(e,t){var d;const n=N3(e,t);if(n)return n;const r=N1(e);if(r){const f=r.map(h=>Vs(h,t)).filter(Boolean);if(f.length>0)return f.join(" | ")}if(dj(e)){const f=j3(e);if(!f)return;const h=Vs(f,t);return h?N1(ql(f))!==void 0?`(${h})[]`:`${h}[]`:void 0}const s=$g(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=$r(e);return`Record<${Vs(f==null?void 0:f.keyType,t)??"string"}, ${Vs(f==null?void 0:f.valueType,t)??"any"}>`}const c=C3(e);if(c)return c.map(f=>`"${f}"`).join(" | ");if(s==="literal"){const f=(d=$r(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=E3(e);return u?`{${Object.entries(u).map(([f,h])=>{const g=uj(h)?"?":"",m=Vs(h,t);return m?`${f}${g}: ${m}`:`${f}${g}`}).join(", ")}}`:"any"}function A3(e,t){return Object.entries(e).map(([n,r])=>({name:n,isOptional:uj(r),isArray:dj(r),typeAnnotation:Vs(r,t)}))}function R3(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 E1(e,t){const n={};for(const[r,s]of Object.entries(e))n[r]={signature:R3(r,A3(s.props.shape,t)),description:s.description};return n}function _3(e){const t={},n=ej();for(const r of e.components)n.add(r.props,{id:r.name}),t[r.name]=r;if(e.root&&!t[e.root]){const r=Object.keys(t).join(", ");throw new Error(`[createLibrary] Root component "${e.root}" was not found in components. Available components: ${r}`)}return{components:t,componentGroups:e.componentGroups,root:e.root,prompt(r){return x3({root:e.root,components:E1(t,n),componentGroups:e.componentGroups,...r})},toSpec(){return{root:e.root,components:E1(t,n),componentGroups:e.componentGroups}},toJSONSchema(){const r=It(Object.fromEntries(Object.entries(t).map(([s,c])=>[s,c.props])));return JD(r,{metadata:n})}}}function zr(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 vu=(function(e){return e.ContinueConversation="continue_conversation",e.OpenUrl="open_url",e})({});function O3(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 L3=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function Ks(e){return!e||typeof e!="object"||Array.isArray(e)?!1:L3.has(e.k)}function z3(e,t){const n=r=>{switch(t(r),r.k){case"Comp":r.args.forEach(n),Object.values(r.mappedProps??{}).forEach(n);break;case"Arr":r.els.forEach(n);break;case"Obj":r.entries.forEach(([,s])=>n(s));break;case"BinOp":n(r.left),n(r.right);break;case"UnaryOp":n(r.operand);break;case"Ternary":n(r.cond),n(r.then),n(r.else);break;case"Member":n(r.obj);break;case"Index":n(r.obj),n(r.index);break;case"Assign":n(r.value);break}};n(e)}let ie=(function(e){return e[e.Newline=0]="Newline",e[e.LParen=1]="LParen",e[e.RParen=2]="RParen",e[e.LBrack=3]="LBrack",e[e.RBrack=4]="RBrack",e[e.LBrace=5]="LBrace",e[e.RBrace=6]="RBrace",e[e.Comma=7]="Comma",e[e.Colon=8]="Colon",e[e.Equals=9]="Equals",e[e.True=10]="True",e[e.False=11]="False",e[e.Null=12]="Null",e[e.EOF=13]="EOF",e[e.Str=14]="Str",e[e.Num=15]="Num",e[e.Ident=16]="Ident",e[e.Type=17]="Type",e[e.StateVar=18]="StateVar",e[e.Dot=19]="Dot",e[e.Plus=20]="Plus",e[e.Minus=21]="Minus",e[e.Star=22]="Star",e[e.Slash=23]="Slash",e[e.Percent=24]="Percent",e[e.EqEq=25]="EqEq",e[e.NotEq=26]="NotEq",e[e.Greater=27]="Greater",e[e.Less=28]="Less",e[e.GreaterEq=29]="GreaterEq",e[e.LessEq=30]="LessEq",e[e.And=31]="And",e[e.Or=32]="Or",e[e.Not=33]="Not",e[e.Question=34]="Question",e[e.BuiltinCall=35]="BuiltinCall",e})({});const M3=1,T1=2,A1=3,vh=4,pl=5,yh=6,yu=7,R1=8,D3=9;function _1(e){let t=0;const n=()=>e[t]??{t:ie.EOF},r=()=>{const y=n();return t++,y},s=y=>{n().t===y&&t++};function c(y){switch(y.t){case ie.Question:return M3;case ie.Or:return T1;case ie.And:return A1;case ie.EqEq:case ie.NotEq:return vh;case ie.Greater:case ie.Less:case ie.GreaterEq:case ie.LessEq:return pl;case ie.Plus:case ie.Minus:return yh;case ie.Star:case ie.Slash:case ie.Percent:return yu;case ie.Dot:case ie.LBrack:return D3;default:return 0}}function u(y=0){let x=d();for(;c(n())>y;)x=f(x);return x}function d(){var x,k;const y=n();if(y.t===ie.Str)return r(),{k:"Str",v:y.v};if(y.t===ie.Num)return r(),{k:"Num",v:y.v};if(y.t===ie.True)return r(),{k:"Bool",v:!0};if(y.t===ie.False)return r(),{k:"Bool",v:!1};if(y.t===ie.Null)return r(),{k:"Null"};if(y.t===ie.LBrack)return g();if(y.t===ie.LBrace)return m();if(y.t===ie.StateVar){const j=y.v;return r(),n().t===ie.Equals?(r(),{k:"Assign",target:j,value:u(0)}):{k:"StateRef",n:j}}if(y.t===ie.Type){const j=y.v;return((x=e[t+1])==null?void 0:x.t)===ie.LParen&&(!Ll(j)||j==="Action")?h():(r(),{k:"Ref",n:j})}if(y.t===ie.BuiltinCall)return((k=e[t+1])==null?void 0:k.t)===ie.LParen?h():(r(),{k:"Ref",n:y.v});if(y.t===ie.Ident)return r(),{k:"Ref",n:y.v};if(y.t===ie.Not)return r(),{k:"UnaryOp",op:"!",operand:u(R1)};if(y.t===ie.Minus)return r(),{k:"UnaryOp",op:"-",operand:u(R1)};if(y.t===ie.LParen){r();const j=u(0);return s(ie.RParen),j}return r(),{k:"Null"}}function f(y){const x=n();if(x.t===ie.Plus)return r(),{k:"BinOp",op:"+",left:y,right:u(yh)};if(x.t===ie.Minus)return r(),{k:"BinOp",op:"-",left:y,right:u(yh)};if(x.t===ie.Star)return r(),{k:"BinOp",op:"*",left:y,right:u(yu)};if(x.t===ie.Slash)return r(),{k:"BinOp",op:"/",left:y,right:u(yu)};if(x.t===ie.Percent)return r(),{k:"BinOp",op:"%",left:y,right:u(yu)};if(x.t===ie.EqEq)return r(),{k:"BinOp",op:"==",left:y,right:u(vh)};if(x.t===ie.NotEq)return r(),{k:"BinOp",op:"!=",left:y,right:u(vh)};if(x.t===ie.Greater)return r(),{k:"BinOp",op:">",left:y,right:u(pl)};if(x.t===ie.Less)return r(),{k:"BinOp",op:"<",left:y,right:u(pl)};if(x.t===ie.GreaterEq)return r(),{k:"BinOp",op:">=",left:y,right:u(pl)};if(x.t===ie.LessEq)return r(),{k:"BinOp",op:"<=",left:y,right:u(pl)};if(x.t===ie.And)return r(),{k:"BinOp",op:"&&",left:y,right:u(A1)};if(x.t===ie.Or)return r(),{k:"BinOp",op:"||",left:y,right:u(T1)};if(x.t===ie.Question){r();const k=u(0);return s(ie.Colon),{k:"Ternary",cond:y,then:k,else:u(0)}}if(x.t===ie.Dot){r();const k=n();return{k:"Member",obj:y,field:k.t===ie.Ident||k.t===ie.Type||k.t===ie.Str||k.t===ie.Num?(r(),String(k.v)):k.t===ie.StateVar?(r(),k.v.replace(/^\$/,"")):(r(),"?")}}if(x.t===ie.LBrack){r();const k=u(0);return s(ie.RBrack),{k:"Index",obj:y,index:k}}return y}function h(){const y=n().v;r(),s(ie.LParen);const x=[];for(;n().t!==ie.RParen&&n().t!==ie.EOF;)x.push(u(0)),n().t===ie.Comma&&r();return s(ie.RParen),{k:"Comp",name:y,args:x}}function g(){r();const y=[];for(;n().t!==ie.RBrack&&n().t!==ie.EOF;)y.push(u(0)),n().t===ie.Comma&&r();return s(ie.RBrack),{k:"Arr",els:y}}function m(){r();const y=[];for(;n().t!==ie.RBrace&&n().t!==ie.EOF;){const x=n(),k=x.t===ie.Ident||x.t===ie.Str||x.t===ie.Type||x.t===ie.Num?(r(),String(x.v)):x.t===ie.StateVar?(r(),x.v.replace(/^\$/,"")):(r(),"?");s(ie.Colon),y.push([k,u(0)]),n().t===ie.Comma&&r()}return s(ie.RBrace),{k:"Obj",entries:y}}return u(0)}function O1(e){const t=[];let n=0;const r=e.length;for(;n<r;){for(;n<r&&(e[n]===" "||e[n]===" "||e[n]==="\r");)n++;if(n>=r)break;const s=e[n];if(s===`
1612
- `){t.push({t:ie.Newline}),n++;continue}if(s==="("){t.push({t:ie.LParen}),n++;continue}if(s===")"){t.push({t:ie.RParen}),n++;continue}if(s==="["){t.push({t:ie.LBrack}),n++;continue}if(s==="]"){t.push({t:ie.RBrack}),n++;continue}if(s==="{"){t.push({t:ie.LBrace}),n++;continue}if(s==="}"){t.push({t:ie.RBrace}),n++;continue}if(s===","){t.push({t:ie.Comma}),n++;continue}if(s===":"){t.push({t:ie.Colon}),n++;continue}if(s==="="){n+1<r&&e[n+1]==="="?(t.push({t:ie.EqEq}),n+=2):(t.push({t:ie.Equals}),n++);continue}if(s==="!"){n+1<r&&e[n+1]==="="?(t.push({t:ie.NotEq}),n+=2):(t.push({t:ie.Not}),n++);continue}if(s===">"){n+1<r&&e[n+1]==="="?(t.push({t:ie.GreaterEq}),n+=2):(t.push({t:ie.Greater}),n++);continue}if(s==="<"){n+1<r&&e[n+1]==="="?(t.push({t:ie.LessEq}),n+=2):(t.push({t:ie.Less}),n++);continue}if(s==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:ie.And}),n+=2):(t.push({t:ie.And}),n++);continue}if(s==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:ie.Or}),n+=2):(t.push({t:ie.Or}),n++);continue}if(s==="."){t.push({t:ie.Dot}),n++;continue}if(s==="?"){t.push({t:ie.Question}),n++;continue}if(s==="+"){t.push({t:ie.Plus}),n++;continue}if(s==="*"){t.push({t:ie.Star}),n++;continue}if(s==="/"){t.push({t:ie.Slash}),n++;continue}if(s==="%"){t.push({t:ie.Percent}),n++;continue}if(s==='"'){const d=n;n++;let f=!1;for(;n<r;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,f=!0;break}else n++;const h=e.slice(d,n);try{const g=f?h:h+'"';t.push({t:ie.Str,v:JSON.parse(g)})}catch{const g=h.replace(/^"|"$/g,"");t.push({t:ie.Str,v:g})}continue}if(s==="'"){n++;let d="";for(;n<r;)if(e[n]==="\\"){if(n++,n<r){const f=e[n];f==="'"?d+="'":f==="\\"?d+="\\":f==="n"?d+=`
1613
- `:f==="t"?d+=" ":d+=f,n++}}else if(e[n]==="'"){n++;break}else d+=e[n],n++;t.push({t:ie.Str,v:d});continue}if(s==="-"){const d=t.length>0?t[t.length-1]:null;if(!(!(d!=null&&(d.t===ie.Num||d.t===ie.Str||d.t===ie.Ident||d.t===ie.Type||d.t===ie.RParen||d.t===ie.RBrack||d.t===ie.True||d.t===ie.False||d.t===ie.Null||d.t===ie.StateVar||d.t===ie.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:ie.Minus}),n++;continue}}const c=s>="0"&&s<="9",u=s==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(c||u){const d=n;for(e[n]==="-"&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&e[n]==="."&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")for(n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&(e[n]==="e"||e[n]==="E"))for(n++,n<r&&(e[n]==="+"||e[n]==="-")&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;t.push({t:ie.Num,v:+e.slice(d,n)});continue}if(s==="$"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){const d=n;for(n++;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:ie.StateVar,v:e.slice(d,n)});continue}if(s>="a"&&s<="z"||s>="A"&&s<="Z"||s==="_"){const d=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;const f=e.slice(d,n);if(f==="true"){t.push({t:ie.True});continue}if(f==="false"){t.push({t:ie.False});continue}if(f==="null"){t.push({t:ie.Null});continue}const h=s>="A"&&s<="Z"?ie.Type:ie.Ident;t.push({t:h,v:f});continue}if(s==="@"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){n++;const d=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:ie.BuiltinCall,v:e.slice(d,n)});continue}n++}return t.push({t:ie.EOF}),t}function $u(e){return e==null||typeof e!="object"?!1:Ks(e)?!0:Array.isArray(e)?e.some($u):zr(e)?Object.values(e.props).some($u):Object.values(e).some($u)}function pj(e,t,n){var c;if(t.visited.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;if(!t.syms.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;const r=t.syms.get(e);if((c=t.unreached)==null||c.delete(e),r.k==="Comp"&&td(r.name))return{k:"RuntimeRef",n:e,refType:r.name===yi.Mutation?"mutation":"query"};t.visited.add(e);const s=t.currentStatementId;t.currentStatementId=e;try{const u=n==="value"?Xs(r,t):fm(r,t);return n==="value"&&zr(u)&&(u.statementId=e),u}finally{t.currentStatementId=s,t.visited.delete(e)}}function fj(e,t,n){if(!Dg.has(e.name)||e.args.length<3)return null;const r=e.args[1],s=r.k==="Ref"?r.n:r.k==="Str"?r.v:null;if(!s)return null;const c=new Set(n);c.add(s);const u=e.args.map((d,f)=>f===1?d:Ln(d,t,c));return{...e,args:u}}function Ln(e,t,n){var r;switch(e.k){case"Ref":return n.has(e.n)?e:pj(e.n,t,"expr");case"Ph":return e;case"Comp":{const s=fj(e,t,n);if(s)return s;const c=e.args.map(d=>Ln(d,t,n));if(Ll(e.name)||td(e.name))return{...e,args:c};const u=(r=t.cat)==null?void 0:r.get(e.name);if(u){const d={};for(let f=0;f<u.params.length&&f<c.length;f++)d[u.params[f].name]=c[f];return{...e,args:c,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:c}}case"Arr":return{...e,els:e.els.map(s=>Ln(s,t,n))};case"Obj":return{...e,entries:e.entries.map(([s,c])=>[s,Ln(c,t,n)])};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"Member":return{...e,obj:Ln(e.obj,t,n)};case"Index":return{...e,obj:Ln(e.obj,t,n),index:Ln(e.index,t,n)};case"Assign":return{...e,value:Ln(e.value,t,n)};default:return e}}function fm(e,t){return Ln(e,t,new Set)}function Xs(e,t){var n;switch(e.k){case"Ref":return pj(e.n,t,"value");case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"Arr":{const r=[];for(const s of e.els){if(s.k==="Ph")continue;const c=Xs(s,t);c===null&&(s.k==="Comp"||s.k==="Ref")||r.push(c)}return r}case"Obj":{const r={};for(const[s,c]of e.entries)r[s]=Xs(c,t);return r}case"Comp":{const{name:r,args:s}=e;if(Ll(r)){const f=fj(e,t,new Set);return f||{...e,args:s.map(h=>fm(h,t))}}if(td(r))return t.errors.push({code:"inline-reserved",component:r,path:"",message:`${r}() must be declared as a top-level statement, not used inline as a value`,statementId:t.currentStatementId}),null;const c=(n=t.cat)==null?void 0:n.get(r),u={};if(c){for(let h=0;h<c.params.length&&h<s.length;h++)u[c.params[h].name]=Xs(s[h],t);if(s.length>c.params.length){const h=s.length-c.params.length;t.errors.push({code:"excess-args",component:r,path:"",message:`${r} takes ${c.params.length} arg(s), got ${s.length} (${h} excess dropped)`,statementId:t.currentStatementId})}const f=c.params.filter(h=>h.required&&(!(h.name in u)||u[h.name]===null));if(f.length){const h=f.filter(g=>g.defaultValue!==void 0?(u[g.name]=g.defaultValue,!1):!0);if(h.length){for(const g of h){const m=g.name in u;t.errors.push({code:m?"null-required":"missing-required",component:r,path:`/${g.name}`,message:m?`required field "${g.name}" cannot be null`:`missing required field "${g.name}"`,statementId:t.currentStatementId})}return null}}}else if(!Ll(r)&&!td(r))return t.errors.push({code:"unknown-component",component:r,path:"",message:`Unknown component "${r}" — not found in catalog or builtins`,statementId:t.currentStatementId}),null;const d=Object.values(u).some(f=>$u(f));return{type:"element",typeName:r,props:u,partial:t.partial,hasDynamicProps:d}}default:return O3(e)?fm(e,t):e}}function $3(e){const t=[];let n=!1,r=!1;for(let c=0;c<e.length;c++){const u=e[c];if(r){r=!1;continue}if(u==="\\"&&n){r=!0;continue}if(n){u===n&&(n=!1);continue}if(u==='"'||u==="'"){n=u;continue}u==="("||u==="["||u==="{"?t.push(u):(u===")"&&t[t.length-1]==="("||u==="]"&&t[t.length-1]==="["||u==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(n||t.length>0))return{text:e,wasIncomplete:!1};let s=e;n&&(r&&(s+="\\"),s+=n);for(let c=t.length-1;c>=0;c--)s+=t[c]==="("?")":t[c]==="["?"]":"}";return{text:s,wasIncomplete:!0}}function L1(e){const t=[];let n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===ie.Newline;)n++;if(n>=e.length||e[n].t===ie.EOF)break;const r=e[n];if(r.t!==ie.Ident&&r.t!==ie.Type&&r.t!==ie.StateVar){for(;n<e.length&&e[n].t!==ie.Newline&&e[n].t!==ie.EOF;)n++;continue}const s=r.v,c=r.t;if(n++,n>=e.length||e[n].t!==ie.Equals){for(;n<e.length&&e[n].t!==ie.Newline&&e[n].t!==ie.EOF;)n++;continue}n++;const u=[];let d=0,f=0;for(;n<e.length&&e[n].t!==ie.EOF;){const h=e[n].t;if(h===ie.Newline&&d<=0&&f<=0){let g=n+1;for(;g<e.length&&e[g].t===ie.Newline;)g++;const m=g<e.length?e[g].t:ie.EOF;if(m===ie.Question||m===ie.Colon&&f>0){n++;continue}break}if(h===ie.Newline){n++;continue}h===ie.LParen||h===ie.LBrack||h===ie.LBrace?d++:(h===ie.RParen||h===ie.RBrack||h===ie.RBrace)&&d>0?d--:h===ie.Question&&d===0?f++:h===ie.Colon&&d===0&&f>0&&f--,u.push(e[n++])}u.length&&t.push({id:s,idTokenType:c,tokens:u})}return t}function Iu(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function hj(e){if(!Ks(e))return[];const t=new Set;return z3(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function z1(e,t){if(t.k==="Comp"&&t.name===yi.Query){const n=hj(t.args[1]);return{kind:"query",id:e.id,call:{callee:yi.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===yi.Mutation?{kind:"mutation",id:e.id,call:{callee:yi.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 I3(e,t){const n={},r=[],s=[];for(const c of e)switch(c.kind){case"state":n[c.id]=Xs(c.init,t);break;case"query":r.push({statementId:c.id,toolAST:c.call.args[0]??null,argsAST:c.call.args[1]??null,defaultsAST:c.call.args[2]??null,refreshAST:c.call.args[3]??null,deps:c.deps,complete:!0});break;case"mutation":s.push({statementId:c.id,toolAST:c.call.args[0]??null,argsAST:c.call.args[1]??null});break}for(const c of e){const u=c.kind==="state"?[c.init]:c.kind==="value"?[c.expr]:c.kind==="query"||c.kind==="mutation"?c.call.args:[];for(const d of u)for(const f of hj(d))f in n||(n[f]=null)}return{stateDeclarations:n,queryStatements:r,mutationStatements:s}}const M1="root";function D1(e){return e.kind==="value"&&e.expr.k==="Comp"&&!Ll(e.expr.name)&&e.expr.name!==yi.Query&&e.expr.name!==yi.Mutation}function P3(e,t,n,r){var c;if(e.has(M1))return M1;if(r&&e.has(r))return r;const s=r?t.find(u=>D1(u)&&u.expr.name===r):void 0;return s?s.id:((c=t.find(D1))==null?void 0:c.id)??n}function bu(e,t,n,r,s,c,u){const d=P3(e,t,n,u);if(!e.has(d))return Iu(r);const f=new Map;for(const[T,N]of e)f.set(T,N.kind==="state"?N.init:N.expr);const h=[],g=[],m=new Set;for(const[T,N]of e)T!==d&&(N.kind==="state"||N.kind==="query"||N.kind==="mutation"||m.add(T));const y={syms:f,cat:c,errors:g,unres:h,visited:new Set,partial:r,currentStatementId:d,unreached:m},x=Xs(f.get(d),y),k=zr(x)?x:null;k&&(k.statementId=d);const{stateDeclarations:j,queryStatements:E,mutationStatements:S}=I3(t,y);return{root:k,meta:{incomplete:r,unresolved:h,orphaned:[...m],statementCount:s,errors:g},stateDeclarations:j,queryStatements:E,mutationStatements:S}}function U3(e){const t=[];let n=0;for(;n<e.length;){const r=e.indexOf("```",n);if(r===-1)break;let s=r+3;for(;s<e.length&&e[s]!==`
1614
- `;)s++;if(s>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}s++;let c=!1,u=-1,d=s;for(;d<e.length;){const f=e[d];if(c){if(f==="\\"&&d+1<e.length){d+=2;continue}f==='"'&&(c=!1),d++;continue}if(f==='"'){c=!0,d++;continue}if(f==="`"&&d+1<e.length&&e[d+1]==="`"&&d+2<e.length&&e[d+2]==="`"){u=d;break}d++}u!==-1?(t.push(e.slice(s,u)),n=u+3):(t.push(e.slice(s)),n=e.length)}if(t.length>0)return t.join(`
1615
- `);if(e.startsWith("```")){let r=3;for(;r<e.length&&e[r]!==`
1616
- `;)r++;const s=r<e.length?r+1:3,c=e.slice(s),u=c.lastIndexOf("```");return u!==-1?c.slice(0,u):c}return e}function $1(e){return e.split(`
1617
- `).map(t=>{let n=!1;for(let r=0;r<t.length;r++){const s=t[r];if(n){if(s==="\\"&&r+1<t.length){r++;continue}s===n&&(n=!1);continue}if(s==='"'||s==="'"){n=s;continue}if(s==="/"&&t[r+1]==="/"||s==="#")return t.substring(0,r).trimEnd()}return t}).join(`
1618
- `)}function B3(e,t){let n="",r=0;const s=new Map;let c=0,u="";function d(m){const y=$1(m).trim();if(!(!y||/^```/.test(y)))for(const x of L1(O1(y))){const k=z1(x,_1(x.tokens));s.set(x.id,k),c++,u||(u=x.id)}}function f(){let m=0,y=0,x=!1,k=!1,j=r;for(let E=r;E<n.length;E++){const S=n[E];if(k){k=!1;continue}if(S==="\\"&&x){k=!0;continue}if(x){S===x&&(x=!1);continue}if(S==='"'||S==="'"){x=S;continue}if(S==="("||S==="["||S==="{")m++;else if(S===")"||S==="]"||S==="}")m=Math.max(0,m-1);else if(S==="?"&&m===0)y++;else if(S===":"&&m===0&&y>0)y--;else if(S===`
1619
- `&&m<=0&&y<=0){let T=E+1;for(;T<n.length&&(n[T]===" "||n[T]===" "||n[T]==="\r"||n[T]===`
1620
- `);)T++;if(T<n.length&&(n[T]==="?"||n[T]===":"&&y>0))continue;const N=n.slice(j,E).trim();N&&d(N),j=E+1,r=E+1}}return j}function h(){const m=f(),y=n.slice(m).trim();if(!y)return c===0?Iu():bu(s,[...s.values()],u,!1,c,e,t);const x=$1(U3(y)).trim();if(!x)return c===0?Iu():bu(s,[...s.values()],u,!1,c,e,t);const{text:k,wasIncomplete:j}=$3(x),E=L1(O1(k));if(!E.length)return c===0?Iu(j):bu(s,[...s.values()],u,j,c,e,t);const S=new Map(s);for(const T of E){if(s.has(T.id))continue;const N=z1(T,_1(T.tokens));S.set(T.id,N)}return bu(S,[...S.values()],u||E[0].id,j,c+E.length,e,t)}function g(){n="",r=0,s.clear(),c=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 F3(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function H3(e){const t=new Map,n=e.$defs??{};for(const[r,s]of Object.entries(n)){const c=s.properties??{},u=s.required??[],d=Object.keys(c).map(f=>({name:f,required:u.includes(f),defaultValue:F3(c[f])}));t.set(r,{params:d})}return t}function q3(e,t){return B3(H3(e),t)}function G3(e,t){if(!(t!=null&&t.properties))return;const n=new Set(t.required??[]);return`Signature: ${e}(${Object.keys(t.properties).map(r=>n.has(r)?`${r}*`:r).join(", ")}) — * marks required`}function V3(e,t,n){return e.map(r=>{var c;const s={source:"parser",code:r.code,message:r.message,component:r.component,path:r.path||void 0,statementId:r.statementId};return r.code==="unknown-component"&&n.length?s.hint=`Available components: ${n.join(", ")}`:r.code==="missing-required"||r.code==="null-required"?s.hint=G3(r.component,(c=t.$defs)==null?void 0:c[r.component]):r.code==="inline-reserved"&&(s.hint=`Declare as a top-level statement: myVar = ${r.component}(...)`),s})}function W3(e){return typeof e=="object"&&e!==null&&e.__reactive==="assign"}function vt(e,t,n){var r,s,c;switch(e.k){case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"StateRef":return((r=t.extraScope)==null?void 0:r[e.n])??t.getState(e.n);case"Ref":case"RuntimeRef":return t.resolveRef(e.n);case"Arr":return e.els.map(u=>vt(u,t));case"Obj":return Object.fromEntries(e.entries.map(([u,d])=>[u,vt(d,t)]));case"Comp":{if(Dg.has(e.name))return Y3(e.name,e.args,t,n);const u=Mg[e.name];if(u){const d=e.args.map(f=>vt(f,t));return u.fn(...d)}if(oj.has(e.name))return Z3(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=(c=(s=d==null?void 0:d.props)==null?void 0:s.shape)==null?void 0:c[g];m.k==="StateRef"&&y&&jl(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))zr(m)?f[g]=ad(m,t,n):Array.isArray(m)&&(f[g]=m.map(y=>zr(y)?ad(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??""):We(u)+We(d);case"-":return We(u)-We(d);case"*":return We(u)*We(d);case"/":return We(d)===0?0:We(u)/We(d);case"%":return We(d)===0?0:We(u)%We(d);case"==":return u==d;case"!=":return u!=d;case">":return We(u)>We(d);case"<":return We(u)<We(d);case">=":return We(u)>=We(d);case"<=":return We(u)<=We(d);default:return null}}case"UnaryOp":return e.op==="!"?!vt(e.operand,t):e.op==="-"?-We(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[We(d)]:u[String(d)]}case"Assign":return{__reactive:"assign",target:e.target,expr:e.value}}}function ad(e,t,n){var c,u;if(e.hasDynamicProps===!1)return e;const r=n.library.components[e.typeName],s={};for(const[d,f]of Object.entries(e.props)){const h=(u=(c=r==null?void 0:r.props)==null?void 0:c.shape)==null?void 0:u[d];s[d]=mj(f,t,n,h)}return{...e,props:s}}function mj(e,t,n,r){return gj(e,t,n,r,{recurseElement:s=>ad(s,t,n),recurse:(s,c)=>mj(s,t,n,c)})}function hm(e){return e==null?{k:"Null"}:typeof e=="string"?{k:"Str",v:e}:typeof e=="number"?{k:"Num",v:e}:typeof e=="boolean"?{k:"Bool",v:e}:Array.isArray(e)?{k:"Arr",els:e.map(hm)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,hm(n)])}:{k:"Null"}}function Z3(e,t,n){switch(e){case"Action":{const r=t.length>0?vt(t[0],n):[];return{steps:(Array.isArray(r)?r:[]).filter(s=>s!=null&&typeof s=="object"&&"type"in s)}}case"Run":{if(t.length===0)return null;const r=t[0];return r.k==="RuntimeRef"?{type:Ma.Run,statementId:r.n,refType:r.refType}:null}case"ToAssistant":{const r=t.length>0?String(vt(t[0],n)??""):"",s=t.length>1?String(vt(t[1],n)??""):void 0;return{type:Ma.ToAssistant,message:r,context:s}}case"OpenUrl":{const r=t.length>0?String(vt(t[0],n)??""):"";return{type:Ma.OpenUrl,url:r}}case"Set":{if(t.length<2)return null;const r=t[0];return r.k!=="StateRef"?null:{type:Ma.Set,target:r.n,valueAST:t[1]}}case"Reset":{const r=t.filter(s=>s.k==="StateRef").map(s=>s.n);return r.length===0?null:{type:Ma.Reset,targets:r}}default:return null}}function On(e,t,n){switch(e.k){case"Ref":return e.n===t?hm(n):e;case"Member":if(Ks(e.obj)){const r=On(e.obj,t,n);if(r.k==="Obj"){const s=r.entries.find(([c])=>c===e.field);if(s)return s[1]}return{...e,obj:r}}return e;case"Index":return{...e,obj:Ks(e.obj)?On(e.obj,t,n):e.obj,index:Ks(e.index)?On(e.index,t,n):e.index};case"BinOp":return{...e,left:On(e.left,t,n),right:On(e.right,t,n)};case"UnaryOp":return{...e,operand:On(e.operand,t,n)};case"Ternary":return{...e,cond:On(e.cond,t,n),then:On(e.then,t,n),else:On(e.else,t,n)};case"Arr":return{...e,els:e.els.map(r=>On(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,s])=>[r,On(s,t,n)])};case"Comp":{const r={...e,args:e.args.map(s=>On(s,t,n))};if(e.mappedProps){const s={};for(const[c,u]of Object.entries(e.mappedProps))s[c]=On(u,t,n);r.mappedProps=s}return r}case"Assign":return{...e,value:On(e.value,t,n)};default:return e}}function Y3(e,t,n,r){if(e==="Each"){if(t.length<3)return[];const s=vt(t[0],n);if(!Array.isArray(s))return[];const c=t[1].k==="Ref"?t[1].n:t[1].k==="Str"?t[1].v:null;if(!c)return[];const u=t[2];return s.map((d,f)=>{const h=On(u,c,d),g={...n,resolveRef:y=>y===c?d:n.resolveRef(y)},m=vt(h,g,r);return r&&zr(m)?ad(m,g,r):m})}return null}function gj(e,t,n,r,s){if(e==null||typeof e!="object")return e;if(Ks(e)){if(e.k==="StateRef"&&r&&jl(r))return{__reactive:"assign",target:e.n,expr:{k:"StateRef",n:"$value"}};const d=vt(e,t,n);return zr(d)?s.recurseElement(d):Array.isArray(d)?d.map(f=>zr(f)?s.recurseElement(f):f):W3(d)&&!(r&&jl(r))?t.getState(d.target)??null:d}if(typeof e=="string"&&r&&jl(r))return e;if(Array.isArray(e))return e.map(d=>s.recurse(d,r));if(zr(e))return s.recurseElement(e);const c=e;if("steps"in c&&Array.isArray(c.steps)||"type"in c&&"valueAST"in c)return e;let u=!1;for(const d of Object.values(c))if(typeof d=="object"&&d!==null){u=!0;break}if(u){const d={};for(const[f,h]of Object.entries(c))d[f]=s.recurse(h,r);return d}return e}function vj(e,t){var c,u,d;if(e.hasDynamicProps===!1)return e;const n={library:t.library},r=t.library.components[e.typeName],s={};for(const[f,h]of Object.entries(e.props)){const g=(u=(c=r==null?void 0:r.props)==null?void 0:c.shape)==null?void 0:u[f];try{s[f]=yj(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 yj(e,t,n,r){return gj(e,t.ctx,n,r,{recurseElement:s=>vj(s,t),recurse:(s,c)=>yj(s,t,n,c)})}var mm=class extends Error{constructor(t){super(`MCP tool error: ${t||"Unknown error"}`);Sn(this,"toolErrorText");this.name="McpToolError",this.toolErrorText=t}};function Q3(e){var n,r;if(e.isError){const s=(n=e.content)==null?void 0:n.filter(c=>c.type==="text").map(c=>c.text).join(`
1621
- `);throw new mm(s||"Unknown error")}if(e.structuredContent!=null)return e.structuredContent;const t=(r=e.content)==null?void 0:r.filter(s=>s.type==="text").map(s=>s.text??"");if(t!=null&&t.length){const s=t.join("");try{return JSON.parse(s)}catch{return s}}return null}var gm=class extends Error{constructor(t,n=[]){super(`[openui] No handler for tool "${t}". Available: ${n.join(", ")||"(none)"}`);Sn(this,"toolName");Sn(this,"availableTools");this.name="ToolNotFoundError",this.toolName=t,this.availableTools=n}};function I1(e){return JSON.stringify(e,(t,n)=>{if(n&&typeof n=="object"&&!Array.isArray(n)){const r={};for(const s of Object.keys(n).sort())r[s]=n[s];return r}if(n===void 0)return"__undefined__";if(typeof n=="number"){if(Number.isNaN(n))return"__NaN__";if(n===1/0)return"__Inf__";if(n===-1/0)return"__-Inf__"}return n})}function K3(e,t,n){const r=n!=null?"::"+I1(n):"";return e+"::"+I1(t)+r}function X3(e){const t=new Map,n=new Map,r=new Map,s=new Set;let c={__openui_loading:[],__openui_refetching:[],__openui_errors:[]},u=JSON.stringify(c),d=!1,f=0;function h(){const z={__openui_loading:[],__openui_refetching:[],__openui_errors:[]};for(const[_,P]of t){const B=r.get(P.cacheKey);if(B&&B.data!==void 0)z[_]=B.data;else if(P.prevCacheKey){const W=r.get(P.prevCacheKey);W&&W.data!==void 0?z[_]=W.data:z[_]=P.defaults}else z[_]=P.defaults;P.loading&&(z.__openui_loading.push(_),P.everFetched&&z.__openui_refetching.push(_)),P.error&&z.__openui_errors.push(P.error)}for(const[_,P]of n)z[_]=P.result,P.error&&z.__openui_errors.push(P.error);try{const _=JSON.stringify(z);if(_===u)return!1;c=z,u=_}catch{c=z,u=""}return!0}function g(){for(const z of[...s])z()}async function m(z,_){if(!e)return;const P=t.get(_);if(!P)return;const B=z,W=P.toolName,I=P.args;let D=r.get(B);D?D.inFlight=!0:(D={data:void 0,inFlight:!0},r.set(B,D)),P.loading=!0,h(),g();try{const F=await e.callTool(W,I??{});if(d)return;const V=t.get(_);if(!V||V.cacheKey!==B){D.inFlight=!1;return}if(D.data=F??null,V.everFetched=!0,V.error=void 0,V.prevCacheKey&&V.prevCacheKey!==B){const X=V.prevCacheKey;V.prevCacheKey=void 0,y(X)}}catch(F){const V=t.get(_);V&&V.cacheKey===B&&(F instanceof gm?V.error={source:"query",code:"tool-not-found",message:`Query tool "${W}" not found`,statementId:_,component:"Query",toolName:W,hint:F.availableTools.length?`Available tools: ${F.availableTools.join(", ")}`:void 0}:F instanceof mm?V.error={source:"query",code:"mcp-error",message:`Query "${W}" returned an error: ${F.toolErrorText}`,statementId:_,component:"Query",toolName:W}:V.error={source:"query",code:"tool-error",message:`Query "${W}" failed: ${F instanceof Error?F.message:String(F)}`,statementId:_,component:"Query",toolName:W}),console.error(`Query "${W}" failed:`,F)}finally{D.inFlight=!1;const F=t.get(_);F&&F.cacheKey===B?(F.loading=!1,h()&&g(),F.needsRefetch&&(F.needsRefetch=!1,m(F.cacheKey,_))):h()&&g()}}function y(z){for(const _ of t.values())if(_.cacheKey===z||_.prevCacheKey===z)return;r.delete(z)}function x(z){if(d)return;const _=new Set(z.map(P=>P.statementId));for(const[P,B]of t)_.has(P)||(B.timer&&clearInterval(B.timer),t.delete(P),y(B.cacheKey),B.prevCacheKey&&y(B.prevCacheKey));for(const P of z){if(!P.complete)continue;const B=K3(P.toolName,P.args,P.deps),W=t.get(P.statementId);W?(W.cacheKey!==B&&(W.prevCacheKey=W.cacheKey),W.toolName=P.toolName,W.args=P.args,W.defaults=P.defaults,W.cacheKey=B):t.set(P.statementId,{toolName:P.toolName,args:P.args,defaults:P.defaults,cacheKey:B,loading:!1,everFetched:!1,refreshInterval:0,needsRefetch:!1});const I=t.get(P.statementId),D=r.get(B),F=D&&D.data!==void 0&&!D.inFlight;e&&!F&&!(D!=null&&D.inFlight)&&m(B,P.statementId);const V=P.refreshInterval??0;V!==I.refreshInterval&&(I.timer&&(clearInterval(I.timer),I.timer=void 0),V>0&&(I.timer=setInterval(()=>{var X;d||!e||(X=r.get(I.cacheKey))!=null&&X.inFlight||m(I.cacheKey,P.statementId)},V*1e3)),I.refreshInterval=V)}h()&&g()}function k(z){const _=t.get(z);if(!_)return null;const P=r.get(_.cacheKey);if(P&&P.data!==void 0)return P.data;if(_.prevCacheKey){const B=r.get(_.prevCacheKey);if(B&&B.data!==void 0)return B.data}return _.defaults}function j(z){var _;return((_=t.get(z))==null?void 0:_.loading)??!1}function E(){for(const z of t.values())if(z.loading)return!0;return!1}function S(z){var P;if(d||!e)return;const _=z!=null&&z.length?z.filter(B=>t.has(B)):[...t.keys()];for(const B of _){const W=t.get(B);W&&((P=r.get(W.cacheKey))!=null&&P.inFlight?W.needsRefetch=!0:m(W.cacheKey,B))}}function T(z){const _=new Set(z.map(P=>P.statementId));for(const P of n.keys())_.has(P)||n.delete(P);for(const P of z){const B=n.get(P.statementId);B?B.toolName!==P.toolName&&(B.toolName=P.toolName,B.result={status:"idle",data:null,error:null},B.error=void 0):n.set(P.statementId,{toolName:P.toolName,result:{status:"idle"}})}h()&&g()}async function N(z,_,P){if(d||!e)return!1;const B=n.get(z);if(!B||B.result.status==="loading")return!1;const W=f;B.result={status:"loading"},h(),g();let I=!1;try{const D=await e.callTool(B.toolName,_);if(d||W!==f)return!1;B.result={status:"success",data:D},B.error=void 0,I=!0}catch(D){if(d||W!==f)return!1;const F=D instanceof Error?D.message:String(D);B.result={status:"error",error:F},D instanceof gm?B.error={source:"mutation",code:"tool-not-found",message:`Mutation tool "${B.toolName}" not found`,statementId:z,component:"Mutation",toolName:B.toolName,hint:D.availableTools.length?`Available tools: ${D.availableTools.join(", ")}`:void 0}:D instanceof mm?B.error={source:"mutation",code:"mcp-error",message:`Mutation "${B.toolName}" returned an error: ${D.toolErrorText}`,statementId:z,component:"Mutation",toolName:B.toolName}:B.error={source:"mutation",code:"tool-error",message:`Mutation "${B.toolName}" failed: ${F}`,statementId:z,component:"Mutation",toolName:B.toolName}}return h(),g(),I&&(P!=null&&P.length)&&S(P),I}function A(z){var _;return((_=n.get(z))==null?void 0:_.result)??null}function q(z){return s.add(z),()=>s.delete(z)}function R(){return c}function $(){d=!1}function H(){d=!0,f++,s.clear();for(const z of t.values())z.timer&&(clearInterval(z.timer),z.timer=void 0),z.loading=!1,z.needsRefetch=!1;n.clear()}return{evaluateQueries:x,getResult:k,isLoading:j,isAnyLoading:E,invalidate:S,registerMutations:T,fireMutation:N,getMutationResult:A,subscribe:q,getSnapshot:R,activate:$,dispose:H}}function J3(){const e=new Map,t=new Set;let n={};function r(){const m=[...t];for(const y of m)y()}function s(){n=Object.fromEntries(e)}function c(m){return e.get(m)}function u(m,y){const x=e.get(m);if(!Object.is(x,y)){if(y&&x&&typeof y=="object"&&typeof x=="object"&&!Array.isArray(y)&&!Array.isArray(x)){const k=Object.keys(y),j=Object.keys(x);if(k.length===j.length&&k.every(E=>Object.is(y[E],x[E])))return}e.set(m,y),s(),r()}}function d(m){return t.add(m),()=>{t.delete(m)}}function f(){return n}function h(m,y){for(const x of Object.keys(y))e.set(x,y[x]);for(const x of Object.keys(m))e.has(x)||e.set(x,m[x]);s(),r()}function g(){e.clear(),t.clear(),n={}}return{get:c,set:u,subscribe:d,getSnapshot:f,initialize:h,dispose:g}}function Ta(e){return S3(e)}function eI(e){return _3(e)}const bj=w.createContext(null);function xj(){const e=w.useContext(bj);if(!e)throw new Error("useOpenUI must be used within a <Renderer /> component.");return e}function tI(){return xj().renderNode}w.createContext(void 0);function bh(e){return e&&typeof e=="object"&&!Array.isArray(e)&&"value"in e?e.value:e}function nI({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:s,initialState:c,toolProvider:u,onError:d},f){const h=w.useMemo(()=>q3(t.toJSONSchema(),t.root),[t]),g=w.useRef(null),m=w.useMemo(()=>{if(g.current=null,!e)return null;try{return h.set(e)}catch(V){return g.current={source:"parser",code:"parse-exception",message:`Parser crashed: ${V instanceof Error?V.message:String(V)}`,hint:"The response may contain syntax the parser cannot handle"},null}},[h,e]),y=w.useMemo(()=>J3(),[]),x=w.useMemo(()=>X3(u??null),[u]);w.useEffect(()=>(x.activate(),()=>x.dispose()),[x]);const k=w.useRef(Symbol());w.useEffect(()=>{if(!(m!=null&&m.stateDeclarations)&&!c)return;const V=`${JSON.stringify(m==null?void 0:m.stateDeclarations)}::${JSON.stringify(c)}`;if(k.current===V)return;k.current=V;const X={};if(c)for(const[Q,L]of Object.entries(c))Q.startsWith("$")?X[Q]=L:y.set(Q,L);y.initialize((m==null?void 0:m.stateDeclarations)??{},X)},[m==null?void 0:m.stateDeclarations,y,c]);const j=w.useSyncExternalStore(y.subscribe,y.getSnapshot,y.getSnapshot),E=w.useSyncExternalStore(x.subscribe,x.getSnapshot,x.getSnapshot),S=w.useMemo(()=>({getState:V=>bh(y.get(V)),resolveRef:V=>{const X=x.getMutationResult(V);return X||x.getResult(V)}}),[y,x]);w.useEffect(()=>{if(n)return;const V=((m==null?void 0:m.queryStatements)??[]).map(X=>{const Q={};if(X.deps)for(const L of X.deps)Q[L]=j[L];return{statementId:X.statementId,toolName:X.toolAST?vt(X.toolAST,S):"",args:X.argsAST?vt(X.argsAST,S):null,defaults:X.defaultsAST?vt(X.defaultsAST,S):null,refreshInterval:X.refreshAST?vt(X.refreshAST,S):void 0,deps:Object.keys(Q).length>0?Q:void 0,complete:X.complete}});x.evaluateQueries(V)},[n,m==null?void 0:m.queryStatements,S,x,j]),w.useEffect(()=>{if(n)return;const V=((m==null?void 0:m.mutationStatements)??[]).map(X=>({statementId:X.statementId,toolName:X.toolAST?vt(X.toolAST,S):""}));x.registerMutations(V)},[n,m==null?void 0:m.mutationStatements,S,x]);const T=w.useRef({onAction:r,onStateUpdate:s,onError:d});T.current={onAction:r,onStateUpdate:s,onError:d};const N=w.useRef(m);N.current=m;const A=w.useRef(null);w.useEffect(()=>(A.current=y.getSnapshot(),y.subscribe(()=>{var X,Q;const V=y.getSnapshot();V!==A.current&&(A.current=null,(Q=(X=T.current).onStateUpdate)==null||Q.call(X,V))})),[y]);const q=w.useCallback((V,X)=>{if(!V)return bh(y.get(X));const Q=y.get(V);if(!(!Q||typeof Q!="object"||Array.isArray(Q)))return bh(Q[X])},[y]),R=w.useCallback((V,X,Q,L,U=!0)=>{var O,ne;const G={value:L,componentType:X};if(!V)y.set(Q,G);else{const ue=y.get(V),le=ue&&typeof ue=="object"&&!Array.isArray(ue)?ue:{};y.set(V,{...le,[Q]:G})}U&&((ne=(O=T.current).onStateUpdate)==null||ne.call(O,y.getSnapshot()))},[y]),$=w.useCallback(V=>{if(V){const X=y.get(V);if(X&&typeof X=="object"&&!Array.isArray(X))return{[V]:X}}return y.getSnapshot()},[y]),H=w.useCallback(async(V,X,Q)=>{var O,ne,ue;const L=$(X),{onAction:U}=T.current;if(Q&&!("steps"in Q)){const le=Q.type||vu.ContinueConversation,be={...Q.params||{}};Q.url&&(be.url=Q.url),Q.context&&(be.context=Q.context),U==null||U({type:le,params:be,humanFriendlyMessage:V,formState:L,formName:X});return}const G=Q;if(G!=null&&G.steps){for(const le of G.steps)switch(le.type){case Ma.Run:if(le.refType==="mutation"){const be=(ne=(O=N.current)==null?void 0:O.mutationStatements)==null?void 0:ne.find(Ee=>Ee.statementId===le.statementId),Re=be!=null&&be.argsAST?vt(be.argsAST,S):{};if(!await x.fireMutation(le.statementId,Re))return}else x.invalidate([le.statementId]);break;case Ma.ToAssistant:U==null||U({type:vu.ContinueConversation,params:le.context?{context:le.context}:{},humanFriendlyMessage:le.message,formState:L,formName:X});break;case Ma.OpenUrl:U==null||U({type:vu.OpenUrl,params:{url:le.url},humanFriendlyMessage:"",formState:L,formName:X});break;case Ma.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 Ma.Reset:{const be=((ue=N.current)==null?void 0:ue.stateDeclarations)??{};for(const Re of le.targets)y.set(Re,be[Re]??null);break}}return}U==null||U({type:vu.ContinueConversation,params:{},humanFriendlyMessage:V,formState:L,formName:X})},[x,S,$,y]),z=w.useRef([]),_=w.useRef(n);_.current=n;const P=w.useCallback(V=>{_.current||z.current.push(V)},[]),B=w.useMemo(()=>({library:t,renderNode:f,triggerAction:H,isStreaming:n,getFieldValue:q,setFieldValue:R,store:y,evaluationContext:S,reportError:P}),[t,f,n,H,q,R,y,S,P]),W=w.useRef([]),I=w.useMemo(()=>{if(!(m!=null&&m.root))return m;const V=[],X={ctx:S,library:t,store:y,errors:V};try{const Q=vj(m.root,X);return W.current=V,{...m,root:Q}}catch(Q){const L=Q instanceof Error?Q.message:String(Q);return V.push({source:"runtime",code:"runtime-error",message:`Prop evaluation failed: ${L}`}),W.current=V,m}},[m,S,t,y,j,E]),D=E.__openui_loading.length>0,F=w.useRef("");return w.useEffect(()=>{var Q,L,U,G;if(n){F.current!==""&&(F.current="",(L=(Q=T.current).onError)==null||L.call(Q,[]));return}const V=[];g.current&&V.push(g.current),e&&!(m!=null&&m.root)&&!g.current&&V.push({source:"parser",code:"parse-failed",message:m?"Code parsed but produced no renderable root component":"Response could not be parsed as valid openui-lang",hint:`The entire response must be valid openui-lang code starting with root = ${t.root??"Root"}(...)`}),(G=(U=m==null?void 0:m.meta)==null?void 0:U.errors)!=null&&G.length&&V.push(...V3(m.meta.errors,t.toJSONSchema(),Object.keys(t.components))),V.push(...W.current),V.push(...z.current),z.current=[],V.push(...E.__openui_errors??[]);const X=JSON.stringify(V);if(X!==F.current){if(F.current=X,T.current.onError)T.current.onError(V);else if(V.length>0)for(const O of V)console.warn(`[openui] ${O.source}/${O.code}: ${O.message}`)}},[n,e,m,I,E,t]),{result:I,parseResult:m,contextValue:B,isQueryLoading:D}}var aI=class extends w.Component{constructor(t){super(t);Sn(this,"lastValidChildren",null);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){this.state.hasError||(this.lastValidChildren=this.props.children)}componentDidUpdate(t){this.state.hasError||(this.lastValidChildren=this.props.children),this.state.hasError&&t.children!==this.props.children&&this.setState({hasError:!1})}componentDidCatch(t){var r,s;const n=this.props.componentName??"Unknown";(s=(r=this.props).onError)==null||s.call(r,{source:"runtime",code:"render-error",component:n,message:`Component ${n} render failed: ${t.message}`})}render(){return this.state.hasError?this.lastValidChildren:this.props.children}};function wj(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:wj(t)},n));if(typeof e=="object"&&e!==null){const t=e;if(t.type==="element")return o.jsx(kj,{node:t})}return null}function kj({node:e}){var s;const{library:t,reportError:n}=xj(),r=(s=t.components[e.typeName])==null?void 0:s.component;return r?o.jsx(aI,{componentName:e.typeName,onError:n,children:o.jsx(rI,{el:e,Comp:r})}):null}function rI({el:e,Comp:t}){const n=tI();return o.jsx(t,{props:e.props,renderNode:n})}let P1=!1;function iI(){if(P1||typeof document>"u")return;P1=!0;const e=document.createElement("style");e.textContent="@keyframes openui-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }",document.head.appendChild(e)}const sI=()=>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 oI({response:e,library:t,isStreaming:n=!1,onAction:r,onStateUpdate:s,initialState:c,onParseResult:u,toolProvider:d,queryLoader:f,onError:h}){w.useInsertionEffect(()=>{iI()},[]);const g=w.useRef(u);g.current=u;const m=w.useRef(d);m.current=d;const y=w.useRef({async callTool(S,T){const N=m.current??null;if(N==null)throw new Error("[openui] toolProvider is null");if(typeof N.callTool=="function")return Q3(await N.callTool({name:S,arguments:T}));const A=N,q=A[S];if(!q)throw new gm(S,Object.keys(A));return q(T)}}),{result:x,parseResult:k,contextValue:j,isQueryLoading:E}=nI({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:s,initialState:c,toolProvider:d!=null?y.current:null,onError:h},wj);return w.useEffect(()=>{var S;(S=g.current)==null||S.call(g,k)},[k]),x!=null&&x.root?o.jsx(bj.Provider,{value:j,children:o.jsxs("div",{style:{position:"relative"},children:[E&&(f??o.jsx(sI,{})),o.jsx("div",{style:{opacity:E?.7:1,transition:"opacity 0.2s ease"},children:o.jsx(kj,{node:x.root})})]})}):null}w.createContext(null);function lI(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 cI=({props:e,renderNode:t})=>{const n=e.children;return o.jsxs("div",{className:"v10-genui-root",children:[e.title?o.jsx("div",{className:"v10-genui-root-title",children:e.title}):null,Array.isArray(n)?n.map((r,s)=>o.jsx(Ze.Fragment,{children:t(r)},s)):t(n)]})},uI=({props:e})=>{var t;return o.jsxs("div",{className:"v10-genui-card v10-genui-entity-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("div",{className:"v10-genui-card-title",children:e.name}),e.typeLabel?o.jsx("div",{className:"v10-genui-card-type",children:e.typeLabel}):null]}),e.subtitle?o.jsx("div",{className:"v10-genui-card-subtitle",children:e.subtitle}):null,(t=e.chips)!=null&&t.length?o.jsx("div",{className:"v10-genui-chips",children:e.chips.map((n,r)=>o.jsxs("span",{className:`v10-genui-chip tone-${n.tone??"default"}`,children:[o.jsx("span",{className:"v10-genui-chip-label",children:n.label}),o.jsx("span",{className:"v10-genui-chip-value",children:n.value})]},r))}):null]})},dI=({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))}),pI=({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:Ig(t.predicate)}),o.jsx("div",{className:"v10-genui-triple-object",children:wI(t.object)})]},n))})]}),fI=({props:e})=>o.jsxs("div",{className:"v10-genui-section",children:[e.heading?o.jsx("div",{className:"v10-genui-section-heading",children:e.heading}):null,o.jsx("div",{className:"v10-genui-type-groups",children:e.groups.map((t,n)=>o.jsxs("div",{className:"v10-genui-type-group",children:[o.jsxs("div",{className:"v10-genui-type-group-head",children:[t.icon?o.jsx("span",{className:"v10-genui-type-icon",children:t.icon}):null,o.jsx("span",{className:"v10-genui-type-label",children:t.typeLabel}),o.jsx("span",{className:"v10-genui-type-count",children:t.items.length})]}),o.jsx("div",{className:"v10-genui-type-items",children:t.items.map((r,s)=>o.jsxs("div",{className:"v10-genui-type-item",title:r.uri,children:[o.jsx("div",{className:"v10-genui-type-item-label",children:r.label}),r.sub?o.jsx("div",{className:"v10-genui-type-item-sub",children:r.sub}):null]},s))})]},n))})]}),hI=({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:["· ",Ig(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))})]}),mI=({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(xu,{label:"Files",value:e.fileCount}),typeof e.classCount=="number"&&o.jsx(xu,{label:"Classes",value:e.classCount}),typeof e.functionCount=="number"&&o.jsx(xu,{label:"Functions",value:e.functionCount}),typeof e.interfaceCount=="number"&&o.jsx(xu,{label:"Interfaces",value:e.interfaceCount})]})]}),gI=({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:SI(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]})]}),vI=({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(wu,{heading:"Context",body:e.context}):null,e.outcome?o.jsx(wu,{heading:"Outcome",body:e.outcome}):null,e.consequences?o.jsx(wu,{heading:"Consequences",body:e.consequences}):null,e.alternatives?o.jsx(wu,{heading:"Alternatives considered",body:e.alternatives}):null]}),yI=({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=lI(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]}),bI=({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]})]}),xI=({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(Fi,{label:"tx",value:U1(e.onChain.txHash),mono:!0}):null,e.onChain.blockNumber?o.jsx(Fi,{label:"block",value:String(e.onChain.blockNumber),mono:!0}):null,e.onChain.chain?o.jsx(Fi,{label:"chain",value:e.onChain.chain}):null]}):null,e.consensus?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsxs("div",{className:"v10-genui-vm-block-heading",children:["Consensus ",e.consensus.quorum?o.jsx("span",{className:"v10-genui-vm-quorum",children:e.consensus.quorum}):null]}),(e.consensus.signers??[]).map((n,r)=>o.jsxs("div",{className:"v10-genui-vm-signer",children:[o.jsx("div",{className:"v10-genui-vm-signer-dot"}),o.jsxs("div",{className:"v10-genui-vm-signer-body",children:[o.jsx("div",{className:"v10-genui-vm-signer-label",children:n.label??kI(n.did)}),o.jsx("div",{className:"v10-genui-vm-signer-did",children:n.did})]}),typeof n.reputation=="number"?o.jsxs("div",{className:"v10-genui-vm-rep",children:["rep ",n.reputation]}):null]},r))]}):null,e.knowledgeAsset?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsx("div",{className:"v10-genui-vm-block-heading",children:"Knowledge asset"}),e.knowledgeAsset.ual?o.jsx(Fi,{label:"ual",value:e.knowledgeAsset.ual,mono:!0}):null,e.knowledgeAsset.contentHash?o.jsx(Fi,{label:"hash",value:U1(e.knowledgeAsset.contentHash),mono:!0}):null,e.knowledgeAsset.tracLocked?o.jsx(Fi,{label:"trac",value:e.knowledgeAsset.tracLocked}):null,e.knowledgeAsset.tokenId?o.jsx(Fi,{label:"nft",value:`#${e.knowledgeAsset.tokenId}`}):null]}):null,(t=e.timeline)!=null&&t.length?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsx("div",{className:"v10-genui-vm-block-heading",children:"Timeline"}),e.timeline.map((n,r)=>o.jsxs("div",{className:"v10-genui-vm-timeline-row",children:[o.jsx("div",{className:"v10-genui-vm-timeline-dot"}),o.jsx("div",{className:"v10-genui-vm-timeline-label",children:n.label}),o.jsx("div",{className:"v10-genui-vm-timeline-at",children:n.at})]},r))]}):null]})]})},xu=({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})]}),wu=({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})]}),Fi=({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 Ig(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 wI(e){return Ig(e).replace(/\^\^<?.*$/,"").replace(/^"(.+)"$/,"$1")}function U1(e){return e?e.length<=16?e:`${e.slice(0,8)}…${e.slice(-6)}`:""}function kI(e){return e?e.length>22?`${e.slice(0,12)}…${e.slice(-6)}`:e:""}function SI(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}const jI=Ta({name:"EntityDetail",description:"Root container for a single-entity detail view. Accepts any number of child blocks (EntityCard, PackageCard, VerifiedProvenancePanel, etc.). Always use this as the outermost element.",props:It({title:$e().optional().describe("Optional top-of-panel title override (defaults to the entity rdfs:label)")}),component:cI}),CI=Ta({name:"EntityCard",description:"Compact header card for any entity: name, rdf:type label, optional subtitle, and up to 6 small stat chips.",props:It({name:$e().describe("Display name / label of the entity"),typeLabel:$e().optional().describe('Human-readable rdf:type label (e.g. "Package", "Pull Request")'),subtitle:$e().optional().describe("Short supporting text (e.g. path, author, date)"),chips:Dr(It({label:$e(),value:$e(),tone:io(["default","success","warn","danger","info"]).optional()})).max(6).optional()}),component:uI}),NI=Ta({name:"EntityStatsGrid",description:"Grid of numeric stats with labels. Use for summarising counts (files, classes, additions, deletions).",props:It({stats:Dr(It({label:$e(),value:zg([$e(),ar()]),hint:$e().optional()})).min(1).max(8)}),component:dI}),EI=Ta({name:"TripleTable",description:"Fallback raw-triples table. Use sparingly — only when the entity has no better structured components in this library.",props:It({heading:$e().optional(),rows:Dr(It({predicate:$e(),object:$e()})).max(60)}),component:pI}),TI=Ta({name:"EntityTypeList",description:"Grouped list of child entities by rdf:type. Great for showing a File's contained classes/functions/interfaces as separate sections.",props:It({heading:$e().optional(),groups:Dr(It({typeLabel:$e(),icon:$e().optional(),items:Dr(It({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(30)})).max(8)}),component:fI}),AI=Ta({name:"CrossRefList",description:"List of cross-references following a single predicate (e.g. code:imports, github:affects, decisions:affects). Each item can show a short subtitle.",props:It({heading:$e().describe('Human-readable heading (e.g. "Imports", "Affected files")'),predicate:$e().optional(),items:Dr(It({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(40)}),component:hI}),RI=Ta({name:"PackageCard",description:"Specialised card for a code:Package entity: name, folder, description, and a mini-stats strip.",props:It({name:$e(),folder:$e().optional(),description:$e().optional(),fileCount:ar().optional(),classCount:ar().optional(),functionCount:ar().optional(),interfaceCount:ar().optional()}),component:mI}),_I=Ta({name:"FileCard",description:"Specialised card for a code:File entity: path, language, line count, owning package.",props:It({path:$e(),language:$e().optional(),lineCount:ar().optional(),packageName:$e().optional()}),component:gI}),OI=Ta({name:"DecisionCard",description:"Specialised card for a decisions:Decision entity: title, status badge, date, context/outcome quoted sections.",props:It({title:$e(),status:io(["proposed","accepted","rejected","superseded"]).optional(),date:$e().optional(),context:$e().optional(),outcome:$e().optional(),consequences:$e().optional(),alternatives:$e().optional()}),component:vI}),LI=Ta({name:"PRCard",description:"Specialised card for a github:PullRequest entity: title + #number, state, author, merged badge, body preview.",props:It({title:$e(),number:ar().optional(),state:io(["open","closed","merged"]).optional(),author:$e().optional(),mergedAt:$e().optional(),body:$e().optional(),url:$e().optional()}),component:yI}),zI=Ta({name:"TaskCard",description:"Specialised card for a tasks:Task entity: title, status chip, priority, assignee, estimate.",props:It({title:$e(),status:io(["todo","in_progress","blocked","done","cancelled"]).optional(),priority:io(["p0","p1","p2","p3"]).optional(),assignee:$e().optional(),estimate:ar().optional()}),component:bI}),MI=Ta({name:"VerifiedProvenancePanel",description:"The Verifiable Memory hero block. Use at the top of any entity in the VM layer. Surfaces on-chain anchor (tx hash, block), consensus (signing agents with reputation), knowledge-asset identity (UAL, content hash, TRAC locked, NFT token id), and finalisation timeline.",props:It({onChain:It({txHash:$e().optional(),blockNumber:zg([$e(),ar()]).optional(),chain:$e().optional()}).optional(),consensus:It({signers:Dr(It({did:$e(),label:$e().optional(),reputation:ar().optional(),signature:$e().optional()})).max(10).optional(),quorum:$e().optional().describe('e.g. "3 of 5"')}).optional(),knowledgeAsset:It({ual:$e().optional(),contentHash:$e().optional(),tracLocked:$e().optional(),tokenId:$e().optional()}).optional(),timeline:Dr(It({label:$e(),at:$e()})).max(6).optional()}),component:xI}),Sj=eI({components:[jI,CI,NI,EI,TI,AI,RI,_I,OI,LI,zI,MI],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 xh=null;function DI(){return xh===null&&(xh=Sj.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."]})),xh}async function*$I(e){const t=await fetch("/api/genui/render",{method:"POST",headers:{"Content-Type":"application/json",...qt()},body:JSON.stringify({contextGraphId:e.contextGraphId,entityUri:e.entityUri,libraryPrompt:e.libraryPrompt}),signal:e.signal});if(!t.ok||!t.body){let c=`HTTP ${t.status}`;try{const u=await t.json();u!=null&&u.error&&(c=u.error)}catch{}yield{type:"error",error:c};return}const n=t.body.getReader(),r=new TextDecoder;let s="";try{for(;;){const{value:c,done:u}=await n.read();if(u)break;s+=r.decode(c,{stream:!0});let d;for(;(d=s.indexOf(`
1622
-
1623
- `))!==-1;){const f=s.slice(0,d);s=s.slice(d+2);const h=B1(f);h&&(yield h)}}if(s.trim()){const c=B1(s);c&&(yield c)}}finally{n.releaseLock()}}function B1(e){let t="message",n="";for(const r of e.split(`
1624
- `))r.startsWith("event:")?t=r.slice(6).trim():r.startsWith("data:")&&(n+=r.slice(5).trim());if(!n)return null;try{const r=JSON.parse(n);switch(t){case"start":return{type:"start",...r};case"delta":return{type:"delta",text:r.text??""};case"final":return{type:"final",content:r.content??""};case"error":return{type:"error",error:r.error??"unknown error"};case"done":return{type:"done"};default:return null}}catch{return null}}const II=({contextGraphId:e,entityUri:t,placeholder:n,fallback:r})=>{const[s,c]=Ze.useState(""),[u,d]=Ze.useState(!0),[f,h]=Ze.useState(null);return Ze.useEffect(()=>{const g=new AbortController;let m="";return c(""),h(null),d(!0),(async()=>{try{const y=DI();for await(const x of $I({contextGraphId:e,entityUri:t,libraryPrompt:y,signal:g.signal}))if(x.type==="delta")m+=x.text,c(m);else if(x.type==="final")x.content&&(m=x.content,c(x.content));else if(x.type==="error"){h(x.error);break}else if(x.type==="done")break}catch(y){y.name!=="AbortError"&&h(y.message)}finally{d(!1)}})(),()=>g.abort()},[e,t]),f?r?o.jsx(o.Fragment,{children:r(f)}):o.jsx(UI,{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(oI,{response:s,library:Sj,isStreaming:u})})},PI="LLM not configured",UI=({error:e})=>{const t=yn(r=>r.openTab);return e.includes(PI)?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 F1({entity:e,profile:t}){const n=w.useMemo(()=>{for(const d of e.subGraphs)if(d!=="meta")return d;return null},[e.subGraphs]);if(!n||!t)return null;const r=t.forSubGraph(n),s=(r==null?void 0:r.color)??"#64748b",c=(r==null?void 0:r.icon)??"•",u=(r==null?void 0:r.displayName)??n;return o.jsxs("span",{className:"v10-subgraph-badge",style:{"--sg-color":s},title:`In sub-graph: ${u}`,children:[o.jsx("span",{className:"v10-subgraph-badge-icon",style:{color:s},children:c}),o.jsx("span",{className:"v10-subgraph-badge-label",children:u})]})}function BI({entity:e,contextGraphId:t,onVerified:n}){const r=Ir(),[s,c]=w.useState(!1),[u,d]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState(null),y=e.trustLevel,x=w.useMemo(()=>{if(!r)return null;for(const N of e.types){const A=r.forType(N);if(A&&(y==="working"&&(A.promoteLabel||A.promoteHint)||y==="shared"&&(A.publishLabel||A.publishHint)))return A}return null},[e.types,r,y]),k=w.useMemo(()=>{if(!r)return null;for(const N of e.subGraphs){if(N==="meta")continue;const A=r.forSubGraph(N);if(A!=null&&A.sourceAssertion)return{binding:A,subGraph:N}}return null},[e.subGraphs,r]);if(y==="verified"||!x)return null;const j=y==="working"?{kind:"promote",label:x.promoteLabel??"Promote to Shared Memory",hint:x.promoteHint??"Shares this entity with the team.",busyCopy:"Sharing…",disabled:!(k!=null&&k.binding.sourceAssertion),disabledReason:k!=null&&k.binding.sourceAssertion?null:`No sourceAssertion declared on the sub-graph profile — add profile:sourceAssertion to the SubGraphBinding for "${[...e.subGraphs].filter(N=>N!=="meta")[0]??"?"}".`}:{kind:"publish",label:x.publishLabel??"Verify on DKG",hint:x.publishHint??"Anchors this entity on-chain.",busyCopy:"Anchoring…",disabled:!(k!=null&&k.binding.sourceAssertion),disabledReason:k!=null&&k.binding.sourceAssertion?null:"This entity is not part of a named Shared-Memory asset, so it cannot be published to Verifiable Memory from here."},E=async()=>{if(j.disabled)return;c(!0),m(null),d(null),h(j.kind);const N=(k==null?void 0:k.binding.sourceAssertion)??"assertion";try{if(j.kind==="promote"){const A=await eo(t,k.binding.sourceAssertion,[e.uri],k.subGraph);d(ag(N,A))}else{const A=await tg(t,k.binding.sourceAssertion,k.subGraph?{subGraphName:k.subGraph}:{});d(A)}n()}catch(A){const q=j.kind==="promote"?to(N,A):null,R=A instanceof eg?A.message:q?q.message:(A==null?void 0:A.message)??"Action failed";m(R)}finally{c(!1)}},S=N=>!!N&&"status"in N,T=N=>!!N&&"kind"in N;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:E,disabled:s||j.disabled,children:s?j.busyCopy:j.label}),g&&o.jsxs("div",{className:"v10-ka-verify-err",children:["✕ ",g]}),u&&f==="promote"&&T(u)&&u.kind==="success"&&o.jsxs("div",{className:"v10-ka-verify-ok",children:[o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Promoted"}),o.jsxs("span",{className:"v10-ka-verify-ok-val",children:["✓ ",u.promotedCount," triple",u.promotedCount===1?"":"s"," now in Shared Memory"]})]}),o.jsx("div",{className:"v10-ka-verify-hint",style:{marginTop:6},children:"Refresh the entity to see the next step appear."})]}),u&&f==="promote"&&T(u)&&u.kind!=="success"&&o.jsxs("div",{className:"v10-ka-verify-err",children:["! ",u.message]}),u&&f==="publish"&&S(u)&&(()=>{var q,R;const N=u.status==="confirmed"&&!!u.txHash,A=N&&!!u.contextGraphError;return o.jsxs("div",{className:N?A?"v10-ka-verify-warn":"v10-ka-verify-ok":"v10-ka-verify-err",children:[o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Status"}),o.jsxs("span",{className:"v10-ka-verify-ok-val",children:[N?A?"⚠":"✓":"✕"," ",u.status,N?A?` (${C2})`:"":" (NOT on-chain)"]})]}),A&&o.jsx("div",{className:"v10-ka-verify-hint",style:{marginTop:6},children:Rl(u.contextGraphError)}),u.txHash?o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"TX hash"}),o.jsx("span",{className:"v10-ka-verify-ok-val mono",title:u.txHash,children:u.txHash})]}):o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"TX hash"}),o.jsx("span",{className:"v10-ka-verify-ok-val",children:"none — on-chain submission skipped"})]}),u.blockNumber!=null&&o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Block"}),o.jsxs("span",{className:"v10-ka-verify-ok-val mono",children:["#",u.blockNumber]})]}),((R=(q=u.kas)==null?void 0:q[0])==null?void 0:R.tokenId)&&o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Token"}),o.jsxs("span",{className:"v10-ka-verify-ok-val mono",children:["#",u.kas[0].tokenId]})]})]})})()]})}function FI({entity:e,allEntities:t,allTriples:n,onNavigate:r,onClose:s,contextGraphId:c,onRefresh:u,onOpenAgent:d}){const[f,h]=w.useState("content"),g=qn(I=>I.theme),m=Ir(),y=ns(),{icon:x,type:k}=jd(e,m),j=JO(e),E=Sd(e),S=E?(y==null?void 0:y.get(E))??null:null,T=e.trustLevel==="verified"?"vm":e.trustLevel==="shared"?"swm":"wm",N=e.trustLevel==="verified"?"Verifiable Memory":e.trustLevel==="shared"?"Shared Working Memory":"Working Memory",A=Lr(e.trustLevel,1),q=w.useMemo(()=>{const I=[];for(const[,D]of t)for(const F of D.connections)F.targetUri===e.uri&&I.push({pred:Bs(F.predicate),entity:D});return I},[e.uri,t]),R=w.useMemo(()=>n.filter(I=>bt(I.subject)===e.uri||bt(I.object)===e.uri),[e.uri,n]),$=w.useMemo(()=>eL(e.uri,n,1),[e.uri,n]),H=w.useMemo(()=>{const I=new Set;for(const D of t.values())lS(D)&&I.add(bt(D.uri));return I},[t]),z=w.useMemo(()=>new Set([bt(e.uri)]),[e.uri]),_=w.useMemo(()=>Ku($,H,{focalSubjects:z}),[$,H,z]),P=w.useMemo(()=>{const I=Gi[e.trustLevel];return{labelMode:"humanized",renderer:"2d",labels:wd({minZoomForLabels:.2}),style:{namespaceColors:gg(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]),B=w.useMemo(()=>({name:`entity-${e.uri}-${g}`,palette:g,focal:{uri:e.uri,sizeMultiplier:2.4}}),[e.uri,g]),W=R.length;return o.jsxs("div",{className:"v10-ka-detail",children:[o.jsxs("div",{className:"v10-ka-header",children:[o.jsx("button",{className:"v10-ka-back",onClick:s,children:"← Back to Context Graph"}),o.jsxs("div",{className:"v10-ka-header-left",children:[o.jsx("div",{className:"v10-ka-label",children:A}),o.jsxs("div",{className:"v10-ka-name",children:[x," ",e.label,o.jsx("span",{className:`v10-trust-badge ${T}`,children:N})]}),o.jsxs("div",{className:"v10-ka-ual",children:[e.uri," · ",k," · ",W," triples"]})]}),(S||E)&&o.jsxs("div",{className:"v10-ka-header-author",children:[o.jsx("div",{className:"v10-ka-header-author-label",children:"Proposed by"}),o.jsx(Yi,{agent:S??void 0,fallbackUri:E??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(D=>m==null?void 0:m.forType(D)).find(D=>D==null?void 0:D.detailHint)||!(m!=null&&m.contextGraphId)?null:o.jsx("div",{className:"v10-ka-section",children:o.jsx(II,{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,D])=>o.jsxs("div",{className:"v10-ka-prop",children:[o.jsx("span",{className:"v10-ka-prop-key",children:Bs(I)}),o.jsx("span",{className:"v10-ka-prop-val",children:D.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,D)=>{const F=t.get(I.targetUri);return o.jsxs("button",{className:"v10-ka-conn",onClick:()=>r(I.targetUri),children:[o.jsx("span",{className:"v10-ka-conn-pred",children:Bs(I.predicate)}),o.jsx("span",{className:"v10-ka-conn-arrow",children:"→"}),o.jsx("span",{className:"v10-ka-conn-target",children:I.targetLabel}),F&&o.jsx(F1,{entity:F,profile:m})]},D)})]}),q.length>0&&o.jsxs("div",{className:"v10-ka-section",children:[o.jsxs("div",{className:"v10-ka-section-title",children:["Referenced by (",q.length,")"]}),q.map((I,D)=>o.jsxs("button",{className:"v10-ka-conn",onClick:()=>r(I.entity.uri),children:[o.jsx("span",{className:"v10-ka-conn-target",children:I.entity.label}),o.jsx(F1,{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})]},D))]}),o.jsxs("div",{className:"v10-ka-meta",children:[o.jsxs("span",{className:"v10-ka-meta-item",children:[x," ",k]}),o.jsxs("span",{className:"v10-ka-meta-item",children:[W," triples"]}),o.jsxs("span",{className:"v10-ka-meta-item",children:[e.connections.length," links"]})]})]}),f==="triples"&&o.jsxs("div",{style:{marginTop:8,overflowX:"auto",border:"1px solid var(--border-default)",borderRadius:6},children:[o.jsxs("table",{className:"v10-ka-triples-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Subject"}),o.jsx("th",{children:"Predicate"}),o.jsx("th",{children:"Object"})]})}),o.jsx("tbody",{children:R.slice(0,50).map((I,D)=>o.jsxs("tr",{children:[o.jsx("td",{title:I.subject,children:Bs(I.subject)}),o.jsx("td",{title:I.predicate,children:Bs(I.predicate)}),o.jsx("td",{title:I.object,children:I.object.startsWith('"')?kd(I.object).slice(0,60):Bs(I.object)})]},D))})]}),o.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",padding:"6px 8px"},children:[Math.min(R.length,50)," of ",R.length," triples shown"]})]}),f==="graph"&&o.jsx(Du,{title:`${e.label} graph`,scopeLabel:`Entity detail graph: 1-hop neighborhood around ${e.label}.`,tone:T,className:"v10-ka-graph-shell",renderGraph:I=>_.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(Sg,{data:_,format:"triples",options:P,viewConfig:B,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:D=>(D==null?void 0:D.id)&&D.id!==e.uri&&r(D.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:c,entityUri:e.uri,enabled:e.trustLevel==="verified"}),o.jsx("div",{className:"v10-ka-section-title",children:"Provenance Trail"}),o.jsx(HI,{entity:e}),o.jsx(BI,{entity:e,contextGraphId:c,onVerified:u}),o.jsxs("div",{style:{marginTop:16,padding:"10px 12px",borderRadius:6,background:"var(--bg-surface)",border:"1px solid var(--border-subtle)"},children:[o.jsx("div",{className:"v10-ka-section-title",style:{marginBottom:6},children:"Entity Summary"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4,fontSize:10},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Type"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:k})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Triples"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:W})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Links"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:e.connections.length})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Layer"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:N.split(" ")[0]})]})]})]})]})]})]})}function HI({entity:e}){const t=ns(),n=u=>{const d=QO(e,u),f=KO(e,u),h=d?t==null?void 0:t.get(d):null;return{uri:d,at:f,agent:h}},r=n("created"),s=n("promoted"),c=n("published");return o.jsxs("div",{className:"v10-ka-timeline",children:[e.trustLevel==="verified"&&o.jsx(wh,{toneClass:"verified",title:"Published to Verifiable Memory",actionWord:"Published",agent:c.agent,agentUri:c.uri,at:c.at}),(e.trustLevel==="shared"||e.trustLevel==="verified")&&o.jsx(wh,{toneClass:"shared",title:"Promoted to Shared Working Memory",actionWord:"Promoted",agent:s.agent,agentUri:s.uri,at:s.at}),o.jsx(wh,{toneClass:"created",title:"Created in Working Memory",actionWord:"Created",agent:r.agent,agentUri:r.uri,at:r.at})]})}function wh({toneClass:e,title:t,actionWord:n,agent:r,agentUri:s,at:c}){const u=c?rL(c):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:c??void 0,children:u})]}),(r||s)&&o.jsxs("div",{className:"v10-ka-event-attribution",children:[o.jsxs("span",{className:"v10-ka-event-attribution-prefix",children:[n," by"]}),o.jsx(Yi,{agent:r??void 0,fallbackUri:s??void 0,size:"sm"})]})]})}function H1(){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 qI({contextGraphId:e,memory:t,onNodeClick:n,onSelectSubGraph:r}){const s=Ir(),[c,u]=w.useState([]),[d,f]=w.useState(!0),[h,g]=w.useState(null);w.useEffect(()=>{let R=!1;return f(!0),g(null),sg(e).then($=>{R||u($.subGraphs??[])}).catch($=>{R||g($ instanceof Error?$.message:"Failed to load subgraphs")}).finally(()=>{R||f(!1)}),()=>{R=!0}},[e]);const{total:m}=yg(t),y=Object.values(t.layerStatus??{}),x=t.loading||y.some(R=>R==="loading"),k=t.error!==null||t.partial||y.some(R=>R==="error"),j=w.useMemo(()=>{const R=new Map;for(const $ of t.entityList){const H=bt($.uri);for(const z of $.subGraphs){let _=R.get(z);_||(_=new Set,R.set(z,_)),_.add(H)}}return R},[t.entityList]),{triplesBySubGraph:E,tripleCountBySubGraph:S}=w.useMemo(()=>{const R=new Map;for(const z of t.allTriples){if(!z.subGraph)continue;let _=R.get(z.subGraph);_||(_=[],R.set(z.subGraph,_)),_.push(z)}for(const z of t.allTriples)if(!z.subGraph){for(const[_,P]of j)if(tm(z,{slug:_,isRoot:!1,scopedUris:P})){let B=R.get(_);B||(B=[],R.set(_,B)),B.push(z)}}const $=new Map,H=new Map;for(const[z,_]of R){const B=nm(_,t.entities).map(W=>({subject:W.subject,predicate:W.predicate,object:W.object}));H.set(z,B.length),$.set(z,Qx(B))}return{triplesBySubGraph:$,tripleCountBySubGraph:H}},[t.allTriples,t.entities,j]),T=w.useMemo(()=>{const R=new Map;for(const $ of t.entityList)for(const H of $.subGraphs){let z=R.get(H);z||(z={wm:0,swm:0,vm:0},R.set(H,z)),$.trustLevel==="verified"?z.vm++:$.trustLevel==="shared"?z.swm++:z.wm++}return R},[t.entityList]),N=w.useMemo(()=>{const R=new Map;for(const $ of t.entityList){const H=bt($.uri);for(const z of $.subGraphs){let _=R.get(z);_||(_=new Map,R.set(z,_)),_.set(H,$.trustLevel),H!==$.uri&&_.set($.uri,$.trustLevel)}}return R},[t.entityList]),A=w.useMemo(()=>c.filter(bg).map(R=>{const $=(s==null?void 0:s.forSubGraph(R.name))??{},H=E.get(R.name)??[],z=j.get(R.name)??new Set,_=N.get(R.name)??new Map;return{slug:R.name,icon:$.icon??"•",color:$.color??"#64748b",displayName:$.displayName??R.name,description:$.description,rank:$.rank??99,entityCount:z.size>0?z.size:R.entityCount,tripleCount:S.get(R.name)??0,triples:Ku(H,z),layerCounts:T.get(R.name)??{wm:0,swm:0,vm:0},entityTrustByUri:_}}).sort((R,$)=>R.rank-$.rank),[c,s,E,S,T,j,N]),q=w.useMemo(()=>{const R=[],$=new Set,H=new Map;let z=0,_=0,P=0;for(const X of t.entityList){if(X.subGraphs.size>0)continue;R.push(X);const Q=bt(X.uri);$.add(Q),H.set(Q,X.trustLevel),Q!==X.uri&&H.set(X.uri,X.trustLevel),X.trustLevel==="verified"?P++:X.trustLevel==="shared"?_++:z++}const B=t.allTriples.filter(X=>!X.subGraph),W=nm(B,t.entities).map(X=>({subject:X.subject,predicate:X.predicate,object:X.object})),I=W.length,D=Ku(W,$),F=Qx(D),V=(s==null?void 0:s.forSubGraph(za))??{};return{slug:za,icon:V.icon??"⊘",color:V.color??"#64748b",displayName:V.displayName??"Root",description:V.description,rank:999,entityCount:R.length,tripleCount:I,triples:F,layerCounts:{wm:z,swm:_,vm:P},entityTrustByUri:H}},[t.entityList,t.allTriples,t.entities,s]);return d&&A.length===0?o.jsx(on,{compact:!0,icon:"#",title:"Loading subgraphs...",className:"v10-sgov-state"}):h&&A.length===0?o.jsx(on,{icon:"!",title:"Couldn't load subgraphs.",description:"Refresh the page to try again.",tone:"danger",className:"v10-sgov-state"}):A.length===0&&q.entityCount===0?o.jsx(on,{icon:"#",title:"No subgraphs in this Context Graph yet.",description:o.jsxs(o.Fragment,{children:["A subgraph is a named topical slice of this Context Graph (e.g. ",o.jsx("code",{children:"recipes"}),", ",o.jsx("code",{children:"decisions"}),"). Agents create one when they scope an assertion to a subgraph. All current entities live in the Context Graph root."]}),actions:[{label:"View root",onClick:()=>r(za),variant:"primary"}],className:"v10-sgov-state"}):o.jsxs("div",{className:"v10-sgov",children:[o.jsxs("div",{className:"v10-sgov-header",children:[o.jsx("div",{className:"v10-sgov-title",children:"Subgraphs"}),o.jsxs("div",{className:"v10-sgov-sub",children:[A.length," named subgraphs · ",t.counts.total," entities · ",m," triples"]})]}),o.jsxs("div",{className:"v10-sgov-grid",children:[A.map(R=>o.jsx(q1,{card:R,isHydrating:x,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>r(R.slug)},R.slug)),o.jsx(q1,{card:q,isHydrating:x,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>r(za),variant:"root"},za)]})]})}function q1({card:e,isHydrating:t=!1,isFailedOrPartial:n=!1,onNodeClick:r,onOpen:s,variant:c}){const u=w.useMemo(()=>{const h={};for(const[g,m]of e.entityTrustByUri)h[g]=Gi[m];return h},[e.entityTrustByUri]),d=w.useMemo(()=>({labelMode:"humanized",renderer:"2d",labels:wd({minZoomForLabels:.8}),style:{classColors:hS,predicateColors:mS,namespaceColors:gg(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=c==="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(jj,{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(Sg,{data:e.triples,format:"triples",options:d,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:r,initialFit:!0})})})]})}function jj({counts:e,activeLayers:t,onClickLayer:n,compact:r=!1}){const s=e.wm+e.swm+e.vm;if(s===0)return r?null:o.jsx("div",{className:"v10-minibar v10-minibar-empty",children:"No data"});const c=[{key:"verified",short:"VM",count:e.vm,color:"#22c55e",label:"Verifiable"},{key:"shared",short:"SWM",count:e.swm,color:"#f59e0b",label:"Shared"},{key:"working",short:"WM",count:e.wm,color:"#64748b",label:"Working"}],u=!!n;return o.jsxs("div",{className:`v10-minibar${r?" compact":""}`,children:[!r&&o.jsx("div",{className:"v10-minibar-bar",children:c.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:c.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 GI({items:e,color:t,onSelectEntity:n,scrollKey:r}){const s=Ir(),c=ns(),u=w.useMemo(()=>{const d=new Map;for(const f of e){const h=`${f.date.getFullYear()}-${String(f.date.getMonth()+1).padStart(2,"0")}`,g=d.get(h)??[];g.push(f),d.set(h,g)}return[...d.entries()].sort((f,h)=>f[0].localeCompare(h[0]))},[e]);return e.length===0?o.jsx("div",{className:"v10-subgraph-timeline-empty","data-cg-scroll-key":r,children:o.jsx(on,{compact:!0,title:"No timeline values yet.",description:"Entities in this sub-graph do not currently expose the configured timeline field."})}):o.jsx("div",{className:"v10-subgraph-timeline","data-cg-scroll-key":r,children:u.map(([d,f])=>o.jsxs("div",{className:"v10-subgraph-timeline-bucket",children:[o.jsxs("div",{className:"v10-subgraph-timeline-bucket-head",children:[o.jsx("span",{className:"v10-subgraph-timeline-bucket-dot",style:{background:t}}),o.jsx("span",{className:"v10-subgraph-timeline-bucket-label",children:iL(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}=jd(h,s),y=Sd(h),x=y?c==null?void 0:c.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}),(x||y)&&o.jsx(Yi,{agent:x??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 VI({slug:e,rawMemory:t,contextGraphId:n,onNodeClick:r,onSelectEntity:s,activeTab:c,onTabChange:u,initialLayer:d,initialEnabledLayers:f,onEnabledLayersChange:h}){const g=Ir(),m=g==null?void 0:g.forSubGraph(e),y=(g==null?void 0:g.chipsFor(e))??[],x=(g==null?void 0:g.savedQueryCatalogsFor(e))??[],k=m==null?void 0:m.timelinePredicate,[j,E]=w.useState("items"),S=c??j,T=S==="timeline"&&!k?"items":S,N=u??E,[A,q]=w.useState(m!=null&&m.timelinePredicate?"created-desc":"triples");w.useEffect(()=>{q(m!=null&&m.timelinePredicate?"created-desc":"triples")},[e,m==null?void 0:m.timelinePredicate]);const R=w.useMemo(()=>f&&f.size>0?new Set(f):d==="wm"?new Set(["working"]):d==="swm"?new Set(["shared"]):d==="vm"?new Set(["verified"]):new Set(["working","shared","verified"]),[d,f]),[$,H]=w.useState(R);w.useEffect(()=>{h==null||h($)},[$,h]);const[z,_]=w.useState(new Map),[P,B]=w.useState(null),[W,I]=w.useState(null),[D,F]=w.useState(!1),[V,X]=w.useState(null),Q=e===za,L=w.useMemo(()=>{const ee=[];for(const ce of t.entityList)(Q?ce.subGraphs.size===0:ce.subGraphs.has(e))&&ee.push(ce);return ee},[t.entityList,e,Q]),U=w.useMemo(()=>new Set(L.map(ee=>ee.uri)),[L]),G=w.useMemo(()=>t.graphTriples.filter(ee=>tm(ee,{slug:e,isRoot:Q,scopedUris:U})),[t.graphTriples,U,e,Q]),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($.size!==1)return null;const ee=$.values().next().value;return ee==="verified"?"vm":ee==="shared"?"swm":ee==="working"?"wm":null},[$]),ue=w.useMemo(()=>{let ee=L;if($.size<3&&(ee=ee.filter(ce=>$.has(ce.trustLevel))),z.size>0)for(const ce of y){const he=z.get(ce.slug);!he||he.size===0||(ee=ee.filter(Le=>{const He=Le.properties.get(ce.predicate);return!He||He.length===0?!1:He.some(Ce=>he.has(Ce))}))}return W&&(ee=ee.filter(ce=>W.has(ce.uri))),ee},[L,$,z,y,W]),le=w.useMemo(()=>new Set(ue.map(ee=>ee.uri)),[ue]),be=w.useMemo(()=>ue.length===L.length?G:G.filter(ee=>le.has(ee.subject)||le.has(ee.object)),[G,L,ue,le]),Ee=w.useMemo(()=>{if(!ne)return null;const ee=ne==="vm"?"verified":ne==="swm"?"shared":"working",ce=L.filter(Ce=>{if(!Ce.layers.has(ee))return!1;if(z.size>0)for(const Fe of y){const et=z.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!(W&&!W.has(Ce.uri))}),he=new Set(ce.map(Ce=>Ce.uri)),Le=new Set,He=[];for(const Ce of t.allTriples){if(Ce.layer!==ee||!tm(Ce,{slug:e,isRoot:Q,scopedUris:U,requireResourceObject:!0})||!(he.has(Ce.subject)||he.has(Ce.object)))continue;const Fe=`${Ce.subject}|${Ce.predicate}|${Ce.object}`;Le.has(Fe)||(Le.add(Fe),He.push({subject:Ce.subject,predicate:Ce.predicate,object:Ce.object,subGraph:Ce.subGraph}))}return He},[ne,t.allTriples,U,e,Q,L,y,z,W])??be,Ie=w.useMemo(()=>{if(ne){const ee=ne==="vm"?"verified":ne==="swm"?"shared":"working";return L.filter(ce=>{if(!ce.layers.has(ee))return!1;if(z.size>0)for(const he of y){const Le=z.get(he.slug);if(!Le||Le.size===0)continue;const He=ce.properties.get(he.predicate);if(!He||He.length===0||!He.some(Ce=>Le.has(Ce)))return!1}return!(W&&!W.has(ce.uri))})}return ue},[ne,L,ue,y,z,W]),Ve=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]=Gi[ce.trustLevel];const he=bt(ce.uri);he!==ce.uri&&(ee[he]=Gi[ce.trustLevel])}return ee},[ne,Ie]),ht=$.size===3?"All layers":ne?Mn[ne].title:Array.from($).map(ee=>Mn[ee==="verified"?"vm":ee==="shared"?"swm":"wm"].trustLabel).join(" + "),Me=w.useMemo(()=>{if(!k)return[];const ee=[];for(const ce of ue){const he=Mu(ce,k);he!=null&&ee.push({entity:ce,date:new Date(he)})}return ee.sort((ce,he)=>ce.date.getTime()-he.date.getTime()),ee},[ue,k]),qe=w.useMemo(()=>{const ee=[...ue];if((A==="created-desc"||A==="created-asc")&&k){const ce=A==="created-desc"?-1:1;return ee.sort((he,Le)=>{const He=Mu(he,k),Ce=Mu(Le,k);return He==null&&Ce==null?0:He==null?1:Ce==null?-1:(He-Ce)*ce}),ee}return A==="label"?(ee.sort((ce,he)=>(ce.label??"").localeCompare(he.label??"")),ee):(ee.sort((ce,he)=>{const Le=ce.tripleCount??0;return(he.tripleCount??0)-Le}),ee)},[ue,A,k]),ke=A==="created-desc"?"newest first · click to open":A==="created-asc"?"oldest first · click to open":A==="label"?"A → Z · click to open":"sorted by triples · click to open",ct=w.useCallback(ee=>{H(ce=>{const he=new Set(ce);return he.has(ee)?he.size>1&&he.delete(ee):he.add(ee),he})},[]),xe=w.useCallback((ee,ce)=>{_(he=>{const Le=new Map(he),He=new Set(Le.get(ee)??[]);return He.has(ce)?He.delete(ce):He.add(ce),He.size===0?Le.delete(ee):Le.set(ee,He),Le})},[]),Oe=w.useCallback(()=>{B(null),I(null),X(null)},[]),_t=w.useCallback(async ee=>{var ce;F(!0),X(null),B(ee.slug);try{const he=await ia(ee.sparql,n),Le=((ce=he==null?void 0:he.result)==null?void 0:ce.bindings)??[],He=ee.resultColumn||"uri",Ce=new Set;for(const Fe of Le){const et=Fe[He];if(!et)continue;const Ne=typeof et=="string"?et:String(et),Wt=Ne.startsWith("<")&&Ne.endsWith(">")?Ne.slice(1,-1):Ne;Ce.add(Wt)}I(Ce)}catch(he){X((he==null?void 0:he.message)??String(he)),I(null),B(null)}finally{F(!1)}},[n]),Dt=(m==null?void 0:m.color)??(Q?"var(--text-tertiary)":"#64748b"),Qt=(m==null?void 0:m.icon)??"•",Ft=(m==null?void 0:m.displayName)??e,dt=m==null?void 0:m.description;w.useEffect(()=>{H(R),_(new Map),Oe()},[e,Oe,R]),w.useEffect(()=>{c||E("items")},[e,c]),w.useEffect(()=>{S!==T&&N(T)},[S,T,N]);const K=!($.size===R.size&&[...$].every(ee=>R.has(ee)))||z.size>0||!!W,Z=()=>{H(new Set(R)),_(new Map),Oe()};return o.jsxs("div",{className:"v10-layer-detail v10-subgraph-detail",style:{"--sg-color":Dt},children:[o.jsxs("div",{className:"v10-subgraph-detail-header",children:[o.jsx("span",{className:"v10-subgraph-detail-icon",style:{color:Dt},children:Qt}),o.jsxs("div",{className:"v10-subgraph-detail-title-wrap",children:[o.jsx("div",{className:"v10-subgraph-detail-title",children:Ft}),dt&&o.jsx("div",{className:"v10-subgraph-detail-desc",children:dt})]}),o.jsx(jj,{counts:{wm:O.wm,swm:O.swm,vm:O.vm},activeLayers:$,onClickLayer:ct,compact:!0})]}),o.jsxs("div",{className:"v10-subgraph-cross-layer",children:[o.jsx("div",{className:"v10-subgraph-cross-layer-lede",children:Q?"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":$.has("working"),onClick:()=>ct("working"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Gi.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":$.has("shared"),onClick:()=>ct("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:Gi.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":$.has("verified"),onClick:()=>ct("verified"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Gi.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${$.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:ht})]})]}),x.length>0&&o.jsxs("div",{className:"v10-subgraph-savedqueries",children:[o.jsx("span",{className:"v10-subgraph-savedqueries-label",children:"Query catalog"}),x.map(ee=>o.jsxs(Ze.Fragment,{children:[o.jsx("span",{className:"v10-subgraph-savedqueries-label",title:ee.description||ee.name,style:{marginLeft:8,opacity:.8},children:ee.name}),ee.queries.map(ce=>{const he=P===ce.slug;return o.jsxs("button",{type:"button",className:`v10-subgraph-savedquery${he?" active":""}`,onClick:()=>he?Oe():_t(ce),title:ce.description||ce.name,disabled:D&&!he,children:[o.jsx("span",{className:"v10-subgraph-savedquery-glyph",children:D&&he?"…":he?"✓":"◎"}),ce.name]},ce.slug)})]},ee.slug)),V&&o.jsx("span",{className:"v10-subgraph-savedquery-error",title:V,children:"✕ query failed"}),W&&P&&o.jsxs("span",{className:"v10-subgraph-savedquery-count",children:[W.size," match",W.size===1?"":"es"]})]}),y.length>0&&o.jsxs("div",{className:"v10-subgraph-filters",children:[y.map(ee=>{const ce=z.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)}),K&&o.jsx("button",{type:"button",className:"v10-subgraph-filter-reset",onClick:Z,children:"Reset filters"})]}),o.jsxs("div",{className:"v10-layer-detail-body",children:[o.jsxs("div",{className:"v10-layer-expand-tabs",children:[o.jsxs("button",{className:`v10-layer-expand-tab ${T==="items"?"active":""}`,onClick:()=>N("items"),children:["Entities (",ue.length,ue.length!==L.length?` / ${L.length}`:"",")"]}),o.jsx("button",{className:`v10-layer-expand-tab ${T==="graph"?"active":""}`,onClick:()=>N("graph"),children:"Graph"}),k&&o.jsx("button",{className:`v10-layer-expand-tab ${T==="timeline"?"active":""}`,onClick:()=>N("timeline"),children:"Timeline"}),o.jsx("button",{className:`v10-layer-expand-tab ${T==="docs"?"active":""}`,onClick:()=>N("docs"),children:"Documents"})]}),T==="items"&&o.jsx("div",{className:"v10-layer-expand-body entities-tab","data-cg-scroll-key":`subgraph:${e}:items`,children:o.jsx(_S,{entities:qe,layerKey:"wm",layerIcon:Qt,onSelectEntity:s,externallySorted:!0,sortLabel:ke,timestampPredicate:k,perEntityTrustBadge:!0,headerExtra:o.jsxs("label",{className:"v10-entity-list-sort",children:[o.jsx("span",{className:"v10-entity-list-sort-label",children:"Sort"}),o.jsxs("select",{className:"v10-entity-list-sort-select",value:A,onChange:ee=>q(ee.target.value),"aria-label":"Sort entities",children:[k&&o.jsxs(o.Fragment,{children:[o.jsx("option",{value:"created-desc",children:"Newest first"}),o.jsx("option",{value:"created-asc",children:"Oldest first"})]}),o.jsx("option",{value:"triples",children:"Most triples"}),o.jsx("option",{value:"label",children:"Label (A→Z)"})]})]})})}),T==="graph"&&o.jsx("div",{className:"v10-layer-expand-body full-width","data-cg-scroll-key":`subgraph:${e}:graph`,children:o.jsx(RS,{layer:ne??"wm",triples:Ee,onNodeClick:r,contextGraphId:n,title:Ft,scopeLabel:`Subgraph graph: ${Ft} entities and entity-to-entity triples from loaded subgraph data.`,trustLegendActiveLayer:ne,scopeEntities:Ve,layerEntities:Ie,nodeColorsOverride:Se})}),T==="timeline"&&k&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(GI,{items:Me,color:Dt,onSelectEntity:s,scrollKey:`subgraph:${e}:timeline`})}),T==="docs"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(OS,{entities:ue,contextGraphId:n,scrollKey:`subgraph:${e}:docs`})})]})]})}const WI={wm:"items",swm:"items",vm:"items"},G1={wm:"working",swm:"shared",vm:"verified"};function kh(e){return e==="wm"||e==="swm"||e==="vm"}function ZI(e){const t=new Set;return e.filter(n=>{const r=`${bt(n.subject)}|${n.predicate}|${bt(n.object)}`;return t.has(r)?!1:(t.add(r),!0)})}function V1(e,t){if(typeof document>"u")return t;const n=document.querySelectorAll("[data-cg-scroll-key]");for(const r of n)if(r.dataset.cgScrollKey===e)return r;return t}function YI({contextGraphId:e}){const{data:t,error:n,loading:r,refresh:s}=Ea(Tn.fetchContextGraphs,[],3e4),[c,u]=w.useState(!1),[d,f]=w.useState(!1),[h,g]=w.useState("overview"),[m,y]=w.useState(null),[x,k]=w.useState({contextGraphId:null,list:[],status:"loading"}),[j,E]=w.useState(null),[S,T]=w.useState(!1),N=w.useRef(0),[A,q]=w.useState(null),[R,$]=w.useState(null),H=w.useRef(null),[z,_]=w.useState(null),P=w.useCallback(de=>{H.current=de,_(de)},[]),B=w.useRef(null),W=w.useCallback(de=>{B.current=de,de===null&&(H.current=null,_(null)),q(de)},[]),[I,D]=w.useState(null),F=w.useRef(null);w.useEffect(()=>{F.current=m},[m]);const[V,X]=w.useState(WI),[Q,L]=w.useState({}),U=w.useRef(null),G=w.useRef(null),O=w.useRef(null),ne=w.useRef(0),ue=_L(e),le=$L(e),be=yn(de=>de.openTab),{data:Re,loading:Ee,error:Ie}=bd(),Ve=w.useCallback(()=>A?`subgraph:${A}:${Q[A]??"items"}`:kh(h)?`layer:${h}:${V[h]}`:"page",[h,A,V,Q]),Se=w.useCallback(de=>{const je=de??Ve(),Te=V1(je,U.current);return{activeLayer:h,activeSubGraph:A,layerTabs:{...V},subGraphTabs:{...Q},scroll:{key:je,top:(Te==null?void 0:Te.scrollTop)??0},subGraphEnabledLayers:A!==null&&H.current?new Set(H.current):null}},[h,A,Ve,V,Q]),ht=w.useCallback(de=>{const je=()=>{const Te=V1(de.key,U.current);Te&&(Te.scrollTop=de.top)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(je):setTimeout(je,0)},[]),Me=w.useCallback((de,je)=>{(!F.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,ht(de))},[m,h,A,V,Q,ht]),w.useEffect(()=>{const de=je=>{const Te=je.detail;Te&&Te.contextGraphId===e&&typeof Te.entityUri=="string"&&(D(null),Me(Te.entityUri))};return window.addEventListener("v10:open-entity",de),()=>window.removeEventListener("v10:open-entity",de)},[e,Me]);const ke=w.useCallback(de=>{var tt;const je=de.startsWith("urn:dkg:agent:")?de.slice(14):de,Te=((tt=le.get(de))==null?void 0:tt.name)??je;be({id:`agent:${e}|${je}`,label:`@ ${Te}`,closable:!0})},[le,e,be]),ct=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=mg(e,{signalErrors:!0}),_t=yg(Oe).total,Dt=FO({activeLayer:h,activeSubGraph:A}),Qt=NS(Dt?e:void 0),Ft=!A&&h==="overview",dt=GL(Ft?e:void 0),ye=Ft?dt.resultContextGraphId===e?dt.events:[]:void 0,K=Ft&&dt.resultContextGraphId===e?dt.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(Te=>{ne.current===je&&k({contextGraphId:de,list:Te.allowedAgents,status:"ok"})}).catch(()=>{ne.current===je&&k({contextGraphId:de,list:[],status:"error"})})},[xe==null?void 0:xe.id]);w.useEffect(()=>{Z()},[Z]);const ee=w.useCallback(()=>{const de=++N.current;Tn.fetchSubGraphs(e).then(je=>{if(N.current!==de)return;const Te=(je.subGraphs??[]).filter(bg).length;E(Te),T(!1)}).catch(()=>{N.current===de&&(E(null),T(!0))})},[e]);w.useEffect(()=>{E(null),T(!1),ee()},[ee]),po(e,ee);const ce=I?G1[I]:null,he=w.useMemo(()=>ce?Oe.allTriples.filter(de=>de.layer===ce):Oe.graphTriples,[Oe.allTriples,Oe.graphTriples,ce]),Le=w.useMemo(()=>ce?ZI(he):he,[he,ce]),He=w.useMemo(()=>ce?oS(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),D(null),qe())},[m,Ce,Oe.loading,qe]);const Fe=w.useCallback((de,je)=>{const Te=B.current;if(qe(),W(de),de===null)$(null);else if(je!==void 0){const tt=new Set([G1[je]]);$(tt),H.current=tt,_(tt)}else{if(Te!==null&&de===Te)return;if(Te!==null&&H.current){const tt=new Set(H.current);$(tt),H.current=tt,_(tt)}else $(null),H.current=null,_(null)}y(null),D(null)},[qe,W]),et=w.useCallback(de=>{qe(),g(de),y(null),D(null),W(null),$(null)},[qe,W]),Ne=w.useCallback((de,je)=>{X(Te=>Te[de]===je?Te:{...Te,[de]:je})},[]),Wt=w.useCallback((de,je)=>{L(Te=>Te[de]===je?Te:{...Te,[de]:je})},[]),At=w.useCallback((de,je,Te)=>{const tt=F.current!=null;Me(de,je),D(Je=>Te??(tt?Je:null))},[Me]),Ha=w.useCallback(()=>{const de=G.current;if(G.current=null,y(null),D(null),!!de){if(g(de.activeLayer),W(de.activeSubGraph),de.activeSubGraph!==null&&de.subGraphEnabledLayers){const je=new Set(de.subGraphEnabledLayers);$(je),H.current=je,_(je)}X(de.layerTabs),L(de.subGraphTabs),O.current=de.scroll}},[W]),la=w.useCallback(de=>{if(!(de!=null&&de.id))return;const je=kh(de.trustLayer)?de.trustLayer:void 0;At(de.id,void 0,je)},[At]),Ur=w.useCallback(de=>{const je=kh(h)?h:void 0;At(de,void 0,je)},[h,At]),Br=w.useCallback(de=>{At(de,"page")},[At]),ca=w.useCallback(()=>{be(TS)},[be]),qa=!!n&&/authentication|unauthor|expired|sign in|log in/i.test(n);if(!xe)return n||t&&!r?o.jsxs("div",{className:"v10-view-placeholder",children:[o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:12,marginBottom:10},children:n?qa?n:"Failed to load context graph.":"Context graph not found."}),qa?o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:()=>window.location.reload(),children:"Refresh page"}):o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:s,children:"Retry"})]}):o.jsx("div",{className:"v10-view-placeholder",children:o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:12},children:"Loading context graph..."})});const or=A?ue.forSubGraph(A):null,Fr=!Oe.loading&&!Oe.error&&!Oe.partial?Oe.entityList:void 0,wi=Ce?"entity":A?"subgraph":h,ge=x.contextGraphId===xe.id?x.list:[],ze=x.contextGraphId===xe.id?x.status:"loading";return o.jsx(SS.Provider,{value:ue,children:o.jsx(CS.Provider,{value:ct,children:o.jsxs("div",{className:"v10-memory-explorer",children:[n&&o.jsx("div",{className:"v10-stale-banner",role:"status",children:qa?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:n}),o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:()=>window.location.reload(),children:"Refresh page"})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Couldn’t refresh context-graph data — showing last known values."}),o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:s,children:"Retry"})]})}),o.jsx(C4,{cg:xe,profile:ue,activeSubGraph:or,onClearSubGraph:()=>Fe(null)}),o.jsx(j4,{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":wi,"data-cg-scroll-key":"page",ref:U,children:[Ce&&o.jsx(FI,{entity:Ce,allEntities:He,allTriples:Le,onNavigate:At,onClose:Ha,contextGraphId:e,onRefresh:Oe.refresh}),A&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(H1,{}),o.jsx(dh,{contextGraphId:e,profile:ue,selected:A,entities:Fr,onSelect:Fe,enabledScope:z??void 0,allTriplesTotal:_t}),o.jsx(VI,{slug:A,rawMemory:Oe,contextGraphId:e,onNodeClick:la,onSelectEntity:At,activeTab:Q[A]??"items",onTabChange:de=>Wt(A,de),initialEnabledLayers:R??void 0,onEnabledLayersChange:P})]}),!A&&h==="overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(_4,{cg:xe,memory:Oe,subGraphCount:j,subGraphFetchFailed:S,participants:ge,participantsStatus:ze,currentAgent:Re??null,currentAgentStatus:Ee?"loading":Ie?"error":"ok",onSwitchLayer:et,onOpenPrimer:ca}),o.jsx(O4,{contextGraphId:e,curatorStatus:A4({cg:xe,currentAgent:Re??null,currentAgentStatus:Ee?"loading":Ie?"error":"ok"}),onParticipantsChanged:Z}),Oe.loading&&o.jsx("div",{className:"v10-me-loading",children:o.jsx("div",{className:"v10-me-loading-text",children:"Loading memory..."})}),Oe.error&&o.jsxs("div",{className:"v10-me-error",children:["Error: ",Oe.error]}),o.jsx("div",{"data-section":"activity",children:o.jsx(u4,{entities:Oe.entityList,lifecycleEvents:ye,lifecycleError:K,onSelectEntity:Br,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(L4,{onOpenPrimer:ca})]}),!A&&h==="graph-overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(H1,{}),o.jsx(dh,{contextGraphId:e,profile:ue,selected:null,entities:Fr,onSelect:Fe,allTriplesTotal:_t}),o.jsx(qI,{contextGraphId:e,memory:Oe,onNodeClick:la,onSelectSubGraph:Fe})]}),!A&&h==="query"&&!Ce&&o.jsx(rz,{contextGraphId:e}),!A&&(h==="wm"||h==="swm"||h==="vm")&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(dh,{contextGraphId:e,profile:ue,selected:A,entities:Fr,onSelect:Fe,layer:h}),o.jsx(G4,{layer:h,memory:Oe,onNodeClick:la,onSelectEntity:Ur,contextGraphId:e,activeTab:V[h],onTabChange:de=>Ne(h,de),swmAttribution:Qt})]})]}),o.jsx(vL,{open:c,onClose:()=>u(!1),contextGraphId:xe.id,contextGraphName:xe.name}),o.jsx(bL,{open:d,onClose:()=>f(!1),contextGraphId:xe.id,contextGraphName:xe.name})]})})})}const QI=[{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 KI(){const e=yn(n=>n.closeTab),t=Ze.useCallback(()=>e(kg),[e]);return Ze.useEffect(()=>{const n=r=>{r.key==="Escape"&&(r.preventDefault(),t())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),o.jsxs("div",{className:"v10-primer-view",children:[o.jsxs("header",{className:"v10-primer-header",children:[o.jsx("button",{type:"button",className:"v10-primer-back",onClick:t,"aria-label":"Close primer and return to the previous tab",children:"← Back"}),o.jsx("p",{className:"v10-primer-kicker",children:"Context Graph Primer"}),o.jsx("h1",{children:"What is a Context Graph?"}),o.jsx("p",{children:"A Context Graph is a shared knowledge workspace where agents stage, review, organize, and publish structured memory."})]}),o.jsxs("section",{className:"v10-primer-pipeline","aria-label":"Context Graph pipeline",children:[o.jsx("span",{className:"wm",children:"Working Memory"}),o.jsx("span",{className:"connector","aria-hidden":"true"}),o.jsx("span",{className:"swm",children:"Shared Working Memory"}),o.jsx("span",{className:"connector","aria-hidden":"true"}),o.jsx("span",{className:"vm",children:"Verifiable Memory"})]}),o.jsx("div",{className:"v10-primer-sections",children:QI.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 XI={"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 W1(e){const t=XI[e];return t?t==="markdown"?"text":t:"binary"}async function Z1(e){const t=await fetch(e,{headers:qt()});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=await t.blob();return URL.createObjectURL(n)}function JI({open:e,onClose:t,assertionName:n,contextGraphId:r,subGraphName:s}){const[c,u]=w.useState(null),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(!0),[x,k]=w.useState(null);w.useEffect(()=>{if(e)return y(!0),k(null),u(null),f(null),g(null),j2(n,r,s).then(async A=>{u(A);const q=W1(A.detectedContentType),R=Ru(A.fileHash,A.detectedContentType);if(q==="text"){const $=await fetch(R,{headers:qt()});$.ok&&f(await $.text())}else if(q==="pdf"||q==="image"){const $=await Z1(R);g($)}}).catch(A=>k(A.message??"Failed to load file info")).finally(()=>y(!1)),()=>{h&&URL.revokeObjectURL(h)}},[e,n,r,s]),w.useEffect(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);const{dialogRef:j,onBackdropClick:E}=Zi(e,t);if(!e)return null;const S=c?W1(c.detectedContentType):null,T=c?Ru(c.fileHash,c.detectedContentType):null,N=async(A,q)=>{try{const R=await Z1(A),$=document.createElement("a");$.href=R,$.download=q,$.click(),URL.revokeObjectURL(R)}catch{window.open(A,"_blank")}};return o.jsx("div",{className:"v10-modal-overlay",onClick:E,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..."}),x&&o.jsxs("div",{className:"v10-file-preview-error",children:[o.jsx("p",{children:x}),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."})]}),c&&!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:c.detectedContentType}),o.jsxs("span",{className:"v10-file-preview-meta-item",children:[c.tripleCount," triples extracted"]}),o.jsx("span",{className:"v10-file-preview-meta-item",children:c.pipelineUsed}),c.completedAt&&o.jsx("span",{className:"v10-file-preview-meta-item",children:new Date(c.completedAt).toLocaleString()})]}),o.jsxs("div",{className:"v10-file-preview-content",children:[S==="pdf"&&h&&o.jsx("iframe",{src:h,className:"v10-file-preview-iframe",title:`Preview: ${n}`}),S==="image"&&h&&o.jsx("img",{src:h,alt:n,className:"v10-file-preview-image"}),S==="text"&&d!=null&&o.jsx("pre",{className:"v10-file-preview-text",children:d}),S==="binary"&&o.jsxs("div",{className:"v10-file-preview-binary",children:[o.jsx("p",{children:"This file type cannot be previewed directly."}),T&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>N(T,n),children:"Download file"})]})]}),o.jsxs("div",{className:"v10-file-preview-footer",children:[T&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>N(T,n),children:"Download original"}),c.mdIntermediateHash&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>N(Ru(c.mdIntermediateHash,"text/markdown"),`${n}.md`),children:"Download markdown intermediate"})]})]})]})})}const e6=w.lazy(()=>Ba(()=>import("./index-BrxEjqsW.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),t6=w.lazy(()=>Ba(()=>import("./index-BrxEjqsW.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.NodePanel}))),n6=w.lazy(()=>Ba(()=>import("./OnChainProvenanceCard-BbrU7jzL.js"),__vite__mapDeps([2,0,1])).then(e=>({default:e.OnChainProvenanceCard}))),a6={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."}},r6={labelMode:"humanized",renderer:"2d",labels:wd({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}},i6=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"})]}),s6=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 Sh({layer:e,contextGraphId:t,externalQuery:n,externalQueryKey:r,queryPresetOptions:s}){var Ie,Ve;const c=a6[e],[u,d]=w.useState("graph"),[f,h]=w.useState(""),[g,m]=w.useState(""),[y,x]=w.useState(""),[k,j]=w.useState(""),[E,S]=w.useState("any"),[T,N]=w.useState(50),[A,q]=w.useState(""),[R,$]=w.useState("any"),[H,z]=w.useState(50),[_,P]=w.useState(e!=="vm"),B=Ze.useRef(e);Ze.useEffect(()=>{B.current!==e&&(B.current=e,h(""),P(e!=="vm"),m(""),x(""),j(""),S("any"),N(50),q(""),$("any"),z(50))},[e]),Ze.useEffect(()=>{n!==void 0&&(h(""),m(n),x(n))},[n,r]);const W=w.useMemo(()=>e==="wm"?`SELECT ?s ?p ?o WHERE { GRAPH <${`did:dkg:context-graph:${t}/_meta`}> { ?g <http://dkg.io/ontology/memoryLayer> "WM" } GRAPH ?g { ?s ?p ?o } FILTER(!CONTAINS(STR(?g), "/meta/assertion/")) } LIMIT 1000`:e==="vm"?c6({query:A,field:R,limit:H}):"SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 500",[t,e,R,H,A]),I=y||W,D=e==="swm"?"_shared_memory":void 0,F=e==="swm",V=e==="vm"?"verifiable-memory":void 0,X=e==="wm"&&I===W,{data:Q,loading:L,error:U,refresh:G}=Ea(()=>ia(I,t,F,D,V,X),[I,t,F,D,V,X],0);po(t,G,{layers:[e]});const{data:O}=Ea(Ym,[],3e4),ne=O==null?void 0:O.blockExplorerUrl,ue=w.useCallback(()=>{const Se=g.trim();if(Se===y){G();return}x(Se)},[y,g,G]),le=w.useCallback(()=>{const Se=k!==A||E!==R||T!==H;if(Se&&(q(k),$(E),z(T)),y){x("");return}Se||G()},[y,R,H,A,E,T,k,G]),be=((Ie=Q==null?void 0:Q.result)==null?void 0:Ie.bindings)??((Ve=Q==null?void 0:Q.results)==null?void 0:Ve.bindings)??[],Re=w.useMemo(()=>be.map(Se=>({subject:Hs(Se.s)??"",predicate:Hs(Se.p)??"",object:Hs(Se.o)??""})).filter(Se=>Se.subject&&Se.predicate&&Se.object),[be]),Ee=w.useCallback(Se=>{Se!=null&&Se.id&&x(`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:c.color},children:c.icon}),o.jsxs("div",{children:[o.jsx("h2",{className:"v10-mlv-title",children:c.label}),o.jsx("p",{className:"v10-mlv-desc",children:c.description})]})]}),e==="wm"&&o.jsx(o6,{contextGraphId:t,onPromoted:G}),e==="swm"&&o.jsx(l6,{contextGraphId:t,onPublished:G}),e==="vm"&&o.jsxs("div",{className:"v10-vm-search-panel",children:[o.jsxs("div",{className:"v10-vm-search-header",children:[o.jsxs("div",{children:[o.jsx("div",{className:"v10-vm-search-title",children:"Search Verifiable Memory"}),o.jsx("div",{className:"v10-vm-search-desc",children:"Search published triples by subject, predicate, object, or across all fields."})]}),o.jsx("button",{className:"v10-vm-search-toggle",type:"button",onClick:()=>P(Se=>!Se),children:_?"Hide SPARQL":"Advanced SPARQL"})]}),o.jsxs("div",{className:"v10-vm-search-controls",children:[o.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Search verifiable memory...",value:k,onChange:Se=>j(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&le()}}),o.jsxs("select",{className:"v10-vm-search-select",value:E,onChange:Se=>S(Se.target.value),children:[o.jsx("option",{value:"any",children:"Any field"}),o.jsx("option",{value:"subject",children:"Subject"}),o.jsx("option",{value:"predicate",children:"Predicate"}),o.jsx("option",{value:"object",children:"Object"})]}),o.jsxs("select",{className:"v10-vm-search-select",value:String(T),onChange:Se=>N(Number.parseInt(Se.target.value,10)||50),children:[o.jsx("option",{value:"25",children:"25 rows"}),o.jsx("option",{value:"50",children:"50 rows"}),o.jsx("option",{value:"100",children:"100 rows"}),o.jsx("option",{value:"200",children:"200 rows"})]}),o.jsx("button",{className:"v10-mlv-run-btn",onClick:le,children:"Search"})]})]}),(e!=="vm"||_)&&o.jsxs("div",{className:"v10-mlv-query-bar",children:[s!=null&&s.length?o.jsxs("select",{className:"v10-vm-search-select",value:f,onChange:Se=>{const ht=Se.target.value;h(ht);const Me=s.find(ke=>ke.label===ht),qe=(Me==null?void 0:Me.query)??"";m(qe),x(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:()=>x(""),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:i6}),o.jsx("button",{className:`v10-mlv-toggle-btn ${u==="graph"?"active":""}`,onClick:()=>d("graph"),title:"Graph view",children:s6})]})]}),L&&o.jsx("p",{className:"v10-mlv-status",children:"Loading..."}),U&&o.jsxs("p",{className:"v10-mlv-status",style:{color:"var(--accent-red)"},children:["Error: ",U]}),!L&&be.length===0&&o.jsxs("div",{className:"v10-mlv-empty",children:[o.jsxs("p",{children:["No triples found in ",c.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,ht)=>o.jsxs("tr",{children:[o.jsx("td",{className:"v10-mlv-cell",children:jh(Hs(Se.s))}),o.jsx("td",{className:"v10-mlv-cell",children:jh(Hs(Se.p))}),o.jsx("td",{className:"v10-mlv-cell",children:jh(Hs(Se.o))})]},ht))})]})]}),!L&&Re.length>0&&u==="graph"&&o.jsxs("div",{className:"v10-mlv-graph-container",children:[o.jsxs("div",{className:"v10-mlv-graph-info",children:[o.jsxs("span",{children:[Re.length," triples"]}),y&&o.jsx("span",{className:"v10-mlv-graph-info-custom",children:"filtered"})]}),o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"v10-mlv-graph-loading",children:"Loading graph renderer..."}),children:o.jsxs(e6,{data:Re,format:"triples",options:r6,style:{width:"100%",height:"100%"},onNodeClick:Ee,initialFit:!0,children:[o.jsx(t6,{className:"v10-mlv-node-panel",showUri:!0,showTypes:!0,showProperties:!0,showMetadata:!1,maxValueLength:150}),o.jsx(n6,{contextGraphId:t,layer:e,explorerUrl:ne})]})})]})]})}function o6({contextGraphId:e,onPromoted:t}){const{data:n,loading:r,refresh:s}=Ea(()=>Al(e,"wm"),[e],0);po(e,s,{layers:["wm"]});const[c,u]=w.useState(null),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(null),x=w.useCallback(async j=>{u(j.graphUri),f(null),g(null);try{const E=await eo(e,j.name,"all",j.subGraph),S=ag(j.name,E);f({message:S.message+(j.subGraph?` (in ${j.subGraph})`:""),kind:S.kind==="success"?"success":"noop",subGraph:j.subGraph}),s(),t()}catch(E){const S=to(j.name,E);g(S?{message:S.message,kind:"not-persisted"}:{message:(E==null?void 0:E.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,E=0,S=null;try{for(const N of n){S=N.name;const A=await eo(e,N.name,"all",N.subGraph);j+=A.promotedCount,A.promotedCount===0&&(E+=1)}const T=E>0?` (${E} assertion${E===1?"":"s"} had nothing to promote)`:"";f({message:j>0?`Promoted ${j} triple${j===1?"":"s"} across ${n.length} assertion${n.length===1?"":"s"}.${T}`:"No triples were promoted — every assertion was already in Shared Working Memory or its content has not been committed yet.",kind:j>0?"success":"noop"}),s(),t()}catch(T){const N=to(S??"selected assertion",T);g(N?{message:N.message,kind:"not-persisted"}:{message:(T==null?void 0:T.message)??"Promote failed",kind:"other"})}finally{u(null)}},[n,e,s,t]);return r?o.jsx("div",{className:"v10-assertion-list-loading",children:"Loading assertions..."}):n!=null&&n.length?o.jsxs("div",{className:"v10-assertion-list",children:[o.jsxs("div",{className:"v10-assertion-list-header",children:[o.jsxs("span",{className:"v10-assertion-list-title",children:["Assertions in Working Memory (",n.length,")"]}),o.jsx("button",{className:"v10-btn-promote-all",disabled:c!==null,onClick:k,children:c==="__all__"?"Promoting...":"Promote All → SWM"})]}),o.jsx("div",{className:"v10-assertion-items",children:n.map(j=>o.jsxs("div",{className:"v10-assertion-item",children:[o.jsxs("div",{className:"v10-assertion-item-info",children:[o.jsx("button",{className:"v10-assertion-item-name clickable",title:j.graphUri,onClick:()=>y({name:j.name,subGraph:j.subGraph}),children:j.name}),j.tripleCount!=null&&o.jsxs("span",{className:"v10-assertion-item-count",children:[j.tripleCount," triples"]}),j.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${j.subGraph}`,children:["› ",Ng(j.subGraph,18)]})]}),o.jsx("button",{className:"v10-btn-promote",disabled:c!==null,onClick:()=>x(j),title:"Copy these triples to Shared Working Memory",children:c===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(JI,{open:!0,onClose:()=>y(null),assertionName:m.name,subGraphName:m.subGraph,contextGraphId:e})]}):null}function l6({contextGraphId:e,onPublished:t}){const{data:n,loading:r,refresh:s}=Ea(()=>Al(e,"swm"),[e],0);po(e,s,{layers:["swm"]});const[c,u]=w.useState(new Set),[d,f]=w.useState(!1),[h,g]=w.useState(null),[m,y]=w.useState(null),x=(n==null?void 0:n.map($=>$.graphUri))??[],k=x.length>0&&x.every($=>c.has($)),j=w.useCallback($=>{u(H=>{const z=new Set(H);return z.has($)?z.delete($):z.add($),z})},[]),E=w.useCallback(()=>{u(k?new Set:new Set(x))},[k,x]),S=w.useCallback(async $=>{if($.length!==0){f(!0),g(null),y(null);try{g(await ng(e,$)),u(new Set),s(),t()}catch(H){y((H==null?void 0:H.message)??"Publish failed")}finally{f(!1)}}},[e,s,t]),T=w.useCallback(()=>{const $=(n??[]).filter(H=>c.has(H.graphUri));return S($)},[n,c,S]),N=w.useCallback(()=>S(n??[]),[n,S]),A=(n==null?void 0:n.reduce(($,H)=>$+(H.tripleCount??0),0))??0,q=(n==null?void 0:n.filter($=>c.has($.graphUri)).reduce(($,H)=>$+(H.tripleCount??0),0))??0,R=!r&&(!n||n.length===0);return r?o.jsx("div",{className:"v10-assertion-list-loading",children:"Loading SWM contents..."}):R?o.jsxs("div",{className:"v10-publish-panel",children:[o.jsx("div",{className:"v10-publish-panel-header",children:o.jsx("span",{className:"v10-publish-panel-title",children:"Publish to Verifiable Memory"})}),o.jsx("div",{className:"v10-publish-panel-empty",children:"No data in Shared Working Memory yet. Promote assertions from Working Memory first."})]}):o.jsxs("div",{className:"v10-publish-panel",children:[o.jsxs("div",{className:"v10-publish-panel-header",children:[o.jsxs("span",{className:"v10-publish-panel-title",children:["Knowledge assets in Shared Working Memory (",n.length," asset",n.length===1?"":"s"," · ",A," triples)"]}),o.jsxs("div",{className:"v10-publish-panel-header-actions",children:[o.jsx("button",{className:"v10-publish-panel-refresh",onClick:s,title:"Refresh",children:"↻"}),o.jsx("button",{className:"v10-btn-promote-all",disabled:d,onClick:N,children:d&&c.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:E}),o.jsx("span",{children:"Select all"})]}),c.size>0&&o.jsx("button",{className:"v10-btn-publish",disabled:d,onClick:T,children:d?"Publishing...":`Publish ${c.size} selected (${q} triples) → VM`})]}),o.jsx("div",{className:"v10-assertion-items",children:n.map($=>o.jsxs("div",{className:`v10-assertion-item ${c.has($.graphUri)?"selected":""}`,children:[o.jsx("label",{className:"v10-publish-entity-check",children:o.jsx("input",{type:"checkbox",checked:c.has($.graphUri),onChange:()=>j($.graphUri)})}),o.jsxs("div",{className:"v10-assertion-item-info",children:[o.jsx("span",{className:"v10-assertion-item-name",title:$.graphUri,children:$.name}),$.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${$.subGraph}`,children:["› ",Ng($.subGraph,18)]}),$.tripleCount!=null&&o.jsxs("span",{className:"v10-assertion-item-count",children:[$.tripleCount," triples"]})]})]},$.graphUri))}),h&&(()=>{const{published:$,total:H,sealed:z,partial:_,partialError:P,failures:B,sample:W}=h,I=$===H&&$>0&&_===0,D=(W==null?void 0:W.status)==="confirmed"&&!!W.txHash;return o.jsxs("div",{className:`v10-publish-result-card ${I?"success":"error"}`,children:[o.jsx("div",{className:"v10-publish-result-title",children:$>0?`Published ${$} of ${H} knowledge asset${H===1?"":"s"} to Verifiable Memory`:"NOT published to Verifiable Memory"}),z>0&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:[z," asset",z===1?" was":"s were"," sealed in Shared Memory before publishing."]}),_>0&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:["⚠ ",_," asset",_===1?"":"s",": ",Rl(P)]}),B.length>0&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:[B.length," asset",B.length===1?"":"s"," could not be published — ",B[0].name,": ",B[0].error,B.length>1?` (+${B.length-1} more)`:""]}),o.jsxs("div",{className:"v10-publish-result-details",children:[(W==null?void 0:W.kaId)!=null&&o.jsxs("div",{children:[o.jsx("span",{className:"v10-publish-result-label",children:"Knowledge Asset:"})," ",W.kaId]}),D?o.jsxs("div",{className:"v10-publish-result-tx",children:[o.jsx("span",{className:"v10-publish-result-label",children:"Tx hash:"})," ",o.jsx("span",{className:"mono",title:W.txHash,children:W.txHash}),W.blockNumber!=null&&o.jsxs("span",{className:"v10-publish-result-block",children:[" (block ",W.blockNumber,")"]})]}):o.jsxs("div",{className:"v10-publish-result-details",children:["Verifiable Memory requires a confirmed ",o.jsx("code",{children:"KCCreated"})," event. If a publish did not land on-chain, check the node logs (typically a missing publisher wallet, an unfunded signer, or a chain adapter that isn't V10-ready)."]})]})]})})(),m&&o.jsx("div",{className:"v10-publish-result-card error",children:m})]})}function Hs(e){if(e!=null)return typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function jh(e){if(!e)return"—";const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function c6(e){const t=Number.isFinite(e.limit)&&e.limit>0?Math.floor(e.limit):50,n=e.query.trim();if(!n)return`SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT ${t}`;const r=u6(n.toLowerCase()),s={subject:`CONTAINS(LCASE(STR(?s)), "${r}")`,predicate:`CONTAINS(LCASE(STR(?p)), "${r}")`,object:`CONTAINS(LCASE(STR(?o)), "${r}")`};return`SELECT ?s ?p ?o WHERE { ?s ?p ?o . FILTER(${e.field==="any"?`(${s.subject} || ${s.predicate} || ${s.object})`:s[e.field]}) } LIMIT ${t}`}function u6(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}const Cj=[{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"}],d6=["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 p6(){const{contextGraphs:e}=Na(),{hidden:t}=dg(),n=w.useMemo(()=>e.filter(r=>!t.has(r.id)),[e,t]);return o.jsxs("div",{className:"v10-memstack",children:[o.jsxs("div",{className:"v10-memstack-head",children:[o.jsx("h1",{className:"v10-memstack-title",children:"Memory Stack"}),o.jsxs("p",{className:"v10-memstack-sub",children:["Every layer across every context graph, at a glance. ",n.length," visible context graph",n.length===1?"":"s"," · hidden context graphs are skipped."]})]}),n.length===0?o.jsx("div",{className:"v10-memstack-empty",children:"No visible context graphs. Create one from the sidebar or un-hide dismissed ones."}):o.jsxs("div",{className:"v10-memstack-table",children:[o.jsxs("div",{className:"v10-memstack-colheads",children:[o.jsx("div",{className:"v10-memstack-colhead project"}),Cj.map(r=>o.jsxs("div",{className:"v10-memstack-colhead",style:{color:r.color},children:[o.jsx("span",{className:"v10-memstack-colhead-icon",children:r.icon}),o.jsx("span",{className:"v10-memstack-colhead-title",children:r.title}),o.jsx("span",{className:"v10-memstack-colhead-desc",children:r.desc})]},r.key))]}),n.map(r=>o.jsx(f6,{cg:r},r.id))]})]})}function f6({cg:e}){const t=mg(e.id),{openTab:n}=yn(),r=wS(t),s=w.useMemo(()=>{const u={working:{entities:[],tripleCount:r.wm},shared:{entities:[],tripleCount:r.swm},verified:{entities:[],tripleCount:r.vm}};for(const d of t.entityList)u[d.trustLevel].entities.push(d);for(const d of Object.keys(u))u[d].entities.sort((f,h)=>{const g=vm(f),m=vm(h);return g&&m?m-g:g?-1:m?1:f.label.localeCompare(h.label)});return u},[t.entityList,r]),c=()=>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:c,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})]}),Cj.map(u=>{const d=s[u.key];return o.jsx(h6,{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 h6({cgId:e,color:t,layerTitle:n,tabPrefix:r,entityCount:s,tripleCount:c,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:c.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:ES(m6(h))})]},h.uri))}):o.jsxs("div",{className:"v10-memstack-cell-empty-hint",children:["Nothing in ",r.toUpperCase()," yet"]}),!f&&o.jsxs("button",{type:"button",className:"v10-memstack-cell-open",onClick:d,title:`Open ${n}`,children:["Open ",r.toUpperCase()," →"]})]})}function vm(e){var t;for(const n of d6){const r=(t=e.properties.get(n))==null?void 0:t[0];if(!r)continue;const s=new Date(r.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"));if(Number.isFinite(s.getTime()))return s.getTime()}return null}function m6(e){const t=vm(e);return t?new Date(t):null}function g6(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const v6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,y6=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,b6={};function Y1(e,t){return(b6.jsx?y6:v6).test(e)}const x6=/[ \t\n\f\r]/g;function w6(e){return typeof e=="object"?e.type==="text"?Q1(e.value):!1:Q1(e)}function Q1(e){return e.replace(x6,"")===""}class Gl{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Gl.prototype.normal={};Gl.prototype.property={};Gl.prototype.space=void 0;function Nj(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Gl(n,r,t)}function ym(e){return e.toLowerCase()}class Vn{constructor(t,n){this.attribute=n,this.property=t}}Vn.prototype.attribute="";Vn.prototype.booleanish=!1;Vn.prototype.boolean=!1;Vn.prototype.commaOrSpaceSeparated=!1;Vn.prototype.commaSeparated=!1;Vn.prototype.defined=!1;Vn.prototype.mustUseProperty=!1;Vn.prototype.number=!1;Vn.prototype.overloadedBoolean=!1;Vn.prototype.property="";Vn.prototype.spaceSeparated=!1;Vn.prototype.space=void 0;let k6=0;const Xe=rs(),sn=rs(),bm=rs(),we=rs(),Rt=rs(),Js=rs(),ra=rs();function rs(){return 2**++k6}const xm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:sn,commaOrSpaceSeparated:ra,commaSeparated:Js,number:we,overloadedBoolean:bm,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),Ch=Object.keys(xm);class Pg extends Vn{constructor(t,n,r,s){let c=-1;if(super(t,n),K1(this,"space",s),typeof r=="number")for(;++c<Ch.length;){const u=Ch[c];K1(this,Ch[c],(r&xm[u])===xm[u])}}}Pg.prototype.defined=!0;function K1(e,t,n){n&&(e[t]=n)}function ho(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const c=new Pg(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(c.mustUseProperty=!0),t[r]=c,n[ym(r)]=r,n[ym(c.attribute)]=r}return new Gl(t,n,e.space)}const Ej=ho({properties:{ariaActiveDescendant:null,ariaAtomic:sn,ariaAutoComplete:null,ariaBusy:sn,ariaChecked:sn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:sn,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:sn,ariaFlowTo:Rt,ariaGrabbed:sn,ariaHasPopup:null,ariaHidden:sn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:we,ariaLive:null,ariaModal:sn,ariaMultiLine:sn,ariaMultiSelectable:sn,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:sn,ariaReadOnly:sn,ariaRelevant:null,ariaRequired:sn,ariaRoleDescription:Rt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:sn,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Tj(e,t){return t in e?e[t]:t}function Aj(e,t){return Tj(e,t.toLowerCase())}const S6=ho({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Js,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:Xe,allowPaymentRequest:Xe,allowUserMedia:Xe,alt:null,as:null,async:Xe,autoCapitalize:null,autoComplete:Rt,autoFocus:Xe,autoPlay:Xe,blocking:Rt,capture:null,charSet:null,checked:Xe,cite:null,className:Rt,cols:we,colSpan:null,content:null,contentEditable:sn,controls:Xe,controlsList:Rt,coords:we|Js,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:bm,draggable:sn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:Rt,height:we,hidden:bm,high:we,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:Xe,inputMode:null,integrity:null,is:null,isMap:Xe,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:Xe,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xe,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Xe,muted:Xe,name:null,nonce:null,noModule:Xe,noValidate:Xe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Xe,optimum:we,pattern:null,ping:Rt,placeholder:null,playsInline:Xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xe,referrerPolicy:null,rel:Rt,required:Xe,reversed:Xe,rows:we,rowSpan:we,sandbox:Rt,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:sn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:sn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xe,declare:Xe,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:sn,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Xe,disableRemotePlayback:Xe,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Aj}),j6=ho({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:ra,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:Js,g2:Js,glyphName:Js,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:ra,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:ra,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ra,rev:ra,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ra,requiredFeatures:ra,requiredFonts:ra,requiredFormats:ra,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:ra,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:ra,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:ra,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:Tj}),Rj=ho({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()}}),_j=ho({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Aj}),Oj=ho({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),C6={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"},N6=/[A-Z]/g,X1=/-[a-z]/g,E6=/^data[-\w.:]+$/i;function T6(e,t){const n=ym(t);let r=t,s=Vn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&E6.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(X1,R6);r="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!X1.test(c)){let u=c.replace(N6,A6);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}s=Pg}return new s(r,t)}function A6(e){return"-"+e.toLowerCase()}function R6(e){return e.charAt(1).toUpperCase()}const _6=Nj([Ej,S6,Rj,_j,Oj],"html"),Ug=Nj([Ej,j6,Rj,_j,Oj],"svg");function O6(e){return e.join(" ").trim()}var qs={},Nh,J1;function L6(){if(J1)return Nh;J1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
1625
- `,h="/",g="*",m="",y="comment",x="declaration";function k(E,S){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];S=S||{};var T=1,N=1;function A(I){var D=I.match(t);D&&(T+=D.length);var F=I.lastIndexOf(f);N=~F?I.length-F:N+I.length}function q(){var I={line:T,column:N};return function(D){return D.position=new R(I),z(),D}}function R(I){this.start=I,this.end={line:T,column:N},this.source=S.source}R.prototype.content=E;function $(I){var D=new Error(S.source+":"+T+":"+N+": "+I);if(D.reason=I,D.filename=S.source,D.line=T,D.column=N,D.source=E,!S.silent)throw D}function H(I){var D=I.exec(E);if(D){var F=D[0];return A(F),E=E.slice(F.length),D}}function z(){H(n)}function _(I){var D;for(I=I||[];D=P();)D!==!1&&I.push(D);return I}function P(){var I=q();if(!(h!=E.charAt(0)||g!=E.charAt(1))){for(var D=2;m!=E.charAt(D)&&(g!=E.charAt(D)||h!=E.charAt(D+1));)++D;if(D+=2,m===E.charAt(D-1))return $("End of comment missing");var F=E.slice(2,D-2);return N+=2,A(F),E=E.slice(D),N+=2,I({type:y,comment:F})}}function B(){var I=q(),D=H(r);if(D){if(P(),!H(s))return $("property missing ':'");var F=H(c),V=I({type:x,property:j(D[0].replace(e,m)),value:F?j(F[0].replace(e,m)):m});return H(u),V}}function W(){var I=[];_(I);for(var D;D=B();)D!==!1&&(I.push(D),_(I));return I}return z(),W()}function j(E){return E?E.replace(d,m):m}return Nh=k,Nh}var ew;function z6(){if(ew)return qs;ew=1;var e=qs&&qs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(qs,"__esModule",{value:!0}),qs.default=n;const t=e(L6());function n(r,s){let c=null;if(!r||typeof r!="string")return c;const u=(0,t.default)(r),d=typeof s=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:h,value:g}=f;d?s(h,g,f):g&&(c=c||{},c[h]=g)}),c}return qs}var fl={},tw;function M6(){if(tw)return fl;tw=1,Object.defineProperty(fl,"__esModule",{value:!0}),fl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,c=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={}),c(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(s,d):h=h.replace(r,d),h.replace(t,u))};return fl.camelCase=f,fl}var hl,nw;function D6(){if(nw)return hl;nw=1;var e=hl&&hl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(z6()),n=M6();function r(s,c){var u={};return!s||typeof s!="string"||(0,t.default)(s,function(d,f){d&&f&&(u[(0,n.camelCase)(d,c)]=f)}),u}return r.default=r,hl=r,hl}var $6=D6();const I6=$l($6),Lj=zj("end"),Bg=zj("start");function zj(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function P6(e){const t=Bg(e),n=Lj(e);if(t&&n)return{start:t,end:n}}function Cl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?aw(e.position):"start"in e||"end"in e?aw(e):"line"in e||"column"in e?wm(e):""}function wm(e){return rw(e&&e.line)+":"+rw(e&&e.column)}function aw(e){return wm(e&&e.start)+"-"+wm(e&&e.end)}function rw(e){return e&&typeof e=="number"?e:1}class An extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",c={},u=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?s=t:!c.cause&&t&&(u=!0,s=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?c.ruleId=r:(c.source=r.slice(0,f),c.ruleId=r.slice(f+1))}if(!c.place&&c.ancestors&&c.ancestors){const f=c.ancestors[c.ancestors.length-1];f&&(c.place=f.position)}const d=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.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=Cl(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}An.prototype.file="";An.prototype.name="";An.prototype.reason="";An.prototype.message="";An.prototype.stack="";An.prototype.column=void 0;An.prototype.line=void 0;An.prototype.ancestors=void 0;An.prototype.cause=void 0;An.prototype.fatal=void 0;An.prototype.place=void 0;An.prototype.ruleId=void 0;An.prototype.source=void 0;const Fg={}.hasOwnProperty,U6=new Map,B6=/[A-Z]/g,F6=new Set(["table","tbody","thead","tfoot","tr"]),H6=new Set(["td","th"]),Mj="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function q6(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=X6(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=K6(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ug:_6,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=Dj(s,e,void 0);return c&&typeof c!="string"?c:s.create(e,s.Fragment,{children:c||void 0},void 0)}function Dj(e,t,n){if(t.type==="element")return G6(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return V6(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Z6(e,t,n);if(t.type==="mdxjsEsm")return W6(e,t);if(t.type==="root")return Y6(e,t,n);if(t.type==="text")return Q6(e,t)}function G6(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Ug,e.schema=s),e.ancestors.push(t);const c=Ij(e,t.tagName,!1),u=J6(e,t);let d=qg(e,t);return F6.has(t.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!w6(f):!0})),$j(e,u,c,t),Hg(u,d),e.ancestors.pop(),e.schema=r,e.create(t,c,u,n)}function V6(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}zl(e,t.position)}function W6(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);zl(e,t.position)}function Z6(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Ug,e.schema=s),e.ancestors.push(t);const c=t.name===null?e.Fragment:Ij(e,t.name,!0),u=e5(e,t),d=qg(e,t);return $j(e,u,c,t),Hg(u,d),e.ancestors.pop(),e.schema=r,e.create(t,c,u,n)}function Y6(e,t,n){const r={};return Hg(r,qg(e,t)),e.create(t,e.Fragment,r,n)}function Q6(e,t){return t.value}function $j(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Hg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function K6(e,t,n){return r;function r(s,c,u,d){const h=Array.isArray(u.children)?n:t;return d?h(c,u,d):h(c,u)}}function X6(e,t){return n;function n(r,s,c,u){const d=Array.isArray(c.children),f=Bg(r);return t(s,c,u,d,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function J6(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Fg.call(t.properties,s)){const c=t5(e,s,t.properties[s]);if(c){const[u,d]=c;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&H6.has(t.tagName)?r=d:n[u]=d}}if(r){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function e5(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const c=r.data.estree.body[0];c.type;const u=c.expression;u.type;const d=u.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else zl(e,t.position);else{const s=r.name;let c;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const d=r.value.data.estree.body[0];d.type,c=e.evaluater.evaluateExpression(d.expression)}else zl(e,t.position);else c=r.value===null?!0:r.value;n[s]=c}return n}function qg(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:U6;for(;++r<t.children.length;){const c=t.children[r];let u;if(e.passKeys){const f=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(f){const h=s.get(f)||0;u=f+"-"+h,s.set(f,h+1)}}const d=Dj(e,c,u);d!==void 0&&n.push(d)}return n}function t5(e,t,n){const r=T6(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?g6(n):O6(n)),r.property==="style"){let s=typeof n=="object"?n:n5(e,String(n));return e.stylePropertyNameCase==="css"&&(s=a5(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?C6[r.property]||r.property:r.attribute,n]}}function n5(e,t){try{return I6(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new An("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=Mj+"#cannot-parse-style-attribute",s}}function Ij(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let c=-1,u;for(;++c<s.length;){const d=Y1(s[c])?{type:"Identifier",name:s[c]}:{type:"Literal",value:s[c]};u=u?{type:"MemberExpression",object:u,property:d,computed:!!(c&&d.type==="Literal"),optional:!1}:d}r=u}else r=Y1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Fg.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);zl(e)}function zl(e,t){const n=new An("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=Mj+"#cannot-handle-mdx-estrees-without-createevaluater",n}function a5(e){const t={};let n;for(n in e)Fg.call(e,n)&&(t[r5(n)]=e[n]);return t}function r5(e){let t=e.replace(B6,i5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function i5(e){return"-"+e.toLowerCase()}const Eh={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"]},s5={};function Gg(e,t){const n=s5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Pj(e,r,s)}function Pj(e,t,n){if(o5(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 iw(e.children,t,n)}return Array.isArray(e)?iw(e,t,n):""}function iw(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=Pj(e[s],t,n);return r.join("")}function o5(e){return!!(e&&typeof e=="object")}const sw=document.createElement("i");function Vg(e){const t="&"+e+";";sw.innerHTML=t;const n=sw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function sa(e,t,n,r){const s=e.length;let c=0,u;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);c<r.length;)u=r.slice(c,c+1e4),u.unshift(t,0),e.splice(...u),c+=1e4,t+=1e4}function Ca(e,t){return e.length>0?(sa(e,e.length,0,t),e):t}const ow={}.hasOwnProperty;function Uj(e){const t={};let n=-1;for(;++n<e.length;)l5(t,e[n]);return t}function l5(e,t){let n;for(n in t){const s=(ow.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let u;if(c)for(u in c){ow.call(s,u)||(s[u]=[]);const d=c[u];c5(s[u],Array.isArray(d)?d:d?[d]:[])}}}function c5(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);sa(e,0,0,r)}function Bj(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 $a(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zn=xi(/[A-Za-z]/),En=xi(/[\dA-Za-z]/),u5=xi(/[#-'*+\--9=?A-Z^-~]/);function rd(e){return e!==null&&(e<32||e===127)}const km=xi(/\d/),d5=xi(/[\dA-Fa-f]/),p5=xi(/[!-/:-@[-`{-~]/);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 Rd=xi(new RegExp("\\p{P}|\\p{S}","u")),Xi=xi(/\s/);function xi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function mo(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const c=e.charCodeAt(n);let u="";if(c===37&&En(e.charCodeAt(n+1))&&En(e.charCodeAt(n+2)))s=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const d=e.charCodeAt(n+1);c<56320&&d>56319&&d<57344?(u=String.fromCharCode(c,d),s=1):u="�"}else u=String.fromCharCode(c);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+s+1,u=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function pt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(f){return it(f)?(e.enter(n),d(f)):t(f)}function d(f){return it(f)&&c++<s?(e.consume(f),d):(e.exit(n),t(f))}}const f5={tokenize:h5};function h5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),pt(e,t,"linePrefix")}function s(d){return e.enter("paragraph"),c(d)}function c(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"),c):(e.consume(d),u)}}const m5={tokenize:g5},lw={tokenize:v5};function g5(e){const t=this,n=[];let r=0,s,c,u;return d;function d(N){if(r<n.length){const A=n[r];return t.containerState=A[1],e.attempt(A[0].continuation,f,h)(N)}return h(N)}function f(N){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&T();const A=t.events.length;let q=A,R;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){R=t.events[q][1].end;break}S(r);let $=A;for(;$<t.events.length;)t.events[$][1].end={...R},$++;return sa(t.events,q+1,0,t.events.slice(A)),t.events.length=$,h(N)}return d(N)}function h(N){if(r===n.length){if(!s)return y(N);if(s.currentConstruct&&s.currentConstruct.concrete)return k(N);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(lw,g,m)(N)}function g(N){return s&&T(),S(r),y(N)}function m(N){return t.parser.lazy[t.now().line]=r!==n.length,u=t.now().offset,k(N)}function y(N){return t.containerState={},e.attempt(lw,x,k)(N)}function x(N){return r++,n.push([t.currentConstruct,t.containerState]),y(N)}function k(N){if(N===null){s&&T(),S(0),e.consume(N);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:c}),j(N)}function j(N){if(N===null){E(e.exit("chunkFlow"),!0),S(0),e.consume(N);return}return Pe(N)?(e.consume(N),E(e.exit("chunkFlow")),r=0,t.interrupt=void 0,d):(e.consume(N),j)}function E(N,A){const q=t.sliceStream(N);if(A&&q.push(null),N.previous=c,c&&(c.next=N),c=N,s.defineSkip(N.start),s.write(q),t.parser.lazy[N.start.line]){let R=s.events.length;for(;R--;)if(s.events[R][1].start.offset<u&&(!s.events[R][1].end||s.events[R][1].end.offset>u))return;const $=t.events.length;let H=$,z,_;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if(z){_=t.events[H][1].end;break}z=!0}for(S(r),R=$;R<t.events.length;)t.events[R][1].end={..._},R++;sa(t.events,H+1,0,t.events.slice($)),t.events.length=R}}function S(N){let A=n.length;for(;A-- >N;){const q=n[A];t.containerState=q[1],q[0].exit.call(t,e)}n.length=N}function T(){s.write([null]),c=void 0,s=void 0,t.containerState._closeFlow=void 0}}function v5(e,t,n){return pt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function so(e){if(e===null||Tt(e)||Xi(e))return 1;if(Rd(e))return 2}function _d(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const c=e[s].resolveAll;c&&!r.includes(c)&&(t=c(t,n),r.push(c))}return t}const Sm={name:"attention",resolveAll:y5,tokenize:b5};function y5(e,t){let n=-1,r,s,c,u,d,f,h,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[r][1].end},y={...e[n][1].start};cw(m,-f),cw(y,f),u={type:f>1?"strongSequence":"emphasisSequence",start:m,end:{...e[r][1].end}},d={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},c={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:f>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[r][1].end={...u.start},e[n][1].start={...d.end},h=[],e[r][1].end.offset-e[r][1].start.offset&&(h=Ca(h,[["enter",e[r][1],t],["exit",e[r][1],t]])),h=Ca(h,[["enter",s,t],["enter",u,t],["exit",u,t],["enter",c,t]]),h=Ca(h,_d(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),h=Ca(h,[["exit",c,t],["enter",d,t],["exit",d,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=Ca(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,sa(e,r-1,n-r+3,h),n=r+h.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function b5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=so(r);let c;return u;function u(f){return c=f,e.enter("attentionSequence"),d(f)}function d(f){if(f===c)return e.consume(f),d;const h=e.exit("attentionSequence"),g=so(f),m=!g||g===2&&s||n.includes(f),y=!s||s===2&&g||n.includes(r);return h._open=!!(c===42?m:m&&(s||!y)),h._close=!!(c===42?y:y&&(g||!m)),t(f)}}function cw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const x5={name:"autolink",tokenize:w5};function w5(e,t,n){let r=0;return s;function s(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(x){return zn(x)?(e.consume(x),u):x===64?n(x):h(x)}function u(x){return x===43||x===45||x===46||En(x)?(r=1,d(x)):h(x)}function d(x){return x===58?(e.consume(x),r=0,f):(x===43||x===45||x===46||En(x))&&r++<32?(e.consume(x),d):(r=0,h(x))}function f(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||rd(x)?n(x):(e.consume(x),f)}function h(x){return x===64?(e.consume(x),g):u5(x)?(e.consume(x),h):n(x)}function g(x){return En(x)?m(x):n(x)}function m(x){return x===46?(e.consume(x),r=0,g):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):y(x)}function y(x){if((x===45||En(x))&&r++<63){const k=x===45?y:m;return e.consume(x),k}return n(x)}}const Vl={partial:!0,tokenize:k5};function k5(e,t,n){return r;function r(c){return it(c)?pt(e,s,"linePrefix")(c):s(c)}function s(c){return c===null||Pe(c)?t(c):n(c)}}const Fj={continuation:{tokenize:j5},exit:C5,name:"blockQuote",tokenize:S5};function S5(e,t,n){const r=this;return s;function s(u){if(u===62){const d=r.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),c}return n(u)}function c(u){return it(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function j5(e,t,n){const r=this;return s;function s(u){return it(u)?pt(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(Fj,t,n)(u)}}function C5(e){e.exit("blockQuote")}const Hj={name:"characterEscape",tokenize:N5};function N5(e,t,n){return r;function r(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),s}function s(c){return p5(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const qj={name:"characterReference",tokenize:E5};function E5(e,t,n){const r=this;let s=0,c,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"),c=31,u=En,g(m))}function h(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=d5,g):(e.enter("characterReferenceValue"),c=7,u=km,g(m))}function g(m){if(m===59&&s){const y=e.exit("characterReferenceValue");return u===En&&!Vg(r.sliceSerialize(y))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(m)&&s++<c?(e.consume(m),g):n(m)}}const uw={partial:!0,tokenize:A5},dw={concrete:!0,name:"codeFenced",tokenize:T5};function T5(e,t,n){const r=this,s={partial:!0,tokenize:q};let c=0,u=0,d;return f;function f(R){return h(R)}function h(R){const $=r.events[r.events.length-1];return c=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,d=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(R)}function g(R){return R===d?(u++,e.consume(R),g):u<3?n(R):(e.exit("codeFencedFenceSequence"),it(R)?pt(e,m,"whitespace")(R):m(R))}function m(R){return R===null||Pe(R)?(e.exit("codeFencedFence"),r.interrupt?t(R):e.check(uw,j,A)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(R))}function y(R){return R===null||Pe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(R)):it(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),pt(e,x,"whitespace")(R)):R===96&&R===d?n(R):(e.consume(R),y)}function x(R){return R===null||Pe(R)?m(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(R))}function k(R){return R===null||Pe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(R)):R===96&&R===d?n(R):(e.consume(R),k)}function j(R){return e.attempt(s,A,E)(R)}function E(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),S}function S(R){return c>0&&it(R)?pt(e,T,"linePrefix",c+1)(R):T(R)}function T(R){return R===null||Pe(R)?e.check(uw,j,A)(R):(e.enter("codeFlowValue"),N(R))}function N(R){return R===null||Pe(R)?(e.exit("codeFlowValue"),T(R)):(e.consume(R),N)}function A(R){return e.exit("codeFenced"),t(R)}function q(R,$,H){let z=0;return _;function _(D){return R.enter("lineEnding"),R.consume(D),R.exit("lineEnding"),P}function P(D){return R.enter("codeFencedFence"),it(D)?pt(R,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):B(D)}function B(D){return D===d?(R.enter("codeFencedFenceSequence"),W(D)):H(D)}function W(D){return D===d?(z++,R.consume(D),W):z>=u?(R.exit("codeFencedFenceSequence"),it(D)?pt(R,I,"whitespace")(D):I(D)):H(D)}function I(D){return D===null||Pe(D)?(R.exit("codeFencedFence"),$(D)):H(D)}}}function A5(e,t,n){const r=this;return s;function s(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}const Th={name:"codeIndented",tokenize:_5},R5={partial:!0,tokenize:O5};function _5(e,t,n){const r=this;return s;function s(h){return e.enter("codeIndented"),pt(e,c,"linePrefix",5)(h)}function c(h){const g=r.events[r.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?u(h):n(h)}function u(h){return h===null?f(h):Pe(h)?e.attempt(R5,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 O5(e,t,n){const r=this;return s;function s(u){return r.parser.lazy[r.now().line]?n(u):Pe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):pt(e,c,"linePrefix",5)(u)}function c(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):Pe(u)?s(u):n(u)}}const L5={name:"codeText",previous:M5,resolve:z5,tokenize:D5};function z5(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function M5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function D5(e,t,n){let r=0,s,c;return u;function u(m){return e.enter("codeText"),e.enter("codeTextSequence"),d(m)}function d(m){return m===96?(e.consume(m),r++,d):(e.exit("codeTextSequence"),f(m))}function f(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),f):m===96?(c=e.enter("codeTextSequence"),s=0,g(m)):Pe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):(e.enter("codeTextData"),h(m))}function h(m){return m===null||m===32||m===96||Pe(m)?(e.exit("codeTextData"),f(m)):(e.consume(m),h)}function g(m){return m===96?(e.consume(m),s++,g):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(c.type="codeTextData",h(m))}}class $5{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&ml(this.left,r),c.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),ml(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ml(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);ml(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ml(this.left,n.reverse())}}}function ml(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 Gj(e){const t={};let n=-1,r,s,c,u,d,f,h;const g=new $5(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(r=g.get(n),n&&r[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,c=0,c<f.length&&f[c][1].type==="lineEndingBlank"&&(c+=2),c<f.length&&f[c][1].type==="content"))for(;++c<f.length&&f[c][1].type!=="content";)f[c][1].type==="chunkText"&&(f[c][1]._isInFirstContentOfListItem=!0,c++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,I5(g,n)),n=t[n],h=!0);else if(r[1]._container){for(c=n,s=void 0;c--;)if(u=g.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),u[1].type="lineEnding",s=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;s&&(r[1].end={...g.get(s)[1].start},d=g.slice(s,n),d.unshift(r),g.splice(s,n-s+1,d))}}return sa(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function I5(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const c=[];let u=n._tokenizer;u||(u=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const d=u.events,f=[],h={};let g,m,y=-1,x=n,k=0,j=0;const E=[j];for(;x;){for(;e.get(++s)[1]!==x;);c.push(s),x._tokenizer||(g=r.sliceStream(x),x.next||g.push(null),m&&u.defineSkip(x.start),x._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),x._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),m=x,x=x.next}for(x=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,E.push(j),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(u.events=[],x?(x._tokenizer=void 0,x.previous=void 0):E.pop(),y=E.length;y--;){const S=d.slice(E[y],E[y+1]),T=c.pop();f.push([T,T+S.length-1]),e.splice(T,2,S)}for(f.reverse(),y=-1;++y<f.length;)h[k+f[y][0]]=k+f[y][1],k+=f[y][1]-f[y][0]-1;return h}const P5={resolve:B5,tokenize:F5},U5={partial:!0,tokenize:H5};function B5(e){return Gj(e),e}function F5(e,t){let n;return r;function r(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(d)}function s(d){return d===null?c(d):Pe(d)?e.check(U5,u,c)(d):(e.consume(d),s)}function c(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 H5(e,t,n){const r=this;return s;function s(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),pt(e,c,"linePrefix")}function c(u){if(u===null||Pe(u))return n(u);const d=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function Vj(e,t,n,r,s,c,u,d,f){const h=f||Number.POSITIVE_INFINITY;let g=0;return m;function m(S){return S===60?(e.enter(r),e.enter(s),e.enter(c),e.consume(S),e.exit(c),y):S===null||S===32||S===41||rd(S)?n(S):(e.enter(r),e.enter(u),e.enter(d),e.enter("chunkString",{contentType:"string"}),j(S))}function y(S){return S===62?(e.enter(c),e.consume(S),e.exit(c),e.exit(s),e.exit(r),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),x(S))}function x(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:x)}function k(S){return S===60||S===62||S===92?(e.consume(S),x):x(S)}function j(S){return!g&&(S===null||S===41||Tt(S))?(e.exit("chunkString"),e.exit(d),e.exit(u),e.exit(r),t(S)):g<h&&S===40?(e.consume(S),g++,j):S===41?(e.consume(S),g--,j):S===null||S===32||S===40||rd(S)?n(S):(e.consume(S),S===92?E:j)}function E(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function Wj(e,t,n,r,s,c){const u=this;let d=0,f;return h;function h(x){return e.enter(r),e.enter(s),e.consume(x),e.exit(s),e.enter(c),g}function g(x){return d>999||x===null||x===91||x===93&&!f||x===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?n(x):x===93?(e.exit(c),e.enter(s),e.consume(x),e.exit(s),e.exit(r),t):Pe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||x===91||x===93||Pe(x)||d++>999?(e.exit("chunkString"),g(x)):(e.consume(x),f||(f=!it(x)),x===92?y:m)}function y(x){return x===91||x===92||x===93?(e.consume(x),d++,m):m(x)}}function Zj(e,t,n,r,s,c){let u;return d;function d(y){return y===34||y===39||y===40?(e.enter(r),e.enter(s),e.consume(y),e.exit(s),u=y===40?41:y,f):n(y)}function f(y){return y===u?(e.enter(s),e.consume(y),e.exit(s),e.exit(r),t):(e.enter(c),h(y))}function h(y){return y===u?(e.exit(c),f(u)):y===null?n(y):Pe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),pt(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 Nl(e,t){let n;return r;function r(s){return Pe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):it(s)?pt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const q5={name:"definition",tokenize:V5},G5={partial:!0,tokenize:W5};function V5(e,t,n){const r=this;let s;return c;function c(x){return e.enter("definition"),u(x)}function u(x){return Wj.call(r,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function d(x){return s=$a(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),f):n(x)}function f(x){return Tt(x)?Nl(e,h)(x):h(x)}function h(x){return Vj(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function g(x){return e.attempt(G5,m,m)(x)}function m(x){return it(x)?pt(e,y,"whitespace")(x):y(x)}function y(x){return x===null||Pe(x)?(e.exit("definition"),r.parser.defined.push(s),t(x)):n(x)}}function W5(e,t,n){return r;function r(d){return Tt(d)?Nl(e,s)(d):n(d)}function s(d){return Zj(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return it(d)?pt(e,u,"whitespace")(d):u(d)}function u(d){return d===null||Pe(d)?t(d):n(d)}}const Z5={name:"hardBreakEscape",tokenize:Y5};function Y5(e,t,n){return r;function r(c){return e.enter("hardBreakEscape"),e.consume(c),s}function s(c){return Pe(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const Q5={name:"headingAtx",resolve:K5,tokenize:X5};function K5(e,t){let n=e.length-2,r=3,s,c;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},c={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},sa(e,r,n-r+1,[["enter",s,t],["enter",c,t],["exit",c,t],["exit",s,t]])),e}function X5(e,t,n){let r=0;return s;function s(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&r++<6?(e.consume(g),u):g===null||Tt(g)?(e.exit("atxHeadingSequence"),d(g)):n(g)}function d(g){return g===35?(e.enter("atxHeadingSequence"),f(g)):g===null||Pe(g)?(e.exit("atxHeading"),t(g)):it(g)?pt(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 J5=["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"],pw=["pre","script","style","textarea"],eP={concrete:!0,name:"htmlFlow",resolveTo:aP,tokenize:rP},tP={partial:!0,tokenize:sP},nP={partial:!0,tokenize:iP};function aP(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 rP(e,t,n){const r=this;let s,c,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),c=!0,j):O===63?(e.consume(O),s=3,r.interrupt?t:L):zn(O)?(e.consume(O),u=String.fromCharCode(O),E):n(O)}function y(O){return O===45?(e.consume(O),s=2,x):O===91?(e.consume(O),s=5,d=0,k):zn(O)?(e.consume(O),s=4,r.interrupt?t:L):n(O)}function x(O){return O===45?(e.consume(O),r.interrupt?t:L):n(O)}function k(O){const ne="CDATA[";return O===ne.charCodeAt(d++)?(e.consume(O),d===ne.length?r.interrupt?t:B:k):n(O)}function j(O){return zn(O)?(e.consume(O),u=String.fromCharCode(O),E):n(O)}function E(O){if(O===null||O===47||O===62||Tt(O)){const ne=O===47,ue=u.toLowerCase();return!ne&&!c&&pw.includes(ue)?(s=1,r.interrupt?t(O):B(O)):J5.includes(u.toLowerCase())?(s=6,ne?(e.consume(O),S):r.interrupt?t(O):B(O)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(O):c?T(O):N(O))}return O===45||En(O)?(e.consume(O),u+=String.fromCharCode(O),E):n(O)}function S(O){return O===62?(e.consume(O),r.interrupt?t:B):n(O)}function T(O){return it(O)?(e.consume(O),T):_(O)}function N(O){return O===47?(e.consume(O),_):O===58||O===95||zn(O)?(e.consume(O),A):it(O)?(e.consume(O),N):_(O)}function A(O){return O===45||O===46||O===58||O===95||En(O)?(e.consume(O),A):q(O)}function q(O){return O===61?(e.consume(O),R):it(O)?(e.consume(O),q):N(O)}function R(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),f=O,$):it(O)?(e.consume(O),R):H(O)}function $(O){return O===f?(e.consume(O),f=null,z):O===null||Pe(O)?n(O):(e.consume(O),$)}function H(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||Tt(O)?q(O):(e.consume(O),H)}function z(O){return O===47||O===62||it(O)?N(O):n(O)}function _(O){return O===62?(e.consume(O),P):n(O)}function P(O){return O===null||Pe(O)?B(O):it(O)?(e.consume(O),P):n(O)}function B(O){return O===45&&s===2?(e.consume(O),F):O===60&&s===1?(e.consume(O),V):O===62&&s===4?(e.consume(O),U):O===63&&s===3?(e.consume(O),L):O===93&&s===5?(e.consume(O),Q):Pe(O)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(tP,G,W)(O)):O===null||Pe(O)?(e.exit("htmlFlowData"),W(O)):(e.consume(O),B)}function W(O){return e.check(nP,I,G)(O)}function I(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),D}function D(O){return O===null||Pe(O)?W(O):(e.enter("htmlFlowData"),B(O))}function F(O){return O===45?(e.consume(O),L):B(O)}function V(O){return O===47?(e.consume(O),u="",X):B(O)}function X(O){if(O===62){const ne=u.toLowerCase();return pw.includes(ne)?(e.consume(O),U):B(O)}return zn(O)&&u.length<8?(e.consume(O),u+=String.fromCharCode(O),X):B(O)}function Q(O){return O===93?(e.consume(O),L):B(O)}function L(O){return O===62?(e.consume(O),U):O===45&&s===2?(e.consume(O),L):B(O)}function U(O){return O===null||Pe(O)?(e.exit("htmlFlowData"),G(O)):(e.consume(O),U)}function G(O){return e.exit("htmlFlow"),t(O)}}function iP(e,t,n){const r=this;return s;function s(u){return Pe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):n(u)}function c(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function sP(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Vl,t,n)}}const oP={name:"htmlText",tokenize:lP};function lP(e,t,n){const r=this;let s,c,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),q):L===63?(e.consume(L),N):zn(L)?(e.consume(L),H):n(L)}function h(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),c=0,k):zn(L)?(e.consume(L),T):n(L)}function g(L){return L===45?(e.consume(L),x):n(L)}function m(L){return L===null?n(L):L===45?(e.consume(L),y):Pe(L)?(u=m,V(L)):(e.consume(L),m)}function y(L){return L===45?(e.consume(L),x):m(L)}function x(L){return L===62?F(L):L===45?y(L):m(L)}function k(L){const U="CDATA[";return L===U.charCodeAt(c++)?(e.consume(L),c===U.length?j:k):n(L)}function j(L){return L===null?n(L):L===93?(e.consume(L),E):Pe(L)?(u=j,V(L)):(e.consume(L),j)}function E(L){return L===93?(e.consume(L),S):j(L)}function S(L){return L===62?F(L):L===93?(e.consume(L),S):j(L)}function T(L){return L===null||L===62?F(L):Pe(L)?(u=T,V(L)):(e.consume(L),T)}function N(L){return L===null?n(L):L===63?(e.consume(L),A):Pe(L)?(u=N,V(L)):(e.consume(L),N)}function A(L){return L===62?F(L):N(L)}function q(L){return zn(L)?(e.consume(L),R):n(L)}function R(L){return L===45||En(L)?(e.consume(L),R):$(L)}function $(L){return Pe(L)?(u=$,V(L)):it(L)?(e.consume(L),$):F(L)}function H(L){return L===45||En(L)?(e.consume(L),H):L===47||L===62||Tt(L)?z(L):n(L)}function z(L){return L===47?(e.consume(L),F):L===58||L===95||zn(L)?(e.consume(L),_):Pe(L)?(u=z,V(L)):it(L)?(e.consume(L),z):F(L)}function _(L){return L===45||L===46||L===58||L===95||En(L)?(e.consume(L),_):P(L)}function P(L){return L===61?(e.consume(L),B):Pe(L)?(u=P,V(L)):it(L)?(e.consume(L),P):z(L)}function B(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),s=L,W):Pe(L)?(u=B,V(L)):it(L)?(e.consume(L),B):(e.consume(L),I)}function W(L){return L===s?(e.consume(L),s=void 0,D):L===null?n(L):Pe(L)?(u=W,V(L)):(e.consume(L),W)}function I(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||Tt(L)?z(L):(e.consume(L),I)}function D(L){return L===47||L===62||Tt(L)?z(L):n(L)}function F(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function V(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),X}function X(L){return it(L)?pt(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):Q(L)}function Q(L){return e.enter("htmlTextData"),u(L)}}const Wg={name:"labelEnd",resolveAll:pP,resolveTo:fP,tokenize:hP},cP={tokenize:mP},uP={tokenize:gP},dP={tokenize:vP};function pP(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&sa(e,0,e.length,n),e}function fP(e,t){let n=e.length,r=0,s,c,u,d;for(;n--;)if(s=e[n][1],c){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&&(c=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(u=n);const f={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[c+r+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",f,t],["enter",h,t]],d=Ca(d,e.slice(c+1,c+r+3)),d=Ca(d,[["enter",g,t]]),d=Ca(d,_d(t.parser.constructs.insideSpan.null,e.slice(c+r+4,u-3),t)),d=Ca(d,[["exit",g,t],e[u-2],e[u-1],["exit",h,t]]),d=Ca(d,e.slice(u+1)),d=Ca(d,[["exit",f,t]]),sa(e,c,e.length,d),e}function hP(e,t,n){const r=this;let s=r.events.length,c,u;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){c=r.events[s][1];break}return d;function d(y){return c?c._inactive?m(y):(u=r.parser.defined.includes($a(r.sliceSerialize({start:c.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),f):n(y)}function f(y){return y===40?e.attempt(cP,g,u?g:m)(y):y===91?e.attempt(uP,g,u?h:m)(y):u?g(y):m(y)}function h(y){return e.attempt(dP,g,m)(y)}function g(y){return t(y)}function m(y){return c._balanced=!0,n(y)}}function mP(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),s}function s(m){return Tt(m)?Nl(e,c)(m):c(m)}function c(m){return m===41?g(m):Vj(e,u,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function u(m){return Tt(m)?Nl(e,f)(m):g(m)}function d(m){return n(m)}function f(m){return m===34||m===39||m===40?Zj(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function h(m){return Tt(m)?Nl(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 gP(e,t,n){const r=this;return s;function s(d){return Wj.call(r,e,c,u,"reference","referenceMarker","referenceString")(d)}function c(d){return r.parser.defined.includes($a(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function u(d){return n(d)}}function vP(e,t,n){return r;function r(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),s}function s(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const yP={name:"labelStartImage",resolveAll:Wg.resolveAll,tokenize:bP};function bP(e,t,n){const r=this;return s;function s(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),c}function c(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),u):n(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(d):t(d)}}const xP={name:"labelStartLink",resolveAll:Wg.resolveAll,tokenize:wP};function wP(e,t,n){const r=this;return s;function s(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const Ah={name:"lineEnding",tokenize:kP};function kP(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),pt(e,t,"linePrefix")}}const Pu={name:"thematicBreak",tokenize:SP};function SP(e,t,n){let r=0,s;return c;function c(h){return e.enter("thematicBreak"),u(h)}function u(h){return s=h,d(h)}function d(h){return h===s?(e.enter("thematicBreakSequence"),f(h)):r>=3&&(h===null||Pe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function f(h){return h===s?(e.consume(h),r++,f):(e.exit("thematicBreakSequence"),it(h)?pt(e,d,"whitespace")(h):d(h))}}const Fn={continuation:{tokenize:EP},exit:AP,name:"list",tokenize:NP},jP={partial:!0,tokenize:RP},CP={partial:!0,tokenize:TP};function NP(e,t,n){const r=this,s=r.events[r.events.length-1];let c=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,u=0;return d;function d(x){const k=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:km(x)){if(r.containerState.type||(r.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(Pu,n,h)(x):h(x);if(!r.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(x)}return n(x)}function f(x){return km(x)&&++u<10?(e.consume(x),f):(!r.interrupt||u<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),h(x)):n(x)}function h(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,e.check(Vl,r.interrupt?n:g,e.attempt(jP,y,m))}function g(x){return r.containerState.initialBlankLine=!0,c++,y(x)}function m(x){return it(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),y):n(x)}function y(x){return r.containerState.size=c+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function EP(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Vl,s,c);function s(d){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,pt(e,t,"listItemIndent",r.containerState.size+1)(d)}function c(d){return r.containerState.furtherBlankLines||!it(d)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(d)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(CP,t,u)(d))}function u(d){return r.containerState._closeFlow=!0,r.interrupt=void 0,pt(e,e.attempt(Fn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function TP(e,t,n){const r=this;return pt(e,s,"listItemIndent",r.containerState.size+1);function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(c):n(c)}}function AP(e){e.exit(this.containerState.type)}function RP(e,t,n){const r=this;return pt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(c){const u=r.events[r.events.length-1];return!it(c)&&u&&u[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const fw={name:"setextUnderline",resolveTo:_P,tokenize:OP};function _P(e,t){let n=e.length,r,s,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const u={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",c?(e.splice(s,0,["enter",u,t]),e.splice(c+1,0,["exit",e[r][1],t]),e[r][1].end={...e[c][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function OP(e,t,n){const r=this;let s;return c;function c(h){let g=r.events.length,m;for(;g--;)if(r.events[g][1].type!=="lineEnding"&&r.events[g][1].type!=="linePrefix"&&r.events[g][1].type!=="content"){m=r.events[g][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),s=h,u(h)):n(h)}function u(h){return e.enter("setextHeadingLineSequence"),d(h)}function d(h){return h===s?(e.consume(h),d):(e.exit("setextHeadingLineSequence"),it(h)?pt(e,f,"lineSuffix")(h):f(h))}function f(h){return h===null||Pe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const LP={tokenize:zP};function zP(e){const t=this,n=e.attempt(Vl,r,e.attempt(this.parser.constructs.flowInitial,s,pt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(P5,s)),"linePrefix")));return n;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const MP={resolveAll:Qj()},DP=Yj("string"),$P=Yj("text");function Yj(e){return{resolveAll:Qj(e==="text"?IP:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],c=n.attempt(s,u,d);return u;function u(g){return h(g)?c(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"),c(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 x=m[y];if(!x.previous||x.previous.call(r,r.previous))return!0}return!1}}}function Qj(e){return t;function t(n,r){let s=-1,c;for(;++s<=n.length;)c===void 0?n[s]&&n[s][1].type==="data"&&(c=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==c+2&&(n[c][1].end=n[s-1][1].end,n.splice(c+2,s-c-2),s=c+2),c=void 0);return e?e(n,r):n}}function IP(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let c=s.length,u=-1,d=0,f;for(;c--;){const h=s[c];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){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const h={type:n===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:r.start._bufferIndex+u,_index:r.start._index+c,line:r.end.line,column:r.end.column-d,offset:r.end.offset-d},end:{...r.end}};r.end={...h.start},r.start.offset===r.end.offset?Object.assign(r,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const PP={42:Fn,43:Fn,45:Fn,48:Fn,49:Fn,50:Fn,51:Fn,52:Fn,53:Fn,54:Fn,55:Fn,56:Fn,57:Fn,62:Fj},UP={91:q5},BP={[-2]:Th,[-1]:Th,32:Th},FP={35:Q5,42:Pu,45:[fw,Pu],60:eP,61:fw,95:Pu,96:dw,126:dw},HP={38:qj,92:Hj},qP={[-5]:Ah,[-4]:Ah,[-3]:Ah,33:yP,38:qj,42:Sm,60:[x5,oP],91:xP,92:[Z5,Hj],93:Wg,95:Sm,96:L5},GP={null:[Sm,MP]},VP={null:[42,95]},WP={null:[]},ZP=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:VP,contentInitial:UP,disable:WP,document:PP,flow:FP,flowInitial:BP,insideSpan:GP,string:HP,text:qP},Symbol.toStringTag,{value:"Module"}));function YP(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},c=[];let u=[],d=[];const f={attempt:$(q),check:$(R),consume:T,enter:N,exit:A,interrupt:$(R,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:y,sliceStream:x,write:m};let g=t.tokenize.call(h,f);return t.resolveAll&&c.push(t),h;function m(P){return u=Ca(u,P),E(),u[u.length-1]!==null?[]:(H(t,0),h.events=_d(c,h.events,h),h.events)}function y(P,B){return KP(x(P),B)}function x(P){return QP(u,P)}function k(){const{_bufferIndex:P,_index:B,line:W,column:I,offset:D}=r;return{_bufferIndex:P,_index:B,line:W,column:I,offset:D}}function j(P){s[P.line]=P.column,_()}function E(){let P;for(;r._index<u.length;){const B=u[r._index];if(typeof B=="string")for(P=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<B.length;)S(B.charCodeAt(r._bufferIndex));else S(B)}}function S(P){g=g(P)}function T(P){Pe(P)?(r.line++,r.column=1,r.offset+=P===-3?2:1,_()):P!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===u[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=P}function N(P,B){const W=B||{};return W.type=P,W.start=k(),h.events.push(["enter",W,h]),d.push(W),W}function A(P){const B=d.pop();return B.end=k(),h.events.push(["exit",B,h]),B}function q(P,B){H(P,B.from)}function R(P,B){B.restore()}function $(P,B){return W;function W(I,D,F){let V,X,Q,L;return Array.isArray(I)?G(I):"tokenize"in I?G([I]):U(I);function U(le){return be;function be(Re){const Ee=Re!==null&&le[Re],Ie=Re!==null&&le.null,Ve=[...Array.isArray(Ee)?Ee:Ee?[Ee]:[],...Array.isArray(Ie)?Ie:Ie?[Ie]:[]];return G(Ve)(Re)}}function G(le){return V=le,X=0,le.length===0?F:O(le[X])}function O(le){return be;function be(Re){return L=z(),Q=le,le.partial||(h.currentConstruct=le),le.name&&h.parser.constructs.disable.null.includes(le.name)?ue():le.tokenize.call(B?Object.assign(Object.create(h),B):h,f,ne,ue)(Re)}}function ne(le){return P(Q,L),D}function ue(le){return L.restore(),++X<V.length?O(V[X]):F}}}function H(P,B){P.resolveAll&&!c.includes(P)&&c.push(P),P.resolve&&sa(h.events,B,h.events.length-B,P.resolve(h.events.slice(B),h)),P.resolveTo&&(h.events=P.resolveTo(h.events,h))}function z(){const P=k(),B=h.previous,W=h.currentConstruct,I=h.events.length,D=Array.from(d);return{from:I,restore:F};function F(){r=P,h.previous=B,h.currentConstruct=W,h.events.length=I,d=D,_()}}function _(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function QP(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,c=t.end._bufferIndex;let u;if(n===s)u=[e[n].slice(r,c)];else{if(u=e.slice(n,s),r>-1){const d=u[0];typeof d=="string"?u[0]=d.slice(r):u.shift()}c>0&&u.push(e[s].slice(0,c))}return u}function KP(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const c=e[n];let u;if(typeof c=="string")u=c;else switch(c){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(c)}s=c===-2,r.push(u)}return r.join("")}function XP(e){const r={constructs:Uj([ZP,...(e||{}).extensions||[]]),content:s(f5),defined:[],document:s(m5),flow:s(LP),lazy:{},string:s(DP),text:s($P)};return r;function s(c){return u;function u(d){return YP(r,c,d)}}}function JP(e){for(;!Gj(e););return e}const hw=/[\0\t\n\r]/g;function eU(){let e=1,t="",n=!0,r;return s;function s(c,u,d){const f=[];let h,g,m,y,x;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),m=0,t="",n&&(c.charCodeAt(0)===65279&&m++,n=void 0);m<c.length;){if(hw.lastIndex=m,h=hw.exec(c),y=h&&h.index!==void 0?h.index:c.length,x=c.charCodeAt(y),!h){t=c.slice(m);break}if(x===10&&m===y&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),m<y&&(f.push(c.slice(m,y)),e+=y-m),x){case 0:{f.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,f.push(-2);e++<g;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}m=y+1}return d&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const tU=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nU(e){return e.replace(tU,aU)}function aU(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),c=s===120||s===88;return Bj(n.slice(c?2:1),c?16:10)}return Vg(n)||e}const Kj={}.hasOwnProperty;function rU(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),iU(n)(JP(XP(n).document().write(eU()(e,t,!0))))}function iU(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(Oe),autolinkProtocol:z,autolinkEmail:z,atxHeading:c(qe),blockQuote:c(Ie),characterEscape:z,characterReference:z,codeFenced:c(Ve),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(Ve,u),codeText:c(Se,u),codeTextData:z,data:z,codeFlowValue:z,definition:c(ht),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(Me),hardBreakEscape:c(ke),hardBreakTrailing:c(ke),htmlFlow:c(ct,u),htmlFlowData:z,htmlText:c(ct,u),htmlTextData:z,image:c(xe),label:u,link:c(Oe),listItem:c(Dt),listItemValue:y,listOrdered:c(_t,m),listUnordered:c(_t),paragraph:c(Qt),reference:O,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(qe),strong:c(Ft),thematicBreak:c(ye)},exit:{atxHeading:f(),atxHeadingSequence:q,autolink:f(),autolinkEmail:Ee,autolinkProtocol:Re,blockQuote:f(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:le,characterReference:be,codeFenced:f(E),codeFencedFence:j,codeFencedFenceInfo:x,codeFencedFenceMeta:k,codeFlowValue:_,codeIndented:f(S),codeText:f(D),codeTextData:_,data:_,definition:f(),definitionDestinationString:A,definitionLabelString:T,definitionTitleString:N,emphasis:f(),hardBreakEscape:f(B),hardBreakTrailing:f(B),htmlFlow:f(W),htmlFlowData:_,htmlText:f(I),htmlTextData:_,image:f(V),label:Q,labelText:X,lineEnding:P,link:f(F),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:ne,resourceDestinationString:L,resourceTitleString:U,resource:G,setextHeading:f(H),setextHeadingLineSequence:$,setextHeadingText:R,strong:f(),thematicBreak:f()}};Xj(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(K){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<K.length;)if(K[he][1].type==="listOrdered"||K[he][1].type==="listUnordered")if(K[he][0]==="enter")ce.push(he);else{const Le=ce.pop();he=s(K,Le,he)}for(he=-1;++he<K.length;){const Le=t[K[he][0]];Kj.call(Le,K[he][1].type)&&Le[K[he][1].type].call(Object.assign({sliceSerialize:K[he][2].sliceSerialize},ee),K[he][1])}if(ee.tokenStack.length>0){const Le=ee.tokenStack[ee.tokenStack.length-1];(Le[1]||mw).call(ee,void 0,Le[0])}for(Z.position={start:hi(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:hi(K.length>0?K[K.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(K,Z,ee){let ce=Z-1,he=-1,Le=!1,He,Ce,Fe,et;for(;++ce<=ee;){const Ne=K[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 At=K[Wt];if(At[1].type==="lineEnding"||At[1].type==="lineEndingBlank"){if(At[0]==="exit")continue;Ce&&(K[Ce][1].type="lineEndingBlank",Le=!0),At[1].type="lineEnding",Ce=Wt}else if(!(At[1].type==="linePrefix"||At[1].type==="blockQuotePrefix"||At[1].type==="blockQuotePrefixWhitespace"||At[1].type==="blockQuoteMarker"||At[1].type==="listItemIndent"))break}Fe&&(!Ce||Fe<Ce)&&(He._spread=!0),He.end=Object.assign({},Ce?K[Ce][1].start:Ne[1].end),K.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,K.splice(ce,0,["enter",Wt,Ne[2]]),ce++,ee++,Fe=void 0,et=!0}}}return K[Z][1]._spread=Le,ee}function c(K,Z){return ee;function ee(ce){d.call(this,K(ce),ce),Z&&Z.call(this,ce)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(K,Z,ee){this.stack[this.stack.length-1].children.push(K),this.stack.push(K),this.tokenStack.push([Z,ee||void 0]),K.position={start:hi(Z.start),end:void 0}}function f(K){return Z;function Z(ee){K&&K.call(this,ee),h.call(this,ee)}}function h(K,Z){const ee=this.stack.pop(),ce=this.tokenStack.pop();if(ce)ce[0].type!==K.type&&(Z?Z.call(this,K,ce[0]):(ce[1]||mw).call(this,K,ce[0]));else throw new Error("Cannot close `"+K.type+"` ("+Cl({start:K.start,end:K.end})+"): it’s not open");ee.position.end=hi(K.end)}function g(){return Gg(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function y(K){if(this.data.expectingFirstListItemValue){const Z=this.stack[this.stack.length-2];Z.start=Number.parseInt(this.sliceSerialize(K),10),this.data.expectingFirstListItemValue=void 0}}function x(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.lang=K}function k(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.meta=K}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.value=K.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.value=K.replace(/(\r?\n|\r)$/g,"")}function T(K){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.label=Z,ee.identifier=$a(this.sliceSerialize(K)).toLowerCase()}function N(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.title=K}function A(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.url=K}function q(K){const Z=this.stack[this.stack.length-1];if(!Z.depth){const ee=this.sliceSerialize(K).length;Z.depth=ee}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function $(K){const Z=this.stack[this.stack.length-1];Z.depth=this.sliceSerialize(K).codePointAt(0)===61?1:2}function H(){this.data.setextHeadingSlurpLineEnding=void 0}function z(K){const ee=this.stack[this.stack.length-1].children;let ce=ee[ee.length-1];(!ce||ce.type!=="text")&&(ce=dt(),ce.position={start:hi(K.start),end:void 0},ee.push(ce)),this.stack.push(ce)}function _(K){const Z=this.stack.pop();Z.value+=this.sliceSerialize(K),Z.position.end=hi(K.end)}function P(K){const Z=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ee=Z.children[Z.children.length-1];ee.position.end=hi(K.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Z.type)&&(z.call(this,K),_.call(this,K))}function B(){this.data.atHardBreak=!0}function W(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.value=K}function I(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.value=K}function D(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.value=K}function F(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=Z,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function V(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=Z,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function X(K){const Z=this.sliceSerialize(K),ee=this.stack[this.stack.length-2];ee.label=nU(Z),ee.identifier=$a(Z).toLowerCase()}function Q(){const K=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=K.children;ee.children=ce}else ee.alt=Z}function L(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.url=K}function U(){const K=this.resume(),Z=this.stack[this.stack.length-1];Z.title=K}function G(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function ne(K){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.label=Z,ee.identifier=$a(this.sliceSerialize(K)).toLowerCase(),this.data.referenceType="full"}function ue(K){this.data.characterReferenceType=K.type}function le(K){const Z=this.sliceSerialize(K),ee=this.data.characterReferenceType;let ce;ee?(ce=Bj(Z,ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ce=Vg(Z);const he=this.stack[this.stack.length-1];he.value+=ce}function be(K){const Z=this.stack.pop();Z.position.end=hi(K.end)}function Re(K){_.call(this,K);const Z=this.stack[this.stack.length-1];Z.url=this.sliceSerialize(K)}function Ee(K){_.call(this,K);const Z=this.stack[this.stack.length-1];Z.url="mailto:"+this.sliceSerialize(K)}function Ie(){return{type:"blockquote",children:[]}}function Ve(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function ht(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Me(){return{type:"emphasis",children:[]}}function qe(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function ct(){return{type:"html",value:""}}function xe(){return{type:"image",title:null,url:"",alt:null}}function Oe(){return{type:"link",title:null,url:"",children:[]}}function _t(K){return{type:"list",ordered:K.type==="listOrdered",start:null,spread:K._spread,children:[]}}function Dt(K){return{type:"listItem",spread:K._spread,checked:null,children:[]}}function Qt(){return{type:"paragraph",children:[]}}function Ft(){return{type:"strong",children:[]}}function dt(){return{type:"text",value:""}}function ye(){return{type:"thematicBreak"}}}function hi(e){return{line:e.line,column:e.column,offset:e.offset}}function Xj(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Xj(e,r):sU(e,r)}}function sU(e,t){let n;for(n in t)if(Kj.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function mw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Cl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Cl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Cl({start:t.start,end:t.end})+") is still open")}function oU(e){const t=this;t.parser=n;function n(r){return rU(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function lU(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 cU(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
1628
- `}]}function uU(e,t){const n=t.value?t.value+`
1629
- `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let c={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function dU(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pU(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fU(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=mo(r.toLowerCase()),c=e.footnoteOrder.indexOf(r);let u,d=e.footnoteCounts.get(r);d===void 0?(d=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=c+1,d+=1,e.footnoteCounts.set(r,d);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,f);const h={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,h),e.applyData(t,h)}function hU(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 mU(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Jj(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),c=s[0];c&&c.type==="text"?c.value="["+c.value:s.unshift({type:"text",value:"["});const u=s[s.length-1];return u&&u.type==="text"?u.value+=r:s.push({type:"text",value:r}),s}function gU(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Jj(e,t);const s={src:mo(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const c={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,c),e.applyData(t,c)}function vU(e,t){const n={src:mo(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function yU(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function bU(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Jj(e,t);const s={href:mo(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const c={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function xU(e,t){const n={href:mo(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function wU(e,t,n){const r=e.all(t),s=n?kU(n):eC(t),c={},u=[];if(typeof t.checked=="boolean"){const g=r[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let d=-1;for(;++d<r.length;){const g=r[d];(s||d!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
1630
- `}),g.type==="element"&&g.tagName==="p"&&!s?u.push(...g.children):u.push(g)}const f=r[r.length-1];f&&(s||f.type!=="element"||f.tagName!=="p")&&u.push({type:"text",value:`
1631
- `});const h={type:"element",tagName:"li",properties:c,children:u};return e.patch(t,h),e.applyData(t,h)}function kU(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=eC(n[r])}return t}function eC(e){const t=e.spread;return t??e.children.length>1}function SU(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const u=r[s];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,c),e.applyData(t,c)}function jU(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CU(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function NU(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function EU(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],u),s.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=Bg(t.children[1]),f=Lj(t.children[t.children.length-1]);d&&f&&(u.position={start:d,end:f}),s.push(u)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,c),e.applyData(t,c)}function TU(e,t,n){const r=n?n.children:void 0,c=(r?r.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,d=u?u.length:t.children.length;let f=-1;const h=[];for(;++f<d;){const m=t.children[f],y={},x=u?u[f]:void 0;x&&(y.align=x);let k={type:"element",tagName:c,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 AU(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const gw=9,vw=32;function RU(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const c=[];for(;r;)c.push(yw(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return c.push(yw(t.slice(s),s>0,!1)),c.join("")}function yw(e,t,n){let r=0,s=e.length;if(t){let c=e.codePointAt(r);for(;c===gw||c===vw;)r++,c=e.codePointAt(r)}if(n){let c=e.codePointAt(s-1);for(;c===gw||c===vw;)s--,c=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function _U(e,t){const n={type:"text",value:RU(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function OU(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const LU={blockquote:lU,break:cU,code:uU,delete:dU,emphasis:pU,footnoteReference:fU,heading:hU,html:mU,imageReference:gU,image:vU,inlineCode:yU,linkReference:bU,link:xU,listItem:wU,list:SU,paragraph:jU,root:CU,strong:NU,table:EU,tableCell:AU,tableRow:TU,text:_U,thematicBreak:OU,toml:ku,yaml:ku,definition:ku,footnoteDefinition:ku};function ku(){}const tC=-1,Od=0,El=1,id=2,Zg=3,Yg=4,Qg=5,Kg=6,nC=7,aC=8,zU=typeof self=="object"?self:globalThis,bw=(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 zU[e](t)},MU=(e,t)=>{const n=(s,c)=>(e.set(c,s),s),r=s=>{if(e.has(s))return e.get(s);const[c,u]=t[s];switch(c){case Od:case tC:return n(u,s);case El:{const d=n([],s);for(const f of u)d.push(r(f));return d}case id:{const d=n({},s);for(const[f,h]of u)d[r(f)]=r(h);return d}case Zg:return n(new Date(u),s);case Yg:{const{source:d,flags:f}=u;return n(new RegExp(d,f),s)}case Qg:{const d=n(new Map,s);for(const[f,h]of u)d.set(r(f),r(h));return d}case Kg:{const d=n(new Set,s);for(const f of u)d.add(r(f));return d}case nC:{const{name:d,message:f}=u;return n(bw(d,f),s)}case aC: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(bw(c,u),s)};return r},xw=e=>MU(new Map,e)(0),Gs="",{toString:DU}={},{keys:$U}=Object,gl=e=>{const t=typeof e;if(t!=="object"||!e)return[Od,t];const n=DU.call(e).slice(8,-1);switch(n){case"Array":return[El,Gs];case"Object":return[id,Gs];case"Date":return[Zg,Gs];case"RegExp":return[Yg,Gs];case"Map":return[Qg,Gs];case"Set":return[Kg,Gs];case"DataView":return[El,n]}return n.includes("Array")?[El,n]:n.includes("Error")?[nC,n]:[id,n]},Su=([e,t])=>e===Od&&(t==="function"||t==="symbol"),IU=(e,t,n,r)=>{const s=(u,d)=>{const f=r.push(u)-1;return n.set(d,f),f},c=u=>{if(n.has(u))return n.get(u);let[d,f]=gl(u);switch(d){case Od:{let g=u;switch(f){case"bigint":d=aC,g=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);g=null;break;case"undefined":return s([tC],u)}return s([d,g],u)}case El:{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(c(y));return m}case id:{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 c(u.toJSON());const g=[],m=s([d,g],u);for(const y of $U(u))(e||!Su(gl(u[y])))&&g.push([c(y),c(u[y])]);return m}case Zg:return s([d,u.toISOString()],u);case Yg:{const{source:g,flags:m}=u;return s([d,{source:g,flags:m}],u)}case Qg:{const g=[],m=s([d,g],u);for(const[y,x]of u)(e||!(Su(gl(y))||Su(gl(x))))&&g.push([c(y),c(x)]);return m}case Kg:{const g=[],m=s([d,g],u);for(const y of u)(e||!Su(gl(y)))&&g.push(c(y));return m}}const{message:h}=u;return s([d,{name:f,message:h}],u)};return c},ww=(e,{json:t,lossy:n}={})=>{const r=[];return IU(!(t||n),!!t,new Map,r)(e),r},sd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?xw(ww(e,t)):structuredClone(e):(e,t)=>xw(ww(e,t));function PU(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 UU(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function BU(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||PU,r=e.options.footnoteBackLabel||UU,s=e.options.footnoteLabel||"Footnotes",c=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=mo(m.toLowerCase());let x=0;const k=[],j=e.footnoteCounts.get(m);for(;j!==void 0&&++x<=j;){k.length>0&&k.push({type:"text",value:" "});let T=typeof n=="string"?n:n(f,x);typeof T=="string"&&(T={type:"text",value:T}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,x),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const E=g[g.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const T=E.children[E.children.length-1];T&&T.type==="text"?T.value+=" ":E.children.push({type:"text",value:" "}),E.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:c,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 Ld=(function(e){if(e==null)return GU;if(typeof e=="function")return zd(e);if(typeof e=="object")return Array.isArray(e)?FU(e):HU(e);if(typeof e=="string")return qU(e);throw new Error("Expected function, string, or object as test")});function FU(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ld(e[n]);return zd(r);function r(...s){let c=-1;for(;++c<t.length;)if(t[c].apply(this,s))return!0;return!1}}function HU(e){const t=e;return zd(n);function n(r){const s=r;let c;for(c in e)if(s[c]!==t[c])return!1;return!0}}function qU(e){return zd(t);function t(n){return n&&n.type===e}}function zd(e){return t;function t(n,r,s){return!!(VU(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function GU(){return!0}function VU(e){return e!==null&&typeof e=="object"&&"type"in e}const rC=[],WU=!0,jm=!1,ZU="skip";function iC(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const c=Ld(s),u=r?-1:1;d(e,void 0,[])();function d(f,h,g){const m=f&&typeof f=="object"?f:{};if(typeof m.type=="string"){const x=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(f.type+(x?"<"+x+">":""))+")"})}return y;function y(){let x=rC,k,j,E;if((!t||c(f,h,g[g.length-1]||void 0))&&(x=YU(n(f,g)),x[0]===jm))return x;if("children"in f&&f.children){const S=f;if(S.children&&x[0]!==ZU)for(j=(r?S.children.length:-1)+u,E=g.concat(S);j>-1&&j<S.children.length;){const T=S.children[j];if(k=d(T,j,E)(),k[0]===jm)return k;j=typeof k[1]=="number"?k[1]:j+u}}return x}}}function YU(e){return Array.isArray(e)?e:typeof e=="number"?[WU,e]:e==null?rC:[e]}function Xg(e,t,n,r){let s,c,u;typeof t=="function"&&typeof n!="function"?(c=void 0,u=t,s=n):(c=t,u=n,s=r),iC(e,c,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 Cm={}.hasOwnProperty,QU={};function KU(e,t){const n=t||QU,r=new Map,s=new Map,c=new Map,u={...LU,...n.handlers},d={all:h,applyData:JU,definitionById:r,footnoteById:s,footnoteCounts:c,footnoteOrder:[],handlers:u,one:f,options:n,patch:XU,wrap:t8};return Xg(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?r:s,y=String(g.identifier).toUpperCase();m.has(y)||m.set(y,g)}}),d;function f(g,m){const y=g.type,x=d.handlers[y];if(Cm.call(d.handlers,y)&&x)return x(d,g,m);if(d.options.passThrough&&d.options.passThrough.includes(y)){if("children"in g){const{children:j,...E}=g,S=sd(E);return S.children=d.all(g),S}return sd(g)}return(d.options.unknownHandler||e8)(d,g,m)}function h(g){const m=[];if("children"in g){const y=g.children;let x=-1;for(;++x<y.length;){const k=d.one(y[x],g);if(k){if(x&&y[x-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=kw(k.value)),!Array.isArray(k)&&k.type==="element")){const j=k.children[0];j&&j.type==="text"&&(j.value=kw(j.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function XU(e,t){e.position&&(t.position=P6(e))}function JU(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,c=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const u="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:u}}n.type==="element"&&c&&Object.assign(n.properties,sd(c)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function e8(e,t){const n=t.data||{},r="value"in t&&!(Cm.call(n,"hProperties")||Cm.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function t8(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
1634
- `});++r<e.length;)r&&n.push({type:"text",value:`
1635
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
1636
- `}),n}function kw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Sw(e,t){const n=KU(e,t),r=n.one(e,void 0),s=BU(n),c=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&c.children.push({type:"text",value:`
1637
- `},s),c}function n8(e,t){return e&&"run"in e?async function(n,r){const s=Sw(n,{file:r,...t});await e.run(s,r)}:function(n,r){return Sw(n,{file:r,...e||t})}}function jw(e){if(e)throw e}var Rh,Cw;function a8(){if(Cw)return Rh;Cw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},c=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!m)return!1;var y;for(y in h);return typeof y>"u"||e.call(h,y)},u=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},d=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(r)return r(h,g).value}else return;return h[g]};return Rh=function f(){var h,g,m,y,x,k,j=arguments[0],E=1,S=arguments.length,T=!1;for(typeof j=="boolean"&&(T=j,j=arguments[1]||{},E=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});E<S;++E)if(h=arguments[E],h!=null)for(g in h)m=d(j,g),y=d(h,g),j!==y&&(T&&y&&(c(y)||(x=s(y)))?(x?(x=!1,k=m&&s(m)?m:[]):k=m&&c(m)?m:{},u(j,{name:g,newValue:f(T,k,y)})):typeof y<"u"&&u(j,{name:g,newValue:y}));return j},Rh}var r8=a8();const _h=$l(r8);function Nm(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 i8(){const e=[],t={run:n,use:r};return t;function n(...s){let c=-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[++c];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?s8(g,d)(...h):u(null,...h)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function s8(e,t){let n;return r;function r(...u){const d=e.length>u.length;let f;d&&u.push(s);try{f=e.apply(this,u)}catch(h){const g=h;if(d&&n)throw g;return s(g)}d||(f&&f.then&&typeof f.then=="function"?f.then(c,s):f instanceof Error?s(f):c(f))}function s(u,...d){n||(n=!0,t(u,...d))}function c(u){s(null,u)}}const nr={basename:o8,dirname:l8,extname:c8,join:u8,sep:"/"};function o8(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Wl(e);let n=0,r=-1,s=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(c){n=s+1;break}}else r<0&&(c=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let u=-1,d=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(c){n=s+1;break}}else u<0&&(c=!0,u=s+1),d>-1&&(e.codePointAt(s)===t.codePointAt(d--)?d<0&&(r=s):(d=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function l8(e){if(Wl(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function c8(e){Wl(e);let t=e.length,n=-1,r=0,s=-1,c=0,u;for(;t--;){const d=e.codePointAt(t);if(d===47){if(u){r=t+1;break}continue}n<0&&(u=!0,n=t+1),d===46?s<0?s=t:c!==1&&(c=1):s>-1&&(c=-1)}return s<0||n<0||c===0||c===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function u8(...e){let t=-1,n;for(;++t<e.length;)Wl(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":d8(n)}function d8(e){Wl(e);const t=e.codePointAt(0)===47;let n=p8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function p8(e,t){let n="",r=0,s=-1,c=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||c===1))if(s!==u-1&&c===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),s=u,c=0;continue}}else if(n.length>0){n="",r=0,s=u,c=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,u):n=e.slice(s+1,u),r=u-s-1;s=u,c=0}else d===46&&c>-1?c++:c=-1}return n}function Wl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const f8={cwd:h8};function h8(){return"/"}function Em(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function m8(e){if(typeof e=="string")e=new URL(e);else if(!Em(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 g8(e)}function g8(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Oh=["history","path","basename","stem","extname","dirname"];class sC{constructor(t){let n;t?Em(t)?n={path:t}:typeof t=="string"||v8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":f8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Oh.length;){const c=Oh[r];c in n&&n[c]!==void 0&&n[c]!==null&&(this[c]=c==="history"?[...n[c]]:n[c])}let s;for(s in n)Oh.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?nr.basename(this.path):void 0}set basename(t){zh(t,"basename"),Lh(t,"basename"),this.path=nr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?nr.dirname(this.path):void 0}set dirname(t){Nw(this.basename,"dirname"),this.path=nr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?nr.extname(this.path):void 0}set extname(t){if(Lh(t,"extname"),Nw(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=nr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Em(t)&&(t=m8(t)),zh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?nr.basename(this.path,this.extname):void 0}set stem(t){zh(t,"stem"),Lh(t,"stem"),this.path=nr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new An(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Lh(e,t){if(e&&e.includes(nr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+nr.sep+"`")}function zh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Nw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function v8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const y8=(function(e){const r=this.constructor.prototype,s=r[e],c=function(){return s.apply(c,arguments)};return Object.setPrototypeOf(c,r),c}),b8={}.hasOwnProperty;class Jg extends y8{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=i8()}copy(){const t=new Jg;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(_h(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?($h("data",this.frozen),this.namespace[t]=n,this):b8.call(this.namespace,t)&&this.namespace[t]||void 0:t?($h("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ju(t),r=this.parser||this.Parser;return Mh("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Mh("process",this.parser||this.Parser),Dh("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(c,u){const d=ju(t),f=r.parse(d);r.run(f,d,function(g,m,y){if(g||!m||!y)return h(g);const x=m,k=r.stringify(x,y);k8(k)?y.value=k:y.result=k,h(g,y)});function h(g,m){g||!m?u(g):c?c(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),Mh("processSync",this.parser||this.Parser),Dh("processSync",this.compiler||this.Compiler),this.process(t,s),Tw("processSync","process",n),r;function s(c,u){n=!0,jw(c),r=u}}run(t,n,r){Ew(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?c(void 0,r):new Promise(c);function c(u,d){const f=ju(n);s.run(t,f,h);function h(g,m,y){const x=m||t;g?d(g):u?u(x):r(void 0,x,y)}}}runSync(t,n){let r=!1,s;return this.run(t,n,c),Tw("runSync","run",r),s;function c(u,d){jw(u),s=d,r=!0}}stringify(t,n){this.freeze();const r=ju(n),s=this.compiler||this.Compiler;return Dh("stringify",s),Ew(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if($h("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 c(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=_h(!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];c(m)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function f(h,g){let m=-1,y=-1;for(;++m<r.length;)if(r[m][0]===h){y=m;break}if(y===-1)r.push([h,...g]);else if(g.length>0){let[x,...k]=g;const j=r[y][1];Nm(j)&&Nm(x)&&(x=_h(!0,j,x)),r[y]=[h,x,...k]}}}}const x8=new Jg().freeze();function Mh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Dh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $h(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 Ew(e){if(!Nm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Tw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ju(e){return w8(e)?e:new sC(e)}function w8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function k8(e){return typeof e=="string"||S8(e)}function S8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const j8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Aw=[],Rw={allowDangerousHtml:!0},C8=/^(https?|ircs?|mailto|xmpp)$/i,N8=[{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 E8(e){const t=T8(e),n=A8(e);return R8(t.runSync(t.parse(n),n),e)}function T8(e){const t=e.rehypePlugins||Aw,n=e.remarkPlugins||Aw,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Rw}:Rw;return x8().use(oU).use(n).use(n8,r).use(t)}function A8(e){const t=e.children||"",n=new sC;return typeof t=="string"&&(n.value=t),n}function R8(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,c=t.disallowedElements,u=t.skipHtml,d=t.unwrapDisallowed,f=t.urlTransform||_8;for(const g of N8)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+j8+g.id,void 0);return Xg(e,h),q6(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 x;for(x in Eh)if(Object.hasOwn(Eh,x)&&Object.hasOwn(g.properties,x)){const k=g.properties[x],j=Eh[x];(j===null||j.includes(g.tagName))&&(g.properties[x]=f(String(k||""),x,g))}}if(g.type==="element"){let x=n?!n.includes(g.tagName):c?c.includes(g.tagName):!1;if(!x&&r&&typeof m=="number"&&(x=!r(g,m,y)),x&&y&&typeof m=="number")return d&&g.children?y.children.splice(m,1,...g.children):y.children.splice(m,1),m}}}function _8(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||C8.test(e.slice(0,t))?e:""}function _w(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function O8(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function oC(e,t,n){const s=Ld((n||{}).ignore||[]),c=L8(t);let u=-1;for(;++u<c.length;)iC(e,"text",d);function d(h,g){let m=-1,y;for(;++m<g.length;){const x=g[m],k=y?y.children:void 0;if(s(x,k?k.indexOf(x):void 0,y))return;y=x}if(y)return f(h,g)}function f(h,g){const m=g[g.length-1],y=c[u][0],x=c[u][1];let k=0;const E=m.children.indexOf(h);let S=!1,T=[];y.lastIndex=0;let N=y.exec(h.value);for(;N;){const A=N.index,q={index:N.index,input:N.input,stack:[...g,h]};let R=x(...N,q);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?y.lastIndex=A+1:(k!==A&&T.push({type:"text",value:h.value.slice(k,A)}),Array.isArray(R)?T.push(...R):R&&T.push(R),k=A+N[0].length,S=!0),!y.global)break;N=y.exec(h.value)}return S?(k<h.value.length&&T.push({type:"text",value:h.value.slice(k)}),m.children.splice(E,1,...T)):T=[h],E+T.length}}function L8(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([z8(s[0]),M8(s[1])])}return t}function z8(e){return typeof e=="string"?new RegExp(O8(e),"g"):e}function M8(e){return typeof e=="function"?e:function(){return e}}const Ih="phrasing",Ph=["autolink","link","image","label"];function D8(){return{transforms:[H8],enter:{literalAutolink:I8,literalAutolinkEmail:Uh,literalAutolinkHttp:Uh,literalAutolinkWww:Uh},exit:{literalAutolink:F8,literalAutolinkEmail:B8,literalAutolinkHttp:P8,literalAutolinkWww:U8}}}function $8(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ih,notInConstruct:Ph},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ih,notInConstruct:Ph},{character:":",before:"[ps]",after:"\\/",inConstruct:Ih,notInConstruct:Ph}]}}function I8(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Uh(e){this.config.enter.autolinkProtocol.call(this,e)}function P8(e){this.config.exit.autolinkProtocol.call(this,e)}function U8(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 B8(e){this.config.exit.autolinkEmail.call(this,e)}function F8(e){this.exit(e)}function H8(e){oC(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,q8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),G8]],{ignore:["link","linkReference"]})}function q8(e,t,n,r,s){let c="";if(!lC(s)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!V8(n)))return!1;const u=W8(n+r);if(!u[0])return!1;const d={type:"link",title:null,url:c+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[d,{type:"text",value:u[1]}]:d}function G8(e,t,n,r){return!lC(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function V8(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 W8(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=_w(e,"(");let c=_w(e,")");for(;r!==-1&&s>c;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),c++;return[e,n]}function lC(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Xi(n)||Rd(n))&&(!t||n!==47)}cC.peek=n9;function Z8(){this.buffer()}function Y8(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Q8(){this.buffer()}function K8(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function X8(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$a(this.sliceSerialize(e)).toLowerCase(),n.label=t}function J8(e){this.exit(e)}function e9(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$a(this.sliceSerialize(e)).toLowerCase(),n.label=t}function t9(e){this.exit(e)}function n9(){return"["}function cC(e,t,n,r){const s=n.createTracker(r);let c=s.move("[^");const u=n.enter("footnoteReference"),d=n.enter("reference");return c+=s.move(n.safe(n.associationId(e),{after:"]",before:c})),d(),u(),c+=s.move("]"),c}function a9(){return{enter:{gfmFootnoteCallString:Z8,gfmFootnoteCall:Y8,gfmFootnoteDefinitionLabelString:Q8,gfmFootnoteDefinition:K8},exit:{gfmFootnoteCallString:X8,gfmFootnoteCall:J8,gfmFootnoteDefinitionLabelString:e9,gfmFootnoteDefinition:t9}}}function r9(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:cC},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,c,u){const d=c.createTracker(u);let f=d.move("[^");const h=c.enter("footnoteDefinition"),g=c.enter("label");return f+=d.move(c.safe(c.associationId(r),{before:f,after:"]"})),g(),f+=d.move("]:"),r.children&&r.children.length>0&&(d.shift(4),f+=d.move((t?`
1638
- `:" ")+c.indentLines(c.containerFlow(r,d.current()),t?uC:i9))),h(),f}}function i9(e,t,n){return t===0?e:uC(e,t,n)}function uC(e,t,n){return(n?"":" ")+e}const s9=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];dC.peek=d9;function o9(){return{canContainEols:["delete"],enter:{strikethrough:c9},exit:{strikethrough:u9}}}function l9(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:s9}],handlers:{delete:dC}}}function c9(e){this.enter({type:"delete",children:[]},e)}function u9(e){this.exit(e)}function dC(e,t,n,r){const s=n.createTracker(r),c=n.enter("strikethrough");let u=s.move("~~");return u+=n.containerPhrasing(e,{...s.current(),before:u,after:"~"}),u+=s.move("~~"),c(),u}function d9(){return"~"}function p9(e){return e.length}function f9(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||p9,c=[],u=[],d=[],f=[];let h=0,g=-1;for(;++g<e.length;){const j=[],E=[];let S=-1;for(e[g].length>h&&(h=e[g].length);++S<e[g].length;){const T=h9(e[g][S]);if(n.alignDelimiters!==!1){const N=s(T);E[S]=N,(f[S]===void 0||N>f[S])&&(f[S]=N)}j.push(T)}u[g]=j,d[g]=E}let m=-1;if(typeof r=="object"&&"length"in r)for(;++m<h;)c[m]=Ow(r[m]);else{const j=Ow(r);for(;++m<h;)c[m]=j}m=-1;const y=[],x=[];for(;++m<h;){const j=c[m];let E="",S="";j===99?(E=":",S=":"):j===108?E=":":j===114&&(S=":");let T=n.alignDelimiters===!1?1:Math.max(1,f[m]-E.length-S.length);const N=E+"-".repeat(T)+S;n.alignDelimiters!==!1&&(T=E.length+T+S.length,T>f[m]&&(f[m]=T),x[m]=T),y[m]=N}u.splice(1,0,y),d.splice(1,0,x),g=-1;const k=[];for(;++g<u.length;){const j=u[g],E=d[g];m=-1;const S=[];for(;++m<h;){const T=j[m]||"";let N="",A="";if(n.alignDelimiters!==!1){const q=f[m]-(E[m]||0),R=c[m];R===114?N=" ".repeat(q):R===99?q%2?(N=" ".repeat(q/2+.5),A=" ".repeat(q/2-.5)):(N=" ".repeat(q/2),A=N):A=" ".repeat(q)}n.delimiterStart!==!1&&!m&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&T==="")&&(n.delimiterStart!==!1||m)&&S.push(" "),n.alignDelimiters!==!1&&S.push(N),S.push(T),n.alignDelimiters!==!1&&S.push(A),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||m!==h-1)&&S.push("|")}k.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return k.join(`
1639
- `)}function h9(e){return e==null?"":String(e)}function Ow(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 m9(e,t,n,r){const s=n.enter("blockquote"),c=n.createTracker(r);c.move("> "),c.shift(2);const u=n.indentLines(n.containerFlow(e,c.current()),g9);return s(),u}function g9(e,t,n){return">"+(n?"":" ")+e}function v9(e,t){return Lw(e,t.inConstruct,!0)&&!Lw(e,t.notInConstruct,!1)}function Lw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function zw(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
1640
- `&&v9(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
1641
- `}function y9(e,t){const n=String(e);let r=n.indexOf(t),s=r,c=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++c>u&&(u=c):c=1,s=r+t.length,r=n.indexOf(t,s);return u}function b9(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 x9(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 w9(e,t,n,r){const s=x9(n),c=e.value||"",u=s==="`"?"GraveAccent":"Tilde";if(b9(e,n)){const m=n.enter("codeIndented"),y=n.indentLines(c,k9);return m(),y}const d=n.createTracker(r),f=s.repeat(Math.max(y9(c,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
- `),c&&(g+=d.move(c+`
1644
- `)),g+=d.move(f),h(),g}function k9(e,t,n){return(n?"":" ")+e}function ev(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 S9(e,t,n,r){const s=ev(n),c=s==='"'?"Quote":"Apostrophe",u=n.enter("definition");let d=n.enter("label");const f=n.createTracker(r);let h=f.move("[");return h+=f.move(n.safe(n.associationId(e),{before:h,after:"]",...f.current()})),h+=f.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(d=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":`
1645
- `,...f.current()}))),d(),e.title&&(d=n.enter(`title${c}`),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 j9(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 Ml(e){return"&#x"+e.toString(16).toUpperCase()+";"}function od(e,t,n){const r=so(e),s=so(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}pC.peek=C9;function pC(e,t,n,r){const s=j9(n),c=n.enter("emphasis"),u=n.createTracker(r),d=u.move(s);let f=u.move(n.containerPhrasing(e,{after:s,before:d,...u.current()}));const h=f.charCodeAt(0),g=od(r.before.charCodeAt(r.before.length-1),h,s);g.inside&&(f=Ml(h)+f.slice(1));const m=f.charCodeAt(f.length-1),y=od(r.after.charCodeAt(0),m,s);y.inside&&(f=f.slice(0,-1)+Ml(m));const x=u.move(s);return c(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},d+f+x}function C9(e,t,n){return n.options.emphasis||"*"}function N9(e,t){let n=!1;return Xg(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,jm}),!!((!e.depth||e.depth<3)&&Gg(e)&&(t.options.setext||n))}function E9(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(r);if(N9(e,n)){const g=n.enter("headingSetext"),m=n.enter("phrasing"),y=n.containerPhrasing(e,{...c.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");c.move(u+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
1650
- `,...c.current()});return/^[\t ]/.test(h)&&(h=Ml(h.charCodeAt(0))+h.slice(1)),h=h?u+" "+h:u,n.options.closeAtx&&(h+=" "+u),f(),d(),h}fC.peek=T9;function fC(e){return e.value||""}function T9(){return"<"}hC.peek=A9;function hC(e,t,n,r){const s=ev(n),c=s==='"'?"Quote":"Apostrophe",u=n.enter("image");let d=n.enter("label");const f=n.createTracker(r);let h=f.move("![");return h+=f.move(n.safe(e.alt,{before:h,after:"]",...f.current()})),h+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(d=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=n.enter(`title${c}`),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 A9(){return"!"}mC.peek=R9;function mC(e,t,n,r){const s=e.referenceType,c=n.enter("imageReference");let u=n.enter("label");const d=n.createTracker(r);let f=d.move("![");const h=n.safe(e.alt,{before:f,after:"]",...d.current()});f+=d.move(h+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return u(),n.stack=g,c(),s==="full"||!h||h!==m?f+=d.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function R9(){return"!"}gC.peek=_9;function gC(e,t,n){let r=e.value||"",s="`",c=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++c<n.unsafe.length;){const u=n.unsafe[c],d=n.compilePattern(u);let f;if(u.atBreak)for(;f=d.exec(r);){let h=f.index;r.charCodeAt(h)===10&&r.charCodeAt(h-1)===13&&h--,r=r.slice(0,h)+" "+r.slice(f.index+1)}}return s+r+s}function _9(){return"`"}function vC(e,t){const n=Gg(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))}yC.peek=O9;function yC(e,t,n,r){const s=ev(n),c=s==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let d,f;if(vC(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${c}`),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 O9(e,t,n){return vC(e,n)?"<":"["}bC.peek=L9;function bC(e,t,n,r){const s=e.referenceType,c=n.enter("linkReference");let u=n.enter("label");const d=n.createTracker(r);let f=d.move("[");const h=n.containerPhrasing(e,{before:f,after:"]",...d.current()});f+=d.move(h+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return u(),n.stack=g,c(),s==="full"||!h||h!==m?f+=d.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function L9(){return"["}function tv(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 z9(e){const t=tv(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 M9(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 xC(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 D9(e,t,n,r){const s=n.enter("list"),c=n.bulletCurrent;let u=e.ordered?M9(n):tv(n);const d=e.ordered?u==="."?")":".":z9(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),xC(n)===u&&g){let m=-1;for(;++m<e.children.length;){const y=e.children[m];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(u=d),n.bulletCurrent=u;const h=n.containerFlow(e,r);return n.bulletLastUsed=u,n.bulletCurrent=c,s(),h}function $9(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 I9(e,t,n,r){const s=$9(n);let c=n.bulletCurrent||tv(n);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let u=c.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const d=n.createTracker(r);d.move(c+" ".repeat(u-c.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,x){return y?(x?"":" ".repeat(u))+m:(x?c:c+" ".repeat(u-c.length))+m}}function P9(e,t,n,r){const s=n.enter("paragraph"),c=n.enter("phrasing"),u=n.containerPhrasing(e,r);return c(),s(),u}const U9=Ld(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function B9(e,t,n,r){return(e.children.some(function(u){return U9(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function F9(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}wC.peek=H9;function wC(e,t,n,r){const s=F9(n),c=n.enter("strong"),u=n.createTracker(r),d=u.move(s+s);let f=u.move(n.containerPhrasing(e,{after:s,before:d,...u.current()}));const h=f.charCodeAt(0),g=od(r.before.charCodeAt(r.before.length-1),h,s);g.inside&&(f=Ml(h)+f.slice(1));const m=f.charCodeAt(f.length-1),y=od(r.after.charCodeAt(0),m,s);y.inside&&(f=f.slice(0,-1)+Ml(m));const x=u.move(s+s);return c(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},d+f+x}function H9(e,t,n){return n.options.strong||"*"}function q9(e,t,n,r){return n.safe(e.value,r)}function G9(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 V9(e,t,n){const r=(xC(n)+(n.options.ruleSpaces?" ":"")).repeat(G9(n));return n.options.ruleSpaces?r.slice(0,-1):r}const kC={blockquote:m9,break:zw,code:w9,definition:S9,emphasis:pC,hardBreak:zw,heading:E9,html:fC,image:hC,imageReference:mC,inlineCode:gC,link:yC,linkReference:bC,list:D9,listItem:I9,paragraph:P9,root:B9,strong:wC,text:q9,thematicBreak:V9};function W9(){return{enter:{table:Z9,tableData:Mw,tableHeader:Mw,tableRow:Q9},exit:{codeText:K9,table:Y9,tableData:Bh,tableHeader:Bh,tableRow:Bh}}}function Z9(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 Y9(e){this.exit(e),this.data.inTable=void 0}function Q9(e){this.enter({type:"tableRow",children:[]},e)}function Bh(e){this.exit(e)}function Mw(e){this.enter({type:"tableCell",children:[]},e)}function K9(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,X9));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function X9(e,t){return t==="|"?t:e}function J9(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,c=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(x,k,j,E){return h(g(x,j,E),x.align)}function d(x,k,j,E){const S=m(x,j,E),T=h([S]);return T.slice(0,T.indexOf(`
1652
- `))}function f(x,k,j,E){const S=j.enter("tableCell"),T=j.enter("phrasing"),N=j.containerPhrasing(x,{...E,before:c,after:c});return T(),S(),N}function h(x,k){return f9(x,{align:k,alignDelimiters:r,padding:n,stringLength:s})}function g(x,k,j){const E=x.children;let S=-1;const T=[],N=k.enter("table");for(;++S<E.length;)T[S]=m(E[S],k,j);return N(),T}function m(x,k,j){const E=x.children;let S=-1;const T=[],N=k.enter("tableRow");for(;++S<E.length;)T[S]=f(E[S],x,k,j);return N(),T}function y(x,k,j){let E=kC.inlineCode(x,k,j);return j.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function eB(){return{exit:{taskListCheckValueChecked:Dw,taskListCheckValueUnchecked:Dw,paragraph:nB}}}function tB(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:aB}}}function Dw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function nB(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let c=-1,u;for(;++c<s.length;){const d=s[c];if(d.type==="paragraph"){u=d;break}}u===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function aB(e,t,n,r){const s=e.children[0],c=typeof e.checked=="boolean"&&s&&s.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",d=n.createTracker(r);c&&d.move(u);let f=kC.listItem(e,t,n,{...r,...d.current()});return c&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),f;function h(g){return g+u}}function rB(){return[D8(),a9(),o9(),W9(),eB()]}function iB(e){return{extensions:[$8(),r9(e),l9(),J9(e),tB()]}}const sB={tokenize:pB,partial:!0},SC={tokenize:fB,partial:!0},jC={tokenize:hB,partial:!0},CC={tokenize:mB,partial:!0},oB={tokenize:gB,partial:!0},NC={name:"wwwAutolink",tokenize:uB,previous:TC},EC={name:"protocolAutolink",tokenize:dB,previous:AC},Pr={name:"emailAutolink",tokenize:cB,previous:RC},sr={};function lB(){return{text:sr}}let Hi=48;for(;Hi<123;)sr[Hi]=Pr,Hi++,Hi===58?Hi=65:Hi===91&&(Hi=97);sr[43]=Pr;sr[45]=Pr;sr[46]=Pr;sr[95]=Pr;sr[72]=[Pr,EC];sr[104]=[Pr,EC];sr[87]=[Pr,NC];sr[119]=[Pr,NC];function cB(e,t,n){const r=this;let s,c;return u;function u(m){return!Tm(m)||!RC.call(r,r.previous)||nv(r.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(m))}function d(m){return Tm(m)?(e.consume(m),d):m===64?(e.consume(m),f):n(m)}function f(m){return m===46?e.check(oB,g,h)(m):m===45||m===95||En(m)?(c=!0,e.consume(m),f):g(m)}function h(m){return e.consume(m),s=!0,f}function g(m){return c&&s&&zn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function uB(e,t,n){const r=this;return s;function s(u){return u!==87&&u!==119||!TC.call(r,r.previous)||nv(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(sB,e.attempt(SC,e.attempt(jC,c),n),n)(u))}function c(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function dB(e,t,n){const r=this;let s="",c=!1;return u;function u(m){return(m===72||m===104)&&AC.call(r,r.previous)&&!nv(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(m),e.consume(m),d):n(m)}function d(m){if(zn(m)&&s.length<5)return s+=String.fromCodePoint(m),e.consume(m),d;if(m===58){const y=s.toLowerCase();if(y==="http"||y==="https")return e.consume(m),f}return n(m)}function f(m){return m===47?(e.consume(m),c?h:(c=!0,f)):n(m)}function h(m){return m===null||rd(m)||Tt(m)||Xi(m)||Rd(m)?n(m):e.attempt(SC,e.attempt(jC,g),n)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function pB(e,t,n){let r=0;return s;function s(u){return(u===87||u===119)&&r<3?(r++,e.consume(u),s):u===46&&r===3?(e.consume(u),c):n(u)}function c(u){return u===null?n(u):t(u)}}function fB(e,t,n){let r,s,c;return u;function u(h){return h===46||h===95?e.check(CC,f,d)(h):h===null||Tt(h)||Xi(h)||h!==45&&Rd(h)?f(h):(c=!0,e.consume(h),u)}function d(h){return h===95?r=!0:(s=r,r=void 0),e.consume(h),u}function f(h){return s||r||!c?n(h):t(h)}}function hB(e,t){let n=0,r=0;return s;function s(u){return u===40?(n++,e.consume(u),s):u===41&&r<n?c(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(CC,t,c)(u):u===null||Tt(u)||Xi(u)?t(u):(e.consume(u),s)}function c(u){return u===41&&r++,e.consume(u),s}}function mB(e,t,n){return r;function r(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),r):d===38?(e.consume(d),c):d===93?(e.consume(d),s):d===60||d===null||Tt(d)||Xi(d)?t(d):n(d)}function s(d){return d===null||d===40||d===91||Tt(d)||Xi(d)?t(d):r(d)}function c(d){return zn(d)?u(d):n(d)}function u(d){return d===59?(e.consume(d),r):zn(d)?(e.consume(d),u):n(d)}}function gB(e,t,n){return r;function r(c){return e.consume(c),s}function s(c){return En(c)?n(c):t(c)}}function TC(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function AC(e){return!zn(e)}function RC(e){return!(e===47||Tm(e))}function Tm(e){return e===43||e===45||e===46||e===95||En(e)}function nv(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const vB={tokenize:CB,partial:!0};function yB(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:kB,continuation:{tokenize:SB},exit:jB}},text:{91:{name:"gfmFootnoteCall",tokenize:wB},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:bB,resolveTo:xB}}}}function bB(e,t,n){const r=this;let s=r.events.length;const c=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;s--;){const f=r.events[s][1];if(f.type==="labelImage"){u=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return d;function d(f){if(!u||!u._balanced)return n(f);const h=$a(r.sliceSerialize({start:u.end,end:r.now()}));return h.codePointAt(0)!==94||!c.includes(h.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function xB(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",c,t],["enter",u,t],["exit",u,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...d),e}function wB(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c=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(c>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($a(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Tt(m)||(u=!0),c++,e.consume(m),m===92?g:h}function g(m){return m===91||m===92||m===93?(e.consume(m),c++,h):h(m)}}function kB(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c,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 c=$a(r.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Tt(k)||(d=!0),u++,e.consume(k),k===92?m:g}function m(k){return k===91||k===92||k===93?(e.consume(k),u++,g):g(k)}function y(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),s.includes(c)||s.push(c),pt(e,x,"gfmFootnoteDefinitionWhitespace")):n(k)}function x(k){return t(k)}}function SB(e,t,n){return e.check(Vl,t,e.attempt(vB,t,n))}function jB(e){e.exit("gfmFootnoteDefinition")}function CB(e,t,n){const r=this;return pt(e,s,"gfmFootnoteDefinitionIndent",5);function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(c):n(c)}}function NB(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:c,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(u,d){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let h=f;for(;h--;)if(u[h][0]==="exit"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[h][1].end.offset-u[h][1].start.offset){u[f][1].type="strikethroughSequence",u[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},u[h][1].start),end:Object.assign({},u[f][1].end)},m={type:"strikethroughText",start:Object.assign({},u[h][1].end),end:Object.assign({},u[f][1].start)},y=[["enter",g,d],["enter",u[h][1],d],["exit",u[h][1],d],["enter",m,d]],x=d.parser.constructs.insideSpan.null;x&&sa(y,y.length,0,_d(x,u.slice(h+1,f),d)),sa(y,y.length,0,[["exit",m,d],["enter",u[f][1],d],["exit",u[f][1],d],["exit",g,d]]),sa(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 c(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"),x(k))}function x(k){const j=so(h);if(k===126)return m>1?f(k):(u.consume(k),m++,x);if(m<2&&!n)return f(k);const E=u.exit("strikethroughSequenceTemporary"),S=so(k);return E._open=!S||S===2&&!!j,E._close=!j||j===2&&!!S,d(k)}}}class EB{constructor(){this.map=[]}add(t,n,r){TB(this,t,n,r)}consume(t){if(this.map.sort(function(c,u){return c[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const c of s)t.push(c);s=r.pop()}this.map.length=0}}function TB(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function AB(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=r.length-1;r[c]=r[c]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function RB(){return{flow:{null:{name:"table",tokenize:_B,resolveAll:OB}}}}function _B(e,t,n){const r=this;let s=0,c=0,u;return d;function d(_){let P=r.events.length-1;for(;P>-1;){const I=r.events[P][1].type;if(I==="lineEnding"||I==="linePrefix")P--;else break}const B=P>-1?r.events[P][1].type:null,W=B==="tableHead"||B==="tableRow"?R:f;return W===R&&r.parser.lazy[r.now().line]?n(_):W(_)}function f(_){return e.enter("tableHead"),e.enter("tableRow"),h(_)}function h(_){return _===124||(u=!0,c+=1),g(_)}function g(_){return _===null?n(_):Pe(_)?c>1?(c=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),x):n(_):it(_)?pt(e,g,"whitespace")(_):(c+=1,u&&(u=!1,s+=1),_===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),m(_)))}function m(_){return _===null||_===124||Tt(_)?(e.exit("data"),g(_)):(e.consume(_),_===92?y:m)}function y(_){return _===92||_===124?(e.consume(_),m):m(_)}function x(_){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(_):(e.enter("tableDelimiterRow"),u=!1,it(_)?pt(e,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):k(_))}function k(_){return _===45||_===58?E(_):_===124?(u=!0,e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),j):q(_)}function j(_){return it(_)?pt(e,E,"whitespace")(_):E(_)}function E(_){return _===58?(c+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),S):_===45?(c+=1,S(_)):_===null||Pe(_)?A(_):q(_)}function S(_){return _===45?(e.enter("tableDelimiterFiller"),T(_)):q(_)}function T(_){return _===45?(e.consume(_),T):_===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),N):(e.exit("tableDelimiterFiller"),N(_))}function N(_){return it(_)?pt(e,A,"whitespace")(_):A(_)}function A(_){return _===124?k(_):_===null||Pe(_)?!u||s!==c?q(_):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(_)):q(_)}function q(_){return n(_)}function R(_){return e.enter("tableRow"),$(_)}function $(_){return _===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),$):_===null||Pe(_)?(e.exit("tableRow"),t(_)):it(_)?pt(e,$,"whitespace")(_):(e.enter("data"),H(_))}function H(_){return _===null||_===124||Tt(_)?(e.exit("data"),$(_)):(e.consume(_),_===92?z:H)}function z(_){return _===92||_===124?(e.consume(_),H):H(_)}}function OB(e,t){let n=-1,r=!0,s=0,c=[0,0,0,0],u=[0,0,0,0],d=!1,f=0,h,g,m;const y=new EB;for(;++n<e.length;){const x=e[n],k=x[1];x[0]==="enter"?k.type==="tableHead"?(d=!1,f!==0&&($w(y,t,f,h,g),g=void 0,f=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",h,t]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(r=!0,m=void 0,c=[0,0,0,0],u=[0,n+1,0,0],d&&(d=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",g,t]])),s=k.type==="tableDelimiterRow"?2:g?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(r=!1,u[2]===0&&(c[1]!==0&&(u[0]=u[1],m=Cu(y,t,c,s,void 0,m),c=[0,0,0,0]),u[2]=n)):k.type==="tableCellDivider"&&(r?r=!1:(c[1]!==0&&(u[0]=u[1],m=Cu(y,t,c,s,void 0,m)),c=u,u=[c[1],n,0,0])):k.type==="tableHead"?(d=!0,f=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(f=n,c[1]!==0?(u[0]=u[1],m=Cu(y,t,c,s,n,m)):u[1]!==0&&(m=Cu(y,t,u,s,n,m)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&$w(y,t,f,h,g),y.consume(t.events),n=-1;++n<t.events.length;){const x=t.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=AB(t.events,n))}return e}function Cu(e,t,n,r,s,c){const u=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(c.end=Object.assign({},Ws(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const f=Ws(t.events,n[1]);if(c={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",c,t]]),n[2]!==0){const h=Ws(t.events,n[2]),g=Ws(t.events,n[3]),m={type:d,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",m,t]]),r!==2){const y=t.events[n[2]],x=t.events[n[3]];if(y[1].end=Object.assign({},x[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&&(c.end=Object.assign({},Ws(t.events,s)),e.add(s,0,[["exit",c,t]]),c=void 0),c}function $w(e,t,n,r,s){const c=[],u=Ws(t.events,n);s&&(s.end=Object.assign({},u),c.push(["exit",s,t])),r.end=Object.assign({},u),c.push(["exit",r,t]),e.add(n+1,0,c)}function Ws(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const LB={name:"tasklistCheck",tokenize:MB};function zB(){return{text:{91:LB}}}function MB(e,t,n){const r=this;return s;function s(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),c)}function c(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:DB},t,n)(f):n(f)}}function DB(e,t,n){return pt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function $B(e){return Uj([lB(),yB(),NB(e),RB(),zB()])}const IB={};function PB(e){const t=this,n=e||IB,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),c=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push($B(n)),c.push(rB()),u.push(iB(n))}function UB(e){oC(e,[/\r?\n|\r/g,BB])}function BB(){return{type:"break"}}function FB(){return function(e){UB(e)}}const _C=["ts","tsx","js","jsx","py","sh","bash","json","yaml","sql","sparql","md","html","css","solidity","rust","go","toml","diff","dockerfile","xml"];let vl=null;function HB(){return vl||(vl=Ba(()=>import("./index-W4n8cdTA.js"),[]).then(e=>e.createHighlighter({themes:["github-dark","github-light"],langs:[..._C]})).catch(e=>{throw vl=null,e}),vl)}function qB(e){if(!e)return null;const t=e.toLowerCase().trim();return _C.includes(t)?t:t==="typescript"?"ts":t==="javascript"?"js":t==="python"?"py":t==="shell"||t==="zsh"?"sh":t==="yml"?"yaml":t==="markdown"?"md":t==="sol"?"solidity":t==="rs"?"rust":t==="golang"?"go":t==="patch"?"diff":t==="docker"?"dockerfile":null}function GB({code:e,lang:t}){const n=qB(t),[r,s]=w.useState(null),[c,u]=w.useState(!1),f=qn(m=>m.theme)==="light"?"github-light":"github-dark",h=w.useRef(null);w.useEffect(()=>{if(!n){s(null);return}let m=!1;return HB().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":c?"Copied":"Copy code",title:c?"Copied":"Copy code",children:c?o.jsx(r_,{size:14,"aria-hidden":"true"}):o.jsx(c_,{size:14,"aria-hidden":"true"})}),o.jsx("span",{className:"v10-md-copy-announce","aria-live":"polite",children:c?"Copied":""}),n&&o.jsx("span",{className:"v10-md-pre-lang","aria-hidden":"true",children:n}),r?o.jsx("div",{className:"v10-md-pre-rendered",dangerouslySetInnerHTML:{__html:r}}):o.jsx("pre",{className:"v10-md-pre-fallback",children:o.jsx("code",{children:e})})]})}function VB(){return e=>{let t="none",n=null;const r=new Set(["img","hr","br"]),s=(d,f)=>{const h=d.children;if(Array.isArray(h))for(let g=0;g<h.length;g++){const m=h[g];if(m.type==="text"&&typeof m.value=="string"&&m.value.trim().length>0)f?t="code":(n={siblings:h,index:g},t="text");else if(m.type==="element"){const y=m.tagName;y==="pre"?(t="code",s(m,!0)):y&&r.has(y)?t="leaf":s(m,f)}}},c=e;s(c,!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(c.children)&&c.children.push(u)}}function WB(e){return e?/^https?:\/\//i.test(e)?"http":/^mailto:/i.test(e)?"mailto":"inert":"inert"}function OC({content:e,streaming:t}){return o.jsx("div",{className:"v10-md",children:o.jsx(E8,{remarkPlugins:[PB,FB],rehypePlugins:t?[VB]:[],components:{img:({src:n,alt:r,title:s})=>o.jsxs("span",{className:"v10-md-image-placeholder",title:s||(typeof n=="string"?n:void 0),children:["[image",r?`: ${r}`:"","]"]}),h1:({children:n})=>o.jsx("h1",{className:"v10-md-h1",children:n}),h2:({children:n})=>o.jsx("h2",{className:"v10-md-h2",children:n}),h3:({children:n})=>o.jsx("h3",{className:"v10-md-h3",children:n}),h4:({children:n})=>o.jsx("h4",{className:"v10-md-h4",children:n}),h5:({children:n})=>o.jsx("h5",{className:"v10-md-h5",children:n}),h6:({children:n})=>o.jsx("h6",{className:"v10-md-h6",children:n}),p:({children:n})=>o.jsx("p",{className:"v10-md-p",children:n}),ul:({children:n})=>o.jsx("ul",{className:"v10-md-ul",children:n}),ol:({children:n})=>o.jsx("ol",{className:"v10-md-ol",children:n}),li:({children:n})=>o.jsx("li",{className:"v10-md-li",children:n}),a:({href:n,children:r})=>{const s=WB(n);return s==="http"?o.jsx("a",{className:"v10-md-link",href:n,target:"_blank",rel:"noopener noreferrer",children:r}):s==="mailto"?o.jsx("a",{className:"v10-md-link",href:n,children:r}):o.jsx("span",{className:"v10-md-link v10-md-link-inert",title:n,children:r})},blockquote:({children:n})=>o.jsx("blockquote",{className:"v10-md-blockquote",children:n}),hr:()=>o.jsx("hr",{className:"v10-md-hr"}),table:({children:n})=>o.jsx("div",{className:"v10-md-table-scroll",children:o.jsx("table",{className:"v10-md-table",children:n})}),thead:({children:n,node:r,...s})=>o.jsx("thead",{className:"v10-md-thead",...s,children:n}),tbody:({children:n,node:r,...s})=>o.jsx("tbody",{className:"v10-md-tbody",...s,children:n}),tr:({children:n,node:r,...s})=>o.jsx("tr",{className:"v10-md-tr",...s,children:n}),th:({children:n,node:r,...s})=>o.jsx("th",{className:"v10-md-th",...s,children:n}),td:({children:n,node:r,...s})=>o.jsx("td",{className:"v10-md-td",...s,children:n}),pre:({children:n,node:r})=>{var c,u,d;const s=(c=r==null?void 0:r.children)==null?void 0:c[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(GB,{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 ZB=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"})]}),YB=Ze.lazy(()=>Ba(()=>import("./Operations-CCMDENBd.js"),__vite__mapDeps([3,1])).then(e=>({default:e.OperationsPage}))),QB=Ze.lazy(()=>Ba(()=>import("./AgentHub-eWb_Tns6.js"),[]).then(e=>({default:e.AgentHubPage}))),KB=Ze.lazy(()=>Ba(()=>import("./Settings-WaFKYtwQ.js"),__vite__mapDeps([4,5])).then(e=>({default:e.SettingsPage}))),XB=Ze.lazy(()=>Ba(()=>import("./Admin-DNNaF7rz.js").then(e=>e.A),__vite__mapDeps([6,5])).then(e=>({default:e.AdminPage}))),JB=Ze.lazy(()=>Ba(()=>import("./AgentProfilePage-D2T_V6PG.js"),[]).then(e=>({default:e.AgentProfilePage})));function eF(){const{tabs:e,activeTabId:t,setActiveTab:n,closeTab:r}=yn();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:c=>{c.stopPropagation(),r(s.id)},children:ZB})]},s.id))})}const tF=["text/","application/json","application/xml","application/javascript","application/x-yaml"];function nF(e){return tF.some(t=>e.startsWith(t))}function aF({docRef:e,contentType:t}){const{tabs:n,activeTabId:r,closeTab:s}=yn(),c=yn(_=>_.setActiveTab),[u,d]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState(""),[y,x]=w.useState(!0),[k,j]=w.useState(null),[E,S]=w.useState("formatted"),T=e.startsWith("urn:dkg:file:"),N=n.find(_=>_.id===r),A=(N==null?void 0:N.label)??"Document",q=()=>{const _=n.find(P=>P.id.startsWith("project:"));_&&c(_.id),s(r)};w.useEffect(()=>{let _=!1;if(x(!0),j(null),d(null),h(null),m(""),!T){x(!1);return}const P=e.replace("urn:dkg:file:",""),B=new AbortController;return fetch(Ru(P,t||void 0),{headers:qt(),signal:B.signal}).then(async W=>{if(!W.ok)throw new Error(`HTTP ${W.status}`);const I=W.headers.get("content-type")??"application/octet-stream";if(!_)if(m(I),nF(I)){const D=await W.text();_||(d(D),x(!1))}else if(I.startsWith("image/")){const D=await W.blob();_||(h(URL.createObjectURL(D)),x(!1))}else if(I==="application/pdf"){const D=await W.blob();_||(h(URL.createObjectURL(D)),x(!1))}else{const D=await W.text();_||(d(D),x(!1))}}).catch(W=>{_||(j(W.message),x(!1))}),()=>{_=!0,B.abort()}},[e,T,t]),w.useEffect(()=>{S("formatted")},[e]),w.useEffect(()=>{const _=f;return()=>{_&&URL.revokeObjectURL(_)}},[f]);const R=g.startsWith("image/"),$=g==="application/pdf",H=g.startsWith("text/markdown")||t.startsWith("text/markdown"),z=!y&&!k&&T&&H&&u!==null;return o.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},children:[o.jsxs("div",{style:{flexShrink:0,display:"flex",alignItems:"center",gap:10,padding:"8px 16px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:[o.jsx("button",{onClick:q,style:{border:"1px solid var(--border-default)",borderRadius:5,background:"none",color:"var(--text-secondary)",fontSize:11,fontWeight:600,padding:"4px 10px",cursor:"pointer",fontFamily:"var(--font-sans)"},children:"← Back to Project"}),o.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:["📄 ",A]}),z&&o.jsx("div",{role:"group","aria-label":"Document view mode",style:{marginLeft:"auto",display:"flex",gap:2,padding:2,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-surface)"},children:["formatted","raw"].map(_=>{const P=E===_;return o.jsx("button",{type:"button","aria-pressed":P,onClick:()=>S(_),style:{border:"none",borderRadius:4,cursor:"pointer",padding:"3px 12px",fontSize:11,fontWeight:600,fontFamily:"var(--font-sans)",color:P?"var(--text-primary)":"var(--text-secondary)",background:P?"var(--bg-elevated)":"transparent"},children:_==="formatted"?"Formatted":"Raw"},_)})})]}),o.jsx("div",{style:{flex:1,overflow:"auto",padding:"20px 24px"},children:T?o.jsxs(o.Fragment,{children:[y&&o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:12},children:"Loading document..."}),k&&o.jsxs("div",{style:{color:"var(--accent-red)",fontSize:12},children:["Failed to load: ",k]}),!y&&R&&f&&o.jsx("img",{src:f,alt:A,style:{maxWidth:"100%",borderRadius:8}}),!y&&$&&f&&o.jsx("iframe",{src:f,title:A,style:{width:"100%",height:"100%",border:"none",borderRadius:8}}),u!==null&&!R&&!$&&H&&E==="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(OC,{content:u})}),u!==null&&!R&&!$&&!(H&&E==="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 rF(){const e=yn(t=>t.activeTabId);if(e==="dashboard")return o.jsx(fL,{});if(e==="operations")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading operations..."}),children:o.jsx(YB,{})});if(e==="agent-hub")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading agent hub..."}),children:o.jsx(QB,{})});if(e==="settings")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading settings..."}),children:o.jsx(KB,{})});if(e==="admin")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading admin..."}),children:o.jsx(XB,{})});if(e==="memory-stack")return o.jsx(p6,{});if(e===kg)return o.jsx(KI,{});if(e.startsWith("project:")){const t=e.slice(8);return o.jsx(YI,{contextGraphId:t})}if(e.startsWith("agent:")){const t=e.slice(6),n=t.indexOf("|");if(n>0){const r=t.slice(0,n),s=t.slice(n+1),c=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(JB,{contextGraphId:r,agentUri:c})})}}if(e.startsWith(Cg)){const{docRef:t,contentType:n}=U4(e);return o.jsx(aF,{docRef:t,contentType:n})}return e.startsWith("wm:")?o.jsx(Sh,{layer:"wm",contextGraphId:e.slice(3)}):e.startsWith("swm:")?o.jsx(Sh,{layer:"swm",contextGraphId:e.slice(4)}):e.startsWith("vm:")?o.jsx(Sh,{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 iF(){return o.jsxs("div",{className:"v10-panel-center",children:[o.jsx(eF,{}),o.jsx("div",{className:"v10-center-content",children:o.jsx(rF,{})})]})}const sF=["Node Log","Transactions"],oF=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"})}),lF=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"})]}),cF=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"})]}),uF=/(\x1B\[[0-9;]*[mGKHFJA-Z]|\[[0-9;]*m)/g;function dF(e){return e.replace(uF,"")}function Iw(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 pF={error:"var(--accent-red, #ef4444)",warn:"var(--accent-yellow, #f59e0b)",info:"var(--text-primary)",debug:"var(--text-tertiary)"};function fF(e){const t=w.useRef(null),n=w.useRef(!0);return w.useEffect(()=>{const r=t.current;if(!r)return;const s=()=>{n.current=r.scrollHeight-r.scrollTop-r.clientHeight<40};return r.addEventListener("scroll",s),()=>r.removeEventListener("scroll",s)},[]),w.useEffect(()=>{n.current&&t.current&&(t.current.scrollTop=t.current.scrollHeight)},[e]),t}function hF(){const[e,t]=w.useState([]),[n,r]=w.useState(""),[s,c]=w.useState("all"),u=w.useCallback(()=>{Tn.fetchNodeLog({lines:300,q:n||void 0}).then(({lines:g})=>t((g??[]).map(dF))).catch(()=>{})},[n]);w.useEffect(()=>{u();const g=setInterval(u,3e3);return()=>clearInterval(g)},[u]);const d=e.filter(g=>s==="all"||Iw(g)===s),f=d.length>0?d[d.length-1]:"",h=fF(f);return o.jsxs("div",{className:"v10-log-container",children:[o.jsxs("div",{className:"v10-log-toolbar",children:[o.jsx("input",{id:"dkg-node-log-filter",name:"dkg-node-log-filter",type:"text",placeholder:"Filter logs...",className:"v10-log-filter",value:n,onChange:g=>r(g.target.value),"aria-label":"Filter node log lines"}),o.jsxs("select",{id:"dkg-node-log-level",name:"dkg-node-log-level",className:"v10-log-level-select",value:s,onChange:g=>c(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:pF[Iw(g)]},children:g},m)),d.length===0&&o.jsx("div",{className:"v10-log-line",style:{color:"var(--text-tertiary)"},children:"No log output"})]})]})}const mF=new Set(["publish","publishFromSWM","update","ka-update","verify","reconstruct"]),gF={publish:"#22c55e",publishFromSWM:"#16a34a",update:"#14b8a6","ka-update":"#0d9488",verify:"#8b5cf6",reconstruct:"#fb923c"};function vF(){const[e,t]=w.useState([]),[n,r]=w.useState(null),s=w.useCallback(()=>{const c=String(Date.now()-216e5),u=[...mF].join(",");Tn.fetchOperationsWithPhases({limit:"100",from:c,names:u}).then(d=>{t((d==null?void 0:d.operations)??[])}).catch(()=>{})},[]);return w.useEffect(()=>{s();const c=setInterval(s,1e4);return()=>clearInterval(c)},[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(c=>{const u=(c.phases??[]).find(h=>h.phase==="chain"),d=c.tx_hash??(u==null?void 0:u.tx_hash),f=n===c.operation_id;return o.jsxs(Ze.Fragment,{children:[o.jsxs("tr",{onClick:()=>r(h=>h===c.operation_id?null:c.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:gF[c.operation_name]??"var(--text-secondary)",fontWeight:600},children:c.operation_name}),o.jsx("td",{style:{padding:"7px 12px",fontFamily:"var(--font-mono)",color:"var(--text-secondary)"},children:Ox(c.operation_id)}),o.jsx("td",{style:{padding:"7px 12px"},children:o.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,fontWeight:600,background:c.status==="success"?"rgba(34,197,94,.15)":c.status==="error"?"rgba(239,68,68,.15)":"rgba(245,158,11,.15)",color:c.status==="success"?"#22c55e":c.status==="error"?"#ef4444":"#f59e0b"},children:c.status})}),o.jsx("td",{style:{padding:"7px 12px",color:"var(--text-secondary)"},children:c.duration_ms!=null?_x(c.duration_ms):"—"}),o.jsx("td",{style:{padding:"7px 12px",color:"var(--text-secondary)"},children:c.started_at?kO(c.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)}…`:c.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:c.operation_id})]}),d&&o.jsxs("span",{children:[o.jsx("b",{children:"Tx:"})," ",o.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:d})]}),c.peer_id&&o.jsxs("span",{children:[o.jsx("b",{children:"Peer:"})," ",o.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:Ox(c.peer_id)})]}),c.error_message&&o.jsxs("span",{style:{color:"#ef4444"},children:[o.jsx("b",{children:"Error:"})," ",c.error_message]})]}),(c.phases??[]).length>0&&o.jsx("div",{style:{marginTop:8,display:"flex",gap:6,flexWrap:"wrap"},children:c.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?_x(h.duration_ms):""]},h.phase))})]})})]},c.operation_id)})})]})})}function yF(){const{bottomCollapsed:e,toggleBottom:t,bottomMaximised:n,toggleBottomMaximised:r,bottomHeight:s,setBottomHeight:c}=qn(),[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 x=E=>{const S=y-E.clientY;y=E.clientY,c(h.current+S)},k=()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",k),document.body.style.cursor="",document.body.style.userSelect="",m.classList.remove("active")},j=E=>{E.preventDefault(),y=E.clientY,document.addEventListener("mousemove",x),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)},[c]);const g=e?void 0:n?"80vh":Math.min(s,qu());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:[sF.map(m=>o.jsx("button",{className:`v10-bottom-tab ${m===u?"active":""}`,onClick:()=>{d(m),e&&t()},children:m},m)),o.jsx("div",{style:{flex:1}}),o.jsx("button",{className:"v10-bottom-toggle",onClick:r,title:n?"Restore":"Maximise",style:{display:e?"none":void 0},children:n?cF:lF}),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:oF})})]}),!e&&o.jsxs("div",{className:"v10-bottom-content",children:[u==="Node Log"&&o.jsx(hF,{}),u==="Transactions"&&o.jsx(vF,{})]})]})}function Pw(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 ld(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 Am(e){if(e==null||e==="")return;const t=e instanceof Date?e:new Date(e);if(!Number.isNaN(t.valueOf()))return t.toISOString()}function bF(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function xF(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 Rm(e,t){var n;return((n=e.find(r=>r.id===t))==null?void 0:n.name)??t}function wF(e){return e.startsWith("did:dkg:context-graph:")?e:`did:dkg:context-graph:${e}`}function kF(e){return String(e??"").replace(/[\u0000-\u001F\u007F]/g," ").replace(/\s+/g," ").trim()}function LC(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 zC(e){return e.status==="queued"||e.status==="completed"||e.status==="skipped"}function MC(e){return e.name.trim()}function SF(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:MC(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 jF(e){const t=[];return{results:e.flatMap(r=>{if(r.status!=="skipped"||!r.result)return[];t.push(r.id);const s=r.result,c=s.extraction;return[{id:r.id,fileName:MC(r.file),contextGraphId:r.contextGraphId,assertionName:r.assertionName,assertionUri:s.assertionUri,fileHash:s.fileHash,detectedContentType:s.detectedContentType,extractionStatus:"skipped",pipelineUsed:c.pipelineUsed??null,tripleCount:c.tripleCount??c.triplesWritten??0,...s.rootEntity?{rootEntity:s.rootEntity}:{},...c.mdIntermediateHash?{mdIntermediateHash:c.mdIntermediateHash}:{},...c.error?{error:c.error}:{}}]}),deliveredDraftIds:t}}function DC(e){return e.length===0?"":e.length===1?`Attachment import result: ${kF(e[0].fileName)}.`:`Attached ${e.length} document import results.`}function CF(e,t){const n=[LC(e),DC(t)].filter(r=>r.length>0).map(r=>r.replace(/\.$/,""));return n.length?`${n.join("; ")}.`:""}function NF(e,t,n){const r=[];if(t){const s=Rm(e,t);r.push({key:"target_context_graph",label:"Target context graph id",value:t}),r.push({key:"target_context_graph_uri",label:"Target context graph URI",value:wF(t)}),r.push({key:"target_context_graph_name",label:"Target context graph name",value:s})}return n!=null&&n.agentAddress&&r.push({key:"current_agent_address",label:"Current agent address",value:n.agentAddress}),n!=null&&n.agentDid&&r.push({key:"current_agent_did",label:"Current agent DID",value:n.agentDid}),n!=null&&n.peerId&&r.push({key:"current_agent_peer_id",label:"Current agent peer ID",value:n.peerId}),r}const EF="https://docs.openclaw.ai/",TF="https://github.com/openclaw/openclaw/releases",Wi="__add_agent__",AF=["openclaw"];function RF(e,t){const n=t instanceof Error?t.message:String(t??"Unknown error");if(t instanceof Qh){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 _F=0;function OF(e,t,n){const r=e.trim();return r?r===t?!0:n==="Request cancelled."&&r===n:!1}function LF(e,t,n,r){return e&&OF(e,t,n)?{content:e,synthesized:!0}:e?r==="hermes"?{content:e,failureNotice:t,synthesized:!1}:{content:e,synthesized:!1}:{content:"",failureNotice:t,synthesized:!0}}function Uw(e,t=""){const n=e.author.toLowerCase(),r=n.includes("assistant")||n.includes("agent")?"assistant":"user",s=typeof e.failureReason=="string"&&e.failureReason.trim()?e.failureReason.trim():void 0,c=r==="assistant"&&(e.persistStatus==="failed"||!!s),u=`Error: ${s??"The local agent turn failed."}`,d=c?LF(e.text,u,s,t):null,f=(d==null?void 0:d.content)??(e.text||LC(e.attachmentRefs??[])),h=!!e.text;return{id:e.uri||`local-history:${++_F}`,uri:e.uri,turnId:e.turnId,role:r,content:f,ts:ld(e.ts),tsRaw:Am(e.ts),attachments:e.attachmentRefs,failureNotice:d==null?void 0:d.failureNotice,synthesized:(d==null?void 0:d.synthesized)??!h}}function zF(e){return e.turnId?`turn:${e.turnId}:${e.role}`:e.uri??`${e.role}:${e.ts??""}:${e.content}`}function Bw(e,t){const n=new Set,r=[];for(const s of[...t,...e]){const c=zF(s);n.has(c)||(n.add(c),r.push(s))}return r}function Fw(e,t,n){const r=typeof n=="string"&&n.trim()?n.trim():t;return!r||r===t?e:e.map(s=>s.turnId===t?{...s,turnId:r}:s)}function Hw(e){return e.replace(/\r\n/g,`
1653
- `).replace(/^(?:[ \t]*\n)+/,"").replace(/(?:\n[ \t]*)+$/,"")}function MF(e,t,n,r,s){const c=Hw(e),u=s?Hw(s):"";if(t==="assistant"&&r&&c.trim()===""&&!u)return o.jsx("span",{className:"v10-chat-thinking",role:"status","aria-live":"polite",children:"Thinking…"});if(t==="assistant"&&!n&&c.trim()!=="")return o.jsxs(o.Fragment,{children:[o.jsx(OC,{content:c,streaming:r&&!u}),u&&o.jsxs("span",{className:"v10-chat-plaintext v10-chat-failure-notice",children:[u,r&&o.jsx("span",{className:"v10-chat-cursor"})]})]});const d=[c,u].filter(Boolean).join(`
1654
-
1655
- `);return o.jsxs("span",{className:"v10-chat-plaintext",children:[d,r&&o.jsx("span",{className:"v10-chat-cursor"})]})}function _m(){return _m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_m.apply(null,arguments)}function DF(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var $F=w.useLayoutEffect,IF=function(t){var n=Ze.useRef(t);return $F(function(){n.current=t}),n},qw=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},PF=function(t,n){var r=Ze.useRef();return Ze.useCallback(function(s){t.current=s,r.current&&qw(r.current,null),r.current=n,n&&qw(n,s)},[n])},Gw={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},UF=function(t){Object.keys(Gw).forEach(function(n){t.style.setProperty(n,Gw[n],"important")})},Vw=UF,_n=null,Ww=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function BF(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),_n||(_n=document.createElement("textarea"),_n.setAttribute("tabindex","-1"),_n.setAttribute("aria-hidden","true"),Vw(_n)),_n.parentNode===null&&document.body.appendChild(_n);var s=e.paddingSize,c=e.borderSize,u=e.sizingStyle,d=u.boxSizing;Object.keys(u).forEach(function(y){var x=y;_n.style[x]=u[x]}),Vw(_n),_n.value=t;var f=Ww(_n,e);_n.value=t,f=Ww(_n,e),_n.value="x";var h=_n.scrollHeight-s,g=h*n;d==="border-box"&&(g=g+s+c),f=Math.max(g,f);var m=h*r;return d==="border-box"&&(m=m+s+c),f=Math.min(m,f),[f,h]}var Zw=function(){},FF=function(t,n){return t.reduce(function(r,s){return r[s]=n[s],r},{})},HF=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],qF=!!document.documentElement.currentStyle,GF=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=FF(HF,n),s=r.boxSizing;if(s==="")return null;qF&&s==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var c=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),u=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:c,borderSize:u}},VF=GF;function av(e,t,n){var r=IF(n);w.useLayoutEffect(function(){var s=function(u){return r.current(u)};if(e)return e.addEventListener(t,s),function(){return e.removeEventListener(t,s)}},[])}var WF=function(t,n){av(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},ZF=function(t){av(window,"resize",t)},YF=function(t){av(document.fonts,"loadingdone",t)},QF=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],KF=function(t,n){var r=t.cacheMeasurements,s=t.maxRows,c=t.minRows,u=t.onChange,d=u===void 0?Zw:u,f=t.onHeightChange,h=f===void 0?Zw:f,g=DF(t,QF),m=g.value!==void 0,y=w.useRef(null),x=PF(y,n),k=w.useRef(0),j=w.useRef(),E=function(){var N=y.current,A=r&&j.current?j.current:VF(N);if(A){j.current=A;var q=BF(A,N.value||N.placeholder||"x",c,s),R=q[0],$=q[1];k.current!==R&&(k.current=R,N.style.setProperty("height",R+"px","important"),h(R,{rowHeight:$}))}},S=function(N){m||E(),d(N)};return w.useLayoutEffect(E),WF(y,function(){if(!m){var T=y.current.value;requestAnimationFrame(function(){var N=y.current;N&&T!==N.value&&E()})}}),ZF(E),YF(E),w.createElement("textarea",_m({},g,{onChange:S,ref:x}))},XF=w.forwardRef(KF),Fh={exports:{}},Hh,Yw;function JF(){if(Yw)return Hh;Yw=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Hh=e,Hh}var qh,Qw;function eH(){if(Qw)return qh;Qw=1;var e=JF();function t(){}function n(){}return n.resetWarningCache=t,qh=function(){function r(u,d,f,h,g,m){if(m!==e){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}}r.isRequired=r;function s(){return r}var c={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:n,resetWarningCache:t};return c.PropTypes=c,c},qh}var Kw;function tH(){return Kw||(Kw=1,Fh.exports=eH()()),Fh.exports}var nH=tH();const Et=$l(nH);function is(e,t,n,r){function s(c){return c instanceof n?c:new n(function(u){u(c)})}return new(n||(n=Promise))(function(c,u){function d(g){try{h(r.next(g))}catch(m){u(m)}}function f(g){try{h(r.throw(g))}catch(m){u(m)}}function h(g){g.done?c(g.value):s(g.value).then(d,f)}h((r=r.apply(e,t||[])).next())})}const aH=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 oo(e,t,n){const r=rH(e),{webkitRelativePath:s}=e,c=typeof t=="string"?t:typeof s=="string"&&s.length>0?s:`./${e.name}`;return typeof r.path!="string"&&Xw(r,"path",c),Xw(r,"relativePath",c),r}function rH(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),s=aH.get(r);s&&Object.defineProperty(e,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return e}function Xw(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const iH=[".DS_Store","Thumbs.db"];function sH(e){return is(this,void 0,void 0,function*(){return cd(e)&&oH(e.dataTransfer)?dH(e.dataTransfer,e.type):lH(e)?cH(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?uH(e):[]})}function oH(e){return cd(e)}function lH(e){return cd(e)&&cd(e.target)}function cd(e){return typeof e=="object"&&e!==null}function cH(e){return Om(e.target.files).map(t=>oo(t))}function uH(e){return is(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>oo(n))})}function dH(e,t){return is(this,void 0,void 0,function*(){if(e.items){const n=Om(e.items).filter(s=>s.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(pH));return Jw($C(r))}return Jw(Om(e.files).map(n=>oo(n)))})}function Jw(e){return e.filter(t=>iH.indexOf(t.name)===-1)}function Om(e){if(e===null)return[];const t=[];for(let n=0;n<e.length;n++){const r=e[n];t.push(r)}return t}function pH(e){if(typeof e.webkitGetAsEntry!="function")return ek(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?IC(t):ek(e,t)}function $C(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?$C(n):[n]],[])}function ek(e,t){return is(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const c=yield e.getAsFileSystemHandle();if(c===null)throw new Error(`${e} is not a File`);if(c!==void 0){const u=yield c.getFile();return u.handle=c,oo(u)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return oo(r,(n=t==null?void 0:t.fullPath)!==null&&n!==void 0?n:void 0)})}function fH(e){return is(this,void 0,void 0,function*(){return e.isDirectory?IC(e):hH(e)})}function IC(e){const t=e.createReader();return new Promise((n,r)=>{const s=[];function c(){t.readEntries(u=>is(this,void 0,void 0,function*(){if(u.length){const d=Promise.all(u.map(fH));s.push(d),c()}else try{const d=yield Promise.all(s);n(d)}catch(d){r(d)}}),u=>{r(u)})}c()})}function hH(e){return is(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const s=oo(r,e.fullPath);t(s)},r=>{n(r)})})})}var Nu={},tk;function mH(){return tk||(tk=1,Nu.__esModule=!0,Nu.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(",");if(n.length===0)return!0;var r=e.name||"",s=(e.type||"").toLowerCase(),c=s.replace(/\/.*$/,"");return n.some(function(u){var d=u.trim().toLowerCase();return d.charAt(0)==="."?r.toLowerCase().endsWith(d):d.endsWith("/*")?c===d.replace(/\/.*$/,""):s===d})}return!0}),Nu}var gH=mH();const Gh=$l(gH);function nk(e){return bH(e)||yH(e)||UC(e)||vH()}function vH(){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 yH(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function bH(e){if(Array.isArray(e))return Lm(e)}function ak(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function rk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ak(Object(n),!0).forEach(function(r){PC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ak(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function PC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dl(e,t){return kH(e)||wH(e,t)||UC(e,t)||xH()}function xH(){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 UC(e,t){if(e){if(typeof e=="string")return Lm(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 Lm(e,t)}}function Lm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wH(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],s=!0,c=!1,u,d;try{for(n=n.call(e);!(s=(u=n.next()).done)&&(r.push(u.value),!(t&&r.length===t));s=!0);}catch(f){c=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(c)throw d}}return r}}function kH(e){if(Array.isArray(e))return e}var SH=typeof Gh=="function"?Gh:Gh.default,jH="file-invalid-type",CH="file-too-large",NH="file-too-small",EH="too-many-files",TH=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),r=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:jH,message:"File type must be ".concat(r)}},ik=function(t){return{code:CH,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},sk=function(t){return{code:NH,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},AH={code:EH,message:"Too many files"};function RH(e){return e.type===""&&typeof e.getAsFile=="function"}function BC(e,t){var n=e.type==="application/x-moz-file"||SH(e,t)||RH(e);return[n,n?null:TH(t)]}function FC(e,t,n){if(Vi(e.size))if(Vi(t)&&Vi(n)){if(e.size>n)return[!1,ik(n)];if(e.size<t)return[!1,sk(t)]}else{if(Vi(t)&&e.size<t)return[!1,sk(t)];if(Vi(n)&&e.size>n)return[!1,ik(n)]}return[!0,null]}function Vi(e){return e!=null}function _H(e){var t=e.files,n=e.accept,r=e.minSize,s=e.maxSize,c=e.multiple,u=e.maxFiles,d=e.validator;return!c&&t.length>1||c&&u>=1&&t.length>u?!1:t.every(function(f){var h=BC(f,n),g=Dl(h,1),m=g[0],y=FC(f,r,s),x=Dl(y,1),k=x[0],j=d?d(f):null;return m&&k&&!j})}function ud(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function yl(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 ok(e){e.preventDefault()}function OH(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function LH(e){return e.indexOf("Edge/")!==-1}function zH(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return OH(e)||LH(e)}function er(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var s=arguments.length,c=new Array(s>1?s-1:0),u=1;u<s;u++)c[u-1]=arguments[u];return t.some(function(d){return!ud(r)&&d&&d.apply(void 0,[r].concat(c)),ud(r)})}}function MH(){return"showOpenFilePicker"in window}function DH(e){if(Vi(e)){var t=Object.entries(e).filter(function(n){var r=Dl(n,2),s=r[0],c=r[1],u=!0;return HC(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(c)||!c.every(qC))&&(console.warn('Skipped "'.concat(s,'" because an invalid file extension was provided.')),u=!1),u}).reduce(function(n,r){var s=Dl(r,2),c=s[0],u=s[1];return rk(rk({},n),{},PC({},c,u))},{});return[{description:"Files",accept:t}]}return e}function $H(e){if(Vi(e))return Object.entries(e).reduce(function(t,n){var r=Dl(n,2),s=r[0],c=r[1];return[].concat(nk(t),[s],nk(c))},[]).filter(function(t){return HC(t)||qC(t)}).join(",")}function IH(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function PH(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function HC(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function qC(e){return/^.*\.[\w]+$/.test(e)}var UH=["children"],BH=["open"],FH=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],HH=["refKey","onChange","onClick"];function lk(e){return VH(e)||GH(e)||GC(e)||qH()}function qH(){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 GH(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function VH(e){if(Array.isArray(e))return zm(e)}function Vh(e,t){return YH(e)||ZH(e,t)||GC(e,t)||WH()}function WH(){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 GC(e,t){if(e){if(typeof e=="string")return zm(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 zm(e,t)}}function zm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ZH(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],s=!0,c=!1,u,d;try{for(n=n.call(e);!(s=(u=n.next()).done)&&(r.push(u.value),!(t&&r.length===t));s=!0);}catch(f){c=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(c)throw d}}return r}}function YH(e){if(Array.isArray(e))return e}function ck(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Mt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ck(Object(n),!0).forEach(function(r){Mm(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ck(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Mm(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dd(e,t){if(e==null)return{};var n=QH(e,t),r,s;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(s=0;s<c.length;s++)r=c[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function QH(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,c;for(c=0;c<r.length;c++)s=r[c],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var rv=w.forwardRef(function(e,t){var n=e.children,r=dd(e,UH),s=WC(r),c=s.open,u=dd(s,BH);return w.useImperativeHandle(t,function(){return{open:c}},[c]),Ze.createElement(w.Fragment,null,n(Mt(Mt({},u),{},{open:c})))});rv.displayName="Dropzone";var VC={disabled:!1,getFilesFromEvent:sH,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};rv.defaultProps=VC;rv.propTypes={children:Et.func,accept:Et.objectOf(Et.arrayOf(Et.string)),multiple:Et.bool,preventDropOnDocument:Et.bool,noClick:Et.bool,noKeyboard:Et.bool,noDrag:Et.bool,noDragEventsBubbling:Et.bool,minSize:Et.number,maxSize:Et.number,maxFiles:Et.number,disabled:Et.bool,getFilesFromEvent:Et.func,onFileDialogCancel:Et.func,onFileDialogOpen:Et.func,useFsAccessApi:Et.bool,autoFocus:Et.bool,onDragEnter:Et.func,onDragLeave:Et.func,onDragOver:Et.func,onDrop:Et.func,onDropAccepted:Et.func,onDropRejected:Et.func,onError:Et.func,validator:Et.func};var Dm={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function WC(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Mt(Mt({},VC),e),n=t.accept,r=t.disabled,s=t.getFilesFromEvent,c=t.maxSize,u=t.minSize,d=t.multiple,f=t.maxFiles,h=t.onDragEnter,g=t.onDragLeave,m=t.onDragOver,y=t.onDrop,x=t.onDropAccepted,k=t.onDropRejected,j=t.onFileDialogCancel,E=t.onFileDialogOpen,S=t.useFsAccessApi,T=t.autoFocus,N=t.preventDropOnDocument,A=t.noClick,q=t.noKeyboard,R=t.noDrag,$=t.noDragEventsBubbling,H=t.onError,z=t.validator,_=w.useMemo(function(){return $H(n)},[n]),P=w.useMemo(function(){return DH(n)},[n]),B=w.useMemo(function(){return typeof E=="function"?E:uk},[E]),W=w.useMemo(function(){return typeof j=="function"?j:uk},[j]),I=w.useRef(null),D=w.useRef(null),F=w.useReducer(KH,Dm),V=Vh(F,2),X=V[0],Q=V[1],L=X.isFocused,U=X.isFileDialogActive,G=w.useRef(typeof window<"u"&&window.isSecureContext&&S&&MH()),O=function(){!G.current&&U&&setTimeout(function(){if(D.current){var K=D.current.files;K.length||(Q({type:"closeDialog"}),W())}},300)};w.useEffect(function(){return window.addEventListener("focus",O,!1),function(){window.removeEventListener("focus",O,!1)}},[D,U,W,G]);var ne=w.useRef([]),ue=w.useRef([]),le=function(K){I.current&&I.current.contains(K.target)||(K.preventDefault(),ne.current=[])};w.useEffect(function(){return N&&(document.addEventListener("dragover",ok,!1),document.addEventListener("drop",le,!1)),function(){N&&(document.removeEventListener("dragover",ok),document.removeEventListener("drop",le))}},[I,N]),w.useEffect(function(){var ye=function(he){ue.current=[].concat(lk(ue.current),[he.target]),yl(he)&&Q({isDragGlobal:!0,type:"setDragGlobal"})},K=function(he){ue.current=ue.current.filter(function(Le){return Le!==he.target&&Le!==null}),!(ue.current.length>0)&&Q({isDragGlobal:!1,type:"setDragGlobal"})},Z=function(){ue.current=[],Q({isDragGlobal:!1,type:"setDragGlobal"})},ee=function(){ue.current=[],Q({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",ye,!1),document.addEventListener("dragleave",K,!1),document.addEventListener("dragend",Z,!1),document.addEventListener("drop",ee,!1),function(){document.removeEventListener("dragenter",ye),document.removeEventListener("dragleave",K),document.removeEventListener("dragend",Z),document.removeEventListener("drop",ee)}},[I]),w.useEffect(function(){return!r&&T&&I.current&&I.current.focus(),function(){}},[I,T,r]);var be=w.useCallback(function(ye){H?H(ye):console.error(ye)},[H]),Re=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye),ne.current=[].concat(lk(ne.current),[ye.target]),yl(ye)&&Promise.resolve(s(ye)).then(function(K){if(!(ud(ye)&&!$)){var Z=K.length,ee=Z>0&&_H({files:K,accept:_,minSize:u,maxSize:c,multiple:d,maxFiles:f,validator:z}),ce=Z>0&&!ee;Q({isDragAccept:ee,isDragReject:ce,isDragActive:!0,type:"setDraggedFiles"}),h&&h(ye)}}).catch(function(K){return be(K)})},[s,h,be,$,_,u,c,d,f,z]),Ee=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye);var K=yl(ye);if(K&&ye.dataTransfer)try{ye.dataTransfer.dropEffect="copy"}catch{}return K&&m&&m(ye),!1},[m,$]),Ie=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye);var K=ne.current.filter(function(ee){return I.current&&I.current.contains(ee)}),Z=K.indexOf(ye.target);Z!==-1&&K.splice(Z,1),ne.current=K,!(K.length>0)&&(Q({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),yl(ye)&&g&&g(ye))},[I,g,$]),Ve=w.useCallback(function(ye,K){var Z=[],ee=[];ye.forEach(function(ce){var he=BC(ce,_),Le=Vh(he,2),He=Le[0],Ce=Le[1],Fe=FC(ce,u,c),et=Vh(Fe,2),Ne=et[0],Wt=et[1],At=z?z(ce):null;if(He&&Ne&&!At)Z.push(ce);else{var Ha=[Ce,Wt];At&&(Ha=Ha.concat(At)),ee.push({file:ce,errors:Ha.filter(function(la){return la})})}}),(!d&&Z.length>1||d&&f>=1&&Z.length>f)&&(Z.forEach(function(ce){ee.push({file:ce,errors:[AH]})}),Z.splice(0)),Q({acceptedFiles:Z,fileRejections:ee,type:"setFiles"}),y&&y(Z,ee,K),ee.length>0&&k&&k(ee,K),Z.length>0&&x&&x(Z,K)},[Q,d,_,u,c,f,y,x,k,z]),Se=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye),ne.current=[],yl(ye)&&Promise.resolve(s(ye)).then(function(K){ud(ye)&&!$||Ve(K,ye)}).catch(function(K){return be(K)}),Q({type:"reset"})},[s,Ve,be,$]),ht=w.useCallback(function(){if(G.current){Q({type:"openDialog"}),B();var ye={multiple:d,types:P};window.showOpenFilePicker(ye).then(function(K){return s(K)}).then(function(K){Ve(K,null),Q({type:"closeDialog"})}).catch(function(K){IH(K)?(W(K),Q({type:"closeDialog"})):PH(K)?(G.current=!1,D.current?(D.current.value=null,D.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(K)});return}D.current&&(Q({type:"openDialog"}),B(),D.current.value=null,D.current.click())},[Q,B,W,S,Ve,be,P,d]),Me=w.useCallback(function(ye){!I.current||!I.current.isEqualNode(ye.target)||(ye.key===" "||ye.key==="Enter"||ye.keyCode===32||ye.keyCode===13)&&(ye.preventDefault(),ht())},[I,ht]),qe=w.useCallback(function(){Q({type:"focus"})},[]),ke=w.useCallback(function(){Q({type:"blur"})},[]),ct=w.useCallback(function(){A||(zH()?setTimeout(ht,0):ht())},[A,ht]),xe=function(K){return r?null:K},Oe=function(K){return q?null:xe(K)},_t=function(K){return R?null:xe(K)},Dt=function(K){$&&K.stopPropagation()},Qt=w.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},K=ye.refKey,Z=K===void 0?"ref":K,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=dd(ye,FH);return Mt(Mt(Mm({onKeyDown:Oe(er(ce,Me)),onFocus:Oe(er(he,qe)),onBlur:Oe(er(Le,ke)),onClick:xe(er(He,ct)),onDragEnter:_t(er(Ce,Re)),onDragOver:_t(er(Fe,Ee)),onDragLeave:_t(er(et,Ie)),onDrop:_t(er(Ne,Se)),role:typeof ee=="string"&&ee!==""?ee:"presentation"},Z,I),!r&&!q?{tabIndex:0}:{}),Wt)}},[I,Me,qe,ke,ct,Re,Ee,Ie,Se,q,R,r]),Ft=w.useCallback(function(ye){ye.stopPropagation()},[]),dt=w.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},K=ye.refKey,Z=K===void 0?"ref":K,ee=ye.onChange,ce=ye.onClick,he=dd(ye,HH),Le=Mm({accept:_,multiple:d,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:xe(er(ee,Se)),onClick:xe(er(ce,Ft)),tabIndex:-1},Z,D);return Mt(Mt({},Le),he)}},[D,n,d,Se,r]);return Mt(Mt({},X),{},{isFocused:L&&!r,getRootProps:Qt,getInputProps:dt,rootRef:I,inputRef:D,open:xe(ht)})}function KH(e,t){switch(t.type){case"focus":return Mt(Mt({},e),{},{isFocused:!0});case"blur":return Mt(Mt({},e),{},{isFocused:!1});case"openDialog":return Mt(Mt({},Dm),{},{isFileDialogActive:!0});case"closeDialog":return Mt(Mt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Mt(Mt({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Mt(Mt({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return Mt(Mt({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return Mt({},Dm);default:return e}}function uk(){}function XH({value:e,onChange:t,options:n,placeholder:r="Select…",disabled:s=!1,className:c,ariaLabel:u,prefixIcon:d}){const[f,h]=w.useState(!1),[g,m]=w.useState(null),[y,x]=w.useState(()=>{const z=n.findIndex(_=>_.value===e);return z>=0?z:0}),k=w.useRef(null),j=w.useRef(null),E=w.useRef(null),S=n.find(z=>z.value===e),T=(S==null?void 0:S.label)??r,N=w.useCallback(()=>{var z;h(!1),(z=j.current)==null||z.focus()},[]),A=w.useCallback(()=>{const z=j.current;if(!z)return;const _=z.getBoundingClientRect(),P=Math.min(240,n.length*36+16),B=window.innerHeight-_.bottom,W=_.top,I=B<P+16&&W>B?"above":"below";m({left:_.left,top:I==="below"?_.bottom+4:_.top-4,width:_.width,placement:I})},[n.length]);w.useLayoutEffect(()=>{f&&A()},[f,A]),w.useEffect(()=>{if(!f)return;const z=()=>A(),_=()=>A(),P=W=>{var D,F;const I=W.target;(D=k.current)!=null&&D.contains(I)||(F=E.current)!=null&&F.contains(I)||h(!1)},B=W=>{W.key==="Escape"&&(W.preventDefault(),N())};return window.addEventListener("scroll",z,!0),window.addEventListener("resize",_),document.addEventListener("mousedown",P),document.addEventListener("keydown",B),()=>{window.removeEventListener("scroll",z,!0),window.removeEventListener("resize",_),document.removeEventListener("mousedown",P),document.removeEventListener("keydown",B)}},[f,N,A]),w.useEffect(()=>{if(f){const z=n.findIndex(_=>_.value===e);x(z>=0?z:0),requestAnimationFrame(()=>{var _;return(_=E.current)==null?void 0:_.focus()})}},[f,e,n]),w.useEffect(()=>{s&&f&&h(!1)},[s,f]);const q=z=>{s||(z.key==="ArrowDown"||z.key==="Enter"||z.key===" ")&&(z.preventDefault(),h(!0))},R=z=>{var _;if(z.key==="ArrowDown")z.preventDefault(),x(P=>{var B;for(let W=1;W<=n.length;W++){const I=(P+W)%n.length;if(!((B=n[I])!=null&&B.disabled))return I}return P});else if(z.key==="ArrowUp")z.preventDefault(),x(P=>{var B;for(let W=1;W<=n.length;W++){const I=(P-W+n.length)%n.length;if(!((B=n[I])!=null&&B.disabled))return I}return P});else if(z.key==="Enter"){z.preventDefault();const P=n[y];P&&!P.disabled&&(t(P.value),N())}else if(z.key==="Home"){z.preventDefault();const P=n.findIndex(B=>!B.disabled);P>=0&&x(P)}else if(z.key==="End"){z.preventDefault();let P=-1;for(let B=n.length-1;B>=0;B--)if(!((_=n[B])!=null&&_.disabled)){P=B;break}P>=0&&x(P)}},$=["v10-select",c,s?"disabled":"",f?"open":""].filter(Boolean).join(" "),H=g?g.placement==="below"?{position:"fixed",left:g.left,top:g.top,width:g.width}:{position:"fixed",left:g.left,top:g.top,width:g.width,transform:"translateY(-100%)"}:void 0;return o.jsxs("div",{ref:k,className:$,children:[o.jsxs("button",{ref:j,type:"button",className:"v10-select-trigger",onClick:()=>!s&&h(z=>!z),onKeyDown:q,disabled:s,"aria-haspopup":"listbox","aria-expanded":f,"aria-label":u,children:[d&&o.jsx("span",{className:"v10-select-prefix","aria-hidden":"true",children:d}),o.jsx("span",{className:`v10-select-value ${S?"":"placeholder"}`,children:T}),o.jsx(s_,{className:"v10-select-caret",size:12,"aria-hidden":"true"})]}),f&&g&&YA.createPortal(o.jsxs("ul",{ref:E,className:`v10-select-menu v10-select-menu-${g.placement}`,role:"listbox",tabIndex:-1,onKeyDown:R,style:H,children:[n.length===0&&o.jsx("li",{className:"v10-select-option empty","aria-disabled":"true",children:"No options"}),n.map((z,_)=>o.jsx("li",{role:"option","aria-selected":z.value===e,title:z.label,className:["v10-select-option",z.value===e?"selected":"",_===y?"highlighted":"",z.disabled?"disabled":""].filter(Boolean).join(" "),onMouseEnter:()=>x(_),onMouseDown:P=>P.preventDefault(),onClick:()=>{s||z.disabled||(t(z.value),N())},children:z.label},z.value))]}),document.body)]})}function dk(e){return e.bridgeOnline?"connected":e.status==="connecting"?"known":e.status==="degraded"?"degraded":"offline"}function JH(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 e7(e){const[t,n]=w.useState(!1),[r,s]=w.useState(!1),c=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=x=>{var k;(k=c.current)!=null&&k.contains(x.target)||n(!1)},y=x=>{x.key==="Escape"&&(x.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 E,S;if(m.key==="Tab"){n(!1);return}if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;m.preventDefault();const y=Array.from(((E=d.current)==null?void 0:E.querySelectorAll(".v10-agent-tab-menu-item:not(:disabled)"))??[]);if(y.length===0)return;const x=y.findIndex(T=>T===document.activeElement),k=m.key==="ArrowDown"?1:-1,j=x===-1?k===1?0:y.length-1:(x+k+y.length)%y.length;(S=y[j])==null||S.focus()};return o.jsxs("div",{className:"v10-agent-tab-menu",ref:c,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(d_,{"aria-hidden":"true",size:14})}),t&&o.jsxs("div",{ref:d,className:`v10-agent-tab-menu-popover${r?" align-right":""}`,role:"menu",onKeyDown:g,children:[o.jsxs("div",{className:"v10-agent-tab-menu-status","aria-hidden":"true",children:[o.jsx("span",{className:`v10-agents-stat-dot ${e.statusDotClass}`}),o.jsx("span",{children:e.statusLabel})]}),o.jsx("button",{type:"button",role:"menuitem",className:"v10-agent-tab-menu-item",disabled:e.refreshBusy,onClick:()=>{f(),e.onRefresh()},children:e.refreshBusy?"Refreshing…":"Refresh"}),e.canDisconnect&&o.jsx("button",{type:"button",role:"menuitem",className:"v10-agent-tab-menu-item danger",onClick:()=>{f(),e.onDisconnect()},children:"Disconnect"})]})]})}function ZC(e,t){return(t==null?void 0:t.trim())||`integration:${e}`}function pd(e){const t=e.sessionId??e.defaultSessionId??Zs(e.integrationId);return{integrationId:e.integrationId,sessionId:t,stateKey:ZC(e.integrationId,t)}}function YC(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 QC(e){var n;if(e.selectedSessionId==null)return!1;const t=e.integrations.find(r=>r.id===e.integrationId);return!(((n=YC(e.selectedSessionId,e.integrations))==null?void 0:n.id)!==e.integrationId||t!=null&&t.defaultSessionId&&e.selectedSessionId!==t.defaultSessionId&&n7(e.integrationId,e.selectedSessionId))}function t7(e){return QC(e)}function n7(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 pk(e,t){const n=e.flatMap(r=>{var d;const s=YC(r.session,t);if(!s)return[];const c=r.messages.find(f=>f.author==="user"),u=r.messages[r.messages.length-1];return[{sessionId:r.session,integrationId:s.id,integrationName:s.name,preview:((d=c==null?void 0:c.text)==null?void 0:d.slice(0,60))||r.session,messageCount:r.messages.length,lastTs:u==null?void 0:u.ts}]});return n.sort((r,s)=>{const c=Date.parse(r.lastTs??""),u=Date.parse(s.lastTs??"");return Number.isFinite(c)&&Number.isFinite(u)?u-c:String(s.lastTs??"").localeCompare(String(r.lastTs??""))}),n}function KC(e,t,n,r,s){var u;const c=pd({integrationId:e,sessionId:t,defaultSessionId:s});return(((u=n[c.stateKey])==null?void 0:u.length)??0)>0||(c.sessionId?r.some(d=>d.sessionId===c.sessionId):!1)}function XC(e,t,n){const r=ZC(e,null);return Object.entries(t).some(([s,c])=>c.length>0&&(s===r||s.startsWith(`${e}:`)))||n.some(s=>s.integrationId===e)}function a7(e){const t=[...e.integrations].sort(Md),n=t.filter(d=>d.persistentChat),r=t.find(d=>d.id===e.selectedIntegrationId)??n[0]??null,s=r?pd({integrationId:r.id,sessionId:e.selectedSessionId,defaultSessionId:r.defaultSessionId}):null,c=r?KC(r.id,e.selectedSessionId,e.localMessagesByConversation,e.sessions,r.defaultSessionId):!1,u=r?XC(r.id,e.localMessagesByConversation,e.sessions):!1;return{sortedIntegrations:t,connectedIntegrations:n,selectedIntegration:r,selectedConversation:s,selectedHasConversation:c,selectedIntegrationHasAnyConversation:u}}function r7(e){const t=e.selectedIntegration,n=!!(t&&!t.persistentChat&&e.selectedHasConversation),r=!!(t&&!t.persistentChat&&e.selectedIntegrationHasAnyConversation),s=r?[t,...e.connectedAgents.filter(d=>d.id!==t.id)]:e.connectedAgents,c=e.selectedIntegrationId===Wi||!t&&e.connectedAgents.length===0||!!(t&&!t.persistentChat&&!e.selectedIntegrationHasAnyConversation),u=!e.localHistoryLoaded&&e.localMessagesCount===0&&!!(t!=null&&t.persistentChat||e.selectedHasConversation);return{showingSessionHistory:n,showingStoredSessions:r,visibleAgentTabs:s,showAddFlow:c,shouldShowConversationLoader:u}}function Md(e,t){const n=e.id==="openclaw"?0:1,r=t.id==="openclaw"?0:1;return n!==r?n-r:e.persistentChat!==t.persistentChat?e.persistentChat?-1:1:e.name.localeCompare(t.name)}function Uu(e,t){return[...e.filter(n=>n.id!==t.id),t].sort(Md)}function i7(e,t){const n=e.find(u=>u.id===t);if(!n)return e;const r=n.connectSupported,s=r?"available":"coming_soon",c=r?"Ready to connect":"Coming next";return Uu(e,{...n,configured:!1,detected:!1,persistentChat:!1,chatReady:!1,bridgeOnline:!1,bridgeStatusLabel:c,status:s,statusLabel:c,detail:r?`${n.name} is no longer attached to this node. Reconnect from the + tab when you want live chat again.`:n.detail,error:void 0,target:void 0})}function s7(e){const t=e.selectedItem;return e.selectedIntegrationId===Wi||t!=null&&(t.persistentChat||KC(e.selectedIntegrationId,e.selectedSessionId,e.localMessagesByConversation,e.sessionSummaries,t.defaultSessionId)||XC(e.selectedIntegrationId,e.localMessagesByConversation,e.sessionSummaries))}function o7(e){var K;const{integrations:t,selectedIntegrationId:n,selectedIntegration:r,selectedSessionId:s,selectedHasConversation:c,selectedIntegrationHasAnyConversation:u,onSelectIntegration:d,onConnectIntegration:f,onDisconnectIntegration:h,onRefreshIntegration:g,connectBusyId:m,refreshBusyId:y,connectNotice:x,connectError:k,localMessages:j,localHistoryLoaded:E,localChatEndRef:S,localInput:T,onLocalInputChange:N,onSendLocalMessage:A,onStopLocalStream:q,localSending:R,activeProjectId:$,availableProjects:H,projectsLoading:z,onSelectProject:_,attachments:P,onAddAttachments:B,onRemoveAttachment:W}=e,I=e.selectableProjects??H,D=P,F=D.some(zC),V=[...new Set(D.map(Z=>Z.contextGraphId))],X=D.some(Z=>Z.status==="uploading"),L=j.some(Z=>Z.streaming)?"streaming":X?"uploading":"idle",U=D.length>0&&D.some(Z=>Z.contextGraphId!==$),G=w.useRef(null),O=w.useRef(null),[ne,ue]=w.useState(null),le=w.useCallback(Z=>{O.current=Z,ue(Z)},[]),[be,Re]=w.useState(!1),Ee=w.useCallback(()=>{const Z=O.current;if(!Z)return;const ee=Z.scrollHeight-Z.scrollTop-Z.clientHeight;Re(ee>40)},[]),Ie=w.useCallback(()=>{const Z=O.current;Z&&Z.scrollTo({top:Z.scrollHeight,behavior:"smooth"})},[]);w.useEffect(()=>{const Z=O.current;if(!Z)return;const ee=requestAnimationFrame(()=>{const ce=Z.scrollHeight-Z.scrollTop-Z.clientHeight;Re(ce>40)});return()=>cancelAnimationFrame(ee)},[n,s,j.length]),w.useEffect(()=>{if(!ne||typeof MutationObserver>"u")return;const Z=()=>{const ce=ne.scrollHeight-ne.scrollTop-ne.clientHeight;Re(ce>40)};Z();const ee=new MutationObserver(Z);return ee.observe(ne,{childList:!0,subtree:!0,characterData:!0}),()=>ee.disconnect()},[ne]);const Ve=(K=e.selectedIntegration)!=null&&K.chatAttachments?e.activeProjectId?e.localSending?"sending":null:"noProject":"unsupported",Se=Ve===null,ht=w.useCallback(Z=>{Se&&B(Z)},[Se,B]),Me=WC({onDrop:ht,noClick:!0,noKeyboard:!0}),qe=[...t].sort(Md),ke=qe.filter(Z=>Z.persistentChat),ct=qe.filter(Z=>!Z.persistentChat),xe=r,{showingSessionHistory:Oe,showingStoredSessions:_t,visibleAgentTabs:Dt,showAddFlow:Qt,shouldShowConversationLoader:Ft}=r7({connectedAgents:ke,selectedIntegration:r,selectedIntegrationId:n,selectedHasConversation:c,selectedIntegrationHasAnyConversation:u,localHistoryLoaded:E,localMessagesCount:j.length}),dt=R||!(xe!=null&&xe.chatReady),ye=!dt&&!X&&(T.trim()!==""||F);return o.jsxs("div",{className:"v10-agents-tab",children:[o.jsxs("div",{className:"v10-agent-subtabs",role:"tablist","aria-label":"Integrated agents",children:[Dt.map(Z=>{const ee=(xe==null?void 0:xe.id)===Z.id&&!Qt;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:QC({integrationId:Z.id,selectedSessionId:s,integrations:t}),sessionId:Z.defaultSessionId}),role:"tab","aria-selected":ee,children:[o.jsx("span",{className:`v10-agents-stat-dot ${dk(Z)}`}),o.jsx("span",{children:Z.name})]}),ee&&o.jsx(e7,{integration:Z,statusLabel:JH(Z,Oe),statusDotClass:dk(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 ${Qt?"active":""}`,onClick:()=>d(Wi),role:"tab","aria-selected":Qt,"aria-label":"Add another integrated agent",title:"Add another integrated agent",children:"+"})]}),Qt?o.jsxs("div",{className:"v10-agent-add-surface",children:[o.jsx("div",{className:"v10-agents-section-label",children:"Connect Another Agent"}),x&&o.jsx("div",{className:"v10-local-agent-notice",children:x}),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:[ct.length===0&&o.jsx("div",{className:"v10-agent-empty-state",children:"No additional local agent integrations are available yet."}),ct.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:EF,target:"_blank",rel:"noreferrer",children:"Docs"}),o.jsx("a",{className:"v10-agent-link-btn",href:TF,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",{...Me.getRootProps({className:"v10-local-agent-chat-shell"}),children:[o.jsx("input",{...Me.getInputProps()}),x&&o.jsx("div",{className:"v10-local-agent-notice",children:x}),k&&o.jsx("div",{className:"v10-local-agent-error",children:k}),!xe.chatReady&&o.jsx("div",{className:`v10-local-agent-warning ${xe.status==="connecting"?"connecting":"offline"}`,children:Oe?`${xe.name} is not currently attached to this node. Session history remains available here; reconnect from the + tab when you want live chat again.`:xe.status==="connecting"?`${xe.name} is still finishing setup. This chat tab stays in place and will go live automatically when the connection is ready.`:xe.status==="degraded"?xe.detail:_t?`${xe.name} has saved sessions on this node. Open one from Sessions or reconnect from the + tab to resume live chat here.`:`${xe.name} is temporarily unavailable. Refresh after it recovers to resume chatting here.`}),Me.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(T_,{className:"v10-drop-overlay-icon",size:32,"aria-hidden":"true"}):o.jsx(n_,{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 ${Rm(H,$)}`:Ve==="sending"?"Wait for the current send to finish.":Ve==="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.":Ve==="sending"?"Drop will be accepted once the agent reply lands.":Ve==="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:[Ft&&o.jsx("div",{className:"v10-agent-empty-state",children:"Loading the latest conversation from DKG memory..."}),!Ft&&j.length===0&&(()=>{const Z=Oe?{title:"No turns in this session yet.",hint:`Reconnect ${xe.name} from the + tab to start a new live thread.`}:_t?{title:`${xe.name} has saved sessions.`,hint:"Open one from Sessions, or reconnect from + to start fresh."}:xe.chatReady?{title:`Start a conversation with ${xe.name}.`,hint:'Try: "What can you help me with?"'}:{title:`${xe.name} is offline.`,hint:"Conversation history stays here while the bridge reconnects."};return o.jsxs("div",{className:"v10-agent-empty-state",children:[o.jsx("div",{className:"v10-agent-empty-state-title",children:Z.title}),o.jsx("div",{className:"v10-agent-empty-state-hint",children:Z.hint})]})})(),j.map(Z=>o.jsxs("div",{className:`v10-chat-msg ${Z.role}`,children:[o.jsx("div",{className:`v10-chat-bubble ${Z.role}`,children:MF(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(XR,{size:14,"aria-hidden":"true"})})]}),o.jsx("div",{className:"v10-agent-input-area",children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,width:"100%"},children:[D.length>0&&o.jsx("div",{className:"v10-attachment-chips",role:"list","aria-label":"Attached files",children:D.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:xF(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:bF(Z.file.size)}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("span",{className:"v10-attachment-chip-status",children:ce})]})]}),o.jsx("button",{type:"button",className:"v10-attachment-chip-remove",onClick:()=>W(Z.id),disabled:R,"aria-label":`Remove ${Z.file.name}`,title:"Remove attachment",children:o.jsx(z_,{size:12,"aria-hidden":"true"})})]},Z.id)})}),U&&o.jsx("div",{className:"v10-local-agent-copy",style:{margin:0,color:"var(--text-tertiary)"},children:V.length>1?"Queued files keep their stored targets and may span multiple projects.":`Queued files keep their stored target (${Rm(H,V[0])}), not the active project.`}),o.jsx("input",{ref:G,type:"file",multiple:!0,style:{display:"none"},onChange:Z=>{Z.target.files&&(B(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(XF,{placeholder:Oe?`Reconnect ${xe.name} to resume live chat...`:xe.chatReady?`Message ${xe.name}...`:xe.status==="connecting"?`${xe.name} is still connecting...`:`${xe.name} bridge offline...`,className:"v10-agent-input",value:T,onChange:Z=>N(Z.target.value),onKeyDown:Z=>{if(!Z.nativeEvent.isComposing){if(Z.key==="Enter"&&!Z.shiftKey&&!Z.ctrlKey&&!Z.metaKey){Z.preventDefault(),ye&&A();return}if((Z.ctrlKey||Z.metaKey)&&Z.key==="Enter"){Z.preventDefault(),ye&&A();return}Z.key==="Escape"&&T.length>0&&(Z.preventDefault(),N(""))}},disabled:dt,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":Ve==="noProject"?"Choose a context graph to attach files":Ve==="sending"?"Wait for the current message to send":"This agent does not support attachments","aria-label":"Attach files",children:o.jsx(w_,{size:14,"aria-hidden":"true"})}),o.jsx("div",{className:"v10-composer-target",children:o.jsx(XH,{className:"v10-local-agent-target-select",value:$??"",onChange:_,options:[...$?[{value:"",label:"No context graph (clear selection)"}]:[],...I.map(Z=>({value:Z.id,label:Z.name}))],placeholder:z?"Loading context graphs…":"Choose a context graph",disabled:z||!$&&I.length===0,ariaLabel:"Active project",prefixIcon:o.jsx(f_,{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"?q:A,disabled:L==="streaming"?!1:L==="uploading"?!0:!ye,"aria-label":L==="streaming"?"Stop reply":L==="uploading"?"Send message (attachments uploading)":"Send message",title:L==="streaming"?"Stop reply":L==="uploading"?"Send message (attachments uploading)…":"Send message",children:L==="streaming"?o.jsx(j_,{size:12,"aria-hidden":"true"}):L==="uploading"?o.jsx(v_,{className:"v10-local-agent-inline-send-spinner",size:14,"aria-hidden":"true"}):o.jsx(e_,{size:14,"aria-hidden":"true"})})]})]})})]})})]})]})}function Wh(e){return e.length>12?e.slice(-8):e}function l7(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 c7(e,t){const n=new Map;for(const g of t){if(!g.peerId)continue;const m=n.get(g.peerId)??[];m.push(g),n.set(g.peerId,m)}const r=new Map;for(const g of e){if(!g.peerId)continue;const m=r.get(g.peerId)??{hasDirect:!1,hasRelay:!1,openedAt:null},y=m.hasDirect||g.transport==="direct",x=m.hasRelay||g.transport==="relayed",k=g.openedAt!=null?m.openedAt!=null?Math.min(m.openedAt,g.openedAt):g.openedAt:m.openedAt;r.set(g.peerId,{hasDirect:y,hasRelay:x,openedAt:k})}const s=g=>{var m;return(m=g.find(y=>y.name))==null?void 0:m.name},c=g=>g.reduce((m,y)=>y.lastSeen!=null&&(m==null||y.lastSeen>m)?y.lastSeen:m,void 0),u=[],d=new Set;for(const[g,m]of r){const y=n.get(g)??[];u.push({peerId:g,name:s(y),transport:m.hasDirect?"direct":"relayed",hasDirect:m.hasDirect,hasRelay:m.hasRelay,openedAt:m.openedAt,connected:!0,lastSeen:c(y),agents:y}),d.add(g)}for(const[g,m]of n){if(d.has(g))continue;const y=m.filter(E=>E.connectionStatus==="connected");if(y.length===0)continue;const x=y.some(E=>E.connectionTransport==="direct"),k=y.some(E=>E.connectionTransport==="relayed"),j=k&&!x?"relayed":"direct";u.push({peerId:g,name:s(m),transport:j,hasDirect:x,hasRelay:k,openedAt:null,connected:!0,lastSeen:c(m),agents:m}),d.add(g)}const f=[];for(const[g,m]of n){if(d.has(g))continue;const y=c(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 u7({peer:e}){var g;const[t,n]=w.useState(!1),r=w.useId(),s=3,c=e.connected?"connected":"offline",u=((g=e.name)==null?void 0:g.trim())||Wh(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 ${c}`,children:[o.jsxs("div",{className:"v10-agent-card-header",children:[o.jsx("span",{className:`v10-agent-card-dot ${c}`}),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:Wh(e.peerId)}),e.connected&&e.openedAt!=null&&o.jsxs("span",{children:["up ",Pw(Date.now()-e.openedAt)]}),!e.connected&&e.lastSeen!=null&&o.jsxs("span",{children:[Pw(Date.now()-e.lastSeen)," ago"]}),e.agents.length>0&&o.jsxs("span",{children:[e.agents.length," agent",e.agents.length===1?"":"s"]})]}),e.agents.length>0&&o.jsxs("ul",{id:r,className:"v10-peer-card-chips","aria-label":`Agents on ${u}`,children:[d.map((m,y)=>o.jsx("li",{className:"v10-peer-chip",title:m.agentUri||"",children:o.jsx("span",{className:"v10-peer-chip-label",children:l7(m.agentUri)||Wh(m.peerId)})},m.agentUri||`${e.peerId}:${y}`)),e.agents.length>s&&o.jsx("li",{children:o.jsx("button",{type:"button",className:"v10-peer-chip-more","aria-expanded":t,"aria-controls":r,onClick:()=>n(m=>!m),children:t?"Show less":`+${e.agents.length-s} more`})})]})]})}function fk(e){const{label:t,peers:n,expanded:r,onToggle:s,emptyMessage:c}=e;return o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header",onClick:s,"aria-expanded":r,children:[o.jsx(Jh,{size:14,className:`v10-peer-group-chevron ${r?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:t}),o.jsx("span",{className:"v10-peer-group-count",children:n.length})]}),r&&o.jsx("div",{className:"v10-peer-group-body",children:n.length===0?o.jsx("div",{className:"v10-agent-empty-state",children:c}):n.map(u=>o.jsx(u7,{peer:u},u.peerId))})]})}function d7(e){const{peerAgents:t,connections:n,loading:r,onRefresh:s}=e,[c,u]=w.useState(!0),[d,f]=w.useState(!1),{connected:h,recentlySeen:g,directCount:m,relayedCount:y}=c7(n.rows,t);return o.jsxs("div",{className:"v10-agent-scroll-tab",children:[o.jsxs("div",{className:"v10-agents-summary",children:[o.jsxs("span",{className:"v10-agents-stat",children:[o.jsx("span",{className:`v10-agents-stat-dot ${h.length>0||n.total>0?"connected":"known"}`}),o.jsxs("span",{title:"Unique libp2p peers connected to this node — matches the count in the header.",children:[h.length," peer",h.length===1?"":"s"]})]}),o.jsxs("span",{className:"v10-agents-stat",title:"Preferred transport per peer (peers reachable via direct + relay are bucketed under direct)",children:[m," direct / ",y," relayed"]}),o.jsx("button",{className:"v10-agents-refresh",onClick:s,title:"Refresh network peers",children:"Refresh"})]}),r&&o.jsx("p",{className:"v10-agents-loading",children:"Loading peers..."}),!r&&h.length===0&&g.length===0&&n.total===0&&o.jsx("div",{className:"v10-agent-empty-state",children:"No network peers detected yet."}),!r&&h.length===0&&n.total>0&&o.jsxs("div",{className:"v10-agent-empty-state",children:["Connected to ",n.total," peer",n.total===1?"":"s"," (peer metadata syncing…)."]}),(h.length>0||g.length>0)&&o.jsxs(o.Fragment,{children:[o.jsx(fk,{label:"Connected",peers:h,expanded:c,onToggle:()=>u(x=>!x),emptyMessage:"No peers currently connected."}),o.jsx(fk,{label:"Recently seen",peers:g,expanded:d,onToggle:()=>f(x=>!x),emptyMessage:"No previously-seen peers."})]})]})}function p7(e){const{sessions:t,onOpenSession:n}=e;return o.jsx("div",{className:"v10-agent-scroll-tab",children:o.jsxs("div",{className:"v10-sessions-list",children:[o.jsx("div",{className:"v10-local-agent-copy",style:{marginBottom:12},children:"Sessions track DKG-persisted conversations for your integrated agents."}),t.length===0?o.jsx("p",{className:"v10-agent-empty-state",children:"No integrated-agent sessions yet."}):t.map(r=>o.jsxs("button",{className:"v10-session-item",onClick:()=>n(r),children:[o.jsxs("span",{className:"v10-session-preview",children:[r.integrationName,": ",r.preview]}),o.jsxs("span",{className:"v10-session-count",children:[r.messageCount," msg",r.messageCount!==1?"s":"",r.lastTs?` - ${ld(r.lastTs)}`:""]})]},r.sessionId))]})})}function f7(){return bd().data}function h7(){const{stage:e,advance:t}=lg(),[n,r]=w.useState("agents"),[s,c]=w.useState([]),[u,d]=w.useState([]),[f,h]=w.useState({total:0,direct:0,relayed:0,rows:[]}),[g,m]=w.useState(!0),y=f7(),[x,k]=w.useState([]),[j,E]=w.useState("openclaw"),[S,T]=w.useState(()=>Zs("openclaw")),[N,A]=w.useState(null),[q,R]=w.useState(null),[$,H]=w.useState(null),[z,_]=w.useState(null),[P,B]=w.useState({}),[W,I]=w.useState({}),[D,F]=w.useState({}),[V,X]=w.useState({}),[Q,L]=w.useState({}),U=w.useRef(new Map),G=w.useRef(!1),O=w.useRef(null),ne=w.useRef([]),ue=w.useRef({}),le=w.useRef("openclaw"),be=w.useRef(Zs("openclaw")),Re=Na(ge=>ge.contextGraphs),Ee=Na(ge=>ge.loading),Ie=Na(ge=>ge.activeProjectId),Ve=Na(ge=>ge.setActiveProject),Se=w.useMemo(()=>vO(Re,y?pg(y):null,Ie),[Re,y,Ie]),ht=pk(s,x),{selectedIntegration:Me,selectedConversation:qe,selectedHasConversation:ke,selectedIntegrationHasAnyConversation:ct}=a7({integrations:x,selectedIntegrationId:j,selectedSessionId:S,localMessagesByConversation:P,sessions:ht}),xe=(qe==null?void 0:qe.stateKey)??null,Oe=xe?P[xe]??[]:[],_t=xe?V[xe]??!1:!1,Dt=xe?W[xe]??"":"",Qt=xe?D[xe]??!1:!1,Ft=xe?Q[xe]??[]:[],dt=w.useCallback(()=>{var ge;(ge=O.current)==null||ge.scrollIntoView({behavior:"smooth"})},[]);w.useEffect(dt,[xe,Oe,dt]),w.useEffect(()=>{ne.current=s},[s]),w.useEffect(()=>{ue.current=P},[P]),w.useEffect(()=>{le.current=j},[j]),w.useEffect(()=>{be.current=S},[S]);const ye=w.useCallback((ge,ze)=>{B(de=>({...de,[ge]:ze(de[ge]??[])}))},[]),K=w.useCallback((ge,ze)=>{ge&&I(de=>({...de,[ge]:ze}))},[]),Z=w.useCallback((ge,ze)=>{F(de=>({...de,[ge]:ze}))},[]),ee=w.useCallback((ge,ze)=>{L(de=>({...de,[ge]:ze(de[ge]??[])}))},[]),ce=w.useCallback((ge,ze,de)=>{const je=Array.from(ze);if(je.length===0)return;const Te=new Set((Q[ge]??[]).map(Ye=>`${Ye.contextGraphId}:${Ye.file.name}:${Ye.file.size}:${Ye.file.lastModified}`)),tt=je.filter(Ye=>{const ft=`${de}:${Ye.name}:${Ye.size}:${Ye.lastModified}`;return Te.has(ft)?!1:(Te.add(ft),!0)});if(tt.length===0)return;const Je=tt.map(Ye=>({id:`${ge}:${Ye.name}:${Ye.size}:${Ye.lastModified}:${crypto.randomUUID()}`,file:Ye,contextGraphId:de,assertionName:`${Date.now().toString(36)}-${crypto.randomUUID().slice(0,8)}-${Ye.name.replace(/[^a-zA-Z0-9._-]/g,"_")}`,status:"queued"}));ee(ge,Ye=>[...Ye,...Je])},[Q,ee]),he=w.useCallback(async(ge,ze)=>{const de=[];for(const je of ze){if(je.status==="completed"||je.status==="skipped"){de.push(je);continue}ee(ge,Te=>Te.map(tt=>tt.id===je.id?{...tt,status:"uploading",error:void 0}:tt));try{const Te=await Yk(je.assertionName,je.contextGraphId,je.file),tt=Te.extraction.status==="completed"?"completed":Te.extraction.status==="skipped"?"skipped":"error",Je={...je,status:tt,result:Te,error:Te.extraction.error};de.push(Je),ee(ge,Ye=>Ye.map(ft=>ft.id===je.id?Je:ft))}catch(Te){const tt={...je,status:"error",error:(Te==null?void 0:Te.message)??"Upload failed"};de.push(tt),ee(ge,Je=>Je.map(Ye=>Ye.id===je.id?tt:Ye))}}return de},[ee]),Le=w.useCallback((ge,ze)=>{ee(ge,de=>de.filter(je=>je.id!==ze))},[ee]),He=w.useCallback((ge,ze)=>{const de=new Set(ze);ee(ge,je=>je.filter(Te=>!de.has(Te.id)))},[ee]),Ce=w.useCallback((ge,ze={})=>{E(ge),ge!==Wi&&(ze.preserveSession||T(ze.sessionId??Zs(ge)))},[]),Fe=w.useCallback(()=>{Tn.fetchMemorySessions(50).then(({sessions:ge})=>c(ge??[])).catch(()=>{})},[]),et=w.useCallback(async()=>{try{const[ge,ze]=await Promise.all([Qm().catch(()=>({agents:[]})),o2().catch(()=>({total:0,direct:0,relayed:0,connections:[]}))]),de=(ge.agents??[]).filter(je=>je.connectionStatus!=="self");d(de),h({total:ze.total??0,direct:ze.direct??0,relayed:ze.relayed??0,rows:Array.isArray(ze.connections)?ze.connections:[]})}catch{}m(!1)},[]),Ne=w.useCallback(async()=>{try{const{integrations:ge}=await yd();k(ge);const ze=pk(ne.current,ge),de=[...ge].sort(Md).filter(ft=>ft.persistentChat),je=le.current,Te=be.current,tt=ge.find(ft=>ft.id===je)??null,Je=s7({selectedIntegrationId:je,selectedItem:tt,selectedSessionId:Te,localMessagesByConversation:ue.current,sessionSummaries:ze});if(!Je){const ft=de[0];Ce((ft==null?void 0:ft.id)??Wi,{sessionId:(ft==null?void 0:ft.defaultSessionId)??null})}const Ye=de[0];Ye&&!G.current&&je!==Wi?(G.current=!0,Ce(Ye.id,{sessionId:Ye.defaultSessionId}),r("agents")):!Ye&&!Je&&(G.current=!1,Ce(Wi))}catch{}},[Ce]),Wt=w.useCallback(async(ge,ze=null,de=null)=>{const je=pd({integrationId:ge,sessionId:ze,defaultSessionId:de});X(Te=>({...Te,[je.stateKey]:!1}));try{const tt=(await fx(ge,100,{sessionId:je.sessionId??void 0})).map(Je=>Uw(Je,ge));ye(je.stateKey,Je=>Bw(Je,tt))}catch{ye(je.stateKey,Te=>Te)}finally{X(Te=>({...Te,[je.stateKey]:!0})),Fe()}},[Fe,ye]);w.useEffect(()=>{Fe(),et(),Ne()},[Fe,et,Ne]),w.useEffect(()=>{for(const ge of AF)Wt(ge,Zs(ge))},[]);const At=w.useCallback(()=>{Fe(),et()},[Fe,et]);Bl(At,15e3,{runImmediately:!1});const Ha=x.some(ge=>ge.persistentChat&&(!ge.chatReady||ge.status==="connecting"))?3e3:15e3;w.useEffect(()=>{const ge=setInterval(()=>{Ne()},Ha);return()=>clearInterval(ge)},[Ha,Ne]),w.useEffect(()=>{if(!(Me!=null&&Me.chatSupported)||!Me.persistentChat&&!ke){xe&&X(ze=>({...ze,[xe]:!1}));return}let ge=!1;return(async()=>await Wt(Me.id,(qe==null?void 0:qe.sessionId)??null,Me.defaultSessionId??null))(),()=>{ge=!0}},[Wt,qe==null?void 0:qe.sessionId,xe,ke,Me==null?void 0:Me.defaultSessionId,Me==null?void 0:Me.chatSupported,Me==null?void 0:Me.id,Me==null?void 0:Me.persistentChat]);const la=w.useCallback(async()=>{const ge=Me,ze=qe,de=Dt.trim(),je=Ft,Te=je.some(zC);if(!(ge!=null&&ge.chatSupported)||!ge.chatReady||Qt||!ze||!de&&!Te)return;const tt=ge.id,Je=ze.stateKey;Z(Je,!0),H(null);let Ye=null,ft="",hn="",Ht="",cn="",lr=[],cr=[],ss=[];try{cr=await he(Je,je);const Wn=cr.map(en=>SF(en)).filter(en=>en!=null),ua=jF(cr);if(!de&&Wn.length===0&&ua.results.length===0)return;hn=crypto.randomUUID();const Aa=DC(ua.results),Hr=[de,Aa].filter(en=>en.length>0).join(`
1660
-
1661
- `);Ht=de?Hr:CF(Wn,ua.results);const mn=de?Hr:"";lr=Wn,ss=[...Wn.map(en=>en.id).filter(en=>typeof en=="string"&&en.length>0),...ua.deliveredDraftIds];const ur=`local:${Je}:${hn}:user`;ft=`local:${Je}:${hn}:assistant`;const da=new Date,Ot=ld(da),go=Am(da);ye(Je,en=>[...en,{id:ur,turnId:hn,role:"user",content:Ht,ts:Ot,tsRaw:go,attachments:Wn},{id:ft,turnId:hn,role:"assistant",content:"",ts:Ot,tsRaw:go,streaming:!0}]),K(Je,""),ss.length>0&&He(Je,ss),Ye=new AbortController,U.current.set(Je,Ye);const Yl=[...NF(Re,Ie,y)],pa=await Y2(tt,mn,{correlationId:hn,signal:Ye==null?void 0:Ye.signal,sessionId:ze.sessionId??void 0,profile:ge.profile,persistUserMessage:mn?void 0:Ht,attachments:Wn,attachmentImportResults:ua.results,contextEntries:Yl,contextGraphId:Ie??void 0,onEvent:en=>{en.type==="text_delta"&&(cn+=en.delta,ye(Je,fa=>fa.map(Ga=>Ga.id===ft?{...Ga,content:Ga.content+en.delta}:Ga)))}}),dr=new Date;ye(Je,en=>Fw(en,hn,pa.turnId).map(fa=>{var Ga;return fa.id===ft?{...fa,content:pa.text||fa.content,turnId:((Ga=pa.turnId)==null?void 0:Ga.trim())||fa.turnId,streaming:!1,synthesized:!pa.text&&!fa.content?!0:fa.synthesized,ts:ld(dr),tsRaw:Am(dr)}:fa})),Fe(),e===0&&t()}catch(Wn){const ua=(Wn==null?void 0:Wn.name)==="AbortError",Aa=ua?"Request cancelled.":RF(ge,Wn),Hr=ua?Aa:`Error: ${Aa}`;ft&&ye(Je,mn=>mn.map(Cn=>Cn.id===ft?{...Cn,content:cn,failureNotice:Hr,streaming:!1,synthesized:!cn}:Cn)),!ua&&tt==="hermes"&&ft&&Ht&&(async()=>{try{const mn=await Z2(tt,{sessionId:ze.sessionId??void 0,correlationId:hn||void 0,userMessage:Ht,assistantReply:cn,failureReason:Aa,profile:ge.profile,attachments:lr,contextGraphId:Ie??void 0});mn.turnId&&ye(Je,Cn=>Fw(Cn,hn,mn.turnId)),Fe()}catch{}})(),ss.length>0&&cr.length>0&&L(mn=>{const Cn=mn[Je]??[],ur=new Set(Cn.map(Ot=>Ot.id)),da=cr.filter(Ot=>!ur.has(Ot.id));return da.length===0?mn:{...mn,[Je]:[...da,...Cn]}}),Ne()}finally{Z(Je,!1),U.current.get(Je)===Ye&&U.current.delete(Je)}},[Ie,t,Re,y,Fe,Dt,Qt,he,Ft,Ne,qe,Me,He,K,Z,e,ye]),Ur=w.useCallback(()=>{if(!xe)return;const ge=U.current.get(xe);ge==null||ge.abort()},[xe]),Br=w.useCallback(async ge=>{A(ge),H(null),R(null);try{const ze=await q2(ge);k(Te=>Uu(Te,ze.integration)),await Ne();const de=Uu(x,ze.integration),je=t7({integrationId:ge,selectedSessionId:S,integrations:de});Ce(ge,{preserveSession:je,sessionId:ze.integration.defaultSessionId}),G.current=!0,R(ze.notice??(ze.integration.chatReady?`${ze.integration.name} is connected and chat-ready.`:`${ze.integration.name} attach is in progress. The node will keep checking for a live bridge.`)),r("agents")}catch(ze){await Ne(),H(ze.message)}finally{A(null)}},[x,Ne,S,Ce]),ca=w.useCallback(async ge=>{H(null),R(null);try{await G2(ge),k(ze=>i7(ze,ge)),G.current=!1,Ce(ge,{preserveSession:j===ge}),R("The local agent was disconnected from this node. Session history remains available here."),r("agents"),await Ne()}catch(ze){H(ze.message)}},[Ne,j,Ce]),qa=w.useCallback(async ge=>{var Te,tt,Je;if(z===ge)return;_(ge),H(null),R(null);const ze=pd({integrationId:ge,sessionId:j===ge?be.current:null,defaultSessionId:(Te=x.find(Ye=>Ye.id===ge))==null?void 0:Te.defaultSessionId}),[de,je]=await Promise.allSettled([V2(ge),fx(ge,100,{sessionId:ze.sessionId??void 0})]);try{if(de.status==="fulfilled"?(k(Ye=>Uu(Ye,de.value.integration)),de.value.notice&&R(de.value.notice)):H(((tt=de.reason)==null?void 0:tt.message)??"Failed to refresh integration."),je.status==="fulfilled"){const Ye=je.value.map(ft=>Uw(ft,ge));ye(ze.stateKey,ft=>Bw(ft,Ye)),X(ft=>({...ft,[ze.stateKey]:!0}))}else de.status==="fulfilled"&&H(((Je=je.reason)==null?void 0:Je.message)??"Failed to refresh conversation.")}finally{_(null)}},[x,z,j,ye]),or=w.useCallback(ge=>{Ce(ge.integrationId,{sessionId:ge.sessionId}),r("agents")},[Ce]),Zl=w.useCallback(ge=>{Ve(ge||null)},[Ve]),Fr=w.useCallback(ge=>{!xe||!Ie||ce(xe,ge,Ie)},[Ie,ce,xe]),wi=w.useCallback(ge=>{xe&&Le(xe,ge)},[Le,xe]);return o.jsxs("div",{className:"v10-panel-right",children:[o.jsxs("div",{className:"v10-agent-mode-tabs",children:[o.jsx("button",{className:`v10-agent-mode-tab ${n==="agents"?"active":""}`,onClick:()=>r("agents"),children:"Agents"}),o.jsx("button",{className:`v10-agent-mode-tab ${n==="network"?"active":""}`,onClick:()=>r("network"),children:"Network"}),o.jsx("button",{className:`v10-agent-mode-tab ${n==="sessions"?"active":""}`,onClick:()=>r("sessions"),children:"Sessions"})]}),n==="agents"&&o.jsx(o7,{integrations:x,selectedIntegrationId:j,selectedIntegration:Me,selectedSessionId:S,selectedHasConversation:ke,selectedIntegrationHasAnyConversation:ct,onSelectIntegration:Ce,onConnectIntegration:Br,onDisconnectIntegration:ca,onRefreshIntegration:qa,connectBusyId:N,refreshBusyId:z,connectNotice:q,connectError:$,localMessages:Oe,localHistoryLoaded:_t,localChatEndRef:O,localInput:Dt,onLocalInputChange:ge=>K(xe,ge),onSendLocalMessage:la,onStopLocalStream:Ur,localSending:Qt,activeProjectId:Ie,availableProjects:Re,selectableProjects:Se,projectsLoading:Ee,onSelectProject:Zl,attachments:Ft,onAddAttachments:Fr,onRemoveAttachment:wi}),n==="network"&&o.jsx(d7,{peerAgents:u,connections:f,loading:g,onRefresh:et}),n==="sessions"&&o.jsx(p7,{sessions:ht,onOpenSession:or})]})}function m7(e,t=document){const n=e==="light";t.documentElement.classList.toggle("light",n),t.body.classList.toggle("light",n)}function g7(){const{toggleLeft:e,toggleRight:t,toggleBottom:n}=qn();w.useEffect(()=>{const r=s=>{if(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement||!(s.metaKey||s.ctrlKey))return;const u=s.key.toLowerCase();if(s.shiftKey&&u==="b"){s.preventDefault(),t();return}if(!s.shiftKey){if(u==="b"){s.preventDefault(),e();return}if(u==="j"){s.preventDefault(),n();return}}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,t,n])}const hk={"/observability":{id:"operations",label:"Observability"},"/operations":{id:"operations",label:"Observability"},"/settings":{id:"settings",label:"Settings"}},v7={operations:"/observability",settings:"/settings",dashboard:"/"};function y7(){const{pathname:e}=Ua(),t=Um(),n=yn(s=>s.openTab),r=yn(s=>s.activeTabId);w.useEffect(()=>{const s=hk[e];s&&n({id:s.id,label:s.label,closable:!0})},[e,n]),w.useEffect(()=>{const s=v7[r];if(s){s!==e&&t(s,{replace:!0});return}hk[e]&&t("/",{replace:!0})},[r,e,t])}function b7(){const[e,t]=w.useState(dR());return w.useEffect(()=>pR(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 x7(){const e=Fk(t=>t.setNodeStatus);Bl(()=>{Tn.fetchStatus().then(e).catch(()=>{})},1e4)}function mk(e){const t=w.useRef(null),n=w.useRef(e);return n.current=e,w.useEffect(()=>{const r=t.current;if(!r)return;let s=0;const c=f=>{const h=f.clientX-s;s=f.clientX,n.current(h)},u=()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u),document.body.style.cursor="",document.body.style.userSelect="",r.classList.remove("active")},d=f=>{f.preventDefault(),s=f.clientX,document.addEventListener("mousemove",c),document.addEventListener("mouseup",u),document.body.style.cursor="col-resize",document.body.style.userSelect="none",r.classList.add("active")};return r.addEventListener("mousedown",d),()=>r.removeEventListener("mousedown",d)},[]),t}function w7(e){const t=w.useRef(e);t.current=e;const[n,r]=w.useState(null);return w.useEffect(()=>{if(!n)return;let s=0;const c=f=>{const h=f.clientY-s;s=f.clientY,t.current(h)},u=()=>{document.removeEventListener("mousemove",c),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",c),document.addEventListener("mouseup",u),document.body.style.cursor="row-resize",document.body.style.userSelect="none",n.classList.add("active")};return n.addEventListener("mousedown",d),()=>{n.removeEventListener("mousedown",d),u()}},[n]),w.useCallback(s=>r(s),[])}function k7(){x7(),g7(),y7();const{leftCollapsed:e,rightCollapsed:t,bottomCollapsed:n,theme:r,leftWidth:s,rightWidth:c,setLeftWidth:u,setRightWidth:d,setBottomHeight:f}=qn(),[,h]=w.useState(0);w.useEffect(()=>{m7(r)},[r]),w.useEffect(()=>{const E=()=>h(S=>S+1);return window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)},[]);const g=w.useCallback(E=>{const S=qn.getState().leftWidth;u(Math.max(140,Math.min(400,S+E)))},[u]),m=w.useCallback(E=>{const S=qn.getState().rightWidth;d(Math.max(200,Math.min(500,S-E)))},[d]),y=w.useCallback(E=>{const S=Math.min(qn.getState().bottomHeight,qu());f(Math.min(S-E,qu()))},[f]),x=mk(g),k=mk(m),j=w7(y);return o.jsxs("div",{className:"v10-app",children:[o.jsx(b7,{}),o.jsx(qR,{}),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(wO,{})}),o.jsx("div",{className:"v10-resize-handle-h",ref:x})]}),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(iF,{})}),!n&&o.jsx("div",{className:"v10-resize-handle-v",ref:j}),o.jsx(yF,{})]}),!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:c},children:o.jsx(h7,{})})]})]})]})}const S7=Ze.lazy(()=>Ba(()=>import("./Network-C6MDsv2e.js"),[]).then(e=>({default:e.NetworkPage})));function j7(){const e=yn(t=>t.openTab);return w.useLayoutEffect(()=>{e(TS)},[e]),o.jsx(bl,{to:"/",replace:!0})}function C7(){return o.jsxs(mA,{children:[o.jsx(mi,{path:"/network",element:o.jsx(Ze.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading..."}),children:o.jsx(S7,{})})}),o.jsx(mi,{path:"/context-graph-primer",element:o.jsx(j7,{})}),o.jsx(mi,{path:"/agent",element:o.jsx(bl,{to:"/",replace:!0})}),o.jsx(mi,{path:"/explorer",element:o.jsx(bl,{to:"/",replace:!0})}),o.jsx(mi,{path:"/messages",element:o.jsx(bl,{to:"/",replace:!0})}),o.jsx(mi,{path:"/apps/*",element:o.jsx(bl,{to:"/",replace:!0})}),o.jsx(mi,{path:"*",element:o.jsx(k7,{})})]})}vT.createRoot(document.getElementById("root")).render(o.jsx(Ze.StrictMode,{children:o.jsx(PA,{basename:"/ui",children:o.jsx(C7,{})})}));export{Q7 as $,u4 as A,U7 as B,B7 as C,I7 as D,$7 as E,P7 as F,A7 as G,Ym as H,F7 as I,_7 as J,K2 as K,zk as L,T6 as M,oq as N,_x as O,h7 as P,oL as Q,Ze as R,lL as S,kO as T,T7 as U,$l as V,_6 as W,o as X,iq as Y,w as Z,Ba as _,Yi as a,tq as a0,rq as a1,aq as a2,X7 as a3,Y7 as a4,Ox as a5,sq as a6,g6 as a7,O6 as a8,Ug as a9,Fs as aa,R7 as ab,O7 as ac,$L as ad,ns as ae,mz as af,Ea as ag,mg as ah,Zi as ai,_L as aj,Ir as ak,Na as al,yn as am,w6 as an,CS as b,SS as c,Et as d,eq as e,Z7 as f,_w as g,E7 as h,W7 as i,K7 as j,nq as k,Qm as l,o2 as m,gd as n,M7 as o,D7 as p,u2 as q,L7 as r,p2 as s,z7 as t,J7 as u,d2 as v,q7 as w,V7 as x,G7 as y,H7 as z};