@origintrail-official/dkg-node-ui 10.0.12 → 10.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +50 -50
- package/dist/chain-cursor-stores.js +6 -6
- package/dist/chat-memory.js +209 -209
- package/dist/db.js +955 -955
- package/dist-ui/assets/{3d-force-graph-Bl6v-uII.js → 3d-force-graph-C9KowW4u.js} +1 -1
- package/dist-ui/assets/{AgentHub-D2vaQxlw.js → AgentHub-BVrcom9_.js} +1 -1
- package/dist-ui/assets/{AgentProfilePage-BgSTdsjD.js → AgentProfilePage-C9XaTt7j.js} +1 -1
- package/dist-ui/assets/{ApproveWalletsModal-D0Ub_eiD.js → ApproveWalletsModal-BdR2mshx.js} +3 -3
- package/dist-ui/assets/{ConvictionDetailView-CieVypna.js → ConvictionDetailView-cao48GL1.js} +1 -1
- package/dist-ui/assets/{Network-DKw_XEGi.js → Network-B3jCYzr5.js} +1 -1
- package/dist-ui/assets/{OnChainProvenanceCard-Dn_IEP7Q.js → OnChainProvenanceCard-DboMX4Aq.js} +1 -1
- package/dist-ui/assets/{Operations-BO2C3UWB.js → Operations-Dg1gfLXv.js} +1 -1
- package/dist-ui/assets/{PublishingConviction-xKRNHbzk.js → PublishingConviction-Byp6t69e.js} +1 -1
- package/dist-ui/assets/{Settings-DC_d9STV.js → Settings-CxI0SKeV.js} +1 -1
- package/dist-ui/assets/{ccip-zWfeQL8Q.js → ccip-wJ3OMRuz.js} +1 -1
- package/dist-ui/assets/{index-CwRQnNYh.js → index-5DS6xjw0.js} +3 -3
- package/dist-ui/assets/index-DOjsv0r7.css +1 -0
- package/dist-ui/assets/index-KoAnx9JE.js +1661 -0
- package/dist-ui/assets/{jsonld-B67IUHNU-C3ydusi_.js → jsonld-32FQRO67-CDirPi8u.js} +2 -2
- package/dist-ui/assets/{jsonld-G-CM-8JR.js → jsonld-CwHW9UDN.js} +1 -1
- package/dist-ui/assets/{renderer-3d-OSESAPET-ConXqyK6.js → renderer-3d-2EVDZII7-BNXV6iSu.js} +2 -2
- package/dist-ui/assets/{shikiHighlighter-C6lRYd1O.js → shikiHighlighter-C-LWPPSu.js} +1 -1
- package/dist-ui/index.html +14 -14
- package/package.json +4 -3
- package/dist-ui/assets/index-DEtfq9qv.css +0 -1
- package/dist-ui/assets/index-hrI-Ir4l.js +0 -1661
- /package/dist-ui/assets/{ntriples-SF2LFNMC-DH7OofPp.js → ntriples-ZWBY2WET-DH7OofPp.js} +0 -0
- /package/dist-ui/assets/{turtle-BXN4L2BY-BzTu0283.js → turtle-JJPK7LJ5-BzTu0283.js} +0 -0
|
@@ -0,0 +1,1661 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-5DS6xjw0.js","assets/ordinal-DhEzRPdO.js","assets/OnChainProvenanceCard-DboMX4Aq.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/Operations-Dg1gfLXv.js","assets/PublishingConviction-Byp6t69e.js","assets/ApproveWalletsModal-BdR2mshx.js","assets/ConvictionDetailView-cao48GL1.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var ST=Object.defineProperty;var jT=(e,t,n)=>t in e?ST(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pn=(e,t,n)=>jT(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();var _V=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function OV(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 hh={exports:{}},yl={};/**
|
|
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 Mx;function CT(){if(Mx)return yl;Mx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,l){var c=null;if(l!==void 0&&(c=""+l),s.key!==void 0&&(c=""+s.key),"key"in s){l={};for(var d in s)d!=="key"&&(l[d]=s[d])}else l=s;return s=l.ref,{$$typeof:e,type:r,key:c,ref:s!==void 0?s:null,props:l}}return yl.Fragment=t,yl.jsx=n,yl.jsxs=n,yl}var Lx;function NT(){return Lx||(Lx=1,hh.exports=CT()),hh.exports}var o=NT(),mh={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 Dx;function ET(){if(Dx)return Ge;Dx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=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"),v=Symbol.iterator;function b(U){return U===null||typeof U!="object"?null:(U=v&&U[v]||U["@@iterator"],typeof U=="function"?U:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function S(U,G,M){this.props=U,this.context=G,this.refs=C,this.updater=M||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 N(){}N.prototype=S.prototype;function E(U,G,M){this.props=U,this.context=G,this.refs=C,this.updater=M||k}var T=E.prototype=new N;T.constructor=E,j(T,S.prototype),T.isPureReactComponent=!0;var $=Array.isArray;function R(){}var L={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function O(U,G,M){var ee=M.ref;return{$$typeof:e,type:U,key:G,ref:ee!==void 0?ee:null,props:M}}function _(U,G){return O(U.type,G,U.props)}function I(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function F(U){var G={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(M){return G[M]})}var K=/\/+/g;function z(U,G){return typeof U=="object"&&U!==null&&U.key!=null?F(""+U.key):G.toString(36)}function q(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 V(U,G,M,ee,ce){var oe=typeof U;(oe==="undefined"||oe==="boolean")&&(U=null);var be=!1;if(U===null)be=!0;else switch(oe){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,V(be(U._payload),G,M,ee,ce)}}if(be)return ce=ce(U),be=ee===""?"."+z(U,0):ee,$(ce)?(M="",be!=null&&(M=be.replace(K,"$&/")+"/"),V(ce,G,M,"",function(De){return De})):ce!=null&&(I(ce)&&(ce=_(ce,M+(ce.key==null||U&&U.key===ce.key?"":(""+ce.key).replace(K,"$&/")+"/")+be)),G.push(ce)),1;be=0;var Re=ee===""?".":ee+":";if($(U))for(var Ne=0;Ne<U.length;Ne++)ee=U[Ne],oe=Re+z(ee,Ne),be+=V(ee,G,M,oe,ce);else if(Ne=b(U),typeof Ne=="function")for(U=Ne.call(U),Ne=0;!(ee=U.next()).done;)ee=ee.value,oe=Re+z(ee,Ne++),be+=V(ee,G,M,oe,ce);else if(oe==="object"){if(typeof U.then=="function")return V(q(U),G,M,ee,ce);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 Z(U,G,M){if(U==null)return U;var ee=[],ce=0;return V(U,ee,"","",function(oe){return G.call(M,oe,ce++)}),ee}function Y(U){if(U._status===-1){var G=U._result;G=G(),G.then(function(M){(U._status===0||U._status===-1)&&(U._status=1,U._result=M)},function(M){(U._status===0||U._status===-1)&&(U._status=2,U._result=M)}),U._status===-1&&(U._status=0,U._result=G)}if(U._status===1)return U._result.default;throw U._result}var W=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)},D={map:Z,forEach:function(U,G,M){Z(U,function(){G.apply(this,arguments)},M)},count:function(U){var G=0;return Z(U,function(){G++}),G},toArray:function(U){return Z(U,function(G){return G})||[]},only:function(U){if(!I(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Ge.Activity=m,Ge.Children=D,Ge.Component=S,Ge.Fragment=n,Ge.Profiler=s,Ge.PureComponent=E,Ge.StrictMode=r,Ge.Suspense=f,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(U){return L.H.useMemoCache(U)}},Ge.cache=function(U){return function(){return U.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(U,G,M){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var ee=j({},U.props),ce=U.key;if(G!=null)for(oe in G.key!==void 0&&(ce=""+G.key),G)!B.call(G,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&G.ref===void 0||(ee[oe]=G[oe]);var oe=arguments.length-2;if(oe===1)ee.children=M;else if(1<oe){for(var be=Array(oe),Re=0;Re<oe;Re++)be[Re]=arguments[Re+2];ee.children=be}return O(U.type,ce,ee)},Ge.createContext=function(U){return U={$$typeof:c,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:l,_context:U},U},Ge.createElement=function(U,G,M){var ee,ce={},oe=null;if(G!=null)for(ee in G.key!==void 0&&(oe=""+G.key),G)B.call(G,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(ce[ee]=G[ee]);var be=arguments.length-2;if(be===1)ce.children=M;else if(1<be){for(var Re=Array(be),Ne=0;Ne<be;Ne++)Re[Ne]=arguments[Ne+2];ce.children=Re}if(U&&U.defaultProps)for(ee in be=U.defaultProps,be)ce[ee]===void 0&&(ce[ee]=be[ee]);return O(U,oe,ce)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(U){return{$$typeof:d,render:U}},Ge.isValidElement=I,Ge.lazy=function(U){return{$$typeof:g,_payload:{_status:-1,_result:U},_init:Y}},Ge.memo=function(U,G){return{$$typeof:h,type:U,compare:G===void 0?null:G}},Ge.startTransition=function(U){var G=L.T,M={};L.T=M;try{var ee=U(),ce=L.S;ce!==null&&ce(M,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(R,W)}catch(oe){W(oe)}finally{G!==null&&M.types!==null&&(G.types=M.types),L.T=G}},Ge.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Ge.use=function(U){return L.H.use(U)},Ge.useActionState=function(U,G,M){return L.H.useActionState(U,G,M)},Ge.useCallback=function(U,G){return L.H.useCallback(U,G)},Ge.useContext=function(U){return L.H.useContext(U)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(U,G){return L.H.useDeferredValue(U,G)},Ge.useEffect=function(U,G){return L.H.useEffect(U,G)},Ge.useEffectEvent=function(U){return L.H.useEffectEvent(U)},Ge.useId=function(){return L.H.useId()},Ge.useImperativeHandle=function(U,G,M){return L.H.useImperativeHandle(U,G,M)},Ge.useInsertionEffect=function(U,G){return L.H.useInsertionEffect(U,G)},Ge.useLayoutEffect=function(U,G){return L.H.useLayoutEffect(U,G)},Ge.useMemo=function(U,G){return L.H.useMemo(U,G)},Ge.useOptimistic=function(U,G){return L.H.useOptimistic(U,G)},Ge.useReducer=function(U,G,M){return L.H.useReducer(U,G,M)},Ge.useRef=function(U){return L.H.useRef(U)},Ge.useState=function(U){return L.H.useState(U)},Ge.useSyncExternalStore=function(U,G,M){return L.H.useSyncExternalStore(U,G,M)},Ge.useTransition=function(){return L.H.useTransition()},Ge.version="19.2.4",Ge}var Ix;function kg(){return Ix||(Ix=1,mh.exports=ET()),mh.exports}var w=kg();const Ve=Jl(w);var gh={exports:{}},bl={},vh={exports:{}},yh={};/**
|
|
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 zx;function AT(){return zx||(zx=1,(function(e){function t(V,Z){var Y=V.length;V.push(Z);e:for(;0<Y;){var W=Y-1>>>1,D=V[W];if(0<s(D,Z))V[W]=Z,V[Y]=D,Y=W;else break e}}function n(V){return V.length===0?null:V[0]}function r(V){if(V.length===0)return null;var Z=V[0],Y=V.pop();if(Y!==Z){V[0]=Y;e:for(var W=0,D=V.length,U=D>>>1;W<U;){var G=2*(W+1)-1,M=V[G],ee=G+1,ce=V[ee];if(0>s(M,Y))ee<D&&0>s(ce,M)?(V[W]=ce,V[ee]=Y,W=ee):(V[W]=M,V[G]=Y,W=G);else if(ee<D&&0>s(ce,Y))V[W]=ce,V[ee]=Y,W=ee;else break e}}return Z}function s(V,Z){var Y=V.sortIndex-Z.sortIndex;return Y!==0?Y:V.id-Z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var f=[],h=[],g=1,m=null,v=3,b=!1,k=!1,j=!1,C=!1,S=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function T(V){for(var Z=n(h);Z!==null;){if(Z.callback===null)r(h);else if(Z.startTime<=V)r(h),Z.sortIndex=Z.expirationTime,t(f,Z);else break;Z=n(h)}}function $(V){if(j=!1,T(V),!k)if(n(f)!==null)k=!0,R||(R=!0,F());else{var Z=n(h);Z!==null&&q($,Z.startTime-V)}}var R=!1,L=-1,B=5,O=-1;function _(){return C?!0:!(e.unstable_now()-O<B)}function I(){if(C=!1,R){var V=e.unstable_now();O=V;var Z=!0;try{e:{k=!1,j&&(j=!1,N(L),L=-1),b=!0;var Y=v;try{t:{for(T(V),m=n(f);m!==null&&!(m.expirationTime>V&&_());){var W=m.callback;if(typeof W=="function"){m.callback=null,v=m.priorityLevel;var D=W(m.expirationTime<=V);if(V=e.unstable_now(),typeof D=="function"){m.callback=D,T(V),Z=!0;break t}m===n(f)&&r(f),T(V)}else r(f);m=n(f)}if(m!==null)Z=!0;else{var U=n(h);U!==null&&q($,U.startTime-V),Z=!1}}break e}finally{m=null,v=Y,b=!1}Z=void 0}}finally{Z?F():R=!1}}}var F;if(typeof E=="function")F=function(){E(I)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,z=K.port2;K.port1.onmessage=I,F=function(){z.postMessage(null)}}else F=function(){S(I,0)};function q(V,Z){L=S(function(){V(e.unstable_now())},Z)}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(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(V){switch(v){case 1:case 2:case 3:var Z=3;break;default:Z=v}var Y=v;v=Z;try{return V()}finally{v=Y}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(V,Z){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var Y=v;v=V;try{return Z()}finally{v=Y}},e.unstable_scheduleCallback=function(V,Z,Y){var W=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?W+Y:W):Y=W,V){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=Y+D,V={id:g++,callback:Z,priorityLevel:V,startTime:Y,expirationTime:D,sortIndex:-1},Y>W?(V.sortIndex=Y,t(h,V),n(f)===null&&V===n(h)&&(j?(N(L),L=-1):j=!0,q($,Y-W))):(V.sortIndex=D,t(f,V),k||b||(k=!0,R||(R=!0,F()))),V},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(V){var Z=v;return function(){var Y=v;v=Z;try{return V.apply(this,arguments)}finally{v=Y}}}})(yh)),yh}var $x;function TT(){return $x||($x=1,vh.exports=AT()),vh.exports}var bh={exports:{}},Tn={};/**
|
|
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 Px;function RT(){if(Px)return Tn;Px=1;var e=kg();function t(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function l(f,h,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:m==null?null:""+m,children:f,containerInfo:h,implementation:g}}var c=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 Tn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Tn.createPortal=function(f,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return l(f,h,null,g)},Tn.flushSync=function(f){var h=c.T,g=r.p;try{if(c.T=null,r.p=2,f)return f()}finally{c.T=h,r.p=g,r.d.f()}},Tn.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))},Tn.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Tn.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var g=h.as,m=d(g,h.crossOrigin),v=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?r.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:m,integrity:v,fetchPriority:b}):g==="script"&&r.d.X(f,{crossOrigin:m,integrity:v,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Tn.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)},Tn.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})}},Tn.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)},Tn.requestFormReset=function(f){r.d.r(f)},Tn.unstable_batchedUpdates=function(f,h){return f(h)},Tn.useFormState=function(f,h,g){return c.H.useFormState(f,h,g)},Tn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Tn.version="19.2.4",Tn}var Ux;function gS(){if(Ux)return bh.exports;Ux=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(),bh.exports=RT(),bh.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 Bx;function _T(){if(Bx)return bl;Bx=1;var e=TT(),t=kg(),n=gS();function r(a){var i="https://react.dev/errors/"+a;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)i+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+a+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function l(a){var i=a,u=a;if(a.alternate)for(;i.return;)i=i.return;else{a=i;do i=a,(i.flags&4098)!==0&&(u=i.return),a=i.return;while(a)}return i.tag===3?u:null}function c(a){if(a.tag===13){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function d(a){if(a.tag===31){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function f(a){if(l(a)!==a)throw Error(r(188))}function h(a){var i=a.alternate;if(!i){if(i=l(a),i===null)throw Error(r(188));return i!==a?null:a}for(var u=a,p=i;;){var y=u.return;if(y===null)break;var x=y.alternate;if(x===null){if(p=y.return,p!==null){u=p;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===u)return f(y),a;if(x===p)return f(y),i;x=x.sibling}throw Error(r(188))}if(u.return!==p.return)u=y,p=x;else{for(var A=!1,P=y.child;P;){if(P===u){A=!0,u=y,p=x;break}if(P===p){A=!0,p=y,u=x;break}P=P.sibling}if(!A){for(P=x.child;P;){if(P===u){A=!0,u=x,p=y;break}if(P===p){A=!0,p=x,u=y;break}P=P.sibling}if(!A)throw Error(r(189))}}if(u.alternate!==p)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?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,v=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),E=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),_=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function F(a){return a===null||typeof a!="object"?null:(a=I&&a[I]||a["@@iterator"],typeof a=="function"?a:null)}var K=Symbol.for("react.client.reference");function z(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===K?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case j:return"Fragment";case S:return"Profiler";case C:return"StrictMode";case $:return"Suspense";case R:return"SuspenseList";case O:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case k:return"Portal";case E:return a.displayName||"Context";case N:return(a._context.displayName||"Context")+".Consumer";case T:var i=a.render;return a=a.displayName,a||(a=i.displayName||i.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case L:return i=a.displayName||null,i!==null?i:z(a.type)||"Memo";case B:i=a._payload,a=a._init;try{return z(a(i))}catch{}}return null}var q=Array.isArray,V=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},W=[],D=-1;function U(a){return{current:a}}function G(a){0>D||(a.current=W[D],W[D]=null,D--)}function M(a,i){D++,W[D]=a.current,a.current=i}var ee=U(null),ce=U(null),oe=U(null),be=U(null);function Re(a,i){switch(M(oe,i),M(ce,a),M(ee,null),i.nodeType){case 9:case 11:a=(a=i.documentElement)&&(a=a.namespaceURI)?nx(a):0;break;default:if(a=i.tagName,i=i.namespaceURI)i=nx(i),a=ax(i,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}G(ee),M(ee,a)}function Ne(){G(ee),G(ce),G(oe)}function De(a){a.memoizedState!==null&&M(be,a);var i=ee.current,u=ax(i,a.type);i!==u&&(M(ce,a),M(ee,u))}function We(a){ce.current===a&&(G(ee),G(ce)),be.current===a&&(G(be),hl._currentValue=Y)}var Se,ft;function Ie(a){if(Se===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);Se=i&&i[1]||"",ft=-1<u.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+Se+a+ft}var qe=!1;function ke(a,i){if(!a||qe)return"";qe=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(i){var ge=function(){throw Error()};if(Object.defineProperty(ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ge,[])}catch(le){var ie=le}Reflect.construct(a,[],ge)}else{try{ge.call()}catch(le){ie=le}a.call(ge.prototype)}}else{try{throw Error()}catch(le){ie=le}(ge=a())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(le){if(le&&ie&&typeof le.stack=="string")return[le.stack,ie.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=p.DetermineComponentFrameRoot(),A=x[0],P=x[1];if(A&&P){var Q=A.split(`
|
|
45
|
+
`),ae=P.split(`
|
|
46
|
+
`);for(y=p=0;p<Q.length&&!Q[p].includes("DetermineComponentFrameRoot");)p++;for(;y<ae.length&&!ae[y].includes("DetermineComponentFrameRoot");)y++;if(p===Q.length||y===ae.length)for(p=Q.length-1,y=ae.length-1;1<=p&&0<=y&&Q[p]!==ae[y];)y--;for(;1<=p&&0<=y;p--,y--)if(Q[p]!==ae[y]){if(p!==1||y!==1)do if(p--,y--,0>y||Q[p]!==ae[y]){var de=`
|
|
47
|
+
`+Q[p].replace(" at new "," at ");return a.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",a.displayName)),de}while(1<=p&&0<=y);break}}}finally{qe=!1,Error.prepareStackTrace=u}return(u=a?a.displayName||a.name:"")?Ie(u):""}function lt(a,i){switch(a.tag){case 26:case 27:case 5:return Ie(a.type);case 16:return Ie("Lazy");case 13:return a.child!==i&&i!==null?Ie("Suspense Fallback"):Ie("Suspense");case 19:return Ie("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 Ie("Activity");default:return""}}function ye(a){try{var i="",u=null;do i+=lt(a,u),u=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,Lt=e.unstable_scheduleCallback,$t=e.unstable_cancelCallback,Qt=e.unstable_shouldYield,Gt=e.unstable_requestPaint,ut=e.unstable_now,xe=e.unstable_getCurrentPriorityLevel,X=e.unstable_ImmediatePriority,fe=e.unstable_UserBlockingPriority,H=e.unstable_NormalPriority,se=e.unstable_LowPriority,pe=e.unstable_IdlePriority,Le=e.log,He=e.unstable_setDisableYieldValue,Ce=null,Fe=null;function tt(a){if(typeof Le=="function"&&He(a),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(Ce,a)}catch{}}var Ee=Math.clz32?Math.clz32:qa,Zt=Math.log,_t=Math.LN2;function qa(a){return a>>>=0,a===0?32:31-(Zt(a)/_t|0)|0}var ha=256,Br=262144,Fr=4194304;function ma(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 Ga(a,i,u){var p=a.pendingLanes;if(p===0)return 0;var y=0,x=a.suspendedLanes,A=a.pingedLanes;a=a.warmLanes;var P=p&134217727;return P!==0?(p=P&~x,p!==0?y=ma(p):(A&=P,A!==0?y=ma(A):u||(u=P&~a,u!==0&&(y=ma(u))))):(P=p&~x,P!==0?y=ma(P):A!==0?y=ma(A):u||(u=p&~a,u!==0&&(y=ma(u)))),y===0?0:i!==0&&i!==y&&(i&x)===0&&(x=y&-y,u=i&-i,x>=u||x===32&&(u&4194048)!==0)?i:y}function ur(a,i){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&i)===0}function dc(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 Hr(){var a=Fr;return Fr<<=1,(Fr&62914560)===0&&(Fr=4194304),a}function Ei(a){for(var i=[],u=0;31>u;u++)i.push(a);return i}function me(a,i){a.pendingLanes|=i,i!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function Me(a,i,u,p,y,x){var A=a.pendingLanes;a.pendingLanes=u,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=u,a.entangledLanes&=u,a.errorRecoveryDisabledLanes&=u,a.shellSuspendCounter=0;var P=a.entanglements,Q=a.expirationTimes,ae=a.hiddenUpdates;for(u=A&~u;0<u;){var de=31-Ee(u),ge=1<<de;P[de]=0,Q[de]=-1;var ie=ae[de];if(ie!==null)for(ae[de]=null,de=0;de<ie.length;de++){var le=ie[de];le!==null&&(le.lane&=-536870913)}u&=~ge}p!==0&&ue(a,p,0),x!==0&&y===0&&a.tag!==0&&(a.suspendedLanes|=x&~(A&~i))}function ue(a,i,u){a.pendingLanes|=i,a.suspendedLanes&=~i;var p=31-Ee(i);a.entangledLanes|=i,a.entanglements[p]=a.entanglements[p]|1073741824|u&261930}function je(a,i){var u=a.entangledLanes|=i;for(a=a.entanglements;u;){var p=31-Ee(u),y=1<<p;y&i|a[p]&i&&(a[p]|=i),u&=~y}}function Ae(a,i){var u=i&-i;return u=(u&42)!==0?1:Ze(u),(u&(a.suspendedLanes|i))!==0?0:u}function Ze(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 Ye(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function Qe(){var a=Z.p;return a!==0?a:(a=window.event,a===void 0?32:Nx(a.type))}function pt(a,i){var u=Z.p;try{return Z.p=a,i()}finally{Z.p=u}}var gn=Math.random().toString(36).slice(2),Vt="__reactFiber$"+gn,vn="__reactProps$"+gn,dr="__reactContainer$"+gn,pr="__reactEvents$"+gn,vs="__reactListeners$"+gn,pc="__reactHandles$"+gn,To="__reactResources$"+gn,wn="__reactMarker$"+gn;function Xn(a){delete a[Vt],delete a[vn],delete a[pr],delete a[vs],delete a[pc]}function ga(a){var i=a[Vt];if(i)return i;for(var u=a.parentNode;u;){if(i=u[dr]||u[Vt]){if(u=i.alternate,i.child!==null||u!==null&&u.child!==null)for(a=ux(a);a!==null;){if(u=a[Vt])return u;a=ux(a)}return i}a=u,u=a.parentNode}return null}function Ma(a){if(a=a[Vt]||a[dr]){var i=a.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return a}return null}function kn(a){var i=a.tag;if(i===5||i===26||i===27||i===6)return a.stateNode;throw Error(r(33))}function Un(a){var i=a[To];return i||(i=a[To]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Ot(a){a[wn]=!0}var qr=new Set,fr={};function Va(a,i){Gr(a,i),Gr(a+"Capture",i)}function Gr(a,i){for(fr[a]=i,a=0;a<i.length;a++)qr.add(i[a])}var ip=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]*$"),Vr={},Ro={};function ys(a){return Oe.call(Ro,a)?!0:Oe.call(Vr,a)?!1:ip.test(a)?Ro[a]=!0:(Vr[a]=!0,!1)}function wt(a,i,u){if(ys(i))if(u===null)a.removeAttribute(i);else{switch(typeof u){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,""+u)}}function Xt(a,i,u){if(u===null)a.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(i);return}a.setAttribute(i,""+u)}}function Sn(a,i,u,p){if(p===null)a.removeAttribute(u);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(u);return}a.setAttributeNS(i,u,""+p)}}function va(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function Zv(a){var i=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function gE(a,i,u){var p=Object.getOwnPropertyDescriptor(a.constructor.prototype,i);if(!a.hasOwnProperty(i)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var y=p.get,x=p.set;return Object.defineProperty(a,i,{configurable:!0,get:function(){return y.call(this)},set:function(A){u=""+A,x.call(this,A)}}),Object.defineProperty(a,i,{enumerable:p.enumerable}),{getValue:function(){return u},setValue:function(A){u=""+A},stopTracking:function(){a._valueTracker=null,delete a[i]}}}}function sp(a){if(!a._valueTracker){var i=Zv(a)?"checked":"value";a._valueTracker=gE(a,i,""+a[i])}}function Kv(a){if(!a)return!1;var i=a._valueTracker;if(!i)return!0;var u=i.getValue(),p="";return a&&(p=Zv(a)?a.checked?"true":"false":a.value),a=p,a!==u?(i.setValue(a),!0):!1}function fc(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 vE=/[\n"\\]/g;function ya(a){return a.replace(vE,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function op(a,i,u,p,y,x,A,P){a.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?a.type=A:a.removeAttribute("type"),i!=null?A==="number"?(i===0&&a.value===""||a.value!=i)&&(a.value=""+va(i)):a.value!==""+va(i)&&(a.value=""+va(i)):A!=="submit"&&A!=="reset"||a.removeAttribute("value"),i!=null?lp(a,A,va(i)):u!=null?lp(a,A,va(u)):p!=null&&a.removeAttribute("value"),y==null&&x!=null&&(a.defaultChecked=!!x),y!=null&&(a.checked=y&&typeof y!="function"&&typeof y!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?a.name=""+va(P):a.removeAttribute("name")}function Yv(a,i,u,p,y,x,A,P){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(a.type=x),i!=null||u!=null){if(!(x!=="submit"&&x!=="reset"||i!=null)){sp(a);return}u=u!=null?""+va(u):"",i=i!=null?""+va(i):u,P||i===a.value||(a.value=i),a.defaultValue=i}p=p??y,p=typeof p!="function"&&typeof p!="symbol"&&!!p,a.checked=P?a.checked:!!p,a.defaultChecked=!!p,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(a.name=A),sp(a)}function lp(a,i,u){i==="number"&&fc(a.ownerDocument)===a||a.defaultValue===""+u||(a.defaultValue=""+u)}function bs(a,i,u,p){if(a=a.options,i){i={};for(var y=0;y<u.length;y++)i["$"+u[y]]=!0;for(u=0;u<a.length;u++)y=i.hasOwnProperty("$"+a[u].value),a[u].selected!==y&&(a[u].selected=y),y&&p&&(a[u].defaultSelected=!0)}else{for(u=""+va(u),i=null,y=0;y<a.length;y++){if(a[y].value===u){a[y].selected=!0,p&&(a[y].defaultSelected=!0);return}i!==null||a[y].disabled||(i=a[y])}i!==null&&(i.selected=!0)}}function Qv(a,i,u){if(i!=null&&(i=""+va(i),i!==a.value&&(a.value=i),u==null)){a.defaultValue!==i&&(a.defaultValue=i);return}a.defaultValue=u!=null?""+va(u):""}function Xv(a,i,u,p){if(i==null){if(p!=null){if(u!=null)throw Error(r(92));if(q(p)){if(1<p.length)throw Error(r(93));p=p[0]}u=p}u==null&&(u=""),i=u}u=va(i),a.defaultValue=u,p=a.textContent,p===u&&p!==""&&p!==null&&(a.value=p),sp(a)}function xs(a,i){if(i){var u=a.firstChild;if(u&&u===a.lastChild&&u.nodeType===3){u.nodeValue=i;return}}a.textContent=i}var yE=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 Jv(a,i,u){var p=i.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?p?a.setProperty(i,""):i==="float"?a.cssFloat="":a[i]="":p?a.setProperty(i,u):typeof u!="number"||u===0||yE.has(i)?i==="float"?a.cssFloat=u:a[i]=(""+u).trim():a[i]=u+"px"}function ey(a,i,u){if(i!=null&&typeof i!="object")throw Error(r(62));if(a=a.style,u!=null){for(var p in u)!u.hasOwnProperty(p)||i!=null&&i.hasOwnProperty(p)||(p.indexOf("--")===0?a.setProperty(p,""):p==="float"?a.cssFloat="":a[p]="");for(var y in i)p=i[y],i.hasOwnProperty(y)&&u[y]!==p&&Jv(a,y,p)}else for(var x in i)i.hasOwnProperty(x)&&Jv(a,x,i[x])}function cp(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 bE=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"]]),xE=/^[\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 hc(a){return xE.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function hr(){}var up=null;function dp(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var ws=null,ks=null;function ty(a){var i=Ma(a);if(i&&(a=i.stateNode)){var u=a[vn]||null;e:switch(a=i.stateNode,i.type){case"input":if(op(a,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),i=u.name,u.type==="radio"&&i!=null){for(u=a;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+ya(""+i)+'"][type="radio"]'),i=0;i<u.length;i++){var p=u[i];if(p!==a&&p.form===a.form){var y=p[vn]||null;if(!y)throw Error(r(90));op(p,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(i=0;i<u.length;i++)p=u[i],p.form===a.form&&Kv(p)}break e;case"textarea":Qv(a,u.value,u.defaultValue);break e;case"select":i=u.value,i!=null&&bs(a,!!u.multiple,i,!1)}}}var pp=!1;function ny(a,i,u){if(pp)return a(i,u);pp=!0;try{var p=a(i);return p}finally{if(pp=!1,(ws!==null||ks!==null)&&(tu(),ws&&(i=ws,a=ks,ks=ws=null,ty(i),a)))for(i=0;i<a.length;i++)ty(a[i])}}function _o(a,i){var u=a.stateNode;if(u===null)return null;var p=u[vn]||null;if(p===null)return null;u=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(u&&typeof u!="function")throw Error(r(231,i,typeof u));return u}var mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fp=!1;if(mr)try{var Oo={};Object.defineProperty(Oo,"passive",{get:function(){fp=!0}}),window.addEventListener("test",Oo,Oo),window.removeEventListener("test",Oo,Oo)}catch{fp=!1}var Wr=null,hp=null,mc=null;function ay(){if(mc)return mc;var a,i=hp,u=i.length,p,y="value"in Wr?Wr.value:Wr.textContent,x=y.length;for(a=0;a<u&&i[a]===y[a];a++);var A=u-a;for(p=1;p<=A&&i[u-p]===y[x-p];p++);return mc=y.slice(a,1<p?1-p:void 0)}function gc(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 vc(){return!0}function ry(){return!1}function Bn(a){function i(u,p,y,x,A){this._reactName=u,this._targetInst=y,this.type=p,this.nativeEvent=x,this.target=A,this.currentTarget=null;for(var P in a)a.hasOwnProperty(P)&&(u=a[P],this[P]=u?u(x):x[P]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?vc:ry,this.isPropagationStopped=ry,this}return m(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=vc)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=vc)},persist:function(){},isPersistent:vc}),i}var Ai={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yc=Bn(Ai),Mo=m({},Ai,{view:0,detail:0}),wE=Bn(Mo),mp,gp,Lo,bc=m({},Mo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:yp,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!==Lo&&(Lo&&a.type==="mousemove"?(mp=a.screenX-Lo.screenX,gp=a.screenY-Lo.screenY):gp=mp=0,Lo=a),mp)},movementY:function(a){return"movementY"in a?a.movementY:gp}}),iy=Bn(bc),kE=m({},bc,{dataTransfer:0}),SE=Bn(kE),jE=m({},Mo,{relatedTarget:0}),vp=Bn(jE),CE=m({},Ai,{animationName:0,elapsedTime:0,pseudoElement:0}),NE=Bn(CE),EE=m({},Ai,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),AE=Bn(EE),TE=m({},Ai,{data:0}),sy=Bn(TE),RE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_E={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"},OE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ME(a){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(a):(a=OE[a])?!!i[a]:!1}function yp(){return ME}var LE=m({},Mo,{key:function(a){if(a.key){var i=RE[a.key]||a.key;if(i!=="Unidentified")return i}return a.type==="keypress"?(a=gc(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?_E[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:yp,charCode:function(a){return a.type==="keypress"?gc(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?gc(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),DE=Bn(LE),IE=m({},bc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),oy=Bn(IE),zE=m({},Mo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:yp}),$E=Bn(zE),PE=m({},Ai,{propertyName:0,elapsedTime:0,pseudoElement:0}),UE=Bn(PE),BE=m({},bc,{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}),FE=Bn(BE),HE=m({},Ai,{newState:0,oldState:0}),qE=Bn(HE),GE=[9,13,27,32],bp=mr&&"CompositionEvent"in window,Do=null;mr&&"documentMode"in document&&(Do=document.documentMode);var VE=mr&&"TextEvent"in window&&!Do,ly=mr&&(!bp||Do&&8<Do&&11>=Do),cy=" ",uy=!1;function dy(a,i){switch(a){case"keyup":return GE.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function py(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Ss=!1;function WE(a,i){switch(a){case"compositionend":return py(i);case"keypress":return i.which!==32?null:(uy=!0,cy);case"textInput":return a=i.data,a===cy&&uy?null:a;default:return null}}function ZE(a,i){if(Ss)return a==="compositionend"||!bp&&dy(a,i)?(a=ay(),mc=hp=Wr=null,Ss=!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 ly&&i.locale!=="ko"?null:i.data;default:return null}}var KE={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 fy(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i==="input"?!!KE[a.type]:i==="textarea"}function hy(a,i,u,p){ws?ks?ks.push(p):ks=[p]:ws=p,i=lu(i,"onChange"),0<i.length&&(u=new yc("onChange","change",null,u,p),a.push({event:u,listeners:i}))}var Io=null,zo=null;function YE(a){Y0(a,0)}function xc(a){var i=kn(a);if(Kv(i))return a}function my(a,i){if(a==="change")return i}var gy=!1;if(mr){var xp;if(mr){var wp="oninput"in document;if(!wp){var vy=document.createElement("div");vy.setAttribute("oninput","return;"),wp=typeof vy.oninput=="function"}xp=wp}else xp=!1;gy=xp&&(!document.documentMode||9<document.documentMode)}function yy(){Io&&(Io.detachEvent("onpropertychange",by),zo=Io=null)}function by(a){if(a.propertyName==="value"&&xc(zo)){var i=[];hy(i,zo,a,dp(a)),ny(YE,i)}}function QE(a,i,u){a==="focusin"?(yy(),Io=i,zo=u,Io.attachEvent("onpropertychange",by)):a==="focusout"&&yy()}function XE(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return xc(zo)}function JE(a,i){if(a==="click")return xc(i)}function eA(a,i){if(a==="input"||a==="change")return xc(i)}function tA(a,i){return a===i&&(a!==0||1/a===1/i)||a!==a&&i!==i}var Jn=typeof Object.is=="function"?Object.is:tA;function $o(a,i){if(Jn(a,i))return!0;if(typeof a!="object"||a===null||typeof i!="object"||i===null)return!1;var u=Object.keys(a),p=Object.keys(i);if(u.length!==p.length)return!1;for(p=0;p<u.length;p++){var y=u[p];if(!Oe.call(i,y)||!Jn(a[y],i[y]))return!1}return!0}function xy(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function wy(a,i){var u=xy(a);a=0;for(var p;u;){if(u.nodeType===3){if(p=a+u.textContent.length,a<=i&&p>=i)return{node:u,offset:i-a};a=p}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=xy(u)}}function ky(a,i){return a&&i?a===i?!0:a&&a.nodeType===3?!1:i&&i.nodeType===3?ky(a,i.parentNode):"contains"in a?a.contains(i):a.compareDocumentPosition?!!(a.compareDocumentPosition(i)&16):!1:!1}function Sy(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var i=fc(a.document);i instanceof a.HTMLIFrameElement;){try{var u=typeof i.contentWindow.location.href=="string"}catch{u=!1}if(u)a=i.contentWindow;else break;i=fc(a.document)}return i}function kp(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 nA=mr&&"documentMode"in document&&11>=document.documentMode,js=null,Sp=null,Po=null,jp=!1;function jy(a,i,u){var p=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;jp||js==null||js!==fc(p)||(p=js,"selectionStart"in p&&kp(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}),Po&&$o(Po,p)||(Po=p,p=lu(Sp,"onSelect"),0<p.length&&(i=new yc("onSelect","select",null,i,u),a.push({event:i,listeners:p}),i.target=js)))}function Ti(a,i){var u={};return u[a.toLowerCase()]=i.toLowerCase(),u["Webkit"+a]="webkit"+i,u["Moz"+a]="moz"+i,u}var Cs={animationend:Ti("Animation","AnimationEnd"),animationiteration:Ti("Animation","AnimationIteration"),animationstart:Ti("Animation","AnimationStart"),transitionrun:Ti("Transition","TransitionRun"),transitionstart:Ti("Transition","TransitionStart"),transitioncancel:Ti("Transition","TransitionCancel"),transitionend:Ti("Transition","TransitionEnd")},Cp={},Cy={};mr&&(Cy=document.createElement("div").style,"AnimationEvent"in window||(delete Cs.animationend.animation,delete Cs.animationiteration.animation,delete Cs.animationstart.animation),"TransitionEvent"in window||delete Cs.transitionend.transition);function Ri(a){if(Cp[a])return Cp[a];if(!Cs[a])return a;var i=Cs[a],u;for(u in i)if(i.hasOwnProperty(u)&&u in Cy)return Cp[a]=i[u];return a}var Ny=Ri("animationend"),Ey=Ri("animationiteration"),Ay=Ri("animationstart"),aA=Ri("transitionrun"),rA=Ri("transitionstart"),iA=Ri("transitioncancel"),Ty=Ri("transitionend"),Ry=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 La(a,i){Ry.set(a,i),Va(i,[a])}var wc=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)},ba=[],Ns=0,Ep=0;function kc(){for(var a=Ns,i=Ep=Ns=0;i<a;){var u=ba[i];ba[i++]=null;var p=ba[i];ba[i++]=null;var y=ba[i];ba[i++]=null;var x=ba[i];if(ba[i++]=null,p!==null&&y!==null){var A=p.pending;A===null?y.next=y:(y.next=A.next,A.next=y),p.pending=y}x!==0&&_y(u,y,x)}}function Sc(a,i,u,p){ba[Ns++]=a,ba[Ns++]=i,ba[Ns++]=u,ba[Ns++]=p,Ep|=p,a.lanes|=p,a=a.alternate,a!==null&&(a.lanes|=p)}function Ap(a,i,u,p){return Sc(a,i,u,p),jc(a)}function _i(a,i){return Sc(a,null,null,i),jc(a)}function _y(a,i,u){a.lanes|=u;var p=a.alternate;p!==null&&(p.lanes|=u);for(var y=!1,x=a.return;x!==null;)x.childLanes|=u,p=x.alternate,p!==null&&(p.childLanes|=u),x.tag===22&&(a=x.stateNode,a===null||a._visibility&1||(y=!0)),a=x,x=x.return;return a.tag===3?(x=a.stateNode,y&&i!==null&&(y=31-Ee(u),a=x.hiddenUpdates,p=a[y],p===null?a[y]=[i]:p.push(i),i.lane=u|536870912),x):null}function jc(a){if(50<ol)throw ol=0,$f=null,Error(r(185));for(var i=a.return;i!==null;)a=i,i=a.return;return a.tag===3?a.stateNode:null}var Es={};function sA(a,i,u,p){this.tag=a,this.key=u,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 ea(a,i,u,p){return new sA(a,i,u,p)}function Tp(a){return a=a.prototype,!(!a||!a.isReactComponent)}function gr(a,i){var u=a.alternate;return u===null?(u=ea(a.tag,i,a.key,a.mode),u.elementType=a.elementType,u.type=a.type,u.stateNode=a.stateNode,u.alternate=a,a.alternate=u):(u.pendingProps=i,u.type=a.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=a.flags&65011712,u.childLanes=a.childLanes,u.lanes=a.lanes,u.child=a.child,u.memoizedProps=a.memoizedProps,u.memoizedState=a.memoizedState,u.updateQueue=a.updateQueue,i=a.dependencies,u.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},u.sibling=a.sibling,u.index=a.index,u.ref=a.ref,u.refCleanup=a.refCleanup,u}function Oy(a,i){a.flags&=65011714;var u=a.alternate;return u===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=u.childLanes,a.lanes=u.lanes,a.child=u.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=u.memoizedProps,a.memoizedState=u.memoizedState,a.updateQueue=u.updateQueue,a.type=u.type,i=u.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),a}function Cc(a,i,u,p,y,x){var A=0;if(p=a,typeof a=="function")Tp(a)&&(A=1);else if(typeof a=="string")A=dT(a,u,ee.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case O:return a=ea(31,u,i,y),a.elementType=O,a.lanes=x,a;case j:return Oi(u.children,y,x,i);case C:A=8,y|=24;break;case S:return a=ea(12,u,i,y|2),a.elementType=S,a.lanes=x,a;case $:return a=ea(13,u,i,y),a.elementType=$,a.lanes=x,a;case R:return a=ea(19,u,i,y),a.elementType=R,a.lanes=x,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case E:A=10;break e;case N:A=9;break e;case T:A=11;break e;case L:A=14;break e;case B:A=16,p=null;break e}A=29,u=Error(r(130,a===null?"null":typeof a,"")),p=null}return i=ea(A,u,i,y),i.elementType=a,i.type=p,i.lanes=x,i}function Oi(a,i,u,p){return a=ea(7,a,p,i),a.lanes=u,a}function Rp(a,i,u){return a=ea(6,a,null,i),a.lanes=u,a}function My(a){var i=ea(18,null,null,0);return i.stateNode=a,i}function _p(a,i,u){return i=ea(4,a.children!==null?a.children:[],a.key,i),i.lanes=u,i.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},i}var Ly=new WeakMap;function xa(a,i){if(typeof a=="object"&&a!==null){var u=Ly.get(a);return u!==void 0?u:(i={value:a,source:i,stack:ye(i)},Ly.set(a,i),i)}return{value:a,source:i,stack:ye(i)}}var As=[],Ts=0,Nc=null,Uo=0,wa=[],ka=0,Zr=null,Wa=1,Za="";function vr(a,i){As[Ts++]=Uo,As[Ts++]=Nc,Nc=a,Uo=i}function Dy(a,i,u){wa[ka++]=Wa,wa[ka++]=Za,wa[ka++]=Zr,Zr=a;var p=Wa;a=Za;var y=32-Ee(p)-1;p&=~(1<<y),u+=1;var x=32-Ee(i)+y;if(30<x){var A=y-y%5;x=(p&(1<<A)-1).toString(32),p>>=A,y-=A,Wa=1<<32-Ee(i)+y|u<<y|p,Za=x+a}else Wa=1<<x|u<<y|p,Za=a}function Op(a){a.return!==null&&(vr(a,1),Dy(a,1,0))}function Mp(a){for(;a===Nc;)Nc=As[--Ts],As[Ts]=null,Uo=As[--Ts],As[Ts]=null;for(;a===Zr;)Zr=wa[--ka],wa[ka]=null,Za=wa[--ka],wa[ka]=null,Wa=wa[--ka],wa[ka]=null}function Iy(a,i){wa[ka++]=Wa,wa[ka++]=Za,wa[ka++]=Zr,Wa=i.id,Za=i.overflow,Zr=a}var jn=null,Dt=null,ct=!1,Kr=null,Sa=!1,Lp=Error(r(519));function Yr(a){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Bo(xa(i,a)),Lp}function zy(a){var i=a.stateNode,u=a.type,p=a.memoizedProps;switch(i[Vt]=a,i[vn]=p,u){case"dialog":at("cancel",i),at("close",i);break;case"iframe":case"object":case"embed":at("load",i);break;case"video":case"audio":for(u=0;u<cl.length;u++)at(cl[u],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),Yv(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),Xv(i,p.value,p.defaultValue,p.children)}u=p.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||i.textContent===""+u||p.suppressHydrationWarning===!0||ex(i.textContent,u)?(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=hr),i=!0):i=!1,i||Yr(a,!0)}function $y(a){for(jn=a.return;jn;)switch(jn.tag){case 5:case 31:case 13:Sa=!1;return;case 27:case 3:Sa=!0;return;default:jn=jn.return}}function Rs(a){if(a!==jn)return!1;if(!ct)return $y(a),ct=!0,!1;var i=a.tag,u;if((u=i!==3&&i!==27)&&((u=i===5)&&(u=a.type,u=!(u!=="form"&&u!=="button")||Jf(a.type,a.memoizedProps)),u=!u),u&&Dt&&Yr(a),$y(a),i===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Dt=cx(a)}else if(i===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Dt=cx(a)}else i===27?(i=Dt,ui(a.type)?(a=rh,rh=null,Dt=a):Dt=i):Dt=jn?Ca(a.stateNode.nextSibling):null;return!0}function Mi(){Dt=jn=null,ct=!1}function Dp(){var a=Kr;return a!==null&&(Gn===null?Gn=a:Gn.push.apply(Gn,a),Kr=null),a}function Bo(a){Kr===null?Kr=[a]:Kr.push(a)}var Ip=U(null),Li=null,yr=null;function Qr(a,i,u){M(Ip,i._currentValue),i._currentValue=u}function br(a){a._currentValue=Ip.current,G(Ip)}function zp(a,i,u){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===u)break;a=a.return}}function $p(a,i,u,p){var y=a.child;for(y!==null&&(y.return=a);y!==null;){var x=y.dependencies;if(x!==null){var A=y.child;x=x.firstContext;e:for(;x!==null;){var P=x;x=y;for(var Q=0;Q<i.length;Q++)if(P.context===i[Q]){x.lanes|=u,P=x.alternate,P!==null&&(P.lanes|=u),zp(x.return,u,a),p||(A=null);break e}x=P.next}}else if(y.tag===18){if(A=y.return,A===null)throw Error(r(341));A.lanes|=u,x=A.alternate,x!==null&&(x.lanes|=u),zp(A,u,a),A=null}else A=y.child;if(A!==null)A.return=y;else for(A=y;A!==null;){if(A===a){A=null;break}if(y=A.sibling,y!==null){y.return=A.return,A=y;break}A=A.return}y=A}}function _s(a,i,u,p){a=null;for(var y=i,x=!1;y!==null;){if(!x){if((y.flags&524288)!==0)x=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var A=y.alternate;if(A===null)throw Error(r(387));if(A=A.memoizedProps,A!==null){var P=y.type;Jn(y.pendingProps.value,A.value)||(a!==null?a.push(P):a=[P])}}else if(y===be.current){if(A=y.alternate,A===null)throw Error(r(387));A.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(a!==null?a.push(hl):a=[hl])}y=y.return}a!==null&&$p(i,a,u,p),i.flags|=262144}function Ec(a){for(a=a.firstContext;a!==null;){if(!Jn(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function Di(a){Li=a,yr=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function Cn(a){return Py(Li,a)}function Ac(a,i){return Li===null&&Di(a),Py(a,i)}function Py(a,i){var u=i._currentValue;if(i={context:i,memoizedValue:u,next:null},yr===null){if(a===null)throw Error(r(308));yr=i,a.dependencies={lanes:0,firstContext:i},a.flags|=524288}else yr=yr.next=i;return u}var oA=typeof AbortController<"u"?AbortController:function(){var a=[],i=this.signal={aborted:!1,addEventListener:function(u,p){a.push(p)}};this.abort=function(){i.aborted=!0,a.forEach(function(u){return u()})}},lA=e.unstable_scheduleCallback,cA=e.unstable_NormalPriority,an={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Pp(){return{controller:new oA,data:new Map,refCount:0}}function Fo(a){a.refCount--,a.refCount===0&&lA(cA,function(){a.controller.abort()})}var Ho=null,Up=0,Os=0,Ms=null;function uA(a,i){if(Ho===null){var u=Ho=[];Up=0,Os=qf(),Ms={status:"pending",value:void 0,then:function(p){u.push(p)}}}return Up++,i.then(Uy,Uy),i}function Uy(){if(--Up===0&&Ho!==null){Ms!==null&&(Ms.status="fulfilled");var a=Ho;Ho=null,Os=0,Ms=null;for(var i=0;i<a.length;i++)(0,a[i])()}}function dA(a,i){var u=[],p={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return a.then(function(){p.status="fulfilled",p.value=i;for(var y=0;y<u.length;y++)(0,u[y])(i)},function(y){for(p.status="rejected",p.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),p}var By=V.S;V.S=function(a,i){j0=ut(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&uA(a,i),By!==null&&By(a,i)};var Ii=U(null);function Bp(){var a=Ii.current;return a!==null?a:At.pooledCache}function Tc(a,i){i===null?M(Ii,Ii.current):M(Ii,i.pool)}function Fy(){var a=Bp();return a===null?null:{parent:an._currentValue,pool:a}}var Ls=Error(r(460)),Fp=Error(r(474)),Rc=Error(r(542)),_c={then:function(){}};function Hy(a){return a=a.status,a==="fulfilled"||a==="rejected"}function qy(a,i,u){switch(u=a[u],u===void 0?a.push(i):u!==i&&(i.then(hr,hr),i=u),i.status){case"fulfilled":return i.value;case"rejected":throw a=i.reason,Vy(a),a;default:if(typeof i.status=="string")i.then(hr,hr);else{if(a=At,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=i,a.status="pending",a.then(function(p){if(i.status==="pending"){var y=i;y.status="fulfilled",y.value=p}},function(p){if(i.status==="pending"){var y=i;y.status="rejected",y.reason=p}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw a=i.reason,Vy(a),a}throw $i=i,Ls}}function zi(a){try{var i=a._init;return i(a._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?($i=u,Ls):u}}var $i=null;function Gy(){if($i===null)throw Error(r(459));var a=$i;return $i=null,a}function Vy(a){if(a===Ls||a===Rc)throw Error(r(483))}var Ds=null,qo=0;function Oc(a){var i=qo;return qo+=1,Ds===null&&(Ds=[]),qy(Ds,a,i)}function Go(a,i){i=i.props.ref,a.ref=i!==void 0?i:null}function Mc(a,i){throw i.$$typeof===v?Error(r(525)):(a=Object.prototype.toString.call(i),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":a)))}function Wy(a){function i(te,J){if(a){var ne=te.deletions;ne===null?(te.deletions=[J],te.flags|=16):ne.push(J)}}function u(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 y(te,J){return te=gr(te,J),te.index=0,te.sibling=null,te}function x(te,J,ne){return te.index=ne,a?(ne=te.alternate,ne!==null?(ne=ne.index,ne<J?(te.flags|=67108866,J):ne):(te.flags|=67108866,J)):(te.flags|=1048576,J)}function A(te){return a&&te.alternate===null&&(te.flags|=67108866),te}function P(te,J,ne,he){return J===null||J.tag!==6?(J=Rp(ne,te.mode,he),J.return=te,J):(J=y(J,ne),J.return=te,J)}function Q(te,J,ne,he){var ze=ne.type;return ze===j?de(te,J,ne.props.children,he,ne.key):J!==null&&(J.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===B&&zi(ze)===J.type)?(J=y(J,ne.props),Go(J,ne),J.return=te,J):(J=Cc(ne.type,ne.key,ne.props,null,te.mode,he),Go(J,ne),J.return=te,J)}function ae(te,J,ne,he){return J===null||J.tag!==4||J.stateNode.containerInfo!==ne.containerInfo||J.stateNode.implementation!==ne.implementation?(J=_p(ne,te.mode,he),J.return=te,J):(J=y(J,ne.children||[]),J.return=te,J)}function de(te,J,ne,he,ze){return J===null||J.tag!==7?(J=Oi(ne,te.mode,he,ze),J.return=te,J):(J=y(J,ne),J.return=te,J)}function ge(te,J,ne){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=Rp(""+J,te.mode,ne),J.return=te,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return ne=Cc(J.type,J.key,J.props,null,te.mode,ne),Go(ne,J),ne.return=te,ne;case k:return J=_p(J,te.mode,ne),J.return=te,J;case B:return J=zi(J),ge(te,J,ne)}if(q(J)||F(J))return J=Oi(J,te.mode,ne,null),J.return=te,J;if(typeof J.then=="function")return ge(te,Oc(J),ne);if(J.$$typeof===E)return ge(te,Ac(te,J),ne);Mc(te,J)}return null}function ie(te,J,ne,he){var ze=J!==null?J.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ze!==null?null:P(te,J,""+ne,he);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case b:return ne.key===ze?Q(te,J,ne,he):null;case k:return ne.key===ze?ae(te,J,ne,he):null;case B:return ne=zi(ne),ie(te,J,ne,he)}if(q(ne)||F(ne))return ze!==null?null:de(te,J,ne,he,null);if(typeof ne.then=="function")return ie(te,J,Oc(ne),he);if(ne.$$typeof===E)return ie(te,J,Ac(te,ne),he);Mc(te,ne)}return null}function le(te,J,ne,he,ze){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return te=te.get(ne)||null,P(J,te,""+he,ze);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case b:return te=te.get(he.key===null?ne:he.key)||null,Q(J,te,he,ze);case k:return te=te.get(he.key===null?ne:he.key)||null,ae(J,te,he,ze);case B:return he=zi(he),le(te,J,ne,he,ze)}if(q(he)||F(he))return te=te.get(ne)||null,de(J,te,he,ze,null);if(typeof he.then=="function")return le(te,J,ne,Oc(he),ze);if(he.$$typeof===E)return le(te,J,ne,Ac(J,he),ze);Mc(J,he)}return null}function Te(te,J,ne,he){for(var ze=null,ht=null,_e=J,Je=J=0,ot=null;_e!==null&&Je<ne.length;Je++){_e.index>Je?(ot=_e,_e=null):ot=_e.sibling;var mt=ie(te,_e,ne[Je],he);if(mt===null){_e===null&&(_e=ot);break}a&&_e&&mt.alternate===null&&i(te,_e),J=x(mt,J,Je),ht===null?ze=mt:ht.sibling=mt,ht=mt,_e=ot}if(Je===ne.length)return u(te,_e),ct&&vr(te,Je),ze;if(_e===null){for(;Je<ne.length;Je++)_e=ge(te,ne[Je],he),_e!==null&&(J=x(_e,J,Je),ht===null?ze=_e:ht.sibling=_e,ht=_e);return ct&&vr(te,Je),ze}for(_e=p(_e);Je<ne.length;Je++)ot=le(_e,te,Je,ne[Je],he),ot!==null&&(a&&ot.alternate!==null&&_e.delete(ot.key===null?Je:ot.key),J=x(ot,J,Je),ht===null?ze=ot:ht.sibling=ot,ht=ot);return a&&_e.forEach(function(mi){return i(te,mi)}),ct&&vr(te,Je),ze}function Be(te,J,ne,he){if(ne==null)throw Error(r(151));for(var ze=null,ht=null,_e=J,Je=J=0,ot=null,mt=ne.next();_e!==null&&!mt.done;Je++,mt=ne.next()){_e.index>Je?(ot=_e,_e=null):ot=_e.sibling;var mi=ie(te,_e,mt.value,he);if(mi===null){_e===null&&(_e=ot);break}a&&_e&&mi.alternate===null&&i(te,_e),J=x(mi,J,Je),ht===null?ze=mi:ht.sibling=mi,ht=mi,_e=ot}if(mt.done)return u(te,_e),ct&&vr(te,Je),ze;if(_e===null){for(;!mt.done;Je++,mt=ne.next())mt=ge(te,mt.value,he),mt!==null&&(J=x(mt,J,Je),ht===null?ze=mt:ht.sibling=mt,ht=mt);return ct&&vr(te,Je),ze}for(_e=p(_e);!mt.done;Je++,mt=ne.next())mt=le(_e,te,Je,mt.value,he),mt!==null&&(a&&mt.alternate!==null&&_e.delete(mt.key===null?Je:mt.key),J=x(mt,J,Je),ht===null?ze=mt:ht.sibling=mt,ht=mt);return a&&_e.forEach(function(kT){return i(te,kT)}),ct&&vr(te,Je),ze}function Nt(te,J,ne,he){if(typeof ne=="object"&&ne!==null&&ne.type===j&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case b:e:{for(var ze=ne.key;J!==null;){if(J.key===ze){if(ze=ne.type,ze===j){if(J.tag===7){u(te,J.sibling),he=y(J,ne.props.children),he.return=te,te=he;break e}}else if(J.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===B&&zi(ze)===J.type){u(te,J.sibling),he=y(J,ne.props),Go(he,ne),he.return=te,te=he;break e}u(te,J);break}else i(te,J);J=J.sibling}ne.type===j?(he=Oi(ne.props.children,te.mode,he,ne.key),he.return=te,te=he):(he=Cc(ne.type,ne.key,ne.props,null,te.mode,he),Go(he,ne),he.return=te,te=he)}return A(te);case k:e:{for(ze=ne.key;J!==null;){if(J.key===ze)if(J.tag===4&&J.stateNode.containerInfo===ne.containerInfo&&J.stateNode.implementation===ne.implementation){u(te,J.sibling),he=y(J,ne.children||[]),he.return=te,te=he;break e}else{u(te,J);break}else i(te,J);J=J.sibling}he=_p(ne,te.mode,he),he.return=te,te=he}return A(te);case B:return ne=zi(ne),Nt(te,J,ne,he)}if(q(ne))return Te(te,J,ne,he);if(F(ne)){if(ze=F(ne),typeof ze!="function")throw Error(r(150));return ne=ze.call(ne),Be(te,J,ne,he)}if(typeof ne.then=="function")return Nt(te,J,Oc(ne),he);if(ne.$$typeof===E)return Nt(te,J,Ac(te,ne),he);Mc(te,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,J!==null&&J.tag===6?(u(te,J.sibling),he=y(J,ne),he.return=te,te=he):(u(te,J),he=Rp(ne,te.mode,he),he.return=te,te=he),A(te)):u(te,J)}return function(te,J,ne,he){try{qo=0;var ze=Nt(te,J,ne,he);return Ds=null,ze}catch(_e){if(_e===Ls||_e===Rc)throw _e;var ht=ea(29,_e,null,te.mode);return ht.lanes=he,ht.return=te,ht}finally{}}}var Pi=Wy(!0),Zy=Wy(!1),Xr=!1;function Hp(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qp(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 Jr(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function ei(a,i,u){var p=a.updateQueue;if(p===null)return null;if(p=p.shared,(bt&2)!==0){var y=p.pending;return y===null?i.next=i:(i.next=y.next,y.next=i),p.pending=i,i=jc(a),_y(a,null,u),i}return Sc(a,p,i,u),jc(a)}function Vo(a,i,u){if(i=i.updateQueue,i!==null&&(i=i.shared,(u&4194048)!==0)){var p=i.lanes;p&=a.pendingLanes,u|=p,i.lanes=u,je(a,u)}}function Gp(a,i){var u=a.updateQueue,p=a.alternate;if(p!==null&&(p=p.updateQueue,u===p)){var y=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var A={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};x===null?y=x=A:x=x.next=A,u=u.next}while(u!==null);x===null?y=x=i:x=x.next=i}else y=x=i;u={baseState:p.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:p.shared,callbacks:p.callbacks},a.updateQueue=u;return}a=u.lastBaseUpdate,a===null?u.firstBaseUpdate=i:a.next=i,u.lastBaseUpdate=i}var Vp=!1;function Wo(){if(Vp){var a=Ms;if(a!==null)throw a}}function Zo(a,i,u,p){Vp=!1;var y=a.updateQueue;Xr=!1;var x=y.firstBaseUpdate,A=y.lastBaseUpdate,P=y.shared.pending;if(P!==null){y.shared.pending=null;var Q=P,ae=Q.next;Q.next=null,A===null?x=ae:A.next=ae,A=Q;var de=a.alternate;de!==null&&(de=de.updateQueue,P=de.lastBaseUpdate,P!==A&&(P===null?de.firstBaseUpdate=ae:P.next=ae,de.lastBaseUpdate=Q))}if(x!==null){var ge=y.baseState;A=0,de=ae=Q=null,P=x;do{var ie=P.lane&-536870913,le=ie!==P.lane;if(le?(st&ie)===ie:(p&ie)===ie){ie!==0&&ie===Os&&(Vp=!0),de!==null&&(de=de.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Te=a,Be=P;ie=i;var Nt=u;switch(Be.tag){case 1:if(Te=Be.payload,typeof Te=="function"){ge=Te.call(Nt,ge,ie);break e}ge=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Be.payload,ie=typeof Te=="function"?Te.call(Nt,ge,ie):Te,ie==null)break e;ge=m({},ge,ie);break e;case 2:Xr=!0}}ie=P.callback,ie!==null&&(a.flags|=64,le&&(a.flags|=8192),le=y.callbacks,le===null?y.callbacks=[ie]:le.push(ie))}else le={lane:ie,tag:P.tag,payload:P.payload,callback:P.callback,next:null},de===null?(ae=de=le,Q=ge):de=de.next=le,A|=ie;if(P=P.next,P===null){if(P=y.shared.pending,P===null)break;le=P,P=le.next,le.next=null,y.lastBaseUpdate=le,y.shared.pending=null}}while(!0);de===null&&(Q=ge),y.baseState=Q,y.firstBaseUpdate=ae,y.lastBaseUpdate=de,x===null&&(y.shared.lanes=0),ii|=A,a.lanes=A,a.memoizedState=ge}}function Ky(a,i){if(typeof a!="function")throw Error(r(191,a));a.call(i)}function Yy(a,i){var u=a.callbacks;if(u!==null)for(a.callbacks=null,a=0;a<u.length;a++)Ky(u[a],i)}var Is=U(null),Lc=U(0);function Qy(a,i){a=Ar,M(Lc,a),M(Is,i),Ar=a|i.baseLanes}function Wp(){M(Lc,Ar),M(Is,Is.current)}function Zp(){Ar=Lc.current,G(Is),G(Lc)}var ta=U(null),ja=null;function ti(a){var i=a.alternate;M(Jt,Jt.current&1),M(ta,a),ja===null&&(i===null||Is.current!==null||i.memoizedState!==null)&&(ja=a)}function Kp(a){M(Jt,Jt.current),M(ta,a),ja===null&&(ja=a)}function Xy(a){a.tag===22?(M(Jt,Jt.current),M(ta,a),ja===null&&(ja=a)):ni()}function ni(){M(Jt,Jt.current),M(ta,ta.current)}function na(a){G(ta),ja===a&&(ja=null),G(Jt)}var Jt=U(0);function Dc(a){for(var i=a;i!==null;){if(i.tag===13){var u=i.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||nh(u)||ah(u)))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 xr=0,Xe=null,jt=null,rn=null,Ic=!1,zs=!1,Ui=!1,zc=0,Ko=0,$s=null,pA=0;function Kt(){throw Error(r(321))}function Yp(a,i){if(i===null)return!1;for(var u=0;u<i.length&&u<a.length;u++)if(!Jn(a[u],i[u]))return!1;return!0}function Qp(a,i,u,p,y,x){return xr=x,Xe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,V.H=a===null||a.memoizedState===null?Db:ff,Ui=!1,x=u(p,y),Ui=!1,zs&&(x=eb(i,u,p,y)),Jy(a),x}function Jy(a){V.H=Xo;var i=jt!==null&&jt.next!==null;if(xr=0,rn=jt=Xe=null,Ic=!1,Ko=0,$s=null,i)throw Error(r(300));a===null||sn||(a=a.dependencies,a!==null&&Ec(a)&&(sn=!0))}function eb(a,i,u,p){Xe=a;var y=0;do{if(zs&&($s=null),Ko=0,zs=!1,25<=y)throw Error(r(301));if(y+=1,rn=jt=null,a.updateQueue!=null){var x=a.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}V.H=Ib,x=i(u,p)}while(zs);return x}function fA(){var a=V.H,i=a.useState()[0];return i=typeof i.then=="function"?Yo(i):i,a=a.useState()[0],(jt!==null?jt.memoizedState:null)!==a&&(Xe.flags|=1024),i}function Xp(){var a=zc!==0;return zc=0,a}function Jp(a,i,u){i.updateQueue=a.updateQueue,i.flags&=-2053,a.lanes&=~u}function ef(a){if(Ic){for(a=a.memoizedState;a!==null;){var i=a.queue;i!==null&&(i.pending=null),a=a.next}Ic=!1}xr=0,rn=jt=Xe=null,zs=!1,Ko=zc=0,$s=null}function Mn(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rn===null?Xe.memoizedState=rn=a:rn=rn.next=a,rn}function en(){if(jt===null){var a=Xe.alternate;a=a!==null?a.memoizedState:null}else a=jt.next;var i=rn===null?Xe.memoizedState:rn.next;if(i!==null)rn=i,jt=a;else{if(a===null)throw Xe.alternate===null?Error(r(467)):Error(r(310));jt=a,a={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},rn===null?Xe.memoizedState=rn=a:rn=rn.next=a}return rn}function $c(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Yo(a){var i=Ko;return Ko+=1,$s===null&&($s=[]),a=qy($s,a,i),i=Xe,(rn===null?i.memoizedState:rn.next)===null&&(i=i.alternate,V.H=i===null||i.memoizedState===null?Db:ff),a}function Pc(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return Yo(a);if(a.$$typeof===E)return Cn(a)}throw Error(r(438,String(a)))}function tf(a){var i=null,u=Xe.updateQueue;if(u!==null&&(i=u.memoCache),i==null){var p=Xe.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(i={data:p.data.map(function(y){return y.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),u===null&&(u=$c(),Xe.updateQueue=u),u.memoCache=i,u=i.data[i.index],u===void 0)for(u=i.data[i.index]=Array(a),p=0;p<a;p++)u[p]=_;return i.index++,u}function wr(a,i){return typeof i=="function"?i(a):i}function Uc(a){var i=en();return nf(i,jt,a)}function nf(a,i,u){var p=a.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=u;var y=a.baseQueue,x=p.pending;if(x!==null){if(y!==null){var A=y.next;y.next=x.next,x.next=A}i.baseQueue=y=x,p.pending=null}if(x=a.baseState,y===null)a.memoizedState=x;else{i=y.next;var P=A=null,Q=null,ae=i,de=!1;do{var ge=ae.lane&-536870913;if(ge!==ae.lane?(st&ge)===ge:(xr&ge)===ge){var ie=ae.revertLane;if(ie===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),ge===Os&&(de=!0);else if((xr&ie)===ie){ae=ae.next,ie===Os&&(de=!0);continue}else ge={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(P=Q=ge,A=x):Q=Q.next=ge,Xe.lanes|=ie,ii|=ie;ge=ae.action,Ui&&u(x,ge),x=ae.hasEagerState?ae.eagerState:u(x,ge)}else ie={lane:ge,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(P=Q=ie,A=x):Q=Q.next=ie,Xe.lanes|=ge,ii|=ge;ae=ae.next}while(ae!==null&&ae!==i);if(Q===null?A=x:Q.next=P,!Jn(x,a.memoizedState)&&(sn=!0,de&&(u=Ms,u!==null)))throw u;a.memoizedState=x,a.baseState=A,a.baseQueue=Q,p.lastRenderedState=x}return y===null&&(p.lanes=0),[a.memoizedState,p.dispatch]}function af(a){var i=en(),u=i.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=a;var p=u.dispatch,y=u.pending,x=i.memoizedState;if(y!==null){u.pending=null;var A=y=y.next;do x=a(x,A.action),A=A.next;while(A!==y);Jn(x,i.memoizedState)||(sn=!0),i.memoizedState=x,i.baseQueue===null&&(i.baseState=x),u.lastRenderedState=x}return[x,p]}function tb(a,i,u){var p=Xe,y=en(),x=ct;if(x){if(u===void 0)throw Error(r(407));u=u()}else u=i();var A=!Jn((jt||y).memoizedState,u);if(A&&(y.memoizedState=u,sn=!0),y=y.queue,of(rb.bind(null,p,y,a),[a]),y.getSnapshot!==i||A||rn!==null&&rn.memoizedState.tag&1){if(p.flags|=2048,Ps(9,{destroy:void 0},ab.bind(null,p,y,u,i),null),At===null)throw Error(r(349));x||(xr&127)!==0||nb(p,i,u)}return u}function nb(a,i,u){a.flags|=16384,a={getSnapshot:i,value:u},i=Xe.updateQueue,i===null?(i=$c(),Xe.updateQueue=i,i.stores=[a]):(u=i.stores,u===null?i.stores=[a]:u.push(a))}function ab(a,i,u,p){i.value=u,i.getSnapshot=p,ib(i)&&sb(a)}function rb(a,i,u){return u(function(){ib(i)&&sb(a)})}function ib(a){var i=a.getSnapshot;a=a.value;try{var u=i();return!Jn(a,u)}catch{return!0}}function sb(a){var i=_i(a,2);i!==null&&Vn(i,a,2)}function rf(a){var i=Mn();if(typeof a=="function"){var u=a;if(a=u(),Ui){tt(!0);try{u()}finally{tt(!1)}}}return i.memoizedState=i.baseState=a,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wr,lastRenderedState:a},i}function ob(a,i,u,p){return a.baseState=u,nf(a,jt,typeof p=="function"?p:wr)}function hA(a,i,u,p,y){if(Hc(a))throw Error(r(485));if(a=i.action,a!==null){var x={payload:y,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){x.listeners.push(A)}};V.T!==null?u(!0):x.isTransition=!1,p(x),u=i.pending,u===null?(x.next=i.pending=x,lb(i,x)):(x.next=u.next,i.pending=u.next=x)}}function lb(a,i){var u=i.action,p=i.payload,y=a.state;if(i.isTransition){var x=V.T,A={};V.T=A;try{var P=u(y,p),Q=V.S;Q!==null&&Q(A,P),cb(a,i,P)}catch(ae){sf(a,i,ae)}finally{x!==null&&A.types!==null&&(x.types=A.types),V.T=x}}else try{x=u(y,p),cb(a,i,x)}catch(ae){sf(a,i,ae)}}function cb(a,i,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(p){ub(a,i,p)},function(p){return sf(a,i,p)}):ub(a,i,u)}function ub(a,i,u){i.status="fulfilled",i.value=u,db(i),a.state=u,i=a.pending,i!==null&&(u=i.next,u===i?a.pending=null:(u=u.next,i.next=u,lb(a,u)))}function sf(a,i,u){var p=a.pending;if(a.pending=null,p!==null){p=p.next;do i.status="rejected",i.reason=u,db(i),i=i.next;while(i!==p)}a.action=null}function db(a){a=a.listeners;for(var i=0;i<a.length;i++)(0,a[i])()}function pb(a,i){return i}function fb(a,i){if(ct){var u=At.formState;if(u!==null){e:{var p=Xe;if(ct){if(Dt){t:{for(var y=Dt,x=Sa;y.nodeType!==8;){if(!x){y=null;break t}if(y=Ca(y.nextSibling),y===null){y=null;break t}}x=y.data,y=x==="F!"||x==="F"?y:null}if(y){Dt=Ca(y.nextSibling),p=y.data==="F!";break e}}Yr(p)}p=!1}p&&(i=u[0])}}return u=Mn(),u.memoizedState=u.baseState=i,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pb,lastRenderedState:i},u.queue=p,u=Ob.bind(null,Xe,p),p.dispatch=u,p=rf(!1),x=pf.bind(null,Xe,!1,p.queue),p=Mn(),y={state:i,dispatch:null,action:a,pending:null},p.queue=y,u=hA.bind(null,Xe,y,x,u),y.dispatch=u,p.memoizedState=a,[i,u,!1]}function hb(a){var i=en();return mb(i,jt,a)}function mb(a,i,u){if(i=nf(a,i,pb)[0],a=Uc(wr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var p=Yo(i)}catch(A){throw A===Ls?Rc:A}else p=i;i=en();var y=i.queue,x=y.dispatch;return u!==i.memoizedState&&(Xe.flags|=2048,Ps(9,{destroy:void 0},mA.bind(null,y,u),null)),[p,x,a]}function mA(a,i){a.action=i}function gb(a){var i=en(),u=jt;if(u!==null)return mb(i,u,a);en(),i=i.memoizedState,u=en();var p=u.queue.dispatch;return u.memoizedState=a,[i,p,!1]}function Ps(a,i,u,p){return a={tag:a,create:u,deps:p,inst:i,next:null},i=Xe.updateQueue,i===null&&(i=$c(),Xe.updateQueue=i),u=i.lastEffect,u===null?i.lastEffect=a.next=a:(p=u.next,u.next=a,a.next=p,i.lastEffect=a),a}function vb(){return en().memoizedState}function Bc(a,i,u,p){var y=Mn();Xe.flags|=a,y.memoizedState=Ps(1|i,{destroy:void 0},u,p===void 0?null:p)}function Fc(a,i,u,p){var y=en();p=p===void 0?null:p;var x=y.memoizedState.inst;jt!==null&&p!==null&&Yp(p,jt.memoizedState.deps)?y.memoizedState=Ps(i,x,u,p):(Xe.flags|=a,y.memoizedState=Ps(1|i,x,u,p))}function yb(a,i){Bc(8390656,8,a,i)}function of(a,i){Fc(2048,8,a,i)}function gA(a){Xe.flags|=4;var i=Xe.updateQueue;if(i===null)i=$c(),Xe.updateQueue=i,i.events=[a];else{var u=i.events;u===null?i.events=[a]:u.push(a)}}function bb(a){var i=en().memoizedState;return gA({ref:i,nextImpl:a}),function(){if((bt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function xb(a,i){return Fc(4,2,a,i)}function wb(a,i){return Fc(4,4,a,i)}function kb(a,i){if(typeof i=="function"){a=a();var u=i(a);return function(){typeof u=="function"?u():i(null)}}if(i!=null)return a=a(),i.current=a,function(){i.current=null}}function Sb(a,i,u){u=u!=null?u.concat([a]):null,Fc(4,4,kb.bind(null,i,a),u)}function lf(){}function jb(a,i){var u=en();i=i===void 0?null:i;var p=u.memoizedState;return i!==null&&Yp(i,p[1])?p[0]:(u.memoizedState=[a,i],a)}function Cb(a,i){var u=en();i=i===void 0?null:i;var p=u.memoizedState;if(i!==null&&Yp(i,p[1]))return p[0];if(p=a(),Ui){tt(!0);try{a()}finally{tt(!1)}}return u.memoizedState=[p,i],p}function cf(a,i,u){return u===void 0||(xr&1073741824)!==0&&(st&261930)===0?a.memoizedState=i:(a.memoizedState=u,a=N0(),Xe.lanes|=a,ii|=a,u)}function Nb(a,i,u,p){return Jn(u,i)?u:Is.current!==null?(a=cf(a,u,p),Jn(a,i)||(sn=!0),a):(xr&42)===0||(xr&1073741824)!==0&&(st&261930)===0?(sn=!0,a.memoizedState=u):(a=N0(),Xe.lanes|=a,ii|=a,i)}function Eb(a,i,u,p,y){var x=Z.p;Z.p=x!==0&&8>x?x:8;var A=V.T,P={};V.T=P,pf(a,!1,i,u);try{var Q=y(),ae=V.S;if(ae!==null&&ae(P,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var de=dA(Q,p);Qo(a,i,de,ia(a))}else Qo(a,i,p,ia(a))}catch(ge){Qo(a,i,{then:function(){},status:"rejected",reason:ge},ia())}finally{Z.p=x,A!==null&&P.types!==null&&(A.types=P.types),V.T=A}}function vA(){}function uf(a,i,u,p){if(a.tag!==5)throw Error(r(476));var y=Ab(a).queue;Eb(a,y,i,Y,u===null?vA:function(){return Tb(a),u(p)})}function Ab(a){var i=a.memoizedState;if(i!==null)return i;i={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wr,lastRenderedState:Y},next:null};var u={};return i.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wr,lastRenderedState:u},next:null},a.memoizedState=i,a=a.alternate,a!==null&&(a.memoizedState=i),i}function Tb(a){var i=Ab(a);i.next===null&&(i=a.alternate.memoizedState),Qo(a,i.next.queue,{},ia())}function df(){return Cn(hl)}function Rb(){return en().memoizedState}function _b(){return en().memoizedState}function yA(a){for(var i=a.return;i!==null;){switch(i.tag){case 24:case 3:var u=ia();a=Jr(u);var p=ei(i,a,u);p!==null&&(Vn(p,i,u),Vo(p,i,u)),i={cache:Pp()},a.payload=i;return}i=i.return}}function bA(a,i,u){var p=ia();u={lane:p,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Hc(a)?Mb(i,u):(u=Ap(a,i,u,p),u!==null&&(Vn(u,a,p),Lb(u,i,p)))}function Ob(a,i,u){var p=ia();Qo(a,i,u,p)}function Qo(a,i,u,p){var y={lane:p,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Hc(a))Mb(i,y);else{var x=a.alternate;if(a.lanes===0&&(x===null||x.lanes===0)&&(x=i.lastRenderedReducer,x!==null))try{var A=i.lastRenderedState,P=x(A,u);if(y.hasEagerState=!0,y.eagerState=P,Jn(P,A))return Sc(a,i,y,0),At===null&&kc(),!1}catch{}finally{}if(u=Ap(a,i,y,p),u!==null)return Vn(u,a,p),Lb(u,i,p),!0}return!1}function pf(a,i,u,p){if(p={lane:2,revertLane:qf(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Hc(a)){if(i)throw Error(r(479))}else i=Ap(a,u,p,2),i!==null&&Vn(i,a,2)}function Hc(a){var i=a.alternate;return a===Xe||i!==null&&i===Xe}function Mb(a,i){zs=Ic=!0;var u=a.pending;u===null?i.next=i:(i.next=u.next,u.next=i),a.pending=i}function Lb(a,i,u){if((u&4194048)!==0){var p=i.lanes;p&=a.pendingLanes,u|=p,i.lanes=u,je(a,u)}}var Xo={readContext:Cn,use:Pc,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useLayoutEffect:Kt,useInsertionEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useSyncExternalStore:Kt,useId:Kt,useHostTransitionStatus:Kt,useFormState:Kt,useActionState:Kt,useOptimistic:Kt,useMemoCache:Kt,useCacheRefresh:Kt};Xo.useEffectEvent=Kt;var Db={readContext:Cn,use:Pc,useCallback:function(a,i){return Mn().memoizedState=[a,i===void 0?null:i],a},useContext:Cn,useEffect:yb,useImperativeHandle:function(a,i,u){u=u!=null?u.concat([a]):null,Bc(4194308,4,kb.bind(null,i,a),u)},useLayoutEffect:function(a,i){return Bc(4194308,4,a,i)},useInsertionEffect:function(a,i){Bc(4,2,a,i)},useMemo:function(a,i){var u=Mn();i=i===void 0?null:i;var p=a();if(Ui){tt(!0);try{a()}finally{tt(!1)}}return u.memoizedState=[p,i],p},useReducer:function(a,i,u){var p=Mn();if(u!==void 0){var y=u(i);if(Ui){tt(!0);try{u(i)}finally{tt(!1)}}}else y=i;return p.memoizedState=p.baseState=y,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:y},p.queue=a,a=a.dispatch=bA.bind(null,Xe,a),[p.memoizedState,a]},useRef:function(a){var i=Mn();return a={current:a},i.memoizedState=a},useState:function(a){a=rf(a);var i=a.queue,u=Ob.bind(null,Xe,i);return i.dispatch=u,[a.memoizedState,u]},useDebugValue:lf,useDeferredValue:function(a,i){var u=Mn();return cf(u,a,i)},useTransition:function(){var a=rf(!1);return a=Eb.bind(null,Xe,a.queue,!0,!1),Mn().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,i,u){var p=Xe,y=Mn();if(ct){if(u===void 0)throw Error(r(407));u=u()}else{if(u=i(),At===null)throw Error(r(349));(st&127)!==0||nb(p,i,u)}y.memoizedState=u;var x={value:u,getSnapshot:i};return y.queue=x,yb(rb.bind(null,p,x,a),[a]),p.flags|=2048,Ps(9,{destroy:void 0},ab.bind(null,p,x,u,i),null),u},useId:function(){var a=Mn(),i=At.identifierPrefix;if(ct){var u=Za,p=Wa;u=(p&~(1<<32-Ee(p)-1)).toString(32)+u,i="_"+i+"R_"+u,u=zc++,0<u&&(i+="H"+u.toString(32)),i+="_"}else u=pA++,i="_"+i+"r_"+u.toString(32)+"_";return a.memoizedState=i},useHostTransitionStatus:df,useFormState:fb,useActionState:fb,useOptimistic:function(a){var i=Mn();i.memoizedState=i.baseState=a;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=u,i=pf.bind(null,Xe,!0,u),u.dispatch=i,[a,i]},useMemoCache:tf,useCacheRefresh:function(){return Mn().memoizedState=yA.bind(null,Xe)},useEffectEvent:function(a){var i=Mn(),u={impl:a};return i.memoizedState=u,function(){if((bt&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},ff={readContext:Cn,use:Pc,useCallback:jb,useContext:Cn,useEffect:of,useImperativeHandle:Sb,useInsertionEffect:xb,useLayoutEffect:wb,useMemo:Cb,useReducer:Uc,useRef:vb,useState:function(){return Uc(wr)},useDebugValue:lf,useDeferredValue:function(a,i){var u=en();return Nb(u,jt.memoizedState,a,i)},useTransition:function(){var a=Uc(wr)[0],i=en().memoizedState;return[typeof a=="boolean"?a:Yo(a),i]},useSyncExternalStore:tb,useId:Rb,useHostTransitionStatus:df,useFormState:hb,useActionState:hb,useOptimistic:function(a,i){var u=en();return ob(u,jt,a,i)},useMemoCache:tf,useCacheRefresh:_b};ff.useEffectEvent=bb;var Ib={readContext:Cn,use:Pc,useCallback:jb,useContext:Cn,useEffect:of,useImperativeHandle:Sb,useInsertionEffect:xb,useLayoutEffect:wb,useMemo:Cb,useReducer:af,useRef:vb,useState:function(){return af(wr)},useDebugValue:lf,useDeferredValue:function(a,i){var u=en();return jt===null?cf(u,a,i):Nb(u,jt.memoizedState,a,i)},useTransition:function(){var a=af(wr)[0],i=en().memoizedState;return[typeof a=="boolean"?a:Yo(a),i]},useSyncExternalStore:tb,useId:Rb,useHostTransitionStatus:df,useFormState:gb,useActionState:gb,useOptimistic:function(a,i){var u=en();return jt!==null?ob(u,jt,a,i):(u.baseState=a,[a,u.queue.dispatch])},useMemoCache:tf,useCacheRefresh:_b};Ib.useEffectEvent=bb;function hf(a,i,u,p){i=a.memoizedState,u=u(p,i),u=u==null?i:m({},i,u),a.memoizedState=u,a.lanes===0&&(a.updateQueue.baseState=u)}var mf={enqueueSetState:function(a,i,u){a=a._reactInternals;var p=ia(),y=Jr(p);y.payload=i,u!=null&&(y.callback=u),i=ei(a,y,p),i!==null&&(Vn(i,a,p),Vo(i,a,p))},enqueueReplaceState:function(a,i,u){a=a._reactInternals;var p=ia(),y=Jr(p);y.tag=1,y.payload=i,u!=null&&(y.callback=u),i=ei(a,y,p),i!==null&&(Vn(i,a,p),Vo(i,a,p))},enqueueForceUpdate:function(a,i){a=a._reactInternals;var u=ia(),p=Jr(u);p.tag=2,i!=null&&(p.callback=i),i=ei(a,p,u),i!==null&&(Vn(i,a,u),Vo(i,a,u))}};function zb(a,i,u,p,y,x,A){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(p,x,A):i.prototype&&i.prototype.isPureReactComponent?!$o(u,p)||!$o(y,x):!0}function $b(a,i,u,p){a=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(u,p),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(u,p),i.state!==a&&mf.enqueueReplaceState(i,i.state,null)}function Bi(a,i){var u=i;if("ref"in i){u={};for(var p in i)p!=="ref"&&(u[p]=i[p])}if(a=a.defaultProps){u===i&&(u=m({},u));for(var y in a)u[y]===void 0&&(u[y]=a[y])}return u}function Pb(a){wc(a)}function Ub(a){console.error(a)}function Bb(a){wc(a)}function qc(a,i){try{var u=a.onUncaughtError;u(i.value,{componentStack:i.stack})}catch(p){setTimeout(function(){throw p})}}function Fb(a,i,u){try{var p=a.onCaughtError;p(u.value,{componentStack:u.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function gf(a,i,u){return u=Jr(u),u.tag=3,u.payload={element:null},u.callback=function(){qc(a,i)},u}function Hb(a){return a=Jr(a),a.tag=3,a}function qb(a,i,u,p){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var x=p.value;a.payload=function(){return y(x)},a.callback=function(){Fb(i,u,p)}}var A=u.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(a.callback=function(){Fb(i,u,p),typeof y!="function"&&(si===null?si=new Set([this]):si.add(this));var P=p.stack;this.componentDidCatch(p.value,{componentStack:P!==null?P:""})})}function xA(a,i,u,p,y){if(u.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(i=u.alternate,i!==null&&_s(i,u,y,!0),u=ta.current,u!==null){switch(u.tag){case 31:case 13:return ja===null?nu():u.alternate===null&&Yt===0&&(Yt=3),u.flags&=-257,u.flags|=65536,u.lanes=y,p===_c?u.flags|=16384:(i=u.updateQueue,i===null?u.updateQueue=new Set([p]):i.add(p),Bf(a,p,y)),!1;case 22:return u.flags|=65536,p===_c?u.flags|=16384:(i=u.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([p])},u.updateQueue=i):(u=i.retryQueue,u===null?i.retryQueue=new Set([p]):u.add(p)),Bf(a,p,y)),!1}throw Error(r(435,u.tag))}return Bf(a,p,y),nu(),!1}if(ct)return i=ta.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=y,p!==Lp&&(a=Error(r(422),{cause:p}),Bo(xa(a,u)))):(p!==Lp&&(i=Error(r(423),{cause:p}),Bo(xa(i,u))),a=a.current.alternate,a.flags|=65536,y&=-y,a.lanes|=y,p=xa(p,u),y=gf(a.stateNode,p,y),Gp(a,y),Yt!==4&&(Yt=2)),!1;var x=Error(r(520),{cause:p});if(x=xa(x,u),sl===null?sl=[x]:sl.push(x),Yt!==4&&(Yt=2),i===null)return!0;p=xa(p,u),u=i;do{switch(u.tag){case 3:return u.flags|=65536,a=y&-y,u.lanes|=a,a=gf(u.stateNode,p,a),Gp(u,a),!1;case 1:if(i=u.type,x=u.stateNode,(u.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(si===null||!si.has(x))))return u.flags|=65536,y&=-y,u.lanes|=y,y=Hb(y),qb(y,a,u,p),Gp(u,y),!1}u=u.return}while(u!==null);return!1}var vf=Error(r(461)),sn=!1;function Nn(a,i,u,p){i.child=a===null?Zy(i,null,u,p):Pi(i,a.child,u,p)}function Gb(a,i,u,p,y){u=u.render;var x=i.ref;if("ref"in p){var A={};for(var P in p)P!=="ref"&&(A[P]=p[P])}else A=p;return Di(i),p=Qp(a,i,u,A,x,y),P=Xp(),a!==null&&!sn?(Jp(a,i,y),kr(a,i,y)):(ct&&P&&Op(i),i.flags|=1,Nn(a,i,p,y),i.child)}function Vb(a,i,u,p,y){if(a===null){var x=u.type;return typeof x=="function"&&!Tp(x)&&x.defaultProps===void 0&&u.compare===null?(i.tag=15,i.type=x,Wb(a,i,x,p,y)):(a=Cc(u.type,null,p,i,i.mode,y),a.ref=i.ref,a.return=i,i.child=a)}if(x=a.child,!Cf(a,y)){var A=x.memoizedProps;if(u=u.compare,u=u!==null?u:$o,u(A,p)&&a.ref===i.ref)return kr(a,i,y)}return i.flags|=1,a=gr(x,p),a.ref=i.ref,a.return=i,i.child=a}function Wb(a,i,u,p,y){if(a!==null){var x=a.memoizedProps;if($o(x,p)&&a.ref===i.ref)if(sn=!1,i.pendingProps=p=x,Cf(a,y))(a.flags&131072)!==0&&(sn=!0);else return i.lanes=a.lanes,kr(a,i,y)}return yf(a,i,u,p,y)}function Zb(a,i,u,p){var y=p.children,x=a!==null?a.memoizedState:null;if(a===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((i.flags&128)!==0){if(x=x!==null?x.baseLanes|u:u,a!==null){for(p=i.child=a.child,y=0;p!==null;)y=y|p.lanes|p.childLanes,p=p.sibling;p=y&~x}else p=0,i.child=null;return Kb(a,i,x,u,p)}if((u&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},a!==null&&Tc(i,x!==null?x.cachePool:null),x!==null?Qy(i,x):Wp(),Xy(i);else return p=i.lanes=536870912,Kb(a,i,x!==null?x.baseLanes|u:u,u,p)}else x!==null?(Tc(i,x.cachePool),Qy(i,x),ni(),i.memoizedState=null):(a!==null&&Tc(i,null),Wp(),ni());return Nn(a,i,y,u),i.child}function Jo(a,i){return a!==null&&a.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function Kb(a,i,u,p,y){var x=Bp();return x=x===null?null:{parent:an._currentValue,pool:x},i.memoizedState={baseLanes:u,cachePool:x},a!==null&&Tc(i,null),Wp(),Xy(i),a!==null&&_s(a,i,p,!0),i.childLanes=y,null}function Gc(a,i){return i=Wc({mode:i.mode,children:i.children},a.mode),i.ref=a.ref,a.child=i,i.return=a,i}function Yb(a,i,u){return Pi(i,a.child,null,u),a=Gc(i,i.pendingProps),a.flags|=2,na(i),i.memoizedState=null,a}function wA(a,i,u){var p=i.pendingProps,y=(i.flags&128)!==0;if(i.flags&=-129,a===null){if(ct){if(p.mode==="hidden")return a=Gc(i,p),i.lanes=536870912,Jo(null,a);if(Kp(i),(a=Dt)?(a=lx(a,Sa),a=a!==null&&a.data==="&"?a:null,a!==null&&(i.memoizedState={dehydrated:a,treeContext:Zr!==null?{id:Wa,overflow:Za}:null,retryLane:536870912,hydrationErrors:null},u=My(a),u.return=i,i.child=u,jn=i,Dt=null)):a=null,a===null)throw Yr(i);return i.lanes=536870912,null}return Gc(i,p)}var x=a.memoizedState;if(x!==null){var A=x.dehydrated;if(Kp(i),y)if(i.flags&256)i.flags&=-257,i=Yb(a,i,u);else if(i.memoizedState!==null)i.child=a.child,i.flags|=128,i=null;else throw Error(r(558));else if(sn||_s(a,i,u,!1),y=(u&a.childLanes)!==0,sn||y){if(p=At,p!==null&&(A=Ae(p,u),A!==0&&A!==x.retryLane))throw x.retryLane=A,_i(a,A),Vn(p,a,A),vf;nu(),i=Yb(a,i,u)}else a=x.treeContext,Dt=Ca(A.nextSibling),jn=i,ct=!0,Kr=null,Sa=!1,a!==null&&Iy(i,a),i=Gc(i,p),i.flags|=4096;return i}return a=gr(a.child,{mode:p.mode,children:p.children}),a.ref=i.ref,i.child=a,a.return=i,a}function Vc(a,i){var u=i.ref;if(u===null)a!==null&&a.ref!==null&&(i.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(a===null||a.ref!==u)&&(i.flags|=4194816)}}function yf(a,i,u,p,y){return Di(i),u=Qp(a,i,u,p,void 0,y),p=Xp(),a!==null&&!sn?(Jp(a,i,y),kr(a,i,y)):(ct&&p&&Op(i),i.flags|=1,Nn(a,i,u,y),i.child)}function Qb(a,i,u,p,y,x){return Di(i),i.updateQueue=null,u=eb(i,p,u,y),Jy(a),p=Xp(),a!==null&&!sn?(Jp(a,i,x),kr(a,i,x)):(ct&&p&&Op(i),i.flags|=1,Nn(a,i,u,x),i.child)}function Xb(a,i,u,p,y){if(Di(i),i.stateNode===null){var x=Es,A=u.contextType;typeof A=="object"&&A!==null&&(x=Cn(A)),x=new u(p,x),i.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=mf,i.stateNode=x,x._reactInternals=i,x=i.stateNode,x.props=p,x.state=i.memoizedState,x.refs={},Hp(i),A=u.contextType,x.context=typeof A=="object"&&A!==null?Cn(A):Es,x.state=i.memoizedState,A=u.getDerivedStateFromProps,typeof A=="function"&&(hf(i,u,A,p),x.state=i.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(A=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),A!==x.state&&mf.enqueueReplaceState(x,x.state,null),Zo(i,p,x,y),Wo(),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308),p=!0}else if(a===null){x=i.stateNode;var P=i.memoizedProps,Q=Bi(u,P);x.props=Q;var ae=x.context,de=u.contextType;A=Es,typeof de=="object"&&de!==null&&(A=Cn(de));var ge=u.getDerivedStateFromProps;de=typeof ge=="function"||typeof x.getSnapshotBeforeUpdate=="function",P=i.pendingProps!==P,de||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(P||ae!==A)&&$b(i,x,p,A),Xr=!1;var ie=i.memoizedState;x.state=ie,Zo(i,p,x,y),Wo(),ae=i.memoizedState,P||ie!==ae||Xr?(typeof ge=="function"&&(hf(i,u,ge,p),ae=i.memoizedState),(Q=Xr||zb(i,u,Q,p,ie,ae,A))?(de||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(i.flags|=4194308)):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=p,i.memoizedState=ae),x.props=p,x.state=ae,x.context=A,p=Q):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),p=!1)}else{x=i.stateNode,qp(a,i),A=i.memoizedProps,de=Bi(u,A),x.props=de,ge=i.pendingProps,ie=x.context,ae=u.contextType,Q=Es,typeof ae=="object"&&ae!==null&&(Q=Cn(ae)),P=u.getDerivedStateFromProps,(ae=typeof P=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(A!==ge||ie!==Q)&&$b(i,x,p,Q),Xr=!1,ie=i.memoizedState,x.state=ie,Zo(i,p,x,y),Wo();var le=i.memoizedState;A!==ge||ie!==le||Xr||a!==null&&a.dependencies!==null&&Ec(a.dependencies)?(typeof P=="function"&&(hf(i,u,P,p),le=i.memoizedState),(de=Xr||zb(i,u,de,p,ie,le,Q)||a!==null&&a.dependencies!==null&&Ec(a.dependencies))?(ae||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(p,le,Q),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(p,le,Q)),typeof x.componentDidUpdate=="function"&&(i.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof x.componentDidUpdate!="function"||A===a.memoizedProps&&ie===a.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||A===a.memoizedProps&&ie===a.memoizedState||(i.flags|=1024),i.memoizedProps=p,i.memoizedState=le),x.props=p,x.state=le,x.context=Q,p=de):(typeof x.componentDidUpdate!="function"||A===a.memoizedProps&&ie===a.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||A===a.memoizedProps&&ie===a.memoizedState||(i.flags|=1024),p=!1)}return x=p,Vc(a,i),p=(i.flags&128)!==0,x||p?(x=i.stateNode,u=p&&typeof u.getDerivedStateFromError!="function"?null:x.render(),i.flags|=1,a!==null&&p?(i.child=Pi(i,a.child,null,y),i.child=Pi(i,null,u,y)):Nn(a,i,u,y),i.memoizedState=x.state,a=i.child):a=kr(a,i,y),a}function Jb(a,i,u,p){return Mi(),i.flags|=256,Nn(a,i,u,p),i.child}var bf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xf(a){return{baseLanes:a,cachePool:Fy()}}function wf(a,i,u){return a=a!==null?a.childLanes&~u:0,i&&(a|=ra),a}function e0(a,i,u){var p=i.pendingProps,y=!1,x=(i.flags&128)!==0,A;if((A=x)||(A=a!==null&&a.memoizedState===null?!1:(Jt.current&2)!==0),A&&(y=!0,i.flags&=-129),A=(i.flags&32)!==0,i.flags&=-33,a===null){if(ct){if(y?ti(i):ni(),(a=Dt)?(a=lx(a,Sa),a=a!==null&&a.data!=="&"?a:null,a!==null&&(i.memoizedState={dehydrated:a,treeContext:Zr!==null?{id:Wa,overflow:Za}:null,retryLane:536870912,hydrationErrors:null},u=My(a),u.return=i,i.child=u,jn=i,Dt=null)):a=null,a===null)throw Yr(i);return ah(a)?i.lanes=32:i.lanes=536870912,null}var P=p.children;return p=p.fallback,y?(ni(),y=i.mode,P=Wc({mode:"hidden",children:P},y),p=Oi(p,y,u,null),P.return=i,p.return=i,P.sibling=p,i.child=P,p=i.child,p.memoizedState=xf(u),p.childLanes=wf(a,A,u),i.memoizedState=bf,Jo(null,p)):(ti(i),kf(i,P))}var Q=a.memoizedState;if(Q!==null&&(P=Q.dehydrated,P!==null)){if(x)i.flags&256?(ti(i),i.flags&=-257,i=Sf(a,i,u)):i.memoizedState!==null?(ni(),i.child=a.child,i.flags|=128,i=null):(ni(),P=p.fallback,y=i.mode,p=Wc({mode:"visible",children:p.children},y),P=Oi(P,y,u,null),P.flags|=2,p.return=i,P.return=i,p.sibling=P,i.child=p,Pi(i,a.child,null,u),p=i.child,p.memoizedState=xf(u),p.childLanes=wf(a,A,u),i.memoizedState=bf,i=Jo(null,p));else if(ti(i),ah(P)){if(A=P.nextSibling&&P.nextSibling.dataset,A)var ae=A.dgst;A=ae,p=Error(r(419)),p.stack="",p.digest=A,Bo({value:p,source:null,stack:null}),i=Sf(a,i,u)}else if(sn||_s(a,i,u,!1),A=(u&a.childLanes)!==0,sn||A){if(A=At,A!==null&&(p=Ae(A,u),p!==0&&p!==Q.retryLane))throw Q.retryLane=p,_i(a,p),Vn(A,a,p),vf;nh(P)||nu(),i=Sf(a,i,u)}else nh(P)?(i.flags|=192,i.child=a.child,i=null):(a=Q.treeContext,Dt=Ca(P.nextSibling),jn=i,ct=!0,Kr=null,Sa=!1,a!==null&&Iy(i,a),i=kf(i,p.children),i.flags|=4096);return i}return y?(ni(),P=p.fallback,y=i.mode,Q=a.child,ae=Q.sibling,p=gr(Q,{mode:"hidden",children:p.children}),p.subtreeFlags=Q.subtreeFlags&65011712,ae!==null?P=gr(ae,P):(P=Oi(P,y,u,null),P.flags|=2),P.return=i,p.return=i,p.sibling=P,i.child=p,Jo(null,p),p=i.child,P=a.child.memoizedState,P===null?P=xf(u):(y=P.cachePool,y!==null?(Q=an._currentValue,y=y.parent!==Q?{parent:Q,pool:Q}:y):y=Fy(),P={baseLanes:P.baseLanes|u,cachePool:y}),p.memoizedState=P,p.childLanes=wf(a,A,u),i.memoizedState=bf,Jo(a.child,p)):(ti(i),u=a.child,a=u.sibling,u=gr(u,{mode:"visible",children:p.children}),u.return=i,u.sibling=null,a!==null&&(A=i.deletions,A===null?(i.deletions=[a],i.flags|=16):A.push(a)),i.child=u,i.memoizedState=null,u)}function kf(a,i){return i=Wc({mode:"visible",children:i},a.mode),i.return=a,a.child=i}function Wc(a,i){return a=ea(22,a,null,i),a.lanes=0,a}function Sf(a,i,u){return Pi(i,a.child,null,u),a=kf(i,i.pendingProps.children),a.flags|=2,i.memoizedState=null,a}function t0(a,i,u){a.lanes|=i;var p=a.alternate;p!==null&&(p.lanes|=i),zp(a.return,i,u)}function jf(a,i,u,p,y,x){var A=a.memoizedState;A===null?a.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:p,tail:u,tailMode:y,treeForkCount:x}:(A.isBackwards=i,A.rendering=null,A.renderingStartTime=0,A.last=p,A.tail=u,A.tailMode=y,A.treeForkCount=x)}function n0(a,i,u){var p=i.pendingProps,y=p.revealOrder,x=p.tail;p=p.children;var A=Jt.current,P=(A&2)!==0;if(P?(A=A&1|2,i.flags|=128):A&=1,M(Jt,A),Nn(a,i,p,u),p=ct?Uo:0,!P&&a!==null&&(a.flags&128)!==0)e:for(a=i.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&t0(a,u,i);else if(a.tag===19)t0(a,u,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(y){case"forwards":for(u=i.child,y=null;u!==null;)a=u.alternate,a!==null&&Dc(a)===null&&(y=u),u=u.sibling;u=y,u===null?(y=i.child,i.child=null):(y=u.sibling,u.sibling=null),jf(i,!1,y,u,x,p);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=i.child,i.child=null;y!==null;){if(a=y.alternate,a!==null&&Dc(a)===null){i.child=y;break}a=y.sibling,y.sibling=u,u=y,y=a}jf(i,!0,u,null,x,p);break;case"together":jf(i,!1,null,null,void 0,p);break;default:i.memoizedState=null}return i.child}function kr(a,i,u){if(a!==null&&(i.dependencies=a.dependencies),ii|=i.lanes,(u&i.childLanes)===0)if(a!==null){if(_s(a,i,u,!1),(u&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,u=gr(a,a.pendingProps),i.child=u,u.return=i;a.sibling!==null;)a=a.sibling,u=u.sibling=gr(a,a.pendingProps),u.return=i;u.sibling=null}return i.child}function Cf(a,i){return(a.lanes&i)!==0?!0:(a=a.dependencies,!!(a!==null&&Ec(a)))}function kA(a,i,u){switch(i.tag){case 3:Re(i,i.stateNode.containerInfo),Qr(i,an,a.memoizedState.cache),Mi();break;case 27:case 5:De(i);break;case 4:Re(i,i.stateNode.containerInfo);break;case 10:Qr(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Kp(i),null;break;case 13:var p=i.memoizedState;if(p!==null)return p.dehydrated!==null?(ti(i),i.flags|=128,null):(u&i.child.childLanes)!==0?e0(a,i,u):(ti(i),a=kr(a,i,u),a!==null?a.sibling:null);ti(i);break;case 19:var y=(a.flags&128)!==0;if(p=(u&i.childLanes)!==0,p||(_s(a,i,u,!1),p=(u&i.childLanes)!==0),y){if(p)return n0(a,i,u);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),M(Jt,Jt.current),p)break;return null;case 22:return i.lanes=0,Zb(a,i,u,i.pendingProps);case 24:Qr(i,an,a.memoizedState.cache)}return kr(a,i,u)}function a0(a,i,u){if(a!==null)if(a.memoizedProps!==i.pendingProps)sn=!0;else{if(!Cf(a,u)&&(i.flags&128)===0)return sn=!1,kA(a,i,u);sn=(a.flags&131072)!==0}else sn=!1,ct&&(i.flags&1048576)!==0&&Dy(i,Uo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var p=i.pendingProps;if(a=zi(i.elementType),i.type=a,typeof a=="function")Tp(a)?(p=Bi(a,p),i.tag=1,i=Xb(null,i,a,p,u)):(i.tag=0,i=yf(null,i,a,p,u));else{if(a!=null){var y=a.$$typeof;if(y===T){i.tag=11,i=Gb(null,i,a,p,u);break e}else if(y===L){i.tag=14,i=Vb(null,i,a,p,u);break e}}throw i=z(a)||a,Error(r(306,i,""))}}return i;case 0:return yf(a,i,i.type,i.pendingProps,u);case 1:return p=i.type,y=Bi(p,i.pendingProps),Xb(a,i,p,y,u);case 3:e:{if(Re(i,i.stateNode.containerInfo),a===null)throw Error(r(387));p=i.pendingProps;var x=i.memoizedState;y=x.element,qp(a,i),Zo(i,p,null,u);var A=i.memoizedState;if(p=A.cache,Qr(i,an,p),p!==x.cache&&$p(i,[an],u,!0),Wo(),p=A.element,x.isDehydrated)if(x={element:p,isDehydrated:!1,cache:A.cache},i.updateQueue.baseState=x,i.memoizedState=x,i.flags&256){i=Jb(a,i,p,u);break e}else if(p!==y){y=xa(Error(r(424)),i),Bo(y),i=Jb(a,i,p,u);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(Dt=Ca(a.firstChild),jn=i,ct=!0,Kr=null,Sa=!0,u=Zy(i,null,p,u),i.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Mi(),p===y){i=kr(a,i,u);break e}Nn(a,i,p,u)}i=i.child}return i;case 26:return Vc(a,i),a===null?(u=hx(i.type,null,i.pendingProps,null))?i.memoizedState=u:ct||(u=i.type,a=i.pendingProps,p=cu(oe.current).createElement(u),p[Vt]=i,p[vn]=a,En(p,u,a),Ot(p),i.stateNode=p):i.memoizedState=hx(i.type,a.memoizedProps,i.pendingProps,a.memoizedState),null;case 27:return De(i),a===null&&ct&&(p=i.stateNode=dx(i.type,i.pendingProps,oe.current),jn=i,Sa=!0,y=Dt,ui(i.type)?(rh=y,Dt=Ca(p.firstChild)):Dt=y),Nn(a,i,i.pendingProps.children,u),Vc(a,i),a===null&&(i.flags|=4194304),i.child;case 5:return a===null&&ct&&((y=p=Dt)&&(p=XA(p,i.type,i.pendingProps,Sa),p!==null?(i.stateNode=p,jn=i,Dt=Ca(p.firstChild),Sa=!1,y=!0):y=!1),y||Yr(i)),De(i),y=i.type,x=i.pendingProps,A=a!==null?a.memoizedProps:null,p=x.children,Jf(y,x)?p=null:A!==null&&Jf(y,A)&&(i.flags|=32),i.memoizedState!==null&&(y=Qp(a,i,fA,null,null,u),hl._currentValue=y),Vc(a,i),Nn(a,i,p,u),i.child;case 6:return a===null&&ct&&((a=u=Dt)&&(u=JA(u,i.pendingProps,Sa),u!==null?(i.stateNode=u,jn=i,Dt=null,a=!0):a=!1),a||Yr(i)),null;case 13:return e0(a,i,u);case 4:return Re(i,i.stateNode.containerInfo),p=i.pendingProps,a===null?i.child=Pi(i,null,p,u):Nn(a,i,p,u),i.child;case 11:return Gb(a,i,i.type,i.pendingProps,u);case 7:return Nn(a,i,i.pendingProps,u),i.child;case 8:return Nn(a,i,i.pendingProps.children,u),i.child;case 12:return Nn(a,i,i.pendingProps.children,u),i.child;case 10:return p=i.pendingProps,Qr(i,i.type,p.value),Nn(a,i,p.children,u),i.child;case 9:return y=i.type._context,p=i.pendingProps.children,Di(i),y=Cn(y),p=p(y),i.flags|=1,Nn(a,i,p,u),i.child;case 14:return Vb(a,i,i.type,i.pendingProps,u);case 15:return Wb(a,i,i.type,i.pendingProps,u);case 19:return n0(a,i,u);case 31:return wA(a,i,u);case 22:return Zb(a,i,u,i.pendingProps);case 24:return Di(i),p=Cn(an),a===null?(y=Bp(),y===null&&(y=At,x=Pp(),y.pooledCache=x,x.refCount++,x!==null&&(y.pooledCacheLanes|=u),y=x),i.memoizedState={parent:p,cache:y},Hp(i),Qr(i,an,y)):((a.lanes&u)!==0&&(qp(a,i),Zo(i,null,null,u),Wo()),y=a.memoizedState,x=i.memoizedState,y.parent!==p?(y={parent:p,cache:p},i.memoizedState=y,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=y),Qr(i,an,p)):(p=x.cache,Qr(i,an,p),p!==y.cache&&$p(i,[an],u,!0))),Nn(a,i,i.pendingProps.children,u),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function Sr(a){a.flags|=4}function Nf(a,i,u,p,y){if((i=(a.mode&32)!==0)&&(i=!1),i){if(a.flags|=16777216,(y&335544128)===y)if(a.stateNode.complete)a.flags|=8192;else if(R0())a.flags|=8192;else throw $i=_c,Fp}else a.flags&=-16777217}function r0(a,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!bx(i))if(R0())a.flags|=8192;else throw $i=_c,Fp}function Zc(a,i){i!==null&&(a.flags|=4),a.flags&16384&&(i=a.tag!==22?Hr():536870912,a.lanes|=i,Hs|=i)}function el(a,i){if(!ct)switch(a.tailMode){case"hidden":i=a.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?a.tail=null:u.sibling=null;break;case"collapsed":u=a.tail;for(var p=null;u!==null;)u.alternate!==null&&(p=u),u=u.sibling;p===null?i||a.tail===null?a.tail=null:a.tail.sibling=null:p.sibling=null}}function It(a){var i=a.alternate!==null&&a.alternate.child===a.child,u=0,p=0;if(i)for(var y=a.child;y!==null;)u|=y.lanes|y.childLanes,p|=y.subtreeFlags&65011712,p|=y.flags&65011712,y.return=a,y=y.sibling;else for(y=a.child;y!==null;)u|=y.lanes|y.childLanes,p|=y.subtreeFlags,p|=y.flags,y.return=a,y=y.sibling;return a.subtreeFlags|=p,a.childLanes=u,i}function SA(a,i,u){var p=i.pendingProps;switch(Mp(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return It(i),null;case 1:return It(i),null;case 3:return u=i.stateNode,p=null,a!==null&&(p=a.memoizedState.cache),i.memoizedState.cache!==p&&(i.flags|=2048),br(an),Ne(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(a===null||a.child===null)&&(Rs(i)?Sr(i):a===null||a.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Dp())),It(i),null;case 26:var y=i.type,x=i.memoizedState;return a===null?(Sr(i),x!==null?(It(i),r0(i,x)):(It(i),Nf(i,y,null,p,u))):x?x!==a.memoizedState?(Sr(i),It(i),r0(i,x)):(It(i),i.flags&=-16777217):(a=a.memoizedProps,a!==p&&Sr(i),It(i),Nf(i,y,a,p,u)),null;case 27:if(We(i),u=oe.current,y=i.type,a!==null&&i.stateNode!=null)a.memoizedProps!==p&&Sr(i);else{if(!p){if(i.stateNode===null)throw Error(r(166));return It(i),null}a=ee.current,Rs(i)?zy(i):(a=dx(y,p,u),i.stateNode=a,Sr(i))}return It(i),null;case 5:if(We(i),y=i.type,a!==null&&i.stateNode!=null)a.memoizedProps!==p&&Sr(i);else{if(!p){if(i.stateNode===null)throw Error(r(166));return It(i),null}if(x=ee.current,Rs(i))zy(i);else{var A=cu(oe.current);switch(x){case 1:x=A.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:x=A.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":x=A.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":x=A.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":x=A.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof p.is=="string"?A.createElement("select",{is:p.is}):A.createElement("select"),p.multiple?x.multiple=!0:p.size&&(x.size=p.size);break;default:x=typeof p.is=="string"?A.createElement(y,{is:p.is}):A.createElement(y)}}x[Vt]=i,x[vn]=p;e:for(A=i.child;A!==null;){if(A.tag===5||A.tag===6)x.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&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}i.stateNode=x;e:switch(En(x,y,p),y){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&Sr(i)}}return It(i),Nf(i,i.type,a===null?null:a.memoizedProps,i.pendingProps,u),null;case 6:if(a&&i.stateNode!=null)a.memoizedProps!==p&&Sr(i);else{if(typeof p!="string"&&i.stateNode===null)throw Error(r(166));if(a=oe.current,Rs(i)){if(a=i.stateNode,u=i.memoizedProps,p=null,y=jn,y!==null)switch(y.tag){case 27:case 5:p=y.memoizedProps}a[Vt]=i,a=!!(a.nodeValue===u||p!==null&&p.suppressHydrationWarning===!0||ex(a.nodeValue,u)),a||Yr(i,!0)}else a=cu(a).createTextNode(p),a[Vt]=i,i.stateNode=a}return It(i),null;case 31:if(u=i.memoizedState,a===null||a.memoizedState!==null){if(p=Rs(i),u!==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[Vt]=i}else Mi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;It(i),a=!1}else u=Dp(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=u),a=!0;if(!a)return i.flags&256?(na(i),i):(na(i),null);if((i.flags&128)!==0)throw Error(r(558))}return It(i),null;case 13:if(p=i.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(y=Rs(i),p!==null&&p.dehydrated!==null){if(a===null){if(!y)throw Error(r(318));if(y=i.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Vt]=i}else Mi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;It(i),y=!1}else y=Dp(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=y),y=!0;if(!y)return i.flags&256?(na(i),i):(na(i),null)}return na(i),(i.flags&128)!==0?(i.lanes=u,i):(u=p!==null,a=a!==null&&a.memoizedState!==null,u&&(p=i.child,y=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(y=p.alternate.memoizedState.cachePool.pool),x=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(x=p.memoizedState.cachePool.pool),x!==y&&(p.flags|=2048)),u!==a&&u&&(i.child.flags|=8192),Zc(i,i.updateQueue),It(i),null);case 4:return Ne(),a===null&&Zf(i.stateNode.containerInfo),It(i),null;case 10:return br(i.type),It(i),null;case 19:if(G(Jt),p=i.memoizedState,p===null)return It(i),null;if(y=(i.flags&128)!==0,x=p.rendering,x===null)if(y)el(p,!1);else{if(Yt!==0||a!==null&&(a.flags&128)!==0)for(a=i.child;a!==null;){if(x=Dc(a),x!==null){for(i.flags|=128,el(p,!1),a=x.updateQueue,i.updateQueue=a,Zc(i,a),i.subtreeFlags=0,a=u,u=i.child;u!==null;)Oy(u,a),u=u.sibling;return M(Jt,Jt.current&1|2),ct&&vr(i,p.treeForkCount),i.child}a=a.sibling}p.tail!==null&&ut()>Jc&&(i.flags|=128,y=!0,el(p,!1),i.lanes=4194304)}else{if(!y)if(a=Dc(x),a!==null){if(i.flags|=128,y=!0,a=a.updateQueue,i.updateQueue=a,Zc(i,a),el(p,!0),p.tail===null&&p.tailMode==="hidden"&&!x.alternate&&!ct)return It(i),null}else 2*ut()-p.renderingStartTime>Jc&&u!==536870912&&(i.flags|=128,y=!0,el(p,!1),i.lanes=4194304);p.isBackwards?(x.sibling=i.child,i.child=x):(a=p.last,a!==null?a.sibling=x:i.child=x,p.last=x)}return p.tail!==null?(a=p.tail,p.rendering=a,p.tail=a.sibling,p.renderingStartTime=ut(),a.sibling=null,u=Jt.current,M(Jt,y?u&1|2:u&1),ct&&vr(i,p.treeForkCount),a):(It(i),null);case 22:case 23:return na(i),Zp(),p=i.memoizedState!==null,a!==null?a.memoizedState!==null!==p&&(i.flags|=8192):p&&(i.flags|=8192),p?(u&536870912)!==0&&(i.flags&128)===0&&(It(i),i.subtreeFlags&6&&(i.flags|=8192)):It(i),u=i.updateQueue,u!==null&&Zc(i,u.retryQueue),u=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),p=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(p=i.memoizedState.cachePool.pool),p!==u&&(i.flags|=2048),a!==null&&G(Ii),null;case 24:return u=null,a!==null&&(u=a.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),br(an),It(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function jA(a,i){switch(Mp(i),i.tag){case 1:return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 3:return br(an),Ne(),a=i.flags,(a&65536)!==0&&(a&128)===0?(i.flags=a&-65537|128,i):null;case 26:case 27:case 5:return We(i),null;case 31:if(i.memoizedState!==null){if(na(i),i.alternate===null)throw Error(r(340));Mi()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 13:if(na(i),a=i.memoizedState,a!==null&&a.dehydrated!==null){if(i.alternate===null)throw Error(r(340));Mi()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 19:return G(Jt),null;case 4:return Ne(),null;case 10:return br(i.type),null;case 22:case 23:return na(i),Zp(),a!==null&&G(Ii),a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 24:return br(an),null;case 25:return null;default:return null}}function i0(a,i){switch(Mp(i),i.tag){case 3:br(an),Ne();break;case 26:case 27:case 5:We(i);break;case 4:Ne();break;case 31:i.memoizedState!==null&&na(i);break;case 13:na(i);break;case 19:G(Jt);break;case 10:br(i.type);break;case 22:case 23:na(i),Zp(),a!==null&&G(Ii);break;case 24:br(an)}}function tl(a,i){try{var u=i.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var y=p.next;u=y;do{if((u.tag&a)===a){p=void 0;var x=u.create,A=u.inst;p=x(),A.destroy=p}u=u.next}while(u!==y)}}catch(P){St(i,i.return,P)}}function ai(a,i,u){try{var p=i.updateQueue,y=p!==null?p.lastEffect:null;if(y!==null){var x=y.next;p=x;do{if((p.tag&a)===a){var A=p.inst,P=A.destroy;if(P!==void 0){A.destroy=void 0,y=i;var Q=u,ae=P;try{ae()}catch(de){St(y,Q,de)}}}p=p.next}while(p!==x)}}catch(de){St(i,i.return,de)}}function s0(a){var i=a.updateQueue;if(i!==null){var u=a.stateNode;try{Yy(i,u)}catch(p){St(a,a.return,p)}}}function o0(a,i,u){u.props=Bi(a.type,a.memoizedProps),u.state=a.memoizedState;try{u.componentWillUnmount()}catch(p){St(a,i,p)}}function nl(a,i){try{var u=a.ref;if(u!==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 u=="function"?a.refCleanup=u(p):u.current=p}}catch(y){St(a,i,y)}}function Ka(a,i){var u=a.ref,p=a.refCleanup;if(u!==null)if(typeof p=="function")try{p()}catch(y){St(a,i,y)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){St(a,i,y)}else u.current=null}function l0(a){var i=a.type,u=a.memoizedProps,p=a.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":u.autoFocus&&p.focus();break e;case"img":u.src?p.src=u.src:u.srcSet&&(p.srcset=u.srcSet)}}catch(y){St(a,a.return,y)}}function Ef(a,i,u){try{var p=a.stateNode;VA(p,a.type,u,i),p[vn]=i}catch(y){St(a,a.return,y)}}function c0(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&ui(a.type)||a.tag===4}function Af(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||c0(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&&ui(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 Tf(a,i,u){var p=a.tag;if(p===5||p===6)a=a.stateNode,i?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(a,i):(i=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,i.appendChild(a),u=u._reactRootContainer,u!=null||i.onclick!==null||(i.onclick=hr));else if(p!==4&&(p===27&&ui(a.type)&&(u=a.stateNode,i=null),a=a.child,a!==null))for(Tf(a,i,u),a=a.sibling;a!==null;)Tf(a,i,u),a=a.sibling}function Kc(a,i,u){var p=a.tag;if(p===5||p===6)a=a.stateNode,i?u.insertBefore(a,i):u.appendChild(a);else if(p!==4&&(p===27&&ui(a.type)&&(u=a.stateNode),a=a.child,a!==null))for(Kc(a,i,u),a=a.sibling;a!==null;)Kc(a,i,u),a=a.sibling}function u0(a){var i=a.stateNode,u=a.memoizedProps;try{for(var p=a.type,y=i.attributes;y.length;)i.removeAttributeNode(y[0]);En(i,p,u),i[Vt]=a,i[vn]=u}catch(x){St(a,a.return,x)}}var jr=!1,on=!1,Rf=!1,d0=typeof WeakSet=="function"?WeakSet:Set,yn=null;function CA(a,i){if(a=a.containerInfo,Qf=gu,a=Sy(a),kp(a)){if("selectionStart"in a)var u={start:a.selectionStart,end:a.selectionEnd};else e:{u=(u=a.ownerDocument)&&u.defaultView||window;var p=u.getSelection&&u.getSelection();if(p&&p.rangeCount!==0){u=p.anchorNode;var y=p.anchorOffset,x=p.focusNode;p=p.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var A=0,P=-1,Q=-1,ae=0,de=0,ge=a,ie=null;t:for(;;){for(var le;ge!==u||y!==0&&ge.nodeType!==3||(P=A+y),ge!==x||p!==0&&ge.nodeType!==3||(Q=A+p),ge.nodeType===3&&(A+=ge.nodeValue.length),(le=ge.firstChild)!==null;)ie=ge,ge=le;for(;;){if(ge===a)break t;if(ie===u&&++ae===y&&(P=A),ie===x&&++de===p&&(Q=A),(le=ge.nextSibling)!==null)break;ge=ie,ie=ge.parentNode}ge=le}u=P===-1||Q===-1?null:{start:P,end:Q}}else u=null}u=u||{start:0,end:0}}else u=null;for(Xf={focusedElem:a,selectionRange:u},gu=!1,yn=i;yn!==null;)if(i=yn,a=i.child,(i.subtreeFlags&1028)!==0&&a!==null)a.return=i,yn=a;else for(;yn!==null;){switch(i=yn,x=i.alternate,a=i.flags,i.tag){case 0:if((a&4)!==0&&(a=i.updateQueue,a=a!==null?a.events:null,a!==null))for(u=0;u<a.length;u++)y=a[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&x!==null){a=void 0,u=i,y=x.memoizedProps,x=x.memoizedState,p=u.stateNode;try{var Te=Bi(u.type,y);a=p.getSnapshotBeforeUpdate(Te,x),p.__reactInternalSnapshotBeforeUpdate=a}catch(Be){St(u,u.return,Be)}}break;case 3:if((a&1024)!==0){if(a=i.stateNode.containerInfo,u=a.nodeType,u===9)th(a);else if(u===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":th(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,yn=a;break}yn=i.return}}function p0(a,i,u){var p=u.flags;switch(u.tag){case 0:case 11:case 15:Nr(a,u),p&4&&tl(5,u);break;case 1:if(Nr(a,u),p&4)if(a=u.stateNode,i===null)try{a.componentDidMount()}catch(A){St(u,u.return,A)}else{var y=Bi(u.type,i.memoizedProps);i=i.memoizedState;try{a.componentDidUpdate(y,i,a.__reactInternalSnapshotBeforeUpdate)}catch(A){St(u,u.return,A)}}p&64&&s0(u),p&512&&nl(u,u.return);break;case 3:if(Nr(a,u),p&64&&(a=u.updateQueue,a!==null)){if(i=null,u.child!==null)switch(u.child.tag){case 27:case 5:i=u.child.stateNode;break;case 1:i=u.child.stateNode}try{Yy(a,i)}catch(A){St(u,u.return,A)}}break;case 27:i===null&&p&4&&u0(u);case 26:case 5:Nr(a,u),i===null&&p&4&&l0(u),p&512&&nl(u,u.return);break;case 12:Nr(a,u);break;case 31:Nr(a,u),p&4&&m0(a,u);break;case 13:Nr(a,u),p&4&&g0(a,u),p&64&&(a=u.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(u=LA.bind(null,u),eT(a,u))));break;case 22:if(p=u.memoizedState!==null||jr,!p){i=i!==null&&i.memoizedState!==null||on,y=jr;var x=on;jr=p,(on=i)&&!x?Er(a,u,(u.subtreeFlags&8772)!==0):Nr(a,u),jr=y,on=x}break;case 30:break;default:Nr(a,u)}}function f0(a){var i=a.alternate;i!==null&&(a.alternate=null,f0(i)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(i=a.stateNode,i!==null&&Xn(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 Pt=null,Fn=!1;function Cr(a,i,u){for(u=u.child;u!==null;)h0(a,i,u),u=u.sibling}function h0(a,i,u){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(Ce,u)}catch{}switch(u.tag){case 26:on||Ka(u,i),Cr(a,i,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:on||Ka(u,i);var p=Pt,y=Fn;ui(u.type)&&(Pt=u.stateNode,Fn=!1),Cr(a,i,u),dl(u.stateNode),Pt=p,Fn=y;break;case 5:on||Ka(u,i);case 6:if(p=Pt,y=Fn,Pt=null,Cr(a,i,u),Pt=p,Fn=y,Pt!==null)if(Fn)try{(Pt.nodeType===9?Pt.body:Pt.nodeName==="HTML"?Pt.ownerDocument.body:Pt).removeChild(u.stateNode)}catch(x){St(u,i,x)}else try{Pt.removeChild(u.stateNode)}catch(x){St(u,i,x)}break;case 18:Pt!==null&&(Fn?(a=Pt,sx(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,u.stateNode),Qs(a)):sx(Pt,u.stateNode));break;case 4:p=Pt,y=Fn,Pt=u.stateNode.containerInfo,Fn=!0,Cr(a,i,u),Pt=p,Fn=y;break;case 0:case 11:case 14:case 15:ai(2,u,i),on||ai(4,u,i),Cr(a,i,u);break;case 1:on||(Ka(u,i),p=u.stateNode,typeof p.componentWillUnmount=="function"&&o0(u,i,p)),Cr(a,i,u);break;case 21:Cr(a,i,u);break;case 22:on=(p=on)||u.memoizedState!==null,Cr(a,i,u),on=p;break;default:Cr(a,i,u)}}function m0(a,i){if(i.memoizedState===null&&(a=i.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{Qs(a)}catch(u){St(i,i.return,u)}}}function g0(a,i){if(i.memoizedState===null&&(a=i.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{Qs(a)}catch(u){St(i,i.return,u)}}function NA(a){switch(a.tag){case 31:case 13:case 19:var i=a.stateNode;return i===null&&(i=a.stateNode=new d0),i;case 22:return a=a.stateNode,i=a._retryCache,i===null&&(i=a._retryCache=new d0),i;default:throw Error(r(435,a.tag))}}function Yc(a,i){var u=NA(a);i.forEach(function(p){if(!u.has(p)){u.add(p);var y=DA.bind(null,a,p);p.then(y,y)}})}function Hn(a,i){var u=i.deletions;if(u!==null)for(var p=0;p<u.length;p++){var y=u[p],x=a,A=i,P=A;e:for(;P!==null;){switch(P.tag){case 27:if(ui(P.type)){Pt=P.stateNode,Fn=!1;break e}break;case 5:Pt=P.stateNode,Fn=!1;break e;case 3:case 4:Pt=P.stateNode.containerInfo,Fn=!0;break e}P=P.return}if(Pt===null)throw Error(r(160));h0(x,A,y),Pt=null,Fn=!1,x=y.alternate,x!==null&&(x.return=null),y.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)v0(i,a),i=i.sibling}var Da=null;function v0(a,i){var u=a.alternate,p=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:Hn(i,a),qn(a),p&4&&(ai(3,a,a.return),tl(3,a),ai(5,a,a.return));break;case 1:Hn(i,a),qn(a),p&512&&(on||u===null||Ka(u,u.return)),p&64&&jr&&(a=a.updateQueue,a!==null&&(p=a.callbacks,p!==null&&(u=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=u===null?p:u.concat(p))));break;case 26:var y=Da;if(Hn(i,a),qn(a),p&512&&(on||u===null||Ka(u,u.return)),p&4){var x=u!==null?u.memoizedState:null;if(p=a.memoizedState,u===null)if(p===null)if(a.stateNode===null){e:{p=a.type,u=a.memoizedProps,y=y.ownerDocument||y;t:switch(p){case"title":x=y.getElementsByTagName("title")[0],(!x||x[wn]||x[Vt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=y.createElement(p),y.head.insertBefore(x,y.querySelector("head > title"))),En(x,p,u),x[Vt]=a,Ot(x),p=x;break e;case"link":var A=vx("link","href",y).get(p+(u.href||""));if(A){for(var P=0;P<A.length;P++)if(x=A[P],x.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&x.getAttribute("rel")===(u.rel==null?null:u.rel)&&x.getAttribute("title")===(u.title==null?null:u.title)&&x.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){A.splice(P,1);break t}}x=y.createElement(p),En(x,p,u),y.head.appendChild(x);break;case"meta":if(A=vx("meta","content",y).get(p+(u.content||""))){for(P=0;P<A.length;P++)if(x=A[P],x.getAttribute("content")===(u.content==null?null:""+u.content)&&x.getAttribute("name")===(u.name==null?null:u.name)&&x.getAttribute("property")===(u.property==null?null:u.property)&&x.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&x.getAttribute("charset")===(u.charSet==null?null:u.charSet)){A.splice(P,1);break t}}x=y.createElement(p),En(x,p,u),y.head.appendChild(x);break;default:throw Error(r(468,p))}x[Vt]=a,Ot(x),p=x}a.stateNode=p}else yx(y,a.type,a.stateNode);else a.stateNode=gx(y,p,a.memoizedProps);else x!==p?(x===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):x.count--,p===null?yx(y,a.type,a.stateNode):gx(y,p,a.memoizedProps)):p===null&&a.stateNode!==null&&Ef(a,a.memoizedProps,u.memoizedProps)}break;case 27:Hn(i,a),qn(a),p&512&&(on||u===null||Ka(u,u.return)),u!==null&&p&4&&Ef(a,a.memoizedProps,u.memoizedProps);break;case 5:if(Hn(i,a),qn(a),p&512&&(on||u===null||Ka(u,u.return)),a.flags&32){y=a.stateNode;try{xs(y,"")}catch(Te){St(a,a.return,Te)}}p&4&&a.stateNode!=null&&(y=a.memoizedProps,Ef(a,y,u!==null?u.memoizedProps:y)),p&1024&&(Rf=!0);break;case 6:if(Hn(i,a),qn(a),p&4){if(a.stateNode===null)throw Error(r(162));p=a.memoizedProps,u=a.stateNode;try{u.nodeValue=p}catch(Te){St(a,a.return,Te)}}break;case 3:if(pu=null,y=Da,Da=uu(i.containerInfo),Hn(i,a),Da=y,qn(a),p&4&&u!==null&&u.memoizedState.isDehydrated)try{Qs(i.containerInfo)}catch(Te){St(a,a.return,Te)}Rf&&(Rf=!1,y0(a));break;case 4:p=Da,Da=uu(a.stateNode.containerInfo),Hn(i,a),qn(a),Da=p;break;case 12:Hn(i,a),qn(a);break;case 31:Hn(i,a),qn(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Yc(a,p)));break;case 13:Hn(i,a),qn(a),a.child.flags&8192&&a.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Xc=ut()),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Yc(a,p)));break;case 22:y=a.memoizedState!==null;var Q=u!==null&&u.memoizedState!==null,ae=jr,de=on;if(jr=ae||y,on=de||Q,Hn(i,a),on=de,jr=ae,qn(a),p&8192)e:for(i=a.stateNode,i._visibility=y?i._visibility&-2:i._visibility|1,y&&(u===null||Q||jr||on||Fi(a)),u=null,i=a;;){if(i.tag===5||i.tag===26){if(u===null){Q=u=i;try{if(x=Q.stateNode,y)A=x.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{P=Q.stateNode;var ge=Q.memoizedProps.style,ie=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;P.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(Te){St(Q,Q.return,Te)}}}else if(i.tag===6){if(u===null){Q=i;try{Q.stateNode.nodeValue=y?"":Q.memoizedProps}catch(Te){St(Q,Q.return,Te)}}}else if(i.tag===18){if(u===null){Q=i;try{var le=Q.stateNode;y?ox(le,!0):ox(Q.stateNode,!1)}catch(Te){St(Q,Q.return,Te)}}}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;u===i&&(u=null),i=i.return}u===i&&(u=null),i.sibling.return=i.return,i=i.sibling}p&4&&(p=a.updateQueue,p!==null&&(u=p.retryQueue,u!==null&&(p.retryQueue=null,Yc(a,u))));break;case 19:Hn(i,a),qn(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Yc(a,p)));break;case 30:break;case 21:break;default:Hn(i,a),qn(a)}}function qn(a){var i=a.flags;if(i&2){try{for(var u,p=a.return;p!==null;){if(c0(p)){u=p;break}p=p.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var y=u.stateNode,x=Af(a);Kc(a,x,y);break;case 5:var A=u.stateNode;u.flags&32&&(xs(A,""),u.flags&=-33);var P=Af(a);Kc(a,P,A);break;case 3:case 4:var Q=u.stateNode.containerInfo,ae=Af(a);Tf(a,ae,Q);break;default:throw Error(r(161))}}catch(de){St(a,a.return,de)}a.flags&=-3}i&4096&&(a.flags&=-4097)}function y0(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var i=a;y0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),a=a.sibling}}function Nr(a,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)p0(a,i.alternate,i),i=i.sibling}function Fi(a){for(a=a.child;a!==null;){var i=a;switch(i.tag){case 0:case 11:case 14:case 15:ai(4,i,i.return),Fi(i);break;case 1:Ka(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&o0(i,i.return,u),Fi(i);break;case 27:dl(i.stateNode);case 26:case 5:Ka(i,i.return),Fi(i);break;case 22:i.memoizedState===null&&Fi(i);break;case 30:Fi(i);break;default:Fi(i)}a=a.sibling}}function Er(a,i,u){for(u=u&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var p=i.alternate,y=a,x=i,A=x.flags;switch(x.tag){case 0:case 11:case 15:Er(y,x,u),tl(4,x);break;case 1:if(Er(y,x,u),p=x,y=p.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ae){St(p,p.return,ae)}if(p=x,y=p.updateQueue,y!==null){var P=p.stateNode;try{var Q=y.shared.hiddenCallbacks;if(Q!==null)for(y.shared.hiddenCallbacks=null,y=0;y<Q.length;y++)Ky(Q[y],P)}catch(ae){St(p,p.return,ae)}}u&&A&64&&s0(x),nl(x,x.return);break;case 27:u0(x);case 26:case 5:Er(y,x,u),u&&p===null&&A&4&&l0(x),nl(x,x.return);break;case 12:Er(y,x,u);break;case 31:Er(y,x,u),u&&A&4&&m0(y,x);break;case 13:Er(y,x,u),u&&A&4&&g0(y,x);break;case 22:x.memoizedState===null&&Er(y,x,u),nl(x,x.return);break;case 30:break;default:Er(y,x,u)}i=i.sibling}}function _f(a,i){var u=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),a=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),a!==u&&(a!=null&&a.refCount++,u!=null&&Fo(u))}function Of(a,i){a=null,i.alternate!==null&&(a=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==a&&(i.refCount++,a!=null&&Fo(a))}function Ia(a,i,u,p){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)b0(a,i,u,p),i=i.sibling}function b0(a,i,u,p){var y=i.flags;switch(i.tag){case 0:case 11:case 15:Ia(a,i,u,p),y&2048&&tl(9,i);break;case 1:Ia(a,i,u,p);break;case 3:Ia(a,i,u,p),y&2048&&(a=null,i.alternate!==null&&(a=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==a&&(i.refCount++,a!=null&&Fo(a)));break;case 12:if(y&2048){Ia(a,i,u,p),a=i.stateNode;try{var x=i.memoizedProps,A=x.id,P=x.onPostCommit;typeof P=="function"&&P(A,i.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(Q){St(i,i.return,Q)}}else Ia(a,i,u,p);break;case 31:Ia(a,i,u,p);break;case 13:Ia(a,i,u,p);break;case 23:break;case 22:x=i.stateNode,A=i.alternate,i.memoizedState!==null?x._visibility&2?Ia(a,i,u,p):al(a,i):x._visibility&2?Ia(a,i,u,p):(x._visibility|=2,Us(a,i,u,p,(i.subtreeFlags&10256)!==0||!1)),y&2048&&_f(A,i);break;case 24:Ia(a,i,u,p),y&2048&&Of(i.alternate,i);break;default:Ia(a,i,u,p)}}function Us(a,i,u,p,y){for(y=y&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var x=a,A=i,P=u,Q=p,ae=A.flags;switch(A.tag){case 0:case 11:case 15:Us(x,A,P,Q,y),tl(8,A);break;case 23:break;case 22:var de=A.stateNode;A.memoizedState!==null?de._visibility&2?Us(x,A,P,Q,y):al(x,A):(de._visibility|=2,Us(x,A,P,Q,y)),y&&ae&2048&&_f(A.alternate,A);break;case 24:Us(x,A,P,Q,y),y&&ae&2048&&Of(A.alternate,A);break;default:Us(x,A,P,Q,y)}i=i.sibling}}function al(a,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var u=a,p=i,y=p.flags;switch(p.tag){case 22:al(u,p),y&2048&&_f(p.alternate,p);break;case 24:al(u,p),y&2048&&Of(p.alternate,p);break;default:al(u,p)}i=i.sibling}}var rl=8192;function Bs(a,i,u){if(a.subtreeFlags&rl)for(a=a.child;a!==null;)x0(a,i,u),a=a.sibling}function x0(a,i,u){switch(a.tag){case 26:Bs(a,i,u),a.flags&rl&&a.memoizedState!==null&&pT(u,Da,a.memoizedState,a.memoizedProps);break;case 5:Bs(a,i,u);break;case 3:case 4:var p=Da;Da=uu(a.stateNode.containerInfo),Bs(a,i,u),Da=p;break;case 22:a.memoizedState===null&&(p=a.alternate,p!==null&&p.memoizedState!==null?(p=rl,rl=16777216,Bs(a,i,u),rl=p):Bs(a,i,u));break;default:Bs(a,i,u)}}function w0(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 il(a){var i=a.deletions;if((a.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var p=i[u];yn=p,S0(p,a)}w0(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)k0(a),a=a.sibling}function k0(a){switch(a.tag){case 0:case 11:case 15:il(a),a.flags&2048&&ai(9,a,a.return);break;case 3:il(a);break;case 12:il(a);break;case 22:var i=a.stateNode;a.memoizedState!==null&&i._visibility&2&&(a.return===null||a.return.tag!==13)?(i._visibility&=-3,Qc(a)):il(a);break;default:il(a)}}function Qc(a){var i=a.deletions;if((a.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var p=i[u];yn=p,S0(p,a)}w0(a)}for(a=a.child;a!==null;){switch(i=a,i.tag){case 0:case 11:case 15:ai(8,i,i.return),Qc(i);break;case 22:u=i.stateNode,u._visibility&2&&(u._visibility&=-3,Qc(i));break;default:Qc(i)}a=a.sibling}}function S0(a,i){for(;yn!==null;){var u=yn;switch(u.tag){case 0:case 11:case 15:ai(8,u,i);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var p=u.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:Fo(u.memoizedState.cache)}if(p=u.child,p!==null)p.return=u,yn=p;else e:for(u=a;yn!==null;){p=yn;var y=p.sibling,x=p.return;if(f0(p),p===u){yn=null;break e}if(y!==null){y.return=x,yn=y;break e}yn=x}}}var EA={getCacheForType:function(a){var i=Cn(an),u=i.data.get(a);return u===void 0&&(u=a(),i.data.set(a,u)),u},cacheSignal:function(){return Cn(an).controller.signal}},AA=typeof WeakMap=="function"?WeakMap:Map,bt=0,At=null,nt=null,st=0,kt=0,aa=null,ri=!1,Fs=!1,Mf=!1,Ar=0,Yt=0,ii=0,Hi=0,Lf=0,ra=0,Hs=0,sl=null,Gn=null,Df=!1,Xc=0,j0=0,Jc=1/0,eu=null,si=null,dn=0,oi=null,qs=null,Tr=0,If=0,zf=null,C0=null,ol=0,$f=null;function ia(){return(bt&2)!==0&&st!==0?st&-st:V.T!==null?qf():Qe()}function N0(){if(ra===0)if((st&536870912)===0||ct){var a=Br;Br<<=1,(Br&3932160)===0&&(Br=262144),ra=a}else ra=536870912;return a=ta.current,a!==null&&(a.flags|=32),ra}function Vn(a,i,u){(a===At&&(kt===2||kt===9)||a.cancelPendingCommit!==null)&&(Gs(a,0),li(a,st,ra,!1)),me(a,u),((bt&2)===0||a!==At)&&(a===At&&((bt&2)===0&&(Hi|=u),Yt===4&&li(a,st,ra,!1)),Ya(a))}function E0(a,i,u){if((bt&6)!==0)throw Error(r(327));var p=!u&&(i&127)===0&&(i&a.expiredLanes)===0||ur(a,i),y=p?_A(a,i):Uf(a,i,!0),x=p;do{if(y===0){Fs&&!p&&li(a,i,0,!1);break}else{if(u=a.current.alternate,x&&!TA(u)){y=Uf(a,i,!1),x=!1;continue}if(y===2){if(x=i,a.errorRecoveryDisabledLanes&x)var A=0;else A=a.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){i=A;e:{var P=a;y=sl;var Q=P.current.memoizedState.isDehydrated;if(Q&&(Gs(P,A).flags|=256),A=Uf(P,A,!1),A!==2){if(Mf&&!Q){P.errorRecoveryDisabledLanes|=x,Hi|=x,y=4;break e}x=Gn,Gn=y,x!==null&&(Gn===null?Gn=x:Gn.push.apply(Gn,x))}y=A}if(x=!1,y!==2)continue}}if(y===1){Gs(a,0),li(a,i,0,!0);break}e:{switch(p=a,x=y,x){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:li(p,i,ra,!ri);break e;case 2:Gn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(y=Xc+300-ut(),10<y)){if(li(p,i,ra,!ri),Ga(p,0,!0)!==0)break e;Tr=i,p.timeoutHandle=rx(A0.bind(null,p,u,Gn,eu,Df,i,ra,Hi,Hs,ri,x,"Throttled",-0,0),y);break e}A0(p,u,Gn,eu,Df,i,ra,Hi,Hs,ri,x,null,-0,0)}}break}while(!0);Ya(a)}function A0(a,i,u,p,y,x,A,P,Q,ae,de,ge,ie,le){if(a.timeoutHandle=-1,ge=i.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:hr},x0(i,x,ge);var Te=(x&62914560)===x?Xc-ut():(x&4194048)===x?j0-ut():0;if(Te=fT(ge,Te),Te!==null){Tr=x,a.cancelPendingCommit=Te(I0.bind(null,a,i,x,u,p,y,A,P,Q,de,ge,null,ie,le)),li(a,x,A,!ae);return}}I0(a,i,x,u,p,y,A,P,Q)}function TA(a){for(var i=a;;){var u=i.tag;if((u===0||u===11||u===15)&&i.flags&16384&&(u=i.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var p=0;p<u.length;p++){var y=u[p],x=y.getSnapshot;y=y.value;try{if(!Jn(x(),y))return!1}catch{return!1}}if(u=i.child,i.subtreeFlags&16384&&u!==null)u.return=i,i=u;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 li(a,i,u,p){i&=~Lf,i&=~Hi,a.suspendedLanes|=i,a.pingedLanes&=~i,p&&(a.warmLanes|=i),p=a.expirationTimes;for(var y=i;0<y;){var x=31-Ee(y),A=1<<x;p[x]=-1,y&=~A}u!==0&&ue(a,u,i)}function tu(){return(bt&6)===0?(ll(0),!1):!0}function Pf(){if(nt!==null){if(kt===0)var a=nt.return;else a=nt,yr=Li=null,ef(a),Ds=null,qo=0,a=nt;for(;a!==null;)i0(a.alternate,a),a=a.return;nt=null}}function Gs(a,i){var u=a.timeoutHandle;u!==-1&&(a.timeoutHandle=-1,KA(u)),u=a.cancelPendingCommit,u!==null&&(a.cancelPendingCommit=null,u()),Tr=0,Pf(),At=a,nt=u=gr(a.current,null),st=i,kt=0,aa=null,ri=!1,Fs=ur(a,i),Mf=!1,Hs=ra=Lf=Hi=ii=Yt=0,Gn=sl=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 y=31-Ee(p),x=1<<y;i|=a[y],p&=~x}return Ar=i,kc(),u}function T0(a,i){Xe=null,V.H=Xo,i===Ls||i===Rc?(i=Gy(),kt=3):i===Fp?(i=Gy(),kt=4):kt=i===vf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,aa=i,nt===null&&(Yt=1,qc(a,xa(i,a.current)))}function R0(){var a=ta.current;return a===null?!0:(st&4194048)===st?ja===null:(st&62914560)===st||(st&536870912)!==0?a===ja:!1}function _0(){var a=V.H;return V.H=Xo,a===null?Xo:a}function O0(){var a=V.A;return V.A=EA,a}function nu(){Yt=4,ri||(st&4194048)!==st&&ta.current!==null||(Fs=!0),(ii&134217727)===0&&(Hi&134217727)===0||At===null||li(At,st,ra,!1)}function Uf(a,i,u){var p=bt;bt|=2;var y=_0(),x=O0();(At!==a||st!==i)&&(eu=null,Gs(a,i)),i=!1;var A=Yt;e:do try{if(kt!==0&&nt!==null){var P=nt,Q=aa;switch(kt){case 8:Pf(),A=6;break e;case 3:case 2:case 9:case 6:ta.current===null&&(i=!0);var ae=kt;if(kt=0,aa=null,Vs(a,P,Q,ae),u&&Fs){A=0;break e}break;default:ae=kt,kt=0,aa=null,Vs(a,P,Q,ae)}}RA(),A=Yt;break}catch(de){T0(a,de)}while(!0);return i&&a.shellSuspendCounter++,yr=Li=null,bt=p,V.H=y,V.A=x,nt===null&&(At=null,st=0,kc()),A}function RA(){for(;nt!==null;)M0(nt)}function _A(a,i){var u=bt;bt|=2;var p=_0(),y=O0();At!==a||st!==i?(eu=null,Jc=ut()+500,Gs(a,i)):Fs=ur(a,i);e:do try{if(kt!==0&&nt!==null){i=nt;var x=aa;t:switch(kt){case 1:kt=0,aa=null,Vs(a,i,x,1);break;case 2:case 9:if(Hy(x)){kt=0,aa=null,L0(i);break}i=function(){kt!==2&&kt!==9||At!==a||(kt=7),Ya(a)},x.then(i,i);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:Hy(x)?(kt=0,aa=null,L0(i)):(kt=0,aa=null,Vs(a,i,x,7));break;case 5:var A=null;switch(nt.tag){case 26:A=nt.memoizedState;case 5:case 27:var P=nt;if(A?bx(A):P.stateNode.complete){kt=0,aa=null;var Q=P.sibling;if(Q!==null)nt=Q;else{var ae=P.return;ae!==null?(nt=ae,au(ae)):nt=null}break t}}kt=0,aa=null,Vs(a,i,x,5);break;case 6:kt=0,aa=null,Vs(a,i,x,6);break;case 8:Pf(),Yt=6;break e;default:throw Error(r(462))}}OA();break}catch(de){T0(a,de)}while(!0);return yr=Li=null,V.H=p,V.A=y,bt=u,nt!==null?0:(At=null,st=0,kc(),Yt)}function OA(){for(;nt!==null&&!Qt();)M0(nt)}function M0(a){var i=a0(a.alternate,a,Ar);a.memoizedProps=a.pendingProps,i===null?au(a):nt=i}function L0(a){var i=a,u=i.alternate;switch(i.tag){case 15:case 0:i=Qb(u,i,i.pendingProps,i.type,void 0,st);break;case 11:i=Qb(u,i,i.pendingProps,i.type.render,i.ref,st);break;case 5:ef(i);default:i0(u,i),i=nt=Oy(i,Ar),i=a0(u,i,Ar)}a.memoizedProps=a.pendingProps,i===null?au(a):nt=i}function Vs(a,i,u,p){yr=Li=null,ef(i),Ds=null,qo=0;var y=i.return;try{if(xA(a,y,i,u,st)){Yt=1,qc(a,xa(u,a.current)),nt=null;return}}catch(x){if(y!==null)throw nt=y,x;Yt=1,qc(a,xa(u,a.current)),nt=null;return}i.flags&32768?(ct||p===1?a=!0:Fs||(st&536870912)!==0?a=!1:(ri=a=!0,(p===2||p===9||p===3||p===6)&&(p=ta.current,p!==null&&p.tag===13&&(p.flags|=16384))),D0(i,a)):au(i)}function au(a){var i=a;do{if((i.flags&32768)!==0){D0(i,ri);return}a=i.return;var u=SA(i.alternate,i,Ar);if(u!==null){nt=u;return}if(i=i.sibling,i!==null){nt=i;return}nt=i=a}while(i!==null);Yt===0&&(Yt=5)}function D0(a,i){do{var u=jA(a.alternate,a);if(u!==null){u.flags&=32767,nt=u;return}if(u=a.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!i&&(a=a.sibling,a!==null)){nt=a;return}nt=a=u}while(a!==null);Yt=6,nt=null}function I0(a,i,u,p,y,x,A,P,Q){a.cancelPendingCommit=null;do ru();while(dn!==0);if((bt&6)!==0)throw Error(r(327));if(i!==null){if(i===a.current)throw Error(r(177));if(x=i.lanes|i.childLanes,x|=Ep,Me(a,u,x,A,P,Q),a===At&&(nt=At=null,st=0),qs=i,oi=a,Tr=u,If=x,zf=y,C0=p,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,IA(H,function(){return B0(),null})):(a.callbackNode=null,a.callbackPriority=0),p=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||p){p=V.T,V.T=null,y=Z.p,Z.p=2,A=bt,bt|=4;try{CA(a,i,u)}finally{bt=A,Z.p=y,V.T=p}}dn=1,z0(),$0(),P0()}}function z0(){if(dn===1){dn=0;var a=oi,i=qs,u=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||u){u=V.T,V.T=null;var p=Z.p;Z.p=2;var y=bt;bt|=4;try{v0(i,a);var x=Xf,A=Sy(a.containerInfo),P=x.focusedElem,Q=x.selectionRange;if(A!==P&&P&&P.ownerDocument&&ky(P.ownerDocument.documentElement,P)){if(Q!==null&&kp(P)){var ae=Q.start,de=Q.end;if(de===void 0&&(de=ae),"selectionStart"in P)P.selectionStart=ae,P.selectionEnd=Math.min(de,P.value.length);else{var ge=P.ownerDocument||document,ie=ge&&ge.defaultView||window;if(ie.getSelection){var le=ie.getSelection(),Te=P.textContent.length,Be=Math.min(Q.start,Te),Nt=Q.end===void 0?Be:Math.min(Q.end,Te);!le.extend&&Be>Nt&&(A=Nt,Nt=Be,Be=A);var te=wy(P,Be),J=wy(P,Nt);if(te&&J&&(le.rangeCount!==1||le.anchorNode!==te.node||le.anchorOffset!==te.offset||le.focusNode!==J.node||le.focusOffset!==J.offset)){var ne=ge.createRange();ne.setStart(te.node,te.offset),le.removeAllRanges(),Be>Nt?(le.addRange(ne),le.extend(J.node,J.offset)):(ne.setEnd(J.node,J.offset),le.addRange(ne))}}}}for(ge=[],le=P;le=le.parentNode;)le.nodeType===1&&ge.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<ge.length;P++){var he=ge[P];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}gu=!!Qf,Xf=Qf=null}finally{bt=y,Z.p=p,V.T=u}}a.current=i,dn=2}}function $0(){if(dn===2){dn=0;var a=oi,i=qs,u=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||u){u=V.T,V.T=null;var p=Z.p;Z.p=2;var y=bt;bt|=4;try{p0(a,i.alternate,i)}finally{bt=y,Z.p=p,V.T=u}}dn=3}}function P0(){if(dn===4||dn===3){dn=0,Gt();var a=oi,i=qs,u=Tr,p=C0;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?dn=5:(dn=0,qs=oi=null,U0(a,a.pendingLanes));var y=a.pendingLanes;if(y===0&&(si=null),Ye(u),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=V.T,y=Z.p,Z.p=2,V.T=null;try{for(var x=a.onRecoverableError,A=0;A<p.length;A++){var P=p[A];x(P.value,{componentStack:P.stack})}}finally{V.T=i,Z.p=y}}(Tr&3)!==0&&ru(),Ya(a),y=a.pendingLanes,(u&261930)!==0&&(y&42)!==0?a===$f?ol++:(ol=0,$f=a):ol=0,ll(0)}}function U0(a,i){(a.pooledCacheLanes&=i)===0&&(i=a.pooledCache,i!=null&&(a.pooledCache=null,Fo(i)))}function ru(){return z0(),$0(),P0(),B0()}function B0(){if(dn!==5)return!1;var a=oi,i=If;If=0;var u=Ye(Tr),p=V.T,y=Z.p;try{Z.p=32>u?32:u,V.T=null,u=zf,zf=null;var x=oi,A=Tr;if(dn=0,qs=oi=null,Tr=0,(bt&6)!==0)throw Error(r(331));var P=bt;if(bt|=4,k0(x.current),b0(x,x.current,A,u),bt=P,ll(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(Ce,x)}catch{}return!0}finally{Z.p=y,V.T=p,U0(a,i)}}function F0(a,i,u){i=xa(u,i),i=gf(a.stateNode,i,2),a=ei(a,i,2),a!==null&&(me(a,2),Ya(a))}function St(a,i,u){if(a.tag===3)F0(a,a,u);else for(;i!==null;){if(i.tag===3){F0(i,a,u);break}else if(i.tag===1){var p=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(si===null||!si.has(p))){a=xa(u,a),u=Hb(2),p=ei(i,u,2),p!==null&&(qb(u,p,i,a),me(p,2),Ya(p));break}}i=i.return}}function Bf(a,i,u){var p=a.pingCache;if(p===null){p=a.pingCache=new AA;var y=new Set;p.set(i,y)}else y=p.get(i),y===void 0&&(y=new Set,p.set(i,y));y.has(u)||(Mf=!0,y.add(u),a=MA.bind(null,a,i,u),i.then(a,a))}function MA(a,i,u){var p=a.pingCache;p!==null&&p.delete(i),a.pingedLanes|=a.suspendedLanes&u,a.warmLanes&=~u,At===a&&(st&u)===u&&(Yt===4||Yt===3&&(st&62914560)===st&&300>ut()-Xc?(bt&2)===0&&Gs(a,0):Lf|=u,Hs===st&&(Hs=0)),Ya(a)}function H0(a,i){i===0&&(i=Hr()),a=_i(a,i),a!==null&&(me(a,i),Ya(a))}function LA(a){var i=a.memoizedState,u=0;i!==null&&(u=i.retryLane),H0(a,u)}function DA(a,i){var u=0;switch(a.tag){case 31:case 13:var p=a.stateNode,y=a.memoizedState;y!==null&&(u=y.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),H0(a,u)}function IA(a,i){return Lt(a,i)}var iu=null,Ws=null,Ff=!1,su=!1,Hf=!1,ci=0;function Ya(a){a!==Ws&&a.next===null&&(Ws===null?iu=Ws=a:Ws=Ws.next=a),su=!0,Ff||(Ff=!0,$A())}function ll(a,i){if(!Hf&&su){Hf=!0;do for(var u=!1,p=iu;p!==null;){if(a!==0){var y=p.pendingLanes;if(y===0)var x=0;else{var A=p.suspendedLanes,P=p.pingedLanes;x=(1<<31-Ee(42|a)+1)-1,x&=y&~(A&~P),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(u=!0,W0(p,x))}else x=st,x=Ga(p,p===At?x:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(x&3)===0||ur(p,x)||(u=!0,W0(p,x));p=p.next}while(u);Hf=!1}}function zA(){q0()}function q0(){su=Ff=!1;var a=0;ci!==0&&ZA()&&(a=ci);for(var i=ut(),u=null,p=iu;p!==null;){var y=p.next,x=G0(p,i);x===0?(p.next=null,u===null?iu=y:u.next=y,y===null&&(Ws=u)):(u=p,(a!==0||(x&3)!==0)&&(su=!0)),p=y}dn!==0&&dn!==5||ll(a),ci!==0&&(ci=0)}function G0(a,i){for(var u=a.suspendedLanes,p=a.pingedLanes,y=a.expirationTimes,x=a.pendingLanes&-62914561;0<x;){var A=31-Ee(x),P=1<<A,Q=y[A];Q===-1?((P&u)===0||(P&p)!==0)&&(y[A]=dc(P,i)):Q<=i&&(a.expiredLanes|=P),x&=~P}if(i=At,u=st,u=Ga(a,a===i?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p=a.callbackNode,u===0||a===i&&(kt===2||kt===9)||a.cancelPendingCommit!==null)return p!==null&&p!==null&&$t(p),a.callbackNode=null,a.callbackPriority=0;if((u&3)===0||ur(a,u)){if(i=u&-u,i===a.callbackPriority)return i;switch(p!==null&&$t(p),Ye(u)){case 2:case 8:u=fe;break;case 32:u=H;break;case 268435456:u=pe;break;default:u=H}return p=V0.bind(null,a),u=Lt(u,p),a.callbackPriority=i,a.callbackNode=u,i}return p!==null&&p!==null&&$t(p),a.callbackPriority=2,a.callbackNode=null,2}function V0(a,i){if(dn!==0&&dn!==5)return a.callbackNode=null,a.callbackPriority=0,null;var u=a.callbackNode;if(ru()&&a.callbackNode!==u)return null;var p=st;return p=Ga(a,a===At?p:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p===0?null:(E0(a,p,i),G0(a,ut()),a.callbackNode!=null&&a.callbackNode===u?V0.bind(null,a):null)}function W0(a,i){if(ru())return null;E0(a,i,!0)}function $A(){YA(function(){(bt&6)!==0?Lt(X,zA):q0()})}function qf(){if(ci===0){var a=Os;a===0&&(a=ha,ha<<=1,(ha&261888)===0&&(ha=256)),ci=a}return ci}function Z0(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:hc(""+a)}function K0(a,i){var u=i.ownerDocument.createElement("input");return u.name=i.name,u.value=i.value,a.id&&u.setAttribute("form",a.id),i.parentNode.insertBefore(u,i),a=new FormData(a),u.parentNode.removeChild(u),a}function PA(a,i,u,p,y){if(i==="submit"&&u&&u.stateNode===y){var x=Z0((y[vn]||null).action),A=p.submitter;A&&(i=(i=A[vn]||null)?Z0(i.formAction):A.getAttribute("formAction"),i!==null&&(x=i,A=null));var P=new yc("action","action",null,p,y);a.push({event:P,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(ci!==0){var Q=A?K0(y,A):new FormData(y);uf(u,{pending:!0,data:Q,method:y.method,action:x},null,Q)}}else typeof x=="function"&&(P.preventDefault(),Q=A?K0(y,A):new FormData(y),uf(u,{pending:!0,data:Q,method:y.method,action:x},x,Q))},currentTarget:y}]})}}for(var Gf=0;Gf<Np.length;Gf++){var Vf=Np[Gf],UA=Vf.toLowerCase(),BA=Vf[0].toUpperCase()+Vf.slice(1);La(UA,"on"+BA)}La(Ny,"onAnimationEnd"),La(Ey,"onAnimationIteration"),La(Ay,"onAnimationStart"),La("dblclick","onDoubleClick"),La("focusin","onFocus"),La("focusout","onBlur"),La(aA,"onTransitionRun"),La(rA,"onTransitionStart"),La(iA,"onTransitionCancel"),La(Ty,"onTransitionEnd"),Gr("onMouseEnter",["mouseout","mouseover"]),Gr("onMouseLeave",["mouseout","mouseover"]),Gr("onPointerEnter",["pointerout","pointerover"]),Gr("onPointerLeave",["pointerout","pointerover"]),Va("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Va("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Va("onBeforeInput",["compositionend","keypress","textInput","paste"]),Va("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Va("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Va("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cl="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(" "),FA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(cl));function Y0(a,i){i=(i&4)!==0;for(var u=0;u<a.length;u++){var p=a[u],y=p.event;p=p.listeners;e:{var x=void 0;if(i)for(var A=p.length-1;0<=A;A--){var P=p[A],Q=P.instance,ae=P.currentTarget;if(P=P.listener,Q!==x&&y.isPropagationStopped())break e;x=P,y.currentTarget=ae;try{x(y)}catch(de){wc(de)}y.currentTarget=null,x=Q}else for(A=0;A<p.length;A++){if(P=p[A],Q=P.instance,ae=P.currentTarget,P=P.listener,Q!==x&&y.isPropagationStopped())break e;x=P,y.currentTarget=ae;try{x(y)}catch(de){wc(de)}y.currentTarget=null,x=Q}}}}function at(a,i){var u=i[pr];u===void 0&&(u=i[pr]=new Set);var p=a+"__bubble";u.has(p)||(Q0(i,a,2,!1),u.add(p))}function Wf(a,i,u){var p=0;i&&(p|=4),Q0(u,a,p,i)}var ou="_reactListening"+Math.random().toString(36).slice(2);function Zf(a){if(!a[ou]){a[ou]=!0,qr.forEach(function(u){u!=="selectionchange"&&(FA.has(u)||Wf(u,!1,a),Wf(u,!0,a))});var i=a.nodeType===9?a:a.ownerDocument;i===null||i[ou]||(i[ou]=!0,Wf("selectionchange",!1,i))}}function Q0(a,i,u,p){switch(Nx(i)){case 2:var y=gT;break;case 8:y=vT;break;default:y=ch}u=y.bind(null,i,u,a),y=void 0,!fp||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),p?y!==void 0?a.addEventListener(i,u,{capture:!0,passive:y}):a.addEventListener(i,u,!0):y!==void 0?a.addEventListener(i,u,{passive:y}):a.addEventListener(i,u,!1)}function Kf(a,i,u,p,y){var x=p;if((i&1)===0&&(i&2)===0&&p!==null)e:for(;;){if(p===null)return;var A=p.tag;if(A===3||A===4){var P=p.stateNode.containerInfo;if(P===y)break;if(A===4)for(A=p.return;A!==null;){var Q=A.tag;if((Q===3||Q===4)&&A.stateNode.containerInfo===y)return;A=A.return}for(;P!==null;){if(A=ga(P),A===null)return;if(Q=A.tag,Q===5||Q===6||Q===26||Q===27){p=x=A;continue e}P=P.parentNode}}p=p.return}ny(function(){var ae=x,de=dp(u),ge=[];e:{var ie=Ry.get(a);if(ie!==void 0){var le=yc,Te=a;switch(a){case"keypress":if(gc(u)===0)break e;case"keydown":case"keyup":le=DE;break;case"focusin":Te="focus",le=vp;break;case"focusout":Te="blur",le=vp;break;case"beforeblur":case"afterblur":le=vp;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=iy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=SE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=$E;break;case Ny:case Ey:case Ay:le=NE;break;case Ty:le=UE;break;case"scroll":case"scrollend":le=wE;break;case"wheel":le=FE;break;case"copy":case"cut":case"paste":le=AE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=oy;break;case"toggle":case"beforetoggle":le=qE}var Be=(i&4)!==0,Nt=!Be&&(a==="scroll"||a==="scrollend"),te=Be?ie!==null?ie+"Capture":null:ie;Be=[];for(var J=ae,ne;J!==null;){var he=J;if(ne=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ne===null||te===null||(he=_o(J,te),he!=null&&Be.push(ul(J,he,ne))),Nt)break;J=J.return}0<Be.length&&(ie=new le(ie,Te,null,u,de),ge.push({event:ie,listeners:Be}))}}if((i&7)===0){e:{if(ie=a==="mouseover"||a==="pointerover",le=a==="mouseout"||a==="pointerout",ie&&u!==up&&(Te=u.relatedTarget||u.fromElement)&&(ga(Te)||Te[dr]))break e;if((le||ie)&&(ie=de.window===de?de:(ie=de.ownerDocument)?ie.defaultView||ie.parentWindow:window,le?(Te=u.relatedTarget||u.toElement,le=ae,Te=Te?ga(Te):null,Te!==null&&(Nt=l(Te),Be=Te.tag,Te!==Nt||Be!==5&&Be!==27&&Be!==6)&&(Te=null)):(le=null,Te=ae),le!==Te)){if(Be=iy,he="onMouseLeave",te="onMouseEnter",J="mouse",(a==="pointerout"||a==="pointerover")&&(Be=oy,he="onPointerLeave",te="onPointerEnter",J="pointer"),Nt=le==null?ie:kn(le),ne=Te==null?ie:kn(Te),ie=new Be(he,J+"leave",le,u,de),ie.target=Nt,ie.relatedTarget=ne,he=null,ga(de)===ae&&(Be=new Be(te,J+"enter",Te,u,de),Be.target=ne,Be.relatedTarget=Nt,he=Be),Nt=he,le&&Te)t:{for(Be=HA,te=le,J=Te,ne=0,he=te;he;he=Be(he))ne++;he=0;for(var ze=J;ze;ze=Be(ze))he++;for(;0<ne-he;)te=Be(te),ne--;for(;0<he-ne;)J=Be(J),he--;for(;ne--;){if(te===J||J!==null&&te===J.alternate){Be=te;break t}te=Be(te),J=Be(J)}Be=null}else Be=null;le!==null&&X0(ge,ie,le,Be,!1),Te!==null&&Nt!==null&&X0(ge,Nt,Te,Be,!0)}}e:{if(ie=ae?kn(ae):window,le=ie.nodeName&&ie.nodeName.toLowerCase(),le==="select"||le==="input"&&ie.type==="file")var ht=my;else if(fy(ie))if(gy)ht=eA;else{ht=XE;var _e=QE}else le=ie.nodeName,!le||le.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?ae&&cp(ae.elementType)&&(ht=my):ht=JE;if(ht&&(ht=ht(a,ae))){hy(ge,ht,u,de);break e}_e&&_e(a,ie,ae),a==="focusout"&&ae&&ie.type==="number"&&ae.memoizedProps.value!=null&&lp(ie,"number",ie.value)}switch(_e=ae?kn(ae):window,a){case"focusin":(fy(_e)||_e.contentEditable==="true")&&(js=_e,Sp=ae,Po=null);break;case"focusout":Po=Sp=js=null;break;case"mousedown":jp=!0;break;case"contextmenu":case"mouseup":case"dragend":jp=!1,jy(ge,u,de);break;case"selectionchange":if(nA)break;case"keydown":case"keyup":jy(ge,u,de)}var Je;if(bp)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 Ss?dy(a,u)&&(ot="onCompositionEnd"):a==="keydown"&&u.keyCode===229&&(ot="onCompositionStart");ot&&(ly&&u.locale!=="ko"&&(Ss||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&Ss&&(Je=ay()):(Wr=de,hp="value"in Wr?Wr.value:Wr.textContent,Ss=!0)),_e=lu(ae,ot),0<_e.length&&(ot=new sy(ot,a,null,u,de),ge.push({event:ot,listeners:_e}),Je?ot.data=Je:(Je=py(u),Je!==null&&(ot.data=Je)))),(Je=VE?WE(a,u):ZE(a,u))&&(ot=lu(ae,"onBeforeInput"),0<ot.length&&(_e=new sy("onBeforeInput","beforeinput",null,u,de),ge.push({event:_e,listeners:ot}),_e.data=Je)),PA(ge,a,ae,u,de)}Y0(ge,i)})}function ul(a,i,u){return{instance:a,listener:i,currentTarget:u}}function lu(a,i){for(var u=i+"Capture",p=[];a!==null;){var y=a,x=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||x===null||(y=_o(a,u),y!=null&&p.unshift(ul(a,y,x)),y=_o(a,i),y!=null&&p.push(ul(a,y,x))),a.tag===3)return p;a=a.return}return[]}function HA(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function X0(a,i,u,p,y){for(var x=i._reactName,A=[];u!==null&&u!==p;){var P=u,Q=P.alternate,ae=P.stateNode;if(P=P.tag,Q!==null&&Q===p)break;P!==5&&P!==26&&P!==27||ae===null||(Q=ae,y?(ae=_o(u,x),ae!=null&&A.unshift(ul(u,ae,Q))):y||(ae=_o(u,x),ae!=null&&A.push(ul(u,ae,Q)))),u=u.return}A.length!==0&&a.push({event:i,listeners:A})}var qA=/\r\n?/g,GA=/\u0000|\uFFFD/g;function J0(a){return(typeof a=="string"?a:""+a).replace(qA,`
|
|
50
|
+
`).replace(GA,"")}function ex(a,i){return i=J0(i),J0(a)===i}function Ct(a,i,u,p,y,x){switch(u){case"children":typeof p=="string"?i==="body"||i==="textarea"&&p===""||xs(a,p):(typeof p=="number"||typeof p=="bigint")&&i!=="body"&&xs(a,""+p);break;case"className":Xt(a,"class",p);break;case"tabIndex":Xt(a,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":Xt(a,u,p);break;case"style":ey(a,p,x);break;case"data":if(i!=="object"){Xt(a,"data",p);break}case"src":case"href":if(p===""&&(i!=="a"||u!=="href")){a.removeAttribute(u);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(u);break}p=hc(""+p),a.setAttribute(u,p);break;case"action":case"formAction":if(typeof p=="function"){a.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(u==="formAction"?(i!=="input"&&Ct(a,i,"name",y.name,y,null),Ct(a,i,"formEncType",y.formEncType,y,null),Ct(a,i,"formMethod",y.formMethod,y,null),Ct(a,i,"formTarget",y.formTarget,y,null)):(Ct(a,i,"encType",y.encType,y,null),Ct(a,i,"method",y.method,y,null),Ct(a,i,"target",y.target,y,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(u);break}p=hc(""+p),a.setAttribute(u,p);break;case"onClick":p!=null&&(a.onclick=hr);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(u=p.__html,u!=null){if(y.children!=null)throw Error(r(60));a.innerHTML=u}}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}u=hc(""+p),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);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(u,""+p):a.removeAttribute(u);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(u,""):a.removeAttribute(u);break;case"capture":case"download":p===!0?a.setAttribute(u,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(u,p):a.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?a.setAttribute(u,p):a.removeAttribute(u);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?a.removeAttribute(u):a.setAttribute(u,p);break;case"popover":at("beforetoggle",a),at("toggle",a),wt(a,"popover",p);break;case"xlinkActuate":Sn(a,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":Sn(a,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":Sn(a,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":Sn(a,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":Sn(a,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":Sn(a,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":Sn(a,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":Sn(a,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":Sn(a,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":wt(a,"is",p);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=bE.get(u)||u,wt(a,u,p))}}function Yf(a,i,u,p,y,x){switch(u){case"style":ey(a,p,x);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(u=p.__html,u!=null){if(y.children!=null)throw Error(r(60));a.innerHTML=u}}break;case"children":typeof p=="string"?xs(a,p):(typeof p=="number"||typeof p=="bigint")&&xs(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=hr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!fr.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),i=u.slice(2,y?u.length-7:void 0),x=a[vn]||null,x=x!=null?x[u]:null,typeof x=="function"&&a.removeEventListener(i,x,y),typeof p=="function")){typeof x!="function"&&x!==null&&(u in a?a[u]=null:a.hasAttribute(u)&&a.removeAttribute(u)),a.addEventListener(i,p,y);break e}u in a?a[u]=p:p===!0?a.setAttribute(u,""):wt(a,u,p)}}}function En(a,i,u){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,y=!1,x;for(x in u)if(u.hasOwnProperty(x)){var A=u[x];if(A!=null)switch(x){case"src":p=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Ct(a,i,x,A,u,null)}}y&&Ct(a,i,"srcSet",u.srcSet,u,null),p&&Ct(a,i,"src",u.src,u,null);return;case"input":at("invalid",a);var P=x=A=y=null,Q=null,ae=null;for(p in u)if(u.hasOwnProperty(p)){var de=u[p];if(de!=null)switch(p){case"name":y=de;break;case"type":A=de;break;case"checked":Q=de;break;case"defaultChecked":ae=de;break;case"value":x=de;break;case"defaultValue":P=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,i));break;default:Ct(a,i,p,de,u,null)}}Yv(a,x,P,Q,ae,A,y,!1);return;case"select":at("invalid",a),p=A=x=null;for(y in u)if(u.hasOwnProperty(y)&&(P=u[y],P!=null))switch(y){case"value":x=P;break;case"defaultValue":A=P;break;case"multiple":p=P;default:Ct(a,i,y,P,u,null)}i=x,u=A,a.multiple=!!p,i!=null?bs(a,!!p,i,!1):u!=null&&bs(a,!!p,u,!0);return;case"textarea":at("invalid",a),x=y=p=null;for(A in u)if(u.hasOwnProperty(A)&&(P=u[A],P!=null))switch(A){case"value":p=P;break;case"defaultValue":y=P;break;case"children":x=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(r(91));break;default:Ct(a,i,A,P,u,null)}Xv(a,p,y,x);return;case"option":for(Q in u)if(u.hasOwnProperty(Q)&&(p=u[Q],p!=null))switch(Q){case"selected":a.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:Ct(a,i,Q,p,u,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<cl.length;p++)at(cl[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(ae in u)if(u.hasOwnProperty(ae)&&(p=u[ae],p!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Ct(a,i,ae,p,u,null)}return;default:if(cp(i)){for(de in u)u.hasOwnProperty(de)&&(p=u[de],p!==void 0&&Yf(a,i,de,p,u,void 0));return}}for(P in u)u.hasOwnProperty(P)&&(p=u[P],p!=null&&Ct(a,i,P,p,u,null))}function VA(a,i,u,p){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,x=null,A=null,P=null,Q=null,ae=null,de=null;for(le in u){var ge=u[le];if(u.hasOwnProperty(le)&&ge!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":Q=ge;default:p.hasOwnProperty(le)||Ct(a,i,le,null,p,ge)}}for(var ie in p){var le=p[ie];if(ge=u[ie],p.hasOwnProperty(ie)&&(le!=null||ge!=null))switch(ie){case"type":x=le;break;case"name":y=le;break;case"checked":ae=le;break;case"defaultChecked":de=le;break;case"value":A=le;break;case"defaultValue":P=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,i));break;default:le!==ge&&Ct(a,i,ie,le,p,ge)}}op(a,A,P,Q,ae,de,x,y);return;case"select":le=A=P=ie=null;for(x in u)if(Q=u[x],u.hasOwnProperty(x)&&Q!=null)switch(x){case"value":break;case"multiple":le=Q;default:p.hasOwnProperty(x)||Ct(a,i,x,null,p,Q)}for(y in p)if(x=p[y],Q=u[y],p.hasOwnProperty(y)&&(x!=null||Q!=null))switch(y){case"value":ie=x;break;case"defaultValue":P=x;break;case"multiple":A=x;default:x!==Q&&Ct(a,i,y,x,p,Q)}i=P,u=A,p=le,ie!=null?bs(a,!!u,ie,!1):!!p!=!!u&&(i!=null?bs(a,!!u,i,!0):bs(a,!!u,u?[]:"",!1));return;case"textarea":le=ie=null;for(P in u)if(y=u[P],u.hasOwnProperty(P)&&y!=null&&!p.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:Ct(a,i,P,null,p,y)}for(A in p)if(y=p[A],x=u[A],p.hasOwnProperty(A)&&(y!=null||x!=null))switch(A){case"value":ie=y;break;case"defaultValue":le=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:y!==x&&Ct(a,i,A,y,p,x)}Qv(a,ie,le);return;case"option":for(var Te in u)if(ie=u[Te],u.hasOwnProperty(Te)&&ie!=null&&!p.hasOwnProperty(Te))switch(Te){case"selected":a.selected=!1;break;default:Ct(a,i,Te,null,p,ie)}for(Q in p)if(ie=p[Q],le=u[Q],p.hasOwnProperty(Q)&&ie!==le&&(ie!=null||le!=null))switch(Q){case"selected":a.selected=ie&&typeof ie!="function"&&typeof ie!="symbol";break;default:Ct(a,i,Q,ie,p,le)}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 u)ie=u[Be],u.hasOwnProperty(Be)&&ie!=null&&!p.hasOwnProperty(Be)&&Ct(a,i,Be,null,p,ie);for(ae in p)if(ie=p[ae],le=u[ae],p.hasOwnProperty(ae)&&ie!==le&&(ie!=null||le!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,i));break;default:Ct(a,i,ae,ie,p,le)}return;default:if(cp(i)){for(var Nt in u)ie=u[Nt],u.hasOwnProperty(Nt)&&ie!==void 0&&!p.hasOwnProperty(Nt)&&Yf(a,i,Nt,void 0,p,ie);for(de in p)ie=p[de],le=u[de],!p.hasOwnProperty(de)||ie===le||ie===void 0&&le===void 0||Yf(a,i,de,ie,p,le);return}}for(var te in u)ie=u[te],u.hasOwnProperty(te)&&ie!=null&&!p.hasOwnProperty(te)&&Ct(a,i,te,null,p,ie);for(ge in p)ie=p[ge],le=u[ge],!p.hasOwnProperty(ge)||ie===le||ie==null&&le==null||Ct(a,i,ge,ie,p,le)}function tx(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function WA(){if(typeof performance.getEntriesByType=="function"){for(var a=0,i=0,u=performance.getEntriesByType("resource"),p=0;p<u.length;p++){var y=u[p],x=y.transferSize,A=y.initiatorType,P=y.duration;if(x&&P&&tx(A)){for(A=0,P=y.responseEnd,p+=1;p<u.length;p++){var Q=u[p],ae=Q.startTime;if(ae>P)break;var de=Q.transferSize,ge=Q.initiatorType;de&&tx(ge)&&(Q=Q.responseEnd,A+=de*(Q<P?1:(P-ae)/(Q-ae)))}if(--p,i+=8*(x+A)/(y.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 Qf=null,Xf=null;function cu(a){return a.nodeType===9?a:a.ownerDocument}function nx(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 ax(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 Jf(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 eh=null;function ZA(){var a=window.event;return a&&a.type==="popstate"?a===eh?!1:(eh=a,!0):(eh=null,!1)}var rx=typeof setTimeout=="function"?setTimeout:void 0,KA=typeof clearTimeout=="function"?clearTimeout:void 0,ix=typeof Promise=="function"?Promise:void 0,YA=typeof queueMicrotask=="function"?queueMicrotask:typeof ix<"u"?function(a){return ix.resolve(null).then(a).catch(QA)}:rx;function QA(a){setTimeout(function(){throw a})}function ui(a){return a==="head"}function sx(a,i){var u=i,p=0;do{var y=u.nextSibling;if(a.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(p===0){a.removeChild(y),Qs(i);return}p--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")p++;else if(u==="html")dl(a.ownerDocument.documentElement);else if(u==="head"){u=a.ownerDocument.head,dl(u);for(var x=u.firstChild;x;){var A=x.nextSibling,P=x.nodeName;x[wn]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&x.rel.toLowerCase()==="stylesheet"||u.removeChild(x),x=A}}else u==="body"&&dl(a.ownerDocument.body);u=y}while(u);Qs(i)}function ox(a,i){var u=a;a=0;do{var p=u.nextSibling;if(u.nodeType===1?i?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(i?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),p&&p.nodeType===8)if(u=p.data,u==="/$"){if(a===0)break;a--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||a++;u=p}while(u)}function th(a){var i=a.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var u=i;switch(i=i.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":th(u),Xn(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}a.removeChild(u)}}function XA(a,i,u,p){for(;a.nodeType===1;){var y=u;if(a.nodeName.toLowerCase()!==i.toLowerCase()){if(!p&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(p){if(!a[wn])switch(i){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(x=a.getAttribute("rel"),x==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(x!==y.rel||a.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||a.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||a.getAttribute("title")!==(y.title==null?null:y.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(x=a.getAttribute("src"),(x!==(y.src==null?null:y.src)||a.getAttribute("type")!==(y.type==null?null:y.type)||a.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&x&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(i==="input"&&a.type==="hidden"){var x=y.name==null?null:""+y.name;if(y.type==="hidden"&&a.getAttribute("name")===x)return a}else return a;if(a=Ca(a.nextSibling),a===null)break}return null}function JA(a,i,u){if(i==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!u||(a=Ca(a.nextSibling),a===null))return null;return a}function lx(a,i){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!i||(a=Ca(a.nextSibling),a===null))return null;return a}function nh(a){return a.data==="$?"||a.data==="$~"}function ah(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function eT(a,i){var u=a.ownerDocument;if(a.data==="$~")a._reactRetry=i;else if(a.data!=="$?"||u.readyState!=="loading")i();else{var p=function(){i(),u.removeEventListener("DOMContentLoaded",p)};u.addEventListener("DOMContentLoaded",p),a._reactRetry=p}}function Ca(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 rh=null;function cx(a){a=a.nextSibling;for(var i=0;a;){if(a.nodeType===8){var u=a.data;if(u==="/$"||u==="/&"){if(i===0)return Ca(a.nextSibling);i--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||i++}a=a.nextSibling}return null}function ux(a){a=a.previousSibling;for(var i=0;a;){if(a.nodeType===8){var u=a.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(i===0)return a;i--}else u!=="/$"&&u!=="/&"||i++}a=a.previousSibling}return null}function dx(a,i,u){switch(i=cu(u),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 dl(a){for(var i=a.attributes;i.length;)a.removeAttributeNode(i[0]);Xn(a)}var Na=new Map,px=new Set;function uu(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var Rr=Z.d;Z.d={f:tT,r:nT,D:aT,C:rT,L:iT,m:sT,X:lT,S:oT,M:cT};function tT(){var a=Rr.f(),i=tu();return a||i}function nT(a){var i=Ma(a);i!==null&&i.tag===5&&i.type==="form"?Tb(i):Rr.r(a)}var Zs=typeof document>"u"?null:document;function fx(a,i,u){var p=Zs;if(p&&typeof i=="string"&&i){var y=ya(i);y='link[rel="'+a+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),px.has(y)||(px.add(y),a={rel:a,crossOrigin:u,href:i},p.querySelector(y)===null&&(i=p.createElement("link"),En(i,"link",a),Ot(i),p.head.appendChild(i)))}}function aT(a){Rr.D(a),fx("dns-prefetch",a,null)}function rT(a,i){Rr.C(a,i),fx("preconnect",a,i)}function iT(a,i,u){Rr.L(a,i,u);var p=Zs;if(p&&a&&i){var y='link[rel="preload"][as="'+ya(i)+'"]';i==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+ya(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+ya(u.imageSizes)+'"]')):y+='[href="'+ya(a)+'"]';var x=y;switch(i){case"style":x=Ks(a);break;case"script":x=Ys(a)}Na.has(x)||(a=m({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:a,as:i},u),Na.set(x,a),p.querySelector(y)!==null||i==="style"&&p.querySelector(pl(x))||i==="script"&&p.querySelector(fl(x))||(i=p.createElement("link"),En(i,"link",a),Ot(i),p.head.appendChild(i)))}}function sT(a,i){Rr.m(a,i);var u=Zs;if(u&&a){var p=i&&typeof i.as=="string"?i.as:"script",y='link[rel="modulepreload"][as="'+ya(p)+'"][href="'+ya(a)+'"]',x=y;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Ys(a)}if(!Na.has(x)&&(a=m({rel:"modulepreload",href:a},i),Na.set(x,a),u.querySelector(y)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(fl(x)))return}p=u.createElement("link"),En(p,"link",a),Ot(p),u.head.appendChild(p)}}}function oT(a,i,u){Rr.S(a,i,u);var p=Zs;if(p&&a){var y=Un(p).hoistableStyles,x=Ks(a);i=i||"default";var A=y.get(x);if(!A){var P={loading:0,preload:null};if(A=p.querySelector(pl(x)))P.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":i},u),(u=Na.get(x))&&ih(a,u);var Q=A=p.createElement("link");Ot(Q),En(Q,"link",a),Q._p=new Promise(function(ae,de){Q.onload=ae,Q.onerror=de}),Q.addEventListener("load",function(){P.loading|=1}),Q.addEventListener("error",function(){P.loading|=2}),P.loading|=4,du(A,i,p)}A={type:"stylesheet",instance:A,count:1,state:P},y.set(x,A)}}}function lT(a,i){Rr.X(a,i);var u=Zs;if(u&&a){var p=Un(u).hoistableScripts,y=Ys(a),x=p.get(y);x||(x=u.querySelector(fl(y)),x||(a=m({src:a,async:!0},i),(i=Na.get(y))&&sh(a,i),x=u.createElement("script"),Ot(x),En(x,"link",a),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(y,x))}}function cT(a,i){Rr.M(a,i);var u=Zs;if(u&&a){var p=Un(u).hoistableScripts,y=Ys(a),x=p.get(y);x||(x=u.querySelector(fl(y)),x||(a=m({src:a,async:!0,type:"module"},i),(i=Na.get(y))&&sh(a,i),x=u.createElement("script"),Ot(x),En(x,"link",a),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(y,x))}}function hx(a,i,u,p){var y=(y=oe.current)?uu(y):null;if(!y)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(i=Ks(u.href),u=Un(y).hoistableStyles,p=u.get(i),p||(p={type:"style",instance:null,count:0,state:null},u.set(i,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){a=Ks(u.href);var x=Un(y).hoistableStyles,A=x.get(a);if(A||(y=y.ownerDocument||y,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(a,A),(x=y.querySelector(pl(a)))&&!x._p&&(A.instance=x,A.state.loading=5),Na.has(a)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Na.set(a,u),x||uT(y,a,u,A.state))),i&&p===null)throw Error(r(528,""));return A}if(i&&p!==null)throw Error(r(529,""));return null;case"script":return i=u.async,u=u.src,typeof u=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Ys(u),u=Un(y).hoistableScripts,p=u.get(i),p||(p={type:"script",instance:null,count:0,state:null},u.set(i,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function Ks(a){return'href="'+ya(a)+'"'}function pl(a){return'link[rel="stylesheet"]['+a+"]"}function mx(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function uT(a,i,u,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}),En(i,"link",u),Ot(i),a.head.appendChild(i))}function Ys(a){return'[src="'+ya(a)+'"]'}function fl(a){return"script[async]"+a}function gx(a,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var p=a.querySelector('style[data-href~="'+ya(u.href)+'"]');if(p)return i.instance=p,Ot(p),p;var y=m({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return p=(a.ownerDocument||a).createElement("style"),Ot(p),En(p,"style",y),du(p,u.precedence,a),i.instance=p;case"stylesheet":y=Ks(u.href);var x=a.querySelector(pl(y));if(x)return i.state.loading|=4,i.instance=x,Ot(x),x;p=mx(u),(y=Na.get(y))&&ih(p,y),x=(a.ownerDocument||a).createElement("link"),Ot(x);var A=x;return A._p=new Promise(function(P,Q){A.onload=P,A.onerror=Q}),En(x,"link",p),i.state.loading|=4,du(x,u.precedence,a),i.instance=x;case"script":return x=Ys(u.src),(y=a.querySelector(fl(x)))?(i.instance=y,Ot(y),y):(p=u,(y=Na.get(x))&&(p=m({},u),sh(p,y)),a=a.ownerDocument||a,y=a.createElement("script"),Ot(y),En(y,"link",p),a.head.appendChild(y),i.instance=y);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,du(p,u.precedence,a));return i.instance}function du(a,i,u){for(var p=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=p.length?p[p.length-1]:null,x=y,A=0;A<p.length;A++){var P=p[A];if(P.dataset.precedence===i)x=P;else if(x!==y)break}x?x.parentNode.insertBefore(a,x.nextSibling):(i=u.nodeType===9?u.head:u,i.insertBefore(a,i.firstChild))}function ih(a,i){a.crossOrigin==null&&(a.crossOrigin=i.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=i.referrerPolicy),a.title==null&&(a.title=i.title)}function sh(a,i){a.crossOrigin==null&&(a.crossOrigin=i.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=i.referrerPolicy),a.integrity==null&&(a.integrity=i.integrity)}var pu=null;function vx(a,i,u){if(pu===null){var p=new Map,y=pu=new Map;y.set(u,p)}else y=pu,p=y.get(u),p||(p=new Map,y.set(u,p));if(p.has(a))return p;for(p.set(a,null),u=u.getElementsByTagName(a),y=0;y<u.length;y++){var x=u[y];if(!(x[wn]||x[Vt]||a==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var A=x.getAttribute(i)||"";A=a+A;var P=p.get(A);P?P.push(x):p.set(A,[x])}}return p}function yx(a,i,u){a=a.ownerDocument||a,a.head.insertBefore(u,i==="title"?a.querySelector("head > title"):null)}function dT(a,i,u){if(u===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 bx(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function pT(a,i,u,p){if(u.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=Ks(p.href),x=i.querySelector(pl(y));if(x){i=x._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(a.count++,a=fu.bind(a),i.then(a,a)),u.state.loading|=4,u.instance=x,Ot(x);return}x=i.ownerDocument||i,p=mx(p),(y=Na.get(y))&&ih(p,y),x=x.createElement("link"),Ot(x);var A=x;A._p=new Promise(function(P,Q){A.onload=P,A.onerror=Q}),En(x,"link",p),u.instance=x}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(u,i),(i=u.state.preload)&&(u.state.loading&3)===0&&(a.count++,u=fu.bind(a),i.addEventListener("load",u),i.addEventListener("error",u))}}var oh=0;function fT(a,i){return a.stylesheets&&a.count===0&&mu(a,a.stylesheets),0<a.count||0<a.imgCount?function(u){var p=setTimeout(function(){if(a.stylesheets&&mu(a,a.stylesheets),a.unsuspend){var x=a.unsuspend;a.unsuspend=null,x()}},6e4+i);0<a.imgBytes&&oh===0&&(oh=62500*WA());var y=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&mu(a,a.stylesheets),a.unsuspend)){var x=a.unsuspend;a.unsuspend=null,x()}},(a.imgBytes>oh?50:800)+i);return a.unsuspend=u,function(){a.unsuspend=null,clearTimeout(p),clearTimeout(y)}}:null}function fu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)mu(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var hu=null;function mu(a,i){a.stylesheets=null,a.unsuspend!==null&&(a.count++,hu=new Map,i.forEach(hT,a),hu=null,fu.call(a))}function hT(a,i){if(!(i.state.loading&4)){var u=hu.get(a);if(u)var p=u.get(null);else{u=new Map,hu.set(a,u);for(var y=a.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<y.length;x++){var A=y[x];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(u.set(A.dataset.precedence,A),p=A)}p&&u.set(null,p)}y=i.instance,A=y.getAttribute("data-precedence"),x=u.get(A)||p,x===p&&u.set(null,y),u.set(A,y),this.count++,p=fu.bind(this),y.addEventListener("load",p),y.addEventListener("error",p),x?x.parentNode.insertBefore(y,x.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(y,a.firstChild)),i.state.loading|=4}}var hl={$$typeof:E,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function mT(a,i,u,p,y,x,A,P,Q){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=Ei(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ei(0),this.hiddenUpdates=Ei(null),this.identifierPrefix=p,this.onUncaughtError=y,this.onCaughtError=x,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function xx(a,i,u,p,y,x,A,P,Q,ae,de,ge){return a=new mT(a,i,u,A,Q,ae,de,ge,P),i=1,x===!0&&(i|=24),x=ea(3,null,null,i),a.current=x,x.stateNode=a,i=Pp(),i.refCount++,a.pooledCache=i,i.refCount++,x.memoizedState={element:p,isDehydrated:u,cache:i},Hp(x),a}function wx(a){return a?(a=Es,a):Es}function kx(a,i,u,p,y,x){y=wx(y),p.context===null?p.context=y:p.pendingContext=y,p=Jr(i),p.payload={element:u},x=x===void 0?null:x,x!==null&&(p.callback=x),u=ei(a,p,i),u!==null&&(Vn(u,a,i),Vo(u,a,i))}function Sx(a,i){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var u=a.retryLane;a.retryLane=u!==0&&u<i?u:i}}function lh(a,i){Sx(a,i),(a=a.alternate)&&Sx(a,i)}function jx(a){if(a.tag===13||a.tag===31){var i=_i(a,67108864);i!==null&&Vn(i,a,67108864),lh(a,67108864)}}function Cx(a){if(a.tag===13||a.tag===31){var i=ia();i=Ze(i);var u=_i(a,i);u!==null&&Vn(u,a,i),lh(a,i)}}var gu=!0;function gT(a,i,u,p){var y=V.T;V.T=null;var x=Z.p;try{Z.p=2,ch(a,i,u,p)}finally{Z.p=x,V.T=y}}function vT(a,i,u,p){var y=V.T;V.T=null;var x=Z.p;try{Z.p=8,ch(a,i,u,p)}finally{Z.p=x,V.T=y}}function ch(a,i,u,p){if(gu){var y=uh(p);if(y===null)Kf(a,i,p,vu,u),Ex(a,p);else if(bT(y,a,i,u,p))p.stopPropagation();else if(Ex(a,p),i&4&&-1<yT.indexOf(a)){for(;y!==null;){var x=Ma(y);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var A=ma(x.pendingLanes);if(A!==0){var P=x;for(P.pendingLanes|=2,P.entangledLanes|=2;A;){var Q=1<<31-Ee(A);P.entanglements[1]|=Q,A&=~Q}Ya(x),(bt&6)===0&&(Jc=ut()+500,ll(0))}}break;case 31:case 13:P=_i(x,2),P!==null&&Vn(P,x,2),tu(),lh(x,2)}if(x=uh(p),x===null&&Kf(a,i,p,vu,u),x===y)break;y=x}y!==null&&p.stopPropagation()}else Kf(a,i,p,null,u)}}function uh(a){return a=dp(a),dh(a)}var vu=null;function dh(a){if(vu=null,a=ga(a),a!==null){var i=l(a);if(i===null)a=null;else{var u=i.tag;if(u===13){if(a=c(i),a!==null)return a;a=null}else if(u===31){if(a=d(i),a!==null)return a;a=null}else if(u===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;a=null}else i!==a&&(a=null)}}return vu=a,null}function Nx(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(xe()){case X:return 2;case fe:return 8;case H:case se:return 32;case pe:return 268435456;default:return 32}default:return 32}}var ph=!1,di=null,pi=null,fi=null,ml=new Map,gl=new Map,hi=[],yT="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 Ex(a,i){switch(a){case"focusin":case"focusout":di=null;break;case"dragenter":case"dragleave":pi=null;break;case"mouseover":case"mouseout":fi=null;break;case"pointerover":case"pointerout":ml.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":gl.delete(i.pointerId)}}function vl(a,i,u,p,y,x){return a===null||a.nativeEvent!==x?(a={blockedOn:i,domEventName:u,eventSystemFlags:p,nativeEvent:x,targetContainers:[y]},i!==null&&(i=Ma(i),i!==null&&jx(i)),a):(a.eventSystemFlags|=p,i=a.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),a)}function bT(a,i,u,p,y){switch(i){case"focusin":return di=vl(di,a,i,u,p,y),!0;case"dragenter":return pi=vl(pi,a,i,u,p,y),!0;case"mouseover":return fi=vl(fi,a,i,u,p,y),!0;case"pointerover":var x=y.pointerId;return ml.set(x,vl(ml.get(x)||null,a,i,u,p,y)),!0;case"gotpointercapture":return x=y.pointerId,gl.set(x,vl(gl.get(x)||null,a,i,u,p,y)),!0}return!1}function Ax(a){var i=ga(a.target);if(i!==null){var u=l(i);if(u!==null){if(i=u.tag,i===13){if(i=c(u),i!==null){a.blockedOn=i,pt(a.priority,function(){Cx(u)});return}}else if(i===31){if(i=d(u),i!==null){a.blockedOn=i,pt(a.priority,function(){Cx(u)});return}}else if(i===3&&u.stateNode.current.memoizedState.isDehydrated){a.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}a.blockedOn=null}function yu(a){if(a.blockedOn!==null)return!1;for(var i=a.targetContainers;0<i.length;){var u=uh(a.nativeEvent);if(u===null){u=a.nativeEvent;var p=new u.constructor(u.type,u);up=p,u.target.dispatchEvent(p),up=null}else return i=Ma(u),i!==null&&jx(i),a.blockedOn=u,!1;i.shift()}return!0}function Tx(a,i,u){yu(a)&&u.delete(i)}function xT(){ph=!1,di!==null&&yu(di)&&(di=null),pi!==null&&yu(pi)&&(pi=null),fi!==null&&yu(fi)&&(fi=null),ml.forEach(Tx),gl.forEach(Tx)}function bu(a,i){a.blockedOn===i&&(a.blockedOn=null,ph||(ph=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,xT)))}var xu=null;function Rx(a){xu!==a&&(xu=a,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){xu===a&&(xu=null);for(var i=0;i<a.length;i+=3){var u=a[i],p=a[i+1],y=a[i+2];if(typeof p!="function"){if(dh(p||u)===null)continue;break}var x=Ma(u);x!==null&&(a.splice(i,3),i-=3,uf(x,{pending:!0,data:y,method:u.method,action:p},p,y))}}))}function Qs(a){function i(Q){return bu(Q,a)}di!==null&&bu(di,a),pi!==null&&bu(pi,a),fi!==null&&bu(fi,a),ml.forEach(i),gl.forEach(i);for(var u=0;u<hi.length;u++){var p=hi[u];p.blockedOn===a&&(p.blockedOn=null)}for(;0<hi.length&&(u=hi[0],u.blockedOn===null);)Ax(u),u.blockedOn===null&&hi.shift();if(u=(a.ownerDocument||a).$$reactFormReplay,u!=null)for(p=0;p<u.length;p+=3){var y=u[p],x=u[p+1],A=y[vn]||null;if(typeof x=="function")A||Rx(u);else if(A){var P=null;if(x&&x.hasAttribute("formAction")){if(y=x,A=x[vn]||null)P=A.formAction;else if(dh(y)!==null)continue}else P=A.action;typeof P=="function"?u[p+1]=P:(u.splice(p,3),p-=3),Rx(u)}}}function _x(){function a(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(A){return y=A})},focusReset:"manual",scroll:"manual"})}function i(){y!==null&&(y(),y=null),p||setTimeout(u,20)}function u(){if(!p&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,y=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(u,100),function(){p=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),y!==null&&(y(),y=null)}}}function fh(a){this._internalRoot=a}wu.prototype.render=fh.prototype.render=function(a){var i=this._internalRoot;if(i===null)throw Error(r(409));var u=i.current,p=ia();kx(u,p,a,i,null,null)},wu.prototype.unmount=fh.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var i=a.containerInfo;kx(a.current,2,null,a,null,null),tu(),i[dr]=null}};function wu(a){this._internalRoot=a}wu.prototype.unstable_scheduleHydration=function(a){if(a){var i=Qe();a={blockedOn:null,target:a,priority:i};for(var u=0;u<hi.length&&i!==0&&i<hi[u].priority;u++);hi.splice(u,0,a),u===0&&Ax(a)}};var Ox=t.version;if(Ox!=="19.2.4")throw Error(r(527,Ox,"19.2.4"));Z.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 wT={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ku=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ku.isDisabled&&ku.supportsFiber)try{Ce=ku.inject(wT),Fe=ku}catch{}}return bl.createRoot=function(a,i){if(!s(a))throw Error(r(299));var u=!1,p="",y=Pb,x=Ub,A=Bb;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(p=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(A=i.onRecoverableError)),i=xx(a,1,!1,null,null,u,p,null,y,x,A,_x),a[dr]=i.current,Zf(a),new fh(i)},bl.hydrateRoot=function(a,i,u){if(!s(a))throw Error(r(299));var p=!1,y="",x=Pb,A=Ub,P=Bb,Q=null;return u!=null&&(u.unstable_strictMode===!0&&(p=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(x=u.onUncaughtError),u.onCaughtError!==void 0&&(A=u.onCaughtError),u.onRecoverableError!==void 0&&(P=u.onRecoverableError),u.formState!==void 0&&(Q=u.formState)),i=xx(a,1,!0,i,u??null,p,y,Q,x,A,P,_x),i.context=wx(null),u=i.current,p=ia(),p=Ze(p),y=Jr(p),y.callback=null,ei(u,y,p),u=p,i.current.lanes=u,me(i,u),Ya(i),a[dr]=i.current,Zf(a),new wu(i)},bl.version="19.2.4",bl}var Fx;function OT(){if(Fx)return gh.exports;Fx=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(),gh.exports=_T(),gh.exports}var MT=OT();/**
|
|
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 Hx="popstate";function qx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function LT(e={}){function t(r,s){var h;let l=(h=s.state)==null?void 0:h.masked,{pathname:c,search:d,hash:f}=l||r.location;return _m("",{pathname:c,search:d,hash:f},s.state&&s.state.usr||null,s.state&&s.state.key||"default",l?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:Hl(s)}return IT(t,n,null,e)}function Ft(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Fa(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function DT(){return Math.random().toString(36).substring(2,10)}function Gx(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 _m(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?wo(t):t,state:n,key:t&&t.key||r||DT(),mask:s}}function Hl({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 wo(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 IT(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:l=!1}=r,c=s.history,d="POP",f=null,h=g();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function g(){return(c.state||{idx:null}).idx}function m(){d="POP";let C=g(),S=C==null?null:C-h;h=C,f&&f({action:d,location:j.location,delta:S})}function v(C,S){d="PUSH";let N=qx(C)?C:_m(j.location,C,S);h=g()+1;let E=Gx(N,h),T=j.createHref(N.mask||N);try{c.pushState(E,"",T)}catch($){if($ instanceof DOMException&&$.name==="DataCloneError")throw $;s.location.assign(T)}l&&f&&f({action:d,location:j.location,delta:1})}function b(C,S){d="REPLACE";let N=qx(C)?C:_m(j.location,C,S);h=g();let E=Gx(N,h),T=j.createHref(N.mask||N);c.replaceState(E,"",T),l&&f&&f({action:d,location:j.location,delta:0})}function k(C){return zT(s,C)}let j={get action(){return d},get location(){return e(s,c)},listen(C){if(f)throw new Error("A history only accepts one active listener");return s.addEventListener(Hx,m),f=C,()=>{s.removeEventListener(Hx,m),f=null}},createHref(C){return t(s,C)},createURL:k,encodeLocation(C){let S=k(C);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:v,replace:b,go(C){return c.go(C)}};return j}function zT(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Ft(r,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:Hl(t);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function vS(e,t,n="/"){return $T(e,t,n,!1)}function $T(e,t,n,r,s){let l=typeof t=="string"?wo(t):t,c=Ir(l.pathname||"/",n);if(c==null)return null;let d=PT(e),f=null,h=QT(c);for(let g=0;f==null&&g<d.length;++g)f=KT(d[g],h,r);return f}function PT(e){let t=yS(e);return UT(t),t}function yS(e,t=[],n=[],r="",s=!1){let l=(c,d,f=s,h)=>{let g={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(r)&&f)return;Ft(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=Ua([r,g.relativePath]),v=n.concat(g);c.children&&c.children.length>0&&(Ft(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),yS(c.children,t,v,m,f)),!(c.path==null&&!c.index)&&t.push({path:m,score:WT(m,c.index),routesMeta:v})};return e.forEach((c,d)=>{var f;if(c.path===""||!((f=c.path)!=null&&f.includes("?")))l(c,d);else for(let h of bS(c.path))l(c,d,!0,h)}),t}function bS(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),l=n.replace(/\?$/,"");if(r.length===0)return s?[l,""]:[l];let c=bS(r.join("/")),d=[];return d.push(...c.map(f=>f===""?l:[l,f].join("/"))),s&&d.push(...c),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function UT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:ZT(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var BT=/^:[\w-]+$/,FT=3,HT=2,qT=1,GT=10,VT=-2,Vx=e=>e==="*";function WT(e,t){let n=e.split("/"),r=n.length;return n.some(Vx)&&(r+=VT),t&&(r+=HT),n.filter(s=>!Vx(s)).reduce((s,l)=>s+(BT.test(l)?FT:l===""?qT:GT),r)}function ZT(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 KT(e,t,n=!1){let{routesMeta:r}=e,s={},l="/",c=[];for(let d=0;d<r.length;++d){let f=r[d],h=d===r.length-1,g=l==="/"?t:t.slice(l.length)||"/",m=od({path:f.relativePath,caseSensitive:f.caseSensitive,end:h},g),v=f.route;if(!m&&h&&n&&!r[r.length-1].route.index&&(m=od({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},g)),!m)return null;Object.assign(s,m.params),c.push({params:s,pathname:Ua([l,m.pathname]),pathnameBase:t2(Ua([l,m.pathnameBase])),route:v}),m.pathnameBase!=="/"&&(l=Ua([l,m.pathnameBase]))}return c}function od(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=YT(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let l=s[0],c=l.replace(/(.)\/+$/,"$1"),d=s.slice(1);return{params:r.reduce((h,{paramName:g,isOptional:m},v)=>{if(g==="*"){let k=d[v]||"";c=l.slice(0,l.length-k.length).replace(/(.)\/+$/,"$1")}const b=d[v];return m&&!b?h[g]=void 0:h[g]=(b||"").replace(/%2F/g,"/"),h},{}),pathname:l,pathnameBase:c,pattern:e}}function YT(e,t=!1,n=!0){Fa(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,(c,d,f,h,g)=>{if(r.push({paramName:d,isOptional:f!=null}),f){let m=g.charAt(h+c.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 QT(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Fa(!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 Ir(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 XT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function JT(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?wo(e):e,l;return n?(n=xS(n),n.startsWith("/")?l=Wx(n.substring(1),"/"):l=Wx(n,t)):l=t,{pathname:l,search:n2(r),hash:a2(s)}}function Wx(e,t){let n=ld(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function xh(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 e2(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Sg(e){let t=e2(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Id(e,t,n,r=!1){let s;typeof e=="string"?s=wo(e):(s={...e},Ft(!s.pathname||!s.pathname.includes("?"),xh("?","pathname","search",s)),Ft(!s.pathname||!s.pathname.includes("#"),xh("#","pathname","hash",s)),Ft(!s.search||!s.search.includes("#"),xh("#","search","hash",s)));let l=e===""||s.pathname==="",c=l?"/":s.pathname,d;if(c==null)d=n;else{let m=t.length-1;if(!r&&c.startsWith("..")){let v=c.split("/");for(;v[0]==="..";)v.shift(),m-=1;s.pathname=v.join("/")}d=m>=0?t[m]:"/"}let f=JT(s,d),h=c&&c!=="/"&&c.endsWith("/"),g=(l||c===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||g)&&(f.pathname+="/"),f}var xS=e=>e.replace(/\/\/+/g,"/"),Ua=e=>xS(e.join("/")),ld=e=>e.replace(/\/+$/,""),t2=e=>ld(e).replace(/^\/*/,"/"),n2=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,a2=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,r2=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 i2(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function s2(e){let t=e.map(n=>n.route.path).filter(Boolean);return Ua(t)||"/"}var wS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function kS(e,t){let n=e;if(typeof n!="string"||!XT.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(wS)try{let l=new URL(window.location.href),c=n.startsWith("//")?new URL(l.protocol+n):new URL(n),d=Ir(c.pathname,t);c.origin===l.origin&&d!=null?n=d+c.search+c.hash:s=!0}catch{Fa(!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 SS=["POST","PUT","PATCH","DELETE"];new Set(SS);var o2=["GET",...SS];new Set(o2);var ko=w.createContext(null);ko.displayName="DataRouter";var zd=w.createContext(null);zd.displayName="DataRouterState";var jS=w.createContext(!1);function l2(){return w.useContext(jS)}var CS=w.createContext({isTransitioning:!1});CS.displayName="ViewTransition";var c2=w.createContext(new Map);c2.displayName="Fetchers";var u2=w.createContext(null);u2.displayName="Await";var fa=w.createContext(null);fa.displayName="Navigation";var ec=w.createContext(null);ec.displayName="Location";var lr=w.createContext({outlet:null,matches:[],isDataRoute:!1});lr.displayName="Route";var jg=w.createContext(null);jg.displayName="RouteError";var NS="REACT_ROUTER_ERROR",d2="REDIRECT",p2="ROUTE_ERROR_RESPONSE";function f2(e){if(e.startsWith(`${NS}:${d2}:{`))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 h2(e){if(e.startsWith(`${NS}:${p2}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new r2(t.status,t.statusText,t.data)}catch{}}function m2(e,{relative:t}={}){Ft(So(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=w.useContext(fa),{hash:s,pathname:l,search:c}=tc(e,{relative:t}),d=l;return n!=="/"&&(d=l==="/"?n:Ua([n,l])),r.createHref({pathname:d,search:c,hash:s})}function So(){return w.useContext(ec)!=null}function Ha(){return Ft(So(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(ec).location}var ES="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function AS(e){w.useContext(fa).static||w.useLayoutEffect(e)}function Cg(){let{isDataRoute:e}=w.useContext(lr);return e?A2():g2()}function g2(){Ft(So(),"useNavigate() may be used only in the context of a <Router> component.");let e=w.useContext(ko),{basename:t,navigator:n}=w.useContext(fa),{matches:r}=w.useContext(lr),{pathname:s}=Ha(),l=JSON.stringify(Sg(r)),c=w.useRef(!1);return AS(()=>{c.current=!0}),w.useCallback((f,h={})=>{if(Fa(c.current,ES),!c.current)return;if(typeof f=="number"){n.go(f);return}let g=Id(f,JSON.parse(l),s,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Ua([t,g.pathname])),(h.replace?n.replace:n.push)(g,h.state,h)},[t,n,l,s,e])}w.createContext(null);function tc(e,{relative:t}={}){let{matches:n}=w.useContext(lr),{pathname:r}=Ha(),s=JSON.stringify(Sg(n));return w.useMemo(()=>Id(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function v2(e,t){return TS(e,t)}function TS(e,t,n){var C;Ft(So(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=w.useContext(fa),{matches:s}=w.useContext(lr),l=s[s.length-1],c=l?l.params:{},d=l?l.pathname:"/",f=l?l.pathnameBase:"/",h=l&&l.route;{let S=h&&h.path||"";_S(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=Ha(),m;if(t){let S=typeof t=="string"?wo(t):t;Ft(f==="/"||((C=S.pathname)==null?void 0:C.startsWith(f)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${S.pathname}" was given in the \`location\` prop.`),m=S}else m=g;let v=m.pathname||"/",b=v;if(f!=="/"){let S=f.replace(/^\//,"").split("/");b="/"+v.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})):vS(e,{pathname:b});Fa(h||k!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Fa(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=k2(k&&k.map(S=>Object.assign({},S,{params:Object.assign({},c,S.params),pathname:Ua([f,r.encodeLocation?r.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?f:Ua([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(ec.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},j):j}function y2(){let e=E2(),t=i2(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},l={padding:"2px 4px",backgroundColor:r},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:l},"ErrorBoundary")," or"," ",w.createElement("code",{style:l},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:s},n):null,c)}var b2=w.createElement(y2,null),RS=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=h2(e.digest);n&&(e=n)}let t=e!==void 0?w.createElement(lr.Provider,{value:this.props.routeContext},w.createElement(jg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?w.createElement(x2,{error:e},t):t}};RS.contextType=jS;var wh=new WeakMap;function x2({children:e,error:t}){let{basename:n}=w.useContext(fa);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=f2(t.digest);if(r){let s=wh.get(t);if(s)throw s;let l=kS(r.location,n);if(wS&&!wh.get(t))if(l.isExternal||r.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:r.replace}));throw wh.set(t,c),c}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function w2({routeContext:e,match:t,children:n}){let r=w.useContext(ko);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(lr.Provider,{value:e},n)}function k2(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,l=r==null?void 0:r.errors;if(l!=null){let g=s.findIndex(m=>m.route.id&&(l==null?void 0:l[m.route.id])!==void 0);Ft(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let c=!1,d=-1;if(n&&r){c=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:v,errors:b}=r,k=m.route.loader&&!v.hasOwnProperty(m.route.id)&&(!b||b[m.route.id]===void 0);if(m.route.lazy||k){n.isStatic&&(c=!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 v,b;f(g,{location:r.location,params:((b=(v=r.matches)==null?void 0:v[0])==null?void 0:b.params)??{},pattern:s2(r.matches),errorInfo:m})}:void 0;return s.reduceRight((g,m,v)=>{let b,k=!1,j=null,C=null;r&&(b=l&&m.route.id?l[m.route.id]:void 0,j=m.route.errorElement||b2,c&&(d<0&&v===0?(_S("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,C=null):d===v&&(k=!0,C=m.route.hydrateFallbackElement||null)));let S=t.concat(s.slice(0,v+1)),N=()=>{let E;return b?E=j:k?E=C:m.route.Component?E=w.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=g,w.createElement(w2,{match:m,routeContext:{outlet:g,matches:S,isDataRoute:r!=null},children:E})};return r&&(m.route.ErrorBoundary||m.route.errorElement||v===0)?w.createElement(RS,{location:r.location,revalidation:r.revalidation,component:j,error:b,children:N(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):N()},null)}function Ng(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function S2(e){let t=w.useContext(ko);return Ft(t,Ng(e)),t}function j2(e){let t=w.useContext(zd);return Ft(t,Ng(e)),t}function C2(e){let t=w.useContext(lr);return Ft(t,Ng(e)),t}function Eg(e){let t=C2(e),n=t.matches[t.matches.length-1];return Ft(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function N2(){return Eg("useRouteId")}function E2(){var r;let e=w.useContext(jg),t=j2("useRouteError"),n=Eg("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function A2(){let{router:e}=S2("useNavigate"),t=Eg("useNavigate"),n=w.useRef(!1);return AS(()=>{n.current=!0}),w.useCallback(async(s,l={})=>{Fa(n.current,ES),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...l}))},[e,t])}var Zx={};function _S(e,t,n){!t&&!Zx[e]&&(Zx[e]=!0,Fa(!1,n))}w.memo(T2);function T2({routes:e,manifest:t,future:n,state:r,isStatic:s,onError:l}){return TS(e,void 0,{manifest:t,state:r,isStatic:s,onError:l})}function Ml({to:e,replace:t,state:n,relative:r}){Ft(So(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=w.useContext(fa);Fa(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=w.useContext(lr),{pathname:c}=Ha(),d=Cg(),f=Id(e,Sg(l),c,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 yi(e){Ft(!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 R2({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:l=!1,useTransitions:c}){Ft(!So(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=w.useMemo(()=>({basename:d,navigator:s,static:l,useTransitions:c,future:{}}),[d,s,l,c]);typeof n=="string"&&(n=wo(n));let{pathname:h="/",search:g="",hash:m="",state:v=null,key:b="default",mask:k}=n,j=w.useMemo(()=>{let C=Ir(h,d);return C==null?null:{location:{pathname:C,search:g,hash:m,state:v,key:b,mask:k},navigationType:r}},[d,h,g,m,v,b,r,k]);return Fa(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(fa.Provider,{value:f},w.createElement(ec.Provider,{children:t,value:j}))}function _2({children:e,location:t}){return v2(Om(e),t)}function Om(e,t=[]){let n=[];return w.Children.forEach(e,(r,s)=>{if(!w.isValidElement(r))return;let l=[...t,s];if(r.type===w.Fragment){n.push.apply(n,Om(r.props.children,l));return}Ft(r.type===yi,`[${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>`),Ft(!r.props.index||!r.props.children,"An index route cannot have child routes.");let c={id:r.props.id||l.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(c.children=Om(r.props.children,l)),n.push(c)}),n}var Wu="get",Zu="application/x-www-form-urlencoded";function $d(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function O2(e){return $d(e)&&e.tagName.toLowerCase()==="button"}function M2(e){return $d(e)&&e.tagName.toLowerCase()==="form"}function L2(e){return $d(e)&&e.tagName.toLowerCase()==="input"}function D2(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function I2(e,t){return e.button===0&&(!t||t==="_self")&&!D2(e)}var Su=null;function z2(){if(Su===null)try{new FormData(document.createElement("form"),0),Su=!1}catch{Su=!0}return Su}var $2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function kh(e){return e!=null&&!$2.has(e)?(Fa(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Zu}"`),null):e}function P2(e,t){let n,r,s,l,c;if(M2(e)){let d=e.getAttribute("action");r=d?Ir(d,t):null,n=e.getAttribute("method")||Wu,s=kh(e.getAttribute("enctype"))||Zu,l=new FormData(e)}else if(O2(e)||L2(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?Ir(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Wu,s=kh(e.getAttribute("formenctype"))||kh(d.getAttribute("enctype"))||Zu,l=new FormData(d,e),!z2()){let{name:h,type:g,value:m}=e;if(g==="image"){let v=h?`${h}.`:"";l.append(`${v}x`,"0"),l.append(`${v}y`,"0")}else h&&l.append(h,m)}}else{if($d(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Wu,r=null,s=Zu,c=e}return l&&s==="text/plain"&&(c=l,l=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:l,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ag(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function OS(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&&Ir(s.pathname,t)==="/"?s.pathname=`${ld(t)}/_root.${r}`:s.pathname=`${ld(s.pathname)}.${r}`,s}async function U2(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 B2(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 F2(e,t,n){let r=await Promise.all(e.map(async s=>{let l=t.routes[s.route.id];if(l){let c=await U2(l,n);return c.links?c.links():[]}return[]}));return V2(r.flat(1).filter(B2).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Kx(e,t,n,r,s,l){let c=(f,h)=>n[h]?f.route.id!==n[h].route.id:!0,d=(f,h)=>{var g;return n[h].pathname!==f.pathname||((g=n[h].route.path)==null?void 0:g.endsWith("*"))&&n[h].params["*"]!==f.params["*"]};return l==="assets"?t.filter((f,h)=>c(f,h)||d(f,h)):l==="data"?t.filter((f,h)=>{var m;let g=r.routes[f.route.id];if(!g||!g.hasLoader)return!1;if(c(f,h)||d(f,h))return!0;if(f.route.shouldRevalidate){let v=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 v=="boolean")return v}return!0}):[]}function H2(e,t,{includeHydrateFallback:n}={}){return q2(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let l=[s.module];return s.clientActionModule&&(l=l.concat(s.clientActionModule)),s.clientLoaderModule&&(l=l.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(l=l.concat(s.hydrateFallbackModule)),s.imports&&(l=l.concat(s.imports)),l}).flat(1))}function q2(e){return[...new Set(e)]}function G2(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function V2(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let l=JSON.stringify(G2(s));return n.has(l)||(n.add(l),r.push({key:l,link:s})),r},[])}function Tg(){let e=w.useContext(ko);return Ag(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function W2(){let e=w.useContext(zd);return Ag(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Rg=w.createContext(void 0);Rg.displayName="FrameworkContext";function _g(){let e=w.useContext(Rg);return Ag(e,"You must render this element inside a <HydratedRouter> element"),e}function Z2(e,t){let n=w.useContext(Rg),[r,s]=w.useState(!1),[l,c]=w.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:h,onMouseLeave:g,onTouchStart:m}=t,v=w.useRef(null);w.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=S=>{S.forEach(N=>{c(N.isIntersecting)})},C=new IntersectionObserver(j,{threshold:.5});return v.current&&C.observe(v.current),()=>{C.disconnect()}}},[e]),w.useEffect(()=>{if(r){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[r]);let b=()=>{s(!0)},k=()=>{s(!1),c(!1)};return n?e!=="intent"?[l,v,{}]:[l,v,{onFocus:xl(d,b),onBlur:xl(f,k),onMouseEnter:xl(h,b),onMouseLeave:xl(g,k),onTouchStart:xl(m,b)}]:[!1,v,{}]}function xl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function K2({page:e,...t}){let n=l2(),{router:r}=Tg(),s=w.useMemo(()=>vS(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?n?w.createElement(Q2,{page:e,matches:s,...t}):w.createElement(X2,{page:e,matches:s,...t}):null}function Y2(e){let{manifest:t,routeModules:n}=_g(),[r,s]=w.useState([]);return w.useEffect(()=>{let l=!1;return F2(e,t,n).then(c=>{l||s(c)}),()=>{l=!0}},[e,t,n]),r}function Q2({page:e,matches:t,...n}){let r=Ha(),{future:s}=_g(),{basename:l}=Tg(),c=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let d=OS(e,l,s.v8_trailingSlashAwareDataRequests,"rsc"),f=!1,h=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?f=!0:h.push(g.route.id);return f&&h.length>0&&d.searchParams.set("_routes",h.join(",")),[d.pathname+d.search]},[l,s.v8_trailingSlashAwareDataRequests,e,r,t]);return w.createElement(w.Fragment,null,c.map(d=>w.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function X2({page:e,matches:t,...n}){let r=Ha(),{future:s,manifest:l,routeModules:c}=_g(),{basename:d}=Tg(),{loaderData:f,matches:h}=W2(),g=w.useMemo(()=>Kx(e,t,h,l,r,"data"),[e,t,h,l,r]),m=w.useMemo(()=>Kx(e,t,h,l,r,"assets"),[e,t,h,l,r]),v=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let j=new Set,C=!1;if(t.forEach(N=>{var T;let E=l.routes[N.route.id];!E||!E.hasLoader||(!g.some($=>$.route.id===N.route.id)&&N.route.id in f&&((T=c[N.route.id])!=null&&T.shouldRevalidate)||E.hasClientLoader?C=!0:j.add(N.route.id))}),j.size===0)return[];let S=OS(e,d,s.v8_trailingSlashAwareDataRequests,"data");return C&&j.size>0&&S.searchParams.set("_routes",t.filter(N=>j.has(N.route.id)).map(N=>N.route.id).join(",")),[S.pathname+S.search]},[d,s.v8_trailingSlashAwareDataRequests,f,r,l,g,t,e,c]),b=w.useMemo(()=>H2(m,l),[m,l]),k=Y2(m);return w.createElement(w.Fragment,null,v.map(j=>w.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),b.map(j=>w.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),k.map(({key:j,link:C})=>w.createElement("link",{key:j,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function J2(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var eR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{eR&&(window.__reactRouterVersion="7.17.0")}catch{}function tR({basename:e,children:t,useTransitions:n,window:r}){let s=w.useRef();s.current==null&&(s.current=LT({window:r,v5Compat:!0}));let l=s.current,[c,d]=w.useState({action:l.action,location:l.location}),f=w.useCallback(h=>{n===!1?d(h):w.startTransition(()=>d(h))},[n]);return w.useLayoutEffect(()=>l.listen(f),[l,f]),w.createElement(R2,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:l,useTransitions:n})}var MS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,LS=w.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:l,replace:c,mask:d,state:f,target:h,to:g,preventScrollReset:m,viewTransition:v,defaultShouldRevalidate:b,...k},j){let{basename:C,navigator:S,useTransitions:N}=w.useContext(fa),E=typeof g=="string"&&MS.test(g),T=kS(g,C);g=T.to;let $=m2(g,{relative:s}),R=Ha(),L=null;if(d){let q=Id(d,[],R.mask?R.mask.pathname:"/",!0);C!=="/"&&(q.pathname=q.pathname==="/"?C:Ua([C,q.pathname])),L=S.createHref(q)}let[B,O,_]=Z2(r,k),I=iR(g,{replace:c,mask:d,state:f,target:h,preventScrollReset:m,relative:s,viewTransition:v,defaultShouldRevalidate:b,useTransitions:N});function F(q){t&&t(q),q.defaultPrevented||I(q)}let K=!(T.isExternal||l),z=w.createElement("a",{...k,..._,href:(K?L:void 0)||T.absoluteURL||$,onClick:K?F:t,ref:J2(j,O),target:h,"data-discover":!E&&n==="render"?"true":void 0});return B&&!E?w.createElement(w.Fragment,null,z,w.createElement(K2,{page:$})):z});LS.displayName="Link";var nR=w.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:l,to:c,viewTransition:d,children:f,...h},g){let m=tc(c,{relative:h.relative}),v=Ha(),b=w.useContext(zd),{navigator:k,basename:j}=w.useContext(fa),C=b!=null&&uR(m)&&d===!0,S=k.encodeLocation?k.encodeLocation(m).pathname:m.pathname,N=v.pathname,E=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(N=N.toLowerCase(),E=E?E.toLowerCase():null,S=S.toLowerCase()),E&&j&&(E=Ir(E,j)||E);const T=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let $=N===S||!s&&N.startsWith(S)&&N.charAt(T)==="/",R=E!=null&&(E===S||!s&&E.startsWith(S)&&E.charAt(S.length)==="/"),L={isActive:$,isPending:R,isTransitioning:C},B=$?t:void 0,O;typeof r=="function"?O=r(L):O=[r,$?"active":null,R?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let _=typeof l=="function"?l(L):l;return w.createElement(LS,{...h,"aria-current":B,className:O,ref:g,style:_,to:c,viewTransition:d},typeof f=="function"?f(L):f)});nR.displayName="NavLink";var aR=w.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:l,method:c=Wu,action:d,onSubmit:f,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:v,...b},k)=>{let{useTransitions:j}=w.useContext(fa),C=lR(),S=cR(d,{relative:h}),N=c.toLowerCase()==="get"?"get":"post",E=typeof d=="string"&&MS.test(d),T=$=>{if(f&&f($),$.defaultPrevented)return;$.preventDefault();let R=$.nativeEvent.submitter,L=(R==null?void 0:R.getAttribute("formmethod"))||c,B=()=>C(R||$.currentTarget,{fetcherKey:t,method:L,navigate:n,replace:s,state:l,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:v});j&&n!==!1?w.startTransition(()=>B()):B()};return w.createElement("form",{ref:k,method:N,action:S,onSubmit:r?f:T,...b,"data-discover":!E&&e==="render"?"true":void 0})});aR.displayName="Form";function rR(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function DS(e){let t=w.useContext(ko);return Ft(t,rR(e)),t}function iR(e,{target:t,replace:n,mask:r,state:s,preventScrollReset:l,relative:c,viewTransition:d,defaultShouldRevalidate:f,useTransitions:h}={}){let g=Cg(),m=Ha(),v=tc(e,{relative:c});return w.useCallback(b=>{if(I2(b,t)){b.preventDefault();let k=n!==void 0?n:Hl(m)===Hl(v),j=()=>g(e,{replace:k,mask:r,state:s,preventScrollReset:l,relative:c,viewTransition:d,defaultShouldRevalidate:f});h?w.startTransition(()=>j()):j()}},[m,g,v,n,r,s,t,e,l,c,d,f,h])}var sR=0,oR=()=>`__${String(++sR)}__`;function lR(){let{router:e}=DS("useSubmit"),{basename:t}=w.useContext(fa),n=N2(),r=e.fetch,s=e.navigate;return w.useCallback(async(l,c={})=>{let{action:d,method:f,encType:h,formData:g,body:m}=P2(l,t);if(c.navigate===!1){let v=c.fetcherKey||oR();await r(v,n,c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:m,formMethod:c.method||f,formEncType:c.encType||h,flushSync:c.flushSync})}else await s(c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:m,formMethod:c.method||f,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[r,s,t,n])}function cR(e,{relative:t}={}){let{basename:n}=w.useContext(fa),r=w.useContext(lr);Ft(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),l={...tc(e||".",{relative:t})},c=Ha();if(e==null){l.search=c.search;let d=new URLSearchParams(l.search),f=d.getAll("index");if(f.some(g=>g==="")){d.delete("index"),f.filter(m=>m).forEach(m=>d.append("index",m));let g=d.toString();l.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:Ua([n,l.pathname])),Hl(l)}function uR(e,{relative:t}={}){let n=w.useContext(CS);Ft(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=DS("useViewTransitionState"),s=tc(e,{relative:t});if(!n.isTransitioning)return!1;let l=Ir(n.currentLocation.pathname,r)||n.currentLocation.pathname,c=Ir(n.nextLocation.pathname,r)||n.nextLocation.pathname;return od(s.pathname,c)!=null||od(s.pathname,l)!=null}var dR=gS();const pR="modulepreload",fR=function(e){return"/ui/"+e},Yx={},gt=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let c=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=c(n.map(h=>{if(h=fR(h),h in Yx)return;Yx[h]=!0;const g=h.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${m}`))return;const v=document.createElement("link");if(v.rel=g?"stylesheet":pR,g||(v.as="script"),v.crossOrigin="",v.href=h,f&&v.setAttribute("nonce",f),document.head.appendChild(v),g)return new Promise((b,k)=>{v.addEventListener("load",b),v.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return s.then(c=>{for(const d of c||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})},Qx=e=>{let t;const n=new Set,r=(h,g)=>{const m=typeof h=="function"?h(t):h;if(!Object.is(m,t)){const v=t;t=g??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(b=>b(t,v))}},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},hR=(e=>e?Qx(e):Qx),mR=e=>e;function gR(e,t=mR){const n=Ve.useSyncExternalStore(e.subscribe,Ve.useCallback(()=>t(e.getState()),[e,t]),Ve.useCallback(()=>t(e.getInitialState()),[e,t]));return Ve.useDebugValue(n),n}const Xx=e=>{const t=hR(e),n=r=>gR(t,r);return Object.assign(n,t),n},os=(e=>e?Xx(e):Xx),IS="dkg-layout",vR=260,Qa={leftCollapsed:!1,rightCollapsed:!1,bottomCollapsed:!0,leftSectionMyProjectsOpen:!0,leftSectionIntegrationsOpen:!1,leftWidth:240,rightWidth:360,bottomHeight:vR},zS=140,$S=400,PS=200,US=500,BS=120,cd=600,yR=240;function bR(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 ud(){const e=bR("--header-h",44),t=typeof window<"u"&&window.innerHeight?window.innerHeight:0;if(!t)return cd;const n=t-e-yR;return Math.max(0,Math.min(cd,n))}function Ku(e,t,n){return Math.max(t,Math.min(n,e))}function Sh(e,t,n,r){return typeof e!="number"||!Number.isFinite(e)?t:Ku(e,n,r)}function xR(){try{const e=localStorage.getItem(IS);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:Sh(t.leftWidth,Qa.leftWidth,zS,$S),rightWidth:Sh(t.rightWidth,Qa.rightWidth,PS,US),bottomHeight:Sh(t.bottomHeight,Qa.bottomHeight,BS,cd)}}catch{return Qa}}let ju=null;function _r(e){ju&&clearTimeout(ju),ju=setTimeout(()=>{ju=null;try{localStorage.setItem(IS,JSON.stringify(e))}catch{}},150)}function Or(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 gi=xR(),Kn=os((e,t)=>({leftCollapsed:gi.leftCollapsed,rightCollapsed:gi.rightCollapsed,bottomCollapsed:gi.bottomCollapsed,bottomMaximised:!1,leftSectionMyProjectsOpen:gi.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:gi.leftSectionIntegrationsOpen,theme:localStorage.getItem("dkg-theme")||"dark",leftWidth:gi.leftWidth,rightWidth:gi.rightWidth,bottomHeight:gi.bottomHeight,toggleLeft:()=>{e(n=>({leftCollapsed:!n.leftCollapsed})),_r(Or(t()))},toggleRight:()=>{e(n=>({rightCollapsed:!n.rightCollapsed})),_r(Or(t()))},toggleBottom:()=>{e(n=>({bottomCollapsed:!n.bottomCollapsed,bottomMaximised:!1})),_r(Or(t()))},toggleBottomMaximised:()=>{e(n=>({bottomMaximised:!n.bottomMaximised,bottomCollapsed:!1})),_r(Or(t()))},toggleLeftSectionMyProjects:()=>{e(n=>({leftSectionMyProjectsOpen:!n.leftSectionMyProjectsOpen})),_r(Or(t()))},toggleLeftSectionIntegrations:()=>{e(n=>({leftSectionIntegrationsOpen:!n.leftSectionIntegrationsOpen})),_r(Or(t()))},setTheme:n=>{localStorage.setItem("dkg-theme",n),e({theme:n})},setLeftWidth:n=>{e({leftWidth:Ku(n,zS,$S)}),_r(Or(t()))},setRightWidth:n=>{e({rightWidth:Ku(n,PS,US)}),_r(Or(t()))},setBottomHeight:n=>{const r=Math.min(BS,ud());e({bottomHeight:Ku(n,r,cd)}),_r(Or(t()))}})),Og=os(e=>({agents:[],activeAgentName:null,nodeStatus:null,setAgents:t=>e({agents:t}),setActiveAgent:t=>e({activeAgentName:t}),setNodeStatus:t=>e({nodeStatus:t})})),wR=[{id:"dashboard",label:"Dashboard",closable:!1}],hn=os((e,t)=>({tabs:wR,activeTabId:"dashboard",openTab:n=>{const{tabs:r}=t();r.find(s=>s.id===n.id)?e({activeTabId:n.id}):e({tabs:[...r,n],activeTabId:n.id})},closeTab:n=>{var d;const{tabs:r,activeTabId:s}=t(),l=r.filter(f=>f.id!==n);if(l.length===0)return;const c=s===n?((d=l[Math.max(0,r.findIndex(f=>f.id===n)-1)])==null?void 0:d.id)??l[0].id:s;e({tabs:l,activeTabId:c})},setActiveTab:n=>e({activeTabId:n})})),_a="";function Ht(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}class Pn extends Error{constructor(n,r,s){super(r??`HTTP ${n}`);pn(this,"status");pn(this,"body");this.status=n,this.body=s}}async function Mg(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 yt(e){const t=await fetch(`${_a}${e}`,{headers:Ht()});if(!t.ok){const n=await t.json().catch(()=>({})),r=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Pn(t.status,r,n)}return t.json()}async function jo(e){const t=await fetch(`${_a}${e}`,{headers:Ht()});if(!t.ok){const n=await t.json().catch(()=>({})),r=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Pn(t.status,r,n)}return t.json()}async function FS(e,t){const n=await Mg(`${_a}${e}`,{headers:Ht()},t);if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Pn(n.status,s,r)}return n.json()}async function xn(e,t){const n=await fetch(`${_a}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Ht()},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 Pn(n.status,s,r)}return n.json()}async function Lg(e,t){const n=await fetch(`${_a}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Ht()},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 kR(e){const t=await fetch(`${_a}${e}`,{method:"DELETE",headers:Ht()});if(!t.ok){const n=await t.json().catch(()=>({})),r=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Pn(t.status,r,n)}return t.json()}const dd=(e,t,n)=>{const r=new URLSearchParams;t&&r.set("key",t),n!=null&&n.extended&&r.set("extended","1");const s=r.toString();return jo(`/api/pca/${encodeURIComponent(e)}${s?`?${s}`:""}`).then(l=>n!=null&&n.extended?{...l,extendedRequested:!0}:l)},MV=e=>xn("/api/pca",{tokens:e.tokens,primaryNode:e.primaryNode}),LV=(e,t)=>xn(`/api/pca/${encodeURIComponent(e)}/agent`,{agent:t}),DV=(e,t)=>kR(`/api/pca/${encodeURIComponent(e)}/agent/${encodeURIComponent(t)}`),IV=(e,t)=>xn(`/api/pca/${encodeURIComponent(e)}/funds`,{tokens:t}),zV=e=>xn(`/api/pca/${encodeURIComponent(e)}/settle`,{}),$V=e=>jo(`/api/pca/${encodeURIComponent(e)}/agents`),SR=e=>jo(`/api/pca/agent/${encodeURIComponent(e)}`),PV=e=>jo("/api/pca/mine?hydrate=1"),UV=e=>jo(`/api/pca/designatable-nodes${e!=null&&e.fresh?"?fresh=1":""}`),jR=()=>jo("/api/pca/contracts");function HS(e){var n;if(!(e instanceof Pn))return!1;const t=(n=e.body)==null?void 0:n.code;return typeof t=="string"&&(t.startsWith("RPC_")||t==="TIMEOUT")}function BV(e){return e instanceof Pn&&e.status===503&&!HS(e)}function FV(e){if(!(e instanceof Pn)||e.status!==503)return!1;const t=e.body;return(t==null?void 0:t.code)==="PCA_LOOKUP_READ_FAILED"||(t==null?void 0:t.error)==="PCA_LOOKUP_READ_FAILED"}const CR=["PrimaryNodeNotInShardingTable","PrimaryNodeUnchanged","PrimaryNodeChangeRateLimited","ZeroPrimaryNode","InvalidAmount","ZeroAgentAddress","TokenTransferFailed","NotAccountOwner","AgentAlreadyRegistered","AgentNotRegistered","AgentCapReached","AccountExpired","AccountAlreadyFullySettled","UnknownAccount"];function HV(e,t={}){if(!(e instanceof Pn))return null;const n=e.status,r=e.body??{},s=typeof r.error=="string"&&r.error.length>0?r.error:e.message,l=t.accountId?`PCA #${t.accountId}`:"this Publisher Conviction Account",c=r.existingAccountId!=null?String(r.existingAccountId):void 0;if(HS(e))return{code:"ServerError",status:n,message:"The chain RPC is temporarily unavailable — try again."};if(n===503)return{code:"FEATURE_UNAVAILABLE",status:n,message:"Publisher Conviction Accounts aren't available on this network."};const d=CR.find(f=>new RegExp(`\\b${f}\\b`).test(s));if(d){let f;switch(d){case"InvalidAmount":f="Enter a TRAC amount greater than 0.";break;case"PrimaryNodeNotInShardingTable":f="That primary node isn't a staked node in the sharding table.";break;case"ZeroPrimaryNode":f="Choose a staked node as the primary node.";break;case"PrimaryNodeUnchanged":f="That's already this account's primary node.";break;case"PrimaryNodeChangeRateLimited":f="The primary node was changed too recently — try again later.";break;case"ZeroAgentAddress":f="Enter a valid operational wallet address.";break;case"TokenTransferFailed":f="The TRAC transfer failed — check the owner wallet's TRAC balance and allowance.";break;case"NotAccountOwner":f=`This node isn't the owner of ${l}, so it can't manage it.`;break;case"UnknownAccount":f=`${l} doesn't exist.`;break;case"AgentAlreadyRegistered":f=c?`This operational wallet is already an approved publishing wallet on PCA #${c} — deregister it there first.`:"This operational wallet is already approved on another PCA — deregister it there first.";break;case"AgentNotRegistered":f=`This operational wallet isn't an approved publishing wallet on ${l}.`;break;case"AgentCapReached":f=`${l} already has the maximum 100 approved publishing wallets.`;break;case"AccountExpired":f=`${l} has expired.`;break;case"AccountAlreadyFullySettled":f=`${l} is already fully settled.`;break;default:f=s}return{code:d,status:n,message:f,...c?{existingAccountId:c}:{}}}return n===404?{code:"UnknownAccount",status:n,message:`${l} doesn't exist.`}:n===403?{code:"NotAccountOwner",status:n,message:`This node isn't the owner of ${l}, so it can't manage it.`}:n===400?{code:"BadRequest",status:n,message:s}:n===409?{code:"Conflict",status:n,message:s}:n>=500?{code:"ServerError",status:n,message:"Something went wrong talking to the chain — try again."}:{code:"Unknown",status:n,message:s}}const Jx="did:dkg:context-graph:",qS=6e4;function GS(e){const t=e.trim();return t.startsWith(Jx)?t.slice(Jx.length):t}class pd extends Error{constructor(n,r={}){super(n);pn(this,"status");pn(this,"code");pn(this,"source");pn(this,"details");pn(this,"correlationId");pn(this,"timeoutMs");pn(this,"target");pn(this,"route");pn(this,"integrationId");pn(this,"retryable");pn(this,"text");pn(this,"timedOut");this.name="LocalAgentApiError",Object.assign(this,r)}}const Dg=()=>yt("/api/status"),qV=()=>yt("/api/settings/retention"),GV=e=>Lg("/api/settings/retention",{retentionDays:e}),VV=()=>yt("/api/settings/telemetry"),WV=e=>Lg("/api/settings/telemetry",{enabled:e}),NR=()=>yt("/api/connections"),ER=(e,t=1e4)=>Mg(`${_a}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Ht()},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()}),AR=(e,t=2e4)=>Mg(`${_a}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Ht()},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()}),Ig=()=>yt("/api/agents"),TR=()=>yt("/api/metrics"),ZV=(e,t,n=300)=>yt(`/api/metrics/history?from=${e}&to=${t}&maxPoints=${n}`),RR=(e={})=>{const t=new URLSearchParams({...e,phases:"1"}).toString();return yt(`/api/operations?${t}`)},KV=e=>yt(`/api/operations/${e}`),YV=e=>{const t=e?`?periodMs=${e}`:"";return yt(`/api/error-hotspots${t}`)},QV=(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 yt(`/api/failed-operations${n?"?"+n:""}`)},XV=e=>yt(`/api/replication/summary${e?`?periodMs=${e}`:""}`),JV=e=>yt(`/api/replication/per-cg${e?`?periodMs=${e}`:""}`),eW=(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 yt(`/api/replication/timeline${n?"?"+n:""}`)},tW=()=>yt("/api/replication/cursors"),nW=(e,t=100)=>yt(`/api/replication/events?cg=${encodeURIComponent(e)}&limit=${t}`),aW=e=>yt(`/api/success-rates?periodMs=${e}`),rW=(e,t)=>{const n=`periodMs=${e}${t?`&bucketMs=${t}`:""}`;return yt(`/api/per-type-stats?${n}`)},_R=(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 yt(`/api/node-log${n?"?"+n:""}`)};async function Pd(){return{contextGraphs:((await FS("/api/context-graph/list",qS)).contextGraphs??[]).filter(n=>!n.isSystem)}}const nc=()=>yt("/api/agent/identity");async function OR(e,t,n,r){const s=new AbortController,l=setTimeout(()=>s.abort(),3e4);try{const c=await fetch(`${_a}/api/context-graph/create`,{method:"POST",headers:{"Content-Type":"application/json",...Ht()},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(!c.ok){const d=await c.json().catch(()=>({}));throw new Error((d==null?void 0:d.error)??`HTTP ${c.status}`)}return c.json()}catch(c){throw c.name==="AbortError"?new Error("Creating project is taking longer than expected — it may still complete in the background. Refresh the page in a moment."):c}finally{clearTimeout(l)}}const MR=(e,t)=>xn(`/api/context-graph/${encodeURIComponent(e)}/remove-participant`,{agentAddress:t}),VS=e=>yt(`/api/context-graph/${encodeURIComponent(e)}/participants`),LR=e=>xn(`/api/context-graph/${encodeURIComponent(e)}/sign-join`,{}),DR=(e,t)=>xn(`/api/context-graph/${encodeURIComponent(e)}/request-join`,t),WS=e=>yt(`/api/context-graph/${encodeURIComponent(e)}/join-requests`),zg=(e,t)=>xn(`/api/context-graph/${encodeURIComponent(e)}/approve-join`,{agentAddress:t}),$g=(e,t)=>xn(`/api/context-graph/${encodeURIComponent(e)}/reject-join`,{agentAddress:t}),IR={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 zR(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 IR[t]}async function ZS(e,t,n,r){const s=new FormData;s.append("file",n),s.append("contextGraphId",t);const l=zR(n);l&&s.append("contentType",l);const c=await fetch(`${_a}/api/knowledge-assets/${encodeURIComponent(e)}/wm/import-file`,{method:"POST",headers:Ht(),body:s});if(!c.ok){const d=await c.json().catch(()=>({}));throw new Error((d==null?void 0:d.error)??`HTTP ${c.status}`)}return c.json()}const jh=new Map;function fd(e){const t=JSON.stringify(e),n=jh.get(t);if(n)return n;const r=(async()=>{const s=await fetch(`${_a}/api/query`,{method:"POST",headers:{"Content-Type":"application/json",...Ht()},body:t});if(!s.ok){const l=await s.json().catch(()=>({})),c=(l==null?void 0:l.error)??`HTTP ${s.status}`;throw new Pn(s.status,c,l)}return s.json()})().finally(()=>{jh.delete(t)});return jh.set(t,r),r}const ua=(e,t,n,r,s,l)=>fd({sparql:e,contextGraphId:t,includeSharedMemory:n,graphSuffix:r,view:s,includeContextGraphPartitions:l});async function $R(e){var l,c,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 ua(n,e),s={};for(const f of((l=r==null?void 0:r.result)==null?void 0:l.bindings)??[]){const h=typeof f.name=="string"?f.name:(c=f.name)==null?void 0:c.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 PR=(e,t)=>xn("/api/profile/query-catalog/write",{contextGraphId:e,quads:t}),UR=new Set(["clearAfter","publishEpochs","publisherNodeIdentityIdOverride"]),BR=e=>{if(typeof e=="string"&&/^\d+$/.test(e))return e;throw new Error("publisherNodeIdentityIdOverride must be passed as a decimal string")},FR=(e,t=[])=>{if(!e)return;const n=Object.keys(e).filter(l=>!UR.has(l)&&!t.includes(l));if(n.length>0)throw new Error(`Unsupported finalized publish option(s): ${n.join(", ")}`);const r={};e.clearAfter!==void 0&&(r.clearSharedMemoryAfter=e.clearAfter),e.publishEpochs!==void 0&&(r.publishEpochs=e.publishEpochs);const s=e.publisherNodeIdentityIdOverride;return s!==void 0&&(r.publisherNodeIdentityIdOverride=BR(s)),Object.keys(r).length>0?r:void 0};function HR(e){const t=e;if(Array.isArray(t.entities))throw Object.assign(new Error("Knowledge Assets are shared atomically; root-entity selection is not supported"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(t.entities!==void 0&&t.entities!=="all")throw Object.assign(new Error("Knowledge Assets are shared atomically; omit entities to share the complete asset"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(t.skipSeal===!0)throw Object.assign(new Error("Knowledge Assets are always sealed before sharing"),{code:"UNSEALED_SHARE_BLOCKED"});if(t.skipSeal!==void 0&&t.skipSeal!==!1)throw new TypeError("skipSeal must be false or omitted");if(t.awaitCuratorAck!==void 0&&typeof t.awaitCuratorAck!="boolean")throw new TypeError("awaitCuratorAck must be a boolean when supplied");return{...t.subGraphName?{subGraphName:t.subGraphName}:{},awaitCuratorAck:t.awaitCuratorAck??!0}}const qR=(e,t,n={})=>{const r=HR(n);return xn(`/api/knowledge-assets/${encodeURIComponent(t)}/swm/share`,{contextGraphId:GS(e),...r.subGraphName?{subGraphName:r.subGraphName}:{},awaitCuratorAck:r.awaitCuratorAck})},Pg=(e,t,n={})=>{const r=FR(n,["subGraphName"]);return xn(`/api/knowledge-assets/${encodeURIComponent(t)}/vm/publish`,{contextGraphId:GS(e),...n.subGraphName?{subGraphName:n.subGraphName}:{},...r?{options:r}:{}})};async function Ug(e,t){let n=0,r=0,s;const l=[];let c=null,d=0n,f=0n,h=0n,g=0n,m,v=!0,b=!0;for(const j of t)try{const C=await Pg(e,j.name,j.subGraph?{subGraphName:j.subGraph}:{});n+=1,C.contextGraphError&&(r+=1,s===void 0&&(s=C.contextGraphError));const S=C;(!c||S.status==="confirmed"&&S.txHash&&!S.contextGraphError)&&(c=S);const N=S.convictionCostCovered;if(N)try{d+=BigInt(N.baseCost),f+=BigInt(N.discountedCost),h+=BigInt(N.drawnFromEpoch),g+=BigInt(N.drawnFromTopUp),m?(N.accountId!==m.accountId&&(v=!1),N.epoch!==m.epoch&&(b=!1)):m=N}catch{}}catch(C){const S=(C==null?void 0:C.message)??"publish failed";l.push({name:j.name,...j.subGraph?{subGraph:j.subGraph}:{},error:S})}const k=m?{...v&&m.accountId?{accountId:m.accountId}:{},...b&&m.epoch!=null?{epoch:m.epoch}:{},baseCost:d.toString(),discountedCost:f.toString(),drawnFromEpoch:h.toString(),drawnFromTopUp:g.toString()}:void 0;return{published:n,total:t.length,partial:r,partialError:s,failures:l,sample:c,convictionCostCovered:k}}async function ac(e,t="wm"){var j,C,S,N,E,T,$,R;if(t==="swm"){const L=`did:dkg:context-graph:${e}/_meta`,B=`did:dkg:context-graph:${e}/`,O=`urn:dkg:assertion:${e}:`,_=`SELECT ?g ?vm WHERE {
|
|
67
|
+
GRAPH <${L}> {
|
|
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
|
+
}`,I=await ua(_,e),F=((j=I==null?void 0:I.result)==null?void 0:j.bindings)??[],K=new Set,z=[];for(const Z of F){const Y=typeof Z.g=="string"?Z.g:(C=Z.g)==null?void 0:C.value;if(!Y)continue;const W=typeof Z.vm=="string"?Z.vm:(S=Z.vm)==null?void 0:S.value;let D,U;if(Y.startsWith(B)){const M=Y.slice(B.length).split("/");if(M.length===3&&M[0]==="assertion")U=M[2];else if(M.length===4&&M[1]==="assertion")D=M[0],U=M[3];else continue}else if(Y.startsWith(O)){const M=Y.slice(O.length);let ee=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(M);ee?U=ee[2]:(ee=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(M),ee&&(D=ee[1],U=ee[3]))}else continue;if(!U||D==="meta")continue;const G=`${D??""} ${U}`;z.push({key:G,name:U,subGraph:D,g:Y}),W&&K.add(G)}const q=new Set,V=[];for(const Z of z)K.has(Z.key)||q.has(Z.key)||(q.add(Z.key),V.push({name:Z.name,graphUri:Z.g,subGraph:Z.subGraph}));return V}const n=`did:dkg:context-graph:${e}/_meta`,r=`did:dkg:context-graph:${e}/`,s='FILTER(!CONTAINS(STR(?g), "/meta/assertion/"))',l=`SELECT ?g WHERE {
|
|
73
|
+
GRAPH <${n}> { ?g <http://dkg.io/ontology/memoryLayer> "WM" }
|
|
74
|
+
${s}
|
|
75
|
+
}`,c=`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([fd({sparql:l,contextGraphId:e,includeContextGraphPartitions:!0}),fd({sparql:c,contextGraphId:e,includeContextGraphPartitions:!0}).catch(()=>null)]),h=((N=d==null?void 0:d.result)==null?void 0:N.bindings)??[],g=new Map;for(const L of((E=f==null?void 0:f.result)==null?void 0:E.bindings)??[]){const B=typeof L.g=="string"?L.g:(T=L.g)==null?void 0:T.value,O=typeof L.cnt=="string"?L.cnt:($=L.cnt)==null?void 0:$.value,_=typeof O=="string"?O.match(/^"?(\d+)/):null,I=_?parseInt(_[1],10):NaN;B&&Number.isFinite(I)&&g.set(B,I)}const m=[],v=new Set,b=`urn:dkg:assertion:${e}:`,k=[...h].sort((L,B)=>{var I,F;const O=(typeof L.g=="string"?L.g:(I=L.g)==null?void 0:I.value)??"",_=(typeof B.g=="string"?B.g:(F=B.g)==null?void 0:F.value)??"";return(O.startsWith(r)?0:1)-(_.startsWith(r)?0:1)});for(const L of k){const B=typeof L.g=="string"?L.g:(R=L.g)==null?void 0:R.value;if(!B)continue;let O,_;if(B.startsWith(r)){const K=B.slice(r.length).split("/");if(K.length===3&&K[0]==="assertion")_=K[2];else if(K.length===4&&K[1]==="assertion")O=K[0],_=K[3];else continue}else if(B.startsWith(b)){const K=B.slice(b.length);let z=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(K);z?_=z[2]:(z=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(K),z&&(O=z[1],_=z[3]))}else continue;if(!_||O==="meta")continue;const I=`${O??""}\0${_}`;if(v.has(I))continue;v.add(I);const F=g.get(B);m.push({name:_,graphUri:B,tripleCount:F,subGraph:O})}return m}const ho=(e,t,n,r)=>{if(Array.isArray(n))throw Object.assign(new Error("Knowledge Assets are shared atomically; root-entity selection is not supported"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(typeof n=="string"&&n!=="all")throw Object.assign(new Error("Knowledge Assets are shared atomically; omit entities to share the complete asset"),{code:"KA_ATOMIC_SHARE_REQUIRED"});const s=n===void 0||typeof n=="string"?{subGraphName:r}:{...n,subGraphName:n.subGraphName??r};return qR(e,t,s)};function Bg(e,t){return t.promotedCount>0?{kind:"success",promotedCount:t.promotedCount,message:`Shared the complete Knowledge Asset ${e} to Shared Working Memory (${t.promotedCount} triple${t.promotedCount===1?"":"s"}).`}:{kind:"noop",message:`${e} was not newly shared. Its complete Knowledge Asset may already be in Shared Working Memory, or its content is still being committed — refresh and try again.`}}function mo(e,t){if(t instanceof Pn&&t.status===413){const n=t.body;if((n==null?void 0:n.code)==="SWM_GOSSIP_PAYLOAD_TOO_LARGE")return{kind:"payload-too-large",actualBytes:typeof n.actualBytes=="number"?n.actualBytes:void 0,limitBytes:typeof n.limitBytes=="number"?n.limitBytes:void 0,message:`${e} is too large to share atomically. Split its content into smaller Knowledge Assets before sharing.`}}if(t instanceof Pn&&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 GR=(e,t,n)=>{const r=new URLSearchParams({contextGraphId:t});return n&&r.set("subGraphName",n),yt(`/api/knowledge-assets/${encodeURIComponent(e)}/wm/extraction-status?${r}`)};function Yu(e,t){const n=e.startsWith("sha256:")||e.startsWith("keccak256:")?e:`sha256:${e}`,r=t?`?contentType=${encodeURIComponent(t)}`:"";return`${_a}/api/file/${encodeURIComponent(n)}${r}`}const VR="binding incomplete";function ql(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 WR=(e=20)=>yt(`/api/memory/sessions?limit=${e}`),ZR=(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 yt(`/api/memory/sessions/${encodeURIComponent(e)}${r?`?${r}`:""}`)};function KS(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 KR(e,t={}){var m;const n=await fetch("/api/openclaw-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Ht()},body:JSON.stringify(KS(e,t)),signal:t.signal});if(!n.ok){const v=await n.json().catch(()=>({}));throw hd(v,`Request failed (${n.status})`,n.status)}const r=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!r.includes("text/event-stream")){const v=await n.json();return(m=t.onEvent)==null||m.call(t,{type:"final",...v}),v}const s=n.body.getReader(),l=new TextDecoder;let c="",d,f;const h=v=>{var b;(b=t.onEvent)==null||b.call(t,v),v.type==="error"?f=hd(v,v.error||"Stream failed"):v.type==="final"&&(d={text:v.text,correlationId:v.correlationId,...v.sessionId?{sessionId:v.sessionId}:{},...v.turnId?{turnId:v.turnId}:{}})},g=v=>{let b=c.indexOf(`
|
|
83
|
+
`);for(;b!==-1;){const k=c.slice(0,b).trim();if(c=c.slice(b+1),b=c.indexOf(`
|
|
84
|
+
`),!k.startsWith("data:"))continue;const j=k.slice(5).trim();if(j){try{h(JSON.parse(j))}catch{}if(f)return}}if(v&&c.trim().startsWith("data:")){const k=c.trim().slice(5).trim();if(!k)return;try{h(JSON.parse(k))}catch{}c=""}};for(;;){const{done:v,value:b}=await s.read();if(v||(c+=l.decode(b,{stream:!0}),g(!1),f))break;if(d)return s.cancel().catch(()=>{}),d}if(c+=l.decode(),g(!0),f)throw f;if(!d)throw new Error("Stream ended without final payload");return d}const YR=()=>yt("/api/openclaw-channel/health");async function YS(e,t,n={}){var b;const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Ht()},body:JSON.stringify(KS(t,n)),signal:n.signal});if(!r.ok){const k=await r.json().catch(()=>({}));throw hd(k,`Request failed (${r.status})`,r.status)}const s=(r.headers.get("content-type")??"").toLowerCase();if(!r.body||!s.includes("text/event-stream")){const k=await r.json();return(b=n.onEvent)==null||b.call(n,{type:"final",...k}),k}const l=r.body.getReader(),c=new TextDecoder;let d="",f,h;const g=k=>k.type==="delta"?{type:"text_delta",delta:k.text??""}:k,m=k=>{var j;(j=n.onEvent)==null||j.call(n,k),k.type==="error"?h=hd(k,k.error||"Stream failed"):k.type==="final"&&(f={text:k.text,correlationId:k.correlationId,...k.sessionId?{sessionId:k.sessionId}:{},...k.turnId?{turnId:k.turnId}:{}})},v=k=>{let j=d.indexOf(`
|
|
85
|
+
`);for(;j!==-1;){const C=d.slice(0,j).trim();if(d=d.slice(j+1),j=d.indexOf(`
|
|
86
|
+
`),!C.startsWith("data:"))continue;const S=C.slice(5).trim();if(S){try{m(g(JSON.parse(S)))}catch{}if(h)return}}if(k&&d.trim().startsWith("data:")){const C=d.trim().slice(5).trim();if(!C)return;try{m(g(JSON.parse(C)))}catch{}d=""}};for(;;){const{done:k,value:j}=await l.read();if(k||(d+=c.decode(j,{stream:!0}),v(!1),h))break;if(f)return l.cancel().catch(()=>{}),f}if(d+=c.decode(),v(!0),h)throw h;if(!f)throw new Error("Stream ended without final payload");return f}const QR=(e,t={})=>YS("/api/hermes-channel/stream",e,t),XR=()=>yt("/api/hermes-channel/health"),JR=(e,t={})=>YS("/api/prime-agent-channel/stream",e,t),e_=()=>yt("/api/prime-agent-channel/health");function t_(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 hd(e,t,n){if(!e||typeof e!="object"||Array.isArray(e))return new pd(t,{status:n});const r=e,s=t_(r,t),l=h=>{const g=r[h];return typeof g=="string"&&g.trim()?g.trim():void 0},c=h=>{const g=r[h];return typeof g=="number"&&Number.isFinite(g)?g:void 0},d=h=>{const g=r[h];return typeof g=="boolean"?g:void 0},f=typeof r.text=="string"&&r.text.trim()?r.text:void 0;return new pd(s,{status:n,code:l("code"),source:l("source"),details:l("details"),correlationId:l("correlationId"),timeoutMs:c("timeoutMs"),target:l("target"),route:l("route"),integrationId:l("integrationId"),retryable:d("retryable"),text:f,timedOut:d("timedOut")})}const Ud={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:YR,streamChat:KR},hermes:{connectSupported:!0,chatSupported:!0,defaultSessionId:({integrationId:e,record:t,health:n})=>s_(e,t,n),resolveChatContext:({sessionId:e,profile:t})=>({...e?{sessionId:e}:{},...t?{profile:t}:{}}),fetchHealth:XR,streamChat:QR},"prime-agent":{connectSupported:!0,chatSupported:!0,defaultSessionId:({record:e,health:t})=>l_(e,t),resolveChatContext:({sessionId:e,liveSession:t})=>{if(!t)return{};if(e&&t.sessionId!==e)throw new Error("Prime Agent live session does not match the selected conversation");return{sessionId:t.rawSessionId}},fetchHealth:e_,streamChat:JR}};function so(e){var n,r;const t=e.trim().toLowerCase();return((r=(n=Ud[t])==null?void 0:n.defaultSessionId)==null?void 0:r.call(n,{integrationId:t}))??null}function n_(e,t){return t!=null&&t.trim()?t.trim():so(e)}async function a_(e,t=50){const n=r=>{if(r.turnId)return`urn:dkg:chat:turn:${encodeURIComponent(r.turnId)}:${encodeURIComponent(r.author)}`;const s=`${e}
|
|
87
|
+
${r.author}
|
|
88
|
+
${r.ts}
|
|
89
|
+
${r.text}`;let l=2166136261;for(let c=0;c<s.length;c+=1)l^=s.charCodeAt(c),l=Math.imul(l,16777619);return`urn:dkg:chat:session:${encodeURIComponent(e)}:message:${(l>>>0).toString(16)}`};try{return[...(await ZR(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 Pn&&r.status===404)return[];throw r}}function r_(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 md(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return null}function i_(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||Fg(e)}function Fg(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 s_(e,t,n){const r=(t==null?void 0:t.metadata)??{},s=md(n==null?void 0:n.profile,r.profileName,r.profile),l=md(r.hermesHome),c=l?null:o_(t),d=[s?`profile-${i_(s)}`:null,l?`home-${Fg(l)}`:null,c].filter(f=>f!=null);return d.length?`${e}:dkg-ui:${d.join(":")}`:`${e}:dkg-ui`}function o_(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-${Fg(n.join("|"))}`:null}function l_(e,t){var n,r,s;return md((n=e==null?void 0:e.metadata)==null?void 0:n.activeMemorySessionId,(s=(r=t==null?void 0:t.sessions)==null?void 0:r[0])==null?void 0:s.memorySessionId)??void 0}function c_(e){return e?typeof e=="string"?e:[e.provider,e.mode,e.status].filter(Boolean).join(" / ")||null:null}function u_(e,t){if(e==="degraded")return!0;const n=String((t==null?void 0:t.status)??"").toLowerCase(),r=t==null?void 0:t.memory;return n.includes("degraded")||n.includes("conflict")||typeof r=="object"&&r!=null&&r.conflict===!0}function QS(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function e1(e){if(!QS(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 d_(e){if(e.target==="bridge")return{target:"bridge",details:e.bridge};if(e.target==="gateway")return{target:"gateway",details:e.gateway};const t=e1(e.bridge),n=e1(e.gateway);return t<0&&n<0?{}:t>=n?{target:"bridge",details:e.bridge}:{target:"gateway",details:e.gateway}}function p_(e){if(!e)return null;const{target:t,details:n}=d_(e);if(!QS(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 f_(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=c_(t==null?void 0:t.memory),l=typeof(t==null?void 0:t.memory)=="object"&&t.memory!=null?t.memory:null;return(l==null?void 0:l.conflict)===!0||String((t==null?void 0:t.status)??"").toLowerCase().includes("conflict")?`${e.name} ${r} has a memory provider conflict${s?` (${s})`:""}.`:t!=null&&t.ok?`${e.name} ${r} is connected${s?` with ${s} memory`:""}.`:t!=null&&t.status?`${e.name} ${r} reports ${t.status}${s?` (${s})`:""}.`:null}async function Hg(e){var R,L,B,O,_,I,F,K,z,q,V,Z,Y,W,D,U;const t=String(e.id??"").toLowerCase(),n=Ud[t],r=((R=e.capabilities)==null?void 0:R.localChat)===!0&&(n==null?void 0:n.chatSupported)===!0,s=r&&((L=e.capabilities)==null?void 0:L.chatAttachments)===!0,l=((B=e.capabilities)==null?void 0:B.connectFromUi)===!0&&(n==null?void 0:n.connectSupported)===!0,c=e.enabled===!0,d=(O=e.runtime)==null?void 0:O.status,f=c&&r&&(n!=null&&n.fetchHealth)?p_(await n.fetchHealth().catch(()=>null)):null,h=u_(d,f),g=(f==null?void 0:f.ok)===!0&&!h,m=g,v=c&&r&&(g||d==="connecting"||d==="degraded"||((_=e.runtime)==null?void 0:_.ready)===!0||r_(e)),b=f_(e,f),k=(I=n==null?void 0:n.defaultSessionId)==null?void 0:I.call(n,{integrationId:t,record:e,health:f}),j=t==="prime-agent"&&(f==null?void 0:f.busy)===!0&&f.clientConnected===!1,C=t==="prime-agent"&&Array.isArray(f==null?void 0:f.sessions)?f.sessions.filter(G=>typeof(G==null?void 0:G.rawSessionId)=="string"&&G.rawSessionId.trim()&&typeof G.memorySessionId=="string"&&G.memorySessionId.trim()).map(G=>({...G,sessionId:G.memorySessionId.trim(),rawSessionId:G.rawSessionId.trim()})):void 0,S=t==="hermes"?md(f==null?void 0:f.profile,(F=e.metadata)==null?void 0:F.profileName,(K=e.metadata)==null?void 0:K.profile)??void 0:void 0;let N,E,T;v&&h?(N="degraded",E="Degraded",T=b??(f==null?void 0:f.error)??((z=e.runtime)==null?void 0:z.lastError)??`${e.name} is attached to this node, but one capability is degraded.`):v&&((q=e.runtime)==null?void 0:q.status)==="connecting"?(N="connecting",E="Connecting",T=((V=e.runtime)==null?void 0:V.lastError)??`${e.name} is registered and still starting up.`):m?(N="chat_ready",E=j?"Still working":f!=null&&f.busy?"Working":"Chat ready",T=j?`${e.name} is still working after the browser stream disconnected. Wait for it to finish before sending another message.`:f!=null&&f.busy?`${e.name} is working on the current turn.`:`${e.name} is connected to this node and ready for chat.`):v?(N="bridge_offline",E="Bridge offline",T=b??(f==null?void 0:f.error)??((Z=e.runtime)==null?void 0:Z.lastError)??`${e.name} is attached to this node, but it is not responding right now.`):n?(N="available",E=l?"Ready to connect":"Awaiting chat bridge",T=c?`${e.name} is registered, but this panel is waiting for the framework chat bridge.`:((Y=e.runtime)==null?void 0:Y.lastError)??`Use the node-served skill plus ${e.name} onboarding to attach an existing local agent.`):(N="coming_soon",E=c?"Registered, panel pending":"Next integration",T=c?`${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 $=m?"Connected":N==="connecting"?"Connecting":N==="degraded"?"Degraded":v?"Unavailable":l?"Ready to connect":"Coming next";return{id:t,name:e.name,framework:e.name,description:e.description,defaultSessionId:k,profile:S,chatSupported:r,chatAttachments:s,connectSupported:l,configured:c,detected:c||g,persistentChat:v,chatReady:g,bridgeOnline:m,bridgeStatusLabel:$,status:N,statusLabel:E,detail:T,error:g?void 0:(f==null?void 0:f.error)??((W=e.runtime)==null?void 0:W.lastError)??void 0,target:f==null?void 0:f.target,source:c||n?"live":"planned",...typeof((D=e.metadata)==null?void 0:D.sessionCount)=="number"?{sessionCount:e.metadata.sessionCount}:{},...typeof((U=e.metadata)==null?void 0:U.activeSessionId)=="string"?{activeSessionId:e.metadata.activeSessionId}:{},...C!=null&&C.length?{liveSessions:C}:{},...typeof(f==null?void 0:f.busy)=="boolean"?{busy:f.busy}:{}}}async function Bd(){const e=await yt("/api/local-agent-integrations"),t=await Promise.all((e.integrations??[]).map(Hg));return t.sort((n,r)=>{const s=n.id==="openclaw"?0:1,l=r.id==="openclaw"?0:1;return s!==l?s-l:n.persistentChat!==r.persistentChat?n.persistentChat?-1:1:n.name.localeCompare(r.name)}),{integrations:t}}async function h_(e){const t=e.trim().toLowerCase(),n=Ud[t];if(!(n!=null&&n.connectSupported))throw new Error(`${e} local connect is not available yet.`);const r=await xn("/api/local-agent-integrations/connect",{id:t,metadata:{source:"node-ui"}}),s=r.integration?await Hg(r.integration):(await Bd()).integrations.find(l=>l.id===t);if(!s)throw new Error(`Missing local agent integration: ${t}`);return{integration:s,notice:r.notice}}async function m_(e){const t=e.trim().toLowerCase();await Lg(`/api/local-agent-integrations/${encodeURIComponent(t)}`,{enabled:!1,runtime:{status:"disconnected",ready:!1,lastError:null}})}async function g_(e){const t=e.trim().toLowerCase(),n=await xn(`/api/local-agent-integrations/${encodeURIComponent(t)}/refresh`,{}),r=n.integration?await Hg(n.integration):(await Bd()).integrations.find(s=>s.id===t);if(!r)throw new Error(`Missing local agent integration: ${t}`);return{integration:r,notice:n.notice}}async function t1(e,t=50,n={}){const r=n_(e,n.sessionId);return r?a_(r,t):[]}async function v_(e){var n;const t=(n=e.sessionId)==null?void 0:n.trim();if(!t)throw new Error("Missing Hermes session id");return xn("/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 y_(e,t){if(e.trim().toLowerCase()==="hermes")return v_(t);throw new Error(`${e} local chat persistence is not available yet.`)}async function b_(e,t,n={}){const r=e.trim().toLowerCase(),s=Ud[r];if(s!=null&&s.streamChat){const{sessionId:l,liveSession:c,profile:d,...f}=n,h=(g,m)=>{var v;return{...f,...(v=s.resolveChatContext)==null?void 0:v.call(s,{integrationId:r,sessionId:g,liveSession:m,profile:d})}};try{return await s.streamChat(t,h(l,c))}catch(g){if(r==="prime-agent"&&c&&g instanceof pd&&g.code==="PRIME_AGENT_NO_SESSION")return s.streamChat(t,h());throw g}}throw new Error(`${e} local chat is not available yet.`)}const x_=()=>yt("/api/economics"),qg=()=>yt("/api/wallets/balances"),iW=()=>xn("/api/shutdown",{}),w_=(e,t)=>xn("/api/subscribe",{contextGraphId:e,syncMode:(t==null?void 0:t.syncMode)??"on-demand"}),k_=()=>yt("/api/notifications"),XS=e=>xn("/api/notifications/read",e?{ids:e}:{}),Gg=e=>FS(`/api/sub-graph/list?contextGraphId=${encodeURIComponent(e)}`,qS),S_={name:"my-dkg-node",networkName:"DKG Mainnet",connectedPeers:12,synced:!0,version:"10.0.0-rc"},j_={total_kcs:1842,confirmed_kcs:1623,tentative_kcs:219},C_={agents:[{name:"my-dkg-node",peerId:"QmYourNode123",connectionStatus:"self"},{name:"research-agent",peerId:"QmResearch456",connectionStatus:"connected",lastSeen:Date.now()},{name:"data-curator",peerId:"QmCurator789",connectionStatus:"connected",lastSeen:Date.now()-6e4},{name:"pharma-bot",peerId:"QmPharma012",connectionStatus:"discovered",lastSeen:Date.now()-3e5}]},N_={contextGraphs:[{id:"cg:pharma-drug-interactions",name:"Pharma Drug Interactions",description:"Drug interaction knowledge graph for clinical decision support",assetCount:227,agentCount:3,callerInvolved:!0,curator:"did:dkg:agent:0x1111111111111111111111111111111111111111"},{id:"cg:climate-science",name:"Climate Science",description:"Climate research data and projections",assetCount:45,agentCount:2,callerInvolved:!0,curator:"did:dkg:agent:0x1111111111111111111111111111111111111111"},{id:"cg:supply-chain-eu",name:"EU Supply Chain",description:"European supply chain provenance tracking",assetCount:89,agentCount:1,callerInvolved:!0,curator:"did:dkg:agent:0x5555555555555555555555555555555555555555"}]},E_={"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:[]}},A_={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},T_={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}]},R_={agentAddress:"0x1111111111111111111111111111111111111111",agentDid:"did:dkg:agent:0x1111111111111111111111111111111111111111",name:"mock-node-agent",framework:"mock",peerId:"QmMockNodeAgentPeer000000000000000000000000",nodeIdentityId:"mock-node-identity"},__={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"},O_={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},M_={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},L_={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 sa(e,t=50){return new Promise(n=>setTimeout(()=>n(e),t))}const oa={fetchStatus:()=>sa(S_),fetchMetrics:()=>sa(j_),fetchAgents:()=>sa(C_),fetchContextGraphs:()=>sa(N_),fetchOperationsWithPhases:()=>sa(A_),fetchEconomics:()=>sa(T_),fetchWalletsBalances:()=>sa(__),fetchCurrentAgent:()=>sa(R_),listParticipants:e=>sa(E_[e]??{contextGraphId:e,allowedAgents:[]}),fetchSubGraphs:e=>sa({contextGraphId:e,subGraphs:[]}),fetchNotificationsFeed:()=>sa(O_),fetchNodeLog:()=>sa(M_),fetchMemorySessions:()=>sa(L_)};let Mr=null,wl=null;const D_=5e3,n1=2,I_=250,Mm=new Set;function z_(){return Mr===!0}function $_(e){return Mm.add(e),e(Mr===!0),()=>{Mm.delete(e)}}function P_(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}function U_(e){return new Promise(t=>setTimeout(t,e))}async function B_(){for(let e=1;e<=n1;e+=1){try{const t=await fetch("/api/status",{cache:"no-store",headers:P_(),signal:AbortSignal.timeout(D_)});if(t.ok||t.status===401)return!1}catch{}e<n1&&await U_(I_)}return!0}async function F_(){if(Mr!==null)return Mr;if(wl)return wl;wl=(async()=>(Mr=await B_(),typeof window<"u"&&(window.__DKG_USING_MOCKS__=Mr,Mr&&console.warn("[dkg-ui] /api/status unreachable (timeout/5xx/network) — falling back to demo (mock) data. The UI is NOT showing live node state.")),Mm.forEach(e=>e(Mr)),Mr))();try{return await wl}finally{wl=null}}async function la(e,t){return await F_()?t():e()}const _n={fetchStatus:()=>la(Dg,oa.fetchStatus),fetchMetrics:()=>la(TR,oa.fetchMetrics),fetchAgents:()=>la(Ig,oa.fetchAgents),fetchContextGraphs:()=>la(Pd,oa.fetchContextGraphs),fetchOperationsWithPhases:e=>la(()=>RR(e),oa.fetchOperationsWithPhases),fetchEconomics:()=>la(x_,oa.fetchEconomics),fetchWalletsBalances:()=>la(qg,oa.fetchWalletsBalances),fetchCurrentAgent:()=>la(nc,oa.fetchCurrentAgent),listParticipants:e=>la(()=>VS(e),()=>oa.listParticipants(e)),fetchSubGraphs:e=>la(()=>Gg(e),()=>oa.fetchSubGraphs(e)),fetchNotificationsFeed:()=>la(k_,oa.fetchNotificationsFeed),fetchNodeLog:e=>la(()=>_R(e),oa.fetchNodeLog),fetchMemorySessions:e=>la(()=>WR(e),oa.fetchMemorySessions),markNotificationsRead:XS,executeQuery:ua},H_=6e4;let ki={data:null,loading:!0,error:null},nr=null,Il=null,Ll=0,wi="";const gd=new Set;function Qi(){if(typeof window>"u")return"";const e=window.__DKG_TOKEN__;return e?`Bearer ${e}`:""}function Qu(e){wi=e,ki={data:null,loading:!0,error:null}}function Ch(){const e=Qi();return e!==wi&&Qu(e),ki}function Xu(){for(const e of gd)e()}function Nh(e){ki=e,Xu()}function vd(){const e=Ll,t=Qi();if((nr==null?void 0:nr.authKey)===t)return nr.promise;t!==wi?(Qu(t),Xu()):Nh({...ki,loading:!0,error:null});const n=_n.fetchCurrentAgent().then(r=>{if(e===Ll){if(t!==Qi()){const s=Qi(),l=wi!==s||ki.loading;wi!==s&&(Qu(s),Xu()),l&&vd();return}Nh({data:r,loading:!1,error:null})}}).catch(r=>{if(e===Ll){if(t!==Qi()){const s=Qi(),l=wi!==s||ki.loading;wi!==s&&(Qu(s),Xu()),l&&vd();return}Nh({data:ki.data,loading:!1,error:r instanceof Error?r.message:"Failed to load current agent"})}}).finally(()=>{e===Ll&&(nr==null?void 0:nr.promise)===n&&(nr=null)});return nr={authKey:t,promise:n},n}function q_(){vd(),!Il&&(Il=setInterval(()=>{vd()},H_))}function G_(){gd.size>0||!Il||(clearInterval(Il),Il=null,Ll+=1,nr=null,ki={data:null,loading:!0,error:null},wi=Qi())}function Fd(){const[e,t]=w.useState(Ch);return w.useEffect(()=>{const n=()=>t(Ch());return gd.add(n),t(Ch()),q_(),()=>{gd.delete(n),G_()}},[]),e}const Ta=os(e=>({contextGraphs:[],loading:!1,activeProjectId:null,setContextGraphs:t=>e({contextGraphs:t}),setLoading:t=>e({loading:t}),setActiveProject:t=>e({activeProjectId:t})})),oo=new Set;let bn=null,Ju=null;const V_=350;function a1(e){return e==="wm"||e==="swm"||e==="vm"}function W_(e){const t=e.layers;return Array.isArray(t)?t.filter(a1):a1(e.layer)?[e.layer]:[]}function Z_(e,t,n){if(!t||e.contextGraphId!==t)return!1;if(!n||n.length===0)return!0;const r=W_(e);return r.length===0?!0:n.some(s=>r.includes(s))}function JS(){if(bn)return;const e=typeof window<"u"?window.__DKG_TOKEN__:void 0,t=e?`/api/events?token=${encodeURIComponent(e)}`:"/api/events";bn=new EventSource(t);const n=r=>s=>{let l={};try{l=JSON.parse(s.data)}catch{}const c={type:r,data:l};for(const d of oo)try{d(c)}catch{}};bn.addEventListener("join_request",n("join_request")),bn.addEventListener("join_approved",n("join_approved")),bn.addEventListener("join_rejected",n("join_rejected")),bn.addEventListener("project_synced",n("project_synced")),bn.addEventListener("memory_graph_changed",n("memory_graph_changed")),bn.addEventListener("notification",n("notification")),bn.addEventListener("connected",n("connected")),bn.onerror=()=>{bn==null||bn.close(),bn=null,oo.size>0&&(Ju=setTimeout(JS,3e3))}}function K_(){Ju&&(clearTimeout(Ju),Ju=null),bn==null||bn.close(),bn=null}function Y_(e){return oo.add(e),oo.size===1&&JS(),()=>{oo.delete(e),oo.size===0&&K_()}}function ls(e){const t=w.useRef(e);t.current=e,w.useEffect(()=>Y_(n=>t.current(n)),[])}function Co(e,t,n={}){var f;const r=w.useRef(t),s=w.useRef(null);r.current=t;const l=n.debounceMs??V_,c=w.useMemo(()=>n.layers??[],[(f=n.layers)==null?void 0:f.join("|")]),d=w.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]);ls(w.useCallback(h=>{h.type==="memory_graph_changed"&&Z_(h.data,e,c)&&(d(),s.current=setTimeout(()=>{s.current=null,r.current(h.data)},l))},[d,e,l,c])),w.useEffect(()=>d,[d])}function rc(e,t,n={}){const r=w.useRef(e);r.current=e;const s=w.useRef(n);s.current=n,w.useEffect(()=>{if(t<=0)return;let l=null,c=!1;const d=()=>{l||c||(l=setInterval(()=>r.current(),t))},f=()=>{l&&(clearInterval(l),l=null)},h=()=>{if(document.hidden){f();return}r.current(),d()};return s.current.runImmediately!==!1&&!document.hidden&&r.current(),document.hidden||d(),document.addEventListener("visibilitychange",h),()=>{c=!0,document.removeEventListener("visibilitychange",h),f()}},[t])}const Q_="No pending join request found";function X_(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 J_(e){const t=[];for(const n of e)n.type==="assertion_activity"?t.push({kind:"digest",id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,event:n.meta.kind,count:n.meta.count,...n.meta.soleAuthor&&n.meta.actorAgentDid?{actorAgentDid:n.meta.actorAgentDid,actorAgentName:n.meta.actorAgentName}:{},...n.meta.bySelf?{bySelf:!0}:{},ts:n.ts,read:n.read===1}):n.type==="join_approved"||n.type==="join_rejected"?t.push({kind:n.type,id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,ts:n.ts,read:n.read===1}):n.type==="pca_cost_covered"&&t.push({kind:"pca_cost_covered",id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,covered:n.meta,publisherAddress:n.meta.publisherAddress,ts:n.ts,read:n.read===1});return t.sort((n,r)=>r.ts-n.ts),t}function r1(e){return e.filter(t=>t.type!=="join_request"&&t.read===0).map(t=>t.id)}function i1(e){const t=e instanceof Error?e.message:String(e);if(t.includes(Q_))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 eO(){const[e,t]=w.useState(null),[n,r]=w.useState("loading"),[s,l]=w.useState(!1),c=w.useRef(!1),d=w.useCallback(()=>{_n.fetchNotificationsFeed().then(E=>{c.current=!0,t(E),l(!1),r(E.scopeUnknown?"identity-pending":"ready")}).catch(()=>{c.current?l(!0):r("error")})},[]);rc(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)},[]),ls(w.useCallback(E=>{E.type==="notification"&&h()},[h]));const g=w.useMemo(()=>X_((e==null?void 0:e.notifications)??[]),[e]),m=w.useMemo(()=>J_((e==null?void 0:e.notifications)??[]),[e]),v=(e==null?void 0:e.badgeCount)??0,b=w.useMemo(()=>r1((e==null?void 0:e.notifications)??[]).length>0,[e]),k=w.useCallback(E=>{E.length!==0&&(t(T=>{if(!T)return T;const $=new Set(E.map(String));return{...T,notifications:T.notifications.map(R=>$.has(String(R.id))?{...R,read:1}:R)}}),XS(E).then(d).catch(()=>{}))},[d]),j=w.useCallback(()=>{k(r1((e==null?void 0:e.notifications)??[]))},[e,k]),C=w.useCallback(async(E,T)=>{try{return await zg(E,T),d(),{ok:!0}}catch($){const R=i1($);return R.ok&&R.alreadyHandled&&d(),R}},[d]),S=w.useCallback(async(E,T)=>{try{return await $g(E,T),d(),{ok:!0}}catch($){const R=i1($);return R.ok&&R.alreadyHandled&&d(),R}},[d]),N=w.useCallback(()=>{l(!1),r(c.current?"ready":"loading"),d()},[d]);return{joinRequests:g,activity:m,unread:v,hasInformationalUnread:b,status:n,refreshError:s,partialActivityError:!1,approve:C,deny:S,markSeen:k,markAllInformationalSeen:j,retry:N}}const tO="dkg-pca",nO=150;function aO(e){return[String(e.chainId).toLowerCase(),e.nft.toLowerCase(),e.token.toLowerCase()].join(":")}function bi(e){return e?`${tO}:${e}`:null}const Eh={trackedIds:[],createPending:null,topUpPending:{}};function zl(e){return typeof e=="string"&&/^\d+$/.test(e)}function rO(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const r of e)zl(r)&&!t.has(r)&&(t.add(r),n.push(r));return n}function iO(e){if(e==null||typeof e!="object")return null;const t=e;return typeof t.ownerEoa!="string"||t.ownerEoa.length===0||typeof t.submittedAt!="number"||!Number.isFinite(t.submittedAt)?null:{ownerEoa:t.ownerEoa,submittedAt:t.submittedAt,...typeof t.txHash=="string"&&t.txHash.length>0?{txHash:t.txHash}:{}}}function sO(e){if(e==null||typeof e!="object")return{};const t={};for(const[n,r]of Object.entries(e)){if(!zl(n)||r==null||typeof r!="object")continue;const s=r;s.accountId===n&&(typeof s.ownerEoa!="string"||s.ownerEoa.length===0||typeof s.txHash!="string"||s.txHash.length===0||typeof s.submittedAt!="number"||!Number.isFinite(s.submittedAt)||(t[n]={accountId:n,ownerEoa:s.ownerEoa,txHash:s.txHash,submittedAt:s.submittedAt,...typeof s.tokens=="string"?{tokens:s.tokens}:{},...typeof s.previousTopUpBufferTrac=="string"?{previousTopUpBufferTrac:s.previousTopUpBufferTrac}:{}}))}return t}function ej(e){const t=bi(e);if(!t)return{...Eh};try{const n=localStorage.getItem(t);if(!n)return{...Eh};const r=JSON.parse(n);return{trackedIds:rO(r.trackedIds),createPending:iO(r.createPending),topUpPending:sO(r.topUpPending)}}catch{return{...Eh}}}let rr=null;function Cu(e,t){e&&(rr&&clearTimeout(rr),rr=setTimeout(()=>{rr=null;try{localStorage.setItem(e,JSON.stringify(t))}catch{}},nO))}function Ah(e,t){if(rr&&(clearTimeout(rr),rr=null),!e)return!1;try{return localStorage.setItem(e,JSON.stringify(t)),!0}catch{return!1}}function qi(e){return{trackedIds:e.trackedIds,createPending:e.createPending,topUpPending:e.topUpPending}}const Nu=ej(null),Gl=os((e,t)=>({scopeKey:null,trackedIds:Nu.trackedIds,createPending:Nu.createPending,topUpPending:Nu.topUpPending,createPendingPersisted:Nu.createPending!=null,setScope:n=>{if(t().scopeKey===n)return;rr&&(clearTimeout(rr),rr=null);const r=ej(n);e({scopeKey:n,trackedIds:r.trackedIds,createPending:r.createPending,topUpPending:r.topUpPending,createPendingPersisted:r.createPending!=null})},trackAccount:n=>{zl(n)&&(e(r=>r.trackedIds.includes(n)?r:{trackedIds:[...r.trackedIds,n]}),Cu(bi(t().scopeKey),qi(t())))},untrackAccount:n=>{e(r=>r.trackedIds.includes(n)?{trackedIds:r.trackedIds.filter(s=>s!==n)}:r),Cu(bi(t().scopeKey),qi(t()))},isTracked:n=>t().trackedIds.includes(n),setCreatePending:n=>{e({createPending:n});const r=Ah(bi(t().scopeKey),qi(t()));return e({createPendingPersisted:r}),r},clearCreatePending:()=>{e({createPending:null,createPendingPersisted:!1}),Cu(bi(t().scopeKey),qi(t()))},setTopUpPending:n=>{zl(n.accountId)&&(e(r=>({topUpPending:{...r.topUpPending,[n.accountId]:n}})),Ah(bi(t().scopeKey),qi(t())))},clearTopUpPending:n=>{e(r=>{if(!r.topUpPending[n])return r;const s={...r.topUpPending};return delete s[n],{topUpPending:s}}),Cu(bi(t().scopeKey),qi(t()))},finishCreate:n=>{e(r=>({createPending:null,createPendingPersisted:!1,trackedIds:zl(n)&&!r.trackedIds.includes(n)?[...r.trackedIds,n]:r.trackedIds})),Ah(bi(t().scopeKey),qi(t()))}}));function Th(e){if(!e)return!1;try{return BigInt(e)>0n}catch{return!1}}function tj(e,t=Math.floor(Date.now()/1e3)){const{expiresAtTimestamp:n}=e;return typeof n=="number"&&n>0&&t>=n}function nj(e,t){return tj(e,t)||!!e.fullySwept}function Vg(e){return Th(e.topUpBuffer)?!0:e.remainingAllowance!==void 0?Th(e.remainingAllowance):e.extendedRequested?null:Th(e.baseEpochAllowance)}function oO(e){return Vg(e)===!0}function lO(e){return e.remainingAllowance!==void 0&&Vg(e)===!1}const aj=90,rj=10080*60;function cO(e,t=Math.floor(Date.now()/1e3)){const{expiresAtTimestamp:n,fullySwept:r,agentCount:s}=e,l=typeof n=="number"&&n>0;return tj(e,t)?"expired":r?"swept":lO(e)?"insolvent":typeof s=="number"&&s>=aj?"cap-near":l&&n-t<=rj?"expiring":"healthy"}function uO(e,t){return!nj(e,t)&&oO(e)}function dO(e){return(e==null?void 0:e.adapterSupported)===!1?null:(e==null?void 0:e.registered)??null}function Lm(e,t){var c;const n=dO(e.probedKey);if(n===null)return{outcome:"inconclusive",registered:null,adapterUnsupported:((c=e.probedKey)==null?void 0:c.adapterSupported)===!1};if(n===!1)return{outcome:"unregistered",registered:!1};const r=nj(e,t),s=Vg(e);if(s===null)return{outcome:"inconclusive",registered:null,adapterUnsupported:!1};const l=s;return!r&&l?{outcome:"covers",registered:!0}:{outcome:"uncovered",registered:!0,dead:r,hasBudget:l}}const s1=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();async function pO(e,t){const n={accountId:e,snapshot:null,error:null,notFound:!1,classification:"unknown",ownerIsPrimaryWallet:!1,health:null,walletProbes:[],approvedCount:0,walletCount:t.length,probesInconclusive:!1};let r;try{r=await dd(e,void 0,{extended:!0})}catch(h){return{...n,error:h,notFound:h instanceof Pn&&h.status===404}}const s=await Promise.all(t.map(h=>dd(e,h,{extended:!0}).then(g=>({wallet:h,registered:Lm(g).registered})).catch(()=>({wallet:h,registered:null})))),l=s.filter(h=>h.registered===!0).length,c=s.some(h=>h.registered===null),f=t.some(h=>s1(h,r.owner))?"owned":l>0?"approved":"unknown";return{accountId:e,snapshot:r,error:null,notFound:!1,classification:f,ownerIsPrimaryWallet:s1(t[0],r.owner),health:cO(r),walletProbes:s,approvedCount:l,walletCount:t.length,probesInconclusive:c}}const lo=new Map;function o1(e){for(const t of e.subs)t()}async function yd(e){const t=++e.seq;if(e.ids.length===0){if(t!==e.seq)return;e.data={wallets:[],walletsError:!1,accounts:[]},e.error=null,e.loading=!1,o1(e);return}try{const n=await qg().catch(()=>null),r=(n==null?void 0:n.wallets)??[],s=!n||!!n.error,l=await Promise.all(e.ids.map(c=>pO(c,r)));if(t!==e.seq)return;e.data={wallets:r,walletsError:s,accounts:l},e.error=null}catch(n){if(t!==e.seq)return;e.error=(n==null?void 0:n.message)??"Failed to resolve PCAs."}finally{t===e.seq&&(e.loading=!1,o1(e))}}function Rh(e){e.timer||e.intervalMs<=0||typeof document<"u"&&document.hidden||(e.timer=setInterval(()=>yd(e),e.intervalMs))}function _h(e){e.timer&&(clearInterval(e.timer),e.timer=null)}function fO(e,t,n,r){let s=lo.get(e);const l=!s;if(s||(s={ids:t,data:null,loading:!0,error:null,subs:new Set,timer:null,intervalMs:n,onVisibility:null,seq:0},lo.set(e,s)),s.subs.add(r),l){const c=s,d=()=>{typeof document>"u"||(document.hidden?_h(c):(yd(c),Rh(c)))};s.onVisibility=d,typeof document<"u"&&document.addEventListener("visibilitychange",d),yd(s),Rh(s)}else n<s.intervalMs&&(s.intervalMs=n,_h(s),Rh(s));return()=>{const c=lo.get(e);c&&(c.subs.delete(r),c.subs.size===0&&(_h(c),c.onVisibility&&typeof document<"u"&&document.removeEventListener("visibilitychange",c.onVisibility),lo.delete(e)))}}const hO=[];function ij(e=3e4,t=[]){var j,C,S;const n=Gl(N=>N.trackedIds),r=t.join(","),s=w.useMemo(()=>[...n,...t.filter(N=>!n.includes(N))],[n.join(","),r]),l=s.join(","),[,c]=w.useReducer(N=>N+1,0);w.useEffect(()=>fO(l,s,e,c),[l,e]);const d=lo.get(l),f=((j=d==null?void 0:d.data)==null?void 0:j.accounts)??hO,h=d?d.loading:!0,g=(d==null?void 0:d.error)??null,{bestCoveringDiscountBps:m,covered:v}=w.useMemo(()=>{let N=null;for(const E of f){if(!E.snapshot||E.approvedCount<=0||!uO(E.snapshot))continue;const T=E.snapshot.discountBps;typeof T=="number"&&(N==null||T>N)&&(N=T)}return{bestCoveringDiscountBps:N,covered:N!=null}},[f]),b=((C=d==null?void 0:d.data)==null?void 0:C.wallets)??[],k=((S=d==null?void 0:d.data)==null?void 0:S.walletsError)??!1;return{accounts:f,wallets:b,walletsError:k,walletsInconclusive:k&&b.length===0,loading:h,error:g,refresh:()=>{const N=lo.get(l);N&&yd(N)},bestCoveringDiscountBps:m,covered:v}}let Oh=null;function sj(){const e=Gl(n=>n.scopeKey),t=Gl(n=>n.setScope);w.useEffect(()=>{e||Oh||(Oh=jR().then(n=>{t(aO(n))}).catch(()=>{}).finally(()=>{Oh=null}))},[e,t])}function mO(){sj();const{accounts:e}=ij(3e4);return w.useMemo(()=>{const t=[],n=Math.floor(Date.now()/1e3);for(const r of e){const s=r.snapshot;if(!s)continue;const l=r.accountId,c=typeof s.expiresAtTimestamp=="number"&&s.expiresAtTimestamp>0,d=c&&n>=s.expiresAtTimestamp;d?t.push({id:`pca-${l}-expired`,accountId:l,kind:"expired",severity:"danger",title:`PCA #${l} has expired`,message:"Publishes no longer get its discount. Create a replacement account to keep saving."}):c&&s.expiresAtTimestamp-n<=rj&&t.push({id:`pca-${l}-expiring`,accountId:l,kind:"expiring",severity:"warn",title:`PCA #${l} is expiring soon`,message:"Top-up can’t extend the lock period — plan a replacement before it expires."}),s.fullySwept&&t.push({id:`pca-${l}-swept`,accountId:l,kind:"swept",severity:"warn",title:`PCA #${l} is fully swept`,message:"Its epoch budgets have been swept to the staker reward pool."}),typeof s.agentCount=="number"&&s.agentCount>=aj&&t.push({id:`pca-${l}-cap`,accountId:l,kind:"cap-near",severity:"warn",title:`PCA #${l} is near the 100-wallet cap`,message:"Deregister unused wallets to make room before approving more."}),r.classification==="owned"&&r.approvedCount===0&&!r.probesInconclusive&&!d&&t.push({id:`pca-${l}-fallthrough`,accountId:l,kind:"fallthrough",severity:"warn",title:`PCA #${l} discounts nothing yet`,message:"Publishes from this node pay the direct cost until you approve this node’s operational wallets."})}return t},[e])}function Vl(e,t=new Date){if(e==null||e==="")return"";const n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return"";if(n.toDateString()===t.toDateString())return n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});const s=new Date(t);if(s.setDate(t.getDate()-1),n.toDateString()===s.toDateString())return`Yesterday ${n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`;const l=t.getTime()-n.getTime();return l>=0&&l<10080*60*1e3?`${n.toLocaleDateString(void 0,{weekday:"short"})} ${n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`:n.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}/**
|
|
90
|
+
* @license lucide-react v1.14.0 - ISC
|
|
91
|
+
*
|
|
92
|
+
* This source code is licensed under the ISC license.
|
|
93
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
94
|
+
*/const oj=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
95
|
+
* @license lucide-react v1.14.0 - ISC
|
|
96
|
+
*
|
|
97
|
+
* This source code is licensed under the ISC license.
|
|
98
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
99
|
+
*/const gO=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
100
|
+
* @license lucide-react v1.14.0 - ISC
|
|
101
|
+
*
|
|
102
|
+
* This source code is licensed under the ISC license.
|
|
103
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
104
|
+
*/const vO=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
|
|
105
|
+
* @license lucide-react v1.14.0 - ISC
|
|
106
|
+
*
|
|
107
|
+
* This source code is licensed under the ISC license.
|
|
108
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
109
|
+
*/const l1=e=>{const t=vO(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
110
|
+
* @license lucide-react v1.14.0 - ISC
|
|
111
|
+
*
|
|
112
|
+
* This source code is licensed under the ISC license.
|
|
113
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
114
|
+
*/var Mh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
115
|
+
* @license lucide-react v1.14.0 - ISC
|
|
116
|
+
*
|
|
117
|
+
* This source code is licensed under the ISC license.
|
|
118
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
119
|
+
*/const yO=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},bO=w.createContext({}),xO=()=>w.useContext(bO),wO=w.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:s="",children:l,iconNode:c,...d},f)=>{const{size:h=24,strokeWidth:g=2,absoluteStrokeWidth:m=!1,color:v="currentColor",className:b=""}=xO()??{},k=r??m?Number(n??g)*24/Number(t??h):n??g;return w.createElement("svg",{ref:f,...Mh,width:t??h??Mh.width,height:t??h??Mh.height,stroke:e??v,strokeWidth:k,className:oj("lucide",b,s),...!l&&!yO(d)&&{"aria-hidden":"true"},...d},[...c.map(([j,C])=>w.createElement(j,C)),...Array.isArray(l)?l:[l]])});/**
|
|
120
|
+
* @license lucide-react v1.14.0 - ISC
|
|
121
|
+
*
|
|
122
|
+
* This source code is licensed under the ISC license.
|
|
123
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
124
|
+
*/const un=(e,t)=>{const n=w.forwardRef(({className:r,...s},l)=>w.createElement(wO,{ref:l,iconNode:t,className:oj(`lucide-${gO(l1(e))}`,`lucide-${e}`,r),...s}));return n.displayName=l1(e),n};/**
|
|
125
|
+
* @license lucide-react v1.14.0 - ISC
|
|
126
|
+
*
|
|
127
|
+
* This source code is licensed under the ISC license.
|
|
128
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
129
|
+
*/const kO=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],SO=un("arrow-down",kO);/**
|
|
130
|
+
* @license lucide-react v1.14.0 - ISC
|
|
131
|
+
*
|
|
132
|
+
* This source code is licensed under the ISC license.
|
|
133
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
134
|
+
*/const jO=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],CO=un("arrow-up",jO);/**
|
|
135
|
+
* @license lucide-react v1.14.0 - ISC
|
|
136
|
+
*
|
|
137
|
+
* This source code is licensed under the ISC license.
|
|
138
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
139
|
+
*/const NO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],EO=un("ban",NO);/**
|
|
140
|
+
* @license lucide-react v1.14.0 - ISC
|
|
141
|
+
*
|
|
142
|
+
* This source code is licensed under the ISC license.
|
|
143
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
144
|
+
*/const AO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],TO=un("check",AO);/**
|
|
145
|
+
* @license lucide-react v1.14.0 - ISC
|
|
146
|
+
*
|
|
147
|
+
* This source code is licensed under the ISC license.
|
|
148
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
+
*/const RO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_O=un("chevron-down",RO);/**
|
|
150
|
+
* @license lucide-react v1.14.0 - ISC
|
|
151
|
+
*
|
|
152
|
+
* This source code is licensed under the ISC license.
|
|
153
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
154
|
+
*/const OO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Dm=un("chevron-right",OO);/**
|
|
155
|
+
* @license lucide-react v1.14.0 - ISC
|
|
156
|
+
*
|
|
157
|
+
* This source code is licensed under the ISC license.
|
|
158
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
159
|
+
*/const MO=[["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"}]],LO=un("copy",MO);/**
|
|
160
|
+
* @license lucide-react v1.14.0 - ISC
|
|
161
|
+
*
|
|
162
|
+
* This source code is licensed under the ISC license.
|
|
163
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
164
|
+
*/const DO=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],IO=un("ellipsis",DO);/**
|
|
165
|
+
* @license lucide-react v1.14.0 - ISC
|
|
166
|
+
*
|
|
167
|
+
* This source code is licensed under the ISC license.
|
|
168
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
169
|
+
*/const zO=[["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"}]],$O=un("folder",zO);/**
|
|
170
|
+
* @license lucide-react v1.14.0 - ISC
|
|
171
|
+
*
|
|
172
|
+
* This source code is licensed under the ISC license.
|
|
173
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
174
|
+
*/const PO=[["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"}]],UO=un("globe",PO);/**
|
|
175
|
+
* @license lucide-react v1.14.0 - ISC
|
|
176
|
+
*
|
|
177
|
+
* This source code is licensed under the ISC license.
|
|
178
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
179
|
+
*/const BO=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],FO=un("loader-circle",BO);/**
|
|
180
|
+
* @license lucide-react v1.14.0 - ISC
|
|
181
|
+
*
|
|
182
|
+
* This source code is licensed under the ISC license.
|
|
183
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
184
|
+
*/const HO=[["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"}]],qO=un("lock",HO);/**
|
|
185
|
+
* @license lucide-react v1.14.0 - ISC
|
|
186
|
+
*
|
|
187
|
+
* This source code is licensed under the ISC license.
|
|
188
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
189
|
+
*/const GO=[["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"}]],VO=un("paperclip",GO);/**
|
|
190
|
+
* @license lucide-react v1.14.0 - ISC
|
|
191
|
+
*
|
|
192
|
+
* This source code is licensed under the ISC license.
|
|
193
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
194
|
+
*/const WO=[["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"}]],c1=un("share-2",WO);/**
|
|
195
|
+
* @license lucide-react v1.14.0 - ISC
|
|
196
|
+
*
|
|
197
|
+
* This source code is licensed under the ISC license.
|
|
198
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
199
|
+
*/const ZO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],KO=un("square",ZO);/**
|
|
200
|
+
* @license lucide-react v1.14.0 - ISC
|
|
201
|
+
*
|
|
202
|
+
* This source code is licensed under the ISC license.
|
|
203
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
204
|
+
*/const YO=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],QO=un("trending-up",YO);/**
|
|
205
|
+
* @license lucide-react v1.14.0 - ISC
|
|
206
|
+
*
|
|
207
|
+
* This source code is licensed under the ISC license.
|
|
208
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
209
|
+
*/const XO=[["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"}]],JO=un("upload",XO);/**
|
|
210
|
+
* @license lucide-react v1.14.0 - ISC
|
|
211
|
+
*
|
|
212
|
+
* This source code is licensed under the ISC license.
|
|
213
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
214
|
+
*/const eM=[["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"}]],tM=un("users-round",eM);/**
|
|
215
|
+
* @license lucide-react v1.14.0 - ISC
|
|
216
|
+
*
|
|
217
|
+
* This source code is licensed under the ISC license.
|
|
218
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
219
|
+
*/const nM=[["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"}]],aM=un("wallet",nM);/**
|
|
220
|
+
* @license lucide-react v1.14.0 - ISC
|
|
221
|
+
*
|
|
222
|
+
* This source code is licensed under the ISC license.
|
|
223
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
224
|
+
*/const rM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],iM=un("x",rM),Lh={1:"ETH",8453:"ETH",84532:"ETH",11155111:"ETH",31337:"ETH",100:"xDAI",10200:"xDAI",2043:"NEURO",20430:"NEURO"};function lj(e){var r;if(e==null)return"ETH";const t=String(e);if(Lh[t])return Lh[t];const n=(r=t.match(/(\d+)\s*$/))==null?void 0:r[1];return n&&Lh[n]||"ETH"}function sW(e,t=6,n=4){const r=(e??"").trim();return r.length<=t+n+1?r:`${r.slice(0,t)}…${r.slice(-n)}`}const Dh="—";function sM(e,t=2){if(e==null)return Dh;let n;if(typeof e=="number")n=e;else{const l=String(e).trim();if(!/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(l))return Dh;n=Number(l)}if(!Number.isFinite(n))return Dh;const r=Math.abs(n),s=r>0&&r<10?t:0;return new Intl.NumberFormat("en-US",{minimumFractionDigits:0,maximumFractionDigits:s}).format(n)}function oM(e,t=2){if(e==null||e==="")return"—";let n;try{n=BigInt(e)}catch{return"—"}const r=n<0n;r&&(n=-n);const s=10n**18n,l=n/s,c=(n%s+s).toString().slice(1).slice(0,t);return sM(`${r?"-":""}${l}.${c||"0"}`,t)}const lM=new Set(["84532","11155111","31337","10200","20430"]);function oW(e){if(e==null)return!1;const t=String(e),n=t.includes(":")?t.split(":").pop():t;return lM.has(n)}function lW(e,t=Math.floor(Date.now()/1e3)){if(!e||e<=0)return"Expiry unknown";const n=e-t,r=Math.round(Math.abs(n)/86400);return n<=0?r===0?"Expired today":`Expired ~${r} day${r===1?"":"s"} ago`:`Expires in ~${r} day${r===1?"":"s"}`}function cj(e){if(!e)return null;let t,n;try{t=BigInt(e.baseCost),n=BigInt(e.discountedCost)}catch{return null}return t<=0n||n<0n||n>=t?null:Number(((t-n)*10000n+t/2n)/t)}function uj({convictionCostCovered:e,className:t=""}){const n=cj(e);if(e==null||n==null)return null;const r=(n/100).toFixed(n%100===0?0:1),s=e.accountId?`via PCA #${e.accountId}`:"across multiple PCAs";return o.jsxs("span",{className:["badge","badge-success","v10-pca-discount-applied",t].filter(Boolean).join(" "),"data-testid":"pca-discount-badge",role:"status",children:[o.jsx("span",{"aria-hidden":"true",children:"◉ "}),"Discount applied — −",r,"% ",s]})}function cM(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;const t=e/100;return`${t.toFixed(t%1===0?0:1)}%`}const uM={eligible:{glyph:"◉",toneClass:"v10-pca-verdict-green"},fallthrough:{glyph:"⚠",toneClass:"v10-pca-verdict-amber"},"fallthrough-no-funds":{glyph:"⚠",toneClass:"v10-pca-verdict-danger"},unknown:{glyph:"◌",toneClass:"v10-pca-verdict-neutral"}};function dM({verdict:e,accountId:t,discountBps:n,accountUntracked:r=!1,reasons:s=[],ownerPublish:l=!1,variant:c="banner",children:d,className:f=""}){const h=uM[e],g=e==="fallthrough"||e==="fallthrough-no-funds",m=g?"alert":"status",v=g?"assertive":"polite",b=t?`PCA #${t}`:"a PCA",k=r?" (not tracked by this node)":"",j=cM(n),C=" unless this graph’s registration escrow already covers it",S=s.length>0?` Reason: ${s.join("; ")}.`:"";if(c==="chip"){const E=e==="eligible"?`Funded by ${b}${k}${j?` (${j} discount)`:""}`:e==="fallthrough"?"⚠ No PCA discount":e==="fallthrough-no-funds"?"⚠ Publish will fail":"PCA status unknown";return o.jsx("span",{className:["v10-pca-verdict-chip",h.toneClass,f].filter(Boolean).join(" "),"data-testid":"pca-eligibility-chip","data-verdict":e,children:o.jsx("span",{className:"v10-pca-verdict-chip-label",role:m,"aria-live":v,children:E})})}let N;return e==="eligible"?N=o.jsxs(o.Fragment,{children:["This publish will use ",b,k,j?` (${j} discount)`:"",".",l?`${C}.`:""]}):e==="fallthrough"?N=o.jsxs(o.Fragment,{children:["No PCA discount on this publish — it will attempt to pay the direct cost from the signing wallet’s TRAC",j?`, forfeiting ${b}’s ${j} discount`:"",l?C:"","; the publish fails if that TRAC is below the fee.",S]}):e==="fallthrough-no-funds"?N=o.jsxs(o.Fragment,{children:["This publish will FAIL — no signing wallet can cover it",j?`, forfeiting ${b}’s ${j} discount`:"",l?C:"",".",S]}):N=o.jsx(o.Fragment,{children:"Couldn’t confirm PCA eligibility — you may pay the direct cost."}),o.jsxs("div",{className:["v10-pca-verdict-banner",h.toneClass,f].filter(Boolean).join(" "),"data-testid":"pca-eligibility-verdict","data-verdict":e,role:m,"aria-live":v,children:[o.jsxs("p",{className:"v10-pca-verdict-message",children:[o.jsx("span",{className:"v10-pca-verdict-glyph","aria-hidden":"true",children:h.glyph}),N]}),d&&o.jsx("div",{className:"v10-pca-verdict-actions",children:d})]})}const bd=new Map,Im=new Set;let u1=!1;function pM(){const e=[...bd.values()];for(const t of Im)t(e)}function fM(e){const t=e.detail;bd.has(t.info.uuid)||(bd.set(t.info.uuid,t),pM())}function hM(){u1||typeof window>"u"||(u1=!0,window.addEventListener("eip6963:announceProvider",fM),window.dispatchEvent(new Event("eip6963:requestProvider")))}function mM(e){return Im.add(e),e([...bd.values()]),()=>{Im.delete(e)}}function zm(e){var r;if(typeof e=="number")return e;const t=(r=String(e).match(/(\d+)\s*$/))==null?void 0:r[1],n=t?Number(t):NaN;if(!Number.isFinite(n))throw new Error(`Unrecognized chainId: ${e}`);return n}function gM(e){return`0x${zm(e).toString(16)}`}const Wg="dkg-node-ui:wallet-provider-rdns";function vM(e){var t;try{(t=globalThis.localStorage)==null||t.setItem(Wg,e)}catch{}}function yM(){var e;try{return((e=globalThis.localStorage)==null?void 0:e.getItem(Wg))??null}catch{return null}}function d1(){var e;try{(e=globalThis.localStorage)==null||e.removeItem(Wg)}catch{}}const dj=new Set(["app.phantom"]),bM=300;function xM(e){return e.filter(t=>!dj.has(t.info.rdns))}function wM(e,t){if(!t)return null;const n=e.filter(r=>r.info.rdns===t);return n.length===1?n[0]:null}function cW(e){return e.address!=null&&e.expectedChainId!=null&&e.chainId!==e.expectedChainId}function kM(e){return(e.walletRpcUrls??[]).filter(t=>/^https?:\/\//i.test(t))}let Eu=!1,Au=null,p1=!1;const uW=os((e,t)=>{function n(s){s.on&&(s.on("accountsChanged",(...l)=>{const c=l[0],d=(c==null?void 0:c[0])??null;if(d===null){t().disconnect();return}e({address:d})}),s.on("chainChanged",(...l)=>{e({chainId:parseInt(l[0],16)})}),s.on("disconnect",()=>t().disconnect()))}async function r(s){const l=s.provider;try{const c=await l.request({method:"eth_accounts"});if(c.length===0){d1();return}const d=await l.request({method:"eth_chainId"});n(l),e({provider:l,providerInfo:s.info,address:c[0],chainId:parseInt(d,16)})}catch(c){console.warn("[wallet] silent reconnect failed",c)}}return{discovered:[],unsupported:[],provider:null,providerInfo:null,address:null,chainId:null,expectedChainId:null,bootstrap:null,setBootstrap(s){e({bootstrap:s,expectedChainId:zm(s.chainId)})},initWallet(){if(typeof window>"u"||(hM(),p1))return;p1=!0;const s=yM();mM(l=>{e({discovered:xM(l),unsupported:l.filter(c=>dj.has(c.info.rdns))}),!(!s||Eu)&&(Au&&clearTimeout(Au),Au=setTimeout(()=>{if(Au=null,Eu)return;const c=wM(t().discovered,s);c&&(Eu=!0,r(c))},bM))})},async connect(s){const l=s.provider,c=await l.request({method:"eth_requestAccounts"}),d=await l.request({method:"eth_chainId"});n(l),e({provider:l,providerInfo:s.info,address:c[0]??null,chainId:parseInt(d,16)}),vM(s.info.rdns),Eu=!1},disconnect(){e({provider:null,providerInfo:null,address:null,chainId:null}),d1()},async switchToExpectedChain(){const{provider:s,bootstrap:l}=t();if(!s)throw new Error("Wallet not connected.");if(!l)throw new Error("Chain not bootstrapped.");const c=gM(l.chainId);try{await s.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})}catch(d){if((d==null?void 0:d.code)===4902){const f=lj(l.chainId),h=kM(l);if(h.length===0)throw new Error("Wallet does not know this chain and the node did not provide wallet-public RPC URLs. Add the network in your wallet, then try again.");await s.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:`chain-${zm(l.chainId)}`,nativeCurrency:{name:f,symbol:f,decimals:18},rpcUrls:h}]})}else throw d}}}});function Zg(e,t){return e&&e.trim()?e:t.length>20?`${t.slice(0,16)}…`:t}function f1(e){return e.length>12?`${e.slice(0,6)}…${e.slice(-4)}`:e}function SM({item:e,onApprove:t,onDeny:n,onOpen:r}){var g;const[s,l]=w.useState({kind:"idle"}),c=Zg(e.contextGraphName,e.cgId),d=((g=e.agentName)==null?void 0:g.trim())||f1(e.agentAddress),f=async m=>{l({kind:"working",action:m});const b=await(m==="approve"?t:n)(e.cgId,e.agentAddress);if(b.ok){const k=b.alreadyHandled?"Already handled":m==="approve"?`Approved — ${d} can now access ${c}`:`Request from ${d} declined`;l({kind:"done",label:k})}else{const k=b.roleError?`You're no longer the curator of ${c}`:m==="approve"?"Couldn’t approve":"Couldn’t deny";l({kind:"error",action:m,message:k})}};if(s.kind==="done")return o.jsxs("div",{className:"v10-notif-row v10-notif-row-terminal",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"v10-notif-glyph","aria-hidden":"true",children:"✓"}),o.jsx("span",{className:"v10-notif-terminal-text",children:s.label})]});const h=s.kind==="working";return o.jsxs("div",{className:"v10-notif-row v10-notif-row-join",children:[o.jsx("span",{className:"v10-notif-glyph v10-notif-glyph-join","aria-hidden":"true",children:"🔑"}),o.jsxs("div",{className:"v10-notif-row-body",children:[o.jsx("div",{className:"v10-notif-row-title",children:"Join request"}),o.jsxs("div",{className:"v10-notif-row-detail",children:[o.jsx("span",{className:"v10-notif-actor",children:d})," wants to join"," ",o.jsx("button",{type:"button",className:"v10-notif-cg-link",onClick:()=>r(e.cgId),title:`Open ${c}`,children:c})]}),o.jsxs("div",{className:"v10-notif-row-sub",children:[o.jsx("span",{className:"v10-notif-addr",title:e.agentAddress,children:f1(e.agentAddress)}),o.jsx("span",{className:"v10-notif-dot",children:"·"}),o.jsx("span",{className:"v10-notif-time",title:new Date(e.ts).toLocaleString(),children:Vl(e.ts)})]}),s.kind==="error"&&o.jsxs("div",{className:"v10-notif-row-error",role:"status","aria-live":"polite",children:[s.message," ",o.jsx("button",{type:"button",className:"v10-notif-retry",onClick:()=>f(s.action),children:"Retry"})]}),o.jsx("span",{className:"v10-sr-only",role:"status","aria-live":"polite",children:h?s.action==="approve"?"Approving…":"Denying…":""})]}),o.jsx("div",{className:"v10-notif-row-actions",children:s.kind==="confirming-deny"?o.jsxs("span",{className:"v10-notif-deny-confirm",role:"group","aria-label":"Confirm deny",onKeyDown:m=>{m.key==="Escape"&&(m.stopPropagation(),l({kind:"idle"}))},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||l({kind:"idle"})},children:[o.jsx("span",{className:"v10-notif-deny-confirm-label",children:"Deny?"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-deny",onClick:()=>f("deny"),"aria-label":`Confirm deny join request from ${d} for ${c}`,children:"Yes"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-ghost",onClick:()=>l({kind:"idle"}),autoFocus:!0,children:"Cancel"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-approve",onClick:()=>f("approve"),disabled:h,"aria-label":`Approve join request from ${d} for ${c}`,children:h&&s.action==="approve"?"…":"Approve"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-ghost",onClick:()=>l({kind:"confirming-deny"}),disabled:h,"aria-label":`Deny join request from ${d} for ${c}`,children:h&&s.action==="deny"?"…":"Deny"})]})})]})}const jM={created:"+",promoted:"⇡",published:"◉"};function CM(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 NM({item:e,onOpen:t}){var d;const n=Zg(e.contextGraphName,e.cgId),r=e.bySelf?"You":((d=e.actorAgentName)==null?void 0:d.trim())||void 0,s=CM(e.event,e.count,r),l=Vl(e.ts),c=`${s} in ${n}${l?`, ${l}`:""}. Open ${n} recent activity.`;return o.jsxs("button",{type:"button",className:`v10-notif-row v10-notif-row-activity v10-notif-activity-${e.event}${e.bySelf?" v10-notif-by-self":""}${e.read?"":" v10-notif-unread"}`,onClick:()=>t(e.cgId),title:`Open ${n} · recent activity`,"aria-label":c,children:[o.jsx("span",{className:`v10-notif-glyph v10-notif-glyph-${e.event}`,"aria-hidden":"true",children:jM[e.event]}),o.jsx("span",{className:"v10-notif-row-body","aria-hidden":"true",children:o.jsxs("span",{className:"v10-notif-row-detail",children:[s," in ",o.jsx("span",{className:"v10-notif-cg-name",children:n})]})}),o.jsx("span",{className:"v10-notif-time","aria-hidden":"true",title:new Date(e.ts).toLocaleString(),children:l})]})}function EM({item:e,onOpen:t}){const n=Zg(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:Vl(e.ts)})]});if(r){const l=Vl(e.ts);return o.jsx("button",{type:"button",className:`v10-notif-row v10-notif-row-confirm v10-notif-confirm-approved${e.read?"":" v10-notif-unread"}`,onClick:()=>t(e.cgId),title:`Open ${n}`,"aria-label":`Request approved: you can now access ${n}${l?`, ${l}`:""}. Open ${n}.`,children:s})}return o.jsx("div",{className:`v10-notif-row v10-notif-row-confirm v10-notif-confirm-rejected${e.read?"":" v10-notif-unread"}`,"aria-disabled":"true",children:s})}function AM({item:e}){var h;const t=cj(e.covered),n=t!=null?(t/100).toFixed(t%100===0?0:1):null;let r=null;try{const g=BigInt(e.covered.baseCost),m=BigInt(e.covered.discountedCost);g>0n&&m>=0n&&m<g&&(r=oM((g-m).toString()))}catch{r=null}const s=`PCA #${e.covered.accountId}`,l=(h=e.contextGraphName)!=null&&h.trim()?` in ${e.contextGraphName.trim()}`:"",c=n!=null?"Publishing discount applied":"Publishing fee covered",d=n!=null?`−${n}% via ${s}${r?` · saved ${r} TRAC`:""}${l}`:`via ${s}${l}`,f=Vl(e.ts);return o.jsxs("div",{className:`v10-notif-row v10-notif-row-confirm v10-notif-pca-discount${e.read?"":" v10-notif-unread"}`,role:"status","aria-label":`${c}, ${d}${f?`, ${f}`:""}.`,children:[o.jsx("span",{className:"v10-notif-glyph v10-notif-glyph-approved","aria-hidden":"true",children:"◉"}),o.jsxs("span",{className:"v10-notif-row-body","aria-hidden":"true",children:[o.jsx("span",{className:"v10-notif-row-title",children:c}),o.jsx("span",{className:"v10-notif-row-detail",children:d})]}),o.jsx("span",{className:"v10-notif-time","aria-hidden":"true",title:new Date(e.ts).toLocaleString(),children:f})]})}function TM({feed:e,onOpenContextGraph:t,pcaAlerts:n=[],onOpenPca:r,id:s,paneRef:l}){const{joinRequests:c,activity:d,status:f,refreshError:h,partialActivityError:g,hasInformationalUnread:m,approve:v,deny:b,markSeen:k,markAllInformationalSeen:j}=e,C=($,R)=>{k([R]),t($)},S=c.length>0,N=d.length>0,E=n.length>0,T=!S&&!N&&!E;return o.jsxs("div",{className:"v10-notif-pane",role:"region","aria-label":"Notifications",id:s,ref:l,tabIndex:-1,children:[o.jsxs("div",{className:"v10-notif-pane-titlebar",children:[o.jsx("div",{className:"v10-notif-pane-title",children:"Notifications"}),m&&o.jsx("button",{type:"button",className:"v10-notif-pane-markread",onClick:j,title:"Mark informational notifications as read",children:"Mark all read"})]}),o.jsxs("div",{className:"v10-notif-pane-body",children:[E&&o.jsxs("section",{className:"v10-notif-section v10-notif-section-pca","aria-label":"Publisher Conviction",children:[o.jsxs("div",{className:"v10-notif-section-head",children:[o.jsx("span",{className:"v10-notif-section-label",children:"Publisher Conviction"}),o.jsx("span",{className:"v10-notif-section-count",children:n.length})]}),o.jsx("div",{className:"v10-notif-section-rows",children:n.map($=>o.jsxs("div",{className:"v10-pca-alert-row","data-severity":$.severity,"data-testid":"pca-bell-alert",role:$.severity==="danger"?"alert":"status",children:[o.jsx("div",{className:"v10-pca-alert-title",children:$.title}),o.jsx("div",{className:"v10-pca-alert-msg",children:$.message}),r&&o.jsxs("button",{type:"button",className:"v10-pca-alert-action",onClick:()=>r($.accountId),children:["Manage PCA #",$.accountId]})]},$.id))})]}),f==="identity-pending"?o.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Verifying access…"}):f==="loading"&&T?o.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Loading notifications…"}):f==="error"&&T?o.jsxs("div",{className:"v10-notif-pane-error",role:"status","aria-live":"polite",children:["Couldn’t load notifications."," ",o.jsx("button",{type:"button",className:"v10-notif-retry",onClick:e.retry,children:"Retry"})]}):T?o.jsxs("div",{className:"v10-notif-pane-empty",role:"status",children:[o.jsx("div",{className:"v10-notif-pane-empty-lead",children:"You’re all caught up."}),o.jsx("div",{className:"v10-notif-pane-empty-sub",children:"Join requests, approvals, and new activity in your context graphs will show up here."})]}):o.jsxs(o.Fragment,{children:[h&&o.jsxs("div",{className:"v10-notif-pane-error v10-notif-pane-error-inline",role:"status","aria-live":"polite",children:["Couldn’t refresh notifications."," ",o.jsx("button",{type:"button",className:"v10-notif-retry",onClick:e.retry,children:"Retry"})]}),S&&o.jsxs("section",{className:"v10-notif-section v10-notif-section-action","aria-label":"Needs your action",children:[o.jsxs("div",{className:"v10-notif-section-head",children:[o.jsx("span",{className:"v10-notif-section-label",children:"Needs your action"}),o.jsx("span",{className:"v10-notif-section-count",children:c.length})]}),o.jsx("div",{className:"v10-notif-section-rows",children:c.map($=>o.jsx(SM,{item:$,onApprove:v,onDeny:b,onOpen: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"})}),g&&o.jsx("div",{className:"v10-notif-pane-error v10-notif-pane-error-inline",role:"status","aria-live":"polite",children:"Recent activity couldn’t load."}),N?o.jsx("div",{className:"v10-notif-section-rows",children:d.map($=>$.kind==="digest"?o.jsx(NM,{item:$,onOpen:R=>C(R,$.id)},$.id):$.kind==="pca_cost_covered"?o.jsx(AM,{item:$},$.id):o.jsx(EM,{item:$,onOpen:R=>C(R,$.id)},$.id))}):!g&&o.jsx("div",{className:"v10-notif-section-empty",children:"No recent activity."})]})]})]})]})}const RM=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"})]}),h1="v10-notifications-pane";function _M(){const e=eO(),t=mO(),[n,r]=w.useState(!1),s=w.useRef(null),l=w.useRef(null),c=Ta(b=>b.setActiveProject),{openTab:d}=hn(),f=w.useRef(null),h=w.useCallback((b=!1)=>{var k;r(!1),b&&((k=l.current)==null||k.focus())},[]);w.useEffect(()=>{if(!n)return;const b=k=>{s.current&&!s.current.contains(k.target)&&h()};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n,h]),w.useEffect(()=>{if(!n)return;const b=f.current;if(!b)return;const k=b.querySelector(".v10-notif-section-action .v10-notif-btn-approve"),j=b.querySelector(".v10-notif-section-rows button, .v10-notif-section-rows a[href]"),C=b.querySelector('button:not(.v10-notif-pane-markread), [href], [tabindex]:not([tabindex="-1"])');(k??j??C??b).focus()},[n]);const g=w.useCallback(b=>{c(b),d({id:`project:${b}`,label:b.slice(0,16),closable:!0}),h()},[c,d,h]),m=w.useCallback(b=>{d({id:`conviction:${b}`,label:`PCA #${b}`,closable:!0}),h()},[d,h]),v=e.unread+t.length;return o.jsxs("div",{className:"v10-header-notif-wrap",ref:s,onKeyDown:n?b=>{b.key==="Escape"&&(b.stopPropagation(),h(!0))}:void 0,children:[o.jsxs("button",{ref:l,className:"v10-header-icon-btn",onClick:()=>r(b=>!b),title:v>0?`Notifications (${v} unread)`:"Notifications","aria-label":v>0?`Notifications, ${v} unread`:"Notifications","aria-haspopup":"dialog","aria-expanded":n,"aria-controls":n?h1:void 0,children:[RM,v>0&&o.jsx("span",{className:"v10-header-notif-badge",children:v})]}),n&&o.jsx(TM,{id:h1,paneRef:f,feed:e,onOpenContextGraph:g,pcaAlerts:t,onOpenPca:m})]})}function OM(e,t,n,r,s){const l=[e?"Synced with the network":"Syncing with the network",`${t} peer${t===1?"":"s"} (${n} direct, ${r} relayed)`];return s>0&&l.push(`Uptime ${MM(s)}`),l.join(`
|
|
225
|
+
`)}function MM(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),s=Math.floor(t%3600/60),l=[];return n>0&&l.push(`${n}d`),(r>0||n>0)&&l.push(`${r}h`),l.push(`${s}m`),l.join(" ")}const LM=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"})]})}),DM=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"})]}),IM=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"})}),zM=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"})]}),$M=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"})]}),PM=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"})]}),UM=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"})}),BM=o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.78 4.78 4 4 0 0 1-6.74 0 4 4 0 0 1-4.78-4.78 4 4 0 0 1 0-6.75z"}),o.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),o.jsx("circle",{cx:"9.5",cy:"9.5",r:".5"}),o.jsx("circle",{cx:"14.5",cy:"14.5",r:".5"})]});function FM(){var C,S;const{theme:e,setTheme:t,leftCollapsed:n,toggleLeft:r,rightCollapsed:s,toggleRight:l}=Kn(),c=Og(N=>N.nodeStatus),d=Fd().data,{openTab:f}=hn(),h=(c==null?void 0:c.connectedPeers)??(c==null?void 0:c.peerCount)??0,g=((C=c==null?void 0:c.connections)==null?void 0:C.direct)??0,m=((S=c==null?void 0:c.connections)==null?void 0:S.relayed)??0,v=(c==null?void 0:c.uptimeMs)??0,k=c!=null&&(c==null?void 0:c.synced)!==!1,j=OM(k,h,g,m,v);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"}),LM]})]}),o.jsx("button",{className:`v10-header-icon-btn ${n?"":"active-toggle"}`,onClick:r,title:"Toggle sidebar",children:zM}),o.jsx("div",{className:"v10-header-sep"}),o.jsxs("div",{className:"v10-header-agent-switcher",title:d?`${d.agentDid}
|
|
226
|
+
${d.agentAddress}`:void 0,children:[o.jsx("span",{className:"v10-header-agent-dot"}),o.jsx("span",{className:"v10-header-agent-name",children:(d!=null&&d.name&&d.name!=="**"?d.name:null)||(c==null?void 0:c.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(_M,{}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"operations",label:"Observability",closable:!0}),title:"Observability",children:UM}),o.jsx("button",{className:"v10-header-icon-btn","data-testid":"pca-launch-btn",onClick:()=>f({id:"conviction",label:"Publisher Conviction",closable:!0}),title:"Publisher Conviction - publishing discounts",children:BM}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"settings",label:"Settings",closable:!0}),title:"Settings",children:PM}),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"?DM:IM}),o.jsx("button",{className:`v10-header-icon-btn ${s?"":"active-toggle"}`,onClick:l,title:"Toggle agent panel",children:$M})]})]})}function HM(){const e=localStorage.getItem("dkg-journey-stage");return e==="1"?1:e==="2"?2:0}const Kg=os((e,t)=>({stage:HM(),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})}})),qM=`@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
|
+
`,GM=`@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
|
+
`,VM=`@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
|
+
`,WM=`@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
|
+
`,ZM=`@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
|
+
`,KM=`# 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
|
+
`,YM=`# 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
|
+
`,QM=`# 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
|
+
`,XM=`# 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
|
+
`,JM=`# 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
|
+
`,e4=/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>"{}|\\^`\x00-\x20]+$/;function t4(e){return e?e4.test(e):!1}function pj(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}const Et={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 xi(e){if(!t4(e))throw new Error(`Invalid /wm/write IRI object: ${e}`);return e}function Ea(e){return`"${pj(e)}"`}function Tu(e,t){return`"${pj(e)}"^^<${xi(t)}>`}function n4({contextGraphId:e,starterSlug:t,ttl:n,guide:r,nowIso:s=new Date().toISOString()}){if(!e)throw new Error("contextGraphId is required");if(!t)throw new Error("starterSlug is required");const l=xi(`urn:dkg:project:${e}:ontology`),c=xi(`${l}:agent-guide`),d=[{subject:l,predicate:Et.rdf+"type",object:xi(Et.owl+"Ontology")},{subject:l,predicate:Et.rdf+"type",object:xi(Et.prov+"Entity")},{subject:l,predicate:Et.rdfs+"label",object:Ea(`Project ontology — ${e}`)},{subject:l,predicate:Et.schema+"name",object:Ea(`Project ontology — ${e}`)},{subject:l,predicate:Et.dcterms+"title",object:Ea(`Project ontology — ${e}`)},{subject:l,predicate:Et.dcterms+"description",object:Ea(`The active ontology for context graph ${e}, derived from the '${t}' starter.`)},{subject:l,predicate:Et.dcterms+"created",object:Tu(s,Et.xsd+"dateTime")},{subject:l,predicate:Et.dcterms+"modified",object:Tu(s,Et.xsd+"dateTime")},{subject:l,predicate:Et.dcterms+"source",object:Ea(t)},{subject:l,predicate:Et.schema+"encodingFormat",object:Ea("text/turtle")},{subject:l,predicate:Et.schema+"text",object:Ea(n)},{subject:l,predicate:Et.dcterms+"references",object:xi(c)},{subject:c,predicate:Et.rdf+"type",object:xi(Et.schema+"DigitalDocument")},{subject:c,predicate:Et.rdfs+"label",object:Ea(`Agent guide — ${e} ontology`)},{subject:c,predicate:Et.schema+"name",object:Ea(`Agent guide — ${e} ontology`)},{subject:c,predicate:Et.dcterms+"title",object:Ea(`Agent guide — ${e} ontology`)},{subject:c,predicate:Et.dcterms+"created",object:Tu(s,Et.xsd+"dateTime")},{subject:c,predicate:Et.dcterms+"modified",object:Tu(s,Et.xsd+"dateTime")},{subject:c,predicate:Et.schema+"encodingFormat",object:Ea("text/markdown")},{subject:c,predicate:Et.schema+"text",object:Ea(r)},{subject:c,predicate:Et.schema+"about",object:xi(l)}];return{ontologyUri:l,guideUri:c,quads:d}}async function Ru(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Ht()},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 a4=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/ontology.ttl":qM,"../../../../mcp-dkg/templates/ontologies/coding-project/ontology.ttl":GM,"../../../../mcp-dkg/templates/ontologies/narrative-writing/ontology.ttl":VM,"../../../../mcp-dkg/templates/ontologies/pkm/ontology.ttl":WM,"../../../../mcp-dkg/templates/ontologies/scientific-research/ontology.ttl":ZM}),r4=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/agent-guide.md":KM,"../../../../mcp-dkg/templates/ontologies/coding-project/agent-guide.md":YM,"../../../../mcp-dkg/templates/ontologies/narrative-writing/agent-guide.md":QM,"../../../../mcp-dkg/templates/ontologies/pkm/agent-guide.md":XM,"../../../../mcp-dkg/templates/ontologies/scientific-research/agent-guide.md":JM});function i4(){const e={};for(const[t,n]of Object.entries(a4)){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(r4)){const r=t.match(/ontologies\/([^/]+)\/agent-guide\.md$/);if(!r)continue;const s=r[1];e[s]&&(e[s].guide=n)}return e}const Yg=i4(),s4=[{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 o4(){return s4.filter(e=>Yg[e.slug])}function l4(e){return Yg[e]??null}async function c4(e,t){const n=l4(t);if(!n)throw new Error(`Unknown ontology starter '${t}'. Available: ${Object.keys(Yg).join(", ")}`);if(!n.ttl||!n.guide)throw new Error(`Starter '${t}' is missing ontology.ttl or agent-guide.md.`);await Ru("/api/sub-graph/create",{contextGraphId:e,subGraphName:"meta"}).catch(d=>{if(!String((d==null?void 0:d.message)??d).includes("already exists"))throw d});const{ontologyUri:r,guideUri:s,quads:l}=n4({contextGraphId:e,starterSlug:t,ttl:n.ttl,guide:n.guide});await Ru("/api/knowledge-assets/project-ontology/wm/discard",{contextGraphId:e,subGraphName:"meta"}).catch(d=>{const f=String((d==null?void 0:d.message)??d);if(!/404|not found/i.test(f))throw d}),await Ru("/api/knowledge-assets/project-ontology/wm/write",{contextGraphId:e,subGraphName:"meta",quads:l});const c=await Ru("/api/knowledge-assets/project-ontology/swm/share",{contextGraphId:e,subGraphName:"meta"});if(!c.swmShared||!c.sealed||!c.publishReady)throw new Error("Project ontology atomic share did not reach Shared Working Memory");return{ontologyUri:r,guideUri:s,tripleCount:l.length}}async function Qg(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Ht()},body:JSON.stringify(t)}),r=await n.text();let s;if(r)try{s=JSON.parse(r)}catch{s={raw:r}}if(!n.ok){const l=(s==null?void 0:s.error)??`HTTP ${n.status}`;throw new Error(typeof l=="string"?l:JSON.stringify(l))}return s}function u4(e,t={}){return Qg(`/api/context-graph/${encodeURIComponent(e)}/manifest/publish`,t)}function d4(e,t){return Qg(`/api/context-graph/${encodeURIComponent(e)}/manifest/plan-install`,t)}function p4(e,t){return Qg(`/api/context-graph/${encodeURIComponent(e)}/manifest/install`,t)}const m1="dkg.wireWorkspace.parentDir",g1="dkg.wireWorkspace.nickname",v1="dkg.wireWorkspace.tools",Ih=[{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 f4(e,t){const n=t.split("/"),r=n[n.length-1]??"";return r||(e??"project").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function h4(e){if(!e)return"";const t=e.hostname.replace(/\.local$/,"").replace(/-/g," ");return`${e.username} @ ${t}`}function y1(e){return e==="both"?["cursor","claude-code"]:[e]}function fj({contextGraphId:e,projectName:t,defaultAgentNickname:n,onDone:r,onCancel:s,variant:l}){var K;const c=w.useMemo(()=>f4(t,e),[t,e]),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,v]=w.useState(""),[b,k]=w.useState(""),[j,C]=w.useState("cursor"),[S,N]=w.useState(!1),[E,T]=w.useState(null),[$,R]=w.useState(null),[L,B]=w.useState(null);w.useEffect(()=>{let z=!1;return(async()=>{try{const[q,V]=await Promise.all([fetch("/api/host/info",{headers:Ht()}).then(W=>W.ok?W.json():null),nc().catch(()=>null)]);if(z)return;if(q){f(q);const W=typeof window<"u"&&window.localStorage.getItem(m1)||q.defaultWorkspaceParent;v(`${W}/${c}`)}V&&g(V);const Z=typeof window<"u"&&window.localStorage.getItem(g1);n?k(n):Z?k(Z):q&&k(h4(q));const Y=typeof window<"u"&&window.localStorage.getItem(v1);Y&&(Y==="cursor"||Y==="claude-code"||Y==="both")&&C(Y)}catch(q){z||console.warn("[WireWorkspacePanel] host info / identity fetch failed:",q)}})(),()=>{z=!0}},[c,n]);function O(z){typeof window>"u"||(window.localStorage.setItem(m1,z),b&&window.localStorage.setItem(g1,b),window.localStorage.setItem(v1,j))}async function _(){N(!0),T(null);try{const z=m.trim();if(!z||z.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 q=await d4(e,{workspaceRoot:z,agentNickname:b.trim(),tools:y1(j)});R(q);const V=z.lastIndexOf("/");V>0&&O(z.slice(0,V))}catch(z){T((z==null?void 0:z.message)||"Preview failed")}finally{N(!1)}}async function I(){N(!0),T(null);try{const z=m.trim(),q=await p4(e,{workspaceRoot:z,agentNickname:b.trim(),tools:y1(j)});B(q)}catch(z){T((z==null?void 0:z.message)||"Install failed")}finally{N(!1)}}if(L)return o.jsxs("div",{children:[o.jsxs("div",{style:{padding:"12px 14px",borderRadius:8,marginBottom:14,fontSize:12,background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.25)",color:"var(--accent-green)"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:6},children:"Workspace wired."}),"Open ",o.jsx("code",{style:{fontFamily:"var(--font-mono)"},children:m})," in ",j==="claude-code"?"Claude Code":j==="both"?"Cursor or Claude Code":"Cursor",". On the first chat, your agent will see the project ontology",l==="join"?", tasks, and decisions":" you publish via the canonical assertion-write flow","."]}),o.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginBottom:8},children:"Files written:"}),o.jsxs("pre",{style:{fontSize:10,fontFamily:"var(--font-mono)",maxHeight:200,overflow:"auto",padding:10,borderRadius:6,background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",margin:0},children:[L.written.map(z=>`${z.action.padEnd(9)} ${z.absPath} (${z.bytesWritten.toLocaleString()} bytes)`).join(`
|
|
1067
|
+
`),L.skipped.length?`
|
|
1068
|
+
|
|
1069
|
+
Skipped:
|
|
1070
|
+
`+L.skipped.map(z=>` - ${z}`).join(`
|
|
1071
|
+
`):"",L.warnings.length?`
|
|
1072
|
+
|
|
1073
|
+
Warnings:
|
|
1074
|
+
`+L.warnings.map(z=>` - ${z}`).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($)return o.jsxs("div",{children:[E&&o.jsx("div",{className:"v10-modal-error",style:{marginBottom:12},children:E}),o.jsx("div",{style:{marginBottom:10,fontSize:11,color:"var(--text-secondary)"},children:"Review the install plan. Files are only written when you click Install."}),o.jsx("pre",{style:{fontSize:10,fontFamily:"var(--font-mono)",maxHeight:320,overflow:"auto",padding:12,borderRadius:6,background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",margin:0,whiteSpace:"pre-wrap"},children:$.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),T(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:I,disabled:S,children:S?"Installing…":"Install"})]})]})]});const F=((K=Ih.find(z=>z.value===j&&!z.disabled))==null?void 0:K.description)??Ih[0].description;return o.jsxs("div",{children:[o.jsxs("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:14,fontSize:12,background:"rgba(59, 130, 246, 0.08)",border:"1px solid rgba(59, 130, 246, 0.25)",color:"var(--accent-primary, #3b82f6)"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:4},children:l==="create"?"Wire your local workspace":"Wire this project locally"}),l==="create"?"Choose a directory for the new project and which coding tool you want it wired for. The daemon will populate the workspace with the right config files so your agent can join the project from turn one.":"Choose a local directory for this project and which coding tool you want it wired for. The daemon will populate the workspace with the right config files so your agent can collaborate on this project."]}),E&&o.jsx("div",{className:"v10-modal-error",style:{marginBottom:12},children:E}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Workspace path"}),o.jsx("input",{className:"v10-form-input",type:"text",value:m,onChange:z=>v(z.target.value),placeholder:d?`${d.defaultWorkspaceParent}/${c}`:"/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:z=>C(z.target.value),children:Ih.map((z,q)=>o.jsx("option",{value:z.disabled?"__disabled__":z.value,disabled:z.disabled,children:z.label},`${z.label}-${q}`))}),o.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:F})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Your agent identity"}),o.jsx("input",{className:"v10-form-input",type:"text",value:h?`urn:dkg:agent:${h.agentAddress.toLowerCase()}`:"fetching…",disabled:!0,spellCheck:!1,style:{fontFamily:"var(--font-mono)",fontSize:11,opacity:.75}}),o.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:["Cryptographic URI derived from this node's wallet address. Same on every project on this machine. Attribution (",o.jsx("code",{children:"prov:wasAttributedTo"}),") on every chat turn uses this URI."]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Nickname for this agent"}),o.jsx("input",{className:"v10-form-input",type:"text",value:b,onChange:z=>k(z.target.value),placeholder:"e.g. Alice on laptop 1",spellCheck:!1,maxLength:80}),o.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:"Free-form human label rendered as the agent's name in chips, lists, and rdfs:label triples. Doesn't affect attribution — only changes how you appear to others."})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:14,gap:10},children:[s?o.jsx("button",{className:"v10-modal-btn",onClick:s,disabled:S,children:"Cancel"}):o.jsx("button",{className:"v10-modal-btn",onClick:r,disabled:S,children:"Skip for now"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:_,disabled:S||!m.trim()||!b.trim(),children:S?"Loading preview…":"Preview install"})]})]})}const b1='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex="-1"])';function ts(e,t){const n=w.useRef(null),r=w.useRef(null);w.useEffect(()=>{if(e)return r.current=document.activeElement??null,queueMicrotask(()=>{const l=n.current;if(!l)return;const c=l.querySelector(b1),f=l.querySelector("[autofocus]")??c;f?f.focus():(l.hasAttribute("tabindex")||l.setAttribute("tabindex","-1"),l.focus())}),()=>{var l,c;(c=(l=r.current)==null?void 0:l.focus)==null||c.call(l)}},[e]),w.useEffect(()=>{if(!e)return;const l=c=>{if(c.key==="Escape"){c.stopPropagation(),t();return}if(c.key!=="Tab")return;const d=n.current;if(!d)return;const f=Array.from(d.querySelectorAll(b1)).filter(v=>v.offsetParent!==null||v===document.activeElement);if(f.length===0){c.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){c.preventDefault(),(c.shiftKey?g:h).focus();return}c.shiftKey&&m===h?(c.preventDefault(),g.focus()):!c.shiftKey&&m===g&&(c.preventDefault(),h.focus())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e,t]);const s=w.useCallback(l=>{l.target===l.currentTarget&&t()},[t]);return{dialogRef:n,onBackdropClick:s}}const go=80,m4=/<\/?[a-z][^>]*>/i,g4=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,v4=/[a-z0-9]/i;function y4(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 c=e.indexOf(">",n+1);if(c===-1)break;n=c+1;continue}}t+=e[n],n+=1}return t}function hj(e){if(typeof e!="string")return"";let t=y4(e);return t=t.replace(/[<>]/g,""),t=t.replace(g4,""),t=t.replace(/\s+/g," "),t=t.trim(),t.length>go&&(t=t.slice(0,go)),t}function x1(e){const t=hj(e);return t?v4.test(t)?m4.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>go?`Name was trimmed to ${go} 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 w1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function b4({open:e,onClose:t}){var ut,xe;const[n,r]=w.useState(""),[s,l]=w.useState(""),[c,d]=w.useState("curated"),[f,h]=w.useState("curator-only"),[g,m]=w.useState(!1),[v,b]=w.useState("community"),k=o4(),[j,C]=w.useState(((ut=k[0])==null?void 0:ut.slug)??"coding-project"),[S,N]=w.useState(!1),[E,T]=w.useState("off"),[$,R]=w.useState("7d"),[L,B]=w.useState("100k"),[O,_]=w.useState(!1),[I,F]=w.useState(""),[K,z]=w.useState(null),[q,V]=w.useState(null),[Z,Y]=w.useState(null),[W,D]=w.useState(null),[U,G]=w.useState(""),[M,ee]=w.useState(!0),[ce,oe]=w.useState(!1),{setContextGraphs:be,contextGraphs:Re,setActiveProject:Ne}=Ta(),{openTab:De}=hn(),{setStage:We,stage:Se}=Kg(),ft=()=>{ee(!0),oe(!1),nc().then(X=>{Y(X.agentAddress),oe(!1)}).catch(()=>{Y(null),oe(!0)}).finally(()=>ee(!1))};w.useEffect(()=>{e&&(V(null),ft())},[e]);const Ie=ts(e&&!W,t),qe=ts(e&&!!W,()=>{D(null),G(""),V(null),r(""),l(""),t()});if(!e)return null;const ke=hj(n),lt=w1(ke),ye=Z&<?`${Z}/${lt}`:lt?`<agent-address>/${lt}`:"",Oe=n?x1(n):null,Lt=X=>{r(X)},$t=async()=>{const X=ke;if(!X||Oe)return;_(!0),z(null),V(null),F(g?"Registering context graph on the network…":"Creating context graph locally…");const fe=w1(X);if(!Z){z("Agent identity is still loading. Please wait a moment and try again."),_(!1);return}const H=`${Z}/${fe}`;try{const se=setTimeout(()=>F(g?"On-chain registration in progress — this can take up to 30s…":"Setting up local context graph…"),5e3),pe=c==="curated"?1:0,Le=f==="curator-only"?0:1,He=c==="curated"?{accessPolicy:pe,publishPolicy:Le,allowedAgents:Z?[Z]:[],register:g}:{accessPolicy:pe,publishPolicy:Le,register:g},Ce=await OR(H,X,s.trim()||void 0,He);if(clearTimeout(se),g&&Ce.registered===!1){const Ee=`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]",Ee),V(Ee)}if(v==="community"||v==="agent")try{F(`Installing '${j}' ontology…`),await c4(Ce.created,j)}catch(Ee){console.warn("[CreateProjectModal] ontology install failed:",Ee),F(`Context graph created, but ontology install failed: ${(Ee==null?void 0:Ee.message)??Ee}`)}let Fe=!0;try{F("Publishing context graph manifest…"),await u4(Ce.created,{})}catch(Ee){Fe=!1,console.warn("[CreateProjectModal] manifest publish failed:",Ee),F(`Context graph created, but manifest publish failed: ${(Ee==null?void 0:Ee.message)??Ee}`)}F("Refreshing context graph list…");const{contextGraphs:tt}=await Pd();be(tt??[]),Ne(Ce.created),De({id:`project:${Ce.created}`,label:X,closable:!0}),Se<2&&We(2),Fe?(G(X),D(Ce.created),F("")):setTimeout(()=>{r(""),l(""),F(""),t()},2500)}catch(se){const pe=(se==null?void 0:se.message)||"Failed to create context graph";pe.includes("already exists")||pe.includes("409")?z("A context graph with this ID already exists. Try a different name."):(pe.includes("taking longer"),z(pe)),F("")}finally{_(!1)}},Qt=Re.length===0;function Gt(){D(null),G(""),V(null),r(""),l(""),t()}return W?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:Gt,"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:[q&&o.jsx("div",{className:"v10-modal-warning",children:q}),o.jsx(fj,{contextGraphId:W,projectName:U,variant:"create",onDone:Gt})]})]})}):o.jsx("div",{className:"v10-modal-overlay",onClick:Ie.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:Ie.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-create-cg-title","aria-describedby":"dkg-create-cg-subtitle",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close create context graph dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-create-cg-title",className:"v10-modal-title",children:"Create New Context Graph"}),o.jsx("div",{id:"dkg-create-cg-subtitle",className:"v10-modal-subtitle",children:"A context graph gives your agent structured memory — a place to draft, share, and publish knowledge."})]}),o.jsxs("div",{className:"v10-modal-body",children:[K&&o.jsx("div",{className:"v10-modal-error",children:K}),q&&o.jsx("div",{className:"v10-modal-warning",children:q}),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:X=>Lt(X.target.value),autoFocus:!0,maxLength:go,"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||(ye?`ID: did:dkg:context-graph:${ye}`:`${n.length}/${go} characters`)})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-description",children:"Description"}),o.jsx("textarea",{id:"dkg-cg-description",name:"dkg-cg-description",className:"v10-form-textarea",placeholder:"What should your agent remember? Describe the domain, goals, or context...",value:s,onChange:X=>l(X.target.value),"aria-label":"Context graph description"})]}),o.jsx("div",{className:"v10-form-divider"}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Sharing"}),o.jsxs("div",{className:"v10-form-radio-group",children:[o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:c==="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:c==="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)"]})]}),c==="curated"&&f==="open"&&o.jsxs("div",{style:{marginTop:6,fontSize:11,color:"var(--text-tertiary)"},children:["Note: an invite-only sharing graph with open contribution still lets ",o.jsx("em",{children:"any"})," wallet publish to Verifiable Memory — the on-chain publish check is not gated by the allowlist. See SPEC_CG_MEMORY_MODEL §2.5."]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"On-chain registration"}),o.jsxs("label",{className:"v10-form-radio",style:{display:"flex",alignItems:"flex-start",gap:8},children:[o.jsx("input",{type:"checkbox",checked:g,onChange:X=>m(X.target.checked),style:{marginTop:3}}),o.jsxs("span",{children:["Register on chain now (required for Verifiable Memory publishing)",o.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:4},children:"Off by default — the project is created locally and can be registered later from its Settings tab when your wallet is funded and a working RPC is configured."})]})]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Ontology"}),o.jsxs("div",{className:"v10-form-radio-group",children:[o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:v==="community",onChange:()=>b("community")}),"Choose a starter — install one of the bundled context-graph-type ontologies"]}),v==="community"&&o.jsxs("div",{style:{marginLeft:24,marginTop:4,marginBottom:8},children:[o.jsx("select",{className:"v10-form-select",value:j,onChange:X=>C(X.target.value),children:k.map(X=>o.jsx("option",{value:X.slug,children:X.displayName},X.slug))}),o.jsx("div",{style:{marginTop:6,fontSize:11,color:"var(--text-tertiary)"},children:(xe=k.find(X=>X.slug===j))==null?void 0:xe.description})]}),o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:v==="agent",onChange:()=>b("agent")}),"Let agent decide — defaults to the closest starter (v1)"]}),v==="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:v==="upload",onChange:()=>b("upload"),disabled:!0}),"Upload an ontology file (.ttl, .owl, .rdf) ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]})]})]}),o.jsxs("div",{className:"v10-form-advanced-toggle",onClick:()=>N(!S),children:[o.jsx("span",{className:`v10-form-adv-chevron ${S?"open":""}`,children:"▸"}),o.jsx("span",{children:"Advanced settings"})]}),S&&o.jsxs("div",{className:"v10-form-advanced-body",style:{opacity:.5,pointerEvents:"none"},children:[o.jsxs("div",{className:"v10-form-group",children:[o.jsxs("label",{className:"v10-form-label",children:["Consensus Quorum ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("select",{className:"v10-form-select",value:E,disabled:!0,children:[o.jsx("option",{value:"off",children:"Off — no consensus verification required"}),o.jsx("option",{value:"2of3",children:"2 of 3 — lightweight consensus"}),o.jsx("option",{value:"3of5",children:"3 of 5 — standard consensus (recommended for teams)"}),o.jsx("option",{value:"custom",children:"Custom — set your own M of N"})]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsxs("label",{className:"v10-form-label",children:["SWM TTL ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("select",{className:"v10-form-select",value:$,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:L,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"}),ce&&o.jsx("button",{className:"v10-modal-btn",onClick:ft,disabled:M,children:M?"Retrying…":"Retry Loading Agent"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:$t,disabled:!n.trim()||!!x1(n)||O||!Z||M,children:O?I||"Creating…":Z?"Create Context Graph":ce?"Agent unavailable":"Loading agent…"})]})]})})}function Xg(e){return{agentDid:e.agentDid,peerId:e.peerId}}function ns(e){if(!(e!=null&&e.trim()))return"unknown";const t=e.trim().replace(/^["']|["']$/g,"").toLowerCase();return t==="private"?"private":t==="public"?"public":"unknown"}function tn(e){let t=e.trim().replace(/^["']|["']$/g,"");t.startsWith("<")&&t.endsWith(">")&&(t=t.slice(1,-1));const n="did:dkg:agent:";if(t.length>=n.length&&t.slice(0,n.length).toLowerCase()===n.toLowerCase()){const s=t.slice(n.length),l=/^(0x[a-fA-F0-9]{40})$/i.exec(s);return l?`${n}${l[1].toLowerCase()}`:`${n}${s}`}return/^0x[a-fA-F0-9]{40}$/.exec(t)?`${n}${t.toLowerCase()}`:t.toLowerCase()}function Hd(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()&&tn(e.curator)===tn(t.agentDid))}function x4(e,t,n){const r=e.filter(s=>Hd(s,t));if(n&&!r.some(s=>s.id===n)){const s=e.find(l=>l.id===n);if(s)return[s,...r]}return r}function w4(e,t){return!(Hd(e,t)||ns(e.accessPolicy)!=="public")}function k4(e){return e.subscribed===!0||e.synced===!0?"project":"catalogue"}function S4(e){return e.alreadyMember===!0||e.autoApproved===!0||e.status==="approved"||e.status==="already-member"}const k1=/^(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|12D3Koo[1-9A-HJ-NP-Za-km-z]{45,53})$/;function j4(e){var b;const t=e.trim().replace(/\\n/g,`
|
|
1076
|
+
`),n=t.split(`
|
|
1077
|
+
`).map(k=>k.trim()).filter(Boolean),r=n[0]??"",s=n.slice(1).join(" ").trim(),l=t.match(/(?:^|\s)(\/(?:ip4|ip6|dns|dns4|dns6|dnsaddr)\/\S+)/),c=((b=l==null?void 0:l[1])==null?void 0:b.replace(/\s+/g,""))??null,d=s.replace(/\s+/g,""),f=d.startsWith("/")?d:c;let h=null;if(f){const k=f.match(/\/p2p\/([^/]+)$/);k&&k1.test(k[1])&&(h=k[1])}else for(const k of[s,...n.slice(1)]){const j=k.trim();if(k1.test(j)){h=j;break}}let g=r;c&&g.includes(c)&&(g=g.replace(c,"")),g=g.replace(/\s*@\s*$/,"").trim();const v=(n.length>1||s.length>0)&&h===null&&f===null;return{cgId:g,curatorPeerId:h,legacyMultiaddr:f,hasUnparsedExtra:v}}function C4(e,t){return!e.hasUnparsedExtra&&t.some(n=>n.id===e.cgId&&ns(n.accessPolicy)==="public")}function S1(e,t){const n=j4(e);return C4(n,t)?{kind:"publicSubscribe",invite:n,validationError:C1(n,{allowBareContextGraphId:!0}),idleLabel:"Subscribe",sendingLabel:"Subscribing…"}:{kind:"privateJoin",invite:n,validationError:C1(n),idleLabel:"Request to Join",sendingLabel:"Sending request…"}}async function j1(e){if(e.curatorPeerId){await AR(e.curatorPeerId).catch(()=>{});return}e.legacyMultiaddr&&(console.warn("[DKG] This invite uses a legacy multiaddr (deprecated). Ask the curator to regenerate using the current Share Context Graph modal — V10 invites carry a peer id and resolve via DHT, so they survive relay rotations."),await ER(e.legacyMultiaddr).catch(()=>{}))}function C1(e,t={}){if(!e.cgId)return"Missing context graph ID";if(e.hasUnparsedExtra)return"Invite contains a second line that is not a valid peer ID (12D3Koo…) or multiaddr (/ip4/…). Check for typos.";if(!e.curatorPeerId&&!e.legacyMultiaddr&&!t.allowBareContextGraphId)return"This invite is missing the curator peer id. Ask the curator to regenerate the invite from the Share Context Graph dialog.";if(e.legacyMultiaddr){if(!e.legacyMultiaddr.startsWith("/"))return"Invalid curator multiaddr";if(!e.legacyMultiaddr.includes("/p2p/"))return"Curator multiaddr is missing peer ID"}return null}function N4(e){if(e instanceof Pn&&e.status===502){const t=E4(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(A4),s=r?"Curator rejected this join request.":"Couldn't deliver this join request to the curator.",l=T4(n,r);return l?`${s} Reason: ${n}. ${l}`:`${s} Reason: ${n}.`}return e instanceof Error&&e.message?e.message:"Failed to send join request"}function E4(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 A4(e){const t=e.replace(/^[^:]+:\s*/,"").trim();return!(!t||/^dial failed\b/i.test(t)||/^not curator$/i.test(t))}function T4(e,t){return t?/scope mismatch/i.test(e)?"This usually means your daemon's network config has a stale ContextGraphsHub address — pull the latest release (or `git pull && pnpm install && pnpm run build:runtime`) and try again.":/unknown CG/i.test(e)?"The curator doesn't recognise this context graph id — double-check the invite, or ask the curator to share an updated one.":null:/not curator/i.test(e)?"Your node reached other peers, but none of them curate this context graph. Make sure the curator's daemon is online and the invite carries the right curator peer id.":null}function R4({open:e,onClose:t,initialContextGraphId:n}){const[r,s]=w.useState(n??""),[l,c]=w.useState("idle"),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,v]=w.useState(!1),[b,k]=w.useState(null),[j,C]=w.useState(""),{contextGraphs:S,setContextGraphs:N,setActiveProject:E}=Ta(),{openTab:T}=hn();w.useEffect(()=>{n&&s(n)},[n]),w.useEffect(()=>{e||(s(n??""),f(null),c("idle"),g(null),v(!1))},[e,n]);const $=w.useCallback(Y=>{E(Y.id),T({id:`project:${Y.id}`,label:Y.name||Y.id,closable:!0})},[E,T]),R=w.useCallback(async(Y,W)=>{const{contextGraphs:D}=await Pd(),U=D??[];N(U);const G=U.find(M=>M.id===Y)??W;return G&&$(G),G},[N,$]),L=w.useCallback(async Y=>{c("approved");try{const W=await R(Y);W&&(C(W.name??Y),k(Y))}catch{}},[R]),B=w.useCallback(Y=>{var D;if(!(!h||Y.type!=="join_approved"&&Y.type!=="join_rejected"||((D=Y.data)==null?void 0:D.contextGraphId)!==h)){if(Y.type==="join_rejected"){c("rejected");return}L(h)}},[h,L]);ls(B);const O=ts(e&&!b,t),_=ts(e&&!!b,()=>{k(null),C(""),t()});if(!e)return null;const I=async()=>{const Y=S1(r,S);if(Y.validationError){f(Y.validationError);return}const{cgId:W,curatorPeerId:D}=Y.invite;if(f(null),Y.kind==="publicSubscribe"){c("sending");try{const G=S.find(M=>M.id===W);await j1(Y.invite),await w_(W,{syncMode:m?"always-on":"on-demand"}),await R(W,G),t()}catch(G){f(G instanceof Error?G.message:"Could not subscribe to this public context graph."),c("idle")}return}const U=S.find(G=>G.id===W);if(U){$(U),t();return}c("sending");try{await j1(Y.invite);const G=await LR(W),M=await nc().then(ce=>ce.name).catch(()=>{}),ee=await DR(W,{delegation:G.delegation,agentName:M,curatorPeerId:D??void 0});if(g(W),S4(ee)){await L(W);return}c("pending")}catch(G){f(N4(G)),c("idle")}};function F(){k(null),C(""),t()}if(b)return o.jsx("div",{className:"v10-modal-overlay",onClick:_.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:_.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-join-wire-title",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:F,"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 ",j]}),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(fj,{contextGraphId:b,projectName:j,variant:"join",onDone:F})})]})});const K=l==="sending",z=l==="pending",q=l==="approved",V=l==="rejected",Z=S1(r,S);return o.jsx("div",{className:"v10-modal-overlay",onClick:O.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:O.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-join-cg-title","aria-describedby":"dkg-join-cg-subtitle",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close join context graph dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-join-cg-title",className:"v10-modal-title",children:"Join a Context Graph"}),o.jsx("div",{id:"dkg-join-cg-subtitle",className:"v10-modal-subtitle",children:"Enter a discovered public Context Graph ID to subscribe, or paste a curator invite for a private graph."})]}),o.jsxs("div",{className:"v10-modal-body",children:[d&&o.jsx("div",{className:"v10-modal-error",children:d}),z&&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."}),q&&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…"}),V&&o.jsx("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:16,fontSize:12,background:"rgba(245, 158, 11, 0.08)",border:"1px solid rgba(245, 158, 11, 0.25)",color:"var(--accent-warning, #f59e0b)"},children:"The curator declined this join request."}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-invite",children:"Context Graph ID or Invite Code"}),o.jsx("textarea",{id:"dkg-cg-invite",name:"dkg-cg-invite",className:"v10-form-textarea",placeholder:`Public: paste a Context Graph ID
|
|
1078
|
+
|
|
1079
|
+
Private: paste the curator invite
|
|
1080
|
+
my-context-graph-abc123
|
|
1081
|
+
12D3KooW...`,value:r,onChange:Y=>s(Y.target.value),autoFocus:!0,rows:3,disabled:K||z||q,style:{fontFamily:"var(--font-mono)",fontSize:11},"aria-label":"Context graph invite code",autoComplete:"off",spellCheck:!1})]}),Z.kind==="publicSubscribe"&&o.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,fontSize:12,color:"var(--text-secondary)",cursor:K?"default":"pointer"},children:[o.jsx("input",{type:"checkbox",checked:m,onChange:Y=>v(Y.target.checked),disabled:K,"aria-label":"Keep this Context Graph synchronized after restart"}),o.jsxs("span",{children:["Keep synchronized after restart",o.jsx("span",{style:{display:"block",color:"var(--text-tertiary)",marginTop:2},children:"Off by default. This node otherwise syncs the graph only when you open it."})]})]})]}),o.jsxs("div",{className:"v10-modal-footer",children:[o.jsx("button",{className:"v10-modal-btn",onClick:t,children:z||q?"Close":"Cancel"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:I,disabled:!r.trim()||K||z||q,children:K?Z.sendingLabel:z?"Awaiting approval…":q?"Approved":Z.idleLabel})]})]})})}const mj="v10:hiddenProjectIds",$m="v10:hidden-projects-change";function zh(){try{const e=localStorage.getItem(mj);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t:[])}catch{return new Set}}function N1(e){try{localStorage.setItem(mj,JSON.stringify([...e])),window.dispatchEvent(new Event($m))}catch{}}function Jg(){const[e,t]=w.useState(()=>zh());w.useEffect(()=>{const s=()=>t(zh());return window.addEventListener($m,s),window.addEventListener("storage",s),()=>{window.removeEventListener($m,s),window.removeEventListener("storage",s)}},[]);const n=w.useCallback(s=>{const l=new Set(zh());l.add(s),N1(l)},[]),r=w.useCallback(()=>{N1(new Set)},[]);return{hidden:e,hide:n,unhideAll:r}}function E1({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 _4({cg:e,isBrowsing:t,onBrowse:n,onSubscribe:r,onHide:s}){const l=e.name||e.id.slice(0,16);return o.jsx("div",{className:"v10-tree-section",children:o.jsxs("div",{className:`v10-tree-section-header catalogue ${t?"active":""}`,children:[o.jsx("span",{className:"v10-tree-project-dot"}),o.jsx("span",{className:"v10-tree-section-label",children:l}),o.jsx("button",{type:"button",className:"v10-tree-catalogue-btn","aria-label":`Browse ${l}`,onClick:n,children:"Browse"}),o.jsx("button",{type:"button",className:"v10-tree-catalogue-btn primary","aria-label":`Subscribe to ${l}`,onClick:r,children:"Subscribe"}),o.jsx("button",{type:"button",className:"v10-tree-hide-btn",title:"Hide this context graph from the sidebar (reversible)",onClick:s,children:"×"})]})})}function O4(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 M4(){const[e,t]=w.useState([]),[n,r]=w.useState(null),s=w.useCallback(()=>{Bd().then(l=>{t(l.integrations),r(null)}).catch(l=>r(l.message))},[]);return rc(s,3e4),o.jsxs("div",{className:"v10-tree-items",style:{display:"block"},children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:.5,padding:"6px 12px 2px 24px"},children:"Agents"}),n&&o.jsx("div",{style:{fontSize:11,color:"var(--accent-orange, #f97316)",padding:"4px 12px 4px 24px"},children:n}),!n&&e.length===0&&o.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 12px 4px 24px",fontStyle:"italic"},children:"No agents detected."}),e.map(l=>o.jsxs("div",{className:"v10-tree-item",title:l.detail,style:{cursor:"default"},children:[o.jsx("span",{"aria-label":l.statusLabel,style:{width:7,height:7,borderRadius:"50%",background:O4(l.status),flexShrink:0}}),o.jsx("span",{className:"v10-tree-item-label",children:l.name}),o.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:4},children:l.statusLabel})]},l.id))]})}function L4(){const e=Kn(W=>W.leftSectionMyProjectsOpen),t=Kn(W=>W.leftSectionIntegrationsOpen),n=Kn(W=>W.toggleLeftSectionMyProjects),r=Kn(W=>W.toggleLeftSectionIntegrations),s=w.useId(),l=w.useId(),{openTab:c,activeTabId:d,setActiveTab:f}=hn(),{contextGraphs:h,setContextGraphs:g,setLoading:m,activeProjectId:v,setActiveProject:b}=Ta(),k=Kg(W=>W.stage),[j,C]=w.useState("explorer"),{hidden:S,hide:N,unhideAll:E}=Jg(),T=Fd().data,$=T?Xg(T):null,R=h.filter(W=>!S.has(W.id)),L=R.filter(W=>Hd(W,$)),B=R.filter(W=>w4(W,$)),O=h.length-R.length,[_,I]=w.useState(!1),[F,K]=w.useState(!1),[z,q]=w.useState(),V=w.useCallback(W=>{q(W),K(!0)},[]),Z=w.useCallback(()=>{K(!1),q(void 0)},[]),Y=w.useCallback(()=>{m(!0),_n.fetchContextGraphs().then(({contextGraphs:W})=>g(W??[])).catch(()=>{}).finally(()=>m(!1))},[g,m]);return rc(Y,6e4),ls(w.useCallback(W=>{(W.type==="join_approved"||W.type==="project_synced")&&Y()},[Y])),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:()=>I(!0),children:"+ New Context Graph"}),o.jsx("button",{className:"v10-new-project-btn",onClick:()=>V(),children:"↗ Join Context Graph"})]}),o.jsxs("div",{className:"v10-tree-header",children:[o.jsx("button",{className:`v10-tree-mode-btn ${j==="explorer"?"active":""}`,onClick:()=>C("explorer"),children:"Context Graphs"}),o.jsx("button",{className:`v10-tree-mode-btn ${j==="oracle"?"active":""}`,onClick:()=>C("oracle"),children:"Context Oracle"})]}),j==="explorer"&&o.jsxs("div",{className:"v10-tree-content",children:[o.jsxs("div",{className:`v10-tree-dashboard ${d==="dashboard"?"active":""}`,onClick:()=>{f("dashboard"),b(null)},children:[o.jsx("span",{children:"▦"})," Dashboard"]}),h.length===0&&k<=1&&o.jsxs("div",{className:"v10-journey-empty-card",children:[o.jsx("div",{className:"v10-jec-title",children:"No context graphs yet"}),o.jsx("div",{className:"v10-jec-hint",children:k===0?"Connect an agent to get started.":"Create your first context graph to give your agent structured memory."}),k===1&&o.jsx("button",{className:"v10-new-project-btn",style:{margin:0},onClick:()=>I(!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(Dm,{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:L.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."})}):L.map(W=>o.jsx(E1,{cg:W,isActive:v===W.id,onSelect:()=>{b(W.id),c({id:`project:${W.id}`,label:W.name||W.id.slice(0,16),closable:!0})},onHide:()=>{N(W.id),v===W.id&&b(null)}},W.id))})]}),O>0&&o.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:E,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",O," hidden context graph",O!==1?"s":""]}),k>=1&&o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header","aria-expanded":t,"aria-controls":l,onClick:r,children:[o.jsx(Dm,{size:14,className:`v10-peer-group-chevron ${t?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:"Integrations"})]}),t&&o.jsx("div",{id:l,className:"v10-peer-group-body",children:o.jsx(M4,{})})]})]}),j==="oracle"&&o.jsxs("div",{className:"v10-tree-content",children:[B.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-tree-group-label",children:"Context Oracle"}),B.map(W=>{const D=()=>{N(W.id),v===W.id&&b(null)};return k4(W)==="catalogue"?o.jsx(_4,{cg:W,isBrowsing:d===`project:${W.id}`,onBrowse:()=>{b(null),c({id:`project:${W.id}`,label:W.name||W.id.slice(0,16),closable:!0})},onSubscribe:()=>V(W.id),onHide:D},W.id):o.jsx(E1,{cg:W,isActive:v===W.id,onSelect:()=>{b(W.id),c({id:`project:${W.id}`,label:W.name||W.id.slice(0,16),closable:!0})},onHide:D},W.id)})]}),B.length===0&&o.jsxs("p",{style:{fontSize:12,color:"var(--text-tertiary)",padding:"20px 12px",textAlign:"center",lineHeight:1.5},children:["No discovered public Context Graphs yet. Public graphs appear here as soon as your node discovers them; use ",o.jsx("strong",{children:"Join Context Graph"})," to subscribe by ID."]}),O>0&&o.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:E,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",O," hidden context graph",O!==1?"s":""]})]}),o.jsx(b4,{open:_,onClose:()=>I(!1)}),o.jsx(R4,{open:F,onClose:Z,initialContextGraphId:z})]})}function da(e,t=[],n=0){const[r,s]=w.useState(null),[l,c]=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 v=!!window.__DKG_TOKEN__,b=sessionStorage.getItem("__dkg_401_reloaded")==="1";if(v&&!b){sessionStorage.setItem("__dkg_401_reloaded","1"),window.location.reload();return}f("Authentication expired — please refresh the page.");return}f(m.message)}}finally{h.current&&c(!1)}},t);return w.useEffect(()=>{h.current=!0,c(!0),g();let m=null;const v=()=>{n<=0||m||(m=setInterval(g,n))},b=()=>{m&&(clearInterval(m),m=null)},k=()=>{typeof document>"u"||(document.hidden?b():(g(),v()))};return(typeof document>"u"||!document.hidden)&&v(),typeof document<"u"&&document.addEventListener("visibilitychange",k),()=>{h.current=!1,b(),typeof document<"u"&&document.removeEventListener("visibilitychange",k)}},[g,n]),{data:r,loading:l,error:d,refresh:g}}function dW(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 A1(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 D4(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 T1(e,t=8){return e?e.length<=t*2?e:e.slice(0,t)+"..."+e.slice(-4):"—"}function I4(){const e=Ta(m=>m.contextGraphs),t=Ta(m=>m.setContextGraphs),{hidden:n}=Jg(),[r,s]=w.useState(null),[l,c]=w.useState(!0),[d,f]=w.useState(()=>e.length===0),h=w.useCallback(()=>{_n.fetchContextGraphs().then(({contextGraphs:m})=>t(m??[])).catch(()=>{}).finally(()=>f(!1))},[t]);return w.useEffect(()=>{h();const m=setInterval(h,6e4);return()=>clearInterval(m)},[h]),ls(w.useCallback(m=>{m.type!=="join_approved"&&m.type!=="join_rejected"&&m.type!=="project_synced"||h()},[h])),w.useEffect(()=>{let m=!0;return c(!0),_n.fetchCurrentAgent().then(v=>{m&&s(Xg(v))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e]),{myCgs:w.useMemo(()=>e.filter(m=>!n.has(m.id)).filter(m=>Hd(m,r)),[e,n,r]),identity:r,identityLoading:l,cgsLoading:d}}const ev=["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 qd(e={}){const t={predicates:[...e.extraPredicates??[],...ev]};return e.minZoomForLabels!==void 0&&(t.minZoomForLabels=e.minZoomForLabels),t}function Gd(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 R1="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function _u(e){if(e!=null)return typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function ed(e){const t=xt(e);return!t||t.startsWith('"')||/\s/.test(t)?!1:t.startsWith("_:")?!0:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function xt(e){const t=e.trim();return t.startsWith('"')?t:t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function co(e){if(!e)return"—";if(e.startsWith('"'))return Gd(e);const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function tv(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=e.lastIndexOf(":"),s=Math.max(t,n,r),l=s>=0?e.slice(s+1):e;try{return decodeURIComponent(l)}catch{return l}}function z4(e){const t=tv(e).trim();return t?(/^[0-9a-f-]{16,}$/i.test(t)?t.replace(/-/g,"").slice(0,12):t).replace(/[_-]+/g," ").trim():""}function $4(e,t){return e===t&&/^urn:dkg:extraction:[^\s]+$/i.test(t)}function P4(e,t){return e===t&&ed(t)}function U4(e){const t=z4(e.uri),n=e.types.map(co).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||co(e.uri)}function B4(e){for(const n of ev){const r=e.properties.get(n),s=r==null?void 0:r.find(l=>l.trim().length>0);if(s)return s}const t=co(e.uri);return e.label&&(e.label!==t||!P4(e.label,e.uri))&&!$4(e.label,e.uri)?e.label:U4(e)}const gj=5e4,vj=2e4,yj=2e4;function F4(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 ${gj}`}function H4(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 ${vj}`}function q4(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 ${yj}`}function G4(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),s=r.indexOf("/"),l=s>=0?r.slice(0,s):r;if(!(!l||l.startsWith("_")||l==="assertion"||l==="meta"))return l}const _1={wm:"loading",swm:"loading",vm:"loading"},V4={wm:"error",swm:"error",vm:"error"};async function $h(e,t,n){var r,s;try{const{layerLimit:l,...c}=n??{},d={sparql:e,contextGraphId:t,...c},f=await fd(d),h=((r=f==null?void 0:f.result)==null?void 0:r.bindings)??((s=f==null?void 0:f.results)==null?void 0:s.bindings)??[],g=typeof l=="number"&&h.length>=l;return{triples:h.map(v=>{const b=_u(v.g);return{subject:_u(v.s)??"",predicate:_u(v.p)??"",object:_u(v.o)??"",subGraph:b?G4(b,t):void 0}}).filter(v=>v.subject&&v.predicate&&v.object),ok:!0,truncated:g}}catch{return{triples:[],ok:!1,truncated:!1}}}function W4(e){var f;const t=new Map,n=new Map,r=new Map,s=new Map,l=new Map;function c(h,g,m){let v=s.get(h);v||(v=new Map,s.set(h,v));let b=v.get(g);if(b||(b=new Set,v.set(g,b)),b.has(m))return!1;b.add(m);let k=l.get(h);return k||(k={working:0,shared:0,verified:0},l.set(h,k)),k[g]++,!0}function d(h){const g=xt(h);let m=t.get(g);return m||(m={uri:g,label:co(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===R1){const m=xt(h.object);g.types.includes(m)||g.types.push(m)}else if(ed(h.object)){const m=xt(h.object),v=d(m);v.layers.add(h.layer),h.subGraph&&v.subGraphs.add(h.subGraph);const b=n.get(g.uri)??new Set,k=`${h.predicate}\0${m}`;b.has(k)||(b.add(k),n.set(g.uri,b),g.connections.push({predicate:h.predicate,targetUri:m,targetLabel:co(m)}))}else{const m=r.get(g.uri)??new Set,v=`${h.predicate}\0${h.object}`;if(!m.has(v)){m.add(v),r.set(g.uri,m);const b=g.properties.get(h.predicate)??[];b.push(Gd(h.object)),g.properties.set(h.predicate,b)}}}for(const h of t.values())h.label=B4(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=xt(h.subject),m=t.get(g);if(m&&m.trustLevel!==h.layer)continue;const v=ed(h.object)?xt(h.object):h.object,b=ed(h.object);if(b){const j=t.get(v);if(j&&j.trustLevel!==h.layer)continue}const k=`${g}\0${h.predicate}\0${v}`;if(m&&c(m.uri,h.layer,k),h.predicate===R1){if(v!==g){const j=t.get(v);j&&c(j.uri,h.layer,k)}}else if(b&&v!==g){const j=t.get(v);j&&c(j.uri,h.layer,k)}}for(const h of t.values()){const g=l.get(h.uri);h.tripleCount=g?g[h.trustLevel]:0}for(const h of t.values())for(const g of h.connections)g.targetLabel=((f=t.get(g.targetUri))==null?void 0:f.label)??co(g.targetUri);return t}const bj=W4;function xj(e){return e.types.length>0||e.properties.size>0||e.connections.length>0}function nv(e,t){const n=(t==null?void 0:t.signalErrors)??!1,[r,s]=w.useState([]),[l,c]=w.useState(!0),[d,f]=w.useState(null),[h,g]=w.useState(!1),[m,v]=w.useState(_1),b=w.useRef(0),k=w.useCallback(async()=>{if(!e)return;const T=++b.current;c(!0),f(null),g(!1),v(_1);try{const $={includeContextGraphPartitions:!0},[R,L,B]=await Promise.all([$h(F4(e),e,{...$,layerLimit:gj}),$h(H4(e),e,{...$,layerLimit:vj}),$h(q4(e),e,{...$,layerLimit:yj})]);if(T!==b.current)return;const O=[...R.triples.map(K=>({...K,layer:"working"})),...L.triples.map(K=>({...K,layer:"shared"})),...B.triples.map(K=>({...K,layer:"verified"}))];s(O),v({wm:R.ok?"ok":"error",swm:L.ok?"ok":"error",vm:B.ok?"ok":"error"});const _=[R,L,B],I=_.filter(K=>!K.ok).length,F=_.some(K=>K.truncated);g(I>0&&I<3||F),f(n&&I===3?"Failed to load memory data":null)}catch($){T===b.current&&(f($.message??"Failed to load memory data"),v(V4))}finally{T===b.current&&c(!1)}},[e,n]);Co(e,k),w.useEffect(()=>{k()},[k]);const j=w.useMemo(()=>bj(r),[r]),C=w.useMemo(()=>[...j.values()].filter(xj).sort((T,$)=>{const R={verified:0,shared:1,working:2},L=R[T.trustLevel]-R[$.trustLevel];if(L!==0)return L;const B=T.tripleCount??0,O=$.tripleCount??0;return O!==B?O-B:T.label.localeCompare($.label)}),[j]),S=w.useMemo(()=>{const T=new Set;return r.filter($=>{const R=`${$.subject}|${$.predicate}|${$.object}`;return T.has(R)?!1:(T.add(R),!0)}).map(({subject:$,predicate:R,object:L,subGraph:B})=>({subject:$,predicate:R,object:L,subGraph:B}))},[r]),N=w.useMemo(()=>{const T=new Map;for(const[$,R]of j)T.set($,R.trustLevel);return T},[j]),E=w.useMemo(()=>{let T=0,$=0,R=0;for(const L of C)L.trustLevel==="verified"?R++:L.trustLevel==="shared"?$++:T++;return{wm:T,swm:$,vm:R,total:C.length}},[C]);return{entities:j,entityList:C,allTriples:r,graphTriples:S,trustMap:N,counts:E,loading:l,error:d,partial:h,layerStatus:m,refresh:k}}const ic="http://dkg.io/viz/",wj=`${ic}OnChainAnchor`,kj=`${ic}AgentIdentity`,Sj=`${ic}anchoredIn`,jj=`${ic}signedBy`,Cj=`${ic}consensus`,O1="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",M1="http://schema.org/name",L1="http://schema.org/description";function kl(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 Z4(e){const t=e.opId.slice(0,10);try{const r=new Date(e.publishedAt).toISOString().slice(11,16);return`anchor ${t} · ${r}UTC`}catch{return`anchor ${t}`}}function K4(e){if(e.startsWith("did:dkg:agent:")){const t=e.slice(14);return t.startsWith("0x")?t.slice(0,6)+"…"+t.slice(-4):t.slice(0,6)+"…"+t.slice(-6)}return e.length>18?e.slice(0,8)+"…"+e.slice(-6):e}function Y4(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 Q4(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),s=r.indexOf("/");if(s<0)return;const l=r.slice(0,s);if(!(!l||l.startsWith("_")))return l}function X4(e){const t=e.lastIndexOf(":");return t>=0?e.slice(t+1):e}function J4(e,t){const n=[],r=new Set;for(const s of e){const l=t?s.roots.filter(d=>t.has(d)):s.roots;if(l.length===0)continue;const c=`urn:dkg:viz:anchor:${s.opId}`;n.push({subject:c,predicate:O1,object:wj,subGraph:s.subGraph}),n.push({subject:c,predicate:M1,object:`"${Z4(s)}"`,subGraph:s.subGraph}),n.push({subject:c,predicate:L1,object:`"Published ${s.roots.length} KA${s.roots.length===1?"":"s"} · ${new Date(s.publishedAt).toISOString()}"`,subGraph:s.subGraph});for(const d of l)n.push({subject:d,predicate:Sj,object:c,subGraph:s.subGraph}),n.push({subject:d,predicate:Cj,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:c,predicate:jj,object:h,subGraph:s.subGraph}),r.has(h)||(r.add(h),n.push({subject:h,predicate:O1,object:kj,subGraph:s.subGraph}),n.push({subject:h,predicate:M1,object:`"${K4(f)}"`,subGraph:s.subGraph}),n.push({subject:h,predicate:L1,object:`"${f}"`,subGraph:s.subGraph}))}}return n}function eL(e,t){const[n,r]=w.useState([]),[s,l]=w.useState(!1),[c,d]=w.useState(null),f=w.useRef(0);w.useEffect(()=>{if(!e){r([]),l(!1);return}const v=++f.current;l(!0),d(null),(async()=>{var b;try{const k=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Ht()},body:JSON.stringify({sparql:Y4(e)})});if(!k.ok)throw new Error(`SPARQL query failed: ${k.status}`);const j=await k.json(),C=((b=j==null?void 0:j.result)==null?void 0:b.bindings)??[],S=new Map;for(const N of C){const E=kl(N.op),T=kl(N.root),$=kl(N.agent),R=kl(N.publishedAt),L=kl(N.g);if(!E||!T||!$||!R)continue;let B=S.get(E);B||(B={opId:X4(E),opUri:E,agents:[],roots:[],publishedAt:R,subGraph:L?Q4(L,e):void 0},S.set(E,B)),B.roots.includes(T)||B.roots.push(T),B.agents.includes($)||B.agents.push($)}if(v!==f.current)return;r([...S.values()].sort((N,E)=>E.publishedAt.localeCompare(N.publishedAt)))}catch(k){if(v!==f.current)return;d((k==null?void 0:k.message)??"Failed to load anchors"),r([])}finally{v===f.current&&l(!1)}})()},[e]);const h=w.useMemo(()=>{if(!t)return null;const v=[];if(t instanceof Set)for(const b of t)v.push(b);else for(const b of t)v.push(b);return v.sort(),v.join("|")},[t]),g=w.useMemo(()=>h==null?null:new Set(h.length===0?[]:h.split("|")),[h]),m=w.useMemo(()=>J4(n,g),[n,g]);return{anchors:n,decorationTriples:m,loading:s,error:c}}function tL(e){return e.activeSubGraph?!1:e.activeLayer==="swm"}const Xi={verified:"#22c55e",shared:"#f59e0b",working:"#64748b"},Xs={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"}},nL="http://www.w3.org/ns/prov#wasAttributedTo",No="http://dkg.io/ontology/agent/",aL=No+"createdBy",rL=No+"promotedBy",iL=No+"publishedBy",sL=No+"createdAt",oL=No+"promotedAt",lL=No+"publishedAt";function Vd(e){for(const t of e.connections)if(t.predicate===nL)return t.targetUri;return null}function cL(e,t){const n=t==="created"?aL:t==="promoted"?rL:iL;for(const r of e.connections)if(r.predicate===n)return r.targetUri;return Vd(e)}function uL(e,t){const n=t==="created"?sL:t==="promoted"?oL:lL,r=e.properties.get(n);return(r==null?void 0:r[0])??null}function D1(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function Js(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 Wd(e,t){var s,l;if(t)for(const c of e.types){const d=t.forType(c),f=D1(c),h=d.label??f;if(d.icon||d.color||d.label)return{icon:d.icon??((s=Xs[f])==null?void 0:s.icon)??Xs.Thing.icon,group:d.label??((l=Xs[f])==null?void 0:l.group)??Xs.Thing.group,color:d.color,type:h}}const n=e.types[0]?D1(e.types[0]):"Entity";return{...Xs[n]??Xs.Thing,type:n}}const $n={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 sr(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 Zn="http://dkg.io/ontology/code/",Nj={[Zn+"Package"]:"#a855f7",[Zn+"File"]:"#3b82f6",[Zn+"Class"]:"#22c55e",[Zn+"Interface"]:"#06b6d4",[Zn+"Function"]:"#f59e0b",[Zn+"TypeAlias"]:"#ec4899",[Zn+"Enum"]:"#ef4444",[Zn+"ExternalModule"]:"#64748b",[wj]:"#f5a524",[kj]:"#c084fc"},Ej={[Zn+"imports"]:"#60a5fa",[Zn+"contains"]:"#a855f7",[Zn+"definedIn"]:"#3b82f6",[Zn+"exports"]:"#f59e0b",[Zn+"extends"]:"#22c55e",[Zn+"implements"]:"#06b6d4",[Sj]:"#f5a524",[jj]:"#c084fc",[Cj]:"#22c55e"};function av(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 dL(e,t){const{color:n}=$n[e],r=e==="vm";return{labelMode:"humanized",renderer:"2d",labels:qd({minZoomForLabels:r?.2:.3}),style:{classColors:Nj,predicateColors:Ej,namespaceColors:av(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 pL(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 fL(e,t,n=2){const r=d=>xt(d.subject),s=d=>xt(d.object),l=new Set([e]);let c=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);c.has(g)&&!l.has(m)&&f.add(m),c.has(m)&&!l.has(g)&&f.add(g)}for(const h of f)l.add(h);if(c=f,c.size===0)break}return t.filter(d=>l.has(r(d))&&l.has(s(d)))}function Aj(e,t){const n=t.lastIndexOf("/"),r=t.lastIndexOf("#"),s=t.lastIndexOf(":"),l=Math.max(n,r,s),c=l>=0?t.slice(l+1):t,d=(()=>{try{return decodeURIComponent(c)}catch{return c}})();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 rv(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 Pm(e,t){return!t.isRoot&&e.subGraph===t.slug?!0:e.subGraph?!1:t.scopedUris.has(e.subject)?!0:t.requireResourceObject?rv(e.object)&&t.scopedUris.has(e.object):t.scopedUris.has(e.object)}function Tj(e,t){const n=t.get(xt(e.subject));return n!==void 0&&n.trustLevel!==e.layer}function Rj(e,t){if(!rv(e.object))return!1;const n=t.get(xt(e.object));return n!==void 0&&n.trustLevel!==e.layer}function _j(e,t){return Tj(e,t)||Rj(e,t)}function Oj(e,t){return Tj(e,t)&&Rj(e,t)}function Um(e,t){const n=new Set,r=[];for(const s of e){if(Oj(s,t))continue;const l=`${xt(s.subject)}|${s.predicate}|${xt(s.object)}`;n.has(l)||(n.add(l),r.push(s))}return r}function iv(e){return w.useMemo(()=>{const t=Um(e.allTriples,e.entities);return{triples:t,total:t.length}},[e.allTriples,e.entities])}function Mj(e){return w.useMemo(()=>{const t=new Set,n=new Set,r=new Set,s=new Set;let l=0,c=0,d=0,f=0;for(const h of e.allTriples){const g=`${xt(h.subject)}|${h.predicate}|${xt(h.object)}`;!Oj(h,e.entities)&&!s.has(g)&&(s.add(g),f++),_j(h,e.entities)||(h.layer==="working"&&!t.has(g)?(t.add(g),l++):h.layer==="shared"&&!n.has(g)?(n.add(g),c++):h.layer==="verified"&&!r.has(g)&&(r.add(g),d++))}return{wm:l,swm:c,vm:d,canonical:f}},[e.allTriples,e.entities])}function hL(e,t){const n=$n[t].trustLevel;return w.useMemo(()=>{const r=new Set,s=[];for(const l of e.allTriples){if(l.layer!==n||_j(l,e.entities))continue;const c=`${xt(l.subject)}|${l.predicate}|${xt(l.object)}`;r.has(c)||(r.add(c),s.push(l))}return s},[e.allTriples,e.entities,n])}const mL="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function gL(e){const t=e.trim();return(t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t)===mL}function xd(e,t,n){const r=[],s=n==null?void 0:n.focalSubjects;for(const l of e){const c=xt(l.subject);!t.has(c)&&!(s!=null&&s.has(c))||rv(l.object)&&!gL(l.predicate)&&!t.has(xt(l.object))||r.push(l)}return r}const Ph="http://dkg.io/ontology/sourceContentType",I1="http://dkg.io/ontology/markdownForm",z1="http://dkg.io/ontology/sourceFile",$1="http://dkg.io/ontology/size";function vL(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 yL(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 td(e,t){const n=e.properties.get(t),r=n==null?void 0:n[0];if(!r)return null;const s=r.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),l=Date.parse(s);return Number.isNaN(l)?null:l}function bL(e){const t=Date.now()-e;if(t<0)return"just now";const n=Math.floor(t/1e3);if(n<45)return"just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const s=Math.floor(r/60);if(s<24)return`${s}h ago`;const l=Math.floor(s/24);return l<30?`${l}d ago`:new Date(e).toISOString().slice(0,10)}function xL(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 wL(e){if(!(e==null||e===""))return`Exact balance: ${e} (full precision from chain)`}function kL(e){if(e==null)return"—";const t=e/100;return`${t%1===0?t.toFixed(0):t.toFixed(1)}%`}function SL(){sj();const e=Og(l=>{var c;return(c=l.nodeStatus)==null?void 0:c.nodeRole}),t=hn(l=>l.openTab),{covered:n,bestCoveringDiscountBps:r,walletsInconclusive:s}=ij();return o.jsxs("div",{className:"v10-ws-pca",children:[o.jsx("span",{className:"v10-ws-pca-label",children:"Publishing discount"}),o.jsx("span",{className:"v10-ws-pca-value","data-covered":n,children:s?"Couldn’t verify your wallets — retry":n?`${kL(r)} discount`:"None — publishing at the direct cost"}),o.jsxs("button",{type:"button",className:"v10-ws-pca-cta",onClick:()=>t({id:"conviction",label:"Publisher Conviction",closable:!0}),children:[e==="edge"?"Get added to a PCA":"Set up PCA"," ->"]})]})}const jL="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.",Bm=[{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."}],Ou={1:"Ethereum",8453:"Base",84532:"Base Sepolia",100:"Gnosis",10200:"Chiado",2043:"NeuroWeb",20430:"NeuroWeb Testnet"};function Uh(e){var s;const t=lj(e);if(e==null)return{name:"Unknown chain",gas:t};const n=String(e);if(Ou[n])return{name:Ou[n],gas:t};const r=(s=n.match(/(\d+)\s*$/))==null?void 0:s[1];return r&&Ou[r]?{name:Ou[r],gas:t}:{name:r?`Chain ${r}`:`Chain ${n}`,gas:t}}function Sl(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 Bh({label:e,value:t,sub:n,accentColor:r,children:s,icon:l,className:c}){return o.jsxs("div",{className:`stat-card v10-anim-mount${c?` ${c}`:""}`,children:[r&&o.jsx("div",{className:"accent",style:{background:r}}),o.jsxs("div",{className:"stat-label",children:[l,e]}),t!=null&&t!==""&&o.jsx("div",{className:"stat-value",children:t}),s,n!=null&&n!==""&&o.jsx("div",{className:"stat-sub",children:n})]})}function P1({counts:e}){const t=e.wm+e.swm+e.vm,n=Bm.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"}):Bm.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 CL(){return o.jsx("div",{className:"v10-layer-legend",children:Bm.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 NL({curator:e,joined:t,refreshing:n}){const r=e+t,s=`Curator ${e} · Joined ${t}`,l="var(--accent-green)",c="var(--text-secondary)";return o.jsxs("div",{className:`v10-cg-rolesplit${n?" is-refreshing":""}`,title:n?"Refreshing — agent identity is being re-checked":void 0,"aria-busy":n||void 0,children:[o.jsx("div",{className:"v10-layerbar","aria-label":s,children:r===0?o.jsx("span",{className:"v10-layerbar-empty"}):o.jsxs(o.Fragment,{children:[e>0&&o.jsx("span",{className:"v10-layerbar-seg",title:`Curator (${e}) — context graphs you created and curate`,style:{width:`${e/r*100}%`,background:l}}),t>0&&o.jsx("span",{className:"v10-layerbar-seg",title:`Joined (${t}) — context graphs you joined as a member`,style:{width:`${t/r*100}%`,background:c}})]})}),o.jsxs("div",{className:"v10-layer-legend",children:[o.jsxs("span",{className:"v10-layer-legend-item",title:"Curator — context graphs you created and curate",children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:l}}),"Curator ",e]}),o.jsxs("span",{className:"v10-layer-legend-item",title:"Joined — context graphs you joined as a member",children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:c}}),"Joined ",t]})]})]})}function EL({cg:e,identity:t,onReport:n,onOpen:r}){var L,B;const s=nv(e.id,{signalErrors:!0}),[l,c]=w.useState(null),[d,f]=w.useState(!1),h=l===null&&!d,g=w.useRef(!0),m=w.useRef(0),v=w.useCallback(()=>{const O=++m.current;_n.listParticipants(e.id).then(_=>{g.current&&O===m.current&&(c((_.allowedAgents??[]).map(tn)),f(!1))}).catch(()=>{g.current&&O===m.current&&(c(null),f(!0))})},[e.id]);w.useEffect(()=>{g.current=!0,c(null),f(!1),v();const O=setInterval(v,3e4);return()=>{g.current=!1,clearInterval(O)}},[v]),ls(w.useCallback(O=>{var I,F;if(O.type!=="join_approved"&&O.type!=="join_rejected"&&O.type!=="project_synced")return;const _=((I=O.data)==null?void 0:I.contextGraphId)??((F=O.data)==null?void 0:F.projectId);_&&_!==e.id||v()},[e.id,v]));const b=ns(e.accessPolicy)==="public",k=w.useMemo(()=>{var F;if(b)return null;const O=(F=e.curator)==null?void 0:F.trim(),_=O?tn(O):null;if(l===null)return d&&_?[_]:null;const I=new Set(l);return _&&I.add(_),[...I]},[l,d,e.curator,b]),j=Number.isFinite(e.assetCount??e.assets)?e.assetCount??e.assets:0,C=w.useMemo(()=>{if(s.error)return{wm:0,swm:0,vm:0,total:j};const O=new Set(s.allTriples.map(_=>_.subject)).size;return{wm:s.counts.wm,swm:s.counts.swm,vm:s.counts.vm,total:O}},[s.error,s.allTriples,s.counts.wm,s.counts.swm,s.counts.vm,j]),S=Mj(s),N=w.useMemo(()=>({wm:S.wm,swm:S.swm,vm:S.vm,total:S.canonical}),[S]),E=[s.loading?1:0,s.error?1:0,s.partial?1:0,h?1:0,d?1:0,b?1:0,C.wm,C.swm,C.vm,C.total,N.wm,N.swm,N.vm,N.total,k?k.slice().sort().join(","):"∅"].join("|");w.useEffect(()=>{n(e.id,{entities:C,triples:N,agents:k??[],sizeLoading:s.loading,sizeError:!!s.error||s.partial,sizeFallback:!!s.error,agentsLoading:h,agentsError:d,agentsUnknown:b,sig:E})},[e.id,E]);const T=ns(e.accessPolicy),$=T==="private"?"Curated":T==="public"?"Public":"Unknown",R=!!((L=e.curator)!=null&&L.trim()&&((B=t==null?void 0:t.agentDid)!=null&&B.trim())&&tn(e.curator)===tn(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:`${$} context graph`,"aria-label":`${$} context graph`,children:T==="private"?o.jsx(qO,{size:13,"aria-hidden":"true"}):T==="public"?o.jsx(UO,{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:[Sl(C.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"KA (summary)"})," · ",o.jsx("span",{className:"v10-cg-dim",children:"— triples"})]}):s.partial?o.jsxs("span",{title:"Partial — one or more memory layers were unavailable; counts are a lower bound",children:["~",Sl(C.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ~",Sl(N.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"triples"})]}):o.jsxs(o.Fragment,{children:[Sl(C.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ",Sl(N.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 U1={wm:0,swm:0,vm:0,total:0};function AL(){var R,L;const{data:e}=da(_n.fetchStatus,[],1e4),{data:t}=da(_n.fetchEconomics,[],6e4),{data:n,loading:r,error:s}=da(_n.fetchWalletsBalances,[],3e4),{openTab:l}=hn(),{setActiveProject:c}=Ta(),{myCgs:d,identity:f,identityLoading:h,cgsLoading:g}=I4(),m=(h||g)&&d.length===0,[v,b]=w.useState({}),k=w.useCallback((B,O)=>{b(_=>{var I;return((I=_[B])==null?void 0:I.sig)===O.sig?_:{..._,[B]:O}})},[]);w.useEffect(()=>{const B=new Set(d.map(O=>O.id));b(O=>{const _=Object.keys(O);if(_.every(F=>B.has(F)))return O;const I={};for(const F of _)B.has(F)&&(I[F]=O[F]);return I})},[d]);const j=w.useMemo(()=>{const B={...U1},O={...U1},_=new Set;let I=!1,F=!1,K=!1,z=!1,q=!1;for(const Z of d){const Y=v[Z.id];if(!Y){I=!0,F=!0;continue}Y.sizeLoading&&(I=!0),Y.agentsLoading&&(F=!0),Y.sizeError&&(K=!0),Y.sizeFallback&&(q=!0),(Y.agentsError||Y.agentsUnknown)&&(z=!0);for(const W of["wm","swm","vm","total"])B[W]+=Y.entities[W],O[W]+=Y.triples[W];for(const W of Y.agents)_.add(W)}const V=d.length>0;return{entities:B,triples:O,agentCount:_.size,sizeLoading:V&&I,agentsLoading:V&&F,sizePartial:K,agentsPartial:z,triplesUnknown:V&&K&&O.total===0,sizeApprox:V&&q,hasCgs:V}},[d,v]),C=w.useMemo(()=>{var I,F;const B=(I=f==null?void 0:f.agentDid)!=null&&I.trim()?tn(f.agentDid):null;let O=0,_=0;for(const K of d)!!(B&&((F=K.curator)!=null&&F.trim())&&tn(K.curator)===B)?O++:_++;return{curator:O,joined:_}},[d,f]),S=[{label:"24h",display:"Last 24h"},{label:"7d",display:"Last 7d"},{label:"30d",display:"Last 30d"}],N=B=>{if(B==null||typeof B=="string"&&B.trim()==="")return"—";const O=Number(B);return isFinite(O)?O.toLocaleString(void 0,{maximumFractionDigits:O>=1e3?0:2}):String(B)},E=S.map(B=>{var _;const O=(_=t==null?void 0:t.periods)==null?void 0:_.find(I=>I.label===B.label);return{display:B.display,publishes:O?String(O.publishCount):"—",trac:O?N(O.totalTrac):"—"}});n!=null&&n.symbol;const T=(n==null?void 0:n.balances)??[],$=B=>B.length>12?`${B.slice(0,6)}…${B.slice(-4)}`:B;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?` · ${Uh(n.chainId).name}`:""]})]}),o.jsxs("div",{className:"v10-dash-stats v10-dash-stats-3",children:[o.jsx(Bh,{label:"My Context Graphs",className:"v10-stat-tight",icon:o.jsx(c1,{size:13,"aria-hidden":!0}),value:m?o.jsx("span",{className:"v10-stat-loading",children:"loading…"}):d.length,accentColor:"var(--accent-blue)",sub:jL,children:j.hasCgs&&!m?o.jsx(NL,{curator:C.curator,joined:C.joined,refreshing:h}):null}),o.jsxs(Bh,{label:"Context Graph Size",icon:o.jsx(QO,{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(P1,{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(P1,{counts:j.triples})]}),o.jsx(CL,{})]}):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(Bh,{label:"Collaborating Agents",icon:o.jsx(tM,{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(c1,{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(B=>o.jsx(EL,{cg:B,identity:f,onReport:k,onOpen:O=>{c(O.id),l({id:`project:${O.id}`,label:O.name||O.id.slice(0,12),closable:!0})}},B.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(aM,{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:Uh(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…"}):T.length>0?o.jsxs("div",{className:"v10-ws-wtable",children:[o.jsxs("div",{className:"v10-ws-wrow v10-ws-whead",children:[o.jsx("span",{children:"Wallet"}),o.jsx("span",{children:"TRAC"}),o.jsxs("span",{children:["Gas (",Uh(n==null?void 0:n.chainId).gas,")"]})]}),T.map(B=>o.jsxs("div",{className:"v10-ws-wrow",children:[o.jsx("span",{className:"v10-ws-addr",title:B.address,children:$(B.address)}),o.jsx("span",{className:"v10-ws-bal",children:N(B.trac)}),o.jsx("span",{className:"v10-ws-bal-sec",title:wL(B.eth),children:xL(B.eth)})]},B.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(B=>o.jsxs("li",{className:"v10-ws-wallet",children:[o.jsx("span",{className:"v10-ws-addr",title:B,children:$(B)}),o.jsx("span",{className:"v10-cg-dim",children:"—"})]},B))}):n!=null&&n.error||s?o.jsx("p",{className:"v10-cg-empty",children:"Wallet balances unavailable."}):o.jsx("p",{className:"v10-cg-empty",children:"No node wallets found."}),(n!=null&&n.error||s)&&(T.length>0||(((L=n==null?void 0:n.wallets)==null?void 0:L.length)??0)>0)?o.jsx("p",{className:"v10-ws-note",children:"Balances may be stale — the chain/RPC reported an error."}):null,o.jsx("div",{className:"v10-ws-subhead",children:"Spending"}),o.jsxs("div",{className:"v10-ws-spend",children:[o.jsxs("div",{className:"v10-ws-spend-head",children:[o.jsx("span",{children:"Period"}),o.jsx("span",{title:"Publishes to Verifiable Memory that spent TRAC on-chain. Free SWM/local/testnet publishes are not counted (they don't burn TRAC).",children:"Publishes to VM"}),o.jsx("span",{children:"TRAC"})]}),E.map(B=>o.jsxs("div",{className:"v10-ws-spend-row",children:[o.jsx("span",{className:"v10-cg-dim",children:B.display}),o.jsx("span",{className:"v10-ws-spend-val",children:B.publishes}),o.jsx("span",{className:"v10-ws-spend-val",children:B.trac})]},B.display))]}),o.jsx(SL,{})]})]})]})}const TL=new Set(["meta"]),$a="__root__";function sv(e){return!TL.has(e.name)}const RL=".md, .docx, .pdf, .txt, .csv, .json, .ttl, .rdf, .owl, .py, .ts, .js, .tsx, .jsx, .java, .go, .rs, .c, .cpp, .html, .xml, .yaml, .yml";function B1(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function _L(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 OL({open:e,onClose:t,contextGraphId:n,contextGraphName:r}){var Y;const[s,l]=w.useState([]),[c,d]=w.useState(!0),[f,h]=w.useState(!0),[g,m]=w.useState("idle"),[v,b]=w.useState(0),[k,j]=w.useState([]),[C,S]=w.useState(null),[N,E]=w.useState(!1),T=w.useRef(null),$=w.useCallback(W=>{const D=Array.from(W);l(U=>{const G=new Set(U.map(ee=>`${ee.file.name}:${ee.file.size}`)),M=D.filter(ee=>!G.has(`${ee.name}:${ee.size}`));return[...U,...M.map(ee=>({file:ee,id:`${ee.name}-${ee.size}-${Date.now()}`}))]})},[]),R=W=>{l(D=>D.filter(U=>U.id!==W))},L=W=>{W.preventDefault(),W.stopPropagation(),E(!0)},B=W=>{W.preventDefault(),W.stopPropagation(),E(!1)},O=W=>{W.preventDefault(),W.stopPropagation(),E(!1),W.dataTransfer.files.length>0&&$(W.dataTransfer.files)},_=async()=>{if(s.length===0)return;m("uploading"),b(0),j([]),S(null);const W=[];for(let U=0;U<s.length;U++){b(U);const{file:G}=s[U],M=G.name.replace(/[^a-zA-Z0-9._-]/g,"_"),ee=`${Date.now().toString(36)}-${U}-${M}`;try{const ce=await ZS(ee,n,G),oe=ce.extraction.tripleCount??ce.extraction.triplesWritten;W.push({fileName:G.name,status:ce.extraction.status==="completed"?"success":ce.extraction.status==="skipped"?"skipped":"error",triplesWritten:oe,error:ce.extraction.error})}catch(ce){W.push({fileName:G.name,status:"error",error:(ce==null?void 0:ce.message)??"Upload failed"})}}j(W),b(s.length);const D=W.some(U=>U.status==="error");m(D?"error":"done")},I=()=>{g!=="uploading"&&(l([]),j([]),m("idle"),S(null),b(0),t())},{dialogRef:F,onBackdropClick:K}=ts(e,I);if(!e)return null;const z=k.reduce((W,D)=>W+(D.triplesWritten??0),0),q=k.filter(W=>W.status==="success").length,V=k.filter(W=>W.status==="skipped").length,Z=k.filter(W=>W.status==="error").length;return o.jsx("div",{className:"v10-modal-overlay",onClick:K,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:F,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-import-modal-title",children:[o.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{id:"dkg-import-modal-title",className:"v10-modal-title",children:"Import to Working Memory"}),o.jsx("div",{className:"v10-modal-subtitle",children: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:I,disabled:g==="uploading","aria-label":"Close import dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:g==="uploading"?"not-allowed":"pointer"},children:"×"})]}),o.jsxs("div",{className:"v10-modal-body",children:[C&&o.jsx("div",{className:"v10-modal-error",children:C}),g==="idle"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`v10-import-dropzone ${N?"drag-over":""}`,onClick:()=>{var W;return(W=T.current)==null?void 0:W.click()},onDragOver:L,onDragLeave:B,onDrop:O,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: ",RL]}),o.jsx("input",{ref:T,type:"file",multiple:!0,style:{display:"none"},onChange:W=>{W.target.files&&$(W.target.files),W.target.value=""}})]}),s.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-import-file-list",children:s.map(W=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:_L(W.file.name)}),o.jsx("span",{className:"v10-import-file-name",children:W.file.name}),o.jsx("span",{className:"v10-import-file-size",children:B1(W.file.size)}),o.jsx("button",{className:"v10-import-file-remove",onClick:()=>R(W.id),title:"Remove",children:"×"})]},W.id))}),o.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginBottom:12},children:[s.length," file",s.length!==1?"s":""," selected · ",B1(s.reduce((W,D)=>W+D.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:c,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… (",v+1," of ",s.length,")"]}),o.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:4},children:((Y=s[v])==null?void 0:Y.file.name)??"…"}),o.jsx("div",{className:"v10-import-progress-bar",children:o.jsx("div",{className:"v10-import-progress-fill",style:{width:`${(v+.5)/s.length*100}%`}})}),o.jsxs("div",{className:"v10-import-progress-text",children:[v," of ",s.length," files processed"]})]}),(g==="done"||g==="error")&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`v10-import-result ${Z>0?"error":"success"}`,"data-testid":"import-result","data-import-status":Z>0?"error":"success","data-import-triples":z,children:Z===0?o.jsxs(o.Fragment,{children:[q>0&&o.jsxs(o.Fragment,{children:["Successfully imported ",q," file",q!==1?"s":"",".",z>0&&o.jsxs(o.Fragment,{children:[" Extracted ",o.jsx("strong",{children:z.toLocaleString()})," triples into working memory."]})]}),V>0&&o.jsxs(o.Fragment,{children:[q>0?" ":"","Stored ",V," file",V!==1?"s":""," as source — no structured knowledge was extracted yet (extraction for these file types is coming soon)."]})]}):o.jsxs(o.Fragment,{children:[q," file",q!==1?"s":""," imported",V>0&&o.jsxs(o.Fragment,{children:[", ",V," stored without extraction"]}),", ",Z," failed.",z>0&&o.jsxs(o.Fragment,{children:[" ",z.toLocaleString()," triples extracted."]})]})}),k.length>0&&o.jsx("div",{className:"v10-import-file-list",style:{marginTop:12},children:k.map((W,D)=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:W.status==="success"?"✓":W.status==="skipped"?"–":"✗"}),o.jsx("span",{className:"v10-import-file-name",children:W.fileName}),o.jsx("span",{className:"v10-import-file-size",style:W.status==="error"?{color:"var(--text-danger)"}:void 0,children:W.status==="success"&&W.triplesWritten!=null?`${W.triplesWritten} triples`:W.status==="skipped"?"stored (no extraction)":W.error??"failed"})]},D))})]})]}),o.jsxs("div",{className:"v10-modal-footer",children:[g==="idle"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"v10-modal-btn",onClick:I,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:I,children:"Done"})]})]})})}function ML(e){return e.length<=12?e:`${e.slice(0,6)}…${e.slice(-4)}`}function LL({open:e,onClose:t,contextGraphId:n,contextGraphName:r}){const[s,l]=w.useState(null),[c,d]=w.useState(null),[f,h]=w.useState([]),[g,m]=w.useState(null),[v,b]=w.useState([]),[k,j]=w.useState([]),[C,S]=w.useState(null),[N,E]=w.useState("allowlist");w.useEffect(()=>{e&&(fetch("/api/status",{headers:Ht()}).then(I=>I.json()).then(I=>{typeof(I==null?void 0:I.peerId)=="string"&&I.peerId.length>0&&d(I.peerId)}).catch(()=>{}),VS(n).then(I=>h(I.allowedAgents)).catch(()=>h([])),Ig().then(I=>{const F=(I.agents??[]).filter(K=>K.connectionStatus!=="self");b(F)}).catch(()=>b([])),WS(n).then(I=>j(I.requests)).catch(()=>j([])))},[e,n]);const{dialogRef:T,onBackdropClick:$}=ts(e,t);if(!e)return null;const R=c?`${n}
|
|
1128
|
+
${c}`:null,L=(I,F)=>{navigator.clipboard.writeText(I).then(()=>{l(F),setTimeout(()=>l(null),2e3)}).catch(()=>{})},B=async I=>{try{await MR(n,I),h(F=>F.filter(K=>K!==I))}catch{}},O=async I=>{S(I);try{await zg(n,I),j(F=>F.filter(K=>K.agentAddress!==I)),h(F=>[...new Set([...F,I])])}catch(F){m((F==null?void 0:F.message)||"Failed to approve")}finally{S(null)}},_=async I=>{S(I);try{await $g(n,I),j(F=>F.filter(K=>K.agentAddress!==I))}catch(F){m((F==null?void 0:F.message)||"Failed to reject")}finally{S(null)}};return o.jsx("div",{className:"v10-modal-overlay",onClick:$,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:T,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-share-modal-title",children:[o.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{id:"dkg-share-modal-title",className:"v10-modal-title",children:"Share Context Graph"}),o.jsxs("div",{className:"v10-modal-subtitle",children:["Invite agents to collaborate on ",o.jsx("strong",{children:r}),"."]})]}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close share dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:"pointer"},children:"×"})]}),o.jsxs("div",{className:"v10-modal-body",children:[o.jsxs("div",{style:{display:"flex",gap:0,marginBottom:16,borderBottom:"1px solid var(--border-default)"},children:[o.jsx("button",{onClick:()=>E("allowlist"),style:{padding:"8px 16px",fontSize:12,fontWeight:N==="allowlist"?600:400,background:"none",border:"none",cursor:"pointer",color:N==="allowlist"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:N==="allowlist"?"2px solid var(--accent-primary)":"2px solid transparent"},children:"Allowlist"}),o.jsxs("button",{onClick:()=>E("requests"),style:{padding:"8px 16px",fontSize:12,fontWeight:N==="requests"?600:400,background:"none",border:"none",cursor:"pointer",color:N==="requests"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:N==="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})]})]}),N==="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(I=>{const F=v.find(K=>{var z;return((z=K.agentAddress)==null?void 0:z.toLowerCase())===I.toLowerCase()});return o.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",borderRadius:6,fontSize:11,fontFamily:"var(--font-mono)",background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[o.jsx("span",{style:{color:"var(--text-primary)"},children:F?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{fontFamily:"var(--font-body)",fontWeight:500},children:F.name})," ",o.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:ML(I)})]}):I}),o.jsx("button",{onClick:()=>B(I),style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",fontSize:12,padding:"0 4px"},title:"Remove agent",children:"×"})]},I)})}),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:()=>L(R,"invite"),style:{position:"absolute",top:6,right:6,fontSize:10,padding:"4px 10px",height:26,cursor:"pointer"},children:s==="invite"?"Copied":"Copy Invite"})]})]})]}),N==="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(I=>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:[I.name&&o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:500},children:I.name}),o.jsx("span",{style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",fontSize:10},children:I.agentAddress}),o.jsxs("span",{style:{fontSize:9,color:"var(--text-tertiary)"},children:["Requested ",new Date(I.timestamp).toLocaleString()]})]}),o.jsxs("div",{style:{display:"flex",gap:6},children:[o.jsx("button",{onClick:()=>O(I.agentAddress),disabled:C===I.agentAddress,style:{background:"rgba(34, 197, 94, 0.15)",color:"var(--text-success)",border:"1px solid rgba(34, 197, 94, 0.3)",cursor:"pointer",borderRadius:4,fontSize:10,padding:"4px 10px",fontWeight:600},children:C===I.agentAddress?"…":"Approve"}),o.jsx("button",{onClick:()=>_(I.agentAddress),disabled:C===I.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"})]})]},I.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 Gi(e,t){var r;const n=await ua(e,t);return((r=n==null?void 0:n.result)==null?void 0:r.bindings)??[]}const Vi={displayName:"Project",primaryColor:"#a855f7",accentColor:"#22c55e"},DL=e=>({slug:e,displayName:e,icon:"•",color:"#64748b",rank:99}),IL={slug:$a,displayName:"Root",description:"Entities not in any subgraph (Context Graph root)",icon:"⊘",rank:99},zL=e=>({typeIri:e,label:e.split(/[/#]/).pop()||e,color:"#64748b"}),cs="http://dkg.io/ontology/profile/";function Lj(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=Lj(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
|
|
1129
|
+
`).replace(/\\\\/g,"\\"):t}function Fm(e){const t=rt(e),n=parseInt(t,10);return Number.isFinite(n)?n:0}function us(e){return`FILTER(strstarts(str(?g), "${`did:dkg:context-graph:${e}/meta`.replace(/"/g,'\\"')}"))`}function $L(e){return`PREFIX prof: <${cs}>
|
|
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
|
+
${us(e)}
|
|
1141
|
+
} LIMIT 1`}function PL(e){return`PREFIX prof: <${cs}>
|
|
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
|
+
${us(e)}
|
|
1157
|
+
}`}function UL(e){return`PREFIX prof: <${cs}>
|
|
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
|
+
${us(e)}
|
|
1170
|
+
}
|
|
1171
|
+
GROUP BY ?chip ?subGraph ?type ?predicate ?label`}function BL(e){return`PREFIX prof: <${cs}>
|
|
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
|
+
${us(e)}
|
|
1183
|
+
}`}function FL(e){return`PREFIX prof: <${cs}>
|
|
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
|
+
${us(e)}
|
|
1198
|
+
}`}function HL(e,t){const n=new Map;for(const f of e){const h=za(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:Fm(f.rank)||99,queries:[]})}const r=t.map(f=>{const h=za(f.q),g=h.split(":query:").pop()??h,m=rt(f.subGraph),v=za(f.catalog),b=v?n.get(v):void 0,k=`default:${m}`;return{slug:g,subGraph:m,catalogSlug:(b==null?void 0:b.slug)??k,catalogName:(b==null?void 0:b.name)??"Queries",catalogDescription:b==null?void 0:b.description,catalogRank:(b==null?void 0:b.rank)??999,name:rt(f.name)||g,description:rt(f.description)||void 0,sparql:rt(f.sparql),resultColumn:rt(f.column)||"",rank:Fm(f.rank)||99}}).filter(f=>f.subGraph&&f.sparql).sort((f,h)=>f.subGraph.localeCompare(h.subGraph)||f.catalogRank-h.catalogRank||f.catalogName.localeCompare(h.catalogName)||f.rank-h.rank||f.name.localeCompare(h.name)),s=new Map;for(const f of n.values())s.set(`${f.subGraph}|${f.slug}`,{...f,queries:[]});for(const f of r){const h=`${f.subGraph}|${f.catalogSlug}`,g=s.get(h);if(g){g.queries.push(f);continue}s.set(h,{slug:f.catalogSlug,subGraph:f.subGraph,name:f.catalogName,description:f.catalogDescription,rank:f.catalogRank,queries:[f]})}const l=Array.from(s.values()).filter(f=>f.queries.length>0).map(f=>({...f,queries:[...f.queries].sort((h,g)=>h.rank-g.rank||h.name.localeCompare(g.name))})).sort((f,h)=>f.subGraph.localeCompare(h.subGraph)||f.rank-h.rank||f.name.localeCompare(h.name)),c=new Map,d=new Map;for(const f of l){const h=c.get(f.subGraph)??[];h.push(f),c.set(f.subGraph,h);const g=d.get(f.subGraph)??[];g.push(...f.queries),d.set(f.subGraph,g)}return{queryCatalogs:l,savedQueries:r,catalogsBySubGraph:c,queriesBySubGraph:d}}function qL(e){return`PREFIX prof: <${cs}>
|
|
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
|
+
${us(e)}
|
|
1215
|
+
}`}function GL(e){return`PREFIX prof: <${cs}>
|
|
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
|
+
${us(e)}
|
|
1230
|
+
}
|
|
1231
|
+
GROUP BY ?view ?name ?description ?nodeSize`}function za(e){const t=Lj(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function VL(e){const[t,n]=w.useState(!0),[r,s]=w.useState(),[l,c]=w.useState(Vi.displayName),[d,f]=w.useState(),[h,g]=w.useState(Vi.primaryColor),[m,v]=w.useState(Vi.accentColor),[b,k]=w.useState([]),[j,C]=w.useState([]),[S,N]=w.useState([]),[E,T]=w.useState([]),[$,R]=w.useState([]),[L,B]=w.useState([]),O=w.useRef(new Map),_=w.useRef(new Map),I=w.useRef(new Map),F=w.useRef(new Map),K=w.useRef(new Map),z=w.useRef(new Map);w.useEffect(()=>{if(!e){n(!1);return}let U=!1;return(async()=>{n(!0),s(void 0);try{const[G,M,ee,ce,oe,be,Re]=await Promise.all([Gi($L(e),e).catch(()=>[]),Gi(PL(e),e).catch(()=>[]),Gi(qL(e),e).catch(()=>[]),Gi(GL(e),e).catch(()=>[]),Gi(UL(e),e).catch(()=>[]),Gi(BL(e),e).catch(()=>[]),Gi(FL(e),e).catch(()=>[])]);if(U)return;const Ne=e;if(G[0]){const ke=G[0];c(rt(ke.name)||Ne),f(rt(ke.description)||void 0),g(rt(ke.primary)||Vi.primaryColor),v(rt(ke.accent)||Vi.accentColor)}else c(Ne),f(void 0),g(Vi.primaryColor),v(Vi.accentColor);const De=M.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:Fm(ke.rank)||99,timelinePredicate:za(ke.timelinePredicate)||void 0,sourceAssertion:rt(ke.sourceAssertion)||void 0})).filter(ke=>ke.slug).sort((ke,lt)=>ke.rank-lt.rank);k(De),_.current=new Map(De.map(ke=>[ke.slug,ke]));const We=ee.map(ke=>({typeIri:za(ke.type),label:rt(ke.label)||void 0,icon:rt(ke.icon)||void 0,color:rt(ke.color)||void 0,detailHint:rt(ke.detailHint)||void 0,promoteLabel:rt(ke.promoteLabel)||void 0,promoteHint:rt(ke.promoteHint)||void 0,publishLabel:rt(ke.publishLabel)||void 0,publishHint:rt(ke.publishHint)||void 0})).filter(ke=>ke.typeIri);C(We),O.current=new Map(We.map(ke=>[ke.typeIri,ke]));const Se=ce.map(ke=>{const lt=za(ke.view),ye=lt.split(":view:").pop()??lt;return{slug:ye,name:rt(ke.name)||ye,description:rt(ke.description)||void 0,nodeSize:rt(ke.nodeSize)||void 0,includeTypes:rt(ke.includeTypes).split("|").map(Oe=>za(Oe.trim())).filter(Boolean),emphasizePredicates:rt(ke.emphasizePredicates).split("|").map(Oe=>za(Oe.trim())).filter(Boolean)}});N(Se),I.current=new Map(Se.map(ke=>[ke.slug,ke]));const ft=oe.map(ke=>{const lt=za(ke.chip),ye=lt.split(":chip:").pop()??lt,Oe=rt(ke.values).split("|").map(Lt=>rt(Lt.trim())).filter(Boolean);return{slug:ye,subGraph:rt(ke.subGraph),typeIri:za(ke.type),predicate:za(ke.predicate),label:rt(ke.label)||"Filter",values:Oe}}).filter(ke=>ke.subGraph&&ke.predicate&&ke.values.length>0);T(ft);const Ie=new Map;for(const ke of ft){const lt=Ie.get(ke.subGraph)??[];lt.push(ke),Ie.set(ke.subGraph,lt)}F.current=Ie;const qe=HL(be,Re);R(qe.queryCatalogs),B(qe.savedQueries),K.current=qe.catalogsBySubGraph,z.current=qe.queriesBySubGraph}catch(G){U||s((G==null?void 0:G.message)??String(G))}finally{U||n(!1)}})(),()=>{U=!0}},[e]);const q=w.useCallback(U=>U===$a?IL:_.current.get(U)??DL(U),[]),V=w.useCallback(U=>O.current.get(U)??zL(U),[]),Z=w.useCallback(U=>I.current.get(U),[]),Y=w.useCallback(U=>F.current.get(U)??[],[]),W=w.useCallback(U=>K.current.get(U)??[],[]),D=w.useCallback(U=>z.current.get(U)??[],[]);return{contextGraphId:e??"",displayName:l,description:d,primaryColor:h,accentColor:m,subGraphs:b,typeBindings:j,views:S,filterChips:E,queryCatalogs:$,savedQueries:L,loading:t,error:r,forSubGraph:q,forType:V,view:Z,chipsFor:Y,savedQueryCatalogsFor:W,savedQueriesFor:D}}const Dj=Ve.createContext(null);function Pr(){return w.useContext(Dj)}const WL="http://dkg.io/ontology/agent/";function ZL(e){return`FILTER(strstarts(str(?g), "${`did:dkg:context-graph:${e}/meta`.replace(/"/g,'\\"')}"))`}function KL(e){return`PREFIX ag: <${WL}>
|
|
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
|
+
${ZL(e)}
|
|
1250
|
+
}`}function Ij(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 Xa(e){const t=Ij(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
|
|
1251
|
+
`).replace(/\\\\/g,"\\"):t}function F1(e){const t=Ij(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function YL(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 QL(e){const t=new Map;for(const n of e){const r=F1(n.a);if(!r)continue;const s=t.get(r),l=Xa(n.kindAi)==="ai"||Xa(n.kind)==="ai"?"ai":Xa(n.kind)==="human"?"human":(s==null?void 0:s.kind)??"ai",c={uri:r,name:Xa(n.name)||Xa(n.label)||r.split(":").pop()||r,kind:l,framework:Xa(n.fw)||(s==null?void 0:s.framework),operatorUri:F1(n.op)||(s==null?void 0:s.operatorUri),walletAddress:Xa(n.wallet)||(s==null?void 0:s.walletAddress),peerId:Xa(n.peerId)||(s==null?void 0:s.peerId),avatar:Xa(n.avatar)||(s==null?void 0:s.avatar),reputation:Xa(n.reputation)||(s==null?void 0:s.reputation),color:YL(r)};c.kind==="human"&&!c.framework&&(c.framework="human"),t.set(r,c)}for(const n of t.values())if(n.operatorUri){const r=t.get(n.operatorUri);r&&(n.operatorName=r.name)}return t}function XL(e){const[t,n]=w.useState(()=>new Map),[r,s]=w.useState(!0),[l,c]=w.useState(),d=w.useRef(new Map);w.useEffect(()=>{if(!e){s(!1);return}let m=!1;return(async()=>{var v;s(!0),c(void 0);try{const b=await ua(KL(e),e);if(m)return;const k=((v=b==null?void 0:b.result)==null?void 0:v.bindings)??[],j=QL(k);n(j),d.current=j}catch(b){m||c((b==null?void 0:b.message)??String(b))}finally{m||s(!1)}})(),()=>{m=!0}},[e]);const f=w.useCallback(m=>d.current.get(m),[]),h=Ve.useMemo(()=>[...t.values()].sort((m,v)=>m.name.localeCompare(v.name)),[t]),g=w.useCallback(m=>{},[]);return{agents:t,list:h,loading:r,error:l,get:f,openAgent:g}}const zj=Ve.createContext(null);function ds(){return w.useContext(zj)}const Hm=["#6366f1","#14b8a6","#f43f5e","#facc15","#8b5cf6","#10b981","#0ea5e9","#d946ef"],H1=1e4;function jl(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 JL(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 eD(e){return e.startsWith("did:")||e.startsWith("12D3")?e:/^0x[0-9a-fA-F]{40}$/.test(e)?`did:dkg:agent:${e}`:e}function tD(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),s=r.indexOf("/");if(s<0)return;const l=r.slice(0,s);if(!(!l||l.startsWith("_")))return l}function nD(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 q1(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)%Hm.length}function $j(e){const[t,n]=w.useState(new Map),[r,s]=w.useState([]),[l,c]=w.useState([]),[d,f]=w.useState(null),[h,g]=w.useState(!1),[m,v]=w.useState(void 0),b=w.useRef(0);w.useEffect(()=>{if(!e){b.current+=1,n(new Map),s([]),c([]),g(!1),v(void 0);return}const S=++b.current,N=new AbortController;let E=!1,T;const $=()=>!E&&S===b.current;return g(!0),f(null),(async()=>{var R;try{const L=new Promise((V,Z)=>{T=setTimeout(()=>{N.abort(),Z(new Error(`SWM attribution query timed out after ${Math.round(H1/1e3)}s`))},H1)}),B=(async()=>{const V=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Ht()},signal:N.signal,body:JSON.stringify({sparql:nD(e)})});if(!V.ok)throw new Error(`SPARQL query failed: ${V.status}`);return V.json()})(),O=await Promise.race([B,L]),I=(((R=O==null?void 0:O.result)==null?void 0:R.bindings)??[]).slice().reverse(),F=new Map,K=new Map,z=[];for(const V of I){const Z=jl(V.op),Y=jl(V.root),W=jl(V.agent),D=jl(V.publishedAt),U=jl(V.g);if(!Z||!Y||!W||!D)continue;const G=eD(W),M=U?tD(U,e):void 0;z.push({opUri:Z,rootUri:Y,agent:G,publishedAt:D,subGraph:M});const ee={agent:G,opUri:Z,publishedAt:D,subGraph:M},ce=F.get(Y);ce?ce.some(be=>be.agent===G)||ce.push(ee):F.set(Y,[ee]);let oe=K.get(G);oe||(oe=new Set,K.set(G,oe)),oe.add(Y)}const q=[...K.entries()].map(([V,Z])=>({agent:V,color:Hm[q1(V)],label:JL(V),entityCount:Z.size})).sort((V,Z)=>Z.entityCount-V.entityCount);if(!$())return;n(F),s(z),c(q),v(e)}catch(L){if(!$())return;f((L==null?void 0:L.message)??"Failed to load SWM attributions"),n(new Map),s([]),c([]),v(e)}finally{T&&clearTimeout(T),$()&&g(!1)}})(),()=>{E=!0,T&&clearTimeout(T),N.abort()}},[e]);const{nodeColors:k,conflicts:j}=w.useMemo(()=>{const S={},N=[];for(const[E,T]of t)T.length!==0&&(T.length===1?S[E]=Hm[q1(T[0].agent)]:(N.push(E),S[E]="#f59e0b"));return{nodeColors:S,conflicts:N}},[t]);return{resultContextGraphId:m,attributions:t,events:r,palette:l,nodeColors:k,conflicts:j,loading:!!(e&&(h||m!==e)),error:d}}function aD(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 G1=1e4,qm="http://dkg.io/ontology/";function rD(e){const t=`did:dkg:context-graph:${e}/_meta`;return`PREFIX dkg: <${qm}>
|
|
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 Ja(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 iD(e){return e===`${qm}AssertionCreated`?"created":e===`${qm}AssertionPromoted`?"promoted":null}function sD(e){const[t,n]=w.useState([]),[r,s]=w.useState(!!e),[l,c]=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([]),c(null),f(void 0),g.current=void 0);let m=!1;const v=new AbortController;let b;return h.current=e,s(!0),c(null),(async()=>{var k;try{const j=new Promise((T,$)=>{b=setTimeout(()=>{v.abort(),$(new Error(`Assertion-lifecycle query timed out after ${Math.round(G1/1e3)}s`))},G1)}),C=(async()=>{const T=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Ht()},signal:v.signal,body:JSON.stringify({sparql:rD(e),contextGraphId:e})});if(!T.ok)throw new Error(`SPARQL query failed: ${T.status}`);return T.json()})(),S=await Promise.race([C,j]);if(m||h.current!==e)return;const N=((k=S==null?void 0:S.result)==null?void 0:k.bindings)??[],E=[];for(const T of N){const $=Ja(T.event),R=Ja(T.type),L=Ja(T.assertion),B=Ja(T.name),O=Ja(T.agent),_=Ja(T.ts);if(!$||!L||!O||!_)continue;const I=iD(R);if(!I)continue;let F;if(I==="promoted"){const q=Ja(T.entityCount),V=q!=null?Number(q):NaN;if(Number.isFinite(V)&&V>0)F=V;else{const Z=Ja(T.subjectEntityCount),Y=Z!=null?Number(Z):NaN;Number.isFinite(Y)&&Y>=0&&(F=Y)}}let z=Ja(T.subGraphName);if(z===void 0){const q=Ja(T.assertionGraph);q&&(z=aD(q,e))}E.push({eventUri:$,kind:I,assertionUri:L,assertionName:B??"",agentUri:O,publishedAt:_,subGraph:z,entityCount:F})}n(E),f(e),g.current=e,c(null)}catch(j){if(m||(j==null?void 0:j.name)==="AbortError")return;c(j.message??String(j)),g.current!==e&&n([]),f(e),g.current=e}finally{b&&clearTimeout(b),m||s(!1)}})(),()=>{m=!0,v.abort(),b&&clearTimeout(b)}},[e]),w.useMemo(()=>({resultContextGraphId:d,events:t,loading:r,error:l}),[d,t,r,l])}const oD=["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"],lD="http://www.w3.org/ns/prov#wasAttributedTo",cD=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 ov(e){const t=e.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),n=new Date(t);return Number.isFinite(n.getTime())?n:null}function lv(e,t,n,r){const s=n?n.toISOString():"no-ts";return r&&r!==t?`${e}|${t}|${r}|${s}`:`${e}|${t}|${s}`}function uD(e){for(const t of oD){const n=e.properties.get(t);if(n!=null&&n.length)for(const r of n){const s=ov(r);if(s)return s}}return null}function dD(e){for(const t of e.connections)if(t.predicate===lD)return t.targetUri;return null}function pD(e){for(const t of e.types)if(cD.has(t))return t;return null}function fD(e){for(const t of e.subGraphs)if(t!=="meta")return t;return null}function hD(e,t={}){const{limit:n=200,agentUri:r,typeIri:s,subGraph:l,includeUndated:c=!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 v=pD(m);if(s&&v!==s)continue;const b=uD(m);if(!b&&(!c||!v))continue;const k=dD(m);if(r&&k!==r)continue;const j=fD(m);if(l&&j!==l)continue;const C=v?"typed":"added";if(h&&h.has(C))continue;const S=lv(C,m.uri,b);g.push({id:S,entity:m,at:b,authorUri:k,kindUri:v,subGraph:j,layer:m.trustLevel,event:C,clickable:!0})}return g.sort((m,v)=>m.at&&v.at?v.at.getTime()-m.at.getTime():m.at&&!v.at?-1:!m.at&&v.at?1:m.entity.label.localeCompare(v.entity.label)),{items:g.slice(0,n),hasMore:g.length>n}},[e,n,r,s,l,c,f])}function mD(e,t=new Date){const n=g=>{const m=new Date(g);return m.setHours(0,0,0,0),m},r=n(t),s=new Date(r.getTime()-1440*60*1e3),l=new Date(r.getTime()-10080*60*1e3),c={},d=[],f=(g,m,v)=>{c[g]||(c[g]={key:g,label:m,items:[]},d.push(g)),c[g].items.push(v)};for(const g of e){if(!g.at){f("undated","Undated",g);continue}const m=n(g.at);if(m.getTime()===r.getTime())f("today","Today",g);else if(m.getTime()===s.getTime())f("yesterday","Yesterday",g);else if(g.at.getTime()>=l.getTime())f("this-week","Earlier this week",g);else{const v=g.at.toLocaleString(void 0,{month:"long",year:"numeric"});f(`m-${v}`,v,g)}}const h=d.indexOf("undated");return h!==-1&&h<d.length-1&&(d.splice(h,1),d.push("undated")),d.map(g=>c[g])}function gD(e,t){const{entitiesByUri:n,agentUri:r,subGraph:s,limit:l=200}=t,c=[];for(const d of e){if(r&&d.agent!==r||s&&d.subGraph!==s)continue;const f=ov(d.publishedAt);if(!f)continue;const h=xt(d.rootUri),g=n.get(h),m=g!=null;c.push({id:lv("promoted",d.opUri,f,h),entity:g??vD(h),at:f,authorUri:d.agent,kindUri:null,subGraph:d.subGraph??null,layer:"shared",event:"promoted",clickable:m})}return c.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)),c.slice(0,l)}function vD(e){return{uri:e,label:tv(e),types:[],trustLevel:"shared",layers:new Set(["shared"]),subGraphs:new Set,properties:new Map,connections:[]}}function yD(e,t={}){const{agentUri:n,subGraph:r,limit:s=200}=t,l=[];for(const c of e){if(n&&c.agentUri!==n||r&&c.subGraph!==r)continue;const d=ov(c.publishedAt);if(!d)continue;const f=c.kind==="promoted"?"promoted":"added",h=c.kind==="promoted"?"shared":"working",g=xt(c.assertionUri);l.push({id:lv(f,c.eventUri,d,g),entity:{uri:g,label:c.assertionName||tv(g),types:[],trustLevel:h,layers:new Set([h]),subGraphs:c.subGraph?new Set([c.subGraph]):new Set,properties:new Map,connections:[]},at:d,authorUri:c.agentUri,kindUri:null,subGraph:c.subGraph??null,layer:h,event:f,entityCount:c.entityCount,clickable:!1})}return l.sort((c,d)=>c.at&&d.at?d.at.getTime()-c.at.getTime():c.at&&!d.at?-1:!c.at&&d.at?1:c.entity.label.localeCompare(d.entity.label)),l.slice(0,s)}function bD(e,t={}){const{swmEvents:n,lifecycleEvents:r,...s}=t,l=r!=null,d=hD(e,{...s,excludeEvents:l?["added"]:void 0});return w.useMemo(()=>{const f=s.limit??200;if(t.typeIri)return{items:d.items,hasMore:d.hasMore};if(!l&&(!n||n.length===0))return{items:d.items,hasMore:d.hasMore};let h;if(l)h=yD(r,{agentUri:s.agentUri,subGraph:s.subGraph,limit:Number.POSITIVE_INFINITY});else{const v=new Map;for(const b of e)v.set(b.uri,b);h=gD(n,{entitiesByUri:v,agentUri:s.agentUri,subGraph:s.subGraph,limit:Number.POSITIVE_INFINITY})}const g=[...d.items,...h];g.sort((v,b)=>v.at&&b.at?b.at.getTime()-v.at.getTime():v.at&&!b.at?-1:!v.at&&b.at?1:v.entity.label.localeCompare(b.entity.label));const m=d.hasMore||g.length>f;return{items:g.slice(0,f),hasMore:m}},[d,n,r,l,e,s.agentUri,s.subGraph,s.limit,t.typeIri])}function Pj(e,t=new Date){if(!e)return"—";const n=t.getTime()-e.getTime(),r=Math.abs(n),s=n<0,l=6e4,c=l*60,d=c*24;return r<l?s?"in a moment":"just now":r<c?s?`in ${Math.floor(r/l)}m`:`${Math.floor(r/l)}m ago`:r<d?s?`in ${Math.floor(r/c)}h`:`${Math.floor(r/c)}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 V1={"claude-code":"⦿",openclaw:"◈",hermes:"⬡",gemini:"✧",human:"👤"};function xD(e,t){return e&&V1[e]?V1[e]:t==="human"?"👤":"◉"}function wD(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 kD(e){const t=e.trim();return t.length<=11?t:`${t.slice(0,6)}…${t.slice(-4)}`}const as=({agent:e,fallbackUri:t,size:n="sm",showOperator:r=!1,onOpenAgent:s,className:l=""})=>{const c=ds();if(!e&&!t)return null;const d=s??(c==null?void 0:c.openAgent),f=(e==null?void 0:e.uri)??t,h=(e==null?void 0:e.name)??(t?kD(t.split(":").pop()??t):"unknown"),g=(e==null?void 0:e.kind)??"ai",m=e==null?void 0:e.framework,v=xD(m,g),b=(e==null?void 0:e.color)??"hsl(0, 0%, 55%)",k=[h,m?`framework: ${m}`:null,e!=null&&e.operatorName?`operator: ${e.operatorName}`:null,e!=null&&e.walletAddress?`wallet: ${e.walletAddress}`:null,e!=null&&e.peerId?`peer: ${e.peerId.slice(0,20)}…`:null,e!=null&&e.reputation?`— ${e.reputation}`:null,f].filter(Boolean).join(`
|
|
1285
|
+
`),j=d?()=>d(f):void 0,C=!!j;return o.jsxs("span",{className:`v10-agent-chip v10-agent-chip-${n}${C?" interactive":""} ${l}`,style:{"--agent-color":b},onClick:j?S=>{S.stopPropagation(),j()}:void 0,title:k,role:C?"button":void 0,tabIndex:C?0:void 0,children:[o.jsxs("span",{className:"v10-agent-chip-avatar",style:{background:b},children:[o.jsx("span",{className:"v10-agent-chip-initials",children:wD(h)}),o.jsx("span",{className:"v10-agent-chip-glyph",title:m??g,children:v})]}),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]})})]})]})},Fh={working:"#64748b",shared:"#f59e0b",verified:"#22c55e"},SD={working:"◇",shared:"◈",verified:"◉"},jD=200,CD=({entities:e,agentUri:t,typeIri:n,subGraph:r,limit:s,includeUndated:l=!0,swmEvents:c,lifecycleEvents:d,lifecycleError:f,title:h,onSelectEntity:g,onOpenAgent:m,emptyHint:v,className:b=""})=>{const{items:k,hasMore:j}=bD(e,{agentUri:t,typeIri:n,subGraph:r,limit:s,includeUndated:l,swmEvents:c,lifecycleEvents:d}),C=Ve.useMemo(()=>mD(k),[k]),S=ds(),N=Pr(),T=j?`${s??jD}+`:String(k.length),$=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":$?"error":void 0,children:$?"—":T})]}):null,L=f?o.jsx("div",{className:"v10-activity-feed-error",role:"status","aria-live":"polite",title:f,children:"Couldn't load recent activity."}):null;return k.length===0?o.jsxs("div",{className:`v10-activity-feed v10-activity-feed-empty ${b}`,children:[R,L??o.jsx("div",{className:"v10-activity-feed-empty-hint",children:v??"No activity with a timestamp yet."})]}):o.jsxs("div",{className:`v10-activity-feed ${b}`,children:[R,L,C.map(B=>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:B.label}),o.jsx("span",{className:"v10-activity-feed-bucket-count",children:B.items.length})]}),o.jsx("div",{className:"v10-activity-feed-items",children:B.items.map(O=>o.jsx(ND,{item:O,agents:S,profile:N,onSelectEntity:g,onOpenAgent:m},O.id))})]},B.key))]})};function ND({item:e,agents:t,profile:n,onSelectEntity:r,onOpenAgent:s}){const l=e.authorUri?t==null?void 0:t.get(e.authorUri):null,c=e.event==="typed",d=c&&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"?Fh.shared:e.event==="published"?Fh.verified:e.event==="added"?"#64748b":(d==null?void 0:d.color)??"#a855f7",m=Fh[e.layer],v=c?ED(e.entity):null,b=(()=>{const j=[];return e.event!=="typed"&&j.push(f),j.push(e.entity.label),e.at&&j.push(e.at.toISOString()),j.join(`
|
|
1286
|
+
`)})(),k=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-activity-feed-layer",style:{color:m},title:`${e.layer} memory`,children:SD[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}),v&&o.jsx("span",{className:`v10-activity-feed-status status-${AD(v)}`,children:v}),(l||e.authorUri)&&o.jsx("span",{className:"v10-activity-feed-author",children:o.jsx(as,{agent:l??void 0,fallbackUri:e.authorUri??void 0,size:"sm",onOpenAgent:s})}),o.jsx("span",{className:"v10-activity-feed-time",title:e.at?e.at.toLocaleString():"no timestamp",children:Pj(e.at)})]});return e.clickable?o.jsx("button",{type:"button",className:"v10-activity-feed-row",onClick:()=>r(e.entity.uri),title:b,children:k}):o.jsx("div",{className:"v10-activity-feed-row v10-activity-feed-row-static",title:b,"aria-disabled":"true",children:k})}function ED(e){var n;const t=["http://dkg.io/ontology/decisions/status","http://dkg.io/ontology/tasks/status","http://dkg.io/ontology/github/state"];for(const r of t){const s=(n=e.properties.get(r))==null?void 0:n[0];if(s)return s}return null}function AD(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 TD={wm:"working",swm:"shared",vm:"verified"};function RD(e){var v,b,k,j;const t=new Map;if(!e)return t;const n="http://dkg.io/ontology/decisions/status",r="http://dkg.io/ontology/tasks/status",s="http://dkg.io/ontology/tasks/priority",l="http://dkg.io/ontology/github/state",c="http://dkg.io/ontology/decisions/Decision",d="http://dkg.io/ontology/tasks/Task",f="http://dkg.io/ontology/github/PullRequest";let h=0,g=0,m=0;for(const C of e)if(C.types.includes(c))((v=C.properties.get(n))==null?void 0:v[0])==="proposed"&&h++;else if(C.types.includes(d)){const S=(b=C.properties.get(s))==null?void 0:b[0],N=(k=C.properties.get(r))==null?void 0:k[0];S==="p0"&&N!=="done"&&N!=="cancelled"&&g++}else C.types.includes(f)&&((j=C.properties.get(l))==null?void 0:j[0])==="open"&&m++;return h>0&&t.set("decisions",{label:`${h} proposed`,tone:"warn"}),g>0&&t.set("tasks",{label:`${g} p0`,tone:"danger"}),m>0&&t.set("github",{label:`${m} open`,tone:"info"}),t}const Hh=({contextGraphId:e,profile:t,selected:n,onSelect:r,entities:s,layer:l,enabledScope:c,allTriplesTotal:d})=>{const[f,h]=Ve.useState([]),[g,m]=Ve.useState(!0),v=Ve.useMemo(()=>RD(s),[s]),b=Ve.useRef(0),k=Ve.useMemo(()=>c&&c.size>0&&c.size<3?new Set(c):c&&c.size>=3?null:l?new Set([TD[l]]):null,[c,l]),j=Ve.useMemo(()=>{if(!s)return null;const z=new Map;for(const q of s)if(!(k&&!k.has(q.trustLevel)))for(const V of q.subGraphs)z.set(V,(z.get(V)??0)+1);return z},[k,s]),C=Ve.useMemo(()=>{if(!s)return null;let z=0;for(const q of s)k&&!k.has(q.trustLevel)||z++;return z},[k,s]),S=Ve.useMemo(()=>{if(!s)return null;let z=0;for(const q of s)k&&!k.has(q.trustLevel)||q.subGraphs.size>0||z++;return z},[k,s]),N=Ve.useCallback(()=>{const z=++b.current;m(!0),Gg(e).then(q=>{z===b.current&&h(q.subGraphs??[])}).catch(()=>{}).finally(()=>{z===b.current&&m(!1)})},[e]);Ve.useEffect(()=>(N(),()=>{b.current++}),[N]),Co(e,N);const E=Ve.useMemo(()=>f.filter(sv).map(z=>{const q=t.forSubGraph(z.name),V=j!==null?j.get(z.name)??0:z.entityCount;return{slug:z.name,icon:q.icon??"•",color:q.color??"#64748b",displayName:q.displayName??z.name,description:q.description??z.description,rank:q.rank??99,entityCount:V,tripleCount:z.tripleCount,layerScoped:j!==null}}).sort((z,q)=>z.rank-q.rank),[f,t,j]),$=S!==null&&S>0||n===$a;if(g&&E.length===0&&!$||E.length===0&&!$)return null;const R=C??E.reduce((z,q)=>z+q.entityCount,0),L=E.reduce((z,q)=>z+q.tripleCount,0),B={working:"Working Memory",shared:"Shared Working Memory",verified:"Verifiable Memory"},O=k?[...k].map(z=>B[z]).join(" + "):null,_=O?` in ${O}`:"",F=`Total distinct entities — includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph · ${R} entities${_}${O?"":` · ${d??L} triples`}`,K=`All — total distinct entities. Includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph. ${R} entities${_}.`;return o.jsxs("div",{className:"v10-subgraph-bar",children:[o.jsx("div",{className:"v10-subgraph-bar-label",children:"Subgraphs"}),o.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===null?" active":""}`,onClick:()=>r(null),title:F,"aria-label":K,children:[o.jsx("span",{className:"v10-subgraph-chip-icon",children:"⊚"}),o.jsx("span",{className:"v10-subgraph-chip-label",children:"All"}),o.jsx("span",{className:"v10-subgraph-chip-count",children:R})]}),E.map(z=>{const q=v.get(z.slug);return o.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===z.slug?" active":""}${q?" has-badge":""}`,onClick:()=>r(z.slug,l),title:`${z.displayName}${z.description?" · "+z.description:""} · ${z.entityCount} entities${_}${O?"":` · ${z.tripleCount} triples`}${q?" · "+q.label:""}`,style:{"--sg-color":z.color},children:[o.jsx("span",{className:"v10-subgraph-chip-icon",style:{color:z.color},children:z.icon}),o.jsx("span",{className:"v10-subgraph-chip-label",children:z.displayName}),o.jsx("span",{className:"v10-subgraph-chip-count",children:z.entityCount}),q&&o.jsxs("span",{className:`v10-subgraph-chip-badge tone-${q.tone}`,children:[o.jsx("span",{className:"v10-subgraph-chip-badge-dot"}),q.label]})]},z.slug)}),$&&(()=>{const z=S??0,q=n===$a;return o.jsxs("button",{type:"button",className:`v10-subgraph-chip v10-subgraph-chip-root${q?" active":""}`,"data-active":q,"data-count":z,onClick:()=>r($a,l),title:`Entities not in any subgraph (Context Graph root) · ${z} 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:z})]})})()]})},cv="context-graph-primer",Uj={id:cv,label:"What is a Context Graph?",closable:!0},Bj={neutral:"var(--border-strong)",wm:"var(--layer-working, #64748b)",swm:"var(--layer-shared, #f59e0b)",vm:"var(--layer-verified, #22c55e)",danger:"var(--text-danger)",query:"#38bdf8",warning:"var(--text-warning)"};function cn({icon:e,title:t,description:n,actions:r=[],tone:s="neutral",compact:l=!1,inline:c=!1,className:d=""}){const f={"--v10-empty-accent":Bj[s]};return o.jsxs("div",{className:["v10-empty-state",l?"compact":"",c?"inline":"",d].filter(Boolean).join(" "),"data-tone":s,style:f,children:[e&&o.jsx("div",{className:"v10-empty-state-icon","aria-hidden":"true",children:e}),o.jsxs("div",{className:"v10-empty-state-copy",children:[o.jsx("div",{className:"v10-empty-state-title",children:t}),n&&o.jsx("div",{className:"v10-empty-state-desc",children:n}),r.length>0&&o.jsx("div",{className:"v10-empty-state-actions",children:r.map(h=>o.jsx("button",{type:"button",className:`v10-empty-state-action ${h.variant??"secondary"}`,onClick:h.onClick,"data-testid":h.testId,children:h.label},h.label))})]})]})}function Zd({items:e,layer:t,compact:n=!1,className:r=""}){const s=t?{"--v10-stat-accent":Bj[t]}:void 0;return o.jsx("div",{className:["v10-stat-strip",n?"compact":"",r].filter(Boolean).join(" "),"data-layer":t,style:s,children:e.map((l,c)=>o.jsxs("div",{className:"v10-stat-strip-cell","data-stat-id":l.id,title:l.tooltip,children:[o.jsx("span",{className:"v10-stat-strip-label",children:l.label}),o.jsx("span",{className:"v10-stat-strip-value",children:l.value}),l.hint&&o.jsx("span",{className:"v10-stat-strip-hint",children:l.hint})]},l.id??c))})}const uv=w.lazy(()=>gt(()=>import("./index-5DS6xjw0.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),_D="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",OD=new Map(ev.map((e,t)=>[e,t]));function Gm(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 Lr(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function MD(e){const t=new Set,n=new Map,r=new Map,s=new Map;for(const d of e){const f=Lr(d.subject);t.add(f);const h=OD.get(d.predicate);if(h!==void 0){const m=Gd(d.object).trim();if(m){const v=s.get(f);(v===void 0||h<v)&&(r.set(f,m),s.set(f,h))}}if(Lr(d.predicate)===_D||!Gm(d.object))continue;const g=Lr(d.object);n.set(f,(n.get(f)??0)+1),n.set(g,(n.get(g)??0)+1)}const l=[...t].filter(d=>(n.get(d)??0)===0).map(d=>({uri:d,label:r.get(d)??Aj(void 0,d)})).sort((d,f)=>d.label.localeCompare(f.label));if(l.length===0)return{canvasTriples:e,singletonItems:l};const c=new Set(l.map(d=>d.uri));return{canvasTriples:e.filter(d=>!c.has(Lr(d.subject))&&!c.has(Lr(d.object))),singletonItems:l}}function LD(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 DD({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 ID=2500;function W1(e,t=ID){if(e.length<=t)return e;const n=new Map;for(const c of e)n.set(c.subject,(n.get(c.subject)??0)+1);const r=[...n.entries()].sort((c,d)=>d[1]-c[1]).map(([c])=>c),s=new Set;let l=0;for(const c of r){const d=n.get(c)??0;l+d>t||(s.add(c),l+=d)}return s.size===0&&r.length>0&&s.add(r[0]),e.filter(c=>s.has(c.subject)).slice(0,t)}function nd({title:e,scopeLabel:t,tone:n,className:r,rail:s,overlay:l,showScopeLabel:c=!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 v=o.jsx("button",{type:"button",className:`v10-graph-expand-btn${c?"":" in-canvas"}`,onClick:()=>m(!0),title:`Expand ${e}`,"aria-label":`Expand ${e}`,children:"⤢"}),b=k=>o.jsxs(o.Fragment,{children:[c&&!k&&o.jsxs("div",{className:"v10-graph-shell-bar",children:[o.jsx("div",{className:"v10-graph-scope",title:t,children:t}),v]}),o.jsxs("div",{className:"v10-graph-body",children:[o.jsxs("div",{className:"v10-graph-canvas",children:[!c&&!k&&v,o.jsx("div",{className:"v10-graph-view",children:h(k)}),l&&o.jsx("div",{className:"v10-graph-overlay",children:l}),o.jsx(DD,{items:d,onSelect:f})]}),s&&o.jsx("aside",{className:"v10-graph-rail",children:s})]})]});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`v10-graph-shell v10-graph-shell-${n}${r?` ${r}`:""}`,children:!g&&b(!1)}),g&&o.jsx("div",{className:"v10-graph-expanded-backdrop",role:"dialog","aria-modal":"true","aria-label":`${e} expanded`,onClick:k=>{k.target===k.currentTarget&&m(!1)},children:o.jsxs("div",{className:`v10-graph-expanded-panel v10-graph-shell-${n}`,children:[o.jsxs("div",{className:"v10-graph-expanded-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"v10-graph-expanded-title",children:e}),o.jsx("div",{className:"v10-graph-expanded-subtitle",children:t})]}),o.jsx("button",{type:"button",className:"v10-graph-expanded-close",onClick:()=>m(!1),"aria-label":`Close expanded ${e}`,children:"×"})]}),o.jsx("div",{className:"v10-graph-expanded-body",children:b(!0)})]})})]})}function Fj({layer:e,triples:t,onNodeClick:n,contextGraphId:r,scopeLabel:s,trustLegendActiveLayer:l,title:c,scopeEntities:d,swmAttribution:f,layerEntities:h,nodeColorsOverride:g}){const{title:m}=$n[e],v=c??m,b=Kn(D=>D.theme),k=w.useMemo(()=>{if(e!=="vm")return;const D=new Set;for(const U of t)D.add(U.subject),Gm(U.object)&&D.add(U.object);return D},[t,e]),{anchors:j,decorationTriples:C}=eL(e==="vm"&&r?r:void 0,k),S=$j(e==="swm"&&r&&!f?r:void 0),N=f??S,E=w.useMemo(()=>{if(!h||h.length===0)return t;const D=new Set;for(const U of h)D.add(xt(U.uri));return xd(t,D)},[t,h]),T=w.useMemo(()=>{const D=new Set,U=[],G=M=>{const ee=`${M.subject}|${M.predicate}|${M.object}`;D.has(ee)||(D.add(ee),U.push({subject:M.subject,predicate:M.predicate,object:M.object}))};for(const M of E)G(M);for(const M of C)G(M);return U},[E,C]),$=T,R=w.useMemo(()=>{const D=e==="swm"?N.nodeColors:void 0;if(!(!D&&!g))return D?g?{...D,...g}:D:g},[e,N.nodeColors,g]),L=w.useMemo(()=>dL(e,R),[e,R]),{canvasTriples:B,singletonItems:O}=w.useMemo(()=>MD($),[$]),_=w.useMemo(()=>{if(!d||d.length===0)return O;const D=new Set(O.map(G=>Lr(G.uri)));for(const G of B)D.add(Lr(G.subject)),Gm(G.object)&&D.add(Lr(G.object));const U=[];for(const G of d){const M=Lr(G.uri);D.has(M)||(D.add(M),U.push({uri:M,label:G.label||Aj(void 0,M)}))}return U.length===0?O:[...O,...U].sort((G,M)=>G.label.localeCompare(M.label))},[O,B,d]),I=`${r??"context"}:${e}`,F=e==="swm"&&!!r&&N.loading,K=`${v} graph`,z=s??LD(e),q=l===null&&!!s,V=l===null?void 0:l??e,Y=e==="vm"&&j.length>0||e==="swm"&&N.palette.length>0?o.jsxs(o.Fragment,{children:[e==="vm"&&j.length>0&&o.jsx($D,{anchors:j}),e==="swm"&&N.palette.length>0&&o.jsx(zD,{palette:N.palette,conflicts:N.conflicts.length})]}):null,W=w.useMemo(()=>({name:`${I}:${b}`,palette:b}),[I,b]);return T.length===0&&_.length===0?o.jsx(nd,{title:K,scopeLabel:z,tone:e,className:"v10-graph-view-fill",showScopeLabel:q,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(cn,{compact:!0,tone:e,icon:$n[e].icon,title:`No triples in ${v}`,description:"The graph will appear when this layer has connected triples."})})}):F?o.jsx(nd,{title:K,scopeLabel:z,tone:"swm",className:"v10-graph-view-fill",showScopeLabel:q,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(cn,{compact:!0,tone:"swm",icon:$n.swm.icon,title:"Loading Shared Working Memory attribution...",description:"Agent colors are being prepared before the graph renders."})})}):o.jsx(nd,{title:K,scopeLabel:z,tone:e,className:"v10-graph-view-fill",overlay:Y,showScopeLabel:q,singletonItems:_,onSingletonClick:D=>n==null?void 0:n(V?{id:D,trustLayer:V}:{id:D}),renderGraph:D=>B.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(uv,{data:B,format:"triples",options:L,viewConfig:W,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:V?U=>n==null?void 0:n({...U,trustLayer:V}):n,initialFit:!0},`${I}:${D?"expanded":"inline"}:${B.length}`)}):o.jsx("div",{className:"v10-graph-placeholder v10-graph-placeholder-centered",children:"Connected graph appears when this layer has linked entities."})})}function zD({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 $D({anchors:e}){var s;const t=w.useMemo(()=>{const l=new Set;for(const c of e)for(const d of c.agents)l.add(d);return l.size},[e]),n=(s=e[0])==null?void 0:s.publishedAt,r=(()=>{if(!n)return null;try{return new Date(n).toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return null}})();return o.jsxs("div",{className:"v10-vm-legend","aria-label":"Verifiable Memory legend",children:[o.jsxs("div",{className:"v10-vm-legend-row v10-vm-legend-head",children:[o.jsx("span",{children:"VM provenance layer"}),o.jsxs("span",{className:"v10-vm-legend-count",children:[e.length," anchor",e.length===1?"":"s"]})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#f5a524"},children:"◉"}),o.jsx("span",{className:"v10-vm-legend-label",children:"On-chain anchor"})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#c084fc"},children:"◈"}),o.jsxs("span",{className:"v10-vm-legend-label",children:["Agent identity (",t,")"]})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#4ade80"},children:"—"}),o.jsx("span",{className:"v10-vm-legend-label",children:"Signed / anchored edge"})]}),r&&o.jsxs("div",{className:"v10-vm-legend-foot",children:["Latest: ",r]})]})}function PD({active:e,counts:t,onSwitch:n,onShare:r,onImport:s,onRefresh:l}){const[c,d]=w.useState(!1),f=w.useRef(null),h=g=>{d(!1),n(g)};return w.useEffect(()=>{if(!c)return;const g=m=>{var b;const v=m.target;v&&((b=f.current)!=null&&b.contains(v))||d(!1)};return document.addEventListener("pointerdown",g),()=>document.removeEventListener("pointerdown",g)},[c]),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":c,"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"})]}),c&&o.jsx("div",{className:"v10-layer-more-menu",role:"menu",children:o.jsxs("button",{type:"button",role:"menuitem",className:`v10-layer-more-item ${e==="query"?"active":""}`,onClick:()=>h("query"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⟐"}),"Query Catalogue"]})})]}),o.jsx("div",{className:"v10-layer-switcher-spacer"}),o.jsxs("div",{className:"v10-layer-switcher-actions",children:[o.jsxs("button",{className:"v10-layer-action-btn",onClick:r,"aria-label":"Share Context Graph",children:[o.jsx("span",{className:"v10-layer-action-icon",children:"⤴"}),o.jsx("span",{className:"v10-layer-action-label",children:"Share"})]}),o.jsxs("button",{className:"v10-layer-action-btn",onClick:s,"aria-label":"Import into Context Graph",children:[o.jsx("span",{className:"v10-layer-action-icon",children:"↑"}),o.jsx("span",{className:"v10-layer-action-label",children:"Import"})]}),o.jsx("button",{className:"v10-layer-action-btn",onClick:l,"aria-label":"Refresh Context Graph data",children:o.jsx("span",{className:"v10-layer-action-icon",children:"↻"})})]})]})}function UD({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 BD(e,t,n,r,s){const l=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",c=new Set([t==null?void 0:t.agentDid,t==null?void 0:t.agentAddress].filter(h=>typeof h=="string"&&h.trim().length>0).map(tn)),d=c.size>0;return l&&d&&c.has(tn(l))?{label:"Curator",title:"This agent is the curator for this Context Graph.",tone:"curator"}:(e==null?void 0:e.callerInvolved)===!0?l&&!d&&n==="loading"?{label:"Role checking",title:"This agent is involved in this Context Graph; curator status is still loading.",tone:"unknown"}:l&&!d&&n==="error"?{label:"Role unknown",title:"This agent is involved in this Context Graph, but curator status could not be confirmed.",tone:"unknown"}:{label:"Joined",title:"This agent is involved in this Context Graph; curator status is shown only when identity metadata confirms it.",tone:"participant"}:(e==null?void 0:e.callerInvolved)===!1?{label:"Not joined",title:"This agent is not listed as curator or participant for this Context Graph.",tone:"viewer"}:s==="ok"&&r.map(h=>h.trim()).filter(Boolean).some(h=>c.has(tn(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 FD(e,t,n){if(ns(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(c=>c.trim()).filter(Boolean).map(tn)),l=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";return l&&s.add(tn(l)),{id:"participants",value:s.size.toLocaleString(),label:"Agents with access",tooltip:"Includes the curator plus allowlisted participants reported by the node."}}function HD(e){const t=ns(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 qD({cg:e,currentAgent:t,currentAgentStatus:n="ok"}){var d,f;const r=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";if(!r)return"unknown";const s=((d=t==null?void 0:t.agentDid)==null?void 0:d.trim())??"",l=((f=t==null?void 0:t.agentAddress)==null?void 0:f.trim())??"",c=s||l;return c?tn(r)===tn(c)?"curator":"not-curator":"unknown"}function GD(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(tn))}function VD({cg:e,memory:t,subGraphCount:n,subGraphFetchFailed:r=!1,participants:s,participantsStatus:l="ok",currentAgent:c,currentAgentStatus:d="ok",onSwitchLayer:f,onOpenPrimer:h}){var W,D,U;const{wm:g,swm:m,vm:v}=t.counts,b=g+m+v,k=BD(e,c??null,d,s,l),j=HD(e==null?void 0:e.accessPolicy),C=FD(e,s,l),S=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",N=S?tn(S):"",E=ns(e==null?void 0:e.accessPolicy)==="public",T=GD(c??null),$=Object.values(t.layerStatus??{}),R=$.filter(G=>G==="error").length,L=!t.loading&&$.length===3&&R===3,B=!t.loading&&R>0,O=t.loading?"Loading memory layers...":L||t.error?"Live memory counts are unavailable.":t.partial||B?"One or more layer counts are currently a lower bound.":"Canonical current-layer entity counts.",_=L?"Unavailable":b.toLocaleString(),{total:I}=iv(t),F=!t.loading&&(t.partial||B),K=L?"Unavailable":t.loading&&I===0?"...":F?`${I.toLocaleString()}+`:I.toLocaleString(),z=L?"Live triple counts are unavailable.":F?"One or more layer triple counts are currently a lower bound.":"Canonical triple total across all layers.",q=n==null?r?"Unavailable":"...":n.toLocaleString(),V=n==null?r?"Sub-graph list is currently unavailable.":"Sub-graph count is loading.":"Topical partitions inside this Context Graph.",Z=[{key:"wm",label:"Working Memory",desc:"Private staging area",count:g,status:((W=t.layerStatus)==null?void 0:W.wm)??"ok",color:"#64748b"},{key:"swm",label:"Shared Working Memory",desc:"Collaborative review",count:m,status:((D=t.layerStatus)==null?void 0:D.swm)??"ok",color:"#f59e0b"},{key:"vm",label:"Verifiable Memory",desc:"Published on-chain",count:v,status:((U=t.layerStatus)==null?void 0:U.vm)??"ok",color:"#22c55e"}],Y=Z.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(Zd,{className:"v10-po-stat-strip",items:[{id:"entities",value:_,label:"Entities",tooltip:O},{id:"triples",value:K,label:"Triples",tooltip:z},{id:"subgraphs",value:q,label:"Subgraphs",tooltip:V},C]})]}),o.jsxs("div",{className:"v10-po-pipeline","data-section":"pipeline","aria-label":"Knowledge Pipeline",children:[o.jsx("div",{className:"v10-po-pipeline-head",children:o.jsxs("div",{children:[o.jsx("div",{className:"v10-po-section-title",children:"Knowledge Pipeline"}),o.jsx("div",{className:"v10-po-section-desc",children:"Entities move from private staging to shared review; published assertion bundles become Knowledge Assets with on-chain provenance."})]})}),o.jsx("div",{className:"v10-po-pipeline-track","aria-hidden":"true",children:!Y&&b>0?Z.map(G=>{const M=G.count>0?G.count/b*100:0;return o.jsx("span",{className:`v10-po-pipeline-seg ${G.key}`,style:{width:`${M}%`,background:G.color}},G.key)}):o.jsx("span",{className:"v10-po-pipeline-empty"})}),o.jsx("div",{className:"v10-po-pipeline-steps",children:Z.map((G,M)=>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:M+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()} ${sr(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:",M=oe=>oe.toLowerCase().startsWith(G)?oe.slice(G.length):oe,ee=new Set,ce=[];if(S&&l==="ok"){const oe=tn(S);ee.add(oe),ce.push({display:M(S),full:S,canonical:oe})}if(l==="ok")for(const oe of s){const be=tn(oe);ee.has(be)||(ee.add(be),ce.push({display:M(oe),full:oe,canonical:be}))}if(ce.length===0){const oe=E?"This Context Graph is public — anyone can subscribe.":l==="loading"?"Loading participant agents...":l==="error"?"Participant list unavailable.":"No participant agents recorded yet.";return o.jsx("div",{className:"v10-po-people-empty",children:oe})}return o.jsx("div",{className:"v10-po-participants-list",children:ce.map(({display:oe,full:be,canonical:Re})=>{const Ne=T.has(Re),De=!!N&&Re===N,We=`${oe.slice(0,6)}…${oe.slice(-4)}`,Se=[We];return Ne&&Se.push("you"),De&&Se.push("curator"),o.jsxs("span",{className:`v10-po-participant${Ne?" is-self":""}${De?" is-curator":""}`,title:be,"aria-label":Se.join(" "),children:[o.jsx("span",{className:"v10-po-participant-name",children:We}),Ne&&o.jsx("span",{className:"v10-po-participant-tag",children:"you"}),De&&o.jsx("span",{className:"v10-po-participant-tag",children:"curator"})]},Re)})})})()]})]})}function WD({contextGraphId:e,curatorStatus:t,onParticipantsChanged:n}){const[r,s]=w.useState([]),[l,c]=w.useState(null),[d,f]=w.useState("loading"),h=w.useRef(0),g=w.useCallback(()=>{if(t!=="curator"){s([]),f("idle");return}const b=++h.current;f("loading"),WS(e).then(k=>{h.current===b&&(s(k.requests.filter(j=>j.status==="pending")),f("idle"))}).catch(()=>{h.current===b&&(s([]),f("error"))})},[e,t]);if(w.useEffect(()=>(g(),()=>{h.current++}),[g]),ls(w.useCallback(b=>{var k;b.type!=="join_request"&&b.type!=="join_approved"&&b.type!=="join_rejected"||((k=b.data)==null?void 0:k.contextGraphId)===e&&g()},[e,g])),t==="not-curator")return null;if(t==="unknown")return o.jsxs("section",{className:"v10-po-join","data-section":"join-requests",children:[o.jsx("header",{className:"v10-po-join-head",children:o.jsx("span",{className:"v10-po-section-title",children:"Pending join requests"})}),o.jsx("div",{className:"v10-po-join-empty",children:"Verifying access…"})]});const m=async b=>{c(b);try{await zg(e,b),s(k=>k.filter(j=>j.agentAddress!==b)),n==null||n()}catch{}finally{c(null)}},v=async b=>{c(b);try{await $g(e,b),s(k=>k.filter(j=>j.agentAddress!==b)),n==null||n()}catch{}finally{c(null)}};return o.jsxs("section",{className:"v10-po-join","data-section":"join-requests",children:[o.jsxs("header",{className:"v10-po-join-head",children:[o.jsx("span",{className:"v10-po-section-title",children:"Pending join requests"}),o.jsx("span",{className:"v10-po-join-count","data-empty":r.length===0?"true":"false",children:r.length})]}),d==="loading"?o.jsx("div",{className:"v10-po-join-empty",children:"Loading join requests..."}):d==="error"?o.jsx("div",{className:"v10-po-join-empty",children:"Join requests are currently unavailable."}):r.length===0?o.jsx("div",{className:"v10-po-join-empty",children:"No pending join requests."}):o.jsx("div",{className:"v10-po-join-list",children:r.map(b=>o.jsxs("div",{className:"v10-po-join-item",children:[o.jsxs("div",{className:"v10-po-join-info",children:[o.jsx("span",{className:"v10-po-join-name",children:b.name||`${b.agentAddress.slice(0,6)}…${b.agentAddress.slice(-4)}`}),o.jsxs("span",{className:"v10-po-join-addr",title:b.agentAddress,children:[b.agentAddress.slice(0,10),"…"]})]}),o.jsxs("div",{className:"v10-po-join-actions",children:[o.jsx("button",{className:"v10-po-join-btn approve",onClick:()=>m(b.agentAddress),disabled:l===b.agentAddress,children:l===b.agentAddress?"…":"✓ Approve"}),o.jsx("button",{className:"v10-po-join-btn reject",onClick:()=>v(b.agentAddress),disabled:l===b.agentAddress,"aria-label":"Reject join request",children:"✕"})]})]},b.agentAddress))})]})}function ZD({onOpenPrimer:e}){return o.jsxs("div",{className:"v10-po-primer-footer","data-section":"primer",children:[o.jsx("span",{className:"v10-po-primer-footer-lede",children:"New here?"}),o.jsx("span",{className:"v10-po-primer-footer-arrow","aria-hidden":"true",children:"→"}),o.jsx("button",{type:"button",className:"v10-po-primer-footer-link",onClick:e,children:"What is a Context Graph?"}),o.jsx("div",{className:"v10-po-primer-footer-sub",children:"A short primer on context graphs, the WM → SWM → VM pipeline, and how participant agents collaborate."})]})}const KD=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();function YD(e,t=0){const n=Gl(c=>c.trackedIds),r=n.join(","),{data:s,loading:l}=da(async()=>{if(n.length===0)return{wallets:[],ownerPublish:!1,resolved:!1};const c=await qg().catch(()=>null),d=(c==null?void 0:c.wallets)??[];let f=!1;try{const{contextGraphs:g}=await Pd(),m=(g??[]).find(b=>(b==null?void 0:b.id)===e),v=m==null?void 0:m.curator;if(v){const b=await nc().catch(()=>null);f=!!(b!=null&&b.agentDid&&tn(v)===tn(b.agentDid))}}catch{f=!1}return{wallets:await Promise.all(d.map(async g=>{var T;const m=(T=c==null?void 0:c.balances)==null?void 0:T.find($=>KD($.address,g)),v=m==null,b=m!=null&&Number(m.eth)>0,k=m!=null&&Number(m.trac)>0;let j,C=!1,S=!1,N,E=!1;for(const $ of n){const R=await dd($,g,{extended:!0}).catch(()=>null);if(R===null){E=!0;continue}const L=Lm(R);if(L.outcome==="inconclusive"){E=!0;continue}if(L.outcome!=="unregistered"){if(L.outcome==="covers"){j={accountId:$,discountBps:R.discountBps,untracked:!1};break}L.dead&&(C=!0,N||(N=$)),L.hasBudget||(S=!0)}}if(!j&&!E&&!C&&!S){const $=await SR(g).catch(()=>{});if($===void 0)E=!0;else if($.accountId!=null&&!n.includes($.accountId)){const R=$.accountId,L=await dd(R,g,{extended:!0}).catch(()=>null);if(L===null)E=!0;else{const B=Lm(L);B.outcome==="covers"?j={accountId:R,discountBps:L.discountBps,untracked:!0}:B.outcome==="uncovered"?(B.dead&&(C=!0,N||(N=R)),B.hasBudget||(S=!0)):E=!0}}}return{wallet:g,covered:!!j,accountId:j==null?void 0:j.accountId,discountBps:j==null?void 0:j.discountBps,coverUntracked:(j==null?void 0:j.untracked)??!1,deadAccountId:j?void 0:N,inconclusive:!j&&E,balanceUnknown:v,gasFunded:b,hasTrac:k,sawExpired:C,sawInsolvent:S}})),ownerPublish:f,resolved:d.length>0}},[r,e],t);return w.useMemo(()=>{const c=(s==null?void 0:s.wallets)??[],d=(s==null?void 0:s.ownerPublish)??!1,f=(s==null?void 0:s.resolved)??!1;if(n.length===0||!f||c.length===0)return{verdict:"unknown",loading:l,ownerPublish:d,anyGasFunded:!1,reasons:[],conditions:{approved:!1,gasFunded:!1,notExpired:!1,solvent:!1},wallets:c};const h=c.filter(S=>S.covered),g=c.filter(S=>!S.covered),m=g.filter(S=>!S.inconclusive&&!S.balanceUnknown),v=g.filter(S=>S.inconclusive||S.balanceUnknown),b={approved:g.length===0,gasFunded:c.every(S=>S.gasFunded),notExpired:!c.some(S=>S.sawExpired),solvent:!c.some(S=>S.sawInsolvent)};let k;const j=[];if(g.length===0)h.some(S=>S.gasFunded||S.balanceUnknown)?k="eligible":(k="fallthrough-no-funds",j.push("every approved signing wallet is out of gas"));else if(m.length===0&&v.length>0)k="unknown";else{const S=c.some(N=>(N.covered||N.hasTrac)&&N.gasFunded);!S&&v.length>0?k="unknown":(k=S?"fallthrough":"fallthrough-no-funds",j.push(`${h.length} of ${c.length} signing wallets approved`),c.some(N=>N.sawExpired)&&j.push("a PCA has expired or been fully swept"),c.some(N=>N.sawInsolvent)&&j.push("a PCA is out of budget"),b.gasFunded||j.push("a signing wallet has no gas"),g.some(N=>N.inconclusive)&&j.push("a wallet’s PCA coverage couldn’t be checked"),g.some(N=>N.balanceUnknown)&&j.push("a signing wallet’s balance couldn’t be checked"))}const C=h.reduce((S,N)=>(N.discountBps??-1)>((S==null?void 0:S.discountBps)??-1)?N:S,void 0);return{verdict:k,loading:l,accountId:C==null?void 0:C.accountId,discountBps:C==null?void 0:C.discountBps,accountUntracked:C==null?void 0:C.coverUntracked,ownerPublish:d,anyGasFunded:c.some(S=>S.gasFunded||S.balanceUnknown),reasons:j,conditions:b,wallets:c}},[s,l,n.length])}function QD(e){return e.verdict==="fallthrough-no-funds"&&!(e.ownerPublish&&e.anyGasFunded)}function XD(e){const t=Gl(c=>c.trackedIds),n=YD(e,3e4),r=QD(n),s="Publish will fail — no signing wallet can fund it (coverage or gas).",l=t.length>0;return{blocked:r,reason:s,chipVisible:l,eligibility:n}}function JD({verdict:e,accountId:t,discountBps:n,accountUntracked:r,ownerPublish:s,id:l}){return o.jsx("div",{className:"v10-pca-publish-chip",id:l,"data-testid":"pca-publish-eligibility",children:o.jsx(dM,{variant:"chip",verdict:e,accountId:t,discountBps:n,accountUntracked:r,ownerPublish:s})})}function dv({title:e,agent:t,footnote:n,dismissed:r,onDismiss:s,children:l}){return o.jsxs("div",{className:`v10-gen-widget ${r?"dissolved":""}`,children:[o.jsxs("div",{className:"v10-gen-widget-header",children:[o.jsx("span",{className:"v10-gen-widget-title",children:e}),o.jsxs("div",{className:"v10-gen-widget-right",children:[t&&o.jsxs("span",{className:"v10-gen-widget-agent",children:[o.jsx("span",{className:"v10-gen-widget-agent-dot"}),t]}),s&&o.jsx("button",{className:"v10-gen-widget-dismiss",onClick:s,children:"✕"})]})]}),o.jsx("div",{className:"v10-gen-widget-body",children:l}),n&&o.jsx("div",{className:"v10-gen-widget-footnote",children:n})]})}function eI({entities:e}){const t=Pr(),n=w.useMemo(()=>{const r=new Map;for(const s of e){const{icon:l,type:c}=Wd(s,t),d=r.get(c);d?d.count++:r.set(c,{icon:l,count:1})}return[...r.entries()].sort((s,l)=>l[1].count-s[1].count)},[e,t]);return n.length===0?null:o.jsx(dv,{title:"Entity Types",children:o.jsx(Zd,{compact:!0,items:n.map(([r,{icon:s,count:l}])=>({id:r,label:`${s} ${r}`,value:l}))})})}function tI({entities:e,entityCount:t,triples:n,layer:r}){const s=w.useMemo(()=>e.filter(d=>d.properties.has("http://dkg.io/ontology/sourceContentType")).length,[e]),l=w.useMemo(()=>e.reduce((d,f)=>d+f.connections.length,0),[e]),c=e.length>0?(l/e.length).toFixed(1):"0";return o.jsx(dv,{title:"Layer Stats",children:o.jsx(Zd,{compact:!0,layer:r,items:[{id:"entities",label:sr(r,t),value:t},{id:"triples",label:"Triples",value:n},{id:"connections",label:"Connections",value:l},{id:"avg",label:"Avg. connections / entity",value:c},...s>0?[{id:"documents",label:"Documents",value:s}]:[]]})})}function Hj(e,t){const[n,r]=w.useState(!1),[s,l]=w.useState(null),[c,d]=w.useState(null),f=w.useCallback(async(h,g)=>{r(!0),d(null),l(null);try{const m=await h();l(m),e==null||e({ok:!0,text:m}),t==null||t()}catch(m){const v=g(m);d(v),e==null||e({ok:!1,text:v})}finally{r(!1)}},[e,t]);return{busy:n,result:s,error:c,run:f}}function qj({title:e,footnote:t,context:n,result:r,error:s,extras:l,children:c}){return o.jsxs(dv,{title:e,footnote:t,children:[o.jsx("div",{className:"v10-decision-context",style:{marginBottom:10},children:n}),r&&o.jsxs("div",{"data-testid":"layer-action-result",style:{fontSize:11,color:"var(--text-success)",marginBottom:8},children:["✓ ",r]}),s&&o.jsxs("div",{"data-testid":"layer-action-error",style:{fontSize:11,color:"var(--text-danger)",marginBottom:8},children:["✕ ",s]}),l,o.jsx("div",{className:"v10-decision-actions",children:c})]})}function nI({count:e,contextGraphId:t,onComplete:n,onResult:r}){const{busy:s,result:l,error:c,run:d}=Hj(r,n),f=w.useCallback(()=>{let m=null;d(async()=>{const v=await ac(t,"wm");let b=0;for(const j of v)m=j.name,(await ho(t,j.name,j.subGraph?{subGraphName:j.subGraph}:{})).promotedCount===0&&(b+=1);const k=v.length-b;if(k>0){const j=b>0?` (${b} already shared or still committing)`:"";return`Shared ${k} complete Knowledge Asset${k!==1?"s":""} to Shared Memory${j}`}return"No Knowledge Assets were newly shared — all were already in Shared Memory or still committing."},v=>{const b=mo(m??"an assertion",v);return b?b.message:(v==null?void 0:v.message)??"Action failed"})},[t,d]);if(e===0)return null;const h="#f59e0b",g=sr("wm",e).toLowerCase();return o.jsx(qj,{title:"Share complete Knowledge Assets",footnote:"Shares each complete owning Knowledge Asset atomically to Shared Working Memory.",context:o.jsxs(o.Fragment,{children:["The displayed ",g," will be shared through their complete owning Knowledge Assets for collaborative review."]}),result:l,error:c,children:o.jsx("button",{"data-testid":"widget-promote-all-btn",className:"v10-decision-btn approve",style:{borderColor:`${h}50`,color:"var(--text-warning)",background:`${h}15`,opacity:s?.5:1},disabled:s,onClick:f,children:s?"...":"✓ Share Complete KAs → Shared"})})}function aI({count:e,contextGraphId:t,onComplete:n,onResult:r}){const[s,l]=w.useState(null),{busy:c,result:d,error:f,run:h}=Hj(r,n),g=XD(t),m=w.useId(),v=w.useId(),b=[g.chipVisible?m:null,g.blocked?v:null].filter(Boolean).join(" ")||void 0,k=w.useCallback(()=>{g.blocked||h(async()=>{l(null);const C=await ac(t,"swm"),S=await Ug(t,C);if(S.published>0){const N=S.failures.length?` (${S.failures.length} assertion${S.failures.length===1?"":"s"} could not be published)`:"",E=S.partial>0?` — ⚠ ${S.partial}: ${ql(S.partialError)}`:"";return l(S.convictionCostCovered??null),`Published ${S.published} knowledge asset${S.published!==1?"s":""} to Verifiable Memory${N}${E}`}if(C.length===0)return"Nothing to publish — promote assertions to Shared Memory first.";throw new Error(S.failures[0]?`${S.failures[0].name}: ${S.failures[0].error}`:"Publish failed")},C=>(C==null?void 0:C.message)??"Action failed")},[t,h,g.blocked]);if(e===0)return null;const j=sr("swm",e).toLowerCase();return o.jsx(qj,{title:"Publish",footnote:`Moves ${j} from this layer to Verifiable Memory.`,context:o.jsxs(o.Fragment,{children:[e," ",j," in this layer can be published to Verifiable Memory on-chain."]}),result:d,error:f,extras:o.jsxs(o.Fragment,{children:[o.jsx(uj,{convictionCostCovered:s}),g.chipVisible&&o.jsx(JD,{...g.eligibility,id:m}),g.blocked&&o.jsx("span",{id:v,className:"v10-sr-only",children:g.reason})]}),children:o.jsx("button",{"data-testid":"widget-publish-vm-btn",className:"v10-decision-btn primary-cta publish-vm",style:{opacity:c||g.blocked?.5:1},disabled:c,"aria-disabled":g.blocked||void 0,title:g.blocked?g.reason:void 0,"aria-describedby":b,onClick:k,children:c?"...":"◉ Publish to Verifiable Memory"})})}function rI({layer:e,entities:t,entityCount:n,tripleCount:r,contextGraphId:s,onComplete:l}){const[c,d]=w.useState(null),f=c&&o.jsxs("div",{"data-testid":c.ok?"layer-action-result":"layer-action-error",style:{fontSize:11,color:c.ok?"var(--text-success)":"var(--text-danger)",marginBottom:8},children:[c.ok?"✓":"✕"," ",c.text]});return n===0?o.jsxs("div",{className:"v10-layer-widgets-strip empty",children:[f,o.jsx(cn,{compact:!0,tone:e,icon:$n[e].icon,title:`No ${sr(e,2).toLowerCase()} yet`,description:e==="wm"?"Import data or chat with agents to populate Working Memory.":e==="swm"?"Seal and share complete Knowledge Assets from Working Memory with the team.":"Publish complete Knowledge Assets from Shared Working Memory to verify them on-chain."})]}):o.jsxs("div",{className:"v10-layer-widgets-strip",children:[o.jsxs("div",{className:"v10-layer-widgets-strip-stats",children:[o.jsx(tI,{entities:t,entityCount:n,triples:r,layer:e}),o.jsx(eI,{entities:t})]}),(e==="wm"||e==="swm")&&s&&o.jsx("div",{className:"v10-layer-widgets-strip-action",children:e==="wm"?o.jsx(nI,{count:n,contextGraphId:s,onComplete:l,onResult:d}):o.jsx(aI,{count:n,contextGraphId:s,onComplete:l,onResult:d})})]})}const pv="doc:";function iI(e,t,n){return`${pv}${e}|${t}|${n}`}function sI(e,t,n){return e?{ref:e,contentType:"text/markdown"}:t?{ref:t,contentType:n}:{ref:void 0,contentType:n}}function oI(e){const t=e.slice(pv.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 fv(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 lI={working:{layerKey:"wm",icon:"◇",label:"Working"},shared:{layerKey:"swm",icon:"◈",label:"Shared"},verified:{layerKey:"vm",icon:"◉",label:"Verifiable"}};function Gj({entities:e,layerKey:t,layerIcon:n,onSelectEntity:r,onOpenAgent:s,externallySorted:l=!1,sortLabel:c,headerExtra:d,timestampPredicate:f,perEntityTrustBadge:h=!1}){const g=Pr(),m=ds(),v=sr(t,e.length).toLowerCase(),b=w.useMemo(()=>{if(l)return e;const C=[...e];return C.sort((S,N)=>{const E=S.tripleCount??0;return(N.tripleCount??0)-E}),C},[e,l]),k=t==="vm"?"Verifiable":t==="swm"?"Shared":"Working";if(e.length===0)return o.jsx("div",{className:"v10-entity-list empty",children:o.jsx(cn,{compact:!0,tone:t,icon:n,title:`No ${sr(t,2).toLowerCase()} yet`,description:`This view will fill when matching ${sr(t,2).toLowerCase()} are available.`})});const j=c??(l?"click to open":"sorted by triples · click to open");return o.jsxs("div",{className:"v10-entity-list",children:[o.jsxs("div",{className:"v10-entity-list-header",children:[o.jsxs("span",{className:"v10-entity-list-count",children:[b.length," ",v]}),o.jsx("span",{className:"v10-entity-list-hint",children:j}),d&&o.jsx("span",{className:"v10-entity-list-extra",children:d})]}),b.map(C=>{const{icon:S,type:N}=Wd(C,g),E=C.tripleCount??0,T=Vd(C),$=T?m==null?void 0:m.get(T):null,R=f?td(C,f):null;return o.jsxs("div",{className:"v10-entity-card",onClick:L=>{L.stopPropagation(),r(C.uri)},children:[o.jsx("span",{className:"v10-entity-card-icon",children:S}),o.jsxs("div",{className:"v10-entity-card-main",children:[o.jsx("div",{className:"v10-entity-card-title",children:C.label}),o.jsxs("div",{className:"v10-entity-card-meta",children:[($||T)&&o.jsx(as,{agent:$??void 0,fallbackUri:T??void 0,size:"sm",onOpenAgent:s}),N&&N!=="Entity"&&o.jsxs("span",{className:"v10-entity-type-pill",children:[S," ",N]}),R!=null&&o.jsx("span",{className:"v10-entity-card-timestamp",title:new Date(R).toLocaleString(),children:bL(R)}),o.jsxs("span",{className:"v10-entity-card-triples",children:[E," triples"]})]})]}),h?(()=>{const L=lI[C.trustLevel];return o.jsxs("span",{className:`v10-trust-badge ${L.layerKey}`,title:`${L.label} Memory`,children:[L.icon," ",L.label]})})():o.jsxs("span",{className:`v10-trust-badge ${t}`,children:[n," ",k]})]},C.uri)})]})}function cI({layer:e,entities:t,tripleCount:n,layerTriples:r,contextGraphId:s,memory:l,activeTab:c,onTabChange:d,onSelectEntity:f,onNodeClick:h,footer:g,swmAttribution:m}){var T;const v=$n[e],b=sr(e,2),k=((T=l.layerStatus)==null?void 0:T.vm)??(l.loading?"loading":l.error?"error":"ok"),j=e==="vm"&&k==="loading"&&t.length===0,C=e==="vm"&&k==="error"&&t.length===0,S=e==="vm"&&k==="ok"&&t.length===0,N=l.counts[e],E=$=>R=>{R.stopPropagation(),d($)};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-layer-expand-tabs",children:[o.jsx("button",{className:`v10-layer-expand-tab ${c==="items"?"active":""}`,onClick:E("items"),children:b}),e!=="vm"&&o.jsx("button",{className:`v10-layer-expand-tab ${c==="assertions"?"active":""}`,onClick:E("assertions"),children:"Assertions"}),o.jsx("button",{className:`v10-layer-expand-tab ${c==="graph"?"active":""}`,onClick:E("graph"),children:"Graph"}),o.jsx("button",{className:`v10-layer-expand-tab ${c==="docs"?"active":""}`,onClick:E("docs"),children:"Documents"})]}),c==="items"&&o.jsxs("div",{className:"v10-layer-expand-body entities-tab","data-cg-scroll-key":`layer:${e}:items`,children:[e==="vm"&&!j&&!C&&o.jsx(uI,{entities:t,tripleCount:n,contextGraphId:s}),j?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(cn,{compact:!0,tone:"vm",icon:$n.vm.icon,title:"Loading Verifiable Memory...",description:"Knowledge Assets are being read from the verified layer."})}):C?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(cn,{compact:!0,tone:"vm",icon:$n.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(rI,{layer:e,entities:t,entityCount:N,tripleCount:n,contextGraphId:s,onComplete:l.refresh}),o.jsx(Gj,{entities:t,layerKey:e,layerIcon:v.icon,onSelectEntity:f})]}),g]}),c==="assertions"&&e!=="vm"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(dI,{contextGraphId:s,layer:e,onComplete:l.refresh,scrollKey:`layer:${e}:assertions`})}),c==="graph"&&o.jsx("div",{className:"v10-layer-expand-body full-width","data-cg-scroll-key":`layer:${e}:graph`,children:o.jsx(Fj,{layer:e,triples:r,onNodeClick:h,contextGraphId:s,swmAttribution:e==="swm"?m:void 0,layerEntities:t})}),c==="docs"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(Vj,{entities:t,contextGraphId:s,scrollKey:`layer:${e}:docs`})})]})}function uI({entities:e,tripleCount:t,contextGraphId:n}){const r=e.length,s=new Set;for(const c of e)for(const d of c.types)s.add(d);const l=s.size;return r===0?o.jsxs("div",{className:"v10-vm-hero v10-vm-hero-empty",children:[o.jsxs("div",{className:"v10-vm-hero-title",children:[o.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),o.jsxs("div",{className:"v10-vm-hero-heading",children:[o.jsx("span",{className:"v10-vm-hero-headline",children:"Nothing published yet"}),o.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),o.jsx(cn,{compact:!0,className:"v10-vm-empty-state",tone:"vm",icon:$n.vm.icon,title:"No Knowledge Assets yet.",description:"Publish complete Knowledge Assets from Shared Working Memory to verify them on-chain."})]}):o.jsxs("div",{className:"v10-vm-hero",children:[o.jsxs("div",{className:"v10-vm-hero-title",children:[o.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),o.jsxs("div",{className:"v10-vm-hero-heading",children:[o.jsx("span",{className:"v10-vm-hero-headline",children:"On-chain anchored · cryptographically signed"}),o.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),o.jsx(Zd,{className:"v10-vm-hero-stats",layer:"vm",items:[{id:"assets",value:r,label:"Knowledge Assets"},{id:"triples",value:t.toLocaleString(),label:"Verifiable Triples"},{id:"types",value:l,label:"Entity Types"}]}),o.jsxs("div",{className:"v10-vm-hero-strip",children:[o.jsxs("div",{className:"v10-vm-hero-chip",title:"Multi-agent endorsement",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#22c55e"}}),"Consensus"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Published to the DKG blockchain anchor",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#3b82f6"}}),"On-chain"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Each contribution bound to a DID",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#a855f7"}}),"Agent Identity"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Tamper-evident via content hashing",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#f59e0b"}}),"Content Hash"]})]})]})}function dI({contextGraphId:e,layer:t,onComplete:n,scrollKey:r}){const{data:s,loading:l,refresh:c}=da(()=>ac(e,t),[e,t],0),{data:d}=da(()=>$R(e),[e,t],0),[f,h]=w.useState(null),[g,m]=w.useState(null),[v,b]=w.useState(null),k=w.useCallback(async E=>{h(E.graphUri),m(null),b(null);try{if(t==="wm"){const T=await ho(e,E.name,E.subGraph?{subGraphName:E.subGraph}:{}),$=Bg(E.name,T);m($.message)}else{const T=await Pg(e,E.name,E.subGraph?{subGraphName:E.subGraph}:{});m(T.contextGraphError?`Published ${E.name} on-chain — ⚠ ${ql(T.contextGraphError)}`:`Published ${E.name} to Verifiable Memory`)}c(),n()}catch(T){const $=mo(E.name,T);b($?$.message:(T==null?void 0:T.message)??"Action failed")}finally{h(null)}},[e,t,c,n]),j=w.useCallback(async()=>{if(!(s!=null&&s.length))return;h("__all__"),m(null),b(null);let E=null;try{if(t==="wm"){let T=0;for(const R of s)E=R.name,(await ho(e,R.name,R.subGraph?{subGraphName:R.subGraph}:{})).promotedCount===0&&(T+=1);const $=s.length-T;if($>0){const R=T>0?` (${T} already shared or still committing)`:"";m(`Shared ${$} complete Knowledge Asset${$!==1?"s":""}${R}`)}else m("No Knowledge Assets were newly shared — all were already in Shared Memory or still committing.")}else{const T=await Ug(e,s);if(T.published>0){const $=T.failures.length?` (${T.failures.length} could not be published)`:"",R=T.partial>0?` — ⚠ ${T.partial}: ${ql(T.partialError)}`:"";m(`Published ${T.published} knowledge asset${T.published!==1?"s":""} to Verifiable Memory${$}${R}`)}else throw new Error(T.failures[0]?`${T.failures[0].name}: ${T.failures[0].error}`:"Publish failed")}c(),n()}catch(T){const $=mo(E??"selected assertion",T);b($?$.message:(T==null?void 0:T.message)??"Action failed")}finally{h(null)}},[s,e,t,c,n]),C={flex:1,overflow:"auto"};if(l)return o.jsx("div",{className:"v10-layer-empty-shell",style:C,"data-cg-scroll-key":r,children:o.jsx(cn,{compact:!0,tone:t,icon:$n[t].icon,title:"Loading assertions..."})});if(!(s!=null&&s.length))return o.jsx("div",{className:"v10-layer-empty-shell",style:C,"data-cg-scroll-key":r,children:o.jsx(cn,{tone:t,icon:$n[t].icon,title:t==="swm"?"No Shared Working Memory assertions listed yet.":"No Working Memory assertions yet.",description:t==="swm"?"Promoted assertion contents are available as Shared Working Memory entities. The assertion list will populate once promoted assertions are exposed by the node.":"Create or import data to stage assertions in Working Memory."})});const S=t==="wm"?"Share Complete KA → Shared":"Publish to VM",N=t==="wm"?"Share Complete KAs → Shared":"Publish all to Verifiable Memory";return o.jsxs("div",{style:C,"data-cg-scroll-key":r,children:[o.jsxs("div",{style:{padding:"8px 16px",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid var(--border-subtle)"},children:[o.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:[s.length," assertion",s.length!==1?"s":""]}),o.jsx("button",{className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:f!==null,onClick:j,style:{opacity:f==="__all__"?.5:1},children:f==="__all__"?"...":N})]}),g&&o.jsxs("div",{"data-testid":t==="wm"?"assertion-promote-result":"assertion-publish-result",style:{padding:"6px 16px",fontSize:11,color:"var(--text-success)"},children:["✓ ",g]}),v&&o.jsxs("div",{"data-testid":t==="wm"?"assertion-promote-result":"assertion-publish-result",style:{padding:"6px 16px",fontSize:11,color:"var(--text-danger)"},children:["✕ ",v]}),s.map(E=>o.jsxs("div",{className:"v10-item-row","data-testid":"assertion-list-row",children:[o.jsx("span",{className:"v10-item-icon",children:"▤"}),o.jsxs("div",{className:"v10-item-info",children:[o.jsx("div",{className:"v10-item-name",style:{fontFamily:"var(--font-mono)",fontSize:11},children:E.name}),(d==null?void 0:d[E.name])&&o.jsx("div",{className:"v10-item-ual",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",opacity:.7,wordBreak:"break-all",marginTop:1},title:d[E.name],children:d[E.name]}),o.jsxs("div",{className:"v10-item-meta-row",children:[E.tripleCount!=null&&o.jsxs("span",{className:"v10-item-count",children:[E.tripleCount," triples"]}),E.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${E.subGraph}`,children:["› ",fv(E.subGraph,18)]})]})]}),o.jsx("button",{"data-testid":"assertion-row-action",className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:f!==null,onClick:T=>{T.stopPropagation(),k(E)},style:{opacity:f===E.graphUri?.5:1,flexShrink:0},children:f===E.graphUri?"...":S})]},E.graphUri))]})}function pI({layer:e,memory:t,onNodeClick:n,onSelectEntity:r,contextGraphId:s,activeTab:l,onTabChange:c,swmAttribution:d}){const f=$n[e],h=w.useMemo(()=>t.entityList.filter(m=>m.trustLevel===f.trustLevel),[t.entityList,f.trustLevel]),g=hL(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(cI,{layer:e,entities:h,tripleCount:g.length,layerTriples:g,contextGraphId:s,memory:t,activeTab:l,onTabChange:c,onSelectEntity:r,onNodeClick:n,swmAttribution:d})})]})}function Vj({entities:e,contextGraphId:t,scrollKey:n}){const r=hn(c=>c.openTab),s=w.useMemo(()=>e.filter(c=>c.properties.has(Ph)),[e]),l=c=>{var v,b,k;const d=(v=c.connections.find(j=>j.predicate===I1))==null?void 0:v.targetUri,f=(b=c.connections.find(j=>j.predicate===z1))==null?void 0:b.targetUri,h=((k=c.properties.get(Ph))==null?void 0:k[0])??"",{ref:g,contentType:m}=sI(d,f,h);r({id:iI(t??"",g??c.uri,m),label:c.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(cn,{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(c=>{var m,v,b,k;const d=((m=c.properties.get(Ph))==null?void 0:m[0])??"",f=(v=c.connections.find(j=>j.predicate===I1||j.predicate===z1))==null?void 0:v.targetUri,h=f?e.find(j=>j.uri===f):void 0,g=((b=h==null?void 0:h.properties.get($1))==null?void 0:b[0])??((k=c.properties.get($1))==null?void 0:k[0]);return o.jsxs("div",{className:"v10-item-row",onClick:()=>l(c),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:c.label}),o.jsxs("div",{className:"v10-item-meta-row",children:[d&&o.jsx("span",{className:"v10-item-type",children:d}),g&&o.jsxs("span",{className:"v10-item-count",children:["· ",Math.round(parseInt(g)/1024),"KB"]})]})]}),o.jsx("button",{className:"v10-item-promote-btn",onClick:j=>{j.stopPropagation(),l(c)},children:"Open →"})]},c.uri)})})})}function Wj(e){return`SELECT ?g ?s ?p ?o WHERE {
|
|
1287
|
+
GRAPH ?g { ?s ?p ?o }
|
|
1288
|
+
${Vm(e)}
|
|
1289
|
+
}
|
|
1290
|
+
LIMIT 1000`}const or="__context_graph",vo="ui-saved-queries",wd="Saved queries",kd="User-created SPARQL saved in this node profile for this Context Graph.",er="http://dkg.io/ontology/profile/",Z1="http://schema.org/",K1="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",fI="http://www.w3.org/2001/XMLSchema#integer";function Y1(e){return JSON.stringify(e)}function Vm(e){const t=`did:dkg:context-graph:${e}`,n=`${t}/`;return`FILTER(
|
|
1291
|
+
(
|
|
1292
|
+
STR(?g) = ${Y1(t)} ||
|
|
1293
|
+
STRSTARTS(STR(?g), ${Y1(n)})
|
|
1294
|
+
) &&
|
|
1295
|
+
!CONTAINS(STR(?g), "/_private")
|
|
1296
|
+
)`}function hI(e){const t="whole-context-graph",n="Context graph",s=or,l=c=>({subGraph:s,catalogSlug:t,catalogName:n,catalogDescription:"Ready-made SPARQL included with the Node UI for common Context Graph checks.",catalogRank:-100,resultColumn:"",...c});return{slug:t,subGraph:s,name:n,description:"Ready-made SPARQL included with the Node UI for common Context Graph checks.",rank:-100,queries:[l({slug:"all-triples",name:"All triples",description:"Show triples across available non-private graphs in this context graph.",sparql:Wj(e),resultColumn:"o",rank:1}),l({slug:"graphs",name:"Graphs",description:"List available non-private named graphs and triple counts.",sparql:`SELECT ?g (COUNT(*) AS ?triples) WHERE {
|
|
1297
|
+
GRAPH ?g { ?s ?p ?o }
|
|
1298
|
+
${Vm(e)}
|
|
1299
|
+
}
|
|
1300
|
+
GROUP BY ?g
|
|
1301
|
+
ORDER BY DESC(?triples)
|
|
1302
|
+
LIMIT 100`,resultColumn:"g",rank:2}),l({slug:"types",name:"Types",description:"Count entities by RDF type across the context graph.",sparql:`SELECT ?type (COUNT(DISTINCT ?s) AS ?entities) WHERE {
|
|
1303
|
+
GRAPH ?g { ?s a ?type }
|
|
1304
|
+
${Vm(e)}
|
|
1305
|
+
}
|
|
1306
|
+
GROUP BY ?type
|
|
1307
|
+
ORDER BY DESC(?entities)
|
|
1308
|
+
LIMIT 100`,resultColumn:"type",rank:3})]}}function mI(e){return e.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"saved-query"}function Q1(e,t,n){return`urn:dkg:profile:${encodeURIComponent(e)}:${t}:${encodeURIComponent(n)}`}function Wi(e){return JSON.stringify(e)}function X1(e){return`"${e}"^^<${fI}>`}function gI(e,t,n,r){const s=Date.now(),l=`${mI(t)}-${s.toString(36)}`,c=Q1(e,"catalog",vo),d=Q1(e,"query",l),f={slug:l,subGraph:or,catalogSlug:vo,catalogName:wd,catalogDescription:kd,catalogRank:50,name:t,description:n||void 0,sparql:r,resultColumn:"",rank:s},h=[{subject:c,predicate:K1,object:`${er}QueryCatalog`,graph:""},{subject:c,predicate:`${er}forSubGraph`,object:Wi(or),graph:""},{subject:c,predicate:`${er}displayName`,object:Wi(wd),graph:""},{subject:c,predicate:`${Z1}description`,object:Wi(kd),graph:""},{subject:c,predicate:`${er}rank`,object:X1(50),graph:""},{subject:d,predicate:K1,object:`${er}SavedQuery`,graph:""},{subject:d,predicate:`${er}forSubGraph`,object:Wi(or),graph:""},{subject:d,predicate:`${er}inCatalog`,object:c,graph:""},{subject:d,predicate:`${er}displayName`,object:Wi(t),graph:""},{subject:d,predicate:`${er}sparqlQuery`,object:Wi(r),graph:""},{subject:d,predicate:`${er}rank`,object:X1(s),graph:""}];return n&&h.push({subject:d,predicate:`${Z1}description`,object:Wi(n),graph:""}),{query:f,quads:h}}function vI(e,t){const n=`${or}|${vo}`,r=e.map(l=>({...l,queries:[...l.queries]})),s=r.find(l=>`${l.subGraph}|${l.slug}`===n);return s?(s.queries=[...s.queries,t].sort((l,c)=>l.rank-c.rank||l.name.localeCompare(c.name)),r):[...r,{slug:vo,subGraph:or,name:wd,description:kd,rank:50,queries:[t]}]}function J1(e){const t=new Map;for(const n of e){const r=`${n.subGraph}|${n.slug}`,s=t.get(r);if(!s){t.set(r,{...n,queries:[...n.queries]});continue}const l=new Map(s.queries.map(c=>[`${c.subGraph}|${c.catalogSlug}|${c.slug}`,c]));for(const c of n.queries){const d=`${c.subGraph}|${c.catalogSlug}|${c.slug}`;l.has(d)||l.set(d,c)}s.queries=Array.from(l.values()).sort((c,d)=>c.rank-d.rank||c.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 yI(e){return e==null?"":typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function bI(e){return e?e.length<=140?e:`${e.slice(0,110)}...${e.slice(-24)}`:"—"}function Kd(e){return e.subGraph===or&&e.slug==="whole-context-graph"}function xI(e){return e.subGraph===or?"context":"subgraph"}function wI(e,t,n){return Kd(e)?"Built-in presets":e.subGraph===or&&e.slug===vo?wd:t==="context"?e.name:`${n??e.subGraph}: ${e.name}`}function kI(e){return Kd(e)?"UI-provided SPARQL for common Context Graph checks.":e.subGraph===or&&e.slug===vo?kd:e.description??""}function SI(e,t){return Kd(e)?"Preset":t==="context"?"Saved":"Subgraph"}function jI(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 CI({contextGraphId:e}){const t=Pr(),n=w.useMemo(()=>Wj(e),[e]),[r,s]=w.useState(n),[l,c]=w.useState(n),[d,f]=w.useState(null),[h,g]=w.useState([]),[m,v]=w.useState(!1),[b,k]=w.useState(""),[j,C]=w.useState(""),[S,N]=w.useState(!1),[E,T]=w.useState(null),[$,R]=w.useState(null),L=w.useMemo(()=>hI(e),[e]),B=w.useMemo(()=>J1([L,...h,...(t==null?void 0:t.queryCatalogs)??[]]),[L,h,t==null?void 0:t.queryCatalogs]),O=w.useMemo(()=>t!=null&&t.loading||t!=null&&t.error?J1([L,...h]):B,[L,h,t==null?void 0:t.error,t==null?void 0:t.loading,B]);w.useEffect(()=>{s(n),c(n),f(null),g([]),v(!1),k(""),C(""),T(null),R(null)},[n]);const{data:_,loading:I,error:F,refresh:K}=da(()=>ua(l,e),[l,e],0),z=w.useMemo(()=>{var G,M;return((G=_==null?void 0:_.result)==null?void 0:G.bindings)??((M=_==null?void 0:_.results)==null?void 0:M.bindings)??[]},[_]),q=w.useMemo(()=>B.some(G=>!Kd(G)&&G.queries.length>0),[B]),V=w.useMemo(()=>{const G=[];for(const M of z)for(const ee of Object.keys(M))G.includes(ee)||G.push(ee);return G},[z]),Z=w.useCallback(()=>{const G=r.trim();if(G){if(f(null),R(null),T(null),G===l){K();return}c(G)}},[l,r,K]),Y=w.useCallback(()=>{s(n),f(null),R(null),T(null),l===n?K():c(n)},[l,n,K]),W=w.useCallback((G,M)=>{const ee=M.trim();if(ee){if(f(G),s(ee),R(null),T(null),l===ee){K();return}c(ee)}},[l,K]),D=w.useCallback(()=>{const G=r.trim().split(`
|
|
1309
|
+
`).find(M=>M.trim());k(G?G.replace(/\s+/g," ").slice(0,60):""),C(""),T(null),R(null),v(!0)},[r]),U=w.useCallback(async G=>{G.preventDefault();const M=b.trim(),ee=j.trim(),ce=r.trim();if(!M){T("Name is required.");return}if(!ce){T("Query is empty.");return}N(!0),T(null),R(null);try{const{query:oe,quads:be}=gI(e,M,ee,ce);await PR(e,be),g(Ne=>vI(Ne,oe));const Re=`${oe.subGraph}|${oe.catalogSlug}|${oe.slug}`;f(Re),s(oe.sparql),l===oe.sparql?K():c(oe.sparql),k(""),C(""),v(!1),R("Saved to catalogue.")}catch(oe){T((oe==null?void 0:oe.message)??"Failed to save query.")}finally{N(!1)}},[l,e,r,K,j,b]);return o.jsxs("div",{className:"v10-memory-layer-view v10-cg-query-view",children:[o.jsxs("div",{className:"v10-mlv-header",children:[o.jsx("span",{className:"v10-mlv-icon",children:"⟐"}),o.jsxs("div",{children:[o.jsx("h2",{className:"v10-mlv-title",children:"Query Catalogue"}),o.jsx("p",{className:"v10-mlv-desc",children:"Reusable SPARQL for this Context Graph. Use UI presets or save queries for people and local agents to reuse."})]})]}),o.jsxs("section",{className:"v10-cg-query-zone v10-cg-query-zone-catalog","aria-labelledby":"query-catalogue-saved-title",children:[o.jsx("div",{className:"v10-cg-query-zone-header",children:o.jsxs("div",{children:[o.jsx("span",{className:"v10-cg-query-eyebrow",children:"Query Library"}),o.jsx("h3",{id:"query-catalogue-saved-title",children:"Choose a query"}),o.jsx("p",{children:"Load a preset or saved query into the editor below."})]})}),(t==null?void 0:t.loading)&&o.jsx(cn,{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(cn,{compact:!0,inline:!0,tone:"danger",icon:"!",title:"Saved query catalogue unavailable",description:t.error}),O.length>0&&o.jsx("div",{className:"v10-cg-query-catalog-groups",children:O.map(G=>{const M=xI(G),ee=M==="context"||t==null?void 0:t.forSubGraph(G.subGraph),ce=(ee==null?void 0:ee.color)??"#38bdf8",oe=wI(G,M,ee==null?void 0:ee.displayName),be=kI(G),Re=SI(G,M);return o.jsxs("div",{className:"v10-cg-query-catalog-group",style:{"--sg-color":ce},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:oe})]}),be&&o.jsx("p",{children:be})]})}),o.jsx("div",{className:"v10-cg-query-list",children:G.queries.map(Ne=>{const De=`${Ne.subGraph}|${Ne.catalogSlug}|${Ne.slug}`,We=d===De&&l===Ne.sparql,Se=Ne.description?`${Ne.name}. ${Ne.description}`:Ne.name;return o.jsxs("button",{type:"button",className:`v10-cg-query-chip${We?" active":""}`,title:Se,"aria-label":`Load query: ${Se}`,onClick:()=>W(De,Ne.sparql),children:[o.jsx("span",{className:"v10-cg-query-chip-title",children:Ne.name}),Ne.description&&o.jsx("span",{className:"v10-cg-query-chip-desc",children:Ne.description})]},De)})})]},`${G.subGraph}|${G.slug}`)})}),!(t!=null&&t.loading)&&!(t!=null&&t.error)&&B.length>0&&!q&&o.jsx(cn,{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:Z,children:"Run"}),o.jsx("button",{className:"v10-mlv-save-btn",type:"button",onClick:D,children:"Save"}),o.jsx("button",{className:"v10-mlv-clear-btn",type:"button",onClick:Y,children:"Reset"})]})]}),m&&o.jsxs("form",{className:"v10-cg-query-save-panel",onSubmit:U,children:[o.jsxs("label",{className:"v10-cg-query-save-field",children:[o.jsx("span",{children:"Name"}),o.jsx("input",{type:"text",value:b,onChange:G=>k(G.target.value),placeholder:"Query name",maxLength:80})]}),o.jsxs("label",{className:"v10-cg-query-save-field",children:[o.jsx("span",{children:"Description"}),o.jsx("input",{type:"text",value:j,onChange:G=>C(G.target.value),placeholder:"Optional",maxLength:180})]}),o.jsxs("div",{className:"v10-cg-query-save-actions",children:[o.jsx("button",{type:"button",className:"v10-mlv-clear-btn",onClick:()=>v(!1),disabled:S,children:"Cancel"}),o.jsx("button",{type:"submit",className:"v10-mlv-run-btn",disabled:S,children:S?"Saving...":"Save query"})]})]}),$&&o.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-success)"},children:$}),E&&o.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-danger)"},children:E}),o.jsxs("div",{className:"v10-cg-query-results",children:[I&&o.jsx(cn,{compact:!0,tone:"query",icon:"?",title:"Loading query results..."}),F&&o.jsx(cn,{compact:!0,tone:"danger",icon:"!",title:"Query could not run.",description:jI(F)}),!I&&!F&&z.length===0&&o.jsx(cn,{compact:!0,tone:"query",icon:"?",title:"No results for this query.",description:"Adjust the query or run a saved query against this Context Graph."}),!I&&!F&&z.length>0&&o.jsxs("div",{className:"v10-mlv-table-wrap",children:[o.jsxs("div",{className:"v10-mlv-result-count",children:[z.length," result",z.length===1?"":"s"]}),o.jsxs("table",{className:"v10-mlv-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:V.map(G=>o.jsx("th",{children:G},G))})}),o.jsx("tbody",{children:z.map((G,M)=>o.jsx("tr",{children:V.map(ee=>{const ce=yI(G[ee]);return o.jsx("td",{className:"v10-mlv-cell",title:ce,children:bI(ce)},ee)})},M))})]})]})]})]})]})}const Zj="http://dkg.io/ontology/",NI="http://www.w3.org/ns/prov#";function Kj(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 qh(e){const t=Kj(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1]:t}function EI(e){const t=Kj(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function AI(e,t){return`PREFIX dkg: <${Zj}>
|
|
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 TI(e,t){return`PREFIX dkg: <${Zj}>
|
|
1317
|
+
PREFIX prov: <${NI}>
|
|
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 Gh={ual:null,opId:null,owner:null,publishedAt:null,publisherPeerId:null,loading:!1};function RI(e,t,n=!0){const[r,s]=w.useState(()=>({...Gh})),l=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){s({...Gh});return}const c=++l.current;s(d=>({...d,loading:!0,error:void 0})),(async()=>{var d,f;try{const[h,g]=await Promise.all([ua(AI(e,t),e).catch(()=>null),ua(TI(e,t),e).catch(()=>null)]);if(c!==l.current)return;const m=(((d=h==null?void 0:h.result)==null?void 0:d.bindings)??[])[0],v=(((f=g==null?void 0:g.result)==null?void 0:f.bindings)??[])[0],b=v?EI(v.op):null,k=v?qh(v.publishedAt):null,j=v!=null&&v.agent?qh(v.agent):null,C=m?qh(m.owner):null;s({ual:b,opId:b?b.slice(b.lastIndexOf(":")+1):null,owner:C,publishedAt:k||null,publisherPeerId:j,loading:!1})}catch(h){if(c!==l.current)return;s({...Gh,loading:!1,error:(h==null?void 0:h.message)??String(h)})}})()},[e,t,n]),r}function ew(e,t){if(!e)return null;for(const n of t.values())if(n.peerId&&n.peerId===e)return n.uri;return null}function eo(e,t=6,n=4){return e?e.length<=t+n+2?e:`${e.slice(0,t)}…${e.slice(-n)}`:""}const hv="http://dkg.io/ontology/",Zi={status:"idle",ual:null,txHash:null,blockNumber:null,kaId:null,author:null,finalizedAt:null,agent:null};function An(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 Mu(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function ji(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}function tw(e){return/[<>"{}|\\^`\s]/.test(e)?"":e}function _I(e,t){const n=`did:dkg:context-graph:${e}/_meta`,r=ji(t);return`PREFIX dkg: <${hv}>
|
|
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
|
+
":${ji(e)}",
|
|
1355
|
+
REPLACE(STRBEFORE(STRAFTER(STR(?asrt), "did:dkg:context-graph:${ji(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 OI(e){const t=e.match(/\/assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function MI(e,t){return`PREFIX dkg: <${hv}>
|
|
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:${ji(e)}/") &&
|
|
1377
|
+
CONTAINS(STR(?g), "_shared_memory_meta")
|
|
1378
|
+
)
|
|
1379
|
+
} ORDER BY DESC(?ts) LIMIT 1`}function LI(e,t,n,r){const s=`did:dkg:context-graph:${e}/_meta`,l=`/assertion/${n}/${r}`,c=ji(t);return`PREFIX dkg: <${hv}>
|
|
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), "${ji(l)}"))
|
|
1386
|
+
OPTIONAL { ?asrt dkg:assertionFinalizedAt ?finalizedAt . }
|
|
1387
|
+
OPTIONAL {
|
|
1388
|
+
?lc dkg:rootEntity <${t}> ;
|
|
1389
|
+
dkg:reservedUal ?ual .
|
|
1390
|
+
FILTER(STRENDS(STR(?lc), "${ji(`:${n}:${r}`)}"))
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
} ORDER BY DESC(STRSTARTS("${c}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function DI(e){const t=e.match(/^assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function II(e,t,n=!0){const[r,s]=w.useState(()=>({...Zi})),l=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){s({...Zi});return}const c=++l.current;s({...Zi,status:"loading"}),(async()=>{var d,f,h;try{const g=tw(t);if(!g){s({...Zi,status:"offchain"});return}const m=await ua(_I(e,g),e);if(c!==l.current)return;const v=(((d=m==null?void 0:m.result)==null?void 0:d.bindings)??[])[0];if(v!=null&&v.tx){const _=v.asrt?Mu(An(v.asrt)):"",I=OI(_),F=(I==null?void 0:I.addr)??null,z=(v.agentSelf?Mu(An(v.agentSelf)):"")||(v.agentLc?Mu(An(v.agentLc)):"")||(F?`did:dkg:agent:${F.toLowerCase()}`:null),q=(v.ualSelf?An(v.ualSelf):"")||(v.ual?An(v.ual):""),V=(v.kaId?An(v.kaId):"")||(v.batchId?An(v.batchId):"");s({status:"verified",ual:q||null,txHash:An(v.tx)||null,blockNumber:v.block?An(v.block):null,kaId:V||null,author:F,finalizedAt:v.finalizedAt?An(v.finalizedAt):null,agent:z});return}const b=await ua(MI(e,g));if(c!==l.current)return;const k=(((f=b==null?void 0:b.result)==null?void 0:f.bindings)??[])[0];if(!k){s({...Zi,status:"offchain"});return}const j=An(k.source),C=DI(j),S=k.agent?Mu(An(k.agent)):null,N=(C==null?void 0:C.addr)??null;if(!C||!tw(C.addr)||!ji(C.name)){s({...Zi,status:"offchain",author:N,agent:S});return}const E=await ua(LI(e,g,C.addr,C.name),e);if(c!==l.current)return;const T=(((h=E==null?void 0:E.result)==null?void 0:h.bindings)??[])[0],$=T!=null&&T.ual?An(T.ual):null,R=T!=null&&T.tx?An(T.tx):null,L=T!=null&&T.block?An(T.block):null,B=T!=null&&T.kaId?An(T.kaId):null,O=T!=null&&T.finalizedAt?An(T.finalizedAt):null;s({status:R?"verified":"offchain",ual:$||null,txHash:R||null,blockNumber:L||null,kaId:B||null,author:N,finalizedAt:O||null,agent:S})}catch(g){if(c!==l.current)return;s({...Zi,status:"error",error:(g==null?void 0:g.message)??String(g)})}})()},[e,t,n]),r}const zI=({contextGraphId:e,entityUri:t,enabled:n})=>{const r=ds(),s=RI(e,t,n),l=II(e,t,n),{data:c}=da(Dg,[],6e4),d=c==null?void 0:c.blockExplorerUrl,f=l.ual??s.ual,h=l.status==="verified";if(!n||s.loading||!s.ual&&!s.owner&&!s.publishedAt&&!h)return null;const g=s.publishedAt?$I(s.publishedAt):null,m=s.publisherPeerId&&r?ew(s.publisherPeerId,r.agents):null,v=m?(r==null?void 0:r.get(m))??null:null,b=s.owner&&r?ew(s.owner,r.agents):null,k=b?(r==null?void 0:r.get(b))??null:null,j=C=>{var S;(S=navigator.clipboard)==null||S.writeText(C).catch(()=>{})};return o.jsxs("div",{className:"v10-vm-identity",children:[o.jsxs("div",{className:"v10-vm-identity-head",children:[o.jsx("span",{className:"v10-vm-identity-glyph",children:"◉"}),o.jsx("span",{className:"v10-vm-identity-title",children:"On-chain identity"}),o.jsx("span",{className:"v10-vm-identity-badge",children:"VERIFIED"})]}),f&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"UAL"}),o.jsx("span",{className:"v10-vm-identity-val mono",title:f,children:f}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(f),title:"Copy UAL",children:"⎘"})]}),h&&l.txHash&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"Tx"}),d?o.jsxs("a",{className:"v10-vm-identity-val mono",href:`${d}/tx/${l.txHash}`,target:"_blank",rel:"noopener noreferrer",title:l.txHash,children:[eo(l.txHash,10,8)," ↗"]}):o.jsx("span",{className:"v10-vm-identity-val mono",title:l.txHash,children:eo(l.txHash,10,8)}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(l.txHash),title:"Copy transaction hash",children:"⎘"}),l.blockNumber&&o.jsxs("span",{className:"v10-vm-identity-opid mono",children:["· block ",l.blockNumber]})]}),h&&l.kaId&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"KA id"}),o.jsx("span",{className:"v10-vm-identity-val mono",title:l.kaId,children:eo(l.kaId,8,8)}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(l.kaId),title:"Copy KA id",children:"⎘"})]}),(k||s.owner)&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"Owner"}),k?o.jsxs("span",{className:"v10-vm-identity-val",children:[o.jsx(as,{agent:k,size:"sm"}),k.walletAddress&&o.jsx("span",{className:"v10-vm-identity-wallet mono",title:k.walletAddress,children:eo(k.walletAddress,6,4)})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-vm-identity-val mono",title:s.owner??"",children:eo(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)]})]}),(v||s.publisherPeerId)&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"By"}),v?o.jsx(as,{agent:v,size:"sm"}):o.jsx("span",{className:"v10-vm-identity-val mono",title:s.publisherPeerId??"",children:eo(s.publisherPeerId,8,6)})]})]})};function $I(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 c.prototype)g in d||Object.defineProperty(d,g,{value:c.prototype[g].bind(d)});d._zod.constr=c,d._zod.def=f}const s=(n==null?void 0:n.Parent)??Object;class l extends s{}Object.defineProperty(l,"name",{value:e});function c(d){var f;const h=n!=null&&n.Parent?new l:this;r(h,d),(f=h._zod).deferred??(f.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(c,"init",{value:r}),Object.defineProperty(c,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(c,"name",{value:e}),c}class Wl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Yj={};function rs(e){return Yj}function Qj(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 PI(e,t){return typeof t=="bigint"?t.toString():t}function Xj(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function mv(e){return e==null}function gv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function UI(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,l=Number.parseInt(e.toFixed(s).replace(".","")),c=Number.parseInt(t.toFixed(s).replace(".",""));return l%c/10**s}function Bt(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 vv(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Cl(e){return JSON.stringify(e)}const Jj=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Wm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const BI=Xj(()=>{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 Zm(e){if(Wm(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Wm(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const FI=new Set(["string","number","symbol"]);function Yd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ps(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 HI(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const qI={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 GI(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 ps(e,{...e._zod.def,shape:n,checks:[]})}function VI(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 ps(e,{...e._zod.def,shape:n,checks:[]})}function WI(e,t){if(!Zm(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 vv(this,"shape",r),r},checks:[]};return ps(e,n)}function ZI(e,t){return ps(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return vv(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function KI(e,t,n){const r=t._zod.def.shape,s={...r};if(n)for(const l in n){if(!(l in r))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(s[l]=e?new e({type:"optional",innerType:r[l]}):r[l])}else for(const l in r)s[l]=e?new e({type:"optional",innerType:r[l]}):r[l];return ps(t,{...t._zod.def,shape:s,checks:[]})}function YI(e,t,n){const r=t._zod.def.shape,s={...r};if(n)for(const l in n){if(!(l in s))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(s[l]=new e({type:"nonoptional",innerType:r[l]}))}else for(const l in r)s[l]=new e({type:"nonoptional",innerType:r[l]});return ps(t,{...t._zod.def,shape:s,checks:[]})}function $l(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 yv(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Lu(e){return typeof e=="string"?e:e==null?void 0:e.message}function is(e,t,n){var s,l,c,d,f,h;const r={...e,path:e.path??[]};if(!e.message){const g=Lu((c=(l=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:l.error)==null?void 0:c.call(l,e))??Lu((d=t==null?void 0:t.error)==null?void 0:d.call(t,e))??Lu((f=n.customError)==null?void 0:f.call(n,e))??Lu((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 bv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Zl(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const eC=(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,PI,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tC=ve("$ZodError",eC),nC=ve("$ZodError",eC,{Parent:Error});function QI(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 XI(e,t){const n=t||function(l){return l.message},r={_errors:[]},s=l=>{for(const c of l.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(d=>s({issues:d}));else if(c.code==="invalid_key")s({issues:c.issues});else if(c.code==="invalid_element")s({issues:c.issues});else if(c.path.length===0)r._errors.push(n(c));else{let d=r,f=0;for(;f<c.path.length;){const h=c.path[f];f===c.path.length-1?(d[h]=d[h]||{_errors:[]},d[h]._errors.push(n(c))):d[h]=d[h]||{_errors:[]},d=d[h],f++}}};return s(e),r}const JI=e=>(t,n,r,s)=>{const l=r?Object.assign(r,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},l);if(c instanceof Promise)throw new Wl;if(c.issues.length){const d=new((s==null?void 0:s.Err)??e)(c.issues.map(f=>is(f,l,rs())));throw Jj(d,s==null?void 0:s.callee),d}return c.value},ez=e=>async(t,n,r,s)=>{const l=r?Object.assign(r,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},l);if(c instanceof Promise&&(c=await c),c.issues.length){const d=new((s==null?void 0:s.Err)??e)(c.issues.map(f=>is(f,l,rs())));throw Jj(d,s==null?void 0:s.callee),d}return c.value},aC=e=>(t,n,r)=>{const s=r?{...r,async:!1}:{async:!1},l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new Wl;return l.issues.length?{success:!1,error:new(e??tC)(l.issues.map(c=>is(c,s,rs())))}:{success:!0,data:l.value}},tz=aC(nC),rC=e=>async(t,n,r)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},s);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(c=>is(c,s,rs())))}:{success:!0,data:l.value}},nz=rC(nC),az=/^[cC][^\s-]{8,}$/,rz=/^[0-9a-z]+$/,iz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,sz=/^[0-9a-vA-V]{20}$/,oz=/^[A-Za-z0-9]{27}$/,lz=/^[a-zA-Z0-9_-]{21}$/,cz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,uz=/^([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})$/,nw=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)$/,dz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,pz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function fz(){return new RegExp(pz,"u")}const hz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,mz=/^(([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})$/,gz=/^((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])$/,vz=/^(([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])$/,yz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,iC=/^[A-Za-z0-9_-]*$/,bz=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,xz=/^\+(?:[0-9]){6,14}[0-9]$/,sC="(?:(?:\\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])))",wz=new RegExp(`^${sC}$`);function oC(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function kz(e){return new RegExp(`^${oC(e)}$`)}function Sz(e){const t=oC({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(`^${sC}T(?:${r})$`)}const jz=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}$`)},Cz=/^\d+$/,Nz=/^-?\d+(?:\.\d+)?/i,Ez=/^[^A-Z]*$/,Az=/^[^a-z]*$/,Yn=ve("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),lC={number:"number",bigint:"bigint",object:"date"},cC=ve("$ZodCheckLessThan",(e,t)=>{Yn.init(e,t);const n=lC[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,l=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<l&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),uC=ve("$ZodCheckGreaterThan",(e,t)=>{Yn.init(e,t);const n=lC[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,l=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Tz=ve("$ZodCheckMultipleOf",(e,t)=>{Yn.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):UI(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})}}),Rz=ve("$ZodCheckNumberFormat",(e,t)=>{var c;Yn.init(e,t),t.format=t.format||"float64";const n=(c=t.format)==null?void 0:c.includes("int"),r=n?"int":"number",[s,l]=qI[t.format];e._zod.onattach.push(d=>{const f=d._zod.bag;f.format=t.format,f.minimum=s,f.maximum=l,n&&(f.pattern=Cz)}),e._zod.check=d=>{const f=d.value;if(n){if(!Number.isInteger(f)){d.issues.push({expected:r,format:t.format,code:"invalid_type",input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?d.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):d.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}f<s&&d.issues.push({origin:"number",input:f,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),f>l&&d.issues.push({origin:"number",input:f,code:"too_big",maximum:l,inst:e})}}),_z=ve("$ZodCheckMaxLength",(e,t)=>{var n;Yn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!mv(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 c=bv(s);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Oz=ve("$ZodCheckMinLength",(e,t)=>{var n;Yn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!mv(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 c=bv(s);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Mz=ve("$ZodCheckLengthEquals",(e,t)=>{var n;Yn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!mv(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=r=>{const s=r.value,l=s.length;if(l===t.length)return;const c=bv(s),d=l>t.length;r.issues.push({origin:c,...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})}}),Qd=ve("$ZodCheckStringFormat",(e,t)=>{var n,r;Yn.init(e,t),e._zod.onattach.push(s=>{const l=s._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Lz=ve("$ZodCheckRegex",(e,t)=>{Qd.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})}}),Dz=ve("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ez),Qd.init(e,t)}),Iz=ve("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Az),Qd.init(e,t)}),zz=ve("$ZodCheckIncludes",(e,t)=>{Yn.init(e,t);const n=Yd(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(s=>{const l=s._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(r)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),$z=ve("$ZodCheckStartsWith",(e,t)=>{Yn.init(e,t);const n=new RegExp(`^${Yd(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})}}),Pz=ve("$ZodCheckEndsWith",(e,t)=>{Yn.init(e,t);const n=new RegExp(`.*${Yd(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})}}),Uz=ve("$ZodCheckOverwrite",(e,t)=>{Yn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Bz{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(c=>c),s=Math.min(...r.map(c=>c.length-c.trimStart().length)),l=r.map(c=>c.slice(s)).map(c=>" ".repeat(this.indent*2)+c);for(const c of l)this.content.push(c)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(l=>` ${l}`)];return new t(...n,s.join(`
|
|
1395
|
+
`))}}const Fz={major:4,minor:0,patch:0},nn=ve("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fz;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const l of r)for(const c of l._zod.onattach)c(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const l=(c,d,f)=>{let h=$l(c),g;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(c))continue}else if(h)continue;const v=c.issues.length,b=m._zod.check(c);if(b instanceof Promise&&(f==null?void 0:f.async)===!1)throw new Wl;if(g||b instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await b,c.issues.length!==v&&(h||(h=$l(c,v)))});else{if(c.issues.length===v)continue;h||(h=$l(c,v))}}return g?g.then(()=>c):c};e._zod.run=(c,d)=>{const f=e._zod.parse(c,d);if(f instanceof Promise){if(d.async===!1)throw new Wl;return f.then(h=>l(h,r,d))}return l(f,r,d)}}e["~standard"]={validate:l=>{var c;try{const d=tz(e,l);return d.success?{value:d.data}:{issues:(c=d.error)==null?void 0:c.issues}}catch{return nz(e,l).then(f=>{var h;return f.success?{value:f.data}:{issues:(h=f.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}}),xv=ve("$ZodString",(e,t)=>{var n;nn.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??jz(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}}),qt=ve("$ZodStringFormat",(e,t)=>{Qd.init(e,t),xv.init(e,t)}),Hz=ve("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=uz),qt.init(e,t)}),qz=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=nw(r))}else t.pattern??(t.pattern=nw());qt.init(e,t)}),Gz=ve("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=dz),qt.init(e,t)}),Vz=ve("$ZodURL",(e,t)=>{qt.init(e,t),e._zod.check=n=>{try{const r=n.value,s=new URL(r),l=s.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:bz.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith("/")&&l.endsWith("/")?n.value=l.slice(0,-1):n.value=l;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Wz=ve("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=fz()),qt.init(e,t)}),Zz=ve("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=lz),qt.init(e,t)}),Kz=ve("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=az),qt.init(e,t)}),Yz=ve("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=rz),qt.init(e,t)}),Qz=ve("$ZodULID",(e,t)=>{t.pattern??(t.pattern=iz),qt.init(e,t)}),Xz=ve("$ZodXID",(e,t)=>{t.pattern??(t.pattern=sz),qt.init(e,t)}),Jz=ve("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=oz),qt.init(e,t)}),e3=ve("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Sz(t)),qt.init(e,t)}),t3=ve("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=wz),qt.init(e,t)}),n3=ve("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=kz(t)),qt.init(e,t)}),a3=ve("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cz),qt.init(e,t)}),r3=ve("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=hz),qt.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),i3=ve("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=mz),qt.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})}}}),s3=ve("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=gz),qt.init(e,t)}),o3=ve("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=vz),qt.init(e,t),e._zod.check=n=>{const[r,s]=n.value.split("/");try{if(!s)throw new Error;const l=Number(s);if(`${l}`!==s)throw new Error;if(l<0||l>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function dC(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const l3=ve("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=yz),qt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{dC(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function c3(e){if(!iC.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return dC(n)}const u3=ve("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=iC),qt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{c3(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),d3=ve("$ZodE164",(e,t)=>{t.pattern??(t.pattern=xz),qt.init(e,t)});function p3(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 f3=ve("$ZodJWT",(e,t)=>{qt.init(e,t),e._zod.check=n=>{p3(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),pC=ve("$ZodNumber",(e,t)=>{nn.init(e,t),e._zod.pattern=e._zod.bag.pattern??Nz,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const l=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...l?{received:l}:{}}),n}}),h3=ve("$ZodNumber",(e,t)=>{Rz.init(e,t),pC.init(e,t)}),m3=ve("$ZodUnknown",(e,t)=>{nn.init(e,t),e._zod.parse=n=>n}),g3=ve("$ZodNever",(e,t)=>{nn.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function aw(e,t,n){e.issues.length&&t.issues.push(...yv(n,e.issues)),t.value[n]=e.value}const v3=ve("$ZodArray",(e,t)=>{nn.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const l=[];for(let c=0;c<s.length;c++){const d=s[c],f=t.element._zod.run({value:d,issues:[]},r);f instanceof Promise?l.push(f.then(h=>aw(h,n,c))):aw(f,n,c)}return l.length?Promise.all(l).then(()=>n):n}});function Du(e,t,n){e.issues.length&&t.issues.push(...yv(n,e.issues)),t.value[n]=e.value}function rw(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(...yv(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const y3=ve("$ZodObject",(e,t)=>{nn.init(e,t);const n=Xj(()=>{const m=Object.keys(t.shape);for(const b of m)if(!(t.shape[b]instanceof nn))throw new Error(`Invalid element at key "${b}": expected a Zod schema`);const v=HI(t.shape);return{shape:t.shape,keys:m,keySet:new Set(m),numKeys:m.length,optionalKeys:new Set(v)}});Bt(e._zod,"propValues",()=>{const m=t.shape,v={};for(const b in m){const k=m[b]._zod;if(k.values){v[b]??(v[b]=new Set);for(const j of k.values)v[b].add(j)}}return v});const r=m=>{const v=new Bz(["shape","payload","ctx"]),b=n.value,k=N=>{const E=Cl(N);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};v.write("const input = payload.value;");const j=Object.create(null);let C=0;for(const N of b.keys)j[N]=`key_${C++}`;v.write("const newResult = {}");for(const N of b.keys)if(b.optionalKeys.has(N)){const E=j[N];v.write(`const ${E} = ${k(N)};`);const T=Cl(N);v.write(`
|
|
1396
|
+
if (${E}.issues.length) {
|
|
1397
|
+
if (input[${T}] === undefined) {
|
|
1398
|
+
if (${T} in input) {
|
|
1399
|
+
newResult[${T}] = undefined;
|
|
1400
|
+
}
|
|
1401
|
+
} else {
|
|
1402
|
+
payload.issues = payload.issues.concat(
|
|
1403
|
+
${E}.issues.map((iss) => ({
|
|
1404
|
+
...iss,
|
|
1405
|
+
path: iss.path ? [${T}, ...iss.path] : [${T}],
|
|
1406
|
+
}))
|
|
1407
|
+
);
|
|
1408
|
+
}
|
|
1409
|
+
} else if (${E}.value === undefined) {
|
|
1410
|
+
if (${T} in input) newResult[${T}] = undefined;
|
|
1411
|
+
} else {
|
|
1412
|
+
newResult[${T}] = ${E}.value;
|
|
1413
|
+
}
|
|
1414
|
+
`)}else{const E=j[N];v.write(`const ${E} = ${k(N)};`),v.write(`
|
|
1415
|
+
if (${E}.issues.length) payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
|
|
1416
|
+
...iss,
|
|
1417
|
+
path: iss.path ? [${Cl(N)}, ...iss.path] : [${Cl(N)}]
|
|
1418
|
+
})));`),v.write(`newResult[${Cl(N)}] = ${E}.value`)}v.write("payload.value = newResult;"),v.write("return payload;");const S=v.compile();return(N,E)=>S(m,N,E)};let s;const l=Wm,c=!Yj.jitless,f=c&&BI.value,h=t.catchall;let g;e._zod.parse=(m,v)=>{g??(g=n.value);const b=m.value;if(!l(b))return m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m;const k=[];if(c&&f&&(v==null?void 0:v.async)===!1&&v.jitless!==!0)s||(s=r(t.shape)),m=s(m,v);else{m.value={};const E=g.shape;for(const T of g.keys){const $=E[T],R=$._zod.run({value:b[T],issues:[]},v),L=$._zod.optin==="optional"&&$._zod.optout==="optional";R instanceof Promise?k.push(R.then(B=>L?rw(B,m,T,b):Du(B,m,T))):L?rw(R,m,T,b):Du(R,m,T)}}if(!h)return k.length?Promise.all(k).then(()=>m):m;const j=[],C=g.keySet,S=h._zod,N=S.def.type;for(const E of Object.keys(b)){if(C.has(E))continue;if(N==="never"){j.push(E);continue}const T=S.run({value:b[E],issues:[]},v);T instanceof Promise?k.push(T.then($=>Du($,m,E))):Du(T,m,E)}return j.length&&m.issues.push({code:"unrecognized_keys",keys:j,input:b,inst:e}),k.length?Promise.all(k).then(()=>m):m}});function iw(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(l=>is(l,r,rs())))}),t}const b3=ve("$ZodUnion",(e,t)=>{nn.init(e,t),Bt(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Bt(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Bt(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Bt(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=>gv(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let s=!1;const l=[];for(const c of t.options){const d=c._zod.run({value:n.value,issues:[]},r);if(d instanceof Promise)l.push(d),s=!0;else{if(d.issues.length===0)return d;l.push(d)}}return s?Promise.all(l).then(c=>iw(c,n,e,r)):iw(l,n,e,r)}}),x3=ve("$ZodIntersection",(e,t)=>{nn.init(e,t),e._zod.parse=(n,r)=>{const s=n.value,l=t.left._zod.run({value:s,issues:[]},r),c=t.right._zod.run({value:s,issues:[]},r);return l instanceof Promise||c instanceof Promise?Promise.all([l,c]).then(([f,h])=>sw(n,f,h)):sw(n,l,c)}});function Km(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(Zm(e)&&Zm(t)){const n=Object.keys(t),r=Object.keys(e).filter(l=>n.indexOf(l)!==-1),s={...e,...t};for(const l of r){const c=Km(e[l],t[l]);if(!c.valid)return{valid:!1,mergeErrorPath:[l,...c.mergeErrorPath]};s[l]=c.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const s=e[r],l=t[r],c=Km(s,l);if(!c.valid)return{valid:!1,mergeErrorPath:[r,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function sw(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),$l(e))return e;const r=Km(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 w3=ve("$ZodEnum",(e,t)=>{nn.init(e,t);const n=Qj(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>FI.has(typeof r)).map(r=>typeof r=="string"?Yd(r):r.toString()).join("|")})$`),e._zod.parse=(r,s)=>{const l=r.value;return e._zod.values.has(l)||r.issues.push({code:"invalid_value",values:n,input:l,inst:e}),r}}),k3=ve("$ZodTransform",(e,t)=>{nn.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(c=>(n.value=c,n));if(s instanceof Promise)throw new Wl;return n.value=s,n}}),S3=ve("$ZodOptional",(e,t)=>{nn.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Bt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Bt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${gv(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)}),j3=ve("$ZodNullable",(e,t)=>{nn.init(e,t),Bt(e._zod,"optin",()=>t.innerType._zod.optin),Bt(e._zod,"optout",()=>t.innerType._zod.optout),Bt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${gv(n.source)}|null)$`):void 0}),Bt(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)}),C3=ve("$ZodDefault",(e,t)=>{nn.init(e,t),e._zod.optin="optional",Bt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(l=>ow(l,t)):ow(s,t)}});function ow(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const N3=ve("$ZodPrefault",(e,t)=>{nn.init(e,t),e._zod.optin="optional",Bt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),E3=ve("$ZodNonOptional",(e,t)=>{nn.init(e,t),Bt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(l=>lw(l,e)):lw(s,e)}});function lw(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 A3=ve("$ZodCatch",(e,t)=>{nn.init(e,t),e._zod.optin="optional",Bt(e._zod,"optout",()=>t.innerType._zod.optout),Bt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(l=>(n.value=l.value,l.issues.length&&(n.value=t.catchValue({...n,error:{issues:l.issues.map(c=>is(c,r,rs()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(l=>is(l,r,rs()))},input:n.value}),n.issues=[]),n)}}),T3=ve("$ZodPipe",(e,t)=>{nn.init(e,t),Bt(e._zod,"values",()=>t.in._zod.values),Bt(e._zod,"optin",()=>t.in._zod.optin),Bt(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const s=t.in._zod.run(n,r);return s instanceof Promise?s.then(l=>cw(l,t,r)):cw(s,t,r)}});function cw(e,t,n){return $l(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const R3=ve("$ZodReadonly",(e,t)=>{nn.init(e,t),Bt(e._zod,"propValues",()=>t.innerType._zod.propValues),Bt(e._zod,"values",()=>t.innerType._zod.values),Bt(e._zod,"optin",()=>t.innerType._zod.optin),Bt(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(uw):uw(s)}});function uw(e){return e.value=Object.freeze(e.value),e}const _3=ve("$ZodCustom",(e,t)=>{Yn.init(e,t),nn.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,s=t.fn(r);if(s instanceof Promise)return s.then(l=>dw(l,n,r,e));dw(s,n,r,e)}});function dw(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(Zl(s))}}class fC{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 hC(){return new fC}const Dl=hC();function O3(e,t){return new e({type:"string",...Ue(t)})}function M3(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ue(t)})}function pw(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ue(t)})}function L3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ue(t)})}function D3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ue(t)})}function I3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ue(t)})}function z3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ue(t)})}function $3(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ue(t)})}function P3(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ue(t)})}function U3(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ue(t)})}function B3(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ue(t)})}function F3(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ue(t)})}function H3(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ue(t)})}function q3(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ue(t)})}function G3(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ue(t)})}function V3(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ue(t)})}function W3(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ue(t)})}function Z3(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ue(t)})}function K3(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ue(t)})}function Y3(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ue(t)})}function Q3(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ue(t)})}function X3(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ue(t)})}function J3(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ue(t)})}function e$(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ue(t)})}function t$(e,t){return new e({type:"string",format:"date",check:"string_format",...Ue(t)})}function n$(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ue(t)})}function a$(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ue(t)})}function r$(e,t){return new e({type:"number",checks:[],...Ue(t)})}function i$(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ue(t)})}function s$(e){return new e({type:"unknown"})}function o$(e,t){return new e({type:"never",...Ue(t)})}function fw(e,t){return new cC({check:"less_than",...Ue(t),value:e,inclusive:!1})}function Vh(e,t){return new cC({check:"less_than",...Ue(t),value:e,inclusive:!0})}function hw(e,t){return new uC({check:"greater_than",...Ue(t),value:e,inclusive:!1})}function Wh(e,t){return new uC({check:"greater_than",...Ue(t),value:e,inclusive:!0})}function mw(e,t){return new Tz({check:"multiple_of",...Ue(t),value:e})}function mC(e,t){return new _z({check:"max_length",...Ue(t),maximum:e})}function Sd(e,t){return new Oz({check:"min_length",...Ue(t),minimum:e})}function gC(e,t){return new Mz({check:"length_equals",...Ue(t),length:e})}function l$(e,t){return new Lz({check:"string_format",format:"regex",...Ue(t),pattern:e})}function c$(e){return new Dz({check:"string_format",format:"lowercase",...Ue(e)})}function u$(e){return new Iz({check:"string_format",format:"uppercase",...Ue(e)})}function d$(e,t){return new zz({check:"string_format",format:"includes",...Ue(t),includes:e})}function p$(e,t){return new $z({check:"string_format",format:"starts_with",...Ue(t),prefix:e})}function f$(e,t){return new Pz({check:"string_format",format:"ends_with",...Ue(t),suffix:e})}function sc(e){return new Uz({check:"overwrite",tx:e})}function h$(e){return sc(t=>t.normalize(e))}function m$(){return sc(e=>e.trim())}function g$(){return sc(e=>e.toLowerCase())}function v$(){return sc(e=>e.toUpperCase())}function y$(e,t,n){return new e({type:"array",element:t,...Ue(n)})}function b$(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ue(n)})}class gw{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??Dl,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,v,b;var r;const s=t._zod.def,l={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},c=this.seen.get(t);if(c)return c.count++,n.schemaPath.includes(t)&&(c.cycle=n.path),c.schema;const d={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,d);const f=(v=(m=t._zod).toJSONSchema)==null?void 0:v.call(m);if(f)d.schema=f;else{const k={...n,schemaPath:[...n.schemaPath,t],path:n.path},j=t._zod.parent;if(j)d.ref=j,this.process(j,k),this.seen.get(j).isParent=!0;else{const C=d.schema;switch(s.type){case"string":{const S=C;S.type="string";const{minimum:N,maximum:E,format:T,patterns:$,contentEncoding:R}=t._zod.bag;if(typeof N=="number"&&(S.minLength=N),typeof E=="number"&&(S.maxLength=E),T&&(S.format=l[T]??T,S.format===""&&delete S.format),R&&(S.contentEncoding=R),$&&$.size>0){const L=[...$];L.length===1?S.pattern=L[0].source:L.length>1&&(d.schema.allOf=[...L.map(B=>({...this.target==="draft-7"?{type:"string"}:{},pattern:B.source}))])}break}case"number":{const S=C,{minimum:N,maximum:E,format:T,multipleOf:$,exclusiveMaximum:R,exclusiveMinimum:L}=t._zod.bag;typeof T=="string"&&T.includes("int")?S.type="integer":S.type="number",typeof L=="number"&&(S.exclusiveMinimum=L),typeof N=="number"&&(S.minimum=N,typeof L=="number"&&(L>=N?delete S.minimum:delete S.exclusiveMinimum)),typeof R=="number"&&(S.exclusiveMaximum=R),typeof E=="number"&&(S.maximum=E,typeof R=="number"&&(R<=E?delete S.maximum:delete S.exclusiveMaximum)),typeof $=="number"&&(S.multipleOf=$);break}case"boolean":{const S=C;S.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{C.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{C.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const S=C,{minimum:N,maximum:E}=t._zod.bag;typeof N=="number"&&(S.minItems=N),typeof E=="number"&&(S.maxItems=E),S.type="array",S.items=this.process(s.element,{...k,path:[...k.path,"items"]});break}case"object":{const S=C;S.type="object",S.properties={};const N=s.shape;for(const $ in N)S.properties[$]=this.process(N[$],{...k,path:[...k.path,"properties",$]});const E=new Set(Object.keys(N)),T=new Set([...E].filter($=>{const R=s.shape[$]._zod;return this.io==="input"?R.optin===void 0:R.optout===void 0}));T.size>0&&(S.required=Array.from(T)),((b=s.catchall)==null?void 0:b._zod.def.type)==="never"?S.additionalProperties=!1:s.catchall?s.catchall&&(S.additionalProperties=this.process(s.catchall,{...k,path:[...k.path,"additionalProperties"]})):this.io==="output"&&(S.additionalProperties=!1);break}case"union":{const S=C;S.anyOf=s.options.map((N,E)=>this.process(N,{...k,path:[...k.path,"anyOf",E]}));break}case"intersection":{const S=C,N=this.process(s.left,{...k,path:[...k.path,"allOf",0]}),E=this.process(s.right,{...k,path:[...k.path,"allOf",1]}),T=R=>"allOf"in R&&Object.keys(R).length===1,$=[...T(N)?N.allOf:[N],...T(E)?E.allOf:[E]];S.allOf=$;break}case"tuple":{const S=C;S.type="array";const N=s.items.map(($,R)=>this.process($,{...k,path:[...k.path,"prefixItems",R]}));if(this.target==="draft-2020-12"?S.prefixItems=N:S.items=N,s.rest){const $=this.process(s.rest,{...k,path:[...k.path,"items"]});this.target==="draft-2020-12"?S.items=$:S.additionalItems=$}s.rest&&(S.items=this.process(s.rest,{...k,path:[...k.path,"items"]}));const{minimum:E,maximum:T}=t._zod.bag;typeof E=="number"&&(S.minItems=E),typeof T=="number"&&(S.maxItems=T);break}case"record":{const S=C;S.type="object",S.propertyNames=this.process(s.keyType,{...k,path:[...k.path,"propertyNames"]}),S.additionalProperties=this.process(s.valueType,{...k,path:[...k.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const S=C,N=Qj(s.entries);N.every(E=>typeof E=="number")&&(S.type="number"),N.every(E=>typeof E=="string")&&(S.type="string"),S.enum=N;break}case"literal":{const S=C,N=[];for(const E of s.values)if(E===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof E=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");N.push(Number(E))}else N.push(E);if(N.length!==0)if(N.length===1){const E=N[0];S.type=E===null?"null":typeof E,S.const=E}else N.every(E=>typeof E=="number")&&(S.type="number"),N.every(E=>typeof E=="string")&&(S.type="string"),N.every(E=>typeof E=="boolean")&&(S.type="string"),N.every(E=>E===null)&&(S.type="null"),S.enum=N;break}case"file":{const S=C,N={type:"string",format:"binary",contentEncoding:"binary"},{minimum:E,maximum:T,mime:$}=t._zod.bag;E!==void 0&&(N.minLength=E),T!==void 0&&(N.maxLength=T),$?$.length===1?(N.contentMediaType=$[0],Object.assign(S,N)):S.anyOf=$.map(R=>({...N,contentMediaType:R})):Object.assign(S,N);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const S=this.process(s.innerType,k);C.anyOf=[S,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,k),d.ref=s.innerType;break}case"success":{const S=C;S.type="boolean";break}case"default":{this.process(s.innerType,k),d.ref=s.innerType,C.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,k),d.ref=s.innerType,this.io==="input"&&(C._prefault=JSON.parse(JSON.stringify(s.defaultValue)));break}case"catch":{this.process(s.innerType,k),d.ref=s.innerType;let S;try{S=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}C.default=S;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const S=C,N=t._zod.pattern;if(!N)throw new Error("Pattern not found in template literal");S.type="string",S.pattern=N.source;break}case"pipe":{const S=this.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;this.process(S,k),d.ref=S;break}case"readonly":{this.process(s.innerType,k),d.ref=s.innerType,C.readOnly=!0;break}case"promise":{this.process(s.innerType,k),d.ref=s.innerType;break}case"optional":{this.process(s.innerType,k),d.ref=s.innerType;break}case"lazy":{const S=t._zod.innerType;this.process(S,k),d.ref=S;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const h=this.metadataRegistry.get(t);return h&&Object.assign(d.schema,h),this.io==="input"&&fn(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,v,b,k,j;const r={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},s=this.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=C=>{var $;const S=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const R=($=r.external.registry.get(C[0]))==null?void 0:$.id,L=r.external.uri??(O=>O);if(R)return{ref:L(R)};const B=C[1].defId??C[1].schema.id??`schema${this.counter++}`;return C[1].defId=B,{defId:B,ref:`${L("__shared")}#/${S}/${B}`}}if(C[1]===s)return{ref:"#"};const E=`#/${S}/`,T=C[1].schema.id??`__schema${this.counter++}`;return{defId:T,ref:E+T}},c=C=>{if(C[1].schema.$ref)return;const S=C[1],{ref:N,defId:E}=l(C);S.def={...S.schema},E&&(S.defId=E);const T=S.schema;for(const $ in T)delete T[$];T.$ref=N};if(r.cycles==="throw")for(const C of this.seen.entries()){const S=C[1];if(S.cycle)throw new Error(`Cycle detected: #/${(g=S.cycle)==null?void 0:g.join("/")}/<root>
|
|
1419
|
+
|
|
1420
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const C of this.seen.entries()){const S=C[1];if(t===C[0]){c(C);continue}if(r.external){const E=(m=r.external.registry.get(C[0]))==null?void 0:m.id;if(t!==C[0]&&E){c(C);continue}}if((v=this.metadataRegistry.get(C[0]))==null?void 0:v.id){c(C);continue}if(S.cycle){c(C);continue}if(S.count>1&&r.reused==="ref"){c(C);continue}}const d=(C,S)=>{const N=this.seen.get(C),E=N.def??N.schema,T={...E};if(N.ref===null)return;const $=N.ref;if(N.ref=null,$){d($,S);const R=this.seen.get($).schema;R.$ref&&S.target==="draft-7"?(E.allOf=E.allOf??[],E.allOf.push(R)):(Object.assign(E,R),Object.assign(E,T))}N.isParent||this.override({zodSchema:C,jsonSchema:E,path:N.path??[]})};for(const C of[...this.seen.entries()].reverse())d(C[0],{target:this.target});const f={};if(this.target==="draft-2020-12"?f.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?f.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),(b=r.external)!=null&&b.uri){const C=(k=r.external.registry.get(t))==null?void 0:k.id;if(!C)throw new Error("Schema is missing an `id` property");f.$id=r.external.uri(C)}Object.assign(f,s.def);const h=((j=r.external)==null?void 0:j.defs)??{};for(const C of this.seen.entries()){const S=C[1];S.def&&S.defId&&(h[S.defId]=S.def)}r.external||Object.keys(h).length>0&&(this.target==="draft-2020-12"?f.$defs=h:f.definitions=h);try{return JSON.parse(JSON.stringify(f))}catch{throw new Error("Error converting schema to JSON.")}}}function x$(e,t){if(e instanceof fC){const r=new gw(t),s={};for(const d of e._idmap.entries()){const[f,h]=d;r.process(h)}const l={},c={registry:e,uri:t==null?void 0:t.uri,defs:s};for(const d of e._idmap.entries()){const[f,h]=d;l[f]=r.emit(h,{...t,external:c})}if(Object.keys(s).length>0){const d=r.target==="draft-2020-12"?"$defs":"definitions";l.__shared={[d]:s}}return{schemas:l}}const n=new gw(t);return n.process(e),n.emit(e,t)}function fn(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 fn(s.element,n);case"object":{for(const l in s.shape)if(fn(s.shape[l],n))return!0;return!1}case"union":{for(const l of s.options)if(fn(l,n))return!0;return!1}case"intersection":return fn(s.left,n)||fn(s.right,n);case"tuple":{for(const l of s.items)if(fn(l,n))return!0;return!!(s.rest&&fn(s.rest,n))}case"record":return fn(s.keyType,n)||fn(s.valueType,n);case"map":return fn(s.keyType,n)||fn(s.valueType,n);case"set":return fn(s.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return fn(s.innerType,n);case"lazy":return fn(s.getter(),n);case"default":return fn(s.innerType,n);case"prefault":return fn(s.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return fn(s.in,n)||fn(s.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${s.type}`)}const w$=ve("ZodISODateTime",(e,t)=>{e3.init(e,t),Wt.init(e,t)});function k$(e){return e$(w$,e)}const S$=ve("ZodISODate",(e,t)=>{t3.init(e,t),Wt.init(e,t)});function j$(e){return t$(S$,e)}const C$=ve("ZodISOTime",(e,t)=>{n3.init(e,t),Wt.init(e,t)});function N$(e){return n$(C$,e)}const E$=ve("ZodISODuration",(e,t)=>{a3.init(e,t),Wt.init(e,t)});function A$(e){return a$(E$,e)}const T$=(e,t)=>{tC.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>XI(e,n)},flatten:{value:n=>QI(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Xd=ve("ZodError",T$,{Parent:Error}),R$=JI(Xd),_$=ez(Xd),O$=aC(Xd),M$=rC(Xd),mn=ve("ZodType",(e,t)=>(nn.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)=>ps(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>R$(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>O$(e,n,r),e.parseAsync=async(n,r)=>_$(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>M$(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(k6(n,r)),e.superRefine=n=>e.check(S6(n)),e.overwrite=n=>e.check(sc(n)),e.optional=()=>xw(e),e.nullable=()=>ww(e),e.nullish=()=>xw(ww(e)),e.nonoptional=n=>h6(e,n),e.array=()=>zr(e),e.or=n=>wv([e,n]),e.and=n=>s6(e,n),e.transform=n=>kw(e,l6(n)),e.default=n=>d6(e,n),e.prefault=n=>f6(e,n),e.catch=n=>g6(e,n),e.pipe=n=>kw(e,n),e.readonly=()=>b6(e),e.describe=n=>{const r=e.clone();return Dl.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Dl.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Dl.get(e);const r=e.clone();return Dl.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),vC=ve("_ZodString",(e,t)=>{xv.init(e,t),mn.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(l$(...r)),e.includes=(...r)=>e.check(d$(...r)),e.startsWith=(...r)=>e.check(p$(...r)),e.endsWith=(...r)=>e.check(f$(...r)),e.min=(...r)=>e.check(Sd(...r)),e.max=(...r)=>e.check(mC(...r)),e.length=(...r)=>e.check(gC(...r)),e.nonempty=(...r)=>e.check(Sd(1,...r)),e.lowercase=r=>e.check(c$(r)),e.uppercase=r=>e.check(u$(r)),e.trim=()=>e.check(m$()),e.normalize=(...r)=>e.check(h$(...r)),e.toLowerCase=()=>e.check(g$()),e.toUpperCase=()=>e.check(v$())}),L$=ve("ZodString",(e,t)=>{xv.init(e,t),vC.init(e,t),e.email=n=>e.check(M3(D$,n)),e.url=n=>e.check($3(I$,n)),e.jwt=n=>e.check(J3(Q$,n)),e.emoji=n=>e.check(P3(z$,n)),e.guid=n=>e.check(pw(vw,n)),e.uuid=n=>e.check(L3(Iu,n)),e.uuidv4=n=>e.check(D3(Iu,n)),e.uuidv6=n=>e.check(I3(Iu,n)),e.uuidv7=n=>e.check(z3(Iu,n)),e.nanoid=n=>e.check(U3($$,n)),e.guid=n=>e.check(pw(vw,n)),e.cuid=n=>e.check(B3(P$,n)),e.cuid2=n=>e.check(F3(U$,n)),e.ulid=n=>e.check(H3(B$,n)),e.base64=n=>e.check(Y3(Z$,n)),e.base64url=n=>e.check(Q3(K$,n)),e.xid=n=>e.check(q3(F$,n)),e.ksuid=n=>e.check(G3(H$,n)),e.ipv4=n=>e.check(V3(q$,n)),e.ipv6=n=>e.check(W3(G$,n)),e.cidrv4=n=>e.check(Z3(V$,n)),e.cidrv6=n=>e.check(K3(W$,n)),e.e164=n=>e.check(X3(Y$,n)),e.datetime=n=>e.check(k$(n)),e.date=n=>e.check(j$(n)),e.time=n=>e.check(N$(n)),e.duration=n=>e.check(A$(n))});function $e(e){return O3(L$,e)}const Wt=ve("ZodStringFormat",(e,t)=>{qt.init(e,t),vC.init(e,t)}),D$=ve("ZodEmail",(e,t)=>{Gz.init(e,t),Wt.init(e,t)}),vw=ve("ZodGUID",(e,t)=>{Hz.init(e,t),Wt.init(e,t)}),Iu=ve("ZodUUID",(e,t)=>{qz.init(e,t),Wt.init(e,t)}),I$=ve("ZodURL",(e,t)=>{Vz.init(e,t),Wt.init(e,t)}),z$=ve("ZodEmoji",(e,t)=>{Wz.init(e,t),Wt.init(e,t)}),$$=ve("ZodNanoID",(e,t)=>{Zz.init(e,t),Wt.init(e,t)}),P$=ve("ZodCUID",(e,t)=>{Kz.init(e,t),Wt.init(e,t)}),U$=ve("ZodCUID2",(e,t)=>{Yz.init(e,t),Wt.init(e,t)}),B$=ve("ZodULID",(e,t)=>{Qz.init(e,t),Wt.init(e,t)}),F$=ve("ZodXID",(e,t)=>{Xz.init(e,t),Wt.init(e,t)}),H$=ve("ZodKSUID",(e,t)=>{Jz.init(e,t),Wt.init(e,t)}),q$=ve("ZodIPv4",(e,t)=>{r3.init(e,t),Wt.init(e,t)}),G$=ve("ZodIPv6",(e,t)=>{i3.init(e,t),Wt.init(e,t)}),V$=ve("ZodCIDRv4",(e,t)=>{s3.init(e,t),Wt.init(e,t)}),W$=ve("ZodCIDRv6",(e,t)=>{o3.init(e,t),Wt.init(e,t)}),Z$=ve("ZodBase64",(e,t)=>{l3.init(e,t),Wt.init(e,t)}),K$=ve("ZodBase64URL",(e,t)=>{u3.init(e,t),Wt.init(e,t)}),Y$=ve("ZodE164",(e,t)=>{d3.init(e,t),Wt.init(e,t)}),Q$=ve("ZodJWT",(e,t)=>{f3.init(e,t),Wt.init(e,t)}),yC=ve("ZodNumber",(e,t)=>{pC.init(e,t),mn.init(e,t),e.gt=(r,s)=>e.check(hw(r,s)),e.gte=(r,s)=>e.check(Wh(r,s)),e.min=(r,s)=>e.check(Wh(r,s)),e.lt=(r,s)=>e.check(fw(r,s)),e.lte=(r,s)=>e.check(Vh(r,s)),e.max=(r,s)=>e.check(Vh(r,s)),e.int=r=>e.check(yw(r)),e.safe=r=>e.check(yw(r)),e.positive=r=>e.check(hw(0,r)),e.nonnegative=r=>e.check(Wh(0,r)),e.negative=r=>e.check(fw(0,r)),e.nonpositive=r=>e.check(Vh(0,r)),e.multipleOf=(r,s)=>e.check(mw(r,s)),e.step=(r,s)=>e.check(mw(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 ir(e){return r$(yC,e)}const X$=ve("ZodNumberFormat",(e,t)=>{h3.init(e,t),yC.init(e,t)});function yw(e){return i$(X$,e)}const J$=ve("ZodUnknown",(e,t)=>{m3.init(e,t),mn.init(e,t)});function bw(){return s$(J$)}const e6=ve("ZodNever",(e,t)=>{g3.init(e,t),mn.init(e,t)});function t6(e){return o$(e6,e)}const n6=ve("ZodArray",(e,t)=>{v3.init(e,t),mn.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Sd(n,r)),e.nonempty=n=>e.check(Sd(1,n)),e.max=(n,r)=>e.check(mC(n,r)),e.length=(n,r)=>e.check(gC(n,r)),e.unwrap=()=>e.element});function zr(e,t){return y$(n6,e,t)}const a6=ve("ZodObject",(e,t)=>{y3.init(e,t),mn.init(e,t),Bt(e,"shape",()=>t.shape),e.keyof=()=>yo(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:bw()}),e.loose=()=>e.clone({...e._zod.def,catchall:bw()}),e.strict=()=>e.clone({...e._zod.def,catchall:t6()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>WI(e,n),e.merge=n=>ZI(e,n),e.pick=n=>GI(e,n),e.omit=n=>VI(e,n),e.partial=(...n)=>KI(bC,e,n[0]),e.required=(...n)=>YI(xC,e,n[0])});function Ut(e,t){const n={type:"object",get shape(){return vv(this,"shape",{...e}),this.shape},...Ue(t)};return new a6(n)}const r6=ve("ZodUnion",(e,t)=>{b3.init(e,t),mn.init(e,t),e.options=t.options});function wv(e,t){return new r6({type:"union",options:e,...Ue(t)})}const i6=ve("ZodIntersection",(e,t)=>{x3.init(e,t),mn.init(e,t)});function s6(e,t){return new i6({type:"intersection",left:e,right:t})}const Ym=ve("ZodEnum",(e,t)=>{w3.init(e,t),mn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,s)=>{const l={};for(const c of r)if(n.has(c))l[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new Ym({...t,checks:[],...Ue(s),entries:l})},e.exclude=(r,s)=>{const l={...t.entries};for(const c of r)if(n.has(c))delete l[c];else throw new Error(`Key ${c} not found in enum`);return new Ym({...t,checks:[],...Ue(s),entries:l})}});function yo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ym({type:"enum",entries:n,...Ue(t)})}const o6=ve("ZodTransform",(e,t)=>{k3.init(e,t),mn.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=l=>{if(typeof l=="string")n.issues.push(Zl(l,n.value,t));else{const c=l;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),c.continue??(c.continue=!0),n.issues.push(Zl(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(l=>(n.value=l,n)):(n.value=s,n)}});function l6(e){return new o6({type:"transform",transform:e})}const bC=ve("ZodOptional",(e,t)=>{S3.init(e,t),mn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function xw(e){return new bC({type:"optional",innerType:e})}const c6=ve("ZodNullable",(e,t)=>{j3.init(e,t),mn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ww(e){return new c6({type:"nullable",innerType:e})}const u6=ve("ZodDefault",(e,t)=>{C3.init(e,t),mn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function d6(e,t){return new u6({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const p6=ve("ZodPrefault",(e,t)=>{N3.init(e,t),mn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function f6(e,t){return new p6({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const xC=ve("ZodNonOptional",(e,t)=>{E3.init(e,t),mn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function h6(e,t){return new xC({type:"nonoptional",innerType:e,...Ue(t)})}const m6=ve("ZodCatch",(e,t)=>{A3.init(e,t),mn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function g6(e,t){return new m6({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const v6=ve("ZodPipe",(e,t)=>{T3.init(e,t),mn.init(e,t),e.in=t.in,e.out=t.out});function kw(e,t){return new v6({type:"pipe",in:e,out:t})}const y6=ve("ZodReadonly",(e,t)=>{R3.init(e,t),mn.init(e,t)});function b6(e){return new y6({type:"readonly",innerType:e})}const x6=ve("ZodCustom",(e,t)=>{_3.init(e,t),mn.init(e,t)});function w6(e){const t=new Yn({check:"custom"});return t._zod.check=e,t}function k6(e,t={}){return b$(x6,e,t)}function S6(e){const t=w6(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Zl(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(Zl(s))}},e(n.value,n)));return t}function Zh(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 Ke(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 kv={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+Ke(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+Ke(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,Ke(n)),Ke(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,Ke(n)),Ke(e[0])):0},Sort:{name:"Sort",signature:"Sort(array, field, direction?) → sorted array",description:'Sort array by field. Direction: "asc" (default) or "desc"',fn:(e,t,n)=>{if(!Array.isArray(e))return e;const r=String(t??""),s=String(n??"asc")==="desc";return[...e].sort((l,c)=>{const d=r?Zh(l,r):l,f=r?Zh(c,r):c,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 v=Ke(d)-Ke(f);return s?-v:v}const m=String(d??"").localeCompare(String(f??""));return s?-m:m})}},Filter:{name:"Filter",signature:'Filter(array, field, operator: "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains", value) → filtered array',description:"Filter array by field value",fn:(e,t,n,r)=>{if(!Array.isArray(e))return[];const s=String(t??""),l=String(n??"==");return e.filter(c=>{const d=s?Zh(c,s):c;switch(l){case"==":return d==r;case"!=":return d!=r;case">":return Ke(d)>Ke(r);case"<":return Ke(d)<Ke(r);case">=":return Ke(d)>=Ke(r);case"<=":return Ke(d)<=Ke(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=Ke(e),r=t!=null?Ke(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(Ke(e))},Floor:{name:"Floor",signature:"Floor(number) → number",description:"Round down to nearest integer",fn:e=>Math.floor(Ke(e))},Ceil:{name:"Ceil",signature:"Ceil(number) → number",description:"Round up to nearest integer",fn:e=>Math.ceil(Ke(e))}},Sv=new Set(["Each"]),j6={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."}},Pa={Run:"run",ToAssistant:"continue_conversation",OpenUrl:"open_url",Set:"set",Reset:"reset"},wC=new Set(["Action",...Object.keys(Pa)]),C6=new Set([...Object.keys(kv),...Sv,...wC]);function Kl(e){return C6.has(e)}const Si={Query:"Query",Mutation:"Mutation"};function jd(e){return e in Si}function Cd(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?`${Cd(n)}[]`:"any[]"}if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const r=e.required??[];return`{${Object.entries(n).map(([s,l])=>`${s}${r.includes(s)?"":"?"}: ${Cd(l)}`).join(", ")}}`}return"object"}return"any"}function kC(e){const t=e.type;if(t==="string")return"";if(t==="number"||t==="integer")return 0;if(t==="boolean")return!1;if(t==="array")return[];if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const r={};for(const[s,l]of Object.entries(n))r[s]=kC(l);return r}return{}}return null}const N6="You are an AI assistant that responds using openui-lang, a declarative UI language. Your ENTIRE response must be valid openui-lang code — no markdown, no explanations, just openui-lang.";function E6(e,t){const n=["## Syntax Rules","","1. Each statement is on its own line: `identifier = Expression`",`2. \`root\` is the entry point — every program must define \`root = ${e}(...)\``,'3. Expressions are: strings ("..."), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)',"4. Use references for readability: define `name = ...` on one line, then use `name` later","5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.",'6. Arguments are POSITIONAL (order matters, not names). Write `Stack([children], "row", "l")` NOT `Stack([children], direction: "row", gap: "l")` — colon syntax is NOT supported and silently breaks',"7. Optional arguments can be omitted from the end"];let r=8;return t.bindings&&n.push(`${r++}. Declare mutable state with \`$varName = defaultValue\`. Components marked with \`$binding\` can read/write these. Undeclared $variables are auto-created with null default.`),t.supportsExpressions&&n.push(`${r++}. String concatenation: \`"text" + $var + "more"\``,`${r++}. Dot member access: \`query.field\` reads a field; on arrays it extracts that field from every element`,`${r++}. Index access: \`arr[0]\`, \`data[index]\``,`${r++}. Arithmetic operators: +, -, *, /, % (work on numbers; + is string concat when either side is a string)`,`${r++}. Comparison: ==, !=, >, <, >=, <=`,`${r++}. Logical: &&, ||, ! (prefix)`,`${r++}. Ternary: \`condition ? valueIfTrue : valueIfFalse\``,`${r++}. Parentheses for grouping: \`(a + b) * c\``),n.push("- Strings use double quotes with backslash escaping"),n.join(`
|
|
1421
|
+
`)}function A6(){const e=Object.values(kv).map(n=>`@${n.signature} — ${n.description}`),t=Object.values(j6).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 T6(){return`## Query — Live Data Fetching
|
|
1436
|
+
|
|
1437
|
+
Fetch data from available tools. Returns defaults instantly, swaps in real data when it arrives.
|
|
1438
|
+
|
|
1439
|
+
\`\`\`
|
|
1440
|
+
metrics = Query("tool_name", {arg1: value, arg2: $binding}, {defaultField: 0, defaultData: []}, refreshInterval?)
|
|
1441
|
+
\`\`\`
|
|
1442
|
+
|
|
1443
|
+
- First arg: tool name (string)
|
|
1444
|
+
- Second arg: arguments object (may reference $bindings — re-fetches automatically on change)
|
|
1445
|
+
- Third arg: default data (rendered immediately before fetch resolves)
|
|
1446
|
+
- Fourth arg (optional): refresh interval in seconds (e.g. 30 for auto-refresh every 30s)
|
|
1447
|
+
- Use dot access on results: metrics.totalEvents, metrics.data.day (array pluck)
|
|
1448
|
+
- Query results must use regular identifiers: \`metrics = Query(...)\`, NOT \`$metrics = Query(...)\`
|
|
1449
|
+
- Manual refresh: \`Button("Refresh", Action([@Run(query1), @Run(query2)]), "secondary")\` — re-fetches the listed queries
|
|
1450
|
+
- Refresh all queries: create Action with @Run for each query`}function R6(){return`## Mutation — Write Operations
|
|
1451
|
+
|
|
1452
|
+
Execute state-changing tool calls (create, update, delete). Unlike Query (auto-fetches on render), Mutation fires only on button click via Action.
|
|
1453
|
+
|
|
1454
|
+
\`\`\`
|
|
1455
|
+
result = Mutation("tool_name", {arg1: $binding, arg2: "value"})
|
|
1456
|
+
\`\`\`
|
|
1457
|
+
|
|
1458
|
+
- First arg: tool name (string)
|
|
1459
|
+
- Second arg: arguments object (evaluated with current $binding values at click time)
|
|
1460
|
+
- result.status: "idle" | "loading" | "success" | "error"
|
|
1461
|
+
- result.data: tool response on success
|
|
1462
|
+
- result.error: error message on failure
|
|
1463
|
+
- Mutation results use regular identifiers: \`result = Mutation(...)\`, NOT \`$result\`
|
|
1464
|
+
- Show loading state: \`result.status == "loading" ? TextContent("Saving...") : null\``}function _6(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 O6(){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 M6(){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 L6(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 D6(){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 I6(){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 z6(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 $6(e){let t="";if(e.inputSchema){const s=e.inputSchema.properties,l=e.inputSchema.required??[];s&&Object.keys(s).length>0&&(t=Object.entries(s).map(([c,d])=>`${c}${l.includes(c)?"":"?"}: ${Cd(d)}`).join(", "))}let n="";e.outputSchema&&(n=` → ${Cd(e.outputSchema)}`);let r=`- ${e.name}(${t})${n}`;return e.description&&(r+=`
|
|
1608
|
+
${e.description}`),r}function P6(e){const t=[],n=[],r=[];for(const l of e)typeof l=="string"?n.push(l):r.push(l);t.push("## Available Tools"),t.push(""),t.push("Use these with Query() for read operations or Mutation() for write operations. The LLM decides which is appropriate based on the tool's purpose."),t.push("");for(const l of n)t.push(`- ${l}`);for(const l of r)t.push($6(l));const s=r.filter(l=>l.outputSchema);if(s.length>0){t.push(""),t.push("### Default values for Query results"),t.push(""),t.push("Use these shapes as minimal Query defaults:");for(const l of s){const c=kC(l.outputSchema);t.push(`- ${l.name}: \`${JSON.stringify(c)}\``)}}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 U6(e,t){var s,l;const n=["## Component Signatures","","Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming."];if(t.usesActionExpression){const c=[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 (${c.join(", ")}).`)}(t.bindings||Object.values(e.components).some(c=>{var d;return(d=c.signature)==null?void 0:d.includes("$binding")}))&&n.push("Props marked `$binding<type>` accept a `$variable` reference for two-way binding.");const r=c=>c.description?`${c.signature} — ${c.description}`:c.signature;if((s=e.componentGroups)!=null&&s.length){const c=new Set;for(const f of e.componentGroups){n.push("",`### ${f.name}`);for(const h of f.components){if(c.has(h))continue;const g=e.components[h];g&&(c.add(h),n.push(r(g)))}if((l=f.notes)!=null&&l.length)for(const h of f.notes)n.push(h)}const d=Object.keys(e.components).filter(f=>!c.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[,c]of Object.entries(e.components))n.push(r(c))}return n.join(`
|
|
1610
|
+
`)}function B6(e){var h,g,m;const t=e.root??"Root",n=!!((h=e.tools)!=null&&h.length),r=e.toolCalls??n,s=e.bindings??r,l=r||s,c=Object.values(e.components).some(v=>{var b;return(b=v.signature)==null?void 0:b.includes("ActionExpression")}),d=[];d.push(e.preamble??N6),d.push(""),d.push(E6(t,{supportsExpressions:l,bindings:s})),d.push(""),d.push(U6(e,{toolCalls:r,bindings:s,usesActionExpression:c})),l&&(d.push(""),d.push(A6())),r&&(d.push(""),d.push(T6()),d.push(""),d.push(R6())),c&&(d.push(""),d.push(_6({toolCalls:r,bindings:s}))),r&&s&&(d.push(""),d.push(O6())),r&&(d.push(""),d.push(I6())),(g=e.tools)!=null&&g.length&&(d.push(""),d.push(P6(e.tools))),d.push(""),d.push(L6(t,{supportsExpressions:l}));const f=[...e.examples??[],...e.toolExamples??[]];if(f.length){d.push(""),d.push("## Examples"),d.push("");for(const v of f)d.push(v),d.push("")}if(e.editMode&&(d.push(""),d.push(M6())),e.inlineMode&&(d.push(""),d.push(D6())),d.push(z6(t,{toolCalls:r,bindings:s})),(m=e.additionalRules)!=null&&m.length){d.push("");for(const v of e.additionalRules)d.push(`- ${v}`)}return d.join(`
|
|
1611
|
+
`)}const F6=new WeakSet;function Pl(e){return typeof e=="object"&&e!==null&&F6.has(e)}const SC=new WeakMap;function H6(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 q6(e){return H6(e.props,e.name),SC.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 jv(e){var t;return(t=$r(e))==null?void 0:t.type}function jC(e){const t=jv(e);return t==="optional"||t==="default"||t==="nullable"}function oc(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 CC(e){return jv(oc(e))==="array"}function G6(e){const t=$r(oc(e));if((t==null?void 0:t.type)==="array")return t.element??t.innerType}function V6(e){const t=$r(oc(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 W6(e,t){try{const n=t.get(e);if(n!=null&&n.id)return n.id}catch{}if(typeof e=="object"&&e!==null)return SC.get(e)}function Sw(e){const t=$r(e);if((t==null?void 0:t.type)==="union"&&Array.isArray(t.options))return t.options}function Z6(e){const t=$r(e);if((t==null?void 0:t.type)==="object"&&t.shape&&typeof t.shape=="object")return t.shape}function ro(e,t){const n=Pl(e),r=K6(oc(e),t);if(r)return n?`$binding<${r}>`:r}function K6(e,t){var d;const n=W6(e,t);if(n)return n;const r=Sw(e);if(r){const f=r.map(h=>ro(h,t)).filter(Boolean);if(f.length>0)return f.join(" | ")}if(CC(e)){const f=G6(e);if(!f)return;const h=ro(f,t);return h?Sw(oc(f))!==void 0?`(${h})[]`:`${h}[]`:void 0}const s=jv(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<${ro(f==null?void 0:f.keyType,t)??"string"}, ${ro(f==null?void 0:f.valueType,t)??"any"}>`}const l=V6(e);if(l)return l.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 c=Z6(e);return c?`{${Object.entries(c).map(([f,h])=>{const g=jC(h)?"?":"",m=ro(h,t);return m?`${f}${g}: ${m}`:`${f}${g}`}).join(", ")}}`:"any"}function Y6(e,t){return Object.entries(e).map(([n,r])=>({name:n,isOptional:jC(r),isArray:CC(r),typeAnnotation:ro(r,t)}))}function Q6(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 jw(e,t){const n={};for(const[r,s]of Object.entries(e))n[r]={signature:Q6(r,Y6(s.props.shape,t)),description:s.description};return n}function X6(e){const t={},n=hC();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 B6({root:e.root,components:jw(t,n),componentGroups:e.componentGroups,...r})},toSpec(){return{root:e.root,components:jw(t,n),componentGroups:e.componentGroups}},toJSONSchema(){const r=Ut(Object.fromEntries(Object.entries(t).map(([s,l])=>[s,l.props])));return x$(r,{metadata:n})}}}function Dr(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return t.type==="element"&&typeof t.typeName=="string"&&typeof t.props=="object"&&t.props!==null&&typeof t.partial=="boolean"}let zu=(function(e){return e.ContinueConversation="continue_conversation",e.OpenUrl="open_url",e})({});function J6(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 e5=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function uo(e){return!e||typeof e!="object"||Array.isArray(e)?!1:e5.has(e.k)}function t5(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 re=(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 n5=1,Cw=2,Nw=3,Kh=4,Nl=5,Yh=6,$u=7,Ew=8,a5=9;function Aw(e){let t=0;const n=()=>e[t]??{t:re.EOF},r=()=>{const v=n();return t++,v},s=v=>{n().t===v&&t++};function l(v){switch(v.t){case re.Question:return n5;case re.Or:return Cw;case re.And:return Nw;case re.EqEq:case re.NotEq:return Kh;case re.Greater:case re.Less:case re.GreaterEq:case re.LessEq:return Nl;case re.Plus:case re.Minus:return Yh;case re.Star:case re.Slash:case re.Percent:return $u;case re.Dot:case re.LBrack:return a5;default:return 0}}function c(v=0){let b=d();for(;l(n())>v;)b=f(b);return b}function d(){var b,k;const v=n();if(v.t===re.Str)return r(),{k:"Str",v:v.v};if(v.t===re.Num)return r(),{k:"Num",v:v.v};if(v.t===re.True)return r(),{k:"Bool",v:!0};if(v.t===re.False)return r(),{k:"Bool",v:!1};if(v.t===re.Null)return r(),{k:"Null"};if(v.t===re.LBrack)return g();if(v.t===re.LBrace)return m();if(v.t===re.StateVar){const j=v.v;return r(),n().t===re.Equals?(r(),{k:"Assign",target:j,value:c(0)}):{k:"StateRef",n:j}}if(v.t===re.Type){const j=v.v;return((b=e[t+1])==null?void 0:b.t)===re.LParen&&(!Kl(j)||j==="Action")?h():(r(),{k:"Ref",n:j})}if(v.t===re.BuiltinCall)return((k=e[t+1])==null?void 0:k.t)===re.LParen?h():(r(),{k:"Ref",n:v.v});if(v.t===re.Ident)return r(),{k:"Ref",n:v.v};if(v.t===re.Not)return r(),{k:"UnaryOp",op:"!",operand:c(Ew)};if(v.t===re.Minus)return r(),{k:"UnaryOp",op:"-",operand:c(Ew)};if(v.t===re.LParen){r();const j=c(0);return s(re.RParen),j}return r(),{k:"Null"}}function f(v){const b=n();if(b.t===re.Plus)return r(),{k:"BinOp",op:"+",left:v,right:c(Yh)};if(b.t===re.Minus)return r(),{k:"BinOp",op:"-",left:v,right:c(Yh)};if(b.t===re.Star)return r(),{k:"BinOp",op:"*",left:v,right:c($u)};if(b.t===re.Slash)return r(),{k:"BinOp",op:"/",left:v,right:c($u)};if(b.t===re.Percent)return r(),{k:"BinOp",op:"%",left:v,right:c($u)};if(b.t===re.EqEq)return r(),{k:"BinOp",op:"==",left:v,right:c(Kh)};if(b.t===re.NotEq)return r(),{k:"BinOp",op:"!=",left:v,right:c(Kh)};if(b.t===re.Greater)return r(),{k:"BinOp",op:">",left:v,right:c(Nl)};if(b.t===re.Less)return r(),{k:"BinOp",op:"<",left:v,right:c(Nl)};if(b.t===re.GreaterEq)return r(),{k:"BinOp",op:">=",left:v,right:c(Nl)};if(b.t===re.LessEq)return r(),{k:"BinOp",op:"<=",left:v,right:c(Nl)};if(b.t===re.And)return r(),{k:"BinOp",op:"&&",left:v,right:c(Nw)};if(b.t===re.Or)return r(),{k:"BinOp",op:"||",left:v,right:c(Cw)};if(b.t===re.Question){r();const k=c(0);return s(re.Colon),{k:"Ternary",cond:v,then:k,else:c(0)}}if(b.t===re.Dot){r();const k=n();return{k:"Member",obj:v,field:k.t===re.Ident||k.t===re.Type||k.t===re.Str||k.t===re.Num?(r(),String(k.v)):k.t===re.StateVar?(r(),k.v.replace(/^\$/,"")):(r(),"?")}}if(b.t===re.LBrack){r();const k=c(0);return s(re.RBrack),{k:"Index",obj:v,index:k}}return v}function h(){const v=n().v;r(),s(re.LParen);const b=[];for(;n().t!==re.RParen&&n().t!==re.EOF;)b.push(c(0)),n().t===re.Comma&&r();return s(re.RParen),{k:"Comp",name:v,args:b}}function g(){r();const v=[];for(;n().t!==re.RBrack&&n().t!==re.EOF;)v.push(c(0)),n().t===re.Comma&&r();return s(re.RBrack),{k:"Arr",els:v}}function m(){r();const v=[];for(;n().t!==re.RBrace&&n().t!==re.EOF;){const b=n(),k=b.t===re.Ident||b.t===re.Str||b.t===re.Type||b.t===re.Num?(r(),String(b.v)):b.t===re.StateVar?(r(),b.v.replace(/^\$/,"")):(r(),"?");s(re.Colon),v.push([k,c(0)]),n().t===re.Comma&&r()}return s(re.RBrace),{k:"Obj",entries:v}}return c(0)}function Tw(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:re.Newline}),n++;continue}if(s==="("){t.push({t:re.LParen}),n++;continue}if(s===")"){t.push({t:re.RParen}),n++;continue}if(s==="["){t.push({t:re.LBrack}),n++;continue}if(s==="]"){t.push({t:re.RBrack}),n++;continue}if(s==="{"){t.push({t:re.LBrace}),n++;continue}if(s==="}"){t.push({t:re.RBrace}),n++;continue}if(s===","){t.push({t:re.Comma}),n++;continue}if(s===":"){t.push({t:re.Colon}),n++;continue}if(s==="="){n+1<r&&e[n+1]==="="?(t.push({t:re.EqEq}),n+=2):(t.push({t:re.Equals}),n++);continue}if(s==="!"){n+1<r&&e[n+1]==="="?(t.push({t:re.NotEq}),n+=2):(t.push({t:re.Not}),n++);continue}if(s===">"){n+1<r&&e[n+1]==="="?(t.push({t:re.GreaterEq}),n+=2):(t.push({t:re.Greater}),n++);continue}if(s==="<"){n+1<r&&e[n+1]==="="?(t.push({t:re.LessEq}),n+=2):(t.push({t:re.Less}),n++);continue}if(s==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:re.And}),n+=2):(t.push({t:re.And}),n++);continue}if(s==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:re.Or}),n+=2):(t.push({t:re.Or}),n++);continue}if(s==="."){t.push({t:re.Dot}),n++;continue}if(s==="?"){t.push({t:re.Question}),n++;continue}if(s==="+"){t.push({t:re.Plus}),n++;continue}if(s==="*"){t.push({t:re.Star}),n++;continue}if(s==="/"){t.push({t:re.Slash}),n++;continue}if(s==="%"){t.push({t:re.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:re.Str,v:JSON.parse(g)})}catch{const g=h.replace(/^"|"$/g,"");t.push({t:re.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:re.Str,v:d});continue}if(s==="-"){const d=t.length>0?t[t.length-1]:null;if(!(!(d!=null&&(d.t===re.Num||d.t===re.Str||d.t===re.Ident||d.t===re.Type||d.t===re.RParen||d.t===re.RBrack||d.t===re.True||d.t===re.False||d.t===re.Null||d.t===re.StateVar||d.t===re.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:re.Minus}),n++;continue}}const l=s>="0"&&s<="9",c=s==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(l||c){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:re.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:re.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:re.True});continue}if(f==="false"){t.push({t:re.False});continue}if(f==="null"){t.push({t:re.Null});continue}const h=s>="A"&&s<="Z"?re.Type:re.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:re.BuiltinCall,v:e.slice(d,n)});continue}n++}return t.push({t:re.EOF}),t}function ad(e){return e==null||typeof e!="object"?!1:uo(e)?!0:Array.isArray(e)?e.some(ad):Dr(e)?Object.values(e.props).some(ad):Object.values(e).some(ad)}function NC(e,t,n){var l;if(t.visited.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;if(!t.syms.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;const r=t.syms.get(e);if((l=t.unreached)==null||l.delete(e),r.k==="Comp"&&jd(r.name))return{k:"RuntimeRef",n:e,refType:r.name===Si.Mutation?"mutation":"query"};t.visited.add(e);const s=t.currentStatementId;t.currentStatementId=e;try{const c=n==="value"?po(r,t):Qm(r,t);return n==="value"&&Dr(c)&&(c.statementId=e),c}finally{t.currentStatementId=s,t.visited.delete(e)}}function EC(e,t,n){if(!Sv.has(e.name)||e.args.length<3)return null;const r=e.args[1],s=r.k==="Ref"?r.n:r.k==="Str"?r.v:null;if(!s)return null;const l=new Set(n);l.add(s);const c=e.args.map((d,f)=>f===1?d:In(d,t,l));return{...e,args:c}}function In(e,t,n){var r;switch(e.k){case"Ref":return n.has(e.n)?e:NC(e.n,t,"expr");case"Ph":return e;case"Comp":{const s=EC(e,t,n);if(s)return s;const l=e.args.map(d=>In(d,t,n));if(Kl(e.name)||jd(e.name))return{...e,args:l};const c=(r=t.cat)==null?void 0:r.get(e.name);if(c){const d={};for(let f=0;f<c.params.length&&f<l.length;f++)d[c.params[f].name]=l[f];return{...e,args:l,mappedProps:d}}return t.errors.push({code:"unknown-component",component:e.name,path:"",message:`Unknown component "${e.name}" — not found in catalog or builtins`,statementId:t.currentStatementId}),{...e,args:l}}case"Arr":return{...e,els:e.els.map(s=>In(s,t,n))};case"Obj":return{...e,entries:e.entries.map(([s,l])=>[s,In(l,t,n)])};case"BinOp":return{...e,left:In(e.left,t,n),right:In(e.right,t,n)};case"UnaryOp":return{...e,operand:In(e.operand,t,n)};case"Ternary":return{...e,cond:In(e.cond,t,n),then:In(e.then,t,n),else:In(e.else,t,n)};case"Member":return{...e,obj:In(e.obj,t,n)};case"Index":return{...e,obj:In(e.obj,t,n),index:In(e.index,t,n)};case"Assign":return{...e,value:In(e.value,t,n)};default:return e}}function Qm(e,t){return In(e,t,new Set)}function po(e,t){var n;switch(e.k){case"Ref":return NC(e.n,t,"value");case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"Arr":{const r=[];for(const s of e.els){if(s.k==="Ph")continue;const l=po(s,t);l===null&&(s.k==="Comp"||s.k==="Ref")||r.push(l)}return r}case"Obj":{const r={};for(const[s,l]of e.entries)r[s]=po(l,t);return r}case"Comp":{const{name:r,args:s}=e;if(Kl(r)){const f=EC(e,t,new Set);return f||{...e,args:s.map(h=>Qm(h,t))}}if(jd(r))return t.errors.push({code:"inline-reserved",component:r,path:"",message:`${r}() must be declared as a top-level statement, not used inline as a value`,statementId:t.currentStatementId}),null;const l=(n=t.cat)==null?void 0:n.get(r),c={};if(l){for(let h=0;h<l.params.length&&h<s.length;h++)c[l.params[h].name]=po(s[h],t);if(s.length>l.params.length){const h=s.length-l.params.length;t.errors.push({code:"excess-args",component:r,path:"",message:`${r} takes ${l.params.length} arg(s), got ${s.length} (${h} excess dropped)`,statementId:t.currentStatementId})}const f=l.params.filter(h=>h.required&&(!(h.name in c)||c[h.name]===null));if(f.length){const h=f.filter(g=>g.defaultValue!==void 0?(c[g.name]=g.defaultValue,!1):!0);if(h.length){for(const g of h){const m=g.name in c;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(!Kl(r)&&!jd(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(c).some(f=>ad(f));return{type:"element",typeName:r,props:c,partial:t.partial,hasDynamicProps:d}}default:return J6(e)?Qm(e,t):e}}function r5(e){const t=[];let n=!1,r=!1;for(let l=0;l<e.length;l++){const c=e[l];if(r){r=!1;continue}if(c==="\\"&&n){r=!0;continue}if(n){c===n&&(n=!1);continue}if(c==='"'||c==="'"){n=c;continue}c==="("||c==="["||c==="{"?t.push(c):(c===")"&&t[t.length-1]==="("||c==="]"&&t[t.length-1]==="["||c==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(n||t.length>0))return{text:e,wasIncomplete:!1};let s=e;n&&(r&&(s+="\\"),s+=n);for(let l=t.length-1;l>=0;l--)s+=t[l]==="("?")":t[l]==="["?"]":"}";return{text:s,wasIncomplete:!0}}function Rw(e){const t=[];let n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===re.Newline;)n++;if(n>=e.length||e[n].t===re.EOF)break;const r=e[n];if(r.t!==re.Ident&&r.t!==re.Type&&r.t!==re.StateVar){for(;n<e.length&&e[n].t!==re.Newline&&e[n].t!==re.EOF;)n++;continue}const s=r.v,l=r.t;if(n++,n>=e.length||e[n].t!==re.Equals){for(;n<e.length&&e[n].t!==re.Newline&&e[n].t!==re.EOF;)n++;continue}n++;const c=[];let d=0,f=0;for(;n<e.length&&e[n].t!==re.EOF;){const h=e[n].t;if(h===re.Newline&&d<=0&&f<=0){let g=n+1;for(;g<e.length&&e[g].t===re.Newline;)g++;const m=g<e.length?e[g].t:re.EOF;if(m===re.Question||m===re.Colon&&f>0){n++;continue}break}if(h===re.Newline){n++;continue}h===re.LParen||h===re.LBrack||h===re.LBrace?d++:(h===re.RParen||h===re.RBrack||h===re.RBrace)&&d>0?d--:h===re.Question&&d===0?f++:h===re.Colon&&d===0&&f>0&&f--,c.push(e[n++])}c.length&&t.push({id:s,idTokenType:l,tokens:c})}return t}function rd(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function AC(e){if(!uo(e))return[];const t=new Set;return t5(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function _w(e,t){if(t.k==="Comp"&&t.name===Si.Query){const n=AC(t.args[1]);return{kind:"query",id:e.id,call:{callee:Si.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===Si.Mutation?{kind:"mutation",id:e.id,call:{callee:Si.Mutation,args:t.args},expr:t}:e.idTokenType===re.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function i5(e,t){const n={},r=[],s=[];for(const l of e)switch(l.kind){case"state":n[l.id]=po(l.init,t);break;case"query":r.push({statementId:l.id,toolAST:l.call.args[0]??null,argsAST:l.call.args[1]??null,defaultsAST:l.call.args[2]??null,refreshAST:l.call.args[3]??null,deps:l.deps,complete:!0});break;case"mutation":s.push({statementId:l.id,toolAST:l.call.args[0]??null,argsAST:l.call.args[1]??null});break}for(const l of e){const c=l.kind==="state"?[l.init]:l.kind==="value"?[l.expr]:l.kind==="query"||l.kind==="mutation"?l.call.args:[];for(const d of c)for(const f of AC(d))f in n||(n[f]=null)}return{stateDeclarations:n,queryStatements:r,mutationStatements:s}}const Ow="root";function Mw(e){return e.kind==="value"&&e.expr.k==="Comp"&&!Kl(e.expr.name)&&e.expr.name!==Si.Query&&e.expr.name!==Si.Mutation}function s5(e,t,n,r){var l;if(e.has(Ow))return Ow;if(r&&e.has(r))return r;const s=r?t.find(c=>Mw(c)&&c.expr.name===r):void 0;return s?s.id:((l=t.find(Mw))==null?void 0:l.id)??n}function Pu(e,t,n,r,s,l,c){const d=s5(e,t,n,c);if(!e.has(d))return rd(r);const f=new Map;for(const[N,E]of e)f.set(N,E.kind==="state"?E.init:E.expr);const h=[],g=[],m=new Set;for(const[N,E]of e)N!==d&&(E.kind==="state"||E.kind==="query"||E.kind==="mutation"||m.add(N));const v={syms:f,cat:l,errors:g,unres:h,visited:new Set,partial:r,currentStatementId:d,unreached:m},b=po(f.get(d),v),k=Dr(b)?b:null;k&&(k.statementId=d);const{stateDeclarations:j,queryStatements:C,mutationStatements:S}=i5(t,v);return{root:k,meta:{incomplete:r,unresolved:h,orphaned:[...m],statementCount:s,errors:g},stateDeclarations:j,queryStatements:C,mutationStatements:S}}function o5(e){const t=[];let n=0;for(;n<e.length;){const r=e.indexOf("```",n);if(r===-1)break;let s=r+3;for(;s<e.length&&e[s]!==`
|
|
1614
|
+
`;)s++;if(s>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}s++;let l=!1,c=-1,d=s;for(;d<e.length;){const f=e[d];if(l){if(f==="\\"&&d+1<e.length){d+=2;continue}f==='"'&&(l=!1),d++;continue}if(f==='"'){l=!0,d++;continue}if(f==="`"&&d+1<e.length&&e[d+1]==="`"&&d+2<e.length&&e[d+2]==="`"){c=d;break}d++}c!==-1?(t.push(e.slice(s,c)),n=c+3):(t.push(e.slice(s)),n=e.length)}if(t.length>0)return t.join(`
|
|
1615
|
+
`);if(e.startsWith("```")){let r=3;for(;r<e.length&&e[r]!==`
|
|
1616
|
+
`;)r++;const s=r<e.length?r+1:3,l=e.slice(s),c=l.lastIndexOf("```");return c!==-1?l.slice(0,c):l}return e}function Lw(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 l5(e,t){let n="",r=0;const s=new Map;let l=0,c="";function d(m){const v=Lw(m).trim();if(!(!v||/^```/.test(v)))for(const b of Rw(Tw(v))){const k=_w(b,Aw(b.tokens));s.set(b.id,k),l++,c||(c=b.id)}}function f(){let m=0,v=0,b=!1,k=!1,j=r;for(let C=r;C<n.length;C++){const S=n[C];if(k){k=!1;continue}if(S==="\\"&&b){k=!0;continue}if(b){S===b&&(b=!1);continue}if(S==='"'||S==="'"){b=S;continue}if(S==="("||S==="["||S==="{")m++;else if(S===")"||S==="]"||S==="}")m=Math.max(0,m-1);else if(S==="?"&&m===0)v++;else if(S===":"&&m===0&&v>0)v--;else if(S===`
|
|
1619
|
+
`&&m<=0&&v<=0){let N=C+1;for(;N<n.length&&(n[N]===" "||n[N]===" "||n[N]==="\r"||n[N]===`
|
|
1620
|
+
`);)N++;if(N<n.length&&(n[N]==="?"||n[N]===":"&&v>0))continue;const E=n.slice(j,C).trim();E&&d(E),j=C+1,r=C+1}}return j}function h(){const m=f(),v=n.slice(m).trim();if(!v)return l===0?rd():Pu(s,[...s.values()],c,!1,l,e,t);const b=Lw(o5(v)).trim();if(!b)return l===0?rd():Pu(s,[...s.values()],c,!1,l,e,t);const{text:k,wasIncomplete:j}=r5(b),C=Rw(Tw(k));if(!C.length)return l===0?rd(j):Pu(s,[...s.values()],c,j,l,e,t);const S=new Map(s);for(const N of C){if(s.has(N.id))continue;const E=_w(N,Aw(N.tokens));S.set(N.id,E)}return Pu(S,[...S.values()],c||C[0].id,j,l+C.length,e,t)}function g(){n="",r=0,s.clear(),l=0,c=""}return{push(m){return n+=m,h()},set(m){(m.length<n.length||!m.startsWith(n))&&g();const v=m.slice(n.length);return v&&(n+=v),h()},getResult:h}}function c5(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function u5(e){const t=new Map,n=e.$defs??{};for(const[r,s]of Object.entries(n)){const l=s.properties??{},c=s.required??[],d=Object.keys(l).map(f=>({name:f,required:c.includes(f),defaultValue:c5(l[f])}));t.set(r,{params:d})}return t}function d5(e,t){return l5(u5(e),t)}function p5(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 f5(e,t,n){return e.map(r=>{var l;const s={source:"parser",code:r.code,message:r.message,component:r.component,path:r.path||void 0,statementId:r.statementId};return r.code==="unknown-component"&&n.length?s.hint=`Available components: ${n.join(", ")}`:r.code==="missing-required"||r.code==="null-required"?s.hint=p5(r.component,(l=t.$defs)==null?void 0:l[r.component]):r.code==="inline-reserved"&&(s.hint=`Declare as a top-level statement: myVar = ${r.component}(...)`),s})}function h5(e){return typeof e=="object"&&e!==null&&e.__reactive==="assign"}function vt(e,t,n){var r,s,l;switch(e.k){case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"StateRef":return((r=t.extraScope)==null?void 0:r[e.n])??t.getState(e.n);case"Ref":case"RuntimeRef":return t.resolveRef(e.n);case"Arr":return e.els.map(c=>vt(c,t));case"Obj":return Object.fromEntries(e.entries.map(([c,d])=>[c,vt(d,t)]));case"Comp":{if(Sv.has(e.name))return g5(e.name,e.args,t,n);const c=kv[e.name];if(c){const d=e.args.map(f=>vt(f,t));return c.fn(...d)}if(wC.has(e.name))return m5(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 v=(l=(s=d==null?void 0:d.props)==null?void 0:s.shape)==null?void 0:l[g];m.k==="StateRef"&&v&&Pl(v)?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))Dr(m)?f[g]=Nd(m,t,n):Array.isArray(m)&&(f[g]=m.map(v=>Dr(v)?Nd(v,t,n):v));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 c=vt(e.left,t),d=vt(e.right,t);switch(e.op){case"+":return typeof c=="string"||typeof d=="string"?String(c??"")+String(d??""):Ke(c)+Ke(d);case"-":return Ke(c)-Ke(d);case"*":return Ke(c)*Ke(d);case"/":return Ke(d)===0?0:Ke(c)/Ke(d);case"%":return Ke(d)===0?0:Ke(c)%Ke(d);case"==":return c==d;case"!=":return c!=d;case">":return Ke(c)>Ke(d);case"<":return Ke(c)<Ke(d);case">=":return Ke(c)>=Ke(d);case"<=":return Ke(c)<=Ke(d);default:return null}}case"UnaryOp":return e.op==="!"?!vt(e.operand,t):e.op==="-"?-Ke(vt(e.operand,t)):null;case"Ternary":return vt(e.cond,t)?vt(e.then,t):vt(e.else,t);case"Member":{const c=vt(e.obj,t);return c==null?null:Array.isArray(c)?e.field==="length"?c.length:c.map(d=>(d==null?void 0:d[e.field])??null):c[e.field]}case"Index":{const c=vt(e.obj,t),d=vt(e.index,t);return c==null||d==null?null:Array.isArray(c)?c[Ke(d)]:c[String(d)]}case"Assign":return{__reactive:"assign",target:e.target,expr:e.value}}}function Nd(e,t,n){var l,c;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=(c=(l=r==null?void 0:r.props)==null?void 0:l.shape)==null?void 0:c[d];s[d]=TC(f,t,n,h)}return{...e,props:s}}function TC(e,t,n,r){return RC(e,t,n,r,{recurseElement:s=>Nd(s,t,n),recurse:(s,l)=>TC(s,t,n,l)})}function Xm(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(Xm)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,Xm(n)])}:{k:"Null"}}function m5(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:Pa.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:Pa.ToAssistant,message:r,context:s}}case"OpenUrl":{const r=t.length>0?String(vt(t[0],n)??""):"";return{type:Pa.OpenUrl,url:r}}case"Set":{if(t.length<2)return null;const r=t[0];return r.k!=="StateRef"?null:{type:Pa.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:Pa.Reset,targets:r}}default:return null}}function Dn(e,t,n){switch(e.k){case"Ref":return e.n===t?Xm(n):e;case"Member":if(uo(e.obj)){const r=Dn(e.obj,t,n);if(r.k==="Obj"){const s=r.entries.find(([l])=>l===e.field);if(s)return s[1]}return{...e,obj:r}}return e;case"Index":return{...e,obj:uo(e.obj)?Dn(e.obj,t,n):e.obj,index:uo(e.index)?Dn(e.index,t,n):e.index};case"BinOp":return{...e,left:Dn(e.left,t,n),right:Dn(e.right,t,n)};case"UnaryOp":return{...e,operand:Dn(e.operand,t,n)};case"Ternary":return{...e,cond:Dn(e.cond,t,n),then:Dn(e.then,t,n),else:Dn(e.else,t,n)};case"Arr":return{...e,els:e.els.map(r=>Dn(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,s])=>[r,Dn(s,t,n)])};case"Comp":{const r={...e,args:e.args.map(s=>Dn(s,t,n))};if(e.mappedProps){const s={};for(const[l,c]of Object.entries(e.mappedProps))s[l]=Dn(c,t,n);r.mappedProps=s}return r}case"Assign":return{...e,value:Dn(e.value,t,n)};default:return e}}function g5(e,t,n,r){if(e==="Each"){if(t.length<3)return[];const s=vt(t[0],n);if(!Array.isArray(s))return[];const l=t[1].k==="Ref"?t[1].n:t[1].k==="Str"?t[1].v:null;if(!l)return[];const c=t[2];return s.map((d,f)=>{const h=Dn(c,l,d),g={...n,resolveRef:v=>v===l?d:n.resolveRef(v)},m=vt(h,g,r);return r&&Dr(m)?Nd(m,g,r):m})}return null}function RC(e,t,n,r,s){if(e==null||typeof e!="object")return e;if(uo(e)){if(e.k==="StateRef"&&r&&Pl(r))return{__reactive:"assign",target:e.n,expr:{k:"StateRef",n:"$value"}};const d=vt(e,t,n);return Dr(d)?s.recurseElement(d):Array.isArray(d)?d.map(f=>Dr(f)?s.recurseElement(f):f):h5(d)&&!(r&&Pl(r))?t.getState(d.target)??null:d}if(typeof e=="string"&&r&&Pl(r))return e;if(Array.isArray(e))return e.map(d=>s.recurse(d,r));if(Dr(e))return s.recurseElement(e);const l=e;if("steps"in l&&Array.isArray(l.steps)||"type"in l&&"valueAST"in l)return e;let c=!1;for(const d of Object.values(l))if(typeof d=="object"&&d!==null){c=!0;break}if(c){const d={};for(const[f,h]of Object.entries(l))d[f]=s.recurse(h,r);return d}return e}function _C(e,t){var l,c,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=(c=(l=r==null?void 0:r.props)==null?void 0:l.shape)==null?void 0:c[f];try{s[f]=OC(h,t,n,g)}catch(m){s[f]=h;const v=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: ${v}`,hint:`Check the expression used for prop "${f}"`})}}return{...e,props:s}}function OC(e,t,n,r){return RC(e,t.ctx,n,r,{recurseElement:s=>_C(s,t),recurse:(s,l)=>OC(s,t,n,l)})}var Jm=class extends Error{constructor(t){super(`MCP tool error: ${t||"Unknown error"}`);pn(this,"toolErrorText");this.name="McpToolError",this.toolErrorText=t}};function v5(e){var n,r;if(e.isError){const s=(n=e.content)==null?void 0:n.filter(l=>l.type==="text").map(l=>l.text).join(`
|
|
1621
|
+
`);throw new Jm(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 eg=class extends Error{constructor(t,n=[]){super(`[openui] No handler for tool "${t}". Available: ${n.join(", ")||"(none)"}`);pn(this,"toolName");pn(this,"availableTools");this.name="ToolNotFoundError",this.toolName=t,this.availableTools=n}};function Dw(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 y5(e,t,n){const r=n!=null?"::"+Dw(n):"";return e+"::"+Dw(t)+r}function b5(e){const t=new Map,n=new Map,r=new Map,s=new Set;let l={__openui_loading:[],__openui_refetching:[],__openui_errors:[]},c=JSON.stringify(l),d=!1,f=0;function h(){const O={__openui_loading:[],__openui_refetching:[],__openui_errors:[]};for(const[_,I]of t){const F=r.get(I.cacheKey);if(F&&F.data!==void 0)O[_]=F.data;else if(I.prevCacheKey){const K=r.get(I.prevCacheKey);K&&K.data!==void 0?O[_]=K.data:O[_]=I.defaults}else O[_]=I.defaults;I.loading&&(O.__openui_loading.push(_),I.everFetched&&O.__openui_refetching.push(_)),I.error&&O.__openui_errors.push(I.error)}for(const[_,I]of n)O[_]=I.result,I.error&&O.__openui_errors.push(I.error);try{const _=JSON.stringify(O);if(_===c)return!1;l=O,c=_}catch{l=O,c=""}return!0}function g(){for(const O of[...s])O()}async function m(O,_){if(!e)return;const I=t.get(_);if(!I)return;const F=O,K=I.toolName,z=I.args;let q=r.get(F);q?q.inFlight=!0:(q={data:void 0,inFlight:!0},r.set(F,q)),I.loading=!0,h(),g();try{const V=await e.callTool(K,z??{});if(d)return;const Z=t.get(_);if(!Z||Z.cacheKey!==F){q.inFlight=!1;return}if(q.data=V??null,Z.everFetched=!0,Z.error=void 0,Z.prevCacheKey&&Z.prevCacheKey!==F){const Y=Z.prevCacheKey;Z.prevCacheKey=void 0,v(Y)}}catch(V){const Z=t.get(_);Z&&Z.cacheKey===F&&(V instanceof eg?Z.error={source:"query",code:"tool-not-found",message:`Query tool "${K}" not found`,statementId:_,component:"Query",toolName:K,hint:V.availableTools.length?`Available tools: ${V.availableTools.join(", ")}`:void 0}:V instanceof Jm?Z.error={source:"query",code:"mcp-error",message:`Query "${K}" returned an error: ${V.toolErrorText}`,statementId:_,component:"Query",toolName:K}:Z.error={source:"query",code:"tool-error",message:`Query "${K}" failed: ${V instanceof Error?V.message:String(V)}`,statementId:_,component:"Query",toolName:K}),console.error(`Query "${K}" failed:`,V)}finally{q.inFlight=!1;const V=t.get(_);V&&V.cacheKey===F?(V.loading=!1,h()&&g(),V.needsRefetch&&(V.needsRefetch=!1,m(V.cacheKey,_))):h()&&g()}}function v(O){for(const _ of t.values())if(_.cacheKey===O||_.prevCacheKey===O)return;r.delete(O)}function b(O){if(d)return;const _=new Set(O.map(I=>I.statementId));for(const[I,F]of t)_.has(I)||(F.timer&&clearInterval(F.timer),t.delete(I),v(F.cacheKey),F.prevCacheKey&&v(F.prevCacheKey));for(const I of O){if(!I.complete)continue;const F=y5(I.toolName,I.args,I.deps),K=t.get(I.statementId);K?(K.cacheKey!==F&&(K.prevCacheKey=K.cacheKey),K.toolName=I.toolName,K.args=I.args,K.defaults=I.defaults,K.cacheKey=F):t.set(I.statementId,{toolName:I.toolName,args:I.args,defaults:I.defaults,cacheKey:F,loading:!1,everFetched:!1,refreshInterval:0,needsRefetch:!1});const z=t.get(I.statementId),q=r.get(F),V=q&&q.data!==void 0&&!q.inFlight;e&&!V&&!(q!=null&&q.inFlight)&&m(F,I.statementId);const Z=I.refreshInterval??0;Z!==z.refreshInterval&&(z.timer&&(clearInterval(z.timer),z.timer=void 0),Z>0&&(z.timer=setInterval(()=>{var Y;d||!e||(Y=r.get(z.cacheKey))!=null&&Y.inFlight||m(z.cacheKey,I.statementId)},Z*1e3)),z.refreshInterval=Z)}h()&&g()}function k(O){const _=t.get(O);if(!_)return null;const I=r.get(_.cacheKey);if(I&&I.data!==void 0)return I.data;if(_.prevCacheKey){const F=r.get(_.prevCacheKey);if(F&&F.data!==void 0)return F.data}return _.defaults}function j(O){var _;return((_=t.get(O))==null?void 0:_.loading)??!1}function C(){for(const O of t.values())if(O.loading)return!0;return!1}function S(O){var I;if(d||!e)return;const _=O!=null&&O.length?O.filter(F=>t.has(F)):[...t.keys()];for(const F of _){const K=t.get(F);K&&((I=r.get(K.cacheKey))!=null&&I.inFlight?K.needsRefetch=!0:m(K.cacheKey,F))}}function N(O){const _=new Set(O.map(I=>I.statementId));for(const I of n.keys())_.has(I)||n.delete(I);for(const I of O){const F=n.get(I.statementId);F?F.toolName!==I.toolName&&(F.toolName=I.toolName,F.result={status:"idle",data:null,error:null},F.error=void 0):n.set(I.statementId,{toolName:I.toolName,result:{status:"idle"}})}h()&&g()}async function E(O,_,I){if(d||!e)return!1;const F=n.get(O);if(!F||F.result.status==="loading")return!1;const K=f;F.result={status:"loading"},h(),g();let z=!1;try{const q=await e.callTool(F.toolName,_);if(d||K!==f)return!1;F.result={status:"success",data:q},F.error=void 0,z=!0}catch(q){if(d||K!==f)return!1;const V=q instanceof Error?q.message:String(q);F.result={status:"error",error:V},q instanceof eg?F.error={source:"mutation",code:"tool-not-found",message:`Mutation tool "${F.toolName}" not found`,statementId:O,component:"Mutation",toolName:F.toolName,hint:q.availableTools.length?`Available tools: ${q.availableTools.join(", ")}`:void 0}:q instanceof Jm?F.error={source:"mutation",code:"mcp-error",message:`Mutation "${F.toolName}" returned an error: ${q.toolErrorText}`,statementId:O,component:"Mutation",toolName:F.toolName}:F.error={source:"mutation",code:"tool-error",message:`Mutation "${F.toolName}" failed: ${V}`,statementId:O,component:"Mutation",toolName:F.toolName}}return h(),g(),z&&(I!=null&&I.length)&&S(I),z}function T(O){var _;return((_=n.get(O))==null?void 0:_.result)??null}function $(O){return s.add(O),()=>s.delete(O)}function R(){return l}function L(){d=!1}function B(){d=!0,f++,s.clear();for(const O of t.values())O.timer&&(clearInterval(O.timer),O.timer=void 0),O.loading=!1,O.needsRefetch=!1;n.clear()}return{evaluateQueries:b,getResult:k,isLoading:j,isAnyLoading:C,invalidate:S,registerMutations:N,fireMutation:E,getMutationResult:T,subscribe:$,getSnapshot:R,activate:L,dispose:B}}function x5(){const e=new Map,t=new Set;let n={};function r(){const m=[...t];for(const v of m)v()}function s(){n=Object.fromEntries(e)}function l(m){return e.get(m)}function c(m,v){const b=e.get(m);if(!Object.is(b,v)){if(v&&b&&typeof v=="object"&&typeof b=="object"&&!Array.isArray(v)&&!Array.isArray(b)){const k=Object.keys(v),j=Object.keys(b);if(k.length===j.length&&k.every(C=>Object.is(v[C],b[C])))return}e.set(m,v),s(),r()}}function d(m){return t.add(m),()=>{t.delete(m)}}function f(){return n}function h(m,v){for(const b of Object.keys(v))e.set(b,v[b]);for(const b of Object.keys(m))e.has(b)||e.set(b,m[b]);s(),r()}function g(){e.clear(),t.clear(),n={}}return{get:l,set:c,subscribe:d,getSnapshot:f,initialize:h,dispose:g}}function Oa(e){return q6(e)}function w5(e){return X6(e)}const MC=w.createContext(null);function LC(){const e=w.useContext(MC);if(!e)throw new Error("useOpenUI must be used within a <Renderer /> component.");return e}function k5(){return LC().renderNode}w.createContext(void 0);function Qh(e){return e&&typeof e=="object"&&!Array.isArray(e)&&"value"in e?e.value:e}function S5({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:s,initialState:l,toolProvider:c,onError:d},f){const h=w.useMemo(()=>d5(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(Z){return g.current={source:"parser",code:"parse-exception",message:`Parser crashed: ${Z instanceof Error?Z.message:String(Z)}`,hint:"The response may contain syntax the parser cannot handle"},null}},[h,e]),v=w.useMemo(()=>x5(),[]),b=w.useMemo(()=>b5(c??null),[c]);w.useEffect(()=>(b.activate(),()=>b.dispose()),[b]);const k=w.useRef(Symbol());w.useEffect(()=>{if(!(m!=null&&m.stateDeclarations)&&!l)return;const Z=`${JSON.stringify(m==null?void 0:m.stateDeclarations)}::${JSON.stringify(l)}`;if(k.current===Z)return;k.current=Z;const Y={};if(l)for(const[W,D]of Object.entries(l))W.startsWith("$")?Y[W]=D:v.set(W,D);v.initialize((m==null?void 0:m.stateDeclarations)??{},Y)},[m==null?void 0:m.stateDeclarations,v,l]);const j=w.useSyncExternalStore(v.subscribe,v.getSnapshot,v.getSnapshot),C=w.useSyncExternalStore(b.subscribe,b.getSnapshot,b.getSnapshot),S=w.useMemo(()=>({getState:Z=>Qh(v.get(Z)),resolveRef:Z=>{const Y=b.getMutationResult(Z);return Y||b.getResult(Z)}}),[v,b]);w.useEffect(()=>{if(n)return;const Z=((m==null?void 0:m.queryStatements)??[]).map(Y=>{const W={};if(Y.deps)for(const D of Y.deps)W[D]=j[D];return{statementId:Y.statementId,toolName:Y.toolAST?vt(Y.toolAST,S):"",args:Y.argsAST?vt(Y.argsAST,S):null,defaults:Y.defaultsAST?vt(Y.defaultsAST,S):null,refreshInterval:Y.refreshAST?vt(Y.refreshAST,S):void 0,deps:Object.keys(W).length>0?W:void 0,complete:Y.complete}});b.evaluateQueries(Z)},[n,m==null?void 0:m.queryStatements,S,b,j]),w.useEffect(()=>{if(n)return;const Z=((m==null?void 0:m.mutationStatements)??[]).map(Y=>({statementId:Y.statementId,toolName:Y.toolAST?vt(Y.toolAST,S):""}));b.registerMutations(Z)},[n,m==null?void 0:m.mutationStatements,S,b]);const N=w.useRef({onAction:r,onStateUpdate:s,onError:d});N.current={onAction:r,onStateUpdate:s,onError:d};const E=w.useRef(m);E.current=m;const T=w.useRef(null);w.useEffect(()=>(T.current=v.getSnapshot(),v.subscribe(()=>{var Y,W;const Z=v.getSnapshot();Z!==T.current&&(T.current=null,(W=(Y=N.current).onStateUpdate)==null||W.call(Y,Z))})),[v]);const $=w.useCallback((Z,Y)=>{if(!Z)return Qh(v.get(Y));const W=v.get(Z);if(!(!W||typeof W!="object"||Array.isArray(W)))return Qh(W[Y])},[v]),R=w.useCallback((Z,Y,W,D,U=!0)=>{var M,ee;const G={value:D,componentType:Y};if(!Z)v.set(W,G);else{const ce=v.get(Z),oe=ce&&typeof ce=="object"&&!Array.isArray(ce)?ce:{};v.set(Z,{...oe,[W]:G})}U&&((ee=(M=N.current).onStateUpdate)==null||ee.call(M,v.getSnapshot()))},[v]),L=w.useCallback(Z=>{if(Z){const Y=v.get(Z);if(Y&&typeof Y=="object"&&!Array.isArray(Y))return{[Z]:Y}}return v.getSnapshot()},[v]),B=w.useCallback(async(Z,Y,W)=>{var M,ee,ce;const D=L(Y),{onAction:U}=N.current;if(W&&!("steps"in W)){const oe=W.type||zu.ContinueConversation,be={...W.params||{}};W.url&&(be.url=W.url),W.context&&(be.context=W.context),U==null||U({type:oe,params:be,humanFriendlyMessage:Z,formState:D,formName:Y});return}const G=W;if(G!=null&&G.steps){for(const oe of G.steps)switch(oe.type){case Pa.Run:if(oe.refType==="mutation"){const be=(ee=(M=E.current)==null?void 0:M.mutationStatements)==null?void 0:ee.find(Ne=>Ne.statementId===oe.statementId),Re=be!=null&&be.argsAST?vt(be.argsAST,S):{};if(!await b.fireMutation(oe.statementId,Re))return}else b.invalidate([oe.statementId]);break;case Pa.ToAssistant:U==null||U({type:zu.ContinueConversation,params:oe.context?{context:oe.context}:{},humanFriendlyMessage:oe.message,formState:D,formName:Y});break;case Pa.OpenUrl:U==null||U({type:zu.OpenUrl,params:{url:oe.url},humanFriendlyMessage:"",formState:D,formName:Y});break;case Pa.Set:{if(!oe.valueAST){console.warn(`[openui] Set action for ${oe.target} has no valueAST — skipping`);break}const be=vt(oe.valueAST,S);v.set(oe.target,be);break}case Pa.Reset:{const be=((ce=E.current)==null?void 0:ce.stateDeclarations)??{};for(const Re of oe.targets)v.set(Re,be[Re]??null);break}}return}U==null||U({type:zu.ContinueConversation,params:{},humanFriendlyMessage:Z,formState:D,formName:Y})},[b,S,L,v]),O=w.useRef([]),_=w.useRef(n);_.current=n;const I=w.useCallback(Z=>{_.current||O.current.push(Z)},[]),F=w.useMemo(()=>({library:t,renderNode:f,triggerAction:B,isStreaming:n,getFieldValue:$,setFieldValue:R,store:v,evaluationContext:S,reportError:I}),[t,f,n,B,$,R,v,S,I]),K=w.useRef([]),z=w.useMemo(()=>{if(!(m!=null&&m.root))return m;const Z=[],Y={ctx:S,library:t,store:v,errors:Z};try{const W=_C(m.root,Y);return K.current=Z,{...m,root:W}}catch(W){const D=W instanceof Error?W.message:String(W);return Z.push({source:"runtime",code:"runtime-error",message:`Prop evaluation failed: ${D}`}),K.current=Z,m}},[m,S,t,v,j,C]),q=C.__openui_loading.length>0,V=w.useRef("");return w.useEffect(()=>{var W,D,U,G;if(n){V.current!==""&&(V.current="",(D=(W=N.current).onError)==null||D.call(W,[]));return}const Z=[];g.current&&Z.push(g.current),e&&!(m!=null&&m.root)&&!g.current&&Z.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&&Z.push(...f5(m.meta.errors,t.toJSONSchema(),Object.keys(t.components))),Z.push(...K.current),Z.push(...O.current),O.current=[],Z.push(...C.__openui_errors??[]);const Y=JSON.stringify(Z);if(Y!==V.current){if(V.current=Y,N.current.onError)N.current.onError(Z);else if(Z.length>0)for(const M of Z)console.warn(`[openui] ${M.source}/${M.code}: ${M.message}`)}},[n,e,m,z,C,t]),{result:z,parseResult:m,contextValue:F,isQueryLoading:q}}var j5=class extends w.Component{constructor(t){super(t);pn(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 DC(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:DC(t)},n));if(typeof e=="object"&&e!==null){const t=e;if(t.type==="element")return o.jsx(IC,{node:t})}return null}function IC({node:e}){var s;const{library:t,reportError:n}=LC(),r=(s=t.components[e.typeName])==null?void 0:s.component;return r?o.jsx(j5,{componentName:e.typeName,onError:n,children:o.jsx(C5,{el:e,Comp:r})}):null}function C5({el:e,Comp:t}){const n=k5();return o.jsx(t,{props:e.props,renderNode:n})}let Iw=!1;function N5(){if(Iw||typeof document>"u")return;Iw=!0;const e=document.createElement("style");e.textContent="@keyframes openui-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }",document.head.appendChild(e)}const E5=()=>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 A5({response:e,library:t,isStreaming:n=!1,onAction:r,onStateUpdate:s,initialState:l,onParseResult:c,toolProvider:d,queryLoader:f,onError:h}){w.useInsertionEffect(()=>{N5()},[]);const g=w.useRef(c);g.current=c;const m=w.useRef(d);m.current=d;const v=w.useRef({async callTool(S,N){const E=m.current??null;if(E==null)throw new Error("[openui] toolProvider is null");if(typeof E.callTool=="function")return v5(await E.callTool({name:S,arguments:N}));const T=E,$=T[S];if(!$)throw new eg(S,Object.keys(T));return $(N)}}),{result:b,parseResult:k,contextValue:j,isQueryLoading:C}=S5({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:s,initialState:l,toolProvider:d!=null?v.current:null,onError:h},DC);return w.useEffect(()=>{var S;(S=g.current)==null||S.call(g,k)},[k]),b!=null&&b.root?o.jsx(MC.Provider,{value:j,children:o.jsxs("div",{style:{position:"relative"},children:[C&&(f??o.jsx(E5,{})),o.jsx("div",{style:{opacity:C?.7:1,transition:"opacity 0.2s ease"},children:o.jsx(IC,{node:b.root})})]})}):null}w.createContext(null);function T5(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 R5=({props:e,renderNode:t})=>{const n=e.children;return o.jsxs("div",{className:"v10-genui-root",children:[e.title?o.jsx("div",{className:"v10-genui-root-title",children:e.title}):null,Array.isArray(n)?n.map((r,s)=>o.jsx(Ve.Fragment,{children:t(r)},s)):t(n)]})},_5=({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]})},O5=({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))}),M5=({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:Cv(t.predicate)}),o.jsx("div",{className:"v10-genui-triple-object",children:F5(t.object)})]},n))})]}),L5=({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))})]}),D5=({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:["· ",Cv(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))})]}),I5=({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(Uu,{label:"Files",value:e.fileCount}),typeof e.classCount=="number"&&o.jsx(Uu,{label:"Classes",value:e.classCount}),typeof e.functionCount=="number"&&o.jsx(Uu,{label:"Functions",value:e.functionCount}),typeof e.interfaceCount=="number"&&o.jsx(Uu,{label:"Interfaces",value:e.interfaceCount})]})]}),z5=({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:q5(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]})]}),$5=({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(Bu,{heading:"Context",body:e.context}):null,e.outcome?o.jsx(Bu,{heading:"Outcome",body:e.outcome}):null,e.consequences?o.jsx(Bu,{heading:"Consequences",body:e.consequences}):null,e.alternatives?o.jsx(Bu,{heading:"Alternatives considered",body:e.alternatives}):null]}),P5=({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=T5(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]}),U5=({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]})]}),B5=({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(Ki,{label:"tx",value:zw(e.onChain.txHash),mono:!0}):null,e.onChain.blockNumber?o.jsx(Ki,{label:"block",value:String(e.onChain.blockNumber),mono:!0}):null,e.onChain.chain?o.jsx(Ki,{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??H5(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(Ki,{label:"ual",value:e.knowledgeAsset.ual,mono:!0}):null,e.knowledgeAsset.contentHash?o.jsx(Ki,{label:"hash",value:zw(e.knowledgeAsset.contentHash),mono:!0}):null,e.knowledgeAsset.tracLocked?o.jsx(Ki,{label:"trac",value:e.knowledgeAsset.tracLocked}):null,e.knowledgeAsset.tokenId?o.jsx(Ki,{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]})]})},Uu=({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})]}),Bu=({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})]}),Ki=({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 Cv(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 F5(e){return Cv(e).replace(/\^\^<?.*$/,"").replace(/^"(.+)"$/,"$1")}function zw(e){return e?e.length<=16?e:`${e.slice(0,8)}…${e.slice(-6)}`:""}function H5(e){return e?e.length>22?`${e.slice(0,12)}…${e.slice(-6)}`:e:""}function q5(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}const G5=Oa({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:Ut({title:$e().optional().describe("Optional top-of-panel title override (defaults to the entity rdfs:label)")}),component:R5}),V5=Oa({name:"EntityCard",description:"Compact header card for any entity: name, rdf:type label, optional subtitle, and up to 6 small stat chips.",props:Ut({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:zr(Ut({label:$e(),value:$e(),tone:yo(["default","success","warn","danger","info"]).optional()})).max(6).optional()}),component:_5}),W5=Oa({name:"EntityStatsGrid",description:"Grid of numeric stats with labels. Use for summarising counts (files, classes, additions, deletions).",props:Ut({stats:zr(Ut({label:$e(),value:wv([$e(),ir()]),hint:$e().optional()})).min(1).max(8)}),component:O5}),Z5=Oa({name:"TripleTable",description:"Fallback raw-triples table. Use sparingly — only when the entity has no better structured components in this library.",props:Ut({heading:$e().optional(),rows:zr(Ut({predicate:$e(),object:$e()})).max(60)}),component:M5}),K5=Oa({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:Ut({heading:$e().optional(),groups:zr(Ut({typeLabel:$e(),icon:$e().optional(),items:zr(Ut({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(30)})).max(8)}),component:L5}),Y5=Oa({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:Ut({heading:$e().describe('Human-readable heading (e.g. "Imports", "Affected files")'),predicate:$e().optional(),items:zr(Ut({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(40)}),component:D5}),Q5=Oa({name:"PackageCard",description:"Specialised card for a code:Package entity: name, folder, description, and a mini-stats strip.",props:Ut({name:$e(),folder:$e().optional(),description:$e().optional(),fileCount:ir().optional(),classCount:ir().optional(),functionCount:ir().optional(),interfaceCount:ir().optional()}),component:I5}),X5=Oa({name:"FileCard",description:"Specialised card for a code:File entity: path, language, line count, owning package.",props:Ut({path:$e(),language:$e().optional(),lineCount:ir().optional(),packageName:$e().optional()}),component:z5}),J5=Oa({name:"DecisionCard",description:"Specialised card for a decisions:Decision entity: title, status badge, date, context/outcome quoted sections.",props:Ut({title:$e(),status:yo(["proposed","accepted","rejected","superseded"]).optional(),date:$e().optional(),context:$e().optional(),outcome:$e().optional(),consequences:$e().optional(),alternatives:$e().optional()}),component:$5}),eP=Oa({name:"PRCard",description:"Specialised card for a github:PullRequest entity: title + #number, state, author, merged badge, body preview.",props:Ut({title:$e(),number:ir().optional(),state:yo(["open","closed","merged"]).optional(),author:$e().optional(),mergedAt:$e().optional(),body:$e().optional(),url:$e().optional()}),component:P5}),tP=Oa({name:"TaskCard",description:"Specialised card for a tasks:Task entity: title, status chip, priority, assignee, estimate.",props:Ut({title:$e(),status:yo(["todo","in_progress","blocked","done","cancelled"]).optional(),priority:yo(["p0","p1","p2","p3"]).optional(),assignee:$e().optional(),estimate:ir().optional()}),component:U5}),nP=Oa({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:Ut({onChain:Ut({txHash:$e().optional(),blockNumber:wv([$e(),ir()]).optional(),chain:$e().optional()}).optional(),consensus:Ut({signers:zr(Ut({did:$e(),label:$e().optional(),reputation:ir().optional(),signature:$e().optional()})).max(10).optional(),quorum:$e().optional().describe('e.g. "3 of 5"')}).optional(),knowledgeAsset:Ut({ual:$e().optional(),contentHash:$e().optional(),tracLocked:$e().optional(),tokenId:$e().optional()}).optional(),timeline:zr(Ut({label:$e(),at:$e()})).max(6).optional()}),component:B5}),zC=w5({components:[G5,V5,W5,Z5,K5,Y5,Q5,X5,J5,eP,tP,nP],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 aP(){return Xh===null&&(Xh=zC.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*rP(e){const t=await fetch("/api/genui/render",{method:"POST",headers:{"Content-Type":"application/json",...Ht()},body:JSON.stringify({contextGraphId:e.contextGraphId,entityUri:e.entityUri,libraryPrompt:e.libraryPrompt}),signal:e.signal});if(!t.ok||!t.body){let l=`HTTP ${t.status}`;try{const c=await t.json();c!=null&&c.error&&(l=c.error)}catch{}yield{type:"error",error:l};return}const n=t.body.getReader(),r=new TextDecoder;let s="";try{for(;;){const{value:l,done:c}=await n.read();if(c)break;s+=r.decode(l,{stream:!0});let d;for(;(d=s.indexOf(`
|
|
1622
|
+
|
|
1623
|
+
`))!==-1;){const f=s.slice(0,d);s=s.slice(d+2);const h=$w(f);h&&(yield h)}}if(s.trim()){const l=$w(s);l&&(yield l)}}finally{n.releaseLock()}}function $w(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 iP=({contextGraphId:e,entityUri:t,placeholder:n,fallback:r})=>{const[s,l]=Ve.useState(""),[c,d]=Ve.useState(!0),[f,h]=Ve.useState(null);return Ve.useEffect(()=>{const g=new AbortController;let m="";return l(""),h(null),d(!0),(async()=>{try{const v=aP();for await(const b of rP({contextGraphId:e,entityUri:t,libraryPrompt:v,signal:g.signal}))if(b.type==="delta")m+=b.text,l(m);else if(b.type==="final")b.content&&(m=b.content,l(b.content));else if(b.type==="error"){h(b.error);break}else if(b.type==="done")break}catch(v){v.name!=="AbortError"&&h(v.message)}finally{d(!1)}})(),()=>g.abort()},[e,t]),f?r?o.jsx(o.Fragment,{children:r(f)}):o.jsx(oP,{error:f}):!s&&c?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(A5,{response:s,library:zC,isStreaming:c})})},sP="LLM not configured",oP=({error:e})=>{const t=hn(r=>r.openTab);return e.includes(sP)?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 Pw({entity:e,profile:t}){const n=w.useMemo(()=>{for(const d of e.subGraphs)if(d!=="meta")return d;return null},[e.subGraphs]);if(!n||!t)return null;const r=t.forSubGraph(n),s=(r==null?void 0:r.color)??"#64748b",l=(r==null?void 0:r.icon)??"•",c=(r==null?void 0:r.displayName)??n;return o.jsxs("span",{className:"v10-subgraph-badge",style:{"--sg-color":s},title:`In sub-graph: ${c}`,children:[o.jsx("span",{className:"v10-subgraph-badge-icon",style:{color:s},children:l}),o.jsx("span",{className:"v10-subgraph-badge-label",children:c})]})}function lP({entity:e,contextGraphId:t,onVerified:n}){const r=Pr(),[s,l]=w.useState(!1),[c,d]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState(null),v=e.trustLevel,b=w.useMemo(()=>{if(!r)return null;for(const E of e.types){const T=r.forType(E);if(T&&(v==="working"&&(T.promoteLabel||T.promoteHint)||v==="shared"&&(T.publishLabel||T.publishHint)))return T}return null},[e.types,r,v]),k=w.useMemo(()=>{if(!r)return null;for(const E of e.subGraphs){if(E==="meta")continue;const T=r.forSubGraph(E);if(T!=null&&T.sourceAssertion)return{binding:T,subGraph:E}}return null},[e.subGraphs,r]);if(v==="verified"||!b)return null;const j=v==="working"?{kind:"promote",label:b.promoteLabel??"Promote to Shared Memory",hint:b.promoteHint??"Shares the complete owning Knowledge Asset with the team.",busyCopy:"Sharing…",disabled:!(k!=null&&k.binding.sourceAssertion),disabledReason:k!=null&&k.binding.sourceAssertion?null:`No sourceAssertion declared on the sub-graph profile — add profile:sourceAssertion to the SubGraphBinding for "${[...e.subGraphs].filter(E=>E!=="meta")[0]??"?"}".`}:{kind:"publish",label:b.publishLabel??"Verify on DKG",hint:b.publishHint??"Publishes the complete owning Knowledge Asset on-chain.",busyCopy:"Anchoring…",disabled:!(k!=null&&k.binding.sourceAssertion),disabledReason:k!=null&&k.binding.sourceAssertion?null:"This entity is not part of a named Shared-Memory asset, so it cannot be published to Verifiable Memory from here."},C=async()=>{if(j.disabled)return;l(!0),m(null),d(null),h(j.kind);const E=(k==null?void 0:k.binding.sourceAssertion)??"assertion";try{if(j.kind==="promote"){const T=await ho(t,k.binding.sourceAssertion,k.subGraph?{subGraphName:k.subGraph}:{});d(Bg(E,T))}else{const T=await Pg(t,k.binding.sourceAssertion,k.subGraph?{subGraphName:k.subGraph}:{});d(T)}n()}catch(T){const $=j.kind==="promote"?mo(E,T):null,R=$?$.message:(T==null?void 0:T.message)??"Action failed";m(R)}finally{l(!1)}},S=E=>!!E&&"status"in E,N=E=>!!E&&"kind"in E;return o.jsxs("div",{className:`v10-ka-verify v10-ka-verify-${j.kind}`,children:[o.jsxs("div",{className:"v10-ka-verify-head",children:[o.jsx("span",{className:"v10-ka-verify-arrow",children:j.kind==="promote"?"◈":"◉"}),o.jsx("span",{className:"v10-ka-verify-title",children:j.label})]}),o.jsx("div",{className:"v10-ka-verify-hint",children:j.hint}),j.disabledReason&&o.jsxs("div",{className:"v10-ka-verify-err",children:["! ",j.disabledReason]}),!c&&o.jsx("button",{className:`v10-ka-verify-btn ${j.kind}`,onClick:C,disabled:s||j.disabled,children:s?j.busyCopy:j.label}),g&&o.jsxs("div",{className:"v10-ka-verify-err",children:["✕ ",g]}),c&&f==="promote"&&N(c)&&c.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:["✓ ",c.promotedCount," triple",c.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."})]}),c&&f==="promote"&&N(c)&&c.kind!=="success"&&o.jsxs("div",{className:"v10-ka-verify-err",children:["! ",c.message]}),c&&f==="publish"&&S(c)&&(()=>{var $,R;const E=c.status==="confirmed"&&!!c.txHash,T=E&&!!c.contextGraphError;return o.jsxs("div",{className:E?T?"v10-ka-verify-warn":"v10-ka-verify-ok":"v10-ka-verify-err",children:[o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Status"}),o.jsxs("span",{className:"v10-ka-verify-ok-val",children:[E?T?"⚠":"✓":"✕"," ",c.status,E?T?` (${VR})`:"":" (NOT on-chain)"]})]}),T&&o.jsx("div",{className:"v10-ka-verify-hint",style:{marginTop:6},children:ql(c.contextGraphError)}),c.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:c.txHash,children:c.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"})]}),c.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:["#",c.blockNumber]})]}),((R=($=c.kas)==null?void 0:$[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:["#",c.kas[0].tokenId]})]})]})})()]})}function cP({entity:e,allEntities:t,allTriples:n,onNavigate:r,onClose:s,contextGraphId:l,onRefresh:c,onOpenAgent:d}){const[f,h]=w.useState("content"),g=Kn(z=>z.theme),m=Pr(),v=ds(),{icon:b,type:k}=Wd(e,m),j=pL(e),C=Vd(e),S=C?(v==null?void 0:v.get(C))??null:null,N=e.trustLevel==="verified"?"vm":e.trustLevel==="shared"?"swm":"wm",E=e.trustLevel==="verified"?"Verifiable Memory":e.trustLevel==="shared"?"Shared Working Memory":"Working Memory",T=sr(e.trustLevel,1),$=w.useMemo(()=>{const z=[];for(const[,q]of t)for(const V of q.connections)V.targetUri===e.uri&&z.push({pred:Js(V.predicate),entity:q});return z},[e.uri,t]),R=w.useMemo(()=>n.filter(z=>xt(z.subject)===e.uri||xt(z.object)===e.uri),[e.uri,n]),L=w.useMemo(()=>fL(e.uri,n,1),[e.uri,n]),B=w.useMemo(()=>{const z=new Set;for(const q of t.values())xj(q)&&z.add(xt(q.uri));return z},[t]),O=w.useMemo(()=>new Set([xt(e.uri)]),[e.uri]),_=w.useMemo(()=>xd(L,B,{focalSubjects:O}),[L,B,O]),I=w.useMemo(()=>{const z=Xi[e.trustLevel];return{labelMode:"humanized",renderer:"2d",labels:qd({minZoomForLabels:.2}),style:{namespaceColors:av(z),defaultNodeColor:z,defaultEdgeColor:"#475569",edgeWidth:1,fontSize:11},hexagon:{baseSize:7,minSize:4,maxSize:10,scaleWithDegree:!0},focus:{maxNodes:500,hops:999}}},[e.trustLevel]),F=w.useMemo(()=>({name:`entity-${e.uri}-${g}`,palette:g,focal:{uri:e.uri,sizeMultiplier:2.4}}),[e.uri,g]),K=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:T}),o.jsxs("div",{className:"v10-ka-name",children:[b," ",e.label,o.jsx("span",{className:`v10-trust-badge ${N}`,children:E})]}),o.jsxs("div",{className:"v10-ka-ual",children:[e.uri," · ",k," · ",K," triples"]})]}),(S||C)&&o.jsxs("div",{className:"v10-ka-header-author",children:[o.jsx("div",{className:"v10-ka-header-author-label",children:"Proposed by"}),o.jsx(as,{agent:S??void 0,fallbackUri:C??void 0,size:"lg",showOperator:!0,onOpenAgent:d})]})]}),o.jsxs("div",{className:"v10-ka-split",children:[o.jsxs("div",{className:"v10-ka-left",children:[o.jsxs("div",{className:"v10-content-tabs",style:{margin:"0 -20px",padding:"0 20px",background:"transparent"},children:[o.jsx("button",{className:`v10-content-tab ${f==="content"?"active":""}`,onClick:()=>h("content"),children:"Content"}),o.jsx("button",{className:`v10-content-tab ${f==="triples"?"active":""}`,onClick:()=>h("triples"),children:"Triples"}),o.jsx("button",{className:`v10-content-tab ${f==="graph"?"active":""}`,onClick:()=>h("graph"),children:"Graph"})]}),f==="content"&&o.jsxs(o.Fragment,{children:[!e.types.map(q=>m==null?void 0:m.forType(q)).find(q=>q==null?void 0:q.detailHint)||!(m!=null&&m.contextGraphId)?null:o.jsx("div",{className:"v10-ka-section",children:o.jsx(iP,{contextGraphId:m.contextGraphId,entityUri:e.uri})}),j&&o.jsx("div",{className:"v10-ka-section",children:o.jsx("div",{className:"v10-ka-desc",children:o.jsx("p",{children:j})})}),e.properties.size>0&&o.jsxs("div",{className:"v10-ka-section",children:[o.jsx("div",{className:"v10-ka-section-title",children:"Properties"}),[...e.properties].map(([z,q])=>o.jsxs("div",{className:"v10-ka-prop",children:[o.jsx("span",{className:"v10-ka-prop-key",children:Js(z)}),o.jsx("span",{className:"v10-ka-prop-val",children:q.join(", ")})]},z))]}),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((z,q)=>{const V=t.get(z.targetUri);return o.jsxs("button",{className:"v10-ka-conn",onClick:()=>r(z.targetUri),children:[o.jsx("span",{className:"v10-ka-conn-pred",children:Js(z.predicate)}),o.jsx("span",{className:"v10-ka-conn-arrow",children:"→"}),o.jsx("span",{className:"v10-ka-conn-target",children:z.targetLabel}),V&&o.jsx(Pw,{entity:V,profile:m})]},q)})]}),$.length>0&&o.jsxs("div",{className:"v10-ka-section",children:[o.jsxs("div",{className:"v10-ka-section-title",children:["Referenced by (",$.length,")"]}),$.map((z,q)=>o.jsxs("button",{className:"v10-ka-conn",onClick:()=>r(z.entity.uri),children:[o.jsx("span",{className:"v10-ka-conn-target",children:z.entity.label}),o.jsx(Pw,{entity:z.entity,profile:m}),o.jsx("span",{className:"v10-ka-conn-arrow",children:"→"}),o.jsx("span",{className:"v10-ka-conn-pred",children:z.pred})]},q))]}),o.jsxs("div",{className:"v10-ka-meta",children:[o.jsxs("span",{className:"v10-ka-meta-item",children:[b," ",k]}),o.jsxs("span",{className:"v10-ka-meta-item",children:[K," triples"]}),o.jsxs("span",{className:"v10-ka-meta-item",children:[e.connections.length," links"]})]})]}),f==="triples"&&o.jsxs("div",{style:{marginTop:8,overflowX:"auto",border:"1px solid var(--border-default)",borderRadius:6},children:[o.jsxs("table",{className:"v10-ka-triples-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Subject"}),o.jsx("th",{children:"Predicate"}),o.jsx("th",{children:"Object"})]})}),o.jsx("tbody",{children:R.slice(0,50).map((z,q)=>o.jsxs("tr",{children:[o.jsx("td",{title:z.subject,children:Js(z.subject)}),o.jsx("td",{title:z.predicate,children:Js(z.predicate)}),o.jsx("td",{title:z.object,children:z.object.startsWith('"')?Gd(z.object).slice(0,60):Js(z.object)})]},q))})]}),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(nd,{title:`${e.label} graph`,scopeLabel:`Entity detail graph: 1-hop neighborhood around ${e.label}.`,tone:N,className:"v10-ka-graph-shell",renderGraph:z=>_.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(uv,{data:_,format:"triples",options:I,viewConfig:F,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:q=>(q==null?void 0:q.id)&&q.id!==e.uri&&r(q.id),initialFit:!0,initialFocus:e.uri},`${e.uri}:${z?"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(zI,{contextGraphId:l,entityUri:e.uri,enabled:e.trustLevel==="verified"}),o.jsx("div",{className:"v10-ka-section-title",children:"Provenance Trail"}),o.jsx(uP,{entity:e}),o.jsx(lP,{entity:e,contextGraphId:l,onVerified:c}),o.jsxs("div",{style:{marginTop:16,padding:"10px 12px",borderRadius:6,background:"var(--bg-surface)",border:"1px solid var(--border-subtle)"},children:[o.jsx("div",{className:"v10-ka-section-title",style:{marginBottom:6},children:"Entity Summary"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4,fontSize:10},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Type"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:k})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Triples"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:K})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Links"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:e.connections.length})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Layer"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:E.split(" ")[0]})]})]})]})]})]})]})}function uP({entity:e}){const t=ds(),n=c=>{const d=cL(e,c),f=uL(e,c),h=d?t==null?void 0:t.get(d):null;return{uri:d,at:f,agent:h}},r=n("created"),s=n("promoted"),l=n("published");return o.jsxs("div",{className:"v10-ka-timeline",children:[e.trustLevel==="verified"&&o.jsx(Jh,{toneClass:"verified",title:"Published to Verifiable Memory",actionWord:"Published",agent:l.agent,agentUri:l.uri,at:l.at}),(e.trustLevel==="shared"||e.trustLevel==="verified")&&o.jsx(Jh,{toneClass:"shared",title:"Promoted to Shared Working Memory",actionWord:"Promoted",agent:s.agent,agentUri:s.uri,at:s.at}),o.jsx(Jh,{toneClass:"created",title:"Created in Working Memory",actionWord:"Created",agent:r.agent,agentUri:r.uri,at:r.at})]})}function Jh({toneClass:e,title:t,actionWord:n,agent:r,agentUri:s,at:l}){const c=l?vL(l):null;return o.jsxs("div",{className:"v10-ka-event",children:[o.jsx("div",{className:`v10-ka-event-dot ${e}`}),o.jsxs("div",{className:"v10-ka-event-header",children:[o.jsx("span",{className:"v10-ka-event-title",children:t}),c&&o.jsx("time",{className:"v10-ka-event-time",dateTime:l??void 0,children:c})]}),(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(as,{agent:r??void 0,fallbackUri:s??void 0,size:"sm"})]})]})}function Uw(){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 dP({contextGraphId:e,memory:t,onNodeClick:n,onSelectSubGraph:r}){const s=Pr(),[l,c]=w.useState([]),[d,f]=w.useState(!0),[h,g]=w.useState(null);w.useEffect(()=>{let R=!1;return f(!0),g(null),Gg(e).then(L=>{R||c(L.subGraphs??[])}).catch(L=>{R||g(L instanceof Error?L.message:"Failed to load subgraphs")}).finally(()=>{R||f(!1)}),()=>{R=!0}},[e]);const{total:m}=iv(t),v=Object.values(t.layerStatus??{}),b=t.loading||v.some(R=>R==="loading"),k=t.error!==null||t.partial||v.some(R=>R==="error"),j=w.useMemo(()=>{const R=new Map;for(const L of t.entityList){const B=xt(L.uri);for(const O of L.subGraphs){let _=R.get(O);_||(_=new Set,R.set(O,_)),_.add(B)}}return R},[t.entityList]),{triplesBySubGraph:C,tripleCountBySubGraph:S}=w.useMemo(()=>{const R=new Map;for(const O of t.allTriples){if(!O.subGraph)continue;let _=R.get(O.subGraph);_||(_=[],R.set(O.subGraph,_)),_.push(O)}for(const O of t.allTriples)if(!O.subGraph){for(const[_,I]of j)if(Pm(O,{slug:_,isRoot:!1,scopedUris:I})){let F=R.get(_);F||(F=[],R.set(_,F)),F.push(O)}}const L=new Map,B=new Map;for(const[O,_]of R){const F=Um(_,t.entities).map(K=>({subject:K.subject,predicate:K.predicate,object:K.object}));B.set(O,F.length),L.set(O,W1(F))}return{triplesBySubGraph:L,tripleCountBySubGraph:B}},[t.allTriples,t.entities,j]),N=w.useMemo(()=>{const R=new Map;for(const L of t.entityList)for(const B of L.subGraphs){let O=R.get(B);O||(O={wm:0,swm:0,vm:0},R.set(B,O)),L.trustLevel==="verified"?O.vm++:L.trustLevel==="shared"?O.swm++:O.wm++}return R},[t.entityList]),E=w.useMemo(()=>{const R=new Map;for(const L of t.entityList){const B=xt(L.uri);for(const O of L.subGraphs){let _=R.get(O);_||(_=new Map,R.set(O,_)),_.set(B,L.trustLevel),B!==L.uri&&_.set(L.uri,L.trustLevel)}}return R},[t.entityList]),T=w.useMemo(()=>l.filter(sv).map(R=>{const L=(s==null?void 0:s.forSubGraph(R.name))??{},B=C.get(R.name)??[],O=j.get(R.name)??new Set,_=E.get(R.name)??new Map;return{slug:R.name,icon:L.icon??"•",color:L.color??"#64748b",displayName:L.displayName??R.name,description:L.description,rank:L.rank??99,entityCount:O.size>0?O.size:R.entityCount,tripleCount:S.get(R.name)??0,triples:xd(B,O),layerCounts:N.get(R.name)??{wm:0,swm:0,vm:0},entityTrustByUri:_}}).sort((R,L)=>R.rank-L.rank),[l,s,C,S,N,j,E]),$=w.useMemo(()=>{const R=[],L=new Set,B=new Map;let O=0,_=0,I=0;for(const Y of t.entityList){if(Y.subGraphs.size>0)continue;R.push(Y);const W=xt(Y.uri);L.add(W),B.set(W,Y.trustLevel),W!==Y.uri&&B.set(Y.uri,Y.trustLevel),Y.trustLevel==="verified"?I++:Y.trustLevel==="shared"?_++:O++}const F=t.allTriples.filter(Y=>!Y.subGraph),K=Um(F,t.entities).map(Y=>({subject:Y.subject,predicate:Y.predicate,object:Y.object})),z=K.length,q=xd(K,L),V=W1(q),Z=(s==null?void 0:s.forSubGraph($a))??{};return{slug:$a,icon:Z.icon??"⊘",color:Z.color??"#64748b",displayName:Z.displayName??"Root",description:Z.description,rank:999,entityCount:R.length,tripleCount:z,triples:V,layerCounts:{wm:O,swm:_,vm:I},entityTrustByUri:B}},[t.entityList,t.allTriples,t.entities,s]);return d&&T.length===0?o.jsx(cn,{compact:!0,icon:"#",title:"Loading subgraphs...",className:"v10-sgov-state"}):h&&T.length===0?o.jsx(cn,{icon:"!",title:"Couldn't load subgraphs.",description:"Refresh the page to try again.",tone:"danger",className:"v10-sgov-state"}):T.length===0&&$.entityCount===0?o.jsx(cn,{icon:"#",title:"No subgraphs in this Context Graph yet.",description:o.jsxs(o.Fragment,{children:["A subgraph is a named topical slice of this Context Graph (e.g. ",o.jsx("code",{children:"recipes"}),", ",o.jsx("code",{children:"decisions"}),"). Agents create one when they scope an assertion to a subgraph. All current entities live in the Context Graph root."]}),actions:[{label:"View root",onClick:()=>r($a),variant:"primary"}],className:"v10-sgov-state"}):o.jsxs("div",{className:"v10-sgov",children:[o.jsxs("div",{className:"v10-sgov-header",children:[o.jsx("div",{className:"v10-sgov-title",children:"Subgraphs"}),o.jsxs("div",{className:"v10-sgov-sub",children:[T.length," named subgraphs · ",t.counts.total," entities · ",m," triples"]})]}),o.jsxs("div",{className:"v10-sgov-grid",children:[T.map(R=>o.jsx(Bw,{card:R,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>r(R.slug)},R.slug)),o.jsx(Bw,{card:$,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>r($a),variant:"root"},$a)]})]})}function Bw({card:e,isHydrating:t=!1,isFailedOrPartial:n=!1,onNodeClick:r,onOpen:s,variant:l}){const c=w.useMemo(()=>{const h={};for(const[g,m]of e.entityTrustByUri)h[g]=Xi[m];return h},[e.entityTrustByUri]),d=w.useMemo(()=>({labelMode:"humanized",renderer:"2d",labels:qd({minZoomForLabels:.8}),style:{classColors:Nj,predicateColors:Ej,namespaceColors:av(e.color),...Object.keys(c).length>0?{nodeColors:c}:{},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,c]),f=l==="root";return o.jsxs("div",{className:`v10-sgov-card${f?" root":""}`,style:f?void 0:{"--sg-color":e.color,borderColor:e.color+"55"},children:[o.jsxs("div",{className:"v10-sgov-card-head",children:[o.jsx("span",{className:"v10-sgov-card-icon",style:f?void 0:{color:e.color},children:e.icon}),o.jsxs("div",{className:"v10-sgov-card-title-wrap",children:[o.jsx("div",{className:"v10-sgov-card-title",children:e.displayName}),e.description&&o.jsx("div",{className:"v10-sgov-card-desc",title:e.description,children:e.description})]}),o.jsx("button",{type:"button",className:"v10-sgov-card-open",onClick:s,title:`Focus on ${e.displayName}`,children:"↗"})]}),o.jsxs("div",{className:"v10-sgov-card-stats",children:[o.jsxs("span",{className:"v10-sgov-card-stat",children:[o.jsx("b",{children:e.entityCount})," entities"]}),o.jsxs("span",{className:"v10-sgov-card-stat",title:t&&e.tripleCount===0?"Loading triples for this subgraph…":n?e.tripleCount===0?"Some layers unavailable; count may be incomplete.":`${e.tripleCount} triples (some layers unavailable; count may be incomplete).`:t?`${e.tripleCount} triples (still loading; count may grow).`:e.tripleCount!==e.triples.length?`${e.tripleCount} triples in this subgraph's scope; ${e.triples.length} rendered (some in-scope edges aren't drawn — either endpoints outside this subgraph, or cap-trimmed in dense buckets).`:void 0,children:[o.jsx("b",{children:t&&e.tripleCount===0?"…":e.tripleCount})," triples"]})]}),o.jsx("div",{className:"v10-sgov-card-pyramid",children:o.jsx($C,{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(uv,{data:e.triples,format:"triples",options:d,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:r,initialFit:!0})})})]})}function $C({counts:e,activeLayers:t,onClickLayer:n,compact:r=!1}){const s=e.wm+e.swm+e.vm;if(s===0)return r?null:o.jsx("div",{className:"v10-minibar v10-minibar-empty",children:"No data"});const l=[{key:"verified",short:"VM",count:e.vm,color:"#22c55e",label:"Verifiable"},{key:"shared",short:"SWM",count:e.swm,color:"#f59e0b",label:"Shared"},{key:"working",short:"WM",count:e.wm,color:"#64748b",label:"Working"}],c=!!n;return o.jsxs("div",{className:`v10-minibar${r?" compact":""}`,children:[!r&&o.jsx("div",{className:"v10-minibar-bar",children:l.filter(d=>d.count>0).map(d=>{const f=d.count/s*100,h=t?t.has(d.key):!0;return o.jsx("div",{className:`v10-minibar-seg${h?"":" dim"}`,style:{width:`${f}%`,background:d.color},title:`${d.label}: ${d.count}`},d.key)})}),o.jsx("div",{className:"v10-minibar-legend",children:l.map(d=>{const f=t?t.has(d.key):!0;return o.jsxs("button",{type:"button",className:`v10-minibar-chip${f?"":" dim"}${c?" interactive":""}`,onClick:c?()=>n(d.key):void 0,disabled:!c,title:`${d.label} Memory — ${d.count} entities${c?" (click to toggle)":""}`,children:[o.jsx("span",{className:"v10-minibar-dot",style:{background:d.color}}),o.jsx("span",{className:"v10-minibar-short",children:d.short}),o.jsx("span",{className:"v10-minibar-count",children:d.count})]},d.key)})})]})}function pP({items:e,color:t,onSelectEntity:n,scrollKey:r}){const s=Pr(),l=ds(),c=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(cn,{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:c.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:yL(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}=Wd(h,s),v=Vd(h),b=v?l==null?void 0:l.get(v):null;return o.jsxs("button",{className:"v10-subgraph-timeline-item",onClick:()=>n(h.uri),title:`${h.label} · ${g.toISOString().slice(0,10)}`,children:[o.jsx("span",{className:"v10-subgraph-timeline-item-icon",children:m}),o.jsx("span",{className:"v10-subgraph-timeline-item-label",children:h.label}),(b||v)&&o.jsx(as,{agent:b??void 0,fallbackUri:v??void 0,size:"sm"}),o.jsx("span",{className:"v10-subgraph-timeline-item-date",children:g.toISOString().slice(0,10)})]},h.uri)})})]},d))})}function fP({slug:e,rawMemory:t,contextGraphId:n,onNodeClick:r,onSelectEntity:s,activeTab:l,onTabChange:c,initialLayer:d,initialEnabledLayers:f,onEnabledLayersChange:h}){const g=Pr(),m=g==null?void 0:g.forSubGraph(e),v=(g==null?void 0:g.chipsFor(e))??[],b=(g==null?void 0:g.savedQueryCatalogsFor(e))??[],k=m==null?void 0:m.timelinePredicate,[j,C]=w.useState("items"),S=l??j,N=S==="timeline"&&!k?"items":S,E=c??C,[T,$]=w.useState(m!=null&&m.timelinePredicate?"created-desc":"triples");w.useEffect(()=>{$(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]),[L,B]=w.useState(R);w.useEffect(()=>{h==null||h(L)},[L,h]);const[O,_]=w.useState(new Map),[I,F]=w.useState(null),[K,z]=w.useState(null),[q,V]=w.useState(!1),[Z,Y]=w.useState(null),W=e===$a,D=w.useMemo(()=>{const H=[];for(const se of t.entityList)(W?se.subGraphs.size===0:se.subGraphs.has(e))&&H.push(se);return H},[t.entityList,e,W]),U=w.useMemo(()=>new Set(D.map(H=>H.uri)),[D]),G=w.useMemo(()=>t.graphTriples.filter(H=>Pm(H,{slug:e,isRoot:W,scopedUris:U})),[t.graphTriples,U,e,W]),M=w.useMemo(()=>{let H=0,se=0,pe=0;for(const Le of D)Le.trustLevel==="verified"?pe++:Le.trustLevel==="shared"?se++:H++;return{wm:H,swm:se,vm:pe,total:D.length}},[D]),ee=w.useMemo(()=>{if(L.size!==1)return null;const H=L.values().next().value;return H==="verified"?"vm":H==="shared"?"swm":H==="working"?"wm":null},[L]),ce=w.useMemo(()=>{let H=D;if(L.size<3&&(H=H.filter(se=>L.has(se.trustLevel))),O.size>0)for(const se of v){const pe=O.get(se.slug);!pe||pe.size===0||(H=H.filter(Le=>{const He=Le.properties.get(se.predicate);return!He||He.length===0?!1:He.some(Ce=>pe.has(Ce))}))}return K&&(H=H.filter(se=>K.has(se.uri))),H},[D,L,O,v,K]),oe=w.useMemo(()=>new Set(ce.map(H=>H.uri)),[ce]),be=w.useMemo(()=>ce.length===D.length?G:G.filter(H=>oe.has(H.subject)||oe.has(H.object)),[G,D,ce,oe]),Ne=w.useMemo(()=>{if(!ee)return null;const H=ee==="vm"?"verified":ee==="swm"?"shared":"working",se=D.filter(Ce=>{if(!Ce.layers.has(H))return!1;if(O.size>0)for(const Fe of v){const tt=O.get(Fe.slug);if(!tt||tt.size===0)continue;const Ee=Ce.properties.get(Fe.predicate);if(!Ee||Ee.length===0||!Ee.some(Zt=>tt.has(Zt)))return!1}return!(K&&!K.has(Ce.uri))}),pe=new Set(se.map(Ce=>Ce.uri)),Le=new Set,He=[];for(const Ce of t.allTriples){if(Ce.layer!==H||!Pm(Ce,{slug:e,isRoot:W,scopedUris:U,requireResourceObject:!0})||!(pe.has(Ce.subject)||pe.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},[ee,t.allTriples,U,e,W,D,v,O,K])??be,De=w.useMemo(()=>{if(ee){const H=ee==="vm"?"verified":ee==="swm"?"shared":"working";return D.filter(se=>{if(!se.layers.has(H))return!1;if(O.size>0)for(const pe of v){const Le=O.get(pe.slug);if(!Le||Le.size===0)continue;const He=se.properties.get(pe.predicate);if(!He||He.length===0||!He.some(Ce=>Le.has(Ce)))return!1}return!(K&&!K.has(se.uri))})}return ce},[ee,D,ce,v,O,K]),We=w.useMemo(()=>De.map(H=>({uri:H.uri,label:H.label})),[De]),Se=w.useMemo(()=>{if(ee)return;const H={};for(const se of De){H[se.uri]=Xi[se.trustLevel];const pe=xt(se.uri);pe!==se.uri&&(H[pe]=Xi[se.trustLevel])}return H},[ee,De]),ft=L.size===3?"All layers":ee?$n[ee].title:Array.from(L).map(H=>$n[H==="verified"?"vm":H==="shared"?"swm":"wm"].trustLabel).join(" + "),Ie=w.useMemo(()=>{if(!k)return[];const H=[];for(const se of ce){const pe=td(se,k);pe!=null&&H.push({entity:se,date:new Date(pe)})}return H.sort((se,pe)=>se.date.getTime()-pe.date.getTime()),H},[ce,k]),qe=w.useMemo(()=>{const H=[...ce];if((T==="created-desc"||T==="created-asc")&&k){const se=T==="created-desc"?-1:1;return H.sort((pe,Le)=>{const He=td(pe,k),Ce=td(Le,k);return He==null&&Ce==null?0:He==null?1:Ce==null?-1:(He-Ce)*se}),H}return T==="label"?(H.sort((se,pe)=>(se.label??"").localeCompare(pe.label??"")),H):(H.sort((se,pe)=>{const Le=se.tripleCount??0;return(pe.tripleCount??0)-Le}),H)},[ce,T,k]),ke=T==="created-desc"?"newest first · click to open":T==="created-asc"?"oldest first · click to open":T==="label"?"A → Z · click to open":"sorted by triples · click to open",lt=w.useCallback(H=>{B(se=>{const pe=new Set(se);return pe.has(H)?pe.size>1&&pe.delete(H):pe.add(H),pe})},[]),ye=w.useCallback((H,se)=>{_(pe=>{const Le=new Map(pe),He=new Set(Le.get(H)??[]);return He.has(se)?He.delete(se):He.add(se),He.size===0?Le.delete(H):Le.set(H,He),Le})},[]),Oe=w.useCallback(()=>{F(null),z(null),Y(null)},[]),Lt=w.useCallback(async H=>{var se;V(!0),Y(null),F(H.slug);try{const pe=await ua(H.sparql,n),Le=((se=pe==null?void 0:pe.result)==null?void 0:se.bindings)??[],He=H.resultColumn||"uri",Ce=new Set;for(const Fe of Le){const tt=Fe[He];if(!tt)continue;const Ee=typeof tt=="string"?tt:String(tt),Zt=Ee.startsWith("<")&&Ee.endsWith(">")?Ee.slice(1,-1):Ee;Ce.add(Zt)}z(Ce)}catch(pe){Y((pe==null?void 0:pe.message)??String(pe)),z(null),F(null)}finally{V(!1)}},[n]),$t=(m==null?void 0:m.color)??(W?"var(--text-tertiary)":"#64748b"),Qt=(m==null?void 0:m.icon)??"•",Gt=(m==null?void 0:m.displayName)??e,ut=m==null?void 0:m.description;w.useEffect(()=>{B(R),_(new Map),Oe()},[e,Oe,R]),w.useEffect(()=>{l||C("items")},[e,l]),w.useEffect(()=>{S!==N&&E(N)},[S,N,E]);const X=!(L.size===R.size&&[...L].every(H=>R.has(H)))||O.size>0||!!K,fe=()=>{B(new Set(R)),_(new Map),Oe()};return o.jsxs("div",{className:"v10-layer-detail v10-subgraph-detail",style:{"--sg-color":$t},children:[o.jsxs("div",{className:"v10-subgraph-detail-header",children:[o.jsx("span",{className:"v10-subgraph-detail-icon",style:{color:$t},children:Qt}),o.jsxs("div",{className:"v10-subgraph-detail-title-wrap",children:[o.jsx("div",{className:"v10-subgraph-detail-title",children:Gt}),ut&&o.jsx("div",{className:"v10-subgraph-detail-desc",children:ut})]}),o.jsx($C,{counts:{wm:M.wm,swm:M.swm,vm:M.vm},activeLayers:L,onClickLayer:lt,compact:!0})]}),o.jsxs("div",{className:"v10-subgraph-cross-layer",children:[o.jsx("div",{className:"v10-subgraph-cross-layer-lede",children:W?"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":L.has("working"),onClick:()=>lt("working"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Xi.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:M.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":L.has("shared"),onClick:()=>lt("shared"),title:ee==="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:Xi.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:M.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":L.has("verified"),onClick:()=>lt("verified"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Xi.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:M.vm})]})]}),o.jsxs("span",{className:`v10-subgraph-active-layer-pill${L.size===3?" all-layers":""}`,"data-testid":"active-layer-pill",children:[o.jsx("span",{className:"v10-subgraph-active-layer-pill-label",children:"Active layer:"}),o.jsx("span",{className:"v10-subgraph-active-layer-pill-value",children:ft})]})]}),b.length>0&&o.jsxs("div",{className:"v10-subgraph-savedqueries",children:[o.jsx("span",{className:"v10-subgraph-savedqueries-label",children:"Query catalog"}),b.map(H=>o.jsxs(Ve.Fragment,{children:[o.jsx("span",{className:"v10-subgraph-savedqueries-label",title:H.description||H.name,style:{marginLeft:8,opacity:.8},children:H.name}),H.queries.map(se=>{const pe=I===se.slug;return o.jsxs("button",{type:"button",className:`v10-subgraph-savedquery${pe?" active":""}`,onClick:()=>pe?Oe():Lt(se),title:se.description||se.name,disabled:q&&!pe,children:[o.jsx("span",{className:"v10-subgraph-savedquery-glyph",children:q&&pe?"…":pe?"✓":"◎"}),se.name]},se.slug)})]},H.slug)),Z&&o.jsx("span",{className:"v10-subgraph-savedquery-error",title:Z,children:"✕ query failed"}),K&&I&&o.jsxs("span",{className:"v10-subgraph-savedquery-count",children:[K.size," match",K.size===1?"":"es"]})]}),v.length>0&&o.jsxs("div",{className:"v10-subgraph-filters",children:[v.map(H=>{const se=O.get(H.slug)??new Set;return o.jsxs("div",{className:"v10-subgraph-filter-row",children:[o.jsx("span",{className:"v10-subgraph-filter-label",children:H.label}),o.jsx("div",{className:"v10-subgraph-filter-chips",children:H.values.map(pe=>{const Le=se.has(pe);return o.jsx("button",{type:"button",className:`v10-subgraph-filter-chip${Le?" active":""}`,onClick:()=>ye(H.slug,pe),children:pe},pe)})})]},H.slug)}),X&&o.jsx("button",{type:"button",className:"v10-subgraph-filter-reset",onClick:fe,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 ${N==="items"?"active":""}`,onClick:()=>E("items"),children:["Entities (",ce.length,ce.length!==D.length?` / ${D.length}`:"",")"]}),o.jsx("button",{className:`v10-layer-expand-tab ${N==="graph"?"active":""}`,onClick:()=>E("graph"),children:"Graph"}),k&&o.jsx("button",{className:`v10-layer-expand-tab ${N==="timeline"?"active":""}`,onClick:()=>E("timeline"),children:"Timeline"}),o.jsx("button",{className:`v10-layer-expand-tab ${N==="docs"?"active":""}`,onClick:()=>E("docs"),children:"Documents"})]}),N==="items"&&o.jsx("div",{className:"v10-layer-expand-body entities-tab","data-cg-scroll-key":`subgraph:${e}:items`,children:o.jsx(Gj,{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:T,onChange:H=>$(H.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)"})]})]})})}),N==="graph"&&o.jsx("div",{className:"v10-layer-expand-body full-width","data-cg-scroll-key":`subgraph:${e}:graph`,children:o.jsx(Fj,{layer:ee??"wm",triples:Ne,onNodeClick:r,contextGraphId:n,title:Gt,scopeLabel:`Subgraph graph: ${Gt} entities and entity-to-entity triples from loaded subgraph data.`,trustLegendActiveLayer:ee,scopeEntities:We,layerEntities:De,nodeColorsOverride:Se})}),N==="timeline"&&k&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(pP,{items:Ie,color:$t,onSelectEntity:s,scrollKey:`subgraph:${e}:timeline`})}),N==="docs"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(Vj,{entities:ce,contextGraphId:n,scrollKey:`subgraph:${e}:docs`})})]})]})}const hP={wm:"items",swm:"items",vm:"items"},Fw={wm:"working",swm:"shared",vm:"verified"};function em(e){return e==="wm"||e==="swm"||e==="vm"}function mP(e){const t=new Set;return e.filter(n=>{const r=`${xt(n.subject)}|${n.predicate}|${xt(n.object)}`;return t.has(r)?!1:(t.add(r),!0)})}function Hw(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 gP({contextGraphId:e}){const{data:t,error:n,loading:r,refresh:s}=da(_n.fetchContextGraphs,[],3e4),[l,c]=w.useState(!1),[d,f]=w.useState(!1),[h,g]=w.useState("overview"),[m,v]=w.useState(null),[b,k]=w.useState({contextGraphId:null,list:[],status:"loading"}),[j,C]=w.useState(null),[S,N]=w.useState(!1),E=w.useRef(0),[T,$]=w.useState(null),[R,L]=w.useState(null),B=w.useRef(null),[O,_]=w.useState(null),I=w.useCallback(ue=>{B.current=ue,_(ue)},[]),F=w.useRef(null),K=w.useCallback(ue=>{F.current=ue,ue===null&&(B.current=null,_(null)),$(ue)},[]),[z,q]=w.useState(null),V=w.useRef(null);w.useEffect(()=>{V.current=m},[m]);const[Z,Y]=w.useState(hP),[W,D]=w.useState({}),U=w.useRef(null),G=w.useRef(null),M=w.useRef(null),ee=w.useRef(0),ce=VL(e),oe=XL(e),be=hn(ue=>ue.openTab),{data:Re,loading:Ne,error:De}=Fd(),We=w.useCallback(()=>T?`subgraph:${T}:${W[T]??"items"}`:em(h)?`layer:${h}:${Z[h]}`:"page",[h,T,Z,W]),Se=w.useCallback(ue=>{const je=ue??We(),Ae=Hw(je,U.current);return{activeLayer:h,activeSubGraph:T,layerTabs:{...Z},subGraphTabs:{...W},scroll:{key:je,top:(Ae==null?void 0:Ae.scrollTop)??0},subGraphEnabledLayers:T!==null&&B.current?new Set(B.current):null}},[h,T,We,Z,W]),ft=w.useCallback(ue=>{const je=()=>{const Ae=Hw(ue.key,U.current);Ae&&(Ae.scrollTop=ue.top)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(je):setTimeout(je,0)},[]),Ie=w.useCallback((ue,je)=>{(!V.current||!G.current)&&(G.current=Se(je)),v(ue)},[Se]),qe=w.useCallback(()=>{G.current=null},[]);w.useEffect(()=>{if(m)return;const ue=M.current;ue&&(M.current=null,ft(ue))},[m,h,T,Z,W,ft]),w.useEffect(()=>{const ue=je=>{const Ae=je.detail;Ae&&Ae.contextGraphId===e&&typeof Ae.entityUri=="string"&&(q(null),Ie(Ae.entityUri))};return window.addEventListener("v10:open-entity",ue),()=>window.removeEventListener("v10:open-entity",ue)},[e,Ie]);const ke=w.useCallback(ue=>{var Ze;const je=ue.startsWith("urn:dkg:agent:")?ue.slice(14):ue,Ae=((Ze=oe.get(ue))==null?void 0:Ze.name)??je;be({id:`agent:${e}|${je}`,label:`@ ${Ae}`,closable:!0})},[oe,e,be]),lt=w.useMemo(()=>({...oe,openAgent:ke}),[oe,ke]),ye=w.useMemo(()=>{var ue;return(ue=t==null?void 0:t.contextGraphs)==null?void 0:ue.find(je=>je.id===e)},[t,e]),Oe=nv(e,{signalErrors:!0}),Lt=iv(Oe).total,$t=tL({activeLayer:h,activeSubGraph:T}),Qt=$j($t?e:void 0),Gt=!T&&h==="overview",ut=sD(Gt?e:void 0),xe=Gt?ut.resultContextGraphId===e?ut.events:[]:void 0,X=Gt&&ut.resultContextGraphId===e?ut.error:null,fe=w.useCallback(()=>{const ue=ye==null?void 0:ye.id;if(!ue)return;const je=ee.current+1;ee.current=je,k({contextGraphId:ue,list:[],status:"loading"}),_n.listParticipants(ue).then(Ae=>{ee.current===je&&k({contextGraphId:ue,list:Ae.allowedAgents,status:"ok"})}).catch(()=>{ee.current===je&&k({contextGraphId:ue,list:[],status:"error"})})},[ye==null?void 0:ye.id]);w.useEffect(()=>{fe()},[fe]);const H=w.useCallback(()=>{const ue=++E.current;_n.fetchSubGraphs(e).then(je=>{if(E.current!==ue)return;const Ae=(je.subGraphs??[]).filter(sv).length;C(Ae),N(!1)}).catch(()=>{E.current===ue&&(C(null),N(!0))})},[e]);w.useEffect(()=>{C(null),N(!1),H()},[H]),Co(e,H);const se=z?Fw[z]:null,pe=w.useMemo(()=>se?Oe.allTriples.filter(ue=>ue.layer===se):Oe.graphTriples,[Oe.allTriples,Oe.graphTriples,se]),Le=w.useMemo(()=>se?mP(pe):pe,[pe,se]),He=w.useMemo(()=>se?bj(pe):Oe.entities,[pe,Oe.entities,se]),Ce=w.useMemo(()=>m?He.get(m)??null:null,[m,He]);w.useEffect(()=>{!m||Ce||Oe.loading||(v(null),q(null),qe())},[m,Ce,Oe.loading,qe]);const Fe=w.useCallback((ue,je)=>{const Ae=F.current;if(qe(),K(ue),ue===null)L(null);else if(je!==void 0){const Ze=new Set([Fw[je]]);L(Ze),B.current=Ze,_(Ze)}else{if(Ae!==null&&ue===Ae)return;if(Ae!==null&&B.current){const Ze=new Set(B.current);L(Ze),B.current=Ze,_(Ze)}else L(null),B.current=null,_(null)}v(null),q(null)},[qe,K]),tt=w.useCallback(ue=>{qe(),g(ue),v(null),q(null),K(null),L(null)},[qe,K]),Ee=w.useCallback((ue,je)=>{Y(Ae=>Ae[ue]===je?Ae:{...Ae,[ue]:je})},[]),Zt=w.useCallback((ue,je)=>{D(Ae=>Ae[ue]===je?Ae:{...Ae,[ue]:je})},[]),_t=w.useCallback((ue,je,Ae)=>{const Ze=V.current!=null;Ie(ue,je),q(Ye=>Ae??(Ze?Ye:null))},[Ie]),qa=w.useCallback(()=>{const ue=G.current;if(G.current=null,v(null),q(null),!!ue){if(g(ue.activeLayer),K(ue.activeSubGraph),ue.activeSubGraph!==null&&ue.subGraphEnabledLayers){const je=new Set(ue.subGraphEnabledLayers);L(je),B.current=je,_(je)}Y(ue.layerTabs),D(ue.subGraphTabs),M.current=ue.scroll}},[K]),ha=w.useCallback(ue=>{if(!(ue!=null&&ue.id))return;const je=em(ue.trustLayer)?ue.trustLayer:void 0;_t(ue.id,void 0,je)},[_t]),Br=w.useCallback(ue=>{const je=em(h)?h:void 0;_t(ue,void 0,je)},[h,_t]),Fr=w.useCallback(ue=>{_t(ue,"page")},[_t]),ma=w.useCallback(()=>{be(Uj)},[be]),Ga=!!n&&/authentication|unauthor|expired|sign in|log in/i.test(n);if(!ye)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?Ga?n:"Failed to load context graph.":"Context graph not found."}),Ga?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 ur=T?ce.forSubGraph(T):null,Hr=!Oe.loading&&!Oe.error&&!Oe.partial?Oe.entityList:void 0,Ei=Ce?"entity":T?"subgraph":h,me=b.contextGraphId===ye.id?b.list:[],Me=b.contextGraphId===ye.id?b.status:"loading";return o.jsx(Dj.Provider,{value:ce,children:o.jsx(zj.Provider,{value:lt,children:o.jsxs("div",{className:"v10-memory-explorer",children:[n&&o.jsx("div",{className:"v10-stale-banner",role:"status",children:Ga?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(UD,{cg:ye,profile:ce,activeSubGraph:ur,onClearSubGraph:()=>Fe(null)}),o.jsx(PD,{active:h,counts:Oe.counts,onSwitch:tt,onShare:()=>f(!0),onImport:()=>c(!0),onRefresh:Oe.refresh}),o.jsxs("main",{className:"v10-memory-explorer-page","data-view":Ei,"data-cg-scroll-key":"page",ref:U,children:[Ce&&o.jsx(cP,{entity:Ce,allEntities:He,allTriples:Le,onNavigate:_t,onClose:qa,contextGraphId:e,onRefresh:Oe.refresh}),T&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(Uw,{}),o.jsx(Hh,{contextGraphId:e,profile:ce,selected:T,entities:Hr,onSelect:Fe,enabledScope:O??void 0,allTriplesTotal:Lt}),o.jsx(fP,{slug:T,rawMemory:Oe,contextGraphId:e,onNodeClick:ha,onSelectEntity:_t,activeTab:W[T]??"items",onTabChange:ue=>Zt(T,ue),initialEnabledLayers:R??void 0,onEnabledLayersChange:I})]}),!T&&h==="overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(VD,{cg:ye,memory:Oe,subGraphCount:j,subGraphFetchFailed:S,participants:me,participantsStatus:Me,currentAgent:Re??null,currentAgentStatus:Ne?"loading":De?"error":"ok",onSwitchLayer:tt,onOpenPrimer:ma}),o.jsx(WD,{contextGraphId:e,curatorStatus:qD({cg:ye,currentAgent:Re??null,currentAgentStatus:Ne?"loading":De?"error":"ok"}),onParticipantsChanged:fe}),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(CD,{entities:Oe.entityList,lifecycleEvents:xe,lifecycleError:X,onSelectEntity:Fr,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(ZD,{onOpenPrimer:ma})]}),!T&&h==="graph-overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(Uw,{}),o.jsx(Hh,{contextGraphId:e,profile:ce,selected:null,entities:Hr,onSelect:Fe,allTriplesTotal:Lt}),o.jsx(dP,{contextGraphId:e,memory:Oe,onNodeClick:ha,onSelectSubGraph:Fe})]}),!T&&h==="query"&&!Ce&&o.jsx(CI,{contextGraphId:e}),!T&&(h==="wm"||h==="swm"||h==="vm")&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(Hh,{contextGraphId:e,profile:ce,selected:T,entities:Hr,onSelect:Fe,layer:h}),o.jsx(pI,{layer:h,memory:Oe,onNodeClick:ha,onSelectEntity:Br,contextGraphId:e,activeTab:Z[h],onTabChange:ue=>Ee(h,ue),swmAttribution:Qt})]})]}),o.jsx(OL,{open:l,onClose:()=>c(!1),contextGraphId:ye.id,contextGraphName:ye.name}),o.jsx(LL,{open:d,onClose:()=>f(!1),contextGraphId:ye.id,contextGraphName:ye.name})]})})})}const vP=[{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 yP(){const e=hn(n=>n.closeTab),t=Ve.useCallback(()=>e(cv),[e]);return Ve.useEffect(()=>{const n=r=>{r.key==="Escape"&&(r.preventDefault(),t())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),o.jsxs("div",{className:"v10-primer-view",children:[o.jsxs("header",{className:"v10-primer-header",children:[o.jsx("button",{type:"button",className:"v10-primer-back",onClick:t,"aria-label":"Close primer and return to the previous tab",children:"← Back"}),o.jsx("p",{className:"v10-primer-kicker",children:"Context Graph Primer"}),o.jsx("h1",{children:"What is a Context Graph?"}),o.jsx("p",{children:"A Context Graph is a shared knowledge workspace where agents stage, review, organize, and publish structured memory."})]}),o.jsxs("section",{className:"v10-primer-pipeline","aria-label":"Context Graph pipeline",children:[o.jsx("span",{className:"wm",children:"Working Memory"}),o.jsx("span",{className:"connector","aria-hidden":"true"}),o.jsx("span",{className:"swm",children:"Shared Working Memory"}),o.jsx("span",{className:"connector","aria-hidden":"true"}),o.jsx("span",{className:"vm",children:"Verifiable Memory"})]}),o.jsx("div",{className:"v10-primer-sections",children:vP.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 bP={"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 qw(e){const t=bP[e];return t?t==="markdown"?"text":t:"binary"}async function Gw(e){const t=await fetch(e,{headers:Ht()});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=await t.blob();return URL.createObjectURL(n)}function xP({open:e,onClose:t,assertionName:n,contextGraphId:r,subGraphName:s}){const[l,c]=w.useState(null),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,v]=w.useState(!0),[b,k]=w.useState(null);w.useEffect(()=>{if(e)return v(!0),k(null),c(null),f(null),g(null),GR(n,r,s).then(async T=>{c(T);const $=qw(T.detectedContentType),R=Yu(T.fileHash,T.detectedContentType);if($==="text"){const L=await fetch(R,{headers:Ht()});L.ok&&f(await L.text())}else if($==="pdf"||$==="image"){const L=await Gw(R);g(L)}}).catch(T=>k(T.message??"Failed to load file info")).finally(()=>v(!1)),()=>{h&&URL.revokeObjectURL(h)}},[e,n,r,s]),w.useEffect(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);const{dialogRef:j,onBackdropClick:C}=ts(e,t);if(!e)return null;const S=l?qw(l.detectedContentType):null,N=l?Yu(l.fileHash,l.detectedContentType):null,E=async(T,$)=>{try{const R=await Gw(T),L=document.createElement("a");L.href=R,L.download=$,L.click(),URL.revokeObjectURL(R)}catch{window.open(T,"_blank")}};return o.jsx("div",{className:"v10-modal-overlay",onClick:C,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box v10-file-preview-modal",ref:j,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-file-preview-title",children:[o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-file-preview-title",className:"v10-modal-title",children:n}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close file preview",title:"Close (Esc)",children:"×"})]}),m&&o.jsx("div",{className:"v10-file-preview-loading",children:"Loading file preview..."}),b&&o.jsxs("div",{className:"v10-file-preview-error",children:[o.jsx("p",{children:b}),o.jsx("p",{style:{fontSize:11,marginTop:4},children:"File preview requires the extraction status to still be cached on the node. If the node was restarted, the preview metadata may be unavailable."})]}),l&&!m&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-file-preview-meta",children:[o.jsx("span",{className:"v10-file-preview-meta-item",children:l.detectedContentType}),o.jsxs("span",{className:"v10-file-preview-meta-item",children:[l.tripleCount," triples extracted"]}),o.jsx("span",{className:"v10-file-preview-meta-item",children:l.pipelineUsed}),l.completedAt&&o.jsx("span",{className:"v10-file-preview-meta-item",children:new Date(l.completedAt).toLocaleString()})]}),o.jsxs("div",{className:"v10-file-preview-content",children:[S==="pdf"&&h&&o.jsx("iframe",{src:h,className:"v10-file-preview-iframe",title:`Preview: ${n}`}),S==="image"&&h&&o.jsx("img",{src:h,alt:n,className:"v10-file-preview-image"}),S==="text"&&d!=null&&o.jsx("pre",{className:"v10-file-preview-text",children:d}),S==="binary"&&o.jsxs("div",{className:"v10-file-preview-binary",children:[o.jsx("p",{children:"This file type cannot be previewed directly."}),N&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>E(N,n),children:"Download file"})]})]}),o.jsxs("div",{className:"v10-file-preview-footer",children:[N&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>E(N,n),children:"Download original"}),l.mdIntermediateHash&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>E(Yu(l.mdIntermediateHash,"text/markdown"),`${n}.md`),children:"Download markdown intermediate"})]})]})]})})}const wP=w.lazy(()=>gt(()=>import("./index-5DS6xjw0.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),kP=w.lazy(()=>gt(()=>import("./index-5DS6xjw0.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.NodePanel}))),SP=w.lazy(()=>gt(()=>import("./OnChainProvenanceCard-DboMX4Aq.js"),__vite__mapDeps([2,0,1])).then(e=>({default:e.OnChainProvenanceCard}))),jP={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."}},CP={labelMode:"humanized",renderer:"2d",labels:qd({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}},NP=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"})]}),EP=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 tm({layer:e,contextGraphId:t,externalQuery:n,externalQueryKey:r,queryPresetOptions:s}){var De,We;const l=jP[e],[c,d]=w.useState("graph"),[f,h]=w.useState(""),[g,m]=w.useState(""),[v,b]=w.useState(""),[k,j]=w.useState(""),[C,S]=w.useState("any"),[N,E]=w.useState(50),[T,$]=w.useState(""),[R,L]=w.useState("any"),[B,O]=w.useState(50),[_,I]=w.useState(e!=="vm"),F=Ve.useRef(e);Ve.useEffect(()=>{F.current!==e&&(F.current=e,h(""),I(e!=="vm"),m(""),b(""),j(""),S("any"),E(50),$(""),L("any"),O(50))},[e]),Ve.useEffect(()=>{n!==void 0&&(h(""),m(n),b(n))},[n,r]);const K=w.useMemo(()=>e==="wm"?`SELECT ?s ?p ?o WHERE { GRAPH <${`did:dkg:context-graph:${t}/_meta`}> { ?g <http://dkg.io/ontology/memoryLayer> "WM" } GRAPH ?g { ?s ?p ?o } FILTER(!CONTAINS(STR(?g), "/meta/assertion/")) } LIMIT 1000`:e==="vm"?RP({query:T,field:R,limit:B}):"SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 500",[t,e,R,B,T]),z=v||K,q=e==="swm"?"_shared_memory":void 0,V=e==="swm",Z=e==="vm"?"verifiable-memory":void 0,Y=e==="wm"&&z===K,{data:W,loading:D,error:U,refresh:G}=da(()=>ua(z,t,V,q,Z,Y),[z,t,V,q,Z,Y],0);Co(t,G,{layers:[e]});const{data:M}=da(Dg,[],3e4),ee=M==null?void 0:M.blockExplorerUrl,ce=w.useCallback(()=>{const Se=g.trim();if(Se===v){G();return}b(Se)},[v,g,G]),oe=w.useCallback(()=>{const Se=k!==T||C!==R||N!==B;if(Se&&($(k),L(C),O(N)),v){b("");return}Se||G()},[v,R,B,T,C,N,k,G]),be=((De=W==null?void 0:W.result)==null?void 0:De.bindings)??((We=W==null?void 0:W.results)==null?void 0:We.bindings)??[],Re=w.useMemo(()=>be.map(Se=>({subject:to(Se.s)??"",predicate:to(Se.p)??"",object:to(Se.o)??""})).filter(Se=>Se.subject&&Se.predicate&&Se.object),[be]),Ne=w.useCallback(Se=>{Se!=null&&Se.id&&b(`SELECT (<${Se.id}> AS ?s) ?p ?o WHERE { <${Se.id}> ?p ?o } LIMIT 100`)},[]);return o.jsxs("div",{className:"v10-memory-layer-view",children:[o.jsxs("div",{className:"v10-mlv-header",children:[o.jsx("span",{className:"v10-mlv-icon",style:{color:l.color},children:l.icon}),o.jsxs("div",{children:[o.jsx("h2",{className:"v10-mlv-title",children:l.label}),o.jsx("p",{className:"v10-mlv-desc",children:l.description})]})]}),e==="wm"&&o.jsx(AP,{contextGraphId:t,onPromoted:G}),e==="swm"&&o.jsx(TP,{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:()=>I(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"&&oe()}}),o.jsxs("select",{className:"v10-vm-search-select",value:C,onChange:Se=>S(Se.target.value),children:[o.jsx("option",{value:"any",children:"Any field"}),o.jsx("option",{value:"subject",children:"Subject"}),o.jsx("option",{value:"predicate",children:"Predicate"}),o.jsx("option",{value:"object",children:"Object"})]}),o.jsxs("select",{className:"v10-vm-search-select",value:String(N),onChange:Se=>E(Number.parseInt(Se.target.value,10)||50),children:[o.jsx("option",{value:"25",children:"25 rows"}),o.jsx("option",{value:"50",children:"50 rows"}),o.jsx("option",{value:"100",children:"100 rows"}),o.jsx("option",{value:"200",children:"200 rows"})]}),o.jsx("button",{className:"v10-mlv-run-btn",onClick:oe,children:"Search"})]})]}),(e!=="vm"||_)&&o.jsxs("div",{className:"v10-mlv-query-bar",children:[s!=null&&s.length?o.jsxs("select",{className:"v10-vm-search-select",value:f,onChange:Se=>{const ft=Se.target.value;h(ft);const Ie=s.find(ke=>ke.label===ft),qe=(Ie==null?void 0:Ie.query)??"";m(qe),b(qe)},children:[o.jsx("option",{value:"",children:"Select common query..."}),s.map(Se=>o.jsx("option",{value:Se.label,children:Se.label},Se.label))]}):o.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Custom SPARQL query...",value:g,onChange:Se=>m(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&ce()}}),o.jsx("button",{className:"v10-mlv-run-btn",onClick:ce,children:"Run"}),v&&o.jsx("button",{className:"v10-mlv-clear-btn",onClick:()=>b(""),title:"Reset to full layer overview",children:"Reset"}),o.jsxs("div",{className:"v10-mlv-view-toggle",children:[o.jsx("button",{className:`v10-mlv-toggle-btn ${c==="table"?"active":""}`,onClick:()=>d("table"),title:"Table view",children:NP}),o.jsx("button",{className:`v10-mlv-toggle-btn ${c==="graph"?"active":""}`,onClick:()=>d("graph"),title:"Graph view",children:EP})]})]}),D&&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]}),!D&&be.length===0&&o.jsxs("div",{className:"v10-mlv-empty",children:[o.jsxs("p",{children:["No triples found in ",l.label.toLowerCase(),"."]}),o.jsxs("p",{style:{fontSize:11,marginTop:4},children:[e==="wm"&&"Import files or chat with your agent to generate working memory.",e==="swm"&&"Promote assertions from working memory to share with collaborators.",e==="vm"&&"Publish shared memory to create verified on-chain knowledge."]})]}),!D&&be.length>0&&c==="table"&&o.jsxs("div",{className:"v10-mlv-table-wrap",children:[o.jsxs("div",{className:"v10-mlv-result-count",children:[be.length," triples"]}),o.jsxs("table",{className:"v10-mlv-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Subject"}),o.jsx("th",{children:"Predicate"}),o.jsx("th",{children:"Object"})]})}),o.jsx("tbody",{children:be.map((Se,ft)=>o.jsxs("tr",{children:[o.jsx("td",{className:"v10-mlv-cell",children:nm(to(Se.s))}),o.jsx("td",{className:"v10-mlv-cell",children:nm(to(Se.p))}),o.jsx("td",{className:"v10-mlv-cell",children:nm(to(Se.o))})]},ft))})]})]}),!D&&Re.length>0&&c==="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"]}),v&&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(wP,{data:Re,format:"triples",options:CP,style:{width:"100%",height:"100%"},onNodeClick:Ne,initialFit:!0,children:[o.jsx(kP,{className:"v10-mlv-node-panel",showUri:!0,showTypes:!0,showProperties:!0,showMetadata:!1,maxValueLength:150}),o.jsx(SP,{contextGraphId:t,layer:e,explorerUrl:ee})]})})]})]})}function AP({contextGraphId:e,onPromoted:t}){const{data:n,loading:r,refresh:s}=da(()=>ac(e,"wm"),[e],0);Co(e,s,{layers:["wm"]});const[l,c]=w.useState(null),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,v]=w.useState(null),b=w.useCallback(async j=>{c(j.graphUri),f(null),g(null);try{const C=await ho(e,j.name,j.subGraph?{subGraphName:j.subGraph}:{}),S=Bg(j.name,C);f({message:S.message+(j.subGraph?` (in ${j.subGraph})`:""),kind:S.kind==="success"?"success":"noop",subGraph:j.subGraph}),s(),t()}catch(C){const S=mo(j.name,C);g(S?{message:S.message,kind:"not-persisted"}:{message:(C==null?void 0:C.message)??"Promote failed",kind:"other"})}finally{c(null)}},[e,s,t]),k=w.useCallback(async()=>{if(!(n!=null&&n.length))return;c("__all__"),f(null),g(null);let j=0,C=null;try{for(const E of n)C=E.name,(await ho(e,E.name,E.subGraph?{subGraphName:E.subGraph}:{})).promotedCount===0&&(j+=1);const S=n.length-j,N=j>0?` (${j} already shared or still committing)`:"";f({message:S>0?`Shared ${S} complete Knowledge Asset${S===1?"":"s"} to Shared Working Memory${N}.`:"No Knowledge Assets were newly shared — all were already in Shared Working Memory or still committing.",kind:S>0?"success":"noop"}),s(),t()}catch(S){const N=mo(C??"selected assertion",S);g(N?{message:N.message,kind:"not-persisted"}:{message:(S==null?void 0:S.message)??"Promote failed",kind:"other"})}finally{c(null)}},[n,e,s,t]);return r?o.jsx("div",{className:"v10-assertion-list-loading",children:"Loading assertions..."}):n!=null&&n.length?o.jsxs("div",{className:"v10-assertion-list",children:[o.jsxs("div",{className:"v10-assertion-list-header",children:[o.jsxs("span",{className:"v10-assertion-list-title",children:["Assertions in Working Memory (",n.length,")"]}),o.jsx("button",{className:"v10-btn-promote-all",disabled:l!==null,onClick:k,children:l==="__all__"?"Sharing...":"Share Complete KAs → SWM"})]}),o.jsx("div",{className:"v10-assertion-items",children:n.map(j=>o.jsxs("div",{className:"v10-assertion-item",children:[o.jsxs("div",{className:"v10-assertion-item-info",children:[o.jsx("button",{className:"v10-assertion-item-name clickable",title:j.graphUri,onClick:()=>v({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:["› ",fv(j.subGraph,18)]})]}),o.jsx("button",{className:"v10-btn-promote",disabled:l!==null,onClick:()=>b(j),title:"Share this complete Knowledge Asset to Shared Working Memory",children:l===j.graphUri?"Promoting...":"→ SWM"})]},j.graphUri))}),d&&o.jsx("div",{className:d.kind==="success"?"v10-promote-result success":"v10-promote-result info",children:d.message}),h&&o.jsx("div",{className:"v10-promote-result error",children:h.message}),m&&o.jsx(xP,{open:!0,onClose:()=>v(null),assertionName:m.name,subGraphName:m.subGraph,contextGraphId:e})]}):null}function TP({contextGraphId:e,onPublished:t}){const{data:n,loading:r,refresh:s}=da(()=>ac(e,"swm"),[e],0);Co(e,s,{layers:["swm"]});const[l,c]=w.useState(new Set),[d,f]=w.useState(!1),[h,g]=w.useState(null),[m,v]=w.useState(null),b=(n==null?void 0:n.map(L=>L.graphUri))??[],k=b.length>0&&b.every(L=>l.has(L)),j=w.useCallback(L=>{c(B=>{const O=new Set(B);return O.has(L)?O.delete(L):O.add(L),O})},[]),C=w.useCallback(()=>{c(k?new Set:new Set(b))},[k,b]),S=w.useCallback(async L=>{if(L.length!==0){f(!0),g(null),v(null);try{g(await Ug(e,L)),c(new Set),s(),t()}catch(B){v((B==null?void 0:B.message)??"Publish failed")}finally{f(!1)}}},[e,s,t]),N=w.useCallback(()=>{const L=(n??[]).filter(B=>l.has(B.graphUri));return S(L)},[n,l,S]),E=w.useCallback(()=>S(n??[]),[n,S]),T=(n==null?void 0:n.reduce((L,B)=>L+(B.tripleCount??0),0))??0,$=(n==null?void 0:n.filter(L=>l.has(L.graphUri)).reduce((L,B)=>L+(B.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"," · ",T," triples)"]}),o.jsxs("div",{className:"v10-publish-panel-header-actions",children:[o.jsx("button",{className:"v10-publish-panel-refresh",onClick:s,title:"Refresh",children:"↻"}),o.jsx("button",{className:"v10-btn-promote-all",disabled:d,onClick:E,children:d&&l.size===0?"Publishing...":"Publish All → VM"})]})]}),o.jsxs("div",{className:"v10-publish-select-bar",children:[o.jsxs("label",{className:"v10-publish-select-all",children:[o.jsx("input",{type:"checkbox",checked:k,onChange:C}),o.jsx("span",{children:"Select all"})]}),l.size>0&&o.jsx("button",{className:"v10-btn-publish",disabled:d,onClick:N,children:d?"Publishing...":`Publish ${l.size} selected (${$} triples) → VM`})]}),o.jsx("div",{className:"v10-assertion-items",children:n.map(L=>o.jsxs("div",{className:`v10-assertion-item ${l.has(L.graphUri)?"selected":""}`,children:[o.jsx("label",{className:"v10-publish-entity-check",children:o.jsx("input",{type:"checkbox",checked:l.has(L.graphUri),onChange:()=>j(L.graphUri)})}),o.jsxs("div",{className:"v10-assertion-item-info",children:[o.jsx("span",{className:"v10-assertion-item-name",title:L.graphUri,children:L.name}),L.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${L.subGraph}`,children:["› ",fv(L.subGraph,18)]}),L.tripleCount!=null&&o.jsxs("span",{className:"v10-assertion-item-count",children:[L.tripleCount," triples"]})]})]},L.graphUri))}),h&&(()=>{const{published:L,total:B,partial:O,partialError:_,failures:I,sample:F,convictionCostCovered:K}=h,z=L===B&&L>0&&O===0,q=(F==null?void 0:F.status)==="confirmed"&&!!F.txHash;return o.jsxs("div",{className:`v10-publish-result-card ${z?"success":"error"}`,children:[o.jsx("div",{className:"v10-publish-result-title",children:L>0?`Published ${L} of ${B} knowledge asset${B===1?"":"s"} to Verifiable Memory`:"NOT published to Verifiable Memory"}),O>0&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:["⚠ ",O," asset",O===1?"":"s",": ",ql(_)]}),I.length>0&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:[I.length," asset",I.length===1?"":"s"," could not be published — ",I[0].name,": ",I[0].error,I.length>1?` (+${I.length-1} more)`:""]}),o.jsxs("div",{className:"v10-publish-result-details",children:[(F==null?void 0:F.kaId)!=null&&o.jsxs("div",{children:[o.jsx("span",{className:"v10-publish-result-label",children:"Knowledge Asset:"})," ",F.kaId]}),q?o.jsxs("div",{className:"v10-publish-result-tx",children:[o.jsx("span",{className:"v10-publish-result-label",children:"Tx hash:"})," ",o.jsx("span",{className:"mono",title:F.txHash,children:F.txHash}),F.blockNumber!=null&&o.jsxs("span",{className:"v10-publish-result-block",children:[" (block ",F.blockNumber,")"]})]}):o.jsxs("div",{className:"v10-publish-result-details",children:["Verifiable Memory requires a confirmed ",o.jsx("code",{children:"KCCreated"})," event. If a publish did not land on-chain, check the node logs (typically a missing publisher wallet, an unfunded signer, or a chain adapter that isn't V10-ready)."]}),o.jsx(uj,{convictionCostCovered:K})]})]})})(),m&&o.jsx("div",{className:"v10-publish-result-card error",children:m})]})}function to(e){if(e!=null)return typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function nm(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 RP(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=_P(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 _P(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}const PC=[{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"}],OP=["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 MP(){const{contextGraphs:e}=Ta(),{hidden:t}=Jg(),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"}),PC.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(LP,{cg:r},r.id))]})]})}function LP({cg:e}){const t=nv(e.id),{openTab:n}=hn(),r=Mj(t),s=w.useMemo(()=>{const c={working:{entities:[],tripleCount:r.wm},shared:{entities:[],tripleCount:r.swm},verified:{entities:[],tripleCount:r.vm}};for(const d of t.entityList)c[d.trustLevel].entities.push(d);for(const d of Object.keys(c))c[d].entities.sort((f,h)=>{const g=tg(f),m=tg(h);return g&&m?m-g:g?-1:m?1:f.label.localeCompare(h.label)});return c},[t.entityList,r]),l=()=>n({id:`project:${e.id}`,label:e.name||e.id.slice(0,16),closable:!0});return o.jsxs("div",{className:"v10-memstack-row",children:[o.jsxs("div",{className:"v10-memstack-project",children:[o.jsxs("button",{type:"button",className:"v10-memstack-project-btn",onClick:l,children:[o.jsx("span",{className:"v10-memstack-project-dot"}),o.jsx("span",{className:"v10-memstack-project-name",children:e.name||e.id})]}),e.description&&o.jsx("div",{className:"v10-memstack-project-desc",title:e.description,children:e.description}),t.loading&&!t.entityList.length&&o.jsx("div",{className:"v10-memstack-project-status",children:"loading…"}),t.error&&o.jsx("div",{className:"v10-memstack-project-status error",children:t.error})]}),PC.map(c=>{const d=s[c.key];return o.jsx(DP,{cgId:e.id,color:c.color,layerTitle:c.title,tabPrefix:c.tabPrefix,entityCount:d.entities.length,tripleCount:d.tripleCount,recent:d.entities.slice(0,4),onOpenLayer:()=>n({id:`${c.tabPrefix}:${e.id}`,label:`${c.short} · ${e.name||e.id.slice(0,12)}`,closable:!0})},c.key)})]})}function DP({cgId:e,color:t,layerTitle:n,tabPrefix:r,entityCount:s,tripleCount:l,recent:c,onOpenLayer:d}){const f=s===0;return o.jsxs("div",{className:`v10-memstack-cell${f?" empty":""}`,style:{"--cell-color":t},children:[o.jsxs("div",{className:"v10-memstack-cell-stats",children:[o.jsx("span",{className:"v10-memstack-cell-n",children:s}),o.jsxs("span",{className:"v10-memstack-cell-n-lbl",children:["entit",s===1?"y":"ies"]}),o.jsx("span",{className:"v10-memstack-cell-sep",children:"·"}),o.jsx("span",{className:"v10-memstack-cell-t",children:l.toLocaleString()}),o.jsx("span",{className:"v10-memstack-cell-t-lbl",children:"triples"})]}),c.length>0?o.jsx("ul",{className:"v10-memstack-cell-recent",children:c.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:Pj(IP(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 tg(e){var t;for(const n of OP){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 IP(e){const t=tg(e);return t?new Date(t):null}function zP(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $P=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,PP=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,UP={};function Vw(e,t){return(UP.jsx?PP:$P).test(e)}const BP=/[ \t\n\f\r]/g;function FP(e){return typeof e=="object"?e.type==="text"?Ww(e.value):!1:Ww(e)}function Ww(e){return e.replace(BP,"")===""}class lc{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}lc.prototype.normal={};lc.prototype.property={};lc.prototype.space=void 0;function UC(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new lc(n,r,t)}function ng(e){return e.toLowerCase()}class Qn{constructor(t,n){this.attribute=n,this.property=t}}Qn.prototype.attribute="";Qn.prototype.booleanish=!1;Qn.prototype.boolean=!1;Qn.prototype.commaOrSpaceSeparated=!1;Qn.prototype.commaSeparated=!1;Qn.prototype.defined=!1;Qn.prototype.mustUseProperty=!1;Qn.prototype.number=!1;Qn.prototype.overloadedBoolean=!1;Qn.prototype.property="";Qn.prototype.spaceSeparated=!1;Qn.prototype.space=void 0;let HP=0;const et=fs(),ln=fs(),ag=fs(),we=fs(),Mt=fs(),fo=fs(),ca=fs();function fs(){return 2**++HP}const rg=Object.freeze(Object.defineProperty({__proto__:null,boolean:et,booleanish:ln,commaOrSpaceSeparated:ca,commaSeparated:fo,number:we,overloadedBoolean:ag,spaceSeparated:Mt},Symbol.toStringTag,{value:"Module"})),am=Object.keys(rg);class Nv extends Qn{constructor(t,n,r,s){let l=-1;if(super(t,n),Zw(this,"space",s),typeof r=="number")for(;++l<am.length;){const c=am[l];Zw(this,am[l],(r&rg[c])===rg[c])}}}Nv.prototype.defined=!0;function Zw(e,t,n){n&&(e[t]=n)}function Eo(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const l=new Nv(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[ng(r)]=r,n[ng(l.attribute)]=r}return new lc(t,n,e.space)}const BC=Eo({properties:{ariaActiveDescendant:null,ariaAtomic:ln,ariaAutoComplete:null,ariaBusy:ln,ariaChecked:ln,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Mt,ariaCurrent:null,ariaDescribedBy:Mt,ariaDetails:null,ariaDisabled:ln,ariaDropEffect:Mt,ariaErrorMessage:null,ariaExpanded:ln,ariaFlowTo:Mt,ariaGrabbed:ln,ariaHasPopup:null,ariaHidden:ln,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Mt,ariaLevel:we,ariaLive:null,ariaModal:ln,ariaMultiLine:ln,ariaMultiSelectable:ln,ariaOrientation:null,ariaOwns:Mt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:ln,ariaReadOnly:ln,ariaRelevant:null,ariaRequired:ln,ariaRoleDescription:Mt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:ln,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 FC(e,t){return t in e?e[t]:t}function HC(e,t){return FC(e,t.toLowerCase())}const qP=Eo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:fo,acceptCharset:Mt,accessKey:Mt,action:null,allow:null,allowFullScreen:et,allowPaymentRequest:et,allowUserMedia:et,alt:null,as:null,async:et,autoCapitalize:null,autoComplete:Mt,autoFocus:et,autoPlay:et,blocking:Mt,capture:null,charSet:null,checked:et,cite:null,className:Mt,cols:we,colSpan:null,content:null,contentEditable:ln,controls:et,controlsList:Mt,coords:we|fo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:et,defer:et,dir:null,dirName:null,disabled:et,download:ag,draggable:ln,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:et,formTarget:null,headers:Mt,height:we,hidden:ag,high:we,href:null,hrefLang:null,htmlFor:Mt,httpEquiv:Mt,id:null,imageSizes:null,imageSrcSet:null,inert:et,inputMode:null,integrity:null,is:null,isMap:et,itemId:null,itemProp:Mt,itemRef:Mt,itemScope:et,itemType:Mt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:et,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:et,muted:et,name:null,nonce:null,noModule:et,noValidate:et,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:et,optimum:we,pattern:null,ping:Mt,placeholder:null,playsInline:et,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:et,referrerPolicy:null,rel:Mt,required:et,reversed:et,rows:we,rowSpan:we,sandbox:Mt,scope:null,scoped:et,seamless:et,selected:et,shadowRootClonable:et,shadowRootDelegatesFocus:et,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:ln,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:et,useMap:null,value:ln,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Mt,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:et,declare:et,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:et,noHref:et,noShade:et,noWrap:et,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:ln,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:et,disableRemotePlayback:et,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:HC}),GP=Eo({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:ca,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:Mt,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:et,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:fo,g2:fo,glyphName:fo,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:ca,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:Mt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ca,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ca,rev:ca,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ca,requiredFeatures:ca,requiredFonts:ca,requiredFormats:ca,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:ca,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:ca,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:ca,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:FC}),qC=Eo({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()}}),GC=Eo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:HC}),VC=Eo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),VP={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"},WP=/[A-Z]/g,Kw=/-[a-z]/g,ZP=/^data[-\w.:]+$/i;function KP(e,t){const n=ng(t);let r=t,s=Qn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ZP.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Kw,QP);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Kw.test(l)){let c=l.replace(WP,YP);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=Nv}return new s(r,t)}function YP(e){return"-"+e.toLowerCase()}function QP(e){return e.charAt(1).toUpperCase()}const XP=UC([BC,qP,qC,GC,VC],"html"),Ev=UC([BC,GP,qC,GC,VC],"svg");function JP(e){return e.join(" ").trim()}var no={},rm,Yw;function eU(){if(Yw)return rm;Yw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
|
|
1625
|
+
`,h="/",g="*",m="",v="comment",b="declaration";function k(C,S){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];S=S||{};var N=1,E=1;function T(z){var q=z.match(t);q&&(N+=q.length);var V=z.lastIndexOf(f);E=~V?z.length-V:E+z.length}function $(){var z={line:N,column:E};return function(q){return q.position=new R(z),O(),q}}function R(z){this.start=z,this.end={line:N,column:E},this.source=S.source}R.prototype.content=C;function L(z){var q=new Error(S.source+":"+N+":"+E+": "+z);if(q.reason=z,q.filename=S.source,q.line=N,q.column=E,q.source=C,!S.silent)throw q}function B(z){var q=z.exec(C);if(q){var V=q[0];return T(V),C=C.slice(V.length),q}}function O(){B(n)}function _(z){var q;for(z=z||[];q=I();)q!==!1&&z.push(q);return z}function I(){var z=$();if(!(h!=C.charAt(0)||g!=C.charAt(1))){for(var q=2;m!=C.charAt(q)&&(g!=C.charAt(q)||h!=C.charAt(q+1));)++q;if(q+=2,m===C.charAt(q-1))return L("End of comment missing");var V=C.slice(2,q-2);return E+=2,T(V),C=C.slice(q),E+=2,z({type:v,comment:V})}}function F(){var z=$(),q=B(r);if(q){if(I(),!B(s))return L("property missing ':'");var V=B(l),Z=z({type:b,property:j(q[0].replace(e,m)),value:V?j(V[0].replace(e,m)):m});return B(c),Z}}function K(){var z=[];_(z);for(var q;q=F();)q!==!1&&(z.push(q),_(z));return z}return O(),K()}function j(C){return C?C.replace(d,m):m}return rm=k,rm}var Qw;function tU(){if(Qw)return no;Qw=1;var e=no&&no.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(no,"__esModule",{value:!0}),no.default=n;const t=e(eU());function n(r,s){let l=null;if(!r||typeof r!="string")return l;const c=(0,t.default)(r),d=typeof s=="function";return c.forEach(f=>{if(f.type!=="declaration")return;const{property:h,value:g}=f;d?s(h,g,f):g&&(l=l||{},l[h]=g)}),l}return no}var El={},Xw;function nU(){if(Xw)return El;Xw=1,Object.defineProperty(El,"__esModule",{value:!0}),El.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,l=function(h){return!h||n.test(h)||e.test(h)},c=function(h,g){return g.toUpperCase()},d=function(h,g){return"".concat(g,"-")},f=function(h,g){return g===void 0&&(g={}),l(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(s,d):h=h.replace(r,d),h.replace(t,c))};return El.camelCase=f,El}var Al,Jw;function aU(){if(Jw)return Al;Jw=1;var e=Al&&Al.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(tU()),n=nU();function r(s,l){var c={};return!s||typeof s!="string"||(0,t.default)(s,function(d,f){d&&f&&(c[(0,n.camelCase)(d,l)]=f)}),c}return r.default=r,Al=r,Al}var rU=aU();const iU=Jl(rU),WC=ZC("end"),Av=ZC("start");function ZC(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 sU(e){const t=Av(e),n=WC(e);if(t&&n)return{start:t,end:n}}function Ul(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ek(e.position):"start"in e||"end"in e?ek(e):"line"in e||"column"in e?ig(e):""}function ig(e){return tk(e&&e.line)+":"+tk(e&&e.column)}function ek(e){return ig(e&&e.start)+"-"+ig(e&&e.end)}function tk(e){return e&&typeof e=="number"?e:1}class On extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",l={},c=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?s=t:!l.cause&&t&&(c=!0,s=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?l.ruleId=r:(l.source=r.slice(0,f),l.ruleId=r.slice(f+1))}if(!l.place&&l.ancestors&&l.ancestors){const f=l.ancestors[l.ancestors.length-1];f&&(l.place=f.position)}const d=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=d?d.line:void 0,this.name=Ul(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=c&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}On.prototype.file="";On.prototype.name="";On.prototype.reason="";On.prototype.message="";On.prototype.stack="";On.prototype.column=void 0;On.prototype.line=void 0;On.prototype.ancestors=void 0;On.prototype.cause=void 0;On.prototype.fatal=void 0;On.prototype.place=void 0;On.prototype.ruleId=void 0;On.prototype.source=void 0;const Tv={}.hasOwnProperty,oU=new Map,lU=/[A-Z]/g,cU=new Set(["table","tbody","thead","tfoot","tr"]),uU=new Set(["td","th"]),KC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function dU(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=bU(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=yU(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"?Ev:XP,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=YC(s,e,void 0);return l&&typeof l!="string"?l:s.create(e,s.Fragment,{children:l||void 0},void 0)}function YC(e,t,n){if(t.type==="element")return pU(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return fU(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return mU(e,t,n);if(t.type==="mdxjsEsm")return hU(e,t);if(t.type==="root")return gU(e,t,n);if(t.type==="text")return vU(e,t)}function pU(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Ev,e.schema=s),e.ancestors.push(t);const l=XC(e,t.tagName,!1),c=xU(e,t);let d=_v(e,t);return cU.has(t.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!FP(f):!0})),QC(e,c,l,t),Rv(c,d),e.ancestors.pop(),e.schema=r,e.create(t,l,c,n)}function fU(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)}Yl(e,t.position)}function hU(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Yl(e,t.position)}function mU(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Ev,e.schema=s),e.ancestors.push(t);const l=t.name===null?e.Fragment:XC(e,t.name,!0),c=wU(e,t),d=_v(e,t);return QC(e,c,l,t),Rv(c,d),e.ancestors.pop(),e.schema=r,e.create(t,l,c,n)}function gU(e,t,n){const r={};return Rv(r,_v(e,t)),e.create(t,e.Fragment,r,n)}function vU(e,t){return t.value}function QC(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Rv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function yU(e,t,n){return r;function r(s,l,c,d){const h=Array.isArray(c.children)?n:t;return d?h(l,c,d):h(l,c)}}function bU(e,t){return n;function n(r,s,l,c){const d=Array.isArray(l.children),f=Av(r);return t(s,l,c,d,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function xU(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Tv.call(t.properties,s)){const l=kU(e,s,t.properties[s]);if(l){const[c,d]=l;e.tableCellAlignToStyle&&c==="align"&&typeof d=="string"&&uU.has(t.tagName)?r=d:n[c]=d}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function wU(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const c=l.expression;c.type;const d=c.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else Yl(e,t.position);else{const s=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const d=r.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else Yl(e,t.position);else l=r.value===null?!0:r.value;n[s]=l}return n}function _v(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:oU;for(;++r<t.children.length;){const l=t.children[r];let c;if(e.passKeys){const f=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(f){const h=s.get(f)||0;c=f+"-"+h,s.set(f,h+1)}}const d=YC(e,l,c);d!==void 0&&n.push(d)}return n}function kU(e,t,n){const r=KP(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?zP(n):JP(n)),r.property==="style"){let s=typeof n=="object"?n:SU(e,String(n));return e.stylePropertyNameCase==="css"&&(s=jU(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?VP[r.property]||r.property:r.attribute,n]}}function SU(e,t){try{return iU(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new On("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=KC+"#cannot-parse-style-attribute",s}}function XC(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let l=-1,c;for(;++l<s.length;){const d=Vw(s[l])?{type:"Identifier",name:s[l]}:{type:"Literal",value:s[l]};c=c?{type:"MemberExpression",object:c,property:d,computed:!!(l&&d.type==="Literal"),optional:!1}:d}r=c}else r=Vw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Tv.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Yl(e)}function Yl(e,t){const n=new On("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=KC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function jU(e){const t={};let n;for(n in e)Tv.call(e,n)&&(t[CU(n)]=e[n]);return t}function CU(e){let t=e.replace(lU,NU);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function NU(e){return"-"+e.toLowerCase()}const im={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},EU={};function Ov(e,t){const n=EU,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return JC(e,r,s)}function JC(e,t,n){if(AU(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 nk(e.children,t,n)}return Array.isArray(e)?nk(e,t,n):""}function nk(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=JC(e[s],t,n);return r.join("")}function AU(e){return!!(e&&typeof e=="object")}const ak=document.createElement("i");function Mv(e){const t="&"+e+";";ak.innerHTML=t;const n=ak.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function pa(e,t,n,r){const s=e.length;let l=0,c;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)c=Array.from(r),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);l<r.length;)c=r.slice(l,l+1e4),c.unshift(t,0),e.splice(...c),l+=1e4,t+=1e4}function Aa(e,t){return e.length>0?(pa(e,e.length,0,t),e):t}const rk={}.hasOwnProperty;function eN(e){const t={};let n=-1;for(;++n<e.length;)TU(t,e[n]);return t}function TU(e,t){let n;for(n in t){const s=(rk.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){rk.call(s,c)||(s[c]=[]);const d=l[c];RU(s[c],Array.isArray(d)?d:d?[d]:[])}}}function RU(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);pa(e,0,0,r)}function tN(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 Ba(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zn=Ci(/[A-Za-z]/),Rn=Ci(/[\dA-Za-z]/),_U=Ci(/[#-'*+\--9=?A-Z^-~]/);function Ed(e){return e!==null&&(e<32||e===127)}const sg=Ci(/\d/),OU=Ci(/[\dA-Fa-f]/),MU=Ci(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function Rt(e){return e!==null&&(e<0||e===32)}function it(e){return e===-2||e===-1||e===32}const Jd=Ci(new RegExp("\\p{P}|\\p{S}","u")),ss=Ci(/\s/);function Ci(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ao(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const l=e.charCodeAt(n);let c="";if(l===37&&Rn(e.charCodeAt(n+1))&&Rn(e.charCodeAt(n+2)))s=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(c=String.fromCharCode(l));else if(l>55295&&l<57344){const d=e.charCodeAt(n+1);l<56320&&d>56319&&d<57344?(c=String.fromCharCode(l,d),s=1):c="�"}else c=String.fromCharCode(l);c&&(t.push(e.slice(r,n),encodeURIComponent(c)),r=n+s+1,c=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function dt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(f){return it(f)?(e.enter(n),d(f)):t(f)}function d(f){return it(f)&&l++<s?(e.consume(f),d):(e.exit(n),t(f))}}const LU={tokenize:DU};function DU(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),dt(e,t,"linePrefix")}function s(d){return e.enter("paragraph"),l(d)}function l(d){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,c(d)}function c(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Pe(d)?(e.consume(d),e.exit("chunkText"),l):(e.consume(d),c)}}const IU={tokenize:zU},ik={tokenize:$U};function zU(e){const t=this,n=[];let r=0,s,l,c;return d;function d(E){if(r<n.length){const T=n[r];return t.containerState=T[1],e.attempt(T[0].continuation,f,h)(E)}return h(E)}function f(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&N();const T=t.events.length;let $=T,R;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){R=t.events[$][1].end;break}S(r);let L=T;for(;L<t.events.length;)t.events[L][1].end={...R},L++;return pa(t.events,$+1,0,t.events.slice(T)),t.events.length=L,h(E)}return d(E)}function h(E){if(r===n.length){if(!s)return v(E);if(s.currentConstruct&&s.currentConstruct.concrete)return k(E);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ik,g,m)(E)}function g(E){return s&&N(),S(r),v(E)}function m(E){return t.parser.lazy[t.now().line]=r!==n.length,c=t.now().offset,k(E)}function v(E){return t.containerState={},e.attempt(ik,b,k)(E)}function b(E){return r++,n.push([t.currentConstruct,t.containerState]),v(E)}function k(E){if(E===null){s&&N(),S(0),e.consume(E);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:l}),j(E)}function j(E){if(E===null){C(e.exit("chunkFlow"),!0),S(0),e.consume(E);return}return Pe(E)?(e.consume(E),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,d):(e.consume(E),j)}function C(E,T){const $=t.sliceStream(E);if(T&&$.push(null),E.previous=l,l&&(l.next=E),l=E,s.defineSkip(E.start),s.write($),t.parser.lazy[E.start.line]){let R=s.events.length;for(;R--;)if(s.events[R][1].start.offset<c&&(!s.events[R][1].end||s.events[R][1].end.offset>c))return;const L=t.events.length;let B=L,O,_;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){if(O){_=t.events[B][1].end;break}O=!0}for(S(r),R=L;R<t.events.length;)t.events[R][1].end={..._},R++;pa(t.events,B+1,0,t.events.slice(L)),t.events.length=R}}function S(E){let T=n.length;for(;T-- >E;){const $=n[T];t.containerState=$[1],$[0].exit.call(t,e)}n.length=E}function N(){s.write([null]),l=void 0,s=void 0,t.containerState._closeFlow=void 0}}function $U(e,t,n){return dt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bo(e){if(e===null||Rt(e)||ss(e))return 1;if(Jd(e))return 2}function ep(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const l=e[s].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const og={name:"attention",resolveAll:PU,tokenize:UU};function PU(e,t){let n=-1,r,s,l,c,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},v={...e[n][1].start};sk(m,-f),sk(v,f),c={type:f>1?"strongSequence":"emphasisSequence",start:m,end:{...e[r][1].end}},d={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},l={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:f>1?"strong":"emphasis",start:{...c.start},end:{...d.end}},e[r][1].end={...c.start},e[n][1].start={...d.end},h=[],e[r][1].end.offset-e[r][1].start.offset&&(h=Aa(h,[["enter",e[r][1],t],["exit",e[r][1],t]])),h=Aa(h,[["enter",s,t],["enter",c,t],["exit",c,t],["enter",l,t]]),h=Aa(h,ep(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),h=Aa(h,[["exit",l,t],["enter",d,t],["exit",d,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=Aa(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,pa(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 UU(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=bo(r);let l;return c;function c(f){return l=f,e.enter("attentionSequence"),d(f)}function d(f){if(f===l)return e.consume(f),d;const h=e.exit("attentionSequence"),g=bo(f),m=!g||g===2&&s||n.includes(f),v=!s||s===2&&g||n.includes(r);return h._open=!!(l===42?m:m&&(s||!v)),h._close=!!(l===42?v:v&&(g||!m)),t(f)}}function sk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const BU={name:"autolink",tokenize:FU};function FU(e,t,n){let r=0;return s;function s(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(b){return zn(b)?(e.consume(b),c):b===64?n(b):h(b)}function c(b){return b===43||b===45||b===46||Rn(b)?(r=1,d(b)):h(b)}function d(b){return b===58?(e.consume(b),r=0,f):(b===43||b===45||b===46||Rn(b))&&r++<32?(e.consume(b),d):(r=0,h(b))}function f(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||Ed(b)?n(b):(e.consume(b),f)}function h(b){return b===64?(e.consume(b),g):_U(b)?(e.consume(b),h):n(b)}function g(b){return Rn(b)?m(b):n(b)}function m(b){return b===46?(e.consume(b),r=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):v(b)}function v(b){if((b===45||Rn(b))&&r++<63){const k=b===45?v:m;return e.consume(b),k}return n(b)}}const cc={partial:!0,tokenize:HU};function HU(e,t,n){return r;function r(l){return it(l)?dt(e,s,"linePrefix")(l):s(l)}function s(l){return l===null||Pe(l)?t(l):n(l)}}const nN={continuation:{tokenize:GU},exit:VU,name:"blockQuote",tokenize:qU};function qU(e,t,n){const r=this;return s;function s(c){if(c===62){const d=r.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),l}return n(c)}function l(c){return it(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function GU(e,t,n){const r=this;return s;function s(c){return it(c)?dt(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):l(c)}function l(c){return e.attempt(nN,t,n)(c)}}function VU(e){e.exit("blockQuote")}const aN={name:"characterEscape",tokenize:WU};function WU(e,t,n){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),s}function s(l){return MU(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const rN={name:"characterReference",tokenize:ZU};function ZU(e,t,n){const r=this;let s=0,l,c;return d;function d(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),f}function f(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),l=31,c=Rn,g(m))}function h(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,c=OU,g):(e.enter("characterReferenceValue"),l=7,c=sg,g(m))}function g(m){if(m===59&&s){const v=e.exit("characterReferenceValue");return c===Rn&&!Mv(r.sliceSerialize(v))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(m)&&s++<l?(e.consume(m),g):n(m)}}const ok={partial:!0,tokenize:YU},lk={concrete:!0,name:"codeFenced",tokenize:KU};function KU(e,t,n){const r=this,s={partial:!0,tokenize:$};let l=0,c=0,d;return f;function f(R){return h(R)}function h(R){const L=r.events[r.events.length-1];return l=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,d=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(R)}function g(R){return R===d?(c++,e.consume(R),g):c<3?n(R):(e.exit("codeFencedFenceSequence"),it(R)?dt(e,m,"whitespace")(R):m(R))}function m(R){return R===null||Pe(R)?(e.exit("codeFencedFence"),r.interrupt?t(R):e.check(ok,j,T)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(R))}function v(R){return R===null||Pe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(R)):it(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),dt(e,b,"whitespace")(R)):R===96&&R===d?n(R):(e.consume(R),v)}function b(R){return R===null||Pe(R)?m(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(R))}function k(R){return R===null||Pe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(R)):R===96&&R===d?n(R):(e.consume(R),k)}function j(R){return e.attempt(s,T,C)(R)}function C(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),S}function S(R){return l>0&&it(R)?dt(e,N,"linePrefix",l+1)(R):N(R)}function N(R){return R===null||Pe(R)?e.check(ok,j,T)(R):(e.enter("codeFlowValue"),E(R))}function E(R){return R===null||Pe(R)?(e.exit("codeFlowValue"),N(R)):(e.consume(R),E)}function T(R){return e.exit("codeFenced"),t(R)}function $(R,L,B){let O=0;return _;function _(q){return R.enter("lineEnding"),R.consume(q),R.exit("lineEnding"),I}function I(q){return R.enter("codeFencedFence"),it(q)?dt(R,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):F(q)}function F(q){return q===d?(R.enter("codeFencedFenceSequence"),K(q)):B(q)}function K(q){return q===d?(O++,R.consume(q),K):O>=c?(R.exit("codeFencedFenceSequence"),it(q)?dt(R,z,"whitespace")(q):z(q)):B(q)}function z(q){return q===null||Pe(q)?(R.exit("codeFencedFence"),L(q)):B(q)}}}function YU(e,t,n){const r=this;return s;function s(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l)}function l(c){return r.parser.lazy[r.now().line]?n(c):t(c)}}const sm={name:"codeIndented",tokenize:XU},QU={partial:!0,tokenize:JU};function XU(e,t,n){const r=this;return s;function s(h){return e.enter("codeIndented"),dt(e,l,"linePrefix",5)(h)}function l(h){const g=r.events[r.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?f(h):Pe(h)?e.attempt(QU,c,f)(h):(e.enter("codeFlowValue"),d(h))}function d(h){return h===null||Pe(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),d)}function f(h){return e.exit("codeIndented"),t(h)}}function JU(e,t,n){const r=this;return s;function s(c){return r.parser.lazy[r.now().line]?n(c):Pe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):dt(e,l,"linePrefix",5)(c)}function l(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):Pe(c)?s(c):n(c)}}const e8={name:"codeText",previous:n8,resolve:t8,tokenize:a8};function t8(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 n8(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function a8(e,t,n){let r=0,s,l;return c;function c(m){return e.enter("codeText"),e.enter("codeTextSequence"),d(m)}function d(m){return m===96?(e.consume(m),r++,d):(e.exit("codeTextSequence"),f(m))}function f(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),f):m===96?(l=e.enter("codeTextSequence"),s=0,g(m)):Pe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):(e.enter("codeTextData"),h(m))}function h(m){return m===null||m===32||m===96||Pe(m)?(e.exit("codeTextData"),f(m)):(e.consume(m),h)}function g(m){return m===96?(e.consume(m),s++,g):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(l.type="codeTextData",h(m))}}class r8{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Tl(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Tl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Tl(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);Tl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Tl(this.left,n.reverse())}}}function Tl(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 iN(e){const t={};let n=-1,r,s,l,c,d,f,h;const g=new r8(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(r=g.get(n),n&&r[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,l=0,l<f.length&&f[l][1].type==="lineEndingBlank"&&(l+=2),l<f.length&&f[l][1].type==="content"))for(;++l<f.length&&f[l][1].type!=="content";)f[l][1].type==="chunkText"&&(f[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,i8(g,n)),n=t[n],h=!0);else if(r[1]._container){for(l=n,s=void 0;l--;)if(c=g.get(l),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),c[1].type="lineEnding",s=l);else if(!(c[1].type==="linePrefix"||c[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 pa(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function i8(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const l=[];let c=n._tokenizer;c||(c=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const d=c.events,f=[],h={};let g,m,v=-1,b=n,k=0,j=0;const C=[j];for(;b;){for(;e.get(++s)[1]!==b;);l.push(s),b._tokenizer||(g=r.sliceStream(b),b.next||g.push(null),m&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++v<d.length;)d[v][0]==="exit"&&d[v-1][0]==="enter"&&d[v][1].type===d[v-1][1].type&&d[v][1].start.line!==d[v][1].end.line&&(j=v+1,C.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(c.events=[],b?(b._tokenizer=void 0,b.previous=void 0):C.pop(),v=C.length;v--;){const S=d.slice(C[v],C[v+1]),N=l.pop();f.push([N,N+S.length-1]),e.splice(N,2,S)}for(f.reverse(),v=-1;++v<f.length;)h[k+f[v][0]]=k+f[v][1],k+=f[v][1]-f[v][0]-1;return h}const s8={resolve:l8,tokenize:c8},o8={partial:!0,tokenize:u8};function l8(e){return iN(e),e}function c8(e,t){let n;return r;function r(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(d)}function s(d){return d===null?l(d):Pe(d)?e.check(o8,c,l)(d):(e.consume(d),s)}function l(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function c(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function u8(e,t,n){const r=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),dt(e,l,"linePrefix")}function l(c){if(c===null||Pe(c))return n(c);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(c):e.interrupt(r.parser.constructs.flow,n,t)(c)}}function sN(e,t,n,r,s,l,c,d,f){const h=f||Number.POSITIVE_INFINITY;let g=0;return m;function m(S){return S===60?(e.enter(r),e.enter(s),e.enter(l),e.consume(S),e.exit(l),v):S===null||S===32||S===41||Ed(S)?n(S):(e.enter(r),e.enter(c),e.enter(d),e.enter("chunkString",{contentType:"string"}),j(S))}function v(S){return S===62?(e.enter(l),e.consume(S),e.exit(l),e.exit(s),e.exit(r),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(S))}function b(S){return S===62?(e.exit("chunkString"),e.exit(d),v(S)):S===null||S===60||Pe(S)?n(S):(e.consume(S),S===92?k:b)}function k(S){return S===60||S===62||S===92?(e.consume(S),b):b(S)}function j(S){return!g&&(S===null||S===41||Rt(S))?(e.exit("chunkString"),e.exit(d),e.exit(c),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||Ed(S)?n(S):(e.consume(S),S===92?C:j)}function C(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function oN(e,t,n,r,s,l){const c=this;let d=0,f;return h;function h(b){return e.enter(r),e.enter(s),e.consume(b),e.exit(s),e.enter(l),g}function g(b){return d>999||b===null||b===91||b===93&&!f||b===94&&!d&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(l),e.enter(s),e.consume(b),e.exit(s),e.exit(r),t):Pe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||Pe(b)||d++>999?(e.exit("chunkString"),g(b)):(e.consume(b),f||(f=!it(b)),b===92?v:m)}function v(b){return b===91||b===92||b===93?(e.consume(b),d++,m):m(b)}}function lN(e,t,n,r,s,l){let c;return d;function d(v){return v===34||v===39||v===40?(e.enter(r),e.enter(s),e.consume(v),e.exit(s),c=v===40?41:v,f):n(v)}function f(v){return v===c?(e.enter(s),e.consume(v),e.exit(s),e.exit(r),t):(e.enter(l),h(v))}function h(v){return v===c?(e.exit(l),f(c)):v===null?n(v):Pe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),dt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===c||v===null||Pe(v)?(e.exit("chunkString"),h(v)):(e.consume(v),v===92?m:g)}function m(v){return v===c||v===92?(e.consume(v),g):g(v)}}function Bl(e,t){let n;return r;function r(s){return Pe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):it(s)?dt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const d8={name:"definition",tokenize:f8},p8={partial:!0,tokenize:h8};function f8(e,t,n){const r=this;let s;return l;function l(b){return e.enter("definition"),c(b)}function c(b){return oN.call(r,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return s=Ba(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),f):n(b)}function f(b){return Rt(b)?Bl(e,h)(b):h(b)}function h(b){return sN(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(p8,m,m)(b)}function m(b){return it(b)?dt(e,v,"whitespace")(b):v(b)}function v(b){return b===null||Pe(b)?(e.exit("definition"),r.parser.defined.push(s),t(b)):n(b)}}function h8(e,t,n){return r;function r(d){return Rt(d)?Bl(e,s)(d):n(d)}function s(d){return lN(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function l(d){return it(d)?dt(e,c,"whitespace")(d):c(d)}function c(d){return d===null||Pe(d)?t(d):n(d)}}const m8={name:"hardBreakEscape",tokenize:g8};function g8(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),s}function s(l){return Pe(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const v8={name:"headingAtx",resolve:y8,tokenize:b8};function y8(e,t){let n=e.length-2,r=3,s,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},pa(e,r,n-r+1,[["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t]])),e}function b8(e,t,n){let r=0;return s;function s(g){return e.enter("atxHeading"),l(g)}function l(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&r++<6?(e.consume(g),c):g===null||Rt(g)?(e.exit("atxHeadingSequence"),d(g)):n(g)}function d(g){return g===35?(e.enter("atxHeadingSequence"),f(g)):g===null||Pe(g)?(e.exit("atxHeading"),t(g)):it(g)?dt(e,d,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function f(g){return g===35?(e.consume(g),f):(e.exit("atxHeadingSequence"),d(g))}function h(g){return g===null||g===35||Rt(g)?(e.exit("atxHeadingText"),d(g)):(e.consume(g),h)}}const x8=["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"],ck=["pre","script","style","textarea"],w8={concrete:!0,name:"htmlFlow",resolveTo:j8,tokenize:C8},k8={partial:!0,tokenize:E8},S8={partial:!0,tokenize:N8};function j8(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 C8(e,t,n){const r=this;let s,l,c,d,f;return h;function h(M){return g(M)}function g(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),m}function m(M){return M===33?(e.consume(M),v):M===47?(e.consume(M),l=!0,j):M===63?(e.consume(M),s=3,r.interrupt?t:D):zn(M)?(e.consume(M),c=String.fromCharCode(M),C):n(M)}function v(M){return M===45?(e.consume(M),s=2,b):M===91?(e.consume(M),s=5,d=0,k):zn(M)?(e.consume(M),s=4,r.interrupt?t:D):n(M)}function b(M){return M===45?(e.consume(M),r.interrupt?t:D):n(M)}function k(M){const ee="CDATA[";return M===ee.charCodeAt(d++)?(e.consume(M),d===ee.length?r.interrupt?t:F:k):n(M)}function j(M){return zn(M)?(e.consume(M),c=String.fromCharCode(M),C):n(M)}function C(M){if(M===null||M===47||M===62||Rt(M)){const ee=M===47,ce=c.toLowerCase();return!ee&&!l&&ck.includes(ce)?(s=1,r.interrupt?t(M):F(M)):x8.includes(c.toLowerCase())?(s=6,ee?(e.consume(M),S):r.interrupt?t(M):F(M)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):l?N(M):E(M))}return M===45||Rn(M)?(e.consume(M),c+=String.fromCharCode(M),C):n(M)}function S(M){return M===62?(e.consume(M),r.interrupt?t:F):n(M)}function N(M){return it(M)?(e.consume(M),N):_(M)}function E(M){return M===47?(e.consume(M),_):M===58||M===95||zn(M)?(e.consume(M),T):it(M)?(e.consume(M),E):_(M)}function T(M){return M===45||M===46||M===58||M===95||Rn(M)?(e.consume(M),T):$(M)}function $(M){return M===61?(e.consume(M),R):it(M)?(e.consume(M),$):E(M)}function R(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),f=M,L):it(M)?(e.consume(M),R):B(M)}function L(M){return M===f?(e.consume(M),f=null,O):M===null||Pe(M)?n(M):(e.consume(M),L)}function B(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Rt(M)?$(M):(e.consume(M),B)}function O(M){return M===47||M===62||it(M)?E(M):n(M)}function _(M){return M===62?(e.consume(M),I):n(M)}function I(M){return M===null||Pe(M)?F(M):it(M)?(e.consume(M),I):n(M)}function F(M){return M===45&&s===2?(e.consume(M),V):M===60&&s===1?(e.consume(M),Z):M===62&&s===4?(e.consume(M),U):M===63&&s===3?(e.consume(M),D):M===93&&s===5?(e.consume(M),W):Pe(M)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(k8,G,K)(M)):M===null||Pe(M)?(e.exit("htmlFlowData"),K(M)):(e.consume(M),F)}function K(M){return e.check(S8,z,G)(M)}function z(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),q}function q(M){return M===null||Pe(M)?K(M):(e.enter("htmlFlowData"),F(M))}function V(M){return M===45?(e.consume(M),D):F(M)}function Z(M){return M===47?(e.consume(M),c="",Y):F(M)}function Y(M){if(M===62){const ee=c.toLowerCase();return ck.includes(ee)?(e.consume(M),U):F(M)}return zn(M)&&c.length<8?(e.consume(M),c+=String.fromCharCode(M),Y):F(M)}function W(M){return M===93?(e.consume(M),D):F(M)}function D(M){return M===62?(e.consume(M),U):M===45&&s===2?(e.consume(M),D):F(M)}function U(M){return M===null||Pe(M)?(e.exit("htmlFlowData"),G(M)):(e.consume(M),U)}function G(M){return e.exit("htmlFlow"),t(M)}}function N8(e,t,n){const r=this;return s;function s(c){return Pe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):n(c)}function l(c){return r.parser.lazy[r.now().line]?n(c):t(c)}}function E8(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(cc,t,n)}}const A8={name:"htmlText",tokenize:T8};function T8(e,t,n){const r=this;let s,l,c;return d;function d(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),f}function f(D){return D===33?(e.consume(D),h):D===47?(e.consume(D),$):D===63?(e.consume(D),E):zn(D)?(e.consume(D),B):n(D)}function h(D){return D===45?(e.consume(D),g):D===91?(e.consume(D),l=0,k):zn(D)?(e.consume(D),N):n(D)}function g(D){return D===45?(e.consume(D),b):n(D)}function m(D){return D===null?n(D):D===45?(e.consume(D),v):Pe(D)?(c=m,Z(D)):(e.consume(D),m)}function v(D){return D===45?(e.consume(D),b):m(D)}function b(D){return D===62?V(D):D===45?v(D):m(D)}function k(D){const U="CDATA[";return D===U.charCodeAt(l++)?(e.consume(D),l===U.length?j:k):n(D)}function j(D){return D===null?n(D):D===93?(e.consume(D),C):Pe(D)?(c=j,Z(D)):(e.consume(D),j)}function C(D){return D===93?(e.consume(D),S):j(D)}function S(D){return D===62?V(D):D===93?(e.consume(D),S):j(D)}function N(D){return D===null||D===62?V(D):Pe(D)?(c=N,Z(D)):(e.consume(D),N)}function E(D){return D===null?n(D):D===63?(e.consume(D),T):Pe(D)?(c=E,Z(D)):(e.consume(D),E)}function T(D){return D===62?V(D):E(D)}function $(D){return zn(D)?(e.consume(D),R):n(D)}function R(D){return D===45||Rn(D)?(e.consume(D),R):L(D)}function L(D){return Pe(D)?(c=L,Z(D)):it(D)?(e.consume(D),L):V(D)}function B(D){return D===45||Rn(D)?(e.consume(D),B):D===47||D===62||Rt(D)?O(D):n(D)}function O(D){return D===47?(e.consume(D),V):D===58||D===95||zn(D)?(e.consume(D),_):Pe(D)?(c=O,Z(D)):it(D)?(e.consume(D),O):V(D)}function _(D){return D===45||D===46||D===58||D===95||Rn(D)?(e.consume(D),_):I(D)}function I(D){return D===61?(e.consume(D),F):Pe(D)?(c=I,Z(D)):it(D)?(e.consume(D),I):O(D)}function F(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),s=D,K):Pe(D)?(c=F,Z(D)):it(D)?(e.consume(D),F):(e.consume(D),z)}function K(D){return D===s?(e.consume(D),s=void 0,q):D===null?n(D):Pe(D)?(c=K,Z(D)):(e.consume(D),K)}function z(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||Rt(D)?O(D):(e.consume(D),z)}function q(D){return D===47||D===62||Rt(D)?O(D):n(D)}function V(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function Z(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),Y}function Y(D){return it(D)?dt(e,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):W(D)}function W(D){return e.enter("htmlTextData"),c(D)}}const Lv={name:"labelEnd",resolveAll:M8,resolveTo:L8,tokenize:D8},R8={tokenize:I8},_8={tokenize:z8},O8={tokenize:$8};function M8(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&&pa(e,0,e.length,n),e}function L8(e,t){let n=e.length,r=0,s,l,c,d;for(;n--;)if(s=e[n][1],l){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(l=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(c=n);const f={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[l][1].start},end:{...e[c][1].end}},g={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[c-2][1].start}};return d=[["enter",f,t],["enter",h,t]],d=Aa(d,e.slice(l+1,l+r+3)),d=Aa(d,[["enter",g,t]]),d=Aa(d,ep(t.parser.constructs.insideSpan.null,e.slice(l+r+4,c-3),t)),d=Aa(d,[["exit",g,t],e[c-2],e[c-1],["exit",h,t]]),d=Aa(d,e.slice(c+1)),d=Aa(d,[["exit",f,t]]),pa(e,l,e.length,d),e}function D8(e,t,n){const r=this;let s=r.events.length,l,c;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){l=r.events[s][1];break}return d;function d(v){return l?l._inactive?m(v):(c=r.parser.defined.includes(Ba(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),f):n(v)}function f(v){return v===40?e.attempt(R8,g,c?g:m)(v):v===91?e.attempt(_8,g,c?h:m)(v):c?g(v):m(v)}function h(v){return e.attempt(O8,g,m)(v)}function g(v){return t(v)}function m(v){return l._balanced=!0,n(v)}}function I8(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 Rt(m)?Bl(e,l)(m):l(m)}function l(m){return m===41?g(m):sN(e,c,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function c(m){return Rt(m)?Bl(e,f)(m):g(m)}function d(m){return n(m)}function f(m){return m===34||m===39||m===40?lN(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function h(m){return Rt(m)?Bl(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 z8(e,t,n){const r=this;return s;function s(d){return oN.call(r,e,l,c,"reference","referenceMarker","referenceString")(d)}function l(d){return r.parser.defined.includes(Ba(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function c(d){return n(d)}}function $8(e,t,n){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),s}function s(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const P8={name:"labelStartImage",resolveAll:Lv.resolveAll,tokenize:U8};function U8(e,t,n){const r=this;return s;function s(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),c):n(d)}function c(d){return d===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(d):t(d)}}const B8={name:"labelStartLink",resolveAll:Lv.resolveAll,tokenize:F8};function F8(e,t,n){const r=this;return s;function s(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),l}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const om={name:"lineEnding",tokenize:H8};function H8(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),dt(e,t,"linePrefix")}}const id={name:"thematicBreak",tokenize:q8};function q8(e,t,n){let r=0,s;return l;function l(h){return e.enter("thematicBreak"),c(h)}function c(h){return s=h,d(h)}function d(h){return h===s?(e.enter("thematicBreakSequence"),f(h)):r>=3&&(h===null||Pe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function f(h){return h===s?(e.consume(h),r++,f):(e.exit("thematicBreakSequence"),it(h)?dt(e,d,"whitespace")(h):d(h))}}const Wn={continuation:{tokenize:Z8},exit:Y8,name:"list",tokenize:W8},G8={partial:!0,tokenize:Q8},V8={partial:!0,tokenize:K8};function W8(e,t,n){const r=this,s=r.events[r.events.length-1];let l=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,c=0;return d;function d(b){const k=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:sg(b)){if(r.containerState.type||(r.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(id,n,h)(b):h(b);if(!r.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(b)}return n(b)}function f(b){return sg(b)&&++c<10?(e.consume(b),f):(!r.interrupt||c<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),h(b)):n(b)}function h(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,e.check(cc,r.interrupt?n:g,e.attempt(G8,v,m))}function g(b){return r.containerState.initialBlankLine=!0,l++,v(b)}function m(b){return it(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),v):n(b)}function v(b){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function Z8(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(cc,s,l);function s(d){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,dt(e,t,"listItemIndent",r.containerState.size+1)(d)}function l(d){return r.containerState.furtherBlankLines||!it(d)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,c(d)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(V8,t,c)(d))}function c(d){return r.containerState._closeFlow=!0,r.interrupt=void 0,dt(e,e.attempt(Wn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function K8(e,t,n){const r=this;return dt(e,s,"listItemIndent",r.containerState.size+1);function s(l){const c=r.events[r.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===r.containerState.size?t(l):n(l)}}function Y8(e){e.exit(this.containerState.type)}function Q8(e,t,n){const r=this;return dt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(l){const c=r.events[r.events.length-1];return!it(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const uk={name:"setextUnderline",resolveTo:X8,tokenize:J8};function X8(e,t){let n=e.length,r,s,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const c={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",l?(e.splice(s,0,["enter",c,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=c,e.push(["exit",c,t]),e}function J8(e,t,n){const r=this;let s;return l;function l(h){let g=r.events.length,m;for(;g--;)if(r.events[g][1].type!=="lineEnding"&&r.events[g][1].type!=="linePrefix"&&r.events[g][1].type!=="content"){m=r.events[g][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),s=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),d(h)}function d(h){return h===s?(e.consume(h),d):(e.exit("setextHeadingLineSequence"),it(h)?dt(e,f,"lineSuffix")(h):f(h))}function f(h){return h===null||Pe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const e9={tokenize:t9};function t9(e){const t=this,n=e.attempt(cc,r,e.attempt(this.parser.constructs.flowInitial,s,dt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(s8,s)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const n9={resolveAll:uN()},a9=cN("string"),r9=cN("text");function cN(e){return{resolveAll:uN(e==="text"?i9:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],l=n.attempt(s,c,d);return c;function c(g){return h(g)?l(g):d(g)}function d(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),f}function f(g){return h(g)?(n.exit("data"),l(g)):(n.consume(g),f)}function h(g){if(g===null)return!0;const m=s[g];let v=-1;if(m)for(;++v<m.length;){const b=m[v];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function uN(e){return t;function t(n,r){let s=-1,l;for(;++s<=n.length;)l===void 0?n[s]&&n[s][1].type==="data"&&(l=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==l+2&&(n[l][1].end=n[s-1][1].end,n.splice(l+2,s-l-2),s=l+2),l=void 0);return e?e(n,r):n}}function i9(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let l=s.length,c=-1,d=0,f;for(;l--;){const h=s[l];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)d++,c--;if(c)break;c=-1}else if(h===-2)f=!0,d++;else if(h!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const h={type:n===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?c:r.start._bufferIndex+c,_index:r.start._index+l,line:r.end.line,column:r.end.column-d,offset:r.end.offset-d},end:{...r.end}};r.end={...h.start},r.start.offset===r.end.offset?Object.assign(r,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const s9={42:Wn,43:Wn,45:Wn,48:Wn,49:Wn,50:Wn,51:Wn,52:Wn,53:Wn,54:Wn,55:Wn,56:Wn,57:Wn,62:nN},o9={91:d8},l9={[-2]:sm,[-1]:sm,32:sm},c9={35:v8,42:id,45:[uk,id],60:w8,61:uk,95:id,96:lk,126:lk},u9={38:rN,92:aN},d9={[-5]:om,[-4]:om,[-3]:om,33:P8,38:rN,42:og,60:[BU,A8],91:B8,92:[m8,aN],93:Lv,95:og,96:e8},p9={null:[og,n9]},f9={null:[42,95]},h9={null:[]},m9=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:f9,contentInitial:o9,disable:h9,document:s9,flow:c9,flowInitial:l9,insideSpan:p9,string:u9,text:d9},Symbol.toStringTag,{value:"Module"}));function g9(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},l=[];let c=[],d=[];const f={attempt:L($),check:L(R),consume:N,enter:E,exit:T,interrupt:L(R,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:v,sliceStream:b,write:m};let g=t.tokenize.call(h,f);return t.resolveAll&&l.push(t),h;function m(I){return c=Aa(c,I),C(),c[c.length-1]!==null?[]:(B(t,0),h.events=ep(l,h.events,h),h.events)}function v(I,F){return y9(b(I),F)}function b(I){return v9(c,I)}function k(){const{_bufferIndex:I,_index:F,line:K,column:z,offset:q}=r;return{_bufferIndex:I,_index:F,line:K,column:z,offset:q}}function j(I){s[I.line]=I.column,_()}function C(){let I;for(;r._index<c.length;){const F=c[r._index];if(typeof F=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<F.length;)S(F.charCodeAt(r._bufferIndex));else S(F)}}function S(I){g=g(I)}function N(I){Pe(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,_()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===c[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=I}function E(I,F){const K=F||{};return K.type=I,K.start=k(),h.events.push(["enter",K,h]),d.push(K),K}function T(I){const F=d.pop();return F.end=k(),h.events.push(["exit",F,h]),F}function $(I,F){B(I,F.from)}function R(I,F){F.restore()}function L(I,F){return K;function K(z,q,V){let Z,Y,W,D;return Array.isArray(z)?G(z):"tokenize"in z?G([z]):U(z);function U(oe){return be;function be(Re){const Ne=Re!==null&&oe[Re],De=Re!==null&&oe.null,We=[...Array.isArray(Ne)?Ne:Ne?[Ne]:[],...Array.isArray(De)?De:De?[De]:[]];return G(We)(Re)}}function G(oe){return Z=oe,Y=0,oe.length===0?V:M(oe[Y])}function M(oe){return be;function be(Re){return D=O(),W=oe,oe.partial||(h.currentConstruct=oe),oe.name&&h.parser.constructs.disable.null.includes(oe.name)?ce():oe.tokenize.call(F?Object.assign(Object.create(h),F):h,f,ee,ce)(Re)}}function ee(oe){return I(W,D),q}function ce(oe){return D.restore(),++Y<Z.length?M(Z[Y]):V}}}function B(I,F){I.resolveAll&&!l.includes(I)&&l.push(I),I.resolve&&pa(h.events,F,h.events.length-F,I.resolve(h.events.slice(F),h)),I.resolveTo&&(h.events=I.resolveTo(h.events,h))}function O(){const I=k(),F=h.previous,K=h.currentConstruct,z=h.events.length,q=Array.from(d);return{from:z,restore:V};function V(){r=I,h.previous=F,h.currentConstruct=K,h.events.length=z,d=q,_()}}function _(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function v9(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,l=t.end._bufferIndex;let c;if(n===s)c=[e[n].slice(r,l)];else{if(c=e.slice(n,s),r>-1){const d=c[0];typeof d=="string"?c[0]=d.slice(r):c.shift()}l>0&&c.push(e[s].slice(0,l))}return c}function y9(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const l=e[n];let c;if(typeof l=="string")c=l;else switch(l){case-5:{c="\r";break}case-4:{c=`
|
|
1626
|
+
`;break}case-3:{c=`\r
|
|
1627
|
+
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&s)continue;c=" ";break}default:c=String.fromCharCode(l)}s=l===-2,r.push(c)}return r.join("")}function b9(e){const r={constructs:eN([m9,...(e||{}).extensions||[]]),content:s(LU),defined:[],document:s(IU),flow:s(e9),lazy:{},string:s(a9),text:s(r9)};return r;function s(l){return c;function c(d){return g9(r,l,d)}}}function x9(e){for(;!iN(e););return e}const dk=/[\0\t\n\r]/g;function w9(){let e=1,t="",n=!0,r;return s;function s(l,c,d){const f=[];let h,g,m,v,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(c||void 0).decode(l)),m=0,t="",n&&(l.charCodeAt(0)===65279&&m++,n=void 0);m<l.length;){if(dk.lastIndex=m,h=dk.exec(l),v=h&&h.index!==void 0?h.index:l.length,b=l.charCodeAt(v),!h){t=l.slice(m);break}if(b===10&&m===v&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),m<v&&(f.push(l.slice(m,v)),e+=v-m),b){case 0:{f.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,f.push(-2);e++<g;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}m=v+1}return d&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const k9=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function S9(e){return e.replace(k9,j9)}function j9(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),l=s===120||s===88;return tN(n.slice(l?2:1),l?16:10)}return Mv(n)||e}const dN={}.hasOwnProperty;function C9(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),N9(n)(x9(b9(n).document().write(w9()(e,t,!0))))}function N9(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Oe),autolinkProtocol:O,autolinkEmail:O,atxHeading:l(qe),blockQuote:l(De),characterEscape:O,characterReference:O,codeFenced:l(We),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(We,c),codeText:l(Se,c),codeTextData:O,data:O,codeFlowValue:O,definition:l(ft),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(Ie),hardBreakEscape:l(ke),hardBreakTrailing:l(ke),htmlFlow:l(lt,c),htmlFlowData:O,htmlText:l(lt,c),htmlTextData:O,image:l(ye),label:c,link:l(Oe),listItem:l($t),listItemValue:v,listOrdered:l(Lt,m),listUnordered:l(Lt),paragraph:l(Qt),reference:M,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(qe),strong:l(Gt),thematicBreak:l(xe)},exit:{atxHeading:f(),atxHeadingSequence:$,autolink:f(),autolinkEmail:Ne,autolinkProtocol:Re,blockQuote:f(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:oe,characterReference:be,codeFenced:f(C),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:k,codeFlowValue:_,codeIndented:f(S),codeText:f(q),codeTextData:_,data:_,definition:f(),definitionDestinationString:T,definitionLabelString:N,definitionTitleString:E,emphasis:f(),hardBreakEscape:f(F),hardBreakTrailing:f(F),htmlFlow:f(K),htmlFlowData:_,htmlText:f(z),htmlTextData:_,image:f(Z),label:W,labelText:Y,lineEnding:I,link:f(V),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:ee,resourceDestinationString:D,resourceTitleString:U,resource:G,setextHeading:f(B),setextHeadingLineSequence:L,setextHeadingText:R,strong:f(),thematicBreak:f()}};pN(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(X){let fe={type:"root",children:[]};const H={stack:[fe],tokenStack:[],config:t,enter:d,exit:h,buffer:c,resume:g,data:n},se=[];let pe=-1;for(;++pe<X.length;)if(X[pe][1].type==="listOrdered"||X[pe][1].type==="listUnordered")if(X[pe][0]==="enter")se.push(pe);else{const Le=se.pop();pe=s(X,Le,pe)}for(pe=-1;++pe<X.length;){const Le=t[X[pe][0]];dN.call(Le,X[pe][1].type)&&Le[X[pe][1].type].call(Object.assign({sliceSerialize:X[pe][2].sliceSerialize},H),X[pe][1])}if(H.tokenStack.length>0){const Le=H.tokenStack[H.tokenStack.length-1];(Le[1]||pk).call(H,void 0,Le[0])}for(fe.position={start:vi(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:vi(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},pe=-1;++pe<t.transforms.length;)fe=t.transforms[pe](fe)||fe;return fe}function s(X,fe,H){let se=fe-1,pe=-1,Le=!1,He,Ce,Fe,tt;for(;++se<=H;){const Ee=X[se];switch(Ee[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ee[0]==="enter"?pe++:pe--,tt=void 0;break}case"lineEndingBlank":{Ee[0]==="enter"&&(He&&!tt&&!pe&&!Fe&&(Fe=se),tt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:tt=void 0}if(!pe&&Ee[0]==="enter"&&Ee[1].type==="listItemPrefix"||pe===-1&&Ee[0]==="exit"&&(Ee[1].type==="listUnordered"||Ee[1].type==="listOrdered")){if(He){let Zt=se;for(Ce=void 0;Zt--;){const _t=X[Zt];if(_t[1].type==="lineEnding"||_t[1].type==="lineEndingBlank"){if(_t[0]==="exit")continue;Ce&&(X[Ce][1].type="lineEndingBlank",Le=!0),_t[1].type="lineEnding",Ce=Zt}else if(!(_t[1].type==="linePrefix"||_t[1].type==="blockQuotePrefix"||_t[1].type==="blockQuotePrefixWhitespace"||_t[1].type==="blockQuoteMarker"||_t[1].type==="listItemIndent"))break}Fe&&(!Ce||Fe<Ce)&&(He._spread=!0),He.end=Object.assign({},Ce?X[Ce][1].start:Ee[1].end),X.splice(Ce||se,0,["exit",He,Ee[2]]),se++,H++}if(Ee[1].type==="listItemPrefix"){const Zt={type:"listItem",_spread:!1,start:Object.assign({},Ee[1].start),end:void 0};He=Zt,X.splice(se,0,["enter",Zt,Ee[2]]),se++,H++,Fe=void 0,tt=!0}}}return X[fe][1]._spread=Le,H}function l(X,fe){return H;function H(se){d.call(this,X(se),se),fe&&fe.call(this,se)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(X,fe,H){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([fe,H||void 0]),X.position={start:vi(fe.start),end:void 0}}function f(X){return fe;function fe(H){X&&X.call(this,H),h.call(this,H)}}function h(X,fe){const H=this.stack.pop(),se=this.tokenStack.pop();if(se)se[0].type!==X.type&&(fe?fe.call(this,X,se[0]):(se[1]||pk).call(this,X,se[0]));else throw new Error("Cannot close `"+X.type+"` ("+Ul({start:X.start,end:X.end})+"): it’s not open");H.position.end=vi(X.end)}function g(){return Ov(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function v(X){if(this.data.expectingFirstListItemValue){const fe=this.stack[this.stack.length-2];fe.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function b(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.lang=X}function k(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=X}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.value=X.replace(/(\r?\n|\r)$/g,"")}function N(X){const fe=this.resume(),H=this.stack[this.stack.length-1];H.label=fe,H.identifier=Ba(this.sliceSerialize(X)).toLowerCase()}function E(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.title=X}function T(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.url=X}function $(X){const fe=this.stack[this.stack.length-1];if(!fe.depth){const H=this.sliceSerialize(X).length;fe.depth=H}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function L(X){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function O(X){const H=this.stack[this.stack.length-1].children;let se=H[H.length-1];(!se||se.type!=="text")&&(se=ut(),se.position={start:vi(X.start),end:void 0},H.push(se)),this.stack.push(se)}function _(X){const fe=this.stack.pop();fe.value+=this.sliceSerialize(X),fe.position.end=vi(X.end)}function I(X){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const H=fe.children[fe.children.length-1];H.position.end=vi(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(fe.type)&&(O.call(this,X),_.call(this,X))}function F(){this.data.atHardBreak=!0}function K(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.value=X}function z(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.value=X}function q(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.value=X}function V(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=fe,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function Z(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=fe,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function Y(X){const fe=this.sliceSerialize(X),H=this.stack[this.stack.length-2];H.label=S9(fe),H.identifier=Ba(fe).toLowerCase()}function W(){const X=this.stack[this.stack.length-1],fe=this.resume(),H=this.stack[this.stack.length-1];if(this.data.inReference=!0,H.type==="link"){const se=X.children;H.children=se}else H.alt=fe}function D(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.url=X}function U(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.title=X}function G(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function ee(X){const fe=this.resume(),H=this.stack[this.stack.length-1];H.label=fe,H.identifier=Ba(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function ce(X){this.data.characterReferenceType=X.type}function oe(X){const fe=this.sliceSerialize(X),H=this.data.characterReferenceType;let se;H?(se=tN(fe,H==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):se=Mv(fe);const pe=this.stack[this.stack.length-1];pe.value+=se}function be(X){const fe=this.stack.pop();fe.position.end=vi(X.end)}function Re(X){_.call(this,X);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(X)}function Ne(X){_.call(this,X);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(X)}function De(){return{type:"blockquote",children:[]}}function We(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function ft(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ie(){return{type:"emphasis",children:[]}}function qe(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function lt(){return{type:"html",value:""}}function ye(){return{type:"image",title:null,url:"",alt:null}}function Oe(){return{type:"link",title:null,url:"",children:[]}}function Lt(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function $t(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function Qt(){return{type:"paragraph",children:[]}}function Gt(){return{type:"strong",children:[]}}function ut(){return{type:"text",value:""}}function xe(){return{type:"thematicBreak"}}}function vi(e){return{line:e.line,column:e.column,offset:e.offset}}function pN(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?pN(e,r):E9(e,r)}}function E9(e,t){let n;for(n in t)if(dN.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 pk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ul({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ul({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ul({start:t.start,end:t.end})+") is still open")}function A9(e){const t=this;t.parser=n;function n(r){return C9(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function T9(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function R9(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
1628
|
+
`}]}function _9(e,t){const n=t.value?t.value+`
|
|
1629
|
+
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function O9(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function M9(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function L9(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Ao(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let c,d=e.footnoteCounts.get(r);d===void 0?(d=0,e.footnoteOrder.push(r),c=e.footnoteOrder.length):c=l+1,d+=1,e.footnoteCounts.set(r,d);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,f);const h={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,h),e.applyData(t,h)}function D9(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 I9(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function fN(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),l=s[0];l&&l.type==="text"?l.value="["+l.value:s.unshift({type:"text",value:"["});const c=s[s.length-1];return c&&c.type==="text"?c.value+=r:s.push({type:"text",value:r}),s}function z9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fN(e,t);const s={src:Ao(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const l={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,l),e.applyData(t,l)}function $9(e,t){const n={src:Ao(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function P9(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function U9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fN(e,t);const s={href:Ao(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const l={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function B9(e,t){const n={href:Ao(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 F9(e,t,n){const r=e.all(t),s=n?H9(n):hN(t),l={},c=[];if(typeof t.checked=="boolean"){const g=r[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let d=-1;for(;++d<r.length;){const g=r[d];(s||d!==0||g.type!=="element"||g.tagName!=="p")&&c.push({type:"text",value:`
|
|
1630
|
+
`}),g.type==="element"&&g.tagName==="p"&&!s?c.push(...g.children):c.push(g)}const f=r[r.length-1];f&&(s||f.type!=="element"||f.tagName!=="p")&&c.push({type:"text",value:`
|
|
1631
|
+
`});const h={type:"element",tagName:"li",properties:l,children:c};return e.patch(t,h),e.applyData(t,h)}function H9(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=hN(n[r])}return t}function hN(e){const t=e.spread;return t??e.children.length>1}function q9(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 c=r[s];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,l),e.applyData(t,l)}function G9(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function V9(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function W9(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Z9(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],c),s.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=Av(t.children[1]),f=WC(t.children[t.children.length-1]);d&&f&&(c.position={start:d,end:f}),s.push(c)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,l),e.applyData(t,l)}function K9(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,d=c?c.length:t.children.length;let f=-1;const h=[];for(;++f<d;){const m=t.children[f],v={},b=c?c[f]:void 0;b&&(v.align=b);let k={type:"element",tagName:l,properties:v,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 Y9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const fk=9,hk=32;function Q9(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const l=[];for(;r;)l.push(mk(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return l.push(mk(t.slice(s),s>0,!1)),l.join("")}function mk(e,t,n){let r=0,s=e.length;if(t){let l=e.codePointAt(r);for(;l===fk||l===hk;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(s-1);for(;l===fk||l===hk;)s--,l=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function X9(e,t){const n={type:"text",value:Q9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function J9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const eB={blockquote:T9,break:R9,code:_9,delete:O9,emphasis:M9,footnoteReference:L9,heading:D9,html:I9,imageReference:z9,image:$9,inlineCode:P9,linkReference:U9,link:B9,listItem:F9,list:q9,paragraph:G9,root:V9,strong:W9,table:Z9,tableCell:Y9,tableRow:K9,text:X9,thematicBreak:J9,toml:Fu,yaml:Fu,definition:Fu,footnoteDefinition:Fu};function Fu(){}const mN=-1,tp=0,Fl=1,Ad=2,Dv=3,Iv=4,zv=5,$v=6,gN=7,vN=8,tB=typeof self=="object"?self:globalThis,gk=(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 tB[e](t)},nB=(e,t)=>{const n=(s,l)=>(e.set(l,s),s),r=s=>{if(e.has(s))return e.get(s);const[l,c]=t[s];switch(l){case tp:case mN:return n(c,s);case Fl:{const d=n([],s);for(const f of c)d.push(r(f));return d}case Ad:{const d=n({},s);for(const[f,h]of c)d[r(f)]=r(h);return d}case Dv:return n(new Date(c),s);case Iv:{const{source:d,flags:f}=c;return n(new RegExp(d,f),s)}case zv:{const d=n(new Map,s);for(const[f,h]of c)d.set(r(f),r(h));return d}case $v:{const d=n(new Set,s);for(const f of c)d.add(r(f));return d}case gN:{const{name:d,message:f}=c;return n(gk(d,f),s)}case vN:return n(BigInt(c),s);case"BigInt":return n(Object(BigInt(c)),s);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:d}=new Uint8Array(c);return n(new DataView(d),c)}}return n(gk(l,c),s)};return r},vk=e=>nB(new Map,e)(0),ao="",{toString:aB}={},{keys:rB}=Object,Rl=e=>{const t=typeof e;if(t!=="object"||!e)return[tp,t];const n=aB.call(e).slice(8,-1);switch(n){case"Array":return[Fl,ao];case"Object":return[Ad,ao];case"Date":return[Dv,ao];case"RegExp":return[Iv,ao];case"Map":return[zv,ao];case"Set":return[$v,ao];case"DataView":return[Fl,n]}return n.includes("Array")?[Fl,n]:n.includes("Error")?[gN,n]:[Ad,n]},Hu=([e,t])=>e===tp&&(t==="function"||t==="symbol"),iB=(e,t,n,r)=>{const s=(c,d)=>{const f=r.push(c)-1;return n.set(d,f),f},l=c=>{if(n.has(c))return n.get(c);let[d,f]=Rl(c);switch(d){case tp:{let g=c;switch(f){case"bigint":d=vN,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);g=null;break;case"undefined":return s([mN],c)}return s([d,g],c)}case Fl:{if(f){let v=c;return f==="DataView"?v=new Uint8Array(c.buffer):f==="ArrayBuffer"&&(v=new Uint8Array(c)),s([f,[...v]],c)}const g=[],m=s([d,g],c);for(const v of c)g.push(l(v));return m}case Ad:{if(f)switch(f){case"BigInt":return s([f,c.toString()],c);case"Boolean":case"Number":case"String":return s([f,c.valueOf()],c)}if(t&&"toJSON"in c)return l(c.toJSON());const g=[],m=s([d,g],c);for(const v of rB(c))(e||!Hu(Rl(c[v])))&&g.push([l(v),l(c[v])]);return m}case Dv:return s([d,c.toISOString()],c);case Iv:{const{source:g,flags:m}=c;return s([d,{source:g,flags:m}],c)}case zv:{const g=[],m=s([d,g],c);for(const[v,b]of c)(e||!(Hu(Rl(v))||Hu(Rl(b))))&&g.push([l(v),l(b)]);return m}case $v:{const g=[],m=s([d,g],c);for(const v of c)(e||!Hu(Rl(v)))&&g.push(l(v));return m}}const{message:h}=c;return s([d,{name:f,message:h}],c)};return l},yk=(e,{json:t,lossy:n}={})=>{const r=[];return iB(!(t||n),!!t,new Map,r)(e),r},Td=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?vk(yk(e,t)):structuredClone(e):(e,t)=>vk(yk(e,t));function sB(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 oB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function lB(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||sB,r=e.options.footnoteBackLabel||oB,s=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",c=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(),v=Ao(m.toLowerCase());let b=0;const k=[],j=e.footnoteCounts.get(m);for(;j!==void 0&&++b<=j;){k.length>0&&k.push({type:"text",value:" "});let N=typeof n=="string"?n:n(f,b);typeof N=="string"&&(N={type:"text",value:N}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+v+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,b),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const N=C.children[C.children.length-1];N&&N.type==="text"?N.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...k)}else g.push(...k);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+v},children:e.wrap(g,!0)};e.patch(h,S),d.push(S)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...Td(c),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 np=(function(e){if(e==null)return pB;if(typeof e=="function")return ap(e);if(typeof e=="object")return Array.isArray(e)?cB(e):uB(e);if(typeof e=="string")return dB(e);throw new Error("Expected function, string, or object as test")});function cB(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=np(e[n]);return ap(r);function r(...s){let l=-1;for(;++l<t.length;)if(t[l].apply(this,s))return!0;return!1}}function uB(e){const t=e;return ap(n);function n(r){const s=r;let l;for(l in e)if(s[l]!==t[l])return!1;return!0}}function dB(e){return ap(t);function t(n){return n&&n.type===e}}function ap(e){return t;function t(n,r,s){return!!(fB(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function pB(){return!0}function fB(e){return e!==null&&typeof e=="object"&&"type"in e}const yN=[],hB=!0,lg=!1,mB="skip";function bN(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const l=np(s),c=r?-1:1;d(e,void 0,[])();function d(f,h,g){const m=f&&typeof f=="object"?f:{};if(typeof m.type=="string"){const b=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(f.type+(b?"<"+b+">":""))+")"})}return v;function v(){let b=yN,k,j,C;if((!t||l(f,h,g[g.length-1]||void 0))&&(b=gB(n(f,g)),b[0]===lg))return b;if("children"in f&&f.children){const S=f;if(S.children&&b[0]!==mB)for(j=(r?S.children.length:-1)+c,C=g.concat(S);j>-1&&j<S.children.length;){const N=S.children[j];if(k=d(N,j,C)(),k[0]===lg)return k;j=typeof k[1]=="number"?k[1]:j+c}}return b}}}function gB(e){return Array.isArray(e)?e:typeof e=="number"?[hB,e]:e==null?yN:[e]}function Pv(e,t,n,r){let s,l,c;typeof t=="function"&&typeof n!="function"?(l=void 0,c=t,s=n):(l=t,c=n,s=r),bN(e,l,d,s);function d(f,h){const g=h[h.length-1],m=g?g.children.indexOf(f):void 0;return c(f,m,g)}}const cg={}.hasOwnProperty,vB={};function yB(e,t){const n=t||vB,r=new Map,s=new Map,l=new Map,c={...eB,...n.handlers},d={all:h,applyData:xB,definitionById:r,footnoteById:s,footnoteCounts:l,footnoteOrder:[],handlers:c,one:f,options:n,patch:bB,wrap:kB};return Pv(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?r:s,v=String(g.identifier).toUpperCase();m.has(v)||m.set(v,g)}}),d;function f(g,m){const v=g.type,b=d.handlers[v];if(cg.call(d.handlers,v)&&b)return b(d,g,m);if(d.options.passThrough&&d.options.passThrough.includes(v)){if("children"in g){const{children:j,...C}=g,S=Td(C);return S.children=d.all(g),S}return Td(g)}return(d.options.unknownHandler||wB)(d,g,m)}function h(g){const m=[];if("children"in g){const v=g.children;let b=-1;for(;++b<v.length;){const k=d.one(v[b],g);if(k){if(b&&v[b-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=bk(k.value)),!Array.isArray(k)&&k.type==="element")){const j=k.children[0];j&&j.type==="text"&&(j.value=bk(j.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function bB(e,t){e.position&&(t.position=sU(e))}function xB(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,l=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const c="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:c}}n.type==="element"&&l&&Object.assign(n.properties,Td(l)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function wB(e,t){const n=t.data||{},r="value"in t&&!(cg.call(n,"hProperties")||cg.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 kB(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 bk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function xk(e,t){const n=yB(e,t),r=n.one(e,void 0),s=lB(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&l.children.push({type:"text",value:`
|
|
1637
|
+
`},s),l}function SB(e,t){return e&&"run"in e?async function(n,r){const s=xk(n,{file:r,...t});await e.run(s,r)}:function(n,r){return xk(n,{file:r,...e||t})}}function wk(e){if(e)throw e}var lm,kk;function jB(){if(kk)return lm;kk=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},l=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!m)return!1;var v;for(v in h);return typeof v>"u"||e.call(h,v)},c=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 lm=function f(){var h,g,m,v,b,k,j=arguments[0],C=1,S=arguments.length,N=!1;for(typeof j=="boolean"&&(N=j,j=arguments[1]||{},C=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});C<S;++C)if(h=arguments[C],h!=null)for(g in h)m=d(j,g),v=d(h,g),j!==v&&(N&&v&&(l(v)||(b=s(v)))?(b?(b=!1,k=m&&s(m)?m:[]):k=m&&l(m)?m:{},c(j,{name:g,newValue:f(N,k,v)})):typeof v<"u"&&c(j,{name:g,newValue:v}));return j},lm}var CB=jB();const cm=Jl(CB);function ug(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 NB(){const e=[],t={run:n,use:r};return t;function n(...s){let l=-1;const c=s.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);d(null,...s);function d(f,...h){const g=e[++l];let m=-1;if(f){c(f);return}for(;++m<s.length;)(h[m]===null||h[m]===void 0)&&(h[m]=s[m]);s=h,g?EB(g,d)(...h):c(null,...h)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function EB(e,t){let n;return r;function r(...c){const d=e.length>c.length;let f;d&&c.push(s);try{f=e.apply(this,c)}catch(h){const g=h;if(d&&n)throw g;return s(g)}d||(f&&f.then&&typeof f.then=="function"?f.then(l,s):f instanceof Error?s(f):l(f))}function s(c,...d){n||(n=!0,t(c,...d))}function l(c){s(null,c)}}const ar={basename:AB,dirname:TB,extname:RB,join:_B,sep:"/"};function AB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');uc(e);let n=0,r=-1,s=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else r<0&&(l=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let c=-1,d=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else c<0&&(l=!0,c=s+1),d>-1&&(e.codePointAt(s)===t.codePointAt(d--)?d<0&&(r=s):(d=-1,r=c));return n===r?r=c:r<0&&(r=e.length),e.slice(n,r)}function TB(e){if(uc(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 RB(e){uc(e);let t=e.length,n=-1,r=0,s=-1,l=0,c;for(;t--;){const d=e.codePointAt(t);if(d===47){if(c){r=t+1;break}continue}n<0&&(c=!0,n=t+1),d===46?s<0?s=t:l!==1&&(l=1):s>-1&&(l=-1)}return s<0||n<0||l===0||l===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function _B(...e){let t=-1,n;for(;++t<e.length;)uc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":OB(n)}function OB(e){uc(e);const t=e.codePointAt(0)===47;let n=MB(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function MB(e,t){let n="",r=0,s=-1,l=0,c=-1,d,f;for(;++c<=e.length;){if(c<e.length)d=e.codePointAt(c);else{if(d===47)break;d=47}if(d===47){if(!(s===c-1||l===1))if(s!==c-1&&l===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),s=c,l=0;continue}}else if(n.length>0){n="",r=0,s=c,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,c):n=e.slice(s+1,c),r=c-s-1;s=c,l=0}else d===46&&l>-1?l++:l=-1}return n}function uc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const LB={cwd:DB};function DB(){return"/"}function dg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function IB(e){if(typeof e=="string")e=new URL(e);else if(!dg(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 zB(e)}function zB(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 um=["history","path","basename","stem","extname","dirname"];class xN{constructor(t){let n;t?dg(t)?n={path:t}:typeof t=="string"||$B(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":LB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<um.length;){const l=um[r];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let s;for(s in n)um.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ar.basename(this.path):void 0}set basename(t){pm(t,"basename"),dm(t,"basename"),this.path=ar.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ar.dirname(this.path):void 0}set dirname(t){Sk(this.basename,"dirname"),this.path=ar.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ar.extname(this.path):void 0}set extname(t){if(dm(t,"extname"),Sk(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=ar.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){dg(t)&&(t=IB(t)),pm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ar.basename(this.path,this.extname):void 0}set stem(t){pm(t,"stem"),dm(t,"stem"),this.path=ar.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 On(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 dm(e,t){if(e&&e.includes(ar.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ar.sep+"`")}function pm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Sk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function $B(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const PB=(function(e){const r=this.constructor.prototype,s=r[e],l=function(){return s.apply(l,arguments)};return Object.setPrototypeOf(l,r),l}),UB={}.hasOwnProperty;class Uv extends PB{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=NB()}copy(){const t=new Uv;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(cm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(mm("data",this.frozen),this.namespace[t]=n,this):UB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(mm("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=qu(t),r=this.parser||this.Parser;return fm("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),fm("process",this.parser||this.Parser),hm("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(l,c){const d=qu(t),f=r.parse(d);r.run(f,d,function(g,m,v){if(g||!m||!v)return h(g);const b=m,k=r.stringify(b,v);HB(k)?v.value=k:v.result=k,h(g,v)});function h(g,m){g||!m?c(g):l?l(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),fm("processSync",this.parser||this.Parser),hm("processSync",this.compiler||this.Compiler),this.process(t,s),Ck("processSync","process",n),r;function s(l,c){n=!0,wk(l),r=c}}run(t,n,r){jk(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?l(void 0,r):new Promise(l);function l(c,d){const f=qu(n);s.run(t,f,h);function h(g,m,v){const b=m||t;g?d(g):c?c(b):r(void 0,b,v)}}}runSync(t,n){let r=!1,s;return this.run(t,n,l),Ck("runSync","run",r),s;function l(c,d){wk(c),s=d,r=!0}}stringify(t,n){this.freeze();const r=qu(n),s=this.compiler||this.Compiler;return hm("stringify",s),jk(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(mm("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(h){if(typeof h=="function")f(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...m]=h;f(g,m)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(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=cm(!0,s.settings,h.settings))}function d(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const m=h[g];l(m)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function f(h,g){let m=-1,v=-1;for(;++m<r.length;)if(r[m][0]===h){v=m;break}if(v===-1)r.push([h,...g]);else if(g.length>0){let[b,...k]=g;const j=r[v][1];ug(j)&&ug(b)&&(b=cm(!0,j,b)),r[v]=[h,b,...k]}}}}const BB=new Uv().freeze();function fm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function hm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function mm(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 jk(e){if(!ug(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ck(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function qu(e){return FB(e)?e:new xN(e)}function FB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function HB(e){return typeof e=="string"||qB(e)}function qB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const GB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Nk=[],Ek={allowDangerousHtml:!0},VB=/^(https?|ircs?|mailto|xmpp)$/i,WB=[{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 ZB(e){const t=KB(e),n=YB(e);return QB(t.runSync(t.parse(n),n),e)}function KB(e){const t=e.rehypePlugins||Nk,n=e.remarkPlugins||Nk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ek}:Ek;return BB().use(A9).use(n).use(SB,r).use(t)}function YB(e){const t=e.children||"",n=new xN;return typeof t=="string"&&(n.value=t),n}function QB(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,l=t.disallowedElements,c=t.skipHtml,d=t.unwrapDisallowed,f=t.urlTransform||XB;for(const g of WB)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+GB+g.id,void 0);return Pv(e,h),dU(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function h(g,m,v){if(g.type==="raw"&&v&&typeof m=="number")return c?v.children.splice(m,1):v.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let b;for(b in im)if(Object.hasOwn(im,b)&&Object.hasOwn(g.properties,b)){const k=g.properties[b],j=im[b];(j===null||j.includes(g.tagName))&&(g.properties[b]=f(String(k||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):l?l.includes(g.tagName):!1;if(!b&&r&&typeof m=="number"&&(b=!r(g,m,v)),b&&v&&typeof m=="number")return d&&g.children?v.children.splice(m,1,...g.children):v.children.splice(m,1),m}}}function XB(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||VB.test(e.slice(0,t))?e:""}function Ak(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 JB(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function wN(e,t,n){const s=np((n||{}).ignore||[]),l=eF(t);let c=-1;for(;++c<l.length;)bN(e,"text",d);function d(h,g){let m=-1,v;for(;++m<g.length;){const b=g[m],k=v?v.children:void 0;if(s(b,k?k.indexOf(b):void 0,v))return;v=b}if(v)return f(h,g)}function f(h,g){const m=g[g.length-1],v=l[c][0],b=l[c][1];let k=0;const C=m.children.indexOf(h);let S=!1,N=[];v.lastIndex=0;let E=v.exec(h.value);for(;E;){const T=E.index,$={index:E.index,input:E.input,stack:[...g,h]};let R=b(...E,$);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?v.lastIndex=T+1:(k!==T&&N.push({type:"text",value:h.value.slice(k,T)}),Array.isArray(R)?N.push(...R):R&&N.push(R),k=T+E[0].length,S=!0),!v.global)break;E=v.exec(h.value)}return S?(k<h.value.length&&N.push({type:"text",value:h.value.slice(k)}),m.children.splice(C,1,...N)):N=[h],C+N.length}}function eF(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([tF(s[0]),nF(s[1])])}return t}function tF(e){return typeof e=="string"?new RegExp(JB(e),"g"):e}function nF(e){return typeof e=="function"?e:function(){return e}}const gm="phrasing",vm=["autolink","link","image","label"];function aF(){return{transforms:[uF],enter:{literalAutolink:iF,literalAutolinkEmail:ym,literalAutolinkHttp:ym,literalAutolinkWww:ym},exit:{literalAutolink:cF,literalAutolinkEmail:lF,literalAutolinkHttp:sF,literalAutolinkWww:oF}}}function rF(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:gm,notInConstruct:vm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:gm,notInConstruct:vm},{character:":",before:"[ps]",after:"\\/",inConstruct:gm,notInConstruct:vm}]}}function iF(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ym(e){this.config.enter.autolinkProtocol.call(this,e)}function sF(e){this.config.exit.autolinkProtocol.call(this,e)}function oF(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 lF(e){this.config.exit.autolinkEmail.call(this,e)}function cF(e){this.exit(e)}function uF(e){wN(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,dF],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),pF]],{ignore:["link","linkReference"]})}function dF(e,t,n,r,s){let l="";if(!kN(s)||(/^w/i.test(t)&&(n=t+n,t="",l="http://"),!fF(n)))return!1;const c=hF(n+r);if(!c[0])return!1;const d={type:"link",title:null,url:l+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[d,{type:"text",value:c[1]}]:d}function pF(e,t,n,r){return!kN(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function fF(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 hF(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=Ak(e,"(");let l=Ak(e,")");for(;r!==-1&&s>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function kN(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ss(n)||Jd(n))&&(!t||n!==47)}SN.peek=SF;function mF(){this.buffer()}function gF(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function vF(){this.buffer()}function yF(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function bF(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ba(this.sliceSerialize(e)).toLowerCase(),n.label=t}function xF(e){this.exit(e)}function wF(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ba(this.sliceSerialize(e)).toLowerCase(),n.label=t}function kF(e){this.exit(e)}function SF(){return"["}function SN(e,t,n,r){const s=n.createTracker(r);let l=s.move("[^");const c=n.enter("footnoteReference"),d=n.enter("reference");return l+=s.move(n.safe(n.associationId(e),{after:"]",before:l})),d(),c(),l+=s.move("]"),l}function jF(){return{enter:{gfmFootnoteCallString:mF,gfmFootnoteCall:gF,gfmFootnoteDefinitionLabelString:vF,gfmFootnoteDefinition:yF},exit:{gfmFootnoteCallString:bF,gfmFootnoteCall:xF,gfmFootnoteDefinitionLabelString:wF,gfmFootnoteDefinition:kF}}}function CF(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:SN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,l,c){const d=l.createTracker(c);let f=d.move("[^");const h=l.enter("footnoteDefinition"),g=l.enter("label");return f+=d.move(l.safe(l.associationId(r),{before:f,after:"]"})),g(),f+=d.move("]:"),r.children&&r.children.length>0&&(d.shift(4),f+=d.move((t?`
|
|
1638
|
+
`:" ")+l.indentLines(l.containerFlow(r,d.current()),t?jN:NF))),h(),f}}function NF(e,t,n){return t===0?e:jN(e,t,n)}function jN(e,t,n){return(n?"":" ")+e}const EF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];CN.peek=OF;function AF(){return{canContainEols:["delete"],enter:{strikethrough:RF},exit:{strikethrough:_F}}}function TF(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:EF}],handlers:{delete:CN}}}function RF(e){this.enter({type:"delete",children:[]},e)}function _F(e){this.exit(e)}function CN(e,t,n,r){const s=n.createTracker(r),l=n.enter("strikethrough");let c=s.move("~~");return c+=n.containerPhrasing(e,{...s.current(),before:c,after:"~"}),c+=s.move("~~"),l(),c}function OF(){return"~"}function MF(e){return e.length}function LF(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||MF,l=[],c=[],d=[],f=[];let h=0,g=-1;for(;++g<e.length;){const j=[],C=[];let S=-1;for(e[g].length>h&&(h=e[g].length);++S<e[g].length;){const N=DF(e[g][S]);if(n.alignDelimiters!==!1){const E=s(N);C[S]=E,(f[S]===void 0||E>f[S])&&(f[S]=E)}j.push(N)}c[g]=j,d[g]=C}let m=-1;if(typeof r=="object"&&"length"in r)for(;++m<h;)l[m]=Tk(r[m]);else{const j=Tk(r);for(;++m<h;)l[m]=j}m=-1;const v=[],b=[];for(;++m<h;){const j=l[m];let C="",S="";j===99?(C=":",S=":"):j===108?C=":":j===114&&(S=":");let N=n.alignDelimiters===!1?1:Math.max(1,f[m]-C.length-S.length);const E=C+"-".repeat(N)+S;n.alignDelimiters!==!1&&(N=C.length+N+S.length,N>f[m]&&(f[m]=N),b[m]=N),v[m]=E}c.splice(1,0,v),d.splice(1,0,b),g=-1;const k=[];for(;++g<c.length;){const j=c[g],C=d[g];m=-1;const S=[];for(;++m<h;){const N=j[m]||"";let E="",T="";if(n.alignDelimiters!==!1){const $=f[m]-(C[m]||0),R=l[m];R===114?E=" ".repeat($):R===99?$%2?(E=" ".repeat($/2+.5),T=" ".repeat($/2-.5)):(E=" ".repeat($/2),T=E):T=" ".repeat($)}n.delimiterStart!==!1&&!m&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||m)&&S.push(" "),n.alignDelimiters!==!1&&S.push(E),S.push(N),n.alignDelimiters!==!1&&S.push(T),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||m!==h-1)&&S.push("|")}k.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return k.join(`
|
|
1639
|
+
`)}function DF(e){return e==null?"":String(e)}function Tk(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 IF(e,t,n,r){const s=n.enter("blockquote"),l=n.createTracker(r);l.move("> "),l.shift(2);const c=n.indentLines(n.containerFlow(e,l.current()),zF);return s(),c}function zF(e,t,n){return">"+(n?"":" ")+e}function $F(e,t){return Rk(e,t.inConstruct,!0)&&!Rk(e,t.notInConstruct,!1)}function Rk(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 _k(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
1640
|
+
`&&$F(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
1641
|
+
`}function PF(e,t){const n=String(e);let r=n.indexOf(t),s=r,l=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++l>c&&(c=l):l=1,s=r+t.length,r=n.indexOf(t,s);return c}function UF(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 BF(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 FF(e,t,n,r){const s=BF(n),l=e.value||"",c=s==="`"?"GraveAccent":"Tilde";if(UF(e,n)){const m=n.enter("codeIndented"),v=n.indentLines(l,HF);return m(),v}const d=n.createTracker(r),f=s.repeat(Math.max(PF(l,s)+1,3)),h=n.enter("codeFenced");let g=d.move(f);if(e.lang){const m=n.enter(`codeFencedLang${c}`);g+=d.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...d.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${c}`);g+=d.move(" "),g+=d.move(n.safe(e.meta,{before:g,after:`
|
|
1642
|
+
`,encode:["`"],...d.current()})),m()}return g+=d.move(`
|
|
1643
|
+
`),l&&(g+=d.move(l+`
|
|
1644
|
+
`)),g+=d.move(f),h(),g}function HF(e,t,n){return(n?"":" ")+e}function Bv(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 qF(e,t,n,r){const s=Bv(n),l=s==='"'?"Quote":"Apostrophe",c=n.enter("definition");let d=n.enter("label");const f=n.createTracker(r);let h=f.move("[");return h+=f.move(n.safe(n.associationId(e),{before:h,after:"]",...f.current()})),h+=f.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(d=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":`
|
|
1645
|
+
`,...f.current()}))),d(),e.title&&(d=n.enter(`title${l}`),h+=f.move(" "+s),h+=f.move(n.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),d()),c(),h}function GF(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 Ql(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Rd(e,t,n){const r=bo(e),s=bo(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}}NN.peek=VF;function NN(e,t,n,r){const s=GF(n),l=n.enter("emphasis"),c=n.createTracker(r),d=c.move(s);let f=c.move(n.containerPhrasing(e,{after:s,before:d,...c.current()}));const h=f.charCodeAt(0),g=Rd(r.before.charCodeAt(r.before.length-1),h,s);g.inside&&(f=Ql(h)+f.slice(1));const m=f.charCodeAt(f.length-1),v=Rd(r.after.charCodeAt(0),m,s);v.inside&&(f=f.slice(0,-1)+Ql(m));const b=c.move(s);return l(),n.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},d+f+b}function VF(e,t,n){return n.options.emphasis||"*"}function WF(e,t){let n=!1;return Pv(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,lg}),!!((!e.depth||e.depth<3)&&Ov(e)&&(t.options.setext||n))}function ZF(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(WF(e,n)){const g=n.enter("headingSetext"),m=n.enter("phrasing"),v=n.containerPhrasing(e,{...l.current(),before:`
|
|
1646
|
+
`,after:`
|
|
1647
|
+
`});return m(),g(),v+`
|
|
1648
|
+
`+(s===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
|
|
1649
|
+
`))+1))}const c="#".repeat(s),d=n.enter("headingAtx"),f=n.enter("phrasing");l.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
|
|
1650
|
+
`,...l.current()});return/^[\t ]/.test(h)&&(h=Ql(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),f(),d(),h}EN.peek=KF;function EN(e){return e.value||""}function KF(){return"<"}AN.peek=YF;function AN(e,t,n,r){const s=Bv(n),l=s==='"'?"Quote":"Apostrophe",c=n.enter("image");let d=n.enter("label");const f=n.createTracker(r);let h=f.move("![");return h+=f.move(n.safe(e.alt,{before:h,after:"]",...f.current()})),h+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(d=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=n.enter(`title${l}`),h+=f.move(" "+s),h+=f.move(n.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),d()),h+=f.move(")"),c(),h}function YF(){return"!"}TN.peek=QF;function TN(e,t,n,r){const s=e.referenceType,l=n.enter("imageReference");let c=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+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return c(),n.stack=g,l(),s==="full"||!h||h!==m?f+=d.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function QF(){return"!"}RN.peek=XF;function RN(e,t,n){let r=e.value||"",s="`",l=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l<n.unsafe.length;){const c=n.unsafe[l],d=n.compilePattern(c);let f;if(c.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 XF(){return"`"}function _N(e,t){const n=Ov(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))}ON.peek=JF;function ON(e,t,n,r){const s=Bv(n),l=s==='"'?"Quote":"Apostrophe",c=n.createTracker(r);let d,f;if(_N(e,n)){const g=n.stack;n.stack=[],d=n.enter("autolink");let m=c.move("<");return m+=c.move(n.containerPhrasing(e,{before:m,after:">",...c.current()})),m+=c.move(">"),d(),n.stack=g,m}d=n.enter("link"),f=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(f=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),f(),e.title&&(f=n.enter(`title${l}`),h+=c.move(" "+s),h+=c.move(n.safe(e.title,{before:h,after:s,...c.current()})),h+=c.move(s),f()),h+=c.move(")"),d(),h}function JF(e,t,n){return _N(e,n)?"<":"["}MN.peek=e7;function MN(e,t,n,r){const s=e.referenceType,l=n.enter("linkReference");let c=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+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return c(),n.stack=g,l(),s==="full"||!h||h!==m?f+=d.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function e7(){return"["}function Fv(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 t7(e){const t=Fv(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 n7(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 LN(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 a7(e,t,n,r){const s=n.enter("list"),l=n.bulletCurrent;let c=e.ordered?n7(n):Fv(n);const d=e.ordered?c==="."?")":".":t7(n);let f=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&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),LN(n)===c&&g){let m=-1;for(;++m<e.children.length;){const v=e.children[m];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(c=d),n.bulletCurrent=c;const h=n.containerFlow(e,r);return n.bulletLastUsed=c,n.bulletCurrent=l,s(),h}function r7(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 i7(e,t,n,r){const s=r7(n);let l=n.bulletCurrent||Fv(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let c=l.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const d=n.createTracker(r);d.move(l+" ".repeat(c-l.length)),d.shift(c);const f=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,d.current()),g);return f(),h;function g(m,v,b){return v?(b?"":" ".repeat(c))+m:(b?l:l+" ".repeat(c-l.length))+m}}function s7(e,t,n,r){const s=n.enter("paragraph"),l=n.enter("phrasing"),c=n.containerPhrasing(e,r);return l(),s(),c}const o7=np(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function l7(e,t,n,r){return(e.children.some(function(c){return o7(c)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function c7(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}DN.peek=u7;function DN(e,t,n,r){const s=c7(n),l=n.enter("strong"),c=n.createTracker(r),d=c.move(s+s);let f=c.move(n.containerPhrasing(e,{after:s,before:d,...c.current()}));const h=f.charCodeAt(0),g=Rd(r.before.charCodeAt(r.before.length-1),h,s);g.inside&&(f=Ql(h)+f.slice(1));const m=f.charCodeAt(f.length-1),v=Rd(r.after.charCodeAt(0),m,s);v.inside&&(f=f.slice(0,-1)+Ql(m));const b=c.move(s+s);return l(),n.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},d+f+b}function u7(e,t,n){return n.options.strong||"*"}function d7(e,t,n,r){return n.safe(e.value,r)}function p7(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 f7(e,t,n){const r=(LN(n)+(n.options.ruleSpaces?" ":"")).repeat(p7(n));return n.options.ruleSpaces?r.slice(0,-1):r}const IN={blockquote:IF,break:_k,code:FF,definition:qF,emphasis:NN,hardBreak:_k,heading:ZF,html:EN,image:AN,imageReference:TN,inlineCode:RN,link:ON,linkReference:MN,list:a7,listItem:i7,paragraph:s7,root:l7,strong:DN,text:d7,thematicBreak:f7};function h7(){return{enter:{table:m7,tableData:Ok,tableHeader:Ok,tableRow:v7},exit:{codeText:y7,table:g7,tableData:bm,tableHeader:bm,tableRow:bm}}}function m7(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 g7(e){this.exit(e),this.data.inTable=void 0}function v7(e){this.enter({type:"tableRow",children:[]},e)}function bm(e){this.exit(e)}function Ok(e){this.enter({type:"tableCell",children:[]},e)}function y7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,b7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function b7(e,t){return t==="|"?t:e}function x7(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
1651
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:c,tableCell:f,tableRow:d}};function c(b,k,j,C){return h(g(b,j,C),b.align)}function d(b,k,j,C){const S=m(b,j,C),N=h([S]);return N.slice(0,N.indexOf(`
|
|
1652
|
+
`))}function f(b,k,j,C){const S=j.enter("tableCell"),N=j.enter("phrasing"),E=j.containerPhrasing(b,{...C,before:l,after:l});return N(),S(),E}function h(b,k){return LF(b,{align:k,alignDelimiters:r,padding:n,stringLength:s})}function g(b,k,j){const C=b.children;let S=-1;const N=[],E=k.enter("table");for(;++S<C.length;)N[S]=m(C[S],k,j);return E(),N}function m(b,k,j){const C=b.children;let S=-1;const N=[],E=k.enter("tableRow");for(;++S<C.length;)N[S]=f(C[S],b,k,j);return E(),N}function v(b,k,j){let C=IN.inlineCode(b,k,j);return j.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function w7(){return{exit:{taskListCheckValueChecked:Mk,taskListCheckValueUnchecked:Mk,paragraph:S7}}}function k7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:j7}}}function Mk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function S7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let l=-1,c;for(;++l<s.length;){const d=s[l];if(d.type==="paragraph"){c=d;break}}c===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 j7(e,t,n,r){const s=e.children[0],l=typeof e.checked=="boolean"&&s&&s.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",d=n.createTracker(r);l&&d.move(c);let f=IN.listItem(e,t,n,{...r,...d.current()});return l&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),f;function h(g){return g+c}}function C7(){return[aF(),jF(),AF(),h7(),w7()]}function N7(e){return{extensions:[rF(),CF(e),TF(),x7(e),k7()]}}const E7={tokenize:M7,partial:!0},zN={tokenize:L7,partial:!0},$N={tokenize:D7,partial:!0},PN={tokenize:I7,partial:!0},A7={tokenize:z7,partial:!0},UN={name:"wwwAutolink",tokenize:_7,previous:FN},BN={name:"protocolAutolink",tokenize:O7,previous:HN},Ur={name:"emailAutolink",tokenize:R7,previous:qN},cr={};function T7(){return{text:cr}}let Yi=48;for(;Yi<123;)cr[Yi]=Ur,Yi++,Yi===58?Yi=65:Yi===91&&(Yi=97);cr[43]=Ur;cr[45]=Ur;cr[46]=Ur;cr[95]=Ur;cr[72]=[Ur,BN];cr[104]=[Ur,BN];cr[87]=[Ur,UN];cr[119]=[Ur,UN];function R7(e,t,n){const r=this;let s,l;return c;function c(m){return!pg(m)||!qN.call(r,r.previous)||Hv(r.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(m))}function d(m){return pg(m)?(e.consume(m),d):m===64?(e.consume(m),f):n(m)}function f(m){return m===46?e.check(A7,g,h)(m):m===45||m===95||Rn(m)?(l=!0,e.consume(m),f):g(m)}function h(m){return e.consume(m),s=!0,f}function g(m){return l&&s&&zn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function _7(e,t,n){const r=this;return s;function s(c){return c!==87&&c!==119||!FN.call(r,r.previous)||Hv(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(E7,e.attempt(zN,e.attempt($N,l),n),n)(c))}function l(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function O7(e,t,n){const r=this;let s="",l=!1;return c;function c(m){return(m===72||m===104)&&HN.call(r,r.previous)&&!Hv(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 v=s.toLowerCase();if(v==="http"||v==="https")return e.consume(m),f}return n(m)}function f(m){return m===47?(e.consume(m),l?h:(l=!0,f)):n(m)}function h(m){return m===null||Ed(m)||Rt(m)||ss(m)||Jd(m)?n(m):e.attempt(zN,e.attempt($N,g),n)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function M7(e,t,n){let r=0;return s;function s(c){return(c===87||c===119)&&r<3?(r++,e.consume(c),s):c===46&&r===3?(e.consume(c),l):n(c)}function l(c){return c===null?n(c):t(c)}}function L7(e,t,n){let r,s,l;return c;function c(h){return h===46||h===95?e.check(PN,f,d)(h):h===null||Rt(h)||ss(h)||h!==45&&Jd(h)?f(h):(l=!0,e.consume(h),c)}function d(h){return h===95?r=!0:(s=r,r=void 0),e.consume(h),c}function f(h){return s||r||!l?n(h):t(h)}}function D7(e,t){let n=0,r=0;return s;function s(c){return c===40?(n++,e.consume(c),s):c===41&&r<n?l(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(PN,t,l)(c):c===null||Rt(c)||ss(c)?t(c):(e.consume(c),s)}function l(c){return c===41&&r++,e.consume(c),s}}function I7(e,t,n){return r;function r(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),r):d===38?(e.consume(d),l):d===93?(e.consume(d),s):d===60||d===null||Rt(d)||ss(d)?t(d):n(d)}function s(d){return d===null||d===40||d===91||Rt(d)||ss(d)?t(d):r(d)}function l(d){return zn(d)?c(d):n(d)}function c(d){return d===59?(e.consume(d),r):zn(d)?(e.consume(d),c):n(d)}}function z7(e,t,n){return r;function r(l){return e.consume(l),s}function s(l){return Rn(l)?n(l):t(l)}}function FN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Rt(e)}function HN(e){return!zn(e)}function qN(e){return!(e===47||pg(e))}function pg(e){return e===43||e===45||e===46||e===95||Rn(e)}function Hv(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 $7={tokenize:V7,partial:!0};function P7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:H7,continuation:{tokenize:q7},exit:G7}},text:{91:{name:"gfmFootnoteCall",tokenize:F7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:U7,resolveTo:B7}}}}function U7(e,t,n){const r=this;let s=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c;for(;s--;){const f=r.events[s][1];if(f.type==="labelImage"){c=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(!c||!c._balanced)return n(f);const h=Ba(r.sliceSerialize({start:c.end,end:r.now()}));return h.codePointAt(0)!==94||!l.includes(h.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function B7(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},d=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",l,t],["enter",c,t],["exit",c,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...d),e}function F7(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,c;return d;function d(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),f}function f(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(m){if(l>999||m===93&&!c||m===null||m===91||Rt(m))return n(m);if(m===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return s.includes(Ba(r.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Rt(m)||(c=!0),l++,e.consume(m),m===92?g:h}function g(m){return m===91||m===92||m===93?(e.consume(m),l++,h):h(m)}}function H7(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,c=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(c>999||k===93&&!d||k===null||k===91||Rt(k))return n(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return l=Ba(r.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return Rt(k)||(d=!0),c++,e.consume(k),k===92?m:g}function m(k){return k===91||k===92||k===93?(e.consume(k),c++,g):g(k)}function v(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),s.includes(l)||s.push(l),dt(e,b,"gfmFootnoteDefinitionWhitespace")):n(k)}function b(k){return t(k)}}function q7(e,t,n){return e.check(cc,t,e.attempt($7,t,n))}function G7(e){e.exit("gfmFootnoteDefinition")}function V7(e,t,n){const r=this;return dt(e,s,"gfmFootnoteDefinitionIndent",5);function s(l){const c=r.events[r.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(l):n(l)}}function W7(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(c,d){let f=-1;for(;++f<c.length;)if(c[f][0]==="enter"&&c[f][1].type==="strikethroughSequenceTemporary"&&c[f][1]._close){let h=f;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[f][1].end.offset-c[f][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[f][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[f][1].end)},m={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[f][1].start)},v=[["enter",g,d],["enter",c[h][1],d],["exit",c[h][1],d],["enter",m,d]],b=d.parser.constructs.insideSpan.null;b&&pa(v,v.length,0,ep(b,c.slice(h+1,f),d)),pa(v,v.length,0,[["exit",m,d],["enter",c[f][1],d],["exit",c[f][1],d],["exit",g,d]]),pa(c,h-1,f-h+3,v),f=h+v.length-2;break}}for(f=-1;++f<c.length;)c[f][1].type==="strikethroughSequenceTemporary"&&(c[f][1].type="data");return c}function l(c,d,f){const h=this.previous,g=this.events;let m=0;return v;function v(k){return h===126&&g[g.length-1][1].type!=="characterEscape"?f(k):(c.enter("strikethroughSequenceTemporary"),b(k))}function b(k){const j=bo(h);if(k===126)return m>1?f(k):(c.consume(k),m++,b);if(m<2&&!n)return f(k);const C=c.exit("strikethroughSequenceTemporary"),S=bo(k);return C._open=!S||S===2&&!!j,C._close=!j||j===2&&!!S,d(k)}}}class Z7{constructor(){this.map=[]}add(t,n,r){K7(this,t,n,r)}consume(t){if(this.map.sort(function(l,c){return l[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const l of s)t.push(l);s=r.pop()}this.map.length=0}}function K7(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 Y7(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Q7(){return{flow:{null:{name:"table",tokenize:X7,resolveAll:J7}}}}function X7(e,t,n){const r=this;let s=0,l=0,c;return d;function d(_){let I=r.events.length-1;for(;I>-1;){const z=r.events[I][1].type;if(z==="lineEnding"||z==="linePrefix")I--;else break}const F=I>-1?r.events[I][1].type:null,K=F==="tableHead"||F==="tableRow"?R:f;return K===R&&r.parser.lazy[r.now().line]?n(_):K(_)}function f(_){return e.enter("tableHead"),e.enter("tableRow"),h(_)}function h(_){return _===124||(c=!0,l+=1),g(_)}function g(_){return _===null?n(_):Pe(_)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),b):n(_):it(_)?dt(e,g,"whitespace")(_):(l+=1,c&&(c=!1,s+=1),_===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),m(_)))}function m(_){return _===null||_===124||Rt(_)?(e.exit("data"),g(_)):(e.consume(_),_===92?v:m)}function v(_){return _===92||_===124?(e.consume(_),m):m(_)}function b(_){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(_):(e.enter("tableDelimiterRow"),c=!1,it(_)?dt(e,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):k(_))}function k(_){return _===45||_===58?C(_):_===124?(c=!0,e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),j):$(_)}function j(_){return it(_)?dt(e,C,"whitespace")(_):C(_)}function C(_){return _===58?(l+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),S):_===45?(l+=1,S(_)):_===null||Pe(_)?T(_):$(_)}function S(_){return _===45?(e.enter("tableDelimiterFiller"),N(_)):$(_)}function N(_){return _===45?(e.consume(_),N):_===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(_))}function E(_){return it(_)?dt(e,T,"whitespace")(_):T(_)}function T(_){return _===124?k(_):_===null||Pe(_)?!c||s!==l?$(_):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(_)):$(_)}function $(_){return n(_)}function R(_){return e.enter("tableRow"),L(_)}function L(_){return _===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),L):_===null||Pe(_)?(e.exit("tableRow"),t(_)):it(_)?dt(e,L,"whitespace")(_):(e.enter("data"),B(_))}function B(_){return _===null||_===124||Rt(_)?(e.exit("data"),L(_)):(e.consume(_),_===92?O:B)}function O(_){return _===92||_===124?(e.consume(_),B):B(_)}}function J7(e,t){let n=-1,r=!0,s=0,l=[0,0,0,0],c=[0,0,0,0],d=!1,f=0,h,g,m;const v=new Z7;for(;++n<e.length;){const b=e[n],k=b[1];b[0]==="enter"?k.type==="tableHead"?(d=!1,f!==0&&(Lk(v,t,f,h,g),g=void 0,f=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.add(n,0,[["enter",h,t]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(r=!0,m=void 0,l=[0,0,0,0],c=[0,n+1,0,0],d&&(d=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.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,c[2]===0&&(l[1]!==0&&(c[0]=c[1],m=Gu(v,t,l,s,void 0,m),l=[0,0,0,0]),c[2]=n)):k.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(c[0]=c[1],m=Gu(v,t,l,s,void 0,m)),l=c,c=[l[1],n,0,0])):k.type==="tableHead"?(d=!0,f=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(f=n,l[1]!==0?(c[0]=c[1],m=Gu(v,t,l,s,n,m)):c[1]!==0&&(m=Gu(v,t,c,s,n,m)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=n)}for(f!==0&&Lk(v,t,f,h,g),v.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=Y7(t.events,n))}return e}function Gu(e,t,n,r,s,l){const c=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(l.end=Object.assign({},io(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const f=io(t.events,n[1]);if(l={type:c,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const h=io(t.events,n[2]),g=io(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 v=t.events[n[2]],b=t.events[n[3]];if(v[1].end=Object.assign({},b[1].end),v[1].type="chunkText",v[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,j=n[3]-n[2]-1;e.add(k,j,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return s!==void 0&&(l.end=Object.assign({},io(t.events,s)),e.add(s,0,[["exit",l,t]]),l=void 0),l}function Lk(e,t,n,r,s){const l=[],c=io(t.events,n);s&&(s.end=Object.assign({},c),l.push(["exit",s,t])),r.end=Object.assign({},c),l.push(["exit",r,t]),e.add(n+1,0,l)}function io(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const eH={name:"tasklistCheck",tokenize:nH};function tH(){return{text:{91:eH}}}function nH(e,t,n){const r=this;return s;function s(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),l)}function l(f){return Rt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),c):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),c):n(f)}function c(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:aH},t,n)(f):n(f)}}function aH(e,t,n){return dt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function rH(e){return eN([T7(),P7(),W7(e),Q7(),tH()])}const iH={};function sH(e){const t=this,n=e||iH,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),c=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(rH(n)),l.push(C7()),c.push(N7(n))}function oH(e){wN(e,[/\r?\n|\r/g,lH])}function lH(){return{type:"break"}}function cH(){return function(e){oH(e)}}const GN=[{aliases:{sh:"sh",shell:"sh",zsh:"sh",bash:"bash"},load:()=>gt(()=>import("./bash-Yzrsuije.js"),[])},{aliases:{css:"css"},load:()=>gt(()=>import("./css-CLj8gQPS.js"),[])},{aliases:{diff:"diff",patch:"diff"},load:()=>gt(()=>import("./diff-D97Zzqfu.js"),[])},{aliases:{dockerfile:"dockerfile",docker:"dockerfile"},load:()=>gt(()=>import("./dockerfile-BcOcwvcX.js"),[])},{aliases:{go:"go",golang:"go"},load:()=>gt(()=>import("./go-C27-OAKa.js"),[])},{aliases:{html:"html"},load:()=>gt(()=>import("./html-pp8916En.js"),__vite__mapDeps([3,4,5]))},{aliases:{js:"js",javascript:"js"},load:()=>gt(()=>import("./javascript-wDzz0qaB.js"),[])},{aliases:{json:"json"},load:()=>gt(()=>import("./json-Cp-IABpG.js"),[])},{aliases:{jsx:"jsx"},load:()=>gt(()=>import("./jsx-g9-lgVsj.js"),[])},{aliases:{md:"md",markdown:"md"},load:()=>gt(()=>import("./markdown-Cvjx9yec.js"),[])},{aliases:{py:"py",python:"py"},load:()=>gt(()=>import("./python-B6aJPvgy.js"),[])},{aliases:{rust:"rust",rs:"rust"},load:()=>gt(()=>import("./rust-B1yitclQ.js"),[])},{aliases:{solidity:"solidity",sol:"solidity"},load:()=>gt(()=>import("./solidity-rGO070M0.js"),[])},{aliases:{sparql:"sparql"},load:()=>gt(()=>import("./sparql-DVZY-KUA.js"),[])},{aliases:{sql:"sql"},load:()=>gt(()=>import("./sql-BLtJtn59.js"),[])},{aliases:{toml:"toml"},load:()=>gt(()=>import("./toml-vGWfd6FD.js"),[])},{aliases:{tsx:"tsx"},load:()=>gt(()=>import("./tsx-COt5Ahok.js"),[])},{aliases:{ts:"ts",typescript:"ts"},load:()=>gt(()=>import("./typescript-BPQ3VLAy.js"),[])},{aliases:{xml:"xml"},load:()=>gt(()=>import("./xml-B8PEiB0p.js"),[])},{aliases:{yaml:"yaml",yml:"yaml"},load:()=>gt(()=>import("./yaml-Buea-lGh.js"),[])}],VN=Object.freeze(Object.assign({},...GN.map(({aliases:e})=>e)));Object.freeze(Object.keys(VN));function uH(e){if(!e)return null;const t=e.toLowerCase().trim();return VN[t]??null}async function pW(){return(await Promise.all(GN.map(({load:t})=>t()))).flatMap(({default:t})=>t).filter((t,n,r)=>r.findIndex(s=>s.name===t.name)===n)}let _l=null;function dH(){return _l||(_l=gt(()=>import("./shikiHighlighter-C-LWPPSu.js"),[]).then(e=>e.createHighlighter()).catch(e=>{throw _l=null,e}),_l)}function pH({code:e,lang:t}){const n=uH(t),[r,s]=w.useState(null),[l,c]=w.useState(!1),f=Kn(m=>m.theme)==="light"?"github-light":"github-dark",h=w.useRef(null);w.useEffect(()=>{if(!n){s(null);return}let m=!1;return dH().then(v=>{if(!m)try{s(v.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),c(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>c(!1),1200)}catch{}};return o.jsxs("div",{className:"v10-md-pre",children:[o.jsx("button",{type:"button",className:"v10-md-copy",onClick:g,"aria-label":l?"Copied":"Copy code",title:l?"Copied":"Copy code",children:l?o.jsx(TO,{size:14,"aria-hidden":"true"}):o.jsx(LO,{size:14,"aria-hidden":"true"})}),o.jsx("span",{className:"v10-md-copy-announce","aria-live":"polite",children:l?"Copied":""}),n&&o.jsx("span",{className:"v10-md-pre-lang","aria-hidden":"true",children:n}),r?o.jsx("div",{className:"v10-md-pre-rendered",dangerouslySetInnerHTML:{__html:r}}):o.jsx("pre",{className:"v10-md-pre-fallback",children:o.jsx("code",{children:e})})]})}function fH(){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 v=m.tagName;v==="pre"?(t="code",s(m,!0)):v&&r.has(v)?t="leaf":s(m,f)}}},l=e;s(l,!1);const c={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,c)}else t==="leaf"&&Array.isArray(l.children)&&l.children.push(c)}}function hH(e){return e?/^https?:\/\//i.test(e)?"http":/^mailto:/i.test(e)?"mailto":"inert":"inert"}function WN({content:e,streaming:t}){return o.jsx("div",{className:"v10-md",children:o.jsx(ZB,{remarkPlugins:[sH,cH],rehypePlugins:t?[fH]:[],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=hH(n);return s==="http"?o.jsx("a",{className:"v10-md-link",href:n,target:"_blank",rel:"noopener noreferrer",children:r}):s==="mailto"?o.jsx("a",{className:"v10-md-link",href:n,children:r}):o.jsx("span",{className:"v10-md-link v10-md-link-inert",title:n,children:r})},blockquote:({children:n})=>o.jsx("blockquote",{className:"v10-md-blockquote",children:n}),hr:()=>o.jsx("hr",{className:"v10-md-hr"}),table:({children:n})=>o.jsx("div",{className:"v10-md-table-scroll",children:o.jsx("table",{className:"v10-md-table",children:n})}),thead:({children:n,node:r,...s})=>o.jsx("thead",{className:"v10-md-thead",...s,children:n}),tbody:({children:n,node:r,...s})=>o.jsx("tbody",{className:"v10-md-tbody",...s,children:n}),tr:({children:n,node:r,...s})=>o.jsx("tr",{className:"v10-md-tr",...s,children:n}),th:({children:n,node:r,...s})=>o.jsx("th",{className:"v10-md-th",...s,children:n}),td:({children:n,node:r,...s})=>o.jsx("td",{className:"v10-md-td",...s,children:n}),pre:({children:n,node:r})=>{var l,c,d;const s=(l=r==null?void 0:r.children)==null?void 0:l[0];if((s==null?void 0:s.tagName)==="code"){const f=((d=(c=s.properties)==null?void 0:c.className)==null?void 0:d[0])??"",h=/language-([\w-]+)/.exec(f),g=(s.children??[]).map(m=>(m==null?void 0:m.value)??"").join("").replace(/\n$/,"");return o.jsx(pH,{code:g,lang:h==null?void 0:h[1]})}return o.jsx("pre",{children:n})},code:({children:n})=>o.jsx("code",{className:"v10-md-code",children:n})},children:e})})}const mH=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"})]}),gH=Ve.lazy(()=>gt(()=>import("./Operations-Dg1gfLXv.js"),__vite__mapDeps([6,1])).then(e=>({default:e.OperationsPage}))),vH=Ve.lazy(()=>gt(()=>import("./AgentHub-BVrcom9_.js"),[]).then(e=>({default:e.AgentHubPage}))),yH=Ve.lazy(()=>gt(()=>import("./Settings-CxI0SKeV.js"),[]).then(e=>({default:e.SettingsPage}))),bH=Ve.lazy(()=>gt(()=>import("./AgentProfilePage-C9XaTt7j.js"),[]).then(e=>({default:e.AgentProfilePage}))),xH=Ve.lazy(()=>gt(()=>import("./PublishingConviction-Byp6t69e.js"),__vite__mapDeps([7,8])).then(e=>({default:e.PublishingConvictionPage}))),wH=Ve.lazy(()=>gt(()=>import("./ConvictionDetailView-cao48GL1.js"),__vite__mapDeps([9,8])).then(e=>({default:e.ConvictionDetailView})));function kH(){const{tabs:e,activeTabId:t,setActiveTab:n,closeTab:r}=hn();return o.jsx("div",{className:"v10-center-tabs",children:e.map(s=>o.jsxs("button",{className:`v10-center-tab ${s.id===t?"active":""}`,onClick:()=>n(s.id),children:[o.jsx("span",{className:"v10-center-tab-label",children:s.label}),s.closable&&o.jsx("span",{className:"v10-center-tab-close",onClick:l=>{l.stopPropagation(),r(s.id)},children:mH})]},s.id))})}const SH=["text/","application/json","application/xml","application/javascript","application/x-yaml"];function jH(e){return SH.some(t=>e.startsWith(t))}function CH({docRef:e,contentType:t}){const{tabs:n,activeTabId:r,closeTab:s}=hn(),l=hn(_=>_.setActiveTab),[c,d]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState(""),[v,b]=w.useState(!0),[k,j]=w.useState(null),[C,S]=w.useState("formatted"),N=e.startsWith("urn:dkg:file:"),E=n.find(_=>_.id===r),T=(E==null?void 0:E.label)??"Document",$=()=>{const _=n.find(I=>I.id.startsWith("project:"));_&&l(_.id),s(r)};w.useEffect(()=>{let _=!1;if(b(!0),j(null),d(null),h(null),m(""),!N){b(!1);return}const I=e.replace("urn:dkg:file:",""),F=new AbortController;return fetch(Yu(I,t||void 0),{headers:Ht(),signal:F.signal}).then(async K=>{if(!K.ok)throw new Error(`HTTP ${K.status}`);const z=K.headers.get("content-type")??"application/octet-stream";if(!_)if(m(z),jH(z)){const q=await K.text();_||(d(q),b(!1))}else if(z.startsWith("image/")){const q=await K.blob();_||(h(URL.createObjectURL(q)),b(!1))}else if(z==="application/pdf"){const q=await K.blob();_||(h(URL.createObjectURL(q)),b(!1))}else{const q=await K.text();_||(d(q),b(!1))}}).catch(K=>{_||(j(K.message),b(!1))}),()=>{_=!0,F.abort()}},[e,N,t]),w.useEffect(()=>{S("formatted")},[e]),w.useEffect(()=>{const _=f;return()=>{_&&URL.revokeObjectURL(_)}},[f]);const R=g.startsWith("image/"),L=g==="application/pdf",B=g.startsWith("text/markdown")||t.startsWith("text/markdown"),O=!v&&!k&&N&&B&&c!==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:$,style:{border:"1px solid var(--border-default)",borderRadius:5,background:"none",color:"var(--text-secondary)",fontSize:11,fontWeight:600,padding:"4px 10px",cursor:"pointer",fontFamily:"var(--font-sans)"},children:"← Back to Project"}),o.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:["📄 ",T]}),O&&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 I=C===_;return o.jsx("button",{type:"button","aria-pressed":I,onClick:()=>S(_),style:{border:"none",borderRadius:4,cursor:"pointer",padding:"3px 12px",fontSize:11,fontWeight:600,fontFamily:"var(--font-sans)",color:I?"var(--text-primary)":"var(--text-secondary)",background:I?"var(--bg-elevated)":"transparent"},children:_==="formatted"?"Formatted":"Raw"},_)})})]}),o.jsx("div",{style:{flex:1,overflow:"auto",padding:"20px 24px"},children:N?o.jsxs(o.Fragment,{children:[v&&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]}),!v&&R&&f&&o.jsx("img",{src:f,alt:T,style:{maxWidth:"100%",borderRadius:8}}),!v&&L&&f&&o.jsx("iframe",{src:f,title:T,style:{width:"100%",height:"100%",border:"none",borderRadius:8}}),c!==null&&!R&&!L&&B&&C==="formatted"&&o.jsx("div",{style:{background:"var(--bg-surface)",borderRadius:8,padding:"16px 20px",border:"1px solid var(--border-default)",color:"var(--text-primary)"},children:o.jsx(WN,{content:c})}),c!==null&&!R&&!L&&!(B&&C==="formatted")&&o.jsx("pre",{style:{fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.7,color:"var(--text-primary)",whiteSpace:"pre-wrap",wordBreak:"break-word",background:"var(--bg-surface)",borderRadius:8,padding:16,border:"1px solid var(--border-default)",margin:0},children:c})]}):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 NH(){const e=hn(t=>t.activeTabId);if(e==="dashboard")return o.jsx(AL,{});if(e==="operations")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading operations..."}),children:o.jsx(gH,{})});if(e==="agent-hub")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading agent hub..."}),children:o.jsx(vH,{})});if(e==="settings")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading settings..."}),children:o.jsx(yH,{})});if(e==="conviction")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading Publisher Conviction..."}),children:o.jsx(xH,{})});if(e==="memory-stack")return o.jsx(MP,{});if(e===cv)return o.jsx(yP,{});if(e.startsWith("project:")){const t=e.slice(8);return o.jsx(gP,{contextGraphId:t})}if(e.startsWith("conviction:")){const t=e.slice(11);return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading account..."}),children:o.jsx(wH,{accountId:t})})}if(e.startsWith("agent:")){const t=e.slice(6),n=t.indexOf("|");if(n>0){const r=t.slice(0,n),s=t.slice(n+1),l=s.includes(":")?s:`urn:dkg:agent:${s}`;return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading agent…"}),children:o.jsx(bH,{contextGraphId:r,agentUri:l})})}}if(e.startsWith(pv)){const{docRef:t,contentType:n}=oI(e);return o.jsx(CH,{docRef:t,contentType:n})}return e.startsWith("wm:")?o.jsx(tm,{layer:"wm",contextGraphId:e.slice(3)}):e.startsWith("swm:")?o.jsx(tm,{layer:"swm",contextGraphId:e.slice(4)}):e.startsWith("vm:")?o.jsx(tm,{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 EH(){return o.jsxs("div",{className:"v10-panel-center",children:[o.jsx(kH,{}),o.jsx("div",{className:"v10-center-content",children:o.jsx(NH,{})})]})}const AH=["Node Log","Transactions"],TH=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"})}),RH=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"})]}),_H=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"})]}),OH=/(\x1B\[[0-9;]*[mGKHFJA-Z]|\[[0-9;]*m)/g;function MH(e){return e.replace(OH,"")}function Dk(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 LH={error:"var(--accent-red, #ef4444)",warn:"var(--accent-yellow, #f59e0b)",info:"var(--text-primary)",debug:"var(--text-tertiary)"};function DH(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 IH(){const[e,t]=w.useState([]),[n,r]=w.useState(""),[s,l]=w.useState("all"),c=w.useCallback(()=>{_n.fetchNodeLog({lines:300,q:n||void 0}).then(({lines:g})=>t((g??[]).map(MH))).catch(()=>{})},[n]);w.useEffect(()=>{c();const g=setInterval(c,3e3);return()=>clearInterval(g)},[c]);const d=e.filter(g=>s==="all"||Dk(g)===s),f=d.length>0?d[d.length-1]:"",h=DH(f);return o.jsxs("div",{className:"v10-log-container",children:[o.jsxs("div",{className:"v10-log-toolbar",children:[o.jsx("input",{id:"dkg-node-log-filter",name:"dkg-node-log-filter",type:"text",placeholder:"Filter logs...",className:"v10-log-filter",value:n,onChange:g=>r(g.target.value),"aria-label":"Filter node log lines"}),o.jsxs("select",{id:"dkg-node-log-level",name:"dkg-node-log-level",className:"v10-log-level-select",value:s,onChange:g=>l(g.target.value),"aria-label":"Filter node log level",children:[o.jsx("option",{value:"all",children:"All"}),o.jsx("option",{value:"error",children:"Error"}),o.jsx("option",{value:"warn",children:"Warn"}),o.jsx("option",{value:"info",children:"Info"}),o.jsx("option",{value:"debug",children:"Debug"})]})]}),o.jsxs("div",{className:"v10-log-output",ref:h,children:[d.map((g,m)=>o.jsx("div",{className:"v10-log-line",style:{color:LH[Dk(g)]},children:g},m)),d.length===0&&o.jsx("div",{className:"v10-log-line",style:{color:"var(--text-tertiary)"},children:"No log output"})]})]})}const zH=new Set(["publish","publishFromSWM","update","ka-update","verify","reconstruct"]),$H={publish:"#22c55e",publishFromSWM:"#16a34a",update:"#14b8a6","ka-update":"#0d9488",verify:"#8b5cf6",reconstruct:"#fb923c"};function PH(){const[e,t]=w.useState([]),[n,r]=w.useState(null),s=w.useCallback(()=>{const l=String(Date.now()-216e5),c=[...zH].join(",");_n.fetchOperationsWithPhases({limit:"100",from:l,names:c}).then(d=>{t((d==null?void 0:d.operations)??[])}).catch(()=>{})},[]);return w.useEffect(()=>{s();const l=setInterval(s,1e4);return()=>clearInterval(l)},[s]),e.length===0?o.jsx("div",{style:{padding:"20px 16px",color:"var(--text-tertiary)",fontSize:12},children:"No publish, update, or verify activity in the last 6 hours."}):o.jsx("div",{className:"v10-log-output",style:{overflowY:"auto",flex:1},children:o.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:11},children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)",color:"var(--text-secondary)",textAlign:"left"},children:[o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Type"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"ID"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Status"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Duration"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Time"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Tx Hash"})]})}),o.jsx("tbody",{children:e.map(l=>{const c=(l.phases??[]).find(h=>h.phase==="chain"),d=l.tx_hash??(c==null?void 0:c.tx_hash),f=n===l.operation_id;return o.jsxs(Ve.Fragment,{children:[o.jsxs("tr",{onClick:()=>r(h=>h===l.operation_id?null:l.operation_id),style:{borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",background:f?"rgba(255,255,255,.03)":void 0},children:[o.jsx("td",{style:{padding:"7px 12px",color:$H[l.operation_name]??"var(--text-secondary)",fontWeight:600},children:l.operation_name}),o.jsx("td",{style:{padding:"7px 12px",fontFamily:"var(--font-mono)",color:"var(--text-secondary)"},children:T1(l.operation_id)}),o.jsx("td",{style:{padding:"7px 12px"},children:o.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,fontWeight:600,background:l.status==="success"?"rgba(34,197,94,.15)":l.status==="error"?"rgba(239,68,68,.15)":"rgba(245,158,11,.15)",color:l.status==="success"?"#22c55e":l.status==="error"?"#ef4444":"#f59e0b"},children:l.status})}),o.jsx("td",{style:{padding:"7px 12px",color:"var(--text-secondary)"},children:l.duration_ms!=null?A1(l.duration_ms):"—"}),o.jsx("td",{style:{padding:"7px 12px",color:"var(--text-secondary)"},children:l.started_at?D4(l.started_at):"—"}),o.jsx("td",{style:{padding:"7px 12px",fontFamily:"var(--font-mono)",color:"var(--text-tertiary)",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d?`${d.slice(0,10)}…`:l.status==="success"?o.jsx("span",{style:{fontFamily:"var(--font-sans)",fontStyle:"italic",color:"var(--text-tertiary)"},children:"local"}):"—"})]}),f&&o.jsx("tr",{style:{background:"rgba(0,0,0,.2)"},children:o.jsxs("td",{colSpan:6,style:{padding:"8px 16px"},children:[o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:16,fontSize:11,color:"var(--text-secondary)"},children:[o.jsxs("span",{children:[o.jsx("b",{children:"ID:"})," ",o.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:l.operation_id})]}),d&&o.jsxs("span",{children:[o.jsx("b",{children:"Tx:"})," ",o.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:d})]}),l.peer_id&&o.jsxs("span",{children:[o.jsx("b",{children:"Peer:"})," ",o.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:T1(l.peer_id)})]}),l.error_message&&o.jsxs("span",{style:{color:"#ef4444"},children:[o.jsx("b",{children:"Error:"})," ",l.error_message]})]}),(l.phases??[]).length>0&&o.jsx("div",{style:{marginTop:8,display:"flex",gap:6,flexWrap:"wrap"},children:l.phases.map(h=>o.jsxs("span",{style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:600,background:"rgba(255,255,255,.06)",color:"var(--text-secondary)"},children:[h.phase," ",h.duration_ms!=null?A1(h.duration_ms):""]},h.phase))})]})})]},l.operation_id)})})]})})}function UH(){const{bottomCollapsed:e,toggleBottom:t,bottomMaximised:n,toggleBottomMaximised:r,bottomHeight:s,setBottomHeight:l}=Kn(),[c,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 v=0;const b=C=>{const S=v-C.clientY;v=C.clientY,l(h.current+S)},k=()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",k),document.body.style.cursor="",document.body.style.userSelect="",m.classList.remove("active")},j=C=>{C.preventDefault(),v=C.clientY,document.addEventListener("mousemove",b),document.addEventListener("mouseup",k),document.body.style.cursor="row-resize",document.body.style.userSelect="none",m.classList.add("active")};return m.addEventListener("mousedown",j),()=>m.removeEventListener("mousedown",j)},[l]);const g=e?void 0:n?"80vh":Math.min(s,ud());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:[AH.map(m=>o.jsx("button",{className:`v10-bottom-tab ${m===c?"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?_H:RH}),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:TH})})]}),!e&&o.jsxs("div",{className:"v10-bottom-content",children:[c==="Node Log"&&o.jsx(IH,{}),c==="Transactions"&&o.jsx(PH,{})]})]})}function Ik(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 _d(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 fg(e){if(e==null||e==="")return;const t=e instanceof Date?e:new Date(e);if(!Number.isNaN(t.valueOf()))return t.toISOString()}function BH(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function FH(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 hg(e,t){var n;return((n=e.find(r=>r.id===t))==null?void 0:n.name)??t}function HH(e){return e.startsWith("did:dkg:context-graph:")?e:`did:dkg:context-graph:${e}`}function qH(e){return String(e??"").replace(/[\u0000-\u001F\u007F]/g," ").replace(/\s+/g," ").trim()}function ZN(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 KN(e){return e.status==="queued"||e.status==="completed"||e.status==="skipped"}function YN(e){return e.name.trim()}function GH(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:YN(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 VH(e){const t=[];return{results:e.flatMap(r=>{if(r.status!=="skipped"||!r.result)return[];t.push(r.id);const s=r.result,l=s.extraction;return[{id:r.id,fileName:YN(r.file),contextGraphId:r.contextGraphId,assertionName:r.assertionName,assertionUri:s.assertionUri,fileHash:s.fileHash,detectedContentType:s.detectedContentType,extractionStatus:"skipped",pipelineUsed:l.pipelineUsed??null,tripleCount:l.tripleCount??l.triplesWritten??0,...s.rootEntity?{rootEntity:s.rootEntity}:{},...l.mdIntermediateHash?{mdIntermediateHash:l.mdIntermediateHash}:{},...l.error?{error:l.error}:{}}]}),deliveredDraftIds:t}}function QN(e){return e.length===0?"":e.length===1?`Attachment import result: ${qH(e[0].fileName)}.`:`Attached ${e.length} document import results.`}function WH(e,t){const n=[ZN(e),QN(t)].filter(r=>r.length>0).map(r=>r.replace(/\.$/,""));return n.length?`${n.join("; ")}.`:""}function ZH(e,t,n){const r=[];if(t){const s=hg(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:HH(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 KH="https://docs.openclaw.ai/",YH="https://github.com/openclaw/openclaw/releases",es="__add_agent__",QH=["openclaw"];function XH(e,t){const n=t instanceof Error?t.message:String(t??"Unknown error");if(t instanceof pd){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==="PRIME_AGENT_SESSION_BUSY")return`${e.name} session is busy — try again in a moment.`;if(t.code==="PRIME_AGENT_NO_SESSION")return`No live ${e.name} session is available. Start or resume a session, then send again.`;if(t.code==="PRIME_AGENT_PROVIDER_UNAUTHORIZED")return`${e.name} provider authentication failed. Check its provider credentials and try again.`;if(t.code==="PRIME_AGENT_PROVIDER_ERROR")return`${e.name} provider request failed. Check its provider configuration and try again.`;if(t.code==="PRIME_AGENT_TURN_ABORTED")return`${e.name} turn was aborted.`;if(t.code==="PRIME_AGENT_TURN_TIMEOUT")return`${e.name} turn exceeded its maximum run time.`;if(t.code==="PRIME_AGENT_DELIVERY_FAILED")return`${e.name} rejected the message before starting the turn.`;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}function xm(e,t,n){return e+(t-e)*n}function XN(e){return e-Math.floor(e)}function wm(e,t){const n=Math.floor(e),r=Math.floor(t);let s=e-n,l=t-r;s=s*s*(3-2*s),l=l*l*(3-2*l);const c=Ra(n,r),d=Ra(n+1,r),f=Ra(n,r+1),h=Ra(n+1,r+1);return c+(d-c)*s+(f-c)*l+(c-d-f+h)*s*l}function Ra(e,t){const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)}function qv(e,t){const n=Math.PI*(3-Math.sqrt(5)),r=1-2*(e+.5)/t,s=Math.sqrt(1-r*r),l=e*n;return[s*Math.cos(l),r,s*Math.sin(l)]}function JH(e,t){return Math.atan2(Math.sin(e-t),Math.cos(e-t))}function hs(e,t,n,r,s){const l=Math.sin(t),c=Math.cos(t),d=Math.sin(e),f=Math.cos(e);return(h,g,m)=>{const v=h*f+m*d,b=-h*d+m*f,k=g*c-b*l,j=g*l+b*c;return[n+v*s,r-k*s,j]}}function Ni(e,t,n,r=.3){t.sort((s,l)=>s.z-l.z);for(const s of t){const l=s.a??1;if(l<.02)continue;const c=Math.min(1,Math.max(0,s.white)),d=Math.round((n?1-c:c)*255);e.fillStyle=`rgba(${d},${d},${d},${l})`,e.beginPath(),e.arc(s.x,s.y,Math.max(r,s.r),0,Math.PI*2),e.fill()}}function eq(e,t,n){for(const r of t){const s=r.a??1;if(s<.02)continue;const l=Math.min(1,Math.max(0,r.white)),c=Math.round((n?1-l:l)*255);e.strokeStyle=`rgba(${c},${c},${c},${s})`,e.lineWidth=r.w,e.beginPath(),e.moveTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.stroke()}}function ms(e,t){return(e/300)**t}const tq=(e,t,n,r,s)=>{const l=t/2,c=t/2,d=t/2*.76,f=hs(n*.4,.3,l,c,1),h=ms(t,s.rsPow??.6),g=[],m=s.ghostN??150;for(let k=0;k<m;k++){const j=qv(k,m),[C,S,N]=f(j[0]*d,j[1]*d,j[2]*d),E=(N/d+1)/2;g.push({x:C,y:S,z:N,r:.8*h,white:.78,a:.1+.22*E})}const v=s.strandN??52,b=s.turns??3;for(let k=0;k<3;k++){const j=k/3*2*Math.PI;for(let C=0;C<v;C++){const S=(XN(C/v+n*.045)*2-1)*.96,N=Math.sqrt(Math.max(0,1-S*S)),E=Math.min(1,(1-Math.abs(S))/.1),T=S*Math.PI*b+j,$=1+.075*Math.sin(S*Math.PI*b*2+j*2+n*.8),R=N*d*$,[L,B,O]=f(Math.cos(T)*R,S*d*$,Math.sin(T)*R),_=(O/d+1)/2;g.push({x:L,y:B,z:O,r:((s.rBase??1.2)+(s.rDepth??1.8)*_)*h,white:.55-.45*_,a:E*(.45+.55*_)})}}Ni(e,g,r,s.rMin)};function nq(e,t,n,r){const s=2*t*n+r,l=e%s,c=new Array(t).fill(0);let d=-1;if(l<2*t*n){const f=Math.floor(l/n),h=(l-f*n)/n,g=1-(1-Math.min(1,h/.7))**3;if(f<t){for(let m=0;m<f;m++)c[m]=1;c[f]=g,d=f}else{const m=2*t-1-f;for(let v=0;v<m;v++)c[v]=1;c[m]=1-g,d=m}}return{amount:c,active:d}}function aq(e,t,n){let[r,s,l]=e,c=!1;for(let d=0;d<t.length;d++){if(n.amount[d]<=0)continue;const f=t[d],h=f.axis===0?r:f.axis===1?s:l;if(h<f.lo||h>=f.hi)continue;d===n.active&&(c=!0);const g=f.ang*n.amount[d],m=Math.cos(g),v=Math.sin(g);if(f.axis===0){const b=s*m-l*v;l=s*v+l*m,s=b}else if(f.axis===1){const b=r*m+l*v;l=-r*v+l*m,r=b}else{const b=r*m-s*v;s=r*v+s*m,r=b}}return[r,s,l,c]}function rq(e){const t=[];for(let n=0;n<e;n++){const r=Math.min(2,Math.floor(Ra(n,2.3)*3)),s=-1+.5*Math.min(3,Math.floor(Ra(n,5.9)*4)),l=Ra(n,7.7)<.5?1:-1;t.push({axis:r,lo:s,hi:s+.5,ang:l*Math.PI/2})}return t}const iq=(e,t,n,r,s)=>{const l=t/2,c=t/2,d=t/2*.82,f=.4+.06*Math.sin(n*.35),h=hs(n*.5,f,l,c,d),g=n*(.5+(1.7-.5)*(s.scanMul??1)),m=ms(t,s.rsPow??.6),v=s.dimBase??1,b=[],k=s.latRings??17,j=s.lonDensity??44;for(let C=0;C<=k;C++){const S=-Math.PI/2+C/k*Math.PI,N=Math.cos(S),E=Math.sin(S),T=Math.max(1,Math.round(Math.abs(N)*j));for(let $=0;$<T;$++){const R=$/T*2*Math.PI,[L,B,O]=h(N*Math.cos(R),E,N*Math.sin(R)),_=(O+1)/2,I=JH(R+n*.5,g),F=Math.exp(-(I*I)/.18)*Math.max(0,O);b.push({x:L,y:B,z:O,r:((s.rBase??.6)+(s.rDepth??1.7)*_+(s.rBoost??1)*F)*m,white:(s.inkFar??.62)-(s.inkSpan??.54)*_,a:v+(1-v)*Math.min(1,F)})}}Ni(e,b,r,s.rMin)},sq=(e,t,n,r,s)=>{const l=t/2,c=t/2,d=t/2*.82,f=hs(n*.55,.35+.1*Math.sin(n*.9),l,c,d),h=ms(t,s.rsPow??.6),g=s.moveCount??14,m=rq(g),v=nq(n,g,.42,1.2),b=[],k=s.latRings??15,j=s.lonDensity??40;for(let C=0;C<=k;C++){const S=-Math.PI/2+C/k*Math.PI,N=Math.cos(S),E=Math.sin(S),T=Math.max(1,Math.round(Math.abs(N)*j));for(let $=0;$<T;$++){const R=$/T*2*Math.PI,[L,B,O,_]=aq([N*Math.cos(R),E,N*Math.sin(R)],m,v),[I,F,K]=f(L,B,O),z=(K+1)/2;b.push({x:I,y:F,z:K,r:((s.rBase??.6)+(s.rDepth??1.7)*z+(_?s.rActive??.3:0))*h,white:(s.inkFar??.62)-(s.inkSpan??.54)*z-(_?.14:0)})}}Ni(e,b,r,s.rMin)},oq=(e,t,n,r,s)=>{const l=t/2,c=t/2,d=t/2*.874,f=hs(n*.18,.38,l,c,1),h=ms(t,s.rsPow??.6),g=[],m=s.rings??15,v=s.lonDensity??40;for(let b=0;b<=m;b++){const k=-Math.PI/2+b/m*Math.PI,j=Math.cos(k),C=Math.sin(k),S=.62*Math.sin(n*2.1-b*.52)+.38*Math.sin(n*1.27+b*.83),N=d*(.88+.105*S),E=Math.max(1,Math.round(Math.abs(j)*v));for(let T=0;T<E;T++){const $=T/E*2*Math.PI,[R,L,B]=f(j*Math.cos($)*N,C*N,j*Math.sin($)*N),O=(B/d+1)/2,_=Math.max(0,S);g.push({x:R,y:L,z:B,r:((s.rBase??.6)+(s.rDepth??1.7)*O)*(1+.4*_)*h,white:.66-.56*O-.1*_})}}Ni(e,g,r,s.rMin)};function lq(e){return e*e*(3-2*e)}function JN(e){const t=e.length,n=[];let r=0;for(let s=0;s<t;s++){const l=e[s],c=e[(s+1)%t],d=Math.hypot(c[0]-l[0],c[1]-l[1]);n.push(d),r+=d}return s=>{let l=s*r,c=0;for(;l>n[c]&&c<t-1;)l-=n[c],c++;const d=e[c],f=e[(c+1)%t],h=n[c]?Math.min(1,l/n[c]):0;return[d[0]+(f[0]-d[0])*h,d[1]+(f[1]-d[1])*h]}}const cq=e=>{const t=-Math.PI/2+e*2*Math.PI;return[Math.cos(t)*.24,Math.sin(t)*.24]},uq=JN([[0,-.26],[.24,.16],[-.24,.16]]),dq=JN([[0,-.2],[.2,-.2],[.2,.2],[-.2,.2],[-.2,-.2]]),km=[cq,uq,dq];function pq(e){return Math.max(6,Math.round(34*e))}const mg=1.4,eE=.9,Sm=mg+eE,fq=(e,t,n,r,s)=>{const l=km.length,c=n%(Sm*l),d=Math.floor(c/Sm),f=c-d*Sm,h=f>mg?lq((f-mg)/eE):0,g=s.spread??1,m=km[d],v=km[(d+1)%l],b=160,k=[];for(let B=0;B<b;B++){const O=B/b,_=m(O),I=v(O);k.push([(_[0]+(I[0]-_[0])*h)*g,(_[1]+(I[1]-_[1])*h)*g])}const j=[];let C=0;for(let B=0;B<b;B++){const O=k[B],_=k[(B+1)%b],I=Math.hypot(_[0]-O[0],_[1]-O[1]);j.push(I),C+=I}const S=pq(s.iconD??1),N=(s.rDot??.021)*1.35*g,E=1+.02*Math.sin(f*3.1),T=[],$=t/2;let R=0,L=0;for(let B=0;B<S;B++){const O=B/S*C;for(;L+j[R]<O&&R<b-1;)L+=j[R],R++;const _=k[R],I=k[(R+1)%b],F=j[R]?Math.min(1,(O-L)/j[R]):0,K=(_[0]+(I[0]-_[0])*F)*E,z=(_[1]+(I[1]-_[1])*F)*E;T.push({x:$+K*t,y:$+z*t,z:0,r:Math.max(.35,N*t),white:.1})}Ni(e,T,r,s.rMin)},hq=(e,t,n,r,s)=>{const l=t/2,c=t/2,d=t/2*.82,f=hs(n*.12,.3,l,c,1),h=ms(t,s.rsPow??.6),g=[],m=s.orbitN??12,v=s.ghostN??40,b=s.particles??3;for(let k=0;k<m;k++){const j=Ra(k,1.7),C=Ra(k,5.2),S=Ra(k,8.9),N=d*(.45+.52*j),E=j*2*Math.PI,T=Math.acos(2*C-1),$=Math.sin(T)*Math.cos(E),R=Math.cos(T),L=Math.sin(T)*Math.sin(E);let B=-R,O=$;const _=0,I=Math.max(1e-6,Math.sqrt(B*B+O*O));B/=I,O/=I;const F=R*_-L*O,K=L*B-$*_,z=$*O-R*B,q=(.25+.55*S)*(S>.5?1:-1);for(let V=0;V<v;V++){const Z=V/v*2*Math.PI,[Y,W,D]=f((B*Math.cos(Z)+F*Math.sin(Z))*N,(O*Math.cos(Z)+K*Math.sin(Z))*N,(_*Math.cos(Z)+z*Math.sin(Z))*N),U=(D/N+1)/2;g.push({x:Y,y:W,z:D,r:(s.ghostR??.9)*h,white:.72,a:(s.ghostA??.5)*(.4+.6*U)})}for(let V=0;V<b;V++){const Z=n*q+V/b*2*Math.PI+C*6,[Y,W,D]=f((B*Math.cos(Z)+F*Math.sin(Z))*N,(O*Math.cos(Z)+K*Math.sin(Z))*N,(_*Math.cos(Z)+z*Math.sin(Z))*N),U=(D/N+1)/2;g.push({x:Y,y:W,z:D,r:((s.partR??1.2)+(s.partRDepth??1.6)*U)*h,white:.3-.22*U})}}Ni(e,g,r,s.rMin)},zk=(e,t,n,r,s)=>{const l=t/2,c=t/2,d=t/2*.78,f=s.spin??1,h=.3,g=hs(n*.1*f,h,l,c,1),m=ms(t,s.rsPow??.6),v=[],b=s.ghostN??150;for(let z=0;z<b;z++){const q=qv(z,b),[V,Z,Y]=g(q[0]*d,q[1]*d,q[2]*d),W=(Y/d+1)/2;v.push({x:V,y:Z,z:Y,r:.8*m,white:.78,a:.1+.22*W})}const k=n*.24*f,j=s.faceOn?-h:.55+.3*Math.sin(n*.18)*f,C=Math.cos(k),S=0,N=Math.sin(k),E=-N*Math.sin(j),T=Math.cos(j),$=C*Math.sin(j),R=S*$-N*T,L=N*E-C*$,B=C*T-S*E,O=.23*(s.wobMul??1),_=s.faceOn?d/(1+.85*O):d,I=s.lanes??5,F=s.segs??88,K=Math.max(1,Math.round(I*(s.bandMul??1)));for(let z=0;z<K;z++){const q=(z-(K-1)/2)*.075,V=Math.abs(z-(K-1)/2)/Math.max(1,(K-1)/2);for(let Z=0;Z<F;Z++){const Y=Z/F*2*Math.PI,W=(.16*Math.sin(Y*3-n*1.7+z*.22)+.07*Math.sin(Y*5+n*1.1))*(s.wobMul??1),D=s.faceOn?1+W:1,U=s.faceOn?q:q+W,G=C*Math.cos(Y)+E*Math.sin(Y)+R*U,M=S*Math.cos(Y)+T*Math.sin(Y)+L*U,ee=N*Math.cos(Y)+$*Math.sin(Y)+B*U,ce=Math.sqrt(G*G+M*M+ee*ee),oe=_*D,[be,Re,Ne]=g(G/ce*oe,M/ce*oe,ee/ce*oe),De=(Ne/d+1)/2;v.push({x:be,y:Re,z:Ne,r:((s.rBase??1.1)+(s.rDepth??1.7)*De)*(1-.25*V)*m,white:.52-.44*De+.18*V,a:.4+.6*De})}}Ni(e,v,r,s.rMin)},mq=(e,t,n,r,s)=>{const l=t/2,c=t/2,d=t/2*.8*(s.spread??1),f=hs(n*.12,.32,l,c,d),h=ms(t,s.rsPow??.6),g=s.nodeN??30,m=s.thr??.72,v=s.nodeR??1.4,b=s.nodeRDepth??1.8,k=[];for(let N=0;N<g;N++){const E=qv(N,g),T=E[0]+.3*(wm(N*.31+9,n*.24)-.5)*2,$=E[1]+.3*(wm(N*.53+27,n*.21)-.5)*2,R=E[2]+.3*(wm(N*.77+55,n*.27)-.5)*2,L=Math.sqrt(T*T+$*$+R*R);k.push([T/L,$/L,R/L])}const j=[],C=[];for(let N=0;N<g;N++)for(let E=N+1;E<g;E++){const T=k[N][0]-k[E][0],$=k[N][1]-k[E][1],R=k[N][2]-k[E][2],L=Math.sqrt(T*T+$*$+R*R);if(L>=m)continue;const[B,O,_]=f(k[N][0],k[N][1],k[N][2]),[I,F,K]=f(k[E][0],k[E][1],k[E][2]),z=((_+K)/2+1)/2;j.push({x1:B,y1:O,x2:I,y2:F,white:.42,a:(1-L/m)*(.3+.55*z),w:Math.max(.6,(s.lineW??.8)*h)})}for(let N=0;N<g;N++){const[E,T,$]=f(k[N][0],k[N][1],k[N][2]),R=($+1)/2,L=1+.25*Math.sin(n*1.4+N*2.7);C.push({x:E,y:T,z:$,r:(v+b*R)*L*h,white:.55-.45*R})}const S=s.signals??5;for(let N=0;N<S;N++){const E=Math.floor(n*.55+N*7.31),T=Math.floor(Ra(E,N*3.1+1.7)*g),$=Math.floor(Ra(E,N*5.7+4.2)*g);if(T===$)continue;const R=XN(n*.55+N*7.31),L=xm(k[T][0],k[$][0],R),B=xm(k[T][1],k[$][1],R),O=xm(k[T][2],k[$][2],R),_=Math.max(1e-6,Math.sqrt(L*L+B*B+O*O)),[I,F,K]=f(L/_,B/_,O/_),z=(K+1)/2;C.push({x:I,y:F,z:K,r:(v*1.5+b*z)*h,white:.05,a:.5+.5*z})}eq(e,j,r),Ni(e,C,r,s.rMin)},gq={orbits:hq,globe:iq,rubik:sq,wave:oq,web:mq,braid:tq,ribbon:zk,ring:zk,morph:fq},vq=[["latRings","lonDensity"],["rings","lonDensity"],["lanes","segs"]],yq=["orbitN","ghostN","nodeN","strandN","signals"],bq=["iconD"],xq=["rBase","rDepth","rActive","rDot","ghostR","partR","partRDepth","nodeR","nodeRDepth"];function wq(e,t){const n={...e},r=new Set,s=Math.sqrt(t);for(const[l,c]of vq){const d=n[l],f=n[c];d!=null&&f!=null&&!r.has(l)&&!r.has(c)&&(n[l]=Math.max(2,Math.round(d*s)),n[c]=Math.max(2,Math.round(f*s)),r.add(l),r.add(c))}for(const l of yq){const c=n[l];c!=null&&c!==0&&!r.has(l)&&(n[l]=Math.max(1,Math.round(c*t)))}for(const l of bq){const c=n[l];c!=null&&(n[l]=Math.max(.02,c*t))}return n}function kq(e,t){const n={...e};for(const r of xq){const s=n[r];s!=null&&(n[r]=s*t)}return n.rSizeMul=(n.rSizeMul??1)*t,n}const Sq={globe:{latRings:17,lonDensity:44,rBase:.6,rDepth:1.7,rBoost:1,inkFar:.62,inkSpan:.54,rsPow:.6,rMin:.3},orbits:{orbitN:12,ghostN:40,ghostR:.9,ghostA:.5,particles:3,partR:1.2,partRDepth:1.6,rsPow:.6,rMin:.3},rubik:{latRings:15,lonDensity:40,moveCount:14,rBase:.6,rDepth:1.7,rActive:.3,inkFar:.62,inkSpan:.54,rsPow:.6,rMin:.3},wave:{rings:15,lonDensity:40,rBase:.6,rDepth:1.7,rsPow:.6,rMin:.3},web:{nodeN:30,thr:.72,signals:5,nodeR:1.4,nodeRDepth:1.8,lineW:.8,rsPow:.6,rMin:.3},braid:{strandN:52,turns:3,ghostN:150,rBase:1.2,rDepth:1.8,rsPow:.6,rMin:.3},ribbon:{lanes:5,segs:88,ghostN:150,rBase:1.1,rDepth:1.7,rsPow:.6,rMin:.3},ring:{lanes:5,segs:88,ghostN:0,faceOn:1,rBase:1.1,rDepth:1.7,rsPow:.6,rMin:.3},morph:{rDot:.021,iconD:1,rMin:.25}},jq={working:"orbits",searching:"globe",solving:"rubik",listening:"wave",connecting:"web",weaving:"braid",composing:"ribbon",breathing:"ring",shaping:"morph"},Cq={orbits:{64:{speed:1.885,count:1,size:1},20:{speed:3.9,count:.238,size:2.4}},globe:{64:{speed:2.015,count:.42,size:1.15,extra:{scanMul:4.08,dimBase:.45}},20:{speed:2.665,count:.105,size:1.75,extra:{scanMul:4.335,dimBase:.45}}},rubik:{64:{speed:1.82,count:.35,size:1.05},20:{speed:1.95,count:.088,size:1.9}},wave:{64:{speed:4.388,count:.341,size:1},20:{speed:3.998,count:.105,size:1.6}},web:{64:{speed:3.315,count:1.35,size:.95},20:{speed:6.63,count:.25,size:1.52}},braid:{64:{speed:1.625,count:.5,size:1},20:{speed:2.75,count:.1125,size:1.36}},ribbon:{64:{speed:2.34,count:.25,size:.85,extra:{spin:0,bandMul:3.9,wobMul:1}},20:{speed:3.12,count:.051,size:1.073,extra:{spin:0,bandMul:4.94,wobMul:1}}},ring:{64:{speed:3.24,count:.25,size:.956,extra:{spin:0,bandMul:3.627,wobMul:.368}},20:{speed:3.78,count:.028,size:1.622,extra:{spin:0,bandMul:3.968,wobMul:.565}}},morph:{64:{speed:2.405,count:.702,size:.395,extra:{spread:1.45}},20:{speed:2.08,count:.53,size:1.011,extra:{spread:1.45}}}},$k=new Map;function Nq(e,t){const n=`${e}-${t}`,r=$k.get(n);if(r)return r;const s=jq[e],l=Cq[s][t];let c={...Sq[s]};l.count!==1&&(c=wq(c,l.count)),l.size!==1&&(c=kq(c,l.size)),l.extra&&(c={...c,...l.extra});const d={mode:s,speed:l.speed,opts:c};return $k.set(n,d),d}function Eq(e){let t=e;for(;t;){const n=t.getAttribute("data-theme");if(n==="dark")return!0;if(n==="light")return!1;if(t.classList.contains("dark"))return!0;if(t.classList.contains("light"))return!1;t=t.parentElement}return null}function Aq(){return typeof matchMedia>"u"||matchMedia("(prefers-color-scheme: dark)").matches}function Tq(e,t){const[n,r]=w.useState(!0);return w.useEffect(()=>{if(e==="dark"){r(!0);return}if(e==="light"){r(!1);return}const s=()=>{const f=Eq(t.current);r(f??Aq())};s();const l=typeof matchMedia<"u"?matchMedia("(prefers-color-scheme: dark)"):null,c=()=>s();l==null||l.addEventListener("change",c);let d=null;return typeof MutationObserver<"u"&&t.current&&(d=new MutationObserver(s),d.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"],subtree:!0})),()=>{l==null||l.removeEventListener("change",c),d==null||d.disconnect()}},[e,t]),n}function Rq(){const[e,t]=w.useState(!1);return w.useEffect(()=>{if(typeof matchMedia>"u")return;const n=matchMedia("(prefers-reduced-motion: reduce)");t(n.matches);const r=s=>t(s.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const _q={working:"Working…",searching:"Searching…",solving:"Solving…",listening:"Listening…",connecting:"Connecting…",weaving:"Weaving…",composing:"Composing…",breathing:"Thinking…",shaping:"Shaping…"};function Oq({state:e="working",size:t=64,theme:n="auto",speed:r=1,paused:s=!1,style:l,"aria-label":c,...d}){const f=w.useRef(null),h=Tq(n,f),g=Rq();return w.useEffect(()=>{const m=f.current;if(!m)return;const v=Math.min(2,typeof devicePixelRatio<"u"&&devicePixelRatio||1);m.width=Math.round(t*v),m.height=Math.round(t*v);const b=m.getContext("2d");if(!b)return;const{mode:k,speed:j,opts:C}=Nq(e,t),S=gq[k],N=j*r,E=F=>{b.setTransform(v,0,0,v,0,0),b.clearRect(0,0,t,t),S(b,t,F,h,C)};if(g){E(.6);return}let T=0,$=!1;const R=()=>{E(performance.now()/1e3*N),$&&(T=requestAnimationFrame(R))},L=()=>{$||s||($=!0,T=requestAnimationFrame(R))},B=()=>{$=!1,cancelAnimationFrame(T)};E(performance.now()/1e3*N);let O=!0;const _=typeof IntersectionObserver<"u"?new IntersectionObserver(([F])=>{O=F.isIntersecting,O&&document.visibilityState!=="hidden"?L():B()}):null;_==null||_.observe(m);const I=()=>{document.visibilityState==="hidden"?B():O&&L()};return document.addEventListener("visibilitychange",I),_||L(),()=>{B(),_==null||_.disconnect(),document.removeEventListener("visibilitychange",I)}},[e,t,h,r,s,g]),o.jsx("canvas",{ref:f,role:"img","aria-label":c??_q[e],style:{width:t,height:t,display:"block",...l},...d})}let Mq=0;function Lq(e,t,n){const r=e.trim();return r?r===t?!0:n==="Request cancelled."&&r===n:!1}function Dq(e,t,n,r){return e&&Lq(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 Iq(e,t){return e?{content:e,failureNotice:t,synthesized:!1}:{content:t,synthesized:!0}}function Pk(e,t=""){const n=e.author.toLowerCase(),r=n.includes("assistant")||n.includes("agent")?"assistant":"user",s=typeof e.failureReason=="string"&&e.failureReason.trim()?e.failureReason.trim():void 0,l=r==="assistant"&&(e.persistStatus==="failed"||!!s),c=`Error: ${s??"The local agent turn failed."}`,d=l?Dq(e.text,c,s,t):null,f=(d==null?void 0:d.content)??(e.text||ZN(e.attachmentRefs??[])),h=!!e.text;return{id:e.uri||`local-history:${++Mq}`,uri:e.uri,turnId:e.turnId,role:r,content:f,ts:_d(e.ts),tsRaw:fg(e.ts),attachments:e.attachmentRefs,failureNotice:d==null?void 0:d.failureNotice,synthesized:(d==null?void 0:d.synthesized)??!h}}function zq(e){return e.turnId?`turn:${e.turnId}:${e.role}`:e.uri??`${e.role}:${e.ts??""}:${e.content}`}function jm(e,t){const n=new Set,r=[];for(const s of[...t,...e]){const l=zq(s);n.has(l)||(n.add(l),r.push(s))}return r}function Uk(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 Bk(e){return e.replace(/\r\n/g,`
|
|
1653
|
+
`).replace(/^(?:[ \t]*\n)+/,"").replace(/(?:\n[ \t]*)+$/,"")}function $q(e,t,n,r,s){const l=Bk(e),c=s?Bk(s):"";if(t==="assistant"&&r&&l.trim()===""&&!c)return o.jsxs("span",{className:"v10-chat-thinking",role:"status","aria-live":"polite",children:[o.jsx(Oq,{"aria-hidden":"true",className:"v10-chat-thinking-orb",state:"connecting",size:64,style:{width:28,height:28},theme:"auto"}),o.jsx("span",{children:"Connecting dots..."})]});if(t==="assistant"&&!n&&l.trim()!=="")return o.jsxs(o.Fragment,{children:[o.jsx(WN,{content:l,streaming:r&&!c}),c&&o.jsxs("span",{className:"v10-chat-plaintext v10-chat-failure-notice",children:[c,r&&o.jsx("span",{className:"v10-chat-cursor"})]})]});const d=[l,c].filter(Boolean).join(`
|
|
1654
|
+
|
|
1655
|
+
`);return o.jsxs("span",{className:"v10-chat-plaintext",children:[d,r&&o.jsx("span",{className:"v10-chat-cursor"})]})}function gg(){return gg=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},gg.apply(null,arguments)}function Pq(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 Uq=w.useLayoutEffect,Bq=function(t){var n=Ve.useRef(t);return Uq(function(){n.current=t}),n},Fk=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},Fq=function(t,n){var r=Ve.useRef();return Ve.useCallback(function(s){t.current=s,r.current&&Fk(r.current,null),r.current=n,n&&Fk(n,s)},[n])},Hk={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},Hq=function(t){Object.keys(Hk).forEach(function(n){t.style.setProperty(n,Hk[n],"important")})},qk=Hq,Ln=null,Gk=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function qq(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),Ln||(Ln=document.createElement("textarea"),Ln.setAttribute("tabindex","-1"),Ln.setAttribute("aria-hidden","true"),qk(Ln)),Ln.parentNode===null&&document.body.appendChild(Ln);var s=e.paddingSize,l=e.borderSize,c=e.sizingStyle,d=c.boxSizing;Object.keys(c).forEach(function(v){var b=v;Ln.style[b]=c[b]}),qk(Ln),Ln.value=t;var f=Gk(Ln,e);Ln.value=t,f=Gk(Ln,e),Ln.value="x";var h=Ln.scrollHeight-s,g=h*n;d==="border-box"&&(g=g+s+l),f=Math.max(g,f);var m=h*r;return d==="border-box"&&(m=m+s+l),f=Math.min(m,f),[f,h]}var Vk=function(){},Gq=function(t,n){return t.reduce(function(r,s){return r[s]=n[s],r},{})},Vq=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],Wq=!!document.documentElement.currentStyle,Zq=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=Gq(Vq,n),s=r.boxSizing;if(s==="")return null;Wq&&s==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var l=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),c=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:l,borderSize:c}},Kq=Zq;function Gv(e,t,n){var r=Bq(n);w.useLayoutEffect(function(){var s=function(c){return r.current(c)};if(e)return e.addEventListener(t,s),function(){return e.removeEventListener(t,s)}},[])}var Yq=function(t,n){Gv(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},Qq=function(t){Gv(window,"resize",t)},Xq=function(t){Gv(document.fonts,"loadingdone",t)},Jq=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],eG=function(t,n){var r=t.cacheMeasurements,s=t.maxRows,l=t.minRows,c=t.onChange,d=c===void 0?Vk:c,f=t.onHeightChange,h=f===void 0?Vk:f,g=Pq(t,Jq),m=g.value!==void 0,v=w.useRef(null),b=Fq(v,n),k=w.useRef(0),j=w.useRef(),C=function(){var E=v.current,T=r&&j.current?j.current:Kq(E);if(T){j.current=T;var $=qq(T,E.value||E.placeholder||"x",l,s),R=$[0],L=$[1];k.current!==R&&(k.current=R,E.style.setProperty("height",R+"px","important"),h(R,{rowHeight:L}))}},S=function(E){m||C(),d(E)};return w.useLayoutEffect(C),Yq(v,function(){if(!m){var N=v.current.value;requestAnimationFrame(function(){var E=v.current;E&&N!==E.value&&C()})}}),Qq(C),Xq(C),w.createElement("textarea",gg({},g,{onChange:S,ref:b}))},tG=w.forwardRef(eG),Cm={exports:{}},Nm,Wk;function nG(){if(Wk)return Nm;Wk=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Nm=e,Nm}var Em,Zk;function aG(){if(Zk)return Em;Zk=1;var e=nG();function t(){}function n(){}return n.resetWarningCache=t,Em=function(){function r(c,d,f,h,g,m){if(m!==e){var v=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 v.name="Invariant Violation",v}}r.isRequired=r;function s(){return r}var l={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:n,resetWarningCache:t};return l.PropTypes=l,l},Em}var Kk;function rG(){return Kk||(Kk=1,Cm.exports=aG()()),Cm.exports}var iG=rG();const Tt=Jl(iG);function gs(e,t,n,r){function s(l){return l instanceof n?l:new n(function(c){c(l)})}return new(n||(n=Promise))(function(l,c){function d(g){try{h(r.next(g))}catch(m){c(m)}}function f(g){try{h(r.throw(g))}catch(m){c(m)}}function h(g){g.done?l(g.value):s(g.value).then(d,f)}h((r=r.apply(e,t||[])).next())})}const sG=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 xo(e,t,n){const r=oG(e),{webkitRelativePath:s}=e,l=typeof t=="string"?t:typeof s=="string"&&s.length>0?s:`./${e.name}`;return typeof r.path!="string"&&Yk(r,"path",l),Yk(r,"relativePath",l),r}function oG(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),s=sG.get(r);s&&Object.defineProperty(e,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return e}function Yk(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const lG=[".DS_Store","Thumbs.db"];function cG(e){return gs(this,void 0,void 0,function*(){return Od(e)&&uG(e.dataTransfer)?hG(e.dataTransfer,e.type):dG(e)?pG(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?fG(e):[]})}function uG(e){return Od(e)}function dG(e){return Od(e)&&Od(e.target)}function Od(e){return typeof e=="object"&&e!==null}function pG(e){return vg(e.target.files).map(t=>xo(t))}function fG(e){return gs(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>xo(n))})}function hG(e,t){return gs(this,void 0,void 0,function*(){if(e.items){const n=vg(e.items).filter(s=>s.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(mG));return Qk(tE(r))}return Qk(vg(e.files).map(n=>xo(n)))})}function Qk(e){return e.filter(t=>lG.indexOf(t.name)===-1)}function vg(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 mG(e){if(typeof e.webkitGetAsEntry!="function")return Xk(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?nE(t):Xk(e,t)}function tE(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?tE(n):[n]],[])}function Xk(e,t){return gs(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const l=yield e.getAsFileSystemHandle();if(l===null)throw new Error(`${e} is not a File`);if(l!==void 0){const c=yield l.getFile();return c.handle=l,xo(c)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return xo(r,(n=t==null?void 0:t.fullPath)!==null&&n!==void 0?n:void 0)})}function gG(e){return gs(this,void 0,void 0,function*(){return e.isDirectory?nE(e):vG(e)})}function nE(e){const t=e.createReader();return new Promise((n,r)=>{const s=[];function l(){t.readEntries(c=>gs(this,void 0,void 0,function*(){if(c.length){const d=Promise.all(c.map(gG));s.push(d),l()}else try{const d=yield Promise.all(s);n(d)}catch(d){r(d)}}),c=>{r(c)})}l()})}function vG(e){return gs(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const s=xo(r,e.fullPath);t(s)},r=>{n(r)})})})}var Vu={},Jk;function yG(){return Jk||(Jk=1,Vu.__esModule=!0,Vu.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(",");if(n.length===0)return!0;var r=e.name||"",s=(e.type||"").toLowerCase(),l=s.replace(/\/.*$/,"");return n.some(function(c){var d=c.trim().toLowerCase();return d.charAt(0)==="."?r.toLowerCase().endsWith(d):d.endsWith("/*")?l===d.replace(/\/.*$/,""):s===d})}return!0}),Vu}var bG=yG();const Am=Jl(bG);function eS(e){return kG(e)||wG(e)||rE(e)||xG()}function xG(){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 wG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function kG(e){if(Array.isArray(e))return yg(e)}function tS(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 nS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tS(Object(n),!0).forEach(function(r){aE(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function aE(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xl(e,t){return CG(e)||jG(e,t)||rE(e,t)||SG()}function SG(){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 rE(e,t){if(e){if(typeof e=="string")return yg(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 yg(e,t)}}function yg(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 jG(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],s=!0,l=!1,c,d;try{for(n=n.call(e);!(s=(c=n.next()).done)&&(r.push(c.value),!(t&&r.length===t));s=!0);}catch(f){l=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(l)throw d}}return r}}function CG(e){if(Array.isArray(e))return e}var NG=typeof Am=="function"?Am:Am.default,EG="file-invalid-type",AG="file-too-large",TG="file-too-small",RG="too-many-files",_G=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:EG,message:"File type must be ".concat(r)}},aS=function(t){return{code:AG,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},rS=function(t){return{code:TG,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},OG={code:RG,message:"Too many files"};function MG(e){return e.type===""&&typeof e.getAsFile=="function"}function iE(e,t){var n=e.type==="application/x-moz-file"||NG(e,t)||MG(e);return[n,n?null:_G(t)]}function sE(e,t,n){if(Ji(e.size))if(Ji(t)&&Ji(n)){if(e.size>n)return[!1,aS(n)];if(e.size<t)return[!1,rS(t)]}else{if(Ji(t)&&e.size<t)return[!1,rS(t)];if(Ji(n)&&e.size>n)return[!1,aS(n)]}return[!0,null]}function Ji(e){return e!=null}function LG(e){var t=e.files,n=e.accept,r=e.minSize,s=e.maxSize,l=e.multiple,c=e.maxFiles,d=e.validator;return!l&&t.length>1||l&&c>=1&&t.length>c?!1:t.every(function(f){var h=iE(f,n),g=Xl(h,1),m=g[0],v=sE(f,r,s),b=Xl(v,1),k=b[0],j=d?d(f):null;return m&&k&&!j})}function Md(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Ol(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 iS(e){e.preventDefault()}function DG(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function IG(e){return e.indexOf("Edge/")!==-1}function zG(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return DG(e)||IG(e)}function tr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var s=arguments.length,l=new Array(s>1?s-1:0),c=1;c<s;c++)l[c-1]=arguments[c];return t.some(function(d){return!Md(r)&&d&&d.apply(void 0,[r].concat(l)),Md(r)})}}function $G(){return"showOpenFilePicker"in window}function PG(e){if(Ji(e)){var t=Object.entries(e).filter(function(n){var r=Xl(n,2),s=r[0],l=r[1],c=!0;return oE(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.')),c=!1),(!Array.isArray(l)||!l.every(lE))&&(console.warn('Skipped "'.concat(s,'" because an invalid file extension was provided.')),c=!1),c}).reduce(function(n,r){var s=Xl(r,2),l=s[0],c=s[1];return nS(nS({},n),{},aE({},l,c))},{});return[{description:"Files",accept:t}]}return e}function UG(e){if(Ji(e))return Object.entries(e).reduce(function(t,n){var r=Xl(n,2),s=r[0],l=r[1];return[].concat(eS(t),[s],eS(l))},[]).filter(function(t){return oE(t)||lE(t)}).join(",")}function BG(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function FG(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function oE(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function lE(e){return/^.*\.[\w]+$/.test(e)}var HG=["children"],qG=["open"],GG=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],VG=["refKey","onChange","onClick"];function sS(e){return KG(e)||ZG(e)||cE(e)||WG()}function WG(){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 ZG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function KG(e){if(Array.isArray(e))return bg(e)}function Tm(e,t){return XG(e)||QG(e,t)||cE(e,t)||YG()}function YG(){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 cE(e,t){if(e){if(typeof e=="string")return bg(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 bg(e,t)}}function bg(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 QG(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],s=!0,l=!1,c,d;try{for(n=n.call(e);!(s=(c=n.next()).done)&&(r.push(c.value),!(t&&r.length===t));s=!0);}catch(f){l=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(l)throw d}}return r}}function XG(e){if(Array.isArray(e))return e}function oS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function zt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oS(Object(n),!0).forEach(function(r){xg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ld(e,t){if(e==null)return{};var n=JG(e,t),r,s;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s<l.length;s++)r=l[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function JG(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,l;for(l=0;l<r.length;l++)s=r[l],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Vv=w.forwardRef(function(e,t){var n=e.children,r=Ld(e,HG),s=dE(r),l=s.open,c=Ld(s,qG);return w.useImperativeHandle(t,function(){return{open:l}},[l]),Ve.createElement(w.Fragment,null,n(zt(zt({},c),{},{open:l})))});Vv.displayName="Dropzone";var uE={disabled:!1,getFilesFromEvent:cG,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};Vv.defaultProps=uE;Vv.propTypes={children:Tt.func,accept:Tt.objectOf(Tt.arrayOf(Tt.string)),multiple:Tt.bool,preventDropOnDocument:Tt.bool,noClick:Tt.bool,noKeyboard:Tt.bool,noDrag:Tt.bool,noDragEventsBubbling:Tt.bool,minSize:Tt.number,maxSize:Tt.number,maxFiles:Tt.number,disabled:Tt.bool,getFilesFromEvent:Tt.func,onFileDialogCancel:Tt.func,onFileDialogOpen:Tt.func,useFsAccessApi:Tt.bool,autoFocus:Tt.bool,onDragEnter:Tt.func,onDragLeave:Tt.func,onDragOver:Tt.func,onDrop:Tt.func,onDropAccepted:Tt.func,onDropRejected:Tt.func,onError:Tt.func,validator:Tt.func};var wg={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function dE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=zt(zt({},uE),e),n=t.accept,r=t.disabled,s=t.getFilesFromEvent,l=t.maxSize,c=t.minSize,d=t.multiple,f=t.maxFiles,h=t.onDragEnter,g=t.onDragLeave,m=t.onDragOver,v=t.onDrop,b=t.onDropAccepted,k=t.onDropRejected,j=t.onFileDialogCancel,C=t.onFileDialogOpen,S=t.useFsAccessApi,N=t.autoFocus,E=t.preventDropOnDocument,T=t.noClick,$=t.noKeyboard,R=t.noDrag,L=t.noDragEventsBubbling,B=t.onError,O=t.validator,_=w.useMemo(function(){return UG(n)},[n]),I=w.useMemo(function(){return PG(n)},[n]),F=w.useMemo(function(){return typeof C=="function"?C:lS},[C]),K=w.useMemo(function(){return typeof j=="function"?j:lS},[j]),z=w.useRef(null),q=w.useRef(null),V=w.useReducer(eV,wg),Z=Tm(V,2),Y=Z[0],W=Z[1],D=Y.isFocused,U=Y.isFileDialogActive,G=w.useRef(typeof window<"u"&&window.isSecureContext&&S&&$G()),M=function(){!G.current&&U&&setTimeout(function(){if(q.current){var X=q.current.files;X.length||(W({type:"closeDialog"}),K())}},300)};w.useEffect(function(){return window.addEventListener("focus",M,!1),function(){window.removeEventListener("focus",M,!1)}},[q,U,K,G]);var ee=w.useRef([]),ce=w.useRef([]),oe=function(X){z.current&&z.current.contains(X.target)||(X.preventDefault(),ee.current=[])};w.useEffect(function(){return E&&(document.addEventListener("dragover",iS,!1),document.addEventListener("drop",oe,!1)),function(){E&&(document.removeEventListener("dragover",iS),document.removeEventListener("drop",oe))}},[z,E]),w.useEffect(function(){var xe=function(pe){ce.current=[].concat(sS(ce.current),[pe.target]),Ol(pe)&&W({isDragGlobal:!0,type:"setDragGlobal"})},X=function(pe){ce.current=ce.current.filter(function(Le){return Le!==pe.target&&Le!==null}),!(ce.current.length>0)&&W({isDragGlobal:!1,type:"setDragGlobal"})},fe=function(){ce.current=[],W({isDragGlobal:!1,type:"setDragGlobal"})},H=function(){ce.current=[],W({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",xe,!1),document.addEventListener("dragleave",X,!1),document.addEventListener("dragend",fe,!1),document.addEventListener("drop",H,!1),function(){document.removeEventListener("dragenter",xe),document.removeEventListener("dragleave",X),document.removeEventListener("dragend",fe),document.removeEventListener("drop",H)}},[z]),w.useEffect(function(){return!r&&N&&z.current&&z.current.focus(),function(){}},[z,N,r]);var be=w.useCallback(function(xe){B?B(xe):console.error(xe)},[B]),Re=w.useCallback(function(xe){xe.preventDefault(),xe.persist(),$t(xe),ee.current=[].concat(sS(ee.current),[xe.target]),Ol(xe)&&Promise.resolve(s(xe)).then(function(X){if(!(Md(xe)&&!L)){var fe=X.length,H=fe>0&&LG({files:X,accept:_,minSize:c,maxSize:l,multiple:d,maxFiles:f,validator:O}),se=fe>0&&!H;W({isDragAccept:H,isDragReject:se,isDragActive:!0,type:"setDraggedFiles"}),h&&h(xe)}}).catch(function(X){return be(X)})},[s,h,be,L,_,c,l,d,f,O]),Ne=w.useCallback(function(xe){xe.preventDefault(),xe.persist(),$t(xe);var X=Ol(xe);if(X&&xe.dataTransfer)try{xe.dataTransfer.dropEffect="copy"}catch{}return X&&m&&m(xe),!1},[m,L]),De=w.useCallback(function(xe){xe.preventDefault(),xe.persist(),$t(xe);var X=ee.current.filter(function(H){return z.current&&z.current.contains(H)}),fe=X.indexOf(xe.target);fe!==-1&&X.splice(fe,1),ee.current=X,!(X.length>0)&&(W({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Ol(xe)&&g&&g(xe))},[z,g,L]),We=w.useCallback(function(xe,X){var fe=[],H=[];xe.forEach(function(se){var pe=iE(se,_),Le=Tm(pe,2),He=Le[0],Ce=Le[1],Fe=sE(se,c,l),tt=Tm(Fe,2),Ee=tt[0],Zt=tt[1],_t=O?O(se):null;if(He&&Ee&&!_t)fe.push(se);else{var qa=[Ce,Zt];_t&&(qa=qa.concat(_t)),H.push({file:se,errors:qa.filter(function(ha){return ha})})}}),(!d&&fe.length>1||d&&f>=1&&fe.length>f)&&(fe.forEach(function(se){H.push({file:se,errors:[OG]})}),fe.splice(0)),W({acceptedFiles:fe,fileRejections:H,type:"setFiles"}),v&&v(fe,H,X),H.length>0&&k&&k(H,X),fe.length>0&&b&&b(fe,X)},[W,d,_,c,l,f,v,b,k,O]),Se=w.useCallback(function(xe){xe.preventDefault(),xe.persist(),$t(xe),ee.current=[],Ol(xe)&&Promise.resolve(s(xe)).then(function(X){Md(xe)&&!L||We(X,xe)}).catch(function(X){return be(X)}),W({type:"reset"})},[s,We,be,L]),ft=w.useCallback(function(){if(G.current){W({type:"openDialog"}),F();var xe={multiple:d,types:I};window.showOpenFilePicker(xe).then(function(X){return s(X)}).then(function(X){We(X,null),W({type:"closeDialog"})}).catch(function(X){BG(X)?(K(X),W({type:"closeDialog"})):FG(X)?(G.current=!1,q.current?(q.current.value=null,q.current.click()):be(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):be(X)});return}q.current&&(W({type:"openDialog"}),F(),q.current.value=null,q.current.click())},[W,F,K,S,We,be,I,d]),Ie=w.useCallback(function(xe){!z.current||!z.current.isEqualNode(xe.target)||(xe.key===" "||xe.key==="Enter"||xe.keyCode===32||xe.keyCode===13)&&(xe.preventDefault(),ft())},[z,ft]),qe=w.useCallback(function(){W({type:"focus"})},[]),ke=w.useCallback(function(){W({type:"blur"})},[]),lt=w.useCallback(function(){T||(zG()?setTimeout(ft,0):ft())},[T,ft]),ye=function(X){return r?null:X},Oe=function(X){return $?null:ye(X)},Lt=function(X){return R?null:ye(X)},$t=function(X){L&&X.stopPropagation()},Qt=w.useMemo(function(){return function(){var xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=xe.refKey,fe=X===void 0?"ref":X,H=xe.role,se=xe.onKeyDown,pe=xe.onFocus,Le=xe.onBlur,He=xe.onClick,Ce=xe.onDragEnter,Fe=xe.onDragOver,tt=xe.onDragLeave,Ee=xe.onDrop,Zt=Ld(xe,GG);return zt(zt(xg({onKeyDown:Oe(tr(se,Ie)),onFocus:Oe(tr(pe,qe)),onBlur:Oe(tr(Le,ke)),onClick:ye(tr(He,lt)),onDragEnter:Lt(tr(Ce,Re)),onDragOver:Lt(tr(Fe,Ne)),onDragLeave:Lt(tr(tt,De)),onDrop:Lt(tr(Ee,Se)),role:typeof H=="string"&&H!==""?H:"presentation"},fe,z),!r&&!$?{tabIndex:0}:{}),Zt)}},[z,Ie,qe,ke,lt,Re,Ne,De,Se,$,R,r]),Gt=w.useCallback(function(xe){xe.stopPropagation()},[]),ut=w.useMemo(function(){return function(){var xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=xe.refKey,fe=X===void 0?"ref":X,H=xe.onChange,se=xe.onClick,pe=Ld(xe,VG),Le=xg({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:ye(tr(H,Se)),onClick:ye(tr(se,Gt)),tabIndex:-1},fe,q);return zt(zt({},Le),pe)}},[q,n,d,Se,r]);return zt(zt({},Y),{},{isFocused:D&&!r,getRootProps:Qt,getInputProps:ut,rootRef:z,inputRef:q,open:ye(ft)})}function eV(e,t){switch(t.type){case"focus":return zt(zt({},e),{},{isFocused:!0});case"blur":return zt(zt({},e),{},{isFocused:!1});case"openDialog":return zt(zt({},wg),{},{isFileDialogActive:!0});case"closeDialog":return zt(zt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return zt(zt({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return zt(zt({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return zt(zt({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return zt({},wg);default:return e}}function lS(){}function cS({value:e,onChange:t,options:n,placeholder:r="Select…",disabled:s=!1,className:l,ariaLabel:c,prefixIcon:d}){const[f,h]=w.useState(!1),[g,m]=w.useState(null),[v,b]=w.useState(()=>{const O=n.findIndex(_=>_.value===e);return O>=0?O:0}),k=w.useRef(null),j=w.useRef(null),C=w.useRef(null),S=n.find(O=>O.value===e),N=(S==null?void 0:S.label)??r,E=w.useCallback(()=>{var O;h(!1),(O=j.current)==null||O.focus()},[]),T=w.useCallback(()=>{const O=j.current;if(!O)return;const _=O.getBoundingClientRect(),I=Math.min(240,n.length*36+16),F=window.innerHeight-_.bottom,K=_.top,z=F<I+16&&K>F?"above":"below";m({left:_.left,top:z==="below"?_.bottom+4:_.top-4,width:_.width,placement:z})},[n.length]);w.useLayoutEffect(()=>{f&&T()},[f,T]),w.useEffect(()=>{if(!f)return;const O=()=>T(),_=()=>T(),I=K=>{var q,V;const z=K.target;(q=k.current)!=null&&q.contains(z)||(V=C.current)!=null&&V.contains(z)||h(!1)},F=K=>{K.key==="Escape"&&(K.preventDefault(),E())};return window.addEventListener("scroll",O,!0),window.addEventListener("resize",_),document.addEventListener("mousedown",I),document.addEventListener("keydown",F),()=>{window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",_),document.removeEventListener("mousedown",I),document.removeEventListener("keydown",F)}},[f,E,T]),w.useEffect(()=>{if(f){const O=n.findIndex(_=>_.value===e);b(O>=0?O:0),requestAnimationFrame(()=>{var _;return(_=C.current)==null?void 0:_.focus()})}},[f,e,n]),w.useEffect(()=>{s&&f&&h(!1)},[s,f]);const $=O=>{s||(O.key==="ArrowDown"||O.key==="Enter"||O.key===" ")&&(O.preventDefault(),h(!0))},R=O=>{var _;if(O.key==="ArrowDown")O.preventDefault(),b(I=>{var F;for(let K=1;K<=n.length;K++){const z=(I+K)%n.length;if(!((F=n[z])!=null&&F.disabled))return z}return I});else if(O.key==="ArrowUp")O.preventDefault(),b(I=>{var F;for(let K=1;K<=n.length;K++){const z=(I-K+n.length)%n.length;if(!((F=n[z])!=null&&F.disabled))return z}return I});else if(O.key==="Enter"){O.preventDefault();const I=n[v];I&&!I.disabled&&(t(I.value),E())}else if(O.key==="Home"){O.preventDefault();const I=n.findIndex(F=>!F.disabled);I>=0&&b(I)}else if(O.key==="End"){O.preventDefault();let I=-1;for(let F=n.length-1;F>=0;F--)if(!((_=n[F])!=null&&_.disabled)){I=F;break}I>=0&&b(I)}},L=["v10-select",l,s?"disabled":"",f?"open":""].filter(Boolean).join(" "),B=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:L,children:[o.jsxs("button",{ref:j,type:"button",className:"v10-select-trigger",onClick:()=>!s&&h(O=>!O),onKeyDown:$,disabled:s,"aria-haspopup":"listbox","aria-expanded":f,"aria-label":c,children:[d&&o.jsx("span",{className:"v10-select-prefix","aria-hidden":"true",children:d}),o.jsx("span",{className:`v10-select-value ${S?"":"placeholder"}`,children:N}),o.jsx(_O,{className:"v10-select-caret",size:12,"aria-hidden":"true"})]}),f&&g&&dR.createPortal(o.jsxs("ul",{ref:C,className:`v10-select-menu v10-select-menu-${g.placement}`,role:"listbox",tabIndex:-1,onKeyDown:R,style:B,children:[n.length===0&&o.jsx("li",{className:"v10-select-option empty","aria-disabled":"true",children:"No options"}),n.map((O,_)=>o.jsx("li",{role:"option","aria-selected":O.value===e,title:O.label,className:["v10-select-option",O.value===e?"selected":"",_===v?"highlighted":"",O.disabled?"disabled":""].filter(Boolean).join(" "),onMouseEnter:()=>b(_),onMouseDown:I=>I.preventDefault(),onClick:()=>{s||O.disabled||(t(O.value),E())},children:O.label},O.value))]}),document.body)]})}function uS(e){return e.bridgeOnline?"connected":e.status==="connecting"?"known":e.status==="degraded"?"degraded":"offline"}function tV(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 nV(e){const[t,n]=w.useState(!1),[r,s]=w.useState(!1),l=w.useRef(null),c=w.useRef(null),d=w.useRef(null);w.useLayoutEffect(()=>{if(!t)return;const m=d.current,v=c.current;if(!m||!v)return;const k=(v.closest(".v10-panel-right")||document.body).getBoundingClientRect();v.getBoundingClientRect().left+m.offsetWidth>k.right-4?s(!0):s(!1)},[t]);const f=w.useCallback(()=>{var m;n(!1),(m=c.current)==null||m.focus()},[]);w.useEffect(()=>{if(!t)return;const m=b=>{var k;(k=l.current)!=null&&k.contains(b.target)||n(!1)},v=b=>{b.key==="Escape"&&(b.preventDefault(),f())};return document.addEventListener("mousedown",m),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",v)}},[t,f]),w.useEffect(()=>{var v;if(!t)return;const m=(v=d.current)==null?void 0:v.querySelector(".v10-agent-tab-menu-item:not(:disabled)");m==null||m.focus()},[t]);const h=m=>{(m.key==="ArrowDown"||m.key==="Enter"||m.key===" ")&&(m.preventDefault(),n(!0))},g=m=>{var C,S;if(m.key==="Tab"){n(!1);return}if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;m.preventDefault();const v=Array.from(((C=d.current)==null?void 0:C.querySelectorAll(".v10-agent-tab-menu-item:not(:disabled)"))??[]);if(v.length===0)return;const b=v.findIndex(N=>N===document.activeElement),k=m.key==="ArrowDown"?1:-1,j=b===-1?k===1?0:v.length-1:(b+k+v.length)%v.length;(S=v[j])==null||S.focus()};return o.jsxs("div",{className:"v10-agent-tab-menu",ref:l,children:[o.jsx("button",{ref:c,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(v=>!v)},onKeyDown:h,children:o.jsx(IO,{"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 Wv(e,t){return(t==null?void 0:t.trim())||`integration:${e}`}function Dd(e){const t=e.sessionId??e.defaultSessionId??so(e.integrationId);return{integrationId:e.integrationId,sessionId:t,stateKey:Wv(e.integrationId,t)}}function pE(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 fE(e){var n;if(e.selectedSessionId==null)return!1;const t=e.integrations.find(r=>r.id===e.integrationId);return!(((n=pE(e.selectedSessionId,e.integrations))==null?void 0:n.id)!==e.integrationId||t!=null&&t.defaultSessionId&&e.selectedSessionId!==t.defaultSessionId&&rV(e.integrationId,e.selectedSessionId))}function aV(e){return fE(e)}function rV(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 dS(e,t){const n=e.flatMap(r=>{var d;const s=pE(r.session,t);if(!s)return[];const l=r.messages.find(f=>f.author==="user"),c=r.messages[r.messages.length-1];return[{sessionId:r.session,integrationId:s.id,integrationName:s.name,preview:((d=l==null?void 0:l.text)==null?void 0:d.slice(0,60))||r.session,messageCount:r.messages.length,lastTs:c==null?void 0:c.ts}]});return n.sort((r,s)=>{const l=Date.parse(r.lastTs??""),c=Date.parse(s.lastTs??"");return Number.isFinite(l)&&Number.isFinite(c)?c-l:String(s.lastTs??"").localeCompare(String(r.lastTs??""))}),n}function hE(e,t,n,r,s){var c;const l=Dd({integrationId:e,sessionId:t,defaultSessionId:s});return(((c=n[l.stateKey])==null?void 0:c.length)??0)>0||(l.sessionId?r.some(d=>d.sessionId===l.sessionId):!1)}function mE(e,t,n){const r=Wv(e,null);return Object.entries(t).some(([s,l])=>l.length>0&&(s===r||s.startsWith(`${e}:`)))||n.some(s=>s.integrationId===e)}function iV(e){const t=[...e.integrations].sort(rp),n=t.filter(d=>d.persistentChat),r=t.find(d=>d.id===e.selectedIntegrationId)??n[0]??null,s=r?Dd({integrationId:r.id,sessionId:e.selectedSessionId,defaultSessionId:r.defaultSessionId}):null,l=r?hE(r.id,e.selectedSessionId,e.localMessagesByConversation,e.sessions,r.defaultSessionId):!1,c=r?mE(r.id,e.localMessagesByConversation,e.sessions):!1;return{sortedIntegrations:t,connectedIntegrations:n,selectedIntegration:r,selectedConversation:s,selectedHasConversation:l,selectedIntegrationHasAnyConversation:c}}function sV(e){const t=e.selectedIntegration,n=!!(t&&!t.persistentChat&&e.selectedHasConversation),r=!!(t&&!t.persistentChat&&e.selectedIntegrationHasAnyConversation),s=r?[t,...e.connectedAgents.filter(d=>d.id!==t.id)]:e.connectedAgents,l=e.selectedIntegrationId===es||!t&&e.connectedAgents.length===0||!!(t&&!t.persistentChat&&!e.selectedIntegrationHasAnyConversation),c=!e.localHistoryLoaded&&e.localMessagesCount===0&&!!(t!=null&&t.persistentChat||e.selectedHasConversation);return{showingSessionHistory:n,showingStoredSessions:r,visibleAgentTabs:s,showAddFlow:l,shouldShowConversationLoader:c}}function rp(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 sd(e,t){return[...e.filter(n=>n.id!==t.id),t].sort(rp)}function oV(e,t){const n=e.find(c=>c.id===t);if(!n)return e;const r=n.connectSupported,s=r?"available":"coming_soon",l=r?"Ready to connect":"Coming next";return sd(e,{...n,configured:!1,detected:!1,persistentChat:!1,chatReady:!1,bridgeOnline:!1,bridgeStatusLabel:l,status:s,statusLabel:l,detail:r?`${n.name} is no longer attached to this node. Reconnect from the + tab when you want live chat again.`:n.detail,error:void 0,target:void 0})}function lV(e){const t=e.selectedItem;return e.selectedIntegrationId===es||t!=null&&(t.persistentChat||hE(e.selectedIntegrationId,e.selectedSessionId,e.localMessagesByConversation,e.sessionSummaries,t.defaultSessionId)||mE(e.selectedIntegrationId,e.localMessagesByConversation,e.sessionSummaries))}const cV={openclaw:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAEy0lEQVR42u2ba4hVVRTHf1OmM9GUjzITRmEyX4nglxwjzZKMIsFHGEJJJlLfJGTGBD8kRkRCVmrRA8ueSqmRqJFOpqb2QafR0sovvbTygaPQpONM3s6W/43D7Z65Zx/OuWcfuAsWM/fOXnut/9pr77322nugQhWqUIWiUzVwC1CXgu466a5OC/wdwA9ADugE9gCPAD0S1NlDOvZIp9H9I9CQhgOmA98BrwIfAG0yaDswIgF9I9S30XFGOo3uVs8h96QVBVf6fh8IvCADTwFTfH8bANztOWk+sBLYAHyhkfwKaAbWAyvUZhJwk09+ivrMScdA39+qXFsX7gV+Bi4Ay4GtPuNt+LQX2p8BL6ov0+fkLCyMozWiuZi5WX07S4OBNzVauYT4gnQMdg38w8DxBIEX8nHtBqlTL+ClMgIv5JdlQyp0LbAxRfB5/kS2lJWu0eqec4S3yqaykMnG1joEPs9rE85C/6MlDoLP89NJg5/sy8HDrNQ7gIMRwVwCWtTHiZAyF5NMi3sD31usztdLrqfODW0W4H8H7vPp7g+sCSlrbLwuzdBvVn5u5uMqL2r2Ard6ETEvpPw/3iHrQekcBuwE3tEAHAjZx5IksrwzIZU/7jM+/90qjcq5EPLHgFr1sdj3/RhgYUgbjK2D4nTA8xbh+5ivWPKGRu12L2HqE3Ia/OLpu1p9jAK+1kmxxsIBhp+LC3w/zcmwijcUyF+hn7O0sJWS79TRudhxd6flOtIvDgfMtVy9zRxuBK7y9WEi4FeLPg4XnPxMND0bYSeZE4cDXrPY+vxsQv8tYDPwdwT5c0q1V3u7yKEI8p2qGFnTDcBQb+Wt18pbo89TlWgccTgROiIbp8rmamGo1+f+3QE3CcQWJR3m3N3uhf9vwDYtPg+oElujUXEN/GrZVidbm7yp97kwtAvTSZ0b/pcszVYWVUrJX5rfPR2LhMOyqVE2hskYZ/uLmactlHWoYPmMQw5YKpsuWtYcLxdXn4igcGxEuaTY2HJbRDnrUlaHsqyljkXAIMsIyGlrvjx/bIRaIiQlSfOXsqnFUu5blCzYJhc3ezvDeYcccF422WJ5FF0whk1U9snTaxzcBt+WbftCtjeYh+Rz7U0hBMxBZriurbocdECXbBse8tD1qf+cMa7EAmISifuVSf3kcCZobLtRtraXyAPGFSZDTd10epdSyr0Og/dP096yOWiwGoPSYXNk3a3t4RttL30UVvszAD7P+2VzX2FoUZ1hF/BQmANRre/q+ymLapBL3Cbb89f4tVHvAFozCD7PrXHcFSzKsAMWxlEQGVpiRXWV25XjxELrM+iAj+OsCk9UrS8r4I2td8bpgCpVi7LigC1JPJ4aq6Ow6+A7VBtIhFZmwAErkrwdNhcNRx0GfzSuy5DuaJKjU6FDtpWFmhx0QFM53whV6cbIFfCvp/Fk1jxPW+cA+HVpPpUzNzHvpgj+PdmQKpnT1rIUwC8r16swm+eyf5QB+J/S5STVKyy7Eip6vq/yt/M0HvgQOBsD8LNa6MaTQZoT8P7vSWAB8Iq200X6fKmbN0eZpGkBo1rsn5waAtpOy7IDZgSAmlCk7YSAtjMqDsgwzQwANTGg6lSs7cwsO8DM64+K8MgibUcGtG2gQsnRv1P7PFimYrmBAAAAAElFTkSuQmCC",hermes:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAANwElEQVR42rVbCZAcVRn+Z3bume6ZnnN3dg0EEzmMiWCJpVUmIjEeWJZiqRRBEw8owERRU4pXieWBEsAyZUlQMXhfSCkBQUuU9RY8IhQaECMEEjAEYyRkQULWflPfW7/8eT3dvYtb1cl0v9fv/e//X//H9/9PRGRURMZEpCIiIyLSFpGeiORFpIS2Jto8EemLSA33LbxfFJEC3mujrYq+Pu6bGKuEsbsi0hGRHOY2bQ30bRBNOfTrRtDkK5raoKkAukZB5wj69LEOcx8IBusTAzp4yU7Wx2RZvDiOgbIYeIwYwJNV0ddH3ybGsgzoYS7Tt4y2Ovo2FE1d9M8RTQH6+pinGsGAMdCUBd3jWIelaTBJBZO20KmKxgBtNbT5ILaO9hraA0ffOvVtYVI7T4A57DwNtPk0j+3bpL4B9fUc8zSJfk1TE30q1NeMMeDaSIyEKuCcllCZJGS3aFlJqJ5CQkl2WBttVUVToOi3NPEOaxBNdocNBuxgwCIY0cZAFbQFaPMwqIf7AH0rmKSN94tYRBfSLGDyDvqWsLgmftfQVld9a0RTS9HUQF8f83DfDugpJ6B/IOlRMCCPRXQxeAntAb4/DxKp4b6J9hIG7IHQHMYbA4G27yiIKoCwNuasoK2Bvg3cV4imDt4ro83S5BP9OczfAz2W/ibaaqDJw/2AAfkIArsOAusRBHZwcV8mcEwR2FUEagYzgczgLt7POxgcOBjciWBwnZg2M3iACewWbWOyIjryFq2rz6aF/tx32BZtp9iivJ2TfmKWJvvZRNFf02bQ2lzrBxQdfoBWUlahsZKKM4N2HvMsQz6ET0p2DIt2+QFxZrBHNEWZQav4B/9ok9bE7ypeZtPTVCatGWHSPGU6PZKsmWueiDxdRI4TkWNF5Kloz2CRwRAz2yTz56cws57DzA44YaXZB9dykCabEWtyMnhxHISOgOM9/C6ibcBdkq55tlhEVoVjbxSRX4vIv0VkWkT2icgOEflVKMHPhP+vwNhl2mF5/O6QGZzAYjJY9Djm1zSV0NZAX2uazfgDrvi46iSpOt3bNl/dR/X1aOuuDNs+FT67RETeKiInYVsa4k8VkWvABH39UUTejjGKKWjyU/YdSN1yI0OucA6c72N3ZPDyBLZhBt9bX0mohuttInKnY2FTIRMmReQ0vGf+3kC7QV9mVywnbc87LIPnE9gRlv4x0GPpb6Othr72UzPrmiG4Tt9dDduljt8e3VcxaQPPa/Q7D6luiViMvjbSQl4qIv+K6LdXRF6PxTeIpgC0MP1MU0PRb/sy/Ye5wi4dUIkIVkoUVR2B7/eJhIu31w8gNcEio95/VETeTIGMtjLWFY7SAZGusLXhNXwGUVbAatw2iCjTjjkmlOBvUy7cLmpXyOjP0g7aOKT/dSKyEAtoYGF+Cvo9Rf/ACgzDA2w8HYUHmPsTReQOReiBIYv4h4jcH37320TkZSJyPBTeKuy8Ptq13vge9MoFMKENhQdE+QHD8ICBpbKRlvUEy3jWwYsFDN5VwUobjNsMSVpid4rIfSThg2oxRuLvFZHV2ParwMBPgzAz14WhxXhQRK7CWJeh79PwfDW2ck95gl3yBNvknVaI/jz+71lXuEAMYL/bBiuWAT0awDobhpD3iMgPsdDHQi5fDM1tFv8dfLdmkb8RkZtCBpwLzp+P7b4VfS8XkaVY0KJwsV8XkVNE5EuhhXgnpH8ZmHgzuc0+0dQjAXIAVUFbw8WAniOwcX0COfoEzCRHwpRNYGBj59eLyGtxvxzm7cMiskRE1sIRssStc3wel0LShpZfQtrb0fZIyPC78fsgrIaoTyCXABLjYKsptFWsErGxdxmEtEnheASSvE9ErghN1DtE5IVYqJHwnyGhu5Vtn4K3twXt9zgY8AcQlsH4wxTolRRtWvqtC90ipKuNZ0y/h/vGbMxgBjvkNmx5I42HhxCaxiz+M5zvI2Dk9WDatEOPWGV6HAVmgTLNvaSIUDXCEbL4W1U5HYZBy1IsbAe2b5K+ByhGuAUMngaDXZZlJekopr9KjpCmv6qcpkNc4azDFR5XrrB5cU0KqW5P6SPcA6VoJHwXGL0vwku8FBKekyvsp7yMYvloigX9B9p7KkHfgyR1vTO2R8QJVRXQ+erei1nPIeHwuEMHZFU4LPhOoxZxr0Mn/FREfj4LT5Gvvyt/YxpWYh5omnU43HSAHAHphkAFQRXY5ChCH4E5NJ7e37B9jT9wpoj8Dtv6r7AEO1Iw4EFcWsEupbC8GkG/BnR8yg8cAollyY7mFCSWJTPybIc0DsDLW0tJltfAz/+JiPxIRN5PQGsfKNDahAx4DLtAPz+bFsz052MgsZnMUIlsYocw/pYCIBlUNO1fIYlPw3F5tYicTjsqA/9gJzHJMOJVGFfg0OhF3Qo7f5PS/tsc1mADRag67+ACRYsaFNWweEnB4jkHLO7BE7wBfvyfoORug2u7jCRiwuQ3Ybt+F4y7CN9mBszQDDDO0u8BnOxXccYe1fdnlFAdpcwQw+LlCFh84Ad0yS/OE26vEyN5LHyUpNuGb38q0B8TGO0ml7cLs2Pc46/B3z+Nkh1GAq9IoQcexi7gZ7vhEJUV/Tbv0IVw85hvlELvQWLEQs5VLJpTY4zbFxRuXyDEpQTp347vvEC4vcXnngKNnaN4wIx/VgoGGDP5F4dn+EqKXWxqjOlvEv09on/AgJz6BIoqOcr5+7rK31vn6UhI4luUlQlUvF4mJdUjPHBDSnO43eFZnk8KTydHc5ib6w/qhIHMKD2ruat41kyQ8rbZnmPgx38QW/4EQl0Yt9eITR6QWBoG7MVc/GwzKT6mvxlBv0/0H2YGu8oV1unrCQpAbCS5BP77i4HyWLvLuH2THJUc6YetKRnwOMwtP7sfNLtc4TFKqbMrbJ2/maDBhfF7Ch32FbpqCw5egu/yFIAfPukBxukbymlZFBNJDnOKtG5YQSYuDf2RmaGxCFdYZ4bM31tAyDp4gb8Ix/m4iCwg3L6iJGT+Tp6lW7zfoQjXg67UrnBDYfxpOVgExjcN2OuM0PZvwk44j96tq3mKAFN0JPjQLGKEaTC94shaRdHvaVeYy11cmaGsgsSsDvCRD7BbcQ22Y5USkRmF21tn6vNqMRfCnKZhwHUInffC1AbkCueT6IA0VsBmVxeRD2AWc63y4loOK6Bx+5yyAFOAyG9JyQBjeq/G79cRAmStQDnOCuQIEovzA4pwXE4mZ6nokNo6jJGlChGrL9qEPnMKbRLKdFdKBnwj1Anvxu9PKmvm8gMOg8RcnmDH4Qla13ES+LwFJBdj+2lnZQlBUB5qAE4kBs9TIMduoD4PpGTAlaSENyH7vIwWHusJRsUC7Etbr24cEloBaZpn5wwxVZOIErdicfvhKpu/+QoPMLvhBcAN0jDgYwSxm+DsmSFzv0hFlbGxQFw0mCd4+Xho6S0IY5dTCny/AyOI8udXgQm30vM34tn6lAxYCcDFhuSjwCCPpoKqodFgHB5QonTz82HqXN7ZNxPiftNAhM5TDHsAKNHBFIvfA8bZ/MON+LTuBWjjx+AB1TSIkMDn3wx8z8Li9yEkvp6QmycS5gAuSrlgVxXJzXR/OT5PI4ijsJ5YRIgxwWoMJmgY8mUR+bGIfAAWYQUU0TQ5QwcSuLIvgg7ZOAcG6HnOAS07KTvE+Q2fMMGqyxXmYEWjwjYIasPrOgDQc4+SyLeHEDwFp2kpdpQNWz80C/Onr4dgDSwM7ydwhSs6L1Afgp/XaSc0kbG9HVt+JzTwakduX6O4a6i2x5bQmb9PUL+7yBxOYXG7AL1NRiRJroBg9kFZV2LW47uKpLJDXGEukqqA6HmY1Ciil2MHRAUrXB+wgOIJgwx/FYvbAMj9KliXM6HNj4X3eRLc5UuQhOV44EYw+FxKgycuknLl1oIEuTXDpHepxd4JizBMuRk7/YyQmC8A4roAWns+lOkdWPAIudBlbGUjnM9BFzHavAPp+JwjN+jKbwRcJMWlrMWURVIZwOEXwyE5CvZ4WKrscWzza7FdF8Jz3IRFHY0dZs8LcBmeFdLVSKTuhwu8kGqOc2mKpNqEkZcS1gd4Khc/Iv/7Oz0mdN0GTb0Y0jgC1WFnw56fQBUqVQdNVrqL8dlcQ7uDaSonqA8IbJHU6JBiaV0hwucFuDbfMOG5sAyPQnlN4Zu/AZ+GSY19n7bhfEhyMUpizgITG1T6HnVoqgK4/QxiVk6BrvoMg64Qac2lRqgHIgpUWt/HYp4XOkzPQtC0AIpnARypcSrDN/8/B+NN0Lg18tW7JN0Oubc18lR1jVCB8EquEXIWSaWtEssPqciyIESTymmrNG6WzgCUaHsHVHano7UubXGmqeYQiqapparEuEjKnmGYU52gPjeoj80lPTdYprxDNuG5wSBBnWAxSZ1gKwKxSVIpqlEkV1WmH4M4ldWxvJLKO5QVxl8ldKcUUb0aVynKNM3ZDLrOC0Sd6Miqg5lx6WuXGXSdF4grknKZwRlXuBaB2rqqxV3V1royuxaBxHpqnpoDtfUcqHNSmmZLv7NIaizleYE8FT20SfkNywz1Ep5IyRJqNfL/OC/gqcyN/yScGBn2bt3xrp+iL4/bmOOJEc+VGSrO8cyQDT0Dh4RcOqAfk3vsz+LMUC5NZihQgMiwU2OuE1p8aqxFuQR9aowPZ8edBNMHrgOV6Y07NaZPsgURp8aC/wJs6rIsXDWrggAAAABJRU5ErkJggg==","prime-agent":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAEUElEQVR42u2Za4hWRRjHf7uuklZ0pSuRG26WUdHVIilqsduHXa39UJBCJWWlkNLNCrthQR+iD4ZWFLFZEhWRKJYVka6Q+qnY7trFG9GuZRetzextBv4Lw2HOeed99z3nLNv8YfZlmTkzzzPnufyf50BERERERERERERERETEiMcRwAH/J4UPAqYAC4E1wE7gY+C4kaz0aOBSYDHwDVDxjPaRqPhhwGxgU4rSg+N5YOxIUnwMcCvwdRXF7XgMaG7UwQcD5wHnAseUpPxkY+4fBSj+BzCrkQdfDnwJ7NfoAz4E5ijSFuHn9wK/Byj/I3BFo33tu4wDrSlek6Pyk4D3AhS3Y6ustKE426SVf6scvA+4rcHnNgG3y9pClN8BnJPHGzjVmN+fAQLYS5jeoDNbgTcS+9uLeCfl7F3K/7lgArA38C1sA44d4nnX6226+/bIFR5NefMX5RmArg5wAXc8Wec59uK6Pfs9Z3L58cALnrkf8jJ7F695Dv7EpJq7UnJxfx3Us9PD4v4B7tP8ZZ5zdio+5YoLgQHP4VdpfmWKFcwN3P9IYInHwqzLzXTWnZJIgft1abnjrZS3byusccDmlAtYF8DAbK7u9Tz7C9ChNW3mz8PiIO6aZ4pQ/nzgb4+AMzR/ckZw3Kv5NF7xtLJG8rmfgalOJtjlzFlL3GAC7c1ASxEX4As6PeLiyA2yguEdnj3bZUGVlDc/NbH+YrlChy50VFGc+2gPARmQQIO4u8oF9Do0+XBlh4GM9XMcAjTPMLpVRulXlRlelys0F3UB13kE7E6seSkgJX5qeMSyjFhhx1+KNWOcam9bCscYV9QFLPf49GnO/KiAOjx0LJN5jzfnTjRF1iVKpe6aX03Ov7HIsnNDQoAVntL4+wYovxv4AvhANPdtFT5r9f/L4gKTiq67Z4qY7JGgt3gKlcnqt9Wj+JtKgyeojzda+05JWFqpaNHtV1KaC03K97Uq/xlwiGe/+WJ//XkWNrXA0s8tEnq5Z/6COpS3fYUzE/vYDLHUQ7YOLFP5WY75D5aiyTbYWTUqv0qVpWtB01PYYEX7l4K5KdXfnYl1zXIRG7Ce8tDVipjk+0bJrsRzV5o6490qqbGtDOWnZZCVrxSw0uDygs9NYFtkgt3pzrz1+xt0YdWsZXWRrG8QJ6rEzBJsXsbzC9Q5WqRiaazM+CZT6z/rxJNqY08RNb4P3QHC9Sv9pbXNJ6hGf8XEke01NlLSXK0QnCG/CxGwTxnCB+vbvw2BGD1RVuB7vEZBfxJtdXGoIVDf1qm4zf8PlKW8jcrr6xD6wcQ+HXUqvzXn7wpBX116axB4QGVqa2Kf++ukxOOHA+tbHWimK9Un9GFhDYpvSfT8SkdXhrC2LfViAD9vD1DcptlHgKMYZmjyBMI+fYhorSGWPKTWVrKXsNH83qP+/rBGpwqfxUOgoicB16p52amWdgsREREREREREREREREREaXhPxXZ1AH/I5YbAAAAAElFTkSuQmCC"};function uV(e){return cV[e.trim().toLowerCase()]}function pS({integrationId:e}){const t=uV(e);return t?o.jsx("span",{className:"v10-local-agent-logo","aria-hidden":"true","data-agent-logo":e,style:{maskImage:`url("${t}")`,WebkitMaskImage:`url("${t}")`}}):null}function dV(e){var X,fe;const{integrations:t,selectedIntegrationId:n,selectedIntegration:r,selectedSessionId:s,selectedHasConversation:l,selectedIntegrationHasAnyConversation:c,onSelectIntegration:d,onConnectIntegration:f,onDisconnectIntegration:h,onRefreshIntegration:g,connectBusyId:m,refreshBusyId:v,connectNotice:b,connectError:k,localMessages:j,localHistoryLoaded:C,localChatEndRef:S,localInput:N,onLocalInputChange:E,onSendLocalMessage:T,onStopLocalStream:$,localSending:R,activeProjectId:L,availableProjects:B,projectsLoading:O,onSelectProject:_,attachments:I,onAddAttachments:F,onRemoveAttachment:K}=e,z=e.selectableProjects??B,q=I,V=q.some(KN),Z=[...new Set(q.map(H=>H.contextGraphId))],Y=q.some(H=>H.status==="uploading"),D=j.some(H=>H.streaming)?"streaming":Y?"uploading":"idle",U=q.length>0&&q.some(H=>H.contextGraphId!==L),G=w.useRef(null),M=w.useRef(null),[ee,ce]=w.useState(null),oe=w.useCallback(H=>{M.current=H,ce(H)},[]),[be,Re]=w.useState(!1),Ne=w.useCallback(()=>{const H=M.current;if(!H)return;const se=H.scrollHeight-H.scrollTop-H.clientHeight;Re(se>40)},[]),De=w.useCallback(()=>{const H=M.current;H&&H.scrollTo({top:H.scrollHeight,behavior:"smooth"})},[]);w.useEffect(()=>{const H=M.current;if(!H)return;const se=requestAnimationFrame(()=>{const pe=H.scrollHeight-H.scrollTop-H.clientHeight;Re(pe>40)});return()=>cancelAnimationFrame(se)},[n,s,j.length]),w.useEffect(()=>{if(!ee||typeof MutationObserver>"u")return;const H=()=>{const pe=ee.scrollHeight-ee.scrollTop-ee.clientHeight;Re(pe>40)};H();const se=new MutationObserver(H);return se.observe(ee,{childList:!0,subtree:!0,characterData:!0}),()=>se.disconnect()},[ee]);const We=(X=e.selectedIntegration)!=null&&X.chatAttachments?e.activeProjectId?e.localSending?"sending":null:"noProject":"unsupported",Se=We===null,ft=w.useCallback(H=>{Se&&F(H)},[Se,F]),Ie=dE({onDrop:ft,noClick:!0,noKeyboard:!0}),qe=[...t].sort(rp),ke=qe.filter(H=>H.persistentChat),lt=qe.filter(H=>!H.persistentChat),ye=r,{showingSessionHistory:Oe,showingStoredSessions:Lt,visibleAgentTabs:$t,showAddFlow:Qt,shouldShowConversationLoader:Gt}=sV({connectedAgents:ke,selectedIntegration:r,selectedIntegrationId:n,selectedHasConversation:l,selectedIntegrationHasAnyConversation:c,localHistoryLoaded:C,localMessagesCount:j.length}),ut=R||!(ye!=null&&ye.chatReady)||ye.busy===!0,xe=!ut&&!Y&&(N.trim()!==""||V);return o.jsxs("div",{className:"v10-agents-tab",children:[o.jsxs("div",{className:"v10-agent-subtabs",role:"tablist","aria-label":"Integrated agents",children:[$t.map(H=>{const se=(ye==null?void 0:ye.id)===H.id&&!Qt;return o.jsxs("div",{className:`v10-agent-subtab-group ${se?"active":""}`,children:[o.jsxs("button",{className:`v10-agent-subtab ${se?"active":""}`,onClick:()=>d(H.id,{preserveSession:fE({integrationId:H.id,selectedSessionId:s,integrations:t}),sessionId:H.defaultSessionId}),role:"tab","aria-selected":se,children:[o.jsx("span",{className:`v10-agents-stat-dot ${uS(H)}`}),o.jsx(pS,{integrationId:H.id}),o.jsx("span",{children:H.name})]}),se&&o.jsx(nV,{integration:H,statusLabel:tV(H,Oe),statusDotClass:uS(H),refreshBusy:v===H.id,canDisconnect:H.persistentChat,onRefresh:()=>g(H.id),onDisconnect:()=>h(H.id)})]},H.id)}),o.jsx("button",{className:`v10-agent-subtab add ${Qt?"active":""}`,onClick:()=>d(es),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"}),b&&o.jsx("div",{className:"v10-local-agent-notice",children:b}),k&&o.jsx("div",{className:"v10-local-agent-error",children:k}),o.jsxs("div",{className:"v10-local-agent-list","aria-label":"Available agent integrations",children:[lt.length===0&&o.jsx("div",{className:"v10-agent-empty-state",children:"No additional local agent integrations are available yet."}),lt.map(H=>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.jsxs("div",{className:"v10-local-agent-title",children:[o.jsx(pS,{integrationId:H.id}),H.name]}),o.jsx("div",{className:"v10-local-agent-subtitle",children:H.description})]}),o.jsx("span",{className:`v10-local-agent-status-pill ${H.status}`,children:H.statusLabel})]}),o.jsx("p",{className:"v10-local-agent-copy",children:H.detail}),H.error&&o.jsx("div",{className:"v10-local-agent-warning offline",role:"status","data-testid":`local-agent-warning-${H.id}`,children:H.error}),H.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(H.id),disabled:m===H.id,children:m===H.id?"Connecting...":"Connect OpenClaw"}),o.jsx("a",{className:"v10-agent-link-btn",href:KH,target:"_blank",rel:"noreferrer",children:"Docs"}),o.jsx("a",{className:"v10-agent-link-btn",href:YH,target:"_blank",rel:"noreferrer",children:"Release Notes"})]})]}),H.id==="prime-agent"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"v10-local-agent-copy",children:"Connect a local Prime Agent through the node, then this tab becomes the persistent chat surface for it. Prime Agent publishes a bridge per live session; the first chat pins one session, and you can switch explicitly when several are live."}),typeof H.sessionCount=="number"&&o.jsx("p",{className:"v10-local-agent-copy","data-testid":`local-agent-sessions-${H.id}`,children:H.sessionCount===0?"No live session. Start a Prime Agent session, then refresh — the extension publishes its bridge on session start.":H.sessionCount===1?"1 live session.":`${H.sessionCount} live sessions — choose which session this chat should use.`}),H.connectSupported&&o.jsx("div",{className:"v10-local-agent-actions",children:o.jsx("button",{className:"v10-agent-send-btn secondary",onClick:()=>f(H.id),disabled:m===H.id,children:m===H.id?"Connecting...":"Connect Prime Agent"})})]}),H.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."}),H.connectSupported&&o.jsx("div",{className:"v10-local-agent-actions",children:o.jsx("button",{className:"v10-agent-send-btn secondary",onClick:()=>f(H.id),disabled:m===H.id,children:m===H.id?"Connecting...":"Connect Hermes"})})]})]},H.id))]})]}):ye&&o.jsxs("div",{...Ie.getRootProps({className:"v10-local-agent-chat-shell"}),children:[o.jsx("input",{...Ie.getInputProps()}),b&&o.jsx("div",{className:"v10-local-agent-notice",children:b}),k&&o.jsx("div",{className:"v10-local-agent-error",children:k}),!ye.chatReady&&o.jsx("div",{className:`v10-local-agent-warning ${ye.status==="connecting"?"connecting":"offline"}`,children:Oe?`${ye.name} is not currently attached to this node. Session history remains available here; reconnect from the + tab when you want live chat again.`:ye.status==="connecting"?`${ye.name} is still finishing setup. This chat tab stays in place and will go live automatically when the connection is ready.`:ye.status==="degraded"?ye.detail:Lt?`${ye.name} has saved sessions on this node. Open one from Sessions or reconnect from the + tab to resume live chat here.`:`${ye.name} is temporarily unavailable. Refresh after it recovers to resume chatting here.`}),ye.id==="prime-agent"&&ye.busy===!0&&o.jsx("div",{className:"v10-local-agent-warning connecting",role:"status","data-testid":"prime-agent-active-turn-status",children:ye.detail}),ye.id==="prime-agent"&&(((fe=ye.liveSessions)==null?void 0:fe.length)??0)>1&&o.jsxs("div",{className:"v10-composer-target","data-testid":"prime-agent-session-picker",children:[o.jsx("span",{className:"v10-local-agent-target-label",children:"Prime session"}),o.jsx(cS,{className:"v10-local-agent-target-select",value:s??ye.defaultSessionId??"",onChange:H=>d(ye.id,{sessionId:H}),options:ye.liveSessions.map((H,se)=>{var pe;return{value:H.sessionId,label:((pe=H.sessionName)==null?void 0:pe.trim())||`${se===0?"Most recent":`Session ${se+1}`} · ${H.sessionId.slice(0,8)}…`}}),ariaLabel:"Prime Agent session",disabled:R||ye.busy===!0})]}),Ie.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(JO,{className:"v10-drop-overlay-icon",size:32,"aria-hidden":"true"}):o.jsx(EO,{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 ${hg(B,L)}`:We==="sending"?"Wait for the current send to finish.":We==="unsupported"?`${ye.name} doesn't accept file attachments.`:"Choose a context graph before attaching files."}),o.jsx("div",{className:"v10-drop-overlay-hint",children:Se?"Release to upload to this conversation.":We==="sending"?"Drop will be accepted once the agent reply lands.":We==="unsupported"?"Try a different agent that supports attachments.":"Use the picker below the composer."})]})}),o.jsxs("div",{className:"v10-chat-messages v10-local-agent-messages",ref:oe,onScroll:Ne,children:[Gt&&o.jsx("div",{className:"v10-agent-empty-state",children:"Loading the latest conversation from DKG memory..."}),!Gt&&j.length===0&&(()=>{const H=Oe?{title:"No turns in this session yet.",hint:`Reconnect ${ye.name} from the + tab to start a new live thread.`}:Lt?{title:`${ye.name} has saved sessions.`,hint:"Open one from Sessions, or reconnect from + to start fresh."}:ye.chatReady?{title:`Start a conversation with ${ye.name}.`,hint:'Try: "What can you help me with?"'}:{title:`${ye.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:H.title}),o.jsx("div",{className:"v10-agent-empty-state-hint",children:H.hint})]})})(),j.map(H=>o.jsxs("div",{className:`v10-chat-msg ${H.role}`,children:[o.jsx("div",{className:`v10-chat-bubble ${H.role}`,children:$q(H.content,H.role,!!H.synthesized,!!H.streaming,H.failureNotice)}),H.attachments&&H.attachments.length>0&&o.jsx("div",{className:"v10-local-agent-attachment-row",style:{display:"flex",flexWrap:"wrap",gap:6,marginTop:6},children:H.attachments.map(se=>o.jsx("span",{className:"v10-local-agent-attachment-chip",style:{padding:"2px 8px",borderRadius:999,background:"var(--bg-elevated)",fontSize:11},children:se.fileName},se.id??se.assertionUri??se.fileHash))}),H.ts&&o.jsx("time",{className:`v10-local-agent-msg-time ${H.role}`,dateTime:H.tsRaw,children:H.ts})]},H.id)),o.jsx("div",{ref:S}),o.jsx("button",{type:"button",className:`v10-scroll-to-bottom ${be?"visible":""}`,onClick:De,"aria-label":"Scroll to latest message",title:"Scroll to latest message",tabIndex:be?0:-1,"aria-hidden":!be,children:o.jsx(SO,{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:[q.length>0&&o.jsx("div",{className:"v10-attachment-chips",role:"list","aria-label":"Attached files",children:q.map(H=>{var Le,He;const se=((Le=H.result)==null?void 0:Le.extraction.tripleCount)??((He=H.result)==null?void 0:He.extraction.triplesWritten),pe=H.status==="queued"?"Queued":H.status==="uploading"?"Importing…":H.status==="completed"?se!=null?`Ready · ${se} triples`:"Ready":H.status==="skipped"?"Stored only":H.error??"Failed";return o.jsxs("div",{className:"v10-attachment-chip","data-status":H.status,role:"listitem",children:[o.jsx("div",{className:"v10-attachment-chip-badge","aria-hidden":"true",children:FH(H.file.name)}),o.jsxs("div",{className:"v10-attachment-chip-body",children:[o.jsx("div",{className:"v10-attachment-chip-name",title:H.file.name,children:H.file.name}),o.jsxs("div",{className:"v10-attachment-chip-meta",children:[o.jsx("span",{children:BH(H.file.size)}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("span",{className:"v10-attachment-chip-status",children:pe})]})]}),o.jsx("button",{type:"button",className:"v10-attachment-chip-remove",onClick:()=>K(H.id),disabled:R,"aria-label":`Remove ${H.file.name}`,title:"Remove attachment",children:o.jsx(iM,{size:12,"aria-hidden":"true"})})]},H.id)})}),U&&o.jsx("div",{className:"v10-local-agent-copy",style:{margin:0,color:"var(--text-tertiary)"},children:Z.length>1?"Queued files keep their stored targets and may span multiple projects.":`Queued files keep their stored target (${hg(B,Z[0])}), not the active project.`}),o.jsx("input",{ref:G,type:"file",multiple:!0,style:{display:"none"},onChange:H=>{H.target.files&&(F(H.target.files),H.target.value="")}}),o.jsx("div",{className:"v10-local-agent-composer-row",children:o.jsxs("div",{className:"v10-local-agent-composer-shell",children:[o.jsx(tG,{placeholder:Oe?`Reconnect ${ye.name} to resume live chat...`:ye.chatReady?`Message ${ye.name}...`:ye.status==="connecting"?`${ye.name} is still connecting...`:`${ye.name} bridge offline...`,className:"v10-agent-input",value:N,onChange:H=>E(H.target.value),onKeyDown:H=>{if(!H.nativeEvent.isComposing){if(H.key==="Enter"&&!H.shiftKey&&!H.ctrlKey&&!H.metaKey){H.preventDefault(),xe&&T();return}if((H.ctrlKey||H.metaKey)&&H.key==="Enter"){H.preventDefault(),xe&&T();return}H.key==="Escape"&&N.length>0&&(H.preventDefault(),E(""))}},disabled:ut,minRows:1,maxRows:8}),o.jsxs("div",{className:"v10-composer-controls",children:[o.jsxs("div",{className:"v10-composer-controls-left",children:[o.jsx("button",{type:"button",className:"v10-composer-attach",onClick:()=>{var H;return(H=G.current)==null?void 0:H.click()},disabled:!Se,title:Se?"Attach files":We==="noProject"?"Choose a context graph to attach files":We==="sending"?"Wait for the current message to send":"This agent does not support attachments","aria-label":"Attach files",children:o.jsx(VO,{size:14,"aria-hidden":"true"})}),o.jsx("div",{className:"v10-composer-target",children:o.jsx(cS,{className:"v10-local-agent-target-select",value:L??"",onChange:_,options:[...L?[{value:"",label:"No context graph (clear selection)"}]:[],...z.map(H=>({value:H.id,label:H.name}))],placeholder:O?"Loading context graphs…":"Choose a context graph",disabled:O||!L&&z.length===0,ariaLabel:"Active project",prefixIcon:o.jsx($O,{size:12,"aria-hidden":"true"})})})]}),o.jsx("button",{type:"button",className:`v10-local-agent-inline-send v10-local-agent-inline-send-${D}`,onClick:D==="streaming"?$:T,disabled:D==="streaming"?!1:D==="uploading"?!0:!xe,"aria-label":D==="streaming"?"Stop reply":D==="uploading"?"Send message (attachments uploading)":"Send message",title:D==="streaming"?"Stop reply":D==="uploading"?"Send message (attachments uploading)…":"Send message",children:D==="streaming"?o.jsx(KO,{size:12,"aria-hidden":"true"}):D==="uploading"?o.jsx(FO,{className:"v10-local-agent-inline-send-spinner",size:14,"aria-hidden":"true"}):o.jsx(CO,{size:14,"aria-hidden":"true"})})]})]})})]})})]})]})}function Rm(e){return e.length>12?e.slice(-8):e}function pV(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 fV(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},v=m.hasDirect||g.transport==="direct",b=m.hasRelay||g.transport==="relayed",k=g.openedAt!=null?m.openedAt!=null?Math.min(m.openedAt,g.openedAt):g.openedAt:m.openedAt;r.set(g.peerId,{hasDirect:v,hasRelay:b,openedAt:k})}const s=g=>{var m;return(m=g.find(v=>v.name))==null?void 0:m.name},l=g=>g.reduce((m,v)=>v.lastSeen!=null&&(m==null||v.lastSeen>m)?v.lastSeen:m,void 0),c=[],d=new Set;for(const[g,m]of r){const v=n.get(g)??[];c.push({peerId:g,name:s(v),transport:m.hasDirect?"direct":"relayed",hasDirect:m.hasDirect,hasRelay:m.hasRelay,openedAt:m.openedAt,connected:!0,lastSeen:l(v),agents:v}),d.add(g)}for(const[g,m]of n){if(d.has(g))continue;const v=m.filter(C=>C.connectionStatus==="connected");if(v.length===0)continue;const b=v.some(C=>C.connectionTransport==="direct"),k=v.some(C=>C.connectionTransport==="relayed"),j=k&&!b?"relayed":"direct";c.push({peerId:g,name:s(m),transport:j,hasDirect:b,hasRelay:k,openedAt:null,connected:!0,lastSeen:l(m),agents:m}),d.add(g)}const f=[];for(const[g,m]of n){if(d.has(g))continue;const v=l(m);v!=null&&f.push({peerId:g,name:s(m),transport:"direct",hasDirect:!1,hasRelay:!1,openedAt:null,connected:!1,lastSeen:v,agents:m})}f.sort((g,m)=>(m.lastSeen??0)-(g.lastSeen??0));const h=c.filter(g=>g.transport==="direct").length;return{connected:c,recentlySeen:f,directCount:h,relayedCount:c.length-h}}function hV({peer:e}){var g;const[t,n]=w.useState(!1),r=w.useId(),s=3,l=e.connected?"connected":"offline",c=((g=e.name)==null?void 0:g.trim())||Rm(e.peerId),d=t?e.agents:e.agents.slice(0,s),f=e.connected?e.transport:"Disconnected",h=e.connected&&e.hasDirect&&e.hasRelay?"Direct + relay paths active — direct shown":void 0;return o.jsxs("div",{className:`v10-agent-card v10-peer-card ${l}`,children:[o.jsxs("div",{className:"v10-agent-card-header",children:[o.jsx("span",{className:`v10-agent-card-dot ${l}`}),o.jsx("span",{className:"v10-peer-card-name",children:c}),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:Rm(e.peerId)}),e.connected&&e.openedAt!=null&&o.jsxs("span",{children:["up ",Ik(Date.now()-e.openedAt)]}),!e.connected&&e.lastSeen!=null&&o.jsxs("span",{children:[Ik(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 ${c}`,children:[d.map((m,v)=>o.jsx("li",{className:"v10-peer-chip",title:m.agentUri||"",children:o.jsx("span",{className:"v10-peer-chip-label",children:pV(m.agentUri)||Rm(m.peerId)})},m.agentUri||`${e.peerId}:${v}`)),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 fS(e){const{label:t,peers:n,expanded:r,onToggle:s,emptyMessage:l}=e;return o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header",onClick:s,"aria-expanded":r,children:[o.jsx(Dm,{size:14,className:`v10-peer-group-chevron ${r?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:t}),o.jsx("span",{className:"v10-peer-group-count",children:n.length})]}),r&&o.jsx("div",{className:"v10-peer-group-body",children:n.length===0?o.jsx("div",{className:"v10-agent-empty-state",children:l}):n.map(c=>o.jsx(hV,{peer:c},c.peerId))})]})}function mV(e){const{peerAgents:t,connections:n,loading:r,onRefresh:s}=e,[l,c]=w.useState(!0),[d,f]=w.useState(!1),{connected:h,recentlySeen:g,directCount:m,relayedCount:v}=fV(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 / ",v," 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(fS,{label:"Connected",peers:h,expanded:l,onToggle:()=>c(b=>!b),emptyMessage:"No peers currently connected."}),o.jsx(fS,{label:"Recently seen",peers:g,expanded:d,onToggle:()=>f(b=>!b),emptyMessage:"No previously-seen peers."})]})]})}function gV(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?` - ${_d(r.lastTs)}`:""]})]},r.sessionId))]})})}function vV(){return Fd().data}function yV(){const{stage:e,advance:t}=Kg(),[n,r]=w.useState("agents"),[s,l]=w.useState([]),[c,d]=w.useState([]),[f,h]=w.useState({total:0,direct:0,relayed:0,rows:[]}),[g,m]=w.useState(!0),v=vV(),[b,k]=w.useState([]),[j,C]=w.useState("openclaw"),[S,N]=w.useState(()=>so("openclaw")),[E,T]=w.useState(null),[$,R]=w.useState(null),[L,B]=w.useState(null),[O,_]=w.useState(null),[I,F]=w.useState({}),[K,z]=w.useState({}),[q,V]=w.useState({}),[Z,Y]=w.useState({}),[W,D]=w.useState({}),U=w.useRef(new Map),G=w.useRef(!1),M=w.useRef(null),ee=w.useRef([]),ce=w.useRef({}),oe=w.useRef("openclaw"),be=w.useRef(so("openclaw")),Re=Ta(me=>me.contextGraphs),Ne=Ta(me=>me.loading),De=Ta(me=>me.activeProjectId),We=Ta(me=>me.setActiveProject),Se=w.useMemo(()=>x4(Re,v?Xg(v):null,De),[Re,v,De]),ft=dS(s,b),{selectedIntegration:Ie,selectedConversation:qe,selectedHasConversation:ke,selectedIntegrationHasAnyConversation:lt}=iV({integrations:b,selectedIntegrationId:j,selectedSessionId:S,localMessagesByConversation:I,sessions:ft}),ye=(qe==null?void 0:qe.stateKey)??null,Oe=ye?I[ye]??[]:[],Lt=ye?Z[ye]??!1:!1,$t=ye?K[ye]??"":"",Qt=ye?q[ye]??!1:!1,Gt=ye?W[ye]??[]:[],ut=w.useCallback(()=>{var me;(me=M.current)==null||me.scrollIntoView({behavior:"smooth"})},[]);w.useEffect(ut,[ye,Oe,ut]),w.useEffect(()=>{ee.current=s},[s]),w.useEffect(()=>{ce.current=I},[I]),w.useEffect(()=>{oe.current=j},[j]),w.useEffect(()=>{be.current=S},[S]);const xe=w.useCallback((me,Me)=>{F(ue=>({...ue,[me]:Me(ue[me]??[])}))},[]),X=w.useCallback((me,Me)=>{me&&z(ue=>({...ue,[me]:Me}))},[]),fe=w.useCallback((me,Me)=>{V(ue=>({...ue,[me]:Me}))},[]),H=w.useCallback((me,Me)=>{D(ue=>({...ue,[me]:Me(ue[me]??[])}))},[]),se=w.useCallback((me,Me,ue)=>{const je=Array.from(Me);if(je.length===0)return;const Ae=new Set((W[me]??[]).map(Qe=>`${Qe.contextGraphId}:${Qe.file.name}:${Qe.file.size}:${Qe.file.lastModified}`)),Ze=je.filter(Qe=>{const pt=`${ue}:${Qe.name}:${Qe.size}:${Qe.lastModified}`;return Ae.has(pt)?!1:(Ae.add(pt),!0)});if(Ze.length===0)return;const Ye=Ze.map(Qe=>({id:`${me}:${Qe.name}:${Qe.size}:${Qe.lastModified}:${crypto.randomUUID()}`,file:Qe,contextGraphId:ue,assertionName:`${Date.now().toString(36)}-${crypto.randomUUID().slice(0,8)}-${Qe.name.replace(/[^a-zA-Z0-9._-]/g,"_")}`,status:"queued"}));H(me,Qe=>[...Qe,...Ye])},[W,H]),pe=w.useCallback(async(me,Me)=>{const ue=[];for(const je of Me){if(je.status==="completed"||je.status==="skipped"){ue.push(je);continue}H(me,Ae=>Ae.map(Ze=>Ze.id===je.id?{...Ze,status:"uploading",error:void 0}:Ze));try{const Ae=await ZS(je.assertionName,je.contextGraphId,je.file),Ze=Ae.extraction.status==="completed"?"completed":Ae.extraction.status==="skipped"?"skipped":"error",Ye={...je,status:Ze,result:Ae,error:Ae.extraction.error};ue.push(Ye),H(me,Qe=>Qe.map(pt=>pt.id===je.id?Ye:pt))}catch(Ae){const Ze={...je,status:"error",error:(Ae==null?void 0:Ae.message)??"Upload failed"};ue.push(Ze),H(me,Ye=>Ye.map(Qe=>Qe.id===je.id?Ze:Qe))}}return ue},[H]),Le=w.useCallback((me,Me)=>{H(me,ue=>ue.filter(je=>je.id!==Me))},[H]),He=w.useCallback((me,Me)=>{const ue=new Set(Me);H(me,je=>je.filter(Ae=>!ue.has(Ae.id)))},[H]),Ce=w.useCallback((me,Me={})=>{C(me),me!==es&&(Me.preserveSession||N(Me.sessionId??so(me)))},[]),Fe=w.useCallback(()=>{_n.fetchMemorySessions(50).then(({sessions:me})=>l(me??[])).catch(()=>{})},[]),tt=w.useCallback(async()=>{try{const[me,Me]=await Promise.all([Ig().catch(()=>({agents:[]})),NR().catch(()=>({total:0,direct:0,relayed:0,connections:[]}))]),ue=(me.agents??[]).filter(je=>je.connectionStatus!=="self");d(ue),h({total:Me.total??0,direct:Me.direct??0,relayed:Me.relayed??0,rows:Array.isArray(Me.connections)?Me.connections:[]})}catch{}m(!1)},[]),Ee=w.useCallback(async()=>{try{const{integrations:me}=await Bd();k(me);const Me=dS(ee.current,me),ue=[...me].sort(rp).filter(pt=>pt.persistentChat),je=oe.current,Ae=be.current,Ze=me.find(pt=>pt.id===je)??null,Ye=lV({selectedIntegrationId:je,selectedItem:Ze,selectedSessionId:Ae,localMessagesByConversation:ce.current,sessionSummaries:Me});if(!Ye){const pt=ue[0];Ce((pt==null?void 0:pt.id)??es,{sessionId:(pt==null?void 0:pt.defaultSessionId)??null})}const Qe=ue[0];Qe&&!G.current&&je!==es?(G.current=!0,Ce(Qe.id,{sessionId:Qe.defaultSessionId}),r("agents")):!Qe&&!Ye&&(G.current=!1,Ce(es))}catch{}},[Ce]),Zt=w.useCallback(async(me,Me=null,ue=null)=>{const je=Dd({integrationId:me,sessionId:Me,defaultSessionId:ue});Y(Ae=>({...Ae,[je.stateKey]:!1}));try{const Ze=(await t1(me,100,{sessionId:je.sessionId??void 0})).map(Ye=>Pk(Ye,me));xe(je.stateKey,Ye=>jm(Ye,Ze))}catch{xe(je.stateKey,Ae=>Ae)}finally{Y(Ae=>({...Ae,[je.stateKey]:!0})),Fe()}},[Fe,xe]);w.useEffect(()=>{Fe(),tt(),Ee()},[Fe,tt,Ee]),w.useEffect(()=>{for(const me of QH)Zt(me,so(me))},[]);const _t=w.useCallback(()=>{Fe(),tt()},[Fe,tt]);rc(_t,15e3,{runImmediately:!1});const qa=b.some(me=>me.persistentChat&&(!me.chatReady||me.status==="connecting"))?3e3:15e3;w.useEffect(()=>{const me=setInterval(()=>{Ee()},qa);return()=>clearInterval(me)},[qa,Ee]),w.useEffect(()=>{if(!(Ie!=null&&Ie.chatSupported)||!Ie.persistentChat&&!ke){ye&&Y(Me=>({...Me,[ye]:!1}));return}let me=!1;return(async()=>await Zt(Ie.id,(qe==null?void 0:qe.sessionId)??null,Ie.defaultSessionId??null))(),()=>{me=!0}},[Zt,qe==null?void 0:qe.sessionId,ye,ke,Ie==null?void 0:Ie.defaultSessionId,Ie==null?void 0:Ie.chatSupported,Ie==null?void 0:Ie.id,Ie==null?void 0:Ie.persistentChat]);const ha=w.useCallback(async()=>{var pc,To;const me=Ie,Me=qe,ue=$t.trim(),je=Gt,Ae=je.some(KN);if(!(me!=null&&me.chatSupported)||!me.chatReady||Qt||!Me||!ue&&!Ae)return;const Ze=me.id,Ye=Me.stateKey;fe(Ye,!0),B(null);let Qe=null,pt="",gn="",Vt="",vn="",dr=[],pr=[],vs=[];try{pr=await pe(Ye,je);const wn=pr.map(wt=>GH(wt)).filter(wt=>wt!=null),Xn=VH(pr);if(!ue&&wn.length===0&&Xn.results.length===0)return;gn=crypto.randomUUID();const ga=QN(Xn.results),Ma=[ue,ga].filter(wt=>wt.length>0).join(`
|
|
1660
|
+
|
|
1661
|
+
`);Vt=ue?Ma:WH(wn,Xn.results);const kn=ue?Ma:"";dr=wn,vs=[...wn.map(wt=>wt.id).filter(wt=>typeof wt=="string"&&wt.length>0),...Xn.deliveredDraftIds];const Ot=`local:${Ye}:${gn}:user`;pt=`local:${Ye}:${gn}:assistant`;const qr=new Date,fr=_d(qr),Va=fg(qr);xe(Ye,wt=>[...wt,{id:Ot,turnId:gn,role:"user",content:Vt,ts:fr,tsRaw:Va,attachments:wn},{id:pt,turnId:gn,role:"assistant",content:"",ts:fr,tsRaw:Va,streaming:!0}]),X(Ye,""),vs.length>0&&He(Ye,vs),Qe=new AbortController,U.current.set(Ye,Qe);const Gr=[...ZH(Re,De,v)],ip=me.id==="prime-agent"?(pc=me.liveSessions)==null?void 0:pc.find(wt=>wt.sessionId===Me.sessionId):void 0,Vr=await b_(Ze,kn,{correlationId:gn,signal:Qe==null?void 0:Qe.signal,sessionId:Me.sessionId??void 0,liveSession:ip,profile:me.profile,persistUserMessage:kn?void 0:Vt,attachments:wn,attachmentImportResults:Xn.results,contextEntries:Gr,contextGraphId:De??void 0,onEvent:wt=>{wt.type==="text_delta"&&(vn+=wt.delta,xe(Ye,Xt=>Xt.map(Sn=>Sn.id===pt?{...Sn,content:Sn.content+wt.delta}:Sn)))}}),Ro=new Date;xe(Ye,wt=>Uk(wt,gn,Vr.turnId).map(Xt=>{var Sn;return Xt.id===pt?{...Xt,content:Vr.text||Xt.content,turnId:((Sn=Vr.turnId)==null?void 0:Sn.trim())||Xt.turnId,streaming:!1,synthesized:!Vr.text&&!Xt.content?!0:Xt.synthesized,ts:_d(Ro),tsRaw:fg(Ro)}:Xt}));const ys=Ze==="prime-agent"?(To=Vr.sessionId)==null?void 0:To.trim():void 0;if(ys&&ys!==Me.sessionId&&oe.current===Ze&&be.current===Me.sessionId){const wt=Wv(Ze,ys);F(Xt=>({...Xt,[wt]:jm(Xt[wt]??[],Xt[Ye]??[])})),Y(Xt=>({...Xt,[wt]:Xt[Ye]??!0})),Ce(Ze,{sessionId:ys}),R(`${me.name} restarted; switched chat to the live session.`)}Fe(),e===0&&t()}catch(wn){const Xn=(wn==null?void 0:wn.name)==="AbortError",ga=Xn?"Request cancelled.":XH(me,wn),Ma=Xn?ga:`Error: ${ga}`;if(pt){const kn=Iq(vn,Ma);xe(Ye,Un=>Un.map(Ot=>Ot.id===pt?{...Ot,...kn,streaming:!1}:Ot))}!Xn&&Ze==="hermes"&&pt&&Vt&&(async()=>{try{const kn=await y_(Ze,{sessionId:Me.sessionId??void 0,correlationId:gn||void 0,userMessage:Vt,assistantReply:vn,failureReason:ga,profile:me.profile,attachments:dr,contextGraphId:De??void 0});kn.turnId&&xe(Ye,Un=>Uk(Un,gn,kn.turnId)),Fe()}catch{}})(),vs.length>0&&pr.length>0&&D(kn=>{const Un=kn[Ye]??[],Ot=new Set(Un.map(fr=>fr.id)),qr=pr.filter(fr=>!Ot.has(fr.id));return qr.length===0?kn:{...kn,[Ye]:[...qr,...Un]}}),Ee()}finally{fe(Ye,!1),U.current.get(Ye)===Qe&&U.current.delete(Ye)}},[De,t,Re,v,Fe,$t,Qt,pe,Gt,Ee,qe,Ie,He,X,fe,Ce,e,xe]),Br=w.useCallback(()=>{if(!ye)return;const me=U.current.get(ye);me==null||me.abort()},[ye]),Fr=w.useCallback(async me=>{T(me),B(null),R(null);try{const Me=await h_(me);k(Ae=>sd(Ae,Me.integration)),await Ee();const ue=sd(b,Me.integration),je=aV({integrationId:me,selectedSessionId:S,integrations:ue});Ce(me,{preserveSession:je,sessionId:Me.integration.defaultSessionId}),G.current=!0,R(Me.notice??(Me.integration.chatReady?`${Me.integration.name} is connected and chat-ready.`:`${Me.integration.name} attach is in progress. The node will keep checking for a live bridge.`)),r("agents")}catch(Me){await Ee(),B(Me.message)}finally{T(null)}},[b,Ee,S,Ce]),ma=w.useCallback(async me=>{B(null),R(null);try{await m_(me),k(Me=>oV(Me,me)),G.current=!1,Ce(me,{preserveSession:j===me}),R("The local agent was disconnected from this node. Session history remains available here."),r("agents"),await Ee()}catch(Me){B(Me.message)}},[Ee,j,Ce]),Ga=w.useCallback(async me=>{var Ae,Ze,Ye;if(O===me)return;_(me),B(null),R(null);const Me=Dd({integrationId:me,sessionId:j===me?be.current:null,defaultSessionId:(Ae=b.find(Qe=>Qe.id===me))==null?void 0:Ae.defaultSessionId}),[ue,je]=await Promise.allSettled([g_(me),t1(me,100,{sessionId:Me.sessionId??void 0})]);try{if(ue.status==="fulfilled"?(k(Qe=>sd(Qe,ue.value.integration)),ue.value.notice&&R(ue.value.notice)):B(((Ze=ue.reason)==null?void 0:Ze.message)??"Failed to refresh integration."),je.status==="fulfilled"){const Qe=je.value.map(pt=>Pk(pt,me));xe(Me.stateKey,pt=>jm(pt,Qe)),Y(pt=>({...pt,[Me.stateKey]:!0}))}else ue.status==="fulfilled"&&B(((Ye=je.reason)==null?void 0:Ye.message)??"Failed to refresh conversation.")}finally{_(null)}},[b,O,j,xe]),ur=w.useCallback(me=>{Ce(me.integrationId,{sessionId:me.sessionId}),r("agents")},[Ce]),dc=w.useCallback(me=>{We(me||null)},[We]),Hr=w.useCallback(me=>{!ye||!De||se(ye,me,De)},[De,se,ye]),Ei=w.useCallback(me=>{ye&&Le(ye,me)},[Le,ye]);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(dV,{integrations:b,selectedIntegrationId:j,selectedIntegration:Ie,selectedSessionId:S,selectedHasConversation:ke,selectedIntegrationHasAnyConversation:lt,onSelectIntegration:Ce,onConnectIntegration:Fr,onDisconnectIntegration:ma,onRefreshIntegration:Ga,connectBusyId:E,refreshBusyId:O,connectNotice:$,connectError:L,localMessages:Oe,localHistoryLoaded:Lt,localChatEndRef:M,localInput:$t,onLocalInputChange:me=>X(ye,me),onSendLocalMessage:ha,onStopLocalStream:Br,localSending:Qt,activeProjectId:De,availableProjects:Re,selectableProjects:Se,projectsLoading:Ne,onSelectProject:dc,attachments:Gt,onAddAttachments:Hr,onRemoveAttachment:Ei}),n==="network"&&o.jsx(mV,{peerAgents:c,connections:f,loading:g,onRefresh:tt}),n==="sessions"&&o.jsx(gV,{sessions:ft,onOpenSession:ur})]})}function bV(e,t=document){const n=e==="light";t.documentElement.setAttribute("data-theme",e),t.documentElement.classList.toggle("light",n),t.body.classList.toggle("light",n)}function xV(){const{toggleLeft:e,toggleRight:t,toggleBottom:n}=Kn();w.useEffect(()=>{const r=s=>{if(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement||!(s.metaKey||s.ctrlKey))return;const c=s.key.toLowerCase();if(s.shiftKey&&c==="b"){s.preventDefault(),t();return}if(!s.shiftKey){if(c==="b"){s.preventDefault(),e();return}if(c==="j"){s.preventDefault(),n();return}}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,t,n])}const hS={"/observability":{id:"operations",label:"Observability"},"/operations":{id:"operations",label:"Observability"},"/settings":{id:"settings",label:"Settings"}},wV={operations:"/observability",settings:"/settings",dashboard:"/"};function kV(){const{pathname:e}=Ha(),t=Cg(),n=hn(s=>s.openTab),r=hn(s=>s.activeTabId);w.useEffect(()=>{const s=hS[e];s&&n({id:s.id,label:s.label,closable:!0})},[e,n]),w.useEffect(()=>{const s=wV[r];if(s){s!==e&&t(s,{replace:!0});return}hS[e]&&t("/",{replace:!0})},[r,e,t])}function SV(){const[e,t]=w.useState(z_());return w.useEffect(()=>$_(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 jV(){const e=Og(t=>t.setNodeStatus);rc(()=>{_n.fetchStatus().then(e).catch(()=>{})},1e4)}function mS(e){const t=w.useRef(null),n=w.useRef(e);return n.current=e,w.useEffect(()=>{const r=t.current;if(!r)return;let s=0;const l=f=>{const h=f.clientX-s;s=f.clientX,n.current(h)},c=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c),document.body.style.cursor="",document.body.style.userSelect="",r.classList.remove("active")},d=f=>{f.preventDefault(),s=f.clientX,document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),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 CV(e){const t=w.useRef(e);t.current=e;const[n,r]=w.useState(null);return w.useEffect(()=>{if(!n)return;let s=0;const l=f=>{const h=f.clientY-s;s=f.clientY,t.current(h)},c=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c),document.body.style.cursor="",document.body.style.userSelect="",n.classList.remove("active")},d=f=>{f.preventDefault(),s=f.clientY,document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),document.body.style.cursor="row-resize",document.body.style.userSelect="none",n.classList.add("active")};return n.addEventListener("mousedown",d),()=>{n.removeEventListener("mousedown",d),c()}},[n]),w.useCallback(s=>r(s),[])}function NV(){jV(),xV(),kV();const{leftCollapsed:e,rightCollapsed:t,bottomCollapsed:n,theme:r,leftWidth:s,rightWidth:l,setLeftWidth:c,setRightWidth:d,setBottomHeight:f}=Kn(),[,h]=w.useState(0);w.useEffect(()=>{bV(r)},[r]),w.useEffect(()=>{const C=()=>h(S=>S+1);return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]),w.useLayoutEffect(()=>{const C=window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("resize"))});return()=>window.cancelAnimationFrame(C)},[e,t]);const g=w.useCallback(C=>{const S=Kn.getState().leftWidth;c(Math.max(140,Math.min(400,S+C)))},[c]),m=w.useCallback(C=>{const S=Kn.getState().rightWidth;d(Math.max(200,Math.min(500,S-C)))},[d]),v=w.useCallback(C=>{const S=Math.min(Kn.getState().bottomHeight,ud());f(Math.min(S-C,ud()))},[f]),b=mS(g),k=mS(m),j=CV(v);return o.jsxs("div",{className:"v10-app",children:[o.jsx(SV,{}),o.jsx(FM,{}),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(L4,{})}),o.jsx("div",{className:"v10-resize-handle-h",ref:b})]}),o.jsxs("div",{className:"v10-center-region",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[o.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden"},children:o.jsx(EH,{})}),!n&&o.jsx("div",{className:"v10-resize-handle-v",ref:j}),o.jsx(UH,{})]}),!t&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-resize-handle-h",ref:k}),o.jsx("div",{className:"v10-panel-right",style:{width:l},children:o.jsx(yV,{})})]})]})]})}const EV=Ve.lazy(()=>gt(()=>import("./Network-B3jCYzr5.js"),[]).then(e=>({default:e.NetworkPage})));function AV(){const e=hn(t=>t.openTab);return w.useLayoutEffect(()=>{e(Uj)},[e]),o.jsx(Ml,{to:"/",replace:!0})}function TV(){return o.jsxs(_2,{children:[o.jsx(yi,{path:"/network",element:o.jsx(Ve.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading..."}),children:o.jsx(EV,{})})}),o.jsx(yi,{path:"/context-graph-primer",element:o.jsx(AV,{})}),o.jsx(yi,{path:"/agent",element:o.jsx(Ml,{to:"/",replace:!0})}),o.jsx(yi,{path:"/explorer",element:o.jsx(Ml,{to:"/",replace:!0})}),o.jsx(yi,{path:"/messages",element:o.jsx(Ml,{to:"/",replace:!0})}),o.jsx(yi,{path:"/apps/*",element:o.jsx(Ml,{to:"/",replace:!0})}),o.jsx(yi,{path:"*",element:o.jsx(NV,{})})]})}MT.createRoot(document.getElementById("root")).render(o.jsx(Ve.StrictMode,{children:o.jsx(tR,{basename:"/ui",children:o.jsx(TV,{})})}));export{lW as $,CD as A,rW as B,TO as C,tW as D,cn as E,nW as F,JV as G,Pn as H,XV as I,eW as J,qV as K,LS as L,Dg as M,aW as N,VV as O,yV as P,qg as Q,Ve as R,Zd as S,KP as T,dW as U,A1 as V,aM as W,xL as X,wL as Y,sM as Z,gt as _,as as a,D4 as a0,oM as a1,OV as a2,Jl as a3,oO as a4,cO as a5,XP as a6,nj as a7,BV as a8,FV as a9,XL as aA,ds as aB,Og as aC,II as aD,da as aE,nv as aF,ts as aG,ij as aH,sj as aI,Gl as aJ,VL as aK,Pr as aL,Ta as aM,hn as aN,uW as aO,FP as aP,uO as aa,oW as ab,cW as ac,o as ad,UV as ae,$V as af,jR as ag,pW as ah,lj as ai,zm as aj,LV as ak,SR as al,DV as am,zV as an,aO as ao,IV as ap,w as aq,T1 as ar,iW as as,zP as at,JP as au,Ev as av,sW as aw,eo as ax,GV as ay,WV as az,zj as b,_O as c,LO as d,FO as e,Dj as f,Tt as g,Ht as h,Ak as i,Lm as j,_V as k,un as l,MV as m,HV as n,s1 as o,Ig as p,NR as q,YV as r,QV as s,TR as t,ZV as u,PV as v,_R as w,KV as x,RR as y,dd as z};
|