@volter/world-console 3.0.23 → 3.0.25
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/client/console.tsx +79 -5
- package/dist/client/console.bundle.js +12 -12
- package/dist/client/console.tsx +79 -5
- package/dist/client/main.bundle.js +89 -89
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var tQ=Object.create;var{getPrototypeOf:oQ,defineProperty:m8,getOwnPropertyNames:nQ}=Object;var eQ=Object.prototype.hasOwnProperty;function _J(_){return this[_]}var QJ,JJ,J0=(_,Q,J)=>{var q=_!=null&&typeof _==="object";if(q){var U=Q?QJ??=new WeakMap:JJ??=new WeakMap,G=U.get(_);if(G)return G}J=_!=null?tQ(oQ(_)):{};let Z=Q||!_||!_.__esModule?m8(J,"default",{value:_,enumerable:!0}):J;for(let F of nQ(_))if(!eQ.call(Z,F))m8(Z,F,{get:_J.bind(_,F),enumerable:!0});if(q)U.set(_,Z);return Z};var M2=(_,Q)=>()=>(Q||_((Q={exports:{}}).exports,Q),Q.exports);var D0=M2(($J,X4)=>{(function(){function _(T,g){Object.defineProperty(q.prototype,T,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",g[0],g[1])}})}function Q(T){if(T===null||typeof T!=="object")return null;return T=J1&&T[J1]||T["@@iterator"],typeof T==="function"?T:null}function J(T,g){T=(T=T.constructor)&&(T.displayName||T.name)||"ReactClass";var _1=T+"."+g;U1[_1]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",g,T),U1[_1]=!0)}function q(T,g,_1){this.props=T,this.context=g,this.refs=Y1,this.updater=_1||F1}function U(){}function G(T,g,_1){this.props=T,this.context=g,this.refs=Y1,this.updater=_1||F1}function Z(){}function F(T){return""+T}function X(T){try{F(T);var g=!1}catch(L1){g=!0}if(g){g=console;var _1=g.error,$1=typeof Symbol==="function"&&Symbol.toStringTag&&T[Symbol.toStringTag]||T.constructor.name||"Object";return _1.call(g,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",$1),F(T)}}function Y(T){if(T==null)return null;if(typeof T==="function")return T.$$typeof===T1?null:T.displayName||T.name||null;if(typeof T==="string")return T;switch(T){case D:return"Fragment";case u:return"Profiler";case P:return"StrictMode";case Q1:return"Suspense";case s:return"SuspenseList";case e:return"Activity"}if(typeof T==="object")switch(typeof T.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),T.$$typeof){case V:return"Portal";case h:return T.displayName||"Context";case m:return(T._context.displayName||"Context")+".Consumer";case t:var g=T.render;return T=T.displayName,T||(T=g.displayName||g.name||"",T=T!==""?"ForwardRef("+T+")":"ForwardRef"),T;case o:return g=T.displayName||null,g!==null?g:Y(T.type)||"Memo";case l:g=T._payload,T=T._init;try{return Y(T(g))}catch(_1){}}return null}function K(T){if(T===D)return"<>";if(typeof T==="object"&&T!==null&&T.$$typeof===l)return"<...>";try{var g=Y(T);return g?"<"+g+">":"<...>"}catch(_1){return"<...>"}}function H(){var T=Z1.A;return T===null?null:T.getOwner()}function L(){return Error("react-stack-top-frame")}function z(T){if(k1.call(T,"key")){var g=Object.getOwnPropertyDescriptor(T,"key").get;if(g&&g.isReactWarning)return!1}return T.key!==void 0}function W(T,g){function _1(){_0||(_0=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",g))}_1.isReactWarning=!0,Object.defineProperty(T,"key",{get:_1,configurable:!0})}function I(){var T=Y(this.type);return I0[T]||(I0[T]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),T=this.props.ref,T!==void 0?T:null}function M(T,g,_1,$1,L1,w1){var P1=_1.ref;return T={$$typeof:x,type:T,key:g,props:_1,_owner:$1},(P1!==void 0?P1:null)!==null?Object.defineProperty(T,"ref",{enumerable:!1,get:I}):Object.defineProperty(T,"ref",{enumerable:!1,value:null}),T._store={},Object.defineProperty(T._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(T,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(T,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:L1}),Object.defineProperty(T,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:w1}),Object.freeze&&(Object.freeze(T.props),Object.freeze(T)),T}function B(T,g){return g=M(T.type,g,T.props,T._owner,T._debugStack,T._debugTask),T._store&&(g._store.validated=T._store.validated),g}function N(T){A(T)?T._store&&(T._store.validated=1):typeof T==="object"&&T!==null&&T.$$typeof===l&&(T._payload.status==="fulfilled"?A(T._payload.value)&&T._payload.value._store&&(T._payload.value._store.validated=1):T._store&&(T._store.validated=1))}function A(T){return typeof T==="object"&&T!==null&&T.$$typeof===x}function R(T){var g={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(_1){return g[_1]})}function O(T,g){return typeof T==="object"&&T!==null&&T.key!=null?(X(T.key),R(""+T.key)):g.toString(36)}function C(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status==="string"?T.then(Z,Z):(T.status="pending",T.then(function(g){T.status==="pending"&&(T.status="fulfilled",T.value=g)},function(g){T.status==="pending"&&(T.status="rejected",T.reason=g)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function f(T,g,_1,$1,L1){var w1=typeof T;if(w1==="undefined"||w1==="boolean")T=null;var P1=!1;if(T===null)P1=!0;else switch(w1){case"bigint":case"string":case"number":P1=!0;break;case"object":switch(T.$$typeof){case x:case V:P1=!0;break;case l:return P1=T._init,f(P1(T._payload),g,_1,$1,L1)}}if(P1){P1=T,L1=L1(P1);var u1=$1===""?"."+O(P1,0):$1;return n(L1)?(_1="",u1!=null&&(_1=u1.replace(Y0,"$&/")+"/"),f(L1,g,_1,"",function(M0){return M0})):L1!=null&&(A(L1)&&(L1.key!=null&&(P1&&P1.key===L1.key||X(L1.key)),_1=B(L1,_1+(L1.key==null||P1&&P1.key===L1.key?"":(""+L1.key).replace(Y0,"$&/")+"/")+u1),$1!==""&&P1!=null&&A(P1)&&P1.key==null&&P1._store&&!P1._store.validated&&(_1._store.validated=2),L1=_1),g.push(L1)),1}if(P1=0,u1=$1===""?".":$1+":",n(T))for(var f1=0;f1<T.length;f1++)$1=T[f1],w1=u1+O($1,f1),P1+=f($1,g,_1,w1,L1);else if(f1=Q(T),typeof f1==="function")for(f1===T.entries&&(x1||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),x1=!0),T=f1.call(T),f1=0;!($1=T.next()).done;)$1=$1.value,w1=u1+O($1,f1++),P1+=f($1,g,_1,w1,L1);else if(w1==="object"){if(typeof T.then==="function")return f(C(T),g,_1,$1,L1);throw g=String(T),Error("Objects are not valid as a React child (found: "+(g==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":g)+"). If you meant to render a collection of children, use an array instead.")}return P1}function S(T,g,_1){if(T==null)return T;var $1=[],L1=0;return f(T,$1,"","",function(w1){return g.call(_1,w1,L1++)}),$1}function w(T){if(T._status===-1){var g=T._ioInfo;g!=null&&(g.start=g.end=performance.now()),g=T._result;var _1=g();if(_1.then(function(L1){if(T._status===0||T._status===-1){T._status=1,T._result=L1;var w1=T._ioInfo;w1!=null&&(w1.end=performance.now()),_1.status===void 0&&(_1.status="fulfilled",_1.value=L1)}},function(L1){if(T._status===0||T._status===-1){T._status=2,T._result=L1;var w1=T._ioInfo;w1!=null&&(w1.end=performance.now()),_1.status===void 0&&(_1.status="rejected",_1.reason=L1)}}),g=T._ioInfo,g!=null){g.value=_1;var $1=_1.displayName;typeof $1==="string"&&(g.name=$1)}T._status===-1&&(T._status=0,T._result=_1)}if(T._status===1)return g=T._result,g===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
2
2
|
|
|
3
3
|
Your code should look like:
|
|
4
4
|
const MyComponent = lazy(() => import('./MyComponent'))
|
|
@@ -6,32 +6,32 @@ Your code should look like:
|
|
|
6
6
|
Did you accidentally put curly braces around the import?`,g),"default"in g||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
7
7
|
|
|
8
8
|
Your code should look like:
|
|
9
|
-
const MyComponent = lazy(() => import('./MyComponent'))`,g),g.default;throw
|
|
9
|
+
const MyComponent = lazy(() => import('./MyComponent'))`,g),g.default;throw T._result}function k(){var T=Z1.H;return T===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
10
10
|
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
11
11
|
2. You might be breaking the Rules of Hooks
|
|
12
12
|
3. You might have more than one copy of React in the same app
|
|
13
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),M}function E(){K1.asyncTransitions--}function l(M){if(w0===null)try{var g=("require"+Math.random()).slice(0,7);w0=(J4&&J4[g]).call(J4,"timers").setImmediate}catch(Q1){w0=function($1){r0===!1&&(r0=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var Y1=new MessageChannel;Y1.port1.onmessage=$1,Y1.port2.postMessage(void 0)}}return w0(M)}function c(M){return 1<M.length&&typeof AggregateError==="function"?AggregateError(M):M[0]}function y(M,g){g!==i0-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),i0=g}function D(M,g,Q1){var $1=K1.actQueue;if($1!==null)if($1.length!==0)try{v($1),l(function(){return D(M,g,Q1)});return}catch(Y1){K1.thrownErrors.push(Y1)}else K1.actQueue=null;0<K1.thrownErrors.length?($1=c(K1.thrownErrors),K1.thrownErrors.length=0,Q1($1)):g(M)}function v(M){if(!G2){G2=!0;var g=0;try{for(;g<M.length;g++){var Q1=M[g];do{K1.didUsePromise=!1;var $1=Q1(!1);if($1!==null){if(K1.didUsePromise){M[g]=Q1,M.splice(0,g);return}Q1=$1}else break}while(1)}M.length=0}catch(Y1){M.splice(0,g+1),K1.thrownErrors.push(Y1)}finally{G2=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var x=Symbol.for("react.transitional.element"),V=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),h=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),e=Symbol.for("react.suspense"),s=Symbol.for("react.suspense_list"),t=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),n=Symbol.for("react.activity"),J1=Symbol.iterator,q1={},F1={isMounted:function(){return!1},enqueueForceUpdate:function(M){J(M,"forceUpdate")},enqueueReplaceState:function(M){J(M,"replaceState")},enqueueSetState:function(M){J(M,"setState")}},Z1=Object.assign,T1={};Object.freeze(T1),q.prototype.isReactComponent={},q.prototype.setState=function(M,g){if(typeof M!=="object"&&typeof M!=="function"&&M!=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,M,g,"setState")},q.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};var L1={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(V0 in L1)L1.hasOwnProperty(V0)&&_(V0,L1[V0]);U.prototype=q.prototype,L1=G.prototype=new U,L1.constructor=G,Z1(L1,q.prototype),L1.isPureReactComponent=!0;var _1=Array.isArray,W1=Symbol.for("react.client.reference"),K1={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},p1=Object.prototype.hasOwnProperty,s1=console.createTask?console.createTask:function(){return null};L1={react_stack_bottom_frame:function(M){return M()}};var a1,j0,K0={},T0=L1.react_stack_bottom_frame.bind(L1,L)(),Q0=s1(K(L)),e1=!1,F0=/\/+/g,W0=typeof reportError==="function"?reportError:function(M){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var g=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M==="object"&&M!==null&&typeof M.message==="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(g))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",M);return}console.error(M)},r0=!1,w0=null,i0=0,f0=!1,G2=!1,l2=typeof queueMicrotask==="function"?function(M){queueMicrotask(function(){return queueMicrotask(M)})}:l;L1=Object.freeze({__proto__:null,c:function(M){return k().useMemoCache(M)}});var V0={map:S,forEach:function(M,g,Q1){S(M,function(){g.apply(this,arguments)},Q1)},count:function(M){var g=0;return S(M,function(){g++}),g},toArray:function(M){return S(M,function(g){return g})||[]},only:function(M){if(!B(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};JJ.Activity=n,JJ.Children=V0,JJ.Component=q,JJ.Fragment=b,JJ.Profiler=j,JJ.PureComponent=G,JJ.StrictMode=P,JJ.Suspense=e,JJ.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=K1,JJ.__COMPILER_RUNTIME=L1,JJ.act=function(M){var g=K1.actQueue,Q1=i0;i0++;var $1=K1.actQueue=g!==null?g:[],Y1=!1;try{var P1=M()}catch(N1){K1.thrownErrors.push(N1)}if(0<K1.thrownErrors.length)throw y(g,Q1),M=c(K1.thrownErrors),K1.thrownErrors.length=0,M;if(P1!==null&&typeof P1==="object"&&typeof P1.then==="function"){var O1=P1;return l2(function(){Y1||f0||(f0=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(N1,Y0){Y1=!0,O1.then(function(u0){if(y(g,Q1),Q1===0){try{v($1),l(function(){return D(u0,N1,Y0)})}catch(r2){K1.thrownErrors.push(r2)}if(0<K1.thrownErrors.length){var B2=c(K1.thrownErrors);K1.thrownErrors.length=0,Y0(B2)}}else N1(u0)},function(u0){y(g,Q1),0<K1.thrownErrors.length?(u0=c(K1.thrownErrors),K1.thrownErrors.length=0,Y0(u0)):Y0(u0)})}}}var v1=P1;if(y(g,Q1),Q1===0&&(v($1),$1.length!==0&&l2(function(){Y1||f0||(f0=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),K1.actQueue=null),0<K1.thrownErrors.length)throw M=c(K1.thrownErrors),K1.thrownErrors.length=0,M;return{then:function(N1,Y0){Y1=!0,Q1===0?(K1.actQueue=$1,l(function(){return D(v1,N1,Y0)})):N1(v1)}}},JJ.cache=function(M){return function(){return M.apply(null,arguments)}},JJ.cacheSignal=function(){return null},JJ.captureOwnerStack=function(){var M=K1.getCurrentStack;return M===null?null:M()},JJ.cloneElement=function(M,g,Q1){if(M===null||M===void 0)throw Error("The argument must be a React element, but you passed "+M+".");var $1=Z1({},M.props),Y1=M.key,P1=M._owner;if(g!=null){var O1;_:{if(p1.call(g,"ref")&&(O1=Object.getOwnPropertyDescriptor(g,"ref").get)&&O1.isReactWarning){O1=!1;break _}O1=g.ref!==void 0}O1&&(P1=H()),z(g)&&(X(g.key),Y1=""+g.key);for(v1 in g)!p1.call(g,v1)||v1==="key"||v1==="__self"||v1==="__source"||v1==="ref"&&g.ref===void 0||($1[v1]=g[v1])}var v1=arguments.length-2;if(v1===1)$1.children=Q1;else if(1<v1){O1=Array(v1);for(var N1=0;N1<v1;N1++)O1[N1]=arguments[N1+2];$1.children=O1}$1=R(M.type,Y1,$1,P1,M._debugStack,M._debugTask);for(Y1=2;Y1<arguments.length;Y1++)N(arguments[Y1]);return $1},JJ.createContext=function(M){return M={$$typeof:h,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:m,_context:M},M._currentRenderer=null,M._currentRenderer2=null,M},JJ.createElement=function(M,g,Q1){for(var $1=2;$1<arguments.length;$1++)N(arguments[$1]);$1={};var Y1=null;if(g!=null)for(N1 in j0||!("__self"in g)||"key"in g||(j0=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),z(g)&&(X(g.key),Y1=""+g.key),g)p1.call(g,N1)&&N1!=="key"&&N1!=="__self"&&N1!=="__source"&&($1[N1]=g[N1]);var P1=arguments.length-2;if(P1===1)$1.children=Q1;else if(1<P1){for(var O1=Array(P1),v1=0;v1<P1;v1++)O1[v1]=arguments[v1+2];Object.freeze&&Object.freeze(O1),$1.children=O1}if(M&&M.defaultProps)for(N1 in P1=M.defaultProps,P1)$1[N1]===void 0&&($1[N1]=P1[N1]);Y1&&W($1,typeof M==="function"?M.displayName||M.name||"Unknown":M);var N1=1e4>K1.recentlyCreatedOwnerStacks++;return R(M,Y1,$1,H(),N1?Error("react-stack-top-frame"):T0,N1?s1(K(M)):Q0)},JJ.createRef=function(){var M={current:null};return Object.seal(M),M},JJ.forwardRef=function(M){M!=null&&M.$$typeof===t?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof M!=="function"?console.error("forwardRef requires a render function but was given %s.",M===null?"null":typeof M):M.length!==0&&M.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",M.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),M!=null&&M.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var g={$$typeof:o,render:M},Q1;return Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return Q1},set:function($1){Q1=$1,M.name||M.displayName||(Object.defineProperty(M,"name",{value:$1}),M.displayName=$1)}}),g},JJ.isValidElement=B,JJ.lazy=function(M){M={_status:-1,_result:M};var g={$$typeof:p,_payload:M,_init:w},Q1={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return M._ioInfo=Q1,g._debugInfo=[{awaited:Q1}],g},JJ.memo=function(M,g){M==null&&console.error("memo: The first argument must be a component. Instead received: %s",M===null?"null":typeof M),g={$$typeof:t,type:M,compare:g===void 0?null:g};var Q1;return Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return Q1},set:function($1){Q1=$1,M.name||M.displayName||(Object.defineProperty(M,"name",{value:$1}),M.displayName=$1)}}),g},JJ.startTransition=function(M){var g=K1.T,Q1={};Q1._updatedFibers=new Set,K1.T=Q1;try{var $1=M(),Y1=K1.S;Y1!==null&&Y1(Q1,$1),typeof $1==="object"&&$1!==null&&typeof $1.then==="function"&&(K1.asyncTransitions++,$1.then(E,E),$1.then(Z,W0))}catch(P1){W0(P1)}finally{g===null&&Q1._updatedFibers&&(M=Q1._updatedFibers.size,Q1._updatedFibers.clear(),10<M&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),g!==null&&Q1.types!==null&&(g.types!==null&&g.types!==Q1.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),g.types=Q1.types),K1.T=g}},JJ.unstable_useCacheRefresh=function(){return k().useCacheRefresh()},JJ.use=function(M){return k().use(M)},JJ.useActionState=function(M,g,Q1){return k().useActionState(M,g,Q1)},JJ.useCallback=function(M,g){return k().useCallback(M,g)},JJ.useContext=function(M){var g=k();return M.$$typeof===m&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),g.useContext(M)},JJ.useDebugValue=function(M,g){return k().useDebugValue(M,g)},JJ.useDeferredValue=function(M,g){return k().useDeferredValue(M,g)},JJ.useEffect=function(M,g){return M==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useEffect(M,g)},JJ.useEffectEvent=function(M){return k().useEffectEvent(M)},JJ.useId=function(){return k().useId()},JJ.useImperativeHandle=function(M,g,Q1){return k().useImperativeHandle(M,g,Q1)},JJ.useInsertionEffect=function(M,g){return M==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useInsertionEffect(M,g)},JJ.useLayoutEffect=function(M,g){return M==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useLayoutEffect(M,g)},JJ.useMemo=function(M,g){return k().useMemo(M,g)},JJ.useOptimistic=function(M,g){return k().useOptimistic(M,g)},JJ.useReducer=function(M,g,Q1){return k().useReducer(M,g,Q1)},JJ.useRef=function(M){return k().useRef(M)},JJ.useState=function(M){return k().useState(M)},JJ.useSyncExternalStore=function(M,g,Q1){return k().useSyncExternalStore(M,g,Q1)},JJ.useTransition=function(){return k().useTransition()},JJ.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var j8=M2(($J)=>{var T2=J0(h0());(function(){function _(P){if(P==null)return null;if(typeof P==="function")return P.$$typeof===k?null:P.displayName||P.name||null;if(typeof P==="string")return P;switch(P){case I:return"Fragment";case A:return"Profiler";case R:return"StrictMode";case O:return"Suspense";case C:return"SuspenseList";case w:return"Activity"}if(typeof P==="object")switch(typeof P.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),P.$$typeof){case W:return"Portal";case B:return P.displayName||"Context";case N:return(P._context.displayName||"Context")+".Consumer";case T:var j=P.render;return P=P.displayName,P||(P=j.displayName||j.name||"",P=P!==""?"ForwardRef("+P+")":"ForwardRef"),P;case f:return j=P.displayName||null,j!==null?j:_(P.type)||"Memo";case S:j=P._payload,P=P._init;try{return _(P(j))}catch(m){}}return null}function Q(P){return""+P}function J(P){try{Q(P);var j=!1}catch(o){j=!0}if(j){j=console;var m=j.error,h=typeof Symbol==="function"&&Symbol.toStringTag&&P[Symbol.toStringTag]||P.constructor.name||"Object";return m.call(j,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",h),Q(P)}}function q(P){if(P===I)return"<>";if(typeof P==="object"&&P!==null&&P.$$typeof===S)return"<...>";try{var j=_(P);return j?"<"+j+">":"<...>"}catch(m){return"<...>"}}function U(){var P=E.A;return P===null?null:P.getOwner()}function G(){return Error("react-stack-top-frame")}function Z(P){if(l.call(P,"key")){var j=Object.getOwnPropertyDescriptor(P,"key").get;if(j&&j.isReactWarning)return!1}return P.key!==void 0}function F(P,j){function m(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",j))}m.isReactWarning=!0,Object.defineProperty(P,"key",{get:m,configurable:!0})}function X(){var P=_(this.type);return v[P]||(v[P]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),P=this.props.ref,P!==void 0?P:null}function Y(P,j,m,h,o,e){var s=m.ref;return P={$$typeof:z,type:P,key:j,props:m,_owner:h},(s!==void 0?s:null)!==null?Object.defineProperty(P,"ref",{enumerable:!1,get:X}):Object.defineProperty(P,"ref",{enumerable:!1,value:null}),P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(P,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(P,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:o}),Object.defineProperty(P,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:e}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P}function K(P,j,m,h,o,e){var s=j.children;if(s!==void 0)if(h)if(c(s)){for(h=0;h<s.length;h++)H(s[h]);Object.freeze&&Object.freeze(s)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else H(s);if(l.call(j,"key")){s=_(P);var t=Object.keys(j).filter(function(n){return n!=="key"});h=0<t.length?"{key: someKey, "+t.join(": ..., ")+": ...}":"{key: someKey}",b[s+h]||(t=0<t.length?"{"+t.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
13
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),T}function E(){Z1.asyncTransitions--}function r(T){if(L0===null)try{var g=("require"+Math.random()).slice(0,7);L0=(X4&&X4[g]).call(X4,"timers").setImmediate}catch(_1){L0=function($1){B0===!1&&(B0=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var L1=new MessageChannel;L1.port1.onmessage=$1,L1.port2.postMessage(void 0)}}return L0(T)}function c(T){return 1<T.length&&typeof AggregateError==="function"?AggregateError(T):T[0]}function y(T,g){g!==G2-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),G2=g}function b(T,g,_1){var $1=Z1.actQueue;if($1!==null)if($1.length!==0)try{v($1),r(function(){return b(T,g,_1)});return}catch(L1){Z1.thrownErrors.push(L1)}else Z1.actQueue=null;0<Z1.thrownErrors.length?($1=c(Z1.thrownErrors),Z1.thrownErrors.length=0,_1($1)):g(T)}function v(T){if(!Z2){Z2=!0;var g=0;try{for(;g<T.length;g++){var _1=T[g];do{Z1.didUsePromise=!1;var $1=_1(!1);if($1!==null){if(Z1.didUsePromise){T[g]=_1,T.splice(0,g);return}_1=$1}else break}while(1)}T.length=0}catch(L1){T.splice(0,g+1),Z1.thrownErrors.push(L1)}finally{Z2=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var x=Symbol.for("react.transitional.element"),V=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),h=Symbol.for("react.context"),t=Symbol.for("react.forward_ref"),Q1=Symbol.for("react.suspense"),s=Symbol.for("react.suspense_list"),o=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),e=Symbol.for("react.activity"),J1=Symbol.iterator,U1={},F1={isMounted:function(){return!1},enqueueForceUpdate:function(T){J(T,"forceUpdate")},enqueueReplaceState:function(T){J(T,"replaceState")},enqueueSetState:function(T){J(T,"setState")}},W1=Object.assign,Y1={};Object.freeze(Y1),q.prototype.isReactComponent={},q.prototype.setState=function(T,g){if(typeof T!=="object"&&typeof T!=="function"&&T!=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,T,g,"setState")},q.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};var B1={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(A0 in B1)B1.hasOwnProperty(A0)&&_(A0,B1[A0]);U.prototype=q.prototype,B1=G.prototype=new U,B1.constructor=G,W1(B1,q.prototype),B1.isPureReactComponent=!0;var n=Array.isArray,T1=Symbol.for("react.client.reference"),Z1={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},k1=Object.prototype.hasOwnProperty,t1=console.createTask?console.createTask:function(){return null};B1={react_stack_bottom_frame:function(T){return T()}};var _0,s1,I0={},S0=B1.react_stack_bottom_frame.bind(B1,L)(),q0=t1(K(L)),x1=!1,Y0=/\/+/g,W0=typeof reportError==="function"?reportError:function(T){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var g=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T==="object"&&T!==null&&typeof T.message==="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(g))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",T);return}console.error(T)},B0=!1,L0=null,G2=0,h0=!1,Z2=!1,F2=typeof queueMicrotask==="function"?function(T){queueMicrotask(function(){return queueMicrotask(T)})}:r;B1=Object.freeze({__proto__:null,c:function(T){return k().useMemoCache(T)}});var A0={map:S,forEach:function(T,g,_1){S(T,function(){g.apply(this,arguments)},_1)},count:function(T){var g=0;return S(T,function(){g++}),g},toArray:function(T){return S(T,function(g){return g})||[]},only:function(T){if(!A(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};$J.Activity=e,$J.Children=A0,$J.Component=q,$J.Fragment=D,$J.Profiler=u,$J.PureComponent=G,$J.StrictMode=P,$J.Suspense=Q1,$J.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Z1,$J.__COMPILER_RUNTIME=B1,$J.act=function(T){var g=Z1.actQueue,_1=G2;G2++;var $1=Z1.actQueue=g!==null?g:[],L1=!1;try{var w1=T()}catch(f1){Z1.thrownErrors.push(f1)}if(0<Z1.thrownErrors.length)throw y(g,_1),T=c(Z1.thrownErrors),Z1.thrownErrors.length=0,T;if(w1!==null&&typeof w1==="object"&&typeof w1.then==="function"){var P1=w1;return F2(function(){L1||h0||(h0=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(f1,M0){L1=!0,P1.then(function(y0){if(y(g,_1),_1===0){try{v($1),r(function(){return b(y0,f1,M0)})}catch(l2){Z1.thrownErrors.push(l2)}if(0<Z1.thrownErrors.length){var L5=c(Z1.thrownErrors);Z1.thrownErrors.length=0,M0(L5)}}else f1(y0)},function(y0){y(g,_1),0<Z1.thrownErrors.length?(y0=c(Z1.thrownErrors),Z1.thrownErrors.length=0,M0(y0)):M0(y0)})}}}var u1=w1;if(y(g,_1),_1===0&&(v($1),$1.length!==0&&F2(function(){L1||h0||(h0=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),Z1.actQueue=null),0<Z1.thrownErrors.length)throw T=c(Z1.thrownErrors),Z1.thrownErrors.length=0,T;return{then:function(f1,M0){L1=!0,_1===0?(Z1.actQueue=$1,r(function(){return b(u1,f1,M0)})):f1(u1)}}},$J.cache=function(T){return function(){return T.apply(null,arguments)}},$J.cacheSignal=function(){return null},$J.captureOwnerStack=function(){var T=Z1.getCurrentStack;return T===null?null:T()},$J.cloneElement=function(T,g,_1){if(T===null||T===void 0)throw Error("The argument must be a React element, but you passed "+T+".");var $1=W1({},T.props),L1=T.key,w1=T._owner;if(g!=null){var P1;_:{if(k1.call(g,"ref")&&(P1=Object.getOwnPropertyDescriptor(g,"ref").get)&&P1.isReactWarning){P1=!1;break _}P1=g.ref!==void 0}P1&&(w1=H()),z(g)&&(X(g.key),L1=""+g.key);for(u1 in g)!k1.call(g,u1)||u1==="key"||u1==="__self"||u1==="__source"||u1==="ref"&&g.ref===void 0||($1[u1]=g[u1])}var u1=arguments.length-2;if(u1===1)$1.children=_1;else if(1<u1){P1=Array(u1);for(var f1=0;f1<u1;f1++)P1[f1]=arguments[f1+2];$1.children=P1}$1=M(T.type,L1,$1,w1,T._debugStack,T._debugTask);for(L1=2;L1<arguments.length;L1++)N(arguments[L1]);return $1},$J.createContext=function(T){return T={$$typeof:h,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:m,_context:T},T._currentRenderer=null,T._currentRenderer2=null,T},$J.createElement=function(T,g,_1){for(var $1=2;$1<arguments.length;$1++)N(arguments[$1]);$1={};var L1=null;if(g!=null)for(f1 in s1||!("__self"in g)||"key"in g||(s1=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),z(g)&&(X(g.key),L1=""+g.key),g)k1.call(g,f1)&&f1!=="key"&&f1!=="__self"&&f1!=="__source"&&($1[f1]=g[f1]);var w1=arguments.length-2;if(w1===1)$1.children=_1;else if(1<w1){for(var P1=Array(w1),u1=0;u1<w1;u1++)P1[u1]=arguments[u1+2];Object.freeze&&Object.freeze(P1),$1.children=P1}if(T&&T.defaultProps)for(f1 in w1=T.defaultProps,w1)$1[f1]===void 0&&($1[f1]=w1[f1]);L1&&W($1,typeof T==="function"?T.displayName||T.name||"Unknown":T);var f1=1e4>Z1.recentlyCreatedOwnerStacks++;return M(T,L1,$1,H(),f1?Error("react-stack-top-frame"):S0,f1?t1(K(T)):q0)},$J.createRef=function(){var T={current:null};return Object.seal(T),T},$J.forwardRef=function(T){T!=null&&T.$$typeof===o?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof T!=="function"?console.error("forwardRef requires a render function but was given %s.",T===null?"null":typeof T):T.length!==0&&T.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",T.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),T!=null&&T.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var g={$$typeof:t,render:T},_1;return Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return _1},set:function($1){_1=$1,T.name||T.displayName||(Object.defineProperty(T,"name",{value:$1}),T.displayName=$1)}}),g},$J.isValidElement=A,$J.lazy=function(T){T={_status:-1,_result:T};var g={$$typeof:l,_payload:T,_init:w},_1={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return T._ioInfo=_1,g._debugInfo=[{awaited:_1}],g},$J.memo=function(T,g){T==null&&console.error("memo: The first argument must be a component. Instead received: %s",T===null?"null":typeof T),g={$$typeof:o,type:T,compare:g===void 0?null:g};var _1;return Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return _1},set:function($1){_1=$1,T.name||T.displayName||(Object.defineProperty(T,"name",{value:$1}),T.displayName=$1)}}),g},$J.startTransition=function(T){var g=Z1.T,_1={};_1._updatedFibers=new Set,Z1.T=_1;try{var $1=T(),L1=Z1.S;L1!==null&&L1(_1,$1),typeof $1==="object"&&$1!==null&&typeof $1.then==="function"&&(Z1.asyncTransitions++,$1.then(E,E),$1.then(Z,W0))}catch(w1){W0(w1)}finally{g===null&&_1._updatedFibers&&(T=_1._updatedFibers.size,_1._updatedFibers.clear(),10<T&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),g!==null&&_1.types!==null&&(g.types!==null&&g.types!==_1.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),g.types=_1.types),Z1.T=g}},$J.unstable_useCacheRefresh=function(){return k().useCacheRefresh()},$J.use=function(T){return k().use(T)},$J.useActionState=function(T,g,_1){return k().useActionState(T,g,_1)},$J.useCallback=function(T,g){return k().useCallback(T,g)},$J.useContext=function(T){var g=k();return T.$$typeof===m&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),g.useContext(T)},$J.useDebugValue=function(T,g){return k().useDebugValue(T,g)},$J.useDeferredValue=function(T,g){return k().useDeferredValue(T,g)},$J.useEffect=function(T,g){return T==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useEffect(T,g)},$J.useEffectEvent=function(T){return k().useEffectEvent(T)},$J.useId=function(){return k().useId()},$J.useImperativeHandle=function(T,g,_1){return k().useImperativeHandle(T,g,_1)},$J.useInsertionEffect=function(T,g){return T==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useInsertionEffect(T,g)},$J.useLayoutEffect=function(T,g){return T==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),k().useLayoutEffect(T,g)},$J.useMemo=function(T,g){return k().useMemo(T,g)},$J.useOptimistic=function(T,g){return k().useOptimistic(T,g)},$J.useReducer=function(T,g,_1){return k().useReducer(T,g,_1)},$J.useRef=function(T){return k().useRef(T)},$J.useState=function(T){return k().useState(T)},$J.useSyncExternalStore=function(T,g,_1){return k().useSyncExternalStore(T,g,_1)},$J.useTransition=function(){return k().useTransition()},$J.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var g8=M2((qJ)=>{var T2=J0(D0());(function(){function _(P){if(P==null)return null;if(typeof P==="function")return P.$$typeof===k?null:P.displayName||P.name||null;if(typeof P==="string")return P;switch(P){case I:return"Fragment";case B:return"Profiler";case M:return"StrictMode";case O:return"Suspense";case C:return"SuspenseList";case w:return"Activity"}if(typeof P==="object")switch(typeof P.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),P.$$typeof){case W:return"Portal";case A:return P.displayName||"Context";case N:return(P._context.displayName||"Context")+".Consumer";case R:var u=P.render;return P=P.displayName,P||(P=u.displayName||u.name||"",P=P!==""?"ForwardRef("+P+")":"ForwardRef"),P;case f:return u=P.displayName||null,u!==null?u:_(P.type)||"Memo";case S:u=P._payload,P=P._init;try{return _(P(u))}catch(m){}}return null}function Q(P){return""+P}function J(P){try{Q(P);var u=!1}catch(t){u=!0}if(u){u=console;var m=u.error,h=typeof Symbol==="function"&&Symbol.toStringTag&&P[Symbol.toStringTag]||P.constructor.name||"Object";return m.call(u,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",h),Q(P)}}function q(P){if(P===I)return"<>";if(typeof P==="object"&&P!==null&&P.$$typeof===S)return"<...>";try{var u=_(P);return u?"<"+u+">":"<...>"}catch(m){return"<...>"}}function U(){var P=E.A;return P===null?null:P.getOwner()}function G(){return Error("react-stack-top-frame")}function Z(P){if(r.call(P,"key")){var u=Object.getOwnPropertyDescriptor(P,"key").get;if(u&&u.isReactWarning)return!1}return P.key!==void 0}function F(P,u){function m(){b||(b=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",u))}m.isReactWarning=!0,Object.defineProperty(P,"key",{get:m,configurable:!0})}function X(){var P=_(this.type);return v[P]||(v[P]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),P=this.props.ref,P!==void 0?P:null}function Y(P,u,m,h,t,Q1){var s=m.ref;return P={$$typeof:z,type:P,key:u,props:m,_owner:h},(s!==void 0?s:null)!==null?Object.defineProperty(P,"ref",{enumerable:!1,get:X}):Object.defineProperty(P,"ref",{enumerable:!1,value:null}),P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(P,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(P,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:t}),Object.defineProperty(P,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Q1}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P}function K(P,u,m,h,t,Q1){var s=u.children;if(s!==void 0)if(h)if(c(s)){for(h=0;h<s.length;h++)H(s[h]);Object.freeze&&Object.freeze(s)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else H(s);if(r.call(u,"key")){s=_(P);var o=Object.keys(u).filter(function(e){return e!=="key"});h=0<o.length?"{key: someKey, "+o.join(": ..., ")+": ...}":"{key: someKey}",D[s+h]||(o=0<o.length?"{"+o.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
14
14
|
let props = %s;
|
|
15
15
|
<%s {...props} />
|
|
16
16
|
React keys must be passed directly to JSX without using spread:
|
|
17
17
|
let props = %s;
|
|
18
|
-
<%s key={someKey} {...props} />`,h,s,
|
|
18
|
+
<%s key={someKey} {...props} />`,h,s,o,s),D[s+h]=!0)}if(s=null,m!==void 0&&(J(m),s=""+m),Z(u)&&(J(u.key),s=""+u.key),"key"in u){m={};for(var l in u)l!=="key"&&(m[l]=u[l])}else m=u;return s&&F(m,typeof P==="function"?P.displayName||P.name||"Unknown":P),Y(P,s,m,U(),t,Q1)}function H(P){L(P)?P._store&&(P._store.validated=1):typeof P==="object"&&P!==null&&P.$$typeof===S&&(P._payload.status==="fulfilled"?L(P._payload.value)&&P._payload.value._store&&(P._payload.value._store.validated=1):P._store&&(P._store.validated=1))}function L(P){return typeof P==="object"&&P!==null&&P.$$typeof===z}var z=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),A=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),E=T2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,r=Object.prototype.hasOwnProperty,c=Array.isArray,y=console.createTask?console.createTask:function(){return null};T2={react_stack_bottom_frame:function(P){return P()}};var b,v={},x=T2.react_stack_bottom_frame.bind(T2,G)(),V=y(q(G)),D={};qJ.Fragment=I,qJ.jsx=function(P,u,m){var h=1e4>E.recentlyCreatedOwnerStacks++;return K(P,u,m,!1,h?Error("react-stack-top-frame"):x,h?y(q(P)):V)},qJ.jsxs=function(P,u,m){var h=1e4>E.recentlyCreatedOwnerStacks++;return K(P,u,m,!0,h?Error("react-stack-top-frame"):x,h?y(q(P)):V)}})()});var R9=M2((eq)=>{var R0=J0(D0());(function(){function _(L,z){return L===z&&(L!==0||1/L===1/z)||L!==L&&z!==z}function Q(L,z){Y||R0.startTransition===void 0||(Y=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var W=z();if(!K){var I=z();U(W,I)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),K=!0)}I=G({inst:{value:W,getSnapshot:z}});var M=I[0].inst,B=I[1];return F(function(){M.value=W,M.getSnapshot=z,J(M)&&B({inst:M})},[L,W,z]),Z(function(){return J(M)&&B({inst:M}),L(function(){J(M)&&B({inst:M})})},[L]),X(W),W}function J(L){var z=L.getSnapshot;L=L.value;try{var W=z();return!U(L,W)}catch(I){return!0}}function q(L,z){return z()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var U=typeof Object.is==="function"?Object.is:_,G=R0.useState,Z=R0.useEffect,F=R0.useLayoutEffect,X=R0.useDebugValue,Y=!1,K=!1,H=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?q:Q;eq.useSyncExternalStore=R0.useSyncExternalStore!==void 0?R0.useSyncExternalStore:H,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var O9=M2((_U)=>{var e0=J0(D0());(function(){function _(X,Y){return X===Y&&(X!==0||1/X===1/Y)||X!==X&&Y!==Y}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var Q=R9(),J=typeof Object.is==="function"?Object.is:_,q=Q.useSyncExternalStore,U=e0.useRef,G=e0.useEffect,Z=e0.useMemo,F=e0.useDebugValue;_U.useSyncExternalStoreWithSelector=function(X,Y,K,H,L){var z=U(null);if(z.current===null){var W={hasValue:!1,value:null};z.current=W}else W=z.current;z=Z(function(){function M(O){if(!B){if(B=!0,N=O,O=H(O),L!==void 0&&W.hasValue){var C=W.value;if(L(C,O))return A=C}return A=O}if(C=A,J(N,O))return C;var f=H(O);if(L!==void 0&&L(C,f))return N=O,C;return N=O,A=f}var B=!1,N,A,R=K===void 0?null:K;return[function(){return M(Y())},R===null?void 0:function(){return M(R())}]},[Y,K,H,L]);var I=q(X,z[0],z[1]);return G(function(){W.hasValue=!0,W.value=I},[I]),F(I),I},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var S9=M2((qU)=>{var z8=J0(D0());(function(){function _(){}function Q(K){return""+K}function J(K,H,L){var z=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;try{Q(z);var W=!1}catch(I){W=!0}return W&&(console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",typeof Symbol==="function"&&Symbol.toStringTag&&z[Symbol.toStringTag]||z.constructor.name||"Object"),Q(z)),{$$typeof:X,key:z==null?null:""+z,children:K,containerInfo:H,implementation:L}}function q(K,H){if(K==="font")return"";if(typeof H==="string")return H==="use-credentials"?H:""}function U(K){return K===null?"`null`":K===void 0?"`undefined`":K===""?"an empty string":'something with type "'+typeof K+'"'}function G(K){return K===null?"`null`":K===void 0?"`undefined`":K===""?"an empty string":typeof K==="string"?JSON.stringify(K):typeof K==="number"?"`"+K+"`":'something with type "'+typeof K+'"'}function Z(){var K=Y.H;return K===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
19
19
|
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
20
20
|
2. You might be breaking the Rules of Hooks
|
|
21
21
|
3. You might have more than one copy of React in the same app
|
|
22
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),K}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var F={d:{f:_,r:function(){throw Error("Invalid form element. requestFormReset must be passed a form that was rendered by React.")},D:_,C:_,L:_,m:_,X:_,S:_,M:_},p:0,findDOMNode:null},X=Symbol.for("react.portal"),Y=$8.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;typeof Map==="function"&&Map.prototype!=null&&typeof Map.prototype.forEach==="function"&&typeof Set==="function"&&Set.prototype!=null&&typeof Set.prototype.clear==="function"&&typeof Set.prototype.forEach==="function"||console.error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),$U.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,$U.createPortal=function(K,H){var L=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!H||H.nodeType!==1&&H.nodeType!==9&&H.nodeType!==11)throw Error("Target container is not a DOM element.");return J(K,H,null,L)},$U.flushSync=function(K){var H=Y.T,L=F.p;try{if(Y.T=null,F.p=2,K)return K()}finally{Y.T=H,F.p=L,F.d.f()&&console.error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.")}},$U.preconnect=function(K,H){typeof K==="string"&&K?H!=null&&typeof H!=="object"?console.error("ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",G(H)):H!=null&&typeof H.crossOrigin!=="string"&&console.error("ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",U(H.crossOrigin)):console.error("ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(K)),typeof K==="string"&&(H?(H=H.crossOrigin,H=typeof H==="string"?H==="use-credentials"?H:"":void 0):H=null,F.d.C(K,H))},$U.prefetchDNS=function(K){if(typeof K!=="string"||!K)console.error("ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(K));else if(1<arguments.length){var H=arguments[1];typeof H==="object"&&H.hasOwnProperty("crossOrigin")?console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",G(H)):console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",G(H))}typeof K==="string"&&F.d.D(K)},$U.preinit=function(K,H){if(typeof K==="string"&&K?H==null||typeof H!=="object"?console.error("ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",G(H)):H.as!=="style"&&H.as!=="script"&&console.error('ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',G(H.as)):console.error("ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(K)),typeof K==="string"&&H&&typeof H.as==="string"){var L=H.as,z=q(L,H.crossOrigin),W=typeof H.integrity==="string"?H.integrity:void 0,I=typeof H.fetchPriority==="string"?H.fetchPriority:void 0;L==="style"?F.d.S(K,typeof H.precedence==="string"?H.precedence:void 0,{crossOrigin:z,integrity:W,fetchPriority:I}):L==="script"&&F.d.X(K,{crossOrigin:z,integrity:W,fetchPriority:I,nonce:typeof H.nonce==="string"?H.nonce:void 0})}},$U.preinitModule=function(K,H){var L="";if(typeof K==="string"&&K||(L+=" The `href` argument encountered was "+U(K)+"."),H!==void 0&&typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":H&&("as"in H)&&H.as!=="script"&&(L+=" The `as` option encountered was "+G(H.as)+"."),L)console.error("ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",L);else switch(L=H&&typeof H.as==="string"?H.as:"script",L){case"script":break;default:L=G(L),console.error('ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',L,K)}if(typeof K==="string")if(typeof H==="object"&&H!==null){if(H.as==null||H.as==="script")L=q(H.as,H.crossOrigin),F.d.M(K,{crossOrigin:L,integrity:typeof H.integrity==="string"?H.integrity:void 0,nonce:typeof H.nonce==="string"?H.nonce:void 0})}else H==null&&F.d.M(K)},$U.preload=function(K,H){var L="";if(typeof K==="string"&&K||(L+=" The `href` argument encountered was "+U(K)+"."),H==null||typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":typeof H.as==="string"&&H.as||(L+=" The `as` option encountered was "+U(H.as)+"."),L&&console.error('ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',L),typeof K==="string"&&typeof H==="object"&&H!==null&&typeof H.as==="string"){L=H.as;var z=q(L,H.crossOrigin);F.d.L(K,L,{crossOrigin:z,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})}},$U.preloadModule=function(K,H){var L="";typeof K==="string"&&K||(L+=" The `href` argument encountered was "+U(K)+"."),H!==void 0&&typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":H&&("as"in H)&&typeof H.as!=="string"&&(L+=" The `as` option encountered was "+U(H.as)+"."),L&&console.error('ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',L),typeof K==="string"&&(H?(L=q(H.as,H.crossOrigin),F.d.m(K,{as:typeof H.as==="string"&&H.as!=="script"?H.as:void 0,crossOrigin:L,integrity:typeof H.integrity==="string"?H.integrity:void 0})):F.d.m(K))},$U.requestFormReset=function(K){F.d.r(K)},$U.unstable_batchedUpdates=function(K,H){return K(H)},$U.useFormState=function(K,H,L){return Z().useFormState(K,H,L)},$U.useFormStatus=function(){return Z().useHostTransitionStatus()},$U.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var O9=M2((CB,R9)=>{var qU=J0(T9());R9.exports=qU});var a5=M2((wZ)=>{var h2=J0(h0());(function(){function _(P){if(P==null)return null;if(typeof P==="function")return P.$$typeof===k?null:P.displayName||P.name||null;if(typeof P==="string")return P;switch(P){case I:return"Fragment";case A:return"Profiler";case R:return"StrictMode";case O:return"Suspense";case C:return"SuspenseList";case w:return"Activity"}if(typeof P==="object")switch(typeof P.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),P.$$typeof){case W:return"Portal";case B:return P.displayName||"Context";case N:return(P._context.displayName||"Context")+".Consumer";case T:var j=P.render;return P=P.displayName,P||(P=j.displayName||j.name||"",P=P!==""?"ForwardRef("+P+")":"ForwardRef"),P;case f:return j=P.displayName||null,j!==null?j:_(P.type)||"Memo";case S:j=P._payload,P=P._init;try{return _(P(j))}catch(m){}}return null}function Q(P){return""+P}function J(P){try{Q(P);var j=!1}catch(o){j=!0}if(j){j=console;var m=j.error,h=typeof Symbol==="function"&&Symbol.toStringTag&&P[Symbol.toStringTag]||P.constructor.name||"Object";return m.call(j,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",h),Q(P)}}function q(P){if(P===I)return"<>";if(typeof P==="object"&&P!==null&&P.$$typeof===S)return"<...>";try{var j=_(P);return j?"<"+j+">":"<...>"}catch(m){return"<...>"}}function U(){var P=E.A;return P===null?null:P.getOwner()}function G(){return Error("react-stack-top-frame")}function Z(P){if(l.call(P,"key")){var j=Object.getOwnPropertyDescriptor(P,"key").get;if(j&&j.isReactWarning)return!1}return P.key!==void 0}function F(P,j){function m(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",j))}m.isReactWarning=!0,Object.defineProperty(P,"key",{get:m,configurable:!0})}function X(){var P=_(this.type);return v[P]||(v[P]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),P=this.props.ref,P!==void 0?P:null}function Y(P,j,m,h,o,e){var s=m.ref;return P={$$typeof:z,type:P,key:j,props:m,_owner:h},(s!==void 0?s:null)!==null?Object.defineProperty(P,"ref",{enumerable:!1,get:X}):Object.defineProperty(P,"ref",{enumerable:!1,value:null}),P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(P,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(P,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:o}),Object.defineProperty(P,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:e}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P}function K(P,j,m,h,o,e){var s=j.children;if(s!==void 0)if(h)if(c(s)){for(h=0;h<s.length;h++)H(s[h]);Object.freeze&&Object.freeze(s)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else H(s);if(l.call(j,"key")){s=_(P);var t=Object.keys(j).filter(function(n){return n!=="key"});h=0<t.length?"{key: someKey, "+t.join(": ..., ")+": ...}":"{key: someKey}",b[s+h]||(t=0<t.length?"{"+t.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
22
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),K}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var F={d:{f:_,r:function(){throw Error("Invalid form element. requestFormReset must be passed a form that was rendered by React.")},D:_,C:_,L:_,m:_,X:_,S:_,M:_},p:0,findDOMNode:null},X=Symbol.for("react.portal"),Y=z8.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;typeof Map==="function"&&Map.prototype!=null&&typeof Map.prototype.forEach==="function"&&typeof Set==="function"&&Set.prototype!=null&&typeof Set.prototype.clear==="function"&&typeof Set.prototype.forEach==="function"||console.error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),qU.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,qU.createPortal=function(K,H){var L=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!H||H.nodeType!==1&&H.nodeType!==9&&H.nodeType!==11)throw Error("Target container is not a DOM element.");return J(K,H,null,L)},qU.flushSync=function(K){var H=Y.T,L=F.p;try{if(Y.T=null,F.p=2,K)return K()}finally{Y.T=H,F.p=L,F.d.f()&&console.error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.")}},qU.preconnect=function(K,H){typeof K==="string"&&K?H!=null&&typeof H!=="object"?console.error("ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",G(H)):H!=null&&typeof H.crossOrigin!=="string"&&console.error("ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",U(H.crossOrigin)):console.error("ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(K)),typeof K==="string"&&(H?(H=H.crossOrigin,H=typeof H==="string"?H==="use-credentials"?H:"":void 0):H=null,F.d.C(K,H))},qU.prefetchDNS=function(K){if(typeof K!=="string"||!K)console.error("ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(K));else if(1<arguments.length){var H=arguments[1];typeof H==="object"&&H.hasOwnProperty("crossOrigin")?console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",G(H)):console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",G(H))}typeof K==="string"&&F.d.D(K)},qU.preinit=function(K,H){if(typeof K==="string"&&K?H==null||typeof H!=="object"?console.error("ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",G(H)):H.as!=="style"&&H.as!=="script"&&console.error('ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',G(H.as)):console.error("ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",U(K)),typeof K==="string"&&H&&typeof H.as==="string"){var L=H.as,z=q(L,H.crossOrigin),W=typeof H.integrity==="string"?H.integrity:void 0,I=typeof H.fetchPriority==="string"?H.fetchPriority:void 0;L==="style"?F.d.S(K,typeof H.precedence==="string"?H.precedence:void 0,{crossOrigin:z,integrity:W,fetchPriority:I}):L==="script"&&F.d.X(K,{crossOrigin:z,integrity:W,fetchPriority:I,nonce:typeof H.nonce==="string"?H.nonce:void 0})}},qU.preinitModule=function(K,H){var L="";if(typeof K==="string"&&K||(L+=" The `href` argument encountered was "+U(K)+"."),H!==void 0&&typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":H&&("as"in H)&&H.as!=="script"&&(L+=" The `as` option encountered was "+G(H.as)+"."),L)console.error("ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",L);else switch(L=H&&typeof H.as==="string"?H.as:"script",L){case"script":break;default:L=G(L),console.error('ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',L,K)}if(typeof K==="string")if(typeof H==="object"&&H!==null){if(H.as==null||H.as==="script")L=q(H.as,H.crossOrigin),F.d.M(K,{crossOrigin:L,integrity:typeof H.integrity==="string"?H.integrity:void 0,nonce:typeof H.nonce==="string"?H.nonce:void 0})}else H==null&&F.d.M(K)},qU.preload=function(K,H){var L="";if(typeof K==="string"&&K||(L+=" The `href` argument encountered was "+U(K)+"."),H==null||typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":typeof H.as==="string"&&H.as||(L+=" The `as` option encountered was "+U(H.as)+"."),L&&console.error('ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',L),typeof K==="string"&&typeof H==="object"&&H!==null&&typeof H.as==="string"){L=H.as;var z=q(L,H.crossOrigin);F.d.L(K,L,{crossOrigin:z,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})}},qU.preloadModule=function(K,H){var L="";typeof K==="string"&&K||(L+=" The `href` argument encountered was "+U(K)+"."),H!==void 0&&typeof H!=="object"?L+=" The `options` argument encountered was "+U(H)+".":H&&("as"in H)&&typeof H.as!=="string"&&(L+=" The `as` option encountered was "+U(H.as)+"."),L&&console.error('ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',L),typeof K==="string"&&(H?(L=q(H.as,H.crossOrigin),F.d.m(K,{as:typeof H.as==="string"&&H.as!=="script"?H.as:void 0,crossOrigin:L,integrity:typeof H.integrity==="string"?H.integrity:void 0})):F.d.m(K))},qU.requestFormReset=function(K){F.d.r(K)},qU.unstable_batchedUpdates=function(K,H){return K(H)},qU.useFormState=function(K,H,L){return Z().useFormState(K,H,L)},qU.useFormStatus=function(){return Z().useHostTransitionStatus()},qU.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var k9=M2((SA,y9)=>{var UU=J0(S9());y9.exports=UU});var n5=M2((fZ)=>{var h2=J0(D0());(function(){function _(P){if(P==null)return null;if(typeof P==="function")return P.$$typeof===k?null:P.displayName||P.name||null;if(typeof P==="string")return P;switch(P){case I:return"Fragment";case B:return"Profiler";case M:return"StrictMode";case O:return"Suspense";case C:return"SuspenseList";case w:return"Activity"}if(typeof P==="object")switch(typeof P.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),P.$$typeof){case W:return"Portal";case A:return P.displayName||"Context";case N:return(P._context.displayName||"Context")+".Consumer";case R:var u=P.render;return P=P.displayName,P||(P=u.displayName||u.name||"",P=P!==""?"ForwardRef("+P+")":"ForwardRef"),P;case f:return u=P.displayName||null,u!==null?u:_(P.type)||"Memo";case S:u=P._payload,P=P._init;try{return _(P(u))}catch(m){}}return null}function Q(P){return""+P}function J(P){try{Q(P);var u=!1}catch(t){u=!0}if(u){u=console;var m=u.error,h=typeof Symbol==="function"&&Symbol.toStringTag&&P[Symbol.toStringTag]||P.constructor.name||"Object";return m.call(u,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",h),Q(P)}}function q(P){if(P===I)return"<>";if(typeof P==="object"&&P!==null&&P.$$typeof===S)return"<...>";try{var u=_(P);return u?"<"+u+">":"<...>"}catch(m){return"<...>"}}function U(){var P=E.A;return P===null?null:P.getOwner()}function G(){return Error("react-stack-top-frame")}function Z(P){if(r.call(P,"key")){var u=Object.getOwnPropertyDescriptor(P,"key").get;if(u&&u.isReactWarning)return!1}return P.key!==void 0}function F(P,u){function m(){b||(b=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",u))}m.isReactWarning=!0,Object.defineProperty(P,"key",{get:m,configurable:!0})}function X(){var P=_(this.type);return v[P]||(v[P]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),P=this.props.ref,P!==void 0?P:null}function Y(P,u,m,h,t,Q1){var s=m.ref;return P={$$typeof:z,type:P,key:u,props:m,_owner:h},(s!==void 0?s:null)!==null?Object.defineProperty(P,"ref",{enumerable:!1,get:X}):Object.defineProperty(P,"ref",{enumerable:!1,value:null}),P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(P,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(P,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:t}),Object.defineProperty(P,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Q1}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P}function K(P,u,m,h,t,Q1){var s=u.children;if(s!==void 0)if(h)if(c(s)){for(h=0;h<s.length;h++)H(s[h]);Object.freeze&&Object.freeze(s)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else H(s);if(r.call(u,"key")){s=_(P);var o=Object.keys(u).filter(function(e){return e!=="key"});h=0<o.length?"{key: someKey, "+o.join(": ..., ")+": ...}":"{key: someKey}",D[s+h]||(o=0<o.length?"{"+o.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
23
23
|
let props = %s;
|
|
24
24
|
<%s {...props} />
|
|
25
25
|
React keys must be passed directly to JSX without using spread:
|
|
26
26
|
let props = %s;
|
|
27
|
-
<%s key={someKey} {...props} />`,h,s,t,s),b[s+h]=!0)}if(s=null,m!==void 0&&(J(m),s=""+m),Z(j)&&(J(j.key),s=""+j.key),"key"in j){m={};for(var p in j)p!=="key"&&(m[p]=j[p])}else m=j;return s&&F(m,typeof P==="function"?P.displayName||P.name||"Unknown":P),Y(P,s,m,U(),o,e)}function H(P){L(P)?P._store&&(P._store.validated=1):typeof P==="object"&&P!==null&&P.$$typeof===S&&(P._payload.status==="fulfilled"?L(P._payload.value)&&P._payload.value._store&&(P._payload.value._store.validated=1):P._store&&(P._store.validated=1))}function L(P){return typeof P==="object"&&P!==null&&P.$$typeof===z}var z=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),B=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),E=h2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,l=Object.prototype.hasOwnProperty,c=Array.isArray,y=console.createTask?console.createTask:function(){return null};h2={react_stack_bottom_frame:function(P){return P()}};var D,v={},x=h2.react_stack_bottom_frame.bind(h2,G)(),V=y(q(G)),b={};wZ.Fragment=I,wZ.jsxDEV=function(P,j,m,h){var o=1e4>E.recentlyCreatedOwnerStacks++;return K(P,j,m,h,o?Error("react-stack-top-frame"):x,o?y(q(P)):V)}})()});var r=J0(h0(),1);var i=J0(j8(),1),d=J0(h0(),1);function c1(_){if(typeof _==="string"||typeof _==="number")return""+_;let Q="";if(Array.isArray(_)){for(let J=0,q;J<_.length;J++)if((q=c1(_[J]))!=="")Q+=(Q&&" ")+q}else for(let J in _)if(_[J])Q+=(Q&&" ")+J;return Q}var qJ={value:()=>{}};function u8(){for(var _=0,Q=arguments.length,J={},q;_<Q;++_){if(!(q=arguments[_]+"")||q in J||/[\s.]/.test(q))throw Error("illegal type: "+q);J[q]=[]}return new $4(J)}function $4(_){this._=_}function UJ(_,Q){return _.trim().split(/^|\s+/).map(function(J){var q="",U=J.indexOf(".");if(U>=0)q=J.slice(U+1),J=J.slice(0,U);if(J&&!Q.hasOwnProperty(J))throw Error("unknown type: "+J);return{type:J,name:q}})}$4.prototype=u8.prototype={constructor:$4,on:function(_,Q){var J=this._,q=UJ(_+"",J),U,G=-1,Z=q.length;if(arguments.length<2){while(++G<Z)if((U=(_=q[G]).type)&&(U=GJ(J[U],_.name)))return U;return}if(Q!=null&&typeof Q!=="function")throw Error("invalid callback: "+Q);while(++G<Z)if(U=(_=q[G]).type)J[U]=V8(J[U],_.name,Q);else if(Q==null)for(U in J)J[U]=V8(J[U],_.name,null);return this},copy:function(){var _={},Q=this._;for(var J in Q)_[J]=Q[J].slice();return new $4(_)},call:function(_,Q){if((U=arguments.length-2)>0)for(var J=Array(U),q=0,U,G;q<U;++q)J[q]=arguments[q+2];if(!this._.hasOwnProperty(_))throw Error("unknown type: "+_);for(G=this._[_],q=0,U=G.length;q<U;++q)G[q].value.apply(Q,J)},apply:function(_,Q,J){if(!this._.hasOwnProperty(_))throw Error("unknown type: "+_);for(var q=this._[_],U=0,G=q.length;U<G;++U)q[U].value.apply(Q,J)}};function GJ(_,Q){for(var J=0,q=_.length,U;J<q;++J)if((U=_[J]).name===Q)return U.value}function V8(_,Q,J){for(var q=0,U=_.length;q<U;++q)if(_[q].name===Q){_[q]=qJ,_=_.slice(0,q).concat(_.slice(q+1));break}if(J!=null)_.push({name:Q,value:J});return _}var R2=u8;function d2(_){return function(){return this.matches(_)}}function q4(_){return function(Q){return Q.matches(_)}}var U4="http://www.w3.org/1999/xhtml",Z3={svg:"http://www.w3.org/2000/svg",xhtml:U4,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function D0(_){var Q=_+="",J=Q.indexOf(":");if(J>=0&&(Q=_.slice(0,J))!=="xmlns")_=_.slice(J+1);return Z3.hasOwnProperty(Q)?{space:Z3[Q],local:_}:_}function F3(_){let Q;while(Q=_.sourceEvent)_=Q;return _}function q0(_,Q){if(_=F3(_),Q===void 0)Q=_.currentTarget;if(Q){var J=Q.ownerSVGElement||Q;if(J.createSVGPoint){var q=J.createSVGPoint();return q.x=_.clientX,q.y=_.clientY,q=q.matrixTransform(Q.getScreenCTM().inverse()),[q.x,q.y]}if(Q.getBoundingClientRect){var U=Q.getBoundingClientRect();return[_.clientX-U.left-Q.clientLeft,_.clientY-U.top-Q.clientTop]}}return[_.pageX,_.pageY]}function ZJ(){}function Z2(_){return _==null?ZJ:function(){return this.querySelector(_)}}function H3(_){if(typeof _!=="function")_=Z2(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=Array(Z),X,Y,K=0;K<Z;++K)if((X=G[K])&&(Y=_.call(X,X.__data__,K,G))){if("__data__"in X)Y.__data__=X.__data__;F[K]=Y}return new i1(q,this._parents)}function X3(_){return _==null?[]:Array.isArray(_)?_:Array.from(_)}function FJ(){return[]}function a2(_){return _==null?FJ:function(){return this.querySelectorAll(_)}}function HJ(_){return function(){return X3(_.apply(this,arguments))}}function K3(_){if(typeof _==="function")_=HJ(_);else _=a2(_);for(var Q=this._groups,J=Q.length,q=[],U=[],G=0;G<J;++G)for(var Z=Q[G],F=Z.length,X,Y=0;Y<F;++Y)if(X=Z[Y])q.push(_.call(X,X.__data__,Y,Z)),U.push(X);return new i1(q,U)}var XJ=Array.prototype.find;function KJ(_){return function(){return XJ.call(this.children,_)}}function YJ(){return this.firstElementChild}function Y3(_){return this.select(_==null?YJ:KJ(typeof _==="function"?_:q4(_)))}var LJ=Array.prototype.filter;function zJ(){return Array.from(this.children)}function WJ(_){return function(){return LJ.call(this.children,_)}}function L3(_){return this.selectAll(_==null?zJ:WJ(typeof _==="function"?_:q4(_)))}function z3(_){if(typeof _!=="function")_=d2(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=[],X,Y=0;Y<Z;++Y)if((X=G[Y])&&_.call(X,X.__data__,Y,G))F.push(X);return new i1(q,this._parents)}function W5(_){return Array(_.length)}function W3(){return new i1(this._enter||this._groups.map(W5),this._parents)}function A5(_,Q){this.ownerDocument=_.ownerDocument,this.namespaceURI=_.namespaceURI,this._next=null,this._parent=_,this.__data__=Q}A5.prototype={constructor:A5,appendChild:function(_){return this._parent.insertBefore(_,this._next)},insertBefore:function(_,Q){return this._parent.insertBefore(_,Q)},querySelector:function(_){return this._parent.querySelector(_)},querySelectorAll:function(_){return this._parent.querySelectorAll(_)}};function A3(_){return function(){return _}}function AJ(_,Q,J,q,U,G){var Z=0,F,X=Q.length,Y=G.length;for(;Z<Y;++Z)if(F=Q[Z])F.__data__=G[Z],q[Z]=F;else J[Z]=new A5(_,G[Z]);for(;Z<X;++Z)if(F=Q[Z])U[Z]=F}function BJ(_,Q,J,q,U,G,Z){var F,X,Y=new Map,K=Q.length,H=G.length,L=Array(K),z;for(F=0;F<K;++F)if(X=Q[F])if(L[F]=z=Z.call(X,X.__data__,F,Q)+"",Y.has(z))U[F]=X;else Y.set(z,X);for(F=0;F<H;++F)if(z=Z.call(_,G[F],F,G)+"",X=Y.get(z))q[F]=X,X.__data__=G[F],Y.delete(z);else J[F]=new A5(_,G[F]);for(F=0;F<K;++F)if((X=Q[F])&&Y.get(L[F])===X)U[F]=X}function MJ(_){return _.__data__}function B3(_,Q){if(!arguments.length)return Array.from(this,MJ);var J=Q?BJ:AJ,q=this._parents,U=this._groups;if(typeof _!=="function")_=A3(_);for(var G=U.length,Z=Array(G),F=Array(G),X=Array(G),Y=0;Y<G;++Y){var K=q[Y],H=U[Y],L=H.length,z=TJ(_.call(K,K&&K.__data__,Y,q)),W=z.length,I=F[Y]=Array(W),R=Z[Y]=Array(W),A=X[Y]=Array(L);J(K,H,I,R,A,z,Q);for(var N=0,B=0,T,O;N<W;++N)if(T=I[N]){if(N>=B)B=N+1;while(!(O=R[B])&&++B<W);T._next=O||null}}return Z=new i1(Z,q),Z._enter=F,Z._exit=X,Z}function TJ(_){return typeof _==="object"&&"length"in _?_:Array.from(_)}function M3(){return new i1(this._exit||this._groups.map(W5),this._parents)}function T3(_,Q,J){var q=this.enter(),U=this,G=this.exit();if(typeof _==="function"){if(q=_(q),q)q=q.selection()}else q=q.append(_+"");if(Q!=null){if(U=Q(U),U)U=U.selection()}if(J==null)G.remove();else J(G);return q&&U?q.merge(U).order():U}function R3(_){var Q=_.selection?_.selection():_;for(var J=this._groups,q=Q._groups,U=J.length,G=q.length,Z=Math.min(U,G),F=Array(U),X=0;X<Z;++X)for(var Y=J[X],K=q[X],H=Y.length,L=F[X]=Array(H),z,W=0;W<H;++W)if(z=Y[W]||K[W])L[W]=z;for(;X<U;++X)F[X]=J[X];return new i1(F,this._parents)}function O3(){for(var _=this._groups,Q=-1,J=_.length;++Q<J;)for(var q=_[Q],U=q.length-1,G=q[U],Z;--U>=0;)if(Z=q[U]){if(G&&Z.compareDocumentPosition(G)^4)G.parentNode.insertBefore(Z,G);G=Z}return this}function I3(_){if(!_)_=RJ;function Q(H,L){return H&&L?_(H.__data__,L.__data__):!H-!L}for(var J=this._groups,q=J.length,U=Array(q),G=0;G<q;++G){for(var Z=J[G],F=Z.length,X=U[G]=Array(F),Y,K=0;K<F;++K)if(Y=Z[K])X[K]=Y;X.sort(Q)}return new i1(U,this._parents).order()}function RJ(_,Q){return _<Q?-1:_>Q?1:_>=Q?0:NaN}function P3(){var _=arguments[0];return arguments[0]=this,_.apply(null,arguments),this}function N3(){return Array.from(this)}function w3(){for(var _=this._groups,Q=0,J=_.length;Q<J;++Q)for(var q=_[Q],U=0,G=q.length;U<G;++U){var Z=q[U];if(Z)return Z}return null}function f3(){let _=0;for(let Q of this)++_;return _}function C3(){return!this.node()}function S3(_){for(var Q=this._groups,J=0,q=Q.length;J<q;++J)for(var U=Q[J],G=0,Z=U.length,F;G<Z;++G)if(F=U[G])_.call(F,F.__data__,G,U);return this}function OJ(_){return function(){this.removeAttribute(_)}}function IJ(_){return function(){this.removeAttributeNS(_.space,_.local)}}function PJ(_,Q){return function(){this.setAttribute(_,Q)}}function NJ(_,Q){return function(){this.setAttributeNS(_.space,_.local,Q)}}function wJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)this.removeAttribute(_);else this.setAttribute(_,J)}}function fJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)this.removeAttributeNS(_.space,_.local);else this.setAttributeNS(_.space,_.local,J)}}function y3(_,Q){var J=D0(_);if(arguments.length<2){var q=this.node();return J.local?q.getAttributeNS(J.space,J.local):q.getAttribute(J)}return this.each((Q==null?J.local?IJ:OJ:typeof Q==="function"?J.local?fJ:wJ:J.local?NJ:PJ)(J,Q))}function B5(_){return _.ownerDocument&&_.ownerDocument.defaultView||_.document&&_||_.defaultView}function CJ(_){return function(){this.style.removeProperty(_)}}function SJ(_,Q,J){return function(){this.style.setProperty(_,Q,J)}}function yJ(_,Q,J){return function(){var q=Q.apply(this,arguments);if(q==null)this.style.removeProperty(_);else this.style.setProperty(_,q,J)}}function k3(_,Q,J){return arguments.length>1?this.each((Q==null?CJ:typeof Q==="function"?yJ:SJ)(_,Q,J==null?"":J)):F2(this.node(),_)}function F2(_,Q){return _.style.getPropertyValue(Q)||B5(_).getComputedStyle(_,null).getPropertyValue(Q)}function kJ(_){return function(){delete this[_]}}function vJ(_,Q){return function(){this[_]=Q}}function jJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)delete this[_];else this[_]=J}}function v3(_,Q){return arguments.length>1?this.each((Q==null?kJ:typeof Q==="function"?jJ:vJ)(_,Q)):this.node()[_]}function h8(_){return _.trim().split(/^|\s+/)}function j3(_){return _.classList||new D8(_)}function D8(_){this._node=_,this._names=h8(_.getAttribute("class")||"")}D8.prototype={add:function(_){var Q=this._names.indexOf(_);if(Q<0)this._names.push(_),this._node.setAttribute("class",this._names.join(" "))},remove:function(_){var Q=this._names.indexOf(_);if(Q>=0)this._names.splice(Q,1),this._node.setAttribute("class",this._names.join(" "))},contains:function(_){return this._names.indexOf(_)>=0}};function b8(_,Q){var J=j3(_),q=-1,U=Q.length;while(++q<U)J.add(Q[q])}function E8(_,Q){var J=j3(_),q=-1,U=Q.length;while(++q<U)J.remove(Q[q])}function VJ(_){return function(){b8(this,_)}}function uJ(_){return function(){E8(this,_)}}function hJ(_,Q){return function(){(Q.apply(this,arguments)?b8:E8)(this,_)}}function V3(_,Q){var J=h8(_+"");if(arguments.length<2){var q=j3(this.node()),U=-1,G=J.length;while(++U<G)if(!q.contains(J[U]))return!1;return!0}return this.each((typeof Q==="function"?hJ:Q?VJ:uJ)(J,Q))}function DJ(){this.textContent=""}function bJ(_){return function(){this.textContent=_}}function EJ(_){return function(){var Q=_.apply(this,arguments);this.textContent=Q==null?"":Q}}function u3(_){return arguments.length?this.each(_==null?DJ:(typeof _==="function"?EJ:bJ)(_)):this.node().textContent}function xJ(){this.innerHTML=""}function mJ(_){return function(){this.innerHTML=_}}function gJ(_){return function(){var Q=_.apply(this,arguments);this.innerHTML=Q==null?"":Q}}function h3(_){return arguments.length?this.each(_==null?xJ:(typeof _==="function"?gJ:mJ)(_)):this.node().innerHTML}function pJ(){if(this.nextSibling)this.parentNode.appendChild(this)}function D3(){return this.each(pJ)}function cJ(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function b3(){return this.each(cJ)}function lJ(_){return function(){var Q=this.ownerDocument,J=this.namespaceURI;return J===U4&&Q.documentElement.namespaceURI===U4?Q.createElement(_):Q.createElementNS(J,_)}}function rJ(_){return function(){return this.ownerDocument.createElementNS(_.space,_.local)}}function M5(_){var Q=D0(_);return(Q.local?rJ:lJ)(Q)}function E3(_){var Q=typeof _==="function"?_:M5(_);return this.select(function(){return this.appendChild(Q.apply(this,arguments))})}function iJ(){return null}function x3(_,Q){var J=typeof _==="function"?_:M5(_),q=Q==null?iJ:typeof Q==="function"?Q:Z2(Q);return this.select(function(){return this.insertBefore(J.apply(this,arguments),q.apply(this,arguments)||null)})}function dJ(){var _=this.parentNode;if(_)_.removeChild(this)}function m3(){return this.each(dJ)}function aJ(){var _=this.cloneNode(!1),Q=this.parentNode;return Q?Q.insertBefore(_,this.nextSibling):_}function sJ(){var _=this.cloneNode(!0),Q=this.parentNode;return Q?Q.insertBefore(_,this.nextSibling):_}function g3(_){return this.select(_?sJ:aJ)}function p3(_){return arguments.length?this.property("__data__",_):this.node().__data__}function tJ(_){return function(Q){_.call(this,Q,this.__data__)}}function oJ(_){return _.trim().split(/^|\s+/).map(function(Q){var J="",q=Q.indexOf(".");if(q>=0)J=Q.slice(q+1),Q=Q.slice(0,q);return{type:Q,name:J}})}function nJ(_){return function(){var Q=this.__on;if(!Q)return;for(var J=0,q=-1,U=Q.length,G;J<U;++J)if(G=Q[J],(!_.type||G.type===_.type)&&G.name===_.name)this.removeEventListener(G.type,G.listener,G.options);else Q[++q]=G;if(++q)Q.length=q;else delete this.__on}}function eJ(_,Q,J){return function(){var q=this.__on,U,G=tJ(Q);if(q){for(var Z=0,F=q.length;Z<F;++Z)if((U=q[Z]).type===_.type&&U.name===_.name){this.removeEventListener(U.type,U.listener,U.options),this.addEventListener(U.type,U.listener=G,U.options=J),U.value=Q;return}}if(this.addEventListener(_.type,G,J),U={type:_.type,name:_.name,value:Q,listener:G,options:J},!q)this.__on=[U];else q.push(U)}}function c3(_,Q,J){var q=oJ(_+""),U,G=q.length,Z;if(arguments.length<2){var F=this.node().__on;if(F){for(var X=0,Y=F.length,K;X<Y;++X)for(U=0,K=F[X];U<G;++U)if((Z=q[U]).type===K.type&&Z.name===K.name)return K.value}return}F=Q?eJ:nJ;for(U=0;U<G;++U)this.each(F(q[U],Q,J));return this}function x8(_,Q,J){var q=B5(_),U=q.CustomEvent;if(typeof U==="function")U=new U(Q,J);else if(U=q.document.createEvent("Event"),J)U.initEvent(Q,J.bubbles,J.cancelable),U.detail=J.detail;else U.initEvent(Q,!1,!1);_.dispatchEvent(U)}function _$(_,Q){return function(){return x8(this,_,Q)}}function Q$(_,Q){return function(){return x8(this,_,Q.apply(this,arguments))}}function l3(_,Q){return this.each((typeof Q==="function"?Q$:_$)(_,Q))}function*r3(){for(var _=this._groups,Q=0,J=_.length;Q<J;++Q)for(var q=_[Q],U=0,G=q.length,Z;U<G;++U)if(Z=q[U])yield Z}var i3=[null];function i1(_,Q){this._groups=_,this._parents=Q}function m8(){return new i1([[document.documentElement]],i3)}function J$(){return this}i1.prototype=m8.prototype={constructor:i1,select:H3,selectAll:K3,selectChild:Y3,selectChildren:L3,filter:z3,data:B3,enter:W3,exit:M3,join:T3,merge:R3,selection:J$,order:O3,sort:I3,call:P3,nodes:N3,node:w3,size:f3,empty:C3,each:S3,attr:y3,style:k3,property:v3,classed:V3,text:u3,html:h3,raise:D3,lower:b3,append:E3,insert:x3,remove:m3,clone:g3,datum:p3,on:c3,dispatch:l3,[Symbol.iterator]:r3};var d0=m8;function o1(_){return typeof _==="string"?new i1([[document.querySelector(_)]],[document.documentElement]):new i1([[_]],i3)}var g8={passive:!1},O2={capture:!0,passive:!1};function G4(_){_.stopImmediatePropagation()}function a0(_){_.preventDefault(),_.stopImmediatePropagation()}function s2(_){var Q=_.document.documentElement,J=o1(_).on("dragstart.drag",a0,O2);if("onselectstart"in Q)J.on("selectstart.drag",a0,O2);else Q.__noselect=Q.style.MozUserSelect,Q.style.MozUserSelect="none"}function T5(_,Q){var J=_.document.documentElement,q=o1(_).on("dragstart.drag",null);if(Q)q.on("click.drag",a0,O2),setTimeout(function(){q.on("click.drag",null)},0);if("onselectstart"in J)q.on("selectstart.drag",null);else J.style.MozUserSelect=J.__noselect,delete J.__noselect}var R5=(_)=>()=>_;function O5(_,{sourceEvent:Q,subject:J,target:q,identifier:U,active:G,x:Z,y:F,dx:X,dy:Y,dispatch:K}){Object.defineProperties(this,{type:{value:_,enumerable:!0,configurable:!0},sourceEvent:{value:Q,enumerable:!0,configurable:!0},subject:{value:J,enumerable:!0,configurable:!0},target:{value:q,enumerable:!0,configurable:!0},identifier:{value:U,enumerable:!0,configurable:!0},active:{value:G,enumerable:!0,configurable:!0},x:{value:Z,enumerable:!0,configurable:!0},y:{value:F,enumerable:!0,configurable:!0},dx:{value:X,enumerable:!0,configurable:!0},dy:{value:Y,enumerable:!0,configurable:!0},_:{value:K}})}O5.prototype.on=function(){var _=this._.on.apply(this._,arguments);return _===this._?this:_};function $$(_){return!_.ctrlKey&&!_.button}function q$(){return this.parentNode}function U$(_,Q){return Q==null?{x:_.x,y:_.y}:Q}function G$(){return navigator.maxTouchPoints||"ontouchstart"in this}function I5(){var _=$$,Q=q$,J=U$,q=G$,U={},G=R2("start","drag","end"),Z=0,F,X,Y,K,H=0;function L(T){T.on("mousedown.drag",z).filter(q).on("touchstart.drag",R).on("touchmove.drag",A,g8).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function z(T,O){if(K||!_.call(this,T,O))return;var C=B(this,Q.call(this,T,O),T,O,"mouse");if(!C)return;o1(T.view).on("mousemove.drag",W,O2).on("mouseup.drag",I,O2),s2(T.view),G4(T),Y=!1,F=T.clientX,X=T.clientY,C("start",T)}function W(T){if(a0(T),!Y){var O=T.clientX-F,C=T.clientY-X;Y=O*O+C*C>H}U.mouse("drag",T)}function I(T){o1(T.view).on("mousemove.drag mouseup.drag",null),T5(T.view,Y),a0(T),U.mouse("end",T)}function R(T,O){if(!_.call(this,T,O))return;var C=T.changedTouches,f=Q.call(this,T,O),S=C.length,w,k;for(w=0;w<S;++w)if(k=B(this,f,T,O,C[w].identifier,C[w]))G4(T),k("start",T,C[w])}function A(T){var O=T.changedTouches,C=O.length,f,S;for(f=0;f<C;++f)if(S=U[O[f].identifier])a0(T),S("drag",T,O[f])}function N(T){var O=T.changedTouches,C=O.length,f,S;if(K)clearTimeout(K);K=setTimeout(function(){K=null},500);for(f=0;f<C;++f)if(S=U[O[f].identifier])G4(T),S("end",T,O[f])}function B(T,O,C,f,S,w){var k=G.copy(),E=q0(w||C,O),l,c,y;if((y=J.call(T,new O5("beforestart",{sourceEvent:C,target:L,identifier:S,active:Z,x:E[0],y:E[1],dx:0,dy:0,dispatch:k}),f))==null)return;return l=y.x-E[0]||0,c=y.y-E[1]||0,function D(v,x,V){var b=E,P;switch(v){case"start":U[S]=D,P=Z++;break;case"end":delete U[S],--Z;case"drag":E=q0(V||x,O),P=Z;break}k.call(v,T,new O5(v,{sourceEvent:x,subject:y,target:L,identifier:S,active:P,x:E[0]+l,y:E[1]+c,dx:E[0]-b[0],dy:E[1]-b[1],dispatch:k}),f)}}return L.filter=function(T){return arguments.length?(_=typeof T==="function"?T:R5(!!T),L):_},L.container=function(T){return arguments.length?(Q=typeof T==="function"?T:R5(T),L):Q},L.subject=function(T){return arguments.length?(J=typeof T==="function"?T:R5(T),L):J},L.touchable=function(T){return arguments.length?(q=typeof T==="function"?T:R5(!!T),L):q},L.on=function(){var T=G.on.apply(G,arguments);return T===G?L:T},L.clickDistance=function(T){return arguments.length?(H=(T=+T)*T,L):Math.sqrt(H)},L}function P5(_,Q,J){_.prototype=Q.prototype=J,J.constructor=_}function d3(_,Q){var J=Object.create(_.prototype);for(var q in Q)J[q]=Q[q];return J}function f5(){}var N5=0.7,H4=1/N5,t2="\\s*([+-]?\\d+)\\s*",w5="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",b0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Z$=/^#([0-9a-f]{3,8})$/,F$=new RegExp(`^rgb\\(${t2},${t2},${t2}\\)$`),H$=new RegExp(`^rgb\\(${b0},${b0},${b0}\\)$`),X$=new RegExp(`^rgba\\(${t2},${t2},${t2},${w5}\\)$`),K$=new RegExp(`^rgba\\(${b0},${b0},${b0},${w5}\\)$`),Y$=new RegExp(`^hsl\\(${w5},${b0},${b0}\\)$`),L$=new RegExp(`^hsla\\(${w5},${b0},${b0},${w5}\\)$`),p8={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};P5(f5,S0,{copy(_){return Object.assign(new this.constructor,this,_)},displayable(){return this.rgb().displayable()},hex:c8,formatHex:c8,formatHex8:z$,formatHsl:W$,formatRgb:l8,toString:l8});function c8(){return this.rgb().formatHex()}function z$(){return this.rgb().formatHex8()}function W$(){return t8(this).formatHsl()}function l8(){return this.rgb().formatRgb()}function S0(_){var Q,J;return _=(_+"").trim().toLowerCase(),(Q=Z$.exec(_))?(J=Q[1].length,Q=parseInt(Q[1],16),J===6?r8(Q):J===3?new L0(Q>>8&15|Q>>4&240,Q>>4&15|Q&240,(Q&15)<<4|Q&15,1):J===8?Z4(Q>>24&255,Q>>16&255,Q>>8&255,(Q&255)/255):J===4?Z4(Q>>12&15|Q>>8&240,Q>>8&15|Q>>4&240,Q>>4&15|Q&240,((Q&15)<<4|Q&15)/255):null):(Q=F$.exec(_))?new L0(Q[1],Q[2],Q[3],1):(Q=H$.exec(_))?new L0(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,1):(Q=X$.exec(_))?Z4(Q[1],Q[2],Q[3],Q[4]):(Q=K$.exec(_))?Z4(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,Q[4]):(Q=Y$.exec(_))?a8(Q[1],Q[2]/100,Q[3]/100,1):(Q=L$.exec(_))?a8(Q[1],Q[2]/100,Q[3]/100,Q[4]):p8.hasOwnProperty(_)?r8(p8[_]):_==="transparent"?new L0(NaN,NaN,NaN,0):null}function r8(_){return new L0(_>>16&255,_>>8&255,_&255,1)}function Z4(_,Q,J,q){if(q<=0)_=Q=J=NaN;return new L0(_,Q,J,q)}function A$(_){if(!(_ instanceof f5))_=S0(_);if(!_)return new L0;return _=_.rgb(),new L0(_.r,_.g,_.b,_.opacity)}function o2(_,Q,J,q){return arguments.length===1?A$(_):new L0(_,Q,J,q==null?1:q)}function L0(_,Q,J,q){this.r=+_,this.g=+Q,this.b=+J,this.opacity=+q}P5(L0,o2,d3(f5,{brighter(_){return _=_==null?H4:Math.pow(H4,_),new L0(this.r*_,this.g*_,this.b*_,this.opacity)},darker(_){return _=_==null?N5:Math.pow(N5,_),new L0(this.r*_,this.g*_,this.b*_,this.opacity)},rgb(){return this},clamp(){return new L0(P2(this.r),P2(this.g),P2(this.b),X4(this.opacity))},displayable(){return-0.5<=this.r&&this.r<255.5&&(-0.5<=this.g&&this.g<255.5)&&(-0.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:i8,formatHex:i8,formatHex8:B$,formatRgb:d8,toString:d8}));function i8(){return`#${I2(this.r)}${I2(this.g)}${I2(this.b)}`}function B$(){return`#${I2(this.r)}${I2(this.g)}${I2(this.b)}${I2((isNaN(this.opacity)?1:this.opacity)*255)}`}function d8(){let _=X4(this.opacity);return`${_===1?"rgb(":"rgba("}${P2(this.r)}, ${P2(this.g)}, ${P2(this.b)}${_===1?")":`, ${_})`}`}function X4(_){return isNaN(_)?1:Math.max(0,Math.min(1,_))}function P2(_){return Math.max(0,Math.min(255,Math.round(_)||0))}function I2(_){return _=P2(_),(_<16?"0":"")+_.toString(16)}function a8(_,Q,J,q){if(q<=0)_=Q=J=NaN;else if(J<=0||J>=1)_=Q=NaN;else if(Q<=0)_=NaN;return new C0(_,Q,J,q)}function t8(_){if(_ instanceof C0)return new C0(_.h,_.s,_.l,_.opacity);if(!(_ instanceof f5))_=S0(_);if(!_)return new C0;if(_ instanceof C0)return _;_=_.rgb();var Q=_.r/255,J=_.g/255,q=_.b/255,U=Math.min(Q,J,q),G=Math.max(Q,J,q),Z=NaN,F=G-U,X=(G+U)/2;if(F){if(Q===G)Z=(J-q)/F+(J<q)*6;else if(J===G)Z=(q-Q)/F+2;else Z=(Q-J)/F+4;F/=X<0.5?G+U:2-G-U,Z*=60}else F=X>0&&X<1?0:Z;return new C0(Z,F,X,_.opacity)}function o8(_,Q,J,q){return arguments.length===1?t8(_):new C0(_,Q,J,q==null?1:q)}function C0(_,Q,J,q){this.h=+_,this.s=+Q,this.l=+J,this.opacity=+q}P5(C0,o8,d3(f5,{brighter(_){return _=_==null?H4:Math.pow(H4,_),new C0(this.h,this.s,this.l*_,this.opacity)},darker(_){return _=_==null?N5:Math.pow(N5,_),new C0(this.h,this.s,this.l*_,this.opacity)},rgb(){var _=this.h%360+(this.h<0)*360,Q=isNaN(_)||isNaN(this.s)?0:this.s,J=this.l,q=J+(J<0.5?J:1-J)*Q,U=2*J-q;return new L0(a3(_>=240?_-240:_+120,U,q),a3(_,U,q),a3(_<120?_+240:_-120,U,q),this.opacity)},clamp(){return new C0(s8(this.h),F4(this.s),F4(this.l),X4(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)},formatHsl(){let _=X4(this.opacity);return`${_===1?"hsl(":"hsla("}${s8(this.h)}, ${F4(this.s)*100}%, ${F4(this.l)*100}%${_===1?")":`, ${_})`}`}}));function s8(_){return _=(_||0)%360,_<0?_+360:_}function F4(_){return Math.max(0,Math.min(1,_||0))}function a3(_,Q,J){return(_<60?Q+(J-Q)*_/60:_<180?J:_<240?Q+(J-Q)*(240-_)/60:Q)*255}function s3(_,Q,J,q,U){var G=_*_,Z=G*_;return((1-3*_+3*G-Z)*Q+(4-6*G+3*Z)*J+(1+3*_+3*G-3*Z)*q+Z*U)/6}function t3(_){var Q=_.length-1;return function(J){var q=J<=0?J=0:J>=1?(J=1,Q-1):Math.floor(J*Q),U=_[q],G=_[q+1],Z=q>0?_[q-1]:2*U-G,F=q<Q-1?_[q+2]:2*G-U;return s3((J-q/Q)*Q,Z,U,G,F)}}function o3(_){var Q=_.length;return function(J){var q=Math.floor(((J%=1)<0?++J:J)*Q),U=_[(q+Q-1)%Q],G=_[q%Q],Z=_[(q+1)%Q],F=_[(q+2)%Q];return s3((J-q/Q)*Q,U,G,Z,F)}}var C5=(_)=>()=>_;function M$(_,Q){return function(J){return _+J*Q}}function T$(_,Q,J){return _=Math.pow(_,J),Q=Math.pow(Q,J)-_,J=1/J,function(q){return Math.pow(_+q*Q,J)}}function n8(_){return(_=+_)===1?K4:function(Q,J){return J-Q?T$(Q,J,_):C5(isNaN(Q)?J:Q)}}function K4(_,Q){var J=Q-_;return J?M$(_,J):C5(isNaN(_)?Q:_)}var N2=function _(Q){var J=n8(Q);function q(U,G){var Z=J((U=o2(U)).r,(G=o2(G)).r),F=J(U.g,G.g),X=J(U.b,G.b),Y=K4(U.opacity,G.opacity);return function(K){return U.r=Z(K),U.g=F(K),U.b=X(K),U.opacity=Y(K),U+""}}return q.gamma=_,q}(1);function e8(_){return function(Q){var J=Q.length,q=Array(J),U=Array(J),G=Array(J),Z,F;for(Z=0;Z<J;++Z)F=o2(Q[Z]),q[Z]=F.r||0,U[Z]=F.g||0,G[Z]=F.b||0;return q=_(q),U=_(U),G=_(G),F.opacity=1,function(X){return F.r=q(X),F.g=U(X),F.b=G(X),F+""}}}var R$=e8(t3),O$=e8(o3);function n3(_,Q){if(!Q)Q=[];var J=_?Math.min(Q.length,_.length):0,q=Q.slice(),U;return function(G){for(U=0;U<J;++U)q[U]=_[U]*(1-G)+Q[U]*G;return q}}function _7(_){return ArrayBuffer.isView(_)&&!(_ instanceof DataView)}function Q7(_,Q){var J=Q?Q.length:0,q=_?Math.min(J,_.length):0,U=Array(q),G=Array(J),Z;for(Z=0;Z<q;++Z)U[Z]=E0(_[Z],Q[Z]);for(;Z<J;++Z)G[Z]=Q[Z];return function(F){for(Z=0;Z<q;++Z)G[Z]=U[Z](F);return G}}function e3(_,Q){var J=new Date;return _=+_,Q=+Q,function(q){return J.setTime(_*(1-q)+Q*q),J}}function U0(_,Q){return _=+_,Q=+Q,function(J){return _*(1-J)+Q*J}}function _6(_,Q){var J={},q={},U;if(_===null||typeof _!=="object")_={};if(Q===null||typeof Q!=="object")Q={};for(U in Q)if(U in _)J[U]=E0(_[U],Q[U]);else q[U]=Q[U];return function(G){for(U in J)q[U]=J[U](G);return q}}var J6=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Q6=new RegExp(J6.source,"g");function I$(_){return function(){return _}}function P$(_){return function(Q){return _(Q)+""}}function n2(_,Q){var J=J6.lastIndex=Q6.lastIndex=0,q,U,G,Z=-1,F=[],X=[];_=_+"",Q=Q+"";while((q=J6.exec(_))&&(U=Q6.exec(Q))){if((G=U.index)>J)if(G=Q.slice(J,G),F[Z])F[Z]+=G;else F[++Z]=G;if((q=q[0])===(U=U[0]))if(F[Z])F[Z]+=U;else F[++Z]=U;else F[++Z]=null,X.push({i:Z,x:U0(q,U)});J=Q6.lastIndex}if(J<Q.length)if(G=Q.slice(J),F[Z])F[Z]+=G;else F[++Z]=G;return F.length<2?X[0]?P$(X[0].x):I$(Q):(Q=X.length,function(Y){for(var K=0,H;K<Q;++K)F[(H=X[K]).i]=H.x(Y);return F.join("")})}function E0(_,Q){var J=typeof Q,q;return Q==null||J==="boolean"?C5(Q):(J==="number"?U0:J==="string"?(q=S0(Q))?(Q=q,N2):n2:Q instanceof S0?N2:Q instanceof Date?e3:_7(Q)?n3:Array.isArray(Q)?Q7:typeof Q.valueOf!=="function"&&typeof Q.toString!=="function"||isNaN(Q)?_6:U0)(_,Q)}var J7=180/Math.PI,Y4={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function L4(_,Q,J,q,U,G){var Z,F,X;if(Z=Math.sqrt(_*_+Q*Q))_/=Z,Q/=Z;if(X=_*J+Q*q)J-=_*X,q-=Q*X;if(F=Math.sqrt(J*J+q*q))J/=F,q/=F,X/=F;if(_*q<Q*J)_=-_,Q=-Q,X=-X,Z=-Z;return{translateX:U,translateY:G,rotate:Math.atan2(Q,_)*J7,skewX:Math.atan(X)*J7,scaleX:Z,scaleY:F}}var z4;function $7(_){let Q=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(_+"");return Q.isIdentity?Y4:L4(Q.a,Q.b,Q.c,Q.d,Q.e,Q.f)}function q7(_){if(_==null)return Y4;if(!z4)z4=document.createElementNS("http://www.w3.org/2000/svg","g");if(z4.setAttribute("transform",_),!(_=z4.transform.baseVal.consolidate()))return Y4;return _=_.matrix,L4(_.a,_.b,_.c,_.d,_.e,_.f)}function U7(_,Q,J,q){function U(Y){return Y.length?Y.pop()+" ":""}function G(Y,K,H,L,z,W){if(Y!==H||K!==L){var I=z.push("translate(",null,Q,null,J);W.push({i:I-4,x:U0(Y,H)},{i:I-2,x:U0(K,L)})}else if(H||L)z.push("translate("+H+Q+L+J)}function Z(Y,K,H,L){if(Y!==K){if(Y-K>180)K+=360;else if(K-Y>180)Y+=360;L.push({i:H.push(U(H)+"rotate(",null,q)-2,x:U0(Y,K)})}else if(K)H.push(U(H)+"rotate("+K+q)}function F(Y,K,H,L){if(Y!==K)L.push({i:H.push(U(H)+"skewX(",null,q)-2,x:U0(Y,K)});else if(K)H.push(U(H)+"skewX("+K+q)}function X(Y,K,H,L,z,W){if(Y!==H||K!==L){var I=z.push(U(z)+"scale(",null,",",null,")");W.push({i:I-4,x:U0(Y,H)},{i:I-2,x:U0(K,L)})}else if(H!==1||L!==1)z.push(U(z)+"scale("+H+","+L+")")}return function(Y,K){var H=[],L=[];return Y=_(Y),K=_(K),G(Y.translateX,Y.translateY,K.translateX,K.translateY,H,L),Z(Y.rotate,K.rotate,H,L),F(Y.skewX,K.skewX,H,L),X(Y.scaleX,Y.scaleY,K.scaleX,K.scaleY,H,L),Y=K=null,function(z){var W=-1,I=L.length,R;while(++W<I)H[(R=L[W]).i]=R.x(z);return H.join("")}}}var $6=U7($7,"px, ","px)","deg)"),q6=U7(q7,", ",")",")");var N$=0.000000000001;function G7(_){return((_=Math.exp(_))+1/_)/2}function w$(_){return((_=Math.exp(_))-1/_)/2}function f$(_){return((_=Math.exp(2*_))-1)/(_+1)}var w2=function _(Q,J,q){function U(G,Z){var F=G[0],X=G[1],Y=G[2],K=Z[0],H=Z[1],L=Z[2],z=K-F,W=H-X,I=z*z+W*W,R,A;if(I<N$)A=Math.log(L/Y)/Q,R=function(f){return[F+f*z,X+f*W,Y*Math.exp(Q*f*A)]};else{var N=Math.sqrt(I),B=(L*L-Y*Y+q*I)/(2*Y*J*N),T=(L*L-Y*Y-q*I)/(2*L*J*N),O=Math.log(Math.sqrt(B*B+1)-B),C=Math.log(Math.sqrt(T*T+1)-T);A=(C-O)/Q,R=function(f){var S=f*A,w=G7(O),k=Y/(J*N)*(w*f$(Q*S+O)-w$(O));return[F+k*z,X+k*W,Y*w/G7(Q*S+O)]}}return R.duration=A*1000*Q/Math.SQRT2,R}return U.rho=function(G){var Z=Math.max(0.001,+G),F=Z*Z,X=F*F;return _(Z,F,X)},U}(Math.SQRT2,2,4);var e2=0,y5=0,S5=0,F7=1000,W4,k5,A4=0,f2=0,B4=0,v5=typeof performance==="object"&&performance.now?performance:Date,H7=typeof window==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(_){setTimeout(_,17)};function V5(){return f2||(H7(C$),f2=v5.now()+B4)}function C$(){f2=0}function j5(){this._call=this._time=this._next=null}j5.prototype=M4.prototype={constructor:j5,restart:function(_,Q,J){if(typeof _!=="function")throw TypeError("callback is not a function");if(J=(J==null?V5():+J)+(Q==null?0:+Q),!this._next&&k5!==this){if(k5)k5._next=this;else W4=this;k5=this}this._call=_,this._time=J,U6()},stop:function(){if(this._call)this._call=null,this._time=1/0,U6()}};function M4(_,Q,J){var q=new j5;return q.restart(_,Q,J),q}function X7(){V5(),++e2;var _=W4,Q;while(_){if((Q=f2-_._time)>=0)_._call.call(void 0,Q);_=_._next}--e2}function Z7(){f2=(A4=v5.now())+B4,e2=y5=0;try{X7()}finally{e2=0,y$(),f2=0}}function S$(){var _=v5.now(),Q=_-A4;if(Q>F7)B4-=Q,A4=_}function y$(){var _,Q=W4,J,q=1/0;while(Q)if(Q._call){if(q>Q._time)q=Q._time;_=Q,Q=Q._next}else J=Q._next,Q._next=null,Q=_?_._next=J:W4=J;k5=_,U6(q)}function U6(_){if(e2)return;if(y5)y5=clearTimeout(y5);var Q=_-f2;if(Q>24){if(_<1/0)y5=setTimeout(Z7,_-v5.now()-B4);if(S5)S5=clearInterval(S5)}else{if(!S5)A4=v5.now(),S5=setInterval(S$,F7);e2=1,H7(Z7)}}function u5(_,Q,J){var q=new j5;return Q=Q==null?0:+Q,q.restart((U)=>{q.stop(),_(U+Q)},Q,J),q}var k$=R2("start","end","cancel","interrupt"),v$=[],L7=0,K7=1,R4=2,T4=3,Y7=4,O4=5,h5=6;function s0(_,Q,J,q,U,G){var Z=_.__transition;if(!Z)_.__transition={};else if(J in Z)return;j$(_,J,{name:Q,index:q,group:U,on:k$,tween:v$,time:G.time,delay:G.delay,duration:G.duration,ease:G.ease,timer:null,state:L7})}function D5(_,Q){var J=n1(_,Q);if(J.state>L7)throw Error("too late; already scheduled");return J}function $0(_,Q){var J=n1(_,Q);if(J.state>T4)throw Error("too late; already running");return J}function n1(_,Q){var J=_.__transition;if(!J||!(J=J[Q]))throw Error("transition not found");return J}function j$(_,Q,J){var q=_.__transition,U;q[Q]=J,J.timer=M4(G,0,J.time);function G(Y){if(J.state=K7,J.timer.restart(Z,J.delay,J.time),J.delay<=Y)Z(Y-J.delay)}function Z(Y){var K,H,L,z;if(J.state!==K7)return X();for(K in q){if(z=q[K],z.name!==J.name)continue;if(z.state===T4)return u5(Z);if(z.state===Y7)z.state=h5,z.timer.stop(),z.on.call("interrupt",_,_.__data__,z.index,z.group),delete q[K];else if(+K<Q)z.state=h5,z.timer.stop(),z.on.call("cancel",_,_.__data__,z.index,z.group),delete q[K]}if(u5(function(){if(J.state===T4)J.state=Y7,J.timer.restart(F,J.delay,J.time),F(Y)}),J.state=R4,J.on.call("start",_,_.__data__,J.index,J.group),J.state!==R4)return;J.state=T4,U=Array(L=J.tween.length);for(K=0,H=-1;K<L;++K)if(z=J.tween[K].value.call(_,_.__data__,J.index,J.group))U[++H]=z;U.length=H+1}function F(Y){var K=Y<J.duration?J.ease.call(null,Y/J.duration):(J.timer.restart(X),J.state=O4,1),H=-1,L=U.length;while(++H<L)U[H].call(_,K);if(J.state===O4)J.on.call("end",_,_.__data__,J.index,J.group),X()}function X(){J.state=h5,J.timer.stop(),delete q[Q];for(var Y in q)return;delete _.__transition}}function H2(_,Q){var J=_.__transition,q,U,G=!0,Z;if(!J)return;Q=Q==null?null:Q+"";for(Z in J){if((q=J[Z]).name!==Q){G=!1;continue}U=q.state>R4&&q.state<O4,q.state=h5,q.timer.stop(),q.on.call(U?"interrupt":"cancel",_,_.__data__,q.index,q.group),delete J[Z]}if(G)delete _.__transition}function G6(_){return this.each(function(){H2(this,_)})}function V$(_,Q){var J,q;return function(){var U=$0(this,_),G=U.tween;if(G!==J){q=J=G;for(var Z=0,F=q.length;Z<F;++Z)if(q[Z].name===Q){q=q.slice(),q.splice(Z,1);break}}U.tween=q}}function u$(_,Q,J){var q,U;if(typeof J!=="function")throw Error();return function(){var G=$0(this,_),Z=G.tween;if(Z!==q){U=(q=Z).slice();for(var F={name:Q,value:J},X=0,Y=U.length;X<Y;++X)if(U[X].name===Q){U[X]=F;break}if(X===Y)U.push(F)}G.tween=U}}function Z6(_,Q){var J=this._id;if(_+="",arguments.length<2){var q=n1(this.node(),J).tween;for(var U=0,G=q.length,Z;U<G;++U)if((Z=q[U]).name===_)return Z.value;return null}return this.each((Q==null?V$:u$)(J,_,Q))}function _5(_,Q,J){var q=_._id;return _.each(function(){var U=$0(this,q);(U.value||(U.value={}))[Q]=J.apply(this,arguments)}),function(U){return n1(U,q).value[Q]}}function b5(_,Q){var J;return(typeof Q==="number"?U0:Q instanceof S0?N2:(J=S0(Q))?(Q=J,N2):n2)(_,Q)}function h$(_){return function(){this.removeAttribute(_)}}function D$(_){return function(){this.removeAttributeNS(_.space,_.local)}}function b$(_,Q,J){var q,U=J+"",G;return function(){var Z=this.getAttribute(_);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function E$(_,Q,J){var q,U=J+"",G;return function(){var Z=this.getAttributeNS(_.space,_.local);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function x$(_,Q,J){var q,U,G;return function(){var Z,F=J(this),X;if(F==null)return void this.removeAttribute(_);return Z=this.getAttribute(_),X=F+"",Z===X?null:Z===q&&X===U?G:(U=X,G=Q(q=Z,F))}}function m$(_,Q,J){var q,U,G;return function(){var Z,F=J(this),X;if(F==null)return void this.removeAttributeNS(_.space,_.local);return Z=this.getAttributeNS(_.space,_.local),X=F+"",Z===X?null:Z===q&&X===U?G:(U=X,G=Q(q=Z,F))}}function F6(_,Q){var J=D0(_),q=J==="transform"?q6:b5;return this.attrTween(_,typeof Q==="function"?(J.local?m$:x$)(J,q,_5(this,"attr."+_,Q)):Q==null?(J.local?D$:h$)(J):(J.local?E$:b$)(J,q,Q))}function g$(_,Q){return function(J){this.setAttribute(_,Q.call(this,J))}}function p$(_,Q){return function(J){this.setAttributeNS(_.space,_.local,Q.call(this,J))}}function c$(_,Q){var J,q;function U(){var G=Q.apply(this,arguments);if(G!==q)J=(q=G)&&p$(_,G);return J}return U._value=Q,U}function l$(_,Q){var J,q;function U(){var G=Q.apply(this,arguments);if(G!==q)J=(q=G)&&g$(_,G);return J}return U._value=Q,U}function H6(_,Q){var J="attr."+_;if(arguments.length<2)return(J=this.tween(J))&&J._value;if(Q==null)return this.tween(J,null);if(typeof Q!=="function")throw Error();var q=D0(_);return this.tween(J,(q.local?c$:l$)(q,Q))}function r$(_,Q){return function(){D5(this,_).delay=+Q.apply(this,arguments)}}function i$(_,Q){return Q=+Q,function(){D5(this,_).delay=Q}}function X6(_){var Q=this._id;return arguments.length?this.each((typeof _==="function"?r$:i$)(Q,_)):n1(this.node(),Q).delay}function d$(_,Q){return function(){$0(this,_).duration=+Q.apply(this,arguments)}}function a$(_,Q){return Q=+Q,function(){$0(this,_).duration=Q}}function K6(_){var Q=this._id;return arguments.length?this.each((typeof _==="function"?d$:a$)(Q,_)):n1(this.node(),Q).duration}function s$(_,Q){if(typeof Q!=="function")throw Error();return function(){$0(this,_).ease=Q}}function Y6(_){var Q=this._id;return arguments.length?this.each(s$(Q,_)):n1(this.node(),Q).ease}function t$(_,Q){return function(){var J=Q.apply(this,arguments);if(typeof J!=="function")throw Error();$0(this,_).ease=J}}function L6(_){if(typeof _!=="function")throw Error();return this.each(t$(this._id,_))}function z6(_){if(typeof _!=="function")_=d2(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=[],X,Y=0;Y<Z;++Y)if((X=G[Y])&&_.call(X,X.__data__,Y,G))F.push(X);return new H0(q,this._parents,this._name,this._id)}function W6(_){if(_._id!==this._id)throw Error();for(var Q=this._groups,J=_._groups,q=Q.length,U=J.length,G=Math.min(q,U),Z=Array(q),F=0;F<G;++F)for(var X=Q[F],Y=J[F],K=X.length,H=Z[F]=Array(K),L,z=0;z<K;++z)if(L=X[z]||Y[z])H[z]=L;for(;F<q;++F)Z[F]=Q[F];return new H0(Z,this._parents,this._name,this._id)}function o$(_){return(_+"").trim().split(/^|\s+/).every(function(Q){var J=Q.indexOf(".");if(J>=0)Q=Q.slice(0,J);return!Q||Q==="start"})}function n$(_,Q,J){var q,U,G=o$(Q)?D5:$0;return function(){var Z=G(this,_),F=Z.on;if(F!==q)(U=(q=F).copy()).on(Q,J);Z.on=U}}function A6(_,Q){var J=this._id;return arguments.length<2?n1(this.node(),J).on.on(_):this.each(n$(J,_,Q))}function e$(_){return function(){var Q=this.parentNode;for(var J in this.__transition)if(+J!==_)return;if(Q)Q.removeChild(this)}}function B6(){return this.on("end.remove",e$(this._id))}function M6(_){var Q=this._name,J=this._id;if(typeof _!=="function")_=Z2(_);for(var q=this._groups,U=q.length,G=Array(U),Z=0;Z<U;++Z)for(var F=q[Z],X=F.length,Y=G[Z]=Array(X),K,H,L=0;L<X;++L)if((K=F[L])&&(H=_.call(K,K.__data__,L,F))){if("__data__"in K)H.__data__=K.__data__;Y[L]=H,s0(Y[L],Q,J,L,Y,n1(K,J))}return new H0(G,this._parents,Q,J)}function T6(_){var Q=this._name,J=this._id;if(typeof _!=="function")_=a2(_);for(var q=this._groups,U=q.length,G=[],Z=[],F=0;F<U;++F)for(var X=q[F],Y=X.length,K,H=0;H<Y;++H)if(K=X[H]){for(var L=_.call(K,K.__data__,H,X),z,W=n1(K,J),I=0,R=L.length;I<R;++I)if(z=L[I])s0(z,Q,J,I,L,W);G.push(L),Z.push(K)}return new H0(G,Z,Q,J)}var _q=d0.prototype.constructor;function R6(){return new _q(this._groups,this._parents)}function Qq(_,Q){var J,q,U;return function(){var G=F2(this,_),Z=(this.style.removeProperty(_),F2(this,_));return G===Z?null:G===J&&Z===q?U:U=Q(J=G,q=Z)}}function z7(_){return function(){this.style.removeProperty(_)}}function Jq(_,Q,J){var q,U=J+"",G;return function(){var Z=F2(this,_);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function $q(_,Q,J){var q,U,G;return function(){var Z=F2(this,_),F=J(this),X=F+"";if(F==null)X=F=(this.style.removeProperty(_),F2(this,_));return Z===X?null:Z===q&&X===U?G:(U=X,G=Q(q=Z,F))}}function qq(_,Q){var J,q,U,G="style."+Q,Z="end."+G,F;return function(){var X=$0(this,_),Y=X.on,K=X.value[G]==null?F||(F=z7(Q)):void 0;if(Y!==J||U!==K)(q=(J=Y).copy()).on(Z,U=K);X.on=q}}function O6(_,Q,J){var q=(_+="")==="transform"?$6:b5;return Q==null?this.styleTween(_,Qq(_,q)).on("end.style."+_,z7(_)):typeof Q==="function"?this.styleTween(_,$q(_,q,_5(this,"style."+_,Q))).each(qq(this._id,_)):this.styleTween(_,Jq(_,q,Q),J).on("end.style."+_,null)}function Uq(_,Q,J){return function(q){this.style.setProperty(_,Q.call(this,q),J)}}function Gq(_,Q,J){var q,U;function G(){var Z=Q.apply(this,arguments);if(Z!==U)q=(U=Z)&&Uq(_,Z,J);return q}return G._value=Q,G}function I6(_,Q,J){var q="style."+(_+="");if(arguments.length<2)return(q=this.tween(q))&&q._value;if(Q==null)return this.tween(q,null);if(typeof Q!=="function")throw Error();return this.tween(q,Gq(_,Q,J==null?"":J))}function Zq(_){return function(){this.textContent=_}}function Fq(_){return function(){var Q=_(this);this.textContent=Q==null?"":Q}}function P6(_){return this.tween("text",typeof _==="function"?Fq(_5(this,"text",_)):Zq(_==null?"":_+""))}function Hq(_){return function(Q){this.textContent=_.call(this,Q)}}function Xq(_){var Q,J;function q(){var U=_.apply(this,arguments);if(U!==J)Q=(J=U)&&Hq(U);return Q}return q._value=_,q}function N6(_){var Q="text";if(arguments.length<1)return(Q=this.tween(Q))&&Q._value;if(_==null)return this.tween(Q,null);if(typeof _!=="function")throw Error();return this.tween(Q,Xq(_))}function w6(){var _=this._name,Q=this._id,J=I4();for(var q=this._groups,U=q.length,G=0;G<U;++G)for(var Z=q[G],F=Z.length,X,Y=0;Y<F;++Y)if(X=Z[Y]){var K=n1(X,Q);s0(X,_,J,Y,Z,{time:K.time+K.delay+K.duration,delay:0,duration:K.duration,ease:K.ease})}return new H0(q,this._parents,_,J)}function f6(){var _,Q,J=this,q=J._id,U=J.size();return new Promise(function(G,Z){var F={value:Z},X={value:function(){if(--U===0)G()}};if(J.each(function(){var Y=$0(this,q),K=Y.on;if(K!==_)Q=(_=K).copy(),Q._.cancel.push(F),Q._.interrupt.push(F),Q._.end.push(X);Y.on=Q}),U===0)G()})}var Kq=0;function H0(_,Q,J,q){this._groups=_,this._parents=Q,this._name=J,this._id=q}function W7(_){return d0().transition(_)}function I4(){return++Kq}var t0=d0.prototype;H0.prototype=W7.prototype={constructor:H0,select:M6,selectAll:T6,selectChild:t0.selectChild,selectChildren:t0.selectChildren,filter:z6,merge:W6,selection:R6,transition:w6,call:t0.call,nodes:t0.nodes,node:t0.node,size:t0.size,empty:t0.empty,each:t0.each,on:A6,attr:F6,attrTween:H6,style:O6,styleTween:I6,text:P6,textTween:N6,remove:B6,tween:Z6,delay:X6,duration:K6,ease:Y6,easeVarying:L6,end:f6,[Symbol.iterator]:t0[Symbol.iterator]};function P4(_){return((_*=2)<=1?_*_*_:(_-=2)*_*_+2)/2}var Yq={time:null,delay:0,duration:250,ease:P4};function Lq(_,Q){var J;while(!(J=_.__transition)||!(J=J[Q]))if(!(_=_.parentNode))throw Error(`transition ${Q} not found`);return J}function C6(_){var Q,J;if(_ instanceof H0)Q=_._id,_=_._name;else Q=I4(),(J=Yq).time=V5(),_=_==null?null:_+"";for(var q=this._groups,U=q.length,G=0;G<U;++G)for(var Z=q[G],F=Z.length,X,Y=0;Y<F;++Y)if(X=Z[Y])s0(X,_,Q,Y,Z,J||Lq(X,Q));return new H0(q,this._parents,_,Q)}d0.prototype.interrupt=G6;d0.prototype.transition=C6;var E5=(_)=>()=>_;function S6(_,{sourceEvent:Q,target:J,transform:q,dispatch:U}){Object.defineProperties(this,{type:{value:_,enumerable:!0,configurable:!0},sourceEvent:{value:Q,enumerable:!0,configurable:!0},target:{value:J,enumerable:!0,configurable:!0},transform:{value:q,enumerable:!0,configurable:!0},_:{value:U}})}function y0(_,Q,J){this.k=_,this.x=Q,this.y=J}y0.prototype={constructor:y0,scale:function(_){return _===1?this:new y0(this.k*_,this.x,this.y)},translate:function(_,Q){return _===0&Q===0?this:new y0(this.k,this.x+this.k*_,this.y+this.k*Q)},apply:function(_){return[_[0]*this.k+this.x,_[1]*this.k+this.y]},applyX:function(_){return _*this.k+this.x},applyY:function(_){return _*this.k+this.y},invert:function(_){return[(_[0]-this.x)/this.k,(_[1]-this.y)/this.k]},invertX:function(_){return(_-this.x)/this.k},invertY:function(_){return(_-this.y)/this.k},rescaleX:function(_){return _.copy().domain(_.range().map(this.invertX,this).map(_.invert,_))},rescaleY:function(_){return _.copy().domain(_.range().map(this.invertY,this).map(_.invert,_))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var C2=new y0(1,0,0);x5.prototype=y0.prototype;function x5(_){while(!_.__zoom)if(!(_=_.parentNode))return C2;return _.__zoom}function N4(_){_.stopImmediatePropagation()}function S2(_){_.preventDefault(),_.stopImmediatePropagation()}function zq(_){return(!_.ctrlKey||_.type==="wheel")&&!_.button}function Wq(){var _=this;if(_ instanceof SVGElement){if(_=_.ownerSVGElement||_,_.hasAttribute("viewBox"))return _=_.viewBox.baseVal,[[_.x,_.y],[_.x+_.width,_.y+_.height]];return[[0,0],[_.width.baseVal.value,_.height.baseVal.value]]}return[[0,0],[_.clientWidth,_.clientHeight]]}function A7(){return this.__zoom||C2}function Aq(_){return-_.deltaY*(_.deltaMode===1?0.05:_.deltaMode?1:0.002)*(_.ctrlKey?10:1)}function Bq(){return navigator.maxTouchPoints||"ontouchstart"in this}function Mq(_,Q,J){var q=_.invertX(Q[0][0])-J[0][0],U=_.invertX(Q[1][0])-J[1][0],G=_.invertY(Q[0][1])-J[0][1],Z=_.invertY(Q[1][1])-J[1][1];return _.translate(U>q?(q+U)/2:Math.min(0,q)||Math.max(0,U),Z>G?(G+Z)/2:Math.min(0,G)||Math.max(0,Z))}function m5(){var _=zq,Q=Wq,J=Mq,q=Aq,U=Bq,G=[0,1/0],Z=[[-1/0,-1/0],[1/0,1/0]],F=250,X=w2,Y=R2("start","zoom","end"),K,H,L,z=500,W=150,I=0,R=10;function A(y){y.property("__zoom",A7).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",w).on("dblclick.zoom",k).filter(U).on("touchstart.zoom",E).on("touchmove.zoom",l).on("touchend.zoom touchcancel.zoom",c).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}A.transform=function(y,D,v,x){var V=y.selection?y.selection():y;if(V.property("__zoom",A7),y!==V)O(y,D,v,x);else V.interrupt().each(function(){C(this,arguments).event(x).start().zoom(null,typeof D==="function"?D.apply(this,arguments):D).end()})},A.scaleBy=function(y,D,v,x){A.scaleTo(y,function(){var V=this.__zoom.k,b=typeof D==="function"?D.apply(this,arguments):D;return V*b},v,x)},A.scaleTo=function(y,D,v,x){A.transform(y,function(){var V=Q.apply(this,arguments),b=this.__zoom,P=v==null?T(V):typeof v==="function"?v.apply(this,arguments):v,j=b.invert(P),m=typeof D==="function"?D.apply(this,arguments):D;return J(B(N(b,m),P,j),V,Z)},v,x)},A.translateBy=function(y,D,v,x){A.transform(y,function(){return J(this.__zoom.translate(typeof D==="function"?D.apply(this,arguments):D,typeof v==="function"?v.apply(this,arguments):v),Q.apply(this,arguments),Z)},null,x)},A.translateTo=function(y,D,v,x,V){A.transform(y,function(){var b=Q.apply(this,arguments),P=this.__zoom,j=x==null?T(b):typeof x==="function"?x.apply(this,arguments):x;return J(C2.translate(j[0],j[1]).scale(P.k).translate(typeof D==="function"?-D.apply(this,arguments):-D,typeof v==="function"?-v.apply(this,arguments):-v),b,Z)},x,V)};function N(y,D){return D=Math.max(G[0],Math.min(G[1],D)),D===y.k?y:new y0(D,y.x,y.y)}function B(y,D,v){var x=D[0]-v[0]*y.k,V=D[1]-v[1]*y.k;return x===y.x&&V===y.y?y:new y0(y.k,x,V)}function T(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function O(y,D,v,x){y.on("start.zoom",function(){C(this,arguments).event(x).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(x).end()}).tween("zoom",function(){var V=this,b=arguments,P=C(V,b).event(x),j=Q.apply(V,b),m=v==null?T(j):typeof v==="function"?v.apply(V,b):v,h=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),o=V.__zoom,e=typeof D==="function"?D.apply(V,b):D,s=X(o.invert(m).concat(h/o.k),e.invert(m).concat(h/e.k));return function(t){if(t===1)t=e;else{var p=s(t),n=h/p[2];t=new y0(n,m[0]-p[0]*n,m[1]-p[1]*n)}P.zoom(null,t)}})}function C(y,D,v){return!v&&y.__zooming||new f(y,D)}function f(y,D){this.that=y,this.args=D,this.active=0,this.sourceEvent=null,this.extent=Q.apply(y,D),this.taps=0}f.prototype={event:function(y){if(y)this.sourceEvent=y;return this},start:function(){if(++this.active===1)this.that.__zooming=this,this.emit("start");return this},zoom:function(y,D){if(this.mouse&&y!=="mouse")this.mouse[1]=D.invert(this.mouse[0]);if(this.touch0&&y!=="touch")this.touch0[1]=D.invert(this.touch0[0]);if(this.touch1&&y!=="touch")this.touch1[1]=D.invert(this.touch1[0]);return this.that.__zoom=D,this.emit("zoom"),this},end:function(){if(--this.active===0)delete this.that.__zooming,this.emit("end");return this},emit:function(y){var D=o1(this.that).datum();Y.call(y,this.that,new S6(y,{sourceEvent:this.sourceEvent,target:A,type:y,transform:this.that.__zoom,dispatch:Y}),D)}};function S(y,...D){if(!_.apply(this,arguments))return;var v=C(this,D).event(y),x=this.__zoom,V=Math.max(G[0],Math.min(G[1],x.k*Math.pow(2,q.apply(this,arguments)))),b=q0(y);if(v.wheel){if(v.mouse[0][0]!==b[0]||v.mouse[0][1]!==b[1])v.mouse[1]=x.invert(v.mouse[0]=b);clearTimeout(v.wheel)}else if(x.k===V)return;else v.mouse=[b,x.invert(b)],H2(this),v.start();S2(y),v.wheel=setTimeout(P,W),v.zoom("mouse",J(B(N(x,V),v.mouse[0],v.mouse[1]),v.extent,Z));function P(){v.wheel=null,v.end()}}function w(y,...D){if(L||!_.apply(this,arguments))return;var v=y.currentTarget,x=C(this,D,!0).event(y),V=o1(y.view).on("mousemove.zoom",m,!0).on("mouseup.zoom",h,!0),b=q0(y,v),P=y.clientX,j=y.clientY;s2(y.view),N4(y),x.mouse=[b,this.__zoom.invert(b)],H2(this),x.start();function m(o){if(S2(o),!x.moved){var e=o.clientX-P,s=o.clientY-j;x.moved=e*e+s*s>I}x.event(o).zoom("mouse",J(B(x.that.__zoom,x.mouse[0]=q0(o,v),x.mouse[1]),x.extent,Z))}function h(o){V.on("mousemove.zoom mouseup.zoom",null),T5(o.view,x.moved),S2(o),x.event(o).end()}}function k(y,...D){if(!_.apply(this,arguments))return;var v=this.__zoom,x=q0(y.changedTouches?y.changedTouches[0]:y,this),V=v.invert(x),b=v.k*(y.shiftKey?0.5:2),P=J(B(N(v,b),x,V),Q.apply(this,D),Z);if(S2(y),F>0)o1(this).transition().duration(F).call(O,P,x,y);else o1(this).call(A.transform,P,x,y)}function E(y,...D){if(!_.apply(this,arguments))return;var v=y.touches,x=v.length,V=C(this,D,y.changedTouches.length===x).event(y),b,P,j,m;N4(y);for(P=0;P<x;++P)if(j=v[P],m=q0(j,this),m=[m,this.__zoom.invert(m),j.identifier],!V.touch0)V.touch0=m,b=!0,V.taps=1+!!K;else if(!V.touch1&&V.touch0[2]!==m[2])V.touch1=m,V.taps=0;if(K)K=clearTimeout(K);if(b){if(V.taps<2)H=m[0],K=setTimeout(function(){K=null},z);H2(this),V.start()}}function l(y,...D){if(!this.__zooming)return;var v=C(this,D).event(y),x=y.changedTouches,V=x.length,b,P,j,m;S2(y);for(b=0;b<V;++b)if(P=x[b],j=q0(P,this),v.touch0&&v.touch0[2]===P.identifier)v.touch0[0]=j;else if(v.touch1&&v.touch1[2]===P.identifier)v.touch1[0]=j;if(P=v.that.__zoom,v.touch1){var h=v.touch0[0],o=v.touch0[1],e=v.touch1[0],s=v.touch1[1],t=(t=e[0]-h[0])*t+(t=e[1]-h[1])*t,p=(p=s[0]-o[0])*p+(p=s[1]-o[1])*p;P=N(P,Math.sqrt(t/p)),j=[(h[0]+e[0])/2,(h[1]+e[1])/2],m=[(o[0]+s[0])/2,(o[1]+s[1])/2]}else if(v.touch0)j=v.touch0[0],m=v.touch0[1];else return;v.zoom("touch",J(B(P,j,m),v.extent,Z))}function c(y,...D){if(!this.__zooming)return;var v=C(this,D).event(y),x=y.changedTouches,V=x.length,b,P;if(N4(y),L)clearTimeout(L);L=setTimeout(function(){L=null},z);for(b=0;b<V;++b)if(P=x[b],v.touch0&&v.touch0[2]===P.identifier)delete v.touch0;else if(v.touch1&&v.touch1[2]===P.identifier)delete v.touch1;if(v.touch1&&!v.touch0)v.touch0=v.touch1,delete v.touch1;if(v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2){if(P=q0(P,this),Math.hypot(H[0]-P[0],H[1]-P[1])<R){var j=o1(this).on("dblclick.zoom");if(j)j.apply(this,arguments)}}}return A.wheelDelta=function(y){return arguments.length?(q=typeof y==="function"?y:E5(+y),A):q},A.filter=function(y){return arguments.length?(_=typeof y==="function"?y:E5(!!y),A):_},A.touchable=function(y){return arguments.length?(U=typeof y==="function"?y:E5(!!y),A):U},A.extent=function(y){return arguments.length?(Q=typeof y==="function"?y:E5([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),A):Q},A.scaleExtent=function(y){return arguments.length?(G[0]=+y[0],G[1]=+y[1],A):[G[0],G[1]]},A.translateExtent=function(y){return arguments.length?(Z[0][0]=+y[0][0],Z[1][0]=+y[1][0],Z[0][1]=+y[0][1],Z[1][1]=+y[1][1],A):[[Z[0][0],Z[0][1]],[Z[1][0],Z[1][1]]]},A.constrain=function(y){return arguments.length?(J=y,A):J},A.duration=function(y){return arguments.length?(F=+y,A):F},A.interpolate=function(y){return arguments.length?(X=y,A):X},A.on=function(){var y=Y.on.apply(Y,arguments);return y===Y?A:y},A.clickDistance=function(y){return arguments.length?(I=(y=+y)*y,A):Math.sqrt(I)},A.tapDistance=function(y){return arguments.length?(R=+y,A):R},A}var X0={error001:(_="react")=>`Seems like you have not used ${_==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${_}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:(_)=>`Node type "${_}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:(_)=>`The old edge with id=${_} does not exist.`,error009:(_)=>`Marker type "${_}" doesn't exist.`,error008:(_,{id:Q,sourceHandle:J,targetHandle:q})=>`Couldn't create edge for ${_} handle id: "${_==="source"?J:q}", edge id: ${Q}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:(_)=>`Edge type "${_}" not found. Using fallback type "default".`,error012:(_)=>`Node with id "${_}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(_="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${_}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:(_)=>`Edge with id "${_}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},q5=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],V6=["Enter"," ","Escape"],u6={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:_,x:Q,y:J})=>`Moved selected node ${_}. New position, x: ${Q}, y: ${J}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},L2;(function(_){_.Strict="strict",_.Loose="loose"})(L2||(L2={}));var o0;(function(_){_.Free="free",_.Vertical="vertical",_.Horizontal="horizontal"})(o0||(o0={}));var y2;(function(_){_.Partial="partial",_.Full="full"})(y2||(y2={}));var h6={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},x0;(function(_){_.Bezier="default",_.Straight="straight",_.Step="step",_.SmoothStep="smoothstep",_.SimpleBezier="simplebezier"})(x0||(x0={}));var J5;(function(_){_.Arrow="arrow",_.ArrowClosed="arrowclosed"})(J5||(J5={}));var X1;(function(_){_.Left="left",_.Top="top",_.Right="right",_.Bottom="bottom"})(X1||(X1={}));var B7={[X1.Left]:X1.Right,[X1.Right]:X1.Left,[X1.Top]:X1.Bottom,[X1.Bottom]:X1.Top},D6=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("source"in _)&&("target"in _),v7=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("position"in _)&&!("source"in _)&&!("target"in _),b6=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("internals"in _)&&!("source"in _)&&!("target"in _);var p5=(_,Q=[0,0])=>{let{width:J,height:q}=I0(_),U=_.origin??Q,G=J*U[0],Z=q*U[1];return{x:_.position.x-G,y:_.position.y-Z}},E6=(_,Q={nodeOrigin:[0,0]})=>{if(!Q.nodeLookup)console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows.");if(_.length===0)return{x:0,y:0,width:0,height:0};let J=!1,q=_.reduce((U,G)=>{let Z=typeof G==="string",F=!Q.nodeLookup&&!Z?G:void 0;if(Q.nodeLookup)F=Z?Q.nodeLookup.get(G):!b6(G)?Q.nodeLookup.get(G.id):G;if(!F)return U;return J=!0,k4(U,C4(F,Q.nodeOrigin))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return J?v4(q):{x:0,y:0,width:0,height:0}},V2=(_,Q={})=>{let J={x:1/0,y:1/0,x2:-1/0,y2:-1/0},q=!1;return _.forEach((U)=>{if(Q.filter===void 0||Q.filter(U))J=k4(J,C4(U)),q=!0}),q?v4(J):{x:0,y:0,width:0,height:0}},S4=(_,Q,[J,q,U]=[0,0,1],G=!1,Z=!1)=>{let F=(Q.x-J)/U,X=(Q.y-q)/U,Y=Q.width/U,K=Q.height/U,H=[];for(let L of _.values()){let{measured:z,selectable:W=!0,hidden:I=!1}=L;if(Z&&!W||I)continue;let R=z.width??L.width??L.initialWidth??0,A=z.height??L.height??L.initialHeight??0,{x:N,y:B}=L.internals.positionAbsolute,T=D7(F,X,Y,K,N,B,R,A),O=R*A,C=G&&T>0;if(!L.internals.handleBounds||C||T>=O||L.dragging)H.push(L)}return H},j7=(_,Q)=>{let J=new Set;return _.forEach((q)=>{J.add(q.id)}),Q.filter((q)=>J.has(q.source)||J.has(q.target))};function Tq(_,Q){let J=new Map,q=Q?.nodes?new Set(Q.nodes.map((U)=>U.id)):null;return _.forEach((U)=>{let G;if(Q?.includeHiddenNodes){let{width:Z,height:F}=I0(U);G=Z>0&&F>0}else G=Boolean(U.measured.width&&U.measured.height&&!U.hidden);if(G&&(!q||q.has(U.id)))J.set(U.id,U)}),J}async function V7({nodes:_,width:Q,height:J,panZoom:q,minZoom:U,maxZoom:G},Z){if(_.size===0)return!0;let F=Tq(_,Z),X=V2(F),Y=l5(X,Q,J,Z?.minZoom??U,Z?.maxZoom??G,Z?.padding??0.1);return await q.setViewport(Y,{duration:Z?.duration,ease:Z?.ease,interpolate:Z?.interpolate}),!0}function x6({nodeId:_,nextPosition:Q,nodeLookup:J,nodeOrigin:q=[0,0],nodeExtent:U,onError:G}){let Z=J.get(_),F=Z.parentId?J.get(Z.parentId):void 0,{x:X,y:Y}=F?F.internals.positionAbsolute:{x:0,y:0},K=Z.origin??q,H=Z.extent||U;if(Z.extent==="parent"&&!Z.expandParent)if(!F)G?.("005",X0.error005());else{let{width:z,height:W}=I0(F);if(z&&W)H=[[X,Y],[X+z,Y+W]]}else if(F&&j2(Z.extent))H=[[Z.extent[0][0]+X,Z.extent[0][1]+Y],[Z.extent[1][0]+X,Z.extent[1][1]+Y]];let L=j2(H)?k2(Q,H,Z.measured):Q;if(Z.measured.width===void 0||Z.measured.height===void 0)G?.("015",X0.error015());return{position:{x:L.x-X+(Z.measured.width??0)*K[0],y:L.y-Y+(Z.measured.height??0)*K[1]},positionAbsolute:L}}async function u7({nodesToRemove:_=[],edgesToRemove:Q=[],nodes:J,edges:q,onBeforeDelete:U}){let G=new Set(_.map((L)=>L.id)),Z=[];for(let L of J){if(L.deletable===!1)continue;let z=G.has(L.id),W=!z&&L.parentId&&Z.find((I)=>I.id===L.parentId);if(z||W)Z.push(L)}let F=new Set(Q.map((L)=>L.id)),X=q.filter((L)=>L.deletable!==!1),K=j7(Z,X);for(let L of X)if(F.has(L.id)&&!K.find((W)=>W.id===L.id))K.push(L);if(!U)return{edges:K,nodes:Z};let H=await U({nodes:Z,edges:K});if(typeof H==="boolean")return H?{edges:K,nodes:Z}:{edges:[],nodes:[]};return H}var $5=(_,Q=0,J=1)=>Math.min(Math.max(_,Q),J),k2=(_={x:0,y:0},Q,J)=>({x:$5(_.x,Q[0][0],Q[1][0]-(J?.width??0)),y:$5(_.y,Q[0][1],Q[1][1]-(J?.height??0))});function h7(_,Q,J){let{width:q,height:U}=I0(J),{x:G,y:Z}=J.internals.positionAbsolute;return k2(_,[[G,Z],[G+q,Z+U]],Q)}var M7=(_,Q,J)=>{if(_<Q)return $5(Math.abs(_-Q),1,Q)/Q;else if(_>J)return-$5(Math.abs(_-J),1,Q)/Q;return 0},y4=(_,Q,J=15,q=40)=>{let U=M7(_.x,q,Q.width-q)*J,G=M7(_.y,q,Q.height-q)*J;return[U,G]},k4=(_,Q)=>({x:Math.min(_.x,Q.x),y:Math.min(_.y,Q.y),x2:Math.max(_.x2,Q.x2),y2:Math.max(_.y2,Q.y2)}),j6=({x:_,y:Q,width:J,height:q})=>({x:_,y:Q,x2:_+J,y2:Q+q}),v4=({x:_,y:Q,x2:J,y2:q})=>({x:_,y:Q,width:J-_,height:q-Q}),U5=(_,Q=[0,0])=>{let{x:J,y:q}=b6(_)?_.internals.positionAbsolute:p5(_,Q);return{x:J,y:q,width:_.measured?.width??_.width??_.initialWidth??0,height:_.measured?.height??_.height??_.initialHeight??0}},C4=(_,Q=[0,0])=>{let{x:J,y:q}=b6(_)?_.internals.positionAbsolute:p5(_,Q);return{x:J,y:q,x2:J+(_.measured?.width??_.width??_.initialWidth??0),y2:q+(_.measured?.height??_.height??_.initialHeight??0)}},m6=(_,Q)=>v4(k4(j6(_),j6(Q))),D7=(_,Q,J,q,U,G,Z,F)=>{let X=Math.max(0,Math.min(_+J,U+Z)-Math.max(_,U)),Y=Math.max(0,Math.min(Q+q,G+F)-Math.max(Q,G));return Math.ceil(X*Y)},c5=(_,Q)=>D7(_.x,_.y,_.width,_.height,Q.x,Q.y,Q.width,Q.height),g6=(_)=>R0(_.width)&&R0(_.height)&&R0(_.x)&&R0(_.y),R0=(_)=>!isNaN(_)&&isFinite(_),p6=(_,Q)=>(J,q)=>{console.warn(`[${_}]: ${q} Help: ${Q}error#${J}`)},G5=(_,Q=[1,1])=>{return{x:Q[0]*Math.round(_.x/Q[0]),y:Q[1]*Math.round(_.y/Q[1])}},Z5=({x:_,y:Q},[J,q,U],G=!1,Z=[1,1])=>{let F={x:(_-J)/U,y:(Q-q)/U};return G?G5(F,Z):F},v2=({x:_,y:Q},[J,q,U])=>{return{x:_*U+J,y:Q*U+q}};function Q5(_,Q){if(typeof _==="number")return Math.floor((Q-Q/(1+_))*0.5);if(typeof _==="string"&&_.endsWith("px")){let J=parseFloat(_);if(!Number.isNaN(J))return Math.floor(J)}if(typeof _==="string"&&_.endsWith("%")){let J=parseFloat(_);if(!Number.isNaN(J))return Math.floor(Q*J*0.01)}return console.error(`The padding value "${_}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Rq(_,Q,J){if(typeof _==="string"||typeof _==="number"){let q=Q5(_,J),U=Q5(_,Q);return{top:q,right:U,bottom:q,left:U,x:U*2,y:q*2}}if(typeof _==="object"){let q=Q5(_.top??_.y??0,J),U=Q5(_.bottom??_.y??0,J),G=Q5(_.left??_.x??0,Q),Z=Q5(_.right??_.x??0,Q);return{top:q,right:Z,bottom:U,left:G,x:G+Z,y:q+U}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Oq(_,Q,J,q,U,G){let{x:Z,y:F}=v2(_,[Q,J,q]),{x:X,y:Y}=v2({x:_.x+_.width,y:_.y+_.height},[Q,J,q]),K=U-X,H=G-Y;return{left:Math.floor(Z),top:Math.floor(F),right:Math.floor(K),bottom:Math.floor(H)}}var l5=(_,Q,J,q,U,G)=>{let Z=Rq(G,Q,J),F=(Q-Z.x)/_.width,X=(J-Z.y)/_.height,Y=Math.min(F,X),K=$5(Y,q,U),H=_.x+_.width/2,L=_.y+_.height/2,z=Q/2-H*K,W=J/2-L*K,I=Oq(_,z,W,K,Q,J),R={left:Math.min(I.left-Z.left,0),top:Math.min(I.top-Z.top,0),right:Math.min(I.right-Z.right,0),bottom:Math.min(I.bottom-Z.bottom,0)};return{x:z-R.left+R.right,y:W-R.top+R.bottom,zoom:K}},F5=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function j2(_){return _!==void 0&&_!==null&&_!=="parent"}function I0(_){return{width:_.measured?.width??_.width??_.initialWidth??0,height:_.measured?.height??_.height??_.initialHeight??0}}function c6(_){return(_.measured?.width??_.width??_.initialWidth)!==void 0&&(_.measured?.height??_.height??_.initialHeight)!==void 0}function l6(_,Q={width:0,height:0},J,q,U){let G={..._},Z=q.get(J);if(Z){let F=Z.origin||U;G.x+=Z.internals.positionAbsolute.x-(Q.width??0)*F[0],G.y+=Z.internals.positionAbsolute.y-(Q.height??0)*F[1]}return G}function r6(_,Q){if(_.size!==Q.size)return!1;for(let J of _)if(!Q.has(J))return!1;return!0}function b7(){let _,Q;return{promise:new Promise((q,U)=>{_=q,Q=U}),resolve:_,reject:Q}}function E7(_){return{...u6,..._||{}}}function Iq(_){if(typeof document>"u")return!0;let Q=document.querySelector(`.${_}-flow__pane`);if(!Q||!Q.isConnected)return!0;let J=getComputedStyle(Q);if(J.display==="none")return!0;if(J.visibility==="hidden"||J.visibility==="collapse")return!0;if(J.opacity==="0")return!0;if(J.width==="0"&&J.height==="0")return!0;let q=Q.getBoundingClientRect();if(q.width===0&&q.height===0)return!0;let U=document.querySelector(`.${_}-flow__attribution`);if(!U||!U.isConnected)return!1;let G=getComputedStyle(U);if(G.display==="none")return!1;if(G.visibility==="hidden"||G.visibility==="collapse")return!1;if(G.opacity==="0")return!1;let Z=U.getBoundingClientRect();if(Z.width===0&&Z.height===0)return!1;return!0}var T7=!1;function x7(_){if(T7)return;T7=!0;let Q=`${_.charAt(0).toUpperCase()+_.slice(1)} Flow`;setTimeout(()=>{if(!Iq(_))console.warn(`${Q}: It seems like you are hiding the attribution. Please only do this when you are subscribed to ${Q} Pro: https://${_}flow.dev/remove-attr
|
|
28
|
-
%cYou can ignore this warning if you are subscribed.`,"font-style: italic;")},1000)}function i6(_){return _===null?null:_?"valid":"invalid"}function g5(_,{snapGrid:Q=[0,0],snapToGrid:J=!1,transform:q,containerBounds:U}){let{x:G,y:Z}=O0(_),F=Z5({x:G-(U?.left??0),y:Z-(U?.top??0)},q),{x:X,y:Y}=J?G5(F,Q):F;return{xSnapped:X,ySnapped:Y,...F}}var j4=(_)=>({width:_.offsetWidth,height:_.offsetHeight}),d6=(_)=>_?.getRootNode?.()||window?.document,Pq=["INPUT","SELECT","TEXTAREA"];function a6(_){let Q=_.composedPath?.()?.[0]||_.target;if(Q?.nodeType!==1)return!1;return Pq.includes(Q.nodeName)||Q.hasAttribute("contenteditable")||!!Q.closest(".nokey")}var s6=(_)=>("clientX"in _),O0=(_,Q)=>{let J=s6(_),q=J?_.clientX:_.touches?.[0].clientX,U=J?_.clientY:_.touches?.[0].clientY;return{x:q-(Q?.left??0),y:U-(Q?.top??0)}},R7=(_,Q,J,q,U)=>{let G=Q.querySelectorAll(`.${_}`);if(!G||!G.length)return null;return Array.from(G).map((Z)=>{let F=Z.getBoundingClientRect();return{id:Z.getAttribute("data-handleid"),type:_,nodeId:U,position:Z.getAttribute("data-handlepos"),x:(F.left-J.left)/q,y:(F.top-J.top)/q,...j4(Z)}})};function V4({sourceX:_,sourceY:Q,targetX:J,targetY:q,sourceControlX:U,sourceControlY:G,targetControlX:Z,targetControlY:F}){let X=_*0.125+U*0.375+Z*0.375+J*0.125,Y=Q*0.125+G*0.375+F*0.375+q*0.125,K=Math.abs(X-_),H=Math.abs(Y-Q);return[X,Y,K,H]}function w4(_,Q){if(_>=0)return 0.5*_;return Q*25*Math.sqrt(-_)}function O7({pos:_,x1:Q,y1:J,x2:q,y2:U,c:G}){switch(_){case X1.Left:return[Q-w4(Q-q,G),J];case X1.Right:return[Q+w4(q-Q,G),J];case X1.Top:return[Q,J-w4(J-U,G)];case X1.Bottom:return[Q,J+w4(U-J,G)]}}function u4({sourceX:_,sourceY:Q,sourcePosition:J=X1.Bottom,targetX:q,targetY:U,targetPosition:G=X1.Top,curvature:Z=0.25}){let[F,X]=O7({pos:J,x1:_,y1:Q,x2:q,y2:U,c:Z}),[Y,K]=O7({pos:G,x1:q,y1:U,x2:_,y2:Q,c:Z}),[H,L,z,W]=V4({sourceX:_,sourceY:Q,targetX:q,targetY:U,sourceControlX:F,sourceControlY:X,targetControlX:Y,targetControlY:K});return[`M${_},${Q} C${F},${X} ${Y},${K} ${q},${U}`,H,L,z,W]}function t6({sourceX:_,sourceY:Q,targetX:J,targetY:q}){let U=Math.abs(J-_)/2,G=J<_?J+U:J-U,Z=Math.abs(q-Q)/2,F=q<Q?q+Z:q-Z;return[G,F,U,Z]}function m7({sourceNode:_,targetNode:Q,selected:J=!1,zIndex:q=0,elevateOnSelect:U=!1,zIndexMode:G="basic"}){if(G==="manual")return q;let Z=U&&J?q+1000:q,F=Math.max(_.parentId||U&&_.selected?_.internals.z:0,Q.parentId||U&&Q.selected?Q.internals.z:0);return Z+F}function g7({sourceNode:_,targetNode:Q,width:J,height:q,transform:U}){let G=k4(C4(_),C4(Q));if(G.x===G.x2)G.x2+=1;if(G.y===G.y2)G.y2+=1;let Z={x:-U[0]/U[2],y:-U[1]/U[2],width:J/U[2],height:q/U[2]};return c5(Z,v4(G))>0}var Nq=({source:_,sourceHandle:Q,target:J,targetHandle:q})=>`xy-edge__${_}${Q||""}-${J}${q||""}`,wq=(_,Q)=>{return Q.some((J)=>J.source===_.source&&J.target===_.target&&(J.sourceHandle===_.sourceHandle||!J.sourceHandle&&!_.sourceHandle)&&(J.targetHandle===_.targetHandle||!J.targetHandle&&!_.targetHandle))},p7=(_,Q,J={})=>{if(!_.source||!_.target)return J.onError?.("006",X0.error006()),Q;let q=J.getEdgeId||Nq,U;if(D6(_))U={..._};else U={..._,id:q(_)};if(wq(U,Q))return Q;if(U.sourceHandle===null)delete U.sourceHandle;if(U.targetHandle===null)delete U.targetHandle;return Q.concat(U)};function h4({sourceX:_,sourceY:Q,targetX:J,targetY:q}){let[U,G,Z,F]=t6({sourceX:_,sourceY:Q,targetX:J,targetY:q});return[`M ${_},${Q}L ${J},${q}`,U,G,Z,F]}var I7={[X1.Left]:{x:-1,y:0},[X1.Right]:{x:1,y:0},[X1.Top]:{x:0,y:-1},[X1.Bottom]:{x:0,y:1}},fq=({source:_,sourcePosition:Q=X1.Bottom,target:J})=>{if(Q===X1.Left||Q===X1.Right)return _.x<J.x?{x:1,y:0}:{x:-1,y:0};return _.y<J.y?{x:0,y:1}:{x:0,y:-1}},P7=(_,Q)=>Math.sqrt(Math.pow(Q.x-_.x,2)+Math.pow(Q.y-_.y,2));function Cq({source:_,sourcePosition:Q=X1.Bottom,target:J,targetPosition:q=X1.Top,center:U,offset:G,stepPosition:Z}){let F=I7[Q],X=I7[q],Y={x:_.x+F.x*G,y:_.y+F.y*G},K={x:J.x+X.x*G,y:J.y+X.y*G},H=fq({source:Y,sourcePosition:Q,target:K}),L=H.x!==0?"x":"y",z=H[L],W=[],I,R,A={x:0,y:0},N={x:0,y:0},[,,B,T]=t6({sourceX:_.x,sourceY:_.y,targetX:J.x,targetY:J.y});if(F[L]*X[L]===-1){if(L==="x")I=U.x??Y.x+(K.x-Y.x)*Z,R=U.y??(Y.y+K.y)/2;else I=U.x??(Y.x+K.x)/2,R=U.y??Y.y+(K.y-Y.y)*Z;let S=[{x:I,y:Y.y},{x:I,y:K.y}],w=[{x:Y.x,y:R},{x:K.x,y:R}];if(F[L]===z)W=L==="x"?S:w;else W=L==="x"?w:S}else{let S=[{x:Y.x,y:K.y}],w=[{x:K.x,y:Y.y}];if(L==="x")W=F.x===z?w:S;else W=F.y===z?S:w;if(Q===q){let y=Math.abs(_[L]-J[L]);if(y<=G){let D=Math.min(G-1,G-y);if(F[L]===z)A[L]=(Y[L]>_[L]?-1:1)*D;else N[L]=(K[L]>J[L]?-1:1)*D}}if(Q!==q){let y=L==="x"?"y":"x",D=F[L]===X[y],v=Y[y]>K[y],x=Y[y]<K[y];if(F[L]===1&&(!D&&v||D&&x)||F[L]!==1&&(!D&&x||D&&v))W=L==="x"?S:w}let k={x:Y.x+A.x,y:Y.y+A.y},E={x:K.x+N.x,y:K.y+N.y},l=Math.max(Math.abs(k.x-W[0].x),Math.abs(E.x-W[0].x)),c=Math.max(Math.abs(k.y-W[0].y),Math.abs(E.y-W[0].y));if(l>=c)I=(k.x+E.x)/2,R=W[0].y;else I=W[0].x,R=(k.y+E.y)/2}let O={x:Y.x+A.x,y:Y.y+A.y},C={x:K.x+N.x,y:K.y+N.y};return[[_,...O.x!==W[0].x||O.y!==W[0].y?[O]:[],...W,...C.x!==W[W.length-1].x||C.y!==W[W.length-1].y?[C]:[],J],I,R,B,T]}function Sq(_,Q,J,q){let U=Math.min(P7(_,Q)/2,P7(Q,J)/2,q),{x:G,y:Z}=Q;if(_.x===G&&G===J.x||_.y===Z&&Z===J.y)return`L${G} ${Z}`;if(_.y===Z){let Y=_.x<J.x?-1:1,K=_.y<J.y?1:-1;return`L ${G+U*Y},${Z}Q ${G},${Z} ${G},${Z+U*K}`}let F=_.x<J.x?1:-1,X=_.y<J.y?-1:1;return`L ${G},${Z+U*X}Q ${G},${Z} ${G+U*F},${Z}`}function r5({sourceX:_,sourceY:Q,sourcePosition:J=X1.Bottom,targetX:q,targetY:U,targetPosition:G=X1.Top,borderRadius:Z=5,centerX:F,centerY:X,offset:Y=20,stepPosition:K=0.5}){let[H,L,z,W,I]=Cq({source:{x:_,y:Q},sourcePosition:J,target:{x:q,y:U},targetPosition:G,center:{x:F,y:X},offset:Y,stepPosition:K}),R=`M${H[0].x} ${H[0].y}`;for(let A=1;A<H.length-1;A++)R+=Sq(H[A-1],H[A],H[A+1],Z);return R+=`L${H[H.length-1].x} ${H[H.length-1].y}`,[R,L,z,W,I]}function N7(_){return _&&!!(_.internals.handleBounds||_.handles?.length)&&!!(_.measured.width||_.width||_.initialWidth)}function c7(_){let{sourceNode:Q,targetNode:J}=_;if(!N7(Q)||!N7(J))return null;let q=Q.internals.handleBounds||w7(Q.handles),U=J.internals.handleBounds||w7(J.handles),G=f7(q?.source??[],_.sourceHandle),Z=f7(_.connectionMode===L2.Strict?U?.target??[]:(U?.target??[]).concat(U?.source??[]),_.targetHandle);if(!G||!Z)return _.onError?.("008",X0.error008(!G?"source":"target",{id:_.id,sourceHandle:_.sourceHandle,targetHandle:_.targetHandle})),null;let F=G?.position||X1.Bottom,X=Z?.position||X1.Top,Y=z2(Q,G,F),K=z2(J,Z,X);return{sourceX:Y.x,sourceY:Y.y,targetX:K.x,targetY:K.y,sourcePosition:F,targetPosition:X}}function w7(_){if(!_)return null;let Q=[],J=[];for(let q of _)if(q.width=q.width??1,q.height=q.height??1,q.type==="source")Q.push(q);else if(q.type==="target")J.push(q);return{source:Q,target:J}}function z2(_,Q,J=X1.Left,q=!1){let U=(Q?.x??0)+_.internals.positionAbsolute.x,G=(Q?.y??0)+_.internals.positionAbsolute.y,{width:Z,height:F}=Q??I0(_);if(q)return{x:U+Z/2,y:G+F/2};switch(Q?.position??J){case X1.Top:return{x:U+Z/2,y:G};case X1.Right:return{x:U+Z,y:G+F/2};case X1.Bottom:return{x:U+Z/2,y:G+F};case X1.Left:return{x:U,y:G+F/2}}}function f7(_,Q){if(!_)return null;return(!Q?_[0]:_.find((J)=>J.id===Q))||null}function D4(_,Q){if(!_)return"";if(typeof _==="string")return _;return`${Q?`${Q}__`:""}${Object.keys(_).sort().map((q)=>`${q}=${_[q]}`).join("&")}`}function l7(_,{id:Q,defaultColor:J,defaultMarkerStart:q,defaultMarkerEnd:U}){let G=new Set;return _.reduce((Z,F)=>{return[F.markerStart||q,F.markerEnd||U].forEach((X)=>{if(X&&typeof X==="object"){let Y=D4(X,Q);if(!G.has(Y))Z.push({id:Y,color:X.color||J,...X}),G.add(Y)}}),Z},[]).sort((Z,F)=>Z.id.localeCompare(F.id))}function r7(_,Q,J,q,U){let G=0.5;if(U==="start")G=0;else if(U==="end")G=1;let Z=[(_.x+_.width*G)*Q.zoom+Q.x,_.y*Q.zoom+Q.y-q],F=[-100*G,-100];switch(J){case X1.Right:Z=[(_.x+_.width)*Q.zoom+Q.x+q,(_.y+_.height*G)*Q.zoom+Q.y],F=[0,-100*G];break;case X1.Bottom:Z[1]=(_.y+_.height)*Q.zoom+Q.y+q,F[1]=0;break;case X1.Left:Z=[_.x*Q.zoom+Q.x-q,(_.y+_.height*G)*Q.zoom+Q.y],F=[-100,-100*G];break}return`translate(${Z[0]}px, ${Z[1]}px) translate(${F[0]}%, ${F[1]}%)`}var i7=1000,yq=10,o6={nodeOrigin:[0,0],nodeExtent:q5,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},kq={...o6,checkEquality:!0};function n6(_,Q){let J={..._};for(let q in Q)if(Q[q]!==void 0)J[q]=Q[q];return J}function d7(_,Q,J){let q=n6(o6,J);for(let U of _.values())if(U.parentId)_8(U,_,Q,q);else{let G=p5(U,q.nodeOrigin),Z=j2(U.extent)?U.extent:q.nodeExtent,F=k2(G,Z,I0(U));U.internals.positionAbsolute=F}}function vq(_,Q){if(!_.handles)return!_.measured?void 0:Q?.internals.handleBounds;let J=[],q=[];for(let U of _.handles){let G={id:U.id,width:U.width??1,height:U.height??1,nodeId:_.id,x:U.x,y:U.y,position:U.position,type:U.type};if(U.type==="source")J.push(G);else if(U.type==="target")q.push(G)}return{source:J,target:q}}function e6(_){return _==="manual"}function b4(_,Q,J,q={}){let U=n6(kq,q),G={i:0},Z=new Map(Q),F=U?.elevateNodesOnSelect&&!e6(U.zIndexMode)?i7:0,X=_.length>0,Y=!1;Q.clear(),J.clear();for(let K of _){let H=Z.get(K.id);if(U.checkEquality&&K===H?.internals.userNode)Q.set(K.id,H);else{let L=p5(K,U.nodeOrigin),z=j2(K.extent)?K.extent:U.nodeExtent,W=k2(L,z,I0(K));H={...U.defaults,...K,measured:{width:K.measured?.width,height:K.measured?.height},internals:{positionAbsolute:W,handleBounds:vq(K,H),z:a7(K,F,U.zIndexMode),userNode:K}},Q.set(K.id,H)}if((H.measured===void 0||H.measured.width===void 0||H.measured.height===void 0)&&!H.hidden)X=!1;if(K.parentId)_8(H,Q,J,q,G);Y||=K.selected??!1}return{nodesInitialized:X,hasSelectedNodes:Y}}function jq(_,Q){if(!_.parentId)return;let J=Q.get(_.parentId);if(J)J.set(_.id,_);else Q.set(_.parentId,new Map([[_.id,_]]))}function _8(_,Q,J,q,U){let{elevateNodesOnSelect:G,nodeOrigin:Z,nodeExtent:F,zIndexMode:X}=n6(o6,q),Y=_.parentId,K=Q.get(Y);if(!K){console.warn(`Parent node ${Y} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}if(jq(_,J),U&&!K.parentId&&K.internals.rootParentIndex===void 0&&X==="auto")K.internals.rootParentIndex=++U.i,K.internals.z=K.internals.z+U.i*yq;if(U&&K.internals.rootParentIndex!==void 0)U.i=K.internals.rootParentIndex;let H=G&&!e6(X)?i7:0,{x:L,y:z,z:W}=Vq(_,K,Z,F,H,X),{positionAbsolute:I}=_.internals,R=L!==I.x||z!==I.y;if(R||W!==_.internals.z)Q.set(_.id,{..._,internals:{..._.internals,positionAbsolute:R?{x:L,y:z}:I,z:W}})}function a7(_,Q,J){let q=R0(_.zIndex)?_.zIndex:0;if(e6(J))return q;return q+(_.selected?Q:0)}function Vq(_,Q,J,q,U,G){let{x:Z,y:F}=Q.internals.positionAbsolute,X=I0(_),Y=p5(_,J),K=j2(_.extent)?k2(Y,_.extent,X):Y,H=k2({x:Z+K.x,y:F+K.y},q,X);if(_.extent==="parent")H=h7(H,X,Q);let L=a7(_,U,G),z=Q.internals.z??0;return{x:H.x,y:H.y,z:z>=L?z+1:L}}function E4(_,Q,J,q=[0,0]){let U=[],G=new Map;for(let Z of _){let F=Q.get(Z.parentId);if(!F)continue;let X=G.get(Z.parentId)?.expandedRect??U5(F),Y=m6(X,Z.rect);G.set(Z.parentId,{expandedRect:Y,parent:F})}if(G.size>0)G.forEach(({expandedRect:Z,parent:F},X)=>{let Y=F.internals.positionAbsolute,K=I0(F),H=F.origin??q,L=Z.x<Y.x?Math.round(Math.abs(Y.x-Z.x)):0,z=Z.y<Y.y?Math.round(Math.abs(Y.y-Z.y)):0,W=Math.max(K.width,Math.round(Z.width)),I=Math.max(K.height,Math.round(Z.height)),R=(W-K.width)*H[0],A=(I-K.height)*H[1];if(L>0||z>0||R||A)U.push({id:X,type:"position",position:{x:F.position.x-L+R,y:F.position.y-z+A}}),J.get(X)?.forEach((N)=>{if(!_.some((B)=>B.id===N.id))U.push({id:N.id,type:"position",position:{x:N.position.x+L,y:N.position.y+z}})});if(K.width<Z.width||K.height<Z.height||L||z)U.push({id:X,type:"dimensions",setAttributes:!0,dimensions:{width:W+(L?H[0]*L-R:0),height:I+(z?H[1]*z-A:0)}})});return U}function s7(_,Q,J,q,U,G,Z){let F=q?.querySelector(".xyflow__viewport"),X=!1;if(!F)return{changes:[],updatedInternals:X};let Y=[],K=window.getComputedStyle(F),{m22:H}=new window.DOMMatrixReadOnly(K.transform),L=[];for(let z of _.values()){let W=Q.get(z.id);if(!W)continue;if(W.hidden){Q.set(W.id,{...W,internals:{...W.internals,handleBounds:void 0}}),X=!0;continue}let I=j4(z.nodeElement),R=W.measured.width!==I.width||W.measured.height!==I.height;if(!!(I.width&&I.height&&(R||!W.internals.handleBounds||z.force))){let N=z.nodeElement.getBoundingClientRect(),B=j2(W.extent)?W.extent:G,{positionAbsolute:T}=W.internals;if(W.parentId&&W.extent==="parent"){let C=Q.get(W.parentId);if(C)T=h7(T,I,C)}else if(B)T=k2(T,B,I);let O={...W,measured:I,internals:{...W.internals,positionAbsolute:T,handleBounds:{source:R7("source",z.nodeElement,N,H,W.id),target:R7("target",z.nodeElement,N,H,W.id)}}};if(Q.set(W.id,O),W.parentId)_8(O,Q,J,{nodeOrigin:U,zIndexMode:Z});if(X=!0,R){if(Y.push({id:W.id,type:"dimensions",dimensions:I}),W.expandParent&&W.parentId)L.push({id:W.id,parentId:W.parentId,rect:U5(O,U)})}}}if(L.length>0){let z=E4(L,Q,J,U);Y.push(...z)}return{changes:Y,updatedInternals:X}}async function t7({delta:_,panZoom:Q,transform:J,translateExtent:q,width:U,height:G}){if(!Q||!_.x&&!_.y)return!1;let Z=await Q.setViewportConstrained({x:J[0]+_.x,y:J[1]+_.y,zoom:J[2]},[[0,0],[U,G]],q);return!!Z&&(Z.x!==J[0]||Z.y!==J[1]||Z.k!==J[2])}function C7(_,Q,J,q,U,G){let Z=U,F=q.get(Z)||new Map;q.set(Z,F.set(J,Q)),Z=`${U}-${_}`;let X=q.get(Z)||new Map;if(q.set(Z,X.set(J,Q)),G){Z=`${U}-${_}-${G}`;let Y=q.get(Z)||new Map;q.set(Z,Y.set(J,Q))}}function Q8(_,Q,J){_.clear(),Q.clear();for(let q of J){let{source:U,target:G,sourceHandle:Z=null,targetHandle:F=null}=q,X={edgeId:q.id,source:U,target:G,sourceHandle:Z,targetHandle:F},Y=`${U}-${Z}--${G}-${F}`,K=`${G}-${F}--${U}-${Z}`;C7("source",X,K,_,U,Z),C7("target",X,Y,_,G,F),Q.set(q.id,q)}}function o7(_,Q){if(!_.parentId)return!1;let J=Q.get(_.parentId);if(!J)return!1;if(J.selected)return!0;return o7(J,Q)}function S7(_,Q,J){let q=_;do{if(q?.matches?.(Q))return!0;if(q===J)return!1;q=q?.parentElement}while(q);return!1}function uq(_,Q,J,q){let U=new Map;for(let[G,Z]of _)if((Z.selected||Z.id===q)&&(!Z.parentId||!o7(Z,_))&&(Z.draggable||Q&&typeof Z.draggable>"u")){let F=_.get(G);if(F)U.set(G,{id:G,position:F.position||{x:0,y:0},distance:{x:J.x-F.internals.positionAbsolute.x,y:J.y-F.internals.positionAbsolute.y},extent:F.extent,parentId:F.parentId,origin:F.origin,expandParent:F.expandParent,internals:{positionAbsolute:F.internals.positionAbsolute||{x:0,y:0}},measured:{width:F.measured.width??0,height:F.measured.height??0}})}return U}function y6({nodeId:_,dragItems:Q,nodeLookup:J,dragging:q=!0}){let U=[];for(let[Z,F]of Q){let X=J.get(Z)?.internals.userNode;if(X)U.push({...X,position:F.position,dragging:q})}if(!_)return[U[0],U];let G=J.get(_)?.internals.userNode;return[!G?U[0]:{...G,position:Q.get(_)?.position||G.position,dragging:q},U]}function hq({dragItems:_,snapGrid:Q,x:J,y:q}){let U=_.values().next().value;if(!U)return null;let G={x:J-U.distance.x,y:q-U.distance.y},Z=G5(G,Q);return{x:Z.x-G.x,y:Z.y-G.y}}function n7({onNodeMouseDown:_,getStoreItems:Q,onDragStart:J,onDrag:q,onDragStop:U}){let G={x:null,y:null},Z=0,F=new Map,X=!1,Y={x:0,y:0},K=null,H=!1,L=null,z=!1,W=!1,I=null;function R({noDragClassName:N,handleSelector:B,domNode:T,isSelectable:O,nodeId:C,nodeClickDistance:f=0}){L=o1(T);function S({x:l,y:c}){let{nodeLookup:y,nodeExtent:D,snapGrid:v,snapToGrid:x,nodeOrigin:V,onNodeDrag:b,onSelectionDrag:P,onError:j,updateNodePositions:m}=Q();G={x:l,y:c};let h=!1,o=F.size>1,e=o&&D?j6(V2(F)):null,s=o&&x?hq({dragItems:F,snapGrid:v,x:l,y:c}):null;for(let[t,p]of F){if(!y.has(t))continue;let n={x:l-p.distance.x,y:c-p.distance.y};if(x)n=s?{x:Math.round(n.x+s.x),y:Math.round(n.y+s.y)}:G5(n,v);let J1=null;if(o&&D&&!p.extent&&e){let{positionAbsolute:Z1}=p.internals,T1=Z1.x-e.x+D[0][0],L1=Z1.x+p.measured.width-e.x2+D[1][0],_1=Z1.y-e.y+D[0][1],W1=Z1.y+p.measured.height-e.y2+D[1][1];J1=[[T1,_1],[L1,W1]]}let{position:q1,positionAbsolute:F1}=x6({nodeId:t,nextPosition:n,nodeLookup:y,nodeExtent:J1?J1:D,nodeOrigin:V,onError:j});h=h||p.position.x!==q1.x||p.position.y!==q1.y,p.position=q1,p.internals.positionAbsolute=F1}if(W=W||h,!h)return;if(m(F,!0),I&&(q||b||!C&&P)){let[t,p]=y6({nodeId:C,dragItems:F,nodeLookup:y});if(q?.(I,F,t,p),b?.(I,t,p),!C)P?.(I,p)}}async function w(){if(!K)return;let{transform:l,panBy:c,autoPanSpeed:y,autoPanOnNodeDrag:D}=Q();if(!D){X=!1,cancelAnimationFrame(Z);return}let[v,x]=y4(Y,K,y);if(v!==0||x!==0){if(G.x=(G.x??0)-v/l[2],G.y=(G.y??0)-x/l[2],await c({x:v,y:x}))S(G)}Z=requestAnimationFrame(w)}function k(l){let{nodeLookup:c,multiSelectionActive:y,nodesDraggable:D,transform:v,snapGrid:x,snapToGrid:V,selectNodesOnDrag:b,onNodeDragStart:P,onSelectionDragStart:j,unselectNodesAndEdges:m}=Q();if(H=!0,(!b||!O)&&!y&&C){if(!c.get(C)?.selected)m()}if(O&&b&&C)_?.(C);let h=g5(l.sourceEvent,{transform:v,snapGrid:x,snapToGrid:V,containerBounds:K});if(G=h,F=uq(c,D,h,C),F.size>0&&(J||P||!C&&j)){let[o,e]=y6({nodeId:C,dragItems:F,nodeLookup:c});if(J?.(l.sourceEvent,F,o,e),P?.(l.sourceEvent,o,e),!C)j?.(l.sourceEvent,e)}}let E=I5().clickDistance(f).on("start",(l)=>{let{domNode:c,nodeDragThreshold:y,transform:D,snapGrid:v,snapToGrid:x}=Q();if(K=c?.getBoundingClientRect()||null,z=!1,W=!1,I=l.sourceEvent,y===0)k(l);G=g5(l.sourceEvent,{transform:D,snapGrid:v,snapToGrid:x,containerBounds:K}),Y=O0(l.sourceEvent,K)}).on("drag",(l)=>{let{autoPanOnNodeDrag:c,transform:y,snapGrid:D,snapToGrid:v,nodeDragThreshold:x,nodeLookup:V}=Q(),b=g5(l.sourceEvent,{transform:y,snapGrid:D,snapToGrid:v,containerBounds:K});if(I=l.sourceEvent,l.sourceEvent.type==="touchmove"&&l.sourceEvent.touches.length>1||C&&!V.has(C))z=!0;if(z)return;if(!X&&c&&H)X=!0,w();if(!H){let P=O0(l.sourceEvent,K),j=P.x-Y.x,m=P.y-Y.y;if(Math.sqrt(j*j+m*m)>x)k(l)}if((G.x!==b.xSnapped||G.y!==b.ySnapped)&&F&&H)Y=O0(l.sourceEvent,K),S(b)}).on("end",(l)=>{if(!H||z){if(z&&F.size>0)Q().updateNodePositions(F,!1);return}if(X=!1,H=!1,cancelAnimationFrame(Z),F.size>0){let{nodeLookup:c,updateNodePositions:y,onNodeDragStop:D,onSelectionDragStop:v}=Q();if(W)y(F,!1),W=!1;if(U||D||!C&&v){let[x,V]=y6({nodeId:C,dragItems:F,nodeLookup:c,dragging:!1});if(U?.(l.sourceEvent,F,x,V),D?.(l.sourceEvent,x,V),!C)v?.(l.sourceEvent,V)}}}).filter((l)=>{let c=l.target;return!l.button&&(!N||!S7(c,`.${N}`,T))&&(!B||S7(c,B,T))});L.call(E)}function A(){L?.on(".drag",null)}return{update:R,destroy:A}}function Dq(_,Q,J){let q=[],U={x:_.x-J,y:_.y-J,width:J*2,height:J*2};for(let G of Q.values())if(c5(U,U5(G))>0)q.push(G);return q}var bq=250;function Eq(_,Q,J,q){let U=[],G=1/0,Z=Dq(_,J,Q+bq);for(let F of Z){let X=[...F.internals.handleBounds?.source??[],...F.internals.handleBounds?.target??[]];for(let Y of X){if(q.nodeId===Y.nodeId&&q.type===Y.type&&q.id===Y.id)continue;let{x:K,y:H}=z2(F,Y,Y.position,!0),L=Math.sqrt(Math.pow(K-_.x,2)+Math.pow(H-_.y,2));if(L>Q)continue;if(L<G)U=[{...Y,x:K,y:H}],G=L;else if(L===G)U.push({...Y,x:K,y:H})}}if(!U.length)return null;if(U.length>1){let F=q.type==="source"?"target":"source";return U.find((X)=>X.type===F)??U[0]}return U[0]}function e7(_,Q,J,q,U,G=!1){let Z=q.get(_);if(!Z)return null;let F=U==="strict"?Z.internals.handleBounds?.[Q]:[...Z.internals.handleBounds?.source??[],...Z.internals.handleBounds?.target??[]],X=(J?F?.find((Y)=>Y.id===J):F?.[0])??null;return X&&G?{...X,...z2(Z,X,X.position,!0)}:X}function _9(_,Q){if(_)return _;else if(Q?.classList.contains("target"))return"target";else if(Q?.classList.contains("source"))return"source";return null}function xq(_,Q){let J=null;if(Q)J=!0;else if(_&&!Q)J=!1;return J}var Q9=()=>!0;function mq(_,{connectionMode:Q,connectionRadius:J,handleId:q,nodeId:U,edgeUpdaterType:G,isTarget:Z,domNode:F,nodeLookup:X,lib:Y,autoPanOnConnect:K,flowId:H,panBy:L,cancelConnection:z,onConnectStart:W,onConnect:I,onConnectEnd:R,isValidConnection:A=Q9,onReconnectEnd:N,updateConnection:B,getTransform:T,getFromHandle:O,autoPanSpeed:C,dragThreshold:f=1,handleDomNode:S}){let w=d6(_.target),k=0,E,{x:l,y:c}=O0(_),y=_9(G,S),D=F?.getBoundingClientRect(),v=!1;if(!D||!y)return;let x=e7(U,y,q,X,Q);if(!x)return;let V=O0(_,D),b=!1,P=null,j=!1,m=null;function h(){if(!K||!D)return;let[q1,F1]=y4(V,D,C);L({x:q1,y:F1}),k=requestAnimationFrame(h)}let o={...x,nodeId:U,type:y,position:x.position},e=X.get(U),t={inProgress:!0,isValid:null,from:z2(e,o,X1.Left,!0),fromHandle:o,fromPosition:o.position,fromNode:e,to:V,toHandle:null,toPosition:B7[o.position],toNode:null,pointer:V};function p(){v=!0,B(t),W?.(_,{nodeId:U,handleId:q,handleType:y})}if(f===0)p();function n(q1){if(!v){let{x:W1,y:K1}=O0(q1),p1=W1-l,s1=K1-c;if(!(p1*p1+s1*s1>f*f))return;p()}if(!O()||!o){J1(q1);return}let F1=T();if(V=O0(q1,D),E=Eq(Z5(V,F1,!1,[1,1]),J,X,o),!b)h(),b=!0;let Z1=J9(q1,{handle:E,connectionMode:Q,fromNodeId:U,fromHandleId:q,fromType:Z?"target":"source",isValidConnection:A,doc:w,lib:Y,flowId:H,nodeLookup:X});m=Z1.handleDomNode,P=Z1.connection,j=xq(!!E,Z1.isValid);let T1=X.get(U),L1=T1?z2(T1,o,X1.Left,!0):t.from,_1={...t,from:L1,isValid:j,to:Z1.toHandle&&j?v2({x:Z1.toHandle.x,y:Z1.toHandle.y},F1):V,toHandle:Z1.toHandle,toPosition:j&&Z1.toHandle?Z1.toHandle.position:B7[o.position],toNode:Z1.toHandle?X.get(Z1.toHandle.nodeId):null,pointer:V};B(_1),t=_1}function J1(q1){if("touches"in q1&&q1.touches.length>0)return;if(v){if((E||m)&&P&&j)I?.(P);let{inProgress:F1,...Z1}=t,T1={...Z1,toPosition:t.toHandle?t.toPosition:null};if(R?.(q1,T1),G)N?.(q1,T1)}z(),cancelAnimationFrame(k),b=!1,j=!1,P=null,m=null,w.removeEventListener("mousemove",n),w.removeEventListener("mouseup",J1),w.removeEventListener("touchmove",n),w.removeEventListener("touchend",J1)}w.addEventListener("mousemove",n),w.addEventListener("mouseup",J1),w.addEventListener("touchmove",n),w.addEventListener("touchend",J1)}function J9(_,{handle:Q,connectionMode:J,fromNodeId:q,fromHandleId:U,fromType:G,doc:Z,lib:F,flowId:X,isValidConnection:Y=Q9,nodeLookup:K}){let H=G==="target",L=Q?Z.querySelector(`.${F}-flow__handle[data-id="${X}-${Q?.nodeId}-${Q?.id}-${Q?.type}"]`):null,{x:z,y:W}=O0(_),I=Z.elementFromPoint(z,W),R=I?.classList.contains(`${F}-flow__handle`)?I:L,A={handleDomNode:R,isValid:!1,connection:null,toHandle:null};if(R){let N=_9(void 0,R),B=R.getAttribute("data-nodeid"),T=R.getAttribute("data-handleid"),O=R.classList.contains("connectable"),C=R.classList.contains("connectableend");if(!B||!N)return A;let f={source:H?B:q,sourceHandle:H?T:U,target:H?q:B,targetHandle:H?U:T};A.connection=f;let w=O&&C&&(J===L2.Strict?H&&N==="source"||!H&&N==="target":B!==q||T!==U);A.isValid=w&&Y(f),A.toHandle=e7(B,N,T,K,J,!0)}return A}var x4={onPointerDown:mq,isValid:J9};function $9({domNode:_,panZoom:Q,getTransform:J,getViewScale:q}){let U=o1(_);function G({translateExtent:F,width:X,height:Y,zoomStep:K=1,pannable:H=!0,zoomable:L=!0,inversePan:z=!1}){let W=(B)=>{if(B.sourceEvent.type!=="wheel"||!Q)return;let T=J(),O=B.sourceEvent.ctrlKey&&F5()?10:1,C=-B.sourceEvent.deltaY*(B.sourceEvent.deltaMode===1?0.05:B.sourceEvent.deltaMode?1:0.002)*K,f=T[2]*Math.pow(2,C*O);Q.scaleTo(f)},I=[0,0],R=(B)=>{if(B.sourceEvent.type==="mousedown"||B.sourceEvent.type==="touchstart")I=[B.sourceEvent.clientX??B.sourceEvent.touches[0].clientX,B.sourceEvent.clientY??B.sourceEvent.touches[0].clientY]},A=(B)=>{let T=J();if(B.sourceEvent.type!=="mousemove"&&B.sourceEvent.type!=="touchmove"||!Q)return;let O=[B.sourceEvent.clientX??B.sourceEvent.touches[0].clientX,B.sourceEvent.clientY??B.sourceEvent.touches[0].clientY],C=[O[0]-I[0],O[1]-I[1]];I=O;let f=q()*Math.max(T[2],Math.log(T[2]))*(z?-1:1),S={x:T[0]-C[0]*f,y:T[1]-C[1]*f},w=[[0,0],[X,Y]];Q.setViewportConstrained({x:S.x,y:S.y,zoom:T[2]},w,F)},N=m5().on("start",R).on("zoom",H?A:null).on("zoom.wheel",L?W:null);U.call(N,{})}function Z(){U.on("zoom",null)}return{update:G,destroy:Z,pointer:q0}}var m4=(_)=>({x:_.x,y:_.y,zoom:_.k}),k6=({x:_,y:Q,zoom:J})=>C2.translate(_,Q).scale(J),Y2=(_,Q)=>_.target.closest(`.${Q}`),q9=(_,Q)=>Q===2&&Array.isArray(_)&&_.includes(2),gq=(_)=>((_*=2)<=1?_*_*_:(_-=2)*_*_+2)/2,v6=(_,Q=0,J=gq,q=()=>{})=>{let U=typeof Q==="number"&&Q>0;if(!U)q();return U?_.transition().duration(Q).ease(J).on("end",q):_},U9=(_)=>{let Q=_.ctrlKey&&F5()?10:1;return-_.deltaY*(_.deltaMode===1?0.05:_.deltaMode?1:0.002)*Q};function pq({zoomPanValues:_,noWheelClassName:Q,d3Selection:J,d3Zoom:q,panOnScrollMode:U,panOnScrollSpeed:G,zoomOnPinch:Z,onPanZoomStart:F,onPanZoom:X,onPanZoomEnd:Y}){return(K)=>{if(Y2(K,Q)){if(K.ctrlKey)K.preventDefault();return!1}K.preventDefault(),K.stopImmediatePropagation();let H=J.property("__zoom").k||1;if(K.ctrlKey&&Z){let R=q0(K),A=U9(K),N=H*Math.pow(2,A);q.scaleTo(J,N,R,K);return}let L=K.deltaMode===1?20:1,z=U===o0.Vertical?0:K.deltaX*L,W=U===o0.Horizontal?0:K.deltaY*L;if(!F5()&&K.shiftKey&&U!==o0.Vertical)z=K.deltaY*L,W=0;q.translateBy(J,-(z/H)*G,-(W/H)*G,{internal:!0});let I=m4(J.property("__zoom"));if(clearTimeout(_.panScrollTimeout),!_.isPanScrolling)_.isPanScrolling=!0,F?.(K,I);else X?.(K,I);_.panScrollTimeout=setTimeout(()=>{Y?.(K,I),_.isPanScrolling=!1},150)}}function cq({noWheelClassName:_,preventScrolling:Q,d3ZoomHandler:J}){return function(q,U){let G=q.type==="wheel",Z=!Q&&G&&!q.ctrlKey,F=Y2(q,_);if(q.ctrlKey&&G&&F)q.preventDefault();if(Z||F)return null;q.preventDefault(),J.call(this,q,U)}}function lq({zoomPanValues:_,onDraggingChange:Q,onPanZoomStart:J}){return(q)=>{if(q.sourceEvent?.internal)return;let U=m4(q.transform);if(_.mouseButton=q.sourceEvent?.button||0,_.isZoomingOrPanning=!0,_.prevViewport=U,q.sourceEvent?.type==="mousedown")Q(!0);if(J)J?.(q.sourceEvent,U)}}function rq({zoomPanValues:_,panOnDrag:Q,onPaneContextMenu:J,onTransformChange:q,onPanZoom:U}){return(G)=>{if(_.usedRightMouseButton=!!(J&&q9(Q,_.mouseButton??0)),!G.sourceEvent?.sync)q([G.transform.x,G.transform.y,G.transform.k]);if(U&&!G.sourceEvent?.internal)U?.(G.sourceEvent,m4(G.transform))}}function iq({zoomPanValues:_,panOnDrag:Q,panOnScroll:J,onDraggingChange:q,onPanZoomEnd:U,onPaneContextMenu:G}){return(Z)=>{if(Z.sourceEvent?.internal)return;if(_.isZoomingOrPanning=!1,G&&q9(Q,_.mouseButton??0)&&!_.usedRightMouseButton&&Z.sourceEvent)G(Z.sourceEvent);if(_.usedRightMouseButton=!1,q(!1),U){let F=m4(Z.transform);_.prevViewport=F,clearTimeout(_.timerId),_.timerId=setTimeout(()=>{U?.(Z.sourceEvent,F)},J?150:0)}}}function dq({panActivationKeyPressed:_,zoomActivationKeyPressed:Q,zoomOnScroll:J,zoomOnPinch:q,panOnDrag:U,panOnScroll:G,zoomOnDoubleClick:Z,userSelectionActive:F,noWheelClassName:X,noPanClassName:Y,lib:K,connectionInProgress:H}){return(L)=>{let z=Q||J,W=q&&L.ctrlKey,I=L.type==="wheel";if(L.button===1&&L.type==="mousedown"&&(Y2(L,`${K}-flow__node`)||Y2(L,`${K}-flow__edge`)||Y2(L,`${K}-flow__selection`)||Y2(L,`${K}-flow__nodesselection`)))return!0;if(!U&&!z&&!G&&!Z&&!q)return!1;if(F)return!1;if(H&&!I)return!1;if(Y2(L,X)&&I)return!1;if(Y2(L,Y)&&(!I||G&&I&&!Q))return!1;if(!q&&L.ctrlKey&&I)return!1;if(!q&&L.type==="touchstart"&&L.touches?.length>1)return L.preventDefault(),!1;if(!z&&!G&&!W&&I)return!1;if(!U&&(L.type==="mousedown"||L.type==="touchstart"))return!1;if(Array.isArray(U)&&!U.includes(L.button)&&L.type==="mousedown")return!1;let R=Array.isArray(U)&&U.includes(L.button)||!L.button||L.button<=1;return(!L.ctrlKey||I||_)&&R}}function G9({domNode:_,minZoom:Q,maxZoom:J,translateExtent:q,viewport:U,onPanZoom:G,onPanZoomStart:Z,onPanZoomEnd:F,onDraggingChange:X}){let Y={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},K=_.getBoundingClientRect(),H=[[0,0],[K.width,K.height]];(typeof ResizeObserver<"u"?new ResizeObserver((c)=>{let y=c[0];if(y)H=[[0,0],[y.contentRect.width,y.contentRect.height]]}):null)?.observe(_);let z=m5().extent(()=>H).scaleExtent([Q,J]).translateExtent(q),W=o1(_).call(z);T({x:U.x,y:U.y,zoom:$5(U.zoom,Q,J)},[[0,0],[K.width,K.height]],q);let I=W.on("wheel.zoom"),R=W.on("dblclick.zoom");z.wheelDelta(U9);async function A(c,y){if(W)return new Promise((D)=>{z?.interpolate(y?.interpolate==="linear"?E0:w2).transform(v6(W,y?.duration,y?.ease,()=>D(!0)),c)});return!1}function N({noWheelClassName:c,noPanClassName:y,onPaneContextMenu:D,userSelectionActive:v,panOnScroll:x,panOnDrag:V,panOnScrollMode:b,panOnScrollSpeed:P,preventScrolling:j,zoomOnPinch:m,zoomOnScroll:h,zoomOnDoubleClick:o,panActivationKeyPressed:e=!1,zoomActivationKeyPressed:s,lib:t,onTransformChange:p,connectionInProgress:n,paneClickDistance:J1,selectionOnDrag:q1}){if(v&&!Y.isZoomingOrPanning)B();let F1=x&&!s&&!v;z.clickDistance(q1?1/0:!R0(J1)||J1<0?0:J1);let Z1=F1?pq({zoomPanValues:Y,noWheelClassName:c,d3Selection:W,d3Zoom:z,panOnScrollMode:b,panOnScrollSpeed:P,zoomOnPinch:m,onPanZoomStart:Z,onPanZoom:G,onPanZoomEnd:F}):cq({noWheelClassName:c,preventScrolling:j,d3ZoomHandler:I});W.on("wheel.zoom",Z1,{passive:!1});let T1=lq({zoomPanValues:Y,onDraggingChange:X,onPanZoomStart:Z});z.on("start",T1);let L1=rq({zoomPanValues:Y,panOnDrag:V,onPaneContextMenu:!!D,onPanZoom:G,onTransformChange:p});z.on("zoom",L1);let _1=iq({zoomPanValues:Y,panOnDrag:V,panOnScroll:x,onPaneContextMenu:D,onPanZoomEnd:F,onDraggingChange:X});z.on("end",_1);let W1=dq({panActivationKeyPressed:e,zoomActivationKeyPressed:s,panOnDrag:V,zoomOnScroll:h,panOnScroll:x,zoomOnDoubleClick:o,zoomOnPinch:m,userSelectionActive:v,noPanClassName:y,noWheelClassName:c,lib:t,connectionInProgress:n});if(z.filter(W1),o)W.on("dblclick.zoom",R);else W.on("dblclick.zoom",null)}function B(){z.on("zoom",null)}async function T(c,y,D){let v=k6(c),x=z?.constrain()(v,y,D);if(x)await A(x);return x}async function O(c,y){let D=k6(c);return await A(D,y),D}function C(c){if(W){let y=k6(c),D=W.property("__zoom");if(D.k!==c.zoom||D.x!==c.x||D.y!==c.y)z?.transform(W,y,null,{sync:!0})}}function f(){let c=W?x5(W.node()):{x:0,y:0,k:1};return{x:c.x,y:c.y,zoom:c.k}}async function S(c,y){if(W)return new Promise((D)=>{z?.interpolate(y?.interpolate==="linear"?E0:w2).scaleTo(v6(W,y?.duration,y?.ease,()=>D(!0)),c)});return!1}async function w(c,y){if(W)return new Promise((D)=>{z?.interpolate(y?.interpolate==="linear"?E0:w2).scaleBy(v6(W,y?.duration,y?.ease,()=>D(!0)),c)});return!1}function k(c){z?.scaleExtent(c)}function E(c){z?.translateExtent(c)}function l(c){let y=!R0(c)||c<0?0:c;z?.clickDistance(y)}return{update:N,destroy:B,setViewport:O,setViewportConstrained:T,getViewport:f,scaleTo:S,scaleBy:w,setScaleExtent:k,setTranslateExtent:E,syncViewport:C,setClickDistance:l}}var n0;(function(_){_.Line="line",_.Handle="handle"})(n0||(n0={}));var Z9=["top-left","top-right","bottom-left","bottom-right"],F9=["top","right","bottom","left"];function aq({width:_,prevWidth:Q,height:J,prevHeight:q,affectsX:U,affectsY:G}){let Z=_-Q,F=J-q,X=[Z>0?1:Z<0?-1:0,F>0?1:F<0?-1:0];if(Z&&U)X[0]=X[0]*-1;if(F&&G)X[1]=X[1]*-1;return X}function y7(_){let Q=_.includes("right")||_.includes("left"),J=_.includes("bottom")||_.includes("top"),q=_.includes("left"),U=_.includes("top");return{isHorizontal:Q,isVertical:J,affectsX:q,affectsY:U}}function X2(_,Q){return Math.max(0,Q-_)}function K2(_,Q){return Math.max(0,_-Q)}function f4(_,Q,J){return Math.max(0,Q-_,_-J)}function k7(_,Q){return _?!Q:Q}function sq(_,Q,J,q,U,G,Z,F){let{affectsX:X,affectsY:Y}=Q,{isHorizontal:K,isVertical:H}=Q,L=K&&H,{xSnapped:z,ySnapped:W}=J,{minWidth:I,maxWidth:R,minHeight:A,maxHeight:N}=q,{x:B,y:T,width:O,height:C,aspectRatio:f}=_,S=Math.floor(K?z-_.pointerX:0),w=Math.floor(H?W-_.pointerY:0),k=O+(X?-S:S),E=C+(Y?-w:w),l=-G[0]*O,c=-G[1]*C,y=f4(k,I,R),D=f4(E,A,N);if(Z){let V=0,b=0;if(X&&S<0)V=X2(B+S+l,Z[0][0]);else if(!X&&S>0)V=K2(B+k+l,Z[1][0]);if(Y&&w<0)b=X2(T+w+c,Z[0][1]);else if(!Y&&w>0)b=K2(T+E+c,Z[1][1]);y=Math.max(y,V),D=Math.max(D,b)}if(F){let V=0,b=0;if(X&&S>0)V=K2(B+S,F[0][0]);else if(!X&&S<0)V=X2(B+k,F[1][0]);if(Y&&w>0)b=K2(T+w,F[0][1]);else if(!Y&&w<0)b=X2(T+E,F[1][1]);y=Math.max(y,V),D=Math.max(D,b)}if(U){if(K){let V=f4(k/f,A,N)*f;if(y=Math.max(y,V),Z){let b=0;if(!X&&!Y||X&&!Y&&L)b=K2(T+c+k/f,Z[1][1])*f;else b=X2(T+c+(X?S:-S)/f,Z[0][1])*f;y=Math.max(y,b)}if(F){let b=0;if(!X&&!Y||X&&!Y&&L)b=X2(T+k/f,F[1][1])*f;else b=K2(T+(X?S:-S)/f,F[0][1])*f;y=Math.max(y,b)}}if(H){let V=f4(E*f,I,R)/f;if(D=Math.max(D,V),Z){let b=0;if(!X&&!Y||Y&&!X&&L)b=K2(B+E*f+l,Z[1][0])/f;else b=X2(B+(Y?w:-w)*f+l,Z[0][0])/f;D=Math.max(D,b)}if(F){let b=0;if(!X&&!Y||Y&&!X&&L)b=X2(B+E*f,F[1][0])/f;else b=K2(B+(Y?w:-w)*f,F[0][0])/f;D=Math.max(D,b)}}}if(w=w+(w<0?D:-D),S=S+(S<0?y:-y),U)if(L)if(k>E*f)w=(k7(X,Y)?-S:S)/f;else S=(k7(X,Y)?-w:w)*f;else if(K)w=S/f,Y=X;else S=w*f,X=Y;let v=X?B+S:B,x=Y?T+w:T;return{width:O+(X?-S:S),height:C+(Y?-w:w),x:G[0]*S*(!X?1:-1)+v,y:G[1]*w*(!Y?1:-1)+x}}var H9={width:0,height:0,x:0,y:0},tq={...H9,pointerX:0,pointerY:0,aspectRatio:1};function oq(_,Q,J){let q=Q.position.x+_.position.x,U=Q.position.y+_.position.y,G=_.measured.width??0,Z=_.measured.height??0,F=J[0]*G,X=J[1]*Z;return[[q-F,U-X],[q+G-F,U+Z-X]]}function X9({domNode:_,nodeId:Q,getStoreItems:J,onChange:q,onEnd:U}){let G=o1(_),Z={controlDirection:y7("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function F({controlPosition:Y,boundaries:K,keepAspectRatio:H,resizeDirection:L,onResizeStart:z,onResize:W,onResizeEnd:I,shouldResize:R}){let A={...H9},N={...tq};Z={boundaries:K,resizeDirection:L,keepAspectRatio:H,controlDirection:y7(Y)};let B=void 0,T=null,O=[],C=void 0,f=void 0,S=void 0,w=I5().on("start",(k)=>{let{nodeLookup:E,transform:l,snapGrid:c,snapToGrid:y,nodeOrigin:D,paneDomNode:v}=J();if(B=E.get(Q),!B)return;T=v?.getBoundingClientRect()??null;let{xSnapped:x,ySnapped:V}=g5(k.sourceEvent,{transform:l,snapGrid:c,snapToGrid:y,containerBounds:T});if(A={width:B.measured.width??0,height:B.measured.height??0,x:B.position.x??0,y:B.position.y??0},N={...A,pointerX:x,pointerY:V,aspectRatio:A.width/A.height},C=void 0,f=j2(B.extent)?B.extent:void 0,B.parentId&&(B.extent==="parent"||B.expandParent))C=E.get(B.parentId);if(C&&B.extent==="parent")f=[[0,0],[C.measured.width,C.measured.height]];O=[],S=void 0;for(let[b,P]of E)if(P.parentId===Q){if(O.push({id:b,position:{...P.position},extent:P.extent}),P.extent==="parent"||P.expandParent){let j=oq(P,B,P.origin??D);if(S)S=[[Math.min(j[0][0],S[0][0]),Math.min(j[0][1],S[0][1])],[Math.max(j[1][0],S[1][0]),Math.max(j[1][1],S[1][1])]];else S=j}}z?.(k,{...A})}).on("drag",(k)=>{let{transform:E,snapGrid:l,snapToGrid:c,nodeOrigin:y}=J(),D=g5(k.sourceEvent,{transform:E,snapGrid:l,snapToGrid:c,containerBounds:T}),v=[];if(!B)return;let{x,y:V,width:b,height:P}=A,j={},m=B.origin??y,{width:h,height:o,x:e,y:s}=sq(N,Z.controlDirection,D,Z.boundaries,Z.keepAspectRatio,m,f,S),t=h!==b,p=o!==P,n=e!==x&&t,J1=s!==V&&p;if(!n&&!J1&&!t&&!p)return;let q1={prevValues:{...A},startX:N.x,startY:N.y,childNodes:O.map((L1)=>({...L1,position:{...L1.position}}))};if(n||J1||m[0]===1||m[1]===1){if(j.x=n?e:A.x,j.y=J1?s:A.y,A.x=j.x,A.y=j.y,O.length>0){let L1=e-x,_1=s-V;for(let W1 of O)W1.position={x:W1.position.x-L1+m[0]*(h-b),y:W1.position.y-_1+m[1]*(o-P)},v.push(W1)}}if(t||p)j.width=t&&(!Z.resizeDirection||Z.resizeDirection==="horizontal")?h:A.width,j.height=p&&(!Z.resizeDirection||Z.resizeDirection==="vertical")?o:A.height,A.width=j.width,A.height=j.height;if(C&&B.expandParent){let L1=m[0]*(j.width??0);if(j.x&&j.x<L1)A.x=L1,N.x=N.x-(j.x-L1);let _1=m[1]*(j.height??0);if(j.y&&j.y<_1)A.y=_1,N.y=N.y-(j.y-_1)}let F1=aq({width:A.width,prevWidth:b,height:A.height,prevHeight:P,affectsX:Z.controlDirection.affectsX,affectsY:Z.controlDirection.affectsY}),Z1={...A,direction:F1};if(R?.(k,Z1)===!1){A=q1.prevValues,N.x=q1.startX,N.y=q1.startY,O.forEach((L1,_1)=>{L1.position=q1.childNodes[_1].position});return}W?.(k,Z1),q(j,v)}).on("end",(k)=>{I?.(k,{...A}),U?.({...A})});G.call(w)}function X(){G.on(".drag",null)}return{update:F,destroy:X}}var A9=J0(h0(),1),B9=J0(Y9(),1);var L9=(_)=>{let Q,J=new Set,q=(K,H)=>{let L=typeof K==="function"?K(Q):K;if(!Object.is(L,Q)){let z=Q;Q=(H!=null?H:typeof L!=="object"||L===null)?L:Object.assign({},Q,L),J.forEach((W)=>W(Q,z))}},U=()=>Q,X={setState:q,getState:U,getInitialState:()=>Y,subscribe:(K)=>{return J.add(K),()=>J.delete(K)},destroy:()=>{if((import.meta.env?import.meta.env.MODE:void 0)!=="production")console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.");J.clear()}},Y=Q=_(q,U,X);return X},z9=(_)=>_?L9(_):L9;var{useDebugValue:_U}=A9.default,{useSyncExternalStoreWithSelector:QU}=B9.default,JU=(_)=>_;function J8(_,Q=JU,J){let q=QU(_.subscribe,_.getState,_.getServerState||_.getInitialState,Q,J);return _U(q),q}var W9=(_,Q)=>{let J=z9(_),q=(U,G=Q)=>J8(J,U,G);return Object.assign(q,J),q},M9=(_,Q)=>_?W9(_,Q):W9;function b1(_,Q){if(Object.is(_,Q))return!0;if(typeof _!=="object"||_===null||typeof Q!=="object"||Q===null)return!1;if(_ instanceof Map&&Q instanceof Map){if(_.size!==Q.size)return!1;for(let[q,U]of _)if(!Object.is(U,Q.get(q)))return!1;return!0}if(_ instanceof Set&&Q instanceof Set){if(_.size!==Q.size)return!1;for(let q of _)if(!Q.has(q))return!1;return!0}let J=Object.keys(_);if(J.length!==Object.keys(Q).length)return!1;for(let q of J)if(!Object.prototype.hasOwnProperty.call(Q,q)||!Object.is(_[q],Q[q]))return!1;return!0}var s9=J0(O9(),1),r4=d.createContext(null),UU=r4.Provider,t9=X0.error001("react");function S1(_,Q){let J=d.useContext(r4);if(J===null)throw Error(t9);return J8(J,_,Q)}function E1(){let _=d.useContext(r4);if(_===null)throw Error(t9);return d.useMemo(()=>({getState:_.getState,setState:_.setState,subscribe:_.subscribe}),[_])}var I9={display:"none"},GU={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},o9="react-flow__node-desc",n9="react-flow__edge-desc",ZU="react-flow__aria-live",FU=(_)=>_.ariaLiveMessage,HU=(_)=>_.ariaLabelConfig;function XU({rfId:_}){let Q=S1(FU);return i.jsx("div",{id:`${ZU}-${_}`,"aria-live":"assertive","aria-atomic":"true",style:GU,children:Q})}function KU({rfId:_,disableKeyboardA11y:Q}){let J=S1(HU);return i.jsxs(i.Fragment,{children:[i.jsx("div",{id:`${o9}-${_}`,style:I9,children:Q?J["node.a11yDescription.default"]:J["node.a11yDescription.keyboardDisabled"]}),i.jsx("div",{id:`${n9}-${_}`,style:I9,children:J["edge.a11yDescription.default"]}),!Q&&i.jsx(XU,{rfId:_})]})}var g0=d.forwardRef(({position:_="top-left",children:Q,className:J,style:q,...U},G)=>{let Z=`${_}`.split("-");return i.jsx("div",{className:c1(["react-flow__panel",J,...Z]),style:q,ref:G,...U,children:Q})});g0.displayName="Panel";var P9="https://reactflow.dev/attribution";function YU({proOptions:_,position:Q="bottom-right"}){if(d.useEffect(()=>{x7("react")},[]),_?.hideAttribution)return null;return i.jsx(g0,{position:Q,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${P9}`,children:i.jsx("a",{href:P9,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var LU=(_)=>{let Q=[],J=[];for(let[,q]of _.nodeLookup)if(q.selected)Q.push(q.internals.userNode);for(let[,q]of _.edgeLookup)if(q.selected)J.push(q);return{selectedNodes:Q,selectedEdges:J}},g4=(_)=>_.id;function zU(_,Q){return b1(_.selectedNodes.map(g4),Q.selectedNodes.map(g4))&&b1(_.selectedEdges.map(g4),Q.selectedEdges.map(g4))}function WU({onSelectionChange:_}){let Q=E1(),{selectedNodes:J,selectedEdges:q}=S1(LU,zU);return d.useEffect(()=>{let U={nodes:J,edges:q};_?.(U),Q.getState().onSelectionChangeHandlers.forEach((G)=>G(U))},[J,q,_]),null}var AU=(_)=>!!_.onSelectionChangeHandlers;function BU({onSelectionChange:_}){let Q=S1(AU);if(_||Q)return i.jsx(WU,{onSelectionChange:_});return null}var e9=[0,0],MU={x:0,y:0,zoom:1},TU=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],N9=[...TU,"rfId"],RU=(_)=>({setNodes:_.setNodes,setEdges:_.setEdges,setMinZoom:_.setMinZoom,setMaxZoom:_.setMaxZoom,setTranslateExtent:_.setTranslateExtent,setNodeExtent:_.setNodeExtent,reset:_.reset,setDefaultNodesAndEdges:_.setDefaultNodesAndEdges}),w9={translateExtent:q5,nodeOrigin:e9,minZoom:0.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function OU(_){let{setNodes:Q,setEdges:J,setMinZoom:q,setMaxZoom:U,setTranslateExtent:G,setNodeExtent:Z,reset:F,setDefaultNodesAndEdges:X}=S1(RU,b1),Y=E1();d.useEffect(()=>{return X(_.defaultNodes,_.defaultEdges),()=>{K.current=w9,F()}},[]);let K=d.useRef(w9);return d.useEffect(()=>{for(let H of N9){let L=_[H],z=K.current[H];if(L===z)continue;if(typeof _[H]>"u")continue;if(H==="nodes")Q(L);else if(H==="edges")J(L);else if(H==="minZoom")q(L);else if(H==="maxZoom")U(L);else if(H==="translateExtent")G(L);else if(H==="nodeExtent")Z(L);else if(H==="ariaLabelConfig")Y.setState({ariaLabelConfig:E7(L)});else if(H==="fitView")Y.setState({fitViewQueued:L});else if(H==="fitViewOptions")Y.setState({fitViewOptions:L});else Y.setState({[H]:L})}K.current=_},N9.map((H)=>_[H])),null}function f9(){if(typeof window>"u"||!window.matchMedia)return null;return window.matchMedia("(prefers-color-scheme: dark)")}function IU(_){let[Q,J]=d.useState(_==="system"?null:_);return d.useEffect(()=>{if(_!=="system"){J(_);return}let q=f9(),U=()=>J(q?.matches?"dark":"light");return U(),q?.addEventListener("change",U),()=>{q?.removeEventListener("change",U)}},[_]),Q!==null?Q:f9()?.matches?"dark":"light"}var C9=typeof document<"u"?document:null;function i5(_=null,Q={target:C9,actInsideInputWithModifier:!0}){let[J,q]=d.useState(!1),U=d.useRef(!1),G=d.useRef(new Set([])),[Z,F]=d.useMemo(()=>{if(_!==null){let Y=(Array.isArray(_)?_:[_]).filter((H)=>typeof H==="string").map((H)=>H.replace(/\+/g,`
|
|
27
|
+
<%s key={someKey} {...props} />`,h,s,o,s),D[s+h]=!0)}if(s=null,m!==void 0&&(J(m),s=""+m),Z(u)&&(J(u.key),s=""+u.key),"key"in u){m={};for(var l in u)l!=="key"&&(m[l]=u[l])}else m=u;return s&&F(m,typeof P==="function"?P.displayName||P.name||"Unknown":P),Y(P,s,m,U(),t,Q1)}function H(P){L(P)?P._store&&(P._store.validated=1):typeof P==="object"&&P!==null&&P.$$typeof===S&&(P._payload.status==="fulfilled"?L(P._payload.value)&&P._payload.value._store&&(P._payload.value._store.validated=1):P._store&&(P._store.validated=1))}function L(P){return typeof P==="object"&&P!==null&&P.$$typeof===z}var z=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),A=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),E=h2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,r=Object.prototype.hasOwnProperty,c=Array.isArray,y=console.createTask?console.createTask:function(){return null};h2={react_stack_bottom_frame:function(P){return P()}};var b,v={},x=h2.react_stack_bottom_frame.bind(h2,G)(),V=y(q(G)),D={};fZ.Fragment=I,fZ.jsxDEV=function(P,u,m,h){var t=1e4>E.recentlyCreatedOwnerStacks++;return K(P,u,m,h,t?Error("react-stack-top-frame"):x,t?y(q(P)):V)}})()});var p=J0(D0(),1);var d=J0(g8(),1),a=J0(D0(),1);function i1(_){if(typeof _==="string"||typeof _==="number")return""+_;let Q="";if(Array.isArray(_)){for(let J=0,q;J<_.length;J++)if((q=i1(_[J]))!=="")Q+=(Q&&" ")+q}else for(let J in _)if(_[J])Q+=(Q&&" ")+J;return Q}var UJ={value:()=>{}};function c8(){for(var _=0,Q=arguments.length,J={},q;_<Q;++_){if(!(q=arguments[_]+"")||q in J||/[\s.]/.test(q))throw Error("illegal type: "+q);J[q]=[]}return new K4(J)}function K4(_){this._=_}function GJ(_,Q){return _.trim().split(/^|\s+/).map(function(J){var q="",U=J.indexOf(".");if(U>=0)q=J.slice(U+1),J=J.slice(0,U);if(J&&!Q.hasOwnProperty(J))throw Error("unknown type: "+J);return{type:J,name:q}})}K4.prototype=c8.prototype={constructor:K4,on:function(_,Q){var J=this._,q=GJ(_+"",J),U,G=-1,Z=q.length;if(arguments.length<2){while(++G<Z)if((U=(_=q[G]).type)&&(U=ZJ(J[U],_.name)))return U;return}if(Q!=null&&typeof Q!=="function")throw Error("invalid callback: "+Q);while(++G<Z)if(U=(_=q[G]).type)J[U]=p8(J[U],_.name,Q);else if(Q==null)for(U in J)J[U]=p8(J[U],_.name,null);return this},copy:function(){var _={},Q=this._;for(var J in Q)_[J]=Q[J].slice();return new K4(_)},call:function(_,Q){if((U=arguments.length-2)>0)for(var J=Array(U),q=0,U,G;q<U;++q)J[q]=arguments[q+2];if(!this._.hasOwnProperty(_))throw Error("unknown type: "+_);for(G=this._[_],q=0,U=G.length;q<U;++q)G[q].value.apply(Q,J)},apply:function(_,Q,J){if(!this._.hasOwnProperty(_))throw Error("unknown type: "+_);for(var q=this._[_],U=0,G=q.length;U<G;++U)q[U].value.apply(Q,J)}};function ZJ(_,Q){for(var J=0,q=_.length,U;J<q;++J)if((U=_[J]).name===Q)return U.value}function p8(_,Q,J){for(var q=0,U=_.length;q<U;++q)if(_[q].name===Q){_[q]=UJ,_=_.slice(0,q).concat(_.slice(q+1));break}if(J!=null)_.push({name:Q,value:J});return _}var R2=c8;function i2(_){return function(){return this.matches(_)}}function Y4(_){return function(Q){return Q.matches(_)}}var L4="http://www.w3.org/1999/xhtml",M3={svg:"http://www.w3.org/2000/svg",xhtml:L4,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function b0(_){var Q=_+="",J=Q.indexOf(":");if(J>=0&&(Q=_.slice(0,J))!=="xmlns")_=_.slice(J+1);return M3.hasOwnProperty(Q)?{space:M3[Q],local:_}:_}function T3(_){let Q;while(Q=_.sourceEvent)_=Q;return _}function U0(_,Q){if(_=T3(_),Q===void 0)Q=_.currentTarget;if(Q){var J=Q.ownerSVGElement||Q;if(J.createSVGPoint){var q=J.createSVGPoint();return q.x=_.clientX,q.y=_.clientY,q=q.matrixTransform(Q.getScreenCTM().inverse()),[q.x,q.y]}if(Q.getBoundingClientRect){var U=Q.getBoundingClientRect();return[_.clientX-U.left-Q.clientLeft,_.clientY-U.top-Q.clientTop]}}return[_.pageX,_.pageY]}function FJ(){}function H2(_){return _==null?FJ:function(){return this.querySelector(_)}}function R3(_){if(typeof _!=="function")_=H2(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=Array(Z),X,Y,K=0;K<Z;++K)if((X=G[K])&&(Y=_.call(X,X.__data__,K,G))){if("__data__"in X)Y.__data__=X.__data__;F[K]=Y}return new d1(q,this._parents)}function O3(_){return _==null?[]:Array.isArray(_)?_:Array.from(_)}function HJ(){return[]}function d2(_){return _==null?HJ:function(){return this.querySelectorAll(_)}}function XJ(_){return function(){return O3(_.apply(this,arguments))}}function I3(_){if(typeof _==="function")_=XJ(_);else _=d2(_);for(var Q=this._groups,J=Q.length,q=[],U=[],G=0;G<J;++G)for(var Z=Q[G],F=Z.length,X,Y=0;Y<F;++Y)if(X=Z[Y])q.push(_.call(X,X.__data__,Y,Z)),U.push(X);return new d1(q,U)}var KJ=Array.prototype.find;function YJ(_){return function(){return KJ.call(this.children,_)}}function LJ(){return this.firstElementChild}function P3(_){return this.select(_==null?LJ:YJ(typeof _==="function"?_:Y4(_)))}var zJ=Array.prototype.filter;function WJ(){return Array.from(this.children)}function BJ(_){return function(){return zJ.call(this.children,_)}}function N3(_){return this.selectAll(_==null?WJ:BJ(typeof _==="function"?_:Y4(_)))}function w3(_){if(typeof _!=="function")_=i2(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=[],X,Y=0;Y<Z;++Y)if((X=G[Y])&&_.call(X,X.__data__,Y,G))F.push(X);return new d1(q,this._parents)}function T5(_){return Array(_.length)}function f3(){return new d1(this._enter||this._groups.map(T5),this._parents)}function R5(_,Q){this.ownerDocument=_.ownerDocument,this.namespaceURI=_.namespaceURI,this._next=null,this._parent=_,this.__data__=Q}R5.prototype={constructor:R5,appendChild:function(_){return this._parent.insertBefore(_,this._next)},insertBefore:function(_,Q){return this._parent.insertBefore(_,Q)},querySelector:function(_){return this._parent.querySelector(_)},querySelectorAll:function(_){return this._parent.querySelectorAll(_)}};function C3(_){return function(){return _}}function AJ(_,Q,J,q,U,G){var Z=0,F,X=Q.length,Y=G.length;for(;Z<Y;++Z)if(F=Q[Z])F.__data__=G[Z],q[Z]=F;else J[Z]=new R5(_,G[Z]);for(;Z<X;++Z)if(F=Q[Z])U[Z]=F}function MJ(_,Q,J,q,U,G,Z){var F,X,Y=new Map,K=Q.length,H=G.length,L=Array(K),z;for(F=0;F<K;++F)if(X=Q[F])if(L[F]=z=Z.call(X,X.__data__,F,Q)+"",Y.has(z))U[F]=X;else Y.set(z,X);for(F=0;F<H;++F)if(z=Z.call(_,G[F],F,G)+"",X=Y.get(z))q[F]=X,X.__data__=G[F],Y.delete(z);else J[F]=new R5(_,G[F]);for(F=0;F<K;++F)if((X=Q[F])&&Y.get(L[F])===X)U[F]=X}function TJ(_){return _.__data__}function S3(_,Q){if(!arguments.length)return Array.from(this,TJ);var J=Q?MJ:AJ,q=this._parents,U=this._groups;if(typeof _!=="function")_=C3(_);for(var G=U.length,Z=Array(G),F=Array(G),X=Array(G),Y=0;Y<G;++Y){var K=q[Y],H=U[Y],L=H.length,z=RJ(_.call(K,K&&K.__data__,Y,q)),W=z.length,I=F[Y]=Array(W),M=Z[Y]=Array(W),B=X[Y]=Array(L);J(K,H,I,M,B,z,Q);for(var N=0,A=0,R,O;N<W;++N)if(R=I[N]){if(N>=A)A=N+1;while(!(O=M[A])&&++A<W);R._next=O||null}}return Z=new d1(Z,q),Z._enter=F,Z._exit=X,Z}function RJ(_){return typeof _==="object"&&"length"in _?_:Array.from(_)}function y3(){return new d1(this._exit||this._groups.map(T5),this._parents)}function k3(_,Q,J){var q=this.enter(),U=this,G=this.exit();if(typeof _==="function"){if(q=_(q),q)q=q.selection()}else q=q.append(_+"");if(Q!=null){if(U=Q(U),U)U=U.selection()}if(J==null)G.remove();else J(G);return q&&U?q.merge(U).order():U}function j3(_){var Q=_.selection?_.selection():_;for(var J=this._groups,q=Q._groups,U=J.length,G=q.length,Z=Math.min(U,G),F=Array(U),X=0;X<Z;++X)for(var Y=J[X],K=q[X],H=Y.length,L=F[X]=Array(H),z,W=0;W<H;++W)if(z=Y[W]||K[W])L[W]=z;for(;X<U;++X)F[X]=J[X];return new d1(F,this._parents)}function v3(){for(var _=this._groups,Q=-1,J=_.length;++Q<J;)for(var q=_[Q],U=q.length-1,G=q[U],Z;--U>=0;)if(Z=q[U]){if(G&&Z.compareDocumentPosition(G)^4)G.parentNode.insertBefore(Z,G);G=Z}return this}function V3(_){if(!_)_=OJ;function Q(H,L){return H&&L?_(H.__data__,L.__data__):!H-!L}for(var J=this._groups,q=J.length,U=Array(q),G=0;G<q;++G){for(var Z=J[G],F=Z.length,X=U[G]=Array(F),Y,K=0;K<F;++K)if(Y=Z[K])X[K]=Y;X.sort(Q)}return new d1(U,this._parents).order()}function OJ(_,Q){return _<Q?-1:_>Q?1:_>=Q?0:NaN}function u3(){var _=arguments[0];return arguments[0]=this,_.apply(null,arguments),this}function h3(){return Array.from(this)}function D3(){for(var _=this._groups,Q=0,J=_.length;Q<J;++Q)for(var q=_[Q],U=0,G=q.length;U<G;++U){var Z=q[U];if(Z)return Z}return null}function b3(){let _=0;for(let Q of this)++_;return _}function E3(){return!this.node()}function x3(_){for(var Q=this._groups,J=0,q=Q.length;J<q;++J)for(var U=Q[J],G=0,Z=U.length,F;G<Z;++G)if(F=U[G])_.call(F,F.__data__,G,U);return this}function IJ(_){return function(){this.removeAttribute(_)}}function PJ(_){return function(){this.removeAttributeNS(_.space,_.local)}}function NJ(_,Q){return function(){this.setAttribute(_,Q)}}function wJ(_,Q){return function(){this.setAttributeNS(_.space,_.local,Q)}}function fJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)this.removeAttribute(_);else this.setAttribute(_,J)}}function CJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)this.removeAttributeNS(_.space,_.local);else this.setAttributeNS(_.space,_.local,J)}}function m3(_,Q){var J=b0(_);if(arguments.length<2){var q=this.node();return J.local?q.getAttributeNS(J.space,J.local):q.getAttribute(J)}return this.each((Q==null?J.local?PJ:IJ:typeof Q==="function"?J.local?CJ:fJ:J.local?wJ:NJ)(J,Q))}function O5(_){return _.ownerDocument&&_.ownerDocument.defaultView||_.document&&_||_.defaultView}function SJ(_){return function(){this.style.removeProperty(_)}}function yJ(_,Q,J){return function(){this.style.setProperty(_,Q,J)}}function kJ(_,Q,J){return function(){var q=Q.apply(this,arguments);if(q==null)this.style.removeProperty(_);else this.style.setProperty(_,q,J)}}function g3(_,Q,J){return arguments.length>1?this.each((Q==null?SJ:typeof Q==="function"?kJ:yJ)(_,Q,J==null?"":J)):X2(this.node(),_)}function X2(_,Q){return _.style.getPropertyValue(Q)||O5(_).getComputedStyle(_,null).getPropertyValue(Q)}function jJ(_){return function(){delete this[_]}}function vJ(_,Q){return function(){this[_]=Q}}function VJ(_,Q){return function(){var J=Q.apply(this,arguments);if(J==null)delete this[_];else this[_]=J}}function p3(_,Q){return arguments.length>1?this.each((Q==null?jJ:typeof Q==="function"?VJ:vJ)(_,Q)):this.node()[_]}function l8(_){return _.trim().split(/^|\s+/)}function c3(_){return _.classList||new r8(_)}function r8(_){this._node=_,this._names=l8(_.getAttribute("class")||"")}r8.prototype={add:function(_){var Q=this._names.indexOf(_);if(Q<0)this._names.push(_),this._node.setAttribute("class",this._names.join(" "))},remove:function(_){var Q=this._names.indexOf(_);if(Q>=0)this._names.splice(Q,1),this._node.setAttribute("class",this._names.join(" "))},contains:function(_){return this._names.indexOf(_)>=0}};function i8(_,Q){var J=c3(_),q=-1,U=Q.length;while(++q<U)J.add(Q[q])}function d8(_,Q){var J=c3(_),q=-1,U=Q.length;while(++q<U)J.remove(Q[q])}function uJ(_){return function(){i8(this,_)}}function hJ(_){return function(){d8(this,_)}}function DJ(_,Q){return function(){(Q.apply(this,arguments)?i8:d8)(this,_)}}function l3(_,Q){var J=l8(_+"");if(arguments.length<2){var q=c3(this.node()),U=-1,G=J.length;while(++U<G)if(!q.contains(J[U]))return!1;return!0}return this.each((typeof Q==="function"?DJ:Q?uJ:hJ)(J,Q))}function bJ(){this.textContent=""}function EJ(_){return function(){this.textContent=_}}function xJ(_){return function(){var Q=_.apply(this,arguments);this.textContent=Q==null?"":Q}}function r3(_){return arguments.length?this.each(_==null?bJ:(typeof _==="function"?xJ:EJ)(_)):this.node().textContent}function mJ(){this.innerHTML=""}function gJ(_){return function(){this.innerHTML=_}}function pJ(_){return function(){var Q=_.apply(this,arguments);this.innerHTML=Q==null?"":Q}}function i3(_){return arguments.length?this.each(_==null?mJ:(typeof _==="function"?pJ:gJ)(_)):this.node().innerHTML}function cJ(){if(this.nextSibling)this.parentNode.appendChild(this)}function d3(){return this.each(cJ)}function lJ(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function a3(){return this.each(lJ)}function rJ(_){return function(){var Q=this.ownerDocument,J=this.namespaceURI;return J===L4&&Q.documentElement.namespaceURI===L4?Q.createElement(_):Q.createElementNS(J,_)}}function iJ(_){return function(){return this.ownerDocument.createElementNS(_.space,_.local)}}function I5(_){var Q=b0(_);return(Q.local?iJ:rJ)(Q)}function s3(_){var Q=typeof _==="function"?_:I5(_);return this.select(function(){return this.appendChild(Q.apply(this,arguments))})}function dJ(){return null}function t3(_,Q){var J=typeof _==="function"?_:I5(_),q=Q==null?dJ:typeof Q==="function"?Q:H2(Q);return this.select(function(){return this.insertBefore(J.apply(this,arguments),q.apply(this,arguments)||null)})}function aJ(){var _=this.parentNode;if(_)_.removeChild(this)}function o3(){return this.each(aJ)}function sJ(){var _=this.cloneNode(!1),Q=this.parentNode;return Q?Q.insertBefore(_,this.nextSibling):_}function tJ(){var _=this.cloneNode(!0),Q=this.parentNode;return Q?Q.insertBefore(_,this.nextSibling):_}function n3(_){return this.select(_?tJ:sJ)}function e3(_){return arguments.length?this.property("__data__",_):this.node().__data__}function oJ(_){return function(Q){_.call(this,Q,this.__data__)}}function nJ(_){return _.trim().split(/^|\s+/).map(function(Q){var J="",q=Q.indexOf(".");if(q>=0)J=Q.slice(q+1),Q=Q.slice(0,q);return{type:Q,name:J}})}function eJ(_){return function(){var Q=this.__on;if(!Q)return;for(var J=0,q=-1,U=Q.length,G;J<U;++J)if(G=Q[J],(!_.type||G.type===_.type)&&G.name===_.name)this.removeEventListener(G.type,G.listener,G.options);else Q[++q]=G;if(++q)Q.length=q;else delete this.__on}}function _$(_,Q,J){return function(){var q=this.__on,U,G=oJ(Q);if(q){for(var Z=0,F=q.length;Z<F;++Z)if((U=q[Z]).type===_.type&&U.name===_.name){this.removeEventListener(U.type,U.listener,U.options),this.addEventListener(U.type,U.listener=G,U.options=J),U.value=Q;return}}if(this.addEventListener(_.type,G,J),U={type:_.type,name:_.name,value:Q,listener:G,options:J},!q)this.__on=[U];else q.push(U)}}function _6(_,Q,J){var q=nJ(_+""),U,G=q.length,Z;if(arguments.length<2){var F=this.node().__on;if(F){for(var X=0,Y=F.length,K;X<Y;++X)for(U=0,K=F[X];U<G;++U)if((Z=q[U]).type===K.type&&Z.name===K.name)return K.value}return}F=Q?_$:eJ;for(U=0;U<G;++U)this.each(F(q[U],Q,J));return this}function a8(_,Q,J){var q=O5(_),U=q.CustomEvent;if(typeof U==="function")U=new U(Q,J);else if(U=q.document.createEvent("Event"),J)U.initEvent(Q,J.bubbles,J.cancelable),U.detail=J.detail;else U.initEvent(Q,!1,!1);_.dispatchEvent(U)}function Q$(_,Q){return function(){return a8(this,_,Q)}}function J$(_,Q){return function(){return a8(this,_,Q.apply(this,arguments))}}function Q6(_,Q){return this.each((typeof Q==="function"?J$:Q$)(_,Q))}function*J6(){for(var _=this._groups,Q=0,J=_.length;Q<J;++Q)for(var q=_[Q],U=0,G=q.length,Z;U<G;++U)if(Z=q[U])yield Z}var $6=[null];function d1(_,Q){this._groups=_,this._parents=Q}function s8(){return new d1([[document.documentElement]],$6)}function $$(){return this}d1.prototype=s8.prototype={constructor:d1,select:R3,selectAll:I3,selectChild:P3,selectChildren:N3,filter:w3,data:S3,enter:f3,exit:y3,join:k3,merge:j3,selection:$$,order:v3,sort:V3,call:u3,nodes:h3,node:D3,size:b3,empty:E3,each:x3,attr:m3,style:g3,property:p3,classed:l3,text:r3,html:i3,raise:d3,lower:a3,append:s3,insert:t3,remove:o3,clone:n3,datum:e3,on:_6,dispatch:Q6,[Symbol.iterator]:J6};var d0=s8;function n1(_){return typeof _==="string"?new d1([[document.querySelector(_)]],[document.documentElement]):new d1([[_]],$6)}var t8={passive:!1},O2={capture:!0,passive:!1};function z4(_){_.stopImmediatePropagation()}function a0(_){_.preventDefault(),_.stopImmediatePropagation()}function a2(_){var Q=_.document.documentElement,J=n1(_).on("dragstart.drag",a0,O2);if("onselectstart"in Q)J.on("selectstart.drag",a0,O2);else Q.__noselect=Q.style.MozUserSelect,Q.style.MozUserSelect="none"}function P5(_,Q){var J=_.document.documentElement,q=n1(_).on("dragstart.drag",null);if(Q)q.on("click.drag",a0,O2),setTimeout(function(){q.on("click.drag",null)},0);if("onselectstart"in J)q.on("selectstart.drag",null);else J.style.MozUserSelect=J.__noselect,delete J.__noselect}var N5=(_)=>()=>_;function w5(_,{sourceEvent:Q,subject:J,target:q,identifier:U,active:G,x:Z,y:F,dx:X,dy:Y,dispatch:K}){Object.defineProperties(this,{type:{value:_,enumerable:!0,configurable:!0},sourceEvent:{value:Q,enumerable:!0,configurable:!0},subject:{value:J,enumerable:!0,configurable:!0},target:{value:q,enumerable:!0,configurable:!0},identifier:{value:U,enumerable:!0,configurable:!0},active:{value:G,enumerable:!0,configurable:!0},x:{value:Z,enumerable:!0,configurable:!0},y:{value:F,enumerable:!0,configurable:!0},dx:{value:X,enumerable:!0,configurable:!0},dy:{value:Y,enumerable:!0,configurable:!0},_:{value:K}})}w5.prototype.on=function(){var _=this._.on.apply(this._,arguments);return _===this._?this:_};function q$(_){return!_.ctrlKey&&!_.button}function U$(){return this.parentNode}function G$(_,Q){return Q==null?{x:_.x,y:_.y}:Q}function Z$(){return navigator.maxTouchPoints||"ontouchstart"in this}function f5(){var _=q$,Q=U$,J=G$,q=Z$,U={},G=R2("start","drag","end"),Z=0,F,X,Y,K,H=0;function L(R){R.on("mousedown.drag",z).filter(q).on("touchstart.drag",M).on("touchmove.drag",B,t8).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function z(R,O){if(K||!_.call(this,R,O))return;var C=A(this,Q.call(this,R,O),R,O,"mouse");if(!C)return;n1(R.view).on("mousemove.drag",W,O2).on("mouseup.drag",I,O2),a2(R.view),z4(R),Y=!1,F=R.clientX,X=R.clientY,C("start",R)}function W(R){if(a0(R),!Y){var O=R.clientX-F,C=R.clientY-X;Y=O*O+C*C>H}U.mouse("drag",R)}function I(R){n1(R.view).on("mousemove.drag mouseup.drag",null),P5(R.view,Y),a0(R),U.mouse("end",R)}function M(R,O){if(!_.call(this,R,O))return;var C=R.changedTouches,f=Q.call(this,R,O),S=C.length,w,k;for(w=0;w<S;++w)if(k=A(this,f,R,O,C[w].identifier,C[w]))z4(R),k("start",R,C[w])}function B(R){var O=R.changedTouches,C=O.length,f,S;for(f=0;f<C;++f)if(S=U[O[f].identifier])a0(R),S("drag",R,O[f])}function N(R){var O=R.changedTouches,C=O.length,f,S;if(K)clearTimeout(K);K=setTimeout(function(){K=null},500);for(f=0;f<C;++f)if(S=U[O[f].identifier])z4(R),S("end",R,O[f])}function A(R,O,C,f,S,w){var k=G.copy(),E=U0(w||C,O),r,c,y;if((y=J.call(R,new w5("beforestart",{sourceEvent:C,target:L,identifier:S,active:Z,x:E[0],y:E[1],dx:0,dy:0,dispatch:k}),f))==null)return;return r=y.x-E[0]||0,c=y.y-E[1]||0,function b(v,x,V){var D=E,P;switch(v){case"start":U[S]=b,P=Z++;break;case"end":delete U[S],--Z;case"drag":E=U0(V||x,O),P=Z;break}k.call(v,R,new w5(v,{sourceEvent:x,subject:y,target:L,identifier:S,active:P,x:E[0]+r,y:E[1]+c,dx:E[0]-D[0],dy:E[1]-D[1],dispatch:k}),f)}}return L.filter=function(R){return arguments.length?(_=typeof R==="function"?R:N5(!!R),L):_},L.container=function(R){return arguments.length?(Q=typeof R==="function"?R:N5(R),L):Q},L.subject=function(R){return arguments.length?(J=typeof R==="function"?R:N5(R),L):J},L.touchable=function(R){return arguments.length?(q=typeof R==="function"?R:N5(!!R),L):q},L.on=function(){var R=G.on.apply(G,arguments);return R===G?L:R},L.clickDistance=function(R){return arguments.length?(H=(R=+R)*R,L):Math.sqrt(H)},L}function C5(_,Q,J){_.prototype=Q.prototype=J,J.constructor=_}function q6(_,Q){var J=Object.create(_.prototype);for(var q in Q)J[q]=Q[q];return J}function k5(){}var S5=0.7,A4=1/S5,s2="\\s*([+-]?\\d+)\\s*",y5="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",E0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",F$=/^#([0-9a-f]{3,8})$/,H$=new RegExp(`^rgb\\(${s2},${s2},${s2}\\)$`),X$=new RegExp(`^rgb\\(${E0},${E0},${E0}\\)$`),K$=new RegExp(`^rgba\\(${s2},${s2},${s2},${y5}\\)$`),Y$=new RegExp(`^rgba\\(${E0},${E0},${E0},${y5}\\)$`),L$=new RegExp(`^hsl\\(${y5},${E0},${E0}\\)$`),z$=new RegExp(`^hsla\\(${y5},${E0},${E0},${y5}\\)$`),o8={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};C5(k5,j0,{copy(_){return Object.assign(new this.constructor,this,_)},displayable(){return this.rgb().displayable()},hex:n8,formatHex:n8,formatHex8:W$,formatHsl:B$,formatRgb:e8,toString:e8});function n8(){return this.rgb().formatHex()}function W$(){return this.rgb().formatHex8()}function B$(){return U7(this).formatHsl()}function e8(){return this.rgb().formatRgb()}function j0(_){var Q,J;return _=(_+"").trim().toLowerCase(),(Q=F$.exec(_))?(J=Q[1].length,Q=parseInt(Q[1],16),J===6?_7(Q):J===3?new z0(Q>>8&15|Q>>4&240,Q>>4&15|Q&240,(Q&15)<<4|Q&15,1):J===8?W4(Q>>24&255,Q>>16&255,Q>>8&255,(Q&255)/255):J===4?W4(Q>>12&15|Q>>8&240,Q>>8&15|Q>>4&240,Q>>4&15|Q&240,((Q&15)<<4|Q&15)/255):null):(Q=H$.exec(_))?new z0(Q[1],Q[2],Q[3],1):(Q=X$.exec(_))?new z0(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,1):(Q=K$.exec(_))?W4(Q[1],Q[2],Q[3],Q[4]):(Q=Y$.exec(_))?W4(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,Q[4]):(Q=L$.exec(_))?$7(Q[1],Q[2]/100,Q[3]/100,1):(Q=z$.exec(_))?$7(Q[1],Q[2]/100,Q[3]/100,Q[4]):o8.hasOwnProperty(_)?_7(o8[_]):_==="transparent"?new z0(NaN,NaN,NaN,0):null}function _7(_){return new z0(_>>16&255,_>>8&255,_&255,1)}function W4(_,Q,J,q){if(q<=0)_=Q=J=NaN;return new z0(_,Q,J,q)}function A$(_){if(!(_ instanceof k5))_=j0(_);if(!_)return new z0;return _=_.rgb(),new z0(_.r,_.g,_.b,_.opacity)}function t2(_,Q,J,q){return arguments.length===1?A$(_):new z0(_,Q,J,q==null?1:q)}function z0(_,Q,J,q){this.r=+_,this.g=+Q,this.b=+J,this.opacity=+q}C5(z0,t2,q6(k5,{brighter(_){return _=_==null?A4:Math.pow(A4,_),new z0(this.r*_,this.g*_,this.b*_,this.opacity)},darker(_){return _=_==null?S5:Math.pow(S5,_),new z0(this.r*_,this.g*_,this.b*_,this.opacity)},rgb(){return this},clamp(){return new z0(P2(this.r),P2(this.g),P2(this.b),M4(this.opacity))},displayable(){return-0.5<=this.r&&this.r<255.5&&(-0.5<=this.g&&this.g<255.5)&&(-0.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:Q7,formatHex:Q7,formatHex8:M$,formatRgb:J7,toString:J7}));function Q7(){return`#${I2(this.r)}${I2(this.g)}${I2(this.b)}`}function M$(){return`#${I2(this.r)}${I2(this.g)}${I2(this.b)}${I2((isNaN(this.opacity)?1:this.opacity)*255)}`}function J7(){let _=M4(this.opacity);return`${_===1?"rgb(":"rgba("}${P2(this.r)}, ${P2(this.g)}, ${P2(this.b)}${_===1?")":`, ${_})`}`}function M4(_){return isNaN(_)?1:Math.max(0,Math.min(1,_))}function P2(_){return Math.max(0,Math.min(255,Math.round(_)||0))}function I2(_){return _=P2(_),(_<16?"0":"")+_.toString(16)}function $7(_,Q,J,q){if(q<=0)_=Q=J=NaN;else if(J<=0||J>=1)_=Q=NaN;else if(Q<=0)_=NaN;return new k0(_,Q,J,q)}function U7(_){if(_ instanceof k0)return new k0(_.h,_.s,_.l,_.opacity);if(!(_ instanceof k5))_=j0(_);if(!_)return new k0;if(_ instanceof k0)return _;_=_.rgb();var Q=_.r/255,J=_.g/255,q=_.b/255,U=Math.min(Q,J,q),G=Math.max(Q,J,q),Z=NaN,F=G-U,X=(G+U)/2;if(F){if(Q===G)Z=(J-q)/F+(J<q)*6;else if(J===G)Z=(q-Q)/F+2;else Z=(Q-J)/F+4;F/=X<0.5?G+U:2-G-U,Z*=60}else F=X>0&&X<1?0:Z;return new k0(Z,F,X,_.opacity)}function G7(_,Q,J,q){return arguments.length===1?U7(_):new k0(_,Q,J,q==null?1:q)}function k0(_,Q,J,q){this.h=+_,this.s=+Q,this.l=+J,this.opacity=+q}C5(k0,G7,q6(k5,{brighter(_){return _=_==null?A4:Math.pow(A4,_),new k0(this.h,this.s,this.l*_,this.opacity)},darker(_){return _=_==null?S5:Math.pow(S5,_),new k0(this.h,this.s,this.l*_,this.opacity)},rgb(){var _=this.h%360+(this.h<0)*360,Q=isNaN(_)||isNaN(this.s)?0:this.s,J=this.l,q=J+(J<0.5?J:1-J)*Q,U=2*J-q;return new z0(U6(_>=240?_-240:_+120,U,q),U6(_,U,q),U6(_<120?_+240:_-120,U,q),this.opacity)},clamp(){return new k0(q7(this.h),B4(this.s),B4(this.l),M4(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)},formatHsl(){let _=M4(this.opacity);return`${_===1?"hsl(":"hsla("}${q7(this.h)}, ${B4(this.s)*100}%, ${B4(this.l)*100}%${_===1?")":`, ${_})`}`}}));function q7(_){return _=(_||0)%360,_<0?_+360:_}function B4(_){return Math.max(0,Math.min(1,_||0))}function U6(_,Q,J){return(_<60?Q+(J-Q)*_/60:_<180?J:_<240?Q+(J-Q)*(240-_)/60:Q)*255}function G6(_,Q,J,q,U){var G=_*_,Z=G*_;return((1-3*_+3*G-Z)*Q+(4-6*G+3*Z)*J+(1+3*_+3*G-3*Z)*q+Z*U)/6}function Z6(_){var Q=_.length-1;return function(J){var q=J<=0?J=0:J>=1?(J=1,Q-1):Math.floor(J*Q),U=_[q],G=_[q+1],Z=q>0?_[q-1]:2*U-G,F=q<Q-1?_[q+2]:2*G-U;return G6((J-q/Q)*Q,Z,U,G,F)}}function F6(_){var Q=_.length;return function(J){var q=Math.floor(((J%=1)<0?++J:J)*Q),U=_[(q+Q-1)%Q],G=_[q%Q],Z=_[(q+1)%Q],F=_[(q+2)%Q];return G6((J-q/Q)*Q,U,G,Z,F)}}var j5=(_)=>()=>_;function T$(_,Q){return function(J){return _+J*Q}}function R$(_,Q,J){return _=Math.pow(_,J),Q=Math.pow(Q,J)-_,J=1/J,function(q){return Math.pow(_+q*Q,J)}}function Z7(_){return(_=+_)===1?T4:function(Q,J){return J-Q?R$(Q,J,_):j5(isNaN(Q)?J:Q)}}function T4(_,Q){var J=Q-_;return J?T$(_,J):j5(isNaN(_)?Q:_)}var N2=function _(Q){var J=Z7(Q);function q(U,G){var Z=J((U=t2(U)).r,(G=t2(G)).r),F=J(U.g,G.g),X=J(U.b,G.b),Y=T4(U.opacity,G.opacity);return function(K){return U.r=Z(K),U.g=F(K),U.b=X(K),U.opacity=Y(K),U+""}}return q.gamma=_,q}(1);function F7(_){return function(Q){var J=Q.length,q=Array(J),U=Array(J),G=Array(J),Z,F;for(Z=0;Z<J;++Z)F=t2(Q[Z]),q[Z]=F.r||0,U[Z]=F.g||0,G[Z]=F.b||0;return q=_(q),U=_(U),G=_(G),F.opacity=1,function(X){return F.r=q(X),F.g=U(X),F.b=G(X),F+""}}}var O$=F7(Z6),I$=F7(F6);function H6(_,Q){if(!Q)Q=[];var J=_?Math.min(Q.length,_.length):0,q=Q.slice(),U;return function(G){for(U=0;U<J;++U)q[U]=_[U]*(1-G)+Q[U]*G;return q}}function H7(_){return ArrayBuffer.isView(_)&&!(_ instanceof DataView)}function X7(_,Q){var J=Q?Q.length:0,q=_?Math.min(J,_.length):0,U=Array(q),G=Array(J),Z;for(Z=0;Z<q;++Z)U[Z]=x0(_[Z],Q[Z]);for(;Z<J;++Z)G[Z]=Q[Z];return function(F){for(Z=0;Z<q;++Z)G[Z]=U[Z](F);return G}}function X6(_,Q){var J=new Date;return _=+_,Q=+Q,function(q){return J.setTime(_*(1-q)+Q*q),J}}function G0(_,Q){return _=+_,Q=+Q,function(J){return _*(1-J)+Q*J}}function K6(_,Q){var J={},q={},U;if(_===null||typeof _!=="object")_={};if(Q===null||typeof Q!=="object")Q={};for(U in Q)if(U in _)J[U]=x0(_[U],Q[U]);else q[U]=Q[U];return function(G){for(U in J)q[U]=J[U](G);return q}}var L6=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Y6=new RegExp(L6.source,"g");function P$(_){return function(){return _}}function N$(_){return function(Q){return _(Q)+""}}function o2(_,Q){var J=L6.lastIndex=Y6.lastIndex=0,q,U,G,Z=-1,F=[],X=[];_=_+"",Q=Q+"";while((q=L6.exec(_))&&(U=Y6.exec(Q))){if((G=U.index)>J)if(G=Q.slice(J,G),F[Z])F[Z]+=G;else F[++Z]=G;if((q=q[0])===(U=U[0]))if(F[Z])F[Z]+=U;else F[++Z]=U;else F[++Z]=null,X.push({i:Z,x:G0(q,U)});J=Y6.lastIndex}if(J<Q.length)if(G=Q.slice(J),F[Z])F[Z]+=G;else F[++Z]=G;return F.length<2?X[0]?N$(X[0].x):P$(Q):(Q=X.length,function(Y){for(var K=0,H;K<Q;++K)F[(H=X[K]).i]=H.x(Y);return F.join("")})}function x0(_,Q){var J=typeof Q,q;return Q==null||J==="boolean"?j5(Q):(J==="number"?G0:J==="string"?(q=j0(Q))?(Q=q,N2):o2:Q instanceof j0?N2:Q instanceof Date?X6:H7(Q)?H6:Array.isArray(Q)?X7:typeof Q.valueOf!=="function"&&typeof Q.toString!=="function"||isNaN(Q)?K6:G0)(_,Q)}var K7=180/Math.PI,R4={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function O4(_,Q,J,q,U,G){var Z,F,X;if(Z=Math.sqrt(_*_+Q*Q))_/=Z,Q/=Z;if(X=_*J+Q*q)J-=_*X,q-=Q*X;if(F=Math.sqrt(J*J+q*q))J/=F,q/=F,X/=F;if(_*q<Q*J)_=-_,Q=-Q,X=-X,Z=-Z;return{translateX:U,translateY:G,rotate:Math.atan2(Q,_)*K7,skewX:Math.atan(X)*K7,scaleX:Z,scaleY:F}}var I4;function Y7(_){let Q=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(_+"");return Q.isIdentity?R4:O4(Q.a,Q.b,Q.c,Q.d,Q.e,Q.f)}function L7(_){if(_==null)return R4;if(!I4)I4=document.createElementNS("http://www.w3.org/2000/svg","g");if(I4.setAttribute("transform",_),!(_=I4.transform.baseVal.consolidate()))return R4;return _=_.matrix,O4(_.a,_.b,_.c,_.d,_.e,_.f)}function z7(_,Q,J,q){function U(Y){return Y.length?Y.pop()+" ":""}function G(Y,K,H,L,z,W){if(Y!==H||K!==L){var I=z.push("translate(",null,Q,null,J);W.push({i:I-4,x:G0(Y,H)},{i:I-2,x:G0(K,L)})}else if(H||L)z.push("translate("+H+Q+L+J)}function Z(Y,K,H,L){if(Y!==K){if(Y-K>180)K+=360;else if(K-Y>180)Y+=360;L.push({i:H.push(U(H)+"rotate(",null,q)-2,x:G0(Y,K)})}else if(K)H.push(U(H)+"rotate("+K+q)}function F(Y,K,H,L){if(Y!==K)L.push({i:H.push(U(H)+"skewX(",null,q)-2,x:G0(Y,K)});else if(K)H.push(U(H)+"skewX("+K+q)}function X(Y,K,H,L,z,W){if(Y!==H||K!==L){var I=z.push(U(z)+"scale(",null,",",null,")");W.push({i:I-4,x:G0(Y,H)},{i:I-2,x:G0(K,L)})}else if(H!==1||L!==1)z.push(U(z)+"scale("+H+","+L+")")}return function(Y,K){var H=[],L=[];return Y=_(Y),K=_(K),G(Y.translateX,Y.translateY,K.translateX,K.translateY,H,L),Z(Y.rotate,K.rotate,H,L),F(Y.skewX,K.skewX,H,L),X(Y.scaleX,Y.scaleY,K.scaleX,K.scaleY,H,L),Y=K=null,function(z){var W=-1,I=L.length,M;while(++W<I)H[(M=L[W]).i]=M.x(z);return H.join("")}}}var z6=z7(Y7,"px, ","px)","deg)"),W6=z7(L7,", ",")",")");var w$=0.000000000001;function W7(_){return((_=Math.exp(_))+1/_)/2}function f$(_){return((_=Math.exp(_))-1/_)/2}function C$(_){return((_=Math.exp(2*_))-1)/(_+1)}var w2=function _(Q,J,q){function U(G,Z){var F=G[0],X=G[1],Y=G[2],K=Z[0],H=Z[1],L=Z[2],z=K-F,W=H-X,I=z*z+W*W,M,B;if(I<w$)B=Math.log(L/Y)/Q,M=function(f){return[F+f*z,X+f*W,Y*Math.exp(Q*f*B)]};else{var N=Math.sqrt(I),A=(L*L-Y*Y+q*I)/(2*Y*J*N),R=(L*L-Y*Y-q*I)/(2*L*J*N),O=Math.log(Math.sqrt(A*A+1)-A),C=Math.log(Math.sqrt(R*R+1)-R);B=(C-O)/Q,M=function(f){var S=f*B,w=W7(O),k=Y/(J*N)*(w*C$(Q*S+O)-f$(O));return[F+k*z,X+k*W,Y*w/W7(Q*S+O)]}}return M.duration=B*1000*Q/Math.SQRT2,M}return U.rho=function(G){var Z=Math.max(0.001,+G),F=Z*Z,X=F*F;return _(Z,F,X)},U}(Math.SQRT2,2,4);var n2=0,V5=0,v5=0,A7=1000,P4,u5,N4=0,f2=0,w4=0,h5=typeof performance==="object"&&performance.now?performance:Date,M7=typeof window==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(_){setTimeout(_,17)};function b5(){return f2||(M7(S$),f2=h5.now()+w4)}function S$(){f2=0}function D5(){this._call=this._time=this._next=null}D5.prototype=f4.prototype={constructor:D5,restart:function(_,Q,J){if(typeof _!=="function")throw TypeError("callback is not a function");if(J=(J==null?b5():+J)+(Q==null?0:+Q),!this._next&&u5!==this){if(u5)u5._next=this;else P4=this;u5=this}this._call=_,this._time=J,B6()},stop:function(){if(this._call)this._call=null,this._time=1/0,B6()}};function f4(_,Q,J){var q=new D5;return q.restart(_,Q,J),q}function T7(){b5(),++n2;var _=P4,Q;while(_){if((Q=f2-_._time)>=0)_._call.call(void 0,Q);_=_._next}--n2}function B7(){f2=(N4=h5.now())+w4,n2=V5=0;try{T7()}finally{n2=0,k$(),f2=0}}function y$(){var _=h5.now(),Q=_-N4;if(Q>A7)w4-=Q,N4=_}function k$(){var _,Q=P4,J,q=1/0;while(Q)if(Q._call){if(q>Q._time)q=Q._time;_=Q,Q=Q._next}else J=Q._next,Q._next=null,Q=_?_._next=J:P4=J;u5=_,B6(q)}function B6(_){if(n2)return;if(V5)V5=clearTimeout(V5);var Q=_-f2;if(Q>24){if(_<1/0)V5=setTimeout(B7,_-h5.now()-w4);if(v5)v5=clearInterval(v5)}else{if(!v5)N4=h5.now(),v5=setInterval(y$,A7);n2=1,M7(B7)}}function E5(_,Q,J){var q=new D5;return Q=Q==null?0:+Q,q.restart((U)=>{q.stop(),_(U+Q)},Q,J),q}var j$=R2("start","end","cancel","interrupt"),v$=[],I7=0,R7=1,S4=2,C4=3,O7=4,y4=5,x5=6;function s0(_,Q,J,q,U,G){var Z=_.__transition;if(!Z)_.__transition={};else if(J in Z)return;V$(_,J,{name:Q,index:q,group:U,on:j$,tween:v$,time:G.time,delay:G.delay,duration:G.duration,ease:G.ease,timer:null,state:I7})}function m5(_,Q){var J=e1(_,Q);if(J.state>I7)throw Error("too late; already scheduled");return J}function $0(_,Q){var J=e1(_,Q);if(J.state>C4)throw Error("too late; already running");return J}function e1(_,Q){var J=_.__transition;if(!J||!(J=J[Q]))throw Error("transition not found");return J}function V$(_,Q,J){var q=_.__transition,U;q[Q]=J,J.timer=f4(G,0,J.time);function G(Y){if(J.state=R7,J.timer.restart(Z,J.delay,J.time),J.delay<=Y)Z(Y-J.delay)}function Z(Y){var K,H,L,z;if(J.state!==R7)return X();for(K in q){if(z=q[K],z.name!==J.name)continue;if(z.state===C4)return E5(Z);if(z.state===O7)z.state=x5,z.timer.stop(),z.on.call("interrupt",_,_.__data__,z.index,z.group),delete q[K];else if(+K<Q)z.state=x5,z.timer.stop(),z.on.call("cancel",_,_.__data__,z.index,z.group),delete q[K]}if(E5(function(){if(J.state===C4)J.state=O7,J.timer.restart(F,J.delay,J.time),F(Y)}),J.state=S4,J.on.call("start",_,_.__data__,J.index,J.group),J.state!==S4)return;J.state=C4,U=Array(L=J.tween.length);for(K=0,H=-1;K<L;++K)if(z=J.tween[K].value.call(_,_.__data__,J.index,J.group))U[++H]=z;U.length=H+1}function F(Y){var K=Y<J.duration?J.ease.call(null,Y/J.duration):(J.timer.restart(X),J.state=y4,1),H=-1,L=U.length;while(++H<L)U[H].call(_,K);if(J.state===y4)J.on.call("end",_,_.__data__,J.index,J.group),X()}function X(){J.state=x5,J.timer.stop(),delete q[Q];for(var Y in q)return;delete _.__transition}}function K2(_,Q){var J=_.__transition,q,U,G=!0,Z;if(!J)return;Q=Q==null?null:Q+"";for(Z in J){if((q=J[Z]).name!==Q){G=!1;continue}U=q.state>S4&&q.state<y4,q.state=x5,q.timer.stop(),q.on.call(U?"interrupt":"cancel",_,_.__data__,q.index,q.group),delete J[Z]}if(G)delete _.__transition}function A6(_){return this.each(function(){K2(this,_)})}function u$(_,Q){var J,q;return function(){var U=$0(this,_),G=U.tween;if(G!==J){q=J=G;for(var Z=0,F=q.length;Z<F;++Z)if(q[Z].name===Q){q=q.slice(),q.splice(Z,1);break}}U.tween=q}}function h$(_,Q,J){var q,U;if(typeof J!=="function")throw Error();return function(){var G=$0(this,_),Z=G.tween;if(Z!==q){U=(q=Z).slice();for(var F={name:Q,value:J},X=0,Y=U.length;X<Y;++X)if(U[X].name===Q){U[X]=F;break}if(X===Y)U.push(F)}G.tween=U}}function M6(_,Q){var J=this._id;if(_+="",arguments.length<2){var q=e1(this.node(),J).tween;for(var U=0,G=q.length,Z;U<G;++U)if((Z=q[U]).name===_)return Z.value;return null}return this.each((Q==null?u$:h$)(J,_,Q))}function e2(_,Q,J){var q=_._id;return _.each(function(){var U=$0(this,q);(U.value||(U.value={}))[Q]=J.apply(this,arguments)}),function(U){return e1(U,q).value[Q]}}function g5(_,Q){var J;return(typeof Q==="number"?G0:Q instanceof j0?N2:(J=j0(Q))?(Q=J,N2):o2)(_,Q)}function D$(_){return function(){this.removeAttribute(_)}}function b$(_){return function(){this.removeAttributeNS(_.space,_.local)}}function E$(_,Q,J){var q,U=J+"",G;return function(){var Z=this.getAttribute(_);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function x$(_,Q,J){var q,U=J+"",G;return function(){var Z=this.getAttributeNS(_.space,_.local);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function m$(_,Q,J){var q,U,G;return function(){var Z,F=J(this),X;if(F==null)return void this.removeAttribute(_);return Z=this.getAttribute(_),X=F+"",Z===X?null:Z===q&&X===U?G:(U=X,G=Q(q=Z,F))}}function g$(_,Q,J){var q,U,G;return function(){var Z,F=J(this),X;if(F==null)return void this.removeAttributeNS(_.space,_.local);return Z=this.getAttributeNS(_.space,_.local),X=F+"",Z===X?null:Z===q&&X===U?G:(U=X,G=Q(q=Z,F))}}function T6(_,Q){var J=b0(_),q=J==="transform"?W6:g5;return this.attrTween(_,typeof Q==="function"?(J.local?g$:m$)(J,q,e2(this,"attr."+_,Q)):Q==null?(J.local?b$:D$)(J):(J.local?x$:E$)(J,q,Q))}function p$(_,Q){return function(J){this.setAttribute(_,Q.call(this,J))}}function c$(_,Q){return function(J){this.setAttributeNS(_.space,_.local,Q.call(this,J))}}function l$(_,Q){var J,q;function U(){var G=Q.apply(this,arguments);if(G!==q)J=(q=G)&&c$(_,G);return J}return U._value=Q,U}function r$(_,Q){var J,q;function U(){var G=Q.apply(this,arguments);if(G!==q)J=(q=G)&&p$(_,G);return J}return U._value=Q,U}function R6(_,Q){var J="attr."+_;if(arguments.length<2)return(J=this.tween(J))&&J._value;if(Q==null)return this.tween(J,null);if(typeof Q!=="function")throw Error();var q=b0(_);return this.tween(J,(q.local?l$:r$)(q,Q))}function i$(_,Q){return function(){m5(this,_).delay=+Q.apply(this,arguments)}}function d$(_,Q){return Q=+Q,function(){m5(this,_).delay=Q}}function O6(_){var Q=this._id;return arguments.length?this.each((typeof _==="function"?i$:d$)(Q,_)):e1(this.node(),Q).delay}function a$(_,Q){return function(){$0(this,_).duration=+Q.apply(this,arguments)}}function s$(_,Q){return Q=+Q,function(){$0(this,_).duration=Q}}function I6(_){var Q=this._id;return arguments.length?this.each((typeof _==="function"?a$:s$)(Q,_)):e1(this.node(),Q).duration}function t$(_,Q){if(typeof Q!=="function")throw Error();return function(){$0(this,_).ease=Q}}function P6(_){var Q=this._id;return arguments.length?this.each(t$(Q,_)):e1(this.node(),Q).ease}function o$(_,Q){return function(){var J=Q.apply(this,arguments);if(typeof J!=="function")throw Error();$0(this,_).ease=J}}function N6(_){if(typeof _!=="function")throw Error();return this.each(o$(this._id,_))}function w6(_){if(typeof _!=="function")_=i2(_);for(var Q=this._groups,J=Q.length,q=Array(J),U=0;U<J;++U)for(var G=Q[U],Z=G.length,F=q[U]=[],X,Y=0;Y<Z;++Y)if((X=G[Y])&&_.call(X,X.__data__,Y,G))F.push(X);return new H0(q,this._parents,this._name,this._id)}function f6(_){if(_._id!==this._id)throw Error();for(var Q=this._groups,J=_._groups,q=Q.length,U=J.length,G=Math.min(q,U),Z=Array(q),F=0;F<G;++F)for(var X=Q[F],Y=J[F],K=X.length,H=Z[F]=Array(K),L,z=0;z<K;++z)if(L=X[z]||Y[z])H[z]=L;for(;F<q;++F)Z[F]=Q[F];return new H0(Z,this._parents,this._name,this._id)}function n$(_){return(_+"").trim().split(/^|\s+/).every(function(Q){var J=Q.indexOf(".");if(J>=0)Q=Q.slice(0,J);return!Q||Q==="start"})}function e$(_,Q,J){var q,U,G=n$(Q)?m5:$0;return function(){var Z=G(this,_),F=Z.on;if(F!==q)(U=(q=F).copy()).on(Q,J);Z.on=U}}function C6(_,Q){var J=this._id;return arguments.length<2?e1(this.node(),J).on.on(_):this.each(e$(J,_,Q))}function _q(_){return function(){var Q=this.parentNode;for(var J in this.__transition)if(+J!==_)return;if(Q)Q.removeChild(this)}}function S6(){return this.on("end.remove",_q(this._id))}function y6(_){var Q=this._name,J=this._id;if(typeof _!=="function")_=H2(_);for(var q=this._groups,U=q.length,G=Array(U),Z=0;Z<U;++Z)for(var F=q[Z],X=F.length,Y=G[Z]=Array(X),K,H,L=0;L<X;++L)if((K=F[L])&&(H=_.call(K,K.__data__,L,F))){if("__data__"in K)H.__data__=K.__data__;Y[L]=H,s0(Y[L],Q,J,L,Y,e1(K,J))}return new H0(G,this._parents,Q,J)}function k6(_){var Q=this._name,J=this._id;if(typeof _!=="function")_=d2(_);for(var q=this._groups,U=q.length,G=[],Z=[],F=0;F<U;++F)for(var X=q[F],Y=X.length,K,H=0;H<Y;++H)if(K=X[H]){for(var L=_.call(K,K.__data__,H,X),z,W=e1(K,J),I=0,M=L.length;I<M;++I)if(z=L[I])s0(z,Q,J,I,L,W);G.push(L),Z.push(K)}return new H0(G,Z,Q,J)}var Qq=d0.prototype.constructor;function j6(){return new Qq(this._groups,this._parents)}function Jq(_,Q){var J,q,U;return function(){var G=X2(this,_),Z=(this.style.removeProperty(_),X2(this,_));return G===Z?null:G===J&&Z===q?U:U=Q(J=G,q=Z)}}function P7(_){return function(){this.style.removeProperty(_)}}function $q(_,Q,J){var q,U=J+"",G;return function(){var Z=X2(this,_);return Z===U?null:Z===q?G:G=Q(q=Z,J)}}function qq(_,Q,J){var q,U,G;return function(){var Z=X2(this,_),F=J(this),X=F+"";if(F==null)X=F=(this.style.removeProperty(_),X2(this,_));return Z===X?null:Z===q&&X===U?G:(U=X,G=Q(q=Z,F))}}function Uq(_,Q){var J,q,U,G="style."+Q,Z="end."+G,F;return function(){var X=$0(this,_),Y=X.on,K=X.value[G]==null?F||(F=P7(Q)):void 0;if(Y!==J||U!==K)(q=(J=Y).copy()).on(Z,U=K);X.on=q}}function v6(_,Q,J){var q=(_+="")==="transform"?z6:g5;return Q==null?this.styleTween(_,Jq(_,q)).on("end.style."+_,P7(_)):typeof Q==="function"?this.styleTween(_,qq(_,q,e2(this,"style."+_,Q))).each(Uq(this._id,_)):this.styleTween(_,$q(_,q,Q),J).on("end.style."+_,null)}function Gq(_,Q,J){return function(q){this.style.setProperty(_,Q.call(this,q),J)}}function Zq(_,Q,J){var q,U;function G(){var Z=Q.apply(this,arguments);if(Z!==U)q=(U=Z)&&Gq(_,Z,J);return q}return G._value=Q,G}function V6(_,Q,J){var q="style."+(_+="");if(arguments.length<2)return(q=this.tween(q))&&q._value;if(Q==null)return this.tween(q,null);if(typeof Q!=="function")throw Error();return this.tween(q,Zq(_,Q,J==null?"":J))}function Fq(_){return function(){this.textContent=_}}function Hq(_){return function(){var Q=_(this);this.textContent=Q==null?"":Q}}function u6(_){return this.tween("text",typeof _==="function"?Hq(e2(this,"text",_)):Fq(_==null?"":_+""))}function Xq(_){return function(Q){this.textContent=_.call(this,Q)}}function Kq(_){var Q,J;function q(){var U=_.apply(this,arguments);if(U!==J)Q=(J=U)&&Xq(U);return Q}return q._value=_,q}function h6(_){var Q="text";if(arguments.length<1)return(Q=this.tween(Q))&&Q._value;if(_==null)return this.tween(Q,null);if(typeof _!=="function")throw Error();return this.tween(Q,Kq(_))}function D6(){var _=this._name,Q=this._id,J=k4();for(var q=this._groups,U=q.length,G=0;G<U;++G)for(var Z=q[G],F=Z.length,X,Y=0;Y<F;++Y)if(X=Z[Y]){var K=e1(X,Q);s0(X,_,J,Y,Z,{time:K.time+K.delay+K.duration,delay:0,duration:K.duration,ease:K.ease})}return new H0(q,this._parents,_,J)}function b6(){var _,Q,J=this,q=J._id,U=J.size();return new Promise(function(G,Z){var F={value:Z},X={value:function(){if(--U===0)G()}};if(J.each(function(){var Y=$0(this,q),K=Y.on;if(K!==_)Q=(_=K).copy(),Q._.cancel.push(F),Q._.interrupt.push(F),Q._.end.push(X);Y.on=Q}),U===0)G()})}var Yq=0;function H0(_,Q,J,q){this._groups=_,this._parents=Q,this._name=J,this._id=q}function N7(_){return d0().transition(_)}function k4(){return++Yq}var t0=d0.prototype;H0.prototype=N7.prototype={constructor:H0,select:y6,selectAll:k6,selectChild:t0.selectChild,selectChildren:t0.selectChildren,filter:w6,merge:f6,selection:j6,transition:D6,call:t0.call,nodes:t0.nodes,node:t0.node,size:t0.size,empty:t0.empty,each:t0.each,on:C6,attr:T6,attrTween:R6,style:v6,styleTween:V6,text:u6,textTween:h6,remove:S6,tween:M6,delay:O6,duration:I6,ease:P6,easeVarying:N6,end:b6,[Symbol.iterator]:t0[Symbol.iterator]};function j4(_){return((_*=2)<=1?_*_*_:(_-=2)*_*_+2)/2}var Lq={time:null,delay:0,duration:250,ease:j4};function zq(_,Q){var J;while(!(J=_.__transition)||!(J=J[Q]))if(!(_=_.parentNode))throw Error(`transition ${Q} not found`);return J}function E6(_){var Q,J;if(_ instanceof H0)Q=_._id,_=_._name;else Q=k4(),(J=Lq).time=b5(),_=_==null?null:_+"";for(var q=this._groups,U=q.length,G=0;G<U;++G)for(var Z=q[G],F=Z.length,X,Y=0;Y<F;++Y)if(X=Z[Y])s0(X,_,Q,Y,Z,J||zq(X,Q));return new H0(q,this._parents,_,Q)}d0.prototype.interrupt=A6;d0.prototype.transition=E6;var p5=(_)=>()=>_;function x6(_,{sourceEvent:Q,target:J,transform:q,dispatch:U}){Object.defineProperties(this,{type:{value:_,enumerable:!0,configurable:!0},sourceEvent:{value:Q,enumerable:!0,configurable:!0},target:{value:J,enumerable:!0,configurable:!0},transform:{value:q,enumerable:!0,configurable:!0},_:{value:U}})}function v0(_,Q,J){this.k=_,this.x=Q,this.y=J}v0.prototype={constructor:v0,scale:function(_){return _===1?this:new v0(this.k*_,this.x,this.y)},translate:function(_,Q){return _===0&Q===0?this:new v0(this.k,this.x+this.k*_,this.y+this.k*Q)},apply:function(_){return[_[0]*this.k+this.x,_[1]*this.k+this.y]},applyX:function(_){return _*this.k+this.x},applyY:function(_){return _*this.k+this.y},invert:function(_){return[(_[0]-this.x)/this.k,(_[1]-this.y)/this.k]},invertX:function(_){return(_-this.x)/this.k},invertY:function(_){return(_-this.y)/this.k},rescaleX:function(_){return _.copy().domain(_.range().map(this.invertX,this).map(_.invert,_))},rescaleY:function(_){return _.copy().domain(_.range().map(this.invertY,this).map(_.invert,_))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var C2=new v0(1,0,0);c5.prototype=v0.prototype;function c5(_){while(!_.__zoom)if(!(_=_.parentNode))return C2;return _.__zoom}function v4(_){_.stopImmediatePropagation()}function S2(_){_.preventDefault(),_.stopImmediatePropagation()}function Wq(_){return(!_.ctrlKey||_.type==="wheel")&&!_.button}function Bq(){var _=this;if(_ instanceof SVGElement){if(_=_.ownerSVGElement||_,_.hasAttribute("viewBox"))return _=_.viewBox.baseVal,[[_.x,_.y],[_.x+_.width,_.y+_.height]];return[[0,0],[_.width.baseVal.value,_.height.baseVal.value]]}return[[0,0],[_.clientWidth,_.clientHeight]]}function w7(){return this.__zoom||C2}function Aq(_){return-_.deltaY*(_.deltaMode===1?0.05:_.deltaMode?1:0.002)*(_.ctrlKey?10:1)}function Mq(){return navigator.maxTouchPoints||"ontouchstart"in this}function Tq(_,Q,J){var q=_.invertX(Q[0][0])-J[0][0],U=_.invertX(Q[1][0])-J[1][0],G=_.invertY(Q[0][1])-J[0][1],Z=_.invertY(Q[1][1])-J[1][1];return _.translate(U>q?(q+U)/2:Math.min(0,q)||Math.max(0,U),Z>G?(G+Z)/2:Math.min(0,G)||Math.max(0,Z))}function l5(){var _=Wq,Q=Bq,J=Tq,q=Aq,U=Mq,G=[0,1/0],Z=[[-1/0,-1/0],[1/0,1/0]],F=250,X=w2,Y=R2("start","zoom","end"),K,H,L,z=500,W=150,I=0,M=10;function B(y){y.property("__zoom",w7).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",w).on("dblclick.zoom",k).filter(U).on("touchstart.zoom",E).on("touchmove.zoom",r).on("touchend.zoom touchcancel.zoom",c).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}B.transform=function(y,b,v,x){var V=y.selection?y.selection():y;if(V.property("__zoom",w7),y!==V)O(y,b,v,x);else V.interrupt().each(function(){C(this,arguments).event(x).start().zoom(null,typeof b==="function"?b.apply(this,arguments):b).end()})},B.scaleBy=function(y,b,v,x){B.scaleTo(y,function(){var V=this.__zoom.k,D=typeof b==="function"?b.apply(this,arguments):b;return V*D},v,x)},B.scaleTo=function(y,b,v,x){B.transform(y,function(){var V=Q.apply(this,arguments),D=this.__zoom,P=v==null?R(V):typeof v==="function"?v.apply(this,arguments):v,u=D.invert(P),m=typeof b==="function"?b.apply(this,arguments):b;return J(A(N(D,m),P,u),V,Z)},v,x)},B.translateBy=function(y,b,v,x){B.transform(y,function(){return J(this.__zoom.translate(typeof b==="function"?b.apply(this,arguments):b,typeof v==="function"?v.apply(this,arguments):v),Q.apply(this,arguments),Z)},null,x)},B.translateTo=function(y,b,v,x,V){B.transform(y,function(){var D=Q.apply(this,arguments),P=this.__zoom,u=x==null?R(D):typeof x==="function"?x.apply(this,arguments):x;return J(C2.translate(u[0],u[1]).scale(P.k).translate(typeof b==="function"?-b.apply(this,arguments):-b,typeof v==="function"?-v.apply(this,arguments):-v),D,Z)},x,V)};function N(y,b){return b=Math.max(G[0],Math.min(G[1],b)),b===y.k?y:new v0(b,y.x,y.y)}function A(y,b,v){var x=b[0]-v[0]*y.k,V=b[1]-v[1]*y.k;return x===y.x&&V===y.y?y:new v0(y.k,x,V)}function R(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function O(y,b,v,x){y.on("start.zoom",function(){C(this,arguments).event(x).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(x).end()}).tween("zoom",function(){var V=this,D=arguments,P=C(V,D).event(x),u=Q.apply(V,D),m=v==null?R(u):typeof v==="function"?v.apply(V,D):v,h=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),t=V.__zoom,Q1=typeof b==="function"?b.apply(V,D):b,s=X(t.invert(m).concat(h/t.k),Q1.invert(m).concat(h/Q1.k));return function(o){if(o===1)o=Q1;else{var l=s(o),e=h/l[2];o=new v0(e,m[0]-l[0]*e,m[1]-l[1]*e)}P.zoom(null,o)}})}function C(y,b,v){return!v&&y.__zooming||new f(y,b)}function f(y,b){this.that=y,this.args=b,this.active=0,this.sourceEvent=null,this.extent=Q.apply(y,b),this.taps=0}f.prototype={event:function(y){if(y)this.sourceEvent=y;return this},start:function(){if(++this.active===1)this.that.__zooming=this,this.emit("start");return this},zoom:function(y,b){if(this.mouse&&y!=="mouse")this.mouse[1]=b.invert(this.mouse[0]);if(this.touch0&&y!=="touch")this.touch0[1]=b.invert(this.touch0[0]);if(this.touch1&&y!=="touch")this.touch1[1]=b.invert(this.touch1[0]);return this.that.__zoom=b,this.emit("zoom"),this},end:function(){if(--this.active===0)delete this.that.__zooming,this.emit("end");return this},emit:function(y){var b=n1(this.that).datum();Y.call(y,this.that,new x6(y,{sourceEvent:this.sourceEvent,target:B,type:y,transform:this.that.__zoom,dispatch:Y}),b)}};function S(y,...b){if(!_.apply(this,arguments))return;var v=C(this,b).event(y),x=this.__zoom,V=Math.max(G[0],Math.min(G[1],x.k*Math.pow(2,q.apply(this,arguments)))),D=U0(y);if(v.wheel){if(v.mouse[0][0]!==D[0]||v.mouse[0][1]!==D[1])v.mouse[1]=x.invert(v.mouse[0]=D);clearTimeout(v.wheel)}else if(x.k===V)return;else v.mouse=[D,x.invert(D)],K2(this),v.start();S2(y),v.wheel=setTimeout(P,W),v.zoom("mouse",J(A(N(x,V),v.mouse[0],v.mouse[1]),v.extent,Z));function P(){v.wheel=null,v.end()}}function w(y,...b){if(L||!_.apply(this,arguments))return;var v=y.currentTarget,x=C(this,b,!0).event(y),V=n1(y.view).on("mousemove.zoom",m,!0).on("mouseup.zoom",h,!0),D=U0(y,v),P=y.clientX,u=y.clientY;a2(y.view),v4(y),x.mouse=[D,this.__zoom.invert(D)],K2(this),x.start();function m(t){if(S2(t),!x.moved){var Q1=t.clientX-P,s=t.clientY-u;x.moved=Q1*Q1+s*s>I}x.event(t).zoom("mouse",J(A(x.that.__zoom,x.mouse[0]=U0(t,v),x.mouse[1]),x.extent,Z))}function h(t){V.on("mousemove.zoom mouseup.zoom",null),P5(t.view,x.moved),S2(t),x.event(t).end()}}function k(y,...b){if(!_.apply(this,arguments))return;var v=this.__zoom,x=U0(y.changedTouches?y.changedTouches[0]:y,this),V=v.invert(x),D=v.k*(y.shiftKey?0.5:2),P=J(A(N(v,D),x,V),Q.apply(this,b),Z);if(S2(y),F>0)n1(this).transition().duration(F).call(O,P,x,y);else n1(this).call(B.transform,P,x,y)}function E(y,...b){if(!_.apply(this,arguments))return;var v=y.touches,x=v.length,V=C(this,b,y.changedTouches.length===x).event(y),D,P,u,m;v4(y);for(P=0;P<x;++P)if(u=v[P],m=U0(u,this),m=[m,this.__zoom.invert(m),u.identifier],!V.touch0)V.touch0=m,D=!0,V.taps=1+!!K;else if(!V.touch1&&V.touch0[2]!==m[2])V.touch1=m,V.taps=0;if(K)K=clearTimeout(K);if(D){if(V.taps<2)H=m[0],K=setTimeout(function(){K=null},z);K2(this),V.start()}}function r(y,...b){if(!this.__zooming)return;var v=C(this,b).event(y),x=y.changedTouches,V=x.length,D,P,u,m;S2(y);for(D=0;D<V;++D)if(P=x[D],u=U0(P,this),v.touch0&&v.touch0[2]===P.identifier)v.touch0[0]=u;else if(v.touch1&&v.touch1[2]===P.identifier)v.touch1[0]=u;if(P=v.that.__zoom,v.touch1){var h=v.touch0[0],t=v.touch0[1],Q1=v.touch1[0],s=v.touch1[1],o=(o=Q1[0]-h[0])*o+(o=Q1[1]-h[1])*o,l=(l=s[0]-t[0])*l+(l=s[1]-t[1])*l;P=N(P,Math.sqrt(o/l)),u=[(h[0]+Q1[0])/2,(h[1]+Q1[1])/2],m=[(t[0]+s[0])/2,(t[1]+s[1])/2]}else if(v.touch0)u=v.touch0[0],m=v.touch0[1];else return;v.zoom("touch",J(A(P,u,m),v.extent,Z))}function c(y,...b){if(!this.__zooming)return;var v=C(this,b).event(y),x=y.changedTouches,V=x.length,D,P;if(v4(y),L)clearTimeout(L);L=setTimeout(function(){L=null},z);for(D=0;D<V;++D)if(P=x[D],v.touch0&&v.touch0[2]===P.identifier)delete v.touch0;else if(v.touch1&&v.touch1[2]===P.identifier)delete v.touch1;if(v.touch1&&!v.touch0)v.touch0=v.touch1,delete v.touch1;if(v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2){if(P=U0(P,this),Math.hypot(H[0]-P[0],H[1]-P[1])<M){var u=n1(this).on("dblclick.zoom");if(u)u.apply(this,arguments)}}}return B.wheelDelta=function(y){return arguments.length?(q=typeof y==="function"?y:p5(+y),B):q},B.filter=function(y){return arguments.length?(_=typeof y==="function"?y:p5(!!y),B):_},B.touchable=function(y){return arguments.length?(U=typeof y==="function"?y:p5(!!y),B):U},B.extent=function(y){return arguments.length?(Q=typeof y==="function"?y:p5([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),B):Q},B.scaleExtent=function(y){return arguments.length?(G[0]=+y[0],G[1]=+y[1],B):[G[0],G[1]]},B.translateExtent=function(y){return arguments.length?(Z[0][0]=+y[0][0],Z[1][0]=+y[1][0],Z[0][1]=+y[0][1],Z[1][1]=+y[1][1],B):[[Z[0][0],Z[0][1]],[Z[1][0],Z[1][1]]]},B.constrain=function(y){return arguments.length?(J=y,B):J},B.duration=function(y){return arguments.length?(F=+y,B):F},B.interpolate=function(y){return arguments.length?(X=y,B):X},B.on=function(){var y=Y.on.apply(Y,arguments);return y===Y?B:y},B.clickDistance=function(y){return arguments.length?(I=(y=+y)*y,B):Math.sqrt(I)},B.tapDistance=function(y){return arguments.length?(M=+y,B):M},B}var X0={error001:(_="react")=>`Seems like you have not used ${_==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${_}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:(_)=>`Node type "${_}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:(_)=>`The old edge with id=${_} does not exist.`,error009:(_)=>`Marker type "${_}" doesn't exist.`,error008:(_,{id:Q,sourceHandle:J,targetHandle:q})=>`Couldn't create edge for ${_} handle id: "${_==="source"?J:q}", edge id: ${Q}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:(_)=>`Edge type "${_}" not found. Using fallback type "default".`,error012:(_)=>`Node with id "${_}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(_="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${_}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:(_)=>`Edge with id "${_}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},$5=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],l6=["Enter"," ","Escape"],r6={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:_,x:Q,y:J})=>`Moved selected node ${_}. New position, x: ${Q}, y: ${J}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},W2;(function(_){_.Strict="strict",_.Loose="loose"})(W2||(W2={}));var o0;(function(_){_.Free="free",_.Vertical="vertical",_.Horizontal="horizontal"})(o0||(o0={}));var y2;(function(_){_.Partial="partial",_.Full="full"})(y2||(y2={}));var i6={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},m0;(function(_){_.Bezier="default",_.Straight="straight",_.Step="step",_.SmoothStep="smoothstep",_.SimpleBezier="simplebezier"})(m0||(m0={}));var Q5;(function(_){_.Arrow="arrow",_.ArrowClosed="arrowclosed"})(Q5||(Q5={}));var K1;(function(_){_.Left="left",_.Top="top",_.Right="right",_.Bottom="bottom"})(K1||(K1={}));var f7={[K1.Left]:K1.Right,[K1.Right]:K1.Left,[K1.Top]:K1.Bottom,[K1.Bottom]:K1.Top},d6=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("source"in _)&&("target"in _),m7=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("position"in _)&&!("source"in _)&&!("target"in _),a6=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("internals"in _)&&!("source"in _)&&!("target"in _);var i5=(_,Q=[0,0])=>{let{width:J,height:q}=w0(_),U=_.origin??Q,G=J*U[0],Z=q*U[1];return{x:_.position.x-G,y:_.position.y-Z}},s6=(_,Q={nodeOrigin:[0,0]})=>{if(!Q.nodeLookup)console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows.");if(_.length===0)return{x:0,y:0,width:0,height:0};let J=!1,q=_.reduce((U,G)=>{let Z=typeof G==="string",F=!Q.nodeLookup&&!Z?G:void 0;if(Q.nodeLookup)F=Z?Q.nodeLookup.get(G):!a6(G)?Q.nodeLookup.get(G.id):G;if(!F)return U;return J=!0,E4(U,h4(F,Q.nodeOrigin))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return J?x4(q):{x:0,y:0,width:0,height:0}},V2=(_,Q={})=>{let J={x:1/0,y:1/0,x2:-1/0,y2:-1/0},q=!1;return _.forEach((U)=>{if(Q.filter===void 0||Q.filter(U))J=E4(J,h4(U)),q=!0}),q?x4(J):{x:0,y:0,width:0,height:0}},D4=(_,Q,[J,q,U]=[0,0,1],G=!1,Z=!1)=>{let F=(Q.x-J)/U,X=(Q.y-q)/U,Y=Q.width/U,K=Q.height/U,H=[];for(let L of _.values()){let{measured:z,selectable:W=!0,hidden:I=!1}=L;if(Z&&!W||I)continue;let M=z.width??L.width??L.initialWidth??0,B=z.height??L.height??L.initialHeight??0,{x:N,y:A}=L.internals.positionAbsolute,R=r7(F,X,Y,K,N,A,M,B),O=M*B,C=G&&R>0;if(!L.internals.handleBounds||C||R>=O||L.dragging)H.push(L)}return H},g7=(_,Q)=>{let J=new Set;return _.forEach((q)=>{J.add(q.id)}),Q.filter((q)=>J.has(q.source)||J.has(q.target))};function Rq(_,Q){let J=new Map,q=Q?.nodes?new Set(Q.nodes.map((U)=>U.id)):null;return _.forEach((U)=>{let G;if(Q?.includeHiddenNodes){let{width:Z,height:F}=w0(U);G=Z>0&&F>0}else G=Boolean(U.measured.width&&U.measured.height&&!U.hidden);if(G&&(!q||q.has(U.id)))J.set(U.id,U)}),J}async function p7({nodes:_,width:Q,height:J,panZoom:q,minZoom:U,maxZoom:G},Z){if(_.size===0)return!0;let F=Rq(_,Z),X=V2(F),Y=a5(X,Q,J,Z?.minZoom??U,Z?.maxZoom??G,Z?.padding??0.1);return await q.setViewport(Y,{duration:Z?.duration,ease:Z?.ease,interpolate:Z?.interpolate}),!0}function t6({nodeId:_,nextPosition:Q,nodeLookup:J,nodeOrigin:q=[0,0],nodeExtent:U,onError:G}){let Z=J.get(_),F=Z.parentId?J.get(Z.parentId):void 0,{x:X,y:Y}=F?F.internals.positionAbsolute:{x:0,y:0},K=Z.origin??q,H=Z.extent||U;if(Z.extent==="parent"&&!Z.expandParent)if(!F)G?.("005",X0.error005());else{let{width:z,height:W}=w0(F);if(z&&W)H=[[X,Y],[X+z,Y+W]]}else if(F&&v2(Z.extent))H=[[Z.extent[0][0]+X,Z.extent[0][1]+Y],[Z.extent[1][0]+X,Z.extent[1][1]+Y]];let L=v2(H)?k2(Q,H,Z.measured):Q;if(Z.measured.width===void 0||Z.measured.height===void 0)G?.("015",X0.error015());return{position:{x:L.x-X+(Z.measured.width??0)*K[0],y:L.y-Y+(Z.measured.height??0)*K[1]},positionAbsolute:L}}async function c7({nodesToRemove:_=[],edgesToRemove:Q=[],nodes:J,edges:q,onBeforeDelete:U}){let G=new Set(_.map((L)=>L.id)),Z=[];for(let L of J){if(L.deletable===!1)continue;let z=G.has(L.id),W=!z&&L.parentId&&Z.find((I)=>I.id===L.parentId);if(z||W)Z.push(L)}let F=new Set(Q.map((L)=>L.id)),X=q.filter((L)=>L.deletable!==!1),K=g7(Z,X);for(let L of X)if(F.has(L.id)&&!K.find((W)=>W.id===L.id))K.push(L);if(!U)return{edges:K,nodes:Z};let H=await U({nodes:Z,edges:K});if(typeof H==="boolean")return H?{edges:K,nodes:Z}:{edges:[],nodes:[]};return H}var J5=(_,Q=0,J=1)=>Math.min(Math.max(_,Q),J),k2=(_={x:0,y:0},Q,J)=>({x:J5(_.x,Q[0][0],Q[1][0]-(J?.width??0)),y:J5(_.y,Q[0][1],Q[1][1]-(J?.height??0))});function l7(_,Q,J){let{width:q,height:U}=w0(J),{x:G,y:Z}=J.internals.positionAbsolute;return k2(_,[[G,Z],[G+q,Z+U]],Q)}var C7=(_,Q,J)=>{if(_<Q)return J5(Math.abs(_-Q),1,Q)/Q;else if(_>J)return-J5(Math.abs(_-J),1,Q)/Q;return 0},b4=(_,Q,J=15,q=40)=>{let U=C7(_.x,q,Q.width-q)*J,G=C7(_.y,q,Q.height-q)*J;return[U,G]},E4=(_,Q)=>({x:Math.min(_.x,Q.x),y:Math.min(_.y,Q.y),x2:Math.max(_.x2,Q.x2),y2:Math.max(_.y2,Q.y2)}),c6=({x:_,y:Q,width:J,height:q})=>({x:_,y:Q,x2:_+J,y2:Q+q}),x4=({x:_,y:Q,x2:J,y2:q})=>({x:_,y:Q,width:J-_,height:q-Q}),q5=(_,Q=[0,0])=>{let{x:J,y:q}=a6(_)?_.internals.positionAbsolute:i5(_,Q);return{x:J,y:q,width:_.measured?.width??_.width??_.initialWidth??0,height:_.measured?.height??_.height??_.initialHeight??0}},h4=(_,Q=[0,0])=>{let{x:J,y:q}=a6(_)?_.internals.positionAbsolute:i5(_,Q);return{x:J,y:q,x2:J+(_.measured?.width??_.width??_.initialWidth??0),y2:q+(_.measured?.height??_.height??_.initialHeight??0)}},o6=(_,Q)=>x4(E4(c6(_),c6(Q))),r7=(_,Q,J,q,U,G,Z,F)=>{let X=Math.max(0,Math.min(_+J,U+Z)-Math.max(_,U)),Y=Math.max(0,Math.min(Q+q,G+F)-Math.max(Q,G));return Math.ceil(X*Y)},d5=(_,Q)=>r7(_.x,_.y,_.width,_.height,Q.x,Q.y,Q.width,Q.height),n6=(_)=>P0(_.width)&&P0(_.height)&&P0(_.x)&&P0(_.y),P0=(_)=>!isNaN(_)&&isFinite(_),e6=(_,Q)=>(J,q)=>{console.warn(`[${_}]: ${q} Help: ${Q}error#${J}`)},U5=(_,Q=[1,1])=>{return{x:Q[0]*Math.round(_.x/Q[0]),y:Q[1]*Math.round(_.y/Q[1])}},G5=({x:_,y:Q},[J,q,U],G=!1,Z=[1,1])=>{let F={x:(_-J)/U,y:(Q-q)/U};return G?U5(F,Z):F},j2=({x:_,y:Q},[J,q,U])=>{return{x:_*U+J,y:Q*U+q}};function _5(_,Q){if(typeof _==="number")return Math.floor((Q-Q/(1+_))*0.5);if(typeof _==="string"&&_.endsWith("px")){let J=parseFloat(_);if(!Number.isNaN(J))return Math.floor(J)}if(typeof _==="string"&&_.endsWith("%")){let J=parseFloat(_);if(!Number.isNaN(J))return Math.floor(Q*J*0.01)}return console.error(`The padding value "${_}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Oq(_,Q,J){if(typeof _==="string"||typeof _==="number"){let q=_5(_,J),U=_5(_,Q);return{top:q,right:U,bottom:q,left:U,x:U*2,y:q*2}}if(typeof _==="object"){let q=_5(_.top??_.y??0,J),U=_5(_.bottom??_.y??0,J),G=_5(_.left??_.x??0,Q),Z=_5(_.right??_.x??0,Q);return{top:q,right:Z,bottom:U,left:G,x:G+Z,y:q+U}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Iq(_,Q,J,q,U,G){let{x:Z,y:F}=j2(_,[Q,J,q]),{x:X,y:Y}=j2({x:_.x+_.width,y:_.y+_.height},[Q,J,q]),K=U-X,H=G-Y;return{left:Math.floor(Z),top:Math.floor(F),right:Math.floor(K),bottom:Math.floor(H)}}var a5=(_,Q,J,q,U,G)=>{let Z=Oq(G,Q,J),F=(Q-Z.x)/_.width,X=(J-Z.y)/_.height,Y=Math.min(F,X),K=J5(Y,q,U),H=_.x+_.width/2,L=_.y+_.height/2,z=Q/2-H*K,W=J/2-L*K,I=Iq(_,z,W,K,Q,J),M={left:Math.min(I.left-Z.left,0),top:Math.min(I.top-Z.top,0),right:Math.min(I.right-Z.right,0),bottom:Math.min(I.bottom-Z.bottom,0)};return{x:z-M.left+M.right,y:W-M.top+M.bottom,zoom:K}},Z5=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function v2(_){return _!==void 0&&_!==null&&_!=="parent"}function w0(_){return{width:_.measured?.width??_.width??_.initialWidth??0,height:_.measured?.height??_.height??_.initialHeight??0}}function _8(_){return(_.measured?.width??_.width??_.initialWidth)!==void 0&&(_.measured?.height??_.height??_.initialHeight)!==void 0}function Q8(_,Q={width:0,height:0},J,q,U){let G={..._},Z=q.get(J);if(Z){let F=Z.origin||U;G.x+=Z.internals.positionAbsolute.x-(Q.width??0)*F[0],G.y+=Z.internals.positionAbsolute.y-(Q.height??0)*F[1]}return G}function J8(_,Q){if(_.size!==Q.size)return!1;for(let J of _)if(!Q.has(J))return!1;return!0}function i7(){let _,Q;return{promise:new Promise((q,U)=>{_=q,Q=U}),resolve:_,reject:Q}}function d7(_){return{...r6,..._||{}}}function Pq(_){if(typeof document>"u")return!0;let Q=document.querySelector(`.${_}-flow__pane`);if(!Q||!Q.isConnected)return!0;let J=getComputedStyle(Q);if(J.display==="none")return!0;if(J.visibility==="hidden"||J.visibility==="collapse")return!0;if(J.opacity==="0")return!0;if(J.width==="0"&&J.height==="0")return!0;let q=Q.getBoundingClientRect();if(q.width===0&&q.height===0)return!0;let U=document.querySelector(`.${_}-flow__attribution`);if(!U||!U.isConnected)return!1;let G=getComputedStyle(U);if(G.display==="none")return!1;if(G.visibility==="hidden"||G.visibility==="collapse")return!1;if(G.opacity==="0")return!1;let Z=U.getBoundingClientRect();if(Z.width===0&&Z.height===0)return!1;return!0}var S7=!1;function a7(_){if(S7)return;S7=!0;let Q=`${_.charAt(0).toUpperCase()+_.slice(1)} Flow`;setTimeout(()=>{if(!Pq(_))console.warn(`${Q}: It seems like you are hiding the attribution. Please only do this when you are subscribed to ${Q} Pro: https://${_}flow.dev/remove-attr
|
|
28
|
+
%cYou can ignore this warning if you are subscribed.`,"font-style: italic;")},1000)}function $8(_){return _===null?null:_?"valid":"invalid"}function r5(_,{snapGrid:Q=[0,0],snapToGrid:J=!1,transform:q,containerBounds:U}){let{x:G,y:Z}=N0(_),F=G5({x:G-(U?.left??0),y:Z-(U?.top??0)},q),{x:X,y:Y}=J?U5(F,Q):F;return{xSnapped:X,ySnapped:Y,...F}}var m4=(_)=>({width:_.offsetWidth,height:_.offsetHeight}),q8=(_)=>_?.getRootNode?.()||window?.document,Nq=["INPUT","SELECT","TEXTAREA"];function U8(_){let Q=_.composedPath?.()?.[0]||_.target;if(Q?.nodeType!==1)return!1;return Nq.includes(Q.nodeName)||Q.hasAttribute("contenteditable")||!!Q.closest(".nokey")}var G8=(_)=>("clientX"in _),N0=(_,Q)=>{let J=G8(_),q=J?_.clientX:_.touches?.[0].clientX,U=J?_.clientY:_.touches?.[0].clientY;return{x:q-(Q?.left??0),y:U-(Q?.top??0)}},y7=(_,Q,J,q,U)=>{let G=Q.querySelectorAll(`.${_}`);if(!G||!G.length)return null;return Array.from(G).map((Z)=>{let F=Z.getBoundingClientRect();return{id:Z.getAttribute("data-handleid"),type:_,nodeId:U,position:Z.getAttribute("data-handlepos"),x:(F.left-J.left)/q,y:(F.top-J.top)/q,...m4(Z)}})};function g4({sourceX:_,sourceY:Q,targetX:J,targetY:q,sourceControlX:U,sourceControlY:G,targetControlX:Z,targetControlY:F}){let X=_*0.125+U*0.375+Z*0.375+J*0.125,Y=Q*0.125+G*0.375+F*0.375+q*0.125,K=Math.abs(X-_),H=Math.abs(Y-Q);return[X,Y,K,H]}function V4(_,Q){if(_>=0)return 0.5*_;return Q*25*Math.sqrt(-_)}function k7({pos:_,x1:Q,y1:J,x2:q,y2:U,c:G}){switch(_){case K1.Left:return[Q-V4(Q-q,G),J];case K1.Right:return[Q+V4(q-Q,G),J];case K1.Top:return[Q,J-V4(J-U,G)];case K1.Bottom:return[Q,J+V4(U-J,G)]}}function p4({sourceX:_,sourceY:Q,sourcePosition:J=K1.Bottom,targetX:q,targetY:U,targetPosition:G=K1.Top,curvature:Z=0.25}){let[F,X]=k7({pos:J,x1:_,y1:Q,x2:q,y2:U,c:Z}),[Y,K]=k7({pos:G,x1:q,y1:U,x2:_,y2:Q,c:Z}),[H,L,z,W]=g4({sourceX:_,sourceY:Q,targetX:q,targetY:U,sourceControlX:F,sourceControlY:X,targetControlX:Y,targetControlY:K});return[`M${_},${Q} C${F},${X} ${Y},${K} ${q},${U}`,H,L,z,W]}function Z8({sourceX:_,sourceY:Q,targetX:J,targetY:q}){let U=Math.abs(J-_)/2,G=J<_?J+U:J-U,Z=Math.abs(q-Q)/2,F=q<Q?q+Z:q-Z;return[G,F,U,Z]}function s7({sourceNode:_,targetNode:Q,selected:J=!1,zIndex:q=0,elevateOnSelect:U=!1,zIndexMode:G="basic"}){if(G==="manual")return q;let Z=U&&J?q+1000:q,F=Math.max(_.parentId||U&&_.selected?_.internals.z:0,Q.parentId||U&&Q.selected?Q.internals.z:0);return Z+F}function t7({sourceNode:_,targetNode:Q,width:J,height:q,transform:U}){let G=E4(h4(_),h4(Q));if(G.x===G.x2)G.x2+=1;if(G.y===G.y2)G.y2+=1;let Z={x:-U[0]/U[2],y:-U[1]/U[2],width:J/U[2],height:q/U[2]};return d5(Z,x4(G))>0}var wq=({source:_,sourceHandle:Q,target:J,targetHandle:q})=>`xy-edge__${_}${Q||""}-${J}${q||""}`,fq=(_,Q)=>{return Q.some((J)=>J.source===_.source&&J.target===_.target&&(J.sourceHandle===_.sourceHandle||!J.sourceHandle&&!_.sourceHandle)&&(J.targetHandle===_.targetHandle||!J.targetHandle&&!_.targetHandle))},o7=(_,Q,J={})=>{if(!_.source||!_.target)return J.onError?.("006",X0.error006()),Q;let q=J.getEdgeId||wq,U;if(d6(_))U={..._};else U={..._,id:q(_)};if(fq(U,Q))return Q;if(U.sourceHandle===null)delete U.sourceHandle;if(U.targetHandle===null)delete U.targetHandle;return Q.concat(U)};function c4({sourceX:_,sourceY:Q,targetX:J,targetY:q}){let[U,G,Z,F]=Z8({sourceX:_,sourceY:Q,targetX:J,targetY:q});return[`M ${_},${Q}L ${J},${q}`,U,G,Z,F]}var j7={[K1.Left]:{x:-1,y:0},[K1.Right]:{x:1,y:0},[K1.Top]:{x:0,y:-1},[K1.Bottom]:{x:0,y:1}},Cq=({source:_,sourcePosition:Q=K1.Bottom,target:J})=>{if(Q===K1.Left||Q===K1.Right)return _.x<J.x?{x:1,y:0}:{x:-1,y:0};return _.y<J.y?{x:0,y:1}:{x:0,y:-1}},v7=(_,Q)=>Math.sqrt(Math.pow(Q.x-_.x,2)+Math.pow(Q.y-_.y,2));function Sq({source:_,sourcePosition:Q=K1.Bottom,target:J,targetPosition:q=K1.Top,center:U,offset:G,stepPosition:Z}){let F=j7[Q],X=j7[q],Y={x:_.x+F.x*G,y:_.y+F.y*G},K={x:J.x+X.x*G,y:J.y+X.y*G},H=Cq({source:Y,sourcePosition:Q,target:K}),L=H.x!==0?"x":"y",z=H[L],W=[],I,M,B={x:0,y:0},N={x:0,y:0},[,,A,R]=Z8({sourceX:_.x,sourceY:_.y,targetX:J.x,targetY:J.y});if(F[L]*X[L]===-1){if(L==="x")I=U.x??Y.x+(K.x-Y.x)*Z,M=U.y??(Y.y+K.y)/2;else I=U.x??(Y.x+K.x)/2,M=U.y??Y.y+(K.y-Y.y)*Z;let S=[{x:I,y:Y.y},{x:I,y:K.y}],w=[{x:Y.x,y:M},{x:K.x,y:M}];if(F[L]===z)W=L==="x"?S:w;else W=L==="x"?w:S}else{let S=[{x:Y.x,y:K.y}],w=[{x:K.x,y:Y.y}];if(L==="x")W=F.x===z?w:S;else W=F.y===z?S:w;if(Q===q){let y=Math.abs(_[L]-J[L]);if(y<=G){let b=Math.min(G-1,G-y);if(F[L]===z)B[L]=(Y[L]>_[L]?-1:1)*b;else N[L]=(K[L]>J[L]?-1:1)*b}}if(Q!==q){let y=L==="x"?"y":"x",b=F[L]===X[y],v=Y[y]>K[y],x=Y[y]<K[y];if(F[L]===1&&(!b&&v||b&&x)||F[L]!==1&&(!b&&x||b&&v))W=L==="x"?S:w}let k={x:Y.x+B.x,y:Y.y+B.y},E={x:K.x+N.x,y:K.y+N.y},r=Math.max(Math.abs(k.x-W[0].x),Math.abs(E.x-W[0].x)),c=Math.max(Math.abs(k.y-W[0].y),Math.abs(E.y-W[0].y));if(r>=c)I=(k.x+E.x)/2,M=W[0].y;else I=W[0].x,M=(k.y+E.y)/2}let O={x:Y.x+B.x,y:Y.y+B.y},C={x:K.x+N.x,y:K.y+N.y};return[[_,...O.x!==W[0].x||O.y!==W[0].y?[O]:[],...W,...C.x!==W[W.length-1].x||C.y!==W[W.length-1].y?[C]:[],J],I,M,A,R]}function yq(_,Q,J,q){let U=Math.min(v7(_,Q)/2,v7(Q,J)/2,q),{x:G,y:Z}=Q;if(_.x===G&&G===J.x||_.y===Z&&Z===J.y)return`L${G} ${Z}`;if(_.y===Z){let Y=_.x<J.x?-1:1,K=_.y<J.y?1:-1;return`L ${G+U*Y},${Z}Q ${G},${Z} ${G},${Z+U*K}`}let F=_.x<J.x?1:-1,X=_.y<J.y?-1:1;return`L ${G},${Z+U*X}Q ${G},${Z} ${G+U*F},${Z}`}function s5({sourceX:_,sourceY:Q,sourcePosition:J=K1.Bottom,targetX:q,targetY:U,targetPosition:G=K1.Top,borderRadius:Z=5,centerX:F,centerY:X,offset:Y=20,stepPosition:K=0.5}){let[H,L,z,W,I]=Sq({source:{x:_,y:Q},sourcePosition:J,target:{x:q,y:U},targetPosition:G,center:{x:F,y:X},offset:Y,stepPosition:K}),M=`M${H[0].x} ${H[0].y}`;for(let B=1;B<H.length-1;B++)M+=yq(H[B-1],H[B],H[B+1],Z);return M+=`L${H[H.length-1].x} ${H[H.length-1].y}`,[M,L,z,W,I]}function V7(_){return _&&!!(_.internals.handleBounds||_.handles?.length)&&!!(_.measured.width||_.width||_.initialWidth)}function n7(_){let{sourceNode:Q,targetNode:J}=_;if(!V7(Q)||!V7(J))return null;let q=Q.internals.handleBounds||u7(Q.handles),U=J.internals.handleBounds||u7(J.handles),G=h7(q?.source??[],_.sourceHandle),Z=h7(_.connectionMode===W2.Strict?U?.target??[]:(U?.target??[]).concat(U?.source??[]),_.targetHandle);if(!G||!Z)return _.onError?.("008",X0.error008(!G?"source":"target",{id:_.id,sourceHandle:_.sourceHandle,targetHandle:_.targetHandle})),null;let F=G?.position||K1.Bottom,X=Z?.position||K1.Top,Y=B2(Q,G,F),K=B2(J,Z,X);return{sourceX:Y.x,sourceY:Y.y,targetX:K.x,targetY:K.y,sourcePosition:F,targetPosition:X}}function u7(_){if(!_)return null;let Q=[],J=[];for(let q of _)if(q.width=q.width??1,q.height=q.height??1,q.type==="source")Q.push(q);else if(q.type==="target")J.push(q);return{source:Q,target:J}}function B2(_,Q,J=K1.Left,q=!1){let U=(Q?.x??0)+_.internals.positionAbsolute.x,G=(Q?.y??0)+_.internals.positionAbsolute.y,{width:Z,height:F}=Q??w0(_);if(q)return{x:U+Z/2,y:G+F/2};switch(Q?.position??J){case K1.Top:return{x:U+Z/2,y:G};case K1.Right:return{x:U+Z,y:G+F/2};case K1.Bottom:return{x:U+Z/2,y:G+F};case K1.Left:return{x:U,y:G+F/2}}}function h7(_,Q){if(!_)return null;return(!Q?_[0]:_.find((J)=>J.id===Q))||null}function l4(_,Q){if(!_)return"";if(typeof _==="string")return _;return`${Q?`${Q}__`:""}${Object.keys(_).sort().map((q)=>`${q}=${_[q]}`).join("&")}`}function e7(_,{id:Q,defaultColor:J,defaultMarkerStart:q,defaultMarkerEnd:U}){let G=new Set;return _.reduce((Z,F)=>{return[F.markerStart||q,F.markerEnd||U].forEach((X)=>{if(X&&typeof X==="object"){let Y=l4(X,Q);if(!G.has(Y))Z.push({id:Y,color:X.color||J,...X}),G.add(Y)}}),Z},[]).sort((Z,F)=>Z.id.localeCompare(F.id))}function _9(_,Q,J,q,U){let G=0.5;if(U==="start")G=0;else if(U==="end")G=1;let Z=[(_.x+_.width*G)*Q.zoom+Q.x,_.y*Q.zoom+Q.y-q],F=[-100*G,-100];switch(J){case K1.Right:Z=[(_.x+_.width)*Q.zoom+Q.x+q,(_.y+_.height*G)*Q.zoom+Q.y],F=[0,-100*G];break;case K1.Bottom:Z[1]=(_.y+_.height)*Q.zoom+Q.y+q,F[1]=0;break;case K1.Left:Z=[_.x*Q.zoom+Q.x-q,(_.y+_.height*G)*Q.zoom+Q.y],F=[-100,-100*G];break}return`translate(${Z[0]}px, ${Z[1]}px) translate(${F[0]}%, ${F[1]}%)`}var Q9=1000,kq=10,F8={nodeOrigin:[0,0],nodeExtent:$5,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},jq={...F8,checkEquality:!0};function H8(_,Q){let J={..._};for(let q in Q)if(Q[q]!==void 0)J[q]=Q[q];return J}function J9(_,Q,J){let q=H8(F8,J);for(let U of _.values())if(U.parentId)K8(U,_,Q,q);else{let G=i5(U,q.nodeOrigin),Z=v2(U.extent)?U.extent:q.nodeExtent,F=k2(G,Z,w0(U));U.internals.positionAbsolute=F}}function vq(_,Q){if(!_.handles)return!_.measured?void 0:Q?.internals.handleBounds;let J=[],q=[];for(let U of _.handles){let G={id:U.id,width:U.width??1,height:U.height??1,nodeId:_.id,x:U.x,y:U.y,position:U.position,type:U.type};if(U.type==="source")J.push(G);else if(U.type==="target")q.push(G)}return{source:J,target:q}}function X8(_){return _==="manual"}function r4(_,Q,J,q={}){let U=H8(jq,q),G={i:0},Z=new Map(Q),F=U?.elevateNodesOnSelect&&!X8(U.zIndexMode)?Q9:0,X=_.length>0,Y=!1;Q.clear(),J.clear();for(let K of _){let H=Z.get(K.id);if(U.checkEquality&&K===H?.internals.userNode)Q.set(K.id,H);else{let L=i5(K,U.nodeOrigin),z=v2(K.extent)?K.extent:U.nodeExtent,W=k2(L,z,w0(K));H={...U.defaults,...K,measured:{width:K.measured?.width,height:K.measured?.height},internals:{positionAbsolute:W,handleBounds:vq(K,H),z:$9(K,F,U.zIndexMode),userNode:K}},Q.set(K.id,H)}if((H.measured===void 0||H.measured.width===void 0||H.measured.height===void 0)&&!H.hidden)X=!1;if(K.parentId)K8(H,Q,J,q,G);Y||=K.selected??!1}return{nodesInitialized:X,hasSelectedNodes:Y}}function Vq(_,Q){if(!_.parentId)return;let J=Q.get(_.parentId);if(J)J.set(_.id,_);else Q.set(_.parentId,new Map([[_.id,_]]))}function K8(_,Q,J,q,U){let{elevateNodesOnSelect:G,nodeOrigin:Z,nodeExtent:F,zIndexMode:X}=H8(F8,q),Y=_.parentId,K=Q.get(Y);if(!K){console.warn(`Parent node ${Y} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}if(Vq(_,J),U&&!K.parentId&&K.internals.rootParentIndex===void 0&&X==="auto")K.internals.rootParentIndex=++U.i,K.internals.z=K.internals.z+U.i*kq;if(U&&K.internals.rootParentIndex!==void 0)U.i=K.internals.rootParentIndex;let H=G&&!X8(X)?Q9:0,{x:L,y:z,z:W}=uq(_,K,Z,F,H,X),{positionAbsolute:I}=_.internals,M=L!==I.x||z!==I.y;if(M||W!==_.internals.z)Q.set(_.id,{..._,internals:{..._.internals,positionAbsolute:M?{x:L,y:z}:I,z:W}})}function $9(_,Q,J){let q=P0(_.zIndex)?_.zIndex:0;if(X8(J))return q;return q+(_.selected?Q:0)}function uq(_,Q,J,q,U,G){let{x:Z,y:F}=Q.internals.positionAbsolute,X=w0(_),Y=i5(_,J),K=v2(_.extent)?k2(Y,_.extent,X):Y,H=k2({x:Z+K.x,y:F+K.y},q,X);if(_.extent==="parent")H=l7(H,X,Q);let L=$9(_,U,G),z=Q.internals.z??0;return{x:H.x,y:H.y,z:z>=L?z+1:L}}function i4(_,Q,J,q=[0,0]){let U=[],G=new Map;for(let Z of _){let F=Q.get(Z.parentId);if(!F)continue;let X=G.get(Z.parentId)?.expandedRect??q5(F),Y=o6(X,Z.rect);G.set(Z.parentId,{expandedRect:Y,parent:F})}if(G.size>0)G.forEach(({expandedRect:Z,parent:F},X)=>{let Y=F.internals.positionAbsolute,K=w0(F),H=F.origin??q,L=Z.x<Y.x?Math.round(Math.abs(Y.x-Z.x)):0,z=Z.y<Y.y?Math.round(Math.abs(Y.y-Z.y)):0,W=Math.max(K.width,Math.round(Z.width)),I=Math.max(K.height,Math.round(Z.height)),M=(W-K.width)*H[0],B=(I-K.height)*H[1];if(L>0||z>0||M||B)U.push({id:X,type:"position",position:{x:F.position.x-L+M,y:F.position.y-z+B}}),J.get(X)?.forEach((N)=>{if(!_.some((A)=>A.id===N.id))U.push({id:N.id,type:"position",position:{x:N.position.x+L,y:N.position.y+z}})});if(K.width<Z.width||K.height<Z.height||L||z)U.push({id:X,type:"dimensions",setAttributes:!0,dimensions:{width:W+(L?H[0]*L-M:0),height:I+(z?H[1]*z-B:0)}})});return U}function q9(_,Q,J,q,U,G,Z){let F=q?.querySelector(".xyflow__viewport"),X=!1;if(!F)return{changes:[],updatedInternals:X};let Y=[],K=window.getComputedStyle(F),{m22:H}=new window.DOMMatrixReadOnly(K.transform),L=[];for(let z of _.values()){let W=Q.get(z.id);if(!W)continue;if(W.hidden){Q.set(W.id,{...W,internals:{...W.internals,handleBounds:void 0}}),X=!0;continue}let I=m4(z.nodeElement),M=W.measured.width!==I.width||W.measured.height!==I.height;if(!!(I.width&&I.height&&(M||!W.internals.handleBounds||z.force))){let N=z.nodeElement.getBoundingClientRect(),A=v2(W.extent)?W.extent:G,{positionAbsolute:R}=W.internals;if(W.parentId&&W.extent==="parent"){let C=Q.get(W.parentId);if(C)R=l7(R,I,C)}else if(A)R=k2(R,A,I);let O={...W,measured:I,internals:{...W.internals,positionAbsolute:R,handleBounds:{source:y7("source",z.nodeElement,N,H,W.id),target:y7("target",z.nodeElement,N,H,W.id)}}};if(Q.set(W.id,O),W.parentId)K8(O,Q,J,{nodeOrigin:U,zIndexMode:Z});if(X=!0,M){if(Y.push({id:W.id,type:"dimensions",dimensions:I}),W.expandParent&&W.parentId)L.push({id:W.id,parentId:W.parentId,rect:q5(O,U)})}}}if(L.length>0){let z=i4(L,Q,J,U);Y.push(...z)}return{changes:Y,updatedInternals:X}}async function U9({delta:_,panZoom:Q,transform:J,translateExtent:q,width:U,height:G}){if(!Q||!_.x&&!_.y)return!1;let Z=await Q.setViewportConstrained({x:J[0]+_.x,y:J[1]+_.y,zoom:J[2]},[[0,0],[U,G]],q);return!!Z&&(Z.x!==J[0]||Z.y!==J[1]||Z.k!==J[2])}function D7(_,Q,J,q,U,G){let Z=U,F=q.get(Z)||new Map;q.set(Z,F.set(J,Q)),Z=`${U}-${_}`;let X=q.get(Z)||new Map;if(q.set(Z,X.set(J,Q)),G){Z=`${U}-${_}-${G}`;let Y=q.get(Z)||new Map;q.set(Z,Y.set(J,Q))}}function Y8(_,Q,J){_.clear(),Q.clear();for(let q of J){let{source:U,target:G,sourceHandle:Z=null,targetHandle:F=null}=q,X={edgeId:q.id,source:U,target:G,sourceHandle:Z,targetHandle:F},Y=`${U}-${Z}--${G}-${F}`,K=`${G}-${F}--${U}-${Z}`;D7("source",X,K,_,U,Z),D7("target",X,Y,_,G,F),Q.set(q.id,q)}}function G9(_,Q){if(!_.parentId)return!1;let J=Q.get(_.parentId);if(!J)return!1;if(J.selected)return!0;return G9(J,Q)}function b7(_,Q,J){let q=_;do{if(q?.matches?.(Q))return!0;if(q===J)return!1;q=q?.parentElement}while(q);return!1}function hq(_,Q,J,q){let U=new Map;for(let[G,Z]of _)if((Z.selected||Z.id===q)&&(!Z.parentId||!G9(Z,_))&&(Z.draggable||Q&&typeof Z.draggable>"u")){let F=_.get(G);if(F)U.set(G,{id:G,position:F.position||{x:0,y:0},distance:{x:J.x-F.internals.positionAbsolute.x,y:J.y-F.internals.positionAbsolute.y},extent:F.extent,parentId:F.parentId,origin:F.origin,expandParent:F.expandParent,internals:{positionAbsolute:F.internals.positionAbsolute||{x:0,y:0}},measured:{width:F.measured.width??0,height:F.measured.height??0}})}return U}function m6({nodeId:_,dragItems:Q,nodeLookup:J,dragging:q=!0}){let U=[];for(let[Z,F]of Q){let X=J.get(Z)?.internals.userNode;if(X)U.push({...X,position:F.position,dragging:q})}if(!_)return[U[0],U];let G=J.get(_)?.internals.userNode;return[!G?U[0]:{...G,position:Q.get(_)?.position||G.position,dragging:q},U]}function Dq({dragItems:_,snapGrid:Q,x:J,y:q}){let U=_.values().next().value;if(!U)return null;let G={x:J-U.distance.x,y:q-U.distance.y},Z=U5(G,Q);return{x:Z.x-G.x,y:Z.y-G.y}}function Z9({onNodeMouseDown:_,getStoreItems:Q,onDragStart:J,onDrag:q,onDragStop:U}){let G={x:null,y:null},Z=0,F=new Map,X=!1,Y={x:0,y:0},K=null,H=!1,L=null,z=!1,W=!1,I=null;function M({noDragClassName:N,handleSelector:A,domNode:R,isSelectable:O,nodeId:C,nodeClickDistance:f=0}){L=n1(R);function S({x:r,y:c}){let{nodeLookup:y,nodeExtent:b,snapGrid:v,snapToGrid:x,nodeOrigin:V,onNodeDrag:D,onSelectionDrag:P,onError:u,updateNodePositions:m}=Q();G={x:r,y:c};let h=!1,t=F.size>1,Q1=t&&b?c6(V2(F)):null,s=t&&x?Dq({dragItems:F,snapGrid:v,x:r,y:c}):null;for(let[o,l]of F){if(!y.has(o))continue;let e={x:r-l.distance.x,y:c-l.distance.y};if(x)e=s?{x:Math.round(e.x+s.x),y:Math.round(e.y+s.y)}:U5(e,v);let J1=null;if(t&&b&&!l.extent&&Q1){let{positionAbsolute:W1}=l.internals,Y1=W1.x-Q1.x+b[0][0],B1=W1.x+l.measured.width-Q1.x2+b[1][0],n=W1.y-Q1.y+b[0][1],T1=W1.y+l.measured.height-Q1.y2+b[1][1];J1=[[Y1,n],[B1,T1]]}let{position:U1,positionAbsolute:F1}=t6({nodeId:o,nextPosition:e,nodeLookup:y,nodeExtent:J1?J1:b,nodeOrigin:V,onError:u});h=h||l.position.x!==U1.x||l.position.y!==U1.y,l.position=U1,l.internals.positionAbsolute=F1}if(W=W||h,!h)return;if(m(F,!0),I&&(q||D||!C&&P)){let[o,l]=m6({nodeId:C,dragItems:F,nodeLookup:y});if(q?.(I,F,o,l),D?.(I,o,l),!C)P?.(I,l)}}async function w(){if(!K)return;let{transform:r,panBy:c,autoPanSpeed:y,autoPanOnNodeDrag:b}=Q();if(!b){X=!1,cancelAnimationFrame(Z);return}let[v,x]=b4(Y,K,y);if(v!==0||x!==0){if(G.x=(G.x??0)-v/r[2],G.y=(G.y??0)-x/r[2],await c({x:v,y:x}))S(G)}Z=requestAnimationFrame(w)}function k(r){let{nodeLookup:c,multiSelectionActive:y,nodesDraggable:b,transform:v,snapGrid:x,snapToGrid:V,selectNodesOnDrag:D,onNodeDragStart:P,onSelectionDragStart:u,unselectNodesAndEdges:m}=Q();if(H=!0,(!D||!O)&&!y&&C){if(!c.get(C)?.selected)m()}if(O&&D&&C)_?.(C);let h=r5(r.sourceEvent,{transform:v,snapGrid:x,snapToGrid:V,containerBounds:K});if(G=h,F=hq(c,b,h,C),F.size>0&&(J||P||!C&&u)){let[t,Q1]=m6({nodeId:C,dragItems:F,nodeLookup:c});if(J?.(r.sourceEvent,F,t,Q1),P?.(r.sourceEvent,t,Q1),!C)u?.(r.sourceEvent,Q1)}}let E=f5().clickDistance(f).on("start",(r)=>{let{domNode:c,nodeDragThreshold:y,transform:b,snapGrid:v,snapToGrid:x}=Q();if(K=c?.getBoundingClientRect()||null,z=!1,W=!1,I=r.sourceEvent,y===0)k(r);G=r5(r.sourceEvent,{transform:b,snapGrid:v,snapToGrid:x,containerBounds:K}),Y=N0(r.sourceEvent,K)}).on("drag",(r)=>{let{autoPanOnNodeDrag:c,transform:y,snapGrid:b,snapToGrid:v,nodeDragThreshold:x,nodeLookup:V}=Q(),D=r5(r.sourceEvent,{transform:y,snapGrid:b,snapToGrid:v,containerBounds:K});if(I=r.sourceEvent,r.sourceEvent.type==="touchmove"&&r.sourceEvent.touches.length>1||C&&!V.has(C))z=!0;if(z)return;if(!X&&c&&H)X=!0,w();if(!H){let P=N0(r.sourceEvent,K),u=P.x-Y.x,m=P.y-Y.y;if(Math.sqrt(u*u+m*m)>x)k(r)}if((G.x!==D.xSnapped||G.y!==D.ySnapped)&&F&&H)Y=N0(r.sourceEvent,K),S(D)}).on("end",(r)=>{if(!H||z){if(z&&F.size>0)Q().updateNodePositions(F,!1);return}if(X=!1,H=!1,cancelAnimationFrame(Z),F.size>0){let{nodeLookup:c,updateNodePositions:y,onNodeDragStop:b,onSelectionDragStop:v}=Q();if(W)y(F,!1),W=!1;if(U||b||!C&&v){let[x,V]=m6({nodeId:C,dragItems:F,nodeLookup:c,dragging:!1});if(U?.(r.sourceEvent,F,x,V),b?.(r.sourceEvent,x,V),!C)v?.(r.sourceEvent,V)}}}).filter((r)=>{let c=r.target;return!r.button&&(!N||!b7(c,`.${N}`,R))&&(!A||b7(c,A,R))});L.call(E)}function B(){L?.on(".drag",null)}return{update:M,destroy:B}}function bq(_,Q,J){let q=[],U={x:_.x-J,y:_.y-J,width:J*2,height:J*2};for(let G of Q.values())if(d5(U,q5(G))>0)q.push(G);return q}var Eq=250;function xq(_,Q,J,q){let U=[],G=1/0,Z=bq(_,J,Q+Eq);for(let F of Z){let X=[...F.internals.handleBounds?.source??[],...F.internals.handleBounds?.target??[]];for(let Y of X){if(q.nodeId===Y.nodeId&&q.type===Y.type&&q.id===Y.id)continue;let{x:K,y:H}=B2(F,Y,Y.position,!0),L=Math.sqrt(Math.pow(K-_.x,2)+Math.pow(H-_.y,2));if(L>Q)continue;if(L<G)U=[{...Y,x:K,y:H}],G=L;else if(L===G)U.push({...Y,x:K,y:H})}}if(!U.length)return null;if(U.length>1){let F=q.type==="source"?"target":"source";return U.find((X)=>X.type===F)??U[0]}return U[0]}function F9(_,Q,J,q,U,G=!1){let Z=q.get(_);if(!Z)return null;let F=U==="strict"?Z.internals.handleBounds?.[Q]:[...Z.internals.handleBounds?.source??[],...Z.internals.handleBounds?.target??[]],X=(J?F?.find((Y)=>Y.id===J):F?.[0])??null;return X&&G?{...X,...B2(Z,X,X.position,!0)}:X}function H9(_,Q){if(_)return _;else if(Q?.classList.contains("target"))return"target";else if(Q?.classList.contains("source"))return"source";return null}function mq(_,Q){let J=null;if(Q)J=!0;else if(_&&!Q)J=!1;return J}var X9=()=>!0;function gq(_,{connectionMode:Q,connectionRadius:J,handleId:q,nodeId:U,edgeUpdaterType:G,isTarget:Z,domNode:F,nodeLookup:X,lib:Y,autoPanOnConnect:K,flowId:H,panBy:L,cancelConnection:z,onConnectStart:W,onConnect:I,onConnectEnd:M,isValidConnection:B=X9,onReconnectEnd:N,updateConnection:A,getTransform:R,getFromHandle:O,autoPanSpeed:C,dragThreshold:f=1,handleDomNode:S}){let w=q8(_.target),k=0,E,{x:r,y:c}=N0(_),y=H9(G,S),b=F?.getBoundingClientRect(),v=!1;if(!b||!y)return;let x=F9(U,y,q,X,Q);if(!x)return;let V=N0(_,b),D=!1,P=null,u=!1,m=null;function h(){if(!K||!b)return;let[U1,F1]=b4(V,b,C);L({x:U1,y:F1}),k=requestAnimationFrame(h)}let t={...x,nodeId:U,type:y,position:x.position},Q1=X.get(U),o={inProgress:!0,isValid:null,from:B2(Q1,t,K1.Left,!0),fromHandle:t,fromPosition:t.position,fromNode:Q1,to:V,toHandle:null,toPosition:f7[t.position],toNode:null,pointer:V};function l(){v=!0,A(o),W?.(_,{nodeId:U,handleId:q,handleType:y})}if(f===0)l();function e(U1){if(!v){let{x:T1,y:Z1}=N0(U1),k1=T1-r,t1=Z1-c;if(!(k1*k1+t1*t1>f*f))return;l()}if(!O()||!t){J1(U1);return}let F1=R();if(V=N0(U1,b),E=xq(G5(V,F1,!1,[1,1]),J,X,t),!D)h(),D=!0;let W1=K9(U1,{handle:E,connectionMode:Q,fromNodeId:U,fromHandleId:q,fromType:Z?"target":"source",isValidConnection:B,doc:w,lib:Y,flowId:H,nodeLookup:X});m=W1.handleDomNode,P=W1.connection,u=mq(!!E,W1.isValid);let Y1=X.get(U),B1=Y1?B2(Y1,t,K1.Left,!0):o.from,n={...o,from:B1,isValid:u,to:W1.toHandle&&u?j2({x:W1.toHandle.x,y:W1.toHandle.y},F1):V,toHandle:W1.toHandle,toPosition:u&&W1.toHandle?W1.toHandle.position:f7[t.position],toNode:W1.toHandle?X.get(W1.toHandle.nodeId):null,pointer:V};A(n),o=n}function J1(U1){if("touches"in U1&&U1.touches.length>0)return;if(v){if((E||m)&&P&&u)I?.(P);let{inProgress:F1,...W1}=o,Y1={...W1,toPosition:o.toHandle?o.toPosition:null};if(M?.(U1,Y1),G)N?.(U1,Y1)}z(),cancelAnimationFrame(k),D=!1,u=!1,P=null,m=null,w.removeEventListener("mousemove",e),w.removeEventListener("mouseup",J1),w.removeEventListener("touchmove",e),w.removeEventListener("touchend",J1)}w.addEventListener("mousemove",e),w.addEventListener("mouseup",J1),w.addEventListener("touchmove",e),w.addEventListener("touchend",J1)}function K9(_,{handle:Q,connectionMode:J,fromNodeId:q,fromHandleId:U,fromType:G,doc:Z,lib:F,flowId:X,isValidConnection:Y=X9,nodeLookup:K}){let H=G==="target",L=Q?Z.querySelector(`.${F}-flow__handle[data-id="${X}-${Q?.nodeId}-${Q?.id}-${Q?.type}"]`):null,{x:z,y:W}=N0(_),I=Z.elementFromPoint(z,W),M=I?.classList.contains(`${F}-flow__handle`)?I:L,B={handleDomNode:M,isValid:!1,connection:null,toHandle:null};if(M){let N=H9(void 0,M),A=M.getAttribute("data-nodeid"),R=M.getAttribute("data-handleid"),O=M.classList.contains("connectable"),C=M.classList.contains("connectableend");if(!A||!N)return B;let f={source:H?A:q,sourceHandle:H?R:U,target:H?q:A,targetHandle:H?U:R};B.connection=f;let w=O&&C&&(J===W2.Strict?H&&N==="source"||!H&&N==="target":A!==q||R!==U);B.isValid=w&&Y(f),B.toHandle=F9(A,N,R,K,J,!0)}return B}var d4={onPointerDown:gq,isValid:K9};function Y9({domNode:_,panZoom:Q,getTransform:J,getViewScale:q}){let U=n1(_);function G({translateExtent:F,width:X,height:Y,zoomStep:K=1,pannable:H=!0,zoomable:L=!0,inversePan:z=!1}){let W=(A)=>{if(A.sourceEvent.type!=="wheel"||!Q)return;let R=J(),O=A.sourceEvent.ctrlKey&&Z5()?10:1,C=-A.sourceEvent.deltaY*(A.sourceEvent.deltaMode===1?0.05:A.sourceEvent.deltaMode?1:0.002)*K,f=R[2]*Math.pow(2,C*O);Q.scaleTo(f)},I=[0,0],M=(A)=>{if(A.sourceEvent.type==="mousedown"||A.sourceEvent.type==="touchstart")I=[A.sourceEvent.clientX??A.sourceEvent.touches[0].clientX,A.sourceEvent.clientY??A.sourceEvent.touches[0].clientY]},B=(A)=>{let R=J();if(A.sourceEvent.type!=="mousemove"&&A.sourceEvent.type!=="touchmove"||!Q)return;let O=[A.sourceEvent.clientX??A.sourceEvent.touches[0].clientX,A.sourceEvent.clientY??A.sourceEvent.touches[0].clientY],C=[O[0]-I[0],O[1]-I[1]];I=O;let f=q()*Math.max(R[2],Math.log(R[2]))*(z?-1:1),S={x:R[0]-C[0]*f,y:R[1]-C[1]*f},w=[[0,0],[X,Y]];Q.setViewportConstrained({x:S.x,y:S.y,zoom:R[2]},w,F)},N=l5().on("start",M).on("zoom",H?B:null).on("zoom.wheel",L?W:null);U.call(N,{})}function Z(){U.on("zoom",null)}return{update:G,destroy:Z,pointer:U0}}var a4=(_)=>({x:_.x,y:_.y,zoom:_.k}),g6=({x:_,y:Q,zoom:J})=>C2.translate(_,Q).scale(J),z2=(_,Q)=>_.target.closest(`.${Q}`),L9=(_,Q)=>Q===2&&Array.isArray(_)&&_.includes(2),pq=(_)=>((_*=2)<=1?_*_*_:(_-=2)*_*_+2)/2,p6=(_,Q=0,J=pq,q=()=>{})=>{let U=typeof Q==="number"&&Q>0;if(!U)q();return U?_.transition().duration(Q).ease(J).on("end",q):_},z9=(_)=>{let Q=_.ctrlKey&&Z5()?10:1;return-_.deltaY*(_.deltaMode===1?0.05:_.deltaMode?1:0.002)*Q};function cq({zoomPanValues:_,noWheelClassName:Q,d3Selection:J,d3Zoom:q,panOnScrollMode:U,panOnScrollSpeed:G,zoomOnPinch:Z,onPanZoomStart:F,onPanZoom:X,onPanZoomEnd:Y}){return(K)=>{if(z2(K,Q)){if(K.ctrlKey)K.preventDefault();return!1}K.preventDefault(),K.stopImmediatePropagation();let H=J.property("__zoom").k||1;if(K.ctrlKey&&Z){let M=U0(K),B=z9(K),N=H*Math.pow(2,B);q.scaleTo(J,N,M,K);return}let L=K.deltaMode===1?20:1,z=U===o0.Vertical?0:K.deltaX*L,W=U===o0.Horizontal?0:K.deltaY*L;if(!Z5()&&K.shiftKey&&U!==o0.Vertical)z=K.deltaY*L,W=0;q.translateBy(J,-(z/H)*G,-(W/H)*G,{internal:!0});let I=a4(J.property("__zoom"));if(clearTimeout(_.panScrollTimeout),!_.isPanScrolling)_.isPanScrolling=!0,F?.(K,I);else X?.(K,I);_.panScrollTimeout=setTimeout(()=>{Y?.(K,I),_.isPanScrolling=!1},150)}}function lq({noWheelClassName:_,preventScrolling:Q,d3ZoomHandler:J}){return function(q,U){let G=q.type==="wheel",Z=!Q&&G&&!q.ctrlKey,F=z2(q,_);if(q.ctrlKey&&G&&F)q.preventDefault();if(Z||F)return null;q.preventDefault(),J.call(this,q,U)}}function rq({zoomPanValues:_,onDraggingChange:Q,onPanZoomStart:J}){return(q)=>{if(q.sourceEvent?.internal)return;let U=a4(q.transform);if(_.mouseButton=q.sourceEvent?.button||0,_.isZoomingOrPanning=!0,_.prevViewport=U,q.sourceEvent?.type==="mousedown")Q(!0);if(J)J?.(q.sourceEvent,U)}}function iq({zoomPanValues:_,panOnDrag:Q,onPaneContextMenu:J,onTransformChange:q,onPanZoom:U}){return(G)=>{if(_.usedRightMouseButton=!!(J&&L9(Q,_.mouseButton??0)),!G.sourceEvent?.sync)q([G.transform.x,G.transform.y,G.transform.k]);if(U&&!G.sourceEvent?.internal)U?.(G.sourceEvent,a4(G.transform))}}function dq({zoomPanValues:_,panOnDrag:Q,panOnScroll:J,onDraggingChange:q,onPanZoomEnd:U,onPaneContextMenu:G}){return(Z)=>{if(Z.sourceEvent?.internal)return;if(_.isZoomingOrPanning=!1,G&&L9(Q,_.mouseButton??0)&&!_.usedRightMouseButton&&Z.sourceEvent)G(Z.sourceEvent);if(_.usedRightMouseButton=!1,q(!1),U){let F=a4(Z.transform);_.prevViewport=F,clearTimeout(_.timerId),_.timerId=setTimeout(()=>{U?.(Z.sourceEvent,F)},J?150:0)}}}function aq({panActivationKeyPressed:_,zoomActivationKeyPressed:Q,zoomOnScroll:J,zoomOnPinch:q,panOnDrag:U,panOnScroll:G,zoomOnDoubleClick:Z,userSelectionActive:F,noWheelClassName:X,noPanClassName:Y,lib:K,connectionInProgress:H}){return(L)=>{let z=Q||J,W=q&&L.ctrlKey,I=L.type==="wheel";if(L.button===1&&L.type==="mousedown"&&(z2(L,`${K}-flow__node`)||z2(L,`${K}-flow__edge`)||z2(L,`${K}-flow__selection`)||z2(L,`${K}-flow__nodesselection`)))return!0;if(!U&&!z&&!G&&!Z&&!q)return!1;if(F)return!1;if(H&&!I)return!1;if(z2(L,X)&&I)return!1;if(z2(L,Y)&&(!I||G&&I&&!Q))return!1;if(!q&&L.ctrlKey&&I)return!1;if(!q&&L.type==="touchstart"&&L.touches?.length>1)return L.preventDefault(),!1;if(!z&&!G&&!W&&I)return!1;if(!U&&(L.type==="mousedown"||L.type==="touchstart"))return!1;if(Array.isArray(U)&&!U.includes(L.button)&&L.type==="mousedown")return!1;let M=Array.isArray(U)&&U.includes(L.button)||!L.button||L.button<=1;return(!L.ctrlKey||I||_)&&M}}function W9({domNode:_,minZoom:Q,maxZoom:J,translateExtent:q,viewport:U,onPanZoom:G,onPanZoomStart:Z,onPanZoomEnd:F,onDraggingChange:X}){let Y={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},K=_.getBoundingClientRect(),H=[[0,0],[K.width,K.height]];(typeof ResizeObserver<"u"?new ResizeObserver((c)=>{let y=c[0];if(y)H=[[0,0],[y.contentRect.width,y.contentRect.height]]}):null)?.observe(_);let z=l5().extent(()=>H).scaleExtent([Q,J]).translateExtent(q),W=n1(_).call(z);R({x:U.x,y:U.y,zoom:J5(U.zoom,Q,J)},[[0,0],[K.width,K.height]],q);let I=W.on("wheel.zoom"),M=W.on("dblclick.zoom");z.wheelDelta(z9);async function B(c,y){if(W)return new Promise((b)=>{z?.interpolate(y?.interpolate==="linear"?x0:w2).transform(p6(W,y?.duration,y?.ease,()=>b(!0)),c)});return!1}function N({noWheelClassName:c,noPanClassName:y,onPaneContextMenu:b,userSelectionActive:v,panOnScroll:x,panOnDrag:V,panOnScrollMode:D,panOnScrollSpeed:P,preventScrolling:u,zoomOnPinch:m,zoomOnScroll:h,zoomOnDoubleClick:t,panActivationKeyPressed:Q1=!1,zoomActivationKeyPressed:s,lib:o,onTransformChange:l,connectionInProgress:e,paneClickDistance:J1,selectionOnDrag:U1}){if(v&&!Y.isZoomingOrPanning)A();let F1=x&&!s&&!v;z.clickDistance(U1?1/0:!P0(J1)||J1<0?0:J1);let W1=F1?cq({zoomPanValues:Y,noWheelClassName:c,d3Selection:W,d3Zoom:z,panOnScrollMode:D,panOnScrollSpeed:P,zoomOnPinch:m,onPanZoomStart:Z,onPanZoom:G,onPanZoomEnd:F}):lq({noWheelClassName:c,preventScrolling:u,d3ZoomHandler:I});W.on("wheel.zoom",W1,{passive:!1});let Y1=rq({zoomPanValues:Y,onDraggingChange:X,onPanZoomStart:Z});z.on("start",Y1);let B1=iq({zoomPanValues:Y,panOnDrag:V,onPaneContextMenu:!!b,onPanZoom:G,onTransformChange:l});z.on("zoom",B1);let n=dq({zoomPanValues:Y,panOnDrag:V,panOnScroll:x,onPaneContextMenu:b,onPanZoomEnd:F,onDraggingChange:X});z.on("end",n);let T1=aq({panActivationKeyPressed:Q1,zoomActivationKeyPressed:s,panOnDrag:V,zoomOnScroll:h,panOnScroll:x,zoomOnDoubleClick:t,zoomOnPinch:m,userSelectionActive:v,noPanClassName:y,noWheelClassName:c,lib:o,connectionInProgress:e});if(z.filter(T1),t)W.on("dblclick.zoom",M);else W.on("dblclick.zoom",null)}function A(){z.on("zoom",null)}async function R(c,y,b){let v=g6(c),x=z?.constrain()(v,y,b);if(x)await B(x);return x}async function O(c,y){let b=g6(c);return await B(b,y),b}function C(c){if(W){let y=g6(c),b=W.property("__zoom");if(b.k!==c.zoom||b.x!==c.x||b.y!==c.y)z?.transform(W,y,null,{sync:!0})}}function f(){let c=W?c5(W.node()):{x:0,y:0,k:1};return{x:c.x,y:c.y,zoom:c.k}}async function S(c,y){if(W)return new Promise((b)=>{z?.interpolate(y?.interpolate==="linear"?x0:w2).scaleTo(p6(W,y?.duration,y?.ease,()=>b(!0)),c)});return!1}async function w(c,y){if(W)return new Promise((b)=>{z?.interpolate(y?.interpolate==="linear"?x0:w2).scaleBy(p6(W,y?.duration,y?.ease,()=>b(!0)),c)});return!1}function k(c){z?.scaleExtent(c)}function E(c){z?.translateExtent(c)}function r(c){let y=!P0(c)||c<0?0:c;z?.clickDistance(y)}return{update:N,destroy:A,setViewport:O,setViewportConstrained:R,getViewport:f,scaleTo:S,scaleBy:w,setScaleExtent:k,setTranslateExtent:E,syncViewport:C,setClickDistance:r}}var n0;(function(_){_.Line="line",_.Handle="handle"})(n0||(n0={}));var B9=["top-left","top-right","bottom-left","bottom-right"],A9=["top","right","bottom","left"];function sq({width:_,prevWidth:Q,height:J,prevHeight:q,affectsX:U,affectsY:G}){let Z=_-Q,F=J-q,X=[Z>0?1:Z<0?-1:0,F>0?1:F<0?-1:0];if(Z&&U)X[0]=X[0]*-1;if(F&&G)X[1]=X[1]*-1;return X}function E7(_){let Q=_.includes("right")||_.includes("left"),J=_.includes("bottom")||_.includes("top"),q=_.includes("left"),U=_.includes("top");return{isHorizontal:Q,isVertical:J,affectsX:q,affectsY:U}}function Y2(_,Q){return Math.max(0,Q-_)}function L2(_,Q){return Math.max(0,_-Q)}function u4(_,Q,J){return Math.max(0,Q-_,_-J)}function x7(_,Q){return _?!Q:Q}function tq(_,Q,J,q,U,G,Z,F){let{affectsX:X,affectsY:Y}=Q,{isHorizontal:K,isVertical:H}=Q,L=K&&H,{xSnapped:z,ySnapped:W}=J,{minWidth:I,maxWidth:M,minHeight:B,maxHeight:N}=q,{x:A,y:R,width:O,height:C,aspectRatio:f}=_,S=Math.floor(K?z-_.pointerX:0),w=Math.floor(H?W-_.pointerY:0),k=O+(X?-S:S),E=C+(Y?-w:w),r=-G[0]*O,c=-G[1]*C,y=u4(k,I,M),b=u4(E,B,N);if(Z){let V=0,D=0;if(X&&S<0)V=Y2(A+S+r,Z[0][0]);else if(!X&&S>0)V=L2(A+k+r,Z[1][0]);if(Y&&w<0)D=Y2(R+w+c,Z[0][1]);else if(!Y&&w>0)D=L2(R+E+c,Z[1][1]);y=Math.max(y,V),b=Math.max(b,D)}if(F){let V=0,D=0;if(X&&S>0)V=L2(A+S,F[0][0]);else if(!X&&S<0)V=Y2(A+k,F[1][0]);if(Y&&w>0)D=L2(R+w,F[0][1]);else if(!Y&&w<0)D=Y2(R+E,F[1][1]);y=Math.max(y,V),b=Math.max(b,D)}if(U){if(K){let V=u4(k/f,B,N)*f;if(y=Math.max(y,V),Z){let D=0;if(!X&&!Y||X&&!Y&&L)D=L2(R+c+k/f,Z[1][1])*f;else D=Y2(R+c+(X?S:-S)/f,Z[0][1])*f;y=Math.max(y,D)}if(F){let D=0;if(!X&&!Y||X&&!Y&&L)D=Y2(R+k/f,F[1][1])*f;else D=L2(R+(X?S:-S)/f,F[0][1])*f;y=Math.max(y,D)}}if(H){let V=u4(E*f,I,M)/f;if(b=Math.max(b,V),Z){let D=0;if(!X&&!Y||Y&&!X&&L)D=L2(A+E*f+r,Z[1][0])/f;else D=Y2(A+(Y?w:-w)*f+r,Z[0][0])/f;b=Math.max(b,D)}if(F){let D=0;if(!X&&!Y||Y&&!X&&L)D=Y2(A+E*f,F[1][0])/f;else D=L2(A+(Y?w:-w)*f,F[0][0])/f;b=Math.max(b,D)}}}if(w=w+(w<0?b:-b),S=S+(S<0?y:-y),U)if(L)if(k>E*f)w=(x7(X,Y)?-S:S)/f;else S=(x7(X,Y)?-w:w)*f;else if(K)w=S/f,Y=X;else S=w*f,X=Y;let v=X?A+S:A,x=Y?R+w:R;return{width:O+(X?-S:S),height:C+(Y?-w:w),x:G[0]*S*(!X?1:-1)+v,y:G[1]*w*(!Y?1:-1)+x}}var M9={width:0,height:0,x:0,y:0},oq={...M9,pointerX:0,pointerY:0,aspectRatio:1};function nq(_,Q,J){let q=Q.position.x+_.position.x,U=Q.position.y+_.position.y,G=_.measured.width??0,Z=_.measured.height??0,F=J[0]*G,X=J[1]*Z;return[[q-F,U-X],[q+G-F,U+Z-X]]}function T9({domNode:_,nodeId:Q,getStoreItems:J,onChange:q,onEnd:U}){let G=n1(_),Z={controlDirection:E7("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function F({controlPosition:Y,boundaries:K,keepAspectRatio:H,resizeDirection:L,onResizeStart:z,onResize:W,onResizeEnd:I,shouldResize:M}){let B={...M9},N={...oq};Z={boundaries:K,resizeDirection:L,keepAspectRatio:H,controlDirection:E7(Y)};let A=void 0,R=null,O=[],C=void 0,f=void 0,S=void 0,w=f5().on("start",(k)=>{let{nodeLookup:E,transform:r,snapGrid:c,snapToGrid:y,nodeOrigin:b,paneDomNode:v}=J();if(A=E.get(Q),!A)return;R=v?.getBoundingClientRect()??null;let{xSnapped:x,ySnapped:V}=r5(k.sourceEvent,{transform:r,snapGrid:c,snapToGrid:y,containerBounds:R});if(B={width:A.measured.width??0,height:A.measured.height??0,x:A.position.x??0,y:A.position.y??0},N={...B,pointerX:x,pointerY:V,aspectRatio:B.width/B.height},C=void 0,f=v2(A.extent)?A.extent:void 0,A.parentId&&(A.extent==="parent"||A.expandParent))C=E.get(A.parentId);if(C&&A.extent==="parent")f=[[0,0],[C.measured.width,C.measured.height]];O=[],S=void 0;for(let[D,P]of E)if(P.parentId===Q){if(O.push({id:D,position:{...P.position},extent:P.extent}),P.extent==="parent"||P.expandParent){let u=nq(P,A,P.origin??b);if(S)S=[[Math.min(u[0][0],S[0][0]),Math.min(u[0][1],S[0][1])],[Math.max(u[1][0],S[1][0]),Math.max(u[1][1],S[1][1])]];else S=u}}z?.(k,{...B})}).on("drag",(k)=>{let{transform:E,snapGrid:r,snapToGrid:c,nodeOrigin:y}=J(),b=r5(k.sourceEvent,{transform:E,snapGrid:r,snapToGrid:c,containerBounds:R}),v=[];if(!A)return;let{x,y:V,width:D,height:P}=B,u={},m=A.origin??y,{width:h,height:t,x:Q1,y:s}=tq(N,Z.controlDirection,b,Z.boundaries,Z.keepAspectRatio,m,f,S),o=h!==D,l=t!==P,e=Q1!==x&&o,J1=s!==V&&l;if(!e&&!J1&&!o&&!l)return;let U1={prevValues:{...B},startX:N.x,startY:N.y,childNodes:O.map((B1)=>({...B1,position:{...B1.position}}))};if(e||J1||m[0]===1||m[1]===1){if(u.x=e?Q1:B.x,u.y=J1?s:B.y,B.x=u.x,B.y=u.y,O.length>0){let B1=Q1-x,n=s-V;for(let T1 of O)T1.position={x:T1.position.x-B1+m[0]*(h-D),y:T1.position.y-n+m[1]*(t-P)},v.push(T1)}}if(o||l)u.width=o&&(!Z.resizeDirection||Z.resizeDirection==="horizontal")?h:B.width,u.height=l&&(!Z.resizeDirection||Z.resizeDirection==="vertical")?t:B.height,B.width=u.width,B.height=u.height;if(C&&A.expandParent){let B1=m[0]*(u.width??0);if(u.x&&u.x<B1)B.x=B1,N.x=N.x-(u.x-B1);let n=m[1]*(u.height??0);if(u.y&&u.y<n)B.y=n,N.y=N.y-(u.y-n)}let F1=sq({width:B.width,prevWidth:D,height:B.height,prevHeight:P,affectsX:Z.controlDirection.affectsX,affectsY:Z.controlDirection.affectsY}),W1={...B,direction:F1};if(M?.(k,W1)===!1){B=U1.prevValues,N.x=U1.startX,N.y=U1.startY,O.forEach((B1,n)=>{B1.position=U1.childNodes[n].position});return}W?.(k,W1),q(u,v)}).on("end",(k)=>{I?.(k,{...B}),U?.({...B})});G.call(w)}function X(){G.on(".drag",null)}return{update:F,destroy:X}}var w9=J0(D0(),1),f9=J0(O9(),1);var I9=(_)=>{let Q,J=new Set,q=(K,H)=>{let L=typeof K==="function"?K(Q):K;if(!Object.is(L,Q)){let z=Q;Q=(H!=null?H:typeof L!=="object"||L===null)?L:Object.assign({},Q,L),J.forEach((W)=>W(Q,z))}},U=()=>Q,X={setState:q,getState:U,getInitialState:()=>Y,subscribe:(K)=>{return J.add(K),()=>J.delete(K)},destroy:()=>{if((import.meta.env?import.meta.env.MODE:void 0)!=="production")console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.");J.clear()}},Y=Q=_(q,U,X);return X},P9=(_)=>_?I9(_):I9;var{useDebugValue:QU}=w9.default,{useSyncExternalStoreWithSelector:JU}=f9.default,$U=(_)=>_;function L8(_,Q=$U,J){let q=JU(_.subscribe,_.getState,_.getServerState||_.getInitialState,Q,J);return QU(q),q}var N9=(_,Q)=>{let J=P9(_),q=(U,G=Q)=>L8(J,U,G);return Object.assign(q,J),q},C9=(_,Q)=>_?N9(_,Q):N9;function m1(_,Q){if(Object.is(_,Q))return!0;if(typeof _!=="object"||_===null||typeof Q!=="object"||Q===null)return!1;if(_ instanceof Map&&Q instanceof Map){if(_.size!==Q.size)return!1;for(let[q,U]of _)if(!Object.is(U,Q.get(q)))return!1;return!0}if(_ instanceof Set&&Q instanceof Set){if(_.size!==Q.size)return!1;for(let q of _)if(!Q.has(q))return!1;return!0}let J=Object.keys(_);if(J.length!==Object.keys(Q).length)return!1;for(let q of J)if(!Object.prototype.hasOwnProperty.call(Q,q)||!Object.is(_[q],Q[q]))return!1;return!0}var q_=J0(k9(),1),e4=a.createContext(null),GU=e4.Provider,U_=X0.error001("react");function S1(_,Q){let J=a.useContext(e4);if(J===null)throw Error(U_);return L8(J,_,Q)}function g1(){let _=a.useContext(e4);if(_===null)throw Error(U_);return a.useMemo(()=>({getState:_.getState,setState:_.setState,subscribe:_.subscribe}),[_])}var j9={display:"none"},ZU={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},G_="react-flow__node-desc",Z_="react-flow__edge-desc",FU="react-flow__aria-live",HU=(_)=>_.ariaLiveMessage,XU=(_)=>_.ariaLabelConfig;function KU({rfId:_}){let Q=S1(HU);return d.jsx("div",{id:`${FU}-${_}`,"aria-live":"assertive","aria-atomic":"true",style:ZU,children:Q})}function YU({rfId:_,disableKeyboardA11y:Q}){let J=S1(XU);return d.jsxs(d.Fragment,{children:[d.jsx("div",{id:`${G_}-${_}`,style:j9,children:Q?J["node.a11yDescription.default"]:J["node.a11yDescription.keyboardDisabled"]}),d.jsx("div",{id:`${Z_}-${_}`,style:j9,children:J["edge.a11yDescription.default"]}),!Q&&d.jsx(KU,{rfId:_})]})}var p0=a.forwardRef(({position:_="top-left",children:Q,className:J,style:q,...U},G)=>{let Z=`${_}`.split("-");return d.jsx("div",{className:i1(["react-flow__panel",J,...Z]),style:q,ref:G,...U,children:Q})});p0.displayName="Panel";var v9="https://reactflow.dev/attribution";function LU({proOptions:_,position:Q="bottom-right"}){if(a.useEffect(()=>{a7("react")},[]),_?.hideAttribution)return null;return d.jsx(p0,{position:Q,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${v9}`,children:d.jsx("a",{href:v9,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var zU=(_)=>{let Q=[],J=[];for(let[,q]of _.nodeLookup)if(q.selected)Q.push(q.internals.userNode);for(let[,q]of _.edgeLookup)if(q.selected)J.push(q);return{selectedNodes:Q,selectedEdges:J}},s4=(_)=>_.id;function WU(_,Q){return m1(_.selectedNodes.map(s4),Q.selectedNodes.map(s4))&&m1(_.selectedEdges.map(s4),Q.selectedEdges.map(s4))}function BU({onSelectionChange:_}){let Q=g1(),{selectedNodes:J,selectedEdges:q}=S1(zU,WU);return a.useEffect(()=>{let U={nodes:J,edges:q};_?.(U),Q.getState().onSelectionChangeHandlers.forEach((G)=>G(U))},[J,q,_]),null}var AU=(_)=>!!_.onSelectionChangeHandlers;function MU({onSelectionChange:_}){let Q=S1(AU);if(_||Q)return d.jsx(BU,{onSelectionChange:_});return null}var F_=[0,0],TU={x:0,y:0,zoom:1},RU=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],V9=[...RU,"rfId"],OU=(_)=>({setNodes:_.setNodes,setEdges:_.setEdges,setMinZoom:_.setMinZoom,setMaxZoom:_.setMaxZoom,setTranslateExtent:_.setTranslateExtent,setNodeExtent:_.setNodeExtent,reset:_.reset,setDefaultNodesAndEdges:_.setDefaultNodesAndEdges}),u9={translateExtent:$5,nodeOrigin:F_,minZoom:0.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function IU(_){let{setNodes:Q,setEdges:J,setMinZoom:q,setMaxZoom:U,setTranslateExtent:G,setNodeExtent:Z,reset:F,setDefaultNodesAndEdges:X}=S1(OU,m1),Y=g1();a.useEffect(()=>{return X(_.defaultNodes,_.defaultEdges),()=>{K.current=u9,F()}},[]);let K=a.useRef(u9);return a.useEffect(()=>{for(let H of V9){let L=_[H],z=K.current[H];if(L===z)continue;if(typeof _[H]>"u")continue;if(H==="nodes")Q(L);else if(H==="edges")J(L);else if(H==="minZoom")q(L);else if(H==="maxZoom")U(L);else if(H==="translateExtent")G(L);else if(H==="nodeExtent")Z(L);else if(H==="ariaLabelConfig")Y.setState({ariaLabelConfig:d7(L)});else if(H==="fitView")Y.setState({fitViewQueued:L});else if(H==="fitViewOptions")Y.setState({fitViewOptions:L});else Y.setState({[H]:L})}K.current=_},V9.map((H)=>_[H])),null}function h9(){if(typeof window>"u"||!window.matchMedia)return null;return window.matchMedia("(prefers-color-scheme: dark)")}function PU(_){let[Q,J]=a.useState(_==="system"?null:_);return a.useEffect(()=>{if(_!=="system"){J(_);return}let q=h9(),U=()=>J(q?.matches?"dark":"light");return U(),q?.addEventListener("change",U),()=>{q?.removeEventListener("change",U)}},[_]),Q!==null?Q:h9()?.matches?"dark":"light"}var D9=typeof document<"u"?document:null;function t5(_=null,Q={target:D9,actInsideInputWithModifier:!0}){let[J,q]=a.useState(!1),U=a.useRef(!1),G=a.useRef(new Set([])),[Z,F]=a.useMemo(()=>{if(_!==null){let Y=(Array.isArray(_)?_:[_]).filter((H)=>typeof H==="string").map((H)=>H.replace(/\+/g,`
|
|
29
29
|
`).replace(`
|
|
30
30
|
|
|
31
31
|
`,`
|
|
32
32
|
+`).split(`
|
|
33
|
-
`)),K=Y.reduce((H,L)=>H.concat(...L),[]);return[Y,K]}return[[],[]]},[_]);return d.useEffect(()=>{let X=Q?.target??C9,Y=Q?.actInsideInputWithModifier??!0;if(_!==null){let K=(z)=>{if(U.current=z.ctrlKey||z.metaKey||z.shiftKey||z.altKey,(!U.current||U.current&&!Y)&&a6(z))return!1;let I=y9(z.code,F);if(G.current.add(z[I]),S9(Z,G.current,!1)){let R=z.composedPath?.()?.[0]||z.target,A=R?.nodeName==="BUTTON"||R?.nodeName==="A";if(Q.preventDefault!==!1&&(U.current||!A))z.preventDefault();q(!0)}},H=(z)=>{let W=y9(z.code,F);if(S9(Z,G.current,!0))q(!1),G.current.clear();else G.current.delete(z[W]);if(z.key==="Meta")G.current.clear();U.current=!1},L=()=>{G.current.clear(),q(!1)};return X?.addEventListener("keydown",K),X?.addEventListener("keyup",H),window.addEventListener("blur",L),window.addEventListener("contextmenu",L),()=>{X?.removeEventListener("keydown",K),X?.removeEventListener("keyup",H),window.removeEventListener("blur",L),window.removeEventListener("contextmenu",L)}}},[_,q]),J}function S9(_,Q,J){return _.filter((q)=>J||q.length===Q.size).some((q)=>q.every((U)=>Q.has(U)))}function y9(_,Q){return Q.includes(_)?"code":"key"}var PU=()=>{let _=E1();return d.useMemo(()=>{return{zoomIn:async(Q)=>{let{panZoom:J}=_.getState();return J?J.scaleBy(1.2,Q):!1},zoomOut:async(Q)=>{let{panZoom:J}=_.getState();return J?J.scaleBy(0.8333333333333334,Q):!1},zoomTo:async(Q,J)=>{let{panZoom:q}=_.getState();return q?q.scaleTo(Q,J):!1},getZoom:()=>_.getState().transform[2],setViewport:async(Q,J)=>{let{transform:[q,U,G],panZoom:Z}=_.getState();if(!Z)return!1;return await Z.setViewport({x:Q.x??q,y:Q.y??U,zoom:Q.zoom??G},J),!0},getViewport:()=>{let[Q,J,q]=_.getState().transform;return{x:Q,y:J,zoom:q}},setCenter:async(Q,J,q)=>{return _.getState().setCenter(Q,J,q)},fitBounds:async(Q,J)=>{let{width:q,height:U,minZoom:G,maxZoom:Z,panZoom:F}=_.getState(),X=l5(Q,q,U,G,Z,J?.padding??0.1);if(!F)return!1;return await F.setViewport(X,{duration:J?.duration,ease:J?.ease,interpolate:J?.interpolate}),!0},screenToFlowPosition:(Q,J={})=>{let{transform:q,snapGrid:U,snapToGrid:G,domNode:Z}=_.getState();if(!Z)return Q;let{x:F,y:X}=Z.getBoundingClientRect(),Y={x:Q.x-F,y:Q.y-X},K=J.snapGrid??U,H=J.snapToGrid??G;return Z5(Y,q,H,K)},flowToScreenPosition:(Q)=>{let{transform:J,domNode:q}=_.getState();if(!q)return Q;let{x:U,y:G}=q.getBoundingClientRect(),Z=v2(Q,J);return{x:Z.x+U,y:Z.y+G}}}},[])};function __(_,Q){let J=[],q=new Map,U=[];for(let G of _)if(G.type==="add"){U.push(G);continue}else if(G.type==="remove"||G.type==="replace")q.set(G.id,[G]);else{let Z=q.get(G.id);if(Z)Z.push(G);else q.set(G.id,[G])}for(let G of Q){let Z=q.get(G.id);if(!Z){J.push(G);continue}if(Z[0].type==="remove")continue;if(Z[0].type==="replace"){J.push({...Z[0].item});continue}let F={...G};for(let X of Z)NU(X,F);J.push(F)}if(U.length)U.forEach((G)=>{if(G.index!==void 0)J.splice(G.index,0,{...G.item});else J.push({...G.item})});return J}function NU(_,Q){switch(_.type){case"select":{Q.selected=_.selected;break}case"position":{if(typeof _.position<"u")Q.position=_.position;if(typeof _.dragging<"u")Q.dragging=_.dragging;break}case"dimensions":{if(typeof _.dimensions<"u"){if(Q.measured={..._.dimensions},_.setAttributes){if(_.setAttributes===!0||_.setAttributes==="width")Q.width=_.dimensions.width;if(_.setAttributes===!0||_.setAttributes==="height")Q.height=_.dimensions.height}}if(typeof _.resizing==="boolean")Q.resizing=_.resizing;break}}}function Q_(_,Q){return __(_,Q)}function wU(_,Q){return __(_,Q)}function u2(_,Q){return{id:_,type:"select",selected:Q}}function H5(_,Q=new Set,J=!1){let q=[];for(let[U,G]of _){let Z=Q.has(U);if(!(G.selected===void 0&&!Z)&&G.selected!==Z){if(J)G.selected=Z;q.push(u2(G.id,Z))}}return q}function k9({items:_=[],lookup:Q}){let J=[],q=new Map(_.map((U)=>[U.id,U]));for(let[U,G]of _.entries()){let Z=Q.get(G.id),F=Z?.internals?.userNode??Z;if(F!==void 0&&F!==G)J.push({id:G.id,item:G,type:"replace"});if(F===void 0)J.push({item:G,type:"add",index:U})}for(let[U]of Q)if(q.get(U)===void 0)J.push({id:U,type:"remove"});return J}function v9(_){return{id:_.id,type:"remove"}}var fU=p6("React Flow","https://reactflow.dev/");function CU(_,Q,J={}){return p7(_,Q,{...J,onError:J.onError??fU})}var j9=(_)=>v7(_),SU=(_)=>D6(_);function J_(_){return d.forwardRef(_)}var $_=typeof window<"u"?d.useLayoutEffect:d.useEffect;function V9(_){let[Q,J]=d.useState(BigInt(0)),[q]=d.useState(()=>yU(()=>J((U)=>U+BigInt(1))));return $_(()=>{let U=q.get();if(U.length)_(U),q.reset()},[Q]),q}function yU(_){let Q=[];return{get:()=>Q,reset:()=>{Q=[]},push:(J)=>{Q.push(J),_()}}}var q_=d.createContext(null);function kU({children:_}){let Q=E1(),J=d.useCallback((F)=>{let{nodes:X=[],setNodes:Y,hasDefaultNodes:K,onNodesChange:H,nodeLookup:L,fitViewQueued:z,onNodesChangeMiddlewareMap:W}=Q.getState(),I=X;for(let A of F)I=typeof A==="function"?A(I):A;let R=k9({items:I,lookup:L});for(let A of W.values())R=A(R);if(K)Y(I);if(R.length>0)H?.(R);else if(z)window.requestAnimationFrame(()=>{let{fitViewQueued:A,nodes:N,setNodes:B}=Q.getState();if(A)B(N)})},[]),q=V9(J),U=d.useCallback((F)=>{let{edges:X=[],setEdges:Y,hasDefaultEdges:K,onEdgesChange:H,edgeLookup:L}=Q.getState(),z=X;for(let W of F)z=typeof W==="function"?W(z):W;if(K)Y(z);else if(H)H(k9({items:z,lookup:L}))},[]),G=V9(U),Z=d.useMemo(()=>({nodeQueue:q,edgeQueue:G}),[]);return i.jsx(q_.Provider,{value:Z,children:_})}function vU(){let _=d.useContext(q_);if(!_)throw Error("useBatchContext must be used within a BatchProvider");return _}var jU=(_)=>!!_.panZoom;function d5(){let _=PU(),Q=E1(),J=vU(),q=S1(jU),U=d.useMemo(()=>{let G=(H)=>Q.getState().nodeLookup.get(H),Z=(H)=>{J.nodeQueue.push(H)},F=(H)=>{J.edgeQueue.push(H)},X=(H)=>{let{nodeLookup:L,nodeOrigin:z}=Q.getState(),W=j9(H)?H:L.get(H.id),I=W.parentId?l6(W.position,W.measured,W.parentId,L,z):W.position,R={...W,position:I,width:W.measured?.width??W.width,height:W.measured?.height??W.height};return U5(R)},Y=(H,L,z={replace:!1})=>{Z((W)=>W.map((I)=>{if(I.id===H){let R=typeof L==="function"?L(I):L;return z.replace&&j9(R)?R:{...I,...R}}return I}))},K=(H,L,z={replace:!1})=>{F((W)=>W.map((I)=>{if(I.id===H){let R=typeof L==="function"?L(I):L;return z.replace&&SU(R)?R:{...I,...R}}return I}))};return{getNodes:()=>Q.getState().nodes.map((H)=>({...H})),getNode:(H)=>G(H)?.internals.userNode,getInternalNode:G,getEdges:()=>{let{edges:H=[]}=Q.getState();return H.map((L)=>({...L}))},getEdge:(H)=>Q.getState().edgeLookup.get(H),setNodes:Z,setEdges:F,addNodes:(H)=>{let L=Array.isArray(H)?H:[H];J.nodeQueue.push((z)=>[...z,...L])},addEdges:(H)=>{let L=Array.isArray(H)?H:[H];J.edgeQueue.push((z)=>[...z,...L])},toObject:()=>{let{nodes:H=[],edges:L=[],transform:z}=Q.getState(),[W,I,R]=z;return{nodes:H.map((A)=>({...A})),edges:L.map((A)=>({...A})),viewport:{x:W,y:I,zoom:R}}},deleteElements:async({nodes:H=[],edges:L=[]})=>{let{nodes:z,edges:W,onNodesDelete:I,onEdgesDelete:R,triggerNodeChanges:A,triggerEdgeChanges:N,onDelete:B,onBeforeDelete:T}=Q.getState(),{nodes:O,edges:C}=await u7({nodesToRemove:H,edgesToRemove:L,nodes:z,edges:W,onBeforeDelete:T}),f=C.length>0,S=O.length>0;if(f){let w=C.map(v9);R?.(C),N(w)}if(S){let w=O.map(v9);I?.(O),A(w)}if(S||f)B?.({nodes:O,edges:C});return{deletedNodes:O,deletedEdges:C}},getIntersectingNodes:(H,L=!0,z)=>{let W=g6(H),I=W?H:X(H),R=z!==void 0;if(!I)return[];return(z||Q.getState().nodes).filter((A)=>{let N=Q.getState().nodeLookup.get(A.id);if(N&&!W&&(A.id===H.id||!N.internals.positionAbsolute))return!1;let B=U5(R?A:N),T=c5(B,I);return L&&T>0||T>=B.width*B.height||T>=I.width*I.height})},isNodeIntersecting:(H,L,z=!0)=>{let I=g6(H)?H:X(H);if(!I)return!1;let R=c5(I,L);return z&&R>0||R>=L.width*L.height||R>=I.width*I.height},updateNode:Y,updateNodeData:(H,L,z={replace:!1})=>{Y(H,(W)=>{let I=typeof L==="function"?L(W):L;return z.replace?{...W,data:I}:{...W,data:{...W.data,...I}}},z)},updateEdge:K,updateEdgeData:(H,L,z={replace:!1})=>{K(H,(W)=>{let I=typeof L==="function"?L(W):L;return z.replace?{...W,data:I}:{...W,data:{...W.data,...I}}},z)},getNodesBounds:(H)=>{let{nodeLookup:L,nodeOrigin:z}=Q.getState();return E6(H,{nodeLookup:L,nodeOrigin:z})},getHandleConnections:({type:H,id:L,nodeId:z})=>Array.from(Q.getState().connectionLookup.get(`${z}-${H}${L?`-${L}`:""}`)?.values()??[]),getNodeConnections:({type:H,handleId:L,nodeId:z})=>Array.from(Q.getState().connectionLookup.get(`${z}${H?L?`-${H}-${L}`:`-${H}`:""}`)?.values()??[]),fitView:async(H)=>{let L=Q.getState().fitViewResolver??b7();return Q.setState({fitViewQueued:!0,fitViewOptions:H,fitViewResolver:L}),J.nodeQueue.push((z)=>[...z]),L.promise}}},[]);return d.useMemo(()=>{return{...U,..._,viewportInitialized:q}},[q])}var u9=(_)=>_.selected,VU=typeof window<"u"?window:void 0;function uU({deleteKeyCode:_,multiSelectionKeyCode:Q}){let J=E1(),{deleteElements:q}=d5(),U=i5(_,{actInsideInputWithModifier:!1}),G=i5(Q,{target:VU});d.useEffect(()=>{if(U){let{edges:Z,nodes:F}=J.getState();q({nodes:F.filter(u9),edges:Z.filter(u9)}),J.setState({nodesSelectionActive:!1})}},[U]),d.useEffect(()=>{J.setState({multiSelectionActive:G})},[G])}function hU(_){let Q=E1();d.useEffect(()=>{let J=()=>{if(!_.current||!(_.current.checkVisibility?.()??!0))return!1;let q=j4(_.current);if(q.height===0||q.width===0)Q.getState().onError?.("004",X0.error004());Q.setState({width:q.width||500,height:q.height||500})};if(_.current){J(),window.addEventListener("resize",J);let q=new ResizeObserver(()=>J());return q.observe(_.current),()=>{if(window.removeEventListener("resize",J),q&&_.current)q.unobserve(_.current)}}},[])}var i4={position:"absolute",width:"100%",height:"100%",top:0,left:0},DU=(_)=>({userSelectionActive:_.userSelectionActive,lib:_.lib,connectionInProgress:_.connection.inProgress});function bU({onPaneContextMenu:_,zoomOnScroll:Q=!0,zoomOnPinch:J=!0,panOnScroll:q=!1,panActivationKeyPressed:U,panOnScrollSpeed:G=0.5,panOnScrollMode:Z=o0.Free,zoomOnDoubleClick:F=!0,panOnDrag:X=!0,defaultViewport:Y,translateExtent:K,minZoom:H,maxZoom:L,zoomActivationKeyCode:z,preventScrolling:W=!0,children:I,noWheelClassName:R,noPanClassName:A,onViewportChange:N,isControlledViewport:B,paneClickDistance:T,selectionOnDrag:O}){let C=E1(),f=d.useRef(null),{userSelectionActive:S,lib:w,connectionInProgress:k}=S1(DU,b1),E=i5(z),l=d.useRef();hU(f);let c=d.useCallback((y)=>{if(N?.({x:y[0],y:y[1],zoom:y[2]}),!B)C.setState({transform:y})},[N,B]);return d.useEffect(()=>{if(f.current){l.current=G9({domNode:f.current,minZoom:H,maxZoom:L,translateExtent:K,viewport:Y,onDraggingChange:(x)=>C.setState((V)=>V.paneDragging===x?V:{paneDragging:x}),onPanZoomStart:(x,V)=>{let{onViewportChangeStart:b,onMoveStart:P}=C.getState();P?.(x,V),b?.(V)},onPanZoom:(x,V)=>{let{onViewportChange:b,onMove:P}=C.getState();P?.(x,V),b?.(V)},onPanZoomEnd:(x,V)=>{let{onViewportChangeEnd:b,onMoveEnd:P}=C.getState();P?.(x,V),b?.(V)}});let{x:y,y:D,zoom:v}=l.current.getViewport();return C.setState({panZoom:l.current,transform:[y,D,v],domNode:f.current.closest(".react-flow")}),()=>{l.current?.destroy()}}},[]),d.useEffect(()=>{l.current?.update({onPaneContextMenu:_,zoomOnScroll:Q,zoomOnPinch:J,panOnScroll:q,panActivationKeyPressed:U,panOnScrollSpeed:G,panOnScrollMode:Z,zoomOnDoubleClick:F,panOnDrag:X,zoomActivationKeyPressed:E,preventScrolling:W,noPanClassName:A,userSelectionActive:S,noWheelClassName:R,lib:w,onTransformChange:c,connectionInProgress:k,selectionOnDrag:O,paneClickDistance:T})},[_,Q,J,q,U,G,Z,F,X,E,W,A,S,R,w,c,k,O,T]),i.jsx("div",{className:"react-flow__renderer",ref:f,style:i4,children:I})}var EU=(_)=>({userSelectionActive:_.userSelectionActive,userSelectionRect:_.userSelectionRect});function xU(){let{userSelectionActive:_,userSelectionRect:Q}=S1(EU,b1);if(!(_&&Q))return null;return i.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:Q.width,height:Q.height,transform:`translate(${Q.x}px, ${Q.y}px)`}})}var q8=(_,Q)=>{return(J)=>{if(J.target!==Q.current)return;_?.(J)}},mU=(_)=>({userSelectionActive:_.userSelectionActive,elementsSelectable:_.elementsSelectable,dragging:_.paneDragging,panBy:_.panBy,autoPanSpeed:_.autoPanSpeed});function gU({isSelecting:_,selectionKeyPressed:Q,selectionMode:J=y2.Full,panOnDrag:q,autoPanOnSelection:U,paneClickDistance:G,selectionOnDrag:Z,onSelectionStart:F,onSelectionEnd:X,onPaneClick:Y,onPaneContextMenu:K,onPaneScroll:H,onPaneMouseEnter:L,onPaneMouseMove:z,onPaneMouseLeave:W,children:I}){let R=d.useRef(0),A=E1(),{userSelectionActive:N,elementsSelectable:B,dragging:T,panBy:O,autoPanSpeed:C}=S1(mU,b1),f=B&&(_||N),S=d.useRef(null),w=d.useRef(),k=d.useRef(new Set),E=d.useRef(new Set),l=d.useRef(!1),c=d.useRef(!1),y=d.useRef({x:0,y:0}),D=d.useRef(!1),v=(p)=>{if(c.current||l.current||A.getState().connection.inProgress){c.current=!1,l.current=!1;return}Y?.(p),A.getState().resetSelectedElements(),A.setState({nodesSelectionActive:!1})},x=(p)=>{if(Array.isArray(q)&&q?.includes(2)){p.preventDefault();return}K?.(p)},V=H?(p)=>H(p):void 0,b=(p)=>{if(c.current)p.stopPropagation(),c.current=!1},P=(p)=>{if(p.pointerType==="touch"&&q!==!1&&!Q)return;let{domNode:n,transform:J1}=A.getState();if(w.current=n?.getBoundingClientRect(),!w.current)return;let q1=p.target===S.current;if(!q1&&!!p.target.closest(".nokey")||!_||!(Z&&q1||Q)||p.button!==0||!p.isPrimary)return;p.target?.setPointerCapture?.(p.pointerId),c.current=!1;let{x:T1,y:L1}=O0(p.nativeEvent,w.current),_1=Z5({x:T1,y:L1},J1);if(A.setState({userSelectionRect:{width:0,height:0,startX:_1.x,startY:_1.y,x:T1,y:L1}}),!q1)p.stopPropagation(),p.preventDefault()};function j(p,n){let{userSelectionRect:J1}=A.getState();if(!J1)return;let{transform:q1,nodeLookup:F1,edgeLookup:Z1,connectionLookup:T1,triggerNodeChanges:L1,triggerEdgeChanges:_1,defaultEdgeOptions:W1}=A.getState(),K1={x:J1.startX,y:J1.startY},{x:p1,y:s1}=v2(K1,q1),a1={startX:K1.x,startY:K1.y,x:p<p1?p:p1,y:n<s1?n:s1,width:Math.abs(p-p1),height:Math.abs(n-s1)},j0=k.current,K0=E.current;k.current=new Set(S4(F1,a1,q1,J===y2.Partial,!0).map((Q0)=>Q0.id)),E.current=new Set;let T0=W1?.selectable??!0;for(let Q0 of k.current){let e1=T1.get(Q0);if(!e1)continue;for(let{edgeId:F0}of e1.values()){let W0=Z1.get(F0);if(W0&&(W0.selectable??T0))E.current.add(F0)}}if(!r6(j0,k.current)){let Q0=H5(F1,k.current,!0);L1(Q0)}if(!r6(K0,E.current)){let Q0=H5(Z1,E.current);_1(Q0)}A.setState({userSelectionRect:a1,userSelectionActive:!0,nodesSelectionActive:!1})}function m(){if(!U||!w.current)return;let[p,n]=y4(y.current,w.current,C);O({x:p,y:n}).then((J1)=>{if(!c.current||!J1){R.current=requestAnimationFrame(m);return}let{x:q1,y:F1}=y.current;j(q1,F1),R.current=requestAnimationFrame(m)})}let h=()=>{cancelAnimationFrame(R.current),R.current=0,D.current=!1};d.useEffect(()=>{return()=>h()},[]);let o=(p)=>{let{userSelectionRect:n,transform:J1,resetSelectedElements:q1}=A.getState();if(!w.current||!n)return;let{x:F1,y:Z1}=O0(p.nativeEvent,w.current);y.current={x:F1,y:Z1};let T1=v2({x:n.startX,y:n.startY},J1);if(!c.current){let L1=Q?0:G;if(Math.hypot(F1-T1.x,Z1-T1.y)<=L1)return;q1(),F?.(p)}if(c.current=!0,!D.current)m(),D.current=!0;j(F1,Z1)},e=(p)=>{if(!f){if(p.target===S.current&&A.getState().connection.inProgress)l.current=!0;return}if(p.button!==0)return;if(p.target?.releasePointerCapture?.(p.pointerId),!N&&p.target===S.current&&A.getState().userSelectionRect)v?.(p);if(A.setState({userSelectionActive:!1,userSelectionRect:null}),c.current)X?.(p),A.setState({nodesSelectionActive:k.current.size>0});h()},s=(p)=>{p.target?.releasePointerCapture?.(p.pointerId),h()},t=q===!0||Array.isArray(q)&&q.includes(0);return i.jsxs("div",{className:c1(["react-flow__pane",{draggable:t,dragging:T,selection:_}]),onClick:f?void 0:q8(v,S),onContextMenu:q8(x,S),onWheel:q8(V,S),onPointerEnter:f?void 0:L,onPointerMove:f?o:z,onPointerUp:e,onPointerCancel:f?s:void 0,onPointerDownCapture:f?P:void 0,onClickCapture:f?b:void 0,onPointerLeave:W,ref:S,style:i4,children:[I,i.jsx(xU,{})]})}function G8({id:_,store:Q,unselect:J=!1,nodeRef:q}){let{addSelectedNodes:U,unselectNodesAndEdges:G,multiSelectionActive:Z,nodeLookup:F,onError:X}=Q.getState(),Y=F.get(_);if(!Y){X?.("012",X0.error012(_));return}if(Q.setState({nodesSelectionActive:!1}),!Y.selected)U([_]);else if(J||Y.selected&&Z)G({nodes:[Y],edges:[]}),requestAnimationFrame(()=>q?.current?.blur())}function U_({nodeRef:_,disabled:Q=!1,noDragClassName:J,handleSelector:q,nodeId:U,isSelectable:G,nodeClickDistance:Z}){let F=E1(),[X,Y]=d.useState(!1),K=d.useRef();return d.useEffect(()=>{if(Q)return;return K.current=n7({getStoreItems:()=>F.getState(),onNodeMouseDown:(H)=>{G8({id:H,store:F,nodeRef:_})},onDragStart:()=>{Y(!0)},onDragStop:()=>{Y(!1)}}),()=>{K.current?.destroy(),K.current=void 0}},[Q,F,_]),d.useEffect(()=>{if(Q||!_.current||!K.current)return;K.current.update({noDragClassName:J,handleSelector:q,domNode:_.current,isSelectable:G,nodeId:U,nodeClickDistance:Z})},[J,q,Q,G,_,U,Z]),X}var pU=(_)=>(Q)=>Q.selected&&(Q.draggable||_&&typeof Q.draggable>"u");function G_(){let _=E1();return d.useCallback((J)=>{let{nodeExtent:q,snapToGrid:U,snapGrid:G,nodesDraggable:Z,onError:F,updateNodePositions:X,nodeLookup:Y,nodeOrigin:K}=_.getState(),H=new Map,L=pU(Z),z=U?G[0]:5,W=U?G[1]:5,I=J.direction.x*z*J.factor,R=J.direction.y*W*J.factor;for(let[,A]of Y){if(!L(A))continue;let N={x:A.internals.positionAbsolute.x+I,y:A.internals.positionAbsolute.y+R};if(U)N=G5(N,G);let{position:B,positionAbsolute:T}=x6({nodeId:A.id,nextPosition:N,nodeLookup:Y,nodeExtent:q,nodeOrigin:K,onError:F});A.position=B,A.internals.positionAbsolute=T,H.set(A.id,A)}X(H)},[])}var Z8=d.createContext(null),cU=Z8.Provider;Z8.Consumer;var F8=()=>{return d.useContext(Z8)},lU=(_)=>({connectOnClick:_.connectOnClick,noPanClassName:_.noPanClassName,rfId:_.rfId}),Z_=d.createContext(null);function rU({children:_}){let Q=S1(lU,b1);return i.jsx(Z_.Provider,{value:Q,children:_})}function iU(){let _=d.useContext(Z_);if(!_)throw Error("useHandleConfig must be used within a HandleConfigProvider");return _}var dU={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},aU=(_,Q,J)=>(q)=>{let{connectionClickStartHandle:U,connectionMode:G,connection:Z}=q,{fromHandle:F,toHandle:X,isValid:Y}=Z;if(!F&&!U)return dU;let K=X?.nodeId===_&&X?.id===Q&&X?.type===J;return{connectingFrom:F?.nodeId===_&&F?.id===Q&&F?.type===J,connectingTo:K,clickConnecting:U?.nodeId===_&&U?.id===Q&&U?.type===J,isPossibleEndHandle:G===L2.Strict?F?.type!==J:_!==F?.nodeId||Q!==F?.id,connectionInProcess:!!F,clickConnectionInProcess:!!U,valid:K&&Y}};function sU({type:_="source",position:Q=X1.Top,isValidConnection:J,isConnectable:q=!0,isConnectableStart:U=!0,isConnectableEnd:G=!0,id:Z,onConnect:F,children:X,className:Y,onMouseDown:K,onTouchStart:H,...L},z){let W=Z||null,I=_==="target",R=E1(),A=F8(),{connectOnClick:N,noPanClassName:B,rfId:T}=iU(),{connectingFrom:O,connectingTo:C,clickConnecting:f,isPossibleEndHandle:S,connectionInProcess:w,clickConnectionInProcess:k,valid:E}=S1(aU(A,W,_),b1);if(!A)R.getState().onError?.("010",X0.error010());let l=(D)=>{let{defaultEdgeOptions:v,onConnect:x,hasDefaultEdges:V}=R.getState(),b={...v,...D};if(V){let{edges:P,setEdges:j,onError:m}=R.getState();j(CU(b,P,{onError:m}))}x?.(b),F?.(b)},c=(D)=>{if(!A)return;let v=s6(D.nativeEvent);if(U&&(v&&D.button===0||!v)){let x=R.getState();x4.onPointerDown(D.nativeEvent,{handleDomNode:D.currentTarget,autoPanOnConnect:x.autoPanOnConnect,connectionMode:x.connectionMode,connectionRadius:x.connectionRadius,domNode:x.domNode,nodeLookup:x.nodeLookup,lib:x.lib,isTarget:I,handleId:W,nodeId:A,flowId:x.rfId,panBy:x.panBy,cancelConnection:x.cancelConnection,onConnectStart:x.onConnectStart,onConnectEnd:(...V)=>R.getState().onConnectEnd?.(...V),updateConnection:x.updateConnection,onConnect:l,isValidConnection:J||((...V)=>R.getState().isValidConnection?.(...V)??!0),getTransform:()=>R.getState().transform,getFromHandle:()=>R.getState().connection.fromHandle,autoPanSpeed:x.autoPanSpeed,dragThreshold:x.connectionDragThreshold})}if(v)K?.(D);else H?.(D)},y=(D)=>{let{onClickConnectStart:v,onClickConnectEnd:x,connectionClickStartHandle:V,connectionMode:b,isValidConnection:P,lib:j,rfId:m,nodeLookup:h,connection:o}=R.getState();if(!A||!V&&!U)return;if(!V){v?.(D.nativeEvent,{nodeId:A,handleId:W,handleType:_}),R.setState({connectionClickStartHandle:{nodeId:A,type:_,id:W}});return}let e=d6(D.target),s=J||P,{connection:t,isValid:p}=x4.isValid(D.nativeEvent,{handle:{nodeId:A,id:W,type:_},connectionMode:b,fromNodeId:V.nodeId,fromHandleId:V.id||null,fromType:V.type,isValidConnection:s,flowId:m,doc:e,lib:j,nodeLookup:h});if(p&&t)l(t);let n=structuredClone(o);delete n.inProgress,n.toPosition=n.toHandle?n.toHandle.position:null,x?.(D,n),R.setState({connectionClickStartHandle:null})};return i.jsx("div",{"data-handleid":W,"data-nodeid":A,"data-handlepos":Q,"data-id":`${T}-${A}-${W}-${_}`,className:c1(["react-flow__handle",`react-flow__handle-${Q}`,"nodrag",B,Y,{source:!I,target:I,connectable:q,connectablestart:U,connectableend:G,clickconnecting:f,connectingfrom:O,connectingto:C,valid:E,connectionindicator:q&&(!w||S)&&(w||k?G:U)}]),onMouseDown:c,onTouchStart:c,onClick:N?y:void 0,ref:z,...L,children:X})}var c4=d.memo(J_(sU));function tU({data:_,isConnectable:Q,sourcePosition:J=X1.Bottom}){return i.jsxs(i.Fragment,{children:[_?.label,i.jsx(c4,{type:"source",position:J,isConnectable:Q})]})}function oU({data:_,isConnectable:Q,targetPosition:J=X1.Top,sourcePosition:q=X1.Bottom}){return i.jsxs(i.Fragment,{children:[i.jsx(c4,{type:"target",position:J,isConnectable:Q}),_?.label,i.jsx(c4,{type:"source",position:q,isConnectable:Q})]})}function nU(){return null}function eU({data:_,isConnectable:Q,targetPosition:J=X1.Top}){return i.jsxs(i.Fragment,{children:[i.jsx(c4,{type:"target",position:J,isConnectable:Q}),_?.label]})}var l4={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},h9={input:tU,default:oU,output:eU,group:nU};function _G(_){if(_.internals.handleBounds===void 0)return{width:_.width??_.initialWidth??_.style?.width,height:_.height??_.initialHeight??_.style?.height};return{width:_.width??_.style?.width,height:_.height??_.style?.height}}var QG=(_)=>{let{width:Q,height:J,x:q,y:U}=V2(_.nodeLookup,{filter:(G)=>!!G.selected});return{width:R0(Q)?Q:null,height:R0(J)?J:null,userSelectionActive:_.userSelectionActive,transformString:`translate(${_.transform[0]}px,${_.transform[1]}px) scale(${_.transform[2]}) translate(${q}px,${U}px)`}};function JG({onSelectionContextMenu:_,noPanClassName:Q,disableKeyboardA11y:J}){let q=E1(),{width:U,height:G,transformString:Z,userSelectionActive:F}=S1(QG,b1),X=G_(),Y=d.useRef(null);d.useEffect(()=>{if(!J)Y.current?.focus({preventScroll:!0})},[J]);let K=!F&&U!==null&&G!==null;if(U_({nodeRef:Y,disabled:!K}),!K)return null;let H=_?(z)=>{let W=q.getState().nodes.filter((I)=>I.selected);_(z,W)}:void 0,L=(z)=>{if(Object.prototype.hasOwnProperty.call(l4,z.key))z.preventDefault(),X({direction:l4[z.key],factor:z.shiftKey?4:1})};return i.jsx("div",{className:c1(["react-flow__nodesselection","react-flow__container",Q]),style:{transform:Z},children:i.jsx("div",{ref:Y,className:"react-flow__nodesselection-rect",onContextMenu:H,tabIndex:J?void 0:-1,onKeyDown:J?void 0:L,style:{width:U,height:G}})})}var D9=typeof window<"u"?window:void 0,$G=(_)=>{return{nodesSelectionActive:_.nodesSelectionActive,userSelectionActive:_.userSelectionActive}};function F_({children:_,onPaneClick:Q,onPaneMouseEnter:J,onPaneMouseMove:q,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:Z,paneClickDistance:F,deleteKeyCode:X,selectionKeyCode:Y,selectionOnDrag:K,selectionMode:H,onSelectionStart:L,onSelectionEnd:z,multiSelectionKeyCode:W,panActivationKeyCode:I,zoomActivationKeyCode:R,elementsSelectable:A,zoomOnScroll:N,zoomOnPinch:B,panOnScroll:T,panOnScrollSpeed:O,panOnScrollMode:C,zoomOnDoubleClick:f,panOnDrag:S,autoPanOnSelection:w,defaultViewport:k,translateExtent:E,minZoom:l,maxZoom:c,preventScrolling:y,onSelectionContextMenu:D,noWheelClassName:v,noPanClassName:x,disableKeyboardA11y:V,onViewportChange:b,isControlledViewport:P}){let{nodesSelectionActive:j,userSelectionActive:m}=S1($G,b1),h=i5(Y,{target:D9}),o=i5(I,{target:D9}),e=o||S,s=o||T,t=K&&e!==!0,p=h||m||t;return uU({deleteKeyCode:X,multiSelectionKeyCode:W}),i.jsx(bU,{onPaneContextMenu:G,elementsSelectable:A,zoomOnScroll:N,zoomOnPinch:B,panOnScroll:s,panActivationKeyPressed:o,panOnScrollSpeed:O,panOnScrollMode:C,zoomOnDoubleClick:f,panOnDrag:!h&&e,defaultViewport:k,translateExtent:E,minZoom:l,maxZoom:c,zoomActivationKeyCode:R,preventScrolling:y,noWheelClassName:v,noPanClassName:x,onViewportChange:b,isControlledViewport:P,paneClickDistance:F,selectionOnDrag:t,children:i.jsxs(gU,{onSelectionStart:L,onSelectionEnd:z,onPaneClick:Q,onPaneMouseEnter:J,onPaneMouseMove:q,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:Z,panOnDrag:e,autoPanOnSelection:w,isSelecting:!!p,selectionMode:H,selectionKeyPressed:h,paneClickDistance:F,selectionOnDrag:t,children:[_,j&&i.jsx(JG,{onSelectionContextMenu:D,noPanClassName:x,disableKeyboardA11y:V})]})})}F_.displayName="FlowRenderer";var qG=d.memo(F_),UG=(_)=>(Q)=>{return _?S4(Q.nodeLookup,{x:0,y:0,width:Q.width,height:Q.height},Q.transform,!0).map((J)=>J.id):Array.from(Q.nodeLookup.keys())};function GG(_){return S1(d.useCallback(UG(_),[_]),b1)}var ZG=(_)=>_.updateNodeInternals;function FG(){let _=S1(ZG),[Q]=d.useState(()=>{if(typeof ResizeObserver>"u")return null;return new ResizeObserver((J)=>{let q=new Map;J.forEach((U)=>{let G=U.target.getAttribute("data-id");q.set(G,{id:G,nodeElement:U.target,force:!0})}),_(q)})});return d.useEffect(()=>{return()=>{Q?.disconnect()}},[Q]),Q}function HG({node:_,nodeType:Q,hasDimensions:J,resizeObserver:q}){let U=E1(),G=d.useRef(null),Z=d.useRef(null),F=d.useRef(_.sourcePosition),X=d.useRef(_.targetPosition),Y=d.useRef(Q),K=J&&!!_.internals.handleBounds;return d.useEffect(()=>{if(G.current&&!_.hidden&&(!K||Z.current!==G.current)){if(Z.current)q?.unobserve(Z.current);q?.observe(G.current),Z.current=G.current}},[K,_.hidden]),d.useEffect(()=>{return()=>{if(Z.current)q?.unobserve(Z.current),Z.current=null}},[]),d.useEffect(()=>{if(G.current){let H=Y.current!==Q,L=F.current!==_.sourcePosition,z=X.current!==_.targetPosition;if(H||L||z)Y.current=Q,F.current=_.sourcePosition,X.current=_.targetPosition,U.getState().updateNodeInternals(new Map([[_.id,{id:_.id,nodeElement:G.current,force:!0}]]))}},[_.id,Q,_.sourcePosition,_.targetPosition]),G}function XG({id:_,onClick:Q,onMouseEnter:J,onMouseMove:q,onMouseLeave:U,onContextMenu:G,onDoubleClick:Z,nodesDraggable:F,elementsSelectable:X,nodesConnectable:Y,nodesFocusable:K,resizeObserver:H,noDragClassName:L,noPanClassName:z,disableKeyboardA11y:W,rfId:I,nodeTypes:R,nodeClickDistance:A,onError:N}){let{node:B,internals:T,isParent:O}=S1((p)=>{let n=p.nodeLookup.get(_),J1=p.parentLookup.has(_);return{node:n,internals:n.internals,isParent:J1}},b1),C=B.type||"default",f=R?.[C]||h9[C];if(f===void 0)N?.("003",X0.error003(C)),C="default",f=R?.default||h9.default;let S=!!(B.draggable||F&&typeof B.draggable>"u"),w=!!(B.selectable||X&&typeof B.selectable>"u"),k=!!(B.connectable||Y&&typeof B.connectable>"u"),E=!!(B.focusable||K&&typeof B.focusable>"u"),l=E1(),c=c6(B),y=HG({node:B,nodeType:C,hasDimensions:c,resizeObserver:H}),D=U_({nodeRef:y,disabled:B.hidden||!S,noDragClassName:L,handleSelector:B.dragHandle,nodeId:_,isSelectable:w,nodeClickDistance:A}),v=G_();if(B.hidden)return null;let x=I0(B),V=_G(B),b=w||S||Q||J||q||U,P=J?(p)=>J(p,{...T.userNode}):void 0,j=q?(p)=>q(p,{...T.userNode}):void 0,m=U?(p)=>U(p,{...T.userNode}):void 0,h=G?(p)=>G(p,{...T.userNode}):void 0,o=Z?(p)=>Z(p,{...T.userNode}):void 0,e=(p)=>{let{selectNodesOnDrag:n,nodeDragThreshold:J1}=l.getState();if(w&&(!n||!S||J1>0))G8({id:_,store:l,nodeRef:y});if(Q)Q(p,{...T.userNode})},s=(p)=>{if(a6(p.nativeEvent)||W)return;if(V6.includes(p.key)&&w){let n=p.key==="Escape";G8({id:_,store:l,unselect:n,nodeRef:y})}else if(S&&B.selected&&Object.prototype.hasOwnProperty.call(l4,p.key)){p.preventDefault();let{ariaLabelConfig:n}=l.getState();l.setState({ariaLiveMessage:n["node.a11yDescription.ariaLiveMessage"]({direction:p.key.replace("Arrow","").toLowerCase(),x:~~T.positionAbsolute.x,y:~~T.positionAbsolute.y})}),v({direction:l4[p.key],factor:p.shiftKey?4:1})}},t=()=>{if(W||!y.current?.matches(":focus-visible"))return;let{transform:p,width:n,height:J1,autoPanOnNodeFocus:q1,setCenter:F1}=l.getState();if(!q1)return;if(!(S4(new Map([[_,B]]),{x:0,y:0,width:n,height:J1},p,!0).length>0))F1(B.position.x+x.width/2,B.position.y+x.height/2,{zoom:p[2]})};return i.jsx("div",{className:c1(["react-flow__node",`react-flow__node-${C}`,{[z]:S},B.className,{selected:B.selected,selectable:w,parent:O,draggable:S,dragging:D}]),ref:y,style:{zIndex:T.z,transform:`translate(${T.positionAbsolute.x}px,${T.positionAbsolute.y}px)`,pointerEvents:b?"all":"none",visibility:c?"visible":"hidden",...B.style,...V},"data-id":_,"data-testid":`rf__node-${_}`,onMouseEnter:P,onMouseMove:j,onMouseLeave:m,onContextMenu:h,onClick:e,onDoubleClick:o,onKeyDown:E?s:void 0,tabIndex:E?0:void 0,onFocus:E?t:void 0,role:B.ariaRole??(E?"group":void 0),"aria-roledescription":"node","aria-describedby":W?void 0:`${o9}-${I}`,"aria-label":B.ariaLabel,...B.domAttributes,children:i.jsx(cU,{value:_,children:i.jsx(f,{id:_,data:B.data,type:C,positionAbsoluteX:T.positionAbsolute.x,positionAbsoluteY:T.positionAbsolute.y,selected:B.selected??!1,selectable:w,draggable:S,deletable:B.deletable??!0,isConnectable:k,sourcePosition:B.sourcePosition,targetPosition:B.targetPosition,dragging:D,dragHandle:B.dragHandle,zIndex:T.z,parentId:B.parentId,...x})})})}var KG=d.memo(XG),YG=(_)=>({nodesConnectable:_.nodesConnectable,nodesFocusable:_.nodesFocusable,elementsSelectable:_.elementsSelectable,onError:_.onError});function H_(_){let{nodesConnectable:Q,nodesFocusable:J,elementsSelectable:q,onError:U}=S1(YG,b1),G=GG(_.onlyRenderVisibleElements),Z=FG();return i.jsx("div",{className:"react-flow__nodes",style:i4,children:G.map((F)=>{return i.jsx(KG,{id:F,nodeTypes:_.nodeTypes,nodeExtent:_.nodeExtent,onClick:_.onNodeClick,onMouseEnter:_.onNodeMouseEnter,onMouseMove:_.onNodeMouseMove,onMouseLeave:_.onNodeMouseLeave,onContextMenu:_.onNodeContextMenu,onDoubleClick:_.onNodeDoubleClick,noDragClassName:_.noDragClassName,noPanClassName:_.noPanClassName,rfId:_.rfId,disableKeyboardA11y:_.disableKeyboardA11y,resizeObserver:Z,nodesDraggable:_.nodesDraggable??!0,nodesConnectable:Q,nodesFocusable:J,elementsSelectable:q,nodeClickDistance:_.nodeClickDistance,onError:U},F)})})}H_.displayName="NodeRenderer";var LG=d.memo(H_);function zG(_){return S1(d.useCallback((J)=>{if(!_)return J.edges.map((U)=>U.id);let q=[];if(J.width&&J.height)for(let U of J.edges){let G=J.nodeLookup.get(U.source),Z=J.nodeLookup.get(U.target);if(G&&Z&&g7({sourceNode:G,targetNode:Z,width:J.width,height:J.height,transform:J.transform}))q.push(U.id)}return q},[_]),b1)}var WG=({color:_="none",strokeWidth:Q=1})=>{let J={strokeWidth:Q,..._&&{stroke:_}};return i.jsx("polyline",{className:"arrow",style:J,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},AG=({color:_="none",strokeWidth:Q=1})=>{let J={strokeWidth:Q,..._&&{stroke:_,fill:_}};return i.jsx("polyline",{className:"arrowclosed",style:J,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},b9={[J5.Arrow]:WG,[J5.ArrowClosed]:AG};function BG(_){let Q=E1();return d.useMemo(()=>{if(!Object.prototype.hasOwnProperty.call(b9,_))return Q.getState().onError?.("009",X0.error009(_)),null;return b9[_]},[_])}var MG=({id:_,type:Q,color:J,width:q=12.5,height:U=12.5,markerUnits:G="strokeWidth",strokeWidth:Z,orient:F="auto-start-reverse"})=>{let X=BG(Q);if(!X)return null;return i.jsx("marker",{className:"react-flow__arrowhead",id:_,markerWidth:`${q}`,markerHeight:`${U}`,viewBox:"-10 -10 20 20",markerUnits:G,orient:F,refX:"0",refY:"0",children:i.jsx(X,{color:J,strokeWidth:Z})})},X_=({defaultColor:_,rfId:Q})=>{let J=S1((G)=>G.edges),q=S1((G)=>G.defaultEdgeOptions),U=d.useMemo(()=>{return l7(J,{id:Q,defaultColor:_,defaultMarkerStart:q?.markerStart,defaultMarkerEnd:q?.markerEnd})},[J,q,Q,_]);if(!U.length)return null;return i.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:i.jsx("defs",{children:U.map((G)=>i.jsx(MG,{id:G.id,type:G.type,color:G.color,width:G.width,height:G.height,markerUnits:G.markerUnits,strokeWidth:G.strokeWidth,orient:G.orient},G.id))})})};X_.displayName="MarkerDefinitions";var TG=d.memo(X_);function K_({x:_,y:Q,label:J,labelStyle:q,labelShowBg:U=!0,labelBgStyle:G,labelBgPadding:Z=[2,4],labelBgBorderRadius:F=2,children:X,className:Y,...K}){let[H,L]=d.useState({x:1,y:0,width:0,height:0}),z=c1(["react-flow__edge-textwrapper",Y]),W=d.useRef(null);if(d.useEffect(()=>{if(W.current){let I=W.current.getBBox();L({x:I.x,y:I.y,width:I.width,height:I.height})}},[J]),!J)return null;return i.jsxs("g",{transform:`translate(${_-H.width/2} ${Q-H.height/2})`,className:z,visibility:H.width?"visible":"hidden",...K,children:[U&&i.jsx("rect",{width:H.width+2*Z[0],x:-Z[0],y:-Z[1],height:H.height+2*Z[1],className:"react-flow__edge-textbg",style:G,rx:F,ry:F}),i.jsx("text",{className:"react-flow__edge-text",y:H.height/2,dy:"0.3em",ref:W,style:q,children:J}),X]})}K_.displayName="EdgeText";var RG=d.memo(K_);function d4({path:_,labelX:Q,labelY:J,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:X,interactionWidth:Y=20,...K}){return i.jsxs(i.Fragment,{children:[i.jsx("path",{...K,d:_,fill:"none",className:c1(["react-flow__edge-path",K.className])}),Y?i.jsx("path",{d:_,fill:"none",strokeOpacity:0,strokeWidth:Y,className:"react-flow__edge-interaction"}):null,q&&R0(Q)&&R0(J)?i.jsx(RG,{x:Q,y:J,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:X}):null]})}function E9({pos:_,x1:Q,y1:J,x2:q,y2:U}){if(_===X1.Left||_===X1.Right)return[0.5*(Q+q),J];return[Q,0.5*(J+U)]}function Y_({sourceX:_,sourceY:Q,sourcePosition:J=X1.Bottom,targetX:q,targetY:U,targetPosition:G=X1.Top}){let[Z,F]=E9({pos:J,x1:_,y1:Q,x2:q,y2:U}),[X,Y]=E9({pos:G,x1:q,y1:U,x2:_,y2:Q}),[K,H,L,z]=V4({sourceX:_,sourceY:Q,targetX:q,targetY:U,sourceControlX:Z,sourceControlY:F,targetControlX:X,targetControlY:Y});return[`M${_},${Q} C${Z},${F} ${X},${Y} ${q},${U}`,K,H,L,z]}function L_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,sourcePosition:Z,targetPosition:F,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:I,markerStart:R,interactionWidth:A})=>{let[N,B,T]=Y_({sourceX:J,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F}),O=_.isInternal?void 0:Q;return i.jsx(d4,{id:O,path:N,labelX:B,labelY:T,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:I,markerStart:R,interactionWidth:A})})}var OG=L_({isInternal:!1}),z_=L_({isInternal:!0});OG.displayName="SimpleBezierEdge";z_.displayName="SimpleBezierEdgeInternal";function W_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,sourcePosition:z=X1.Bottom,targetPosition:W=X1.Top,markerEnd:I,markerStart:R,pathOptions:A,interactionWidth:N})=>{let[B,T,O]=r5({sourceX:J,sourceY:q,sourcePosition:z,targetX:U,targetY:G,targetPosition:W,borderRadius:A?.borderRadius,offset:A?.offset,stepPosition:A?.stepPosition}),C=_.isInternal?void 0:Q;return i.jsx(d4,{id:C,path:B,labelX:T,labelY:O,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:I,markerStart:R,interactionWidth:N})})}var A_=W_({isInternal:!1}),B_=W_({isInternal:!0});A_.displayName="SmoothStepEdge";B_.displayName="SmoothStepEdgeInternal";function M_(_){return d.memo(({id:Q,...J})=>{let q=_.isInternal?void 0:Q;return i.jsx(A_,{...J,id:q,pathOptions:d.useMemo(()=>({borderRadius:0,offset:J.pathOptions?.offset}),[J.pathOptions?.offset])})})}var IG=M_({isInternal:!1}),T_=M_({isInternal:!0});IG.displayName="StepEdge";T_.displayName="StepEdgeInternal";function R_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:z,markerStart:W,interactionWidth:I})=>{let[R,A,N]=h4({sourceX:J,sourceY:q,targetX:U,targetY:G}),B=_.isInternal?void 0:Q;return i.jsx(d4,{id:B,path:R,labelX:A,labelY:N,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:z,markerStart:W,interactionWidth:I})})}var PG=R_({isInternal:!1}),O_=R_({isInternal:!0});PG.displayName="StraightEdge";O_.displayName="StraightEdgeInternal";function I_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,sourcePosition:Z=X1.Bottom,targetPosition:F=X1.Top,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:I,markerStart:R,pathOptions:A,interactionWidth:N})=>{let[B,T,O]=u4({sourceX:J,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F,curvature:A?.curvature}),C=_.isInternal?void 0:Q;return i.jsx(d4,{id:C,path:B,labelX:T,labelY:O,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:I,markerStart:R,interactionWidth:N})})}var NG=I_({isInternal:!1}),P_=I_({isInternal:!0});NG.displayName="BezierEdge";P_.displayName="BezierEdgeInternal";var x9={default:P_,straight:O_,step:T_,smoothstep:B_,simplebezier:z_},m9={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},wG=(_,Q,J)=>{if(J===X1.Left)return _-Q;if(J===X1.Right)return _+Q;return _},fG=(_,Q,J)=>{if(J===X1.Top)return _-Q;if(J===X1.Bottom)return _+Q;return _},g9="react-flow__edgeupdater";function p9({position:_,centerX:Q,centerY:J,radius:q=10,onMouseDown:U,onMouseEnter:G,onMouseOut:Z,type:F}){return i.jsx("circle",{onMouseDown:U,onMouseEnter:G,onMouseOut:Z,className:c1([g9,`${g9}-${F}`]),cx:wG(Q,q,_),cy:fG(J,q,_),r:q,stroke:"transparent",fill:"transparent"})}function CG({isReconnectable:_,reconnectRadius:Q,edge:J,sourceX:q,sourceY:U,targetX:G,targetY:Z,sourcePosition:F,targetPosition:X,onReconnect:Y,onReconnectStart:K,onReconnectEnd:H,setReconnecting:L,setUpdateHover:z}){let W=E1(),I=(T,O)=>{if(T.button!==0)return;let{autoPanOnConnect:C,domNode:f,connectionMode:S,connectionRadius:w,lib:k,onConnectStart:E,cancelConnection:l,nodeLookup:c,rfId:y,panBy:D,updateConnection:v}=W.getState(),x=O.type==="target",V=(j,m)=>{L(!1),H?.(j,J,O.type,m)},b=(j)=>Y?.(J,j),P=(j,m)=>{L(!0),K?.(T,J,O.type),E?.(j,m)};x4.onPointerDown(T.nativeEvent,{autoPanOnConnect:C,connectionMode:S,connectionRadius:w,domNode:f,handleId:O.id,nodeId:O.nodeId,nodeLookup:c,isTarget:x,edgeUpdaterType:O.type,lib:k,flowId:y,cancelConnection:l,panBy:D,isValidConnection:(...j)=>W.getState().isValidConnection?.(...j)??!0,onConnect:b,onConnectStart:P,onConnectEnd:(...j)=>W.getState().onConnectEnd?.(...j),onReconnectEnd:V,updateConnection:v,getTransform:()=>W.getState().transform,getFromHandle:()=>W.getState().connection.fromHandle,dragThreshold:W.getState().connectionDragThreshold,handleDomNode:T.currentTarget})},R=(T)=>I(T,{nodeId:J.target,id:J.targetHandle??null,type:"target"}),A=(T)=>I(T,{nodeId:J.source,id:J.sourceHandle??null,type:"source"}),N=()=>z(!0),B=()=>z(!1);return i.jsxs(i.Fragment,{children:[(_===!0||_==="source")&&i.jsx(p9,{position:F,centerX:q,centerY:U,radius:Q,onMouseDown:R,onMouseEnter:N,onMouseOut:B,type:"source"}),(_===!0||_==="target")&&i.jsx(p9,{position:X,centerX:G,centerY:Z,radius:Q,onMouseDown:A,onMouseEnter:N,onMouseOut:B,type:"target"})]})}function SG({id:_,edgesFocusable:Q,edgesReconnectable:J,elementsSelectable:q,onClick:U,onDoubleClick:G,onContextMenu:Z,onMouseEnter:F,onMouseMove:X,onMouseLeave:Y,reconnectRadius:K,onReconnect:H,onReconnectStart:L,onReconnectEnd:z,rfId:W,edgeTypes:I,noPanClassName:R,onError:A,disableKeyboardA11y:N}){let B=S1((F1)=>F1.edgeLookup.get(_)),T=S1((F1)=>F1.defaultEdgeOptions);B=T?{...T,...B}:B;let O=B.type||"default",C=I?.[O]||x9[O];if(C===void 0)A?.("011",X0.error011(O)),O="default",C=I?.default||x9.default;let f=!!(B.focusable||Q&&typeof B.focusable>"u"),S=typeof H<"u"&&(B.reconnectable||J&&typeof B.reconnectable>"u"),w=!!(B.selectable||q&&typeof B.selectable>"u"),k=d.useRef(null),[E,l]=d.useState(!1),[c,y]=d.useState(!1),D=E1(),{zIndex:v=B.zIndex,sourceX:x,sourceY:V,targetX:b,targetY:P,sourcePosition:j,targetPosition:m}=S1(d.useCallback((F1)=>{let Z1=F1.nodeLookup.get(B.source),T1=F1.nodeLookup.get(B.target);if(!Z1||!T1)return m9;let L1=c7({id:_,sourceNode:Z1,targetNode:T1,sourceHandle:B.sourceHandle||null,targetHandle:B.targetHandle||null,connectionMode:F1.connectionMode,onError:A}),_1=m7({selected:B.selected,zIndex:B.zIndex,sourceNode:Z1,targetNode:T1,elevateOnSelect:F1.elevateEdgesOnSelect,zIndexMode:F1.zIndexMode});return{...L1||m9,zIndex:_1}},[B.source,B.target,B.sourceHandle,B.targetHandle,B.selected,B.zIndex,A]),b1),h=d.useMemo(()=>B.markerStart?`url('#${D4(B.markerStart,W)}')`:void 0,[B.markerStart,W]),o=d.useMemo(()=>B.markerEnd?`url('#${D4(B.markerEnd,W)}')`:void 0,[B.markerEnd,W]);if(B.hidden||x===null||V===null||b===null||P===null)return null;let e=(F1)=>{let{addSelectedEdges:Z1,unselectNodesAndEdges:T1,multiSelectionActive:L1}=D.getState();if(w)if(D.setState({nodesSelectionActive:!1}),B.selected&&L1)T1({nodes:[],edges:[B]}),k.current?.blur();else Z1([_]);if(U)U(F1,B)},s=G?(F1)=>{G(F1,{...B})}:void 0,t=Z?(F1)=>{Z(F1,{...B})}:void 0,p=F?(F1)=>{F(F1,{...B})}:void 0,n=X?(F1)=>{X(F1,{...B})}:void 0,J1=Y?(F1)=>{Y(F1,{...B})}:void 0,q1=(F1)=>{if(!N&&V6.includes(F1.key)&&w){let{unselectNodesAndEdges:Z1,addSelectedEdges:T1}=D.getState();if(F1.key==="Escape")k.current?.blur(),Z1({edges:[B]});else T1([_])}};return i.jsx("svg",{style:{zIndex:v},children:i.jsxs("g",{className:c1(["react-flow__edge",`react-flow__edge-${O}`,B.className,R,{selected:B.selected,animated:B.animated,inactive:!w&&!U,updating:E,selectable:w}]),onClick:e,onDoubleClick:s,onContextMenu:t,onMouseEnter:p,onMouseMove:n,onMouseLeave:J1,onKeyDown:f?q1:void 0,tabIndex:f?0:void 0,role:B.ariaRole??(f?"group":"img"),"aria-roledescription":"edge","data-id":_,"data-testid":`rf__edge-${_}`,"aria-label":B.ariaLabel===null?void 0:B.ariaLabel||`Edge from ${B.source} to ${B.target}`,"aria-describedby":f?`${n9}-${W}`:void 0,ref:k,...B.domAttributes,children:[!c&&i.jsx(C,{id:_,source:B.source,target:B.target,type:B.type,selected:B.selected,animated:B.animated,selectable:w,deletable:B.deletable??!0,label:B.label,labelStyle:B.labelStyle,labelShowBg:B.labelShowBg,labelBgStyle:B.labelBgStyle,labelBgPadding:B.labelBgPadding,labelBgBorderRadius:B.labelBgBorderRadius,sourceX:x,sourceY:V,targetX:b,targetY:P,sourcePosition:j,targetPosition:m,data:B.data,style:B.style,sourceHandleId:B.sourceHandle,targetHandleId:B.targetHandle,markerStart:h,markerEnd:o,pathOptions:"pathOptions"in B?B.pathOptions:void 0,interactionWidth:B.interactionWidth}),S&&i.jsx(CG,{edge:B,isReconnectable:S,reconnectRadius:K,onReconnect:H,onReconnectStart:L,onReconnectEnd:z,sourceX:x,sourceY:V,targetX:b,targetY:P,sourcePosition:j,targetPosition:m,setUpdateHover:l,setReconnecting:y})]})})}var yG=d.memo(SG),kG=(_)=>({edgesFocusable:_.edgesFocusable,edgesReconnectable:_.edgesReconnectable,elementsSelectable:_.elementsSelectable,connectionMode:_.connectionMode,onError:_.onError});function N_({defaultMarkerColor:_,onlyRenderVisibleElements:Q,rfId:J,edgeTypes:q,noPanClassName:U,onReconnect:G,onEdgeContextMenu:Z,onEdgeMouseEnter:F,onEdgeMouseMove:X,onEdgeMouseLeave:Y,onEdgeClick:K,reconnectRadius:H,onEdgeDoubleClick:L,onReconnectStart:z,onReconnectEnd:W,disableKeyboardA11y:I}){let{edgesFocusable:R,edgesReconnectable:A,elementsSelectable:N,onError:B}=S1(kG,b1),T=zG(Q);return i.jsxs("div",{className:"react-flow__edges",children:[i.jsx(TG,{defaultColor:_,rfId:J}),T.map((O)=>{return i.jsx(yG,{id:O,edgesFocusable:R,edgesReconnectable:A,elementsSelectable:N,noPanClassName:U,onReconnect:G,onContextMenu:Z,onMouseEnter:F,onMouseMove:X,onMouseLeave:Y,onClick:K,reconnectRadius:H,onDoubleClick:L,onReconnectStart:z,onReconnectEnd:W,rfId:J,onError:B,edgeTypes:q,disableKeyboardA11y:I},O)})]})}N_.displayName="EdgeRenderer";var vG=d.memo(N_),c9=(_)=>`translate(${_[0]}px,${_[1]}px) scale(${_[2]})`;function jG({children:_}){let Q=E1(),J=d.useRef(null),[q]=d.useState(()=>Q.getState().transform);return $_(()=>{let U=null,G=()=>{let Z=Q.getState().transform;if(U&&Z[0]===U[0]&&Z[1]===U[1]&&Z[2]===U[2])return;if(U=Z,J.current)J.current.style.transform=c9(Z)};return G(),Q.subscribe(G)},[Q]),i.jsx("div",{ref:J,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:c9(q)},children:_})}function VG(_){let Q=d5(),J=d.useRef(!1);d.useEffect(()=>{if(!J.current&&Q.viewportInitialized&&_)setTimeout(()=>_(Q),1),J.current=!0},[_,Q.viewportInitialized])}var uG=(_)=>_.panZoom?.syncViewport;function hG(_){let Q=S1(uG),J=E1();return d.useEffect(()=>{if(_)Q?.(_),J.setState({transform:[_.x,_.y,_.zoom]})},[_,Q]),null}function l9(_){return _.connection.inProgress?{..._.connection,to:Z5(_.connection.to,_.transform)}:{..._.connection}}function DG(_){if(_)return(J)=>{let q=l9(J);return _(q)};return l9}function bG(_){let Q=DG(_);return S1(Q,b1)}var EG=(_)=>({nodesConnectable:_.nodesConnectable,isValid:_.connection.isValid,inProgress:_.connection.inProgress,width:_.width,height:_.height});function xG({containerStyle:_,style:Q,type:J,component:q}){let{nodesConnectable:U,width:G,height:Z,isValid:F,inProgress:X}=S1(EG,b1);if(!(G&&U&&X))return null;return i.jsx("svg",{style:_,width:G,height:Z,className:"react-flow__connectionline react-flow__container",children:i.jsx("g",{className:c1(["react-flow__connection",i6(F)]),children:i.jsx(w_,{style:Q,type:J,CustomComponent:q,isValid:F})})})}var w_=({style:_,type:Q=x0.Bezier,CustomComponent:J,isValid:q})=>{let{inProgress:U,from:G,fromNode:Z,fromHandle:F,fromPosition:X,to:Y,toNode:K,toHandle:H,toPosition:L,pointer:z}=bG();if(!U)return;if(J)return i.jsx(J,{connectionLineType:Q,connectionLineStyle:_,fromNode:Z,fromHandle:F,fromX:G.x,fromY:G.y,toX:Y.x,toY:Y.y,fromPosition:X,toPosition:L,connectionStatus:i6(q),toNode:K,toHandle:H,pointer:z});let W="",I={sourceX:G.x,sourceY:G.y,sourcePosition:X,targetX:Y.x,targetY:Y.y,targetPosition:L};switch(Q){case x0.Bezier:[W]=u4(I);break;case x0.SimpleBezier:[W]=Y_(I);break;case x0.Step:[W]=r5({...I,borderRadius:0});break;case x0.SmoothStep:[W]=r5(I);break;default:[W]=h4(I)}return i.jsx("path",{d:W,fill:"none",className:"react-flow__connection-path",style:_})};w_.displayName="ConnectionLine";var mG={};function r9(_=mG){let Q=d.useRef(_),J=E1();d.useEffect(()=>{{let q=new Set([...Object.keys(Q.current),...Object.keys(_)]);for(let U of q)if(Q.current[U]!==_[U]){J.getState().onError?.("002",X0.error002());break}Q.current=_}},[_])}function gG(){let _=E1(),Q=d.useRef(!1);d.useEffect(()=>{if(!Q.current){let J=document.querySelector(".react-flow__pane");if(J&&window.getComputedStyle(J).zIndex!=="1")_.getState().onError?.("013",X0.error013("react"));Q.current=!0}},[])}function f_({nodeTypes:_,edgeTypes:Q,onInit:J,onNodeClick:q,onEdgeClick:U,onNodeDoubleClick:G,onEdgeDoubleClick:Z,onNodeMouseEnter:F,onNodeMouseMove:X,onNodeMouseLeave:Y,onNodeContextMenu:K,onSelectionContextMenu:H,onSelectionStart:L,onSelectionEnd:z,connectionLineType:W,connectionLineStyle:I,connectionLineComponent:R,connectionLineContainerStyle:A,selectionKeyCode:N,selectionOnDrag:B,selectionMode:T,multiSelectionKeyCode:O,panActivationKeyCode:C,zoomActivationKeyCode:f,deleteKeyCode:S,onlyRenderVisibleElements:w,elementsSelectable:k,defaultViewport:E,translateExtent:l,minZoom:c,maxZoom:y,preventScrolling:D,defaultMarkerColor:v,zoomOnScroll:x,zoomOnPinch:V,panOnScroll:b,panOnScrollSpeed:P,panOnScrollMode:j,zoomOnDoubleClick:m,panOnDrag:h,autoPanOnSelection:o,onPaneClick:e,onPaneMouseEnter:s,onPaneMouseMove:t,onPaneMouseLeave:p,onPaneScroll:n,onPaneContextMenu:J1,paneClickDistance:q1,nodeClickDistance:F1,onEdgeContextMenu:Z1,onEdgeMouseEnter:T1,onEdgeMouseMove:L1,onEdgeMouseLeave:_1,reconnectRadius:W1,onReconnect:K1,onReconnectStart:p1,onReconnectEnd:s1,noDragClassName:a1,noWheelClassName:j0,noPanClassName:K0,disableKeyboardA11y:T0,nodeExtent:Q0,rfId:e1,viewport:F0,onViewportChange:W0,nodesDraggable:r0}){return r9(_),r9(Q),gG(),VG(J),hG(F0),i.jsx(qG,{onPaneClick:e,onPaneMouseEnter:s,onPaneMouseMove:t,onPaneMouseLeave:p,onPaneContextMenu:J1,onPaneScroll:n,paneClickDistance:q1,deleteKeyCode:S,selectionKeyCode:N,selectionOnDrag:B,selectionMode:T,onSelectionStart:L,onSelectionEnd:z,multiSelectionKeyCode:O,panActivationKeyCode:C,zoomActivationKeyCode:f,elementsSelectable:k,zoomOnScroll:x,zoomOnPinch:V,zoomOnDoubleClick:m,panOnScroll:b,panOnScrollSpeed:P,panOnScrollMode:j,panOnDrag:h,autoPanOnSelection:o,defaultViewport:E,translateExtent:l,minZoom:c,maxZoom:y,onSelectionContextMenu:H,preventScrolling:D,noDragClassName:a1,noWheelClassName:j0,noPanClassName:K0,disableKeyboardA11y:T0,onViewportChange:W0,isControlledViewport:!!F0,children:i.jsxs(jG,{children:[i.jsx(vG,{edgeTypes:Q,onEdgeClick:U,onEdgeDoubleClick:Z,onReconnect:K1,onReconnectStart:p1,onReconnectEnd:s1,onlyRenderVisibleElements:w,onEdgeContextMenu:Z1,onEdgeMouseEnter:T1,onEdgeMouseMove:L1,onEdgeMouseLeave:_1,reconnectRadius:W1,defaultMarkerColor:v,noPanClassName:K0,disableKeyboardA11y:T0,rfId:e1}),i.jsx(xG,{style:I,type:W,component:R,containerStyle:A}),i.jsx("div",{className:"react-flow__edgelabel-renderer"}),i.jsx(LG,{nodeTypes:_,onNodeClick:q,onNodeDoubleClick:G,onNodeMouseEnter:F,onNodeMouseMove:X,onNodeMouseLeave:Y,onNodeContextMenu:K,nodeClickDistance:F1,onlyRenderVisibleElements:w,noPanClassName:K0,noDragClassName:a1,disableKeyboardA11y:T0,nodeExtent:Q0,rfId:e1,nodesDraggable:r0}),i.jsx("div",{className:"react-flow__viewport-portal"})]})})}f_.displayName="GraphView";var pG=d.memo(f_),cG=p6("React Flow","https://reactflow.dev/"),i9=({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X=0.5,maxZoom:Y=2,nodeOrigin:K,nodeExtent:H,zIndexMode:L="basic"}={})=>{let z=new Map,W=new Map,I=new Map,R=new Map,A=q??Q??[],N=J??_??[],B=K??[0,0],T=H??q5;Q8(I,R,A);let{nodesInitialized:O}=b4(N,z,W,{nodeOrigin:B,nodeExtent:T,zIndexMode:L}),C=[0,0,1];if(Z&&U&&G){let f=V2(z,{filter:(E)=>!!((E.width||E.initialWidth)&&(E.height||E.initialHeight))}),{x:S,y:w,zoom:k}=l5(f,U,G,X,Y,F?.padding??0.1);C=[S,w,k]}return{rfId:"1",width:U??0,height:G??0,transform:C,nodes:N,nodesInitialized:O,nodeLookup:z,parentLookup:W,edges:A,edgeLookup:R,connectionLookup:I,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:J!==void 0,hasDefaultEdges:q!==void 0,panZoom:null,minZoom:X,maxZoom:Y,translateExtent:q5,nodeExtent:T,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:L2.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:B,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:Z??!1,fitViewOptions:F,fitViewResolver:null,connection:{...h6},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:cG,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:u6,zIndexMode:L,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},lG=({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X,maxZoom:Y,nodeOrigin:K,nodeExtent:H,zIndexMode:L})=>M9((z,W)=>{async function I(){let{nodeLookup:R,panZoom:A,fitViewOptions:N,fitViewResolver:B,width:T,height:O,minZoom:C,maxZoom:f}=W();if(!A)return;await V7({nodes:R,width:T,height:O,panZoom:A,minZoom:C,maxZoom:f},N),B?.resolve(!0),z({fitViewResolver:null})}return{...i9({nodes:_,edges:Q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X,maxZoom:Y,nodeOrigin:K,nodeExtent:H,defaultNodes:J,defaultEdges:q,zIndexMode:L}),setNodes:(R)=>{let{nodeLookup:A,parentLookup:N,nodeOrigin:B,nodeExtent:T,elevateNodesOnSelect:O,fitViewQueued:C,zIndexMode:f,nodesSelectionActive:S}=W(),{nodesInitialized:w,hasSelectedNodes:k}=b4(R,A,N,{nodeOrigin:B,nodeExtent:T,elevateNodesOnSelect:O,checkEquality:!0,zIndexMode:f}),E=S&&k;if(C&&w)I(),z({nodes:R,nodesInitialized:w,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:E});else z({nodes:R,nodesInitialized:w,nodesSelectionActive:E})},setEdges:(R)=>{let{connectionLookup:A,edgeLookup:N}=W();Q8(A,N,R),z({edges:R})},setDefaultNodesAndEdges:(R,A)=>{if(R){let{setNodes:N}=W();N(R),z({hasDefaultNodes:!0})}if(A){let{setEdges:N}=W();N(A),z({hasDefaultEdges:!0})}},updateNodeInternals:(R)=>{let{triggerNodeChanges:A,nodeLookup:N,parentLookup:B,domNode:T,nodeOrigin:O,nodeExtent:C,debug:f,fitViewQueued:S,zIndexMode:w}=W(),{changes:k,updatedInternals:E}=s7(R,N,B,T,O,C,w);if(!E)return;if(d7(N,B,{nodeOrigin:O,nodeExtent:C,zIndexMode:w}),S)I(),z({fitViewQueued:!1,fitViewOptions:void 0});else z({});if(k?.length>0){if(f)console.log("React Flow: trigger node changes",k);A?.(k)}},updateNodePositions:(R,A=!1)=>{let N=[],B=[],{nodeLookup:T,triggerNodeChanges:O,connection:C,updateConnection:f,onNodesChangeMiddlewareMap:S}=W();for(let[w,k]of R){let E=T.get(w),l=!!(E?.expandParent&&E?.parentId&&k?.position),c={id:w,type:"position",position:l?{x:Math.max(0,k.position.x),y:Math.max(0,k.position.y)}:k.position,dragging:A};if(E&&C.inProgress&&C.fromNode.id===E.id){let y=z2(E,C.fromHandle,X1.Left,!0);f({...C,from:y})}if(l&&E.parentId)N.push({id:w,parentId:E.parentId,rect:{...k.internals.positionAbsolute,width:k.measured.width??0,height:k.measured.height??0}});B.push(c)}if(N.length>0){let{parentLookup:w,nodeOrigin:k}=W(),E=E4(N,T,w,k);B.push(...E)}for(let w of S.values())B=w(B);O(B)},triggerNodeChanges:(R)=>{let{onNodesChange:A,setNodes:N,nodes:B,hasDefaultNodes:T,debug:O}=W();if(R?.length){if(T){let C=Q_(R,B);N(C)}if(O)console.log("React Flow: trigger node changes",R);A?.(R)}},triggerEdgeChanges:(R)=>{let{onEdgesChange:A,setEdges:N,edges:B,hasDefaultEdges:T,debug:O}=W();if(R?.length){if(T){let C=wU(R,B);N(C)}if(O)console.log("React Flow: trigger edge changes",R);A?.(R)}},addSelectedNodes:(R)=>{let{multiSelectionActive:A,edgeLookup:N,nodeLookup:B,triggerNodeChanges:T,triggerEdgeChanges:O}=W();if(A){let C=R.map((f)=>u2(f,!0));T(C);return}T(H5(B,new Set([...R]),!0)),O(H5(N))},addSelectedEdges:(R)=>{let{multiSelectionActive:A,edgeLookup:N,nodeLookup:B,triggerNodeChanges:T,triggerEdgeChanges:O}=W();if(A){let C=R.map((f)=>u2(f,!0));O(C);return}O(H5(N,new Set([...R]))),T(H5(B,new Set,!0))},unselectNodesAndEdges:({nodes:R,edges:A}={})=>{let{edges:N,nodes:B,nodeLookup:T,triggerNodeChanges:O,triggerEdgeChanges:C}=W(),f=R?R:B,S=A?A:N,w=[];for(let E of f){if(!E.selected)continue;let l=T.get(E.id);if(l)l.selected=!1;w.push(u2(E.id,!1))}let k=[];for(let E of S){if(!E.selected)continue;k.push(u2(E.id,!1))}O(w),C(k)},setMinZoom:(R)=>{let{panZoom:A,maxZoom:N}=W();A?.setScaleExtent([R,N]),z({minZoom:R})},setMaxZoom:(R)=>{let{panZoom:A,minZoom:N}=W();A?.setScaleExtent([N,R]),z({maxZoom:R})},setTranslateExtent:(R)=>{W().panZoom?.setTranslateExtent(R),z({translateExtent:R})},resetSelectedElements:()=>{let{edges:R,nodes:A,triggerNodeChanges:N,triggerEdgeChanges:B,elementsSelectable:T}=W();if(!T)return;let O=A.reduce((f,S)=>S.selected?[...f,u2(S.id,!1)]:f,[]),C=R.reduce((f,S)=>S.selected?[...f,u2(S.id,!1)]:f,[]);N(O),B(C)},setNodeExtent:(R)=>{let{nodes:A,nodeLookup:N,parentLookup:B,nodeOrigin:T,elevateNodesOnSelect:O,nodeExtent:C,zIndexMode:f}=W();if(R[0][0]===C[0][0]&&R[0][1]===C[0][1]&&R[1][0]===C[1][0]&&R[1][1]===C[1][1])return;b4(A,N,B,{nodeOrigin:T,nodeExtent:R,elevateNodesOnSelect:O,checkEquality:!1,zIndexMode:f}),z({nodeExtent:R})},panBy:(R)=>{let{transform:A,width:N,height:B,panZoom:T,translateExtent:O}=W();return t7({delta:R,panZoom:T,transform:A,translateExtent:O,width:N,height:B})},setCenter:async(R,A,N)=>{let{width:B,height:T,maxZoom:O,panZoom:C}=W();if(!C)return!1;let f=typeof N?.zoom<"u"?N.zoom:O;return await C.setViewport({x:B/2-R*f,y:T/2-A*f,zoom:f},{duration:N?.duration,ease:N?.ease,interpolate:N?.interpolate}),!0},cancelConnection:()=>{z({connection:{...h6}})},updateConnection:(R)=>{z({connection:R})},reset:()=>z({...i9()})}},Object.is);function H8({initialNodes:_,initialEdges:Q,defaultNodes:J,defaultEdges:q,initialWidth:U,initialHeight:G,initialMinZoom:Z,initialMaxZoom:F,initialFitViewOptions:X,fitView:Y,nodeOrigin:K,nodeExtent:H,zIndexMode:L,children:z}){let[W]=d.useState(()=>lG({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Y,minZoom:Z,maxZoom:F,fitViewOptions:X,nodeOrigin:K,nodeExtent:H,zIndexMode:L}));return i.jsx(UU,{value:W,children:i.jsx(kU,{children:i.jsx(rU,{children:z})})})}function rG({children:_,nodes:Q,edges:J,defaultNodes:q,defaultEdges:U,width:G,height:Z,fitView:F,fitViewOptions:X,minZoom:Y,maxZoom:K,nodeOrigin:H,nodeExtent:L,zIndexMode:z}){if(d.useContext(r4))return i.jsx(i.Fragment,{children:_});return i.jsx(H8,{initialNodes:Q,initialEdges:J,defaultNodes:q,defaultEdges:U,initialWidth:G,initialHeight:Z,fitView:F,initialFitViewOptions:X,initialMinZoom:Y,initialMaxZoom:K,nodeOrigin:H,nodeExtent:L,zIndexMode:z,children:_})}var iG={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function dG({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,className:U,nodeTypes:G,edgeTypes:Z,onNodeClick:F,onEdgeClick:X,onInit:Y,onMove:K,onMoveStart:H,onMoveEnd:L,onConnect:z,onConnectStart:W,onConnectEnd:I,onClickConnectStart:R,onClickConnectEnd:A,onNodeMouseEnter:N,onNodeMouseMove:B,onNodeMouseLeave:T,onNodeContextMenu:O,onNodeDoubleClick:C,onNodeDragStart:f,onNodeDrag:S,onNodeDragStop:w,onNodesDelete:k,onEdgesDelete:E,onDelete:l,onSelectionChange:c,onSelectionDragStart:y,onSelectionDrag:D,onSelectionDragStop:v,onSelectionContextMenu:x,onSelectionStart:V,onSelectionEnd:b,onBeforeDelete:P,connectionMode:j,connectionLineType:m=x0.Bezier,connectionLineStyle:h,connectionLineComponent:o,connectionLineContainerStyle:e,deleteKeyCode:s="Backspace",selectionKeyCode:t="Shift",selectionOnDrag:p=!1,selectionMode:n=y2.Full,panActivationKeyCode:J1="Space",multiSelectionKeyCode:q1=F5()?"Meta":"Control",zoomActivationKeyCode:F1=F5()?"Meta":"Control",snapToGrid:Z1,snapGrid:T1,onlyRenderVisibleElements:L1=!1,selectNodesOnDrag:_1,nodesDraggable:W1,autoPanOnNodeFocus:K1,nodesConnectable:p1,nodesFocusable:s1,nodeOrigin:a1=e9,edgesFocusable:j0,edgesReconnectable:K0,elementsSelectable:T0=!0,defaultViewport:Q0=MU,minZoom:e1=0.5,maxZoom:F0=2,translateExtent:W0=q5,preventScrolling:r0=!0,nodeExtent:w0,defaultMarkerColor:i0="#b1b1b7",zoomOnScroll:f0=!0,zoomOnPinch:G2=!0,panOnScroll:l2=!1,panOnScrollSpeed:V0=0.5,panOnScrollMode:M=o0.Free,zoomOnDoubleClick:g=!0,panOnDrag:Q1=!0,onPaneClick:$1,onPaneMouseEnter:Y1,onPaneMouseMove:P1,onPaneMouseLeave:O1,onPaneScroll:v1,onPaneContextMenu:N1,paneClickDistance:Y0=1,nodeClickDistance:u0=0,children:B2,onReconnect:r2,onReconnectStart:i2,onReconnectEnd:Q4,onEdgeContextMenu:q3,onEdgeDoubleClick:U3,onEdgeMouseEnter:u,onEdgeMouseMove:a,onEdgeMouseLeave:U1,reconnectRadius:G1=10,onNodesChange:C1,onEdgesChange:H1,noDragClassName:z1="nodrag",noWheelClassName:B1="nowheel",noPanClassName:f1="nopan",fitView:g1,fitViewOptions:I1,connectOnClick:r1,attributionPosition:h1,proOptions:z5,defaultEdgeOptions:A0,elevateNodesOnSelect:D1=!0,elevateEdgesOnSelect:CQ=!1,disableKeyboardA11y:f8=!1,autoPanOnConnect:SQ,autoPanOnNodeDrag:yQ,autoPanOnSelection:kQ=!0,autoPanSpeed:vQ,connectionRadius:jQ,isValidConnection:VQ,onError:uQ,style:hQ,id:C8,nodeDragThreshold:DQ,connectionDragThreshold:bQ,viewport:EQ,onViewportChange:xQ,width:mQ,height:gQ,colorMode:pQ="light",debug:cQ,onScroll:S8,ariaLabelConfig:lQ,zIndexMode:y8="basic",...rQ},iQ){let G3=C8||"1",dQ=IU(pQ),aQ=d.useCallback((k8)=>{k8.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),S8?.(k8)},[S8]);return i.jsx("div",{"data-testid":"rf__wrapper",...rQ,onScroll:aQ,style:{...hQ,...iG},ref:iQ,className:c1(["react-flow",U,dQ]),id:C8,role:"application",children:i.jsxs(rG,{nodes:_,edges:Q,width:mQ,height:gQ,fitView:g1,fitViewOptions:I1,minZoom:e1,maxZoom:F0,nodeOrigin:a1,nodeExtent:w0,zIndexMode:y8,children:[i.jsx(OU,{nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,onConnect:z,onConnectStart:W,onConnectEnd:I,onClickConnectStart:R,onClickConnectEnd:A,nodesDraggable:W1,autoPanOnNodeFocus:K1,nodesConnectable:p1,nodesFocusable:s1,edgesFocusable:j0,edgesReconnectable:K0,elementsSelectable:T0,elevateNodesOnSelect:D1,elevateEdgesOnSelect:CQ,minZoom:e1,maxZoom:F0,nodeExtent:w0,onNodesChange:C1,onEdgesChange:H1,snapToGrid:Z1,snapGrid:T1,connectionMode:j,translateExtent:W0,connectOnClick:r1,defaultEdgeOptions:A0,fitView:g1,fitViewOptions:I1,onNodesDelete:k,onEdgesDelete:E,onDelete:l,onNodeDragStart:f,onNodeDrag:S,onNodeDragStop:w,onSelectionDrag:D,onSelectionDragStart:y,onSelectionDragStop:v,onMove:K,onMoveStart:H,onMoveEnd:L,noPanClassName:f1,nodeOrigin:a1,rfId:G3,autoPanOnConnect:SQ,autoPanOnNodeDrag:yQ,autoPanSpeed:vQ,onError:uQ,connectionRadius:jQ,isValidConnection:VQ,selectNodesOnDrag:_1,nodeDragThreshold:DQ,connectionDragThreshold:bQ,onBeforeDelete:P,debug:cQ,ariaLabelConfig:lQ,zIndexMode:y8}),i.jsx(pG,{onInit:Y,onNodeClick:F,onEdgeClick:X,onNodeMouseEnter:N,onNodeMouseMove:B,onNodeMouseLeave:T,onNodeContextMenu:O,onNodeDoubleClick:C,nodeTypes:G,edgeTypes:Z,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:o,connectionLineContainerStyle:e,selectionKeyCode:t,selectionOnDrag:p,selectionMode:n,deleteKeyCode:s,multiSelectionKeyCode:q1,panActivationKeyCode:J1,zoomActivationKeyCode:F1,onlyRenderVisibleElements:L1,defaultViewport:Q0,translateExtent:W0,minZoom:e1,maxZoom:F0,preventScrolling:r0,zoomOnScroll:f0,zoomOnPinch:G2,zoomOnDoubleClick:g,panOnScroll:l2,panOnScrollSpeed:V0,panOnScrollMode:M,panOnDrag:Q1,autoPanOnSelection:kQ,onPaneClick:$1,onPaneMouseEnter:Y1,onPaneMouseMove:P1,onPaneMouseLeave:O1,onPaneScroll:v1,onPaneContextMenu:N1,paneClickDistance:Y0,nodeClickDistance:u0,onSelectionContextMenu:x,onSelectionStart:V,onSelectionEnd:b,onReconnect:r2,onReconnectStart:i2,onReconnectEnd:Q4,onEdgeContextMenu:q3,onEdgeDoubleClick:U3,onEdgeMouseEnter:u,onEdgeMouseMove:a,onEdgeMouseLeave:U1,reconnectRadius:G1,defaultMarkerColor:i0,noDragClassName:z1,noWheelClassName:B1,noPanClassName:f1,rfId:G3,disableKeyboardA11y:f8,nodeExtent:w0,viewport:EQ,onViewportChange:xQ,nodesDraggable:W1}),i.jsx(BU,{onSelectionChange:c}),B2,i.jsx(YU,{proOptions:z5,position:h1}),i.jsx(KU,{rfId:G3,disableKeyboardA11y:f8})]})})}var C_=J_(dG);function S_(_){let[Q,J]=d.useState(_),q=d.useCallback((U)=>J((G)=>Q_(U,G)),[]);return[Q,J,q]}var xB=X0.error014();function aG({dimensions:_,lineWidth:Q,variant:J,className:q}){return i.jsx("path",{strokeWidth:Q,d:`M${_[0]/2} 0 V${_[1]} M0 ${_[1]/2} H${_[0]}`,className:c1(["react-flow__background-pattern",J,q])})}function sG({radius:_,className:Q}){return i.jsx("circle",{cx:_,cy:_,r:_,className:c1(["react-flow__background-pattern","dots",Q])})}var m0;(function(_){_.Lines="lines",_.Dots="dots",_.Cross="cross"})(m0||(m0={}));var tG={[m0.Dots]:1,[m0.Lines]:1,[m0.Cross]:6},oG=(_)=>({transform:_.transform,patternId:`pattern-${_.rfId}`});function y_({id:_,variant:Q=m0.Dots,gap:J=20,size:q,lineWidth:U=1,offset:G=0,color:Z,bgColor:F,style:X,className:Y,patternClassName:K}){let H=d.useRef(null),{transform:L,patternId:z}=S1(oG,b1),W=q||tG[Q],I=Q===m0.Dots,R=Q===m0.Cross,A=Array.isArray(J)?J:[J,J],N=[A[0]*L[2]||1,A[1]*L[2]||1],B=W*L[2],T=Array.isArray(G)?G:[G,G],O=R?[B,B]:N,C=[T[0]*L[2]+O[0]/2,T[1]*L[2]+O[1]/2],f=`${z}${_?_:""}`;return i.jsxs("svg",{className:c1(["react-flow__background",Y]),style:{...X,...i4,"--xy-background-color-props":F,"--xy-background-pattern-color-props":Z},ref:H,"data-testid":"rf__background",children:[i.jsx("pattern",{id:f,x:L[0]%N[0],y:L[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:I?i.jsx(sG,{radius:B/2,className:K}):i.jsx(aG,{dimensions:O,lineWidth:U,variant:Q,className:K})}),i.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${f})`})]})}y_.displayName="Background";var k_=d.memo(y_);function nG(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:i.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function eG(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:i.jsx("path",{d:"M0 0h32v4.2H0z"})})}function _Z(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:i.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function QZ(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:i.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function JZ(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:i.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function p4({children:_,className:Q,...J}){return i.jsx("button",{type:"button",className:c1(["react-flow__controls-button",Q]),...J,children:_})}var $Z=(_)=>({isInteractive:_.nodesDraggable||_.nodesConnectable||_.elementsSelectable,minZoomReached:_.transform[2]<=_.minZoom,maxZoomReached:_.transform[2]>=_.maxZoom,ariaLabelConfig:_.ariaLabelConfig});function v_({style:_,showZoom:Q=!0,showFitView:J=!0,showInteractive:q=!0,fitViewOptions:U,onZoomIn:G,onZoomOut:Z,onFitView:F,onInteractiveChange:X,className:Y,children:K,position:H="bottom-left",orientation:L="vertical","aria-label":z}){let W=E1(),{isInteractive:I,minZoomReached:R,maxZoomReached:A,ariaLabelConfig:N}=S1($Z,b1),{zoomIn:B,zoomOut:T,fitView:O}=d5(),C=()=>{B(),G?.()},f=()=>{T(),Z?.()},S=()=>{O(U),F?.()},w=()=>{W.setState({nodesDraggable:!I,nodesConnectable:!I,elementsSelectable:!I}),X?.(!I)};return i.jsxs(g0,{className:c1(["react-flow__controls",L==="horizontal"?"horizontal":"vertical",Y]),position:H,style:_,"data-testid":"rf__controls","aria-label":z??N["controls.ariaLabel"],children:[Q&&i.jsxs(i.Fragment,{children:[i.jsx(p4,{onClick:C,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:A,children:i.jsx(nG,{})}),i.jsx(p4,{onClick:f,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:R,children:i.jsx(eG,{})})]}),J&&i.jsx(p4,{className:"react-flow__controls-fitview",onClick:S,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:i.jsx(_Z,{})}),q&&i.jsx(p4,{className:"react-flow__controls-interactive",onClick:w,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:I?i.jsx(JZ,{}):i.jsx(QZ,{})}),K]})}v_.displayName="Controls";var j_=d.memo(v_);function qZ({id:_,x:Q,y:J,width:q,height:U,style:G,color:Z,strokeColor:F,strokeWidth:X,className:Y,borderRadius:K,shapeRendering:H,selected:L,onClick:z}){let{background:W,backgroundColor:I}=G||{},R=Z||W||I;return i.jsx("rect",{className:c1(["react-flow__minimap-node",{selected:L},Y]),x:Q,y:J,rx:K,ry:K,width:q,height:U,style:{fill:R,stroke:F,strokeWidth:X},shapeRendering:H,onClick:z?(A)=>z(A,_):void 0})}var UZ=d.memo(qZ),GZ=(_)=>_.nodes.map((Q)=>Q.id),U8=(_)=>_ instanceof Function?_:()=>_;function ZZ({nodeStrokeColor:_,nodeColor:Q,nodeClassName:J="",nodeBorderRadius:q=5,nodeStrokeWidth:U,nodeComponent:G=UZ,onClick:Z}){let F=S1(GZ,b1),X=U8(Q),Y=U8(_),K=U8(J),H=typeof window>"u"||!!window.chrome?"crispEdges":"geometricPrecision";return i.jsx(i.Fragment,{children:F.map((L)=>i.jsx(HZ,{id:L,nodeColorFunc:X,nodeStrokeColorFunc:Y,nodeClassNameFunc:K,nodeBorderRadius:q,nodeStrokeWidth:U,NodeComponent:G,onClick:Z,shapeRendering:H},L))})}function FZ({id:_,nodeColorFunc:Q,nodeStrokeColorFunc:J,nodeClassNameFunc:q,nodeBorderRadius:U,nodeStrokeWidth:G,shapeRendering:Z,NodeComponent:F,onClick:X}){let{node:Y,x:K,y:H,width:L,height:z}=S1((W)=>{let I=W.nodeLookup.get(_);if(!I)return{node:void 0,x:0,y:0,width:0,height:0};let R=I.internals.userNode,{x:A,y:N}=I.internals.positionAbsolute,{width:B,height:T}=I0(R);return{node:R,x:A,y:N,width:B,height:T}},b1);if(!Y||Y.hidden||!c6(Y))return null;return i.jsx(F,{x:K,y:H,width:L,height:z,style:Y.style,selected:!!Y.selected,className:q(Y),color:Q(Y),borderRadius:U,strokeColor:J(Y),strokeWidth:G,shapeRendering:Z,onClick:X,id:Y.id})}var HZ=d.memo(FZ),XZ=d.memo(ZZ),KZ=200,YZ=150,LZ=(_)=>!_.hidden,zZ=(_)=>{let Q={x:-_.transform[0]/_.transform[2],y:-_.transform[1]/_.transform[2],width:_.width/_.transform[2],height:_.height/_.transform[2]},J=!1;for(let q of _.nodeLookup.values())if(!q.hidden){J=!0;break}return{viewBB:Q,boundingRect:J?m6(V2(_.nodeLookup,{filter:LZ}),Q):Q,rfId:_.rfId,panZoom:_.panZoom,translateExtent:_.translateExtent,flowWidth:_.width,flowHeight:_.height,ariaLabelConfig:_.ariaLabelConfig}},d9=(_,Q)=>_.x===Q.x&&_.y===Q.y&&_.width===Q.width&&_.height===Q.height,WZ=(_,Q)=>d9(_.viewBB,Q.viewBB)&&d9(_.boundingRect,Q.boundingRect)&&_.rfId===Q.rfId&&_.panZoom===Q.panZoom&&_.translateExtent===Q.translateExtent&&_.flowWidth===Q.flowWidth&&_.flowHeight===Q.flowHeight&&_.ariaLabelConfig===Q.ariaLabelConfig,AZ="react-flow__minimap-desc";function V_({style:_,className:Q,nodeStrokeColor:J,nodeColor:q,nodeClassName:U="",nodeBorderRadius:G=5,nodeStrokeWidth:Z,nodeComponent:F,bgColor:X,maskColor:Y,maskStrokeColor:K,maskStrokeWidth:H,position:L="bottom-right",onClick:z,onNodeClick:W,pannable:I=!1,zoomable:R=!1,ariaLabel:A,inversePan:N,zoomStep:B=1,offsetScale:T=5}){let O=E1(),C=d.useRef(null),{boundingRect:f,panZoom:S,viewBB:w,rfId:k,translateExtent:E,flowWidth:l,flowHeight:c,ariaLabelConfig:y}=S1(zZ,WZ),D=_?.width??KZ,v=_?.height??YZ,x=f.width/D,V=f.height/v,b=Math.max(x,V),P=b*D,j=b*v,m=T*b,h=f.x-(P-f.width)/2-m,o=f.y-(j-f.height)/2-m,e=P+m*2,s=j+m*2,t=`${AZ}-${k}`,p=d.useRef(0),n=d.useRef();p.current=b,d.useEffect(()=>{let T1=O.getState().panZoom;if(C.current&&T1)return n.current=$9({domNode:C.current,panZoom:T1,getTransform:()=>O.getState().transform,getViewScale:()=>p.current}),()=>{n.current?.destroy()}},[S]),d.useEffect(()=>{n.current?.update({translateExtent:E,width:l,height:c,inversePan:N,pannable:I,zoomStep:B,zoomable:R})},[I,R,N,B,E,l,c]);let J1=z?(T1)=>{let[L1,_1]=n.current?.pointer(T1)||[0,0];z(T1,{x:L1,y:_1})}:void 0,q1=d.useCallback((T1,L1)=>{let _1=O.getState().nodeLookup.get(L1).internals.userNode;W?.(T1,_1)},[W]),F1=W?q1:void 0,Z1=A??y["minimap.ariaLabel"];return i.jsx(g0,{position:L,style:{..._,"--xy-minimap-background-color-props":typeof X==="string"?X:void 0,"--xy-minimap-mask-background-color-props":typeof Y==="string"?Y:void 0,"--xy-minimap-mask-stroke-color-props":typeof K==="string"?K:void 0,"--xy-minimap-mask-stroke-width-props":typeof H==="number"?H*b:void 0,"--xy-minimap-node-background-color-props":typeof q==="string"?q:void 0,"--xy-minimap-node-stroke-color-props":typeof J==="string"?J:void 0,"--xy-minimap-node-stroke-width-props":typeof Z==="number"?Z:void 0},className:c1(["react-flow__minimap",Q]),"data-testid":"rf__minimap",children:i.jsxs("svg",{width:D,height:v,viewBox:`${h} ${o} ${e} ${s}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":t,ref:C,onClick:J1,children:[Z1&&i.jsx("title",{id:t,children:Z1}),i.jsx(XZ,{onClick:F1,nodeColor:q,nodeStrokeColor:J,nodeBorderRadius:G,nodeClassName:U,nodeStrokeWidth:Z,nodeComponent:F}),i.jsx("path",{className:"react-flow__minimap-mask",d:`M${h-m},${o-m}h${e+m*2}v${s+m*2}h${-e-m*2}z
|
|
34
|
-
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}V_.displayName="MiniMap";var u_=d.memo(V_),BZ=(_)=>(Q)=>_?`${Math.max(1/Q.transform[2],1)}`:void 0,MZ={[n0.Line]:"right",[n0.Handle]:"bottom-right"};function TZ({nodeId:_,position:Q,variant:J=n0.Handle,className:q,style:U=void 0,children:G,color:Z,minWidth:F=10,minHeight:X=10,maxWidth:Y=Number.MAX_VALUE,maxHeight:K=Number.MAX_VALUE,keepAspectRatio:H=!1,resizeDirection:L,autoScale:z=!0,shouldResize:W,onResizeStart:I,onResize:R,onResizeEnd:A}){let N=F8(),B=typeof _==="string"?_:N,T=E1(),O=d.useRef(null),C=J===n0.Handle,f=S1(d.useCallback(BZ(C&&z),[C,z]),b1),S=d.useRef(null),w=Q??MZ[J];d.useEffect(()=>{if(!O.current||!B)return;if(!S.current)S.current=X9({domNode:O.current,nodeId:B,getStoreItems:()=>{let{nodeLookup:E,transform:l,snapGrid:c,snapToGrid:y,nodeOrigin:D,domNode:v}=T.getState();return{nodeLookup:E,transform:l,snapGrid:c,snapToGrid:y,nodeOrigin:D,paneDomNode:v}},onChange:(E,l)=>{let{triggerNodeChanges:c,nodeLookup:y,parentLookup:D,nodeOrigin:v}=T.getState(),x=[],V={x:E.x,y:E.y},b=y.get(B);if(b&&b.expandParent&&b.parentId){let P=b.origin??v,j=E.width??b.measured.width??0,m=E.height??b.measured.height??0,h={id:b.id,parentId:b.parentId,rect:{width:j,height:m,...l6({x:E.x??b.position.x,y:E.y??b.position.y},{width:j,height:m},b.parentId,y,P)}},o=E4([h],y,D,v);x.push(...o),V.x=E.x?Math.max(P[0]*j,E.x):void 0,V.y=E.y?Math.max(P[1]*m,E.y):void 0}if(V.x!==void 0&&V.y!==void 0){let P={id:B,type:"position",position:{...V}};x.push(P)}if(E.width!==void 0&&E.height!==void 0){let j={id:B,type:"dimensions",resizing:!0,setAttributes:!L?!0:L==="horizontal"?"width":"height",dimensions:{width:E.width,height:E.height}};x.push(j)}for(let P of l){let j={...P,type:"position"};x.push(j)}c(x)},onEnd:({width:E,height:l})=>{let c={id:B,type:"dimensions",resizing:!1,dimensions:{width:E,height:l}};T.getState().triggerNodeChanges([c])}});return S.current.update({controlPosition:w,boundaries:{minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K},keepAspectRatio:H,resizeDirection:L,onResizeStart:I,onResize:R,onResizeEnd:A,shouldResize:W}),()=>{S.current?.destroy()}},[w,F,X,Y,K,H,I,R,A,W]);let k=w.split("-");return i.jsx("div",{className:c1(["react-flow__resize-control","nodrag",...k,J,q]),ref:O,style:{...U,scale:f,...Z&&{[C?"backgroundColor":"borderColor"]:Z}},children:G})}var a9=d.memo(TZ);function h_({nodeId:_,isVisible:Q=!0,handleClassName:J,handleStyle:q,lineClassName:U,lineStyle:G,color:Z,minWidth:F=10,minHeight:X=10,maxWidth:Y=Number.MAX_VALUE,maxHeight:K=Number.MAX_VALUE,keepAspectRatio:H=!1,autoScale:L=!0,shouldResize:z,onResizeStart:W,onResize:I,onResizeEnd:R}){if(!Q)return null;return i.jsxs(i.Fragment,{children:[F9.map((A)=>i.jsx(a9,{className:U,style:G,nodeId:_,position:A,variant:n0.Line,color:Z,minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K,onResizeStart:W,keepAspectRatio:H,autoScale:L,shouldResize:z,onResize:I,onResizeEnd:R},A)),Z9.map((A)=>i.jsx(a9,{className:J,style:q,nodeId:_,position:A,color:Z,minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K,onResizeStart:W,keepAspectRatio:H,autoScale:L,shouldResize:z,onResize:I,onResizeEnd:R},A))]})}var RZ=(_)=>_.domNode?.querySelector(".react-flow__renderer");function OZ({children:_}){let Q=S1(RZ);if(!Q)return null;return s9.createPortal(_,Q)}var IZ=(_,Q)=>_?.internals.positionAbsolute.x!==Q?.internals.positionAbsolute.x||_?.internals.positionAbsolute.y!==Q?.internals.positionAbsolute.y||_?.measured.width!==Q?.measured.width||_?.measured.height!==Q?.measured.height||_?.selected!==Q?.selected||_?.internals.z!==Q?.internals.z,PZ=(_,Q)=>{if(_.size!==Q.size)return!1;for(let[J,q]of _)if(IZ(q,Q.get(J)))return!1;return!0},NZ=(_)=>({x:_.transform[0],y:_.transform[1],zoom:_.transform[2],selectedNodesCount:_.nodes.filter((Q)=>Q.selected).length});function X8({nodeId:_,children:Q,className:J,style:q,isVisible:U,position:G=X1.Top,offset:Z=10,align:F="center",...X}){let Y=F8(),K=d.useCallback((O)=>{return(Array.isArray(_)?_:[_||Y||""]).reduce((S,w)=>{let k=O.nodeLookup.get(w);if(k)S.set(k.id,k);return S},new Map)},[_,Y]),H=S1(K,PZ),{x:L,y:z,zoom:W,selectedNodesCount:I}=S1(NZ,b1);if(!(typeof U==="boolean"?U:H.size===1&&H.values().next().value?.selected&&I===1)||!H.size)return null;let A=V2(H),N=Array.from(H.values()),B=Math.max(...N.map((O)=>O.internals.z+1)),T={position:"absolute",transform:r7(A,{x:L,y:z,zoom:W},G,Z,F),zIndex:B,...q};return i.jsx(OZ,{children:i.jsx("div",{style:T,className:c1(["react-flow__node-toolbar",J]),...X,"data-id":N.reduce((O,C)=>`${O}${C.id} `,"").trim(),children:Q})})}var _0=J0(h0(),1);var D_={x:{title:"X",fill:"currentColor",d:"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"},youtube:{title:"YouTube",fill:"#FF0000",d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"},tiktok:{title:"TikTok",fill:"currentColor",d:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z"},discord:{title:"Discord",fill:"#5865F2",d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"},resend:{title:"Resend",fill:"currentColor",d:"M2.023 0v24h5.553v-8.434h2.998L15.326 24h6.65l-5.372-9.258a7.652 7.652 0 0 0 3.316-3.016c.709-1.21 1.062-2.57 1.062-4.08 0-1.462-.353-2.767-1.062-3.91-.709-1.165-1.692-2.079-2.95-2.742C15.737.331 14.355 0 12.823 0Zm5.553 4.87h4.219c.731 0 1.349.125 1.851.376.526.252.925.618 1.2 1.098.274.457.412.994.412 1.611S15.132 9.12 14.88 9.6c-.229.48-.572.856-1.03 1.13-.434.252-.948.38-1.542.38H7.576Z"},linkedin:{title:"LinkedIn",fill:"#0A66C2",d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"},reddit:{title:"Reddit",fill:"#FF4500",d:"M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z"},bluesky:{title:"Bluesky",fill:"#0285FF",d:"M12 10.8c-1.087-2.114-4.046-6.053-6.798-7.995C2.566.944 1.561 1.266.902 1.565.139 1.908 0 3.08 0 3.768c0 .69.378 5.65.624 6.479.815 2.736 3.713 3.66 6.383 3.364.136-.02.275-.039.415-.056-.138.022-.276.04-.415.056-3.912.58-7.387 2.005-2.83 7.078 5.013 5.19 6.87-1.113 7.823-4.308.953 3.195 2.05 9.271 7.733 4.308 4.267-4.308 1.172-6.498-2.74-7.078a8.741 8.741 0 0 1-.415-.056c.14.017.279.036.415.056 2.67.297 5.568-.628 6.383-3.364.246-.828.624-5.79.624-6.478 0-.69-.139-1.861-.902-2.206-.659-.298-1.664-.62-4.3 1.24C16.046 4.748 13.087 8.687 12 10.8Z"},instagram:{title:"Instagram",fill:"#FF0069",d:"M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077"},github:{title:"GitHub",fill:"currentColor",d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"},stripe:{title:"Stripe",fill:"#635BFF",d:"M13.976 9.15c-2.172-.806-3.356-1.426-3.356-2.409 0-.831.683-1.305 1.901-1.305 2.227 0 4.515.858 6.09 1.631l.89-5.494C18.252.975 15.697 0 12.165 0 9.667 0 7.589.654 6.104 1.872 4.56 3.147 3.757 4.992 3.757 7.218c0 4.039 2.467 5.76 6.476 7.219 2.585.92 3.445 1.574 3.445 2.583 0 .98-.84 1.545-2.354 1.545-1.875 0-4.965-.921-6.99-2.109l-.9 5.555C5.175 22.99 8.385 24 11.714 24c2.641 0 4.843-.624 6.328-1.813 1.664-1.305 2.525-3.236 2.525-5.732 0-4.128-2.524-5.851-6.594-7.305h.003z"},slack:{title:"Slack",fill:"#4A154B",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"},openai:{title:"OpenAI",fill:"#412991",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"},anthropic:{title:"Anthropic",fill:"currentColor",d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"},twilio:{title:"Twilio",fill:"#F22F46",d:"M12 0C5.381-.008.008 5.352 0 11.971V12c0 6.64 5.359 12 12 12 6.64 0 12-5.36 12-12 0-6.641-5.36-12-12-12zm0 20.801c-4.846.015-8.786-3.904-8.801-8.75V12c-.014-4.846 3.904-8.786 8.75-8.801H12c4.847-.014 8.786 3.904 8.801 8.75V12c.015 4.847-3.904 8.786-8.75 8.801H12zm5.44-11.76c0 1.359-1.12 2.479-2.481 2.479-1.366-.007-2.472-1.113-2.479-2.479 0-1.361 1.12-2.481 2.479-2.481 1.361 0 2.481 1.12 2.481 2.481zm0 5.919c0 1.36-1.12 2.48-2.481 2.48-1.367-.008-2.473-1.114-2.479-2.48 0-1.359 1.12-2.479 2.479-2.479 1.361-.001 2.481 1.12 2.481 2.479zm-5.919 0c0 1.36-1.12 2.48-2.479 2.48-1.368-.007-2.475-1.113-2.481-2.48 0-1.359 1.12-2.479 2.481-2.479 1.358-.001 2.479 1.12 2.479 2.479zm0-5.919c0 1.359-1.12 2.479-2.479 2.479-1.367-.007-2.475-1.112-2.481-2.479 0-1.361 1.12-2.481 2.481-2.481 1.358 0 2.479 1.12 2.479 2.481z"},sendgrid:{title:"SendGrid",fill:"#51A9E3",d:"M.8 24h13.6c.88 0 1.6-.72 1.6-1.6v-4.8c0-.88-.72-1.6-1.6-1.6H9.6c-.88 0-1.6-.72-1.6-1.6V9.6C8 8.72 7.28 8 6.4 8H1.6C.72 8 0 8.72 0 9.6v13.6c0 .44.36.8.8.8zM23.2 0H9.6C8.72 0 8 .72 8 1.6v4.8C8 7.28 8.72 8 9.6 8h4.8c.88 0 1.6.72 1.6 1.6v4.8c0 .88.72 1.6 1.6 1.6h4.8c.88 0 1.6-.72 1.6-1.6V.8c0-.44-.36-.8-.8-.8Z"},mailgun:{title:"Mailgun",fill:"#F06B66",d:"M11.837 0c6.602 0 11.984 5.381 11.984 11.994-.017 2.99-3.264 4.84-5.844 3.331a3.805 3.805 0 0 1-.06-.035l-.055-.033-.022.055c-2.554 4.63-9.162 4.758-11.894.232-2.732-4.527.46-10.313 5.746-10.416a6.868 6.868 0 0 1 7.002 6.866 1.265 1.265 0 0 0 2.52 0c0-5.18-4.197-9.38-9.377-9.387C4.611 2.594.081 10.41 3.683 16.673c3.238 5.632 11.08 6.351 15.289 1.402l1.997 1.686A11.95 11.95 0 0 1 11.837 24C2.6 23.72-2.87 13.543 1.992 5.684A12.006 12.006 0 0 1 11.837 0Zm0 7.745c-3.276-.163-5.5 3.281-4.003 6.2a4.26 4.26 0 0 0 4.014 2.31c3.276-.171 5.137-3.824 3.35-6.575a4.26 4.26 0 0 0-3.36-1.935Zm0 2.53c1.324 0 2.152 1.433 1.49 2.58a1.72 1.72 0 0 1-1.49.86 1.72 1.72 0 1 1 0-3.44Z"},notion:{title:"Notion",fill:"currentColor",d:"M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"},linear:{title:"Linear",fill:"#5E6AD2",d:"M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z"},jira:{title:"Jira",fill:"#0052CC",d:"M11.571 11.513H0a5.218 5.218 0 0 0 5.232 5.215h2.13v2.057A5.215 5.215 0 0 0 12.575 24V12.518a1.005 1.005 0 0 0-1.005-1.005zm5.723-5.756H5.736a5.215 5.215 0 0 0 5.215 5.214h2.129v2.058a5.218 5.218 0 0 0 5.215 5.214V6.758a1.001 1.001 0 0 0-1.001-1.001zM23.013 0H11.455a5.215 5.215 0 0 0 5.215 5.215h2.129v2.057A5.215 5.215 0 0 0 24 12.483V1.005A1.001 1.001 0 0 0 23.013 0Z"},hubspot:{title:"HubSpot",fill:"#FF7A59",d:"M18.164 7.93V5.084a2.198 2.198 0 001.267-1.978v-.067A2.2 2.2 0 0017.238.845h-.067a2.2 2.2 0 00-2.193 2.193v.067a2.196 2.196 0 001.252 1.973l.013.006v2.852a6.22 6.22 0 00-2.969 1.31l.012-.01-7.828-6.095A2.497 2.497 0 104.3 4.656l-.012.006 7.697 5.991a6.176 6.176 0 00-1.038 3.446c0 1.343.425 2.588 1.147 3.607l-.013-.02-2.342 2.343a1.968 1.968 0 00-.58-.095h-.002a2.033 2.033 0 102.033 2.033 1.978 1.978 0 00-.1-.595l.005.014 2.317-2.317a6.247 6.247 0 104.782-11.134l-.036-.005zm-.964 9.378a3.206 3.206 0 113.215-3.207v.002a3.206 3.206 0 01-3.207 3.207z"},paypal:{title:"PayPal",fill:"#003087",d:"M7.016 19.198h-4.2a.562.562 0 0 1-.555-.65L5.093.584A.692.692 0 0 1 5.776 0h7.222c3.417 0 5.904 2.488 5.846 5.5-.006.25-.027.5-.066.747A6.794 6.794 0 0 1 12.071 12H8.743a.69.69 0 0 0-.682.583l-.325 2.056-.013.083-.692 4.39-.015.087zM19.79 6.142c-.01.087-.01.175-.023.261a7.76 7.76 0 0 1-7.695 6.598H9.007l-.283 1.795-.013.083-.692 4.39-.134.843-.014.088H6.86l-.497 3.15a.562.562 0 0 0 .555.65h3.612c.34 0 .63-.249.683-.585l.952-6.031a.692.692 0 0 1 .683-.584h2.126a6.793 6.793 0 0 0 6.707-5.752c.306-1.95-.466-3.744-1.89-4.906z"},shopify:{title:"Shopify",fill:"#7AB55C",d:"M15.337 23.979l7.216-1.561s-2.604-17.613-2.625-17.73c-.018-.116-.114-.192-.211-.192s-1.929-.136-1.929-.136-1.275-1.274-1.439-1.411c-.045-.037-.075-.057-.121-.074l-.914 21.104h.023zM11.71 11.305s-.81-.424-1.774-.424c-1.447 0-1.504.906-1.504 1.141 0 1.232 3.24 1.715 3.24 4.629 0 2.295-1.44 3.76-3.406 3.76-2.354 0-3.54-1.465-3.54-1.465l.646-2.086s1.245 1.066 2.28 1.066c.675 0 .975-.545.975-.932 0-1.619-2.654-1.694-2.654-4.359-.034-2.237 1.571-4.416 4.827-4.416 1.257 0 1.875.361 1.875.361l-.945 2.715-.02.01zM11.17.83c.136 0 .271.038.405.135-.984.465-2.064 1.639-2.508 3.992-.656.213-1.293.405-1.889.578C7.697 3.75 8.951.84 11.17.84V.83zm1.235 2.949v.135c-.754.232-1.583.484-2.394.736.466-1.777 1.333-2.645 2.085-2.971.193.501.309 1.176.309 2.1zm.539-2.234c.694.074 1.141.867 1.429 1.755-.349.114-.735.231-1.158.366v-.252c0-.752-.096-1.371-.271-1.871v.002zm2.992 1.289c-.02 0-.06.021-.078.021s-.289.075-.714.21c-.423-1.233-1.176-2.37-2.508-2.37h-.115C12.135.209 11.669 0 11.265 0 8.159 0 6.675 3.877 6.21 5.846c-1.194.365-2.063.636-2.16.674-.675.213-.694.232-.772.87-.075.462-1.83 14.063-1.83 14.063L15.009 24l.927-21.166z"},sentry:{title:"Sentry",fill:"#362D59",d:"M13.91 2.505c-.873-1.448-2.972-1.448-3.844 0L6.904 7.92a15.478 15.478 0 0 1 8.53 12.811h-2.221A13.301 13.301 0 0 0 5.784 9.814l-2.926 5.06a7.65 7.65 0 0 1 4.435 5.848H2.194a.365.365 0 0 1-.298-.534l1.413-2.402a5.16 5.16 0 0 0-1.614-.913L.296 19.275a2.182 2.182 0 0 0 .812 2.999 2.24 2.24 0 0 0 1.086.288h6.983a9.322 9.322 0 0 0-3.845-8.318l1.11-1.922a11.47 11.47 0 0 1 4.95 10.24h5.915a17.242 17.242 0 0 0-7.885-15.28l2.244-3.845a.37.37 0 0 1 .504-.13c.255.14 9.75 16.708 9.928 16.9a.365.365 0 0 1-.327.543h-2.287c.029.612.029 1.223 0 1.831h2.297a2.206 2.206 0 0 0 1.922-3.31z"},vercel:{title:"Vercel",fill:"currentColor",d:"M24 22.525H0l12-21.05 12 21.05z"},supabase:{title:"Supabase",fill:"#3FCF8E",d:"M11.9 1.036c-.015-.986-1.26-1.41-1.874-.637L.764 12.05C-.33 13.427.65 15.455 2.409 15.455h9.579l.113 7.51c.014.985 1.259 1.408 1.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z"},clerk:{title:"Clerk",fill:"#6C47FF",d:"m21.47 20.829-2.881-2.881a.572.572 0 0 0-.7-.084 6.854 6.854 0 0 1-7.081 0 .576.576 0 0 0-.7.084l-2.881 2.881a.576.576 0 0 0-.103.69.57.57 0 0 0 .166.186 12 12 0 0 0 14.113 0 .58.58 0 0 0 .239-.423.576.576 0 0 0-.172-.453Zm.002-17.668-2.88 2.88a.569.569 0 0 1-.701.084A6.857 6.857 0 0 0 8.724 8.08a6.862 6.862 0 0 0-1.222 3.692 6.86 6.86 0 0 0 .978 3.764.573.573 0 0 1-.083.699l-2.881 2.88a.567.567 0 0 1-.864-.063A11.993 11.993 0 0 1 6.771 2.7a11.99 11.99 0 0 1 14.637-.405.566.566 0 0 1 .232.418.57.57 0 0 1-.168.448Zm-7.118 12.261a3.427 3.427 0 1 0 0-6.854 3.427 3.427 0 0 0 0 6.854Z"},aws:{title:"Amazon Web Services",fill:"#232F3E",d:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 0 1-.287-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.214c.263 0 .534-.048.822-.144.287-.096.543-.271.758-.51.128-.152.224-.32.272-.512.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 5.55a1.398 1.398 0 0 1-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 0 1 .32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 0 1 .311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 0 1-.056.2l-1.923 6.17c-.048.16-.104.263-.168.311a.51.51 0 0 1-.303.08h-.687c-.151 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32l-1.238-5.148-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 0 1-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.559c-.144-.151-.416-.287-.807-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 0 1-.4-1.158c0-.335.073-.63.216-.886.144-.255.335-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.175 0 .359.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 0 1 .24.2.43.43 0 0 1 .071.263v.375c0 .168-.064.256-.184.256a.83.83 0 0 1-.303-.096 3.652 3.652 0 0 0-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.159.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926-.144.272-.336.511-.583.703-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167zM21.698 16.207c-2.626 1.94-6.442 2.969-9.722 2.969-4.598 0-8.74-1.7-11.87-4.526-.247-.223-.024-.527.272-.351 3.384 1.963 7.559 3.153 11.877 3.153 2.914 0 6.114-.607 9.06-1.852.439-.2.814.287.383.607zM22.792 14.961c-.336-.43-2.22-.207-3.074-.103-.255.032-.295-.192-.063-.36 1.5-1.053 3.967-.75 4.254-.399.287.36-.08 2.826-1.485 4.007-.215.184-.423.088-.327-.151.32-.79 1.03-2.57.695-2.994z"},figma:{title:"Figma",fill:"#F24E1E",d:"M15.852 8.981h-4.588V0h4.588c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.491-4.49 4.491zM12.735 7.51h3.117c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-3.117V7.51zm0 1.471H8.148c-2.476 0-4.49-2.014-4.49-4.49S5.672 0 8.148 0h4.588v8.981zm-4.587-7.51c-1.665 0-3.019 1.355-3.019 3.019s1.354 3.02 3.019 3.02h3.117V1.471H8.148zm4.587 15.019H8.148c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h4.588v8.98zM8.148 8.981c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h3.117V8.981H8.148zM8.172 24c-2.489 0-4.515-2.014-4.515-4.49s2.014-4.49 4.49-4.49h4.588v4.441c0 2.503-2.047 4.539-4.563 4.539zm-.024-7.51a3.023 3.023 0 0 0-3.019 3.019c0 1.665 1.365 3.019 3.044 3.019 1.705 0 3.093-1.376 3.093-3.068v-2.97H8.148zm7.704 0h-.098c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h.098c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.49-4.49 4.49zm-.097-7.509c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h.098c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-.098z"},airtable:{title:"Airtable",fill:"#18BFFF",d:"M11.992 1.966c-.434 0-.87.086-1.28.257L1.779 5.917c-.503.208-.49.908.012 1.116l8.982 3.558a3.266 3.266 0 0 0 2.454 0l8.982-3.558c.503-.196.503-.908.012-1.116l-8.957-3.694a3.255 3.255 0 0 0-1.272-.257zM23.4 8.056a.589.589 0 0 0-.222.045l-10.012 3.877a.612.612 0 0 0-.38.564v8.896a.6.6 0 0 0 .821.552L23.62 18.1a.583.583 0 0 0 .38-.551V8.653a.6.6 0 0 0-.6-.596zM.676 8.095a.644.644 0 0 0-.48.19C.086 8.396 0 8.53 0 8.69v8.355c0 .442.515.737.908.54l6.27-3.006.307-.147 2.969-1.436c.466-.22.43-.908-.061-1.092L.883 8.138a.57.57 0 0 0-.207-.044z"},intercom:{title:"Intercom",fill:"#6AFDEF",d:"M21 0H3C1.343 0 0 1.343 0 3v18c0 1.658 1.343 3 3 3h18c1.658 0 3-1.342 3-3V3c0-1.657-1.342-3-3-3zm-5.801 4.399c0-.44.36-.8.802-.8.44 0 .8.36.8.8v10.688c0 .442-.36.801-.8.801-.443 0-.802-.359-.802-.801V4.399zM11.2 3.994c0-.44.357-.799.8-.799s.8.359.8.799v11.602c0 .44-.357.8-.8.8s-.8-.36-.8-.8V3.994zm-4 .405c0-.44.359-.8.799-.8.443 0 .802.36.802.8v10.688c0 .442-.36.801-.802.801-.44 0-.799-.359-.799-.801V4.399zM3.199 6c0-.442.36-.8.802-.8.44 0 .799.358.799.8v7.195c0 .441-.359.8-.799.8-.443 0-.802-.36-.802-.8V6zM20.52 18.202c-.123.105-3.086 2.593-8.52 2.593-5.433 0-8.397-2.486-8.521-2.593-.335-.288-.375-.792-.086-1.128.285-.334.79-.375 1.125-.09.047.041 2.693 2.211 7.481 2.211 4.848 0 7.456-2.186 7.479-2.207.334-.289.839-.25 1.128.086.289.336.25.84-.086 1.128zm.281-5.007c0 .441-.36.8-.801.8-.441 0-.801-.36-.801-.8V6c0-.442.361-.8.801-.8.441 0 .801.357.801.8v7.195z"},posthog:{title:"PostHog",fill:"currentColor",d:"M9.854 14.5 5 9.647.854 5.5A.5.5 0 0 0 0 5.854V8.44a.5.5 0 0 0 .146.353L5 13.647l.147.146L9.854 18.5l.146.147v-.049c.065.03.134.049.207.049h2.586a.5.5 0 0 0 .353-.854L9.854 14.5zm0-5-4-4a.487.487 0 0 0-.409-.144.515.515 0 0 0-.356.21.493.493 0 0 0-.089.288V8.44a.5.5 0 0 0 .147.353l9 9a.5.5 0 0 0 .853-.354v-2.585a.5.5 0 0 0-.146-.354l-5-5zm1-4a.5.5 0 0 0-.854.354V8.44a.5.5 0 0 0 .147.353l4 4a.5.5 0 0 0 .853-.354V9.854a.5.5 0 0 0-.146-.354l-4-4zm12.647 11.515a3.863 3.863 0 0 1-2.232-1.1l-4.708-4.707a.5.5 0 0 0-.854.354v6.585a.5.5 0 0 0 .5.5H23.5a.5.5 0 0 0 .5-.5v-.6c0-.276-.225-.497-.499-.532zm-5.394.032a.8.8 0 1 1 0-1.6.8.8 0 0 1 0 1.6zM.854 15.5a.5.5 0 0 0-.854.354v2.293a.5.5 0 0 0 .5.5h2.293c.222 0 .39-.135.462-.309a.493.493 0 0 0-.109-.545L.854 15.501zM5 14.647.854 10.5a.5.5 0 0 0-.854.353v2.586a.5.5 0 0 0 .146.353L4.854 18.5l.146.147h2.793a.5.5 0 0 0 .353-.854L5 14.647z"},datadog:{title:"Datadog",fill:"#632CA6",d:"M19.57 17.04l-1.997-1.316-1.665 2.782-1.937-.567-1.706 2.604.087.82 9.274-1.71-.538-5.794zm-8.649-2.498l1.488-.204c.241.108.409.15.697.223.45.117.97.23 1.741-.16.18-.088.553-.43.704-.625l6.096-1.106.622 7.527-10.444 1.882zm11.325-2.712l-.602.115L20.488 0 .789 2.285l2.427 19.693 2.306-.334c-.184-.263-.471-.581-.96-.989-.68-.564-.44-1.522-.039-2.127.53-1.022 3.26-2.322 3.106-3.956-.056-.594-.15-1.368-.702-1.898-.02.22.017.432.017.432s-.227-.289-.34-.683c-.112-.15-.2-.199-.319-.4-.085.233-.073.503-.073.503s-.186-.437-.216-.807c-.11.166-.137.48-.137.48s-.241-.69-.186-1.062c-.11-.323-.436-.965-.343-2.424.6.421 1.924.321 2.44-.439.171-.251.288-.939-.086-2.293-.24-.868-.835-2.16-1.066-2.651l-.028.02c.122.395.374 1.223.47 1.625.293 1.218.372 1.642.234 2.204-.116.488-.397.808-1.107 1.165-.71.358-1.653-.514-1.713-.562-.69-.55-1.224-1.447-1.284-1.883-.062-.477.275-.763.445-1.153-.243.07-.514.192-.514.192s.323-.334.722-.624c.165-.109.262-.178.436-.323a9.762 9.762 0 0 0-.456.003s.42-.227.855-.392c-.318-.014-.623-.003-.623-.003s.937-.419 1.678-.727c.509-.208 1.006-.147 1.286.257.367.53.752.817 1.569.996.501-.223.653-.337 1.284-.509.554-.61.99-.688.99-.688s-.216.198-.274.51c.314-.249.66-.455.66-.455s-.134.164-.259.426l.03.043c.366-.22.797-.394.797-.394s-.123.156-.268.358c.277-.002.838.012 1.056.037 1.285.028 1.552-1.374 2.045-1.55.618-.22.894-.353 1.947.68.903.888 1.609 2.477 1.259 2.833-.294.295-.874-.115-1.516-.916a3.466 3.466 0 0 1-.716-1.562 1.533 1.533 0 0 0-.497-.85s.23.51.23.96c0 .246.03 1.165.424 1.68-.039.076-.057.374-.1.43-.458-.554-1.443-.95-1.604-1.067.544.445 1.793 1.468 2.273 2.449.453.927.186 1.777.416 1.997.065.063.976 1.197 1.15 1.767.306.994.019 2.038-.381 2.685l-1.117.174c-.163-.045-.273-.068-.42-.153.08-.143.241-.5.243-.572l-.063-.111c-.348.492-.93.97-1.414 1.245-.633.359-1.363.304-1.838.156-1.348-.415-2.623-1.327-2.93-1.566 0 0-.01.191.048.234.34.383 1.119 1.077 1.872 1.56l-1.605.177.759 5.908c-.337.048-.39.071-.757.124-.325-1.147-.946-1.895-1.624-2.332-.599-.384-1.424-.47-2.214-.314l-.05.059a2.851 2.851 0 0 1 1.863.444c.654.413 1.181 1.481 1.375 2.124.248.822.42 1.7-.248 2.632-.476.662-1.864 1.028-2.986.237.3.481.705.876 1.25.95.809.11 1.577-.03 2.106-.574.452-.464.69-1.434.628-2.456l.714-.104.258 1.834 11.827-1.424zM15.05 6.848c-.034.075-.085.125-.007.37l.004.014.013.032.032.073c.14.287.295.558.552.696.067-.011.136-.019.207-.023.242-.01.395.028.492.08.009-.048.01-.119.005-.222-.018-.364.072-.982-.626-1.308-.264-.122-.634-.084-.757.068a.302.302 0 0 1 .058.013c.186.066.06.13.027.207m1.958 3.392c-.092-.05-.52-.03-.821.005-.574.068-1.193.267-1.328.372-.247.191-.135.523.047.66.511.382.96.638 1.432.575.29-.038.546-.497.728-.914.124-.288.124-.598-.058-.698m-5.077-2.942c.162-.154-.805-.355-1.556.156-.554.378-.571 1.187-.041 1.646.053.046.096.078.137.104a4.77 4.77 0 0 1 1.396-.412c.113-.125.243-.345.21-.745-.044-.542-.455-.456-.146-.749"},algolia:{title:"Algolia",fill:"#003DFF",d:"M12 0C5.445 0 .103 5.285.01 11.817c-.097 6.634 5.285 12.131 11.92 12.17a11.91 11.91 0 0 0 5.775-1.443.281.281 0 0 0 .052-.457l-1.122-.994a.79.79 0 0 0-.833-.14 9.693 9.693 0 0 1-3.923.77c-5.36-.067-9.692-4.527-9.607-9.888.084-5.293 4.417-9.573 9.73-9.573h9.73v17.296l-5.522-4.907a.407.407 0 0 0-.596.063 4.52 4.52 0 0 1-3.934 1.793 4.538 4.538 0 0 1-4.192-4.168 4.53 4.53 0 0 1 4.512-4.872 4.532 4.532 0 0 1 4.509 4.126c.018.205.11.397.265.533l1.438 1.275a.28.28 0 0 0 .462-.158 6.82 6.82 0 0 0 .099-1.725c-.232-3.376-2.966-6.092-6.345-6.3-3.873-.24-7.11 2.79-7.214 6.588-.1 3.7 2.933 6.892 6.634 6.974a6.75 6.75 0 0 0 4.136-1.294l7.212 6.394a.48.48 0 0 0 .797-.36V.456A.456.456 0 0 0 23.54 0Z"},cloudflare:{title:"Cloudflare",fill:"#F38020",d:"M16.5088 16.8447c.1475-.5068.0908-.9707-.1553-1.3154-.2246-.3164-.6045-.499-1.0615-.5205l-8.6592-.1123a.1559.1559 0 0 1-.1333-.0713c-.0283-.042-.0351-.0986-.021-.1553.0278-.084.1123-.1484.2036-.1562l8.7359-.1123c1.0351-.0489 2.1601-.8868 2.5537-1.9136l.499-1.3013c.0215-.0561.0293-.1128.0147-.168-.5625-2.5463-2.835-4.4453-5.5499-4.4453-2.5039 0-4.6284 1.6177-5.3876 3.8614-.4927-.3658-1.1187-.5625-1.794-.499-1.2026.119-2.1665 1.083-2.2861 2.2856-.0283.31-.0069.6128.0635.894C1.5683 13.171 0 14.7754 0 16.752c0 .1748.0142.3515.0352.5273.0141.083.0844.1475.1689.1475h15.9814c.0909 0 .1758-.0645.2032-.1553l.12-.4268zm2.7568-5.5634c-.0771 0-.1611 0-.2383.0112-.0566 0-.1054.0415-.127.0976l-.3378 1.1744c-.1475.5068-.0918.9707.1543 1.3164.2256.3164.6055.498 1.0625.5195l1.8437.1133c.0557 0 .1055.0263.1329.0703.0283.043.0351.1074.0214.1562-.0283.084-.1132.1485-.204.1553l-1.921.1123c-1.041.0488-2.1582.8867-2.5527 1.914l-.1406.3585c-.0283.0713.0215.1416.0986.1416h6.5977c.0771 0 .1474-.0489.169-.126.1122-.4082.1757-.837.1757-1.2803 0-2.6025-2.125-4.727-4.7344-4.727"},upstash:{title:"Upstash",fill:"#00E9A3",d:"M13.8027 0C11.193 0 8.583.9952 6.5918 2.9863c-3.9823 3.9823-3.9823 10.4396 0 14.4219 1.9911 1.9911 5.2198 1.9911 7.211 0 1.991-1.9911 1.991-5.2198 0-7.211L12 12c.9956.9956.9956 2.6098 0 3.6055-.9956.9955-2.6099.9955-3.6055 0-2.9866-2.9868-2.9866-7.8297 0-10.8164 2.9868-2.9868 7.8297-2.9868 10.8164 0l1.8028-1.8028C19.0225.9952 16.4125 0 13.8027 0zM12 12c-.9956-.9956-.9956-2.6098 0-3.6055.9956-.9955 2.6098-.9955 3.6055 0 2.9867 2.9868 2.9867 7.8297 0 10.8164-2.9867 2.9868-7.8297 2.9868-10.8164 0l-1.8028 1.8028c3.9823 3.9822 10.4396 3.9822 14.4219 0 3.9823-3.9824 3.9823-10.4396 0-14.4219-.9956-.9956-2.3006-1.4922-3.6055-1.4922-1.3048 0-2.6099.4966-3.6054 1.4922-1.9912 1.9912-1.9912 5.2198 0 7.211z"},mixpanel:{title:"Mixpanel",fill:"#7856FF",d:"M6.967 9.996h3.053c-.763-.477-1.048-1.145-1.431-2.384L7.443 3.366C6.919 1.458 6.49.551 4.39.551H.004v1.145h.621c1.286 0 1.431.477 1.814 1.908L3.44 7.326c.524 1.814 1.337 2.67 3.53 2.67h-.003Zm7.06 0h3.053c2.194 0 2.956-.86 3.484-2.67l1.001-3.722c.382-1.431.57-1.908 1.814-1.908H24V.551h-4.34c-2.146 0-2.576.86-3.053 2.815l-1.145 4.246c-.384 1.286-.673 1.907-1.435 2.384Zm-4.007 4.008h4.007V9.996H10.02v4.008ZM0 23.449h4.39c2.1 0 2.529-.907 3.053-2.815l1.146-4.246c.383-1.239.668-1.907 1.431-2.384H6.967c-2.194 0-3.007.86-3.531 2.67l-1.001 3.722c-.383 1.431-.524 1.907-1.814 1.907H0v1.146Zm19.65 0h4.343v-1.146h-.622c-1.239 0-1.431-.476-1.814-1.907l-1.001-3.722c-.524-1.814-1.286-2.67-3.483-2.67h-3.046c.762.477 1.041 1.098 1.424 2.384l1.145 4.246c.477 1.955.907 2.815 3.054 2.815Z"},gemini:{title:"Google Gemini",fill:"#8E75B2",d:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"}};var A1=J0(a5(),1),fZ="https://brand.volter.ai/logo/twin-world/svg?size=64&variant=mono";function s5({href:_,onClick:Q}){return A1.jsxDEV("h1",{children:A1.jsxDEV("a",{href:_,onClick:Q,children:[A1.jsxDEV("img",{src:fZ,alt:"",width:24,height:24,style:{verticalAlign:"middle"}},void 0,!1,void 0,this),A1.jsxDEV("span",{className:"brand-name",children:" Volter World"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}async function _2(_){return(await _.json().catch(()=>({}))).error??`answered ${_.status}`}function E_(_,Q,J=0,q=""){let[U,G]=_0.useState({state:"loading"});return _0.useEffect(()=>{G({state:"loading"})},[q,Q]),_0.useEffect(()=>{if(!Q)return;let Z=!0;return(async()=>{try{let F=await _(Q),X=F.ok?{state:"ok",data:await F.json()}:{state:"error",status:F.status,error:await _2(F)};if(Z)G(X)}catch(F){if(Z)G({state:"error",status:0,error:String(F)})}})(),()=>{Z=!1}},[q,Q,J]),U}function G0({load:_,what:Q,retry:J,lines:q=3}){if(_.state==="loading")return A1.jsxDEV(CZ,{lines:q,label:`Loading ${Q}…`},void 0,!1,void 0,this);if(_.state==="error")return A1.jsxDEV("div",{role:"alert",className:"error-state",children:[A1.jsxDEV("span",{children:["Could not read ",Q,": ",_.error]},void 0,!0,void 0,this),J?A1.jsxDEV("button",{type:"button",onClick:J,children:"Try again"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);return null}function CZ({lines:_=3,label:Q="Loading…"}){return A1.jsxDEV("div",{className:"skeleton",role:"status","aria-label":Q,children:Array.from({length:_},(J,q)=>A1.jsxDEV("span",{style:{width:`${[92,76,84,64,88][q%5]}%`}},q,!1,void 0,this))},void 0,!1,void 0,this)}function u1({iso:_,time:Q}){if(!_)return A1.jsxDEV("span",{children:"—"},void 0,!1,void 0,this);let J=new Date(_);return A1.jsxDEV("time",{dateTime:_,title:_,children:Number.isNaN(J.getTime())?_:Q?J.toLocaleTimeString():J.toLocaleString()},void 0,!1,void 0,this)}var D2=(_)=>_?new Date(_).toLocaleString():"—";function L8(_){let Q=_?Date.parse(_):Number.NaN;if(Number.isNaN(Q))return"—";let J=Math.max(0,Math.round((Date.now()-Q)/1000));return J<60?"just now":J<3600?`${Math.round(J/60)}m ago`:J<86400?`${Math.round(J/3600)}h ago`:`${Math.round(J/86400)}d ago`}function x1(_,Q){let J=Q.replace(/[_-]+/g," "),q=J.endsWith("s")?J:/[^aeiou]y$/.test(J)?`${J.slice(0,-1)}ies`:/(ch|sh|x)$/.test(J)?`${J}es`:`${J}s`;return`${_} ${_===1?J:q}`}var b2=(_)=>_.length<=1?_.join(""):`${_.slice(0,-1).join(", ")} and ${_[_.length-1]}`,SZ={github:"GitHub",openai:"OpenAI",aws:"AWS",hubspot:"HubSpot",paypal:"PayPal",youtube:"YouTube",tiktok:"TikTok",linkedin:"LinkedIn",xai:"xAI",sendgrid:"SendGrid",elevenlabs:"ElevenLabs",assemblyai:"AssemblyAI",planetscale:"PlanetScale",googleoauth:"Google sign-in",npm:"npm","npm-registry":"npm registry",posthog:"PostHog",mongodb:"MongoDB",pagerduty:"PagerDuty",mailgun:"Mailgun",turbopuffer:"turbopuffer"},M1=(_)=>SZ[_]??_.charAt(0).toUpperCase()+_.slice(1);function d1({vendor:_}){let Q=D_[_];return A1.jsxDEV("span",{className:Q?"mark logo":"mark","aria-hidden":"true",children:Q?A1.jsxDEV("svg",{viewBox:"0 0 24 24",children:A1.jsxDEV("path",{d:Q.d,fill:Q.fill},void 0,!1,void 0,this)},void 0,!1,void 0,this):M1(_).charAt(0)},void 0,!1,void 0,this)}var b_=(_)=>{_.currentTarget.closest("details")?.removeAttribute("open")},yZ="volter.theme",z8=()=>{try{let _=localStorage.getItem(yZ);return _==="light"||_==="dark"?_:"system"}catch{return"system"}};function x_(_=z8()){let Q=document.documentElement;if(_==="system")Q.removeAttribute("data-theme");else Q.setAttribute("data-theme",_)}function m_(){return _0.useEffect(()=>{let _=()=>[...document.querySelectorAll("details.menu[open], details.clock-more[open]")],Q=(q)=>{if(q.key!=="Escape"||document.querySelector("dialog[open]"))return;let U=_();if(!U.length)return;for(let G of U)G.removeAttribute("open");U[U.length-1].querySelector("summary")?.focus()},J=(q)=>{let U=q.target;for(let G of _())if(!U||!G.contains(U))G.removeAttribute("open")};return document.addEventListener("keydown",Q),document.addEventListener("click",J),()=>{document.removeEventListener("keydown",Q),document.removeEventListener("click",J)}},[]),null}function M0({open:_,onClose:Q,title:J,children:q,footer:U,wide:G}){let Z=_0.useRef(null),F=_0.useId();return _0.useEffect(()=>{let X=Z.current;if(!X)return;if(_&&!X.open){X.showModal();let Y=X.querySelector(".dialog-body :is(input:not([type=hidden]):not([disabled]), select, textarea)");if(Y?.focus(),Y instanceof HTMLInputElement&&Y.value&&/^(text|search|email|url)$/.test(Y.type))Y.select()}if(!_&&X.open)X.close()},[_]),A1.jsxDEV("dialog",{ref:Z,className:G==="window"?"dialog window":G?"dialog wide":"dialog","aria-labelledby":F,onClose:Q,onCancel:(X)=>{X.preventDefault(),Q()},onMouseDown:(X)=>{if(X.target===Z.current)Q()},children:_?A1.jsxDEV(A1.Fragment,{children:[A1.jsxDEV("div",{className:"dialog-head",children:[A1.jsxDEV("h2",{id:F,children:J},void 0,!1,void 0,this),A1.jsxDEV("button",{type:"button",className:"icon-button","aria-label":"Close",onClick:Q,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("div",{className:"dialog-body",children:q},void 0,!1,void 0,this),U?A1.jsxDEV("div",{className:"dialog-foot",children:U},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null},void 0,!1,void 0,this)}var K8="volter:confirm";function p0(_){return new Promise((Q)=>{window.dispatchEvent(new CustomEvent(K8,{detail:{ask:_,resolve:Q}}))})}function g_(){let[_,Q]=_0.useState(null),[J,q]=_0.useState("");_0.useEffect(()=>{let F=(X)=>{q(""),Q(X.detail)};return window.addEventListener(K8,F),()=>window.removeEventListener(K8,F)},[]);let U=(F)=>{_?.resolve(F),Q(null)},G=_?.ask,Z=!G?.typed||J===G.typed;return A1.jsxDEV(M0,{open:Boolean(_),onClose:()=>U(!1),title:G?.title??"",footer:A1.jsxDEV(A1.Fragment,{children:[A1.jsxDEV("button",{type:"button",onClick:()=>U(!1),children:"Cancel"},void 0,!1,void 0,this),A1.jsxDEV("button",{type:"button",className:G?.danger?"danger-button":"primary",disabled:!Z,onClick:()=>U(!0),children:G?.action},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:[G?.body?A1.jsxDEV("div",{className:"confirm-body",children:G.body},void 0,!1,void 0,this):null,G?.typed?A1.jsxDEV("div",{className:"typed-confirm",children:[A1.jsxDEV("p",{children:["Type ",A1.jsxDEV("code",{children:G.typed},void 0,!1,void 0,this)," to confirm."]},void 0,!0,void 0,this),A1.jsxDEV("input",{autoFocus:!0,"aria-label":`Type ${G.typed} to confirm`,value:J,onChange:(F)=>q(F.target.value),onKeyDown:(F)=>{if(F.key==="Enter"&&Z)U(!0)},autoComplete:"off",spellCheck:!1},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}var Y8="volter:toast";function l1(_,Q="ok"){window.dispatchEvent(new CustomEvent(Y8,{detail:{text:_,kind:Q}}))}function p_(){let[_,Q]=_0.useState([]);return _0.useEffect(()=>{let J=0,q=(U)=>{let{text:G,kind:Z}=U.detail,F=++J;if(Q((X)=>[...X.slice(-3),{id:F,text:G,kind:Z}]),Z!=="error")setTimeout(()=>Q((X)=>X.filter((Y)=>Y.id!==F)),4500)};return window.addEventListener(Y8,q),()=>window.removeEventListener(Y8,q)},[]),A1.jsxDEV("div",{className:"toasts",role:"region","aria-label":"Notifications",children:_.map((J)=>A1.jsxDEV("div",{className:`toast ${J.kind}`,role:J.kind==="error"?"alert":"status",children:[A1.jsxDEV("span",{children:J.text},void 0,!1,void 0,this),A1.jsxDEV("button",{type:"button",className:"icon-button","aria-label":"Dismiss",onClick:()=>Q((q)=>q.filter((U)=>U.id!==J.id)),children:"✕"},void 0,!1,void 0,this)]},J.id,!0,void 0,this))},void 0,!1,void 0,this)}function W8({value:_,label:Q,secret:J}){let[q,U]=_0.useState(!1);return A1.jsxDEV("div",{className:"copy-field",children:[Q?A1.jsxDEV("span",{className:"copy-label",children:Q},void 0,!1,void 0,this):null,A1.jsxDEV("div",{className:"copy-row",children:[A1.jsxDEV("input",{readOnly:!0,value:_,"aria-label":Q??"Value",onFocus:(Z)=>Z.currentTarget.select(),spellCheck:!1},void 0,!1,void 0,this),A1.jsxDEV("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(_).then(()=>{U(!0),setTimeout(()=>U(!1),1600),l1(J?"Copied. Keep it somewhere safe":"Copied")}).catch(()=>l1("Your browser would not copy it: select it and copy","error"))},children:q?"Copied":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function c_({label:_,items:Q}){return A1.jsxDEV("details",{className:"menu row-menu",children:[A1.jsxDEV("summary",{className:"icon-button",role:"button","aria-haspopup":"menu","aria-label":_,title:_,children:"⋯"},void 0,!1,void 0,this),A1.jsxDEV("div",{className:"popover menu-list",role:"menu",children:Q.filter((J)=>Boolean(J)).map((J)=>J.href?A1.jsxDEV("a",{role:"menuitem",href:J.href,className:J.danger?"danger-item":void 0,onClick:b_,children:J.label},J.label,!1,void 0,this):A1.jsxDEV("button",{type:"button",role:"menuitem",disabled:J.disabled,className:J.danger?"danger-item":void 0,onClick:(q)=>{b_(q),J.onSelect?.()},children:J.label},J.label,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function X5({title:_,children:Q,action:J}){return A1.jsxDEV("div",{className:"empty-state",children:[A1.jsxDEV("p",{className:"empty-title",children:_},void 0,!1,void 0,this),Q?A1.jsxDEV("div",{className:"empty-body",children:Q},void 0,!1,void 0,this):null,J?A1.jsxDEV("div",{className:"empty-action",children:J},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function l_(){return _0.useEffect(()=>{let _=(J)=>{let q=document.querySelector("main.app"),U=J.target;if(q?.hasAttribute("data-drawer")&&U&&!U.closest(".side")&&!U.closest(".drawer-button"))q.removeAttribute("data-drawer")},Q=(J)=>{if(J.key==="Escape")kZ()};return document.addEventListener("click",_),document.addEventListener("keydown",Q),()=>{document.removeEventListener("click",_),document.removeEventListener("keydown",Q)}},[]),A1.jsxDEV("button",{type:"button",className:"icon-button drawer-button","aria-label":"Menu",onClick:()=>{document.querySelector("main.app")?.toggleAttribute("data-drawer")},children:"☰"},void 0,!1,void 0,this)}var kZ=()=>{document.querySelector("main.app")?.removeAttribute("data-drawer")};function a4(_={}){let Q=(q,U)=>_.tools?`${U} (\`${q}\`)`:`\`${q}\``,J=["Set up Volter World for this app, so its calls to Stripe, Slack, GitHub, OpenAI and the other services it uses go to local twins instead of the real APIs. The app keeps its real SDKs and code.","",_.tools?"1. You have the Volter World tools (volter mcp). If the `volter` command is missing, install it: `npm install -g @volter/world`.":"1. Install the command and your agent tooling: `npm install -g @volter/world`, then `volter agents install --yes`.",`2. In the app's folder, ${Q("volter world init --install","world_init")}: it detects the vendors the app calls and installs their twins. Show me the vendors it detected and why, before keeping them.`,`3. ${_.tools?"Start it with world_up":"Start it: `volter world up`"}, then run the tests inside it: ${Q("volter world run -- <the test command>","world_run")}. Fix anything that fails because a call went to the real service.`,`4. Tell me what the app did at each vendor (${Q("volter world log","world_log")}), and give me the dashboard link (${_.tools?"world_view":"`volter world view --no-open`, started in the background: it keeps running"}).`];if(_.platform){let q=_.world??"<org>/<world>";J.push(`5. Share it with my team on ${_.platform}: ${Q(`volter login ${_.platform}`,"platform_login")} gives a link and a code for me to approve in my browser. Once I have, link it with ${Q(`volter remote add origin ${q} --create`,"remote_link with create: true")}${_.world?"":" (ask me for <org>/<world>)"}, then send what the app did: ${Q('volter world changeset -m "<what and why>"',"world_changeset")} and ${Q("volter world push","world_push")}.`)}return J.push("","The guide: https://world.volter.ai/docs/guides/use-with-a-coding-agent.md"),J.join(`
|
|
35
|
-
`)}var r_={"git-commit-horizontal":[["rect",{x:"9",y:"9",width:"6",height:"6"}],["path",{d:"M3 12h6M15 12h6"}]],"arrow-down-to-line":[["path",{d:"M12 17V3"}],["path",{d:"m6 11 6 6 6-6"}],["path",{d:"M19 21H5"}]],"arrow-up-from-line":[["path",{d:"m18 9-6-6-6 6"}],["path",{d:"M12 3v14"}],["path",{d:"M5 21h14"}]],"git-branch":[["rect",{x:"4",y:"3",width:"4",height:"4"}],["rect",{x:"4",y:"17",width:"4",height:"4"}],["rect",{x:"16",y:"5",width:"4",height:"4"}],["path",{d:"M6 7v10M18 9v2a4 4 0 0 1-4 4H6"}]],monitor:[["rect",{x:"3",y:"4",width:"18",height:"13"}],["path",{d:"M8 21h8M12 17v4"}]],vault:[["rect",{width:"18",height:"18",x:"3",y:"3"}],["rect",{x:"6.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m7.9 7.9 2.7 2.7"}],["rect",{x:"15.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m13.4 10.6 2.7-2.7"}],["rect",{x:"6.3",y:"15.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m7.9 16.1 2.7-2.7"}],["rect",{x:"15.3",y:"15.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m13.4 13.4 2.7 2.7"}],["circle",{cx:"12",cy:"12",r:"2"}]],settings:[["circle",{cx:"12",cy:"12",r:"3"}],["circle",{cx:"12",cy:"12",r:"7"}],["path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9L7 7M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1"}]],history:[["path",{d:"M3 12a9 9 0 1 0 3-6.7"}],["path",{d:"M3 4v5h5"}],["path",{d:"M12 7v5l3 3"}]],activity:[["path",{d:"M2 12h4l3-8 6 16 3-8h4"}]],"file-diff":[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M9 10h6"}],["path",{d:"M12 13V7"}],["path",{d:"M9 17h6"}]],"square-plus":[["rect",{x:"4",y:"4",width:"16",height:"16"}],["path",{d:"M12 8v8M8 12h8"}]],"square-minus":[["rect",{width:"18",height:"18",x:"3",y:"3"}],["path",{d:"M8 12h8"}]],"square-dot":[["rect",{width:"18",height:"18",x:"3",y:"3"}],["rect",{x:"10.8",y:"10.8",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],cloud:[["path",{d:"M7 19a5 5 0 0 1-.5-10A6 6 0 0 1 18 8a4.5 4.5 0 0 1 .5 11z"}]],"refresh-cw":[["path",{d:"M20 12a8 8 0 0 1-14.3 4.9M4 12a8 8 0 0 1 14.3-4.9"}],["path",{d:"M19 3v5h-5M5 21v-5h5"}]],clock:[["circle",{cx:"12",cy:"12",r:"9"}],["path",{d:"M12 7v5l3 3"}]],"key-round":[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z"}],["rect",{x:"15.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],plug:[["path",{d:"M9 3v5M15 3v5M6 8h12v4a6 6 0 0 1-12 0zM12 18v3"}]],"list-checks":[["path",{d:"M11 6h9M11 12h9M11 18h9"}],["path",{d:"M3 6l1.5 1.5L7 5M3 12l1.5 1.5L7 11M3 18l1.5 1.5L7 17"}]],palette:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"}],["rect",{x:"12.3",y:"5.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"16.3",y:"9.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"5.3",y:"11.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"7.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],check:[["path",{d:"M4 12l5 5L20 6"}]],plus:[["path",{d:"M12 4v16M4 12h16"}]],"chevron-down":[["path",{d:"M5 9l7 7 7-7"}]],"external-link":[["path",{d:"M14 4h6v6M20 4l-9 9"}],["path",{d:"M18 14v6H4V6h6"}]],"table-2":[["path",{d:"M3 9h18"}],["path",{d:"M9 3v18"}],["rect",{x:"3",y:"3",width:"18",height:"18"}]],"scroll-text":[["path",{d:"M15 12h-5"}],["path",{d:"M15 8h-5"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3"}]],"layout-grid":[["rect",{x:"4",y:"4",width:"7",height:"7"}],["rect",{x:"13",y:"4",width:"7",height:"7"}],["rect",{x:"4",y:"13",width:"7",height:"7"}],["rect",{x:"13",y:"13",width:"7",height:"7"}]],globe:[["circle",{cx:"12",cy:"12",r:"9"}],["path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"}]],"arrow-left":[["path",{d:"M20 12H5M11 6l-6 6 6 6"}]],link:[["path",{d:"M9 15l6-6"}],["path",{d:"M11 6l2-2a4.2 4.2 0 0 1 6 6l-2 2M13 18l-2 2a4.2 4.2 0 0 1-6-6l2-2"}]],user:[["circle",{cx:"12",cy:"8",r:"4"}],["path",{d:"M4 21v-1a6 6 0 0 1 6-6h4a6 6 0 0 1 6 6v1"}]],"log-out":[["path",{d:"M10 4H4v16h6M9 12h11M16 8l4 4-4 4"}]]};var $=J0(a5(),1),t4="volter.console.token",n5=document.getElementById("root"),R1=n5.dataset.base??"/-/console",k1=window.location.origin,l0=(n5.dataset.worlds??k1).replace(/\/+$/,""),QQ=(n5.dataset.names??"").split(",").filter((_)=>_!==""),J2=n5.dataset.worldOrigin==="1",p2=window.fetch.bind(window),W2="(session)",JQ="(pass)",t5=(_)=>{try{if(_&&!J2)sessionStorage.setItem(t4,_);else sessionStorage.removeItem(t4);localStorage.removeItem(t4)}catch{}},$Q="volter.console.portal",qQ=(_)=>{try{if(typeof _==="string"&&/^https?:$/.test(new URL(_).protocol))sessionStorage.setItem($Q,new URL(_).origin)}catch{}},vZ=()=>{return c2.get("token")??""},Z0=()=>{try{let _=sessionStorage.getItem($Q)??"";return _&&/^https?:$/.test(new URL(_).protocol)?new URL(_).origin:""}catch{return""}},jZ=()=>{let _=vZ();if(J2){if(t5(""),c2.get("pass"))return JQ;let Q=new URLSearchParams(window.location.search).has("signin");if(Q)try{window.history.replaceState(null,"",window.location.pathname+window.location.hash)}catch{}return _||(Q?"":W2)}if(_)return t5(_),_;try{return sessionStorage.getItem(t4)??""}catch{return""}};function t1(_){let Q=_.trim();if(/not ready/i.test(Q)&&/(never verified|not verified|no approvals)/i.test(Q)){let G=[],Z=[];if(/(never verified|not verified)/i.test(Q))G.push("it is not verified yet"),Z.push("verify");if(/no approvals/i.test(Q))G.push("no one has approved it"),Z.push("approve");return{text:`Not ready to deploy: ${b2(G)}.`,acts:Z}}let J=/no credential (?:is )?sealed for ([a-z0-9_-]+)/i.exec(Q);if(J)return{text:`No credential is sealed for ${M1(J[1])}: seal one in Settings › Vault.`,acts:["vault"]};if(/has no origin/i.test(Q))return{text:"This World has no remote: name one in Settings › Remote.",acts:["remote"]};let q=/the ([a-z0-9_-]+) twin has no root/i.exec(Q)??/:\s*([a-z0-9_, -]+?) (?:has|have) no root/i.exec(Q);if(q){let G=q[1].split(/,\s*/).filter(Boolean).map(M1);return{text:`${b2(G)} ${G.length===1?"is":"are"} not connected to ${G.length===1?"its":"their"} real service: Settings › Real services.`,acts:["settings"]}}if(/opening a seal is/i.test(Q))return{text:"A key cannot seal a credential: open the World as yourself.",acts:[]};if(/a key manages no keys/i.test(Q))return{text:"A key cannot manage keys: open the World as yourself.",acts:[]};if(/^PUT origin:/i.test(Q))return{text:"That is not a World's address: https://<host>/<org>/<world>",acts:[]};if(/^clock: \{/i.test(Q))return{text:"Pick a date and time.",acts:[]};if(/^advance: \{/i.test(Q))return{text:"Advance by a number and a unit: 90m, 12h, 3d.",acts:[]};if(/^branches: \{/i.test(Q))return{text:"That branch could not be made: pick now, or an instant before it.",acts:[]};if(/^approve: \{/i.test(Q))return{text:"Name who approves.",acts:[]};if(/a browser deploys only what it names/i.test(Q))return{text:"A deploy is confirmed by its name: use Deploy again.",acts:[]};if(/^no such door/i.test(Q))return{text:"This World does not answer that here.",acts:[]};return{text:Q.replace(/\s*[—–-]+\s*(?:run\s+)?`[^`]*`/g,"").replace(/\s*[—–-]+\s*(?:PUT|POST|GET|DELETE)\s+\/-\/\S+(?:\s*\{[^}]*\})?/g,"").replace(/\s*\(\s*`[^`]*`\s*\)/g,"").replace(/`(?:volter|printf|curl|npm|bun)[^`]*`/g,"").replace(/:\s*\{[^}]*\}/g,"").replace(/\(\s*\)/g,"").replace(/\s*;\s*(?=[;.]|$)/g,"").replace(/\s+([,.;:])/g,"$1").trim()||_,acts:[]}}var z0=async(_)=>t1(await _2(_)).text,VZ={vault:["vault","Open Vault"],remote:["remote","Open Remote"],settings:["settings/services","Open Real services"]};function UQ({name:_,acts:Q}){let J=Q.map((q)=>VZ[q]).filter((q)=>Boolean(q));if(J.length===0)return null;return $.jsxDEV($.Fragment,{children:J.map(([q,U])=>$.jsxDEV(r.default.Fragment,{children:[" ",$.jsxDEV("a",{href:`${R1}/${_}/~/${q}`,onClick:(G)=>{G.preventDefault(),j1([..._.split("/"),"~",...q.split("/")])},children:U},void 0,!1,void 0,this)]},q,!0,void 0,this))},void 0,!1,void 0,this)}async function y1(_,Q,J={}){return p2(`${k1}${Q}`,{...J,headers:{...J.headers??{},..._===W2?{}:{"x-volter-token":_},...J.body&&!J.headers?.["content-type"]?{"content-type":"application/json"}:{}}})}function V1(_,Q,J=0){let q=E_((U)=>y1(_,U),Q,J,_);return q.state==="error"?{...q,error:t1(q.error).text}:q}var L5=(_)=>{let Q=new Date(_),J=(q)=>String(q).padStart(2,"0");return`${Q.getFullYear()}-${J(Q.getMonth()+1)}-${J(Q.getDate())}T${J(Q.getHours())}:${J(Q.getMinutes())}`},i_=(_)=>new Date(Math.ceil(Date.parse(_)/60000)*60000).toISOString(),GQ=(_)=>_.operation==="observed"?`observed${_.provenance==="placeholder"?" (default data)":" (vendor)"}`:_.receipt?`${_.receipt.status??""} ${_.receipt.externalId??""} ${_.receipt.reason??""}`.trim():_.provenance==="placeholder"?"default data":"unpushed",uZ=(_)=>{let Q=/^[0-9a-f]{2}-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/.exec(_??"");return Q?{trace:Q[1],span:Q[2]}:null},R8="volter.console.snapshots",$2=()=>{try{return JSON.parse(sessionStorage.getItem(R8)??"{}")}catch{return{}}},ZQ=new Map,O8=(_)=>{if(J2){if(_.token||_.readToken)ZQ.set(_.name,{token:_.token,readToken:_.readToken});_={..._,token:"",readToken:""}}try{sessionStorage.setItem(R8,JSON.stringify({...$2(),[_.name]:_}))}catch{}},I8=(_)=>ZQ.get(_)?.readToken||$2()[_]?.readToken||"",o4=(_)=>{try{let Q=$2();delete Q[_],sessionStorage.setItem(R8,JSON.stringify(Q))}catch{}},c2=new URLSearchParams(window.location.hash.slice(1)),K5=c2.get("close")??"";function e5(_){if(typeof _!=="string")return null;let Q;try{Q=new URL(_)}catch{return null}return(Q.protocol==="http:"||Q.protocol==="https:")&&Q.origin===_.replace(/\/+$/,"")?Q:null}function P8(_){let Q=e5(_);if(!Q)return null;let J=new URL(k1);if(Q.protocol!==J.protocol||Q.port!==J.port)return null;if(Q.hostname===J.hostname)return Q.origin;let q=/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./;if(!q.test(Q.hostname))return null;let U=Q.hostname.replace(q,"");return U===J.hostname||q.test(J.hostname)&&U===J.hostname.replace(q,"")?Q.origin:null}function hZ(_){let Q;try{Q=JSON.parse(_)}catch{return null}let J=/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/i;if(typeof Q.name!=="string"||!J.test(Q.name)||typeof Q.parent!=="string"||!J.test(Q.parent)||typeof Q.at!=="string")return null;let q=Q.parentOrigin===void 0?void 0:P8(Q.parentOrigin);return{name:Q.name,parent:Q.parent,token:typeof Q.token==="string"?Q.token:"",readToken:typeof Q.readToken==="string"?Q.readToken:"",at:Q.at,expiresAt:typeof Q.expiresAt==="string"?Q.expiresAt:null,...q?{parentOrigin:q}:{}}}{let _=c2.get("snapshot");if(_){let Q=hZ(_);if(Q&&!$2()[Q.name])O8(Q)}}var FQ="volter.console.home",HQ=(_)=>{let Q=e5(_);if(!Q)return null;let J=new URL(k1).hostname,q=J.replace(/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./,"");return Q.hostname===J||Q.hostname===q?Q.origin:null};{let _=HQ(c2.get("home"));if(_)try{sessionStorage.setItem(FQ,_)}catch{}}if(["token","pass","portal","snapshot","home","close"].some((_)=>c2.has(_)))try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}var v0=()=>{try{return HQ(sessionStorage.getItem(FQ))??""}catch{return""}};function N8(_,Q,J,q){let U=new URLSearchParams({token:Q,home:v0()||k1}),G=$2()[J];if(G)U.set("snapshot",JSON.stringify(G));window.location.replace(`${_}${q??`${window.location.pathname}${window.location.search}`}#${U.toString()}`)}var _3=n5.dataset.route==="memory"?"":null;function $M(_){_3=_,window.dispatchEvent(new PopStateEvent("popstate"))}function x2(){return(_3??window.location.pathname.slice(R1.length)).split("/").filter(Boolean).map((_)=>{try{return decodeURIComponent(_)}catch{return""}})}var d_=/^[a-z0-9](?:[a-z0-9]|-(?!-))*$/i,Q2=(_,Q)=>_&&Q&&d_.test(_)&&d_.test(Q)?`${_}/${Q}`:"";function j1(_){let Q=`/${_.map(encodeURIComponent).join("/")}`;if(_3!==null)_3=Q;else window.history.pushState(null,"",`${R1}${Q}`);window.dispatchEvent(new PopStateEvent("popstate"))}function XQ(_,Q){let J=P8($2()[_]?.origin);if(J&&J!==k1){N8(J,I8(_),_,`${R1}/${Q.map(encodeURIComponent).join("/")}`);return}j1(Q)}async function a_(){let[_,Q]=x2(),J=Q2(_,Q),q=J?[J]:QQ;if(q.length===0){let U=await p2(`${k1}/-/ping`).catch(()=>null);q=U?.ok?(await U.json().catch(()=>({}))).worlds??[]:[]}q=q.filter((U)=>{let[G,Z,...F]=U.split("/");return F.length===0&&Q2(G,Z)===U});for(let U of q){let G=await p2(`${k1}/-/${U}/session`,{method:"POST"}).catch(()=>null);if(!G)continue;let Z=await G.json().catch(()=>({})),F=e5(Z.origin)?.origin;if(G.status===409&&F&&F!==k1)return window.location.replace(`${F}${R1}/${U}`),"moved";if(G.ok&&Z.local)return{token:typeof Z.token==="string"&&Z.token?Z.token:W2}}return null}function DZ(){let[_,Q]=r.useState(z8),J=(q)=>()=>{try{if(q==="system")localStorage.removeItem("volter.theme");else localStorage.setItem("volter.theme",q)}catch{}x_(q),Q(q)};return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"menu-label",children:"Appearance"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"theme-choice",role:"radiogroup","aria-label":"Appearance",children:["system","light","dark"].map((q)=>$.jsxDEV("button",{type:"button",role:"radio","aria-checked":_===q,onClick:J(q),children:q==="system"?"System":q==="light"?"Light":"Dark"},q,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function bZ(){let[_,Q]=r.useState(jZ()),[J,q]=r.useState(!1),[U,G]=r.useState(!1),[Z,F]=r.useState(""),[X,Y]=r.useState(null),[K,H]=r.useState(null),[L,z]=r.useState(x2());r.useEffect(()=>{let m=()=>z(x2());return window.addEventListener("popstate",m),()=>window.removeEventListener("popstate",m)},[]),r.useEffect(()=>{let[m,h]=x2(),o=Q2(m,h),[e,s]=o?o.split("/"):[],t=$2()[K5];if(!K5||!_||!e||!s||!t?.made||t.parent!==`${e}/${s}`||Q2(...K5.split("/"))!==K5)return;try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}y1(_,`/-/${e}/${s}/branches/${K5}`,{method:"DELETE"}).catch(()=>null).then(()=>o4(K5))},[_]);let W=r.useCallback(async(m)=>{if(H(null),!m){let s=await a_();if(s==="moved")return;if(s){if(q(!0),s.token!==W2)t5(s.token);Q(s.token);return}Y(null),G(!0);return}if(J2&&m===W2){let s=await a_();if(s==="moved")return;if(s)q(!0)}if(J2&&m===JQ){let[s,t]=x2(),p=Q2(s,t),[n,J1]=p?p.split("/"):[],q1=n&&J1?await p2(`${k1}/-/${n}/${J1}/session`,{method:"POST",headers:{"x-volter-pass":c2.get("pass")??""}}).catch(()=>null):null;if(!q1){H(`${k1} did not answer: no session was opened`),Y(null);return}if(!q1.ok){H(`${await z0(q1)}. Open it again from the platform.`),Y(null);return}qQ((await q1.json().catch(()=>({}))).issuer),Q(W2);return}if(J2&&m!==W2){let[s,t]=x2(),p=Q2(s,t),[n,J1]=p?p.split("/"):[],q1=n&&J1?await p2(`${k1}/-/${n}/${J1}/session`,{method:"POST",headers:{"x-volter-token":m}}).catch(()=>null):null;if(!q1){H(`${k1} did not answer: no session was opened`),Y(null);return}if(!q1.ok){let F1=await z0(q1);H(q1.status===401||q1.status===403?`That token does not open ${n}/${J1}.`:q1.status===409?`${n}/${J1}'s session lives at another origin: ${F1}`:`The World could not open a session (${q1.status}): ${F1}`),Y(null);return}Q(W2);return}let h=J2?new Response(null,{status:404}):await y1(m,"/-/worlds");if(h.ok){let{worlds:s}=await h.json();Y({kind:"admin",worlds:s});return}if(h.status===429){H("You are asking faster than the platform allows — wait a moment and reload."),Y(null);return}if(h.status>=500){let s=await h.json().catch(()=>({}));H(`The platform could not list your worlds${s.error?`: ${s.error}`:""}. Reload; if it stays, the status page says what is wrong.`),Y(null);return}let o=QQ;if(o.length===0){let s=await p2(`${k1}/-/ping`);if(!s.ok){H(`${k1} does not answer as a host`),Y(null);return}if(o=(await s.json()).worlds??[],o.length===0){H(`${k1} does not list its Worlds: open a World at its own address, ${k1}${R1}/<org>/<world>`),Y(null);return}}let e=[];for(let s of o){let t=await y1(m,`/-/${s}/twins`);if(t.ok){let p=await t.json();e.push({name:s,base:`${l0}/${s}`,twins:(p.twins??[]).map((n)=>({vendor:n.twin,protocol:n.protocol??null,root:n.root??null}))})}}if(e.length===0){H("This link or key opens no World here: it was revoked, or it has ended."),Y(null);return}Y({kind:"world",worlds:e})},[]);r.useEffect(()=>{W(_)},[_,W]);let I=(m)=>X?.kind==="admin"?X.worlds.find((h)=>h.name===m)?.token??_:_,[R,A]=r.useState("");if(!_||!X&&!K)return $.jsxDEV("main",{className:"app gate",children:$.jsxDEV("div",{className:"gate-window",children:[$.jsxDEV(s5,{href:`${R1}/`},void 0,!1,void 0,this),_&&!X&&!K||!_&&!U?$.jsxDEV("p",{className:"mode",children:"Opening…"},void 0,!1,void 0,this):$.jsxDEV("form",{onSubmit:(m)=>{m.preventDefault(),t5(Z.trim()),Q(Z.trim())},className:"stack",children:[$.jsxDEV("h2",{children:"Open a World"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"A World's token opens that World. A host's admin token opens every World it serves."},void 0,!1,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Token"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"token",type:"password",value:Z,onChange:(m)=>F(m.target.value),autoFocus:!0,autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",children:"Open"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);let N=()=>H("This link or key opens no World here: it was revoked, or it has ended."),B=()=>{if(J){window.location.reload();return}if(J2){let[m,h]=x2(),o=Q2(m,h),[e,s]=o?o.split("/"):[],t=()=>window.location.replace(Z0()?`${Z0()}/`:`${k1}${R1}/${e&&s?`${e}/${s}`:""}?signin`);if(setTimeout(t,2000),e&&s)p2(`${k1}/-/${e}/${s}/session/end`,{method:"POST"}).catch(()=>null).then(t);else t();return}if(X)for(let m of X.worlds)navigator.sendBeacon(`${m.base.replace(/\/[^/]+\/[^/]+$/,"")}/-/${m.name}/session/end`);t5(""),Q(""),F(""),Y(null),j1([])};if(K||!X)return $.jsxDEV("main",{className:"app gate",children:$.jsxDEV("div",{className:"gate-window",children:[$.jsxDEV(s5,{href:`${R1}/`},void 0,!1,void 0,this),$.jsxDEV("h2",{children:"Could not open it"},void 0,!1,void 0,this),$.jsxDEV("p",{role:"alert",children:K??"nothing answered"},void 0,!1,void 0,this),Z0()?$.jsxDEV("a",{className:"button primary",href:`${Z0()}/`,children:["Back to ",new URL(Z0()).host]},void 0,!0,void 0,this):$.jsxDEV("button",{type:"button",className:"primary",onClick:B,children:J?"Try again":"Use another token"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);let[T,O,C,f,S,w,k]=L,E=C==="~",l=/^[A-Za-z0-9_-]+$/,c=/^[^\u0000-\u001f\u007f]{1,200}$/,y=E||!C||!l.test(C)?void 0:C,D=S&&l.test(S)?w!==void 0&&f!=="changes"&&f!=="screens"?Q2(S,w)||void 0:S:void 0,v=f==="changes"&&S==="changesets"&&w&&l.test(w)?w:f==="screens"&&w&&k&&/^[A-Za-z0-9_.-]+$/.test(w)&&c.test(k)?`${w}:${k}`:void 0,x=Q2(T,O),V=x?$2()[x]??null:null,b=(m)=>I8(m)||I(m),P=V?X.kind==="admin"?X.worlds.find((m)=>m.name===V.parent)?.token??null:X.worlds.some((m)=>m.name===V.parent)?_:null:null,j=async(m)=>{let h=P8(m.parentOrigin);if(h&&h!==k1){o4(m.name),window.location.assign(`${h}${R1}/${m.parent}#close=${encodeURIComponent(m.name)}`);return}if(m.made)await y1(I(m.parent),`/-/${m.parent}/branches/${m.name}`,{method:"DELETE"}).catch(()=>null),o4(m.name);j1(m.parent.split("/"))};return $.jsxDEV("main",{className:x?"app workspace":"app home",children:[x?null:$.jsxDEV("header",{children:[x?$.jsxDEV(l_,{},void 0,!1,void 0,this):null,$.jsxDEV(s5,{href:`${v0()&&v0()!==k1?v0():""}${R1}/`,onClick:(m)=>{if(v0()&&v0()!==k1)return;m.preventDefault(),j1([])}},void 0,!1,void 0,this),$.jsxDEV("nav",{"aria-label":"breadcrumb",className:"crumbs",children:[x?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),$.jsxDEV("span",{children:x.split("/")[0]},void 0,!1,void 0,this),$.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${R1}/${x}`,className:"crumb-world",onClick:(m)=>{m.preventDefault(),j1(x.split("/"))},children:x.split("/")[1]},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,y?$.jsxDEV("span",{children:[" / ",y]},void 0,!0,void 0,this):null,E&&f==="trace"?$.jsxDEV("span",{children:" / trace"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),Z0()?$.jsxDEV("a",{href:`${Z0()}/${x?encodeURIComponent(x.split("/")[0]):""}`,title:`Back to the platform at ${new URL(Z0()).host}`,className:"back-link",children:["← ",$.jsxDEV("span",{className:"back-text",children:x?`${x.split("/")[0]}'s Worlds`:new URL(Z0()).host},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,x?null:$.jsxDEV("span",{className:"mode",children:J?"on this machine":R?`signed in as ${R}`:X.kind==="admin"?"host: admin":"opened with a link or key"},void 0,!1,void 0,this),x||J?null:$.jsxDEV("button",{onClick:B,children:"Sign out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x?$.jsxDEV(gZ,{name:x,token:b(x),twin:y,tab:E?f??"overview":"overview",arg:E?D:void 0,...E&&v?{sub:v}:{},admin:V?null:X.kind==="admin"?_:null,snapshot:V,parentToken:P,who:{local:J,person:R||null,admin:X.kind==="admin"},onSignOut:B,onReturn:j,opens:(m)=>!!$2()[m]||X.kind==="admin"&&X.worlds.some((h)=>h.name===m),onRemoved:()=>{W(_),j1([])},onWho:A,onEnded:N,worlds:X.worlds.map((m)=>m.name)},x,!1,void 0,this):$.jsxDEV(EZ,{mode:X,admin:X.kind==="admin"?_:null,reload:()=>W(_)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function EZ({mode:_,admin:Q,reload:J}){let[q,U]=r.useState(""),[G,Z]=r.useState(""),[F,X]=r.useState(""),[Y,K]=r.useState(null),H=async(f)=>{if(!await p0({title:`Rotate the tokens of ${f}?`,body:"Every app, script and person holding the current tokens loses access at once. The new ones are shown once.",action:"Rotate tokens",danger:!0}))return;let S=await y1(Q,`/-/worlds/${f}/rotate`,{method:"POST"}),w=await S.json().catch(()=>({}));K(S.ok?`rotated ${f}: the new tokens are shown once — token ${w.token} · read token ${w.readToken}`:w.error?t1(w.error).text:`answered ${S.status}`),await J()},L=async(f)=>{let S=await y1(Q,`/-/worlds/${f}`,{method:"DELETE"}),w=await S.json().catch(()=>({}));K(S.ok?`removed ${f}`:w.error?t1(w.error).text:`answered ${S.status}`),await J()},[z,W]=r.useState(!1),[I,R]=r.useState(!1),[A,N]=r.useState(""),B=async(f)=>{f.preventDefault(),K(null),W(!0);try{let S=await y1(Q,"/-/worlds",{method:"POST",body:JSON.stringify({org:q,world:G,vendors:F.split(",").map((k)=>k.trim()).filter(Boolean)})}),w=await S.json();if(!S.ok){K(w.error?t1(w.error).text:`the host answered ${S.status}`);return}K(`provisioned ${w.name}`),Z(""),X(""),R(!1),await J()}finally{W(!1)}},T=A.trim().toLowerCase(),O=_.worlds.filter((f)=>!T||f.name.toLowerCase().includes(T)||f.twins.some((S)=>S.vendor.includes(T))),C=[...new Set(O.map((f)=>f.name.split("/")[0]))];return $.jsxDEV("section",{className:"home-window","aria-labelledby":"worlds",children:[$.jsxDEV("div",{className:"home-head",children:[$.jsxDEV("h2",{id:"worlds",children:"Worlds"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:[x1(_.worlds.length,"World")," ",Q?"this host serves":"this key opens"]},void 0,!0,void 0,this),Q?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{K(null),R(!0)},children:[$.jsxDEV(w1,{name:"plus",size:16},void 0,!1,void 0,this),"New World"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"home-find",children:$.jsxDEV("input",{type:"search",placeholder:"Filter by World or vendor","aria-label":"Filter Worlds",value:A,onChange:(f)=>N(f.target.value)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y&&!I?$.jsxDEV("p",{role:"status",className:"home-note",children:Y},void 0,!1,void 0,this):null,C.map((f)=>$.jsxDEV(r.default.Fragment,{children:[$.jsxDEV("p",{className:"menu-label home-org",children:f},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"home-list",children:O.filter((S)=>S.name.split("/")[0]===f).map((S)=>$.jsxDEV("li",{children:[$.jsxDEV("a",{href:`${R1}/${S.name}`,onClick:(w)=>{w.preventDefault(),j1(S.name.split("/"))},children:[$.jsxDEV(w1,{name:"globe",size:20},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:S.name.split("/")[1]},void 0,!1,void 0,this),$.jsxDEV("small",{children:$.jsxDEV("code",{children:S.base},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"home-vendors",children:S.twins.map((w)=>$.jsxDEV("span",{title:M1(w.vendor),children:$.jsxDEV(d1,{vendor:w.vendor},void 0,!1,void 0,this)},w.vendor,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q?$.jsxDEV("details",{className:"menu home-more",children:[$.jsxDEV("summary",{"aria-label":`More for ${S.name}`,children:"⋯"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"popover menu-list",children:[$.jsxDEV("button",{type:"button",onClick:(w)=>{w.currentTarget.closest("details")?.removeAttribute("open"),H(S.name)},children:"Rotate tokens…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"danger-item",onClick:(w)=>{w.currentTarget.closest("details")?.removeAttribute("open"),p0({title:`Remove ${S.name}?`,body:"The host stops serving it and its whole history goes with it. This cannot be undone.",action:"Remove World",danger:!0,typed:S.name}).then((k)=>{if(k)L(S.name)})},children:"Remove World…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},S.name,!0,void 0,this))},void 0,!1,void 0,this)]},f,!0,void 0,this)),O.length===0?$.jsxDEV("p",{className:"mode home-note",children:T?`No World matches ${A}.`:"No Worlds here yet."},void 0,!1,void 0,this):null,$.jsxDEV(M0,{open:I,onClose:()=>{if(!z)R(!1)},title:"New World",footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>R(!1),disabled:z,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"provision",className:"primary",disabled:z,children:z?"Making… (ten seconds or so)":"Make World"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"provision",onSubmit:B,className:"stack",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Org"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"org",value:q,onChange:(f)=>U(f.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"World"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"world",value:G,onChange:(f)=>Z(f.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Vendors"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"vendors",value:F,onChange:(f)=>X(f.target.value),placeholder:"stripe, slack",required:!0},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"A twin of each, with its default data."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y?$.jsxDEV("p",{role:"status",children:Y},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var xZ=["changes","events","trace","vendors","screens","canvas","branches","settings","remote","vault"],mZ=(_,Q)=>{let J=Q?.screens?.find((q)=>q.path.replace(/\/+$/,"")==="")??Q?.screens?.find((q)=>!/[{<]/.test(q.path));return Q&&J?`${l0}/${_}/${Q.twin}${J.path.startsWith("/")?J.path:`/${J.path}`}`:null},s_={verify:"verified",use:"used",issue:"issued",revoke:"revoked",rotate:"rotated",seed:"seeded",upsert:"saved",set:"set",start:"started",finish:"finished",fail:"failed",schedule:"scheduled",deliver:"delivered",like:"liked",follow:"followed",reply:"replied",create:"created",update:"updated",delete:"deleted",record:"recorded",remove:"removed",add:"added",send:"sent",post:"posted",postmessage:"posted",cancel:"canceled",close:"closed",open:"opened",publish:"published",upload:"uploaded",invite:"invited",archive:"archived",merge:"merged",refund:"refunded",capture:"captured",confirm:"confirmed",pay:"paid"};function N0(_){let Q=_.operation??_.op,J=(Q.includes(".")?Q.slice(Q.lastIndexOf(".")+1):Q).toLowerCase(),q=_.subject.type.replace(/[_-]+/g," ").trim(),U=`${q.charAt(0).toUpperCase()}${q.slice(1)}`,G=/(^|\.)twin\./.test(Q)||/^seed_/.test(J),Z=Q.replace(/[._]+/g," ").trim(),F=G?`${U} seeded`:s_[J]?`${U} ${s_[J]}`:`${Z.charAt(0).toUpperCase()}${Z.slice(1)}`,X=_.fields??{},Y=["title","name","email","text","subject","summary","description"].map((H)=>X[H]).find((H)=>typeof H==="string"&&H.trim()!=="")??null,K=Y===null?null:Y.replace(/<([@#!])[^|>]*\|([^>]+)>/g,(H,L,z)=>`${L==="!"?"@":L}${z}`).replace(/<(?:https?:[^|>]+)\|([^>]+)>/g,"$1").replace(/<(https?:[^>]+)>/g,"$1");return{what:F,label:K===null?null:K.length>80?`${K.slice(0,79)}…`:K}}var q2=(_)=>/token|password|secret|key|credential/i.test(_.subject.type)&&_.subject.id.length>6?`••••${_.subject.id.slice(-4)}`:_.subject.id;function gZ({name:_,token:Q,twin:J,tab:q,arg:U,sub:G,admin:Z,snapshot:F,parentToken:X,who:Y,onSignOut:K,onReturn:H,opens:L,onRemoved:z,onWho:W,onEnded:I,worlds:R=[]}){let[A,N]=r.useState("pending"),[B,T]=r.useState(null),[O,C]=r.useState(0),[f,S]=r.useState(null);r.useEffect(()=>{let p=!0;return T(null),y1(Q,`/-/${_}/session`,{method:"POST"}).then(async(n)=>{let J1=await n.json().catch(()=>({}));if(qQ(J1.issuer),J1.who)W?.(J1.who);S(typeof J1.signsAs==="string"?J1.signsAs:null);let q1=e5(J1.origin)?.origin;if(n.status===409&&q1&&q1!==k1){N8(q1,Q,_);return}if(!p)return;if(N(!n.ok?"unknown":J1.scope==="read"?"read":J1.scope==="write"?"write":"unknown"),!n.ok)T(J1.error?t1(J1.error).text:`answered ${n.status}`)}).catch((n)=>{if(p)N("unknown"),T(`the World did not answer: ${n instanceof Error?n.message:String(n)}`)}),()=>{p=!1}},[_,Q,O]);let w=B?{state:"error",error:B}:A==="pending"?{state:"pending"}:{state:"ok",scope:A},k=A==="write",E=(p)=>{if(p.status!==403)return;p.clone().json().then((n)=>{if(/read token|opens only reads|write access|reads only/i.test(n?.error??""))N("read")},()=>null)},[l,c]=r.useState(0);r.useEffect(()=>{let p=setInterval(()=>{if(!document.hidden)c((n)=>n+1)},5000);return()=>clearInterval(p)},[]);let[y,D]=r.useState(0),v=V1(Q,`/-/${_}/clock`,l+y);r.useEffect(()=>{if(J2&&!F&&v.state==="error"&&v.status===401)I?.()},[v,F,I]);let x=V1(Q,`/-/${_}/twins`),V=V1(Q,`/-/${_}/branches`,y),b=V1(Q,`/-/${_}/map`,Math.floor(l/2)),P=!(V.state==="error"&&(V.status===404||V.status===405)),j=xZ.includes(q)?q:"overview",m=x.state==="ok"?x.data.twins.map((p)=>p.twin):[];if(J&&x.state==="ok"&&!m.includes(J))return $.jsxDEV("main",{className:"center",children:$.jsxDEV(X5,{title:`${_} has no ${J}`,action:$.jsxDEV("a",{href:`${R1}/${_}`,onClick:(p)=>{p.preventDefault(),j1(_.split("/"))},children:["Open ",_]},void 0,!0,void 0,this),children:$.jsxDEV("p",{children:["No vendor of this World is called ",J,". Its changesets are under Changes › History."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);let h=j==="vendors"&&U?U:void 0,o=()=>{N("pending"),C((p)=>p+1)};if(j==="canvas"||j==="vendors"&&!h||q==="screens"&&!U)return $.jsxDEV(WF,{name:_,token:Q,twins:x,session:w,retry:o,snapshot:F,back:()=>j1(_.split("/")),canWrite:k&&!F},void 0,!1,void 0,this);let s=q==="settings"?{kind:"settings",tab:((p)=>KQ.find(([n])=>n===p)?.[0]??"account")(U)}:q==="remote"?{kind:"settings",tab:"remote"}:q==="vault"?{kind:"settings",tab:"vault"}:q==="branches"?{kind:"branches",...U?{open:U}:{}}:null,t=J?"vendor":q==="screens"&&U?"screen":j==="vendors"&&h?"vendor":q==="trace"?"trace":q==="events"?"events":q==="changes"&&U==="changesets"?"history":"changes";return $.jsxDEV(oZ,{name:_,token:Q,view:t,win:s,who:Y,snapshot:F,onReturn:H,onSignOut:K,worlds:R,session:w,retry:o,...t==="vendor"?{arg:J??h}:t==="events"||t==="trace"||t==="screen"?U?{arg:U}:{}:{},...G?{sub:G}:{},twins:x,map:b,branches:P?V:null,clock:v,canWrite:k&&!F,refused:E,signsAs:f,opens:L,tick:l,admin:Z,onRemoved:z,onClock:()=>D((p)=>p+1),scope:F?"read":A},void 0,!1,void 0,this)}function w1({name:_,size:Q=20}){return $.jsxDEV("svg",{className:"icon",viewBox:"0 0 24 24",width:Q,height:Q,fill:"none",stroke:"currentColor",strokeWidth:Q<=16?1.75:1.5,strokeLinecap:"square",strokeLinejoin:"miter","aria-hidden":"true",children:(r_[_]??[]).map(([J,q],U)=>r.default.createElement(J,{key:U,...q}))},void 0,!1,void 0,this)}function Q3(_){let Q=(J)=>{let q=(J.operation??J.op).toLowerCase();return q.includes(".")?q.slice(q.lastIndexOf(".")+1):q};if(_.some((J)=>/^(delete|remove|archive|revoke)/.test(Q(J))||J.fields?.deleted===!0))return{icon:"square-minus",word:"removed",tone:"removed"};if(/^(create|add|insert|issue|send|post|upload|invite|record|seed)/.test(Q(_[0])))return{icon:"square-plus",word:"made",tone:"added"};return{icon:"square-dot",word:"changed",tone:"changed"}}var KQ=[["account","Account","user"],["changesets","Changesets","git-commit-horizontal"],["remote","Remote","cloud"],["access","Access","key-round"],["services","Real services","plug"],["vault","Vault","vault"],["checks","Checks","list-checks"],["clock","Clock","clock"],["appearance","Appearance","palette"]],pZ=(_,Q)=>{let J=Q.split("/").pop()??Q,q=_.split("/").pop()??"";return J.startsWith(`${q}-`)?J.slice(q.length+1):J},m2=(_)=>_.replace(/^_+/,"").replace(/[_-]+/g," ");function YQ({record:_,history:Q}){let J=_.writes[_.writes.length-1],q=N0(J),U=Q3(_.writes),G=new Set(_.writes.map((H)=>H.id)),Z=_.writes[0].occurredAt,F={};if(Q){for(let H of Q)if(!G.has(H.id)&&!H.landsId&&!H.aliasOf&&H.subject.type===J.subject.type&&H.subject.id===J.subject.id&&H.occurredAt<=Z)Object.assign(F,H.fields??{})}let X={...F};for(let H of _.writes)Object.assign(X,H.fields??{});let Y=U.tone==="added"&&Object.keys(F).length===0,K=[...new Set([...Object.keys(F),...Object.keys(X)])].filter((H)=>!wQ(F[H],X[H]));return $.jsxDEV("div",{className:"ws-diff","aria-label":`${q.label??q2(J)}: its changes`,children:[$.jsxDEV("div",{className:"ws-diff-head",children:[$.jsxDEV("span",{className:`ws-kind ${U.tone}`,title:U.word,children:$.jsxDEV(w1,{name:U.icon,size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(d1,{vendor:_.twin},void 0,!1,void 0,this),$.jsxDEV("div",{className:"cell-label",children:[$.jsxDEV("b",{children:q.label??q2(J)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[M1(_.twin)," · ",J.subject.type.replace(/^_+/,"").replace(/[_-]+/g," ")," ",$.jsxDEV("code",{children:q2(J)},void 0,!1,void 0,this)," · ",U.word," here"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ol",{className:"ws-writes",children:_.writes.map((H)=>$.jsxDEV("li",{children:[$.jsxDEV("b",{children:N0(H).what},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(u1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",o5(H)]},void 0,!0,void 0,this)]},H.id,!0,void 0,this))},void 0,!1,void 0,this),Q===null?$.jsxDEV("p",{className:"mode pad",children:"Reading its history…"},void 0,!1,void 0,this):K.length===0?$.jsxDEV("p",{className:"mode pad",children:"No field holds a new value."},void 0,!1,void 0,this):$.jsxDEV("table",{className:"ws-fields","aria-label":"Fields before and after",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Field"},void 0,!1,void 0,this),Y?null:$.jsxDEV("th",{children:"Before"},void 0,!1,void 0,this),$.jsxDEV("th",{children:U.tone==="removed"?"After":"Now"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:K.map((H)=>$.jsxDEV("tr",{children:[$.jsxDEV("th",{scope:"row",children:$.jsxDEV("code",{children:H},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y?null:$.jsxDEV("td",{className:H in F?"was":"none",children:H in F?$.jsxDEV(U2,{v:F[H]},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:H in X?"now":"none",children:H in X?$.jsxDEV(U2,{v:X[H]},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},H,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function LQ({records:_,selected:Q,onPick:J,label:q}){let[U,G]=r.useState(()=>{try{return localStorage.getItem("volter.console.records")==="tree"}catch{return!1}}),Z=(Y)=>{G(Y);try{localStorage.setItem("volter.console.records",Y?"tree":"path")}catch{}},F=(Y,K)=>{let H=Y.writes[Y.writes.length-1],L=N0(H),z=Q3(Y.writes);return $.jsxDEV("li",{children:$.jsxDEV("button",{type:"button",className:[Q===Y.key?"on":"",K?"nested":""].join(" ").trim()||void 0,"aria-pressed":Q===Y.key,onClick:()=>J(Y.key),children:[K?null:$.jsxDEV(d1,{vendor:Y.twin},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:L.label??q2(H)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[m2(H.subject.type)," · ",L.what.split(" ").slice(-1)[0],Y.writes.length>1?` · ${x1(Y.writes.length,"write")}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:`ws-kind ${z.tone}`,title:z.word,"aria-label":z.word,children:$.jsxDEV(w1,{name:z.icon,size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},Y.key,!1,void 0,this)},X=[...new Set(_.map((Y)=>Y.twin))];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-view-switch",role:"group","aria-label":"List the records by",children:[$.jsxDEV("button",{type:"button","aria-pressed":!U,className:U?void 0:"on",onClick:()=>Z(!1),children:"Path"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button","aria-pressed":U,className:U?"on":void 0,onClick:()=>Z(!0),children:"Tree"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"ws-list","aria-label":q,children:U?X.map((Y)=>{let K=_.filter((H)=>H.twin===Y);return $.jsxDEV("li",{className:"ws-group",children:[$.jsxDEV("p",{className:"ws-group-head",children:[$.jsxDEV(d1,{vendor:Y},void 0,!1,void 0,this),$.jsxDEV("b",{children:M1(Y)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:K.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:K.map((H)=>F(H,!0))},void 0,!1,void 0,this)]},Y,!0,void 0,this)}):_.map((Y)=>F(Y,!1))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function cZ({name:_,token:Q,branches:J,opens:q,refused:U,onChanged:G}){let[Z,F]=r.useState(""),[X,Y]=r.useState(!1),K=J?.state==="ok"&&J.data.checkedOut||_.split("/")[1],H=J?.state==="ok"&&J.data.named?.length?J.data.named:[{name:K,running:!0}],L=J?.state==="ok"?J.data.branches:[],z=Z.trim().toLowerCase(),W=(R)=>!z||R.toLowerCase().includes(z),I=(R)=>{R.currentTarget.closest("details")?.removeAttribute("open")};return $.jsxDEV("details",{className:"menu ws-pick",children:[$.jsxDEV("summary",{title:"The branch served here",children:[$.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-pick-label",children:[$.jsxDEV("small",{children:"Branch"},void 0,!1,void 0,this),$.jsxDEV("b",{children:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(w1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"popover ws-branch-menu",children:[$.jsxDEV("div",{className:"ws-branch-find",children:[$.jsxDEV("input",{type:"search",placeholder:"Filter","aria-label":"Filter branches",value:Z,onChange:(R)=>F(R.target.value)},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:(R)=>{I(R),Y(!0)},disabled:!J,children:"New branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"This World"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-branch-list",children:H.filter((R)=>W(R.name)).map((R)=>$.jsxDEV("li",{className:R.name===K?"current":void 0,children:[$.jsxDEV("span",{className:"tick",children:R.name===K?$.jsxDEV(w1,{name:"check",size:16},void 0,!1,void 0,this):$.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"name",children:R.name},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:R.name===K?"served here":R.running?"running":"stopped"},void 0,!1,void 0,this)]},R.name,!0,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Branches of it"},void 0,!1,void 0,this),L.length===0?$.jsxDEV("p",{className:"mode ws-branch-none",children:"None yet. New branch makes one, from now or as the World was."},void 0,!1,void 0,this):$.jsxDEV("ul",{className:"ws-branch-list",children:L.filter((R)=>W(R.name)).map((R)=>{let A=$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"tick",children:$.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"name",children:pZ(_,R.name)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:R.at?.instant?$.jsxDEV($.Fragment,{children:["as of ",$.jsxDEV(u1,{iso:R.at.instant,time:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N=R.expiresAt?`Goes away ${new Date(R.expiresAt).toLocaleString()}`:"Kept";return $.jsxDEV("li",{children:q(R.name)?$.jsxDEV("a",{href:`${R1}/${R.name}`,title:N,onClick:(B)=>{B.preventDefault(),I(B),XQ(R.name,R.name.split("/"))},children:A},void 0,!1,void 0,this):$.jsxDEV("span",{title:`${N}. Its tokens went to whoever made it; it opens from their page.`,children:A},void 0,!1,void 0,this)},R.name,!1,void 0,this)})},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-branch-foot",children:$.jsxDEV("a",{href:`${R1}/${_}/~/branches`,onClick:(R)=>{R.preventDefault(),I(R),j1([..._.split("/"),"~","branches"])},children:"Manage branches…"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(AQ,{name:_,token:Q,open:X,onClose:()=>Y(!1),onMade:G,refused:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function zQ({name:_,view:Q,changes:J,changesets:q}){let U=(G)=>(Z)=>{Z.preventDefault(),j1([..._.split("/"),"~",...G])};return $.jsxDEV("nav",{className:"tabs ws-pane-tabs","aria-label":"Changes and history",children:[$.jsxDEV("a",{href:`${R1}/${_}/~/changes`,className:Q==="changes"?"on":void 0,"aria-current":Q==="changes"?"page":void 0,onClick:U(["changes"]),children:["Changes",J?$.jsxDEV("span",{className:"count",children:J},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("a",{href:`${R1}/${_}/~/changes/changesets`,className:Q==="history"?"on":void 0,"aria-current":Q==="history"?"page":void 0,onClick:U(["changes","changesets"]),children:["History",q?$.jsxDEV("span",{className:"count",children:q},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function lZ({name:_,token:Q,sets:J,sub:q,signsAs:U,canWrite:G,rooted:Z,refused:F,onChanged:X,changes:Y,withScreens:K,required:H}){let[L,z]=r.useState(null),[W,I]=r.useState(!1),R=J.state==="ok"?[...J.data.changesets].sort((S,w)=>w.createdAt.localeCompare(S.createdAt)):[],A=R.find((S)=>S.name===q)??R[0],N=r.useMemo(()=>{let S=new Map;for(let w of A?PQ(A):[]){let k=`${w.twin}:${w.entry.subject.type}:${w.entry.subject.id}`,E=S.get(k)??{key:k,twin:w.twin,writes:[]};E.writes.push(w.entry),S.set(k,E)}return[...S.values()]},[A]),B=N.find((S)=>S.key===L)??N[0],T=V1(Q,B?`/-/${_}/log/${B.twin}`:null),O={added:0,removed:0,changed:0};for(let S of N)O[Q3(S.writes).tone]=(O[Q3(S.writes).tone]??0)+1;let C=A?$3(A):null,f=A?NQ(A,H):null;return $.jsxDEV("div",{className:"ws-two",children:[$.jsxDEV("div",{className:"ws-files",children:[$.jsxDEV(zQ,{name:_,view:"history",changes:Y,changesets:R.length},void 0,!1,void 0,this),$.jsxDEV(G0,{load:J,what:"the changesets",lines:4},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-list ws-commits","aria-label":"Changesets",children:R.map((S)=>{let w=A?.name===S.name,k=$3(S).label==="Not sent";return $.jsxDEV("li",{children:$.jsxDEV("a",{href:`${R1}/${_}/~/changes/changesets/${S.name}`,className:w?"on":void 0,"aria-current":w?"true":void 0,onClick:(E)=>{E.preventDefault(),z(null),j1([..._.split("/"),"~","changes","changesets",S.name])},children:[$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:M8(S)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[S.owner??(S.cutBy?n4(S.cutBy):"unrecorded")," • ",$.jsxDEV(u1,{iso:S.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k?$.jsxDEV("span",{className:"ws-unpushed",title:"Not pushed to the remote yet",children:$.jsxDEV(w1,{name:"arrow-up-from-line",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},S.name,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-pane-right",children:[J.state==="ok"&&!A?$.jsxDEV(X5,{title:"No changesets yet",children:$.jsxDEV("p",{children:"Cut one from Changes: the cut box is at its foot."},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,A&&C&&f?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-commit-head",children:[$.jsxDEV("div",{className:"ws-commit-title",children:[$.jsxDEV("h3",{children:M8(A)},void 0,!1,void 0,this),$.jsxDEV("p",{className:"ws-commit-stat",children:[$.jsxDEV(w1,{name:"file-diff",size:16},void 0,!1,void 0,this)," ",x1(N.length,"changed record"),O.added?$.jsxDEV("span",{className:"plus",children:[" +",O.added]},void 0,!0,void 0,this):null,O.removed?$.jsxDEV("span",{className:"minus",children:[" −",O.removed]},void 0,!0,void 0,this):null,O.changed?$.jsxDEV("span",{className:"dot",children:[" •",O.changed]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode ws-commit-meta",children:[$.jsxDEV("code",{children:A.name},void 0,!1,void 0,this)," · ",$.jsxDEV(u1,{iso:A.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"ws-commit-who",children:[["Owner",A.owner??(A.cutBy&&/^(token|token:read)$|^key:(?!.* for:)/.test(A.cutBy)?"no person: a service’s":"unrecorded")],["Cut by",A.cutBy?A.pushedBy&&A.applied===null&&A.cutBy==="machine"?"the machine it was cut on":n4(A.cutBy):"unrecorded"],...A.pushedBy?[["Pushed by",n4(A.pushedBy)]]:[]].map(([S,w])=>$.jsxDEV("span",{children:[$.jsxDEV("span",{className:"mode",children:S},void 0,!1,void 0,this)," ",w]},S,!0,void 0,this))},void 0,!1,void 0,this),A.pushedBy?$.jsxDEV("p",{className:"mode ws-commit-meta",children:A.applied===null?"Owner and cut by are as the World it was cut in recorded them; pushed by is this World's own record.":"Owner and cut by are this World’s record; pushed by is as the remote recorded it."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>I(!0),title:"Where it went, the checks, the approvals; Verify, Approve and Deploy",children:[$.jsxDEV("span",{className:`badge cs-${C.tone}`,children:C.label},void 0,!1,void 0,this),$.jsxDEV("span",{className:`badge cs-${f.tone}`,children:f.label},void 0,!1,void 0,this),"Review…"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-two inner",children:[$.jsxDEV("div",{className:"ws-files",children:$.jsxDEV(LQ,{records:N,...B?{selected:B.key}:{},onPick:z,label:"Records it changed"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-detail",children:B?$.jsxDEV(YQ,{record:B,history:T.state==="ok"?T.data.entries:T.state==="error"?[]:null},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode pad",children:"It changes nothing."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(M0,{open:W,onClose:()=>I(!1),title:`Review: ${M8(A)}`,wide:!0,children:[$.jsxDEV(_Q,{name:_,token:Q,signsAs:U,c:A,canWrite:G,rooted:Z,refused:F,onChanged:X,part:"head",required:H},`h:${A.name}`,!1,void 0,this),$.jsxDEV(_Q,{name:_,token:Q,signsAs:U,c:A,canWrite:G,rooted:Z,refused:F,onChanged:X,part:"review",required:H},`r:${A.name}`,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function rZ({name:_,token:Q,vendors:J,vendor:q,tick:U}){let[G,Z]=r.useState(t_*4),[F,X]=r.useState(""),[Y,K]=r.useState(null),H=V1(Q,`/-/${_}/timeline?limit=${G}${q?`&twin=${encodeURIComponent(q)}`:""}`,Math.floor(U/2)),L=H.state==="ok"?HF(H.data.entries):[],z=[...new Set(L.map((O)=>N0(O.entry).what))].sort(),W=L.filter((O)=>!F||N0(O.entry).what===F),I=W.find((O)=>Y5(O)===Y)??W[0],R=(O)=>(C)=>{C.preventDefault(),K(null),j1([..._.split("/"),"~","events",...O?[O]:[]])},A=I?.entry.input&&typeof I.entry.input==="object"?I.entry.input.body:void 0,N=I?uZ(I.entry.traceparent):null,B=I?o_(I):null,T=I?UF(I.entry):[];return $.jsxDEV("div",{className:"ws-events",children:[$.jsxDEV("div",{className:"ws-filterbar",children:[$.jsxDEV("nav",{className:"ws-seg","aria-label":"Vendor",children:[$.jsxDEV("a",{href:`${R1}/${_}/~/events`,className:!q?"on":void 0,"aria-current":!q?"page":void 0,onClick:R(),children:"All"},void 0,!1,void 0,this),J.map((O)=>$.jsxDEV("a",{href:`${R1}/${_}/~/events/${O}`,className:q===O?"on":void 0,"aria-current":q===O?"page":void 0,onClick:R(O),children:[$.jsxDEV(d1,{vendor:O},void 0,!1,void 0,this),M1(O)]},O,!0,void 0,this))]},void 0,!0,void 0,this),$.jsxDEV("select",{"aria-label":"Operation",value:F,onChange:(O)=>{X(O.target.value),K(null)},children:[$.jsxDEV("option",{value:"",children:"Every operation"},void 0,!1,void 0,this),z.map((O)=>$.jsxDEV("option",{value:O,children:O},O,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-grid-wrap",children:[$.jsxDEV(G0,{load:H,what:"the events",lines:6},void 0,!1,void 0,this),$.jsxDEV("table",{className:"ws-grid","aria-label":"Events",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Time"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"What"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Record"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"By"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Receipt"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:W.map((O)=>{let C=N0(O.entry),f=o_(O),S=I&&Y5(O)===Y5(I);return $.jsxDEV("tr",{className:S?"on":void 0,"aria-selected":S,onClick:()=>K(Y5(O)),children:[$.jsxDEV("td",{className:"mono",children:$.jsxDEV(u1,{iso:O.entry.occurredAt,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(d1,{vendor:O.twin},void 0,!1,void 0,this),M1(O.twin)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("b",{children:C.what},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"ws-cell-clip",children:C.label?`“${C.label}”`:$.jsxDEV("code",{children:q2(O.entry)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:o5(O.entry,O.caller)},void 0,!1,void 0,this),$.jsxDEV("td",{children:f?$.jsxDEV("span",{className:f.bad?"badge cs-bad":f.status==="deployed"?"badge cs-done":"badge",children:f.status},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:GQ(O.entry)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},Y5(O),!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-event-detail",children:I?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-event-line",children:[$.jsxDEV("span",{className:"badge",children:MQ(I.entry)},void 0,!1,void 0,this),B?$.jsxDEV("span",{className:B.bad?"badge cs-bad":"badge cs-good",children:B.status},void 0,!1,void 0,this):null,$.jsxDEV("code",{children:[I.entry.subject.type,":",q2(I.entry)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(u1,{iso:I.entry.occurredAt},void 0,!1,void 0,this)," · ",o5(I.entry,I.caller)]},void 0,!0,void 0,this),N?$.jsxDEV("a",{href:`${R1}/${_}/~/trace/${N.trace}`,onClick:(O)=>{O.preventDefault(),j1([..._.split("/"),"~","trace",N.trace])},children:"Its trace →"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-event-panes",children:[$.jsxDEV("div",{role:"region","aria-label":"The request",children:[$.jsxDEV("h4",{children:"Request"},void 0,!1,void 0,this),A!==void 0?$.jsxDEV(ZF,{body:A},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode",children:"No request body: the World or the vendor wrote it."},void 0,!1,void 0,this),T.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h4",{children:"Usage"},void 0,!1,void 0,this),$.jsxDEV("dl",{className:"fields",children:T.map(([O,C])=>$.jsxDEV(r.default.Fragment,{children:[$.jsxDEV("dt",{children:O},void 0,!1,void 0,this),$.jsxDEV("dd",{children:C},void 0,!1,void 0,this)]},O,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{role:"region","aria-label":"What it wrote",children:[$.jsxDEV("h4",{children:"Written"},void 0,!1,void 0,this),$.jsxDEV(RQ,{fields:I.entry.fields},void 0,!1,void 0,this),$.jsxDEV("h4",{children:I.copies.length?"Receipts":"Receipt"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:I.copies.length?I.copies.map((O)=>O.entry.receipt?.status??"landed copy").join(" · "):FF(I.entry)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("p",{className:"mode pad",children:"Nothing written here yet."},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-foot mode",children:[$.jsxDEV("span",{children:[I?`${W.indexOf(I)+1} of ${W.length}`:W.length," events",q?` at ${M1(q)}`:""]},void 0,!0,void 0,this),H.state==="ok"&&H.data.next?$.jsxDEV("button",{type:"button",onClick:()=>Z((O)=>O+t_*4),children:"Load older"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function iZ({name:_,token:Q,id:J}){let q=/^[0-9a-f]{32}$/.test(J),U=V1(Q,q?`/-/${_}/timeline?trace=${J}&limit=500`:null),G=U.state==="ok"?[...U.data.entries].sort((H,L)=>-BQ(H,L)):[],[Z,F]=r.useState(null),X=G[0]?Date.parse(G[0].entry.occurredAt):0,Y=G.length?Math.max(1,Date.parse(G[G.length-1].entry.occurredAt)-X):1,K=[...new Set(G.map((H)=>H.twin))];return $.jsxDEV("div",{className:"ws-sheet ws-trace",children:[$.jsxDEV("p",{className:"crumbs-line",children:$.jsxDEV("a",{href:`${R1}/${_}/~/events`,onClick:(H)=>{H.preventDefault(),j1([..._.split("/"),"~","events"])},children:[$.jsxDEV(w1,{name:"arrow-left",size:16},void 0,!1,void 0,this)," Events"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("h2",{children:[G[0]?`${N0(G[0].entry).what} …`:"Trace"," ",$.jsxDEV("code",{className:"mode",children:J.slice(0,12)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!q?$.jsxDEV("p",{role:"alert",children:[J?`${J} is not a trace id`:"No trace named",": a W3C trace id is 32 hex characters."]},void 0,!0,void 0,this):$.jsxDEV(G0,{load:U,what:"the trace"},void 0,!1,void 0,this),G.length?$.jsxDEV("p",{className:"ws-trace-meta",children:["Started ",$.jsxDEV("b",{children:$.jsxDEV(u1,{iso:G[0].entry.occurredAt},void 0,!1,void 0,this)},void 0,!1,void 0,this)," · Took ",$.jsxDEV("b",{children:[Y," ms"]},void 0,!0,void 0,this)," · Vendors ",$.jsxDEV("b",{children:K.map(M1).join(", ")},void 0,!1,void 0,this)," · Writes ",$.jsxDEV("b",{children:G.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,U.state==="ok"&&G.length===0?$.jsxDEV(X5,{title:"Nothing in this World carries this trace",children:$.jsxDEV("p",{children:["An app instrumented with OpenTelemetry sends a ",$.jsxDEV("code",{children:"traceparent"},void 0,!1,void 0,this)," with each call, and every write that call makes keeps it, so one click reads across every vendor."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,G.length?$.jsxDEV("div",{className:"ws-spans",role:"table","aria-label":"The trace's writes",children:[$.jsxDEV("div",{className:"ws-span head",role:"row",children:[$.jsxDEV("span",{role:"columnheader",children:"Vendor and what"},void 0,!1,void 0,this),$.jsxDEV("span",{role:"columnheader",className:"ws-ticks",children:[$.jsxDEV("span",{children:"0 ms"},void 0,!1,void 0,this),$.jsxDEV("span",{children:[Math.round(Y/2)," ms"]},void 0,!0,void 0,this),$.jsxDEV("span",{children:[Y," ms"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.map((H)=>{let L=Date.parse(H.entry.occurredAt)-X,z=Y5(H),W=N0(H.entry);return $.jsxDEV(r.default.Fragment,{children:[$.jsxDEV("div",{className:Z===z?"ws-span on":"ws-span",role:"row",onClick:()=>F(Z===z?null:z),children:[$.jsxDEV("span",{role:"cell",className:"ws-span-name",children:[$.jsxDEV(d1,{vendor:H.twin},void 0,!1,void 0,this),$.jsxDEV("b",{children:M1(H.twin)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[W.what,W.label?` “${W.label}”`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{role:"cell",className:"ws-span-track",children:[$.jsxDEV("span",{className:"ws-span-dot",style:{left:`${L/Y*100}%`}},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-span-at mode",style:{left:`${L/Y*100}%`},children:["+",L," ms"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z===z?$.jsxDEV("div",{className:"ws-span-detail",children:[$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("code",{children:MQ(H.entry)},void 0,!1,void 0,this)," on ",$.jsxDEV("code",{children:[H.entry.subject.type,":",q2(H.entry)]},void 0,!0,void 0,this)," · ",o5(H.entry,H.caller)," · ",GQ(H.entry)]},void 0,!0,void 0,this),$.jsxDEV(RQ,{fields:H.entry.fields},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},z,!0,void 0,this)})]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function dZ({name:_,token:Q,vendor:J,withScreens:q,tick:U}){let G=V1(Q,`/-/${_}/checkpoint/${J}`,Math.floor(U/6)),Z=G.state==="ok"?G.data.tree.filter((T)=>T.deleted!==!0):[],F=[...new Set(Z.map((T)=>T.type))].map((T)=>({type:T,count:Z.filter((O)=>O.type===T).length})).sort((T,O)=>Number(T.type.startsWith("_"))-Number(O.type.startsWith("_"))||m2(T.type).localeCompare(m2(O.type))),[X,Y]=r.useState(null),[K,H]=r.useState(null),L=F.some((T)=>T.type===X)?X:F[0]?.type,z=Z.filter((T)=>T.type===L),W=z.find((T)=>T.id===K)??z[0],I=["name","email","title","text","description","subject","amount","percent_off","unit_amount","currency","status","channel","customer","product"],R=new Set(["id","type","object","livemode","created","updated","updatedAt","deleted"]),A=(T)=>!R.has(T)&&z.some((O)=>O[T]!==void 0&&O[T]!==null&&typeof O[T]!=="object"),N=[...new Set(z.flatMap((T)=>Object.keys(T)))],B=[...I.filter(A),...N.filter((T)=>!I.includes(T)&&A(T))].slice(0,4);return $.jsxDEV("div",{className:"ws-table-app",children:[$.jsxDEV("nav",{className:"ws-tables","aria-label":`${M1(J)}'s records`,children:[$.jsxDEV("div",{className:"ws-list-head",children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(d1,{vendor:J},void 0,!1,void 0,this),M1(J)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(G0,{load:G,what:"what it stores",lines:4},void 0,!1,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Stores"},void 0,!1,void 0,this),F.map((T)=>$.jsxDEV("a",{href:`#${T.type}`,className:L===T.type?"on":void 0,"aria-current":L===T.type?"true":void 0,onClick:(O)=>{O.preventDefault(),Y(T.type),H(null)},children:[$.jsxDEV(w1,{name:"table-2",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:m2(T.type)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"count",children:T.count},void 0,!1,void 0,this)]},T.type,!0,void 0,this)),$.jsxDEV("p",{className:"menu-label",children:"Also"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${R1}/${_}/~/events/${J}`,onClick:(T)=>{T.preventDefault(),j1([..._.split("/"),"~","events",J])},children:[$.jsxDEV(w1,{name:"activity",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Its events"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q?$.jsxDEV("a",{href:`${R1}/${_}/~/screens/${J}`,onClick:(T)=>{T.preventDefault(),j1([..._.split("/"),"~","screens",J])},children:[$.jsxDEV(w1,{name:"monitor",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Its screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-grid-wrap",children:[G.state==="ok"&&F.length===0?$.jsxDEV(X5,{title:`${M1(J)} stores nothing yet`,children:$.jsxDEV("p",{children:"What your app makes there shows here, by type."},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,z.length?$.jsxDEV("table",{className:"ws-grid","aria-label":`${m2(L??"")} records`,children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"id"},void 0,!1,void 0,this),B.map((T)=>$.jsxDEV("th",{children:T},T,!1,void 0,this)),$.jsxDEV("th",{children:"updated"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:z.map((T)=>$.jsxDEV("tr",{className:W?.id===T.id?"on":void 0,"aria-selected":W?.id===T.id,onClick:()=>H(T.id),children:[$.jsxDEV("td",{children:$.jsxDEV("code",{children:T.id},void 0,!1,void 0,this)},void 0,!1,void 0,this),B.map((O)=>$.jsxDEV("td",{className:"ws-cell-clip",children:T[O]===void 0||T[O]===null?$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this):String(T[O])},O,!1,void 0,this)),$.jsxDEV("td",{className:"mode",children:typeof T.updatedAt==="string"?$.jsxDEV(u1,{iso:T.updatedAt},void 0,!1,void 0,this):"—"},void 0,!1,void 0,this)]},T.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("aside",{className:"ws-record","aria-label":"The selected record",children:W?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-list-head",children:[$.jsxDEV("span",{children:m2(W.type)},void 0,!1,void 0,this),$.jsxDEV("code",{children:W.id},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("dl",{className:"ws-record-fields",children:Object.entries(W).filter(([T])=>T!=="type"&&T!=="id").map(([T,O])=>$.jsxDEV(r.default.Fragment,{children:[$.jsxDEV("dt",{children:T},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(U2,{v:O},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},T,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-foot mode",children:W?`${z.indexOf(W)+1} of ${x1(z.length,m2(L??"record"))}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function aZ({name:_,vendor:Q,url:J,mapError:q,holding:U,session:G,retry:Z}){return $.jsxDEV("div",{className:"ws-screen",children:[$.jsxDEV("div",{className:"ws-screen-bar",children:[$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(d1,{vendor:Q},void 0,!1,void 0,this),$.jsxDEV("b",{children:M1(Q)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:U},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${R1}/${_}/~/vendors/${Q}`,onClick:(F)=>{F.preventDefault(),j1([..._.split("/"),"~","vendors",Q])},children:[$.jsxDEV(w1,{name:"table-2",size:16},void 0,!1,void 0,this),"Its records"]},void 0,!0,void 0,this),J?$.jsxDEV("a",{href:J,target:"_blank",rel:"noopener noreferrer",children:[$.jsxDEV(w1,{name:"external-link",size:16},void 0,!1,void 0,this),"New tab"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),G.state==="ok"&&G.scope==="read"?$.jsxDEV("p",{className:"mode ws-screens-note",children:"You are looking read only: the screens browse, and refuse changes."},void 0,!1,void 0,this):null,q?$.jsxDEV("p",{role:"alert",className:"ws-screens-note",children:["The World did not say where its screens are: ",q]},void 0,!0,void 0,this):G.state==="pending"||J===void 0?$.jsxDEV("p",{className:"mode ws-screens-note",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,G.state==="error"?$.jsxDEV("p",{role:"alert",className:"ws-screens-note",children:["The World did not open its screens: ",G.error," ",$.jsxDEV("button",{type:"button",onClick:Z,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,G.state==="ok"&&J===null?$.jsxDEV("p",{className:"mode ws-screens-note",children:[M1(Q),"'s pack lists no screens."]},void 0,!0,void 0,this):null,G.state==="ok"&&J?$.jsxDEV("iframe",{title:`${M1(Q)}, as this World shows it`,src:J},Q,!1,void 0,this):null]},void 0,!0,void 0,this)}function sZ({name:_,token:Q,who:J,scope:q}){let[U,G]=r.useState(0),Z=V1(Q,`/-/${_}/twins`),F=V1(Q,`/-/${_}/rules`,U),X=F.state==="ok"?F.data.changesets:null,[Y,K]=r.useState(null),[H,L]=r.useState(null),[z,W]=r.useState(!1),[I,R]=r.useState([]),A=Y??X?.approvals??1,N=H??X?.summary??"required",B=X!==null&&(A!==(X.approvals??1)||N!==(X.summary??"required")),T=(k,E)=>{if(R((l)=>[{ok:k,text:E,at:new Date().toISOString(),n:++_4},...l].slice(0,3)),!k)l1(E,"error")},O=async(k)=>{k.preventDefault(),W(!0);try{let E=await y1(Q,`/-/${_}/rules`,{method:"PUT",body:JSON.stringify({changesets:{approvals:A,summary:N}})});if(!E.ok){T(!1,`Save: ${await z0(E)}`);return}T(!0,`Saved: ${A===0?"no approval":x1(A,"approval")} before a deploy; a summary ${N==="required"?"required":"generated when none is given"}.`),K(null),L(null),G((l)=>l+1)}finally{W(!1)}},C={gated:"a person deploys an approved changeset",auto:"a push deploys at once",hold:"nothing deploys"},f=J.person?$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:J.person},void 0,!1,void 0,this),J.local?", signed in on this machine":""]},void 0,!0,void 0,this):J.local?$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:"this machine"},void 0,!1,void 0,this),": no one is signed in here, so no person owns them until they are pushed by one"]},void 0,!0,void 0,this):J.admin?$.jsxDEV($.Fragment,{children:$.jsxDEV("b",{children:"the host's admin"},void 0,!1,void 0,this)},void 0,!1,void 0,this):$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:"this token"},void 0,!1,void 0,this),", a service"]},void 0,!0,void 0,this),S=Z.state==="ok"?Z.data.twins.filter((k)=>k.root?.url):[],w=q!=="write"?"This session reads the World; it changes no rules":null;return $.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Changesets"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"This World's rules, kept with it and shared by everyone who works in it. A person or the World's token changes them; a key never does, so an agent cannot relax the review its own changes go through."},void 0,!1,void 0,this),$.jsxDEV(G0,{load:F,what:"the rules",lines:2},void 0,!1,void 0,this),$.jsxDEV("form",{className:"ws-rules",onSubmit:(k)=>void O(k),"aria-label":"Changeset rules",children:[$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Recorded as"},void 0,!1,void 0,this),$.jsxDEV("p",{children:["What you cut here is recorded as ",f,". An agent's or an app's key cuts as itself, for the person it was made for; a World's token cuts as a service."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"A cut's summary"},void 0,!1,void 0,this),$.jsxDEV("fieldset",{className:"choice",disabled:Boolean(w)||X===null,children:[$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"summary",checked:N==="required",onChange:()=>L("required")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Required: whoever cuts says what it does and why"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"summary",checked:N==="generated",onChange:()=>L("generated")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Generated from its changes when none is given"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:"Either way a cut takes every change not yet in a changeset: there is no staging."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Ready to deploy"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-rule-list",children:$.jsxDEV("li",{children:[$.jsxDEV(w1,{name:"check",size:16},void 0,!1,void 0,this),"Verified: replayed in a throwaway World, the World's checks passing"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("label",{className:"ws-rule-row",children:[$.jsxDEV("span",{children:"Approved by"},void 0,!1,void 0,this),$.jsxDEV("select",{value:A,onChange:(k)=>K(Number(k.target.value)),disabled:Boolean(w)||X===null,"aria-label":"Approvals required",children:[0,1,2,3,4,5].map((k)=>$.jsxDEV("option",{value:k,children:k===0?"no one: verified is enough":k===1?"1 person":`${k} different people`},k,!1,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"for its contents as they stand"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Deploys to"},void 0,!1,void 0,this),Z.state==="ok"&&S.length===0?$.jsxDEV("p",{className:"mode",children:"No vendor here is connected to its real service, so nothing deploys from this World."},void 0,!1,void 0,this):null,S.length?$.jsxDEV("ul",{className:"ws-rule-list",children:S.map((k)=>$.jsxDEV("li",{children:[$.jsxDEV(d1,{vendor:k.twin},void 0,!1,void 0,this),M1(k.twin),": ",C[k.root.deploy??"gated"]??"gated"]},k.twin,!0,void 0,this))},void 0,!1,void 0,this):null,$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("a",{href:`${R1}/${_}/~/settings/services`,onClick:(k)=>{k.preventDefault(),j1([..._.split("/"),"~","settings","services"])},children:"Real services"},void 0,!1,void 0,this)," sets each vendor's deploy policy."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(A2,{log:I,name:_},void 0,!1,void 0,this),$.jsxDEV("div",{className:"row-actions",children:[$.jsxDEV("button",{type:"submit",className:"primary",disabled:Boolean(w)||z||!B,title:w??void 0,children:z?"Saving…":"Save"},void 0,!1,void 0,this),B?$.jsxDEV("button",{type:"button",onClick:()=>{K(null),L(null)},children:"Cancel"},void 0,!1,void 0,this):null,w?$.jsxDEV("span",{className:"mode",children:[w,"."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function tZ({who:_,scope:Q,snapshot:J,portal:q,onSignOut:U}){let G=Q==="write"?"Reads and changes this World":Q==="read"?"Reads this World; changes nothing":"…",[Z,F]=J?["A snapshot",`of ${J.parent}, read only`]:_.local&&_.person?[_.person,"Signed in on this machine: this World is served here, and acts as you"]:_.local?["This machine","Served here, with no one signed in: what you do is recorded as this machine"]:_.person?[_.person,q?`Signed in through ${new URL(q).host}`:"Signed in"]:_.admin?["The host's admin","Opened with the host admin token: every World it serves"]:["A link or key","Opened with a token for this World"];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Account"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-account",children:[$.jsxDEV("span",{className:"ws-account-face","aria-hidden":"true",children:$.jsxDEV(w1,{name:_.person?"user":_.local?"monitor":J?"clock":"key-round",size:20},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"cell-label",children:[$.jsxDEV("b",{children:Z},void 0,!1,void 0,this),$.jsxDEV("small",{children:F},void 0,!1,void 0,this),$.jsxDEV("small",{children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_.local||J?null:$.jsxDEV("p",{children:$.jsxDEV("button",{type:"button",onClick:U,children:[$.jsxDEV(w1,{name:"log-out",size:16},void 0,!1,void 0,this),_.person?"Sign out":_.admin?"Sign out of the host":"Use another token"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q&&_.person?$.jsxDEV("p",{className:"mode",children:["Your profile, orgs and keys are on ",$.jsxDEV("a",{href:`${q}/`,children:new URL(q).host},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function oZ({name:_,token:Q,view:J,sub:q,arg:U,win:G,who:Z,snapshot:F,onReturn:X,onSignOut:Y,worlds:K,session:H,retry:L,twins:z,map:W,branches:I,clock:R,canWrite:A,refused:N,signsAs:B,opens:T,tick:O,admin:C,onRemoved:f,onClock:S,scope:w}){let k=fQ(_,Q,O,N),[E,l]=r.useState(0),c=E*1e5+Math.floor(O/2),y=V1(Q,`/-/${_}/diff`,c),D=V1(Q,`/-/${_}/changesets`,c),v=V1(Q,`/-/${_}/rules`,c),[x,V]=r.useState(null),b=(_1)=>(W1)=>{W1?.preventDefault(),j1([..._.split("/"),"~",..._1])},P=z.state==="ok"?z.data.twins.map((_1)=>_1.twin):[],j=new Map((W.state==="ok"?W.data.twins:[]).flatMap((_1)=>{let W1=mZ(_,_1);return W1?[[_1.twin,W1]]:[]})),m=[...j.keys()],h=W.state==="ok"?W.data.twins.filter((_1)=>_1.root).map((_1)=>_1.twin):[],o=(_1)=>W.state==="ok"?(W.data.twins.find((W1)=>W1.twin===_1)?.resources??[]).reduce((W1,K1)=>W1+K1.count,0):0,e=I?.state==="ok"&&I.data.checkedOut||_.split("/")[1],s=r.useMemo(()=>{if(y.state!=="ok")return[];let _1=new Map;for(let W1 of y.data.changes){let K1=`${W1.twin}:${W1.entry.subject.type}:${W1.entry.subject.id}`,p1=_1.get(K1)??{key:K1,twin:W1.twin,writes:[]};p1.writes.push(W1.entry),_1.set(K1,p1)}return[..._1.values()]},[y]),t=s.find((_1)=>_1.key===x)??s[0],p=V1(Q,J==="changes"&&t?`/-/${_}/log/${t.twin}`:null,c),n=y.state==="ok"?y.data.changes.length:0,J1=k.waiting.length,q1=k.there,F1=k.origin.state==="ok"?k.origin.data.origin:null,Z1=!A?"This session reads the World; it changes nothing":!q1?"No remote: name one in Settings › Remote":null,T1=(_1,W1,K1,p1,s1,a1)=>$.jsxDEV("a",{href:`${R1}/${_}/~/${p1}`,className:_1?"on":void 0,"aria-current":_1?"page":void 0,onClick:s1,children:[W1,$.jsxDEV("span",{children:K1},void 0,!1,void 0,this),a1?$.jsxDEV("span",{className:"count",children:a1},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),L1=(_1)=>{_1.currentTarget.closest("details")?.removeAttribute("open")};return $.jsxDEV("div",{className:"ws",children:[$.jsxDEV("div",{className:"ws-bar",role:"toolbar","aria-label":`${_} toolbar`,children:[$.jsxDEV("div",{className:"ws-left",children:[$.jsxDEV(s5,{href:`${R1}/${_}`,onClick:(_1)=>{_1.preventDefault(),b(["changes"])()}},void 0,!1,void 0,this),$.jsxDEV("details",{className:"menu ws-pick",children:[$.jsxDEV("summary",{title:"This World",children:[$.jsxDEV(w1,{name:"globe",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-pick-label",children:[$.jsxDEV("small",{children:"World"},void 0,!1,void 0,this),$.jsxDEV("b",{children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(w1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"popover menu-list ws-world-menu",children:[Z.local?null:$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"menu-label",children:"Worlds"},void 0,!1,void 0,this),K.map((_1)=>$.jsxDEV("a",{href:`${R1}/${_1}`,className:_1===_?"on":void 0,onClick:(W1)=>{W1.preventDefault(),L1(W1),j1(_1.split("/"))},children:[_1===_?$.jsxDEV(w1,{name:"check",size:16},void 0,!1,void 0,this):$.jsxDEV(w1,{name:"globe",size:16},void 0,!1,void 0,this),_1]},_1,!0,void 0,this)),$.jsxDEV("a",{href:`${v0()&&v0()!==k1?v0():""}${R1}/`,onClick:(_1)=>{if(v0()&&v0()!==k1)return;_1.preventDefault(),L1(_1),j1([])},children:[$.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),"All Worlds",Z0()?` on ${new URL(Z0()).host}`:""]},void 0,!0,void 0,this),$.jsxDEV("hr",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Connect an app"},void 0,!1,void 0,this),Z0()?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Point your app's SDKs here with a key made on the platform; its calls to these vendors land in this World:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:[l0,"/",_,"/<vendor>"]},void 0,!0,void 0,this),$.jsxDEV(A8,{text:a4({platform:Z0(),world:_})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):!Z.local?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Point your app's SDKs here with a key from Settings › Access; its calls to these vendors land in this World:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:[l0,"/",_,"/<vendor>"]},void 0,!0,void 0,this),$.jsxDEV(A8,{text:a4()},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Run it in this World; its calls to these vendors land here:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:"volter world run -- npm start"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"ws-menu-text mode",children:["Or point an SDK at ",$.jsxDEV("code",{children:[l0,"/",_,"/<vendor>"]},void 0,!0,void 0,this)," with the token in ",$.jsxDEV("code",{children:".volter/token"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),$.jsxDEV(A8,{text:a4()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("hr",{},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${R1}/${_}/~/settings`,onClick:(_1)=>{L1(_1),b(["settings"])(_1)},children:[$.jsxDEV(w1,{name:"settings",size:16},void 0,!1,void 0,this),"Settings…"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(cZ,{name:_,token:Q,branches:I,opens:T,refused:N,onChanged:S},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-where",title:"Where this is",children:[$.jsxDEV("span",{children:_},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),$.jsxDEV("span",{children:e},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),F1?$.jsxDEV("a",{href:`${R1}/${_}/~/remote`,onClick:b(["remote"]),children:["origin ",F1.namespace,J1?$.jsxDEV("b",{children:[" ↑",J1]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):$.jsxDEV("a",{href:`${R1}/${_}/~/remote`,onClick:b(["remote"]),children:"no remote"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${R1}/${_}/~/settings/clock`,onClick:b(["settings","clock"]),children:R.state==="ok"?$.jsxDEV($.Fragment,{children:[R.data.frozen?"stopped at ":"",$.jsxDEV(u1,{iso:R.data.at,time:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-right",children:[$.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void k.pull(),disabled:Boolean(Z1)||k.busy!==null,title:Z1??`Fetch what ${q1} has and move this branch onto it`,children:[$.jsxDEV(w1,{name:"arrow-down-to-line",size:16},void 0,!1,void 0,this),k.busy==="Pull"?"Pulling…":"Pull"]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void k.push(),disabled:Boolean(Z1)||k.busy!==null||J1===0,title:Z1??(J1?`Push ${x1(J1,"changeset")} to ${q1}`:`Every changeset is at ${q1}`),children:[$.jsxDEV(w1,{name:"arrow-up-from-line",size:16},void 0,!1,void 0,this),k.busy==="Push"?"Pushing…":"Push",J1?$.jsxDEV("span",{className:"ws-btn-count",children:J1},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",className:"ws-btn icon-only","aria-label":"Settings",title:"Settings",onClick:()=>b(["settings"])(),children:$.jsxDEV(w1,{name:"settings",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F?$.jsxDEV("div",{className:"ws-banner",role:"region","aria-label":"Snapshot",children:[$.jsxDEV(w1,{name:"clock",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:["You are looking at ",$.jsxDEV("b",{children:F.parent},void 0,!1,void 0,this)," as it was at ",$.jsxDEV(u1,{iso:F.at},void 0,!1,void 0,this),": a read-only snapshot",F.expiresAt?$.jsxDEV($.Fragment,{children:[", gone ",$.jsxDEV(u1,{iso:F.expiresAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,"."]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>void X(F),children:"Return to live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,k.log.length?$.jsxDEV("div",{className:"ws-said",children:$.jsxDEV(A2,{log:k.log.slice(0,1),name:_},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV("div",{className:"ws-body",children:[$.jsxDEV("nav",{className:"ws-side","aria-label":`${_} places`,children:[P.length?$.jsxDEV("a",{href:`${R1}/${_}/~/screens`,className:J==="screen"?"ws-screens-entry on":"ws-screens-entry",onClick:b(["screens"]),title:`The board: ${b2(P.map(M1))}`,children:[$.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Board"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-screens-marks",children:[P.slice(0,3).map((_1)=>$.jsxDEV(d1,{vendor:_1},_1,!1,void 0,this)),P.length>3?$.jsxDEV("span",{className:"more",children:["+",P.length-3]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("p",{className:"side-group",children:"Workspace"},void 0,!1,void 0,this),T1(J==="changes"||J==="history",$.jsxDEV(w1,{name:"file-diff",size:16},void 0,!1,void 0,this),"Changes","changes",b(["changes"]),s.length?String(s.length):void 0),T1(J==="events"&&!U||J==="trace",$.jsxDEV(w1,{name:"activity",size:16},void 0,!1,void 0,this),"Events","events",b(["events"])),$.jsxDEV("p",{className:"side-group",children:"Records"},void 0,!1,void 0,this),P.map((_1)=>$.jsxDEV(r.default.Fragment,{children:T1(J==="vendor"&&U===_1,$.jsxDEV(d1,{vendor:_1},void 0,!1,void 0,this),M1(_1),`vendors/${_1}`,b(["vendors",_1]),o(_1)?String(o(_1)):void 0)},_1,!1,void 0,this)),$.jsxDEV("p",{className:"side-group",children:"Remote"},void 0,!1,void 0,this),T1(!1,$.jsxDEV(w1,{name:"cloud",size:16},void 0,!1,void 0,this),q1?"origin":"Name a remote…","remote",b(["remote"]),J1?`↑${J1}`:void 0)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-main",role:"main",children:[J==="changes"?$.jsxDEV("div",{className:"ws-status",children:[$.jsxDEV("div",{className:"ws-files",children:[$.jsxDEV(zQ,{name:_,view:"changes",changes:s.length,changesets:D.state==="ok"?D.data.changesets.length:0},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-list-head",children:[$.jsxDEV("span",{children:"Not in a changeset"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:y.state==="ok"?`${x1(s.length,"record")} · ${x1(n,"write")}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(G0,{load:y,what:"the changes",lines:4},void 0,!1,void 0,this),$.jsxDEV(LQ,{records:s,...t?{selected:t.key}:{},onPick:V,label:"Changed records"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-detail",children:[y.state==="ok"&&!t?$.jsxDEV(X5,{title:"No changes on this branch",action:J1>0&&q1?$.jsxDEV("button",{type:"button",className:"primary",disabled:Boolean(Z1)||k.busy!==null,onClick:()=>void k.push(),children:["Push ",x1(J1,"changeset")," to origin"]},void 0,!0,void 0,this):void 0,children:$.jsxDEV("p",{children:["What your app writes to this World lands here, record by record, to cut into a changeset. Everything since ",y.data.base.at?$.jsxDEV(u1,{iso:y.data.base.at},void 0,!1,void 0,this):$.jsxDEV("code",{children:y.data.base.id},void 0,!1,void 0,this)," is in one already."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,t?$.jsxDEV(YQ,{record:t,history:p.state==="ok"?p.data.entries:p.state==="error"?[]:null},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(TF,{pinned:!0,generated:v.state==="ok"&&v.data.changesets.summary==="generated",author:{face:$.jsxDEV(w1,{name:Z.person?"user":Z.local?"monitor":"key-round",size:18},void 0,!1,void 0,this),who:Z.person??(Z.local?"This machine":Z.admin?"The host's admin":"A token"),account:`${R1}/${_}/~/settings/account`,branch:e},name:_,token:Q,changes:n,canWrite:A,refused:N,onCut:()=>{l((_1)=>_1+1),V(null)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,J==="history"?$.jsxDEV(lZ,{name:_,token:Q,sets:D,changes:s.length,withScreens:m,required:v.state==="ok"?v.data.changesets.approvals??1:1,...q?{sub:q}:{},signsAs:B,canWrite:A,rooted:h,refused:N,onChanged:()=>l((_1)=>_1+1)},void 0,!1,void 0,this):null,J==="events"?$.jsxDEV(rZ,{name:_,token:Q,vendors:P,...U&&P.includes(U)?{vendor:U}:{},tick:O},U??"",!1,void 0,this):null,J==="trace"?$.jsxDEV(iZ,{name:_,token:Q,id:U??""},void 0,!1,void 0,this):null,J==="vendor"&&U?$.jsxDEV(dZ,{name:_,token:Q,vendor:U,withScreens:m.includes(U),tick:O},U,!1,void 0,this):null,J==="screen"&&U?$.jsxDEV(aZ,{name:_,vendor:U,url:W.state==="ok"?j.get(U)??null:void 0,...W.state==="error"?{mapError:W.error}:{},holding:eZ(W.state==="ok"?W.data.twins.find((_1)=>_1.twin===U)?.resources??[]:[]),session:H,retry:L},U,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(M0,{open:G?.kind==="settings",onClose:()=>b(["changes"])(),title:"Settings",wide:"window",children:G?.kind==="settings"?$.jsxDEV("div",{className:"ws-settings",children:[$.jsxDEV("nav",{"aria-label":"Settings",children:KQ.map(([_1,W1,K1])=>$.jsxDEV("a",{href:`${R1}/${_}/~/settings/${_1}`,className:G.tab===_1?"on":void 0,"aria-current":G.tab===_1?"page":void 0,onClick:b(["settings",_1]),children:[$.jsxDEV(w1,{name:K1,size:16},void 0,!1,void 0,this),W1]},_1,!0,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-settings-pane",children:[w==="read"?$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("span",{className:"badge read-only",children:"Read only"},void 0,!1,void 0,this)," This session reads the World; it changes nothing."]},void 0,!0,void 0,this):null,G.tab==="account"?$.jsxDEV(tZ,{who:Z,scope:w,snapshot:F,portal:Z0(),onSignOut:Y},void 0,!1,void 0,this):null,G.tab==="changesets"?$.jsxDEV(sZ,{name:_,token:Q,who:Z,scope:w},void 0,!1,void 0,this):null,G.tab==="remote"?$.jsxDEV(OF,{name:_,token:Q,canWrite:A,tick:O,refused:N},void 0,!1,void 0,this):null,G.tab==="access"||G.tab==="services"||G.tab==="checks"||G.tab==="clock"?$.jsxDEV(PF,{name:_,token:Q,admin:C,canWrite:A,refused:N,onRemoved:f,only:G.tab},void 0,!1,void 0,this):null,G.tab==="vault"?$.jsxDEV(IF,{name:_,token:Q,canWrite:A,refused:N},void 0,!1,void 0,this):null,G.tab==="appearance"?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Appearance"},void 0,!1,void 0,this),$.jsxDEV(DZ,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),$.jsxDEV(M0,{open:G?.kind==="branches",onClose:()=>b(["changes"])(),title:"Branches",wide:!0,children:G?.kind==="branches"?$.jsxDEV(JF,{name:_,token:Q,canWrite:A,branches:I,opens:T,...G.open?{open:G.open}:{},onChanged:S,refused:N},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function A8({text:_}){return $.jsxDEV("button",{type:"button",className:"agent-prompt-button",onClick:()=>{navigator.clipboard?.writeText(_).then(()=>l1("Copied the prompt: paste it into your coding agent"),()=>l1("Could not copy the prompt","error"))},children:"Copy a prompt for your coding agent"},void 0,!1,void 0,this)}var w8=(_)=>`${_.url.replace(/\/+$/,"")}/${_.namespace}`,nZ=(_)=>_.filter((Q)=>Q.applied===null||Q.applied.outcome==="refused"),eZ=(_,Q=4)=>{let J=[..._].filter((q)=>q.count>0).sort((q,U)=>U.count-q.count);return J.length?J.slice(0,Q).map((q)=>x1(q.count,q.type.replace(/^_+/,""))).join(" · ")+(J.length>Q?` · +${J.length-Q} more`:""):"nothing yet"},WQ=$.jsxDEV("svg",{className:"branch-glyph",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:$.jsxDEV("path",{fill:"currentColor",d:"M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm0 2.122a2.25 2.25 0 1 0-1.5 0v5.256a2.25 2.25 0 1 0 1.5 0V9.5h4.25A2.25 2.25 0 0 0 11.5 7.25v-.878a2.25 2.25 0 1 0-1.5 0v.878a.75.75 0 0 1-.75.75H5V5.372ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm6.5-9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this);function _F({name:_,token:Q,clock:J,canWrite:q,onChanged:U,refused:G,open:Z}){let[F,X]=r.useState(!1),[Y,K]=r.useState(""),[H,L]=r.useState(""),[z,W]=r.useState(null),[I,R]=r.useState(!1),A=J.state==="ok"?J.data:null,N=async(C,f,S)=>{R(!0),W(null);try{let w=await y1(Q,`/-/${_}/${f}`,{method:f==="clock"?"PUT":"POST",body:JSON.stringify(S)});if(!w.ok){G(w),W({ok:!1,text:await z0(w)});return}let k=await w.json();W({ok:!0,text:`${C} — the World is at ${new Date(k.at).toLocaleString()}`}),X(!1),U()}catch(w){W({ok:!1,text:`the World did not answer: ${w instanceof Error?w.message:String(w)}`})}finally{R(!1)}},B=(C)=>{C.preventDefault();let f=new Date(Y);if(Number.isNaN(f.getTime())){W({ok:!1,text:"Pick a date and time."});return}if(A&&f.getTime()<Date.parse(A.at)){W({ok:!1,text:`The World's clock only moves forward: pick a time after ${new Date(A.at).toLocaleString()}.`});return}N("Clock set","clock",{at:f.toISOString()})},T=(C,f)=>{N(`Advanced ${f}`,"clock/advance",{by:C})},O=[["1h","1 hour"],["1d","1 day"],["7d","1 week"],["30d","30 days"]];return $.jsxDEV("div",{className:`clock${A?.frozen?" frozen":""}`,role:"region","aria-label":"World clock",children:[$.jsxDEV("p",{className:"clock-now",children:J.state==="loading"?$.jsxDEV("span",{className:"mode",children:"clock…"},void 0,!1,void 0,this):J.state==="error"?$.jsxDEV("span",{className:"mode",children:["Clock: ",J.error]},void 0,!0,void 0,this):A.frozen?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"badge",children:"Simulation"},void 0,!1,void 0,this)," World time ",$.jsxDEV("strong",{children:$.jsxDEV(u1,{iso:A.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV($.Fragment,{children:["World time ",$.jsxDEV("strong",{children:$.jsxDEV(u1,{iso:A.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"· real time"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q&&A?$.jsxDEV("details",{className:Z?"clock-more inline":"clock-more",open:Z||void 0,children:[$.jsxDEV("summary",{children:"Simulate time…"},void 0,!1,void 0,this),$.jsxDEV("div",{className:Z?void 0:"popover",children:[$.jsxDEV("p",{className:"mode",children:"Move this World's clock forward to see what happens later: renewals, expiries, scheduled sends. Like a test clock, it only moves forward; to look back, the branch picker’s Manage branches… views an earlier moment."},void 0,!1,void 0,this),$.jsxDEV("div",{className:"clock-controls",children:[$.jsxDEV("button",{type:"button","aria-expanded":F,onClick:()=>{X(!F),K(L5(i_(A.at))),W(null)},children:"Set time…"},void 0,!1,void 0,this),$.jsxDEV("div",{role:"group","aria-label":"Advance the clock",className:"advance",children:[$.jsxDEV("span",{className:"mode",children:"Advance"},void 0,!1,void 0,this),O.map(([C,f])=>$.jsxDEV("button",{type:"button","aria-label":`Advance ${f}`,disabled:I||!A.frozen,title:A.frozen?void 0:"Set the time first: advancing moves a set clock",onClick:()=>T(C,f),children:f},C,!1,void 0,this)),$.jsxDEV("form",{className:"inline",onSubmit:(C)=>{if(C.preventDefault(),!/^\d+[smhd]$/.test(H.trim())){W({ok:!1,text:"Advance by a number and a unit: 90m, 12h, 3d."});return}T(H.trim(),`by ${H.trim()}`)},children:[$.jsxDEV("label",{className:"sr",children:["Advance by ",$.jsxDEV("input",{name:"advanceBy",value:H,onChange:(C)=>L(C.target.value),placeholder:"90m, 12h, 3d",size:9,disabled:!A.frozen},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",disabled:I||!A.frozen,children:"Advance"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!A.frozen?$.jsxDEV("p",{className:"mode",children:"The World runs on real time. Set a time to start simulating; then advance it."},void 0,!1,void 0,this):null,F?$.jsxDEV("form",{className:"inline","aria-label":"Set the World time",onSubmit:B,noValidate:!0,children:[$.jsxDEV("label",{children:["World time ",$.jsxDEV("input",{name:"worldTime",type:"datetime-local",value:Y,min:L5(i_(A.at)),onChange:(C)=>K(C.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:Intl.DateTimeFormat().resolvedOptions().timeZone},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",disabled:I,children:"Set time"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>X(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,z?$.jsxDEV("p",{role:z.ok?"status":"alert",children:z.text},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function QF({name:_,token:Q,clock:J,refused:q}){let[U,G]=r.useState(!1),[Z,F]=r.useState(""),[X,Y]=r.useState(null),[K,H]=r.useState(!1),L=J.state==="ok"?J.data.at:new Date().toISOString(),z=r.useRef(null);return r.useEffect(()=>{if(!U)return;let I=(A)=>{if(A.key==="Escape"&&!document.querySelector("dialog[open]"))G(!1),z.current?.querySelector("button")?.focus()},R=(A)=>{if(!z.current?.contains(A.target))G(!1)};return document.addEventListener("keydown",I),document.addEventListener("click",R),()=>{document.removeEventListener("keydown",I),document.removeEventListener("click",R)}},[U]),$.jsxDEV("div",{className:"as-of",ref:z,children:[$.jsxDEV("button",{type:"button","aria-expanded":U,title:"Open a read-only copy of this World as it was at a moment you pick",onClick:()=>{G(!U),F(L5(L)),Y(null)},children:"View an earlier moment…"},void 0,!1,void 0,this),U?$.jsxDEV("form",{className:"inline","aria-label":"View the World as of a past moment",onSubmit:async(I)=>{I.preventDefault(),Y(null);let R=new Date(Z);if(Number.isNaN(R.getTime())){Y("Pick a date and time.");return}if(R.getTime()>Date.parse(L)){Y(`That is after the World's present (${new Date(L).toLocaleString()}); a snapshot looks back.`);return}H(!0);try{let A=await y1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:R.toISOString()},ttl:3600})});if(!A.ok){q(A),Y(await z0(A));return}let N=await A.json();O8({name:N.name,parent:_,token:N.token,readToken:N.readToken,at:R.toISOString(),expiresAt:N.expiresAt??null,parentOrigin:k1,made:!0});let B=e5(N.origin)?.origin;if(B&&B!==k1){N8(B,N.readToken,N.name,`${R1}/${N.name}`);return}j1(N.name.split("/"))}catch(A){Y(`the World did not answer: ${A instanceof Error?A.message:String(A)}`)}finally{H(!1)}},noValidate:!0,children:[$.jsxDEV("label",{children:["As of ",$.jsxDEV("input",{name:"asOf",type:"datetime-local",value:Z,max:L5(L),onChange:(I)=>F(I.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",disabled:K,children:K?"Opening…":"Open snapshot"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Opens a read-only copy of this World as it was then; the copy goes away within the hour."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,X?$.jsxDEV("p",{role:"alert",children:X},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function AQ({name:_,token:Q,open:J,onClose:q,onMade:U,refused:G}){let Z=(f)=>f.split("/").pop()??f,[F,X]=r.useState(!1),[Y,K]=r.useState(null),[H,L]=r.useState(""),[z,W]=r.useState("now"),[I,R]=r.useState(""),[A,N]=r.useState("24"),[B,T]=r.useState(!0);r.useEffect(()=>{if(J)K(null),R(L5(new Date().toISOString()))},[J]);let O=async(f)=>{f.preventDefault(),K(null);let S=z==="at"?new Date(I):null;if(S&&Number.isNaN(S.getTime())){K("Pick a date and time, or make it as of now.");return}if(S&&S.getTime()>Date.now()){K("A branch is made as of now or a moment before it.");return}X(!0);let w=await y1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({ttl:Math.round(Number(A)*3600),...S?{at:{instant:S.toISOString()}}:B?{live:!0}:{},...H.trim()?{label:H.trim()}:{}})}).catch(()=>null);if(X(!1),!w){K(`${k1} did not answer`);return}if(!w.ok){G(w),K(await z0(w));return}let k=await w.json();O8({name:k.name,parent:_,token:k.token??"",readToken:k.readToken,at:(S??new Date).toISOString(),expiresAt:k.expiresAt??null,parentOrigin:k1,...k.origin?{origin:k.origin}:{}}),q(),L(""),l1(`Made ${Z(k.name)}`),U()};return $.jsxDEV(M0,{open:J,onClose:()=>{if(!F)q()},title:`New branch of ${Z(_)}`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>q(),disabled:F,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"new-branch",className:"primary",disabled:F,children:F?"Making…":"Make branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"new-branch",onSubmit:(f)=>void O(f),className:"stack",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Label ",$.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("input",{name:"branchLabel",value:H,onChange:(f)=>L(f.target.value.toLowerCase()),placeholder:"checkout-flow",pattern:"[a-z0-9][a-z0-9\\-]{0,23}",maxLength:24},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("fieldset",{className:"choice",children:[$.jsxDEV("legend",{children:"From"},void 0,!1,void 0,this),$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"branchWhen",checked:z==="now",onChange:()=>W("now")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Now: the World as it is"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z==="now"?$.jsxDEV("label",{className:"check sub",children:[$.jsxDEV("input",{type:"checkbox",name:"branchLive",checked:B,onChange:(f)=>T(f.target.checked)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Live: its clock keeps this World's time, as a pull request's preview does (else it stops now)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"branchWhen",checked:z==="at",onChange:()=>W("at")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"An instant before now: the World as it was then, its clock stopped there"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z==="at"?$.jsxDEV("input",{type:"datetime-local","aria-label":"As of",value:I,max:L5(new Date().toISOString()),onChange:(f)=>R(f.target.value)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Goes away after"},void 0,!1,void 0,this),$.jsxDEV("select",{name:"branchLife",value:A,onChange:(f)=>N(f.target.value),children:[$.jsxDEV("option",{value:"1",children:"1 hour"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"24",children:"1 day"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"72",children:"3 days"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"168",children:"7 days"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y?$.jsxDEV("p",{role:"alert",children:Y},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function JF({name:_,token:Q,canWrite:J,branches:q,opens:U,open:G,onChanged:Z,refused:F,snapshotOf:X}){let Y=V1(Q,`/-/${_}/clock`),K=(N)=>N.split("/").pop()??N,[H,L]=r.useState(!1),z=(N)=>(B)=>{B.preventDefault(),j1([..._.split("/"),"~","branches",...N?N.split("/"):[]])};if(!q)return $.jsxDEV("p",{className:"mode",children:"This host makes no branches of a World."},void 0,!1,void 0,this);let W=q.state==="ok"?q.data.branches:[],I=q.state==="ok"&&(q.data.named?.length??0)>0?q.data.named:[{name:K(_),running:!0}],R=q.state==="ok"?q.data.checkedOut??K(_):K(_),A=async(N)=>{if(!await p0({title:`Remove the branch ${K(N)}?`,body:"Whoever holds its tokens loses it, and its history goes with it.",action:"Remove branch",danger:!0}))return;let B=await y1(Q,`/-/${_}/branches/${N}`,{method:"DELETE"}).catch((T)=>T);if(B instanceof Error){l1(`Remove ${K(N)}: the World did not answer (${B.message})`,"error");return}if(!B.ok){F(B),l1(`Remove ${K(N)}: ${await z0(B)}`,"error");return}o4(N),l1(`Removed ${K(N)}`),Z(),j1([..._.split("/"),"~","branches"])};if(G){let N=G.includes("/")?W.find((T)=>T.name===G):void 0,B=G.includes("/")?void 0:I.find((T)=>T.name===G);return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"crumbs-line",children:$.jsxDEV("a",{href:`${R1}/${_}/~/branches`,onClick:z(),children:"← Branches"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(G0,{load:q,what:"the branches"},void 0,!1,void 0,this),q.state==="ok"&&!N&&!B?$.jsxDEV("p",{className:"mode",children:["This World has no branch named ",G,"."]},void 0,!0,void 0,this):null,N?$.jsxDEV($F,{name:_,b:N,canWrite:J,opens:U(N.name),remove:()=>void A(N.name)},void 0,!1,void 0,this):null,B&&!N?$.jsxDEV(qF,{name:_,token:Q,b:B,served:B.name===R,canWrite:J,canServe:q.state==="ok"&&Boolean(q.data.canServe)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}return $.jsxDEV("div",{"aria-labelledby":"branches",children:[$.jsxDEV("div",{className:"branches-head",children:[$.jsxDEV("p",{className:"lede",children:["Branch this World to look at it as it was, or to change it without touching ",$.jsxDEV("b",{children:R},void 0,!1,void 0,this),". Each branch's name opens its page."]},void 0,!0,void 0,this),J?$.jsxDEV("div",{className:"head-actions",children:[X?null:$.jsxDEV(QF,{name:_,token:Q,clock:Y,refused:F},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>L(!0),children:"New branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(G0,{load:q,what:"the branches"},void 0,!1,void 0,this),q.state==="ok"?$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Branches",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{id:"branches",children:"Branch"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Parent"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"As of"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Goes away"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:[I.map((N)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:[$.jsxDEV("a",{href:`${R1}/${_}/~/branches/${N.name}`,onClick:z(N.name),children:$.jsxDEV("b",{children:N.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.name===R?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("span",{className:"badge live",children:"served here"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):N.running?null:$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("span",{className:"badge",children:"stopped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"live"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"kept"},void 0,!1,void 0,this)]},`own:${N.name}`,!0,void 0,this)),W.map((N)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("a",{href:`${R1}/${_}/~/branches/${N.name}`,onClick:z(N.name),children:$.jsxDEV("b",{children:K(N.name)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:K(N.from??_)},void 0,!1,void 0,this),$.jsxDEV("td",{children:N.at?.instant?$.jsxDEV(u1,{iso:N.at.instant},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"live"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV(u1,{iso:N.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:N.expiresAt?$.jsxDEV(u1,{iso:N.expiresAt},void 0,!1,void 0,this):"kept"},void 0,!1,void 0,this)]},N.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV(AQ,{name:_,token:Q,open:H,onClose:()=>L(!1),onMade:Z,refused:F},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function $F({name:_,b:Q,canWrite:J,opens:q,remove:U}){let G=(X)=>X.split("/").pop()??X,Z=I8(Q.name),F=V1(Z,Z?`/-/${Q.name}/diff`:null);return $.jsxDEV("div",{className:"branch-page",children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("h3",{children:[WQ," ",G(Q.name)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:[q?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>XQ(Q.name,Q.name.split("/")),children:"Open"},void 0,!1,void 0,this):null,J?$.jsxDEV("button",{type:"button",className:"danger-button",onClick:U,children:"Remove…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"block",children:$.jsxDEV("dl",{className:"fields pad",children:[$.jsxDEV("dt",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV("code",{children:Q.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Parent"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:G(Q.from??_)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"As of"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:Q.at?.instant?$.jsxDEV(u1,{iso:Q.at.instant},void 0,!1,void 0,this):"live: it keeps its parent's time"},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(u1,{iso:Q.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Goes away"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:Q.expiresAt?$.jsxDEV(u1,{iso:Q.expiresAt},void 0,!1,void 0,this):"kept"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),!q?$.jsxDEV("p",{className:"mode",children:"Its tokens were handed to whoever made it: it opens, and shows its own changes, in their tab."},void 0,!1,void 0,this):null,F.state==="ok"?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h4",{children:"Its changes"},void 0,!1,void 0,this),F.data.changes.length===0?$.jsxDEV("p",{className:"mode",children:"Nothing written on it since it branched."},void 0,!1,void 0,this):$.jsxDEV(MF,{changes:F.data.changes,idPrefix:`branch-${G(Q.name)}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function qF({name:_,token:Q,b:J,served:q,canWrite:U,canServe:G}){let[Z,F]=r.useState(!1),[X,Y]=r.useState(null),K=async()=>{F(!0),Y(null);let H=await y1(Q,`/-/${_}/branches/${encodeURIComponent(J.name)}/serve`,{method:"POST"}).catch(()=>null);if(H?.ok){location.reload();return}F(!1),Y(H?await z0(H):`${k1} did not answer`)};return $.jsxDEV("div",{className:"branch-page",children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("h3",{children:[WQ," ",J.name," ",q?$.jsxDEV("span",{className:"badge live",children:"served here"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:U&&G&&!q?$.jsxDEV("button",{type:"button",className:"primary",disabled:Z,onClick:()=>void K(),children:Z?"Switching…":"Serve here"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"block",children:$.jsxDEV("dl",{className:"fields pad",children:[$.jsxDEV("dt",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV("code",{children:J.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Kind"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:"one of this World's own branches"},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"State"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:J.running?"running":"stopped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q?$.jsxDEV("p",{className:"mode",children:["This is the branch these pages show: its changes are on ",$.jsxDEV("a",{href:`${R1}/${_}/~/changes`,onClick:(H)=>{H.preventDefault(),j1([..._.split("/"),"~","changes"])},children:"Changes"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this):G?$.jsxDEV("p",{className:"mode",children:["“Serve here” stops this one's twins and serves ",J.name," in its place."]},void 0,!0,void 0,this):$.jsxDEV("p",{className:"mode",children:"This host serves one of the World's own branches at a time, and does not switch them from this page."},void 0,!1,void 0,this),X?$.jsxDEV("p",{role:"alert",children:X},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var t_=50,Y5=(_)=>`${_.twin}:${_.position}`,BQ=(_,Q)=>Date.parse(Q.entry.occurredAt)-Date.parse(_.entry.occurredAt)||_.twin.localeCompare(Q.twin)||Q.position-_.position,n4=(_)=>{if(!_)return"someone";if(_.startsWith("key:")){let[Q,J]=_.slice(4).split(" for:");return J?`${Q}, for ${J}`:Q||"a key"}if(_.startsWith("person:"))return _.slice(7);return _==="machine"?"this machine":_==="person"?"a session with no name":_==="token:read"?"the read-only token":_==="token"?"the World's token":_},o5=(_,Q)=>{let J=typeof Q==="string"?Q:typeof _.caller==="string"?_.caller:"";if(J.startsWith("key:")&&J.length>4)return`by ${n4(J)}`;if(J.startsWith("person:")&&J.length>7)return`by ${J.slice(7)}`;if(J==="machine")return"by this machine";if(J==="person")return"by a session with no name";if(J==="key")return"by a key";if(J==="token:read")return"by the read-only token";if(J==="token")return"by the World's token";return _.actor?.kind==="system"?"by the vendor":_.actor?.id?`by ${_.actor.id}`:"by an app"},MQ=(_)=>_.operation??_.op;function UF(_){let Q=_.fields??{},J=Q.usage!==null&&typeof Q.usage==="object"?Q.usage:Q,q=(...Y)=>Y.map((K)=>J[K]??Q[K]).find((K)=>typeof K==="number"),U=[],G=q("prompt_tokens","input_tokens"),Z=q("completion_tokens","output_tokens"),F=q("total_tokens");if(G!==void 0)U.push(["tokens in",G.toLocaleString()]);if(Z!==void 0)U.push(["tokens out",Z.toLocaleString()]);if(F!==void 0)U.push(["tokens in all",F.toLocaleString()]);let X=q("cost_usd","cost");if(X!==void 0)U.push(["cost",`$${X<0.01?X.toPrecision(2):X.toFixed(2)}`]);return U}function TQ({text:_,at:Q=280}){if(_.length<=Q)return $.jsxDEV("span",{className:"text",children:_},void 0,!1,void 0,this);return $.jsxDEV("details",{className:"folded",children:[$.jsxDEV("summary",{children:[$.jsxDEV("span",{className:"text",children:[_.slice(0,Q),"…"]},void 0,!0,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:["show all ",_.length.toLocaleString()," characters"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"text",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function U2({v:_}){if(typeof _==="string")return $.jsxDEV(TQ,{text:_},void 0,!1,void 0,this);if(_===null||typeof _!=="object")return $.jsxDEV("code",{children:String(_)},void 0,!1,void 0,this);let Q=JSON.stringify(_,null,2);return Q.length<=160?$.jsxDEV("code",{children:JSON.stringify(_)},void 0,!1,void 0,this):$.jsxDEV("details",{className:"folded",children:[$.jsxDEV("summary",{children:$.jsxDEV("code",{children:[JSON.stringify(_).slice(0,120),"…"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("pre",{children:Q},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var GF=(_)=>typeof _==="string"?_:Array.isArray(_)?_.map((Q)=>Q&&typeof Q==="object"&&typeof Q.text==="string"?Q.text:"").filter(Boolean).join(`
|
|
36
|
-
`):JSON.stringify(_??"");function ZF({body:_}){if(_===null||typeof _!=="object"||Array.isArray(_))return $.jsxDEV(U2,{v:_},void 0,!1,void 0,this);let Q=_,J=Array.isArray(Q.messages)?Q.messages:null,q=Object.entries(Q).filter(([U])=>!(J&&U==="messages"));return $.jsxDEV($.Fragment,{children:[q.length?$.jsxDEV("dl",{className:"fields",children:q.map(([U,G])=>$.jsxDEV(r.default.Fragment,{children:[$.jsxDEV("dt",{children:U},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(U2,{v:G},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},U,!0,void 0,this))},void 0,!1,void 0,this):null,J?$.jsxDEV("ol",{className:"messages",children:J.map((U,G)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:"role",children:typeof U.role==="string"?U.role:"message"},void 0,!1,void 0,this),$.jsxDEV(TQ,{text:GF(U.content)},void 0,!1,void 0,this)]},G,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function RQ({fields:_}){let Q=Object.entries(_??{});if(Q.length===0)return $.jsxDEV("p",{className:"mode",children:"No fields."},void 0,!1,void 0,this);return $.jsxDEV("dl",{className:"fields",children:Q.map(([J,q])=>$.jsxDEV(r.default.Fragment,{children:[$.jsxDEV("dt",{children:J},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(U2,{v:q},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},J,!0,void 0,this))},void 0,!1,void 0,this)}var FF=(_)=>_.receipt?`${_.receipt.status??""}${_.receipt.externalId?` · ${_.receipt.externalId}`:""}${_.receipt.reason?` · ${_.receipt.reason}`:""}`:_.operation==="observed"?"observed from the vendor":_.provenance==="placeholder"?"default data":"none: it has not left this World";function HF(_){let Q=new Map,J=[],q=[],U=new Map;for(let G of _){if(G.entry.landsId||G.entry.aliasOf){q.push(G);continue}let Z={...G,copies:[]};if(J.push(Z),!Q.has(`${G.twin}:${G.entry.id}`))Q.set(`${G.twin}:${G.entry.id}`,Z);if(!U.has(`${G.twin}:${G.entry.subject.type}:${G.entry.subject.id}`))U.set(`${G.twin}:${G.entry.subject.type}:${G.entry.subject.id}`,Z)}for(let G of q){let Z=G.entry.landsId?Q.get(`${G.twin}:${G.entry.landsId}`):G.entry.aliasOf?U.get(`${G.twin}:${G.entry.subject.type}:${G.entry.aliasOf}`):void 0;if(Z)Z.copies.push(G);else J.push({...G,copies:[]})}return J.sort(BQ)}var B8={deployed:5,confirmed:4,landed:3,replayed:2,skipped:1};function o_(_){let Q=[_.entry.receipt,..._.copies.map((U)=>U.entry.receipt)].filter((U)=>Boolean(U?.status));if(Q.length===0)return null;let J=Q.find((U)=>U.status==="failed"||U.status==="refused"),q=[...Q].sort((U,G)=>(B8[G.status]??0)-(B8[U.status]??0))[0];return J&&!(B8[q.status]>=5)?{status:J.status,bad:!0}:{status:q.status,bad:!1}}var k0=1280,c0=820,s4=160,P0=72,T8=120,XF=72,e4="This World shows its branches' sites only on this machine.",m1=(_)=>`${_.vendor}:${_.id}`,E2=(_)=>`${_.vendor}:section:${_.section.id}`,g2=(_)=>[_.section.id,..._.section.aka??[]].map((Q)=>`${_.vendor}:section:${Q}`),J3=(_,Q)=>Q.at&&("site"in Q.at)?Q.at.site:Q.at?`${l0}/${_}/${Q.vendor}${Q.at.screen}`:null,OQ=(_,Q,J)=>J.at&&("screen"in J.at)?`${l0}/-/${_}/branches/${Q}/pages?${new URLSearchParams({land:`/${Q}/${J.vendor}${J.at.screen}`}).toString()}`:J3(Q,J),n_=(_,Q)=>_.include?Q.filter((J)=>_.include.includes(m1(J))||g2(J).some((q)=>_.include.includes(q))):Q.filter((J)=>!(_.hidden??[]).includes(m1(J)));function KF({data:_}){let{frame:Q,url:J,active:q,picked:U,boards:G,addTo:Z,remove:F,compare:X,grab:Y,branch:K}=_,H=m1(Q),L=G.filter((W)=>W.include&&!W.include.includes(H)&&!g2(Q).some((I)=>W.include.includes(I))),z=S1((W)=>W.transform[2]*(P0+T8)>=XF);return $.jsxDEV($.Fragment,{children:[$.jsxDEV(X8,{isVisible:z||U||q,position:X1.Top,align:"start",className:"frame-label",children:[$.jsxDEV("span",{className:"frame-name",onPointerDown:Y,children:[$.jsxDEV(d1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:Q.title},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q.changes?$.jsxDEV("button",{type:"button",className:"frame-changed nodrag",onClick:()=>X(H),title:`${x1(Q.changes,"change")} ${K?"on this branch":"here, not in a changeset"}: compare`,children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),Q.changes]},void 0,!0,void 0,this):U?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>X(H),title:"Compare with a branch of this World","aria-label":`Compare ${Q.title} with a branch`,children:$.jsxDEV(w1,{name:"file-diff",size:14},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,U&&L.length?$.jsxDEV("select",{className:"nodrag frame-add",value:"","aria-label":`Add ${Q.title} to a board`,onChange:(W)=>{if(W.target.value)Z(W.target.value,H)},children:[$.jsxDEV("option",{value:"",children:"Add to board…"},void 0,!1,void 0,this),L.map((W)=>$.jsxDEV("option",{value:W.id,children:W.name},W.id,!1,void 0,this))]},void 0,!0,void 0,this):null,U&&F?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>F.act(H),title:F.label,"aria-label":F.label,children:"✕"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:q?"frame on":U?"frame picked":"frame",style:{width:k0,height:c0},children:[$.jsxDEV("div",{className:"frame-bar",children:[$.jsxDEV(d1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("strong",{children:[M1(Q.vendor)," · ",Q.kind]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"frame-url",children:Q.url.replace(/^https?:\/\//,"")},void 0,!1,void 0,this),J?$.jsxDEV("a",{className:"nodrag",href:J,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${Q.title} in a new tab`,children:"↗"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:q?"frame-body nodrag nopan nowheel":"frame-body",children:J?$.jsxDEV("iframe",{title:Q.title,src:J,loading:"lazy",style:{pointerEvents:q?"auto":"none"}},void 0,!1,void 0,this):$.jsxDEV("div",{className:"frame-none",children:[$.jsxDEV("p",{children:$.jsxDEV("strong",{children:Q.unseen==="branch-sites"?e4:Q.unseen==="sites-not-routed"?`This World shows ${Q.title} only at its own local address.`:`${M1(Q.vendor)}'s twin draws no page for this ${Q.kind} yet.`},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:Q.url},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function IQ({name:_,label:Q,done:J}){let q=r.useRef(!1),U=(G)=>{if(q.current)return;q.current=!0,J(G?.trim()&&G.trim()!==_?G.trim().slice(0,80):null)};return $.jsxDEV("input",{className:"nodrag nopan name-field","aria-label":Q,defaultValue:_,size:Math.max(8,_.length+2),autoFocus:!0,onFocus:(G)=>G.currentTarget.select(),onKeyDown:(G)=>{if(G.key==="Enter")U(G.currentTarget.value);else if(G.key==="Escape")U(null)},onBlur:(G)=>U(G.currentTarget.value)},void 0,!1,void 0,this)}function YF({data:_}){return $.jsxDEV($.Fragment,{children:[$.jsxDEV(h_,{isVisible:_.picked&&_.editable,minWidth:480,minHeight:360,color:"var(--accent)",onResizeEnd:_.resized},void 0,!1,void 0,this),$.jsxDEV(X8,{isVisible:!0,position:X1.Top,align:"start",offset:-30,className:"section-tag",children:[_.renaming?$.jsxDEV(IQ,{name:_.name,label:"Name this section",done:(Q)=>_.renamed(_.key,Q)},void 0,!1,void 0,this):$.jsxDEV("button",{type:"button",className:_.picked?"nodrag on":"nodrag",onPointerDown:_.grab,onClick:()=>_.pick(_.key),onDoubleClick:()=>{if(_.editable)_.rename(_.key)},title:_.editable?"Double-click to rename":void 0,children:[_.vendor?$.jsxDEV(d1,{vendor:_.vendor},void 0,!1,void 0,this):null,$.jsxDEV("span",{children:_.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.picked&&_.editable&&!_.renaming?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>_.remove(_.key),"aria-label":`Remove the section ${_.name}`,title:"Remove the section (its frames stay)",children:"✕"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:_.picked?"section-box on":"section-box"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function e_({url:_,title:Q}){return $.jsxDEV("div",{className:"compare-thumb",style:{width:420,height:420*c0/k0},children:$.jsxDEV("iframe",{title:Q,src:_,loading:"lazy",style:{width:k0,height:c0,transform:`scale(${420/k0})`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function LF({name:_,token:Q,frame:J,onClose:q,reads:U,viewing:G=""}){let[Z,F]=r.useState(G?"world":J.since?"before":""),[X,Y]=r.useState({state:"opening"}),[K,H]=r.useState(null),L=r.useRef(new Set),z=V1(Q,`/-/${_}/branches`,U),W=z.state==="ok"?z.data.branches.filter((O)=>O.name!==G&&O.name!==K&&!L.current.has(O.name)):[],I=V1(Q,G?`/-/${_}/board`:null,U),R=I.state==="ok"?I.data.frames.find((O)=>m1(O)===m1(J)):void 0,A=V1(Q,`/-/${_}/${G?`branches/${G}/`:""}board/changes?frame=${encodeURIComponent(m1(J))}`,U),N=async(O,C,f)=>{let S=J.at;if("site"in S){let E=new URL(J.url),l=C&&/^https?:\/\/\{host\}\./.test(C)?C.replace("{host}",E.hostname.toLowerCase()):null;return l?{url:`${l}${E.pathname}${E.search}`}:{why:e4}}let w=`${l0}/-/${_}/branches/${O}/pages?${new URLSearchParams({land:`/${O}/${J.vendor}${S.screen}`}).toString()}`,k=await fetch(w,{credentials:"same-origin",redirect:"manual"}).catch(()=>null);if(f())return{why:""};return k?.type==="opaqueredirect"?{url:w}:{why:`This World does not show its branches' pages${k?`: ${await z0(k)}`:""}.`}};r.useEffect(()=>{if(Z==="world"){if(I.state==="loading"){Y({state:"opening"});return}let E=R?J3(_,R):null;Y(E?{state:"ok",url:E}:{state:"none",why:I.state==="error"?I.error:"The World has no page here to show."});return}if(!J.at){Y({state:"none",why:J.unseen==="branch-sites"?e4:`${M1(J.vendor)}'s twin draws no page for this ${J.kind} yet; its changes are listed below.`});return}if(Z===""){Y({state:"none",why:"Choose a branch of this World to set beside it."});return}let O=!1;if(Z!=="before"){Y({state:"opening"});let E=z.state==="ok"?z.data.branches.find((c)=>c.name===Z):void 0,l=setTimeout(()=>void N(Z,E?.sites??null,()=>O).then((c)=>{if(!O)Y("url"in c?{state:"ok",url:c.url}:{state:"none",why:c.why})}),300);return()=>{O=!0,clearTimeout(l)}}if(!J.since){Y({state:"none",why:"Nothing here has changed since the World was last cut."});return}Y({state:"opening"});let C=new Date(Date.parse(J.since)-1).toISOString(),f=null,S=setTimeout(()=>void(async()=>{let E=await y1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:C},ttl:3600}),signal:AbortSignal.timeout(60000)}).catch(()=>null);if(!E?.ok){Y({state:"none",why:`The World made no copy of itself as it was then${E?`: ${await z0(E)}`:""}.`});return}let l=await E.json();if(f=l.name,H(l.name),L.current.add(l.name),O){y1(Q,`/-/${_}/branches/${l.name}`,{method:"DELETE"}).catch(()=>null);return}let c=await N(l.name,l.sites??null,()=>O);if(!O)Y("url"in c?{state:"ok",url:c.url,at:C}:{state:"none",why:c.why})})(),500),w=()=>{if(f)y1(Q,`/-/${_}/branches/${f}`,{method:"DELETE",keepalive:!0}).catch(()=>null);f=null},k=(E)=>{if(!E.persisted)w()};return window.addEventListener("pagehide",k),()=>{O=!0,clearTimeout(S),window.removeEventListener("pagehide",k),w(),H(null)}},[_,Q,J.vendor,J.id,J.since,Z,I.state,JSON.stringify(R?.at)]);let B=G?OQ(_,G,J):J3(_,J),T=!J.at||Z!==""?null:z.state==="ok"&&W.length===0?"This World has no branches to set beside it: make one under Branches.":z.state==="error"?`The World's branches could not be read: ${z.error}`:null;return $.jsxDEV("div",{className:"compare",role:"dialog","aria-label":`Changes to ${J.title}`,children:[$.jsxDEV("div",{className:"compare-head",children:[$.jsxDEV(d1,{vendor:J.vendor},void 0,!1,void 0,this),$.jsxDEV("strong",{children:J.title},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:J.changes?`${x1(J.changes,"change")} ${G?"on this branch":"not yet cut"}${J.since?`, since ${D2(J.since)}`:""}`:G?"No changes here on this branch":"No changes here not yet cut"},void 0,!1,void 0,this),J.at?$.jsxDEV("label",{className:"compare-base",children:["Compare with"," ",$.jsxDEV("select",{value:Z,onChange:(O)=>F(O.target.value),children:[Z===""?$.jsxDEV("option",{value:"",children:"Choose a branch…"},void 0,!1,void 0,this):null,G?$.jsxDEV("option",{value:"world",children:"The World"},void 0,!1,void 0,this):null,!G&&(J.since||Z==="before")?$.jsxDEV("option",{value:"before",children:"Before these changes"},void 0,!1,void 0,this):null,Z&&Z!=="before"&&Z!=="world"&&!W.some((O)=>O.name===Z)?$.jsxDEV("option",{value:Z,children:Z.split("/")[1]},void 0,!1,void 0,this):null,W.map((O)=>$.jsxDEV("option",{value:O.name,children:[O.name.split("/")[1],O.at?.label?` (${O.at.label})`:O.at?.instant?` (as of ${D2(O.at.instant)})`:O.at?.live?" (live)":""]},O.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("button",{type:"button",className:"ghost",onClick:q,"aria-label":"Close the comparison",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"compare-sides",children:[$.jsxDEV("figure",{children:[$.jsxDEV("figcaption",{children:Z==="before"?`Before${X.state==="ok"&&X.at?` · as of ${D2(X.at)}`:""}`:Z==="world"?"The World":Z?Z.split("/")[1]:"A branch"},void 0,!1,void 0,this),T?$.jsxDEV("p",{className:"mode compare-note",children:T},void 0,!1,void 0,this):X.state==="ok"?$.jsxDEV(e_,{url:X.url,title:`${J.title} before`},void 0,!1,void 0,this):X.state==="opening"?$.jsxDEV("p",{className:"mode compare-note",role:"status",children:"Opening the World as it was…"},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode compare-note",children:X.why},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("figure",{children:[$.jsxDEV("figcaption",{children:G?`${G.split("/")[1]} · branch`:"Now"},void 0,!1,void 0,this),B?$.jsxDEV(e_,{url:B,title:`${J.title} now`},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode compare-note",children:J.unseen==="branch-sites"?e4:`${M1(J.vendor)}'s twin draws no page for this ${J.kind} yet.`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),A.state==="error"?$.jsxDEV("p",{role:"alert",className:"mode",children:["Its changes could not be read: ",A.error]},void 0,!0,void 0,this):null,Z!=="before"&&Z&&A.state==="ok"&&A.data.acts.length?$.jsxDEV("p",{className:"mode compare-acts-head",children:G?"This branch’s changes here:":"This World's own changes here, not yet cut:"},void 0,!1,void 0,this):null,$.jsxDEV("ol",{className:"compare-acts",children:(A.state==="ok"?A.data.acts:[]).map((O)=>{let C=O.entries[0],f=N0({...C,service:J.vendor,id:"",occurredAt:O.at});return $.jsxDEV("li",{children:[$.jsxDEV("span",{className:"mode",children:D2(O.at)},void 0,!1,void 0,this),$.jsxDEV("details",{children:[$.jsxDEV("summary",{children:[$.jsxDEV("strong",{children:f.what},void 0,!1,void 0,this),f.label?` · ${f.label}`:"",O.writes>1?$.jsxDEV("span",{className:"mode",children:[" and ",x1(O.writes-1,"more write")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:[O.entries.map((S,w)=>$.jsxDEV("li",{children:[$.jsxDEV("code",{children:S.operation??S.op},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[S.subject.type," ",q2(S)]},void 0,!0,void 0,this)]},w,!0,void 0,this)),O.writes>O.entries.length?$.jsxDEV("li",{className:"mode",children:["and ",x1(O.writes-O.entries.length,"more write")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},`${O.at}:${C.subject.type}:${C.subject.id}`,!0,void 0,this)})},void 0,!1,void 0,this),A.state==="ok"&&A.data.total>A.data.acts.length?$.jsxDEV("p",{className:"mode",children:["and ",x1(A.data.total-A.data.acts.length,"earlier change"),", in Changes"]},void 0,!0,void 0,this):null,!G?$.jsxDEV("a",{className:"compare-all",href:`${R1}/${_}/~/changes`,onClick:(O)=>{O.preventDefault(),j1([..._.split("/"),"~","changes"])},children:"Every change in the World →"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var zF={screen:KF,section:YF};function WF(_){let[Q,J]=r.useState(()=>new URLSearchParams(window.location.search).get("viewing")??"");return r.useEffect(()=>{let U=()=>J(new URLSearchParams(window.location.search).get("viewing")??"");return window.addEventListener("popstate",U),()=>window.removeEventListener("popstate",U)},[]),$.jsxDEV(H8,{children:$.jsxDEV(AF,{..._,viewing:Q,view:(U)=>{let G=new URL(window.location.href);if(U)G.searchParams.set("viewing",U);else G.searchParams.delete("viewing");window.history.pushState(null,"",G),window.dispatchEvent(new PopStateEvent("popstate"))}},void 0,!1,void 0,this)},`${_.name}:${Q}`,!1,void 0,this)}function AF({name:_,token:Q,session:J,retry:q,snapshot:U,back:G,canWrite:Z,viewing:F,view:X}){let Y=r.useRef(null),K=r.useRef(0),H=r.useRef(Promise.resolve()),L=r.useRef(0),[,z]=r.useState(0),[W,I]=r.useState({state:"loading"}),[R,A]=r.useState(null),[N,B]=r.useState(0),T=V1(Q,`/-/${_}/branches`,N),O=T.state==="ok"?T.data.branches.find((u)=>u.name===F):void 0,C=T.state==="ok"?T.data.branches.filter((u)=>!(u.at?.instant&&u.expiresAt&&!u.at.label)):[],f=r.useRef(0),S=r.useRef(0),w=r.useCallback(async()=>{let u=L.current,a=++f.current,U1=F?`branches/${F.split("/").map(encodeURIComponent).join("/")}/board`:"board",[G1,C1]=await Promise.all([y1(Q,`/-/${_}/${U1}`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),F?y1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null):Promise.resolve(null)]),H1=G1?.ok?await G1.json().catch(()=>null):null,z1=F?C1?.ok?await C1.json().catch(()=>null):null:H1;if(H1&&z1)H1.boards=z1.boards,H1.version=z1.version;if(a<S.current)return;if(S.current=a,!H1?.frames||!z1?.boards||!z1.version){let B1=!G1?.ok?G1:C1,f1=B1?`the World answered ${B1.status}`:"the World did not answer";I((g1)=>g1.state==="ok"?g1:{state:"error",status:B1?.status??0,error:f1}),A(f1);return}if(A(null),B((B1)=>B1+1),u===L.current&&K.current===0)Y.current={boards:H1.boards,version:H1.version};I({state:"ok",data:H1})},[Q,_,F]);r.useEffect(()=>{w();let u=setInterval(()=>{if(!document.hidden)w()},1e4);return()=>clearInterval(u)},[w]);let k=W.state==="ok"?W.data.frames.map((u)=>F&&u.at&&("site"in u.at)&&!/^https?:\/\/\{host\}\./.test(O?.sites??"")?{...u,at:null,unseen:"branch-sites"}:u):[],E=Y.current?.boards??[{id:"everything",name:"Everything"}],[l,c]=r.useState(null),y=k.some((u)=>u.changes),D=l??(y?"changes":"everything"),v=(D==="changes"?E[0]:E.find((u)=>u.id===D))??E[0],[x,V]=r.useState(new Set),b=Z&&!U&&!F,P=r.useCallback((u)=>{if(!b)return Promise.resolve();if(!Y.current)return l1("The board is being read again: make that change once it shows","error"),Promise.resolve();Y.current={...Y.current,boards:u(Y.current.boards)},K.current+=1,L.current+=1,z((U1)=>U1+1);let a=H.current.then(async()=>{let U1=Y.current;if(!U1)return;try{let G1=await y1(Q,`/-/${_}/board`,{method:"PUT",body:JSON.stringify({boards:U1.boards,version:U1.version}),signal:AbortSignal.timeout(15000)}),C1=await G1.json().catch(()=>null);if(G1.ok&&C1?.boards&&C1.version)Y.current={boards:K.current>1&&Y.current?Y.current.boards:C1.boards,version:C1.version};else if(G1.status===409&&C1?.boards&&C1.version)Y.current={boards:C1.boards,version:C1.version},l1("Someone else changed the board first: it is shown as they left it","error");else throw Error(C1?.error??`the World answered ${G1.status}`)}catch(G1){l1(`The board was not kept: ${G1 instanceof Error?G1.message:String(G1)}`,"error"),Y.current=null;let C1=await y1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),H1=C1?.ok?await C1.json().catch(()=>null):null;if(H1?.boards&&H1.version)Y.current={boards:H1.boards,version:H1.version}}}).finally(()=>{if(K.current-=1,L.current+=1,z((U1)=>U1+1),K.current===0&&!Y.current)w()});return H.current=a,a},[Q,_,w,b]),j=(u,a)=>{P((U1)=>U1.map((G1)=>G1.id===u?a(G1):G1))},m=(u)=>u.parent?`${u.vendor}:${u.parent}`:null,h=new Set(k.map(m1)),o=(u)=>{let a=m(u);return!a||!h.has(a)},e=D==="changes"?k.filter((u)=>u.changes):v.include?n_(v,k):n_(v,k).filter((u)=>o(u)||x.has(m(u))),s=k.filter((u)=>u.changes&&!e.includes(u)).reduce((u,a)=>u+a.changes,0),[t,p]=r.useState(null),[n,J1]=r.useState(null),[q1,F1]=r.useState(null),Z1=d5(),T1=E.filter((u)=>u.include),L1=(u,a)=>j(u,(U1)=>({...U1,include:[...U1.include??[],a]})),_1={label:v.include?"Take it off this board":"Hide it",act:(u)=>{J1(null),j(v.id,(a)=>a.include?{...a,include:a.include.filter((U1)=>U1!==u)}:{...a,hidden:[...a.hidden??[],u]})}},W1=(u)=>({x:u.position.x,y:u.position.y,w:u.width??u.measured?.width??k0,h:u.height??u.measured?.height??c0}),K1=(u,a)=>{let U1=W1(u),G1=U1.x+U1.w/2,C1=U1.y+U1.h/2;return a.filter((H1)=>H1.type==="section").map((H1,z1)=>({s:H1,i:z1})).filter(({s:H1})=>{let z1=W1(H1);return G1>=z1.x&&G1<=z1.x+z1.w&&C1>=z1.y&&C1<=z1.y+z1.h}).sort((H1,z1)=>W1(H1.s).w*W1(H1.s).h-W1(z1.s).w*W1(z1.s).h||z1.i-H1.i)[0]?.s},p1=r.useCallback(()=>{let u=new Map;for(let B1 of e){let f1=v.placed?.[m1(B1)];if(f1)u.set(m1(B1),f1)}let a=Math.max(-s4,...[...u.values()].map((B1)=>B1.y+c0)),U1=[...new Set(e.map(E2))];for(let B1 of U1){let f1=e.filter((h1)=>E2(h1)===B1),g1=f1.filter((h1)=>u.has(m1(h1))).map((h1)=>u.get(m1(h1))),I1=g1.length?Math.max(...g1.map((h1)=>h1.x))+k0+s4:0,r1=g1.length?Math.min(...g1.map((h1)=>h1.y)):a+s4+P0*2+T8;for(let h1 of f1)if(!u.has(m1(h1)))u.set(m1(h1),{x:I1,y:r1}),I1+=k0+s4;a=Math.max(a,r1+c0)}let G1=v.sections??{},C1=(B1,f1,g1,I1,r1)=>({id:`sec:${B1}`,type:"section",position:{x:f1.x,y:f1.y},width:f1.w,height:f1.h,zIndex:0,draggable:b,data:{key:B1,name:g1,vendor:I1,named:r1}}),H1=[];for(let B1 of U1){let f1=e.find((D1)=>E2(D1)===B1),g1=g2(f1).find((D1)=>G1[D1])??B1,I1=G1[g1];if(I1?.gone)continue;let r1=e.filter((D1)=>E2(D1)===B1).map((D1)=>u.get(m1(D1))),h1={x:Math.min(...r1.map((D1)=>D1.x))-P0,y:Math.min(...r1.map((D1)=>D1.y))-P0-T8,w:0,h:0};h1.w=Math.max(...r1.map((D1)=>D1.x))+k0+P0-h1.x,h1.h=Math.max(...r1.map((D1)=>D1.y))+c0+P0-h1.y;let z5=e.filter((D1)=>E2(D1)===B1&&!v.placed?.[m1(D1)]).map((D1)=>u.get(m1(D1))),A0=I1?{...I1}:h1;if(I1)for(let D1 of z5)A0.w=Math.max(A0.w,D1.x+k0+P0-A0.x),A0.h=Math.max(A0.h,D1.y+c0+P0-A0.y);H1.push(C1(g1,A0,I1?.name??`${M1(f1.vendor)} · ${f1.section.title}`,f1.vendor,Boolean(I1?.name)))}for(let[B1,f1]of Object.entries(G1))if(B1.startsWith("user:")&&!f1.gone)H1.push(C1(B1,f1,f1.name??"Section",null,!0));let z1=e.map((B1)=>({id:m1(B1),type:"screen",zIndex:1,width:k0,height:c0,draggable:b,position:u.get(m1(B1)),data:{world:_,branch:Boolean(F),frame:B1,url:F?OQ(_,F,B1):J3(_,B1)}}));return[...H1,...z1]},[JSON.stringify(e),JSON.stringify(v),_,b,F]),[s1,a1,j0]=S_([]),K0=S1((u)=>u.transform[2]),T0=r.useRef("");r.useEffect(()=>{let u=p1();if(a1(u),u.length&&T0.current!==D)T0.current=D,requestAnimationFrame(()=>{Z1.fitView({padding:{top:"72px",left:"272px",right:"40px",bottom:"72px"},duration:0})})},[p1,a1]);let Q0=(u,a=[],U1={})=>{let G1=Object.fromEntries(a.map((H1)=>{let z1=Z1.getNode(`sec:${H1}`);if(!z1)return[H1,void 0];let B1=W1(z1),f1=z1.data,g1=U1[H1]??(f1.named?f1.name:void 0);return[H1,{x:Math.round(B1.x),y:Math.round(B1.y),w:Math.round(B1.w),h:Math.round(B1.h),...g1?{name:g1.slice(0,80)}:{}}]}).filter(([,H1])=>H1!==void 0)),C1=Object.fromEntries(Object.entries(u).map(([H1,z1])=>[H1,{x:Math.round(z1.x),y:Math.round(z1.y)}]));j(v.id,(H1)=>({...H1,placed:{...H1.placed??{},...C1},sections:{...H1.sections??{},...G1}}))},e1=r.useRef(null),F0=(u,a)=>{if(a.type!=="section"){e1.current=null;return}let U1=Z1.getNodes(),G1=W1(a),C1=(H1)=>{let z1=W1(H1);if(H1.type==="screen"){let B1=z1.x+z1.w/2,f1=z1.y+z1.h/2;return B1>=G1.x&&B1<=G1.x+G1.w&&f1>=G1.y&&f1<=G1.y+G1.h}return H1.id!==a.id&&z1.x>=G1.x&&z1.y>=G1.y&&z1.x+z1.w<=G1.x+G1.w&&z1.y+z1.h<=G1.y+G1.h};e1.current={id:a.id,from:{...a.position},members:U1.filter(C1).map((H1)=>({id:H1.id,x:H1.position.x,y:H1.position.y}))}},W0=(u,a)=>{let U1=e1.current;if(!U1||U1.id!==a.id)return;let G1=a.position.x-U1.from.x,C1=a.position.y-U1.from.y,H1=new Map(U1.members.map((z1)=>[z1.id,z1]));a1((z1)=>z1.map((B1)=>{let f1=H1.get(B1.id);return f1?{...B1,position:{x:f1.x+G1,y:f1.y+C1}}:B1}))},r0=(u,a)=>{let U1=e1.current;e1.current=null;let G1=a.position.x-(U1?.from.x??a.position.x),C1=a.position.y-(U1?.from.y??a.position.y),H1=a.type==="screen"?[{id:a.id,x:a.position.x,y:a.position.y}]:(U1?.members??[]).map((z1)=>({...z1,x:z1.x+G1,y:z1.y+C1}));requestAnimationFrame(()=>{let z1=Z1.getNodes(),B1=new Map(H1.filter((I1)=>!I1.id.startsWith("sec:")).map((I1)=>[I1.id,{x:I1.x,y:I1.y}])),f1=new Set([...a.type==="section"?[a.data.key]:[],...H1.filter((I1)=>I1.id.startsWith("sec:")).map((I1)=>I1.id.slice(4))]),g1=new Set(z1.filter((I1)=>B1.has(I1.id)).flatMap((I1)=>g2(I1.data.frame)));for(let I1 of z1){if(I1.type==="screen"&&g2(I1.data.frame).some((r1)=>g1.has(r1))&&!B1.has(I1.id))B1.set(I1.id,{x:I1.position.x,y:I1.position.y});if(I1.type==="section"&&g1.has(I1.data.key))f1.add(I1.data.key)}Q0(Object.fromEntries(B1),[...f1])})},w0=(u)=>Object.fromEntries(Z1.getNodes().filter((a)=>a.type==="screen"&&g2(a.data.frame).includes(u)).map((a)=>[a.id,{x:a.position.x,y:a.position.y}])),[i0,f0]=r.useState(null),G2=(u)=>{J1(`sec:${u}`),f0(u)},l2=(u,a)=>{if(f0(null),!a)return;a1((U1)=>U1.map((G1)=>G1.id===`sec:${u}`?{...G1,data:{...G1.data,name:a,named:!0}}:G1)),requestAnimationFrame(()=>Q0(w0(u),[u],{[u]:a}))},V0=(u)=>{J1(null);let a=Z1.getNode(`sec:${u}`);j(v.id,(U1)=>{let G1=Object.fromEntries(Object.entries(U1.sections??{}).filter(([C1])=>C1!==u));return{...U1,sections:u.startsWith("user:")?G1:{...G1,[u]:{...a?{x:Math.round(a.position.x),y:Math.round(a.position.y),w:Math.round(W1(a).w),h:Math.round(W1(a).h)}:{x:0,y:0,w:0,h:0},gone:!0}}}})},M=()=>{let u=n?Z1.getNode(n):void 0,a=Z1.screenToFlowPosition({x:window.innerWidth/2,y:window.innerHeight/2}),U1=u?.type==="screen"?{x:u.position.x-P0,y:u.position.y-P0,w:k0+P0*2,h:c0+P0*2}:{x:a.x-900,y:a.y-600,w:1800,h:1200},G1=`user:${Date.now().toString(36)}`,C1=Object.keys(v.sections??{}).filter((H1)=>H1.startsWith("user:")).length+1;J1(`sec:${G1}`),j(v.id,(H1)=>({...H1,sections:{...H1.sections??{},[G1]:{x:Math.round(U1.x),y:Math.round(U1.y),w:Math.round(U1.w),h:Math.round(U1.h),name:`Section ${C1}`}}}))},g=(u)=>(a)=>{if(!b||a.button!==0)return;let U1=Z1.getNode(u);if(!U1)return;let G1=a.currentTarget;G1.setPointerCapture(a.pointerId);let{clientX:C1,clientY:H1}=a,z1={...U1.position},B1=!1,f1=(r1)=>{let h1=Z1.getZoom();return{...U1,position:{x:z1.x+(r1.clientX-C1)/h1,y:z1.y+(r1.clientY-H1)/h1}}},g1=(r1)=>{if(!B1&&Math.hypot(r1.clientX-C1,r1.clientY-H1)<4)return;if(!B1)B1=!0,F0(null,U1);let h1=f1(r1);a1((z5)=>z5.map((A0)=>A0.id===u?{...A0,position:h1.position}:A0)),W0(null,h1)},I1=(r1)=>{if(G1.removeEventListener("pointermove",g1),G1.removeEventListener("pointerup",I1),G1.removeEventListener("pointercancel",I1),B1)r0(null,f1(r1)),G1.addEventListener("click",(h1)=>{h1.stopPropagation(),h1.preventDefault()},{capture:!0,once:!0});else if(U1.type==="screen")J1(u)};G1.addEventListener("pointermove",g1),G1.addEventListener("pointerup",I1),G1.addEventListener("pointercancel",I1)},Q1=s1.map((u)=>u.type==="section"?{...u,data:{...u.data,grab:g(u.id),picked:n===u.id,editable:b,renaming:b&&i0===u.data.key,pick:(a)=>J1(`sec:${a}`),rename:G2,renamed:l2,remove:V0,resized:()=>requestAnimationFrame(()=>{let a=u.data.key;Q0(w0(a),[a])})}}:{...u,data:{...u.data,grab:g(u.id),active:t===u.id,picked:n===u.id,boards:b?T1:[],addTo:L1,remove:!b||v.include&&!v.include.includes(u.id)?null:_1,compare:(a)=>{J1(a),F1(a)}}});r.useEffect(()=>{let u=(a)=>{if(a.target?.closest("input, textarea, select, [contenteditable]"))return;if(a.key==="Escape"){if(t)p(null);else J1(null);return}if(!b||t)return;if((a.key==="Delete"||a.key==="Backspace")&&n){if(a.preventDefault(),n.startsWith("sec:"))V0(n.slice(4));else if(!v.include||v.include.includes(n))_1.act(n);else l1("It is on this board with its whole group: take the group off in the list to remove it","error");return}if(a.key==="S"&&a.shiftKey&&!a.metaKey&&!a.ctrlKey)a.preventDefault(),M()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)});let $1=(u)=>{J1(u);let a=Z1.getNode(u);if(!a)return;let U1=W1(a);Z1.fitBounds({x:U1.x,y:U1.y,width:U1.w,height:U1.h},{padding:0.15,duration:400})},Y1=()=>{let u=`board-${Date.now().toString(36)}`;c(u),P((a)=>[...a,{id:u,name:`Board ${a.length}`,include:[]}])},P1=()=>f0(`board:${v.id}`),O1=()=>{let u=v.id;c(null),P((a)=>a.filter((U1)=>U1.id!==u))},v1=[...new Map(k.map((u)=>[E2(u),u])).values()],N1=v.include?[...v1.filter((u)=>!g2(u).some((a)=>v.include.includes(a))).map((u)=>({key:E2(u),label:`${M1(u.vendor)} · ${u.section.title} (all)`})),...k.filter((u)=>!e.includes(u)).map((u)=>({key:m1(u),label:u.title}))]:[],Y0=v.include?[]:k.filter((u)=>(v.hidden??[]).includes(m1(u))),u0=s1.filter((u)=>u.type==="section"),B2=s1.filter((u)=>u.type==="screen"),r2=new Map(B2.map((u)=>[u.id,K1(u,s1)?.id??null])),i2=new Map;for(let u of k){let a=m(u);if(a&&h.has(a))i2.set(a,(i2.get(a)??0)+1)}let Q4=(u)=>{let a=u.data.frame;return $.jsxDEV("li",{children:[$.jsxDEV("button",{type:"button",className:n===u.id?"on":void 0,onClick:()=>$1(u.id),onDoubleClick:()=>p(u.id),children:[$.jsxDEV(d1,{vendor:a.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:a.title},void 0,!1,void 0,this),a.changes?$.jsxDEV("span",{className:"layer-changed",title:`${x1(a.changes,"change")} ${F?"on this branch":"not in a changeset"}: its mark on the board opens a comparison`,children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),a.changes]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),i2.get(u.id)&&D!=="changes"&&!v.include?$.jsxDEV("button",{type:"button",className:"ghost layer-open","aria-expanded":x.has(u.id),onClick:()=>V((U1)=>{let G1=new Set(U1);if(G1.has(u.id))G1.delete(u.id);else G1.add(u.id);return G1}),title:x.has(u.id)?"Close the pages under it":"Open the pages under it",children:[x.has(u.id)?"−":"+",i2.get(u.id)]},void 0,!0,void 0,this):null]},u.id,!0,void 0,this)},q3=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,U3=J.state==="ok"&&W.state==="ok";return $.jsxDEV("div",{className:"canvas full",role:"region","aria-label":"The World's board",style:{"--zoom":K0},children:$.jsxDEV(C_,{nodes:U3?Q1:[],onNodesChange:j0,nodeTypes:zF,onNodeDragStart:F0,onNodeDrag:W0,onNodeDragStop:r0,onNodeClick:(u,a)=>{if(a.id!==t)J1(a.id)},onNodeDoubleClick:(u,a)=>{if(a.type==="screen")J1(a.id),p(a.id)},onPaneClick:()=>{p(null),J1(null)},minZoom:0.03,maxZoom:1.5,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnPinch:!0,zoomOnScroll:!1,zoomOnDoubleClick:!1,colorMode:q3?"dark":"light",proOptions:{hideAttribution:!0},children:[$.jsxDEV(k_,{variant:m0.Dots,gap:28*2**Math.max(0,Math.ceil(Math.log2(16/(28*K0)))),size:2/K0},void 0,!1,void 0,this),$.jsxDEV(g0,{position:"top-left",className:"float layers",children:[$.jsxDEV("div",{className:"float-head",children:[$.jsxDEV("button",{type:"button",className:"back",onClick:G,"aria-label":`Back to ${_}`,children:"←"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"float-title",children:[$.jsxDEV("strong",{children:(F||_).split("/")[1]},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:[_.split("/")[0],F?" · branch":U?" · snapshot":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{className:"compare-base board-viewing",children:["Viewing",$.jsxDEV("select",{value:F,disabled:K.current>0,onChange:(u)=>X(u.target.value),children:[$.jsxDEV("option",{value:"",children:"The World"},void 0,!1,void 0,this),F&&!C.some((u)=>u.name===F)?$.jsxDEV("option",{value:F,children:[F," · branch"]},void 0,!0,void 0,this):null,C.map((u)=>$.jsxDEV("option",{value:u.name,children:[u.name.split("/")[1]," · branch"]},u.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T.state==="error"&&T.status!==404?$.jsxDEV("p",{className:"mode",role:"alert",children:["Branches could not be read: ",T.error]},void 0,!0,void 0,this):null,$.jsxDEV("div",{className:"board-tabs",role:"tablist","aria-label":"Boards",children:[$.jsxDEV("button",{type:"button",role:"tab","aria-selected":D==="changes",className:D==="changes"?"on":void 0,onClick:()=>{J1(null),p(null),c("changes")},title:F?"The pages whose records changed on this branch":"The pages whose records changed and are not yet in a changeset",children:["Changes",y?` (${k.filter((u)=>u.changes).length})`:""]},void 0,!0,void 0,this),E.map((u)=>i0===`board:${u.id}`?$.jsxDEV(IQ,{name:u.name,label:"Name this board",done:(a)=>{if(f0(null),a)j(u.id,(U1)=>({...U1,name:a}))}},u.id,!1,void 0,this):$.jsxDEV("button",{type:"button",role:"tab","aria-selected":D!=="changes"&&u.id===v.id,className:D!=="changes"&&u.id===v.id?"on":void 0,onClick:()=>{J1(null),p(null),c(u.id)},onDoubleClick:b&&u.id===v.id&&u.include?P1:void 0,children:u.name},u.id,!1,void 0,this)),b?$.jsxDEV("button",{type:"button",className:"ghost",onClick:Y1,"aria-label":"A new board",children:"+"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),v.include&&b?$.jsxDEV("div",{className:"board-acts",children:[$.jsxDEV("button",{type:"button",className:"ghost",onClick:P1,children:"Rename"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"ghost",onClick:O1,children:"Delete board"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("ul",{className:"layer-list","aria-label":"Layers",children:[u0.map((u)=>{let a=u.data;return $.jsxDEV("li",{children:[$.jsxDEV("button",{type:"button",className:n===u.id?"layer-section on":"layer-section",onClick:()=>$1(u.id),onDoubleClick:()=>{if(b)$1(u.id),G2(a.key)},children:[a.vendor?$.jsxDEV(d1,{vendor:a.vendor},void 0,!1,void 0,this):$.jsxDEV(w1,{name:"layout-grid",size:14},void 0,!1,void 0,this),$.jsxDEV("span",{children:a.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list inner",children:B2.filter((U1)=>r2.get(U1.id)===u.id).map(Q4)},void 0,!1,void 0,this)]},u.id,!0,void 0,this)}),B2.filter((u)=>!r2.get(u.id)).map(Q4)]},void 0,!0,void 0,this),v.include&&!e.length?$.jsxDEV("p",{className:"mode pad-s",children:"An empty board: add frames from Everything, or below."},void 0,!1,void 0,this):null,N1.length&&b?$.jsxDEV("select",{className:"board-add",value:"","aria-label":"Add to this board",onChange:(u)=>{let a=u.target.value;if(a)j(v.id,(U1)=>({...U1,include:[...U1.include??[],a]}))},children:[$.jsxDEV("option",{value:"",children:"Add to this board…"},void 0,!1,void 0,this),N1.map((u)=>$.jsxDEV("option",{value:u.key,children:u.label},u.key,!1,void 0,this))]},void 0,!0,void 0,this):null,Y0.length?$.jsxDEV("details",{className:"board-hidden",children:[$.jsxDEV("summary",{children:["Hidden (",Y0.length,")"]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list",children:Y0.map((u)=>$.jsxDEV("li",{children:b?$.jsxDEV("button",{type:"button",onClick:()=>j(v.id,(a)=>({...a,hidden:(a.hidden??[]).filter((U1)=>U1!==m1(u))})),children:[$.jsxDEV("span",{children:u.title},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Show"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("span",{className:"pad-s",children:u.title},void 0,!1,void 0,this)},m1(u),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,s?$.jsxDEV("button",{type:"button",className:"board-elsewhere",onClick:()=>c("changes"),children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),x1(s,"change")," not on this board"]},void 0,!0,void 0,this):null,$.jsxDEV(G0,{load:W,what:"the board"},void 0,!1,void 0,this),R&&W.state==="ok"?$.jsxDEV("p",{role:"alert",className:"pad-s",children:["The board could not be read again (",R,"): it shows what was last read."]},void 0,!0,void 0,this):null,J.state==="pending"?$.jsxDEV("p",{className:"mode",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,J.state==="error"?$.jsxDEV("p",{role:"alert",children:["The World did not open its screens: ",J.error," ",$.jsxDEV("button",{type:"button",onClick:q,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),t?$.jsxDEV(g0,{position:"top-center",className:"float hint using",children:[$.jsxDEV("span",{className:"mode",children:["Using ",e.find((u)=>m1(u)===t)?.title??t]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>p(null),children:["Done ",$.jsxDEV("kbd",{children:"Esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV(g0,{position:"top-center",className:"float hint mode",children:"Scroll to pan · pinch or ⌘ scroll to zoom · double-click a frame to use it"},void 0,!1,void 0,this),b?$.jsxDEV(g0,{position:"bottom-center",className:"float board-tools",children:$.jsxDEV("button",{type:"button",className:"ghost",onClick:M,title:"Section (⇧S): around the selected frame, else in the middle",children:[$.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Section"},void 0,!1,void 0,this),$.jsxDEV("kbd",{children:"⇧S"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,q1&&e.some((u)=>m1(u)===q1)?$.jsxDEV(g0,{position:"top-right",className:"float compare-panel",children:$.jsxDEV(LF,{viewing:F,name:_,token:Q,frame:e.find((u)=>m1(u)===q1),onClose:()=>F1(null),reads:N},q1,!1,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV(j_,{showInteractive:!1,position:"bottom-left"},void 0,!1,void 0,this),$.jsxDEV(u_,{pannable:!0,zoomable:!0,nodeBorderRadius:8,position:"bottom-right"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var PQ=(_)=>_.actions.map((Q)=>({twin:Q.service,entry:{...Q.action,service:Q.service,op:Q.action.op??Q.action.operation??""}})),BF=(_)=>{let Q=_.action.input??{};return!(typeof Q.operationId==="string"||Q.graphql!==void 0&&Q.graphql!==null)};function $3(_){let Q=_.actions.filter(BF).length,J=_.actions.length-Q,q=_.applied?.receipts??[],U=_.deployed??[],G=new Set([...U.filter((X)=>X.status==="deployed"),...q.filter((X)=>X.status==="confirmed")].map((X)=>X.actionId)).size,Z=new Set([...U.filter((X)=>X.status==="refused"||X.status==="failed"),...q.filter((X)=>X.status==="failed")].map((X)=>X.actionId)).size,F={performed:G,failed:Z,total:J,own:Q};if(J>0&&G>=J)return{label:"Deployed",tone:"done",...F};if(G>0)return{label:`Partly deployed: ${G} of ${J}`,tone:"warn",...F};if(Z>0)return{label:`${Z} refused or failed`,tone:"bad",...F};if(q.some((X)=>X.status==="replayed")&&q.every((X)=>X.status==="replayed"||X.status==="skipped"))return{label:"Pushed",tone:"good",...F};return{label:"Not sent",tone:"plain",...F}}var M8=(_)=>_.message??_.narration?.split(`
|
|
37
|
-
`)[0]?.replace(/ setting .*$/,"")??_.name;function NQ(_,Q=1){let J=_.currentHash??_.contentHash,q=_.readiness?.approvers??new Set(_.approvals.filter((G)=>G.contentHash===J).map((G)=>G.principal)).size,U=_.verification&&_.verification.contentHash===J?_.verification:null;if(U&&!U.passed)return{label:"Checks failed",tone:"bad"};if(q>0&&q<Q)return{label:`Approved by ${q} of ${Q}`,tone:"plain"};if(q>0)return{label:`Approved by ${q}`,tone:"good"};if(U)return{label:"Verified",tone:"good"};return{label:"Not verified",tone:"plain"}}function _Q({name:_,token:Q,signsAs:J,c:q,canWrite:U,rooted:G,refused:Z,onChanged:F,part:X,required:Y}){let K=X==="head",H=X==="review",[L,z]=r.useState(null),[W,I]=r.useState(!1),[R,A]=r.useState(""),[N,B]=r.useState(""),[T,O]=r.useState(null),C=V1(Q,`/-/${_}/origin`),f=$3(q),S=NQ(q,Y),w=PQ(q),k=[...new Set(w.map((h)=>h.twin))],E=k.some((h)=>G.includes(h)),l=(h)=>h===(q.currentHash??q.contentHash),c=q.applied?.receipts??[],y=(q.deployed??[]).filter((h)=>h.status!=="landed"),D=c.filter((h)=>h.status==="confirmed").length,v=y.filter((h)=>h.status==="deployed"),x=async(h,o,e,s)=>{z(h),O(null);try{let t=await y1(Q,o,{method:"POST",...e===void 0?{}:{body:JSON.stringify(e)}});if(!t.ok)return Z(t),O({what:h,...t1(await _2(t))}),!1;if(s)l1(s);return F(),!0}catch(t){return O({what:h,text:`the World did not answer (${t instanceof Error?t.message:String(t)})`,acts:[]}),!1}finally{z(null)}},V=()=>{x("Verify",`/-/${_}/changesets/${q.name}/verify`,void 0,"Verified: the checks ran over it")},b=async(h)=>{if(h.preventDefault(),await x("Approve",`/-/${_}/changesets/${q.name}/approve`,{...R.trim()?{note:R.trim()}:{},...J===null&&N.trim()?{as:N.trim()}:{}},"Approved"))I(!1),A("")},P=async()=>{let h=k.filter((o)=>G.includes(o));if(!await p0({title:`Deploy ${q.name} to the real vendors?`,body:$.jsxDEV($.Fragment,{children:["It performs its ",q.actions.length," change",q.actions.length===1?"":"s"," against the real account",h.length===1?"":"s"," behind ",b2(h.map(M1)),". This cannot be taken back here."]},void 0,!0,void 0,this),action:"Deploy",danger:!0,typed:q.name}))return;z("Deploy"),O(null);try{let o=await y1(Q,`/-/${_}/deploy/${q.name}`,{method:"POST",body:JSON.stringify({confirm:q.name})});if(!o.ok){Z(o),O({what:"Deploy",...t1(await _2(o))});return}let e=await y1(Q,`/-/${_}/changesets/${q.name}`),s=e.ok?await e.json():null;if(!s){l1("Deploy: sent; reading its receipts failed","info"),F();return}let t=$3(s);l1(`Deploy: ${t.performed} of ${t.total} change${t.total===1?"":"s"} performed at the vendor${t.failed?`; ${t.failed} refused or failed`:""}`,t.failed?"error":t.performed?"ok":"info"),F()}catch(o){O({what:"Deploy",text:`the World did not answer (${o instanceof Error?o.message:String(o)})`,acts:[]})}finally{z(null)}},j=!U?"This session reads the World; it changes nothing":f.label==="Deployed"?"Already deployed: every change was performed at the vendor":null,m=C.state==="ok"&&C.data.origin?w8(C.data.origin):null;return $.jsxDEV("div",{className:"changeset","aria-labelledby":"changeset-title",children:[K?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("div",{children:[$.jsxDEV("h3",{id:"changeset-title",children:[q.message??q.name," ",$.jsxDEV("span",{className:`badge cs-${f.tone}`,children:f.label},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:`badge cs-${S.tone}`,children:S.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("code",{children:q.name},void 0,!1,void 0,this)," · made ",$.jsxDEV(u1,{iso:q.createdAt},void 0,!1,void 0,this)," · ",q.actions.length," change",q.actions.length===1?"":"s"," at ",b2(k.map(M1))||"no vendor"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:[$.jsxDEV("button",{type:"button",onClick:V,disabled:Boolean(j)||L!==null,title:j??"Replay it in a throwaway World and run the World's checks",children:L==="Verify"?"Verifying…":"Verify"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>I(!0),disabled:Boolean(j)||L!==null,title:j??"Sign its current contents as yourself",children:"Approve…"},void 0,!1,void 0,this),E?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>void P(),disabled:Boolean(j)||L!==null,title:j??"Perform it against the real accounts behind this World",children:L==="Deploy"?"Deploying…":"Deploy…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),j&&f.label!=="Deployed"?$.jsxDEV("p",{className:"mode",children:[j,"."]},void 0,!0,void 0,this):null,T?$.jsxDEV("div",{role:"alert",className:"refusal",children:[$.jsxDEV("span",{children:[$.jsxDEV("b",{children:T.what},void 0,!1,void 0,this),": ",T.text]},void 0,!0,void 0,this),T.acts.includes("verify")&&U?$.jsxDEV("button",{type:"button",onClick:V,disabled:L!==null,children:"Verify"},void 0,!1,void 0,this):null,T.acts.includes("approve")&&U?$.jsxDEV("button",{type:"button",onClick:()=>I(!0),disabled:L!==null,children:"Approve…"},void 0,!1,void 0,this):null,$.jsxDEV(UQ,{name:_,acts:T.acts},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):null,H?$.jsxDEV($.Fragment,{children:[q.narration?$.jsxDEV("p",{className:"narration",children:q.narration},void 0,!1,void 0,this):null,$.jsxDEV("h4",{children:"Where it went"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"block where",children:[f.performed>0?$.jsxDEV("p",{className:"pad",children:[f.performed>=f.total?"Deployed":"Partly deployed",": ",f.performed," of ",f.total," change",f.total===1?"":"s",f.own?` (and ${f.own} of the World's own, which stay in it)`:""," performed at ",b2([...new Set([...v.map((h)=>h.service),...c.filter((h)=>h.status==="confirmed").map((h)=>h.service)].map(M1))]),v.length?` (${v.length} from here`:" (",v.length&&D?", ":"",D?`${D} by the remote`:"",")."]},void 0,!0,void 0,this):f.label==="Pushed"?$.jsxDEV("p",{className:"pad",children:["Pushed to the remote",m?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("code",{children:m},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,q.applied?$.jsxDEV($.Fragment,{children:[" · ",$.jsxDEV(u1,{iso:q.applied.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,": every change was replayed there. No vendor has performed any of it."]},void 0,!0,void 0,this):f.failed===0?$.jsxDEV("p",{className:"pad",children:["Not sent: it is only in this World.",q.applied?.outcome==="refused"?" A push was refused (below); Push sends it again.":$.jsxDEV($.Fragment,{children:[" Push sends it to the remote World",E?"; Deploy, to the real vendors behind it":"","."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,f.failed>0?$.jsxDEV("p",{className:"pad failed",role:"alert",children:[f.failed," change",f.failed===1?" was":"s were"," refused or failed at the vendor",[...y.filter((h)=>h.reason&&(h.status==="refused"||h.status==="failed")).map((h)=>h.reason),...c.filter((h)=>h.status==="failed"&&h.error).map((h)=>h.error)].slice(0,3).map((h)=>`: ${t1(h).text}`).join(""),"."]},void 0,!0,void 0,this):null,q.applied?.refusal?.length?$.jsxDEV("ul",{className:"checks pad",children:q.applied.refusal.map((h,o)=>$.jsxDEV("li",{className:"mode",children:t1(h).text},o,!1,void 0,this))},void 0,!1,void 0,this):null,y.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"pad where-sub mode",children:"At the vendor"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"receipts pad",children:y.map((h)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:h.status==="refused"||h.status==="failed"?"badge cs-bad":h.status==="deployed"?"badge cs-done":"badge",children:h.status},void 0,!1,void 0,this)," ",M1(h.service)," ",h.status==="deployed"?h.url?$.jsxDEV("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",children:h.externalId??h.url},void 0,!1,void 0,this):h.externalId?$.jsxDEV("code",{children:h.externalId},void 0,!1,void 0,this):null:null,h.reason?$.jsxDEV("span",{className:"mode",children:[" · ",t1(h.reason).text]},void 0,!0,void 0,this):null," ",$.jsxDEV("span",{className:"mode",children:["· ",$.jsxDEV(u1,{iso:h.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},`v:${h.actionId}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,c.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"pad where-sub mode",children:"At the remote"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"receipts pad",children:c.map((h)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:h.status==="failed"?"badge cs-bad":h.status==="confirmed"?"badge cs-done":"badge",children:h.status},void 0,!1,void 0,this)," ",M1(h.service)," ",$.jsxDEV("span",{className:"mode",children:h.status==="replayed"?"replayed at the remote World":h.status==="confirmed"?"performed at the vendor by the remote":""},void 0,!1,void 0,this),h.status==="confirmed"&&h.externalId?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("code",{children:h.externalId},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,h.error?$.jsxDEV("span",{className:"mode",children:[" · ",t1(h.error).text]},void 0,!0,void 0,this):null]},`r:${h.actionId}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),!E&&f.label!=="Deployed"?$.jsxDEV("p",{className:"mode",children:["No vendor it changes is connected to its real service here, so it does not deploy from this World. ",$.jsxDEV("a",{href:`${R1}/${_}/~/settings/services`,onClick:(h)=>{h.preventDefault(),j1([..._.split("/"),"~","settings","services"])},children:"Connect a vendor in Settings › Real services"},void 0,!1,void 0,this)," to deploy."]},void 0,!0,void 0,this):null,$.jsxDEV("h4",{children:"Checks"},void 0,!1,void 0,this),!q.verification?$.jsxDEV("p",{className:"mode",children:"Not verified yet. Verify replays it in a throwaway World and runs this World's checks over the result."},void 0,!1,void 0,this):$.jsxDEV("div",{className:l(q.verification.contentHash)?"":"stale",children:[$.jsxDEV("p",{children:[q.verification.passed?"✓ Passed":"✗ Failed"," · ",$.jsxDEV(u1,{iso:q.verification.at},void 0,!1,void 0,this),l(q.verification.contentHash)?null:$.jsxDEV("span",{className:"mode",children:" · on an earlier version of it: verify again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.verification.results.length?$.jsxDEV("ul",{className:"checks",children:q.verification.results.map((h)=>$.jsxDEV("li",{children:[h.passed?"✓":"✗"," ",$.jsxDEV("code",{children:h.id},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:M1(h.service)},void 0,!1,void 0,this)]},h.id,!0,void 0,this))},void 0,!1,void 0,this):null,q.verification.refusals?.length?$.jsxDEV("ul",{className:"checks",children:q.verification.refusals.map((h,o)=>$.jsxDEV("li",{children:["✗ ",$.jsxDEV("code",{children:h.check},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[M1(h.service),": ",h.reason]},void 0,!0,void 0,this)]},o,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("h4",{children:"Approvals"},void 0,!1,void 0,this),q.approvals.length===0?$.jsxDEV("p",{className:"mode",children:"No one has approved it."},void 0,!1,void 0,this):$.jsxDEV("ul",{className:"approvals",children:q.approvals.map((h,o)=>$.jsxDEV("li",{children:[$.jsxDEV("b",{children:h.principal},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(u1,{iso:h.at},void 0,!1,void 0,this),l(h.contentHash)?"":" · signed an earlier version"]},void 0,!0,void 0,this),h.note?$.jsxDEV("div",{className:"mode",children:["“",h.note,"”"]},void 0,!0,void 0,this):null]},o,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(M0,{open:W,onClose:()=>{if(!L)I(!1)},title:`Approve ${q.name}`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>I(!1),disabled:L!==null,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"approve-changeset",className:"primary",disabled:L!==null,children:L==="Approve"?"Approving…":"Approve"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"approve-changeset",onSubmit:(h)=>void b(h),className:"stack",children:[$.jsxDEV("p",{className:"mode",children:["You sign its contents as they stand now",J?$.jsxDEV($.Fragment,{children:[", recorded as ",$.jsxDEV("b",{children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,". A later change to it shows your approval as for an earlier version."]},void 0,!0,void 0,this),J===null?$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Approving as"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"approveAs",value:N,onChange:(h)=>B(h.target.value),maxLength:80,required:!0,placeholder:"your name or email",autoComplete:"off"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"This World was opened with its token, which names no person: the approval records the name you give."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Note ",$.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("textarea",{name:"approveNote",value:R,onChange:(h)=>A(h.target.value),rows:3,maxLength:500},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var wQ=(_,Q)=>JSON.stringify(_)===JSON.stringify(Q);function MF({changes:_,idPrefix:Q}){let J=[...new Set(_.map((q)=>q.twin))];return $.jsxDEV($.Fragment,{children:J.map((q)=>{let U=_.filter((Z)=>Z.twin===q).map((Z)=>Z.entry),G=[...new Set(U.map((Z)=>`${Z.subject.type}:${Z.subject.id}`))];return $.jsxDEV("div",{className:"compare",role:"group","aria-labelledby":`${Q}-${q}`,children:[$.jsxDEV("h3",{id:`${Q}-${q}`,className:"vendor-cell",children:[$.jsxDEV(d1,{vendor:q},void 0,!1,void 0,this),M1(q)," ",$.jsxDEV("span",{className:"mode",children:["· ",x1(G.length,"record"),", ",x1(U.length,"write")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:G.map((Z)=>{let F=U.filter((H)=>`${H.subject.type}:${H.subject.id}`===Z),X=F[F.length-1],Y=N0(X),K={};return $.jsxDEV("li",{className:"record",children:[$.jsxDEV("p",{className:"record-head",children:[$.jsxDEV("span",{className:"kind",children:X.subject.type.replace(/^_+/,"").replace(/[_-]+/g," ")},void 0,!1,void 0,this)," ",Y.label?$.jsxDEV("span",{className:"label",children:["“",Y.label,"”"]},void 0,!0,void 0,this):null," ",$.jsxDEV("code",{children:q2(X)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F.map((H)=>{let L=H.fields??{},z=Object.entries(L).filter(([I,R])=>!(I in K)||!wQ(K[I],R)),W=K;return K={...K,...L},$.jsxDEV("div",{className:"write",children:[$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("span",{className:"op",children:N0(H).what},void 0,!1,void 0,this)," · ",$.jsxDEV(u1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",o5(H)]},void 0,!0,void 0,this),z.length===0?$.jsxDEV("p",{className:"mode",children:"It set no field to a new value."},void 0,!1,void 0,this):$.jsxDEV("dl",{className:"fields field-diff","aria-label":`Fields ${N0(H).what} set`,children:z.map(([I,R])=>$.jsxDEV(r.default.Fragment,{children:[$.jsxDEV("dt",{children:I},void 0,!1,void 0,this),$.jsxDEV("dd",{children:I in W?$.jsxDEV("span",{className:"changed",children:[$.jsxDEV("del",{children:$.jsxDEV(U2,{v:W[I]},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"arrow","aria-label":"becomes",children:"→"},void 0,!1,void 0,this),$.jsxDEV("ins",{children:$.jsxDEV(U2,{v:R},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV(U2,{v:R},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},I,!0,void 0,this))},void 0,!1,void 0,this)]},H.id,!0,void 0,this)})]},Z,!0,void 0,this)})},void 0,!1,void 0,this)]},q,!0,void 0,this)})},void 0,!1,void 0,this)}function TF({name:_,token:Q,changes:J,canWrite:q,refused:U,onCut:G,pinned:Z,generated:F,inputRef:X,author:Y}){let[K,H]=r.useState(""),[L,z]=r.useState(!1),[W,I]=r.useState([]),R=(N,B,T)=>{I((O)=>[{ok:N,text:B,at:new Date().toISOString(),n:++_4,...T?.length?{acts:T}:{}},...O].slice(0,4))},A=async(N)=>{N.preventDefault(),z(!0);try{let B=await y1(Q,`/-/${_}/changesets`,{method:"POST",body:JSON.stringify(K.trim()?{message:K.trim()}:{})});if(!B.ok){U(B);let O=t1(await _2(B));R(!1,`Cut a changeset: ${O.text}`,O.acts);return}let T=await B.json();R(!0,`Cut ${T.name??"a changeset"}: ${x1(T.actions?.length??0,"change")}, ready to review in History and push.`),H(""),G()}catch(B){R(!1,`Cut a changeset: the World did not answer (${B instanceof Error?B.message:String(B)})`)}finally{z(!1)}};if(Z){let N=!q?"This session reads the World; it changes nothing":J===0?"Nothing to cut: no change is outside a changeset":null;return $.jsxDEV("div",{className:"ws-cut",children:[$.jsxDEV(A2,{log:W,name:_},void 0,!1,void 0,this),$.jsxDEV("form",{onSubmit:(B)=>void A(B),"aria-label":"Cut a changeset",children:[Y?$.jsxDEV("a",{className:"ws-author",href:Y.account,title:`${Y.who}: your account`,onClick:(B)=>{B.preventDefault(),j1(Y.account.slice(R1.length+1).split("/"))},children:Y.face},void 0,!1,void 0,this):null,$.jsxDEV("input",{ref:X,name:"changesetMessage","aria-label":"Summary",value:K,onChange:(B)=>H(B.target.value),placeholder:J===0?"Nothing to cut":F?"Summary (optional)":"Summary (required)",required:!F,maxLength:200,disabled:Boolean(N),title:N??void 0},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",disabled:Boolean(N)||L,title:N??void 0,children:L?"Cutting…":J===0?"Cut a changeset":$.jsxDEV($.Fragment,{children:["Cut ",x1(J,"change"),Y?$.jsxDEV($.Fragment,{children:[" on ",$.jsxDEV("b",{children:Y.branch},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}if(!q||J===0)return $.jsxDEV(A2,{log:W,name:_},void 0,!1,void 0,this);return $.jsxDEV($.Fragment,{children:[$.jsxDEV("form",{className:"block cut pad",onSubmit:(N)=>void A(N),"aria-label":"Cut a changeset",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Cut ",J===1?"this change":`these ${J} changes`," into a changeset: what it does and why"]},void 0,!0,void 0,this),$.jsxDEV("input",{name:"changesetMessage",value:K,onChange:(N)=>H(N.target.value),placeholder:"Welcome email for new sign-ups",required:!0,maxLength:200,disabled:J===0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",disabled:L||J===0,children:L?"Cutting…":"Cut a changeset"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(A2,{log:W,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function RF({name:_,token:Q}){let[J,q]=r.useState(0),U=V1(Q,`/-/${_}/keys`,J),[G,Z]=r.useState(!1),[F,X]=r.useState(""),[Y,K]=r.useState("write"),[H,L]=r.useState(!1),[z,W]=r.useState(null),[I,R]=r.useState(null),[A,N]=r.useState(null),B=async()=>{let C=`Read-only link · ${new Date().toLocaleDateString(void 0,{month:"short",day:"numeric"})}`,f=await y1(Q,`/-/${_}/keys`,{method:"POST",body:JSON.stringify({name:C,scope:"read"})}).catch(()=>null),S=f?await f.json().catch(()=>({})):{error:`${k1} did not answer`};if(!f?.ok||!S.key){l1(S.error?t1(S.error).text:"refused","error");return}N(`${window.location.origin}${R1}/${_}#${new URLSearchParams({token:S.key}).toString()}`),q((w)=>w+1)},T=async(C)=>{C.preventDefault(),L(!0),W(null);let f=await y1(Q,`/-/${_}/keys`,{method:"POST",body:JSON.stringify({name:F.trim(),scope:Y})}).catch(()=>null);L(!1);let S=f?await f.json().catch(()=>({})):{error:`${k1} did not answer`};if(!f?.ok||!S.key){W(S.error?t1(S.error).text:"refused");return}Z(!1),R({key:S.key,name:F.trim()}),X(""),q((w)=>w+1)},O=async(C)=>{if(!await p0({title:`Revoke ${C.name}?`,body:"Whatever holds it loses this World at once.",action:"Revoke key",danger:!0}))return;let f=await y1(Q,`/-/${_}/keys/${C.id}`,{method:"DELETE"});if(f.ok)l1(`Revoked ${C.name}`);else l1(await z0(f),"error");q((S)=>S+1)};return $.jsxDEV("section",{"aria-labelledby":"keys-head",className:"keys",children:[$.jsxDEV("div",{className:"keys-head",children:[$.jsxDEV("div",{children:[$.jsxDEV("h3",{id:"keys-head",children:"Keys"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"What an app, a script or a CI job holds to reach this World: each named for what holds it and revoked alone. People open the World as themselves; keys are for software."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z0()?$.jsxDEV("a",{className:"button primary",href:`${Z0()}/${encodeURIComponent(_.split("/")[0]??"")}`,children:"Make a key on the platform"},void 0,!1,void 0,this):$.jsxDEV("div",{className:"head-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>void B(),children:"Share a read-only link"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{W(null),Z(!0)},children:"Make a key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(G0,{load:U,what:"the keys",retry:()=>q((C)=>C+1)},void 0,!1,void 0,this),U.state==="ok"?U.data.keys.length===0?$.jsxDEV("p",{className:"mode",children:"No keys yet. The World's own token opens it too."},void 0,!1,void 0,this):$.jsxDEV("table",{className:"dense","aria-label":"Keys",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"For"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Access"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Last used"},void 0,!1,void 0,this),$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:U.data.keys.map((C)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:C.name},void 0,!1,void 0,this),$.jsxDEV("td",{children:C.person??$.jsxDEV("span",{className:"mode",title:"It acts as itself: a service",children:"no one: a service"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:C.scope==="write"?"Read and write":"Read only"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:$.jsxDEV("span",{title:D2(C.createdAt),children:L8(C.createdAt)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:C.lastUsedAt?L8(C.lastUsedAt):"never"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"num",children:$.jsxDEV(c_,{label:`More for ${C.name}`,items:[{label:"Revoke…",danger:!0,onSelect:()=>void O(C)}]},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},C.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(M0,{open:G,onClose:()=>{if(!H)Z(!1)},title:"Make a key",footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>Z(!1),disabled:H,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"make-key",disabled:H||!F.trim(),children:H?"Making…":"Make key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"make-key",onSubmit:T,"aria-label":"Make a key",children:[$.jsxDEV("label",{children:["Name ",$.jsxDEV("input",{autoFocus:!0,name:"keyName",value:F,onChange:(C)=>X(C.target.value),placeholder:"ci, staging app…",maxLength:80,required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:["Access ",$.jsxDEV("select",{value:Y,onChange:(C)=>K(C.target.value==="read"?"read":"write"),children:[$.jsxDEV("option",{value:"write",children:"Read and write"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"read",children:"Read only"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z?$.jsxDEV("p",{role:"alert",children:z},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(M0,{open:Boolean(I),onClose:()=>R(null),title:`${I?.name??"The key"} is ready`,footer:$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>R(null),children:"Done"},void 0,!1,void 0,this),children:[$.jsxDEV("p",{className:"mode",children:"Copy it now: it is shown this once. Put it where the app reads its secrets."},void 0,!1,void 0,this),I?$.jsxDEV(W8,{label:"Key",value:I.key,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(M0,{open:Boolean(A),onClose:()=>N(null),title:"A read-only link",footer:$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>N(null),children:"Done"},void 0,!1,void 0,this),children:[$.jsxDEV("p",{className:"mode",children:"Whoever opens it sees this World's pages and changes nothing. Copy it now: it is shown this once. It is listed under Keys, where revoking it closes the link at once."},void 0,!1,void 0,this),A?$.jsxDEV(W8,{label:"Link",value:A,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var _4=0;function A2({log:_,name:Q}){if(_.length===0)return null;return $.jsxDEV("ul",{className:"narration-log",role:"status","aria-live":"polite",children:_.map((J)=>$.jsxDEV("li",{className:J.ok?"ok":"bad",children:[$.jsxDEV("span",{className:"mode",children:$.jsxDEV(u1,{iso:J.at,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",J.text,J.acts?$.jsxDEV(UQ,{name:Q,acts:J.acts},void 0,!1,void 0,this):null]},J.n,!0,void 0,this))},void 0,!1,void 0,this)}function fQ(_,Q,J,q){let[U,G]=r.useState(0),Z=U*1e5+Math.floor(J/2),F=V1(Q,`/-/${_}/origin`,Z),X=V1(Q,`/-/${_}/diff`,Z),Y=V1(Q,`/-/${_}/changesets`,Z),[K,H]=r.useState([]),[L,z]=r.useState(null),W=(O,C,f)=>{if(H((S)=>[{ok:O,text:C,at:new Date().toISOString(),n:++_4,...f?.length?{acts:f}:{}},...S].slice(0,8)),!O)l1(C,"error")},I=async(O,C,f)=>{z(O);try{let S=await y1(Q,`/-/${_}/${C}`,f);if(!S.ok){q(S);let w=t1(await _2(S));return W(!1,`${O}: ${w.text}`,w.acts),null}return await S.json()}catch(S){return W(!1,`${O}: the World did not answer (${S instanceof Error?S.message:String(S)})`),null}finally{z(null),G((S)=>S+1)}},R=F.state==="ok"&&F.data.origin?w8(F.data.origin):null,A=X.state==="ok"?X.data.changes.length:null,N=Y.state==="ok"&&R?nZ(Y.data.changesets.filter((O)=>!O.pushedBy)).sort((O,C)=>O.createdAt.localeCompare(C.createdAt)):[];return{origin:F,diff:X,sets:Y,there:R,changes:A,waiting:N,log:K,busy:L,say:W,send:I,push:async()=>{let O=await I("Push","origin/push",{method:"POST"});if(!O)return;if(O.pushed.length===0){W(!0,"Nothing to push: every changeset is already at the remote.");return}for(let C of O.pushed){let f=C.receipts??[],S=f.filter((c)=>c.status==="replayed").length,w=f.filter((c)=>c.status==="confirmed").length,k=f.filter((c)=>c.status==="failed").length,E=C.outcome==="applied"&&k===0;if(C.outcome==="refused"){W(!1,`Push of ${C.changeset} was refused${C.refusal?.length?`: ${C.refusal.map((c)=>t1(c).text).join("; ")}`:""}.`);continue}let l=[`${S} of ${x1(f.length,"change")} replayed there`,...w?[`${w} performed at the vendor by the remote`]:[],...k?[`${k} failed`]:[]];W(E,`${C.outcome==="partial"?"Partly pushed":"Pushed"} ${C.changeset} to ${R??"the remote"}: ${l.join("; ")}${C.refusal?.length?` (${C.refusal.map((c)=>t1(c).text).join("; ")})`:""}.`)}},pull:async()=>{let O=await I("Pull","origin/pull",{method:"POST"});if(!O)return;let C=Object.entries(O.appended).filter(([,S])=>S>0),f=O.rebased.flatMap((S)=>S.conflicts.map((w)=>`${M1(S.twin)} ${w.subject.type}:${w.subject.id} ${w.field}`));W(f.length===0,`Pulled from ${R??"the remote"}: ${C.length?C.map(([S,w])=>`${x1(w,"entry")} at ${M1(S)}`).join(", "):"nothing new"}${f.length?`; conflicts at ${f.join(", ")}`:""}.`)}}}function OF({name:_,token:Q,canWrite:J,tick:q,refused:U}){let{origin:G,there:Z,changes:F,log:X,busy:Y,say:K,send:H,push:L,pull:z}=fQ(_,Q,q,U),[W,I]=r.useState(""),[R,A]=r.useState(""),[N,B]=r.useState(!1),T=async(C)=>{C.preventDefault();let f=await H("Name the remote","origin",{method:"PUT",body:JSON.stringify({url:W.trim(),token:R.trim()})});if(f){let S=Object.values(f.appended??{}).reduce((w,k)=>w+k,0);K(!0,`The remote is ${w8(f.origin)}: its history came in (${x1(S,"entry")}).`),A(""),B(!1)}},O=!J?"This session reads the World; it changes nothing":null;return $.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"block remote",children:[$.jsxDEV("div",{className:"block-head",children:[$.jsxDEV("h3",{children:"Origin"},void 0,!1,void 0,this),J?$.jsxDEV("button",{type:"button",onClick:()=>{I(Z??""),B(!N)},"aria-expanded":N,children:Z?"Change the remote…":"Name a remote…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"pad",children:[G.state==="ok"?Z?$.jsxDEV("p",{children:[$.jsxDEV("code",{className:"big",children:Z},void 0,!1,void 0,this),G.data.origin?.fetchedAt?$.jsxDEV("span",{className:"mode",children:[" · last fetched ",$.jsxDEV(u1,{iso:G.data.origin.fetchedAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):$.jsxDEV("p",{children:"No remote — this World keeps its default data. Name one to push its changesets to a shared World and pull what others pushed there."},void 0,!1,void 0,this):$.jsxDEV(G0,{load:G,what:"the remote",lines:1},void 0,!1,void 0,this),N?$.jsxDEV("form",{className:"stack origin-form",onSubmit:(C)=>void T(C),"aria-label":"Name the remote",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The World's address"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"originUrl",value:W,onChange:(C)=>I(C.target.value),placeholder:"https://worlds.example.com/acme/team",required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"A key or token that opens it"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"originToken",type:"password",value:R,onChange:(C)=>A(C.target.value),required:!0,autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:"Naming it brings its history in. Your pushes are recorded there as whoever this key was made for, or as the key itself."},void 0,!1,void 0,this),$.jsxDEV("div",{className:"row-actions",children:[$.jsxDEV("button",{type:"submit",className:"primary",disabled:Y!==null,children:Y==="Name the remote"?"Bringing its history in…":"Save the remote"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>B(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(A2,{log:X,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function IF({name:_,token:Q,canWrite:J,refused:q}){let[U,G]=r.useState(0),Z=V1(Q,`/-/${_}/twins`,U),F=V1(Q,`/-/${_}/links`,U),X=V1(Q,`/-/${_}/requests?hours=24`,U),[Y,K]=r.useState({}),[H,L]=r.useState(null),[z,W]=r.useState(""),[I,R]=r.useState(!1),[A,N]=r.useState([]),B=(w,k,E)=>{if(N((l)=>[{ok:w,text:k,at:new Date().toISOString(),n:++_4,...E?.length?{acts:E}:{}},...l].slice(0,6)),!w)l1(k,"error")},T=F.state==="ok"?Object.keys(F.data.links).sort():[];r.useEffect(()=>{let w=!0;return Promise.all(T.map(async(k)=>{let E=await y1(Q,`/-/${_}/twins/${k}/credential`).catch(()=>null),l=E?.ok?await E.json():null;return[k,l?.credential??null]})).then((k)=>{if(w)K(Object.fromEntries(k))}),()=>{w=!1}},[_,Q,T.join(","),U]);let O=async(w)=>{if(w.preventDefault(),!H||!z)return;R(!0);let k=await y1(Q,`/-/${_}/twins/${H.vendor}/credential`,{method:"PUT",body:z,headers:{"content-type":"text/plain"}}).catch(()=>null);if(R(!1),!k){B(!1,`Seal ${H.vendor}: ${k1} did not answer`);return}if(!k.ok){q(k);let l=t1(await _2(k));B(!1,`Seal ${M1(H.vendor)}: ${l.text}`,l.acts);return}let E=await k.json().catch(()=>({}));B(!0,`Sealed a credential for ${M1(H.vendor)}${E.fingerprint?` (${E.fingerprint})`:""}: it opens for ${E.boundTo??H.to} only, and is never shown again.`),W(""),L(null),G((l)=>l+1)},C=async(w)=>{if(!await p0({title:`Remove the link ${w}?`,body:`Requests to ${l0}/${_}/${w}/… stop being forwarded to ${F.state==="ok"?F.data.links[w]?.origin:"its origin"}.`,action:"Remove link",danger:!0}))return;let k=await y1(Q,`/-/${_}/links/${w}`,{method:"DELETE"}).catch(()=>null);if(!k?.ok){if(k)q(k);B(!1,`Remove ${w}: ${k?await z0(k):"the World did not answer"}`);return}B(!0,`Removed the link ${w}.`),G((E)=>E+1)},f=(w)=>w?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"badge rooted",children:"sealed"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[w.fingerprint?$.jsxDEV("code",{children:w.fingerprint},void 0,!1,void 0,this):null," · ",$.jsxDEV(u1,{iso:w.placedAt},void 0,!1,void 0,this),w.sealedBy?` · by ${w.sealedBy==="vault"?"the vault":"the host's key"}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("span",{className:"mode",children:"none"},void 0,!1,void 0,this),S=Z.state==="ok"?Z.data.twins:[];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"lede",children:"A real vendor's credential lives in one place, sealed: beside this World, bound to where it goes. It is never readable back; this page says only that one is sealed, when, by what, and for where."},void 0,!1,void 0,this),$.jsxDEV(A2,{log:A,name:_},void 0,!1,void 0,this),$.jsxDEV("section",{className:"block","aria-labelledby":"creds-head",children:[$.jsxDEV("div",{className:"block-head",children:$.jsxDEV("h3",{id:"creds-head",children:"Vendors"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(G0,{load:Z,what:"the vendors"},void 0,!1,void 0,this),Z.state==="ok"?$.jsxDEV("table",{className:"dense","aria-label":"Credentials by vendor",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Credential"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Bound to"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Real service"},void 0,!1,void 0,this),J?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:S.map((w)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(d1,{vendor:w.twin},void 0,!1,void 0,this),M1(w.twin)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:f(w.credential)},void 0,!1,void 0,this),$.jsxDEV("td",{children:w.credential?.boundTo?$.jsxDEV("code",{children:w.credential.boundTo},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:w.root?.url?$.jsxDEV("code",{children:w.root.url},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"none: a stand-in"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J?$.jsxDEV("td",{className:"num",children:$.jsxDEV("button",{type:"button",disabled:!w.root?.url,title:w.root?.url?`Seal ${M1(w.twin)}'s real credential for ${w.root.url}`:"Connect it to its real service first (Settings › Real services): a credential is sealed for where it goes",onClick:()=>{W(""),L({vendor:w.twin,to:w.root.url})},children:w.credential?"Replace…":"Seal a credential…"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},w.twin,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,Z.state==="ok"&&S.every((w)=>!w.root?.url)?$.jsxDEV("p",{className:"mode pad",children:"No vendor here has a real service behind it, so none holds a credential. Connect one in Settings › Real services; its credential is sealed here."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("section",{className:"block","aria-labelledby":"links-head",children:[$.jsxDEV("div",{className:"block-head",children:[$.jsxDEV("h3",{id:"links-head",children:"Links"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"a vendor with no twin, forwarded with its sealed credential"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(G0,{load:F,what:"the links"},void 0,!1,void 0,this),X.state==="ok"&&(X.data.journalFailures??0)>0?$.jsxDEV("p",{className:"mode pad",role:"alert",children:[X.data.journalFailures," request ",X.data.journalFailures===1?"line was":"lines were"," not kept by this World's server since it started (its links, and the twins it runs in its own process): those requests are missing from what this page counts."]},void 0,!0,void 0,this):null,F.state==="ok"&&T.length===0?$.jsxDEV("p",{className:"mode pad",children:["No links. A link forwards requests for a vendor with no twin here, at ",$.jsxDEV("code",{children:[l0,"/",_,"/<link>/…"]},void 0,!0,void 0,this),", to that vendor's real API with the credential sealed for it."]},void 0,!0,void 0,this):null,T.length?$.jsxDEV("table",{className:"dense","aria-label":"Links",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Link"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Origin"},void 0,!1,void 0,this),$.jsxDEV("th",{className:"num",children:"Requests, 24h"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Credential"},void 0,!1,void 0,this),J?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:T.map((w)=>{let k=F.state==="ok"?F.data.links[w].origin:"",E=X.state==="ok"?X.data.twins.find((l)=>l.twin===w):void 0;return $.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("b",{children:w},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("code",{children:k},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"num",children:E?$.jsxDEV("span",{title:Object.entries(E.byStatus).map(([l,c])=>`${l}: ${c}`).join(" · "),children:E.requests},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:[f(Y[w]??null),Y[w]?.boundTo?$.jsxDEV("div",{className:"mode",children:["bound to ",$.jsxDEV("code",{children:Y[w].boundTo},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),J?$.jsxDEV("td",{className:"num row-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>{W(""),L({vendor:w,to:k})},children:Y[w]?"Replace…":"Seal a credential…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>void C(w),children:"Remove…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},w,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(M0,{open:Boolean(H),onClose:()=>{if(!I)L(null)},title:`Seal ${H?M1(H.vendor):""}'s credential`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>L(null),disabled:I,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"seal-credential",className:"primary",disabled:I||!z,children:I?"Sealing…":"Seal it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"seal-credential",className:"stack",onSubmit:(w)=>void O(w),children:[$.jsxDEV("p",{className:"mode",children:["It is sealed for ",$.jsxDEV("code",{children:H?.to},void 0,!1,void 0,this)," and opens there only. It is never shown again, here or anywhere."]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The real key"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"credential",type:"password",value:z,onChange:(w)=>W(w.target.value),autoComplete:"off",required:!0,autoFocus:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function PF({name:_,token:Q,admin:J,canWrite:q,refused:U,onRemoved:G,only:Z}){let F=(V)=>!Z||Z===V,[X,Y]=r.useState(0),K=V1(Q,`/-/${_}/twins`,X),H=V1(Q,`/-/${_}/checks`,X),[L,z]=r.useState(0),W=V1(Q,`/-/${_}/clock`,L),[I,R]=r.useState([]),[A,N]=r.useState(null),[B,T]=r.useState(null),[O,C]=r.useState(""),[f,S]=r.useState("gated"),[w,k]=r.useState(!1),E=(V,b,P)=>{if(R((j)=>[{ok:V,text:b,at:new Date().toISOString(),n:++_4,...P?.length?{acts:P}:{}},...j].slice(0,6)),!V)l1(b,"error")},l=async(V,b,P)=>{let j=await y1(Q,b,P).catch(()=>null);if(!j)return E(!1,`${V}: the World did not answer`),!1;if(!j.ok){U(j);let m=t1(await _2(j));return E(!1,`${V}: ${m.text}`,m.acts),!1}return E(!0,`${V}: done.`),Y((m)=>m+1),!0},c=async(V)=>{if(V.preventDefault(),!B)return;k(!0);let b=B.root??{},P=await l(O.trim()?`Connect ${M1(B.twin)} to ${O.trim()}`:`Disconnect ${M1(B.twin)}`,`/-/${_}/twins/${B.twin}/root`,{method:"PUT",body:JSON.stringify(O.trim()?{...b,url:O.trim(),deploy:f}:null)});if(k(!1),P)T(null)},y=async()=>{if(!await p0({title:`Rotate the tokens of ${_}?`,body:"Every app, script and person holding the current tokens loses access at once. The new ones are shown once.",action:"Rotate tokens",danger:!0}))return;let V=await y1(J,`/-/worlds/${_}/rotate`,{method:"POST"});if(V.ok)N(await V.json()),E(!0,"Rotated: the new tokens are shown once, below.");else E(!1,`Rotate: ${await z0(V)}`)},D=async()=>{if(!await p0({title:`Remove ${_}?`,body:"The host stops serving it and its whole history goes with it. This cannot be undone.",action:"Remove World",danger:!0,typed:_}))return;let V=await y1(J,`/-/worlds/${_}`,{method:"DELETE"}).catch((b)=>b);if(V instanceof Error){E(!1,`Remove: the host did not answer (${V.message})`);return}if(V.ok)G();else E(!1,`Remove: ${await z0(V)}`)},v=K.state==="ok"?K.data.twins:[],x={gated:"gated: a person deploys an approved changeset",auto:"auto: a push deploys at once",hold:"hold: nothing deploys"};return $.jsxDEV($.Fragment,{children:[$.jsxDEV(A2,{log:I,name:_},void 0,!1,void 0,this),F("access")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Access"},void 0,!1,void 0,this),q?$.jsxDEV(RF,{name:_,token:Q},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode",children:"This session reads the World: its keys are managed by whoever holds its token."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,F("services")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Real services"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:[v.some((V)=>V.root?.url)?null:"Every vendor here is a stand-in. ","Connect a vendor to its real service to read the real state into this World; its real credential is sealed in the Vault, and an approved changeset deploys there by its policy."]},void 0,!0,void 0,this),$.jsxDEV(G0,{load:K,what:"the vendors"},void 0,!1,void 0,this),K.state==="ok"?$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Real services",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Real service"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Deploy policy"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Last read from it"},void 0,!1,void 0,this),q?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:v.map((V)=>{let b=V.root;return $.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(d1,{vendor:V.twin},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${R1}/${_}/${V.twin}`,title:`Its log and stored state · ${V.position??0} entries`,onClick:(P)=>{P.preventDefault(),j1([..._.split("/"),V.twin])},children:M1(V.twin)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:b?.url?$.jsxDEV("code",{children:b.url},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"not connected"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:b?.url?x[b.deploy??""]??b.deploy??"—":"—"},void 0,!1,void 0,this),$.jsxDEV("td",{children:V.refresh?.failed?$.jsxDEV("span",{role:"alert",children:["failed ×",V.refresh.failed.count??1,": ",V.refresh.failed.reason??""]},void 0,!0,void 0,this):b?.url?D2(V.refresh?.observedAt??V.refresh?.at):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q?$.jsxDEV("td",{className:"num row-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>{C(b?.url??""),S(b?.deploy==="auto"||b?.deploy==="hold"?b.deploy:"gated"),T(V)},children:b?.url?"Change…":"Connect…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",disabled:!b?.url,title:b?.url?"Read the real service's current state into this World":"Connect it first",onClick:()=>void p0({title:`Read ${M1(V.twin)} now?`,body:`The real ${M1(V.twin)}'s current state is read into this World. Nothing is written to ${M1(V.twin)}.`,action:"Read from it"}).then((P)=>{if(P)l(`Read from ${M1(V.twin)}`,`/-/${_}/twins/${V.twin}/refresh`,{method:"POST"})}),children:"Read from it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},V.twin,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,F("clock")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Clock"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"The instant every vendor here stamps from. Set it and move it forward to see what happens later: renewals, expiries, scheduled sends."},void 0,!1,void 0,this),$.jsxDEV(_F,{name:_,token:Q,clock:W,canWrite:q,onChanged:()=>z((V)=>V+1),refused:U,open:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,F("checks")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Checks"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"JavaScript the World runs over every change before it is performed (a changeset's Verify runs them too)."},void 0,!1,void 0,this),$.jsxDEV(G0,{load:H,what:"the checks"},void 0,!1,void 0,this),H.state==="ok"?H.data.checks.length===0?$.jsxDEV("p",{className:"mode",children:"No checks: every change is performed as it comes."},void 0,!1,void 0,this):$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Checks",children:$.jsxDEV("tbody",{children:H.data.checks.map((V)=>$.jsxDEV("tr",{children:$.jsxDEV("td",{children:$.jsxDEV("code",{children:V},void 0,!1,void 0,this)},void 0,!1,void 0,this)},V,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,J&&!Z?$.jsxDEV("div",{className:"danger",role:"region","aria-label":"Danger zone",children:[$.jsxDEV("h3",{children:"Danger zone"},void 0,!1,void 0,this),A?$.jsxDEV("p",{role:"status",children:["token ",$.jsxDEV("code",{children:A.token},void 0,!1,void 0,this)," · read token ",$.jsxDEV("code",{children:A.readToken},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("p",{children:[$.jsxDEV("button",{type:"button",onClick:()=>void y(),children:"Rotate tokens"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"New tokens for this World; every app, script and browser using the old ones is signed out."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{children:[$.jsxDEV("button",{type:"button",onClick:()=>void D(),children:"Remove world"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"Deletes this World and everything in it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(M0,{open:Boolean(B),onClose:()=>{if(!w)T(null)},title:`Connect ${B?M1(B.twin):""} to its real service`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>T(null),disabled:w,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"connect-root",className:"primary",disabled:w,children:w?"Saving…":O.trim()?"Connect":"Disconnect"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"connect-root",className:"stack",onSubmit:(V)=>void c(V),children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The real service's API address"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"rootUrl",value:O,onChange:(V)=>C(V.target.value),placeholder:"https://api.openai.com",autoFocus:!0},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Empty disconnects it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Deploy policy"},void 0,!1,void 0,this),$.jsxDEV("select",{name:"rootDeploy",value:f,onChange:(V)=>S(V.target.value==="auto"?"auto":V.target.value==="hold"?"hold":"gated"),children:["gated","auto","hold"].map((V)=>$.jsxDEV("option",{value:V,children:x[V]},V,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qM(){return $.jsxDEV($.Fragment,{children:[$.jsxDEV(bZ,{},void 0,!1,void 0,this),$.jsxDEV(p_,{},void 0,!1,void 0,this),$.jsxDEV(g_,{},void 0,!1,void 0,this),$.jsxDEV(m_,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{$M as openAt,n5 as ROOT,qM as ConsolePage};
|
|
33
|
+
`)),K=Y.reduce((H,L)=>H.concat(...L),[]);return[Y,K]}return[[],[]]},[_]);return a.useEffect(()=>{let X=Q?.target??D9,Y=Q?.actInsideInputWithModifier??!0;if(_!==null){let K=(z)=>{if(U.current=z.ctrlKey||z.metaKey||z.shiftKey||z.altKey,(!U.current||U.current&&!Y)&&U8(z))return!1;let I=E9(z.code,F);if(G.current.add(z[I]),b9(Z,G.current,!1)){let M=z.composedPath?.()?.[0]||z.target,B=M?.nodeName==="BUTTON"||M?.nodeName==="A";if(Q.preventDefault!==!1&&(U.current||!B))z.preventDefault();q(!0)}},H=(z)=>{let W=E9(z.code,F);if(b9(Z,G.current,!0))q(!1),G.current.clear();else G.current.delete(z[W]);if(z.key==="Meta")G.current.clear();U.current=!1},L=()=>{G.current.clear(),q(!1)};return X?.addEventListener("keydown",K),X?.addEventListener("keyup",H),window.addEventListener("blur",L),window.addEventListener("contextmenu",L),()=>{X?.removeEventListener("keydown",K),X?.removeEventListener("keyup",H),window.removeEventListener("blur",L),window.removeEventListener("contextmenu",L)}}},[_,q]),J}function b9(_,Q,J){return _.filter((q)=>J||q.length===Q.size).some((q)=>q.every((U)=>Q.has(U)))}function E9(_,Q){return Q.includes(_)?"code":"key"}var NU=()=>{let _=g1();return a.useMemo(()=>{return{zoomIn:async(Q)=>{let{panZoom:J}=_.getState();return J?J.scaleBy(1.2,Q):!1},zoomOut:async(Q)=>{let{panZoom:J}=_.getState();return J?J.scaleBy(0.8333333333333334,Q):!1},zoomTo:async(Q,J)=>{let{panZoom:q}=_.getState();return q?q.scaleTo(Q,J):!1},getZoom:()=>_.getState().transform[2],setViewport:async(Q,J)=>{let{transform:[q,U,G],panZoom:Z}=_.getState();if(!Z)return!1;return await Z.setViewport({x:Q.x??q,y:Q.y??U,zoom:Q.zoom??G},J),!0},getViewport:()=>{let[Q,J,q]=_.getState().transform;return{x:Q,y:J,zoom:q}},setCenter:async(Q,J,q)=>{return _.getState().setCenter(Q,J,q)},fitBounds:async(Q,J)=>{let{width:q,height:U,minZoom:G,maxZoom:Z,panZoom:F}=_.getState(),X=a5(Q,q,U,G,Z,J?.padding??0.1);if(!F)return!1;return await F.setViewport(X,{duration:J?.duration,ease:J?.ease,interpolate:J?.interpolate}),!0},screenToFlowPosition:(Q,J={})=>{let{transform:q,snapGrid:U,snapToGrid:G,domNode:Z}=_.getState();if(!Z)return Q;let{x:F,y:X}=Z.getBoundingClientRect(),Y={x:Q.x-F,y:Q.y-X},K=J.snapGrid??U,H=J.snapToGrid??G;return G5(Y,q,H,K)},flowToScreenPosition:(Q)=>{let{transform:J,domNode:q}=_.getState();if(!q)return Q;let{x:U,y:G}=q.getBoundingClientRect(),Z=j2(Q,J);return{x:Z.x+U,y:Z.y+G}}}},[])};function H_(_,Q){let J=[],q=new Map,U=[];for(let G of _)if(G.type==="add"){U.push(G);continue}else if(G.type==="remove"||G.type==="replace")q.set(G.id,[G]);else{let Z=q.get(G.id);if(Z)Z.push(G);else q.set(G.id,[G])}for(let G of Q){let Z=q.get(G.id);if(!Z){J.push(G);continue}if(Z[0].type==="remove")continue;if(Z[0].type==="replace"){J.push({...Z[0].item});continue}let F={...G};for(let X of Z)wU(X,F);J.push(F)}if(U.length)U.forEach((G)=>{if(G.index!==void 0)J.splice(G.index,0,{...G.item});else J.push({...G.item})});return J}function wU(_,Q){switch(_.type){case"select":{Q.selected=_.selected;break}case"position":{if(typeof _.position<"u")Q.position=_.position;if(typeof _.dragging<"u")Q.dragging=_.dragging;break}case"dimensions":{if(typeof _.dimensions<"u"){if(Q.measured={..._.dimensions},_.setAttributes){if(_.setAttributes===!0||_.setAttributes==="width")Q.width=_.dimensions.width;if(_.setAttributes===!0||_.setAttributes==="height")Q.height=_.dimensions.height}}if(typeof _.resizing==="boolean")Q.resizing=_.resizing;break}}}function X_(_,Q){return H_(_,Q)}function fU(_,Q){return H_(_,Q)}function u2(_,Q){return{id:_,type:"select",selected:Q}}function F5(_,Q=new Set,J=!1){let q=[];for(let[U,G]of _){let Z=Q.has(U);if(!(G.selected===void 0&&!Z)&&G.selected!==Z){if(J)G.selected=Z;q.push(u2(G.id,Z))}}return q}function x9({items:_=[],lookup:Q}){let J=[],q=new Map(_.map((U)=>[U.id,U]));for(let[U,G]of _.entries()){let Z=Q.get(G.id),F=Z?.internals?.userNode??Z;if(F!==void 0&&F!==G)J.push({id:G.id,item:G,type:"replace"});if(F===void 0)J.push({item:G,type:"add",index:U})}for(let[U]of Q)if(q.get(U)===void 0)J.push({id:U,type:"remove"});return J}function m9(_){return{id:_.id,type:"remove"}}var CU=e6("React Flow","https://reactflow.dev/");function SU(_,Q,J={}){return o7(_,Q,{...J,onError:J.onError??CU})}var g9=(_)=>m7(_),yU=(_)=>d6(_);function K_(_){return a.forwardRef(_)}var Y_=typeof window<"u"?a.useLayoutEffect:a.useEffect;function p9(_){let[Q,J]=a.useState(BigInt(0)),[q]=a.useState(()=>kU(()=>J((U)=>U+BigInt(1))));return Y_(()=>{let U=q.get();if(U.length)_(U),q.reset()},[Q]),q}function kU(_){let Q=[];return{get:()=>Q,reset:()=>{Q=[]},push:(J)=>{Q.push(J),_()}}}var L_=a.createContext(null);function jU({children:_}){let Q=g1(),J=a.useCallback((F)=>{let{nodes:X=[],setNodes:Y,hasDefaultNodes:K,onNodesChange:H,nodeLookup:L,fitViewQueued:z,onNodesChangeMiddlewareMap:W}=Q.getState(),I=X;for(let B of F)I=typeof B==="function"?B(I):B;let M=x9({items:I,lookup:L});for(let B of W.values())M=B(M);if(K)Y(I);if(M.length>0)H?.(M);else if(z)window.requestAnimationFrame(()=>{let{fitViewQueued:B,nodes:N,setNodes:A}=Q.getState();if(B)A(N)})},[]),q=p9(J),U=a.useCallback((F)=>{let{edges:X=[],setEdges:Y,hasDefaultEdges:K,onEdgesChange:H,edgeLookup:L}=Q.getState(),z=X;for(let W of F)z=typeof W==="function"?W(z):W;if(K)Y(z);else if(H)H(x9({items:z,lookup:L}))},[]),G=p9(U),Z=a.useMemo(()=>({nodeQueue:q,edgeQueue:G}),[]);return d.jsx(L_.Provider,{value:Z,children:_})}function vU(){let _=a.useContext(L_);if(!_)throw Error("useBatchContext must be used within a BatchProvider");return _}var VU=(_)=>!!_.panZoom;function o5(){let _=NU(),Q=g1(),J=vU(),q=S1(VU),U=a.useMemo(()=>{let G=(H)=>Q.getState().nodeLookup.get(H),Z=(H)=>{J.nodeQueue.push(H)},F=(H)=>{J.edgeQueue.push(H)},X=(H)=>{let{nodeLookup:L,nodeOrigin:z}=Q.getState(),W=g9(H)?H:L.get(H.id),I=W.parentId?Q8(W.position,W.measured,W.parentId,L,z):W.position,M={...W,position:I,width:W.measured?.width??W.width,height:W.measured?.height??W.height};return q5(M)},Y=(H,L,z={replace:!1})=>{Z((W)=>W.map((I)=>{if(I.id===H){let M=typeof L==="function"?L(I):L;return z.replace&&g9(M)?M:{...I,...M}}return I}))},K=(H,L,z={replace:!1})=>{F((W)=>W.map((I)=>{if(I.id===H){let M=typeof L==="function"?L(I):L;return z.replace&&yU(M)?M:{...I,...M}}return I}))};return{getNodes:()=>Q.getState().nodes.map((H)=>({...H})),getNode:(H)=>G(H)?.internals.userNode,getInternalNode:G,getEdges:()=>{let{edges:H=[]}=Q.getState();return H.map((L)=>({...L}))},getEdge:(H)=>Q.getState().edgeLookup.get(H),setNodes:Z,setEdges:F,addNodes:(H)=>{let L=Array.isArray(H)?H:[H];J.nodeQueue.push((z)=>[...z,...L])},addEdges:(H)=>{let L=Array.isArray(H)?H:[H];J.edgeQueue.push((z)=>[...z,...L])},toObject:()=>{let{nodes:H=[],edges:L=[],transform:z}=Q.getState(),[W,I,M]=z;return{nodes:H.map((B)=>({...B})),edges:L.map((B)=>({...B})),viewport:{x:W,y:I,zoom:M}}},deleteElements:async({nodes:H=[],edges:L=[]})=>{let{nodes:z,edges:W,onNodesDelete:I,onEdgesDelete:M,triggerNodeChanges:B,triggerEdgeChanges:N,onDelete:A,onBeforeDelete:R}=Q.getState(),{nodes:O,edges:C}=await c7({nodesToRemove:H,edgesToRemove:L,nodes:z,edges:W,onBeforeDelete:R}),f=C.length>0,S=O.length>0;if(f){let w=C.map(m9);M?.(C),N(w)}if(S){let w=O.map(m9);I?.(O),B(w)}if(S||f)A?.({nodes:O,edges:C});return{deletedNodes:O,deletedEdges:C}},getIntersectingNodes:(H,L=!0,z)=>{let W=n6(H),I=W?H:X(H),M=z!==void 0;if(!I)return[];return(z||Q.getState().nodes).filter((B)=>{let N=Q.getState().nodeLookup.get(B.id);if(N&&!W&&(B.id===H.id||!N.internals.positionAbsolute))return!1;let A=q5(M?B:N),R=d5(A,I);return L&&R>0||R>=A.width*A.height||R>=I.width*I.height})},isNodeIntersecting:(H,L,z=!0)=>{let I=n6(H)?H:X(H);if(!I)return!1;let M=d5(I,L);return z&&M>0||M>=L.width*L.height||M>=I.width*I.height},updateNode:Y,updateNodeData:(H,L,z={replace:!1})=>{Y(H,(W)=>{let I=typeof L==="function"?L(W):L;return z.replace?{...W,data:I}:{...W,data:{...W.data,...I}}},z)},updateEdge:K,updateEdgeData:(H,L,z={replace:!1})=>{K(H,(W)=>{let I=typeof L==="function"?L(W):L;return z.replace?{...W,data:I}:{...W,data:{...W.data,...I}}},z)},getNodesBounds:(H)=>{let{nodeLookup:L,nodeOrigin:z}=Q.getState();return s6(H,{nodeLookup:L,nodeOrigin:z})},getHandleConnections:({type:H,id:L,nodeId:z})=>Array.from(Q.getState().connectionLookup.get(`${z}-${H}${L?`-${L}`:""}`)?.values()??[]),getNodeConnections:({type:H,handleId:L,nodeId:z})=>Array.from(Q.getState().connectionLookup.get(`${z}${H?L?`-${H}-${L}`:`-${H}`:""}`)?.values()??[]),fitView:async(H)=>{let L=Q.getState().fitViewResolver??i7();return Q.setState({fitViewQueued:!0,fitViewOptions:H,fitViewResolver:L}),J.nodeQueue.push((z)=>[...z]),L.promise}}},[]);return a.useMemo(()=>{return{...U,..._,viewportInitialized:q}},[q])}var c9=(_)=>_.selected,uU=typeof window<"u"?window:void 0;function hU({deleteKeyCode:_,multiSelectionKeyCode:Q}){let J=g1(),{deleteElements:q}=o5(),U=t5(_,{actInsideInputWithModifier:!1}),G=t5(Q,{target:uU});a.useEffect(()=>{if(U){let{edges:Z,nodes:F}=J.getState();q({nodes:F.filter(c9),edges:Z.filter(c9)}),J.setState({nodesSelectionActive:!1})}},[U]),a.useEffect(()=>{J.setState({multiSelectionActive:G})},[G])}function DU(_){let Q=g1();a.useEffect(()=>{let J=()=>{if(!_.current||!(_.current.checkVisibility?.()??!0))return!1;let q=m4(_.current);if(q.height===0||q.width===0)Q.getState().onError?.("004",X0.error004());Q.setState({width:q.width||500,height:q.height||500})};if(_.current){J(),window.addEventListener("resize",J);let q=new ResizeObserver(()=>J());return q.observe(_.current),()=>{if(window.removeEventListener("resize",J),q&&_.current)q.unobserve(_.current)}}},[])}var _3={position:"absolute",width:"100%",height:"100%",top:0,left:0},bU=(_)=>({userSelectionActive:_.userSelectionActive,lib:_.lib,connectionInProgress:_.connection.inProgress});function EU({onPaneContextMenu:_,zoomOnScroll:Q=!0,zoomOnPinch:J=!0,panOnScroll:q=!1,panActivationKeyPressed:U,panOnScrollSpeed:G=0.5,panOnScrollMode:Z=o0.Free,zoomOnDoubleClick:F=!0,panOnDrag:X=!0,defaultViewport:Y,translateExtent:K,minZoom:H,maxZoom:L,zoomActivationKeyCode:z,preventScrolling:W=!0,children:I,noWheelClassName:M,noPanClassName:B,onViewportChange:N,isControlledViewport:A,paneClickDistance:R,selectionOnDrag:O}){let C=g1(),f=a.useRef(null),{userSelectionActive:S,lib:w,connectionInProgress:k}=S1(bU,m1),E=t5(z),r=a.useRef();DU(f);let c=a.useCallback((y)=>{if(N?.({x:y[0],y:y[1],zoom:y[2]}),!A)C.setState({transform:y})},[N,A]);return a.useEffect(()=>{if(f.current){r.current=W9({domNode:f.current,minZoom:H,maxZoom:L,translateExtent:K,viewport:Y,onDraggingChange:(x)=>C.setState((V)=>V.paneDragging===x?V:{paneDragging:x}),onPanZoomStart:(x,V)=>{let{onViewportChangeStart:D,onMoveStart:P}=C.getState();P?.(x,V),D?.(V)},onPanZoom:(x,V)=>{let{onViewportChange:D,onMove:P}=C.getState();P?.(x,V),D?.(V)},onPanZoomEnd:(x,V)=>{let{onViewportChangeEnd:D,onMoveEnd:P}=C.getState();P?.(x,V),D?.(V)}});let{x:y,y:b,zoom:v}=r.current.getViewport();return C.setState({panZoom:r.current,transform:[y,b,v],domNode:f.current.closest(".react-flow")}),()=>{r.current?.destroy()}}},[]),a.useEffect(()=>{r.current?.update({onPaneContextMenu:_,zoomOnScroll:Q,zoomOnPinch:J,panOnScroll:q,panActivationKeyPressed:U,panOnScrollSpeed:G,panOnScrollMode:Z,zoomOnDoubleClick:F,panOnDrag:X,zoomActivationKeyPressed:E,preventScrolling:W,noPanClassName:B,userSelectionActive:S,noWheelClassName:M,lib:w,onTransformChange:c,connectionInProgress:k,selectionOnDrag:O,paneClickDistance:R})},[_,Q,J,q,U,G,Z,F,X,E,W,B,S,M,w,c,k,O,R]),d.jsx("div",{className:"react-flow__renderer",ref:f,style:_3,children:I})}var xU=(_)=>({userSelectionActive:_.userSelectionActive,userSelectionRect:_.userSelectionRect});function mU(){let{userSelectionActive:_,userSelectionRect:Q}=S1(xU,m1);if(!(_&&Q))return null;return d.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:Q.width,height:Q.height,transform:`translate(${Q.x}px, ${Q.y}px)`}})}var W8=(_,Q)=>{return(J)=>{if(J.target!==Q.current)return;_?.(J)}},gU=(_)=>({userSelectionActive:_.userSelectionActive,elementsSelectable:_.elementsSelectable,dragging:_.paneDragging,panBy:_.panBy,autoPanSpeed:_.autoPanSpeed});function pU({isSelecting:_,selectionKeyPressed:Q,selectionMode:J=y2.Full,panOnDrag:q,autoPanOnSelection:U,paneClickDistance:G,selectionOnDrag:Z,onSelectionStart:F,onSelectionEnd:X,onPaneClick:Y,onPaneContextMenu:K,onPaneScroll:H,onPaneMouseEnter:L,onPaneMouseMove:z,onPaneMouseLeave:W,children:I}){let M=a.useRef(0),B=g1(),{userSelectionActive:N,elementsSelectable:A,dragging:R,panBy:O,autoPanSpeed:C}=S1(gU,m1),f=A&&(_||N),S=a.useRef(null),w=a.useRef(),k=a.useRef(new Set),E=a.useRef(new Set),r=a.useRef(!1),c=a.useRef(!1),y=a.useRef({x:0,y:0}),b=a.useRef(!1),v=(l)=>{if(c.current||r.current||B.getState().connection.inProgress){c.current=!1,r.current=!1;return}Y?.(l),B.getState().resetSelectedElements(),B.setState({nodesSelectionActive:!1})},x=(l)=>{if(Array.isArray(q)&&q?.includes(2)){l.preventDefault();return}K?.(l)},V=H?(l)=>H(l):void 0,D=(l)=>{if(c.current)l.stopPropagation(),c.current=!1},P=(l)=>{if(l.pointerType==="touch"&&q!==!1&&!Q)return;let{domNode:e,transform:J1}=B.getState();if(w.current=e?.getBoundingClientRect(),!w.current)return;let U1=l.target===S.current;if(!U1&&!!l.target.closest(".nokey")||!_||!(Z&&U1||Q)||l.button!==0||!l.isPrimary)return;l.target?.setPointerCapture?.(l.pointerId),c.current=!1;let{x:Y1,y:B1}=N0(l.nativeEvent,w.current),n=G5({x:Y1,y:B1},J1);if(B.setState({userSelectionRect:{width:0,height:0,startX:n.x,startY:n.y,x:Y1,y:B1}}),!U1)l.stopPropagation(),l.preventDefault()};function u(l,e){let{userSelectionRect:J1}=B.getState();if(!J1)return;let{transform:U1,nodeLookup:F1,edgeLookup:W1,connectionLookup:Y1,triggerNodeChanges:B1,triggerEdgeChanges:n,defaultEdgeOptions:T1}=B.getState(),Z1={x:J1.startX,y:J1.startY},{x:k1,y:t1}=j2(Z1,U1),_0={startX:Z1.x,startY:Z1.y,x:l<k1?l:k1,y:e<t1?e:t1,width:Math.abs(l-k1),height:Math.abs(e-t1)},s1=k.current,I0=E.current;k.current=new Set(D4(F1,_0,U1,J===y2.Partial,!0).map((q0)=>q0.id)),E.current=new Set;let S0=T1?.selectable??!0;for(let q0 of k.current){let x1=Y1.get(q0);if(!x1)continue;for(let{edgeId:Y0}of x1.values()){let W0=W1.get(Y0);if(W0&&(W0.selectable??S0))E.current.add(Y0)}}if(!J8(s1,k.current)){let q0=F5(F1,k.current,!0);B1(q0)}if(!J8(I0,E.current)){let q0=F5(W1,E.current);n(q0)}B.setState({userSelectionRect:_0,userSelectionActive:!0,nodesSelectionActive:!1})}function m(){if(!U||!w.current)return;let[l,e]=b4(y.current,w.current,C);O({x:l,y:e}).then((J1)=>{if(!c.current||!J1){M.current=requestAnimationFrame(m);return}let{x:U1,y:F1}=y.current;u(U1,F1),M.current=requestAnimationFrame(m)})}let h=()=>{cancelAnimationFrame(M.current),M.current=0,b.current=!1};a.useEffect(()=>{return()=>h()},[]);let t=(l)=>{let{userSelectionRect:e,transform:J1,resetSelectedElements:U1}=B.getState();if(!w.current||!e)return;let{x:F1,y:W1}=N0(l.nativeEvent,w.current);y.current={x:F1,y:W1};let Y1=j2({x:e.startX,y:e.startY},J1);if(!c.current){let B1=Q?0:G;if(Math.hypot(F1-Y1.x,W1-Y1.y)<=B1)return;U1(),F?.(l)}if(c.current=!0,!b.current)m(),b.current=!0;u(F1,W1)},Q1=(l)=>{if(!f){if(l.target===S.current&&B.getState().connection.inProgress)r.current=!0;return}if(l.button!==0)return;if(l.target?.releasePointerCapture?.(l.pointerId),!N&&l.target===S.current&&B.getState().userSelectionRect)v?.(l);if(B.setState({userSelectionActive:!1,userSelectionRect:null}),c.current)X?.(l),B.setState({nodesSelectionActive:k.current.size>0});h()},s=(l)=>{l.target?.releasePointerCapture?.(l.pointerId),h()},o=q===!0||Array.isArray(q)&&q.includes(0);return d.jsxs("div",{className:i1(["react-flow__pane",{draggable:o,dragging:R,selection:_}]),onClick:f?void 0:W8(v,S),onContextMenu:W8(x,S),onWheel:W8(V,S),onPointerEnter:f?void 0:L,onPointerMove:f?t:z,onPointerUp:Q1,onPointerCancel:f?s:void 0,onPointerDownCapture:f?P:void 0,onClickCapture:f?D:void 0,onPointerLeave:W,ref:S,style:_3,children:[I,d.jsx(mU,{})]})}function A8({id:_,store:Q,unselect:J=!1,nodeRef:q}){let{addSelectedNodes:U,unselectNodesAndEdges:G,multiSelectionActive:Z,nodeLookup:F,onError:X}=Q.getState(),Y=F.get(_);if(!Y){X?.("012",X0.error012(_));return}if(Q.setState({nodesSelectionActive:!1}),!Y.selected)U([_]);else if(J||Y.selected&&Z)G({nodes:[Y],edges:[]}),requestAnimationFrame(()=>q?.current?.blur())}function z_({nodeRef:_,disabled:Q=!1,noDragClassName:J,handleSelector:q,nodeId:U,isSelectable:G,nodeClickDistance:Z}){let F=g1(),[X,Y]=a.useState(!1),K=a.useRef();return a.useEffect(()=>{if(Q)return;return K.current=Z9({getStoreItems:()=>F.getState(),onNodeMouseDown:(H)=>{A8({id:H,store:F,nodeRef:_})},onDragStart:()=>{Y(!0)},onDragStop:()=>{Y(!1)}}),()=>{K.current?.destroy(),K.current=void 0}},[Q,F,_]),a.useEffect(()=>{if(Q||!_.current||!K.current)return;K.current.update({noDragClassName:J,handleSelector:q,domNode:_.current,isSelectable:G,nodeId:U,nodeClickDistance:Z})},[J,q,Q,G,_,U,Z]),X}var cU=(_)=>(Q)=>Q.selected&&(Q.draggable||_&&typeof Q.draggable>"u");function W_(){let _=g1();return a.useCallback((J)=>{let{nodeExtent:q,snapToGrid:U,snapGrid:G,nodesDraggable:Z,onError:F,updateNodePositions:X,nodeLookup:Y,nodeOrigin:K}=_.getState(),H=new Map,L=cU(Z),z=U?G[0]:5,W=U?G[1]:5,I=J.direction.x*z*J.factor,M=J.direction.y*W*J.factor;for(let[,B]of Y){if(!L(B))continue;let N={x:B.internals.positionAbsolute.x+I,y:B.internals.positionAbsolute.y+M};if(U)N=U5(N,G);let{position:A,positionAbsolute:R}=t6({nodeId:B.id,nextPosition:N,nodeLookup:Y,nodeExtent:q,nodeOrigin:K,onError:F});B.position=A,B.internals.positionAbsolute=R,H.set(B.id,B)}X(H)},[])}var M8=a.createContext(null),lU=M8.Provider;M8.Consumer;var T8=()=>{return a.useContext(M8)},rU=(_)=>({connectOnClick:_.connectOnClick,noPanClassName:_.noPanClassName,rfId:_.rfId}),B_=a.createContext(null);function iU({children:_}){let Q=S1(rU,m1);return d.jsx(B_.Provider,{value:Q,children:_})}function dU(){let _=a.useContext(B_);if(!_)throw Error("useHandleConfig must be used within a HandleConfigProvider");return _}var aU={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},sU=(_,Q,J)=>(q)=>{let{connectionClickStartHandle:U,connectionMode:G,connection:Z}=q,{fromHandle:F,toHandle:X,isValid:Y}=Z;if(!F&&!U)return aU;let K=X?.nodeId===_&&X?.id===Q&&X?.type===J;return{connectingFrom:F?.nodeId===_&&F?.id===Q&&F?.type===J,connectingTo:K,clickConnecting:U?.nodeId===_&&U?.id===Q&&U?.type===J,isPossibleEndHandle:G===W2.Strict?F?.type!==J:_!==F?.nodeId||Q!==F?.id,connectionInProcess:!!F,clickConnectionInProcess:!!U,valid:K&&Y}};function tU({type:_="source",position:Q=K1.Top,isValidConnection:J,isConnectable:q=!0,isConnectableStart:U=!0,isConnectableEnd:G=!0,id:Z,onConnect:F,children:X,className:Y,onMouseDown:K,onTouchStart:H,...L},z){let W=Z||null,I=_==="target",M=g1(),B=T8(),{connectOnClick:N,noPanClassName:A,rfId:R}=dU(),{connectingFrom:O,connectingTo:C,clickConnecting:f,isPossibleEndHandle:S,connectionInProcess:w,clickConnectionInProcess:k,valid:E}=S1(sU(B,W,_),m1);if(!B)M.getState().onError?.("010",X0.error010());let r=(b)=>{let{defaultEdgeOptions:v,onConnect:x,hasDefaultEdges:V}=M.getState(),D={...v,...b};if(V){let{edges:P,setEdges:u,onError:m}=M.getState();u(SU(D,P,{onError:m}))}x?.(D),F?.(D)},c=(b)=>{if(!B)return;let v=G8(b.nativeEvent);if(U&&(v&&b.button===0||!v)){let x=M.getState();d4.onPointerDown(b.nativeEvent,{handleDomNode:b.currentTarget,autoPanOnConnect:x.autoPanOnConnect,connectionMode:x.connectionMode,connectionRadius:x.connectionRadius,domNode:x.domNode,nodeLookup:x.nodeLookup,lib:x.lib,isTarget:I,handleId:W,nodeId:B,flowId:x.rfId,panBy:x.panBy,cancelConnection:x.cancelConnection,onConnectStart:x.onConnectStart,onConnectEnd:(...V)=>M.getState().onConnectEnd?.(...V),updateConnection:x.updateConnection,onConnect:r,isValidConnection:J||((...V)=>M.getState().isValidConnection?.(...V)??!0),getTransform:()=>M.getState().transform,getFromHandle:()=>M.getState().connection.fromHandle,autoPanSpeed:x.autoPanSpeed,dragThreshold:x.connectionDragThreshold})}if(v)K?.(b);else H?.(b)},y=(b)=>{let{onClickConnectStart:v,onClickConnectEnd:x,connectionClickStartHandle:V,connectionMode:D,isValidConnection:P,lib:u,rfId:m,nodeLookup:h,connection:t}=M.getState();if(!B||!V&&!U)return;if(!V){v?.(b.nativeEvent,{nodeId:B,handleId:W,handleType:_}),M.setState({connectionClickStartHandle:{nodeId:B,type:_,id:W}});return}let Q1=q8(b.target),s=J||P,{connection:o,isValid:l}=d4.isValid(b.nativeEvent,{handle:{nodeId:B,id:W,type:_},connectionMode:D,fromNodeId:V.nodeId,fromHandleId:V.id||null,fromType:V.type,isValidConnection:s,flowId:m,doc:Q1,lib:u,nodeLookup:h});if(l&&o)r(o);let e=structuredClone(t);delete e.inProgress,e.toPosition=e.toHandle?e.toHandle.position:null,x?.(b,e),M.setState({connectionClickStartHandle:null})};return d.jsx("div",{"data-handleid":W,"data-nodeid":B,"data-handlepos":Q,"data-id":`${R}-${B}-${W}-${_}`,className:i1(["react-flow__handle",`react-flow__handle-${Q}`,"nodrag",A,Y,{source:!I,target:I,connectable:q,connectablestart:U,connectableend:G,clickconnecting:f,connectingfrom:O,connectingto:C,valid:E,connectionindicator:q&&(!w||S)&&(w||k?G:U)}]),onMouseDown:c,onTouchStart:c,onClick:N?y:void 0,ref:z,...L,children:X})}var o4=a.memo(K_(tU));function oU({data:_,isConnectable:Q,sourcePosition:J=K1.Bottom}){return d.jsxs(d.Fragment,{children:[_?.label,d.jsx(o4,{type:"source",position:J,isConnectable:Q})]})}function nU({data:_,isConnectable:Q,targetPosition:J=K1.Top,sourcePosition:q=K1.Bottom}){return d.jsxs(d.Fragment,{children:[d.jsx(o4,{type:"target",position:J,isConnectable:Q}),_?.label,d.jsx(o4,{type:"source",position:q,isConnectable:Q})]})}function eU(){return null}function _G({data:_,isConnectable:Q,targetPosition:J=K1.Top}){return d.jsxs(d.Fragment,{children:[d.jsx(o4,{type:"target",position:J,isConnectable:Q}),_?.label]})}var n4={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},l9={input:oU,default:nU,output:_G,group:eU};function QG(_){if(_.internals.handleBounds===void 0)return{width:_.width??_.initialWidth??_.style?.width,height:_.height??_.initialHeight??_.style?.height};return{width:_.width??_.style?.width,height:_.height??_.style?.height}}var JG=(_)=>{let{width:Q,height:J,x:q,y:U}=V2(_.nodeLookup,{filter:(G)=>!!G.selected});return{width:P0(Q)?Q:null,height:P0(J)?J:null,userSelectionActive:_.userSelectionActive,transformString:`translate(${_.transform[0]}px,${_.transform[1]}px) scale(${_.transform[2]}) translate(${q}px,${U}px)`}};function $G({onSelectionContextMenu:_,noPanClassName:Q,disableKeyboardA11y:J}){let q=g1(),{width:U,height:G,transformString:Z,userSelectionActive:F}=S1(JG,m1),X=W_(),Y=a.useRef(null);a.useEffect(()=>{if(!J)Y.current?.focus({preventScroll:!0})},[J]);let K=!F&&U!==null&&G!==null;if(z_({nodeRef:Y,disabled:!K}),!K)return null;let H=_?(z)=>{let W=q.getState().nodes.filter((I)=>I.selected);_(z,W)}:void 0,L=(z)=>{if(Object.prototype.hasOwnProperty.call(n4,z.key))z.preventDefault(),X({direction:n4[z.key],factor:z.shiftKey?4:1})};return d.jsx("div",{className:i1(["react-flow__nodesselection","react-flow__container",Q]),style:{transform:Z},children:d.jsx("div",{ref:Y,className:"react-flow__nodesselection-rect",onContextMenu:H,tabIndex:J?void 0:-1,onKeyDown:J?void 0:L,style:{width:U,height:G}})})}var r9=typeof window<"u"?window:void 0,qG=(_)=>{return{nodesSelectionActive:_.nodesSelectionActive,userSelectionActive:_.userSelectionActive}};function A_({children:_,onPaneClick:Q,onPaneMouseEnter:J,onPaneMouseMove:q,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:Z,paneClickDistance:F,deleteKeyCode:X,selectionKeyCode:Y,selectionOnDrag:K,selectionMode:H,onSelectionStart:L,onSelectionEnd:z,multiSelectionKeyCode:W,panActivationKeyCode:I,zoomActivationKeyCode:M,elementsSelectable:B,zoomOnScroll:N,zoomOnPinch:A,panOnScroll:R,panOnScrollSpeed:O,panOnScrollMode:C,zoomOnDoubleClick:f,panOnDrag:S,autoPanOnSelection:w,defaultViewport:k,translateExtent:E,minZoom:r,maxZoom:c,preventScrolling:y,onSelectionContextMenu:b,noWheelClassName:v,noPanClassName:x,disableKeyboardA11y:V,onViewportChange:D,isControlledViewport:P}){let{nodesSelectionActive:u,userSelectionActive:m}=S1(qG,m1),h=t5(Y,{target:r9}),t=t5(I,{target:r9}),Q1=t||S,s=t||R,o=K&&Q1!==!0,l=h||m||o;return hU({deleteKeyCode:X,multiSelectionKeyCode:W}),d.jsx(EU,{onPaneContextMenu:G,elementsSelectable:B,zoomOnScroll:N,zoomOnPinch:A,panOnScroll:s,panActivationKeyPressed:t,panOnScrollSpeed:O,panOnScrollMode:C,zoomOnDoubleClick:f,panOnDrag:!h&&Q1,defaultViewport:k,translateExtent:E,minZoom:r,maxZoom:c,zoomActivationKeyCode:M,preventScrolling:y,noWheelClassName:v,noPanClassName:x,onViewportChange:D,isControlledViewport:P,paneClickDistance:F,selectionOnDrag:o,children:d.jsxs(pU,{onSelectionStart:L,onSelectionEnd:z,onPaneClick:Q,onPaneMouseEnter:J,onPaneMouseMove:q,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:Z,panOnDrag:Q1,autoPanOnSelection:w,isSelecting:!!l,selectionMode:H,selectionKeyPressed:h,paneClickDistance:F,selectionOnDrag:o,children:[_,u&&d.jsx($G,{onSelectionContextMenu:b,noPanClassName:x,disableKeyboardA11y:V})]})})}A_.displayName="FlowRenderer";var UG=a.memo(A_),GG=(_)=>(Q)=>{return _?D4(Q.nodeLookup,{x:0,y:0,width:Q.width,height:Q.height},Q.transform,!0).map((J)=>J.id):Array.from(Q.nodeLookup.keys())};function ZG(_){return S1(a.useCallback(GG(_),[_]),m1)}var FG=(_)=>_.updateNodeInternals;function HG(){let _=S1(FG),[Q]=a.useState(()=>{if(typeof ResizeObserver>"u")return null;return new ResizeObserver((J)=>{let q=new Map;J.forEach((U)=>{let G=U.target.getAttribute("data-id");q.set(G,{id:G,nodeElement:U.target,force:!0})}),_(q)})});return a.useEffect(()=>{return()=>{Q?.disconnect()}},[Q]),Q}function XG({node:_,nodeType:Q,hasDimensions:J,resizeObserver:q}){let U=g1(),G=a.useRef(null),Z=a.useRef(null),F=a.useRef(_.sourcePosition),X=a.useRef(_.targetPosition),Y=a.useRef(Q),K=J&&!!_.internals.handleBounds;return a.useEffect(()=>{if(G.current&&!_.hidden&&(!K||Z.current!==G.current)){if(Z.current)q?.unobserve(Z.current);q?.observe(G.current),Z.current=G.current}},[K,_.hidden]),a.useEffect(()=>{return()=>{if(Z.current)q?.unobserve(Z.current),Z.current=null}},[]),a.useEffect(()=>{if(G.current){let H=Y.current!==Q,L=F.current!==_.sourcePosition,z=X.current!==_.targetPosition;if(H||L||z)Y.current=Q,F.current=_.sourcePosition,X.current=_.targetPosition,U.getState().updateNodeInternals(new Map([[_.id,{id:_.id,nodeElement:G.current,force:!0}]]))}},[_.id,Q,_.sourcePosition,_.targetPosition]),G}function KG({id:_,onClick:Q,onMouseEnter:J,onMouseMove:q,onMouseLeave:U,onContextMenu:G,onDoubleClick:Z,nodesDraggable:F,elementsSelectable:X,nodesConnectable:Y,nodesFocusable:K,resizeObserver:H,noDragClassName:L,noPanClassName:z,disableKeyboardA11y:W,rfId:I,nodeTypes:M,nodeClickDistance:B,onError:N}){let{node:A,internals:R,isParent:O}=S1((l)=>{let e=l.nodeLookup.get(_),J1=l.parentLookup.has(_);return{node:e,internals:e.internals,isParent:J1}},m1),C=A.type||"default",f=M?.[C]||l9[C];if(f===void 0)N?.("003",X0.error003(C)),C="default",f=M?.default||l9.default;let S=!!(A.draggable||F&&typeof A.draggable>"u"),w=!!(A.selectable||X&&typeof A.selectable>"u"),k=!!(A.connectable||Y&&typeof A.connectable>"u"),E=!!(A.focusable||K&&typeof A.focusable>"u"),r=g1(),c=_8(A),y=XG({node:A,nodeType:C,hasDimensions:c,resizeObserver:H}),b=z_({nodeRef:y,disabled:A.hidden||!S,noDragClassName:L,handleSelector:A.dragHandle,nodeId:_,isSelectable:w,nodeClickDistance:B}),v=W_();if(A.hidden)return null;let x=w0(A),V=QG(A),D=w||S||Q||J||q||U,P=J?(l)=>J(l,{...R.userNode}):void 0,u=q?(l)=>q(l,{...R.userNode}):void 0,m=U?(l)=>U(l,{...R.userNode}):void 0,h=G?(l)=>G(l,{...R.userNode}):void 0,t=Z?(l)=>Z(l,{...R.userNode}):void 0,Q1=(l)=>{let{selectNodesOnDrag:e,nodeDragThreshold:J1}=r.getState();if(w&&(!e||!S||J1>0))A8({id:_,store:r,nodeRef:y});if(Q)Q(l,{...R.userNode})},s=(l)=>{if(U8(l.nativeEvent)||W)return;if(l6.includes(l.key)&&w){let e=l.key==="Escape";A8({id:_,store:r,unselect:e,nodeRef:y})}else if(S&&A.selected&&Object.prototype.hasOwnProperty.call(n4,l.key)){l.preventDefault();let{ariaLabelConfig:e}=r.getState();r.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:l.key.replace("Arrow","").toLowerCase(),x:~~R.positionAbsolute.x,y:~~R.positionAbsolute.y})}),v({direction:n4[l.key],factor:l.shiftKey?4:1})}},o=()=>{if(W||!y.current?.matches(":focus-visible"))return;let{transform:l,width:e,height:J1,autoPanOnNodeFocus:U1,setCenter:F1}=r.getState();if(!U1)return;if(!(D4(new Map([[_,A]]),{x:0,y:0,width:e,height:J1},l,!0).length>0))F1(A.position.x+x.width/2,A.position.y+x.height/2,{zoom:l[2]})};return d.jsx("div",{className:i1(["react-flow__node",`react-flow__node-${C}`,{[z]:S},A.className,{selected:A.selected,selectable:w,parent:O,draggable:S,dragging:b}]),ref:y,style:{zIndex:R.z,transform:`translate(${R.positionAbsolute.x}px,${R.positionAbsolute.y}px)`,pointerEvents:D?"all":"none",visibility:c?"visible":"hidden",...A.style,...V},"data-id":_,"data-testid":`rf__node-${_}`,onMouseEnter:P,onMouseMove:u,onMouseLeave:m,onContextMenu:h,onClick:Q1,onDoubleClick:t,onKeyDown:E?s:void 0,tabIndex:E?0:void 0,onFocus:E?o:void 0,role:A.ariaRole??(E?"group":void 0),"aria-roledescription":"node","aria-describedby":W?void 0:`${G_}-${I}`,"aria-label":A.ariaLabel,...A.domAttributes,children:d.jsx(lU,{value:_,children:d.jsx(f,{id:_,data:A.data,type:C,positionAbsoluteX:R.positionAbsolute.x,positionAbsoluteY:R.positionAbsolute.y,selected:A.selected??!1,selectable:w,draggable:S,deletable:A.deletable??!0,isConnectable:k,sourcePosition:A.sourcePosition,targetPosition:A.targetPosition,dragging:b,dragHandle:A.dragHandle,zIndex:R.z,parentId:A.parentId,...x})})})}var YG=a.memo(KG),LG=(_)=>({nodesConnectable:_.nodesConnectable,nodesFocusable:_.nodesFocusable,elementsSelectable:_.elementsSelectable,onError:_.onError});function M_(_){let{nodesConnectable:Q,nodesFocusable:J,elementsSelectable:q,onError:U}=S1(LG,m1),G=ZG(_.onlyRenderVisibleElements),Z=HG();return d.jsx("div",{className:"react-flow__nodes",style:_3,children:G.map((F)=>{return d.jsx(YG,{id:F,nodeTypes:_.nodeTypes,nodeExtent:_.nodeExtent,onClick:_.onNodeClick,onMouseEnter:_.onNodeMouseEnter,onMouseMove:_.onNodeMouseMove,onMouseLeave:_.onNodeMouseLeave,onContextMenu:_.onNodeContextMenu,onDoubleClick:_.onNodeDoubleClick,noDragClassName:_.noDragClassName,noPanClassName:_.noPanClassName,rfId:_.rfId,disableKeyboardA11y:_.disableKeyboardA11y,resizeObserver:Z,nodesDraggable:_.nodesDraggable??!0,nodesConnectable:Q,nodesFocusable:J,elementsSelectable:q,nodeClickDistance:_.nodeClickDistance,onError:U},F)})})}M_.displayName="NodeRenderer";var zG=a.memo(M_);function WG(_){return S1(a.useCallback((J)=>{if(!_)return J.edges.map((U)=>U.id);let q=[];if(J.width&&J.height)for(let U of J.edges){let G=J.nodeLookup.get(U.source),Z=J.nodeLookup.get(U.target);if(G&&Z&&t7({sourceNode:G,targetNode:Z,width:J.width,height:J.height,transform:J.transform}))q.push(U.id)}return q},[_]),m1)}var BG=({color:_="none",strokeWidth:Q=1})=>{let J={strokeWidth:Q,..._&&{stroke:_}};return d.jsx("polyline",{className:"arrow",style:J,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},AG=({color:_="none",strokeWidth:Q=1})=>{let J={strokeWidth:Q,..._&&{stroke:_,fill:_}};return d.jsx("polyline",{className:"arrowclosed",style:J,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},i9={[Q5.Arrow]:BG,[Q5.ArrowClosed]:AG};function MG(_){let Q=g1();return a.useMemo(()=>{if(!Object.prototype.hasOwnProperty.call(i9,_))return Q.getState().onError?.("009",X0.error009(_)),null;return i9[_]},[_])}var TG=({id:_,type:Q,color:J,width:q=12.5,height:U=12.5,markerUnits:G="strokeWidth",strokeWidth:Z,orient:F="auto-start-reverse"})=>{let X=MG(Q);if(!X)return null;return d.jsx("marker",{className:"react-flow__arrowhead",id:_,markerWidth:`${q}`,markerHeight:`${U}`,viewBox:"-10 -10 20 20",markerUnits:G,orient:F,refX:"0",refY:"0",children:d.jsx(X,{color:J,strokeWidth:Z})})},T_=({defaultColor:_,rfId:Q})=>{let J=S1((G)=>G.edges),q=S1((G)=>G.defaultEdgeOptions),U=a.useMemo(()=>{return e7(J,{id:Q,defaultColor:_,defaultMarkerStart:q?.markerStart,defaultMarkerEnd:q?.markerEnd})},[J,q,Q,_]);if(!U.length)return null;return d.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:d.jsx("defs",{children:U.map((G)=>d.jsx(TG,{id:G.id,type:G.type,color:G.color,width:G.width,height:G.height,markerUnits:G.markerUnits,strokeWidth:G.strokeWidth,orient:G.orient},G.id))})})};T_.displayName="MarkerDefinitions";var RG=a.memo(T_);function R_({x:_,y:Q,label:J,labelStyle:q,labelShowBg:U=!0,labelBgStyle:G,labelBgPadding:Z=[2,4],labelBgBorderRadius:F=2,children:X,className:Y,...K}){let[H,L]=a.useState({x:1,y:0,width:0,height:0}),z=i1(["react-flow__edge-textwrapper",Y]),W=a.useRef(null);if(a.useEffect(()=>{if(W.current){let I=W.current.getBBox();L({x:I.x,y:I.y,width:I.width,height:I.height})}},[J]),!J)return null;return d.jsxs("g",{transform:`translate(${_-H.width/2} ${Q-H.height/2})`,className:z,visibility:H.width?"visible":"hidden",...K,children:[U&&d.jsx("rect",{width:H.width+2*Z[0],x:-Z[0],y:-Z[1],height:H.height+2*Z[1],className:"react-flow__edge-textbg",style:G,rx:F,ry:F}),d.jsx("text",{className:"react-flow__edge-text",y:H.height/2,dy:"0.3em",ref:W,style:q,children:J}),X]})}R_.displayName="EdgeText";var OG=a.memo(R_);function Q3({path:_,labelX:Q,labelY:J,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:X,interactionWidth:Y=20,...K}){return d.jsxs(d.Fragment,{children:[d.jsx("path",{...K,d:_,fill:"none",className:i1(["react-flow__edge-path",K.className])}),Y?d.jsx("path",{d:_,fill:"none",strokeOpacity:0,strokeWidth:Y,className:"react-flow__edge-interaction"}):null,q&&P0(Q)&&P0(J)?d.jsx(OG,{x:Q,y:J,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:X}):null]})}function d9({pos:_,x1:Q,y1:J,x2:q,y2:U}){if(_===K1.Left||_===K1.Right)return[0.5*(Q+q),J];return[Q,0.5*(J+U)]}function O_({sourceX:_,sourceY:Q,sourcePosition:J=K1.Bottom,targetX:q,targetY:U,targetPosition:G=K1.Top}){let[Z,F]=d9({pos:J,x1:_,y1:Q,x2:q,y2:U}),[X,Y]=d9({pos:G,x1:q,y1:U,x2:_,y2:Q}),[K,H,L,z]=g4({sourceX:_,sourceY:Q,targetX:q,targetY:U,sourceControlX:Z,sourceControlY:F,targetControlX:X,targetControlY:Y});return[`M${_},${Q} C${Z},${F} ${X},${Y} ${q},${U}`,K,H,L,z]}function I_(_){return a.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,sourcePosition:Z,targetPosition:F,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:I,markerStart:M,interactionWidth:B})=>{let[N,A,R]=O_({sourceX:J,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F}),O=_.isInternal?void 0:Q;return d.jsx(Q3,{id:O,path:N,labelX:A,labelY:R,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:I,markerStart:M,interactionWidth:B})})}var IG=I_({isInternal:!1}),P_=I_({isInternal:!0});IG.displayName="SimpleBezierEdge";P_.displayName="SimpleBezierEdgeInternal";function N_(_){return a.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,sourcePosition:z=K1.Bottom,targetPosition:W=K1.Top,markerEnd:I,markerStart:M,pathOptions:B,interactionWidth:N})=>{let[A,R,O]=s5({sourceX:J,sourceY:q,sourcePosition:z,targetX:U,targetY:G,targetPosition:W,borderRadius:B?.borderRadius,offset:B?.offset,stepPosition:B?.stepPosition}),C=_.isInternal?void 0:Q;return d.jsx(Q3,{id:C,path:A,labelX:R,labelY:O,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:I,markerStart:M,interactionWidth:N})})}var w_=N_({isInternal:!1}),f_=N_({isInternal:!0});w_.displayName="SmoothStepEdge";f_.displayName="SmoothStepEdgeInternal";function C_(_){return a.memo(({id:Q,...J})=>{let q=_.isInternal?void 0:Q;return d.jsx(w_,{...J,id:q,pathOptions:a.useMemo(()=>({borderRadius:0,offset:J.pathOptions?.offset}),[J.pathOptions?.offset])})})}var PG=C_({isInternal:!1}),S_=C_({isInternal:!0});PG.displayName="StepEdge";S_.displayName="StepEdgeInternal";function y_(_){return a.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:z,markerStart:W,interactionWidth:I})=>{let[M,B,N]=c4({sourceX:J,sourceY:q,targetX:U,targetY:G}),A=_.isInternal?void 0:Q;return d.jsx(Q3,{id:A,path:M,labelX:B,labelY:N,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:z,markerStart:W,interactionWidth:I})})}var NG=y_({isInternal:!1}),k_=y_({isInternal:!0});NG.displayName="StraightEdge";k_.displayName="StraightEdgeInternal";function j_(_){return a.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,sourcePosition:Z=K1.Bottom,targetPosition:F=K1.Top,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:I,markerStart:M,pathOptions:B,interactionWidth:N})=>{let[A,R,O]=p4({sourceX:J,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F,curvature:B?.curvature}),C=_.isInternal?void 0:Q;return d.jsx(Q3,{id:C,path:A,labelX:R,labelY:O,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:I,markerStart:M,interactionWidth:N})})}var wG=j_({isInternal:!1}),v_=j_({isInternal:!0});wG.displayName="BezierEdge";v_.displayName="BezierEdgeInternal";var a9={default:v_,straight:k_,step:S_,smoothstep:f_,simplebezier:P_},s9={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},fG=(_,Q,J)=>{if(J===K1.Left)return _-Q;if(J===K1.Right)return _+Q;return _},CG=(_,Q,J)=>{if(J===K1.Top)return _-Q;if(J===K1.Bottom)return _+Q;return _},t9="react-flow__edgeupdater";function o9({position:_,centerX:Q,centerY:J,radius:q=10,onMouseDown:U,onMouseEnter:G,onMouseOut:Z,type:F}){return d.jsx("circle",{onMouseDown:U,onMouseEnter:G,onMouseOut:Z,className:i1([t9,`${t9}-${F}`]),cx:fG(Q,q,_),cy:CG(J,q,_),r:q,stroke:"transparent",fill:"transparent"})}function SG({isReconnectable:_,reconnectRadius:Q,edge:J,sourceX:q,sourceY:U,targetX:G,targetY:Z,sourcePosition:F,targetPosition:X,onReconnect:Y,onReconnectStart:K,onReconnectEnd:H,setReconnecting:L,setUpdateHover:z}){let W=g1(),I=(R,O)=>{if(R.button!==0)return;let{autoPanOnConnect:C,domNode:f,connectionMode:S,connectionRadius:w,lib:k,onConnectStart:E,cancelConnection:r,nodeLookup:c,rfId:y,panBy:b,updateConnection:v}=W.getState(),x=O.type==="target",V=(u,m)=>{L(!1),H?.(u,J,O.type,m)},D=(u)=>Y?.(J,u),P=(u,m)=>{L(!0),K?.(R,J,O.type),E?.(u,m)};d4.onPointerDown(R.nativeEvent,{autoPanOnConnect:C,connectionMode:S,connectionRadius:w,domNode:f,handleId:O.id,nodeId:O.nodeId,nodeLookup:c,isTarget:x,edgeUpdaterType:O.type,lib:k,flowId:y,cancelConnection:r,panBy:b,isValidConnection:(...u)=>W.getState().isValidConnection?.(...u)??!0,onConnect:D,onConnectStart:P,onConnectEnd:(...u)=>W.getState().onConnectEnd?.(...u),onReconnectEnd:V,updateConnection:v,getTransform:()=>W.getState().transform,getFromHandle:()=>W.getState().connection.fromHandle,dragThreshold:W.getState().connectionDragThreshold,handleDomNode:R.currentTarget})},M=(R)=>I(R,{nodeId:J.target,id:J.targetHandle??null,type:"target"}),B=(R)=>I(R,{nodeId:J.source,id:J.sourceHandle??null,type:"source"}),N=()=>z(!0),A=()=>z(!1);return d.jsxs(d.Fragment,{children:[(_===!0||_==="source")&&d.jsx(o9,{position:F,centerX:q,centerY:U,radius:Q,onMouseDown:M,onMouseEnter:N,onMouseOut:A,type:"source"}),(_===!0||_==="target")&&d.jsx(o9,{position:X,centerX:G,centerY:Z,radius:Q,onMouseDown:B,onMouseEnter:N,onMouseOut:A,type:"target"})]})}function yG({id:_,edgesFocusable:Q,edgesReconnectable:J,elementsSelectable:q,onClick:U,onDoubleClick:G,onContextMenu:Z,onMouseEnter:F,onMouseMove:X,onMouseLeave:Y,reconnectRadius:K,onReconnect:H,onReconnectStart:L,onReconnectEnd:z,rfId:W,edgeTypes:I,noPanClassName:M,onError:B,disableKeyboardA11y:N}){let A=S1((F1)=>F1.edgeLookup.get(_)),R=S1((F1)=>F1.defaultEdgeOptions);A=R?{...R,...A}:A;let O=A.type||"default",C=I?.[O]||a9[O];if(C===void 0)B?.("011",X0.error011(O)),O="default",C=I?.default||a9.default;let f=!!(A.focusable||Q&&typeof A.focusable>"u"),S=typeof H<"u"&&(A.reconnectable||J&&typeof A.reconnectable>"u"),w=!!(A.selectable||q&&typeof A.selectable>"u"),k=a.useRef(null),[E,r]=a.useState(!1),[c,y]=a.useState(!1),b=g1(),{zIndex:v=A.zIndex,sourceX:x,sourceY:V,targetX:D,targetY:P,sourcePosition:u,targetPosition:m}=S1(a.useCallback((F1)=>{let W1=F1.nodeLookup.get(A.source),Y1=F1.nodeLookup.get(A.target);if(!W1||!Y1)return s9;let B1=n7({id:_,sourceNode:W1,targetNode:Y1,sourceHandle:A.sourceHandle||null,targetHandle:A.targetHandle||null,connectionMode:F1.connectionMode,onError:B}),n=s7({selected:A.selected,zIndex:A.zIndex,sourceNode:W1,targetNode:Y1,elevateOnSelect:F1.elevateEdgesOnSelect,zIndexMode:F1.zIndexMode});return{...B1||s9,zIndex:n}},[A.source,A.target,A.sourceHandle,A.targetHandle,A.selected,A.zIndex,B]),m1),h=a.useMemo(()=>A.markerStart?`url('#${l4(A.markerStart,W)}')`:void 0,[A.markerStart,W]),t=a.useMemo(()=>A.markerEnd?`url('#${l4(A.markerEnd,W)}')`:void 0,[A.markerEnd,W]);if(A.hidden||x===null||V===null||D===null||P===null)return null;let Q1=(F1)=>{let{addSelectedEdges:W1,unselectNodesAndEdges:Y1,multiSelectionActive:B1}=b.getState();if(w)if(b.setState({nodesSelectionActive:!1}),A.selected&&B1)Y1({nodes:[],edges:[A]}),k.current?.blur();else W1([_]);if(U)U(F1,A)},s=G?(F1)=>{G(F1,{...A})}:void 0,o=Z?(F1)=>{Z(F1,{...A})}:void 0,l=F?(F1)=>{F(F1,{...A})}:void 0,e=X?(F1)=>{X(F1,{...A})}:void 0,J1=Y?(F1)=>{Y(F1,{...A})}:void 0,U1=(F1)=>{if(!N&&l6.includes(F1.key)&&w){let{unselectNodesAndEdges:W1,addSelectedEdges:Y1}=b.getState();if(F1.key==="Escape")k.current?.blur(),W1({edges:[A]});else Y1([_])}};return d.jsx("svg",{style:{zIndex:v},children:d.jsxs("g",{className:i1(["react-flow__edge",`react-flow__edge-${O}`,A.className,M,{selected:A.selected,animated:A.animated,inactive:!w&&!U,updating:E,selectable:w}]),onClick:Q1,onDoubleClick:s,onContextMenu:o,onMouseEnter:l,onMouseMove:e,onMouseLeave:J1,onKeyDown:f?U1:void 0,tabIndex:f?0:void 0,role:A.ariaRole??(f?"group":"img"),"aria-roledescription":"edge","data-id":_,"data-testid":`rf__edge-${_}`,"aria-label":A.ariaLabel===null?void 0:A.ariaLabel||`Edge from ${A.source} to ${A.target}`,"aria-describedby":f?`${Z_}-${W}`:void 0,ref:k,...A.domAttributes,children:[!c&&d.jsx(C,{id:_,source:A.source,target:A.target,type:A.type,selected:A.selected,animated:A.animated,selectable:w,deletable:A.deletable??!0,label:A.label,labelStyle:A.labelStyle,labelShowBg:A.labelShowBg,labelBgStyle:A.labelBgStyle,labelBgPadding:A.labelBgPadding,labelBgBorderRadius:A.labelBgBorderRadius,sourceX:x,sourceY:V,targetX:D,targetY:P,sourcePosition:u,targetPosition:m,data:A.data,style:A.style,sourceHandleId:A.sourceHandle,targetHandleId:A.targetHandle,markerStart:h,markerEnd:t,pathOptions:"pathOptions"in A?A.pathOptions:void 0,interactionWidth:A.interactionWidth}),S&&d.jsx(SG,{edge:A,isReconnectable:S,reconnectRadius:K,onReconnect:H,onReconnectStart:L,onReconnectEnd:z,sourceX:x,sourceY:V,targetX:D,targetY:P,sourcePosition:u,targetPosition:m,setUpdateHover:r,setReconnecting:y})]})})}var kG=a.memo(yG),jG=(_)=>({edgesFocusable:_.edgesFocusable,edgesReconnectable:_.edgesReconnectable,elementsSelectable:_.elementsSelectable,connectionMode:_.connectionMode,onError:_.onError});function V_({defaultMarkerColor:_,onlyRenderVisibleElements:Q,rfId:J,edgeTypes:q,noPanClassName:U,onReconnect:G,onEdgeContextMenu:Z,onEdgeMouseEnter:F,onEdgeMouseMove:X,onEdgeMouseLeave:Y,onEdgeClick:K,reconnectRadius:H,onEdgeDoubleClick:L,onReconnectStart:z,onReconnectEnd:W,disableKeyboardA11y:I}){let{edgesFocusable:M,edgesReconnectable:B,elementsSelectable:N,onError:A}=S1(jG,m1),R=WG(Q);return d.jsxs("div",{className:"react-flow__edges",children:[d.jsx(RG,{defaultColor:_,rfId:J}),R.map((O)=>{return d.jsx(kG,{id:O,edgesFocusable:M,edgesReconnectable:B,elementsSelectable:N,noPanClassName:U,onReconnect:G,onContextMenu:Z,onMouseEnter:F,onMouseMove:X,onMouseLeave:Y,onClick:K,reconnectRadius:H,onDoubleClick:L,onReconnectStart:z,onReconnectEnd:W,rfId:J,onError:A,edgeTypes:q,disableKeyboardA11y:I},O)})]})}V_.displayName="EdgeRenderer";var vG=a.memo(V_),n9=(_)=>`translate(${_[0]}px,${_[1]}px) scale(${_[2]})`;function VG({children:_}){let Q=g1(),J=a.useRef(null),[q]=a.useState(()=>Q.getState().transform);return Y_(()=>{let U=null,G=()=>{let Z=Q.getState().transform;if(U&&Z[0]===U[0]&&Z[1]===U[1]&&Z[2]===U[2])return;if(U=Z,J.current)J.current.style.transform=n9(Z)};return G(),Q.subscribe(G)},[Q]),d.jsx("div",{ref:J,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n9(q)},children:_})}function uG(_){let Q=o5(),J=a.useRef(!1);a.useEffect(()=>{if(!J.current&&Q.viewportInitialized&&_)setTimeout(()=>_(Q),1),J.current=!0},[_,Q.viewportInitialized])}var hG=(_)=>_.panZoom?.syncViewport;function DG(_){let Q=S1(hG),J=g1();return a.useEffect(()=>{if(_)Q?.(_),J.setState({transform:[_.x,_.y,_.zoom]})},[_,Q]),null}function e9(_){return _.connection.inProgress?{..._.connection,to:G5(_.connection.to,_.transform)}:{..._.connection}}function bG(_){if(_)return(J)=>{let q=e9(J);return _(q)};return e9}function EG(_){let Q=bG(_);return S1(Q,m1)}var xG=(_)=>({nodesConnectable:_.nodesConnectable,isValid:_.connection.isValid,inProgress:_.connection.inProgress,width:_.width,height:_.height});function mG({containerStyle:_,style:Q,type:J,component:q}){let{nodesConnectable:U,width:G,height:Z,isValid:F,inProgress:X}=S1(xG,m1);if(!(G&&U&&X))return null;return d.jsx("svg",{style:_,width:G,height:Z,className:"react-flow__connectionline react-flow__container",children:d.jsx("g",{className:i1(["react-flow__connection",$8(F)]),children:d.jsx(u_,{style:Q,type:J,CustomComponent:q,isValid:F})})})}var u_=({style:_,type:Q=m0.Bezier,CustomComponent:J,isValid:q})=>{let{inProgress:U,from:G,fromNode:Z,fromHandle:F,fromPosition:X,to:Y,toNode:K,toHandle:H,toPosition:L,pointer:z}=EG();if(!U)return;if(J)return d.jsx(J,{connectionLineType:Q,connectionLineStyle:_,fromNode:Z,fromHandle:F,fromX:G.x,fromY:G.y,toX:Y.x,toY:Y.y,fromPosition:X,toPosition:L,connectionStatus:$8(q),toNode:K,toHandle:H,pointer:z});let W="",I={sourceX:G.x,sourceY:G.y,sourcePosition:X,targetX:Y.x,targetY:Y.y,targetPosition:L};switch(Q){case m0.Bezier:[W]=p4(I);break;case m0.SimpleBezier:[W]=O_(I);break;case m0.Step:[W]=s5({...I,borderRadius:0});break;case m0.SmoothStep:[W]=s5(I);break;default:[W]=c4(I)}return d.jsx("path",{d:W,fill:"none",className:"react-flow__connection-path",style:_})};u_.displayName="ConnectionLine";var gG={};function __(_=gG){let Q=a.useRef(_),J=g1();a.useEffect(()=>{{let q=new Set([...Object.keys(Q.current),...Object.keys(_)]);for(let U of q)if(Q.current[U]!==_[U]){J.getState().onError?.("002",X0.error002());break}Q.current=_}},[_])}function pG(){let _=g1(),Q=a.useRef(!1);a.useEffect(()=>{if(!Q.current){let J=document.querySelector(".react-flow__pane");if(J&&window.getComputedStyle(J).zIndex!=="1")_.getState().onError?.("013",X0.error013("react"));Q.current=!0}},[])}function h_({nodeTypes:_,edgeTypes:Q,onInit:J,onNodeClick:q,onEdgeClick:U,onNodeDoubleClick:G,onEdgeDoubleClick:Z,onNodeMouseEnter:F,onNodeMouseMove:X,onNodeMouseLeave:Y,onNodeContextMenu:K,onSelectionContextMenu:H,onSelectionStart:L,onSelectionEnd:z,connectionLineType:W,connectionLineStyle:I,connectionLineComponent:M,connectionLineContainerStyle:B,selectionKeyCode:N,selectionOnDrag:A,selectionMode:R,multiSelectionKeyCode:O,panActivationKeyCode:C,zoomActivationKeyCode:f,deleteKeyCode:S,onlyRenderVisibleElements:w,elementsSelectable:k,defaultViewport:E,translateExtent:r,minZoom:c,maxZoom:y,preventScrolling:b,defaultMarkerColor:v,zoomOnScroll:x,zoomOnPinch:V,panOnScroll:D,panOnScrollSpeed:P,panOnScrollMode:u,zoomOnDoubleClick:m,panOnDrag:h,autoPanOnSelection:t,onPaneClick:Q1,onPaneMouseEnter:s,onPaneMouseMove:o,onPaneMouseLeave:l,onPaneScroll:e,onPaneContextMenu:J1,paneClickDistance:U1,nodeClickDistance:F1,onEdgeContextMenu:W1,onEdgeMouseEnter:Y1,onEdgeMouseMove:B1,onEdgeMouseLeave:n,reconnectRadius:T1,onReconnect:Z1,onReconnectStart:k1,onReconnectEnd:t1,noDragClassName:_0,noWheelClassName:s1,noPanClassName:I0,disableKeyboardA11y:S0,nodeExtent:q0,rfId:x1,viewport:Y0,onViewportChange:W0,nodesDraggable:B0}){return __(_),__(Q),pG(),uG(J),DG(Y0),d.jsx(UG,{onPaneClick:Q1,onPaneMouseEnter:s,onPaneMouseMove:o,onPaneMouseLeave:l,onPaneContextMenu:J1,onPaneScroll:e,paneClickDistance:U1,deleteKeyCode:S,selectionKeyCode:N,selectionOnDrag:A,selectionMode:R,onSelectionStart:L,onSelectionEnd:z,multiSelectionKeyCode:O,panActivationKeyCode:C,zoomActivationKeyCode:f,elementsSelectable:k,zoomOnScroll:x,zoomOnPinch:V,zoomOnDoubleClick:m,panOnScroll:D,panOnScrollSpeed:P,panOnScrollMode:u,panOnDrag:h,autoPanOnSelection:t,defaultViewport:E,translateExtent:r,minZoom:c,maxZoom:y,onSelectionContextMenu:H,preventScrolling:b,noDragClassName:_0,noWheelClassName:s1,noPanClassName:I0,disableKeyboardA11y:S0,onViewportChange:W0,isControlledViewport:!!Y0,children:d.jsxs(VG,{children:[d.jsx(vG,{edgeTypes:Q,onEdgeClick:U,onEdgeDoubleClick:Z,onReconnect:Z1,onReconnectStart:k1,onReconnectEnd:t1,onlyRenderVisibleElements:w,onEdgeContextMenu:W1,onEdgeMouseEnter:Y1,onEdgeMouseMove:B1,onEdgeMouseLeave:n,reconnectRadius:T1,defaultMarkerColor:v,noPanClassName:I0,disableKeyboardA11y:S0,rfId:x1}),d.jsx(mG,{style:I,type:W,component:M,containerStyle:B}),d.jsx("div",{className:"react-flow__edgelabel-renderer"}),d.jsx(zG,{nodeTypes:_,onNodeClick:q,onNodeDoubleClick:G,onNodeMouseEnter:F,onNodeMouseMove:X,onNodeMouseLeave:Y,onNodeContextMenu:K,nodeClickDistance:F1,onlyRenderVisibleElements:w,noPanClassName:I0,noDragClassName:_0,disableKeyboardA11y:S0,nodeExtent:q0,rfId:x1,nodesDraggable:B0}),d.jsx("div",{className:"react-flow__viewport-portal"})]})})}h_.displayName="GraphView";var cG=a.memo(h_),lG=e6("React Flow","https://reactflow.dev/"),Q_=({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X=0.5,maxZoom:Y=2,nodeOrigin:K,nodeExtent:H,zIndexMode:L="basic"}={})=>{let z=new Map,W=new Map,I=new Map,M=new Map,B=q??Q??[],N=J??_??[],A=K??[0,0],R=H??$5;Y8(I,M,B);let{nodesInitialized:O}=r4(N,z,W,{nodeOrigin:A,nodeExtent:R,zIndexMode:L}),C=[0,0,1];if(Z&&U&&G){let f=V2(z,{filter:(E)=>!!((E.width||E.initialWidth)&&(E.height||E.initialHeight))}),{x:S,y:w,zoom:k}=a5(f,U,G,X,Y,F?.padding??0.1);C=[S,w,k]}return{rfId:"1",width:U??0,height:G??0,transform:C,nodes:N,nodesInitialized:O,nodeLookup:z,parentLookup:W,edges:B,edgeLookup:M,connectionLookup:I,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:J!==void 0,hasDefaultEdges:q!==void 0,panZoom:null,minZoom:X,maxZoom:Y,translateExtent:$5,nodeExtent:R,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:W2.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:A,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:Z??!1,fitViewOptions:F,fitViewResolver:null,connection:{...i6},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:lG,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:r6,zIndexMode:L,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},rG=({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X,maxZoom:Y,nodeOrigin:K,nodeExtent:H,zIndexMode:L})=>C9((z,W)=>{async function I(){let{nodeLookup:M,panZoom:B,fitViewOptions:N,fitViewResolver:A,width:R,height:O,minZoom:C,maxZoom:f}=W();if(!B)return;await p7({nodes:M,width:R,height:O,panZoom:B,minZoom:C,maxZoom:f},N),A?.resolve(!0),z({fitViewResolver:null})}return{...Q_({nodes:_,edges:Q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X,maxZoom:Y,nodeOrigin:K,nodeExtent:H,defaultNodes:J,defaultEdges:q,zIndexMode:L}),setNodes:(M)=>{let{nodeLookup:B,parentLookup:N,nodeOrigin:A,nodeExtent:R,elevateNodesOnSelect:O,fitViewQueued:C,zIndexMode:f,nodesSelectionActive:S}=W(),{nodesInitialized:w,hasSelectedNodes:k}=r4(M,B,N,{nodeOrigin:A,nodeExtent:R,elevateNodesOnSelect:O,checkEquality:!0,zIndexMode:f}),E=S&&k;if(C&&w)I(),z({nodes:M,nodesInitialized:w,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:E});else z({nodes:M,nodesInitialized:w,nodesSelectionActive:E})},setEdges:(M)=>{let{connectionLookup:B,edgeLookup:N}=W();Y8(B,N,M),z({edges:M})},setDefaultNodesAndEdges:(M,B)=>{if(M){let{setNodes:N}=W();N(M),z({hasDefaultNodes:!0})}if(B){let{setEdges:N}=W();N(B),z({hasDefaultEdges:!0})}},updateNodeInternals:(M)=>{let{triggerNodeChanges:B,nodeLookup:N,parentLookup:A,domNode:R,nodeOrigin:O,nodeExtent:C,debug:f,fitViewQueued:S,zIndexMode:w}=W(),{changes:k,updatedInternals:E}=q9(M,N,A,R,O,C,w);if(!E)return;if(J9(N,A,{nodeOrigin:O,nodeExtent:C,zIndexMode:w}),S)I(),z({fitViewQueued:!1,fitViewOptions:void 0});else z({});if(k?.length>0){if(f)console.log("React Flow: trigger node changes",k);B?.(k)}},updateNodePositions:(M,B=!1)=>{let N=[],A=[],{nodeLookup:R,triggerNodeChanges:O,connection:C,updateConnection:f,onNodesChangeMiddlewareMap:S}=W();for(let[w,k]of M){let E=R.get(w),r=!!(E?.expandParent&&E?.parentId&&k?.position),c={id:w,type:"position",position:r?{x:Math.max(0,k.position.x),y:Math.max(0,k.position.y)}:k.position,dragging:B};if(E&&C.inProgress&&C.fromNode.id===E.id){let y=B2(E,C.fromHandle,K1.Left,!0);f({...C,from:y})}if(r&&E.parentId)N.push({id:w,parentId:E.parentId,rect:{...k.internals.positionAbsolute,width:k.measured.width??0,height:k.measured.height??0}});A.push(c)}if(N.length>0){let{parentLookup:w,nodeOrigin:k}=W(),E=i4(N,R,w,k);A.push(...E)}for(let w of S.values())A=w(A);O(A)},triggerNodeChanges:(M)=>{let{onNodesChange:B,setNodes:N,nodes:A,hasDefaultNodes:R,debug:O}=W();if(M?.length){if(R){let C=X_(M,A);N(C)}if(O)console.log("React Flow: trigger node changes",M);B?.(M)}},triggerEdgeChanges:(M)=>{let{onEdgesChange:B,setEdges:N,edges:A,hasDefaultEdges:R,debug:O}=W();if(M?.length){if(R){let C=fU(M,A);N(C)}if(O)console.log("React Flow: trigger edge changes",M);B?.(M)}},addSelectedNodes:(M)=>{let{multiSelectionActive:B,edgeLookup:N,nodeLookup:A,triggerNodeChanges:R,triggerEdgeChanges:O}=W();if(B){let C=M.map((f)=>u2(f,!0));R(C);return}R(F5(A,new Set([...M]),!0)),O(F5(N))},addSelectedEdges:(M)=>{let{multiSelectionActive:B,edgeLookup:N,nodeLookup:A,triggerNodeChanges:R,triggerEdgeChanges:O}=W();if(B){let C=M.map((f)=>u2(f,!0));O(C);return}O(F5(N,new Set([...M]))),R(F5(A,new Set,!0))},unselectNodesAndEdges:({nodes:M,edges:B}={})=>{let{edges:N,nodes:A,nodeLookup:R,triggerNodeChanges:O,triggerEdgeChanges:C}=W(),f=M?M:A,S=B?B:N,w=[];for(let E of f){if(!E.selected)continue;let r=R.get(E.id);if(r)r.selected=!1;w.push(u2(E.id,!1))}let k=[];for(let E of S){if(!E.selected)continue;k.push(u2(E.id,!1))}O(w),C(k)},setMinZoom:(M)=>{let{panZoom:B,maxZoom:N}=W();B?.setScaleExtent([M,N]),z({minZoom:M})},setMaxZoom:(M)=>{let{panZoom:B,minZoom:N}=W();B?.setScaleExtent([N,M]),z({maxZoom:M})},setTranslateExtent:(M)=>{W().panZoom?.setTranslateExtent(M),z({translateExtent:M})},resetSelectedElements:()=>{let{edges:M,nodes:B,triggerNodeChanges:N,triggerEdgeChanges:A,elementsSelectable:R}=W();if(!R)return;let O=B.reduce((f,S)=>S.selected?[...f,u2(S.id,!1)]:f,[]),C=M.reduce((f,S)=>S.selected?[...f,u2(S.id,!1)]:f,[]);N(O),A(C)},setNodeExtent:(M)=>{let{nodes:B,nodeLookup:N,parentLookup:A,nodeOrigin:R,elevateNodesOnSelect:O,nodeExtent:C,zIndexMode:f}=W();if(M[0][0]===C[0][0]&&M[0][1]===C[0][1]&&M[1][0]===C[1][0]&&M[1][1]===C[1][1])return;r4(B,N,A,{nodeOrigin:R,nodeExtent:M,elevateNodesOnSelect:O,checkEquality:!1,zIndexMode:f}),z({nodeExtent:M})},panBy:(M)=>{let{transform:B,width:N,height:A,panZoom:R,translateExtent:O}=W();return U9({delta:M,panZoom:R,transform:B,translateExtent:O,width:N,height:A})},setCenter:async(M,B,N)=>{let{width:A,height:R,maxZoom:O,panZoom:C}=W();if(!C)return!1;let f=typeof N?.zoom<"u"?N.zoom:O;return await C.setViewport({x:A/2-M*f,y:R/2-B*f,zoom:f},{duration:N?.duration,ease:N?.ease,interpolate:N?.interpolate}),!0},cancelConnection:()=>{z({connection:{...i6}})},updateConnection:(M)=>{z({connection:M})},reset:()=>z({...Q_()})}},Object.is);function R8({initialNodes:_,initialEdges:Q,defaultNodes:J,defaultEdges:q,initialWidth:U,initialHeight:G,initialMinZoom:Z,initialMaxZoom:F,initialFitViewOptions:X,fitView:Y,nodeOrigin:K,nodeExtent:H,zIndexMode:L,children:z}){let[W]=a.useState(()=>rG({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,width:U,height:G,fitView:Y,minZoom:Z,maxZoom:F,fitViewOptions:X,nodeOrigin:K,nodeExtent:H,zIndexMode:L}));return d.jsx(GU,{value:W,children:d.jsx(jU,{children:d.jsx(iU,{children:z})})})}function iG({children:_,nodes:Q,edges:J,defaultNodes:q,defaultEdges:U,width:G,height:Z,fitView:F,fitViewOptions:X,minZoom:Y,maxZoom:K,nodeOrigin:H,nodeExtent:L,zIndexMode:z}){if(a.useContext(e4))return d.jsx(d.Fragment,{children:_});return d.jsx(R8,{initialNodes:Q,initialEdges:J,defaultNodes:q,defaultEdges:U,initialWidth:G,initialHeight:Z,fitView:F,initialFitViewOptions:X,initialMinZoom:Y,initialMaxZoom:K,nodeOrigin:H,nodeExtent:L,zIndexMode:z,children:_})}var dG={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function aG({nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,className:U,nodeTypes:G,edgeTypes:Z,onNodeClick:F,onEdgeClick:X,onInit:Y,onMove:K,onMoveStart:H,onMoveEnd:L,onConnect:z,onConnectStart:W,onConnectEnd:I,onClickConnectStart:M,onClickConnectEnd:B,onNodeMouseEnter:N,onNodeMouseMove:A,onNodeMouseLeave:R,onNodeContextMenu:O,onNodeDoubleClick:C,onNodeDragStart:f,onNodeDrag:S,onNodeDragStop:w,onNodesDelete:k,onEdgesDelete:E,onDelete:r,onSelectionChange:c,onSelectionDragStart:y,onSelectionDrag:b,onSelectionDragStop:v,onSelectionContextMenu:x,onSelectionStart:V,onSelectionEnd:D,onBeforeDelete:P,connectionMode:u,connectionLineType:m=m0.Bezier,connectionLineStyle:h,connectionLineComponent:t,connectionLineContainerStyle:Q1,deleteKeyCode:s="Backspace",selectionKeyCode:o="Shift",selectionOnDrag:l=!1,selectionMode:e=y2.Full,panActivationKeyCode:J1="Space",multiSelectionKeyCode:U1=Z5()?"Meta":"Control",zoomActivationKeyCode:F1=Z5()?"Meta":"Control",snapToGrid:W1,snapGrid:Y1,onlyRenderVisibleElements:B1=!1,selectNodesOnDrag:n,nodesDraggable:T1,autoPanOnNodeFocus:Z1,nodesConnectable:k1,nodesFocusable:t1,nodeOrigin:_0=F_,edgesFocusable:s1,edgesReconnectable:I0,elementsSelectable:S0=!0,defaultViewport:q0=TU,minZoom:x1=0.5,maxZoom:Y0=2,translateExtent:W0=$5,preventScrolling:B0=!0,nodeExtent:L0,defaultMarkerColor:G2="#b1b1b7",zoomOnScroll:h0=!0,zoomOnPinch:Z2=!0,panOnScroll:F2=!1,panOnScrollSpeed:A0=0.5,panOnScrollMode:T=o0.Free,zoomOnDoubleClick:g=!0,panOnDrag:_1=!0,onPaneClick:$1,onPaneMouseEnter:L1,onPaneMouseMove:w1,onPaneMouseLeave:P1,onPaneScroll:u1,onPaneContextMenu:f1,paneClickDistance:M0=1,nodeClickDistance:y0=0,children:L5,onReconnect:l2,onReconnectStart:Y3,onReconnectEnd:z5,onEdgeContextMenu:L3,onEdgeDoubleClick:U4,onEdgeMouseEnter:z3,onEdgeMouseMove:W3,onEdgeMouseLeave:G4,reconnectRadius:W5=10,onNodesChange:B3,onEdgesChange:B5,noDragClassName:Z4="nodrag",noWheelClassName:r2="nowheel",noPanClassName:A5="nopan",fitView:F4,fitViewOptions:H4,connectOnClick:j,attributionPosition:i,proOptions:q1,defaultEdgeOptions:G1,elevateNodesOnSelect:N1=!0,elevateEdgesOnSelect:H1=!1,disableKeyboardA11y:z1=!1,autoPanOnConnect:X1,autoPanOnNodeDrag:I1,autoPanOnSelection:v1=!0,autoPanSpeed:R1,connectionRadius:r1,isValidConnection:b1,onError:M5,style:T0,id:E1,nodeDragThreshold:bQ,connectionDragThreshold:EQ,viewport:xQ,onViewportChange:mQ,width:gQ,height:pQ,colorMode:cQ="light",debug:lQ,onScroll:b8,ariaLabelConfig:rQ,zIndexMode:E8="basic",...iQ},dQ){let A3=E1||"1",aQ=PU(cQ),sQ=a.useCallback((x8)=>{x8.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),b8?.(x8)},[b8]);return d.jsx("div",{"data-testid":"rf__wrapper",...iQ,onScroll:sQ,style:{...T0,...dG},ref:dQ,className:i1(["react-flow",U,aQ]),id:E1,role:"application",children:d.jsxs(iG,{nodes:_,edges:Q,width:gQ,height:pQ,fitView:F4,fitViewOptions:H4,minZoom:x1,maxZoom:Y0,nodeOrigin:_0,nodeExtent:L0,zIndexMode:E8,children:[d.jsx(IU,{nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,onConnect:z,onConnectStart:W,onConnectEnd:I,onClickConnectStart:M,onClickConnectEnd:B,nodesDraggable:T1,autoPanOnNodeFocus:Z1,nodesConnectable:k1,nodesFocusable:t1,edgesFocusable:s1,edgesReconnectable:I0,elementsSelectable:S0,elevateNodesOnSelect:N1,elevateEdgesOnSelect:H1,minZoom:x1,maxZoom:Y0,nodeExtent:L0,onNodesChange:B3,onEdgesChange:B5,snapToGrid:W1,snapGrid:Y1,connectionMode:u,translateExtent:W0,connectOnClick:j,defaultEdgeOptions:G1,fitView:F4,fitViewOptions:H4,onNodesDelete:k,onEdgesDelete:E,onDelete:r,onNodeDragStart:f,onNodeDrag:S,onNodeDragStop:w,onSelectionDrag:b,onSelectionDragStart:y,onSelectionDragStop:v,onMove:K,onMoveStart:H,onMoveEnd:L,noPanClassName:A5,nodeOrigin:_0,rfId:A3,autoPanOnConnect:X1,autoPanOnNodeDrag:I1,autoPanSpeed:R1,onError:M5,connectionRadius:r1,isValidConnection:b1,selectNodesOnDrag:n,nodeDragThreshold:bQ,connectionDragThreshold:EQ,onBeforeDelete:P,debug:lQ,ariaLabelConfig:rQ,zIndexMode:E8}),d.jsx(cG,{onInit:Y,onNodeClick:F,onEdgeClick:X,onNodeMouseEnter:N,onNodeMouseMove:A,onNodeMouseLeave:R,onNodeContextMenu:O,onNodeDoubleClick:C,nodeTypes:G,edgeTypes:Z,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:t,connectionLineContainerStyle:Q1,selectionKeyCode:o,selectionOnDrag:l,selectionMode:e,deleteKeyCode:s,multiSelectionKeyCode:U1,panActivationKeyCode:J1,zoomActivationKeyCode:F1,onlyRenderVisibleElements:B1,defaultViewport:q0,translateExtent:W0,minZoom:x1,maxZoom:Y0,preventScrolling:B0,zoomOnScroll:h0,zoomOnPinch:Z2,zoomOnDoubleClick:g,panOnScroll:F2,panOnScrollSpeed:A0,panOnScrollMode:T,panOnDrag:_1,autoPanOnSelection:v1,onPaneClick:$1,onPaneMouseEnter:L1,onPaneMouseMove:w1,onPaneMouseLeave:P1,onPaneScroll:u1,onPaneContextMenu:f1,paneClickDistance:M0,nodeClickDistance:y0,onSelectionContextMenu:x,onSelectionStart:V,onSelectionEnd:D,onReconnect:l2,onReconnectStart:Y3,onReconnectEnd:z5,onEdgeContextMenu:L3,onEdgeDoubleClick:U4,onEdgeMouseEnter:z3,onEdgeMouseMove:W3,onEdgeMouseLeave:G4,reconnectRadius:W5,defaultMarkerColor:G2,noDragClassName:Z4,noWheelClassName:r2,noPanClassName:A5,rfId:A3,disableKeyboardA11y:z1,nodeExtent:L0,viewport:xQ,onViewportChange:mQ,nodesDraggable:T1}),d.jsx(MU,{onSelectionChange:c}),L5,d.jsx(LU,{proOptions:q1,position:i}),d.jsx(YU,{rfId:A3,disableKeyboardA11y:z1})]})})}var D_=K_(aG);function b_(_){let[Q,J]=a.useState(_),q=a.useCallback((U)=>J((G)=>X_(U,G)),[]);return[Q,J,q]}var mA=X0.error014();function sG({dimensions:_,lineWidth:Q,variant:J,className:q}){return d.jsx("path",{strokeWidth:Q,d:`M${_[0]/2} 0 V${_[1]} M0 ${_[1]/2} H${_[0]}`,className:i1(["react-flow__background-pattern",J,q])})}function tG({radius:_,className:Q}){return d.jsx("circle",{cx:_,cy:_,r:_,className:i1(["react-flow__background-pattern","dots",Q])})}var g0;(function(_){_.Lines="lines",_.Dots="dots",_.Cross="cross"})(g0||(g0={}));var oG={[g0.Dots]:1,[g0.Lines]:1,[g0.Cross]:6},nG=(_)=>({transform:_.transform,patternId:`pattern-${_.rfId}`});function E_({id:_,variant:Q=g0.Dots,gap:J=20,size:q,lineWidth:U=1,offset:G=0,color:Z,bgColor:F,style:X,className:Y,patternClassName:K}){let H=a.useRef(null),{transform:L,patternId:z}=S1(nG,m1),W=q||oG[Q],I=Q===g0.Dots,M=Q===g0.Cross,B=Array.isArray(J)?J:[J,J],N=[B[0]*L[2]||1,B[1]*L[2]||1],A=W*L[2],R=Array.isArray(G)?G:[G,G],O=M?[A,A]:N,C=[R[0]*L[2]+O[0]/2,R[1]*L[2]+O[1]/2],f=`${z}${_?_:""}`;return d.jsxs("svg",{className:i1(["react-flow__background",Y]),style:{...X,..._3,"--xy-background-color-props":F,"--xy-background-pattern-color-props":Z},ref:H,"data-testid":"rf__background",children:[d.jsx("pattern",{id:f,x:L[0]%N[0],y:L[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:I?d.jsx(tG,{radius:A/2,className:K}):d.jsx(sG,{dimensions:O,lineWidth:U,variant:Q,className:K})}),d.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${f})`})]})}E_.displayName="Background";var x_=a.memo(E_);function eG(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:d.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function _Z(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:d.jsx("path",{d:"M0 0h32v4.2H0z"})})}function QZ(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:d.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function JZ(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function $Z(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function t4({children:_,className:Q,...J}){return d.jsx("button",{type:"button",className:i1(["react-flow__controls-button",Q]),...J,children:_})}var qZ=(_)=>({isInteractive:_.nodesDraggable||_.nodesConnectable||_.elementsSelectable,minZoomReached:_.transform[2]<=_.minZoom,maxZoomReached:_.transform[2]>=_.maxZoom,ariaLabelConfig:_.ariaLabelConfig});function m_({style:_,showZoom:Q=!0,showFitView:J=!0,showInteractive:q=!0,fitViewOptions:U,onZoomIn:G,onZoomOut:Z,onFitView:F,onInteractiveChange:X,className:Y,children:K,position:H="bottom-left",orientation:L="vertical","aria-label":z}){let W=g1(),{isInteractive:I,minZoomReached:M,maxZoomReached:B,ariaLabelConfig:N}=S1(qZ,m1),{zoomIn:A,zoomOut:R,fitView:O}=o5(),C=()=>{A(),G?.()},f=()=>{R(),Z?.()},S=()=>{O(U),F?.()},w=()=>{W.setState({nodesDraggable:!I,nodesConnectable:!I,elementsSelectable:!I}),X?.(!I)};return d.jsxs(p0,{className:i1(["react-flow__controls",L==="horizontal"?"horizontal":"vertical",Y]),position:H,style:_,"data-testid":"rf__controls","aria-label":z??N["controls.ariaLabel"],children:[Q&&d.jsxs(d.Fragment,{children:[d.jsx(t4,{onClick:C,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:B,children:d.jsx(eG,{})}),d.jsx(t4,{onClick:f,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:M,children:d.jsx(_Z,{})})]}),J&&d.jsx(t4,{className:"react-flow__controls-fitview",onClick:S,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:d.jsx(QZ,{})}),q&&d.jsx(t4,{className:"react-flow__controls-interactive",onClick:w,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:I?d.jsx($Z,{}):d.jsx(JZ,{})}),K]})}m_.displayName="Controls";var g_=a.memo(m_);function UZ({id:_,x:Q,y:J,width:q,height:U,style:G,color:Z,strokeColor:F,strokeWidth:X,className:Y,borderRadius:K,shapeRendering:H,selected:L,onClick:z}){let{background:W,backgroundColor:I}=G||{},M=Z||W||I;return d.jsx("rect",{className:i1(["react-flow__minimap-node",{selected:L},Y]),x:Q,y:J,rx:K,ry:K,width:q,height:U,style:{fill:M,stroke:F,strokeWidth:X},shapeRendering:H,onClick:z?(B)=>z(B,_):void 0})}var GZ=a.memo(UZ),ZZ=(_)=>_.nodes.map((Q)=>Q.id),B8=(_)=>_ instanceof Function?_:()=>_;function FZ({nodeStrokeColor:_,nodeColor:Q,nodeClassName:J="",nodeBorderRadius:q=5,nodeStrokeWidth:U,nodeComponent:G=GZ,onClick:Z}){let F=S1(ZZ,m1),X=B8(Q),Y=B8(_),K=B8(J),H=typeof window>"u"||!!window.chrome?"crispEdges":"geometricPrecision";return d.jsx(d.Fragment,{children:F.map((L)=>d.jsx(XZ,{id:L,nodeColorFunc:X,nodeStrokeColorFunc:Y,nodeClassNameFunc:K,nodeBorderRadius:q,nodeStrokeWidth:U,NodeComponent:G,onClick:Z,shapeRendering:H},L))})}function HZ({id:_,nodeColorFunc:Q,nodeStrokeColorFunc:J,nodeClassNameFunc:q,nodeBorderRadius:U,nodeStrokeWidth:G,shapeRendering:Z,NodeComponent:F,onClick:X}){let{node:Y,x:K,y:H,width:L,height:z}=S1((W)=>{let I=W.nodeLookup.get(_);if(!I)return{node:void 0,x:0,y:0,width:0,height:0};let M=I.internals.userNode,{x:B,y:N}=I.internals.positionAbsolute,{width:A,height:R}=w0(M);return{node:M,x:B,y:N,width:A,height:R}},m1);if(!Y||Y.hidden||!_8(Y))return null;return d.jsx(F,{x:K,y:H,width:L,height:z,style:Y.style,selected:!!Y.selected,className:q(Y),color:Q(Y),borderRadius:U,strokeColor:J(Y),strokeWidth:G,shapeRendering:Z,onClick:X,id:Y.id})}var XZ=a.memo(HZ),KZ=a.memo(FZ),YZ=200,LZ=150,zZ=(_)=>!_.hidden,WZ=(_)=>{let Q={x:-_.transform[0]/_.transform[2],y:-_.transform[1]/_.transform[2],width:_.width/_.transform[2],height:_.height/_.transform[2]},J=!1;for(let q of _.nodeLookup.values())if(!q.hidden){J=!0;break}return{viewBB:Q,boundingRect:J?o6(V2(_.nodeLookup,{filter:zZ}),Q):Q,rfId:_.rfId,panZoom:_.panZoom,translateExtent:_.translateExtent,flowWidth:_.width,flowHeight:_.height,ariaLabelConfig:_.ariaLabelConfig}},J_=(_,Q)=>_.x===Q.x&&_.y===Q.y&&_.width===Q.width&&_.height===Q.height,BZ=(_,Q)=>J_(_.viewBB,Q.viewBB)&&J_(_.boundingRect,Q.boundingRect)&&_.rfId===Q.rfId&&_.panZoom===Q.panZoom&&_.translateExtent===Q.translateExtent&&_.flowWidth===Q.flowWidth&&_.flowHeight===Q.flowHeight&&_.ariaLabelConfig===Q.ariaLabelConfig,AZ="react-flow__minimap-desc";function p_({style:_,className:Q,nodeStrokeColor:J,nodeColor:q,nodeClassName:U="",nodeBorderRadius:G=5,nodeStrokeWidth:Z,nodeComponent:F,bgColor:X,maskColor:Y,maskStrokeColor:K,maskStrokeWidth:H,position:L="bottom-right",onClick:z,onNodeClick:W,pannable:I=!1,zoomable:M=!1,ariaLabel:B,inversePan:N,zoomStep:A=1,offsetScale:R=5}){let O=g1(),C=a.useRef(null),{boundingRect:f,panZoom:S,viewBB:w,rfId:k,translateExtent:E,flowWidth:r,flowHeight:c,ariaLabelConfig:y}=S1(WZ,BZ),b=_?.width??YZ,v=_?.height??LZ,x=f.width/b,V=f.height/v,D=Math.max(x,V),P=D*b,u=D*v,m=R*D,h=f.x-(P-f.width)/2-m,t=f.y-(u-f.height)/2-m,Q1=P+m*2,s=u+m*2,o=`${AZ}-${k}`,l=a.useRef(0),e=a.useRef();l.current=D,a.useEffect(()=>{let Y1=O.getState().panZoom;if(C.current&&Y1)return e.current=Y9({domNode:C.current,panZoom:Y1,getTransform:()=>O.getState().transform,getViewScale:()=>l.current}),()=>{e.current?.destroy()}},[S]),a.useEffect(()=>{e.current?.update({translateExtent:E,width:r,height:c,inversePan:N,pannable:I,zoomStep:A,zoomable:M})},[I,M,N,A,E,r,c]);let J1=z?(Y1)=>{let[B1,n]=e.current?.pointer(Y1)||[0,0];z(Y1,{x:B1,y:n})}:void 0,U1=a.useCallback((Y1,B1)=>{let n=O.getState().nodeLookup.get(B1).internals.userNode;W?.(Y1,n)},[W]),F1=W?U1:void 0,W1=B??y["minimap.ariaLabel"];return d.jsx(p0,{position:L,style:{..._,"--xy-minimap-background-color-props":typeof X==="string"?X:void 0,"--xy-minimap-mask-background-color-props":typeof Y==="string"?Y:void 0,"--xy-minimap-mask-stroke-color-props":typeof K==="string"?K:void 0,"--xy-minimap-mask-stroke-width-props":typeof H==="number"?H*D:void 0,"--xy-minimap-node-background-color-props":typeof q==="string"?q:void 0,"--xy-minimap-node-stroke-color-props":typeof J==="string"?J:void 0,"--xy-minimap-node-stroke-width-props":typeof Z==="number"?Z:void 0},className:i1(["react-flow__minimap",Q]),"data-testid":"rf__minimap",children:d.jsxs("svg",{width:b,height:v,viewBox:`${h} ${t} ${Q1} ${s}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":o,ref:C,onClick:J1,children:[W1&&d.jsx("title",{id:o,children:W1}),d.jsx(KZ,{onClick:F1,nodeColor:q,nodeStrokeColor:J,nodeBorderRadius:G,nodeClassName:U,nodeStrokeWidth:Z,nodeComponent:F}),d.jsx("path",{className:"react-flow__minimap-mask",d:`M${h-m},${t-m}h${Q1+m*2}v${s+m*2}h${-Q1-m*2}z
|
|
34
|
+
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}p_.displayName="MiniMap";var c_=a.memo(p_),MZ=(_)=>(Q)=>_?`${Math.max(1/Q.transform[2],1)}`:void 0,TZ={[n0.Line]:"right",[n0.Handle]:"bottom-right"};function RZ({nodeId:_,position:Q,variant:J=n0.Handle,className:q,style:U=void 0,children:G,color:Z,minWidth:F=10,minHeight:X=10,maxWidth:Y=Number.MAX_VALUE,maxHeight:K=Number.MAX_VALUE,keepAspectRatio:H=!1,resizeDirection:L,autoScale:z=!0,shouldResize:W,onResizeStart:I,onResize:M,onResizeEnd:B}){let N=T8(),A=typeof _==="string"?_:N,R=g1(),O=a.useRef(null),C=J===n0.Handle,f=S1(a.useCallback(MZ(C&&z),[C,z]),m1),S=a.useRef(null),w=Q??TZ[J];a.useEffect(()=>{if(!O.current||!A)return;if(!S.current)S.current=T9({domNode:O.current,nodeId:A,getStoreItems:()=>{let{nodeLookup:E,transform:r,snapGrid:c,snapToGrid:y,nodeOrigin:b,domNode:v}=R.getState();return{nodeLookup:E,transform:r,snapGrid:c,snapToGrid:y,nodeOrigin:b,paneDomNode:v}},onChange:(E,r)=>{let{triggerNodeChanges:c,nodeLookup:y,parentLookup:b,nodeOrigin:v}=R.getState(),x=[],V={x:E.x,y:E.y},D=y.get(A);if(D&&D.expandParent&&D.parentId){let P=D.origin??v,u=E.width??D.measured.width??0,m=E.height??D.measured.height??0,h={id:D.id,parentId:D.parentId,rect:{width:u,height:m,...Q8({x:E.x??D.position.x,y:E.y??D.position.y},{width:u,height:m},D.parentId,y,P)}},t=i4([h],y,b,v);x.push(...t),V.x=E.x?Math.max(P[0]*u,E.x):void 0,V.y=E.y?Math.max(P[1]*m,E.y):void 0}if(V.x!==void 0&&V.y!==void 0){let P={id:A,type:"position",position:{...V}};x.push(P)}if(E.width!==void 0&&E.height!==void 0){let u={id:A,type:"dimensions",resizing:!0,setAttributes:!L?!0:L==="horizontal"?"width":"height",dimensions:{width:E.width,height:E.height}};x.push(u)}for(let P of r){let u={...P,type:"position"};x.push(u)}c(x)},onEnd:({width:E,height:r})=>{let c={id:A,type:"dimensions",resizing:!1,dimensions:{width:E,height:r}};R.getState().triggerNodeChanges([c])}});return S.current.update({controlPosition:w,boundaries:{minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K},keepAspectRatio:H,resizeDirection:L,onResizeStart:I,onResize:M,onResizeEnd:B,shouldResize:W}),()=>{S.current?.destroy()}},[w,F,X,Y,K,H,I,M,B,W]);let k=w.split("-");return d.jsx("div",{className:i1(["react-flow__resize-control","nodrag",...k,J,q]),ref:O,style:{...U,scale:f,...Z&&{[C?"backgroundColor":"borderColor"]:Z}},children:G})}var $_=a.memo(RZ);function l_({nodeId:_,isVisible:Q=!0,handleClassName:J,handleStyle:q,lineClassName:U,lineStyle:G,color:Z,minWidth:F=10,minHeight:X=10,maxWidth:Y=Number.MAX_VALUE,maxHeight:K=Number.MAX_VALUE,keepAspectRatio:H=!1,autoScale:L=!0,shouldResize:z,onResizeStart:W,onResize:I,onResizeEnd:M}){if(!Q)return null;return d.jsxs(d.Fragment,{children:[A9.map((B)=>d.jsx($_,{className:U,style:G,nodeId:_,position:B,variant:n0.Line,color:Z,minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K,onResizeStart:W,keepAspectRatio:H,autoScale:L,shouldResize:z,onResize:I,onResizeEnd:M},B)),B9.map((B)=>d.jsx($_,{className:J,style:q,nodeId:_,position:B,color:Z,minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K,onResizeStart:W,keepAspectRatio:H,autoScale:L,shouldResize:z,onResize:I,onResizeEnd:M},B))]})}var OZ=(_)=>_.domNode?.querySelector(".react-flow__renderer");function IZ({children:_}){let Q=S1(OZ);if(!Q)return null;return q_.createPortal(_,Q)}var PZ=(_,Q)=>_?.internals.positionAbsolute.x!==Q?.internals.positionAbsolute.x||_?.internals.positionAbsolute.y!==Q?.internals.positionAbsolute.y||_?.measured.width!==Q?.measured.width||_?.measured.height!==Q?.measured.height||_?.selected!==Q?.selected||_?.internals.z!==Q?.internals.z,NZ=(_,Q)=>{if(_.size!==Q.size)return!1;for(let[J,q]of _)if(PZ(q,Q.get(J)))return!1;return!0},wZ=(_)=>({x:_.transform[0],y:_.transform[1],zoom:_.transform[2],selectedNodesCount:_.nodes.filter((Q)=>Q.selected).length});function O8({nodeId:_,children:Q,className:J,style:q,isVisible:U,position:G=K1.Top,offset:Z=10,align:F="center",...X}){let Y=T8(),K=a.useCallback((O)=>{return(Array.isArray(_)?_:[_||Y||""]).reduce((S,w)=>{let k=O.nodeLookup.get(w);if(k)S.set(k.id,k);return S},new Map)},[_,Y]),H=S1(K,NZ),{x:L,y:z,zoom:W,selectedNodesCount:I}=S1(wZ,m1);if(!(typeof U==="boolean"?U:H.size===1&&H.values().next().value?.selected&&I===1)||!H.size)return null;let B=V2(H),N=Array.from(H.values()),A=Math.max(...N.map((O)=>O.internals.z+1)),R={position:"absolute",transform:_9(B,{x:L,y:z,zoom:W},G,Z,F),zIndex:A,...q};return d.jsx(IZ,{children:d.jsx("div",{style:R,className:i1(["react-flow__node-toolbar",J]),...X,"data-id":N.reduce((O,C)=>`${O}${C.id} `,"").trim(),children:Q})})}var Q0=J0(D0(),1);var r_={x:{title:"X",fill:"currentColor",d:"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"},youtube:{title:"YouTube",fill:"#FF0000",d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"},tiktok:{title:"TikTok",fill:"currentColor",d:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z"},discord:{title:"Discord",fill:"#5865F2",d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"},resend:{title:"Resend",fill:"currentColor",d:"M2.023 0v24h5.553v-8.434h2.998L15.326 24h6.65l-5.372-9.258a7.652 7.652 0 0 0 3.316-3.016c.709-1.21 1.062-2.57 1.062-4.08 0-1.462-.353-2.767-1.062-3.91-.709-1.165-1.692-2.079-2.95-2.742C15.737.331 14.355 0 12.823 0Zm5.553 4.87h4.219c.731 0 1.349.125 1.851.376.526.252.925.618 1.2 1.098.274.457.412.994.412 1.611S15.132 9.12 14.88 9.6c-.229.48-.572.856-1.03 1.13-.434.252-.948.38-1.542.38H7.576Z"},linkedin:{title:"LinkedIn",fill:"#0A66C2",d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"},reddit:{title:"Reddit",fill:"#FF4500",d:"M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z"},bluesky:{title:"Bluesky",fill:"#0285FF",d:"M12 10.8c-1.087-2.114-4.046-6.053-6.798-7.995C2.566.944 1.561 1.266.902 1.565.139 1.908 0 3.08 0 3.768c0 .69.378 5.65.624 6.479.815 2.736 3.713 3.66 6.383 3.364.136-.02.275-.039.415-.056-.138.022-.276.04-.415.056-3.912.58-7.387 2.005-2.83 7.078 5.013 5.19 6.87-1.113 7.823-4.308.953 3.195 2.05 9.271 7.733 4.308 4.267-4.308 1.172-6.498-2.74-7.078a8.741 8.741 0 0 1-.415-.056c.14.017.279.036.415.056 2.67.297 5.568-.628 6.383-3.364.246-.828.624-5.79.624-6.478 0-.69-.139-1.861-.902-2.206-.659-.298-1.664-.62-4.3 1.24C16.046 4.748 13.087 8.687 12 10.8Z"},instagram:{title:"Instagram",fill:"#FF0069",d:"M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077"},github:{title:"GitHub",fill:"currentColor",d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"},stripe:{title:"Stripe",fill:"#635BFF",d:"M13.976 9.15c-2.172-.806-3.356-1.426-3.356-2.409 0-.831.683-1.305 1.901-1.305 2.227 0 4.515.858 6.09 1.631l.89-5.494C18.252.975 15.697 0 12.165 0 9.667 0 7.589.654 6.104 1.872 4.56 3.147 3.757 4.992 3.757 7.218c0 4.039 2.467 5.76 6.476 7.219 2.585.92 3.445 1.574 3.445 2.583 0 .98-.84 1.545-2.354 1.545-1.875 0-4.965-.921-6.99-2.109l-.9 5.555C5.175 22.99 8.385 24 11.714 24c2.641 0 4.843-.624 6.328-1.813 1.664-1.305 2.525-3.236 2.525-5.732 0-4.128-2.524-5.851-6.594-7.305h.003z"},slack:{title:"Slack",fill:"#4A154B",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"},openai:{title:"OpenAI",fill:"#412991",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"},anthropic:{title:"Anthropic",fill:"currentColor",d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"},twilio:{title:"Twilio",fill:"#F22F46",d:"M12 0C5.381-.008.008 5.352 0 11.971V12c0 6.64 5.359 12 12 12 6.64 0 12-5.36 12-12 0-6.641-5.36-12-12-12zm0 20.801c-4.846.015-8.786-3.904-8.801-8.75V12c-.014-4.846 3.904-8.786 8.75-8.801H12c4.847-.014 8.786 3.904 8.801 8.75V12c.015 4.847-3.904 8.786-8.75 8.801H12zm5.44-11.76c0 1.359-1.12 2.479-2.481 2.479-1.366-.007-2.472-1.113-2.479-2.479 0-1.361 1.12-2.481 2.479-2.481 1.361 0 2.481 1.12 2.481 2.481zm0 5.919c0 1.36-1.12 2.48-2.481 2.48-1.367-.008-2.473-1.114-2.479-2.48 0-1.359 1.12-2.479 2.479-2.479 1.361-.001 2.481 1.12 2.481 2.479zm-5.919 0c0 1.36-1.12 2.48-2.479 2.48-1.368-.007-2.475-1.113-2.481-2.48 0-1.359 1.12-2.479 2.481-2.479 1.358-.001 2.479 1.12 2.479 2.479zm0-5.919c0 1.359-1.12 2.479-2.479 2.479-1.367-.007-2.475-1.112-2.481-2.479 0-1.361 1.12-2.481 2.481-2.481 1.358 0 2.479 1.12 2.479 2.481z"},sendgrid:{title:"SendGrid",fill:"#51A9E3",d:"M.8 24h13.6c.88 0 1.6-.72 1.6-1.6v-4.8c0-.88-.72-1.6-1.6-1.6H9.6c-.88 0-1.6-.72-1.6-1.6V9.6C8 8.72 7.28 8 6.4 8H1.6C.72 8 0 8.72 0 9.6v13.6c0 .44.36.8.8.8zM23.2 0H9.6C8.72 0 8 .72 8 1.6v4.8C8 7.28 8.72 8 9.6 8h4.8c.88 0 1.6.72 1.6 1.6v4.8c0 .88.72 1.6 1.6 1.6h4.8c.88 0 1.6-.72 1.6-1.6V.8c0-.44-.36-.8-.8-.8Z"},mailgun:{title:"Mailgun",fill:"#F06B66",d:"M11.837 0c6.602 0 11.984 5.381 11.984 11.994-.017 2.99-3.264 4.84-5.844 3.331a3.805 3.805 0 0 1-.06-.035l-.055-.033-.022.055c-2.554 4.63-9.162 4.758-11.894.232-2.732-4.527.46-10.313 5.746-10.416a6.868 6.868 0 0 1 7.002 6.866 1.265 1.265 0 0 0 2.52 0c0-5.18-4.197-9.38-9.377-9.387C4.611 2.594.081 10.41 3.683 16.673c3.238 5.632 11.08 6.351 15.289 1.402l1.997 1.686A11.95 11.95 0 0 1 11.837 24C2.6 23.72-2.87 13.543 1.992 5.684A12.006 12.006 0 0 1 11.837 0Zm0 7.745c-3.276-.163-5.5 3.281-4.003 6.2a4.26 4.26 0 0 0 4.014 2.31c3.276-.171 5.137-3.824 3.35-6.575a4.26 4.26 0 0 0-3.36-1.935Zm0 2.53c1.324 0 2.152 1.433 1.49 2.58a1.72 1.72 0 0 1-1.49.86 1.72 1.72 0 1 1 0-3.44Z"},notion:{title:"Notion",fill:"currentColor",d:"M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"},linear:{title:"Linear",fill:"#5E6AD2",d:"M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z"},jira:{title:"Jira",fill:"#0052CC",d:"M11.571 11.513H0a5.218 5.218 0 0 0 5.232 5.215h2.13v2.057A5.215 5.215 0 0 0 12.575 24V12.518a1.005 1.005 0 0 0-1.005-1.005zm5.723-5.756H5.736a5.215 5.215 0 0 0 5.215 5.214h2.129v2.058a5.218 5.218 0 0 0 5.215 5.214V6.758a1.001 1.001 0 0 0-1.001-1.001zM23.013 0H11.455a5.215 5.215 0 0 0 5.215 5.215h2.129v2.057A5.215 5.215 0 0 0 24 12.483V1.005A1.001 1.001 0 0 0 23.013 0Z"},hubspot:{title:"HubSpot",fill:"#FF7A59",d:"M18.164 7.93V5.084a2.198 2.198 0 001.267-1.978v-.067A2.2 2.2 0 0017.238.845h-.067a2.2 2.2 0 00-2.193 2.193v.067a2.196 2.196 0 001.252 1.973l.013.006v2.852a6.22 6.22 0 00-2.969 1.31l.012-.01-7.828-6.095A2.497 2.497 0 104.3 4.656l-.012.006 7.697 5.991a6.176 6.176 0 00-1.038 3.446c0 1.343.425 2.588 1.147 3.607l-.013-.02-2.342 2.343a1.968 1.968 0 00-.58-.095h-.002a2.033 2.033 0 102.033 2.033 1.978 1.978 0 00-.1-.595l.005.014 2.317-2.317a6.247 6.247 0 104.782-11.134l-.036-.005zm-.964 9.378a3.206 3.206 0 113.215-3.207v.002a3.206 3.206 0 01-3.207 3.207z"},paypal:{title:"PayPal",fill:"#003087",d:"M7.016 19.198h-4.2a.562.562 0 0 1-.555-.65L5.093.584A.692.692 0 0 1 5.776 0h7.222c3.417 0 5.904 2.488 5.846 5.5-.006.25-.027.5-.066.747A6.794 6.794 0 0 1 12.071 12H8.743a.69.69 0 0 0-.682.583l-.325 2.056-.013.083-.692 4.39-.015.087zM19.79 6.142c-.01.087-.01.175-.023.261a7.76 7.76 0 0 1-7.695 6.598H9.007l-.283 1.795-.013.083-.692 4.39-.134.843-.014.088H6.86l-.497 3.15a.562.562 0 0 0 .555.65h3.612c.34 0 .63-.249.683-.585l.952-6.031a.692.692 0 0 1 .683-.584h2.126a6.793 6.793 0 0 0 6.707-5.752c.306-1.95-.466-3.744-1.89-4.906z"},shopify:{title:"Shopify",fill:"#7AB55C",d:"M15.337 23.979l7.216-1.561s-2.604-17.613-2.625-17.73c-.018-.116-.114-.192-.211-.192s-1.929-.136-1.929-.136-1.275-1.274-1.439-1.411c-.045-.037-.075-.057-.121-.074l-.914 21.104h.023zM11.71 11.305s-.81-.424-1.774-.424c-1.447 0-1.504.906-1.504 1.141 0 1.232 3.24 1.715 3.24 4.629 0 2.295-1.44 3.76-3.406 3.76-2.354 0-3.54-1.465-3.54-1.465l.646-2.086s1.245 1.066 2.28 1.066c.675 0 .975-.545.975-.932 0-1.619-2.654-1.694-2.654-4.359-.034-2.237 1.571-4.416 4.827-4.416 1.257 0 1.875.361 1.875.361l-.945 2.715-.02.01zM11.17.83c.136 0 .271.038.405.135-.984.465-2.064 1.639-2.508 3.992-.656.213-1.293.405-1.889.578C7.697 3.75 8.951.84 11.17.84V.83zm1.235 2.949v.135c-.754.232-1.583.484-2.394.736.466-1.777 1.333-2.645 2.085-2.971.193.501.309 1.176.309 2.1zm.539-2.234c.694.074 1.141.867 1.429 1.755-.349.114-.735.231-1.158.366v-.252c0-.752-.096-1.371-.271-1.871v.002zm2.992 1.289c-.02 0-.06.021-.078.021s-.289.075-.714.21c-.423-1.233-1.176-2.37-2.508-2.37h-.115C12.135.209 11.669 0 11.265 0 8.159 0 6.675 3.877 6.21 5.846c-1.194.365-2.063.636-2.16.674-.675.213-.694.232-.772.87-.075.462-1.83 14.063-1.83 14.063L15.009 24l.927-21.166z"},sentry:{title:"Sentry",fill:"#362D59",d:"M13.91 2.505c-.873-1.448-2.972-1.448-3.844 0L6.904 7.92a15.478 15.478 0 0 1 8.53 12.811h-2.221A13.301 13.301 0 0 0 5.784 9.814l-2.926 5.06a7.65 7.65 0 0 1 4.435 5.848H2.194a.365.365 0 0 1-.298-.534l1.413-2.402a5.16 5.16 0 0 0-1.614-.913L.296 19.275a2.182 2.182 0 0 0 .812 2.999 2.24 2.24 0 0 0 1.086.288h6.983a9.322 9.322 0 0 0-3.845-8.318l1.11-1.922a11.47 11.47 0 0 1 4.95 10.24h5.915a17.242 17.242 0 0 0-7.885-15.28l2.244-3.845a.37.37 0 0 1 .504-.13c.255.14 9.75 16.708 9.928 16.9a.365.365 0 0 1-.327.543h-2.287c.029.612.029 1.223 0 1.831h2.297a2.206 2.206 0 0 0 1.922-3.31z"},vercel:{title:"Vercel",fill:"currentColor",d:"M24 22.525H0l12-21.05 12 21.05z"},supabase:{title:"Supabase",fill:"#3FCF8E",d:"M11.9 1.036c-.015-.986-1.26-1.41-1.874-.637L.764 12.05C-.33 13.427.65 15.455 2.409 15.455h9.579l.113 7.51c.014.985 1.259 1.408 1.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z"},clerk:{title:"Clerk",fill:"#6C47FF",d:"m21.47 20.829-2.881-2.881a.572.572 0 0 0-.7-.084 6.854 6.854 0 0 1-7.081 0 .576.576 0 0 0-.7.084l-2.881 2.881a.576.576 0 0 0-.103.69.57.57 0 0 0 .166.186 12 12 0 0 0 14.113 0 .58.58 0 0 0 .239-.423.576.576 0 0 0-.172-.453Zm.002-17.668-2.88 2.88a.569.569 0 0 1-.701.084A6.857 6.857 0 0 0 8.724 8.08a6.862 6.862 0 0 0-1.222 3.692 6.86 6.86 0 0 0 .978 3.764.573.573 0 0 1-.083.699l-2.881 2.88a.567.567 0 0 1-.864-.063A11.993 11.993 0 0 1 6.771 2.7a11.99 11.99 0 0 1 14.637-.405.566.566 0 0 1 .232.418.57.57 0 0 1-.168.448Zm-7.118 12.261a3.427 3.427 0 1 0 0-6.854 3.427 3.427 0 0 0 0 6.854Z"},aws:{title:"Amazon Web Services",fill:"#232F3E",d:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 0 1-.287-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.214c.263 0 .534-.048.822-.144.287-.096.543-.271.758-.51.128-.152.224-.32.272-.512.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 5.55a1.398 1.398 0 0 1-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 0 1 .32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 0 1 .311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 0 1-.056.2l-1.923 6.17c-.048.16-.104.263-.168.311a.51.51 0 0 1-.303.08h-.687c-.151 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32l-1.238-5.148-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 0 1-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.559c-.144-.151-.416-.287-.807-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 0 1-.4-1.158c0-.335.073-.63.216-.886.144-.255.335-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.175 0 .359.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 0 1 .24.2.43.43 0 0 1 .071.263v.375c0 .168-.064.256-.184.256a.83.83 0 0 1-.303-.096 3.652 3.652 0 0 0-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.159.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926-.144.272-.336.511-.583.703-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167zM21.698 16.207c-2.626 1.94-6.442 2.969-9.722 2.969-4.598 0-8.74-1.7-11.87-4.526-.247-.223-.024-.527.272-.351 3.384 1.963 7.559 3.153 11.877 3.153 2.914 0 6.114-.607 9.06-1.852.439-.2.814.287.383.607zM22.792 14.961c-.336-.43-2.22-.207-3.074-.103-.255.032-.295-.192-.063-.36 1.5-1.053 3.967-.75 4.254-.399.287.36-.08 2.826-1.485 4.007-.215.184-.423.088-.327-.151.32-.79 1.03-2.57.695-2.994z"},figma:{title:"Figma",fill:"#F24E1E",d:"M15.852 8.981h-4.588V0h4.588c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.491-4.49 4.491zM12.735 7.51h3.117c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-3.117V7.51zm0 1.471H8.148c-2.476 0-4.49-2.014-4.49-4.49S5.672 0 8.148 0h4.588v8.981zm-4.587-7.51c-1.665 0-3.019 1.355-3.019 3.019s1.354 3.02 3.019 3.02h3.117V1.471H8.148zm4.587 15.019H8.148c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h4.588v8.98zM8.148 8.981c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h3.117V8.981H8.148zM8.172 24c-2.489 0-4.515-2.014-4.515-4.49s2.014-4.49 4.49-4.49h4.588v4.441c0 2.503-2.047 4.539-4.563 4.539zm-.024-7.51a3.023 3.023 0 0 0-3.019 3.019c0 1.665 1.365 3.019 3.044 3.019 1.705 0 3.093-1.376 3.093-3.068v-2.97H8.148zm7.704 0h-.098c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h.098c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.49-4.49 4.49zm-.097-7.509c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h.098c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-.098z"},airtable:{title:"Airtable",fill:"#18BFFF",d:"M11.992 1.966c-.434 0-.87.086-1.28.257L1.779 5.917c-.503.208-.49.908.012 1.116l8.982 3.558a3.266 3.266 0 0 0 2.454 0l8.982-3.558c.503-.196.503-.908.012-1.116l-8.957-3.694a3.255 3.255 0 0 0-1.272-.257zM23.4 8.056a.589.589 0 0 0-.222.045l-10.012 3.877a.612.612 0 0 0-.38.564v8.896a.6.6 0 0 0 .821.552L23.62 18.1a.583.583 0 0 0 .38-.551V8.653a.6.6 0 0 0-.6-.596zM.676 8.095a.644.644 0 0 0-.48.19C.086 8.396 0 8.53 0 8.69v8.355c0 .442.515.737.908.54l6.27-3.006.307-.147 2.969-1.436c.466-.22.43-.908-.061-1.092L.883 8.138a.57.57 0 0 0-.207-.044z"},intercom:{title:"Intercom",fill:"#6AFDEF",d:"M21 0H3C1.343 0 0 1.343 0 3v18c0 1.658 1.343 3 3 3h18c1.658 0 3-1.342 3-3V3c0-1.657-1.342-3-3-3zm-5.801 4.399c0-.44.36-.8.802-.8.44 0 .8.36.8.8v10.688c0 .442-.36.801-.8.801-.443 0-.802-.359-.802-.801V4.399zM11.2 3.994c0-.44.357-.799.8-.799s.8.359.8.799v11.602c0 .44-.357.8-.8.8s-.8-.36-.8-.8V3.994zm-4 .405c0-.44.359-.8.799-.8.443 0 .802.36.802.8v10.688c0 .442-.36.801-.802.801-.44 0-.799-.359-.799-.801V4.399zM3.199 6c0-.442.36-.8.802-.8.44 0 .799.358.799.8v7.195c0 .441-.359.8-.799.8-.443 0-.802-.36-.802-.8V6zM20.52 18.202c-.123.105-3.086 2.593-8.52 2.593-5.433 0-8.397-2.486-8.521-2.593-.335-.288-.375-.792-.086-1.128.285-.334.79-.375 1.125-.09.047.041 2.693 2.211 7.481 2.211 4.848 0 7.456-2.186 7.479-2.207.334-.289.839-.25 1.128.086.289.336.25.84-.086 1.128zm.281-5.007c0 .441-.36.8-.801.8-.441 0-.801-.36-.801-.8V6c0-.442.361-.8.801-.8.441 0 .801.357.801.8v7.195z"},posthog:{title:"PostHog",fill:"currentColor",d:"M9.854 14.5 5 9.647.854 5.5A.5.5 0 0 0 0 5.854V8.44a.5.5 0 0 0 .146.353L5 13.647l.147.146L9.854 18.5l.146.147v-.049c.065.03.134.049.207.049h2.586a.5.5 0 0 0 .353-.854L9.854 14.5zm0-5-4-4a.487.487 0 0 0-.409-.144.515.515 0 0 0-.356.21.493.493 0 0 0-.089.288V8.44a.5.5 0 0 0 .147.353l9 9a.5.5 0 0 0 .853-.354v-2.585a.5.5 0 0 0-.146-.354l-5-5zm1-4a.5.5 0 0 0-.854.354V8.44a.5.5 0 0 0 .147.353l4 4a.5.5 0 0 0 .853-.354V9.854a.5.5 0 0 0-.146-.354l-4-4zm12.647 11.515a3.863 3.863 0 0 1-2.232-1.1l-4.708-4.707a.5.5 0 0 0-.854.354v6.585a.5.5 0 0 0 .5.5H23.5a.5.5 0 0 0 .5-.5v-.6c0-.276-.225-.497-.499-.532zm-5.394.032a.8.8 0 1 1 0-1.6.8.8 0 0 1 0 1.6zM.854 15.5a.5.5 0 0 0-.854.354v2.293a.5.5 0 0 0 .5.5h2.293c.222 0 .39-.135.462-.309a.493.493 0 0 0-.109-.545L.854 15.501zM5 14.647.854 10.5a.5.5 0 0 0-.854.353v2.586a.5.5 0 0 0 .146.353L4.854 18.5l.146.147h2.793a.5.5 0 0 0 .353-.854L5 14.647z"},datadog:{title:"Datadog",fill:"#632CA6",d:"M19.57 17.04l-1.997-1.316-1.665 2.782-1.937-.567-1.706 2.604.087.82 9.274-1.71-.538-5.794zm-8.649-2.498l1.488-.204c.241.108.409.15.697.223.45.117.97.23 1.741-.16.18-.088.553-.43.704-.625l6.096-1.106.622 7.527-10.444 1.882zm11.325-2.712l-.602.115L20.488 0 .789 2.285l2.427 19.693 2.306-.334c-.184-.263-.471-.581-.96-.989-.68-.564-.44-1.522-.039-2.127.53-1.022 3.26-2.322 3.106-3.956-.056-.594-.15-1.368-.702-1.898-.02.22.017.432.017.432s-.227-.289-.34-.683c-.112-.15-.2-.199-.319-.4-.085.233-.073.503-.073.503s-.186-.437-.216-.807c-.11.166-.137.48-.137.48s-.241-.69-.186-1.062c-.11-.323-.436-.965-.343-2.424.6.421 1.924.321 2.44-.439.171-.251.288-.939-.086-2.293-.24-.868-.835-2.16-1.066-2.651l-.028.02c.122.395.374 1.223.47 1.625.293 1.218.372 1.642.234 2.204-.116.488-.397.808-1.107 1.165-.71.358-1.653-.514-1.713-.562-.69-.55-1.224-1.447-1.284-1.883-.062-.477.275-.763.445-1.153-.243.07-.514.192-.514.192s.323-.334.722-.624c.165-.109.262-.178.436-.323a9.762 9.762 0 0 0-.456.003s.42-.227.855-.392c-.318-.014-.623-.003-.623-.003s.937-.419 1.678-.727c.509-.208 1.006-.147 1.286.257.367.53.752.817 1.569.996.501-.223.653-.337 1.284-.509.554-.61.99-.688.99-.688s-.216.198-.274.51c.314-.249.66-.455.66-.455s-.134.164-.259.426l.03.043c.366-.22.797-.394.797-.394s-.123.156-.268.358c.277-.002.838.012 1.056.037 1.285.028 1.552-1.374 2.045-1.55.618-.22.894-.353 1.947.68.903.888 1.609 2.477 1.259 2.833-.294.295-.874-.115-1.516-.916a3.466 3.466 0 0 1-.716-1.562 1.533 1.533 0 0 0-.497-.85s.23.51.23.96c0 .246.03 1.165.424 1.68-.039.076-.057.374-.1.43-.458-.554-1.443-.95-1.604-1.067.544.445 1.793 1.468 2.273 2.449.453.927.186 1.777.416 1.997.065.063.976 1.197 1.15 1.767.306.994.019 2.038-.381 2.685l-1.117.174c-.163-.045-.273-.068-.42-.153.08-.143.241-.5.243-.572l-.063-.111c-.348.492-.93.97-1.414 1.245-.633.359-1.363.304-1.838.156-1.348-.415-2.623-1.327-2.93-1.566 0 0-.01.191.048.234.34.383 1.119 1.077 1.872 1.56l-1.605.177.759 5.908c-.337.048-.39.071-.757.124-.325-1.147-.946-1.895-1.624-2.332-.599-.384-1.424-.47-2.214-.314l-.05.059a2.851 2.851 0 0 1 1.863.444c.654.413 1.181 1.481 1.375 2.124.248.822.42 1.7-.248 2.632-.476.662-1.864 1.028-2.986.237.3.481.705.876 1.25.95.809.11 1.577-.03 2.106-.574.452-.464.69-1.434.628-2.456l.714-.104.258 1.834 11.827-1.424zM15.05 6.848c-.034.075-.085.125-.007.37l.004.014.013.032.032.073c.14.287.295.558.552.696.067-.011.136-.019.207-.023.242-.01.395.028.492.08.009-.048.01-.119.005-.222-.018-.364.072-.982-.626-1.308-.264-.122-.634-.084-.757.068a.302.302 0 0 1 .058.013c.186.066.06.13.027.207m1.958 3.392c-.092-.05-.52-.03-.821.005-.574.068-1.193.267-1.328.372-.247.191-.135.523.047.66.511.382.96.638 1.432.575.29-.038.546-.497.728-.914.124-.288.124-.598-.058-.698m-5.077-2.942c.162-.154-.805-.355-1.556.156-.554.378-.571 1.187-.041 1.646.053.046.096.078.137.104a4.77 4.77 0 0 1 1.396-.412c.113-.125.243-.345.21-.745-.044-.542-.455-.456-.146-.749"},algolia:{title:"Algolia",fill:"#003DFF",d:"M12 0C5.445 0 .103 5.285.01 11.817c-.097 6.634 5.285 12.131 11.92 12.17a11.91 11.91 0 0 0 5.775-1.443.281.281 0 0 0 .052-.457l-1.122-.994a.79.79 0 0 0-.833-.14 9.693 9.693 0 0 1-3.923.77c-5.36-.067-9.692-4.527-9.607-9.888.084-5.293 4.417-9.573 9.73-9.573h9.73v17.296l-5.522-4.907a.407.407 0 0 0-.596.063 4.52 4.52 0 0 1-3.934 1.793 4.538 4.538 0 0 1-4.192-4.168 4.53 4.53 0 0 1 4.512-4.872 4.532 4.532 0 0 1 4.509 4.126c.018.205.11.397.265.533l1.438 1.275a.28.28 0 0 0 .462-.158 6.82 6.82 0 0 0 .099-1.725c-.232-3.376-2.966-6.092-6.345-6.3-3.873-.24-7.11 2.79-7.214 6.588-.1 3.7 2.933 6.892 6.634 6.974a6.75 6.75 0 0 0 4.136-1.294l7.212 6.394a.48.48 0 0 0 .797-.36V.456A.456.456 0 0 0 23.54 0Z"},cloudflare:{title:"Cloudflare",fill:"#F38020",d:"M16.5088 16.8447c.1475-.5068.0908-.9707-.1553-1.3154-.2246-.3164-.6045-.499-1.0615-.5205l-8.6592-.1123a.1559.1559 0 0 1-.1333-.0713c-.0283-.042-.0351-.0986-.021-.1553.0278-.084.1123-.1484.2036-.1562l8.7359-.1123c1.0351-.0489 2.1601-.8868 2.5537-1.9136l.499-1.3013c.0215-.0561.0293-.1128.0147-.168-.5625-2.5463-2.835-4.4453-5.5499-4.4453-2.5039 0-4.6284 1.6177-5.3876 3.8614-.4927-.3658-1.1187-.5625-1.794-.499-1.2026.119-2.1665 1.083-2.2861 2.2856-.0283.31-.0069.6128.0635.894C1.5683 13.171 0 14.7754 0 16.752c0 .1748.0142.3515.0352.5273.0141.083.0844.1475.1689.1475h15.9814c.0909 0 .1758-.0645.2032-.1553l.12-.4268zm2.7568-5.5634c-.0771 0-.1611 0-.2383.0112-.0566 0-.1054.0415-.127.0976l-.3378 1.1744c-.1475.5068-.0918.9707.1543 1.3164.2256.3164.6055.498 1.0625.5195l1.8437.1133c.0557 0 .1055.0263.1329.0703.0283.043.0351.1074.0214.1562-.0283.084-.1132.1485-.204.1553l-1.921.1123c-1.041.0488-2.1582.8867-2.5527 1.914l-.1406.3585c-.0283.0713.0215.1416.0986.1416h6.5977c.0771 0 .1474-.0489.169-.126.1122-.4082.1757-.837.1757-1.2803 0-2.6025-2.125-4.727-4.7344-4.727"},upstash:{title:"Upstash",fill:"#00E9A3",d:"M13.8027 0C11.193 0 8.583.9952 6.5918 2.9863c-3.9823 3.9823-3.9823 10.4396 0 14.4219 1.9911 1.9911 5.2198 1.9911 7.211 0 1.991-1.9911 1.991-5.2198 0-7.211L12 12c.9956.9956.9956 2.6098 0 3.6055-.9956.9955-2.6099.9955-3.6055 0-2.9866-2.9868-2.9866-7.8297 0-10.8164 2.9868-2.9868 7.8297-2.9868 10.8164 0l1.8028-1.8028C19.0225.9952 16.4125 0 13.8027 0zM12 12c-.9956-.9956-.9956-2.6098 0-3.6055.9956-.9955 2.6098-.9955 3.6055 0 2.9867 2.9868 2.9867 7.8297 0 10.8164-2.9867 2.9868-7.8297 2.9868-10.8164 0l-1.8028 1.8028c3.9823 3.9822 10.4396 3.9822 14.4219 0 3.9823-3.9824 3.9823-10.4396 0-14.4219-.9956-.9956-2.3006-1.4922-3.6055-1.4922-1.3048 0-2.6099.4966-3.6054 1.4922-1.9912 1.9912-1.9912 5.2198 0 7.211z"},mixpanel:{title:"Mixpanel",fill:"#7856FF",d:"M6.967 9.996h3.053c-.763-.477-1.048-1.145-1.431-2.384L7.443 3.366C6.919 1.458 6.49.551 4.39.551H.004v1.145h.621c1.286 0 1.431.477 1.814 1.908L3.44 7.326c.524 1.814 1.337 2.67 3.53 2.67h-.003Zm7.06 0h3.053c2.194 0 2.956-.86 3.484-2.67l1.001-3.722c.382-1.431.57-1.908 1.814-1.908H24V.551h-4.34c-2.146 0-2.576.86-3.053 2.815l-1.145 4.246c-.384 1.286-.673 1.907-1.435 2.384Zm-4.007 4.008h4.007V9.996H10.02v4.008ZM0 23.449h4.39c2.1 0 2.529-.907 3.053-2.815l1.146-4.246c.383-1.239.668-1.907 1.431-2.384H6.967c-2.194 0-3.007.86-3.531 2.67l-1.001 3.722c-.383 1.431-.524 1.907-1.814 1.907H0v1.146Zm19.65 0h4.343v-1.146h-.622c-1.239 0-1.431-.476-1.814-1.907l-1.001-3.722c-.524-1.814-1.286-2.67-3.483-2.67h-3.046c.762.477 1.041 1.098 1.424 2.384l1.145 4.246c.477 1.955.907 2.815 3.054 2.815Z"},gemini:{title:"Google Gemini",fill:"#8E75B2",d:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"}};var A1=J0(n5(),1),CZ="https://brand.volter.ai/logo/twin-world/svg?size=64&variant=mono";function e5({href:_,onClick:Q}){return A1.jsxDEV("h1",{children:A1.jsxDEV("a",{href:_,onClick:Q,children:[A1.jsxDEV("img",{src:CZ,alt:"",width:24,height:24,style:{verticalAlign:"middle"}},void 0,!1,void 0,this),A1.jsxDEV("span",{className:"brand-name",children:" Volter World"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}async function _2(_){return(await _.json().catch(()=>({}))).error??`answered ${_.status}`}function d_(_,Q,J=0,q=""){let[U,G]=Q0.useState({state:"loading"});return Q0.useEffect(()=>{G({state:"loading"})},[q,Q]),Q0.useEffect(()=>{if(!Q)return;let Z=!0;return(async()=>{try{let F=await _(Q),X=F.ok?{state:"ok",data:await F.json()}:{state:"error",status:F.status,error:await _2(F)};if(Z)G(X)}catch(F){if(Z)G({state:"error",status:0,error:String(F)})}})(),()=>{Z=!1}},[q,Q,J]),U}function Z0({load:_,what:Q,retry:J,lines:q=3}){if(_.state==="loading")return A1.jsxDEV(SZ,{lines:q,label:`Loading ${Q}…`},void 0,!1,void 0,this);if(_.state==="error")return A1.jsxDEV("div",{role:"alert",className:"error-state",children:[A1.jsxDEV("span",{children:["Could not read ",Q,": ",_.error]},void 0,!0,void 0,this),J?A1.jsxDEV("button",{type:"button",onClick:J,children:"Try again"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);return null}function SZ({lines:_=3,label:Q="Loading…"}){return A1.jsxDEV("div",{className:"skeleton",role:"status","aria-label":Q,children:Array.from({length:_},(J,q)=>A1.jsxDEV("span",{style:{width:`${[92,76,84,64,88][q%5]}%`}},q,!1,void 0,this))},void 0,!1,void 0,this)}function D1({iso:_,time:Q}){if(!_)return A1.jsxDEV("span",{children:"—"},void 0,!1,void 0,this);let J=new Date(_);return A1.jsxDEV("time",{dateTime:_,title:_,children:Number.isNaN(J.getTime())?_:Q?J.toLocaleTimeString():J.toLocaleString()},void 0,!1,void 0,this)}var D2=(_)=>_?new Date(_).toLocaleString():"—";function N8(_){let Q=_?Date.parse(_):Number.NaN;if(Number.isNaN(Q))return"—";let J=Math.max(0,Math.round((Date.now()-Q)/1000));return J<60?"just now":J<3600?`${Math.round(J/60)}m ago`:J<86400?`${Math.round(J/3600)}h ago`:`${Math.round(J/86400)}d ago`}function c1(_,Q){let J=Q.replace(/[_-]+/g," "),q=J.endsWith("s")?J:/[^aeiou]y$/.test(J)?`${J.slice(0,-1)}ies`:/(ch|sh|x)$/.test(J)?`${J}es`:`${J}s`;return`${_} ${_===1?J:q}`}var b2=(_)=>_.length<=1?_.join(""):`${_.slice(0,-1).join(", ")} and ${_[_.length-1]}`,yZ={github:"GitHub",openai:"OpenAI",aws:"AWS",hubspot:"HubSpot",paypal:"PayPal",youtube:"YouTube",tiktok:"TikTok",linkedin:"LinkedIn",xai:"xAI",sendgrid:"SendGrid",elevenlabs:"ElevenLabs",assemblyai:"AssemblyAI",planetscale:"PlanetScale",googleoauth:"Google sign-in",npm:"npm","npm-registry":"npm registry",posthog:"PostHog",mongodb:"MongoDB",pagerduty:"PagerDuty",mailgun:"Mailgun",turbopuffer:"turbopuffer"},M1=(_)=>yZ[_]??_.charAt(0).toUpperCase()+_.slice(1);function a1({vendor:_}){let Q=r_[_];return A1.jsxDEV("span",{className:Q?"mark logo":"mark","aria-hidden":"true",children:Q?A1.jsxDEV("svg",{viewBox:"0 0 24 24",children:A1.jsxDEV("path",{d:Q.d,fill:Q.fill},void 0,!1,void 0,this)},void 0,!1,void 0,this):M1(_).charAt(0)},void 0,!1,void 0,this)}var i_=(_)=>{_.currentTarget.closest("details")?.removeAttribute("open")},kZ="volter.theme",w8=()=>{try{let _=localStorage.getItem(kZ);return _==="light"||_==="dark"?_:"system"}catch{return"system"}};function a_(_=w8()){let Q=document.documentElement;if(_==="system")Q.removeAttribute("data-theme");else Q.setAttribute("data-theme",_)}function s_(){return Q0.useEffect(()=>{let _=()=>[...document.querySelectorAll("details.menu[open], details.clock-more[open]")],Q=(q)=>{if(q.key!=="Escape"||document.querySelector("dialog[open]"))return;let U=_();if(!U.length)return;for(let G of U)G.removeAttribute("open");U[U.length-1].querySelector("summary")?.focus()},J=(q)=>{let U=q.target;for(let G of _())if(!U||!G.contains(U))G.removeAttribute("open")};return document.addEventListener("keydown",Q),document.addEventListener("click",J),()=>{document.removeEventListener("keydown",Q),document.removeEventListener("click",J)}},[]),null}function O0({open:_,onClose:Q,title:J,children:q,footer:U,wide:G}){let Z=Q0.useRef(null),F=Q0.useId();return Q0.useEffect(()=>{let X=Z.current;if(!X)return;if(_&&!X.open){X.showModal();let Y=X.querySelector(".dialog-body :is(input:not([type=hidden]):not([disabled]), select, textarea)");if(Y?.focus(),Y instanceof HTMLInputElement&&Y.value&&/^(text|search|email|url)$/.test(Y.type))Y.select()}if(!_&&X.open)X.close()},[_]),A1.jsxDEV("dialog",{ref:Z,className:G==="window"?"dialog window":G?"dialog wide":"dialog","aria-labelledby":F,onClose:Q,onCancel:(X)=>{X.preventDefault(),Q()},onMouseDown:(X)=>{if(X.target===Z.current)Q()},children:_?A1.jsxDEV(A1.Fragment,{children:[A1.jsxDEV("div",{className:"dialog-head",children:[A1.jsxDEV("h2",{id:F,children:J},void 0,!1,void 0,this),A1.jsxDEV("button",{type:"button",className:"icon-button","aria-label":"Close",onClick:Q,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("div",{className:"dialog-body",children:q},void 0,!1,void 0,this),U?A1.jsxDEV("div",{className:"dialog-foot",children:U},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null},void 0,!1,void 0,this)}var I8="volter:confirm";function c0(_){return new Promise((Q)=>{window.dispatchEvent(new CustomEvent(I8,{detail:{ask:_,resolve:Q}}))})}function t_(){let[_,Q]=Q0.useState(null),[J,q]=Q0.useState("");Q0.useEffect(()=>{let F=(X)=>{q(""),Q(X.detail)};return window.addEventListener(I8,F),()=>window.removeEventListener(I8,F)},[]);let U=(F)=>{_?.resolve(F),Q(null)},G=_?.ask,Z=!G?.typed||J===G.typed;return A1.jsxDEV(O0,{open:Boolean(_),onClose:()=>U(!1),title:G?.title??"",footer:A1.jsxDEV(A1.Fragment,{children:[A1.jsxDEV("button",{type:"button",onClick:()=>U(!1),children:"Cancel"},void 0,!1,void 0,this),A1.jsxDEV("button",{type:"button",className:G?.danger?"danger-button":"primary",disabled:!Z,onClick:()=>U(!0),children:G?.action},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:[G?.body?A1.jsxDEV("div",{className:"confirm-body",children:G.body},void 0,!1,void 0,this):null,G?.typed?A1.jsxDEV("div",{className:"typed-confirm",children:[A1.jsxDEV("p",{children:["Type ",A1.jsxDEV("code",{children:G.typed},void 0,!1,void 0,this)," to confirm."]},void 0,!0,void 0,this),A1.jsxDEV("input",{autoFocus:!0,"aria-label":`Type ${G.typed} to confirm`,value:J,onChange:(F)=>q(F.target.value),onKeyDown:(F)=>{if(F.key==="Enter"&&Z)U(!0)},autoComplete:"off",spellCheck:!1},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}var P8="volter:toast";function p1(_,Q="ok"){window.dispatchEvent(new CustomEvent(P8,{detail:{text:_,kind:Q}}))}function o_(){let[_,Q]=Q0.useState([]);return Q0.useEffect(()=>{let J=0,q=(U)=>{let{text:G,kind:Z}=U.detail,F=++J;if(Q((X)=>[...X.slice(-3),{id:F,text:G,kind:Z}]),Z!=="error")setTimeout(()=>Q((X)=>X.filter((Y)=>Y.id!==F)),4500)};return window.addEventListener(P8,q),()=>window.removeEventListener(P8,q)},[]),A1.jsxDEV("div",{className:"toasts",role:"region","aria-label":"Notifications",children:_.map((J)=>A1.jsxDEV("div",{className:`toast ${J.kind}`,role:J.kind==="error"?"alert":"status",children:[A1.jsxDEV("span",{children:J.text},void 0,!1,void 0,this),A1.jsxDEV("button",{type:"button",className:"icon-button","aria-label":"Dismiss",onClick:()=>Q((q)=>q.filter((U)=>U.id!==J.id)),children:"✕"},void 0,!1,void 0,this)]},J.id,!0,void 0,this))},void 0,!1,void 0,this)}function f8({value:_,label:Q,secret:J}){let[q,U]=Q0.useState(!1);return A1.jsxDEV("div",{className:"copy-field",children:[Q?A1.jsxDEV("span",{className:"copy-label",children:Q},void 0,!1,void 0,this):null,A1.jsxDEV("div",{className:"copy-row",children:[A1.jsxDEV("input",{readOnly:!0,value:_,"aria-label":Q??"Value",onFocus:(Z)=>Z.currentTarget.select(),spellCheck:!1},void 0,!1,void 0,this),A1.jsxDEV("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(_).then(()=>{U(!0),setTimeout(()=>U(!1),1600),p1(J?"Copied. Keep it somewhere safe":"Copied")}).catch(()=>p1("Your browser would not copy it: select it and copy","error"))},children:q?"Copied":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function n_({label:_,items:Q}){return A1.jsxDEV("details",{className:"menu row-menu",children:[A1.jsxDEV("summary",{className:"icon-button",role:"button","aria-haspopup":"menu","aria-label":_,title:_,children:"⋯"},void 0,!1,void 0,this),A1.jsxDEV("div",{className:"popover menu-list",role:"menu",children:Q.filter((J)=>Boolean(J)).map((J)=>J.href?A1.jsxDEV("a",{role:"menuitem",href:J.href,className:J.danger?"danger-item":void 0,onClick:i_,children:J.label},J.label,!1,void 0,this):A1.jsxDEV("button",{type:"button",role:"menuitem",disabled:J.disabled,className:J.danger?"danger-item":void 0,onClick:(q)=>{i_(q),J.onSelect?.()},children:J.label},J.label,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function H5({title:_,children:Q,action:J}){return A1.jsxDEV("div",{className:"empty-state",children:[A1.jsxDEV("p",{className:"empty-title",children:_},void 0,!1,void 0,this),Q?A1.jsxDEV("div",{className:"empty-body",children:Q},void 0,!1,void 0,this):null,J?A1.jsxDEV("div",{className:"empty-action",children:J},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function e_(){return Q0.useEffect(()=>{let _=(J)=>{let q=document.querySelector("main.app"),U=J.target;if(q?.hasAttribute("data-drawer")&&U&&!U.closest(".side")&&!U.closest(".drawer-button"))q.removeAttribute("data-drawer")},Q=(J)=>{if(J.key==="Escape")jZ()};return document.addEventListener("click",_),document.addEventListener("keydown",Q),()=>{document.removeEventListener("click",_),document.removeEventListener("keydown",Q)}},[]),A1.jsxDEV("button",{type:"button",className:"icon-button drawer-button","aria-label":"Menu",onClick:()=>{document.querySelector("main.app")?.toggleAttribute("data-drawer")},children:"☰"},void 0,!1,void 0,this)}var jZ=()=>{document.querySelector("main.app")?.removeAttribute("data-drawer")};function J3(_={}){let Q=(q,U)=>_.tools?`${U} (\`${q}\`)`:`\`${q}\``,J=["Set up Volter World for this app, so its calls to Stripe, Slack, GitHub, OpenAI and the other services it uses go to local twins instead of the real APIs. The app keeps its real SDKs and code.","",_.tools?"1. You have the Volter World tools (volter mcp). If the `volter` command is missing, install it: `npm install -g @volter/world`.":"1. Install the command and your agent tooling: `npm install -g @volter/world`, then `volter agents install --yes`.",`2. In the app's folder, ${Q("volter world init --install","world_init")}: it detects the vendors the app calls and installs their twins. Show me the vendors it detected and why, before keeping them.`,`3. ${_.tools?"Start it with world_up":"Start it: `volter world up`"}, then run the tests inside it: ${Q("volter world run -- <the test command>","world_run")}. Fix anything that fails because a call went to the real service.`,`4. Tell me what the app did at each vendor (${Q("volter world log","world_log")}), and give me the dashboard link (${_.tools?"world_view":"`volter world view --no-open`, started in the background: it keeps running"}).`];if(_.platform){let q=_.world??"<org>/<world>";J.push(`5. Share it with my team on ${_.platform}: ${Q(`volter login ${_.platform}`,"platform_login")} gives a link and a code for me to approve in my browser. Once I have, link it with ${Q(`volter remote add origin ${q} --create`,"remote_link with create: true")}${_.world?"":" (ask me for <org>/<world>)"}, then send what the app did: ${Q('volter world changeset -m "<what and why>"',"world_changeset")} and ${Q("volter world push","world_push")}.`)}return J.push("","The guide: https://world.volter.ai/docs/guides/use-with-a-coding-agent.md"),J.join(`
|
|
35
|
+
`)}var _Q={"git-commit-horizontal":[["rect",{x:"9",y:"9",width:"6",height:"6"}],["path",{d:"M3 12h6M15 12h6"}]],"arrow-down-to-line":[["path",{d:"M12 17V3"}],["path",{d:"m6 11 6 6 6-6"}],["path",{d:"M19 21H5"}]],"arrow-up-from-line":[["path",{d:"m18 9-6-6-6 6"}],["path",{d:"M12 3v14"}],["path",{d:"M5 21h14"}]],"git-branch":[["rect",{x:"4",y:"3",width:"4",height:"4"}],["rect",{x:"4",y:"17",width:"4",height:"4"}],["rect",{x:"16",y:"5",width:"4",height:"4"}],["path",{d:"M6 7v10M18 9v2a4 4 0 0 1-4 4H6"}]],monitor:[["rect",{x:"3",y:"4",width:"18",height:"13"}],["path",{d:"M8 21h8M12 17v4"}]],vault:[["rect",{width:"18",height:"18",x:"3",y:"3"}],["rect",{x:"6.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m7.9 7.9 2.7 2.7"}],["rect",{x:"15.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m13.4 10.6 2.7-2.7"}],["rect",{x:"6.3",y:"15.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m7.9 16.1 2.7-2.7"}],["rect",{x:"15.3",y:"15.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["path",{d:"m13.4 13.4 2.7 2.7"}],["circle",{cx:"12",cy:"12",r:"2"}]],settings:[["circle",{cx:"12",cy:"12",r:"3"}],["circle",{cx:"12",cy:"12",r:"7"}],["path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9L7 7M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1"}]],history:[["path",{d:"M3 12a9 9 0 1 0 3-6.7"}],["path",{d:"M3 4v5h5"}],["path",{d:"M12 7v5l3 3"}]],activity:[["path",{d:"M2 12h4l3-8 6 16 3-8h4"}]],"file-diff":[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M9 10h6"}],["path",{d:"M12 13V7"}],["path",{d:"M9 17h6"}]],"square-plus":[["rect",{x:"4",y:"4",width:"16",height:"16"}],["path",{d:"M12 8v8M8 12h8"}]],"square-minus":[["rect",{width:"18",height:"18",x:"3",y:"3"}],["path",{d:"M8 12h8"}]],"square-dot":[["rect",{width:"18",height:"18",x:"3",y:"3"}],["rect",{x:"10.8",y:"10.8",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],cloud:[["path",{d:"M7 19a5 5 0 0 1-.5-10A6 6 0 0 1 18 8a4.5 4.5 0 0 1 .5 11z"}]],"refresh-cw":[["path",{d:"M20 12a8 8 0 0 1-14.3 4.9M4 12a8 8 0 0 1 14.3-4.9"}],["path",{d:"M19 3v5h-5M5 21v-5h5"}]],clock:[["circle",{cx:"12",cy:"12",r:"9"}],["path",{d:"M12 7v5l3 3"}]],"key-round":[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z"}],["rect",{x:"15.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],plug:[["path",{d:"M9 3v5M15 3v5M6 8h12v4a6 6 0 0 1-12 0zM12 18v3"}]],"list-checks":[["path",{d:"M11 6h9M11 12h9M11 18h9"}],["path",{d:"M3 6l1.5 1.5L7 5M3 12l1.5 1.5L7 11M3 18l1.5 1.5L7 17"}]],palette:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"}],["rect",{x:"12.3",y:"5.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"16.3",y:"9.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"5.3",y:"11.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}],["rect",{x:"7.3",y:"6.3",width:"2.4",height:"2.4",fill:"currentColor",stroke:"none"}]],check:[["path",{d:"M4 12l5 5L20 6"}]],plus:[["path",{d:"M12 4v16M4 12h16"}]],"chevron-down":[["path",{d:"M5 9l7 7 7-7"}]],"external-link":[["path",{d:"M14 4h6v6M20 4l-9 9"}],["path",{d:"M18 14v6H4V6h6"}]],"table-2":[["path",{d:"M3 9h18"}],["path",{d:"M9 3v18"}],["rect",{x:"3",y:"3",width:"18",height:"18"}]],"scroll-text":[["path",{d:"M15 12h-5"}],["path",{d:"M15 8h-5"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3"}]],"layout-grid":[["rect",{x:"4",y:"4",width:"7",height:"7"}],["rect",{x:"13",y:"4",width:"7",height:"7"}],["rect",{x:"4",y:"13",width:"7",height:"7"}],["rect",{x:"13",y:"13",width:"7",height:"7"}]],globe:[["circle",{cx:"12",cy:"12",r:"9"}],["path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"}]],"arrow-left":[["path",{d:"M20 12H5M11 6l-6 6 6 6"}]],link:[["path",{d:"M9 15l6-6"}],["path",{d:"M11 6l2-2a4.2 4.2 0 0 1 6 6l-2 2M13 18l-2 2a4.2 4.2 0 0 1-6-6l2-2"}]],user:[["circle",{cx:"12",cy:"8",r:"4"}],["path",{d:"M4 21v-1a6 6 0 0 1 6-6h4a6 6 0 0 1 6 6v1"}]],"log-out":[["path",{d:"M10 4H4v16h6M9 12h11M16 8l4 4-4 4"}]]};var $=J0(n5(),1),q3="volter.console.token",J4=document.getElementById("root"),O1=J4.dataset.base??"/-/console",j1=window.location.origin,i0=(J4.dataset.worlds??j1).replace(/\/+$/,""),XQ=(J4.dataset.names??"").split(",").filter((_)=>_!==""),J2=J4.dataset.worldOrigin==="1",p2=window.fetch.bind(window),r0="(session)",KQ="(pass)",_4=(_)=>{try{if(_&&!J2)sessionStorage.setItem(q3,_);else sessionStorage.removeItem(q3);localStorage.removeItem(q3)}catch{}},YQ="volter.console.portal",LQ=(_)=>{try{if(typeof _==="string"&&/^https?:$/.test(new URL(_).protocol))sessionStorage.setItem(YQ,new URL(_).origin)}catch{}},vZ=()=>{return c2.get("token")??""},F0=()=>{try{let _=sessionStorage.getItem(YQ)??"";return _&&/^https?:$/.test(new URL(_).protocol)?new URL(_).origin:""}catch{return""}},VZ=()=>{let _=vZ();if(J2){if(_4(""),c2.get("pass"))return KQ;let Q=new URLSearchParams(window.location.search).has("signin");if(Q)try{window.history.replaceState(null,"",window.location.pathname+window.location.hash)}catch{}return _||(Q?"":r0)}if(_)return _4(_),_;try{return sessionStorage.getItem(q3)??""}catch{return""}};function o1(_){let Q=_.trim();if(/not ready/i.test(Q)&&/(never verified|not verified|no approvals)/i.test(Q)){let G=[],Z=[];if(/(never verified|not verified)/i.test(Q))G.push("it is not verified yet"),Z.push("verify");if(/no approvals/i.test(Q))G.push("no one has approved it"),Z.push("approve");return{text:`Not ready to deploy: ${b2(G)}.`,acts:Z}}let J=/no credential (?:is )?sealed for ([a-z0-9_-]+)/i.exec(Q);if(J)return{text:`No credential is sealed for ${M1(J[1])}: seal one in Settings › Vault.`,acts:["vault"]};if(/has no origin/i.test(Q))return{text:"This World has no remote: name one in Settings › Remote.",acts:["remote"]};let q=/the ([a-z0-9_-]+) twin has no root/i.exec(Q)??/:\s*([a-z0-9_, -]+?) (?:has|have) no root/i.exec(Q);if(q){let G=q[1].split(/,\s*/).filter(Boolean).map(M1);return{text:`${b2(G)} ${G.length===1?"is":"are"} not connected to ${G.length===1?"its":"their"} real service: Settings › Real services.`,acts:["settings"]}}if(/opening a seal is/i.test(Q))return{text:"A key cannot seal a credential: open the World as yourself.",acts:[]};if(/a key manages no keys/i.test(Q))return{text:"A key cannot manage keys: open the World as yourself.",acts:[]};if(/^PUT origin:/i.test(Q))return{text:"That is not a World's address: https://<host>/<org>/<world>",acts:[]};if(/^clock: \{/i.test(Q))return{text:"Pick a date and time.",acts:[]};if(/^advance: \{/i.test(Q))return{text:"Advance by a number and a unit: 90m, 12h, 3d.",acts:[]};if(/^branches: \{/i.test(Q))return{text:"That branch could not be made: pick now, or an instant before it.",acts:[]};if(/^approve: \{/i.test(Q))return{text:"Name who approves.",acts:[]};if(/a browser deploys only what it names/i.test(Q))return{text:"A deploy is confirmed by its name: use Deploy again.",acts:[]};if(/^no such door/i.test(Q))return{text:"This World does not answer that here.",acts:[]};return{text:Q.replace(/\s*[—–-]+\s*(?:run\s+)?`[^`]*`/g,"").replace(/\s*[—–-]+\s*(?:PUT|POST|GET|DELETE)\s+\/-\/\S+(?:\s*\{[^}]*\})?/g,"").replace(/\s*\(\s*`[^`]*`\s*\)/g,"").replace(/`(?:volter|printf|curl|npm|bun)[^`]*`/g,"").replace(/:\s*\{[^}]*\}/g,"").replace(/\(\s*\)/g,"").replace(/\s*;\s*(?=[;.]|$)/g,"").replace(/\s+([,.;:])/g,"$1").trim()||_,acts:[]}}var K0=async(_)=>o1(await _2(_)).text,uZ={vault:["vault","Open Vault"],remote:["remote","Open Remote"],settings:["settings/services","Open Real services"]};function zQ({name:_,acts:Q}){let J=Q.map((q)=>uZ[q]).filter((q)=>Boolean(q));if(J.length===0)return null;return $.jsxDEV($.Fragment,{children:J.map(([q,U])=>$.jsxDEV(p.default.Fragment,{children:[" ",$.jsxDEV("a",{href:`${O1}/${_}/~/${q}`,onClick:(G)=>{G.preventDefault(),h1([..._.split("/"),"~",...q.split("/")])},children:U},void 0,!1,void 0,this)]},q,!0,void 0,this))},void 0,!1,void 0,this)}async function y1(_,Q,J={}){return p2(`${j1}${Q}`,{...J,headers:{...J.headers??{},..._===r0?{}:{"x-volter-token":_},...J.body&&!J.headers?.["content-type"]?{"content-type":"application/json"}:{}}})}function V1(_,Q,J=0){let q=d_((U)=>y1(_,U),Q,J,_);return q.state==="error"?{...q,error:o1(q.error).text}:q}var Y5=(_)=>{let Q=new Date(_),J=(q)=>String(q).padStart(2,"0");return`${Q.getFullYear()}-${J(Q.getMonth()+1)}-${J(Q.getDate())}T${J(Q.getHours())}:${J(Q.getMinutes())}`},QQ=(_)=>new Date(Math.ceil(Date.parse(_)/60000)*60000).toISOString(),WQ=(_)=>_.operation==="observed"?`observed${_.provenance==="placeholder"?" (default data)":" (vendor)"}`:_.receipt?`${_.receipt.status??""} ${_.receipt.externalId??""} ${_.receipt.reason??""}`.trim():_.provenance==="placeholder"?"default data":"unpushed",hZ=(_)=>{let Q=/^[0-9a-f]{2}-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/.exec(_??"");return Q?{trace:Q[1],span:Q[2]}:null},j8="volter.console.snapshots",$2=()=>{try{return JSON.parse(sessionStorage.getItem(j8)??"{}")}catch{return{}}},BQ=new Map,v8=(_)=>{if(J2){if(_.token||_.readToken)BQ.set(_.name,{token:_.token,readToken:_.readToken});_={..._,token:"",readToken:""}}try{sessionStorage.setItem(j8,JSON.stringify({...$2(),[_.name]:_}))}catch{}},V8=(_)=>BQ.get(_)?.readToken||$2()[_]?.readToken||"",U3=(_)=>{try{let Q=$2();delete Q[_],sessionStorage.setItem(j8,JSON.stringify(Q))}catch{}},c2=new URLSearchParams(window.location.hash.slice(1)),X5=c2.get("close")??"";function $4(_){if(typeof _!=="string")return null;let Q;try{Q=new URL(_)}catch{return null}return(Q.protocol==="http:"||Q.protocol==="https:")&&Q.origin===_.replace(/\/+$/,"")?Q:null}function u8(_){let Q=$4(_);if(!Q)return null;let J=new URL(j1);if(Q.protocol!==J.protocol||Q.port!==J.port)return null;if(Q.hostname===J.hostname)return Q.origin;let q=/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./;if(!q.test(Q.hostname))return null;let U=Q.hostname.replace(q,"");return U===J.hostname||q.test(J.hostname)&&U===J.hostname.replace(q,"")?Q.origin:null}function DZ(_){let Q;try{Q=JSON.parse(_)}catch{return null}let J=/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/i;if(typeof Q.name!=="string"||!J.test(Q.name)||typeof Q.parent!=="string"||!J.test(Q.parent)||typeof Q.at!=="string")return null;let q=Q.parentOrigin===void 0?void 0:u8(Q.parentOrigin);return{name:Q.name,parent:Q.parent,token:typeof Q.token==="string"?Q.token:"",readToken:typeof Q.readToken==="string"?Q.readToken:"",at:Q.at,expiresAt:typeof Q.expiresAt==="string"?Q.expiresAt:null,...q?{parentOrigin:q}:{}}}{let _=c2.get("snapshot");if(_){let Q=DZ(_);if(Q&&!$2()[Q.name])v8(Q)}}var AQ="volter.console.home",MQ=(_)=>{let Q=$4(_);if(!Q)return null;let J=new URL(j1).hostname,q=J.replace(/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./,"");return Q.hostname===J||Q.hostname===q?Q.origin:null};{let _=MQ(c2.get("home"));if(_)try{sessionStorage.setItem(AQ,_)}catch{}}if(["token","pass","portal","snapshot","home","close"].some((_)=>c2.has(_)))try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}var u0=()=>{try{return MQ(sessionStorage.getItem(AQ))??""}catch{return""}};function h8(_,Q,J,q){let U=new URLSearchParams({token:Q,home:u0()||j1}),G=$2()[J];if(G)U.set("snapshot",JSON.stringify(G));window.location.replace(`${_}${q??`${window.location.pathname}${window.location.search}`}#${U.toString()}`)}var F3=J4.dataset.route==="memory"?"":null;function qM(_){F3=_,window.dispatchEvent(new PopStateEvent("popstate"))}function x2(){return(F3??window.location.pathname.slice(O1.length)).split("/").filter(Boolean).map((_)=>{try{return decodeURIComponent(_)}catch{return""}})}var JQ=/^[a-z0-9](?:[a-z0-9]|-(?!-))*$/i,Q2=(_,Q)=>_&&Q&&JQ.test(_)&&JQ.test(Q)?`${_}/${Q}`:"";function h1(_){let Q=`/${_.map(encodeURIComponent).join("/")}`;if(F3!==null)F3=Q;else window.history.pushState(null,"",`${O1}${Q}`);window.dispatchEvent(new PopStateEvent("popstate"))}function TQ(_,Q){let J=u8($2()[_]?.origin);if(J&&J!==j1){h8(J,V8(_),_,`${O1}/${Q.map(encodeURIComponent).join("/")}`);return}h1(Q)}async function $Q(){let[_,Q]=x2(),J=Q2(_,Q),q=J?[J]:XQ;if(q.length===0){let U=await p2(`${j1}/-/ping`).catch(()=>null);q=U?.ok?(await U.json().catch(()=>({}))).worlds??[]:[]}q=q.filter((U)=>{let[G,Z,...F]=U.split("/");return F.length===0&&Q2(G,Z)===U});for(let U of q){let G=await p2(`${j1}/-/${U}/session`,{method:"POST"}).catch(()=>null);if(!G)continue;let Z=await G.json().catch(()=>({})),F=$4(Z.origin)?.origin;if(G.status===409&&F&&F!==j1)return window.location.replace(`${F}${O1}/${U}`),"moved";if(G.ok&&Z.local)return{token:typeof Z.token==="string"&&Z.token?Z.token:r0}}return null}function bZ(){let[_,Q]=p.useState(w8),J=(q)=>()=>{try{if(q==="system")localStorage.removeItem("volter.theme");else localStorage.setItem("volter.theme",q)}catch{}a_(q),Q(q)};return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"menu-label",children:"Appearance"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"theme-choice",role:"radiogroup","aria-label":"Appearance",children:["system","light","dark"].map((q)=>$.jsxDEV("button",{type:"button",role:"radio","aria-checked":_===q,onClick:J(q),children:q==="system"?"System":q==="light"?"Light":"Dark"},q,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function EZ(){let[_,Q]=p.useState(VZ()),[J,q]=p.useState(!1),[U,G]=p.useState(!1),[Z,F]=p.useState(""),[X,Y]=p.useState(null),[K,H]=p.useState(null),[L,z]=p.useState(x2());p.useEffect(()=>{let m=()=>z(x2());return window.addEventListener("popstate",m),()=>window.removeEventListener("popstate",m)},[]),p.useEffect(()=>{let[m,h]=x2(),t=Q2(m,h),[Q1,s]=t?t.split("/"):[],o=$2()[X5];if(!X5||!_||!Q1||!s||!o?.made||o.parent!==`${Q1}/${s}`||Q2(...X5.split("/"))!==X5)return;try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}y1(_,`/-/${Q1}/${s}/branches/${X5}`,{method:"DELETE"}).catch(()=>null).then(()=>U3(X5))},[_]);let W=p.useCallback(async(m)=>{if(H(null),!m){let s=await $Q();if(s==="moved")return;if(s){if(q(!0),s.token!==r0)_4(s.token);Q(s.token);return}Y(null),G(!0);return}if(J2&&m===r0){let s=await $Q();if(s==="moved")return;if(s)q(!0)}if(J2&&m===KQ){let[s,o]=x2(),l=Q2(s,o),[e,J1]=l?l.split("/"):[],U1=e&&J1?await p2(`${j1}/-/${e}/${J1}/session`,{method:"POST",headers:{"x-volter-pass":c2.get("pass")??""}}).catch(()=>null):null;if(!U1){H(`${j1} did not answer: no session was opened`),Y(null);return}if(!U1.ok){H(`${await K0(U1)}. Open it again from the platform.`),Y(null);return}LQ((await U1.json().catch(()=>({}))).issuer),Q(r0);return}if(J2&&m!==r0){let[s,o]=x2(),l=Q2(s,o),[e,J1]=l?l.split("/"):[],U1=e&&J1?await p2(`${j1}/-/${e}/${J1}/session`,{method:"POST",headers:{"x-volter-token":m}}).catch(()=>null):null;if(!U1){H(`${j1} did not answer: no session was opened`),Y(null);return}if(!U1.ok){let F1=await K0(U1);H(U1.status===401||U1.status===403?`That token does not open ${e}/${J1}.`:U1.status===409?`${e}/${J1}'s session lives at another origin: ${F1}`:`The World could not open a session (${U1.status}): ${F1}`),Y(null);return}Q(r0);return}let h=J2?new Response(null,{status:404}):await y1(m,"/-/worlds");if(h.ok){let{worlds:s}=await h.json();Y({kind:"admin",worlds:s});return}if(h.status===429){H("You are asking faster than the platform allows — wait a moment and reload."),Y(null);return}if(h.status>=500){let s=await h.json().catch(()=>({}));H(`The platform could not list your worlds${s.error?`: ${s.error}`:""}. Reload; if it stays, the status page says what is wrong.`),Y(null);return}let t=XQ;if(t.length===0){let s=await p2(`${j1}/-/ping`);if(!s.ok){H(`${j1} does not answer as a host`),Y(null);return}if(t=(await s.json()).worlds??[],t.length===0){H(`${j1} does not list its Worlds: open a World at its own address, ${j1}${O1}/<org>/<world>`),Y(null);return}}let Q1=[];for(let s of t){let o=await y1(m,`/-/${s}/twins`);if(o.ok){let l=await o.json();Q1.push({name:s,base:`${i0}/${s}`,twins:(l.twins??[]).map((e)=>({vendor:e.twin,protocol:e.protocol??null,root:e.root??null}))})}}if(Q1.length===0){H("This link or key opens no World here: it was revoked, or it has ended."),Y(null);return}Y({kind:"world",worlds:Q1})},[]);p.useEffect(()=>{W(_)},[_,W]);let I=(m)=>X?.kind==="admin"?X.worlds.find((h)=>h.name===m)?.token??_:_,[M,B]=p.useState("");if(!_||!X&&!K)return $.jsxDEV("main",{className:"app gate",children:$.jsxDEV("div",{className:"gate-window",children:[$.jsxDEV(e5,{href:`${O1}/`},void 0,!1,void 0,this),_&&!X&&!K||!_&&!U?$.jsxDEV("p",{className:"mode",children:"Opening…"},void 0,!1,void 0,this):$.jsxDEV("form",{onSubmit:(m)=>{m.preventDefault(),_4(Z.trim()),Q(Z.trim())},className:"stack",children:[$.jsxDEV("h2",{children:"Open a World"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"A World's token opens that World. A host's admin token opens every World it serves."},void 0,!1,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Token"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"token",type:"password",value:Z,onChange:(m)=>F(m.target.value),autoFocus:!0,autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",children:"Open"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);let N=()=>H("This link or key opens no World here: it was revoked, or it has ended."),A=()=>{if(J){window.location.reload();return}if(J2){let[m,h]=x2(),t=Q2(m,h),[Q1,s]=t?t.split("/"):[],o=()=>window.location.replace(F0()?`${F0()}/`:`${j1}${O1}/${Q1&&s?`${Q1}/${s}`:""}?signin`);if(setTimeout(o,2000),Q1&&s)p2(`${j1}/-/${Q1}/${s}/session/end`,{method:"POST"}).catch(()=>null).then(o);else o();return}if(X)for(let m of X.worlds)navigator.sendBeacon(`${m.base.replace(/\/[^/]+\/[^/]+$/,"")}/-/${m.name}/session/end`);_4(""),Q(""),F(""),Y(null),h1([])};if(K||!X)return $.jsxDEV("main",{className:"app gate",children:$.jsxDEV("div",{className:"gate-window",children:[$.jsxDEV(e5,{href:`${O1}/`},void 0,!1,void 0,this),$.jsxDEV("h2",{children:"Could not open it"},void 0,!1,void 0,this),$.jsxDEV("p",{role:"alert",children:K??"nothing answered"},void 0,!1,void 0,this),F0()?$.jsxDEV("a",{className:"button primary",href:`${F0()}/`,children:["Back to ",new URL(F0()).host]},void 0,!0,void 0,this):$.jsxDEV("button",{type:"button",className:"primary",onClick:A,children:J?"Try again":"Use another token"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);let[R,O,C,f,S,w,k]=L,E=C==="~",r=/^[A-Za-z0-9_-]+$/,c=/^[^\u0000-\u001f\u007f]{1,200}$/,y=E||!C||!r.test(C)?void 0:C,b=S&&r.test(S)?w!==void 0&&f!=="changes"&&f!=="screens"?Q2(S,w)||void 0:S:void 0,v=f==="changes"&&S==="changesets"&&w&&r.test(w)?w:f==="screens"&&w&&k&&/^[A-Za-z0-9_.-]+$/.test(w)&&c.test(k)?`${w}:${k}`:void 0,x=Q2(R,O),V=x?$2()[x]??null:null,D=(m)=>V8(m)||I(m),P=V?X.kind==="admin"?X.worlds.find((m)=>m.name===V.parent)?.token??null:X.worlds.some((m)=>m.name===V.parent)?_:null:null,u=async(m)=>{let h=u8(m.parentOrigin);if(h&&h!==j1){U3(m.name),window.location.assign(`${h}${O1}/${m.parent}#close=${encodeURIComponent(m.name)}`);return}if(m.made)await y1(I(m.parent),`/-/${m.parent}/branches/${m.name}`,{method:"DELETE"}).catch(()=>null),U3(m.name);h1(m.parent.split("/"))};return $.jsxDEV("main",{className:x?"app workspace":"app home",children:[x?null:$.jsxDEV("header",{children:[x?$.jsxDEV(e_,{},void 0,!1,void 0,this):null,$.jsxDEV(e5,{href:`${u0()&&u0()!==j1?u0():""}${O1}/`,onClick:(m)=>{if(u0()&&u0()!==j1)return;m.preventDefault(),h1([])}},void 0,!1,void 0,this),$.jsxDEV("nav",{"aria-label":"breadcrumb",className:"crumbs",children:[x?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),$.jsxDEV("span",{children:x.split("/")[0]},void 0,!1,void 0,this),$.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${O1}/${x}`,className:"crumb-world",onClick:(m)=>{m.preventDefault(),h1(x.split("/"))},children:x.split("/")[1]},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,y?$.jsxDEV("span",{children:[" / ",y]},void 0,!0,void 0,this):null,E&&f==="trace"?$.jsxDEV("span",{children:" / trace"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),F0()?$.jsxDEV("a",{href:`${F0()}/${x?encodeURIComponent(x.split("/")[0]):""}`,title:`Back to the platform at ${new URL(F0()).host}`,className:"back-link",children:["← ",$.jsxDEV("span",{className:"back-text",children:x?`${x.split("/")[0]}'s Worlds`:new URL(F0()).host},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,x?null:$.jsxDEV("span",{className:"mode",children:J?"on this machine":M?`signed in as ${M}`:X.kind==="admin"?"host: admin":"opened with a link or key"},void 0,!1,void 0,this),x||J?null:$.jsxDEV("button",{onClick:A,children:"Sign out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x?$.jsxDEV(pZ,{name:x,token:D(x),twin:y,tab:E?f??"overview":"overview",arg:E?b:void 0,...E&&v?{sub:v}:{},admin:V?null:X.kind==="admin"?_:null,snapshot:V,parentToken:P,who:{local:J,person:M||null,admin:X.kind==="admin"},onSignOut:A,onReturn:u,opens:(m)=>!!$2()[m]||X.kind==="admin"&&X.worlds.some((h)=>h.name===m),onRemoved:()=>{W(_),h1([])},onWho:B,onEnded:N,worlds:X.worlds.map((m)=>m.name)},x,!1,void 0,this):$.jsxDEV(xZ,{mode:X,admin:X.kind==="admin"?_:null,reload:()=>W(_)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function xZ({mode:_,admin:Q,reload:J}){let[q,U]=p.useState(""),[G,Z]=p.useState(""),[F,X]=p.useState(""),[Y,K]=p.useState(null),H=async(f)=>{if(!await c0({title:`Rotate the tokens of ${f}?`,body:"Every app, script and person holding the current tokens loses access at once. The new ones are shown once.",action:"Rotate tokens",danger:!0}))return;let S=await y1(Q,`/-/worlds/${f}/rotate`,{method:"POST"}),w=await S.json().catch(()=>({}));K(S.ok?`rotated ${f}: the new tokens are shown once — token ${w.token} · read token ${w.readToken}`:w.error?o1(w.error).text:`answered ${S.status}`),await J()},L=async(f)=>{let S=await y1(Q,`/-/worlds/${f}`,{method:"DELETE"}),w=await S.json().catch(()=>({}));K(S.ok?`removed ${f}`:w.error?o1(w.error).text:`answered ${S.status}`),await J()},[z,W]=p.useState(!1),[I,M]=p.useState(!1),[B,N]=p.useState(""),A=async(f)=>{f.preventDefault(),K(null),W(!0);try{let S=await y1(Q,"/-/worlds",{method:"POST",body:JSON.stringify({org:q,world:G,vendors:F.split(",").map((k)=>k.trim()).filter(Boolean)})}),w=await S.json();if(!S.ok){K(w.error?o1(w.error).text:`the host answered ${S.status}`);return}K(`provisioned ${w.name}`),Z(""),X(""),M(!1),await J()}finally{W(!1)}},R=B.trim().toLowerCase(),O=_.worlds.filter((f)=>!R||f.name.toLowerCase().includes(R)||f.twins.some((S)=>S.vendor.includes(R))),C=[...new Set(O.map((f)=>f.name.split("/")[0]))];return $.jsxDEV("section",{className:"home-window","aria-labelledby":"worlds",children:[$.jsxDEV("div",{className:"home-head",children:[$.jsxDEV("h2",{id:"worlds",children:"Worlds"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:[c1(_.worlds.length,"World")," ",Q?"this host serves":"this key opens"]},void 0,!0,void 0,this),Q?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{K(null),M(!0)},children:[$.jsxDEV(C1,{name:"plus",size:16},void 0,!1,void 0,this),"New World"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"home-find",children:$.jsxDEV("input",{type:"search",placeholder:"Filter by World or vendor","aria-label":"Filter Worlds",value:B,onChange:(f)=>N(f.target.value)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y&&!I?$.jsxDEV("p",{role:"status",className:"home-note",children:Y},void 0,!1,void 0,this):null,C.map((f)=>$.jsxDEV(p.default.Fragment,{children:[$.jsxDEV("p",{className:"menu-label home-org",children:f},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"home-list",children:O.filter((S)=>S.name.split("/")[0]===f).map((S)=>$.jsxDEV("li",{children:[$.jsxDEV("a",{href:`${O1}/${S.name}`,onClick:(w)=>{w.preventDefault(),h1(S.name.split("/"))},children:[$.jsxDEV(C1,{name:"globe",size:20},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:S.name.split("/")[1]},void 0,!1,void 0,this),$.jsxDEV("small",{children:$.jsxDEV("code",{children:S.base},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"home-vendors",children:S.twins.map((w)=>$.jsxDEV("span",{title:M1(w.vendor),children:$.jsxDEV(a1,{vendor:w.vendor},void 0,!1,void 0,this)},w.vendor,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q?$.jsxDEV("details",{className:"menu home-more",children:[$.jsxDEV("summary",{"aria-label":`More for ${S.name}`,children:"⋯"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"popover menu-list",children:[$.jsxDEV("button",{type:"button",onClick:(w)=>{w.currentTarget.closest("details")?.removeAttribute("open"),H(S.name)},children:"Rotate tokens…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"danger-item",onClick:(w)=>{w.currentTarget.closest("details")?.removeAttribute("open"),c0({title:`Remove ${S.name}?`,body:"The host stops serving it and its whole history goes with it. This cannot be undone.",action:"Remove World",danger:!0,typed:S.name}).then((k)=>{if(k)L(S.name)})},children:"Remove World…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},S.name,!0,void 0,this))},void 0,!1,void 0,this)]},f,!0,void 0,this)),O.length===0?$.jsxDEV("p",{className:"mode home-note",children:R?`No World matches ${B}.`:"No Worlds here yet."},void 0,!1,void 0,this):null,$.jsxDEV(O0,{open:I,onClose:()=>{if(!z)M(!1)},title:"New World",footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>M(!1),disabled:z,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"provision",className:"primary",disabled:z,children:z?"Making… (ten seconds or so)":"Make World"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"provision",onSubmit:A,className:"stack",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Org"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"org",value:q,onChange:(f)=>U(f.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"World"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"world",value:G,onChange:(f)=>Z(f.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Vendors"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"vendors",value:F,onChange:(f)=>X(f.target.value),placeholder:"stripe, slack",required:!0},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"A twin of each, with its default data."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y?$.jsxDEV("p",{role:"status",children:Y},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var mZ=["changes","events","trace","vendors","screens","canvas","branches","settings","remote","vault"],gZ=(_,Q)=>{let J=Q?.screens?.find((q)=>q.path.replace(/\/+$/,"")==="")??Q?.screens?.find((q)=>!/[{<]/.test(q.path));return Q&&J?`${i0}/${_}/${Q.twin}${J.path.startsWith("/")?J.path:`/${J.path}`}`:null},qQ={verify:"verified",use:"used",issue:"issued",revoke:"revoked",rotate:"rotated",seed:"seeded",upsert:"saved",set:"set",start:"started",finish:"finished",fail:"failed",schedule:"scheduled",deliver:"delivered",like:"liked",follow:"followed",reply:"replied",create:"created",update:"updated",delete:"deleted",record:"recorded",remove:"removed",add:"added",send:"sent",post:"posted",postmessage:"posted",cancel:"canceled",close:"closed",open:"opened",publish:"published",upload:"uploaded",invite:"invited",archive:"archived",merge:"merged",refund:"refunded",capture:"captured",confirm:"confirmed",pay:"paid"};function C0(_){let Q=_.operation??_.op,J=(Q.includes(".")?Q.slice(Q.lastIndexOf(".")+1):Q).toLowerCase(),q=_.subject.type.replace(/[_-]+/g," ").trim(),U=`${q.charAt(0).toUpperCase()}${q.slice(1)}`,G=/(^|\.)twin\./.test(Q)||/^seed_/.test(J),Z=Q.replace(/[._]+/g," ").trim(),F=G?`${U} seeded`:qQ[J]?`${U} ${qQ[J]}`:`${Z.charAt(0).toUpperCase()}${Z.slice(1)}`,X=_.fields??{},Y=["title","name","email","text","subject","summary","description"].map((H)=>X[H]).find((H)=>typeof H==="string"&&H.trim()!=="")??null,K=Y===null?null:Y.replace(/<([@#!])[^|>]*\|([^>]+)>/g,(H,L,z)=>`${L==="!"?"@":L}${z}`).replace(/<(?:https?:[^|>]+)\|([^>]+)>/g,"$1").replace(/<(https?:[^>]+)>/g,"$1");return{what:F,label:K===null?null:K.length>80?`${K.slice(0,79)}…`:K}}var q2=(_)=>/token|password|secret|key|credential/i.test(_.subject.type)&&_.subject.id.length>6?`••••${_.subject.id.slice(-4)}`:_.subject.id;function pZ({name:_,token:Q,twin:J,tab:q,arg:U,sub:G,admin:Z,snapshot:F,parentToken:X,who:Y,onSignOut:K,onReturn:H,opens:L,onRemoved:z,onWho:W,onEnded:I,worlds:M=[]}){let[B,N]=p.useState("pending"),[A,R]=p.useState(null),[O,C]=p.useState(0),[f,S]=p.useState(null);p.useEffect(()=>{let l=!0;return R(null),y1(Q,`/-/${_}/session`,{method:"POST"}).then(async(e)=>{let J1=await e.json().catch(()=>({}));if(LQ(J1.issuer),J1.who)W?.(J1.who);S(typeof J1.signsAs==="string"?J1.signsAs:null);let U1=$4(J1.origin)?.origin;if(e.status===409&&U1&&U1!==j1){h8(U1,Q,_);return}if(!l)return;if(N(!e.ok?"unknown":J1.scope==="read"?"read":J1.scope==="write"?"write":"unknown"),!e.ok)R(J1.error?o1(J1.error).text:`answered ${e.status}`)}).catch((e)=>{if(l)N("unknown"),R(`the World did not answer: ${e instanceof Error?e.message:String(e)}`)}),()=>{l=!1}},[_,Q,O]);let w=A?{state:"error",error:A}:B==="pending"?{state:"pending"}:{state:"ok",scope:B},k=B==="write",E=(l)=>{if(l.status!==403)return;l.clone().json().then((e)=>{if(/read token|opens only reads|write access|reads only/i.test(e?.error??""))N("read")},()=>null)},[r,c]=p.useState(0);p.useEffect(()=>{let l=setInterval(()=>{if(!document.hidden)c((e)=>e+1)},5000);return()=>clearInterval(l)},[]);let[y,b]=p.useState(0),v=V1(Q,`/-/${_}/clock`,r+y);p.useEffect(()=>{if(J2&&!F&&v.state==="error"&&v.status===401)I?.()},[v,F,I]);let x=V1(Q,`/-/${_}/twins`),V=V1(Q,`/-/${_}/branches`,y),D=V1(Q,`/-/${_}/map`,Math.floor(r/2)),P=!(V.state==="error"&&(V.status===404||V.status===405)),u=mZ.includes(q)?q:"overview",m=x.state==="ok"?x.data.twins.map((l)=>l.twin):[];if(J&&x.state==="ok"&&!m.includes(J))return $.jsxDEV("main",{className:"center",children:$.jsxDEV(H5,{title:`${_} has no ${J}`,action:$.jsxDEV("a",{href:`${O1}/${_}`,onClick:(l)=>{l.preventDefault(),h1(_.split("/"))},children:["Open ",_]},void 0,!0,void 0,this),children:$.jsxDEV("p",{children:["No vendor of this World is called ",J,". Its changesets are under Changes › History."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);let h=u==="vendors"&&U?U:void 0,t=()=>{N("pending"),C((l)=>l+1)};if(u==="canvas"||u==="vendors"&&!h||q==="screens"&&!U)return $.jsxDEV(BF,{name:_,token:Q,twins:x,session:w,retry:t,snapshot:F,back:()=>h1(_.split("/")),canWrite:k&&!F},void 0,!1,void 0,this);let s=q==="settings"?{kind:"settings",tab:((l)=>RQ.find(([e])=>e===l)?.[0]??"account")(U)}:q==="remote"?{kind:"settings",tab:"remote"}:q==="vault"?{kind:"settings",tab:"vault"}:q==="branches"?{kind:"branches",...U?{open:U}:{}}:null,o=J?"vendor":q==="screens"&&U?"screen":u==="vendors"&&h?"vendor":q==="trace"?"trace":q==="events"?"events":q==="changes"&&U==="changesets"?"history":"changes";return $.jsxDEV(nZ,{name:_,token:Q,view:o,win:s,who:Y,snapshot:F,onReturn:H,onSignOut:K,worlds:M,session:w,retry:t,...o==="vendor"?{arg:J??h}:o==="events"||o==="trace"||o==="screen"?U?{arg:U}:{}:{},...G?{sub:G}:{},twins:x,map:D,branches:P?V:null,clock:v,canWrite:k&&!F,refused:E,signsAs:f,opens:L,tick:r,admin:Z,onRemoved:z,onClock:()=>b((l)=>l+1),scope:F?"read":B},void 0,!1,void 0,this)}function C1({name:_,size:Q=20}){return $.jsxDEV("svg",{className:"icon",viewBox:"0 0 24 24",width:Q,height:Q,fill:"none",stroke:"currentColor",strokeWidth:Q<=16?1.75:1.5,strokeLinecap:"square",strokeLinejoin:"miter","aria-hidden":"true",children:(_Q[_]??[]).map(([J,q],U)=>p.default.createElement(J,{key:U,...q}))},void 0,!1,void 0,this)}function H3(_){let Q=(J)=>{let q=(J.operation??J.op).toLowerCase();return q.includes(".")?q.slice(q.lastIndexOf(".")+1):q};if(_.some((J)=>/^(delete|remove|archive|revoke)/.test(Q(J))||J.fields?.deleted===!0))return{icon:"square-minus",word:"removed",tone:"removed"};if(/^(create|add|insert|issue|send|post|upload|invite|record|seed)/.test(Q(_[0])))return{icon:"square-plus",word:"made",tone:"added"};return{icon:"square-dot",word:"changed",tone:"changed"}}var RQ=[["account","Account","user"],["changesets","Changesets","git-commit-horizontal"],["remote","Remote","cloud"],["access","Access","key-round"],["services","Real services","plug"],["vault","Vault","vault"],["checks","Checks","list-checks"],["clock","Clock","clock"],["appearance","Appearance","palette"]],cZ=(_,Q)=>{let J=Q.split("/").pop()??Q,q=_.split("/").pop()??"";return J.startsWith(`${q}-`)?J.slice(q.length+1):J},m2=(_)=>_.replace(/^_+/,"").replace(/[_-]+/g," ");function OQ({record:_,history:Q}){let J=_.writes[_.writes.length-1],q=C0(J),U=H3(_.writes),G=new Set(_.writes.map((H)=>H.id)),Z=_.writes[0].occurredAt,F={};if(Q){for(let H of Q)if(!G.has(H.id)&&!H.landsId&&!H.aliasOf&&H.subject.type===J.subject.type&&H.subject.id===J.subject.id&&H.occurredAt<=Z)Object.assign(F,H.fields??{})}let X={...F};for(let H of _.writes)Object.assign(X,H.fields??{});let Y=U.tone==="added"&&Object.keys(F).length===0,K=[...new Set([...Object.keys(F),...Object.keys(X)])].filter((H)=>!hQ(F[H],X[H]));return $.jsxDEV("div",{className:"ws-diff","aria-label":`${q.label??q2(J)}: its changes`,children:[$.jsxDEV("div",{className:"ws-diff-head",children:[$.jsxDEV("span",{className:`ws-kind ${U.tone}`,title:U.word,children:$.jsxDEV(C1,{name:U.icon,size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(a1,{vendor:_.twin},void 0,!1,void 0,this),$.jsxDEV("div",{className:"cell-label",children:[$.jsxDEV("b",{children:q.label??q2(J)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[M1(_.twin)," · ",J.subject.type.replace(/^_+/,"").replace(/[_-]+/g," ")," ",$.jsxDEV("code",{children:q2(J)},void 0,!1,void 0,this)," · ",U.word," here"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ol",{className:"ws-writes",children:_.writes.map((H)=>$.jsxDEV("li",{children:[$.jsxDEV("b",{children:C0(H).what},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(D1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",Q4(H)]},void 0,!0,void 0,this)]},H.id,!0,void 0,this))},void 0,!1,void 0,this),Q===null?$.jsxDEV("p",{className:"mode pad",children:"Reading its history…"},void 0,!1,void 0,this):K.length===0?$.jsxDEV("p",{className:"mode pad",children:"No field holds a new value."},void 0,!1,void 0,this):$.jsxDEV("table",{className:"ws-fields","aria-label":"Fields before and after",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Field"},void 0,!1,void 0,this),Y?null:$.jsxDEV("th",{children:"Before"},void 0,!1,void 0,this),$.jsxDEV("th",{children:U.tone==="removed"?"After":"Now"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:K.map((H)=>$.jsxDEV("tr",{children:[$.jsxDEV("th",{scope:"row",children:$.jsxDEV("code",{children:H},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y?null:$.jsxDEV("td",{className:H in F?"was":"none",children:H in F?$.jsxDEV(U2,{v:F[H]},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:H in X?"now":"none",children:H in X?$.jsxDEV(U2,{v:X[H]},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},H,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function IQ({records:_,selected:Q,onPick:J,label:q}){let[U,G]=p.useState(()=>{try{return localStorage.getItem("volter.console.records")==="tree"}catch{return!1}}),Z=(Y)=>{G(Y);try{localStorage.setItem("volter.console.records",Y?"tree":"path")}catch{}},F=(Y,K)=>{let H=Y.writes[Y.writes.length-1],L=C0(H),z=H3(Y.writes);return $.jsxDEV("li",{children:$.jsxDEV("button",{type:"button",className:[Q===Y.key?"on":"",K?"nested":""].join(" ").trim()||void 0,"aria-pressed":Q===Y.key,onClick:()=>J(Y.key),children:[K?null:$.jsxDEV(a1,{vendor:Y.twin},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:L.label??q2(H)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[m2(H.subject.type)," · ",L.what.split(" ").slice(-1)[0],Y.writes.length>1?` · ${c1(Y.writes.length,"write")}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:`ws-kind ${z.tone}`,title:z.word,"aria-label":z.word,children:$.jsxDEV(C1,{name:z.icon,size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},Y.key,!1,void 0,this)},X=[...new Set(_.map((Y)=>Y.twin))];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-view-switch",role:"group","aria-label":"List the records by",children:[$.jsxDEV("button",{type:"button","aria-pressed":!U,className:U?void 0:"on",onClick:()=>Z(!1),children:"Path"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button","aria-pressed":U,className:U?"on":void 0,onClick:()=>Z(!0),children:"Tree"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"ws-list","aria-label":q,children:U?X.map((Y)=>{let K=_.filter((H)=>H.twin===Y);return $.jsxDEV("li",{className:"ws-group",children:[$.jsxDEV("p",{className:"ws-group-head",children:[$.jsxDEV(a1,{vendor:Y},void 0,!1,void 0,this),$.jsxDEV("b",{children:M1(Y)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:K.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:K.map((H)=>F(H,!0))},void 0,!1,void 0,this)]},Y,!0,void 0,this)}):_.map((Y)=>F(Y,!1))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function lZ({name:_,token:Q,branches:J,opens:q,refused:U,onChanged:G}){let[Z,F]=p.useState(""),[X,Y]=p.useState(!1),K=J?.state==="ok"&&J.data.checkedOut||_.split("/")[1],H=J?.state==="ok"&&J.data.named?.length?J.data.named:[{name:K,running:!0}],L=J?.state==="ok"?J.data.branches:[],z=Z.trim().toLowerCase(),W=(M)=>!z||M.toLowerCase().includes(z),I=(M)=>{M.currentTarget.closest("details")?.removeAttribute("open")};return $.jsxDEV("details",{className:"menu ws-pick",children:[$.jsxDEV("summary",{title:"The branch served here",children:[$.jsxDEV(C1,{name:"git-branch",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-pick-label",children:[$.jsxDEV("small",{children:"Branch"},void 0,!1,void 0,this),$.jsxDEV("b",{children:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(C1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"popover ws-branch-menu",children:[$.jsxDEV("div",{className:"ws-branch-find",children:[$.jsxDEV("input",{type:"search",placeholder:"Filter","aria-label":"Filter branches",value:Z,onChange:(M)=>F(M.target.value)},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:(M)=>{I(M),Y(!0)},disabled:!J,children:"New branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"This World"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-branch-list",children:H.filter((M)=>W(M.name)).map((M)=>$.jsxDEV("li",{className:M.name===K?"current":void 0,children:[$.jsxDEV("span",{className:"tick",children:M.name===K?$.jsxDEV(C1,{name:"check",size:16},void 0,!1,void 0,this):$.jsxDEV(C1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"name",children:M.name},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:M.name===K?"served here":M.running?"running":"stopped"},void 0,!1,void 0,this)]},M.name,!0,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Branches of it"},void 0,!1,void 0,this),L.length===0?$.jsxDEV("p",{className:"mode ws-branch-none",children:"None yet. New branch makes one, from now or as the World was."},void 0,!1,void 0,this):$.jsxDEV("ul",{className:"ws-branch-list",children:L.filter((M)=>W(M.name)).map((M)=>{let B=$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"tick",children:$.jsxDEV(C1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"name",children:cZ(_,M.name)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:M.at?.instant?$.jsxDEV($.Fragment,{children:["as of ",$.jsxDEV(D1,{iso:M.at.instant,time:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N=M.expiresAt?`Goes away ${new Date(M.expiresAt).toLocaleString()}`:"Kept";return $.jsxDEV("li",{children:q(M.name)?$.jsxDEV("a",{href:`${O1}/${M.name}`,title:N,onClick:(A)=>{A.preventDefault(),I(A),TQ(M.name,M.name.split("/"))},children:B},void 0,!1,void 0,this):$.jsxDEV("span",{title:`${N}. Its tokens went to whoever made it; it opens from their page.`,children:B},void 0,!1,void 0,this)},M.name,!1,void 0,this)})},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-branch-foot",children:$.jsxDEV("a",{href:`${O1}/${_}/~/branches`,onClick:(M)=>{M.preventDefault(),I(M),h1([..._.split("/"),"~","branches"])},children:"Manage branches…"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(wQ,{name:_,token:Q,open:X,onClose:()=>Y(!1),onMade:G,refused:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function PQ({name:_,view:Q,changes:J,changesets:q}){let U=(G)=>(Z)=>{Z.preventDefault(),h1([..._.split("/"),"~",...G])};return $.jsxDEV("nav",{className:"tabs ws-pane-tabs","aria-label":"Changes and history",children:[$.jsxDEV("a",{href:`${O1}/${_}/~/changes`,className:Q==="changes"?"on":void 0,"aria-current":Q==="changes"?"page":void 0,onClick:U(["changes"]),children:["Changes",J?$.jsxDEV("span",{className:"count",children:J},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("a",{href:`${O1}/${_}/~/changes/changesets`,className:Q==="history"?"on":void 0,"aria-current":Q==="history"?"page":void 0,onClick:U(["changes","changesets"]),children:["History",q?$.jsxDEV("span",{className:"count",children:q},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function rZ({name:_,token:Q,sets:J,sub:q,signsAs:U,canWrite:G,rooted:Z,refused:F,onChanged:X,changes:Y,withScreens:K,required:H}){let[L,z]=p.useState(null),[W,I]=p.useState(!1),M=J.state==="ok"?[...J.data.changesets].sort((S,w)=>w.createdAt.localeCompare(S.createdAt)):[],B=M.find((S)=>S.name===q)??M[0],N=p.useMemo(()=>{let S=new Map;for(let w of B?VQ(B):[]){let k=`${w.twin}:${w.entry.subject.type}:${w.entry.subject.id}`,E=S.get(k)??{key:k,twin:w.twin,writes:[]};E.writes.push(w.entry),S.set(k,E)}return[...S.values()]},[B]),A=N.find((S)=>S.key===L)??N[0],R=V1(Q,A?`/-/${_}/log/${A.twin}`:null),O={added:0,removed:0,changed:0};for(let S of N)O[H3(S.writes).tone]=(O[H3(S.writes).tone]??0)+1;let C=B?K3(B):null,f=B?uQ(B,H):null;return $.jsxDEV("div",{className:"ws-two",children:[$.jsxDEV("div",{className:"ws-files",children:[$.jsxDEV(PQ,{name:_,view:"history",changes:Y,changesets:M.length},void 0,!1,void 0,this),$.jsxDEV(Z0,{load:J,what:"the changesets",lines:4},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-list ws-commits","aria-label":"Changesets",children:M.map((S)=>{let w=B?.name===S.name,k=K3(S).label==="Not sent";return $.jsxDEV("li",{children:$.jsxDEV("a",{href:`${O1}/${_}/~/changes/changesets/${S.name}`,className:w?"on":void 0,"aria-current":w?"true":void 0,onClick:(E)=>{E.preventDefault(),z(null),h1([..._.split("/"),"~","changes","changesets",S.name])},children:[$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:y8(S)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[S.owner??(S.cutBy?G3(S.cutBy):"unrecorded")," • ",$.jsxDEV(D1,{iso:S.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k?$.jsxDEV("span",{className:"ws-unpushed",title:"Not pushed to the remote yet",children:$.jsxDEV(C1,{name:"arrow-up-from-line",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},S.name,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-pane-right",children:[J.state==="ok"&&!B?$.jsxDEV(H5,{title:"No changesets yet",children:$.jsxDEV("p",{children:"Cut one from Changes: the cut box is at its foot."},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,B&&C&&f?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-commit-head",children:[$.jsxDEV("div",{className:"ws-commit-title",children:[$.jsxDEV("h3",{children:y8(B)},void 0,!1,void 0,this),$.jsxDEV("p",{className:"ws-commit-stat",children:[$.jsxDEV(C1,{name:"file-diff",size:16},void 0,!1,void 0,this)," ",c1(N.length,"changed record"),O.added?$.jsxDEV("span",{className:"plus",children:[" +",O.added]},void 0,!0,void 0,this):null,O.removed?$.jsxDEV("span",{className:"minus",children:[" −",O.removed]},void 0,!0,void 0,this):null,O.changed?$.jsxDEV("span",{className:"dot",children:[" •",O.changed]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode ws-commit-meta",children:[$.jsxDEV("code",{children:B.name},void 0,!1,void 0,this)," · ",$.jsxDEV(D1,{iso:B.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"ws-commit-who",children:[["Owner",B.owner??(B.cutBy&&/^(token|token:read)$|^key:(?!.* for:)/.test(B.cutBy)?"no person: a service’s":"unrecorded")],["Cut by",B.cutBy?B.pushedBy&&B.applied===null&&B.cutBy==="machine"?"the machine it was cut on":G3(B.cutBy):"unrecorded"],...B.pushedBy?[["Pushed by",G3(B.pushedBy)]]:[]].map(([S,w])=>$.jsxDEV("span",{children:[$.jsxDEV("span",{className:"mode",children:S},void 0,!1,void 0,this)," ",w]},S,!0,void 0,this))},void 0,!1,void 0,this),B.pushedBy?$.jsxDEV("p",{className:"mode ws-commit-meta",children:B.applied===null?"Owner and cut by are as the World it was cut in recorded them; pushed by is this World's own record.":"Owner and cut by are this World’s record; pushed by is as the remote recorded it."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>I(!0),title:"Where it went, the checks, the approvals; Verify, Approve and Deploy",children:[$.jsxDEV("span",{className:`badge cs-${C.tone}`,children:C.label},void 0,!1,void 0,this),$.jsxDEV("span",{className:`badge cs-${f.tone}`,children:f.label},void 0,!1,void 0,this),"Review…"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-two inner",children:[$.jsxDEV("div",{className:"ws-files",children:$.jsxDEV(IQ,{records:N,...A?{selected:A.key}:{},onPick:z,label:"Records it changed"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-detail",children:A?$.jsxDEV(OQ,{record:A,history:R.state==="ok"?R.data.entries:R.state==="error"?[]:null},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode pad",children:"It changes nothing."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(O0,{open:W,onClose:()=>I(!1),title:`Review: ${y8(B)}`,wide:!0,children:[$.jsxDEV(HQ,{name:_,token:Q,signsAs:U,c:B,canWrite:G,rooted:Z,refused:F,onChanged:X,part:"head",required:H},`h:${B.name}`,!1,void 0,this),$.jsxDEV(HQ,{name:_,token:Q,signsAs:U,c:B,canWrite:G,rooted:Z,refused:F,onChanged:X,part:"review",required:H},`r:${B.name}`,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function iZ({name:_,token:Q,vendors:J,vendor:q,tick:U}){let[G,Z]=p.useState(UQ*4),[F,X]=p.useState(""),[Y,K]=p.useState(null),H=V1(Q,`/-/${_}/timeline?limit=${G}${q?`&twin=${encodeURIComponent(q)}`:""}`,Math.floor(U/2)),L=H.state==="ok"?XF(H.data.entries):[],z=[...new Set(L.map((O)=>C0(O.entry).what))].sort(),W=L.filter((O)=>!F||C0(O.entry).what===F),I=W.find((O)=>K5(O)===Y)??W[0],M=(O)=>(C)=>{C.preventDefault(),K(null),h1([..._.split("/"),"~","events",...O?[O]:[]])},B=I?.entry.input&&typeof I.entry.input==="object"?I.entry.input.body:void 0,N=I?hZ(I.entry.traceparent):null,A=I?GQ(I):null,R=I?GF(I.entry):[];return $.jsxDEV("div",{className:"ws-events",children:[$.jsxDEV("div",{className:"ws-filterbar",children:[$.jsxDEV("nav",{className:"ws-seg","aria-label":"Vendor",children:[$.jsxDEV("a",{href:`${O1}/${_}/~/events`,className:!q?"on":void 0,"aria-current":!q?"page":void 0,onClick:M(),children:"All"},void 0,!1,void 0,this),J.map((O)=>$.jsxDEV("a",{href:`${O1}/${_}/~/events/${O}`,className:q===O?"on":void 0,"aria-current":q===O?"page":void 0,onClick:M(O),children:[$.jsxDEV(a1,{vendor:O},void 0,!1,void 0,this),M1(O)]},O,!0,void 0,this))]},void 0,!0,void 0,this),$.jsxDEV("select",{"aria-label":"Operation",value:F,onChange:(O)=>{X(O.target.value),K(null)},children:[$.jsxDEV("option",{value:"",children:"Every operation"},void 0,!1,void 0,this),z.map((O)=>$.jsxDEV("option",{value:O,children:O},O,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-grid-wrap",children:[$.jsxDEV(Z0,{load:H,what:"the events",lines:6},void 0,!1,void 0,this),$.jsxDEV("table",{className:"ws-grid","aria-label":"Events",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Time"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"What"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Record"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"By"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Receipt"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:W.map((O)=>{let C=C0(O.entry),f=GQ(O),S=I&&K5(O)===K5(I);return $.jsxDEV("tr",{className:S?"on":void 0,"aria-selected":S,onClick:()=>K(K5(O)),children:[$.jsxDEV("td",{className:"mono",children:$.jsxDEV(D1,{iso:O.entry.occurredAt,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(a1,{vendor:O.twin},void 0,!1,void 0,this),M1(O.twin)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("b",{children:C.what},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"ws-cell-clip",children:C.label?`“${C.label}”`:$.jsxDEV("code",{children:q2(O.entry)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:Q4(O.entry,O.caller)},void 0,!1,void 0,this),$.jsxDEV("td",{children:f?$.jsxDEV("span",{className:f.bad?"badge cs-bad":f.status==="deployed"?"badge cs-done":"badge",children:f.status},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:WQ(O.entry)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},K5(O),!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-event-detail",children:I?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-event-line",children:[$.jsxDEV("span",{className:"badge",children:CQ(I.entry)},void 0,!1,void 0,this),A?$.jsxDEV("span",{className:A.bad?"badge cs-bad":"badge cs-good",children:A.status},void 0,!1,void 0,this):null,$.jsxDEV("code",{children:[I.entry.subject.type,":",q2(I.entry)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(D1,{iso:I.entry.occurredAt},void 0,!1,void 0,this)," · ",Q4(I.entry,I.caller)]},void 0,!0,void 0,this),N?$.jsxDEV("a",{href:`${O1}/${_}/~/trace/${N.trace}`,onClick:(O)=>{O.preventDefault(),h1([..._.split("/"),"~","trace",N.trace])},children:"Its trace →"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-event-panes",children:[$.jsxDEV("div",{role:"region","aria-label":"The request",children:[$.jsxDEV("h4",{children:"Request"},void 0,!1,void 0,this),B!==void 0?$.jsxDEV(FF,{body:B},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode",children:"No request body: the World or the vendor wrote it."},void 0,!1,void 0,this),R.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h4",{children:"Usage"},void 0,!1,void 0,this),$.jsxDEV("dl",{className:"fields",children:R.map(([O,C])=>$.jsxDEV(p.default.Fragment,{children:[$.jsxDEV("dt",{children:O},void 0,!1,void 0,this),$.jsxDEV("dd",{children:C},void 0,!1,void 0,this)]},O,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{role:"region","aria-label":"What it wrote",children:[$.jsxDEV("h4",{children:"Written"},void 0,!1,void 0,this),$.jsxDEV(yQ,{fields:I.entry.fields},void 0,!1,void 0,this),$.jsxDEV("h4",{children:I.copies.length?"Receipts":"Receipt"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:I.copies.length?I.copies.map((O)=>O.entry.receipt?.status??"landed copy").join(" · "):HF(I.entry)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("p",{className:"mode pad",children:"Nothing written here yet."},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-foot mode",children:[$.jsxDEV("span",{children:[I?`${W.indexOf(I)+1} of ${W.length}`:W.length," events",q?` at ${M1(q)}`:""]},void 0,!0,void 0,this),H.state==="ok"&&H.data.next?$.jsxDEV("button",{type:"button",onClick:()=>Z((O)=>O+UQ*4),children:"Load older"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function dZ({name:_,token:Q,id:J}){let q=/^[0-9a-f]{32}$/.test(J),U=V1(Q,q?`/-/${_}/timeline?trace=${J}&limit=500`:null),G=U.state==="ok"?[...U.data.entries].sort((H,L)=>-fQ(H,L)):[],[Z,F]=p.useState(null),X=G[0]?Date.parse(G[0].entry.occurredAt):0,Y=G.length?Math.max(1,Date.parse(G[G.length-1].entry.occurredAt)-X):1,K=[...new Set(G.map((H)=>H.twin))];return $.jsxDEV("div",{className:"ws-sheet ws-trace",children:[$.jsxDEV("p",{className:"crumbs-line",children:$.jsxDEV("a",{href:`${O1}/${_}/~/events`,onClick:(H)=>{H.preventDefault(),h1([..._.split("/"),"~","events"])},children:[$.jsxDEV(C1,{name:"arrow-left",size:16},void 0,!1,void 0,this)," Events"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("h2",{children:[G[0]?`${C0(G[0].entry).what} …`:"Trace"," ",$.jsxDEV("code",{className:"mode",children:J.slice(0,12)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!q?$.jsxDEV("p",{role:"alert",children:[J?`${J} is not a trace id`:"No trace named",": a W3C trace id is 32 hex characters."]},void 0,!0,void 0,this):$.jsxDEV(Z0,{load:U,what:"the trace"},void 0,!1,void 0,this),G.length?$.jsxDEV("p",{className:"ws-trace-meta",children:["Started ",$.jsxDEV("b",{children:$.jsxDEV(D1,{iso:G[0].entry.occurredAt},void 0,!1,void 0,this)},void 0,!1,void 0,this)," · Took ",$.jsxDEV("b",{children:[Y," ms"]},void 0,!0,void 0,this)," · Vendors ",$.jsxDEV("b",{children:K.map(M1).join(", ")},void 0,!1,void 0,this)," · Writes ",$.jsxDEV("b",{children:G.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,U.state==="ok"&&G.length===0?$.jsxDEV(H5,{title:"Nothing in this World carries this trace",children:$.jsxDEV("p",{children:["An app instrumented with OpenTelemetry sends a ",$.jsxDEV("code",{children:"traceparent"},void 0,!1,void 0,this)," with each call, and every write that call makes keeps it, so one click reads across every vendor."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,G.length?$.jsxDEV("div",{className:"ws-spans",role:"table","aria-label":"The trace's writes",children:[$.jsxDEV("div",{className:"ws-span head",role:"row",children:[$.jsxDEV("span",{role:"columnheader",children:"Vendor and what"},void 0,!1,void 0,this),$.jsxDEV("span",{role:"columnheader",className:"ws-ticks",children:[$.jsxDEV("span",{children:"0 ms"},void 0,!1,void 0,this),$.jsxDEV("span",{children:[Math.round(Y/2)," ms"]},void 0,!0,void 0,this),$.jsxDEV("span",{children:[Y," ms"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.map((H)=>{let L=Date.parse(H.entry.occurredAt)-X,z=K5(H),W=C0(H.entry);return $.jsxDEV(p.default.Fragment,{children:[$.jsxDEV("div",{className:Z===z?"ws-span on":"ws-span",role:"row",onClick:()=>F(Z===z?null:z),children:[$.jsxDEV("span",{role:"cell",className:"ws-span-name",children:[$.jsxDEV(a1,{vendor:H.twin},void 0,!1,void 0,this),$.jsxDEV("b",{children:M1(H.twin)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[W.what,W.label?` “${W.label}”`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{role:"cell",className:"ws-span-track",children:[$.jsxDEV("span",{className:"ws-span-dot",style:{left:`${L/Y*100}%`}},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-span-at mode",style:{left:`${L/Y*100}%`},children:["+",L," ms"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z===z?$.jsxDEV("div",{className:"ws-span-detail",children:[$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("code",{children:CQ(H.entry)},void 0,!1,void 0,this)," on ",$.jsxDEV("code",{children:[H.entry.subject.type,":",q2(H.entry)]},void 0,!0,void 0,this)," · ",Q4(H.entry,H.caller)," · ",WQ(H.entry)]},void 0,!0,void 0,this),$.jsxDEV(yQ,{fields:H.entry.fields},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},z,!0,void 0,this)})]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function aZ({name:_,token:Q,vendor:J,withScreens:q,tick:U}){let G=V1(Q,`/-/${_}/checkpoint/${J}`,Math.floor(U/6)),Z=G.state==="ok"?G.data.tree.filter((R)=>R.deleted!==!0):[],F=[...new Set(Z.map((R)=>R.type))].map((R)=>({type:R,count:Z.filter((O)=>O.type===R).length})).sort((R,O)=>Number(R.type.startsWith("_"))-Number(O.type.startsWith("_"))||m2(R.type).localeCompare(m2(O.type))),[X,Y]=p.useState(null),[K,H]=p.useState(null),L=F.some((R)=>R.type===X)?X:F[0]?.type,z=Z.filter((R)=>R.type===L),W=z.find((R)=>R.id===K)??z[0],I=["name","email","title","text","description","subject","amount","percent_off","unit_amount","currency","status","channel","customer","product"],M=new Set(["id","type","object","livemode","created","updated","updatedAt","deleted"]),B=(R)=>!M.has(R)&&z.some((O)=>O[R]!==void 0&&O[R]!==null&&typeof O[R]!=="object"),N=[...new Set(z.flatMap((R)=>Object.keys(R)))],A=[...I.filter(B),...N.filter((R)=>!I.includes(R)&&B(R))].slice(0,4);return $.jsxDEV("div",{className:"ws-table-app",children:[$.jsxDEV("nav",{className:"ws-tables","aria-label":`${M1(J)}'s records`,children:[$.jsxDEV("div",{className:"ws-list-head",children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(a1,{vendor:J},void 0,!1,void 0,this),M1(J)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(Z0,{load:G,what:"what it stores",lines:4},void 0,!1,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Stores"},void 0,!1,void 0,this),F.map((R)=>$.jsxDEV("a",{href:`#${R.type}`,className:L===R.type?"on":void 0,"aria-current":L===R.type?"true":void 0,onClick:(O)=>{O.preventDefault(),Y(R.type),H(null)},children:[$.jsxDEV(C1,{name:"table-2",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:m2(R.type)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"count",children:R.count},void 0,!1,void 0,this)]},R.type,!0,void 0,this)),$.jsxDEV("p",{className:"menu-label",children:"Also"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${O1}/${_}/~/events/${J}`,onClick:(R)=>{R.preventDefault(),h1([..._.split("/"),"~","events",J])},children:[$.jsxDEV(C1,{name:"activity",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Its events"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q?$.jsxDEV("a",{href:`${O1}/${_}/~/screens/${J}`,onClick:(R)=>{R.preventDefault(),h1([..._.split("/"),"~","screens",J])},children:[$.jsxDEV(C1,{name:"monitor",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Its screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-grid-wrap",children:[G.state==="ok"&&F.length===0?$.jsxDEV(H5,{title:`${M1(J)} stores nothing yet`,children:$.jsxDEV("p",{children:"What your app makes there shows here, by type."},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,z.length?$.jsxDEV("table",{className:"ws-grid","aria-label":`${m2(L??"")} records`,children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"id"},void 0,!1,void 0,this),A.map((R)=>$.jsxDEV("th",{children:R},R,!1,void 0,this)),$.jsxDEV("th",{children:"updated"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:z.map((R)=>$.jsxDEV("tr",{className:W?.id===R.id?"on":void 0,"aria-selected":W?.id===R.id,onClick:()=>H(R.id),children:[$.jsxDEV("td",{children:$.jsxDEV("code",{children:R.id},void 0,!1,void 0,this)},void 0,!1,void 0,this),A.map((O)=>$.jsxDEV("td",{className:"ws-cell-clip",children:R[O]===void 0||R[O]===null?$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this):String(R[O])},O,!1,void 0,this)),$.jsxDEV("td",{className:"mode",children:typeof R.updatedAt==="string"?$.jsxDEV(D1,{iso:R.updatedAt},void 0,!1,void 0,this):"—"},void 0,!1,void 0,this)]},R.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("aside",{className:"ws-record","aria-label":"The selected record",children:W?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-list-head",children:[$.jsxDEV("span",{children:m2(W.type)},void 0,!1,void 0,this),$.jsxDEV("code",{children:W.id},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("dl",{className:"ws-record-fields",children:Object.entries(W).filter(([R])=>R!=="type"&&R!=="id").map(([R,O])=>$.jsxDEV(p.default.Fragment,{children:[$.jsxDEV("dt",{children:R},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(U2,{v:O},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},R,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-foot mode",children:W?`${z.indexOf(W)+1} of ${c1(z.length,m2(L??"record"))}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function sZ({name:_,vendor:Q,url:J,mapError:q,holding:U,session:G,retry:Z}){return $.jsxDEV("div",{className:"ws-screen",children:[$.jsxDEV("div",{className:"ws-screen-bar",children:[$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(a1,{vendor:Q},void 0,!1,void 0,this),$.jsxDEV("b",{children:M1(Q)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:U},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${O1}/${_}/~/vendors/${Q}`,onClick:(F)=>{F.preventDefault(),h1([..._.split("/"),"~","vendors",Q])},children:[$.jsxDEV(C1,{name:"table-2",size:16},void 0,!1,void 0,this),"Its records"]},void 0,!0,void 0,this),J?$.jsxDEV("a",{href:J,target:"_blank",rel:"noopener noreferrer",children:[$.jsxDEV(C1,{name:"external-link",size:16},void 0,!1,void 0,this),"New tab"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),G.state==="ok"&&G.scope==="read"?$.jsxDEV("p",{className:"mode ws-screens-note",children:"You are looking read only: the screens browse, and refuse changes."},void 0,!1,void 0,this):null,q?$.jsxDEV("p",{role:"alert",className:"ws-screens-note",children:["The World did not say where its screens are: ",q]},void 0,!0,void 0,this):G.state==="pending"||J===void 0?$.jsxDEV("p",{className:"mode ws-screens-note",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,G.state==="error"?$.jsxDEV("p",{role:"alert",className:"ws-screens-note",children:["The World did not open its screens: ",G.error," ",$.jsxDEV("button",{type:"button",onClick:Z,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,G.state==="ok"&&J===null?$.jsxDEV("p",{className:"mode ws-screens-note",children:[M1(Q),"'s pack lists no screens."]},void 0,!0,void 0,this):null,G.state==="ok"&&J?$.jsxDEV("iframe",{title:`${M1(Q)}, as this World shows it`,src:J},Q,!1,void 0,this):null]},void 0,!0,void 0,this)}function tZ({name:_,token:Q,who:J,scope:q}){let[U,G]=p.useState(0),Z=V1(Q,`/-/${_}/twins`),F=V1(Q,`/-/${_}/rules`,U),X=F.state==="ok"?F.data.changesets:null,[Y,K]=p.useState(null),[H,L]=p.useState(null),[z,W]=p.useState(!1),[I,M]=p.useState([]),B=Y??X?.approvals??1,N=H??X?.summary??"required",A=X!==null&&(B!==(X.approvals??1)||N!==(X.summary??"required")),R=(k,E)=>{if(M((r)=>[{ok:k,text:E,at:new Date().toISOString(),n:++q4},...r].slice(0,3)),!k)p1(E,"error")},O=async(k)=>{k.preventDefault(),W(!0);try{let E=await y1(Q,`/-/${_}/rules`,{method:"PUT",body:JSON.stringify({changesets:{approvals:B,summary:N}})});if(!E.ok){R(!1,`Save: ${await K0(E)}`);return}R(!0,`Saved: ${B===0?"no approval":c1(B,"approval")} before a deploy; a summary ${N==="required"?"required":"generated when none is given"}.`),K(null),L(null),G((r)=>r+1)}finally{W(!1)}},C={gated:"a person deploys an approved changeset",auto:"a push deploys at once",hold:"nothing deploys"},f=J.person?$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:J.person},void 0,!1,void 0,this),J.local?", signed in on this machine":""]},void 0,!0,void 0,this):J.local?$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:"this machine"},void 0,!1,void 0,this),": no one is signed in here, so no person owns them until they are pushed by one"]},void 0,!0,void 0,this):J.admin?$.jsxDEV($.Fragment,{children:$.jsxDEV("b",{children:"the host's admin"},void 0,!1,void 0,this)},void 0,!1,void 0,this):$.jsxDEV($.Fragment,{children:[$.jsxDEV("b",{children:"this token"},void 0,!1,void 0,this),", a service"]},void 0,!0,void 0,this),S=Z.state==="ok"?Z.data.twins.filter((k)=>k.root?.url):[],w=q!=="write"?"This session reads the World; it changes no rules":null;return $.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Changesets"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"This World's rules, kept with it and shared by everyone who works in it. A person or the World's token changes them; a key never does, so an agent cannot relax the review its own changes go through."},void 0,!1,void 0,this),$.jsxDEV(Z0,{load:F,what:"the rules",lines:2},void 0,!1,void 0,this),$.jsxDEV("form",{className:"ws-rules",onSubmit:(k)=>void O(k),"aria-label":"Changeset rules",children:[$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Recorded as"},void 0,!1,void 0,this),$.jsxDEV("p",{children:["What you cut here is recorded as ",f,". An agent's or an app's key cuts as itself, for the person it was made for; a World's token cuts as a service."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"A cut's summary"},void 0,!1,void 0,this),$.jsxDEV("fieldset",{className:"choice",disabled:Boolean(w)||X===null,children:[$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"summary",checked:N==="required",onChange:()=>L("required")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Required: whoever cuts says what it does and why"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"summary",checked:N==="generated",onChange:()=>L("generated")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Generated from its changes when none is given"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:"Either way a cut takes every change not yet in a changeset: there is no staging."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Ready to deploy"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-rule-list",children:$.jsxDEV("li",{children:[$.jsxDEV(C1,{name:"check",size:16},void 0,!1,void 0,this),"Verified: replayed in a throwaway World, the World's checks passing"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("label",{className:"ws-rule-row",children:[$.jsxDEV("span",{children:"Approved by"},void 0,!1,void 0,this),$.jsxDEV("select",{value:B,onChange:(k)=>K(Number(k.target.value)),disabled:Boolean(w)||X===null,"aria-label":"Approvals required",children:[0,1,2,3,4,5].map((k)=>$.jsxDEV("option",{value:k,children:k===0?"no one: verified is enough":k===1?"1 person":`${k} different people`},k,!1,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"for its contents as they stand"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Deploys to"},void 0,!1,void 0,this),Z.state==="ok"&&S.length===0?$.jsxDEV("p",{className:"mode",children:"No vendor here is connected to its real service, so nothing deploys from this World."},void 0,!1,void 0,this):null,S.length?$.jsxDEV("ul",{className:"ws-rule-list",children:S.map((k)=>$.jsxDEV("li",{children:[$.jsxDEV(a1,{vendor:k.twin},void 0,!1,void 0,this),M1(k.twin),": ",C[k.root.deploy??"gated"]??"gated"]},k.twin,!0,void 0,this))},void 0,!1,void 0,this):null,$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("a",{href:`${O1}/${_}/~/settings/services`,onClick:(k)=>{k.preventDefault(),h1([..._.split("/"),"~","settings","services"])},children:"Real services"},void 0,!1,void 0,this)," sets each vendor's deploy policy."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(A2,{log:I,name:_},void 0,!1,void 0,this),$.jsxDEV("div",{className:"row-actions",children:[$.jsxDEV("button",{type:"submit",className:"primary",disabled:Boolean(w)||z||!A,title:w??void 0,children:z?"Saving…":"Save"},void 0,!1,void 0,this),A?$.jsxDEV("button",{type:"button",onClick:()=>{K(null),L(null)},children:"Cancel"},void 0,!1,void 0,this):null,w?$.jsxDEV("span",{className:"mode",children:[w,"."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function oZ({who:_,scope:Q,snapshot:J,portal:q,onSignOut:U}){let G=Q==="write"?"Reads and changes this World":Q==="read"?"Reads this World; changes nothing":"…",[Z,F]=J?["A snapshot",`of ${J.parent}, read only`]:_.local&&_.person?[_.person,"Signed in on this machine: this World is served here, and acts as you"]:_.local?["This machine","Served here, with no one signed in: what you do is recorded as this machine"]:_.person?[_.person,q?`Signed in through ${new URL(q).host}`:"Signed in"]:_.admin?["The host's admin","Opened with the host admin token: every World it serves"]:["A link or key","Opened with a token for this World"];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Account"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-account",children:[$.jsxDEV("span",{className:"ws-account-face","aria-hidden":"true",children:$.jsxDEV(C1,{name:_.person?"user":_.local?"monitor":J?"clock":"key-round",size:20},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"cell-label",children:[$.jsxDEV("b",{children:Z},void 0,!1,void 0,this),$.jsxDEV("small",{children:F},void 0,!1,void 0,this),$.jsxDEV("small",{children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_.local||J?null:$.jsxDEV("p",{children:$.jsxDEV("button",{type:"button",onClick:U,children:[$.jsxDEV(C1,{name:"log-out",size:16},void 0,!1,void 0,this),_.person?"Sign out":_.admin?"Sign out of the host":"Use another token"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q&&_.person?$.jsxDEV("p",{className:"mode",children:["Your profile, orgs and keys are on ",$.jsxDEV("a",{href:`${q}/`,children:new URL(q).host},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function nZ({name:_,token:Q,view:J,sub:q,arg:U,win:G,who:Z,snapshot:F,onReturn:X,onSignOut:Y,worlds:K,session:H,retry:L,twins:z,map:W,branches:I,clock:M,canWrite:B,refused:N,signsAs:A,opens:R,tick:O,admin:C,onRemoved:f,onClock:S,scope:w}){let k=DQ(_,Q,O,N),[E,r]=p.useState(0),c=E*1e5+Math.floor(O/2),y=V1(Q,`/-/${_}/diff`,c),b=V1(Q,`/-/${_}/changesets`,c),v=V1(Q,`/-/${_}/rules`,c),[x,V]=p.useState(null),D=(n)=>(T1)=>{T1?.preventDefault(),h1([..._.split("/"),"~",...n])},P=z.state==="ok"?z.data.twins.map((n)=>n.twin):[],u=new Map((W.state==="ok"?W.data.twins:[]).flatMap((n)=>{let T1=gZ(_,n);return T1?[[n.twin,T1]]:[]})),m=[...u.keys()],h=W.state==="ok"?W.data.twins.filter((n)=>n.root).map((n)=>n.twin):[],t=(n)=>W.state==="ok"?(W.data.twins.find((T1)=>T1.twin===n)?.resources??[]).reduce((T1,Z1)=>T1+Z1.count,0):0,Q1=I?.state==="ok"&&I.data.checkedOut||_.split("/")[1],s=p.useMemo(()=>{if(y.state!=="ok")return[];let n=new Map;for(let T1 of y.data.changes){let Z1=`${T1.twin}:${T1.entry.subject.type}:${T1.entry.subject.id}`,k1=n.get(Z1)??{key:Z1,twin:T1.twin,writes:[]};k1.writes.push(T1.entry),n.set(Z1,k1)}return[...n.values()]},[y]),o=s.find((n)=>n.key===x)??s[0],l=V1(Q,J==="changes"&&o?`/-/${_}/log/${o.twin}`:null,c),e=y.state==="ok"?y.data.changes.length:0,J1=k.waiting.length,U1=k.there,F1=k.origin.state==="ok"?k.origin.data.origin:null,W1=!B?"This session reads the World; it changes nothing":!U1?"No remote: name one in Settings › Remote":null,Y1=(n,T1,Z1,k1,t1,_0)=>$.jsxDEV("a",{href:`${O1}/${_}/~/${k1}`,className:n?"on":void 0,"aria-current":n?"page":void 0,onClick:t1,children:[T1,$.jsxDEV("span",{children:Z1},void 0,!1,void 0,this),_0?$.jsxDEV("span",{className:"count",children:_0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),B1=(n)=>{n.currentTarget.closest("details")?.removeAttribute("open")};return $.jsxDEV("div",{className:"ws",children:[$.jsxDEV("div",{className:"ws-bar",role:"toolbar","aria-label":`${_} toolbar`,children:[$.jsxDEV("div",{className:"ws-left",children:[$.jsxDEV(e5,{href:`${O1}/${_}`,onClick:(n)=>{n.preventDefault(),D(["changes"])()}},void 0,!1,void 0,this),$.jsxDEV("details",{className:"menu ws-pick",children:[$.jsxDEV("summary",{title:"This World",children:[$.jsxDEV(C1,{name:"globe",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-pick-label",children:[$.jsxDEV("small",{children:"World"},void 0,!1,void 0,this),$.jsxDEV("b",{children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(C1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"popover menu-list ws-world-menu",children:[Z.local?null:$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"menu-label",children:"Worlds"},void 0,!1,void 0,this),K.map((n)=>$.jsxDEV("a",{href:`${O1}/${n}`,className:n===_?"on":void 0,onClick:(T1)=>{T1.preventDefault(),B1(T1),h1(n.split("/"))},children:[n===_?$.jsxDEV(C1,{name:"check",size:16},void 0,!1,void 0,this):$.jsxDEV(C1,{name:"globe",size:16},void 0,!1,void 0,this),n]},n,!0,void 0,this)),$.jsxDEV("a",{href:`${u0()&&u0()!==j1?u0():""}${O1}/`,onClick:(n)=>{if(u0()&&u0()!==j1)return;n.preventDefault(),B1(n),h1([])},children:[$.jsxDEV(C1,{name:"layout-grid",size:16},void 0,!1,void 0,this),"All Worlds",F0()?` on ${new URL(F0()).host}`:""]},void 0,!0,void 0,this),$.jsxDEV("hr",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Connect an app"},void 0,!1,void 0,this),F0()?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Point your app's SDKs here with a key made on the platform; its calls to these vendors land in this World:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:[i0,"/",_,"/<vendor>"]},void 0,!0,void 0,this),$.jsxDEV(C8,{text:J3({platform:F0(),world:_})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):!Z.local?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Point your app's SDKs here with a key from Settings › Access; its calls to these vendors land in this World:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:[i0,"/",_,"/<vendor>"]},void 0,!0,void 0,this),$.jsxDEV(C8,{text:J3()},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"ws-menu-text",children:"Run it in this World; its calls to these vendors land here:"},void 0,!1,void 0,this),$.jsxDEV("pre",{children:"volter world run -- npm start"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"ws-menu-text mode",children:["Or point an SDK at ",$.jsxDEV("code",{children:[i0,"/",_,"/<vendor>"]},void 0,!0,void 0,this)," with the token in ",$.jsxDEV("code",{children:".volter/token"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),$.jsxDEV(C8,{text:J3()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("hr",{},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${O1}/${_}/~/settings`,onClick:(n)=>{B1(n),D(["settings"])(n)},children:[$.jsxDEV(C1,{name:"settings",size:16},void 0,!1,void 0,this),"Settings…"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(lZ,{name:_,token:Q,branches:I,opens:R,refused:N,onChanged:S},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-where",title:"Where this is",children:[$.jsxDEV("span",{children:_},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),$.jsxDEV("span",{children:Q1},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),F1?$.jsxDEV("a",{href:`${O1}/${_}/~/remote`,onClick:D(["remote"]),children:["origin ",F1.namespace,J1?$.jsxDEV("b",{children:[" ↑",J1]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):$.jsxDEV("a",{href:`${O1}/${_}/~/remote`,onClick:D(["remote"]),children:"no remote"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${O1}/${_}/~/settings/clock`,onClick:D(["settings","clock"]),children:M.state==="ok"?$.jsxDEV($.Fragment,{children:[M.data.frozen?"stopped at ":"",$.jsxDEV(D1,{iso:M.data.at,time:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-right",children:[$.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void k.pull(),disabled:Boolean(W1)||k.busy!==null,title:W1??`Fetch what ${U1} has and move this branch onto it`,children:[$.jsxDEV(C1,{name:"arrow-down-to-line",size:16},void 0,!1,void 0,this),k.busy==="Pull"?"Pulling…":"Pull"]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void k.push(),disabled:Boolean(W1)||k.busy!==null||J1===0,title:W1??(J1?`Push ${c1(J1,"changeset")} to ${U1}`:`Every changeset is at ${U1}`),children:[$.jsxDEV(C1,{name:"arrow-up-from-line",size:16},void 0,!1,void 0,this),k.busy==="Push"?"Pushing…":"Push",J1?$.jsxDEV("span",{className:"ws-btn-count",children:J1},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",className:"ws-btn icon-only","aria-label":"Settings",title:"Settings",onClick:()=>D(["settings"])(),children:$.jsxDEV(C1,{name:"settings",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F?$.jsxDEV("div",{className:"ws-banner",role:"region","aria-label":"Snapshot",children:[$.jsxDEV(C1,{name:"clock",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:["You are looking at ",$.jsxDEV("b",{children:F.parent},void 0,!1,void 0,this)," as it was at ",$.jsxDEV(D1,{iso:F.at},void 0,!1,void 0,this),": a read-only snapshot",F.expiresAt?$.jsxDEV($.Fragment,{children:[", gone ",$.jsxDEV(D1,{iso:F.expiresAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,"."]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>void X(F),children:"Return to live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,k.log.length?$.jsxDEV("div",{className:"ws-said",children:$.jsxDEV(A2,{log:k.log.slice(0,1),name:_},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV("div",{className:"ws-body",children:[$.jsxDEV("nav",{className:"ws-side","aria-label":`${_} places`,children:[P.length?$.jsxDEV("a",{href:`${O1}/${_}/~/screens`,className:J==="screen"?"ws-screens-entry on":"ws-screens-entry",onClick:D(["screens"]),title:`The board: ${b2(P.map(M1))}`,children:[$.jsxDEV(C1,{name:"layout-grid",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Board"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-screens-marks",children:[P.slice(0,3).map((n)=>$.jsxDEV(a1,{vendor:n},n,!1,void 0,this)),P.length>3?$.jsxDEV("span",{className:"more",children:["+",P.length-3]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("p",{className:"side-group",children:"Workspace"},void 0,!1,void 0,this),Y1(J==="changes"||J==="history",$.jsxDEV(C1,{name:"file-diff",size:16},void 0,!1,void 0,this),"Changes","changes",D(["changes"]),s.length?String(s.length):void 0),Y1(J==="events"&&!U||J==="trace",$.jsxDEV(C1,{name:"activity",size:16},void 0,!1,void 0,this),"Events","events",D(["events"])),$.jsxDEV("p",{className:"side-group",children:"Records"},void 0,!1,void 0,this),P.map((n)=>$.jsxDEV(p.default.Fragment,{children:Y1(J==="vendor"&&U===n,$.jsxDEV(a1,{vendor:n},void 0,!1,void 0,this),M1(n),`vendors/${n}`,D(["vendors",n]),t(n)?String(t(n)):void 0)},n,!1,void 0,this)),$.jsxDEV("p",{className:"side-group",children:"Remote"},void 0,!1,void 0,this),Y1(!1,$.jsxDEV(C1,{name:"cloud",size:16},void 0,!1,void 0,this),U1?"origin":"Name a remote…","remote",D(["remote"]),J1?`↑${J1}`:void 0)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-main",role:"main",children:[J==="changes"?$.jsxDEV("div",{className:"ws-status",children:[$.jsxDEV("div",{className:"ws-files",children:[$.jsxDEV(PQ,{name:_,view:"changes",changes:s.length,changesets:b.state==="ok"?b.data.changesets.length:0},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-list-head",children:[$.jsxDEV("span",{children:"Not in a changeset"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:y.state==="ok"?`${c1(s.length,"record")} · ${c1(e,"write")}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(Z0,{load:y,what:"the changes",lines:4},void 0,!1,void 0,this),$.jsxDEV(IQ,{records:s,...o?{selected:o.key}:{},onPick:V,label:"Changed records"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-detail",children:[y.state==="ok"&&!o?$.jsxDEV(H5,{title:"No changes on this branch",action:J1>0&&U1?$.jsxDEV("button",{type:"button",className:"primary",disabled:Boolean(W1)||k.busy!==null,onClick:()=>void k.push(),children:["Push ",c1(J1,"changeset")," to origin"]},void 0,!0,void 0,this):void 0,children:$.jsxDEV("p",{children:["What your app writes to this World lands here, record by record, to cut into a changeset. Everything since ",y.data.base.at?$.jsxDEV(D1,{iso:y.data.base.at},void 0,!1,void 0,this):$.jsxDEV("code",{children:y.data.base.id},void 0,!1,void 0,this)," is in one already."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,o?$.jsxDEV(OQ,{record:o,history:l.state==="ok"?l.data.entries:l.state==="error"?[]:null},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(RF,{pinned:!0,generated:v.state==="ok"&&v.data.changesets.summary==="generated",author:{face:$.jsxDEV(C1,{name:Z.person?"user":Z.local?"monitor":"key-round",size:18},void 0,!1,void 0,this),who:Z.person??(Z.local?"This machine":Z.admin?"The host's admin":"A token"),account:`${O1}/${_}/~/settings/account`,branch:Q1},name:_,token:Q,changes:e,canWrite:B,refused:N,onCut:()=>{r((n)=>n+1),V(null)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,J==="history"?$.jsxDEV(rZ,{name:_,token:Q,sets:b,changes:s.length,withScreens:m,required:v.state==="ok"?v.data.changesets.approvals??1:1,...q?{sub:q}:{},signsAs:A,canWrite:B,rooted:h,refused:N,onChanged:()=>r((n)=>n+1)},void 0,!1,void 0,this):null,J==="events"?$.jsxDEV(iZ,{name:_,token:Q,vendors:P,...U&&P.includes(U)?{vendor:U}:{},tick:O},U??"",!1,void 0,this):null,J==="trace"?$.jsxDEV(dZ,{name:_,token:Q,id:U??""},void 0,!1,void 0,this):null,J==="vendor"&&U?$.jsxDEV(aZ,{name:_,token:Q,vendor:U,withScreens:m.includes(U),tick:O},U,!1,void 0,this):null,J==="screen"&&U?$.jsxDEV(sZ,{name:_,vendor:U,url:W.state==="ok"?u.get(U)??null:void 0,...W.state==="error"?{mapError:W.error}:{},holding:_F(W.state==="ok"?W.data.twins.find((n)=>n.twin===U)?.resources??[]:[]),session:H,retry:L},U,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(O0,{open:G?.kind==="settings",onClose:()=>D(["changes"])(),title:"Settings",wide:"window",children:G?.kind==="settings"?$.jsxDEV("div",{className:"ws-settings",children:[$.jsxDEV("nav",{"aria-label":"Settings",children:RQ.map(([n,T1,Z1])=>$.jsxDEV("a",{href:`${O1}/${_}/~/settings/${n}`,className:G.tab===n?"on":void 0,"aria-current":G.tab===n?"page":void 0,onClick:D(["settings",n]),children:[$.jsxDEV(C1,{name:Z1,size:16},void 0,!1,void 0,this),T1]},n,!0,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-settings-pane",children:[w==="read"?$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("span",{className:"badge read-only",children:"Read only"},void 0,!1,void 0,this)," This session reads the World; it changes nothing."]},void 0,!0,void 0,this):null,G.tab==="account"?$.jsxDEV(oZ,{who:Z,scope:w,snapshot:F,portal:F0(),onSignOut:Y},void 0,!1,void 0,this):null,G.tab==="changesets"?$.jsxDEV(tZ,{name:_,token:Q,who:Z,scope:w},void 0,!1,void 0,this):null,G.tab==="remote"?$.jsxDEV(IF,{name:_,token:Q,canWrite:B,tick:O,refused:N},void 0,!1,void 0,this):null,G.tab==="access"||G.tab==="services"||G.tab==="checks"||G.tab==="clock"?$.jsxDEV(NF,{name:_,token:Q,admin:C,canWrite:B,refused:N,onRemoved:f,only:G.tab},void 0,!1,void 0,this):null,G.tab==="vault"?$.jsxDEV(PF,{name:_,token:Q,canWrite:B,refused:N},void 0,!1,void 0,this):null,G.tab==="appearance"?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Appearance"},void 0,!1,void 0,this),$.jsxDEV(bZ,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this),$.jsxDEV(O0,{open:G?.kind==="branches",onClose:()=>D(["changes"])(),title:"Branches",wide:!0,children:G?.kind==="branches"?$.jsxDEV($F,{name:_,token:Q,canWrite:B,branches:I,opens:R,...G.open?{open:G.open}:{},onChanged:S,refused:N},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function C8({text:_}){return $.jsxDEV("button",{type:"button",className:"agent-prompt-button",onClick:()=>{navigator.clipboard?.writeText(_).then(()=>p1("Copied the prompt: paste it into your coding agent"),()=>p1("Could not copy the prompt","error"))},children:"Copy a prompt for your coding agent"},void 0,!1,void 0,this)}var D8=(_)=>`${_.url.replace(/\/+$/,"")}/${_.namespace}`,eZ=(_)=>_.filter((Q)=>Q.applied===null||Q.applied.outcome==="refused"),_F=(_,Q=4)=>{let J=[..._].filter((q)=>q.count>0).sort((q,U)=>U.count-q.count);return J.length?J.slice(0,Q).map((q)=>c1(q.count,q.type.replace(/^_+/,""))).join(" · ")+(J.length>Q?` · +${J.length-Q} more`:""):"nothing yet"},NQ=$.jsxDEV("svg",{className:"branch-glyph",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:$.jsxDEV("path",{fill:"currentColor",d:"M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm0 2.122a2.25 2.25 0 1 0-1.5 0v5.256a2.25 2.25 0 1 0 1.5 0V9.5h4.25A2.25 2.25 0 0 0 11.5 7.25v-.878a2.25 2.25 0 1 0-1.5 0v.878a.75.75 0 0 1-.75.75H5V5.372ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm6.5-9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this);function QF({name:_,token:Q,clock:J,canWrite:q,onChanged:U,refused:G,open:Z}){let[F,X]=p.useState(!1),[Y,K]=p.useState(""),[H,L]=p.useState(""),[z,W]=p.useState(null),[I,M]=p.useState(!1),B=J.state==="ok"?J.data:null,N=async(C,f,S)=>{M(!0),W(null);try{let w=await y1(Q,`/-/${_}/${f}`,{method:f==="clock"?"PUT":"POST",body:JSON.stringify(S)});if(!w.ok){G(w),W({ok:!1,text:await K0(w)});return}let k=await w.json();W({ok:!0,text:`${C} — the World is at ${new Date(k.at).toLocaleString()}`}),X(!1),U()}catch(w){W({ok:!1,text:`the World did not answer: ${w instanceof Error?w.message:String(w)}`})}finally{M(!1)}},A=(C)=>{C.preventDefault();let f=new Date(Y);if(Number.isNaN(f.getTime())){W({ok:!1,text:"Pick a date and time."});return}if(B&&f.getTime()<Date.parse(B.at)){W({ok:!1,text:`The World's clock only moves forward: pick a time after ${new Date(B.at).toLocaleString()}.`});return}N("Clock set","clock",{at:f.toISOString()})},R=(C,f)=>{N(`Advanced ${f}`,"clock/advance",{by:C})},O=[["1h","1 hour"],["1d","1 day"],["7d","1 week"],["30d","30 days"]];return $.jsxDEV("div",{className:`clock${B?.frozen?" frozen":""}`,role:"region","aria-label":"World clock",children:[$.jsxDEV("p",{className:"clock-now",children:J.state==="loading"?$.jsxDEV("span",{className:"mode",children:"clock…"},void 0,!1,void 0,this):J.state==="error"?$.jsxDEV("span",{className:"mode",children:["Clock: ",J.error]},void 0,!0,void 0,this):B.frozen?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"badge",children:"Simulation"},void 0,!1,void 0,this)," World time ",$.jsxDEV("strong",{children:$.jsxDEV(D1,{iso:B.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV($.Fragment,{children:["World time ",$.jsxDEV("strong",{children:$.jsxDEV(D1,{iso:B.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"· real time"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q&&B?$.jsxDEV("details",{className:Z?"clock-more inline":"clock-more",open:Z||void 0,children:[$.jsxDEV("summary",{children:"Simulate time…"},void 0,!1,void 0,this),$.jsxDEV("div",{className:Z?void 0:"popover",children:[$.jsxDEV("p",{className:"mode",children:"Move this World's clock forward to see what happens later: renewals, expiries, scheduled sends. Like a test clock, it only moves forward; to look back, the branch picker’s Manage branches… views an earlier moment."},void 0,!1,void 0,this),$.jsxDEV("div",{className:"clock-controls",children:[$.jsxDEV("button",{type:"button","aria-expanded":F,onClick:()=>{X(!F),K(Y5(QQ(B.at))),W(null)},children:"Set time…"},void 0,!1,void 0,this),$.jsxDEV("div",{role:"group","aria-label":"Advance the clock",className:"advance",children:[$.jsxDEV("span",{className:"mode",children:"Advance"},void 0,!1,void 0,this),O.map(([C,f])=>$.jsxDEV("button",{type:"button","aria-label":`Advance ${f}`,disabled:I||!B.frozen,title:B.frozen?void 0:"Set the time first: advancing moves a set clock",onClick:()=>R(C,f),children:f},C,!1,void 0,this)),$.jsxDEV("form",{className:"inline",onSubmit:(C)=>{if(C.preventDefault(),!/^\d+[smhd]$/.test(H.trim())){W({ok:!1,text:"Advance by a number and a unit: 90m, 12h, 3d."});return}R(H.trim(),`by ${H.trim()}`)},children:[$.jsxDEV("label",{className:"sr",children:["Advance by ",$.jsxDEV("input",{name:"advanceBy",value:H,onChange:(C)=>L(C.target.value),placeholder:"90m, 12h, 3d",size:9,disabled:!B.frozen},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",disabled:I||!B.frozen,children:"Advance"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!B.frozen?$.jsxDEV("p",{className:"mode",children:"The World runs on real time. Set a time to start simulating; then advance it."},void 0,!1,void 0,this):null,F?$.jsxDEV("form",{className:"inline","aria-label":"Set the World time",onSubmit:A,noValidate:!0,children:[$.jsxDEV("label",{children:["World time ",$.jsxDEV("input",{name:"worldTime",type:"datetime-local",value:Y,min:Y5(QQ(B.at)),onChange:(C)=>K(C.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:Intl.DateTimeFormat().resolvedOptions().timeZone},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",disabled:I,children:"Set time"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>X(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,z?$.jsxDEV("p",{role:z.ok?"status":"alert",children:z.text},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function JF({name:_,token:Q,clock:J,refused:q}){let[U,G]=p.useState(!1),[Z,F]=p.useState(""),[X,Y]=p.useState(null),[K,H]=p.useState(!1),L=J.state==="ok"?J.data.at:new Date().toISOString(),z=p.useRef(null);return p.useEffect(()=>{if(!U)return;let I=(B)=>{if(B.key==="Escape"&&!document.querySelector("dialog[open]"))G(!1),z.current?.querySelector("button")?.focus()},M=(B)=>{if(!z.current?.contains(B.target))G(!1)};return document.addEventListener("keydown",I),document.addEventListener("click",M),()=>{document.removeEventListener("keydown",I),document.removeEventListener("click",M)}},[U]),$.jsxDEV("div",{className:"as-of",ref:z,children:[$.jsxDEV("button",{type:"button","aria-expanded":U,title:"Open a read-only copy of this World as it was at a moment you pick",onClick:()=>{G(!U),F(Y5(L)),Y(null)},children:"View an earlier moment…"},void 0,!1,void 0,this),U?$.jsxDEV("form",{className:"inline","aria-label":"View the World as of a past moment",onSubmit:async(I)=>{I.preventDefault(),Y(null);let M=new Date(Z);if(Number.isNaN(M.getTime())){Y("Pick a date and time.");return}if(M.getTime()>Date.parse(L)){Y(`That is after the World's present (${new Date(L).toLocaleString()}); a snapshot looks back.`);return}H(!0);try{let B=await y1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:M.toISOString()},ttl:3600})});if(!B.ok){q(B),Y(await K0(B));return}let N=await B.json();v8({name:N.name,parent:_,token:N.token,readToken:N.readToken,at:M.toISOString(),expiresAt:N.expiresAt??null,parentOrigin:j1,made:!0});let A=$4(N.origin)?.origin;if(A&&A!==j1){h8(A,N.readToken,N.name,`${O1}/${N.name}`);return}h1(N.name.split("/"))}catch(B){Y(`the World did not answer: ${B instanceof Error?B.message:String(B)}`)}finally{H(!1)}},noValidate:!0,children:[$.jsxDEV("label",{children:["As of ",$.jsxDEV("input",{name:"asOf",type:"datetime-local",value:Z,max:Y5(L),onChange:(I)=>F(I.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",disabled:K,children:K?"Opening…":"Open snapshot"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Opens a read-only copy of this World as it was then; the copy goes away within the hour."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,X?$.jsxDEV("p",{role:"alert",children:X},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function wQ({name:_,token:Q,open:J,onClose:q,onMade:U,refused:G}){let Z=(f)=>f.split("/").pop()??f,[F,X]=p.useState(!1),[Y,K]=p.useState(null),[H,L]=p.useState(""),[z,W]=p.useState("now"),[I,M]=p.useState(""),[B,N]=p.useState("24"),[A,R]=p.useState(!0);p.useEffect(()=>{if(J)K(null),M(Y5(new Date().toISOString()))},[J]);let O=async(f)=>{f.preventDefault(),K(null);let S=z==="at"?new Date(I):null;if(S&&Number.isNaN(S.getTime())){K("Pick a date and time, or make it as of now.");return}if(S&&S.getTime()>Date.now()){K("A branch is made as of now or a moment before it.");return}X(!0);let w=await y1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({ttl:Math.round(Number(B)*3600),...S?{at:{instant:S.toISOString()}}:A?{live:!0}:{},...H.trim()?{label:H.trim()}:{}})}).catch(()=>null);if(X(!1),!w){K(`${j1} did not answer`);return}if(!w.ok){G(w),K(await K0(w));return}let k=await w.json();v8({name:k.name,parent:_,token:k.token??"",readToken:k.readToken,at:(S??new Date).toISOString(),expiresAt:k.expiresAt??null,parentOrigin:j1,...k.origin?{origin:k.origin}:{}}),q(),L(""),p1(`Made ${Z(k.name)}`),U()};return $.jsxDEV(O0,{open:J,onClose:()=>{if(!F)q()},title:`New branch of ${Z(_)}`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>q(),disabled:F,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"new-branch",className:"primary",disabled:F,children:F?"Making…":"Make branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"new-branch",onSubmit:(f)=>void O(f),className:"stack",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Label ",$.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("input",{name:"branchLabel",value:H,onChange:(f)=>L(f.target.value.toLowerCase()),placeholder:"checkout-flow",pattern:"[a-z0-9][a-z0-9\\-]{0,23}",maxLength:24},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("fieldset",{className:"choice",children:[$.jsxDEV("legend",{children:"From"},void 0,!1,void 0,this),$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"branchWhen",checked:z==="now",onChange:()=>W("now")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Now: the World as it is"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z==="now"?$.jsxDEV("label",{className:"check sub",children:[$.jsxDEV("input",{type:"checkbox",name:"branchLive",checked:A,onChange:(f)=>R(f.target.checked)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Live: its clock keeps this World's time, as a pull request's preview does (else it stops now)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"branchWhen",checked:z==="at",onChange:()=>W("at")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"An instant before now: the World as it was then, its clock stopped there"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z==="at"?$.jsxDEV("input",{type:"datetime-local","aria-label":"As of",value:I,max:Y5(new Date().toISOString()),onChange:(f)=>M(f.target.value)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Goes away after"},void 0,!1,void 0,this),$.jsxDEV("select",{name:"branchLife",value:B,onChange:(f)=>N(f.target.value),children:[$.jsxDEV("option",{value:"1",children:"1 hour"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"24",children:"1 day"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"72",children:"3 days"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"168",children:"7 days"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y?$.jsxDEV("p",{role:"alert",children:Y},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function $F({name:_,token:Q,canWrite:J,branches:q,opens:U,open:G,onChanged:Z,refused:F,snapshotOf:X}){let Y=V1(Q,`/-/${_}/clock`),K=(N)=>N.split("/").pop()??N,[H,L]=p.useState(!1),z=(N)=>(A)=>{A.preventDefault(),h1([..._.split("/"),"~","branches",...N?N.split("/"):[]])};if(!q)return $.jsxDEV("p",{className:"mode",children:"This host makes no branches of a World."},void 0,!1,void 0,this);let W=q.state==="ok"?q.data.branches:[],I=q.state==="ok"&&(q.data.named?.length??0)>0?q.data.named:[{name:K(_),running:!0}],M=q.state==="ok"?q.data.checkedOut??K(_):K(_),B=async(N)=>{if(!await c0({title:`Remove the branch ${K(N)}?`,body:"Whoever holds its tokens loses it, and its history goes with it.",action:"Remove branch",danger:!0}))return;let A=await y1(Q,`/-/${_}/branches/${N}`,{method:"DELETE"}).catch((R)=>R);if(A instanceof Error){p1(`Remove ${K(N)}: the World did not answer (${A.message})`,"error");return}if(!A.ok){F(A),p1(`Remove ${K(N)}: ${await K0(A)}`,"error");return}U3(N),p1(`Removed ${K(N)}`),Z(),h1([..._.split("/"),"~","branches"])};if(G){let N=G.includes("/")?W.find((R)=>R.name===G):void 0,A=G.includes("/")?void 0:I.find((R)=>R.name===G);return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"crumbs-line",children:$.jsxDEV("a",{href:`${O1}/${_}/~/branches`,onClick:z(),children:"← Branches"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(Z0,{load:q,what:"the branches"},void 0,!1,void 0,this),q.state==="ok"&&!N&&!A?$.jsxDEV("p",{className:"mode",children:["This World has no branch named ",G,"."]},void 0,!0,void 0,this):null,N?$.jsxDEV(qF,{name:_,b:N,canWrite:J,opens:U(N.name),remove:()=>void B(N.name)},void 0,!1,void 0,this):null,A&&!N?$.jsxDEV(UF,{name:_,token:Q,b:A,served:A.name===M,canWrite:J,canServe:q.state==="ok"&&Boolean(q.data.canServe)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}return $.jsxDEV("div",{"aria-labelledby":"branches",children:[$.jsxDEV("div",{className:"branches-head",children:[$.jsxDEV("p",{className:"lede",children:["Branch this World to look at it as it was, or to change it without touching ",$.jsxDEV("b",{children:M},void 0,!1,void 0,this),". Each branch's name opens its page."]},void 0,!0,void 0,this),J?$.jsxDEV("div",{className:"head-actions",children:[X?null:$.jsxDEV(JF,{name:_,token:Q,clock:Y,refused:F},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>L(!0),children:"New branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(Z0,{load:q,what:"the branches"},void 0,!1,void 0,this),q.state==="ok"?$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Branches",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{id:"branches",children:"Branch"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Parent"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"As of"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Goes away"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:[I.map((N)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:[$.jsxDEV("a",{href:`${O1}/${_}/~/branches/${N.name}`,onClick:z(N.name),children:$.jsxDEV("b",{children:N.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.name===M?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("span",{className:"badge live",children:"served here"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):N.running?null:$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("span",{className:"badge",children:"stopped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"live"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:"kept"},void 0,!1,void 0,this)]},`own:${N.name}`,!0,void 0,this)),W.map((N)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("a",{href:`${O1}/${_}/~/branches/${N.name}`,onClick:z(N.name),children:$.jsxDEV("b",{children:K(N.name)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:K(N.from??_)},void 0,!1,void 0,this),$.jsxDEV("td",{children:N.at?.instant?$.jsxDEV(D1,{iso:N.at.instant},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"live"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV(D1,{iso:N.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:N.expiresAt?$.jsxDEV(D1,{iso:N.expiresAt},void 0,!1,void 0,this):"kept"},void 0,!1,void 0,this)]},N.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV(wQ,{name:_,token:Q,open:H,onClose:()=>L(!1),onMade:Z,refused:F},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qF({name:_,b:Q,canWrite:J,opens:q,remove:U}){let G=(X)=>X.split("/").pop()??X,Z=V8(Q.name),F=V1(Z,Z?`/-/${Q.name}/diff`:null);return $.jsxDEV("div",{className:"branch-page",children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("h3",{children:[NQ," ",G(Q.name)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:[q?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>TQ(Q.name,Q.name.split("/")),children:"Open"},void 0,!1,void 0,this):null,J?$.jsxDEV("button",{type:"button",className:"danger-button",onClick:U,children:"Remove…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"block",children:$.jsxDEV("dl",{className:"fields pad",children:[$.jsxDEV("dt",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV("code",{children:Q.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Parent"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:G(Q.from??_)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"As of"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:Q.at?.instant?$.jsxDEV(D1,{iso:Q.at.instant},void 0,!1,void 0,this):"live: it keeps its parent's time"},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(D1,{iso:Q.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Goes away"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:Q.expiresAt?$.jsxDEV(D1,{iso:Q.expiresAt},void 0,!1,void 0,this):"kept"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),!q?$.jsxDEV("p",{className:"mode",children:"Its tokens were handed to whoever made it: it opens, and shows its own changes, in their tab."},void 0,!1,void 0,this):null,F.state==="ok"?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h4",{children:"Its changes"},void 0,!1,void 0,this),F.data.changes.length===0?$.jsxDEV("p",{className:"mode",children:"Nothing written on it since it branched."},void 0,!1,void 0,this):$.jsxDEV(TF,{changes:F.data.changes,idPrefix:`branch-${G(Q.name)}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function UF({name:_,token:Q,b:J,served:q,canWrite:U,canServe:G}){let[Z,F]=p.useState(!1),[X,Y]=p.useState(null),K=async()=>{F(!0),Y(null);let H=await y1(Q,`/-/${_}/branches/${encodeURIComponent(J.name)}/serve`,{method:"POST"}).catch(()=>null);if(H?.ok){location.reload();return}F(!1),Y(H?await K0(H):`${j1} did not answer`)};return $.jsxDEV("div",{className:"branch-page",children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("h3",{children:[NQ," ",J.name," ",q?$.jsxDEV("span",{className:"badge live",children:"served here"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:U&&G&&!q?$.jsxDEV("button",{type:"button",className:"primary",disabled:Z,onClick:()=>void K(),children:Z?"Switching…":"Serve here"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"block",children:$.jsxDEV("dl",{className:"fields pad",children:[$.jsxDEV("dt",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV("code",{children:J.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"Kind"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:"one of this World's own branches"},void 0,!1,void 0,this),$.jsxDEV("dt",{children:"State"},void 0,!1,void 0,this),$.jsxDEV("dd",{children:J.running?"running":"stopped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q?$.jsxDEV("p",{className:"mode",children:["This is the branch these pages show: its changes are on ",$.jsxDEV("a",{href:`${O1}/${_}/~/changes`,onClick:(H)=>{H.preventDefault(),h1([..._.split("/"),"~","changes"])},children:"Changes"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this):G?$.jsxDEV("p",{className:"mode",children:["“Serve here” stops this one's twins and serves ",J.name," in its place."]},void 0,!0,void 0,this):$.jsxDEV("p",{className:"mode",children:"This host serves one of the World's own branches at a time, and does not switch them from this page."},void 0,!1,void 0,this),X?$.jsxDEV("p",{role:"alert",children:X},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var UQ=50,K5=(_)=>`${_.twin}:${_.position}`,fQ=(_,Q)=>Date.parse(Q.entry.occurredAt)-Date.parse(_.entry.occurredAt)||_.twin.localeCompare(Q.twin)||Q.position-_.position,G3=(_)=>{if(!_)return"someone";if(_.startsWith("key:")){let[Q,J]=_.slice(4).split(" for:");return J?`${Q}, for ${J}`:Q||"a key"}if(_.startsWith("person:"))return _.slice(7);return _==="machine"?"this machine":_==="person"?"a session with no name":_==="token:read"?"the read-only token":_==="token"?"the World's token":_},Q4=(_,Q)=>{let J=typeof Q==="string"?Q:typeof _.caller==="string"?_.caller:"";if(J.startsWith("key:")&&J.length>4)return`by ${G3(J)}`;if(J.startsWith("person:")&&J.length>7)return`by ${J.slice(7)}`;if(J==="machine")return"by this machine";if(J==="person")return"by a session with no name";if(J==="key")return"by a key";if(J==="token:read")return"by the read-only token";if(J==="token")return"by the World's token";return _.actor?.kind==="system"?"by the vendor":_.actor?.id?`by ${_.actor.id}`:"by an app"},CQ=(_)=>_.operation??_.op;function GF(_){let Q=_.fields??{},J=Q.usage!==null&&typeof Q.usage==="object"?Q.usage:Q,q=(...Y)=>Y.map((K)=>J[K]??Q[K]).find((K)=>typeof K==="number"),U=[],G=q("prompt_tokens","input_tokens"),Z=q("completion_tokens","output_tokens"),F=q("total_tokens");if(G!==void 0)U.push(["tokens in",G.toLocaleString()]);if(Z!==void 0)U.push(["tokens out",Z.toLocaleString()]);if(F!==void 0)U.push(["tokens in all",F.toLocaleString()]);let X=q("cost_usd","cost");if(X!==void 0)U.push(["cost",`$${X<0.01?X.toPrecision(2):X.toFixed(2)}`]);return U}function SQ({text:_,at:Q=280}){if(_.length<=Q)return $.jsxDEV("span",{className:"text",children:_},void 0,!1,void 0,this);return $.jsxDEV("details",{className:"folded",children:[$.jsxDEV("summary",{children:[$.jsxDEV("span",{className:"text",children:[_.slice(0,Q),"…"]},void 0,!0,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:["show all ",_.length.toLocaleString()," characters"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"text",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function U2({v:_}){if(typeof _==="string")return $.jsxDEV(SQ,{text:_},void 0,!1,void 0,this);if(_===null||typeof _!=="object")return $.jsxDEV("code",{children:String(_)},void 0,!1,void 0,this);let Q=JSON.stringify(_,null,2);return Q.length<=160?$.jsxDEV("code",{children:JSON.stringify(_)},void 0,!1,void 0,this):$.jsxDEV("details",{className:"folded",children:[$.jsxDEV("summary",{children:$.jsxDEV("code",{children:[JSON.stringify(_).slice(0,120),"…"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("pre",{children:Q},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var ZF=(_)=>typeof _==="string"?_:Array.isArray(_)?_.map((Q)=>Q&&typeof Q==="object"&&typeof Q.text==="string"?Q.text:"").filter(Boolean).join(`
|
|
36
|
+
`):JSON.stringify(_??"");function FF({body:_}){if(_===null||typeof _!=="object"||Array.isArray(_))return $.jsxDEV(U2,{v:_},void 0,!1,void 0,this);let Q=_,J=Array.isArray(Q.messages)?Q.messages:null,q=Object.entries(Q).filter(([U])=>!(J&&U==="messages"));return $.jsxDEV($.Fragment,{children:[q.length?$.jsxDEV("dl",{className:"fields",children:q.map(([U,G])=>$.jsxDEV(p.default.Fragment,{children:[$.jsxDEV("dt",{children:U},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(U2,{v:G},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},U,!0,void 0,this))},void 0,!1,void 0,this):null,J?$.jsxDEV("ol",{className:"messages",children:J.map((U,G)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:"role",children:typeof U.role==="string"?U.role:"message"},void 0,!1,void 0,this),$.jsxDEV(SQ,{text:ZF(U.content)},void 0,!1,void 0,this)]},G,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function yQ({fields:_}){let Q=Object.entries(_??{});if(Q.length===0)return $.jsxDEV("p",{className:"mode",children:"No fields."},void 0,!1,void 0,this);return $.jsxDEV("dl",{className:"fields",children:Q.map(([J,q])=>$.jsxDEV(p.default.Fragment,{children:[$.jsxDEV("dt",{children:J},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(U2,{v:q},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},J,!0,void 0,this))},void 0,!1,void 0,this)}var HF=(_)=>_.receipt?`${_.receipt.status??""}${_.receipt.externalId?` · ${_.receipt.externalId}`:""}${_.receipt.reason?` · ${_.receipt.reason}`:""}`:_.operation==="observed"?"observed from the vendor":_.provenance==="placeholder"?"default data":"none: it has not left this World";function XF(_){let Q=new Map,J=[],q=[],U=new Map;for(let G of _){if(G.entry.landsId||G.entry.aliasOf){q.push(G);continue}let Z={...G,copies:[]};if(J.push(Z),!Q.has(`${G.twin}:${G.entry.id}`))Q.set(`${G.twin}:${G.entry.id}`,Z);if(!U.has(`${G.twin}:${G.entry.subject.type}:${G.entry.subject.id}`))U.set(`${G.twin}:${G.entry.subject.type}:${G.entry.subject.id}`,Z)}for(let G of q){let Z=G.entry.landsId?Q.get(`${G.twin}:${G.entry.landsId}`):G.entry.aliasOf?U.get(`${G.twin}:${G.entry.subject.type}:${G.entry.aliasOf}`):void 0;if(Z)Z.copies.push(G);else J.push({...G,copies:[]})}return J.sort(fQ)}var S8={deployed:5,confirmed:4,landed:3,replayed:2,skipped:1};function GQ(_){let Q=[_.entry.receipt,..._.copies.map((U)=>U.entry.receipt)].filter((U)=>Boolean(U?.status));if(Q.length===0)return null;let J=Q.find((U)=>U.status==="failed"||U.status==="refused"),q=[...Q].sort((U,G)=>(S8[G.status]??0)-(S8[U.status]??0))[0];return J&&!(S8[q.status]>=5)?{status:J.status,bad:!0}:{status:q.status,bad:!1}}var V0=1280,l0=820,$3=160,f0=72,k8=120,KF=72,Z3="This World shows its branches' sites only on this machine.",l1=(_)=>`${_.vendor}:${_.id}`,E2=(_)=>`${_.vendor}:section:${_.section.id}`,g2=(_)=>[_.section.id,..._.section.aka??[]].map((Q)=>`${_.vendor}:section:${Q}`),X3=(_,Q)=>Q.at&&("site"in Q.at)?Q.at.site:Q.at?`${i0}/${_}/${Q.vendor}${Q.at.screen}`:null,kQ=(_,Q,J)=>J.at&&("screen"in J.at)?`${i0}/-/${_}/branches/${Q}/pages?${new URLSearchParams({land:`/${Q}/${J.vendor}${J.at.screen}`}).toString()}`:X3(Q,J),ZQ=(_,Q)=>_.include?Q.filter((J)=>_.include.includes(l1(J))||g2(J).some((q)=>_.include.includes(q))):Q.filter((J)=>!(_.hidden??[]).includes(l1(J)));function jQ({data:_}){let[Q,J]=p.useState(0),q=V1(_.token,`/-/${_.world}/twins/${_.vendor}/people`,Q),U=p.useRef(!1);if(q.state==="ok")U.current=q.data.viewAs;if(!U.current)return $.jsxDEV($.Fragment,{},void 0,!1,void 0,this);return $.jsxDEV("select",{className:"nodrag nopan frame-add",value:"","aria-label":`View ${M1(_.vendor)} as`,disabled:_.busy,onFocus:()=>J((G)=>G+1),onChange:(G)=>{if(G.target.value)_.choose(G.target.value==="signed-out"?null:G.target.value)},children:[$.jsxDEV("option",{value:"",children:_.busy?"Signing in…":_.label?`View as: ${_.label}`:"View as…"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"signed-out",children:"Signed out"},void 0,!1,void 0,this),q.state==="ok"?q.data.people.map((G)=>$.jsxDEV("option",{value:G.id,children:G.label},G.id,!1,void 0,this)):$.jsxDEV("option",{disabled:!0,children:q.state==="error"?q.error:"Loading people…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function YF({data:_}){let{frame:Q,url:J,active:q,picked:U,boards:G,addTo:Z,remove:F,compare:X,grab:Y,branch:K}=_,H=l1(Q),L=p.useRef(null),z=_.navigation?.frame===H?_.navigation:void 0;p.useEffect(()=>{if(!z)return;let M=new URL(z.url).origin,B=(N)=>{if(N.origin!==M||N.source!==L.current?.contentWindow||N.data?.type!=="volter-view-as"||N.data.pass!==z.pass)return;if(N.data.viewed?.vendor!==Q.vendor&&!N.data.error)return;z.done(N.data.viewed,N.data.error)};return window.addEventListener("message",B),()=>window.removeEventListener("message",B)},[z,Q.vendor]);let W=G.filter((M)=>M.include&&!M.include.includes(H)&&!g2(Q).some((B)=>M.include.includes(B))),I=S1((M)=>M.transform[2]*(f0+k8)>=KF);return $.jsxDEV($.Fragment,{children:[$.jsxDEV(O8,{isVisible:I||U||q,position:K1.Top,align:"start",className:"frame-label",children:[$.jsxDEV("span",{className:"frame-name",onPointerDown:Y,children:[$.jsxDEV(a1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:Q.title},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q.changes?$.jsxDEV("button",{type:"button",className:"frame-changed nodrag",onClick:()=>X(H),title:`${c1(Q.changes,"change")} ${K?"on this branch":"here, not in a changeset"}: compare`,children:[$.jsxDEV(C1,{name:"square-dot",size:14},void 0,!1,void 0,this),Q.changes]},void 0,!0,void 0,this):U?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>X(H),title:"Compare with a branch of this World","aria-label":`Compare ${Q.title} with a branch`,children:$.jsxDEV(C1,{name:"file-diff",size:14},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,U&&_.viewAs?$.jsxDEV(jQ,{data:_.viewAs},void 0,!1,void 0,this):null,U&&W.length?$.jsxDEV("select",{className:"nodrag frame-add",value:"","aria-label":`Add ${Q.title} to a board`,onChange:(M)=>{if(M.target.value)Z(M.target.value,H)},children:[$.jsxDEV("option",{value:"",children:"Add to board…"},void 0,!1,void 0,this),W.map((M)=>$.jsxDEV("option",{value:M.id,children:M.name},M.id,!1,void 0,this))]},void 0,!0,void 0,this):null,U&&F?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>F.act(H),title:F.label,"aria-label":F.label,children:"✕"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:q?"frame on":U?"frame picked":"frame",style:{width:V0,height:l0},children:[$.jsxDEV("div",{className:"frame-bar",children:[$.jsxDEV(a1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("strong",{children:[M1(Q.vendor)," · ",Q.kind]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"frame-url",children:Q.url.replace(/^https?:\/\//,"")},void 0,!1,void 0,this),J?$.jsxDEV("a",{className:"nodrag",href:J,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${Q.title} in a new tab`,children:"↗"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:q?"frame-body nodrag nopan nowheel":"frame-body",children:J?$.jsxDEV("iframe",{ref:L,title:Q.title,src:z?.url??J,loading:z?"eager":"lazy",style:{pointerEvents:q?"auto":"none"}},_.revision??0,!1,void 0,this):$.jsxDEV("div",{className:"frame-none",children:[$.jsxDEV("p",{children:$.jsxDEV("strong",{children:Q.unseen==="branch-sites"?Z3:Q.unseen==="sites-not-routed"?`This World shows ${Q.title} only at its own local address.`:`${M1(Q.vendor)}'s twin draws no page for this ${Q.kind} yet.`},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:Q.url},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function vQ({name:_,label:Q,done:J}){let q=p.useRef(!1),U=(G)=>{if(q.current)return;q.current=!0,J(G?.trim()&&G.trim()!==_?G.trim().slice(0,80):null)};return $.jsxDEV("input",{className:"nodrag nopan name-field","aria-label":Q,defaultValue:_,size:Math.max(8,_.length+2),autoFocus:!0,onFocus:(G)=>G.currentTarget.select(),onKeyDown:(G)=>{if(G.key==="Enter")U(G.currentTarget.value);else if(G.key==="Escape")U(null)},onBlur:(G)=>U(G.currentTarget.value)},void 0,!1,void 0,this)}function LF({data:_}){return $.jsxDEV($.Fragment,{children:[$.jsxDEV(l_,{isVisible:_.picked&&_.editable,minWidth:480,minHeight:360,color:"var(--accent)",onResizeEnd:_.resized},void 0,!1,void 0,this),$.jsxDEV(O8,{isVisible:!0,position:K1.Top,align:"start",offset:-30,className:"section-tag",children:[_.renaming?$.jsxDEV(vQ,{name:_.name,label:"Name this section",done:(Q)=>_.renamed(_.key,Q)},void 0,!1,void 0,this):$.jsxDEV("button",{type:"button",className:_.picked?"nodrag on":"nodrag",onPointerDown:_.grab,onClick:()=>_.pick(_.key),onDoubleClick:()=>{if(_.editable)_.rename(_.key)},title:_.editable?"Double-click to rename":void 0,children:[_.vendor?$.jsxDEV(a1,{vendor:_.vendor},void 0,!1,void 0,this):null,$.jsxDEV("span",{children:_.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.viewAs?$.jsxDEV(jQ,{data:_.viewAs},void 0,!1,void 0,this):null,_.picked&&_.editable&&!_.renaming?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>_.remove(_.key),"aria-label":`Remove the section ${_.name}`,title:"Remove the section (its frames stay)",children:"✕"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:_.picked?"section-box on":"section-box"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FQ({url:_,title:Q}){return $.jsxDEV("div",{className:"compare-thumb",style:{width:420,height:420*l0/V0},children:$.jsxDEV("iframe",{title:Q,src:_,loading:"lazy",style:{width:V0,height:l0,transform:`scale(${420/V0})`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function zF({name:_,token:Q,frame:J,onClose:q,reads:U,viewing:G=""}){let[Z,F]=p.useState(G?"world":J.since?"before":""),[X,Y]=p.useState({state:"opening"}),[K,H]=p.useState(null),L=p.useRef(new Set),z=V1(Q,`/-/${_}/branches`,U),W=z.state==="ok"?z.data.branches.filter((O)=>O.name!==G&&O.name!==K&&!L.current.has(O.name)):[],I=V1(Q,G?`/-/${_}/board`:null,U),M=I.state==="ok"?I.data.frames.find((O)=>l1(O)===l1(J)):void 0,B=V1(Q,`/-/${_}/${G?`branches/${G}/`:""}board/changes?frame=${encodeURIComponent(l1(J))}`,U),N=async(O,C,f)=>{let S=J.at;if("site"in S){let E=new URL(J.url),r=C&&/^https?:\/\/\{host\}\./.test(C)?C.replace("{host}",E.hostname.toLowerCase()):null;return r?{url:`${r}${E.pathname}${E.search}`}:{why:Z3}}let w=`${i0}/-/${_}/branches/${O}/pages?${new URLSearchParams({land:`/${O}/${J.vendor}${S.screen}`}).toString()}`,k=await fetch(w,{credentials:"same-origin",redirect:"manual"}).catch(()=>null);if(f())return{why:""};return k?.type==="opaqueredirect"?{url:w}:{why:`This World does not show its branches' pages${k?`: ${await K0(k)}`:""}.`}};p.useEffect(()=>{if(Z==="world"){if(I.state==="loading"){Y({state:"opening"});return}let E=M?X3(_,M):null;Y(E?{state:"ok",url:E}:{state:"none",why:I.state==="error"?I.error:"The World has no page here to show."});return}if(!J.at){Y({state:"none",why:J.unseen==="branch-sites"?Z3:`${M1(J.vendor)}'s twin draws no page for this ${J.kind} yet; its changes are listed below.`});return}if(Z===""){Y({state:"none",why:"Choose a branch of this World to set beside it."});return}let O=!1;if(Z!=="before"){Y({state:"opening"});let E=z.state==="ok"?z.data.branches.find((c)=>c.name===Z):void 0,r=setTimeout(()=>void N(Z,E?.sites??null,()=>O).then((c)=>{if(!O)Y("url"in c?{state:"ok",url:c.url}:{state:"none",why:c.why})}),300);return()=>{O=!0,clearTimeout(r)}}if(!J.since){Y({state:"none",why:"Nothing here has changed since the World was last cut."});return}Y({state:"opening"});let C=new Date(Date.parse(J.since)-1).toISOString(),f=null,S=setTimeout(()=>void(async()=>{let E=await y1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:C},ttl:3600}),signal:AbortSignal.timeout(60000)}).catch(()=>null);if(!E?.ok){Y({state:"none",why:`The World made no copy of itself as it was then${E?`: ${await K0(E)}`:""}.`});return}let r=await E.json();if(f=r.name,H(r.name),L.current.add(r.name),O){y1(Q,`/-/${_}/branches/${r.name}`,{method:"DELETE"}).catch(()=>null);return}let c=await N(r.name,r.sites??null,()=>O);if(!O)Y("url"in c?{state:"ok",url:c.url,at:C}:{state:"none",why:c.why})})(),500),w=()=>{if(f)y1(Q,`/-/${_}/branches/${f}`,{method:"DELETE",keepalive:!0}).catch(()=>null);f=null},k=(E)=>{if(!E.persisted)w()};return window.addEventListener("pagehide",k),()=>{O=!0,clearTimeout(S),window.removeEventListener("pagehide",k),w(),H(null)}},[_,Q,J.vendor,J.id,J.since,Z,I.state,JSON.stringify(M?.at)]);let A=G?kQ(_,G,J):X3(_,J),R=!J.at||Z!==""?null:z.state==="ok"&&W.length===0?"This World has no branches to set beside it: make one under Branches.":z.state==="error"?`The World's branches could not be read: ${z.error}`:null;return $.jsxDEV("div",{className:"compare",role:"dialog","aria-label":`Changes to ${J.title}`,children:[$.jsxDEV("div",{className:"compare-head",children:[$.jsxDEV(a1,{vendor:J.vendor},void 0,!1,void 0,this),$.jsxDEV("strong",{children:J.title},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:J.changes?`${c1(J.changes,"change")} ${G?"on this branch":"not yet cut"}${J.since?`, since ${D2(J.since)}`:""}`:G?"No changes here on this branch":"No changes here not yet cut"},void 0,!1,void 0,this),J.at?$.jsxDEV("label",{className:"compare-base",children:["Compare with"," ",$.jsxDEV("select",{value:Z,onChange:(O)=>F(O.target.value),children:[Z===""?$.jsxDEV("option",{value:"",children:"Choose a branch…"},void 0,!1,void 0,this):null,G?$.jsxDEV("option",{value:"world",children:"The World"},void 0,!1,void 0,this):null,!G&&(J.since||Z==="before")?$.jsxDEV("option",{value:"before",children:"Before these changes"},void 0,!1,void 0,this):null,Z&&Z!=="before"&&Z!=="world"&&!W.some((O)=>O.name===Z)?$.jsxDEV("option",{value:Z,children:Z.split("/")[1]},void 0,!1,void 0,this):null,W.map((O)=>$.jsxDEV("option",{value:O.name,children:[O.name.split("/")[1],O.at?.label?` (${O.at.label})`:O.at?.instant?` (as of ${D2(O.at.instant)})`:O.at?.live?" (live)":""]},O.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("button",{type:"button",className:"ghost",onClick:q,"aria-label":"Close the comparison",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"compare-sides",children:[$.jsxDEV("figure",{children:[$.jsxDEV("figcaption",{children:Z==="before"?`Before${X.state==="ok"&&X.at?` · as of ${D2(X.at)}`:""}`:Z==="world"?"The World":Z?Z.split("/")[1]:"A branch"},void 0,!1,void 0,this),R?$.jsxDEV("p",{className:"mode compare-note",children:R},void 0,!1,void 0,this):X.state==="ok"?$.jsxDEV(FQ,{url:X.url,title:`${J.title} before`},void 0,!1,void 0,this):X.state==="opening"?$.jsxDEV("p",{className:"mode compare-note",role:"status",children:"Opening the World as it was…"},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode compare-note",children:X.why},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("figure",{children:[$.jsxDEV("figcaption",{children:G?`${G.split("/")[1]} · branch`:"Now"},void 0,!1,void 0,this),A?$.jsxDEV(FQ,{url:A,title:`${J.title} now`},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode compare-note",children:J.unseen==="branch-sites"?Z3:`${M1(J.vendor)}'s twin draws no page for this ${J.kind} yet.`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),B.state==="error"?$.jsxDEV("p",{role:"alert",className:"mode",children:["Its changes could not be read: ",B.error]},void 0,!0,void 0,this):null,Z!=="before"&&Z&&B.state==="ok"&&B.data.acts.length?$.jsxDEV("p",{className:"mode compare-acts-head",children:G?"This branch’s changes here:":"This World's own changes here, not yet cut:"},void 0,!1,void 0,this):null,$.jsxDEV("ol",{className:"compare-acts",children:(B.state==="ok"?B.data.acts:[]).map((O)=>{let C=O.entries[0],f=C0({...C,service:J.vendor,id:"",occurredAt:O.at});return $.jsxDEV("li",{children:[$.jsxDEV("span",{className:"mode",children:D2(O.at)},void 0,!1,void 0,this),$.jsxDEV("details",{children:[$.jsxDEV("summary",{children:[$.jsxDEV("strong",{children:f.what},void 0,!1,void 0,this),f.label?` · ${f.label}`:"",O.writes>1?$.jsxDEV("span",{className:"mode",children:[" and ",c1(O.writes-1,"more write")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:[O.entries.map((S,w)=>$.jsxDEV("li",{children:[$.jsxDEV("code",{children:S.operation??S.op},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[S.subject.type," ",q2(S)]},void 0,!0,void 0,this)]},w,!0,void 0,this)),O.writes>O.entries.length?$.jsxDEV("li",{className:"mode",children:["and ",c1(O.writes-O.entries.length,"more write")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},`${O.at}:${C.subject.type}:${C.subject.id}`,!0,void 0,this)})},void 0,!1,void 0,this),B.state==="ok"&&B.data.total>B.data.acts.length?$.jsxDEV("p",{className:"mode",children:["and ",c1(B.data.total-B.data.acts.length,"earlier change"),", in Changes"]},void 0,!0,void 0,this):null,!G?$.jsxDEV("a",{className:"compare-all",href:`${O1}/${_}/~/changes`,onClick:(O)=>{O.preventDefault(),h1([..._.split("/"),"~","changes"])},children:"Every change in the World →"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var WF={screen:YF,section:LF};function BF(_){let[Q,J]=p.useState(()=>new URLSearchParams(window.location.search).get("viewing")??"");return p.useEffect(()=>{let U=()=>J(new URLSearchParams(window.location.search).get("viewing")??"");return window.addEventListener("popstate",U),()=>window.removeEventListener("popstate",U)},[]),$.jsxDEV(R8,{children:$.jsxDEV(AF,{..._,viewing:Q,view:(U)=>{let G=new URL(window.location.href);if(U)G.searchParams.set("viewing",U);else G.searchParams.delete("viewing");window.history.pushState(null,"",G),window.dispatchEvent(new PopStateEvent("popstate"))}},void 0,!1,void 0,this)},`${_.name}:${Q}`,!1,void 0,this)}function AF({name:_,token:Q,session:J,retry:q,snapshot:U,back:G,canWrite:Z,viewing:F,view:X}){let Y=p.useRef(null),K=p.useRef(0),H=p.useRef(Promise.resolve()),L=p.useRef(0),[,z]=p.useState(0),[W,I]=p.useState({state:"loading"}),[M,B]=p.useState(null),[N,A]=p.useState(0),R=V1(Q,`/-/${_}/branches`,N),O=R.state==="ok"?R.data.branches.find((j)=>j.name===F):void 0,C=R.state==="ok"?R.data.branches.filter((j)=>!(j.at?.instant&&j.expiresAt&&!j.at.label)):[],f=p.useRef(0),S=p.useRef(0),w=p.useCallback(async()=>{let j=L.current,i=++f.current,q1=F?`branches/${F.split("/").map(encodeURIComponent).join("/")}/board`:"board",[G1,N1]=await Promise.all([y1(Q,`/-/${_}/${q1}`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),F?y1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null):Promise.resolve(null)]),H1=G1?.ok?await G1.json().catch(()=>null):null,z1=F?N1?.ok?await N1.json().catch(()=>null):null:H1;if(H1&&z1)H1.boards=z1.boards,H1.version=z1.version;if(i<S.current)return;if(S.current=i,!H1?.frames||!z1?.boards||!z1.version){let X1=!G1?.ok?G1:N1,I1=X1?`the World answered ${X1.status}`:"the World did not answer";I((v1)=>v1.state==="ok"?v1:{state:"error",status:X1?.status??0,error:I1}),B(I1);return}if(B(null),A((X1)=>X1+1),j===L.current&&K.current===0)Y.current={boards:H1.boards,version:H1.version};I({state:"ok",data:H1})},[Q,_,F]);p.useEffect(()=>{w();let j=setInterval(()=>{if(!document.hidden)w()},1e4);return()=>clearInterval(j)},[w]);let k=W.state==="ok"?W.data.frames.map((j)=>F&&j.at&&("site"in j.at)&&!/^https?:\/\/\{host\}\./.test(O?.sites??"")?{...j,at:null,unseen:"branch-sites"}:j):[],E=Y.current?.boards??[{id:"everything",name:"Everything"}],[r,c]=p.useState(null),y=k.some((j)=>j.changes),b=r??(y?"changes":"everything"),v=(b==="changes"?E[0]:E.find((j)=>j.id===b))??E[0],[x,V]=p.useState(new Set),D=Z&&!U&&!F,[P,u]=p.useState({}),[m,h]=p.useState({}),t=p.useRef(new Set),[Q1,s]=p.useState([]),o=p.useRef(new Set),l=p.useRef(!0);p.useEffect(()=>{return l.current=!0,()=>{l.current=!1;for(let j of o.current)clearTimeout(j)}},[]);let e=p.useCallback((j)=>{if(!D)return Promise.resolve();if(!Y.current)return p1("The board is being read again: make that change once it shows","error"),Promise.resolve();Y.current={...Y.current,boards:j(Y.current.boards)},K.current+=1,L.current+=1,z((q1)=>q1+1);let i=H.current.then(async()=>{let q1=Y.current;if(!q1)return;try{let G1=await y1(Q,`/-/${_}/board`,{method:"PUT",body:JSON.stringify({boards:q1.boards,version:q1.version}),signal:AbortSignal.timeout(15000)}),N1=await G1.json().catch(()=>null);if(G1.ok&&N1?.boards&&N1.version)Y.current={boards:K.current>1&&Y.current?Y.current.boards:N1.boards,version:N1.version};else if(G1.status===409&&N1?.boards&&N1.version)Y.current={boards:N1.boards,version:N1.version},p1("Someone else changed the board first: it is shown as they left it","error");else throw Error(N1?.error??`the World answered ${G1.status}`)}catch(G1){p1(`The board was not kept: ${G1 instanceof Error?G1.message:String(G1)}`,"error"),Y.current=null;let N1=await y1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),H1=N1?.ok?await N1.json().catch(()=>null):null;if(H1?.boards&&H1.version)Y.current={boards:H1.boards,version:H1.version}}}).finally(()=>{if(K.current-=1,L.current+=1,z((q1)=>q1+1),K.current===0&&!Y.current)w()});return H.current=i,i},[Q,_,w,D]),J1=(j,i)=>{e((q1)=>q1.map((G1)=>G1.id===j?i(G1):G1))},U1=(j)=>j.parent?`${j.vendor}:${j.parent}`:null,F1=new Set(k.map(l1)),W1=(j)=>{let i=U1(j);return!i||!F1.has(i)},Y1=b==="changes"?k.filter((j)=>j.changes):v.include?ZQ(v,k):ZQ(v,k).filter((j)=>W1(j)||x.has(U1(j))),B1=k.filter((j)=>j.changes&&!Y1.includes(j)).reduce((j,i)=>j+i.changes,0),[n,T1]=p.useState(null),[Z1,k1]=p.useState(null),[t1,_0]=p.useState(null),s1=o5(),I0=E.filter((j)=>j.include),S0=(j,i)=>J1(j,(q1)=>({...q1,include:[...q1.include??[],i]})),q0={label:v.include?"Take it off this board":"Hide it",act:(j)=>{k1(null),J1(v.id,(i)=>i.include?{...i,include:i.include.filter((q1)=>q1!==j)}:{...i,hidden:[...i.hidden??[],j]})}},x1=(j)=>({x:j.position.x,y:j.position.y,w:j.width??j.measured?.width??V0,h:j.height??j.measured?.height??l0}),Y0=(j,i)=>{let q1=x1(j),G1=q1.x+q1.w/2,N1=q1.y+q1.h/2;return i.filter((H1)=>H1.type==="section").map((H1,z1)=>({s:H1,i:z1})).filter(({s:H1})=>{let z1=x1(H1);return G1>=z1.x&&G1<=z1.x+z1.w&&N1>=z1.y&&N1<=z1.y+z1.h}).sort((H1,z1)=>x1(H1.s).w*x1(H1.s).h-x1(z1.s).w*x1(z1.s).h||z1.i-H1.i)[0]?.s},W0=p.useCallback(()=>{let j=new Map;for(let X1 of Y1){let I1=v.placed?.[l1(X1)];if(I1)j.set(l1(X1),I1)}let i=Math.max(-$3,...[...j.values()].map((X1)=>X1.y+l0)),q1=[...new Set(Y1.map(E2))];for(let X1 of q1){let I1=Y1.filter((b1)=>E2(b1)===X1),v1=I1.filter((b1)=>j.has(l1(b1))).map((b1)=>j.get(l1(b1))),R1=v1.length?Math.max(...v1.map((b1)=>b1.x))+V0+$3:0,r1=v1.length?Math.min(...v1.map((b1)=>b1.y)):i+$3+f0*2+k8;for(let b1 of I1)if(!j.has(l1(b1)))j.set(l1(b1),{x:R1,y:r1}),R1+=V0+$3;i=Math.max(i,r1+l0)}let G1=v.sections??{},N1=(X1,I1,v1,R1,r1)=>({id:`sec:${X1}`,type:"section",position:{x:I1.x,y:I1.y},width:I1.w,height:I1.h,zIndex:0,draggable:D,data:{key:X1,name:v1,vendor:R1,named:r1}}),H1=[];for(let X1 of q1){let I1=Y1.find((E1)=>E2(E1)===X1),v1=g2(I1).find((E1)=>G1[E1])??X1,R1=G1[v1];if(R1?.gone)continue;let r1=Y1.filter((E1)=>E2(E1)===X1).map((E1)=>j.get(l1(E1))),b1={x:Math.min(...r1.map((E1)=>E1.x))-f0,y:Math.min(...r1.map((E1)=>E1.y))-f0-k8,w:0,h:0};b1.w=Math.max(...r1.map((E1)=>E1.x))+V0+f0-b1.x,b1.h=Math.max(...r1.map((E1)=>E1.y))+l0+f0-b1.y;let M5=Y1.filter((E1)=>E2(E1)===X1&&!v.placed?.[l1(E1)]).map((E1)=>j.get(l1(E1))),T0=R1?{...R1}:b1;if(R1)for(let E1 of M5)T0.w=Math.max(T0.w,E1.x+V0+f0-T0.x),T0.h=Math.max(T0.h,E1.y+l0+f0-T0.y);H1.push(N1(v1,T0,R1?.name??`${M1(I1.vendor)} · ${I1.section.title}`,I1.vendor,Boolean(R1?.name)))}for(let[X1,I1]of Object.entries(G1))if(X1.startsWith("user:")&&!I1.gone)H1.push(N1(X1,I1,I1.name??"Section",null,!0));let z1=Y1.map((X1)=>({id:l1(X1),type:"screen",zIndex:1,width:V0,height:l0,draggable:D,position:j.get(l1(X1)),data:{world:_,branch:Boolean(F),frame:X1,url:F?kQ(_,F,X1):X3(_,X1)}}));return[...H1,...z1]},[JSON.stringify(Y1),JSON.stringify(v),_,D,F]),[B0,L0,G2]=b_([]),h0=S1((j)=>j.transform[2]),Z2=p.useRef("");p.useEffect(()=>{let j=W0();if(L0(j),j.length&&Z2.current!==b)Z2.current=b,requestAnimationFrame(()=>{s1.fitView({padding:{top:"72px",left:"272px",right:"40px",bottom:"72px"},duration:0})})},[W0,L0]);let F2=(j,i=[],q1={})=>{let G1=Object.fromEntries(i.map((H1)=>{let z1=s1.getNode(`sec:${H1}`);if(!z1)return[H1,void 0];let X1=x1(z1),I1=z1.data,v1=q1[H1]??(I1.named?I1.name:void 0);return[H1,{x:Math.round(X1.x),y:Math.round(X1.y),w:Math.round(X1.w),h:Math.round(X1.h),...v1?{name:v1.slice(0,80)}:{}}]}).filter(([,H1])=>H1!==void 0)),N1=Object.fromEntries(Object.entries(j).map(([H1,z1])=>[H1,{x:Math.round(z1.x),y:Math.round(z1.y)}]));J1(v.id,(H1)=>({...H1,placed:{...H1.placed??{},...N1},sections:{...H1.sections??{},...G1}}))},A0=p.useRef(null),T=(j,i)=>{if(i.type!=="section"){A0.current=null;return}let q1=s1.getNodes(),G1=x1(i),N1=(H1)=>{let z1=x1(H1);if(H1.type==="screen"){let X1=z1.x+z1.w/2,I1=z1.y+z1.h/2;return X1>=G1.x&&X1<=G1.x+G1.w&&I1>=G1.y&&I1<=G1.y+G1.h}return H1.id!==i.id&&z1.x>=G1.x&&z1.y>=G1.y&&z1.x+z1.w<=G1.x+G1.w&&z1.y+z1.h<=G1.y+G1.h};A0.current={id:i.id,from:{...i.position},members:q1.filter(N1).map((H1)=>({id:H1.id,x:H1.position.x,y:H1.position.y}))}},g=(j,i)=>{let q1=A0.current;if(!q1||q1.id!==i.id)return;let G1=i.position.x-q1.from.x,N1=i.position.y-q1.from.y,H1=new Map(q1.members.map((z1)=>[z1.id,z1]));L0((z1)=>z1.map((X1)=>{let I1=H1.get(X1.id);return I1?{...X1,position:{x:I1.x+G1,y:I1.y+N1}}:X1}))},_1=(j,i)=>{let q1=A0.current;A0.current=null;let G1=i.position.x-(q1?.from.x??i.position.x),N1=i.position.y-(q1?.from.y??i.position.y),H1=i.type==="screen"?[{id:i.id,x:i.position.x,y:i.position.y}]:(q1?.members??[]).map((z1)=>({...z1,x:z1.x+G1,y:z1.y+N1}));requestAnimationFrame(()=>{let z1=s1.getNodes(),X1=new Map(H1.filter((R1)=>!R1.id.startsWith("sec:")).map((R1)=>[R1.id,{x:R1.x,y:R1.y}])),I1=new Set([...i.type==="section"?[i.data.key]:[],...H1.filter((R1)=>R1.id.startsWith("sec:")).map((R1)=>R1.id.slice(4))]),v1=new Set(z1.filter((R1)=>X1.has(R1.id)).flatMap((R1)=>g2(R1.data.frame)));for(let R1 of z1){if(R1.type==="screen"&&g2(R1.data.frame).some((r1)=>v1.has(r1))&&!X1.has(R1.id))X1.set(R1.id,{x:R1.position.x,y:R1.position.y});if(R1.type==="section"&&v1.has(R1.data.key))I1.add(R1.data.key)}F2(Object.fromEntries(X1),[...I1])})},$1=(j)=>Object.fromEntries(s1.getNodes().filter((i)=>i.type==="screen"&&g2(i.data.frame).includes(j)).map((i)=>[i.id,{x:i.position.x,y:i.position.y}])),[L1,w1]=p.useState(null),P1=(j)=>{k1(`sec:${j}`),w1(j)},u1=(j,i)=>{if(w1(null),!i)return;L0((q1)=>q1.map((G1)=>G1.id===`sec:${j}`?{...G1,data:{...G1.data,name:i,named:!0}}:G1)),requestAnimationFrame(()=>F2($1(j),[j],{[j]:i}))},f1=(j)=>{k1(null);let i=s1.getNode(`sec:${j}`);J1(v.id,(q1)=>{let G1=Object.fromEntries(Object.entries(q1.sections??{}).filter(([N1])=>N1!==j));return{...q1,sections:j.startsWith("user:")?G1:{...G1,[j]:{...i?{x:Math.round(i.position.x),y:Math.round(i.position.y),w:Math.round(x1(i).w),h:Math.round(x1(i).h)}:{x:0,y:0,w:0,h:0},gone:!0}}}})},M0=()=>{let j=Z1?s1.getNode(Z1):void 0,i=s1.screenToFlowPosition({x:window.innerWidth/2,y:window.innerHeight/2}),q1=j?.type==="screen"?{x:j.position.x-f0,y:j.position.y-f0,w:V0+f0*2,h:l0+f0*2}:{x:i.x-900,y:i.y-600,w:1800,h:1200},G1=`user:${Date.now().toString(36)}`,N1=Object.keys(v.sections??{}).filter((H1)=>H1.startsWith("user:")).length+1;k1(`sec:${G1}`),J1(v.id,(H1)=>({...H1,sections:{...H1.sections??{},[G1]:{x:Math.round(q1.x),y:Math.round(q1.y),w:Math.round(q1.w),h:Math.round(q1.h),name:`Section ${N1}`}}}))},y0=(j)=>(i)=>{if(!D||i.button!==0)return;let q1=s1.getNode(j);if(!q1)return;let G1=i.currentTarget;G1.setPointerCapture(i.pointerId);let{clientX:N1,clientY:H1}=i,z1={...q1.position},X1=!1,I1=(r1)=>{let b1=s1.getZoom();return{...q1,position:{x:z1.x+(r1.clientX-N1)/b1,y:z1.y+(r1.clientY-H1)/b1}}},v1=(r1)=>{if(!X1&&Math.hypot(r1.clientX-N1,r1.clientY-H1)<4)return;if(!X1)X1=!0,T(null,q1);let b1=I1(r1);L0((M5)=>M5.map((T0)=>T0.id===j?{...T0,position:b1.position}:T0)),g(null,b1)},R1=(r1)=>{if(G1.removeEventListener("pointermove",v1),G1.removeEventListener("pointerup",R1),G1.removeEventListener("pointercancel",R1),X1)_1(null,I1(r1)),G1.addEventListener("click",(b1)=>{b1.stopPropagation(),b1.preventDefault()},{capture:!0,once:!0});else if(q1.type==="screen")k1(j)};G1.addEventListener("pointermove",v1),G1.addEventListener("pointerup",R1),G1.addEventListener("pointercancel",R1)},L5=async(j,i)=>{if(!D||t.current.has(j))return;let q1=B0.find((X1)=>X1.type==="screen"&&X1.data.frame.vendor===j&&X1.data.frame.at&&("screen"in X1.data.frame.at));if(!q1){p1("Open a page of this vendor on the board first","error");return}let G1=q1.data.frame;t.current.add(j),s([...t.current]);let N1,H1=!1,z1=(X1,I1)=>{if(H1||!l.current)return;if(H1=!0,N1)clearTimeout(N1),o.current.delete(N1);if(t.current.delete(j),s([...t.current]),h((v1)=>{let R1={...v1};return delete R1[j],R1}),I1){p1(I1,"error");return}u((v1)=>({...v1,[j]:{label:X1?.label??v1[j]?.label??"",revision:(v1[j]?.revision??0)+1}}))};try{let X1=`/${_}/${j}${G1.at.screen}`,I1=await y1(r0,`/-/${_}/twins/${j}/session`,{method:"POST",body:JSON.stringify({person:i,land:X1})});if(!I1.ok){z1(void 0,await K0(I1));return}let v1=await I1.json();if(!l.current)return;let R1=new URLSearchParams(new URL(v1.url).hash.slice(1)).get("pass");if(!R1)throw Error("The World did not return a sign-in pass.");h((r1)=>({...r1,[j]:{frame:q1.id,url:v1.url,pass:R1,done:z1}})),N1=setTimeout(()=>z1(void 0,"The sign-in did not finish. Choose View as again."),60000),o.current.add(N1)}catch(X1){z1(void 0,X1 instanceof Error?X1.message:"The World did not answer.")}},l2=(j)=>D&&Q===r0&&j&&B0.some((i)=>i.type==="screen"&&i.data.frame.vendor===j&&i.data.frame.at&&("screen"in i.data.frame.at))?{world:_,token:Q,vendor:j,label:P[j]?.label,busy:Q1.includes(j),choose:(i)=>{L5(j,i)}}:void 0,Y3=B0.map((j)=>j.type==="section"?{...j,data:{...j.data,viewAs:l2(j.data.vendor),grab:y0(j.id),picked:Z1===j.id,editable:D,renaming:D&&L1===j.data.key,pick:(i)=>k1(`sec:${i}`),rename:P1,renamed:u1,remove:f1,resized:()=>requestAnimationFrame(()=>{let i=j.data.key;F2($1(i),[i])})}}:{...j,data:{...j.data,viewAs:j.data.frame.at&&"screen"in j.data.frame.at?l2(j.data.frame.vendor):void 0,navigation:D?m[j.data.frame.vendor]:void 0,revision:P[j.data.frame.vendor]?.revision,grab:y0(j.id),active:n===j.id,picked:Z1===j.id,boards:D?I0:[],addTo:S0,remove:!D||v.include&&!v.include.includes(j.id)?null:q0,compare:(i)=>{k1(i),_0(i)}}});p.useEffect(()=>{let j=(i)=>{if(i.target?.closest("input, textarea, select, [contenteditable]"))return;if(i.key==="Escape"){if(n)T1(null);else k1(null);return}if(!D||n)return;if((i.key==="Delete"||i.key==="Backspace")&&Z1){if(i.preventDefault(),Z1.startsWith("sec:"))f1(Z1.slice(4));else if(!v.include||v.include.includes(Z1))q0.act(Z1);else p1("It is on this board with its whole group: take the group off in the list to remove it","error");return}if(i.key==="S"&&i.shiftKey&&!i.metaKey&&!i.ctrlKey)i.preventDefault(),M0()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)});let z5=(j)=>{k1(j);let i=s1.getNode(j);if(!i)return;let q1=x1(i);s1.fitBounds({x:q1.x,y:q1.y,width:q1.w,height:q1.h},{padding:0.15,duration:400})},L3=()=>{let j=`board-${Date.now().toString(36)}`;c(j),e((i)=>[...i,{id:j,name:`Board ${i.length}`,include:[]}])},U4=()=>w1(`board:${v.id}`),z3=()=>{let j=v.id;c(null),e((i)=>i.filter((q1)=>q1.id!==j))},W3=[...new Map(k.map((j)=>[E2(j),j])).values()],G4=v.include?[...W3.filter((j)=>!g2(j).some((i)=>v.include.includes(i))).map((j)=>({key:E2(j),label:`${M1(j.vendor)} · ${j.section.title} (all)`})),...k.filter((j)=>!Y1.includes(j)).map((j)=>({key:l1(j),label:j.title}))]:[],W5=v.include?[]:k.filter((j)=>(v.hidden??[]).includes(l1(j))),B3=B0.filter((j)=>j.type==="section"),B5=B0.filter((j)=>j.type==="screen"),Z4=new Map(B5.map((j)=>[j.id,Y0(j,B0)?.id??null])),r2=new Map;for(let j of k){let i=U1(j);if(i&&F1.has(i))r2.set(i,(r2.get(i)??0)+1)}let A5=(j)=>{let i=j.data.frame;return $.jsxDEV("li",{children:[$.jsxDEV("button",{type:"button",className:Z1===j.id?"on":void 0,onClick:()=>z5(j.id),onDoubleClick:()=>T1(j.id),children:[$.jsxDEV(a1,{vendor:i.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:i.title},void 0,!1,void 0,this),i.changes?$.jsxDEV("span",{className:"layer-changed",title:`${c1(i.changes,"change")} ${F?"on this branch":"not in a changeset"}: its mark on the board opens a comparison`,children:[$.jsxDEV(C1,{name:"square-dot",size:14},void 0,!1,void 0,this),i.changes]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),r2.get(j.id)&&b!=="changes"&&!v.include?$.jsxDEV("button",{type:"button",className:"ghost layer-open","aria-expanded":x.has(j.id),onClick:()=>V((q1)=>{let G1=new Set(q1);if(G1.has(j.id))G1.delete(j.id);else G1.add(j.id);return G1}),title:x.has(j.id)?"Close the pages under it":"Open the pages under it",children:[x.has(j.id)?"−":"+",r2.get(j.id)]},void 0,!0,void 0,this):null]},j.id,!0,void 0,this)},F4=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,H4=J.state==="ok"&&W.state==="ok";return $.jsxDEV("div",{className:"canvas full",role:"region","aria-label":"The World's board",style:{"--zoom":h0},children:$.jsxDEV(D_,{nodes:H4?Y3:[],onNodesChange:G2,nodeTypes:WF,onNodeDragStart:T,onNodeDrag:g,onNodeDragStop:_1,onNodeClick:(j,i)=>{if(i.id!==n)k1(i.id)},onNodeDoubleClick:(j,i)=>{if(i.type==="screen")k1(i.id),T1(i.id)},onPaneClick:()=>{T1(null),k1(null)},minZoom:0.03,maxZoom:1.5,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnPinch:!0,zoomOnScroll:!1,zoomOnDoubleClick:!1,colorMode:F4?"dark":"light",proOptions:{hideAttribution:!0},children:[$.jsxDEV(x_,{variant:g0.Dots,gap:28*2**Math.max(0,Math.ceil(Math.log2(16/(28*h0)))),size:2/h0},void 0,!1,void 0,this),$.jsxDEV(p0,{position:"top-left",className:"float layers",children:[$.jsxDEV("div",{className:"float-head",children:[$.jsxDEV("button",{type:"button",className:"back",onClick:G,"aria-label":`Back to ${_}`,children:"←"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"float-title",children:[$.jsxDEV("strong",{children:(F||_).split("/")[1]},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:[_.split("/")[0],F?" · branch":U?" · snapshot":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{className:"compare-base board-viewing",children:["Viewing",$.jsxDEV("select",{value:F,disabled:K.current>0,onChange:(j)=>X(j.target.value),children:[$.jsxDEV("option",{value:"",children:"The World"},void 0,!1,void 0,this),F&&!C.some((j)=>j.name===F)?$.jsxDEV("option",{value:F,children:[F," · branch"]},void 0,!0,void 0,this):null,C.map((j)=>$.jsxDEV("option",{value:j.name,children:[j.name.split("/")[1]," · branch"]},j.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R.state==="error"&&R.status!==404?$.jsxDEV("p",{className:"mode",role:"alert",children:["Branches could not be read: ",R.error]},void 0,!0,void 0,this):null,$.jsxDEV("div",{className:"board-tabs",role:"tablist","aria-label":"Boards",children:[$.jsxDEV("button",{type:"button",role:"tab","aria-selected":b==="changes",className:b==="changes"?"on":void 0,onClick:()=>{k1(null),T1(null),c("changes")},title:F?"The pages whose records changed on this branch":"The pages whose records changed and are not yet in a changeset",children:["Changes",y?` (${k.filter((j)=>j.changes).length})`:""]},void 0,!0,void 0,this),E.map((j)=>L1===`board:${j.id}`?$.jsxDEV(vQ,{name:j.name,label:"Name this board",done:(i)=>{if(w1(null),i)J1(j.id,(q1)=>({...q1,name:i}))}},j.id,!1,void 0,this):$.jsxDEV("button",{type:"button",role:"tab","aria-selected":b!=="changes"&&j.id===v.id,className:b!=="changes"&&j.id===v.id?"on":void 0,onClick:()=>{k1(null),T1(null),c(j.id)},onDoubleClick:D&&j.id===v.id&&j.include?U4:void 0,children:j.name},j.id,!1,void 0,this)),D?$.jsxDEV("button",{type:"button",className:"ghost",onClick:L3,"aria-label":"A new board",children:"+"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),v.include&&D?$.jsxDEV("div",{className:"board-acts",children:[$.jsxDEV("button",{type:"button",className:"ghost",onClick:U4,children:"Rename"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"ghost",onClick:z3,children:"Delete board"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("ul",{className:"layer-list","aria-label":"Layers",children:[B3.map((j)=>{let i=j.data;return $.jsxDEV("li",{children:[$.jsxDEV("button",{type:"button",className:Z1===j.id?"layer-section on":"layer-section",onClick:()=>z5(j.id),onDoubleClick:()=>{if(D)z5(j.id),P1(i.key)},children:[i.vendor?$.jsxDEV(a1,{vendor:i.vendor},void 0,!1,void 0,this):$.jsxDEV(C1,{name:"layout-grid",size:14},void 0,!1,void 0,this),$.jsxDEV("span",{children:i.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list inner",children:B5.filter((q1)=>Z4.get(q1.id)===j.id).map(A5)},void 0,!1,void 0,this)]},j.id,!0,void 0,this)}),B5.filter((j)=>!Z4.get(j.id)).map(A5)]},void 0,!0,void 0,this),v.include&&!Y1.length?$.jsxDEV("p",{className:"mode pad-s",children:"An empty board: add frames from Everything, or below."},void 0,!1,void 0,this):null,G4.length&&D?$.jsxDEV("select",{className:"board-add",value:"","aria-label":"Add to this board",onChange:(j)=>{let i=j.target.value;if(i)J1(v.id,(q1)=>({...q1,include:[...q1.include??[],i]}))},children:[$.jsxDEV("option",{value:"",children:"Add to this board…"},void 0,!1,void 0,this),G4.map((j)=>$.jsxDEV("option",{value:j.key,children:j.label},j.key,!1,void 0,this))]},void 0,!0,void 0,this):null,W5.length?$.jsxDEV("details",{className:"board-hidden",children:[$.jsxDEV("summary",{children:["Hidden (",W5.length,")"]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list",children:W5.map((j)=>$.jsxDEV("li",{children:D?$.jsxDEV("button",{type:"button",onClick:()=>J1(v.id,(i)=>({...i,hidden:(i.hidden??[]).filter((q1)=>q1!==l1(j))})),children:[$.jsxDEV("span",{children:j.title},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Show"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("span",{className:"pad-s",children:j.title},void 0,!1,void 0,this)},l1(j),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,B1?$.jsxDEV("button",{type:"button",className:"board-elsewhere",onClick:()=>c("changes"),children:[$.jsxDEV(C1,{name:"square-dot",size:14},void 0,!1,void 0,this),c1(B1,"change")," not on this board"]},void 0,!0,void 0,this):null,$.jsxDEV(Z0,{load:W,what:"the board"},void 0,!1,void 0,this),M&&W.state==="ok"?$.jsxDEV("p",{role:"alert",className:"pad-s",children:["The board could not be read again (",M,"): it shows what was last read."]},void 0,!0,void 0,this):null,J.state==="pending"?$.jsxDEV("p",{className:"mode",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,J.state==="error"?$.jsxDEV("p",{role:"alert",children:["The World did not open its screens: ",J.error," ",$.jsxDEV("button",{type:"button",onClick:q,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),n?$.jsxDEV(p0,{position:"top-center",className:"float hint using",children:[$.jsxDEV("span",{className:"mode",children:["Using ",Y1.find((j)=>l1(j)===n)?.title??n]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>T1(null),children:["Done ",$.jsxDEV("kbd",{children:"Esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV(p0,{position:"top-center",className:"float hint mode",children:"Scroll to pan · pinch or ⌘ scroll to zoom · double-click a frame to use it"},void 0,!1,void 0,this),D?$.jsxDEV(p0,{position:"bottom-center",className:"float board-tools",children:$.jsxDEV("button",{type:"button",className:"ghost",onClick:M0,title:"Section (⇧S): around the selected frame, else in the middle",children:[$.jsxDEV(C1,{name:"layout-grid",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Section"},void 0,!1,void 0,this),$.jsxDEV("kbd",{children:"⇧S"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,t1&&Y1.some((j)=>l1(j)===t1)?$.jsxDEV(p0,{position:"top-right",className:"float compare-panel",children:$.jsxDEV(zF,{viewing:F,name:_,token:Q,frame:Y1.find((j)=>l1(j)===t1),onClose:()=>_0(null),reads:N},t1,!1,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV(g_,{showInteractive:!1,position:"bottom-left"},void 0,!1,void 0,this),$.jsxDEV(c_,{pannable:!0,zoomable:!0,nodeBorderRadius:8,position:"bottom-right"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var VQ=(_)=>_.actions.map((Q)=>({twin:Q.service,entry:{...Q.action,service:Q.service,op:Q.action.op??Q.action.operation??""}})),MF=(_)=>{let Q=_.action.input??{};return!(typeof Q.operationId==="string"||Q.graphql!==void 0&&Q.graphql!==null)};function K3(_){let Q=_.actions.filter(MF).length,J=_.actions.length-Q,q=_.applied?.receipts??[],U=_.deployed??[],G=new Set([...U.filter((X)=>X.status==="deployed"),...q.filter((X)=>X.status==="confirmed")].map((X)=>X.actionId)).size,Z=new Set([...U.filter((X)=>X.status==="refused"||X.status==="failed"),...q.filter((X)=>X.status==="failed")].map((X)=>X.actionId)).size,F={performed:G,failed:Z,total:J,own:Q};if(J>0&&G>=J)return{label:"Deployed",tone:"done",...F};if(G>0)return{label:`Partly deployed: ${G} of ${J}`,tone:"warn",...F};if(Z>0)return{label:`${Z} refused or failed`,tone:"bad",...F};if(q.some((X)=>X.status==="replayed")&&q.every((X)=>X.status==="replayed"||X.status==="skipped"))return{label:"Pushed",tone:"good",...F};return{label:"Not sent",tone:"plain",...F}}var y8=(_)=>_.message??_.narration?.split(`
|
|
37
|
+
`)[0]?.replace(/ setting .*$/,"")??_.name;function uQ(_,Q=1){let J=_.currentHash??_.contentHash,q=_.readiness?.approvers??new Set(_.approvals.filter((G)=>G.contentHash===J).map((G)=>G.principal)).size,U=_.verification&&_.verification.contentHash===J?_.verification:null;if(U&&!U.passed)return{label:"Checks failed",tone:"bad"};if(q>0&&q<Q)return{label:`Approved by ${q} of ${Q}`,tone:"plain"};if(q>0)return{label:`Approved by ${q}`,tone:"good"};if(U)return{label:"Verified",tone:"good"};return{label:"Not verified",tone:"plain"}}function HQ({name:_,token:Q,signsAs:J,c:q,canWrite:U,rooted:G,refused:Z,onChanged:F,part:X,required:Y}){let K=X==="head",H=X==="review",[L,z]=p.useState(null),[W,I]=p.useState(!1),[M,B]=p.useState(""),[N,A]=p.useState(""),[R,O]=p.useState(null),C=V1(Q,`/-/${_}/origin`),f=K3(q),S=uQ(q,Y),w=VQ(q),k=[...new Set(w.map((h)=>h.twin))],E=k.some((h)=>G.includes(h)),r=(h)=>h===(q.currentHash??q.contentHash),c=q.applied?.receipts??[],y=(q.deployed??[]).filter((h)=>h.status!=="landed"),b=c.filter((h)=>h.status==="confirmed").length,v=y.filter((h)=>h.status==="deployed"),x=async(h,t,Q1,s)=>{z(h),O(null);try{let o=await y1(Q,t,{method:"POST",...Q1===void 0?{}:{body:JSON.stringify(Q1)}});if(!o.ok)return Z(o),O({what:h,...o1(await _2(o))}),!1;if(s)p1(s);return F(),!0}catch(o){return O({what:h,text:`the World did not answer (${o instanceof Error?o.message:String(o)})`,acts:[]}),!1}finally{z(null)}},V=()=>{x("Verify",`/-/${_}/changesets/${q.name}/verify`,void 0,"Verified: the checks ran over it")},D=async(h)=>{if(h.preventDefault(),await x("Approve",`/-/${_}/changesets/${q.name}/approve`,{...M.trim()?{note:M.trim()}:{},...J===null&&N.trim()?{as:N.trim()}:{}},"Approved"))I(!1),B("")},P=async()=>{let h=k.filter((t)=>G.includes(t));if(!await c0({title:`Deploy ${q.name} to the real vendors?`,body:$.jsxDEV($.Fragment,{children:["It performs its ",q.actions.length," change",q.actions.length===1?"":"s"," against the real account",h.length===1?"":"s"," behind ",b2(h.map(M1)),". This cannot be taken back here."]},void 0,!0,void 0,this),action:"Deploy",danger:!0,typed:q.name}))return;z("Deploy"),O(null);try{let t=await y1(Q,`/-/${_}/deploy/${q.name}`,{method:"POST",body:JSON.stringify({confirm:q.name})});if(!t.ok){Z(t),O({what:"Deploy",...o1(await _2(t))});return}let Q1=await y1(Q,`/-/${_}/changesets/${q.name}`),s=Q1.ok?await Q1.json():null;if(!s){p1("Deploy: sent; reading its receipts failed","info"),F();return}let o=K3(s);p1(`Deploy: ${o.performed} of ${o.total} change${o.total===1?"":"s"} performed at the vendor${o.failed?`; ${o.failed} refused or failed`:""}`,o.failed?"error":o.performed?"ok":"info"),F()}catch(t){O({what:"Deploy",text:`the World did not answer (${t instanceof Error?t.message:String(t)})`,acts:[]})}finally{z(null)}},u=!U?"This session reads the World; it changes nothing":f.label==="Deployed"?"Already deployed: every change was performed at the vendor":null,m=C.state==="ok"&&C.data.origin?D8(C.data.origin):null;return $.jsxDEV("div",{className:"changeset","aria-labelledby":"changeset-title",children:[K?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("div",{children:[$.jsxDEV("h3",{id:"changeset-title",children:[q.message??q.name," ",$.jsxDEV("span",{className:`badge cs-${f.tone}`,children:f.label},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:`badge cs-${S.tone}`,children:S.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("code",{children:q.name},void 0,!1,void 0,this)," · made ",$.jsxDEV(D1,{iso:q.createdAt},void 0,!1,void 0,this)," · ",q.actions.length," change",q.actions.length===1?"":"s"," at ",b2(k.map(M1))||"no vendor"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:[$.jsxDEV("button",{type:"button",onClick:V,disabled:Boolean(u)||L!==null,title:u??"Replay it in a throwaway World and run the World's checks",children:L==="Verify"?"Verifying…":"Verify"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>I(!0),disabled:Boolean(u)||L!==null,title:u??"Sign its current contents as yourself",children:"Approve…"},void 0,!1,void 0,this),E?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>void P(),disabled:Boolean(u)||L!==null,title:u??"Perform it against the real accounts behind this World",children:L==="Deploy"?"Deploying…":"Deploy…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),u&&f.label!=="Deployed"?$.jsxDEV("p",{className:"mode",children:[u,"."]},void 0,!0,void 0,this):null,R?$.jsxDEV("div",{role:"alert",className:"refusal",children:[$.jsxDEV("span",{children:[$.jsxDEV("b",{children:R.what},void 0,!1,void 0,this),": ",R.text]},void 0,!0,void 0,this),R.acts.includes("verify")&&U?$.jsxDEV("button",{type:"button",onClick:V,disabled:L!==null,children:"Verify"},void 0,!1,void 0,this):null,R.acts.includes("approve")&&U?$.jsxDEV("button",{type:"button",onClick:()=>I(!0),disabled:L!==null,children:"Approve…"},void 0,!1,void 0,this):null,$.jsxDEV(zQ,{name:_,acts:R.acts},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):null,H?$.jsxDEV($.Fragment,{children:[q.narration?$.jsxDEV("p",{className:"narration",children:q.narration},void 0,!1,void 0,this):null,$.jsxDEV("h4",{children:"Where it went"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"block where",children:[f.performed>0?$.jsxDEV("p",{className:"pad",children:[f.performed>=f.total?"Deployed":"Partly deployed",": ",f.performed," of ",f.total," change",f.total===1?"":"s",f.own?` (and ${f.own} of the World's own, which stay in it)`:""," performed at ",b2([...new Set([...v.map((h)=>h.service),...c.filter((h)=>h.status==="confirmed").map((h)=>h.service)].map(M1))]),v.length?` (${v.length} from here`:" (",v.length&&b?", ":"",b?`${b} by the remote`:"",")."]},void 0,!0,void 0,this):f.label==="Pushed"?$.jsxDEV("p",{className:"pad",children:["Pushed to the remote",m?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("code",{children:m},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,q.applied?$.jsxDEV($.Fragment,{children:[" · ",$.jsxDEV(D1,{iso:q.applied.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,": every change was replayed there. No vendor has performed any of it."]},void 0,!0,void 0,this):f.failed===0?$.jsxDEV("p",{className:"pad",children:["Not sent: it is only in this World.",q.applied?.outcome==="refused"?" A push was refused (below); Push sends it again.":$.jsxDEV($.Fragment,{children:[" Push sends it to the remote World",E?"; Deploy, to the real vendors behind it":"","."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,f.failed>0?$.jsxDEV("p",{className:"pad failed",role:"alert",children:[f.failed," change",f.failed===1?" was":"s were"," refused or failed at the vendor",[...y.filter((h)=>h.reason&&(h.status==="refused"||h.status==="failed")).map((h)=>h.reason),...c.filter((h)=>h.status==="failed"&&h.error).map((h)=>h.error)].slice(0,3).map((h)=>`: ${o1(h).text}`).join(""),"."]},void 0,!0,void 0,this):null,q.applied?.refusal?.length?$.jsxDEV("ul",{className:"checks pad",children:q.applied.refusal.map((h,t)=>$.jsxDEV("li",{className:"mode",children:o1(h).text},t,!1,void 0,this))},void 0,!1,void 0,this):null,y.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"pad where-sub mode",children:"At the vendor"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"receipts pad",children:y.map((h)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:h.status==="refused"||h.status==="failed"?"badge cs-bad":h.status==="deployed"?"badge cs-done":"badge",children:h.status},void 0,!1,void 0,this)," ",M1(h.service)," ",h.status==="deployed"?h.url?$.jsxDEV("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",children:h.externalId??h.url},void 0,!1,void 0,this):h.externalId?$.jsxDEV("code",{children:h.externalId},void 0,!1,void 0,this):null:null,h.reason?$.jsxDEV("span",{className:"mode",children:[" · ",o1(h.reason).text]},void 0,!0,void 0,this):null," ",$.jsxDEV("span",{className:"mode",children:["· ",$.jsxDEV(D1,{iso:h.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},`v:${h.actionId}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,c.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"pad where-sub mode",children:"At the remote"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"receipts pad",children:c.map((h)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:h.status==="failed"?"badge cs-bad":h.status==="confirmed"?"badge cs-done":"badge",children:h.status},void 0,!1,void 0,this)," ",M1(h.service)," ",$.jsxDEV("span",{className:"mode",children:h.status==="replayed"?"replayed at the remote World":h.status==="confirmed"?"performed at the vendor by the remote":""},void 0,!1,void 0,this),h.status==="confirmed"&&h.externalId?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("code",{children:h.externalId},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,h.error?$.jsxDEV("span",{className:"mode",children:[" · ",o1(h.error).text]},void 0,!0,void 0,this):null]},`r:${h.actionId}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),!E&&f.label!=="Deployed"?$.jsxDEV("p",{className:"mode",children:["No vendor it changes is connected to its real service here, so it does not deploy from this World. ",$.jsxDEV("a",{href:`${O1}/${_}/~/settings/services`,onClick:(h)=>{h.preventDefault(),h1([..._.split("/"),"~","settings","services"])},children:"Connect a vendor in Settings › Real services"},void 0,!1,void 0,this)," to deploy."]},void 0,!0,void 0,this):null,$.jsxDEV("h4",{children:"Checks"},void 0,!1,void 0,this),!q.verification?$.jsxDEV("p",{className:"mode",children:"Not verified yet. Verify replays it in a throwaway World and runs this World's checks over the result."},void 0,!1,void 0,this):$.jsxDEV("div",{className:r(q.verification.contentHash)?"":"stale",children:[$.jsxDEV("p",{children:[q.verification.passed?"✓ Passed":"✗ Failed"," · ",$.jsxDEV(D1,{iso:q.verification.at},void 0,!1,void 0,this),r(q.verification.contentHash)?null:$.jsxDEV("span",{className:"mode",children:" · on an earlier version of it: verify again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.verification.results.length?$.jsxDEV("ul",{className:"checks",children:q.verification.results.map((h)=>$.jsxDEV("li",{children:[h.passed?"✓":"✗"," ",$.jsxDEV("code",{children:h.id},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:M1(h.service)},void 0,!1,void 0,this)]},h.id,!0,void 0,this))},void 0,!1,void 0,this):null,q.verification.refusals?.length?$.jsxDEV("ul",{className:"checks",children:q.verification.refusals.map((h,t)=>$.jsxDEV("li",{children:["✗ ",$.jsxDEV("code",{children:h.check},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[M1(h.service),": ",h.reason]},void 0,!0,void 0,this)]},t,!0,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("h4",{children:"Approvals"},void 0,!1,void 0,this),q.approvals.length===0?$.jsxDEV("p",{className:"mode",children:"No one has approved it."},void 0,!1,void 0,this):$.jsxDEV("ul",{className:"approvals",children:q.approvals.map((h,t)=>$.jsxDEV("li",{children:[$.jsxDEV("b",{children:h.principal},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(D1,{iso:h.at},void 0,!1,void 0,this),r(h.contentHash)?"":" · signed an earlier version"]},void 0,!0,void 0,this),h.note?$.jsxDEV("div",{className:"mode",children:["“",h.note,"”"]},void 0,!0,void 0,this):null]},t,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(O0,{open:W,onClose:()=>{if(!L)I(!1)},title:`Approve ${q.name}`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>I(!1),disabled:L!==null,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"approve-changeset",className:"primary",disabled:L!==null,children:L==="Approve"?"Approving…":"Approve"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"approve-changeset",onSubmit:(h)=>void D(h),className:"stack",children:[$.jsxDEV("p",{className:"mode",children:["You sign its contents as they stand now",J?$.jsxDEV($.Fragment,{children:[", recorded as ",$.jsxDEV("b",{children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,". A later change to it shows your approval as for an earlier version."]},void 0,!0,void 0,this),J===null?$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Approving as"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"approveAs",value:N,onChange:(h)=>A(h.target.value),maxLength:80,required:!0,placeholder:"your name or email",autoComplete:"off"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"This World was opened with its token, which names no person: the approval records the name you give."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Note ",$.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("textarea",{name:"approveNote",value:M,onChange:(h)=>B(h.target.value),rows:3,maxLength:500},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var hQ=(_,Q)=>JSON.stringify(_)===JSON.stringify(Q);function TF({changes:_,idPrefix:Q}){let J=[...new Set(_.map((q)=>q.twin))];return $.jsxDEV($.Fragment,{children:J.map((q)=>{let U=_.filter((Z)=>Z.twin===q).map((Z)=>Z.entry),G=[...new Set(U.map((Z)=>`${Z.subject.type}:${Z.subject.id}`))];return $.jsxDEV("div",{className:"compare",role:"group","aria-labelledby":`${Q}-${q}`,children:[$.jsxDEV("h3",{id:`${Q}-${q}`,className:"vendor-cell",children:[$.jsxDEV(a1,{vendor:q},void 0,!1,void 0,this),M1(q)," ",$.jsxDEV("span",{className:"mode",children:["· ",c1(G.length,"record"),", ",c1(U.length,"write")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:G.map((Z)=>{let F=U.filter((H)=>`${H.subject.type}:${H.subject.id}`===Z),X=F[F.length-1],Y=C0(X),K={};return $.jsxDEV("li",{className:"record",children:[$.jsxDEV("p",{className:"record-head",children:[$.jsxDEV("span",{className:"kind",children:X.subject.type.replace(/^_+/,"").replace(/[_-]+/g," ")},void 0,!1,void 0,this)," ",Y.label?$.jsxDEV("span",{className:"label",children:["“",Y.label,"”"]},void 0,!0,void 0,this):null," ",$.jsxDEV("code",{children:q2(X)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F.map((H)=>{let L=H.fields??{},z=Object.entries(L).filter(([I,M])=>!(I in K)||!hQ(K[I],M)),W=K;return K={...K,...L},$.jsxDEV("div",{className:"write",children:[$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("span",{className:"op",children:C0(H).what},void 0,!1,void 0,this)," · ",$.jsxDEV(D1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",Q4(H)]},void 0,!0,void 0,this),z.length===0?$.jsxDEV("p",{className:"mode",children:"It set no field to a new value."},void 0,!1,void 0,this):$.jsxDEV("dl",{className:"fields field-diff","aria-label":`Fields ${C0(H).what} set`,children:z.map(([I,M])=>$.jsxDEV(p.default.Fragment,{children:[$.jsxDEV("dt",{children:I},void 0,!1,void 0,this),$.jsxDEV("dd",{children:I in W?$.jsxDEV("span",{className:"changed",children:[$.jsxDEV("del",{children:$.jsxDEV(U2,{v:W[I]},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"arrow","aria-label":"becomes",children:"→"},void 0,!1,void 0,this),$.jsxDEV("ins",{children:$.jsxDEV(U2,{v:M},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV(U2,{v:M},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},I,!0,void 0,this))},void 0,!1,void 0,this)]},H.id,!0,void 0,this)})]},Z,!0,void 0,this)})},void 0,!1,void 0,this)]},q,!0,void 0,this)})},void 0,!1,void 0,this)}function RF({name:_,token:Q,changes:J,canWrite:q,refused:U,onCut:G,pinned:Z,generated:F,inputRef:X,author:Y}){let[K,H]=p.useState(""),[L,z]=p.useState(!1),[W,I]=p.useState([]),M=(N,A,R)=>{I((O)=>[{ok:N,text:A,at:new Date().toISOString(),n:++q4,...R?.length?{acts:R}:{}},...O].slice(0,4))},B=async(N)=>{N.preventDefault(),z(!0);try{let A=await y1(Q,`/-/${_}/changesets`,{method:"POST",body:JSON.stringify(K.trim()?{message:K.trim()}:{})});if(!A.ok){U(A);let O=o1(await _2(A));M(!1,`Cut a changeset: ${O.text}`,O.acts);return}let R=await A.json();M(!0,`Cut ${R.name??"a changeset"}: ${c1(R.actions?.length??0,"change")}, ready to review in History and push.`),H(""),G()}catch(A){M(!1,`Cut a changeset: the World did not answer (${A instanceof Error?A.message:String(A)})`)}finally{z(!1)}};if(Z){let N=!q?"This session reads the World; it changes nothing":J===0?"Nothing to cut: no change is outside a changeset":null;return $.jsxDEV("div",{className:"ws-cut",children:[$.jsxDEV(A2,{log:W,name:_},void 0,!1,void 0,this),$.jsxDEV("form",{onSubmit:(A)=>void B(A),"aria-label":"Cut a changeset",children:[Y?$.jsxDEV("a",{className:"ws-author",href:Y.account,title:`${Y.who}: your account`,onClick:(A)=>{A.preventDefault(),h1(Y.account.slice(O1.length+1).split("/"))},children:Y.face},void 0,!1,void 0,this):null,$.jsxDEV("input",{ref:X,name:"changesetMessage","aria-label":"Summary",value:K,onChange:(A)=>H(A.target.value),placeholder:J===0?"Nothing to cut":F?"Summary (optional)":"Summary (required)",required:!F,maxLength:200,disabled:Boolean(N),title:N??void 0},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",disabled:Boolean(N)||L,title:N??void 0,children:L?"Cutting…":J===0?"Cut a changeset":$.jsxDEV($.Fragment,{children:["Cut ",c1(J,"change"),Y?$.jsxDEV($.Fragment,{children:[" on ",$.jsxDEV("b",{children:Y.branch},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}if(!q||J===0)return $.jsxDEV(A2,{log:W,name:_},void 0,!1,void 0,this);return $.jsxDEV($.Fragment,{children:[$.jsxDEV("form",{className:"block cut pad",onSubmit:(N)=>void B(N),"aria-label":"Cut a changeset",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Cut ",J===1?"this change":`these ${J} changes`," into a changeset: what it does and why"]},void 0,!0,void 0,this),$.jsxDEV("input",{name:"changesetMessage",value:K,onChange:(N)=>H(N.target.value),placeholder:"Welcome email for new sign-ups",required:!0,maxLength:200,disabled:J===0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",disabled:L||J===0,children:L?"Cutting…":"Cut a changeset"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(A2,{log:W,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function OF({name:_,token:Q}){let[J,q]=p.useState(0),U=V1(Q,`/-/${_}/keys`,J),[G,Z]=p.useState(!1),[F,X]=p.useState(""),[Y,K]=p.useState("write"),[H,L]=p.useState(!1),[z,W]=p.useState(null),[I,M]=p.useState(null),[B,N]=p.useState(null),A=async()=>{let C=`Read-only link · ${new Date().toLocaleDateString(void 0,{month:"short",day:"numeric"})}`,f=await y1(Q,`/-/${_}/keys`,{method:"POST",body:JSON.stringify({name:C,scope:"read"})}).catch(()=>null),S=f?await f.json().catch(()=>({})):{error:`${j1} did not answer`};if(!f?.ok||!S.key){p1(S.error?o1(S.error).text:"refused","error");return}N(`${window.location.origin}${O1}/${_}#${new URLSearchParams({token:S.key}).toString()}`),q((w)=>w+1)},R=async(C)=>{C.preventDefault(),L(!0),W(null);let f=await y1(Q,`/-/${_}/keys`,{method:"POST",body:JSON.stringify({name:F.trim(),scope:Y})}).catch(()=>null);L(!1);let S=f?await f.json().catch(()=>({})):{error:`${j1} did not answer`};if(!f?.ok||!S.key){W(S.error?o1(S.error).text:"refused");return}Z(!1),M({key:S.key,name:F.trim()}),X(""),q((w)=>w+1)},O=async(C)=>{if(!await c0({title:`Revoke ${C.name}?`,body:"Whatever holds it loses this World at once.",action:"Revoke key",danger:!0}))return;let f=await y1(Q,`/-/${_}/keys/${C.id}`,{method:"DELETE"});if(f.ok)p1(`Revoked ${C.name}`);else p1(await K0(f),"error");q((S)=>S+1)};return $.jsxDEV("section",{"aria-labelledby":"keys-head",className:"keys",children:[$.jsxDEV("div",{className:"keys-head",children:[$.jsxDEV("div",{children:[$.jsxDEV("h3",{id:"keys-head",children:"Keys"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"What an app, a script or a CI job holds to reach this World: each named for what holds it and revoked alone. People open the World as themselves; keys are for software."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F0()?$.jsxDEV("a",{className:"button primary",href:`${F0()}/${encodeURIComponent(_.split("/")[0]??"")}`,children:"Make a key on the platform"},void 0,!1,void 0,this):$.jsxDEV("div",{className:"head-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>void A(),children:"Share a read-only link"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{W(null),Z(!0)},children:"Make a key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(Z0,{load:U,what:"the keys",retry:()=>q((C)=>C+1)},void 0,!1,void 0,this),U.state==="ok"?U.data.keys.length===0?$.jsxDEV("p",{className:"mode",children:"No keys yet. The World's own token opens it too."},void 0,!1,void 0,this):$.jsxDEV("table",{className:"dense","aria-label":"Keys",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Name"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"For"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Access"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Last used"},void 0,!1,void 0,this),$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:U.data.keys.map((C)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:C.name},void 0,!1,void 0,this),$.jsxDEV("td",{children:C.person??$.jsxDEV("span",{className:"mode",title:"It acts as itself: a service",children:"no one: a service"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:C.scope==="write"?"Read and write":"Read only"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:$.jsxDEV("span",{title:D2(C.createdAt),children:N8(C.createdAt)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:C.lastUsedAt?N8(C.lastUsedAt):"never"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"num",children:$.jsxDEV(n_,{label:`More for ${C.name}`,items:[{label:"Revoke…",danger:!0,onSelect:()=>void O(C)}]},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},C.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(O0,{open:G,onClose:()=>{if(!H)Z(!1)},title:"Make a key",footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>Z(!1),disabled:H,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"make-key",disabled:H||!F.trim(),children:H?"Making…":"Make key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"make-key",onSubmit:R,"aria-label":"Make a key",children:[$.jsxDEV("label",{children:["Name ",$.jsxDEV("input",{autoFocus:!0,name:"keyName",value:F,onChange:(C)=>X(C.target.value),placeholder:"ci, staging app…",maxLength:80,required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:["Access ",$.jsxDEV("select",{value:Y,onChange:(C)=>K(C.target.value==="read"?"read":"write"),children:[$.jsxDEV("option",{value:"write",children:"Read and write"},void 0,!1,void 0,this),$.jsxDEV("option",{value:"read",children:"Read only"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z?$.jsxDEV("p",{role:"alert",children:z},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(O0,{open:Boolean(I),onClose:()=>M(null),title:`${I?.name??"The key"} is ready`,footer:$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>M(null),children:"Done"},void 0,!1,void 0,this),children:[$.jsxDEV("p",{className:"mode",children:"Copy it now: it is shown this once. Put it where the app reads its secrets."},void 0,!1,void 0,this),I?$.jsxDEV(f8,{label:"Key",value:I.key,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(O0,{open:Boolean(B),onClose:()=>N(null),title:"A read-only link",footer:$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>N(null),children:"Done"},void 0,!1,void 0,this),children:[$.jsxDEV("p",{className:"mode",children:"Whoever opens it sees this World's pages and changes nothing. Copy it now: it is shown this once. It is listed under Keys, where revoking it closes the link at once."},void 0,!1,void 0,this),B?$.jsxDEV(f8,{label:"Link",value:B,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var q4=0;function A2({log:_,name:Q}){if(_.length===0)return null;return $.jsxDEV("ul",{className:"narration-log",role:"status","aria-live":"polite",children:_.map((J)=>$.jsxDEV("li",{className:J.ok?"ok":"bad",children:[$.jsxDEV("span",{className:"mode",children:$.jsxDEV(D1,{iso:J.at,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",J.text,J.acts?$.jsxDEV(zQ,{name:Q,acts:J.acts},void 0,!1,void 0,this):null]},J.n,!0,void 0,this))},void 0,!1,void 0,this)}function DQ(_,Q,J,q){let[U,G]=p.useState(0),Z=U*1e5+Math.floor(J/2),F=V1(Q,`/-/${_}/origin`,Z),X=V1(Q,`/-/${_}/diff`,Z),Y=V1(Q,`/-/${_}/changesets`,Z),[K,H]=p.useState([]),[L,z]=p.useState(null),W=(O,C,f)=>{if(H((S)=>[{ok:O,text:C,at:new Date().toISOString(),n:++q4,...f?.length?{acts:f}:{}},...S].slice(0,8)),!O)p1(C,"error")},I=async(O,C,f)=>{z(O);try{let S=await y1(Q,`/-/${_}/${C}`,f);if(!S.ok){q(S);let w=o1(await _2(S));return W(!1,`${O}: ${w.text}`,w.acts),null}return await S.json()}catch(S){return W(!1,`${O}: the World did not answer (${S instanceof Error?S.message:String(S)})`),null}finally{z(null),G((S)=>S+1)}},M=F.state==="ok"&&F.data.origin?D8(F.data.origin):null,B=X.state==="ok"?X.data.changes.length:null,N=Y.state==="ok"&&M?eZ(Y.data.changesets.filter((O)=>!O.pushedBy)).sort((O,C)=>O.createdAt.localeCompare(C.createdAt)):[];return{origin:F,diff:X,sets:Y,there:M,changes:B,waiting:N,log:K,busy:L,say:W,send:I,push:async()=>{let O=await I("Push","origin/push",{method:"POST"});if(!O)return;if(O.pushed.length===0){W(!0,"Nothing to push: every changeset is already at the remote.");return}for(let C of O.pushed){let f=C.receipts??[],S=f.filter((c)=>c.status==="replayed").length,w=f.filter((c)=>c.status==="confirmed").length,k=f.filter((c)=>c.status==="failed").length,E=C.outcome==="applied"&&k===0;if(C.outcome==="refused"){W(!1,`Push of ${C.changeset} was refused${C.refusal?.length?`: ${C.refusal.map((c)=>o1(c).text).join("; ")}`:""}.`);continue}let r=[`${S} of ${c1(f.length,"change")} replayed there`,...w?[`${w} performed at the vendor by the remote`]:[],...k?[`${k} failed`]:[]];W(E,`${C.outcome==="partial"?"Partly pushed":"Pushed"} ${C.changeset} to ${M??"the remote"}: ${r.join("; ")}${C.refusal?.length?` (${C.refusal.map((c)=>o1(c).text).join("; ")})`:""}.`)}},pull:async()=>{let O=await I("Pull","origin/pull",{method:"POST"});if(!O)return;let C=Object.entries(O.appended).filter(([,S])=>S>0),f=O.rebased.flatMap((S)=>S.conflicts.map((w)=>`${M1(S.twin)} ${w.subject.type}:${w.subject.id} ${w.field}`));W(f.length===0,`Pulled from ${M??"the remote"}: ${C.length?C.map(([S,w])=>`${c1(w,"entry")} at ${M1(S)}`).join(", "):"nothing new"}${f.length?`; conflicts at ${f.join(", ")}`:""}.`)}}}function IF({name:_,token:Q,canWrite:J,tick:q,refused:U}){let{origin:G,there:Z,changes:F,log:X,busy:Y,say:K,send:H,push:L,pull:z}=DQ(_,Q,q,U),[W,I]=p.useState(""),[M,B]=p.useState(""),[N,A]=p.useState(!1),R=async(C)=>{C.preventDefault();let f=await H("Name the remote","origin",{method:"PUT",body:JSON.stringify({url:W.trim(),token:M.trim()})});if(f){let S=Object.values(f.appended??{}).reduce((w,k)=>w+k,0);K(!0,`The remote is ${D8(f.origin)}: its history came in (${c1(S,"entry")}).`),B(""),A(!1)}},O=!J?"This session reads the World; it changes nothing":null;return $.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"block remote",children:[$.jsxDEV("div",{className:"block-head",children:[$.jsxDEV("h3",{children:"Origin"},void 0,!1,void 0,this),J?$.jsxDEV("button",{type:"button",onClick:()=>{I(Z??""),A(!N)},"aria-expanded":N,children:Z?"Change the remote…":"Name a remote…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"pad",children:[G.state==="ok"?Z?$.jsxDEV("p",{children:[$.jsxDEV("code",{className:"big",children:Z},void 0,!1,void 0,this),G.data.origin?.fetchedAt?$.jsxDEV("span",{className:"mode",children:[" · last fetched ",$.jsxDEV(D1,{iso:G.data.origin.fetchedAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):$.jsxDEV("p",{children:"No remote — this World keeps its default data. Name one to push its changesets to a shared World and pull what others pushed there."},void 0,!1,void 0,this):$.jsxDEV(Z0,{load:G,what:"the remote",lines:1},void 0,!1,void 0,this),N?$.jsxDEV("form",{className:"stack origin-form",onSubmit:(C)=>void R(C),"aria-label":"Name the remote",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The World's address"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"originUrl",value:W,onChange:(C)=>I(C.target.value),placeholder:"https://worlds.example.com/acme/team",required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"A key or token that opens it"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"originToken",type:"password",value:M,onChange:(C)=>B(C.target.value),required:!0,autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:"Naming it brings its history in. Your pushes are recorded there as whoever this key was made for, or as the key itself."},void 0,!1,void 0,this),$.jsxDEV("div",{className:"row-actions",children:[$.jsxDEV("button",{type:"submit",className:"primary",disabled:Y!==null,children:Y==="Name the remote"?"Bringing its history in…":"Save the remote"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>A(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(A2,{log:X,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function PF({name:_,token:Q,canWrite:J,refused:q}){let[U,G]=p.useState(0),Z=V1(Q,`/-/${_}/twins`,U),F=V1(Q,`/-/${_}/links`,U),X=V1(Q,`/-/${_}/requests?hours=24`,U),[Y,K]=p.useState({}),[H,L]=p.useState(null),[z,W]=p.useState(""),[I,M]=p.useState(!1),[B,N]=p.useState([]),A=(w,k,E)=>{if(N((r)=>[{ok:w,text:k,at:new Date().toISOString(),n:++q4,...E?.length?{acts:E}:{}},...r].slice(0,6)),!w)p1(k,"error")},R=F.state==="ok"?Object.keys(F.data.links).sort():[];p.useEffect(()=>{let w=!0;return Promise.all(R.map(async(k)=>{let E=await y1(Q,`/-/${_}/twins/${k}/credential`).catch(()=>null),r=E?.ok?await E.json():null;return[k,r?.credential??null]})).then((k)=>{if(w)K(Object.fromEntries(k))}),()=>{w=!1}},[_,Q,R.join(","),U]);let O=async(w)=>{if(w.preventDefault(),!H||!z)return;M(!0);let k=await y1(Q,`/-/${_}/twins/${H.vendor}/credential`,{method:"PUT",body:z,headers:{"content-type":"text/plain"}}).catch(()=>null);if(M(!1),!k){A(!1,`Seal ${H.vendor}: ${j1} did not answer`);return}if(!k.ok){q(k);let r=o1(await _2(k));A(!1,`Seal ${M1(H.vendor)}: ${r.text}`,r.acts);return}let E=await k.json().catch(()=>({}));A(!0,`Sealed a credential for ${M1(H.vendor)}${E.fingerprint?` (${E.fingerprint})`:""}: it opens for ${E.boundTo??H.to} only, and is never shown again.`),W(""),L(null),G((r)=>r+1)},C=async(w)=>{if(!await c0({title:`Remove the link ${w}?`,body:`Requests to ${i0}/${_}/${w}/… stop being forwarded to ${F.state==="ok"?F.data.links[w]?.origin:"its origin"}.`,action:"Remove link",danger:!0}))return;let k=await y1(Q,`/-/${_}/links/${w}`,{method:"DELETE"}).catch(()=>null);if(!k?.ok){if(k)q(k);A(!1,`Remove ${w}: ${k?await K0(k):"the World did not answer"}`);return}A(!0,`Removed the link ${w}.`),G((E)=>E+1)},f=(w)=>w?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"badge rooted",children:"sealed"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[w.fingerprint?$.jsxDEV("code",{children:w.fingerprint},void 0,!1,void 0,this):null," · ",$.jsxDEV(D1,{iso:w.placedAt},void 0,!1,void 0,this),w.sealedBy?` · by ${w.sealedBy==="vault"?"the vault":"the host's key"}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV("span",{className:"mode",children:"none"},void 0,!1,void 0,this),S=Z.state==="ok"?Z.data.twins:[];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"lede",children:"A real vendor's credential lives in one place, sealed: beside this World, bound to where it goes. It is never readable back; this page says only that one is sealed, when, by what, and for where."},void 0,!1,void 0,this),$.jsxDEV(A2,{log:B,name:_},void 0,!1,void 0,this),$.jsxDEV("section",{className:"block","aria-labelledby":"creds-head",children:[$.jsxDEV("div",{className:"block-head",children:$.jsxDEV("h3",{id:"creds-head",children:"Vendors"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(Z0,{load:Z,what:"the vendors"},void 0,!1,void 0,this),Z.state==="ok"?$.jsxDEV("table",{className:"dense","aria-label":"Credentials by vendor",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Credential"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Bound to"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Real service"},void 0,!1,void 0,this),J?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:S.map((w)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(a1,{vendor:w.twin},void 0,!1,void 0,this),M1(w.twin)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:f(w.credential)},void 0,!1,void 0,this),$.jsxDEV("td",{children:w.credential?.boundTo?$.jsxDEV("code",{children:w.credential.boundTo},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:w.root?.url?$.jsxDEV("code",{children:w.root.url},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"none: a stand-in"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J?$.jsxDEV("td",{className:"num",children:$.jsxDEV("button",{type:"button",disabled:!w.root?.url,title:w.root?.url?`Seal ${M1(w.twin)}'s real credential for ${w.root.url}`:"Connect it to its real service first (Settings › Real services): a credential is sealed for where it goes",onClick:()=>{W(""),L({vendor:w.twin,to:w.root.url})},children:w.credential?"Replace…":"Seal a credential…"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},w.twin,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,Z.state==="ok"&&S.every((w)=>!w.root?.url)?$.jsxDEV("p",{className:"mode pad",children:"No vendor here has a real service behind it, so none holds a credential. Connect one in Settings › Real services; its credential is sealed here."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("section",{className:"block","aria-labelledby":"links-head",children:[$.jsxDEV("div",{className:"block-head",children:[$.jsxDEV("h3",{id:"links-head",children:"Links"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"a vendor with no twin, forwarded with its sealed credential"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(Z0,{load:F,what:"the links"},void 0,!1,void 0,this),X.state==="ok"&&(X.data.journalFailures??0)>0?$.jsxDEV("p",{className:"mode pad",role:"alert",children:[X.data.journalFailures," request ",X.data.journalFailures===1?"line was":"lines were"," not kept by this World's server since it started (its links, and the twins it runs in its own process): those requests are missing from what this page counts."]},void 0,!0,void 0,this):null,F.state==="ok"&&R.length===0?$.jsxDEV("p",{className:"mode pad",children:["No links. A link forwards requests for a vendor with no twin here, at ",$.jsxDEV("code",{children:[i0,"/",_,"/<link>/…"]},void 0,!0,void 0,this),", to that vendor's real API with the credential sealed for it."]},void 0,!0,void 0,this):null,R.length?$.jsxDEV("table",{className:"dense","aria-label":"Links",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Link"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Origin"},void 0,!1,void 0,this),$.jsxDEV("th",{className:"num",children:"Requests, 24h"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Credential"},void 0,!1,void 0,this),J?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:R.map((w)=>{let k=F.state==="ok"?F.data.links[w].origin:"",E=X.state==="ok"?X.data.twins.find((r)=>r.twin===w):void 0;return $.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("b",{children:w},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:$.jsxDEV("code",{children:k},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"num",children:E?$.jsxDEV("span",{title:Object.entries(E.byStatus).map(([r,c])=>`${r}: ${c}`).join(" · "),children:E.requests},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:[f(Y[w]??null),Y[w]?.boundTo?$.jsxDEV("div",{className:"mode",children:["bound to ",$.jsxDEV("code",{children:Y[w].boundTo},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),J?$.jsxDEV("td",{className:"num row-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>{W(""),L({vendor:w,to:k})},children:Y[w]?"Replace…":"Seal a credential…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>void C(w),children:"Remove…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},w,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(O0,{open:Boolean(H),onClose:()=>{if(!I)L(null)},title:`Seal ${H?M1(H.vendor):""}'s credential`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>L(null),disabled:I,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"seal-credential",className:"primary",disabled:I||!z,children:I?"Sealing…":"Seal it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"seal-credential",className:"stack",onSubmit:(w)=>void O(w),children:[$.jsxDEV("p",{className:"mode",children:["It is sealed for ",$.jsxDEV("code",{children:H?.to},void 0,!1,void 0,this)," and opens there only. It is never shown again, here or anywhere."]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The real key"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"credential",type:"password",value:z,onChange:(w)=>W(w.target.value),autoComplete:"off",required:!0,autoFocus:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function NF({name:_,token:Q,admin:J,canWrite:q,refused:U,onRemoved:G,only:Z}){let F=(V)=>!Z||Z===V,[X,Y]=p.useState(0),K=V1(Q,`/-/${_}/twins`,X),H=V1(Q,`/-/${_}/checks`,X),[L,z]=p.useState(0),W=V1(Q,`/-/${_}/clock`,L),[I,M]=p.useState([]),[B,N]=p.useState(null),[A,R]=p.useState(null),[O,C]=p.useState(""),[f,S]=p.useState("gated"),[w,k]=p.useState(!1),E=(V,D,P)=>{if(M((u)=>[{ok:V,text:D,at:new Date().toISOString(),n:++q4,...P?.length?{acts:P}:{}},...u].slice(0,6)),!V)p1(D,"error")},r=async(V,D,P)=>{let u=await y1(Q,D,P).catch(()=>null);if(!u)return E(!1,`${V}: the World did not answer`),!1;if(!u.ok){U(u);let m=o1(await _2(u));return E(!1,`${V}: ${m.text}`,m.acts),!1}return E(!0,`${V}: done.`),Y((m)=>m+1),!0},c=async(V)=>{if(V.preventDefault(),!A)return;k(!0);let D=A.root??{},P=await r(O.trim()?`Connect ${M1(A.twin)} to ${O.trim()}`:`Disconnect ${M1(A.twin)}`,`/-/${_}/twins/${A.twin}/root`,{method:"PUT",body:JSON.stringify(O.trim()?{...D,url:O.trim(),deploy:f}:null)});if(k(!1),P)R(null)},y=async()=>{if(!await c0({title:`Rotate the tokens of ${_}?`,body:"Every app, script and person holding the current tokens loses access at once. The new ones are shown once.",action:"Rotate tokens",danger:!0}))return;let V=await y1(J,`/-/worlds/${_}/rotate`,{method:"POST"});if(V.ok)N(await V.json()),E(!0,"Rotated: the new tokens are shown once, below.");else E(!1,`Rotate: ${await K0(V)}`)},b=async()=>{if(!await c0({title:`Remove ${_}?`,body:"The host stops serving it and its whole history goes with it. This cannot be undone.",action:"Remove World",danger:!0,typed:_}))return;let V=await y1(J,`/-/worlds/${_}`,{method:"DELETE"}).catch((D)=>D);if(V instanceof Error){E(!1,`Remove: the host did not answer (${V.message})`);return}if(V.ok)G();else E(!1,`Remove: ${await K0(V)}`)},v=K.state==="ok"?K.data.twins:[],x={gated:"gated: a person deploys an approved changeset",auto:"auto: a push deploys at once",hold:"hold: nothing deploys"};return $.jsxDEV($.Fragment,{children:[$.jsxDEV(A2,{log:I,name:_},void 0,!1,void 0,this),F("access")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Access"},void 0,!1,void 0,this),q?$.jsxDEV(OF,{name:_,token:Q},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode",children:"This session reads the World: its keys are managed by whoever holds its token."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,F("services")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Real services"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:[v.some((V)=>V.root?.url)?null:"Every vendor here is a stand-in. ","Connect a vendor to its real service to read the real state into this World; its real credential is sealed in the Vault, and an approved changeset deploys there by its policy."]},void 0,!0,void 0,this),$.jsxDEV(Z0,{load:K,what:"the vendors"},void 0,!1,void 0,this),K.state==="ok"?$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Real services",children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Real service"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Deploy policy"},void 0,!1,void 0,this),$.jsxDEV("th",{children:"Last read from it"},void 0,!1,void 0,this),q?$.jsxDEV("th",{className:"num",children:$.jsxDEV("span",{className:"sr",children:"Actions"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("tbody",{children:v.map((V)=>{let D=V.root;return $.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(a1,{vendor:V.twin},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${O1}/${_}/${V.twin}`,title:`Its log and stored state · ${V.position??0} entries`,onClick:(P)=>{P.preventDefault(),h1([..._.split("/"),V.twin])},children:M1(V.twin)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:D?.url?$.jsxDEV("code",{children:D.url},void 0,!1,void 0,this):$.jsxDEV("span",{className:"mode",children:"not connected"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:D?.url?x[D.deploy??""]??D.deploy??"—":"—"},void 0,!1,void 0,this),$.jsxDEV("td",{children:V.refresh?.failed?$.jsxDEV("span",{role:"alert",children:["failed ×",V.refresh.failed.count??1,": ",V.refresh.failed.reason??""]},void 0,!0,void 0,this):D?.url?D2(V.refresh?.observedAt??V.refresh?.at):$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q?$.jsxDEV("td",{className:"num row-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>{C(D?.url??""),S(D?.deploy==="auto"||D?.deploy==="hold"?D.deploy:"gated"),R(V)},children:D?.url?"Change…":"Connect…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",disabled:!D?.url,title:D?.url?"Read the real service's current state into this World":"Connect it first",onClick:()=>void c0({title:`Read ${M1(V.twin)} now?`,body:`The real ${M1(V.twin)}'s current state is read into this World. Nothing is written to ${M1(V.twin)}.`,action:"Read from it"}).then((P)=>{if(P)r(`Read from ${M1(V.twin)}`,`/-/${_}/twins/${V.twin}/refresh`,{method:"POST"})}),children:"Read from it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},V.twin,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,F("clock")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Clock"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"The instant every vendor here stamps from. Set it and move it forward to see what happens later: renewals, expiries, scheduled sends."},void 0,!1,void 0,this),$.jsxDEV(QF,{name:_,token:Q,clock:W,canWrite:q,onChanged:()=>z((V)=>V+1),refused:U,open:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,F("checks")?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Checks"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:"JavaScript the World runs over every change before it is performed (a changeset's Verify runs them too)."},void 0,!1,void 0,this),$.jsxDEV(Z0,{load:H,what:"the checks"},void 0,!1,void 0,this),H.state==="ok"?H.data.checks.length===0?$.jsxDEV("p",{className:"mode",children:"No checks: every change is performed as it comes."},void 0,!1,void 0,this):$.jsxDEV("div",{className:"block",children:$.jsxDEV("table",{className:"dense","aria-label":"Checks",children:$.jsxDEV("tbody",{children:H.data.checks.map((V)=>$.jsxDEV("tr",{children:$.jsxDEV("td",{children:$.jsxDEV("code",{children:V},void 0,!1,void 0,this)},void 0,!1,void 0,this)},V,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,J&&!Z?$.jsxDEV("div",{className:"danger",role:"region","aria-label":"Danger zone",children:[$.jsxDEV("h3",{children:"Danger zone"},void 0,!1,void 0,this),B?$.jsxDEV("p",{role:"status",children:["token ",$.jsxDEV("code",{children:B.token},void 0,!1,void 0,this)," · read token ",$.jsxDEV("code",{children:B.readToken},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("p",{children:[$.jsxDEV("button",{type:"button",onClick:()=>void y(),children:"Rotate tokens"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"New tokens for this World; every app, script and browser using the old ones is signed out."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{children:[$.jsxDEV("button",{type:"button",onClick:()=>void b(),children:"Remove world"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"Deletes this World and everything in it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV(O0,{open:Boolean(A),onClose:()=>{if(!w)R(null)},title:`Connect ${A?M1(A.twin):""} to its real service`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>R(null),disabled:w,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"connect-root",className:"primary",disabled:w,children:w?"Saving…":O.trim()?"Connect":"Disconnect"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"connect-root",className:"stack",onSubmit:(V)=>void c(V),children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The real service's API address"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"rootUrl",value:O,onChange:(V)=>C(V.target.value),placeholder:"https://api.openai.com",autoFocus:!0},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"Empty disconnects it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Deploy policy"},void 0,!1,void 0,this),$.jsxDEV("select",{name:"rootDeploy",value:f,onChange:(V)=>S(V.target.value==="auto"?"auto":V.target.value==="hold"?"hold":"gated"),children:["gated","auto","hold"].map((V)=>$.jsxDEV("option",{value:V,children:x[V]},V,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function UM(){return $.jsxDEV($.Fragment,{children:[$.jsxDEV(EZ,{},void 0,!1,void 0,this),$.jsxDEV(o_,{},void 0,!1,void 0,this),$.jsxDEV(t_,{},void 0,!1,void 0,this),$.jsxDEV(s_,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{qM as openAt,J4 as ROOT,UM as ConsolePage};
|