@volter/world-console 3.0.17 → 3.0.18
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.
|
@@ -33,5 +33,5 @@ React keys must be passed directly to JSX without using spread:
|
|
|
33
33
|
`)),K=Y.reduce((H,L)=>H.concat(...L),[]);return[Y,K]}return[[],[]]},[_]);return d.useEffect(()=>{let X=Q?.target??R9,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)&&m6(z))return!1;let w=I9(z.code,F);if(G.current.add(z[w]),O9(Z,G.current,!1)){let R=z.composedPath?.()?.[0]||z.target,A=R?.nodeName==="BUTTON"||R?.nodeName==="A";if(Q.preventDefault!==!1&&(U.current||!A))z.preventDefault();q(!0)}},H=(z)=>{let W=I9(z.code,F);if(O9(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 O9(_,Q,J){return _.filter((q)=>J||q.length===Q.size).some((q)=>q.every((U)=>Q.has(U)))}function I9(_,Q){return Q.includes(_)?"code":"key"}var OU=()=>{let _=b1();return d.useMemo(()=>{return{zoomIn:async(Q)=>{let{panZoom:J}=_.getState();return J?J.scaleBy(1.2,Q):!1},zoomOut:async(Q)=>{let{panZoom:J}=_.getState();return J?J.scaleBy(0.8333333333333334,Q):!1},zoomTo:async(Q,J)=>{let{panZoom:q}=_.getState();return q?q.scaleTo(Q,J):!1},getZoom:()=>_.getState().transform[2],setViewport:async(Q,J)=>{let{transform:[q,U,G],panZoom:Z}=_.getState();if(!Z)return!1;return await Z.setViewport({x:Q.x??q,y:Q.y??U,zoom:Q.zoom??G},J),!0},getViewport:()=>{let[Q,J,q]=_.getState().transform;return{x:Q,y:J,zoom:q}},setCenter:async(Q,J,q)=>{return _.getState().setCenter(Q,J,q)},fitBounds:async(Q,J)=>{let{width:q,height:U,minZoom:G,maxZoom:Z,panZoom:F}=_.getState(),X=m5(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 q5(Y,q,H,K)},flowToScreenPosition:(Q)=>{let{transform:J,domNode:q}=_.getState();if(!q)return Q;let{x:U,y:G}=q.getBoundingClientRect(),Z=k2(Q,J);return{x:Z.x+U,y:Z.y+G}}}},[])};function d9(_,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)IU(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 IU(_,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 a9(_,Q){return d9(_,Q)}function wU(_,Q){return d9(_,Q)}function V2(_,Q){return{id:_,type:"select",selected:Q}}function G5(_,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(V2(G.id,Z))}}return q}function w9({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 P9(_){return{id:_.id,type:"remove"}}var PU=u6("React Flow","https://reactflow.dev/");function NU(_,Q,J={}){return h7(_,Q,{...J,onError:J.onError??PU})}var N9=(_)=>P7(_),fU=(_)=>S6(_);function s9(_){return d.forwardRef(_)}var t9=typeof window<"u"?d.useLayoutEffect:d.useEffect;function f9(_){let[Q,J]=d.useState(BigInt(0)),[q]=d.useState(()=>CU(()=>J((U)=>U+BigInt(1))));return t9(()=>{let U=q.get();if(U.length)_(U),q.reset()},[Q]),q}function CU(_){let Q=[];return{get:()=>Q,reset:()=>{Q=[]},push:(J)=>{Q.push(J),_()}}}var o9=d.createContext(null);function SU({children:_}){let Q=b1(),J=d.useCallback((F)=>{let{nodes:X=[],setNodes:Y,hasDefaultNodes:K,onNodesChange:H,nodeLookup:L,fitViewQueued:z,onNodesChangeMiddlewareMap:W}=Q.getState(),w=X;for(let A of F)w=typeof A==="function"?A(w):A;let R=w9({items:w,lookup:L});for(let A of W.values())R=A(R);if(K)Y(w);if(R.length>0)H?.(R);else if(z)window.requestAnimationFrame(()=>{let{fitViewQueued:A,nodes:O,setNodes:B}=Q.getState();if(A)B(O)})},[]),q=f9(J),U=d.useCallback((F)=>{let{edges:X=[],setEdges:Y,hasDefaultEdges:K,onEdgesChange:H,edgeLookup:L}=Q.getState(),z=X;for(let W of F)z=typeof W==="function"?W(z):W;if(K)Y(z);else if(H)H(w9({items:z,lookup:L}))},[]),G=f9(U),Z=d.useMemo(()=>({nodeQueue:q,edgeQueue:G}),[]);return r.jsx(o9.Provider,{value:Z,children:_})}function vU(){let _=d.useContext(o9);if(!_)throw Error("useBatchContext must be used within a BatchProvider");return _}var kU=(_)=>!!_.panZoom;function c5(){let _=OU(),Q=b1(),J=vU(),q=N1(kU),U=d.useMemo(()=>{let G=(H)=>Q.getState().nodeLookup.get(H),Z=(H)=>{J.nodeQueue.push(H)},F=(H)=>{J.edgeQueue.push(H)},X=(H)=>{let{nodeLookup:L,nodeOrigin:z}=Q.getState(),W=N9(H)?H:L.get(H.id),w=W.parentId?D6(W.position,W.measured,W.parentId,L,z):W.position,R={...W,position:w,width:W.measured?.width??W.width,height:W.measured?.height??W.height};return J5(R)},Y=(H,L,z={replace:!1})=>{Z((W)=>W.map((w)=>{if(w.id===H){let R=typeof L==="function"?L(w):L;return z.replace&&N9(R)?R:{...w,...R}}return w}))},K=(H,L,z={replace:!1})=>{F((W)=>W.map((w)=>{if(w.id===H){let R=typeof L==="function"?L(w):L;return z.replace&&fU(R)?R:{...w,...R}}return w}))};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,w,R]=z;return{nodes:H.map((A)=>({...A})),edges:L.map((A)=>({...A})),viewport:{x:W,y:w,zoom:R}}},deleteElements:async({nodes:H=[],edges:L=[]})=>{let{nodes:z,edges:W,onNodesDelete:w,onEdgesDelete:R,triggerNodeChanges:A,triggerEdgeChanges:O,onDelete:B,onBeforeDelete:M}=Q.getState(),{nodes:P,edges:C}=await C7({nodesToRemove:H,edgesToRemove:L,nodes:z,edges:W,onBeforeDelete:M}),f=C.length>0,v=P.length>0;if(f){let N=C.map(P9);R?.(C),O(N)}if(v){let N=P.map(P9);w?.(P),A(N)}if(v||f)B?.({nodes:P,edges:C});return{deletedNodes:P,deletedEdges:C}},getIntersectingNodes:(H,L=!0,z)=>{let W=V6(H),w=W?H:X(H),R=z!==void 0;if(!w)return[];return(z||Q.getState().nodes).filter((A)=>{let O=Q.getState().nodeLookup.get(A.id);if(O&&!W&&(A.id===H.id||!O.internals.positionAbsolute))return!1;let B=J5(R?A:O),M=x5(B,w);return L&&M>0||M>=B.width*B.height||M>=w.width*w.height})},isNodeIntersecting:(H,L,z=!0)=>{let w=V6(H)?H:X(H);if(!w)return!1;let R=x5(w,L);return z&&R>0||R>=L.width*L.height||R>=w.width*w.height},updateNode:Y,updateNodeData:(H,L,z={replace:!1})=>{Y(H,(W)=>{let w=typeof L==="function"?L(W):L;return z.replace?{...W,data:w}:{...W,data:{...W.data,...w}}},z)},updateEdge:K,updateEdgeData:(H,L,z={replace:!1})=>{K(H,(W)=>{let w=typeof L==="function"?L(W):L;return z.replace?{...W,data:w}:{...W,data:{...W.data,...w}}},z)},getNodesBounds:(H)=>{let{nodeLookup:L,nodeOrigin:z}=Q.getState();return k6(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??k7();return Q.setState({fitViewQueued:!0,fitViewOptions:H,fitViewResolver:L}),J.nodeQueue.push((z)=>[...z]),L.promise}}},[]);return d.useMemo(()=>{return{...U,..._,viewportInitialized:q}},[q])}var C9=(_)=>_.selected,yU=typeof window<"u"?window:void 0;function jU({deleteKeyCode:_,multiSelectionKeyCode:Q}){let J=b1(),{deleteElements:q}=c5(),U=p5(_,{actInsideInputWithModifier:!1}),G=p5(Q,{target:yU});d.useEffect(()=>{if(U){let{edges:Z,nodes:F}=J.getState();q({nodes:F.filter(C9),edges:Z.filter(C9)}),J.setState({nodesSelectionActive:!1})}},[U]),d.useEffect(()=>{J.setState({multiSelectionActive:G})},[G])}function VU(_){let Q=b1();d.useEffect(()=>{let J=()=>{if(!_.current||!(_.current.checkVisibility?.()??!0))return!1;let q=C4(_.current);if(q.height===0||q.width===0)Q.getState().onError?.("004",H0.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 g4={position:"absolute",width:"100%",height:"100%",top:0,left:0},uU=(_)=>({userSelectionActive:_.userSelectionActive,lib:_.lib,connectionInProgress:_.connection.inProgress});function hU({onPaneContextMenu:_,zoomOnScroll:Q=!0,zoomOnPinch:J=!0,panOnScroll:q=!1,panActivationKeyPressed:U,panOnScrollSpeed:G=0.5,panOnScrollMode:Z=s0.Free,zoomOnDoubleClick:F=!0,panOnDrag:X=!0,defaultViewport:Y,translateExtent:K,minZoom:H,maxZoom:L,zoomActivationKeyCode:z,preventScrolling:W=!0,children:w,noWheelClassName:R,noPanClassName:A,onViewportChange:O,isControlledViewport:B,paneClickDistance:M,selectionOnDrag:P}){let C=b1(),f=d.useRef(null),{userSelectionActive:v,lib:N,connectionInProgress:k}=N1(uU,D1),u=p5(z),i=d.useRef();VU(f);let l=d.useCallback((S)=>{if(O?.({x:S[0],y:S[1],zoom:S[2]}),!B)C.setState({transform:S})},[O,B]);return d.useEffect(()=>{if(f.current){i.current=e7({domNode:f.current,minZoom:H,maxZoom:L,translateExtent:K,viewport:Y,onDraggingChange:(E)=>C.setState((j)=>j.paneDragging===E?j:{paneDragging:E}),onPanZoomStart:(E,j)=>{let{onViewportChangeStart:m,onMoveStart:I}=C.getState();I?.(E,j),m?.(j)},onPanZoom:(E,j)=>{let{onViewportChange:m,onMove:I}=C.getState();I?.(E,j),m?.(j)},onPanZoomEnd:(E,j)=>{let{onViewportChangeEnd:m,onMoveEnd:I}=C.getState();I?.(E,j),m?.(j)}});let{x:S,y:b,zoom:h}=i.current.getViewport();return C.setState({panZoom:i.current,transform:[S,b,h],domNode:f.current.closest(".react-flow")}),()=>{i.current?.destroy()}}},[]),d.useEffect(()=>{i.current?.update({onPaneContextMenu:_,zoomOnScroll:Q,zoomOnPinch:J,panOnScroll:q,panActivationKeyPressed:U,panOnScrollSpeed:G,panOnScrollMode:Z,zoomOnDoubleClick:F,panOnDrag:X,zoomActivationKeyPressed:u,preventScrolling:W,noPanClassName:A,userSelectionActive:v,noWheelClassName:R,lib:N,onTransformChange:l,connectionInProgress:k,selectionOnDrag:P,paneClickDistance:M})},[_,Q,J,q,U,G,Z,F,X,u,W,A,v,R,N,l,k,P,M]),r.jsx("div",{className:"react-flow__renderer",ref:f,style:g4,children:w})}var DU=(_)=>({userSelectionActive:_.userSelectionActive,userSelectionRect:_.userSelectionRect});function bU(){let{userSelectionActive:_,userSelectionRect:Q}=N1(DU,D1);if(!(_&&Q))return null;return r.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 t6=(_,Q)=>{return(J)=>{if(J.target!==Q.current)return;_?.(J)}},EU=(_)=>({userSelectionActive:_.userSelectionActive,elementsSelectable:_.elementsSelectable,dragging:_.paneDragging,panBy:_.panBy,autoPanSpeed:_.autoPanSpeed});function xU({isSelecting:_,selectionKeyPressed:Q,selectionMode:J=S2.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:w}){let R=d.useRef(0),A=b1(),{userSelectionActive:O,elementsSelectable:B,dragging:M,panBy:P,autoPanSpeed:C}=N1(EU,D1),f=B&&(_||O),v=d.useRef(null),N=d.useRef(),k=d.useRef(new Set),u=d.useRef(new Set),i=d.useRef(!1),l=d.useRef(!1),S=d.useRef({x:0,y:0}),b=d.useRef(!1),h=(p)=>{if(l.current||i.current||A.getState().connection.inProgress){l.current=!1,i.current=!1;return}Y?.(p),A.getState().resetSelectedElements(),A.setState({nodesSelectionActive:!1})},E=(p)=>{if(Array.isArray(q)&&q?.includes(2)){p.preventDefault();return}K?.(p)},j=H?(p)=>H(p):void 0,m=(p)=>{if(l.current)p.stopPropagation(),l.current=!1},I=(p)=>{if(p.pointerType==="touch"&&q!==!1&&!Q)return;let{domNode:e,transform:$1}=A.getState();if(N.current=e?.getBoundingClientRect(),!N.current)return;let U1=p.target===v.current;if(!U1&&!!p.target.closest(".nokey")||!_||!(Z&&U1||Q)||p.button!==0||!p.isPrimary)return;p.target?.setPointerCapture?.(p.pointerId),l.current=!1;let{x:W1,y:Y1}=T0(p.nativeEvent,N.current),n=q5({x:W1,y:Y1},$1);if(A.setState({userSelectionRect:{width:0,height:0,startX:n.x,startY:n.y,x:W1,y:Y1}}),!U1)p.stopPropagation(),p.preventDefault()};function V(p,e){let{userSelectionRect:$1}=A.getState();if(!$1)return;let{transform:U1,nodeLookup:q1,edgeLookup:K1,connectionLookup:W1,triggerNodeChanges:Y1,triggerEdgeChanges:n,defaultEdgeOptions:R1}=A.getState(),H1={x:$1.startX,y:$1.startY},{x:x1,y:a1}=k2(H1,U1),i1={startX:H1.x,startY:H1.y,x:p<x1?p:x1,y:e<a1?e:a1,width:Math.abs(p-x1),height:Math.abs(e-a1)},k0=k.current,B0=u.current;k.current=new Set(w4(q1,i1,U1,J===S2.Partial,!0).map((J0)=>J0.id)),u.current=new Set;let w0=R1?.selectable??!0;for(let J0 of k.current){let Z0=W1.get(J0);if(!Z0)continue;for(let{edgeId:n1}of Z0.values()){let Y0=K1.get(n1);if(Y0&&(Y0.selectable??w0))u.current.add(n1)}}if(!b6(k0,k.current)){let J0=G5(q1,k.current,!0);Y1(J0)}if(!b6(B0,u.current)){let J0=G5(K1,u.current);n(J0)}A.setState({userSelectionRect:i1,userSelectionActive:!0,nodesSelectionActive:!1})}function D(){if(!U||!N.current)return;let[p,e]=P4(S.current,N.current,C);P({x:p,y:e}).then(($1)=>{if(!l.current||!$1){R.current=requestAnimationFrame(D);return}let{x:U1,y:q1}=S.current;V(U1,q1),R.current=requestAnimationFrame(D)})}let y=()=>{cancelAnimationFrame(R.current),R.current=0,b.current=!1};d.useEffect(()=>{return()=>y()},[]);let t=(p)=>{let{userSelectionRect:e,transform:$1,resetSelectedElements:U1}=A.getState();if(!N.current||!e)return;let{x:q1,y:K1}=T0(p.nativeEvent,N.current);S.current={x:q1,y:K1};let W1=k2({x:e.startX,y:e.startY},$1);if(!l.current){let Y1=Q?0:G;if(Math.hypot(q1-W1.x,K1-W1.y)<=Y1)return;U1(),F?.(p)}if(l.current=!0,!b.current)D(),b.current=!0;V(q1,K1)},_1=(p)=>{if(!f){if(p.target===v.current&&A.getState().connection.inProgress)i.current=!0;return}if(p.button!==0)return;if(p.target?.releasePointerCapture?.(p.pointerId),!O&&p.target===v.current&&A.getState().userSelectionRect)h?.(p);if(A.setState({userSelectionActive:!1,userSelectionRect:null}),l.current)X?.(p),A.setState({nodesSelectionActive:k.current.size>0});y()},a=(p)=>{p.target?.releasePointerCapture?.(p.pointerId),y()},o=q===!0||Array.isArray(q)&&q.includes(0);return r.jsxs("div",{className:m1(["react-flow__pane",{draggable:o,dragging:M,selection:_}]),onClick:f?void 0:t6(h,v),onContextMenu:t6(E,v),onWheel:t6(j,v),onPointerEnter:f?void 0:L,onPointerMove:f?t:z,onPointerUp:_1,onPointerCancel:f?a:void 0,onPointerDownCapture:f?I:void 0,onClickCapture:f?m:void 0,onPointerLeave:W,ref:v,style:g4,children:[w,r.jsx(bU,{})]})}function n6({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",H0.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 n9({nodeRef:_,disabled:Q=!1,noDragClassName:J,handleSelector:q,nodeId:U,isSelectable:G,nodeClickDistance:Z}){let F=b1(),[X,Y]=d.useState(!1),K=d.useRef();return d.useEffect(()=>{if(Q)return;return K.current=i7({getStoreItems:()=>F.getState(),onNodeMouseDown:(H)=>{n6({id:H,store:F,nodeRef:_})},onDragStart:()=>{Y(!0)},onDragStop:()=>{Y(!1)}}),()=>{K.current?.destroy(),K.current=void 0}},[Q,F,_]),d.useEffect(()=>{if(Q||!_.current||!K.current)return;K.current.update({noDragClassName:J,handleSelector:q,domNode:_.current,isSelectable:G,nodeId:U,nodeClickDistance:Z})},[J,q,Q,G,_,U,Z]),X}var mU=(_)=>(Q)=>Q.selected&&(Q.draggable||_&&typeof Q.draggable>"u");function e9(){let _=b1();return d.useCallback((J)=>{let{nodeExtent:q,snapToGrid:U,snapGrid:G,nodesDraggable:Z,onError:F,updateNodePositions:X,nodeLookup:Y,nodeOrigin:K}=_.getState(),H=new Map,L=mU(Z),z=U?G[0]:5,W=U?G[1]:5,w=J.direction.x*z*J.factor,R=J.direction.y*W*J.factor;for(let[,A]of Y){if(!L(A))continue;let O={x:A.internals.positionAbsolute.x+w,y:A.internals.positionAbsolute.y+R};if(U)O=$5(O,G);let{position:B,positionAbsolute:M}=y6({nodeId:A.id,nextPosition:O,nodeLookup:Y,nodeExtent:q,nodeOrigin:K,onError:F});A.position=B,A.internals.positionAbsolute=M,H.set(A.id,A)}X(H)},[])}var e6=d.createContext(null),gU=e6.Provider;e6.Consumer;var _8=()=>{return d.useContext(e6)},pU=(_)=>({connectOnClick:_.connectOnClick,noPanClassName:_.noPanClassName,rfId:_.rfId}),__=d.createContext(null);function cU({children:_}){let Q=N1(pU,D1);return r.jsx(__.Provider,{value:Q,children:_})}function lU(){let _=d.useContext(__);if(!_)throw Error("useHandleConfig must be used within a HandleConfigProvider");return _}var iU={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},rU=(_,Q,J)=>(q)=>{let{connectionClickStartHandle:U,connectionMode:G,connection:Z}=q,{fromHandle:F,toHandle:X,isValid:Y}=Z;if(!F&&!U)return iU;let K=X?.nodeId===_&&X?.id===Q&&X?.type===J;return{connectingFrom:F?.nodeId===_&&F?.id===Q&&F?.type===J,connectingTo:K,clickConnecting:U?.nodeId===_&&U?.id===Q&&U?.type===J,isPossibleEndHandle:G===L2.Strict?F?.type!==J:_!==F?.nodeId||Q!==F?.id,connectionInProcess:!!F,clickConnectionInProcess:!!U,valid:K&&Y}};function dU({type:_="source",position:Q=F1.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,w=_==="target",R=b1(),A=_8(),{connectOnClick:O,noPanClassName:B,rfId:M}=lU(),{connectingFrom:P,connectingTo:C,clickConnecting:f,isPossibleEndHandle:v,connectionInProcess:N,clickConnectionInProcess:k,valid:u}=N1(rU(A,W,_),D1);if(!A)R.getState().onError?.("010",H0.error010());let i=(b)=>{let{defaultEdgeOptions:h,onConnect:E,hasDefaultEdges:j}=R.getState(),m={...h,...b};if(j){let{edges:I,setEdges:V,onError:D}=R.getState();V(NU(m,I,{onError:D}))}E?.(m),F?.(m)},l=(b)=>{if(!A)return;let h=g6(b.nativeEvent);if(U&&(h&&b.button===0||!h)){let E=R.getState();u4.onPointerDown(b.nativeEvent,{handleDomNode:b.currentTarget,autoPanOnConnect:E.autoPanOnConnect,connectionMode:E.connectionMode,connectionRadius:E.connectionRadius,domNode:E.domNode,nodeLookup:E.nodeLookup,lib:E.lib,isTarget:w,handleId:W,nodeId:A,flowId:E.rfId,panBy:E.panBy,cancelConnection:E.cancelConnection,onConnectStart:E.onConnectStart,onConnectEnd:(...j)=>R.getState().onConnectEnd?.(...j),updateConnection:E.updateConnection,onConnect:i,isValidConnection:J||((...j)=>R.getState().isValidConnection?.(...j)??!0),getTransform:()=>R.getState().transform,getFromHandle:()=>R.getState().connection.fromHandle,autoPanSpeed:E.autoPanSpeed,dragThreshold:E.connectionDragThreshold})}if(h)K?.(b);else H?.(b)},S=(b)=>{let{onClickConnectStart:h,onClickConnectEnd:E,connectionClickStartHandle:j,connectionMode:m,isValidConnection:I,lib:V,rfId:D,nodeLookup:y,connection:t}=R.getState();if(!A||!j&&!U)return;if(!j){h?.(b.nativeEvent,{nodeId:A,handleId:W,handleType:_}),R.setState({connectionClickStartHandle:{nodeId:A,type:_,id:W}});return}let _1=x6(b.target),a=J||I,{connection:o,isValid:p}=u4.isValid(b.nativeEvent,{handle:{nodeId:A,id:W,type:_},connectionMode:m,fromNodeId:j.nodeId,fromHandleId:j.id||null,fromType:j.type,isValidConnection:a,flowId:D,doc:_1,lib:V,nodeLookup:y});if(p&&o)i(o);let e=structuredClone(t);delete e.inProgress,e.toPosition=e.toHandle?e.toHandle.position:null,E?.(b,e),R.setState({connectionClickStartHandle:null})};return r.jsx("div",{"data-handleid":W,"data-nodeid":A,"data-handlepos":Q,"data-id":`${M}-${A}-${W}-${_}`,className:m1(["react-flow__handle",`react-flow__handle-${Q}`,"nodrag",B,Y,{source:!w,target:w,connectable:q,connectablestart:U,connectableend:G,clickconnecting:f,connectingfrom:P,connectingto:C,valid:u,connectionindicator:q&&(!N||v)&&(N||k?G:U)}]),onMouseDown:l,onTouchStart:l,onClick:O?S:void 0,ref:z,...L,children:X})}var E4=d.memo(s9(dU));function aU({data:_,isConnectable:Q,sourcePosition:J=F1.Bottom}){return r.jsxs(r.Fragment,{children:[_?.label,r.jsx(E4,{type:"source",position:J,isConnectable:Q})]})}function sU({data:_,isConnectable:Q,targetPosition:J=F1.Top,sourcePosition:q=F1.Bottom}){return r.jsxs(r.Fragment,{children:[r.jsx(E4,{type:"target",position:J,isConnectable:Q}),_?.label,r.jsx(E4,{type:"source",position:q,isConnectable:Q})]})}function tU(){return null}function oU({data:_,isConnectable:Q,targetPosition:J=F1.Top}){return r.jsxs(r.Fragment,{children:[r.jsx(E4,{type:"target",position:J,isConnectable:Q}),_?.label]})}var x4={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},S9={input:aU,default:sU,output:oU,group:tU};function nU(_){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 eU=(_)=>{let{width:Q,height:J,x:q,y:U}=j2(_.nodeLookup,{filter:(G)=>!!G.selected});return{width:M0(Q)?Q:null,height:M0(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=b1(),{width:U,height:G,transformString:Z,userSelectionActive:F}=N1(eU,D1),X=e9(),Y=d.useRef(null);d.useEffect(()=>{if(!J)Y.current?.focus({preventScroll:!0})},[J]);let K=!F&&U!==null&&G!==null;if(n9({nodeRef:Y,disabled:!K}),!K)return null;let H=_?(z)=>{let W=q.getState().nodes.filter((w)=>w.selected);_(z,W)}:void 0,L=(z)=>{if(Object.prototype.hasOwnProperty.call(x4,z.key))z.preventDefault(),X({direction:x4[z.key],factor:z.shiftKey?4:1})};return r.jsx("div",{className:m1(["react-flow__nodesselection","react-flow__container",Q]),style:{transform:Z},children:r.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 v9=typeof window<"u"?window:void 0,QG=(_)=>{return{nodesSelectionActive:_.nodesSelectionActive,userSelectionActive:_.userSelectionActive}};function Q_({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:w,zoomActivationKeyCode:R,elementsSelectable:A,zoomOnScroll:O,zoomOnPinch:B,panOnScroll:M,panOnScrollSpeed:P,panOnScrollMode:C,zoomOnDoubleClick:f,panOnDrag:v,autoPanOnSelection:N,defaultViewport:k,translateExtent:u,minZoom:i,maxZoom:l,preventScrolling:S,onSelectionContextMenu:b,noWheelClassName:h,noPanClassName:E,disableKeyboardA11y:j,onViewportChange:m,isControlledViewport:I}){let{nodesSelectionActive:V,userSelectionActive:D}=N1(QG,D1),y=p5(Y,{target:v9}),t=p5(w,{target:v9}),_1=t||v,a=t||M,o=K&&_1!==!0,p=y||D||o;return jU({deleteKeyCode:X,multiSelectionKeyCode:W}),r.jsx(hU,{onPaneContextMenu:G,elementsSelectable:A,zoomOnScroll:O,zoomOnPinch:B,panOnScroll:a,panActivationKeyPressed:t,panOnScrollSpeed:P,panOnScrollMode:C,zoomOnDoubleClick:f,panOnDrag:!y&&_1,defaultViewport:k,translateExtent:u,minZoom:i,maxZoom:l,zoomActivationKeyCode:R,preventScrolling:S,noWheelClassName:h,noPanClassName:E,onViewportChange:m,isControlledViewport:I,paneClickDistance:F,selectionOnDrag:o,children:r.jsxs(xU,{onSelectionStart:L,onSelectionEnd:z,onPaneClick:Q,onPaneMouseEnter:J,onPaneMouseMove:q,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:Z,panOnDrag:_1,autoPanOnSelection:N,isSelecting:!!p,selectionMode:H,selectionKeyPressed:y,paneClickDistance:F,selectionOnDrag:o,children:[_,V&&r.jsx(_G,{onSelectionContextMenu:b,noPanClassName:E,disableKeyboardA11y:j})]})})}Q_.displayName="FlowRenderer";var JG=d.memo(Q_),$G=(_)=>(Q)=>{return _?w4(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 qG(_){return N1(d.useCallback($G(_),[_]),D1)}var UG=(_)=>_.updateNodeInternals;function GG(){let _=N1(UG),[Q]=d.useState(()=>{if(typeof ResizeObserver>"u")return null;return new ResizeObserver((J)=>{let q=new Map;J.forEach((U)=>{let G=U.target.getAttribute("data-id");q.set(G,{id:G,nodeElement:U.target,force:!0})}),_(q)})});return d.useEffect(()=>{return()=>{Q?.disconnect()}},[Q]),Q}function ZG({node:_,nodeType:Q,hasDimensions:J,resizeObserver:q}){let U=b1(),G=d.useRef(null),Z=d.useRef(null),F=d.useRef(_.sourcePosition),X=d.useRef(_.targetPosition),Y=d.useRef(Q),K=J&&!!_.internals.handleBounds;return d.useEffect(()=>{if(G.current&&!_.hidden&&(!K||Z.current!==G.current)){if(Z.current)q?.unobserve(Z.current);q?.observe(G.current),Z.current=G.current}},[K,_.hidden]),d.useEffect(()=>{return()=>{if(Z.current)q?.unobserve(Z.current),Z.current=null}},[]),d.useEffect(()=>{if(G.current){let H=Y.current!==Q,L=F.current!==_.sourcePosition,z=X.current!==_.targetPosition;if(H||L||z)Y.current=Q,F.current=_.sourcePosition,X.current=_.targetPosition,U.getState().updateNodeInternals(new Map([[_.id,{id:_.id,nodeElement:G.current,force:!0}]]))}},[_.id,Q,_.sourcePosition,_.targetPosition]),G}function FG({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:w,nodeTypes:R,nodeClickDistance:A,onError:O}){let{node:B,internals:M,isParent:P}=N1((p)=>{let e=p.nodeLookup.get(_),$1=p.parentLookup.has(_);return{node:e,internals:e.internals,isParent:$1}},D1),C=B.type||"default",f=R?.[C]||S9[C];if(f===void 0)O?.("003",H0.error003(C)),C="default",f=R?.default||S9.default;let v=!!(B.draggable||F&&typeof B.draggable>"u"),N=!!(B.selectable||X&&typeof B.selectable>"u"),k=!!(B.connectable||Y&&typeof B.connectable>"u"),u=!!(B.focusable||K&&typeof B.focusable>"u"),i=b1(),l=h6(B),S=ZG({node:B,nodeType:C,hasDimensions:l,resizeObserver:H}),b=n9({nodeRef:S,disabled:B.hidden||!v,noDragClassName:L,handleSelector:B.dragHandle,nodeId:_,isSelectable:N,nodeClickDistance:A}),h=e9();if(B.hidden)return null;let E=R0(B),j=nU(B),m=N||v||Q||J||q||U,I=J?(p)=>J(p,{...M.userNode}):void 0,V=q?(p)=>q(p,{...M.userNode}):void 0,D=U?(p)=>U(p,{...M.userNode}):void 0,y=G?(p)=>G(p,{...M.userNode}):void 0,t=Z?(p)=>Z(p,{...M.userNode}):void 0,_1=(p)=>{let{selectNodesOnDrag:e,nodeDragThreshold:$1}=i.getState();if(N&&(!e||!v||$1>0))n6({id:_,store:i,nodeRef:S});if(Q)Q(p,{...M.userNode})},a=(p)=>{if(m6(p.nativeEvent)||W)return;if(N6.includes(p.key)&&N){let e=p.key==="Escape";n6({id:_,store:i,unselect:e,nodeRef:S})}else if(v&&B.selected&&Object.prototype.hasOwnProperty.call(x4,p.key)){p.preventDefault();let{ariaLabelConfig:e}=i.getState();i.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:p.key.replace("Arrow","").toLowerCase(),x:~~M.positionAbsolute.x,y:~~M.positionAbsolute.y})}),h({direction:x4[p.key],factor:p.shiftKey?4:1})}},o=()=>{if(W||!S.current?.matches(":focus-visible"))return;let{transform:p,width:e,height:$1,autoPanOnNodeFocus:U1,setCenter:q1}=i.getState();if(!U1)return;if(!(w4(new Map([[_,B]]),{x:0,y:0,width:e,height:$1},p,!0).length>0))q1(B.position.x+E.width/2,B.position.y+E.height/2,{zoom:p[2]})};return r.jsx("div",{className:m1(["react-flow__node",`react-flow__node-${C}`,{[z]:v},B.className,{selected:B.selected,selectable:N,parent:P,draggable:v,dragging:b}]),ref:S,style:{zIndex:M.z,transform:`translate(${M.positionAbsolute.x}px,${M.positionAbsolute.y}px)`,pointerEvents:m?"all":"none",visibility:l?"visible":"hidden",...B.style,...j},"data-id":_,"data-testid":`rf__node-${_}`,onMouseEnter:I,onMouseMove:V,onMouseLeave:D,onContextMenu:y,onClick:_1,onDoubleClick:t,onKeyDown:u?a:void 0,tabIndex:u?0:void 0,onFocus:u?o:void 0,role:B.ariaRole??(u?"group":void 0),"aria-roledescription":"node","aria-describedby":W?void 0:`${l9}-${w}`,"aria-label":B.ariaLabel,...B.domAttributes,children:r.jsx(gU,{value:_,children:r.jsx(f,{id:_,data:B.data,type:C,positionAbsoluteX:M.positionAbsolute.x,positionAbsoluteY:M.positionAbsolute.y,selected:B.selected??!1,selectable:N,draggable:v,deletable:B.deletable??!0,isConnectable:k,sourcePosition:B.sourcePosition,targetPosition:B.targetPosition,dragging:b,dragHandle:B.dragHandle,zIndex:M.z,parentId:B.parentId,...E})})})}var HG=d.memo(FG),XG=(_)=>({nodesConnectable:_.nodesConnectable,nodesFocusable:_.nodesFocusable,elementsSelectable:_.elementsSelectable,onError:_.onError});function J_(_){let{nodesConnectable:Q,nodesFocusable:J,elementsSelectable:q,onError:U}=N1(XG,D1),G=qG(_.onlyRenderVisibleElements),Z=GG();return r.jsx("div",{className:"react-flow__nodes",style:g4,children:G.map((F)=>{return r.jsx(HG,{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)})})}J_.displayName="NodeRenderer";var KG=d.memo(J_);function YG(_){return N1(d.useCallback((J)=>{if(!_)return J.edges.map((U)=>U.id);let q=[];if(J.width&&J.height)for(let U of J.edges){let G=J.nodeLookup.get(U.source),Z=J.nodeLookup.get(U.target);if(G&&Z&&u7({sourceNode:G,targetNode:Z,width:J.width,height:J.height,transform:J.transform}))q.push(U.id)}return q},[_]),D1)}var LG=({color:_="none",strokeWidth:Q=1})=>{let J={strokeWidth:Q,..._&&{stroke:_}};return r.jsx("polyline",{className:"arrow",style:J,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},zG=({color:_="none",strokeWidth:Q=1})=>{let J={strokeWidth:Q,..._&&{stroke:_,fill:_}};return r.jsx("polyline",{className:"arrowclosed",style:J,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},k9={[e2.Arrow]:LG,[e2.ArrowClosed]:zG};function WG(_){let Q=b1();return d.useMemo(()=>{if(!Object.prototype.hasOwnProperty.call(k9,_))return Q.getState().onError?.("009",H0.error009(_)),null;return k9[_]},[_])}var BG=({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=WG(Q);if(!X)return null;return r.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:r.jsx(X,{color:J,strokeWidth:Z})})},$_=({defaultColor:_,rfId:Q})=>{let J=N1((G)=>G.edges),q=N1((G)=>G.defaultEdgeOptions),U=d.useMemo(()=>{return b7(J,{id:Q,defaultColor:_,defaultMarkerStart:q?.markerStart,defaultMarkerEnd:q?.markerEnd})},[J,q,Q,_]);if(!U.length)return null;return r.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:r.jsx("defs",{children:U.map((G)=>r.jsx(BG,{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))})})};$_.displayName="MarkerDefinitions";var AG=d.memo($_);function q_({x:_,y:Q,label:J,labelStyle:q,labelShowBg:U=!0,labelBgStyle:G,labelBgPadding:Z=[2,4],labelBgBorderRadius:F=2,children:X,className:Y,...K}){let[H,L]=d.useState({x:1,y:0,width:0,height:0}),z=m1(["react-flow__edge-textwrapper",Y]),W=d.useRef(null);if(d.useEffect(()=>{if(W.current){let w=W.current.getBBox();L({x:w.x,y:w.y,width:w.width,height:w.height})}},[J]),!J)return null;return r.jsxs("g",{transform:`translate(${_-H.width/2} ${Q-H.height/2})`,className:z,visibility:H.width?"visible":"hidden",...K,children:[U&&r.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}),r.jsx("text",{className:"react-flow__edge-text",y:H.height/2,dy:"0.3em",ref:W,style:q,children:J}),X]})}q_.displayName="EdgeText";var MG=d.memo(q_);function p4({path:_,labelX:Q,labelY:J,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:X,interactionWidth:Y=20,...K}){return r.jsxs(r.Fragment,{children:[r.jsx("path",{...K,d:_,fill:"none",className:m1(["react-flow__edge-path",K.className])}),Y?r.jsx("path",{d:_,fill:"none",strokeOpacity:0,strokeWidth:Y,className:"react-flow__edge-interaction"}):null,q&&M0(Q)&&M0(J)?r.jsx(MG,{x:Q,y:J,label:q,labelStyle:U,labelShowBg:G,labelBgStyle:Z,labelBgPadding:F,labelBgBorderRadius:X}):null]})}function y9({pos:_,x1:Q,y1:J,x2:q,y2:U}){if(_===F1.Left||_===F1.Right)return[0.5*(Q+q),J];return[Q,0.5*(J+U)]}function U_({sourceX:_,sourceY:Q,sourcePosition:J=F1.Bottom,targetX:q,targetY:U,targetPosition:G=F1.Top}){let[Z,F]=y9({pos:J,x1:_,y1:Q,x2:q,y2:U}),[X,Y]=y9({pos:G,x1:q,y1:U,x2:_,y2:Q}),[K,H,L,z]=S4({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 G_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,sourcePosition:Z,targetPosition:F,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:w,markerStart:R,interactionWidth:A})=>{let[O,B,M]=U_({sourceX:J,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F}),P=_.isInternal?void 0:Q;return r.jsx(p4,{id:P,path:O,labelX:B,labelY:M,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:w,markerStart:R,interactionWidth:A})})}var TG=G_({isInternal:!1}),Z_=G_({isInternal:!0});TG.displayName="SimpleBezierEdge";Z_.displayName="SimpleBezierEdgeInternal";function F_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,sourcePosition:z=F1.Bottom,targetPosition:W=F1.Top,markerEnd:w,markerStart:R,pathOptions:A,interactionWidth:O})=>{let[B,M,P]=g5({sourceX:J,sourceY:q,sourcePosition:z,targetX:U,targetY:G,targetPosition:W,borderRadius:A?.borderRadius,offset:A?.offset,stepPosition:A?.stepPosition}),C=_.isInternal?void 0:Q;return r.jsx(p4,{id:C,path:B,labelX:M,labelY:P,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:w,markerStart:R,interactionWidth:O})})}var H_=F_({isInternal:!1}),X_=F_({isInternal:!0});H_.displayName="SmoothStepEdge";X_.displayName="SmoothStepEdgeInternal";function K_(_){return d.memo(({id:Q,...J})=>{let q=_.isInternal?void 0:Q;return r.jsx(H_,{...J,id:q,pathOptions:d.useMemo(()=>({borderRadius:0,offset:J.pathOptions?.offset}),[J.pathOptions?.offset])})})}var RG=K_({isInternal:!1}),Y_=K_({isInternal:!0});RG.displayName="StepEdge";Y_.displayName="StepEdgeInternal";function L_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:z,markerStart:W,interactionWidth:w})=>{let[R,A,O]=k4({sourceX:J,sourceY:q,targetX:U,targetY:G}),B=_.isInternal?void 0:Q;return r.jsx(p4,{id:B,path:R,labelX:A,labelY:O,label:Z,labelStyle:F,labelShowBg:X,labelBgStyle:Y,labelBgPadding:K,labelBgBorderRadius:H,style:L,markerEnd:z,markerStart:W,interactionWidth:w})})}var OG=L_({isInternal:!1}),z_=L_({isInternal:!0});OG.displayName="StraightEdge";z_.displayName="StraightEdgeInternal";function W_(_){return d.memo(({id:Q,sourceX:J,sourceY:q,targetX:U,targetY:G,sourcePosition:Z=F1.Bottom,targetPosition:F=F1.Top,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:w,markerStart:R,pathOptions:A,interactionWidth:O})=>{let[B,M,P]=v4({sourceX:J,sourceY:q,sourcePosition:Z,targetX:U,targetY:G,targetPosition:F,curvature:A?.curvature}),C=_.isInternal?void 0:Q;return r.jsx(p4,{id:C,path:B,labelX:M,labelY:P,label:X,labelStyle:Y,labelShowBg:K,labelBgStyle:H,labelBgPadding:L,labelBgBorderRadius:z,style:W,markerEnd:w,markerStart:R,interactionWidth:O})})}var IG=W_({isInternal:!1}),B_=W_({isInternal:!0});IG.displayName="BezierEdge";B_.displayName="BezierEdgeInternal";var j9={default:B_,straight:z_,step:Y_,smoothstep:X_,simplebezier:Z_},V9={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},wG=(_,Q,J)=>{if(J===F1.Left)return _-Q;if(J===F1.Right)return _+Q;return _},PG=(_,Q,J)=>{if(J===F1.Top)return _-Q;if(J===F1.Bottom)return _+Q;return _},u9="react-flow__edgeupdater";function h9({position:_,centerX:Q,centerY:J,radius:q=10,onMouseDown:U,onMouseEnter:G,onMouseOut:Z,type:F}){return r.jsx("circle",{onMouseDown:U,onMouseEnter:G,onMouseOut:Z,className:m1([u9,`${u9}-${F}`]),cx:wG(Q,q,_),cy:PG(J,q,_),r:q,stroke:"transparent",fill:"transparent"})}function NG({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=b1(),w=(M,P)=>{if(M.button!==0)return;let{autoPanOnConnect:C,domNode:f,connectionMode:v,connectionRadius:N,lib:k,onConnectStart:u,cancelConnection:i,nodeLookup:l,rfId:S,panBy:b,updateConnection:h}=W.getState(),E=P.type==="target",j=(V,D)=>{L(!1),H?.(V,J,P.type,D)},m=(V)=>Y?.(J,V),I=(V,D)=>{L(!0),K?.(M,J,P.type),u?.(V,D)};u4.onPointerDown(M.nativeEvent,{autoPanOnConnect:C,connectionMode:v,connectionRadius:N,domNode:f,handleId:P.id,nodeId:P.nodeId,nodeLookup:l,isTarget:E,edgeUpdaterType:P.type,lib:k,flowId:S,cancelConnection:i,panBy:b,isValidConnection:(...V)=>W.getState().isValidConnection?.(...V)??!0,onConnect:m,onConnectStart:I,onConnectEnd:(...V)=>W.getState().onConnectEnd?.(...V),onReconnectEnd:j,updateConnection:h,getTransform:()=>W.getState().transform,getFromHandle:()=>W.getState().connection.fromHandle,dragThreshold:W.getState().connectionDragThreshold,handleDomNode:M.currentTarget})},R=(M)=>w(M,{nodeId:J.target,id:J.targetHandle??null,type:"target"}),A=(M)=>w(M,{nodeId:J.source,id:J.sourceHandle??null,type:"source"}),O=()=>z(!0),B=()=>z(!1);return r.jsxs(r.Fragment,{children:[(_===!0||_==="source")&&r.jsx(h9,{position:F,centerX:q,centerY:U,radius:Q,onMouseDown:R,onMouseEnter:O,onMouseOut:B,type:"source"}),(_===!0||_==="target")&&r.jsx(h9,{position:X,centerX:G,centerY:Z,radius:Q,onMouseDown:A,onMouseEnter:O,onMouseOut:B,type:"target"})]})}function fG({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:w,noPanClassName:R,onError:A,disableKeyboardA11y:O}){let B=N1((q1)=>q1.edgeLookup.get(_)),M=N1((q1)=>q1.defaultEdgeOptions);B=M?{...M,...B}:B;let P=B.type||"default",C=w?.[P]||j9[P];if(C===void 0)A?.("011",H0.error011(P)),P="default",C=w?.default||j9.default;let f=!!(B.focusable||Q&&typeof B.focusable>"u"),v=typeof H<"u"&&(B.reconnectable||J&&typeof B.reconnectable>"u"),N=!!(B.selectable||q&&typeof B.selectable>"u"),k=d.useRef(null),[u,i]=d.useState(!1),[l,S]=d.useState(!1),b=b1(),{zIndex:h=B.zIndex,sourceX:E,sourceY:j,targetX:m,targetY:I,sourcePosition:V,targetPosition:D}=N1(d.useCallback((q1)=>{let K1=q1.nodeLookup.get(B.source),W1=q1.nodeLookup.get(B.target);if(!K1||!W1)return V9;let Y1=D7({id:_,sourceNode:K1,targetNode:W1,sourceHandle:B.sourceHandle||null,targetHandle:B.targetHandle||null,connectionMode:q1.connectionMode,onError:A}),n=V7({selected:B.selected,zIndex:B.zIndex,sourceNode:K1,targetNode:W1,elevateOnSelect:q1.elevateEdgesOnSelect,zIndexMode:q1.zIndexMode});return{...Y1||V9,zIndex:n}},[B.source,B.target,B.sourceHandle,B.targetHandle,B.selected,B.zIndex,A]),D1),y=d.useMemo(()=>B.markerStart?`url('#${y4(B.markerStart,W)}')`:void 0,[B.markerStart,W]),t=d.useMemo(()=>B.markerEnd?`url('#${y4(B.markerEnd,W)}')`:void 0,[B.markerEnd,W]);if(B.hidden||E===null||j===null||m===null||I===null)return null;let _1=(q1)=>{let{addSelectedEdges:K1,unselectNodesAndEdges:W1,multiSelectionActive:Y1}=b.getState();if(N)if(b.setState({nodesSelectionActive:!1}),B.selected&&Y1)W1({nodes:[],edges:[B]}),k.current?.blur();else K1([_]);if(U)U(q1,B)},a=G?(q1)=>{G(q1,{...B})}:void 0,o=Z?(q1)=>{Z(q1,{...B})}:void 0,p=F?(q1)=>{F(q1,{...B})}:void 0,e=X?(q1)=>{X(q1,{...B})}:void 0,$1=Y?(q1)=>{Y(q1,{...B})}:void 0,U1=(q1)=>{if(!O&&N6.includes(q1.key)&&N){let{unselectNodesAndEdges:K1,addSelectedEdges:W1}=b.getState();if(q1.key==="Escape")k.current?.blur(),K1({edges:[B]});else W1([_])}};return r.jsx("svg",{style:{zIndex:h},children:r.jsxs("g",{className:m1(["react-flow__edge",`react-flow__edge-${P}`,B.className,R,{selected:B.selected,animated:B.animated,inactive:!N&&!U,updating:u,selectable:N}]),onClick:_1,onDoubleClick:a,onContextMenu:o,onMouseEnter:p,onMouseMove:e,onMouseLeave:$1,onKeyDown:f?U1:void 0,tabIndex:f?0:void 0,role:B.ariaRole??(f?"group":"img"),"aria-roledescription":"edge","data-id":_,"data-testid":`rf__edge-${_}`,"aria-label":B.ariaLabel===null?void 0:B.ariaLabel||`Edge from ${B.source} to ${B.target}`,"aria-describedby":f?`${i9}-${W}`:void 0,ref:k,...B.domAttributes,children:[!l&&r.jsx(C,{id:_,source:B.source,target:B.target,type:B.type,selected:B.selected,animated:B.animated,selectable:N,deletable:B.deletable??!0,label:B.label,labelStyle:B.labelStyle,labelShowBg:B.labelShowBg,labelBgStyle:B.labelBgStyle,labelBgPadding:B.labelBgPadding,labelBgBorderRadius:B.labelBgBorderRadius,sourceX:E,sourceY:j,targetX:m,targetY:I,sourcePosition:V,targetPosition:D,data:B.data,style:B.style,sourceHandleId:B.sourceHandle,targetHandleId:B.targetHandle,markerStart:y,markerEnd:t,pathOptions:"pathOptions"in B?B.pathOptions:void 0,interactionWidth:B.interactionWidth}),v&&r.jsx(NG,{edge:B,isReconnectable:v,reconnectRadius:K,onReconnect:H,onReconnectStart:L,onReconnectEnd:z,sourceX:E,sourceY:j,targetX:m,targetY:I,sourcePosition:V,targetPosition:D,setUpdateHover:i,setReconnecting:S})]})})}var CG=d.memo(fG),SG=(_)=>({edgesFocusable:_.edgesFocusable,edgesReconnectable:_.edgesReconnectable,elementsSelectable:_.elementsSelectable,connectionMode:_.connectionMode,onError:_.onError});function A_({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:w}){let{edgesFocusable:R,edgesReconnectable:A,elementsSelectable:O,onError:B}=N1(SG,D1),M=YG(Q);return r.jsxs("div",{className:"react-flow__edges",children:[r.jsx(AG,{defaultColor:_,rfId:J}),M.map((P)=>{return r.jsx(CG,{id:P,edgesFocusable:R,edgesReconnectable:A,elementsSelectable:O,noPanClassName:U,onReconnect:G,onContextMenu:Z,onMouseEnter:F,onMouseMove:X,onMouseLeave:Y,onClick:K,reconnectRadius:H,onDoubleClick:L,onReconnectStart:z,onReconnectEnd:W,rfId:J,onError:B,edgeTypes:q,disableKeyboardA11y:w},P)})]})}A_.displayName="EdgeRenderer";var vG=d.memo(A_),D9=(_)=>`translate(${_[0]}px,${_[1]}px) scale(${_[2]})`;function kG({children:_}){let Q=b1(),J=d.useRef(null),[q]=d.useState(()=>Q.getState().transform);return t9(()=>{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=D9(Z)};return G(),Q.subscribe(G)},[Q]),r.jsx("div",{ref:J,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:D9(q)},children:_})}function yG(_){let Q=c5(),J=d.useRef(!1);d.useEffect(()=>{if(!J.current&&Q.viewportInitialized&&_)setTimeout(()=>_(Q),1),J.current=!0},[_,Q.viewportInitialized])}var jG=(_)=>_.panZoom?.syncViewport;function VG(_){let Q=N1(jG),J=b1();return d.useEffect(()=>{if(_)Q?.(_),J.setState({transform:[_.x,_.y,_.zoom]})},[_,Q]),null}function b9(_){return _.connection.inProgress?{..._.connection,to:q5(_.connection.to,_.transform)}:{..._.connection}}function uG(_){if(_)return(J)=>{let q=b9(J);return _(q)};return b9}function hG(_){let Q=uG(_);return N1(Q,D1)}var DG=(_)=>({nodesConnectable:_.nodesConnectable,isValid:_.connection.isValid,inProgress:_.connection.inProgress,width:_.width,height:_.height});function bG({containerStyle:_,style:Q,type:J,component:q}){let{nodesConnectable:U,width:G,height:Z,isValid:F,inProgress:X}=N1(DG,D1);if(!(G&&U&&X))return null;return r.jsx("svg",{style:_,width:G,height:Z,className:"react-flow__connectionline react-flow__container",children:r.jsx("g",{className:m1(["react-flow__connection",E6(F)]),children:r.jsx(M_,{style:Q,type:J,CustomComponent:q,isValid:F})})})}var M_=({style:_,type:Q=E0.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}=hG();if(!U)return;if(J)return r.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:E6(q),toNode:K,toHandle:H,pointer:z});let W="",w={sourceX:G.x,sourceY:G.y,sourcePosition:X,targetX:Y.x,targetY:Y.y,targetPosition:L};switch(Q){case E0.Bezier:[W]=v4(w);break;case E0.SimpleBezier:[W]=U_(w);break;case E0.Step:[W]=g5({...w,borderRadius:0});break;case E0.SmoothStep:[W]=g5(w);break;default:[W]=k4(w)}return r.jsx("path",{d:W,fill:"none",className:"react-flow__connection-path",style:_})};M_.displayName="ConnectionLine";var EG={};function E9(_=EG){let Q=d.useRef(_),J=b1();d.useEffect(()=>{{let q=new Set([...Object.keys(Q.current),...Object.keys(_)]);for(let U of q)if(Q.current[U]!==_[U]){J.getState().onError?.("002",H0.error002());break}Q.current=_}},[_])}function xG(){let _=b1(),Q=d.useRef(!1);d.useEffect(()=>{if(!Q.current){let J=document.querySelector(".react-flow__pane");if(J&&window.getComputedStyle(J).zIndex!=="1")_.getState().onError?.("013",H0.error013("react"));Q.current=!0}},[])}function T_({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:w,connectionLineComponent:R,connectionLineContainerStyle:A,selectionKeyCode:O,selectionOnDrag:B,selectionMode:M,multiSelectionKeyCode:P,panActivationKeyCode:C,zoomActivationKeyCode:f,deleteKeyCode:v,onlyRenderVisibleElements:N,elementsSelectable:k,defaultViewport:u,translateExtent:i,minZoom:l,maxZoom:S,preventScrolling:b,defaultMarkerColor:h,zoomOnScroll:E,zoomOnPinch:j,panOnScroll:m,panOnScrollSpeed:I,panOnScrollMode:V,zoomOnDoubleClick:D,panOnDrag:y,autoPanOnSelection:t,onPaneClick:_1,onPaneMouseEnter:a,onPaneMouseMove:o,onPaneMouseLeave:p,onPaneScroll:e,onPaneContextMenu:$1,paneClickDistance:U1,nodeClickDistance:q1,onEdgeContextMenu:K1,onEdgeMouseEnter:W1,onEdgeMouseMove:Y1,onEdgeMouseLeave:n,reconnectRadius:R1,onReconnect:H1,onReconnectStart:x1,onReconnectEnd:a1,noDragClassName:i1,noWheelClassName:k0,noPanClassName:B0,disableKeyboardA11y:w0,nodeExtent:J0,rfId:Z0,viewport:n1,onViewportChange:Y0,nodesDraggable:U2}){return E9(_),E9(Q),xG(),yG(J),VG(n1),r.jsx(JG,{onPaneClick:_1,onPaneMouseEnter:a,onPaneMouseMove:o,onPaneMouseLeave:p,onPaneContextMenu:$1,onPaneScroll:e,paneClickDistance:U1,deleteKeyCode:v,selectionKeyCode:O,selectionOnDrag:B,selectionMode:M,onSelectionStart:L,onSelectionEnd:z,multiSelectionKeyCode:P,panActivationKeyCode:C,zoomActivationKeyCode:f,elementsSelectable:k,zoomOnScroll:E,zoomOnPinch:j,zoomOnDoubleClick:D,panOnScroll:m,panOnScrollSpeed:I,panOnScrollMode:V,panOnDrag:y,autoPanOnSelection:t,defaultViewport:u,translateExtent:i,minZoom:l,maxZoom:S,onSelectionContextMenu:H,preventScrolling:b,noDragClassName:i1,noWheelClassName:k0,noPanClassName:B0,disableKeyboardA11y:w0,onViewportChange:Y0,isControlledViewport:!!n1,children:r.jsxs(kG,{children:[r.jsx(vG,{edgeTypes:Q,onEdgeClick:U,onEdgeDoubleClick:Z,onReconnect:H1,onReconnectStart:x1,onReconnectEnd:a1,onlyRenderVisibleElements:N,onEdgeContextMenu:K1,onEdgeMouseEnter:W1,onEdgeMouseMove:Y1,onEdgeMouseLeave:n,reconnectRadius:R1,defaultMarkerColor:h,noPanClassName:B0,disableKeyboardA11y:w0,rfId:Z0}),r.jsx(bG,{style:w,type:W,component:R,containerStyle:A}),r.jsx("div",{className:"react-flow__edgelabel-renderer"}),r.jsx(KG,{nodeTypes:_,onNodeClick:q,onNodeDoubleClick:G,onNodeMouseEnter:F,onNodeMouseMove:X,onNodeMouseLeave:Y,onNodeContextMenu:K,nodeClickDistance:q1,onlyRenderVisibleElements:N,noPanClassName:B0,noDragClassName:i1,disableKeyboardA11y:w0,nodeExtent:J0,rfId:Z0,nodesDraggable:U2}),r.jsx("div",{className:"react-flow__viewport-portal"})]})})}T_.displayName="GraphView";var mG=d.memo(T_),gG=u6("React Flow","https://reactflow.dev/"),x9=({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,w=new Map,R=new Map,A=q??Q??[],O=J??_??[],B=K??[0,0],M=H??Q5;d6(w,R,A);let{nodesInitialized:P}=j4(O,z,W,{nodeOrigin:B,nodeExtent:M,zIndexMode:L}),C=[0,0,1];if(Z&&U&&G){let f=j2(z,{filter:(u)=>!!((u.width||u.initialWidth)&&(u.height||u.initialHeight))}),{x:v,y:N,zoom:k}=m5(f,U,G,X,Y,F?.padding??0.1);C=[v,N,k]}return{rfId:"1",width:U??0,height:G??0,transform:C,nodes:O,nodesInitialized:P,nodeLookup:z,parentLookup:W,edges:A,edgeLookup:R,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:J!==void 0,hasDefaultEdges:q!==void 0,panZoom:null,minZoom:X,maxZoom:Y,translateExtent:Q5,nodeExtent:M,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:L2.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:B,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:Z??!1,fitViewOptions:F,fitViewResolver:null,connection:{...C6},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gG,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:f6,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}},pG=({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})=>K9((z,W)=>{async function w(){let{nodeLookup:R,panZoom:A,fitViewOptions:O,fitViewResolver:B,width:M,height:P,minZoom:C,maxZoom:f}=W();if(!A)return;await f7({nodes:R,width:M,height:P,panZoom:A,minZoom:C,maxZoom:f},O),B?.resolve(!0),z({fitViewResolver:null})}return{...x9({nodes:_,edges:Q,width:U,height:G,fitView:Z,fitViewOptions:F,minZoom:X,maxZoom:Y,nodeOrigin:K,nodeExtent:H,defaultNodes:J,defaultEdges:q,zIndexMode:L}),setNodes:(R)=>{let{nodeLookup:A,parentLookup:O,nodeOrigin:B,nodeExtent:M,elevateNodesOnSelect:P,fitViewQueued:C,zIndexMode:f,nodesSelectionActive:v}=W(),{nodesInitialized:N,hasSelectedNodes:k}=j4(R,A,O,{nodeOrigin:B,nodeExtent:M,elevateNodesOnSelect:P,checkEquality:!0,zIndexMode:f}),u=v&&k;if(C&&N)w(),z({nodes:R,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u});else z({nodes:R,nodesInitialized:N,nodesSelectionActive:u})},setEdges:(R)=>{let{connectionLookup:A,edgeLookup:O}=W();d6(A,O,R),z({edges:R})},setDefaultNodesAndEdges:(R,A)=>{if(R){let{setNodes:O}=W();O(R),z({hasDefaultNodes:!0})}if(A){let{setEdges:O}=W();O(A),z({hasDefaultEdges:!0})}},updateNodeInternals:(R)=>{let{triggerNodeChanges:A,nodeLookup:O,parentLookup:B,domNode:M,nodeOrigin:P,nodeExtent:C,debug:f,fitViewQueued:v,zIndexMode:N}=W(),{changes:k,updatedInternals:u}=p7(R,O,B,M,P,C,N);if(!u)return;if(m7(O,B,{nodeOrigin:P,nodeExtent:C,zIndexMode:N}),v)w(),z({fitViewQueued:!1,fitViewOptions:void 0});else z({});if(k?.length>0){if(f)console.log("React Flow: trigger node changes",k);A?.(k)}},updateNodePositions:(R,A=!1)=>{let O=[],B=[],{nodeLookup:M,triggerNodeChanges:P,connection:C,updateConnection:f,onNodesChangeMiddlewareMap:v}=W();for(let[N,k]of R){let u=M.get(N),i=!!(u?.expandParent&&u?.parentId&&k?.position),l={id:N,type:"position",position:i?{x:Math.max(0,k.position.x),y:Math.max(0,k.position.y)}:k.position,dragging:A};if(u&&C.inProgress&&C.fromNode.id===u.id){let S=z2(u,C.fromHandle,F1.Left,!0);f({...C,from:S})}if(i&&u.parentId)O.push({id:N,parentId:u.parentId,rect:{...k.internals.positionAbsolute,width:k.measured.width??0,height:k.measured.height??0}});B.push(l)}if(O.length>0){let{parentLookup:N,nodeOrigin:k}=W(),u=V4(O,M,N,k);B.push(...u)}for(let N of v.values())B=N(B);P(B)},triggerNodeChanges:(R)=>{let{onNodesChange:A,setNodes:O,nodes:B,hasDefaultNodes:M,debug:P}=W();if(R?.length){if(M){let C=a9(R,B);O(C)}if(P)console.log("React Flow: trigger node changes",R);A?.(R)}},triggerEdgeChanges:(R)=>{let{onEdgesChange:A,setEdges:O,edges:B,hasDefaultEdges:M,debug:P}=W();if(R?.length){if(M){let C=wU(R,B);O(C)}if(P)console.log("React Flow: trigger edge changes",R);A?.(R)}},addSelectedNodes:(R)=>{let{multiSelectionActive:A,edgeLookup:O,nodeLookup:B,triggerNodeChanges:M,triggerEdgeChanges:P}=W();if(A){let C=R.map((f)=>V2(f,!0));M(C);return}M(G5(B,new Set([...R]),!0)),P(G5(O))},addSelectedEdges:(R)=>{let{multiSelectionActive:A,edgeLookup:O,nodeLookup:B,triggerNodeChanges:M,triggerEdgeChanges:P}=W();if(A){let C=R.map((f)=>V2(f,!0));P(C);return}P(G5(O,new Set([...R]))),M(G5(B,new Set,!0))},unselectNodesAndEdges:({nodes:R,edges:A}={})=>{let{edges:O,nodes:B,nodeLookup:M,triggerNodeChanges:P,triggerEdgeChanges:C}=W(),f=R?R:B,v=A?A:O,N=[];for(let u of f){if(!u.selected)continue;let i=M.get(u.id);if(i)i.selected=!1;N.push(V2(u.id,!1))}let k=[];for(let u of v){if(!u.selected)continue;k.push(V2(u.id,!1))}P(N),C(k)},setMinZoom:(R)=>{let{panZoom:A,maxZoom:O}=W();A?.setScaleExtent([R,O]),z({minZoom:R})},setMaxZoom:(R)=>{let{panZoom:A,minZoom:O}=W();A?.setScaleExtent([O,R]),z({maxZoom:R})},setTranslateExtent:(R)=>{W().panZoom?.setTranslateExtent(R),z({translateExtent:R})},resetSelectedElements:()=>{let{edges:R,nodes:A,triggerNodeChanges:O,triggerEdgeChanges:B,elementsSelectable:M}=W();if(!M)return;let P=A.reduce((f,v)=>v.selected?[...f,V2(v.id,!1)]:f,[]),C=R.reduce((f,v)=>v.selected?[...f,V2(v.id,!1)]:f,[]);O(P),B(C)},setNodeExtent:(R)=>{let{nodes:A,nodeLookup:O,parentLookup:B,nodeOrigin:M,elevateNodesOnSelect:P,nodeExtent:C,zIndexMode:f}=W();if(R[0][0]===C[0][0]&&R[0][1]===C[0][1]&&R[1][0]===C[1][0]&&R[1][1]===C[1][1])return;j4(A,O,B,{nodeOrigin:M,nodeExtent:R,elevateNodesOnSelect:P,checkEquality:!1,zIndexMode:f}),z({nodeExtent:R})},panBy:(R)=>{let{transform:A,width:O,height:B,panZoom:M,translateExtent:P}=W();return c7({delta:R,panZoom:M,transform:A,translateExtent:P,width:O,height:B})},setCenter:async(R,A,O)=>{let{width:B,height:M,maxZoom:P,panZoom:C}=W();if(!C)return!1;let f=typeof O?.zoom<"u"?O.zoom:P;return await C.setViewport({x:B/2-R*f,y:M/2-A*f,zoom:f},{duration:O?.duration,ease:O?.ease,interpolate:O?.interpolate}),!0},cancelConnection:()=>{z({connection:{...C6}})},updateConnection:(R)=>{z({connection:R})},reset:()=>z({...x9()})}},Object.is);function Q8({initialNodes:_,initialEdges:Q,defaultNodes:J,defaultEdges:q,initialWidth:U,initialHeight:G,initialMinZoom:Z,initialMaxZoom:F,initialFitViewOptions:X,fitView:Y,nodeOrigin:K,nodeExtent:H,zIndexMode:L,children:z}){let[W]=d.useState(()=>pG({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 r.jsx($U,{value:W,children:r.jsx(SU,{children:r.jsx(cU,{children:z})})})}function cG({children:_,nodes:Q,edges:J,defaultNodes:q,defaultEdges:U,width:G,height:Z,fitView:F,fitViewOptions:X,minZoom:Y,maxZoom:K,nodeOrigin:H,nodeExtent:L,zIndexMode:z}){if(d.useContext(m4))return r.jsx(r.Fragment,{children:_});return r.jsx(Q8,{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 lG={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function iG({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:w,onClickConnectStart:R,onClickConnectEnd:A,onNodeMouseEnter:O,onNodeMouseMove:B,onNodeMouseLeave:M,onNodeContextMenu:P,onNodeDoubleClick:C,onNodeDragStart:f,onNodeDrag:v,onNodeDragStop:N,onNodesDelete:k,onEdgesDelete:u,onDelete:i,onSelectionChange:l,onSelectionDragStart:S,onSelectionDrag:b,onSelectionDragStop:h,onSelectionContextMenu:E,onSelectionStart:j,onSelectionEnd:m,onBeforeDelete:I,connectionMode:V,connectionLineType:D=E0.Bezier,connectionLineStyle:y,connectionLineComponent:t,connectionLineContainerStyle:_1,deleteKeyCode:a="Backspace",selectionKeyCode:o="Shift",selectionOnDrag:p=!1,selectionMode:e=S2.Full,panActivationKeyCode:$1="Space",multiSelectionKeyCode:U1=U5()?"Meta":"Control",zoomActivationKeyCode:q1=U5()?"Meta":"Control",snapToGrid:K1,snapGrid:W1,onlyRenderVisibleElements:Y1=!1,selectNodesOnDrag:n,nodesDraggable:R1,autoPanOnNodeFocus:H1,nodesConnectable:x1,nodesFocusable:a1,nodeOrigin:i1=r9,edgesFocusable:k0,edgesReconnectable:B0,elementsSelectable:w0=!0,defaultViewport:J0=BU,minZoom:Z0=0.5,maxZoom:n1=2,translateExtent:Y0=Q5,preventScrolling:U2=!0,nodeExtent:P0,defaultMarkerColor:c0="#b1b1b7",zoomOnScroll:G2=!0,zoomOnPinch:l0=!0,panOnScroll:c2=!1,panOnScrollSpeed:y0=0.5,panOnScrollMode:T=s0.Free,zoomOnDoubleClick:g=!0,panOnDrag:Q1=!0,onPaneClick:J1,onPaneMouseEnter:X1,onPaneMouseMove:O1,onPaneMouseLeave:T1,onPaneScroll:v1,onPaneContextMenu:I1,paneClickDistance:A0=1,nodeClickDistance:j0=0,children:x,onReconnect:s,onReconnectStart:G1,onReconnectEnd:Z1,onEdgeContextMenu:f1,onEdgeDoubleClick:L1,onEdgeMouseEnter:M1,onEdgeMouseMove:P1,onEdgeMouseLeave:k1,reconnectRadius:e1=10,onNodesChange:C1,onEdgesChange:L0,noDragClassName:r1="nodrag",noWheelClassName:o4="nowheel",noPanClassName:V0="nopan",fitView:h1,fitViewOptions:M8,connectOnClick:RQ,attributionPosition:OQ,proOptions:IQ,defaultEdgeOptions:wQ,elevateNodesOnSelect:PQ=!0,elevateEdgesOnSelect:NQ=!1,disableKeyboardA11y:T8=!1,autoPanOnConnect:fQ,autoPanOnNodeDrag:CQ,autoPanOnSelection:SQ=!0,autoPanSpeed:vQ,connectionRadius:kQ,isValidConnection:yQ,onError:jQ,style:VQ,id:R8,nodeDragThreshold:uQ,connectionDragThreshold:hQ,viewport:DQ,onViewportChange:bQ,width:EQ,height:xQ,colorMode:mQ="light",debug:gQ,onScroll:O8,ariaLabelConfig:pQ,zIndexMode:I8="basic",...cQ},lQ){let n4=R8||"1",iQ=RU(mQ),rQ=d.useCallback((w8)=>{w8.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),O8?.(w8)},[O8]);return r.jsx("div",{"data-testid":"rf__wrapper",...cQ,onScroll:rQ,style:{...VQ,...lG},ref:lQ,className:m1(["react-flow",U,iQ]),id:R8,role:"application",children:r.jsxs(cG,{nodes:_,edges:Q,width:EQ,height:xQ,fitView:h1,fitViewOptions:M8,minZoom:Z0,maxZoom:n1,nodeOrigin:i1,nodeExtent:P0,zIndexMode:I8,children:[r.jsx(TU,{nodes:_,edges:Q,defaultNodes:J,defaultEdges:q,onConnect:z,onConnectStart:W,onConnectEnd:w,onClickConnectStart:R,onClickConnectEnd:A,nodesDraggable:R1,autoPanOnNodeFocus:H1,nodesConnectable:x1,nodesFocusable:a1,edgesFocusable:k0,edgesReconnectable:B0,elementsSelectable:w0,elevateNodesOnSelect:PQ,elevateEdgesOnSelect:NQ,minZoom:Z0,maxZoom:n1,nodeExtent:P0,onNodesChange:C1,onEdgesChange:L0,snapToGrid:K1,snapGrid:W1,connectionMode:V,translateExtent:Y0,connectOnClick:RQ,defaultEdgeOptions:wQ,fitView:h1,fitViewOptions:M8,onNodesDelete:k,onEdgesDelete:u,onDelete:i,onNodeDragStart:f,onNodeDrag:v,onNodeDragStop:N,onSelectionDrag:b,onSelectionDragStart:S,onSelectionDragStop:h,onMove:K,onMoveStart:H,onMoveEnd:L,noPanClassName:V0,nodeOrigin:i1,rfId:n4,autoPanOnConnect:fQ,autoPanOnNodeDrag:CQ,autoPanSpeed:vQ,onError:jQ,connectionRadius:kQ,isValidConnection:yQ,selectNodesOnDrag:n,nodeDragThreshold:uQ,connectionDragThreshold:hQ,onBeforeDelete:I,debug:gQ,ariaLabelConfig:pQ,zIndexMode:I8}),r.jsx(mG,{onInit:Y,onNodeClick:F,onEdgeClick:X,onNodeMouseEnter:O,onNodeMouseMove:B,onNodeMouseLeave:M,onNodeContextMenu:P,onNodeDoubleClick:C,nodeTypes:G,edgeTypes:Z,connectionLineType:D,connectionLineStyle:y,connectionLineComponent:t,connectionLineContainerStyle:_1,selectionKeyCode:o,selectionOnDrag:p,selectionMode:e,deleteKeyCode:a,multiSelectionKeyCode:U1,panActivationKeyCode:$1,zoomActivationKeyCode:q1,onlyRenderVisibleElements:Y1,defaultViewport:J0,translateExtent:Y0,minZoom:Z0,maxZoom:n1,preventScrolling:U2,zoomOnScroll:G2,zoomOnPinch:l0,zoomOnDoubleClick:g,panOnScroll:c2,panOnScrollSpeed:y0,panOnScrollMode:T,panOnDrag:Q1,autoPanOnSelection:SQ,onPaneClick:J1,onPaneMouseEnter:X1,onPaneMouseMove:O1,onPaneMouseLeave:T1,onPaneScroll:v1,onPaneContextMenu:I1,paneClickDistance:A0,nodeClickDistance:j0,onSelectionContextMenu:E,onSelectionStart:j,onSelectionEnd:m,onReconnect:s,onReconnectStart:G1,onReconnectEnd:Z1,onEdgeContextMenu:f1,onEdgeDoubleClick:L1,onEdgeMouseEnter:M1,onEdgeMouseMove:P1,onEdgeMouseLeave:k1,reconnectRadius:e1,defaultMarkerColor:c0,noDragClassName:r1,noWheelClassName:o4,noPanClassName:V0,rfId:n4,disableKeyboardA11y:T8,nodeExtent:P0,viewport:DQ,onViewportChange:bQ,nodesDraggable:R1}),r.jsx(WU,{onSelectionChange:l}),x,r.jsx(XU,{proOptions:IQ,position:OQ}),r.jsx(HU,{rfId:n4,disableKeyboardA11y:T8})]})})}var R_=s9(iG);function O_(_){let[Q,J]=d.useState(_),q=d.useCallback((U)=>J((G)=>a9(U,G)),[]);return[Q,J,q]}var bA=H0.error014();function rG({dimensions:_,lineWidth:Q,variant:J,className:q}){return r.jsx("path",{strokeWidth:Q,d:`M${_[0]/2} 0 V${_[1]} M0 ${_[1]/2} H${_[0]}`,className:m1(["react-flow__background-pattern",J,q])})}function dG({radius:_,className:Q}){return r.jsx("circle",{cx:_,cy:_,r:_,className:m1(["react-flow__background-pattern","dots",Q])})}var x0;(function(_){_.Lines="lines",_.Dots="dots",_.Cross="cross"})(x0||(x0={}));var aG={[x0.Dots]:1,[x0.Lines]:1,[x0.Cross]:6},sG=(_)=>({transform:_.transform,patternId:`pattern-${_.rfId}`});function I_({id:_,variant:Q=x0.Dots,gap:J=20,size:q,lineWidth:U=1,offset:G=0,color:Z,bgColor:F,style:X,className:Y,patternClassName:K}){let H=d.useRef(null),{transform:L,patternId:z}=N1(sG,D1),W=q||aG[Q],w=Q===x0.Dots,R=Q===x0.Cross,A=Array.isArray(J)?J:[J,J],O=[A[0]*L[2]||1,A[1]*L[2]||1],B=W*L[2],M=Array.isArray(G)?G:[G,G],P=R?[B,B]:O,C=[M[0]*L[2]+P[0]/2,M[1]*L[2]+P[1]/2],f=`${z}${_?_:""}`;return r.jsxs("svg",{className:m1(["react-flow__background",Y]),style:{...X,...g4,"--xy-background-color-props":F,"--xy-background-pattern-color-props":Z},ref:H,"data-testid":"rf__background",children:[r.jsx("pattern",{id:f,x:L[0]%O[0],y:L[1]%O[1],width:O[0],height:O[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:w?r.jsx(dG,{radius:B/2,className:K}):r.jsx(rG,{dimensions:P,lineWidth:U,variant:Q,className:K})}),r.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${f})`})]})}I_.displayName="Background";var w_=d.memo(I_);function tG(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:r.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function oG(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:r.jsx("path",{d:"M0 0h32v4.2H0z"})})}function nG(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:r.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 eG(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:r.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 r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:r.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 b4({children:_,className:Q,...J}){return r.jsx("button",{type:"button",className:m1(["react-flow__controls-button",Q]),...J,children:_})}var QZ=(_)=>({isInteractive:_.nodesDraggable||_.nodesConnectable||_.elementsSelectable,minZoomReached:_.transform[2]<=_.minZoom,maxZoomReached:_.transform[2]>=_.maxZoom,ariaLabelConfig:_.ariaLabelConfig});function P_({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=b1(),{isInteractive:w,minZoomReached:R,maxZoomReached:A,ariaLabelConfig:O}=N1(QZ,D1),{zoomIn:B,zoomOut:M,fitView:P}=c5(),C=()=>{B(),G?.()},f=()=>{M(),Z?.()},v=()=>{P(U),F?.()},N=()=>{W.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),X?.(!w)};return r.jsxs(m0,{className:m1(["react-flow__controls",L==="horizontal"?"horizontal":"vertical",Y]),position:H,style:_,"data-testid":"rf__controls","aria-label":z??O["controls.ariaLabel"],children:[Q&&r.jsxs(r.Fragment,{children:[r.jsx(b4,{onClick:C,className:"react-flow__controls-zoomin",title:O["controls.zoomIn.ariaLabel"],"aria-label":O["controls.zoomIn.ariaLabel"],disabled:A,children:r.jsx(tG,{})}),r.jsx(b4,{onClick:f,className:"react-flow__controls-zoomout",title:O["controls.zoomOut.ariaLabel"],"aria-label":O["controls.zoomOut.ariaLabel"],disabled:R,children:r.jsx(oG,{})})]}),J&&r.jsx(b4,{className:"react-flow__controls-fitview",onClick:v,title:O["controls.fitView.ariaLabel"],"aria-label":O["controls.fitView.ariaLabel"],children:r.jsx(nG,{})}),q&&r.jsx(b4,{className:"react-flow__controls-interactive",onClick:N,title:O["controls.interactive.ariaLabel"],"aria-label":O["controls.interactive.ariaLabel"],children:w?r.jsx(_Z,{}):r.jsx(eG,{})}),K]})}P_.displayName="Controls";var N_=d.memo(P_);function JZ({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:w}=G||{},R=Z||W||w;return r.jsx("rect",{className:m1(["react-flow__minimap-node",{selected:L},Y]),x:Q,y:J,rx:K,ry:K,width:q,height:U,style:{fill:R,stroke:F,strokeWidth:X},shapeRendering:H,onClick:z?(A)=>z(A,_):void 0})}var $Z=d.memo(JZ),qZ=(_)=>_.nodes.map((Q)=>Q.id),o6=(_)=>_ instanceof Function?_:()=>_;function UZ({nodeStrokeColor:_,nodeColor:Q,nodeClassName:J="",nodeBorderRadius:q=5,nodeStrokeWidth:U,nodeComponent:G=$Z,onClick:Z}){let F=N1(qZ,D1),X=o6(Q),Y=o6(_),K=o6(J),H=typeof window>"u"||!!window.chrome?"crispEdges":"geometricPrecision";return r.jsx(r.Fragment,{children:F.map((L)=>r.jsx(ZZ,{id:L,nodeColorFunc:X,nodeStrokeColorFunc:Y,nodeClassNameFunc:K,nodeBorderRadius:q,nodeStrokeWidth:U,NodeComponent:G,onClick:Z,shapeRendering:H},L))})}function GZ({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}=N1((W)=>{let w=W.nodeLookup.get(_);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};let R=w.internals.userNode,{x:A,y:O}=w.internals.positionAbsolute,{width:B,height:M}=R0(R);return{node:R,x:A,y:O,width:B,height:M}},D1);if(!Y||Y.hidden||!h6(Y))return null;return r.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 ZZ=d.memo(GZ),FZ=d.memo(UZ),HZ=200,XZ=150,KZ=(_)=>!_.hidden,YZ=(_)=>{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?j6(j2(_.nodeLookup,{filter:KZ}),Q):Q,rfId:_.rfId,panZoom:_.panZoom,translateExtent:_.translateExtent,flowWidth:_.width,flowHeight:_.height,ariaLabelConfig:_.ariaLabelConfig}},m9=(_,Q)=>_.x===Q.x&&_.y===Q.y&&_.width===Q.width&&_.height===Q.height,LZ=(_,Q)=>m9(_.viewBB,Q.viewBB)&&m9(_.boundingRect,Q.boundingRect)&&_.rfId===Q.rfId&&_.panZoom===Q.panZoom&&_.translateExtent===Q.translateExtent&&_.flowWidth===Q.flowWidth&&_.flowHeight===Q.flowHeight&&_.ariaLabelConfig===Q.ariaLabelConfig,zZ="react-flow__minimap-desc";function f_({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:w=!1,zoomable:R=!1,ariaLabel:A,inversePan:O,zoomStep:B=1,offsetScale:M=5}){let P=b1(),C=d.useRef(null),{boundingRect:f,panZoom:v,viewBB:N,rfId:k,translateExtent:u,flowWidth:i,flowHeight:l,ariaLabelConfig:S}=N1(YZ,LZ),b=_?.width??HZ,h=_?.height??XZ,E=f.width/b,j=f.height/h,m=Math.max(E,j),I=m*b,V=m*h,D=M*m,y=f.x-(I-f.width)/2-D,t=f.y-(V-f.height)/2-D,_1=I+D*2,a=V+D*2,o=`${zZ}-${k}`,p=d.useRef(0),e=d.useRef();p.current=m,d.useEffect(()=>{let W1=P.getState().panZoom;if(C.current&&W1)return e.current=t7({domNode:C.current,panZoom:W1,getTransform:()=>P.getState().transform,getViewScale:()=>p.current}),()=>{e.current?.destroy()}},[v]),d.useEffect(()=>{e.current?.update({translateExtent:u,width:i,height:l,inversePan:O,pannable:w,zoomStep:B,zoomable:R})},[w,R,O,B,u,i,l]);let $1=z?(W1)=>{let[Y1,n]=e.current?.pointer(W1)||[0,0];z(W1,{x:Y1,y:n})}:void 0,U1=d.useCallback((W1,Y1)=>{let n=P.getState().nodeLookup.get(Y1).internals.userNode;W?.(W1,n)},[W]),q1=W?U1:void 0,K1=A??S["minimap.ariaLabel"];return r.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 J==="string"?J:void 0,"--xy-minimap-node-stroke-width-props":typeof Z==="number"?Z:void 0},className:m1(["react-flow__minimap",Q]),"data-testid":"rf__minimap",children:r.jsxs("svg",{width:b,height:h,viewBox:`${y} ${t} ${_1} ${a}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":o,ref:C,onClick:$1,children:[K1&&r.jsx("title",{id:o,children:K1}),r.jsx(FZ,{onClick:q1,nodeColor:q,nodeStrokeColor:J,nodeBorderRadius:G,nodeClassName:U,nodeStrokeWidth:Z,nodeComponent:F}),r.jsx("path",{className:"react-flow__minimap-mask",d:`M${y-D},${t-D}h${_1+D*2}v${a+D*2}h${-_1-D*2}z
|
|
34
34
|
M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}f_.displayName="MiniMap";var C_=d.memo(f_),WZ=(_)=>(Q)=>_?`${Math.max(1/Q.transform[2],1)}`:void 0,BZ={[t0.Line]:"right",[t0.Handle]:"bottom-right"};function AZ({nodeId:_,position:Q,variant:J=t0.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:w,onResize:R,onResizeEnd:A}){let O=_8(),B=typeof _==="string"?_:O,M=b1(),P=d.useRef(null),C=J===t0.Handle,f=N1(d.useCallback(WZ(C&&z),[C,z]),D1),v=d.useRef(null),N=Q??BZ[J];d.useEffect(()=>{if(!P.current||!B)return;if(!v.current)v.current=$9({domNode:P.current,nodeId:B,getStoreItems:()=>{let{nodeLookup:u,transform:i,snapGrid:l,snapToGrid:S,nodeOrigin:b,domNode:h}=M.getState();return{nodeLookup:u,transform:i,snapGrid:l,snapToGrid:S,nodeOrigin:b,paneDomNode:h}},onChange:(u,i)=>{let{triggerNodeChanges:l,nodeLookup:S,parentLookup:b,nodeOrigin:h}=M.getState(),E=[],j={x:u.x,y:u.y},m=S.get(B);if(m&&m.expandParent&&m.parentId){let I=m.origin??h,V=u.width??m.measured.width??0,D=u.height??m.measured.height??0,y={id:m.id,parentId:m.parentId,rect:{width:V,height:D,...D6({x:u.x??m.position.x,y:u.y??m.position.y},{width:V,height:D},m.parentId,S,I)}},t=V4([y],S,b,h);E.push(...t),j.x=u.x?Math.max(I[0]*V,u.x):void 0,j.y=u.y?Math.max(I[1]*D,u.y):void 0}if(j.x!==void 0&&j.y!==void 0){let I={id:B,type:"position",position:{...j}};E.push(I)}if(u.width!==void 0&&u.height!==void 0){let V={id:B,type:"dimensions",resizing:!0,setAttributes:!L?!0:L==="horizontal"?"width":"height",dimensions:{width:u.width,height:u.height}};E.push(V)}for(let I of i){let V={...I,type:"position"};E.push(V)}l(E)},onEnd:({width:u,height:i})=>{let l={id:B,type:"dimensions",resizing:!1,dimensions:{width:u,height:i}};M.getState().triggerNodeChanges([l])}});return v.current.update({controlPosition:N,boundaries:{minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K},keepAspectRatio:H,resizeDirection:L,onResizeStart:w,onResize:R,onResizeEnd:A,shouldResize:W}),()=>{v.current?.destroy()}},[N,F,X,Y,K,H,w,R,A,W]);let k=N.split("-");return r.jsx("div",{className:m1(["react-flow__resize-control","nodrag",...k,J,q]),ref:P,style:{...U,scale:f,...Z&&{[C?"backgroundColor":"borderColor"]:Z}},children:G})}var g9=d.memo(AZ);function S_({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:w,onResizeEnd:R}){if(!Q)return null;return r.jsxs(r.Fragment,{children:[Q9.map((A)=>r.jsx(g9,{className:U,style:G,nodeId:_,position:A,variant:t0.Line,color:Z,minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K,onResizeStart:W,keepAspectRatio:H,autoScale:L,shouldResize:z,onResize:w,onResizeEnd:R},A)),_9.map((A)=>r.jsx(g9,{className:J,style:q,nodeId:_,position:A,color:Z,minWidth:F,minHeight:X,maxWidth:Y,maxHeight:K,onResizeStart:W,keepAspectRatio:H,autoScale:L,shouldResize:z,onResize:w,onResizeEnd:R},A))]})}var MZ=(_)=>_.domNode?.querySelector(".react-flow__renderer");function TZ({children:_}){let Q=N1(MZ);if(!Q)return null;return p9.createPortal(_,Q)}var RZ=(_,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,OZ=(_,Q)=>{if(_.size!==Q.size)return!1;for(let[J,q]of _)if(RZ(q,Q.get(J)))return!1;return!0},IZ=(_)=>({x:_.transform[0],y:_.transform[1],zoom:_.transform[2],selectedNodesCount:_.nodes.filter((Q)=>Q.selected).length});function J8({nodeId:_,children:Q,className:J,style:q,isVisible:U,position:G=F1.Top,offset:Z=10,align:F="center",...X}){let Y=_8(),K=d.useCallback((P)=>{return(Array.isArray(_)?_:[_||Y||""]).reduce((v,N)=>{let k=P.nodeLookup.get(N);if(k)v.set(k.id,k);return v},new Map)},[_,Y]),H=N1(K,OZ),{x:L,y:z,zoom:W,selectedNodesCount:w}=N1(IZ,D1);if(!(typeof U==="boolean"?U:H.size===1&&H.values().next().value?.selected&&w===1)||!H.size)return null;let A=j2(H),O=Array.from(H.values()),B=Math.max(...O.map((P)=>P.internals.z+1)),M={position:"absolute",transform:E7(A,{x:L,y:z,zoom:W},G,Z,F),zIndex:B,...q};return r.jsx(TZ,{children:r.jsx("div",{style:M,className:m1(["react-flow__node-toolbar",J]),...X,"data-id":O.reduce((P,C)=>`${P}${C.id} `,"").trim(),children:Q})})}var o1=_0(u0(),1);var v_={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 z1=_0(l5(),1),PZ="https://brand.volter.ai/logo/twin-world/svg?size=64&variant=mono";function i5({href:_,onClick:Q}){return z1.jsxDEV("h1",{children:z1.jsxDEV("a",{href:_,onClick:Q,children:[z1.jsxDEV("img",{src:PZ,alt:"",width:24,height:24,style:{verticalAlign:"middle"}},void 0,!1,void 0,this),z1.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 n0(_){return(await _.json().catch(()=>({}))).error??`answered ${_.status}`}function y_(_,Q,J=0,q=""){let[U,G]=o1.useState({state:"loading"});return o1.useEffect(()=>{G({state:"loading"})},[q,Q]),o1.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 n0(F)};if(Z)G(X)}catch(F){if(Z)G({state:"error",status:0,error:String(F)})}})(),()=>{Z=!1}},[q,Q,J]),U}function U0({load:_,what:Q,retry:J,lines:q=3}){if(_.state==="loading")return z1.jsxDEV(NZ,{lines:q,label:`Loading ${Q}…`},void 0,!1,void 0,this);if(_.state==="error")return z1.jsxDEV("div",{role:"alert",className:"error-state",children:[z1.jsxDEV("span",{children:["Could not read ",Q,": ",_.error]},void 0,!0,void 0,this),J?z1.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 NZ({lines:_=3,label:Q="Loading…"}){return z1.jsxDEV("div",{className:"skeleton",role:"status","aria-label":Q,children:Array.from({length:_},(J,q)=>z1.jsxDEV("span",{style:{width:`${[92,76,84,64,88][q%5]}%`}},q,!1,void 0,this))},void 0,!1,void 0,this)}function V1({iso:_,time:Q}){if(!_)return z1.jsxDEV("span",{children:"—"},void 0,!1,void 0,this);let J=new Date(_);return z1.jsxDEV("time",{dateTime:_,title:_,children:Number.isNaN(J.getTime())?_:Q?J.toLocaleTimeString():J.toLocaleString()},void 0,!1,void 0,this)}var h2=(_)=>_?new Date(_).toLocaleString():"—";function U8(_){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 E1(_,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 D2=(_)=>_.length<=1?_.join(""):`${_.slice(0,-1).join(", ")} and ${_[_.length-1]}`,fZ={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"},B1=(_)=>fZ[_]??_.charAt(0).toUpperCase()+_.slice(1);function l1({vendor:_}){let Q=v_[_];return z1.jsxDEV("span",{className:Q?"mark logo":"mark","aria-hidden":"true",children:Q?z1.jsxDEV("svg",{viewBox:"0 0 24 24",children:z1.jsxDEV("path",{d:Q.d,fill:Q.fill},void 0,!1,void 0,this)},void 0,!1,void 0,this):B1(_).charAt(0)},void 0,!1,void 0,this)}var k_=(_)=>{_.currentTarget.closest("details")?.removeAttribute("open")},CZ="volter.theme",G8=()=>{try{let _=localStorage.getItem(CZ);return _==="light"||_==="dark"?_:"system"}catch{return"system"}};function j_(_=G8()){let Q=document.documentElement;if(_==="system")Q.removeAttribute("data-theme");else Q.setAttribute("data-theme",_)}function V_(){return o1.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 W0({open:_,onClose:Q,title:J,children:q,footer:U,wide:G}){let Z=o1.useRef(null),F=o1.useId();return o1.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()},[_]),z1.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:_?z1.jsxDEV(z1.Fragment,{children:[z1.jsxDEV("div",{className:"dialog-head",children:[z1.jsxDEV("h2",{id:F,children:J},void 0,!1,void 0,this),z1.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),z1.jsxDEV("div",{className:"dialog-body",children:q},void 0,!1,void 0,this),U?z1.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 $8="volter:confirm";function g0(_){return new Promise((Q)=>{window.dispatchEvent(new CustomEvent($8,{detail:{ask:_,resolve:Q}}))})}function u_(){let[_,Q]=o1.useState(null),[J,q]=o1.useState("");o1.useEffect(()=>{let F=(X)=>{q(""),Q(X.detail)};return window.addEventListener($8,F),()=>window.removeEventListener($8,F)},[]);let U=(F)=>{_?.resolve(F),Q(null)},G=_?.ask,Z=!G?.typed||J===G.typed;return z1.jsxDEV(W0,{open:Boolean(_),onClose:()=>U(!1),title:G?.title??"",footer:z1.jsxDEV(z1.Fragment,{children:[z1.jsxDEV("button",{type:"button",onClick:()=>U(!1),children:"Cancel"},void 0,!1,void 0,this),z1.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?z1.jsxDEV("div",{className:"confirm-body",children:G.body},void 0,!1,void 0,this):null,G?.typed?z1.jsxDEV("div",{className:"typed-confirm",children:[z1.jsxDEV("p",{children:["Type ",z1.jsxDEV("code",{children:G.typed},void 0,!1,void 0,this)," to confirm."]},void 0,!0,void 0,this),z1.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 q8="volter:toast";function g1(_,Q="ok"){window.dispatchEvent(new CustomEvent(q8,{detail:{text:_,kind:Q}}))}function h_(){let[_,Q]=o1.useState([]);return o1.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(q8,q),()=>window.removeEventListener(q8,q)},[]),z1.jsxDEV("div",{className:"toasts",role:"region","aria-label":"Notifications",children:_.map((J)=>z1.jsxDEV("div",{className:`toast ${J.kind}`,role:J.kind==="error"?"alert":"status",children:[z1.jsxDEV("span",{children:J.text},void 0,!1,void 0,this),z1.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 Z8({value:_,label:Q,secret:J}){let[q,U]=o1.useState(!1);return z1.jsxDEV("div",{className:"copy-field",children:[Q?z1.jsxDEV("span",{className:"copy-label",children:Q},void 0,!1,void 0,this):null,z1.jsxDEV("div",{className:"copy-row",children:[z1.jsxDEV("input",{readOnly:!0,value:_,"aria-label":Q??"Value",onFocus:(Z)=>Z.currentTarget.select(),spellCheck:!1},void 0,!1,void 0,this),z1.jsxDEV("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(_).then(()=>{U(!0),setTimeout(()=>U(!1),1600),g1(J?"Copied. Keep it somewhere safe":"Copied")}).catch(()=>g1("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 D_({label:_,items:Q}){return z1.jsxDEV("details",{className:"menu row-menu",children:[z1.jsxDEV("summary",{className:"icon-button",role:"button","aria-haspopup":"menu","aria-label":_,title:_,children:"⋯"},void 0,!1,void 0,this),z1.jsxDEV("div",{className:"popover menu-list",role:"menu",children:Q.filter((J)=>Boolean(J)).map((J)=>J.href?z1.jsxDEV("a",{role:"menuitem",href:J.href,className:J.danger?"danger-item":void 0,onClick:k_,children:J.label},J.label,!1,void 0,this):z1.jsxDEV("button",{type:"button",role:"menuitem",disabled:J.disabled,className:J.danger?"danger-item":void 0,onClick:(q)=>{k_(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 Z5({title:_,children:Q,action:J}){return z1.jsxDEV("div",{className:"empty-state",children:[z1.jsxDEV("p",{className:"empty-title",children:_},void 0,!1,void 0,this),Q?z1.jsxDEV("div",{className:"empty-body",children:Q},void 0,!1,void 0,this):null,J?z1.jsxDEV("div",{className:"empty-action",children:J},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function b_(){return o1.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")SZ()};return document.addEventListener("click",_),document.addEventListener("keydown",Q),()=>{document.removeEventListener("click",_),document.removeEventListener("keydown",Q)}},[]),z1.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 SZ=()=>{document.querySelector("main.app")?.removeAttribute("data-drawer")};function c4(_={}){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
35
|
`)}var E_={"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 $=_0(l5(),1),i4="volter.console.token",a5=document.getElementById("root"),A1=a5.dataset.base??"/-/console",y1=window.location.origin,Q2=(a5.dataset.worlds??y1).replace(/\/+$/,""),a_=(a5.dataset.names??"").split(",").filter((_)=>_!==""),_2=a5.dataset.worldOrigin==="1",g2=window.fetch.bind(window),W2="(session)",s_="(pass)",r5=(_)=>{try{if(_&&!_2)sessionStorage.setItem(i4,_);else sessionStorage.removeItem(i4);localStorage.removeItem(i4)}catch{}},t_="volter.console.portal",o_=(_)=>{try{if(typeof _==="string"&&/^https?:$/.test(new URL(_).protocol))sessionStorage.setItem(t_,new URL(_).origin)}catch{}},vZ=()=>{return p2.get("token")??""},G0=()=>{try{let _=sessionStorage.getItem(t_)??"";return _&&/^https?:$/.test(new URL(_).protocol)?new URL(_).origin:""}catch{return""}},kZ=()=>{let _=vZ();if(_2){if(r5(""),p2.get("pass"))return s_;let Q=new URLSearchParams(window.location.search).has("signin");if(Q)try{window.history.replaceState(null,"",window.location.pathname+window.location.hash)}catch{}return _||(Q?"":W2)}if(_)return r5(_),_;try{return sessionStorage.getItem(i4)??""}catch{return""}};function d1(_){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: ${D2(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 ${B1(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(B1);return{text:`${D2(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(_)=>d1(await n0(_)).text,yZ={vault:["vault","Open Vault"],remote:["remote","Open Remote"],settings:["settings/services","Open Real services"]};function n_({name:_,acts:Q}){let J=Q.map((q)=>yZ[q]).filter((q)=>Boolean(q));if(J.length===0)return null;return $.jsxDEV($.Fragment,{children:J.map(([q,U])=>$.jsxDEV(c.default.Fragment,{children:[" ",$.jsxDEV("a",{href:`${A1}/${_}/~/${q}`,onClick:(G)=>{G.preventDefault(),j1([..._.split("/"),"~",...q.split("/")])},children:U},void 0,!1,void 0,this)]},q,!0,void 0,this))},void 0,!1,void 0,this)}async function S1(_,Q,J={}){return g2(`${y1}${Q}`,{...J,headers:{...J.headers??{},..._===W2?{}:{"x-volter-token":_},...J.body&&!J.headers?.["content-type"]?{"content-type":"application/json"}:{}}})}function u1(_,Q,J=0){let q=y_((U)=>S1(_,U),Q,J,_);return q.state==="error"?{...q,error:d1(q.error).text}:q}var X5=(_)=>{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())}`},x_=(_)=>new Date(Math.ceil(Date.parse(_)/60000)*60000).toISOString(),e_=(_)=>_.operation==="observed"?`observed${_.provenance==="placeholder"?" (default data)":" (vendor)"}`:_.receipt?`${_.receipt.status??""} ${_.receipt.externalId??""} ${_.receipt.reason??""}`.trim():_.provenance==="placeholder"?"default data":"unpushed",jZ=(_)=>{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},Y8="volter.console.snapshots",J2=()=>{try{return JSON.parse(sessionStorage.getItem(Y8)??"{}")}catch{return{}}},_Q=new Map,L8=(_)=>{if(_2){if(_.token||_.readToken)_Q.set(_.name,{token:_.token,readToken:_.readToken});_={..._,token:"",readToken:""}}try{sessionStorage.setItem(Y8,JSON.stringify({...J2(),[_.name]:_}))}catch{}},z8=(_)=>_Q.get(_)?.readToken||J2()[_]?.readToken||"",r4=(_)=>{try{let Q=J2();delete Q[_],sessionStorage.setItem(Y8,JSON.stringify(Q))}catch{}},p2=new URLSearchParams(window.location.hash.slice(1)),F5=p2.get("close")??"";function s5(_){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 W8(_){let Q=s5(_);if(!Q)return null;let J=new URL(y1);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 VZ(_){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:W8(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 _=p2.get("snapshot");if(_){let Q=VZ(_);if(Q&&!J2()[Q.name])L8(Q)}}var QQ="volter.console.home",JQ=(_)=>{let Q=s5(_);if(!Q)return null;let J=new URL(y1).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 _=JQ(p2.get("home"));if(_)try{sessionStorage.setItem(QQ,_)}catch{}}if(["token","pass","portal","snapshot","home","close"].some((_)=>p2.has(_)))try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}var v0=()=>{try{return JQ(sessionStorage.getItem(QQ))??""}catch{return""}};function B8(_,Q,J,q){let U=new URLSearchParams({token:Q,home:v0()||y1}),G=J2()[J];if(G)U.set("snapshot",JSON.stringify(G));window.location.replace(`${_}${q??`${window.location.pathname}${window.location.search}`}#${U.toString()}`)}var a4=a5.dataset.route==="memory"?"":null;function QM(_){a4=_,window.dispatchEvent(new PopStateEvent("popstate"))}function E2(){return(a4??window.location.pathname.slice(A1.length)).split("/").filter(Boolean).map((_)=>{try{return decodeURIComponent(_)}catch{return""}})}var m_=/^[a-z0-9](?:[a-z0-9]|-(?!-))*$/i,e0=(_,Q)=>_&&Q&&m_.test(_)&&m_.test(Q)?`${_}/${Q}`:"";function j1(_){let Q=`/${_.map(encodeURIComponent).join("/")}`;if(a4!==null)a4=Q;else window.history.pushState(null,"",`${A1}${Q}`);window.dispatchEvent(new PopStateEvent("popstate"))}function $Q(_,Q){let J=W8(J2()[_]?.origin);if(J&&J!==y1){B8(J,z8(_),_,`${A1}/${Q.map(encodeURIComponent).join("/")}`);return}j1(Q)}async function g_(){let[_,Q]=E2(),J=e0(_,Q),q=J?[J]:a_;if(q.length===0){let U=await g2(`${y1}/-/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&&e0(G,Z)===U});for(let U of q){let G=await g2(`${y1}/-/${U}/session`,{method:"POST"}).catch(()=>null);if(!G)continue;let Z=await G.json().catch(()=>({})),F=s5(Z.origin)?.origin;if(G.status===409&&F&&F!==y1)return window.location.replace(`${F}${A1}/${U}`),"moved";if(G.ok&&Z.local)return{token:typeof Z.token==="string"&&Z.token?Z.token:W2}}return null}function uZ(){let[_,Q]=c.useState(G8),J=(q)=>()=>{try{if(q==="system")localStorage.removeItem("volter.theme");else localStorage.setItem("volter.theme",q)}catch{}j_(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 hZ(){let[_,Q]=c.useState(kZ()),[J,q]=c.useState(!1),[U,G]=c.useState(!1),[Z,F]=c.useState(""),[X,Y]=c.useState(null),[K,H]=c.useState(null),[L,z]=c.useState(E2());c.useEffect(()=>{let D=()=>z(E2());return window.addEventListener("popstate",D),()=>window.removeEventListener("popstate",D)},[]),c.useEffect(()=>{let[D,y]=E2(),t=e0(D,y),[_1,a]=t?t.split("/"):[],o=J2()[F5];if(!F5||!_||!_1||!a||!o?.made||o.parent!==`${_1}/${a}`||e0(...F5.split("/"))!==F5)return;try{window.history.replaceState(null,"",window.location.pathname+window.location.search)}catch{}S1(_,`/-/${_1}/${a}/branches/${F5}`,{method:"DELETE"}).catch(()=>null).then(()=>r4(F5))},[_]);let W=c.useCallback(async(D)=>{if(H(null),!D){let a=await g_();if(a==="moved")return;if(a){if(q(!0),a.token!==W2)r5(a.token);Q(a.token);return}Y(null),G(!0);return}if(_2&&D===W2){let a=await g_();if(a==="moved")return;if(a)q(!0)}if(_2&&D===s_){let[a,o]=E2(),p=e0(a,o),[e,$1]=p?p.split("/"):[],U1=e&&$1?await g2(`${y1}/-/${e}/${$1}/session`,{method:"POST",headers:{"x-volter-pass":p2.get("pass")??""}}).catch(()=>null):null;if(!U1){H(`${y1} 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}o_((await U1.json().catch(()=>({}))).issuer),Q(W2);return}if(_2&&D!==W2){let[a,o]=E2(),p=e0(a,o),[e,$1]=p?p.split("/"):[],U1=e&&$1?await g2(`${y1}/-/${e}/${$1}/session`,{method:"POST",headers:{"x-volter-token":D}}).catch(()=>null):null;if(!U1){H(`${y1} did not answer: no session was opened`),Y(null);return}if(!U1.ok){let q1=await K0(U1);H(U1.status===401||U1.status===403?`That token does not open ${e}/${$1}.`:U1.status===409?`${e}/${$1}'s session lives at another origin: ${q1}`:`The World could not open a session (${U1.status}): ${q1}`),Y(null);return}Q(W2);return}let y=_2?new Response(null,{status:404}):await S1(D,"/-/worlds");if(y.ok){let{worlds:a}=await y.json();Y({kind:"admin",worlds:a});return}if(y.status===429){H("You are asking faster than the platform allows — wait a moment and reload."),Y(null);return}if(y.status>=500){let a=await y.json().catch(()=>({}));H(`The platform could not list your worlds${a.error?`: ${a.error}`:""}. Reload; if it stays, the status page says what is wrong.`),Y(null);return}let t=a_;if(t.length===0){let a=await g2(`${y1}/-/ping`);if(!a.ok){H(`${y1} does not answer as a host`),Y(null);return}if(t=(await a.json()).worlds??[],t.length===0){H(`${y1} does not list its Worlds: open a World at its own address, ${y1}${A1}/<org>/<world>`),Y(null);return}}let _1=[];for(let a of t){let o=await S1(D,`/-/${a}/twins`);if(o.ok){let p=await o.json();_1.push({name:a,base:`${Q2}/${a}`,twins:(p.twins??[]).map((e)=>({vendor:e.twin,protocol:e.protocol??null,root:e.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})},[]);c.useEffect(()=>{W(_)},[_,W]);let w=(D)=>X?.kind==="admin"?X.worlds.find((y)=>y.name===D)?.token??_:_,[R,A]=c.useState("");if(!_||!X&&!K)return $.jsxDEV("main",{className:"app gate",children:$.jsxDEV("div",{className:"gate-window",children:[$.jsxDEV(i5,{href:`${A1}/`},void 0,!1,void 0,this),_&&!X&&!K||!_&&!U?$.jsxDEV("p",{className:"mode",children:"Opening…"},void 0,!1,void 0,this):$.jsxDEV("form",{onSubmit:(D)=>{D.preventDefault(),r5(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:(D)=>F(D.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 O=()=>H("This link or key opens no World here: it was revoked, or it has ended."),B=()=>{if(J){window.location.reload();return}if(_2){let[D,y]=E2(),t=e0(D,y),[_1,a]=t?t.split("/"):[],o=()=>window.location.replace(G0()?`${G0()}/`:`${y1}${A1}/${_1&&a?`${_1}/${a}`:""}?signin`);if(setTimeout(o,2000),_1&&a)g2(`${y1}/-/${_1}/${a}/session/end`,{method:"POST"}).catch(()=>null).then(o);else o();return}if(X)for(let D of X.worlds)navigator.sendBeacon(`${D.base.replace(/\/[^/]+\/[^/]+$/,"")}/-/${D.name}/session/end`);r5(""),Q(""),F(""),Y(null),j1([])};if(K||!X)return $.jsxDEV("main",{className:"app gate",children:$.jsxDEV("div",{className:"gate-window",children:[$.jsxDEV(i5,{href:`${A1}/`},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),G0()?$.jsxDEV("a",{className:"button primary",href:`${G0()}/`,children:["Back to ",new URL(G0()).host]},void 0,!0,void 0,this):$.jsxDEV("button",{type:"button",className:"primary",onClick:B,children:J?"Try again":"Use another token"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);let[M,P,C,f,v,N,k]=L,u=C==="~",i=/^[A-Za-z0-9_-]+$/,l=/^[^\u0000-\u001f\u007f]{1,200}$/,S=u||!C||!i.test(C)?void 0:C,b=v&&i.test(v)?N!==void 0&&f!=="changes"&&f!=="screens"?e0(v,N)||void 0:v:void 0,h=f==="changes"&&v==="changesets"&&N&&i.test(N)?N:f==="screens"&&N&&k&&/^[A-Za-z0-9_.-]+$/.test(N)&&l.test(k)?`${N}:${k}`:void 0,E=e0(M,P),j=E?J2()[E]??null:null,m=(D)=>z8(D)||w(D),I=j?X.kind==="admin"?X.worlds.find((D)=>D.name===j.parent)?.token??null:X.worlds.some((D)=>D.name===j.parent)?_:null:null,V=async(D)=>{let y=W8(D.parentOrigin);if(y&&y!==y1){r4(D.name),window.location.assign(`${y}${A1}/${D.parent}#close=${encodeURIComponent(D.name)}`);return}if(D.made)await S1(w(D.parent),`/-/${D.parent}/branches/${D.name}`,{method:"DELETE"}).catch(()=>null),r4(D.name);j1(D.parent.split("/"))};return $.jsxDEV("main",{className:E?"app workspace":"app home",children:[E?null:$.jsxDEV("header",{children:[E?$.jsxDEV(b_,{},void 0,!1,void 0,this):null,$.jsxDEV(i5,{href:`${v0()&&v0()!==y1?v0():""}${A1}/`,onClick:(D)=>{if(v0()&&v0()!==y1)return;D.preventDefault(),j1([])}},void 0,!1,void 0,this),$.jsxDEV("nav",{"aria-label":"breadcrumb",className:"crumbs",children:[E?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"crumb-sep","aria-hidden":"true",children:"/"},void 0,!1,void 0,this),$.jsxDEV("span",{children:E.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:`${A1}/${E}`,className:"crumb-world",onClick:(D)=>{D.preventDefault(),j1(E.split("/"))},children:E.split("/")[1]},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,S?$.jsxDEV("span",{children:[" / ",S]},void 0,!0,void 0,this):null,u&&f==="trace"?$.jsxDEV("span",{children:" / trace"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),G0()?$.jsxDEV("a",{href:`${G0()}/${E?encodeURIComponent(E.split("/")[0]):""}`,title:`Back to the platform at ${new URL(G0()).host}`,className:"back-link",children:["← ",$.jsxDEV("span",{className:"back-text",children:E?`${E.split("/")[0]}'s Worlds`:new URL(G0()).host},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,E?null:$.jsxDEV("span",{className:"mode",children:J?"on this machine":R?`signed in as ${R}`:X.kind==="admin"?"host: admin":"opened with a link or key"},void 0,!1,void 0,this),E||J?null:$.jsxDEV("button",{onClick:B,children:"Sign out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),E?$.jsxDEV(xZ,{name:E,token:m(E),twin:S,tab:u?f??"overview":"overview",arg:u?b:void 0,...u&&h?{sub:h}:{},admin:j?null:X.kind==="admin"?_:null,snapshot:j,parentToken:I,who:{local:J,person:R||null,admin:X.kind==="admin"},onSignOut:B,onReturn:V,opens:(D)=>!!J2()[D]||X.kind==="admin"&&X.worlds.some((y)=>y.name===D),onRemoved:()=>{W(_),j1([])},onWho:A,onEnded:O,worlds:X.worlds.map((D)=>D.name)},E,!1,void 0,this):$.jsxDEV(DZ,{mode:X,admin:X.kind==="admin"?_:null,reload:()=>W(_)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function DZ({mode:_,admin:Q,reload:J}){let[q,U]=c.useState(""),[G,Z]=c.useState(""),[F,X]=c.useState(""),[Y,K]=c.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 v=await S1(Q,`/-/worlds/${f}/rotate`,{method:"POST"}),N=await v.json().catch(()=>({}));K(v.ok?`rotated ${f}: the new tokens are shown once — token ${N.token} · read token ${N.readToken}`:N.error?d1(N.error).text:`answered ${v.status}`),await J()},L=async(f)=>{let v=await S1(Q,`/-/worlds/${f}`,{method:"DELETE"}),N=await v.json().catch(()=>({}));K(v.ok?`removed ${f}`:N.error?d1(N.error).text:`answered ${v.status}`),await J()},[z,W]=c.useState(!1),[w,R]=c.useState(!1),[A,O]=c.useState(""),B=async(f)=>{f.preventDefault(),K(null),W(!0);try{let v=await S1(Q,"/-/worlds",{method:"POST",body:JSON.stringify({org:q,world:G,vendors:F.split(",").map((k)=>k.trim()).filter(Boolean)})}),N=await v.json();if(!v.ok){K(N.error?d1(N.error).text:`the host answered ${v.status}`);return}K(`provisioned ${N.name}`),Z(""),X(""),R(!1),await J()}finally{W(!1)}},M=A.trim().toLowerCase(),P=_.worlds.filter((f)=>!M||f.name.toLowerCase().includes(M)||f.twins.some((v)=>v.vendor.includes(M))),C=[...new Set(P.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:[E1(_.worlds.length,"World")," ",Q?"this host serves":"this key opens"]},void 0,!0,void 0,this),Q?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{K(null),R(!0)},children:[$.jsxDEV(w1,{name:"plus",size:16},void 0,!1,void 0,this),"New World"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"home-find",children:$.jsxDEV("input",{type:"search",placeholder:"Filter by World or vendor","aria-label":"Filter Worlds",value:A,onChange:(f)=>O(f.target.value)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y&&!w?$.jsxDEV("p",{role:"status",className:"home-note",children:Y},void 0,!1,void 0,this):null,C.map((f)=>$.jsxDEV(c.default.Fragment,{children:[$.jsxDEV("p",{className:"menu-label home-org",children:f},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"home-list",children:P.filter((v)=>v.name.split("/")[0]===f).map((v)=>$.jsxDEV("li",{children:[$.jsxDEV("a",{href:`${A1}/${v.name}`,onClick:(N)=>{N.preventDefault(),j1(v.name.split("/"))},children:[$.jsxDEV(w1,{name:"globe",size:20},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:v.name.split("/")[1]},void 0,!1,void 0,this),$.jsxDEV("small",{children:$.jsxDEV("code",{children:v.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:v.twins.map((N)=>$.jsxDEV("span",{title:B1(N.vendor),children:$.jsxDEV(l1,{vendor:N.vendor},void 0,!1,void 0,this)},N.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 ${v.name}`,children:"⋯"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"popover menu-list",children:[$.jsxDEV("button",{type:"button",onClick:(N)=>{N.currentTarget.closest("details")?.removeAttribute("open"),H(v.name)},children:"Rotate tokens…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"danger-item",onClick:(N)=>{N.currentTarget.closest("details")?.removeAttribute("open"),g0({title:`Remove ${v.name}?`,body:"The host stops serving it and its whole history goes with it. This cannot be undone.",action:"Remove World",danger:!0,typed:v.name}).then((k)=>{if(k)L(v.name)})},children:"Remove World…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},v.name,!0,void 0,this))},void 0,!1,void 0,this)]},f,!0,void 0,this)),P.length===0?$.jsxDEV("p",{className:"mode home-note",children:M?`No World matches ${A}.`:"No Worlds here yet."},void 0,!1,void 0,this):null,$.jsxDEV(W0,{open:w,onClose:()=>{if(!z)R(!1)},title:"New World",footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>R(!1),disabled:z,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"provision",className:"primary",disabled:z,children:z?"Making… (ten seconds or so)":"Make World"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"provision",onSubmit:B,className:"stack",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Org"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"org",value:q,onChange:(f)=>U(f.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"World"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"world",value:G,onChange:(f)=>Z(f.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Vendors"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"vendors",value:F,onChange:(f)=>X(f.target.value),placeholder:"stripe, slack",required:!0},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"A twin of each, with its default data."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y?$.jsxDEV("p",{role:"status",children:Y},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var bZ=["changes","events","trace","vendors","screens","canvas","branches","settings","remote","vault"],EZ=(_,Q)=>{let J=Q?.screens?.find((q)=>q.path.replace(/\/+$/,"")==="")??Q?.screens?.find((q)=>!/[{<]/.test(q.path));return Q&&J?`${Q2}/${_}/${Q.twin}${J.path.startsWith("/")?J.path:`/${J.path}`}`:null},p_={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 I0(_){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`:p_[J]?`${U} ${p_[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 $2=(_)=>/token|password|secret|key|credential/i.test(_.subject.type)&&_.subject.id.length>6?`••••${_.subject.id.slice(-4)}`:_.subject.id;function xZ({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:w,worlds:R=[]}){let[A,O]=c.useState("pending"),[B,M]=c.useState(null),[P,C]=c.useState(0),[f,v]=c.useState(null);c.useEffect(()=>{let p=!0;return M(null),S1(Q,`/-/${_}/session`,{method:"POST"}).then(async(e)=>{let $1=await e.json().catch(()=>({}));if(o_($1.issuer),$1.who)W?.($1.who);v(typeof $1.signsAs==="string"?$1.signsAs:null);let U1=s5($1.origin)?.origin;if(e.status===409&&U1&&U1!==y1){B8(U1,Q,_);return}if(!p)return;if(O(!e.ok?"unknown":$1.scope==="read"?"read":$1.scope==="write"?"write":"unknown"),!e.ok)M($1.error?d1($1.error).text:`answered ${e.status}`)}).catch((e)=>{if(p)O("unknown"),M(`the World did not answer: ${e instanceof Error?e.message:String(e)}`)}),()=>{p=!1}},[_,Q,P]);let N=B?{state:"error",error:B}:A==="pending"?{state:"pending"}:{state:"ok",scope:A},k=A==="write",u=(p)=>{if(p.status!==403)return;p.clone().json().then((e)=>{if(/read token|opens only reads|write access|reads only/i.test(e?.error??""))O("read")},()=>null)},[i,l]=c.useState(0);c.useEffect(()=>{let p=setInterval(()=>{if(!document.hidden)l((e)=>e+1)},5000);return()=>clearInterval(p)},[]);let[S,b]=c.useState(0),h=u1(Q,`/-/${_}/clock`,i+S);c.useEffect(()=>{if(_2&&!F&&h.state==="error"&&h.status===401)w?.()},[h,F,w]);let E=u1(Q,`/-/${_}/twins`),j=u1(Q,`/-/${_}/branches`,S),m=u1(Q,`/-/${_}/map`,Math.floor(i/2)),I=!(j.state==="error"&&(j.status===404||j.status===405)),V=bZ.includes(q)?q:"overview",D=E.state==="ok"?E.data.twins.map((p)=>p.twin):[];if(J&&E.state==="ok"&&!D.includes(J))return $.jsxDEV("main",{className:"center",children:$.jsxDEV(Z5,{title:`${_} has no ${J}`,action:$.jsxDEV("a",{href:`${A1}/${_}`,onClick:(p)=>{p.preventDefault(),j1(_.split("/"))},children:["Open ",_]},void 0,!0,void 0,this),children:$.jsxDEV("p",{children:["No vendor of this World is called ",J,". Its changesets are under Changes › History."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);let y=V==="vendors"&&U?U:void 0,t=()=>{O("pending"),C((p)=>p+1)};if(V==="canvas"||V==="vendors"&&!y||q==="screens"&&!U)return $.jsxDEV(LF,{name:_,token:Q,twins:E,session:N,retry:t,snapshot:F,back:()=>j1(_.split("/")),canWrite:k&&!F},void 0,!1,void 0,this);let a=q==="settings"?{kind:"settings",tab:((p)=>qQ.find(([e])=>e===p)?.[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":V==="vendors"&&y?"vendor":q==="trace"?"trace":q==="events"?"events":q==="changes"&&U==="changesets"?"history":"changes";return $.jsxDEV(sZ,{name:_,token:Q,view:o,win:a,who:Y,snapshot:F,onReturn:H,onSignOut:K,worlds:R,session:N,retry:t,...o==="vendor"?{arg:J??y}:o==="events"||o==="trace"||o==="screen"?U?{arg:U}:{}:{},...G?{sub:G}:{},twins:E,map:m,branches:I?j:null,clock:h,canWrite:k&&!F,refused:u,signsAs:f,opens:L,tick:i,admin:Z,onRemoved:z,onClock:()=>b((p)=>p+1),scope:F?"read":A},void 0,!1,void 0,this)}function w1({name:_,size:Q=20}){return $.jsxDEV("svg",{className:"icon",viewBox:"0 0 24 24",width:Q,height:Q,fill:"none",stroke:"currentColor",strokeWidth:Q<=16?1.75:1.5,strokeLinecap:"square",strokeLinejoin:"miter","aria-hidden":"true",children:(E_[_]??[]).map(([J,q],U)=>c.default.createElement(J,{key:U,...q}))},void 0,!1,void 0,this)}function s4(_){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 qQ=[["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"]],mZ=(_,Q)=>{let J=Q.split("/").pop()??Q,q=_.split("/").pop()??"";return J.startsWith(`${q}-`)?J.slice(q.length+1):J},x2=(_)=>_.replace(/^_+/,"").replace(/[_-]+/g," ");function UQ({record:_,history:Q}){let J=_.writes[_.writes.length-1],q=I0(J),U=s4(_.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)=>!MQ(F[H],X[H]));return $.jsxDEV("div",{className:"ws-diff","aria-label":`${q.label??$2(J)}: its changes`,children:[$.jsxDEV("div",{className:"ws-diff-head",children:[$.jsxDEV("span",{className:`ws-kind ${U.tone}`,title:U.word,children:$.jsxDEV(w1,{name:U.icon,size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(l1,{vendor:_.twin},void 0,!1,void 0,this),$.jsxDEV("div",{className:"cell-label",children:[$.jsxDEV("b",{children:q.label??$2(J)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[B1(_.twin)," · ",J.subject.type.replace(/^_+/,"").replace(/[_-]+/g," ")," ",$.jsxDEV("code",{children:$2(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:I0(H).what},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(V1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",d5(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(q2,{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(q2,{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 GQ({records:_,selected:Q,onPick:J,label:q}){let[U,G]=c.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=I0(H),z=s4(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(l1,{vendor:Y.twin},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:L.label??$2(H)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[x2(H.subject.type)," · ",L.what.split(" ").slice(-1)[0],Y.writes.length>1?` · ${E1(Y.writes.length,"write")}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:`ws-kind ${z.tone}`,title:z.word,"aria-label":z.word,children:$.jsxDEV(w1,{name:z.icon,size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},Y.key,!1,void 0,this)},X=[...new Set(_.map((Y)=>Y.twin))];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-view-switch",role:"group","aria-label":"List the records by",children:[$.jsxDEV("button",{type:"button","aria-pressed":!U,className:U?void 0:"on",onClick:()=>Z(!1),children:"Path"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button","aria-pressed":U,className:U?"on":void 0,onClick:()=>Z(!0),children:"Tree"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"ws-list","aria-label":q,children:U?X.map((Y)=>{let K=_.filter((H)=>H.twin===Y);return $.jsxDEV("li",{className:"ws-group",children:[$.jsxDEV("p",{className:"ws-group-head",children:[$.jsxDEV(l1,{vendor:Y},void 0,!1,void 0,this),$.jsxDEV("b",{children:B1(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 gZ({name:_,token:Q,branches:J,opens:q,refused:U,onChanged:G}){let[Z,F]=c.useState(""),[X,Y]=c.useState(!1),K=J?.state==="ok"&&J.data.checkedOut||_.split("/")[1],H=J?.state==="ok"&&J.data.named?.length?J.data.named:[{name:K,running:!0}],L=J?.state==="ok"?J.data.branches:[],z=Z.trim().toLowerCase(),W=(R)=>!z||R.toLowerCase().includes(z),w=(R)=>{R.currentTarget.closest("details")?.removeAttribute("open")};return $.jsxDEV("details",{className:"menu ws-pick",children:[$.jsxDEV("summary",{title:"The branch served here",children:[$.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-pick-label",children:[$.jsxDEV("small",{children:"Branch"},void 0,!1,void 0,this),$.jsxDEV("b",{children:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(w1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"popover ws-branch-menu",children:[$.jsxDEV("div",{className:"ws-branch-find",children:[$.jsxDEV("input",{type:"search",placeholder:"Filter","aria-label":"Filter branches",value:Z,onChange:(R)=>F(R.target.value)},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:(R)=>{w(R),Y(!0)},disabled:!J,children:"New branch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"This World"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-branch-list",children:H.filter((R)=>W(R.name)).map((R)=>$.jsxDEV("li",{className:R.name===K?"current":void 0,children:[$.jsxDEV("span",{className:"tick",children:R.name===K?$.jsxDEV(w1,{name:"check",size:16},void 0,!1,void 0,this):$.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"name",children:R.name},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:R.name===K?"served here":R.running?"running":"stopped"},void 0,!1,void 0,this)]},R.name,!0,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("p",{className:"menu-label",children:"Branches of it"},void 0,!1,void 0,this),L.length===0?$.jsxDEV("p",{className:"mode ws-branch-none",children:"None yet. New branch makes one, from now or as the World was."},void 0,!1,void 0,this):$.jsxDEV("ul",{className:"ws-branch-list",children:L.filter((R)=>W(R.name)).map((R)=>{let A=$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"tick",children:$.jsxDEV(w1,{name:"git-branch",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"name",children:mZ(_,R.name)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:R.at?.instant?$.jsxDEV($.Fragment,{children:["as of ",$.jsxDEV(V1,{iso:R.at.instant,time:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"live"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O=R.expiresAt?`Goes away ${new Date(R.expiresAt).toLocaleString()}`:"Kept";return $.jsxDEV("li",{children:q(R.name)?$.jsxDEV("a",{href:`${A1}/${R.name}`,title:O,onClick:(B)=>{B.preventDefault(),w(B),$Q(R.name,R.name.split("/"))},children:A},void 0,!1,void 0,this):$.jsxDEV("span",{title:`${O}. Its tokens went to whoever made it; it opens from their page.`,children:A},void 0,!1,void 0,this)},R.name,!1,void 0,this)})},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-branch-foot",children:$.jsxDEV("a",{href:`${A1}/${_}/~/branches`,onClick:(R)=>{R.preventDefault(),w(R),j1([..._.split("/"),"~","branches"])},children:"Manage branches…"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(HQ,{name:_,token:Q,open:X,onClose:()=>Y(!1),onMade:G,refused:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ZQ({name:_,view:Q,changes:J,changesets:q}){let U=(G)=>(Z)=>{Z.preventDefault(),j1([..._.split("/"),"~",...G])};return $.jsxDEV("nav",{className:"tabs ws-pane-tabs","aria-label":"Changes and history",children:[$.jsxDEV("a",{href:`${A1}/${_}/~/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:`${A1}/${_}/~/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 pZ({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]=c.useState(null),[W,w]=c.useState(!1),R=J.state==="ok"?[...J.data.changesets].sort((v,N)=>N.createdAt.localeCompare(v.createdAt)):[],A=R.find((v)=>v.name===q)??R[0],O=c.useMemo(()=>{let v=new Map;for(let N of A?BQ(A):[]){let k=`${N.twin}:${N.entry.subject.type}:${N.entry.subject.id}`,u=v.get(k)??{key:k,twin:N.twin,writes:[]};u.writes.push(N.entry),v.set(k,u)}return[...v.values()]},[A]),B=O.find((v)=>v.key===L)??O[0],M=u1(Q,B?`/-/${_}/log/${B.twin}`:null),P={added:0,removed:0,changed:0};for(let v of O)P[s4(v.writes).tone]=(P[s4(v.writes).tone]??0)+1;let C=A?t4(A):null,f=A?AQ(A,H):null;return $.jsxDEV("div",{className:"ws-two",children:[$.jsxDEV("div",{className:"ws-files",children:[$.jsxDEV(ZQ,{name:_,view:"history",changes:Y,changesets:R.length},void 0,!1,void 0,this),$.jsxDEV(U0,{load:J,what:"the changesets",lines:4},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-list ws-commits","aria-label":"Changesets",children:R.map((v)=>{let N=A?.name===v.name,k=t4(v).label==="Not sent";return $.jsxDEV("li",{children:$.jsxDEV("a",{href:`${A1}/${_}/~/changes/changesets/${v.name}`,className:N?"on":void 0,"aria-current":N?"true":void 0,onClick:(u)=>{u.preventDefault(),z(null),j1([..._.split("/"),"~","changes","changesets",v.name])},children:[$.jsxDEV("span",{className:"ws-row-text",children:[$.jsxDEV("b",{children:X8(v)},void 0,!1,void 0,this),$.jsxDEV("small",{children:[v.owner??(v.cutBy?d4(v.cutBy):"unrecorded")," • ",$.jsxDEV(V1,{iso:v.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k?$.jsxDEV("span",{className:"ws-unpushed",title:"Not pushed to the remote yet",children:$.jsxDEV(w1,{name:"arrow-up-from-line",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},v.name,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-pane-right",children:[J.state==="ok"&&!A?$.jsxDEV(Z5,{title:"No changesets yet",children:$.jsxDEV("p",{children:"Cut one from Changes: the cut box is at its foot."},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,A&&C&&f?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-commit-head",children:[$.jsxDEV("div",{className:"ws-commit-title",children:[$.jsxDEV("h3",{children:X8(A)},void 0,!1,void 0,this),$.jsxDEV("p",{className:"ws-commit-stat",children:[$.jsxDEV(w1,{name:"file-diff",size:16},void 0,!1,void 0,this)," ",E1(O.length,"changed record"),P.added?$.jsxDEV("span",{className:"plus",children:[" +",P.added]},void 0,!0,void 0,this):null,P.removed?$.jsxDEV("span",{className:"minus",children:[" −",P.removed]},void 0,!0,void 0,this):null,P.changed?$.jsxDEV("span",{className:"dot",children:[" •",P.changed]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode ws-commit-meta",children:[$.jsxDEV("code",{children:A.name},void 0,!1,void 0,this)," · ",$.jsxDEV(V1,{iso:A.createdAt},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"ws-commit-who",children:[["Owner",A.owner??(A.cutBy&&/^(token|token:read)$|^key:(?!.* for:)/.test(A.cutBy)?"no person: a service’s":"unrecorded")],["Cut by",A.cutBy?A.pushedBy&&A.applied===null&&A.cutBy==="machine"?"the machine it was cut on":d4(A.cutBy):"unrecorded"],...A.pushedBy?[["Pushed by",d4(A.pushedBy)]]:[]].map(([v,N])=>$.jsxDEV("span",{children:[$.jsxDEV("span",{className:"mode",children:v},void 0,!1,void 0,this)," ",N]},v,!0,void 0,this))},void 0,!1,void 0,this),A.pushedBy?$.jsxDEV("p",{className:"mode ws-commit-meta",children:A.applied===null?"Owner and cut by are as the World it was cut in recorded them; pushed by is this World's own record.":"Owner and cut by are this World’s record; pushed by is as the remote recorded it."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>w(!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(GQ,{records:O,...B?{selected:B.key}:{},onPick:z,label:"Records it changed"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-detail",children:B?$.jsxDEV(UQ,{record:B,history:M.state==="ok"?M.data.entries:M.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(W0,{open:W,onClose:()=>w(!1),title:`Review: ${X8(A)}`,wide:!0,children:[$.jsxDEV(d_,{name:_,token:Q,signsAs:U,c:A,canWrite:G,rooted:Z,refused:F,onChanged:X,part:"head",required:H},`h:${A.name}`,!1,void 0,this),$.jsxDEV(d_,{name:_,token:Q,signsAs:U,c:A,canWrite:G,rooted:Z,refused:F,onChanged:X,part:"review",required:H},`r:${A.name}`,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function cZ({name:_,token:Q,vendors:J,vendor:q,tick:U}){let[G,Z]=c.useState(c_*4),[F,X]=c.useState(""),[Y,K]=c.useState(null),H=u1(Q,`/-/${_}/timeline?limit=${G}${q?`&twin=${encodeURIComponent(q)}`:""}`,Math.floor(U/2)),L=H.state==="ok"?ZF(H.data.entries):[],z=[...new Set(L.map((P)=>I0(P.entry).what))].sort(),W=L.filter((P)=>!F||I0(P.entry).what===F),w=W.find((P)=>H5(P)===Y)??W[0],R=(P)=>(C)=>{C.preventDefault(),K(null),j1([..._.split("/"),"~","events",...P?[P]:[]])},A=w?.entry.input&&typeof w.entry.input==="object"?w.entry.input.body:void 0,O=w?jZ(w.entry.traceparent):null,B=w?l_(w):null,M=w?$F(w.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:`${A1}/${_}/~/events`,className:!q?"on":void 0,"aria-current":!q?"page":void 0,onClick:R(),children:"All"},void 0,!1,void 0,this),J.map((P)=>$.jsxDEV("a",{href:`${A1}/${_}/~/events/${P}`,className:q===P?"on":void 0,"aria-current":q===P?"page":void 0,onClick:R(P),children:[$.jsxDEV(l1,{vendor:P},void 0,!1,void 0,this),B1(P)]},P,!0,void 0,this))]},void 0,!0,void 0,this),$.jsxDEV("select",{"aria-label":"Operation",value:F,onChange:(P)=>{X(P.target.value),K(null)},children:[$.jsxDEV("option",{value:"",children:"Every operation"},void 0,!1,void 0,this),z.map((P)=>$.jsxDEV("option",{value:P,children:P},P,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-grid-wrap",children:[$.jsxDEV(U0,{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((P)=>{let C=I0(P.entry),f=l_(P),v=w&&H5(P)===H5(w);return $.jsxDEV("tr",{className:v?"on":void 0,"aria-selected":v,onClick:()=>K(H5(P)),children:[$.jsxDEV("td",{className:"mono",children:$.jsxDEV(V1,{iso:P.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(l1,{vendor:P.twin},void 0,!1,void 0,this),B1(P.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:$2(P.entry)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:d5(P.entry,P.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:e_(P.entry)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},H5(P),!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:w?$.jsxDEV($.Fragment,{children:[$.jsxDEV("div",{className:"ws-event-line",children:[$.jsxDEV("span",{className:"badge",children:KQ(w.entry)},void 0,!1,void 0,this),B?$.jsxDEV("span",{className:B.bad?"badge cs-bad":"badge cs-good",children:B.status},void 0,!1,void 0,this):null,$.jsxDEV("code",{children:[w.entry.subject.type,":",$2(w.entry)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(V1,{iso:w.entry.occurredAt},void 0,!1,void 0,this)," · ",d5(w.entry,w.caller)]},void 0,!0,void 0,this),O?$.jsxDEV("a",{href:`${A1}/${_}/~/trace/${O.trace}`,onClick:(P)=>{P.preventDefault(),j1([..._.split("/"),"~","trace",O.trace])},children:"Its trace →"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-event-panes",children:[$.jsxDEV("div",{role:"region","aria-label":"The request",children:[$.jsxDEV("h4",{children:"Request"},void 0,!1,void 0,this),A!==void 0?$.jsxDEV(UF,{body:A},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode",children:"No request body: the World or the vendor wrote it."},void 0,!1,void 0,this),M.length?$.jsxDEV($.Fragment,{children:[$.jsxDEV("h4",{children:"Usage"},void 0,!1,void 0,this),$.jsxDEV("dl",{className:"fields",children:M.map(([P,C])=>$.jsxDEV(c.default.Fragment,{children:[$.jsxDEV("dt",{children:P},void 0,!1,void 0,this),$.jsxDEV("dd",{children:C},void 0,!1,void 0,this)]},P,!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(LQ,{fields:w.entry.fields},void 0,!1,void 0,this),$.jsxDEV("h4",{children:w.copies.length?"Receipts":"Receipt"},void 0,!1,void 0,this),$.jsxDEV("p",{className:"mode",children:w.copies.length?w.copies.map((P)=>P.entry.receipt?.status??"landed copy").join(" · "):GF(w.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:[w?`${W.indexOf(w)+1} of ${W.length}`:W.length," events",q?` at ${B1(q)}`:""]},void 0,!0,void 0,this),H.state==="ok"&&H.data.next?$.jsxDEV("button",{type:"button",onClick:()=>Z((P)=>P+c_*4),children:"Load older"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function lZ({name:_,token:Q,id:J}){let q=/^[0-9a-f]{32}$/.test(J),U=u1(Q,q?`/-/${_}/timeline?trace=${J}&limit=500`:null),G=U.state==="ok"?[...U.data.entries].sort((H,L)=>-XQ(H,L)):[],[Z,F]=c.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:`${A1}/${_}/~/events`,onClick:(H)=>{H.preventDefault(),j1([..._.split("/"),"~","events"])},children:[$.jsxDEV(w1,{name:"arrow-left",size:16},void 0,!1,void 0,this)," Events"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("h2",{children:[G[0]?`${I0(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(U0,{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(V1,{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(B1).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(Z5,{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=H5(H),W=I0(H.entry);return $.jsxDEV(c.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(l1,{vendor:H.twin},void 0,!1,void 0,this),$.jsxDEV("b",{children:B1(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:KQ(H.entry)},void 0,!1,void 0,this)," on ",$.jsxDEV("code",{children:[H.entry.subject.type,":",$2(H.entry)]},void 0,!0,void 0,this)," · ",d5(H.entry,H.caller)," · ",e_(H.entry)]},void 0,!0,void 0,this),$.jsxDEV(LQ,{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 iZ({name:_,token:Q,vendor:J,withScreens:q,tick:U}){let G=u1(Q,`/-/${_}/checkpoint/${J}`,Math.floor(U/6)),Z=G.state==="ok"?G.data.tree.filter((M)=>M.deleted!==!0):[],F=[...new Set(Z.map((M)=>M.type))].map((M)=>({type:M,count:Z.filter((P)=>P.type===M).length})).sort((M,P)=>Number(M.type.startsWith("_"))-Number(P.type.startsWith("_"))||x2(M.type).localeCompare(x2(P.type))),[X,Y]=c.useState(null),[K,H]=c.useState(null),L=F.some((M)=>M.type===X)?X:F[0]?.type,z=Z.filter((M)=>M.type===L),W=z.find((M)=>M.id===K)??z[0],w=["name","email","title","text","description","subject","amount","percent_off","unit_amount","currency","status","channel","customer","product"],R=new Set(["id","type","object","livemode","created","updated","updatedAt","deleted"]),A=(M)=>!R.has(M)&&z.some((P)=>P[M]!==void 0&&P[M]!==null&&typeof P[M]!=="object"),O=[...new Set(z.flatMap((M)=>Object.keys(M)))],B=[...w.filter(A),...O.filter((M)=>!w.includes(M)&&A(M))].slice(0,4);return $.jsxDEV("div",{className:"ws-table-app",children:[$.jsxDEV("nav",{className:"ws-tables","aria-label":`${B1(J)}'s records`,children:[$.jsxDEV("div",{className:"ws-list-head",children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(l1,{vendor:J},void 0,!1,void 0,this),B1(J)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(U0,{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((M)=>$.jsxDEV("a",{href:`#${M.type}`,className:L===M.type?"on":void 0,"aria-current":L===M.type?"true":void 0,onClick:(P)=>{P.preventDefault(),Y(M.type),H(null)},children:[$.jsxDEV(w1,{name:"table-2",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:x2(M.type)},void 0,!1,void 0,this),$.jsxDEV("span",{className:"count",children:M.count},void 0,!1,void 0,this)]},M.type,!0,void 0,this)),$.jsxDEV("p",{className:"menu-label",children:"Also"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${A1}/${_}/~/events/${J}`,onClick:(M)=>{M.preventDefault(),j1([..._.split("/"),"~","events",J])},children:[$.jsxDEV(w1,{name:"activity",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Its events"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q?$.jsxDEV("a",{href:`${A1}/${_}/~/screens/${J}`,onClick:(M)=>{M.preventDefault(),j1([..._.split("/"),"~","screens",J])},children:[$.jsxDEV(w1,{name:"monitor",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Its screens"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-grid-wrap",children:[G.state==="ok"&&F.length===0?$.jsxDEV(Z5,{title:`${B1(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":`${x2(L??"")} records`,children:[$.jsxDEV("thead",{children:$.jsxDEV("tr",{children:[$.jsxDEV("th",{children:"id"},void 0,!1,void 0,this),B.map((M)=>$.jsxDEV("th",{children:M},M,!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((M)=>$.jsxDEV("tr",{className:W?.id===M.id?"on":void 0,"aria-selected":W?.id===M.id,onClick:()=>H(M.id),children:[$.jsxDEV("td",{children:$.jsxDEV("code",{children:M.id},void 0,!1,void 0,this)},void 0,!1,void 0,this),B.map((P)=>$.jsxDEV("td",{className:"ws-cell-clip",children:M[P]===void 0||M[P]===null?$.jsxDEV("span",{className:"mode",children:"—"},void 0,!1,void 0,this):String(M[P])},P,!1,void 0,this)),$.jsxDEV("td",{className:"mode",children:typeof M.updatedAt==="string"?$.jsxDEV(V1,{iso:M.updatedAt},void 0,!1,void 0,this):"—"},void 0,!1,void 0,this)]},M.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:x2(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(([M])=>M!=="type"&&M!=="id").map(([M,P])=>$.jsxDEV(c.default.Fragment,{children:[$.jsxDEV("dt",{children:M},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(q2,{v:P},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},M,!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 ${E1(z.length,x2(L??"record"))}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rZ({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(l1,{vendor:Q},void 0,!1,void 0,this),$.jsxDEV("b",{children:B1(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:`${A1}/${_}/~/vendors/${Q}`,onClick:(F)=>{F.preventDefault(),j1([..._.split("/"),"~","vendors",Q])},children:[$.jsxDEV(w1,{name:"table-2",size:16},void 0,!1,void 0,this),"Its records"]},void 0,!0,void 0,this),J?$.jsxDEV("a",{href:J,target:"_blank",rel:"noopener noreferrer",children:[$.jsxDEV(w1,{name:"external-link",size:16},void 0,!1,void 0,this),"New tab"]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),G.state==="ok"&&G.scope==="read"?$.jsxDEV("p",{className:"mode ws-screens-note",children:"You are looking read only: the screens browse, and refuse changes."},void 0,!1,void 0,this):null,q?$.jsxDEV("p",{role:"alert",className:"ws-screens-note",children:["The World did not say where its screens are: ",q]},void 0,!0,void 0,this):G.state==="pending"||J===void 0?$.jsxDEV("p",{className:"mode ws-screens-note",role:"status",children:"Opening…"},void 0,!1,void 0,this):null,G.state==="error"?$.jsxDEV("p",{role:"alert",className:"ws-screens-note",children:["The World did not open its screens: ",G.error," ",$.jsxDEV("button",{type:"button",onClick:Z,children:"Try again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,G.state==="ok"&&J===null?$.jsxDEV("p",{className:"mode ws-screens-note",children:[B1(Q),"'s pack lists no screens."]},void 0,!0,void 0,this):null,G.state==="ok"&&J?$.jsxDEV("iframe",{title:`${B1(Q)}, as this World shows it`,src:J},Q,!1,void 0,this):null]},void 0,!0,void 0,this)}function dZ({name:_,token:Q,who:J,scope:q}){let[U,G]=c.useState(0),Z=u1(Q,`/-/${_}/twins`),F=u1(Q,`/-/${_}/rules`,U),X=F.state==="ok"?F.data.changesets:null,[Y,K]=c.useState(null),[H,L]=c.useState(null),[z,W]=c.useState(!1),[w,R]=c.useState([]),A=Y??X?.approvals??1,O=H??X?.summary??"required",B=X!==null&&(A!==(X.approvals??1)||O!==(X.summary??"required")),M=(k,u)=>{if(R((i)=>[{ok:k,text:u,at:new Date().toISOString(),n:++t5},...i].slice(0,3)),!k)g1(u,"error")},P=async(k)=>{k.preventDefault(),W(!0);try{let u=await S1(Q,`/-/${_}/rules`,{method:"PUT",body:JSON.stringify({changesets:{approvals:A,summary:O}})});if(!u.ok){M(!1,`Save: ${await K0(u)}`);return}M(!0,`Saved: ${A===0?"no approval":E1(A,"approval")} before a deploy; a summary ${O==="required"?"required":"generated when none is given"}.`),K(null),L(null),G((i)=>i+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),v=Z.state==="ok"?Z.data.twins.filter((k)=>k.root?.url):[],N=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(U0,{load:F,what:"the rules",lines:2},void 0,!1,void 0,this),$.jsxDEV("form",{className:"ws-rules",onSubmit:(k)=>void P(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(N)||X===null,children:[$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"summary",checked:O==="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:O==="generated",onChange:()=>L("generated")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Generated from its changes when none is given"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:"Either way a cut takes every change not yet in a changeset: there is no staging."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-rule",children:[$.jsxDEV("h4",{children:"Ready to deploy"},void 0,!1,void 0,this),$.jsxDEV("ul",{className:"ws-rule-list",children:$.jsxDEV("li",{children:[$.jsxDEV(w1,{name:"check",size:16},void 0,!1,void 0,this),"Verified: replayed in a throwaway World, the World's checks passing"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("label",{className:"ws-rule-row",children:[$.jsxDEV("span",{children:"Approved by"},void 0,!1,void 0,this),$.jsxDEV("select",{value:A,onChange:(k)=>K(Number(k.target.value)),disabled:Boolean(N)||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"&&v.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,v.length?$.jsxDEV("ul",{className:"ws-rule-list",children:v.map((k)=>$.jsxDEV("li",{children:[$.jsxDEV(l1,{vendor:k.twin},void 0,!1,void 0,this),B1(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:`${A1}/${_}/~/settings/services`,onClick:(k)=>{k.preventDefault(),j1([..._.split("/"),"~","settings","services"])},children:"Real services"},void 0,!1,void 0,this)," sets each vendor's deploy policy."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(B2,{log:w,name:_},void 0,!1,void 0,this),$.jsxDEV("div",{className:"row-actions",children:[$.jsxDEV("button",{type:"submit",className:"primary",disabled:Boolean(N)||z||!B,title:N??void 0,children:z?"Saving…":"Save"},void 0,!1,void 0,this),B?$.jsxDEV("button",{type:"button",onClick:()=>{K(null),L(null)},children:"Cancel"},void 0,!1,void 0,this):null,N?$.jsxDEV("span",{className:"mode",children:[N,"."]},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 aZ({who:_,scope:Q,snapshot:J,portal:q,onSignOut:U}){let G=Q==="write"?"Reads and changes this World":Q==="read"?"Reads this World; changes nothing":"…",[Z,F]=J?["A snapshot",`of ${J.parent}, read only`]:_.local&&_.person?[_.person,"Signed in on this machine: this World is served here, and acts as you"]:_.local?["This machine","Served here, with no one signed in: what you do is recorded as this machine"]:_.person?[_.person,q?`Signed in through ${new URL(q).host}`:"Signed in"]:_.admin?["The host's admin","Opened with the host admin token: every World it serves"]:["A link or key","Opened with a token for this World"];return $.jsxDEV($.Fragment,{children:[$.jsxDEV("h3",{className:"settings-head",children:"Account"},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-account",children:[$.jsxDEV("span",{className:"ws-account-face","aria-hidden":"true",children:$.jsxDEV(w1,{name:_.person?"user":_.local?"monitor":J?"clock":"key-round",size:20},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("div",{className:"cell-label",children:[$.jsxDEV("b",{children:Z},void 0,!1,void 0,this),$.jsxDEV("small",{children:F},void 0,!1,void 0,this),$.jsxDEV("small",{children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_.local||J?null:$.jsxDEV("p",{children:$.jsxDEV("button",{type:"button",onClick:U,children:[$.jsxDEV(w1,{name:"log-out",size:16},void 0,!1,void 0,this),_.person?"Sign out":_.admin?"Sign out of the host":"Use another token"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q&&_.person?$.jsxDEV("p",{className:"mode",children:["Your profile, orgs and keys are on ",$.jsxDEV("a",{href:`${q}/`,children:new URL(q).host},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function sZ({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:w,clock:R,canWrite:A,refused:O,signsAs:B,opens:M,tick:P,admin:C,onRemoved:f,onClock:v,scope:N}){let k=TQ(_,Q,P,O),[u,i]=c.useState(0),l=u*1e5+Math.floor(P/2),S=u1(Q,`/-/${_}/diff`,l),b=u1(Q,`/-/${_}/changesets`,l),h=u1(Q,`/-/${_}/rules`,l),[E,j]=c.useState(null),m=(n)=>(R1)=>{R1?.preventDefault(),j1([..._.split("/"),"~",...n])},I=z.state==="ok"?z.data.twins.map((n)=>n.twin):[],V=new Map((W.state==="ok"?W.data.twins:[]).flatMap((n)=>{let R1=EZ(_,n);return R1?[[n.twin,R1]]:[]})),D=[...V.keys()],y=W.state==="ok"?W.data.twins.filter((n)=>n.root).map((n)=>n.twin):[],t=(n)=>W.state==="ok"?(W.data.twins.find((R1)=>R1.twin===n)?.resources??[]).reduce((R1,H1)=>R1+H1.count,0):0,_1=w?.state==="ok"&&w.data.checkedOut||_.split("/")[1],a=c.useMemo(()=>{if(S.state!=="ok")return[];let n=new Map;for(let R1 of S.data.changes){let H1=`${R1.twin}:${R1.entry.subject.type}:${R1.entry.subject.id}`,x1=n.get(H1)??{key:H1,twin:R1.twin,writes:[]};x1.writes.push(R1.entry),n.set(H1,x1)}return[...n.values()]},[S]),o=a.find((n)=>n.key===E)??a[0],p=u1(Q,J==="changes"&&o?`/-/${_}/log/${o.twin}`:null,l),e=S.state==="ok"?S.data.changes.length:0,$1=k.waiting.length,U1=k.there,q1=k.origin.state==="ok"?k.origin.data.origin:null,K1=!A?"This session reads the World; it changes nothing":!U1?"No remote: name one in Settings › Remote":null,W1=(n,R1,H1,x1,a1,i1)=>$.jsxDEV("a",{href:`${A1}/${_}/~/${x1}`,className:n?"on":void 0,"aria-current":n?"page":void 0,onClick:a1,children:[R1,$.jsxDEV("span",{children:H1},void 0,!1,void 0,this),i1?$.jsxDEV("span",{className:"count",children:i1},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),Y1=(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(i5,{href:`${A1}/${_}`,onClick:(n)=>{n.preventDefault(),m(["changes"])()}},void 0,!1,void 0,this),$.jsxDEV("details",{className:"menu ws-pick",children:[$.jsxDEV("summary",{title:"This World",children:[$.jsxDEV(w1,{name:"globe",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-pick-label",children:[$.jsxDEV("small",{children:"World"},void 0,!1,void 0,this),$.jsxDEV("b",{children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(w1,{name:"chevron-down",size:16},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"popover menu-list ws-world-menu",children:[Z.local?null:$.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"menu-label",children:"Worlds"},void 0,!1,void 0,this),K.map((n)=>$.jsxDEV("a",{href:`${A1}/${n}`,className:n===_?"on":void 0,onClick:(R1)=>{R1.preventDefault(),Y1(R1),j1(n.split("/"))},children:[n===_?$.jsxDEV(w1,{name:"check",size:16},void 0,!1,void 0,this):$.jsxDEV(w1,{name:"globe",size:16},void 0,!1,void 0,this),n]},n,!0,void 0,this)),$.jsxDEV("a",{href:`${v0()&&v0()!==y1?v0():""}${A1}/`,onClick:(n)=>{if(v0()&&v0()!==y1)return;n.preventDefault(),Y1(n),j1([])},children:[$.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),"All Worlds",G0()?` on ${new URL(G0()).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),G0()?$.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:[Q2,"/",_,"/<vendor>"]},void 0,!0,void 0,this),$.jsxDEV(F8,{text:c4({platform:G0(),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:[Q2,"/",_,"/<vendor>"]},void 0,!0,void 0,this),$.jsxDEV(F8,{text:c4()},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:[Q2,"/",_,"/<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(F8,{text:c4()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("hr",{},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${A1}/${_}/~/settings`,onClick:(n)=>{Y1(n),m(["settings"])(n)},children:[$.jsxDEV(w1,{name:"settings",size:16},void 0,!1,void 0,this),"Settings…"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(gZ,{name:_,token:Q,branches:w,opens:M,refused:O,onChanged:v},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:_1},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),q1?$.jsxDEV("a",{href:`${A1}/${_}/~/remote`,onClick:m(["remote"]),children:["origin ",q1.namespace,$1?$.jsxDEV("b",{children:[" ↑",$1]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):$.jsxDEV("a",{href:`${A1}/${_}/~/remote`,onClick:m(["remote"]),children:"no remote"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"sep",children:":"},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${A1}/${_}/~/settings/clock`,onClick:m(["settings","clock"]),children:R.state==="ok"?$.jsxDEV($.Fragment,{children:[R.data.frozen?"stopped at ":"",$.jsxDEV(V1,{iso:R.data.at,time:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):"…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-right",children:[$.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void k.pull(),disabled:Boolean(K1)||k.busy!==null,title:K1??`Fetch what ${U1} has and move this branch onto it`,children:[$.jsxDEV(w1,{name:"arrow-down-to-line",size:16},void 0,!1,void 0,this),k.busy==="Pull"?"Pulling…":"Pull"]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",className:"ws-btn",onClick:()=>void k.push(),disabled:Boolean(K1)||k.busy!==null||$1===0,title:K1??($1?`Push ${E1($1,"changeset")} to ${U1}`:`Every changeset is at ${U1}`),children:[$.jsxDEV(w1,{name:"arrow-up-from-line",size:16},void 0,!1,void 0,this),k.busy==="Push"?"Pushing…":"Push",$1?$.jsxDEV("span",{className:"ws-btn-count",children:$1},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:()=>m(["settings"])(),children:$.jsxDEV(w1,{name:"settings",size:16},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F?$.jsxDEV("div",{className:"ws-banner",role:"region","aria-label":"Snapshot",children:[$.jsxDEV(w1,{name:"clock",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:["You are looking at ",$.jsxDEV("b",{children:F.parent},void 0,!1,void 0,this)," as it was at ",$.jsxDEV(V1,{iso:F.at},void 0,!1,void 0,this),": a read-only snapshot",F.expiresAt?$.jsxDEV($.Fragment,{children:[", gone ",$.jsxDEV(V1,{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(B2,{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:[I.length?$.jsxDEV("a",{href:`${A1}/${_}/~/screens`,className:J==="screen"?"ws-screens-entry on":"ws-screens-entry",onClick:m(["screens"]),title:`The board: ${D2(I.map(B1))}`,children:[$.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Board"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"ws-screens-marks",children:[I.slice(0,3).map((n)=>$.jsxDEV(l1,{vendor:n},n,!1,void 0,this)),I.length>3?$.jsxDEV("span",{className:"more",children:["+",I.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),W1(J==="changes"||J==="history",$.jsxDEV(w1,{name:"file-diff",size:16},void 0,!1,void 0,this),"Changes","changes",m(["changes"]),a.length?String(a.length):void 0),W1(J==="events"&&!U||J==="trace",$.jsxDEV(w1,{name:"activity",size:16},void 0,!1,void 0,this),"Events","events",m(["events"])),$.jsxDEV("p",{className:"side-group",children:"Records"},void 0,!1,void 0,this),I.map((n)=>$.jsxDEV(c.default.Fragment,{children:W1(J==="vendor"&&U===n,$.jsxDEV(l1,{vendor:n},void 0,!1,void 0,this),B1(n),`vendors/${n}`,m(["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),W1(!1,$.jsxDEV(w1,{name:"cloud",size:16},void 0,!1,void 0,this),U1?"origin":"Name a remote…","remote",m(["remote"]),$1?`↑${$1}`:void 0)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-main",role:"main",children:[J==="changes"?$.jsxDEV("div",{className:"ws-status",children:[$.jsxDEV("div",{className:"ws-files",children:[$.jsxDEV(ZQ,{name:_,view:"changes",changes:a.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:S.state==="ok"?`${E1(a.length,"record")} · ${E1(e,"write")}`:""},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(U0,{load:S,what:"the changes",lines:4},void 0,!1,void 0,this),$.jsxDEV(GQ,{records:a,...o?{selected:o.key}:{},onPick:j,label:"Changed records"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"ws-detail",children:[S.state==="ok"&&!o?$.jsxDEV(Z5,{title:"No changes on this branch",action:$1>0&&U1?$.jsxDEV("button",{type:"button",className:"primary",disabled:Boolean(K1)||k.busy!==null,onClick:()=>void k.push(),children:["Push ",E1($1,"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 ",S.data.base.at?$.jsxDEV(V1,{iso:S.data.base.at},void 0,!1,void 0,this):$.jsxDEV("code",{children:S.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(UQ,{record:o,history:p.state==="ok"?p.data.entries:p.state==="error"?[]:null},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(AF,{pinned:!0,generated:h.state==="ok"&&h.data.changesets.summary==="generated",author:{face:$.jsxDEV(w1,{name:Z.person?"user":Z.local?"monitor":"key-round",size:18},void 0,!1,void 0,this),who:Z.person??(Z.local?"This machine":Z.admin?"The host's admin":"A token"),account:`${A1}/${_}/~/settings/account`,branch:_1},name:_,token:Q,changes:e,canWrite:A,refused:O,onCut:()=>{i((n)=>n+1),j(null)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,J==="history"?$.jsxDEV(pZ,{name:_,token:Q,sets:b,changes:a.length,withScreens:D,required:h.state==="ok"?h.data.changesets.approvals??1:1,...q?{sub:q}:{},signsAs:B,canWrite:A,rooted:y,refused:O,onChanged:()=>i((n)=>n+1)},void 0,!1,void 0,this):null,J==="events"?$.jsxDEV(cZ,{name:_,token:Q,vendors:I,...U&&I.includes(U)?{vendor:U}:{},tick:P},U??"",!1,void 0,this):null,J==="trace"?$.jsxDEV(lZ,{name:_,token:Q,id:U??""},void 0,!1,void 0,this):null,J==="vendor"&&U?$.jsxDEV(iZ,{name:_,token:Q,vendor:U,withScreens:D.includes(U),tick:P},U,!1,void 0,this):null,J==="screen"&&U?$.jsxDEV(rZ,{name:_,vendor:U,url:W.state==="ok"?V.get(U)??null:void 0,...W.state==="error"?{mapError:W.error}:{},holding:oZ(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(W0,{open:G?.kind==="settings",onClose:()=>m(["changes"])(),title:"Settings",wide:"window",children:G?.kind==="settings"?$.jsxDEV("div",{className:"ws-settings",children:[$.jsxDEV("nav",{"aria-label":"Settings",children:qQ.map(([n,R1,H1])=>$.jsxDEV("a",{href:`${A1}/${_}/~/settings/${n}`,className:G.tab===n?"on":void 0,"aria-current":G.tab===n?"page":void 0,onClick:m(["settings",n]),children:[$.jsxDEV(w1,{name:H1,size:16},void 0,!1,void 0,this),R1]},n,!0,void 0,this))},void 0,!1,void 0,this),$.jsxDEV("div",{className:"ws-settings-pane",children:[N==="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(aZ,{who:Z,scope:N,snapshot:F,portal:G0(),onSignOut:Y},void 0,!1,void 0,this):null,G.tab==="changesets"?$.jsxDEV(dZ,{name:_,token:Q,who:Z,scope:N},void 0,!1,void 0,this):null,G.tab==="remote"?$.jsxDEV(TF,{name:_,token:Q,canWrite:A,tick:P,refused:O},void 0,!1,void 0,this):null,G.tab==="access"||G.tab==="services"||G.tab==="checks"||G.tab==="clock"?$.jsxDEV(OF,{name:_,token:Q,admin:C,canWrite:A,refused:O,onRemoved:f,only:G.tab},void 0,!1,void 0,this):null,G.tab==="vault"?$.jsxDEV(RF,{name:_,token:Q,canWrite:A,refused:O},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(uZ,{},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(W0,{open:G?.kind==="branches",onClose:()=>m(["changes"])(),title:"Branches",wide:!0,children:G?.kind==="branches"?$.jsxDEV(_F,{name:_,token:Q,canWrite:A,branches:w,opens:M,...G.open?{open:G.open}:{},onChanged:v,refused:O},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function F8({text:_}){return $.jsxDEV("button",{type:"button",className:"agent-prompt-button",onClick:()=>{navigator.clipboard?.writeText(_).then(()=>g1("Copied the prompt: paste it into your coding agent"),()=>g1("Could not copy the prompt","error"))},children:"Copy a prompt for your coding agent"},void 0,!1,void 0,this)}var A8=(_)=>`${_.url.replace(/\/+$/,"")}/${_.namespace}`,tZ=(_)=>_.filter((Q)=>Q.applied===null||Q.applied.outcome==="refused"),oZ=(_,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)=>E1(q.count,q.type.replace(/^_+/,""))).join(" · ")+(J.length>Q?` · +${J.length-Q} more`:""):"nothing yet"},FQ=$.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 nZ({name:_,token:Q,clock:J,canWrite:q,onChanged:U,refused:G,open:Z}){let[F,X]=c.useState(!1),[Y,K]=c.useState(""),[H,L]=c.useState(""),[z,W]=c.useState(null),[w,R]=c.useState(!1),A=J.state==="ok"?J.data:null,O=async(C,f,v)=>{R(!0),W(null);try{let N=await S1(Q,`/-/${_}/${f}`,{method:f==="clock"?"PUT":"POST",body:JSON.stringify(v)});if(!N.ok){G(N),W({ok:!1,text:await K0(N)});return}let k=await N.json();W({ok:!0,text:`${C} — the World is at ${new Date(k.at).toLocaleString()}`}),X(!1),U()}catch(N){W({ok:!1,text:`the World did not answer: ${N instanceof Error?N.message:String(N)}`})}finally{R(!1)}},B=(C)=>{C.preventDefault();let f=new Date(Y);if(Number.isNaN(f.getTime())){W({ok:!1,text:"Pick a date and time."});return}if(A&&f.getTime()<Date.parse(A.at)){W({ok:!1,text:`The World's clock only moves forward: pick a time after ${new Date(A.at).toLocaleString()}.`});return}O("Clock set","clock",{at:f.toISOString()})},M=(C,f)=>{O(`Advanced ${f}`,"clock/advance",{by:C})},P=[["1h","1 hour"],["1d","1 day"],["7d","1 week"],["30d","30 days"]];return $.jsxDEV("div",{className:`clock${A?.frozen?" frozen":""}`,role:"region","aria-label":"World clock",children:[$.jsxDEV("p",{className:"clock-now",children:J.state==="loading"?$.jsxDEV("span",{className:"mode",children:"clock…"},void 0,!1,void 0,this):J.state==="error"?$.jsxDEV("span",{className:"mode",children:["Clock: ",J.error]},void 0,!0,void 0,this):A.frozen?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"badge",children:"Simulation"},void 0,!1,void 0,this)," World time ",$.jsxDEV("strong",{children:$.jsxDEV(V1,{iso:A.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV($.Fragment,{children:["World time ",$.jsxDEV("strong",{children:$.jsxDEV(V1,{iso:A.at},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:"· real time"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q&&A?$.jsxDEV("details",{className:Z?"clock-more inline":"clock-more",open:Z||void 0,children:[$.jsxDEV("summary",{children:"Simulate time…"},void 0,!1,void 0,this),$.jsxDEV("div",{className:Z?void 0:"popover",children:[$.jsxDEV("p",{className:"mode",children:"Move this World's clock forward to see what happens later: renewals, expiries, scheduled sends. Like a test clock, it only moves forward; to look back, the branch picker’s Manage branches… views an earlier moment."},void 0,!1,void 0,this),$.jsxDEV("div",{className:"clock-controls",children:[$.jsxDEV("button",{type:"button","aria-expanded":F,onClick:()=>{X(!F),K(X5(x_(A.at))),W(null)},children:"Set time…"},void 0,!1,void 0,this),$.jsxDEV("div",{role:"group","aria-label":"Advance the clock",className:"advance",children:[$.jsxDEV("span",{className:"mode",children:"Advance"},void 0,!1,void 0,this),P.map(([C,f])=>$.jsxDEV("button",{type:"button","aria-label":`Advance ${f}`,disabled:w||!A.frozen,title:A.frozen?void 0:"Set the time first: advancing moves a set clock",onClick:()=>M(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}M(H.trim(),`by ${H.trim()}`)},children:[$.jsxDEV("label",{className:"sr",children:["Advance by ",$.jsxDEV("input",{name:"advanceBy",value:H,onChange:(C)=>L(C.target.value),placeholder:"90m, 12h, 3d",size:9,disabled:!A.frozen},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"submit",disabled:w||!A.frozen,children:"Advance"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!A.frozen?$.jsxDEV("p",{className:"mode",children:"The World runs on real time. Set a time to start simulating; then advance it."},void 0,!1,void 0,this):null,F?$.jsxDEV("form",{className:"inline","aria-label":"Set the World time",onSubmit:B,noValidate:!0,children:[$.jsxDEV("label",{children:["World time ",$.jsxDEV("input",{name:"worldTime",type:"datetime-local",value:Y,min:X5(x_(A.at)),onChange:(C)=>K(C.target.value),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"mode",children:Intl.DateTimeFormat().resolvedOptions().timeZone},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",disabled:w,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 eZ({name:_,token:Q,clock:J,refused:q}){let[U,G]=c.useState(!1),[Z,F]=c.useState(""),[X,Y]=c.useState(null),[K,H]=c.useState(!1),L=J.state==="ok"?J.data.at:new Date().toISOString(),z=c.useRef(null);return c.useEffect(()=>{if(!U)return;let w=(A)=>{if(A.key==="Escape"&&!document.querySelector("dialog[open]"))G(!1),z.current?.querySelector("button")?.focus()},R=(A)=>{if(!z.current?.contains(A.target))G(!1)};return document.addEventListener("keydown",w),document.addEventListener("click",R),()=>{document.removeEventListener("keydown",w),document.removeEventListener("click",R)}},[U]),$.jsxDEV("div",{className:"as-of",ref:z,children:[$.jsxDEV("button",{type:"button","aria-expanded":U,title:"Open a read-only copy of this World as it was at a moment you pick",onClick:()=>{G(!U),F(X5(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(w)=>{w.preventDefault(),Y(null);let R=new Date(Z);if(Number.isNaN(R.getTime())){Y("Pick a date and time.");return}if(R.getTime()>Date.parse(L)){Y(`That is after the World's present (${new Date(L).toLocaleString()}); a snapshot looks back.`);return}H(!0);try{let A=await S1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:R.toISOString()},ttl:3600})});if(!A.ok){q(A),Y(await K0(A));return}let O=await A.json();L8({name:O.name,parent:_,token:O.token,readToken:O.readToken,at:R.toISOString(),expiresAt:O.expiresAt??null,parentOrigin:y1,made:!0});let B=s5(O.origin)?.origin;if(B&&B!==y1){B8(B,O.readToken,O.name,`${A1}/${O.name}`);return}j1(O.name.split("/"))}catch(A){Y(`the World did not answer: ${A instanceof Error?A.message:String(A)}`)}finally{H(!1)}},noValidate:!0,children:[$.jsxDEV("label",{children:["As of ",$.jsxDEV("input",{name:"asOf",type:"datetime-local",value:Z,max:X5(L),onChange:(w)=>F(w.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 HQ({name:_,token:Q,open:J,onClose:q,onMade:U,refused:G}){let Z=(f)=>f.split("/").pop()??f,[F,X]=c.useState(!1),[Y,K]=c.useState(null),[H,L]=c.useState(""),[z,W]=c.useState("now"),[w,R]=c.useState(""),[A,O]=c.useState("24"),[B,M]=c.useState(!0);c.useEffect(()=>{if(J)K(null),R(X5(new Date().toISOString()))},[J]);let P=async(f)=>{f.preventDefault(),K(null);let v=z==="at"?new Date(w):null;if(v&&Number.isNaN(v.getTime())){K("Pick a date and time, or make it as of now.");return}if(v&&v.getTime()>Date.now()){K("A branch is made as of now or a moment before it.");return}X(!0);let N=await S1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({ttl:Math.round(Number(A)*3600),...v?{at:{instant:v.toISOString()}}:B?{live:!0}:{},...H.trim()?{label:H.trim()}:{}})}).catch(()=>null);if(X(!1),!N){K(`${y1} did not answer`);return}if(!N.ok){G(N),K(await K0(N));return}let k=await N.json();L8({name:k.name,parent:_,token:k.token??"",readToken:k.readToken,at:(v??new Date).toISOString(),expiresAt:k.expiresAt??null,parentOrigin:y1,...k.origin?{origin:k.origin}:{}}),q(),L(""),g1(`Made ${Z(k.name)}`),U()};return $.jsxDEV(W0,{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 P(f),className:"stack",children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Label ",$.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("input",{name:"branchLabel",value:H,onChange:(f)=>L(f.target.value.toLowerCase()),placeholder:"checkout-flow",pattern:"[a-z0-9][a-z0-9\\-]{0,23}",maxLength:24},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("fieldset",{className:"choice",children:[$.jsxDEV("legend",{children:"From"},void 0,!1,void 0,this),$.jsxDEV("label",{className:"check",children:[$.jsxDEV("input",{type:"radio",name:"branchWhen",checked:z==="now",onChange:()=>W("now")},void 0,!1,void 0,this)," ",$.jsxDEV("span",{children:"Now: the World as it is"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z==="now"?$.jsxDEV("label",{className:"check sub",children:[$.jsxDEV("input",{type:"checkbox",name:"branchLive",checked:B,onChange:(f)=>M(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:w,max:X5(new Date().toISOString()),onChange:(f)=>R(f.target.value)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"Goes away after"},void 0,!1,void 0,this),$.jsxDEV("select",{name:"branchLife",value:A,onChange:(f)=>O(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=u1(Q,`/-/${_}/clock`),K=(O)=>O.split("/").pop()??O,[H,L]=c.useState(!1),z=(O)=>(B)=>{B.preventDefault(),j1([..._.split("/"),"~","branches",...O?O.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:[],w=q.state==="ok"&&(q.data.named?.length??0)>0?q.data.named:[{name:K(_),running:!0}],R=q.state==="ok"?q.data.checkedOut??K(_):K(_),A=async(O)=>{if(!await g0({title:`Remove the branch ${K(O)}?`,body:"Whoever holds its tokens loses it, and its history goes with it.",action:"Remove branch",danger:!0}))return;let B=await S1(Q,`/-/${_}/branches/${O}`,{method:"DELETE"}).catch((M)=>M);if(B instanceof Error){g1(`Remove ${K(O)}: the World did not answer (${B.message})`,"error");return}if(!B.ok){F(B),g1(`Remove ${K(O)}: ${await K0(B)}`,"error");return}r4(O),g1(`Removed ${K(O)}`),Z(),j1([..._.split("/"),"~","branches"])};if(G){let O=G.includes("/")?W.find((M)=>M.name===G):void 0,B=G.includes("/")?void 0:w.find((M)=>M.name===G);return $.jsxDEV($.Fragment,{children:[$.jsxDEV("p",{className:"crumbs-line",children:$.jsxDEV("a",{href:`${A1}/${_}/~/branches`,onClick:z(),children:"← Branches"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(U0,{load:q,what:"the branches"},void 0,!1,void 0,this),q.state==="ok"&&!O&&!B?$.jsxDEV("p",{className:"mode",children:["This World has no branch named ",G,"."]},void 0,!0,void 0,this):null,O?$.jsxDEV(QF,{name:_,b:O,canWrite:J,opens:U(O.name),remove:()=>void A(O.name)},void 0,!1,void 0,this):null,B&&!O?$.jsxDEV(JF,{name:_,token:Q,b:B,served:B.name===R,canWrite:J,canServe:q.state==="ok"&&Boolean(q.data.canServe)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}return $.jsxDEV("div",{"aria-labelledby":"branches",children:[$.jsxDEV("div",{className:"branches-head",children:[$.jsxDEV("p",{className:"lede",children:["Branch this World to look at it as it was, or to change it without touching ",$.jsxDEV("b",{children:R},void 0,!1,void 0,this),". Each branch's name opens its page."]},void 0,!0,void 0,this),J?$.jsxDEV("div",{className:"head-actions",children:[X?null:$.jsxDEV(eZ,{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(U0,{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:[w.map((O)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:[$.jsxDEV("a",{href:`${A1}/${_}/~/branches/${O.name}`,onClick:z(O.name),children:$.jsxDEV("b",{children:O.name},void 0,!1,void 0,this)},void 0,!1,void 0,this),O.name===R?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("span",{className:"badge live",children:"served here"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):O.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:${O.name}`,!0,void 0,this)),W.map((O)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("a",{href:`${A1}/${_}/~/branches/${O.name}`,onClick:z(O.name),children:$.jsxDEV("b",{children:K(O.name)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:K(O.from??_)},void 0,!1,void 0,this),$.jsxDEV("td",{children:O.at?.instant?$.jsxDEV(V1,{iso:O.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(V1,{iso:O.createdAt},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:O.expiresAt?$.jsxDEV(V1,{iso:O.expiresAt},void 0,!1,void 0,this):"kept"},void 0,!1,void 0,this)]},O.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(HQ,{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=z8(Q.name),F=u1(Z,Z?`/-/${Q.name}/diff`:null);return $.jsxDEV("div",{className:"branch-page",children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("h3",{children:[FQ," ",G(Q.name)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"changeset-actions",children:[q?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>$Q(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(V1,{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(V1,{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(V1,{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(BF,{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 JF({name:_,token:Q,b:J,served:q,canWrite:U,canServe:G}){let[Z,F]=c.useState(!1),[X,Y]=c.useState(null),K=async()=>{F(!0),Y(null);let H=await S1(Q,`/-/${_}/branches/${encodeURIComponent(J.name)}/serve`,{method:"POST"}).catch(()=>null);if(H?.ok){location.reload();return}F(!1),Y(H?await K0(H):`${y1} did not answer`)};return $.jsxDEV("div",{className:"branch-page",children:[$.jsxDEV("div",{className:"changeset-head",children:[$.jsxDEV("h3",{children:[FQ," ",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:`${A1}/${_}/~/changes`,onClick:(H)=>{H.preventDefault(),j1([..._.split("/"),"~","changes"])},children:"Changes"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this):G?$.jsxDEV("p",{className:"mode",children:["“Serve here” stops this one's twins and serves ",J.name," in its place."]},void 0,!0,void 0,this):$.jsxDEV("p",{className:"mode",children:"This host serves one of the World's own branches at a time, and does not switch them from this page."},void 0,!1,void 0,this),X?$.jsxDEV("p",{role:"alert",children:X},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var c_=50,H5=(_)=>`${_.twin}:${_.position}`,XQ=(_,Q)=>Date.parse(Q.entry.occurredAt)-Date.parse(_.entry.occurredAt)||_.twin.localeCompare(Q.twin)||Q.position-_.position,d4=(_)=>{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":_},d5=(_,Q)=>{let J=typeof Q==="string"?Q:typeof _.caller==="string"?_.caller:"";if(J.startsWith("key:")&&J.length>4)return`by ${d4(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"},KQ=(_)=>_.operation??_.op;function $F(_){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 YQ({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 q2({v:_}){if(typeof _==="string")return $.jsxDEV(YQ,{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 qF=(_)=>typeof _==="string"?_:Array.isArray(_)?_.map((Q)=>Q&&typeof Q==="object"&&typeof Q.text==="string"?Q.text:"").filter(Boolean).join(`
|
|
36
|
-
`):JSON.stringify(_??"");function UF({body:_}){if(_===null||typeof _!=="object"||Array.isArray(_))return $.jsxDEV(q2,{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(c.default.Fragment,{children:[$.jsxDEV("dt",{children:U},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(q2,{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(YQ,{text:qF(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 LQ({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(c.default.Fragment,{children:[$.jsxDEV("dt",{children:J},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(q2,{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 GF=(_)=>_.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 ZF(_){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(XQ)}var H8={deployed:5,confirmed:4,landed:3,replayed:2,skipped:1};function l_(_){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)=>(H8[G.status]??0)-(H8[U.status]??0))[0];return J&&!(H8[q.status]>=5)?{status:J.status,bad:!0}:{status:q.status,bad:!1}}var S0=1280,p0=820,l4=160,O0=72,K8=120,FF=72,p1=(_)=>`${_.vendor}:${_.id}`,b2=(_)=>`${_.vendor}:section:${_.section.id}`,m2=(_)=>[_.section.id,..._.section.aka??[]].map((Q)=>`${_.vendor}:section:${Q}`),zQ=(_,Q)=>Q.at&&("site"in Q.at)?Q.at.site:Q.at?`${Q2}/${_}/${Q.vendor}${Q.at.screen}`:null,i_=(_,Q)=>_.include?Q.filter((J)=>_.include.includes(p1(J))||m2(J).some((q)=>_.include.includes(q))):Q.filter((J)=>!(_.hidden??[]).includes(p1(J)));function HF({data:_}){let{frame:Q,url:J,active:q,picked:U,boards:G,addTo:Z,remove:F,compare:X}=_,Y=p1(Q),K=G.filter((L)=>L.include&&!L.include.includes(Y)&&!m2(Q).some((z)=>L.include.includes(z))),H=N1((L)=>L.transform[2]*(O0+K8)>=FF);return $.jsxDEV($.Fragment,{children:[$.jsxDEV(J8,{isVisible:H||U||q,position:F1.Top,align:"start",className:"frame-label",children:[$.jsxDEV(l1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:Q.title},void 0,!1,void 0,this),Q.changes?$.jsxDEV("button",{type:"button",className:"frame-changed nodrag",onClick:()=>X(Y),title:`${E1(Q.changes,"change")} here, not in a changeset: compare before and now`,children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),Q.changes]},void 0,!0,void 0,this):U?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>X(Y),title:"Compare with a branch of this World","aria-label":`Compare ${Q.title} with a branch`,children:$.jsxDEV(w1,{name:"file-diff",size:14},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,U&&K.length?$.jsxDEV("select",{className:"nodrag frame-add",value:"","aria-label":`Add ${Q.title} to a board`,onChange:(L)=>{if(L.target.value)Z(L.target.value,Y)},children:[$.jsxDEV("option",{value:"",children:"Add to board…"},void 0,!1,void 0,this),K.map((L)=>$.jsxDEV("option",{value:L.id,children:L.name},L.id,!1,void 0,this))]},void 0,!0,void 0,this):null,U&&F?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>F.act(Y),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:S0,height:p0},children:[$.jsxDEV("div",{className:"frame-bar",children:[$.jsxDEV(l1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("strong",{children:[B1(Q.vendor)," · ",Q.kind]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"frame-url",children:Q.url.replace(/^https?:\/\//,"")},void 0,!1,void 0,this),J?$.jsxDEV("a",{className:"nodrag",href:J,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${Q.title} in a new tab`,children:"↗"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:q?"frame-body nodrag nopan nowheel":"frame-body",children:J?$.jsxDEV("iframe",{title:Q.title,src:J,loading:"lazy",style:{pointerEvents:q?"auto":"none"}},void 0,!1,void 0,this):$.jsxDEV("div",{className:"frame-none",children:[$.jsxDEV("p",{children:$.jsxDEV("strong",{children:Q.unseen==="sites-not-routed"?`This World shows ${Q.title} only at its own local address.`:`${B1(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 WQ({name:_,label:Q,done:J}){let q=c.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 XF({data:_}){return $.jsxDEV($.Fragment,{children:[$.jsxDEV(S_,{isVisible:_.picked&&_.editable,minWidth:480,minHeight:360,color:"var(--accent)",onResizeEnd:_.resized},void 0,!1,void 0,this),$.jsxDEV(J8,{isVisible:!0,position:F1.Top,align:"start",offset:-30,className:"section-tag",children:[_.renaming?$.jsxDEV(WQ,{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",onClick:()=>_.pick(_.key),onDoubleClick:()=>{if(_.editable)_.rename(_.key)},title:_.editable?"Double-click to rename":void 0,children:[_.vendor?$.jsxDEV(l1,{vendor:_.vendor},void 0,!1,void 0,this):null,$.jsxDEV("span",{children:_.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.picked&&_.editable&&!_.renaming?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>_.remove(_.key),"aria-label":`Remove the section ${_.name}`,title:"Remove the section (its frames stay)",children:"✕"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:_.picked?"section-box on":"section-box"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function r_({url:_,title:Q}){return $.jsxDEV("div",{className:"compare-thumb",style:{width:420,height:420*p0/S0},children:$.jsxDEV("iframe",{title:Q,src:_,loading:"lazy",style:{width:S0,height:p0,transform:`scale(${420/S0})`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function KF({name:_,token:Q,frame:J,onClose:q,reads:U}){let[G,Z]=c.useState(J.since?"before":""),[F,X]=c.useState({state:"opening"}),[Y,K]=c.useState(null),H=c.useRef(new Set),L=u1(Q,`/-/${_}/branches`,U),z=L.state==="ok"?L.data.branches.filter((O)=>O.name!==Y&&!H.current.has(O.name)):[],W=u1(Q,`/-/${_}/board/changes?frame=${encodeURIComponent(p1(J))}`,U),w=async(O,B,M)=>{let P=J.at;if("site"in P){let v=new URL(J.url),N=B&&/^https?:\/\/\{host\}\./.test(B)?B.replace("{host}",v.hostname.toLowerCase()):null;return N?{url:`${N}${v.pathname}${v.search}`}:{why:"This World shows its branches' sites only on this machine."}}let C=`${Q2}/-/${_}/branches/${O}/pages?${new URLSearchParams({land:`/${O}/${J.vendor}${P.screen}`}).toString()}`,f=await fetch(C,{credentials:"same-origin",redirect:"manual"}).catch(()=>null);if(M())return{why:""};return f?.type==="opaqueredirect"?{url:C}:{why:`This World does not show its branches' pages${f?`: ${await K0(f)}`:""}.`}};c.useEffect(()=>{if(!J.at){X({state:"none",why:`${B1(J.vendor)}'s twin draws no page for this ${J.kind} yet; its changes are listed below.`});return}if(G===""){X({state:"none",why:"Choose a branch of this World to set beside it."});return}let O=!1;if(G!=="before"){X({state:"opening"});let v=L.state==="ok"?L.data.branches.find((k)=>k.name===G):void 0,N=setTimeout(()=>void w(G,v?.sites??null,()=>O).then((k)=>{if(!O)X("url"in k?{state:"ok",url:k.url}:{state:"none",why:k.why})}),300);return()=>{O=!0,clearTimeout(N)}}if(!J.since){X({state:"none",why:"Nothing here has changed since the World was last cut."});return}X({state:"opening"});let B=new Date(Date.parse(J.since)-1).toISOString(),M=null,P=setTimeout(()=>void(async()=>{let v=await S1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:B},ttl:3600}),signal:AbortSignal.timeout(60000)}).catch(()=>null);if(!v?.ok){X({state:"none",why:`The World made no copy of itself as it was then${v?`: ${await K0(v)}`:""}.`});return}let N=await v.json();if(M=N.name,K(N.name),H.current.add(N.name),O){S1(Q,`/-/${_}/branches/${N.name}`,{method:"DELETE"}).catch(()=>null);return}let k=await w(N.name,N.sites??null,()=>O);if(!O)X("url"in k?{state:"ok",url:k.url,at:B}:{state:"none",why:k.why})})(),500),C=()=>{if(M)S1(Q,`/-/${_}/branches/${M}`,{method:"DELETE",keepalive:!0}).catch(()=>null);M=null},f=(v)=>{if(!v.persisted)C()};return window.addEventListener("pagehide",f),()=>{O=!0,clearTimeout(P),window.removeEventListener("pagehide",f),C(),K(null)}},[_,Q,J.vendor,J.id,J.since,G]);let R=zQ(_,J),A=!J.at||G!==""?null:L.state==="ok"&&z.length===0?"This World has no branches to set beside it: make one under Branches.":L.state==="error"?`The World's branches could not be read: ${L.error}`:null;return $.jsxDEV("div",{className:"compare",role:"dialog","aria-label":`Changes to ${J.title}`,children:[$.jsxDEV("div",{className:"compare-head",children:[$.jsxDEV(l1,{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?`${E1(J.changes,"change")} not yet cut${J.since?`, since ${h2(J.since)}`:""}`:"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:G,onChange:(O)=>Z(O.target.value),children:[G===""?$.jsxDEV("option",{value:"",children:"Choose a branch…"},void 0,!1,void 0,this):null,J.since||G==="before"?$.jsxDEV("option",{value:"before",children:"Before these changes"},void 0,!1,void 0,this):null,G&&G!=="before"&&!z.some((O)=>O.name===G)?$.jsxDEV("option",{value:G,children:G.split("/")[1]},void 0,!1,void 0,this):null,z.map((O)=>$.jsxDEV("option",{value:O.name,children:[O.name.split("/")[1],O.at?.label?` (${O.at.label})`:O.at?.instant?` (as of ${h2(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:G==="before"?`Before${F.state==="ok"&&F.at?` · as of ${h2(F.at)}`:""}`:G?G.split("/")[1]:"A branch"},void 0,!1,void 0,this),A?$.jsxDEV("p",{className:"mode compare-note",children:A},void 0,!1,void 0,this):F.state==="ok"?$.jsxDEV(r_,{url:F.url,title:`${J.title} before`},void 0,!1,void 0,this):F.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:F.why},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("figure",{children:[$.jsxDEV("figcaption",{children:"Now"},void 0,!1,void 0,this),R?$.jsxDEV(r_,{url:R,title:`${J.title} now`},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode compare-note",children:[B1(J.vendor),"'s twin draws no page for this ",J.kind," yet."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.state==="error"?$.jsxDEV("p",{role:"alert",className:"mode",children:["Its changes could not be read: ",W.error]},void 0,!0,void 0,this):null,G!=="before"&&G&&W.state==="ok"&&W.data.acts.length?$.jsxDEV("p",{className:"mode compare-acts-head",children:"This World's own changes here, not yet cut:"},void 0,!1,void 0,this):null,$.jsxDEV("ol",{className:"compare-acts",children:(W.state==="ok"?W.data.acts:[]).map((O)=>{let B=O.entries[0],M=I0({...B,service:J.vendor,id:"",occurredAt:O.at});return $.jsxDEV("li",{children:[$.jsxDEV("span",{className:"mode",children:h2(O.at)},void 0,!1,void 0,this),$.jsxDEV("details",{children:[$.jsxDEV("summary",{children:[$.jsxDEV("strong",{children:M.what},void 0,!1,void 0,this),M.label?` · ${M.label}`:"",O.writes>1?$.jsxDEV("span",{className:"mode",children:[" and ",E1(O.writes-1,"more write")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:[O.entries.map((P,C)=>$.jsxDEV("li",{children:[$.jsxDEV("code",{children:P.operation??P.op},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[P.subject.type," ",$2(P)]},void 0,!0,void 0,this)]},C,!0,void 0,this)),O.writes>O.entries.length?$.jsxDEV("li",{className:"mode",children:["and ",E1(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}:${B.subject.type}:${B.subject.id}`,!0,void 0,this)})},void 0,!1,void 0,this),W.state==="ok"&&W.data.total>W.data.acts.length?$.jsxDEV("p",{className:"mode",children:["and ",E1(W.data.total-W.data.acts.length,"earlier change"),", in Changes"]},void 0,!0,void 0,this):null,$.jsxDEV("a",{className:"compare-all",href:`${A1}/${_}/~/changes`,onClick:(O)=>{O.preventDefault(),j1([..._.split("/"),"~","changes"])},children:"Every change in the World →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var YF={screen:HF,section:XF};function LF(_){return $.jsxDEV(Q8,{children:$.jsxDEV(zF,{..._},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function zF({name:_,token:Q,session:J,retry:q,snapshot:U,back:G,canWrite:Z}){let F=c.useRef(null),X=c.useRef(0),Y=c.useRef(Promise.resolve()),K=c.useRef(0),[,H]=c.useState(0),[L,z]=c.useState({state:"loading"}),[W,w]=c.useState(null),[R,A]=c.useState(0),O=c.useRef(0),B=c.useRef(0),M=c.useCallback(async()=>{let x=K.current,s=++O.current,G1=await S1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),Z1=G1?.ok?await G1.json().catch(()=>null):null;if(s<B.current)return;if(B.current=s,!Z1?.frames||!Z1.boards||!Z1.version){let f1=G1?`the World answered ${G1.status}`:"the World did not answer";z((L1)=>L1.state==="ok"?L1:{state:"error",status:G1?.status??0,error:f1}),w(f1);return}if(w(null),A((f1)=>f1+1),x===K.current&&X.current===0)F.current={boards:Z1.boards,version:Z1.version};z({state:"ok",data:Z1})},[Q,_]);c.useEffect(()=>{M();let x=setInterval(()=>{if(!document.hidden)M()},1e4);return()=>clearInterval(x)},[M]);let P=L.state==="ok"?L.data.frames:[],C=F.current?.boards??[{id:"everything",name:"Everything"}],[f,v]=c.useState(null),N=P.some((x)=>x.changes),k=f??(N?"changes":"everything"),u=(k==="changes"?C[0]:C.find((x)=>x.id===k))??C[0],[i,l]=c.useState(new Set),S=Z&&!U,b=c.useCallback((x)=>{if(!F.current)return g1("The board is being read again: make that change once it shows","error"),Promise.resolve();F.current={...F.current,boards:x(F.current.boards)},X.current+=1,K.current+=1,H((G1)=>G1+1);let s=Y.current.then(async()=>{let G1=F.current;if(!G1)return;try{let Z1=await S1(Q,`/-/${_}/board`,{method:"PUT",body:JSON.stringify({boards:G1.boards,version:G1.version}),signal:AbortSignal.timeout(15000)}),f1=await Z1.json().catch(()=>null);if(Z1.ok&&f1?.boards&&f1.version)F.current={boards:X.current>1&&F.current?F.current.boards:f1.boards,version:f1.version};else if(Z1.status===409&&f1?.boards&&f1.version)F.current={boards:f1.boards,version:f1.version},g1("Someone else changed the board first: it is shown as they left it","error");else throw Error(f1?.error??`the World answered ${Z1.status}`)}catch(Z1){g1(`The board was not kept: ${Z1 instanceof Error?Z1.message:String(Z1)}`,"error"),F.current=null;let f1=await S1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),L1=f1?.ok?await f1.json().catch(()=>null):null;if(L1?.boards&&L1.version)F.current={boards:L1.boards,version:L1.version}}}).finally(()=>{if(X.current-=1,K.current+=1,H((G1)=>G1+1),X.current===0&&!F.current)M()});return Y.current=s,s},[Q,_,M]),h=(x,s)=>{b((G1)=>G1.map((Z1)=>Z1.id===x?s(Z1):Z1))},E=(x)=>x.parent?`${x.vendor}:${x.parent}`:null,j=new Set(P.map(p1)),m=(x)=>{let s=E(x);return!s||!j.has(s)},I=k==="changes"?P.filter((x)=>x.changes):u.include?i_(u,P):i_(u,P).filter((x)=>m(x)||i.has(E(x))),V=P.filter((x)=>x.changes&&!I.includes(x)).reduce((x,s)=>x+s.changes,0),[D,y]=c.useState(null),[t,_1]=c.useState(null),[a,o]=c.useState(null),p=c5(),e=C.filter((x)=>x.include),$1=(x,s)=>h(x,(G1)=>({...G1,include:[...G1.include??[],s]})),U1={label:u.include?"Take it off this board":"Hide it",act:(x)=>{_1(null),h(u.id,(s)=>s.include?{...s,include:s.include.filter((G1)=>G1!==x)}:{...s,hidden:[...s.hidden??[],x]})}},q1=(x)=>({x:x.position.x,y:x.position.y,w:x.width??x.measured?.width??S0,h:x.height??x.measured?.height??p0}),K1=(x,s)=>{let G1=q1(x),Z1=G1.x+G1.w/2,f1=G1.y+G1.h/2;return s.filter((L1)=>L1.type==="section").map((L1,M1)=>({s:L1,i:M1})).filter(({s:L1})=>{let M1=q1(L1);return Z1>=M1.x&&Z1<=M1.x+M1.w&&f1>=M1.y&&f1<=M1.y+M1.h}).sort((L1,M1)=>q1(L1.s).w*q1(L1.s).h-q1(M1.s).w*q1(M1.s).h||M1.i-L1.i)[0]?.s},W1=c.useCallback(()=>{let x=new Map;for(let P1 of I){let k1=u.placed?.[p1(P1)];if(k1)x.set(p1(P1),k1)}let s=Math.max(-l4,...[...x.values()].map((P1)=>P1.y+p0)),G1=[...new Set(I.map(b2))];for(let P1 of G1){let k1=I.filter((r1)=>b2(r1)===P1),e1=k1.filter((r1)=>x.has(p1(r1))).map((r1)=>x.get(p1(r1))),C1=e1.length?Math.max(...e1.map((r1)=>r1.x))+S0+l4:0,L0=e1.length?Math.min(...e1.map((r1)=>r1.y)):s+l4+O0*2+K8;for(let r1 of k1)if(!x.has(p1(r1)))x.set(p1(r1),{x:C1,y:L0}),C1+=S0+l4;s=Math.max(s,L0+p0)}let Z1=u.sections??{},f1=(P1,k1,e1,C1,L0)=>({id:`sec:${P1}`,type:"section",position:{x:k1.x,y:k1.y},width:k1.w,height:k1.h,zIndex:0,draggable:S,data:{key:P1,name:e1,vendor:C1,named:L0}}),L1=[];for(let P1 of G1){let k1=I.find((h1)=>b2(h1)===P1),e1=m2(k1).find((h1)=>Z1[h1])??P1,C1=Z1[e1];if(C1?.gone)continue;let L0=I.filter((h1)=>b2(h1)===P1).map((h1)=>x.get(p1(h1))),r1={x:Math.min(...L0.map((h1)=>h1.x))-O0,y:Math.min(...L0.map((h1)=>h1.y))-O0-K8,w:0,h:0};r1.w=Math.max(...L0.map((h1)=>h1.x))+S0+O0-r1.x,r1.h=Math.max(...L0.map((h1)=>h1.y))+p0+O0-r1.y;let o4=I.filter((h1)=>b2(h1)===P1&&!u.placed?.[p1(h1)]).map((h1)=>x.get(p1(h1))),V0=C1?{...C1}:r1;if(C1)for(let h1 of o4)V0.w=Math.max(V0.w,h1.x+S0+O0-V0.x),V0.h=Math.max(V0.h,h1.y+p0+O0-V0.y);L1.push(f1(e1,V0,C1?.name??`${B1(k1.vendor)} · ${k1.section.title}`,k1.vendor,Boolean(C1?.name)))}for(let[P1,k1]of Object.entries(Z1))if(P1.startsWith("user:")&&!k1.gone)L1.push(f1(P1,k1,k1.name??"Section",null,!0));let M1=I.map((P1)=>({id:p1(P1),type:"screen",zIndex:1,width:S0,height:p0,draggable:S,position:x.get(p1(P1)),data:{world:_,frame:P1,url:zQ(_,P1)}}));return[...L1,...M1]},[JSON.stringify(I),JSON.stringify(u),_,S]),[Y1,n,R1]=O_([]),H1=N1((x)=>x.transform[2]),x1=c.useRef("");c.useEffect(()=>{let x=W1();if(n(x),x.length&&x1.current!==k)x1.current=k,requestAnimationFrame(()=>{p.fitView({padding:{top:"72px",left:"272px",right:"40px",bottom:"72px"},duration:0})})},[W1,n]);let a1=(x,s=[],G1={})=>{let Z1=Object.fromEntries(s.map((L1)=>{let M1=p.getNode(`sec:${L1}`);if(!M1)return[L1,void 0];let P1=q1(M1),k1=M1.data,e1=G1[L1]??(k1.named?k1.name:void 0);return[L1,{x:Math.round(P1.x),y:Math.round(P1.y),w:Math.round(P1.w),h:Math.round(P1.h),...e1?{name:e1.slice(0,80)}:{}}]}).filter(([,L1])=>L1!==void 0)),f1=Object.fromEntries(Object.entries(x).map(([L1,M1])=>[L1,{x:Math.round(M1.x),y:Math.round(M1.y)}]));h(u.id,(L1)=>({...L1,placed:{...L1.placed??{},...f1},sections:{...L1.sections??{},...Z1}}))},i1=c.useRef(null),k0=(x,s)=>{if(s.type!=="section"){i1.current=null;return}let G1=p.getNodes(),Z1=q1(s),f1=(L1)=>{let M1=q1(L1);if(L1.type==="screen"){let P1=M1.x+M1.w/2,k1=M1.y+M1.h/2;return P1>=Z1.x&&P1<=Z1.x+Z1.w&&k1>=Z1.y&&k1<=Z1.y+Z1.h}return L1.id!==s.id&&M1.x>=Z1.x&&M1.y>=Z1.y&&M1.x+M1.w<=Z1.x+Z1.w&&M1.y+M1.h<=Z1.y+Z1.h};i1.current={id:s.id,from:{...s.position},members:G1.filter(f1).map((L1)=>({id:L1.id,x:L1.position.x,y:L1.position.y}))}},B0=(x,s)=>{let G1=i1.current;if(!G1||G1.id!==s.id)return;let Z1=s.position.x-G1.from.x,f1=s.position.y-G1.from.y,L1=new Map(G1.members.map((M1)=>[M1.id,M1]));n((M1)=>M1.map((P1)=>{let k1=L1.get(P1.id);return k1?{...P1,position:{x:k1.x+Z1,y:k1.y+f1}}:P1}))},w0=(x,s)=>{let G1=i1.current;i1.current=null;let Z1=s.position.x-(G1?.from.x??s.position.x),f1=s.position.y-(G1?.from.y??s.position.y),L1=s.type==="screen"?[{id:s.id,x:s.position.x,y:s.position.y}]:(G1?.members??[]).map((M1)=>({...M1,x:M1.x+Z1,y:M1.y+f1}));requestAnimationFrame(()=>{let M1=p.getNodes(),P1=new Map(L1.filter((C1)=>!C1.id.startsWith("sec:")).map((C1)=>[C1.id,{x:C1.x,y:C1.y}])),k1=new Set([...s.type==="section"?[s.data.key]:[],...L1.filter((C1)=>C1.id.startsWith("sec:")).map((C1)=>C1.id.slice(4))]),e1=new Set(M1.filter((C1)=>P1.has(C1.id)).flatMap((C1)=>m2(C1.data.frame)));for(let C1 of M1){if(C1.type==="screen"&&m2(C1.data.frame).some((L0)=>e1.has(L0))&&!P1.has(C1.id))P1.set(C1.id,{x:C1.position.x,y:C1.position.y});if(C1.type==="section"&&e1.has(C1.data.key))k1.add(C1.data.key)}a1(Object.fromEntries(P1),[...k1])})},J0=(x)=>Object.fromEntries(p.getNodes().filter((s)=>s.type==="screen"&&m2(s.data.frame).includes(x)).map((s)=>[s.id,{x:s.position.x,y:s.position.y}])),[Z0,n1]=c.useState(null),Y0=(x)=>{_1(`sec:${x}`),n1(x)},U2=(x,s)=>{if(n1(null),!s)return;n((G1)=>G1.map((Z1)=>Z1.id===`sec:${x}`?{...Z1,data:{...Z1.data,name:s,named:!0}}:Z1)),requestAnimationFrame(()=>a1(J0(x),[x],{[x]:s}))},P0=(x)=>{_1(null);let s=p.getNode(`sec:${x}`);h(u.id,(G1)=>{let Z1=Object.fromEntries(Object.entries(G1.sections??{}).filter(([f1])=>f1!==x));return{...G1,sections:x.startsWith("user:")?Z1:{...Z1,[x]:{...s?{x:Math.round(s.position.x),y:Math.round(s.position.y),w:Math.round(q1(s).w),h:Math.round(q1(s).h)}:{x:0,y:0,w:0,h:0},gone:!0}}}})},c0=()=>{let x=t?p.getNode(t):void 0,s=p.screenToFlowPosition({x:window.innerWidth/2,y:window.innerHeight/2}),G1=x?.type==="screen"?{x:x.position.x-O0,y:x.position.y-O0,w:S0+O0*2,h:p0+O0*2}:{x:s.x-900,y:s.y-600,w:1800,h:1200},Z1=`user:${Date.now().toString(36)}`,f1=Object.keys(u.sections??{}).filter((L1)=>L1.startsWith("user:")).length+1;_1(`sec:${Z1}`),h(u.id,(L1)=>({...L1,sections:{...L1.sections??{},[Z1]:{x:Math.round(G1.x),y:Math.round(G1.y),w:Math.round(G1.w),h:Math.round(G1.h),name:`Section ${f1}`}}}))},G2=Y1.map((x)=>x.type==="section"?{...x,data:{...x.data,picked:t===x.id,editable:S,renaming:S&&Z0===x.data.key,pick:(s)=>_1(`sec:${s}`),rename:Y0,renamed:U2,remove:P0,resized:()=>requestAnimationFrame(()=>{let s=x.data.key;a1(J0(s),[s])})}}:{...x,data:{...x.data,active:D===x.id,picked:t===x.id,boards:S?e:[],addTo:$1,remove:!S||u.include&&!u.include.includes(x.id)?null:U1,compare:(s)=>{_1(s),o(s)}}});c.useEffect(()=>{let x=(s)=>{if(s.target?.closest("input, textarea, select, [contenteditable]"))return;if(s.key==="Escape"){if(D)y(null);else _1(null);return}if(!S||D)return;if((s.key==="Delete"||s.key==="Backspace")&&t){if(s.preventDefault(),t.startsWith("sec:"))P0(t.slice(4));else if(!u.include||u.include.includes(t))U1.act(t);else g1("It is on this board with its whole group: take the group off in the list to remove it","error");return}if(s.key==="S"&&s.shiftKey&&!s.metaKey&&!s.ctrlKey)s.preventDefault(),c0()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)});let l0=(x)=>{_1(x);let s=p.getNode(x);if(!s)return;let G1=q1(s);p.fitBounds({x:G1.x,y:G1.y,width:G1.w,height:G1.h},{padding:0.15,duration:400})},c2=()=>{let x=`board-${Date.now().toString(36)}`;v(x),b((s)=>[...s,{id:x,name:`Board ${s.length}`,include:[]}])},y0=()=>n1(`board:${u.id}`),T=()=>{let x=u.id;v(null),b((s)=>s.filter((G1)=>G1.id!==x))},g=[...new Map(P.map((x)=>[b2(x),x])).values()],Q1=u.include?[...g.filter((x)=>!m2(x).some((s)=>u.include.includes(s))).map((x)=>({key:b2(x),label:`${B1(x.vendor)} · ${x.section.title} (all)`})),...P.filter((x)=>!I.includes(x)).map((x)=>({key:p1(x),label:x.title}))]:[],J1=u.include?[]:P.filter((x)=>(u.hidden??[]).includes(p1(x))),X1=Y1.filter((x)=>x.type==="section"),O1=Y1.filter((x)=>x.type==="screen"),T1=new Map(O1.map((x)=>[x.id,K1(x,Y1)?.id??null])),v1=new Map;for(let x of P){let s=E(x);if(s&&j.has(s))v1.set(s,(v1.get(s)??0)+1)}let I1=(x)=>{let s=x.data.frame;return $.jsxDEV("li",{children:[$.jsxDEV("button",{type:"button",className:t===x.id?"on":void 0,onClick:()=>l0(x.id),onDoubleClick:()=>y(x.id),children:[$.jsxDEV(l1,{vendor:s.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:s.title},void 0,!1,void 0,this),s.changes?$.jsxDEV("span",{className:"layer-changed",title:`${E1(s.changes,"change")}, not in a changeset: its mark on the board compares before and now`,children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),s.changes]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),v1.get(x.id)&&k!=="changes"&&!u.include?$.jsxDEV("button",{type:"button",className:"ghost layer-open","aria-expanded":i.has(x.id),onClick:()=>l((G1)=>{let Z1=new Set(G1);if(Z1.has(x.id))Z1.delete(x.id);else Z1.add(x.id);return Z1}),title:i.has(x.id)?"Close the pages under it":"Open the pages under it",children:[i.has(x.id)?"−":"+",v1.get(x.id)]},void 0,!0,void 0,this):null]},x.id,!0,void 0,this)},A0=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,j0=J.state==="ok"&&L.state==="ok";return $.jsxDEV("div",{className:"canvas full",role:"region","aria-label":"The World's board",style:{"--zoom":H1},children:$.jsxDEV(R_,{nodes:j0?G2:[],onNodesChange:R1,nodeTypes:YF,onNodeDragStart:k0,onNodeDrag:B0,onNodeDragStop:w0,onNodeClick:(x,s)=>{if(s.id!==D)_1(s.id)},onNodeDoubleClick:(x,s)=>{if(s.type==="screen")_1(s.id),y(s.id)},onPaneClick:()=>{y(null),_1(null)},minZoom:0.03,maxZoom:1.5,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnPinch:!0,zoomOnScroll:!1,zoomOnDoubleClick:!1,colorMode:A0?"dark":"light",proOptions:{hideAttribution:!0},children:[$.jsxDEV(w_,{variant:x0.Dots,gap:28,size:1.4},void 0,!1,void 0,this),$.jsxDEV(m0,{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:_.split("/")[1]},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:[_.split("/")[0],U?" · snapshot":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"board-tabs",role:"tablist","aria-label":"Boards",children:[$.jsxDEV("button",{type:"button",role:"tab","aria-selected":k==="changes",className:k==="changes"?"on":void 0,onClick:()=>{_1(null),y(null),v("changes")},title:"The pages whose records changed and are not yet in a changeset",children:["Changes",N?` (${P.filter((x)=>x.changes).length})`:""]},void 0,!0,void 0,this),C.map((x)=>Z0===`board:${x.id}`?$.jsxDEV(WQ,{name:x.name,label:"Name this board",done:(s)=>{if(n1(null),s)h(x.id,(G1)=>({...G1,name:s}))}},x.id,!1,void 0,this):$.jsxDEV("button",{type:"button",role:"tab","aria-selected":k!=="changes"&&x.id===u.id,className:k!=="changes"&&x.id===u.id?"on":void 0,onClick:()=>{_1(null),y(null),v(x.id)},onDoubleClick:S&&x.id===u.id&&x.include?y0:void 0,children:x.name},x.id,!1,void 0,this)),S?$.jsxDEV("button",{type:"button",className:"ghost",onClick:c2,"aria-label":"A new board",children:"+"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),u.include&&S?$.jsxDEV("div",{className:"board-acts",children:[$.jsxDEV("button",{type:"button",className:"ghost",onClick:y0,children:"Rename"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"ghost",onClick:T,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:[X1.map((x)=>{let s=x.data;return $.jsxDEV("li",{children:[$.jsxDEV("button",{type:"button",className:t===x.id?"layer-section on":"layer-section",onClick:()=>l0(x.id),onDoubleClick:()=>{if(S)l0(x.id),Y0(s.key)},children:[s.vendor?$.jsxDEV(l1,{vendor:s.vendor},void 0,!1,void 0,this):$.jsxDEV(w1,{name:"layout-grid",size:14},void 0,!1,void 0,this),$.jsxDEV("span",{children:s.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list inner",children:O1.filter((G1)=>T1.get(G1.id)===x.id).map(I1)},void 0,!1,void 0,this)]},x.id,!0,void 0,this)}),O1.filter((x)=>!T1.get(x.id)).map(I1)]},void 0,!0,void 0,this),u.include&&!I.length?$.jsxDEV("p",{className:"mode pad-s",children:"An empty board: add frames from Everything, or below."},void 0,!1,void 0,this):null,Q1.length&&S?$.jsxDEV("select",{className:"board-add",value:"","aria-label":"Add to this board",onChange:(x)=>{let s=x.target.value;if(s)h(u.id,(G1)=>({...G1,include:[...G1.include??[],s]}))},children:[$.jsxDEV("option",{value:"",children:"Add to this board…"},void 0,!1,void 0,this),Q1.map((x)=>$.jsxDEV("option",{value:x.key,children:x.label},x.key,!1,void 0,this))]},void 0,!0,void 0,this):null,J1.length?$.jsxDEV("details",{className:"board-hidden",children:[$.jsxDEV("summary",{children:["Hidden (",J1.length,")"]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list",children:J1.map((x)=>$.jsxDEV("li",{children:S?$.jsxDEV("button",{type:"button",onClick:()=>h(u.id,(s)=>({...s,hidden:(s.hidden??[]).filter((G1)=>G1!==p1(x))})),children:[$.jsxDEV("span",{children:x.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:x.title},void 0,!1,void 0,this)},p1(x),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,V?$.jsxDEV("button",{type:"button",className:"board-elsewhere",onClick:()=>v("changes"),children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),E1(V,"change")," not on this board"]},void 0,!0,void 0,this):null,$.jsxDEV(U0,{load:L,what:"the board"},void 0,!1,void 0,this),W&&L.state==="ok"?$.jsxDEV("p",{role:"alert",className:"pad-s",children:["The board could not be read again (",W,"): 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),D?$.jsxDEV(m0,{position:"top-center",className:"float hint using",children:[$.jsxDEV("span",{className:"mode",children:["Using ",I.find((x)=>p1(x)===D)?.title??D]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>y(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(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),S?$.jsxDEV(m0,{position:"bottom-center",className:"float board-tools",children:$.jsxDEV("button",{type:"button",className:"ghost",onClick:c0,title:"Section (⇧S): around the selected frame, else in the middle",children:[$.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Section"},void 0,!1,void 0,this),$.jsxDEV("kbd",{children:"⇧S"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,a&&I.some((x)=>p1(x)===a)?$.jsxDEV(m0,{position:"top-right",className:"float compare-panel",children:$.jsxDEV(KF,{name:_,token:Q,frame:I.find((x)=>p1(x)===a),onClose:()=>o(null),reads:R},a,!1,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV(N_,{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 BQ=(_)=>_.actions.map((Q)=>({twin:Q.service,entry:{...Q.action,service:Q.service,op:Q.action.op??Q.action.operation??""}})),WF=(_)=>{let Q=_.action.input??{};return!(typeof Q.operationId==="string"||Q.graphql!==void 0&&Q.graphql!==null)};function t4(_){let Q=_.actions.filter(WF).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 X8=(_)=>_.message??_.narration?.split(`
|
|
36
|
+
`):JSON.stringify(_??"");function UF({body:_}){if(_===null||typeof _!=="object"||Array.isArray(_))return $.jsxDEV(q2,{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(c.default.Fragment,{children:[$.jsxDEV("dt",{children:U},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(q2,{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(YQ,{text:qF(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 LQ({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(c.default.Fragment,{children:[$.jsxDEV("dt",{children:J},void 0,!1,void 0,this),$.jsxDEV("dd",{children:$.jsxDEV(q2,{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 GF=(_)=>_.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 ZF(_){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(XQ)}var H8={deployed:5,confirmed:4,landed:3,replayed:2,skipped:1};function l_(_){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)=>(H8[G.status]??0)-(H8[U.status]??0))[0];return J&&!(H8[q.status]>=5)?{status:J.status,bad:!0}:{status:q.status,bad:!1}}var S0=1280,p0=820,l4=160,O0=72,K8=120,FF=72,p1=(_)=>`${_.vendor}:${_.id}`,b2=(_)=>`${_.vendor}:section:${_.section.id}`,m2=(_)=>[_.section.id,..._.section.aka??[]].map((Q)=>`${_.vendor}:section:${Q}`),zQ=(_,Q)=>Q.at&&("site"in Q.at)?Q.at.site:Q.at?`${Q2}/${_}/${Q.vendor}${Q.at.screen}`:null,i_=(_,Q)=>_.include?Q.filter((J)=>_.include.includes(p1(J))||m2(J).some((q)=>_.include.includes(q))):Q.filter((J)=>!(_.hidden??[]).includes(p1(J)));function HF({data:_}){let{frame:Q,url:J,active:q,picked:U,boards:G,addTo:Z,remove:F,compare:X}=_,Y=p1(Q),K=G.filter((L)=>L.include&&!L.include.includes(Y)&&!m2(Q).some((z)=>L.include.includes(z))),H=N1((L)=>L.transform[2]*(O0+K8)>=FF);return $.jsxDEV($.Fragment,{children:[$.jsxDEV(J8,{isVisible:H||U||q,position:F1.Top,align:"start",className:"frame-label",children:[$.jsxDEV(l1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:Q.title},void 0,!1,void 0,this),Q.changes?$.jsxDEV("button",{type:"button",className:"frame-changed nodrag",onClick:()=>X(Y),title:`${E1(Q.changes,"change")} here, not in a changeset: compare before and now`,children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),Q.changes]},void 0,!0,void 0,this):U?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>X(Y),title:"Compare with a branch of this World","aria-label":`Compare ${Q.title} with a branch`,children:$.jsxDEV(w1,{name:"file-diff",size:14},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,U&&K.length?$.jsxDEV("select",{className:"nodrag frame-add",value:"","aria-label":`Add ${Q.title} to a board`,onChange:(L)=>{if(L.target.value)Z(L.target.value,Y)},children:[$.jsxDEV("option",{value:"",children:"Add to board…"},void 0,!1,void 0,this),K.map((L)=>$.jsxDEV("option",{value:L.id,children:L.name},L.id,!1,void 0,this))]},void 0,!0,void 0,this):null,U&&F?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>F.act(Y),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:S0,height:p0},children:[$.jsxDEV("div",{className:"frame-bar",children:[$.jsxDEV(l1,{vendor:Q.vendor},void 0,!1,void 0,this),$.jsxDEV("strong",{children:[B1(Q.vendor)," · ",Q.kind]},void 0,!0,void 0,this),$.jsxDEV("span",{className:"frame-url",children:Q.url.replace(/^https?:\/\//,"")},void 0,!1,void 0,this),J?$.jsxDEV("a",{className:"nodrag",href:J,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${Q.title} in a new tab`,children:"↗"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:q?"frame-body nodrag nopan nowheel":"frame-body",children:J?$.jsxDEV("iframe",{title:Q.title,src:J,loading:"lazy",style:{pointerEvents:q?"auto":"none"}},void 0,!1,void 0,this):$.jsxDEV("div",{className:"frame-none",children:[$.jsxDEV("p",{children:$.jsxDEV("strong",{children:Q.unseen==="sites-not-routed"?`This World shows ${Q.title} only at its own local address.`:`${B1(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 WQ({name:_,label:Q,done:J}){let q=c.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 XF({data:_}){return $.jsxDEV($.Fragment,{children:[$.jsxDEV(S_,{isVisible:_.picked&&_.editable,minWidth:480,minHeight:360,color:"var(--accent)",onResizeEnd:_.resized},void 0,!1,void 0,this),$.jsxDEV(J8,{isVisible:!0,position:F1.Top,align:"start",offset:-30,className:"section-tag",children:[_.renaming?$.jsxDEV(WQ,{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",onClick:()=>_.pick(_.key),onDoubleClick:()=>{if(_.editable)_.rename(_.key)},title:_.editable?"Double-click to rename":void 0,children:[_.vendor?$.jsxDEV(l1,{vendor:_.vendor},void 0,!1,void 0,this):null,$.jsxDEV("span",{children:_.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_.picked&&_.editable&&!_.renaming?$.jsxDEV("button",{type:"button",className:"ghost nodrag",onClick:()=>_.remove(_.key),"aria-label":`Remove the section ${_.name}`,title:"Remove the section (its frames stay)",children:"✕"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("div",{className:_.picked?"section-box on":"section-box"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function r_({url:_,title:Q}){return $.jsxDEV("div",{className:"compare-thumb",style:{width:420,height:420*p0/S0},children:$.jsxDEV("iframe",{title:Q,src:_,loading:"lazy",style:{width:S0,height:p0,transform:`scale(${420/S0})`}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function KF({name:_,token:Q,frame:J,onClose:q,reads:U}){let[G,Z]=c.useState(J.since?"before":""),[F,X]=c.useState({state:"opening"}),[Y,K]=c.useState(null),H=c.useRef(new Set),L=u1(Q,`/-/${_}/branches`,U),z=L.state==="ok"?L.data.branches.filter((O)=>O.name!==Y&&!H.current.has(O.name)):[],W=u1(Q,`/-/${_}/board/changes?frame=${encodeURIComponent(p1(J))}`,U),w=async(O,B,M)=>{let P=J.at;if("site"in P){let v=new URL(J.url),N=B&&/^https?:\/\/\{host\}\./.test(B)?B.replace("{host}",v.hostname.toLowerCase()):null;return N?{url:`${N}${v.pathname}${v.search}`}:{why:"This World shows its branches' sites only on this machine."}}let C=`${Q2}/-/${_}/branches/${O}/pages?${new URLSearchParams({land:`/${O}/${J.vendor}${P.screen}`}).toString()}`,f=await fetch(C,{credentials:"same-origin",redirect:"manual"}).catch(()=>null);if(M())return{why:""};return f?.type==="opaqueredirect"?{url:C}:{why:`This World does not show its branches' pages${f?`: ${await K0(f)}`:""}.`}};c.useEffect(()=>{if(!J.at){X({state:"none",why:`${B1(J.vendor)}'s twin draws no page for this ${J.kind} yet; its changes are listed below.`});return}if(G===""){X({state:"none",why:"Choose a branch of this World to set beside it."});return}let O=!1;if(G!=="before"){X({state:"opening"});let v=L.state==="ok"?L.data.branches.find((k)=>k.name===G):void 0,N=setTimeout(()=>void w(G,v?.sites??null,()=>O).then((k)=>{if(!O)X("url"in k?{state:"ok",url:k.url}:{state:"none",why:k.why})}),300);return()=>{O=!0,clearTimeout(N)}}if(!J.since){X({state:"none",why:"Nothing here has changed since the World was last cut."});return}X({state:"opening"});let B=new Date(Date.parse(J.since)-1).toISOString(),M=null,P=setTimeout(()=>void(async()=>{let v=await S1(Q,`/-/${_}/branches`,{method:"POST",body:JSON.stringify({at:{instant:B},ttl:3600}),signal:AbortSignal.timeout(60000)}).catch(()=>null);if(!v?.ok){X({state:"none",why:`The World made no copy of itself as it was then${v?`: ${await K0(v)}`:""}.`});return}let N=await v.json();if(M=N.name,K(N.name),H.current.add(N.name),O){S1(Q,`/-/${_}/branches/${N.name}`,{method:"DELETE"}).catch(()=>null);return}let k=await w(N.name,N.sites??null,()=>O);if(!O)X("url"in k?{state:"ok",url:k.url,at:B}:{state:"none",why:k.why})})(),500),C=()=>{if(M)S1(Q,`/-/${_}/branches/${M}`,{method:"DELETE",keepalive:!0}).catch(()=>null);M=null},f=(v)=>{if(!v.persisted)C()};return window.addEventListener("pagehide",f),()=>{O=!0,clearTimeout(P),window.removeEventListener("pagehide",f),C(),K(null)}},[_,Q,J.vendor,J.id,J.since,G]);let R=zQ(_,J),A=!J.at||G!==""?null:L.state==="ok"&&z.length===0?"This World has no branches to set beside it: make one under Branches.":L.state==="error"?`The World's branches could not be read: ${L.error}`:null;return $.jsxDEV("div",{className:"compare",role:"dialog","aria-label":`Changes to ${J.title}`,children:[$.jsxDEV("div",{className:"compare-head",children:[$.jsxDEV(l1,{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?`${E1(J.changes,"change")} not yet cut${J.since?`, since ${h2(J.since)}`:""}`:"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:G,onChange:(O)=>Z(O.target.value),children:[G===""?$.jsxDEV("option",{value:"",children:"Choose a branch…"},void 0,!1,void 0,this):null,J.since||G==="before"?$.jsxDEV("option",{value:"before",children:"Before these changes"},void 0,!1,void 0,this):null,G&&G!=="before"&&!z.some((O)=>O.name===G)?$.jsxDEV("option",{value:G,children:G.split("/")[1]},void 0,!1,void 0,this):null,z.map((O)=>$.jsxDEV("option",{value:O.name,children:[O.name.split("/")[1],O.at?.label?` (${O.at.label})`:O.at?.instant?` (as of ${h2(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:G==="before"?`Before${F.state==="ok"&&F.at?` · as of ${h2(F.at)}`:""}`:G?G.split("/")[1]:"A branch"},void 0,!1,void 0,this),A?$.jsxDEV("p",{className:"mode compare-note",children:A},void 0,!1,void 0,this):F.state==="ok"?$.jsxDEV(r_,{url:F.url,title:`${J.title} before`},void 0,!1,void 0,this):F.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:F.why},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("figure",{children:[$.jsxDEV("figcaption",{children:"Now"},void 0,!1,void 0,this),R?$.jsxDEV(r_,{url:R,title:`${J.title} now`},void 0,!1,void 0,this):$.jsxDEV("p",{className:"mode compare-note",children:[B1(J.vendor),"'s twin draws no page for this ",J.kind," yet."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W.state==="error"?$.jsxDEV("p",{role:"alert",className:"mode",children:["Its changes could not be read: ",W.error]},void 0,!0,void 0,this):null,G!=="before"&&G&&W.state==="ok"&&W.data.acts.length?$.jsxDEV("p",{className:"mode compare-acts-head",children:"This World's own changes here, not yet cut:"},void 0,!1,void 0,this):null,$.jsxDEV("ol",{className:"compare-acts",children:(W.state==="ok"?W.data.acts:[]).map((O)=>{let B=O.entries[0],M=I0({...B,service:J.vendor,id:"",occurredAt:O.at});return $.jsxDEV("li",{children:[$.jsxDEV("span",{className:"mode",children:h2(O.at)},void 0,!1,void 0,this),$.jsxDEV("details",{children:[$.jsxDEV("summary",{children:[$.jsxDEV("strong",{children:M.what},void 0,!1,void 0,this),M.label?` · ${M.label}`:"",O.writes>1?$.jsxDEV("span",{className:"mode",children:[" and ",E1(O.writes-1,"more write")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV("ul",{children:[O.entries.map((P,C)=>$.jsxDEV("li",{children:[$.jsxDEV("code",{children:P.operation??P.op},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[P.subject.type," ",$2(P)]},void 0,!0,void 0,this)]},C,!0,void 0,this)),O.writes>O.entries.length?$.jsxDEV("li",{className:"mode",children:["and ",E1(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}:${B.subject.type}:${B.subject.id}`,!0,void 0,this)})},void 0,!1,void 0,this),W.state==="ok"&&W.data.total>W.data.acts.length?$.jsxDEV("p",{className:"mode",children:["and ",E1(W.data.total-W.data.acts.length,"earlier change"),", in Changes"]},void 0,!0,void 0,this):null,$.jsxDEV("a",{className:"compare-all",href:`${A1}/${_}/~/changes`,onClick:(O)=>{O.preventDefault(),j1([..._.split("/"),"~","changes"])},children:"Every change in the World →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var YF={screen:HF,section:XF};function LF(_){return $.jsxDEV(Q8,{children:$.jsxDEV(zF,{..._},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function zF({name:_,token:Q,session:J,retry:q,snapshot:U,back:G,canWrite:Z}){let F=c.useRef(null),X=c.useRef(0),Y=c.useRef(Promise.resolve()),K=c.useRef(0),[,H]=c.useState(0),[L,z]=c.useState({state:"loading"}),[W,w]=c.useState(null),[R,A]=c.useState(0),O=c.useRef(0),B=c.useRef(0),M=c.useCallback(async()=>{let x=K.current,s=++O.current,G1=await S1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),Z1=G1?.ok?await G1.json().catch(()=>null):null;if(s<B.current)return;if(B.current=s,!Z1?.frames||!Z1.boards||!Z1.version){let f1=G1?`the World answered ${G1.status}`:"the World did not answer";z((L1)=>L1.state==="ok"?L1:{state:"error",status:G1?.status??0,error:f1}),w(f1);return}if(w(null),A((f1)=>f1+1),x===K.current&&X.current===0)F.current={boards:Z1.boards,version:Z1.version};z({state:"ok",data:Z1})},[Q,_]);c.useEffect(()=>{M();let x=setInterval(()=>{if(!document.hidden)M()},1e4);return()=>clearInterval(x)},[M]);let P=L.state==="ok"?L.data.frames:[],C=F.current?.boards??[{id:"everything",name:"Everything"}],[f,v]=c.useState(null),N=P.some((x)=>x.changes),k=f??(N?"changes":"everything"),u=(k==="changes"?C[0]:C.find((x)=>x.id===k))??C[0],[i,l]=c.useState(new Set),S=Z&&!U,b=c.useCallback((x)=>{if(!F.current)return g1("The board is being read again: make that change once it shows","error"),Promise.resolve();F.current={...F.current,boards:x(F.current.boards)},X.current+=1,K.current+=1,H((G1)=>G1+1);let s=Y.current.then(async()=>{let G1=F.current;if(!G1)return;try{let Z1=await S1(Q,`/-/${_}/board`,{method:"PUT",body:JSON.stringify({boards:G1.boards,version:G1.version}),signal:AbortSignal.timeout(15000)}),f1=await Z1.json().catch(()=>null);if(Z1.ok&&f1?.boards&&f1.version)F.current={boards:X.current>1&&F.current?F.current.boards:f1.boards,version:f1.version};else if(Z1.status===409&&f1?.boards&&f1.version)F.current={boards:f1.boards,version:f1.version},g1("Someone else changed the board first: it is shown as they left it","error");else throw Error(f1?.error??`the World answered ${Z1.status}`)}catch(Z1){g1(`The board was not kept: ${Z1 instanceof Error?Z1.message:String(Z1)}`,"error"),F.current=null;let f1=await S1(Q,`/-/${_}/board`,{signal:AbortSignal.timeout(15000)}).catch(()=>null),L1=f1?.ok?await f1.json().catch(()=>null):null;if(L1?.boards&&L1.version)F.current={boards:L1.boards,version:L1.version}}}).finally(()=>{if(X.current-=1,K.current+=1,H((G1)=>G1+1),X.current===0&&!F.current)M()});return Y.current=s,s},[Q,_,M]),h=(x,s)=>{b((G1)=>G1.map((Z1)=>Z1.id===x?s(Z1):Z1))},E=(x)=>x.parent?`${x.vendor}:${x.parent}`:null,j=new Set(P.map(p1)),m=(x)=>{let s=E(x);return!s||!j.has(s)},I=k==="changes"?P.filter((x)=>x.changes):u.include?i_(u,P):i_(u,P).filter((x)=>m(x)||i.has(E(x))),V=P.filter((x)=>x.changes&&!I.includes(x)).reduce((x,s)=>x+s.changes,0),[D,y]=c.useState(null),[t,_1]=c.useState(null),[a,o]=c.useState(null),p=c5(),e=C.filter((x)=>x.include),$1=(x,s)=>h(x,(G1)=>({...G1,include:[...G1.include??[],s]})),U1={label:u.include?"Take it off this board":"Hide it",act:(x)=>{_1(null),h(u.id,(s)=>s.include?{...s,include:s.include.filter((G1)=>G1!==x)}:{...s,hidden:[...s.hidden??[],x]})}},q1=(x)=>({x:x.position.x,y:x.position.y,w:x.width??x.measured?.width??S0,h:x.height??x.measured?.height??p0}),K1=(x,s)=>{let G1=q1(x),Z1=G1.x+G1.w/2,f1=G1.y+G1.h/2;return s.filter((L1)=>L1.type==="section").map((L1,M1)=>({s:L1,i:M1})).filter(({s:L1})=>{let M1=q1(L1);return Z1>=M1.x&&Z1<=M1.x+M1.w&&f1>=M1.y&&f1<=M1.y+M1.h}).sort((L1,M1)=>q1(L1.s).w*q1(L1.s).h-q1(M1.s).w*q1(M1.s).h||M1.i-L1.i)[0]?.s},W1=c.useCallback(()=>{let x=new Map;for(let P1 of I){let k1=u.placed?.[p1(P1)];if(k1)x.set(p1(P1),k1)}let s=Math.max(-l4,...[...x.values()].map((P1)=>P1.y+p0)),G1=[...new Set(I.map(b2))];for(let P1 of G1){let k1=I.filter((r1)=>b2(r1)===P1),e1=k1.filter((r1)=>x.has(p1(r1))).map((r1)=>x.get(p1(r1))),C1=e1.length?Math.max(...e1.map((r1)=>r1.x))+S0+l4:0,L0=e1.length?Math.min(...e1.map((r1)=>r1.y)):s+l4+O0*2+K8;for(let r1 of k1)if(!x.has(p1(r1)))x.set(p1(r1),{x:C1,y:L0}),C1+=S0+l4;s=Math.max(s,L0+p0)}let Z1=u.sections??{},f1=(P1,k1,e1,C1,L0)=>({id:`sec:${P1}`,type:"section",position:{x:k1.x,y:k1.y},width:k1.w,height:k1.h,zIndex:0,draggable:S,data:{key:P1,name:e1,vendor:C1,named:L0}}),L1=[];for(let P1 of G1){let k1=I.find((h1)=>b2(h1)===P1),e1=m2(k1).find((h1)=>Z1[h1])??P1,C1=Z1[e1];if(C1?.gone)continue;let L0=I.filter((h1)=>b2(h1)===P1).map((h1)=>x.get(p1(h1))),r1={x:Math.min(...L0.map((h1)=>h1.x))-O0,y:Math.min(...L0.map((h1)=>h1.y))-O0-K8,w:0,h:0};r1.w=Math.max(...L0.map((h1)=>h1.x))+S0+O0-r1.x,r1.h=Math.max(...L0.map((h1)=>h1.y))+p0+O0-r1.y;let o4=I.filter((h1)=>b2(h1)===P1&&!u.placed?.[p1(h1)]).map((h1)=>x.get(p1(h1))),V0=C1?{...C1}:r1;if(C1)for(let h1 of o4)V0.w=Math.max(V0.w,h1.x+S0+O0-V0.x),V0.h=Math.max(V0.h,h1.y+p0+O0-V0.y);L1.push(f1(e1,V0,C1?.name??`${B1(k1.vendor)} · ${k1.section.title}`,k1.vendor,Boolean(C1?.name)))}for(let[P1,k1]of Object.entries(Z1))if(P1.startsWith("user:")&&!k1.gone)L1.push(f1(P1,k1,k1.name??"Section",null,!0));let M1=I.map((P1)=>({id:p1(P1),type:"screen",zIndex:1,width:S0,height:p0,draggable:S,position:x.get(p1(P1)),data:{world:_,frame:P1,url:zQ(_,P1)}}));return[...L1,...M1]},[JSON.stringify(I),JSON.stringify(u),_,S]),[Y1,n,R1]=O_([]),H1=N1((x)=>x.transform[2]),x1=c.useRef("");c.useEffect(()=>{let x=W1();if(n(x),x.length&&x1.current!==k)x1.current=k,requestAnimationFrame(()=>{p.fitView({padding:{top:"72px",left:"272px",right:"40px",bottom:"72px"},duration:0})})},[W1,n]);let a1=(x,s=[],G1={})=>{let Z1=Object.fromEntries(s.map((L1)=>{let M1=p.getNode(`sec:${L1}`);if(!M1)return[L1,void 0];let P1=q1(M1),k1=M1.data,e1=G1[L1]??(k1.named?k1.name:void 0);return[L1,{x:Math.round(P1.x),y:Math.round(P1.y),w:Math.round(P1.w),h:Math.round(P1.h),...e1?{name:e1.slice(0,80)}:{}}]}).filter(([,L1])=>L1!==void 0)),f1=Object.fromEntries(Object.entries(x).map(([L1,M1])=>[L1,{x:Math.round(M1.x),y:Math.round(M1.y)}]));h(u.id,(L1)=>({...L1,placed:{...L1.placed??{},...f1},sections:{...L1.sections??{},...Z1}}))},i1=c.useRef(null),k0=(x,s)=>{if(s.type!=="section"){i1.current=null;return}let G1=p.getNodes(),Z1=q1(s),f1=(L1)=>{let M1=q1(L1);if(L1.type==="screen"){let P1=M1.x+M1.w/2,k1=M1.y+M1.h/2;return P1>=Z1.x&&P1<=Z1.x+Z1.w&&k1>=Z1.y&&k1<=Z1.y+Z1.h}return L1.id!==s.id&&M1.x>=Z1.x&&M1.y>=Z1.y&&M1.x+M1.w<=Z1.x+Z1.w&&M1.y+M1.h<=Z1.y+Z1.h};i1.current={id:s.id,from:{...s.position},members:G1.filter(f1).map((L1)=>({id:L1.id,x:L1.position.x,y:L1.position.y}))}},B0=(x,s)=>{let G1=i1.current;if(!G1||G1.id!==s.id)return;let Z1=s.position.x-G1.from.x,f1=s.position.y-G1.from.y,L1=new Map(G1.members.map((M1)=>[M1.id,M1]));n((M1)=>M1.map((P1)=>{let k1=L1.get(P1.id);return k1?{...P1,position:{x:k1.x+Z1,y:k1.y+f1}}:P1}))},w0=(x,s)=>{let G1=i1.current;i1.current=null;let Z1=s.position.x-(G1?.from.x??s.position.x),f1=s.position.y-(G1?.from.y??s.position.y),L1=s.type==="screen"?[{id:s.id,x:s.position.x,y:s.position.y}]:(G1?.members??[]).map((M1)=>({...M1,x:M1.x+Z1,y:M1.y+f1}));requestAnimationFrame(()=>{let M1=p.getNodes(),P1=new Map(L1.filter((C1)=>!C1.id.startsWith("sec:")).map((C1)=>[C1.id,{x:C1.x,y:C1.y}])),k1=new Set([...s.type==="section"?[s.data.key]:[],...L1.filter((C1)=>C1.id.startsWith("sec:")).map((C1)=>C1.id.slice(4))]),e1=new Set(M1.filter((C1)=>P1.has(C1.id)).flatMap((C1)=>m2(C1.data.frame)));for(let C1 of M1){if(C1.type==="screen"&&m2(C1.data.frame).some((L0)=>e1.has(L0))&&!P1.has(C1.id))P1.set(C1.id,{x:C1.position.x,y:C1.position.y});if(C1.type==="section"&&e1.has(C1.data.key))k1.add(C1.data.key)}a1(Object.fromEntries(P1),[...k1])})},J0=(x)=>Object.fromEntries(p.getNodes().filter((s)=>s.type==="screen"&&m2(s.data.frame).includes(x)).map((s)=>[s.id,{x:s.position.x,y:s.position.y}])),[Z0,n1]=c.useState(null),Y0=(x)=>{_1(`sec:${x}`),n1(x)},U2=(x,s)=>{if(n1(null),!s)return;n((G1)=>G1.map((Z1)=>Z1.id===`sec:${x}`?{...Z1,data:{...Z1.data,name:s,named:!0}}:Z1)),requestAnimationFrame(()=>a1(J0(x),[x],{[x]:s}))},P0=(x)=>{_1(null);let s=p.getNode(`sec:${x}`);h(u.id,(G1)=>{let Z1=Object.fromEntries(Object.entries(G1.sections??{}).filter(([f1])=>f1!==x));return{...G1,sections:x.startsWith("user:")?Z1:{...Z1,[x]:{...s?{x:Math.round(s.position.x),y:Math.round(s.position.y),w:Math.round(q1(s).w),h:Math.round(q1(s).h)}:{x:0,y:0,w:0,h:0},gone:!0}}}})},c0=()=>{let x=t?p.getNode(t):void 0,s=p.screenToFlowPosition({x:window.innerWidth/2,y:window.innerHeight/2}),G1=x?.type==="screen"?{x:x.position.x-O0,y:x.position.y-O0,w:S0+O0*2,h:p0+O0*2}:{x:s.x-900,y:s.y-600,w:1800,h:1200},Z1=`user:${Date.now().toString(36)}`,f1=Object.keys(u.sections??{}).filter((L1)=>L1.startsWith("user:")).length+1;_1(`sec:${Z1}`),h(u.id,(L1)=>({...L1,sections:{...L1.sections??{},[Z1]:{x:Math.round(G1.x),y:Math.round(G1.y),w:Math.round(G1.w),h:Math.round(G1.h),name:`Section ${f1}`}}}))},G2=Y1.map((x)=>x.type==="section"?{...x,data:{...x.data,picked:t===x.id,editable:S,renaming:S&&Z0===x.data.key,pick:(s)=>_1(`sec:${s}`),rename:Y0,renamed:U2,remove:P0,resized:()=>requestAnimationFrame(()=>{let s=x.data.key;a1(J0(s),[s])})}}:{...x,data:{...x.data,active:D===x.id,picked:t===x.id,boards:S?e:[],addTo:$1,remove:!S||u.include&&!u.include.includes(x.id)?null:U1,compare:(s)=>{_1(s),o(s)}}});c.useEffect(()=>{let x=(s)=>{if(s.target?.closest("input, textarea, select, [contenteditable]"))return;if(s.key==="Escape"){if(D)y(null);else _1(null);return}if(!S||D)return;if((s.key==="Delete"||s.key==="Backspace")&&t){if(s.preventDefault(),t.startsWith("sec:"))P0(t.slice(4));else if(!u.include||u.include.includes(t))U1.act(t);else g1("It is on this board with its whole group: take the group off in the list to remove it","error");return}if(s.key==="S"&&s.shiftKey&&!s.metaKey&&!s.ctrlKey)s.preventDefault(),c0()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)});let l0=(x)=>{_1(x);let s=p.getNode(x);if(!s)return;let G1=q1(s);p.fitBounds({x:G1.x,y:G1.y,width:G1.w,height:G1.h},{padding:0.15,duration:400})},c2=()=>{let x=`board-${Date.now().toString(36)}`;v(x),b((s)=>[...s,{id:x,name:`Board ${s.length}`,include:[]}])},y0=()=>n1(`board:${u.id}`),T=()=>{let x=u.id;v(null),b((s)=>s.filter((G1)=>G1.id!==x))},g=[...new Map(P.map((x)=>[b2(x),x])).values()],Q1=u.include?[...g.filter((x)=>!m2(x).some((s)=>u.include.includes(s))).map((x)=>({key:b2(x),label:`${B1(x.vendor)} · ${x.section.title} (all)`})),...P.filter((x)=>!I.includes(x)).map((x)=>({key:p1(x),label:x.title}))]:[],J1=u.include?[]:P.filter((x)=>(u.hidden??[]).includes(p1(x))),X1=Y1.filter((x)=>x.type==="section"),O1=Y1.filter((x)=>x.type==="screen"),T1=new Map(O1.map((x)=>[x.id,K1(x,Y1)?.id??null])),v1=new Map;for(let x of P){let s=E(x);if(s&&j.has(s))v1.set(s,(v1.get(s)??0)+1)}let I1=(x)=>{let s=x.data.frame;return $.jsxDEV("li",{children:[$.jsxDEV("button",{type:"button",className:t===x.id?"on":void 0,onClick:()=>l0(x.id),onDoubleClick:()=>y(x.id),children:[$.jsxDEV(l1,{vendor:s.vendor},void 0,!1,void 0,this),$.jsxDEV("span",{children:s.title},void 0,!1,void 0,this),s.changes?$.jsxDEV("span",{className:"layer-changed",title:`${E1(s.changes,"change")}, not in a changeset: its mark on the board compares before and now`,children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),s.changes]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),v1.get(x.id)&&k!=="changes"&&!u.include?$.jsxDEV("button",{type:"button",className:"ghost layer-open","aria-expanded":i.has(x.id),onClick:()=>l((G1)=>{let Z1=new Set(G1);if(Z1.has(x.id))Z1.delete(x.id);else Z1.add(x.id);return Z1}),title:i.has(x.id)?"Close the pages under it":"Open the pages under it",children:[i.has(x.id)?"−":"+",v1.get(x.id)]},void 0,!0,void 0,this):null]},x.id,!0,void 0,this)},A0=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,j0=J.state==="ok"&&L.state==="ok";return $.jsxDEV("div",{className:"canvas full",role:"region","aria-label":"The World's board",style:{"--zoom":H1},children:$.jsxDEV(R_,{nodes:j0?G2:[],onNodesChange:R1,nodeTypes:YF,onNodeDragStart:k0,onNodeDrag:B0,onNodeDragStop:w0,onNodeClick:(x,s)=>{if(s.id!==D)_1(s.id)},onNodeDoubleClick:(x,s)=>{if(s.type==="screen")_1(s.id),y(s.id)},onPaneClick:()=>{y(null),_1(null)},minZoom:0.03,maxZoom:1.5,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnPinch:!0,zoomOnScroll:!1,zoomOnDoubleClick:!1,colorMode:A0?"dark":"light",proOptions:{hideAttribution:!0},children:[$.jsxDEV(w_,{variant:x0.Dots,gap:28*2**Math.max(0,Math.ceil(Math.log2(16/(28*H1)))),size:2/H1},void 0,!1,void 0,this),$.jsxDEV(m0,{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:_.split("/")[1]},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:[_.split("/")[0],U?" · snapshot":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("div",{className:"board-tabs",role:"tablist","aria-label":"Boards",children:[$.jsxDEV("button",{type:"button",role:"tab","aria-selected":k==="changes",className:k==="changes"?"on":void 0,onClick:()=>{_1(null),y(null),v("changes")},title:"The pages whose records changed and are not yet in a changeset",children:["Changes",N?` (${P.filter((x)=>x.changes).length})`:""]},void 0,!0,void 0,this),C.map((x)=>Z0===`board:${x.id}`?$.jsxDEV(WQ,{name:x.name,label:"Name this board",done:(s)=>{if(n1(null),s)h(x.id,(G1)=>({...G1,name:s}))}},x.id,!1,void 0,this):$.jsxDEV("button",{type:"button",role:"tab","aria-selected":k!=="changes"&&x.id===u.id,className:k!=="changes"&&x.id===u.id?"on":void 0,onClick:()=>{_1(null),y(null),v(x.id)},onDoubleClick:S&&x.id===u.id&&x.include?y0:void 0,children:x.name},x.id,!1,void 0,this)),S?$.jsxDEV("button",{type:"button",className:"ghost",onClick:c2,"aria-label":"A new board",children:"+"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),u.include&&S?$.jsxDEV("div",{className:"board-acts",children:[$.jsxDEV("button",{type:"button",className:"ghost",onClick:y0,children:"Rename"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"ghost",onClick:T,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:[X1.map((x)=>{let s=x.data;return $.jsxDEV("li",{children:[$.jsxDEV("button",{type:"button",className:t===x.id?"layer-section on":"layer-section",onClick:()=>l0(x.id),onDoubleClick:()=>{if(S)l0(x.id),Y0(s.key)},children:[s.vendor?$.jsxDEV(l1,{vendor:s.vendor},void 0,!1,void 0,this):$.jsxDEV(w1,{name:"layout-grid",size:14},void 0,!1,void 0,this),$.jsxDEV("span",{children:s.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list inner",children:O1.filter((G1)=>T1.get(G1.id)===x.id).map(I1)},void 0,!1,void 0,this)]},x.id,!0,void 0,this)}),O1.filter((x)=>!T1.get(x.id)).map(I1)]},void 0,!0,void 0,this),u.include&&!I.length?$.jsxDEV("p",{className:"mode pad-s",children:"An empty board: add frames from Everything, or below."},void 0,!1,void 0,this):null,Q1.length&&S?$.jsxDEV("select",{className:"board-add",value:"","aria-label":"Add to this board",onChange:(x)=>{let s=x.target.value;if(s)h(u.id,(G1)=>({...G1,include:[...G1.include??[],s]}))},children:[$.jsxDEV("option",{value:"",children:"Add to this board…"},void 0,!1,void 0,this),Q1.map((x)=>$.jsxDEV("option",{value:x.key,children:x.label},x.key,!1,void 0,this))]},void 0,!0,void 0,this):null,J1.length?$.jsxDEV("details",{className:"board-hidden",children:[$.jsxDEV("summary",{children:["Hidden (",J1.length,")"]},void 0,!0,void 0,this),$.jsxDEV("ul",{className:"layer-list",children:J1.map((x)=>$.jsxDEV("li",{children:S?$.jsxDEV("button",{type:"button",onClick:()=>h(u.id,(s)=>({...s,hidden:(s.hidden??[]).filter((G1)=>G1!==p1(x))})),children:[$.jsxDEV("span",{children:x.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:x.title},void 0,!1,void 0,this)},p1(x),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,V?$.jsxDEV("button",{type:"button",className:"board-elsewhere",onClick:()=>v("changes"),children:[$.jsxDEV(w1,{name:"square-dot",size:14},void 0,!1,void 0,this),E1(V,"change")," not on this board"]},void 0,!0,void 0,this):null,$.jsxDEV(U0,{load:L,what:"the board"},void 0,!1,void 0,this),W&&L.state==="ok"?$.jsxDEV("p",{role:"alert",className:"pad-s",children:["The board could not be read again (",W,"): 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),D?$.jsxDEV(m0,{position:"top-center",className:"float hint using",children:[$.jsxDEV("span",{className:"mode",children:["Using ",I.find((x)=>p1(x)===D)?.title??D]},void 0,!0,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>y(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(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),S?$.jsxDEV(m0,{position:"bottom-center",className:"float board-tools",children:$.jsxDEV("button",{type:"button",className:"ghost",onClick:c0,title:"Section (⇧S): around the selected frame, else in the middle",children:[$.jsxDEV(w1,{name:"layout-grid",size:16},void 0,!1,void 0,this),$.jsxDEV("span",{children:"Section"},void 0,!1,void 0,this),$.jsxDEV("kbd",{children:"⇧S"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,a&&I.some((x)=>p1(x)===a)?$.jsxDEV(m0,{position:"top-right",className:"float compare-panel",children:$.jsxDEV(KF,{name:_,token:Q,frame:I.find((x)=>p1(x)===a),onClose:()=>o(null),reads:R},a,!1,void 0,this)},void 0,!1,void 0,this):null,$.jsxDEV(N_,{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 BQ=(_)=>_.actions.map((Q)=>({twin:Q.service,entry:{...Q.action,service:Q.service,op:Q.action.op??Q.action.operation??""}})),WF=(_)=>{let Q=_.action.input??{};return!(typeof Q.operationId==="string"||Q.graphql!==void 0&&Q.graphql!==null)};function t4(_){let Q=_.actions.filter(WF).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 X8=(_)=>_.message??_.narration?.split(`
|
|
37
37
|
`)[0]?.replace(/ setting .*$/,"")??_.name;function AQ(_,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 d_({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]=c.useState(null),[W,w]=c.useState(!1),[R,A]=c.useState(""),[O,B]=c.useState(""),[M,P]=c.useState(null),C=u1(Q,`/-/${_}/origin`),f=t4(q),v=AQ(q,Y),N=BQ(q),k=[...new Set(N.map((y)=>y.twin))],u=k.some((y)=>G.includes(y)),i=(y)=>y===(q.currentHash??q.contentHash),l=q.applied?.receipts??[],S=(q.deployed??[]).filter((y)=>y.status!=="landed"),b=l.filter((y)=>y.status==="confirmed").length,h=S.filter((y)=>y.status==="deployed"),E=async(y,t,_1,a)=>{z(y),P(null);try{let o=await S1(Q,t,{method:"POST",..._1===void 0?{}:{body:JSON.stringify(_1)}});if(!o.ok)return Z(o),P({what:y,...d1(await n0(o))}),!1;if(a)g1(a);return F(),!0}catch(o){return P({what:y,text:`the World did not answer (${o instanceof Error?o.message:String(o)})`,acts:[]}),!1}finally{z(null)}},j=()=>{E("Verify",`/-/${_}/changesets/${q.name}/verify`,void 0,"Verified: the checks ran over it")},m=async(y)=>{if(y.preventDefault(),await E("Approve",`/-/${_}/changesets/${q.name}/approve`,{...R.trim()?{note:R.trim()}:{},...J===null&&O.trim()?{as:O.trim()}:{}},"Approved"))w(!1),A("")},I=async()=>{let y=k.filter((t)=>G.includes(t));if(!await g0({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",y.length===1?"":"s"," behind ",D2(y.map(B1)),". This cannot be taken back here."]},void 0,!0,void 0,this),action:"Deploy",danger:!0,typed:q.name}))return;z("Deploy"),P(null);try{let t=await S1(Q,`/-/${_}/deploy/${q.name}`,{method:"POST",body:JSON.stringify({confirm:q.name})});if(!t.ok){Z(t),P({what:"Deploy",...d1(await n0(t))});return}let _1=await S1(Q,`/-/${_}/changesets/${q.name}`),a=_1.ok?await _1.json():null;if(!a){g1("Deploy: sent; reading its receipts failed","info"),F();return}let o=t4(a);g1(`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){P({what:"Deploy",text:`the World did not answer (${t instanceof Error?t.message:String(t)})`,acts:[]})}finally{z(null)}},V=!U?"This session reads the World; it changes nothing":f.label==="Deployed"?"Already deployed: every change was performed at the vendor":null,D=C.state==="ok"&&C.data.origin?A8(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-${v.tone}`,children:v.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(V1,{iso:q.createdAt},void 0,!1,void 0,this)," · ",q.actions.length," change",q.actions.length===1?"":"s"," at ",D2(k.map(B1))||"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:j,disabled:Boolean(V)||L!==null,title:V??"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:()=>w(!0),disabled:Boolean(V)||L!==null,title:V??"Sign its current contents as yourself",children:"Approve…"},void 0,!1,void 0,this),u?$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>void I(),disabled:Boolean(V)||L!==null,title:V??"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),V&&f.label!=="Deployed"?$.jsxDEV("p",{className:"mode",children:[V,"."]},void 0,!0,void 0,this):null,M?$.jsxDEV("div",{role:"alert",className:"refusal",children:[$.jsxDEV("span",{children:[$.jsxDEV("b",{children:M.what},void 0,!1,void 0,this),": ",M.text]},void 0,!0,void 0,this),M.acts.includes("verify")&&U?$.jsxDEV("button",{type:"button",onClick:j,disabled:L!==null,children:"Verify"},void 0,!1,void 0,this):null,M.acts.includes("approve")&&U?$.jsxDEV("button",{type:"button",onClick:()=>w(!0),disabled:L!==null,children:"Approve…"},void 0,!1,void 0,this):null,$.jsxDEV(n_,{name:_,acts:M.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 ",D2([...new Set([...h.map((y)=>y.service),...l.filter((y)=>y.status==="confirmed").map((y)=>y.service)].map(B1))]),h.length?` (${h.length} from here`:" (",h.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",D?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("code",{children:D},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,q.applied?$.jsxDEV($.Fragment,{children:[" · ",$.jsxDEV(V1,{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",u?"; 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",[...S.filter((y)=>y.reason&&(y.status==="refused"||y.status==="failed")).map((y)=>y.reason),...l.filter((y)=>y.status==="failed"&&y.error).map((y)=>y.error)].slice(0,3).map((y)=>`: ${d1(y).text}`).join(""),"."]},void 0,!0,void 0,this):null,q.applied?.refusal?.length?$.jsxDEV("ul",{className:"checks pad",children:q.applied.refusal.map((y,t)=>$.jsxDEV("li",{className:"mode",children:d1(y).text},t,!1,void 0,this))},void 0,!1,void 0,this):null,S.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:S.map((y)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:y.status==="refused"||y.status==="failed"?"badge cs-bad":y.status==="deployed"?"badge cs-done":"badge",children:y.status},void 0,!1,void 0,this)," ",B1(y.service)," ",y.status==="deployed"?y.url?$.jsxDEV("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",children:y.externalId??y.url},void 0,!1,void 0,this):y.externalId?$.jsxDEV("code",{children:y.externalId},void 0,!1,void 0,this):null:null,y.reason?$.jsxDEV("span",{className:"mode",children:[" · ",d1(y.reason).text]},void 0,!0,void 0,this):null," ",$.jsxDEV("span",{className:"mode",children:["· ",$.jsxDEV(V1,{iso:y.at},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},`v:${y.actionId}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,l.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:l.map((y)=>$.jsxDEV("li",{children:[$.jsxDEV("span",{className:y.status==="failed"?"badge cs-bad":y.status==="confirmed"?"badge cs-done":"badge",children:y.status},void 0,!1,void 0,this)," ",B1(y.service)," ",$.jsxDEV("span",{className:"mode",children:y.status==="replayed"?"replayed at the remote World":y.status==="confirmed"?"performed at the vendor by the remote":""},void 0,!1,void 0,this),y.status==="confirmed"&&y.externalId?$.jsxDEV($.Fragment,{children:[" ",$.jsxDEV("code",{children:y.externalId},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,y.error?$.jsxDEV("span",{className:"mode",children:[" · ",d1(y.error).text]},void 0,!0,void 0,this):null]},`r:${y.actionId}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),!u&&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:`${A1}/${_}/~/settings/services`,onClick:(y)=>{y.preventDefault(),j1([..._.split("/"),"~","settings","services"])},children:"Connect a vendor in Settings › Real services"},void 0,!1,void 0,this)," to deploy."]},void 0,!0,void 0,this):null,$.jsxDEV("h4",{children:"Checks"},void 0,!1,void 0,this),!q.verification?$.jsxDEV("p",{className:"mode",children:"Not verified yet. Verify replays it in a throwaway World and runs this World's checks over the result."},void 0,!1,void 0,this):$.jsxDEV("div",{className:i(q.verification.contentHash)?"":"stale",children:[$.jsxDEV("p",{children:[q.verification.passed?"✓ Passed":"✗ Failed"," · ",$.jsxDEV(V1,{iso:q.verification.at},void 0,!1,void 0,this),i(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((y)=>$.jsxDEV("li",{children:[y.passed?"✓":"✗"," ",$.jsxDEV("code",{children:y.id},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:B1(y.service)},void 0,!1,void 0,this)]},y.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((y,t)=>$.jsxDEV("li",{children:["✗ ",$.jsxDEV("code",{children:y.check},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[B1(y.service),": ",y.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((y,t)=>$.jsxDEV("li",{children:[$.jsxDEV("b",{children:y.principal},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[$.jsxDEV(V1,{iso:y.at},void 0,!1,void 0,this),i(y.contentHash)?"":" · signed an earlier version"]},void 0,!0,void 0,this),y.note?$.jsxDEV("div",{className:"mode",children:["“",y.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(W0,{open:W,onClose:()=>{if(!L)w(!1)},title:`Approve ${q.name}`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>w(!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:(y)=>void m(y),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:O,onChange:(y)=>B(y.target.value),maxLength:80,required:!0,placeholder:"your name or email",autoComplete:"off"},void 0,!1,void 0,this),$.jsxDEV("span",{className:"mode",children:"This World was opened with its token, which names no person: the approval records the name you give."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("label",{children:[$.jsxDEV("span",{children:["Note ",$.jsxDEV("span",{className:"mode",children:"(optional)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("textarea",{name:"approveNote",value:R,onChange:(y)=>A(y.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 MQ=(_,Q)=>JSON.stringify(_)===JSON.stringify(Q);function BF({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(l1,{vendor:q},void 0,!1,void 0,this),B1(q)," ",$.jsxDEV("span",{className:"mode",children:["· ",E1(G.length,"record"),", ",E1(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=I0(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:$2(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(([w,R])=>!(w in K)||!MQ(K[w],R)),W=K;return K={...K,...L},$.jsxDEV("div",{className:"write",children:[$.jsxDEV("p",{className:"mode",children:[$.jsxDEV("span",{className:"op",children:I0(H).what},void 0,!1,void 0,this)," · ",$.jsxDEV(V1,{iso:H.occurredAt},void 0,!1,void 0,this)," · ",d5(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 ${I0(H).what} set`,children:z.map(([w,R])=>$.jsxDEV(c.default.Fragment,{children:[$.jsxDEV("dt",{children:w},void 0,!1,void 0,this),$.jsxDEV("dd",{children:w in W?$.jsxDEV("span",{className:"changed",children:[$.jsxDEV("del",{children:$.jsxDEV(q2,{v:W[w]},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(q2,{v:R},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):$.jsxDEV(q2,{v:R},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},w,!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 AF({name:_,token:Q,changes:J,canWrite:q,refused:U,onCut:G,pinned:Z,generated:F,inputRef:X,author:Y}){let[K,H]=c.useState(""),[L,z]=c.useState(!1),[W,w]=c.useState([]),R=(O,B,M)=>{w((P)=>[{ok:O,text:B,at:new Date().toISOString(),n:++t5,...M?.length?{acts:M}:{}},...P].slice(0,4))},A=async(O)=>{O.preventDefault(),z(!0);try{let B=await S1(Q,`/-/${_}/changesets`,{method:"POST",body:JSON.stringify(K.trim()?{message:K.trim()}:{})});if(!B.ok){U(B);let P=d1(await n0(B));R(!1,`Cut a changeset: ${P.text}`,P.acts);return}let M=await B.json();R(!0,`Cut ${M.name??"a changeset"}: ${E1(M.actions?.length??0,"change")}, ready to review in History and push.`),H(""),G()}catch(B){R(!1,`Cut a changeset: the World did not answer (${B instanceof Error?B.message:String(B)})`)}finally{z(!1)}};if(Z){let O=!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(B2,{log:W,name:_},void 0,!1,void 0,this),$.jsxDEV("form",{onSubmit:(B)=>void A(B),"aria-label":"Cut a changeset",children:[Y?$.jsxDEV("a",{className:"ws-author",href:Y.account,title:`${Y.who}: your account`,onClick:(B)=>{B.preventDefault(),j1(Y.account.slice(A1.length+1).split("/"))},children:Y.face},void 0,!1,void 0,this):null,$.jsxDEV("input",{ref:X,name:"changesetMessage","aria-label":"Summary",value:K,onChange:(B)=>H(B.target.value),placeholder:J===0?"Nothing to cut":F?"Summary (optional)":"Summary (required)",required:!F,maxLength:200,disabled:Boolean(O),title:O??void 0},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",className:"primary",disabled:Boolean(O)||L,title:O??void 0,children:L?"Cutting…":J===0?"Cut a changeset":$.jsxDEV($.Fragment,{children:["Cut ",E1(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(B2,{log:W,name:_},void 0,!1,void 0,this);return $.jsxDEV($.Fragment,{children:[$.jsxDEV("form",{className:"block cut pad",onSubmit:(O)=>void A(O),"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:(O)=>H(O.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(B2,{log:W,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MF({name:_,token:Q}){let[J,q]=c.useState(0),U=u1(Q,`/-/${_}/keys`,J),[G,Z]=c.useState(!1),[F,X]=c.useState(""),[Y,K]=c.useState("write"),[H,L]=c.useState(!1),[z,W]=c.useState(null),[w,R]=c.useState(null),[A,O]=c.useState(null),B=async()=>{let C=`Read-only link · ${new Date().toLocaleDateString(void 0,{month:"short",day:"numeric"})}`,f=await S1(Q,`/-/${_}/keys`,{method:"POST",body:JSON.stringify({name:C,scope:"read"})}).catch(()=>null),v=f?await f.json().catch(()=>({})):{error:`${y1} did not answer`};if(!f?.ok||!v.key){g1(v.error?d1(v.error).text:"refused","error");return}O(`${window.location.origin}${A1}/${_}#${new URLSearchParams({token:v.key}).toString()}`),q((N)=>N+1)},M=async(C)=>{C.preventDefault(),L(!0),W(null);let f=await S1(Q,`/-/${_}/keys`,{method:"POST",body:JSON.stringify({name:F.trim(),scope:Y})}).catch(()=>null);L(!1);let v=f?await f.json().catch(()=>({})):{error:`${y1} did not answer`};if(!f?.ok||!v.key){W(v.error?d1(v.error).text:"refused");return}Z(!1),R({key:v.key,name:F.trim()}),X(""),q((N)=>N+1)},P=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 S1(Q,`/-/${_}/keys/${C.id}`,{method:"DELETE"});if(f.ok)g1(`Revoked ${C.name}`);else g1(await K0(f),"error");q((v)=>v+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),G0()?$.jsxDEV("a",{className:"button primary",href:`${G0()}/${encodeURIComponent(_.split("/")[0]??"")}`,children:"Make a key on the platform"},void 0,!1,void 0,this):$.jsxDEV("div",{className:"head-actions",children:[$.jsxDEV("button",{type:"button",onClick:()=>void B(),children:"Share a read-only link"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>{W(null),Z(!0)},children:"Make a key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(U0,{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:h2(C.createdAt),children:U8(C.createdAt)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{className:"mode",children:C.lastUsedAt?U8(C.lastUsedAt):"never"},void 0,!1,void 0,this),$.jsxDEV("td",{className:"num",children:$.jsxDEV(D_,{label:`More for ${C.name}`,items:[{label:"Revoke…",danger:!0,onSelect:()=>void P(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(W0,{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:M,"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(W0,{open:Boolean(w),onClose:()=>R(null),title:`${w?.name??"The key"} is ready`,footer:$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>R(null),children:"Done"},void 0,!1,void 0,this),children:[$.jsxDEV("p",{className:"mode",children:"Copy it now: it is shown this once. Put it where the app reads its secrets."},void 0,!1,void 0,this),w?$.jsxDEV(Z8,{label:"Key",value:w.key,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(W0,{open:Boolean(A),onClose:()=>O(null),title:"A read-only link",footer:$.jsxDEV("button",{type:"button",className:"primary",onClick:()=>O(null),children:"Done"},void 0,!1,void 0,this),children:[$.jsxDEV("p",{className:"mode",children:"Whoever opens it sees this World's pages and changes nothing. Copy it now: it is shown this once. It is listed under Keys, where revoking it closes the link at once."},void 0,!1,void 0,this),A?$.jsxDEV(Z8,{label:"Link",value:A,secret:!0},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var t5=0;function B2({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(V1,{iso:J.at,time:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)," ",J.text,J.acts?$.jsxDEV(n_,{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 TQ(_,Q,J,q){let[U,G]=c.useState(0),Z=U*1e5+Math.floor(J/2),F=u1(Q,`/-/${_}/origin`,Z),X=u1(Q,`/-/${_}/diff`,Z),Y=u1(Q,`/-/${_}/changesets`,Z),[K,H]=c.useState([]),[L,z]=c.useState(null),W=(P,C,f)=>{if(H((v)=>[{ok:P,text:C,at:new Date().toISOString(),n:++t5,...f?.length?{acts:f}:{}},...v].slice(0,8)),!P)g1(C,"error")},w=async(P,C,f)=>{z(P);try{let v=await S1(Q,`/-/${_}/${C}`,f);if(!v.ok){q(v);let N=d1(await n0(v));return W(!1,`${P}: ${N.text}`,N.acts),null}return await v.json()}catch(v){return W(!1,`${P}: the World did not answer (${v instanceof Error?v.message:String(v)})`),null}finally{z(null),G((v)=>v+1)}},R=F.state==="ok"&&F.data.origin?A8(F.data.origin):null,A=X.state==="ok"?X.data.changes.length:null,O=Y.state==="ok"&&R?tZ(Y.data.changesets.filter((P)=>!P.pushedBy)).sort((P,C)=>P.createdAt.localeCompare(C.createdAt)):[];return{origin:F,diff:X,sets:Y,there:R,changes:A,waiting:O,log:K,busy:L,say:W,send:w,push:async()=>{let P=await w("Push","origin/push",{method:"POST"});if(!P)return;if(P.pushed.length===0){W(!0,"Nothing to push: every changeset is already at the remote.");return}for(let C of P.pushed){let f=C.receipts??[],v=f.filter((l)=>l.status==="replayed").length,N=f.filter((l)=>l.status==="confirmed").length,k=f.filter((l)=>l.status==="failed").length,u=C.outcome==="applied"&&k===0;if(C.outcome==="refused"){W(!1,`Push of ${C.changeset} was refused${C.refusal?.length?`: ${C.refusal.map((l)=>d1(l).text).join("; ")}`:""}.`);continue}let i=[`${v} of ${E1(f.length,"change")} replayed there`,...N?[`${N} performed at the vendor by the remote`]:[],...k?[`${k} failed`]:[]];W(u,`${C.outcome==="partial"?"Partly pushed":"Pushed"} ${C.changeset} to ${R??"the remote"}: ${i.join("; ")}${C.refusal?.length?` (${C.refusal.map((l)=>d1(l).text).join("; ")})`:""}.`)}},pull:async()=>{let P=await w("Pull","origin/pull",{method:"POST"});if(!P)return;let C=Object.entries(P.appended).filter(([,v])=>v>0),f=P.rebased.flatMap((v)=>v.conflicts.map((N)=>`${B1(v.twin)} ${N.subject.type}:${N.subject.id} ${N.field}`));W(f.length===0,`Pulled from ${R??"the remote"}: ${C.length?C.map(([v,N])=>`${E1(N,"entry")} at ${B1(v)}`).join(", "):"nothing new"}${f.length?`; conflicts at ${f.join(", ")}`:""}.`)}}}function TF({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}=TQ(_,Q,q,U),[W,w]=c.useState(""),[R,A]=c.useState(""),[O,B]=c.useState(!1),M=async(C)=>{C.preventDefault();let f=await H("Name the remote","origin",{method:"PUT",body:JSON.stringify({url:W.trim(),token:R.trim()})});if(f){let v=Object.values(f.appended??{}).reduce((N,k)=>N+k,0);K(!0,`The remote is ${A8(f.origin)}: its history came in (${E1(v,"entry")}).`),A(""),B(!1)}},P=!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:()=>{w(Z??""),B(!O)},"aria-expanded":O,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(V1,{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(U0,{load:G,what:"the remote",lines:1},void 0,!1,void 0,this),O?$.jsxDEV("form",{className:"stack origin-form",onSubmit:(C)=>void M(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)=>w(C.target.value),placeholder:"https://worlds.example.com/acme/team",required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"A key or token that opens it"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"originToken",type:"password",value:R,onChange:(C)=>A(C.target.value),required:!0,autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV("p",{className:"mode",children:"Naming it brings its history in. Your pushes are recorded there as whoever this key was made for, or as the key itself."},void 0,!1,void 0,this),$.jsxDEV("div",{className:"row-actions",children:[$.jsxDEV("button",{type:"submit",className:"primary",disabled:Y!==null,children:Y==="Name the remote"?"Bringing its history in…":"Save the remote"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>B(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.jsxDEV(B2,{log:X,name:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function RF({name:_,token:Q,canWrite:J,refused:q}){let[U,G]=c.useState(0),Z=u1(Q,`/-/${_}/twins`,U),F=u1(Q,`/-/${_}/links`,U),X=u1(Q,`/-/${_}/requests?hours=24`,U),[Y,K]=c.useState({}),[H,L]=c.useState(null),[z,W]=c.useState(""),[w,R]=c.useState(!1),[A,O]=c.useState([]),B=(N,k,u)=>{if(O((i)=>[{ok:N,text:k,at:new Date().toISOString(),n:++t5,...u?.length?{acts:u}:{}},...i].slice(0,6)),!N)g1(k,"error")},M=F.state==="ok"?Object.keys(F.data.links).sort():[];c.useEffect(()=>{let N=!0;return Promise.all(M.map(async(k)=>{let u=await S1(Q,`/-/${_}/twins/${k}/credential`).catch(()=>null),i=u?.ok?await u.json():null;return[k,i?.credential??null]})).then((k)=>{if(N)K(Object.fromEntries(k))}),()=>{N=!1}},[_,Q,M.join(","),U]);let P=async(N)=>{if(N.preventDefault(),!H||!z)return;R(!0);let k=await S1(Q,`/-/${_}/twins/${H.vendor}/credential`,{method:"PUT",body:z,headers:{"content-type":"text/plain"}}).catch(()=>null);if(R(!1),!k){B(!1,`Seal ${H.vendor}: ${y1} did not answer`);return}if(!k.ok){q(k);let i=d1(await n0(k));B(!1,`Seal ${B1(H.vendor)}: ${i.text}`,i.acts);return}let u=await k.json().catch(()=>({}));B(!0,`Sealed a credential for ${B1(H.vendor)}${u.fingerprint?` (${u.fingerprint})`:""}: it opens for ${u.boundTo??H.to} only, and is never shown again.`),W(""),L(null),G((i)=>i+1)},C=async(N)=>{if(!await g0({title:`Remove the link ${N}?`,body:`Requests to ${Q2}/${_}/${N}/… stop being forwarded to ${F.state==="ok"?F.data.links[N]?.origin:"its origin"}.`,action:"Remove link",danger:!0}))return;let k=await S1(Q,`/-/${_}/links/${N}`,{method:"DELETE"}).catch(()=>null);if(!k?.ok){if(k)q(k);B(!1,`Remove ${N}: ${k?await K0(k):"the World did not answer"}`);return}B(!0,`Removed the link ${N}.`),G((u)=>u+1)},f=(N)=>N?$.jsxDEV($.Fragment,{children:[$.jsxDEV("span",{className:"badge rooted",children:"sealed"},void 0,!1,void 0,this)," ",$.jsxDEV("span",{className:"mode",children:[N.fingerprint?$.jsxDEV("code",{children:N.fingerprint},void 0,!1,void 0,this):null," · ",$.jsxDEV(V1,{iso:N.placedAt},void 0,!1,void 0,this),N.sealedBy?` · by ${N.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),v=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(B2,{log:A,name:_},void 0,!1,void 0,this),$.jsxDEV("section",{className:"block","aria-labelledby":"creds-head",children:[$.jsxDEV("div",{className:"block-head",children:$.jsxDEV("h3",{id:"creds-head",children:"Vendors"},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.jsxDEV(U0,{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:v.map((N)=>$.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(l1,{vendor:N.twin},void 0,!1,void 0,this),B1(N.twin)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:f(N.credential)},void 0,!1,void 0,this),$.jsxDEV("td",{children:N.credential?.boundTo?$.jsxDEV("code",{children:N.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:N.root?.url?$.jsxDEV("code",{children:N.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:!N.root?.url,title:N.root?.url?`Seal ${B1(N.twin)}'s real credential for ${N.root.url}`:"Connect it to its real service first (Settings › Real services): a credential is sealed for where it goes",onClick:()=>{W(""),L({vendor:N.twin,to:N.root.url})},children:N.credential?"Replace…":"Seal a credential…"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},N.twin,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,Z.state==="ok"&&v.every((N)=>!N.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(U0,{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"&&M.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:[Q2,"/",_,"/<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,M.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:M.map((N)=>{let k=F.state==="ok"?F.data.links[N].origin:"",u=X.state==="ok"?X.data.twins.find((i)=>i.twin===N):void 0;return $.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("b",{children:N},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:u?$.jsxDEV("span",{title:Object.entries(u.byStatus).map(([i,l])=>`${i}: ${l}`).join(" · "),children:u.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[N]??null),Y[N]?.boundTo?$.jsxDEV("div",{className:"mode",children:["bound to ",$.jsxDEV("code",{children:Y[N].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:N,to:k})},children:Y[N]?"Replace…":"Seal a credential…"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"button",onClick:()=>void C(N),children:"Remove…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),$.jsxDEV(W0,{open:Boolean(H),onClose:()=>{if(!w)L(null)},title:`Seal ${H?B1(H.vendor):""}'s credential`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>L(null),disabled:w,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"seal-credential",className:"primary",disabled:w||!z,children:w?"Sealing…":"Seal it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"seal-credential",className:"stack",onSubmit:(N)=>void P(N),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:(N)=>W(N.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 OF({name:_,token:Q,admin:J,canWrite:q,refused:U,onRemoved:G,only:Z}){let F=(j)=>!Z||Z===j,[X,Y]=c.useState(0),K=u1(Q,`/-/${_}/twins`,X),H=u1(Q,`/-/${_}/checks`,X),[L,z]=c.useState(0),W=u1(Q,`/-/${_}/clock`,L),[w,R]=c.useState([]),[A,O]=c.useState(null),[B,M]=c.useState(null),[P,C]=c.useState(""),[f,v]=c.useState("gated"),[N,k]=c.useState(!1),u=(j,m,I)=>{if(R((V)=>[{ok:j,text:m,at:new Date().toISOString(),n:++t5,...I?.length?{acts:I}:{}},...V].slice(0,6)),!j)g1(m,"error")},i=async(j,m,I)=>{let V=await S1(Q,m,I).catch(()=>null);if(!V)return u(!1,`${j}: the World did not answer`),!1;if(!V.ok){U(V);let D=d1(await n0(V));return u(!1,`${j}: ${D.text}`,D.acts),!1}return u(!0,`${j}: done.`),Y((D)=>D+1),!0},l=async(j)=>{if(j.preventDefault(),!B)return;k(!0);let m=B.root??{},I=await i(P.trim()?`Connect ${B1(B.twin)} to ${P.trim()}`:`Disconnect ${B1(B.twin)}`,`/-/${_}/twins/${B.twin}/root`,{method:"PUT",body:JSON.stringify(P.trim()?{...m,url:P.trim(),deploy:f}:null)});if(k(!1),I)M(null)},S=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 j=await S1(J,`/-/worlds/${_}/rotate`,{method:"POST"});if(j.ok)O(await j.json()),u(!0,"Rotated: the new tokens are shown once, below.");else u(!1,`Rotate: ${await K0(j)}`)},b=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 j=await S1(J,`/-/worlds/${_}`,{method:"DELETE"}).catch((m)=>m);if(j instanceof Error){u(!1,`Remove: the host did not answer (${j.message})`);return}if(j.ok)G();else u(!1,`Remove: ${await K0(j)}`)},h=K.state==="ok"?K.data.twins:[],E={gated:"gated: a person deploys an approved changeset",auto:"auto: a push deploys at once",hold:"hold: nothing deploys"};return $.jsxDEV($.Fragment,{children:[$.jsxDEV(B2,{log:w,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(MF,{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:[h.some((j)=>j.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(U0,{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:h.map((j)=>{let m=j.root;return $.jsxDEV("tr",{children:[$.jsxDEV("td",{children:$.jsxDEV("span",{className:"vendor-cell",children:[$.jsxDEV(l1,{vendor:j.twin},void 0,!1,void 0,this),$.jsxDEV("a",{href:`${A1}/${_}/${j.twin}`,title:`Its log and stored state · ${j.position??0} entries`,onClick:(I)=>{I.preventDefault(),j1([..._.split("/"),j.twin])},children:B1(j.twin)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.jsxDEV("td",{children:m?.url?$.jsxDEV("code",{children:m.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:m?.url?E[m.deploy??""]??m.deploy??"—":"—"},void 0,!1,void 0,this),$.jsxDEV("td",{children:j.refresh?.failed?$.jsxDEV("span",{role:"alert",children:["failed ×",j.refresh.failed.count??1,": ",j.refresh.failed.reason??""]},void 0,!0,void 0,this):m?.url?h2(j.refresh?.observedAt??j.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(m?.url??""),v(m?.deploy==="auto"||m?.deploy==="hold"?m.deploy:"gated"),M(j)},children:m?.url?"Change…":"Connect…"},void 0,!1,void 0,this),$.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 ${B1(j.twin)} now?`,body:`The real ${B1(j.twin)}'s current state is read into this World. Nothing is written to ${B1(j.twin)}.`,action:"Read from it"}).then((I)=>{if(I)i(`Read from ${B1(j.twin)}`,`/-/${_}/twins/${j.twin}/refresh`,{method:"POST"})}),children:"Read from it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},j.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(nZ,{name:_,token:Q,clock:W,canWrite:q,onChanged:()=>z((j)=>j+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(U0,{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((j)=>$.jsxDEV("tr",{children:$.jsxDEV("td",{children:$.jsxDEV("code",{children:j},void 0,!1,void 0,this)},void 0,!1,void 0,this)},j,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,J&&!Z?$.jsxDEV("div",{className:"danger",role:"region","aria-label":"Danger zone",children:[$.jsxDEV("h3",{children:"Danger zone"},void 0,!1,void 0,this),A?$.jsxDEV("p",{role:"status",children:["token ",$.jsxDEV("code",{children:A.token},void 0,!1,void 0,this)," · read token ",$.jsxDEV("code",{children:A.readToken},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,$.jsxDEV("p",{children:[$.jsxDEV("button",{type:"button",onClick:()=>void S(),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(W0,{open:Boolean(B),onClose:()=>{if(!N)M(null)},title:`Connect ${B?B1(B.twin):""} to its real service`,footer:$.jsxDEV($.Fragment,{children:[$.jsxDEV("button",{type:"button",onClick:()=>M(null),disabled:N,children:"Cancel"},void 0,!1,void 0,this),$.jsxDEV("button",{type:"submit",form:"connect-root",className:"primary",disabled:N,children:N?"Saving…":P.trim()?"Connect":"Disconnect"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:$.jsxDEV("form",{id:"connect-root",className:"stack",onSubmit:(j)=>void l(j),children:[$.jsxDEV("label",{children:[$.jsxDEV("span",{children:"The real service's API address"},void 0,!1,void 0,this),$.jsxDEV("input",{name:"rootUrl",value:P,onChange:(j)=>C(j.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:(j)=>v(j.target.value==="auto"?"auto":j.target.value==="hold"?"hold":"gated"),children:["gated","auto","hold"].map((j)=>$.jsxDEV("option",{value:j,children:E[j]},j,!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 JM(){return $.jsxDEV($.Fragment,{children:[$.jsxDEV(hZ,{},void 0,!1,void 0,this),$.jsxDEV(h_,{},void 0,!1,void 0,this),$.jsxDEV(u_,{},void 0,!1,void 0,this),$.jsxDEV(V_,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{QM as openAt,a5 as ROOT,JM as ConsolePage};
|