@volter/world-console 3.0.25 → 3.0.27
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 +57 -106
- package/dist/client/console.bundle.js +12 -12
- package/dist/client/console.tsx +57 -106
- package/dist/client/main.bundle.js +104 -104
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var oQ=Object.create;var{getPrototypeOf:nQ,defineProperty:u8,getOwnPropertyNames:eQ}=Object;var _$=Object.prototype.hasOwnProperty;function Q$(_){return this[_]}var $$,J$,Q0=(_,Q,$)=>{var q=_!=null&&typeof _==="object";if(q){var U=Q?$$??=new WeakMap:J$??=new WeakMap,G=U.get(_);if(G)return G}$=_!=null?oQ(nQ(_)):{};let Z=Q||!_||!_.__esModule?u8($,"default",{value:_,enumerable:!0}):$;for(let F of eQ(_))if(!_$.call(Z,F))u8(Z,F,{get:Q$.bind(_,F),enumerable:!0});if(q)U.set(_,Z);return Z};var O2=(_,Q)=>()=>(Q||_((Q={exports:{}}).exports,Q),Q.exports);var u0=O2((q$,U4)=>{(function(){function _(R,g){Object.defineProperty(q.prototype,R,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",g[0],g[1])}})}function Q(R){if(R===null||typeof R!=="object")return null;return R=Q1&&R[Q1]||R["@@iterator"],typeof R==="function"?R:null}function $(R,g){R=(R=R.constructor)&&(R.displayName||R.name)||"ReactClass";var _1=R+"."+g;J1[_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,R),J1[_1]=!0)}function q(R,g,_1){this.props=R,this.context=g,this.refs=K1,this.updater=_1||Z1}function U(){}function G(R,g,_1){this.props=R,this.context=g,this.refs=K1,this.updater=_1||Z1}function Z(){}function F(R){return""+R}function X(R){try{F(R);var g=!1}catch(Y1){g=!0}if(g){g=console;var _1=g.error,q1=typeof Symbol==="function"&&Symbol.toStringTag&&R[Symbol.toStringTag]||R.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.",q1),F(R)}}function Y(R){if(R==null)return null;if(typeof R==="function")return R.$$typeof===R1?null:R.displayName||R.name||null;if(typeof R==="string")return R;switch(R){case m:return"Fragment";case u:return"Profiler";case P:return"StrictMode";case $1:return"Suspense";case i:return"SuspenseList";case n:return"Activity"}if(typeof R==="object")switch(typeof R.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),R.$$typeof){case V:return"Portal";case h:return R.displayName||"Context";case E:return(R._context.displayName||"Context")+".Consumer";case o:var g=R.render;return R=R.displayName,R||(R=g.displayName||g.name||"",R=R!==""?"ForwardRef("+R+")":"ForwardRef"),R;case t:return g=R.displayName||null,g!==null?g:Y(R.type)||"Memo";case p:g=R._payload,R=R._init;try{return Y(R(g))}catch(_1){}}return null}function K(R){if(R===m)return"<>";if(typeof R==="object"&&R!==null&&R.$$typeof===p)return"<...>";try{var g=Y(R);return g?"<"+g+">":"<...>"}catch(_1){return"<...>"}}function H(){var R=X1.A;return R===null?null:R.getOwner()}function L(){return Error("react-stack-top-frame")}function z(R){if(y1.call(R,"key")){var g=Object.getOwnPropertyDescriptor(R,"key").get;if(g&&g.isReactWarning)return!1}return R.key!==void 0}function W(R,g){function _1(){o1||(o1=!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(R,"key",{get:_1,configurable:!0})}function I(){var R=Y(this.type);return J0[R]||(J0[R]=!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.")),R=this.props.ref,R!==void 0?R:null}function M(R,g,_1,q1,Y1,I1){var O1=_1.ref;return R={$$typeof:j,type:R,key:g,props:_1,_owner:q1},(O1!==void 0?O1:null)!==null?Object.defineProperty(R,"ref",{enumerable:!1,get:I}):Object.defineProperty(R,"ref",{enumerable:!1,value:null}),R._store={},Object.defineProperty(R._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(R,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(R,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Y1}),Object.defineProperty(R,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:I1}),Object.freeze&&(Object.freeze(R.props),Object.freeze(R)),R}function B(R,g){return g=M(R.type,g,R.props,R._owner,R._debugStack,R._debugTask),R._store&&(g._store.validated=R._store.validated),g}function N(R){A(R)?R._store&&(R._store.validated=1):typeof R==="object"&&R!==null&&R.$$typeof===p&&(R._payload.status==="fulfilled"?A(R._payload.value)&&R._payload.value._store&&(R._payload.value._store.validated=1):R._store&&(R._store.validated=1))}function A(R){return typeof R==="object"&&R!==null&&R.$$typeof===j}function T(R){var g={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(_1){return g[_1]})}function O(R,g){return typeof R==="object"&&R!==null&&R.key!=null?(X(R.key),T(""+R.key)):g.toString(36)}function C(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status==="string"?R.then(Z,Z):(R.status="pending",R.then(function(g){R.status==="pending"&&(R.status="fulfilled",R.value=g)},function(g){R.status==="pending"&&(R.status="rejected",R.reason=g)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function f(R,g,_1,q1,Y1){var I1=typeof R;if(I1==="undefined"||I1==="boolean")R=null;var O1=!1;if(R===null)O1=!0;else switch(I1){case"bigint":case"string":case"number":O1=!0;break;case"object":switch(R.$$typeof){case j:case V:O1=!0;break;case p:return O1=R._init,f(O1(R._payload),g,_1,q1,Y1)}}if(O1){O1=R,Y1=Y1(O1);var j1=q1===""?"."+O(O1,0):q1;return e(Y1)?(_1="",j1!=null&&(_1=j1.replace(q0,"$&/")+"/"),f(Y1,g,_1,"",function(T0){return T0})):Y1!=null&&(A(Y1)&&(Y1.key!=null&&(O1&&O1.key===Y1.key||X(Y1.key)),_1=B(Y1,_1+(Y1.key==null||O1&&O1.key===Y1.key?"":(""+Y1.key).replace(q0,"$&/")+"/")+j1),q1!==""&&O1!=null&&A(O1)&&O1.key==null&&O1._store&&!O1._store.validated&&(_1._store.validated=2),Y1=_1),g.push(Y1)),1}if(O1=0,j1=q1===""?".":q1+":",e(R))for(var f1=0;f1<R.length;f1++)q1=R[f1],I1=j1+O(q1,f1),O1+=f(q1,g,_1,I1,Y1);else if(f1=Q(R),typeof f1==="function")for(f1===R.entries&&(X0||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),X0=!0),R=f1.call(R),f1=0;!(q1=R.next()).done;)q1=q1.value,I1=j1+O(q1,f1++),O1+=f(q1,g,_1,I1,Y1);else if(I1==="object"){if(typeof R.then==="function")return f(C(R),g,_1,q1,Y1);throw g=String(R),Error("Objects are not valid as a React child (found: "+(g==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":g)+"). If you meant to render a collection of children, use an array instead.")}return O1}function S(R,g,_1){if(R==null)return R;var q1=[],Y1=0;return f(R,q1,"","",function(I1){return g.call(_1,I1,Y1++)}),q1}function w(R){if(R._status===-1){var g=R._ioInfo;g!=null&&(g.start=g.end=performance.now()),g=R._result;var _1=g();if(_1.then(function(Y1){if(R._status===0||R._status===-1){R._status=1,R._result=Y1;var I1=R._ioInfo;I1!=null&&(I1.end=performance.now()),_1.status===void 0&&(_1.status="fulfilled",_1.value=Y1)}},function(Y1){if(R._status===0||R._status===-1){R._status=2,R._result=Y1;var I1=R._ioInfo;I1!=null&&(I1.end=performance.now()),_1.status===void 0&&(_1.status="rejected",_1.reason=Y1)}}),g=R._ioInfo,g!=null){g.value=_1;var q1=_1.displayName;typeof q1==="string"&&(g.name=q1)}R._status===-1&&(R._status=0,R._result=_1)}if(R._status===1)return g=R._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 R._result}function y(){var R=X1.H;return R===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.`),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:
|
|
13
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),R}function D(){X1.asyncTransitions--}function c(R){if(f0===null)try{var g=("require"+Math.random()).slice(0,7);f0=(U4&&U4[g]).call(U4,"timers").setImmediate}catch(_1){f0=function(q1){l0===!1&&(l0=!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=q1,Y1.port2.postMessage(void 0)}}return f0(R)}function l(R){return 1<R.length&&typeof AggregateError==="function"?AggregateError(R):R[0]}function v(R,g){g!==r0-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. "),r0=g}function x(R,g,_1){var q1=X1.actQueue;if(q1!==null)if(q1.length!==0)try{b(q1),c(function(){return x(R,g,_1)});return}catch(Y1){X1.thrownErrors.push(Y1)}else X1.actQueue=null;0<X1.thrownErrors.length?(q1=l(X1.thrownErrors),X1.thrownErrors.length=0,_1(q1)):g(R)}function b(R){if(!F2){F2=!0;var g=0;try{for(;g<R.length;g++){var _1=R[g];do{X1.didUsePromise=!1;var q1=_1(!1);if(q1!==null){if(X1.didUsePromise){R[g]=_1,R.splice(0,g);return}_1=q1}else break}while(1)}R.length=0}catch(Y1){R.splice(0,g+1),X1.thrownErrors.push(Y1)}finally{F2=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var j=Symbol.for("react.transitional.element"),V=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),h=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),$1=Symbol.for("react.suspense"),i=Symbol.for("react.suspense_list"),t=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),n=Symbol.for("react.activity"),Q1=Symbol.iterator,J1={},Z1={isMounted:function(){return!1},enqueueForceUpdate:function(R){$(R,"forceUpdate")},enqueueReplaceState:function(R){$(R,"replaceState")},enqueueSetState:function(R){$(R,"setState")}},L1=Object.assign,K1={};Object.freeze(K1),q.prototype.isReactComponent={},q.prototype.setState=function(R,g){if(typeof R!=="object"&&typeof R!=="function"&&R!=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,R,g,"setState")},q.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};var W1={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 W1)W1.hasOwnProperty(V0)&&_(V0,W1[V0]);U.prototype=q.prototype,W1=G.prototype=new U,W1.constructor=G,L1(W1,q.prototype),W1.isPureReactComponent=!0;var e=Array.isArray,R1=Symbol.for("react.client.reference"),X1={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},y1=Object.prototype.hasOwnProperty,e1=console.createTask?console.createTask:function(){return null};W1={react_stack_bottom_frame:function(R){return R()}};var o1,W0,J0={},w0=W1.react_stack_bottom_frame.bind(W1,L)(),_0=e1(K(L)),X0=!1,q0=/\/+/g,U0=typeof reportError==="function"?reportError:function(R){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var g=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R==="object"&&R!==null&&typeof R.message==="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(g))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",R);return}console.error(R)},l0=!1,f0=null,r0=0,i0=!1,F2=!1,d0=typeof queueMicrotask==="function"?function(R){queueMicrotask(function(){return queueMicrotask(R)})}:c;W1=Object.freeze({__proto__:null,c:function(R){return y().useMemoCache(R)}});var V0={map:S,forEach:function(R,g,_1){S(R,function(){g.apply(this,arguments)},_1)},count:function(R){var g=0;return S(R,function(){g++}),g},toArray:function(R){return S(R,function(g){return g})||[]},only:function(R){if(!A(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};q$.Activity=n,q$.Children=V0,q$.Component=q,q$.Fragment=m,q$.Profiler=u,q$.PureComponent=G,q$.StrictMode=P,q$.Suspense=$1,q$.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=X1,q$.__COMPILER_RUNTIME=W1,q$.act=function(R){var g=X1.actQueue,_1=r0;r0++;var q1=X1.actQueue=g!==null?g:[],Y1=!1;try{var I1=R()}catch(f1){X1.thrownErrors.push(f1)}if(0<X1.thrownErrors.length)throw v(g,_1),R=l(X1.thrownErrors),X1.thrownErrors.length=0,R;if(I1!==null&&typeof I1==="object"&&typeof I1.then==="function"){var O1=I1;return d0(function(){Y1||i0||(i0=!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,T0){Y1=!0,O1.then(function(C0){if(v(g,_1),_1===0){try{b(q1),c(function(){return x(C0,f1,T0)})}catch(z5){X1.thrownErrors.push(z5)}if(0<X1.thrownErrors.length){var R2=l(X1.thrownErrors);X1.thrownErrors.length=0,T0(R2)}}else f1(C0)},function(C0){v(g,_1),0<X1.thrownErrors.length?(C0=l(X1.thrownErrors),X1.thrownErrors.length=0,T0(C0)):T0(C0)})}}}var j1=I1;if(v(g,_1),_1===0&&(b(q1),q1.length!==0&&d0(function(){Y1||i0||(i0=!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(() => ...)"))}),X1.actQueue=null),0<X1.thrownErrors.length)throw R=l(X1.thrownErrors),X1.thrownErrors.length=0,R;return{then:function(f1,T0){Y1=!0,_1===0?(X1.actQueue=q1,c(function(){return x(j1,f1,T0)})):f1(j1)}}},q$.cache=function(R){return function(){return R.apply(null,arguments)}},q$.cacheSignal=function(){return null},q$.captureOwnerStack=function(){var R=X1.getCurrentStack;return R===null?null:R()},q$.cloneElement=function(R,g,_1){if(R===null||R===void 0)throw Error("The argument must be a React element, but you passed "+R+".");var q1=L1({},R.props),Y1=R.key,I1=R._owner;if(g!=null){var O1;_:{if(y1.call(g,"ref")&&(O1=Object.getOwnPropertyDescriptor(g,"ref").get)&&O1.isReactWarning){O1=!1;break _}O1=g.ref!==void 0}O1&&(I1=H()),z(g)&&(X(g.key),Y1=""+g.key);for(j1 in g)!y1.call(g,j1)||j1==="key"||j1==="__self"||j1==="__source"||j1==="ref"&&g.ref===void 0||(q1[j1]=g[j1])}var j1=arguments.length-2;if(j1===1)q1.children=_1;else if(1<j1){O1=Array(j1);for(var f1=0;f1<j1;f1++)O1[f1]=arguments[f1+2];q1.children=O1}q1=M(R.type,Y1,q1,I1,R._debugStack,R._debugTask);for(Y1=2;Y1<arguments.length;Y1++)N(arguments[Y1]);return q1},q$.createContext=function(R){return R={$$typeof:h,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:E,_context:R},R._currentRenderer=null,R._currentRenderer2=null,R},q$.createElement=function(R,g,_1){for(var q1=2;q1<arguments.length;q1++)N(arguments[q1]);q1={};var Y1=null;if(g!=null)for(f1 in W0||!("__self"in g)||"key"in g||(W0=!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)y1.call(g,f1)&&f1!=="key"&&f1!=="__self"&&f1!=="__source"&&(q1[f1]=g[f1]);var I1=arguments.length-2;if(I1===1)q1.children=_1;else if(1<I1){for(var O1=Array(I1),j1=0;j1<I1;j1++)O1[j1]=arguments[j1+2];Object.freeze&&Object.freeze(O1),q1.children=O1}if(R&&R.defaultProps)for(f1 in I1=R.defaultProps,I1)q1[f1]===void 0&&(q1[f1]=I1[f1]);Y1&&W(q1,typeof R==="function"?R.displayName||R.name||"Unknown":R);var f1=1e4>X1.recentlyCreatedOwnerStacks++;return M(R,Y1,q1,H(),f1?Error("react-stack-top-frame"):w0,f1?e1(K(R)):_0)},q$.createRef=function(){var R={current:null};return Object.seal(R),R},q$.forwardRef=function(R){R!=null&&R.$$typeof===t?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof R!=="function"?console.error("forwardRef requires a render function but was given %s.",R===null?"null":typeof R):R.length!==0&&R.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",R.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),R!=null&&R.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var g={$$typeof:o,render:R},_1;return Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return _1},set:function(q1){_1=q1,R.name||R.displayName||(Object.defineProperty(R,"name",{value:q1}),R.displayName=q1)}}),g},q$.isValidElement=A,q$.lazy=function(R){R={_status:-1,_result:R};var g={$$typeof:p,_payload:R,_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 R._ioInfo=_1,g._debugInfo=[{awaited:_1}],g},q$.memo=function(R,g){R==null&&console.error("memo: The first argument must be a component. Instead received: %s",R===null?"null":typeof R),g={$$typeof:t,type:R,compare:g===void 0?null:g};var _1;return Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return _1},set:function(q1){_1=q1,R.name||R.displayName||(Object.defineProperty(R,"name",{value:q1}),R.displayName=q1)}}),g},q$.startTransition=function(R){var g=X1.T,_1={};_1._updatedFibers=new Set,X1.T=_1;try{var q1=R(),Y1=X1.S;Y1!==null&&Y1(_1,q1),typeof q1==="object"&&q1!==null&&typeof q1.then==="function"&&(X1.asyncTransitions++,q1.then(D,D),q1.then(Z,U0))}catch(I1){U0(I1)}finally{g===null&&_1._updatedFibers&&(R=_1._updatedFibers.size,_1._updatedFibers.clear(),10<R&&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),X1.T=g}},q$.unstable_useCacheRefresh=function(){return y().useCacheRefresh()},q$.use=function(R){return y().use(R)},q$.useActionState=function(R,g,_1){return y().useActionState(R,g,_1)},q$.useCallback=function(R,g){return y().useCallback(R,g)},q$.useContext=function(R){var g=y();return R.$$typeof===E&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),g.useContext(R)},q$.useDebugValue=function(R,g){return y().useDebugValue(R,g)},q$.useDeferredValue=function(R,g){return y().useDeferredValue(R,g)},q$.useEffect=function(R,g){return R==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),y().useEffect(R,g)},q$.useEffectEvent=function(R){return y().useEffectEvent(R)},q$.useId=function(){return y().useId()},q$.useImperativeHandle=function(R,g,_1){return y().useImperativeHandle(R,g,_1)},q$.useInsertionEffect=function(R,g){return R==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),y().useInsertionEffect(R,g)},q$.useLayoutEffect=function(R,g){return R==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),y().useLayoutEffect(R,g)},q$.useMemo=function(R,g){return y().useMemo(R,g)},q$.useOptimistic=function(R,g){return y().useOptimistic(R,g)},q$.useReducer=function(R,g,_1){return y().useReducer(R,g,_1)},q$.useRef=function(R){return y().useRef(R)},q$.useState=function(R){return y().useState(R)},q$.useSyncExternalStore=function(R,g,_1){return y().useSyncExternalStore(R,g,_1)},q$.useTransition=function(){return y().useTransition()},q$.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var h8=O2((U$)=>{var I2=Q0(u0());(function(){function _(P){if(P==null)return null;if(typeof P==="function")return P.$$typeof===y?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 T: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(E){}}return null}function Q(P){return""+P}function $(P){try{Q(P);var u=!1}catch(o){u=!0}if(u){u=console;var E=u.error,h=typeof Symbol==="function"&&Symbol.toStringTag&&P[Symbol.toStringTag]||P.constructor.name||"Object";return E.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(E){return"<...>"}}function U(){var P=D.A;return P===null?null:P.getOwner()}function G(){return Error("react-stack-top-frame")}function Z(P){if(c.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 E(){x||(x=!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))}E.isReactWarning=!0,Object.defineProperty(P,"key",{get:E,configurable:!0})}function X(){var P=_(this.type);return b[P]||(b[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,E,h,o,$1){var i=E.ref;return P={$$typeof:z,type:P,key:u,props:E,_owner:h},(i!==void 0?i: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:$1}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P}function K(P,u,E,h,o,$1){var i=u.children;if(i!==void 0)if(h)if(l(i)){for(h=0;h<i.length;h++)H(i[h]);Object.freeze&&Object.freeze(i)}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(i);if(c.call(u,"key")){i=_(P);var t=Object.keys(u).filter(function(n){return n!=="key"});h=0<t.length?"{key: someKey, "+t.join(": ..., ")+": ...}":"{key: someKey}",m[i+h]||(t=0<t.length?"{"+t.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,
|
|
18
|
+
<%s key={someKey} {...props} />`,h,i,t,i),m[i+h]=!0)}if(i=null,E!==void 0&&($(E),i=""+E),Z(u)&&($(u.key),i=""+u.key),"key"in u){E={};for(var p in u)p!=="key"&&(E[p]=u[p])}else E=u;return i&&F(E,typeof P==="function"?P.displayName||P.name||"Unknown":P),Y(P,i,E,U(),o,$1)}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"),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"),y=Symbol.for("react.client.reference"),D=I2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,c=Object.prototype.hasOwnProperty,l=Array.isArray,v=console.createTask?console.createTask:function(){return null};I2={react_stack_bottom_frame:function(P){return P()}};var x,b={},j=I2.react_stack_bottom_frame.bind(I2,G)(),V=v(q(G)),m={};U$.Fragment=I,U$.jsx=function(P,u,E){var h=1e4>D.recentlyCreatedOwnerStacks++;return K(P,u,E,!1,h?Error("react-stack-top-frame"):j,h?v(q(P)):V)},U$.jsxs=function(P,u,E){var h=1e4>D.recentlyCreatedOwnerStacks++;return K(P,u,E,!0,h?Error("react-stack-top-frame"):j,h?v(q(P)):V)}})()});var z9=O2((_U)=>{var A0=Q0(u0());(function(){function _(L,z){return L===z&&(L!==0||1/L===1/z)||L!==L&&z!==z}function Q(L,z){Y||A0.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,$(M)&&B({inst:M})},[L,W,z]),Z(function(){return $(M)&&B({inst:M}),L(function(){$(M)&&B({inst:M})})},[L]),X(W),W}function $(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=A0.useState,Z=A0.useEffect,F=A0.useLayoutEffect,X=A0.useDebugValue,Y=!1,K=!1,H=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?q:Q;_U.useSyncExternalStore=A0.useSyncExternalStore!==void 0?A0.useSyncExternalStore:H,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var W9=O2((QU)=>{var _2=Q0(u0());(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=z9(),$=typeof Object.is==="function"?Object.is:_,q=Q.useSyncExternalStore,U=_2.useRef,G=_2.useEffect,Z=_2.useMemo,F=_2.useDebugValue;QU.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,$(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,T=K===void 0?null:K;return[function(){return M(Y())},T===null?void 0:function(){return M(T())}]},[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 I9=O2((UU)=>{var Z8=Q0(u0());(function(){function _(){}function Q(K){return""+K}function $(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=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:
|
|
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"),UU.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,UU.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 $(K,H,null,L)},UU.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.")}},UU.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))},UU.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)},UU.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})}},UU.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)},UU.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})}},UU.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))},UU.requestFormReset=function(K){F.d.r(K)},UU.unstable_batchedUpdates=function(K,H){return K(H)},UU.useFormState=function(K,H,L){return Z().useFormState(K,H,L)},UU.useFormStatus=function(){return Z().useHostTransitionStatus()},UU.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var N9=O2((yA,P9)=>{var GU=Q0(I9());P9.exports=GU});var t5=O2((CZ)=>{var E2=Q0(u0());(function(){function _(P){if(P==null)return null;if(typeof P==="function")return P.$$typeof===y?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 T: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(E){}}return null}function Q(P){return""+P}function $(P){try{Q(P);var u=!1}catch(o){u=!0}if(u){u=console;var E=u.error,h=typeof Symbol==="function"&&Symbol.toStringTag&&P[Symbol.toStringTag]||P.constructor.name||"Object";return E.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(E){return"<...>"}}function U(){var P=D.A;return P===null?null:P.getOwner()}function G(){return Error("react-stack-top-frame")}function Z(P){if(c.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 E(){x||(x=!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))}E.isReactWarning=!0,Object.defineProperty(P,"key",{get:E,configurable:!0})}function X(){var P=_(this.type);return b[P]||(b[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,E,h,o,$1){var i=E.ref;return P={$$typeof:z,type:P,key:u,props:E,_owner:h},(i!==void 0?i: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:$1}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P}function K(P,u,E,h,o,$1){var i=u.children;if(i!==void 0)if(h)if(l(i)){for(h=0;h<i.length;h++)H(i[h]);Object.freeze&&Object.freeze(i)}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(i);if(c.call(u,"key")){i=_(P);var t=Object.keys(u).filter(function(n){return n!=="key"});h=0<t.length?"{key: someKey, "+t.join(": ..., ")+": ...}":"{key: someKey}",m[i+h]||(t=0<t.length?"{"+t.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,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,`
|
|
27
|
+
<%s key={someKey} {...props} />`,h,i,t,i),m[i+h]=!0)}if(i=null,E!==void 0&&($(E),i=""+E),Z(u)&&($(u.key),i=""+u.key),"key"in u){E={};for(var p in u)p!=="key"&&(E[p]=u[p])}else E=u;return i&&F(E,typeof P==="function"?P.displayName||P.name||"Unknown":P),Y(P,i,E,U(),o,$1)}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"),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"),y=Symbol.for("react.client.reference"),D=E2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,c=Object.prototype.hasOwnProperty,l=Array.isArray,v=console.createTask?console.createTask:function(){return null};E2={react_stack_bottom_frame:function(P){return P()}};var x,b={},j=E2.react_stack_bottom_frame.bind(E2,G)(),V=v(q(G)),m={};CZ.Fragment=I,CZ.jsxDEV=function(P,u,E,h){var o=1e4>D.recentlyCreatedOwnerStacks++;return K(P,u,E,h,o?Error("react-stack-top-frame"):j,o?v(q(P)):V)}})()});var r=Q0(u0(),1);var a=Q0(h8(),1),s=Q0(u0(),1);function c1(_){if(typeof _==="string"||typeof _==="number")return""+_;let Q="";if(Array.isArray(_)){for(let $=0,q;$<_.length;$++)if((q=c1(_[$]))!=="")Q+=(Q&&" ")+q}else for(let $ in _)if(_[$])Q+=(Q&&" ")+$;return Q}var G$={value:()=>{}};function b8(){for(var _=0,Q=arguments.length,$={},q;_<Q;++_){if(!(q=arguments[_]+"")||q in $||/[\s.]/.test(q))throw Error("illegal type: "+q);$[q]=[]}return new G4($)}function G4(_){this._=_}function Z$(_,Q){return _.trim().split(/^|\s+/).map(function($){var q="",U=$.indexOf(".");if(U>=0)q=$.slice(U+1),$=$.slice(0,U);if($&&!Q.hasOwnProperty($))throw Error("unknown type: "+$);return{type:$,name:q}})}G4.prototype=b8.prototype={constructor:G4,on:function(_,Q){var $=this._,q=Z$(_+"",$),U,G=-1,Z=q.length;if(arguments.length<2){while(++G<Z)if((U=(_=q[G]).type)&&(U=F$($[U],_.name)))return U;return}if(Q!=null&&typeof Q!=="function")throw Error("invalid callback: "+Q);while(++G<Z)if(U=(_=q[G]).type)$[U]=D8($[U],_.name,Q);else if(Q==null)for(U in $)$[U]=D8($[U],_.name,null);return this},copy:function(){var _={},Q=this._;for(var $ in Q)_[$]=Q[$].slice();return new G4(_)},call:function(_,Q){if((U=arguments.length-2)>0)for(var $=Array(U),q=0,U,G;q<U;++q)$[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,$)},apply:function(_,Q,$){if(!this._.hasOwnProperty(_))throw Error("unknown type: "+_);for(var q=this._[_],U=0,G=q.length;U<G;++U)q[U].value.apply(Q,$)}};function F$(_,Q){for(var $=0,q=_.length,U;$<q;++$)if((U=_[$]).name===Q)return U.value}function D8(_,Q,$){for(var q=0,U=_.length;q<U;++q)if(_[q].name===Q){_[q]=G$,_=_.slice(0,q).concat(_.slice(q+1));break}if($!=null)_.push({name:Q,value:$});return _}var P2=b8;function i2(_){return function(){return this.matches(_)}}function Z4(_){return function(Q){return Q.matches(_)}}var F4="http://www.w3.org/1999/xhtml",K3={svg:"http://www.w3.org/2000/svg",xhtml:F4,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function h0(_){var Q=_+="",$=Q.indexOf(":");if($>=0&&(Q=_.slice(0,$))!=="xmlns")_=_.slice($+1);return K3.hasOwnProperty(Q)?{space:K3[Q],local:_}:_}function Y3(_){let Q;while(Q=_.sourceEvent)_=Q;return _}function G0(_,Q){if(_=Y3(_),Q===void 0)Q=_.currentTarget;if(Q){var $=Q.ownerSVGElement||Q;if($.createSVGPoint){var q=$.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 H$(){}function H2(_){return _==null?H$:function(){return this.querySelector(_)}}function L3(_){if(typeof _!=="function")_=H2(_);for(var Q=this._groups,$=Q.length,q=Array($),U=0;U<$;++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 z3(_){return _==null?[]:Array.isArray(_)?_:Array.from(_)}function X$(){return[]}function d2(_){return _==null?X$:function(){return this.querySelectorAll(_)}}function K$(_){return function(){return z3(_.apply(this,arguments))}}function W3(_){if(typeof _==="function")_=K$(_);else _=d2(_);for(var Q=this._groups,$=Q.length,q=[],U=[],G=0;G<$;++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 Y$=Array.prototype.find;function L$(_){return function(){return Y$.call(this.children,_)}}function z$(){return this.firstElementChild}function B3(_){return this.select(_==null?z$:L$(typeof _==="function"?_:Z4(_)))}var W$=Array.prototype.filter;function B$(){return Array.from(this.children)}function A$(_){return function(){return W$.call(this.children,_)}}function A3(_){return this.selectAll(_==null?B$:A$(typeof _==="function"?_:Z4(_)))}function M3(_){if(typeof _!=="function")_=i2(_);for(var Q=this._groups,$=Q.length,q=Array($),U=0;U<$;++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 A5(_){return Array(_.length)}function T3(){return new i1(this._enter||this._groups.map(A5),this._parents)}function M5(_,Q){this.ownerDocument=_.ownerDocument,this.namespaceURI=_.namespaceURI,this._next=null,this._parent=_,this.__data__=Q}M5.prototype={constructor:M5,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 R3(_){return function(){return _}}function M$(_,Q,$,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 $[Z]=new M5(_,G[Z]);for(;Z<X;++Z)if(F=Q[Z])U[Z]=F}function T$(_,Q,$,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 $[F]=new M5(_,G[F]);for(F=0;F<K;++F)if((X=Q[F])&&Y.get(L[F])===X)U[F]=X}function R$(_){return _.__data__}function O3(_,Q){if(!arguments.length)return Array.from(this,R$);var $=Q?T$:M$,q=this._parents,U=this._groups;if(typeof _!=="function")_=R3(_);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=O$(_.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);$(K,H,I,M,B,z,Q);for(var N=0,A=0,T,O;N<W;++N)if(T=I[N]){if(N>=A)A=N+1;while(!(O=M[A])&&++A<W);T._next=O||null}}return Z=new i1(Z,q),Z._enter=F,Z._exit=X,Z}function O$(_){return typeof _==="object"&&"length"in _?_:Array.from(_)}function I3(){return new i1(this._exit||this._groups.map(A5),this._parents)}function P3(_,Q,$){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($==null)G.remove();else $(G);return q&&U?q.merge(U).order():U}function N3(_){var Q=_.selection?_.selection():_;for(var $=this._groups,q=Q._groups,U=$.length,G=q.length,Z=Math.min(U,G),F=Array(U),X=0;X<Z;++X)for(var Y=$[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]=$[X];return new i1(F,this._parents)}function w3(){for(var _=this._groups,Q=-1,$=_.length;++Q<$;)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 f3(_){if(!_)_=I$;function Q(H,L){return H&&L?_(H.__data__,L.__data__):!H-!L}for(var $=this._groups,q=$.length,U=Array(q),G=0;G<q;++G){for(var Z=$[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 I$(_,Q){return _<Q?-1:_>Q?1:_>=Q?0:NaN}function C3(){var _=arguments[0];return arguments[0]=this,_.apply(null,arguments),this}function S3(){return Array.from(this)}function v3(){for(var _=this._groups,Q=0,$=_.length;Q<$;++Q)for(var q=_[Q],U=0,G=q.length;U<G;++U){var Z=q[U];if(Z)return Z}return null}function y3(){let _=0;for(let Q of this)++_;return _}function k3(){return!this.node()}function j3(_){for(var Q=this._groups,$=0,q=Q.length;$<q;++$)for(var U=Q[$],G=0,Z=U.length,F;G<Z;++G)if(F=U[G])_.call(F,F.__data__,G,U);return this}function P$(_){return function(){this.removeAttribute(_)}}function N$(_){return function(){this.removeAttributeNS(_.space,_.local)}}function w$(_,Q){return function(){this.setAttribute(_,Q)}}function f$(_,Q){return function(){this.setAttributeNS(_.space,_.local,Q)}}function C$(_,Q){return function(){var $=Q.apply(this,arguments);if($==null)this.removeAttribute(_);else this.setAttribute(_,$)}}function S$(_,Q){return function(){var $=Q.apply(this,arguments);if($==null)this.removeAttributeNS(_.space,_.local);else this.setAttributeNS(_.space,_.local,$)}}function V3(_,Q){var $=h0(_);if(arguments.length<2){var q=this.node();return $.local?q.getAttributeNS($.space,$.local):q.getAttribute($)}return this.each((Q==null?$.local?N$:P$:typeof Q==="function"?$.local?S$:C$:$.local?f$:w$)($,Q))}function T5(_){return _.ownerDocument&&_.ownerDocument.defaultView||_.document&&_||_.defaultView}function v$(_){return function(){this.style.removeProperty(_)}}function y$(_,Q,$){return function(){this.style.setProperty(_,Q,$)}}function k$(_,Q,$){return function(){var q=Q.apply(this,arguments);if(q==null)this.style.removeProperty(_);else this.style.setProperty(_,q,$)}}function u3(_,Q,$){return arguments.length>1?this.each((Q==null?v$:typeof Q==="function"?k$:y$)(_,Q,$==null?"":$)):X2(this.node(),_)}function X2(_,Q){return _.style.getPropertyValue(Q)||T5(_).getComputedStyle(_,null).getPropertyValue(Q)}function j$(_){return function(){delete this[_]}}function V$(_,Q){return function(){this[_]=Q}}function u$(_,Q){return function(){var $=Q.apply(this,arguments);if($==null)delete this[_];else this[_]=$}}function h3(_,Q){return arguments.length>1?this.each((Q==null?j$:typeof Q==="function"?u$:V$)(_,Q)):this.node()[_]}function E8(_){return _.trim().split(/^|\s+/)}function D3(_){return _.classList||new x8(_)}function x8(_){this._node=_,this._names=E8(_.getAttribute("class")||"")}x8.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 m8(_,Q){var $=D3(_),q=-1,U=Q.length;while(++q<U)$.add(Q[q])}function g8(_,Q){var $=D3(_),q=-1,U=Q.length;while(++q<U)$.remove(Q[q])}function h$(_){return function(){m8(this,_)}}function D$(_){return function(){g8(this,_)}}function b$(_,Q){return function(){(Q.apply(this,arguments)?m8:g8)(this,_)}}function b3(_,Q){var $=E8(_+"");if(arguments.length<2){var q=D3(this.node()),U=-1,G=$.length;while(++U<G)if(!q.contains($[U]))return!1;return!0}return this.each((typeof Q==="function"?b$:Q?h$:D$)($,Q))}function E$(){this.textContent=""}function x$(_){return function(){this.textContent=_}}function m$(_){return function(){var Q=_.apply(this,arguments);this.textContent=Q==null?"":Q}}function E3(_){return arguments.length?this.each(_==null?E$:(typeof _==="function"?m$:x$)(_)):this.node().textContent}function g$(){this.innerHTML=""}function p$(_){return function(){this.innerHTML=_}}function c$(_){return function(){var Q=_.apply(this,arguments);this.innerHTML=Q==null?"":Q}}function x3(_){return arguments.length?this.each(_==null?g$:(typeof _==="function"?c$:p$)(_)):this.node().innerHTML}function l$(){if(this.nextSibling)this.parentNode.appendChild(this)}function m3(){return this.each(l$)}function r$(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function g3(){return this.each(r$)}function i$(_){return function(){var Q=this.ownerDocument,$=this.namespaceURI;return $===F4&&Q.documentElement.namespaceURI===F4?Q.createElement(_):Q.createElementNS($,_)}}function d$(_){return function(){return this.ownerDocument.createElementNS(_.space,_.local)}}function R5(_){var Q=h0(_);return(Q.local?d$:i$)(Q)}function p3(_){var Q=typeof _==="function"?_:R5(_);return this.select(function(){return this.appendChild(Q.apply(this,arguments))})}function a$(){return null}function c3(_,Q){var $=typeof _==="function"?_:R5(_),q=Q==null?a$:typeof Q==="function"?Q:H2(Q);return this.select(function(){return this.insertBefore($.apply(this,arguments),q.apply(this,arguments)||null)})}function s$(){var _=this.parentNode;if(_)_.removeChild(this)}function l3(){return this.each(s$)}function t$(){var _=this.cloneNode(!1),Q=this.parentNode;return Q?Q.insertBefore(_,this.nextSibling):_}function o$(){var _=this.cloneNode(!0),Q=this.parentNode;return Q?Q.insertBefore(_,this.nextSibling):_}function r3(_){return this.select(_?o$:t$)}function i3(_){return arguments.length?this.property("__data__",_):this.node().__data__}function n$(_){return function(Q){_.call(this,Q,this.__data__)}}function e$(_){return _.trim().split(/^|\s+/).map(function(Q){var $="",q=Q.indexOf(".");if(q>=0)$=Q.slice(q+1),Q=Q.slice(0,q);return{type:Q,name:$}})}function _J(_){return function(){var Q=this.__on;if(!Q)return;for(var $=0,q=-1,U=Q.length,G;$<U;++$)if(G=Q[$],(!_.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 QJ(_,Q,$){return function(){var q=this.__on,U,G=n$(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=$),U.value=Q;return}}if(this.addEventListener(_.type,G,$),U={type:_.type,name:_.name,value:Q,listener:G,options:$},!q)this.__on=[U];else q.push(U)}}function d3(_,Q,$){var q=e$(_+""),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?QJ:_J;for(U=0;U<G;++U)this.each(F(q[U],Q,$));return this}function p8(_,Q,$){var q=T5(_),U=q.CustomEvent;if(typeof U==="function")U=new U(Q,$);else if(U=q.document.createEvent("Event"),$)U.initEvent(Q,$.bubbles,$.cancelable),U.detail=$.detail;else U.initEvent(Q,!1,!1);_.dispatchEvent(U)}function $J(_,Q){return function(){return p8(this,_,Q)}}function JJ(_,Q){return function(){return p8(this,_,Q.apply(this,arguments))}}function a3(_,Q){return this.each((typeof Q==="function"?JJ:$J)(_,Q))}function*s3(){for(var _=this._groups,Q=0,$=_.length;Q<$;++Q)for(var q=_[Q],U=0,G=q.length,Z;U<G;++U)if(Z=q[U])yield Z}var t3=[null];function i1(_,Q){this._groups=_,this._parents=Q}function c8(){return new i1([[document.documentElement]],t3)}function qJ(){return this}i1.prototype=c8.prototype={constructor:i1,select:L3,selectAll:W3,selectChild:B3,selectChildren:A3,filter:M3,data:O3,enter:T3,exit:I3,join:P3,merge:N3,selection:qJ,order:w3,sort:f3,call:C3,nodes:S3,node:v3,size:y3,empty:k3,each:j3,attr:V3,style:u3,property:h3,classed:b3,text:E3,html:x3,raise:m3,lower:g3,append:p3,insert:c3,remove:l3,clone:r3,datum:i3,on:d3,dispatch:a3,[Symbol.iterator]:s3};var a0=c8;function s1(_){return typeof _==="string"?new i1([[document.querySelector(_)]],[document.documentElement]):new i1([[_]],t3)}var l8={passive:!1},N2={capture:!0,passive:!1};function H4(_){_.stopImmediatePropagation()}function s0(_){_.preventDefault(),_.stopImmediatePropagation()}function a2(_){var Q=_.document.documentElement,$=s1(_).on("dragstart.drag",s0,N2);if("onselectstart"in Q)$.on("selectstart.drag",s0,N2);else Q.__noselect=Q.style.MozUserSelect,Q.style.MozUserSelect="none"}function O5(_,Q){var $=_.document.documentElement,q=s1(_).on("dragstart.drag",null);if(Q)q.on("click.drag",s0,N2),setTimeout(function(){q.on("click.drag",null)},0);if("onselectstart"in $)q.on("selectstart.drag",null);else $.style.MozUserSelect=$.__noselect,delete $.__noselect}var I5=(_)=>()=>_;function P5(_,{sourceEvent:Q,subject:$,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:$,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}})}P5.prototype.on=function(){var _=this._.on.apply(this._,arguments);return _===this._?this:_};function UJ(_){return!_.ctrlKey&&!_.button}function GJ(){return this.parentNode}function ZJ(_,Q){return Q==null?{x:_.x,y:_.y}:Q}function FJ(){return navigator.maxTouchPoints||"ontouchstart"in this}function N5(){var _=UJ,Q=GJ,$=ZJ,q=FJ,U={},G=P2("start","drag","end"),Z=0,F,X,Y,K,H=0;function L(T){T.on("mousedown.drag",z).filter(q).on("touchstart.drag",M).on("touchmove.drag",B,l8).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=A(this,Q.call(this,T,O),T,O,"mouse");if(!C)return;s1(T.view).on("mousemove.drag",W,N2).on("mouseup.drag",I,N2),a2(T.view),H4(T),Y=!1,F=T.clientX,X=T.clientY,C("start",T)}function W(T){if(s0(T),!Y){var O=T.clientX-F,C=T.clientY-X;Y=O*O+C*C>H}U.mouse("drag",T)}function I(T){s1(T.view).on("mousemove.drag mouseup.drag",null),O5(T.view,Y),s0(T),U.mouse("end",T)}function M(T,O){if(!_.call(this,T,O))return;var C=T.changedTouches,f=Q.call(this,T,O),S=C.length,w,y;for(w=0;w<S;++w)if(y=A(this,f,T,O,C[w].identifier,C[w]))H4(T),y("start",T,C[w])}function B(T){var O=T.changedTouches,C=O.length,f,S;for(f=0;f<C;++f)if(S=U[O[f].identifier])s0(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])H4(T),S("end",T,O[f])}function A(T,O,C,f,S,w){var y=G.copy(),D=G0(w||C,O),c,l,v;if((v=$.call(T,new P5("beforestart",{sourceEvent:C,target:L,identifier:S,active:Z,x:D[0],y:D[1],dx:0,dy:0,dispatch:y}),f))==null)return;return c=v.x-D[0]||0,l=v.y-D[1]||0,function x(b,j,V){var m=D,P;switch(b){case"start":U[S]=x,P=Z++;break;case"end":delete U[S],--Z;case"drag":D=G0(V||j,O),P=Z;break}y.call(b,T,new P5(b,{sourceEvent:j,subject:v,target:L,identifier:S,active:P,x:D[0]+c,y:D[1]+l,dx:D[0]-m[0],dy:D[1]-m[1],dispatch:y}),f)}}return L.filter=function(T){return arguments.length?(_=typeof T==="function"?T:I5(!!T),L):_},L.container=function(T){return arguments.length?(Q=typeof T==="function"?T:I5(T),L):Q},L.subject=function(T){return arguments.length?($=typeof T==="function"?T:I5(T),L):$},L.touchable=function(T){return arguments.length?(q=typeof T==="function"?T:I5(!!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 w5(_,Q,$){_.prototype=Q.prototype=$,$.constructor=_}function o3(_,Q){var $=Object.create(_.prototype);for(var q in Q)$[q]=Q[q];return $}function S5(){}var f5=0.7,Y4=1/f5,s2="\\s*([+-]?\\d+)\\s*",C5="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",D0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",HJ=/^#([0-9a-f]{3,8})$/,XJ=new RegExp(`^rgb\\(${s2},${s2},${s2}\\)$`),KJ=new RegExp(`^rgb\\(${D0},${D0},${D0}\\)$`),YJ=new RegExp(`^rgba\\(${s2},${s2},${s2},${C5}\\)$`),LJ=new RegExp(`^rgba\\(${D0},${D0},${D0},${C5}\\)$`),zJ=new RegExp(`^hsl\\(${C5},${D0},${D0}\\)$`),WJ=new RegExp(`^hsla\\(${C5},${D0},${D0},${C5}\\)$`),r8={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};w5(S5,v0,{copy(_){return Object.assign(new this.constructor,this,_)},displayable(){return this.rgb().displayable()},hex:i8,formatHex:i8,formatHex8:BJ,formatHsl:AJ,formatRgb:d8,toString:d8});function i8(){return this.rgb().formatHex()}function BJ(){return this.rgb().formatHex8()}function AJ(){return e8(this).formatHsl()}function d8(){return this.rgb().formatRgb()}function v0(_){var Q,$;return _=(_+"").trim().toLowerCase(),(Q=HJ.exec(_))?($=Q[1].length,Q=parseInt(Q[1],16),$===6?a8(Q):$===3?new L0(Q>>8&15|Q>>4&240,Q>>4&15|Q&240,(Q&15)<<4|Q&15,1):$===8?X4(Q>>24&255,Q>>16&255,Q>>8&255,(Q&255)/255):$===4?X4(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=XJ.exec(_))?new L0(Q[1],Q[2],Q[3],1):(Q=KJ.exec(_))?new L0(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,1):(Q=YJ.exec(_))?X4(Q[1],Q[2],Q[3],Q[4]):(Q=LJ.exec(_))?X4(Q[1]*255/100,Q[2]*255/100,Q[3]*255/100,Q[4]):(Q=zJ.exec(_))?o8(Q[1],Q[2]/100,Q[3]/100,1):(Q=WJ.exec(_))?o8(Q[1],Q[2]/100,Q[3]/100,Q[4]):r8.hasOwnProperty(_)?a8(r8[_]):_==="transparent"?new L0(NaN,NaN,NaN,0):null}function a8(_){return new L0(_>>16&255,_>>8&255,_&255,1)}function X4(_,Q,$,q){if(q<=0)_=Q=$=NaN;return new L0(_,Q,$,q)}function MJ(_){if(!(_ instanceof S5))_=v0(_);if(!_)return new L0;return _=_.rgb(),new L0(_.r,_.g,_.b,_.opacity)}function t2(_,Q,$,q){return arguments.length===1?MJ(_):new L0(_,Q,$,q==null?1:q)}function L0(_,Q,$,q){this.r=+_,this.g=+Q,this.b=+$,this.opacity=+q}w5(L0,t2,o3(S5,{brighter(_){return _=_==null?Y4:Math.pow(Y4,_),new L0(this.r*_,this.g*_,this.b*_,this.opacity)},darker(_){return _=_==null?f5:Math.pow(f5,_),new L0(this.r*_,this.g*_,this.b*_,this.opacity)},rgb(){return this},clamp(){return new L0(f2(this.r),f2(this.g),f2(this.b),L4(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:s8,formatHex:s8,formatHex8:TJ,formatRgb:t8,toString:t8}));function s8(){return`#${w2(this.r)}${w2(this.g)}${w2(this.b)}`}function TJ(){return`#${w2(this.r)}${w2(this.g)}${w2(this.b)}${w2((isNaN(this.opacity)?1:this.opacity)*255)}`}function t8(){let _=L4(this.opacity);return`${_===1?"rgb(":"rgba("}${f2(this.r)}, ${f2(this.g)}, ${f2(this.b)}${_===1?")":`, ${_})`}`}function L4(_){return isNaN(_)?1:Math.max(0,Math.min(1,_))}function f2(_){return Math.max(0,Math.min(255,Math.round(_)||0))}function w2(_){return _=f2(_),(_<16?"0":"")+_.toString(16)}function o8(_,Q,$,q){if(q<=0)_=Q=$=NaN;else if($<=0||$>=1)_=Q=NaN;else if(Q<=0)_=NaN;return new S0(_,Q,$,q)}function e8(_){if(_ instanceof S0)return new S0(_.h,_.s,_.l,_.opacity);if(!(_ instanceof S5))_=v0(_);if(!_)return new S0;if(_ instanceof S0)return _;_=_.rgb();var Q=_.r/255,$=_.g/255,q=_.b/255,U=Math.min(Q,$,q),G=Math.max(Q,$,q),Z=NaN,F=G-U,X=(G+U)/2;if(F){if(Q===G)Z=($-q)/F+($<q)*6;else if($===G)Z=(q-Q)/F+2;else Z=(Q-$)/F+4;F/=X<0.5?G+U:2-G-U,Z*=60}else F=X>0&&X<1?0:Z;return new S0(Z,F,X,_.opacity)}function _7(_,Q,$,q){return arguments.length===1?e8(_):new S0(_,Q,$,q==null?1:q)}function S0(_,Q,$,q){this.h=+_,this.s=+Q,this.l=+$,this.opacity=+q}w5(S0,_7,o3(S5,{brighter(_){return _=_==null?Y4:Math.pow(Y4,_),new S0(this.h,this.s,this.l*_,this.opacity)},darker(_){return _=_==null?f5:Math.pow(f5,_),new S0(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,$=this.l,q=$+($<0.5?$:1-$)*Q,U=2*$-q;return new L0(n3(_>=240?_-240:_+120,U,q),n3(_,U,q),n3(_<120?_+240:_-120,U,q),this.opacity)},clamp(){return new S0(n8(this.h),K4(this.s),K4(this.l),L4(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 _=L4(this.opacity);return`${_===1?"hsl(":"hsla("}${n8(this.h)}, ${K4(this.s)*100}%, ${K4(this.l)*100}%${_===1?")":`, ${_})`}`}}));function n8(_){return _=(_||0)%360,_<0?_+360:_}function K4(_){return Math.max(0,Math.min(1,_||0))}function n3(_,Q,$){return(_<60?Q+($-Q)*_/60:_<180?$:_<240?Q+($-Q)*(240-_)/60:Q)*255}function e3(_,Q,$,q,U){var G=_*_,Z=G*_;return((1-3*_+3*G-Z)*Q+(4-6*G+3*Z)*$+(1+3*_+3*G-3*Z)*q+Z*U)/6}function _6(_){var Q=_.length-1;return function($){var q=$<=0?$=0:$>=1?($=1,Q-1):Math.floor($*Q),U=_[q],G=_[q+1],Z=q>0?_[q-1]:2*U-G,F=q<Q-1?_[q+2]:2*G-U;return e3(($-q/Q)*Q,Z,U,G,F)}}function Q6(_){var Q=_.length;return function($){var q=Math.floor((($%=1)<0?++$:$)*Q),U=_[(q+Q-1)%Q],G=_[q%Q],Z=_[(q+1)%Q],F=_[(q+2)%Q];return e3(($-q/Q)*Q,U,G,Z,F)}}var v5=(_)=>()=>_;function RJ(_,Q){return function($){return _+$*Q}}function OJ(_,Q,$){return _=Math.pow(_,$),Q=Math.pow(Q,$)-_,$=1/$,function(q){return Math.pow(_+q*Q,$)}}function Q7(_){return(_=+_)===1?z4:function(Q,$){return $-Q?OJ(Q,$,_):v5(isNaN(Q)?$:Q)}}function z4(_,Q){var $=Q-_;return $?RJ(_,$):v5(isNaN(_)?Q:_)}var C2=function _(Q){var $=Q7(Q);function q(U,G){var Z=$((U=t2(U)).r,(G=t2(G)).r),F=$(U.g,G.g),X=$(U.b,G.b),Y=z4(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 $7(_){return function(Q){var $=Q.length,q=Array($),U=Array($),G=Array($),Z,F;for(Z=0;Z<$;++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 IJ=$7(_6),PJ=$7(Q6);function $6(_,Q){if(!Q)Q=[];var $=_?Math.min(Q.length,_.length):0,q=Q.slice(),U;return function(G){for(U=0;U<$;++U)q[U]=_[U]*(1-G)+Q[U]*G;return q}}function J7(_){return ArrayBuffer.isView(_)&&!(_ instanceof DataView)}function q7(_,Q){var $=Q?Q.length:0,q=_?Math.min($,_.length):0,U=Array(q),G=Array($),Z;for(Z=0;Z<q;++Z)U[Z]=b0(_[Z],Q[Z]);for(;Z<$;++Z)G[Z]=Q[Z];return function(F){for(Z=0;Z<q;++Z)G[Z]=U[Z](F);return G}}function J6(_,Q){var $=new Date;return _=+_,Q=+Q,function(q){return $.setTime(_*(1-q)+Q*q),$}}function Z0(_,Q){return _=+_,Q=+Q,function($){return _*(1-$)+Q*$}}function q6(_,Q){var $={},q={},U;if(_===null||typeof _!=="object")_={};if(Q===null||typeof Q!=="object")Q={};for(U in Q)if(U in _)$[U]=b0(_[U],Q[U]);else q[U]=Q[U];return function(G){for(U in $)q[U]=$[U](G);return q}}var G6=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,U6=new RegExp(G6.source,"g");function NJ(_){return function(){return _}}function wJ(_){return function(Q){return _(Q)+""}}function o2(_,Q){var $=G6.lastIndex=U6.lastIndex=0,q,U,G,Z=-1,F=[],X=[];_=_+"",Q=Q+"";while((q=G6.exec(_))&&(U=U6.exec(Q))){if((G=U.index)>$)if(G=Q.slice($,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:Z0(q,U)});$=U6.lastIndex}if($<Q.length)if(G=Q.slice($),F[Z])F[Z]+=G;else F[++Z]=G;return F.length<2?X[0]?wJ(X[0].x):NJ(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 b0(_,Q){var $=typeof Q,q;return Q==null||$==="boolean"?v5(Q):($==="number"?Z0:$==="string"?(q=v0(Q))?(Q=q,C2):o2:Q instanceof v0?C2:Q instanceof Date?J6:J7(Q)?$6:Array.isArray(Q)?q7:typeof Q.valueOf!=="function"&&typeof Q.toString!=="function"||isNaN(Q)?q6:Z0)(_,Q)}var U7=180/Math.PI,W4={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function B4(_,Q,$,q,U,G){var Z,F,X;if(Z=Math.sqrt(_*_+Q*Q))_/=Z,Q/=Z;if(X=_*$+Q*q)$-=_*X,q-=Q*X;if(F=Math.sqrt($*$+q*q))$/=F,q/=F,X/=F;if(_*q<Q*$)_=-_,Q=-Q,X=-X,Z=-Z;return{translateX:U,translateY:G,rotate:Math.atan2(Q,_)*U7,skewX:Math.atan(X)*U7,scaleX:Z,scaleY:F}}var A4;function G7(_){let Q=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(_+"");return Q.isIdentity?W4:B4(Q.a,Q.b,Q.c,Q.d,Q.e,Q.f)}function Z7(_){if(_==null)return W4;if(!A4)A4=document.createElementNS("http://www.w3.org/2000/svg","g");if(A4.setAttribute("transform",_),!(_=A4.transform.baseVal.consolidate()))return W4;return _=_.matrix,B4(_.a,_.b,_.c,_.d,_.e,_.f)}function F7(_,Q,$,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,$);W.push({i:I-4,x:Z0(Y,H)},{i:I-2,x:Z0(K,L)})}else if(H||L)z.push("translate("+H+Q+L+$)}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:Z0(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:Z0(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:Z0(Y,H)},{i:I-2,x:Z0(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=F7(G7,"px, ","px)","deg)"),F6=F7(Z7,", ",")",")");var fJ=0.000000000001;function H7(_){return((_=Math.exp(_))+1/_)/2}function CJ(_){return((_=Math.exp(_))-1/_)/2}function SJ(_){return((_=Math.exp(2*_))-1)/(_+1)}var S2=function _(Q,$,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<fJ)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*$*N),T=(L*L-Y*Y-q*I)/(2*L*$*N),O=Math.log(Math.sqrt(A*A+1)-A),C=Math.log(Math.sqrt(T*T+1)-T);B=(C-O)/Q,M=function(f){var S=f*B,w=H7(O),y=Y/($*N)*(w*SJ(Q*S+O)-CJ(O));return[F+y*z,X+y*W,Y*w/H7(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,k5=0,y5=0,K7=1000,M4,j5,T4=0,v2=0,R4=0,V5=typeof performance==="object"&&performance.now?performance:Date,Y7=typeof window==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(_){setTimeout(_,17)};function h5(){return v2||(Y7(vJ),v2=V5.now()+R4)}function vJ(){v2=0}function u5(){this._call=this._time=this._next=null}u5.prototype=O4.prototype={constructor:u5,restart:function(_,Q,$){if(typeof _!=="function")throw TypeError("callback is not a function");if($=($==null?h5():+$)+(Q==null?0:+Q),!this._next&&j5!==this){if(j5)j5._next=this;else M4=this;j5=this}this._call=_,this._time=$,H6()},stop:function(){if(this._call)this._call=null,this._time=1/0,H6()}};function O4(_,Q,$){var q=new u5;return q.restart(_,Q,$),q}function L7(){h5(),++n2;var _=M4,Q;while(_){if((Q=v2-_._time)>=0)_._call.call(void 0,Q);_=_._next}--n2}function X7(){v2=(T4=V5.now())+R4,n2=k5=0;try{L7()}finally{n2=0,kJ(),v2=0}}function yJ(){var _=V5.now(),Q=_-T4;if(Q>K7)R4-=Q,T4=_}function kJ(){var _,Q=M4,$,q=1/0;while(Q)if(Q._call){if(q>Q._time)q=Q._time;_=Q,Q=Q._next}else $=Q._next,Q._next=null,Q=_?_._next=$:M4=$;j5=_,H6(q)}function H6(_){if(n2)return;if(k5)k5=clearTimeout(k5);var Q=_-v2;if(Q>24){if(_<1/0)k5=setTimeout(X7,_-V5.now()-R4);if(y5)y5=clearInterval(y5)}else{if(!y5)T4=V5.now(),y5=setInterval(yJ,K7);n2=1,Y7(X7)}}function D5(_,Q,$){var q=new u5;return Q=Q==null?0:+Q,q.restart((U)=>{q.stop(),_(U+Q)},Q,$),q}var jJ=P2("start","end","cancel","interrupt"),VJ=[],B7=0,z7=1,P4=2,I4=3,W7=4,N4=5,b5=6;function t0(_,Q,$,q,U,G){var Z=_.__transition;if(!Z)_.__transition={};else if($ in Z)return;uJ(_,$,{name:Q,index:q,group:U,on:jJ,tween:VJ,time:G.time,delay:G.delay,duration:G.duration,ease:G.ease,timer:null,state:B7})}function E5(_,Q){var $=t1(_,Q);if($.state>B7)throw Error("too late; already scheduled");return $}function $0(_,Q){var $=t1(_,Q);if($.state>I4)throw Error("too late; already running");return $}function t1(_,Q){var $=_.__transition;if(!$||!($=$[Q]))throw Error("transition not found");return $}function uJ(_,Q,$){var q=_.__transition,U;q[Q]=$,$.timer=O4(G,0,$.time);function G(Y){if($.state=z7,$.timer.restart(Z,$.delay,$.time),$.delay<=Y)Z(Y-$.delay)}function Z(Y){var K,H,L,z;if($.state!==z7)return X();for(K in q){if(z=q[K],z.name!==$.name)continue;if(z.state===I4)return D5(Z);if(z.state===W7)z.state=b5,z.timer.stop(),z.on.call("interrupt",_,_.__data__,z.index,z.group),delete q[K];else if(+K<Q)z.state=b5,z.timer.stop(),z.on.call("cancel",_,_.__data__,z.index,z.group),delete q[K]}if(D5(function(){if($.state===I4)$.state=W7,$.timer.restart(F,$.delay,$.time),F(Y)}),$.state=P4,$.on.call("start",_,_.__data__,$.index,$.group),$.state!==P4)return;$.state=I4,U=Array(L=$.tween.length);for(K=0,H=-1;K<L;++K)if(z=$.tween[K].value.call(_,_.__data__,$.index,$.group))U[++H]=z;U.length=H+1}function F(Y){var K=Y<$.duration?$.ease.call(null,Y/$.duration):($.timer.restart(X),$.state=N4,1),H=-1,L=U.length;while(++H<L)U[H].call(_,K);if($.state===N4)$.on.call("end",_,_.__data__,$.index,$.group),X()}function X(){$.state=b5,$.timer.stop(),delete q[Q];for(var Y in q)return;delete _.__transition}}function K2(_,Q){var $=_.__transition,q,U,G=!0,Z;if(!$)return;Q=Q==null?null:Q+"";for(Z in $){if((q=$[Z]).name!==Q){G=!1;continue}U=q.state>P4&&q.state<N4,q.state=b5,q.timer.stop(),q.on.call(U?"interrupt":"cancel",_,_.__data__,q.index,q.group),delete $[Z]}if(G)delete _.__transition}function X6(_){return this.each(function(){K2(this,_)})}function hJ(_,Q){var $,q;return function(){var U=$0(this,_),G=U.tween;if(G!==$){q=$=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 DJ(_,Q,$){var q,U;if(typeof $!=="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:$},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 K6(_,Q){var $=this._id;if(_+="",arguments.length<2){var q=t1(this.node(),$).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?hJ:DJ)($,_,Q))}function e2(_,Q,$){var q=_._id;return _.each(function(){var U=$0(this,q);(U.value||(U.value={}))[Q]=$.apply(this,arguments)}),function(U){return t1(U,q).value[Q]}}function x5(_,Q){var $;return(typeof Q==="number"?Z0:Q instanceof v0?C2:($=v0(Q))?(Q=$,C2):o2)(_,Q)}function bJ(_){return function(){this.removeAttribute(_)}}function EJ(_){return function(){this.removeAttributeNS(_.space,_.local)}}function xJ(_,Q,$){var q,U=$+"",G;return function(){var Z=this.getAttribute(_);return Z===U?null:Z===q?G:G=Q(q=Z,$)}}function mJ(_,Q,$){var q,U=$+"",G;return function(){var Z=this.getAttributeNS(_.space,_.local);return Z===U?null:Z===q?G:G=Q(q=Z,$)}}function gJ(_,Q,$){var q,U,G;return function(){var Z,F=$(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 pJ(_,Q,$){var q,U,G;return function(){var Z,F=$(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 Y6(_,Q){var $=h0(_),q=$==="transform"?F6:x5;return this.attrTween(_,typeof Q==="function"?($.local?pJ:gJ)($,q,e2(this,"attr."+_,Q)):Q==null?($.local?EJ:bJ)($):($.local?mJ:xJ)($,q,Q))}function cJ(_,Q){return function($){this.setAttribute(_,Q.call(this,$))}}function lJ(_,Q){return function($){this.setAttributeNS(_.space,_.local,Q.call(this,$))}}function rJ(_,Q){var $,q;function U(){var G=Q.apply(this,arguments);if(G!==q)$=(q=G)&&lJ(_,G);return $}return U._value=Q,U}function iJ(_,Q){var $,q;function U(){var G=Q.apply(this,arguments);if(G!==q)$=(q=G)&&cJ(_,G);return $}return U._value=Q,U}function L6(_,Q){var $="attr."+_;if(arguments.length<2)return($=this.tween($))&&$._value;if(Q==null)return this.tween($,null);if(typeof Q!=="function")throw Error();var q=h0(_);return this.tween($,(q.local?rJ:iJ)(q,Q))}function dJ(_,Q){return function(){E5(this,_).delay=+Q.apply(this,arguments)}}function aJ(_,Q){return Q=+Q,function(){E5(this,_).delay=Q}}function z6(_){var Q=this._id;return arguments.length?this.each((typeof _==="function"?dJ:aJ)(Q,_)):t1(this.node(),Q).delay}function sJ(_,Q){return function(){$0(this,_).duration=+Q.apply(this,arguments)}}function tJ(_,Q){return Q=+Q,function(){$0(this,_).duration=Q}}function W6(_){var Q=this._id;return arguments.length?this.each((typeof _==="function"?sJ:tJ)(Q,_)):t1(this.node(),Q).duration}function oJ(_,Q){if(typeof Q!=="function")throw Error();return function(){$0(this,_).ease=Q}}function B6(_){var Q=this._id;return arguments.length?this.each(oJ(Q,_)):t1(this.node(),Q).ease}function nJ(_,Q){return function(){var $=Q.apply(this,arguments);if(typeof $!=="function")throw Error();$0(this,_).ease=$}}function A6(_){if(typeof _!=="function")throw Error();return this.each(nJ(this._id,_))}function M6(_){if(typeof _!=="function")_=i2(_);for(var Q=this._groups,$=Q.length,q=Array($),U=0;U<$;++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 K0(q,this._parents,this._name,this._id)}function T6(_){if(_._id!==this._id)throw Error();for(var Q=this._groups,$=_._groups,q=Q.length,U=$.length,G=Math.min(q,U),Z=Array(q),F=0;F<G;++F)for(var X=Q[F],Y=$[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 K0(Z,this._parents,this._name,this._id)}function eJ(_){return(_+"").trim().split(/^|\s+/).every(function(Q){var $=Q.indexOf(".");if($>=0)Q=Q.slice(0,$);return!Q||Q==="start"})}function _q(_,Q,$){var q,U,G=eJ(Q)?E5:$0;return function(){var Z=G(this,_),F=Z.on;if(F!==q)(U=(q=F).copy()).on(Q,$);Z.on=U}}function R6(_,Q){var $=this._id;return arguments.length<2?t1(this.node(),$).on.on(_):this.each(_q($,_,Q))}function Qq(_){return function(){var Q=this.parentNode;for(var $ in this.__transition)if(+$!==_)return;if(Q)Q.removeChild(this)}}function O6(){return this.on("end.remove",Qq(this._id))}function I6(_){var Q=this._name,$=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,t0(Y[L],Q,$,L,Y,t1(K,$))}return new K0(G,this._parents,Q,$)}function P6(_){var Q=this._name,$=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=t1(K,$),I=0,M=L.length;I<M;++I)if(z=L[I])t0(z,Q,$,I,L,W);G.push(L),Z.push(K)}return new K0(G,Z,Q,$)}var $q=a0.prototype.constructor;function N6(){return new $q(this._groups,this._parents)}function Jq(_,Q){var $,q,U;return function(){var G=X2(this,_),Z=(this.style.removeProperty(_),X2(this,_));return G===Z?null:G===$&&Z===q?U:U=Q($=G,q=Z)}}function A7(_){return function(){this.style.removeProperty(_)}}function qq(_,Q,$){var q,U=$+"",G;return function(){var Z=X2(this,_);return Z===U?null:Z===q?G:G=Q(q=Z,$)}}function Uq(_,Q,$){var q,U,G;return function(){var Z=X2(this,_),F=$(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 Gq(_,Q){var $,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=A7(Q)):void 0;if(Y!==$||U!==K)(q=($=Y).copy()).on(Z,U=K);X.on=q}}function w6(_,Q,$){var q=(_+="")==="transform"?Z6:x5;return Q==null?this.styleTween(_,Jq(_,q)).on("end.style."+_,A7(_)):typeof Q==="function"?this.styleTween(_,Uq(_,q,e2(this,"style."+_,Q))).each(Gq(this._id,_)):this.styleTween(_,qq(_,q,Q),$).on("end.style."+_,null)}function Zq(_,Q,$){return function(q){this.style.setProperty(_,Q.call(this,q),$)}}function Fq(_,Q,$){var q,U;function G(){var Z=Q.apply(this,arguments);if(Z!==U)q=(U=Z)&&Zq(_,Z,$);return q}return G._value=Q,G}function f6(_,Q,$){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,Fq(_,Q,$==null?"":$))}function Hq(_){return function(){this.textContent=_}}function Xq(_){return function(){var Q=_(this);this.textContent=Q==null?"":Q}}function C6(_){return this.tween("text",typeof _==="function"?Xq(e2(this,"text",_)):Hq(_==null?"":_+""))}function Kq(_){return function(Q){this.textContent=_.call(this,Q)}}function Yq(_){var Q,$;function q(){var U=_.apply(this,arguments);if(U!==$)Q=($=U)&&Kq(U);return Q}return q._value=_,q}function S6(_){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,Yq(_))}function v6(){var _=this._name,Q=this._id,$=w4();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=t1(X,Q);t0(X,_,$,Y,Z,{time:K.time+K.delay+K.duration,delay:0,duration:K.duration,ease:K.ease})}return new K0(q,this._parents,_,$)}function y6(){var _,Q,$=this,q=$._id,U=$.size();return new Promise(function(G,Z){var F={value:Z},X={value:function(){if(--U===0)G()}};if($.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 Lq=0;function K0(_,Q,$,q){this._groups=_,this._parents=Q,this._name=$,this._id=q}function M7(_){return a0().transition(_)}function w4(){return++Lq}var o0=a0.prototype;K0.prototype=M7.prototype={constructor:K0,select:I6,selectAll:P6,selectChild:o0.selectChild,selectChildren:o0.selectChildren,filter:M6,merge:T6,selection:N6,transition:v6,call:o0.call,nodes:o0.nodes,node:o0.node,size:o0.size,empty:o0.empty,each:o0.each,on:R6,attr:Y6,attrTween:L6,style:w6,styleTween:f6,text:C6,textTween:S6,remove:O6,tween:K6,delay:z6,duration:W6,ease:B6,easeVarying:A6,end:y6,[Symbol.iterator]:o0[Symbol.iterator]};function f4(_){return((_*=2)<=1?_*_*_:(_-=2)*_*_+2)/2}var zq={time:null,delay:0,duration:250,ease:f4};function Wq(_,Q){var $;while(!($=_.__transition)||!($=$[Q]))if(!(_=_.parentNode))throw Error(`transition ${Q} not found`);return $}function k6(_){var Q,$;if(_ instanceof K0)Q=_._id,_=_._name;else Q=w4(),($=zq).time=h5(),_=_==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])t0(X,_,Q,Y,Z,$||Wq(X,Q));return new K0(q,this._parents,_,Q)}a0.prototype.interrupt=X6;a0.prototype.transition=k6;var m5=(_)=>()=>_;function j6(_,{sourceEvent:Q,target:$,transform:q,dispatch:U}){Object.defineProperties(this,{type:{value:_,enumerable:!0,configurable:!0},sourceEvent:{value:Q,enumerable:!0,configurable:!0},target:{value:$,enumerable:!0,configurable:!0},transform:{value:q,enumerable:!0,configurable:!0},_:{value:U}})}function y0(_,Q,$){this.k=_,this.x=Q,this.y=$}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 y2=new y0(1,0,0);g5.prototype=y0.prototype;function g5(_){while(!_.__zoom)if(!(_=_.parentNode))return y2;return _.__zoom}function C4(_){_.stopImmediatePropagation()}function k2(_){_.preventDefault(),_.stopImmediatePropagation()}function Bq(_){return(!_.ctrlKey||_.type==="wheel")&&!_.button}function Aq(){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 T7(){return this.__zoom||y2}function Mq(_){return-_.deltaY*(_.deltaMode===1?0.05:_.deltaMode?1:0.002)*(_.ctrlKey?10:1)}function Tq(){return navigator.maxTouchPoints||"ontouchstart"in this}function Rq(_,Q,$){var q=_.invertX(Q[0][0])-$[0][0],U=_.invertX(Q[1][0])-$[1][0],G=_.invertY(Q[0][1])-$[0][1],Z=_.invertY(Q[1][1])-$[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 p5(){var _=Bq,Q=Aq,$=Rq,q=Mq,U=Tq,G=[0,1/0],Z=[[-1/0,-1/0],[1/0,1/0]],F=250,X=S2,Y=P2("start","zoom","end"),K,H,L,z=500,W=150,I=0,M=10;function B(v){v.property("__zoom",T7).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",w).on("dblclick.zoom",y).filter(U).on("touchstart.zoom",D).on("touchmove.zoom",c).on("touchend.zoom touchcancel.zoom",l).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}B.transform=function(v,x,b,j){var V=v.selection?v.selection():v;if(V.property("__zoom",T7),v!==V)O(v,x,b,j);else V.interrupt().each(function(){C(this,arguments).event(j).start().zoom(null,typeof x==="function"?x.apply(this,arguments):x).end()})},B.scaleBy=function(v,x,b,j){B.scaleTo(v,function(){var V=this.__zoom.k,m=typeof x==="function"?x.apply(this,arguments):x;return V*m},b,j)},B.scaleTo=function(v,x,b,j){B.transform(v,function(){var V=Q.apply(this,arguments),m=this.__zoom,P=b==null?T(V):typeof b==="function"?b.apply(this,arguments):b,u=m.invert(P),E=typeof x==="function"?x.apply(this,arguments):x;return $(A(N(m,E),P,u),V,Z)},b,j)},B.translateBy=function(v,x,b,j){B.transform(v,function(){return $(this.__zoom.translate(typeof x==="function"?x.apply(this,arguments):x,typeof b==="function"?b.apply(this,arguments):b),Q.apply(this,arguments),Z)},null,j)},B.translateTo=function(v,x,b,j,V){B.transform(v,function(){var m=Q.apply(this,arguments),P=this.__zoom,u=j==null?T(m):typeof j==="function"?j.apply(this,arguments):j;return $(y2.translate(u[0],u[1]).scale(P.k).translate(typeof x==="function"?-x.apply(this,arguments):-x,typeof b==="function"?-b.apply(this,arguments):-b),m,Z)},j,V)};function N(v,x){return x=Math.max(G[0],Math.min(G[1],x)),x===v.k?v:new y0(x,v.x,v.y)}function A(v,x,b){var j=x[0]-b[0]*v.k,V=x[1]-b[1]*v.k;return j===v.x&&V===v.y?v:new y0(v.k,j,V)}function T(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function O(v,x,b,j){v.on("start.zoom",function(){C(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(j).end()}).tween("zoom",function(){var V=this,m=arguments,P=C(V,m).event(j),u=Q.apply(V,m),E=b==null?T(u):typeof b==="function"?b.apply(V,m):b,h=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),o=V.__zoom,$1=typeof x==="function"?x.apply(V,m):x,i=X(o.invert(E).concat(h/o.k),$1.invert(E).concat(h/$1.k));return function(t){if(t===1)t=$1;else{var p=i(t),n=h/p[2];t=new y0(n,E[0]-p[0]*n,E[1]-p[1]*n)}P.zoom(null,t)}})}function C(v,x,b){return!b&&v.__zooming||new f(v,x)}function f(v,x){this.that=v,this.args=x,this.active=0,this.sourceEvent=null,this.extent=Q.apply(v,x),this.taps=0}f.prototype={event:function(v){if(v)this.sourceEvent=v;return this},start:function(){if(++this.active===1)this.that.__zooming=this,this.emit("start");return this},zoom:function(v,x){if(this.mouse&&v!=="mouse")this.mouse[1]=x.invert(this.mouse[0]);if(this.touch0&&v!=="touch")this.touch0[1]=x.invert(this.touch0[0]);if(this.touch1&&v!=="touch")this.touch1[1]=x.invert(this.touch1[0]);return this.that.__zoom=x,this.emit("zoom"),this},end:function(){if(--this.active===0)delete this.that.__zooming,this.emit("end");return this},emit:function(v){var x=s1(this.that).datum();Y.call(v,this.that,new j6(v,{sourceEvent:this.sourceEvent,target:B,type:v,transform:this.that.__zoom,dispatch:Y}),x)}};function S(v,...x){if(!_.apply(this,arguments))return;var b=C(this,x).event(v),j=this.__zoom,V=Math.max(G[0],Math.min(G[1],j.k*Math.pow(2,q.apply(this,arguments)))),m=G0(v);if(b.wheel){if(b.mouse[0][0]!==m[0]||b.mouse[0][1]!==m[1])b.mouse[1]=j.invert(b.mouse[0]=m);clearTimeout(b.wheel)}else if(j.k===V)return;else b.mouse=[m,j.invert(m)],K2(this),b.start();k2(v),b.wheel=setTimeout(P,W),b.zoom("mouse",$(A(N(j,V),b.mouse[0],b.mouse[1]),b.extent,Z));function P(){b.wheel=null,b.end()}}function w(v,...x){if(L||!_.apply(this,arguments))return;var b=v.currentTarget,j=C(this,x,!0).event(v),V=s1(v.view).on("mousemove.zoom",E,!0).on("mouseup.zoom",h,!0),m=G0(v,b),P=v.clientX,u=v.clientY;a2(v.view),C4(v),j.mouse=[m,this.__zoom.invert(m)],K2(this),j.start();function E(o){if(k2(o),!j.moved){var $1=o.clientX-P,i=o.clientY-u;j.moved=$1*$1+i*i>I}j.event(o).zoom("mouse",$(A(j.that.__zoom,j.mouse[0]=G0(o,b),j.mouse[1]),j.extent,Z))}function h(o){V.on("mousemove.zoom mouseup.zoom",null),O5(o.view,j.moved),k2(o),j.event(o).end()}}function y(v,...x){if(!_.apply(this,arguments))return;var b=this.__zoom,j=G0(v.changedTouches?v.changedTouches[0]:v,this),V=b.invert(j),m=b.k*(v.shiftKey?0.5:2),P=$(A(N(b,m),j,V),Q.apply(this,x),Z);if(k2(v),F>0)s1(this).transition().duration(F).call(O,P,j,v);else s1(this).call(B.transform,P,j,v)}function D(v,...x){if(!_.apply(this,arguments))return;var b=v.touches,j=b.length,V=C(this,x,v.changedTouches.length===j).event(v),m,P,u,E;C4(v);for(P=0;P<j;++P)if(u=b[P],E=G0(u,this),E=[E,this.__zoom.invert(E),u.identifier],!V.touch0)V.touch0=E,m=!0,V.taps=1+!!K;else if(!V.touch1&&V.touch0[2]!==E[2])V.touch1=E,V.taps=0;if(K)K=clearTimeout(K);if(m){if(V.taps<2)H=E[0],K=setTimeout(function(){K=null},z);K2(this),V.start()}}function c(v,...x){if(!this.__zooming)return;var b=C(this,x).event(v),j=v.changedTouches,V=j.length,m,P,u,E;k2(v);for(m=0;m<V;++m)if(P=j[m],u=G0(P,this),b.touch0&&b.touch0[2]===P.identifier)b.touch0[0]=u;else if(b.touch1&&b.touch1[2]===P.identifier)b.touch1[0]=u;if(P=b.that.__zoom,b.touch1){var h=b.touch0[0],o=b.touch0[1],$1=b.touch1[0],i=b.touch1[1],t=(t=$1[0]-h[0])*t+(t=$1[1]-h[1])*t,p=(p=i[0]-o[0])*p+(p=i[1]-o[1])*p;P=N(P,Math.sqrt(t/p)),u=[(h[0]+$1[0])/2,(h[1]+$1[1])/2],E=[(o[0]+i[0])/2,(o[1]+i[1])/2]}else if(b.touch0)u=b.touch0[0],E=b.touch0[1];else return;b.zoom("touch",$(A(P,u,E),b.extent,Z))}function l(v,...x){if(!this.__zooming)return;var b=C(this,x).event(v),j=v.changedTouches,V=j.length,m,P;if(C4(v),L)clearTimeout(L);L=setTimeout(function(){L=null},z);for(m=0;m<V;++m)if(P=j[m],b.touch0&&b.touch0[2]===P.identifier)delete b.touch0;else if(b.touch1&&b.touch1[2]===P.identifier)delete b.touch1;if(b.touch1&&!b.touch0)b.touch0=b.touch1,delete b.touch1;if(b.touch0)b.touch0[1]=this.__zoom.invert(b.touch0[0]);else if(b.end(),b.taps===2){if(P=G0(P,this),Math.hypot(H[0]-P[0],H[1]-P[1])<M){var u=s1(this).on("dblclick.zoom");if(u)u.apply(this,arguments)}}}return B.wheelDelta=function(v){return arguments.length?(q=typeof v==="function"?v:m5(+v),B):q},B.filter=function(v){return arguments.length?(_=typeof v==="function"?v:m5(!!v),B):_},B.touchable=function(v){return arguments.length?(U=typeof v==="function"?v:m5(!!v),B):U},B.extent=function(v){return arguments.length?(Q=typeof v==="function"?v:m5([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),B):Q},B.scaleExtent=function(v){return arguments.length?(G[0]=+v[0],G[1]=+v[1],B):[G[0],G[1]]},B.translateExtent=function(v){return arguments.length?(Z[0][0]=+v[0][0],Z[1][0]=+v[1][0],Z[0][1]=+v[0][1],Z[1][1]=+v[1][1],B):[[Z[0][0],Z[0][1]],[Z[1][0],Z[1][1]]]},B.constrain=function(v){return arguments.length?($=v,B):$},B.duration=function(v){return arguments.length?(F=+v,B):F},B.interpolate=function(v){return arguments.length?(X=v,B):X},B.on=function(){var v=Y.on.apply(Y,arguments);return v===Y?B:v},B.clickDistance=function(v){return arguments.length?(I=(v=+v)*v,B):Math.sqrt(I)},B.tapDistance=function(v){return arguments.length?(M=+v,B):M},B}var Y0={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:$,targetHandle:q})=>`Couldn't create edge for ${_} handle id: "${_==="source"?$: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.`},J5=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],b6=["Enter"," ","Escape"],E6={"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:$})=>`Moved selected node ${_}. New position, x: ${Q}, y: ${$}`,"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 n0;(function(_){_.Free="free",_.Vertical="vertical",_.Horizontal="horizontal"})(n0||(n0={}));var j2;(function(_){_.Partial="partial",_.Full="full"})(j2||(j2={}));var x6={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},E0;(function(_){_.Bezier="default",_.Straight="straight",_.Step="step",_.SmoothStep="smoothstep",_.SimpleBezier="simplebezier"})(E0||(E0={}));var Q5;(function(_){_.Arrow="arrow",_.ArrowClosed="arrowclosed"})(Q5||(Q5={}));var H1;(function(_){_.Left="left",_.Top="top",_.Right="right",_.Bottom="bottom"})(H1||(H1={}));var R7={[H1.Left]:H1.Right,[H1.Right]:H1.Left,[H1.Top]:H1.Bottom,[H1.Bottom]:H1.Top},m6=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("source"in _)&&("target"in _),u7=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("position"in _)&&!("source"in _)&&!("target"in _),g6=(_)=>!!_&&typeof _==="object"&&("id"in _)&&("internals"in _)&&!("source"in _)&&!("target"in _);var l5=(_,Q=[0,0])=>{let{width:$,height:q}=I0(_),U=_.origin??Q,G=$*U[0],Z=q*U[1];return{x:_.position.x-G,y:_.position.y-Z}},p6=(_,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 $=!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):!g6(G)?Q.nodeLookup.get(G.id):G;if(!F)return U;return $=!0,V4(U,y4(F,Q.nodeOrigin))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return $?u4(q):{x:0,y:0,width:0,height:0}},D2=(_,Q={})=>{let $={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))$=V4($,y4(U)),q=!0}),q?u4($):{x:0,y:0,width:0,height:0}},k4=(_,Q,[$,q,U]=[0,0,1],G=!1,Z=!1)=>{let F=(Q.x-$)/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,T=x7(F,X,Y,K,N,A,M,B),O=M*B,C=G&&T>0;if(!L.internals.handleBounds||C||T>=O||L.dragging)H.push(L)}return H},h7=(_,Q)=>{let $=new Set;return _.forEach((q)=>{$.add(q.id)}),Q.filter((q)=>$.has(q.source)||$.has(q.target))};function Oq(_,Q){let $=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)))$.set(U.id,U)}),$}async function D7({nodes:_,width:Q,height:$,panZoom:q,minZoom:U,maxZoom:G},Z){if(_.size===0)return!0;let F=Oq(_,Z),X=D2(F),Y=i5(X,Q,$,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 c6({nodeId:_,nextPosition:Q,nodeLookup:$,nodeOrigin:q=[0,0],nodeExtent:U,onError:G}){let Z=$.get(_),F=Z.parentId?$.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",Y0.error005());else{let{width:z,height:W}=I0(F);if(z&&W)H=[[X,Y],[X+z,Y+W]]}else if(F&&h2(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=h2(H)?V2(Q,H,Z.measured):Q;if(Z.measured.width===void 0||Z.measured.height===void 0)G?.("015",Y0.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 b7({nodesToRemove:_=[],edgesToRemove:Q=[],nodes:$,edges:q,onBeforeDelete:U}){let G=new Set(_.map((L)=>L.id)),Z=[];for(let L of $){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=h7(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,$=1)=>Math.min(Math.max(_,Q),$),V2=(_={x:0,y:0},Q,$)=>({x:$5(_.x,Q[0][0],Q[1][0]-($?.width??0)),y:$5(_.y,Q[0][1],Q[1][1]-($?.height??0))});function E7(_,Q,$){let{width:q,height:U}=I0($),{x:G,y:Z}=$.internals.positionAbsolute;return V2(_,[[G,Z],[G+q,Z+U]],Q)}var O7=(_,Q,$)=>{if(_<Q)return $5(Math.abs(_-Q),1,Q)/Q;else if(_>$)return-$5(Math.abs(_-$),1,Q)/Q;return 0},j4=(_,Q,$=15,q=40)=>{let U=O7(_.x,q,Q.width-q)*$,G=O7(_.y,q,Q.height-q)*$;return[U,G]},V4=(_,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)}),D6=({x:_,y:Q,width:$,height:q})=>({x:_,y:Q,x2:_+$,y2:Q+q}),u4=({x:_,y:Q,x2:$,y2:q})=>({x:_,y:Q,width:$-_,height:q-Q}),q5=(_,Q=[0,0])=>{let{x:$,y:q}=g6(_)?_.internals.positionAbsolute:l5(_,Q);return{x:$,y:q,width:_.measured?.width??_.width??_.initialWidth??0,height:_.measured?.height??_.height??_.initialHeight??0}},y4=(_,Q=[0,0])=>{let{x:$,y:q}=g6(_)?_.internals.positionAbsolute:l5(_,Q);return{x:$,y:q,x2:$+(_.measured?.width??_.width??_.initialWidth??0),y2:q+(_.measured?.height??_.height??_.initialHeight??0)}},l6=(_,Q)=>u4(V4(D6(_),D6(Q))),x7=(_,Q,$,q,U,G,Z,F)=>{let X=Math.max(0,Math.min(_+$,U+Z)-Math.max(_,U)),Y=Math.max(0,Math.min(Q+q,G+F)-Math.max(Q,G));return Math.ceil(X*Y)},r5=(_,Q)=>x7(_.x,_.y,_.width,_.height,Q.x,Q.y,Q.width,Q.height),r6=(_)=>R0(_.width)&&R0(_.height)&&R0(_.x)&&R0(_.y),R0=(_)=>!isNaN(_)&&isFinite(_),i6=(_,Q)=>($,q)=>{console.warn(`[${_}]: ${q} Help: ${Q}error#${$}`)},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},[$,q,U],G=!1,Z=[1,1])=>{let F={x:(_-$)/U,y:(Q-q)/U};return G?U5(F,Z):F},u2=({x:_,y:Q},[$,q,U])=>{return{x:_*U+$,y:Q*U+q}};function _5(_,Q){if(typeof _==="number")return Math.floor((Q-Q/(1+_))*0.5);if(typeof _==="string"&&_.endsWith("px")){let $=parseFloat(_);if(!Number.isNaN($))return Math.floor($)}if(typeof _==="string"&&_.endsWith("%")){let $=parseFloat(_);if(!Number.isNaN($))return Math.floor(Q*$*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 Iq(_,Q,$){if(typeof _==="string"||typeof _==="number"){let q=_5(_,$),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,$),U=_5(_.bottom??_.y??0,$),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 Pq(_,Q,$,q,U,G){let{x:Z,y:F}=u2(_,[Q,$,q]),{x:X,y:Y}=u2({x:_.x+_.width,y:_.y+_.height},[Q,$,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 i5=(_,Q,$,q,U,G)=>{let Z=Iq(G,Q,$),F=(Q-Z.x)/_.width,X=($-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=$/2-L*K,I=Pq(_,z,W,K,Q,$),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 h2(_){return _!==void 0&&_!==null&&_!=="parent"}function I0(_){return{width:_.measured?.width??_.width??_.initialWidth??0,height:_.measured?.height??_.height??_.initialHeight??0}}function d6(_){return(_.measured?.width??_.width??_.initialWidth)!==void 0&&(_.measured?.height??_.height??_.initialHeight)!==void 0}function a6(_,Q={width:0,height:0},$,q,U){let G={..._},Z=q.get($);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 s6(_,Q){if(_.size!==Q.size)return!1;for(let $ of _)if(!Q.has($))return!1;return!0}function m7(){let _,Q;return{promise:new Promise((q,U)=>{_=q,Q=U}),resolve:_,reject:Q}}function g7(_){return{...E6,..._||{}}}function Nq(_){if(typeof document>"u")return!0;let Q=document.querySelector(`.${_}-flow__pane`);if(!Q||!Q.isConnected)return!0;let $=getComputedStyle(Q);if($.display==="none")return!0;if($.visibility==="hidden"||$.visibility==="collapse")return!0;if($.opacity==="0")return!0;if($.width==="0"&&$.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 I7=!1;function p7(_){if(I7)return;I7=!0;let Q=`${_.charAt(0).toUpperCase()+_.slice(1)} Flow`;setTimeout(()=>{if(!Nq(_))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 t6(_){return _===null?null:_?"valid":"invalid"}function c5(_,{snapGrid:Q=[0,0],snapToGrid:$=!1,transform:q,containerBounds:U}){let{x:G,y:Z}=O0(_),F=G5({x:G-(U?.left??0),y:Z-(U?.top??0)},q),{x:X,y:Y}=$?U5(F,Q):F;return{xSnapped:X,ySnapped:Y,...F}}var h4=(_)=>({width:_.offsetWidth,height:_.offsetHeight}),o6=(_)=>_?.getRootNode?.()||window?.document,wq=["INPUT","SELECT","TEXTAREA"];function n6(_){let Q=_.composedPath?.()?.[0]||_.target;if(Q?.nodeType!==1)return!1;return wq.includes(Q.nodeName)||Q.hasAttribute("contenteditable")||!!Q.closest(".nokey")}var e6=(_)=>("clientX"in _),O0=(_,Q)=>{let $=e6(_),q=$?_.clientX:_.touches?.[0].clientX,U=$?_.clientY:_.touches?.[0].clientY;return{x:q-(Q?.left??0),y:U-(Q?.top??0)}},P7=(_,Q,$,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-$.left)/q,y:(F.top-$.top)/q,...h4(Z)}})};function D4({sourceX:_,sourceY:Q,targetX:$,targetY:q,sourceControlX:U,sourceControlY:G,targetControlX:Z,targetControlY:F}){let X=_*0.125+U*0.375+Z*0.375+$*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 S4(_,Q){if(_>=0)return 0.5*_;return Q*25*Math.sqrt(-_)}function N7({pos:_,x1:Q,y1:$,x2:q,y2:U,c:G}){switch(_){case H1.Left:return[Q-S4(Q-q,G),$];case H1.Right:return[Q+S4(q-Q,G),$];case H1.Top:return[Q,$-S4($-U,G)];case H1.Bottom:return[Q,$+S4(U-$,G)]}}function b4({sourceX:_,sourceY:Q,sourcePosition:$=H1.Bottom,targetX:q,targetY:U,targetPosition:G=H1.Top,curvature:Z=0.25}){let[F,X]=N7({pos:$,x1:_,y1:Q,x2:q,y2:U,c:Z}),[Y,K]=N7({pos:G,x1:q,y1:U,x2:_,y2:Q,c:Z}),[H,L,z,W]=D4({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 _8({sourceX:_,sourceY:Q,targetX:$,targetY:q}){let U=Math.abs($-_)/2,G=$<_?$+U:$-U,Z=Math.abs(q-Q)/2,F=q<Q?q+Z:q-Z;return[G,F,U,Z]}function c7({sourceNode:_,targetNode:Q,selected:$=!1,zIndex:q=0,elevateOnSelect:U=!1,zIndexMode:G="basic"}){if(G==="manual")return q;let Z=U&&$?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 l7({sourceNode:_,targetNode:Q,width:$,height:q,transform:U}){let G=V4(y4(_),y4(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:$/U[2],height:q/U[2]};return r5(Z,u4(G))>0}var fq=({source:_,sourceHandle:Q,target:$,targetHandle:q})=>`xy-edge__${_}${Q||""}-${$}${q||""}`,Cq=(_,Q)=>{return Q.some(($)=>$.source===_.source&&$.target===_.target&&($.sourceHandle===_.sourceHandle||!$.sourceHandle&&!_.sourceHandle)&&($.targetHandle===_.targetHandle||!$.targetHandle&&!_.targetHandle))},r7=(_,Q,$={})=>{if(!_.source||!_.target)return $.onError?.("006",Y0.error006()),Q;let q=$.getEdgeId||fq,U;if(m6(_))U={..._};else U={..._,id:q(_)};if(Cq(U,Q))return Q;if(U.sourceHandle===null)delete U.sourceHandle;if(U.targetHandle===null)delete U.targetHandle;return Q.concat(U)};function E4({sourceX:_,sourceY:Q,targetX:$,targetY:q}){let[U,G,Z,F]=_8({sourceX:_,sourceY:Q,targetX:$,targetY:q});return[`M ${_},${Q}L ${$},${q}`,U,G,Z,F]}var w7={[H1.Left]:{x:-1,y:0},[H1.Right]:{x:1,y:0},[H1.Top]:{x:0,y:-1},[H1.Bottom]:{x:0,y:1}},Sq=({source:_,sourcePosition:Q=H1.Bottom,target:$})=>{if(Q===H1.Left||Q===H1.Right)return _.x<$.x?{x:1,y:0}:{x:-1,y:0};return _.y<$.y?{x:0,y:1}:{x:0,y:-1}},f7=(_,Q)=>Math.sqrt(Math.pow(Q.x-_.x,2)+Math.pow(Q.y-_.y,2));function vq({source:_,sourcePosition:Q=H1.Bottom,target:$,targetPosition:q=H1.Top,center:U,offset:G,stepPosition:Z}){let F=w7[Q],X=w7[q],Y={x:_.x+F.x*G,y:_.y+F.y*G},K={x:$.x+X.x*G,y:$.y+X.y*G},H=Sq({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,T]=_8({sourceX:_.x,sourceY:_.y,targetX:$.x,targetY:$.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 v=Math.abs(_[L]-$[L]);if(v<=G){let x=Math.min(G-1,G-v);if(F[L]===z)B[L]=(Y[L]>_[L]?-1:1)*x;else N[L]=(K[L]>$[L]?-1:1)*x}}if(Q!==q){let v=L==="x"?"y":"x",x=F[L]===X[v],b=Y[v]>K[v],j=Y[v]<K[v];if(F[L]===1&&(!x&&b||x&&j)||F[L]!==1&&(!x&&j||x&&b))W=L==="x"?S:w}let y={x:Y.x+B.x,y:Y.y+B.y},D={x:K.x+N.x,y:K.y+N.y},c=Math.max(Math.abs(y.x-W[0].x),Math.abs(D.x-W[0].x)),l=Math.max(Math.abs(y.y-W[0].y),Math.abs(D.y-W[0].y));if(c>=l)I=(y.x+D.x)/2,M=W[0].y;else I=W[0].x,M=(y.y+D.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]:[],$],I,M,A,T]}function yq(_,Q,$,q){let U=Math.min(f7(_,Q)/2,f7(Q,$)/2,q),{x:G,y:Z}=Q;if(_.x===G&&G===$.x||_.y===Z&&Z===$.y)return`L${G} ${Z}`;if(_.y===Z){let Y=_.x<$.x?-1:1,K=_.y<$.y?1:-1;return`L ${G+U*Y},${Z}Q ${G},${Z} ${G},${Z+U*K}`}let F=_.x<$.x?1:-1,X=_.y<$.y?-1:1;return`L ${G},${Z+U*X}Q ${G},${Z} ${G+U*F},${Z}`}function d5({sourceX:_,sourceY:Q,sourcePosition:$=H1.Bottom,targetX:q,targetY:U,targetPosition:G=H1.Top,borderRadius:Z=5,centerX:F,centerY:X,offset:Y=20,stepPosition:K=0.5}){let[H,L,z,W,I]=vq({source:{x:_,y:Q},sourcePosition:$,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 C7(_){return _&&!!(_.internals.handleBounds||_.handles?.length)&&!!(_.measured.width||_.width||_.initialWidth)}function i7(_){let{sourceNode:Q,targetNode:$}=_;if(!C7(Q)||!C7($))return null;let q=Q.internals.handleBounds||S7(Q.handles),U=$.internals.handleBounds||S7($.handles),G=v7(q?.source??[],_.sourceHandle),Z=v7(_.connectionMode===W2.Strict?U?.target??[]:(U?.target??[]).concat(U?.source??[]),_.targetHandle);if(!G||!Z)return _.onError?.("008",Y0.error008(!G?"source":"target",{id:_.id,sourceHandle:_.sourceHandle,targetHandle:_.targetHandle})),null;let F=G?.position||H1.Bottom,X=Z?.position||H1.Top,Y=B2(Q,G,F),K=B2($,Z,X);return{sourceX:Y.x,sourceY:Y.y,targetX:K.x,targetY:K.y,sourcePosition:F,targetPosition:X}}function S7(_){if(!_)return null;let Q=[],$=[];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")$.push(q);return{source:Q,target:$}}function B2(_,Q,$=H1.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??$){case H1.Top:return{x:U+Z/2,y:G};case H1.Right:return{x:U+Z,y:G+F/2};case H1.Bottom:return{x:U+Z/2,y:G+F};case H1.Left:return{x:U,y:G+F/2}}}function v7(_,Q){if(!_)return null;return(!Q?_[0]:_.find(($)=>$.id===Q))||null}function x4(_,Q){if(!_)return"";if(typeof _==="string")return _;return`${Q?`${Q}__`:""}${Object.keys(_).sort().map((q)=>`${q}=${_[q]}`).join("&")}`}function d7(_,{id:Q,defaultColor:$,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=x4(X,Q);if(!G.has(Y))Z.push({id:Y,color:X.color||$,...X}),G.add(Y)}}),Z},[]).sort((Z,F)=>Z.id.localeCompare(F.id))}function a7(_,Q,$,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($){case H1.Right:Z=[(_.x+_.width)*Q.zoom+Q.x+q,(_.y+_.height*G)*Q.zoom+Q.y],F=[0,-100*G];break;case H1.Bottom:Z[1]=(_.y+_.height)*Q.zoom+Q.y+q,F[1]=0;break;case H1.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 s7=1000,kq=10,Q8={nodeOrigin:[0,0],nodeExtent:J5,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},jq={...Q8,checkEquality:!0};function $8(_,Q){let $={..._};for(let q in Q)if(Q[q]!==void 0)$[q]=Q[q];return $}function t7(_,Q,$){let q=$8(Q8,$);for(let U of _.values())if(U.parentId)q8(U,_,Q,q);else{let G=l5(U,q.nodeOrigin),Z=h2(U.extent)?U.extent:q.nodeExtent,F=V2(G,Z,I0(U));U.internals.positionAbsolute=F}}function Vq(_,Q){if(!_.handles)return!_.measured?void 0:Q?.internals.handleBounds;let $=[],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")$.push(G);else if(U.type==="target")q.push(G)}return{source:$,target:q}}function J8(_){return _==="manual"}function m4(_,Q,$,q={}){let U=$8(jq,q),G={i:0},Z=new Map(Q),F=U?.elevateNodesOnSelect&&!J8(U.zIndexMode)?s7:0,X=_.length>0,Y=!1;Q.clear(),$.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=l5(K,U.nodeOrigin),z=h2(K.extent)?K.extent:U.nodeExtent,W=V2(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:o7(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)q8(H,Q,$,q,G);Y||=K.selected??!1}return{nodesInitialized:X,hasSelectedNodes:Y}}function uq(_,Q){if(!_.parentId)return;let $=Q.get(_.parentId);if($)$.set(_.id,_);else Q.set(_.parentId,new Map([[_.id,_]]))}function q8(_,Q,$,q,U){let{elevateNodesOnSelect:G,nodeOrigin:Z,nodeExtent:F,zIndexMode:X}=$8(Q8,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(uq(_,$),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&&!J8(X)?s7:0,{x:L,y:z,z:W}=hq(_,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 o7(_,Q,$){let q=R0(_.zIndex)?_.zIndex:0;if(J8($))return q;return q+(_.selected?Q:0)}function hq(_,Q,$,q,U,G){let{x:Z,y:F}=Q.internals.positionAbsolute,X=I0(_),Y=l5(_,$),K=h2(_.extent)?V2(Y,_.extent,X):Y,H=V2({x:Z+K.x,y:F+K.y},q,X);if(_.extent==="parent")H=E7(H,X,Q);let L=o7(_,U,G),z=Q.internals.z??0;return{x:H.x,y:H.y,z:z>=L?z+1:L}}function g4(_,Q,$,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=l6(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)),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}}),$.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 n7(_,Q,$,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=h4(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=h2(W.extent)?W.extent:G,{positionAbsolute:T}=W.internals;if(W.parentId&&W.extent==="parent"){let C=Q.get(W.parentId);if(C)T=E7(T,I,C)}else if(A)T=V2(T,A,I);let O={...W,measured:I,internals:{...W.internals,positionAbsolute:T,handleBounds:{source:P7("source",z.nodeElement,N,H,W.id),target:P7("target",z.nodeElement,N,H,W.id)}}};if(Q.set(W.id,O),W.parentId)q8(O,Q,$,{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=g4(L,Q,$,U);Y.push(...z)}return{changes:Y,updatedInternals:X}}async function e7({delta:_,panZoom:Q,transform:$,translateExtent:q,width:U,height:G}){if(!Q||!_.x&&!_.y)return!1;let Z=await Q.setViewportConstrained({x:$[0]+_.x,y:$[1]+_.y,zoom:$[2]},[[0,0],[U,G]],q);return!!Z&&(Z.x!==$[0]||Z.y!==$[1]||Z.k!==$[2])}function y7(_,Q,$,q,U,G){let Z=U,F=q.get(Z)||new Map;q.set(Z,F.set($,Q)),Z=`${U}-${_}`;let X=q.get(Z)||new Map;if(q.set(Z,X.set($,Q)),G){Z=`${U}-${_}-${G}`;let Y=q.get(Z)||new Map;q.set(Z,Y.set($,Q))}}function U8(_,Q,$){_.clear(),Q.clear();for(let q of $){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}`;y7("source",X,K,_,U,Z),y7("target",X,Y,_,G,F),Q.set(q.id,q)}}function _9(_,Q){if(!_.parentId)return!1;let $=Q.get(_.parentId);if(!$)return!1;if($.selected)return!0;return _9($,Q)}function k7(_,Q,$){let q=_;do{if(q?.matches?.(Q))return!0;if(q===$)return!1;q=q?.parentElement}while(q);return!1}function Dq(_,Q,$,q){let U=new Map;for(let[G,Z]of _)if((Z.selected||Z.id===q)&&(!Z.parentId||!_9(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:$.x-F.internals.positionAbsolute.x,y:$.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 V6({nodeId:_,dragItems:Q,nodeLookup:$,dragging:q=!0}){let U=[];for(let[Z,F]of Q){let X=$.get(Z)?.internals.userNode;if(X)U.push({...X,position:F.position,dragging:q})}if(!_)return[U[0],U];let G=$.get(_)?.internals.userNode;return[!G?U[0]:{...G,position:Q.get(_)?.position||G.position,dragging:q},U]}function bq({dragItems:_,snapGrid:Q,x:$,y:q}){let U=_.values().next().value;if(!U)return null;let G={x:$-U.distance.x,y:q-U.distance.y},Z=U5(G,Q);return{x:Z.x-G.x,y:Z.y-G.y}}function Q9({onNodeMouseDown:_,getStoreItems:Q,onDragStart:$,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:T,isSelectable:O,nodeId:C,nodeClickDistance:f=0}){L=s1(T);function S({x:c,y:l}){let{nodeLookup:v,nodeExtent:x,snapGrid:b,snapToGrid:j,nodeOrigin:V,onNodeDrag:m,onSelectionDrag:P,onError:u,updateNodePositions:E}=Q();G={x:c,y:l};let h=!1,o=F.size>1,$1=o&&x?D6(D2(F)):null,i=o&&j?bq({dragItems:F,snapGrid:b,x:c,y:l}):null;for(let[t,p]of F){if(!v.has(t))continue;let n={x:c-p.distance.x,y:l-p.distance.y};if(j)n=i?{x:Math.round(n.x+i.x),y:Math.round(n.y+i.y)}:U5(n,b);let Q1=null;if(o&&x&&!p.extent&&$1){let{positionAbsolute:L1}=p.internals,K1=L1.x-$1.x+x[0][0],W1=L1.x+p.measured.width-$1.x2+x[1][0],e=L1.y-$1.y+x[0][1],R1=L1.y+p.measured.height-$1.y2+x[1][1];Q1=[[K1,e],[W1,R1]]}let{position:J1,positionAbsolute:Z1}=c6({nodeId:t,nextPosition:n,nodeLookup:v,nodeExtent:Q1?Q1:x,nodeOrigin:V,onError:u});h=h||p.position.x!==J1.x||p.position.y!==J1.y,p.position=J1,p.internals.positionAbsolute=Z1}if(W=W||h,!h)return;if(E(F,!0),I&&(q||m||!C&&P)){let[t,p]=V6({nodeId:C,dragItems:F,nodeLookup:v});if(q?.(I,F,t,p),m?.(I,t,p),!C)P?.(I,p)}}async function w(){if(!K)return;let{transform:c,panBy:l,autoPanSpeed:v,autoPanOnNodeDrag:x}=Q();if(!x){X=!1,cancelAnimationFrame(Z);return}let[b,j]=j4(Y,K,v);if(b!==0||j!==0){if(G.x=(G.x??0)-b/c[2],G.y=(G.y??0)-j/c[2],await l({x:b,y:j}))S(G)}Z=requestAnimationFrame(w)}function y(c){let{nodeLookup:l,multiSelectionActive:v,nodesDraggable:x,transform:b,snapGrid:j,snapToGrid:V,selectNodesOnDrag:m,onNodeDragStart:P,onSelectionDragStart:u,unselectNodesAndEdges:E}=Q();if(H=!0,(!m||!O)&&!v&&C){if(!l.get(C)?.selected)E()}if(O&&m&&C)_?.(C);let h=c5(c.sourceEvent,{transform:b,snapGrid:j,snapToGrid:V,containerBounds:K});if(G=h,F=Dq(l,x,h,C),F.size>0&&($||P||!C&&u)){let[o,$1]=V6({nodeId:C,dragItems:F,nodeLookup:l});if($?.(c.sourceEvent,F,o,$1),P?.(c.sourceEvent,o,$1),!C)u?.(c.sourceEvent,$1)}}let D=N5().clickDistance(f).on("start",(c)=>{let{domNode:l,nodeDragThreshold:v,transform:x,snapGrid:b,snapToGrid:j}=Q();if(K=l?.getBoundingClientRect()||null,z=!1,W=!1,I=c.sourceEvent,v===0)y(c);G=c5(c.sourceEvent,{transform:x,snapGrid:b,snapToGrid:j,containerBounds:K}),Y=O0(c.sourceEvent,K)}).on("drag",(c)=>{let{autoPanOnNodeDrag:l,transform:v,snapGrid:x,snapToGrid:b,nodeDragThreshold:j,nodeLookup:V}=Q(),m=c5(c.sourceEvent,{transform:v,snapGrid:x,snapToGrid:b,containerBounds:K});if(I=c.sourceEvent,c.sourceEvent.type==="touchmove"&&c.sourceEvent.touches.length>1||C&&!V.has(C))z=!0;if(z)return;if(!X&&l&&H)X=!0,w();if(!H){let P=O0(c.sourceEvent,K),u=P.x-Y.x,E=P.y-Y.y;if(Math.sqrt(u*u+E*E)>j)y(c)}if((G.x!==m.xSnapped||G.y!==m.ySnapped)&&F&&H)Y=O0(c.sourceEvent,K),S(m)}).on("end",(c)=>{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:l,updateNodePositions:v,onNodeDragStop:x,onSelectionDragStop:b}=Q();if(W)v(F,!1),W=!1;if(U||x||!C&&b){let[j,V]=V6({nodeId:C,dragItems:F,nodeLookup:l,dragging:!1});if(U?.(c.sourceEvent,F,j,V),x?.(c.sourceEvent,j,V),!C)b?.(c.sourceEvent,V)}}}).filter((c)=>{let l=c.target;return!c.button&&(!N||!k7(l,`.${N}`,T))&&(!A||k7(l,A,T))});L.call(D)}function B(){L?.on(".drag",null)}return{update:M,destroy:B}}function Eq(_,Q,$){let q=[],U={x:_.x-$,y:_.y-$,width:$*2,height:$*2};for(let G of Q.values())if(r5(U,q5(G))>0)q.push(G);return q}var xq=250;function mq(_,Q,$,q){let U=[],G=1/0,Z=Eq(_,$,Q+xq);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 $9(_,Q,$,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=($?F?.find((Y)=>Y.id===$):F?.[0])??null;return X&&G?{...X,...B2(Z,X,X.position,!0)}:X}function J9(_,Q){if(_)return _;else if(Q?.classList.contains("target"))return"target";else if(Q?.classList.contains("source"))return"source";return null}function gq(_,Q){let $=null;if(Q)$=!0;else if(_&&!Q)$=!1;return $}var q9=()=>!0;function pq(_,{connectionMode:Q,connectionRadius:$,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=q9,onReconnectEnd:N,updateConnection:A,getTransform:T,getFromHandle:O,autoPanSpeed:C,dragThreshold:f=1,handleDomNode:S}){let w=o6(_.target),y=0,D,{x:c,y:l}=O0(_),v=J9(G,S),x=F?.getBoundingClientRect(),b=!1;if(!x||!v)return;let j=$9(U,v,q,X,Q);if(!j)return;let V=O0(_,x),m=!1,P=null,u=!1,E=null;function h(){if(!K||!x)return;let[J1,Z1]=j4(V,x,C);L({x:J1,y:Z1}),y=requestAnimationFrame(h)}let o={...j,nodeId:U,type:v,position:j.position},$1=X.get(U),t={inProgress:!0,isValid:null,from:B2($1,o,H1.Left,!0),fromHandle:o,fromPosition:o.position,fromNode:$1,to:V,toHandle:null,toPosition:R7[o.position],toNode:null,pointer:V};function p(){b=!0,A(t),W?.(_,{nodeId:U,handleId:q,handleType:v})}if(f===0)p();function n(J1){if(!b){let{x:R1,y:X1}=O0(J1),y1=R1-c,e1=X1-l;if(!(y1*y1+e1*e1>f*f))return;p()}if(!O()||!o){Q1(J1);return}let Z1=T();if(V=O0(J1,x),D=mq(G5(V,Z1,!1,[1,1]),$,X,o),!m)h(),m=!0;let L1=U9(J1,{handle:D,connectionMode:Q,fromNodeId:U,fromHandleId:q,fromType:Z?"target":"source",isValidConnection:B,doc:w,lib:Y,flowId:H,nodeLookup:X});E=L1.handleDomNode,P=L1.connection,u=gq(!!D,L1.isValid);let K1=X.get(U),W1=K1?B2(K1,o,H1.Left,!0):t.from,e={...t,from:W1,isValid:u,to:L1.toHandle&&u?u2({x:L1.toHandle.x,y:L1.toHandle.y},Z1):V,toHandle:L1.toHandle,toPosition:u&&L1.toHandle?L1.toHandle.position:R7[o.position],toNode:L1.toHandle?X.get(L1.toHandle.nodeId):null,pointer:V};A(e),t=e}function Q1(J1){if("touches"in J1&&J1.touches.length>0)return;if(b){if((D||E)&&P&&u)I?.(P);let{inProgress:Z1,...L1}=t,K1={...L1,toPosition:t.toHandle?t.toPosition:null};if(M?.(J1,K1),G)N?.(J1,K1)}z(),cancelAnimationFrame(y),m=!1,u=!1,P=null,E=null,w.removeEventListener("mousemove",n),w.removeEventListener("mouseup",Q1),w.removeEventListener("touchmove",n),w.removeEventListener("touchend",Q1)}w.addEventListener("mousemove",n),w.addEventListener("mouseup",Q1),w.addEventListener("touchmove",n),w.addEventListener("touchend",Q1)}function U9(_,{handle:Q,connectionMode:$,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),M=I?.classList.contains(`${F}-flow__handle`)?I:L,B={handleDomNode:M,isValid:!1,connection:null,toHandle:null};if(M){let N=J9(void 0,M),A=M.getAttribute("data-nodeid"),T=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?T:U,target:H?q:A,targetHandle:H?U:T};B.connection=f;let w=O&&C&&($===W2.Strict?H&&N==="source"||!H&&N==="target":A!==q||T!==U);B.isValid=w&&Y(f),B.toHandle=$9(A,N,T,K,$,!0)}return B}var p4={onPointerDown:pq,isValid:U9};function G9({domNode:_,panZoom:Q,getTransform:$,getViewScale:q}){let U=s1(_);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 T=$(),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=T[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 T=$();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(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=p5().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:G0}}var c4=(_)=>({x:_.x,y:_.y,zoom:_.k}),u6=({x:_,y:Q,zoom:$})=>y2.translate(_,Q).scale($),z2=(_,Q)=>_.target.closest(`.${Q}`),Z9=(_,Q)=>Q===2&&Array.isArray(_)&&_.includes(2),cq=(_)=>((_*=2)<=1?_*_*_:(_-=2)*_*_+2)/2,h6=(_,Q=0,$=cq,q=()=>{})=>{let U=typeof Q==="number"&&Q>0;if(!U)q();return U?_.transition().duration(Q).ease($).on("end",q):_},F9=(_)=>{let Q=_.ctrlKey&&Z5()?10:1;return-_.deltaY*(_.deltaMode===1?0.05:_.deltaMode?1:0.002)*Q};function lq({zoomPanValues:_,noWheelClassName:Q,d3Selection:$,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=$.property("__zoom").k||1;if(K.ctrlKey&&Z){let M=G0(K),B=F9(K),N=H*Math.pow(2,B);q.scaleTo($,N,M,K);return}let L=K.deltaMode===1?20:1,z=U===n0.Vertical?0:K.deltaX*L,W=U===n0.Horizontal?0:K.deltaY*L;if(!Z5()&&K.shiftKey&&U!==n0.Vertical)z=K.deltaY*L,W=0;q.translateBy($,-(z/H)*G,-(W/H)*G,{internal:!0});let I=c4($.property("__zoom"));if(clearTimeout(_.panScrollTimeout),!_.isPanScrolling)_.isPanScrolling=!0,F?.(K,I);else X?.(K,I);_.panScrollTimeout=setTimeout(()=>{Y?.(K,I),_.isPanScrolling=!1},150)}}function rq({noWheelClassName:_,preventScrolling:Q,d3ZoomHandler:$}){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(),$.call(this,q,U)}}function iq({zoomPanValues:_,onDraggingChange:Q,onPanZoomStart:$}){return(q)=>{if(q.sourceEvent?.internal)return;let U=c4(q.transform);if(_.mouseButton=q.sourceEvent?.button||0,_.isZoomingOrPanning=!0,_.prevViewport=U,q.sourceEvent?.type==="mousedown")Q(!0);if($)$?.(q.sourceEvent,U)}}function dq({zoomPanValues:_,panOnDrag:Q,onPaneContextMenu:$,onTransformChange:q,onPanZoom:U}){return(G)=>{if(_.usedRightMouseButton=!!($&&Z9(Q,_.mouseButton??0)),!G.sourceEvent?.sync)q([G.transform.x,G.transform.y,G.transform.k]);if(U&&!G.sourceEvent?.internal)U?.(G.sourceEvent,c4(G.transform))}}function aq({zoomPanValues:_,panOnDrag:Q,panOnScroll:$,onDraggingChange:q,onPanZoomEnd:U,onPaneContextMenu:G}){return(Z)=>{if(Z.sourceEvent?.internal)return;if(_.isZoomingOrPanning=!1,G&&Z9(Q,_.mouseButton??0)&&!_.usedRightMouseButton&&Z.sourceEvent)G(Z.sourceEvent);if(_.usedRightMouseButton=!1,q(!1),U){let F=c4(Z.transform);_.prevViewport=F,clearTimeout(_.timerId),_.timerId=setTimeout(()=>{U?.(Z.sourceEvent,F)},$?150:0)}}}function sq({panActivationKeyPressed:_,zoomActivationKeyPressed:Q,zoomOnScroll:$,zoomOnPinch:q,panOnDrag:U,panOnScroll:G,zoomOnDoubleClick:Z,userSelectionActive:F,noWheelClassName:X,noPanClassName:Y,lib:K,connectionInProgress:H}){return(L)=>{let z=Q||$,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 H9({domNode:_,minZoom:Q,maxZoom:$,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((l)=>{let v=l[0];if(v)H=[[0,0],[v.contentRect.width,v.contentRect.height]]}):null)?.observe(_);let z=p5().extent(()=>H).scaleExtent([Q,$]).translateExtent(q),W=s1(_).call(z);T({x:U.x,y:U.y,zoom:$5(U.zoom,Q,$)},[[0,0],[K.width,K.height]],q);let I=W.on("wheel.zoom"),M=W.on("dblclick.zoom");z.wheelDelta(F9);async function B(l,v){if(W)return new Promise((x)=>{z?.interpolate(v?.interpolate==="linear"?b0:S2).transform(h6(W,v?.duration,v?.ease,()=>x(!0)),l)});return!1}function N({noWheelClassName:l,noPanClassName:v,onPaneContextMenu:x,userSelectionActive:b,panOnScroll:j,panOnDrag:V,panOnScrollMode:m,panOnScrollSpeed:P,preventScrolling:u,zoomOnPinch:E,zoomOnScroll:h,zoomOnDoubleClick:o,panActivationKeyPressed:$1=!1,zoomActivationKeyPressed:i,lib:t,onTransformChange:p,connectionInProgress:n,paneClickDistance:Q1,selectionOnDrag:J1}){if(b&&!Y.isZoomingOrPanning)A();let Z1=j&&!i&&!b;z.clickDistance(J1?1/0:!R0(Q1)||Q1<0?0:Q1);let L1=Z1?lq({zoomPanValues:Y,noWheelClassName:l,d3Selection:W,d3Zoom:z,panOnScrollMode:m,panOnScrollSpeed:P,zoomOnPinch:E,onPanZoomStart:Z,onPanZoom:G,onPanZoomEnd:F}):rq({noWheelClassName:l,preventScrolling:u,d3ZoomHandler:I});W.on("wheel.zoom",L1,{passive:!1});let K1=iq({zoomPanValues:Y,onDraggingChange:X,onPanZoomStart:Z});z.on("start",K1);let W1=dq({zoomPanValues:Y,panOnDrag:V,onPaneContextMenu:!!x,onPanZoom:G,onTransformChange:p});z.on("zoom",W1);let e=aq({zoomPanValues:Y,panOnDrag:V,panOnScroll:j,onPaneContextMenu:x,onPanZoomEnd:F,onDraggingChange:X});z.on("end",e);let R1=sq({panActivationKeyPressed:$1,zoomActivationKeyPressed:i,panOnDrag:V,zoomOnScroll:h,panOnScroll:j,zoomOnDoubleClick:o,zoomOnPinch:E,userSelectionActive:b,noPanClassName:v,noWheelClassName:l,lib:t,connectionInProgress:n});if(z.filter(R1),o)W.on("dblclick.zoom",M);else W.on("dblclick.zoom",null)}function A(){z.on("zoom",null)}async function T(l,v,x){let b=u6(l),j=z?.constrain()(b,v,x);if(j)await B(j);return j}async function O(l,v){let x=u6(l);return await B(x,v),x}function C(l){if(W){let v=u6(l),x=W.property("__zoom");if(x.k!==l.zoom||x.x!==l.x||x.y!==l.y)z?.transform(W,v,null,{sync:!0})}}function f(){let l=W?g5(W.node()):{x:0,y:0,k:1};return{x:l.x,y:l.y,zoom:l.k}}async function S(l,v){if(W)return new Promise((x)=>{z?.interpolate(v?.interpolate==="linear"?b0:S2).scaleTo(h6(W,v?.duration,v?.ease,()=>x(!0)),l)});return!1}async function w(l,v){if(W)return new Promise((x)=>{z?.interpolate(v?.interpolate==="linear"?b0:S2).scaleBy(h6(W,v?.duration,v?.ease,()=>x(!0)),l)});return!1}function y(l){z?.scaleExtent(l)}function D(l){z?.translateExtent(l)}function c(l){let v=!R0(l)||l<0?0:l;z?.clickDistance(v)}return{update:N,destroy:A,setViewport:O,setViewportConstrained:T,getViewport:f,scaleTo:S,scaleBy:w,setScaleExtent:y,setTranslateExtent:D,syncViewport:C,setClickDistance:c}}var e0;(function(_){_.Line="line",_.Handle="handle"})(e0||(e0={}));var X9=["top-left","top-right","bottom-left","bottom-right"],K9=["top","right","bottom","left"];function tq({width:_,prevWidth:Q,height:$,prevHeight:q,affectsX:U,affectsY:G}){let Z=_-Q,F=$-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 j7(_){let Q=_.includes("right")||_.includes("left"),$=_.includes("bottom")||_.includes("top"),q=_.includes("left"),U=_.includes("top");return{isHorizontal:Q,isVertical:$,affectsX:q,affectsY:U}}function Y2(_,Q){return Math.max(0,Q-_)}function L2(_,Q){return Math.max(0,_-Q)}function v4(_,Q,$){return Math.max(0,Q-_,_-$)}function V7(_,Q){return _?!Q:Q}function oq(_,Q,$,q,U,G,Z,F){let{affectsX:X,affectsY:Y}=Q,{isHorizontal:K,isVertical:H}=Q,L=K&&H,{xSnapped:z,ySnapped:W}=$,{minWidth:I,maxWidth:M,minHeight:B,maxHeight:N}=q,{x:A,y:T,width:O,height:C,aspectRatio:f}=_,S=Math.floor(K?z-_.pointerX:0),w=Math.floor(H?W-_.pointerY:0),y=O+(X?-S:S),D=C+(Y?-w:w),c=-G[0]*O,l=-G[1]*C,v=v4(y,I,M),x=v4(D,B,N);if(Z){let V=0,m=0;if(X&&S<0)V=Y2(A+S+c,Z[0][0]);else if(!X&&S>0)V=L2(A+y+c,Z[1][0]);if(Y&&w<0)m=Y2(T+w+l,Z[0][1]);else if(!Y&&w>0)m=L2(T+D+l,Z[1][1]);v=Math.max(v,V),x=Math.max(x,m)}if(F){let V=0,m=0;if(X&&S>0)V=L2(A+S,F[0][0]);else if(!X&&S<0)V=Y2(A+y,F[1][0]);if(Y&&w>0)m=L2(T+w,F[0][1]);else if(!Y&&w<0)m=Y2(T+D,F[1][1]);v=Math.max(v,V),x=Math.max(x,m)}if(U){if(K){let V=v4(y/f,B,N)*f;if(v=Math.max(v,V),Z){let m=0;if(!X&&!Y||X&&!Y&&L)m=L2(T+l+y/f,Z[1][1])*f;else m=Y2(T+l+(X?S:-S)/f,Z[0][1])*f;v=Math.max(v,m)}if(F){let m=0;if(!X&&!Y||X&&!Y&&L)m=Y2(T+y/f,F[1][1])*f;else m=L2(T+(X?S:-S)/f,F[0][1])*f;v=Math.max(v,m)}}if(H){let V=v4(D*f,I,M)/f;if(x=Math.max(x,V),Z){let m=0;if(!X&&!Y||Y&&!X&&L)m=L2(A+D*f+c,Z[1][0])/f;else m=Y2(A+(Y?w:-w)*f+c,Z[0][0])/f;x=Math.max(x,m)}if(F){let m=0;if(!X&&!Y||Y&&!X&&L)m=Y2(A+D*f,F[1][0])/f;else m=L2(A+(Y?w:-w)*f,F[0][0])/f;x=Math.max(x,m)}}}if(w=w+(w<0?x:-x),S=S+(S<0?v:-v),U)if(L)if(y>D*f)w=(V7(X,Y)?-S:S)/f;else S=(V7(X,Y)?-w:w)*f;else if(K)w=S/f,Y=X;else S=w*f,X=Y;let b=X?A+S:A,j=Y?T+w:T;return{width:O+(X?-S:S),height:C+(Y?-w:w),x:G[0]*S*(!X?1:-1)+b,y:G[1]*w*(!Y?1:-1)+j}}var Y9={width:0,height:0,x:0,y:0},nq={...Y9,pointerX:0,pointerY:0,aspectRatio:1};function eq(_,Q,$){let q=Q.position.x+_.position.x,U=Q.position.y+_.position.y,G=_.measured.width??0,Z=_.measured.height??0,F=$[0]*G,X=$[1]*Z;return[[q-F,U-X],[q+G-F,U+Z-X]]}function L9({domNode:_,nodeId:Q,getStoreItems:$,onChange:q,onEnd:U}){let G=s1(_),Z={controlDirection:j7("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={...Y9},N={...nq};Z={boundaries:K,resizeDirection:L,keepAspectRatio:H,controlDirection:j7(Y)};let A=void 0,T=null,O=[],C=void 0,f=void 0,S=void 0,w=N5().on("start",(y)=>{let{nodeLookup:D,transform:c,snapGrid:l,snapToGrid:v,nodeOrigin:x,paneDomNode:b}=$();if(A=D.get(Q),!A)return;T=b?.getBoundingClientRect()??null;let{xSnapped:j,ySnapped:V}=c5(y.sourceEvent,{transform:c,snapGrid:l,snapToGrid:v,containerBounds:T});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:j,pointerY:V,aspectRatio:B.width/B.height},C=void 0,f=h2(A.extent)?A.extent:void 0,A.parentId&&(A.extent==="parent"||A.expandParent))C=D.get(A.parentId);if(C&&A.extent==="parent")f=[[0,0],[C.measured.width,C.measured.height]];O=[],S=void 0;for(let[m,P]of D)if(P.parentId===Q){if(O.push({id:m,position:{...P.position},extent:P.extent}),P.extent==="parent"||P.expandParent){let u=eq(P,A,P.origin??x);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?.(y,{...B})}).on("drag",(y)=>{let{transform:D,snapGrid:c,snapToGrid:l,nodeOrigin:v}=$(),x=c5(y.sourceEvent,{transform:D,snapGrid:c,snapToGrid:l,containerBounds:T}),b=[];if(!A)return;let{x:j,y:V,width:m,height:P}=B,u={},E=A.origin??v,{width:h,height:o,x:$1,y:i}=oq(N,Z.controlDirection,x,Z.boundaries,Z.keepAspectRatio,E,f,S),t=h!==m,p=o!==P,n=$1!==j&&t,Q1=i!==V&&p;if(!n&&!Q1&&!t&&!p)return;let J1={prevValues:{...B},startX:N.x,startY:N.y,childNodes:O.map((W1)=>({...W1,position:{...W1.position}}))};if(n||Q1||E[0]===1||E[1]===1){if(u.x=n?$1:B.x,u.y=Q1?i:B.y,B.x=u.x,B.y=u.y,O.length>0){let W1=$1-j,e=i-V;for(let R1 of O)R1.position={x:R1.position.x-W1+E[0]*(h-m),y:R1.position.y-e+E[1]*(o-P)},b.push(R1)}}if(t||p)u.width=t&&(!Z.resizeDirection||Z.resizeDirection==="horizontal")?h:B.width,u.height=p&&(!Z.resizeDirection||Z.resizeDirection==="vertical")?o:B.height,B.width=u.width,B.height=u.height;if(C&&A.expandParent){let W1=E[0]*(u.width??0);if(u.x&&u.x<W1)B.x=W1,N.x=N.x-(u.x-W1);let e=E[1]*(u.height??0);if(u.y&&u.y<e)B.y=e,N.y=N.y-(u.y-e)}let Z1=tq({width:B.width,prevWidth:m,height:B.height,prevHeight:P,affectsX:Z.controlDirection.affectsX,affectsY:Z.controlDirection.affectsY}),L1={...B,direction:Z1};if(M?.(y,L1)===!1){B=J1.prevValues,N.x=J1.startX,N.y=J1.startY,O.forEach((W1,e)=>{W1.position=J1.childNodes[e].position});return}W?.(y,L1),q(u,b)}).on("end",(y)=>{I?.(y,{...B}),U?.({...B})});G.call(w)}function X(){G.on(".drag",null)}return{update:F,destroy:X}}var T9=Q0(u0(),1),R9=Q0(W9(),1);var B9=(_)=>{let Q,$=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),$.forEach((W)=>W(Q,z))}},U=()=>Q,X={setState:q,getState:U,getInitialState:()=>Y,subscribe:(K)=>{return $.add(K),()=>$.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.");$.clear()}},Y=Q=_(q,U,X);return X},A9=(_)=>_?B9(_):B9;var{useDebugValue:$U}=T9.default,{useSyncExternalStoreWithSelector:JU}=R9.default,qU=(_)=>_;function G8(_,Q=qU,$){let q=JU(_.subscribe,_.getState,_.getServerState||_.getInitialState,Q,$);return $U(q),q}var M9=(_,Q)=>{let $=A9(_),q=(U,G=Q)=>G8($,U,G);return Object.assign(q,$),q},O9=(_,Q)=>_?M9(_,Q):M9;function x1(_,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 $=Object.keys(_);if($.length!==Object.keys(Q).length)return!1;for(let q of $)if(!Object.prototype.hasOwnProperty.call(Q,q)||!Object.is(_[q],Q[q]))return!1;return!0}var n9=Q0(N9(),1),a4=s.createContext(null),ZU=a4.Provider,e9=Y0.error001("react");function S1(_,Q){let $=s.useContext(a4);if($===null)throw Error(e9);return G8($,_,Q)}function m1(){let _=s.useContext(a4);if(_===null)throw Error(e9);return s.useMemo(()=>({getState:_.getState,setState:_.setState,subscribe:_.subscribe}),[_])}var w9={display:"none"},FU={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},__="react-flow__node-desc",Q_="react-flow__edge-desc",HU="react-flow__aria-live",XU=(_)=>_.ariaLiveMessage,KU=(_)=>_.ariaLabelConfig;function YU({rfId:_}){let Q=S1(XU);return a.jsx("div",{id:`${HU}-${_}`,"aria-live":"assertive","aria-atomic":"true",style:FU,children:Q})}function LU({rfId:_,disableKeyboardA11y:Q}){let $=S1(KU);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${__}-${_}`,style:w9,children:Q?$["node.a11yDescription.default"]:$["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${Q_}-${_}`,style:w9,children:$["edge.a11yDescription.default"]}),!Q&&a.jsx(YU,{rfId:_})]})}var m0=s.forwardRef(({position:_="top-left",children:Q,className:$,style:q,...U},G)=>{let Z=`${_}`.split("-");return a.jsx("div",{className:c1(["react-flow__panel",$,...Z]),style:q,ref:G,...U,children:Q})});m0.displayName="Panel";var f9="https://reactflow.dev/attribution";function zU({proOptions:_,position:Q="bottom-right"}){if(s.useEffect(()=>{p7("react")},[]),_?.hideAttribution)return null;return a.jsx(m0,{position:Q,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${f9}`,children:a.jsx("a",{href:f9,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var WU=(_)=>{let Q=[],$=[];for(let[,q]of _.nodeLookup)if(q.selected)Q.push(q.internals.userNode);for(let[,q]of _.edgeLookup)if(q.selected)$.push(q);return{selectedNodes:Q,selectedEdges:$}},l4=(_)=>_.id;function BU(_,Q){return x1(_.selectedNodes.map(l4),Q.selectedNodes.map(l4))&&x1(_.selectedEdges.map(l4),Q.selectedEdges.map(l4))}function AU({onSelectionChange:_}){let Q=m1(),{selectedNodes:$,selectedEdges:q}=S1(WU,BU);return s.useEffect(()=>{let U={nodes:$,edges:q};_?.(U),Q.getState().onSelectionChangeHandlers.forEach((G)=>G(U))},[$,q,_]),null}var MU=(_)=>!!_.onSelectionChangeHandlers;function TU({onSelectionChange:_}){let Q=S1(MU);if(_||Q)return a.jsx(AU,{onSelectionChange:_});return null}var $_=[0,0],RU={x:0,y:0,zoom:1},OU=["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"],C9=[...OU,"rfId"],IU=(_)=>({setNodes:_.setNodes,setEdges:_.setEdges,setMinZoom:_.setMinZoom,setMaxZoom:_.setMaxZoom,setTranslateExtent:_.setTranslateExtent,setNodeExtent:_.setNodeExtent,reset:_.reset,setDefaultNodesAndEdges:_.setDefaultNodesAndEdges}),S9={translateExtent:J5,nodeOrigin:$_,minZoom:0.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function PU(_){let{setNodes:Q,setEdges:$,setMinZoom:q,setMaxZoom:U,setTranslateExtent:G,setNodeExtent:Z,reset:F,setDefaultNodesAndEdges:X}=S1(IU,x1),Y=m1();s.useEffect(()=>{return X(_.defaultNodes,_.defaultEdges),()=>{K.current=S9,F()}},[]);let K=s.useRef(S9);return s.useEffect(()=>{for(let H of C9){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")$(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:g7(L)});else if(H==="fitView")Y.setState({fitViewQueued:L});else if(H==="fitViewOptions")Y.setState({fitViewOptions:L});else Y.setState({[H]:L})}K.current=_},C9.map((H)=>_[H])),null}function v9(){if(typeof window>"u"||!window.matchMedia)return null;return window.matchMedia("(prefers-color-scheme: dark)")}function NU(_){let[Q,$]=s.useState(_==="system"?null:_);return s.useEffect(()=>{if(_!=="system"){$(_);return}let q=v9(),U=()=>$(q?.matches?"dark":"light");return U(),q?.addEventListener("change",U),()=>{q?.removeEventListener("change",U)}},[_]),Q!==null?Q:v9()?.matches?"dark":"light"}var y9=typeof document<"u"?document:null;function a5(_=null,Q={target:y9,actInsideInputWithModifier:!0}){let[$,q]=s.useState(!1),U=s.useRef(!1),G=s.useRef(new Set([])),[Z,F]=s.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 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};
|
|
33
|
+
`)),K=Y.reduce((H,L)=>H.concat(...L),[]);return[Y,K]}return[[],[]]},[_]);return s.useEffect(()=>{let X=Q?.target??y9,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)&&n6(z))return!1;let I=j9(z.code,F);if(G.current.add(z[I]),k9(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=j9(z.code,F);if(k9(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]),$}function k9(_,Q,$){return _.filter((q)=>$||q.length===Q.size).some((q)=>q.every((U)=>Q.has(U)))}function j9(_,Q){return Q.includes(_)?"code":"key"}var wU=()=>{let _=m1();return s.useMemo(()=>{return{zoomIn:async(Q)=>{let{panZoom:$}=_.getState();return $?$.scaleBy(1.2,Q):!1},zoomOut:async(Q)=>{let{panZoom:$}=_.getState();return $?$.scaleBy(0.8333333333333334,Q):!1},zoomTo:async(Q,$)=>{let{panZoom:q}=_.getState();return q?q.scaleTo(Q,$):!1},getZoom:()=>_.getState().transform[2],setViewport:async(Q,$)=>{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},$),!0},getViewport:()=>{let[Q,$,q]=_.getState().transform;return{x:Q,y:$,zoom:q}},setCenter:async(Q,$,q)=>{return _.getState().setCenter(Q,$,q)},fitBounds:async(Q,$)=>{let{width:q,height:U,minZoom:G,maxZoom:Z,panZoom:F}=_.getState(),X=i5(Q,q,U,G,Z,$?.padding??0.1);if(!F)return!1;return await F.setViewport(X,{duration:$?.duration,ease:$?.ease,interpolate:$?.interpolate}),!0},screenToFlowPosition:(Q,$={})=>{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=$.snapGrid??U,H=$.snapToGrid??G;return G5(Y,q,H,K)},flowToScreenPosition:(Q)=>{let{transform:$,domNode:q}=_.getState();if(!q)return Q;let{x:U,y:G}=q.getBoundingClientRect(),Z=u2(Q,$);return{x:Z.x+U,y:Z.y+G}}}},[])};function J_(_,Q){let $=[],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){$.push(G);continue}if(Z[0].type==="remove")continue;if(Z[0].type==="replace"){$.push({...Z[0].item});continue}let F={...G};for(let X of Z)fU(X,F);$.push(F)}if(U.length)U.forEach((G)=>{if(G.index!==void 0)$.splice(G.index,0,{...G.item});else $.push({...G.item})});return $}function fU(_,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 J_(_,Q)}function CU(_,Q){return J_(_,Q)}function b2(_,Q){return{id:_,type:"select",selected:Q}}function F5(_,Q=new Set,$=!1){let q=[];for(let[U,G]of _){let Z=Q.has(U);if(!(G.selected===void 0&&!Z)&&G.selected!==Z){if($)G.selected=Z;q.push(b2(G.id,Z))}}return q}function V9({items:_=[],lookup:Q}){let $=[],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)$.push({id:G.id,item:G,type:"replace"});if(F===void 0)$.push({item:G,type:"add",index:U})}for(let[U]of Q)if(q.get(U)===void 0)$.push({id:U,type:"remove"});return $}function u9(_){return{id:_.id,type:"remove"}}var SU=i6("React Flow","https://reactflow.dev/");function vU(_,Q,$={}){return r7(_,Q,{...$,onError:$.onError??SU})}var h9=(_)=>u7(_),yU=(_)=>m6(_);function U_(_){return s.forwardRef(_)}var G_=typeof window<"u"?s.useLayoutEffect:s.useEffect;function D9(_){let[Q,$]=s.useState(BigInt(0)),[q]=s.useState(()=>kU(()=>$((U)=>U+BigInt(1))));return G_(()=>{let U=q.get();if(U.length)_(U),q.reset()},[Q]),q}function kU(_){let Q=[];return{get:()=>Q,reset:()=>{Q=[]},push:($)=>{Q.push($),_()}}}var Z_=s.createContext(null);function jU({children:_}){let Q=m1(),$=s.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=V9({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=D9($),U=s.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(V9({items:z,lookup:L}))},[]),G=D9(U),Z=s.useMemo(()=>({nodeQueue:q,edgeQueue:G}),[]);return a.jsx(Z_.Provider,{value:Z,children:_})}function VU(){let _=s.useContext(Z_);if(!_)throw Error("useBatchContext must be used within a BatchProvider");return _}var uU=(_)=>!!_.panZoom;function s5(){let _=wU(),Q=m1(),$=VU(),q=S1(uU),U=s.useMemo(()=>{let G=(H)=>Q.getState().nodeLookup.get(H),Z=(H)=>{$.nodeQueue.push(H)},F=(H)=>{$.edgeQueue.push(H)},X=(H)=>{let{nodeLookup:L,nodeOrigin:z}=Q.getState(),W=h9(H)?H:L.get(H.id),I=W.parentId?a6(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&&h9(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];$.nodeQueue.push((z)=>[...z,...L])},addEdges:(H)=>{let L=Array.isArray(H)?H:[H];$.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:T}=Q.getState(),{nodes:O,edges:C}=await b7({nodesToRemove:H,edgesToRemove:L,nodes:z,edges:W,onBeforeDelete:T}),f=C.length>0,S=O.length>0;if(f){let w=C.map(u9);M?.(C),N(w)}if(S){let w=O.map(u9);I?.(O),B(w)}if(S||f)A?.({nodes:O,edges:C});return{deletedNodes:O,deletedEdges:C}},getIntersectingNodes:(H,L=!0,z)=>{let W=r6(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),T=r5(A,I);return L&&T>0||T>=A.width*A.height||T>=I.width*I.height})},isNodeIntersecting:(H,L,z=!0)=>{let I=r6(H)?H:X(H);if(!I)return!1;let M=r5(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 p6(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??m7();return Q.setState({fitViewQueued:!0,fitViewOptions:H,fitViewResolver:L}),$.nodeQueue.push((z)=>[...z]),L.promise}}},[]);return s.useMemo(()=>{return{...U,..._,viewportInitialized:q}},[q])}var b9=(_)=>_.selected,hU=typeof window<"u"?window:void 0;function DU({deleteKeyCode:_,multiSelectionKeyCode:Q}){let $=m1(),{deleteElements:q}=s5(),U=a5(_,{actInsideInputWithModifier:!1}),G=a5(Q,{target:hU});s.useEffect(()=>{if(U){let{edges:Z,nodes:F}=$.getState();q({nodes:F.filter(b9),edges:Z.filter(b9)}),$.setState({nodesSelectionActive:!1})}},[U]),s.useEffect(()=>{$.setState({multiSelectionActive:G})},[G])}function bU(_){let Q=m1();s.useEffect(()=>{let $=()=>{if(!_.current||!(_.current.checkVisibility?.()??!0))return!1;let q=h4(_.current);if(q.height===0||q.width===0)Q.getState().onError?.("004",Y0.error004());Q.setState({width:q.width||500,height:q.height||500})};if(_.current){$(),window.addEventListener("resize",$);let q=new ResizeObserver(()=>$());return q.observe(_.current),()=>{if(window.removeEventListener("resize",$),q&&_.current)q.unobserve(_.current)}}},[])}var s4={position:"absolute",width:"100%",height:"100%",top:0,left:0},EU=(_)=>({userSelectionActive:_.userSelectionActive,lib:_.lib,connectionInProgress:_.connection.inProgress});function xU({onPaneContextMenu:_,zoomOnScroll:Q=!0,zoomOnPinch:$=!0,panOnScroll:q=!1,panActivationKeyPressed:U,panOnScrollSpeed:G=0.5,panOnScrollMode:Z=n0.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:T,selectionOnDrag:O}){let C=m1(),f=s.useRef(null),{userSelectionActive:S,lib:w,connectionInProgress:y}=S1(EU,x1),D=a5(z),c=s.useRef();bU(f);let l=s.useCallback((v)=>{if(N?.({x:v[0],y:v[1],zoom:v[2]}),!A)C.setState({transform:v})},[N,A]);return s.useEffect(()=>{if(f.current){c.current=H9({domNode:f.current,minZoom:H,maxZoom:L,translateExtent:K,viewport:Y,onDraggingChange:(j)=>C.setState((V)=>V.paneDragging===j?V:{paneDragging:j}),onPanZoomStart:(j,V)=>{let{onViewportChangeStart:m,onMoveStart:P}=C.getState();P?.(j,V),m?.(V)},onPanZoom:(j,V)=>{let{onViewportChange:m,onMove:P}=C.getState();P?.(j,V),m?.(V)},onPanZoomEnd:(j,V)=>{let{onViewportChangeEnd:m,onMoveEnd:P}=C.getState();P?.(j,V),m?.(V)}});let{x:v,y:x,zoom:b}=c.current.getViewport();return C.setState({panZoom:c.current,transform:[v,x,b],domNode:f.current.closest(".react-flow")}),()=>{c.current?.destroy()}}},[]),s.useEffect(()=>{c.current?.update({onPaneContextMenu:_,zoomOnScroll:Q,zoomOnPinch:$,panOnScroll:q,panActivationKeyPressed:U,panOnScrollSpeed:G,panOnScrollMode:Z,zoomOnDoubleClick:F,panOnDrag:X,zoomActivationKeyPressed:D,preventScrolling:W,noPanClassName:B,userSelectionActive:S,noWheelClassName:M,lib:w,onTransformChange:l,connectionInProgress:y,selectionOnDrag:O,paneClickDistance:T})},[_,Q,$,q,U,G,Z,F,X,D,W,B,S,M,w,l,y,O,T]),a.jsx("div",{className:"react-flow__renderer",ref:f,style:s4,children:I})}var mU=(_)=>({userSelectionActive:_.userSelectionActive,userSelectionRect:_.userSelectionRect});function gU(){let{userSelectionActive:_,userSelectionRect:Q}=S1(mU,x1);if(!(_&&Q))return null;return a.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 F8=(_,Q)=>{return($)=>{if($.target!==Q.current)return;_?.($)}},pU=(_)=>({userSelectionActive:_.userSelectionActive,elementsSelectable:_.elementsSelectable,dragging:_.paneDragging,panBy:_.panBy,autoPanSpeed:_.autoPanSpeed});function cU({isSelecting:_,selectionKeyPressed:Q,selectionMode:$=j2.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=s.useRef(0),B=m1(),{userSelectionActive:N,elementsSelectable:A,dragging:T,panBy:O,autoPanSpeed:C}=S1(pU,x1),f=A&&(_||N),S=s.useRef(null),w=s.useRef(),y=s.useRef(new Set),D=s.useRef(new Set),c=s.useRef(!1),l=s.useRef(!1),v=s.useRef({x:0,y:0}),x=s.useRef(!1),b=(p)=>{if(l.current||c.current||B.getState().connection.inProgress){l.current=!1,c.current=!1;return}Y?.(p),B.getState().resetSelectedElements(),B.setState({nodesSelectionActive:!1})},j=(p)=>{if(Array.isArray(q)&&q?.includes(2)){p.preventDefault();return}K?.(p)},V=H?(p)=>H(p):void 0,m=(p)=>{if(l.current)p.stopPropagation(),l.current=!1},P=(p)=>{if(p.pointerType==="touch"&&q!==!1&&!Q)return;let{domNode:n,transform:Q1}=B.getState();if(w.current=n?.getBoundingClientRect(),!w.current)return;let J1=p.target===S.current;if(!J1&&!!p.target.closest(".nokey")||!_||!(Z&&J1||Q)||p.button!==0||!p.isPrimary)return;p.target?.setPointerCapture?.(p.pointerId),l.current=!1;let{x:K1,y:W1}=O0(p.nativeEvent,w.current),e=G5({x:K1,y:W1},Q1);if(B.setState({userSelectionRect:{width:0,height:0,startX:e.x,startY:e.y,x:K1,y:W1}}),!J1)p.stopPropagation(),p.preventDefault()};function u(p,n){let{userSelectionRect:Q1}=B.getState();if(!Q1)return;let{transform:J1,nodeLookup:Z1,edgeLookup:L1,connectionLookup:K1,triggerNodeChanges:W1,triggerEdgeChanges:e,defaultEdgeOptions:R1}=B.getState(),X1={x:Q1.startX,y:Q1.startY},{x:y1,y:e1}=u2(X1,J1),o1={startX:X1.x,startY:X1.y,x:p<y1?p:y1,y:n<e1?n:e1,width:Math.abs(p-y1),height:Math.abs(n-e1)},W0=y.current,J0=D.current;y.current=new Set(k4(Z1,o1,J1,$===j2.Partial,!0).map((_0)=>_0.id)),D.current=new Set;let w0=R1?.selectable??!0;for(let _0 of y.current){let X0=K1.get(_0);if(!X0)continue;for(let{edgeId:q0}of X0.values()){let U0=L1.get(q0);if(U0&&(U0.selectable??w0))D.current.add(q0)}}if(!s6(W0,y.current)){let _0=F5(Z1,y.current,!0);W1(_0)}if(!s6(J0,D.current)){let _0=F5(L1,D.current);e(_0)}B.setState({userSelectionRect:o1,userSelectionActive:!0,nodesSelectionActive:!1})}function E(){if(!U||!w.current)return;let[p,n]=j4(v.current,w.current,C);O({x:p,y:n}).then((Q1)=>{if(!l.current||!Q1){M.current=requestAnimationFrame(E);return}let{x:J1,y:Z1}=v.current;u(J1,Z1),M.current=requestAnimationFrame(E)})}let h=()=>{cancelAnimationFrame(M.current),M.current=0,x.current=!1};s.useEffect(()=>{return()=>h()},[]);let o=(p)=>{let{userSelectionRect:n,transform:Q1,resetSelectedElements:J1}=B.getState();if(!w.current||!n)return;let{x:Z1,y:L1}=O0(p.nativeEvent,w.current);v.current={x:Z1,y:L1};let K1=u2({x:n.startX,y:n.startY},Q1);if(!l.current){let W1=Q?0:G;if(Math.hypot(Z1-K1.x,L1-K1.y)<=W1)return;J1(),F?.(p)}if(l.current=!0,!x.current)E(),x.current=!0;u(Z1,L1)},$1=(p)=>{if(!f){if(p.target===S.current&&B.getState().connection.inProgress)c.current=!0;return}if(p.button!==0)return;if(p.target?.releasePointerCapture?.(p.pointerId),!N&&p.target===S.current&&B.getState().userSelectionRect)b?.(p);if(B.setState({userSelectionActive:!1,userSelectionRect:null}),l.current)X?.(p),B.setState({nodesSelectionActive:y.current.size>0});h()},i=(p)=>{p.target?.releasePointerCapture?.(p.pointerId),h()},t=q===!0||Array.isArray(q)&&q.includes(0);return a.jsxs("div",{className:c1(["react-flow__pane",{draggable:t,dragging:T,selection:_}]),onClick:f?void 0:F8(b,S),onContextMenu:F8(j,S),onWheel:F8(V,S),onPointerEnter:f?void 0:L,onPointerMove:f?o:z,onPointerUp:$1,onPointerCancel:f?i:void 0,onPointerDownCapture:f?P:void 0,onClickCapture:f?m:void 0,onPointerLeave:W,ref:S,style:s4,children:[I,a.jsx(gU,{})]})}function X8({id:_,store:Q,unselect:$=!1,nodeRef:q}){let{addSelectedNodes:U,unselectNodesAndEdges:G,multiSelectionActive:Z,nodeLookup:F,onError:X}=Q.getState(),Y=F.get(_);if(!Y){X?.("012",Y0.error012(_));return}if(Q.setState({nodesSelectionActive:!1}),!Y.selected)U([_]);else if($||Y.selected&&Z)G({nodes:[Y],edges:[]}),requestAnimationFrame(()=>q?.current?.blur())}function F_({nodeRef:_,disabled:Q=!1,noDragClassName:$,handleSelector:q,nodeId:U,isSelectable:G,nodeClickDistance:Z}){let F=m1(),[X,Y]=s.useState(!1),K=s.useRef();return s.useEffect(()=>{if(Q)return;return K.current=Q9({getStoreItems:()=>F.getState(),onNodeMouseDown:(H)=>{X8({id:H,store:F,nodeRef:_})},onDragStart:()=>{Y(!0)},onDragStop:()=>{Y(!1)}}),()=>{K.current?.destroy(),K.current=void 0}},[Q,F,_]),s.useEffect(()=>{if(Q||!_.current||!K.current)return;K.current.update({noDragClassName:$,handleSelector:q,domNode:_.current,isSelectable:G,nodeId:U,nodeClickDistance:Z})},[$,q,Q,G,_,U,Z]),X}var lU=(_)=>(Q)=>Q.selected&&(Q.draggable||_&&typeof Q.draggable>"u");function H_(){let _=m1();return s.useCallback(($)=>{let{nodeExtent:q,snapToGrid:U,snapGrid:G,nodesDraggable:Z,onError:F,updateNodePositions:X,nodeLookup:Y,nodeOrigin:K}=_.getState(),H=new Map,L=lU(Z),z=U?G[0]:5,W=U?G[1]:5,I=$.direction.x*z*$.factor,M=$.direction.y*W*$.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:T}=c6({nodeId:B.id,nextPosition:N,nodeLookup:Y,nodeExtent:q,nodeOrigin:K,onError:F});B.position=A,B.internals.positionAbsolute=T,H.set(B.id,B)}X(H)},[])}var K8=s.createContext(null),rU=K8.Provider;K8.Consumer;var Y8=()=>{return s.useContext(K8)},iU=(_)=>({connectOnClick:_.connectOnClick,noPanClassName:_.noPanClassName,rfId:_.rfId}),X_=s.createContext(null);function dU({children:_}){let Q=S1(iU,x1);return a.jsx(X_.Provider,{value:Q,children:_})}function aU(){let _=s.useContext(X_);if(!_)throw Error("useHandleConfig must be used within a HandleConfigProvider");return _}var sU={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},tU=(_,Q,$)=>(q)=>{let{connectionClickStartHandle:U,connectionMode:G,connection:Z}=q,{fromHandle:F,toHandle:X,isValid:Y}=Z;if(!F&&!U)return sU;let K=X?.nodeId===_&&X?.id===Q&&X?.type===$;return{connectingFrom:F?.nodeId===_&&F?.id===Q&&F?.type===$,connectingTo:K,clickConnecting:U?.nodeId===_&&U?.id===Q&&U?.type===$,isPossibleEndHandle:G===W2.Strict?F?.type!==$:_!==F?.nodeId||Q!==F?.id,connectionInProcess:!!F,clickConnectionInProcess:!!U,valid:K&&Y}};function oU({type:_="source",position:Q=H1.Top,isValidConnection:$,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=m1(),B=Y8(),{connectOnClick:N,noPanClassName:A,rfId:T}=aU(),{connectingFrom:O,connectingTo:C,clickConnecting:f,isPossibleEndHandle:S,connectionInProcess:w,clickConnectionInProcess:y,valid:D}=S1(tU(B,W,_),x1);if(!B)M.getState().onError?.("010",Y0.error010());let c=(x)=>{let{defaultEdgeOptions:b,onConnect:j,hasDefaultEdges:V}=M.getState(),m={...b,...x};if(V){let{edges:P,setEdges:u,onError:E}=M.getState();u(vU(m,P,{onError:E}))}j?.(m),F?.(m)},l=(x)=>{if(!B)return;let b=e6(x.nativeEvent);if(U&&(b&&x.button===0||!b)){let j=M.getState();p4.onPointerDown(x.nativeEvent,{handleDomNode:x.currentTarget,autoPanOnConnect:j.autoPanOnConnect,connectionMode:j.connectionMode,connectionRadius:j.connectionRadius,domNode:j.domNode,nodeLookup:j.nodeLookup,lib:j.lib,isTarget:I,handleId:W,nodeId:B,flowId:j.rfId,panBy:j.panBy,cancelConnection:j.cancelConnection,onConnectStart:j.onConnectStart,onConnectEnd:(...V)=>M.getState().onConnectEnd?.(...V),updateConnection:j.updateConnection,onConnect:c,isValidConnection:$||((...V)=>M.getState().isValidConnection?.(...V)??!0),getTransform:()=>M.getState().transform,getFromHandle:()=>M.getState().connection.fromHandle,autoPanSpeed:j.autoPanSpeed,dragThreshold:j.connectionDragThreshold})}if(b)K?.(x);else H?.(x)},v=(x)=>{let{onClickConnectStart:b,onClickConnectEnd:j,connectionClickStartHandle:V,connectionMode:m,isValidConnection:P,lib:u,rfId:E,nodeLookup:h,connection:o}=M.getState();if(!B||!V&&!U)return;if(!V){b?.(x.nativeEvent,{nodeId:B,handleId:W,handleType:_}),M.setState({connectionClickStartHandle:{nodeId:B,type:_,id:W}});return}let $1=o6(x.target),i=$||P,{connection:t,isValid:p}=p4.isValid(x.nativeEvent,{handle:{nodeId:B,id:W,type:_},connectionMode:m,fromNodeId:V.nodeId,fromHandleId:V.id||null,fromType:V.type,isValidConnection:i,flowId:E,doc:$1,lib:u,nodeLookup:h});if(p&&t)c(t);let n=structuredClone(o);delete n.inProgress,n.toPosition=n.toHandle?n.toHandle.position:null,j?.(x,n),M.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":W,"data-nodeid":B,"data-handlepos":Q,"data-id":`${T}-${B}-${W}-${_}`,className:c1(["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:D,connectionindicator:q&&(!w||S)&&(w||y?G:U)}]),onMouseDown:l,onTouchStart:l,onClick:N?v:void 0,ref:z,...L,children:X})}var i4=s.memo(U_(oU));function nU({data:_,isConnectable:Q,sourcePosition:$=H1.Bottom}){return a.jsxs(a.Fragment,{children:[_?.label,a.jsx(i4,{type:"source",position:$,isConnectable:Q})]})}function eU({data:_,isConnectable:Q,targetPosition:$=H1.Top,sourcePosition:q=H1.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(i4,{type:"target",position:$,isConnectable:Q}),_?.label,a.jsx(i4,{type:"source",position:q,isConnectable:Q})]})}function _G(){return null}function QG({data:_,isConnectable:Q,targetPosition:$=H1.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(i4,{type:"target",position:$,isConnectable:Q}),_?.label]})}var d4={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},E9={input:nU,default:eU,output:QG,group:_G};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 JG=(_)=>{let{width:Q,height:$,x:q,y:U}=D2(_.nodeLookup,{filter:(G)=>!!G.selected});return{width:R0(Q)?Q:null,height:R0($)?$:null,userSelectionActive:_.userSelectionActive,transformString:`translate(${_.transform[0]}px,${_.transform[1]}px) scale(${_.transform[2]}) translate(${q}px,${U}px)`}};function qG({onSelectionContextMenu:_,noPanClassName:Q,disableKeyboardA11y:$}){let q=m1(),{width:U,height:G,transformString:Z,userSelectionActive:F}=S1(JG,x1),X=H_(),Y=s.useRef(null);s.useEffect(()=>{if(!$)Y.current?.focus({preventScroll:!0})},[$]);let K=!F&&U!==null&&G!==null;if(F_({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(d4,z.key))z.preventDefault(),X({direction:d4[z.key],factor:z.shiftKey?4:1})};return a.jsx("div",{className:c1(["react-flow__nodesselection","react-flow__container",Q]),style:{transform:Z},children:a.jsx("div",{ref:Y,className:"react-flow__nodesselection-rect",onContextMenu:H,tabIndex:$?void 0:-1,onKeyDown:$?void 0:L,style:{width:U,height:G}})})}var x9=typeof window<"u"?window:void 0,UG=(_)=>{return{nodesSelectionActive:_.nodesSelectionActive,userSelectionActive:_.userSelectionActive}};function K_({children:_,onPaneClick:Q,onPaneMouseEnter:$,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:T,panOnScrollSpeed:O,panOnScrollMode:C,zoomOnDoubleClick:f,panOnDrag:S,autoPanOnSelection:w,defaultViewport:y,translateExtent:D,minZoom:c,maxZoom:l,preventScrolling:v,onSelectionContextMenu:x,noWheelClassName:b,noPanClassName:j,disableKeyboardA11y:V,onViewportChange:m,isControlledViewport:P}){let{nodesSelectionActive:u,userSelectionActive:E}=S1(UG,x1),h=a5(Y,{target:x9}),o=a5(I,{target:x9}),$1=o||S,i=o||T,t=K&&$1!==!0,p=h||E||t;return DU({deleteKeyCode:X,multiSelectionKeyCode:W}),a.jsx(xU,{onPaneContextMenu:G,elementsSelectable:B,zoomOnScroll:N,zoomOnPinch:A,panOnScroll:i,panActivationKeyPressed:o,panOnScrollSpeed:O,panOnScrollMode:C,zoomOnDoubleClick:f,panOnDrag:!h&&$1,defaultViewport:y,translateExtent:D,minZoom:c,maxZoom:l,zoomActivationKeyCode:M,preventScrolling:v,noWheelClassName:b,noPanClassName:j,onViewportChange:m,isControlledViewport:P,paneClickDistance:F,selectionOnDrag:t,children:a.jsxs(cU,{onSelectionStart:L,onSelectionEnd:z,onPaneClick:Q,onPaneMouseEnter:$,onPaneMouseMove:q,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:Z,panOnDrag:$1,autoPanOnSelection:w,isSelecting:!!p,selectionMode:H,selectionKeyPressed:h,paneClickDistance:F,selectionOnDrag:t,children:[_,u&&a.jsx(qG,{onSelectionContextMenu:x,noPanClassName:j,disableKeyboardA11y:V})]})})}K_.displayName="FlowRenderer";var GG=s.memo(K_),ZG=(_)=>(Q)=>{return _?k4(Q.nodeLookup,{x:0,y:0,width:Q.width,height:Q.height},Q.transform,!0).map(($)=>$.id):Array.from(Q.nodeLookup.keys())};function FG(_){return S1(s.useCallback(ZG(_),[_]),x1)}var HG=(_)=>_.updateNodeInternals;function XG(){let _=S1(HG),[Q]=s.useState(()=>{if(typeof ResizeObserver>"u")return null;return new ResizeObserver(($)=>{let q=new Map;$.forEach((U)=>{let G=U.target.getAttribute("data-id");q.set(G,{id:G,nodeElement:U.target,force:!0})}),_(q)})});return s.useEffect(()=>{return()=>{Q?.disconnect()}},[Q]),Q}function KG({node:_,nodeType:Q,hasDimensions:$,resizeObserver:q}){let U=m1(),G=s.useRef(null),Z=s.useRef(null),F=s.useRef(_.sourcePosition),X=s.useRef(_.targetPosition),Y=s.useRef(Q),K=$&&!!_.internals.handleBounds;return s.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]),s.useEffect(()=>{return()=>{if(Z.current)q?.unobserve(Z.current),Z.current=null}},[]),s.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 YG({id:_,onClick:Q,onMouseEnter:$,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:T,isParent:O}=S1((p)=>{let n=p.nodeLookup.get(_),Q1=p.parentLookup.has(_);return{node:n,internals:n.internals,isParent:Q1}},x1),C=A.type||"default",f=M?.[C]||E9[C];if(f===void 0)N?.("003",Y0.error003(C)),C="default",f=M?.default||E9.default;let S=!!(A.draggable||F&&typeof A.draggable>"u"),w=!!(A.selectable||X&&typeof A.selectable>"u"),y=!!(A.connectable||Y&&typeof A.connectable>"u"),D=!!(A.focusable||K&&typeof A.focusable>"u"),c=m1(),l=d6(A),v=KG({node:A,nodeType:C,hasDimensions:l,resizeObserver:H}),x=F_({nodeRef:v,disabled:A.hidden||!S,noDragClassName:L,handleSelector:A.dragHandle,nodeId:_,isSelectable:w,nodeClickDistance:B}),b=H_();if(A.hidden)return null;let j=I0(A),V=$G(A),m=w||S||Q||$||q||U,P=$?(p)=>$(p,{...T.userNode}):void 0,u=q?(p)=>q(p,{...T.userNode}):void 0,E=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,$1=(p)=>{let{selectNodesOnDrag:n,nodeDragThreshold:Q1}=c.getState();if(w&&(!n||!S||Q1>0))X8({id:_,store:c,nodeRef:v});if(Q)Q(p,{...T.userNode})},i=(p)=>{if(n6(p.nativeEvent)||W)return;if(b6.includes(p.key)&&w){let n=p.key==="Escape";X8({id:_,store:c,unselect:n,nodeRef:v})}else if(S&&A.selected&&Object.prototype.hasOwnProperty.call(d4,p.key)){p.preventDefault();let{ariaLabelConfig:n}=c.getState();c.setState({ariaLiveMessage:n["node.a11yDescription.ariaLiveMessage"]({direction:p.key.replace("Arrow","").toLowerCase(),x:~~T.positionAbsolute.x,y:~~T.positionAbsolute.y})}),b({direction:d4[p.key],factor:p.shiftKey?4:1})}},t=()=>{if(W||!v.current?.matches(":focus-visible"))return;let{transform:p,width:n,height:Q1,autoPanOnNodeFocus:J1,setCenter:Z1}=c.getState();if(!J1)return;if(!(k4(new Map([[_,A]]),{x:0,y:0,width:n,height:Q1},p,!0).length>0))Z1(A.position.x+j.width/2,A.position.y+j.height/2,{zoom:p[2]})};return a.jsx("div",{className:c1(["react-flow__node",`react-flow__node-${C}`,{[z]:S},A.className,{selected:A.selected,selectable:w,parent:O,draggable:S,dragging:x}]),ref:v,style:{zIndex:T.z,transform:`translate(${T.positionAbsolute.x}px,${T.positionAbsolute.y}px)`,pointerEvents:m?"all":"none",visibility:l?"visible":"hidden",...A.style,...V},"data-id":_,"data-testid":`rf__node-${_}`,onMouseEnter:P,onMouseMove:u,onMouseLeave:E,onContextMenu:h,onClick:$1,onDoubleClick:o,onKeyDown:D?i:void 0,tabIndex:D?0:void 0,onFocus:D?t:void 0,role:A.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":W?void 0:`${__}-${I}`,"aria-label":A.ariaLabel,...A.domAttributes,children:a.jsx(rU,{value:_,children:a.jsx(f,{id:_,data:A.data,type:C,positionAbsoluteX:T.positionAbsolute.x,positionAbsoluteY:T.positionAbsolute.y,selected:A.selected??!1,selectable:w,draggable:S,deletable:A.deletable??!0,isConnectable:y,sourcePosition:A.sourcePosition,targetPosition:A.targetPosition,dragging:x,dragHandle:A.dragHandle,zIndex:T.z,parentId:A.parentId,...j})})})}var LG=s.memo(YG),zG=(_)=>({nodesConnectable:_.nodesConnectable,nodesFocusable:_.nodesFocusable,elementsSelectable:_.elementsSelectable,onError:_.onError});function Y_(_){let{nodesConnectable:Q,nodesFocusable:$,elementsSelectable:q,onError:U}=S1(zG,x1),G=FG(_.onlyRenderVisibleElements),Z=XG();return a.jsx("div",{className:"react-flow__nodes",style:s4,children:G.map((F)=>{return a.jsx(LG,{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:$,elementsSelectable:q,nodeClickDistance:_.nodeClickDistance,onError:U},F)})})}Y_.displayName="NodeRenderer";var WG=s.memo(Y_);function BG(_){return S1(s.useCallback(($)=>{if(!_)return $.edges.map((U)=>U.id);let q=[];if($.width&&$.height)for(let U of $.edges){let G=$.nodeLookup.get(U.source),Z=$.nodeLookup.get(U.target);if(G&&Z&&l7({sourceNode:G,targetNode:Z,width:$.width,height:$.height,transform:$.transform}))q.push(U.id)}return q},[_]),x1)}var AG=({color:_="none",strokeWidth:Q=1})=>{let $={strokeWidth:Q,..._&&{stroke:_}};return a.jsx("polyline",{className:"arrow",style:$,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},MG=({color:_="none",strokeWidth:Q=1})=>{let $={strokeWidth:Q,..._&&{stroke:_,fill:_}};return a.jsx("polyline",{className:"arrowclosed",style:$,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},m9={[Q5.Arrow]:AG,[Q5.ArrowClosed]:MG};function TG(_){let Q=m1();return s.useMemo(()=>{if(!Object.prototype.hasOwnProperty.call(m9,_))return Q.getState().onError?.("009",Y0.error009(_)),null;return m9[_]},[_])}var RG=({id:_,type:Q,color:$,width:q=12.5,height:U=12.5,markerUnits:G="strokeWidth",strokeWidth:Z,orient:F="auto-start-reverse"})=>{let X=TG(Q);if(!X)return null;return a.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:a.jsx(X,{color:$,strokeWidth:Z})})},L_=({defaultColor:_,rfId:Q})=>{let $=S1((G)=>G.edges),q=S1((G)=>G.defaultEdgeOptions),U=s.useMemo(()=>{return d7($,{id:Q,defaultColor:_,defaultMarkerStart:q?.markerStart,defaultMarkerEnd:q?.markerEnd})},[$,q,Q,_]);if(!U.length)return null;return a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:U.map((G)=>a.jsx(RG,{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))})})};L_.displayName="MarkerDefinitions";var OG=s.memo(L_);function z_({x:_,y:Q,label:$,labelStyle:q,labelShowBg:U=!0,labelBgStyle:G,labelBgPadding:Z=[2,4],labelBgBorderRadius:F=2,children:X,className:Y,...K}){let[H,L]=s.useState({x:1,y:0,width:0,height:0}),z=c1(["react-flow__edge-textwrapper",Y]),W=s.useRef(null);if(s.useEffect(()=>{if(W.current){let I=W.current.getBBox();L({x:I.x,y:I.y,width:I.width,height:I.height})}},[$]),!$)return null;return a.jsxs("g",{transform:`translate(${_-H.width/2} ${Q-H.height/2})`,className:z,visibility:H.width?"visible":"hidden",...K,children:[U&&a.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}),a.jsx("text",{className:"react-flow__edge-text",y:H.height/2,dy:"0.3em",ref:W,style:q,children:$}),X]})}z_.displayName="EdgeText";var IG=s.memo(z_);function t4({path:_,labelX:Q,labelY:$,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:X,interactionWidth:Y=20,...K}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...K,d:_,fill:"none",className:c1(["react-flow__edge-path",K.className])}),Y?a.jsx("path",{d:_,fill:"none",strokeOpacity:0,strokeWidth:Y,className:"react-flow__edge-interaction"}):null,q&&R0(Q)&&R0($)?a.jsx(IG,{x:Q,y:$,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:X}):null]})}function g9({pos:_,x1:Q,y1:$,x2:q,y2:U}){if(_===H1.Left||_===H1.Right)return[0.5*(Q+q),$];return[Q,0.5*($+U)]}function W_({sourceX:_,sourceY:Q,sourcePosition:$=H1.Bottom,targetX:q,targetY:U,targetPosition:G=H1.Top}){let[Z,F]=g9({pos:$,x1:_,y1:Q,x2:q,y2:U}),[X,Y]=g9({pos:G,x1:q,y1:U,x2:_,y2:Q}),[K,H,L,z]=D4({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 B_(_){return s.memo(({id:Q,sourceX:$,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,T]=W_({sourceX:$,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F}),O=_.isInternal?void 0:Q;return a.jsx(t4,{id:O,path:N,labelX:A,labelY:T,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:I,markerStart:M,interactionWidth:B})})}var PG=B_({isInternal:!1}),A_=B_({isInternal:!0});PG.displayName="SimpleBezierEdge";A_.displayName="SimpleBezierEdgeInternal";function M_(_){return s.memo(({id:Q,sourceX:$,sourceY:q,targetX:U,targetY:G,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,sourcePosition:z=H1.Bottom,targetPosition:W=H1.Top,markerEnd:I,markerStart:M,pathOptions:B,interactionWidth:N})=>{let[A,T,O]=d5({sourceX:$,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 a.jsx(t4,{id:C,path:A,labelX:T,labelY:O,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:I,markerStart:M,interactionWidth:N})})}var T_=M_({isInternal:!1}),R_=M_({isInternal:!0});T_.displayName="SmoothStepEdge";R_.displayName="SmoothStepEdgeInternal";function O_(_){return s.memo(({id:Q,...$})=>{let q=_.isInternal?void 0:Q;return a.jsx(T_,{...$,id:q,pathOptions:s.useMemo(()=>({borderRadius:0,offset:$.pathOptions?.offset}),[$.pathOptions?.offset])})})}var NG=O_({isInternal:!1}),I_=O_({isInternal:!0});NG.displayName="StepEdge";I_.displayName="StepEdgeInternal";function P_(_){return s.memo(({id:Q,sourceX:$,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]=E4({sourceX:$,sourceY:q,targetX:U,targetY:G}),A=_.isInternal?void 0:Q;return a.jsx(t4,{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 wG=P_({isInternal:!1}),N_=P_({isInternal:!0});wG.displayName="StraightEdge";N_.displayName="StraightEdgeInternal";function w_(_){return s.memo(({id:Q,sourceX:$,sourceY:q,targetX:U,targetY:G,sourcePosition:Z=H1.Bottom,targetPosition:F=H1.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,T,O]=b4({sourceX:$,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F,curvature:B?.curvature}),C=_.isInternal?void 0:Q;return a.jsx(t4,{id:C,path:A,labelX:T,labelY:O,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:I,markerStart:M,interactionWidth:N})})}var fG=w_({isInternal:!1}),f_=w_({isInternal:!0});fG.displayName="BezierEdge";f_.displayName="BezierEdgeInternal";var p9={default:f_,straight:N_,step:I_,smoothstep:R_,simplebezier:A_},c9={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},CG=(_,Q,$)=>{if($===H1.Left)return _-Q;if($===H1.Right)return _+Q;return _},SG=(_,Q,$)=>{if($===H1.Top)return _-Q;if($===H1.Bottom)return _+Q;return _},l9="react-flow__edgeupdater";function r9({position:_,centerX:Q,centerY:$,radius:q=10,onMouseDown:U,onMouseEnter:G,onMouseOut:Z,type:F}){return a.jsx("circle",{onMouseDown:U,onMouseEnter:G,onMouseOut:Z,className:c1([l9,`${l9}-${F}`]),cx:CG(Q,q,_),cy:SG($,q,_),r:q,stroke:"transparent",fill:"transparent"})}function vG({isReconnectable:_,reconnectRadius:Q,edge:$,sourceX:q,sourceY:U,targetX:G,targetY:Z,sourcePosition:F,targetPosition:X,onReconnect:Y,onReconnectStart:K,onReconnectEnd:H,setReconnecting:L,setUpdateHover:z}){let W=m1(),I=(T,O)=>{if(T.button!==0)return;let{autoPanOnConnect:C,domNode:f,connectionMode:S,connectionRadius:w,lib:y,onConnectStart:D,cancelConnection:c,nodeLookup:l,rfId:v,panBy:x,updateConnection:b}=W.getState(),j=O.type==="target",V=(u,E)=>{L(!1),H?.(u,$,O.type,E)},m=(u)=>Y?.($,u),P=(u,E)=>{L(!0),K?.(T,$,O.type),D?.(u,E)};p4.onPointerDown(T.nativeEvent,{autoPanOnConnect:C,connectionMode:S,connectionRadius:w,domNode:f,handleId:O.id,nodeId:O.nodeId,nodeLookup:l,isTarget:j,edgeUpdaterType:O.type,lib:y,flowId:v,cancelConnection:c,panBy:x,isValidConnection:(...u)=>W.getState().isValidConnection?.(...u)??!0,onConnect:m,onConnectStart:P,onConnectEnd:(...u)=>W.getState().onConnectEnd?.(...u),onReconnectEnd:V,updateConnection:b,getTransform:()=>W.getState().transform,getFromHandle:()=>W.getState().connection.fromHandle,dragThreshold:W.getState().connectionDragThreshold,handleDomNode:T.currentTarget})},M=(T)=>I(T,{nodeId:$.target,id:$.targetHandle??null,type:"target"}),B=(T)=>I(T,{nodeId:$.source,id:$.sourceHandle??null,type:"source"}),N=()=>z(!0),A=()=>z(!1);return a.jsxs(a.Fragment,{children:[(_===!0||_==="source")&&a.jsx(r9,{position:F,centerX:q,centerY:U,radius:Q,onMouseDown:M,onMouseEnter:N,onMouseOut:A,type:"source"}),(_===!0||_==="target")&&a.jsx(r9,{position:X,centerX:G,centerY:Z,radius:Q,onMouseDown:B,onMouseEnter:N,onMouseOut:A,type:"target"})]})}function yG({id:_,edgesFocusable:Q,edgesReconnectable:$,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((Z1)=>Z1.edgeLookup.get(_)),T=S1((Z1)=>Z1.defaultEdgeOptions);A=T?{...T,...A}:A;let O=A.type||"default",C=I?.[O]||p9[O];if(C===void 0)B?.("011",Y0.error011(O)),O="default",C=I?.default||p9.default;let f=!!(A.focusable||Q&&typeof A.focusable>"u"),S=typeof H<"u"&&(A.reconnectable||$&&typeof A.reconnectable>"u"),w=!!(A.selectable||q&&typeof A.selectable>"u"),y=s.useRef(null),[D,c]=s.useState(!1),[l,v]=s.useState(!1),x=m1(),{zIndex:b=A.zIndex,sourceX:j,sourceY:V,targetX:m,targetY:P,sourcePosition:u,targetPosition:E}=S1(s.useCallback((Z1)=>{let L1=Z1.nodeLookup.get(A.source),K1=Z1.nodeLookup.get(A.target);if(!L1||!K1)return c9;let W1=i7({id:_,sourceNode:L1,targetNode:K1,sourceHandle:A.sourceHandle||null,targetHandle:A.targetHandle||null,connectionMode:Z1.connectionMode,onError:B}),e=c7({selected:A.selected,zIndex:A.zIndex,sourceNode:L1,targetNode:K1,elevateOnSelect:Z1.elevateEdgesOnSelect,zIndexMode:Z1.zIndexMode});return{...W1||c9,zIndex:e}},[A.source,A.target,A.sourceHandle,A.targetHandle,A.selected,A.zIndex,B]),x1),h=s.useMemo(()=>A.markerStart?`url('#${x4(A.markerStart,W)}')`:void 0,[A.markerStart,W]),o=s.useMemo(()=>A.markerEnd?`url('#${x4(A.markerEnd,W)}')`:void 0,[A.markerEnd,W]);if(A.hidden||j===null||V===null||m===null||P===null)return null;let $1=(Z1)=>{let{addSelectedEdges:L1,unselectNodesAndEdges:K1,multiSelectionActive:W1}=x.getState();if(w)if(x.setState({nodesSelectionActive:!1}),A.selected&&W1)K1({nodes:[],edges:[A]}),y.current?.blur();else L1([_]);if(U)U(Z1,A)},i=G?(Z1)=>{G(Z1,{...A})}:void 0,t=Z?(Z1)=>{Z(Z1,{...A})}:void 0,p=F?(Z1)=>{F(Z1,{...A})}:void 0,n=X?(Z1)=>{X(Z1,{...A})}:void 0,Q1=Y?(Z1)=>{Y(Z1,{...A})}:void 0,J1=(Z1)=>{if(!N&&b6.includes(Z1.key)&&w){let{unselectNodesAndEdges:L1,addSelectedEdges:K1}=x.getState();if(Z1.key==="Escape")y.current?.blur(),L1({edges:[A]});else K1([_])}};return a.jsx("svg",{style:{zIndex:b},children:a.jsxs("g",{className:c1(["react-flow__edge",`react-flow__edge-${O}`,A.className,M,{selected:A.selected,animated:A.animated,inactive:!w&&!U,updating:D,selectable:w}]),onClick:$1,onDoubleClick:i,onContextMenu:t,onMouseEnter:p,onMouseMove:n,onMouseLeave:Q1,onKeyDown:f?J1: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?`${Q_}-${W}`:void 0,ref:y,...A.domAttributes,children:[!l&&a.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:j,sourceY:V,targetX:m,targetY:P,sourcePosition:u,targetPosition:E,data:A.data,style:A.style,sourceHandleId:A.sourceHandle,targetHandleId:A.targetHandle,markerStart:h,markerEnd:o,pathOptions:"pathOptions"in A?A.pathOptions:void 0,interactionWidth:A.interactionWidth}),S&&a.jsx(vG,{edge:A,isReconnectable:S,reconnectRadius:K,onReconnect:H,onReconnectStart:L,onReconnectEnd:z,sourceX:j,sourceY:V,targetX:m,targetY:P,sourcePosition:u,targetPosition:E,setUpdateHover:c,setReconnecting:v})]})})}var kG=s.memo(yG),jG=(_)=>({edgesFocusable:_.edgesFocusable,edgesReconnectable:_.edgesReconnectable,elementsSelectable:_.elementsSelectable,connectionMode:_.connectionMode,onError:_.onError});function C_({defaultMarkerColor:_,onlyRenderVisibleElements:Q,rfId:$,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,x1),T=BG(Q);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(OG,{defaultColor:_,rfId:$}),T.map((O)=>{return a.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:$,onError:A,edgeTypes:q,disableKeyboardA11y:I},O)})]})}C_.displayName="EdgeRenderer";var VG=s.memo(C_),i9=(_)=>`translate(${_[0]}px,${_[1]}px) scale(${_[2]})`;function uG({children:_}){let Q=m1(),$=s.useRef(null),[q]=s.useState(()=>Q.getState().transform);return G_(()=>{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,$.current)$.current.style.transform=i9(Z)};return G(),Q.subscribe(G)},[Q]),a.jsx("div",{ref:$,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:i9(q)},children:_})}function hG(_){let Q=s5(),$=s.useRef(!1);s.useEffect(()=>{if(!$.current&&Q.viewportInitialized&&_)setTimeout(()=>_(Q),1),$.current=!0},[_,Q.viewportInitialized])}var DG=(_)=>_.panZoom?.syncViewport;function bG(_){let Q=S1(DG),$=m1();return s.useEffect(()=>{if(_)Q?.(_),$.setState({transform:[_.x,_.y,_.zoom]})},[_,Q]),null}function d9(_){return _.connection.inProgress?{..._.connection,to:G5(_.connection.to,_.transform)}:{..._.connection}}function EG(_){if(_)return($)=>{let q=d9($);return _(q)};return d9}function xG(_){let Q=EG(_);return S1(Q,x1)}var mG=(_)=>({nodesConnectable:_.nodesConnectable,isValid:_.connection.isValid,inProgress:_.connection.inProgress,width:_.width,height:_.height});function gG({containerStyle:_,style:Q,type:$,component:q}){let{nodesConnectable:U,width:G,height:Z,isValid:F,inProgress:X}=S1(mG,x1);if(!(G&&U&&X))return null;return a.jsx("svg",{style:_,width:G,height:Z,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:c1(["react-flow__connection",t6(F)]),children:a.jsx(S_,{style:Q,type:$,CustomComponent:q,isValid:F})})})}var S_=({style:_,type:Q=E0.Bezier,CustomComponent:$,isValid:q})=>{let{inProgress:U,from:G,fromNode:Z,fromHandle:F,fromPosition:X,to:Y,toNode:K,toHandle:H,toPosition:L,pointer:z}=xG();if(!U)return;if($)return a.jsx($,{connectionLineType:Q,connectionLineStyle:_,fromNode:Z,fromHandle:F,fromX:G.x,fromY:G.y,toX:Y.x,toY:Y.y,fromPosition:X,toPosition:L,connectionStatus:t6(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 E0.Bezier:[W]=b4(I);break;case E0.SimpleBezier:[W]=W_(I);break;case E0.Step:[W]=d5({...I,borderRadius:0});break;case E0.SmoothStep:[W]=d5(I);break;default:[W]=E4(I)}return a.jsx("path",{d:W,fill:"none",className:"react-flow__connection-path",style:_})};S_.displayName="ConnectionLine";var pG={};function a9(_=pG){let Q=s.useRef(_),$=m1();s.useEffect(()=>{{let q=new Set([...Object.keys(Q.current),...Object.keys(_)]);for(let U of q)if(Q.current[U]!==_[U]){$.getState().onError?.("002",Y0.error002());break}Q.current=_}},[_])}function cG(){let _=m1(),Q=s.useRef(!1);s.useEffect(()=>{if(!Q.current){let $=document.querySelector(".react-flow__pane");if($&&window.getComputedStyle($).zIndex!=="1")_.getState().onError?.("013",Y0.error013("react"));Q.current=!0}},[])}function v_({nodeTypes:_,edgeTypes:Q,onInit:$,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:T,multiSelectionKeyCode:O,panActivationKeyCode:C,zoomActivationKeyCode:f,deleteKeyCode:S,onlyRenderVisibleElements:w,elementsSelectable:y,defaultViewport:D,translateExtent:c,minZoom:l,maxZoom:v,preventScrolling:x,defaultMarkerColor:b,zoomOnScroll:j,zoomOnPinch:V,panOnScroll:m,panOnScrollSpeed:P,panOnScrollMode:u,zoomOnDoubleClick:E,panOnDrag:h,autoPanOnSelection:o,onPaneClick:$1,onPaneMouseEnter:i,onPaneMouseMove:t,onPaneMouseLeave:p,onPaneScroll:n,onPaneContextMenu:Q1,paneClickDistance:J1,nodeClickDistance:Z1,onEdgeContextMenu:L1,onEdgeMouseEnter:K1,onEdgeMouseMove:W1,onEdgeMouseLeave:e,reconnectRadius:R1,onReconnect:X1,onReconnectStart:y1,onReconnectEnd:e1,noDragClassName:o1,noWheelClassName:W0,noPanClassName:J0,disableKeyboardA11y:w0,nodeExtent:_0,rfId:X0,viewport:q0,onViewportChange:U0,nodesDraggable:l0}){return a9(_),a9(Q),cG(),hG($),bG(q0),a.jsx(GG,{onPaneClick:$1,onPaneMouseEnter:i,onPaneMouseMove:t,onPaneMouseLeave:p,onPaneContextMenu:Q1,onPaneScroll:n,paneClickDistance:J1,deleteKeyCode:S,selectionKeyCode:N,selectionOnDrag:A,selectionMode:T,onSelectionStart:L,onSelectionEnd:z,multiSelectionKeyCode:O,panActivationKeyCode:C,zoomActivationKeyCode:f,elementsSelectable:y,zoomOnScroll:j,zoomOnPinch:V,zoomOnDoubleClick:E,panOnScroll:m,panOnScrollSpeed:P,panOnScrollMode:u,panOnDrag:h,autoPanOnSelection:o,defaultViewport:D,translateExtent:c,minZoom:l,maxZoom:v,onSelectionContextMenu:H,preventScrolling:x,noDragClassName:o1,noWheelClassName:W0,noPanClassName:J0,disableKeyboardA11y:w0,onViewportChange:U0,isControlledViewport:!!q0,children:a.jsxs(uG,{children:[a.jsx(VG,{edgeTypes:Q,onEdgeClick:U,onEdgeDoubleClick:Z,onReconnect:X1,onReconnectStart:y1,onReconnectEnd:e1,onlyRenderVisibleElements:w,onEdgeContextMenu:L1,onEdgeMouseEnter:K1,onEdgeMouseMove:W1,onEdgeMouseLeave:e,reconnectRadius:R1,defaultMarkerColor:b,noPanClassName:J0,disableKeyboardA11y:w0,rfId:X0}),a.jsx(gG,{style:I,type:W,component:M,containerStyle:B}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(WG,{nodeTypes:_,onNodeClick:q,onNodeDoubleClick:G,onNodeMouseEnter:F,onNodeMouseMove:X,onNodeMouseLeave:Y,onNodeContextMenu:K,nodeClickDistance:Z1,onlyRenderVisibleElements:w,noPanClassName:J0,noDragClassName:o1,disableKeyboardA11y:w0,nodeExtent:_0,rfId:X0,nodesDraggable:l0}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}v_.displayName="GraphView";var lG=s.memo(v_),rG=i6("React Flow","https://reactflow.dev/"),s9=({nodes:_,edges:Q,defaultNodes:$,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=$??_??[],A=K??[0,0],T=H??J5;U8(I,M,B);let{nodesInitialized:O}=m4(N,z,W,{nodeOrigin:A,nodeExtent:T,zIndexMode:L}),C=[0,0,1];if(Z&&U&&G){let f=D2(z,{filter:(D)=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:S,y:w,zoom:y}=i5(f,U,G,X,Y,F?.padding??0.1);C=[S,w,y]}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:$!==void 0,hasDefaultEdges:q!==void 0,panZoom:null,minZoom:X,maxZoom:Y,translateExtent:J5,nodeExtent:T,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:{...x6},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:rG,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:E6,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}},iG=({nodes:_,edges:Q,defaultNodes:$,defaultEdges:q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X,maxZoom:Y,nodeOrigin:K,nodeExtent:H,zIndexMode:L})=>O9((z,W)=>{async function I(){let{nodeLookup:M,panZoom:B,fitViewOptions:N,fitViewResolver:A,width:T,height:O,minZoom:C,maxZoom:f}=W();if(!B)return;await D7({nodes:M,width:T,height:O,panZoom:B,minZoom:C,maxZoom:f},N),A?.resolve(!0),z({fitViewResolver:null})}return{...s9({nodes:_,edges:Q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X,maxZoom:Y,nodeOrigin:K,nodeExtent:H,defaultNodes:$,defaultEdges:q,zIndexMode:L}),setNodes:(M)=>{let{nodeLookup:B,parentLookup:N,nodeOrigin:A,nodeExtent:T,elevateNodesOnSelect:O,fitViewQueued:C,zIndexMode:f,nodesSelectionActive:S}=W(),{nodesInitialized:w,hasSelectedNodes:y}=m4(M,B,N,{nodeOrigin:A,nodeExtent:T,elevateNodesOnSelect:O,checkEquality:!0,zIndexMode:f}),D=S&&y;if(C&&w)I(),z({nodes:M,nodesInitialized:w,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:D});else z({nodes:M,nodesInitialized:w,nodesSelectionActive:D})},setEdges:(M)=>{let{connectionLookup:B,edgeLookup:N}=W();U8(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:T,nodeOrigin:O,nodeExtent:C,debug:f,fitViewQueued:S,zIndexMode:w}=W(),{changes:y,updatedInternals:D}=n7(M,N,A,T,O,C,w);if(!D)return;if(t7(N,A,{nodeOrigin:O,nodeExtent:C,zIndexMode:w}),S)I(),z({fitViewQueued:!1,fitViewOptions:void 0});else z({});if(y?.length>0){if(f)console.log("React Flow: trigger node changes",y);B?.(y)}},updateNodePositions:(M,B=!1)=>{let N=[],A=[],{nodeLookup:T,triggerNodeChanges:O,connection:C,updateConnection:f,onNodesChangeMiddlewareMap:S}=W();for(let[w,y]of M){let D=T.get(w),c=!!(D?.expandParent&&D?.parentId&&y?.position),l={id:w,type:"position",position:c?{x:Math.max(0,y.position.x),y:Math.max(0,y.position.y)}:y.position,dragging:B};if(D&&C.inProgress&&C.fromNode.id===D.id){let v=B2(D,C.fromHandle,H1.Left,!0);f({...C,from:v})}if(c&&D.parentId)N.push({id:w,parentId:D.parentId,rect:{...y.internals.positionAbsolute,width:y.measured.width??0,height:y.measured.height??0}});A.push(l)}if(N.length>0){let{parentLookup:w,nodeOrigin:y}=W(),D=g4(N,T,w,y);A.push(...D)}for(let w of S.values())A=w(A);O(A)},triggerNodeChanges:(M)=>{let{onNodesChange:B,setNodes:N,nodes:A,hasDefaultNodes:T,debug:O}=W();if(M?.length){if(T){let C=q_(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:T,debug:O}=W();if(M?.length){if(T){let C=CU(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:T,triggerEdgeChanges:O}=W();if(B){let C=M.map((f)=>b2(f,!0));T(C);return}T(F5(A,new Set([...M]),!0)),O(F5(N))},addSelectedEdges:(M)=>{let{multiSelectionActive:B,edgeLookup:N,nodeLookup:A,triggerNodeChanges:T,triggerEdgeChanges:O}=W();if(B){let C=M.map((f)=>b2(f,!0));O(C);return}O(F5(N,new Set([...M]))),T(F5(A,new Set,!0))},unselectNodesAndEdges:({nodes:M,edges:B}={})=>{let{edges:N,nodes:A,nodeLookup:T,triggerNodeChanges:O,triggerEdgeChanges:C}=W(),f=M?M:A,S=B?B:N,w=[];for(let D of f){if(!D.selected)continue;let c=T.get(D.id);if(c)c.selected=!1;w.push(b2(D.id,!1))}let y=[];for(let D of S){if(!D.selected)continue;y.push(b2(D.id,!1))}O(w),C(y)},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:T}=W();if(!T)return;let O=B.reduce((f,S)=>S.selected?[...f,b2(S.id,!1)]:f,[]),C=M.reduce((f,S)=>S.selected?[...f,b2(S.id,!1)]:f,[]);N(O),A(C)},setNodeExtent:(M)=>{let{nodes:B,nodeLookup:N,parentLookup:A,nodeOrigin:T,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;m4(B,N,A,{nodeOrigin:T,nodeExtent:M,elevateNodesOnSelect:O,checkEquality:!1,zIndexMode:f}),z({nodeExtent:M})},panBy:(M)=>{let{transform:B,width:N,height:A,panZoom:T,translateExtent:O}=W();return e7({delta:M,panZoom:T,transform:B,translateExtent:O,width:N,height:A})},setCenter:async(M,B,N)=>{let{width:A,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:A/2-M*f,y:T/2-B*f,zoom:f},{duration:N?.duration,ease:N?.ease,interpolate:N?.interpolate}),!0},cancelConnection:()=>{z({connection:{...x6}})},updateConnection:(M)=>{z({connection:M})},reset:()=>z({...s9()})}},Object.is);function L8({initialNodes:_,initialEdges:Q,defaultNodes:$,defaultEdges:q,initialWidth:U,initialHeight:G,initialMinZoom:Z,initialMaxZoom:F,initialFitViewOptions:X,fitView:Y,nodeOrigin:K,nodeExtent:H,zIndexMode:L,children:z}){let[W]=s.useState(()=>iG({nodes:_,edges:Q,defaultNodes:$,defaultEdges:q,width:U,height:G,fitView:Y,minZoom:Z,maxZoom:F,fitViewOptions:X,nodeOrigin:K,nodeExtent:H,zIndexMode:L}));return a.jsx(ZU,{value:W,children:a.jsx(jU,{children:a.jsx(dU,{children:z})})})}function dG({children:_,nodes:Q,edges:$,defaultNodes:q,defaultEdges:U,width:G,height:Z,fitView:F,fitViewOptions:X,minZoom:Y,maxZoom:K,nodeOrigin:H,nodeExtent:L,zIndexMode:z}){if(s.useContext(a4))return a.jsx(a.Fragment,{children:_});return a.jsx(L8,{initialNodes:Q,initialEdges:$,defaultNodes:q,defaultEdges:U,initialWidth:G,initialHeight:Z,fitView:F,initialFitViewOptions:X,initialMinZoom:Y,initialMaxZoom:K,nodeOrigin:H,nodeExtent:L,zIndexMode:z,children:_})}var aG={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function sG({nodes:_,edges:Q,defaultNodes:$,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:T,onNodeContextMenu:O,onNodeDoubleClick:C,onNodeDragStart:f,onNodeDrag:S,onNodeDragStop:w,onNodesDelete:y,onEdgesDelete:D,onDelete:c,onSelectionChange:l,onSelectionDragStart:v,onSelectionDrag:x,onSelectionDragStop:b,onSelectionContextMenu:j,onSelectionStart:V,onSelectionEnd:m,onBeforeDelete:P,connectionMode:u,connectionLineType:E=E0.Bezier,connectionLineStyle:h,connectionLineComponent:o,connectionLineContainerStyle:$1,deleteKeyCode:i="Backspace",selectionKeyCode:t="Shift",selectionOnDrag:p=!1,selectionMode:n=j2.Full,panActivationKeyCode:Q1="Space",multiSelectionKeyCode:J1=Z5()?"Meta":"Control",zoomActivationKeyCode:Z1=Z5()?"Meta":"Control",snapToGrid:L1,snapGrid:K1,onlyRenderVisibleElements:W1=!1,selectNodesOnDrag:e,nodesDraggable:R1,autoPanOnNodeFocus:X1,nodesConnectable:y1,nodesFocusable:e1,nodeOrigin:o1=$_,edgesFocusable:W0,edgesReconnectable:J0,elementsSelectable:w0=!0,defaultViewport:_0=RU,minZoom:X0=0.5,maxZoom:q0=2,translateExtent:U0=J5,preventScrolling:l0=!0,nodeExtent:f0,defaultMarkerColor:r0="#b1b1b7",zoomOnScroll:i0=!0,zoomOnPinch:F2=!0,panOnScroll:d0=!1,panOnScrollSpeed:V0=0.5,panOnScrollMode:R=n0.Free,zoomOnDoubleClick:g=!0,panOnDrag:_1=!0,onPaneClick:q1,onPaneMouseEnter:Y1,onPaneMouseMove:I1,onPaneMouseLeave:O1,onPaneScroll:j1,onPaneContextMenu:f1,paneClickDistance:T0=1,nodeClickDistance:C0=0,children:R2,onReconnect:z5,onReconnectStart:W5,onReconnectEnd:J4,onEdgeContextMenu:r2,onEdgeDoubleClick:q4,onEdgeMouseEnter:Z3,onEdgeMouseMove:F3,onEdgeMouseLeave:k,reconnectRadius:d=10,onNodesChange:U1,onEdgesChange:G1,noDragClassName:C1="nodrag",noWheelClassName:F1="nowheel",noPanClassName:z1="nopan",fitView:B1,fitViewOptions:P1,connectOnClick:p1,attributionPosition:N1,proOptions:r1,defaultEdgeOptions:D1,elevateNodesOnSelect:B5=!0,elevateEdgesOnSelect:B0=!1,disableKeyboardA11y:E1=!1,autoPanOnConnect:H3,autoPanOnNodeDrag:kQ,autoPanOnSelection:jQ=!0,autoPanSpeed:VQ,connectionRadius:uQ,isValidConnection:hQ,onError:DQ,style:bQ,id:y8,nodeDragThreshold:EQ,connectionDragThreshold:xQ,viewport:mQ,onViewportChange:gQ,width:pQ,height:cQ,colorMode:lQ="light",debug:rQ,onScroll:k8,ariaLabelConfig:iQ,zIndexMode:j8="basic",...dQ},aQ){let X3=y8||"1",sQ=NU(lQ),tQ=s.useCallback((V8)=>{V8.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),k8?.(V8)},[k8]);return a.jsx("div",{"data-testid":"rf__wrapper",...dQ,onScroll:tQ,style:{...bQ,...aG},ref:aQ,className:c1(["react-flow",U,sQ]),id:y8,role:"application",children:a.jsxs(dG,{nodes:_,edges:Q,width:pQ,height:cQ,fitView:B1,fitViewOptions:P1,minZoom:X0,maxZoom:q0,nodeOrigin:o1,nodeExtent:f0,zIndexMode:j8,children:[a.jsx(PU,{nodes:_,edges:Q,defaultNodes:$,defaultEdges:q,onConnect:z,onConnectStart:W,onConnectEnd:I,onClickConnectStart:M,onClickConnectEnd:B,nodesDraggable:R1,autoPanOnNodeFocus:X1,nodesConnectable:y1,nodesFocusable:e1,edgesFocusable:W0,edgesReconnectable:J0,elementsSelectable:w0,elevateNodesOnSelect:B5,elevateEdgesOnSelect:B0,minZoom:X0,maxZoom:q0,nodeExtent:f0,onNodesChange:U1,onEdgesChange:G1,snapToGrid:L1,snapGrid:K1,connectionMode:u,translateExtent:U0,connectOnClick:p1,defaultEdgeOptions:D1,fitView:B1,fitViewOptions:P1,onNodesDelete:y,onEdgesDelete:D,onDelete:c,onNodeDragStart:f,onNodeDrag:S,onNodeDragStop:w,onSelectionDrag:x,onSelectionDragStart:v,onSelectionDragStop:b,onMove:K,onMoveStart:H,onMoveEnd:L,noPanClassName:z1,nodeOrigin:o1,rfId:X3,autoPanOnConnect:H3,autoPanOnNodeDrag:kQ,autoPanSpeed:VQ,onError:DQ,connectionRadius:uQ,isValidConnection:hQ,selectNodesOnDrag:e,nodeDragThreshold:EQ,connectionDragThreshold:xQ,onBeforeDelete:P,debug:rQ,ariaLabelConfig:iQ,zIndexMode:j8}),a.jsx(lG,{onInit:Y,onNodeClick:F,onEdgeClick:X,onNodeMouseEnter:N,onNodeMouseMove:A,onNodeMouseLeave:T,onNodeContextMenu:O,onNodeDoubleClick:C,nodeTypes:G,edgeTypes:Z,connectionLineType:E,connectionLineStyle:h,connectionLineComponent:o,connectionLineContainerStyle:$1,selectionKeyCode:t,selectionOnDrag:p,selectionMode:n,deleteKeyCode:i,multiSelectionKeyCode:J1,panActivationKeyCode:Q1,zoomActivationKeyCode:Z1,onlyRenderVisibleElements:W1,defaultViewport:_0,translateExtent:U0,minZoom:X0,maxZoom:q0,preventScrolling:l0,zoomOnScroll:i0,zoomOnPinch:F2,zoomOnDoubleClick:g,panOnScroll:d0,panOnScrollSpeed:V0,panOnScrollMode:R,panOnDrag:_1,autoPanOnSelection:jQ,onPaneClick:q1,onPaneMouseEnter:Y1,onPaneMouseMove:I1,onPaneMouseLeave:O1,onPaneScroll:j1,onPaneContextMenu:f1,paneClickDistance:T0,nodeClickDistance:C0,onSelectionContextMenu:j,onSelectionStart:V,onSelectionEnd:m,onReconnect:z5,onReconnectStart:W5,onReconnectEnd:J4,onEdgeContextMenu:r2,onEdgeDoubleClick:q4,onEdgeMouseEnter:Z3,onEdgeMouseMove:F3,onEdgeMouseLeave:k,reconnectRadius:d,defaultMarkerColor:r0,noDragClassName:C1,noWheelClassName:F1,noPanClassName:z1,rfId:X3,disableKeyboardA11y:E1,nodeExtent:f0,viewport:mQ,onViewportChange:gQ,nodesDraggable:R1}),a.jsx(TU,{onSelectionChange:l}),R2,a.jsx(zU,{proOptions:r1,position:N1}),a.jsx(LU,{rfId:X3,disableKeyboardA11y:E1})]})})}var y_=U_(sG);function k_(_){let[Q,$]=s.useState(_),q=s.useCallback((U)=>$((G)=>q_(U,G)),[]);return[Q,$,q]}var pA=Y0.error014();function tG({dimensions:_,lineWidth:Q,variant:$,className:q}){return a.jsx("path",{strokeWidth:Q,d:`M${_[0]/2} 0 V${_[1]} M0 ${_[1]/2} H${_[0]}`,className:c1(["react-flow__background-pattern",$,q])})}function oG({radius:_,className:Q}){return a.jsx("circle",{cx:_,cy:_,r:_,className:c1(["react-flow__background-pattern","dots",Q])})}var x0;(function(_){_.Lines="lines",_.Dots="dots",_.Cross="cross"})(x0||(x0={}));var nG={[x0.Dots]:1,[x0.Lines]:1,[x0.Cross]:6},eG=(_)=>({transform:_.transform,patternId:`pattern-${_.rfId}`});function j_({id:_,variant:Q=x0.Dots,gap:$=20,size:q,lineWidth:U=1,offset:G=0,color:Z,bgColor:F,style:X,className:Y,patternClassName:K}){let H=s.useRef(null),{transform:L,patternId:z}=S1(eG,x1),W=q||nG[Q],I=Q===x0.Dots,M=Q===x0.Cross,B=Array.isArray($)?$:[$,$],N=[B[0]*L[2]||1,B[1]*L[2]||1],A=W*L[2],T=Array.isArray(G)?G:[G,G],O=M?[A,A]:N,C=[T[0]*L[2]+O[0]/2,T[1]*L[2]+O[1]/2],f=`${z}${_?_:""}`;return a.jsxs("svg",{className:c1(["react-flow__background",Y]),style:{...X,...s4,"--xy-background-color-props":F,"--xy-background-pattern-color-props":Z},ref:H,"data-testid":"rf__background",children:[a.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?a.jsx(oG,{radius:A/2,className:K}):a.jsx(tG,{dimensions:O,lineWidth:U,variant:Q,className:K})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${f})`})]})}j_.displayName="Background";var V_=s.memo(j_);function _Z(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function QZ(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function $Z(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.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 a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.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 qZ(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.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 r4({children:_,className:Q,...$}){return a.jsx("button",{type:"button",className:c1(["react-flow__controls-button",Q]),...$,children:_})}var UZ=(_)=>({isInteractive:_.nodesDraggable||_.nodesConnectable||_.elementsSelectable,minZoomReached:_.transform[2]<=_.minZoom,maxZoomReached:_.transform[2]>=_.maxZoom,ariaLabelConfig:_.ariaLabelConfig});function u_({style:_,showZoom:Q=!0,showFitView:$=!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=m1(),{isInteractive:I,minZoomReached:M,maxZoomReached:B,ariaLabelConfig:N}=S1(UZ,x1),{zoomIn:A,zoomOut:T,fitView:O}=s5(),C=()=>{A(),G?.()},f=()=>{T(),Z?.()},S=()=>{O(U),F?.()},w=()=>{W.setState({nodesDraggable:!I,nodesConnectable:!I,elementsSelectable:!I}),X?.(!I)};return a.jsxs(m0,{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&&a.jsxs(a.Fragment,{children:[a.jsx(r4,{onClick:C,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:B,children:a.jsx(_Z,{})}),a.jsx(r4,{onClick:f,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:M,children:a.jsx(QZ,{})})]}),$&&a.jsx(r4,{className:"react-flow__controls-fitview",onClick:S,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:a.jsx($Z,{})}),q&&a.jsx(r4,{className:"react-flow__controls-interactive",onClick:w,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:I?a.jsx(qZ,{}):a.jsx(JZ,{})}),K]})}u_.displayName="Controls";var h_=s.memo(u_);function GZ({id:_,x:Q,y:$,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 a.jsx("rect",{className:c1(["react-flow__minimap-node",{selected:L},Y]),x:Q,y:$,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 ZZ=s.memo(GZ),FZ=(_)=>_.nodes.map((Q)=>Q.id),H8=(_)=>_ instanceof Function?_:()=>_;function HZ({nodeStrokeColor:_,nodeColor:Q,nodeClassName:$="",nodeBorderRadius:q=5,nodeStrokeWidth:U,nodeComponent:G=ZZ,onClick:Z}){let F=S1(FZ,x1),X=H8(Q),Y=H8(_),K=H8($),H=typeof window>"u"||!!window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:F.map((L)=>a.jsx(KZ,{id:L,nodeColorFunc:X,nodeStrokeColorFunc:Y,nodeClassNameFunc:K,nodeBorderRadius:q,nodeStrokeWidth:U,NodeComponent:G,onClick:Z,shapeRendering:H},L))})}function XZ({id:_,nodeColorFunc:Q,nodeStrokeColorFunc:$,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:T}=I0(M);return{node:M,x:B,y:N,width:A,height:T}},x1);if(!Y||Y.hidden||!d6(Y))return null;return a.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:$(Y),strokeWidth:G,shapeRendering:Z,onClick:X,id:Y.id})}var KZ=s.memo(XZ),YZ=s.memo(HZ),LZ=200,zZ=150,WZ=(_)=>!_.hidden,BZ=(_)=>{let Q={x:-_.transform[0]/_.transform[2],y:-_.transform[1]/_.transform[2],width:_.width/_.transform[2],height:_.height/_.transform[2]},$=!1;for(let q of _.nodeLookup.values())if(!q.hidden){$=!0;break}return{viewBB:Q,boundingRect:$?l6(D2(_.nodeLookup,{filter:WZ}),Q):Q,rfId:_.rfId,panZoom:_.panZoom,translateExtent:_.translateExtent,flowWidth:_.width,flowHeight:_.height,ariaLabelConfig:_.ariaLabelConfig}},t9=(_,Q)=>_.x===Q.x&&_.y===Q.y&&_.width===Q.width&&_.height===Q.height,AZ=(_,Q)=>t9(_.viewBB,Q.viewBB)&&t9(_.boundingRect,Q.boundingRect)&&_.rfId===Q.rfId&&_.panZoom===Q.panZoom&&_.translateExtent===Q.translateExtent&&_.flowWidth===Q.flowWidth&&_.flowHeight===Q.flowHeight&&_.ariaLabelConfig===Q.ariaLabelConfig,MZ="react-flow__minimap-desc";function D_({style:_,className:Q,nodeStrokeColor:$,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:T=5}){let O=m1(),C=s.useRef(null),{boundingRect:f,panZoom:S,viewBB:w,rfId:y,translateExtent:D,flowWidth:c,flowHeight:l,ariaLabelConfig:v}=S1(BZ,AZ),x=_?.width??LZ,b=_?.height??zZ,j=f.width/x,V=f.height/b,m=Math.max(j,V),P=m*x,u=m*b,E=T*m,h=f.x-(P-f.width)/2-E,o=f.y-(u-f.height)/2-E,$1=P+E*2,i=u+E*2,t=`${MZ}-${y}`,p=s.useRef(0),n=s.useRef();p.current=m,s.useEffect(()=>{let K1=O.getState().panZoom;if(C.current&&K1)return n.current=G9({domNode:C.current,panZoom:K1,getTransform:()=>O.getState().transform,getViewScale:()=>p.current}),()=>{n.current?.destroy()}},[S]),s.useEffect(()=>{n.current?.update({translateExtent:D,width:c,height:l,inversePan:N,pannable:I,zoomStep:A,zoomable:M})},[I,M,N,A,D,c,l]);let Q1=z?(K1)=>{let[W1,e]=n.current?.pointer(K1)||[0,0];z(K1,{x:W1,y:e})}:void 0,J1=s.useCallback((K1,W1)=>{let e=O.getState().nodeLookup.get(W1).internals.userNode;W?.(K1,e)},[W]),Z1=W?J1:void 0,L1=B??v["minimap.ariaLabel"];return a.jsx(m0,{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*m:void 0,"--xy-minimap-node-background-color-props":typeof q==="string"?q:void 0,"--xy-minimap-node-stroke-color-props":typeof $==="string"?$: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:a.jsxs("svg",{width:x,height:b,viewBox:`${h} ${o} ${$1} ${i}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":t,ref:C,onClick:Q1,children:[L1&&a.jsx("title",{id:t,children:L1}),a.jsx(YZ,{onClick:Z1,nodeColor:q,nodeStrokeColor:$,nodeBorderRadius:G,nodeClassName:U,nodeStrokeWidth:Z,nodeComponent:F}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${h-E},${o-E}h${$1+E*2}v${i+E*2}h${-$1-E*2}z
|
|
34
|
+
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}D_.displayName="MiniMap";var b_=s.memo(D_),TZ=(_)=>(Q)=>_?`${Math.max(1/Q.transform[2],1)}`:void 0,RZ={[e0.Line]:"right",[e0.Handle]:"bottom-right"};function OZ({nodeId:_,position:Q,variant:$=e0.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=Y8(),A=typeof _==="string"?_:N,T=m1(),O=s.useRef(null),C=$===e0.Handle,f=S1(s.useCallback(TZ(C&&z),[C,z]),x1),S=s.useRef(null),w=Q??RZ[$];s.useEffect(()=>{if(!O.current||!A)return;if(!S.current)S.current=L9({domNode:O.current,nodeId:A,getStoreItems:()=>{let{nodeLookup:D,transform:c,snapGrid:l,snapToGrid:v,nodeOrigin:x,domNode:b}=T.getState();return{nodeLookup:D,transform:c,snapGrid:l,snapToGrid:v,nodeOrigin:x,paneDomNode:b}},onChange:(D,c)=>{let{triggerNodeChanges:l,nodeLookup:v,parentLookup:x,nodeOrigin:b}=T.getState(),j=[],V={x:D.x,y:D.y},m=v.get(A);if(m&&m.expandParent&&m.parentId){let P=m.origin??b,u=D.width??m.measured.width??0,E=D.height??m.measured.height??0,h={id:m.id,parentId:m.parentId,rect:{width:u,height:E,...a6({x:D.x??m.position.x,y:D.y??m.position.y},{width:u,height:E},m.parentId,v,P)}},o=g4([h],v,x,b);j.push(...o),V.x=D.x?Math.max(P[0]*u,D.x):void 0,V.y=D.y?Math.max(P[1]*E,D.y):void 0}if(V.x!==void 0&&V.y!==void 0){let P={id:A,type:"position",position:{...V}};j.push(P)}if(D.width!==void 0&&D.height!==void 0){let u={id:A,type:"dimensions",resizing:!0,setAttributes:!L?!0:L==="horizontal"?"width":"height",dimensions:{width:D.width,height:D.height}};j.push(u)}for(let P of c){let u={...P,type:"position"};j.push(u)}l(j)},onEnd:({width:D,height:c})=>{let l={id:A,type:"dimensions",resizing:!1,dimensions:{width:D,height:c}};T.getState().triggerNodeChanges([l])}});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 y=w.split("-");return a.jsx("div",{className:c1(["react-flow__resize-control","nodrag",...y,$,q]),ref:O,style:{...U,scale:f,...Z&&{[C?"backgroundColor":"borderColor"]:Z}},children:G})}var o9=s.memo(OZ);function E_({nodeId:_,isVisible:Q=!0,handleClassName:$,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 a.jsxs(a.Fragment,{children:[K9.map((B)=>a.jsx(o9,{className:U,style:G,nodeId:_,position:B,variant:e0.Line,color:Z,minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K,onResizeStart:W,keepAspectRatio:H,autoScale:L,shouldResize:z,onResize:I,onResizeEnd:M},B)),X9.map((B)=>a.jsx(o9,{className:$,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 IZ=(_)=>_.domNode?.querySelector(".react-flow__renderer");function PZ({children:_}){let Q=S1(IZ);if(!Q)return null;return n9.createPortal(_,Q)}var NZ=(_,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,wZ=(_,Q)=>{if(_.size!==Q.size)return!1;for(let[$,q]of _)if(NZ(q,Q.get($)))return!1;return!0},fZ=(_)=>({x:_.transform[0],y:_.transform[1],zoom:_.transform[2],selectedNodesCount:_.nodes.filter((Q)=>Q.selected).length});function z8({nodeId:_,children:Q,className:$,style:q,isVisible:U,position:G=H1.Top,offset:Z=10,align:F="center",...X}){let Y=Y8(),K=s.useCallback((O)=>{return(Array.isArray(_)?_:[_||Y||""]).reduce((S,w)=>{let y=O.nodeLookup.get(w);if(y)S.set(y.id,y);return S},new Map)},[_,Y]),H=S1(K,wZ),{x:L,y:z,zoom:W,selectedNodesCount:I}=S1(fZ,x1);if(!(typeof U==="boolean"?U:H.size===1&&H.values().next().value?.selected&&I===1)||!H.size)return null;let B=D2(H),N=Array.from(H.values()),A=Math.max(...N.map((O)=>O.internals.z+1)),T={position:"absolute",transform:a7(B,{x:L,y:z,zoom:W},G,Z,F),zIndex:A,...q};return a.jsx(PZ,{children:a.jsx("div",{style:T,className:c1(["react-flow__node-toolbar",$]),...X,"data-id":N.reduce((O,C)=>`${O}${C.id} `,"").trim(),children:Q})})}var n1=Q0(u0(),1);var x_={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=Q0(t5(),1),SZ="https://brand.volter.ai/logo/twin-world/svg?size=64&variant=mono";function o5({href:_,onClick:Q}){return A1.jsxDEV("h1",{children:A1.jsxDEV("a",{href:_,onClick:Q,children:[A1.jsxDEV("img",{src:SZ,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 Q2(_){return(await _.json().catch(()=>({}))).error??`answered ${_.status}`}function g_(_,Q,$=0,q=""){let[U,G]=n1.useState({state:"loading"});return n1.useEffect(()=>{G({state:"loading"})},[q,Q]),n1.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 Q2(F)};if(Z)G(X)}catch(F){if(Z)G({state:"error",status:0,error:String(F)})}})(),()=>{Z=!1}},[q,Q,$]),U}function F0({load:_,what:Q,retry:$,lines:q=3}){if(_.state==="loading")return A1.jsxDEV(vZ,{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),$?A1.jsxDEV("button",{type:"button",onClick:$,children:"Try again"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);return null}function vZ({lines:_=3,label:Q="Loading…"}){return A1.jsxDEV("div",{className:"skeleton",role:"status","aria-label":Q,children:Array.from({length:_},($,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 h1({iso:_,time:Q}){if(!_)return A1.jsxDEV("span",{children:"—"},void 0,!1,void 0,this);let $=new Date(_);return A1.jsxDEV("time",{dateTime:_,title:_,children:Number.isNaN($.getTime())?_:Q?$.toLocaleTimeString():$.toLocaleString()},void 0,!1,void 0,this)}var x2=(_)=>_?new Date(_).toLocaleString():"—";function A8(_){let Q=_?Date.parse(_):Number.NaN;if(Number.isNaN(Q))return"—";let $=Math.max(0,Math.round((Date.now()-Q)/1000));return $<60?"just now":$<3600?`${Math.round($/60)}m ago`:$<86400?`${Math.round($/3600)}h ago`:`${Math.round($/86400)}d ago`}function g1(_,Q){let $=Q.replace(/[_-]+/g," "),q=$.endsWith("s")?$:/[^aeiou]y$/.test($)?`${$.slice(0,-1)}ies`:/(ch|sh|x)$/.test($)?`${$}es`:`${$}s`;return`${_} ${_===1?$:q}`}var m2=(_)=>_.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 d1({vendor:_}){let Q=x_[_];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 m_=(_)=>{_.currentTarget.closest("details")?.removeAttribute("open")},kZ="volter.theme",M8=()=>{try{let _=localStorage.getItem(kZ);return _==="light"||_==="dark"?_:"system"}catch{return"system"}};function p_(_=M8()){let Q=document.documentElement;if(_==="system")Q.removeAttribute("data-theme");else Q.setAttribute("data-theme",_)}function c_(){return n1.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()},$=(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",$),()=>{document.removeEventListener("keydown",Q),document.removeEventListener("click",$)}},[]),null}function M0({open:_,onClose:Q,title:$,children:q,footer:U,wide:G}){let Z=n1.useRef(null),F=n1.useId();return n1.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:$},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 W8="volter:confirm";function g0(_){return new Promise((Q)=>{window.dispatchEvent(new CustomEvent(W8,{detail:{ask:_,resolve:Q}}))})}function l_(){let[_,Q]=n1.useState(null),[$,q]=n1.useState("");n1.useEffect(()=>{let F=(X)=>{q(""),Q(X.detail)};return window.addEventListener(W8,F),()=>window.removeEventListener(W8,F)},[]);let U=(F)=>{_?.resolve(F),Q(null)},G=_?.ask,Z=!G?.typed||$===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:$,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 B8="volter:toast";function l1(_,Q="ok"){window.dispatchEvent(new CustomEvent(B8,{detail:{text:_,kind:Q}}))}function r_(){let[_,Q]=n1.useState([]);return n1.useEffect(()=>{let $=0,q=(U)=>{let{text:G,kind:Z}=U.detail,F=++$;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(B8,q),()=>window.removeEventListener(B8,q)},[]),A1.jsxDEV("div",{className:"toasts",role:"region","aria-label":"Notifications",children:_.map(($)=>A1.jsxDEV("div",{className:`toast ${$.kind}`,role:$.kind==="error"?"alert":"status",children:[A1.jsxDEV("span",{children:$.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!==$.id)),children:"✕"},void 0,!1,void 0,this)]},$.id,!0,void 0,this))},void 0,!1,void 0,this)}function T8({value:_,label:Q,secret:$}){let[q,U]=n1.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($?"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 i_({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(($)=>Boolean($)).map(($)=>$.href?A1.jsxDEV("a",{role:"menuitem",href:$.href,className:$.danger?"danger-item":void 0,onClick:m_,children:$.label},$.label,!1,void 0,this):A1.jsxDEV("button",{type:"button",role:"menuitem",disabled:$.disabled,className:$.danger?"danger-item":void 0,onClick:(q)=>{m_(q),$.onSelect?.()},children:$.label},$.label,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function H5({title:_,children:Q,action:$}){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,$?A1.jsxDEV("div",{className:"empty-action",children:$},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function d_(){return n1.useEffect(()=>{let _=($)=>{let q=document.querySelector("main.app"),U=$.target;if(q?.hasAttribute("data-drawer")&&U&&!U.closest(".side")&&!U.closest(".drawer-button"))q.removeAttribute("data-drawer")},Q=($)=>{if($.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 a_(_){return _.browser?`~browser:${encodeURIComponent(_.browser)}:${_.vendor}:${_.id}`:`${_.vendor}:${_.id}`}function o4(_={}){let Q=(q,U)=>_.tools?`${U} (\`${q}\`)`:`\`${q}\``,$=["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>";$.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 $.push("","The guide: https://world.volter.ai/docs/guides/use-with-a-coding-agent.md"),$.join(`
|
|
35
|
+
`)}var s_={"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 J=Q0(t5(),1),e4="volter.console.token",_4=document.getElementById("root"),T1=_4.dataset.base??"/-/console",k1=window.location.origin,c0=(_4.dataset.worlds??k1).replace(/\/+$/,""),UQ=(_4.dataset.names??"").split(",").filter((_)=>_!==""),q2=_4.dataset.worldOrigin==="1",c2=window.fetch.bind(window),M2="(session)",GQ="(pass)",n5=(_)=>{try{if(_&&!q2)sessionStorage.setItem(e4,_);else sessionStorage.removeItem(e4);localStorage.removeItem(e4)}catch{}},ZQ="volter.console.portal",FQ=(_)=>{try{if(typeof _==="string"&&/^https?:$/.test(new URL(_).protocol))sessionStorage.setItem(ZQ,new URL(_).origin)}catch{}},VZ=()=>{return l2.get("token")??""},H0=()=>{try{let _=sessionStorage.getItem(ZQ)??"";return _&&/^https?:$/.test(new URL(_).protocol)?new URL(_).origin:""}catch{return""}},uZ=()=>{let _=VZ();if(q2){if(n5(""),l2.get("pass"))return GQ;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?"":M2)}if(_)return n5(_),_;try{return sessionStorage.getItem(e4)??""}catch{return""}};function a1(_){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: ${m2(G)}.`,acts:Z}}let $=/no credential (?:is )?sealed for ([a-z0-9_-]+)/i.exec(Q);if($)return{text:`No credential is sealed for ${M1($[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:`${m2(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(_)=>a1(await Q2(_)).text,hZ={vault:["vault","Open Vault"],remote:["remote","Open Remote"],settings:["settings/services","Open Real services"]};function HQ({name:_,acts:Q}){let $=Q.map((q)=>hZ[q]).filter((q)=>Boolean(q));if($.length===0)return null;return J.jsxDEV(J.Fragment,{children:$.map(([q,U])=>J.jsxDEV(r.default.Fragment,{children:[" ",J.jsxDEV("a",{href:`${T1}/${_}/~/${q}`,onClick:(G)=>{G.preventDefault(),V1([..._.split("/"),"~",...q.split("/")])},children:U},void 0,!1,void 0,this)]},q,!0,void 0,this))},void 0,!1,void 0,this)}async function v1(_,Q,$={}){return c2(`${k1}${Q}`,{...$,headers:{...$.headers??{},..._===M2?{}:{"x-volter-token":_},...$.body&&!$.headers?.["content-type"]?{"content-type":"application/json"}:{}}})}function u1(_,Q,$=0){let q=g_((U)=>v1(_,U),Q,$,_);return q.state==="error"?{...q,error:a1(q.error).text}:q}var L5=(_)=>{let Q=new Date(_),$=(q)=>String(q).padStart(2,"0");return`${Q.getFullYear()}-${$(Q.getMonth()+1)}-${$(Q.getDate())}T${$(Q.getHours())}:${$(Q.getMinutes())}`},t_=(_)=>new Date(Math.ceil(Date.parse(_)/60000)*60000).toISOString(),XQ=(_)=>_.operation==="observed"?`observed${_.provenance==="placeholder"?" (default data)":" (vendor)"}`:_.receipt?`${_.receipt.status??""} ${_.receipt.externalId??""} ${_.receipt.reason??""}`.trim():_.provenance==="placeholder"?"default data":"unpushed",DZ=(_)=>{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},N8="volter.console.snapshots",U2=()=>{try{return JSON.parse(sessionStorage.getItem(N8)??"{}")}catch{return{}}},KQ=new Map,w8=(_)=>{if(q2){if(_.token||_.readToken)KQ.set(_.name,{token:_.token,readToken:_.readToken});_={..._,token:"",readToken:""}}try{sessionStorage.setItem(N8,JSON.stringify({...U2(),[_.name]:_}))}catch{}},f8=(_)=>KQ.get(_)?.readToken||U2()[_]?.readToken||"",_3=(_)=>{try{let Q=U2();delete Q[_],sessionStorage.setItem(N8,JSON.stringify(Q))}catch{}},l2=new URLSearchParams(window.location.hash.slice(1)),X5=l2.get("close")??"";function Q4(_){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 C8(_){let Q=Q4(_);if(!Q)return null;let $=new URL(k1);if(Q.protocol!==$.protocol||Q.port!==$.port)return null;if(Q.hostname===$.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===$.hostname||q.test($.hostname)&&U===$.hostname.replace(q,"")?Q.origin:null}function bZ(_){let Q;try{Q=JSON.parse(_)}catch{return null}let $=/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/i;if(typeof Q.name!=="string"||!$.test(Q.name)||typeof Q.parent!=="string"||!$.test(Q.parent)||typeof Q.at!=="string")return null;let q=Q.parentOrigin===void 0?void 0:C8(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 _=l2.get("snapshot");if(_){let Q=bZ(_);if(Q&&!U2()[Q.name])w8(Q)}}var YQ="volter.console.home",LQ=(_)=>{let Q=Q4(_);if(!Q)return null;let $=new URL(k1).hostname,q=$.replace(/^[a-z0-9](?:[a-z0-9]|-(?!-))*--[a-z0-9](?:[a-z0-9]|-(?!-))*\./,"");return Q.hostname===$||Q.hostname===q?Q.origin:null};{let _=LQ(l2.get("home"));if(_)try{sessionStorage.setItem(YQ,_)}catch{}}if(["token","pass","portal","snapshot","home","close"].some((_)=>l2.has(_)))try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}var j0=()=>{try{return LQ(sessionStorage.getItem(YQ))??""}catch{return""}};function S8(_,Q,$,q){let U=new URLSearchParams({token:Q,home:j0()||k1}),G=U2()[$];if(G)U.set("snapshot",JSON.stringify(G));window.location.replace(`${_}${q??`${window.location.pathname}${window.location.search}`}#${U.toString()}`)}var J3=_4.dataset.route==="memory"?"":null;function FM(_){J3=_,window.dispatchEvent(new PopStateEvent("popstate"))}function g2(){return(J3??window.location.pathname.slice(T1.length)).split("/").filter(Boolean).map((_)=>{try{return decodeURIComponent(_)}catch{return""}})}var o_=/^[a-z0-9](?:[a-z0-9]|-(?!-))*$/i,$2=(_,Q)=>_&&Q&&o_.test(_)&&o_.test(Q)?`${_}/${Q}`:"";function V1(_){let Q=`/${_.map(encodeURIComponent).join("/")}`;if(J3!==null)J3=Q;else window.history.pushState(null,"",`${T1}${Q}`);window.dispatchEvent(new PopStateEvent("popstate"))}function zQ(_,Q){let $=C8(U2()[_]?.origin);if($&&$!==k1){S8($,f8(_),_,`${T1}/${Q.map(encodeURIComponent).join("/")}`);return}V1(Q)}async function n_(){let[_,Q]=g2(),$=$2(_,Q),q=$?[$]:UQ;if(q.length===0){let U=await c2(`${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&&$2(G,Z)===U});for(let U of q){let G=await c2(`${k1}/-/${U}/session`,{method:"POST"}).catch(()=>null);if(!G)continue;let Z=await G.json().catch(()=>({})),F=Q4(Z.origin)?.origin;if(G.status===409&&F&&F!==k1)return window.location.replace(`${F}${T1}/${U}`),"moved";if(G.ok&&Z.local)return{token:typeof Z.token==="string"&&Z.token?Z.token:M2}}return null}function EZ(){let[_,Q]=r.useState(M8),$=(q)=>()=>{try{if(q==="system")localStorage.removeItem("volter.theme");else localStorage.setItem("volter.theme",q)}catch{}p_(q),Q(q)};return J.jsxDEV(J.Fragment,{children:[J.jsxDEV("p",{className:"menu-label",children:"Appearance"},void 0,!1,void 0,this),J.jsxDEV("div",{className:"theme-choice",role:"radiogroup","aria-label":"Appearance",children:["system","light","dark"].map((q)=>J.jsxDEV("button",{type:"button",role:"radio","aria-checked":_===q,onClick:$(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 xZ(){let[_,Q]=r.useState(uZ()),[$,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(g2());r.useEffect(()=>{let E=()=>z(g2());return window.addEventListener("popstate",E),()=>window.removeEventListener("popstate",E)},[]),r.useEffect(()=>{let[E,h]=g2(),o=$2(E,h),[$1,i]=o?o.split("/"):[],t=U2()[X5];if(!X5||!_||!$1||!i||!t?.made||t.parent!==`${$1}/${i}`||$2(...X5.split("/"))!==X5)return;try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}v1(_,`/-/${$1}/${i}/branches/${X5}`,{method:"DELETE"}).catch(()=>null).then(()=>_3(X5))},[_]);let W=r.useCallback(async(E)=>{if(H(null),!E){let i=await n_();if(i==="moved")return;if(i){if(q(!0),i.token!==M2)n5(i.token);Q(i.token);return}Y(null),G(!0);return}if(q2&&E===M2){let i=await n_();if(i==="moved")return;if(i)q(!0)}if(q2&&E===GQ){let[i,t]=g2(),p=$2(i,t),[n,Q1]=p?p.split("/"):[],J1=n&&Q1?await c2(`${k1}/-/${n}/${Q1}/session`,{method:"POST",headers:{"x-volter-pass":l2.get("pass")??""}}).catch(()=>null):null;if(!J1){H(`${k1} did not answer: no session was opened`),Y(null);return}if(!J1.ok){H(`${await z0(J1)}. Open it again from the platform.`),Y(null);return}FQ((await J1.json().catch(()=>({}))).issuer),Q(M2);return}if(q2&&E!==M2){let[i,t]=g2(),p=$2(i,t),[n,Q1]=p?p.split("/"):[],J1=n&&Q1?await c2(`${k1}/-/${n}/${Q1}/session`,{method:"POST",headers:{"x-volter-token":E}}).catch(()=>null):null;if(!J1){H(`${k1} did not answer: no session was opened`),Y(null);return}if(!J1.ok){let Z1=await z0(J1);H(J1.status===401||J1.status===403?`That token does not open ${n}/${Q1}.`:J1.status===409?`${n}/${Q1}'s session lives at another origin: ${Z1}`:`The World could not open a session (${J1.status}): ${Z1}`),Y(null);return}Q(M2);return}let h=q2?new Response(null,{status:404}):await v1(E,"/-/worlds");if(h.ok){let{worlds:i}=await h.json();Y({kind:"admin",worlds:i});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 i=await h.json().catch(()=>({}));H(`The platform could not list your worlds${i.error?`: ${i.error}`:""}. Reload; if it stays, the status page says what is wrong.`),Y(null);return}let o=UQ;if(o.length===0){let i=await c2(`${k1}/-/ping`);if(!i.ok){H(`${k1} does not answer as a host`),Y(null);return}if(o=(await i.json()).worlds??[],o.length===0){H(`${k1} does not list its Worlds: open a World at its own address, ${k1}${T1}/<org>/<world>`),Y(null);return}}let $1=[];for(let i of o){let t=await v1(E,`/-/${i}/twins`);if(t.ok){let p=await t.json();$1.push({name:i,base:`${c0}/${i}`,twins:(p.twins??[]).map((n)=>({vendor:n.twin,protocol:n.protocol??null,root:n.root??null}))})}}if($1.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:$1})},[]);r.useEffect(()=>{W(_)},[_,W]);let I=(E)=>X?.kind==="admin"?X.worlds.find((h)=>h.name===E)?.token??_:_,[M,B]=r.useState("");if(!_||!X&&!K)return J.jsxDEV("main",{className:"app gate",children:J.jsxDEV("div",{className:"gate-window",children:[J.jsxDEV(o5,{href:`${T1}/`},void 0,!1,void 0,this),_&&!X&&!K||!_&&!U?J.jsxDEV("p",{className:"mode",children:"Opening…"},void 0,!1,void 0,this):J.jsxDEV("form",{onSubmit:(E)=>{E.preventDefault(),n5(Z.trim()),Q(Z.trim())},className:"stack",children:[J.jsxDEV("h2",{children:"Open a World"},void 0,!1,void 0,this),J.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),J.jsxDEV("label",{children:[J.jsxDEV("span",{children:"Token"},void 0,!1,void 0,this),J.jsxDEV("input",{name:"token",type:"password",value:Z,onChange:(E)=>F(E.target.value),autoFocus:!0,autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.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($){window.location.reload();return}if(q2){let[E,h]=g2(),o=$2(E,h),[$1,i]=o?o.split("/"):[],t=()=>window.location.replace(H0()?`${H0()}/`:`${k1}${T1}/${$1&&i?`${$1}/${i}`:""}?signin`);if(setTimeout(t,2000),$1&&i)c2(`${k1}/-/${$1}/${i}/session/end`,{method:"POST"}).catch(()=>null).then(t);else t();return}if(X)for(let E of X.worlds)navigator.sendBeacon(`${E.base.replace(/\/[^/]+\/[^/]+$/,"")}/-/${E.name}/session/end`);n5(""),Q(""),F(""),Y(null),V1([])};if(K||!X)return J.jsxDEV("main",{className:"app gate",children:J.jsxDEV("div",{className:"gate-window",children:[J.jsxDEV(o5,{href:`${T1}/`},void 0,!1,void 0,this),J.jsxDEV("h2",{children:"Could not open it"},void 0,!1,void 0,this),J.jsxDEV("p",{role:"alert",children:K??"nothing answered"},void 0,!1,void 0,this),H0()?J.jsxDEV("a",{className:"button primary",href:`${H0()}/`,children:["Back to ",new URL(H0()).host]},void 0,!0,void 0,this):J.jsxDEV("button",{type:"button",className:"primary",onClick:A,children:$?"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,y]=L,D=C==="~",c=/^[A-Za-z0-9_-]+$/,l=/^[^\u0000-\u001f\u007f]{1,200}$/,v=D||!C||!c.test(C)?void 0:C,x=S&&c.test(S)?w!==void 0&&f!=="changes"&&f!=="screens"?$2(S,w)||void 0:S:void 0,b=f==="changes"&&S==="changesets"&&w&&c.test(w)?w:f==="screens"&&w&&y&&/^[A-Za-z0-9_.-]+$/.test(w)&&l.test(y)?`${w}:${y}`:void 0,j=$2(T,O),V=j?U2()[j]??null:null,m=(E)=>f8(E)||I(E),P=V?X.kind==="admin"?X.worlds.find((E)=>E.name===V.parent)?.token??null:X.worlds.some((E)=>E.name===V.parent)?_:null:null,u=async(E)=>{let h=C8(E.parentOrigin);if(h&&h!==k1){_3(E.name),window.location.assign(`${h}${T1}/${E.parent}#close=${encodeURIComponent(E.name)}`);return}if(E.made)await v1(I(E.parent),`/-/${E.parent}/branches/${E.name}`,{method:"DELETE"}).catch(()=>null),_3(E.name);V1(E.parent.split("/"))};return J.jsxDEV("main",{className:j?"app workspace":"app home",children:[j?null:J.jsxDEV("header",{children:[j?J.jsxDEV(d_,{},void 0,!1,void 0,this):null,J.jsxDEV(o5,{href:`${j0()&&j0()!==k1?j0():""}${T1}/`,onClick:(E)=>{if(j0()&&j0()!==k1)return;E.preventDefault(),V1([])}},void 0,!1,void 0,this),J.jsxDEV("nav",{"aria-label":"breadcrumb",className:"crumbs",children:[j?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),J.jsxDEV("span",{children:j.split("/")[0]},void 0,!1,void 0,this),J.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),J.jsxDEV("a",{href:`${T1}/${j}`,className:"crumb-world",onClick:(E)=>{E.preventDefault(),V1(j.split("/"))},children:j.split("/")[1]},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,v?J.jsxDEV("span",{children:[" / ",v]},void 0,!0,void 0,this):null,D&&f==="trace"?J.jsxDEV("span",{children:" / trace"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),H0()?J.jsxDEV("a",{href:`${H0()}/${j?encodeURIComponent(j.split("/")[0]):""}`,title:`Back to the platform at ${new URL(H0()).host}`,className:"back-link",children:["← ",J.jsxDEV("span",{className:"back-text",children:j?`${j.split("/")[0]}'s Worlds`:new URL(H0()).host},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,j?null:J.jsxDEV("span",{className:"mode",children:$?"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),j||$?null:J.jsxDEV("button",{onClick:A,children:"Sign out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j?J.jsxDEV(cZ,{name:j,token:m(j),twin:v,tab:D?f??"overview":"overview",arg:D?x:void 0,...D&&b?{sub:b}:{},admin:V?null:X.kind==="admin"?_:null,snapshot:V,parentToken:P,who:{local:$,person:M||null,admin:X.kind==="admin"},onSignOut:A,onReturn:u,opens:(E)=>!!U2()[E]||X.kind==="admin"&&X.worlds.some((h)=>h.name===E),onRemoved:()=>{W(_),V1([])},onWho:B,onEnded:N,worlds:X.worlds.map((E)=>E.name)},j,!1,void 0,this):J.jsxDEV(mZ,{mode:X,admin:X.kind==="admin"?_:null,reload:()=>W(_)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function mZ({mode:_,admin:Q,reload:$}){let[q,U]=r.useState(""),[G,Z]=r.useState(""),[F,X]=r.useState(""),[Y,K]=r.useState(null),H=async(f)=>{if(!await g0({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 v1(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?a1(w.error).text:`answered ${S.status}`),await $()},L=async(f)=>{let S=await v1(Q,`/-/worlds/${f}`,{method:"DELETE"}),w=await S.json().catch(()=>({}));K(S.ok?`removed ${f}`:w.error?a1(w.error).text:`answered ${S.status}`),await $()},[z,W]=r.useState(!1),[I,M]=r.useState(!1),[B,N]=r.useState(""),A=async(f)=>{f.preventDefault(),K(null),W(!0);try{let S=await v1(Q,"/-/worlds",{method:"POST",body:JSON.stringify({org:q,world:G,vendors:F.split(",").map((y)=>y.trim()).filter(Boolean)})}),w=await S.json();if(!S.ok){K(w.error?a1(w.error).text:`the host answered ${S.status}`);return}K(`provisioned ${w.name}`),Z(""),X(""),M(!1),await $()}finally{W(!1)}},T=B.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 J.jsxDEV("section",{className:"home-window","aria-labelledby":"worlds",children:[J.jsxDEV("div",{className:"home-head",children:[J.jsxDEV("h2",{id:"worlds",children:"Worlds"},void 0,!1,void 0,this),J.jsxDEV("span",{className:"mode",children:[g1(_.worlds.length,"World")," ",Q?"this host serves":"this key opens"]},void 0,!0,void 0,this),Q?J.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{K(null),M(!0)},children:[J.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),J.jsxDEV("div",{className:"home-find",children:J.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?J.jsxDEV("p",{role:"status",className:"home-note",children:Y},void 0,!1,void 0,this):null,C.map((f)=>J.jsxDEV(r.default.Fragment,{children:[J.jsxDEV("p",{className:"menu-label home-org",children:f},void 0,!1,void 0,this),J.jsxDEV("ul",{className:"home-list",children:O.filter((S)=>S.name.split("/")[0]===f).map((S)=>J.jsxDEV("li",{children:[J.jsxDEV("a",{href:`${T1}/${S.name}`,onClick:(w)=>{w.preventDefault(),V1(S.name.split("/"))},children:[J.jsxDEV(w1,{name:"globe",size:20},void 0,!1,void 0,this),J.jsxDEV("span",{className:"ws-row-text",children:[J.jsxDEV("b",{children:S.name.split("/")[1]},void 0,!1,void 0,this),J.jsxDEV("small",{children:J.jsxDEV("code",{children:S.base},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("span",{className:"home-vendors",children:S.twins.map((w)=>J.jsxDEV("span",{title:M1(w.vendor),children:J.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?J.jsxDEV("details",{className:"menu home-more",children:[J.jsxDEV("summary",{"aria-label":`More for ${S.name}`,children:"⋯"},void 0,!1,void 0,this),J.jsxDEV("div",{className:"popover menu-list",children:[J.jsxDEV("button",{type:"button",onClick:(w)=>{w.currentTarget.closest("details")?.removeAttribute("open"),H(S.name)},children:"Rotate tokens…"},void 0,!1,void 0,this),J.jsxDEV("button",{type:"button",className:"danger-item",onClick:(w)=>{w.currentTarget.closest("details")?.removeAttribute("open"),g0({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((y)=>{if(y)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?J.jsxDEV("p",{className:"mode home-note",children:T?`No World matches ${B}.`:"No Worlds here yet."},void 0,!1,void 0,this):null,J.jsxDEV(M0,{open:I,onClose:()=>{if(!z)M(!1)},title:"New World",footer:J.jsxDEV(J.Fragment,{children:[J.jsxDEV("button",{type:"button",onClick:()=>M(!1),disabled:z,children:"Cancel"},void 0,!1,void 0,this),J.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:J.jsxDEV("form",{id:"provision",onSubmit:A,className:"stack",children:[J.jsxDEV("label",{children:[J.jsxDEV("span",{children:"Org"},void 0,!1,void 0,this),J.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),J.jsxDEV("label",{children:[J.jsxDEV("span",{children:"World"},void 0,!1,void 0,this),J.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),J.jsxDEV("label",{children:[J.jsxDEV("span",{children:"Vendors"},void 0,!1,void 0,this),J.jsxDEV("input",{name:"vendors",value:F,onChange:(f)=>X(f.target.value),placeholder:"stripe, slack",required:!0},void 0,!1,void 0,this),J.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?J.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 gZ=["changes","events","trace","vendors","screens","canvas","branches","settings","remote","vault"],pZ=(_,Q)=>{let $=Q?.screens?.find((q)=>q.path.replace(/\/+$/,"")==="")??Q?.screens?.find((q)=>!/[{<]/.test(q.path));return Q&&$?`${c0}/${_}/${Q.twin}${$.path.startsWith("/")?$.path:`/${$.path}`}`:null},e_={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,$=(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($),Z=Q.replace(/[._]+/g," ").trim(),F=G?`${U} seeded`:e_[$]?`${U} ${e_[$]}`:`${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 G2=(_)=>/token|password|secret|key|credential/i.test(_.subject.type)&&_.subject.id.length>6?`••••${_.subject.id.slice(-4)}`:_.subject.id;function cZ({name:_,token:Q,twin:$,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]=r.useState("pending"),[A,T]=r.useState(null),[O,C]=r.useState(0),[f,S]=r.useState(null);r.useEffect(()=>{let p=!0;return T(null),v1(Q,`/-/${_}/session`,{method:"POST"}).then(async(n)=>{let Q1=await n.json().catch(()=>({}));if(FQ(Q1.issuer),Q1.who)W?.(Q1.who);S(typeof Q1.signsAs==="string"?Q1.signsAs:null);let J1=Q4(Q1.origin)?.origin;if(n.status===409&&J1&&J1!==k1){S8(J1,Q,_);return}if(!p)return;if(N(!n.ok?"unknown":Q1.scope==="read"?"read":Q1.scope==="write"?"write":"unknown"),!n.ok)T(Q1.error?a1(Q1.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=A?{state:"error",error:A}:B==="pending"?{state:"pending"}:{state:"ok",scope:B},y=B==="write",D=(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)},[c,l]=r.useState(0);r.useEffect(()=>{let p=setInterval(()=>{if(!document.hidden)l((n)=>n+1)},5000);return()=>clearInterval(p)},[]);let[v,x]=r.useState(0),b=u1(Q,`/-/${_}/clock`,c+v);r.useEffect(()=>{if(q2&&!F&&b.state==="error"&&b.status===401)I?.()},[b,F,I]);let j=u1(Q,`/-/${_}/twins`),V=u1(Q,`/-/${_}/branches`,v),m=u1(Q,`/-/${_}/map`,Math.floor(c/2)),P=!(V.state==="error"&&(V.status===404||V.status===405)),u=gZ.includes(q)?q:"overview",E=j.state==="ok"?j.data.twins.map((p)=>p.twin):[];if($&&j.state==="ok"&&!E.includes($))return J.jsxDEV("main",{className:"center",children:J.jsxDEV(H5,{title:`${_} has no ${$}`,action:J.jsxDEV("a",{href:`${T1}/${_}`,onClick:(p)=>{p.preventDefault(),V1(_.split("/"))},children:["Open ",_]},void 0,!0,void 0,this),children:J.jsxDEV("p",{children:["No vendor of this World is called ",$,". 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,o=()=>{N("pending"),C((p)=>p+1)};if(u==="canvas"||u==="vendors"&&!h||q==="screens"&&!U)return J.jsxDEV(MF,{name:_,token:Q,twins:j,session:w,retry:o,snapshot:F,back:()=>V1(_.split("/")),canWrite:y&&!F},void 0,!1,void 0,this);let i=q==="settings"?{kind:"settings",tab:((p)=>WQ.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=$?"vendor":q==="screens"&&U?"screen":u==="vendors"&&h?"vendor":q==="trace"?"trace":q==="events"?"events":q==="changes"&&U==="changesets"?"history":"changes";return J.jsxDEV(eZ,{name:_,token:Q,view:t,win:i,who:Y,snapshot:F,onReturn:H,onSignOut:K,worlds:M,session:w,retry:o,...t==="vendor"?{arg:$??h}:t==="events"||t==="trace"||t==="screen"?U?{arg:U}:{}:{},...G?{sub:G}:{},twins:j,map:m,branches:P?V:null,clock:b,canWrite:y&&!F,refused:D,signsAs:f,opens:L,tick:c,admin:Z,onRemoved:z,onClock:()=>x((p)=>p+1),scope:F?"read":B},void 0,!1,void 0,this)}function w1({name:_,size:Q=20}){return J.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:(s_[_]??[]).map(([$,q],U)=>r.default.createElement($,{key:U,...q}))},void 0,!1,void 0,this)}function q3(_){let Q=($)=>{let q=($.operation??$.op).toLowerCase();return q.includes(".")?q.slice(q.lastIndexOf(".")+1):q};if(_.some(($)=>/^(delete|remove|archive|revoke)/.test(Q($))||$.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 WQ=[["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"]],lZ=(_,Q)=>{let $=Q.split("/").pop()??Q,q=_.split("/").pop()??"";return $.startsWith(`${q}-`)?$.slice(q.length+1):$},p2=(_)=>_.replace(/^_+/,"").replace(/[_-]+/g," ");function BQ({record:_,history:Q}){let $=_.writes[_.writes.length-1],q=N0($),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===$.subject.type&&H.subject.id===$.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)=>!vQ(F[H],X[H]));return J.jsxDEV("div",{className:"ws-diff","aria-label":`${q.label??G2($)}: its changes`,children:[J.jsxDEV("div",{className:"ws-diff-head",children:[J.jsxDEV("span",{className:`ws-kind ${U.tone}`,title:U.word,children:J.jsxDEV(w1,{name:U.icon,size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV(d1,{vendor:_.twin},void 0,!1,void 0,this),J.jsxDEV("div",{className:"cell-label",children:[J.jsxDEV("b",{children:q.label??G2($)},void 0,!1,void 0,this),J.jsxDEV("small",{children:[M1(_.twin)," · ",$.subject.type.replace(/^_+/,"").replace(/[_-]+/g," ")," ",J.jsxDEV("code",{children:G2($)},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),J.jsxDEV("ol",{className:"ws-writes",children:_.writes.map((H)=>J.jsxDEV("li",{children:[J.jsxDEV("b",{children:N0(H).what},void 0,!1,void 0,this)," ",J.jsxDEV("span",{className:"mode",children:[J.jsxDEV(h1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",e5(H)]},void 0,!0,void 0,this)]},H.id,!0,void 0,this))},void 0,!1,void 0,this),Q===null?J.jsxDEV("p",{className:"mode pad",children:"Reading its history…"},void 0,!1,void 0,this):K.length===0?J.jsxDEV("p",{className:"mode pad",children:"No field holds a new value."},void 0,!1,void 0,this):J.jsxDEV("table",{className:"ws-fields","aria-label":"Fields before and after",children:[J.jsxDEV("thead",{children:J.jsxDEV("tr",{children:[J.jsxDEV("th",{children:"Field"},void 0,!1,void 0,this),Y?null:J.jsxDEV("th",{children:"Before"},void 0,!1,void 0,this),J.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),J.jsxDEV("tbody",{children:K.map((H)=>J.jsxDEV("tr",{children:[J.jsxDEV("th",{scope:"row",children:J.jsxDEV("code",{children:H},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y?null:J.jsxDEV("td",{className:H in F?"was":"none",children:H in F?J.jsxDEV(Z2,{v:F[H]},void 0,!1,void 0,this):J.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{className:H in X?"now":"none",children:H in X?J.jsxDEV(Z2,{v:X[H]},void 0,!1,void 0,this):J.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 AQ({records:_,selected:Q,onPick:$,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 J.jsxDEV("li",{children:J.jsxDEV("button",{type:"button",className:[Q===Y.key?"on":"",K?"nested":""].join(" ").trim()||void 0,"aria-pressed":Q===Y.key,onClick:()=>$(Y.key),children:[K?null:J.jsxDEV(d1,{vendor:Y.twin},void 0,!1,void 0,this),J.jsxDEV("span",{className:"ws-row-text",children:[J.jsxDEV("b",{children:L.label??G2(H)},void 0,!1,void 0,this),J.jsxDEV("small",{children:[p2(H.subject.type)," · ",L.what.split(" ").slice(-1)[0],Y.writes.length>1?` · ${g1(Y.writes.length,"write")}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("span",{className:`ws-kind ${z.tone}`,title:z.word,"aria-label":z.word,children:J.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 J.jsxDEV(J.Fragment,{children:[J.jsxDEV("div",{className:"ws-view-switch",role:"group","aria-label":"List the records by",children:[J.jsxDEV("button",{type:"button","aria-pressed":!U,className:U?void 0:"on",onClick:()=>Z(!1),children:"Path"},void 0,!1,void 0,this),J.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),J.jsxDEV("ul",{className:"ws-list","aria-label":q,children:U?X.map((Y)=>{let K=_.filter((H)=>H.twin===Y);return J.jsxDEV("li",{className:"ws-group",children:[J.jsxDEV("p",{className:"ws-group-head",children:[J.jsxDEV(d1,{vendor:Y},void 0,!1,void 0,this),J.jsxDEV("b",{children:M1(Y)},void 0,!1,void 0,this),J.jsxDEV("span",{className:"mode",children:K.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.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 rZ({name:_,token:Q,branches:$,opens:q,refused:U,onChanged:G}){let[Z,F]=r.useState(""),[X,Y]=r.useState(!1),K=$?.state==="ok"&&$.data.checkedOut||_.split("/")[1],H=$?.state==="ok"&&$.data.named?.length?$.data.named:[{name:K,running:!0}],L=$?.state==="ok"?$.data.branches:[],z=Z.trim().toLowerCase(),W=(M)=>!z||M.toLowerCase().includes(z),I=(M)=>{M.currentTarget.closest("details")?.removeAttribute("open")};return J.jsxDEV("details",{className:"menu ws-pick",children:[J.jsxDEV("summary",{title:"The branch served here",children:[J.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this),J.jsxDEV("span",{className:"ws-pick-label",children:[J.jsxDEV("small",{children:"Branch"},void 0,!1,void 0,this),J.jsxDEV("b",{children:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV(w1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("div",{className:"popover ws-branch-menu",children:[J.jsxDEV("div",{className:"ws-branch-find",children:[J.jsxDEV("input",{type:"search",placeholder:"Filter","aria-label":"Filter branches",value:Z,onChange:(M)=>F(M.target.value)},void 0,!1,void 0,this),J.jsxDEV("button",{type:"button",onClick:(M)=>{I(M),Y(!0)},disabled:!$,children:"New branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("p",{className:"menu-label",children:"This World"},void 0,!1,void 0,this),J.jsxDEV("ul",{className:"ws-branch-list",children:H.filter((M)=>W(M.name)).map((M)=>J.jsxDEV("li",{className:M.name===K?"current":void 0,children:[J.jsxDEV("span",{className:"tick",children:M.name===K?J.jsxDEV(w1,{name:"check",size:16},void 0,!1,void 0,this):J.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("span",{className:"name",children:M.name},void 0,!1,void 0,this),J.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),J.jsxDEV("p",{className:"menu-label",children:"Branches of it"},void 0,!1,void 0,this),L.length===0?J.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):J.jsxDEV("ul",{className:"ws-branch-list",children:L.filter((M)=>W(M.name)).map((M)=>{let B=J.jsxDEV(J.Fragment,{children:[J.jsxDEV("span",{className:"tick",children:J.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("span",{className:"name",children:lZ(_,M.name)},void 0,!1,void 0,this),J.jsxDEV("span",{className:"mode",children:M.at?.instant?J.jsxDEV(J.Fragment,{children:["as of ",J.jsxDEV(h1,{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 J.jsxDEV("li",{children:q(M.name)?J.jsxDEV("a",{href:`${T1}/${M.name}`,title:N,onClick:(A)=>{A.preventDefault(),I(A),zQ(M.name,M.name.split("/"))},children:B},void 0,!1,void 0,this):J.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),J.jsxDEV("div",{className:"ws-branch-foot",children:J.jsxDEV("a",{href:`${T1}/${_}/~/branches`,onClick:(M)=>{M.preventDefault(),I(M),V1([..._.split("/"),"~","branches"])},children:"Manage branches…"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV(RQ,{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 MQ({name:_,view:Q,changes:$,changesets:q}){let U=(G)=>(Z)=>{Z.preventDefault(),V1([..._.split("/"),"~",...G])};return J.jsxDEV("nav",{className:"tabs ws-pane-tabs","aria-label":"Changes and history",children:[J.jsxDEV("a",{href:`${T1}/${_}/~/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:$},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),J.jsxDEV("a",{href:`${T1}/${_}/~/changes/changesets`,className:Q==="history"?"on":void 0,"aria-current":Q==="history"?"page":void 0,onClick:U(["changes","changesets"]),children:["History",q?J.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 iZ({name:_,token:Q,sets:$,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),M=$.state==="ok"?[...$.data.changesets].sort((S,w)=>w.createdAt.localeCompare(S.createdAt)):[],B=M.find((S)=>S.name===q)??M[0],N=r.useMemo(()=>{let S=new Map;for(let w of B?CQ(B):[]){let y=`${w.twin}:${w.entry.subject.type}:${w.entry.subject.id}`,D=S.get(y)??{key:y,twin:w.twin,writes:[]};D.writes.push(w.entry),S.set(y,D)}return[...S.values()]},[B]),A=N.find((S)=>S.key===L)??N[0],T=u1(Q,A?`/-/${_}/log/${A.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=B?G3(B):null,f=B?SQ(B,H):null;return J.jsxDEV("div",{className:"ws-two",children:[J.jsxDEV("div",{className:"ws-files",children:[J.jsxDEV(MQ,{name:_,view:"history",changes:Y,changesets:M.length},void 0,!1,void 0,this),J.jsxDEV(F0,{load:$,what:"the changesets",lines:4},void 0,!1,void 0,this),J.jsxDEV("ul",{className:"ws-list ws-commits","aria-label":"Changesets",children:M.map((S)=>{let w=B?.name===S.name,y=G3(S).label==="Not sent";return J.jsxDEV("li",{children:J.jsxDEV("a",{href:`${T1}/${_}/~/changes/changesets/${S.name}`,className:w?"on":void 0,"aria-current":w?"true":void 0,onClick:(D)=>{D.preventDefault(),z(null),V1([..._.split("/"),"~","changes","changesets",S.name])},children:[J.jsxDEV("span",{className:"ws-row-text",children:[J.jsxDEV("b",{children:I8(S)},void 0,!1,void 0,this),J.jsxDEV("small",{children:[S.owner??(S.cutBy?Q3(S.cutBy):"unrecorded")," • ",J.jsxDEV(h1,{iso:S.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y?J.jsxDEV("span",{className:"ws-unpushed",title:"Not pushed to the remote yet",children:J.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),J.jsxDEV("div",{className:"ws-pane-right",children:[$.state==="ok"&&!B?J.jsxDEV(H5,{title:"No changesets yet",children:J.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?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("div",{className:"ws-commit-head",children:[J.jsxDEV("div",{className:"ws-commit-title",children:[J.jsxDEV("h3",{children:I8(B)},void 0,!1,void 0,this),J.jsxDEV("p",{className:"ws-commit-stat",children:[J.jsxDEV(w1,{name:"file-diff",size:16},void 0,!1,void 0,this)," ",g1(N.length,"changed record"),O.added?J.jsxDEV("span",{className:"plus",children:[" +",O.added]},void 0,!0,void 0,this):null,O.removed?J.jsxDEV("span",{className:"minus",children:[" −",O.removed]},void 0,!0,void 0,this):null,O.changed?J.jsxDEV("span",{className:"dot",children:[" •",O.changed]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),J.jsxDEV("p",{className:"mode ws-commit-meta",children:[J.jsxDEV("code",{children:B.name},void 0,!1,void 0,this)," · ",J.jsxDEV(h1,{iso:B.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.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":Q3(B.cutBy):"unrecorded"],...B.pushedBy?[["Pushed by",Q3(B.pushedBy)]]:[]].map(([S,w])=>J.jsxDEV("span",{children:[J.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?J.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),J.jsxDEV("button",{type:"button",onClick:()=>I(!0),title:"Where it went, the checks, the approvals; Verify, Approve and Deploy",children:[J.jsxDEV("span",{className:`badge cs-${C.tone}`,children:C.label},void 0,!1,void 0,this),J.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),J.jsxDEV("div",{className:"ws-two inner",children:[J.jsxDEV("div",{className:"ws-files",children:J.jsxDEV(AQ,{records:N,...A?{selected:A.key}:{},onPick:z,label:"Records it changed"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("div",{className:"ws-detail",children:A?J.jsxDEV(BQ,{record:A,history:T.state==="ok"?T.data.entries:T.state==="error"?[]:null},void 0,!1,void 0,this):J.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),J.jsxDEV(M0,{open:W,onClose:()=>I(!1),title:`Review: ${I8(B)}`,wide:!0,children:[J.jsxDEV(qQ,{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),J.jsxDEV(qQ,{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 dZ({name:_,token:Q,vendors:$,vendor:q,tick:U}){let[G,Z]=r.useState(_Q*4),[F,X]=r.useState(""),[Y,K]=r.useState(null),H=u1(Q,`/-/${_}/timeline?limit=${G}${q?`&twin=${encodeURIComponent(q)}`:""}`,Math.floor(U/2)),L=H.state==="ok"?KF(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)=>K5(O)===Y)??W[0],M=(O)=>(C)=>{C.preventDefault(),K(null),V1([..._.split("/"),"~","events",...O?[O]:[]])},B=I?.entry.input&&typeof I.entry.input==="object"?I.entry.input.body:void 0,N=I?DZ(I.entry.traceparent):null,A=I?QQ(I):null,T=I?ZF(I.entry):[];return J.jsxDEV("div",{className:"ws-events",children:[J.jsxDEV("div",{className:"ws-filterbar",children:[J.jsxDEV("nav",{className:"ws-seg","aria-label":"Vendor",children:[J.jsxDEV("a",{href:`${T1}/${_}/~/events`,className:!q?"on":void 0,"aria-current":!q?"page":void 0,onClick:M(),children:"All"},void 0,!1,void 0,this),$.map((O)=>J.jsxDEV("a",{href:`${T1}/${_}/~/events/${O}`,className:q===O?"on":void 0,"aria-current":q===O?"page":void 0,onClick:M(O),children:[J.jsxDEV(d1,{vendor:O},void 0,!1,void 0,this),M1(O)]},O,!0,void 0,this))]},void 0,!0,void 0,this),J.jsxDEV("select",{"aria-label":"Operation",value:F,onChange:(O)=>{X(O.target.value),K(null)},children:[J.jsxDEV("option",{value:"",children:"Every operation"},void 0,!1,void 0,this),z.map((O)=>J.jsxDEV("option",{value:O,children:O},O,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("div",{className:"ws-grid-wrap",children:[J.jsxDEV(F0,{load:H,what:"the events",lines:6},void 0,!1,void 0,this),J.jsxDEV("table",{className:"ws-grid","aria-label":"Events",children:[J.jsxDEV("thead",{children:J.jsxDEV("tr",{children:[J.jsxDEV("th",{children:"Time"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"What"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Record"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"By"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Receipt"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("tbody",{children:W.map((O)=>{let C=N0(O.entry),f=QQ(O),S=I&&K5(O)===K5(I);return J.jsxDEV("tr",{className:S?"on":void 0,"aria-selected":S,onClick:()=>K(K5(O)),children:[J.jsxDEV("td",{className:"mono",children:J.jsxDEV(h1,{iso:O.entry.occurredAt,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{children:J.jsxDEV("span",{className:"vendor-cell",children:[J.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),J.jsxDEV("td",{children:J.jsxDEV("b",{children:C.what},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{className:"ws-cell-clip",children:C.label?`“${C.label}”`:J.jsxDEV("code",{children:G2(O.entry)},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{className:"mode",children:e5(O.entry,O.caller)},void 0,!1,void 0,this),J.jsxDEV("td",{children:f?J.jsxDEV("span",{className:f.bad?"badge cs-bad":f.status==="deployed"?"badge cs-done":"badge",children:f.status},void 0,!1,void 0,this):J.jsxDEV("span",{className:"mode",children:XQ(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),J.jsxDEV("div",{className:"ws-event-detail",children:I?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("div",{className:"ws-event-line",children:[J.jsxDEV("span",{className:"badge",children:IQ(I.entry)},void 0,!1,void 0,this),A?J.jsxDEV("span",{className:A.bad?"badge cs-bad":"badge cs-good",children:A.status},void 0,!1,void 0,this):null,J.jsxDEV("code",{children:[I.entry.subject.type,":",G2(I.entry)]},void 0,!0,void 0,this),J.jsxDEV("span",{className:"mode",children:[J.jsxDEV(h1,{iso:I.entry.occurredAt},void 0,!1,void 0,this)," · ",e5(I.entry,I.caller)]},void 0,!0,void 0,this),N?J.jsxDEV("a",{href:`${T1}/${_}/~/trace/${N.trace}`,onClick:(O)=>{O.preventDefault(),V1([..._.split("/"),"~","trace",N.trace])},children:"Its trace →"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),J.jsxDEV("div",{className:"ws-event-panes",children:[J.jsxDEV("div",{role:"region","aria-label":"The request",children:[J.jsxDEV("h4",{children:"Request"},void 0,!1,void 0,this),B!==void 0?J.jsxDEV(HF,{body:B},void 0,!1,void 0,this):J.jsxDEV("p",{className:"mode",children:"No request body: the World or the vendor wrote it."},void 0,!1,void 0,this),T.length?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("h4",{children:"Usage"},void 0,!1,void 0,this),J.jsxDEV("dl",{className:"fields",children:T.map(([O,C])=>J.jsxDEV(r.default.Fragment,{children:[J.jsxDEV("dt",{children:O},void 0,!1,void 0,this),J.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),J.jsxDEV("div",{role:"region","aria-label":"What it wrote",children:[J.jsxDEV("h4",{children:"Written"},void 0,!1,void 0,this),J.jsxDEV(NQ,{fields:I.entry.fields},void 0,!1,void 0,this),J.jsxDEV("h4",{children:I.copies.length?"Receipts":"Receipt"},void 0,!1,void 0,this),J.jsxDEV("p",{className:"mode",children:I.copies.length?I.copies.map((O)=>O.entry.receipt?.status??"landed copy").join(" · "):XF(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):J.jsxDEV("p",{className:"mode pad",children:"Nothing written here yet."},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("div",{className:"ws-foot mode",children:[J.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?J.jsxDEV("button",{type:"button",onClick:()=>Z((O)=>O+_Q*4),children:"Load older"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function aZ({name:_,token:Q,id:$}){let q=/^[0-9a-f]{32}$/.test($),U=u1(Q,q?`/-/${_}/timeline?trace=${$}&limit=500`:null),G=U.state==="ok"?[...U.data.entries].sort((H,L)=>-OQ(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 J.jsxDEV("div",{className:"ws-sheet ws-trace",children:[J.jsxDEV("p",{className:"crumbs-line",children:J.jsxDEV("a",{href:`${T1}/${_}/~/events`,onClick:(H)=>{H.preventDefault(),V1([..._.split("/"),"~","events"])},children:[J.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),J.jsxDEV("h2",{children:[G[0]?`${N0(G[0].entry).what} …`:"Trace"," ",J.jsxDEV("code",{className:"mode",children:$.slice(0,12)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!q?J.jsxDEV("p",{role:"alert",children:[$?`${$} is not a trace id`:"No trace named",": a W3C trace id is 32 hex characters."]},void 0,!0,void 0,this):J.jsxDEV(F0,{load:U,what:"the trace"},void 0,!1,void 0,this),G.length?J.jsxDEV("p",{className:"ws-trace-meta",children:["Started ",J.jsxDEV("b",{children:J.jsxDEV(h1,{iso:G[0].entry.occurredAt},void 0,!1,void 0,this)},void 0,!1,void 0,this)," · Took ",J.jsxDEV("b",{children:[Y," ms"]},void 0,!0,void 0,this)," · Vendors ",J.jsxDEV("b",{children:K.map(M1).join(", ")},void 0,!1,void 0,this)," · Writes ",J.jsxDEV("b",{children:G.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,U.state==="ok"&&G.length===0?J.jsxDEV(H5,{title:"Nothing in this World carries this trace",children:J.jsxDEV("p",{children:["An app instrumented with OpenTelemetry sends a ",J.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?J.jsxDEV("div",{className:"ws-spans",role:"table","aria-label":"The trace's writes",children:[J.jsxDEV("div",{className:"ws-span head",role:"row",children:[J.jsxDEV("span",{role:"columnheader",children:"Vendor and what"},void 0,!1,void 0,this),J.jsxDEV("span",{role:"columnheader",className:"ws-ticks",children:[J.jsxDEV("span",{children:"0 ms"},void 0,!1,void 0,this),J.jsxDEV("span",{children:[Math.round(Y/2)," ms"]},void 0,!0,void 0,this),J.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=N0(H.entry);return J.jsxDEV(r.default.Fragment,{children:[J.jsxDEV("div",{className:Z===z?"ws-span on":"ws-span",role:"row",onClick:()=>F(Z===z?null:z),children:[J.jsxDEV("span",{role:"cell",className:"ws-span-name",children:[J.jsxDEV(d1,{vendor:H.twin},void 0,!1,void 0,this),J.jsxDEV("b",{children:M1(H.twin)},void 0,!1,void 0,this)," ",J.jsxDEV("span",{className:"mode",children:[W.what,W.label?` “${W.label}”`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("span",{role:"cell",className:"ws-span-track",children:[J.jsxDEV("span",{className:"ws-span-dot",style:{left:`${L/Y*100}%`}},void 0,!1,void 0,this),J.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?J.jsxDEV("div",{className:"ws-span-detail",children:[J.jsxDEV("p",{className:"mode",children:[J.jsxDEV("code",{children:IQ(H.entry)},void 0,!1,void 0,this)," on ",J.jsxDEV("code",{children:[H.entry.subject.type,":",G2(H.entry)]},void 0,!0,void 0,this)," · ",e5(H.entry,H.caller)," · ",XQ(H.entry)]},void 0,!0,void 0,this),J.jsxDEV(NQ,{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 sZ({name:_,token:Q,vendor:$,withScreens:q,tick:U}){let G=u1(Q,`/-/${_}/checkpoint/${$}`,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("_"))||p2(T.type).localeCompare(p2(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"],M=new Set(["id","type","object","livemode","created","updated","updatedAt","deleted"]),B=(T)=>!M.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)))],A=[...I.filter(B),...N.filter((T)=>!I.includes(T)&&B(T))].slice(0,4);return J.jsxDEV("div",{className:"ws-table-app",children:[J.jsxDEV("nav",{className:"ws-tables","aria-label":`${M1($)}'s records`,children:[J.jsxDEV("div",{className:"ws-list-head",children:J.jsxDEV("span",{className:"vendor-cell",children:[J.jsxDEV(d1,{vendor:$},void 0,!1,void 0,this),M1($)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),J.jsxDEV(F0,{load:G,what:"what it stores",lines:4},void 0,!1,void 0,this),J.jsxDEV("p",{className:"menu-label",children:"Stores"},void 0,!1,void 0,this),F.map((T)=>J.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:[J.jsxDEV(w1,{name:"table-2",size:16},void 0,!1,void 0,this),J.jsxDEV("span",{children:p2(T.type)},void 0,!1,void 0,this),J.jsxDEV("span",{className:"count",children:T.count},void 0,!1,void 0,this)]},T.type,!0,void 0,this)),J.jsxDEV("p",{className:"menu-label",children:"Also"},void 0,!1,void 0,this),J.jsxDEV("a",{href:`${T1}/${_}/~/events/${$}`,onClick:(T)=>{T.preventDefault(),V1([..._.split("/"),"~","events",$])},children:[J.jsxDEV(w1,{name:"activity",size:16},void 0,!1,void 0,this),J.jsxDEV("span",{children:"Its events"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q?J.jsxDEV("a",{href:`${T1}/${_}/~/screens/${$}`,onClick:(T)=>{T.preventDefault(),V1([..._.split("/"),"~","screens",$])},children:[J.jsxDEV(w1,{name:"monitor",size:16},void 0,!1,void 0,this),J.jsxDEV("span",{children:"Its screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),J.jsxDEV("div",{className:"ws-grid-wrap",children:[G.state==="ok"&&F.length===0?J.jsxDEV(H5,{title:`${M1($)} stores nothing yet`,children:J.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?J.jsxDEV("table",{className:"ws-grid","aria-label":`${p2(L??"")} records`,children:[J.jsxDEV("thead",{children:J.jsxDEV("tr",{children:[J.jsxDEV("th",{children:"id"},void 0,!1,void 0,this),A.map((T)=>J.jsxDEV("th",{children:T},T,!1,void 0,this)),J.jsxDEV("th",{children:"updated"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("tbody",{children:z.map((T)=>J.jsxDEV("tr",{className:W?.id===T.id?"on":void 0,"aria-selected":W?.id===T.id,onClick:()=>H(T.id),children:[J.jsxDEV("td",{children:J.jsxDEV("code",{children:T.id},void 0,!1,void 0,this)},void 0,!1,void 0,this),A.map((O)=>J.jsxDEV("td",{className:"ws-cell-clip",children:T[O]===void 0||T[O]===null?J.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this):String(T[O])},O,!1,void 0,this)),J.jsxDEV("td",{className:"mode",children:typeof T.updatedAt==="string"?J.jsxDEV(h1,{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),J.jsxDEV("aside",{className:"ws-record","aria-label":"The selected record",children:W?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("div",{className:"ws-list-head",children:[J.jsxDEV("span",{children:p2(W.type)},void 0,!1,void 0,this),J.jsxDEV("code",{children:W.id},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("dl",{className:"ws-record-fields",children:Object.entries(W).filter(([T])=>T!=="type"&&T!=="id").map(([T,O])=>J.jsxDEV(r.default.Fragment,{children:[J.jsxDEV("dt",{children:T},void 0,!1,void 0,this),J.jsxDEV("dd",{children:J.jsxDEV(Z2,{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),J.jsxDEV("div",{className:"ws-foot mode",children:W?`${z.indexOf(W)+1} of ${g1(z.length,p2(L??"record"))}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function tZ({name:_,vendor:Q,url:$,mapError:q,holding:U,session:G,retry:Z}){return J.jsxDEV("div",{className:"ws-screen",children:[J.jsxDEV("div",{className:"ws-screen-bar",children:[J.jsxDEV("span",{className:"vendor-cell",children:[J.jsxDEV(d1,{vendor:Q},void 0,!1,void 0,this),J.jsxDEV("b",{children:M1(Q)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("span",{className:"mode",children:U},void 0,!1,void 0,this),J.jsxDEV("a",{href:`${T1}/${_}/~/vendors/${Q}`,onClick:(F)=>{F.preventDefault(),V1([..._.split("/"),"~","vendors",Q])},children:[J.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:$,target:"_blank",rel:"noopener noreferrer",children:[J.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"?J.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?J.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"||$===void 0?J.jsxDEV("p",{className:"mode ws-screens-note",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,G.state==="error"?J.jsxDEV("p",{role:"alert",className:"ws-screens-note",children:["The World did not open its screens: ",G.error," ",J.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"&&$===null?J.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:$},Q,!1,void 0,this):null]},void 0,!0,void 0,this)}function oZ({name:_,token:Q,who:$,scope:q}){let[U,G]=r.useState(0),Z=u1(Q,`/-/${_}/twins`),F=u1(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,M]=r.useState([]),B=Y??X?.approvals??1,N=H??X?.summary??"required",A=X!==null&&(B!==(X.approvals??1)||N!==(X.summary??"required")),T=(y,D)=>{if(M((c)=>[{ok:y,text:D,at:new Date().toISOString(),n:++$4},...c].slice(0,3)),!y)l1(D,"error")},O=async(y)=>{y.preventDefault(),W(!0);try{let D=await v1(Q,`/-/${_}/rules`,{method:"PUT",body:JSON.stringify({changesets:{approvals:B,summary:N}})});if(!D.ok){T(!1,`Save: ${await z0(D)}`);return}T(!0,`Saved: ${B===0?"no approval":g1(B,"approval")} before a deploy; a summary ${N==="required"?"required":"generated when none is given"}.`),K(null),L(null),G((c)=>c+1)}finally{W(!1)}},C={gated:"a person deploys an approved changeset",auto:"a push deploys at once",hold:"nothing deploys"},f=$.person?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("b",{children:$.person},void 0,!1,void 0,this),$.local?", signed in on this machine":""]},void 0,!0,void 0,this):$.local?J.jsxDEV(J.Fragment,{children:[J.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):$.admin?J.jsxDEV(J.Fragment,{children:J.jsxDEV("b",{children:"the host's admin"},void 0,!1,void 0,this)},void 0,!1,void 0,this):J.jsxDEV(J.Fragment,{children:[J.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((y)=>y.root?.url):[],w=q!=="write"?"This session reads the World; it changes no rules":null;return J.jsxDEV(J.Fragment,{children:[J.jsxDEV("h3",{className:"settings-head",children:"Changesets"},void 0,!1,void 0,this),J.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),J.jsxDEV(F0,{load:F,what:"the rules",lines:2},void 0,!1,void 0,this),J.jsxDEV("form",{className:"ws-rules",onSubmit:(y)=>void O(y),"aria-label":"Changeset rules",children:[J.jsxDEV("div",{className:"ws-rule",children:[J.jsxDEV("h4",{children:"Recorded as"},void 0,!1,void 0,this),J.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),J.jsxDEV("div",{className:"ws-rule",children:[J.jsxDEV("h4",{children:"A cut's summary"},void 0,!1,void 0,this),J.jsxDEV("fieldset",{className:"choice",disabled:Boolean(w)||X===null,children:[J.jsxDEV("label",{className:"check",children:[J.jsxDEV("input",{type:"radio",name:"summary",checked:N==="required",onChange:()=>L("required")},void 0,!1,void 0,this)," ",J.jsxDEV("span",{children:"Required: whoever cuts says what it does and why"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("label",{className:"check",children:[J.jsxDEV("input",{type:"radio",name:"summary",checked:N==="generated",onChange:()=>L("generated")},void 0,!1,void 0,this)," ",J.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),J.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),J.jsxDEV("div",{className:"ws-rule",children:[J.jsxDEV("h4",{children:"Ready to deploy"},void 0,!1,void 0,this),J.jsxDEV("ul",{className:"ws-rule-list",children:J.jsxDEV("li",{children:[J.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),J.jsxDEV("label",{className:"ws-rule-row",children:[J.jsxDEV("span",{children:"Approved by"},void 0,!1,void 0,this),J.jsxDEV("select",{value:B,onChange:(y)=>K(Number(y.target.value)),disabled:Boolean(w)||X===null,"aria-label":"Approvals required",children:[0,1,2,3,4,5].map((y)=>J.jsxDEV("option",{value:y,children:y===0?"no one: verified is enough":y===1?"1 person":`${y} different people`},y,!1,void 0,this))},void 0,!1,void 0,this),J.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),J.jsxDEV("div",{className:"ws-rule",children:[J.jsxDEV("h4",{children:"Deploys to"},void 0,!1,void 0,this),Z.state==="ok"&&S.length===0?J.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?J.jsxDEV("ul",{className:"ws-rule-list",children:S.map((y)=>J.jsxDEV("li",{children:[J.jsxDEV(d1,{vendor:y.twin},void 0,!1,void 0,this),M1(y.twin),": ",C[y.root.deploy??"gated"]??"gated"]},y.twin,!0,void 0,this))},void 0,!1,void 0,this):null,J.jsxDEV("p",{className:"mode",children:[J.jsxDEV("a",{href:`${T1}/${_}/~/settings/services`,onClick:(y)=>{y.preventDefault(),V1([..._.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),J.jsxDEV(T2,{log:I,name:_},void 0,!1,void 0,this),J.jsxDEV("div",{className:"row-actions",children:[J.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?J.jsxDEV("button",{type:"button",onClick:()=>{K(null),L(null)},children:"Cancel"},void 0,!1,void 0,this):null,w?J.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 nZ({who:_,scope:Q,snapshot:$,portal:q,onSignOut:U}){let G=Q==="write"?"Reads and changes this World":Q==="read"?"Reads this World; changes nothing":"…",[Z,F]=$?["A snapshot",`of ${$.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 J.jsxDEV(J.Fragment,{children:[J.jsxDEV("h3",{className:"settings-head",children:"Account"},void 0,!1,void 0,this),J.jsxDEV("div",{className:"ws-account",children:[J.jsxDEV("span",{className:"ws-account-face","aria-hidden":"true",children:J.jsxDEV(w1,{name:_.person?"user":_.local?"monitor":$?"clock":"key-round",size:20},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("div",{className:"cell-label",children:[J.jsxDEV("b",{children:Z},void 0,!1,void 0,this),J.jsxDEV("small",{children:F},void 0,!1,void 0,this),J.jsxDEV("small",{children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_.local||$?null:J.jsxDEV("p",{children:J.jsxDEV("button",{type:"button",onClick:U,children:[J.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?J.jsxDEV("p",{className:"mode",children:["Your profile, orgs and keys are on ",J.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 eZ({name:_,token:Q,view:$,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:T,tick:O,admin:C,onRemoved:f,onClock:S,scope:w}){let y=yQ(_,Q,O,N),[D,c]=r.useState(0),l=D*1e5+Math.floor(O/2),v=u1(Q,`/-/${_}/diff`,l),x=u1(Q,`/-/${_}/changesets`,l),b=u1(Q,`/-/${_}/rules`,l),[j,V]=r.useState(null),m=(e)=>(R1)=>{R1?.preventDefault(),V1([..._.split("/"),"~",...e])},P=z.state==="ok"?z.data.twins.map((e)=>e.twin):[],u=new Map((W.state==="ok"?W.data.twins:[]).flatMap((e)=>{let R1=pZ(_,e);return R1?[[e.twin,R1]]:[]})),E=[...u.keys()],h=W.state==="ok"?W.data.twins.filter((e)=>e.root).map((e)=>e.twin):[],o=(e)=>W.state==="ok"?(W.data.twins.find((R1)=>R1.twin===e)?.resources??[]).reduce((R1,X1)=>R1+X1.count,0):0,$1=I?.state==="ok"&&I.data.checkedOut||_.split("/")[1],i=r.useMemo(()=>{if(v.state!=="ok")return[];let e=new Map;for(let R1 of v.data.changes){let X1=`${R1.twin}:${R1.entry.subject.type}:${R1.entry.subject.id}`,y1=e.get(X1)??{key:X1,twin:R1.twin,writes:[]};y1.writes.push(R1.entry),e.set(X1,y1)}return[...e.values()]},[v]),t=i.find((e)=>e.key===j)??i[0],p=u1(Q,$==="changes"&&t?`/-/${_}/log/${t.twin}`:null,l),n=v.state==="ok"?v.data.changes.length:0,Q1=y.waiting.length,J1=y.there,Z1=y.origin.state==="ok"?y.origin.data.origin:null,L1=!B?"This session reads the World; it changes nothing":!J1?"No remote: name one in Settings › Remote":null,K1=(e,R1,X1,y1,e1,o1)=>J.jsxDEV("a",{href:`${T1}/${_}/~/${y1}`,className:e?"on":void 0,"aria-current":e?"page":void 0,onClick:e1,children:[R1,J.jsxDEV("span",{children:X1},void 0,!1,void 0,this),o1?J.jsxDEV("span",{className:"count",children:o1},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),W1=(e)=>{e.currentTarget.closest("details")?.removeAttribute("open")};return J.jsxDEV("div",{className:"ws",children:[J.jsxDEV("div",{className:"ws-bar",role:"toolbar","aria-label":`${_} toolbar`,children:[J.jsxDEV("div",{className:"ws-left",children:[J.jsxDEV(o5,{href:`${T1}/${_}`,onClick:(e)=>{e.preventDefault(),m(["changes"])()}},void 0,!1,void 0,this),J.jsxDEV("details",{className:"menu ws-pick",children:[J.jsxDEV("summary",{title:"This World",children:[J.jsxDEV(w1,{name:"globe",size:16},void 0,!1,void 0,this),J.jsxDEV("span",{className:"ws-pick-label",children:[J.jsxDEV("small",{children:"World"},void 0,!1,void 0,this),J.jsxDEV("b",{children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV(w1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("div",{className:"popover menu-list ws-world-menu",children:[Z.local?null:J.jsxDEV(J.Fragment,{children:[J.jsxDEV("p",{className:"menu-label",children:"Worlds"},void 0,!1,void 0,this),K.map((e)=>J.jsxDEV("a",{href:`${T1}/${e}`,className:e===_?"on":void 0,onClick:(R1)=>{R1.preventDefault(),W1(R1),V1(e.split("/"))},children:[e===_?J.jsxDEV(w1,{name:"check",size:16},void 0,!1,void 0,this):J.jsxDEV(w1,{name:"globe",size:16},void 0,!1,void 0,this),e]},e,!0,void 0,this)),J.jsxDEV("a",{href:`${j0()&&j0()!==k1?j0():""}${T1}/`,onClick:(e)=>{if(j0()&&j0()!==k1)return;e.preventDefault(),W1(e),V1([])},children:[J.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),"All Worlds",H0()?` on ${new URL(H0()).host}`:""]},void 0,!0,void 0,this),J.jsxDEV("hr",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("p",{className:"menu-label",children:"Connect an app"},void 0,!1,void 0,this),H0()?J.jsxDEV(J.Fragment,{children:[J.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),J.jsxDEV("pre",{children:[c0,"/",_,"/<vendor>"]},void 0,!0,void 0,this),J.jsxDEV(R8,{text:o4({platform:H0(),world:_})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):!Z.local?J.jsxDEV(J.Fragment,{children:[J.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),J.jsxDEV("pre",{children:[c0,"/",_,"/<vendor>"]},void 0,!0,void 0,this),J.jsxDEV(R8,{text:o4()},void 0,!1,void 0,this)]},void 0,!0,void 0,this):J.jsxDEV(J.Fragment,{children:[J.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),J.jsxDEV("pre",{children:"volter world run -- npm start"},void 0,!1,void 0,this),J.jsxDEV("p",{className:"ws-menu-text mode",children:["Or point an SDK at ",J.jsxDEV("code",{children:[c0,"/",_,"/<vendor>"]},void 0,!0,void 0,this)," with the token in ",J.jsxDEV("code",{children:".volter/token"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),J.jsxDEV(R8,{text:o4()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("hr",{},void 0,!1,void 0,this),J.jsxDEV("a",{href:`${T1}/${_}/~/settings`,onClick:(e)=>{W1(e),m(["settings"])(e)},children:[J.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),J.jsxDEV(rZ,{name:_,token:Q,branches:I,opens:T,refused:N,onChanged:S},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("div",{className:"ws-where",title:"Where this is",children:[J.jsxDEV("span",{children:_},void 0,!1,void 0,this),J.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),J.jsxDEV("span",{children:$1},void 0,!1,void 0,this),J.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),Z1?J.jsxDEV("a",{href:`${T1}/${_}/~/remote`,onClick:m(["remote"]),children:["origin ",Z1.namespace,Q1?J.jsxDEV("b",{children:[" ↑",Q1]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):J.jsxDEV("a",{href:`${T1}/${_}/~/remote`,onClick:m(["remote"]),children:"no remote"},void 0,!1,void 0,this),J.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),J.jsxDEV("a",{href:`${T1}/${_}/~/settings/clock`,onClick:m(["settings","clock"]),children:M.state==="ok"?J.jsxDEV(J.Fragment,{children:[M.data.frozen?"stopped at ":"",J.jsxDEV(h1,{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),J.jsxDEV("div",{className:"ws-right",children:[J.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void y.pull(),disabled:Boolean(L1)||y.busy!==null,title:L1??`Fetch what ${J1} has and move this branch onto it`,children:[J.jsxDEV(w1,{name:"arrow-down-to-line",size:16},void 0,!1,void 0,this),y.busy==="Pull"?"Pulling…":"Pull"]},void 0,!0,void 0,this),J.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void y.push(),disabled:Boolean(L1)||y.busy!==null||Q1===0,title:L1??(Q1?`Push ${g1(Q1,"changeset")} to ${J1}`:`Every changeset is at ${J1}`),children:[J.jsxDEV(w1,{name:"arrow-up-from-line",size:16},void 0,!1,void 0,this),y.busy==="Push"?"Pushing…":"Push",Q1?J.jsxDEV("span",{className:"ws-btn-count",children:Q1},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),J.jsxDEV("button",{type:"button",className:"ws-btn icon-only","aria-label":"Settings",title:"Settings",onClick:()=>m(["settings"])(),children:J.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?J.jsxDEV("div",{className:"ws-banner",role:"region","aria-label":"Snapshot",children:[J.jsxDEV(w1,{name:"clock",size:16},void 0,!1,void 0,this),J.jsxDEV("span",{children:["You are looking at ",J.jsxDEV("b",{children:F.parent},void 0,!1,void 0,this)," as it was at ",J.jsxDEV(h1,{iso:F.at},void 0,!1,void 0,this),": a read-only snapshot",F.expiresAt?J.jsxDEV(J.Fragment,{children:[", gone ",J.jsxDEV(h1,{iso:F.expiresAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,"."]},void 0,!0,void 0,this),J.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,y.log.length?J.jsxDEV("div",{className:"ws-said",children:J.jsxDEV(T2,{log:y.log.slice(0,1),name:_},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,J.jsxDEV("div",{className:"ws-body",children:[J.jsxDEV("nav",{className:"ws-side","aria-label":`${_} places`,children:[P.length?J.jsxDEV("a",{href:`${T1}/${_}/~/screens`,className:$==="screen"?"ws-screens-entry on":"ws-screens-entry",onClick:m(["screens"]),title:`The board: ${m2(P.map(M1))}`,children:[J.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),J.jsxDEV("span",{children:"Board"},void 0,!1,void 0,this),J.jsxDEV("span",{className:"ws-screens-marks",children:[P.slice(0,3).map((e)=>J.jsxDEV(d1,{vendor:e},e,!1,void 0,this)),P.length>3?J.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,J.jsxDEV("p",{className:"side-group",children:"Workspace"},void 0,!1,void 0,this),K1($==="changes"||$==="history",J.jsxDEV(w1,{name:"file-diff",size:16},void 0,!1,void 0,this),"Changes","changes",m(["changes"]),i.length?String(i.length):void 0),K1($==="events"&&!U||$==="trace",J.jsxDEV(w1,{name:"activity",size:16},void 0,!1,void 0,this),"Events","events",m(["events"])),J.jsxDEV("p",{className:"side-group",children:"Records"},void 0,!1,void 0,this),P.map((e)=>J.jsxDEV(r.default.Fragment,{children:K1($==="vendor"&&U===e,J.jsxDEV(d1,{vendor:e},void 0,!1,void 0,this),M1(e),`vendors/${e}`,m(["vendors",e]),o(e)?String(o(e)):void 0)},e,!1,void 0,this)),J.jsxDEV("p",{className:"side-group",children:"Remote"},void 0,!1,void 0,this),K1(!1,J.jsxDEV(w1,{name:"cloud",size:16},void 0,!1,void 0,this),J1?"origin":"Name a remote…","remote",m(["remote"]),Q1?`↑${Q1}`:void 0)]},void 0,!0,void 0,this),J.jsxDEV("div",{className:"ws-main",role:"main",children:[$==="changes"?J.jsxDEV("div",{className:"ws-status",children:[J.jsxDEV("div",{className:"ws-files",children:[J.jsxDEV(MQ,{name:_,view:"changes",changes:i.length,changesets:x.state==="ok"?x.data.changesets.length:0},void 0,!1,void 0,this),J.jsxDEV("div",{className:"ws-list-head",children:[J.jsxDEV("span",{children:"Not in a changeset"},void 0,!1,void 0,this),J.jsxDEV("span",{className:"mode",children:v.state==="ok"?`${g1(i.length,"record")} · ${g1(n,"write")}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV(F0,{load:v,what:"the changes",lines:4},void 0,!1,void 0,this),J.jsxDEV(AQ,{records:i,...t?{selected:t.key}:{},onPick:V,label:"Changed records"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("div",{className:"ws-detail",children:[v.state==="ok"&&!t?J.jsxDEV(H5,{title:"No changes on this branch",action:Q1>0&&J1?J.jsxDEV("button",{type:"button",className:"primary",disabled:Boolean(L1)||y.busy!==null,onClick:()=>void y.push(),children:["Push ",g1(Q1,"changeset")," to origin"]},void 0,!0,void 0,this):void 0,children:J.jsxDEV("p",{children:["What your app writes to this World lands here, record by record, to cut into a changeset. Everything since ",v.data.base.at?J.jsxDEV(h1,{iso:v.data.base.at},void 0,!1,void 0,this):J.jsxDEV("code",{children:v.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?J.jsxDEV(BQ,{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),J.jsxDEV(IF,{pinned:!0,generated:b.state==="ok"&&b.data.changesets.summary==="generated",author:{face:J.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:`${T1}/${_}/~/settings/account`,branch:$1},name:_,token:Q,changes:n,canWrite:B,refused:N,onCut:()=>{c((e)=>e+1),V(null)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$==="history"?J.jsxDEV(iZ,{name:_,token:Q,sets:x,changes:i.length,withScreens:E,required:b.state==="ok"?b.data.changesets.approvals??1:1,...q?{sub:q}:{},signsAs:A,canWrite:B,rooted:h,refused:N,onChanged:()=>c((e)=>e+1)},void 0,!1,void 0,this):null,$==="events"?J.jsxDEV(dZ,{name:_,token:Q,vendors:P,...U&&P.includes(U)?{vendor:U}:{},tick:O},U??"",!1,void 0,this):null,$==="trace"?J.jsxDEV(aZ,{name:_,token:Q,id:U??""},void 0,!1,void 0,this):null,$==="vendor"&&U?J.jsxDEV(sZ,{name:_,token:Q,vendor:U,withScreens:E.includes(U),tick:O},U,!1,void 0,this):null,$==="screen"&&U?J.jsxDEV(tZ,{name:_,vendor:U,url:W.state==="ok"?u.get(U)??null:void 0,...W.state==="error"?{mapError:W.error}:{},holding:QF(W.state==="ok"?W.data.twins.find((e)=>e.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),J.jsxDEV(M0,{open:G?.kind==="settings",onClose:()=>m(["changes"])(),title:"Settings",wide:"window",children:G?.kind==="settings"?J.jsxDEV("div",{className:"ws-settings",children:[J.jsxDEV("nav",{"aria-label":"Settings",children:WQ.map(([e,R1,X1])=>J.jsxDEV("a",{href:`${T1}/${_}/~/settings/${e}`,className:G.tab===e?"on":void 0,"aria-current":G.tab===e?"page":void 0,onClick:m(["settings",e]),children:[J.jsxDEV(w1,{name:X1,size:16},void 0,!1,void 0,this),R1]},e,!0,void 0,this))},void 0,!1,void 0,this),J.jsxDEV("div",{className:"ws-settings-pane",children:[w==="read"?J.jsxDEV("p",{className:"mode",children:[J.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"?J.jsxDEV(nZ,{who:Z,scope:w,snapshot:F,portal:H0(),onSignOut:Y},void 0,!1,void 0,this):null,G.tab==="changesets"?J.jsxDEV(oZ,{name:_,token:Q,who:Z,scope:w},void 0,!1,void 0,this):null,G.tab==="remote"?J.jsxDEV(NF,{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"?J.jsxDEV(fF,{name:_,token:Q,admin:C,canWrite:B,refused:N,onRemoved:f,only:G.tab},void 0,!1,void 0,this):null,G.tab==="vault"?J.jsxDEV(wF,{name:_,token:Q,canWrite:B,refused:N},void 0,!1,void 0,this):null,G.tab==="appearance"?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("h3",{className:"settings-head",children:"Appearance"},void 0,!1,void 0,this),J.jsxDEV(EZ,{},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),J.jsxDEV(M0,{open:G?.kind==="branches",onClose:()=>m(["changes"])(),title:"Branches",wide:!0,children:G?.kind==="branches"?J.jsxDEV(qF,{name:_,token:Q,canWrite:B,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 R8({text:_}){return J.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 v8=(_)=>`${_.url.replace(/\/+$/,"")}/${_.namespace}`,_F=(_)=>_.filter((Q)=>Q.applied===null||Q.applied.outcome==="refused"),QF=(_,Q=4)=>{let $=[..._].filter((q)=>q.count>0).sort((q,U)=>U.count-q.count);return $.length?$.slice(0,Q).map((q)=>g1(q.count,q.type.replace(/^_+/,""))).join(" · ")+($.length>Q?` · +${$.length-Q} more`:""):"nothing yet"},TQ=J.jsxDEV("svg",{className:"branch-glyph",viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:J.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:$,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,M]=r.useState(!1),B=$.state==="ok"?$.data:null,N=async(C,f,S)=>{M(!0),W(null);try{let w=await v1(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 y=await w.json();W({ok:!0,text:`${C} — the World is at ${new Date(y.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()})},T=(C,f)=>{N(`Advanced ${f}`,"clock/advance",{by:C})},O=[["1h","1 hour"],["1d","1 day"],["7d","1 week"],["30d","30 days"]];return J.jsxDEV("div",{className:`clock${B?.frozen?" frozen":""}`,role:"region","aria-label":"World clock",children:[J.jsxDEV("p",{className:"clock-now",children:$.state==="loading"?J.jsxDEV("span",{className:"mode",children:"clock…"},void 0,!1,void 0,this):$.state==="error"?J.jsxDEV("span",{className:"mode",children:["Clock: ",$.error]},void 0,!0,void 0,this):B.frozen?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("span",{className:"badge",children:"Simulation"},void 0,!1,void 0,this)," World time ",J.jsxDEV("strong",{children:J.jsxDEV(h1,{iso:B.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):J.jsxDEV(J.Fragment,{children:["World time ",J.jsxDEV("strong",{children:J.jsxDEV(h1,{iso:B.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",J.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?J.jsxDEV("details",{className:Z?"clock-more inline":"clock-more",open:Z||void 0,children:[J.jsxDEV("summary",{children:"Simulate time…"},void 0,!1,void 0,this),J.jsxDEV("div",{className:Z?void 0:"popover",children:[J.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),J.jsxDEV("div",{className:"clock-controls",children:[J.jsxDEV("button",{type:"button","aria-expanded":F,onClick:()=>{X(!F),K(L5(t_(B.at))),W(null)},children:"Set time…"},void 0,!1,void 0,this),J.jsxDEV("div",{role:"group","aria-label":"Advance the clock",className:"advance",children:[J.jsxDEV("span",{className:"mode",children:"Advance"},void 0,!1,void 0,this),O.map(([C,f])=>J.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:()=>T(C,f),children:f},C,!1,void 0,this)),J.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:[J.jsxDEV("label",{className:"sr",children:["Advance by ",J.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),J.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?J.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?J.jsxDEV("form",{className:"inline","aria-label":"Set the World time",onSubmit:A,noValidate:!0,children:[J.jsxDEV("label",{children:["World time ",J.jsxDEV("input",{name:"worldTime",type:"datetime-local",value:Y,min:L5(t_(B.at)),onChange:(C)=>K(C.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("span",{className:"mode",children:Intl.DateTimeFormat().resolvedOptions().timeZone},void 0,!1,void 0,this),J.jsxDEV("button",{type:"submit",disabled:I,children:"Set time"},void 0,!1,void 0,this),J.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?J.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:$,refused:q}){let[U,G]=r.useState(!1),[Z,F]=r.useState(""),[X,Y]=r.useState(null),[K,H]=r.useState(!1),L=$.state==="ok"?$.data.at:new Date().toISOString(),z=r.useRef(null);return r.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]),J.jsxDEV("div",{className:"as-of",ref:z,children:[J.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?J.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 v1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:M.toISOString()},ttl:3600})});if(!B.ok){q(B),Y(await z0(B));return}let N=await B.json();w8({name:N.name,parent:_,token:N.token,readToken:N.readToken,at:M.toISOString(),expiresAt:N.expiresAt??null,parentOrigin:k1,made:!0});let A=Q4(N.origin)?.origin;if(A&&A!==k1){S8(A,N.readToken,N.name,`${T1}/${N.name}`);return}V1(N.name.split("/"))}catch(B){Y(`the World did not answer: ${B instanceof Error?B.message:String(B)}`)}finally{H(!1)}},noValidate:!0,children:[J.jsxDEV("label",{children:["As of ",J.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),J.jsxDEV("button",{type:"submit",disabled:K,children:K?"Opening…":"Open snapshot"},void 0,!1,void 0,this),J.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?J.jsxDEV("p",{role:"alert",children:X},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function RQ({name:_,token:Q,open:$,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,M]=r.useState(""),[B,N]=r.useState("24"),[A,T]=r.useState(!0);r.useEffect(()=>{if($)K(null),M(L5(new Date().toISOString()))},[$]);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 v1(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(`${k1} did not answer`);return}if(!w.ok){G(w),K(await z0(w));return}let y=await w.json();w8({name:y.name,parent:_,token:y.token??"",readToken:y.readToken,at:(S??new Date).toISOString(),expiresAt:y.expiresAt??null,parentOrigin:k1,...y.origin?{origin:y.origin}:{}}),q(),L(""),l1(`Made ${Z(y.name)}`),U()};return J.jsxDEV(M0,{open:$,onClose:()=>{if(!F)q()},title:`New branch of ${Z(_)}`,footer:J.jsxDEV(J.Fragment,{children:[J.jsxDEV("button",{type:"button",onClick:()=>q(),disabled:F,children:"Cancel"},void 0,!1,void 0,this),J.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:J.jsxDEV("form",{id:"new-branch",onSubmit:(f)=>void O(f),className:"stack",children:[J.jsxDEV("label",{children:[J.jsxDEV("span",{children:["Label ",J.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.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),J.jsxDEV("fieldset",{className:"choice",children:[J.jsxDEV("legend",{children:"From"},void 0,!1,void 0,this),J.jsxDEV("label",{className:"check",children:[J.jsxDEV("input",{type:"radio",name:"branchWhen",checked:z==="now",onChange:()=>W("now")},void 0,!1,void 0,this)," ",J.jsxDEV("span",{children:"Now: the World as it is"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z==="now"?J.jsxDEV("label",{className:"check sub",children:[J.jsxDEV("input",{type:"checkbox",name:"branchLive",checked:A,onChange:(f)=>T(f.target.checked)},void 0,!1,void 0,this)," ",J.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,J.jsxDEV("label",{className:"check",children:[J.jsxDEV("input",{type:"radio",name:"branchWhen",checked:z==="at",onChange:()=>W("at")},void 0,!1,void 0,this)," ",J.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"?J.jsxDEV("input",{type:"datetime-local","aria-label":"As of",value:I,max:L5(new Date().toISOString()),onChange:(f)=>M(f.target.value)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),J.jsxDEV("label",{children:[J.jsxDEV("span",{children:"Goes away after"},void 0,!1,void 0,this),J.jsxDEV("select",{name:"branchLife",value:B,onChange:(f)=>N(f.target.value),children:[J.jsxDEV("option",{value:"1",children:"1 hour"},void 0,!1,void 0,this),J.jsxDEV("option",{value:"24",children:"1 day"},void 0,!1,void 0,this),J.jsxDEV("option",{value:"72",children:"3 days"},void 0,!1,void 0,this),J.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?J.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 qF({name:_,token:Q,canWrite:$,branches:q,opens:U,open:G,onChanged:Z,refused:F,snapshotOf:X}){let Y=u1(Q,`/-/${_}/clock`),K=(N)=>N.split("/").pop()??N,[H,L]=r.useState(!1),z=(N)=>(A)=>{A.preventDefault(),V1([..._.split("/"),"~","branches",...N?N.split("/"):[]])};if(!q)return J.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 g0({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 v1(Q,`/-/${_}/branches/${N}`,{method:"DELETE"}).catch((T)=>T);if(A instanceof Error){l1(`Remove ${K(N)}: the World did not answer (${A.message})`,"error");return}if(!A.ok){F(A),l1(`Remove ${K(N)}: ${await z0(A)}`,"error");return}_3(N),l1(`Removed ${K(N)}`),Z(),V1([..._.split("/"),"~","branches"])};if(G){let N=G.includes("/")?W.find((T)=>T.name===G):void 0,A=G.includes("/")?void 0:I.find((T)=>T.name===G);return J.jsxDEV(J.Fragment,{children:[J.jsxDEV("p",{className:"crumbs-line",children:J.jsxDEV("a",{href:`${T1}/${_}/~/branches`,onClick:z(),children:"← Branches"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV(F0,{load:q,what:"the branches"},void 0,!1,void 0,this),q.state==="ok"&&!N&&!A?J.jsxDEV("p",{className:"mode",children:["This World has no branch named ",G,"."]},void 0,!0,void 0,this):null,N?J.jsxDEV(UF,{name:_,b:N,canWrite:$,opens:U(N.name),remove:()=>void B(N.name)},void 0,!1,void 0,this):null,A&&!N?J.jsxDEV(GF,{name:_,token:Q,b:A,served:A.name===M,canWrite:$,canServe:q.state==="ok"&&Boolean(q.data.canServe)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}return J.jsxDEV("div",{"aria-labelledby":"branches",children:[J.jsxDEV("div",{className:"branches-head",children:[J.jsxDEV("p",{className:"lede",children:["Branch this World to look at it as it was, or to change it without touching ",J.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:J.jsxDEV(JF,{name:_,token:Q,clock:Y,refused:F},void 0,!1,void 0,this),J.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),J.jsxDEV(F0,{load:q,what:"the branches"},void 0,!1,void 0,this),q.state==="ok"?J.jsxDEV("div",{className:"block",children:J.jsxDEV("table",{className:"dense","aria-label":"Branches",children:[J.jsxDEV("thead",{children:J.jsxDEV("tr",{children:[J.jsxDEV("th",{id:"branches",children:"Branch"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Parent"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"As of"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Goes away"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("tbody",{children:[I.map((N)=>J.jsxDEV("tr",{children:[J.jsxDEV("td",{children:[J.jsxDEV("a",{href:`${T1}/${_}/~/branches/${N.name}`,onClick:z(N.name),children:J.jsxDEV("b",{children:N.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.name===M?J.jsxDEV(J.Fragment,{children:[" ",J.jsxDEV("span",{className:"badge live",children:"served here"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):N.running?null:J.jsxDEV(J.Fragment,{children:[" ",J.jsxDEV("span",{className:"badge",children:"stopped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),J.jsxDEV("td",{className:"mode",children:"live"},void 0,!1,void 0,this),J.jsxDEV("td",{className:"mode",children:"—"},void 0,!1,void 0,this),J.jsxDEV("td",{className:"mode",children:"kept"},void 0,!1,void 0,this)]},`own:${N.name}`,!0,void 0,this)),W.map((N)=>J.jsxDEV("tr",{children:[J.jsxDEV("td",{children:J.jsxDEV("a",{href:`${T1}/${_}/~/branches/${N.name}`,onClick:z(N.name),children:J.jsxDEV("b",{children:K(N.name)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{children:K(N.from??_)},void 0,!1,void 0,this),J.jsxDEV("td",{children:N.at?.instant?J.jsxDEV(h1,{iso:N.at.instant},void 0,!1,void 0,this):J.jsxDEV("span",{className:"mode",children:"live"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{children:J.jsxDEV(h1,{iso:N.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{children:N.expiresAt?J.jsxDEV(h1,{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,J.jsxDEV(RQ,{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 UF({name:_,b:Q,canWrite:$,opens:q,remove:U}){let G=(X)=>X.split("/").pop()??X,Z=f8(Q.name),F=u1(Z,Z?`/-/${Q.name}/diff`:null);return J.jsxDEV("div",{className:"branch-page",children:[J.jsxDEV("div",{className:"changeset-head",children:[J.jsxDEV("h3",{children:[TQ," ",G(Q.name)]},void 0,!0,void 0,this),J.jsxDEV("div",{className:"changeset-actions",children:[q?J.jsxDEV("button",{type:"button",className:"primary",onClick:()=>zQ(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),J.jsxDEV("div",{className:"block",children:J.jsxDEV("dl",{className:"fields pad",children:[J.jsxDEV("dt",{children:"Name"},void 0,!1,void 0,this),J.jsxDEV("dd",{children:J.jsxDEV("code",{children:Q.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("dt",{children:"Parent"},void 0,!1,void 0,this),J.jsxDEV("dd",{children:G(Q.from??_)},void 0,!1,void 0,this),J.jsxDEV("dt",{children:"As of"},void 0,!1,void 0,this),J.jsxDEV("dd",{children:Q.at?.instant?J.jsxDEV(h1,{iso:Q.at.instant},void 0,!1,void 0,this):"live: it keeps its parent's time"},void 0,!1,void 0,this),J.jsxDEV("dt",{children:"Made"},void 0,!1,void 0,this),J.jsxDEV("dd",{children:J.jsxDEV(h1,{iso:Q.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("dt",{children:"Goes away"},void 0,!1,void 0,this),J.jsxDEV("dd",{children:Q.expiresAt?J.jsxDEV(h1,{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?J.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"?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("h4",{children:"Its changes"},void 0,!1,void 0,this),F.data.changes.length===0?J.jsxDEV("p",{className:"mode",children:"Nothing written on it since it branched."},void 0,!1,void 0,this):J.jsxDEV(OF,{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 GF({name:_,token:Q,b:$,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 v1(Q,`/-/${_}/branches/${encodeURIComponent($.name)}/serve`,{method:"POST"}).catch(()=>null);if(H?.ok){location.reload();return}F(!1),Y(H?await z0(H):`${k1} did not answer`)};return J.jsxDEV("div",{className:"branch-page",children:[J.jsxDEV("div",{className:"changeset-head",children:[J.jsxDEV("h3",{children:[TQ," ",$.name," ",q?J.jsxDEV("span",{className:"badge live",children:"served here"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),J.jsxDEV("div",{className:"changeset-actions",children:U&&G&&!q?J.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),J.jsxDEV("div",{className:"block",children:J.jsxDEV("dl",{className:"fields pad",children:[J.jsxDEV("dt",{children:"Name"},void 0,!1,void 0,this),J.jsxDEV("dd",{children:J.jsxDEV("code",{children:$.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("dt",{children:"Kind"},void 0,!1,void 0,this),J.jsxDEV("dd",{children:"one of this World's own branches"},void 0,!1,void 0,this),J.jsxDEV("dt",{children:"State"},void 0,!1,void 0,this),J.jsxDEV("dd",{children:$.running?"running":"stopped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q?J.jsxDEV("p",{className:"mode",children:["This is the branch these pages show: its changes are on ",J.jsxDEV("a",{href:`${T1}/${_}/~/changes`,onClick:(H)=>{H.preventDefault(),V1([..._.split("/"),"~","changes"])},children:"Changes"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this):G?J.jsxDEV("p",{className:"mode",children:["“Serve here” stops this one's twins and serves ",$.name," in its place."]},void 0,!0,void 0,this):J.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?J.jsxDEV("p",{role:"alert",children:X},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var _Q=50,K5=(_)=>`${_.twin}:${_.position}`,OQ=(_,Q)=>Date.parse(Q.entry.occurredAt)-Date.parse(_.entry.occurredAt)||_.twin.localeCompare(Q.twin)||Q.position-_.position,Q3=(_)=>{if(!_)return"someone";if(_.startsWith("key:")){let[Q,$]=_.slice(4).split(" for:");return $?`${Q}, for ${$}`: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":_},e5=(_,Q)=>{let $=typeof Q==="string"?Q:typeof _.caller==="string"?_.caller:"";if($.startsWith("key:")&&$.length>4)return`by ${Q3($)}`;if($.startsWith("person:")&&$.length>7)return`by ${$.slice(7)}`;if($==="machine")return"by this machine";if($==="person")return"by a session with no name";if($==="key")return"by a key";if($==="token:read")return"by the read-only token";if($==="token")return"by the World's token";return _.actor?.kind==="system"?"by the vendor":_.actor?.id?`by ${_.actor.id}`:"by an app"},IQ=(_)=>_.operation??_.op;function ZF(_){let Q=_.fields??{},$=Q.usage!==null&&typeof Q.usage==="object"?Q.usage:Q,q=(...Y)=>Y.map((K)=>$[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 PQ({text:_,at:Q=280}){if(_.length<=Q)return J.jsxDEV("span",{className:"text",children:_},void 0,!1,void 0,this);return J.jsxDEV("details",{className:"folded",children:[J.jsxDEV("summary",{children:[J.jsxDEV("span",{className:"text",children:[_.slice(0,Q),"…"]},void 0,!0,void 0,this)," ",J.jsxDEV("span",{className:"mode",children:["show all ",_.length.toLocaleString()," characters"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("span",{className:"text",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Z2({v:_}){if(typeof _==="string")return J.jsxDEV(PQ,{text:_},void 0,!1,void 0,this);if(_===null||typeof _!=="object")return J.jsxDEV("code",{children:String(_)},void 0,!1,void 0,this);let Q=JSON.stringify(_,null,2);return Q.length<=160?J.jsxDEV("code",{children:JSON.stringify(_)},void 0,!1,void 0,this):J.jsxDEV("details",{className:"folded",children:[J.jsxDEV("summary",{children:J.jsxDEV("code",{children:[JSON.stringify(_).slice(0,120),"…"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("pre",{children:Q},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var FF=(_)=>typeof _==="string"?_:Array.isArray(_)?_.map((Q)=>Q&&typeof Q==="object"&&typeof Q.text==="string"?Q.text:"").filter(Boolean).join(`
|
|
36
|
+
`):JSON.stringify(_??"");function HF({body:_}){if(_===null||typeof _!=="object"||Array.isArray(_))return J.jsxDEV(Z2,{v:_},void 0,!1,void 0,this);let Q=_,$=Array.isArray(Q.messages)?Q.messages:null,q=Object.entries(Q).filter(([U])=>!($&&U==="messages"));return J.jsxDEV(J.Fragment,{children:[q.length?J.jsxDEV("dl",{className:"fields",children:q.map(([U,G])=>J.jsxDEV(r.default.Fragment,{children:[J.jsxDEV("dt",{children:U},void 0,!1,void 0,this),J.jsxDEV("dd",{children:J.jsxDEV(Z2,{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:$.map((U,G)=>J.jsxDEV("li",{children:[J.jsxDEV("span",{className:"role",children:typeof U.role==="string"?U.role:"message"},void 0,!1,void 0,this),J.jsxDEV(PQ,{text:FF(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 NQ({fields:_}){let Q=Object.entries(_??{});if(Q.length===0)return J.jsxDEV("p",{className:"mode",children:"No fields."},void 0,!1,void 0,this);return J.jsxDEV("dl",{className:"fields",children:Q.map(([$,q])=>J.jsxDEV(r.default.Fragment,{children:[J.jsxDEV("dt",{children:$},void 0,!1,void 0,this),J.jsxDEV("dd",{children:J.jsxDEV(Z2,{v:q},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},$,!0,void 0,this))},void 0,!1,void 0,this)}var XF=(_)=>_.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 KF(_){let Q=new Map,$=[],q=[],U=new Map;for(let G of _){if(G.entry.landsId||G.entry.aliasOf){q.push(G);continue}let Z={...G,copies:[]};if($.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 $.push({...G,copies:[]})}return $.sort(OQ)}var O8={deployed:5,confirmed:4,landed:3,replayed:2,skipped:1};function QQ(_){let Q=[_.entry.receipt,..._.copies.map((U)=>U.entry.receipt)].filter((U)=>Boolean(U?.status));if(Q.length===0)return null;let $=Q.find((U)=>U.status==="failed"||U.status==="refused"),q=[...Q].sort((U,G)=>(O8[G.status]??0)-(O8[U.status]??0))[0];return $&&!(O8[q.status]>=5)?{status:$.status,bad:!0}:{status:q.status,bad:!1}}var k0=1280,p0=820,n4=160,P0=72,P8=120,YF=72,$3="This World shows its branches' sites only on this machine.",b1=a_,A2=(_)=>b1({..._,id:`section:${_.section.id}`}),LF=(_)=>({first:_.flatMap((Q)=>Q.browser?[Q.browser]:[]).sort()[0],frames:new Set(_.filter((Q)=>!Q.browser).map(b1)),sections:new Set(_.filter((Q)=>!Q.browser).flatMap((Q)=>[Q.section.id,...Q.section.aka??[]].map(($)=>`${Q.vendor}:section:${$}`)))}),J2=(_,Q)=>{let $=`${_.vendor}:${_.id}`;return _.browser===Q.first&&!Q.frames.has($)?[b1(_),$]:[b1(_)]},Y5=(_,Q)=>[...new Set([_.section.id,..._.section.aka??[]].flatMap(($)=>{let q=b1({..._,id:`section:${$}`}),U=`${_.vendor}:section:${$}`;return _.browser===Q.first&&!Q.sections.has(U)?[q,U]:[q]}))],U3=(_,Q)=>Q.at&&("site"in Q.at)?Q.at.site:Q.at?`${c0}/${_}/${Q.vendor}${Q.at.screen}`:null,wQ=(_,Q,$)=>$.at&&("screen"in $.at)?`${c0}/-/${_}/branches/${Q}/pages?${new URLSearchParams({land:`/${Q}/${$.vendor}${$.at.screen}`}).toString()}`:U3(Q,$),$Q=(_,Q,$)=>_.include?Q.filter((q)=>J2(q,$).some((U)=>_.include.includes(U))||Y5(q,$).some((U)=>_.include.includes(U))):Q.filter((q)=>!J2(q,$).some((U)=>(_.hidden??[]).includes(U)));function zF({data:_}){let{aliases:Q,frame:$,url:q,active:U,picked:G,boards:Z,addTo:F,remove:X,compare:Y,grab:K,branch:H}=_,L=b1($),z=r.useRef(null),W=Z.filter((M)=>M.include&&!J2($,Q).some((B)=>M.include.includes(B))&&!Y5($,Q).some((B)=>M.include.includes(B))),I=S1((M)=>M.transform[2]*(P0+P8)>=YF);return J.jsxDEV(J.Fragment,{children:[J.jsxDEV(z8,{isVisible:I||G||U,position:H1.Top,align:"start",className:"frame-label",children:[J.jsxDEV("span",{className:"frame-name",onPointerDown:K,children:[J.jsxDEV(d1,{vendor:$.vendor},void 0,!1,void 0,this),J.jsxDEV("span",{children:$.title},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.changes?J.jsxDEV("button",{type:"button",className:"frame-changed nodrag",onClick:()=>Y(L),title:`${g1($.changes,"change")} ${H?"on this branch":"here, not in a changeset"}: compare`,children:[J.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),$.changes]},void 0,!0,void 0,this):G?J.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>Y(L),title:"Compare with a branch of this World","aria-label":`Compare ${$.title} with a branch`,children:J.jsxDEV(w1,{name:"file-diff",size:14},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,G&&W.length?J.jsxDEV("select",{className:"nodrag frame-add",value:"","aria-label":`Add ${$.title} to a board`,onChange:(M)=>{if(M.target.value)F(M.target.value,L)},children:[J.jsxDEV("option",{value:"",children:"Add to board…"},void 0,!1,void 0,this),W.map((M)=>J.jsxDEV("option",{value:M.id,children:M.name},M.id,!1,void 0,this))]},void 0,!0,void 0,this):null,G&&X?J.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>X.act(L),title:X.label,"aria-label":X.label,children:"✕"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),J.jsxDEV("div",{className:U?"frame on":G?"frame picked":"frame",style:{width:k0,height:p0},children:[J.jsxDEV("div",{className:"frame-bar",children:[J.jsxDEV(d1,{vendor:$.vendor},void 0,!1,void 0,this),J.jsxDEV("strong",{children:[$.browser?`${$.browser} · `:"",M1($.vendor)," · ",$.kind]},void 0,!0,void 0,this),J.jsxDEV("span",{className:"frame-url",children:$.url.replace(/^https?:\/\//,"")},void 0,!1,void 0,this),q?J.jsxDEV("a",{className:"nodrag",href:q,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${$.title} in a new tab`,children:"↗"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),J.jsxDEV("div",{className:U?"frame-body nodrag nopan nowheel":"frame-body",children:q?J.jsxDEV("iframe",{ref:z,title:$.title,src:q,loading:"lazy",style:{pointerEvents:U?"auto":"none"}},void 0,!1,void 0,this):J.jsxDEV("div",{className:"frame-none",children:[J.jsxDEV("p",{children:J.jsxDEV("strong",{children:$.unseen==="branch-sites"?$3:$.unseen==="sites-not-routed"?`This World shows ${$.title} only at its own local address.`:`${M1($.vendor)}'s twin draws no page for this ${$.kind} yet.`},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("p",{className:"mode",children:$.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 fQ({name:_,label:Q,done:$}){let q=r.useRef(!1),U=(G)=>{if(q.current)return;q.current=!0,$(G?.trim()&&G.trim()!==_?G.trim().slice(0,80):null)};return J.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 WF({data:_}){return J.jsxDEV(J.Fragment,{children:[J.jsxDEV(E_,{isVisible:_.picked&&_.editable,minWidth:480,minHeight:360,color:"var(--accent)",onResizeEnd:_.resized},void 0,!1,void 0,this),J.jsxDEV(z8,{isVisible:!0,position:H1.Top,align:"start",offset:-30,className:"section-tag",children:[_.renaming?J.jsxDEV(fQ,{name:_.name,label:"Name this section",done:(Q)=>_.renamed(_.key,Q)},void 0,!1,void 0,this):J.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?J.jsxDEV(d1,{vendor:_.vendor},void 0,!1,void 0,this):null,J.jsxDEV("span",{children:_.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.picked&&_.editable&&!_.renaming?J.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),J.jsxDEV("div",{className:_.picked?"section-box on":"section-box"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function JQ({url:_,title:Q}){return J.jsxDEV("div",{className:"compare-thumb",style:{width:420,height:420*p0/k0},children:J.jsxDEV("iframe",{title:Q,src:_,loading:"lazy",style:{width:k0,height:p0,transform:`scale(${420/k0})`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function BF({name:_,token:Q,frame:$,onClose:q,reads:U,viewing:G=""}){let[Z,F]=r.useState(G?"world":$.since?"before":""),[X,Y]=r.useState({state:"opening"}),[K,H]=r.useState(null),L=r.useRef(new Set),z=u1(Q,`/-/${_}/branches`,U),W=z.state==="ok"?z.data.branches.filter((O)=>O.name!==G&&O.name!==K&&!L.current.has(O.name)):[],I=u1(Q,G?`/-/${_}/board`:null,U),M=I.state==="ok"?I.data.frames.find((O)=>b1(O)===b1($)):void 0,B=u1(Q,`/-/${_}/${G?`branches/${G}/`:""}board/changes?frame=${encodeURIComponent(b1($))}`,U),N=async(O,C,f)=>{let S=$.at;if("site"in S){let D=new URL($.url),c=C&&/^https?:\/\/\{host\}\./.test(C)?C.replace("{host}",D.hostname.toLowerCase()):null;return c?{url:`${c}${D.pathname}${D.search}`}:{why:$3}}let w=`${c0}/-/${_}/branches/${O}/pages?${new URLSearchParams({land:`/${O}/${$.vendor}${S.screen}`}).toString()}`,y=await fetch(w,{credentials:"same-origin",redirect:"manual"}).catch(()=>null);if(f())return{why:""};return y?.type==="opaqueredirect"?{url:w}:{why:`This World does not show its branches' pages${y?`: ${await z0(y)}`:""}.`}};r.useEffect(()=>{if(Z==="world"){if(I.state==="loading"){Y({state:"opening"});return}let D=M?U3(_,M):null;Y(D?{state:"ok",url:D}:{state:"none",why:I.state==="error"?I.error:"The World has no page here to show."});return}if(!$.at){Y({state:"none",why:$.unseen==="branch-sites"?$3:`${M1($.vendor)}'s twin draws no page for this ${$.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 D=z.state==="ok"?z.data.branches.find((l)=>l.name===Z):void 0,c=setTimeout(()=>void N(Z,D?.sites??null,()=>O).then((l)=>{if(!O)Y("url"in l?{state:"ok",url:l.url}:{state:"none",why:l.why})}),300);return()=>{O=!0,clearTimeout(c)}}if(!$.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($.since)-1).toISOString(),f=null,S=setTimeout(()=>void(async()=>{let D=await v1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:C},ttl:3600}),signal:AbortSignal.timeout(60000)}).catch(()=>null);if(!D?.ok){Y({state:"none",why:`The World made no copy of itself as it was then${D?`: ${await z0(D)}`:""}.`});return}let c=await D.json();if(f=c.name,H(c.name),L.current.add(c.name),O){v1(Q,`/-/${_}/branches/${c.name}`,{method:"DELETE"}).catch(()=>null);return}let l=await N(c.name,c.sites??null,()=>O);if(!O)Y("url"in l?{state:"ok",url:l.url,at:C}:{state:"none",why:l.why})})(),500),w=()=>{if(f)v1(Q,`/-/${_}/branches/${f}`,{method:"DELETE",keepalive:!0}).catch(()=>null);f=null},y=(D)=>{if(!D.persisted)w()};return window.addEventListener("pagehide",y),()=>{O=!0,clearTimeout(S),window.removeEventListener("pagehide",y),w(),H(null)}},[_,Q,$.vendor,$.id,$.since,Z,I.state,JSON.stringify(M?.at)]);let A=G?wQ(_,G,$):U3(_,$),T=!$.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 J.jsxDEV("div",{className:"compare",role:"dialog","aria-label":`Changes to ${$.title}`,children:[J.jsxDEV("div",{className:"compare-head",children:[J.jsxDEV(d1,{vendor:$.vendor},void 0,!1,void 0,this),J.jsxDEV("strong",{children:$.title},void 0,!1,void 0,this),J.jsxDEV("span",{className:"mode",children:$.changes?`${g1($.changes,"change")} ${G?"on this branch":"not yet cut"}${$.since?`, since ${x2($.since)}`:""}`:G?"No changes here on this branch":"No changes here not yet cut"},void 0,!1,void 0,this),$.at?J.jsxDEV("label",{className:"compare-base",children:["Compare with"," ",J.jsxDEV("select",{value:Z,onChange:(O)=>F(O.target.value),children:[Z===""?J.jsxDEV("option",{value:"",children:"Choose a branch…"},void 0,!1,void 0,this):null,G?J.jsxDEV("option",{value:"world",children:"The World"},void 0,!1,void 0,this):null,!G&&($.since||Z==="before")?J.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)?J.jsxDEV("option",{value:Z,children:Z.split("/")[1]},void 0,!1,void 0,this):null,W.map((O)=>J.jsxDEV("option",{value:O.name,children:[O.name.split("/")[1],O.at?.label?` (${O.at.label})`:O.at?.instant?` (as of ${x2(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,J.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),J.jsxDEV("div",{className:"compare-sides",children:[J.jsxDEV("figure",{children:[J.jsxDEV("figcaption",{children:Z==="before"?`Before${X.state==="ok"&&X.at?` · as of ${x2(X.at)}`:""}`:Z==="world"?"The World":Z?Z.split("/")[1]:"A branch"},void 0,!1,void 0,this),T?J.jsxDEV("p",{className:"mode compare-note",children:T},void 0,!1,void 0,this):X.state==="ok"?J.jsxDEV(JQ,{url:X.url,title:`${$.title} before`},void 0,!1,void 0,this):X.state==="opening"?J.jsxDEV("p",{className:"mode compare-note",role:"status",children:"Opening the World as it was…"},void 0,!1,void 0,this):J.jsxDEV("p",{className:"mode compare-note",children:X.why},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("figure",{children:[J.jsxDEV("figcaption",{children:G?`${G.split("/")[1]} · branch`:"Now"},void 0,!1,void 0,this),A?J.jsxDEV(JQ,{url:A,title:`${$.title} now`},void 0,!1,void 0,this):J.jsxDEV("p",{className:"mode compare-note",children:$.unseen==="branch-sites"?$3:`${M1($.vendor)}'s twin draws no page for this ${$.kind} yet.`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),B.state==="error"?J.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?J.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,J.jsxDEV("ol",{className:"compare-acts",children:(B.state==="ok"?B.data.acts:[]).map((O)=>{let C=O.entries[0],f=N0({...C,service:$.vendor,id:"",occurredAt:O.at});return J.jsxDEV("li",{children:[J.jsxDEV("span",{className:"mode",children:x2(O.at)},void 0,!1,void 0,this),J.jsxDEV("details",{children:[J.jsxDEV("summary",{children:[J.jsxDEV("strong",{children:f.what},void 0,!1,void 0,this),f.label?` · ${f.label}`:"",O.writes>1?J.jsxDEV("span",{className:"mode",children:[" and ",g1(O.writes-1,"more write")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),J.jsxDEV("ul",{children:[O.entries.map((S,w)=>J.jsxDEV("li",{children:[J.jsxDEV("code",{children:S.operation??S.op},void 0,!1,void 0,this)," ",J.jsxDEV("span",{className:"mode",children:[S.subject.type," ",G2(S)]},void 0,!0,void 0,this)]},w,!0,void 0,this)),O.writes>O.entries.length?J.jsxDEV("li",{className:"mode",children:["and ",g1(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?J.jsxDEV("p",{className:"mode",children:["and ",g1(B.data.total-B.data.acts.length,"earlier change"),", in Changes"]},void 0,!0,void 0,this):null,!G?J.jsxDEV("a",{className:"compare-all",href:`${T1}/${_}/~/changes`,onClick:(O)=>{O.preventDefault(),V1([..._.split("/"),"~","changes"])},children:"Every change in the World →"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var AF={screen:zF,section:WF};function MF(_){let[Q,$]=r.useState(()=>new URLSearchParams(window.location.search).get("viewing")??"");return r.useEffect(()=>{let U=()=>$(new URLSearchParams(window.location.search).get("viewing")??"");return window.addEventListener("popstate",U),()=>window.removeEventListener("popstate",U)},[]),J.jsxDEV(L8,{children:J.jsxDEV(TF,{..._,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 TF({name:_,token:Q,session:$,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"}),[M,B]=r.useState(null),[N,A]=r.useState(0),T=u1(Q,`/-/${_}/branches`,N),O=T.state==="ok"?T.data.branches.find((k)=>k.name===F):void 0,C=T.state==="ok"?T.data.branches.filter((k)=>!(k.at?.instant&&k.expiresAt&&!k.at.label)):[],f=r.useRef(0),S=r.useRef(0),w=r.useCallback(async()=>{let k=L.current,d=++f.current,U1=F?`branches/${F.split("/").map(encodeURIComponent).join("/")}/board`:"board",[G1,C1]=await Promise.all([v1(Q,`/-/${_}/${U1}`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),F?v1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null):Promise.resolve(null)]),F1=G1?.ok?await G1.json().catch(()=>null):null,z1=F?C1?.ok?await C1.json().catch(()=>null):null:F1;if(F1&&z1)F1.boards=z1.boards,F1.version=z1.version;if(d<S.current)return;if(S.current=d,!F1?.frames||!z1?.boards||!z1.version){let B1=!G1?.ok?G1:C1,P1=B1?`the World answered ${B1.status}`:"the World did not answer";I((p1)=>p1.state==="ok"?p1:{state:"error",status:B1?.status??0,error:P1}),B(P1);return}if(B(null),A((B1)=>B1+1),k===L.current&&K.current===0)Y.current={boards:F1.boards,version:F1.version};I({state:"ok",data:F1})},[Q,_,F]);r.useEffect(()=>{w();let k=setInterval(()=>{if(!document.hidden)w()},1e4);return()=>clearInterval(k)},[w]);let y=W.state==="ok"?W.data.frames.map((k)=>F&&(k.browser||k.at&&("site"in k.at)&&!/^https?:\/\/\{host\}\./.test(O?.sites??""))?{...k,at:null,unseen:"branch-sites"}:k):[],D=LF(y),c=Y.current?.boards??[{id:"everything",name:"Everything"}],[l,v]=r.useState(null),x=y.some((k)=>k.changes),b=l??(x?"changes":"everything"),j=(b==="changes"?c[0]:c.find((k)=>k.id===b))??c[0],[V,m]=r.useState(new Set),P=Z&&!U&&!F,u=r.useCallback((k)=>{if(!P)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:k(Y.current.boards)},K.current+=1,L.current+=1,z((U1)=>U1+1);let d=H.current.then(async()=>{let U1=Y.current;if(!U1)return;try{let G1=await v1(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 v1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),F1=C1?.ok?await C1.json().catch(()=>null):null;if(F1?.boards&&F1.version)Y.current={boards:F1.boards,version:F1.version}}}).finally(()=>{if(K.current-=1,L.current+=1,z((U1)=>U1+1),K.current===0&&!Y.current)w()});return H.current=d,d},[Q,_,w,P]),E=(k,d)=>{u((U1)=>U1.map((G1)=>G1.id===k?d(G1):G1))},h=(k)=>k.parent?b1({...k,id:k.parent}):null,o=new Set(y.map(b1)),$1=(k)=>{let d=h(k);return!d||!o.has(d)},i=b==="changes"?y.filter((k)=>k.changes):j.include?$Q(j,y,D):$Q(j,y,D).filter((k)=>$1(k)||V.has(h(k))),t=y.filter((k)=>k.changes&&!i.includes(k)).reduce((k,d)=>k+d.changes,0),[p,n]=r.useState(null),[Q1,J1]=r.useState(null),[Z1,L1]=r.useState(null),K1=s5(),W1=c.filter((k)=>k.include),e=(k,d)=>E(k,(U1)=>({...U1,include:[...U1.include??[],d]})),R1=(k,d)=>{let U1=y.find((G1)=>b1(G1)===k);return U1?J2(U1,D).find((G1)=>d.includes(G1))??k:k},X1={label:j.include?"Take it off this board":"Hide it",act:(k)=>{J1(null),E(j.id,(d)=>d.include?{...d,include:d.include.filter((U1)=>U1!==R1(k,d.include))}:{...d,hidden:[...d.hidden??[],k]})}},y1=(k)=>({x:k.position.x,y:k.position.y,w:k.width??k.measured?.width??k0,h:k.height??k.measured?.height??p0}),e1=(k,d)=>{let U1=y1(k),G1=U1.x+U1.w/2,C1=U1.y+U1.h/2;return d.filter((F1)=>F1.type==="section").map((F1,z1)=>({s:F1,i:z1})).filter(({s:F1})=>{let z1=y1(F1);return G1>=z1.x&&G1<=z1.x+z1.w&&C1>=z1.y&&C1<=z1.y+z1.h}).sort((F1,z1)=>y1(F1.s).w*y1(F1.s).h-y1(z1.s).w*y1(z1.s).h||z1.i-F1.i)[0]?.s},o1=r.useCallback(()=>{let k=new Map;for(let B1 of i){let P1=J2(B1,D).map((p1)=>j.placed?.[p1]).find(Boolean);if(P1)k.set(b1(B1),P1)}let d=Math.max(-n4,...[...k.values()].map((B1)=>B1.y+p0)),U1=[...new Set(i.map(A2))];for(let B1 of U1){let P1=i.filter((D1)=>A2(D1)===B1),p1=P1.filter((D1)=>k.has(b1(D1))).map((D1)=>k.get(b1(D1))),N1=p1.length?Math.max(...p1.map((D1)=>D1.x))+k0+n4:0,r1=p1.length?Math.min(...p1.map((D1)=>D1.y)):d+n4+P0*2+P8;for(let D1 of P1)if(!k.has(b1(D1)))k.set(b1(D1),{x:N1,y:r1}),N1+=k0+n4;d=Math.max(d,r1+p0)}let G1=j.sections??{},C1=(B1,P1,p1,N1,r1)=>({id:`sec:${B1}`,type:"section",position:{x:P1.x,y:P1.y},width:P1.w,height:P1.h,zIndex:0,draggable:P,data:{key:B1,name:p1,vendor:N1,named:r1}}),F1=[];for(let B1 of U1){let P1=i.find((E1)=>A2(E1)===B1),p1=Y5(P1,D).find((E1)=>G1[E1])??B1,N1=G1[p1];if(N1?.gone)continue;let r1=i.filter((E1)=>A2(E1)===B1).map((E1)=>k.get(b1(E1))),D1={x:Math.min(...r1.map((E1)=>E1.x))-P0,y:Math.min(...r1.map((E1)=>E1.y))-P0-P8,w:0,h:0};D1.w=Math.max(...r1.map((E1)=>E1.x))+k0+P0-D1.x,D1.h=Math.max(...r1.map((E1)=>E1.y))+p0+P0-D1.y;let B5=i.filter((E1)=>A2(E1)===B1&&!J2(E1,D).some((H3)=>j.placed?.[H3])).map((E1)=>k.get(b1(E1))),B0=N1?{...N1}:D1;if(N1)for(let E1 of B5)B0.w=Math.max(B0.w,E1.x+k0+P0-B0.x),B0.h=Math.max(B0.h,E1.y+p0+P0-B0.y);F1.push(C1(B1,B0,N1?.name??`${P1.browser?`${P1.browser} · `:""}${M1(P1.vendor)} · ${P1.section.title}`,P1.vendor,Boolean(N1?.name)))}for(let[B1,P1]of Object.entries(G1))if(B1.startsWith("user:")&&!P1.gone)F1.push(C1(B1,P1,P1.name??"Section",null,!0));let z1=i.map((B1)=>({id:b1(B1),type:"screen",zIndex:1,width:k0,height:p0,draggable:P,position:k.get(b1(B1)),data:{aliases:D,world:_,branch:Boolean(F),frame:B1,url:F?wQ(_,F,B1):U3(_,B1)}}));return[...F1,...z1]},[JSON.stringify(i),JSON.stringify(j),_,P,F]),[W0,J0,w0]=k_([]),_0=S1((k)=>k.transform[2]),X0=r.useRef("");r.useEffect(()=>{let k=o1();if(J0(k),k.length&&X0.current!==b)X0.current=b,requestAnimationFrame(()=>{K1.fitView({padding:{top:"72px",left:"272px",right:"40px",bottom:"72px"},duration:0})})},[o1,J0]);let q0=(k,d=[],U1={})=>{let G1=Object.fromEntries(d.map((F1)=>{let z1=K1.getNode(`sec:${F1}`);if(!z1)return[F1,void 0];let B1=y1(z1),P1=z1.data,p1=U1[F1]??(P1.named?P1.name:void 0);return[F1,{x:Math.round(B1.x),y:Math.round(B1.y),w:Math.round(B1.w),h:Math.round(B1.h),...p1?{name:p1.slice(0,80)}:{}}]}).filter(([,F1])=>F1!==void 0)),C1=Object.fromEntries(Object.entries(k).map(([F1,z1])=>[F1,{x:Math.round(z1.x),y:Math.round(z1.y)}]));E(j.id,(F1)=>({...F1,placed:{...F1.placed??{},...C1},sections:{...F1.sections??{},...G1}}))},U0=r.useRef(null),l0=(k,d)=>{if(d.type!=="section"){U0.current=null;return}let U1=K1.getNodes(),G1=y1(d),C1=(F1)=>{let z1=y1(F1);if(F1.type==="screen"){let B1=z1.x+z1.w/2,P1=z1.y+z1.h/2;return B1>=G1.x&&B1<=G1.x+G1.w&&P1>=G1.y&&P1<=G1.y+G1.h}return F1.id!==d.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};U0.current={id:d.id,from:{...d.position},members:U1.filter(C1).map((F1)=>({id:F1.id,x:F1.position.x,y:F1.position.y}))}},f0=(k,d)=>{let U1=U0.current;if(!U1||U1.id!==d.id)return;let G1=d.position.x-U1.from.x,C1=d.position.y-U1.from.y,F1=new Map(U1.members.map((z1)=>[z1.id,z1]));J0((z1)=>z1.map((B1)=>{let P1=F1.get(B1.id);return P1?{...B1,position:{x:P1.x+G1,y:P1.y+C1}}:B1}))},r0=(k,d)=>{let U1=U0.current;U0.current=null;let G1=d.position.x-(U1?.from.x??d.position.x),C1=d.position.y-(U1?.from.y??d.position.y),F1=d.type==="screen"?[{id:d.id,x:d.position.x,y:d.position.y}]:(U1?.members??[]).map((z1)=>({...z1,x:z1.x+G1,y:z1.y+C1}));requestAnimationFrame(()=>{let z1=K1.getNodes(),B1=new Map(F1.filter((N1)=>!N1.id.startsWith("sec:")).map((N1)=>[N1.id,{x:N1.x,y:N1.y}])),P1=new Set([...d.type==="section"?[d.data.key]:[],...F1.filter((N1)=>N1.id.startsWith("sec:")).map((N1)=>N1.id.slice(4))]),p1=new Set(z1.filter((N1)=>B1.has(N1.id)).map((N1)=>A2(N1.data.frame)));for(let N1 of z1){if(N1.type==="screen"&&Y5(N1.data.frame,D).some((r1)=>p1.has(r1))&&!B1.has(N1.id))B1.set(N1.id,{x:N1.position.x,y:N1.position.y});if(N1.type==="section"&&p1.has(N1.data.key))P1.add(N1.data.key)}q0(Object.fromEntries(B1),[...P1])})},i0=(k)=>Object.fromEntries(K1.getNodes().filter((d)=>d.type==="screen"&&Y5(d.data.frame,D).includes(k)).map((d)=>[d.id,{x:d.position.x,y:d.position.y}])),[F2,d0]=r.useState(null),V0=(k)=>{J1(`sec:${k}`),d0(k)},R=(k,d)=>{if(d0(null),!d)return;J0((U1)=>U1.map((G1)=>G1.id===`sec:${k}`?{...G1,data:{...G1.data,name:d,named:!0}}:G1)),requestAnimationFrame(()=>q0(i0(k),[k],{[k]:d}))},g=(k)=>{J1(null);let d=K1.getNode(`sec:${k}`);E(j.id,(U1)=>{let G1=Object.fromEntries(Object.entries(U1.sections??{}).filter(([C1])=>C1!==k));return{...U1,sections:k.startsWith("user:")?G1:{...G1,[k]:{...d?{x:Math.round(d.position.x),y:Math.round(d.position.y),w:Math.round(y1(d).w),h:Math.round(y1(d).h)}:{x:0,y:0,w:0,h:0},gone:!0}}}})},_1=()=>{let k=Q1?K1.getNode(Q1):void 0,d=K1.screenToFlowPosition({x:window.innerWidth/2,y:window.innerHeight/2}),U1=k?.type==="screen"?{x:k.position.x-P0,y:k.position.y-P0,w:k0+P0*2,h:p0+P0*2}:{x:d.x-900,y:d.y-600,w:1800,h:1200},G1=`user:${Date.now().toString(36)}`,C1=Object.keys(j.sections??{}).filter((F1)=>F1.startsWith("user:")).length+1;J1(`sec:${G1}`),E(j.id,(F1)=>({...F1,sections:{...F1.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}`}}}))},q1=(k)=>(d)=>{if(!P||d.button!==0)return;let U1=K1.getNode(k);if(!U1)return;let G1=d.currentTarget;G1.setPointerCapture(d.pointerId);let{clientX:C1,clientY:F1}=d,z1={...U1.position},B1=!1,P1=(r1)=>{let D1=K1.getZoom();return{...U1,position:{x:z1.x+(r1.clientX-C1)/D1,y:z1.y+(r1.clientY-F1)/D1}}},p1=(r1)=>{if(!B1&&Math.hypot(r1.clientX-C1,r1.clientY-F1)<4)return;if(!B1)B1=!0,l0(null,U1);let D1=P1(r1);J0((B5)=>B5.map((B0)=>B0.id===k?{...B0,position:D1.position}:B0)),f0(null,D1)},N1=(r1)=>{if(G1.removeEventListener("pointermove",p1),G1.removeEventListener("pointerup",N1),G1.removeEventListener("pointercancel",N1),B1)r0(null,P1(r1)),G1.addEventListener("click",(D1)=>{D1.stopPropagation(),D1.preventDefault()},{capture:!0,once:!0});else if(U1.type==="screen")J1(k)};G1.addEventListener("pointermove",p1),G1.addEventListener("pointerup",N1),G1.addEventListener("pointercancel",N1)},Y1=W0.map((k)=>k.type==="section"?{...k,data:{...k.data,grab:q1(k.id),picked:Q1===k.id,editable:P,renaming:P&&F2===k.data.key,pick:(d)=>J1(`sec:${d}`),rename:V0,renamed:R,remove:g,resized:()=>requestAnimationFrame(()=>{let d=k.data.key;q0(i0(d),[d])})}}:{...k,data:{...k.data,grab:q1(k.id),active:p===k.id,picked:Q1===k.id,boards:P?W1:[],addTo:e,remove:!P||j.include&&!J2(k.data.frame,D).some((d)=>j.include.includes(d))?null:X1,compare:(d)=>{J1(d),L1(d)}}});r.useEffect(()=>{let k=(d)=>{if(d.target?.closest("input, textarea, select, [contenteditable]"))return;if(d.key==="Escape"){if(p)n(null);else J1(null);return}if(!P||p)return;if((d.key==="Delete"||d.key==="Backspace")&&Q1){if(d.preventDefault(),Q1.startsWith("sec:"))g(Q1.slice(4));else if(!j.include||y.some((U1)=>b1(U1)===Q1&&J2(U1,D).some((G1)=>j.include.includes(G1))))X1.act(Q1);else l1("It is on this board with its whole group: take the group off in the list to remove it","error");return}if(d.key==="S"&&d.shiftKey&&!d.metaKey&&!d.ctrlKey)d.preventDefault(),_1()};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)});let I1=(k)=>{J1(k);let d=K1.getNode(k);if(!d)return;let U1=y1(d);K1.fitBounds({x:U1.x,y:U1.y,width:U1.w,height:U1.h},{padding:0.15,duration:400})},O1=()=>{let k=`board-${Date.now().toString(36)}`;v(k),u((d)=>[...d,{id:k,name:`Board ${d.length}`,include:[]}])},j1=()=>d0(`board:${j.id}`),f1=()=>{let k=j.id;v(null),u((d)=>d.filter((U1)=>U1.id!==k))},T0=[...new Map(y.map((k)=>[A2(k),k])).values()],C0=j.include?[...T0.filter((k)=>!Y5(k,D).some((d)=>j.include.includes(d))).map((k)=>({key:A2(k),label:`${k.browser?`${k.browser} · `:""}${M1(k.vendor)} · ${k.section.title} (all)`})),...y.filter((k)=>!i.includes(k)).map((k)=>({key:b1(k),label:`${k.browser?`${k.browser} · `:""}${k.title}`}))]:[],R2=j.include?[]:y.filter((k)=>J2(k,D).some((d)=>(j.hidden??[]).includes(d))),z5=W0.filter((k)=>k.type==="section"),W5=W0.filter((k)=>k.type==="screen"),J4=new Map(W5.map((k)=>[k.id,e1(k,W0)?.id??null])),r2=new Map;for(let k of y){let d=h(k);if(d&&o.has(d))r2.set(d,(r2.get(d)??0)+1)}let q4=(k)=>{let d=k.data.frame;return J.jsxDEV("li",{children:[J.jsxDEV("button",{type:"button",className:Q1===k.id?"on":void 0,onClick:()=>I1(k.id),onDoubleClick:()=>n(k.id),children:[J.jsxDEV(d1,{vendor:d.vendor},void 0,!1,void 0,this),J.jsxDEV("span",{children:d.title},void 0,!1,void 0,this),d.changes?J.jsxDEV("span",{className:"layer-changed",title:`${g1(d.changes,"change")} ${F?"on this branch":"not in a changeset"}: its mark on the board opens a comparison`,children:[J.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),d.changes]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),r2.get(k.id)&&b!=="changes"&&!j.include?J.jsxDEV("button",{type:"button",className:"ghost layer-open","aria-expanded":V.has(k.id),onClick:()=>m((U1)=>{let G1=new Set(U1);if(G1.has(k.id))G1.delete(k.id);else G1.add(k.id);return G1}),title:V.has(k.id)?"Close the pages under it":"Open the pages under it",children:[V.has(k.id)?"−":"+",r2.get(k.id)]},void 0,!0,void 0,this):null]},k.id,!0,void 0,this)},Z3=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,F3=$.state==="ok"&&W.state==="ok";return J.jsxDEV("div",{className:"canvas full",role:"region","aria-label":"The World's board",style:{"--zoom":_0},children:J.jsxDEV(y_,{nodes:F3?Y1:[],onNodesChange:w0,nodeTypes:AF,onNodeDragStart:l0,onNodeDrag:f0,onNodeDragStop:r0,onNodeClick:(k,d)=>{if(d.id!==p)J1(d.id)},onNodeDoubleClick:(k,d)=>{if(d.type==="screen")J1(d.id),n(d.id)},onPaneClick:()=>{n(null),J1(null)},minZoom:0.03,maxZoom:1.5,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnPinch:!0,zoomOnScroll:!1,zoomOnDoubleClick:!1,colorMode:Z3?"dark":"light",proOptions:{hideAttribution:!0},children:[J.jsxDEV(V_,{variant:x0.Dots,gap:28*2**Math.max(0,Math.ceil(Math.log2(16/(28*_0)))),size:2/_0},void 0,!1,void 0,this),J.jsxDEV(m0,{position:"top-left",className:"float layers",children:[J.jsxDEV("div",{className:"float-head",children:[J.jsxDEV("button",{type:"button",className:"back",onClick:G,"aria-label":`Back to ${_}`,children:"←"},void 0,!1,void 0,this),J.jsxDEV("span",{className:"float-title",children:[J.jsxDEV("strong",{children:(F||_).split("/")[1]},void 0,!1,void 0,this),J.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),J.jsxDEV("label",{className:"compare-base board-viewing",children:["Viewing",J.jsxDEV("select",{value:F,disabled:K.current>0,onChange:(k)=>X(k.target.value),children:[J.jsxDEV("option",{value:"",children:"The World"},void 0,!1,void 0,this),F&&!C.some((k)=>k.name===F)?J.jsxDEV("option",{value:F,children:[F," · branch"]},void 0,!0,void 0,this):null,C.map((k)=>J.jsxDEV("option",{value:k.name,children:[k.name.split("/")[1]," · branch"]},k.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T.state==="error"&&T.status!==404?J.jsxDEV("p",{className:"mode",role:"alert",children:["Branches could not be read: ",T.error]},void 0,!0,void 0,this):null,J.jsxDEV("div",{className:"board-tabs",role:"tablist","aria-label":"Boards",children:[J.jsxDEV("button",{type:"button",role:"tab","aria-selected":b==="changes",className:b==="changes"?"on":void 0,onClick:()=>{J1(null),n(null),v("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",x?` (${y.filter((k)=>k.changes).length})`:""]},void 0,!0,void 0,this),c.map((k)=>F2===`board:${k.id}`?J.jsxDEV(fQ,{name:k.name,label:"Name this board",done:(d)=>{if(d0(null),d)E(k.id,(U1)=>({...U1,name:d}))}},k.id,!1,void 0,this):J.jsxDEV("button",{type:"button",role:"tab","aria-selected":b!=="changes"&&k.id===j.id,className:b!=="changes"&&k.id===j.id?"on":void 0,onClick:()=>{J1(null),n(null),v(k.id)},onDoubleClick:P&&k.id===j.id&&k.include?j1:void 0,children:k.name},k.id,!1,void 0,this)),P?J.jsxDEV("button",{type:"button",className:"ghost",onClick:O1,"aria-label":"A new board",children:"+"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),j.include&&P?J.jsxDEV("div",{className:"board-acts",children:[J.jsxDEV("button",{type:"button",className:"ghost",onClick:j1,children:"Rename"},void 0,!1,void 0,this),J.jsxDEV("button",{type:"button",className:"ghost",onClick:f1,children:"Delete board"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,J.jsxDEV("ul",{className:"layer-list","aria-label":"Layers",children:[z5.map((k)=>{let d=k.data;return J.jsxDEV("li",{children:[J.jsxDEV("button",{type:"button",className:Q1===k.id?"layer-section on":"layer-section",onClick:()=>I1(k.id),onDoubleClick:()=>{if(P)I1(k.id),V0(d.key)},children:[d.vendor?J.jsxDEV(d1,{vendor:d.vendor},void 0,!1,void 0,this):J.jsxDEV(w1,{name:"layout-grid",size:14},void 0,!1,void 0,this),J.jsxDEV("span",{children:d.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("ul",{className:"layer-list inner",children:W5.filter((U1)=>J4.get(U1.id)===k.id).map(q4)},void 0,!1,void 0,this)]},k.id,!0,void 0,this)}),W5.filter((k)=>!J4.get(k.id)).map(q4)]},void 0,!0,void 0,this),j.include&&!i.length?J.jsxDEV("p",{className:"mode pad-s",children:"An empty board: add frames from Everything, or below."},void 0,!1,void 0,this):null,C0.length&&P?J.jsxDEV("select",{className:"board-add",value:"","aria-label":"Add to this board",onChange:(k)=>{let d=k.target.value;if(d)E(j.id,(U1)=>({...U1,include:[...U1.include??[],d]}))},children:[J.jsxDEV("option",{value:"",children:"Add to this board…"},void 0,!1,void 0,this),C0.map((k)=>J.jsxDEV("option",{value:k.key,children:k.label},k.key,!1,void 0,this))]},void 0,!0,void 0,this):null,R2.length?J.jsxDEV("details",{className:"board-hidden",children:[J.jsxDEV("summary",{children:["Hidden (",R2.length,")"]},void 0,!0,void 0,this),J.jsxDEV("ul",{className:"layer-list",children:R2.map((k)=>J.jsxDEV("li",{children:P?J.jsxDEV("button",{type:"button",onClick:()=>E(j.id,(d)=>({...d,hidden:(d.hidden??[]).filter((U1)=>U1!==R1(b1(k),d.hidden??[]))})),children:[J.jsxDEV("span",{children:[k.browser?`${k.browser} · `:"",k.title]},void 0,!0,void 0,this),J.jsxDEV("span",{className:"mode",children:"Show"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):J.jsxDEV("span",{className:"pad-s",children:[k.browser?`${k.browser} · `:"",k.title]},void 0,!0,void 0,this)},b1(k),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,t?J.jsxDEV("button",{type:"button",className:"board-elsewhere",onClick:()=>v("changes"),children:[J.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),g1(t,"change")," not on this board"]},void 0,!0,void 0,this):null,J.jsxDEV(F0,{load:W,what:"the board"},void 0,!1,void 0,this),M&&W.state==="ok"?J.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,$.state==="pending"?J.jsxDEV("p",{className:"mode",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,$.state==="error"?J.jsxDEV("p",{role:"alert",children:["The World did not open its screens: ",$.error," ",J.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),p?J.jsxDEV(m0,{position:"top-center",className:"float hint using",children:[J.jsxDEV("span",{className:"mode",children:["Using ",i.find((k)=>b1(k)===p)?.title??p]},void 0,!0,void 0,this),J.jsxDEV("button",{type:"button",onClick:()=>n(null),children:["Done ",J.jsxDEV("kbd",{children:"Esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):J.jsxDEV(m0,{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),P?J.jsxDEV(m0,{position:"bottom-center",className:"float board-tools",children:J.jsxDEV("button",{type:"button",className:"ghost",onClick:_1,title:"Section (⇧S): around the selected frame, else in the middle",children:[J.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),J.jsxDEV("span",{children:"Section"},void 0,!1,void 0,this),J.jsxDEV("kbd",{children:"⇧S"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,Z1&&i.some((k)=>b1(k)===Z1)?J.jsxDEV(m0,{position:"top-right",className:"float compare-panel",children:J.jsxDEV(BF,{viewing:F,name:_,token:Q,frame:i.find((k)=>b1(k)===Z1),onClose:()=>L1(null),reads:N},Z1,!1,void 0,this)},void 0,!1,void 0,this):null,J.jsxDEV(h_,{showInteractive:!1,position:"bottom-left"},void 0,!1,void 0,this),J.jsxDEV(b_,{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 CQ=(_)=>_.actions.map((Q)=>({twin:Q.service,entry:{...Q.action,service:Q.service,op:Q.action.op??Q.action.operation??""}})),RF=(_)=>{let Q=_.action.input??{};return!(typeof Q.operationId==="string"||Q.graphql!==void 0&&Q.graphql!==null)};function G3(_){let Q=_.actions.filter(RF).length,$=_.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:$,own:Q};if($>0&&G>=$)return{label:"Deployed",tone:"done",...F};if(G>0)return{label:`Partly deployed: ${G} of ${$}`,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 I8=(_)=>_.message??_.narration?.split(`
|
|
37
|
+
`)[0]?.replace(/ setting .*$/,"")??_.name;function SQ(_,Q=1){let $=_.currentHash??_.contentHash,q=_.readiness?.approvers??new Set(_.approvals.filter((G)=>G.contentHash===$).map((G)=>G.principal)).size,U=_.verification&&_.verification.contentHash===$?_.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 qQ({name:_,token:Q,signsAs:$,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),[M,B]=r.useState(""),[N,A]=r.useState(""),[T,O]=r.useState(null),C=u1(Q,`/-/${_}/origin`),f=G3(q),S=SQ(q,Y),w=CQ(q),y=[...new Set(w.map((h)=>h.twin))],D=y.some((h)=>G.includes(h)),c=(h)=>h===(q.currentHash??q.contentHash),l=q.applied?.receipts??[],v=(q.deployed??[]).filter((h)=>h.status!=="landed"),x=l.filter((h)=>h.status==="confirmed").length,b=v.filter((h)=>h.status==="deployed"),j=async(h,o,$1,i)=>{z(h),O(null);try{let t=await v1(Q,o,{method:"POST",...$1===void 0?{}:{body:JSON.stringify($1)}});if(!t.ok)return Z(t),O({what:h,...a1(await Q2(t))}),!1;if(i)l1(i);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=()=>{j("Verify",`/-/${_}/changesets/${q.name}/verify`,void 0,"Verified: the checks ran over it")},m=async(h)=>{if(h.preventDefault(),await j("Approve",`/-/${_}/changesets/${q.name}/approve`,{...M.trim()?{note:M.trim()}:{},...$===null&&N.trim()?{as:N.trim()}:{}},"Approved"))I(!1),B("")},P=async()=>{let h=y.filter((o)=>G.includes(o));if(!await g0({title:`Deploy ${q.name} to the real vendors?`,body:J.jsxDEV(J.Fragment,{children:["It performs its ",q.actions.length," change",q.actions.length===1?"":"s"," against the real account",h.length===1?"":"s"," behind ",m2(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 v1(Q,`/-/${_}/deploy/${q.name}`,{method:"POST",body:JSON.stringify({confirm:q.name})});if(!o.ok){Z(o),O({what:"Deploy",...a1(await Q2(o))});return}let $1=await v1(Q,`/-/${_}/changesets/${q.name}`),i=$1.ok?await $1.json():null;if(!i){l1("Deploy: sent; reading its receipts failed","info"),F();return}let t=G3(i);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)}},u=!U?"This session reads the World; it changes nothing":f.label==="Deployed"?"Already deployed: every change was performed at the vendor":null,E=C.state==="ok"&&C.data.origin?v8(C.data.origin):null;return J.jsxDEV("div",{className:"changeset","aria-labelledby":"changeset-title",children:[K?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("div",{className:"changeset-head",children:[J.jsxDEV("div",{children:[J.jsxDEV("h3",{id:"changeset-title",children:[q.message??q.name," ",J.jsxDEV("span",{className:`badge cs-${f.tone}`,children:f.label},void 0,!1,void 0,this)," ",J.jsxDEV("span",{className:`badge cs-${S.tone}`,children:S.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("p",{className:"mode",children:[J.jsxDEV("code",{children:q.name},void 0,!1,void 0,this)," · made ",J.jsxDEV(h1,{iso:q.createdAt},void 0,!1,void 0,this)," · ",q.actions.length," change",q.actions.length===1?"":"s"," at ",m2(y.map(M1))||"no vendor"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("div",{className:"changeset-actions",children:[J.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),J.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),D?J.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"?J.jsxDEV("p",{className:"mode",children:[u,"."]},void 0,!0,void 0,this):null,T?J.jsxDEV("div",{role:"alert",className:"refusal",children:[J.jsxDEV("span",{children:[J.jsxDEV("b",{children:T.what},void 0,!1,void 0,this),": ",T.text]},void 0,!0,void 0,this),T.acts.includes("verify")&&U?J.jsxDEV("button",{type:"button",onClick:V,disabled:L!==null,children:"Verify"},void 0,!1,void 0,this):null,T.acts.includes("approve")&&U?J.jsxDEV("button",{type:"button",onClick:()=>I(!0),disabled:L!==null,children:"Approve…"},void 0,!1,void 0,this):null,J.jsxDEV(HQ,{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?J.jsxDEV(J.Fragment,{children:[q.narration?J.jsxDEV("p",{className:"narration",children:q.narration},void 0,!1,void 0,this):null,J.jsxDEV("h4",{children:"Where it went"},void 0,!1,void 0,this),J.jsxDEV("div",{className:"block where",children:[f.performed>0?J.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 ",m2([...new Set([...b.map((h)=>h.service),...l.filter((h)=>h.status==="confirmed").map((h)=>h.service)].map(M1))]),b.length?` (${b.length} from here`:" (",b.length&&x?", ":"",x?`${x} by the remote`:"",")."]},void 0,!0,void 0,this):f.label==="Pushed"?J.jsxDEV("p",{className:"pad",children:["Pushed to the remote",E?J.jsxDEV(J.Fragment,{children:[" ",J.jsxDEV("code",{children:E},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,q.applied?J.jsxDEV(J.Fragment,{children:[" · ",J.jsxDEV(h1,{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?J.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.":J.jsxDEV(J.Fragment,{children:[" Push sends it to the remote World",D?"; Deploy, to the real vendors behind it":"","."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,f.failed>0?J.jsxDEV("p",{className:"pad failed",role:"alert",children:[f.failed," change",f.failed===1?" was":"s were"," refused or failed at the vendor",[...v.filter((h)=>h.reason&&(h.status==="refused"||h.status==="failed")).map((h)=>h.reason),...l.filter((h)=>h.status==="failed"&&h.error).map((h)=>h.error)].slice(0,3).map((h)=>`: ${a1(h).text}`).join(""),"."]},void 0,!0,void 0,this):null,q.applied?.refusal?.length?J.jsxDEV("ul",{className:"checks pad",children:q.applied.refusal.map((h,o)=>J.jsxDEV("li",{className:"mode",children:a1(h).text},o,!1,void 0,this))},void 0,!1,void 0,this):null,v.length?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("p",{className:"pad where-sub mode",children:"At the vendor"},void 0,!1,void 0,this),J.jsxDEV("ul",{className:"receipts pad",children:v.map((h)=>J.jsxDEV("li",{children:[J.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?J.jsxDEV("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",children:h.externalId??h.url},void 0,!1,void 0,this):h.externalId?J.jsxDEV("code",{children:h.externalId},void 0,!1,void 0,this):null:null,h.reason?J.jsxDEV("span",{className:"mode",children:[" · ",a1(h.reason).text]},void 0,!0,void 0,this):null," ",J.jsxDEV("span",{className:"mode",children:["· ",J.jsxDEV(h1,{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,l.length?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("p",{className:"pad where-sub mode",children:"At the remote"},void 0,!1,void 0,this),J.jsxDEV("ul",{className:"receipts pad",children:l.map((h)=>J.jsxDEV("li",{children:[J.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)," ",J.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?J.jsxDEV(J.Fragment,{children:[" ",J.jsxDEV("code",{children:h.externalId},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,h.error?J.jsxDEV("span",{className:"mode",children:[" · ",a1(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),!D&&f.label!=="Deployed"?J.jsxDEV("p",{className:"mode",children:["No vendor it changes is connected to its real service here, so it does not deploy from this World. ",J.jsxDEV("a",{href:`${T1}/${_}/~/settings/services`,onClick:(h)=>{h.preventDefault(),V1([..._.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,J.jsxDEV("h4",{children:"Checks"},void 0,!1,void 0,this),!q.verification?J.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):J.jsxDEV("div",{className:c(q.verification.contentHash)?"":"stale",children:[J.jsxDEV("p",{children:[q.verification.passed?"✓ Passed":"✗ Failed"," · ",J.jsxDEV(h1,{iso:q.verification.at},void 0,!1,void 0,this),c(q.verification.contentHash)?null:J.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?J.jsxDEV("ul",{className:"checks",children:q.verification.results.map((h)=>J.jsxDEV("li",{children:[h.passed?"✓":"✗"," ",J.jsxDEV("code",{children:h.id},void 0,!1,void 0,this)," ",J.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?J.jsxDEV("ul",{className:"checks",children:q.verification.refusals.map((h,o)=>J.jsxDEV("li",{children:["✗ ",J.jsxDEV("code",{children:h.check},void 0,!1,void 0,this)," ",J.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),J.jsxDEV("h4",{children:"Approvals"},void 0,!1,void 0,this),q.approvals.length===0?J.jsxDEV("p",{className:"mode",children:"No one has approved it."},void 0,!1,void 0,this):J.jsxDEV("ul",{className:"approvals",children:q.approvals.map((h,o)=>J.jsxDEV("li",{children:[J.jsxDEV("b",{children:h.principal},void 0,!1,void 0,this)," ",J.jsxDEV("span",{className:"mode",children:[J.jsxDEV(h1,{iso:h.at},void 0,!1,void 0,this),c(h.contentHash)?"":" · signed an earlier version"]},void 0,!0,void 0,this),h.note?J.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,J.jsxDEV(M0,{open:W,onClose:()=>{if(!L)I(!1)},title:`Approve ${q.name}`,footer:J.jsxDEV(J.Fragment,{children:[J.jsxDEV("button",{type:"button",onClick:()=>I(!1),disabled:L!==null,children:"Cancel"},void 0,!1,void 0,this),J.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:J.jsxDEV("form",{id:"approve-changeset",onSubmit:(h)=>void m(h),className:"stack",children:[J.jsxDEV("p",{className:"mode",children:["You sign its contents as they stand now",$?J.jsxDEV(J.Fragment,{children:[", recorded as ",J.jsxDEV("b",{children:$},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),$===null?J.jsxDEV("label",{children:[J.jsxDEV("span",{children:"Approving as"},void 0,!1,void 0,this),J.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),J.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,J.jsxDEV("label",{children:[J.jsxDEV("span",{children:["Note ",J.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.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 vQ=(_,Q)=>JSON.stringify(_)===JSON.stringify(Q);function OF({changes:_,idPrefix:Q}){let $=[...new Set(_.map((q)=>q.twin))];return J.jsxDEV(J.Fragment,{children:$.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 J.jsxDEV("div",{className:"compare",role:"group","aria-labelledby":`${Q}-${q}`,children:[J.jsxDEV("h3",{id:`${Q}-${q}`,className:"vendor-cell",children:[J.jsxDEV(d1,{vendor:q},void 0,!1,void 0,this),M1(q)," ",J.jsxDEV("span",{className:"mode",children:["· ",g1(G.length,"record"),", ",g1(U.length,"write")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.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 J.jsxDEV("li",{className:"record",children:[J.jsxDEV("p",{className:"record-head",children:[J.jsxDEV("span",{className:"kind",children:X.subject.type.replace(/^_+/,"").replace(/[_-]+/g," ")},void 0,!1,void 0,this)," ",Y.label?J.jsxDEV("span",{className:"label",children:["“",Y.label,"”"]},void 0,!0,void 0,this):null," ",J.jsxDEV("code",{children:G2(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)||!vQ(K[I],M)),W=K;return K={...K,...L},J.jsxDEV("div",{className:"write",children:[J.jsxDEV("p",{className:"mode",children:[J.jsxDEV("span",{className:"op",children:N0(H).what},void 0,!1,void 0,this)," · ",J.jsxDEV(h1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",e5(H)]},void 0,!0,void 0,this),z.length===0?J.jsxDEV("p",{className:"mode",children:"It set no field to a new value."},void 0,!1,void 0,this):J.jsxDEV("dl",{className:"fields field-diff","aria-label":`Fields ${N0(H).what} set`,children:z.map(([I,M])=>J.jsxDEV(r.default.Fragment,{children:[J.jsxDEV("dt",{children:I},void 0,!1,void 0,this),J.jsxDEV("dd",{children:I in W?J.jsxDEV("span",{className:"changed",children:[J.jsxDEV("del",{children:J.jsxDEV(Z2,{v:W[I]},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("span",{className:"arrow","aria-label":"becomes",children:"→"},void 0,!1,void 0,this),J.jsxDEV("ins",{children:J.jsxDEV(Z2,{v:M},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):J.jsxDEV(Z2,{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 IF({name:_,token:Q,changes:$,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([]),M=(N,A,T)=>{I((O)=>[{ok:N,text:A,at:new Date().toISOString(),n:++$4,...T?.length?{acts:T}:{}},...O].slice(0,4))},B=async(N)=>{N.preventDefault(),z(!0);try{let A=await v1(Q,`/-/${_}/changesets`,{method:"POST",body:JSON.stringify(K.trim()?{message:K.trim()}:{})});if(!A.ok){U(A);let O=a1(await Q2(A));M(!1,`Cut a changeset: ${O.text}`,O.acts);return}let T=await A.json();M(!0,`Cut ${T.name??"a changeset"}: ${g1(T.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":$===0?"Nothing to cut: no change is outside a changeset":null;return J.jsxDEV("div",{className:"ws-cut",children:[J.jsxDEV(T2,{log:W,name:_},void 0,!1,void 0,this),J.jsxDEV("form",{onSubmit:(A)=>void B(A),"aria-label":"Cut a changeset",children:[Y?J.jsxDEV("a",{className:"ws-author",href:Y.account,title:`${Y.who}: your account`,onClick:(A)=>{A.preventDefault(),V1(Y.account.slice(T1.length+1).split("/"))},children:Y.face},void 0,!1,void 0,this):null,J.jsxDEV("input",{ref:X,name:"changesetMessage","aria-label":"Summary",value:K,onChange:(A)=>H(A.target.value),placeholder:$===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),J.jsxDEV("button",{type:"submit",className:"primary",disabled:Boolean(N)||L,title:N??void 0,children:L?"Cutting…":$===0?"Cut a changeset":J.jsxDEV(J.Fragment,{children:["Cut ",g1($,"change"),Y?J.jsxDEV(J.Fragment,{children:[" on ",J.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||$===0)return J.jsxDEV(T2,{log:W,name:_},void 0,!1,void 0,this);return J.jsxDEV(J.Fragment,{children:[J.jsxDEV("form",{className:"block cut pad",onSubmit:(N)=>void B(N),"aria-label":"Cut a changeset",children:[J.jsxDEV("label",{children:[J.jsxDEV("span",{children:["Cut ",$===1?"this change":`these ${$} changes`," into a changeset: what it does and why"]},void 0,!0,void 0,this),J.jsxDEV("input",{name:"changesetMessage",value:K,onChange:(N)=>H(N.target.value),placeholder:"Welcome email for new sign-ups",required:!0,maxLength:200,disabled:$===0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("button",{type:"submit",className:"primary",disabled:L||$===0,children:L?"Cutting…":"Cut a changeset"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV(T2,{log:W,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function PF({name:_,token:Q}){let[$,q]=r.useState(0),U=u1(Q,`/-/${_}/keys`,$),[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,M]=r.useState(null),[B,N]=r.useState(null),A=async()=>{let C=`Read-only link · ${new Date().toLocaleDateString(void 0,{month:"short",day:"numeric"})}`,f=await v1(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?a1(S.error).text:"refused","error");return}N(`${window.location.origin}${T1}/${_}#${new URLSearchParams({token:S.key}).toString()}`),q((w)=>w+1)},T=async(C)=>{C.preventDefault(),L(!0),W(null);let f=await v1(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?a1(S.error).text:"refused");return}Z(!1),M({key:S.key,name:F.trim()}),X(""),q((w)=>w+1)},O=async(C)=>{if(!await g0({title:`Revoke ${C.name}?`,body:"Whatever holds it loses this World at once.",action:"Revoke key",danger:!0}))return;let f=await v1(Q,`/-/${_}/keys/${C.id}`,{method:"DELETE"});if(f.ok)l1(`Revoked ${C.name}`);else l1(await z0(f),"error");q((S)=>S+1)};return J.jsxDEV("section",{"aria-labelledby":"keys-head",className:"keys",children:[J.jsxDEV("div",{className:"keys-head",children:[J.jsxDEV("div",{children:[J.jsxDEV("h3",{id:"keys-head",children:"Keys"},void 0,!1,void 0,this),J.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),H0()?J.jsxDEV("a",{className:"button primary",href:`${H0()}/${encodeURIComponent(_.split("/")[0]??"")}`,children:"Make a key on the platform"},void 0,!1,void 0,this):J.jsxDEV("div",{className:"head-actions",children:[J.jsxDEV("button",{type:"button",onClick:()=>void A(),children:"Share a read-only link"},void 0,!1,void 0,this),J.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),J.jsxDEV(F0,{load:U,what:"the keys",retry:()=>q((C)=>C+1)},void 0,!1,void 0,this),U.state==="ok"?U.data.keys.length===0?J.jsxDEV("p",{className:"mode",children:"No keys yet. The World's own token opens it too."},void 0,!1,void 0,this):J.jsxDEV("table",{className:"dense","aria-label":"Keys",children:[J.jsxDEV("thead",{children:J.jsxDEV("tr",{children:[J.jsxDEV("th",{children:"Name"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"For"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Access"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Made"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Last used"},void 0,!1,void 0,this),J.jsxDEV("th",{className:"num",children:J.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),J.jsxDEV("tbody",{children:U.data.keys.map((C)=>J.jsxDEV("tr",{children:[J.jsxDEV("td",{children:C.name},void 0,!1,void 0,this),J.jsxDEV("td",{children:C.person??J.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),J.jsxDEV("td",{children:C.scope==="write"?"Read and write":"Read only"},void 0,!1,void 0,this),J.jsxDEV("td",{className:"mode",children:J.jsxDEV("span",{title:x2(C.createdAt),children:A8(C.createdAt)},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{className:"mode",children:C.lastUsedAt?A8(C.lastUsedAt):"never"},void 0,!1,void 0,this),J.jsxDEV("td",{className:"num",children:J.jsxDEV(i_,{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,J.jsxDEV(M0,{open:G,onClose:()=>{if(!H)Z(!1)},title:"Make a key",footer:J.jsxDEV(J.Fragment,{children:[J.jsxDEV("button",{type:"button",onClick:()=>Z(!1),disabled:H,children:"Cancel"},void 0,!1,void 0,this),J.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:J.jsxDEV("form",{id:"make-key",onSubmit:T,"aria-label":"Make a key",children:[J.jsxDEV("label",{children:["Name ",J.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),J.jsxDEV("label",{children:["Access ",J.jsxDEV("select",{value:Y,onChange:(C)=>K(C.target.value==="read"?"read":"write"),children:[J.jsxDEV("option",{value:"write",children:"Read and write"},void 0,!1,void 0,this),J.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?J.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),J.jsxDEV(M0,{open:Boolean(I),onClose:()=>M(null),title:`${I?.name??"The key"} is ready`,footer:J.jsxDEV("button",{type:"button",className:"primary",onClick:()=>M(null),children:"Done"},void 0,!1,void 0,this),children:[J.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?J.jsxDEV(T8,{label:"Key",value:I.key,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),J.jsxDEV(M0,{open:Boolean(B),onClose:()=>N(null),title:"A read-only link",footer:J.jsxDEV("button",{type:"button",className:"primary",onClick:()=>N(null),children:"Done"},void 0,!1,void 0,this),children:[J.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?J.jsxDEV(T8,{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 $4=0;function T2({log:_,name:Q}){if(_.length===0)return null;return J.jsxDEV("ul",{className:"narration-log",role:"status","aria-live":"polite",children:_.map(($)=>J.jsxDEV("li",{className:$.ok?"ok":"bad",children:[J.jsxDEV("span",{className:"mode",children:J.jsxDEV(h1,{iso:$.at,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",$.text,$.acts?J.jsxDEV(HQ,{name:Q,acts:$.acts},void 0,!1,void 0,this):null]},$.n,!0,void 0,this))},void 0,!1,void 0,this)}function yQ(_,Q,$,q){let[U,G]=r.useState(0),Z=U*1e5+Math.floor($/2),F=u1(Q,`/-/${_}/origin`,Z),X=u1(Q,`/-/${_}/diff`,Z),Y=u1(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 v1(Q,`/-/${_}/${C}`,f);if(!S.ok){q(S);let w=a1(await Q2(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?v8(F.data.origin):null,B=X.state==="ok"?X.data.changes.length:null,N=Y.state==="ok"&&M?_F(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((l)=>l.status==="replayed").length,w=f.filter((l)=>l.status==="confirmed").length,y=f.filter((l)=>l.status==="failed").length,D=C.outcome==="applied"&&y===0;if(C.outcome==="refused"){W(!1,`Push of ${C.changeset} was refused${C.refusal?.length?`: ${C.refusal.map((l)=>a1(l).text).join("; ")}`:""}.`);continue}let c=[`${S} of ${g1(f.length,"change")} replayed there`,...w?[`${w} performed at the vendor by the remote`]:[],...y?[`${y} failed`]:[]];W(D,`${C.outcome==="partial"?"Partly pushed":"Pushed"} ${C.changeset} to ${M??"the remote"}: ${c.join("; ")}${C.refusal?.length?` (${C.refusal.map((l)=>a1(l).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])=>`${g1(w,"entry")} at ${M1(S)}`).join(", "):"nothing new"}${f.length?`; conflicts at ${f.join(", ")}`:""}.`)}}}function NF({name:_,token:Q,canWrite:$,tick:q,refused:U}){let{origin:G,there:Z,changes:F,log:X,busy:Y,say:K,send:H,push:L,pull:z}=yQ(_,Q,q,U),[W,I]=r.useState(""),[M,B]=r.useState(""),[N,A]=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:M.trim()})});if(f){let S=Object.values(f.appended??{}).reduce((w,y)=>w+y,0);K(!0,`The remote is ${v8(f.origin)}: its history came in (${g1(S,"entry")}).`),B(""),A(!1)}},O=!$?"This session reads the World; it changes nothing":null;return J.jsxDEV(J.Fragment,{children:[J.jsxDEV("div",{className:"block remote",children:[J.jsxDEV("div",{className:"block-head",children:[J.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),J.jsxDEV("div",{className:"pad",children:[G.state==="ok"?Z?J.jsxDEV("p",{children:[J.jsxDEV("code",{className:"big",children:Z},void 0,!1,void 0,this),G.data.origin?.fetchedAt?J.jsxDEV("span",{className:"mode",children:[" · last fetched ",J.jsxDEV(h1,{iso:G.data.origin.fetchedAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):J.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):J.jsxDEV(F0,{load:G,what:"the remote",lines:1},void 0,!1,void 0,this),N?J.jsxDEV("form",{className:"stack origin-form",onSubmit:(C)=>void T(C),"aria-label":"Name the remote",children:[J.jsxDEV("label",{children:[J.jsxDEV("span",{children:"The World's address"},void 0,!1,void 0,this),J.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),J.jsxDEV("label",{children:[J.jsxDEV("span",{children:"A key or token that opens it"},void 0,!1,void 0,this),J.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),J.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),J.jsxDEV("div",{className:"row-actions",children:[J.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),J.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),J.jsxDEV(T2,{log:X,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wF({name:_,token:Q,canWrite:$,refused:q}){let[U,G]=r.useState(0),Z=u1(Q,`/-/${_}/twins`,U),F=u1(Q,`/-/${_}/links`,U),X=u1(Q,`/-/${_}/requests?hours=24`,U),[Y,K]=r.useState({}),[H,L]=r.useState(null),[z,W]=r.useState(""),[I,M]=r.useState(!1),[B,N]=r.useState([]),A=(w,y,D)=>{if(N((c)=>[{ok:w,text:y,at:new Date().toISOString(),n:++$4,...D?.length?{acts:D}:{}},...c].slice(0,6)),!w)l1(y,"error")},T=F.state==="ok"?Object.keys(F.data.links).sort():[];r.useEffect(()=>{let w=!0;return Promise.all(T.map(async(y)=>{let D=await v1(Q,`/-/${_}/twins/${y}/credential`).catch(()=>null),c=D?.ok?await D.json():null;return[y,c?.credential??null]})).then((y)=>{if(w)K(Object.fromEntries(y))}),()=>{w=!1}},[_,Q,T.join(","),U]);let O=async(w)=>{if(w.preventDefault(),!H||!z)return;M(!0);let y=await v1(Q,`/-/${_}/twins/${H.vendor}/credential`,{method:"PUT",body:z,headers:{"content-type":"text/plain"}}).catch(()=>null);if(M(!1),!y){A(!1,`Seal ${H.vendor}: ${k1} did not answer`);return}if(!y.ok){q(y);let c=a1(await Q2(y));A(!1,`Seal ${M1(H.vendor)}: ${c.text}`,c.acts);return}let D=await y.json().catch(()=>({}));A(!0,`Sealed a credential for ${M1(H.vendor)}${D.fingerprint?` (${D.fingerprint})`:""}: it opens for ${D.boundTo??H.to} only, and is never shown again.`),W(""),L(null),G((c)=>c+1)},C=async(w)=>{if(!await g0({title:`Remove the link ${w}?`,body:`Requests to ${c0}/${_}/${w}/… stop being forwarded to ${F.state==="ok"?F.data.links[w]?.origin:"its origin"}.`,action:"Remove link",danger:!0}))return;let y=await v1(Q,`/-/${_}/links/${w}`,{method:"DELETE"}).catch(()=>null);if(!y?.ok){if(y)q(y);A(!1,`Remove ${w}: ${y?await z0(y):"the World did not answer"}`);return}A(!0,`Removed the link ${w}.`),G((D)=>D+1)},f=(w)=>w?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("span",{className:"badge rooted",children:"sealed"},void 0,!1,void 0,this)," ",J.jsxDEV("span",{className:"mode",children:[w.fingerprint?J.jsxDEV("code",{children:w.fingerprint},void 0,!1,void 0,this):null," · ",J.jsxDEV(h1,{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):J.jsxDEV("span",{className:"mode",children:"none"},void 0,!1,void 0,this),S=Z.state==="ok"?Z.data.twins:[];return J.jsxDEV(J.Fragment,{children:[J.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),J.jsxDEV(T2,{log:B,name:_},void 0,!1,void 0,this),J.jsxDEV("section",{className:"block","aria-labelledby":"creds-head",children:[J.jsxDEV("div",{className:"block-head",children:J.jsxDEV("h3",{id:"creds-head",children:"Vendors"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV(F0,{load:Z,what:"the vendors"},void 0,!1,void 0,this),Z.state==="ok"?J.jsxDEV("table",{className:"dense","aria-label":"Credentials by vendor",children:[J.jsxDEV("thead",{children:J.jsxDEV("tr",{children:[J.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Credential"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Bound to"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Real service"},void 0,!1,void 0,this),$?J.jsxDEV("th",{className:"num",children:J.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),J.jsxDEV("tbody",{children:S.map((w)=>J.jsxDEV("tr",{children:[J.jsxDEV("td",{children:J.jsxDEV("span",{className:"vendor-cell",children:[J.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),J.jsxDEV("td",{children:f(w.credential)},void 0,!1,void 0,this),J.jsxDEV("td",{children:w.credential?.boundTo?J.jsxDEV("code",{children:w.credential.boundTo},void 0,!1,void 0,this):J.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{children:w.root?.url?J.jsxDEV("code",{children:w.root.url},void 0,!1,void 0,this):J.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:J.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)?J.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),J.jsxDEV("section",{className:"block","aria-labelledby":"links-head",children:[J.jsxDEV("div",{className:"block-head",children:[J.jsxDEV("h3",{id:"links-head",children:"Links"},void 0,!1,void 0,this),J.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),J.jsxDEV(F0,{load:F,what:"the links"},void 0,!1,void 0,this),X.state==="ok"&&(X.data.journalFailures??0)>0?J.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?J.jsxDEV("p",{className:"mode pad",children:["No links. A link forwards requests for a vendor with no twin here, at ",J.jsxDEV("code",{children:[c0,"/",_,"/<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?J.jsxDEV("table",{className:"dense","aria-label":"Links",children:[J.jsxDEV("thead",{children:J.jsxDEV("tr",{children:[J.jsxDEV("th",{children:"Link"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Origin"},void 0,!1,void 0,this),J.jsxDEV("th",{className:"num",children:"Requests, 24h"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Credential"},void 0,!1,void 0,this),$?J.jsxDEV("th",{className:"num",children:J.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),J.jsxDEV("tbody",{children:T.map((w)=>{let y=F.state==="ok"?F.data.links[w].origin:"",D=X.state==="ok"?X.data.twins.find((c)=>c.twin===w):void 0;return J.jsxDEV("tr",{children:[J.jsxDEV("td",{children:J.jsxDEV("b",{children:w},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{children:J.jsxDEV("code",{children:y},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{className:"num",children:D?J.jsxDEV("span",{title:Object.entries(D.byStatus).map(([c,l])=>`${c}: ${l}`).join(" · "),children:D.requests},void 0,!1,void 0,this):J.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{children:[f(Y[w]??null),Y[w]?.boundTo?J.jsxDEV("div",{className:"mode",children:["bound to ",J.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:[J.jsxDEV("button",{type:"button",onClick:()=>{W(""),L({vendor:w,to:y})},children:Y[w]?"Replace…":"Seal a credential…"},void 0,!1,void 0,this),J.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),J.jsxDEV(M0,{open:Boolean(H),onClose:()=>{if(!I)L(null)},title:`Seal ${H?M1(H.vendor):""}'s credential`,footer:J.jsxDEV(J.Fragment,{children:[J.jsxDEV("button",{type:"button",onClick:()=>L(null),disabled:I,children:"Cancel"},void 0,!1,void 0,this),J.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:J.jsxDEV("form",{id:"seal-credential",className:"stack",onSubmit:(w)=>void O(w),children:[J.jsxDEV("p",{className:"mode",children:["It is sealed for ",J.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),J.jsxDEV("label",{children:[J.jsxDEV("span",{children:"The real key"},void 0,!1,void 0,this),J.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 fF({name:_,token:Q,admin:$,canWrite:q,refused:U,onRemoved:G,only:Z}){let F=(V)=>!Z||Z===V,[X,Y]=r.useState(0),K=u1(Q,`/-/${_}/twins`,X),H=u1(Q,`/-/${_}/checks`,X),[L,z]=r.useState(0),W=u1(Q,`/-/${_}/clock`,L),[I,M]=r.useState([]),[B,N]=r.useState(null),[A,T]=r.useState(null),[O,C]=r.useState(""),[f,S]=r.useState("gated"),[w,y]=r.useState(!1),D=(V,m,P)=>{if(M((u)=>[{ok:V,text:m,at:new Date().toISOString(),n:++$4,...P?.length?{acts:P}:{}},...u].slice(0,6)),!V)l1(m,"error")},c=async(V,m,P)=>{let u=await v1(Q,m,P).catch(()=>null);if(!u)return D(!1,`${V}: the World did not answer`),!1;if(!u.ok){U(u);let E=a1(await Q2(u));return D(!1,`${V}: ${E.text}`,E.acts),!1}return D(!0,`${V}: done.`),Y((E)=>E+1),!0},l=async(V)=>{if(V.preventDefault(),!A)return;y(!0);let m=A.root??{},P=await c(O.trim()?`Connect ${M1(A.twin)} to ${O.trim()}`:`Disconnect ${M1(A.twin)}`,`/-/${_}/twins/${A.twin}/root`,{method:"PUT",body:JSON.stringify(O.trim()?{...m,url:O.trim(),deploy:f}:null)});if(y(!1),P)T(null)},v=async()=>{if(!await g0({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 v1($,`/-/worlds/${_}/rotate`,{method:"POST"});if(V.ok)N(await V.json()),D(!0,"Rotated: the new tokens are shown once, below.");else D(!1,`Rotate: ${await z0(V)}`)},x=async()=>{if(!await g0({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 v1($,`/-/worlds/${_}`,{method:"DELETE"}).catch((m)=>m);if(V instanceof Error){D(!1,`Remove: the host did not answer (${V.message})`);return}if(V.ok)G();else D(!1,`Remove: ${await z0(V)}`)},b=K.state==="ok"?K.data.twins:[],j={gated:"gated: a person deploys an approved changeset",auto:"auto: a push deploys at once",hold:"hold: nothing deploys"};return J.jsxDEV(J.Fragment,{children:[J.jsxDEV(T2,{log:I,name:_},void 0,!1,void 0,this),F("access")?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("h3",{className:"settings-head",children:"Access"},void 0,!1,void 0,this),q?J.jsxDEV(PF,{name:_,token:Q},void 0,!1,void 0,this):J.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")?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("h3",{className:"settings-head",children:"Real services"},void 0,!1,void 0,this),J.jsxDEV("p",{className:"mode",children:[b.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),J.jsxDEV(F0,{load:K,what:"the vendors"},void 0,!1,void 0,this),K.state==="ok"?J.jsxDEV("div",{className:"block",children:J.jsxDEV("table",{className:"dense","aria-label":"Real services",children:[J.jsxDEV("thead",{children:J.jsxDEV("tr",{children:[J.jsxDEV("th",{children:"Vendor"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Real service"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Deploy policy"},void 0,!1,void 0,this),J.jsxDEV("th",{children:"Last read from it"},void 0,!1,void 0,this),q?J.jsxDEV("th",{className:"num",children:J.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),J.jsxDEV("tbody",{children:b.map((V)=>{let m=V.root;return J.jsxDEV("tr",{children:[J.jsxDEV("td",{children:J.jsxDEV("span",{className:"vendor-cell",children:[J.jsxDEV(d1,{vendor:V.twin},void 0,!1,void 0,this),J.jsxDEV("a",{href:`${T1}/${_}/${V.twin}`,title:`Its log and stored state · ${V.position??0} entries`,onClick:(P)=>{P.preventDefault(),V1([..._.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),J.jsxDEV("td",{children:m?.url?J.jsxDEV("code",{children:m.url},void 0,!1,void 0,this):J.jsxDEV("span",{className:"mode",children:"not connected"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J.jsxDEV("td",{className:"mode",children:m?.url?j[m.deploy??""]??m.deploy??"—":"—"},void 0,!1,void 0,this),J.jsxDEV("td",{children:V.refresh?.failed?J.jsxDEV("span",{role:"alert",children:["failed ×",V.refresh.failed.count??1,": ",V.refresh.failed.reason??""]},void 0,!0,void 0,this):m?.url?x2(V.refresh?.observedAt??V.refresh?.at):J.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q?J.jsxDEV("td",{className:"num row-actions",children:[J.jsxDEV("button",{type:"button",onClick:()=>{C(m?.url??""),S(m?.deploy==="auto"||m?.deploy==="hold"?m.deploy:"gated"),T(V)},children:m?.url?"Change…":"Connect…"},void 0,!1,void 0,this),J.jsxDEV("button",{type:"button",disabled:!m?.url,title:m?.url?"Read the real service's current state into this World":"Connect it first",onClick:()=>void g0({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)c(`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")?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("h3",{className:"settings-head",children:"Clock"},void 0,!1,void 0,this),J.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),J.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")?J.jsxDEV(J.Fragment,{children:[J.jsxDEV("h3",{className:"settings-head",children:"Checks"},void 0,!1,void 0,this),J.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),J.jsxDEV(F0,{load:H,what:"the checks"},void 0,!1,void 0,this),H.state==="ok"?H.data.checks.length===0?J.jsxDEV("p",{className:"mode",children:"No checks: every change is performed as it comes."},void 0,!1,void 0,this):J.jsxDEV("div",{className:"block",children:J.jsxDEV("table",{className:"dense","aria-label":"Checks",children:J.jsxDEV("tbody",{children:H.data.checks.map((V)=>J.jsxDEV("tr",{children:J.jsxDEV("td",{children:J.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,$&&!Z?J.jsxDEV("div",{className:"danger",role:"region","aria-label":"Danger zone",children:[J.jsxDEV("h3",{children:"Danger zone"},void 0,!1,void 0,this),B?J.jsxDEV("p",{role:"status",children:["token ",J.jsxDEV("code",{children:B.token},void 0,!1,void 0,this)," · read token ",J.jsxDEV("code",{children:B.readToken},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,J.jsxDEV("p",{children:[J.jsxDEV("button",{type:"button",onClick:()=>void v(),children:"Rotate tokens"},void 0,!1,void 0,this)," ",J.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),J.jsxDEV("p",{children:[J.jsxDEV("button",{type:"button",onClick:()=>void x(),children:"Remove world"},void 0,!1,void 0,this)," ",J.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,J.jsxDEV(M0,{open:Boolean(A),onClose:()=>{if(!w)T(null)},title:`Connect ${A?M1(A.twin):""} to its real service`,footer:J.jsxDEV(J.Fragment,{children:[J.jsxDEV("button",{type:"button",onClick:()=>T(null),disabled:w,children:"Cancel"},void 0,!1,void 0,this),J.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:J.jsxDEV("form",{id:"connect-root",className:"stack",onSubmit:(V)=>void l(V),children:[J.jsxDEV("label",{children:[J.jsxDEV("span",{children:"The real service's API address"},void 0,!1,void 0,this),J.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),J.jsxDEV("span",{className:"mode",children:"Empty disconnects it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.jsxDEV("label",{children:[J.jsxDEV("span",{children:"Deploy policy"},void 0,!1,void 0,this),J.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)=>J.jsxDEV("option",{value:V,children:j[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 HM(){return J.jsxDEV(J.Fragment,{children:[J.jsxDEV(xZ,{},void 0,!1,void 0,this),J.jsxDEV(r_,{},void 0,!1,void 0,this),J.jsxDEV(l_,{},void 0,!1,void 0,this),J.jsxDEV(c_,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{FM as openAt,_4 as ROOT,HM as ConsolePage};
|